Skip to content

Commit

Permalink
chore: dumi 1.x -> 2.x (#391)
Browse files Browse the repository at this point in the history
* chore: dumi 1.x -> 2.x

* chore: update dep
  • Loading branch information
kiner-tang authored Feb 20, 2023
1 parent a2f197f commit d14633b
Show file tree
Hide file tree
Showing 45 changed files with 167 additions and 76 deletions.
14 changes: 14 additions & 0 deletions .dumirc.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { defineConfig } from 'dumi';
import path from 'path';

export default defineConfig({
alias: {
'rc-cascader$': path.resolve('src'),
'rc-cascader/es': path.resolve('src'),
},
favicons: ['https://avatars0.githubusercontent.com/u/9441414?s=200&v=4'],
themeConfig: {
name: 'Cascader',
logo: 'https://avatars0.githubusercontent.com/u/9441414?s=200&v=4',
},
});
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,7 @@ coverage
.umi-test
.env.local
.doc

# dumi
.dumi/tmp
.dumi/tmp-production
4 changes: 0 additions & 4 deletions .umirc.gh.ts

This file was deleted.

21 changes: 0 additions & 21 deletions .umirc.ts

This file was deleted.

1 change: 1 addition & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<embed src="../CHANGELOG.md"></embed>
9 changes: 7 additions & 2 deletions docs/demo/adjust-overflow.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## adjust-overflow
---
title: adjust-overflow
nav:
title: Demo
path: /demo
---

<code src="../../examples/adjust-overflow.jsx">
<code src="../../examples/adjust-overflow.tsx"></code>
9 changes: 7 additions & 2 deletions docs/demo/animation.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## animation
---
title: animation
nav:
title: Demo
path: /demo
---

<code src="../../examples/animation.jsx">
<code src="../../examples/animation.tsx"></code>
9 changes: 7 additions & 2 deletions docs/demo/change-on-select.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## change-on-select
---
title: change-on-select
nav:
title: Demo
path: /demo
---

<code src="../../examples/change-on-select.jsx">
<code src="../../examples/change-on-select.tsx"></code>
9 changes: 7 additions & 2 deletions docs/demo/custom-arrow-icon.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## custom-arrow-icon
---
title: custom-arrow-icon
nav:
title: Demo
path: /demo
---

<code src="../../examples/custom-arrow-icon.jsx">
<code src="../../examples/custom-arrow-icon.tsx"></code>
9 changes: 7 additions & 2 deletions docs/demo/custom-field-name.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## custom-field-name
---
title: custom-field-name
nav:
title: Demo
path: /demo
---

<code src="../../examples/custom-field-name.jsx">
<code src="../../examples/custom-field-name.tsx"></code>
9 changes: 7 additions & 2 deletions docs/demo/debug.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## debug
---
title: debug
nav:
title: Demo
path: /demo
---

<code src="../../examples/debug.tsx">
<code src="../../examples/debug.tsx"></code>
9 changes: 7 additions & 2 deletions docs/demo/default-expand-single-option.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## default-expand-single-option
---
title: default-expand-single-option
nav:
title: Demo
path: /demo
---

<code src="../../examples/default-expand-single-option.jsx">
<code src="../../examples/default-expand-single-option.tsx"></code>
9 changes: 7 additions & 2 deletions docs/demo/defaultValue.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## defaultValue
---
title: defaultValue
nav:
title: Demo
path: /demo
---

<code src="../../examples/defaultValue.jsx">
<code src="../../examples/defaultValue.tsx"></code>
9 changes: 7 additions & 2 deletions docs/demo/disabled.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## disabled
---
title: disabled
nav:
title: Demo
path: /demo
---

<code src="../../examples/disabled.jsx">
<code src="../../examples/disabled.tsx"></code>
9 changes: 7 additions & 2 deletions docs/demo/dropdown-render.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## dropdown-render
---
title: dropdown-render
nav:
title: Demo
path: /demo
---

<code src="../../examples/dropdown-render.jsx">
<code src="../../examples/dropdown-render.tsx"></code>
9 changes: 7 additions & 2 deletions docs/demo/dynamic-options.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## dynamic-options
---
title: dynamic-options
nav:
title: Demo
path: /demo
---

<code src="../../examples/dynamic-options.jsx">
<code src="../../examples/dynamic-options.tsx"></code>
9 changes: 7 additions & 2 deletions docs/demo/hover.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## hover
---
title: hover
nav:
title: Demo
path: /demo
---

<code src="../../examples/hover.jsx">
<code src="../../examples/hover.tsx"></code>
9 changes: 7 additions & 2 deletions docs/demo/multiple.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## multiple
---
title: multiple
nav:
title: Demo
path: /demo
---

<code src="../../examples/multiple.tsx">
<code src="../../examples/multiple.tsx"></code>
9 changes: 7 additions & 2 deletions docs/demo/rc-form.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## rc-form
---
title: rc-form
nav:
title: Demo
path: /demo
---

<code src="../../examples/rc-form.jsx">
<code src="../../examples/rc-form.tsx"></code>
9 changes: 7 additions & 2 deletions docs/demo/simple.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## simple
---
title: animated
nav:
title: Demo
path: /demo
---

<code src="../../examples/simple.jsx">
<code src="../../examples/simple.tsx"></code>
9 changes: 7 additions & 2 deletions docs/demo/text-trigger.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## text-trigger
---
title: text-trigger
nav:
title: Demo
path: /demo
---

<code src="../../examples/text-trigger.jsx">
<code src="../../examples/text-trigger.tsx">
9 changes: 7 additions & 2 deletions docs/demo/value.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## value
---
title: value
nav:
title: Demo
path: /demo
---

<code src="../../examples/value.jsx">
<code src="../../examples/value.tsx"></code>
9 changes: 7 additions & 2 deletions docs/demo/visible.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## visible
---
title: visible
nav:
title: Demo
path: /demo
---

<code src="../../examples/visible.jsx">
<code src="../../examples/visible.tsx"></code>
4 changes: 3 additions & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
---
title: rc-cascader
hero:
title: rc-cascader
description: React cascader Component
---

<embed src="../README.md"></embed>
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* eslint-disable no-console, react/prop-types */
import type { BuildInPlacements } from 'rc-trigger/lib/interface';
import React from 'react';
import '../assets/index.less';
import Cascader from '../src';
Expand Down Expand Up @@ -57,7 +58,7 @@ const addressOptions = [
},
];

