@douyinfe/semi-ui 2.19.1-alpha.2 → 2.19.2-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/css/semi.css +88 -148
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +3219 -177
- package/dist/umd/semi-ui.js.map +1 -1
- package/dist/umd/semi-ui.min.js +1 -1
- package/dist/umd/semi-ui.min.js.map +1 -1
- package/lib/cjs/_base/base.css +1 -0
- package/lib/cjs/anchor/index.d.ts +4 -0
- package/lib/cjs/anchor/index.js +36 -1
- package/lib/cjs/anchor/link.d.ts +2 -0
- package/lib/cjs/anchor/link.js +8 -2
- package/lib/cjs/avatar/index.d.ts +1 -0
- package/lib/cjs/avatar/index.js +2 -1
- package/lib/cjs/button/Button.d.ts +1 -1
- package/lib/cjs/button/buttonGroup.d.ts +1 -0
- package/lib/cjs/button/buttonGroup.js +42 -3
- package/lib/cjs/button/index.d.ts +2 -1
- package/lib/cjs/button/index.js +1 -0
- package/lib/cjs/carousel/CarouselIndicator.d.ts +1 -1
- package/lib/cjs/carousel/index.d.ts +1 -1
- package/lib/cjs/checkbox/checkbox.d.ts +1 -0
- package/lib/cjs/checkbox/checkbox.js +19 -10
- package/lib/cjs/checkbox/checkboxGroup.js +2 -1
- package/lib/cjs/datePicker/dateInput.d.ts +1 -1
- package/lib/cjs/datePicker/datePicker.d.ts +1 -1
- package/lib/cjs/datePicker/monthsGrid.d.ts +1 -1
- package/lib/cjs/dropdown/index.js +5 -1
- package/lib/cjs/form/baseForm.d.ts +1 -1
- package/lib/cjs/form/field.d.ts +1 -1
- package/lib/cjs/popconfirm/index.d.ts +4 -2
- package/lib/cjs/popconfirm/index.js +49 -31
- package/lib/cjs/radio/radio.d.ts +2 -1
- package/lib/cjs/radio/radio.js +22 -13
- package/lib/cjs/radio/radioGroup.d.ts +1 -1
- package/lib/cjs/radio/radioGroup.js +1 -1
- package/lib/cjs/tag/group.js +14 -12
- package/lib/cjs/tag/index.d.ts +1 -1
- package/lib/cjs/tag/index.js +1 -1
- package/lib/cjs/timePicker/TimePicker.d.ts +2 -2
- package/lib/cjs/timePicker/TimeShape.d.ts +1 -1
- package/lib/cjs/timePicker/index.d.ts +2 -2
- package/lib/cjs/tooltip/index.js +2 -2
- package/lib/cjs/typography/base.d.ts +1 -1
- package/lib/cjs/typography/paragraph.d.ts +1 -1
- package/lib/cjs/typography/text.d.ts +1 -1
- package/lib/cjs/typography/title.d.ts +2 -2
- package/lib/cjs/upload/index.d.ts +1 -1
- package/lib/es/_base/base.css +1 -0
- package/lib/es/anchor/index.d.ts +4 -0
- package/lib/es/anchor/index.js +35 -1
- package/lib/es/anchor/link.d.ts +2 -0
- package/lib/es/anchor/link.js +8 -2
- package/lib/es/avatar/index.d.ts +1 -0
- package/lib/es/avatar/index.js +2 -1
- package/lib/es/button/Button.d.ts +1 -1
- package/lib/es/button/buttonGroup.d.ts +1 -0
- package/lib/es/button/buttonGroup.js +41 -1
- package/lib/es/button/index.d.ts +2 -1
- package/lib/es/button/index.js +1 -0
- package/lib/es/carousel/CarouselIndicator.d.ts +1 -1
- package/lib/es/carousel/index.d.ts +1 -1
- package/lib/es/checkbox/checkbox.d.ts +1 -0
- package/lib/es/checkbox/checkbox.js +19 -10
- package/lib/es/checkbox/checkboxGroup.js +2 -1
- package/lib/es/datePicker/dateInput.d.ts +1 -1
- package/lib/es/datePicker/datePicker.d.ts +1 -1
- package/lib/es/datePicker/monthsGrid.d.ts +1 -1
- package/lib/es/dropdown/index.js +7 -1
- package/lib/es/form/baseForm.d.ts +1 -1
- package/lib/es/form/field.d.ts +1 -1
- package/lib/es/popconfirm/index.d.ts +4 -2
- package/lib/es/popconfirm/index.js +49 -31
- package/lib/es/radio/radio.d.ts +2 -1
- package/lib/es/radio/radio.js +22 -13
- package/lib/es/radio/radioGroup.d.ts +1 -1
- package/lib/es/radio/radioGroup.js +1 -1
- package/lib/es/tag/group.js +14 -12
- package/lib/es/tag/index.d.ts +1 -1
- package/lib/es/tag/index.js +1 -1
- package/lib/es/timePicker/TimePicker.d.ts +2 -2
- package/lib/es/timePicker/TimeShape.d.ts +1 -1
- package/lib/es/timePicker/index.d.ts +2 -2
- package/lib/es/tooltip/index.js +2 -2
- package/lib/es/typography/base.d.ts +1 -1
- package/lib/es/typography/paragraph.d.ts +1 -1
- package/lib/es/typography/text.d.ts +1 -1
- package/lib/es/typography/title.d.ts +2 -2
- package/lib/es/upload/index.d.ts +1 -1
- package/package.json +12 -8
- package/_base/_story/a11y.jsx +0 -1302
- package/_base/_story/a11y.scss +0 -48
- package/_base/_story/index.scss +0 -11
- package/_base/_story/index.stories.js +0 -116
- package/_base/_story/index.stories.tsx +0 -55
- package/_base/base.scss +0 -3
- package/_base/base.ts +0 -36
- package/_base/baseComponent.tsx +0 -79
- package/_base/reactUtils.ts +0 -43
- package/_portal/_story/portal.stories.js +0 -13
- package/_portal/index.tsx +0 -113
- package/_test_/utils/dom/index.js +0 -9
- package/_test_/utils/function/index.js +0 -1
- package/_test_/utils/function/sleep.js +0 -9
- package/_test_/utils/index.js +0 -4
- package/_test_/utils/table/index.js +0 -310
- package/_test_/utils/tooltip/index.js +0 -39
- package/_utils/hooks/usePrevFocus.ts +0 -17
- package/_utils/index.ts +0 -198
- package/anchor/__test__/anchor.test.js +0 -60
- package/anchor/_story/anchor.stories.js +0 -288
- package/anchor/_story/anchor.stories.tsx +0 -165
- package/anchor/anchor-context.ts +0 -13
- package/anchor/index.tsx +0 -300
- package/anchor/link.tsx +0 -161
- package/autoComplete/__test__/autoComplete.test.js +0 -456
- package/autoComplete/_story/CustomTrigger/index.jsx +0 -106
- package/autoComplete/_story/autoComplete.stories.js +0 -348
- package/autoComplete/_story/autoComplete.stories.tsx +0 -87
- package/autoComplete/index.tsx +0 -504
- package/autoComplete/option.tsx +0 -164
- package/avatar/__test__/avatar.test.js +0 -363
- package/avatar/__test__/avatarGroup.test.js +0 -193
- package/avatar/_story/Demo.tsx +0 -22
- package/avatar/_story/avatar.stories.js +0 -248
- package/avatar/_story/avatar.stories.tsx +0 -7
- package/avatar/avatarGroup.tsx +0 -93
- package/avatar/index.tsx +0 -236
- package/avatar/interface.ts +0 -51
- package/backtop/__test__/backtop.test.js +0 -49
- package/backtop/_story/backtop.stories.js +0 -37
- package/backtop/_story/backtop.stories.tsx +0 -30
- package/backtop/index.tsx +0 -117
- package/badge/__test__/badge.test.js +0 -123
- package/badge/_story/Demo.tsx +0 -16
- package/badge/_story/badge.stories.js +0 -123
- package/badge/_story/badge.stories.tsx +0 -8
- package/badge/index.tsx +0 -91
- package/banner/__test__/banner.test.js +0 -58
- package/banner/_story/Demo.tsx +0 -14
- package/banner/_story/banner.stories.js +0 -106
- package/banner/_story/banner.stories.tsx +0 -8
- package/banner/index.tsx +0 -174
- package/breadcrumb/__test__/breadcrumb.test.js +0 -219
- package/breadcrumb/_story/Demo.tsx +0 -24
- package/breadcrumb/_story/breadcrumb.stories.js +0 -331
- package/breadcrumb/_story/breadcrumb.stories.tsx +0 -45
- package/breadcrumb/bread-context.tsx +0 -13
- package/breadcrumb/index.tsx +0 -302
- package/breadcrumb/item.tsx +0 -215
- package/button/Button.tsx +0 -133
- package/button/__test__/button.test.js +0 -71
- package/button/_story/Demo.tsx +0 -51
- package/button/_story/button.stories.js +0 -293
- package/button/_story/button.stories.tsx +0 -10
- package/button/buttonGroup.tsx +0 -56
- package/button/index.tsx +0 -38
- package/button/splitButtonGroup.tsx +0 -30
- package/calendar/__test__/calendar.test.js +0 -182
- package/calendar/_story/Demo.tsx +0 -20
- package/calendar/_story/calendar.stories.js +0 -560
- package/calendar/_story/calendar.stories.tsx +0 -5
- package/calendar/dayCalendar.tsx +0 -191
- package/calendar/dayCol.tsx +0 -156
- package/calendar/index.tsx +0 -63
- package/calendar/interface.ts +0 -43
- package/calendar/monthCalendar.tsx +0 -400
- package/calendar/rangeCalendar.tsx +0 -270
- package/calendar/timeCol.tsx +0 -64
- package/calendar/weekCalendar.tsx +0 -271
- package/card/__test__/card.test.js +0 -202
- package/card/_story/card.stories.js +0 -562
- package/card/_story/card.stories.tsx +0 -103
- package/card/cardGroup.tsx +0 -64
- package/card/index.tsx +0 -249
- package/card/meta.tsx +0 -73
- package/carousel/CarouselArrow.tsx +0 -64
- package/carousel/CarouselIndicator.tsx +0 -83
- package/carousel/__test__/carousel.test.js +0 -159
- package/carousel/_story/carousel.stories.js +0 -486
- package/carousel/index.tsx +0 -293
- package/carousel/interface.ts +0 -63
- package/cascader/__test__/cascader.test.js +0 -1356
- package/cascader/_story/CustomTrigger/index.jsx +0 -63
- package/cascader/_story/Demo.tsx +0 -63
- package/cascader/_story/cascader.stories.js +0 -1585
- package/cascader/_story/cascader.stories.tsx +0 -6
- package/cascader/index.tsx +0 -999
- package/cascader/item.tsx +0 -328
- package/checkbox/__test__/checkbox.test.js +0 -85
- package/checkbox/__test__/checkboxGroup.test.js +0 -180
- package/checkbox/_story/Demo.tsx +0 -27
- package/checkbox/_story/checkbox.stories.js +0 -1022
- package/checkbox/_story/checkbox.stories.tsx +0 -8
- package/checkbox/checkbox.tsx +0 -290
- package/checkbox/checkboxGroup.tsx +0 -197
- package/checkbox/checkboxInner.tsx +0 -129
- package/checkbox/context.ts +0 -14
- package/checkbox/index.tsx +0 -19
- package/collapse/__test__/collapse.test.js +0 -168
- package/collapse/_story/Demo.tsx +0 -28
- package/collapse/_story/accordion.stories.js +0 -143
- package/collapse/_story/accordion.stories.tsx +0 -8
- package/collapse/collapse-context.tsx +0 -18
- package/collapse/index.tsx +0 -120
- package/collapse/item.tsx +0 -163
- package/collapsible/_story/Demo.tsx +0 -41
- package/collapsible/_story/Nested/index.js +0 -101
- package/collapsible/_story/collapsible.stories.js +0 -588
- package/collapsible/_story/collapsible.stories.tsx +0 -7
- package/collapsible/index.tsx +0 -165
- package/configProvider/_story/ChangeTimeZone/index.js +0 -183
- package/configProvider/_story/GetPopupContainer/index.js +0 -194
- package/configProvider/_story/RTLDirection/RTLForm.jsx +0 -313
- package/configProvider/_story/RTLDirection/RTLTable.jsx +0 -94
- package/configProvider/_story/RTLDirection/RTLWrapper.tsx +0 -27
- package/configProvider/_story/configProvider.stories.js +0 -30
- package/configProvider/_story/configProvider.stories.tsx +0 -27
- package/configProvider/context.tsx +0 -14
- package/configProvider/index.tsx +0 -48
- package/datePicker/__test__/datePicker.test.js +0 -1065
- package/datePicker/_story/AllTypes/index.js +0 -19
- package/datePicker/_story/AutoSwitchDate/index.jsx +0 -14
- package/datePicker/_story/Autofocus/index.js +0 -11
- package/datePicker/_story/BetterRangePicker/index.jsx +0 -172
- package/datePicker/_story/Callbacks/index.jsx +0 -24
- package/datePicker/_story/ControlledDemo/index.js +0 -149
- package/datePicker/_story/CustomTrigger/index.jsx +0 -36
- package/datePicker/_story/Cycled/index.jsx +0 -11
- package/datePicker/_story/DateOffset/index.js +0 -83
- package/datePicker/_story/DatePickerSlot/index.jsx +0 -83
- package/datePicker/_story/DatePickerSlot/index.scss +0 -7
- package/datePicker/_story/DatePickerTimeZone/index.jsx +0 -27
- package/datePicker/_story/Density/index.jsx +0 -69
- package/datePicker/_story/DisabledDate/index.js +0 -189
- package/datePicker/_story/ExceptionDemo/index.js +0 -20
- package/datePicker/_story/Multiple/index.jsx +0 -24
- package/datePicker/_story/NeedConfirm/index.jsx +0 -94
- package/datePicker/_story/OnChangeWithDateFirst/index.jsx +0 -37
- package/datePicker/_story/OverPopover/index.jsx +0 -22
- package/datePicker/_story/RenderDate/index.js +0 -31
- package/datePicker/_story/RenderFullDate/index.js +0 -78
- package/datePicker/_story/RenderFullDate/index.scss +0 -23
- package/datePicker/_story/SyncSwitchMonth/index.js +0 -45
- package/datePicker/_story/TimePickerOpts/index.jsx +0 -16
- package/datePicker/_story/datePicker.stories.js +0 -1016
- package/datePicker/_story/datePicker.stories.tsx +0 -230
- package/datePicker/_story/v2/AutoFillTime.jsx +0 -37
- package/datePicker/_story/v2/FixDefaultPickerValue.jsx +0 -31
- package/datePicker/_story/v2/FixInputRangeFocus.jsx +0 -25
- package/datePicker/_story/v2/FixTriggerRender.tsx +0 -36
- package/datePicker/_story/v2/InputFormat.jsx +0 -29
- package/datePicker/_story/v2/InputFormatConfirm.jsx +0 -44
- package/datePicker/_story/v2/InputFormatDisabled.jsx +0 -27
- package/datePicker/_story/v2/InsetInput.jsx +0 -104
- package/datePicker/_story/v2/InsetInputE2E.jsx +0 -69
- package/datePicker/_story/v2/PanelOpen.jsx +0 -39
- package/datePicker/_story/v2/YearButton.jsx +0 -17
- package/datePicker/_story/v2/index.js +0 -11
- package/datePicker/dateInput.tsx +0 -455
- package/datePicker/datePicker.tsx +0 -796
- package/datePicker/footer.tsx +0 -29
- package/datePicker/index.tsx +0 -86
- package/datePicker/insetInput.tsx +0 -76
- package/datePicker/month.tsx +0 -395
- package/datePicker/monthsGrid.tsx +0 -649
- package/datePicker/navigation.tsx +0 -150
- package/datePicker/quickControl.tsx +0 -101
- package/datePicker/yearAndMonth.tsx +0 -254
- package/descriptions/__test__/descriptions.test.js +0 -193
- package/descriptions/_story/Demo.tsx +0 -36
- package/descriptions/_story/descriptions.stories.js +0 -145
- package/descriptions/_story/descriptions.stories.tsx +0 -6
- package/descriptions/descriptions-context.ts +0 -11
- package/descriptions/index.tsx +0 -82
- package/descriptions/item.tsx +0 -66
- package/divider/__test__/divider.test.js +0 -72
- package/divider/_story/Demo.tsx +0 -16
- package/divider/_story/divider.stories.js +0 -41
- package/divider/_story/divider.stories.tsx +0 -8
- package/divider/index.tsx +0 -76
- package/dropdown/__test__/dropdown.test.js +0 -308
- package/dropdown/_story/AutoClose/index.js +0 -120
- package/dropdown/_story/DisabledItem/index.js +0 -31
- package/dropdown/_story/InHoverElements/index.js +0 -25
- package/dropdown/_story/InHoverElements/index.scss +0 -16
- package/dropdown/_story/MultiDropdown/index.js +0 -34
- package/dropdown/_story/WrapAvatar/index.jsx +0 -10
- package/dropdown/_story/dropdown.stories.js +0 -331
- package/dropdown/_story/dropdown.stories.tsx +0 -28
- package/dropdown/_story/inTable/index.js +0 -194
- package/dropdown/context.ts +0 -13
- package/dropdown/dropdownDivider.tsx +0 -23
- package/dropdown/dropdownItem.tsx +0 -106
- package/dropdown/dropdownMenu.tsx +0 -51
- package/dropdown/dropdownTitle.tsx +0 -37
- package/dropdown/index.tsx +0 -257
- package/empty/__test__/empty.test.js +0 -63
- package/empty/_story/Demo.tsx +0 -10
- package/empty/_story/empty.stories.js +0 -53
- package/empty/_story/empty.stories.tsx +0 -8
- package/empty/index.tsx +0 -135
- package/form/__test__/arrayField.test.js +0 -204
- package/form/__test__/baseForm/baseForm.test.js +0 -628
- package/form/__test__/baseForm/onChange.test.js +0 -144
- package/form/__test__/errorMessage.test.js +0 -59
- package/form/__test__/field.test.js +0 -426
- package/form/__test__/formApi.test.js +0 -604
- package/form/__test__/group.test.js +0 -108
- package/form/__test__/hoc.test.js +0 -24
- package/form/__test__/label.test.js +0 -69
- package/form/__test__/section.test.js +0 -49
- package/form/__test__/slot.test.js +0 -108
- package/form/_story/Debug/bugDemo.jsx +0 -219
- package/form/_story/Debug/childDidMount.jsx +0 -30
- package/form/_story/Debug/myRadio.jsx +0 -32
- package/form/_story/DynamicField/arrayFieldDemo.jsx +0 -320
- package/form/_story/DynamicField/nestArrayField.jsx +0 -159
- package/form/_story/FieldProps/bigNumberFieldPath.jsx +0 -73
- package/form/_story/FieldProps/convert.jsx +0 -100
- package/form/_story/FieldProps/fieldRef.jsx +0 -74
- package/form/_story/FieldProps/helpAndExtra.jsx +0 -136
- package/form/_story/FieldProps/labelOptional.jsx +0 -30
- package/form/_story/FieldProps/pureField.jsx +0 -0
- package/form/_story/FieldProps/rulesUpdateDemo.js +0 -116
- package/form/_story/FormApi/arrayDemo.jsx +0 -94
- package/form/_story/FormApi/formApiDemo.jsx +0 -83
- package/form/_story/FormApi/resetDemo.jsx +0 -41
- package/form/_story/FormApi/setValuesDemo.jsx +0 -133
- package/form/_story/FormSubmit/index.tsx +0 -45
- package/form/_story/HOC/displayName.jsx +0 -19
- package/form/_story/HOC/withFieldDemo.jsx +0 -216
- package/form/_story/Hook/hookDemo.jsx +0 -195
- package/form/_story/Layout/layoutDemo.jsx +0 -348
- package/form/_story/Layout/modalFormDemo.jsx +0 -94
- package/form/_story/Layout/slotDemo.jsx +0 -126
- package/form/_story/Performance/performanceDemo.jsx +0 -440
- package/form/_story/Performance/selectUseReactNode.jsx +0 -110
- package/form/_story/Reference/inform.test.js +0 -110
- package/form/_story/Validate/validateDemo.jsx +0 -421
- package/form/_story/demo.jsx +0 -433
- package/form/_story/form.stories.js +0 -440
- package/form/_story/form.stories.tsx +0 -191
- package/form/arrayField.tsx +0 -200
- package/form/baseForm.tsx +0 -300
- package/form/context.tsx +0 -18
- package/form/errorMessage.tsx +0 -91
- package/form/field.tsx +0 -79
- package/form/group.tsx +0 -93
- package/form/hoc/withField.tsx +0 -604
- package/form/hoc/withFormApi.tsx +0 -11
- package/form/hoc/withFormState.tsx +0 -11
- package/form/hooks/index.ts +0 -12
- package/form/hooks/useArrayFieldState.tsx +0 -9
- package/form/hooks/useFieldApi.tsx +0 -21
- package/form/hooks/useFieldState.tsx +0 -18
- package/form/hooks/useFormApi.tsx +0 -7
- package/form/hooks/useFormState.tsx +0 -9
- package/form/hooks/useFormUpdater.tsx +0 -6
- package/form/hooks/useStateWithGetter.ts +0 -13
- package/form/index.tsx +0 -40
- package/form/interface.ts +0 -134
- package/form/label.tsx +0 -96
- package/form/section.tsx +0 -38
- package/form/slot.tsx +0 -167
- package/getBabelConfig.js +0 -25
- package/grid/__test__/calculateGutter.test.js +0 -50
- package/grid/_story/demo.scss +0 -23
- package/grid/_story/grid.stories.js +0 -290
- package/grid/_story/grid.stories.tsx +0 -15
- package/grid/col.tsx +0 -135
- package/grid/index.tsx +0 -7
- package/grid/row.tsx +0 -178
- package/gulpfile.js +0 -119
- package/iconButton/_story/iconButton.stories.tsx +0 -16
- package/iconButton/index.tsx +0 -134
- package/icons/_story/Others/add-template-icon.jsx +0 -0
- package/icons/_story/Others/add-template-icon.svg +0 -10
- package/icons/_story/Others/hangup.svg +0 -3
- package/icons/_story/Others/index.js +0 -24
- package/icons/_story/Others/xianglin.svg +0 -3
- package/icons/_story/icon.stories.js +0 -63
- package/icons/_story/icon.stories.tsx +0 -46
- package/icons/index.tsx +0 -5
- package/index.ts +0 -97
- package/input/__test__/input.test.js +0 -285
- package/input/__test__/textArea.test.js +0 -172
- package/input/_story/Demo.tsx +0 -33
- package/input/_story/TextareaDemo.tsx +0 -27
- package/input/_story/input.scss +0 -0
- package/input/_story/input.stories.js +0 -961
- package/input/_story/input.stories.tsx +0 -11
- package/input/index.tsx +0 -515
- package/input/inputGroup.tsx +0 -127
- package/input/textarea.tsx +0 -339
- package/inputNumber/__test__/inputNumber.test.js +0 -434
- package/inputNumber/_story/input.stories.tsx +0 -17
- package/inputNumber/_story/inputNumber.scss +0 -10
- package/inputNumber/_story/inputNumber.stories.js +0 -767
- package/inputNumber/index.tsx +0 -518
- package/layout/Sider.tsx +0 -122
- package/layout/__test__/layout.test.js +0 -51
- package/layout/_story/layout.stories.js +0 -305
- package/layout/_story/layout.stories.tsx +0 -13
- package/layout/index.tsx +0 -129
- package/layout/layout-context.ts +0 -18
- package/list/__test__/list.test.js +0 -264
- package/list/_story/list.stories.js +0 -920
- package/list/_story/list.stories.tsx +0 -26
- package/list/index.tsx +0 -186
- package/list/item.tsx +0 -113
- package/list/list-context.ts +0 -15
- package/locale/README.md +0 -53
- package/locale/_story/locale.stories.js +0 -221
- package/locale/_story/locale.stories.tsx +0 -57
- package/locale/context.tsx +0 -5
- package/locale/interface.ts +0 -155
- package/locale/localeConsumer.tsx +0 -58
- package/locale/localeProvider.tsx +0 -35
- package/locale/source/ar.ts +0 -159
- package/locale/source/de.ts +0 -159
- package/locale/source/en_GB.ts +0 -159
- package/locale/source/en_US.ts +0 -159
- package/locale/source/es.ts +0 -163
- package/locale/source/fr.ts +0 -159
- package/locale/source/id_ID.ts +0 -160
- package/locale/source/it.ts +0 -159
- package/locale/source/ja_JP.ts +0 -160
- package/locale/source/ko_KR.ts +0 -160
- package/locale/source/ms_MY.ts +0 -159
- package/locale/source/pt_BR.ts +0 -167
- package/locale/source/ru_RU.ts +0 -162
- package/locale/source/th_TH.ts +0 -163
- package/locale/source/tr_TR.ts +0 -159
- package/locale/source/vi_VN.ts +0 -162
- package/locale/source/zh_CN.ts +0 -160
- package/locale/source/zh_TW.ts +0 -160
- package/modal/ConfirmModal.tsx +0 -89
- package/modal/Modal.tsx +0 -417
- package/modal/ModalContent.tsx +0 -337
- package/modal/__test__/confirm.test.js +0 -203
- package/modal/__test__/modal.test.js +0 -324
- package/modal/_story/CollapsibleInModal/index.jsx +0 -100
- package/modal/_story/DynamicContext/context.js +0 -8
- package/modal/_story/DynamicContext/index.jsx +0 -30
- package/modal/_story/__snapshots__/modal.stories.tsx.snap +0 -203
- package/modal/_story/modal.stories.js +0 -343
- package/modal/_story/modal.stories.tsx +0 -41
- package/modal/confirm.tsx +0 -120
- package/modal/index.tsx +0 -13
- package/modal/useModal/HookModal.tsx +0 -63
- package/modal/useModal/index.tsx +0 -80
- package/motions/Rotate.tsx +0 -64
- package/navigation/CollapseButton.tsx +0 -47
- package/navigation/Footer.tsx +0 -74
- package/navigation/Header.tsx +0 -82
- package/navigation/Item.tsx +0 -293
- package/navigation/OpenIconTransition.tsx +0 -58
- package/navigation/README.md +0 -10
- package/navigation/SubNav.tsx +0 -389
- package/navigation/SubNavTransition.tsx +0 -58
- package/navigation/__test__/navigation.test.js +0 -274
- package/navigation/_story/AutoOpen/index.js +0 -69
- package/navigation/_story/ControlledSelectedKeys/index.js +0 -78
- package/navigation/_story/DisabledNav/index.js +0 -46
- package/navigation/_story/ItemsChange/index.js +0 -41
- package/navigation/_story/LinkNav/index.jsx +0 -90
- package/navigation/_story/MountUnmount/index.js +0 -57
- package/navigation/_story/WithChildren/index.js +0 -119
- package/navigation/_story/WithRouter/index.js +0 -111
- package/navigation/_story/navigation.stories.js +0 -330
- package/navigation/_story/navigation.stories.tsx +0 -101
- package/navigation/index.tsx +0 -427
- package/navigation/nav-context.ts +0 -30
- package/notification/NoticeTransition.tsx +0 -68
- package/notification/__test__/notification.test.js +0 -325
- package/notification/_story/Demo.tsx +0 -29
- package/notification/_story/notification.stories.js +0 -225
- package/notification/_story/notification.stories.tsx +0 -6
- package/notification/_story/useNotification/context.js +0 -3
- package/notification/_story/useNotification/index.jsx +0 -43
- package/notification/index.tsx +0 -267
- package/notification/notice.tsx +0 -204
- package/notification/useNotification/HookNotice.tsx +0 -36
- package/notification/useNotification/index.tsx +0 -94
- package/overflowList/__test__/overflowList.test.js +0 -31
- package/overflowList/_story/Demo.tsx +0 -36
- package/overflowList/_story/overflowList.stories.js +0 -400
- package/overflowList/_story/overflowList.stories.tsx +0 -7
- package/overflowList/index.tsx +0 -279
- package/overflowList/intersectionObserver.tsx +0 -94
- package/pagination/__test__/pagination.test.js +0 -255
- package/pagination/_story/pagination.stories.js +0 -159
- package/pagination/_story/pagination.stories.tsx +0 -11
- package/pagination/index.tsx +0 -476
- package/popconfirm/__test__/popconfirm.test.js +0 -131
- package/popconfirm/_story/DynamicDisable/index.jsx +0 -25
- package/popconfirm/_story/InTable/index.js +0 -75
- package/popconfirm/_story/ShowArrow/index.jsx +0 -141
- package/popconfirm/_story/TitlePopconfirm/index.js +0 -130
- package/popconfirm/_story/TypesConfirm/index.jsx +0 -121
- package/popconfirm/_story/popconfirm.stories.js +0 -170
- package/popconfirm/_story/popconfirm.stories.tsx +0 -20
- package/popconfirm/index.tsx +0 -249
- package/popover/Arrow.tsx +0 -66
- package/popover/__test__/popover.test.js +0 -52
- package/popover/_story/ArrowPointAtCenter/index.jsx +0 -138
- package/popover/_story/BtnClose/index.jsx +0 -80
- package/popover/_story/NestedPopover/index.js +0 -41
- package/popover/_story/PopRight/index.js +0 -25
- package/popover/_story/PopRight/index.scss +0 -25
- package/popover/_story/SelectInPopover/index.jsx +0 -38
- package/popover/_story/popover.stories.js +0 -684
- package/popover/_story/popover.stories.tsx +0 -53
- package/popover/index.tsx +0 -182
- package/progress/__test__/progress.test.js +0 -127
- package/progress/_story/progress.stories.js +0 -71
- package/progress/_story/progress.stories.tsx +0 -11
- package/progress/index.tsx +0 -283
- package/radio/__test__/radio.test.jsx +0 -91
- package/radio/__test__/radioGroup.test.jsx +0 -207
- package/radio/_story/Demo.tsx +0 -34
- package/radio/_story/radio.scss +0 -4
- package/radio/_story/radio.stories.js +0 -892
- package/radio/_story/radio.stories.tsx +0 -7
- package/radio/context.ts +0 -25
- package/radio/index.tsx +0 -12
- package/radio/radio.tsx +0 -320
- package/radio/radioGroup.tsx +0 -240
- package/radio/radioInner.tsx +0 -151
- package/rating/__test__/rating.test.js +0 -247
- package/rating/_story/rating.stories.js +0 -108
- package/rating/_story/rating.stories.tsx +0 -11
- package/rating/index.tsx +0 -345
- package/rating/item.tsx +0 -233
- package/resizeObserver/index.tsx +0 -115
- package/scripts/compileDist.js +0 -52
- package/scripts/compileLib.js +0 -13
- package/scripts/compileScss.js +0 -25
- package/scrollList/__test__/scrollList.test.js +0 -226
- package/scrollList/_story/ScrollList/index.js +0 -69
- package/scrollList/_story/SingleWheelList/index.js +0 -72
- package/scrollList/_story/WheelList/index.js +0 -119
- package/scrollList/_story/scrolllist.stories.js +0 -33
- package/scrollList/_story/scrolllist.stories.tsx +0 -131
- package/scrollList/index.tsx +0 -81
- package/scrollList/scrollItem.tsx +0 -540
- package/select/__test__/select.test.js +0 -1323
- package/select/_story/CustomTrigger/index.jsx +0 -21
- package/select/_story/select.scss +0 -51
- package/select/_story/select.stories.js +0 -2988
- package/select/_story/select.stories.tsx +0 -195
- package/select/index.tsx +0 -1239
- package/select/option.tsx +0 -166
- package/select/optionGroup.tsx +0 -42
- package/select/utils.tsx +0 -76
- package/select/virtualRow.tsx +0 -13
- package/sideSheet/SideSheetContent.tsx +0 -177
- package/sideSheet/SideSheetTransition.tsx +0 -104
- package/sideSheet/__test__/sideSheet.test.js +0 -319
- package/sideSheet/_story/sideSheet.stories.js +0 -379
- package/sideSheet/_story/sideSheet.stories.tsx +0 -48
- package/sideSheet/index.tsx +0 -270
- package/skeleton/__test__/skeleton.test.js +0 -32
- package/skeleton/_story/skeleton.stories.js +0 -82
- package/skeleton/_story/skeleton.stories.tsx +0 -61
- package/skeleton/index.tsx +0 -62
- package/skeleton/item.tsx +0 -82
- package/slider/__test__/__snapshots__/slider.test.js.snap +0 -5
- package/slider/__test__/slider.test.js +0 -164
- package/slider/_story/Demo.scss +0 -3
- package/slider/_story/Demo.tsx +0 -28
- package/slider/_story/slider.stories.js +0 -428
- package/slider/_story/slider.stories.tsx +0 -7
- package/slider/index.tsx +0 -635
- package/space/__test__/space.test.js +0 -99
- package/space/_story/space.stories.js +0 -254
- package/space/_story/space.stories.tsx +0 -26
- package/space/index.tsx +0 -95
- package/space/utils.ts +0 -24
- package/spin/__test__/spin.test.js +0 -46
- package/spin/_story/Demo.tsx +0 -10
- package/spin/_story/spin.stories.js +0 -92
- package/spin/_story/spin.stories.tsx +0 -6
- package/spin/icon.tsx +0 -55
- package/spin/index.tsx +0 -137
- package/steps/__test__/steps.test.js +0 -372
- package/steps/_story/steps.stories.js +0 -306
- package/steps/_story/steps.stories.tsx +0 -17
- package/steps/basicStep.tsx +0 -141
- package/steps/basicSteps.tsx +0 -111
- package/steps/context.ts +0 -7
- package/steps/fillStep.tsx +0 -128
- package/steps/fillSteps.tsx +0 -98
- package/steps/index.tsx +0 -69
- package/steps/navStep.tsx +0 -74
- package/steps/navSteps.tsx +0 -74
- package/steps/step.tsx +0 -37
- package/switch/__test__/switch.test.js +0 -128
- package/switch/_story/switch.stories.js +0 -161
- package/switch/_story/switch.stories.tsx +0 -124
- package/switch/index.tsx +0 -185
- package/table/Body/BaseRow.tsx +0 -400
- package/table/Body/ExpandedRow.tsx +0 -157
- package/table/Body/SectionRow.tsx +0 -202
- package/table/Body/index.tsx +0 -859
- package/table/ColGroup.tsx +0 -66
- package/table/Column.tsx +0 -17
- package/table/ColumnFilter.tsx +0 -210
- package/table/ColumnSelection.tsx +0 -91
- package/table/ColumnShape.ts +0 -33
- package/table/ColumnSorter.tsx +0 -81
- package/table/CustomExpandIcon.tsx +0 -100
- package/table/HeadTable.tsx +0 -120
- package/table/ResizableHeaderCell.tsx +0 -44
- package/table/ResizableTable.tsx +0 -176
- package/table/Table.tsx +0 -1413
- package/table/TableCell.tsx +0 -367
- package/table/TableContextProvider.tsx +0 -53
- package/table/TableHeader.tsx +0 -183
- package/table/TableHeaderRow.tsx +0 -196
- package/table/TablePagination.tsx +0 -52
- package/table/__test__/table.test.js +0 -1952
- package/table/_story/BetterScrollbar.tsx +0 -115
- package/table/_story/ChildrenData/index.js +0 -251
- package/table/_story/ChildrenDataInnerSelected/index.js +0 -221
- package/table/_story/ChildrenDataSelected/index.js +0 -247
- package/table/_story/ControlledPagination/index.jsx +0 -232
- package/table/_story/ControlledSortOrder/index.jsx +0 -85
- package/table/_story/CustomComponents/index.js +0 -101
- package/table/_story/CustomExpandIcons/index.js +0 -97
- package/table/_story/CustomFilterDropdownItem/index.jsx +0 -98
- package/table/_story/DefaultSortOrder.tsx +0 -120
- package/table/_story/Demos/columnRender.jsx +0 -131
- package/table/_story/Demos/controlledPagination.jsx +0 -125
- package/table/_story/Demos/customFilter.jsx +0 -110
- package/table/_story/Demos/default.jsx +0 -82
- package/table/_story/Demos/dynamic.jsx +0 -594
- package/table/_story/Demos/expand.jsx +0 -114
- package/table/_story/Demos/filterAndSorter.jsx +0 -102
- package/table/_story/Demos/fixed.jsx +0 -117
- package/table/_story/Demos/fullRender.jsx +0 -131
- package/table/_story/Demos/group.jsx +0 -109
- package/table/_story/Demos/headerMerge.jsx +0 -121
- package/table/_story/Demos/headerMergeJSX.jsx +0 -83
- package/table/_story/Demos/infiniteScroll.jsx +0 -118
- package/table/_story/Demos/onRow.jsx +0 -114
- package/table/_story/Demos/pagination.jsx +0 -101
- package/table/_story/Demos/resizable copy.jsx +0 -102
- package/table/_story/Demos/resizable.jsx +0 -183
- package/table/_story/Demos/rowSelection.jsx +0 -130
- package/table/_story/Demos/sortTree.jsx +0 -218
- package/table/_story/Demos/sortable.jsx +0 -183
- package/table/_story/Demos/span.jsx +0 -155
- package/table/_story/Demos/tree.jsx +0 -109
- package/table/_story/Demos/treeSelect.jsx +0 -196
- package/table/_story/Demos/virtualized.jsx +0 -103
- package/table/_story/Demos/zebra.jsx +0 -124
- package/table/_story/DragableTable/index.jsx +0 -156
- package/table/_story/DragableTable/index.scss +0 -7
- package/table/_story/DynamicFilters/data.json +0 -105
- package/table/_story/DynamicFilters/index.js +0 -78
- package/table/_story/DynamicTable/index.jsx +0 -569
- package/table/_story/EventTable/index.jsx +0 -76
- package/table/_story/Expand/index.js +0 -85
- package/table/_story/ExpandAllGroupRows/index.jsx +0 -90
- package/table/_story/ExpandAllRows/index.jsx +0 -111
- package/table/_story/ExpandRowByClick.jsx +0 -77
- package/table/_story/FilterWithNewDataTable/index.jsx +0 -108
- package/table/_story/FixAllColumnsWithoutWidth.tsx +0 -52
- package/table/_story/FixRenderReturnProps.jsx +0 -105
- package/table/_story/FixedExpandedRows/index.js +0 -105
- package/table/_story/FixedGroups/index.js +0 -80
- package/table/_story/FixedTable/index.js +0 -92
- package/table/_story/FnTable/index.js +0 -103
- package/table/_story/FullRender/index.jsx +0 -135
- package/table/_story/GroupedCols/index.jsx +0 -83
- package/table/_story/GroupedColsFixed/index.jsx +0 -95
- package/table/_story/GroupedColsFixedJSX/index.jsx +0 -122
- package/table/_story/GroupedColsFixedVirtualized/index.jsx +0 -107
- package/table/_story/GroupedColsFixedVirtualizedGroups/index.jsx +0 -110
- package/table/_story/GroupedRows/index.js +0 -83
- package/table/_story/GroupedRowsFixed/index.js +0 -81
- package/table/_story/InSideSheet/index.jsx +0 -90
- package/table/_story/InfiniteScroll/index.js +0 -115
- package/table/_story/JSXAsyncData/index.jsx +0 -47
- package/table/_story/JSXColumnPropColumn.jsx +0 -57
- package/table/_story/JSXColumnsComplex.jsx +0 -174
- package/table/_story/JSXColumnsNest.tsx +0 -74
- package/table/_story/JSXColumnsSmiple.jsx +0 -53
- package/table/_story/JSXFixedTable/index.js +0 -224
- package/table/_story/JSXTitles/index.js +0 -55
- package/table/_story/LinkedScroll/index.jsx +0 -137
- package/table/_story/LinkedScroll/index.scss +0 -0
- package/table/_story/MassiveColumns/index.jsx +0 -109
- package/table/_story/MassiveColumns/index.scss +0 -9
- package/table/_story/ModalTable/index.jsx +0 -228
- package/table/_story/PagintaionTable/index.js +0 -123
- package/table/_story/Perf/Render/complex.jsx +0 -191
- package/table/_story/Perf/Render/context.jsx +0 -72
- package/table/_story/Perf/Render/controlledSelection.jsx +0 -103
- package/table/_story/Perf/Render/index.jsx +0 -95
- package/table/_story/Perf/Render/onRow.jsx +0 -112
- package/table/_story/Perf/Render/resizableSelection.jsx +0 -193
- package/table/_story/Perf/Virtualized/index.jsx +0 -71
- package/table/_story/Perf/index.js +0 -8
- package/table/_story/RTL/AlignScrollBar.jsx +0 -17
- package/table/_story/RTL/index.js +0 -2
- package/table/_story/RenderPagination/index.jsx +0 -161
- package/table/_story/ResizableColumns/index.jsx +0 -95
- package/table/_story/ResizableColumns/index.scss +0 -30
- package/table/_story/ResizableTable/index.jsx +0 -85
- package/table/_story/ScrollBar/index.jsx +0 -71
- package/table/_story/SelectedRows/index.js +0 -137
- package/table/_story/TableSpan/index.jsx +0 -117
- package/table/_story/TabsTable/index.jsx +0 -78
- package/table/_story/TestClone/index.js +0 -0
- package/table/_story/VirtualTableOnCell/index.jsx +0 -84
- package/table/_story/VirtualizedDynamicData/index.jsx +0 -111
- package/table/_story/VirtualizedGroupedRows/index.jsx +0 -135
- package/table/_story/VirtualizedNotFixed/index.js +0 -89
- package/table/_story/VritualizedDataSelected/index.js +0 -273
- package/table/_story/WarnColumnWithoutDataIndex.tsx +0 -71
- package/table/_story/WithSideSheet/index.js +0 -82
- package/table/_story/data/big.json +0 -8205
- package/table/_story/data/big2.json +0 -42271
- package/table/_story/table.stories.js +0 -596
- package/table/_story/table.stories.tsx +0 -382
- package/table/_story/v2/FixedColumnsChange/index.jsx +0 -104
- package/table/_story/v2/FixedExpandedRow/index.jsx +0 -95
- package/table/_story/v2/FixedFilter/index.tsx +0 -106
- package/table/_story/v2/FixedHeaderMerge/index.jsx +0 -98
- package/table/_story/v2/FixedMemoryLeak/index.jsx +0 -33
- package/table/_story/v2/FixedOnHeaderRow/index.jsx +0 -137
- package/table/_story/v2/FixedResizable/index.jsx +0 -114
- package/table/_story/v2/FixedSorter/index.tsx +0 -102
- package/table/_story/v2/FixedVirtualizedEmpty.tsx +0 -76
- package/table/_story/v2/FixedZIndex/index.jsx +0 -87
- package/table/_story/v2/defaultFilteredValue.tsx +0 -114
- package/table/_story/v2/index.js +0 -12
- package/table/_story/v2/radioRowSelection.tsx +0 -107
- package/table/_story/virtualized/index.js +0 -92
- package/table/_story/virtualizedFixed/index.js +0 -131
- package/table/getColumns.tsx +0 -34
- package/table/index.tsx +0 -44
- package/table/interface.ts +0 -321
- package/table/table-context.ts +0 -32
- package/table/utils.ts +0 -123
- package/tabs/TabBar.tsx +0 -264
- package/tabs/TabPane.tsx +0 -128
- package/tabs/TabPaneTransition.tsx +0 -67
- package/tabs/__test__/tabs.test.js +0 -208
- package/tabs/_story/Demo.tsx +0 -39
- package/tabs/_story/search.jsx +0 -37
- package/tabs/_story/tabs.stories.js +0 -905
- package/tabs/_story/tabs.stories.tsx +0 -6
- package/tabs/index.tsx +0 -302
- package/tabs/interface.ts +0 -87
- package/tabs/tabs-context.ts +0 -6
- package/tag/_story/Demo.tsx +0 -22
- package/tag/_story/tag.stories.js +0 -290
- package/tag/_story/tag.stories.tsx +0 -6
- package/tag/group.tsx +0 -136
- package/tag/index.tsx +0 -163
- package/tag/interface.ts +0 -56
- package/tagInput/__test__/tagInput.test.js +0 -398
- package/tagInput/_story/tagInput.stories.js +0 -445
- package/tagInput/_story/tagInput.stories.tsx +0 -24
- package/tagInput/index.tsx +0 -612
- package/timePicker/Combobox.tsx +0 -336
- package/timePicker/PanelShape.ts +0 -8
- package/timePicker/TimeInput.tsx +0 -207
- package/timePicker/TimePicker.tsx +0 -550
- package/timePicker/TimeShape.ts +0 -19
- package/timePicker/__test__/timePicker.test.js +0 -322
- package/timePicker/_story/Callbacks/index.jsx +0 -24
- package/timePicker/_story/CustomTrigger/index.jsx +0 -35
- package/timePicker/_story/DisabledTime/index.jsx +0 -17
- package/timePicker/_story/timepicker.stories.js +0 -301
- package/timePicker/_story/timepicker.stories.tsx +0 -18
- package/timePicker/index.tsx +0 -47
- package/timeline/__test__/timeline.test.js +0 -253
- package/timeline/_story/timeline.stories.js +0 -235
- package/timeline/_story/timeline.stories.tsx +0 -15
- package/timeline/index.tsx +0 -97
- package/timeline/item.tsx +0 -83
- package/toast/ToastTransition.tsx +0 -43
- package/toast/__test__/toast-command-call.test.js +0 -63
- package/toast/__test__/toast.test.js +0 -104
- package/toast/_story/Demo.tsx +0 -22
- package/toast/_story/toast.stories.js +0 -139
- package/toast/_story/toast.stories.tsx +0 -7
- package/toast/index.tsx +0 -234
- package/toast/toast.tsx +0 -152
- package/toast/useToast/HookToast.tsx +0 -35
- package/toast/useToast/index.tsx +0 -79
- package/tooltip/ArrowBoundingShape.ts +0 -8
- package/tooltip/TooltipStyledTransition.tsx +0 -31
- package/tooltip/TriangleArrow.tsx +0 -12
- package/tooltip/TriangleArrowVertical.tsx +0 -12
- package/tooltip/__test__/tooltip.test.js +0 -364
- package/tooltip/_story/ArrowPointAtCenter/index.jsx +0 -137
- package/tooltip/_story/ContainerPosition/index.jsx +0 -15
- package/tooltip/_story/ContainerPosition/index.scss +0 -10
- package/tooltip/_story/CustomContainer/index.jsx +0 -39
- package/tooltip/_story/DangerousHtml/index.js +0 -30
- package/tooltip/_story/Edge/index.js +0 -16
- package/tooltip/_story/InTable/index.jsx +0 -86
- package/tooltip/_story/Safari/autoAdjust.js +0 -23
- package/tooltip/_story/ScrollDemo/index.js +0 -65
- package/tooltip/_story/story.scss +0 -50
- package/tooltip/_story/tooltip.stories.js +0 -1099
- package/tooltip/_story/tooltip.stories.tsx +0 -54
- package/tooltip/index.tsx +0 -737
- package/transfer/__test__/transfer.test.js +0 -324
- package/transfer/_story/transfer.scss +0 -124
- package/transfer/_story/transfer.stories.js +0 -787
- package/transfer/_story/transfer.stories.tsx +0 -80
- package/transfer/index.tsx +0 -667
- package/tree/__test__/autosizer.test.js +0 -102
- package/tree/__test__/tree.test.js +0 -927
- package/tree/__test__/treeMultiple.test.js +0 -687
- package/tree/__test__/treeNodeProps.test.js +0 -192
- package/tree/_story/BigData.jsx +0 -58
- package/tree/_story/Demo.tsx +0 -72
- package/tree/_story/bigDataGen.jsx +0 -98
- package/tree/_story/data.js +0 -3
- package/tree/_story/tree.stories.js +0 -2550
- package/tree/_story/tree.stories.tsx +0 -7
- package/tree/autoSizer.tsx +0 -86
- package/tree/collapse.tsx +0 -144
- package/tree/index.tsx +0 -798
- package/tree/interface.ts +0 -148
- package/tree/nodeList.tsx +0 -88
- package/tree/treeContext.tsx +0 -49
- package/tree/treeNode.tsx +0 -443
- package/tree/treeUtil.tsx +0 -14
- package/treeSelect/__test__/treeMultiple.test.js +0 -775
- package/treeSelect/__test__/treeSelect.test.js +0 -968
- package/treeSelect/_story/CustomTrigger/index.jsx +0 -47
- package/treeSelect/_story/Demo.tsx +0 -83
- package/treeSelect/_story/treeSelect.stories.js +0 -1658
- package/treeSelect/_story/treeSelect.stories.tsx +0 -7
- package/treeSelect/index.tsx +0 -1417
- package/trigger/__test__/trigger.test.js +0 -17
- package/trigger/index.tsx +0 -45
- package/tsconfig.json +0 -33
- package/typography/__test__/typography.test.js +0 -75
- package/typography/_story/typography.stories.js +0 -637
- package/typography/_story/typography.stories.tsx +0 -175
- package/typography/base.tsx +0 -634
- package/typography/copyable.tsx +0 -144
- package/typography/index.tsx +0 -24
- package/typography/interface.ts +0 -27
- package/typography/paragraph.tsx +0 -77
- package/typography/text.tsx +0 -68
- package/typography/title.tsx +0 -74
- package/typography/typography.tsx +0 -41
- package/typography/util.tsx +0 -140
- package/upload/__test__/dragUpload.test.js +0 -122
- package/upload/__test__/upload.test.js +0 -947
- package/upload/_story/upload.stories.js +0 -1111
- package/upload/_story/upload.stories.tsx +0 -16
- package/upload/fileCard.tsx +0 -283
- package/upload/index.tsx +0 -721
- package/upload/interface.ts +0 -64
- package/webpack.config.js +0 -96
|
@@ -1,2988 +0,0 @@
|
|
|
1
|
-
import React, { useState, useRef, useEffect } from 'react';
|
|
2
|
-
|
|
3
|
-
import './select.scss';
|
|
4
|
-
import { Input, Select, Button, Icon, Avatar, Checkbox, Form, withField, Space, Tag } from '../../index';
|
|
5
|
-
import CustomTrigger from './CustomTrigger';
|
|
6
|
-
import classNames from 'classnames';
|
|
7
|
-
import { getHighLightTextHTML } from '../../_utils/index';
|
|
8
|
-
const Option = Select.Option;
|
|
9
|
-
import { IconSearch, IconGift } from '@douyinfe/semi-icons';
|
|
10
|
-
|
|
11
|
-
export default {
|
|
12
|
-
title: 'Select',
|
|
13
|
-
parameters: {
|
|
14
|
-
chromatic: { disableSnapshot: true },
|
|
15
|
-
},
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
let Test = () => {
|
|
19
|
-
let [options, setOptions] = useState([1, 2, 3, 4]);
|
|
20
|
-
|
|
21
|
-
function add() {
|
|
22
|
-
let newOptions = Array.from(
|
|
23
|
-
{
|
|
24
|
-
length: Math.floor(Math.random() * 10),
|
|
25
|
-
},
|
|
26
|
-
(v, i) => i + 1
|
|
27
|
-
);
|
|
28
|
-
setOptions(newOptions);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
let style = {
|
|
32
|
-
width: 150,
|
|
33
|
-
margin: 20,
|
|
34
|
-
};
|
|
35
|
-
let slotStyle = {
|
|
36
|
-
backgroundColor: 'whitesmoke',
|
|
37
|
-
height: '40px',
|
|
38
|
-
display: 'flex',
|
|
39
|
-
justifyContent: 'center',
|
|
40
|
-
alignItems: 'center',
|
|
41
|
-
borderRadius: '0 0 6px 6px',
|
|
42
|
-
};
|
|
43
|
-
let outSlotStyle = {
|
|
44
|
-
backgroundColor: 'whitesmoke',
|
|
45
|
-
height: '29px',
|
|
46
|
-
display: 'flex',
|
|
47
|
-
justifyContent: 'center',
|
|
48
|
-
alignItems: 'center',
|
|
49
|
-
cursor: 'pointer',
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
const click = e => {};
|
|
53
|
-
|
|
54
|
-
let outSlotNode = (
|
|
55
|
-
<div onClick={e => click(e)}>
|
|
56
|
-
<Checkbox>sendLarkNotification</Checkbox>
|
|
57
|
-
<div>
|
|
58
|
-
<Button theme="solid">confirm</Button>
|
|
59
|
-
</div>
|
|
60
|
-
</div>
|
|
61
|
-
);
|
|
62
|
-
return (
|
|
63
|
-
<>
|
|
64
|
-
<Select
|
|
65
|
-
style={style}
|
|
66
|
-
dropdownClassName="test-dropdown"
|
|
67
|
-
dropdownStyle={{
|
|
68
|
-
width: 150,
|
|
69
|
-
}}
|
|
70
|
-
filter
|
|
71
|
-
placeholder="fefe"
|
|
72
|
-
position="rightTop"
|
|
73
|
-
innerBottomSlot={
|
|
74
|
-
<div style={slotStyle}>
|
|
75
|
-
<Button
|
|
76
|
-
size="small"
|
|
77
|
-
style={{
|
|
78
|
-
margin: 0,
|
|
79
|
-
}}
|
|
80
|
-
>
|
|
81
|
-
申请其他地区权限
|
|
82
|
-
</Button>
|
|
83
|
-
</div>
|
|
84
|
-
}
|
|
85
|
-
>
|
|
86
|
-
{options.map(option => (
|
|
87
|
-
<Option value={option} key={option} className="fefe">
|
|
88
|
-
{option}
|
|
89
|
-
</Option>
|
|
90
|
-
))}
|
|
91
|
-
</Select>
|
|
92
|
-
<Select
|
|
93
|
-
style={{
|
|
94
|
-
marginTop: 20,
|
|
95
|
-
width: 200,
|
|
96
|
-
}}
|
|
97
|
-
dropdownClassName="test-dropdown"
|
|
98
|
-
dropdownStyle={{
|
|
99
|
-
width: 150,
|
|
100
|
-
}}
|
|
101
|
-
filter
|
|
102
|
-
placeholder="fefe"
|
|
103
|
-
position="rightTop"
|
|
104
|
-
outerBottomSlot={outSlotNode}
|
|
105
|
-
>
|
|
106
|
-
{options.map(option => (
|
|
107
|
-
<Option value={option} key={option} className="fefe">
|
|
108
|
-
{option}
|
|
109
|
-
</Option>
|
|
110
|
-
))}
|
|
111
|
-
</Select>
|
|
112
|
-
</>
|
|
113
|
-
);
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
const AutoFocusDemo = () => {
|
|
117
|
-
return (
|
|
118
|
-
<>
|
|
119
|
-
<Select
|
|
120
|
-
autoFocus
|
|
121
|
-
style={{
|
|
122
|
-
width: 200,
|
|
123
|
-
}}
|
|
124
|
-
onFocus={() => console.log('onFocus')}
|
|
125
|
-
onBlur={() => console.log('onBlur')}
|
|
126
|
-
>
|
|
127
|
-
<Option value="abc">抖音</Option>
|
|
128
|
-
<Option value="hotsoon">火山</Option>
|
|
129
|
-
<Option value="pipixia">皮皮虾</Option>
|
|
130
|
-
<Option value="duoshan">多闪</Option>
|
|
131
|
-
<Option value="xigua">西瓜视频</Option>
|
|
132
|
-
</Select>
|
|
133
|
-
<div className="test-div">test-div</div>
|
|
134
|
-
</>
|
|
135
|
-
);
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
export const AutoFocus = () => <AutoFocusDemo />;
|
|
139
|
-
|
|
140
|
-
AutoFocus.story = {
|
|
141
|
-
name: 'autoFocus',
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
export const InnerBottomSlotOuterBottomSlot = () => <Test />;
|
|
145
|
-
|
|
146
|
-
InnerBottomSlotOuterBottomSlot.story = {
|
|
147
|
-
name: 'innerBottomSlot / outerBottomSlot',
|
|
148
|
-
};
|
|
149
|
-
|
|
150
|
-
export const InnerTopSlotOuterTopSlot = () => {
|
|
151
|
-
const slot = <div>未找到应用?</div>;
|
|
152
|
-
return (
|
|
153
|
-
<div>
|
|
154
|
-
innerTopSlot
|
|
155
|
-
<div>
|
|
156
|
-
<Select
|
|
157
|
-
innerTopSlot={slot}
|
|
158
|
-
style={{
|
|
159
|
-
width: 250,
|
|
160
|
-
}}
|
|
161
|
-
maxHeight={150}
|
|
162
|
-
>
|
|
163
|
-
<Option value="abc">抖音</Option>
|
|
164
|
-
<Option value="hotsoon">火山</Option>
|
|
165
|
-
<Option value="pipixia">皮皮虾</Option>
|
|
166
|
-
<Option value="duoshan">多闪</Option>
|
|
167
|
-
<Option value="xigua">西瓜视频</Option>
|
|
168
|
-
</Select>
|
|
169
|
-
</div>
|
|
170
|
-
outerTopSlot
|
|
171
|
-
<div>
|
|
172
|
-
<Select
|
|
173
|
-
outerTopSlot={slot}
|
|
174
|
-
style={{
|
|
175
|
-
width: 250,
|
|
176
|
-
}}
|
|
177
|
-
maxHeight={150}
|
|
178
|
-
>
|
|
179
|
-
<Option value="abc">抖音</Option>
|
|
180
|
-
<Option value="hotsoon">火山</Option>
|
|
181
|
-
<Option value="pipixia">皮皮虾</Option>
|
|
182
|
-
<Option value="duoshan">多闪</Option>
|
|
183
|
-
<Option value="xigua">西瓜视频</Option>
|
|
184
|
-
</Select>
|
|
185
|
-
</div>
|
|
186
|
-
</div>
|
|
187
|
-
);
|
|
188
|
-
};
|
|
189
|
-
|
|
190
|
-
InnerTopSlotOuterTopSlot.story = {
|
|
191
|
-
name: 'innerTopSlot / outerTopSlot',
|
|
192
|
-
};
|
|
193
|
-
|
|
194
|
-
export const OneOptionJsxWithOtherOptionArray = () => (
|
|
195
|
-
<Select
|
|
196
|
-
defaultValue={'all'}
|
|
197
|
-
style={{
|
|
198
|
-
width: 250,
|
|
199
|
-
}}
|
|
200
|
-
>
|
|
201
|
-
<Option value="all" key="all">
|
|
202
|
-
all
|
|
203
|
-
</Option>
|
|
204
|
-
{[1, 2, 3].map(item => (
|
|
205
|
-
<Option value={`type${item}`} key={item}>{`type${item}`}</Option>
|
|
206
|
-
))}
|
|
207
|
-
</Select>
|
|
208
|
-
);
|
|
209
|
-
|
|
210
|
-
OneOptionJsxWithOtherOptionArray.story = {
|
|
211
|
-
name: 'one option jsx with other option array',
|
|
212
|
-
};
|
|
213
|
-
|
|
214
|
-
let options = [
|
|
215
|
-
{
|
|
216
|
-
value: 'all',
|
|
217
|
-
label: '全部',
|
|
218
|
-
otherKey: 'all semi',
|
|
219
|
-
},
|
|
220
|
-
{
|
|
221
|
-
value: 'abc',
|
|
222
|
-
label: '抖音',
|
|
223
|
-
otherKey: 'abc semi',
|
|
224
|
-
},
|
|
225
|
-
{
|
|
226
|
-
value: 'hotsoon',
|
|
227
|
-
label: '火山小视频',
|
|
228
|
-
otherKey: 'hostsoom semi',
|
|
229
|
-
},
|
|
230
|
-
{
|
|
231
|
-
value: 'pipixia',
|
|
232
|
-
label: '皮皮虾',
|
|
233
|
-
otherKey: 'pif',
|
|
234
|
-
},
|
|
235
|
-
{
|
|
236
|
-
value: 'toutiao',
|
|
237
|
-
label: '今日头条',
|
|
238
|
-
otherKey: 'toutiao semi',
|
|
239
|
-
},
|
|
240
|
-
{
|
|
241
|
-
value: 'rd',
|
|
242
|
-
label: 'rd',
|
|
243
|
-
otherKey: 'semi rd',
|
|
244
|
-
},
|
|
245
|
-
{
|
|
246
|
-
value: 'ued',
|
|
247
|
-
label: 'ued',
|
|
248
|
-
otherKey: 'semi ued',
|
|
249
|
-
},
|
|
250
|
-
{
|
|
251
|
-
value: 'ued',
|
|
252
|
-
label: 'japan',
|
|
253
|
-
otherKey: 'semi ued',
|
|
254
|
-
},
|
|
255
|
-
{
|
|
256
|
-
value: '+86',
|
|
257
|
-
label: '+86',
|
|
258
|
-
otherKey: 'semi',
|
|
259
|
-
},
|
|
260
|
-
];
|
|
261
|
-
let longOptions = options.concat({
|
|
262
|
-
value: 'long',
|
|
263
|
-
label: 'Semi Design 是一个设计系统,它定义了一套中后台设计与前端基础组',
|
|
264
|
-
});
|
|
265
|
-
|
|
266
|
-
export const SelectSize = () => (
|
|
267
|
-
<div
|
|
268
|
-
style={{
|
|
269
|
-
margin: 20,
|
|
270
|
-
}}
|
|
271
|
-
>
|
|
272
|
-
<h4>
|
|
273
|
-
使用方不设width时,下拉菜单根据内容自动适配宽度(不推荐这样使用,select的宽度会动态变化)
|
|
274
|
-
</h4>
|
|
275
|
-
<Select
|
|
276
|
-
defaultValue={'all'}
|
|
277
|
-
optionList={options}
|
|
278
|
-
style={{
|
|
279
|
-
margin: 10,
|
|
280
|
-
}}
|
|
281
|
-
></Select>
|
|
282
|
-
<Select
|
|
283
|
-
defaultValue={'long'}
|
|
284
|
-
optionList={longOptions}
|
|
285
|
-
style={{
|
|
286
|
-
margin: 10,
|
|
287
|
-
}}
|
|
288
|
-
></Select>
|
|
289
|
-
<Select
|
|
290
|
-
defaultValue={'abc'}
|
|
291
|
-
size="large"
|
|
292
|
-
optionList={options}
|
|
293
|
-
style={{
|
|
294
|
-
margin: 10,
|
|
295
|
-
}}
|
|
296
|
-
></Select>
|
|
297
|
-
{/* <Select defaultValue={'+86'} size="large" optionList={options} style={{margin: 10}}>
|
|
298
|
-
</Select> */}
|
|
299
|
-
<h4>通过style设width的</h4>
|
|
300
|
-
90px:{' '}
|
|
301
|
-
<Select
|
|
302
|
-
defaultValue={'all'}
|
|
303
|
-
style={{
|
|
304
|
-
width: 90,
|
|
305
|
-
marign: 10,
|
|
306
|
-
}}
|
|
307
|
-
optionList={options}
|
|
308
|
-
></Select>
|
|
309
|
-
120px:{' '}
|
|
310
|
-
<Select
|
|
311
|
-
defaultValue={'all'}
|
|
312
|
-
style={{
|
|
313
|
-
width: 120,
|
|
314
|
-
margin: 10,
|
|
315
|
-
}}
|
|
316
|
-
optionList={options}
|
|
317
|
-
></Select>
|
|
318
|
-
400px:{' '}
|
|
319
|
-
<Select
|
|
320
|
-
defaultValue={'all'}
|
|
321
|
-
style={{
|
|
322
|
-
width: 400,
|
|
323
|
-
margin: 10,
|
|
324
|
-
}}
|
|
325
|
-
optionList={options}
|
|
326
|
-
></Select>
|
|
327
|
-
<br />
|
|
328
|
-
100%:{' '}
|
|
329
|
-
<Select
|
|
330
|
-
defaultValue={'all'}
|
|
331
|
-
style={{
|
|
332
|
-
width: '100%',
|
|
333
|
-
margin: 10,
|
|
334
|
-
}}
|
|
335
|
-
optionList={options}
|
|
336
|
-
></Select>
|
|
337
|
-
<br />
|
|
338
|
-
<h4>通过css设width的</h4>
|
|
339
|
-
<Select defaultValue={'all'} className="test-width" optionList={options}></Select>
|
|
340
|
-
<br />
|
|
341
|
-
<h4>dropdownMatchSelectWidth</h4>
|
|
342
|
-
<p>当该项设为true时,下拉菜单最小宽度会等于Select宽度(默认为true)</p>
|
|
343
|
-
<div
|
|
344
|
-
style={{
|
|
345
|
-
margin: 10,
|
|
346
|
-
}}
|
|
347
|
-
>
|
|
348
|
-
style方式指定90px:
|
|
349
|
-
<Select
|
|
350
|
-
defaultValue={'all'}
|
|
351
|
-
optionList={options}
|
|
352
|
-
dropdownMatchSelectWidth={true}
|
|
353
|
-
style={{
|
|
354
|
-
width: 90,
|
|
355
|
-
}}
|
|
356
|
-
/>
|
|
357
|
-
</div>
|
|
358
|
-
<div
|
|
359
|
-
style={{
|
|
360
|
-
margin: 10,
|
|
361
|
-
}}
|
|
362
|
-
>
|
|
363
|
-
css方式声明130px:
|
|
364
|
-
<Select
|
|
365
|
-
defaultValue={'all'}
|
|
366
|
-
className="test-width"
|
|
367
|
-
optionList={options}
|
|
368
|
-
dropdownMatchSelectWidth={true}
|
|
369
|
-
></Select>
|
|
370
|
-
</div>
|
|
371
|
-
<div>
|
|
372
|
-
<h4>需要强制下拉菜单与select同宽的时候</h4>
|
|
373
|
-
<p>通过dropdownStyle覆盖min-width,将其设成与select的width同样的值</p>
|
|
374
|
-
<Select
|
|
375
|
-
defaultValue={'all'}
|
|
376
|
-
style={{
|
|
377
|
-
width: 300,
|
|
378
|
-
margin: 10,
|
|
379
|
-
}}
|
|
380
|
-
dropdownStyle={{
|
|
381
|
-
width: 300,
|
|
382
|
-
}}
|
|
383
|
-
optionList={options}
|
|
384
|
-
/>
|
|
385
|
-
</div>
|
|
386
|
-
</div>
|
|
387
|
-
);
|
|
388
|
-
|
|
389
|
-
SelectSize.story = {
|
|
390
|
-
name: 'select size',
|
|
391
|
-
};
|
|
392
|
-
|
|
393
|
-
export const WithPrefixSuffixInsetLabelShowClearShowArrow = () => (
|
|
394
|
-
<>
|
|
395
|
-
<h4>prefix & suffix</h4>
|
|
396
|
-
<Select
|
|
397
|
-
style={{
|
|
398
|
-
width: '250px',
|
|
399
|
-
}}
|
|
400
|
-
optionList={options}
|
|
401
|
-
prefix={<IconSearch />}
|
|
402
|
-
suffix={<IconGift></IconGift>}
|
|
403
|
-
></Select>
|
|
404
|
-
<h4>insetLabel</h4>
|
|
405
|
-
<Select
|
|
406
|
-
style={{
|
|
407
|
-
width: '250px',
|
|
408
|
-
}}
|
|
409
|
-
optionList={options}
|
|
410
|
-
insetLabel={'业务线'}
|
|
411
|
-
></Select>
|
|
412
|
-
<h4>showClear</h4>
|
|
413
|
-
<Select
|
|
414
|
-
style={{
|
|
415
|
-
width: '250px',
|
|
416
|
-
}}
|
|
417
|
-
optionList={options}
|
|
418
|
-
showClear
|
|
419
|
-
></Select>
|
|
420
|
-
<h4>showArrow = false</h4>
|
|
421
|
-
<Select
|
|
422
|
-
style={{
|
|
423
|
-
width: '250px',
|
|
424
|
-
}}
|
|
425
|
-
optionList={options}
|
|
426
|
-
showArrow={false}
|
|
427
|
-
></Select>
|
|
428
|
-
|
|
429
|
-
<h4>defaultValue是不存在的值</h4>
|
|
430
|
-
<Select
|
|
431
|
-
style={{
|
|
432
|
-
width: '250px',
|
|
433
|
-
}}
|
|
434
|
-
optionList={options}
|
|
435
|
-
defaultValue="+85"
|
|
436
|
-
></Select>
|
|
437
|
-
</>
|
|
438
|
-
);
|
|
439
|
-
|
|
440
|
-
WithPrefixSuffixInsetLabelShowClearShowArrow.story = {
|
|
441
|
-
name: 'with prefix / suffix / insetLabel, showClear, showArrow',
|
|
442
|
-
};
|
|
443
|
-
WithPrefixSuffixInsetLabelShowClearShowArrow.parameters = {
|
|
444
|
-
chromatic: { disableSnapshot: false },
|
|
445
|
-
};
|
|
446
|
-
|
|
447
|
-
export const WithDefaultSelected = () => (
|
|
448
|
-
<Select
|
|
449
|
-
style={{
|
|
450
|
-
width: '250px',
|
|
451
|
-
}}
|
|
452
|
-
defaultValue={1}
|
|
453
|
-
>
|
|
454
|
-
<Option value={1}>opt1</Option>
|
|
455
|
-
<Option value={2}>opt2</Option>
|
|
456
|
-
<Option value={3}>opt3</Option>
|
|
457
|
-
<Option value="4">opt4</Option>
|
|
458
|
-
</Select>
|
|
459
|
-
);
|
|
460
|
-
|
|
461
|
-
WithDefaultSelected.story = {
|
|
462
|
-
name: 'with default selected',
|
|
463
|
-
};
|
|
464
|
-
|
|
465
|
-
export const WithScrollbar = () => (
|
|
466
|
-
<Select
|
|
467
|
-
style={{
|
|
468
|
-
width: '250px',
|
|
469
|
-
}}
|
|
470
|
-
defaultValue={1}
|
|
471
|
-
>
|
|
472
|
-
<Option value={1}>opt1</Option>
|
|
473
|
-
<Option value={2}>opt2</Option>
|
|
474
|
-
<Option value={3}>opt3</Option>
|
|
475
|
-
<Option value="4">opt4</Option>
|
|
476
|
-
<Option value={5}>opt5</Option>
|
|
477
|
-
<Option value={6}>opt6</Option>
|
|
478
|
-
<Option value={7}>opt7</Option>
|
|
479
|
-
<Option value="8">opt8</Option>
|
|
480
|
-
<Option value={9}>opt9</Option>
|
|
481
|
-
<Option value={10}>opt10dfsdfsdfdsfdsfsdf</Option>
|
|
482
|
-
<Option value={11}>opt11</Option>
|
|
483
|
-
<Option value="12">opt12jfldsjflsdjlfldjslfjhifsdfdsfdsffdsodsjlfhjl</Option>
|
|
484
|
-
</Select>
|
|
485
|
-
);
|
|
486
|
-
|
|
487
|
-
WithScrollbar.story = {
|
|
488
|
-
name: 'with scrollbar',
|
|
489
|
-
};
|
|
490
|
-
|
|
491
|
-
class Link extends React.Component {
|
|
492
|
-
get provinces() {
|
|
493
|
-
return ['Sichuan', 'Guangdong'];
|
|
494
|
-
}
|
|
495
|
-
|
|
496
|
-
get maps() {
|
|
497
|
-
return {
|
|
498
|
-
Sichuan: ['Chengdu', 'Dujiangyan'],
|
|
499
|
-
Guangdong: ['Guangzhou', 'Shenzhen', 'Dongguan'],
|
|
500
|
-
};
|
|
501
|
-
}
|
|
502
|
-
|
|
503
|
-
constructor() {
|
|
504
|
-
super();
|
|
505
|
-
this.state = {
|
|
506
|
-
provinces: this.provinces,
|
|
507
|
-
maps: this.maps,
|
|
508
|
-
citys: this.maps[this.provinces[0]],
|
|
509
|
-
city: this.maps[this.provinces[0]][0],
|
|
510
|
-
};
|
|
511
|
-
this.provinceChange = this.provinceChange.bind(this);
|
|
512
|
-
this.cityChange = this.cityChange.bind(this);
|
|
513
|
-
}
|
|
514
|
-
|
|
515
|
-
provinceChange(newProvince) {
|
|
516
|
-
const { maps } = this.state;
|
|
517
|
-
this.setState({
|
|
518
|
-
citys: maps[newProvince],
|
|
519
|
-
city: maps[newProvince][0],
|
|
520
|
-
});
|
|
521
|
-
}
|
|
522
|
-
|
|
523
|
-
cityChange(city) {
|
|
524
|
-
this.setState({
|
|
525
|
-
city,
|
|
526
|
-
});
|
|
527
|
-
}
|
|
528
|
-
|
|
529
|
-
render() {
|
|
530
|
-
const { provinces, citys, city } = this.state;
|
|
531
|
-
return (
|
|
532
|
-
<React.Fragment>
|
|
533
|
-
<Select
|
|
534
|
-
style={{
|
|
535
|
-
width: '150px',
|
|
536
|
-
margin: '10px',
|
|
537
|
-
}}
|
|
538
|
-
onChange={this.provinceChange}
|
|
539
|
-
defaultValue={provinces[0]}
|
|
540
|
-
>
|
|
541
|
-
{provinces.map(pro => (
|
|
542
|
-
<Option value={pro} key={pro}>
|
|
543
|
-
{pro}
|
|
544
|
-
</Option>
|
|
545
|
-
))}
|
|
546
|
-
</Select>
|
|
547
|
-
<Select
|
|
548
|
-
style={{
|
|
549
|
-
width: '150px',
|
|
550
|
-
margin: '10px',
|
|
551
|
-
}}
|
|
552
|
-
value={city}
|
|
553
|
-
onChange={this.cityChange}
|
|
554
|
-
>
|
|
555
|
-
{citys.map(c => (
|
|
556
|
-
<Option value={c} key={c}>
|
|
557
|
-
{c}
|
|
558
|
-
</Option>
|
|
559
|
-
))}
|
|
560
|
-
</Select>
|
|
561
|
-
</React.Fragment>
|
|
562
|
-
);
|
|
563
|
-
}
|
|
564
|
-
}
|
|
565
|
-
|
|
566
|
-
export const TwoSelectChangeAtTheSameTime = () => <Link />;
|
|
567
|
-
|
|
568
|
-
TwoSelectChangeAtTheSameTime.story = {
|
|
569
|
-
name: 'two select change at the same time',
|
|
570
|
-
};
|
|
571
|
-
|
|
572
|
-
export const SelectMultiple = () => (
|
|
573
|
-
<>
|
|
574
|
-
<Select
|
|
575
|
-
multiple={true}
|
|
576
|
-
max={10}
|
|
577
|
-
style={{
|
|
578
|
-
width: '180px',
|
|
579
|
-
}}
|
|
580
|
-
placeholder="fefe"
|
|
581
|
-
>
|
|
582
|
-
<Option value={1}>opt1</Option>
|
|
583
|
-
<Option value={2}>opt2</Option>
|
|
584
|
-
<Option value={3}>opt3</Option>
|
|
585
|
-
<Option value="4">opt4</Option>
|
|
586
|
-
<Option value={5}>opt5</Option>
|
|
587
|
-
<Option value={6}>opt6</Option>
|
|
588
|
-
<Option value={7}>opt7</Option>
|
|
589
|
-
<Option value={8}>opt8</Option>
|
|
590
|
-
</Select>
|
|
591
|
-
<br />
|
|
592
|
-
<br />
|
|
593
|
-
<Select
|
|
594
|
-
multiple={true}
|
|
595
|
-
style={{
|
|
596
|
-
width: '300px',
|
|
597
|
-
}}
|
|
598
|
-
defaultValue={[1, 2, 3]}
|
|
599
|
-
placeholder="fefe"
|
|
600
|
-
>
|
|
601
|
-
<Option value={1}>opt1</Option>
|
|
602
|
-
<Option value={2}>opt2</Option>
|
|
603
|
-
<Option value={3}>opt3</Option>
|
|
604
|
-
<Option value="4">opt4</Option>
|
|
605
|
-
<Option value={5}>opt5</Option>
|
|
606
|
-
<Option value={6}>opt6</Option>
|
|
607
|
-
<Option value={7}>opt7</Option>
|
|
608
|
-
<Option value={8}>opt8</Option>
|
|
609
|
-
</Select>
|
|
610
|
-
<br />
|
|
611
|
-
<br />
|
|
612
|
-
<Select
|
|
613
|
-
multiple={true}
|
|
614
|
-
style={{
|
|
615
|
-
width: '300px',
|
|
616
|
-
}}
|
|
617
|
-
defaultValue={[1, 2, 3]}
|
|
618
|
-
placeholder="fefe"
|
|
619
|
-
disabled
|
|
620
|
-
onSelect={(...res) => console.log(res)}
|
|
621
|
-
onDeselect={(...res) => console.log(res)}
|
|
622
|
-
>
|
|
623
|
-
<Option value={1}>opt1</Option>
|
|
624
|
-
<Option value={2}>opt2</Option>
|
|
625
|
-
<Option value={3}>opt3</Option>
|
|
626
|
-
<Option value="4">opt4</Option>
|
|
627
|
-
<Option value={5}>opt5</Option>
|
|
628
|
-
<Option value={6}>opt6</Option>
|
|
629
|
-
<Option value={7}>opt7</Option>
|
|
630
|
-
<Option value={8}>opt8</Option>
|
|
631
|
-
</Select>
|
|
632
|
-
<br />
|
|
633
|
-
<br />
|
|
634
|
-
maxTagCount = 3
|
|
635
|
-
<Select
|
|
636
|
-
multiple={true}
|
|
637
|
-
maxTagCount={3}
|
|
638
|
-
style={{
|
|
639
|
-
width: '350px',
|
|
640
|
-
}}
|
|
641
|
-
defaultValue={[1, 2, 3]}
|
|
642
|
-
placeholder="fefe"
|
|
643
|
-
insetLabel="标签"
|
|
644
|
-
onSelect={(...res) => console.log(res)}
|
|
645
|
-
onDeselect={(...res) => console.log(res)}
|
|
646
|
-
>
|
|
647
|
-
<Option value={1}>opt1</Option>
|
|
648
|
-
<Option value={2}>opt2</Option>
|
|
649
|
-
<Option value={3}>opt3</Option>
|
|
650
|
-
<Option value="4">opt4</Option>
|
|
651
|
-
<Option value={5}>opt5</Option>
|
|
652
|
-
<Option value={6}>opt6</Option>
|
|
653
|
-
<Option value={7}>opt7</Option>
|
|
654
|
-
<Option value={8}>opt8</Option>
|
|
655
|
-
</Select>
|
|
656
|
-
<br />
|
|
657
|
-
<br />
|
|
658
|
-
maxTagCount = 3, max=5
|
|
659
|
-
<Select
|
|
660
|
-
multiple={true}
|
|
661
|
-
maxTagCount={3}
|
|
662
|
-
max={5}
|
|
663
|
-
style={{
|
|
664
|
-
width: '350px',
|
|
665
|
-
}}
|
|
666
|
-
defaultValue={[1, 2, 3]}
|
|
667
|
-
placeholder="fefe"
|
|
668
|
-
insetLabel="标签"
|
|
669
|
-
onSelect={(...res) => console.log(res)}
|
|
670
|
-
onDeselect={(...res) => console.log(res)}
|
|
671
|
-
>
|
|
672
|
-
<Option value={1}>opt1</Option>
|
|
673
|
-
<Option value={2}>opt2</Option>
|
|
674
|
-
<Option value={3}>opt3</Option>
|
|
675
|
-
<Option value="4">opt4</Option>
|
|
676
|
-
<Option value={5}>opt5</Option>
|
|
677
|
-
<Option value={6}>opt6</Option>
|
|
678
|
-
<Option value={7}>opt7</Option>
|
|
679
|
-
<Option value={8}>opt8</Option>
|
|
680
|
-
</Select>
|
|
681
|
-
</>
|
|
682
|
-
);
|
|
683
|
-
|
|
684
|
-
SelectMultiple.story = {
|
|
685
|
-
name: 'select multiple',
|
|
686
|
-
};
|
|
687
|
-
SelectMultiple.parameters = {
|
|
688
|
-
chromatic: { disableSnapshot: false },
|
|
689
|
-
};
|
|
690
|
-
|
|
691
|
-
export const SelectDisabled = () => (
|
|
692
|
-
<Select
|
|
693
|
-
disabled
|
|
694
|
-
multiple={true}
|
|
695
|
-
max={10}
|
|
696
|
-
style={{
|
|
697
|
-
width: '250px',
|
|
698
|
-
}}
|
|
699
|
-
>
|
|
700
|
-
<Option value={1}>opt1</Option>
|
|
701
|
-
<Option value={2} disabled>
|
|
702
|
-
opt2
|
|
703
|
-
</Option>
|
|
704
|
-
<Option value={3}>opt3</Option>
|
|
705
|
-
<Option value="4">opt4</Option>
|
|
706
|
-
</Select>
|
|
707
|
-
);
|
|
708
|
-
|
|
709
|
-
SelectDisabled.story = {
|
|
710
|
-
name: 'select disabled',
|
|
711
|
-
};
|
|
712
|
-
|
|
713
|
-
function filter(input, option) {
|
|
714
|
-
console.log(option);
|
|
715
|
-
return option.label.includes(input);
|
|
716
|
-
}
|
|
717
|
-
|
|
718
|
-
const spanStyle = {
|
|
719
|
-
display: 'inline-block',
|
|
720
|
-
marginRight: '8px',
|
|
721
|
-
width: '16px',
|
|
722
|
-
height: '16px',
|
|
723
|
-
borderRadius: '50%',
|
|
724
|
-
border: '1px solid var(--semi-color-bg-1)',
|
|
725
|
-
};
|
|
726
|
-
const colorOptions = [
|
|
727
|
-
{
|
|
728
|
-
value: 'grey-1',
|
|
729
|
-
spanStyle: { ...spanStyle, backgroundColor: 'rgb(107, 116, 117)' },
|
|
730
|
-
},
|
|
731
|
-
{
|
|
732
|
-
value: 'purple-5',
|
|
733
|
-
spanStyle: { ...spanStyle, backgroundColor: 'rgb(158, 40, 179)' },
|
|
734
|
-
},
|
|
735
|
-
{
|
|
736
|
-
value: 'pink-2',
|
|
737
|
-
spanStyle: { ...spanStyle, backgroundColor: 'rgb(233, 30, 99)' },
|
|
738
|
-
},
|
|
739
|
-
{
|
|
740
|
-
value: 'blue-3',
|
|
741
|
-
spanStyle: { ...spanStyle, backgroundColor: 'rgb(0, 119, 250)' },
|
|
742
|
-
},
|
|
743
|
-
];
|
|
744
|
-
const alignStyle = {
|
|
745
|
-
display: 'flex',
|
|
746
|
-
alignItems: 'center',
|
|
747
|
-
};
|
|
748
|
-
|
|
749
|
-
const customFilter = (input, option) => {
|
|
750
|
-
return option.value.includes(input);
|
|
751
|
-
};
|
|
752
|
-
|
|
753
|
-
export const SelectFilterSingle = () => (
|
|
754
|
-
<div>
|
|
755
|
-
<h5>默认筛选</h5>
|
|
756
|
-
<Select
|
|
757
|
-
filter
|
|
758
|
-
style={{
|
|
759
|
-
width: '250px',
|
|
760
|
-
margin: 10,
|
|
761
|
-
}}
|
|
762
|
-
showClear
|
|
763
|
-
autoFocus
|
|
764
|
-
onSearch={(val) => console.log(`onSearch:${val}`)}
|
|
765
|
-
onFocus={() => console.log('onFocus')}
|
|
766
|
-
onBlur={() => console.log('onBlur')}
|
|
767
|
-
>
|
|
768
|
-
<Option value={1}>opt1</Option>
|
|
769
|
-
<Option value={2} disabled>
|
|
770
|
-
disabled
|
|
771
|
-
</Option>
|
|
772
|
-
<Option value={3}>Lucy</Option>
|
|
773
|
-
<Option value="4">bay</Option>
|
|
774
|
-
<Option value="5">sert</Option>
|
|
775
|
-
<Option value="6">wym</Option>
|
|
776
|
-
<Option value="7" disabled>
|
|
777
|
-
meno
|
|
778
|
-
</Option>
|
|
779
|
-
<Option value="8">opts</Option>
|
|
780
|
-
</Select>
|
|
781
|
-
<h5>自定义筛选函数</h5>
|
|
782
|
-
<Select
|
|
783
|
-
style={{
|
|
784
|
-
width: '250px',
|
|
785
|
-
margin: 10,
|
|
786
|
-
}}
|
|
787
|
-
filter={filter}
|
|
788
|
-
showClear
|
|
789
|
-
onBlur={() => console.log('onBlur')}
|
|
790
|
-
onSearch={val => console.log(val)}
|
|
791
|
-
onFocus={() => console.log('onFocus')}
|
|
792
|
-
>
|
|
793
|
-
<Option value={1}>opt1(value:1)</Option>
|
|
794
|
-
<Option value={2}>mike(value:2)</Option>
|
|
795
|
-
<Option value={3}>Lucy(value:3)</Option>
|
|
796
|
-
<Option value={4}>bay(value:4)</Option>
|
|
797
|
-
</Select>
|
|
798
|
-
<h5>filter为true,但option label为node时</h5>
|
|
799
|
-
<Select
|
|
800
|
-
style={{
|
|
801
|
-
width: '250px',
|
|
802
|
-
margin: 10,
|
|
803
|
-
}}
|
|
804
|
-
showClear
|
|
805
|
-
filter={customFilter}
|
|
806
|
-
onChange={v => console.log(v)}
|
|
807
|
-
insetLabel="insetLabel"
|
|
808
|
-
onFocus={() => console.log('onFocus')}
|
|
809
|
-
onBlur={() => console.log('onBlur')}
|
|
810
|
-
onSearch={(val) => console.log(val)}
|
|
811
|
-
>
|
|
812
|
-
{colorOptions.map(option => (
|
|
813
|
-
<Option value={option.value} key={option.value}>
|
|
814
|
-
<div style={alignStyle}>
|
|
815
|
-
<span style={option.spanStyle}></span>
|
|
816
|
-
{option.value}
|
|
817
|
-
</div>
|
|
818
|
-
</Option>
|
|
819
|
-
))}
|
|
820
|
-
</Select>
|
|
821
|
-
</div>
|
|
822
|
-
);
|
|
823
|
-
|
|
824
|
-
SelectFilterSingle.story = {
|
|
825
|
-
name: 'select filter single',
|
|
826
|
-
};
|
|
827
|
-
|
|
828
|
-
export const SelectFilterMultiple = () => (
|
|
829
|
-
<>
|
|
830
|
-
<Select
|
|
831
|
-
filter
|
|
832
|
-
multiple={true}
|
|
833
|
-
style={{
|
|
834
|
-
width: '250px',
|
|
835
|
-
}}
|
|
836
|
-
placeholder="fefe"
|
|
837
|
-
>
|
|
838
|
-
<Option value={1}>opt1</Option>
|
|
839
|
-
<Option value={2}>opt2</Option>
|
|
840
|
-
<Option value={3}>opt22</Option>
|
|
841
|
-
<Option value={3}>opt3</Option>
|
|
842
|
-
<Option value={4}>opt4</Option>
|
|
843
|
-
<Option value={5}>opt5</Option>
|
|
844
|
-
<Option value={6}>opt6</Option>
|
|
845
|
-
<Option value={7}>opt7</Option>
|
|
846
|
-
<Option value={8}>opt8</Option>
|
|
847
|
-
</Select>
|
|
848
|
-
<Select
|
|
849
|
-
filter
|
|
850
|
-
multiple={true}
|
|
851
|
-
maxTagCount={3}
|
|
852
|
-
style={{
|
|
853
|
-
width: '270px',
|
|
854
|
-
}}
|
|
855
|
-
placeholder="fefe"
|
|
856
|
-
>
|
|
857
|
-
<Option value={1}>opt1</Option>
|
|
858
|
-
<Option value={2}>opt2</Option>
|
|
859
|
-
<Option value={3}>opt22</Option>
|
|
860
|
-
<Option value={3}>opt3</Option>
|
|
861
|
-
<Option value={4}>opt4</Option>
|
|
862
|
-
<Option value={5}>opt5</Option>
|
|
863
|
-
<Option value={6}>opt6</Option>
|
|
864
|
-
<Option value={7}>opt7</Option>
|
|
865
|
-
<Option value={8}>opt8</Option>
|
|
866
|
-
</Select>
|
|
867
|
-
</>
|
|
868
|
-
);
|
|
869
|
-
|
|
870
|
-
SelectFilterMultiple.story = {
|
|
871
|
-
name: 'select filter multiple',
|
|
872
|
-
};
|
|
873
|
-
|
|
874
|
-
const OptionLabelProp = () => {
|
|
875
|
-
const [value, setValue] = useState(1);
|
|
876
|
-
return (
|
|
877
|
-
<>
|
|
878
|
-
设置optionLabelProp属性(默认为'children')为'value'时,回填到选择框中的文本会是Option.value
|
|
879
|
-
<br></br>
|
|
880
|
-
<Select
|
|
881
|
-
style={{
|
|
882
|
-
width: '250px',
|
|
883
|
-
}}
|
|
884
|
-
defaultValue={1}
|
|
885
|
-
optionLabelProp="value"
|
|
886
|
-
>
|
|
887
|
-
<Option value={1}>opt1</Option>
|
|
888
|
-
<Option value={2}>opt2</Option>
|
|
889
|
-
<Option value={3}>
|
|
890
|
-
<span
|
|
891
|
-
style={{
|
|
892
|
-
color: 'pink',
|
|
893
|
-
}}
|
|
894
|
-
>
|
|
895
|
-
opt3 Node
|
|
896
|
-
</span>
|
|
897
|
-
</Option>
|
|
898
|
-
<Option value="4">
|
|
899
|
-
<span
|
|
900
|
-
style={{
|
|
901
|
-
color: 'red',
|
|
902
|
-
}}
|
|
903
|
-
>
|
|
904
|
-
testNode
|
|
905
|
-
</span>
|
|
906
|
-
</Option>
|
|
907
|
-
</Select>
|
|
908
|
-
<br />
|
|
909
|
-
<br />
|
|
910
|
-
<Select
|
|
911
|
-
style={{
|
|
912
|
-
width: '250px',
|
|
913
|
-
}}
|
|
914
|
-
value={value}
|
|
915
|
-
optionLabelProp="value"
|
|
916
|
-
onChange={setValue}
|
|
917
|
-
>
|
|
918
|
-
<Option value={1}>opt1</Option>
|
|
919
|
-
<Option value={2}>opt2</Option>
|
|
920
|
-
<Option value={3}>
|
|
921
|
-
<span
|
|
922
|
-
style={{
|
|
923
|
-
color: 'pink',
|
|
924
|
-
}}
|
|
925
|
-
>
|
|
926
|
-
opt3 Node
|
|
927
|
-
</span>
|
|
928
|
-
</Option>
|
|
929
|
-
<Option value="4">
|
|
930
|
-
<span
|
|
931
|
-
style={{
|
|
932
|
-
color: 'red',
|
|
933
|
-
}}
|
|
934
|
-
>
|
|
935
|
-
testNode
|
|
936
|
-
</span>
|
|
937
|
-
</Option>
|
|
938
|
-
</Select>
|
|
939
|
-
<br />
|
|
940
|
-
<br />
|
|
941
|
-
<Select
|
|
942
|
-
style={{
|
|
943
|
-
width: '250px',
|
|
944
|
-
}}
|
|
945
|
-
defaultValue={1}
|
|
946
|
-
>
|
|
947
|
-
<Option value={1}>children Label Text 1</Option>
|
|
948
|
-
<Option value={2}>opt2</Option>
|
|
949
|
-
<Option value={3}>opt3</Option>
|
|
950
|
-
<Option value="4">
|
|
951
|
-
<span
|
|
952
|
-
style={{
|
|
953
|
-
color: 'red',
|
|
954
|
-
}}
|
|
955
|
-
>
|
|
956
|
-
testNode
|
|
957
|
-
</span>
|
|
958
|
-
</Option>
|
|
959
|
-
</Select>
|
|
960
|
-
<Select
|
|
961
|
-
style={{
|
|
962
|
-
width: '250px',
|
|
963
|
-
}}
|
|
964
|
-
defaultValue={1}
|
|
965
|
-
filter
|
|
966
|
-
optionLabelProp="value"
|
|
967
|
-
>
|
|
968
|
-
<Option value={1}>children Label Text 1</Option>
|
|
969
|
-
<Option value={2}>opt2</Option>
|
|
970
|
-
<Option value={3}>opt3</Option>
|
|
971
|
-
<Option value="4">
|
|
972
|
-
<span
|
|
973
|
-
style={{
|
|
974
|
-
color: 'red',
|
|
975
|
-
}}
|
|
976
|
-
>
|
|
977
|
-
testNode
|
|
978
|
-
</span>
|
|
979
|
-
</Option>
|
|
980
|
-
</Select>
|
|
981
|
-
<br />
|
|
982
|
-
<br />
|
|
983
|
-
多选
|
|
984
|
-
<Select
|
|
985
|
-
style={{
|
|
986
|
-
width: '250px',
|
|
987
|
-
}}
|
|
988
|
-
multiple
|
|
989
|
-
filter
|
|
990
|
-
optionLabelProp="value"
|
|
991
|
-
>
|
|
992
|
-
<Option value={1}>children Label Text 1</Option>
|
|
993
|
-
<Option value={2}>opt2</Option>
|
|
994
|
-
<Option value={3}>opt3</Option>
|
|
995
|
-
<Option value="4">
|
|
996
|
-
<span
|
|
997
|
-
style={{
|
|
998
|
-
color: 'red',
|
|
999
|
-
}}
|
|
1000
|
-
>
|
|
1001
|
-
testNode
|
|
1002
|
-
</span>
|
|
1003
|
-
</Option>
|
|
1004
|
-
</Select>
|
|
1005
|
-
</>
|
|
1006
|
-
);
|
|
1007
|
-
};
|
|
1008
|
-
|
|
1009
|
-
class CustomRender extends React.Component {
|
|
1010
|
-
constructor() {
|
|
1011
|
-
super();
|
|
1012
|
-
this.state = {
|
|
1013
|
-
list: [
|
|
1014
|
-
{
|
|
1015
|
-
name: '夏可漫',
|
|
1016
|
-
email: 'xiakeman@example.com',
|
|
1017
|
-
abbr: 'XK',
|
|
1018
|
-
color: 'amber',
|
|
1019
|
-
},
|
|
1020
|
-
{
|
|
1021
|
-
name: '申悦',
|
|
1022
|
-
email: 'shenyue@example.com',
|
|
1023
|
-
abbr: 'SY',
|
|
1024
|
-
color: 'indigo',
|
|
1025
|
-
},
|
|
1026
|
-
{
|
|
1027
|
-
name: '曲晨一',
|
|
1028
|
-
email: 'quchenyi@example.com',
|
|
1029
|
-
abbr: 'CY',
|
|
1030
|
-
color: 'blue',
|
|
1031
|
-
},
|
|
1032
|
-
{
|
|
1033
|
-
name: '文嘉茂',
|
|
1034
|
-
email: 'wenjiamao@example.com',
|
|
1035
|
-
abbr: 'JM',
|
|
1036
|
-
color: 'cyan',
|
|
1037
|
-
},
|
|
1038
|
-
],
|
|
1039
|
-
};
|
|
1040
|
-
}
|
|
1041
|
-
|
|
1042
|
-
renderCustomOption(item, index) {
|
|
1043
|
-
const optionStyle = {
|
|
1044
|
-
display: 'flex',
|
|
1045
|
-
};
|
|
1046
|
-
return (
|
|
1047
|
-
<Option key={index} value={item.name} style={optionStyle} showTick={false} {...item}>
|
|
1048
|
-
<Avatar color={item.color} size="small">
|
|
1049
|
-
{item.abbr}
|
|
1050
|
-
</Avatar>
|
|
1051
|
-
<div
|
|
1052
|
-
style={{
|
|
1053
|
-
marginLeft: 4,
|
|
1054
|
-
}}
|
|
1055
|
-
>
|
|
1056
|
-
<p
|
|
1057
|
-
style={{
|
|
1058
|
-
fontSize: 14,
|
|
1059
|
-
margin: 4,
|
|
1060
|
-
}}
|
|
1061
|
-
>
|
|
1062
|
-
{item.name}
|
|
1063
|
-
</p>
|
|
1064
|
-
<p
|
|
1065
|
-
style={{
|
|
1066
|
-
margin: 4,
|
|
1067
|
-
}}
|
|
1068
|
-
>
|
|
1069
|
-
{item.email}
|
|
1070
|
-
</p>
|
|
1071
|
-
</div>
|
|
1072
|
-
</Option>
|
|
1073
|
-
);
|
|
1074
|
-
}
|
|
1075
|
-
|
|
1076
|
-
renderSelectedItem(optionNode) {
|
|
1077
|
-
return (
|
|
1078
|
-
<div>
|
|
1079
|
-
<Avatar color={optionNode.color} size="small">
|
|
1080
|
-
{optionNode.abbr}
|
|
1081
|
-
</Avatar>
|
|
1082
|
-
<span
|
|
1083
|
-
style={{
|
|
1084
|
-
margin: 8,
|
|
1085
|
-
}}
|
|
1086
|
-
>
|
|
1087
|
-
{optionNode.email}
|
|
1088
|
-
</span>
|
|
1089
|
-
</div>
|
|
1090
|
-
);
|
|
1091
|
-
}
|
|
1092
|
-
|
|
1093
|
-
renderMultipleSelectedItem(optionNode) {
|
|
1094
|
-
let content = (
|
|
1095
|
-
<div>
|
|
1096
|
-
<Avatar color={optionNode.color} size="small">
|
|
1097
|
-
{optionNode.abbr}
|
|
1098
|
-
</Avatar>
|
|
1099
|
-
</div>
|
|
1100
|
-
);
|
|
1101
|
-
return {
|
|
1102
|
-
isRenderInTag: true,
|
|
1103
|
-
content,
|
|
1104
|
-
};
|
|
1105
|
-
}
|
|
1106
|
-
|
|
1107
|
-
renderMultipleWithoutTag(optionNode) {
|
|
1108
|
-
let content = (
|
|
1109
|
-
<div>
|
|
1110
|
-
<Avatar color={optionNode.color} size="small">
|
|
1111
|
-
{optionNode.abbr}
|
|
1112
|
-
</Avatar>
|
|
1113
|
-
</div>
|
|
1114
|
-
);
|
|
1115
|
-
return {
|
|
1116
|
-
isRenderInTag: false,
|
|
1117
|
-
content,
|
|
1118
|
-
};
|
|
1119
|
-
}
|
|
1120
|
-
|
|
1121
|
-
render() {
|
|
1122
|
-
const { list } = this.state;
|
|
1123
|
-
return (
|
|
1124
|
-
<React.Fragment>
|
|
1125
|
-
<Select
|
|
1126
|
-
style={{
|
|
1127
|
-
width: 300,
|
|
1128
|
-
height: 40,
|
|
1129
|
-
}}
|
|
1130
|
-
onChange={this.provinceChange}
|
|
1131
|
-
defaultValue={'夏可漫'}
|
|
1132
|
-
renderSelectedItem={this.renderSelectedItem}
|
|
1133
|
-
>
|
|
1134
|
-
{list.map((item, index) => this.renderCustomOption(item, index))}
|
|
1135
|
-
</Select>
|
|
1136
|
-
<Select
|
|
1137
|
-
style={{
|
|
1138
|
-
width: 360,
|
|
1139
|
-
height: 60,
|
|
1140
|
-
marginTop: 20,
|
|
1141
|
-
}}
|
|
1142
|
-
onChange={this.provinceChange}
|
|
1143
|
-
defaultValue={['夏可漫', '申悦']}
|
|
1144
|
-
multiple
|
|
1145
|
-
renderSelectedItem={this.renderMultipleSelectedItem}
|
|
1146
|
-
>
|
|
1147
|
-
{list.map((item, index) => this.renderCustomOption(item, index))}
|
|
1148
|
-
</Select>
|
|
1149
|
-
<Select
|
|
1150
|
-
style={{
|
|
1151
|
-
width: 360,
|
|
1152
|
-
height: 60,
|
|
1153
|
-
marginTop: 20,
|
|
1154
|
-
}}
|
|
1155
|
-
onChange={this.provinceChange}
|
|
1156
|
-
defaultValue={['夏可漫', '申悦']}
|
|
1157
|
-
multiple
|
|
1158
|
-
renderSelectedItem={this.renderMultipleWithoutTag}
|
|
1159
|
-
>
|
|
1160
|
-
{list.map((item, index) => this.renderCustomOption(item, index))}
|
|
1161
|
-
</Select>
|
|
1162
|
-
</React.Fragment>
|
|
1163
|
-
);
|
|
1164
|
-
}
|
|
1165
|
-
}
|
|
1166
|
-
|
|
1167
|
-
export const RenderSelectedItem = () => (
|
|
1168
|
-
<>
|
|
1169
|
-
renderSelectedItem
|
|
1170
|
-
<CustomRender />
|
|
1171
|
-
<br />
|
|
1172
|
-
<br />
|
|
1173
|
-
OptionLabelProp
|
|
1174
|
-
<OptionLabelProp />
|
|
1175
|
-
</>
|
|
1176
|
-
);
|
|
1177
|
-
|
|
1178
|
-
RenderSelectedItem.story = {
|
|
1179
|
-
name: 'renderSelectedItem',
|
|
1180
|
-
};
|
|
1181
|
-
|
|
1182
|
-
RenderSelectedItem.parameters = {
|
|
1183
|
-
chromatic: { disableSnapshot: false },
|
|
1184
|
-
};
|
|
1185
|
-
|
|
1186
|
-
const ControlledSelect = () => {
|
|
1187
|
-
const [value, setValue] = useState('nick');
|
|
1188
|
-
const [value2, setValue2] = useState('jerry');
|
|
1189
|
-
const [value3, setValue3] = useState();
|
|
1190
|
-
const [value4, setValue4] = useState(['nick']);
|
|
1191
|
-
const [value5, setValue5] = useState();
|
|
1192
|
-
return (
|
|
1193
|
-
<>
|
|
1194
|
-
<span>value + onChange</span>
|
|
1195
|
-
<Select
|
|
1196
|
-
value={value}
|
|
1197
|
-
onChange={setValue}
|
|
1198
|
-
style={{
|
|
1199
|
-
width: 200,
|
|
1200
|
-
}}
|
|
1201
|
-
>
|
|
1202
|
-
<Option value="nick">nick</Option>
|
|
1203
|
-
<Option value="jerry">jerry</Option>
|
|
1204
|
-
<Option value="mark">mark</Option>
|
|
1205
|
-
</Select>
|
|
1206
|
-
|
|
1207
|
-
<br />
|
|
1208
|
-
<br />
|
|
1209
|
-
<span>只传value,不传onChange</span>
|
|
1210
|
-
<Select
|
|
1211
|
-
value={value2}
|
|
1212
|
-
style={{
|
|
1213
|
-
width: 200,
|
|
1214
|
-
}}
|
|
1215
|
-
>
|
|
1216
|
-
<Option value="nick">nick</Option>
|
|
1217
|
-
<Option value="jerry">jerry</Option>
|
|
1218
|
-
<Option value="mark">mark</Option>
|
|
1219
|
-
</Select>
|
|
1220
|
-
<br />
|
|
1221
|
-
<br />
|
|
1222
|
-
|
|
1223
|
-
<span>value + onChange , 多选</span>
|
|
1224
|
-
<Select
|
|
1225
|
-
value={value3}
|
|
1226
|
-
onChange={setValue3}
|
|
1227
|
-
multiple
|
|
1228
|
-
style={{
|
|
1229
|
-
width: 200,
|
|
1230
|
-
}}
|
|
1231
|
-
>
|
|
1232
|
-
<Option value="nick">nick</Option>
|
|
1233
|
-
<Option value="jerry">jerry</Option>
|
|
1234
|
-
<Option value="mark">mark</Option>
|
|
1235
|
-
<Option value="nick2">nick2</Option>
|
|
1236
|
-
<Option value="jerry2">jerry2</Option>
|
|
1237
|
-
<Option value="mark2">mark2</Option>
|
|
1238
|
-
</Select>
|
|
1239
|
-
<br />
|
|
1240
|
-
<br />
|
|
1241
|
-
|
|
1242
|
-
<span>value, 多选</span>
|
|
1243
|
-
<Select
|
|
1244
|
-
value={value4}
|
|
1245
|
-
multiple
|
|
1246
|
-
style={{
|
|
1247
|
-
width: 200,
|
|
1248
|
-
}}
|
|
1249
|
-
>
|
|
1250
|
-
<Option value="nick">nick</Option>
|
|
1251
|
-
<Option value="jerry">jerry</Option>
|
|
1252
|
-
<Option value="mark">mark</Option>
|
|
1253
|
-
</Select>
|
|
1254
|
-
|
|
1255
|
-
<br />
|
|
1256
|
-
<h5>filter为true,但option label为node时</h5>
|
|
1257
|
-
<Select
|
|
1258
|
-
style={{
|
|
1259
|
-
width: '250px',
|
|
1260
|
-
}}
|
|
1261
|
-
filter={customFilter}
|
|
1262
|
-
onChange={v => console.log(v)}
|
|
1263
|
-
insetLabel="insetLabel"
|
|
1264
|
-
value={value5}
|
|
1265
|
-
onChange={setValue5}
|
|
1266
|
-
>
|
|
1267
|
-
{colorOptions.map(option => (
|
|
1268
|
-
<Option value={option.value} key={option.value}>
|
|
1269
|
-
<div style={alignStyle}>
|
|
1270
|
-
<span style={option.spanStyle}></span>
|
|
1271
|
-
{option.value}
|
|
1272
|
-
</div>
|
|
1273
|
-
</Option>
|
|
1274
|
-
))}
|
|
1275
|
-
</Select>
|
|
1276
|
-
</>
|
|
1277
|
-
);
|
|
1278
|
-
};
|
|
1279
|
-
|
|
1280
|
-
export const Controlled = () => <ControlledSelect></ControlledSelect>;
|
|
1281
|
-
|
|
1282
|
-
Controlled.story = {
|
|
1283
|
-
name: 'controlled',
|
|
1284
|
-
};
|
|
1285
|
-
|
|
1286
|
-
const UnControlledSelect = () => {
|
|
1287
|
-
const onChange = value => {
|
|
1288
|
-
console.log(value);
|
|
1289
|
-
};
|
|
1290
|
-
|
|
1291
|
-
return (
|
|
1292
|
-
<>
|
|
1293
|
-
<h5>defaultValue在list中不存在</h5>
|
|
1294
|
-
<Select
|
|
1295
|
-
defaultValue={90}
|
|
1296
|
-
onChange={onChange}
|
|
1297
|
-
style={{
|
|
1298
|
-
width: 200,
|
|
1299
|
-
}}
|
|
1300
|
-
>
|
|
1301
|
-
<Option value={20}>nick</Option>
|
|
1302
|
-
<Option value={10}>jerry</Option>
|
|
1303
|
-
<Option value={5}>mark</Option>
|
|
1304
|
-
</Select>
|
|
1305
|
-
<h5>defaultValue在list中存在</h5>
|
|
1306
|
-
<Select
|
|
1307
|
-
defaultValue={10}
|
|
1308
|
-
onChange={onChange}
|
|
1309
|
-
style={{
|
|
1310
|
-
width: 200,
|
|
1311
|
-
}}
|
|
1312
|
-
>
|
|
1313
|
-
<Option value={20}>nick</Option>
|
|
1314
|
-
<Option value={10}>jerry</Option>
|
|
1315
|
-
<Option value={5}>mark</Option>
|
|
1316
|
-
</Select>
|
|
1317
|
-
</>
|
|
1318
|
-
);
|
|
1319
|
-
};
|
|
1320
|
-
|
|
1321
|
-
export { UnControlledSelect };
|
|
1322
|
-
UnControlledSelect.story = {
|
|
1323
|
-
name: '非受控组件'
|
|
1324
|
-
};
|
|
1325
|
-
|
|
1326
|
-
export const TestScroll = () => (
|
|
1327
|
-
<div
|
|
1328
|
-
style={{
|
|
1329
|
-
marginTop: '600px',
|
|
1330
|
-
marginBottom: '50px',
|
|
1331
|
-
}}
|
|
1332
|
-
>
|
|
1333
|
-
<Select
|
|
1334
|
-
style={{
|
|
1335
|
-
width: '150px',
|
|
1336
|
-
}}
|
|
1337
|
-
>
|
|
1338
|
-
<Option value="tony">IronMan</Option>
|
|
1339
|
-
<Option value="Thor" disabled>
|
|
1340
|
-
Thor
|
|
1341
|
-
</Option>
|
|
1342
|
-
<Option value="steve">Caption</Option>
|
|
1343
|
-
<Option value="peter">SpiderBoy</Option>
|
|
1344
|
-
</Select>
|
|
1345
|
-
</div>
|
|
1346
|
-
);
|
|
1347
|
-
|
|
1348
|
-
TestScroll.story = {
|
|
1349
|
-
name: 'test scroll',
|
|
1350
|
-
};
|
|
1351
|
-
|
|
1352
|
-
let optionList = [
|
|
1353
|
-
{
|
|
1354
|
-
value: 'tony',
|
|
1355
|
-
label: 'Ironman',
|
|
1356
|
-
},
|
|
1357
|
-
{
|
|
1358
|
-
value: 'Thor',
|
|
1359
|
-
label: 'Thor',
|
|
1360
|
-
},
|
|
1361
|
-
{
|
|
1362
|
-
value: 'steve',
|
|
1363
|
-
label: 'Caption',
|
|
1364
|
-
},
|
|
1365
|
-
{
|
|
1366
|
-
value: 'peter',
|
|
1367
|
-
label: 'SpiderBoy',
|
|
1368
|
-
},
|
|
1369
|
-
];
|
|
1370
|
-
|
|
1371
|
-
export const OptionList = () => (
|
|
1372
|
-
<Select
|
|
1373
|
-
style={{
|
|
1374
|
-
width: '100px',
|
|
1375
|
-
}}
|
|
1376
|
-
optionList={optionList}
|
|
1377
|
-
></Select>
|
|
1378
|
-
);
|
|
1379
|
-
|
|
1380
|
-
OptionList.story = {
|
|
1381
|
-
name: 'optionList',
|
|
1382
|
-
};
|
|
1383
|
-
|
|
1384
|
-
export const InsetLabel = () => (
|
|
1385
|
-
<>
|
|
1386
|
-
<Select
|
|
1387
|
-
style={{
|
|
1388
|
-
width: 300,
|
|
1389
|
-
}}
|
|
1390
|
-
insetLabel="主播类型"
|
|
1391
|
-
placeholder="请选择"
|
|
1392
|
-
optionList={optionList}
|
|
1393
|
-
></Select>
|
|
1394
|
-
<Select
|
|
1395
|
-
style={{
|
|
1396
|
-
width: 300,
|
|
1397
|
-
}}
|
|
1398
|
-
multiple
|
|
1399
|
-
insetLabel="主播类型"
|
|
1400
|
-
optionList={optionList}
|
|
1401
|
-
></Select>
|
|
1402
|
-
<Select
|
|
1403
|
-
style={{
|
|
1404
|
-
width: 300,
|
|
1405
|
-
}}
|
|
1406
|
-
filter
|
|
1407
|
-
insetLabel="主播类型"
|
|
1408
|
-
optionList={optionList}
|
|
1409
|
-
></Select>
|
|
1410
|
-
<Select
|
|
1411
|
-
style={{
|
|
1412
|
-
width: 300,
|
|
1413
|
-
}}
|
|
1414
|
-
filter
|
|
1415
|
-
multiple
|
|
1416
|
-
insetLabel="主播类型"
|
|
1417
|
-
optionList={optionList}
|
|
1418
|
-
></Select>
|
|
1419
|
-
</>
|
|
1420
|
-
);
|
|
1421
|
-
|
|
1422
|
-
InsetLabel.story = {
|
|
1423
|
-
name: 'insetLabel',
|
|
1424
|
-
};
|
|
1425
|
-
|
|
1426
|
-
export const ChangeOptionDynamic = () => {
|
|
1427
|
-
function App() {
|
|
1428
|
-
let [options, setOptions] = useState([]);
|
|
1429
|
-
let [index, setIndex] = useState(0);
|
|
1430
|
-
|
|
1431
|
-
const addOption = () => {
|
|
1432
|
-
const randomItem = optionList[index];
|
|
1433
|
-
index = index + 1;
|
|
1434
|
-
setIndex(index);
|
|
1435
|
-
options = [...options, { ...randomItem }];
|
|
1436
|
-
setOptions(options);
|
|
1437
|
-
};
|
|
1438
|
-
|
|
1439
|
-
const reset = () => {
|
|
1440
|
-
setOptions([]);
|
|
1441
|
-
setIndex(0);
|
|
1442
|
-
};
|
|
1443
|
-
|
|
1444
|
-
return (
|
|
1445
|
-
<div>
|
|
1446
|
-
<Select
|
|
1447
|
-
style={{
|
|
1448
|
-
width: '150px',
|
|
1449
|
-
}}
|
|
1450
|
-
defaultValue="tony"
|
|
1451
|
-
>
|
|
1452
|
-
{options.map((option, idx) => (
|
|
1453
|
-
<Select.Option key={option.key || idx} value={option.value}>
|
|
1454
|
-
{option.label}
|
|
1455
|
-
</Select.Option>
|
|
1456
|
-
))}
|
|
1457
|
-
</Select>
|
|
1458
|
-
<h4>多选</h4>
|
|
1459
|
-
<Select
|
|
1460
|
-
style={{
|
|
1461
|
-
width: '150px',
|
|
1462
|
-
}}
|
|
1463
|
-
multiple
|
|
1464
|
-
defaultValue={['tony']}
|
|
1465
|
-
>
|
|
1466
|
-
{options.map((option, idx) => (
|
|
1467
|
-
<Select.Option key={option.key || idx} value={option.value}>
|
|
1468
|
-
{option.label}
|
|
1469
|
-
</Select.Option>
|
|
1470
|
-
))}
|
|
1471
|
-
</Select>
|
|
1472
|
-
<button onClick={addOption}>add option</button>
|
|
1473
|
-
<button onClick={reset}>reset</button>
|
|
1474
|
-
</div>
|
|
1475
|
-
);
|
|
1476
|
-
}
|
|
1477
|
-
|
|
1478
|
-
return <App />;
|
|
1479
|
-
};
|
|
1480
|
-
|
|
1481
|
-
ChangeOptionDynamic.story = {
|
|
1482
|
-
name: 'change option dynamic',
|
|
1483
|
-
};
|
|
1484
|
-
|
|
1485
|
-
let list = [
|
|
1486
|
-
{
|
|
1487
|
-
value: 'tony',
|
|
1488
|
-
label: 'Ironman',
|
|
1489
|
-
otherKey: {
|
|
1490
|
-
role: 1,
|
|
1491
|
-
},
|
|
1492
|
-
},
|
|
1493
|
-
{
|
|
1494
|
-
value: 'Thor',
|
|
1495
|
-
label: 'Thor',
|
|
1496
|
-
otherKey: {
|
|
1497
|
-
role: 2,
|
|
1498
|
-
},
|
|
1499
|
-
},
|
|
1500
|
-
{
|
|
1501
|
-
value: 'steve',
|
|
1502
|
-
label: 'Caption',
|
|
1503
|
-
otherKey: {
|
|
1504
|
-
role: 3,
|
|
1505
|
-
},
|
|
1506
|
-
},
|
|
1507
|
-
{
|
|
1508
|
-
value: 'peter',
|
|
1509
|
-
label: 'SpiderBoy',
|
|
1510
|
-
otherKey: {
|
|
1511
|
-
role: 4,
|
|
1512
|
-
},
|
|
1513
|
-
},
|
|
1514
|
-
];
|
|
1515
|
-
|
|
1516
|
-
const SearchDemo1 = () => {
|
|
1517
|
-
const [optionList, setOptionList] = useState(list);
|
|
1518
|
-
const [loading, setLoading] = useState(false);
|
|
1519
|
-
|
|
1520
|
-
const handleSearch = value => {
|
|
1521
|
-
setLoading(true);
|
|
1522
|
-
let length = Math.ceil(Math.random() * 10);
|
|
1523
|
-
let result = Array.from(
|
|
1524
|
-
{
|
|
1525
|
-
length,
|
|
1526
|
-
},
|
|
1527
|
-
(v, i) => {
|
|
1528
|
-
return {
|
|
1529
|
-
value: value + i,
|
|
1530
|
-
label: value + i,
|
|
1531
|
-
otherKey: {
|
|
1532
|
-
role: i,
|
|
1533
|
-
},
|
|
1534
|
-
};
|
|
1535
|
-
}
|
|
1536
|
-
);
|
|
1537
|
-
setTimeout(() => {
|
|
1538
|
-
setOptionList(result);
|
|
1539
|
-
setLoading(false);
|
|
1540
|
-
}, 1000);
|
|
1541
|
-
};
|
|
1542
|
-
|
|
1543
|
-
const [value, setValue] = useState(optionList[0].value);
|
|
1544
|
-
|
|
1545
|
-
const onChange = value => {
|
|
1546
|
-
console.log(value);
|
|
1547
|
-
setValue(value);
|
|
1548
|
-
};
|
|
1549
|
-
|
|
1550
|
-
return (
|
|
1551
|
-
<div>
|
|
1552
|
-
受控:
|
|
1553
|
-
<Select
|
|
1554
|
-
filter
|
|
1555
|
-
style={{
|
|
1556
|
-
width: '150px',
|
|
1557
|
-
}}
|
|
1558
|
-
onSearch={v => handleSearch(v)}
|
|
1559
|
-
optionList={optionList}
|
|
1560
|
-
value={value}
|
|
1561
|
-
loading={loading}
|
|
1562
|
-
showClear
|
|
1563
|
-
onChange={onChange}
|
|
1564
|
-
></Select>
|
|
1565
|
-
非受控:
|
|
1566
|
-
<Select
|
|
1567
|
-
style={{
|
|
1568
|
-
width: '150px',
|
|
1569
|
-
}}
|
|
1570
|
-
filter
|
|
1571
|
-
showClear
|
|
1572
|
-
onSearch={v => handleSearch(v)}
|
|
1573
|
-
optionList={optionList}
|
|
1574
|
-
loading={loading}
|
|
1575
|
-
onChange={onChange}
|
|
1576
|
-
></Select>
|
|
1577
|
-
多选非受控
|
|
1578
|
-
<Select
|
|
1579
|
-
style={{
|
|
1580
|
-
width: '150px',
|
|
1581
|
-
}}
|
|
1582
|
-
showClear
|
|
1583
|
-
filter
|
|
1584
|
-
multiple
|
|
1585
|
-
onSearch={v => handleSearch(v)}
|
|
1586
|
-
optionList={optionList}
|
|
1587
|
-
loading={loading}
|
|
1588
|
-
onChange={onChange}
|
|
1589
|
-
></Select>
|
|
1590
|
-
</div>
|
|
1591
|
-
);
|
|
1592
|
-
};
|
|
1593
|
-
|
|
1594
|
-
import debounce from 'lodash/debounce';
|
|
1595
|
-
|
|
1596
|
-
class SearchDemo2 extends React.Component {
|
|
1597
|
-
constructor() {
|
|
1598
|
-
super();
|
|
1599
|
-
this.state = {
|
|
1600
|
-
loading: false,
|
|
1601
|
-
optionList: [
|
|
1602
|
-
{
|
|
1603
|
-
value: 'abc',
|
|
1604
|
-
label: '抖音',
|
|
1605
|
-
type: 1,
|
|
1606
|
-
},
|
|
1607
|
-
{
|
|
1608
|
-
value: 'hotsoon',
|
|
1609
|
-
label: '火山小视频',
|
|
1610
|
-
type: 2,
|
|
1611
|
-
},
|
|
1612
|
-
{
|
|
1613
|
-
value: 'pipixia',
|
|
1614
|
-
label: '皮皮虾',
|
|
1615
|
-
type: 3,
|
|
1616
|
-
},
|
|
1617
|
-
{
|
|
1618
|
-
value: 'toutiao',
|
|
1619
|
-
label: '今日头条',
|
|
1620
|
-
type: 4,
|
|
1621
|
-
},
|
|
1622
|
-
],
|
|
1623
|
-
value: [],
|
|
1624
|
-
};
|
|
1625
|
-
this.handleSearch = debounce(this.handleSearch, 800).bind(this);
|
|
1626
|
-
this.onChange = this.onChange.bind(this);
|
|
1627
|
-
this.customRender = this.customRender.bind(this);
|
|
1628
|
-
}
|
|
1629
|
-
|
|
1630
|
-
handleSearch(inputValue) {
|
|
1631
|
-
this.setState({
|
|
1632
|
-
loading: true,
|
|
1633
|
-
});
|
|
1634
|
-
let length = Math.ceil(Math.random() * 100);
|
|
1635
|
-
let result = Array.from(
|
|
1636
|
-
{
|
|
1637
|
-
length,
|
|
1638
|
-
},
|
|
1639
|
-
(v, i) => {
|
|
1640
|
-
return {
|
|
1641
|
-
value: inputValue + i,
|
|
1642
|
-
label: 'label' + i,
|
|
1643
|
-
type: i + 1,
|
|
1644
|
-
};
|
|
1645
|
-
}
|
|
1646
|
-
);
|
|
1647
|
-
setTimeout(() => {
|
|
1648
|
-
this.setState({
|
|
1649
|
-
optionList: result,
|
|
1650
|
-
loading: false,
|
|
1651
|
-
});
|
|
1652
|
-
}, 2000);
|
|
1653
|
-
}
|
|
1654
|
-
|
|
1655
|
-
onChange(value) {
|
|
1656
|
-
this.setState({
|
|
1657
|
-
value,
|
|
1658
|
-
});
|
|
1659
|
-
console.log(value);
|
|
1660
|
-
}
|
|
1661
|
-
|
|
1662
|
-
customRender(optionNode) {
|
|
1663
|
-
return optionNode.value + optionNode.label;
|
|
1664
|
-
}
|
|
1665
|
-
|
|
1666
|
-
render() {
|
|
1667
|
-
const { loading, optionList, value } = this.state;
|
|
1668
|
-
return (
|
|
1669
|
-
<div>
|
|
1670
|
-
<Select
|
|
1671
|
-
style={{
|
|
1672
|
-
width: 150,
|
|
1673
|
-
}}
|
|
1674
|
-
showClear
|
|
1675
|
-
filter
|
|
1676
|
-
labelInValue
|
|
1677
|
-
onSearch={this.handleSearch}
|
|
1678
|
-
optionList={optionList}
|
|
1679
|
-
loading={loading}
|
|
1680
|
-
onChange={this.onChange}
|
|
1681
|
-
placeholder="请选择"
|
|
1682
|
-
></Select>
|
|
1683
|
-
<br />
|
|
1684
|
-
<br />
|
|
1685
|
-
<Select
|
|
1686
|
-
style={{
|
|
1687
|
-
width: 180,
|
|
1688
|
-
}}
|
|
1689
|
-
filter // labelInValue
|
|
1690
|
-
showClear
|
|
1691
|
-
multiple
|
|
1692
|
-
value={value}
|
|
1693
|
-
renderSelectedItem={this.customRender}
|
|
1694
|
-
onSearch={this.handleSearch}
|
|
1695
|
-
optionList={optionList}
|
|
1696
|
-
loading={loading}
|
|
1697
|
-
onChange={this.onChange}
|
|
1698
|
-
placeholder="请选择"
|
|
1699
|
-
></Select>
|
|
1700
|
-
</div>
|
|
1701
|
-
);
|
|
1702
|
-
}
|
|
1703
|
-
}
|
|
1704
|
-
|
|
1705
|
-
export const Search = () => (
|
|
1706
|
-
<>
|
|
1707
|
-
<SearchDemo1 />
|
|
1708
|
-
<SearchDemo2 />
|
|
1709
|
-
</>
|
|
1710
|
-
);
|
|
1711
|
-
|
|
1712
|
-
Search.story = {
|
|
1713
|
-
name: 'search',
|
|
1714
|
-
};
|
|
1715
|
-
|
|
1716
|
-
export const IncomeDetail = ({ config = {}, params = {} }) => {
|
|
1717
|
-
const [detailList, setDetailList] = useState([]);
|
|
1718
|
-
const [hasMore, setHasMore] = useState(true);
|
|
1719
|
-
const [loading, setLoading] = useState();
|
|
1720
|
-
let lock;
|
|
1721
|
-
|
|
1722
|
-
const fetchData = (outParams = {}) => {
|
|
1723
|
-
if (lock) {
|
|
1724
|
-
return;
|
|
1725
|
-
}
|
|
1726
|
-
|
|
1727
|
-
setLoading(true); // 参数
|
|
1728
|
-
// 请求
|
|
1729
|
-
|
|
1730
|
-
fetch({
|
|
1731
|
-
url: URL.user_profit,
|
|
1732
|
-
method: 'get',
|
|
1733
|
-
baseURL: config.webcast_host,
|
|
1734
|
-
params,
|
|
1735
|
-
})
|
|
1736
|
-
.then(res => {
|
|
1737
|
-
lock = false;
|
|
1738
|
-
setLoading(false);
|
|
1739
|
-
console.log('++++', data);
|
|
1740
|
-
})
|
|
1741
|
-
.catch(() => {
|
|
1742
|
-
setLoading(false);
|
|
1743
|
-
Toast.show('网络异常,请稍后重试');
|
|
1744
|
-
});
|
|
1745
|
-
};
|
|
1746
|
-
|
|
1747
|
-
useEffect(fetchData, []); // 监听滚动设置吸顶 以及加载更多
|
|
1748
|
-
|
|
1749
|
-
useEffect(() => {
|
|
1750
|
-
window.addEventListener('scroll', function() {
|
|
1751
|
-
// 加载更多
|
|
1752
|
-
const scrollY = window.scrollY;
|
|
1753
|
-
const scrollHeight = document.documentElement.scrollHeight;
|
|
1754
|
-
const screenHeight = screen.height;
|
|
1755
|
-
|
|
1756
|
-
if (!loading && hasMore && scrollY + screenHeight + 300 > scrollHeight) {
|
|
1757
|
-
fetchData();
|
|
1758
|
-
}
|
|
1759
|
-
});
|
|
1760
|
-
}, [detailList.length]);
|
|
1761
|
-
return (
|
|
1762
|
-
<div>
|
|
1763
|
-
<Select></Select>
|
|
1764
|
-
</div>
|
|
1765
|
-
);
|
|
1766
|
-
};
|
|
1767
|
-
|
|
1768
|
-
export const AllowCreate = () => (
|
|
1769
|
-
<Select
|
|
1770
|
-
style={{
|
|
1771
|
-
width: 500,
|
|
1772
|
-
}}
|
|
1773
|
-
optionList={optionList}
|
|
1774
|
-
allowCreate={true}
|
|
1775
|
-
multiple={true}
|
|
1776
|
-
filter={true}
|
|
1777
|
-
onChange={v => console.log(v)}
|
|
1778
|
-
></Select>
|
|
1779
|
-
);
|
|
1780
|
-
|
|
1781
|
-
AllowCreate.story = {
|
|
1782
|
-
name: 'allowCreate',
|
|
1783
|
-
};
|
|
1784
|
-
|
|
1785
|
-
export const AllowCreateCustomRender = () => (
|
|
1786
|
-
<Select
|
|
1787
|
-
style={{
|
|
1788
|
-
width: 500,
|
|
1789
|
-
}}
|
|
1790
|
-
optionList={optionList}
|
|
1791
|
-
allowCreate={true}
|
|
1792
|
-
multiple={true}
|
|
1793
|
-
filter={true}
|
|
1794
|
-
onChange={v => console.log(v)}
|
|
1795
|
-
renderCreateItem={v => `semi: ${v}`}
|
|
1796
|
-
></Select>
|
|
1797
|
-
);
|
|
1798
|
-
|
|
1799
|
-
AllowCreateCustomRender.story = {
|
|
1800
|
-
name: 'allowCreate custom render',
|
|
1801
|
-
};
|
|
1802
|
-
|
|
1803
|
-
let AllowCreateControlledDemo = () => {
|
|
1804
|
-
let [value, setValue] = useState();
|
|
1805
|
-
const optionList = [
|
|
1806
|
-
{
|
|
1807
|
-
value: 'abc',
|
|
1808
|
-
label: '抖音',
|
|
1809
|
-
},
|
|
1810
|
-
{
|
|
1811
|
-
value: 'hotsoon',
|
|
1812
|
-
label: '火山小视频',
|
|
1813
|
-
},
|
|
1814
|
-
{
|
|
1815
|
-
value: 'pipixia',
|
|
1816
|
-
label: '皮皮虾',
|
|
1817
|
-
},
|
|
1818
|
-
{
|
|
1819
|
-
value: 'toutiao',
|
|
1820
|
-
label: '今日头条',
|
|
1821
|
-
},
|
|
1822
|
-
];
|
|
1823
|
-
const [list, setList] = useState(optionList);
|
|
1824
|
-
|
|
1825
|
-
const handleSelect = v => {
|
|
1826
|
-
var lastOne = v[v.length - 1];
|
|
1827
|
-
|
|
1828
|
-
if (lastOne && list.findIndex(item => item.value === lastOne) == -1) {
|
|
1829
|
-
list.push({
|
|
1830
|
-
value: lastOne,
|
|
1831
|
-
label: lastOne,
|
|
1832
|
-
});
|
|
1833
|
-
}
|
|
1834
|
-
|
|
1835
|
-
setList(list);
|
|
1836
|
-
setValue(v);
|
|
1837
|
-
};
|
|
1838
|
-
|
|
1839
|
-
return (
|
|
1840
|
-
<Select
|
|
1841
|
-
style={{
|
|
1842
|
-
width: 400,
|
|
1843
|
-
}}
|
|
1844
|
-
optionList={list}
|
|
1845
|
-
allowCreate={true}
|
|
1846
|
-
multiple={true}
|
|
1847
|
-
filter={true}
|
|
1848
|
-
value={value}
|
|
1849
|
-
onChange={handleSelect}
|
|
1850
|
-
></Select>
|
|
1851
|
-
);
|
|
1852
|
-
};
|
|
1853
|
-
|
|
1854
|
-
const AllowCreateDemo = () => {
|
|
1855
|
-
let [value, setValue] = useState();
|
|
1856
|
-
const optionList = [
|
|
1857
|
-
{
|
|
1858
|
-
value: 'abc',
|
|
1859
|
-
label: '抖音',
|
|
1860
|
-
},
|
|
1861
|
-
{
|
|
1862
|
-
value: 'hotsoon',
|
|
1863
|
-
label: '火山小视频',
|
|
1864
|
-
},
|
|
1865
|
-
{
|
|
1866
|
-
value: 'pipixia',
|
|
1867
|
-
label: '皮皮虾',
|
|
1868
|
-
},
|
|
1869
|
-
{
|
|
1870
|
-
value: 'toutiao',
|
|
1871
|
-
label: '今日头条',
|
|
1872
|
-
},
|
|
1873
|
-
];
|
|
1874
|
-
const [list, setList] = useState(optionList);
|
|
1875
|
-
|
|
1876
|
-
const handleSelect = v => {
|
|
1877
|
-
var lastOne = v[v.length - 1];
|
|
1878
|
-
|
|
1879
|
-
if (lastOne && list.findIndex(item => item.value === lastOne) == -1) {
|
|
1880
|
-
list.push({
|
|
1881
|
-
value: lastOne,
|
|
1882
|
-
label: lastOne,
|
|
1883
|
-
});
|
|
1884
|
-
}
|
|
1885
|
-
|
|
1886
|
-
setList(list); // setValue(v)
|
|
1887
|
-
};
|
|
1888
|
-
|
|
1889
|
-
return (
|
|
1890
|
-
<Select
|
|
1891
|
-
style={{
|
|
1892
|
-
width: 400,
|
|
1893
|
-
}}
|
|
1894
|
-
optionList={list}
|
|
1895
|
-
defaultValue={['abc', 'hotsoon']}
|
|
1896
|
-
allowCreate={true}
|
|
1897
|
-
multiple={true}
|
|
1898
|
-
filter={true}
|
|
1899
|
-
onChange={handleSelect}
|
|
1900
|
-
></Select>
|
|
1901
|
-
);
|
|
1902
|
-
};
|
|
1903
|
-
|
|
1904
|
-
export const AllowCreateWithDefaultValue = () => <AllowCreateDemo />;
|
|
1905
|
-
|
|
1906
|
-
AllowCreateWithDefaultValue.story = {
|
|
1907
|
-
name: 'allowCreate with defaultValue',
|
|
1908
|
-
};
|
|
1909
|
-
|
|
1910
|
-
class HideDemo extends React.Component {
|
|
1911
|
-
constructor(props) {
|
|
1912
|
-
super(props);
|
|
1913
|
-
this.state = {
|
|
1914
|
-
optionList: [
|
|
1915
|
-
{
|
|
1916
|
-
value: 'abc',
|
|
1917
|
-
label: '抖音',
|
|
1918
|
-
},
|
|
1919
|
-
{
|
|
1920
|
-
value: 'hotsoon',
|
|
1921
|
-
label: '火山小视频',
|
|
1922
|
-
},
|
|
1923
|
-
{
|
|
1924
|
-
value: 'pipixia',
|
|
1925
|
-
label: '皮皮虾',
|
|
1926
|
-
},
|
|
1927
|
-
{
|
|
1928
|
-
value: 'toutiao',
|
|
1929
|
-
label: '今日头条',
|
|
1930
|
-
},
|
|
1931
|
-
],
|
|
1932
|
-
selectedItems: [],
|
|
1933
|
-
};
|
|
1934
|
-
this.onChange = this.onChange.bind(this);
|
|
1935
|
-
}
|
|
1936
|
-
|
|
1937
|
-
onChange(selectedItems) {
|
|
1938
|
-
this.setState({
|
|
1939
|
-
selectedItems,
|
|
1940
|
-
});
|
|
1941
|
-
}
|
|
1942
|
-
|
|
1943
|
-
render() {
|
|
1944
|
-
let { optionList, selectedItems } = this.state;
|
|
1945
|
-
let filterOptions = optionList.filter(option => !selectedItems.includes(option.value));
|
|
1946
|
-
return (
|
|
1947
|
-
<Select
|
|
1948
|
-
value={selectedItems}
|
|
1949
|
-
multiple
|
|
1950
|
-
style={{
|
|
1951
|
-
width: 300,
|
|
1952
|
-
}}
|
|
1953
|
-
onChange={this.onChange}
|
|
1954
|
-
optionList={filterOptions}
|
|
1955
|
-
></Select>
|
|
1956
|
-
);
|
|
1957
|
-
}
|
|
1958
|
-
}
|
|
1959
|
-
|
|
1960
|
-
export const AutoHiddenSelectedItem = () => <HideDemo></HideDemo>;
|
|
1961
|
-
|
|
1962
|
-
AutoHiddenSelectedItem.story = {
|
|
1963
|
-
name: 'auto hidden selected item',
|
|
1964
|
-
};
|
|
1965
|
-
|
|
1966
|
-
class CustomCreate extends React.Component {
|
|
1967
|
-
constructor(props) {
|
|
1968
|
-
super(props);
|
|
1969
|
-
this.state = {
|
|
1970
|
-
optionList: [
|
|
1971
|
-
{
|
|
1972
|
-
value: 'abc',
|
|
1973
|
-
label: '抖音',
|
|
1974
|
-
},
|
|
1975
|
-
{
|
|
1976
|
-
value: 'hotsoon',
|
|
1977
|
-
label: '火山小视频',
|
|
1978
|
-
},
|
|
1979
|
-
{
|
|
1980
|
-
value: 'pipixia',
|
|
1981
|
-
label: '皮皮虾',
|
|
1982
|
-
},
|
|
1983
|
-
{
|
|
1984
|
-
value: 'toutiao',
|
|
1985
|
-
label: '今日头条',
|
|
1986
|
-
},
|
|
1987
|
-
{
|
|
1988
|
-
value: 0,
|
|
1989
|
-
label: 0,
|
|
1990
|
-
},
|
|
1991
|
-
],
|
|
1992
|
-
selectedItems: ['fefe'],
|
|
1993
|
-
};
|
|
1994
|
-
this.onChange = this.onChange.bind(this);
|
|
1995
|
-
this.customRender = this.customRender.bind(this);
|
|
1996
|
-
this.search = this.search.bind(this);
|
|
1997
|
-
}
|
|
1998
|
-
|
|
1999
|
-
onChange(selectedItems) {
|
|
2000
|
-
console.log(selectedItems); // this.setState({ selectedItems, optionList: [] });
|
|
2001
|
-
|
|
2002
|
-
this.setState({
|
|
2003
|
-
selectedItems,
|
|
2004
|
-
}); // this.setState({ optionList: [] });
|
|
2005
|
-
}
|
|
2006
|
-
|
|
2007
|
-
customRender(v) {
|
|
2008
|
-
return (
|
|
2009
|
-
<>
|
|
2010
|
-
<span>label:{v.label}</span>
|
|
2011
|
-
<span>value:{v.value}</span>
|
|
2012
|
-
</>
|
|
2013
|
-
);
|
|
2014
|
-
}
|
|
2015
|
-
|
|
2016
|
-
customCreate(inputValue, isFocus) {
|
|
2017
|
-
let style = {
|
|
2018
|
-
padding: 12,
|
|
2019
|
-
cursor: 'pointer',
|
|
2020
|
-
backgroundColor: isFocus ? 'var(--semi-color-fill-0)' : '#FFF',
|
|
2021
|
-
};
|
|
2022
|
-
return <div style={style}>{'create' + inputValue}</div>;
|
|
2023
|
-
}
|
|
2024
|
-
|
|
2025
|
-
search(inputValue) {
|
|
2026
|
-
let length = Math.ceil(Math.random() * 10);
|
|
2027
|
-
let result = Array.from(
|
|
2028
|
-
{
|
|
2029
|
-
length,
|
|
2030
|
-
},
|
|
2031
|
-
(v, i) => {
|
|
2032
|
-
return {
|
|
2033
|
-
value: inputValue + i,
|
|
2034
|
-
label: inputValue + i,
|
|
2035
|
-
type: i + 1,
|
|
2036
|
-
};
|
|
2037
|
-
}
|
|
2038
|
-
);
|
|
2039
|
-
console.log(result); // result = result.concat(selectedOption);
|
|
2040
|
-
|
|
2041
|
-
this.setState({
|
|
2042
|
-
optionList: result,
|
|
2043
|
-
});
|
|
2044
|
-
}
|
|
2045
|
-
|
|
2046
|
-
render() {
|
|
2047
|
-
let { optionList, selectedItems } = this.state;
|
|
2048
|
-
return (
|
|
2049
|
-
<>
|
|
2050
|
-
<Select
|
|
2051
|
-
defaultValue={['abc']}
|
|
2052
|
-
filter
|
|
2053
|
-
style={{
|
|
2054
|
-
width: 300,
|
|
2055
|
-
}}
|
|
2056
|
-
multiple
|
|
2057
|
-
optionList={optionList}
|
|
2058
|
-
onSearch={this.search}
|
|
2059
|
-
onChange={this.onChange}
|
|
2060
|
-
emptyContent={null} // onChangeWithObject
|
|
2061
|
-
></Select>
|
|
2062
|
-
</>
|
|
2063
|
-
);
|
|
2064
|
-
}
|
|
2065
|
-
}
|
|
2066
|
-
|
|
2067
|
-
export const _CustomCreate = () => <CustomCreate></CustomCreate>;
|
|
2068
|
-
|
|
2069
|
-
_CustomCreate.story = {
|
|
2070
|
-
name: 'CustomCreate',
|
|
2071
|
-
};
|
|
2072
|
-
|
|
2073
|
-
class OptionGroupDemo extends React.Component {
|
|
2074
|
-
constructor(props) {
|
|
2075
|
-
super(props);
|
|
2076
|
-
this.handleSearch = this.handleSearch.bind(this);
|
|
2077
|
-
this.state = {
|
|
2078
|
-
groups: [
|
|
2079
|
-
{
|
|
2080
|
-
label: 'Asia',
|
|
2081
|
-
children: [
|
|
2082
|
-
{
|
|
2083
|
-
label: 'China',
|
|
2084
|
-
value: 'zhongguo',
|
|
2085
|
-
},
|
|
2086
|
-
{
|
|
2087
|
-
label: 'Koera',
|
|
2088
|
-
value: 'hanguo',
|
|
2089
|
-
},
|
|
2090
|
-
],
|
|
2091
|
-
},
|
|
2092
|
-
{
|
|
2093
|
-
label: 'Europe',
|
|
2094
|
-
children: [
|
|
2095
|
-
{
|
|
2096
|
-
label: 'Germany',
|
|
2097
|
-
value: 'deguo',
|
|
2098
|
-
},
|
|
2099
|
-
{
|
|
2100
|
-
label: 'France',
|
|
2101
|
-
value: 'faguo',
|
|
2102
|
-
},
|
|
2103
|
-
],
|
|
2104
|
-
},
|
|
2105
|
-
{
|
|
2106
|
-
label: 'Other',
|
|
2107
|
-
children: [
|
|
2108
|
-
{
|
|
2109
|
-
label: 'vf',
|
|
2110
|
-
value: 'Sourth',
|
|
2111
|
-
},
|
|
2112
|
-
],
|
|
2113
|
-
},
|
|
2114
|
-
],
|
|
2115
|
-
};
|
|
2116
|
-
}
|
|
2117
|
-
|
|
2118
|
-
handleSearch(input) {
|
|
2119
|
-
let groups = [1, 2, 3].map(i => {
|
|
2120
|
-
return {
|
|
2121
|
-
label: i,
|
|
2122
|
-
// label: Math.random(),
|
|
2123
|
-
children: [10, 20].map(j => {
|
|
2124
|
-
return {
|
|
2125
|
-
label: Math.random(),
|
|
2126
|
-
value: Math.random(),
|
|
2127
|
-
};
|
|
2128
|
-
}),
|
|
2129
|
-
};
|
|
2130
|
-
});
|
|
2131
|
-
this.setState({
|
|
2132
|
-
groups,
|
|
2133
|
-
});
|
|
2134
|
-
}
|
|
2135
|
-
|
|
2136
|
-
renderGroup(group, index) {
|
|
2137
|
-
const options = group.children.map(option => (
|
|
2138
|
-
<Select.Option value={option.value} label={option.label} key={option.label} />
|
|
2139
|
-
));
|
|
2140
|
-
return <Select.OptGroup key={`${index}-${group.label}`} label={group.label}>{options}</Select.OptGroup>;
|
|
2141
|
-
}
|
|
2142
|
-
|
|
2143
|
-
render() {
|
|
2144
|
-
const { groups } = this.state;
|
|
2145
|
-
return (
|
|
2146
|
-
<>
|
|
2147
|
-
<Select
|
|
2148
|
-
placeholder=""
|
|
2149
|
-
style={{
|
|
2150
|
-
width: 180,
|
|
2151
|
-
}}
|
|
2152
|
-
filter
|
|
2153
|
-
onSearch={this.handleSearch}
|
|
2154
|
-
remote
|
|
2155
|
-
>
|
|
2156
|
-
{groups.map((group, index) => this.renderGroup(group, index))}
|
|
2157
|
-
</Select>
|
|
2158
|
-
</>
|
|
2159
|
-
);
|
|
2160
|
-
}
|
|
2161
|
-
}
|
|
2162
|
-
|
|
2163
|
-
export const SelectOptionGroup = () => <OptionGroupDemo />;
|
|
2164
|
-
|
|
2165
|
-
SelectOptionGroup.story = {
|
|
2166
|
-
name: 'Select OptionGroup',
|
|
2167
|
-
};
|
|
2168
|
-
|
|
2169
|
-
const BlurDemo = () => {
|
|
2170
|
-
const onBlur = (value, e) => {
|
|
2171
|
-
console.log(value);
|
|
2172
|
-
console.log(e);
|
|
2173
|
-
};
|
|
2174
|
-
|
|
2175
|
-
const onFocus = (value, e) => {
|
|
2176
|
-
console.log(value);
|
|
2177
|
-
console.log(e);
|
|
2178
|
-
};
|
|
2179
|
-
|
|
2180
|
-
return (
|
|
2181
|
-
<>
|
|
2182
|
-
<Select
|
|
2183
|
-
filter
|
|
2184
|
-
placeholder=""
|
|
2185
|
-
style={{
|
|
2186
|
-
width: 180,
|
|
2187
|
-
}}
|
|
2188
|
-
onBlur={onBlur}
|
|
2189
|
-
onFocus={onFocus}
|
|
2190
|
-
>
|
|
2191
|
-
<Select.Option value="zhongguo">China</Select.Option>
|
|
2192
|
-
<Select.Option value="hanguo">Koera</Select.Option>
|
|
2193
|
-
<Select.Option value="deguo">Germany</Select.Option>
|
|
2194
|
-
<Select.Option value="faguo">France</Select.Option>
|
|
2195
|
-
</Select>
|
|
2196
|
-
</>
|
|
2197
|
-
);
|
|
2198
|
-
};
|
|
2199
|
-
|
|
2200
|
-
export const SelectOnBlurOnFocus = () => <BlurDemo></BlurDemo>;
|
|
2201
|
-
|
|
2202
|
-
SelectOnBlurOnFocus.story = {
|
|
2203
|
-
name: 'Select onBlur/onFocus',
|
|
2204
|
-
};
|
|
2205
|
-
|
|
2206
|
-
const AutoAdjustOverflowDemo = () => {
|
|
2207
|
-
const [list, setList] = useState([
|
|
2208
|
-
{
|
|
2209
|
-
value: 'abc',
|
|
2210
|
-
label: '1111',
|
|
2211
|
-
},
|
|
2212
|
-
{
|
|
2213
|
-
value: 'hotsoon',
|
|
2214
|
-
label: '1112',
|
|
2215
|
-
},
|
|
2216
|
-
{
|
|
2217
|
-
value: 'pipixia',
|
|
2218
|
-
label: '1113',
|
|
2219
|
-
},
|
|
2220
|
-
{
|
|
2221
|
-
value: 'toutiao',
|
|
2222
|
-
label: '1114',
|
|
2223
|
-
},
|
|
2224
|
-
]);
|
|
2225
|
-
|
|
2226
|
-
const onSearch = () => {
|
|
2227
|
-
let newList = Array.from(
|
|
2228
|
-
{
|
|
2229
|
-
length: Math.floor(Math.random() * 10),
|
|
2230
|
-
},
|
|
2231
|
-
(v, i) => {
|
|
2232
|
-
return {
|
|
2233
|
-
value: i,
|
|
2234
|
-
label: i,
|
|
2235
|
-
};
|
|
2236
|
-
}
|
|
2237
|
-
);
|
|
2238
|
-
setList(newList);
|
|
2239
|
-
console.log(newList);
|
|
2240
|
-
};
|
|
2241
|
-
|
|
2242
|
-
return (
|
|
2243
|
-
<div
|
|
2244
|
-
style={{
|
|
2245
|
-
height: 180,
|
|
2246
|
-
margin: 250,
|
|
2247
|
-
border: '1px solid pink',
|
|
2248
|
-
}}
|
|
2249
|
-
>
|
|
2250
|
-
<Select
|
|
2251
|
-
optionList={list}
|
|
2252
|
-
filter={true}
|
|
2253
|
-
remote={true}
|
|
2254
|
-
onSearch={onSearch}
|
|
2255
|
-
style={{
|
|
2256
|
-
width: 200,
|
|
2257
|
-
}}
|
|
2258
|
-
multiple
|
|
2259
|
-
/>
|
|
2260
|
-
</div>
|
|
2261
|
-
);
|
|
2262
|
-
};
|
|
2263
|
-
|
|
2264
|
-
export const AutoAdjustOverflow = () => <AutoAdjustOverflowDemo></AutoAdjustOverflowDemo>;
|
|
2265
|
-
|
|
2266
|
-
AutoAdjustOverflow.story = {
|
|
2267
|
-
name: 'autoAdjustOverflow',
|
|
2268
|
-
};
|
|
2269
|
-
|
|
2270
|
-
const AllowCreateWithFilter = () => {
|
|
2271
|
-
const [list, setList] = useState([
|
|
2272
|
-
{
|
|
2273
|
-
value: 'abc',
|
|
2274
|
-
label: 'abc',
|
|
2275
|
-
otherKey: 'abc',
|
|
2276
|
-
},
|
|
2277
|
-
{
|
|
2278
|
-
value: 'hotsoon',
|
|
2279
|
-
label: 'hotsoon',
|
|
2280
|
-
otherKey: 'efg',
|
|
2281
|
-
},
|
|
2282
|
-
{
|
|
2283
|
-
value: 'pipixia',
|
|
2284
|
-
label: 'pipixia',
|
|
2285
|
-
otherKey: 'hij',
|
|
2286
|
-
},
|
|
2287
|
-
{
|
|
2288
|
-
value: 'toutiao',
|
|
2289
|
-
label: 'toutiao',
|
|
2290
|
-
otherKey: 'klm',
|
|
2291
|
-
},
|
|
2292
|
-
]);
|
|
2293
|
-
|
|
2294
|
-
const filter = (sugInput, option) => {
|
|
2295
|
-
let compareKey = option.otherKey ? option.otherKey.toUpperCase() : '';
|
|
2296
|
-
let sug = sugInput.toUpperCase();
|
|
2297
|
-
return compareKey.includes(sug);
|
|
2298
|
-
};
|
|
2299
|
-
|
|
2300
|
-
return (
|
|
2301
|
-
<div
|
|
2302
|
-
style={{
|
|
2303
|
-
height: 180,
|
|
2304
|
-
margin: 250,
|
|
2305
|
-
}}
|
|
2306
|
-
>
|
|
2307
|
-
<Select
|
|
2308
|
-
optionList={list}
|
|
2309
|
-
multiple
|
|
2310
|
-
filter={filter}
|
|
2311
|
-
style={{
|
|
2312
|
-
width: 200,
|
|
2313
|
-
}}
|
|
2314
|
-
allowCreate
|
|
2315
|
-
/>
|
|
2316
|
-
</div>
|
|
2317
|
-
);
|
|
2318
|
-
};
|
|
2319
|
-
|
|
2320
|
-
export const FilterAllowCreate = () => <AllowCreateWithFilter></AllowCreateWithFilter>;
|
|
2321
|
-
|
|
2322
|
-
FilterAllowCreate.story = {
|
|
2323
|
-
name: 'Filter + allowCreate',
|
|
2324
|
-
};
|
|
2325
|
-
|
|
2326
|
-
const SelectRefDemo = () => {
|
|
2327
|
-
const ref = useRef();
|
|
2328
|
-
const secondRef = useRef();
|
|
2329
|
-
const [open, setOpen] = useState(false);
|
|
2330
|
-
const list = [
|
|
2331
|
-
{
|
|
2332
|
-
value: 'abc',
|
|
2333
|
-
label: 'Abc',
|
|
2334
|
-
},
|
|
2335
|
-
{
|
|
2336
|
-
value: 'hotsoon',
|
|
2337
|
-
label: 'Hotsoon',
|
|
2338
|
-
},
|
|
2339
|
-
{
|
|
2340
|
-
value: 'pipixia',
|
|
2341
|
-
label: 'Pipixia',
|
|
2342
|
-
},
|
|
2343
|
-
{
|
|
2344
|
-
value: 'toutiao',
|
|
2345
|
-
label: 'TooBuzz',
|
|
2346
|
-
},
|
|
2347
|
-
];
|
|
2348
|
-
|
|
2349
|
-
const change = () => {
|
|
2350
|
-
if (!open) {
|
|
2351
|
-
ref.current.open();
|
|
2352
|
-
setOpen(true);
|
|
2353
|
-
} else {
|
|
2354
|
-
ref.current.close();
|
|
2355
|
-
setOpen(false);
|
|
2356
|
-
}
|
|
2357
|
-
};
|
|
2358
|
-
|
|
2359
|
-
const focus = () => {
|
|
2360
|
-
ref.current.focus();
|
|
2361
|
-
};
|
|
2362
|
-
|
|
2363
|
-
const clearInput = () => {
|
|
2364
|
-
ref.current.clearInput();
|
|
2365
|
-
};
|
|
2366
|
-
|
|
2367
|
-
const deselectAll = () => {
|
|
2368
|
-
ref.current.deselectAll();
|
|
2369
|
-
};
|
|
2370
|
-
|
|
2371
|
-
const selectAll = () => {
|
|
2372
|
-
ref.current.selectAll();
|
|
2373
|
-
};
|
|
2374
|
-
|
|
2375
|
-
return (
|
|
2376
|
-
<>
|
|
2377
|
-
<h4>onChangeWithObject = false</h4>
|
|
2378
|
-
<Select
|
|
2379
|
-
innerBottomSlot={
|
|
2380
|
-
<div>
|
|
2381
|
-
<Space>
|
|
2382
|
-
<Button onClick={change}>close</Button>
|
|
2383
|
-
<Button onClick={clearInput}>clearInput</Button>
|
|
2384
|
-
<Button onClick={deselectAll}>deselectAll</Button>
|
|
2385
|
-
<Button onClick={selectAll}>selectAll</Button>
|
|
2386
|
-
</Space>
|
|
2387
|
-
</div>
|
|
2388
|
-
}
|
|
2389
|
-
ref={ref}
|
|
2390
|
-
onChange={e => console.log(e)}
|
|
2391
|
-
placeholder="Business line"
|
|
2392
|
-
style={{
|
|
2393
|
-
width: 180,
|
|
2394
|
-
}}
|
|
2395
|
-
optionList={list}
|
|
2396
|
-
filter
|
|
2397
|
-
multiple
|
|
2398
|
-
></Select>
|
|
2399
|
-
<Space>
|
|
2400
|
-
<Button onClick={change}>open</Button>
|
|
2401
|
-
<Button onClick={focus}>focus</Button>
|
|
2402
|
-
<Button onClick={clearInput}>clearInput</Button>
|
|
2403
|
-
<Button onClick={deselectAll}>deselectAll</Button>
|
|
2404
|
-
<Button onClick={selectAll}>selectAll</Button>
|
|
2405
|
-
</Space>
|
|
2406
|
-
<h4
|
|
2407
|
-
style={{
|
|
2408
|
-
marginTop: 20,
|
|
2409
|
-
}}
|
|
2410
|
-
>
|
|
2411
|
-
onChangeWithObject = true
|
|
2412
|
-
</h4>
|
|
2413
|
-
<Select
|
|
2414
|
-
innerBottomSlot={
|
|
2415
|
-
<div>
|
|
2416
|
-
<Space></Space>
|
|
2417
|
-
</div>
|
|
2418
|
-
}
|
|
2419
|
-
onChange={e => console.log(e)}
|
|
2420
|
-
onChangeWithObject
|
|
2421
|
-
ref={secondRef}
|
|
2422
|
-
placeholder="Business line"
|
|
2423
|
-
style={{
|
|
2424
|
-
width: 180,
|
|
2425
|
-
}}
|
|
2426
|
-
optionList={list}
|
|
2427
|
-
filter
|
|
2428
|
-
multiple
|
|
2429
|
-
></Select>
|
|
2430
|
-
<Space>
|
|
2431
|
-
<Button onClick={() => secondRef.current.deselectAll()}>deselectAll</Button>
|
|
2432
|
-
<Button onClick={() => secondRef.current.selectAll()}>selectAll</Button>
|
|
2433
|
-
</Space>
|
|
2434
|
-
</>
|
|
2435
|
-
);
|
|
2436
|
-
};
|
|
2437
|
-
|
|
2438
|
-
export const Ref = () => <SelectRefDemo />;
|
|
2439
|
-
|
|
2440
|
-
Ref.story = {
|
|
2441
|
-
name: 'ref',
|
|
2442
|
-
};
|
|
2443
|
-
|
|
2444
|
-
export const CustomTriggerDemo = () => <CustomTrigger />;
|
|
2445
|
-
CustomTriggerDemo.story = {
|
|
2446
|
-
name: 'custom trigger'
|
|
2447
|
-
}
|
|
2448
|
-
|
|
2449
|
-
class VirtualizeClassDemo extends React.Component {
|
|
2450
|
-
constructor(props) {
|
|
2451
|
-
super(props);
|
|
2452
|
-
// this.handleSearch = this.handleSearch.bind(this);
|
|
2453
|
-
let newOptions = Array.from({ length: 1000 }, (v, i) => ({ label: `o-${i}`, value: `v-${v}-${i}` }));
|
|
2454
|
-
this.state = {
|
|
2455
|
-
optionList: newOptions,
|
|
2456
|
-
};
|
|
2457
|
-
}
|
|
2458
|
-
render() {
|
|
2459
|
-
let { groups, optionList } = this.state;
|
|
2460
|
-
let virtualize = {
|
|
2461
|
-
height: 300,
|
|
2462
|
-
widht: '100%',
|
|
2463
|
-
itemSize: 36,
|
|
2464
|
-
};
|
|
2465
|
-
return (
|
|
2466
|
-
<>
|
|
2467
|
-
<Select
|
|
2468
|
-
placeholder=""
|
|
2469
|
-
style={{ width: 180 }}
|
|
2470
|
-
filter
|
|
2471
|
-
onSearch={this.handleSearch}
|
|
2472
|
-
virtualize={virtualize}
|
|
2473
|
-
optionList={optionList}
|
|
2474
|
-
></Select>
|
|
2475
|
-
</>
|
|
2476
|
-
);
|
|
2477
|
-
}
|
|
2478
|
-
}
|
|
2479
|
-
|
|
2480
|
-
export const VirtualizeDemo = () => <VirtualizeClassDemo />;
|
|
2481
|
-
|
|
2482
|
-
VirtualizeDemo.story = {
|
|
2483
|
-
name: 'virtualize select'
|
|
2484
|
-
}
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
const SelectPosition = () => {
|
|
2488
|
-
return (
|
|
2489
|
-
<div
|
|
2490
|
-
style={{
|
|
2491
|
-
height: 500,
|
|
2492
|
-
border: '1px solid red',
|
|
2493
|
-
overflow: 'auto',
|
|
2494
|
-
}}
|
|
2495
|
-
>
|
|
2496
|
-
<p>p</p>
|
|
2497
|
-
<p>p</p>
|
|
2498
|
-
<p>p</p>
|
|
2499
|
-
<p>p</p>
|
|
2500
|
-
<p>p</p>
|
|
2501
|
-
<p>p</p>
|
|
2502
|
-
<p>p</p>
|
|
2503
|
-
<p>p</p>
|
|
2504
|
-
<p>p</p>
|
|
2505
|
-
<p>p</p>
|
|
2506
|
-
<p>p</p>
|
|
2507
|
-
<p>p</p>
|
|
2508
|
-
<p>p</p>
|
|
2509
|
-
<p>p</p>
|
|
2510
|
-
<p>p</p>
|
|
2511
|
-
<p>p</p>
|
|
2512
|
-
<p>p</p>
|
|
2513
|
-
<p>p</p>
|
|
2514
|
-
<p>p</p>
|
|
2515
|
-
<p>p</p>
|
|
2516
|
-
<p>p</p>
|
|
2517
|
-
<p>p</p>
|
|
2518
|
-
<p>p</p>
|
|
2519
|
-
<Select
|
|
2520
|
-
defaultValue="abc"
|
|
2521
|
-
style={{
|
|
2522
|
-
width: 120,
|
|
2523
|
-
}}
|
|
2524
|
-
>
|
|
2525
|
-
<Option value="abc">抖音</Option>
|
|
2526
|
-
<Option value="hotsoon">火山</Option>
|
|
2527
|
-
<Option value="pipixia" disabled>
|
|
2528
|
-
皮皮虾
|
|
2529
|
-
</Option>
|
|
2530
|
-
<Option value="xigua">西瓜视频</Option>
|
|
2531
|
-
</Select>
|
|
2532
|
-
<p>p</p>
|
|
2533
|
-
<p>p</p>
|
|
2534
|
-
<p>p</p>
|
|
2535
|
-
<p>p</p>
|
|
2536
|
-
<p>p</p>
|
|
2537
|
-
<p>p</p>
|
|
2538
|
-
<p>p</p>
|
|
2539
|
-
<p>p</p>
|
|
2540
|
-
<p>p</p>
|
|
2541
|
-
<p>p</p>
|
|
2542
|
-
<p>p</p>
|
|
2543
|
-
<p>p</p>
|
|
2544
|
-
<p>p</p>
|
|
2545
|
-
<p>p</p>
|
|
2546
|
-
<p>p</p>
|
|
2547
|
-
<p>p</p>
|
|
2548
|
-
<p>p</p>
|
|
2549
|
-
<p>p</p>
|
|
2550
|
-
<p>p</p>
|
|
2551
|
-
<p>p</p>
|
|
2552
|
-
<p>p</p>
|
|
2553
|
-
<p>p</p>
|
|
2554
|
-
<p>p</p>
|
|
2555
|
-
<p>p</p>
|
|
2556
|
-
<p>p</p>
|
|
2557
|
-
<p>p</p>
|
|
2558
|
-
<p>p</p>
|
|
2559
|
-
<p>p</p>
|
|
2560
|
-
<p>p</p>
|
|
2561
|
-
<p>p</p>
|
|
2562
|
-
<p>p</p>
|
|
2563
|
-
<p>p</p>
|
|
2564
|
-
<p>p</p>
|
|
2565
|
-
<p>p</p>
|
|
2566
|
-
<p>p</p>
|
|
2567
|
-
<p>p</p>
|
|
2568
|
-
<p>p</p>
|
|
2569
|
-
<p>p</p>
|
|
2570
|
-
<p>p</p>
|
|
2571
|
-
<p>p</p>
|
|
2572
|
-
<p>p</p>
|
|
2573
|
-
<p>p</p>
|
|
2574
|
-
</div>
|
|
2575
|
-
);
|
|
2576
|
-
};
|
|
2577
|
-
|
|
2578
|
-
export { SelectPosition };
|
|
2579
|
-
SelectPosition.story = {
|
|
2580
|
-
name: 'Select position problem'
|
|
2581
|
-
}
|
|
2582
|
-
|
|
2583
|
-
const RenderOptionDemo = () => {
|
|
2584
|
-
const renderOptionItem = renderProps => {
|
|
2585
|
-
const {
|
|
2586
|
-
disabled,
|
|
2587
|
-
selected,
|
|
2588
|
-
label,
|
|
2589
|
-
value,
|
|
2590
|
-
focused,
|
|
2591
|
-
className,
|
|
2592
|
-
style,
|
|
2593
|
-
onMouseEnter,
|
|
2594
|
-
onClick,
|
|
2595
|
-
empty,
|
|
2596
|
-
emptyContent,
|
|
2597
|
-
...rest
|
|
2598
|
-
} = renderProps;
|
|
2599
|
-
const optionCls = classNames({
|
|
2600
|
-
['custom-option-render']: true,
|
|
2601
|
-
['custom-option-render-focused']: focused,
|
|
2602
|
-
['custom-option-render-disabled']: disabled,
|
|
2603
|
-
['custom-option-render-selected']: selected,
|
|
2604
|
-
}); // Notice:
|
|
2605
|
-
// 1.props传入的style需在wrapper dom上进行消费,否则在虚拟化场景下会无法正常使用
|
|
2606
|
-
// 2.选中(selected)、聚焦(focused)、禁用(disabled)等状态的样式需自行加上,你可以从props中获取到相对的boolean值
|
|
2607
|
-
// 3.onMouseEnter需在wrapper dom上绑定,否则上下键盘操作时显示会有问题
|
|
2608
|
-
|
|
2609
|
-
return (
|
|
2610
|
-
<div
|
|
2611
|
-
style={style}
|
|
2612
|
-
className={optionCls}
|
|
2613
|
-
onClick={() => onClick()}
|
|
2614
|
-
onMouseEnter={e => onMouseEnter()}
|
|
2615
|
-
>
|
|
2616
|
-
<Checkbox checked={selected} />
|
|
2617
|
-
<div className="option-right">{label}</div>
|
|
2618
|
-
</div>
|
|
2619
|
-
);
|
|
2620
|
-
};
|
|
2621
|
-
|
|
2622
|
-
return (
|
|
2623
|
-
<>
|
|
2624
|
-
<Select
|
|
2625
|
-
filter
|
|
2626
|
-
dropdownClassName="components-select-demo-renderOptionItem"
|
|
2627
|
-
optionList={optionList}
|
|
2628
|
-
style={{
|
|
2629
|
-
width: 300,
|
|
2630
|
-
}}
|
|
2631
|
-
renderOptionItem={renderOptionItem}
|
|
2632
|
-
/>
|
|
2633
|
-
<br />
|
|
2634
|
-
<br />
|
|
2635
|
-
<Select
|
|
2636
|
-
filter
|
|
2637
|
-
multiple
|
|
2638
|
-
dropdownClassName="components-select-demo-renderOptionItem"
|
|
2639
|
-
optionList={optionList}
|
|
2640
|
-
style={{
|
|
2641
|
-
width: 450,
|
|
2642
|
-
}}
|
|
2643
|
-
renderOptionItem={renderOptionItem}
|
|
2644
|
-
/>
|
|
2645
|
-
</>
|
|
2646
|
-
);
|
|
2647
|
-
};
|
|
2648
|
-
|
|
2649
|
-
export const RenderOptionItem = () => <RenderOptionDemo />;
|
|
2650
|
-
|
|
2651
|
-
RenderOptionItem.story = {
|
|
2652
|
-
name: 'renderOptionItem',
|
|
2653
|
-
};
|
|
2654
|
-
|
|
2655
|
-
const FilterDefaultOpen = () => {
|
|
2656
|
-
const [value1, setValue1] = useState('a-1');
|
|
2657
|
-
return (
|
|
2658
|
-
<>
|
|
2659
|
-
<Select
|
|
2660
|
-
placeholder=""
|
|
2661
|
-
style={{
|
|
2662
|
-
width: 180,
|
|
2663
|
-
}}
|
|
2664
|
-
filter
|
|
2665
|
-
defaultOpen
|
|
2666
|
-
>
|
|
2667
|
-
<Select.OptGroup label="Asia">
|
|
2668
|
-
<Select.Option value="a-1">China</Select.Option>
|
|
2669
|
-
<Select.Option value="a-2">Koera</Select.Option>
|
|
2670
|
-
</Select.OptGroup>
|
|
2671
|
-
<Select.OptGroup label="Europe">
|
|
2672
|
-
<Select.Option value="b-1">Germany</Select.Option>
|
|
2673
|
-
<Select.Option value="b-2">France</Select.Option>
|
|
2674
|
-
</Select.OptGroup>
|
|
2675
|
-
<Select.OptGroup label="South America">
|
|
2676
|
-
<Select.Option value="c-1">Peru</Select.Option>
|
|
2677
|
-
</Select.OptGroup>
|
|
2678
|
-
</Select>
|
|
2679
|
-
<Select
|
|
2680
|
-
placeholder=""
|
|
2681
|
-
style={{
|
|
2682
|
-
width: 180,
|
|
2683
|
-
marginLeft: 20,
|
|
2684
|
-
}}
|
|
2685
|
-
filter
|
|
2686
|
-
defaultOpen
|
|
2687
|
-
defaultValue="a-2"
|
|
2688
|
-
>
|
|
2689
|
-
<Select.OptGroup label="Asia">
|
|
2690
|
-
<Select.Option value="a-1">China</Select.Option>
|
|
2691
|
-
<Select.Option value="a-2">Koera</Select.Option>
|
|
2692
|
-
</Select.OptGroup>
|
|
2693
|
-
<Select.OptGroup label="Europe">
|
|
2694
|
-
<Select.Option value="b-1">Germany</Select.Option>
|
|
2695
|
-
<Select.Option value="b-2">France</Select.Option>
|
|
2696
|
-
</Select.OptGroup>
|
|
2697
|
-
<Select.OptGroup label="South America">
|
|
2698
|
-
<Select.Option value="c-1">Peru</Select.Option>
|
|
2699
|
-
</Select.OptGroup>
|
|
2700
|
-
</Select>
|
|
2701
|
-
<Select
|
|
2702
|
-
placeholder=""
|
|
2703
|
-
style={{
|
|
2704
|
-
width: 180,
|
|
2705
|
-
marginLeft: 20,
|
|
2706
|
-
}}
|
|
2707
|
-
filter
|
|
2708
|
-
defaultOpen
|
|
2709
|
-
value={value1}
|
|
2710
|
-
onChange={val => setValue1(val)}
|
|
2711
|
-
>
|
|
2712
|
-
<Select.Option value="a-1">China</Select.Option>
|
|
2713
|
-
<Select.Option value="a-2">Koera</Select.Option>
|
|
2714
|
-
<Select.Option value="b-1">Germany</Select.Option>
|
|
2715
|
-
<Select.Option value="b-2">France</Select.Option>
|
|
2716
|
-
<Select.Option value="c-1">Peru</Select.Option>
|
|
2717
|
-
</Select>
|
|
2718
|
-
</>
|
|
2719
|
-
);
|
|
2720
|
-
};
|
|
2721
|
-
|
|
2722
|
-
export { FilterDefaultOpen };
|
|
2723
|
-
FilterDefaultOpen.story = {
|
|
2724
|
-
name: 'Filter + defaultOpen'
|
|
2725
|
-
};
|
|
2726
|
-
|
|
2727
|
-
const CustomSelect = props => {
|
|
2728
|
-
const { fieldRef, ...rest } = props;
|
|
2729
|
-
return <Select {...rest} ref={fieldRef} />;
|
|
2730
|
-
};
|
|
2731
|
-
|
|
2732
|
-
const CustomFieldSelect = withField(CustomSelect);
|
|
2733
|
-
|
|
2734
|
-
const RefDemo = () => {
|
|
2735
|
-
const fieldRef = useRef(null);
|
|
2736
|
-
|
|
2737
|
-
const onChange = () => {
|
|
2738
|
-
console.log(fieldRef);
|
|
2739
|
-
fieldRef.current.open();
|
|
2740
|
-
debugger;
|
|
2741
|
-
};
|
|
2742
|
-
|
|
2743
|
-
return (
|
|
2744
|
-
<Form>
|
|
2745
|
-
<CustomFieldSelect field="test" initValue="se" fieldRef={fieldRef}></CustomFieldSelect>
|
|
2746
|
-
<Button onClick={onChange}>change</Button>
|
|
2747
|
-
</Form>
|
|
2748
|
-
);
|
|
2749
|
-
};
|
|
2750
|
-
|
|
2751
|
-
export const RefFieldDemo = () => <RefDemo />;
|
|
2752
|
-
|
|
2753
|
-
RefFieldDemo.story = {
|
|
2754
|
-
name: 'Ref field demo',
|
|
2755
|
-
};
|
|
2756
|
-
|
|
2757
|
-
const ValueZeroDemo = () => {
|
|
2758
|
-
const list = [
|
|
2759
|
-
{
|
|
2760
|
-
value: 6,
|
|
2761
|
-
label: '抖音小视频',
|
|
2762
|
-
otherKey: 0,
|
|
2763
|
-
},
|
|
2764
|
-
{
|
|
2765
|
-
value: 1,
|
|
2766
|
-
label: '火山小视频',
|
|
2767
|
-
disabled: true,
|
|
2768
|
-
otherKey: 1,
|
|
2769
|
-
},
|
|
2770
|
-
{
|
|
2771
|
-
value: 'pipixia',
|
|
2772
|
-
label: '皮皮虾',
|
|
2773
|
-
otherKey: 2,
|
|
2774
|
-
},
|
|
2775
|
-
{
|
|
2776
|
-
value: 'toutiao',
|
|
2777
|
-
label: '今日头条',
|
|
2778
|
-
otherKey: 3,
|
|
2779
|
-
},
|
|
2780
|
-
];
|
|
2781
|
-
return (
|
|
2782
|
-
<Select
|
|
2783
|
-
placeholder="请选择业务线"
|
|
2784
|
-
style={{
|
|
2785
|
-
width: 180,
|
|
2786
|
-
}}
|
|
2787
|
-
optionList={list}
|
|
2788
|
-
value={0}
|
|
2789
|
-
renderSelectedItem={option => option.label + 1}
|
|
2790
|
-
></Select>
|
|
2791
|
-
);
|
|
2792
|
-
};
|
|
2793
|
-
|
|
2794
|
-
export const Value0 = () => <ValueZeroDemo />;
|
|
2795
|
-
|
|
2796
|
-
Value0.story = {
|
|
2797
|
-
name: 'value=0',
|
|
2798
|
-
};
|
|
2799
|
-
|
|
2800
|
-
const Highlight = () => {
|
|
2801
|
-
const searchWords = ['do', 'dollar'];
|
|
2802
|
-
const sourceString = 'aaa do dollar aaa';
|
|
2803
|
-
const result = getHighLightTextHTML({
|
|
2804
|
-
searchWords,
|
|
2805
|
-
sourceString,
|
|
2806
|
-
});
|
|
2807
|
-
const result2 = getHighLightTextHTML({
|
|
2808
|
-
searchWords: ['z'],
|
|
2809
|
-
sourceString: 'aaazaaazaaa',
|
|
2810
|
-
});
|
|
2811
|
-
return result2;
|
|
2812
|
-
};
|
|
2813
|
-
|
|
2814
|
-
export const _Highlight = () => <Highlight />;
|
|
2815
|
-
|
|
2816
|
-
_Highlight.story = {
|
|
2817
|
-
name: 'highlight',
|
|
2818
|
-
};
|
|
2819
|
-
|
|
2820
|
-
export const ScrollIntoView = () => (
|
|
2821
|
-
<div>
|
|
2822
|
-
<p>single selection</p>
|
|
2823
|
-
<Select defaultValue='v-11' defaultOpen style={{ width: 120, marginBottom: 300 }}>
|
|
2824
|
-
{new Array(50).fill(null).map((item, idx) => (
|
|
2825
|
-
<Option value={`v-${idx}`} key={idx}>{`option-${idx}`}</Option>
|
|
2826
|
-
))}
|
|
2827
|
-
</Select>
|
|
2828
|
-
<p>single selection with no selected item</p>
|
|
2829
|
-
<Select style={{ marginBottom: 300, width: 120 }}>
|
|
2830
|
-
{new Array(50).fill(null).map((item, idx) => (
|
|
2831
|
-
<Option value={`v-${idx}`} key={idx}>{`option-${idx}`}</Option>
|
|
2832
|
-
))}
|
|
2833
|
-
</Select>
|
|
2834
|
-
<p>The selected node is the last</p>
|
|
2835
|
-
<Select defaultValue='v-49' defaultOpen style={{ marginBottom: 300, width: 120 }}>
|
|
2836
|
-
{new Array(50).fill(null).map((item, idx) => (
|
|
2837
|
-
<Option value={`v-${idx}`} key={idx}>{`option-${idx}`}</Option>
|
|
2838
|
-
))}
|
|
2839
|
-
</Select>
|
|
2840
|
-
<p>The selected node is the first</p>
|
|
2841
|
-
<Select defaultValue='v-0' style={{ marginBottom: 300, width: 120 }}>
|
|
2842
|
-
{new Array(50).fill(null).map((item, idx) => (
|
|
2843
|
-
<Option value={`v-${idx}`} key={idx}>{`option-${idx}`}</Option>
|
|
2844
|
-
))}
|
|
2845
|
-
</Select>
|
|
2846
|
-
<p>multiple selection</p>
|
|
2847
|
-
<Select defaultValue={['v-25', 'v-9']} multiple style={{ marginBottom: 300, width: 220 }}>
|
|
2848
|
-
{new Array(30).fill(null).map((item, idx) => (
|
|
2849
|
-
<Option value={`v-${idx}`} key={idx}>{`option-${idx}`}</Option>
|
|
2850
|
-
))}
|
|
2851
|
-
</Select>
|
|
2852
|
-
<p>multiple selection with no selected item</p>
|
|
2853
|
-
<Select multiple style={{ marginBottom: 300, width: 220 }}>
|
|
2854
|
-
{new Array(30).fill(null).map((item, idx) => (
|
|
2855
|
-
<Option value={`v-${idx}`} key={idx}>{`option-${idx}`}</Option>
|
|
2856
|
-
))}
|
|
2857
|
-
</Select>
|
|
2858
|
-
</div>
|
|
2859
|
-
);
|
|
2860
|
-
|
|
2861
|
-
ScrollIntoView.story = {
|
|
2862
|
-
name: 'scroll into view',
|
|
2863
|
-
};
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
export const SelectInputPropsDemo = () => {
|
|
2867
|
-
|
|
2868
|
-
const inputProps = {
|
|
2869
|
-
className: 'ttt',
|
|
2870
|
-
onCompositionEnd: (v) => console.log(v.target.value)
|
|
2871
|
-
};
|
|
2872
|
-
|
|
2873
|
-
return (
|
|
2874
|
-
<Select
|
|
2875
|
-
// onSearch={(v) => console.log(v)}
|
|
2876
|
-
optionList={list}
|
|
2877
|
-
inputProps={inputProps}
|
|
2878
|
-
multiple
|
|
2879
|
-
filter
|
|
2880
|
-
style={{ width: 200 }}
|
|
2881
|
-
>
|
|
2882
|
-
</Select>
|
|
2883
|
-
)
|
|
2884
|
-
};
|
|
2885
|
-
SelectInputPropsDemo.story = {
|
|
2886
|
-
name: 'inputProps',
|
|
2887
|
-
};
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
export const AutoClearSearchValue = () => {
|
|
2891
|
-
const [val, setVal] = useState(['semi1']);
|
|
2892
|
-
const optionList = [
|
|
2893
|
-
{ label: 'semi1', value: 'semi1' },
|
|
2894
|
-
{ label: 'semi2', value: 'semi2' },
|
|
2895
|
-
{ label: 'semi3', value: 'semi3' },
|
|
2896
|
-
{ label: 'semi4', value: 'semi4' },
|
|
2897
|
-
{ label: 'semi5', value: 'semi5' },
|
|
2898
|
-
{ label: 'semi6', value: 'semi6' },
|
|
2899
|
-
];
|
|
2900
|
-
|
|
2901
|
-
return (
|
|
2902
|
-
<>
|
|
2903
|
-
<h4>Controlled mode + multiple</h4>
|
|
2904
|
-
<Select style={{ width: 400 }} multiple optionList={optionList} filter value={val} onChange={value => setVal(value)} autoClearSearchValue={false}></Select>
|
|
2905
|
-
<br />
|
|
2906
|
-
<br />
|
|
2907
|
-
<h4>Uncontrolled mode + multiple</h4>
|
|
2908
|
-
<Select style={{ width: 400 }} multiple optionList={optionList} filter autoClearSearchValue={false}></Select>
|
|
2909
|
-
<h4>Uncontrolled mode + multiple + defaultValue</h4>
|
|
2910
|
-
<Select style={{ width: 400 }} multiple optionList={optionList} filter defaultValue={['semi2']} autoClearSearchValue={false}></Select>
|
|
2911
|
-
</>
|
|
2912
|
-
)
|
|
2913
|
-
}
|
|
2914
|
-
|
|
2915
|
-
SelectInputPropsDemo.story = {
|
|
2916
|
-
name: 'AutoClearSearchValue',
|
|
2917
|
-
};
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
export const RenderSelectedItemCallCount = () => {
|
|
2921
|
-
const list = [
|
|
2922
|
-
{ "name": "夏可漫", "email": "xiakeman@example.com", "avatar": "https://sf6-cdn-tos.douyinstatic.com/obj/eden-cn/ptlz_zlp/ljhwZthlaukjlkulzlp/root-web-sites/avatarDemo.jpeg" },
|
|
2923
|
-
{ "name": "申悦", "email": "shenyue@example.com", "avatar": "https://lf3-static.bytednsdoc.com/obj/eden-cn/ptlz_zlp/ljhwZthlaukjlkulzlp/root-web-sites/bag.jpeg" },
|
|
2924
|
-
{ "name": "曲晨一", "email": "quchenyi@example.com", "avatar": "https://sf6-cdn-tos.douyinstatic.com/obj/eden-cn/ptlz_zlp/ljhwZthlaukjlkulzlp/root-web-sites/8bd8224511db085ed74fea37205aede5.jpg" },
|
|
2925
|
-
{ "name": "文嘉茂", "email": "wenjiamao@example.com", "avatar": "https://sf6-cdn-tos.douyinstatic.com/obj/eden-cn/ptlz_zlp/ljhwZthlaukjlkulzlp/root-web-sites/6fbafc2d-e3e6-4cff-a1e2-17709c680624.png" },
|
|
2926
|
-
{ "name": "文嘉茂2", "email": "wenjiamao@example.com", "avatar": "https://sf6-cdn-tos.douyinstatic.com/obj/eden-cn/ptlz_zlp/ljhwZthlaukjlkulzlp/root-web-sites/6fbafc2d-e3e6-4cff-a1e2-17709c680624.png" },
|
|
2927
|
-
{ "name": "文嘉茂3", "email": "wenjiamao@example.com", "avatar": "https://sf6-cdn-tos.douyinstatic.com/obj/eden-cn/ptlz_zlp/ljhwZthlaukjlkulzlp/root-web-sites/6fbafc2d-e3e6-4cff-a1e2-17709c680624.png" },
|
|
2928
|
-
]
|
|
2929
|
-
|
|
2930
|
-
const renderMultipleWithCustomTag = (optionNode, { onClose }) => {
|
|
2931
|
-
console.count('rerender')
|
|
2932
|
-
const content = (
|
|
2933
|
-
<Tag
|
|
2934
|
-
avatarSrc={optionNode.avatar}
|
|
2935
|
-
avatarShape='circle'
|
|
2936
|
-
closable={true}
|
|
2937
|
-
onClose={onClose}
|
|
2938
|
-
size='large'
|
|
2939
|
-
>
|
|
2940
|
-
{optionNode.name}
|
|
2941
|
-
</Tag>
|
|
2942
|
-
);
|
|
2943
|
-
return {
|
|
2944
|
-
isRenderInTag: false,
|
|
2945
|
-
content
|
|
2946
|
-
};
|
|
2947
|
-
}
|
|
2948
|
-
|
|
2949
|
-
const renderCustomOption = (item, index) => {
|
|
2950
|
-
const optionStyle = {
|
|
2951
|
-
display: 'flex',
|
|
2952
|
-
paddingLeft: 24,
|
|
2953
|
-
paddingTop: 10,
|
|
2954
|
-
paddingBottom: 10
|
|
2955
|
-
}
|
|
2956
|
-
return (
|
|
2957
|
-
<Select.Option key={index} value={item.name} style={optionStyle} showTick={true} {...item} key={item.email}>
|
|
2958
|
-
<Avatar size="small" src={item.avatar} />
|
|
2959
|
-
<div style={{ marginLeft: 8 }}>
|
|
2960
|
-
<div style={{ fontSize: 14 }}>{item.name}</div>
|
|
2961
|
-
<div style={{ color: 'var(--color-text-2)', fontSize: 12, lineHeight: '16px', fontWeight: 'normal' }}>{item.email}</div>
|
|
2962
|
-
</div>
|
|
2963
|
-
</Select.Option>
|
|
2964
|
-
)
|
|
2965
|
-
}
|
|
2966
|
-
|
|
2967
|
-
return (
|
|
2968
|
-
<>
|
|
2969
|
-
<Select
|
|
2970
|
-
placeholder='请选择'
|
|
2971
|
-
showClear
|
|
2972
|
-
multiple
|
|
2973
|
-
maxTagCount={2}
|
|
2974
|
-
style={{ width: 280, height: 40 }}
|
|
2975
|
-
onChange={v => console.log(v)}
|
|
2976
|
-
defaultValue={'夏可漫'}
|
|
2977
|
-
renderSelectedItem={renderMultipleWithCustomTag}
|
|
2978
|
-
>
|
|
2979
|
-
{list.map((item, index) => renderCustomOption(item, index))}
|
|
2980
|
-
</Select>
|
|
2981
|
-
</>
|
|
2982
|
-
);
|
|
2983
|
-
}
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
RenderSelectedItemCallCount.story = {
|
|
2987
|
-
name: 'RenderSelectedItemCallCount',
|
|
2988
|
-
};
|