@douyinfe/semi-foundation 2.36.0-beta.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/foundation.ts +2 -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/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.js +0 -4
- 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 +24 -24
- 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 +3 -3
- package/lib/cjs/datePicker/monthsGridFoundation.js +43 -238
- package/lib/cjs/datePicker/yearAndMonthFoundation.d.ts +1 -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.js +3 -21
- 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/constants.js +0 -2
- 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 +71 -302
- 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/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 +1 -1
- package/lib/cjs/timePicker/foundation.js +3 -97
- 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/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.js +0 -2
- package/lib/cjs/typography/formatNumeral.d.ts +3 -3
- package/lib/cjs/typography/formatNumeral.js +16 -32
- 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/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.js +0 -3
- 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 +24 -24
- 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 +3 -3
- package/lib/es/datePicker/monthsGridFoundation.js +42 -222
- package/lib/es/datePicker/yearAndMonthFoundation.d.ts +1 -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.js +3 -18
- 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/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 +71 -309
- 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/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 +1 -1
- package/lib/es/timePicker/foundation.js +4 -90
- 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/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/formatNumeral.d.ts +3 -3
- package/lib/es/typography/formatNumeral.js +16 -29
- 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/package.json +2 -2
- package/table/foundation.ts +7 -10
- 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,9 @@ 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
|
|
440
359
|
[...children])
|
|
441
360
|
}));
|
|
442
361
|
}
|
|
@@ -447,20 +366,16 @@ class TableFoundation extends _foundation.default {
|
|
|
447
366
|
});
|
|
448
367
|
}
|
|
449
368
|
});
|
|
450
|
-
|
|
451
369
|
if (hasValidFilters) {
|
|
452
370
|
dataSource = Array.from(filteredData && filteredData.values());
|
|
453
371
|
}
|
|
454
|
-
|
|
455
372
|
return dataSource;
|
|
456
373
|
}
|
|
457
|
-
|
|
458
374
|
limitPageDataSource(dataSource, pagination) {
|
|
459
375
|
dataSource = dataSource == null ? this.getProp('dataSource') : dataSource;
|
|
460
376
|
pagination = pagination == null ? this.getState('pagination') : pagination;
|
|
461
377
|
let pageData = dataSource;
|
|
462
378
|
const pageNo = (0, _get2.default)(pagination, 'currentPage');
|
|
463
|
-
|
|
464
379
|
if (this.getProp('pagination') !== false && pageNo && dataSource && pagination && !this._pagerIsControlled()) {
|
|
465
380
|
const {
|
|
466
381
|
pageSize = _constants.numbers.DEFAULT_PAGE_SIZE
|
|
@@ -469,15 +384,12 @@ class TableFoundation extends _foundation.default {
|
|
|
469
384
|
const end = pageNo * pageSize;
|
|
470
385
|
pageData = (0, _slice2.default)(dataSource, start, end);
|
|
471
386
|
}
|
|
472
|
-
|
|
473
387
|
return pageData;
|
|
474
388
|
}
|
|
475
|
-
|
|
476
389
|
normalizePagination(pagination, dataSource) {
|
|
477
390
|
pagination = pagination == null ? this._getPagination() : pagination;
|
|
478
391
|
dataSource = dataSource == null ? this._getDataSource() : dataSource;
|
|
479
392
|
const propPagination = this.getProp('pagination');
|
|
480
|
-
|
|
481
393
|
if (pagination) {
|
|
482
394
|
pagination = typeof pagination === 'object' ? Object.assign({}, pagination) : {};
|
|
483
395
|
pagination = (0, _merge2.default)({
|
|
@@ -486,7 +398,6 @@ class TableFoundation extends _foundation.default {
|
|
|
486
398
|
currentPage: (0, _get2.default)(propPagination, 'defaultCurrentPage', 1),
|
|
487
399
|
position: _constants.strings.PAGINATION_POSITIONS[0]
|
|
488
400
|
}, pagination);
|
|
489
|
-
|
|
490
401
|
if (!this._pagerIsControlled()) {
|
|
491
402
|
const total = (0, _get2.default)(propPagination, 'total', dataSource.length);
|
|
492
403
|
const pageSize = (0, _get2.default)(propPagination, 'pageSize', pagination.pageSize);
|
|
@@ -495,16 +406,13 @@ class TableFoundation extends _foundation.default {
|
|
|
495
406
|
} = pagination;
|
|
496
407
|
const realTotalPage = Math.ceil(total / pageSize);
|
|
497
408
|
pagination.total = total;
|
|
498
|
-
|
|
499
409
|
if (currentPage > realTotalPage) {
|
|
500
410
|
pagination.currentPage = 1;
|
|
501
411
|
}
|
|
502
412
|
}
|
|
503
413
|
}
|
|
504
|
-
|
|
505
414
|
return pagination;
|
|
506
415
|
}
|
|
507
|
-
|
|
508
416
|
setAdapterPageData() {
|
|
509
417
|
let pageData = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
510
418
|
const {
|
|
@@ -514,30 +422,19 @@ class TableFoundation extends _foundation.default {
|
|
|
514
422
|
allRowKeys,
|
|
515
423
|
groups
|
|
516
424
|
} = pageData;
|
|
517
|
-
|
|
518
425
|
this._adapter.setDisabledRowKeys(disabledRowKeys);
|
|
519
|
-
|
|
520
426
|
this._adapter.setAllRowKeys(allRowKeys);
|
|
521
|
-
|
|
522
427
|
this._adapter.setPagination(pagination);
|
|
523
|
-
|
|
524
428
|
this._adapter.setGroups(groups);
|
|
525
|
-
|
|
526
429
|
this._adapter.setDataSource(dataSource);
|
|
527
430
|
}
|
|
528
|
-
|
|
529
431
|
destroy() {}
|
|
530
|
-
|
|
531
432
|
setAllDisabledRowKeys(disabledRowKeys) {
|
|
532
433
|
this._adapter.setAllDisabledRowKeys(disabledRowKeys);
|
|
533
434
|
}
|
|
534
|
-
|
|
535
435
|
handleClick(e) {}
|
|
536
|
-
|
|
537
436
|
handleMouseEnter(e) {}
|
|
538
|
-
|
|
539
437
|
handleMouseLeave(e) {}
|
|
540
|
-
|
|
541
438
|
stopPropagation(e) {
|
|
542
439
|
this._adapter.stopPropagation(e);
|
|
543
440
|
}
|
|
@@ -546,15 +443,11 @@ class TableFoundation extends _foundation.default {
|
|
|
546
443
|
* @param {Array} srcArr
|
|
547
444
|
* @param {Object} objArrs
|
|
548
445
|
*/
|
|
549
|
-
|
|
550
|
-
|
|
551
446
|
_addNoDuplicatedItemsToArr() {
|
|
552
447
|
let srcArr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
553
|
-
|
|
554
448
|
for (var _len = arguments.length, objArrs = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
555
449
|
objArrs[_key - 1] = arguments[_key];
|
|
556
450
|
}
|
|
557
|
-
|
|
558
451
|
for (const objArr of objArrs) {
|
|
559
452
|
if (Array.isArray(objArr)) {
|
|
560
453
|
for (const item of objArr) {
|
|
@@ -564,19 +457,15 @@ class TableFoundation extends _foundation.default {
|
|
|
564
457
|
}
|
|
565
458
|
}
|
|
566
459
|
}
|
|
567
|
-
|
|
568
460
|
return srcArr;
|
|
569
461
|
}
|
|
570
|
-
|
|
571
462
|
_notifyChange(pagination, filters, sorter, extra) {
|
|
572
463
|
pagination = pagination == null ? this._getPagination() : pagination;
|
|
573
464
|
filters = filters == null ? this._getAllFilters() : filters;
|
|
574
465
|
sorter = sorter == null ? this._getAllSorters()[0] : sorter;
|
|
575
|
-
|
|
576
466
|
if ((0, _get2.default)(this.getProp('scroll'), 'scrollToFirstRowOnChange')) {
|
|
577
467
|
this._adapter.resetScrollY();
|
|
578
468
|
}
|
|
579
|
-
|
|
580
469
|
this._adapter.notifyChange({
|
|
581
470
|
pagination: Object.assign({}, pagination),
|
|
582
471
|
filters: [...filters],
|
|
@@ -584,15 +473,12 @@ class TableFoundation extends _foundation.default {
|
|
|
584
473
|
extra: Object.assign({}, extra)
|
|
585
474
|
});
|
|
586
475
|
}
|
|
587
|
-
|
|
588
476
|
_rowExpansionIsControlled() {
|
|
589
477
|
return Array.isArray(this.getProp('expandedRowKeys'));
|
|
590
478
|
}
|
|
591
|
-
|
|
592
479
|
_pagerIsControlled() {
|
|
593
480
|
return (0, _get2.default)(this.getProp('pagination'), 'currentPage') != null;
|
|
594
481
|
}
|
|
595
|
-
|
|
596
482
|
_selectionIsControlled() {
|
|
597
483
|
return Array.isArray((0, _get2.default)(this.getProp('rowSelection'), 'selectedRowKeys'));
|
|
598
484
|
}
|
|
@@ -602,8 +488,6 @@ class TableFoundation extends _foundation.default {
|
|
|
602
488
|
* @param {String} dataIndex
|
|
603
489
|
* @returns {Boolean}
|
|
604
490
|
*/
|
|
605
|
-
|
|
606
|
-
|
|
607
491
|
_sorterIsControlled(dataIndex) {
|
|
608
492
|
// The basis for judgment should be props columns instead of cachedColumns fix#1141
|
|
609
493
|
const query = dataIndex && this.getQuery(dataIndex, this.getState('flattenColumns'));
|
|
@@ -615,46 +499,39 @@ class TableFoundation extends _foundation.default {
|
|
|
615
499
|
* @param {String} dataIndex
|
|
616
500
|
* @returns {Boolean}
|
|
617
501
|
*/
|
|
618
|
-
|
|
619
|
-
|
|
620
502
|
_filterIsControlled(dataIndex) {
|
|
621
503
|
const query = dataIndex && this.getQuery(dataIndex, this.getState('flattenColumns'));
|
|
622
504
|
return Boolean(query && Array.isArray(query.filteredValue));
|
|
623
505
|
}
|
|
624
|
-
|
|
625
506
|
_filterShowIsControlled(dataIndex) {
|
|
626
507
|
const query = dataIndex && this.getQuery(dataIndex, this.getState('flattenColumns'));
|
|
627
508
|
return Boolean(query && (query.filterDropdownVisible === true || query.filterDropdownVisible === false));
|
|
628
509
|
}
|
|
629
|
-
|
|
630
510
|
_getSelectedRowKeys() {
|
|
631
511
|
const rowSelection = this.getState('rowSelection');
|
|
632
512
|
const selectedRowKeys = (0, _get2.default)(rowSelection, 'selectedRowKeys', []);
|
|
633
513
|
return [...selectedRowKeys];
|
|
634
514
|
}
|
|
635
|
-
|
|
636
515
|
_getSelectedRowKeysSet() {
|
|
637
516
|
const rowSelection = this.getState('rowSelection');
|
|
638
517
|
const selectedRowKeysSet = (0, _get2.default)(rowSelection, 'selectedRowKeysSet', new Set());
|
|
639
518
|
return selectedRowKeysSet;
|
|
640
519
|
}
|
|
641
|
-
|
|
642
520
|
_getDataSource() {
|
|
643
521
|
return this.getProp('dataSource') || [];
|
|
644
522
|
}
|
|
645
|
-
|
|
646
523
|
_getRecord(realKey) {
|
|
647
524
|
return (0, _find2.default)(this.getProp('dataSource'), record => realKey != null && realKey !== '' && this.getRecordKey(record) === realKey);
|
|
648
525
|
}
|
|
649
|
-
|
|
650
526
|
_getRecordChildren(record) {
|
|
651
527
|
return (0, _get2.default)(record, this.getProp('childrenRecordName'));
|
|
652
528
|
}
|
|
653
|
-
|
|
654
529
|
_getPagination() {
|
|
655
530
|
return this.getState('pagination') || {};
|
|
656
531
|
}
|
|
657
|
-
|
|
532
|
+
/**
|
|
533
|
+
* Filters are considered valid if filteredValue exists
|
|
534
|
+
*/
|
|
658
535
|
_getAllFilters(queries) {
|
|
659
536
|
queries = queries || this.getState('queries');
|
|
660
537
|
const filters = [];
|
|
@@ -665,12 +542,10 @@ class TableFoundation extends _foundation.default {
|
|
|
665
542
|
});
|
|
666
543
|
return filters;
|
|
667
544
|
}
|
|
668
|
-
|
|
669
545
|
_getAllSorters(queries) {
|
|
670
546
|
queries = queries || this.getState('queries');
|
|
671
547
|
return (0, _filter2.default)(queries, query => query.sorter && query.sortOrder);
|
|
672
548
|
}
|
|
673
|
-
|
|
674
549
|
_filterQueries(targetQuery, queries) {
|
|
675
550
|
let keys = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ['dataIndex'];
|
|
676
551
|
queries = queries == null ? this.getState('queries') : queries;
|
|
@@ -678,7 +553,6 @@ class TableFoundation extends _foundation.default {
|
|
|
678
553
|
const filteredIndexes = [];
|
|
679
554
|
(0, _each2.default)(queries, (itQuery, index) => {
|
|
680
555
|
const flag = (0, _some2.default)(keys, k => k && targetQuery[k] != null && targetQuery[k] === itQuery[k]);
|
|
681
|
-
|
|
682
556
|
if (flag) {
|
|
683
557
|
filteredQueries.push(itQuery);
|
|
684
558
|
filteredIndexes.push(index);
|
|
@@ -689,18 +563,15 @@ class TableFoundation extends _foundation.default {
|
|
|
689
563
|
filteredIndexes
|
|
690
564
|
};
|
|
691
565
|
}
|
|
692
|
-
|
|
693
566
|
_mergeToQueries(query, queries) {
|
|
694
567
|
let keys = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ['dataIndex'];
|
|
695
568
|
queries = queries == null ? this.getState('queries') : queries;
|
|
696
569
|
queries = [...queries];
|
|
697
570
|
query = Object.assign({}, query);
|
|
698
|
-
|
|
699
571
|
const {
|
|
700
572
|
filteredQueries,
|
|
701
573
|
filteredIndexes
|
|
702
574
|
} = this._filterQueries(query, queries, keys);
|
|
703
|
-
|
|
704
575
|
(0, _each2.default)(filteredQueries, (curQuery, idx) => {
|
|
705
576
|
// assign(curQuery, query);
|
|
706
577
|
queries[filteredIndexes[idx]] = Object.assign({}, query);
|
|
@@ -712,53 +583,39 @@ class TableFoundation extends _foundation.default {
|
|
|
712
583
|
* @param {RecordType} record
|
|
713
584
|
* @returns {string}
|
|
714
585
|
*/
|
|
715
|
-
|
|
716
|
-
|
|
717
586
|
getRecordKey(record) {
|
|
718
587
|
if (!record) {
|
|
719
588
|
return undefined;
|
|
720
589
|
}
|
|
721
|
-
|
|
722
590
|
const rowKey = this.getProp('rowKey');
|
|
723
591
|
return typeof rowKey === 'function' ? rowKey(record) : (0, _get2.default)(record, rowKey);
|
|
724
592
|
}
|
|
725
|
-
|
|
726
593
|
isEmpty(dataSource) {
|
|
727
594
|
dataSource = dataSource == null ? this.getProp('dataSource') : dataSource;
|
|
728
595
|
return !(Array.isArray(dataSource) && dataSource.length > 0);
|
|
729
596
|
}
|
|
730
|
-
|
|
731
597
|
handleSelectRow(realKey, selected, e) {
|
|
732
598
|
this.stopPropagation(e);
|
|
733
|
-
|
|
734
599
|
if (typeof selected === 'boolean' && realKey != null) {
|
|
735
600
|
const selectedRowKeys = this._getSelectedRowKeys();
|
|
736
|
-
|
|
737
601
|
let foundIdx = -1;
|
|
738
602
|
const selectedRow = this.getSelectedRows(null, [realKey])[0];
|
|
739
603
|
let selectedRows;
|
|
740
|
-
|
|
741
604
|
if ((foundIdx = selectedRowKeys.indexOf(realKey)) > -1 && selected === false) {
|
|
742
605
|
selectedRowKeys.splice(foundIdx, 1);
|
|
743
606
|
selectedRows = this.getSelectedRows(null, selectedRowKeys);
|
|
744
|
-
|
|
745
607
|
if (!this._selectionIsControlled()) {
|
|
746
608
|
this._adapter.setSelectedRowKeys(selectedRowKeys);
|
|
747
609
|
}
|
|
748
|
-
|
|
749
610
|
this._adapter.notifySelect(selectedRow, selected, selectedRows, e);
|
|
750
|
-
|
|
751
611
|
this._adapter.notifySelectionChange(selectedRowKeys, selectedRows);
|
|
752
612
|
} else if (selectedRowKeys.indexOf(realKey) === -1 && selected === true) {
|
|
753
613
|
selectedRowKeys.push(realKey);
|
|
754
614
|
selectedRows = this.getSelectedRows(null, selectedRowKeys);
|
|
755
|
-
|
|
756
615
|
if (!this._selectionIsControlled()) {
|
|
757
616
|
this._adapter.setSelectedRowKeys(selectedRowKeys);
|
|
758
617
|
}
|
|
759
|
-
|
|
760
618
|
this._adapter.notifySelect(selectedRow, selected, selectedRows, e);
|
|
761
|
-
|
|
762
619
|
this._adapter.notifySelectionChange(selectedRowKeys, selectedRows);
|
|
763
620
|
}
|
|
764
621
|
}
|
|
@@ -768,49 +625,35 @@ class TableFoundation extends _foundation.default {
|
|
|
768
625
|
* @param {*} selected The future state of the select all button
|
|
769
626
|
* @param {*} e
|
|
770
627
|
*/
|
|
771
|
-
|
|
772
|
-
|
|
773
628
|
handleSelectAllRow(selected, e) {
|
|
774
629
|
this.stopPropagation(e);
|
|
775
|
-
|
|
776
630
|
if (typeof selected === 'boolean') {
|
|
777
631
|
const curSelectedRowKeys = this._getSelectedRowKeys();
|
|
778
|
-
|
|
779
632
|
let selectedRowKeys = [...curSelectedRowKeys];
|
|
780
|
-
|
|
781
633
|
const selectedRowKeysSet = this._getSelectedRowKeysSet();
|
|
782
|
-
|
|
783
634
|
let allRowKeys = [...this._adapter.getCachedFilteredSortedRowKeys()];
|
|
784
|
-
|
|
785
635
|
const disabledRowKeys = this._adapter.getAllDisabledRowKeys();
|
|
786
|
-
|
|
787
636
|
const disabledRowKeysSet = this._adapter.getAllDisabledRowKeysSet();
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
637
|
+
let changedRowKeys;
|
|
638
|
+
// Select all, if not disabled && not in selectedRowKeys
|
|
791
639
|
if (selected) {
|
|
792
640
|
for (const key of allRowKeys) {
|
|
793
641
|
if (!disabledRowKeysSet.has(key) && !selectedRowKeysSet.has(key)) {
|
|
794
642
|
selectedRowKeys.push(key);
|
|
795
643
|
}
|
|
796
644
|
}
|
|
797
|
-
|
|
798
645
|
allRowKeys = (0, _array.pullAll)(allRowKeys, [...disabledRowKeys, ...curSelectedRowKeys]);
|
|
799
646
|
changedRowKeys = [...allRowKeys];
|
|
800
647
|
} else {
|
|
801
648
|
selectedRowKeys = (0, _array.pullAll)(selectedRowKeys, allRowKeys);
|
|
802
649
|
changedRowKeys = [...curSelectedRowKeys];
|
|
803
650
|
}
|
|
804
|
-
|
|
805
651
|
const changedRows = this.getSelectedRows(null, changedRowKeys || []);
|
|
806
652
|
const selectedRows = this.getSelectedRows(null, selectedRowKeys || []);
|
|
807
|
-
|
|
808
653
|
if (!this._selectionIsControlled()) {
|
|
809
654
|
this._adapter.setSelectedRowKeys(selectedRowKeys);
|
|
810
655
|
}
|
|
811
|
-
|
|
812
656
|
this._adapter.notifySelectAll(selected, selectedRows, changedRows, e);
|
|
813
|
-
|
|
814
657
|
this._adapter.notifySelectionChange(selectedRowKeys, selectedRows);
|
|
815
658
|
}
|
|
816
659
|
}
|
|
@@ -820,27 +663,20 @@ class TableFoundation extends _foundation.default {
|
|
|
820
663
|
* @param {*} selectedRowKeys
|
|
821
664
|
* @param {*} selectedRowKeysSet Recursive optimization
|
|
822
665
|
*/
|
|
823
|
-
|
|
824
|
-
|
|
825
666
|
getSelectedRows(dataSource, selectedRowKeys, selectedRowKeysSet) {
|
|
826
667
|
dataSource = dataSource == null ? this._getDataSource() : dataSource;
|
|
827
668
|
selectedRowKeys = selectedRowKeys == null ? this._getSelectedRowKeys() : selectedRowKeys;
|
|
828
|
-
|
|
829
669
|
if (!(0, _isSet2.default)(selectedRowKeysSet)) {
|
|
830
670
|
selectedRowKeysSet = new Set(selectedRowKeys);
|
|
831
671
|
}
|
|
832
|
-
|
|
833
672
|
const childrenRecordName = this.getProp('childrenRecordName');
|
|
834
673
|
const selectedRows = [];
|
|
835
|
-
|
|
836
674
|
if ((0, _isSet2.default)(selectedRowKeysSet) && selectedRowKeysSet.size && Array.isArray(dataSource) && dataSource.length) {
|
|
837
675
|
// Time complexity optimization, replace the includes operation of array with has of set
|
|
838
676
|
selectedRows.push(...dataSource.filter(data => selectedRowKeysSet.has(this.getRecordKey(data))));
|
|
839
|
-
|
|
840
677
|
if (selectedRows.length < selectedRowKeys.length) {
|
|
841
678
|
for (const item of dataSource) {
|
|
842
679
|
const children = (0, _get2.default)(item, childrenRecordName);
|
|
843
|
-
|
|
844
680
|
if (Array.isArray(children) && children.length) {
|
|
845
681
|
const rows = this.getSelectedRows(children, selectedRowKeys, selectedRowKeysSet);
|
|
846
682
|
selectedRows.push(...rows);
|
|
@@ -848,54 +684,42 @@ class TableFoundation extends _foundation.default {
|
|
|
848
684
|
}
|
|
849
685
|
}
|
|
850
686
|
}
|
|
851
|
-
|
|
852
687
|
return selectedRows;
|
|
853
688
|
}
|
|
854
|
-
|
|
855
689
|
getAllDisabledRowKeys(dataSource, getCheckboxProps) {
|
|
856
690
|
dataSource = dataSource == null ? this._getDataSource() : dataSource;
|
|
857
691
|
getCheckboxProps = getCheckboxProps == null ? (0, _get2.default)(this.getProp('rowSelection'), 'getCheckboxProps') : getCheckboxProps;
|
|
858
692
|
const childrenRecordName = this.getProp('childrenRecordName');
|
|
859
693
|
const disabledRowKeys = [];
|
|
860
|
-
|
|
861
694
|
if (Array.isArray(dataSource) && dataSource.length && typeof getCheckboxProps === 'function') {
|
|
862
695
|
for (const record of dataSource) {
|
|
863
696
|
const props = getCheckboxProps(record);
|
|
864
|
-
|
|
865
697
|
if (props && props.disabled) {
|
|
866
698
|
disabledRowKeys.push(this.getRecordKey(record));
|
|
867
699
|
}
|
|
868
|
-
|
|
869
700
|
const children = (0, _get2.default)(record, childrenRecordName);
|
|
870
|
-
|
|
871
701
|
if (Array.isArray(children) && children.length) {
|
|
872
702
|
const keys = this.getAllDisabledRowKeys(children, getCheckboxProps);
|
|
873
703
|
disabledRowKeys.push(...keys);
|
|
874
704
|
}
|
|
875
705
|
}
|
|
876
706
|
}
|
|
877
|
-
|
|
878
707
|
return disabledRowKeys;
|
|
879
708
|
}
|
|
880
|
-
|
|
881
709
|
getAllRowKeys(dataSource) {
|
|
882
710
|
dataSource = dataSource == null ? this._getDataSource() : dataSource;
|
|
883
711
|
const childrenRecordName = this.getProp('childrenRecordName');
|
|
884
712
|
const allRowKeys = [];
|
|
885
|
-
|
|
886
713
|
if (Array.isArray(dataSource) && dataSource.length) {
|
|
887
714
|
for (const record of dataSource) {
|
|
888
715
|
const childrenRowKeys = [];
|
|
889
716
|
const children = (0, _get2.default)(record, childrenRecordName);
|
|
890
|
-
|
|
891
717
|
if (Array.isArray(children) && children.length) {
|
|
892
718
|
childrenRowKeys.push(...this.getAllRowKeys(children));
|
|
893
719
|
}
|
|
894
|
-
|
|
895
720
|
allRowKeys.push(this.getRecordKey(record), ...childrenRowKeys);
|
|
896
721
|
}
|
|
897
722
|
}
|
|
898
|
-
|
|
899
723
|
return allRowKeys;
|
|
900
724
|
}
|
|
901
725
|
/**
|
|
@@ -903,8 +727,6 @@ class TableFoundation extends _foundation.default {
|
|
|
903
727
|
* @param {Array} selectedRowKeys
|
|
904
728
|
* @param {Set} allRowKeysSet
|
|
905
729
|
*/
|
|
906
|
-
|
|
907
|
-
|
|
908
730
|
hasRowSelected(selectedRowKeys, allRowKeysSet) {
|
|
909
731
|
return Boolean(Array.isArray(selectedRowKeys) && selectedRowKeys.length && (0, _isSet2.default)(allRowKeysSet) && allRowKeysSet.size && selectedRowKeys.filter(key => allRowKeysSet.has(key)).length);
|
|
910
732
|
}
|
|
@@ -914,38 +736,31 @@ class TableFoundation extends _foundation.default {
|
|
|
914
736
|
* @param {String} realKey
|
|
915
737
|
* @param {Event} domEvent
|
|
916
738
|
*/
|
|
917
|
-
|
|
918
|
-
|
|
919
739
|
handleRowExpanded(expanded, realKey, domEvent) {
|
|
920
740
|
this.stopPropagation(domEvent);
|
|
921
741
|
const expandedRowKeys = [...this.getState('expandedRowKeys')];
|
|
922
742
|
const index = expandedRowKeys.indexOf(realKey);
|
|
923
743
|
const keyIsValid = typeof realKey === 'string' || typeof realKey === 'number';
|
|
924
|
-
|
|
925
744
|
if (keyIsValid && expanded && index === -1) {
|
|
926
745
|
expandedRowKeys.push(realKey);
|
|
927
746
|
} else if (keyIsValid && !expanded && index > -1) {
|
|
928
747
|
expandedRowKeys.splice(index, 1);
|
|
929
748
|
}
|
|
930
|
-
|
|
931
749
|
if (!this._rowExpansionIsControlled()) {
|
|
932
750
|
this._adapter.setExpandedRowKeys(expandedRowKeys);
|
|
933
751
|
}
|
|
934
|
-
|
|
935
752
|
const expandedRows = this.getSelectedRows(null, expandedRowKeys);
|
|
936
|
-
let expandedRow = this.getSelectedRows(null, [realKey])[0];
|
|
937
|
-
|
|
753
|
+
let expandedRow = this.getSelectedRows(null, [realKey])[0];
|
|
754
|
+
// groups record processing
|
|
938
755
|
const groups = this._getGroups();
|
|
939
|
-
|
|
940
756
|
if (groups) {
|
|
941
757
|
// Construct group expandRow
|
|
942
758
|
if (groups.has(realKey)) {
|
|
943
759
|
expandedRow = {
|
|
944
760
|
groupKey: realKey
|
|
945
761
|
};
|
|
946
|
-
}
|
|
947
|
-
|
|
948
|
-
|
|
762
|
+
}
|
|
763
|
+
// If expandedRowKeys includes groupKey, add to expandedRows
|
|
949
764
|
for (let i = 0, len = expandedRowKeys.length; i < len; i++) {
|
|
950
765
|
if (groups.has(realKey)) {
|
|
951
766
|
expandedRows.push({
|
|
@@ -954,26 +769,19 @@ class TableFoundation extends _foundation.default {
|
|
|
954
769
|
}
|
|
955
770
|
}
|
|
956
771
|
}
|
|
957
|
-
|
|
958
772
|
this._adapter.notifyExpand(expanded, expandedRow, domEvent);
|
|
959
|
-
|
|
960
773
|
this._adapter.notifyExpandedRowsChange(expandedRows);
|
|
961
774
|
}
|
|
962
775
|
/**
|
|
963
776
|
* get state.groups
|
|
964
777
|
* @returns {Map|Null}
|
|
965
778
|
*/
|
|
966
|
-
|
|
967
|
-
|
|
968
779
|
_getGroups() {
|
|
969
780
|
const groupBy = this._adapter.getProp('groupBy');
|
|
970
|
-
|
|
971
781
|
if (groupBy !== null) {
|
|
972
782
|
const groups = this._adapter.getState('groups');
|
|
973
|
-
|
|
974
783
|
return groups;
|
|
975
784
|
}
|
|
976
|
-
|
|
977
785
|
return null;
|
|
978
786
|
}
|
|
979
787
|
/**
|
|
@@ -982,18 +790,14 @@ class TableFoundation extends _foundation.default {
|
|
|
982
790
|
* @param {Set} disabledRowKeysSet
|
|
983
791
|
* @param {Array} allKeys keys after sorted and filtered
|
|
984
792
|
*/
|
|
985
|
-
|
|
986
|
-
|
|
987
793
|
allIsSelected(selectedRowKeysSet, disabledRowKeysSet, allKeys) {
|
|
988
794
|
const filteredAllKeys = (0, _filter2.default)(allKeys, key => key != null && !disabledRowKeysSet.has(key));
|
|
989
|
-
|
|
990
795
|
if (filteredAllKeys && filteredAllKeys.length) {
|
|
991
796
|
for (const key of filteredAllKeys) {
|
|
992
797
|
if (key != null && !selectedRowKeysSet.has(key)) {
|
|
993
798
|
return false;
|
|
994
799
|
}
|
|
995
800
|
}
|
|
996
|
-
|
|
997
801
|
return true;
|
|
998
802
|
} else {
|
|
999
803
|
return false;
|
|
@@ -1004,18 +808,14 @@ class TableFoundation extends _foundation.default {
|
|
|
1004
808
|
* @param {*} selectedRowKeys
|
|
1005
809
|
* @param {*} allKeys
|
|
1006
810
|
*/
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
811
|
allIsNotSelected(selectedRowKeys, allKeys) {
|
|
1010
812
|
for (const key of allKeys) {
|
|
1011
813
|
if (key != null && Array.isArray(selectedRowKeys) && selectedRowKeys.includes(key)) {
|
|
1012
814
|
return true;
|
|
1013
815
|
}
|
|
1014
816
|
}
|
|
1015
|
-
|
|
1016
817
|
return false;
|
|
1017
818
|
}
|
|
1018
|
-
|
|
1019
819
|
formatPaginationInfo() {
|
|
1020
820
|
let pagination = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1021
821
|
let defaultPageText = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
@@ -1028,7 +828,6 @@ class TableFoundation extends _foundation.default {
|
|
|
1028
828
|
} = pagination;
|
|
1029
829
|
const currentStart = Math.min((currentPage - 1) * pageSize + 1, total);
|
|
1030
830
|
const currentEnd = Math.min(currentPage * pageSize, total);
|
|
1031
|
-
|
|
1032
831
|
if (formatPageText || formatPageText !== false && defaultPageText && total > 0) {
|
|
1033
832
|
info = typeof formatPageText === 'function' ? formatPageText({
|
|
1034
833
|
currentStart,
|
|
@@ -1036,24 +835,21 @@ class TableFoundation extends _foundation.default {
|
|
|
1036
835
|
total
|
|
1037
836
|
}) : defaultPageText.replace('${currentStart}', currentStart).replace('${currentEnd}', currentEnd).replace('${total}', total);
|
|
1038
837
|
}
|
|
1039
|
-
|
|
1040
838
|
return info;
|
|
1041
839
|
}
|
|
1042
|
-
|
|
1043
840
|
toggleShowFilter(dataIndex, visible) {
|
|
1044
841
|
let filterObj = this.getQuery(dataIndex);
|
|
1045
|
-
const filterDropdownVisible = visible;
|
|
1046
|
-
|
|
842
|
+
const filterDropdownVisible = visible;
|
|
843
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1047
844
|
filterObj = Object.assign(Object.assign({}, filterObj), {
|
|
1048
845
|
filterDropdownVisible
|
|
1049
846
|
});
|
|
1050
|
-
|
|
1051
|
-
|
|
847
|
+
if (!this._filterShowIsControlled()) {
|
|
848
|
+
// this._adapter.setQuery({
|
|
1052
849
|
// ...filterObj,
|
|
1053
850
|
// filterDropdownVisible,
|
|
1054
851
|
// });
|
|
1055
852
|
}
|
|
1056
|
-
|
|
1057
853
|
this._adapter.notifyFilterDropdownVisibleChange(filterDropdownVisible, dataIndex);
|
|
1058
854
|
}
|
|
1059
855
|
/**
|
|
@@ -1061,8 +857,6 @@ class TableFoundation extends _foundation.default {
|
|
|
1061
857
|
* @param {*} dataIndex
|
|
1062
858
|
* @param {*} data
|
|
1063
859
|
*/
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
860
|
handleFilterSelect(dataIndex) {
|
|
1067
861
|
let data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1068
862
|
let query = this.getQuery(dataIndex);
|
|
@@ -1074,17 +868,12 @@ class TableFoundation extends _foundation.default {
|
|
|
1074
868
|
filteredValue
|
|
1075
869
|
});
|
|
1076
870
|
queries = (0, _utils.mergeQueries)(query, queries);
|
|
1077
|
-
|
|
1078
871
|
const mergedQueries = this._mergeToQueries(query, null);
|
|
1079
|
-
|
|
1080
872
|
const filters = this._getAllFilters(mergedQueries);
|
|
1081
|
-
|
|
1082
873
|
if (!this._filterIsControlled(dataIndex)) {
|
|
1083
874
|
this._adapter.setQueries(queries);
|
|
1084
|
-
|
|
1085
875
|
this.handleClickFilterOrSorter(queries);
|
|
1086
876
|
}
|
|
1087
|
-
|
|
1088
877
|
this._notifyChange(null, filters);
|
|
1089
878
|
}
|
|
1090
879
|
/**
|
|
@@ -1092,8 +881,6 @@ class TableFoundation extends _foundation.default {
|
|
|
1092
881
|
* @param {*} column
|
|
1093
882
|
* @param {*} e
|
|
1094
883
|
*/
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
884
|
handleSort() {
|
|
1098
885
|
let column = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1099
886
|
let e = arguments.length > 1 ? arguments[1] : undefined;
|
|
@@ -1110,7 +897,6 @@ class TableFoundation extends _foundation.default {
|
|
|
1110
897
|
const stateSortOrder = (0, _get2.default)(sorterObj, 'sortOrder');
|
|
1111
898
|
const defaultSortOrder = (0, _get2.default)(sorterObj, 'defaultSortOrder', false);
|
|
1112
899
|
let querySortOrder = this.isSortOrderValid(stateSortOrder) ? stateSortOrder : defaultSortOrder;
|
|
1113
|
-
|
|
1114
900
|
if (dataIndex && dataIndex === sorterObj.dataIndex) {
|
|
1115
901
|
if (querySortOrder === _constants.strings.SORT_DIRECTIONS[0]) {
|
|
1116
902
|
querySortOrder = _constants.strings.SORT_DIRECTIONS[1];
|
|
@@ -1123,32 +909,25 @@ class TableFoundation extends _foundation.default {
|
|
|
1123
909
|
// This results in the current click only supports single column sorting
|
|
1124
910
|
querySortOrder = false;
|
|
1125
911
|
}
|
|
1126
|
-
|
|
1127
912
|
arr[idx] = Object.assign(Object.assign({}, sorterObj), {
|
|
1128
913
|
sortOrder: querySortOrder
|
|
1129
914
|
});
|
|
1130
|
-
|
|
1131
915
|
if (dataIndex === sorterObj.dataIndex) {
|
|
1132
916
|
curQuery = arr[idx];
|
|
1133
917
|
}
|
|
1134
918
|
}
|
|
1135
919
|
});
|
|
1136
|
-
|
|
1137
920
|
if (!this._sorterIsControlled(dataIndex)) {
|
|
1138
921
|
this._adapter.setQueries(queries);
|
|
1139
|
-
|
|
1140
922
|
this.handleClickFilterOrSorter(queries);
|
|
1141
|
-
}
|
|
1142
|
-
|
|
1143
|
-
|
|
923
|
+
}
|
|
924
|
+
// notify sort event
|
|
1144
925
|
this._notifyChange(null, null, curQuery, null);
|
|
1145
926
|
}
|
|
1146
927
|
/**
|
|
1147
928
|
* Recalculate the cached data after clicking filter or sorter
|
|
1148
929
|
* @param {*} queries
|
|
1149
930
|
*/
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
931
|
handleClickFilterOrSorter(queries) {
|
|
1153
932
|
const dataSource = [...this.getProp('dataSource')];
|
|
1154
933
|
const sortedDataSource = this.getFilteredSortedDataSource(dataSource, queries);
|
|
@@ -1158,38 +937,28 @@ class TableFoundation extends _foundation.default {
|
|
|
1158
937
|
const pageData = this.getCurrentPageData(sortedDataSource);
|
|
1159
938
|
this.setAdapterPageData(pageData);
|
|
1160
939
|
}
|
|
1161
|
-
|
|
1162
940
|
getQuery(dataIndex, queries) {
|
|
1163
941
|
queries = queries || this.getState('queries');
|
|
1164
|
-
|
|
1165
942
|
if (dataIndex != null) {
|
|
1166
943
|
return (0, _find2.default)(queries, query => query.dataIndex === dataIndex);
|
|
1167
944
|
}
|
|
1168
|
-
|
|
1169
945
|
return undefined;
|
|
1170
946
|
}
|
|
1171
|
-
|
|
1172
947
|
getCellWidths(flattenedColumns, flattenedWidths, ignoreScrollBarKey) {
|
|
1173
948
|
return this._adapter.getCellWidths(flattenedColumns, flattenedWidths, ignoreScrollBarKey);
|
|
1174
949
|
}
|
|
1175
|
-
|
|
1176
950
|
setHeadWidths(headWidths, index) {
|
|
1177
951
|
return this._adapter.setHeadWidths(headWidths, index);
|
|
1178
952
|
}
|
|
1179
|
-
|
|
1180
953
|
getHeadWidths(index) {
|
|
1181
954
|
return this._adapter.getHeadWidths(index);
|
|
1182
955
|
}
|
|
1183
|
-
|
|
1184
956
|
mergedRowExpandable(record) {
|
|
1185
957
|
return this._adapter.mergedRowExpandable(record);
|
|
1186
958
|
}
|
|
1187
|
-
|
|
1188
959
|
setBodyHasScrollbar(bodyHasScrollbar) {
|
|
1189
960
|
this._adapter.setBodyHasScrollbar(bodyHasScrollbar);
|
|
1190
961
|
}
|
|
1191
|
-
|
|
1192
962
|
}
|
|
1193
|
-
|
|
1194
963
|
var _default = TableFoundation;
|
|
1195
964
|
exports.default = _default;
|