class MyCascader extends React.Component {
class MyCascader extends React.Component<{ builtinPlacements?: BuildInPlacements }> {
state = {
inputValue: '',
};
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 5 additions & 5 deletions examples/rc-form.jsx → examples/rc-form.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* eslint-disable no-console, react/no-multi-comp, react/prop-types, react/button-has-type,prefer-destructuring,max-len, max-classes-per-file */
import React, { Component } from 'react';
import arrayTreeFilter from 'array-tree-filter';
import { createForm } from 'rc-form';
import { Component } from 'react';
import '../assets/index.less';
import arrayTreeFilter from 'array-tree-filter';
import Cascader from '../src';

const addressOptions = [
Expand Down Expand Up @@ -59,7 +59,7 @@ const addressOptions = [
];

class CascaderInput extends Component {
onChange = (value) => {
onChange = value => {
const props = this.props;
if (props.onChange) {
props.onChange(value);
Expand All @@ -70,7 +70,7 @@ class CascaderInput extends Component {
const props = this.props;
const value = props.value || [];
return arrayTreeFilter(props.options, (o, level) => o.value === value[level])
.map((o) => o.label)
.map(o => o.label)
.join(', ');
}

Expand All @@ -85,7 +85,7 @@ class CascaderInput extends Component {
}

class Form extends Component {
onSubmit = (e) => {
onSubmit = e => {
const props = this.props;
const { form } = props;
e.preventDefault();
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion examples/value.jsx → examples/value.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable no-console,react/button-has-type */
import React from 'react';
import arrayTreeFilter from 'array-tree-filter';
import React from 'react';
import '../assets/index.less';
import Cascader from '../src';

Expand Down
2 changes: 1 addition & 1 deletion examples/visible.jsx → examples/visible.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable no-console */
import React from 'react';
import arrayTreeFilter from 'array-tree-filter';
import React from 'react';
import '../assets/index.less';
import Cascader from '../src';

Expand Down
2 changes: 1 addition & 1 deletion now.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{
"src": "package.json",
"use": "@now/static-build",
"config": { "distDir": ".doc" }
"config": { "distDir": "dist" }
}
],
"routes": [
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"@types/react-dom": "^17.0.11",
"@types/warning": "^3.0.0",
"cross-env": "^7.0.0",
"dumi": "^1.1.12",
"dumi": "^2.1.10",
"enzyme": "^3.3.0",
"enzyme-adapter-react-16": "^1.0.2",
"enzyme-to-json": "^3.2.1",
Expand All @@ -61,7 +61,8 @@
"rc-trigger": "^5.0.4",
"react": "^16.0.0",
"react-dom": "^16.0.0",
"typescript": "^4.4.2"
"typescript": "^4.4.2",
"less": "^3.13.1"
},
"dependencies": {
"@babel/runtime": "^7.12.5",
Expand Down
2 changes: 2 additions & 0 deletions src/Cascader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { BaseSelect } from 'rc-select';
import type { DisplayValueType, Placement } from 'rc-select/lib/BaseSelect';
import useId from 'rc-select/lib/hooks/useId';
import { conductCheck } from 'rc-tree/lib/utils/conductUtil';
import type { BuildInPlacements } from 'rc-trigger/lib/interface';
import useMergedState from 'rc-util/lib/hooks/useMergedState';
import * as React from 'react';
import CascaderContext from './context';
Expand Down Expand Up @@ -100,6 +101,7 @@ interface BaseCascaderProps<OptionType extends BaseOptionType = DefaultOptionTyp
/** @deprecated Use `placement` instead */
popupPlacement?: Placement;
placement?: Placement;
builtinPlacements?: BuildInPlacements;

/** @deprecated Use `onDropdownVisibleChange` instead */
onPopupVisibleChange?: (open: boolean) => void;
Expand Down
6 changes: 4 additions & 2 deletions tests/demoOptions.js → tests/demoOptions.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
export const optionsForActiveMenuItems = [
import type { DefaultOptionType } from '@/Cascader';

export const optionsForActiveMenuItems: DefaultOptionType[] = [
{
value: '1',
label: '1',
Expand Down Expand Up @@ -33,7 +35,7 @@ export const optionsForActiveMenuItems = [
},
];

export const addressOptions = [
export const addressOptions: DefaultOptionType[] = [
{
label: '福建',
value: 'fj',
Expand Down
1 change: 0 additions & 1 deletion tests/keyboard.spec.js → tests/keyboard.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { mount } from 'enzyme';
import KeyCode from 'rc-util/lib/KeyCode';
import Cascader from '../src';
Expand Down

1 comment on commit d14633b

@vercel
Copy link

@vercel vercel bot commented on d14633b Feb 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

cascader – ./

cascader-git-master-react-component.vercel.app
cascader-react-component.vercel.app

Please sign in to comment.