@douyinfe/semi-foundation 2.24.2 → 2.25.0-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/anchor/anchor.scss +6 -0
- package/anchor/foundation.ts +7 -6
- package/anchor/linkFoundation.ts +0 -1
- package/anchor/variables.scss +4 -0
- package/autoComplete/autoComplete.scss +2 -0
- package/autoComplete/foundation.ts +23 -20
- package/autoComplete/optionFoundation.ts +0 -2
- package/avatar/animation.scss +19 -0
- package/avatar/avatar.scss +314 -1
- package/avatar/constants.ts +21 -4
- package/avatar/foundation.ts +21 -4
- package/avatar/variables.scss +66 -10
- package/badge/badge.scss +13 -0
- package/badge/constants.ts +1 -1
- package/badge/variables.scss +4 -0
- package/base/foundation.ts +2 -3
- package/breadcrumb/breadcrumb.scss +10 -4
- package/breadcrumb/foundation.ts +0 -1
- package/breadcrumb/variables.scss +4 -0
- package/button/button.scss +88 -21
- package/button/iconButton.scss +1 -0
- package/button/splitButtonGroup.scss +10 -9
- package/button/variables.scss +13 -0
- package/calendar/calendar.scss +1 -1
- package/calendar/eventUtil.ts +14 -10
- package/calendar/foundation.ts +9 -9
- package/carousel/carousel.scss +4 -0
- package/carousel/foundation.ts +12 -7
- package/cascader/cascader.scss +66 -23
- package/cascader/constants.ts +5 -1
- package/cascader/foundation.ts +111 -63
- package/cascader/util.ts +64 -10
- package/cascader/variables.scss +5 -1
- package/checkbox/checkbox.scss +0 -1
- package/checkbox/checkboxFoundation.ts +1 -2
- package/checkbox/checkboxGroupFoundation.ts +0 -1
- package/collapse/foundation.ts +1 -0
- package/datePicker/_utils/getDefaultFormatToken.ts +1 -0
- package/datePicker/_utils/getInsetInputFormatToken.ts +1 -0
- package/datePicker/_utils/getInsetInputValueFromInsetInputStr.ts +1 -0
- package/datePicker/_utils/getYears.ts +8 -4
- package/datePicker/_utils/isValidTimeZone.ts +3 -0
- package/datePicker/constants.ts +1 -1
- package/datePicker/datePicker.scss +170 -21
- package/datePicker/foundation.ts +175 -150
- package/datePicker/inputFoundation.ts +34 -16
- package/datePicker/monthFoundation.ts +0 -1
- package/datePicker/monthsGridFoundation.ts +52 -32
- package/datePicker/variables.scss +13 -4
- package/datePicker/yearAndMonthFoundation.ts +68 -21
- package/descriptions/constants.ts +2 -1
- package/descriptions/descriptions.scss +20 -0
- package/descriptions/foundation.ts +36 -0
- package/descriptions/variables.scss +10 -0
- package/dropdown/constants.ts +1 -1
- package/dropdown/dropdown.scss +5 -0
- package/dropdown/foundation.ts +4 -3
- package/dropdown/menuFoundation.ts +3 -3
- package/form/constants.ts +2 -1
- package/form/form.scss +5 -2
- package/form/foundation.ts +12 -10
- package/form/interface.ts +5 -6
- package/form/utils.ts +39 -16
- package/form/variables.scss +3 -0
- package/grid/grid.scss +1 -1
- package/image/constants.ts +5 -1
- package/image/image.scss +9 -5
- package/image/previewFooterFoundation.ts +1 -4
- package/image/previewFoundation.ts +1 -1
- package/image/previewImageFoundation.ts +61 -70
- package/image/previewInnerFoundation.ts +93 -47
- package/image/utils.ts +18 -20
- package/image/variables.scss +1 -1
- package/input/foundation.ts +2 -4
- package/input/input.scss +48 -3
- package/input/textarea.scss +34 -0
- package/input/textareaFoundation.ts +42 -18
- package/input/variables.scss +7 -0
- package/inputNumber/foundation.ts +0 -5
- package/inputNumber/inputNumber.scss +9 -0
- package/lib/cjs/anchor/anchor.css +5 -0
- package/lib/cjs/anchor/anchor.scss +6 -0
- package/lib/cjs/anchor/constants.js +1 -3
- package/lib/cjs/anchor/foundation.js +20 -80
- package/lib/cjs/anchor/linkFoundation.js +3 -16
- package/lib/cjs/anchor/variables.scss +4 -0
- package/lib/cjs/autoComplete/autoComplete.css +1 -0
- package/lib/cjs/autoComplete/autoComplete.scss +2 -0
- package/lib/cjs/autoComplete/constants.js +3 -6
- package/lib/cjs/autoComplete/foundation.d.ts +3 -1
- package/lib/cjs/autoComplete/foundation.js +37 -149
- package/lib/cjs/autoComplete/optionFoundation.js +2 -14
- package/lib/cjs/avatar/animation.scss +19 -0
- package/lib/cjs/avatar/avatar.css +261 -0
- package/lib/cjs/avatar/avatar.scss +314 -1
- package/lib/cjs/avatar/constants.js +1 -4
- package/lib/cjs/avatar/foundation.d.ts +3 -0
- package/lib/cjs/avatar/foundation.js +21 -19
- package/lib/cjs/avatar/variables.scss +66 -10
- package/lib/cjs/backtop/constants.js +1 -3
- package/lib/cjs/backtop/foundation.d.ts +2 -2
- package/lib/cjs/backtop/foundation.js +0 -21
- package/lib/cjs/badge/badge.css +10 -0
- package/lib/cjs/badge/badge.scss +13 -0
- package/lib/cjs/badge/constants.js +2 -4
- package/lib/cjs/badge/variables.scss +4 -0
- package/lib/cjs/banner/constants.js +1 -3
- package/lib/cjs/banner/foundation.js +0 -7
- package/lib/cjs/base/constants.js +2 -4
- package/lib/cjs/base/foundation.d.ts +3 -3
- package/lib/cjs/base/foundation.js +12 -46
- package/lib/cjs/base/index.js +0 -3
- package/lib/cjs/breadcrumb/breadcrumb.css +5 -3
- package/lib/cjs/breadcrumb/breadcrumb.scss +10 -4
- package/lib/cjs/breadcrumb/constants.js +1 -3
- package/lib/cjs/breadcrumb/foundation.js +0 -13
- package/lib/cjs/breadcrumb/itemFoundation.js +0 -7
- package/lib/cjs/breadcrumb/variables.scss +4 -0
- package/lib/cjs/button/button.css +32 -5
- package/lib/cjs/button/button.scss +88 -21
- package/lib/cjs/button/constants.js +1 -3
- package/lib/cjs/button/iconButton.css +1 -0
- package/lib/cjs/button/iconButton.scss +1 -0
- package/lib/cjs/button/splitButtonGroup.scss +10 -9
- package/lib/cjs/button/variables.scss +13 -0
- package/lib/cjs/calendar/calendar.css +2 -2
- package/lib/cjs/calendar/calendar.scss +1 -1
- package/lib/cjs/calendar/constants.js +1 -3
- package/lib/cjs/calendar/eventUtil.d.ts +7 -6
- package/lib/cjs/calendar/eventUtil.js +15 -83
- package/lib/cjs/calendar/foundation.d.ts +4 -4
- package/lib/cjs/calendar/foundation.js +32 -128
- package/lib/cjs/card/constants.js +1 -3
- package/lib/cjs/carousel/carousel.css +4 -0
- package/lib/cjs/carousel/carousel.scss +4 -0
- package/lib/cjs/carousel/constants.js +9 -11
- package/lib/cjs/carousel/foundation.d.ts +2 -0
- package/lib/cjs/carousel/foundation.js +7 -52
- package/lib/cjs/cascader/cascader.css +45 -4
- package/lib/cjs/cascader/cascader.scss +66 -23
- package/lib/cjs/cascader/constants.d.ts +3 -0
- package/lib/cjs/cascader/constants.js +9 -8
- package/lib/cjs/cascader/foundation.d.ts +27 -8
- package/lib/cjs/cascader/foundation.js +122 -300
- package/lib/cjs/cascader/util.d.ts +9 -1
- package/lib/cjs/cascader/util.js +69 -33
- package/lib/cjs/cascader/variables.scss +5 -1
- package/lib/cjs/checkbox/checkbox.css +0 -1
- package/lib/cjs/checkbox/checkbox.scss +0 -1
- package/lib/cjs/checkbox/checkboxFoundation.js +1 -38
- package/lib/cjs/checkbox/checkboxGroupFoundation.js +1 -23
- package/lib/cjs/checkbox/constants.js +13 -15
- package/lib/cjs/collapse/constants.js +1 -3
- package/lib/cjs/collapse/foundation.d.ts +2 -1
- package/lib/cjs/collapse/foundation.js +2 -13
- package/lib/cjs/collapsible/constants.js +1 -3
- package/lib/cjs/collapsible/foundation.js +0 -9
- package/lib/cjs/datePicker/_utils/formatter.js +4 -10
- package/lib/cjs/datePicker/_utils/getDayOfWeek.d.ts +1 -1
- package/lib/cjs/datePicker/_utils/getDayOfWeek.js +0 -4
- package/lib/cjs/datePicker/_utils/getDefaultFormatToken.d.ts +1 -0
- package/lib/cjs/datePicker/_utils/getDefaultFormatToken.js +2 -6
- package/lib/cjs/datePicker/_utils/getDefaultPickerDate.d.ts +1 -1
- package/lib/cjs/datePicker/_utils/getDefaultPickerDate.js +0 -15
- package/lib/cjs/datePicker/_utils/getFullDateOffset.js +0 -7
- package/lib/cjs/datePicker/_utils/getInsetInputFormatToken.js +2 -6
- package/lib/cjs/datePicker/_utils/getInsetInputValueFromInsetInputStr.js +1 -6
- package/lib/cjs/datePicker/_utils/getMonthTable.d.ts +1 -1
- package/lib/cjs/datePicker/_utils/getMonthTable.js +7 -18
- package/lib/cjs/datePicker/_utils/getMonthsInYear.js +1 -3
- package/lib/cjs/datePicker/_utils/getYears.d.ts +1 -1
- package/lib/cjs/datePicker/_utils/getYears.js +9 -7
- package/lib/cjs/datePicker/_utils/index.js +0 -13
- package/lib/cjs/datePicker/_utils/isAfter.js +0 -4
- package/lib/cjs/datePicker/_utils/isBefore.js +0 -4
- package/lib/cjs/datePicker/_utils/isBetween.js +0 -4
- package/lib/cjs/datePicker/_utils/isDate.js +0 -1
- package/lib/cjs/datePicker/_utils/isSameDay.js +0 -4
- package/lib/cjs/datePicker/_utils/isTimestamp.js +0 -4
- package/lib/cjs/datePicker/_utils/isUnixTimestamp.js +0 -4
- package/lib/cjs/datePicker/_utils/isValidDate.js +0 -1
- package/lib/cjs/datePicker/_utils/isValidTimeZone.d.ts +1 -0
- package/lib/cjs/datePicker/_utils/isValidTimeZone.js +9 -0
- package/lib/cjs/datePicker/_utils/isWithinInterval.js +0 -4
- package/lib/cjs/datePicker/_utils/parser.js +0 -10
- package/lib/cjs/datePicker/constants.d.ts +1 -1
- package/lib/cjs/datePicker/constants.js +28 -31
- package/lib/cjs/datePicker/datePicker.css +88 -13
- package/lib/cjs/datePicker/datePicker.scss +170 -21
- package/lib/cjs/datePicker/foundation.d.ts +79 -50
- package/lib/cjs/datePicker/foundation.js +173 -441
- package/lib/cjs/datePicker/inputFoundation.d.ts +15 -6
- package/lib/cjs/datePicker/inputFoundation.js +35 -98
- package/lib/cjs/datePicker/monthFoundation.d.ts +1 -1
- package/lib/cjs/datePicker/monthFoundation.js +2 -28
- package/lib/cjs/datePicker/monthsGridFoundation.d.ts +18 -13
- package/lib/cjs/datePicker/monthsGridFoundation.js +70 -247
- package/lib/cjs/datePicker/variables.scss +13 -4
- package/lib/cjs/datePicker/yearAndMonthFoundation.d.ts +68 -13
- package/lib/cjs/datePicker/yearAndMonthFoundation.js +55 -42
- package/lib/cjs/descriptions/constants.d.ts +1 -0
- package/lib/cjs/descriptions/constants.js +3 -4
- package/lib/cjs/descriptions/descriptions.css +15 -0
- package/lib/cjs/descriptions/descriptions.scss +20 -0
- package/lib/cjs/descriptions/foundation.d.ts +7 -0
- package/lib/cjs/descriptions/foundation.js +45 -0
- package/lib/cjs/descriptions/variables.scss +10 -0
- package/lib/cjs/divider/constants.js +1 -3
- package/lib/cjs/dropdown/constants.js +4 -7
- package/lib/cjs/dropdown/dropdown.css +4 -0
- package/lib/cjs/dropdown/dropdown.scss +5 -0
- package/lib/cjs/dropdown/foundation.js +9 -25
- package/lib/cjs/dropdown/menuFoundation.js +9 -28
- package/lib/cjs/empty/constants.js +1 -3
- package/lib/cjs/form/constants.d.ts +1 -0
- package/lib/cjs/form/constants.js +3 -4
- package/lib/cjs/form/form.css +4 -0
- package/lib/cjs/form/form.scss +5 -2
- package/lib/cjs/form/foundation.d.ts +4 -4
- package/lib/cjs/form/foundation.js +84 -214
- package/lib/cjs/form/interface.d.ts +10 -10
- package/lib/cjs/form/utils.d.ts +10 -1
- package/lib/cjs/form/utils.js +85 -93
- package/lib/cjs/form/variables.scss +3 -0
- package/lib/cjs/grid/constants.js +1 -3
- package/lib/cjs/grid/grid.css +1 -1
- package/lib/cjs/grid/grid.scss +1 -1
- package/lib/cjs/highlight/constants.js +1 -3
- package/lib/cjs/icons/constants.js +1 -3
- package/lib/cjs/image/constants.d.ts +4 -1
- package/lib/cjs/image/constants.js +7 -5
- package/lib/cjs/image/image.css +4 -2
- package/lib/cjs/image/image.scss +9 -5
- package/lib/cjs/image/imageFoundation.js +4 -18
- package/lib/cjs/image/previewFooterFoundation.d.ts +0 -1
- package/lib/cjs/image/previewFooterFoundation.js +0 -14
- package/lib/cjs/image/previewFoundation.js +0 -11
- package/lib/cjs/image/previewImageFoundation.d.ts +9 -24
- package/lib/cjs/image/previewImageFoundation.js +79 -164
- package/lib/cjs/image/previewInnerFoundation.d.ts +19 -15
- package/lib/cjs/image/previewInnerFoundation.js +108 -114
- package/lib/cjs/image/utils.d.ts +1 -1
- package/lib/cjs/image/utils.js +46 -35
- package/lib/cjs/image/variables.scss +1 -1
- package/lib/cjs/input/constants.js +1 -3
- package/lib/cjs/input/foundation.js +19 -104
- package/lib/cjs/input/input.css +45 -1
- package/lib/cjs/input/input.scss +48 -3
- package/lib/cjs/input/textarea.css +20 -0
- package/lib/cjs/input/textarea.scss +34 -0
- package/lib/cjs/input/textareaFoundation.d.ts +1 -1
- package/lib/cjs/input/textareaFoundation.js +58 -101
- package/lib/cjs/input/util/calculateNodeHeight.js +6 -18
- package/lib/cjs/input/util/getSizingData.js +7 -11
- package/lib/cjs/input/variables.scss +7 -0
- package/lib/cjs/inputNumber/constants.js +0 -2
- package/lib/cjs/inputNumber/foundation.js +28 -197
- package/lib/cjs/inputNumber/inputNumber.css +4 -0
- package/lib/cjs/inputNumber/inputNumber.scss +9 -0
- package/lib/cjs/layout/constants.js +1 -3
- package/lib/cjs/list/constants.js +1 -3
- package/lib/cjs/modal/constants.js +1 -3
- package/lib/cjs/modal/modal.css +8 -0
- package/lib/cjs/modal/modal.scss +10 -1
- package/lib/cjs/modal/modalContentFoundation.js +0 -20
- package/lib/cjs/modal/modalFoundation.d.ts +8 -4
- package/lib/cjs/modal/modalFoundation.js +40 -15
- package/lib/cjs/modal/variables.scss +6 -1
- package/lib/cjs/navigation/NavItem.js +0 -12
- package/lib/cjs/navigation/constants.js +1 -4
- package/lib/cjs/navigation/foundation.js +3 -70
- package/lib/cjs/navigation/itemFoundation.js +3 -22
- package/lib/cjs/navigation/subNavFoundation.js +7 -42
- package/lib/cjs/notification/constants.js +3 -6
- package/lib/cjs/notification/notification.css +18 -0
- package/lib/cjs/notification/notification.scss +21 -1
- package/lib/cjs/notification/notificationFoundation.d.ts +6 -6
- package/lib/cjs/notification/notificationFoundation.js +0 -16
- package/lib/cjs/notification/notificationListFoundation.d.ts +4 -1
- package/lib/cjs/notification/notificationListFoundation.js +15 -18
- package/lib/cjs/overflowList/constants.d.ts +6 -4
- package/lib/cjs/overflowList/constants.js +3 -3
- package/lib/cjs/overflowList/foundation.d.ts +3 -1
- package/lib/cjs/overflowList/foundation.js +59 -68
- package/lib/cjs/pagination/constants.js +1 -3
- package/lib/cjs/pagination/foundation.d.ts +5 -3
- package/lib/cjs/pagination/foundation.js +36 -93
- package/lib/cjs/pagination/pagination.css +23 -0
- package/lib/cjs/pagination/pagination.scss +29 -0
- package/lib/cjs/pagination/variables.scss +1 -0
- package/lib/cjs/popconfirm/constants.js +2 -4
- package/lib/cjs/popconfirm/popconfirm.css +4 -24
- package/lib/cjs/popconfirm/popconfirm.scss +4 -16
- package/lib/cjs/popconfirm/popconfirmFoundation.d.ts +4 -0
- package/lib/cjs/popconfirm/popconfirmFoundation.js +17 -19
- package/lib/cjs/popconfirm/rtl.scss +0 -13
- package/lib/cjs/popconfirm/variables.scss +0 -4
- package/lib/cjs/popover/constants.d.ts +1 -1
- package/lib/cjs/popover/constants.js +3 -6
- package/lib/cjs/popover/popover.css +2 -0
- package/lib/cjs/popover/popover.scss +2 -0
- package/lib/cjs/progress/constants.js +1 -3
- package/lib/cjs/progress/generates.d.ts +2 -2
- package/lib/cjs/progress/generates.js +33 -74
- package/lib/cjs/radio/constants.js +13 -15
- package/lib/cjs/radio/radio.css +3 -0
- package/lib/cjs/radio/radio.scss +6 -3
- package/lib/cjs/radio/radioFoundation.js +0 -14
- package/lib/cjs/radio/radioGroupFoundation.js +3 -23
- package/lib/cjs/radio/radioInnerFoundation.js +1 -19
- package/lib/cjs/radio/variables.scss +4 -0
- package/lib/cjs/rating/constants.js +1 -3
- package/lib/cjs/rating/foundation.js +10 -62
- package/lib/cjs/scrollList/constants.js +2 -4
- package/lib/cjs/scrollList/foundation.js +0 -4
- package/lib/cjs/scrollList/itemFoundation.js +8 -61
- package/lib/cjs/scrollList/scrollTo.js +2 -5
- package/lib/cjs/select/constants.js +3 -6
- package/lib/cjs/select/foundation.d.ts +8 -6
- package/lib/cjs/select/foundation.js +172 -434
- package/lib/cjs/select/option.scss +1 -1
- package/lib/cjs/select/optionFoundation.js +2 -14
- package/lib/cjs/select/select.css +50 -0
- package/lib/cjs/select/select.scss +74 -5
- package/lib/cjs/select/variables.scss +9 -6
- package/lib/cjs/sideSheet/constants.js +2 -4
- package/lib/cjs/sideSheet/sideSheet.css +30 -0
- package/lib/cjs/sideSheet/sideSheet.scss +38 -0
- package/lib/cjs/sideSheet/sideSheetFoundation.d.ts +1 -0
- package/lib/cjs/sideSheet/sideSheetFoundation.js +0 -18
- package/lib/cjs/sideSheet/variables.scss +7 -0
- package/lib/cjs/skeleton/constants.js +1 -3
- package/lib/cjs/skeleton/skeleton.css +3 -2
- package/lib/cjs/skeleton/skeleton.scss +1 -0
- package/lib/cjs/skeleton/variables.scss +2 -2
- package/lib/cjs/slider/constants.d.ts +1 -0
- package/lib/cjs/slider/constants.js +8 -9
- package/lib/cjs/slider/foundation.d.ts +13 -2
- package/lib/cjs/slider/foundation.js +30 -226
- package/lib/cjs/slider/slider.css +25 -11
- package/lib/cjs/slider/slider.scss +16 -1
- package/lib/cjs/slider/variables.scss +15 -9
- package/lib/cjs/space/constants.js +1 -3
- package/lib/cjs/spin/constants.js +1 -3
- package/lib/cjs/spin/foundation.js +3 -13
- package/lib/cjs/spin/spin.css +3 -0
- package/lib/cjs/spin/spin.scss +3 -0
- package/lib/cjs/steps/bacisSteps.scss +10 -3
- package/lib/cjs/steps/constants.js +2 -4
- package/lib/cjs/steps/fillSteps.scss +7 -7
- package/lib/cjs/steps/steps.css +27 -22
- package/lib/cjs/steps/variables.scss +3 -3
- package/lib/cjs/switch/constants.js +13 -15
- package/lib/cjs/switch/foundation.js +1 -21
- package/lib/cjs/switch/switch.css +10 -0
- package/lib/cjs/switch/switch.scss +13 -2
- package/lib/cjs/table/bodyFoundation.js +1 -34
- package/lib/cjs/table/cellFoundation.js +0 -5
- package/lib/cjs/table/constants.d.ts +0 -1
- package/lib/cjs/table/constants.js +13 -18
- package/lib/cjs/table/foundation.d.ts +26 -16
- package/lib/cjs/table/foundation.js +79 -308
- package/lib/cjs/table/rtl.scss +33 -2
- package/lib/cjs/table/table.css +100 -64
- package/lib/cjs/table/table.scss +66 -8
- package/lib/cjs/table/tableRowFoundation.js +0 -12
- package/lib/cjs/table/tableSelectionCellFoundation.js +0 -6
- package/lib/cjs/table/utils.d.ts +6 -4
- package/lib/cjs/table/utils.js +27 -160
- package/lib/cjs/table/variables.scss +6 -3
- package/lib/cjs/tabs/constants.js +21 -23
- package/lib/cjs/tabs/foundation.js +2 -40
- package/lib/cjs/tabs/tabs.css +207 -7
- package/lib/cjs/tabs/tabs.scss +339 -24
- package/lib/cjs/tag/constants.js +1 -4
- package/lib/cjs/tag/tag.css +34 -1
- package/lib/cjs/tag/tag.scss +43 -4
- package/lib/cjs/tag/variables.scss +5 -0
- package/lib/cjs/tagInput/constants.js +1 -3
- package/lib/cjs/tagInput/foundation.d.ts +7 -4
- package/lib/cjs/tagInput/foundation.js +64 -88
- package/lib/cjs/tagInput/tagInput.css +35 -9
- package/lib/cjs/tagInput/tagInput.scss +41 -12
- package/lib/cjs/tagInput/utils/getSplitedArray.js +0 -11
- package/lib/cjs/tagInput/variables.scss +2 -0
- package/lib/cjs/timePicker/ComboxFoundation.js +6 -41
- package/lib/cjs/timePicker/constants.js +3 -6
- package/lib/cjs/timePicker/foundation.d.ts +2 -2
- package/lib/cjs/timePicker/foundation.js +28 -107
- package/lib/cjs/timePicker/inputFoundation.js +4 -25
- package/lib/cjs/timePicker/timePicker.css +15 -0
- package/lib/cjs/timePicker/timePicker.scss +22 -1
- package/lib/cjs/timePicker/utils/index.js +12 -51
- package/lib/cjs/timePicker/utils/localeDate.js +0 -10
- package/lib/cjs/timeline/constants.js +2 -4
- package/lib/cjs/toast/animation.scss +3 -0
- package/lib/cjs/toast/constants.js +3 -6
- package/lib/cjs/toast/toast.css +35 -3
- package/lib/cjs/toast/toast.scss +43 -3
- package/lib/cjs/toast/toastFoundation.d.ts +5 -4
- package/lib/cjs/toast/toastFoundation.js +0 -14
- package/lib/cjs/toast/toastListFoundation.d.ts +5 -0
- package/lib/cjs/toast/toastListFoundation.js +10 -22
- package/lib/cjs/toast/variables.scss +14 -0
- package/lib/cjs/tooltip/constants.d.ts +1 -1
- package/lib/cjs/tooltip/constants.js +2 -4
- package/lib/cjs/tooltip/foundation.d.ts +5 -2
- package/lib/cjs/tooltip/foundation.js +143 -336
- package/lib/cjs/tooltip/tooltip.css +7 -0
- package/lib/cjs/tooltip/tooltip.scss +9 -0
- package/lib/cjs/transfer/constants.js +1 -3
- package/lib/cjs/transfer/foundation.d.ts +1 -1
- package/lib/cjs/transfer/foundation.js +4 -69
- package/lib/cjs/transfer/transfer.css +4 -0
- package/lib/cjs/transfer/transfer.scss +7 -0
- package/lib/cjs/transfer/transferUtils.js +5 -27
- package/lib/cjs/tree/constants.js +2 -4
- package/lib/cjs/tree/foundation.d.ts +14 -9
- package/lib/cjs/tree/foundation.js +60 -183
- package/lib/cjs/tree/rtl.scss +19 -11
- package/lib/cjs/tree/tree.css +147 -65
- package/lib/cjs/tree/tree.scss +112 -17
- package/lib/cjs/tree/treeUtil.d.ts +17 -8
- package/lib/cjs/tree/treeUtil.js +102 -195
- package/lib/cjs/tree/variables.scss +3 -2
- package/lib/cjs/treeSelect/constants.js +3 -5
- package/lib/cjs/treeSelect/foundation.d.ts +26 -13
- package/lib/cjs/treeSelect/foundation.js +153 -248
- package/lib/cjs/treeSelect/treeSelect.css +55 -10
- package/lib/cjs/treeSelect/treeSelect.scss +76 -20
- package/lib/cjs/treeSelect/variables.scss +4 -2
- package/lib/cjs/typography/constants.d.ts +1 -0
- package/lib/cjs/typography/constants.js +2 -3
- package/lib/cjs/typography/formatNumeral.d.ts +3 -3
- package/lib/cjs/typography/formatNumeral.js +22 -43
- package/lib/cjs/typography/typography.css +135 -2
- package/lib/cjs/typography/typography.scss +151 -8
- package/lib/cjs/typography/variables.scss +52 -0
- package/lib/cjs/upload/constants.js +2 -4
- package/lib/cjs/upload/fileCardFoundation.d.ts +9 -0
- package/lib/cjs/upload/fileCardFoundation.js +18 -0
- package/lib/cjs/upload/foundation.d.ts +14 -5
- package/lib/cjs/upload/foundation.js +107 -247
- package/lib/cjs/upload/upload.css +9 -0
- package/lib/cjs/upload/upload.scss +8 -0
- package/lib/cjs/upload/utils.js +14 -33
- package/lib/cjs/utils/Event.js +1 -21
- package/lib/cjs/utils/FocusHandle.d.ts +1 -1
- package/lib/cjs/utils/FocusHandle.js +6 -35
- package/lib/cjs/utils/Logger.js +0 -21
- package/lib/cjs/utils/Store.js +0 -10
- package/lib/cjs/utils/a11y.js +18 -43
- package/lib/cjs/utils/array.d.ts +2 -2
- package/lib/cjs/utils/array.js +2 -9
- package/lib/cjs/utils/arrayMove.js +0 -1
- package/lib/cjs/utils/classnames.js +0 -12
- package/lib/cjs/utils/date-fns-extra.d.ts +28 -17
- package/lib/cjs/utils/date-fns-extra.js +82 -51
- package/lib/cjs/utils/dom.d.ts +1 -1
- package/lib/cjs/utils/dom.js +0 -13
- package/lib/cjs/utils/function.js +0 -2
- package/lib/cjs/utils/getDataAttr.js +1 -3
- package/lib/cjs/utils/getHighlight.js +5 -26
- package/lib/cjs/utils/getMotionObjFromProps.js +4 -16
- package/lib/cjs/utils/index.js +0 -4
- package/lib/cjs/utils/isBothNaN.js +0 -2
- package/lib/cjs/utils/isElement.js +0 -1
- package/lib/cjs/utils/isEnterPress.js +0 -5
- package/lib/cjs/utils/isEscPress.js +0 -5
- package/lib/cjs/utils/isNullOrUndefined.js +0 -1
- package/lib/cjs/utils/isNumber.js +0 -1
- package/lib/cjs/utils/isObject.js +0 -1
- package/lib/cjs/utils/isPromise.js +0 -3
- package/lib/cjs/utils/isString.js +0 -1
- package/lib/cjs/utils/keyCode.js +0 -105
- package/lib/cjs/utils/log.js +0 -5
- package/lib/cjs/utils/number.js +0 -2
- package/lib/cjs/utils/object.d.ts +4 -4
- package/lib/cjs/utils/object.js +10 -36
- package/lib/cjs/utils/set.js +0 -8
- package/lib/cjs/utils/shallowEqualObjects.js +0 -7
- package/lib/cjs/utils/touchPolyfill.js +1 -8
- package/lib/cjs/utils/type.d.ts +3 -3
- package/lib/cjs/utils/uuid.js +4 -11
- package/lib/cjs/utils/warning.js +1 -2
- package/lib/es/anchor/anchor.css +5 -0
- package/lib/es/anchor/anchor.scss +6 -0
- package/lib/es/anchor/constants.js +1 -1
- package/lib/es/anchor/foundation.js +20 -73
- package/lib/es/anchor/linkFoundation.js +3 -12
- package/lib/es/anchor/variables.scss +4 -0
- package/lib/es/autoComplete/autoComplete.css +1 -0
- package/lib/es/autoComplete/autoComplete.scss +2 -0
- package/lib/es/autoComplete/constants.js +3 -3
- package/lib/es/autoComplete/foundation.d.ts +3 -1
- package/lib/es/autoComplete/foundation.js +37 -142
- package/lib/es/autoComplete/optionFoundation.js +2 -10
- package/lib/es/avatar/animation.scss +19 -0
- package/lib/es/avatar/avatar.css +261 -0
- package/lib/es/avatar/avatar.scss +314 -1
- package/lib/es/avatar/constants.js +1 -2
- package/lib/es/avatar/foundation.d.ts +3 -0
- package/lib/es/avatar/foundation.js +21 -14
- package/lib/es/avatar/variables.scss +66 -10
- package/lib/es/backtop/constants.js +1 -1
- package/lib/es/backtop/foundation.d.ts +2 -2
- package/lib/es/backtop/foundation.js +0 -16
- package/lib/es/badge/badge.css +10 -0
- package/lib/es/badge/badge.scss +13 -0
- package/lib/es/badge/constants.js +2 -2
- package/lib/es/badge/variables.scss +4 -0
- package/lib/es/banner/constants.js +1 -1
- package/lib/es/banner/foundation.js +0 -3
- package/lib/es/base/constants.js +2 -2
- package/lib/es/base/foundation.d.ts +3 -3
- package/lib/es/base/foundation.js +11 -44
- package/lib/es/breadcrumb/breadcrumb.css +5 -3
- package/lib/es/breadcrumb/breadcrumb.scss +10 -4
- package/lib/es/breadcrumb/constants.js +1 -1
- package/lib/es/breadcrumb/foundation.js +0 -8
- package/lib/es/breadcrumb/itemFoundation.js +0 -3
- package/lib/es/breadcrumb/variables.scss +4 -0
- package/lib/es/button/button.css +32 -5
- package/lib/es/button/button.scss +88 -21
- package/lib/es/button/constants.js +1 -1
- package/lib/es/button/iconButton.css +1 -0
- package/lib/es/button/iconButton.scss +1 -0
- package/lib/es/button/splitButtonGroup.scss +10 -9
- package/lib/es/button/variables.scss +13 -0
- package/lib/es/calendar/calendar.css +2 -2
- package/lib/es/calendar/calendar.scss +1 -1
- package/lib/es/calendar/constants.js +1 -1
- package/lib/es/calendar/eventUtil.d.ts +7 -6
- package/lib/es/calendar/eventUtil.js +15 -45
- package/lib/es/calendar/foundation.d.ts +4 -4
- package/lib/es/calendar/foundation.js +32 -122
- package/lib/es/card/constants.js +1 -1
- package/lib/es/carousel/carousel.css +4 -0
- package/lib/es/carousel/carousel.scss +4 -0
- package/lib/es/carousel/constants.js +9 -9
- package/lib/es/carousel/foundation.d.ts +2 -0
- package/lib/es/carousel/foundation.js +7 -47
- package/lib/es/cascader/cascader.css +45 -4
- package/lib/es/cascader/cascader.scss +66 -23
- package/lib/es/cascader/constants.d.ts +3 -0
- package/lib/es/cascader/constants.js +7 -5
- package/lib/es/cascader/foundation.d.ts +27 -8
- package/lib/es/cascader/foundation.js +125 -286
- package/lib/es/cascader/util.d.ts +9 -1
- package/lib/es/cascader/util.js +65 -24
- package/lib/es/cascader/variables.scss +5 -1
- package/lib/es/checkbox/checkbox.css +0 -1
- package/lib/es/checkbox/checkbox.scss +0 -1
- package/lib/es/checkbox/checkboxFoundation.js +1 -34
- package/lib/es/checkbox/checkboxGroupFoundation.js +1 -20
- package/lib/es/checkbox/constants.js +13 -13
- package/lib/es/collapse/constants.js +1 -1
- package/lib/es/collapse/foundation.d.ts +2 -1
- package/lib/es/collapse/foundation.js +2 -9
- package/lib/es/collapsible/constants.js +1 -1
- package/lib/es/collapsible/foundation.js +0 -7
- package/lib/es/datePicker/_utils/formatter.js +4 -8
- package/lib/es/datePicker/_utils/getDayOfWeek.d.ts +1 -1
- package/lib/es/datePicker/_utils/getDayOfWeek.js +0 -3
- package/lib/es/datePicker/_utils/getDefaultFormatToken.d.ts +1 -0
- package/lib/es/datePicker/_utils/getDefaultFormatToken.js +2 -3
- package/lib/es/datePicker/_utils/getDefaultPickerDate.d.ts +1 -1
- package/lib/es/datePicker/_utils/getDefaultPickerDate.js +0 -10
- package/lib/es/datePicker/_utils/getFullDateOffset.js +0 -3
- package/lib/es/datePicker/_utils/getInsetInputFormatToken.js +2 -5
- package/lib/es/datePicker/_utils/getInsetInputValueFromInsetInputStr.js +1 -5
- package/lib/es/datePicker/_utils/getMonthTable.d.ts +1 -1
- package/lib/es/datePicker/_utils/getMonthTable.js +8 -18
- package/lib/es/datePicker/_utils/getMonthsInYear.js +1 -2
- package/lib/es/datePicker/_utils/getYears.d.ts +1 -1
- package/lib/es/datePicker/_utils/getYears.js +9 -6
- package/lib/es/datePicker/_utils/isBetween.js +0 -1
- package/lib/es/datePicker/_utils/isValidTimeZone.d.ts +1 -0
- package/lib/es/datePicker/_utils/isValidTimeZone.js +3 -0
- package/lib/es/datePicker/_utils/parser.js +0 -8
- package/lib/es/datePicker/constants.d.ts +1 -1
- package/lib/es/datePicker/constants.js +28 -28
- package/lib/es/datePicker/datePicker.css +88 -13
- package/lib/es/datePicker/datePicker.scss +170 -21
- package/lib/es/datePicker/foundation.d.ts +79 -50
- package/lib/es/datePicker/foundation.js +173 -426
- package/lib/es/datePicker/inputFoundation.d.ts +15 -6
- package/lib/es/datePicker/inputFoundation.js +35 -85
- package/lib/es/datePicker/monthFoundation.d.ts +1 -1
- package/lib/es/datePicker/monthFoundation.js +3 -22
- package/lib/es/datePicker/monthsGridFoundation.d.ts +18 -13
- package/lib/es/datePicker/monthsGridFoundation.js +70 -231
- package/lib/es/datePicker/variables.scss +13 -4
- package/lib/es/datePicker/yearAndMonthFoundation.d.ts +68 -13
- package/lib/es/datePicker/yearAndMonthFoundation.js +55 -37
- package/lib/es/descriptions/constants.d.ts +1 -0
- package/lib/es/descriptions/constants.js +3 -2
- package/lib/es/descriptions/descriptions.css +15 -0
- package/lib/es/descriptions/descriptions.scss +20 -0
- package/lib/es/descriptions/foundation.d.ts +7 -0
- package/lib/es/descriptions/foundation.js +37 -0
- package/lib/es/descriptions/variables.scss +10 -0
- package/lib/es/divider/constants.js +1 -1
- package/lib/es/dropdown/constants.js +4 -4
- package/lib/es/dropdown/dropdown.css +4 -0
- package/lib/es/dropdown/dropdown.scss +5 -0
- package/lib/es/dropdown/foundation.js +9 -20
- package/lib/es/dropdown/menuFoundation.js +9 -23
- package/lib/es/empty/constants.js +1 -1
- package/lib/es/form/constants.d.ts +1 -0
- package/lib/es/form/constants.js +3 -2
- package/lib/es/form/form.css +4 -0
- package/lib/es/form/form.scss +5 -2
- package/lib/es/form/foundation.d.ts +4 -4
- package/lib/es/form/foundation.js +84 -203
- package/lib/es/form/interface.d.ts +10 -10
- package/lib/es/form/utils.d.ts +10 -1
- package/lib/es/form/utils.js +83 -86
- package/lib/es/form/variables.scss +3 -0
- package/lib/es/grid/constants.js +1 -1
- package/lib/es/grid/grid.css +1 -1
- package/lib/es/grid/grid.scss +1 -1
- package/lib/es/highlight/constants.js +1 -1
- package/lib/es/icons/constants.js +1 -1
- package/lib/es/image/constants.d.ts +4 -1
- package/lib/es/image/constants.js +5 -2
- package/lib/es/image/image.css +4 -2
- package/lib/es/image/image.scss +9 -5
- package/lib/es/image/imageFoundation.js +4 -13
- package/lib/es/image/previewFooterFoundation.d.ts +0 -1
- package/lib/es/image/previewFooterFoundation.js +0 -10
- package/lib/es/image/previewFoundation.js +0 -7
- package/lib/es/image/previewImageFoundation.d.ts +9 -24
- package/lib/es/image/previewImageFoundation.js +79 -156
- package/lib/es/image/previewInnerFoundation.d.ts +19 -15
- package/lib/es/image/previewInnerFoundation.js +108 -107
- package/lib/es/image/utils.d.ts +1 -1
- package/lib/es/image/utils.js +46 -27
- package/lib/es/image/variables.scss +1 -1
- package/lib/es/input/constants.js +1 -1
- package/lib/es/input/foundation.js +19 -96
- package/lib/es/input/input.css +45 -1
- package/lib/es/input/input.scss +48 -3
- package/lib/es/input/textarea.css +20 -0
- package/lib/es/input/textarea.scss +34 -0
- package/lib/es/input/textareaFoundation.d.ts +1 -1
- package/lib/es/input/textareaFoundation.js +58 -91
- package/lib/es/input/util/calculateNodeHeight.js +6 -18
- package/lib/es/input/util/getSizingData.js +7 -11
- package/lib/es/input/variables.scss +7 -0
- package/lib/es/inputNumber/foundation.js +28 -188
- package/lib/es/inputNumber/inputNumber.css +4 -0
- package/lib/es/inputNumber/inputNumber.scss +9 -0
- package/lib/es/layout/constants.js +1 -1
- package/lib/es/list/constants.js +1 -1
- package/lib/es/modal/constants.js +1 -1
- package/lib/es/modal/modal.css +8 -0
- package/lib/es/modal/modal.scss +10 -1
- package/lib/es/modal/modalContentFoundation.js +0 -15
- package/lib/es/modal/modalFoundation.d.ts +8 -4
- package/lib/es/modal/modalFoundation.js +40 -11
- package/lib/es/modal/variables.scss +6 -1
- package/lib/es/navigation/NavItem.js +0 -8
- package/lib/es/navigation/constants.js +2 -2
- package/lib/es/navigation/foundation.js +3 -63
- package/lib/es/navigation/itemFoundation.js +3 -19
- package/lib/es/navigation/subNavFoundation.js +7 -38
- package/lib/es/notification/constants.js +4 -4
- package/lib/es/notification/notification.css +18 -0
- package/lib/es/notification/notification.scss +21 -1
- package/lib/es/notification/notificationFoundation.d.ts +6 -6
- package/lib/es/notification/notificationFoundation.js +0 -11
- package/lib/es/notification/notificationListFoundation.d.ts +4 -1
- package/lib/es/notification/notificationListFoundation.js +15 -14
- package/lib/es/overflowList/constants.d.ts +6 -4
- package/lib/es/overflowList/constants.js +3 -1
- package/lib/es/overflowList/foundation.d.ts +3 -1
- package/lib/es/overflowList/foundation.js +59 -64
- package/lib/es/pagination/constants.js +1 -1
- package/lib/es/pagination/foundation.d.ts +5 -3
- package/lib/es/pagination/foundation.js +36 -90
- package/lib/es/pagination/pagination.css +23 -0
- package/lib/es/pagination/pagination.scss +29 -0
- package/lib/es/pagination/variables.scss +1 -0
- package/lib/es/popconfirm/constants.js +2 -2
- package/lib/es/popconfirm/popconfirm.css +4 -24
- package/lib/es/popconfirm/popconfirm.scss +4 -16
- package/lib/es/popconfirm/popconfirmFoundation.d.ts +4 -0
- package/lib/es/popconfirm/popconfirmFoundation.js +17 -14
- package/lib/es/popconfirm/rtl.scss +0 -13
- package/lib/es/popconfirm/variables.scss +0 -4
- package/lib/es/popover/constants.d.ts +1 -1
- package/lib/es/popover/constants.js +3 -3
- package/lib/es/popover/popover.css +2 -0
- package/lib/es/popover/popover.scss +2 -0
- package/lib/es/progress/constants.js +1 -1
- package/lib/es/progress/generates.d.ts +2 -2
- package/lib/es/progress/generates.js +33 -73
- package/lib/es/radio/constants.js +13 -13
- package/lib/es/radio/radio.css +3 -0
- package/lib/es/radio/radio.scss +6 -3
- package/lib/es/radio/radioFoundation.js +0 -9
- package/lib/es/radio/radioGroupFoundation.js +3 -19
- package/lib/es/radio/radioInnerFoundation.js +1 -15
- package/lib/es/radio/variables.scss +4 -0
- package/lib/es/rating/constants.js +1 -1
- package/lib/es/rating/foundation.js +10 -55
- package/lib/es/scrollList/constants.js +2 -2
- package/lib/es/scrollList/itemFoundation.js +8 -60
- package/lib/es/scrollList/scrollTo.js +2 -4
- package/lib/es/select/constants.js +3 -3
- package/lib/es/select/foundation.d.ts +8 -6
- package/lib/es/select/foundation.js +172 -420
- package/lib/es/select/option.scss +1 -1
- package/lib/es/select/optionFoundation.js +2 -10
- package/lib/es/select/select.css +50 -0
- package/lib/es/select/select.scss +74 -5
- package/lib/es/select/variables.scss +9 -6
- package/lib/es/sideSheet/constants.js +2 -2
- package/lib/es/sideSheet/sideSheet.css +30 -0
- package/lib/es/sideSheet/sideSheet.scss +38 -0
- package/lib/es/sideSheet/sideSheetFoundation.d.ts +1 -0
- package/lib/es/sideSheet/sideSheetFoundation.js +0 -12
- package/lib/es/sideSheet/variables.scss +7 -0
- package/lib/es/skeleton/constants.js +1 -1
- package/lib/es/skeleton/skeleton.css +3 -2
- package/lib/es/skeleton/skeleton.scss +1 -0
- package/lib/es/skeleton/variables.scss +2 -2
- package/lib/es/slider/constants.d.ts +1 -0
- package/lib/es/slider/constants.js +8 -7
- package/lib/es/slider/foundation.d.ts +13 -2
- package/lib/es/slider/foundation.js +30 -219
- package/lib/es/slider/slider.css +25 -11
- package/lib/es/slider/slider.scss +16 -1
- package/lib/es/slider/variables.scss +15 -9
- package/lib/es/space/constants.js +1 -1
- package/lib/es/spin/constants.js +1 -1
- package/lib/es/spin/foundation.js +3 -11
- package/lib/es/spin/spin.css +3 -0
- package/lib/es/spin/spin.scss +3 -0
- package/lib/es/steps/bacisSteps.scss +10 -3
- package/lib/es/steps/constants.js +2 -2
- package/lib/es/steps/fillSteps.scss +7 -7
- package/lib/es/steps/steps.css +27 -22
- package/lib/es/steps/variables.scss +3 -3
- package/lib/es/switch/constants.js +13 -13
- package/lib/es/switch/foundation.js +1 -16
- package/lib/es/switch/switch.css +10 -0
- package/lib/es/switch/switch.scss +13 -2
- package/lib/es/table/bodyFoundation.js +1 -25
- package/lib/es/table/cellFoundation.js +0 -1
- package/lib/es/table/constants.d.ts +0 -1
- package/lib/es/table/constants.js +13 -16
- package/lib/es/table/foundation.d.ts +26 -16
- package/lib/es/table/foundation.js +79 -313
- package/lib/es/table/rtl.scss +33 -2
- package/lib/es/table/table.css +100 -64
- package/lib/es/table/table.scss +66 -8
- package/lib/es/table/tableRowFoundation.js +1 -9
- package/lib/es/table/tableSelectionCellFoundation.js +0 -2
- package/lib/es/table/utils.d.ts +6 -4
- package/lib/es/table/utils.js +25 -119
- package/lib/es/table/variables.scss +6 -3
- package/lib/es/tabs/constants.js +21 -21
- package/lib/es/tabs/foundation.js +2 -35
- package/lib/es/tabs/tabs.css +207 -7
- package/lib/es/tabs/tabs.scss +339 -24
- package/lib/es/tag/constants.js +1 -2
- package/lib/es/tag/tag.css +34 -1
- package/lib/es/tag/tag.scss +43 -4
- package/lib/es/tag/variables.scss +5 -0
- package/lib/es/tagInput/constants.js +1 -1
- package/lib/es/tagInput/foundation.d.ts +7 -4
- package/lib/es/tagInput/foundation.js +64 -78
- package/lib/es/tagInput/tagInput.css +35 -9
- package/lib/es/tagInput/tagInput.scss +41 -12
- package/lib/es/tagInput/utils/getSplitedArray.js +0 -7
- package/lib/es/tagInput/variables.scss +2 -0
- package/lib/es/timePicker/ComboxFoundation.js +6 -32
- package/lib/es/timePicker/constants.js +3 -3
- package/lib/es/timePicker/foundation.d.ts +2 -2
- package/lib/es/timePicker/foundation.js +30 -101
- package/lib/es/timePicker/inputFoundation.js +4 -22
- package/lib/es/timePicker/timePicker.css +15 -0
- package/lib/es/timePicker/timePicker.scss +22 -1
- package/lib/es/timePicker/utils/index.js +12 -30
- package/lib/es/timePicker/utils/localeDate.js +0 -8
- package/lib/es/timeline/constants.js +2 -2
- package/lib/es/toast/animation.scss +3 -0
- package/lib/es/toast/constants.js +4 -4
- package/lib/es/toast/toast.css +35 -3
- package/lib/es/toast/toast.scss +43 -3
- package/lib/es/toast/toastFoundation.d.ts +5 -4
- package/lib/es/toast/toastFoundation.js +0 -9
- package/lib/es/toast/toastListFoundation.d.ts +5 -0
- package/lib/es/toast/toastListFoundation.js +10 -18
- package/lib/es/toast/variables.scss +14 -0
- package/lib/es/tooltip/constants.d.ts +1 -1
- package/lib/es/tooltip/constants.js +2 -2
- package/lib/es/tooltip/foundation.d.ts +5 -2
- package/lib/es/tooltip/foundation.js +143 -332
- package/lib/es/tooltip/tooltip.css +7 -0
- package/lib/es/tooltip/tooltip.scss +9 -0
- package/lib/es/transfer/constants.js +1 -1
- package/lib/es/transfer/foundation.d.ts +1 -1
- package/lib/es/transfer/foundation.js +5 -62
- package/lib/es/transfer/transfer.css +4 -0
- package/lib/es/transfer/transfer.scss +7 -0
- package/lib/es/transfer/transferUtils.js +5 -21
- package/lib/es/tree/constants.js +2 -2
- package/lib/es/tree/foundation.d.ts +14 -9
- package/lib/es/tree/foundation.js +60 -176
- package/lib/es/tree/rtl.scss +19 -11
- package/lib/es/tree/tree.css +147 -65
- package/lib/es/tree/tree.scss +112 -17
- package/lib/es/tree/treeUtil.d.ts +17 -8
- package/lib/es/tree/treeUtil.js +102 -161
- package/lib/es/tree/variables.scss +3 -2
- package/lib/es/treeSelect/constants.js +3 -3
- package/lib/es/treeSelect/foundation.d.ts +26 -13
- package/lib/es/treeSelect/foundation.js +155 -235
- package/lib/es/treeSelect/treeSelect.css +55 -10
- package/lib/es/treeSelect/treeSelect.scss +76 -20
- package/lib/es/treeSelect/variables.scss +4 -2
- package/lib/es/typography/constants.d.ts +1 -0
- package/lib/es/typography/constants.js +2 -1
- package/lib/es/typography/formatNumeral.d.ts +3 -3
- package/lib/es/typography/formatNumeral.js +22 -40
- package/lib/es/typography/typography.css +135 -2
- package/lib/es/typography/typography.scss +151 -8
- package/lib/es/typography/variables.scss +52 -0
- package/lib/es/upload/constants.js +2 -2
- package/lib/es/upload/fileCardFoundation.d.ts +9 -0
- package/lib/es/upload/fileCardFoundation.js +10 -0
- package/lib/es/upload/foundation.d.ts +14 -5
- package/lib/es/upload/foundation.js +107 -240
- package/lib/es/upload/upload.css +9 -0
- package/lib/es/upload/upload.scss +8 -0
- package/lib/es/upload/utils.js +14 -28
- package/lib/es/utils/Event.js +1 -17
- package/lib/es/utils/FocusHandle.d.ts +1 -1
- package/lib/es/utils/FocusHandle.js +6 -32
- package/lib/es/utils/Logger.js +0 -20
- package/lib/es/utils/Store.js +0 -9
- package/lib/es/utils/a11y.js +18 -31
- package/lib/es/utils/array.d.ts +2 -2
- package/lib/es/utils/array.js +2 -7
- package/lib/es/utils/classnames.js +0 -10
- package/lib/es/utils/date-fns-extra.d.ts +28 -17
- package/lib/es/utils/date-fns-extra.js +78 -40
- package/lib/es/utils/dom.d.ts +1 -1
- package/lib/es/utils/dom.js +0 -9
- package/lib/es/utils/function.js +0 -1
- package/lib/es/utils/getDataAttr.js +1 -2
- package/lib/es/utils/getHighlight.js +5 -26
- package/lib/es/utils/getMotionObjFromProps.js +4 -12
- package/lib/es/utils/isBothNaN.js +0 -1
- package/lib/es/utils/isEnterPress.js +0 -2
- package/lib/es/utils/isEscPress.js +0 -2
- package/lib/es/utils/keyCode.js +0 -104
- package/lib/es/utils/log.js +0 -3
- package/lib/es/utils/object.d.ts +4 -4
- package/lib/es/utils/object.js +10 -29
- package/lib/es/utils/set.js +0 -5
- package/lib/es/utils/shallowEqualObjects.js +0 -6
- package/lib/es/utils/touchPolyfill.js +1 -6
- package/lib/es/utils/type.d.ts +3 -3
- package/lib/es/utils/uuid.js +4 -10
- package/lib/es/utils/warning.js +1 -1
- package/modal/modal.scss +10 -1
- package/modal/modalContentFoundation.ts +3 -3
- package/modal/modalFoundation.ts +32 -7
- package/modal/variables.scss +6 -1
- package/navigation/NavItem.ts +0 -2
- package/navigation/foundation.ts +1 -3
- package/navigation/itemFoundation.ts +0 -1
- package/navigation/subNavFoundation.ts +3 -2
- package/notification/notification.scss +21 -1
- package/notification/notificationFoundation.ts +3 -3
- package/notification/notificationListFoundation.ts +14 -4
- package/overflowList/constants.ts +4 -2
- package/overflowList/foundation.ts +51 -33
- package/package.json +6 -5
- package/pagination/foundation.ts +13 -3
- package/pagination/pagination.scss +29 -0
- package/pagination/variables.scss +1 -0
- package/popconfirm/popconfirm.scss +4 -16
- package/popconfirm/popconfirmFoundation.ts +20 -2
- package/popconfirm/rtl.scss +0 -13
- package/popconfirm/variables.scss +0 -4
- package/popover/constants.ts +1 -1
- package/popover/popover.scss +2 -0
- package/radio/radio.scss +6 -3
- package/radio/radioFoundation.ts +1 -1
- package/radio/radioGroupFoundation.ts +0 -1
- package/radio/radioInnerFoundation.ts +0 -1
- package/radio/variables.scss +4 -0
- package/rating/foundation.ts +0 -1
- package/select/foundation.ts +70 -32
- package/select/option.scss +1 -1
- package/select/optionFoundation.ts +0 -2
- package/select/select.scss +74 -5
- package/select/variables.scss +9 -6
- package/sideSheet/sideSheet.scss +38 -0
- package/sideSheet/sideSheetFoundation.ts +3 -2
- package/sideSheet/variables.scss +7 -0
- package/skeleton/skeleton.scss +1 -0
- package/skeleton/variables.scss +2 -2
- package/slider/constants.ts +1 -0
- package/slider/foundation.ts +25 -29
- package/slider/slider.scss +16 -1
- package/slider/variables.scss +15 -9
- package/spin/spin.scss +3 -0
- package/steps/bacisSteps.scss +10 -3
- package/steps/fillSteps.scss +7 -7
- package/steps/variables.scss +3 -3
- package/switch/foundation.ts +2 -4
- package/switch/switch.scss +13 -2
- package/table/bodyFoundation.ts +0 -1
- package/table/constants.ts +0 -3
- package/table/foundation.ts +33 -31
- package/table/rtl.scss +33 -2
- package/table/table.scss +66 -8
- package/table/tableRowFoundation.ts +0 -1
- package/table/utils.ts +23 -43
- package/table/variables.scss +6 -3
- package/tabs/foundation.ts +2 -2
- package/tabs/tabs.scss +339 -24
- package/tag/constants.ts +19 -2
- package/tag/tag.scss +43 -4
- package/tag/variables.scss +5 -0
- package/tagInput/foundation.ts +57 -3
- package/tagInput/tagInput.scss +41 -12
- package/tagInput/variables.scss +2 -0
- package/timePicker/foundation.ts +27 -18
- package/timePicker/inputFoundation.ts +0 -2
- package/timePicker/timePicker.scss +22 -1
- package/timePicker/utils/index.ts +3 -2
- package/toast/animation.scss +3 -0
- package/toast/toast.scss +43 -3
- package/toast/toastFoundation.ts +4 -6
- package/toast/toastListFoundation.ts +13 -3
- package/toast/variables.scss +14 -0
- package/tooltip/constants.ts +1 -1
- package/tooltip/foundation.ts +96 -58
- package/tooltip/tooltip.scss +9 -0
- package/transfer/foundation.ts +0 -1
- package/transfer/transfer.scss +7 -0
- package/tree/foundation.ts +38 -33
- package/tree/rtl.scss +19 -11
- package/tree/tree.scss +112 -17
- package/tree/treeUtil.ts +64 -32
- package/tree/variables.scss +3 -2
- package/treeSelect/foundation.ts +132 -70
- package/treeSelect/treeSelect.scss +76 -20
- package/treeSelect/variables.scss +4 -2
- package/typography/constants.ts +1 -0
- package/typography/formatNumeral.ts +2 -5
- package/typography/typography.scss +151 -8
- package/typography/variables.scss +52 -0
- package/upload/fileCardFoundation.ts +17 -0
- package/upload/foundation.ts +85 -10
- package/upload/upload.scss +8 -0
- package/utils/Event.ts +0 -1
- package/utils/a11y.ts +6 -6
- package/utils/array.ts +4 -4
- package/utils/date-fns-extra.ts +83 -22
- package/utils/function.ts +0 -1
- package/utils/getDataAttr.ts +1 -1
- package/utils/getMotionObjFromProps.ts +3 -2
- package/utils/object.ts +0 -3
|
@@ -4,86 +4,52 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _omit2 = _interopRequireDefault(require("lodash/omit"));
|
|
9
|
-
|
|
10
8
|
var _isEqual2 = _interopRequireDefault(require("lodash/isEqual"));
|
|
11
|
-
|
|
12
9
|
var _isString2 = _interopRequireDefault(require("lodash/isString"));
|
|
13
|
-
|
|
14
10
|
var _isNumber2 = _interopRequireDefault(require("lodash/isNumber"));
|
|
15
|
-
|
|
16
11
|
var _foundation = _interopRequireDefault(require("../base/foundation"));
|
|
17
|
-
|
|
18
12
|
var _keyCode = _interopRequireWildcard(require("../utils/keyCode"));
|
|
19
|
-
|
|
20
13
|
var _warning = _interopRequireDefault(require("../utils/warning"));
|
|
21
|
-
|
|
22
14
|
var _isNullOrUndefined = _interopRequireDefault(require("../utils/isNullOrUndefined"));
|
|
23
|
-
|
|
24
15
|
var _isEnterPress = _interopRequireDefault(require("../utils/isEnterPress"));
|
|
25
|
-
|
|
26
16
|
var _a11y = require("../utils/a11y");
|
|
27
|
-
|
|
28
17
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
29
|
-
|
|
30
18
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
31
|
-
|
|
32
19
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
33
|
-
|
|
34
20
|
var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
35
21
|
var t = {};
|
|
36
|
-
|
|
37
22
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
38
|
-
|
|
39
23
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
40
24
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
41
25
|
}
|
|
42
26
|
return t;
|
|
43
27
|
};
|
|
44
|
-
/* argus-disable unPkgSensitiveInfo */
|
|
45
|
-
|
|
46
|
-
/* eslint-disable max-len */
|
|
47
|
-
|
|
48
|
-
|
|
49
28
|
class SelectFoundation extends _foundation.default {
|
|
50
29
|
constructor(adapter) {
|
|
51
|
-
super(Object.assign({}, adapter));
|
|
52
|
-
//
|
|
53
|
-
|
|
30
|
+
super(Object.assign({}, adapter));
|
|
31
|
+
// keyboard event listner
|
|
54
32
|
this._keydownHandler = null;
|
|
55
33
|
}
|
|
56
|
-
|
|
57
34
|
init() {
|
|
58
35
|
this._setDropdownWidth();
|
|
59
|
-
|
|
60
36
|
const isDefaultOpen = this.getProp('defaultOpen');
|
|
61
37
|
const isOpen = this.getProp('open');
|
|
62
|
-
|
|
63
38
|
const originalOptions = this._collectOptions();
|
|
64
|
-
|
|
65
39
|
this._setDefaultSelection(originalOptions);
|
|
66
|
-
|
|
67
40
|
if (isDefaultOpen || isOpen) {
|
|
68
41
|
this.open(undefined, originalOptions);
|
|
69
42
|
}
|
|
70
|
-
|
|
71
43
|
const autoFocus = this.getProp('autoFocus');
|
|
72
|
-
|
|
73
44
|
if (autoFocus) {
|
|
74
45
|
this.focus();
|
|
75
46
|
}
|
|
76
47
|
}
|
|
77
|
-
|
|
78
48
|
focus() {
|
|
79
49
|
const isFilterable = this._isFilterable();
|
|
80
|
-
|
|
81
50
|
const isMultiple = this._isMultiple();
|
|
82
|
-
|
|
83
51
|
this._adapter.updateFocusState(true);
|
|
84
|
-
|
|
85
52
|
this._adapter.setIsFocusInContainer(false);
|
|
86
|
-
|
|
87
53
|
if (isFilterable && isMultiple) {
|
|
88
54
|
// when filter and multiple, only focus input
|
|
89
55
|
this.focusInput();
|
|
@@ -94,15 +60,14 @@ class SelectFoundation extends _foundation.default {
|
|
|
94
60
|
this._focusTrigger();
|
|
95
61
|
}
|
|
96
62
|
}
|
|
97
|
-
|
|
98
63
|
_focusTrigger() {
|
|
99
|
-
this._adapter.focusTrigger();
|
|
100
|
-
|
|
64
|
+
this._adapter.focusTrigger();
|
|
65
|
+
// this.bindKeyBoardEvent();
|
|
101
66
|
}
|
|
102
67
|
|
|
103
68
|
destroy() {
|
|
104
|
-
this._adapter.unregisterClickOutsideHandler();
|
|
105
|
-
|
|
69
|
+
this._adapter.unregisterClickOutsideHandler();
|
|
70
|
+
// this.unBindKeyBoardEvent();
|
|
106
71
|
}
|
|
107
72
|
|
|
108
73
|
_setDropdownWidth() {
|
|
@@ -111,7 +76,6 @@ class SelectFoundation extends _foundation.default {
|
|
|
111
76
|
dropdownMatchSelectWidth
|
|
112
77
|
} = this.getProps();
|
|
113
78
|
let width;
|
|
114
|
-
|
|
115
79
|
if (dropdownMatchSelectWidth) {
|
|
116
80
|
if (style && (0, _isNumber2.default)(style.width)) {
|
|
117
81
|
width = style.width;
|
|
@@ -120,22 +84,16 @@ class SelectFoundation extends _foundation.default {
|
|
|
120
84
|
} else {
|
|
121
85
|
width = this._adapter.getTriggerWidth();
|
|
122
86
|
}
|
|
123
|
-
|
|
124
87
|
this._adapter.setOptionWrapperWidth(width);
|
|
125
88
|
}
|
|
126
89
|
}
|
|
127
|
-
|
|
128
90
|
_collectOptions() {
|
|
129
91
|
const originalOptions = this._adapter.getOptionsFromChildren();
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
92
|
+
this._adapter.updateOptions(originalOptions);
|
|
93
|
+
// Reposition the drop-down layer
|
|
134
94
|
this._adapter.rePositionDropdown();
|
|
135
|
-
|
|
136
95
|
return originalOptions;
|
|
137
96
|
}
|
|
138
|
-
|
|
139
97
|
_setDefaultSelection(originalOptions) {
|
|
140
98
|
let {
|
|
141
99
|
value
|
|
@@ -143,135 +101,123 @@ class SelectFoundation extends _foundation.default {
|
|
|
143
101
|
const {
|
|
144
102
|
defaultValue
|
|
145
103
|
} = this.getProps();
|
|
146
|
-
|
|
147
|
-
|
|
104
|
+
if (this._isControlledComponent()) {
|
|
105
|
+
// do nothing
|
|
148
106
|
} else {
|
|
149
107
|
value = defaultValue;
|
|
150
108
|
}
|
|
151
|
-
|
|
152
109
|
this._update(value, originalOptions);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
|
|
110
|
+
}
|
|
111
|
+
// call when props.optionList change
|
|
156
112
|
handleOptionListChange() {
|
|
157
113
|
const newOptionList = this._collectOptions();
|
|
158
|
-
|
|
159
114
|
const {
|
|
160
115
|
selections
|
|
161
116
|
} = this.getStates();
|
|
162
|
-
this.updateOptionsActiveStatus(selections, newOptionList);
|
|
163
|
-
|
|
117
|
+
this.updateOptionsActiveStatus(selections, newOptionList);
|
|
118
|
+
// reset focusIndex
|
|
164
119
|
const {
|
|
165
120
|
defaultActiveFirstOption
|
|
166
121
|
} = this.getProps();
|
|
167
|
-
|
|
168
122
|
if (defaultActiveFirstOption) {
|
|
169
123
|
this._adapter.updateFocusIndex(0);
|
|
170
124
|
}
|
|
171
|
-
}
|
|
125
|
+
}
|
|
126
|
+
// In uncontrolled mode, when props.optionList change,
|
|
172
127
|
// but already had defaultValue or choose some option
|
|
173
|
-
|
|
174
|
-
|
|
175
128
|
handleOptionListChangeHadDefaultValue() {
|
|
176
129
|
const selections = this.getState('selections');
|
|
177
130
|
let value;
|
|
178
131
|
const {
|
|
179
132
|
onChangeWithObject
|
|
180
133
|
} = this.getProps();
|
|
181
|
-
|
|
182
134
|
const isMultiple = this._isMultiple();
|
|
183
|
-
|
|
184
135
|
switch (true) {
|
|
185
136
|
case isMultiple && Boolean(selections.size):
|
|
186
137
|
try {
|
|
187
|
-
value = [...selections].map(item =>
|
|
138
|
+
value = [...selections].map(item =>
|
|
139
|
+
// At this point item1 is directly the object
|
|
188
140
|
onChangeWithObject ? item[1] : item[1].value);
|
|
189
141
|
} catch (error) {
|
|
190
142
|
value = [];
|
|
191
143
|
}
|
|
192
|
-
|
|
193
144
|
break;
|
|
194
|
-
|
|
195
145
|
case isMultiple && !selections.size:
|
|
196
146
|
value = [];
|
|
197
147
|
break;
|
|
198
|
-
|
|
199
148
|
case !isMultiple && Boolean(selections.size):
|
|
200
149
|
try {
|
|
201
150
|
value = onChangeWithObject ? [...selections][0][1] : [...selections][0][1].value;
|
|
202
151
|
} catch (error) {}
|
|
203
|
-
|
|
204
152
|
break;
|
|
205
|
-
|
|
206
153
|
case !isMultiple && !selections.size:
|
|
207
154
|
break;
|
|
208
|
-
|
|
209
155
|
default:
|
|
210
156
|
break;
|
|
211
157
|
}
|
|
212
|
-
|
|
213
158
|
const originalOptions = this._adapter.getOptionsFromChildren();
|
|
214
|
-
|
|
215
159
|
this._update(value, originalOptions);
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
|
|
160
|
+
}
|
|
161
|
+
// call when props.value change
|
|
219
162
|
handleValueChange(value) {
|
|
220
163
|
const {
|
|
221
|
-
allowCreate
|
|
164
|
+
allowCreate,
|
|
165
|
+
autoClearSearchValue,
|
|
166
|
+
remote
|
|
222
167
|
} = this.getProps();
|
|
223
|
-
|
|
224
|
-
|
|
168
|
+
const {
|
|
169
|
+
inputValue
|
|
170
|
+
} = this.getStates();
|
|
171
|
+
let originalOptions;
|
|
172
|
+
// AllowCreate and controlled mode, no need to re-collect optionList
|
|
225
173
|
if (allowCreate && this._isControlledComponent()) {
|
|
226
174
|
originalOptions = this.getState('options');
|
|
227
175
|
originalOptions.forEach(item => item._show = true);
|
|
228
176
|
} else {
|
|
229
177
|
// originalOptions = this.getState('options');
|
|
230
|
-
// The options in state cannot be used directly here,
|
|
178
|
+
// The options in state cannot be used directly here,
|
|
179
|
+
// because it is possible to update the optionList and props.value at the same time, and the options in state are still old at this time
|
|
231
180
|
originalOptions = this._adapter.getOptionsFromChildren();
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
|
|
181
|
+
}
|
|
182
|
+
// Multi-selection, controlled mode, you need to reposition the drop-down menu after updating
|
|
235
183
|
this._adapter.rePositionDropdown();
|
|
236
|
-
|
|
184
|
+
if (this._isFilterable() && !autoClearSearchValue && inputValue && !remote) {
|
|
185
|
+
originalOptions = this._filterOption(originalOptions, inputValue);
|
|
186
|
+
}
|
|
237
187
|
this._update(value, originalOptions);
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
|
|
188
|
+
}
|
|
189
|
+
// Update the selected item in the selection box
|
|
241
190
|
_update(propValue, originalOptions) {
|
|
242
191
|
let selections;
|
|
243
|
-
|
|
244
192
|
if (!this._isMultiple()) {
|
|
245
193
|
// Radio
|
|
246
194
|
selections = this._updateSingle(propValue, originalOptions);
|
|
247
195
|
} else {
|
|
248
196
|
selections = this._updateMultiple(propValue, originalOptions);
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
this._adapter.updateSelection(selections);
|
|
253
|
-
|
|
254
|
-
|
|
197
|
+
this.updateOverflowItemCount(selections.size);
|
|
198
|
+
}
|
|
199
|
+
// Update the text in the selection box
|
|
200
|
+
this._adapter.updateSelection(selections);
|
|
201
|
+
// Update the selected item in the drop-down box
|
|
255
202
|
this.updateOptionsActiveStatus(selections, originalOptions);
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
|
|
203
|
+
}
|
|
204
|
+
// Optionally selected updates (when components are mounted, or after value changes)
|
|
259
205
|
_updateSingle(propValue, originalOptions) {
|
|
260
206
|
const selections = new Map();
|
|
261
207
|
const {
|
|
262
208
|
onChangeWithObject
|
|
263
|
-
} = this.getProps();
|
|
264
|
-
|
|
209
|
+
} = this.getProps();
|
|
210
|
+
// When onChangeWithObject is true, the defaultValue or Value passed by the props should be the object, which corresponds to the result returned by onChange, so the value of the object needs to be taken as a judgment comparison
|
|
265
211
|
const selectedValue = onChangeWithObject && typeof propValue !== 'undefined' ? propValue.value : propValue;
|
|
266
212
|
const selectedOptions = originalOptions.filter(option => option.value === selectedValue);
|
|
267
|
-
const noMatchOptionInList = !selectedOptions.length && typeof selectedValue !== 'undefined'
|
|
268
|
-
|
|
213
|
+
const noMatchOptionInList = !selectedOptions.length && typeof selectedValue !== 'undefined' && selectedValue !== null;
|
|
214
|
+
// If the current value, there is a matching option in the optionList
|
|
269
215
|
if (selectedOptions.length) {
|
|
270
216
|
const selectedOption = selectedOptions[0];
|
|
271
|
-
const optionExist = Object.assign({}, selectedOption);
|
|
217
|
+
const optionExist = Object.assign({}, selectedOption);
|
|
218
|
+
// if (onChangeWithObject) {
|
|
272
219
|
// OptionExist = {... propValue }; // value is the object with the'value 'Key
|
|
273
220
|
// }
|
|
274
|
-
|
|
275
221
|
selections.set(optionExist.label, optionExist);
|
|
276
222
|
} else if (noMatchOptionInList) {
|
|
277
223
|
// If the current value does not have a corresponding item in the optionList, construct an option and update it to the selection. However, it does not need to be inserted into the list
|
|
@@ -281,53 +227,45 @@ class SelectFoundation extends _foundation.default {
|
|
|
281
227
|
_notExist: true,
|
|
282
228
|
_scrollIndex: -1
|
|
283
229
|
};
|
|
284
|
-
|
|
285
230
|
if (onChangeWithObject) {
|
|
286
231
|
optionNotExist = Object.assign(Object.assign({}, propValue), {
|
|
287
232
|
_notExist: true,
|
|
288
233
|
_scrollIndex: -1
|
|
289
234
|
});
|
|
290
235
|
}
|
|
291
|
-
|
|
292
236
|
selections.set(optionNotExist.label, optionNotExist);
|
|
293
237
|
}
|
|
294
|
-
|
|
295
238
|
return selections;
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
|
|
239
|
+
}
|
|
240
|
+
// Multi-selected option update (when the component is mounted, or after the value changes)
|
|
299
241
|
_updateMultiple(propValue, originalOptions) {
|
|
300
242
|
const nowSelections = this.getState('selections');
|
|
301
|
-
let selectedOptionList = [];
|
|
302
|
-
|
|
243
|
+
let selectedOptionList = [];
|
|
244
|
+
// Multiple selection is to determine whether it is an array to avoid the problem of defaultValue/value incoming string error
|
|
303
245
|
const propValueIsArray = Array.isArray(propValue);
|
|
304
|
-
this.checkMultipleProps();
|
|
305
|
-
|
|
246
|
+
this.checkMultipleProps();
|
|
247
|
+
// If N values are currently selected, the corresponding option data is retrieved from the current selections for retrieval. Because these selected options may not exist in the new optionList
|
|
306
248
|
if (nowSelections.size) {
|
|
307
249
|
selectedOptionList = [...nowSelections].map(item => item[1]);
|
|
308
250
|
}
|
|
309
|
-
|
|
310
251
|
const selections = new Map();
|
|
311
252
|
let selectedValues = propValue;
|
|
312
253
|
const {
|
|
313
254
|
onChangeWithObject
|
|
314
|
-
} = this.getProps();
|
|
315
|
-
|
|
255
|
+
} = this.getProps();
|
|
256
|
+
// When onChangeWithObject is true
|
|
316
257
|
if (onChangeWithObject && propValueIsArray) {
|
|
317
258
|
selectedValues = propValue.map(item => item.value);
|
|
318
259
|
}
|
|
319
|
-
|
|
320
260
|
if (propValueIsArray && selectedValues.length) {
|
|
321
261
|
selectedValues.forEach((selectedValue, i) => {
|
|
322
262
|
// The current value exists in the current optionList
|
|
323
263
|
const index = originalOptions.findIndex(option => option.value === selectedValue);
|
|
324
|
-
|
|
325
264
|
if (index !== -1) {
|
|
326
265
|
selections.set(originalOptions[index].label, originalOptions[index]);
|
|
327
266
|
} else {
|
|
328
267
|
// The current value exists in the optionList that has been selected before the change, and does not exist in the current optionList, then directly take the corresponding value from the selections, no need to construct a new option
|
|
329
268
|
const indexInSelectedList = selectedOptionList.findIndex(option => option.value === selectedValue);
|
|
330
|
-
|
|
331
269
|
if (indexInSelectedList !== -1) {
|
|
332
270
|
const option = selectedOptionList[indexInSelectedList];
|
|
333
271
|
selections.set(option.label, option);
|
|
@@ -348,18 +286,14 @@ class SelectFoundation extends _foundation.default {
|
|
|
348
286
|
}
|
|
349
287
|
});
|
|
350
288
|
}
|
|
351
|
-
|
|
352
289
|
return selections;
|
|
353
290
|
}
|
|
354
|
-
|
|
355
291
|
_isMultiple() {
|
|
356
292
|
return this.getProp('multiple');
|
|
357
293
|
}
|
|
358
|
-
|
|
359
294
|
_isDisabled() {
|
|
360
295
|
return this.getProp('disabled');
|
|
361
296
|
}
|
|
362
|
-
|
|
363
297
|
_isFilterable() {
|
|
364
298
|
return Boolean(this.getProp('filter')); // filter can be boolean or function
|
|
365
299
|
}
|
|
@@ -371,14 +305,11 @@ class SelectFoundation extends _foundation.default {
|
|
|
371
305
|
const {
|
|
372
306
|
isOpen
|
|
373
307
|
} = this.getStates();
|
|
374
|
-
|
|
375
308
|
const isDisabled = this._isDisabled();
|
|
376
|
-
|
|
377
309
|
if (isDisabled) {
|
|
378
310
|
return;
|
|
379
311
|
} else if (!isOpen) {
|
|
380
312
|
this.open();
|
|
381
|
-
|
|
382
313
|
this._notifyFocus(e);
|
|
383
314
|
} else if (isOpen && clickToHide) {
|
|
384
315
|
this.close(e);
|
|
@@ -386,41 +317,31 @@ class SelectFoundation extends _foundation.default {
|
|
|
386
317
|
this.focusInput();
|
|
387
318
|
}
|
|
388
319
|
}
|
|
389
|
-
|
|
390
320
|
open(acInput, originalOptions) {
|
|
391
321
|
const isFilterable = this._isFilterable();
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
322
|
+
const options = originalOptions || this.getState('options');
|
|
323
|
+
// When searchable, when the drop-down box expands
|
|
395
324
|
if (isFilterable) {
|
|
396
325
|
// Also clears the options filter to show all candidates
|
|
397
326
|
// Options created dynamically but not selected are also filtered out
|
|
398
327
|
const sugInput = '';
|
|
399
|
-
|
|
400
328
|
const newOptions = this._filterOption(options, sugInput).filter(item => !item._inputCreateOnly);
|
|
401
|
-
|
|
402
329
|
this._adapter.updateOptions(newOptions);
|
|
403
|
-
|
|
404
330
|
this.toggle2SearchInput(true);
|
|
331
|
+
} else {
|
|
332
|
+
// whether it is a filter or not, isFocus is guaranteed to be true when open
|
|
333
|
+
this._adapter.updateFocusState(true);
|
|
405
334
|
}
|
|
406
|
-
|
|
407
335
|
this._adapter.openMenu();
|
|
408
|
-
|
|
409
336
|
this._setDropdownWidth();
|
|
410
|
-
|
|
411
337
|
this._adapter.notifyDropdownVisibleChange(true);
|
|
412
|
-
|
|
413
338
|
this.bindKeyBoardEvent();
|
|
414
|
-
|
|
415
339
|
this._adapter.registerClickOutsideHandler(e => {
|
|
416
340
|
this.close(e);
|
|
417
|
-
|
|
418
341
|
this._notifyBlur(e);
|
|
419
|
-
|
|
420
342
|
this._adapter.updateFocusState(false);
|
|
421
343
|
});
|
|
422
344
|
}
|
|
423
|
-
|
|
424
345
|
toggle2SearchInput(isShow) {
|
|
425
346
|
if (isShow) {
|
|
426
347
|
this._adapter.toggleInputShow(isShow, () => this.focusInput());
|
|
@@ -429,208 +350,164 @@ class SelectFoundation extends _foundation.default {
|
|
|
429
350
|
this._adapter.toggleInputShow(isShow, () => undefined);
|
|
430
351
|
}
|
|
431
352
|
}
|
|
432
|
-
|
|
433
353
|
close(e, closeCb) {
|
|
434
354
|
// to support A11y, closing the panel trigger does not necessarily lose focus
|
|
435
355
|
this._adapter.closeMenu();
|
|
436
|
-
|
|
437
356
|
this._adapter.notifyDropdownVisibleChange(false);
|
|
438
|
-
|
|
439
|
-
|
|
357
|
+
this._adapter.setIsFocusInContainer(false);
|
|
358
|
+
// this.unBindKeyBoardEvent();
|
|
440
359
|
// this._notifyBlur(e);
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
this._adapter.unregisterClickOutsideHandler(); // this._adapter.updateFocusState(false);
|
|
444
|
-
|
|
445
|
-
|
|
360
|
+
// this._adapter.updateFocusState(false);
|
|
361
|
+
this._adapter.unregisterClickOutsideHandler();
|
|
446
362
|
const isFilterable = this._isFilterable();
|
|
447
|
-
|
|
448
363
|
if (isFilterable) {
|
|
449
364
|
this.toggle2SearchInput(false);
|
|
450
365
|
}
|
|
451
|
-
|
|
452
366
|
this._adapter.once('popoverClose', () => {
|
|
453
367
|
if (isFilterable) {
|
|
454
|
-
this.clearInput();
|
|
368
|
+
this.clearInput(e);
|
|
455
369
|
}
|
|
456
|
-
|
|
457
370
|
if (closeCb) {
|
|
458
371
|
closeCb();
|
|
459
372
|
}
|
|
460
373
|
});
|
|
461
374
|
}
|
|
462
|
-
|
|
463
375
|
onSelect(option, optionIndex, event) {
|
|
464
376
|
const isDisabled = this._isDisabled();
|
|
465
|
-
|
|
466
377
|
if (isDisabled) {
|
|
467
378
|
return;
|
|
468
|
-
}
|
|
469
|
-
|
|
470
|
-
|
|
379
|
+
}
|
|
380
|
+
// If the allowCreate dynamically created option is selected, onCreate needs to be triggered
|
|
471
381
|
if (option._inputCreateOnly) {
|
|
472
382
|
this._adapter.notifyCreate(option);
|
|
473
383
|
}
|
|
474
|
-
|
|
475
384
|
const isMultiple = this._isMultiple();
|
|
476
|
-
|
|
477
385
|
if (!isMultiple) {
|
|
478
386
|
this._handleSingleSelect(option, event);
|
|
479
|
-
|
|
480
387
|
this._focusTrigger();
|
|
481
388
|
} else {
|
|
482
389
|
this._handleMultipleSelect(option, event);
|
|
483
390
|
}
|
|
484
|
-
|
|
485
391
|
this._adapter.updateFocusIndex(optionIndex);
|
|
486
392
|
}
|
|
487
|
-
|
|
488
393
|
_handleSingleSelect(_a, event) {
|
|
489
394
|
var {
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
395
|
+
value,
|
|
396
|
+
label
|
|
397
|
+
} = _a,
|
|
398
|
+
rest = __rest(_a, ["value", "label"]);
|
|
495
399
|
const selections = new Map().set(label, Object.assign({
|
|
496
400
|
value,
|
|
497
401
|
label
|
|
498
|
-
}, rest));
|
|
499
|
-
|
|
402
|
+
}, rest));
|
|
403
|
+
// First trigger onSelect, then trigger onChange
|
|
500
404
|
this._notifySelect(value, Object.assign({
|
|
501
405
|
value,
|
|
502
406
|
label
|
|
503
|
-
}, rest));
|
|
407
|
+
}, rest));
|
|
408
|
+
// If it is a controlled component, directly notify
|
|
504
409
|
// Make sure that the operations of updating updateOptions are done after the animation ends
|
|
505
410
|
// otherwise the content will be updated when the popup layer is not collapsed, and it looks like it will flash once when it is closed
|
|
506
|
-
|
|
507
|
-
|
|
508
411
|
if (this._isControlledComponent()) {
|
|
509
412
|
this.close(event, () => {
|
|
510
413
|
this._notifyChange(selections);
|
|
511
414
|
});
|
|
512
415
|
} else {
|
|
513
|
-
this._adapter.updateSelection(selections);
|
|
514
|
-
|
|
515
|
-
|
|
416
|
+
this._adapter.updateSelection(selections);
|
|
417
|
+
// notify user
|
|
516
418
|
this._notifyChange(selections);
|
|
517
|
-
|
|
518
419
|
this.close(event, () => {
|
|
519
420
|
// Update the selected item in the drop-down box
|
|
520
421
|
this.updateOptionsActiveStatus(selections);
|
|
521
422
|
});
|
|
522
423
|
}
|
|
523
424
|
}
|
|
524
|
-
|
|
525
425
|
_handleMultipleSelect(_a, event) {
|
|
526
426
|
var {
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
427
|
+
value,
|
|
428
|
+
label
|
|
429
|
+
} = _a,
|
|
430
|
+
rest = __rest(_a, ["value", "label"]);
|
|
532
431
|
const maxLimit = this._adapter.getMaxLimit();
|
|
533
|
-
|
|
534
432
|
const selections = this._adapter.getSelections();
|
|
535
|
-
|
|
536
433
|
const {
|
|
537
434
|
autoClearSearchValue
|
|
538
435
|
} = this.getProps();
|
|
539
|
-
|
|
540
436
|
if (selections.has(label)) {
|
|
541
437
|
this._notifyDeselect(value, Object.assign({
|
|
542
438
|
value,
|
|
543
439
|
label
|
|
544
440
|
}, rest));
|
|
545
|
-
|
|
546
441
|
selections.delete(label);
|
|
547
442
|
} else if (maxLimit && selections.size === maxLimit) {
|
|
548
443
|
this._adapter.notifyMaxLimit(Object.assign({
|
|
549
444
|
value,
|
|
550
445
|
label
|
|
551
446
|
}, (0, _omit2.default)(rest, '_scrollIndex')));
|
|
552
|
-
|
|
553
447
|
return;
|
|
554
448
|
} else {
|
|
555
449
|
this._notifySelect(value, Object.assign({
|
|
556
450
|
value,
|
|
557
451
|
label
|
|
558
452
|
}, rest));
|
|
559
|
-
|
|
560
453
|
selections.set(label, Object.assign({
|
|
561
454
|
value,
|
|
562
455
|
label
|
|
563
456
|
}, rest));
|
|
564
457
|
}
|
|
565
|
-
|
|
566
458
|
if (this._isControlledComponent()) {
|
|
567
459
|
// Controlled components, directly notified
|
|
568
460
|
this._notifyChange(selections);
|
|
569
|
-
|
|
570
461
|
if (this._isFilterable()) {
|
|
571
462
|
if (autoClearSearchValue) {
|
|
572
|
-
this.clearInput();
|
|
463
|
+
this.clearInput(event);
|
|
573
464
|
}
|
|
574
|
-
|
|
575
465
|
this.focusInput();
|
|
576
466
|
}
|
|
577
467
|
} else {
|
|
578
468
|
// Uncontrolled components, update ui
|
|
579
|
-
this._adapter.updateSelection(selections);
|
|
580
|
-
|
|
581
|
-
|
|
469
|
+
this._adapter.updateSelection(selections);
|
|
470
|
+
this.updateOverflowItemCount(selections.size);
|
|
471
|
+
// In multi-select mode, the drop-down pop-up layer is repositioned every time the value is changed, because the height selection of the selection box may have changed
|
|
582
472
|
this._adapter.rePositionDropdown();
|
|
583
|
-
|
|
584
473
|
let {
|
|
585
474
|
options
|
|
586
|
-
} = this.getStates();
|
|
587
|
-
|
|
475
|
+
} = this.getStates();
|
|
476
|
+
// Searchable filtering, when selected, resets Input
|
|
588
477
|
if (this._isFilterable()) {
|
|
589
478
|
// When filter active,if autoClearSearchValue is true,reset input after select
|
|
590
479
|
if (autoClearSearchValue) {
|
|
591
|
-
this.clearInput();
|
|
592
|
-
|
|
480
|
+
this.clearInput(event);
|
|
481
|
+
// At the same time, the filtering of options is also cleared, in order to show all candidates
|
|
593
482
|
const sugInput = '';
|
|
594
483
|
options = this._filterOption(options, sugInput);
|
|
595
484
|
}
|
|
596
|
-
|
|
597
485
|
this.focusInput();
|
|
598
486
|
}
|
|
599
|
-
|
|
600
487
|
this.updateOptionsActiveStatus(selections, options);
|
|
601
|
-
|
|
602
488
|
this._notifyChange(selections);
|
|
603
489
|
}
|
|
604
490
|
}
|
|
605
|
-
|
|
606
491
|
clearSelected() {
|
|
607
492
|
const selections = new Map();
|
|
608
|
-
|
|
609
493
|
if (this._isControlledComponent()) {
|
|
610
494
|
this._notifyChange(selections);
|
|
611
|
-
|
|
612
495
|
this._adapter.notifyClear();
|
|
613
496
|
} else {
|
|
614
497
|
this._adapter.updateSelection(selections);
|
|
615
|
-
|
|
616
498
|
this.updateOptionsActiveStatus(selections);
|
|
617
|
-
|
|
618
499
|
this._notifyChange(selections);
|
|
619
|
-
|
|
620
500
|
this._adapter.notifyClear();
|
|
621
|
-
}
|
|
622
|
-
|
|
623
|
-
|
|
501
|
+
}
|
|
502
|
+
// when call manually by ref method
|
|
624
503
|
const {
|
|
625
504
|
isOpen
|
|
626
505
|
} = this.getStates();
|
|
627
|
-
|
|
628
506
|
if (isOpen) {
|
|
629
507
|
this._adapter.rePositionDropdown();
|
|
630
508
|
}
|
|
631
|
-
}
|
|
632
|
-
|
|
633
|
-
|
|
509
|
+
}
|
|
510
|
+
// Update the selected item in the drop-down box
|
|
634
511
|
updateOptionsActiveStatus(selections) {
|
|
635
512
|
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.getState('options');
|
|
636
513
|
const {
|
|
@@ -639,7 +516,6 @@ class SelectFoundation extends _foundation.default {
|
|
|
639
516
|
const newOptions = options.map(option => {
|
|
640
517
|
if (selections.has(option.label)) {
|
|
641
518
|
option._selected = true;
|
|
642
|
-
|
|
643
519
|
if (allowCreate) {
|
|
644
520
|
delete option._inputCreateOnly;
|
|
645
521
|
}
|
|
@@ -647,49 +523,38 @@ class SelectFoundation extends _foundation.default {
|
|
|
647
523
|
if (option._inputCreateOnly) {
|
|
648
524
|
option._show = false;
|
|
649
525
|
}
|
|
650
|
-
|
|
651
526
|
option._selected = false;
|
|
652
527
|
}
|
|
653
|
-
|
|
654
528
|
return option;
|
|
655
529
|
});
|
|
656
|
-
|
|
657
530
|
this._adapter.updateOptions(newOptions);
|
|
658
531
|
}
|
|
659
|
-
|
|
660
532
|
removeTag(item) {
|
|
661
533
|
const selections = this._adapter.getSelections();
|
|
662
|
-
|
|
663
534
|
selections.delete(item.label);
|
|
664
|
-
|
|
665
535
|
if (this._isControlledComponent()) {
|
|
666
536
|
this._notifyDeselect(item.value, item);
|
|
667
|
-
|
|
668
537
|
this._notifyChange(selections);
|
|
669
538
|
} else {
|
|
670
539
|
this._notifyDeselect(item.value, item);
|
|
671
|
-
|
|
672
540
|
this._adapter.updateSelection(selections);
|
|
673
|
-
|
|
674
|
-
this.updateOptionsActiveStatus(selections);
|
|
675
|
-
|
|
541
|
+
this.updateOverflowItemCount(selections.size);
|
|
542
|
+
this.updateOptionsActiveStatus(selections);
|
|
543
|
+
// Repostion drop-down layer, because the selection may have changed the number of rows, resulting in a height change
|
|
676
544
|
this._adapter.rePositionDropdown();
|
|
677
|
-
|
|
678
545
|
this._notifyChange(selections);
|
|
679
546
|
}
|
|
680
547
|
}
|
|
681
|
-
|
|
682
|
-
clearInput() {
|
|
548
|
+
// The reason why event input is optional is that clearInput may be manually called by the user through ref
|
|
549
|
+
clearInput(event) {
|
|
683
550
|
const {
|
|
684
551
|
inputValue
|
|
685
|
-
} = this.getStates();
|
|
686
|
-
|
|
552
|
+
} = this.getStates();
|
|
553
|
+
// only when input is not null, select should notifySearch and updateOptions
|
|
687
554
|
if (inputValue !== '') {
|
|
688
555
|
this._adapter.updateInputValue('');
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
556
|
+
this._adapter.notifySearch('', event);
|
|
557
|
+
// reset options filter
|
|
693
558
|
const {
|
|
694
559
|
options
|
|
695
560
|
} = this.getStates();
|
|
@@ -697,27 +562,20 @@ class SelectFoundation extends _foundation.default {
|
|
|
697
562
|
remote
|
|
698
563
|
} = this.getProps();
|
|
699
564
|
let optionsAfterFilter = options;
|
|
700
|
-
|
|
701
565
|
if (!remote) {
|
|
702
566
|
optionsAfterFilter = this._filterOption(options, '');
|
|
703
567
|
}
|
|
704
|
-
|
|
705
568
|
this._adapter.updateOptions(optionsAfterFilter);
|
|
706
569
|
}
|
|
707
570
|
}
|
|
708
|
-
|
|
709
571
|
focusInput() {
|
|
710
572
|
this._adapter.focusInput();
|
|
711
|
-
|
|
712
573
|
this._adapter.updateFocusState(true);
|
|
713
|
-
|
|
714
574
|
this._adapter.setIsFocusInContainer(false);
|
|
715
575
|
}
|
|
716
|
-
|
|
717
|
-
handleInputChange(sugInput) {
|
|
576
|
+
handleInputChange(sugInput, event) {
|
|
718
577
|
// Input is a controlled component, so the value needs to be updated
|
|
719
578
|
this._adapter.updateInputValue(sugInput);
|
|
720
|
-
|
|
721
579
|
const {
|
|
722
580
|
options,
|
|
723
581
|
isOpen
|
|
@@ -727,28 +585,21 @@ class SelectFoundation extends _foundation.default {
|
|
|
727
585
|
remote
|
|
728
586
|
} = this.getProps();
|
|
729
587
|
let optionsAfterFilter = options;
|
|
730
|
-
|
|
731
588
|
if (!remote) {
|
|
732
589
|
// Filter options based on input
|
|
733
590
|
optionsAfterFilter = this._filterOption(options, sugInput);
|
|
734
|
-
}
|
|
735
|
-
|
|
736
|
-
|
|
591
|
+
}
|
|
592
|
+
// When allowClear is true, an entry can be created. You need to include the current input as a new Option input
|
|
737
593
|
optionsAfterFilter = this._createOptionByInput(allowCreate, optionsAfterFilter, sugInput);
|
|
738
|
-
|
|
739
594
|
this._adapter.updateOptions(optionsAfterFilter);
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
595
|
+
this._adapter.notifySearch(sugInput, event);
|
|
596
|
+
// In multi-select mode, the drop-down box is repositioned each time you enter, because it may cause a line break as the input changes
|
|
744
597
|
if (this._isMultiple()) {
|
|
745
598
|
this._adapter.rePositionDropdown();
|
|
746
599
|
}
|
|
747
600
|
}
|
|
748
|
-
|
|
749
601
|
_filterOption(originalOptions, sugInput) {
|
|
750
602
|
const filter = this.getProp('filter');
|
|
751
|
-
|
|
752
603
|
if (!filter) {
|
|
753
604
|
// 1. No filtering
|
|
754
605
|
return originalOptions;
|
|
@@ -760,13 +611,11 @@ class SelectFoundation extends _foundation.default {
|
|
|
760
611
|
const groupLabel = option._parentGroup && option._parentGroup.label;
|
|
761
612
|
const matchOption = label.includes(input);
|
|
762
613
|
const matchGroup = (0, _isString2.default)(groupLabel) && groupLabel.toLowerCase().includes(input);
|
|
763
|
-
|
|
764
614
|
if (matchOption || matchGroup) {
|
|
765
615
|
option._show = true;
|
|
766
616
|
} else {
|
|
767
617
|
option._show = false;
|
|
768
618
|
}
|
|
769
|
-
|
|
770
619
|
return option;
|
|
771
620
|
});
|
|
772
621
|
} else if (typeof filter === 'function') {
|
|
@@ -776,10 +625,8 @@ class SelectFoundation extends _foundation.default {
|
|
|
776
625
|
return option;
|
|
777
626
|
});
|
|
778
627
|
}
|
|
779
|
-
|
|
780
628
|
return undefined;
|
|
781
629
|
}
|
|
782
|
-
|
|
783
630
|
_createOptionByInput(allowCreate, optionsAfterFilter, sugInput) {
|
|
784
631
|
if (allowCreate) {
|
|
785
632
|
if (sugInput) {
|
|
@@ -797,13 +644,11 @@ class SelectFoundation extends _foundation.default {
|
|
|
797
644
|
optionsAfterFilter.forEach((option, index) => {
|
|
798
645
|
if (!option._show && !option._inputCreateOnly) {
|
|
799
646
|
return;
|
|
800
|
-
}
|
|
801
|
-
|
|
802
|
-
|
|
647
|
+
}
|
|
648
|
+
// The matching algorithm is not necessarily through labels?
|
|
803
649
|
if (option.label === sugInput) {
|
|
804
650
|
matchOptionIndex = index;
|
|
805
651
|
}
|
|
806
|
-
|
|
807
652
|
if (option._inputCreateOnly) {
|
|
808
653
|
createOptionIndex = index;
|
|
809
654
|
option.value = sugInput;
|
|
@@ -811,11 +656,9 @@ class SelectFoundation extends _foundation.default {
|
|
|
811
656
|
option._show = true;
|
|
812
657
|
}
|
|
813
658
|
});
|
|
814
|
-
|
|
815
659
|
if (createOptionIndex === -1 && matchOptionIndex === -1) {
|
|
816
660
|
optionsAfterFilter.push(newOptionByInput);
|
|
817
661
|
}
|
|
818
|
-
|
|
819
662
|
if (matchOptionIndex !== -1) {
|
|
820
663
|
optionsAfterFilter = optionsAfterFilter.filter(item => !item._inputCreateOnly);
|
|
821
664
|
}
|
|
@@ -823,26 +666,21 @@ class SelectFoundation extends _foundation.default {
|
|
|
823
666
|
// Delete input unselected items
|
|
824
667
|
optionsAfterFilter = optionsAfterFilter.filter(item => !item._inputCreateOnly);
|
|
825
668
|
}
|
|
826
|
-
}
|
|
827
|
-
|
|
828
|
-
|
|
669
|
+
}
|
|
670
|
+
// TODO Promise supports asynchronous creation
|
|
829
671
|
return optionsAfterFilter;
|
|
830
672
|
}
|
|
831
|
-
|
|
832
673
|
bindKeyBoardEvent() {
|
|
833
674
|
this._keydownHandler = event => {
|
|
834
675
|
this._handleKeyDown(event);
|
|
835
676
|
};
|
|
836
|
-
|
|
837
677
|
this._adapter.registerKeyDown(this._keydownHandler);
|
|
838
678
|
}
|
|
839
|
-
|
|
840
679
|
unBindKeyBoardEvent() {
|
|
841
680
|
if (this._keydownHandler) {
|
|
842
681
|
this._adapter.unregisterKeyDown();
|
|
843
682
|
}
|
|
844
683
|
}
|
|
845
|
-
|
|
846
684
|
_handleKeyDown(event) {
|
|
847
685
|
const key = event.keyCode;
|
|
848
686
|
const {
|
|
@@ -854,157 +692,117 @@ class SelectFoundation extends _foundation.default {
|
|
|
854
692
|
const {
|
|
855
693
|
isOpen
|
|
856
694
|
} = this.getStates();
|
|
857
|
-
|
|
858
695
|
if (loading || disabled) {
|
|
859
696
|
return;
|
|
860
697
|
}
|
|
861
|
-
|
|
862
698
|
switch (key) {
|
|
863
699
|
case _keyCode.default.UP:
|
|
864
700
|
// Prevent Input's cursor from following
|
|
865
701
|
// Prevent Input cursor from following
|
|
866
702
|
event.preventDefault();
|
|
867
|
-
|
|
868
703
|
this._handleArrowKeyDown(-1);
|
|
869
|
-
|
|
870
704
|
break;
|
|
871
|
-
|
|
872
705
|
case _keyCode.default.DOWN:
|
|
873
706
|
// Prevent Input's cursor from following
|
|
874
707
|
// Prevent Input cursor from following
|
|
875
708
|
event.preventDefault();
|
|
876
|
-
|
|
877
709
|
this._handleArrowKeyDown(1);
|
|
878
|
-
|
|
879
710
|
break;
|
|
880
|
-
|
|
881
711
|
case _keyCode.default.BACKSPACE:
|
|
882
712
|
this._handleBackspaceKeyDown();
|
|
883
|
-
|
|
884
713
|
break;
|
|
885
|
-
|
|
886
714
|
case _keyCode.default.ENTER:
|
|
887
715
|
// internal-issues:302
|
|
888
716
|
// prevent trigger form’s submit when use in form
|
|
889
717
|
(0, _a11y.handlePrevent)(event);
|
|
890
|
-
|
|
891
718
|
this._handleEnterKeyDown(event);
|
|
892
|
-
|
|
893
719
|
break;
|
|
894
|
-
|
|
895
720
|
case _keyCode.default.ESC:
|
|
896
721
|
isOpen && this.close(event);
|
|
897
722
|
filter && !multiple && this._focusTrigger();
|
|
898
723
|
break;
|
|
899
|
-
|
|
900
724
|
case _keyCode.default.TAB:
|
|
901
725
|
// check if slot have focusable element
|
|
902
726
|
this._handleTabKeyDown(event);
|
|
903
|
-
|
|
904
727
|
break;
|
|
905
|
-
|
|
906
728
|
default:
|
|
907
729
|
break;
|
|
908
730
|
}
|
|
909
731
|
}
|
|
910
|
-
|
|
911
732
|
handleContainerKeyDown(event) {
|
|
912
733
|
// when focus in contanier, handle the key down
|
|
913
734
|
const key = event.keyCode;
|
|
914
735
|
const {
|
|
915
736
|
isOpen
|
|
916
737
|
} = this.getStates();
|
|
917
|
-
|
|
918
738
|
switch (key) {
|
|
919
739
|
case _keyCode.default.TAB:
|
|
920
740
|
isOpen && this._handleTabKeyDown(event);
|
|
921
741
|
break;
|
|
922
|
-
|
|
923
742
|
default:
|
|
924
743
|
break;
|
|
925
744
|
}
|
|
926
745
|
}
|
|
927
|
-
|
|
928
746
|
_getEnableFocusIndex(offset) {
|
|
929
747
|
const {
|
|
930
748
|
focusIndex,
|
|
931
749
|
options
|
|
932
750
|
} = this.getStates();
|
|
933
|
-
const visibleOptions = options.filter(item => item._show);
|
|
934
|
-
|
|
751
|
+
const visibleOptions = options.filter(item => item._show);
|
|
752
|
+
// let visibleOptions = options;
|
|
935
753
|
const optionsLength = visibleOptions.length;
|
|
936
754
|
let index = focusIndex + offset;
|
|
937
|
-
|
|
938
755
|
if (index < 0) {
|
|
939
756
|
index = optionsLength - 1;
|
|
940
757
|
}
|
|
941
|
-
|
|
942
758
|
if (index >= optionsLength) {
|
|
943
759
|
index = 0;
|
|
944
|
-
}
|
|
945
|
-
|
|
946
|
-
|
|
760
|
+
}
|
|
761
|
+
// avoid newIndex option is disabled
|
|
947
762
|
if (offset > 0) {
|
|
948
763
|
let nearestActiveOption = -1;
|
|
949
|
-
|
|
950
764
|
for (let i = 0; i < visibleOptions.length; i++) {
|
|
951
765
|
const optionIsActive = !visibleOptions[i].disabled;
|
|
952
|
-
|
|
953
766
|
if (optionIsActive) {
|
|
954
767
|
nearestActiveOption = i;
|
|
955
768
|
}
|
|
956
|
-
|
|
957
769
|
if (nearestActiveOption >= index) {
|
|
958
770
|
break;
|
|
959
771
|
}
|
|
960
772
|
}
|
|
961
|
-
|
|
962
773
|
index = nearestActiveOption;
|
|
963
774
|
} else {
|
|
964
775
|
let nearestActiveOption = visibleOptions.length;
|
|
965
|
-
|
|
966
776
|
for (let i = optionsLength - 1; i >= 0; i--) {
|
|
967
777
|
const optionIsActive = !visibleOptions[i].disabled;
|
|
968
|
-
|
|
969
778
|
if (optionIsActive) {
|
|
970
779
|
nearestActiveOption = i;
|
|
971
780
|
}
|
|
972
|
-
|
|
973
781
|
if (nearestActiveOption <= index) {
|
|
974
782
|
break;
|
|
975
783
|
}
|
|
976
784
|
}
|
|
977
|
-
|
|
978
785
|
index = nearestActiveOption;
|
|
979
|
-
}
|
|
980
|
-
|
|
981
|
-
|
|
786
|
+
}
|
|
787
|
+
// console.log('new:' + index);
|
|
982
788
|
this._adapter.updateFocusIndex(index);
|
|
983
|
-
|
|
984
789
|
this._adapter.updateScrollTop(index);
|
|
985
790
|
}
|
|
986
|
-
|
|
987
791
|
_handleArrowKeyDown(offset) {
|
|
988
792
|
const {
|
|
989
793
|
isOpen
|
|
990
794
|
} = this.getStates();
|
|
991
795
|
isOpen ? this._getEnableFocusIndex(offset) : this.open();
|
|
992
796
|
}
|
|
993
|
-
|
|
994
797
|
_handleTabKeyDown(event) {
|
|
995
798
|
const {
|
|
996
799
|
isOpen
|
|
997
800
|
} = this.getStates();
|
|
998
|
-
|
|
999
801
|
this._adapter.updateFocusState(false);
|
|
1000
|
-
|
|
1001
802
|
if (isOpen) {
|
|
1002
803
|
const container = this._adapter.getContainer();
|
|
1003
|
-
|
|
1004
804
|
const focusableElements = this._adapter.getFocusableElements(container);
|
|
1005
|
-
|
|
1006
805
|
const focusableNum = focusableElements.length;
|
|
1007
|
-
|
|
1008
806
|
if (focusableNum > 0) {
|
|
1009
807
|
// Shift + Tab will move focus backward
|
|
1010
808
|
if (event.shiftKey) {
|
|
@@ -1014,8 +812,7 @@ class SelectFoundation extends _foundation.default {
|
|
|
1014
812
|
}
|
|
1015
813
|
} else {
|
|
1016
814
|
// there are no focusable elements inside the container, tab to next element and trigger blur
|
|
1017
|
-
this.close();
|
|
1018
|
-
|
|
815
|
+
this.close(event);
|
|
1019
816
|
this._notifyBlur(event);
|
|
1020
817
|
}
|
|
1021
818
|
} else {
|
|
@@ -1023,55 +820,41 @@ class SelectFoundation extends _foundation.default {
|
|
|
1023
820
|
this._notifyBlur(event);
|
|
1024
821
|
}
|
|
1025
822
|
}
|
|
1026
|
-
|
|
1027
823
|
_handlePanelOpenTabKeyDown(focusableElements, event) {
|
|
1028
824
|
const activeElement = this._adapter.getActiveElement();
|
|
1029
|
-
|
|
1030
825
|
const isFocusInContainer = this._adapter.getIsFocusInContainer();
|
|
1031
|
-
|
|
1032
826
|
if (!isFocusInContainer) {
|
|
1033
827
|
// focus in trigger, set next focus to the first element in container
|
|
1034
828
|
focusableElements[0].focus();
|
|
1035
|
-
|
|
1036
829
|
this._adapter.setIsFocusInContainer(true);
|
|
1037
|
-
|
|
1038
830
|
(0, _a11y.handlePrevent)(event);
|
|
1039
831
|
} else if (activeElement === focusableElements[focusableElements.length - 1]) {
|
|
1040
832
|
// focus in the last element in container, focus back to trigger and close panel
|
|
1041
833
|
this._focusTrigger();
|
|
1042
|
-
|
|
1043
|
-
this.close();
|
|
834
|
+
this.close(event);
|
|
1044
835
|
(0, _a11y.handlePrevent)(event);
|
|
1045
836
|
}
|
|
1046
837
|
}
|
|
1047
|
-
|
|
1048
838
|
_handlePanelOpenShiftTabKeyDown(focusableElements, event) {
|
|
1049
839
|
const activeElement = this._adapter.getActiveElement();
|
|
1050
|
-
|
|
1051
840
|
const isFocusInContainer = this._adapter.getIsFocusInContainer();
|
|
1052
|
-
|
|
1053
841
|
if (!isFocusInContainer) {
|
|
1054
842
|
// focus in trigger, close the panel, shift tab to previe element and trigger blur
|
|
1055
|
-
this.close();
|
|
1056
|
-
|
|
843
|
+
this.close(event);
|
|
1057
844
|
this._notifyBlur(event);
|
|
1058
845
|
} else if (activeElement === focusableElements[0]) {
|
|
1059
846
|
// focus in the first element in container, focus back to trigger
|
|
1060
847
|
this._focusTrigger();
|
|
1061
|
-
|
|
1062
848
|
this._adapter.setIsFocusInContainer(false);
|
|
1063
|
-
|
|
1064
849
|
(0, _a11y.handlePrevent)(event);
|
|
1065
850
|
}
|
|
1066
851
|
}
|
|
1067
|
-
|
|
1068
852
|
_handleEnterKeyDown(event) {
|
|
1069
853
|
const {
|
|
1070
854
|
isOpen,
|
|
1071
855
|
options,
|
|
1072
856
|
focusIndex
|
|
1073
857
|
} = this.getStates();
|
|
1074
|
-
|
|
1075
858
|
if (!isOpen) {
|
|
1076
859
|
this.open();
|
|
1077
860
|
} else {
|
|
@@ -1079,64 +862,54 @@ class SelectFoundation extends _foundation.default {
|
|
|
1079
862
|
const visibleOptions = options.filter(item => item._show);
|
|
1080
863
|
const {
|
|
1081
864
|
length
|
|
1082
|
-
} = visibleOptions;
|
|
1083
|
-
|
|
865
|
+
} = visibleOptions;
|
|
866
|
+
// fix issue 1201
|
|
1084
867
|
if (length <= focusIndex) {
|
|
1085
868
|
return;
|
|
1086
869
|
}
|
|
1087
|
-
|
|
1088
870
|
if (visibleOptions && length) {
|
|
1089
871
|
const selectedOption = visibleOptions[focusIndex];
|
|
1090
|
-
|
|
1091
872
|
if (selectedOption.disabled) {
|
|
1092
873
|
return;
|
|
1093
874
|
}
|
|
1094
|
-
|
|
1095
875
|
this.onSelect(selectedOption, focusIndex, event);
|
|
1096
876
|
}
|
|
1097
877
|
} else {
|
|
1098
|
-
this.close();
|
|
878
|
+
this.close(event);
|
|
1099
879
|
}
|
|
1100
880
|
}
|
|
1101
881
|
}
|
|
1102
|
-
|
|
1103
882
|
_handleBackspaceKeyDown() {
|
|
1104
883
|
if (this._isMultiple()) {
|
|
1105
884
|
const selections = this._adapter.getSelections();
|
|
1106
|
-
|
|
1107
885
|
const {
|
|
1108
886
|
inputValue
|
|
1109
887
|
} = this.getStates();
|
|
1110
888
|
const length = selections.size;
|
|
1111
|
-
|
|
1112
889
|
if (length && !inputValue) {
|
|
1113
890
|
const keys = [...selections.keys()];
|
|
1114
891
|
let index = length - 1;
|
|
1115
892
|
let targetLabel = keys[index];
|
|
1116
893
|
let targetItem = selections.get(targetLabel);
|
|
1117
|
-
let isAllDisabled = false;
|
|
1118
|
-
|
|
894
|
+
let isAllDisabled = false;
|
|
895
|
+
// can skip disabled item when remove trigger by backspace
|
|
1119
896
|
if (targetItem.disabled && index === 0) {
|
|
1120
897
|
return;
|
|
1121
898
|
}
|
|
1122
|
-
|
|
1123
899
|
while (targetItem.disabled && index !== 0) {
|
|
1124
900
|
index = index - 1;
|
|
1125
901
|
targetLabel = keys[index];
|
|
1126
|
-
targetItem = selections.get(targetLabel);
|
|
1127
|
-
|
|
902
|
+
targetItem = selections.get(targetLabel);
|
|
1128
903
|
if (index == 0 && targetItem.disabled) {
|
|
1129
904
|
isAllDisabled = true;
|
|
1130
905
|
}
|
|
1131
906
|
}
|
|
1132
|
-
|
|
1133
907
|
if (!isAllDisabled) {
|
|
1134
908
|
this.removeTag(targetItem);
|
|
1135
909
|
}
|
|
1136
910
|
}
|
|
1137
911
|
}
|
|
1138
912
|
}
|
|
1139
|
-
|
|
1140
913
|
_notifyChange(selections) {
|
|
1141
914
|
const {
|
|
1142
915
|
onChangeWithObject
|
|
@@ -1144,88 +917,65 @@ class SelectFoundation extends _foundation.default {
|
|
|
1144
917
|
const stateSelections = this.getState('selections');
|
|
1145
918
|
let notifyVal;
|
|
1146
919
|
const selectionsProps = [...selections.values()];
|
|
1147
|
-
|
|
1148
920
|
const isMultiple = this._isMultiple();
|
|
1149
|
-
|
|
1150
921
|
const hasChange = this._diffSelections(selections, stateSelections, isMultiple);
|
|
1151
|
-
|
|
1152
922
|
if (!hasChange) {
|
|
1153
923
|
return;
|
|
1154
924
|
}
|
|
1155
|
-
|
|
1156
925
|
switch (true) {
|
|
1157
926
|
case onChangeWithObject:
|
|
1158
927
|
this._notifyChangeWithObject(selections);
|
|
1159
|
-
|
|
1160
928
|
break;
|
|
1161
|
-
|
|
1162
929
|
case !onChangeWithObject && !isMultiple:
|
|
1163
930
|
notifyVal = selectionsProps.length ? selectionsProps[0].value : undefined;
|
|
1164
|
-
|
|
1165
931
|
this._adapter.notifyChange(notifyVal);
|
|
1166
|
-
|
|
1167
932
|
break;
|
|
1168
|
-
|
|
1169
933
|
case !onChangeWithObject && isMultiple:
|
|
1170
934
|
notifyVal = selectionsProps.length ? selectionsProps.map(props => props.value) : [];
|
|
1171
|
-
|
|
1172
935
|
this._adapter.notifyChange(notifyVal);
|
|
1173
|
-
|
|
1174
936
|
break;
|
|
1175
|
-
|
|
1176
937
|
default:
|
|
1177
938
|
break;
|
|
1178
939
|
}
|
|
1179
940
|
}
|
|
1180
|
-
|
|
1181
941
|
_removeInternalKey(option) {
|
|
1182
|
-
// eslint-disable-next-line
|
|
1183
942
|
let newOption = Object.assign({}, option);
|
|
1184
943
|
delete newOption._parentGroup;
|
|
1185
944
|
delete newOption._show;
|
|
1186
945
|
delete newOption._selected;
|
|
1187
946
|
delete newOption._scrollIndex;
|
|
1188
|
-
|
|
947
|
+
delete newOption._keyInJsx;
|
|
1189
948
|
if ('_keyInOptionList' in newOption) {
|
|
1190
949
|
newOption.key = newOption._keyInOptionList;
|
|
1191
950
|
delete newOption._keyInOptionList;
|
|
1192
951
|
}
|
|
1193
|
-
|
|
1194
952
|
return newOption;
|
|
1195
953
|
}
|
|
1196
|
-
|
|
1197
954
|
_notifySelect(value, option) {
|
|
1198
955
|
const newOption = this._removeInternalKey(option);
|
|
1199
|
-
|
|
1200
956
|
this._adapter.notifySelect(value, newOption);
|
|
1201
957
|
}
|
|
1202
|
-
|
|
1203
958
|
_notifyDeselect(value, option) {
|
|
1204
959
|
const newOption = this._removeInternalKey(option);
|
|
1205
|
-
|
|
1206
960
|
this._adapter.notifyDeselect(value, newOption);
|
|
1207
961
|
}
|
|
1208
|
-
|
|
1209
962
|
_diffSelections(selections, oldSelections, isMultiple) {
|
|
1210
963
|
let diff = true;
|
|
1211
|
-
|
|
1212
964
|
if (!isMultiple) {
|
|
1213
965
|
const selectionProps = [...selections.values()];
|
|
1214
966
|
const oldSelectionProps = [...oldSelections.values()];
|
|
1215
967
|
const optionLabel = selectionProps[0] ? selectionProps[0].label : selectionProps[0];
|
|
1216
968
|
const oldOptionLabel = oldSelectionProps[0] ? oldSelectionProps[0].label : oldSelectionProps[0];
|
|
1217
969
|
diff = !(0, _isEqual2.default)(optionLabel, oldOptionLabel);
|
|
1218
|
-
} else {
|
|
970
|
+
} else {
|
|
971
|
+
// When multiple selection, there is no scene where the value is different between the two operations
|
|
1219
972
|
}
|
|
1220
|
-
|
|
1221
973
|
return diff;
|
|
1222
|
-
}
|
|
1223
|
-
|
|
1224
|
-
|
|
974
|
+
}
|
|
975
|
+
// When onChangeWithObject is true, the onChange input parameter is not only value, but also label and other parameters
|
|
1225
976
|
_notifyChangeWithObject(selections) {
|
|
1226
977
|
const stateSelections = this.getState('selections');
|
|
1227
978
|
const values = [];
|
|
1228
|
-
|
|
1229
979
|
for (const item of selections.entries()) {
|
|
1230
980
|
let val = Object.assign({
|
|
1231
981
|
label: item[0]
|
|
@@ -1233,88 +983,70 @@ class SelectFoundation extends _foundation.default {
|
|
|
1233
983
|
val = this._removeInternalKey(val);
|
|
1234
984
|
values.push(val);
|
|
1235
985
|
}
|
|
1236
|
-
|
|
1237
986
|
if (!this._isMultiple()) {
|
|
1238
987
|
this._adapter.notifyChange(values[0]);
|
|
1239
988
|
} else {
|
|
1240
989
|
this._adapter.notifyChange(values);
|
|
1241
990
|
}
|
|
1242
|
-
}
|
|
991
|
+
}
|
|
992
|
+
// Scenes that may trigger blur:
|
|
1243
993
|
// 1、clickOutSide
|
|
1244
994
|
// 2、 tab to next element/ shift tab to previous element
|
|
1245
995
|
// 3、[remove when add a11y] click option / press enter, and then select complete(when multiple is false
|
|
1246
996
|
// 4、[remove when add a11y] press esc when dropdown list open
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
997
|
_notifyBlur(e) {
|
|
1250
998
|
this._adapter.notifyBlur(e);
|
|
1251
|
-
}
|
|
999
|
+
}
|
|
1000
|
+
// Scenes that may trigger focus:
|
|
1252
1001
|
// 1、click selection
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
1002
|
_notifyFocus(e) {
|
|
1256
1003
|
this._adapter.notifyFocus(e);
|
|
1257
1004
|
}
|
|
1258
|
-
|
|
1259
1005
|
handleMouseEnter(e) {
|
|
1260
1006
|
this._adapter.updateHovering(true);
|
|
1261
|
-
|
|
1262
1007
|
this._adapter.notifyMouseEnter(e);
|
|
1263
1008
|
}
|
|
1264
|
-
|
|
1265
1009
|
handleMouseLeave(e) {
|
|
1266
1010
|
this._adapter.updateHovering(false);
|
|
1267
|
-
|
|
1268
1011
|
this._adapter.notifyMouseLeave(e);
|
|
1269
1012
|
}
|
|
1270
|
-
|
|
1271
1013
|
handleClearClick(e) {
|
|
1272
1014
|
const {
|
|
1273
1015
|
filter
|
|
1274
1016
|
} = this.getProps();
|
|
1275
|
-
|
|
1276
1017
|
if (filter) {
|
|
1277
|
-
this.clearInput();
|
|
1018
|
+
this.clearInput(e);
|
|
1278
1019
|
}
|
|
1279
|
-
|
|
1280
|
-
this.
|
|
1281
|
-
|
|
1020
|
+
// after click showClear button, the select need to be focused
|
|
1021
|
+
this.focus();
|
|
1022
|
+
this.clearSelected();
|
|
1023
|
+
// prevent this click open dropdown
|
|
1282
1024
|
e.stopPropagation();
|
|
1283
1025
|
}
|
|
1284
|
-
|
|
1285
1026
|
handleKeyPress(e) {
|
|
1286
1027
|
if (e && e.key === _keyCode.ENTER_KEY) {
|
|
1287
1028
|
this.handleClick(e);
|
|
1288
1029
|
}
|
|
1289
1030
|
}
|
|
1290
1031
|
/* istanbul ignore next */
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
1032
|
handleClearBtnEnterPress(e) {
|
|
1294
1033
|
if ((0, _isEnterPress.default)(e)) {
|
|
1295
1034
|
this.handleClearClick(e);
|
|
1296
1035
|
}
|
|
1297
1036
|
}
|
|
1298
|
-
|
|
1299
1037
|
handleOptionMouseEnter(optionIndex) {
|
|
1300
1038
|
this._adapter.updateFocusIndex(optionIndex);
|
|
1301
1039
|
}
|
|
1302
|
-
|
|
1303
1040
|
handleListScroll(e) {
|
|
1304
1041
|
this._adapter.notifyListScroll(e);
|
|
1305
1042
|
}
|
|
1306
|
-
|
|
1307
1043
|
handleTriggerFocus(e) {
|
|
1308
1044
|
this.bindKeyBoardEvent();
|
|
1309
|
-
|
|
1310
|
-
this._adapter.updateFocusState(true);
|
|
1311
|
-
|
|
1045
|
+
// close the tag in multiple select did not trigger select focus, but trigger TriggerFocus, so not need to updateFocusState in this function
|
|
1046
|
+
// this._adapter.updateFocusState(true);
|
|
1312
1047
|
this._adapter.setIsFocusInContainer(false);
|
|
1313
1048
|
}
|
|
1314
|
-
|
|
1315
1049
|
handleTriggerBlur(e) {
|
|
1316
|
-
this._adapter.updateFocusState(false);
|
|
1317
|
-
|
|
1318
1050
|
const {
|
|
1319
1051
|
filter,
|
|
1320
1052
|
autoFocus
|
|
@@ -1322,28 +1054,25 @@ class SelectFoundation extends _foundation.default {
|
|
|
1322
1054
|
const {
|
|
1323
1055
|
isOpen,
|
|
1324
1056
|
isFocus
|
|
1325
|
-
} = this.getStates();
|
|
1057
|
+
} = this.getStates();
|
|
1058
|
+
// Under normal circumstances, blur will be accompanied by clickOutsideHandler, so the notify of blur can be called uniformly in clickOutsideHandler
|
|
1326
1059
|
// But when autoFocus or the panel is close, because clickOutsideHandler is not register or unregister, you need to listen for the trigger's blur and trigger the notify callback
|
|
1327
|
-
|
|
1328
1060
|
if (isFocus && !isOpen) {
|
|
1329
1061
|
this._notifyBlur(e);
|
|
1062
|
+
this._adapter.updateFocusState(false);
|
|
1330
1063
|
}
|
|
1331
1064
|
}
|
|
1332
|
-
|
|
1333
1065
|
handleInputBlur(e) {
|
|
1334
1066
|
const {
|
|
1335
1067
|
filter,
|
|
1336
1068
|
autoFocus
|
|
1337
1069
|
} = this.getProps();
|
|
1338
|
-
|
|
1339
1070
|
const isMultiple = this._isMultiple();
|
|
1340
|
-
|
|
1341
1071
|
if (autoFocus && filter && !isMultiple) {
|
|
1342
1072
|
// under this condition, when input blur, hide the input
|
|
1343
1073
|
this.toggle2SearchInput(false);
|
|
1344
1074
|
}
|
|
1345
1075
|
}
|
|
1346
|
-
|
|
1347
1076
|
selectAll() {
|
|
1348
1077
|
const {
|
|
1349
1078
|
options
|
|
@@ -1352,22 +1081,18 @@ class SelectFoundation extends _foundation.default {
|
|
|
1352
1081
|
onChangeWithObject
|
|
1353
1082
|
} = this.getProps();
|
|
1354
1083
|
let selectedValues = [];
|
|
1355
|
-
|
|
1356
1084
|
const isMultiple = this._isMultiple();
|
|
1357
|
-
|
|
1358
1085
|
if (!isMultiple) {
|
|
1359
|
-
console.warn(
|
|
1086
|
+
console.warn(`[Semi Select]: It seems that you have called the selectAll method in the single-selection Select.
|
|
1087
|
+
Please note that this is not a legal way to use it`);
|
|
1360
1088
|
return;
|
|
1361
1089
|
}
|
|
1362
|
-
|
|
1363
1090
|
if (onChangeWithObject) {
|
|
1364
1091
|
selectedValues = options;
|
|
1365
1092
|
} else {
|
|
1366
1093
|
selectedValues = options.map(option => option.value);
|
|
1367
1094
|
}
|
|
1368
|
-
|
|
1369
1095
|
this.handleValueChange(selectedValues);
|
|
1370
|
-
|
|
1371
1096
|
this._adapter.notifyChange(selectedValues);
|
|
1372
1097
|
}
|
|
1373
1098
|
/**
|
|
@@ -1375,8 +1100,6 @@ class SelectFoundation extends _foundation.default {
|
|
|
1375
1100
|
* -defaultValue/value in multiple selection mode is array
|
|
1376
1101
|
* @param {Object} props
|
|
1377
1102
|
*/
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
1103
|
checkMultipleProps(props) {
|
|
1381
1104
|
if (this._isMultiple()) {
|
|
1382
1105
|
const currentProps = props ? props : this.getProps();
|
|
@@ -1385,34 +1108,49 @@ class SelectFoundation extends _foundation.default {
|
|
|
1385
1108
|
value
|
|
1386
1109
|
} = currentProps;
|
|
1387
1110
|
const selectedValues = value || defaultValue;
|
|
1388
|
-
|
|
1389
1111
|
if (!(0, _isNullOrUndefined.default)(selectedValues) && !Array.isArray(selectedValues)) {
|
|
1390
1112
|
/* istanbul ignore next */
|
|
1391
1113
|
(0, _warning.default)(true, '[Semi Select] defaultValue/value should be array type in multiple mode');
|
|
1392
1114
|
}
|
|
1393
1115
|
}
|
|
1394
1116
|
}
|
|
1395
|
-
|
|
1396
1117
|
updateScrollTop() {
|
|
1397
1118
|
this._adapter.updateScrollTop();
|
|
1398
1119
|
}
|
|
1399
|
-
|
|
1120
|
+
updateOverflowItemCount(selectionLength, overFlowCount) {
|
|
1121
|
+
const {
|
|
1122
|
+
maxTagCount,
|
|
1123
|
+
ellipsisTrigger
|
|
1124
|
+
} = this.getProps();
|
|
1125
|
+
if (!ellipsisTrigger) {
|
|
1126
|
+
return;
|
|
1127
|
+
}
|
|
1128
|
+
if (overFlowCount) {
|
|
1129
|
+
this._adapter.updateOverflowItemCount(overFlowCount);
|
|
1130
|
+
} else if (typeof maxTagCount === 'number') {
|
|
1131
|
+
if (selectionLength - maxTagCount > 0) {
|
|
1132
|
+
this._adapter.updateOverflowItemCount(selectionLength - maxTagCount);
|
|
1133
|
+
} else {
|
|
1134
|
+
this._adapter.updateOverflowItemCount(0);
|
|
1135
|
+
}
|
|
1136
|
+
}
|
|
1137
|
+
}
|
|
1400
1138
|
updateIsFullTags() {
|
|
1401
1139
|
const {
|
|
1402
1140
|
isFullTags
|
|
1403
1141
|
} = this.getStates();
|
|
1404
|
-
|
|
1405
1142
|
if (!isFullTags) {
|
|
1406
1143
|
this._adapter.setState({
|
|
1407
1144
|
isFullTags: true
|
|
1408
1145
|
});
|
|
1409
1146
|
}
|
|
1410
1147
|
}
|
|
1411
|
-
|
|
1412
1148
|
handlePopoverClose() {
|
|
1413
1149
|
this._adapter.emit('popoverClose');
|
|
1414
1150
|
}
|
|
1415
|
-
|
|
1151
|
+
// need to remove focus style of option when user hover slot
|
|
1152
|
+
handleSlotMouseEnter() {
|
|
1153
|
+
this._adapter.updateFocusIndex(-1);
|
|
1154
|
+
}
|
|
1416
1155
|
}
|
|
1417
|
-
|
|
1418
1156
|
exports.default = SelectFoundation;
|