@kdcloudjs/kdesign 1.8.12 → 1.8.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/kdesign.css +1 -1
- package/dist/kdesign.css.map +1 -1
- package/dist/kdesign.js +5 -3
- package/dist/kdesign.js.map +1 -1
- package/dist/kdesign.min.css +1 -1
- package/dist/kdesign.min.js +2 -2
- package/dist/kdesign.min.js.map +1 -1
- package/es/_utils/KeyCode.js +1 -333
- package/es/_utils/arrayUtil.js +0 -8
- package/es/_utils/formatUtil.js +9 -59
- package/es/_utils/getStringLength.js +0 -1
- package/es/_utils/hooks.js +2 -34
- package/es/_utils/index.js +1 -7
- package/es/_utils/numberUtil.js +0 -54
- package/es/_utils/raf.js +2 -2
- package/es/_utils/reactNode.js +1 -1
- package/es/_utils/resizeObserver.js +2 -4
- package/es/_utils/type.js +0 -1
- package/es/_utils/usePopper.js +3 -3
- package/es/alert/alert.js +8 -16
- package/es/anchor/anchor-link.js +3 -3
- package/es/anchor/anchor.js +23 -26
- package/es/anchor/context.js +1 -1
- package/es/avatar/avatar.js +8 -11
- package/es/badge/badge.js +7 -13
- package/es/base-data/base-data.js +34 -103
- package/es/breadcrumb/breadcrumb.js +12 -12
- package/es/breadcrumb/breadcrumbItem.js +5 -5
- package/es/button/button.js +13 -24
- package/es/button/group.js +13 -13
- package/es/card/card.js +12 -14
- package/es/carousel/carousel.js +13 -13
- package/es/carousel/displayList.js +3 -3
- package/es/carousel/fadeList.js +3 -3
- package/es/carousel/slideList.js +4 -4
- package/es/carousel/slidebar.js +3 -3
- package/es/cascader/cascader.js +31 -36
- package/es/checkbox/checkbox.js +25 -30
- package/es/checkbox/group.js +8 -9
- package/es/city-picker/city-picker.js +28 -38
- package/es/city-picker/interface.js +1 -1
- package/es/city-picker/option.js +4 -4
- package/es/clipboard/clipboard.js +5 -23
- package/es/clipboard/util.js +0 -60
- package/es/collapse/collapse.js +5 -5
- package/es/collapse/panel.js +15 -15
- package/es/color-picker/color-picker-panel.js +12 -13
- package/es/color-picker/color-picker.js +6 -10
- package/es/color-picker/utils/validateColor.js +0 -3
- package/es/config-provider/ConfigContext.js +1 -4
- package/es/config-provider/SizeContext.js +3 -3
- package/es/config-provider/compDefaultProps.js +3 -10
- package/es/config-provider/configProvider.js +1 -6
- package/es/config-provider/defaultConfig.js +0 -1
- package/es/date-picker/calendar.js +6 -23
- package/es/date-picker/context.js +1 -1
- package/es/date-picker/date-panel.js +12 -13
- package/es/date-picker/date-picker.js +7 -12
- package/es/date-picker/hooks/use-hover-value.js +0 -1
- package/es/date-picker/hooks/use-picker-input.js +0 -4
- package/es/date-picker/hooks/use-range-disabled.js +2 -6
- package/es/date-picker/hooks/use-range-view-dates.js +1 -9
- package/es/date-picker/hooks/use-text-value-mapping.js +0 -1
- package/es/date-picker/locale/zh_CN.js +0 -1
- package/es/date-picker/panel/date-time/date-time.js +4 -6
- package/es/date-picker/panel/header/header.js +14 -14
- package/es/date-picker/panel/month/month.js +5 -6
- package/es/date-picker/panel/quarter/quarter.js +4 -4
- package/es/date-picker/panel/time/time-column.js +4 -6
- package/es/date-picker/panel/time/time.js +10 -35
- package/es/date-picker/panel/week/week.js +5 -8
- package/es/date-picker/panel/year/year.js +4 -6
- package/es/date-picker/popper.js +3 -6
- package/es/date-picker/range/input-range.js +12 -13
- package/es/date-picker/range-picker.js +13 -36
- package/es/date-picker/single/input-date.js +8 -14
- package/es/date-picker/utils/date-fns.js +0 -35
- package/es/date-picker/utils/get-extra-footer.js +1 -1
- package/es/date-picker/utils/get-ranges.js +8 -8
- package/es/date-picker/utils/index.js +0 -3
- package/es/divider/divider.js +2 -2
- package/es/drawer/drawer.js +14 -39
- package/es/dropdown/dropdown.js +10 -11
- package/es/dropdown/menu.js +8 -12
- package/es/empty/defaultEmptyImg.js +18 -18
- package/es/empty/empty.js +9 -10
- package/es/empty/illustrationEmptyImg.js +106 -106
- package/es/filter/condition.js +10 -10
- package/es/filter/filter.js +17 -19
- package/es/filter/scheme.js +34 -41
- package/es/form/Field.js +5 -5
- package/es/form/FieldContext.js +1 -1
- package/es/form/FieldLabel.js +2 -2
- package/es/form/FieldWrapper.js +6 -6
- package/es/form/Form.js +2 -5
- package/es/form/FormContext.js +2 -4
- package/es/form/hooks/useForm.js +1 -14
- package/es/form/index.js +1 -1
- package/es/grid/col.js +1 -7
- package/es/grid/row.js +3 -9
- package/es/icon/icon.js +2 -2
- package/es/image/image.js +5 -7
- package/es/image/preview-group.js +3 -4
- package/es/image/preview.js +22 -24
- package/es/image-cropper/cropper.js +3 -6
- package/es/image-cropper/image-cropper.js +5 -5
- package/es/image-cropper/operation-bar.js +9 -9
- package/es/index.js +4 -0
- package/es/input/ClearableLabeledInput.js +13 -13
- package/es/input/TextArea.js +7 -7
- package/es/input/calculateNodeHeight.js +6 -11
- package/es/input/index.js +0 -1
- package/es/input/input.js +5 -5
- package/es/input-number/inputNumber.js +3 -10
- package/es/layout/layout.js +5 -9
- package/es/layout/sider.js +11 -14
- package/es/link/link.js +8 -12
- package/es/locale/locale.js +4 -34
- package/es/menu/menu.js +3 -4
- package/es/menu/menuItem.js +8 -13
- package/es/menu/subMenu.js +19 -27
- package/es/menu/util.js +0 -4
- package/es/message/content.js +13 -13
- package/es/message/index.js +1 -3
- package/es/modal/confirm.js +1 -1
- package/es/modal/modal.js +32 -40
- package/es/notification/content.js +18 -18
- package/es/notification/index.js +1 -1
- package/es/notification-base/index.js +1 -1
- package/es/notification-base/notice.js +2 -2
- package/es/notification-base/notification.js +3 -3
- package/es/pagination/pagination.js +48 -70
- package/es/popconfirm/popconfirm.js +8 -10
- package/es/popper/index.d.ts +2 -0
- package/es/popper/index.js +9 -15
- package/es/progress/circle.js +6 -8
- package/es/progress/line.js +3 -3
- package/es/progress/progress.js +11 -11
- package/es/qr-code/qr-code.js +6 -6
- package/es/radio/context.js +1 -1
- package/es/radio/group.js +9 -13
- package/es/radio/radio-button.js +2 -2
- package/es/radio/radio.js +19 -24
- package/es/rate/rate.js +11 -61
- package/es/search/option.js +4 -5
- package/es/search/quick-search.js +36 -57
- package/es/search/search-panel.js +56 -60
- package/es/search/search.js +9 -10
- package/es/select/interface.js +1 -1
- package/es/select/option.js +4 -4
- package/es/select/select.js +47 -87
- package/es/signature/drawingBoard.js +16 -16
- package/es/signature/signature.js +20 -20
- package/es/signature/utils/signature_pad.js +4 -12
- package/es/slider/marks.js +3 -5
- package/es/slider/slider.js +11 -32
- package/es/slider/sliderTooltip.js +3 -3
- package/es/slider/steps.js +2 -2
- package/es/slider/track.js +1 -1
- package/es/space/space.js +3 -5
- package/es/spin/spin.js +16 -18
- package/es/split-panel/split-panel.js +7 -18
- package/es/split-panel/trigger.js +6 -6
- package/es/stepper/stepper.js +11 -12
- package/es/steps/Step.js +8 -8
- package/es/steps/Steps.js +5 -5
- package/es/switch/switch.js +4 -6
- package/es/table/api.js +5 -22
- package/es/table/table.js +4 -15
- package/es/tabs/active-line.js +2 -6
- package/es/tabs/arrow-button.js +3 -3
- package/es/tabs/context.js +1 -1
- package/es/tabs/index.js +0 -1
- package/es/tabs/tab-pane.js +6 -6
- package/es/tabs/tabs.js +31 -34
- package/es/tag/tag.js +7 -15
- package/es/timeline/Timeline.js +5 -5
- package/es/timeline/TimelineItem.js +5 -5
- package/es/tooltip/tooltip.js +2 -2
- package/es/transfer/list-body.js +4 -4
- package/es/transfer/list-item.js +5 -6
- package/es/transfer/list.js +18 -22
- package/es/transfer/operation.js +7 -7
- package/es/transfer/search.js +5 -5
- package/es/transfer/transfer.js +8 -13
- package/es/tree/tree.js +9 -9
- package/es/tree/treeNode.js +18 -20
- package/es/tree/utils/treeUtils.js +1 -27
- package/es/tree-select/interface.js +1 -1
- package/es/tree-select/tree-select.js +35 -48
- package/es/typography/base.js +5 -5
- package/es/typography/index.js +0 -1
- package/es/typography/paragraph.js +1 -1
- package/es/typography/text.js +1 -1
- package/es/typography/title.js +1 -1
- package/es/typography/typography.js +4 -8
- package/es/upload/dragger.js +2 -2
- package/es/upload/request.js +0 -5
- package/es/upload/scan-files.js +0 -1
- package/es/upload/upload.js +34 -34
- package/es/upload/verify-file.js +0 -1
- package/es/view-container/context.js +1 -1
- package/es/view-container/view-container.js +4 -8
- package/es/virtual-list/Filler.js +2 -2
- package/es/virtual-list/utils/algorithmUtil.js +0 -13
- package/es/virtual-list/utils/itemUtil.js +0 -30
- package/es/virtual-list/virtual-list.js +8 -11
- package/lib/_utils/KeyCode.js +1 -333
- package/lib/_utils/arrayUtil.js +0 -8
- package/lib/_utils/formatUtil.js +9 -59
- package/lib/_utils/getStringLength.js +0 -1
- package/lib/_utils/hooks.js +2 -34
- package/lib/_utils/index.js +0 -7
- package/lib/_utils/numberUtil.js +0 -54
- package/lib/_utils/raf.js +2 -2
- package/lib/_utils/reactNode.js +1 -1
- package/lib/_utils/resizeObserver.js +2 -4
- package/lib/_utils/type.js +0 -1
- package/lib/_utils/usePopper.js +3 -3
- package/lib/alert/alert.js +8 -16
- package/lib/anchor/anchor-link.js +3 -3
- package/lib/anchor/anchor.js +23 -26
- package/lib/anchor/context.js +1 -1
- package/lib/avatar/avatar.js +8 -11
- package/lib/badge/badge.js +7 -13
- package/lib/base-data/base-data.js +34 -103
- package/lib/breadcrumb/breadcrumb.js +12 -12
- package/lib/breadcrumb/breadcrumbItem.js +5 -5
- package/lib/button/button.js +13 -24
- package/lib/button/group.js +13 -13
- package/lib/card/card.js +12 -14
- package/lib/carousel/carousel.js +13 -13
- package/lib/carousel/displayList.js +3 -3
- package/lib/carousel/fadeList.js +3 -3
- package/lib/carousel/slideList.js +4 -4
- package/lib/carousel/slidebar.js +3 -3
- package/lib/cascader/cascader.js +31 -36
- package/lib/checkbox/checkbox.js +25 -30
- package/lib/checkbox/group.js +8 -8
- package/lib/city-picker/city-picker.js +28 -38
- package/lib/city-picker/interface.js +1 -1
- package/lib/city-picker/option.js +4 -4
- package/lib/clipboard/clipboard.js +5 -23
- package/lib/clipboard/util.js +0 -60
- package/lib/collapse/collapse.js +5 -5
- package/lib/collapse/panel.js +15 -15
- package/lib/color-picker/color-picker-panel.js +12 -14
- package/lib/color-picker/color-picker.js +6 -10
- package/lib/color-picker/utils/validateColor.js +0 -3
- package/lib/config-provider/ConfigContext.js +1 -5
- package/lib/config-provider/SizeContext.js +3 -3
- package/lib/config-provider/compDefaultProps.js +3 -10
- package/lib/config-provider/configProvider.js +1 -7
- package/lib/config-provider/defaultConfig.js +0 -1
- package/lib/date-picker/calendar.js +6 -23
- package/lib/date-picker/context.js +1 -1
- package/lib/date-picker/date-panel.js +12 -13
- package/lib/date-picker/date-picker.js +7 -12
- package/lib/date-picker/hooks/use-hover-value.js +0 -1
- package/lib/date-picker/hooks/use-picker-input.js +0 -4
- package/lib/date-picker/hooks/use-range-disabled.js +2 -6
- package/lib/date-picker/hooks/use-range-view-dates.js +1 -9
- package/lib/date-picker/hooks/use-text-value-mapping.js +0 -1
- package/lib/date-picker/locale/zh_CN.js +0 -1
- package/lib/date-picker/panel/date-time/date-time.js +4 -6
- package/lib/date-picker/panel/header/header.js +14 -14
- package/lib/date-picker/panel/month/month.js +5 -6
- package/lib/date-picker/panel/quarter/quarter.js +4 -4
- package/lib/date-picker/panel/time/time-column.js +4 -6
- package/lib/date-picker/panel/time/time.js +10 -35
- package/lib/date-picker/panel/week/week.js +5 -8
- package/lib/date-picker/panel/year/year.js +4 -6
- package/lib/date-picker/popper.js +3 -6
- package/lib/date-picker/range/input-range.js +12 -13
- package/lib/date-picker/range-picker.js +13 -36
- package/lib/date-picker/single/input-date.js +8 -14
- package/lib/date-picker/utils/date-fns.js +0 -34
- package/lib/date-picker/utils/get-extra-footer.js +1 -1
- package/lib/date-picker/utils/get-ranges.js +8 -8
- package/lib/date-picker/utils/index.js +0 -3
- package/lib/divider/divider.js +2 -2
- package/lib/drawer/drawer.js +14 -40
- package/lib/dropdown/dropdown.js +10 -11
- package/lib/dropdown/menu.js +8 -12
- package/lib/empty/defaultEmptyImg.js +18 -18
- package/lib/empty/empty.js +9 -10
- package/lib/empty/illustrationEmptyImg.js +106 -106
- package/lib/filter/condition.js +10 -10
- package/lib/filter/filter.js +17 -19
- package/lib/filter/scheme.js +34 -41
- package/lib/form/Field.js +5 -5
- package/lib/form/FieldContext.js +1 -1
- package/lib/form/FieldLabel.js +2 -2
- package/lib/form/FieldWrapper.js +6 -6
- package/lib/form/Form.js +2 -5
- package/lib/form/FormContext.js +2 -4
- package/lib/form/hooks/useForm.js +1 -14
- package/lib/form/index.js +1 -1
- package/lib/grid/col.js +1 -7
- package/lib/grid/row.js +3 -9
- package/lib/icon/icon.js +2 -2
- package/lib/image/image.js +5 -7
- package/lib/image/preview-group.js +3 -4
- package/lib/image/preview.js +22 -24
- package/lib/image-cropper/cropper.js +3 -6
- package/lib/image-cropper/image-cropper.js +5 -5
- package/lib/image-cropper/operation-bar.js +9 -9
- package/lib/index.js +2 -8
- package/lib/input/ClearableLabeledInput.js +13 -13
- package/lib/input/TextArea.js +7 -7
- package/lib/input/calculateNodeHeight.js +6 -11
- package/lib/input/index.js +0 -1
- package/lib/input/input.js +5 -5
- package/lib/input-number/inputNumber.js +3 -10
- package/lib/layout/layout.js +5 -9
- package/lib/layout/sider.js +11 -14
- package/lib/link/link.js +8 -12
- package/lib/locale/locale.js +4 -34
- package/lib/menu/menu.js +3 -4
- package/lib/menu/menuItem.js +8 -13
- package/lib/menu/subMenu.js +19 -27
- package/lib/menu/util.js +0 -4
- package/lib/message/content.js +13 -13
- package/lib/message/index.js +1 -3
- package/lib/modal/confirm.js +1 -1
- package/lib/modal/modal.js +32 -40
- package/lib/notification/content.js +18 -18
- package/lib/notification/index.js +1 -1
- package/lib/notification-base/index.js +1 -1
- package/lib/notification-base/notice.js +2 -2
- package/lib/notification-base/notification.js +3 -3
- package/lib/pagination/pagination.js +48 -70
- package/lib/popconfirm/popconfirm.js +8 -10
- package/lib/popper/index.d.ts +2 -0
- package/lib/popper/index.js +9 -15
- package/lib/progress/circle.js +6 -8
- package/lib/progress/line.js +3 -3
- package/lib/progress/progress.js +11 -11
- package/lib/qr-code/qr-code.js +6 -6
- package/lib/radio/context.js +1 -1
- package/lib/radio/group.js +9 -13
- package/lib/radio/radio-button.js +2 -2
- package/lib/radio/radio.js +19 -24
- package/lib/rate/rate.js +11 -61
- package/lib/search/option.js +4 -5
- package/lib/search/quick-search.js +36 -57
- package/lib/search/search-panel.js +56 -60
- package/lib/search/search.js +9 -10
- package/lib/select/interface.js +1 -1
- package/lib/select/option.js +4 -4
- package/lib/select/select.js +47 -87
- package/lib/signature/drawingBoard.js +16 -16
- package/lib/signature/signature.js +20 -20
- package/lib/signature/utils/signature_pad.js +4 -12
- package/lib/slider/marks.js +3 -5
- package/lib/slider/slider.js +11 -32
- package/lib/slider/sliderTooltip.js +3 -3
- package/lib/slider/steps.js +2 -2
- package/lib/slider/track.js +1 -1
- package/lib/space/space.js +3 -5
- package/lib/spin/spin.js +16 -18
- package/lib/split-panel/split-panel.js +7 -18
- package/lib/split-panel/trigger.js +6 -6
- package/lib/stepper/stepper.js +11 -12
- package/lib/steps/Step.js +8 -8
- package/lib/steps/Steps.js +5 -5
- package/lib/switch/switch.js +4 -6
- package/lib/table/api.js +5 -22
- package/lib/table/table.js +4 -15
- package/lib/tabs/active-line.js +2 -6
- package/lib/tabs/arrow-button.js +3 -3
- package/lib/tabs/context.js +1 -1
- package/lib/tabs/index.js +0 -1
- package/lib/tabs/tab-pane.js +6 -6
- package/lib/tabs/tabs.js +31 -34
- package/lib/tag/tag.js +7 -15
- package/lib/timeline/Timeline.js +5 -5
- package/lib/timeline/TimelineItem.js +5 -5
- package/lib/tooltip/tooltip.js +2 -2
- package/lib/transfer/list-body.js +4 -4
- package/lib/transfer/list-item.js +5 -6
- package/lib/transfer/list.js +18 -22
- package/lib/transfer/operation.js +7 -7
- package/lib/transfer/search.js +5 -5
- package/lib/transfer/transfer.js +8 -13
- package/lib/tree/tree.js +9 -9
- package/lib/tree/treeNode.js +18 -20
- package/lib/tree/utils/treeUtils.js +1 -27
- package/lib/tree-select/interface.js +1 -1
- package/lib/tree-select/tree-select.js +35 -48
- package/lib/typography/base.js +5 -5
- package/lib/typography/index.js +0 -1
- package/lib/typography/paragraph.js +1 -1
- package/lib/typography/text.js +1 -1
- package/lib/typography/title.js +1 -1
- package/lib/typography/typography.js +4 -8
- package/lib/upload/dragger.js +2 -2
- package/lib/upload/request.js +0 -5
- package/lib/upload/scan-files.js +0 -1
- package/lib/upload/upload.js +34 -34
- package/lib/upload/verify-file.js +0 -1
- package/lib/view-container/context.js +1 -1
- package/lib/view-container/view-container.js +4 -8
- package/lib/virtual-list/Filler.js +2 -2
- package/lib/virtual-list/utils/algorithmUtil.js +0 -13
- package/lib/virtual-list/utils/itemUtil.js +0 -30
- package/lib/virtual-list/virtual-list.js +8 -12
- package/package.json +1 -3
|
@@ -73,7 +73,7 @@ var InternalBaseData = function InternalBaseData(props, ref) {
|
|
|
73
73
|
onCollect = advancedSelectortProps.onCollect,
|
|
74
74
|
onShowMore = advancedSelectortProps.onShowMore,
|
|
75
75
|
onVisibleChange = advancedSelectortProps.onVisibleChange;
|
|
76
|
-
var isMultiple = mode === 'multiple';
|
|
76
|
+
var isMultiple = mode === 'multiple';
|
|
77
77
|
var _useState = (0, _react.useState)([]),
|
|
78
78
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
79
79
|
seletedOptions = _useState2[0],
|
|
@@ -110,14 +110,11 @@ var InternalBaseData = function InternalBaseData(props, ref) {
|
|
|
110
110
|
deleteEndIndx: 0
|
|
111
111
|
});
|
|
112
112
|
var advancedSelectorfixCls = getPrefixCls(prefixCls, 'baseData', customPrefixcls);
|
|
113
|
-
// class
|
|
114
113
|
var advancedSelectorCls = (0, _classnames.default)(advancedSelectorfixCls, className, (0, _defineProperty2.default)({}, "".concat(advancedSelectorfixCls, "-disabled"), disabled));
|
|
115
|
-
// 多选模式下 维护新增选中的下标
|
|
116
114
|
(0, _react.useEffect)(function () {
|
|
117
115
|
searchInfo.current.searchIndex = seletedOptions.length;
|
|
118
116
|
searchInfo.current.editOptions = seletedOptions;
|
|
119
117
|
}, [seletedOptions]);
|
|
120
|
-
// 记录每个选项的开始与结束下标
|
|
121
118
|
var setValIndxPosition = (0, _react.useCallback)(function () {
|
|
122
119
|
var _context;
|
|
123
120
|
var str = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
@@ -146,11 +143,9 @@ var InternalBaseData = function InternalBaseData(props, ref) {
|
|
|
146
143
|
}, [setValIndxPosition]);
|
|
147
144
|
(0, _react.useEffect)(function () {
|
|
148
145
|
var seletedItems = [];
|
|
149
|
-
// 多选
|
|
150
146
|
if (isMultiple && Array.isArray(value)) {
|
|
151
147
|
seletedItems = value;
|
|
152
148
|
}
|
|
153
|
-
// 单选
|
|
154
149
|
if (!isMultiple && value) {
|
|
155
150
|
seletedItems = [value];
|
|
156
151
|
}
|
|
@@ -166,31 +161,22 @@ var InternalBaseData = function InternalBaseData(props, ref) {
|
|
|
166
161
|
var selectionStart = ((_b = (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.input) === null || _b === void 0 ? void 0 : _b.selectionStart) || 0;
|
|
167
162
|
var index = findSelectionIndex(selectionStart, posList);
|
|
168
163
|
searchInfo.current.searchIndex = index;
|
|
169
|
-
// 新增一个
|
|
170
164
|
var list = (0, _toConsumableArray2.default)(searchInfo.current.editOptions || []);
|
|
171
165
|
if (valueArr.length - preValueArr.length === 1) {
|
|
172
166
|
(0, _splice.default)(list).call(list, index, 0, null);
|
|
173
167
|
}
|
|
174
168
|
if (valueArr.length < preValueArr.length) {
|
|
175
169
|
var val = searchInfo.current.previousEditValue;
|
|
176
|
-
/**
|
|
177
|
-
* selectionStart 被删除的字符串开始下标
|
|
178
|
-
* deleteEndIndx 被删除的字符串结束下标
|
|
179
|
-
* 多选时,判断删除的字符包含了几个已选项
|
|
180
|
-
* 单选时,判断selectionStart与deleteEndIndx相等(都为0),则表示选项被删除
|
|
181
|
-
*/
|
|
182
170
|
var deleteEndIndx = isMultiple ? val.length - inputValue.length + selectionStart : 0;
|
|
183
171
|
var _findDeleteInterval = findDeleteInterval(selectionStart, deleteEndIndx, indxPosList),
|
|
184
172
|
start = _findDeleteInterval.start,
|
|
185
173
|
end = _findDeleteInterval.end;
|
|
186
174
|
list === null || list === void 0 ? void 0 : (0, _splice.default)(list).call(list, start, end - start + 1);
|
|
187
175
|
}
|
|
188
|
-
// 判断每次单个按del键时删除了分隔符后下一次触发
|
|
189
176
|
if (searchInfo.current.deleteEndIndx > 0 && selectionStart !== searchInfo.current.deleteEndIndx) {
|
|
190
177
|
var _findDeleteInterval2 = findDeleteInterval(selectionStart, searchInfo.current.deleteEndIndx, initIndexPos),
|
|
191
178
|
_start = _findDeleteInterval2.start,
|
|
192
179
|
_end = _findDeleteInterval2.end;
|
|
193
|
-
// 单个删除时找到合理的下标触发
|
|
194
180
|
if (_start !== null && _end !== null && _start <= _end) {
|
|
195
181
|
list === null || list === void 0 ? void 0 : (0, _splice.default)(list).call(list, _start, _end - _start + 1);
|
|
196
182
|
searchInfo.current.deleteEndIndx = 0;
|
|
@@ -198,7 +184,6 @@ var InternalBaseData = function InternalBaseData(props, ref) {
|
|
|
198
184
|
}
|
|
199
185
|
searchInfo.current.editOptions = list;
|
|
200
186
|
searchInfo.current.previousEditValue = inputValue;
|
|
201
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
202
187
|
}, [delimiter, inputValue, isMultiple, setValIndxPosition]);
|
|
203
188
|
var getStrToArr = function getStrToArr() {
|
|
204
189
|
var _context5;
|
|
@@ -219,11 +204,9 @@ var InternalBaseData = function InternalBaseData(props, ref) {
|
|
|
219
204
|
setShowTotal(false);
|
|
220
205
|
}
|
|
221
206
|
}, [inputValue, isMultiple]);
|
|
222
|
-
// 当选中项文字超出输入框时,显示共多少项
|
|
223
207
|
(0, _react.useLayoutEffect)(function () {
|
|
224
208
|
handleShowTotal();
|
|
225
209
|
}, [handleShowTotal]);
|
|
226
|
-
// 通过选中项显示input文字, optionLabelProp为回填到选择框的属性
|
|
227
210
|
var setValueBySeleted = (0, _react.useCallback)(function () {
|
|
228
211
|
var _context8;
|
|
229
212
|
var defaultInputValue = seletedOptions.reduce(function (pre, next, index, arr) {
|
|
@@ -254,17 +237,16 @@ var InternalBaseData = function InternalBaseData(props, ref) {
|
|
|
254
237
|
var textValue = e.target.value;
|
|
255
238
|
var val = textValue;
|
|
256
239
|
var inputDom = (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.input;
|
|
257
|
-
var selectionStart = inputDom.selectionStart || 0;
|
|
240
|
+
var selectionStart = inputDom.selectionStart || 0;
|
|
258
241
|
if (isMultiple && inputDom && textValue && textValue.length > inputValue.length) {
|
|
259
242
|
searchInfo.current.selectionStart = selectionStart;
|
|
260
|
-
var isInHead = selectionStart === 1 && textValue[1] !== delimiter && textValue.length !== 1;
|
|
243
|
+
var isInHead = selectionStart === 1 && textValue[1] !== delimiter && textValue.length !== 1;
|
|
261
244
|
var isInMid = selectionStart !== textValue.length && textValue[selectionStart - 2] === delimiter && textValue[selectionStart] !== delimiter;
|
|
262
245
|
if (isInHead || isInMid) {
|
|
263
246
|
inputDom.value = val = textValue.substring(0, selectionStart) + delimiter + textValue.substring(selectionStart, textValue.length);
|
|
264
247
|
setCursorPosition(inputDom, selectionStart);
|
|
265
248
|
}
|
|
266
249
|
}
|
|
267
|
-
// 单个删除时 当删除的字符为分隔符delimiter 记录位置
|
|
268
250
|
if (findDeletedChar(searchInfo.current.previousEditValue || '', textValue) === delimiter) {
|
|
269
251
|
searchInfo.current.deleteEndIndx = selectionStart;
|
|
270
252
|
}
|
|
@@ -283,13 +265,12 @@ var InternalBaseData = function InternalBaseData(props, ref) {
|
|
|
283
265
|
}
|
|
284
266
|
if (inputRef.current && queryStr) {
|
|
285
267
|
if (queryStr.indexOf(delimiter) < 0) {
|
|
286
|
-
// 只有一条记录
|
|
287
268
|
return queryStr;
|
|
288
269
|
}
|
|
289
270
|
var selectionStart = ((_b = (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.input) === null || _b === void 0 ? void 0 : _b.selectionStart) || 0;
|
|
290
|
-
var startIndex = (0, _slice.default)(queryStr).call(queryStr, 0, selectionStart).lastIndexOf(delimiter) + 1;
|
|
271
|
+
var startIndex = (0, _slice.default)(queryStr).call(queryStr, 0, selectionStart).lastIndexOf(delimiter) + 1;
|
|
291
272
|
var endIndex = (0, _slice.default)(queryStr).call(queryStr, selectionStart).indexOf(delimiter);
|
|
292
|
-
endIndex = endIndex === -1 ? queryStr.length : selectionStart + endIndex;
|
|
273
|
+
endIndex = endIndex === -1 ? queryStr.length : selectionStart + endIndex;
|
|
293
274
|
queryStr = (0, _slice.default)(queryStr).call(queryStr, startIndex, endIndex);
|
|
294
275
|
return queryStr;
|
|
295
276
|
}
|
|
@@ -307,7 +288,6 @@ var InternalBaseData = function InternalBaseData(props, ref) {
|
|
|
307
288
|
setFocused(false);
|
|
308
289
|
setInputValue(searchInfo.current.previousInputValue);
|
|
309
290
|
searchInfo.current.previousEditValue = (0, _concat.default)(_context10 = "".concat(searchInfo.current.previousInputValue)).call(_context10, delimiter);
|
|
310
|
-
// 多选失去焦点时,通过editOptions去改写选中项
|
|
311
291
|
var list = (0, _filter.default)(_context11 = searchInfo.current.editOptions || []).call(_context11, function (item) {
|
|
312
292
|
return item;
|
|
313
293
|
}) || [];
|
|
@@ -346,14 +326,11 @@ var InternalBaseData = function InternalBaseData(props, ref) {
|
|
|
346
326
|
e.stopPropagation();
|
|
347
327
|
onShowMore === null || onShowMore === void 0 ? void 0 : onShowMore();
|
|
348
328
|
};
|
|
349
|
-
// 设置光标位置
|
|
350
329
|
var setCursorPosition = function setCursorPosition(element, prePosition) {
|
|
351
330
|
if (element.setSelectionRange) {
|
|
352
|
-
// Chrome Firefox
|
|
353
331
|
element.focus();
|
|
354
332
|
window.setTimeout(element.setSelectionRange(prePosition, prePosition), 0);
|
|
355
333
|
} else if (element.createTextRange) {
|
|
356
|
-
// 兼容IE
|
|
357
334
|
var range = element.createTextRange;
|
|
358
335
|
range.collapse(true);
|
|
359
336
|
range.moveEnd('character', prePosition);
|
|
@@ -361,7 +338,6 @@ var InternalBaseData = function InternalBaseData(props, ref) {
|
|
|
361
338
|
range.select();
|
|
362
339
|
}
|
|
363
340
|
};
|
|
364
|
-
// 双击选中当前项
|
|
365
341
|
var handleDoubleClick = function handleDoubleClick() {
|
|
366
342
|
var _a;
|
|
367
343
|
var inputDom = (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.input;
|
|
@@ -379,7 +355,6 @@ var InternalBaseData = function InternalBaseData(props, ref) {
|
|
|
379
355
|
}
|
|
380
356
|
return {};
|
|
381
357
|
};
|
|
382
|
-
// 多选,找到光标停留的当前项的下标
|
|
383
358
|
var findSelectionIndex = function findSelectionIndex(selectionStart, posList) {
|
|
384
359
|
var indx = 0;
|
|
385
360
|
for (var index = 0; index < posList.length; index++) {
|
|
@@ -390,13 +365,6 @@ var InternalBaseData = function InternalBaseData(props, ref) {
|
|
|
390
365
|
}
|
|
391
366
|
return indx;
|
|
392
367
|
};
|
|
393
|
-
/**
|
|
394
|
-
* 找出删除项的下标
|
|
395
|
-
*
|
|
396
|
-
* @param start 删除时文字光标的起始位置
|
|
397
|
-
* @param end 删除时文字光标的终止位置
|
|
398
|
-
* @param posList 每个选中项的下标区间
|
|
399
|
-
*/
|
|
400
368
|
var findDeleteInterval = function findDeleteInterval(start, end, posList) {
|
|
401
369
|
var delIndex = {
|
|
402
370
|
start: null,
|
|
@@ -422,7 +390,6 @@ var InternalBaseData = function InternalBaseData(props, ref) {
|
|
|
422
390
|
var _list = (0, _filter.default)(seletedOptions).call(seletedOptions, function (v) {
|
|
423
391
|
return v.value !== item.value;
|
|
424
392
|
});
|
|
425
|
-
// 取消选中(非受控状态下)
|
|
426
393
|
isMultiple && value === undefined && setSeletedOptions(_list);
|
|
427
394
|
onChange === null || onChange === void 0 ? void 0 : onChange((0, _map.default)(_context13 = (0, _filter.default)(_list).call(_list, function (item) {
|
|
428
395
|
return item;
|
|
@@ -474,13 +441,13 @@ var InternalBaseData = function InternalBaseData(props, ref) {
|
|
|
474
441
|
var totalText = locale.getLangMsg('BaseData', 'total', {
|
|
475
442
|
total: seletedOptions.length
|
|
476
443
|
});
|
|
477
|
-
return
|
|
444
|
+
return _react.default.createElement("div", {
|
|
478
445
|
className: advancedSelectorCls,
|
|
479
446
|
ref: advancedSelectorRef,
|
|
480
447
|
style: style
|
|
481
|
-
},
|
|
448
|
+
}, _react.default.createElement(_resizeObserver.default, {
|
|
482
449
|
onResize: handleShowTotal
|
|
483
|
-
},
|
|
450
|
+
}, _react.default.createElement(_index.Input, {
|
|
484
451
|
ref: inputRef,
|
|
485
452
|
borderType: "none",
|
|
486
453
|
disabled: disabled,
|
|
@@ -490,48 +457,32 @@ var InternalBaseData = function InternalBaseData(props, ref) {
|
|
|
490
457
|
onDoubleClick: handleDoubleClick,
|
|
491
458
|
onFocus: handleFocus,
|
|
492
459
|
onBlur: handleBlur
|
|
493
|
-
})), showTotal && !isFocused && isMultiple &&
|
|
460
|
+
})), showTotal && !isFocused && isMultiple && _react.default.createElement("span", {
|
|
494
461
|
className: "".concat(advancedSelectorfixCls, "-total"),
|
|
495
462
|
onClick: showInputTotal
|
|
496
|
-
}, totalText), isShowDetailBtn && !disabled &&
|
|
463
|
+
}, totalText), isShowDetailBtn && !disabled && _react.default.createElement("span", {
|
|
497
464
|
className: "".concat(advancedSelectorfixCls, "-detail"),
|
|
498
465
|
onClick: handleShowDetail
|
|
499
|
-
},
|
|
466
|
+
}, _react.default.createElement(_index.Icon, {
|
|
500
467
|
type: "material"
|
|
501
|
-
})), !disabled &&
|
|
468
|
+
})), !disabled && _react.default.createElement("span", {
|
|
502
469
|
className: "".concat(advancedSelectorfixCls, "-suffix"),
|
|
503
470
|
onClick: handleShowMore
|
|
504
|
-
},
|
|
471
|
+
}, _react.default.createElement(_index.Icon, {
|
|
505
472
|
type: "search"
|
|
506
473
|
})));
|
|
507
474
|
};
|
|
508
|
-
// 渲染下拉列表框
|
|
509
475
|
var renderContent = function renderContent() {
|
|
510
|
-
return
|
|
476
|
+
return _react.default.createElement("div", {
|
|
511
477
|
className: "".concat(advancedSelectorfixCls, "-dropdown")
|
|
512
478
|
}, searchInfo.current.searchValue ? renderDropdownContent(options, columns, true, true) : renderHistoryContent());
|
|
513
479
|
};
|
|
514
|
-
/**
|
|
515
|
-
* 判断Checkbox半选状态
|
|
516
|
-
*
|
|
517
|
-
* @param {string[]} value 选中项数组
|
|
518
|
-
* @returns {boolean}
|
|
519
|
-
*/
|
|
520
480
|
var getIndeterminate = (0, _react.useCallback)(function (value) {
|
|
521
481
|
return value.length > 0 && value.length < options.length;
|
|
522
482
|
}, [options]);
|
|
523
483
|
var getChecked = function getChecked(value) {
|
|
524
484
|
return options.length && value.length === options.length;
|
|
525
485
|
};
|
|
526
|
-
/**
|
|
527
|
-
* 渲染下拉列表
|
|
528
|
-
*
|
|
529
|
-
* @param {IOptionsProps} data 下拉列表的数据
|
|
530
|
-
* @param {IColumnsProps} myColumns 下拉列表的展示列
|
|
531
|
-
* @param {boolean} showFooter 是否显示下拉框footer
|
|
532
|
-
* @param {boolean} showCheckbox 是否显示多选框
|
|
533
|
-
* @returns {React.ReactNode}
|
|
534
|
-
*/
|
|
535
486
|
var renderDropdownContent = function renderDropdownContent(data, myColumns) {
|
|
536
487
|
var _context18;
|
|
537
488
|
var showFooter = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
@@ -543,14 +494,14 @@ var InternalBaseData = function InternalBaseData(props, ref) {
|
|
|
543
494
|
}) : [];
|
|
544
495
|
var indeterminate = getIndeterminate(seletedOptions);
|
|
545
496
|
var checked = getChecked(seletedOptions);
|
|
546
|
-
return
|
|
497
|
+
return _react.default.createElement(_react.default.Fragment, null, myColumns && Array.isArray(myColumns) && _react.default.createElement("div", {
|
|
547
498
|
className: "".concat(advancedSelectorfixCls, "-dropdown-columns")
|
|
548
499
|
}, (0, _map.default)(dropDownColumns).call(dropDownColumns, function (item, index) {
|
|
549
|
-
return
|
|
500
|
+
return _react.default.createElement("span", {
|
|
550
501
|
key: item.key,
|
|
551
502
|
className: "".concat(advancedSelectorfixCls, "-dropdown-columns-item"),
|
|
552
503
|
title: item.title
|
|
553
|
-
}, isMultiple && index === 0 && showCheckbox &&
|
|
504
|
+
}, isMultiple && index === 0 && showCheckbox && _react.default.createElement(_index.Checkbox, {
|
|
554
505
|
style: {
|
|
555
506
|
marginRight: 5
|
|
556
507
|
},
|
|
@@ -558,33 +509,27 @@ var InternalBaseData = function InternalBaseData(props, ref) {
|
|
|
558
509
|
indeterminate: indeterminate,
|
|
559
510
|
onChange: handleSelectAll
|
|
560
511
|
}), item.title);
|
|
561
|
-
})), loading ?
|
|
512
|
+
})), loading ? _react.default.createElement("div", {
|
|
562
513
|
className: "".concat(advancedSelectorfixCls, "-dropdown-loading")
|
|
563
|
-
},
|
|
514
|
+
}, _react.default.createElement(_index.Spin, null)) : data.length ? renderOptionsContent(data, dropDownColumns, showCheckbox) : renderNotContent(), showFooter && dropdownFooterRender && _react.default.createElement("div", {
|
|
564
515
|
className: "".concat(advancedSelectorfixCls, "-dropdown-footer")
|
|
565
516
|
}, dropdownFooterRender));
|
|
566
517
|
};
|
|
567
|
-
/**
|
|
568
|
-
* 渲染收藏图标
|
|
569
|
-
*
|
|
570
|
-
* @param {IOptionsProps} item
|
|
571
|
-
* @returns {React.ReactNode}
|
|
572
|
-
*/
|
|
573
518
|
var renderCollect = (0, _react.useCallback)(function (item) {
|
|
574
|
-
return
|
|
519
|
+
return _react.default.createElement("span", {
|
|
575
520
|
className: "".concat(advancedSelectorfixCls, "-dropdown-options-item-collect"),
|
|
576
521
|
onMouseDown: function onMouseDown(e) {
|
|
577
522
|
return e.stopPropagation();
|
|
578
523
|
}
|
|
579
524
|
}, (0, _findIndex.default)(collectList).call(collectList, function (v) {
|
|
580
525
|
return v.value === item.value;
|
|
581
|
-
}) === -1 ?
|
|
526
|
+
}) === -1 ? _react.default.createElement(_index.Icon, {
|
|
582
527
|
className: "".concat(advancedSelectorfixCls, "-dropdown-options-item-collect-not-icon"),
|
|
583
528
|
type: "collect",
|
|
584
529
|
onClick: function onClick() {
|
|
585
530
|
return handleCollect(item, true);
|
|
586
531
|
}
|
|
587
|
-
}) :
|
|
532
|
+
}) : _react.default.createElement(_index.Icon, {
|
|
588
533
|
className: "".concat(advancedSelectorfixCls, "-dropdown-options-item-collect-icon"),
|
|
589
534
|
type: "star",
|
|
590
535
|
onClick: function onClick() {
|
|
@@ -598,21 +543,13 @@ var InternalBaseData = function InternalBaseData(props, ref) {
|
|
|
598
543
|
var renderSearchValue = function renderSearchValue(item, column) {
|
|
599
544
|
return searchField === 'all' || searchField === column.key ? findSearchValue(item[column.key]) : item[column.key];
|
|
600
545
|
};
|
|
601
|
-
/**
|
|
602
|
-
* 渲染下拉项
|
|
603
|
-
*
|
|
604
|
-
* @param {IOptionsProps} data 下拉列表的数据
|
|
605
|
-
* @param {IColumnsProps} myColumns 下拉列表的展示列
|
|
606
|
-
* @param {boolean} showCheckbox 是否显示多选框
|
|
607
|
-
* @returns {React.ReactNode}
|
|
608
|
-
*/
|
|
609
546
|
var renderOptionsContent = function renderOptionsContent(data, myColumns) {
|
|
610
547
|
var showCheckbox = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
611
|
-
return
|
|
548
|
+
return _react.default.createElement(_react.default.Fragment, null, (0, _map.default)(data).call(data, function (item, index) {
|
|
612
549
|
if (index + 1 > size) {
|
|
613
550
|
return null;
|
|
614
551
|
}
|
|
615
|
-
return
|
|
552
|
+
return _react.default.createElement("div", {
|
|
616
553
|
key: item.value,
|
|
617
554
|
className: (0, _classnames.default)("".concat(advancedSelectorfixCls, "-dropdown-options"), {
|
|
618
555
|
selected: seletedOptions.some(function (v) {
|
|
@@ -623,11 +560,11 @@ var InternalBaseData = function InternalBaseData(props, ref) {
|
|
|
623
560
|
return handleSelect(item);
|
|
624
561
|
}
|
|
625
562
|
}, (0, _map.default)(myColumns).call(myColumns, function (column, index) {
|
|
626
|
-
return
|
|
563
|
+
return _react.default.createElement("span", {
|
|
627
564
|
key: column.key,
|
|
628
565
|
className: "".concat(advancedSelectorfixCls, "-dropdown-options-item"),
|
|
629
566
|
title: item[column.key]
|
|
630
|
-
}, isMultiple && showCheckbox && index === 0 &&
|
|
567
|
+
}, isMultiple && showCheckbox && index === 0 && _react.default.createElement(_index.Checkbox, {
|
|
631
568
|
style: {
|
|
632
569
|
marginRight: 5
|
|
633
570
|
},
|
|
@@ -639,41 +576,35 @@ var InternalBaseData = function InternalBaseData(props, ref) {
|
|
|
639
576
|
}));
|
|
640
577
|
}));
|
|
641
578
|
};
|
|
642
|
-
/**
|
|
643
|
-
* 标注出搜索的文字
|
|
644
|
-
*
|
|
645
|
-
* @param {string} title 搜索的文字
|
|
646
|
-
* @returns {React.ReactNode}
|
|
647
|
-
*/
|
|
648
579
|
var findSearchValue = function findSearchValue(title) {
|
|
649
580
|
var _searchInfo$current$s = searchInfo.current.searchValue,
|
|
650
581
|
searchValue = _searchInfo$current$s === void 0 ? '' : _searchInfo$current$s;
|
|
651
582
|
var index = title.indexOf(searchValue);
|
|
652
583
|
var beforeStr = title.substr(0, index);
|
|
653
584
|
var afterStr = title.substr(index + searchValue.length);
|
|
654
|
-
var content = index > -1 ?
|
|
585
|
+
var content = index > -1 ? _react.default.createElement("span", null, beforeStr, _react.default.createElement("span", {
|
|
655
586
|
className: "".concat(advancedSelectorfixCls, "-dropdown-options-item-search")
|
|
656
|
-
}, searchValue), afterStr) :
|
|
587
|
+
}, searchValue), afterStr) : _react.default.createElement("span", null, title);
|
|
657
588
|
return content;
|
|
658
589
|
};
|
|
659
590
|
var renderHistoryContent = function renderHistoryContent() {
|
|
660
591
|
if (!showFrequent) {
|
|
661
592
|
return null;
|
|
662
593
|
}
|
|
663
|
-
return
|
|
594
|
+
return _react.default.createElement(_index.Tabs, {
|
|
664
595
|
defaultActiveKey: "history"
|
|
665
|
-
},
|
|
596
|
+
}, _react.default.createElement(_index.Tabs.TabPane, {
|
|
666
597
|
key: "history",
|
|
667
598
|
tab: baseDataLangMsg.history
|
|
668
|
-
}, renderDropdownContent(historyList, columns)),
|
|
599
|
+
}, renderDropdownContent(historyList, columns)), _react.default.createElement(_index.Tabs.TabPane, {
|
|
669
600
|
key: "collect",
|
|
670
601
|
tab: baseDataLangMsg.favorites
|
|
671
602
|
}, renderDropdownContent(collectList, columns)));
|
|
672
603
|
};
|
|
673
604
|
var renderNotContent = (0, _react.useCallback)(function () {
|
|
674
|
-
return
|
|
605
|
+
return _react.default.createElement("div", {
|
|
675
606
|
className: "".concat(advancedSelectorfixCls, "-dropdown-empty")
|
|
676
|
-
},
|
|
607
|
+
}, _react.default.createElement(_index.Empty, null));
|
|
677
608
|
}, [advancedSelectorfixCls]);
|
|
678
609
|
var catchStyle = function catchStyle() {
|
|
679
610
|
if (advancedSelectorRef === null || advancedSelectorRef === void 0 ? void 0 : advancedSelectorRef.current) {
|
|
@@ -703,7 +634,7 @@ var InternalBaseData = function InternalBaseData(props, ref) {
|
|
|
703
634
|
});
|
|
704
635
|
return (0, _usePopper.default)(renderAdvancedSelector(), renderContent(), popperProps);
|
|
705
636
|
};
|
|
706
|
-
var BaseData =
|
|
637
|
+
var BaseData = _react.default.forwardRef(InternalBaseData);
|
|
707
638
|
BaseData.displayName = 'BaseData';
|
|
708
639
|
var _default = BaseData;
|
|
709
640
|
exports.default = _default;
|
|
@@ -75,7 +75,7 @@ var Breadcrumb = function Breadcrumb(props) {
|
|
|
75
75
|
var _context, _context2, _classNames;
|
|
76
76
|
return (0, _classnames.default)(item.className, "".concat(breadcrumbPrefixCls, "-item"), (_classNames = {}, (0, _defineProperty2.default)(_classNames, "".concat(breadcrumbPrefixCls, "-item-link"), (item === null || item === void 0 ? void 0 : item.path) || (item === null || item === void 0 ? void 0 : item.href)), (0, _defineProperty2.default)(_classNames, (0, _concat.default)(_context = "".concat(breadcrumbPrefixCls, "-item-")).call(_context, colorModel || 'emphasize', "-model-current"), isLast), (0, _defineProperty2.default)(_classNames, (0, _concat.default)(_context2 = "".concat(breadcrumbPrefixCls, "-item-")).call(_context2, colorModel || 'emphasize', "-model"), !isLast), _classNames));
|
|
77
77
|
};
|
|
78
|
-
var MIN_ITEM = 3;
|
|
78
|
+
var MIN_ITEM = 3;
|
|
79
79
|
var isLastItem = function isLastItem(index, items) {
|
|
80
80
|
return index === (items === null || items === void 0 ? void 0 : items.length) - 1;
|
|
81
81
|
};
|
|
@@ -83,17 +83,17 @@ var Breadcrumb = function Breadcrumb(props) {
|
|
|
83
83
|
if (isLastItem(index, items)) {
|
|
84
84
|
return null;
|
|
85
85
|
} else {
|
|
86
|
-
return
|
|
86
|
+
return _react.default.createElement("span", {
|
|
87
87
|
className: breadcrumbSeparatorClass
|
|
88
88
|
}, separator);
|
|
89
89
|
}
|
|
90
90
|
};
|
|
91
91
|
var getMoreIconContent = function getMoreIconContent(items) {
|
|
92
92
|
var MoreItems = function MoreItems() {
|
|
93
|
-
return
|
|
93
|
+
return _react.default.createElement("div", {
|
|
94
94
|
className: breadcrumbMorePanelClass
|
|
95
95
|
}, (0, _map.default)(items).call(items, function (item, index) {
|
|
96
|
-
return
|
|
96
|
+
return _react.default.createElement(_breadcrumbItem.default, {
|
|
97
97
|
key: "breadcrumb--more-item-".concat(index),
|
|
98
98
|
index: index,
|
|
99
99
|
item: (0, _extends2.default)((0, _extends2.default)({}, item), {
|
|
@@ -103,13 +103,13 @@ var Breadcrumb = function Breadcrumb(props) {
|
|
|
103
103
|
});
|
|
104
104
|
}));
|
|
105
105
|
};
|
|
106
|
-
return
|
|
106
|
+
return _react.default.createElement(_react.default.Fragment, null, _react.default.createElement(_tooltip.default, {
|
|
107
107
|
popperClassName: breadcrumbPopperClass,
|
|
108
108
|
arrow: false,
|
|
109
|
-
tip:
|
|
109
|
+
tip: _react.default.createElement(MoreItems, null),
|
|
110
110
|
trigger: "hover",
|
|
111
111
|
placement: "bottomLeft"
|
|
112
|
-
},
|
|
112
|
+
}, _react.default.createElement(_icon.default, {
|
|
113
113
|
type: "more"
|
|
114
114
|
})));
|
|
115
115
|
};
|
|
@@ -189,12 +189,12 @@ var Breadcrumb = function Breadcrumb(props) {
|
|
|
189
189
|
});
|
|
190
190
|
};
|
|
191
191
|
}, [itemsArray, breadcrumbWidth]);
|
|
192
|
-
return
|
|
192
|
+
return _react.default.createElement(_react.default.Fragment, null, _react.default.createElement("div", (0, _extends2.default)({
|
|
193
193
|
className: breadcrumbClass
|
|
194
194
|
}, others, {
|
|
195
195
|
ref: breadcrumbRef
|
|
196
196
|
}), (itemsConfig === null || itemsConfig === void 0 ? void 0 : itemsConfig.length) > 0 && (0, _map.default)(itemsConfig).call(itemsConfig, function (item, index) {
|
|
197
|
-
return
|
|
197
|
+
return _react.default.createElement(_breadcrumbItem.default, {
|
|
198
198
|
key: "breadcrumb-item-".concat(index),
|
|
199
199
|
item: (0, _extends2.default)((0, _extends2.default)({}, item), {
|
|
200
200
|
className: getBreadcrumbItemClass(item, isLastItem(index, itemsConfig))
|
|
@@ -204,12 +204,12 @@ var Breadcrumb = function Breadcrumb(props) {
|
|
|
204
204
|
separator: getSeparator(index, itemsConfig),
|
|
205
205
|
openEllipsis: isLastItem(index, itemsConfig) ? openEllipsis : false
|
|
206
206
|
});
|
|
207
|
-
})),
|
|
207
|
+
})), _react.default.createElement("div", {
|
|
208
208
|
className: breadcrumbHideIconClass,
|
|
209
209
|
ref: breadcrumbHideIconRef
|
|
210
|
-
},
|
|
210
|
+
}, _react.default.createElement(_icon.default, {
|
|
211
211
|
type: "more"
|
|
212
|
-
}),
|
|
212
|
+
}), _react.default.createElement("span", {
|
|
213
213
|
className: breadcrumbSeparatorClass
|
|
214
214
|
}, separator)));
|
|
215
215
|
};
|
|
@@ -44,21 +44,21 @@ var BreadcrumbItem = function BreadcrumbItem(props) {
|
|
|
44
44
|
}
|
|
45
45
|
onItemClick && onItemClick(item, index);
|
|
46
46
|
};
|
|
47
|
-
return
|
|
47
|
+
return _react.default.createElement(_react.default.Fragment, null, _react.default.createElement("div", {
|
|
48
48
|
className: className,
|
|
49
49
|
onClick: handleItemClick
|
|
50
|
-
}, icon &&
|
|
50
|
+
}, icon && _react.default.createElement("div", {
|
|
51
51
|
className: itemIconCls
|
|
52
|
-
}, icon),
|
|
52
|
+
}, icon), _react.default.createElement("div", {
|
|
53
53
|
className: itemTextCls,
|
|
54
54
|
title: typeof title === 'string' ? title : '',
|
|
55
55
|
style: {
|
|
56
56
|
maxWidth: openEllipsis ? '170px' : 'unset',
|
|
57
57
|
overflow: openEllipsis ? 'hidden' : 'inherit'
|
|
58
58
|
}
|
|
59
|
-
}, title), dropdownProps && 'menu' in dropdownProps &&
|
|
59
|
+
}, title), dropdownProps && 'menu' in dropdownProps && _react.default.createElement(_dropdown.default, (0, _extends2.default)({
|
|
60
60
|
placement: "bottomRight"
|
|
61
|
-
}, dropdownProps),
|
|
61
|
+
}, dropdownProps), _react.default.createElement(_icon.default, {
|
|
62
62
|
type: "arrow-down"
|
|
63
63
|
})), separator));
|
|
64
64
|
};
|
package/lib/button/button.js
CHANGED
|
@@ -45,7 +45,7 @@ var InternalButton = function InternalButton(props, ref) {
|
|
|
45
45
|
getPrefixCls = _useContext.getPrefixCls,
|
|
46
46
|
prefixCls = _useContext.prefixCls,
|
|
47
47
|
userDefaultProps = _useContext.compDefaultProps;
|
|
48
|
-
var buttonProps = (0, _utils.getCompProps)('Button', userDefaultProps, props);
|
|
48
|
+
var buttonProps = (0, _utils.getCompProps)('Button', userDefaultProps, props);
|
|
49
49
|
var type = buttonProps.type,
|
|
50
50
|
iconPlace = buttonProps.iconPlace,
|
|
51
51
|
children = buttonProps.children,
|
|
@@ -64,24 +64,16 @@ var InternalButton = function InternalButton(props, ref) {
|
|
|
64
64
|
htmlType = _buttonProps$htmlType === void 0 ? 'button' : _buttonProps$htmlType,
|
|
65
65
|
others = __rest(buttonProps, ["type", "iconPlace", "children", "className", "prefixCls", "size", "loading", "shape", "bordered", "onClick", "icon", "ghost", "block", "disabled", "htmlType"]);
|
|
66
66
|
(0, _devwarning.default)(ButtonTypes.indexOf(type) === -1, 'button', "cannot found button type '".concat(type, "'"));
|
|
67
|
-
var btnPrefixCls = getPrefixCls(prefixCls, 'btn', customPrefixcls);
|
|
68
|
-
/**
|
|
69
|
-
* 按钮click事件处理
|
|
70
|
-
* @param {React.MouseEvent<HTMLButtonElement | HTMLAnchorElement, MouseEvent>} e 事件对象
|
|
71
|
-
*/
|
|
67
|
+
var btnPrefixCls = getPrefixCls(prefixCls, 'btn', customPrefixcls);
|
|
72
68
|
var handleClick = function handleClick(e) {
|
|
73
69
|
if (loading || disabled) {
|
|
74
|
-
// 加载中和禁用状态不触发点击事件
|
|
75
70
|
return;
|
|
76
71
|
}
|
|
77
72
|
var waveStatus = buttonRef.current.getAttribute('click-animating-wave');
|
|
78
|
-
// 进入时是否在加载动画
|
|
79
73
|
if (waveStatus === 'true') {
|
|
80
74
|
buttonRef.current.setAttribute('click-animating-wave', false);
|
|
81
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
82
75
|
window.getComputedStyle(buttonRef.current).animationPlayState;
|
|
83
76
|
}
|
|
84
|
-
// 启动动画
|
|
85
77
|
buttonRef.current.setAttribute('click-animating-wave', true);
|
|
86
78
|
buttonRef.current.addEventListener('animationend', onAnimationEnd);
|
|
87
79
|
onClick && onClick(e);
|
|
@@ -93,24 +85,21 @@ var InternalButton = function InternalButton(props, ref) {
|
|
|
93
85
|
e.target.setAttribute('click-animating-wave', 'false');
|
|
94
86
|
removeEventListener('animationend', onAnimationEnd);
|
|
95
87
|
};
|
|
96
|
-
|
|
97
|
-
var buttonRef = ref || /*#__PURE__*/_react.default.createRef();
|
|
98
|
-
// 对children进行进一步处理,目前只处理typeof child === 'string'的情况,后续有特殊情况的在此方法处理
|
|
88
|
+
var buttonRef = ref || _react.default.createRef();
|
|
99
89
|
var handleChild = function handleChild(child) {
|
|
100
90
|
if (typeof child === 'string') {
|
|
101
|
-
return
|
|
91
|
+
return _react.default.createElement("span", null, child);
|
|
102
92
|
}
|
|
103
|
-
|
|
104
93
|
return child;
|
|
105
94
|
};
|
|
106
|
-
var isTextBtn = type === 'text';
|
|
95
|
+
var isTextBtn = type === 'text';
|
|
107
96
|
var btnClasses = (0, _classnames.default)(btnPrefixCls, className, (_classNames = {}, (0, _defineProperty2.default)(_classNames, (0, _concat.default)(_context = "".concat(btnPrefixCls, "-")).call(_context, type), type), (0, _defineProperty2.default)(_classNames, (0, _concat.default)(_context2 = "".concat(btnPrefixCls, "-size-")).call(_context2, size), size), (0, _defineProperty2.default)(_classNames, (0, _concat.default)(_context3 = "".concat(btnPrefixCls, "-shape-")).call(_context3, shape), shape && !isTextBtn), (0, _defineProperty2.default)(_classNames, "".concat(btnPrefixCls, "-no-border"), !bordered), (0, _defineProperty2.default)(_classNames, "".concat(btnPrefixCls, "-background-ghost"), ghost && !disabled), (0, _defineProperty2.default)(_classNames, "".concat(btnPrefixCls, "-loading"), loading && !isTextBtn), (0, _defineProperty2.default)(_classNames, "".concat(btnPrefixCls, "-block"), block && !shape), (0, _defineProperty2.default)(_classNames, "".concat(btnPrefixCls, "-icon-only"), !children && children !== 0 && icon), _classNames));
|
|
108
97
|
var iconWrapperClassName = (0, _concat.default)(_context4 = "".concat(btnPrefixCls, "-iconWrapper-")).call(_context4, iconPlace === 'left' ? 'left' : 'right');
|
|
109
|
-
var iconNode = icon && !loading ?
|
|
98
|
+
var iconNode = icon && !loading ? _react.default.createElement("span", {
|
|
110
99
|
className: iconWrapperClassName
|
|
111
|
-
}, icon) : loading ?
|
|
100
|
+
}, icon) : loading ? _react.default.createElement("span", {
|
|
112
101
|
className: iconWrapperClassName
|
|
113
|
-
},
|
|
102
|
+
}, _react.default.createElement(_index.Icon, {
|
|
114
103
|
className: (0, _concat.default)(_context5 = "".concat(btnPrefixCls, "-")).call(_context5, type === ButtonTypes[1] ? 'primary-loadingIcon' : 'loadingIcon'),
|
|
115
104
|
type: "loadding",
|
|
116
105
|
spin: true
|
|
@@ -118,14 +107,14 @@ var InternalButton = function InternalButton(props, ref) {
|
|
|
118
107
|
var btnChild = handleChild(children);
|
|
119
108
|
switch (type) {
|
|
120
109
|
case 'text':
|
|
121
|
-
return
|
|
110
|
+
return _react.default.createElement("span", (0, _extends2.default)({
|
|
122
111
|
ref: buttonRef,
|
|
123
112
|
className: btnClasses,
|
|
124
113
|
onClick: handleClick,
|
|
125
114
|
disabled: disabled
|
|
126
115
|
}, others), iconNode, children);
|
|
127
116
|
default:
|
|
128
|
-
return
|
|
117
|
+
return _react.default.createElement("button", (0, _extends2.default)({
|
|
129
118
|
ref: buttonRef,
|
|
130
119
|
className: btnClasses,
|
|
131
120
|
onClick: handleClick,
|
|
@@ -133,14 +122,14 @@ var InternalButton = function InternalButton(props, ref) {
|
|
|
133
122
|
type: htmlType
|
|
134
123
|
}, others, {
|
|
135
124
|
"click-animating-wave": "false"
|
|
136
|
-
}), iconPlace === 'left' ?
|
|
125
|
+
}), iconPlace === 'left' ? _react.default.createElement(_react.default.Fragment, null, iconNode, !!(iconNode && children) && _react.default.createElement("span", {
|
|
137
126
|
className: "btn-space"
|
|
138
|
-
}), btnChild) :
|
|
127
|
+
}), btnChild) : _react.default.createElement(_react.default.Fragment, null, btnChild, !!(iconNode && children) && _react.default.createElement("span", {
|
|
139
128
|
className: "btn-space"
|
|
140
129
|
}), iconNode));
|
|
141
130
|
}
|
|
142
131
|
};
|
|
143
|
-
var Button =
|
|
132
|
+
var Button = _react.default.forwardRef(InternalButton);
|
|
144
133
|
Button.displayName = 'Button';
|
|
145
134
|
var _default = Button;
|
|
146
135
|
exports.default = _default;
|