@kdcloudjs/kdesign 1.8.11 → 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 +93 -15
- package/dist/kdesign.js.map +1 -1
- package/dist/kdesign.min.css +1 -1
- package/dist/kdesign.min.js +3 -3
- 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 +42 -104
- 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 +4 -1
- package/es/popper/index.js +84 -22
- 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 +42 -104
- 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 +4 -1
- package/lib/popper/index.js +84 -22
- 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
package/es/_utils/hooks.js
CHANGED
|
@@ -13,13 +13,6 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
13
13
|
import { useEffect, useState, useRef, useReducer } from 'react';
|
|
14
14
|
import ResizeObserver from 'resize-observer-polyfill';
|
|
15
15
|
import devWarning from './devwarning';
|
|
16
|
-
/**
|
|
17
|
-
* @description 点击指定区域外执行回调
|
|
18
|
-
*
|
|
19
|
-
* @export
|
|
20
|
-
* @param {RefObject<HTMLElement>[]} refs
|
|
21
|
-
* @param {(e: Event) => void} handler
|
|
22
|
-
*/
|
|
23
16
|
export function useOnClickOutside(refs, handler) {
|
|
24
17
|
useEffect(function () {
|
|
25
18
|
var listener = function listener(event) {
|
|
@@ -47,24 +40,7 @@ export function useOnClickOutside(refs, handler) {
|
|
|
47
40
|
};
|
|
48
41
|
}, [refs, handler]);
|
|
49
42
|
}
|
|
50
|
-
|
|
51
|
-
* @description 合并状态
|
|
52
|
-
*
|
|
53
|
-
* @export
|
|
54
|
-
* @template T
|
|
55
|
-
* @template R
|
|
56
|
-
* @param {(T | (() => T))} defaultStateValue
|
|
57
|
-
* @param {({
|
|
58
|
-
* defaultValue?: T | (() => T)
|
|
59
|
-
* value?: T
|
|
60
|
-
* onChange?: (value: T, prevValue: T) => void
|
|
61
|
-
* postState?: (value: T) => T
|
|
62
|
-
* })} [option]
|
|
63
|
-
* @returns {[R, (value: T) => void]}
|
|
64
|
-
*/
|
|
65
|
-
export function useMergedState(defaultStateValue,
|
|
66
|
-
// 初始state
|
|
67
|
-
option) {
|
|
43
|
+
export function useMergedState(defaultStateValue, option) {
|
|
68
44
|
var _ref = option || {},
|
|
69
45
|
defaultValue = _ref.defaultValue,
|
|
70
46
|
value = _ref.value,
|
|
@@ -104,12 +80,6 @@ option) {
|
|
|
104
80
|
}, [value]);
|
|
105
81
|
return [mergedValue, triggerChange];
|
|
106
82
|
}
|
|
107
|
-
/**
|
|
108
|
-
* @description 获取之前的值
|
|
109
|
-
*
|
|
110
|
-
* @export
|
|
111
|
-
* @param {P} value
|
|
112
|
-
*/
|
|
113
83
|
export function usePrevious(value) {
|
|
114
84
|
var ref = useRef(value);
|
|
115
85
|
useEffect(function () {
|
|
@@ -185,8 +155,7 @@ export function useResizeObserver(element, handler) {
|
|
|
185
155
|
return;
|
|
186
156
|
}
|
|
187
157
|
var contentRect = entries[0].contentRect;
|
|
188
|
-
var hide = contentRect.width === 0 && contentRect.height === 0;
|
|
189
|
-
// DOMRectReadOnly 对象不可读, 不可赋值
|
|
158
|
+
var hide = contentRect.width === 0 && contentRect.height === 0;
|
|
190
159
|
var rect = _extends({
|
|
191
160
|
hide: hide
|
|
192
161
|
}, contentRect);
|
|
@@ -221,7 +190,6 @@ export function useStateWithPromise(defaultVal) {
|
|
|
221
190
|
var _useState3 = useState({
|
|
222
191
|
value: defaultVal,
|
|
223
192
|
resolve: function resolve(e) {
|
|
224
|
-
// eslint-disable-next-line no-unused-expressions, @typescript-eslint/no-unused-expressions
|
|
225
193
|
e;
|
|
226
194
|
}
|
|
227
195
|
}),
|
package/es/_utils/index.js
CHANGED
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
import _extends from "@babel/runtime-corejs3/helpers/extends";
|
|
2
|
-
import compDefaultProps from '../config-provider/compDefaultProps';
|
|
3
|
-
/**
|
|
4
|
-
* 结合compDefaultProps、用户自定义默认属性和组件当前属性获取组件实际应用属性
|
|
5
|
-
* @param {keyof typeof compDefaultProps} compName 组件名
|
|
6
|
-
* @param {any} userDefaultProps 用户自定义组件默认属性
|
|
7
|
-
* @param {any} compProps 组件接收到的属性
|
|
8
|
-
*/
|
|
2
|
+
import compDefaultProps from '../config-provider/compDefaultProps';
|
|
9
3
|
export var getCompProps = function getCompProps(compName, userDefaultProps, compProps) {
|
|
10
4
|
var defaultProps = compDefaultProps[compName];
|
|
11
5
|
var userProps = userDefaultProps && userDefaultProps[compName] || {};
|
package/es/_utils/numberUtil.js
CHANGED
|
@@ -2,48 +2,29 @@ import _Number$isNaN from "@babel/runtime-corejs3/core-js-stable/number/is-nan";
|
|
|
2
2
|
import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/slice";
|
|
3
3
|
import _fillInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/fill";
|
|
4
4
|
import Big from 'big.js';
|
|
5
|
-
/**
|
|
6
|
-
* 使用定点表示法来格式化一个数
|
|
7
|
-
* @param {String|Number} number [必选,数字或者表示数字的字符串,范围为[0,20],超过范围则报错]
|
|
8
|
-
* @param {Number} digits [必选,小数点后数字的个数]
|
|
9
|
-
* @param {Boolean} isRound [可选,格式化时是否四舍五入,默认为false,即进行四舍五入,为false时直接截取,不满足位数的往后补0]
|
|
10
|
-
* @return {String} [结果]
|
|
11
|
-
*/
|
|
12
5
|
export function toFixed(number, digits) {
|
|
13
6
|
var isRound = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
14
|
-
// 非数字
|
|
15
|
-
// if (!/(^-\d+|^\d+)\.?\d*$/gi.test(number)) { // Number.isFinite(number)
|
|
16
|
-
// throw new Error('toFixed() number argument must be a valid number')
|
|
17
|
-
// }
|
|
18
7
|
if (_Number$isNaN(Number(number))) {
|
|
19
8
|
throw new Error('toFixed() number argument must be a valid number');
|
|
20
9
|
}
|
|
21
|
-
// 是否为正数
|
|
22
10
|
var isPositive = +number >= 0;
|
|
23
|
-
// 转化为字符串
|
|
24
11
|
number += '';
|
|
25
12
|
isRound = Boolean(isRound);
|
|
26
|
-
// 去掉正负号,统一按照正数来处理,最后再加上符号
|
|
27
13
|
number = number.replace(/^(?:-|\+)/gi, '');
|
|
28
|
-
// 小数点过大
|
|
29
14
|
if (digits > 20 || digits < 0) {
|
|
30
15
|
throw new RangeError('toFixed() digits argument must be between 0 and 20');
|
|
31
16
|
}
|
|
32
|
-
// 如果是简写如.11则整数位补0,变成0.11
|
|
33
17
|
if (/^\./gi.test(number)) {
|
|
34
18
|
number = '0' + number;
|
|
35
19
|
}
|
|
36
20
|
var numParts = number.split('.');
|
|
37
21
|
var result = '';
|
|
38
|
-
// 在str后面加n个0
|
|
39
22
|
var _paddingZero = function _paddingZero(str, n) {
|
|
40
23
|
for (var i = 0; i < n; i++) {
|
|
41
24
|
str += '0';
|
|
42
25
|
}
|
|
43
26
|
return str;
|
|
44
27
|
};
|
|
45
|
-
// 在str后面加0,直至str的长度达到n
|
|
46
|
-
// 如果超过了n,则直接截取前n个字符串
|
|
47
28
|
var _paddingZeroTo = function _paddingZeroTo(str, n) {
|
|
48
29
|
if (str.length >= n) {
|
|
49
30
|
return str.substr(0, n);
|
|
@@ -51,39 +32,24 @@ export function toFixed(number, digits) {
|
|
|
51
32
|
return _paddingZero(str, n - str.length);
|
|
52
33
|
}
|
|
53
34
|
};
|
|
54
|
-
// 直接就是整数
|
|
55
35
|
if (numParts.length < 2) {
|
|
56
36
|
result = numParts[0] + '.' + _paddingZero('', digits);
|
|
57
37
|
} else {
|
|
58
|
-
// 为浮点数
|
|
59
|
-
// 如果为截取
|
|
60
38
|
if (isRound === false) {
|
|
61
39
|
result = numParts[0] + '.' + _paddingZeroTo(numParts[1], digits);
|
|
62
|
-
// 如果为四舍五入
|
|
63
40
|
} else {
|
|
64
|
-
// 放大10的N次方倍
|
|
65
41
|
var enlarge = numParts[0] + _paddingZeroTo(numParts[1], digits) + '.' + numParts[1].substr(digits);
|
|
66
|
-
// 取整
|
|
67
42
|
enlarge = Math.round(parseFloat(enlarge)) + '';
|
|
68
|
-
// 缩小10的N次方
|
|
69
43
|
while (enlarge.length <= digits) {
|
|
70
44
|
enlarge = '0' + enlarge;
|
|
71
45
|
}
|
|
72
46
|
result = enlarge.substr(0, enlarge.length - digits) + '.' + enlarge.substr(enlarge.length - digits);
|
|
73
47
|
}
|
|
74
48
|
}
|
|
75
|
-
// 如果最后一位为.,则去除
|
|
76
49
|
result = result.replace(/\.$/gi, '').replace(/^\./gi, '0.');
|
|
77
|
-
// 加上正负数符号位
|
|
78
50
|
result = isPositive ? result : '-' + result;
|
|
79
51
|
return result;
|
|
80
52
|
}
|
|
81
|
-
/**
|
|
82
|
-
* 将已有的数字进行前面补零的方法
|
|
83
|
-
* @param {String|Number} number [需要在前面补零的数字]
|
|
84
|
-
* @param {Number} lenght [补零后的数字长度]
|
|
85
|
-
* 如:supplementZero(1, 4) return '0001'
|
|
86
|
-
*/
|
|
87
53
|
export function supplementZero(number) {
|
|
88
54
|
var _context;
|
|
89
55
|
var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
|
|
@@ -91,29 +57,20 @@ export function supplementZero(number) {
|
|
|
91
57
|
if (number.length > length) return number;
|
|
92
58
|
return _sliceInstanceProperty(_context = Array(length).join('0') + number).call(_context, -length);
|
|
93
59
|
}
|
|
94
|
-
/**
|
|
95
|
-
*
|
|
96
|
-
* 序列化字符串为数字,只取字符串中的数字、小数点、正负号
|
|
97
|
-
* @param {String} strNumber 字符串
|
|
98
|
-
*/
|
|
99
60
|
export function serialization(strNumber) {
|
|
100
61
|
var numberList = strNumber.match(/\d|^-|\./g);
|
|
101
62
|
if (!numberList) return '';
|
|
102
|
-
// 取出正负号
|
|
103
63
|
var sign = numberList[0] === '-' ? '-' : '';
|
|
104
64
|
if (sign === '-') {
|
|
105
|
-
// 有负号, 去掉数组的负号
|
|
106
65
|
numberList.shift();
|
|
107
66
|
}
|
|
108
67
|
var numberString = numberList.join('');
|
|
109
|
-
// .replace('.', 'a').replace(/\./g, '').replace('a', '.')
|
|
110
68
|
var res = numberString.replace(/^0{2,}/gi, '0');
|
|
111
69
|
if (/^(0[^.])/gi.test(res)) {
|
|
112
70
|
return sign + _sliceInstanceProperty(res).call(res, 1);
|
|
113
71
|
}
|
|
114
72
|
return sign + res;
|
|
115
73
|
}
|
|
116
|
-
// 根据整数精度和小数精度获取最大值
|
|
117
74
|
export function getMaxNumberByPrecision(integerPrecision, decimalPrecision) {
|
|
118
75
|
var _context2, _context3;
|
|
119
76
|
var integerString = _fillInstanceProperty(_context2 = Array(integerPrecision)).call(_context2, '9').reduce(function (res, value) {
|
|
@@ -123,19 +80,9 @@ export function getMaxNumberByPrecision(integerPrecision, decimalPrecision) {
|
|
|
123
80
|
return res += value;
|
|
124
81
|
}, integerString + '.'));
|
|
125
82
|
}
|
|
126
|
-
/**
|
|
127
|
-
* 判断是否为正则表达式
|
|
128
|
-
* @param {string|number} number 待判断的值
|
|
129
|
-
*/
|
|
130
83
|
export function isExp(number) {
|
|
131
84
|
return /\d+\.?\d*e[+-]*\d+/i.test(number.toString());
|
|
132
85
|
}
|
|
133
|
-
/**
|
|
134
|
-
* 将科学计数法显示的数字格式化为正常浮点数
|
|
135
|
-
* 1e-6 => 0.000006
|
|
136
|
-
* @param {Number} number 待格式化的科学计数法
|
|
137
|
-
* @returns num 格式化后的数值,如果不满足科学计数法的话,则原值返回
|
|
138
|
-
*/
|
|
139
86
|
export function exponentToFloat(number) {
|
|
140
87
|
var tempNumber = Number(number);
|
|
141
88
|
if (isNaN(tempNumber) || !isFinite(tempNumber) || number === '') return tempNumber.toString();
|
|
@@ -143,7 +90,6 @@ export function exponentToFloat(number) {
|
|
|
143
90
|
var bigNumValue = bigNum.valueOf();
|
|
144
91
|
var exponentReg = /^(?!-0(\.0+)?(e|$))-?(0|[1-9]\d*)(\.\d+)?(e-?(0|[1-9]\d*))?$/i;
|
|
145
92
|
if (exponentReg.test(bigNumValue)) {
|
|
146
|
-
// 获取精度, 默认 10
|
|
147
93
|
var lenArr = exponentReg.exec(bigNumValue);
|
|
148
94
|
var len = Number(lenArr && lenArr[6] ? lenArr[6] : 10);
|
|
149
95
|
var fixedNumber = bigNum.toFixed(len).valueOf();
|
package/es/_utils/raf.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var target = typeof window === 'undefined' ? global : window;
|
|
2
2
|
var vendors = ['webkit', 'ms', 'moz', 'o'];
|
|
3
|
-
var raf = target.requestAnimationFrame;
|
|
4
|
-
var caf = target.cancelAnimationFrame;
|
|
3
|
+
var raf = target.requestAnimationFrame;
|
|
4
|
+
var caf = target.cancelAnimationFrame;
|
|
5
5
|
if (!raf || !caf) {
|
|
6
6
|
vendors.some(function (prefix) {
|
|
7
7
|
raf = target["".concat(prefix, "RequestAnimationFrame")];
|
package/es/_utils/reactNode.js
CHANGED
|
@@ -3,7 +3,7 @@ var isValidElement = React.isValidElement;
|
|
|
3
3
|
export { isValidElement };
|
|
4
4
|
export function replaceElement(element, replacement, props) {
|
|
5
5
|
if (!isValidElement(element)) return replacement;
|
|
6
|
-
return
|
|
6
|
+
return React.cloneElement(element, typeof props === 'function' ? props(element.props || {}) : props);
|
|
7
7
|
}
|
|
8
8
|
export function isFragment(child) {
|
|
9
9
|
return child && isValidElement(child) && child.type === React.Fragment;
|
|
@@ -10,7 +10,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_R
|
|
|
10
10
|
import React from 'react';
|
|
11
11
|
import ResizeObserver from 'resize-observer-polyfill';
|
|
12
12
|
import { findDOMNode } from 'react-dom';
|
|
13
|
-
var ResizeObserverComponent =
|
|
13
|
+
var ResizeObserverComponent = function (_React$Component) {
|
|
14
14
|
_inherits(ResizeObserverComponent, _React$Component);
|
|
15
15
|
var _super = _createSuper(ResizeObserverComponent);
|
|
16
16
|
function ResizeObserverComponent() {
|
|
@@ -27,7 +27,6 @@ var ResizeObserverComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
27
27
|
var onResize = _this.props.onResize;
|
|
28
28
|
onResize && onResize(entry);
|
|
29
29
|
});
|
|
30
|
-
// eslint-disable-next-line react/no-find-dom-node
|
|
31
30
|
_this.resizeObserver.observe(findDOMNode(_assertThisInitialized(_this)));
|
|
32
31
|
};
|
|
33
32
|
_this.destroyResizeObserver = function () {
|
|
@@ -39,7 +38,7 @@ var ResizeObserverComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
39
38
|
_createClass(ResizeObserverComponent, [{
|
|
40
39
|
key: "componentDidMount",
|
|
41
40
|
value: function componentDidMount() {
|
|
42
|
-
if (!
|
|
41
|
+
if (!React.isValidElement(this.props.children)) {
|
|
43
42
|
console.warn('The children of ResizeObserver is invalid.');
|
|
44
43
|
} else {
|
|
45
44
|
this.createResizeObserver();
|
|
@@ -48,7 +47,6 @@ var ResizeObserverComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
48
47
|
}, {
|
|
49
48
|
key: "componentDidUpdate",
|
|
50
49
|
value: function componentDidUpdate() {
|
|
51
|
-
// eslint-disable-next-line react/no-find-dom-node
|
|
52
50
|
if (!this.resizeObserver && findDOMNode(this)) {
|
|
53
51
|
this.createResizeObserver();
|
|
54
52
|
}
|
package/es/_utils/type.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// https://stackoverflow.com/questions/46176165/ways-to-get-string-literal-type-of-array-values-without-enum-overhead
|
|
2
1
|
export var tuple = function tuple() {
|
|
3
2
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
4
3
|
args[_key] = arguments[_key];
|
package/es/_utils/usePopper.js
CHANGED
|
@@ -620,10 +620,10 @@ function usePopper(locatorElement, popperElement, props) {
|
|
|
620
620
|
};
|
|
621
621
|
}
|
|
622
622
|
}, [getTriggerElement, hidePopper, locatorRef, mouseEnterDelay, mousePos, showPopper, trigger, visible]);
|
|
623
|
-
var Locator =
|
|
623
|
+
var Locator = cloneElement(locatorElement, {
|
|
624
624
|
ref: locatorRef
|
|
625
625
|
});
|
|
626
|
-
var Popper =
|
|
627
|
-
return
|
|
626
|
+
var Popper = React.createElement("div", _extends({}, popperProps), popperElement);
|
|
627
|
+
return React.createElement(React.Fragment, null, Locator, exist && container && ReactDOM.createPortal(Popper, container));
|
|
628
628
|
}
|
|
629
629
|
export default usePopper;
|
package/es/alert/alert.js
CHANGED
|
@@ -37,18 +37,10 @@ var setContainerStyle = function setContainerStyle(dom, posInfo) {
|
|
|
37
37
|
dom.style.setProperty(prop, styles[prop]);
|
|
38
38
|
});
|
|
39
39
|
};
|
|
40
|
-
/**
|
|
41
|
-
* @description 创建悬浮顶部的反馈浮层容器
|
|
42
|
-
* @param alertContainer 反馈浮层容器ref
|
|
43
|
-
* @param alertPrefixCls 反馈浮层前缀class
|
|
44
|
-
* @param bannerOffset 反馈浮层悬浮顶部的坐标量
|
|
45
|
-
*
|
|
46
|
-
*/
|
|
47
40
|
function createAlertContainer(alertContainer, alertPrefixCls, bannerOffset) {
|
|
48
41
|
var posKey = bannerOffset.join(',');
|
|
49
42
|
var container = document.createElement('div');
|
|
50
43
|
container.classList.add("".concat(alertPrefixCls, "-banner-container"));
|
|
51
|
-
// container.classList.add(`${alertPrefixCls}-banner-container-flex`)
|
|
52
44
|
setContainerStyle(container, bannerOffset);
|
|
53
45
|
alertContainer.current = container;
|
|
54
46
|
allBannerAlertPortalsContainer.appendChild(container);
|
|
@@ -60,7 +52,7 @@ var Alert = function Alert(props) {
|
|
|
60
52
|
getPrefixCls = _useContext.getPrefixCls,
|
|
61
53
|
prefixCls = _useContext.prefixCls,
|
|
62
54
|
userDefaultProps = _useContext.compDefaultProps;
|
|
63
|
-
var alertProps = getCompProps('Alert', userDefaultProps, props);
|
|
55
|
+
var alertProps = getCompProps('Alert', userDefaultProps, props);
|
|
64
56
|
var type = alertProps.type,
|
|
65
57
|
message = alertProps.message,
|
|
66
58
|
showIcon = alertProps.showIcon,
|
|
@@ -162,26 +154,26 @@ var Alert = function Alert(props) {
|
|
|
162
154
|
var _context2;
|
|
163
155
|
return _concatInstanceProperty(_context2 = "alert-".concat(type, "-")).call(_context2, mode, "-color");
|
|
164
156
|
};
|
|
165
|
-
var iconNode =
|
|
157
|
+
var iconNode = React.createElement("div", {
|
|
166
158
|
className: classNames("".concat(alertPrefixCls, "-icon"), getAlertColorType('icon'))
|
|
167
|
-
}, icon ||
|
|
159
|
+
}, icon || React.createElement(Icon, {
|
|
168
160
|
type: alertIconType
|
|
169
161
|
}));
|
|
170
|
-
var AlertComp =
|
|
162
|
+
var AlertComp = React.createElement("div", _extends({
|
|
171
163
|
className: classNames(alertClasses, getAlertColorType('bg'), getAlertColorType('border'))
|
|
172
164
|
}, events, {
|
|
173
165
|
ref: alertRef,
|
|
174
166
|
style: style
|
|
175
|
-
}, othersProps), showIcon && iconNode,
|
|
167
|
+
}, othersProps), showIcon && iconNode, React.createElement("div", {
|
|
176
168
|
className: classNames((_classNames2 = {}, _defineProperty(_classNames2, "".concat(alertPrefixCls, "-message"), true), _defineProperty(_classNames2, "".concat(alertPrefixCls, "-without-icon-message"), !showIcon), _classNames2))
|
|
177
|
-
}, message), extra, closable && type !== 'success' &&
|
|
169
|
+
}, message), extra, closable && type !== 'success' && React.createElement("div", {
|
|
178
170
|
className: "".concat(alertPrefixCls, "-close-icon"),
|
|
179
171
|
onClick: handleClose
|
|
180
|
-
}, closeNode ||
|
|
172
|
+
}, closeNode || React.createElement(Icon, {
|
|
181
173
|
type: "close"
|
|
182
174
|
})));
|
|
183
175
|
if (banner) {
|
|
184
|
-
return
|
|
176
|
+
return ReactDOM.createPortal(AlertComp, alertContainer.current);
|
|
185
177
|
} else {
|
|
186
178
|
return AlertComp;
|
|
187
179
|
}
|
package/es/anchor/anchor-link.js
CHANGED
|
@@ -14,7 +14,7 @@ var AnchorLink = function AnchorLink(props) {
|
|
|
14
14
|
var _useContext = useContext(ConfigContext),
|
|
15
15
|
getPrefixCls = _useContext.getPrefixCls,
|
|
16
16
|
prefixCls = _useContext.prefixCls;
|
|
17
|
-
var anchorLinkPrefixCls = getPrefixCls(prefixCls, 'anchor', customPrefixcls);
|
|
17
|
+
var anchorLinkPrefixCls = getPrefixCls(prefixCls, 'anchor', customPrefixcls);
|
|
18
18
|
var _useContext2 = useContext(AnchorContext),
|
|
19
19
|
activeLink = _useContext2.activeLink,
|
|
20
20
|
scrollTo = _useContext2.scrollTo,
|
|
@@ -45,9 +45,9 @@ var AnchorLink = function AnchorLink(props) {
|
|
|
45
45
|
var active = activeLink === href;
|
|
46
46
|
var anchorLinkClasses = classNames("".concat(anchorLinkPrefixCls, "-link"), _defineProperty({}, "".concat(anchorLinkPrefixCls, "-link-active"), active), className);
|
|
47
47
|
var titleClassName = classNames("".concat(anchorLinkPrefixCls, "-link-title"), (_classNames2 = {}, _defineProperty(_classNames2, "".concat(anchorLinkPrefixCls, "-link-title-active"), active), _defineProperty(_classNames2, "".concat(anchorLinkPrefixCls, "-link-title-secondary"), !isFirstLevel && type === 'bookmarks'), _classNames2));
|
|
48
|
-
return
|
|
48
|
+
return React.createElement("div", {
|
|
49
49
|
className: anchorLinkClasses
|
|
50
|
-
},
|
|
50
|
+
}, React.createElement("span", {
|
|
51
51
|
title: typeof title === 'string' ? title : '',
|
|
52
52
|
className: titleClassName,
|
|
53
53
|
onClick: handleClick
|
package/es/anchor/anchor.js
CHANGED
|
@@ -127,7 +127,7 @@ var InternalAnchor = function InternalAnchor(props, ref) {
|
|
|
127
127
|
affix = anchorProps.affix,
|
|
128
128
|
dropdownStyle = anchorProps.dropdownStyle,
|
|
129
129
|
onVisibleChange = anchorProps.onVisibleChange;
|
|
130
|
-
var anchorPrefixCls = getPrefixCls(prefixCls, 'anchor', customPrefixcls);
|
|
130
|
+
var anchorPrefixCls = getPrefixCls(prefixCls, 'anchor', customPrefixcls);
|
|
131
131
|
devWarning(AnchorTypes.indexOf(type) === -1, 'anchor', "cannot found anchor type '".concat(type, "'"));
|
|
132
132
|
var _useState = useState(null),
|
|
133
133
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -170,18 +170,16 @@ var InternalAnchor = function InternalAnchor(props, ref) {
|
|
|
170
170
|
isLocked = _useState20[0],
|
|
171
171
|
setIsLocked = _useState20[1];
|
|
172
172
|
var isAdcanced = type === 'advanced';
|
|
173
|
-
// ref
|
|
174
173
|
var wrapperRef = React.useRef(null);
|
|
175
174
|
var inkRef = React.useRef(null);
|
|
176
175
|
var linkContentRef = React.useRef(null);
|
|
177
176
|
var iconRef = React.useRef(null);
|
|
178
|
-
var menuWrapRef =
|
|
177
|
+
var menuWrapRef = React.createRef();
|
|
179
178
|
var normalRef = React.useRef(null);
|
|
180
179
|
var anchorRef = ref || normalRef;
|
|
181
180
|
var linksWidthRef = React.useRef([]);
|
|
182
181
|
var animating = React.useRef(false);
|
|
183
182
|
var wrapperClass = classNames(className, _defineProperty({}, "".concat(anchorPrefixCls, "-wrapper"), true));
|
|
184
|
-
// classes
|
|
185
183
|
var anchorMenuClass = classNames(_defineProperty({}, "".concat(anchorPrefixCls, "-menu"), true));
|
|
186
184
|
var anchorAdvancedClass = classNames(_defineProperty({}, "".concat(anchorPrefixCls, "-advanced"), true));
|
|
187
185
|
var inkClass = classNames("".concat(anchorPrefixCls, "-line-slider"), {
|
|
@@ -199,7 +197,6 @@ var InternalAnchor = function InternalAnchor(props, ref) {
|
|
|
199
197
|
}
|
|
200
198
|
}, [anchorPrefixCls, anchorRef, isAdcanced]);
|
|
201
199
|
var mounting = React.useRef(true);
|
|
202
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
203
200
|
useEffect(function () {
|
|
204
201
|
var _a;
|
|
205
202
|
if (mounting.current) {
|
|
@@ -383,27 +380,27 @@ var InternalAnchor = function InternalAnchor(props, ref) {
|
|
|
383
380
|
var _context4;
|
|
384
381
|
return _mapInstanceProperty(_context4 = toArray(linksChildren)).call(_context4, function (item, indx) {
|
|
385
382
|
if (!item) return item;
|
|
386
|
-
return
|
|
383
|
+
return React.cloneElement(item, {
|
|
387
384
|
isFirstLevel: true,
|
|
388
385
|
key: indx
|
|
389
386
|
});
|
|
390
387
|
});
|
|
391
388
|
};
|
|
392
389
|
var anchorBookmarksContent = function anchorBookmarksContent(ref) {
|
|
393
|
-
return
|
|
390
|
+
return React.createElement("div", {
|
|
394
391
|
ref: ref,
|
|
395
392
|
className: wrapperClass,
|
|
396
393
|
style: style
|
|
397
|
-
},
|
|
394
|
+
}, React.createElement("div", {
|
|
398
395
|
className: anchorPrefixCls,
|
|
399
396
|
style: fixedTop ? {
|
|
400
397
|
position: 'fixed',
|
|
401
398
|
top: offsetTop || 0,
|
|
402
399
|
width: anchorPosition.width
|
|
403
400
|
} : undefined
|
|
404
|
-
},
|
|
401
|
+
}, React.createElement("div", {
|
|
405
402
|
className: "".concat(anchorPrefixCls, "-line")
|
|
406
|
-
},
|
|
403
|
+
}, React.createElement("span", {
|
|
407
404
|
className: inkClass,
|
|
408
405
|
ref: inkRef
|
|
409
406
|
})), addChildrenProps(children)));
|
|
@@ -417,10 +414,10 @@ var InternalAnchor = function InternalAnchor(props, ref) {
|
|
|
417
414
|
setPositionHistory(positions);
|
|
418
415
|
setListPosition(positions[positions.length - 1]);
|
|
419
416
|
};
|
|
420
|
-
return
|
|
417
|
+
return React.createElement("span", {
|
|
421
418
|
className: leftClasses,
|
|
422
419
|
onClick: handleLeft
|
|
423
|
-
},
|
|
420
|
+
}, React.createElement(Icon, {
|
|
424
421
|
type: "arrow-left"
|
|
425
422
|
}));
|
|
426
423
|
};
|
|
@@ -447,20 +444,20 @@ var InternalAnchor = function InternalAnchor(props, ref) {
|
|
|
447
444
|
});
|
|
448
445
|
setListPosition(posiostion);
|
|
449
446
|
};
|
|
450
|
-
return
|
|
447
|
+
return React.createElement("span", {
|
|
451
448
|
className: rightClasses,
|
|
452
449
|
onClick: handleRight
|
|
453
|
-
},
|
|
450
|
+
}, React.createElement(Icon, {
|
|
454
451
|
type: "arrow-right"
|
|
455
452
|
}));
|
|
456
453
|
};
|
|
457
|
-
var anchorMenuContent =
|
|
454
|
+
var anchorMenuContent = React.createElement("div", {
|
|
458
455
|
ref: anchorRef,
|
|
459
456
|
className: "".concat(anchorPrefixCls, "-menu-wrapper"),
|
|
460
457
|
style: _extends({
|
|
461
458
|
width: '100%'
|
|
462
459
|
}, style)
|
|
463
|
-
},
|
|
460
|
+
}, React.createElement("div", {
|
|
464
461
|
className: anchorMenuClass,
|
|
465
462
|
style: fixedTop ? {
|
|
466
463
|
position: 'fixed',
|
|
@@ -469,13 +466,13 @@ var InternalAnchor = function InternalAnchor(props, ref) {
|
|
|
469
466
|
} : {
|
|
470
467
|
width: style === null || style === void 0 ? void 0 : style.width
|
|
471
468
|
}
|
|
472
|
-
}, renderLeftArrow(),
|
|
469
|
+
}, renderLeftArrow(), React.createElement("div", {
|
|
473
470
|
className: "".concat(anchorPrefixCls, "-menu-wrap"),
|
|
474
471
|
ref: menuWrapRef,
|
|
475
472
|
style: {
|
|
476
473
|
maxWidth: listWidth
|
|
477
474
|
}
|
|
478
|
-
},
|
|
475
|
+
}, React.createElement("div", {
|
|
479
476
|
ref: linkContentRef,
|
|
480
477
|
className: "".concat(anchorPrefixCls, "-menu-link-list"),
|
|
481
478
|
style: {
|
|
@@ -484,27 +481,27 @@ var InternalAnchor = function InternalAnchor(props, ref) {
|
|
|
484
481
|
}, children)), renderRightArrow()));
|
|
485
482
|
var renderAnchorAdvanced = function renderAnchorAdvanced() {
|
|
486
483
|
var iconList = toArray(lockedIcon);
|
|
487
|
-
var unlock = iconList[0] ||
|
|
484
|
+
var unlock = iconList[0] || React.createElement(Icon, {
|
|
488
485
|
type: "unlock-solid"
|
|
489
486
|
});
|
|
490
|
-
var lock = iconList[1] ||
|
|
487
|
+
var lock = iconList[1] || React.createElement(Icon, {
|
|
491
488
|
type: "lock-solid"
|
|
492
489
|
});
|
|
493
|
-
return
|
|
490
|
+
return React.createElement("div", {
|
|
494
491
|
ref: fixedRef,
|
|
495
492
|
className: anchorAdvancedClass,
|
|
496
493
|
style: dropdownStyle
|
|
497
|
-
}, lockedIcon !== false &&
|
|
494
|
+
}, lockedIcon !== false && React.createElement("span", {
|
|
498
495
|
className: "".concat(anchorPrefixCls, "-advanced-lock"),
|
|
499
496
|
onClick: function onClick() {
|
|
500
497
|
return setIsLocked(!isLocked);
|
|
501
498
|
}
|
|
502
499
|
}, isLocked ? lock : unlock), anchorBookmarksContent(wrapperRef));
|
|
503
500
|
};
|
|
504
|
-
var anchorAdvancedContent = usePopper(
|
|
501
|
+
var anchorAdvancedContent = usePopper(React.createElement("span", {
|
|
505
502
|
className: "".concat(anchorPrefixCls, "-advanced-arrows"),
|
|
506
503
|
ref: isAdcanced ? ref || iconRef : null
|
|
507
|
-
}, icon ||
|
|
504
|
+
}, icon || React.createElement(Icon, {
|
|
508
505
|
type: "location-solid"
|
|
509
506
|
})), renderAnchorAdvanced(), popperProps);
|
|
510
507
|
var renderAnchorContent = function renderAnchorContent(anchorType) {
|
|
@@ -519,7 +516,7 @@ var InternalAnchor = function InternalAnchor(props, ref) {
|
|
|
519
516
|
return anchorBookmarksContent(anchorRef);
|
|
520
517
|
}
|
|
521
518
|
};
|
|
522
|
-
return
|
|
519
|
+
return React.createElement(AnchorContext.Provider, {
|
|
523
520
|
value: {
|
|
524
521
|
registerLink: registerLink,
|
|
525
522
|
activeLink: activeLink,
|
|
@@ -529,6 +526,6 @@ var InternalAnchor = function InternalAnchor(props, ref) {
|
|
|
529
526
|
}
|
|
530
527
|
}, renderAnchorContent(type));
|
|
531
528
|
};
|
|
532
|
-
var Anchor =
|
|
529
|
+
var Anchor = React.forwardRef(InternalAnchor);
|
|
533
530
|
Anchor.displayName = 'Anchor';
|
|
534
531
|
export default Anchor;
|
package/es/anchor/context.js
CHANGED
package/es/avatar/avatar.js
CHANGED
|
@@ -45,13 +45,11 @@ var InternalAvatar = function InternalAvatar(props, ref) {
|
|
|
45
45
|
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
46
46
|
mounted = _React$useState6[0],
|
|
47
47
|
setMounted = _React$useState6[1];
|
|
48
|
-
|
|
49
|
-
var avatarRef = ref || /*#__PURE__*/React.createRef();
|
|
48
|
+
var avatarRef = ref || React.createRef();
|
|
50
49
|
var avatarChildrenRef = React.useRef();
|
|
51
|
-
// class
|
|
52
50
|
var avatarPrefixCls = getPrefixCls(prefixCls, 'avatar', customPrefixcls);
|
|
53
51
|
var sizeClasses = classNames((_classNames = {}, _defineProperty(_classNames, "".concat(avatarPrefixCls, "-lg"), size === 'large'), _defineProperty(_classNames, "".concat(avatarPrefixCls, "-md"), size === 'middle'), _defineProperty(_classNames, "".concat(avatarPrefixCls, "-sm"), size === 'small'), _defineProperty(_classNames, "".concat(avatarPrefixCls, "-xs"), size === 'extra-small'), _classNames));
|
|
54
|
-
var hasImageElement =
|
|
52
|
+
var hasImageElement = React.isValidElement(src);
|
|
55
53
|
var isShowDefaultIcon = !src && !icon && !children;
|
|
56
54
|
var avatarClasses = classNames(avatarPrefixCls, sizeClasses, (_classNames2 = {}, _defineProperty(_classNames2, _concatInstanceProperty(_context = "".concat(avatarPrefixCls, "-")).call(_context, shape), !!shape), _defineProperty(_classNames2, "".concat(avatarPrefixCls, "-image"), hasImageElement || src && isImgExist), _defineProperty(_classNames2, "".concat(avatarPrefixCls, "-icon"), !!icon || isShowDefaultIcon), _defineProperty(_classNames2, "".concat(avatarPrefixCls, "-disabled"), disabled), _classNames2), className);
|
|
57
55
|
var sizeStyle = typeof size === 'number' ? {
|
|
@@ -66,7 +64,6 @@ var InternalAvatar = function InternalAvatar(props, ref) {
|
|
|
66
64
|
}, [src]);
|
|
67
65
|
React.useEffect(function () {
|
|
68
66
|
setScaleParam();
|
|
69
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
70
67
|
}, [gap]);
|
|
71
68
|
React.useEffect(function () {
|
|
72
69
|
setMounted(true);
|
|
@@ -92,7 +89,7 @@ var InternalAvatar = function InternalAvatar(props, ref) {
|
|
|
92
89
|
};
|
|
93
90
|
var childrenToRender;
|
|
94
91
|
if (typeof src === 'string' && isImgExist) {
|
|
95
|
-
childrenToRender =
|
|
92
|
+
childrenToRender = React.createElement("img", {
|
|
96
93
|
src: src,
|
|
97
94
|
srcSet: srcSet,
|
|
98
95
|
draggable: draggable,
|
|
@@ -104,7 +101,7 @@ var InternalAvatar = function InternalAvatar(props, ref) {
|
|
|
104
101
|
} else if (icon) {
|
|
105
102
|
childrenToRender = icon;
|
|
106
103
|
} else if (!children) {
|
|
107
|
-
childrenToRender =
|
|
104
|
+
childrenToRender = React.createElement(Icon, {
|
|
108
105
|
type: "avatar-solid"
|
|
109
106
|
});
|
|
110
107
|
} else if (mounted || scale !== 1) {
|
|
@@ -114,7 +111,7 @@ var InternalAvatar = function InternalAvatar(props, ref) {
|
|
|
114
111
|
var sizeChildrenStyle = typeof size === 'number' ? {
|
|
115
112
|
lineHeight: "".concat(size, "px")
|
|
116
113
|
} : {};
|
|
117
|
-
childrenToRender =
|
|
114
|
+
childrenToRender = React.createElement("span", {
|
|
118
115
|
className: "".concat(avatarPrefixCls, "-string"),
|
|
119
116
|
ref: function ref(node) {
|
|
120
117
|
avatarChildrenRef.current = node;
|
|
@@ -122,7 +119,7 @@ var InternalAvatar = function InternalAvatar(props, ref) {
|
|
|
122
119
|
style: _extends(_extends({}, sizeChildrenStyle), childrenStyle)
|
|
123
120
|
}, children);
|
|
124
121
|
} else {
|
|
125
|
-
childrenToRender =
|
|
122
|
+
childrenToRender = React.createElement("span", {
|
|
126
123
|
className: "".concat(avatarPrefixCls, "-string"),
|
|
127
124
|
style: {
|
|
128
125
|
opacity: 0
|
|
@@ -132,12 +129,12 @@ var InternalAvatar = function InternalAvatar(props, ref) {
|
|
|
132
129
|
}
|
|
133
130
|
}, children);
|
|
134
131
|
}
|
|
135
|
-
return
|
|
132
|
+
return React.createElement("span", {
|
|
136
133
|
ref: avatarRef,
|
|
137
134
|
className: avatarClasses,
|
|
138
135
|
style: _extends(_extends({}, sizeStyle), style)
|
|
139
136
|
}, childrenToRender);
|
|
140
137
|
};
|
|
141
|
-
var Avatar =
|
|
138
|
+
var Avatar = React.forwardRef(InternalAvatar);
|
|
142
139
|
Avatar.displayName = 'Avatar';
|
|
143
140
|
export default Avatar;
|