@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/lib/image/image.js
CHANGED
|
@@ -24,7 +24,6 @@ var ImageInternal = function ImageInternal(props, ref) {
|
|
|
24
24
|
getPrefixCls = _React$useContext.getPrefixCls,
|
|
25
25
|
pkgPrefixCls = _React$useContext.prefixCls,
|
|
26
26
|
userDefaultProps = _React$useContext.compDefaultProps;
|
|
27
|
-
// 属性需要合并一遍用户定义的默认属性
|
|
28
27
|
var allProps = (0, _utils.getCompProps)('Image', userDefaultProps, props);
|
|
29
28
|
var innerRef = React.useRef();
|
|
30
29
|
var previewRef = ref || innerRef;
|
|
@@ -40,7 +39,6 @@ var ImageInternal = function ImageInternal(props, ref) {
|
|
|
40
39
|
_allProps$placeholder = allProps.placeholder,
|
|
41
40
|
placeholder = _allProps$placeholder === void 0 ? '' : _allProps$placeholder,
|
|
42
41
|
customPrefixcls = allProps.prefixCls;
|
|
43
|
-
// className前缀
|
|
44
42
|
var prefixCls = getPrefixCls(pkgPrefixCls, 'image', customPrefixcls);
|
|
45
43
|
var _React$useState = React.useState(false),
|
|
46
44
|
_React$useState2 = (0, _slicedToArray2.default)(_React$useState, 2),
|
|
@@ -119,7 +117,7 @@ var ImageInternal = function ImageInternal(props, ref) {
|
|
|
119
117
|
operations: props.previewOperations,
|
|
120
118
|
onClose: onClose
|
|
121
119
|
};
|
|
122
|
-
return
|
|
120
|
+
return React.createElement("div", {
|
|
123
121
|
className: (0, _classnames.default)(prefixCls, props.className, {
|
|
124
122
|
error: error
|
|
125
123
|
}),
|
|
@@ -127,13 +125,13 @@ var ImageInternal = function ImageInternal(props, ref) {
|
|
|
127
125
|
width: width,
|
|
128
126
|
height: height
|
|
129
127
|
}, props.style)
|
|
130
|
-
},
|
|
128
|
+
}, React.createElement("img", (0, _extends2.default)({}, imgProps, {
|
|
131
129
|
ref: previewRef
|
|
132
|
-
})), (operations === null || operations === void 0 ? void 0 : operations.length) > 0 && !error &&
|
|
130
|
+
})), (operations === null || operations === void 0 ? void 0 : operations.length) > 0 && !error && React.createElement("div", {
|
|
133
131
|
className: "".concat(prefixCls, "-action")
|
|
134
|
-
}, operations), preview && exit &&
|
|
132
|
+
}, operations), preview && exit && React.createElement(_preview.default, (0, _extends2.default)({}, previewProps)));
|
|
135
133
|
};
|
|
136
|
-
var Image =
|
|
134
|
+
var Image = React.forwardRef(ImageInternal);
|
|
137
135
|
var ImageOuter = Image;
|
|
138
136
|
ImageOuter.Preview = _preview.default;
|
|
139
137
|
ImageOuter.PreviewGroup = _previewGroup.default;
|
|
@@ -39,7 +39,6 @@ var PreviewGroup = function PreviewGroup(_ref) {
|
|
|
39
39
|
return image.props;
|
|
40
40
|
}) : [children !== undefined ? children.props : {}];
|
|
41
41
|
}, [children, items, hasItems]);
|
|
42
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
43
42
|
var refs = (0, _map.default)(images).call(images, function () {
|
|
44
43
|
return React.useRef();
|
|
45
44
|
});
|
|
@@ -119,15 +118,15 @@ var PreviewGroup = function PreviewGroup(_ref) {
|
|
|
119
118
|
onClose: onClose,
|
|
120
119
|
onPrevious: onPrevious
|
|
121
120
|
};
|
|
122
|
-
return
|
|
121
|
+
return React.createElement(React.Fragment, null, images.length > 1 ? (0, _map.default)(_context3 = React.Children).call(_context3, children, function (image, index) {
|
|
123
122
|
var _a, _b;
|
|
124
|
-
return
|
|
123
|
+
return React.cloneElement(image, {
|
|
125
124
|
key: image.key || index,
|
|
126
125
|
preview: false,
|
|
127
126
|
ref: refs[index],
|
|
128
127
|
onClick: ((_a = image === null || image === void 0 ? void 0 : image.props) === null || _a === void 0 ? void 0 : _a.preview) !== false ? onPreview.bind(null, index, (_b = image === null || image === void 0 ? void 0 : image.props) === null || _b === void 0 ? void 0 : _b.src) : undefined
|
|
129
128
|
});
|
|
130
|
-
}) : children, exit &&
|
|
129
|
+
}) : children, exit && React.createElement(_preview.default, (0, _extends2.default)({}, previewProps)));
|
|
131
130
|
};
|
|
132
131
|
var _default = PreviewGroup;
|
|
133
132
|
exports.default = _default;
|
package/lib/image/preview.js
CHANGED
|
@@ -30,7 +30,6 @@ var Preview = function Preview(props) {
|
|
|
30
30
|
pkgPrefixCls = _React$useContext.prefixCls,
|
|
31
31
|
userDefaultProps = _React$useContext.compDefaultProps,
|
|
32
32
|
locale = _React$useContext.locale;
|
|
33
|
-
// 属性需要合并一遍用户定义的默认属性
|
|
34
33
|
var allProps = (0, _utils.getCompProps)('Image', userDefaultProps, props);
|
|
35
34
|
var imageLangMsg = locale.getCompLangMsg({
|
|
36
35
|
componentName: 'Image'
|
|
@@ -46,7 +45,6 @@ var Preview = function Preview(props) {
|
|
|
46
45
|
length = allProps.length,
|
|
47
46
|
operations = allProps.operations,
|
|
48
47
|
customPrefixcls = allProps.prefixCls;
|
|
49
|
-
// className前缀
|
|
50
48
|
var prefixCls = getPrefixCls(pkgPrefixCls, 'image', customPrefixcls);
|
|
51
49
|
var _React$useState = React.useState(visible),
|
|
52
50
|
_React$useState2 = (0, _slicedToArray2.default)(_React$useState, 2),
|
|
@@ -119,51 +117,51 @@ var Preview = function Preview(props) {
|
|
|
119
117
|
return e.stopPropagation();
|
|
120
118
|
}
|
|
121
119
|
};
|
|
122
|
-
var peviewContainer =
|
|
120
|
+
var peviewContainer = React.createElement("div", {
|
|
123
121
|
className: (0, _classnames.default)("".concat(prefixCls, "-preview"), props.className, {
|
|
124
122
|
show: show
|
|
125
123
|
}),
|
|
126
124
|
style: (0, _extends2.default)({}, props.style)
|
|
127
|
-
},
|
|
125
|
+
}, React.createElement("div", {
|
|
128
126
|
className: "".concat(prefixCls, "-preview-mask"),
|
|
129
127
|
onClick: onClose
|
|
130
|
-
}),
|
|
128
|
+
}), React.createElement(_reactDraggable.default, {
|
|
131
129
|
defaultClassName: "".concat(prefixCls, "-preview-wrap"),
|
|
132
130
|
position: {
|
|
133
131
|
x: 0,
|
|
134
132
|
y: 0
|
|
135
133
|
}
|
|
136
|
-
},
|
|
134
|
+
}, React.createElement("div", {
|
|
137
135
|
onClick: onClose
|
|
138
|
-
},
|
|
136
|
+
}, React.createElement("img", (0, _extends2.default)({}, previewImgProps)))), React.createElement("div", {
|
|
139
137
|
className: "".concat(prefixCls, "-preview-action")
|
|
140
|
-
}, props.type !== 'upload' && length &&
|
|
138
|
+
}, props.type !== 'upload' && length && React.createElement(_icon.default, {
|
|
141
139
|
type: "arrow-left",
|
|
142
140
|
className: (0, _classnames.default)({
|
|
143
141
|
disabled: current <= 0
|
|
144
142
|
}),
|
|
145
143
|
onClick: props.onPrevious
|
|
146
|
-
}),
|
|
144
|
+
}), React.createElement(_icon.default, {
|
|
147
145
|
type: "shrink",
|
|
148
146
|
className: (0, _classnames.default)({
|
|
149
147
|
disabled: scale <= minScale
|
|
150
148
|
}),
|
|
151
149
|
onClick: handleZoomOut
|
|
152
|
-
}),
|
|
150
|
+
}), React.createElement(_icon.default, {
|
|
153
151
|
type: "zoom",
|
|
154
152
|
className: (0, _classnames.default)({
|
|
155
153
|
disabled: scale >= maxScale
|
|
156
154
|
}),
|
|
157
155
|
onClick: handleZoomIn
|
|
158
|
-
}), props.type !== 'upload' && operations, props.type !== 'upload' && length &&
|
|
156
|
+
}), props.type !== 'upload' && operations, props.type !== 'upload' && length && React.createElement(_icon.default, {
|
|
159
157
|
type: "arrow-right",
|
|
160
158
|
className: (0, _classnames.default)({
|
|
161
159
|
disabled: current >= length - 1
|
|
162
160
|
}),
|
|
163
161
|
onClick: props.onNext
|
|
164
|
-
})), props.type === 'upload' && length &&
|
|
162
|
+
})), props.type === 'upload' && length && React.createElement(React.Fragment, null, React.createElement("span", {
|
|
165
163
|
className: "".concat(prefixCls, "-preview-previous")
|
|
166
|
-
},
|
|
164
|
+
}, React.createElement(_icon.default, {
|
|
167
165
|
type: "arrow-left",
|
|
168
166
|
style: {
|
|
169
167
|
fontSize: 20
|
|
@@ -172,9 +170,9 @@ var Preview = function Preview(props) {
|
|
|
172
170
|
disabled: current <= 0
|
|
173
171
|
}),
|
|
174
172
|
onClick: props.onPrevious
|
|
175
|
-
})),
|
|
173
|
+
})), React.createElement("span", {
|
|
176
174
|
className: "".concat(prefixCls, "-preview-next")
|
|
177
|
-
},
|
|
175
|
+
}, React.createElement(_icon.default, {
|
|
178
176
|
type: "arrow-right",
|
|
179
177
|
style: {
|
|
180
178
|
fontSize: 20
|
|
@@ -183,26 +181,26 @@ var Preview = function Preview(props) {
|
|
|
183
181
|
disabled: current >= length - 1
|
|
184
182
|
}),
|
|
185
183
|
onClick: props.onNext
|
|
186
|
-
}))), props.type !== 'upload' &&
|
|
184
|
+
}))), props.type !== 'upload' && React.createElement(_icon.default, {
|
|
187
185
|
className: "".concat(prefixCls, "-preview-close"),
|
|
188
186
|
type: "close-solid",
|
|
189
187
|
onClick: onClose
|
|
190
|
-
}), props.type === 'upload' &&
|
|
188
|
+
}), props.type === 'upload' && React.createElement("div", {
|
|
191
189
|
className: "".concat(prefixCls, "-preview-topbar")
|
|
192
|
-
},
|
|
190
|
+
}, React.createElement("div", {
|
|
193
191
|
className: "".concat(prefixCls, "-preview-topbar-info")
|
|
194
|
-
},
|
|
192
|
+
}, React.createElement("span", {
|
|
195
193
|
className: "".concat(prefixCls, "-preview-topbar-info-name")
|
|
196
|
-
}, name),
|
|
194
|
+
}, name), React.createElement("span", {
|
|
197
195
|
className: "".concat(prefixCls, "-preview-topbar-info-size")
|
|
198
|
-
}, size)),
|
|
196
|
+
}, size)), React.createElement("div", {
|
|
199
197
|
className: "".concat(prefixCls, "-preview-topbar-action")
|
|
200
|
-
}, operations,
|
|
198
|
+
}, operations, React.createElement("span", {
|
|
201
199
|
onClick: onClose
|
|
202
|
-
},
|
|
200
|
+
}, React.createElement(_icon.default, {
|
|
203
201
|
type: "close-solid"
|
|
204
202
|
}), imageLangMsg.close))));
|
|
205
|
-
return
|
|
203
|
+
return _reactDom.default.createPortal(peviewContainer, document.body);
|
|
206
204
|
};
|
|
207
205
|
var _default = Preview;
|
|
208
206
|
exports.default = _default;
|
|
@@ -15,12 +15,9 @@ var _cropperjs = _interopRequireDefault(require("cropperjs"));
|
|
|
15
15
|
var _type = require("../_utils/type");
|
|
16
16
|
function _getRequireWildcardCache(nodeInterop) { if (typeof _WeakMap !== "function") return null; var cacheBabelInterop = new _WeakMap(); var cacheNodeInterop = new _WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
17
17
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && _Object$getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? _Object$getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
18
|
-
// crop 形成新的裁剪框
|
|
19
|
-
// move 图片可移动
|
|
20
|
-
// none 都不能移动
|
|
21
18
|
var DragModeTypes = (0, _type.tuple)('crop', 'move', 'none');
|
|
22
19
|
exports.DragModeTypes = DragModeTypes;
|
|
23
|
-
var Cropper =
|
|
20
|
+
var Cropper = (0, _react.forwardRef)(function (props, forwardedRef) {
|
|
24
21
|
var containerRef = (0, _react.useRef)(null);
|
|
25
22
|
var imgRef = (0, _react.useRef)(null);
|
|
26
23
|
var cropperRef = (0, _react.useRef)(null);
|
|
@@ -114,10 +111,10 @@ var Cropper = /*#__PURE__*/(0, _react.forwardRef)(function (props, forwardedRef)
|
|
|
114
111
|
var imgStyle = {
|
|
115
112
|
display: 'none'
|
|
116
113
|
};
|
|
117
|
-
return
|
|
114
|
+
return _react.default.createElement("div", {
|
|
118
115
|
className: className,
|
|
119
116
|
ref: containerRef
|
|
120
|
-
},
|
|
117
|
+
}, _react.default.createElement("img", {
|
|
121
118
|
ref: imgRef,
|
|
122
119
|
style: imgStyle,
|
|
123
120
|
src: imgSrc
|
|
@@ -96,7 +96,7 @@ var InternalImageCropper = function InternalImageCropper(props, forwardedRef) {
|
|
|
96
96
|
restProps = __rest(_a, ["prefixCls", "containerWidth", "containerHeight", "title", "visible", "onClose", "onCropSuccess", "onCropFailed", "dragMode", "viewMode", "aspectRatio", "modal", "okText", "okBtn", "image", "zoomOnWheel", "imageMaxSize", "cropBoxMovable", "customComponents", "showDeaultToolbar", "autoCropArea"]);
|
|
97
97
|
var prefixCls = getPrefixCls(pkgPrefixCls, 'image-cropper', customPrefixcls);
|
|
98
98
|
var handleOkClick = function handleOkClick() {
|
|
99
|
-
return __awaiter(void 0, void 0, void 0,
|
|
99
|
+
return __awaiter(void 0, void 0, void 0, _regenerator.default.mark(function _callee() {
|
|
100
100
|
var imgFile;
|
|
101
101
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
102
102
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -131,7 +131,7 @@ var InternalImageCropper = function InternalImageCropper(props, forwardedRef) {
|
|
|
131
131
|
(0, _react.useEffect)(function () {
|
|
132
132
|
setCropperSrc(image);
|
|
133
133
|
}, [image]);
|
|
134
|
-
var CropperNode =
|
|
134
|
+
var CropperNode = _react.default.createElement(_cropper.default, {
|
|
135
135
|
className: "".concat(prefixCls, "-container"),
|
|
136
136
|
dragMode: dragMode,
|
|
137
137
|
viewMode: viewMode,
|
|
@@ -143,7 +143,7 @@ var InternalImageCropper = function InternalImageCropper(props, forwardedRef) {
|
|
|
143
143
|
autoCropArea: autoCropArea,
|
|
144
144
|
ref: cropperRef
|
|
145
145
|
});
|
|
146
|
-
var OperationBarNode =
|
|
146
|
+
var OperationBarNode = _react.default.createElement(_operationBar.default, {
|
|
147
147
|
className: "".concat(prefixCls, "-bar-container"),
|
|
148
148
|
btnClassName: "".concat(prefixCls, "-btn-container"),
|
|
149
149
|
imageMaxSize: imageMaxSize,
|
|
@@ -158,7 +158,7 @@ var InternalImageCropper = function InternalImageCropper(props, forwardedRef) {
|
|
|
158
158
|
getCropper: cropperRef,
|
|
159
159
|
showDeaultToolbar: showDeaultToolbar
|
|
160
160
|
});
|
|
161
|
-
return
|
|
161
|
+
return _react.default.createElement(_modal.default, (0, _extends2.default)({
|
|
162
162
|
className: (0, _classnames.default)("".concat(prefixCls, "-modal-container")),
|
|
163
163
|
bodyClassName: (0, _classnames.default)("".concat(prefixCls, "-modal-body-container")),
|
|
164
164
|
width: containerWidth,
|
|
@@ -170,7 +170,7 @@ var InternalImageCropper = function InternalImageCropper(props, forwardedRef) {
|
|
|
170
170
|
onCancel: onClose
|
|
171
171
|
}, restProps));
|
|
172
172
|
};
|
|
173
|
-
var ImageCropper =
|
|
173
|
+
var ImageCropper = (0, _react.forwardRef)(InternalImageCropper);
|
|
174
174
|
ImageCropper.displayName = 'ImageCropper';
|
|
175
175
|
var _default = ImageCropper;
|
|
176
176
|
exports.default = _default;
|
|
@@ -76,33 +76,33 @@ var OperationBar = function OperationBar(props) {
|
|
|
76
76
|
showUploadList: false
|
|
77
77
|
};
|
|
78
78
|
}, [accept, beforeUpload]);
|
|
79
|
-
return
|
|
79
|
+
return _react.default.createElement("div", {
|
|
80
80
|
className: className
|
|
81
|
-
}, showDeaultToolbar &&
|
|
81
|
+
}, showDeaultToolbar && _react.default.createElement("div", {
|
|
82
82
|
className: (0, _classnames.default)(btnClassName)
|
|
83
|
-
},
|
|
83
|
+
}, _react.default.createElement(_icon.default, {
|
|
84
84
|
type: "reduction",
|
|
85
85
|
onClick: handleRevert
|
|
86
|
-
}),
|
|
86
|
+
}), _react.default.createElement(_upload.default, (0, _extends2.default)({}, uploadProps), _react.default.createElement(_icon.default, {
|
|
87
87
|
type: "upload"
|
|
88
|
-
})),
|
|
88
|
+
})), _react.default.createElement(_icon.default, {
|
|
89
89
|
type: "spin",
|
|
90
90
|
onClick: handleRotate
|
|
91
|
-
}),
|
|
91
|
+
}), _react.default.createElement(_icon.default, {
|
|
92
92
|
type: "reduce",
|
|
93
93
|
onClick: function onClick() {
|
|
94
94
|
return handleZoom(-0.1);
|
|
95
95
|
}
|
|
96
|
-
}),
|
|
96
|
+
}), _react.default.createElement(_icon.default, {
|
|
97
97
|
type: "add",
|
|
98
98
|
onClick: function onClick() {
|
|
99
99
|
return handleZoom(0.1);
|
|
100
100
|
}
|
|
101
101
|
})), customComponents && (0, _map.default)(customComponents).call(customComponents, function (Component, index) {
|
|
102
102
|
return Component(getCropper, index);
|
|
103
|
-
}), okBtn ?
|
|
103
|
+
}), okBtn ? _react.default.createElement("div", {
|
|
104
104
|
onClick: handleBtnClick
|
|
105
|
-
}, okBtn) :
|
|
105
|
+
}, okBtn) : _react.default.createElement(_button.default, {
|
|
106
106
|
className: (0, _classnames.default)('ok-btn'),
|
|
107
107
|
type: "primary",
|
|
108
108
|
onClick: handleBtnClick
|
package/lib/index.js
CHANGED
|
@@ -467,13 +467,7 @@ var _divider = _interopRequireDefault(require("./divider"));
|
|
|
467
467
|
var _signature = _interopRequireDefault(require("./signature"));
|
|
468
468
|
function _getRequireWildcardCache(nodeInterop) { if (typeof _WeakMap !== "function") return null; var cacheBabelInterop = new _WeakMap(); var cacheNodeInterop = new _WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
469
469
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && _Object$getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? _Object$getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
470
|
-
/* @remove-on-es-build-begin */
|
|
471
|
-
// this file is not used if use https://github.com/ant-design/babel-plugin-import
|
|
472
470
|
var ENV = process.env.NODE_ENV;
|
|
473
|
-
if (ENV !== 'production' && ENV !== 'test' && typeof console !== 'undefined' && console.warn &&
|
|
474
|
-
// eslint-disable-line no-console
|
|
475
|
-
typeof window !== 'undefined') {
|
|
476
|
-
// eslint-disable-next-line no-console
|
|
471
|
+
if (ENV !== 'production' && ENV !== 'test' && typeof console !== 'undefined' && console.warn && typeof window !== 'undefined') {
|
|
477
472
|
console.warn('You are using a whole package of kdesign, please use https://www.npmjs.com/package/babel-plugin-import to reduce app bundle size.');
|
|
478
|
-
}
|
|
479
|
-
/* @remove-on-es-build-end */
|
|
473
|
+
}
|
|
@@ -70,20 +70,20 @@ var ClearableInput = function ClearableInput(props) {
|
|
|
70
70
|
}
|
|
71
71
|
var needClear = !disabled && value && isMouseEnter;
|
|
72
72
|
var clearIconCls = (0, _classnames.default)((_classNames = {}, (0, _defineProperty2.default)(_classNames, "".concat(prefixCls, "-textarea-clear-icon"), inputType === ClearableInputType[1]), (0, _defineProperty2.default)(_classNames, "".concat(prefixCls, "-clear-icon"), inputType === ClearableInputType[0]), (0, _defineProperty2.default)(_classNames, "".concat(prefixCls, "-clear-icon-hidden"), !needClear), (0, _defineProperty2.default)(_classNames, "".concat(prefixCls, "-clear-icon-rightSpace"), suffix), _classNames));
|
|
73
|
-
return
|
|
73
|
+
return _react.default.createElement("span", {
|
|
74
74
|
onMouseDown: mouseDownHandle,
|
|
75
75
|
onClick: handleReset,
|
|
76
76
|
className: clearIconCls
|
|
77
|
-
}, typeof allowClear === 'boolean' ?
|
|
77
|
+
}, typeof allowClear === 'boolean' ? _react.default.createElement(_index.Icon, {
|
|
78
78
|
type: "close-solid"
|
|
79
79
|
}) : allowClear);
|
|
80
80
|
};
|
|
81
81
|
var renderSuffix = function renderSuffix() {
|
|
82
82
|
if (suffix || inputCount) {
|
|
83
|
-
return
|
|
83
|
+
return _react.default.createElement("span", {
|
|
84
84
|
className: "".concat(prefixCls, "-suffix"),
|
|
85
85
|
onMouseDown: mouseDownHandle
|
|
86
|
-
}, inputCount &&
|
|
86
|
+
}, inputCount && _react.default.createElement("span", {
|
|
87
87
|
style: {
|
|
88
88
|
marginRight: suffix ? 9 : 0
|
|
89
89
|
}
|
|
@@ -97,19 +97,19 @@ var ClearableInput = function ClearableInput(props) {
|
|
|
97
97
|
return originElement;
|
|
98
98
|
}
|
|
99
99
|
var suffixNode = renderSuffix();
|
|
100
|
-
var prefixNode = prefix ?
|
|
100
|
+
var prefixNode = prefix ? _react.default.createElement("span", {
|
|
101
101
|
className: "".concat(prefixCls, "-prefix"),
|
|
102
102
|
onMouseDown: mouseDownHandle
|
|
103
103
|
}, prefix) : null;
|
|
104
104
|
var inputWrapperClasses = (0, _classnames.default)((_classNames2 = {}, (0, _defineProperty2.default)(_classNames2, "".concat(prefixCls, "-wrapper"), true), (0, _defineProperty2.default)(_classNames2, "".concat(prefixCls, "-wrapper-focused"), focused && !disabled), (0, _defineProperty2.default)(_classNames2, (0, _concat.default)(_context = "".concat(prefixCls, "-wrapper-size-")).call(_context, size), size), (0, _defineProperty2.default)(_classNames2, "".concat(prefixCls, "-wrapper-borderless"), borderType === 'none'), (0, _defineProperty2.default)(_classNames2, "".concat(prefixCls, "-wrapper-underline"), borderType === 'underline'), (0, _defineProperty2.default)(_classNames2, "".concat(prefixCls, "-error"), status === 'error'), (0, _defineProperty2.default)(_classNames2, "".concat(prefixCls, "-wrapper-disabled"), disabled), _classNames2), (0, _defineProperty2.default)({}, className, className && !addonBefore && !addonAfter));
|
|
105
|
-
return
|
|
105
|
+
return _react.default.createElement("span", {
|
|
106
106
|
className: inputWrapperClasses,
|
|
107
107
|
ref: fixRef,
|
|
108
108
|
style: style,
|
|
109
109
|
onClick: clickHandle,
|
|
110
110
|
onMouseEnter: mouseEnterHandle,
|
|
111
111
|
onMouseLeave: mouseLeaveHandle
|
|
112
|
-
}, prefixNode,
|
|
112
|
+
}, prefixNode, _react.default.cloneElement(originElement, {
|
|
113
113
|
style: null
|
|
114
114
|
}), renderClearIcon(), suffixNode);
|
|
115
115
|
};
|
|
@@ -119,19 +119,19 @@ var ClearableInput = function ClearableInput(props) {
|
|
|
119
119
|
return originElement;
|
|
120
120
|
}
|
|
121
121
|
var addonClassName = (0, _classnames.default)("".concat(prefixCls, "-group-addon"), (_classNames4 = {}, (0, _defineProperty2.default)(_classNames4, "".concat(prefixCls, "-group-addon-borderless"), borderType === 'none'), (0, _defineProperty2.default)(_classNames4, "".concat(prefixCls, "-group-addon-underline"), borderType === 'underline'), (0, _defineProperty2.default)(_classNames4, "".concat(prefixCls, "-error"), status === 'error'), (0, _defineProperty2.default)(_classNames4, "".concat(prefixCls, "-group-addon-disabled"), disabled), _classNames4));
|
|
122
|
-
var addonBeforeNode = addonBefore ?
|
|
122
|
+
var addonBeforeNode = addonBefore ? _react.default.createElement("span", {
|
|
123
123
|
className: addonClassName
|
|
124
124
|
}, addonBefore) : null;
|
|
125
|
-
var addonAfterNode = addonAfter ?
|
|
125
|
+
var addonAfterNode = addonAfter ? _react.default.createElement("span", {
|
|
126
126
|
className: addonClassName
|
|
127
127
|
}, addonAfter) : null;
|
|
128
128
|
var inputGroupClasses = (0, _classnames.default)(className, (_classNames5 = {}, (0, _defineProperty2.default)(_classNames5, "".concat(prefixCls, "-group"), true), (0, _defineProperty2.default)(_classNames5, (0, _concat.default)(_context2 = "".concat(prefixCls, "-group-size-")).call(_context2, size), size), _classNames5));
|
|
129
|
-
return
|
|
129
|
+
return _react.default.createElement("span", {
|
|
130
130
|
className: "".concat(prefixCls, "-group-wrapper")
|
|
131
|
-
},
|
|
131
|
+
}, _react.default.createElement("span", {
|
|
132
132
|
className: inputGroupClasses,
|
|
133
133
|
style: style
|
|
134
|
-
}, addonBeforeNode,
|
|
134
|
+
}, addonBeforeNode, _react.default.cloneElement(originElement, {
|
|
135
135
|
style: null
|
|
136
136
|
}), addonAfterNode));
|
|
137
137
|
};
|
|
@@ -160,7 +160,7 @@ var ClearableInput = function ClearableInput(props) {
|
|
|
160
160
|
}
|
|
161
161
|
}
|
|
162
162
|
var textAreaWrapperClasses = (0, _classnames.default)(className, (0, _defineProperty2.default)({}, "".concat(prefixCls, "-wrapper-textarea"), true));
|
|
163
|
-
return
|
|
163
|
+
return _react.default.createElement("span", {
|
|
164
164
|
className: textAreaWrapperClasses,
|
|
165
165
|
style: wrapperStyle,
|
|
166
166
|
onMouseEnter: mouseEnterHandle,
|
package/lib/input/TextArea.js
CHANGED
|
@@ -40,7 +40,7 @@ var InternalTextarea = function InternalTextarea(props, ref) {
|
|
|
40
40
|
getPrefixCls = _useContext.getPrefixCls,
|
|
41
41
|
prefixCls = _useContext.prefixCls,
|
|
42
42
|
userDefaultProps = _useContext.compDefaultProps;
|
|
43
|
-
var textAreaProps = (0, _utils.getCompProps)('TextArea', userDefaultProps, props);
|
|
43
|
+
var textAreaProps = (0, _utils.getCompProps)('TextArea', userDefaultProps, props);
|
|
44
44
|
var _useState = (0, _react.useState)({}),
|
|
45
45
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
46
46
|
textareaStyles = _useState2[0],
|
|
@@ -65,7 +65,7 @@ var InternalTextarea = function InternalTextarea(props, ref) {
|
|
|
65
65
|
size = textAreaProps.size,
|
|
66
66
|
status = textAreaProps.status,
|
|
67
67
|
others = __rest(textAreaProps, ["value", "allowClear", "borderType", "defaultValue", "count", "countPosition", "autoSize", "className", "prefixCls", "canResize", "maxLength", "disabled", "onBlur", "onFocus", "onChange", "placeholder", "style", "size", "status"]);
|
|
68
|
-
var textAreaPrefixCls = getPrefixCls(prefixCls, 'input', customPrefixcls);
|
|
68
|
+
var textAreaPrefixCls = getPrefixCls(prefixCls, 'input', customPrefixcls);
|
|
69
69
|
(0, _devwarning.default)(_input.BorderTypes.indexOf(borderType) === -1, 'textarea', "cannot found textarea borderType '".concat(borderType, "'"));
|
|
70
70
|
var _useMergedState = (0, _hooks.useMergedState)('', {
|
|
71
71
|
value: propsValue,
|
|
@@ -135,7 +135,7 @@ var InternalTextarea = function InternalTextarea(props, ref) {
|
|
|
135
135
|
if (count && (showNumberMark || numberMarkError) && !disabled && maxLength !== '' && maxLength >= 0) {
|
|
136
136
|
var _classNames;
|
|
137
137
|
var countClass = (0, _classnames.default)("".concat(textAreaPrefixCls, "-textarea-mark"), (_classNames = {}, (0, _defineProperty2.default)(_classNames, "".concat(textAreaPrefixCls, "-textarea-mark-inner"), countPosition === 'inner'), (0, _defineProperty2.default)(_classNames, "".concat(textAreaPrefixCls, "-textarea-mark-error"), numberMarkError), _classNames));
|
|
138
|
-
return
|
|
138
|
+
return _react.default.createElement("div", {
|
|
139
139
|
className: countClass
|
|
140
140
|
}, value ? value.length : 0, "/", maxLength);
|
|
141
141
|
}
|
|
@@ -183,7 +183,7 @@ var InternalTextarea = function InternalTextarea(props, ref) {
|
|
|
183
183
|
delete wrapperStyle[key];
|
|
184
184
|
}
|
|
185
185
|
}
|
|
186
|
-
var textarea =
|
|
186
|
+
var textarea = _react.default.createElement("textarea", (0, _extends2.default)({
|
|
187
187
|
ref: textareaRef,
|
|
188
188
|
disabled: disabled,
|
|
189
189
|
style: (0, _extends2.default)({}, textareaStyles, hadCount || !!allowClear ? otherStyles : style),
|
|
@@ -195,12 +195,12 @@ var InternalTextarea = function InternalTextarea(props, ref) {
|
|
|
195
195
|
placeholder: placeholder,
|
|
196
196
|
maxLength: maxLength
|
|
197
197
|
}, others));
|
|
198
|
-
return hadCount ?
|
|
198
|
+
return hadCount ? _react.default.createElement("span", {
|
|
199
199
|
style: wrapperStyle,
|
|
200
200
|
className: (0, _concat.default)(_context2 = "".concat(prefixCls, "-countWrapper ")).call(_context2, className && !allowClear ? className : '')
|
|
201
201
|
}, textarea, renderNumberMark()) : textarea;
|
|
202
202
|
};
|
|
203
|
-
return
|
|
203
|
+
return _react.default.createElement(_ClearableLabeledInput.default, (0, _extends2.default)({}, textAreaProps, {
|
|
204
204
|
handleReset: handleReset,
|
|
205
205
|
value: value,
|
|
206
206
|
inputType: "text",
|
|
@@ -209,7 +209,7 @@ var InternalTextarea = function InternalTextarea(props, ref) {
|
|
|
209
209
|
numberMark: renderNumberMark()
|
|
210
210
|
}));
|
|
211
211
|
};
|
|
212
|
-
var TextArea =
|
|
212
|
+
var TextArea = _react.default.forwardRef(InternalTextarea);
|
|
213
213
|
TextArea.displayName = 'TextArea';
|
|
214
214
|
var _default = TextArea;
|
|
215
215
|
exports.default = _default;
|
|
@@ -57,33 +57,28 @@ function calculateNodeHeight(uiTextNode) {
|
|
|
57
57
|
var maxHeight = _maxSafeInteger.default;
|
|
58
58
|
var height = parseFloat(new _big.default(hiddenTextarea.scrollHeight).valueOf());
|
|
59
59
|
if (boxSizing === 'border-box') {
|
|
60
|
-
height = parseFloat(new _big.default(height).plus(borderSize).valueOf());
|
|
60
|
+
height = parseFloat(new _big.default(height).plus(borderSize).valueOf());
|
|
61
61
|
} else if (boxSizing === 'content-box') {
|
|
62
|
-
height = parseFloat(new _big.default(height).minus(paddingSize).valueOf());
|
|
62
|
+
height = parseFloat(new _big.default(height).minus(paddingSize).valueOf());
|
|
63
63
|
}
|
|
64
|
-
|
|
65
64
|
if (minRows !== null || maxRows !== null) {
|
|
66
65
|
hiddenTextarea.value = ' ';
|
|
67
66
|
var bigSingleRowHeight = new _big.default(hiddenTextarea.scrollHeight).minus(paddingSize);
|
|
68
67
|
if (minRows !== null) {
|
|
69
68
|
minHeight = parseFloat(bigSingleRowHeight.times(minRows).valueOf());
|
|
70
69
|
if (boxSizing === 'border-box') {
|
|
71
|
-
minHeight = parseFloat(new _big.default(minHeight).plus(paddingSize).plus(borderSize).valueOf());
|
|
70
|
+
minHeight = parseFloat(new _big.default(minHeight).plus(paddingSize).plus(borderSize).valueOf());
|
|
72
71
|
}
|
|
73
|
-
|
|
74
|
-
height = new _big.default(minHeight).gt(height) ? minHeight : height; // Math.max(minHeight, height)
|
|
72
|
+
height = new _big.default(minHeight).gt(height) ? minHeight : height;
|
|
75
73
|
}
|
|
76
|
-
|
|
77
74
|
if (maxRows !== null) {
|
|
78
75
|
maxHeight = parseFloat(bigSingleRowHeight.times(maxRows).valueOf());
|
|
79
76
|
if (boxSizing === 'border-box') {
|
|
80
|
-
maxHeight = parseFloat(new _big.default(maxHeight).plus(paddingSize).plus(borderSize).valueOf());
|
|
77
|
+
maxHeight = parseFloat(new _big.default(maxHeight).plus(paddingSize).plus(borderSize).valueOf());
|
|
81
78
|
}
|
|
82
|
-
|
|
83
|
-
height = new _big.default(maxHeight).lt(height) ? maxHeight : height; // Math.min(maxHeight, height)
|
|
79
|
+
height = new _big.default(maxHeight).lt(height) ? maxHeight : height;
|
|
84
80
|
}
|
|
85
81
|
}
|
|
86
|
-
|
|
87
82
|
var overflowY = new _big.default(height).lt(maxHeight) ? 'hidden' : '';
|
|
88
83
|
return {
|
|
89
84
|
height: height,
|
package/lib/input/index.js
CHANGED
|
@@ -30,6 +30,5 @@ var _input = _interopRequireWildcard(require("./input"));
|
|
|
30
30
|
var _TextArea = _interopRequireDefault(require("./TextArea"));
|
|
31
31
|
function _getRequireWildcardCache(nodeInterop) { if (typeof _WeakMap !== "function") return null; var cacheBabelInterop = new _WeakMap(); var cacheNodeInterop = new _WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
32
32
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && _Object$getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? _Object$getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
33
|
-
// export { TextAreaProps } from './TextArea'
|
|
34
33
|
var _default = _input.default;
|
|
35
34
|
exports.default = _default;
|
package/lib/input/input.js
CHANGED
|
@@ -84,7 +84,7 @@ var InternalInput = function InternalInput(props, ref) {
|
|
|
84
84
|
showNumberMark = _useState4[0],
|
|
85
85
|
setShowNumberMark = _useState4[1];
|
|
86
86
|
var inputRef = (0, _react.useRef)();
|
|
87
|
-
var inputPrefixCls = getPrefixCls(prefixCls, 'input', customPrefixcls);
|
|
87
|
+
var inputPrefixCls = getPrefixCls(prefixCls, 'input', customPrefixcls);
|
|
88
88
|
var addonBefore = others.addonBefore,
|
|
89
89
|
addonAfter = others.addonAfter;
|
|
90
90
|
var inputClasses = (0, _classnames.default)(inputPrefixCls, (_classNames = {}, (0, _defineProperty2.default)(_classNames, (0, _concat.default)(_context = "".concat(inputPrefixCls, "-size-")).call(_context, size), size), (0, _defineProperty2.default)(_classNames, "".concat(inputPrefixCls, "-borderless"), borderType === 'none'), (0, _defineProperty2.default)(_classNames, "".concat(inputPrefixCls, "-underline"), borderType === 'underline'), (0, _defineProperty2.default)(_classNames, "".concat(inputPrefixCls, "-error"), status === 'error'), (0, _defineProperty2.default)(_classNames, "".concat(inputPrefixCls, "-disabled"), disabled), _classNames), (0, _defineProperty2.default)({}, className, className && !(0, _ClearableLabeledInput.hasPrefixSuffix)(inputProps) && !addonBefore && !addonAfter));
|
|
@@ -133,14 +133,14 @@ var InternalInput = function InternalInput(props, ref) {
|
|
|
133
133
|
enteredLength = maxLength;
|
|
134
134
|
}
|
|
135
135
|
if (count && showNumberMark && !disabled) {
|
|
136
|
-
return
|
|
136
|
+
return _react.default.createElement("div", {
|
|
137
137
|
className: (0, _classnames.default)("".concat(inputPrefixCls, "-input-mark-inner"))
|
|
138
138
|
}, enteredLength, maxLength !== undefined ? "/".concat(maxLength) : null);
|
|
139
139
|
}
|
|
140
140
|
return null;
|
|
141
141
|
};
|
|
142
142
|
var renderInput = function renderInput() {
|
|
143
|
-
return
|
|
143
|
+
return _react.default.createElement("input", (0, _extends2.default)({
|
|
144
144
|
ref: inputRef,
|
|
145
145
|
type: type,
|
|
146
146
|
disabled: disabled,
|
|
@@ -181,7 +181,7 @@ var InternalInput = function InternalInput(props, ref) {
|
|
|
181
181
|
}
|
|
182
182
|
};
|
|
183
183
|
});
|
|
184
|
-
return
|
|
184
|
+
return _react.default.createElement(_ClearableLabeledInput.default, (0, _extends2.default)({}, inputProps, {
|
|
185
185
|
handleReset: handleReset,
|
|
186
186
|
value: value,
|
|
187
187
|
inputType: "input",
|
|
@@ -192,7 +192,7 @@ var InternalInput = function InternalInput(props, ref) {
|
|
|
192
192
|
inputCount: renderCount()
|
|
193
193
|
}));
|
|
194
194
|
};
|
|
195
|
-
var Input =
|
|
195
|
+
var Input = _react.default.forwardRef(InternalInput);
|
|
196
196
|
Input.displayName = 'Input';
|
|
197
197
|
var _default = Input;
|
|
198
198
|
exports.default = _default;
|
|
@@ -91,7 +91,7 @@ var InternalInputNumber = function InternalInputNumber(props, ref) {
|
|
|
91
91
|
var isScopeValid = function isScopeValid(value) {
|
|
92
92
|
if (value === '') return true;
|
|
93
93
|
var numberValue = parseFloat(value) || 0;
|
|
94
|
-
if (min >= 0 && value.substr(0, 1) === '-') return false;
|
|
94
|
+
if (min >= 0 && value.substr(0, 1) === '-') return false;
|
|
95
95
|
if (minMark === '[' && numberValue < min || minMark === '(' && numberValue <= min || maxMark === ']' && numberValue > max || maxMark === ')' && numberValue >= max) return false;
|
|
96
96
|
return true;
|
|
97
97
|
};
|
|
@@ -109,15 +109,11 @@ var InternalInputNumber = function InternalInputNumber(props, ref) {
|
|
|
109
109
|
});
|
|
110
110
|
};
|
|
111
111
|
var verifiValue = function verifiValue(initValue) {
|
|
112
|
-
// 将 value 进行数字序列化 剔除非数字输入-复制粘贴的情况
|
|
113
112
|
var value = (0, _numberUtil.serialization)(initValue);
|
|
114
|
-
// 校验数字合法性
|
|
115
113
|
if (!/^-?\d*\.?\d*$/.test(value)) return false;
|
|
116
|
-
// 输入内容超出数字范围不允许输入
|
|
117
114
|
if (mustInScope && !isScopeValid(value)) {
|
|
118
115
|
return false;
|
|
119
116
|
}
|
|
120
|
-
// 整数字段不允许输入小数点
|
|
121
117
|
if (decimalLength === 0 && (0, _includes.default)(value).call(value, '.')) {
|
|
122
118
|
return false;
|
|
123
119
|
}
|
|
@@ -253,17 +249,14 @@ var InternalInputNumber = function InternalInputNumber(props, ref) {
|
|
|
253
249
|
_inputValue = '';
|
|
254
250
|
}
|
|
255
251
|
var bigValue = new _big.default(Number(_inputValue));
|
|
256
|
-
// 还原最小值
|
|
257
252
|
if (typeof min === 'number' && bigValue.lt(min)) {
|
|
258
253
|
_inputValue = min.toString();
|
|
259
254
|
onChange === null || onChange === void 0 ? void 0 : onChange(handleEventAttachValue(event, numberMode ? Number(_inputValue) : _inputValue));
|
|
260
255
|
}
|
|
261
|
-
// 还原最大值
|
|
262
256
|
if (typeof max === 'number' && bigValue.gt(max)) {
|
|
263
257
|
_inputValue = max.toString();
|
|
264
258
|
onChange === null || onChange === void 0 ? void 0 : onChange(handleEventAttachValue(event, numberMode ? Number(_inputValue) : _inputValue));
|
|
265
259
|
}
|
|
266
|
-
// 超过精度位数直接截断
|
|
267
260
|
_inputValue = handleNumericalAccuracy(_inputValue);
|
|
268
261
|
var formatValue = handleFormatValue(_inputValue, {
|
|
269
262
|
mask: mask,
|
|
@@ -348,7 +341,7 @@ var InternalInputNumber = function InternalInputNumber(props, ref) {
|
|
|
348
341
|
handleChange(e);
|
|
349
342
|
}
|
|
350
343
|
};
|
|
351
|
-
return
|
|
344
|
+
return _react.default.createElement(_input.default, (0, _extends2.default)({}, others, {
|
|
352
345
|
onCompositionStart: handleComposition,
|
|
353
346
|
onCompositionUpdate: handleComposition,
|
|
354
347
|
onCompositionEnd: handleComposition,
|
|
@@ -363,7 +356,7 @@ var InternalInputNumber = function InternalInputNumber(props, ref) {
|
|
|
363
356
|
className: (0, _classnames.default)(inputPrefixCls, className)
|
|
364
357
|
}));
|
|
365
358
|
};
|
|
366
|
-
var InputNumber =
|
|
359
|
+
var InputNumber = _react.default.forwardRef(InternalInputNumber);
|
|
367
360
|
InputNumber.displayName = 'InputNumber';
|
|
368
361
|
var _default = InputNumber;
|
|
369
362
|
exports.default = _default;
|