@douyinfe/semi-foundation 2.36.0-alpha.0 → 2.36.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/calendar/calendar.scss +1 -1
- package/calendar/foundation.ts +2 -1
- package/datePicker/_utils/getYears.ts +8 -4
- package/datePicker/foundation.ts +1 -1
- package/datePicker/monthsGridFoundation.ts +2 -1
- package/datePicker/yearAndMonthFoundation.ts +3 -1
- package/lib/cjs/anchor/constants.js +0 -2
- package/lib/cjs/anchor/foundation.js +10 -73
- package/lib/cjs/anchor/linkFoundation.js +4 -16
- package/lib/cjs/autoComplete/constants.js +0 -3
- package/lib/cjs/autoComplete/foundation.d.ts +1 -1
- package/lib/cjs/autoComplete/foundation.js +25 -139
- package/lib/cjs/autoComplete/optionFoundation.js +4 -14
- package/lib/cjs/avatar/constants.js +0 -2
- package/lib/cjs/avatar/foundation.js +0 -17
- package/lib/cjs/backtop/constants.js +0 -2
- package/lib/cjs/backtop/foundation.d.ts +2 -2
- package/lib/cjs/backtop/foundation.js +0 -21
- package/lib/cjs/badge/constants.js +0 -2
- package/lib/cjs/banner/constants.js +0 -2
- package/lib/cjs/banner/foundation.js +0 -7
- package/lib/cjs/base/constants.js +2 -4
- package/lib/cjs/base/foundation.d.ts +1 -1
- package/lib/cjs/base/foundation.js +12 -46
- package/lib/cjs/base/index.js +0 -3
- package/lib/cjs/breadcrumb/constants.js +0 -2
- package/lib/cjs/breadcrumb/foundation.js +1 -12
- package/lib/cjs/breadcrumb/itemFoundation.js +0 -7
- package/lib/cjs/button/constants.js +0 -2
- package/lib/cjs/calendar/calendar.css +2 -2
- package/lib/cjs/calendar/calendar.scss +1 -1
- package/lib/cjs/calendar/constants.js +0 -2
- package/lib/cjs/calendar/eventUtil.d.ts +1 -1
- package/lib/cjs/calendar/eventUtil.js +2 -74
- package/lib/cjs/calendar/foundation.d.ts +2 -2
- package/lib/cjs/calendar/foundation.js +28 -123
- package/lib/cjs/card/constants.js +0 -2
- package/lib/cjs/carousel/constants.js +0 -2
- package/lib/cjs/carousel/foundation.js +2 -52
- package/lib/cjs/cascader/constants.js +0 -3
- package/lib/cjs/cascader/foundation.d.ts +4 -4
- package/lib/cjs/cascader/foundation.js +28 -242
- package/lib/cjs/cascader/util.js +6 -24
- package/lib/cjs/checkbox/checkboxFoundation.js +2 -38
- package/lib/cjs/checkbox/checkboxGroupFoundation.js +2 -23
- package/lib/cjs/checkbox/constants.js +0 -2
- package/lib/cjs/collapse/constants.js +0 -2
- package/lib/cjs/collapse/foundation.d.ts +1 -1
- package/lib/cjs/collapse/foundation.js +2 -13
- package/lib/cjs/collapsible/constants.js +0 -2
- 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.js +0 -5
- 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 +0 -5
- package/lib/cjs/datePicker/_utils/getInsetInputValueFromInsetInputStr.js +0 -6
- package/lib/cjs/datePicker/_utils/getMonthTable.d.ts +1 -1
- package/lib/cjs/datePicker/_utils/getMonthTable.js +3 -14
- package/lib/cjs/datePicker/_utils/getMonthsInYear.js +0 -2
- 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.js +0 -1
- package/lib/cjs/datePicker/_utils/isWithinInterval.js +0 -4
- package/lib/cjs/datePicker/_utils/parser.js +0 -10
- package/lib/cjs/datePicker/constants.js +0 -3
- package/lib/cjs/datePicker/foundation.d.ts +25 -25
- package/lib/cjs/datePicker/foundation.js +22 -333
- package/lib/cjs/datePicker/inputFoundation.d.ts +3 -3
- package/lib/cjs/datePicker/inputFoundation.js +5 -86
- package/lib/cjs/datePicker/monthFoundation.d.ts +1 -1
- package/lib/cjs/datePicker/monthFoundation.js +3 -28
- package/lib/cjs/datePicker/monthsGridFoundation.d.ts +5 -4
- package/lib/cjs/datePicker/monthsGridFoundation.js +43 -238
- package/lib/cjs/datePicker/yearAndMonthFoundation.d.ts +3 -1
- package/lib/cjs/datePicker/yearAndMonthFoundation.js +12 -38
- package/lib/cjs/descriptions/constants.js +0 -2
- package/lib/cjs/divider/constants.js +0 -2
- package/lib/cjs/dropdown/constants.js +0 -3
- package/lib/cjs/dropdown/foundation.js +4 -23
- package/lib/cjs/dropdown/menuFoundation.js +8 -27
- package/lib/cjs/empty/constants.js +0 -2
- package/lib/cjs/form/constants.js +0 -2
- package/lib/cjs/form/foundation.js +75 -206
- package/lib/cjs/form/interface.d.ts +5 -5
- package/lib/cjs/form/utils.js +47 -77
- package/lib/cjs/grid/constants.js +0 -2
- package/lib/cjs/highlight/constants.js +0 -2
- package/lib/cjs/icons/constants.js +0 -2
- package/lib/cjs/image/constants.js +0 -2
- package/lib/cjs/image/imageFoundation.js +4 -18
- package/lib/cjs/image/previewFooterFoundation.js +0 -13
- package/lib/cjs/image/previewFoundation.js +0 -11
- package/lib/cjs/image/previewImageFoundation.js +6 -80
- package/lib/cjs/image/previewInnerFoundation.js +12 -77
- package/lib/cjs/image/utils.js +0 -14
- package/lib/cjs/input/constants.js +0 -2
- package/lib/cjs/input/foundation.js +17 -101
- package/lib/cjs/input/textareaFoundation.js +20 -85
- package/lib/cjs/input/util/calculateNodeHeight.js +6 -18
- package/lib/cjs/input/util/getSizingData.js +7 -11
- package/lib/cjs/inputNumber/constants.js +0 -2
- package/lib/cjs/inputNumber/foundation.js +29 -192
- package/lib/cjs/layout/constants.js +0 -2
- package/lib/cjs/list/constants.js +0 -2
- package/lib/cjs/modal/constants.js +0 -2
- package/lib/cjs/modal/modalContentFoundation.js +0 -20
- package/lib/cjs/modal/modalFoundation.d.ts +2 -2
- package/lib/cjs/modal/modalFoundation.js +2 -22
- package/lib/cjs/navigation/NavItem.js +0 -10
- package/lib/cjs/navigation/constants.js +0 -3
- package/lib/cjs/navigation/foundation.js +3 -67
- package/lib/cjs/navigation/itemFoundation.d.ts +0 -2
- package/lib/cjs/navigation/itemFoundation.js +3 -21
- package/lib/cjs/navigation/navigation.css +7 -77
- package/lib/cjs/navigation/navigation.scss +7 -119
- package/lib/cjs/navigation/subNavFoundation.d.ts +0 -2
- package/lib/cjs/navigation/subNavFoundation.js +4 -40
- package/lib/cjs/notification/constants.js +0 -3
- package/lib/cjs/notification/notificationFoundation.d.ts +3 -3
- package/lib/cjs/notification/notificationFoundation.js +0 -16
- package/lib/cjs/notification/notificationListFoundation.js +7 -17
- package/lib/cjs/overflowList/constants.js +0 -2
- package/lib/cjs/overflowList/foundation.js +11 -41
- package/lib/cjs/pagination/constants.js +0 -2
- package/lib/cjs/pagination/foundation.d.ts +3 -3
- package/lib/cjs/pagination/foundation.js +21 -90
- package/lib/cjs/popconfirm/constants.js +0 -2
- package/lib/cjs/popconfirm/popconfirmFoundation.js +1 -21
- package/lib/cjs/popover/constants.js +0 -3
- package/lib/cjs/progress/constants.js +0 -2
- package/lib/cjs/progress/generates.d.ts +2 -2
- package/lib/cjs/progress/generates.js +19 -60
- package/lib/cjs/radio/constants.js +0 -2
- package/lib/cjs/radio/radioFoundation.js +0 -14
- package/lib/cjs/radio/radioGroupFoundation.js +4 -23
- package/lib/cjs/radio/radioInnerFoundation.js +2 -19
- package/lib/cjs/rating/constants.js +0 -2
- package/lib/cjs/rating/foundation.js +11 -61
- package/lib/cjs/scrollList/constants.js +0 -2
- 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 +0 -3
- package/lib/cjs/select/foundation.d.ts +2 -2
- package/lib/cjs/select/foundation.js +122 -425
- package/lib/cjs/select/optionFoundation.js +4 -14
- package/lib/cjs/sideSheet/constants.js +0 -2
- package/lib/cjs/sideSheet/sideSheetFoundation.js +0 -18
- package/lib/cjs/skeleton/constants.js +0 -2
- package/lib/cjs/slider/constants.js +0 -2
- package/lib/cjs/slider/foundation.d.ts +1 -1
- package/lib/cjs/slider/foundation.js +25 -204
- package/lib/cjs/space/constants.js +0 -2
- package/lib/cjs/spin/constants.js +0 -2
- package/lib/cjs/spin/foundation.js +3 -13
- package/lib/cjs/steps/bacisSteps.scss +238 -287
- package/lib/cjs/steps/constants.js +0 -2
- package/lib/cjs/steps/fillSteps.scss +142 -153
- package/lib/cjs/steps/navSteps.scss +40 -61
- package/lib/cjs/steps/steps.css +17 -381
- package/lib/cjs/switch/constants.js +0 -2
- package/lib/cjs/switch/foundation.js +2 -18
- package/lib/cjs/table/bodyFoundation.js +2 -34
- package/lib/cjs/table/cellFoundation.js +0 -5
- package/lib/cjs/table/constants.js +7 -8
- package/lib/cjs/table/foundation.d.ts +17 -14
- package/lib/cjs/table/foundation.js +72 -302
- package/lib/cjs/table/table.css +6 -0
- package/lib/cjs/table/table.scss +12 -0
- package/lib/cjs/table/tableRowFoundation.js +0 -11
- package/lib/cjs/table/tableSelectionCellFoundation.js +0 -6
- package/lib/cjs/table/utils.d.ts +2 -2
- package/lib/cjs/table/utils.js +5 -118
- package/lib/cjs/tabs/constants.js +0 -2
- package/lib/cjs/tabs/foundation.js +2 -40
- package/lib/cjs/tabs/tabs.css +14 -14
- package/lib/cjs/tabs/tabs.scss +16 -14
- package/lib/cjs/tag/constants.js +1 -2
- package/lib/cjs/tagInput/constants.js +0 -2
- package/lib/cjs/tagInput/foundation.d.ts +4 -4
- package/lib/cjs/tagInput/foundation.js +4 -94
- package/lib/cjs/tagInput/utils/getSplitedArray.js +0 -11
- package/lib/cjs/timePicker/ComboxFoundation.js +4 -39
- package/lib/cjs/timePicker/constants.js +0 -3
- package/lib/cjs/timePicker/foundation.d.ts +2 -2
- package/lib/cjs/timePicker/foundation.js +6 -102
- package/lib/cjs/timePicker/inputFoundation.js +6 -25
- package/lib/cjs/timePicker/utils/index.js +6 -45
- package/lib/cjs/timePicker/utils/localeDate.js +0 -10
- package/lib/cjs/timeline/constants.js +0 -2
- package/lib/cjs/timeline/timeline.css +0 -36
- package/lib/cjs/timeline/timeline.scss +46 -96
- package/lib/cjs/toast/constants.js +0 -3
- package/lib/cjs/toast/toastFoundation.d.ts +3 -3
- package/lib/cjs/toast/toastFoundation.js +0 -14
- package/lib/cjs/toast/toastListFoundation.js +4 -22
- package/lib/cjs/tooltip/constants.js +0 -2
- package/lib/cjs/tooltip/foundation.d.ts +1 -1
- package/lib/cjs/tooltip/foundation.js +63 -291
- package/lib/cjs/transfer/constants.js +0 -2
- package/lib/cjs/transfer/foundation.d.ts +1 -1
- package/lib/cjs/transfer/foundation.js +4 -68
- package/lib/cjs/transfer/transferUtils.js +5 -27
- package/lib/cjs/tree/constants.js +0 -2
- package/lib/cjs/tree/foundation.d.ts +3 -3
- package/lib/cjs/tree/foundation.js +34 -150
- package/lib/cjs/tree/treeUtil.js +54 -173
- package/lib/cjs/treeSelect/constants.js +0 -2
- package/lib/cjs/treeSelect/foundation.d.ts +7 -7
- package/lib/cjs/treeSelect/foundation.js +18 -192
- package/lib/cjs/typography/constants.d.ts +1 -0
- package/lib/cjs/typography/constants.js +1 -2
- package/lib/cjs/typography/formatNumeral.d.ts +3 -3
- package/lib/cjs/typography/formatNumeral.js +16 -32
- package/lib/cjs/typography/typography.css +120 -0
- package/lib/cjs/typography/typography.scss +131 -6
- package/lib/cjs/typography/variables.scss +48 -0
- package/lib/cjs/upload/constants.js +0 -2
- package/lib/cjs/upload/foundation.d.ts +5 -5
- package/lib/cjs/upload/foundation.js +36 -245
- package/lib/cjs/upload/utils.js +10 -29
- package/lib/cjs/utils/Event.js +2 -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 +1 -1
- package/lib/cjs/utils/array.js +0 -7
- package/lib/cjs/utils/arrayMove.js +0 -1
- package/lib/cjs/utils/classnames.js +0 -12
- package/lib/cjs/utils/date-fns-extra.js +0 -35
- package/lib/cjs/utils/dom.d.ts +1 -1
- package/lib/cjs/utils/dom.js +0 -13
- package/lib/cjs/utils/function.js +0 -1
- package/lib/cjs/utils/getDataAttr.js +0 -2
- package/lib/cjs/utils/getHighlight.js +5 -26
- package/lib/cjs/utils/getMotionObjFromProps.js +0 -12
- 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 +12 -34
- package/lib/cjs/utils/set.js +0 -8
- package/lib/cjs/utils/shallowEqualObjects.js +0 -7
- package/lib/cjs/utils/touchPolyfill.js +0 -7
- package/lib/cjs/utils/type.d.ts +3 -3
- package/lib/cjs/utils/uuid.js +2 -9
- package/lib/cjs/utils/warning.js +0 -1
- package/lib/es/anchor/foundation.js +10 -66
- package/lib/es/anchor/linkFoundation.js +4 -12
- package/lib/es/autoComplete/foundation.d.ts +1 -1
- package/lib/es/autoComplete/foundation.js +24 -132
- package/lib/es/autoComplete/optionFoundation.js +4 -10
- package/lib/es/avatar/foundation.js +0 -12
- package/lib/es/backtop/foundation.d.ts +2 -2
- package/lib/es/backtop/foundation.js +0 -16
- package/lib/es/banner/foundation.js +0 -3
- package/lib/es/base/constants.js +2 -2
- package/lib/es/base/foundation.d.ts +1 -1
- package/lib/es/base/foundation.js +11 -44
- package/lib/es/breadcrumb/foundation.js +0 -7
- package/lib/es/breadcrumb/itemFoundation.js +0 -3
- package/lib/es/calendar/calendar.css +2 -2
- package/lib/es/calendar/calendar.scss +1 -1
- package/lib/es/calendar/eventUtil.d.ts +1 -1
- package/lib/es/calendar/eventUtil.js +2 -36
- package/lib/es/calendar/foundation.d.ts +2 -2
- package/lib/es/calendar/foundation.js +28 -117
- package/lib/es/carousel/foundation.js +2 -47
- package/lib/es/cascader/constants.js +0 -1
- package/lib/es/cascader/foundation.d.ts +4 -4
- package/lib/es/cascader/foundation.js +30 -226
- package/lib/es/cascader/util.js +6 -15
- package/lib/es/checkbox/checkboxFoundation.js +2 -34
- package/lib/es/checkbox/checkboxGroupFoundation.js +2 -20
- package/lib/es/collapse/foundation.d.ts +1 -1
- package/lib/es/collapse/foundation.js +2 -9
- 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.js +0 -2
- 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 +0 -4
- package/lib/es/datePicker/_utils/getInsetInputValueFromInsetInputStr.js +0 -5
- package/lib/es/datePicker/_utils/getMonthTable.d.ts +1 -1
- package/lib/es/datePicker/_utils/getMonthTable.js +4 -14
- package/lib/es/datePicker/_utils/getMonthsInYear.js +0 -1
- 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/parser.js +0 -8
- package/lib/es/datePicker/foundation.d.ts +25 -25
- package/lib/es/datePicker/foundation.js +22 -318
- package/lib/es/datePicker/inputFoundation.d.ts +3 -3
- package/lib/es/datePicker/inputFoundation.js +5 -74
- package/lib/es/datePicker/monthFoundation.d.ts +1 -1
- package/lib/es/datePicker/monthFoundation.js +4 -22
- package/lib/es/datePicker/monthsGridFoundation.d.ts +5 -4
- package/lib/es/datePicker/monthsGridFoundation.js +42 -222
- package/lib/es/datePicker/yearAndMonthFoundation.d.ts +3 -1
- package/lib/es/datePicker/yearAndMonthFoundation.js +12 -36
- package/lib/es/dropdown/foundation.js +4 -18
- package/lib/es/dropdown/menuFoundation.js +8 -22
- package/lib/es/form/foundation.js +74 -195
- package/lib/es/form/interface.d.ts +5 -5
- package/lib/es/form/utils.js +47 -70
- package/lib/es/image/imageFoundation.js +4 -13
- package/lib/es/image/previewFooterFoundation.js +0 -9
- package/lib/es/image/previewFoundation.js +0 -7
- package/lib/es/image/previewImageFoundation.js +6 -72
- package/lib/es/image/previewInnerFoundation.js +12 -70
- package/lib/es/image/utils.js +0 -6
- package/lib/es/input/foundation.js +17 -93
- package/lib/es/input/textareaFoundation.js +20 -75
- package/lib/es/input/util/calculateNodeHeight.js +6 -18
- package/lib/es/input/util/getSizingData.js +7 -11
- package/lib/es/inputNumber/foundation.js +28 -183
- package/lib/es/modal/modalContentFoundation.js +0 -15
- package/lib/es/modal/modalFoundation.d.ts +2 -2
- package/lib/es/modal/modalFoundation.js +2 -17
- package/lib/es/navigation/NavItem.js +0 -6
- package/lib/es/navigation/constants.js +1 -1
- package/lib/es/navigation/foundation.js +2 -60
- package/lib/es/navigation/itemFoundation.d.ts +0 -2
- package/lib/es/navigation/itemFoundation.js +3 -18
- package/lib/es/navigation/navigation.css +7 -77
- package/lib/es/navigation/navigation.scss +7 -119
- package/lib/es/navigation/subNavFoundation.d.ts +0 -2
- package/lib/es/navigation/subNavFoundation.js +4 -36
- package/lib/es/notification/constants.js +1 -1
- package/lib/es/notification/notificationFoundation.d.ts +3 -3
- package/lib/es/notification/notificationFoundation.js +0 -11
- package/lib/es/notification/notificationListFoundation.js +6 -13
- package/lib/es/overflowList/foundation.js +11 -37
- package/lib/es/pagination/foundation.d.ts +3 -3
- package/lib/es/pagination/foundation.js +20 -87
- package/lib/es/popconfirm/popconfirmFoundation.js +1 -16
- package/lib/es/progress/generates.d.ts +2 -2
- package/lib/es/progress/generates.js +19 -59
- package/lib/es/radio/radioFoundation.js +0 -9
- package/lib/es/radio/radioGroupFoundation.js +4 -19
- package/lib/es/radio/radioInnerFoundation.js +2 -15
- package/lib/es/rating/foundation.js +10 -54
- package/lib/es/scrollList/itemFoundation.js +8 -60
- package/lib/es/scrollList/scrollTo.js +2 -4
- package/lib/es/select/foundation.d.ts +2 -2
- package/lib/es/select/foundation.js +122 -411
- package/lib/es/select/optionFoundation.js +4 -10
- package/lib/es/sideSheet/sideSheetFoundation.js +0 -12
- package/lib/es/slider/foundation.d.ts +1 -1
- package/lib/es/slider/foundation.js +24 -197
- package/lib/es/spin/foundation.js +3 -11
- package/lib/es/steps/bacisSteps.scss +238 -287
- package/lib/es/steps/fillSteps.scss +142 -153
- package/lib/es/steps/navSteps.scss +40 -61
- package/lib/es/steps/steps.css +17 -381
- package/lib/es/switch/foundation.js +2 -13
- package/lib/es/table/bodyFoundation.js +2 -25
- package/lib/es/table/cellFoundation.js +0 -1
- package/lib/es/table/constants.js +6 -6
- package/lib/es/table/foundation.d.ts +17 -14
- package/lib/es/table/foundation.js +72 -309
- package/lib/es/table/table.css +6 -0
- package/lib/es/table/table.scss +12 -0
- package/lib/es/table/tableRowFoundation.js +2 -9
- package/lib/es/table/tableSelectionCellFoundation.js +0 -2
- package/lib/es/table/utils.d.ts +2 -2
- package/lib/es/table/utils.js +5 -81
- package/lib/es/tabs/foundation.js +2 -35
- package/lib/es/tabs/tabs.css +14 -14
- package/lib/es/tabs/tabs.scss +16 -14
- package/lib/es/tagInput/foundation.d.ts +4 -4
- package/lib/es/tagInput/foundation.js +4 -84
- package/lib/es/tagInput/utils/getSplitedArray.js +0 -7
- package/lib/es/timePicker/ComboxFoundation.js +4 -30
- package/lib/es/timePicker/foundation.d.ts +2 -2
- package/lib/es/timePicker/foundation.js +7 -95
- package/lib/es/timePicker/inputFoundation.js +6 -22
- package/lib/es/timePicker/utils/index.js +6 -25
- package/lib/es/timePicker/utils/localeDate.js +0 -8
- package/lib/es/timeline/timeline.css +0 -36
- package/lib/es/timeline/timeline.scss +46 -96
- package/lib/es/toast/constants.js +1 -1
- package/lib/es/toast/toastFoundation.d.ts +3 -3
- package/lib/es/toast/toastFoundation.js +0 -9
- package/lib/es/toast/toastListFoundation.js +4 -18
- package/lib/es/tooltip/foundation.d.ts +1 -1
- package/lib/es/tooltip/foundation.js +63 -288
- package/lib/es/transfer/foundation.d.ts +1 -1
- package/lib/es/transfer/foundation.js +6 -62
- package/lib/es/transfer/transferUtils.js +5 -21
- package/lib/es/tree/foundation.d.ts +3 -3
- package/lib/es/tree/foundation.js +34 -143
- package/lib/es/tree/treeUtil.js +54 -139
- package/lib/es/treeSelect/foundation.d.ts +7 -7
- package/lib/es/treeSelect/foundation.js +20 -179
- package/lib/es/typography/constants.d.ts +1 -0
- package/lib/es/typography/constants.js +1 -0
- package/lib/es/typography/formatNumeral.d.ts +3 -3
- package/lib/es/typography/formatNumeral.js +16 -29
- package/lib/es/typography/typography.css +120 -0
- package/lib/es/typography/typography.scss +131 -6
- package/lib/es/typography/variables.scss +48 -0
- package/lib/es/upload/foundation.d.ts +5 -5
- package/lib/es/upload/foundation.js +36 -238
- package/lib/es/upload/utils.js +10 -24
- package/lib/es/utils/Event.js +2 -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 +1 -1
- package/lib/es/utils/array.js +0 -5
- package/lib/es/utils/classnames.js +0 -10
- package/lib/es/utils/date-fns-extra.js +0 -27
- package/lib/es/utils/dom.d.ts +1 -1
- package/lib/es/utils/dom.js +0 -9
- package/lib/es/utils/getDataAttr.js +0 -1
- package/lib/es/utils/getHighlight.js +5 -26
- package/lib/es/utils/getMotionObjFromProps.js +0 -8
- 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 +12 -28
- package/lib/es/utils/set.js +0 -5
- package/lib/es/utils/shallowEqualObjects.js +0 -6
- package/lib/es/utils/touchPolyfill.js +0 -5
- package/lib/es/utils/type.d.ts +3 -3
- package/lib/es/utils/uuid.js +2 -8
- package/navigation/itemFoundation.ts +1 -3
- package/navigation/navigation.scss +7 -119
- package/navigation/subNavFoundation.ts +1 -3
- package/overflowList/foundation.ts +4 -4
- package/package.json +2 -2
- package/steps/bacisSteps.scss +238 -287
- package/steps/fillSteps.scss +142 -153
- package/steps/navSteps.scss +40 -61
- package/table/foundation.ts +8 -10
- package/table/table.scss +12 -0
- package/tabs/tabs.scss +16 -14
- package/timePicker/foundation.ts +4 -6
- package/timeline/timeline.scss +46 -96
- package/typography/constants.ts +1 -0
- package/typography/typography.scss +131 -6
- package/typography/variables.scss +48 -0
- package/upload/foundation.ts +8 -8
|
@@ -4,52 +4,84 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _isUndefined2 = _interopRequireDefault(require("lodash/isUndefined"));
|
|
9
|
-
|
|
10
8
|
var _isEqual2 = _interopRequireDefault(require("lodash/isEqual"));
|
|
11
|
-
|
|
12
9
|
var _slice2 = _interopRequireDefault(require("lodash/slice"));
|
|
13
|
-
|
|
14
10
|
var _isMap2 = _interopRequireDefault(require("lodash/isMap"));
|
|
15
|
-
|
|
16
11
|
var _filter2 = _interopRequireDefault(require("lodash/filter"));
|
|
17
|
-
|
|
18
12
|
var _isSet2 = _interopRequireDefault(require("lodash/isSet"));
|
|
19
|
-
|
|
20
13
|
var _pull2 = _interopRequireDefault(require("lodash/pull"));
|
|
21
|
-
|
|
22
14
|
var _some2 = _interopRequireDefault(require("lodash/some"));
|
|
23
|
-
|
|
24
15
|
var _find2 = _interopRequireDefault(require("lodash/find"));
|
|
25
|
-
|
|
26
16
|
var _each2 = _interopRequireDefault(require("lodash/each"));
|
|
27
|
-
|
|
28
17
|
var _isFunction2 = _interopRequireDefault(require("lodash/isFunction"));
|
|
29
|
-
|
|
30
18
|
var _merge2 = _interopRequireDefault(require("lodash/merge"));
|
|
31
|
-
|
|
32
19
|
var _get2 = _interopRequireDefault(require("lodash/get"));
|
|
33
|
-
|
|
34
20
|
var _memoizeOne = _interopRequireDefault(require("memoize-one"));
|
|
35
|
-
|
|
36
21
|
var _foundation = _interopRequireDefault(require("../base/foundation"));
|
|
37
|
-
|
|
38
22
|
var _constants = require("./constants");
|
|
39
|
-
|
|
40
23
|
var _utils = require("./utils");
|
|
41
|
-
|
|
42
24
|
var _array = require("../utils/array");
|
|
43
|
-
|
|
44
25
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
26
|
+
/* eslint-disable prefer-destructuring */
|
|
27
|
+
/* eslint-disable max-depth */
|
|
28
|
+
/* eslint-disable max-nested-callbacks */
|
|
29
|
+
/* eslint-disable max-len */
|
|
30
|
+
/* eslint-disable no-param-reassign */
|
|
31
|
+
/* eslint-disable eqeqeq */
|
|
32
|
+
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
45
33
|
|
|
46
34
|
class TableFoundation extends _foundation.default {
|
|
35
|
+
/**
|
|
36
|
+
* update columns in place, and use default values as initial values if the sorting and filtering columns have no values
|
|
37
|
+
*/
|
|
38
|
+
static initColumnsFilteredValueAndSorterOrder(columns) {
|
|
39
|
+
columns.forEach(column => {
|
|
40
|
+
TableFoundation.initFilteredValue(column);
|
|
41
|
+
TableFoundation.initSorterOrder(column);
|
|
42
|
+
});
|
|
43
|
+
return columns;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* init filteredValue of filtering column, use defaultFilteredValue or [] when it is undefined
|
|
47
|
+
*/
|
|
48
|
+
static initFilteredValue(column) {
|
|
49
|
+
const {
|
|
50
|
+
defaultFilteredValue,
|
|
51
|
+
filteredValue
|
|
52
|
+
} = column;
|
|
53
|
+
// There may be cases where onFilter is empty, such as server-side filtering
|
|
54
|
+
// Because filterValue affects the output of filters, it needs to be initialized here
|
|
55
|
+
if ((0, _isUndefined2.default)(filteredValue)) {
|
|
56
|
+
if (Array.isArray(defaultFilteredValue) && defaultFilteredValue.length) {
|
|
57
|
+
column.filteredValue = defaultFilteredValue;
|
|
58
|
+
} else {
|
|
59
|
+
column.filteredValue = [];
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* init sortOrder of sorting column, use defaultSortOrder or [] when it is undefined
|
|
65
|
+
*/
|
|
66
|
+
static initSorterOrder(column) {
|
|
67
|
+
const {
|
|
68
|
+
defaultSortOrder,
|
|
69
|
+
sortOrder,
|
|
70
|
+
sorter
|
|
71
|
+
} = column;
|
|
72
|
+
if (sorter && (0, _isUndefined2.default)(sortOrder)) {
|
|
73
|
+
if (!(0, _isUndefined2.default)(defaultSortOrder)) {
|
|
74
|
+
column.sortOrder = defaultSortOrder;
|
|
75
|
+
} else {
|
|
76
|
+
column.sortOrder = false;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
47
80
|
constructor(adapter) {
|
|
48
81
|
super(Object.assign({}, adapter));
|
|
49
82
|
/**
|
|
50
83
|
* set page number
|
|
51
84
|
*/
|
|
52
|
-
|
|
53
85
|
this.setPage = (currentPage, currentPageSize) => {
|
|
54
86
|
currentPage = currentPage || this._adapter.getCurrentPage();
|
|
55
87
|
const currentPagination = this.getState('pagination');
|
|
@@ -62,120 +94,49 @@ class TableFoundation extends _foundation.default {
|
|
|
62
94
|
currentPage,
|
|
63
95
|
pageSize: currentPageSize
|
|
64
96
|
}));
|
|
65
|
-
|
|
66
97
|
if (!this._pagerIsControlled() && currentPage > 0) {
|
|
67
98
|
this._adapter.setDisabledRowKeys(disabledRowKeys);
|
|
68
|
-
|
|
69
99
|
this._adapter.setAllRowKeys(allRowKeys);
|
|
70
|
-
|
|
71
100
|
this._adapter.setPagination(pagination);
|
|
72
|
-
|
|
73
101
|
this._adapter.setDataSource(dataSource);
|
|
74
102
|
}
|
|
75
|
-
|
|
76
103
|
this._notifyChange(pagination);
|
|
77
104
|
};
|
|
78
105
|
/**
|
|
79
106
|
* Cache related data when initializing or updating the calculated dataSource
|
|
80
107
|
* @param {*} filteredSortedDataSource
|
|
81
108
|
*/
|
|
82
|
-
|
|
83
|
-
|
|
84
109
|
this.setCachedFilteredSortedDataSource = filteredSortedDataSource => {
|
|
85
110
|
this._adapter.setCachedFilteredSortedDataSource(filteredSortedDataSource);
|
|
86
|
-
|
|
87
111
|
const filteredSortedRowKeys = this.getAllRowKeys(filteredSortedDataSource);
|
|
88
|
-
|
|
89
112
|
this._adapter.setCachedFilteredSortedRowKeys(filteredSortedRowKeys);
|
|
90
113
|
};
|
|
91
|
-
|
|
92
114
|
this.isSortOrderValid = sortOrder => _constants.strings.SORT_DIRECTIONS.includes(sortOrder) || sortOrder === false;
|
|
93
115
|
/**
|
|
94
116
|
* memoized function list
|
|
95
117
|
*/
|
|
96
|
-
|
|
97
|
-
|
|
98
118
|
const handleColumns = this._adapter.getHandleColumns();
|
|
99
|
-
|
|
100
119
|
const mergePagination = this._adapter.getMergePagination();
|
|
101
|
-
|
|
102
120
|
this.memoizedWithFnsColumns = (0, _memoizeOne.default)(handleColumns, _isEqual2.default);
|
|
103
121
|
this.memoizedFilterColumns = (0, _memoizeOne.default)(_utils.filterColumns);
|
|
104
122
|
this.memoizedFlattenFnsColumns = (0, _memoizeOne.default)(_utils.flattenColumns);
|
|
105
123
|
this.memoizedPagination = (0, _memoizeOne.default)(mergePagination, _isEqual2.default);
|
|
106
124
|
}
|
|
107
|
-
/**
|
|
108
|
-
* update columns in place, and use default values as initial values if the sorting and filtering columns have no values
|
|
109
|
-
*/
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
static initColumnsFilteredValueAndSorterOrder(columns) {
|
|
113
|
-
columns.forEach(column => {
|
|
114
|
-
TableFoundation.initFilteredValue(column);
|
|
115
|
-
TableFoundation.initSorterOrder(column);
|
|
116
|
-
});
|
|
117
|
-
return columns;
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* init filteredValue of filtering column, use defaultFilteredValue or [] when it is undefined
|
|
121
|
-
*/
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
static initFilteredValue(column) {
|
|
125
|
-
const {
|
|
126
|
-
defaultFilteredValue,
|
|
127
|
-
filteredValue,
|
|
128
|
-
onFilter
|
|
129
|
-
} = column;
|
|
130
|
-
const hasFilter = (0, _isFunction2.default)(onFilter);
|
|
131
|
-
|
|
132
|
-
if (hasFilter && (0, _isUndefined2.default)(filteredValue)) {
|
|
133
|
-
if (Array.isArray(defaultFilteredValue) && defaultFilteredValue.length) {
|
|
134
|
-
column.filteredValue = defaultFilteredValue;
|
|
135
|
-
} else {
|
|
136
|
-
column.filteredValue = [];
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
/**
|
|
141
|
-
* init sortOrder of sorting column, use defaultSortOrder or [] when it is undefined
|
|
142
|
-
*/
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
static initSorterOrder(column) {
|
|
146
|
-
const {
|
|
147
|
-
defaultSortOrder,
|
|
148
|
-
sortOrder,
|
|
149
|
-
sorter
|
|
150
|
-
} = column;
|
|
151
|
-
|
|
152
|
-
if (sorter && (0, _isUndefined2.default)(sortOrder)) {
|
|
153
|
-
if (!(0, _isUndefined2.default)(defaultSortOrder)) {
|
|
154
|
-
column.sortOrder = defaultSortOrder;
|
|
155
|
-
} else {
|
|
156
|
-
column.sortOrder = false;
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
|
|
161
125
|
init() {
|
|
162
126
|
const dataSource = [...this.getProp('dataSource')];
|
|
163
|
-
|
|
164
127
|
const {
|
|
165
128
|
queries
|
|
166
129
|
} = this._adapter.getStates();
|
|
167
|
-
|
|
168
130
|
const filteredSortedDataSource = this.getFilteredSortedDataSource(dataSource, queries);
|
|
169
131
|
const allDataDisabledRowKeys = this.getAllDisabledRowKeys(filteredSortedDataSource);
|
|
170
132
|
const pageData = this.getCurrentPageData(filteredSortedDataSource);
|
|
171
133
|
this.setAdapterPageData(pageData);
|
|
172
134
|
this.initExpandedRowKeys(pageData);
|
|
173
|
-
this.initSelectedRowKeys(pageData);
|
|
174
|
-
|
|
135
|
+
this.initSelectedRowKeys(pageData);
|
|
136
|
+
// cache dataSource after mount, and then calculate it on demand
|
|
175
137
|
this.setCachedFilteredSortedDataSource(filteredSortedDataSource);
|
|
176
138
|
this.setAllDisabledRowKeys(allDataDisabledRowKeys);
|
|
177
139
|
}
|
|
178
|
-
|
|
179
140
|
initExpandedRowKeys() {
|
|
180
141
|
let {
|
|
181
142
|
groups
|
|
@@ -190,7 +151,6 @@ class TableFoundation extends _foundation.default {
|
|
|
190
151
|
expandAllGroupRows
|
|
191
152
|
} = this.getProps();
|
|
192
153
|
const expandedRowKeys = [];
|
|
193
|
-
|
|
194
154
|
if (defaultExpandAllRows || expandAllRows) {
|
|
195
155
|
this._addNoDuplicatedItemsToArr(expandedRowKeys, this.getAllRowKeys(dataSource), groups && (0, _isMap2.default)(groups) && groups.size ? Array.from(groups.keys()) : []);
|
|
196
156
|
} else if (defaultExpandAllGroupRows || expandAllGroupRows) {
|
|
@@ -200,31 +160,25 @@ class TableFoundation extends _foundation.default {
|
|
|
200
160
|
} else if (Array.isArray(propExpandedRowKeys) && propExpandedRowKeys.length) {
|
|
201
161
|
this._addNoDuplicatedItemsToArr(expandedRowKeys, propExpandedRowKeys);
|
|
202
162
|
}
|
|
203
|
-
|
|
204
163
|
this._adapter.setExpandedRowKeys(expandedRowKeys);
|
|
205
164
|
}
|
|
206
|
-
|
|
207
165
|
initSelectedRowKeys(_ref) {
|
|
208
166
|
let {
|
|
209
167
|
disabledRowKeys
|
|
210
168
|
} = _ref;
|
|
211
169
|
const rowSelection = this.getProp('rowSelection');
|
|
212
170
|
const rowKeys = [];
|
|
213
|
-
|
|
214
171
|
if (rowSelection) {
|
|
215
172
|
const selectedRowKeys = (0, _get2.default)(rowSelection, 'selectedRowKeys');
|
|
216
173
|
const defaultSelectedRowKeys = (0, _get2.default)(rowSelection, 'defaultSelectedRowKeys');
|
|
217
|
-
|
|
218
174
|
if (Array.isArray(selectedRowKeys)) {
|
|
219
175
|
this._addNoDuplicatedItemsToArr(rowKeys, selectedRowKeys);
|
|
220
176
|
} else if (Array.isArray(defaultSelectedRowKeys)) {
|
|
221
177
|
this._addNoDuplicatedItemsToArr(rowKeys, defaultSelectedRowKeys);
|
|
222
178
|
}
|
|
223
|
-
|
|
224
179
|
if (Array.isArray(disabledRowKeys) && disabledRowKeys.length) {
|
|
225
180
|
(0, _pull2.default)(rowKeys, ...disabledRowKeys);
|
|
226
181
|
}
|
|
227
|
-
|
|
228
182
|
this._adapter.setSelectedRowKeys(rowKeys);
|
|
229
183
|
}
|
|
230
184
|
}
|
|
@@ -234,17 +188,8 @@ class TableFoundation extends _foundation.default {
|
|
|
234
188
|
* @param {Object[]} queries
|
|
235
189
|
* @returns {Object[]} sortedDataSource
|
|
236
190
|
*/
|
|
237
|
-
|
|
238
|
-
|
|
239
191
|
getFilteredSortedDataSource(dataSource, queries) {
|
|
240
192
|
const filteredDataSource = this.filterDataSource(dataSource, queries.filter(query => {
|
|
241
|
-
/**
|
|
242
|
-
* 这里无需判断 filteredValue 是否为数组,初始化时它是 `undefined`,点击选择空时为 `[]`
|
|
243
|
-
* 初始化时我们应该用 `defaultFilteredValue`,点击后我们应该用 `filteredValue`
|
|
244
|
-
*
|
|
245
|
-
* There is no need to judge whether `filteredValue` is an array here, because it is `undefined` when initialized, and `[]` when you click to select empty
|
|
246
|
-
* When initializing we should use `defaultFilteredValue`, after clicking we should use `filteredValue`
|
|
247
|
-
*/
|
|
248
193
|
const currentFilteredValue = query.filteredValue ? query.filteredValue : query.defaultFilteredValue;
|
|
249
194
|
return (0, _isFunction2.default)(query.onFilter) && Array.isArray(currentFilteredValue) && currentFilteredValue.length;
|
|
250
195
|
}));
|
|
@@ -259,16 +204,12 @@ class TableFoundation extends _foundation.default {
|
|
|
259
204
|
* @param {object} queries
|
|
260
205
|
* @returns {{dataSource: RecordType[], groups: Map<string, Set<string>>, pagination: object, disabledRowKeys: string[], queries: BaseColumnProps[], allRowKeys: string[]}}
|
|
261
206
|
*/
|
|
262
|
-
|
|
263
|
-
|
|
264
207
|
getCurrentPageData(dataSource, pagination, queries) {
|
|
265
208
|
const filteredSortedDataSource = this._adapter.getCachedFilteredSortedDataSource();
|
|
266
|
-
|
|
267
209
|
dataSource = dataSource == null ? [...filteredSortedDataSource] : dataSource;
|
|
268
210
|
pagination = pagination == null ? this.getState('pagination') && Object.assign({}, this.getState('pagination')) : pagination;
|
|
269
211
|
queries = queries == null ? [...this.getState('queries')] : queries;
|
|
270
212
|
let groups;
|
|
271
|
-
|
|
272
213
|
if (this.getProp('groupBy') != null) {
|
|
273
214
|
const {
|
|
274
215
|
groups: groupedGroups,
|
|
@@ -277,7 +218,6 @@ class TableFoundation extends _foundation.default {
|
|
|
277
218
|
dataSource = groupedData;
|
|
278
219
|
groups = groupedGroups;
|
|
279
220
|
}
|
|
280
|
-
|
|
281
221
|
pagination = this.normalizePagination(pagination, dataSource);
|
|
282
222
|
dataSource = this.limitPageDataSource(dataSource, pagination);
|
|
283
223
|
const disabledRowKeys = this.getAllDisabledRowKeys(dataSource);
|
|
@@ -298,21 +238,16 @@ class TableFoundation extends _foundation.default {
|
|
|
298
238
|
* @param {*[]} dataSource
|
|
299
239
|
* @param {Function|string} groupBy
|
|
300
240
|
*/
|
|
301
|
-
|
|
302
|
-
|
|
303
241
|
groupDataSource(dataSource, groupBy) {
|
|
304
242
|
groupBy = groupBy == null ? this.getProp('groupBy') : groupBy;
|
|
305
243
|
const groups = new Map();
|
|
306
244
|
const newDataSource = [];
|
|
307
|
-
|
|
308
245
|
if (groupBy != null) {
|
|
309
246
|
(0, _each2.default)(dataSource, (record, index) => {
|
|
310
247
|
const groupKey = typeof groupBy === 'function' ? groupBy(record) : (0, _get2.default)(record, groupBy);
|
|
311
|
-
|
|
312
248
|
if (groupKey != null && groupKey !== '') {
|
|
313
249
|
const recordKey = this.getRecordKey(record);
|
|
314
250
|
let group = groups.get(groupKey);
|
|
315
|
-
|
|
316
251
|
if (!(0, _isSet2.default)(group)) {
|
|
317
252
|
group = new Set([recordKey]);
|
|
318
253
|
groups.set(groupKey, group);
|
|
@@ -322,7 +257,6 @@ class TableFoundation extends _foundation.default {
|
|
|
322
257
|
}
|
|
323
258
|
});
|
|
324
259
|
}
|
|
325
|
-
|
|
326
260
|
if (groups && groups.size) {
|
|
327
261
|
groups.forEach((set, key) => {
|
|
328
262
|
if ((0, _isSet2.default)(set)) {
|
|
@@ -334,7 +268,6 @@ class TableFoundation extends _foundation.default {
|
|
|
334
268
|
} else {
|
|
335
269
|
newDataSource.push(...dataSource);
|
|
336
270
|
}
|
|
337
|
-
|
|
338
271
|
return {
|
|
339
272
|
groups,
|
|
340
273
|
dataSource: newDataSource
|
|
@@ -347,8 +280,6 @@ class TableFoundation extends _foundation.default {
|
|
|
347
280
|
* @param {Array} sorters
|
|
348
281
|
* @returns {Array}
|
|
349
282
|
*/
|
|
350
|
-
|
|
351
|
-
|
|
352
283
|
sortDataSource(dataSource, sorters) {
|
|
353
284
|
(0, _each2.default)(sorters, sorterObj => {
|
|
354
285
|
// const sorterObj = last(sorters) || {};
|
|
@@ -359,27 +290,22 @@ class TableFoundation extends _foundation.default {
|
|
|
359
290
|
sortChildrenRecord
|
|
360
291
|
} = sorterObj;
|
|
361
292
|
const currentSortOrder = this.isSortOrderValid(sortOrder) ? sortOrder : defaultSortOrder;
|
|
362
|
-
|
|
363
293
|
if ((0, _isFunction2.default)(sorter) && currentSortOrder && _constants.strings.SORT_DIRECTIONS.includes(currentSortOrder)) {
|
|
364
294
|
if (sortChildrenRecord) {
|
|
365
295
|
const childrenRecordName = this.getProp('childrenRecordName');
|
|
366
296
|
dataSource = dataSource && dataSource.map(record => {
|
|
367
297
|
const children = this._getRecordChildren(record);
|
|
368
|
-
|
|
369
298
|
if (Array.isArray(children) && children.length) {
|
|
370
299
|
return Object.assign(Object.assign({}, record), {
|
|
371
300
|
[childrenRecordName]: this.sortDataSource(children, [sorterObj])
|
|
372
301
|
});
|
|
373
302
|
}
|
|
374
|
-
|
|
375
303
|
return record;
|
|
376
304
|
});
|
|
377
305
|
}
|
|
378
|
-
|
|
379
306
|
dataSource.sort((0, _array.withOrderSort)(sorter, currentSortOrder));
|
|
380
307
|
return false;
|
|
381
308
|
}
|
|
382
|
-
|
|
383
309
|
return undefined;
|
|
384
310
|
});
|
|
385
311
|
return dataSource;
|
|
@@ -391,8 +317,6 @@ class TableFoundation extends _foundation.default {
|
|
|
391
317
|
* @param {*[]} filters
|
|
392
318
|
* @returns {*[]}
|
|
393
319
|
*/
|
|
394
|
-
|
|
395
|
-
|
|
396
320
|
filterDataSource(dataSource, filters) {
|
|
397
321
|
let filteredData = null;
|
|
398
322
|
let hasValidFilters = false;
|
|
@@ -405,27 +329,22 @@ class TableFoundation extends _foundation.default {
|
|
|
405
329
|
defaultFilteredValue
|
|
406
330
|
} = filterObj;
|
|
407
331
|
const currentFilteredValue = Array.isArray(filteredValue) ? filteredValue : defaultFilteredValue;
|
|
408
|
-
|
|
409
332
|
if (typeof onFilter === 'function' && Array.isArray(currentFilteredValue) && currentFilteredValue.length) {
|
|
410
333
|
hasValidFilters = true;
|
|
411
|
-
|
|
412
334
|
if (filteredData === null) {
|
|
413
335
|
filteredData = new Map();
|
|
414
336
|
} else {
|
|
415
337
|
dataSource = Array.from(filteredData && filteredData.values());
|
|
416
338
|
filteredData = new Map();
|
|
417
339
|
}
|
|
418
|
-
|
|
419
340
|
(0, _each2.default)(dataSource, record => {
|
|
420
341
|
(0, _each2.default)(currentFilteredValue, value => {
|
|
421
342
|
const childrenRecords = (0, _get2.default)(record, childrenRecordName);
|
|
422
343
|
const recordKey = this.getRecordKey(record);
|
|
423
344
|
let filteredChildren;
|
|
424
|
-
|
|
425
345
|
if (Array.isArray(childrenRecords) && childrenRecords.length && filterChildrenRecord) {
|
|
426
346
|
filteredChildren = this.filterDataSource(childrenRecords, [filterObj]);
|
|
427
347
|
}
|
|
428
|
-
|
|
429
348
|
if (Array.isArray(filteredChildren) && filteredChildren.length) {
|
|
430
349
|
if (recordKey != null) {
|
|
431
350
|
const children = (0, _get2.default)(filteredData.get(recordKey), childrenRecordName, []);
|
|
@@ -434,9 +353,10 @@ class TableFoundation extends _foundation.default {
|
|
|
434
353
|
if (arr.find(item => this.getRecordKey(item) === this.getRecordKey(cur)) == null) {
|
|
435
354
|
arr.push(cur);
|
|
436
355
|
}
|
|
437
|
-
|
|
438
356
|
return arr;
|
|
439
|
-
},
|
|
357
|
+
},
|
|
358
|
+
// @ts-ignore
|
|
359
|
+
[...children])
|
|
440
360
|
}));
|
|
441
361
|
}
|
|
442
362
|
} else if (onFilter(value, record)) {
|
|
@@ -446,20 +366,16 @@ class TableFoundation extends _foundation.default {
|
|
|
446
366
|
});
|
|
447
367
|
}
|
|
448
368
|
});
|
|
449
|
-
|
|
450
369
|
if (hasValidFilters) {
|
|
451
370
|
dataSource = Array.from(filteredData && filteredData.values());
|
|
452
371
|
}
|
|
453
|
-
|
|
454
372
|
return dataSource;
|
|
455
373
|
}
|
|
456
|
-
|
|
457
374
|
limitPageDataSource(dataSource, pagination) {
|
|
458
375
|
dataSource = dataSource == null ? this.getProp('dataSource') : dataSource;
|
|
459
376
|
pagination = pagination == null ? this.getState('pagination') : pagination;
|
|
460
377
|
let pageData = dataSource;
|
|
461
378
|
const pageNo = (0, _get2.default)(pagination, 'currentPage');
|
|
462
|
-
|
|
463
379
|
if (this.getProp('pagination') !== false && pageNo && dataSource && pagination && !this._pagerIsControlled()) {
|
|
464
380
|
const {
|
|
465
381
|
pageSize = _constants.numbers.DEFAULT_PAGE_SIZE
|
|
@@ -468,15 +384,12 @@ class TableFoundation extends _foundation.default {
|
|
|
468
384
|
const end = pageNo * pageSize;
|
|
469
385
|
pageData = (0, _slice2.default)(dataSource, start, end);
|
|
470
386
|
}
|
|
471
|
-
|
|
472
387
|
return pageData;
|
|
473
388
|
}
|
|
474
|
-
|
|
475
389
|
normalizePagination(pagination, dataSource) {
|
|
476
390
|
pagination = pagination == null ? this._getPagination() : pagination;
|
|
477
391
|
dataSource = dataSource == null ? this._getDataSource() : dataSource;
|
|
478
392
|
const propPagination = this.getProp('pagination');
|
|
479
|
-
|
|
480
393
|
if (pagination) {
|
|
481
394
|
pagination = typeof pagination === 'object' ? Object.assign({}, pagination) : {};
|
|
482
395
|
pagination = (0, _merge2.default)({
|
|
@@ -485,7 +398,6 @@ class TableFoundation extends _foundation.default {
|
|
|
485
398
|
currentPage: (0, _get2.default)(propPagination, 'defaultCurrentPage', 1),
|
|
486
399
|
position: _constants.strings.PAGINATION_POSITIONS[0]
|
|
487
400
|
}, pagination);
|
|
488
|
-
|
|
489
401
|
if (!this._pagerIsControlled()) {
|
|
490
402
|
const total = (0, _get2.default)(propPagination, 'total', dataSource.length);
|
|
491
403
|
const pageSize = (0, _get2.default)(propPagination, 'pageSize', pagination.pageSize);
|
|
@@ -494,16 +406,13 @@ class TableFoundation extends _foundation.default {
|
|
|
494
406
|
} = pagination;
|
|
495
407
|
const realTotalPage = Math.ceil(total / pageSize);
|
|
496
408
|
pagination.total = total;
|
|
497
|
-
|
|
498
409
|
if (currentPage > realTotalPage) {
|
|
499
410
|
pagination.currentPage = 1;
|
|
500
411
|
}
|
|
501
412
|
}
|
|
502
413
|
}
|
|
503
|
-
|
|
504
414
|
return pagination;
|
|
505
415
|
}
|
|
506
|
-
|
|
507
416
|
setAdapterPageData() {
|
|
508
417
|
let pageData = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
509
418
|
const {
|
|
@@ -513,30 +422,19 @@ class TableFoundation extends _foundation.default {
|
|
|
513
422
|
allRowKeys,
|
|
514
423
|
groups
|
|
515
424
|
} = pageData;
|
|
516
|
-
|
|
517
425
|
this._adapter.setDisabledRowKeys(disabledRowKeys);
|
|
518
|
-
|
|
519
426
|
this._adapter.setAllRowKeys(allRowKeys);
|
|
520
|
-
|
|
521
427
|
this._adapter.setPagination(pagination);
|
|
522
|
-
|
|
523
428
|
this._adapter.setGroups(groups);
|
|
524
|
-
|
|
525
429
|
this._adapter.setDataSource(dataSource);
|
|
526
430
|
}
|
|
527
|
-
|
|
528
431
|
destroy() {}
|
|
529
|
-
|
|
530
432
|
setAllDisabledRowKeys(disabledRowKeys) {
|
|
531
433
|
this._adapter.setAllDisabledRowKeys(disabledRowKeys);
|
|
532
434
|
}
|
|
533
|
-
|
|
534
435
|
handleClick(e) {}
|
|
535
|
-
|
|
536
436
|
handleMouseEnter(e) {}
|
|
537
|
-
|
|
538
437
|
handleMouseLeave(e) {}
|
|
539
|
-
|
|
540
438
|
stopPropagation(e) {
|
|
541
439
|
this._adapter.stopPropagation(e);
|
|
542
440
|
}
|
|
@@ -545,15 +443,11 @@ class TableFoundation extends _foundation.default {
|
|
|
545
443
|
* @param {Array} srcArr
|
|
546
444
|
* @param {Object} objArrs
|
|
547
445
|
*/
|
|
548
|
-
|
|
549
|
-
|
|
550
446
|
_addNoDuplicatedItemsToArr() {
|
|
551
447
|
let srcArr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
552
|
-
|
|
553
448
|
for (var _len = arguments.length, objArrs = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
554
449
|
objArrs[_key - 1] = arguments[_key];
|
|
555
450
|
}
|
|
556
|
-
|
|
557
451
|
for (const objArr of objArrs) {
|
|
558
452
|
if (Array.isArray(objArr)) {
|
|
559
453
|
for (const item of objArr) {
|
|
@@ -563,19 +457,15 @@ class TableFoundation extends _foundation.default {
|
|
|
563
457
|
}
|
|
564
458
|
}
|
|
565
459
|
}
|
|
566
|
-
|
|
567
460
|
return srcArr;
|
|
568
461
|
}
|
|
569
|
-
|
|
570
462
|
_notifyChange(pagination, filters, sorter, extra) {
|
|
571
463
|
pagination = pagination == null ? this._getPagination() : pagination;
|
|
572
464
|
filters = filters == null ? this._getAllFilters() : filters;
|
|
573
465
|
sorter = sorter == null ? this._getAllSorters()[0] : sorter;
|
|
574
|
-
|
|
575
466
|
if ((0, _get2.default)(this.getProp('scroll'), 'scrollToFirstRowOnChange')) {
|
|
576
467
|
this._adapter.resetScrollY();
|
|
577
468
|
}
|
|
578
|
-
|
|
579
469
|
this._adapter.notifyChange({
|
|
580
470
|
pagination: Object.assign({}, pagination),
|
|
581
471
|
filters: [...filters],
|
|
@@ -583,15 +473,12 @@ class TableFoundation extends _foundation.default {
|
|
|
583
473
|
extra: Object.assign({}, extra)
|
|
584
474
|
});
|
|
585
475
|
}
|
|
586
|
-
|
|
587
476
|
_rowExpansionIsControlled() {
|
|
588
477
|
return Array.isArray(this.getProp('expandedRowKeys'));
|
|
589
478
|
}
|
|
590
|
-
|
|
591
479
|
_pagerIsControlled() {
|
|
592
480
|
return (0, _get2.default)(this.getProp('pagination'), 'currentPage') != null;
|
|
593
481
|
}
|
|
594
|
-
|
|
595
482
|
_selectionIsControlled() {
|
|
596
483
|
return Array.isArray((0, _get2.default)(this.getProp('rowSelection'), 'selectedRowKeys'));
|
|
597
484
|
}
|
|
@@ -601,8 +488,6 @@ class TableFoundation extends _foundation.default {
|
|
|
601
488
|
* @param {String} dataIndex
|
|
602
489
|
* @returns {Boolean}
|
|
603
490
|
*/
|
|
604
|
-
|
|
605
|
-
|
|
606
491
|
_sorterIsControlled(dataIndex) {
|
|
607
492
|
// The basis for judgment should be props columns instead of cachedColumns fix#1141
|
|
608
493
|
const query = dataIndex && this.getQuery(dataIndex, this.getState('flattenColumns'));
|
|
@@ -614,46 +499,39 @@ class TableFoundation extends _foundation.default {
|
|
|
614
499
|
* @param {String} dataIndex
|
|
615
500
|
* @returns {Boolean}
|
|
616
501
|
*/
|
|
617
|
-
|
|
618
|
-
|
|
619
502
|
_filterIsControlled(dataIndex) {
|
|
620
503
|
const query = dataIndex && this.getQuery(dataIndex, this.getState('flattenColumns'));
|
|
621
504
|
return Boolean(query && Array.isArray(query.filteredValue));
|
|
622
505
|
}
|
|
623
|
-
|
|
624
506
|
_filterShowIsControlled(dataIndex) {
|
|
625
507
|
const query = dataIndex && this.getQuery(dataIndex, this.getState('flattenColumns'));
|
|
626
508
|
return Boolean(query && (query.filterDropdownVisible === true || query.filterDropdownVisible === false));
|
|
627
509
|
}
|
|
628
|
-
|
|
629
510
|
_getSelectedRowKeys() {
|
|
630
511
|
const rowSelection = this.getState('rowSelection');
|
|
631
512
|
const selectedRowKeys = (0, _get2.default)(rowSelection, 'selectedRowKeys', []);
|
|
632
513
|
return [...selectedRowKeys];
|
|
633
514
|
}
|
|
634
|
-
|
|
635
515
|
_getSelectedRowKeysSet() {
|
|
636
516
|
const rowSelection = this.getState('rowSelection');
|
|
637
517
|
const selectedRowKeysSet = (0, _get2.default)(rowSelection, 'selectedRowKeysSet', new Set());
|
|
638
518
|
return selectedRowKeysSet;
|
|
639
519
|
}
|
|
640
|
-
|
|
641
520
|
_getDataSource() {
|
|
642
521
|
return this.getProp('dataSource') || [];
|
|
643
522
|
}
|
|
644
|
-
|
|
645
523
|
_getRecord(realKey) {
|
|
646
524
|
return (0, _find2.default)(this.getProp('dataSource'), record => realKey != null && realKey !== '' && this.getRecordKey(record) === realKey);
|
|
647
525
|
}
|
|
648
|
-
|
|
649
526
|
_getRecordChildren(record) {
|
|
650
527
|
return (0, _get2.default)(record, this.getProp('childrenRecordName'));
|
|
651
528
|
}
|
|
652
|
-
|
|
653
529
|
_getPagination() {
|
|
654
530
|
return this.getState('pagination') || {};
|
|
655
531
|
}
|
|
656
|
-
|
|
532
|
+
/**
|
|
533
|
+
* Filters are considered valid if filteredValue exists
|
|
534
|
+
*/
|
|
657
535
|
_getAllFilters(queries) {
|
|
658
536
|
queries = queries || this.getState('queries');
|
|
659
537
|
const filters = [];
|
|
@@ -664,12 +542,10 @@ class TableFoundation extends _foundation.default {
|
|
|
664
542
|
});
|
|
665
543
|
return filters;
|
|
666
544
|
}
|
|
667
|
-
|
|
668
545
|
_getAllSorters(queries) {
|
|
669
546
|
queries = queries || this.getState('queries');
|
|
670
547
|
return (0, _filter2.default)(queries, query => query.sorter && query.sortOrder);
|
|
671
548
|
}
|
|
672
|
-
|
|
673
549
|
_filterQueries(targetQuery, queries) {
|
|
674
550
|
let keys = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ['dataIndex'];
|
|
675
551
|
queries = queries == null ? this.getState('queries') : queries;
|
|
@@ -677,7 +553,6 @@ class TableFoundation extends _foundation.default {
|
|
|
677
553
|
const filteredIndexes = [];
|
|
678
554
|
(0, _each2.default)(queries, (itQuery, index) => {
|
|
679
555
|
const flag = (0, _some2.default)(keys, k => k && targetQuery[k] != null && targetQuery[k] === itQuery[k]);
|
|
680
|
-
|
|
681
556
|
if (flag) {
|
|
682
557
|
filteredQueries.push(itQuery);
|
|
683
558
|
filteredIndexes.push(index);
|
|
@@ -688,18 +563,15 @@ class TableFoundation extends _foundation.default {
|
|
|
688
563
|
filteredIndexes
|
|
689
564
|
};
|
|
690
565
|
}
|
|
691
|
-
|
|
692
566
|
_mergeToQueries(query, queries) {
|
|
693
567
|
let keys = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ['dataIndex'];
|
|
694
568
|
queries = queries == null ? this.getState('queries') : queries;
|
|
695
569
|
queries = [...queries];
|
|
696
570
|
query = Object.assign({}, query);
|
|
697
|
-
|
|
698
571
|
const {
|
|
699
572
|
filteredQueries,
|
|
700
573
|
filteredIndexes
|
|
701
574
|
} = this._filterQueries(query, queries, keys);
|
|
702
|
-
|
|
703
575
|
(0, _each2.default)(filteredQueries, (curQuery, idx) => {
|
|
704
576
|
// assign(curQuery, query);
|
|
705
577
|
queries[filteredIndexes[idx]] = Object.assign({}, query);
|
|
@@ -711,53 +583,39 @@ class TableFoundation extends _foundation.default {
|
|
|
711
583
|
* @param {RecordType} record
|
|
712
584
|
* @returns {string}
|
|
713
585
|
*/
|
|
714
|
-
|
|
715
|
-
|
|
716
586
|
getRecordKey(record) {
|
|
717
587
|
if (!record) {
|
|
718
588
|
return undefined;
|
|
719
589
|
}
|
|
720
|
-
|
|
721
590
|
const rowKey = this.getProp('rowKey');
|
|
722
591
|
return typeof rowKey === 'function' ? rowKey(record) : (0, _get2.default)(record, rowKey);
|
|
723
592
|
}
|
|
724
|
-
|
|
725
593
|
isEmpty(dataSource) {
|
|
726
594
|
dataSource = dataSource == null ? this.getProp('dataSource') : dataSource;
|
|
727
595
|
return !(Array.isArray(dataSource) && dataSource.length > 0);
|
|
728
596
|
}
|
|
729
|
-
|
|
730
597
|
handleSelectRow(realKey, selected, e) {
|
|
731
598
|
this.stopPropagation(e);
|
|
732
|
-
|
|
733
599
|
if (typeof selected === 'boolean' && realKey != null) {
|
|
734
600
|
const selectedRowKeys = this._getSelectedRowKeys();
|
|
735
|
-
|
|
736
601
|
let foundIdx = -1;
|
|
737
602
|
const selectedRow = this.getSelectedRows(null, [realKey])[0];
|
|
738
603
|
let selectedRows;
|
|
739
|
-
|
|
740
604
|
if ((foundIdx = selectedRowKeys.indexOf(realKey)) > -1 && selected === false) {
|
|
741
605
|
selectedRowKeys.splice(foundIdx, 1);
|
|
742
606
|
selectedRows = this.getSelectedRows(null, selectedRowKeys);
|
|
743
|
-
|
|
744
607
|
if (!this._selectionIsControlled()) {
|
|
745
608
|
this._adapter.setSelectedRowKeys(selectedRowKeys);
|
|
746
609
|
}
|
|
747
|
-
|
|
748
610
|
this._adapter.notifySelect(selectedRow, selected, selectedRows, e);
|
|
749
|
-
|
|
750
611
|
this._adapter.notifySelectionChange(selectedRowKeys, selectedRows);
|
|
751
612
|
} else if (selectedRowKeys.indexOf(realKey) === -1 && selected === true) {
|
|
752
613
|
selectedRowKeys.push(realKey);
|
|
753
614
|
selectedRows = this.getSelectedRows(null, selectedRowKeys);
|
|
754
|
-
|
|
755
615
|
if (!this._selectionIsControlled()) {
|
|
756
616
|
this._adapter.setSelectedRowKeys(selectedRowKeys);
|
|
757
617
|
}
|
|
758
|
-
|
|
759
618
|
this._adapter.notifySelect(selectedRow, selected, selectedRows, e);
|
|
760
|
-
|
|
761
619
|
this._adapter.notifySelectionChange(selectedRowKeys, selectedRows);
|
|
762
620
|
}
|
|
763
621
|
}
|
|
@@ -767,49 +625,35 @@ class TableFoundation extends _foundation.default {
|
|
|
767
625
|
* @param {*} selected The future state of the select all button
|
|
768
626
|
* @param {*} e
|
|
769
627
|
*/
|
|
770
|
-
|
|
771
|
-
|
|
772
628
|
handleSelectAllRow(selected, e) {
|
|
773
629
|
this.stopPropagation(e);
|
|
774
|
-
|
|
775
630
|
if (typeof selected === 'boolean') {
|
|
776
631
|
const curSelectedRowKeys = this._getSelectedRowKeys();
|
|
777
|
-
|
|
778
632
|
let selectedRowKeys = [...curSelectedRowKeys];
|
|
779
|
-
|
|
780
633
|
const selectedRowKeysSet = this._getSelectedRowKeysSet();
|
|
781
|
-
|
|
782
634
|
let allRowKeys = [...this._adapter.getCachedFilteredSortedRowKeys()];
|
|
783
|
-
|
|
784
635
|
const disabledRowKeys = this._adapter.getAllDisabledRowKeys();
|
|
785
|
-
|
|
786
636
|
const disabledRowKeysSet = this._adapter.getAllDisabledRowKeysSet();
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
637
|
+
let changedRowKeys;
|
|
638
|
+
// Select all, if not disabled && not in selectedRowKeys
|
|
790
639
|
if (selected) {
|
|
791
640
|
for (const key of allRowKeys) {
|
|
792
641
|
if (!disabledRowKeysSet.has(key) && !selectedRowKeysSet.has(key)) {
|
|
793
642
|
selectedRowKeys.push(key);
|
|
794
643
|
}
|
|
795
644
|
}
|
|
796
|
-
|
|
797
645
|
allRowKeys = (0, _array.pullAll)(allRowKeys, [...disabledRowKeys, ...curSelectedRowKeys]);
|
|
798
646
|
changedRowKeys = [...allRowKeys];
|
|
799
647
|
} else {
|
|
800
648
|
selectedRowKeys = (0, _array.pullAll)(selectedRowKeys, allRowKeys);
|
|
801
649
|
changedRowKeys = [...curSelectedRowKeys];
|
|
802
650
|
}
|
|
803
|
-
|
|
804
651
|
const changedRows = this.getSelectedRows(null, changedRowKeys || []);
|
|
805
652
|
const selectedRows = this.getSelectedRows(null, selectedRowKeys || []);
|
|
806
|
-
|
|
807
653
|
if (!this._selectionIsControlled()) {
|
|
808
654
|
this._adapter.setSelectedRowKeys(selectedRowKeys);
|
|
809
655
|
}
|
|
810
|
-
|
|
811
656
|
this._adapter.notifySelectAll(selected, selectedRows, changedRows, e);
|
|
812
|
-
|
|
813
657
|
this._adapter.notifySelectionChange(selectedRowKeys, selectedRows);
|
|
814
658
|
}
|
|
815
659
|
}
|
|
@@ -819,27 +663,20 @@ class TableFoundation extends _foundation.default {
|
|
|
819
663
|
* @param {*} selectedRowKeys
|
|
820
664
|
* @param {*} selectedRowKeysSet Recursive optimization
|
|
821
665
|
*/
|
|
822
|
-
|
|
823
|
-
|
|
824
666
|
getSelectedRows(dataSource, selectedRowKeys, selectedRowKeysSet) {
|
|
825
667
|
dataSource = dataSource == null ? this._getDataSource() : dataSource;
|
|
826
668
|
selectedRowKeys = selectedRowKeys == null ? this._getSelectedRowKeys() : selectedRowKeys;
|
|
827
|
-
|
|
828
669
|
if (!(0, _isSet2.default)(selectedRowKeysSet)) {
|
|
829
670
|
selectedRowKeysSet = new Set(selectedRowKeys);
|
|
830
671
|
}
|
|
831
|
-
|
|
832
672
|
const childrenRecordName = this.getProp('childrenRecordName');
|
|
833
673
|
const selectedRows = [];
|
|
834
|
-
|
|
835
674
|
if ((0, _isSet2.default)(selectedRowKeysSet) && selectedRowKeysSet.size && Array.isArray(dataSource) && dataSource.length) {
|
|
836
675
|
// Time complexity optimization, replace the includes operation of array with has of set
|
|
837
676
|
selectedRows.push(...dataSource.filter(data => selectedRowKeysSet.has(this.getRecordKey(data))));
|
|
838
|
-
|
|
839
677
|
if (selectedRows.length < selectedRowKeys.length) {
|
|
840
678
|
for (const item of dataSource) {
|
|
841
679
|
const children = (0, _get2.default)(item, childrenRecordName);
|
|
842
|
-
|
|
843
680
|
if (Array.isArray(children) && children.length) {
|
|
844
681
|
const rows = this.getSelectedRows(children, selectedRowKeys, selectedRowKeysSet);
|
|
845
682
|
selectedRows.push(...rows);
|
|
@@ -847,54 +684,42 @@ class TableFoundation extends _foundation.default {
|
|
|
847
684
|
}
|
|
848
685
|
}
|
|
849
686
|
}
|
|
850
|
-
|
|
851
687
|
return selectedRows;
|
|
852
688
|
}
|
|
853
|
-
|
|
854
689
|
getAllDisabledRowKeys(dataSource, getCheckboxProps) {
|
|
855
690
|
dataSource = dataSource == null ? this._getDataSource() : dataSource;
|
|
856
691
|
getCheckboxProps = getCheckboxProps == null ? (0, _get2.default)(this.getProp('rowSelection'), 'getCheckboxProps') : getCheckboxProps;
|
|
857
692
|
const childrenRecordName = this.getProp('childrenRecordName');
|
|
858
693
|
const disabledRowKeys = [];
|
|
859
|
-
|
|
860
694
|
if (Array.isArray(dataSource) && dataSource.length && typeof getCheckboxProps === 'function') {
|
|
861
695
|
for (const record of dataSource) {
|
|
862
696
|
const props = getCheckboxProps(record);
|
|
863
|
-
|
|
864
697
|
if (props && props.disabled) {
|
|
865
698
|
disabledRowKeys.push(this.getRecordKey(record));
|
|
866
699
|
}
|
|
867
|
-
|
|
868
700
|
const children = (0, _get2.default)(record, childrenRecordName);
|
|
869
|
-
|
|
870
701
|
if (Array.isArray(children) && children.length) {
|
|
871
702
|
const keys = this.getAllDisabledRowKeys(children, getCheckboxProps);
|
|
872
703
|
disabledRowKeys.push(...keys);
|
|
873
704
|
}
|
|
874
705
|
}
|
|
875
706
|
}
|
|
876
|
-
|
|
877
707
|
return disabledRowKeys;
|
|
878
708
|
}
|
|
879
|
-
|
|
880
709
|
getAllRowKeys(dataSource) {
|
|
881
710
|
dataSource = dataSource == null ? this._getDataSource() : dataSource;
|
|
882
711
|
const childrenRecordName = this.getProp('childrenRecordName');
|
|
883
712
|
const allRowKeys = [];
|
|
884
|
-
|
|
885
713
|
if (Array.isArray(dataSource) && dataSource.length) {
|
|
886
714
|
for (const record of dataSource) {
|
|
887
715
|
const childrenRowKeys = [];
|
|
888
716
|
const children = (0, _get2.default)(record, childrenRecordName);
|
|
889
|
-
|
|
890
717
|
if (Array.isArray(children) && children.length) {
|
|
891
718
|
childrenRowKeys.push(...this.getAllRowKeys(children));
|
|
892
719
|
}
|
|
893
|
-
|
|
894
720
|
allRowKeys.push(this.getRecordKey(record), ...childrenRowKeys);
|
|
895
721
|
}
|
|
896
722
|
}
|
|
897
|
-
|
|
898
723
|
return allRowKeys;
|
|
899
724
|
}
|
|
900
725
|
/**
|
|
@@ -902,8 +727,6 @@ class TableFoundation extends _foundation.default {
|
|
|
902
727
|
* @param {Array} selectedRowKeys
|
|
903
728
|
* @param {Set} allRowKeysSet
|
|
904
729
|
*/
|
|
905
|
-
|
|
906
|
-
|
|
907
730
|
hasRowSelected(selectedRowKeys, allRowKeysSet) {
|
|
908
731
|
return Boolean(Array.isArray(selectedRowKeys) && selectedRowKeys.length && (0, _isSet2.default)(allRowKeysSet) && allRowKeysSet.size && selectedRowKeys.filter(key => allRowKeysSet.has(key)).length);
|
|
909
732
|
}
|
|
@@ -913,38 +736,31 @@ class TableFoundation extends _foundation.default {
|
|
|
913
736
|
* @param {String} realKey
|
|
914
737
|
* @param {Event} domEvent
|
|
915
738
|
*/
|
|
916
|
-
|
|
917
|
-
|
|
918
739
|
handleRowExpanded(expanded, realKey, domEvent) {
|
|
919
740
|
this.stopPropagation(domEvent);
|
|
920
741
|
const expandedRowKeys = [...this.getState('expandedRowKeys')];
|
|
921
742
|
const index = expandedRowKeys.indexOf(realKey);
|
|
922
743
|
const keyIsValid = typeof realKey === 'string' || typeof realKey === 'number';
|
|
923
|
-
|
|
924
744
|
if (keyIsValid && expanded && index === -1) {
|
|
925
745
|
expandedRowKeys.push(realKey);
|
|
926
746
|
} else if (keyIsValid && !expanded && index > -1) {
|
|
927
747
|
expandedRowKeys.splice(index, 1);
|
|
928
748
|
}
|
|
929
|
-
|
|
930
749
|
if (!this._rowExpansionIsControlled()) {
|
|
931
750
|
this._adapter.setExpandedRowKeys(expandedRowKeys);
|
|
932
751
|
}
|
|
933
|
-
|
|
934
752
|
const expandedRows = this.getSelectedRows(null, expandedRowKeys);
|
|
935
|
-
let expandedRow = this.getSelectedRows(null, [realKey])[0];
|
|
936
|
-
|
|
753
|
+
let expandedRow = this.getSelectedRows(null, [realKey])[0];
|
|
754
|
+
// groups record processing
|
|
937
755
|
const groups = this._getGroups();
|
|
938
|
-
|
|
939
756
|
if (groups) {
|
|
940
757
|
// Construct group expandRow
|
|
941
758
|
if (groups.has(realKey)) {
|
|
942
759
|
expandedRow = {
|
|
943
760
|
groupKey: realKey
|
|
944
761
|
};
|
|
945
|
-
}
|
|
946
|
-
|
|
947
|
-
|
|
762
|
+
}
|
|
763
|
+
// If expandedRowKeys includes groupKey, add to expandedRows
|
|
948
764
|
for (let i = 0, len = expandedRowKeys.length; i < len; i++) {
|
|
949
765
|
if (groups.has(realKey)) {
|
|
950
766
|
expandedRows.push({
|
|
@@ -953,26 +769,19 @@ class TableFoundation extends _foundation.default {
|
|
|
953
769
|
}
|
|
954
770
|
}
|
|
955
771
|
}
|
|
956
|
-
|
|
957
772
|
this._adapter.notifyExpand(expanded, expandedRow, domEvent);
|
|
958
|
-
|
|
959
773
|
this._adapter.notifyExpandedRowsChange(expandedRows);
|
|
960
774
|
}
|
|
961
775
|
/**
|
|
962
776
|
* get state.groups
|
|
963
777
|
* @returns {Map|Null}
|
|
964
778
|
*/
|
|
965
|
-
|
|
966
|
-
|
|
967
779
|
_getGroups() {
|
|
968
780
|
const groupBy = this._adapter.getProp('groupBy');
|
|
969
|
-
|
|
970
781
|
if (groupBy !== null) {
|
|
971
782
|
const groups = this._adapter.getState('groups');
|
|
972
|
-
|
|
973
783
|
return groups;
|
|
974
784
|
}
|
|
975
|
-
|
|
976
785
|
return null;
|
|
977
786
|
}
|
|
978
787
|
/**
|
|
@@ -981,18 +790,14 @@ class TableFoundation extends _foundation.default {
|
|
|
981
790
|
* @param {Set} disabledRowKeysSet
|
|
982
791
|
* @param {Array} allKeys keys after sorted and filtered
|
|
983
792
|
*/
|
|
984
|
-
|
|
985
|
-
|
|
986
793
|
allIsSelected(selectedRowKeysSet, disabledRowKeysSet, allKeys) {
|
|
987
794
|
const filteredAllKeys = (0, _filter2.default)(allKeys, key => key != null && !disabledRowKeysSet.has(key));
|
|
988
|
-
|
|
989
795
|
if (filteredAllKeys && filteredAllKeys.length) {
|
|
990
796
|
for (const key of filteredAllKeys) {
|
|
991
797
|
if (key != null && !selectedRowKeysSet.has(key)) {
|
|
992
798
|
return false;
|
|
993
799
|
}
|
|
994
800
|
}
|
|
995
|
-
|
|
996
801
|
return true;
|
|
997
802
|
} else {
|
|
998
803
|
return false;
|
|
@@ -1003,18 +808,14 @@ class TableFoundation extends _foundation.default {
|
|
|
1003
808
|
* @param {*} selectedRowKeys
|
|
1004
809
|
* @param {*} allKeys
|
|
1005
810
|
*/
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
811
|
allIsNotSelected(selectedRowKeys, allKeys) {
|
|
1009
812
|
for (const key of allKeys) {
|
|
1010
813
|
if (key != null && Array.isArray(selectedRowKeys) && selectedRowKeys.includes(key)) {
|
|
1011
814
|
return true;
|
|
1012
815
|
}
|
|
1013
816
|
}
|
|
1014
|
-
|
|
1015
817
|
return false;
|
|
1016
818
|
}
|
|
1017
|
-
|
|
1018
819
|
formatPaginationInfo() {
|
|
1019
820
|
let pagination = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1020
821
|
let defaultPageText = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
@@ -1027,7 +828,6 @@ class TableFoundation extends _foundation.default {
|
|
|
1027
828
|
} = pagination;
|
|
1028
829
|
const currentStart = Math.min((currentPage - 1) * pageSize + 1, total);
|
|
1029
830
|
const currentEnd = Math.min(currentPage * pageSize, total);
|
|
1030
|
-
|
|
1031
831
|
if (formatPageText || formatPageText !== false && defaultPageText && total > 0) {
|
|
1032
832
|
info = typeof formatPageText === 'function' ? formatPageText({
|
|
1033
833
|
currentStart,
|
|
@@ -1035,24 +835,21 @@ class TableFoundation extends _foundation.default {
|
|
|
1035
835
|
total
|
|
1036
836
|
}) : defaultPageText.replace('${currentStart}', currentStart).replace('${currentEnd}', currentEnd).replace('${total}', total);
|
|
1037
837
|
}
|
|
1038
|
-
|
|
1039
838
|
return info;
|
|
1040
839
|
}
|
|
1041
|
-
|
|
1042
840
|
toggleShowFilter(dataIndex, visible) {
|
|
1043
841
|
let filterObj = this.getQuery(dataIndex);
|
|
1044
|
-
const filterDropdownVisible = visible;
|
|
1045
|
-
|
|
842
|
+
const filterDropdownVisible = visible;
|
|
843
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1046
844
|
filterObj = Object.assign(Object.assign({}, filterObj), {
|
|
1047
845
|
filterDropdownVisible
|
|
1048
846
|
});
|
|
1049
|
-
|
|
1050
|
-
|
|
847
|
+
if (!this._filterShowIsControlled()) {
|
|
848
|
+
// this._adapter.setQuery({
|
|
1051
849
|
// ...filterObj,
|
|
1052
850
|
// filterDropdownVisible,
|
|
1053
851
|
// });
|
|
1054
852
|
}
|
|
1055
|
-
|
|
1056
853
|
this._adapter.notifyFilterDropdownVisibleChange(filterDropdownVisible, dataIndex);
|
|
1057
854
|
}
|
|
1058
855
|
/**
|
|
@@ -1060,8 +857,6 @@ class TableFoundation extends _foundation.default {
|
|
|
1060
857
|
* @param {*} dataIndex
|
|
1061
858
|
* @param {*} data
|
|
1062
859
|
*/
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
860
|
handleFilterSelect(dataIndex) {
|
|
1066
861
|
let data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1067
862
|
let query = this.getQuery(dataIndex);
|
|
@@ -1073,17 +868,12 @@ class TableFoundation extends _foundation.default {
|
|
|
1073
868
|
filteredValue
|
|
1074
869
|
});
|
|
1075
870
|
queries = (0, _utils.mergeQueries)(query, queries);
|
|
1076
|
-
|
|
1077
871
|
const mergedQueries = this._mergeToQueries(query, null);
|
|
1078
|
-
|
|
1079
872
|
const filters = this._getAllFilters(mergedQueries);
|
|
1080
|
-
|
|
1081
873
|
if (!this._filterIsControlled(dataIndex)) {
|
|
1082
874
|
this._adapter.setQueries(queries);
|
|
1083
|
-
|
|
1084
875
|
this.handleClickFilterOrSorter(queries);
|
|
1085
876
|
}
|
|
1086
|
-
|
|
1087
877
|
this._notifyChange(null, filters);
|
|
1088
878
|
}
|
|
1089
879
|
/**
|
|
@@ -1091,8 +881,6 @@ class TableFoundation extends _foundation.default {
|
|
|
1091
881
|
* @param {*} column
|
|
1092
882
|
* @param {*} e
|
|
1093
883
|
*/
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
884
|
handleSort() {
|
|
1097
885
|
let column = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1098
886
|
let e = arguments.length > 1 ? arguments[1] : undefined;
|
|
@@ -1109,7 +897,6 @@ class TableFoundation extends _foundation.default {
|
|
|
1109
897
|
const stateSortOrder = (0, _get2.default)(sorterObj, 'sortOrder');
|
|
1110
898
|
const defaultSortOrder = (0, _get2.default)(sorterObj, 'defaultSortOrder', false);
|
|
1111
899
|
let querySortOrder = this.isSortOrderValid(stateSortOrder) ? stateSortOrder : defaultSortOrder;
|
|
1112
|
-
|
|
1113
900
|
if (dataIndex && dataIndex === sorterObj.dataIndex) {
|
|
1114
901
|
if (querySortOrder === _constants.strings.SORT_DIRECTIONS[0]) {
|
|
1115
902
|
querySortOrder = _constants.strings.SORT_DIRECTIONS[1];
|
|
@@ -1122,32 +909,25 @@ class TableFoundation extends _foundation.default {
|
|
|
1122
909
|
// This results in the current click only supports single column sorting
|
|
1123
910
|
querySortOrder = false;
|
|
1124
911
|
}
|
|
1125
|
-
|
|
1126
912
|
arr[idx] = Object.assign(Object.assign({}, sorterObj), {
|
|
1127
913
|
sortOrder: querySortOrder
|
|
1128
914
|
});
|
|
1129
|
-
|
|
1130
915
|
if (dataIndex === sorterObj.dataIndex) {
|
|
1131
916
|
curQuery = arr[idx];
|
|
1132
917
|
}
|
|
1133
918
|
}
|
|
1134
919
|
});
|
|
1135
|
-
|
|
1136
920
|
if (!this._sorterIsControlled(dataIndex)) {
|
|
1137
921
|
this._adapter.setQueries(queries);
|
|
1138
|
-
|
|
1139
922
|
this.handleClickFilterOrSorter(queries);
|
|
1140
|
-
}
|
|
1141
|
-
|
|
1142
|
-
|
|
923
|
+
}
|
|
924
|
+
// notify sort event
|
|
1143
925
|
this._notifyChange(null, null, curQuery, null);
|
|
1144
926
|
}
|
|
1145
927
|
/**
|
|
1146
928
|
* Recalculate the cached data after clicking filter or sorter
|
|
1147
929
|
* @param {*} queries
|
|
1148
930
|
*/
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
931
|
handleClickFilterOrSorter(queries) {
|
|
1152
932
|
const dataSource = [...this.getProp('dataSource')];
|
|
1153
933
|
const sortedDataSource = this.getFilteredSortedDataSource(dataSource, queries);
|
|
@@ -1157,38 +937,28 @@ class TableFoundation extends _foundation.default {
|
|
|
1157
937
|
const pageData = this.getCurrentPageData(sortedDataSource);
|
|
1158
938
|
this.setAdapterPageData(pageData);
|
|
1159
939
|
}
|
|
1160
|
-
|
|
1161
940
|
getQuery(dataIndex, queries) {
|
|
1162
941
|
queries = queries || this.getState('queries');
|
|
1163
|
-
|
|
1164
942
|
if (dataIndex != null) {
|
|
1165
943
|
return (0, _find2.default)(queries, query => query.dataIndex === dataIndex);
|
|
1166
944
|
}
|
|
1167
|
-
|
|
1168
945
|
return undefined;
|
|
1169
946
|
}
|
|
1170
|
-
|
|
1171
947
|
getCellWidths(flattenedColumns, flattenedWidths, ignoreScrollBarKey) {
|
|
1172
948
|
return this._adapter.getCellWidths(flattenedColumns, flattenedWidths, ignoreScrollBarKey);
|
|
1173
949
|
}
|
|
1174
|
-
|
|
1175
950
|
setHeadWidths(headWidths, index) {
|
|
1176
951
|
return this._adapter.setHeadWidths(headWidths, index);
|
|
1177
952
|
}
|
|
1178
|
-
|
|
1179
953
|
getHeadWidths(index) {
|
|
1180
954
|
return this._adapter.getHeadWidths(index);
|
|
1181
955
|
}
|
|
1182
|
-
|
|
1183
956
|
mergedRowExpandable(record) {
|
|
1184
957
|
return this._adapter.mergedRowExpandable(record);
|
|
1185
958
|
}
|
|
1186
|
-
|
|
1187
959
|
setBodyHasScrollbar(bodyHasScrollbar) {
|
|
1188
960
|
this._adapter.setBodyHasScrollbar(bodyHasScrollbar);
|
|
1189
961
|
}
|
|
1190
|
-
|
|
1191
962
|
}
|
|
1192
|
-
|
|
1193
963
|
var _default = TableFoundation;
|
|
1194
964
|
exports.default = _default;
|