From 073edf93c8a4e7096a2d7591e6c9989c9e4696e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8C=E8=B4=A7=E6=9C=BA=E5=99=A8=E4=BA=BA?= Date: Fri, 19 Nov 2021 17:34:39 +0800 Subject: [PATCH] docs: Use dumi (#674) * docs: Use dumi * chore: add ignore * chore: fix lint * chore: ignore debug * chore: rm debug.md --- .gitignore | 3 +++ .umirc.ts | 19 +++++++++++++++++++ README.md | 8 ++++---- docs/demo/auto-adjust-dropdown.md | 2 ++ docs/demo/combobox.md | 2 ++ docs/demo/controlled.md | 2 ++ docs/demo/custom-icon.md | 2 ++ docs/demo/custom-selector.md | 2 ++ docs/demo/custom-tags.md | 2 ++ docs/demo/dropdownRender.md | 2 ++ docs/demo/email.md | 2 ++ docs/demo/filterSort.md | 2 ++ docs/demo/force-suggest.md | 2 ++ docs/demo/getPopupContainer.md | 2 ++ docs/demo/loading.md | 2 ++ docs/demo/mul-suggest.md | 2 ++ docs/demo/mul-tag-suggest.md | 2 ++ docs/demo/multiple-readonly.md | 2 ++ docs/demo/multiple.md | 2 ++ docs/demo/optgroup.md | 2 ++ docs/demo/optionFilterProp.md | 2 ++ docs/demo/optionLabelProp.md | 2 ++ docs/demo/single-animation.md | 2 ++ docs/demo/single.md | 2 ++ docs/demo/singleFieldNames.md | 2 ++ docs/demo/suggest.md | 2 ++ docs/demo/tags.md | 2 ++ docs/demo/update-option.md | 2 ++ .../examples}/auto-adjust-dropdown.tsx | 4 ++-- {examples => docs/examples}/combobox.tsx | 4 ++-- {examples => docs/examples}/common.less | 0 .../examples}/common/tbFetchSuggest.tsx | 0 {examples => docs/examples}/controlled.tsx | 4 ++-- {examples => docs/examples}/custom-icon.tsx | 4 ++-- .../examples}/custom-selector.tsx | 4 ++-- {examples => docs/examples}/custom-tags.tsx | 4 ++-- .../examples}/dropdownRender.tsx | 4 ++-- {examples => docs/examples}/email.tsx | 4 ++-- {examples => docs/examples}/filterSort.tsx | 4 ++-- {examples => docs/examples}/force-suggest.tsx | 4 ++-- .../examples}/getPopupContainer.tsx | 4 ++-- {examples => docs/examples}/loading.tsx | 4 ++-- {examples => docs/examples}/mul-suggest.tsx | 4 ++-- .../examples}/mul-tag-suggest.tsx | 4 ++-- .../examples}/multiple-readonly.tsx | 4 ++-- {examples => docs/examples}/multiple.tsx | 4 ++-- {examples => docs/examples}/optgroup.tsx | 4 ++-- .../examples}/optionFilterProp.tsx | 4 ++-- .../examples}/optionLabelProp.tsx | 4 ++-- .../examples}/single-animation.tsx | 4 ++-- {examples => docs/examples}/single.less | 0 {examples => docs/examples}/single.tsx | 4 ++-- .../examples}/singleFieldNames.tsx | 4 ++-- {examples => docs/examples}/suggest.tsx | 4 ++-- {examples => docs/examples}/tags.tsx | 4 ++-- {examples => docs/examples}/update-option.tsx | 4 ++-- package.json | 7 ++++--- tsconfig.json | 2 +- 58 files changed, 131 insertions(+), 58 deletions(-) create mode 100644 .umirc.ts create mode 100644 docs/demo/auto-adjust-dropdown.md create mode 100644 docs/demo/combobox.md create mode 100644 docs/demo/controlled.md create mode 100644 docs/demo/custom-icon.md create mode 100644 docs/demo/custom-selector.md create mode 100644 docs/demo/custom-tags.md create mode 100644 docs/demo/dropdownRender.md create mode 100644 docs/demo/email.md create mode 100644 docs/demo/filterSort.md create mode 100644 docs/demo/force-suggest.md create mode 100644 docs/demo/getPopupContainer.md create mode 100644 docs/demo/loading.md create mode 100644 docs/demo/mul-suggest.md create mode 100644 docs/demo/mul-tag-suggest.md create mode 100644 docs/demo/multiple-readonly.md create mode 100644 docs/demo/multiple.md create mode 100644 docs/demo/optgroup.md create mode 100644 docs/demo/optionFilterProp.md create mode 100644 docs/demo/optionLabelProp.md create mode 100644 docs/demo/single-animation.md create mode 100644 docs/demo/single.md create mode 100644 docs/demo/singleFieldNames.md create mode 100644 docs/demo/suggest.md create mode 100644 docs/demo/tags.md create mode 100644 docs/demo/update-option.md rename {examples => docs/examples}/auto-adjust-dropdown.tsx (97%) rename {examples => docs/examples}/combobox.tsx (97%) rename {examples => docs/examples}/common.less (100%) rename {examples => docs/examples}/common/tbFetchSuggest.tsx (100%) rename {examples => docs/examples}/controlled.tsx (96%) rename {examples => docs/examples}/custom-icon.tsx (98%) rename {examples => docs/examples}/custom-selector.tsx (82%) rename {examples => docs/examples}/custom-tags.tsx (97%) rename {examples => docs/examples}/dropdownRender.tsx (96%) rename {examples => docs/examples}/email.tsx (93%) rename {examples => docs/examples}/filterSort.tsx (92%) rename {examples => docs/examples}/force-suggest.tsx (95%) rename {examples => docs/examples}/getPopupContainer.tsx (94%) rename {examples => docs/examples}/loading.tsx (95%) rename {examples => docs/examples}/mul-suggest.tsx (93%) rename {examples => docs/examples}/mul-tag-suggest.tsx (94%) rename {examples => docs/examples}/multiple-readonly.tsx (93%) rename {examples => docs/examples}/multiple.tsx (96%) rename {examples => docs/examples}/optgroup.tsx (91%) rename {examples => docs/examples}/optionFilterProp.tsx (91%) rename {examples => docs/examples}/optionLabelProp.tsx (88%) rename {examples => docs/examples}/single-animation.tsx (91%) rename {examples => docs/examples}/single.less (100%) rename {examples => docs/examples}/single.tsx (97%) rename {examples => docs/examples}/singleFieldNames.tsx (91%) rename {examples => docs/examples}/suggest.tsx (95%) rename {examples => docs/examples}/tags.tsx (97%) rename {examples => docs/examples}/update-option.tsx (94%) diff --git a/.gitignore b/.gitignore index 9b0000159..68d284393 100644 --- a/.gitignore +++ b/.gitignore @@ -22,6 +22,7 @@ node_modules .cache dist debug.tsx +debug.md assets/**/*.css build lib @@ -37,3 +38,5 @@ tsconfig.test.json .prettierignore .storybook storybook/index.js +.doc +.umi \ No newline at end of file diff --git a/.umirc.ts b/.umirc.ts new file mode 100644 index 000000000..30754d85f --- /dev/null +++ b/.umirc.ts @@ -0,0 +1,19 @@ +// more config: https://d.umijs.org/config +import { defineConfig } from 'dumi'; + +export default defineConfig({ + title: 'rc-select', + favicon: + 'https://avatars0.githubusercontent.com/u/9441414?s=200&v=4', + logo: + 'https://avatars0.githubusercontent.com/u/9441414?s=200&v=4', + outputPath: '.doc', + exportStatic: {}, + styles: [ + ` + .markdown table { + width: auto !important; + } + `, + ] +}); \ No newline at end of file diff --git a/README.md b/README.md index 8d99f55b5..e500f50d5 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ React Select ### basic use -```js +```jsx | pure import Select, { Option } from 'rc-select'; export default () => ( @@ -102,11 +102,11 @@ export default () => ( | optionFilterProp | which prop value of option will be used for filter if filterOption is true | String | 'value' | | filterSort | Sort function for search options sorting, see [Array.sort](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort)'s compareFunction. | Function(optionA:Option, optionB: Option) | - | | optionLabelProp | render option value or option children as content of select | String: 'value'/'children' | 'value' | -| defaultValue | initial selected option(s) | String/Array | - | -| value | current selected option(s) | String/Array/{key:String, label:React.Node}/Array<{key, label}> | - | +| defaultValue | initial selected option(s) | String \| String[] | - | +| value | current selected option(s) | String \| String[] \| {key:String, label:React.Node} \| {key:String, label:React.Node}[] | - | | labelInValue | whether to embed label in value, see above value type. Not support `combobox` mode | Bool | false | | backfill | whether backfill select option to search input (Only works in single and combobox mode) | Bool | false | -| onChange | called when select an option or input value change(combobox) | function(value, option:Option/Array