tntd 2.7.3 → 2.7.4
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/LICENSE +21 -0
- package/README.md +72 -0
- package/es/actions/index.js +12 -0
- package/es/actions/index.js.map +1 -0
- package/es/actions/index.less +70 -0
- package/es/check-card/group.js +149 -0
- package/es/check-card/group.js.map +1 -0
- package/es/check-card/index.js +120 -0
- package/es/check-card/index.js.map +1 -0
- package/es/check-card/index.less +179 -0
- package/es/color-picker/ColorPicker.js +1 -1
- package/es/color-picker/ColorPicker.js.map +1 -1
- package/es/color-picker/index.less +1 -1
- package/es/ellipsis/index.js +13 -3
- package/es/ellipsis/index.js.map +1 -1
- package/es/ellipsis/index.less +2 -2
- package/es/handle/index.js +20 -9
- package/es/handle/index.js.map +1 -1
- package/es/handle/index.less +1 -1
- package/es/index.js +7 -0
- package/es/index.js.map +1 -1
- package/es/index.less +5 -0
- package/es/locale/en_US.js +3 -1
- package/es/locale/en_US.js.map +1 -1
- package/es/locale/zh_CN.js +3 -1
- package/es/locale/zh_CN.js.map +1 -1
- package/es/mention/index.js +4 -0
- package/es/mention/index.js.map +1 -0
- package/es/page/Box.js +1 -1
- package/es/page/Box.js.map +1 -1
- package/es/page/index.js +1 -1
- package/es/page/index.js.map +1 -1
- package/es/page/index.less +5 -5
- package/es/prev-locale.js +1 -1
- package/es/prev-locale.js.map +1 -1
- package/es/query-form/Field/SelectInput.js +2 -2
- package/es/query-form/Field/SelectInput.js.map +1 -1
- package/es/query-form/Field/index.js +2 -1
- package/es/query-form/Field/index.js.map +1 -1
- package/es/query-list-scene/QueryForm.js +2 -2
- package/es/query-list-scene/QueryForm.js.map +1 -1
- package/es/segmented/index.js +50 -0
- package/es/segmented/index.js.map +1 -0
- package/es/segmented/index.less +138 -0
- package/es/table/constants.js +53 -0
- package/es/table/constants.js.map +1 -1
- package/es/table/context.js.map +1 -1
- package/es/table/hooks/use-column-setting.js.map +1 -1
- package/es/table/table.js +107 -6
- package/es/table/table.js.map +1 -1
- package/es/table/table.less +3 -1
- package/es/table/total-shower.js +6 -0
- package/es/table/total-shower.js.map +1 -0
- package/es/title/index.js +5 -5
- package/es/title/index.js.map +1 -1
- package/es/title/index.less +10 -10
- package/es/tntd-form/Form.js +1 -1
- package/es/tntd-form/Form.js.map +1 -1
- package/es/tntd-form/TntdForm/components/Item.js +42 -30
- package/es/tntd-form/TntdForm/components/ItemComp.js +167 -158
- package/es/tntd-form/TntdForm/components/List.js +89 -78
- package/es/tntd-form/TntdForm/index.js +38 -33
- package/es/tntd-form/TntdForm/interface.js +1 -2
- package/es/tntd-form/TntdForm/store.js +1 -2
- package/es/tntd-form/TntdForm/utils.js +158 -168
- package/es/tntd-modal/index.js +54 -21
- package/es/tntd-modal/index.js.map +1 -1
- package/es/tntd-modal/index.less +83 -63
- package/es/utils/index.js +1 -0
- package/es/utils/index.js.map +1 -1
- package/es/utils/simple-template.js +11 -0
- package/es/utils/simple-template.js.map +1 -0
- package/es/water-mark/index.js +99 -0
- package/es/water-mark/index.js.map +1 -0
- package/lib/actions/index.d.ts +15 -0
- package/lib/actions/index.d.ts.map +1 -0
- package/lib/actions/index.js +17 -0
- package/lib/actions/index.js.map +1 -0
- package/lib/actions/index.less +70 -0
- package/lib/check-card/group.d.ts +130 -0
- package/lib/check-card/group.d.ts.map +1 -0
- package/lib/check-card/group.js +179 -0
- package/lib/check-card/group.js.map +1 -0
- package/lib/check-card/index.d.ts +136 -0
- package/lib/check-card/index.d.ts.map +1 -0
- package/lib/check-card/index.js +148 -0
- package/lib/check-card/index.js.map +1 -0
- package/lib/check-card/index.less +179 -0
- package/lib/color-picker/ColorPicker.js +1 -1
- package/lib/color-picker/ColorPicker.js.map +1 -1
- package/lib/color-picker/index.less +1 -1
- package/lib/ellipsis/index.d.ts.map +1 -1
- package/lib/ellipsis/index.js +13 -3
- package/lib/ellipsis/index.js.map +1 -1
- package/lib/ellipsis/index.less +2 -2
- package/lib/handle/index.d.ts.map +1 -1
- package/lib/handle/index.js +20 -9
- package/lib/handle/index.js.map +1 -1
- package/lib/handle/index.less +1 -1
- package/lib/index.d.ts +7 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +11 -1
- package/lib/index.js.map +1 -1
- package/lib/index.less +5 -0
- package/lib/locale/default.d.ts +1 -0
- package/lib/locale/default.d.ts.map +1 -1
- package/lib/locale/en_US.d.ts +1 -0
- package/lib/locale/en_US.d.ts.map +1 -1
- package/lib/locale/en_US.js +3 -1
- package/lib/locale/en_US.js.map +1 -1
- package/lib/locale/zh_CN.d.ts +1 -0
- package/lib/locale/zh_CN.d.ts.map +1 -1
- package/lib/locale/zh_CN.js +3 -1
- package/lib/locale/zh_CN.js.map +1 -1
- package/lib/mention/index.js +25 -0
- package/lib/page/Box.js +1 -1
- package/lib/page/Box.js.map +1 -1
- package/lib/page/index.js +1 -1
- package/lib/page/index.js.map +1 -1
- package/lib/page/index.less +5 -5
- package/lib/prev-locale.js +1 -1
- package/lib/prev-locale.js.map +1 -1
- package/lib/query-form/Field/SelectInput.d.ts.map +1 -1
- package/lib/query-form/Field/SelectInput.js +2 -2
- package/lib/query-form/Field/SelectInput.js.map +1 -1
- package/lib/query-form/Field/index.d.ts.map +1 -1
- package/lib/query-form/Field/index.js +2 -1
- package/lib/query-form/Field/index.js.map +1 -1
- package/lib/query-list-scene/QueryForm.d.ts +1 -1
- package/lib/query-list-scene/QueryForm.d.ts.map +1 -1
- package/lib/query-list-scene/QueryForm.js +2 -2
- package/lib/query-list-scene/QueryForm.js.map +1 -1
- package/lib/segmented/index.d.ts +23 -0
- package/lib/segmented/index.d.ts.map +1 -0
- package/lib/segmented/index.js +78 -0
- package/lib/segmented/index.js.map +1 -0
- package/lib/segmented/index.less +138 -0
- package/lib/table/constants.d.ts +2 -0
- package/lib/table/constants.d.ts.map +1 -1
- package/lib/table/constants.js +54 -1
- package/lib/table/constants.js.map +1 -1
- package/lib/table/context.d.ts +1 -0
- package/lib/table/context.d.ts.map +1 -1
- package/lib/table/context.js.map +1 -1
- package/lib/table/hooks/use-column-setting.d.ts +4 -1
- package/lib/table/hooks/use-column-setting.d.ts.map +1 -1
- package/lib/table/hooks/use-column-setting.js.map +1 -1
- package/lib/table/table.d.ts +2 -1
- package/lib/table/table.d.ts.map +1 -1
- package/lib/table/table.js +107 -6
- package/lib/table/table.js.map +1 -1
- package/lib/table/table.less +3 -1
- package/lib/table/total-shower.d.ts +9 -0
- package/lib/table/total-shower.d.ts.map +1 -0
- package/lib/table/total-shower.js +13 -0
- package/lib/table/total-shower.js.map +1 -0
- package/lib/title/index.d.ts +11 -1
- package/lib/title/index.d.ts.map +1 -1
- package/lib/title/index.js +5 -5
- package/lib/title/index.js.map +1 -1
- package/lib/title/index.less +10 -10
- package/lib/tntd-form/Form.js +1 -1
- package/lib/tntd-form/Form.js.map +1 -1
- package/lib/tntd-form/TntdForm/components/Item.js +55 -61
- package/lib/tntd-form/TntdForm/components/ItemComp.js +203 -190
- package/lib/tntd-form/TntdForm/components/List.js +118 -111
- package/lib/tntd-form/TntdForm/index.js +61 -67
- package/lib/tntd-form/TntdForm/interface.js +4 -2
- package/lib/tntd-form/TntdForm/store.js +8 -7
- package/lib/tntd-form/TntdForm/utils.js +182 -184
- package/lib/tntd-modal/index.d.ts +15 -2
- package/lib/tntd-modal/index.d.ts.map +1 -1
- package/lib/tntd-modal/index.js +58 -23
- package/lib/tntd-modal/index.js.map +1 -1
- package/lib/tntd-modal/index.less +83 -63
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.d.ts.map +1 -1
- package/lib/utils/index.js +1 -0
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/simple-template.d.ts +9 -0
- package/lib/utils/simple-template.d.ts.map +1 -0
- package/lib/utils/simple-template.js +15 -0
- package/lib/utils/simple-template.js.map +1 -0
- package/lib/water-mark/index.d.ts +49 -0
- package/lib/water-mark/index.d.ts.map +1 -0
- package/lib/water-mark/index.js +129 -0
- package/lib/water-mark/index.js.map +1 -0
- package/package.json +21 -3
- package/es/_util/colors.js +0 -3
- package/es/_util/colors.js.map +0 -1
- package/es/_util/easings.js +0 -9
- package/es/_util/easings.js.map +0 -1
- package/es/_util/getDataOrAriaProps.js +0 -8
- package/es/_util/getDataOrAriaProps.js.map +0 -1
- package/es/_util/getScroll.js +0 -14
- package/es/_util/getScroll.js.map +0 -1
- package/es/_util/interopDefault.js +0 -5
- package/es/_util/interopDefault.js.map +0 -1
- package/es/_util/isNumeric.js +0 -4
- package/es/_util/isNumeric.js.map +0 -1
- package/es/_util/motion.js +0 -22
- package/es/_util/motion.js.map +0 -1
- package/es/_util/openAnimation.js +0 -51
- package/es/_util/openAnimation.js.map +0 -1
- package/es/_util/raf.js +0 -25
- package/es/_util/raf.js.map +0 -1
- package/es/_util/reactNode.js +0 -6
- package/es/_util/reactNode.js.map +0 -1
- package/es/_util/ref.js +0 -15
- package/es/_util/ref.js.map +0 -1
- package/es/_util/responsiveObserve.js +0 -82
- package/es/_util/responsiveObserve.js.map +0 -1
- package/es/_util/scrollTo.js +0 -29
- package/es/_util/scrollTo.js.map +0 -1
- package/es/_util/styleChecker.js +0 -12
- package/es/_util/styleChecker.js.map +0 -1
- package/es/_util/throttleByAnimationFrame.js +0 -40
- package/es/_util/throttleByAnimationFrame.js.map +0 -1
- package/es/_util/transButton.js +0 -103
- package/es/_util/transButton.js.map +0 -1
- package/es/_util/triggerEvent.js +0 -8
- package/es/_util/triggerEvent.js.map +0 -1
- package/es/_util/type.js +0 -3
- package/es/_util/type.js.map +0 -1
- package/es/_util/warning.js +0 -5
- package/es/_util/warning.js.map +0 -1
- package/es/_util/wave.js +0 -228
- package/es/_util/wave.js.map +0 -1
- package/es/config-provider/context.js +0 -41
- package/es/config-provider/context.js.map +0 -1
- package/es/tntd-form/__tests__/demo-extend.test.js +0 -3
- package/es/tntd-form/__tests__/demo-extend.test.js.map +0 -1
- package/es/tntd-form/__tests__/demo.test.js +0 -3
- package/es/tntd-form/__tests__/demo.test.js.map +0 -1
- package/es/tntd-form/__tests__/image.test.js +0 -5
- package/es/tntd-form/__tests__/image.test.js.map +0 -1
- package/es/tntd-form/__tests__/index.test.js +0 -957
- package/es/tntd-form/__tests__/index.test.js.map +0 -1
- package/es/tntd-form/__tests__/list-noStyle.test.js +0 -41
- package/es/tntd-form/__tests__/list-noStyle.test.js.map +0 -1
- package/es/tntd-form/__tests__/list.test.js +0 -164
- package/es/tntd-form/__tests__/list.test.js.map +0 -1
- package/es/tntd-form/__tests__/ref.test.js +0 -45
- package/es/tntd-form/__tests__/ref.test.js.map +0 -1
- package/es/tntd-form/__tests__/type.test.js +0 -74
- package/es/tntd-form/__tests__/type.test.js.map +0 -1
- package/lib/_util/colors.d.ts +0 -3
- package/lib/_util/colors.d.ts.map +0 -1
- package/lib/_util/colors.js +0 -7
- package/lib/_util/colors.js.map +0 -1
- package/lib/_util/easings.d.ts +0 -2
- package/lib/_util/easings.d.ts.map +0 -1
- package/lib/_util/easings.js +0 -14
- package/lib/_util/easings.js.map +0 -1
- package/lib/_util/getDataOrAriaProps.d.ts +0 -2
- package/lib/_util/getDataOrAriaProps.d.ts.map +0 -1
- package/lib/_util/getDataOrAriaProps.js +0 -13
- package/lib/_util/getDataOrAriaProps.js.map +0 -1
- package/lib/_util/getScroll.d.ts +0 -2
- package/lib/_util/getScroll.d.ts.map +0 -1
- package/lib/_util/getScroll.js +0 -18
- package/lib/_util/getScroll.js.map +0 -1
- package/lib/_util/interopDefault.d.ts +0 -2
- package/lib/_util/interopDefault.d.ts.map +0 -1
- package/lib/_util/interopDefault.js +0 -9
- package/lib/_util/interopDefault.js.map +0 -1
- package/lib/_util/isNumeric.d.ts +0 -3
- package/lib/_util/isNumeric.d.ts.map +0 -1
- package/lib/_util/isNumeric.js +0 -7
- package/lib/_util/isNumeric.js.map +0 -1
- package/lib/_util/motion.d.ts +0 -24
- package/lib/_util/motion.d.ts.map +0 -1
- package/lib/_util/motion.js +0 -17
- package/lib/_util/motion.js.map +0 -1
- package/lib/_util/openAnimation.d.ts +0 -7
- package/lib/_util/openAnimation.d.ts.map +0 -1
- package/lib/_util/openAnimation.js +0 -58
- package/lib/_util/openAnimation.js.map +0 -1
- package/lib/_util/raf.d.ts +0 -10
- package/lib/_util/raf.d.ts.map +0 -1
- package/lib/_util/raf.js +0 -34
- package/lib/_util/raf.js.map +0 -1
- package/lib/_util/reactNode.d.ts +0 -3
- package/lib/_util/reactNode.d.ts.map +0 -1
- package/lib/_util/reactNode.js +0 -31
- package/lib/_util/reactNode.js.map +0 -1
- package/lib/_util/ref.d.ts +0 -4
- package/lib/_util/ref.d.ts.map +0 -1
- package/lib/_util/ref.js +0 -22
- package/lib/_util/ref.js.map +0 -1
- package/lib/_util/responsiveObserve.d.ts +0 -14
- package/lib/_util/responsiveObserve.d.ts.map +0 -1
- package/lib/_util/responsiveObserve.js +0 -83
- package/lib/_util/responsiveObserve.js.map +0 -1
- package/lib/_util/scrollTo.d.ts +0 -11
- package/lib/_util/scrollTo.d.ts.map +0 -1
- package/lib/_util/scrollTo.js +0 -34
- package/lib/_util/scrollTo.js.map +0 -1
- package/lib/_util/styleChecker.d.ts +0 -4
- package/lib/_util/styleChecker.d.ts.map +0 -1
- package/lib/_util/styleChecker.js +0 -14
- package/lib/_util/styleChecker.js.map +0 -1
- package/lib/_util/throttleByAnimationFrame.d.ts +0 -6
- package/lib/_util/throttleByAnimationFrame.d.ts.map +0 -1
- package/lib/_util/throttleByAnimationFrame.js +0 -49
- package/lib/_util/throttleByAnimationFrame.js.map +0 -1
- package/lib/_util/transButton.d.ts +0 -21
- package/lib/_util/transButton.d.ts.map +0 -1
- package/lib/_util/transButton.js +0 -112
- package/lib/_util/transButton.js.map +0 -1
- package/lib/_util/triggerEvent.d.ts +0 -2
- package/lib/_util/triggerEvent.d.ts.map +0 -1
- package/lib/_util/triggerEvent.js +0 -12
- package/lib/_util/triggerEvent.js.map +0 -1
- package/lib/_util/type.d.ts +0 -4
- package/lib/_util/type.d.ts.map +0 -1
- package/lib/_util/type.js +0 -9
- package/lib/_util/type.js.map +0 -1
- package/lib/_util/warning.d.ts +0 -5
- package/lib/_util/warning.d.ts.map +0 -1
- package/lib/_util/warning.js +0 -28
- package/lib/_util/warning.js.map +0 -1
- package/lib/_util/wave.d.ts +0 -26
- package/lib/_util/wave.d.ts.map +0 -1
- package/lib/_util/wave.js +0 -249
- package/lib/_util/wave.js.map +0 -1
- package/lib/config-provider/context.d.ts +0 -61
- package/lib/config-provider/context.d.ts.map +0 -1
- package/lib/config-provider/context.js +0 -64
- package/lib/config-provider/context.js.map +0 -1
- package/lib/tntd-form/TntdForm/components/Item.d.ts +0 -5
- package/lib/tntd-form/TntdForm/components/Item.d.ts.map +0 -1
- package/lib/tntd-form/TntdForm/components/Item.js.map +0 -1
- package/lib/tntd-form/TntdForm/components/ItemComp.d.ts +0 -5
- package/lib/tntd-form/TntdForm/components/ItemComp.d.ts.map +0 -1
- package/lib/tntd-form/TntdForm/components/ItemComp.js.map +0 -1
- package/lib/tntd-form/TntdForm/components/List.d.ts +0 -5
- package/lib/tntd-form/TntdForm/components/List.d.ts.map +0 -1
- package/lib/tntd-form/TntdForm/components/List.js.map +0 -1
- package/lib/tntd-form/TntdForm/index.d.ts +0 -10
- package/lib/tntd-form/TntdForm/index.d.ts.map +0 -1
- package/lib/tntd-form/TntdForm/index.js.map +0 -1
- package/lib/tntd-form/TntdForm/interface.d.ts +0 -93
- package/lib/tntd-form/TntdForm/interface.d.ts.map +0 -1
- package/lib/tntd-form/TntdForm/interface.js.map +0 -1
- package/lib/tntd-form/TntdForm/store.d.ts +0 -4
- package/lib/tntd-form/TntdForm/store.d.ts.map +0 -1
- package/lib/tntd-form/TntdForm/store.js.map +0 -1
- package/lib/tntd-form/TntdForm/utils.d.ts +0 -48
- package/lib/tntd-form/TntdForm/utils.d.ts.map +0 -1
- package/lib/tntd-form/TntdForm/utils.js.map +0 -1
- package/lib/tntd-form/__tests__/demo-extend.test.d.ts +0 -2
- package/lib/tntd-form/__tests__/demo-extend.test.d.ts.map +0 -1
- package/lib/tntd-form/__tests__/demo-extend.test.js +0 -5
- package/lib/tntd-form/__tests__/demo-extend.test.js.map +0 -1
- package/lib/tntd-form/__tests__/demo.test.d.ts +0 -2
- package/lib/tntd-form/__tests__/demo.test.d.ts.map +0 -1
- package/lib/tntd-form/__tests__/demo.test.js +0 -8
- package/lib/tntd-form/__tests__/demo.test.js.map +0 -1
- package/lib/tntd-form/__tests__/image.test.d.ts +0 -2
- package/lib/tntd-form/__tests__/image.test.d.ts.map +0 -1
- package/lib/tntd-form/__tests__/image.test.js +0 -7
- package/lib/tntd-form/__tests__/image.test.js.map +0 -1
- package/lib/tntd-form/__tests__/index.test.d.ts +0 -2
- package/lib/tntd-form/__tests__/index.test.d.ts.map +0 -1
- package/lib/tntd-form/__tests__/index.test.js +0 -981
- package/lib/tntd-form/__tests__/index.test.js.map +0 -1
- package/lib/tntd-form/__tests__/list-noStyle.test.d.ts +0 -2
- package/lib/tntd-form/__tests__/list-noStyle.test.d.ts.map +0 -1
- package/lib/tntd-form/__tests__/list-noStyle.test.js +0 -46
- package/lib/tntd-form/__tests__/list-noStyle.test.js.map +0 -1
- package/lib/tntd-form/__tests__/list.test.d.ts +0 -2
- package/lib/tntd-form/__tests__/list.test.d.ts.map +0 -1
- package/lib/tntd-form/__tests__/list.test.js +0 -169
- package/lib/tntd-form/__tests__/list.test.js.map +0 -1
- package/lib/tntd-form/__tests__/ref.test.d.ts +0 -2
- package/lib/tntd-form/__tests__/ref.test.d.ts.map +0 -1
- package/lib/tntd-form/__tests__/ref.test.js +0 -50
- package/lib/tntd-form/__tests__/ref.test.js.map +0 -1
- package/lib/tntd-form/__tests__/type.test.d.ts +0 -2
- package/lib/tntd-form/__tests__/type.test.d.ts.map +0 -1
- package/lib/tntd-form/__tests__/type.test.js +0 -98
- package/lib/tntd-form/__tests__/type.test.js.map +0 -1
|
@@ -1,27 +1,36 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.validateFields = exports.recursionSort = exports.recursionCheck = exports.isValidKey = exports.handleCheckItem = exports.getNames = exports.getInitValue = exports.getFieldsValue = exports.getFieldValue = void 0;
|
|
7
|
+
function _toArray(arr) { return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableRest(); }
|
|
8
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
9
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
10
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
11
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
12
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
|
+
var isValidKey = function isValidKey(key, object) {
|
|
14
|
+
return key in object;
|
|
6
15
|
};
|
|
7
|
-
exports.isValidKey = isValidKey;
|
|
8
16
|
/**
|
|
9
17
|
* 将xx.xx.xx 转换为数组
|
|
10
18
|
* @param {*} name
|
|
11
19
|
* @returns
|
|
12
20
|
*/
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
exports.isValidKey = isValidKey;
|
|
22
|
+
var getNames = function getNames(name) {
|
|
23
|
+
var attrs = [];
|
|
24
|
+
if (Array.isArray(name)) {
|
|
25
|
+
var _name = _toArray(name),
|
|
26
|
+
str = _name[0],
|
|
27
|
+
rest = _name.slice(1);
|
|
28
|
+
attrs = str.split('.').concat(rest);
|
|
29
|
+
} else {
|
|
30
|
+
attrs = typeof name === 'string' ? name.split('.') : [];
|
|
31
|
+
}
|
|
32
|
+
return attrs;
|
|
23
33
|
};
|
|
24
|
-
exports.getNames = getNames;
|
|
25
34
|
/**
|
|
26
35
|
* 对数据进行校验
|
|
27
36
|
* @param {*} list
|
|
@@ -29,37 +38,36 @@ exports.getNames = getNames;
|
|
|
29
38
|
* @param {*} formData
|
|
30
39
|
* @returns
|
|
31
40
|
*/
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
41
|
+
exports.getNames = getNames;
|
|
42
|
+
var recursionCheck = function recursionCheck(list, dataLevel, formData) {
|
|
43
|
+
var errorList = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
|
|
44
|
+
try {
|
|
45
|
+
if (Array.isArray(list)) {
|
|
46
|
+
list.forEach(function (item) {
|
|
47
|
+
var key = item.name;
|
|
48
|
+
var attrs = Object.keys(formData[key]);
|
|
49
|
+
attrs.forEach(function (attr) {
|
|
50
|
+
var _a;
|
|
51
|
+
var error = (_a = formData[item.name][attr]) === null || _a === void 0 ? void 0 : _a.checkItem();
|
|
52
|
+
if (error) {
|
|
53
|
+
errorList.push("".concat([item.name + '.' + attr], ":"), error);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
if (dataLevel[key]) {
|
|
57
|
+
recursionCheck(dataLevel[key], dataLevel, formData, errorList);
|
|
49
58
|
}
|
|
50
|
-
|
|
59
|
+
});
|
|
51
60
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
59
|
-
throw e;
|
|
61
|
+
return errorList;
|
|
62
|
+
} catch (e) {
|
|
63
|
+
if (typeof e === 'string') {
|
|
64
|
+
throw e.toUpperCase();
|
|
65
|
+
} else if (e instanceof Error) {
|
|
66
|
+
throw e.message;
|
|
60
67
|
}
|
|
68
|
+
throw e;
|
|
69
|
+
}
|
|
61
70
|
};
|
|
62
|
-
exports.recursionCheck = recursionCheck;
|
|
63
71
|
/**
|
|
64
72
|
* 将数据进行排序
|
|
65
73
|
* @param {*} list
|
|
@@ -68,174 +76,164 @@ exports.recursionCheck = recursionCheck;
|
|
|
68
76
|
* @param {*} errorList
|
|
69
77
|
* @returns
|
|
70
78
|
*/
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}, {});
|
|
98
|
-
return values;
|
|
99
|
-
}
|
|
79
|
+
exports.recursionCheck = recursionCheck;
|
|
80
|
+
var recursionSort = function recursionSort(list, dataLevel, formData) {
|
|
81
|
+
try {
|
|
82
|
+
if (Array.isArray(list)) {
|
|
83
|
+
var values = list.reduce(function (total, item, index) {
|
|
84
|
+
var attrObj = {};
|
|
85
|
+
var key = item.name;
|
|
86
|
+
var prefixs = key.split('.');
|
|
87
|
+
var attrs = formData[key] ? Object.keys(formData[key]) : [];
|
|
88
|
+
attrs.forEach(function (attr) {
|
|
89
|
+
var _a;
|
|
90
|
+
attrObj[attr] = (_a = formData[key][attr]) === null || _a === void 0 ? void 0 : _a.value;
|
|
91
|
+
});
|
|
92
|
+
var children = [];
|
|
93
|
+
if (dataLevel[key]) {
|
|
94
|
+
children = recursionSort(dataLevel[key], dataLevel, formData);
|
|
95
|
+
}
|
|
96
|
+
var len = prefixs.length - 2;
|
|
97
|
+
if (total[prefixs[len]]) {
|
|
98
|
+
total[prefixs[len]][index] = Object.assign(Object.assign({}, attrObj), children || []);
|
|
99
|
+
} else {
|
|
100
|
+
total[prefixs[len]] = [Object.assign(Object.assign({}, attrObj), children || [])];
|
|
101
|
+
}
|
|
102
|
+
return total;
|
|
103
|
+
}, {});
|
|
104
|
+
return values;
|
|
100
105
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
throw e.message;
|
|
109
|
-
}
|
|
110
|
-
throw e;
|
|
106
|
+
} catch (e) {
|
|
107
|
+
if (typeof e === 'string') {
|
|
108
|
+
console.error(e.toUpperCase());
|
|
109
|
+
throw e.toUpperCase();
|
|
110
|
+
} else if (e instanceof Error) {
|
|
111
|
+
console.error(e.message);
|
|
112
|
+
throw e.message;
|
|
111
113
|
}
|
|
114
|
+
throw e;
|
|
115
|
+
}
|
|
112
116
|
};
|
|
113
|
-
exports.recursionSort = recursionSort;
|
|
114
117
|
/**
|
|
115
118
|
* 获取form表单的value
|
|
116
119
|
* @param {*} formCurrent
|
|
117
120
|
* @returns
|
|
118
121
|
*/
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
const values = (0, exports.recursionSort)(recursionStart, dataLevel, formData);
|
|
132
|
-
return values;
|
|
122
|
+
exports.recursionSort = recursionSort;
|
|
123
|
+
var getFieldsValue = function getFieldsValue(formCurrent) {
|
|
124
|
+
try {
|
|
125
|
+
var formData = formCurrent.formData,
|
|
126
|
+
dataLevel = formCurrent.dataLevel;
|
|
127
|
+
var firstKey = '';
|
|
128
|
+
// 这里不直接用Object.keys的原因是Object.keys并不能保证一定是按照属性顺序
|
|
129
|
+
for (var i in dataLevel) {
|
|
130
|
+
if (Object.prototype.hasOwnProperty.call(dataLevel, i)) {
|
|
131
|
+
firstKey = i;
|
|
132
|
+
break;
|
|
133
|
+
}
|
|
133
134
|
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
135
|
+
var recursionStart = dataLevel[firstKey];
|
|
136
|
+
var values = recursionSort(recursionStart, dataLevel, formData);
|
|
137
|
+
return values;
|
|
138
|
+
} catch (e) {
|
|
139
|
+
if (typeof e === 'string') {
|
|
140
|
+
console.error(e.toUpperCase());
|
|
141
|
+
return e.toUpperCase();
|
|
142
|
+
} else if (e instanceof Error) {
|
|
143
|
+
console.error(e.message);
|
|
144
|
+
return e.message;
|
|
144
145
|
}
|
|
146
|
+
return e;
|
|
147
|
+
}
|
|
145
148
|
};
|
|
146
|
-
exports.getFieldsValue = getFieldsValue;
|
|
147
149
|
/**
|
|
148
150
|
* 获取form表单的value
|
|
149
151
|
* @param {*} formCurrent
|
|
150
152
|
* @returns
|
|
151
153
|
*/
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
return e.message;
|
|
164
|
-
}
|
|
165
|
-
return e;
|
|
154
|
+
exports.getFieldsValue = getFieldsValue;
|
|
155
|
+
var getFieldValue = function getFieldValue(formCurrent, field) {
|
|
156
|
+
var _a, _b;
|
|
157
|
+
try {
|
|
158
|
+
var formData = formCurrent.formData;
|
|
159
|
+
return formData && ((_b = (_a = formData === null || formData === void 0 ? void 0 : formData[field[0]]) === null || _a === void 0 ? void 0 : _a[field[1]]) === null || _b === void 0 ? void 0 : _b.value);
|
|
160
|
+
} catch (e) {
|
|
161
|
+
if (typeof e === 'string') {
|
|
162
|
+
return e.toUpperCase();
|
|
163
|
+
} else if (e instanceof Error) {
|
|
164
|
+
return e.message;
|
|
166
165
|
}
|
|
166
|
+
return e;
|
|
167
|
+
}
|
|
167
168
|
};
|
|
168
|
-
exports.getFieldValue = getFieldValue;
|
|
169
169
|
/**
|
|
170
170
|
* 提交时候校验的方法
|
|
171
171
|
* @param {*} formCurrent
|
|
172
172
|
* @returns
|
|
173
173
|
*/
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
const errorList = (0, exports.recursionCheck)(recursionStart, dataLevel, formData);
|
|
187
|
-
if (Array.isArray(errorList) && errorList.length) {
|
|
188
|
-
console.error(JSON.stringify(errorList));
|
|
189
|
-
}
|
|
190
|
-
else {
|
|
191
|
-
resolve((0, exports.recursionSort)(recursionStart, dataLevel, formData));
|
|
192
|
-
}
|
|
193
|
-
});
|
|
194
|
-
};
|
|
195
|
-
exports.validateFields = validateFields;
|
|
196
|
-
/** 获取初始化的值 */
|
|
197
|
-
const getInitValue = (initialValues, names) => {
|
|
198
|
-
let keys = [];
|
|
199
|
-
if (Array.isArray(names)) {
|
|
200
|
-
const [str, ...rest] = names;
|
|
201
|
-
keys = str.split('.').concat(rest);
|
|
174
|
+
exports.getFieldValue = getFieldValue;
|
|
175
|
+
var validateFields = function validateFields(formCurrent) {
|
|
176
|
+
return new Promise(function (resolve) {
|
|
177
|
+
var formData = formCurrent.formData,
|
|
178
|
+
dataLevel = formCurrent.dataLevel;
|
|
179
|
+
var firstKey = '';
|
|
180
|
+
// 这里不直接用Object.keys的原因是Object.keys并不能保证一定是按照属性顺序
|
|
181
|
+
for (var i in dataLevel) {
|
|
182
|
+
if (Object.prototype.hasOwnProperty.call(dataLevel, i)) {
|
|
183
|
+
firstKey = i;
|
|
184
|
+
break;
|
|
185
|
+
}
|
|
202
186
|
}
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
187
|
+
var recursionStart = dataLevel[firstKey];
|
|
188
|
+
var errorList = recursionCheck(recursionStart, dataLevel, formData);
|
|
189
|
+
if (Array.isArray(errorList) && errorList.length) {
|
|
190
|
+
console.error(JSON.stringify(errorList));
|
|
191
|
+
} else {
|
|
192
|
+
resolve(recursionSort(recursionStart, dataLevel, formData));
|
|
209
193
|
}
|
|
210
|
-
|
|
194
|
+
});
|
|
195
|
+
};
|
|
196
|
+
/** 获取初始化的值 */
|
|
197
|
+
exports.validateFields = validateFields;
|
|
198
|
+
var getInitValue = function getInitValue(initialValues, names) {
|
|
199
|
+
var keys = [];
|
|
200
|
+
if (Array.isArray(names)) {
|
|
201
|
+
var _names = _toArray(names),
|
|
202
|
+
str = _names[0],
|
|
203
|
+
rest = _names.slice(1);
|
|
204
|
+
keys = str.split('.').concat(rest);
|
|
205
|
+
}
|
|
206
|
+
if (Array.isArray(keys) && !!keys.length) {
|
|
207
|
+
keys.forEach(function (i) {
|
|
208
|
+
initialValues = ['', null, undefined].includes(initialValues === null || initialValues === void 0 ? void 0 : initialValues[i]) ? undefined : initialValues === null || initialValues === void 0 ? void 0 : initialValues[i];
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
return initialValues;
|
|
211
212
|
};
|
|
212
|
-
exports.getInitValue = getInitValue;
|
|
213
213
|
/** 校验表单是否正确的方法 */
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
return;
|
|
214
|
+
exports.getInitValue = getInitValue;
|
|
215
|
+
var handleCheckItem = function handleCheckItem(value, rules) {
|
|
216
|
+
try {
|
|
217
|
+
if (Array.isArray(rules)) {
|
|
218
|
+
rules.forEach(function (i) {
|
|
219
|
+
// @ts-ignore
|
|
220
|
+
if (i.required && ['', null, undefined].includes(value)) {
|
|
221
|
+
throw new Error((i === null || i === void 0 ? void 0 : i.message) || 'error');
|
|
222
|
+
}
|
|
223
|
+
if (i === null || i === void 0 ? void 0 : i.validator) {
|
|
224
|
+
i.validator(rules, value, function (_errorMsg) {
|
|
225
|
+
throw new Error(_errorMsg);
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
});
|
|
230
229
|
}
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
}
|
|
230
|
+
return;
|
|
231
|
+
} catch (e) {
|
|
232
|
+
if (typeof e === 'string') {
|
|
233
|
+
return e.toUpperCase();
|
|
234
|
+
} else if (e instanceof Error) {
|
|
235
|
+
return e.message;
|
|
238
236
|
}
|
|
237
|
+
}
|
|
239
238
|
};
|
|
240
|
-
exports.handleCheckItem = handleCheckItem;
|
|
241
|
-
//# sourceMappingURL=utils.js.map
|
|
239
|
+
exports.handleCheckItem = handleCheckItem;
|
|
@@ -1,3 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import type { ModalProps as AntdModalProps } from 'antd/lib/modal';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import './index.less';
|
|
4
|
+
export declare type ModalProps = AntdModalProps & {
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
hasFooter?: boolean;
|
|
7
|
+
config?: {
|
|
8
|
+
fullScreen?: boolean;
|
|
9
|
+
width?: string | number;
|
|
10
|
+
height?: string | number;
|
|
11
|
+
logo?: React.ReactNode;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export declare const Modal: ({ visible, className, title, width, style, children, onCancel, hasFooter, footer, config, ...rest }: ModalProps) => JSX.Element;
|
|
15
|
+
export default Modal;
|
|
3
16
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tntd-modal/index.
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tntd-modal/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,IAAI,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAElE,OAAO,KAAgD,MAAM,OAAO,CAAA;AAIpE,OAAO,cAAc,CAAA;AAErB,oBAAY,UAAU,GAAG,cAAc,GAAG;IACxC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC1B,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,MAAM,CAAC,EAAE;QACP,UAAU,CAAC,EAAE,OAAO,CAAA;QACpB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;QACvB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;QACxB,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;KACvB,CAAA;CACF,CAAA;AAED,eAAO,MAAM,KAAK,wGAef,UAAU,gBAgGZ,CAAA;AAED,eAAe,KAAK,CAAA"}
|
package/lib/tntd-modal/index.js
CHANGED
|
@@ -37,31 +37,66 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
37
37
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
38
|
};
|
|
39
39
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
+
exports.Modal = void 0;
|
|
41
|
+
const react_1 = require("@icon-park/react");
|
|
40
42
|
const classnames_1 = __importDefault(require("classnames"));
|
|
41
|
-
const
|
|
42
|
-
const
|
|
43
|
-
const
|
|
43
|
+
const react_2 = __importStar(require("react"));
|
|
44
|
+
const antd_1 = require("antd");
|
|
45
|
+
const lodash_1 = require("lodash");
|
|
44
46
|
require("./index.less");
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
(
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
47
|
+
const Modal = (_a) => {
|
|
48
|
+
var { visible, className, title, width, style = {}, children, onCancel, hasFooter = true, footer, config = {
|
|
49
|
+
width: 'auto',
|
|
50
|
+
height: 'auto',
|
|
51
|
+
} } = _a, rest = __rest(_a, ["visible", "className", "title", "width", "style", "children", "onCancel", "hasFooter", "footer", "config"]);
|
|
52
|
+
const [fullscreen, setFullscreen] = (0, react_2.useState)(false);
|
|
53
|
+
const supportFullscreen = config.fullScreen;
|
|
54
|
+
(0, react_2.useEffect)(() => {
|
|
55
|
+
return () => {
|
|
56
|
+
setFullscreen(false);
|
|
57
|
+
};
|
|
58
|
+
}, [visible]);
|
|
59
|
+
const Title = ({ title, logo, fullscreen, onToggleFullscreen, onClose, }) => {
|
|
60
|
+
return (react_2.default.createElement(react_2.Fragment, null,
|
|
61
|
+
react_2.default.createElement("div", { className: "ant-modal-header-title" },
|
|
62
|
+
logo && logo,
|
|
63
|
+
react_2.default.createElement("span", null, title)),
|
|
64
|
+
react_2.default.createElement("div", { className: "ant-modal-header-actions" },
|
|
65
|
+
react_2.default.createElement("a", { className: "modal-fullscreen-wrap", onClick: onToggleFullscreen }, fullscreen ? react_2.default.createElement(react_1.OffScreen, null) : react_2.default.createElement(react_1.FullScreen, null)),
|
|
66
|
+
react_2.default.createElement("a", { className: "modal-close-wrap", onClick: onClose },
|
|
67
|
+
react_2.default.createElement(react_1.Close, { theme: "outline" })))));
|
|
68
|
+
};
|
|
69
|
+
const computeWidth = supportFullscreen
|
|
70
|
+
? fullscreen
|
|
71
|
+
? '100vw'
|
|
72
|
+
: width || config.width
|
|
73
|
+
: width || config.width;
|
|
74
|
+
const computeHeight = supportFullscreen ? (fullscreen ? '100vh' : config.height) : 'inherit';
|
|
75
|
+
style.height = computeHeight;
|
|
76
|
+
if (supportFullscreen && fullscreen) {
|
|
77
|
+
style.top = 0;
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
delete style.top;
|
|
81
|
+
}
|
|
82
|
+
const footerConfig = hasFooter
|
|
83
|
+
? ((0, lodash_1.isArray)(footer) ? footer.length > 0 : footer)
|
|
84
|
+
? footer
|
|
85
|
+
: undefined
|
|
86
|
+
: null;
|
|
87
|
+
return (react_2.default.createElement(antd_1.Modal, Object.assign({ visible: visible, title: supportFullscreen ? (react_2.default.createElement(Title, { logo: config.logo, title: title, fullscreen: fullscreen, supportFullscreen: supportFullscreen, onClose: onCancel, onToggleFullscreen: () => {
|
|
61
88
|
setFullscreen(!fullscreen);
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
89
|
+
if (!fullscreen) {
|
|
90
|
+
}
|
|
91
|
+
} })) : (title), onCancel: onCancel, centered: supportFullscreen ? true : rest.centered ? true : false, width: computeWidth, style: style, className: (0, classnames_1.default)([
|
|
92
|
+
{
|
|
93
|
+
'support-fullscreen': supportFullscreen,
|
|
94
|
+
fullscreen: fullscreen,
|
|
95
|
+
'no-header': supportFullscreen && !(config.logo || title),
|
|
96
|
+
},
|
|
97
|
+
className,
|
|
98
|
+
]), footer: footer }, rest), children));
|
|
66
99
|
};
|
|
100
|
+
exports.Modal = Modal;
|
|
101
|
+
exports.default = exports.Modal;
|
|
67
102
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tntd-modal/index.
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tntd-modal/index.tsx"],"names":[],"mappings":"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","sourcesContent":["import { Close, FullScreen as FullScreenIcon, OffScreen } from '@icon-park/react'\nimport type { ModalProps as AntdModalProps } from 'antd/lib/modal'\nimport cn from 'classnames'\nimport React, { Fragment, useEffect, useState, useRef } from 'react'\nimport { Modal as AntdModal } from 'antd'\nimport { isArray } from 'lodash'\n\nimport './index.less'\n\nexport type ModalProps = AntdModalProps & {\n children?: React.ReactNode\n hasFooter?: boolean\n config?: {\n fullScreen?: boolean\n width?: string | number\n height?: string | number\n logo?: React.ReactNode\n }\n}\n\nexport const Modal = ({\n visible,\n className,\n title,\n width,\n style = {},\n children,\n onCancel,\n hasFooter = true,\n footer,\n config = {\n width: 'auto',\n height: 'auto',\n },\n ...rest\n}: ModalProps) => {\n const [fullscreen, setFullscreen] = useState<boolean>(false)\n const supportFullscreen = config.fullScreen\n\n useEffect(() => {\n return () => {\n setFullscreen(false)\n }\n }, [visible])\n\n const Title = ({\n title,\n logo,\n fullscreen,\n onToggleFullscreen,\n onClose,\n }: // eslint-disable-next-line @typescript-eslint/no-explicit-any\n any) => {\n return (\n <Fragment>\n <div className=\"ant-modal-header-title\">\n {logo && logo}\n <span>{title}</span>\n </div>\n <div className=\"ant-modal-header-actions\">\n <a className=\"modal-fullscreen-wrap\" onClick={onToggleFullscreen}>\n {fullscreen ? <OffScreen /> : <FullScreenIcon />}\n </a>\n <a className=\"modal-close-wrap\" onClick={onClose}>\n <Close theme=\"outline\" />\n </a>\n </div>\n </Fragment>\n )\n }\n\n const computeWidth = supportFullscreen\n ? fullscreen\n ? '100vw'\n : width || config.width\n : width || config.width\n\n const computeHeight = supportFullscreen ? (fullscreen ? '100vh' : config.height) : 'inherit'\n\n style.height = computeHeight\n if (supportFullscreen && fullscreen) {\n style.top = 0\n } else {\n delete style.top\n }\n\n const footerConfig = hasFooter\n ? (isArray(footer) ? footer.length > 0 : footer)\n ? footer\n : undefined\n : null\n\n return (\n <AntdModal\n visible={visible}\n title={\n supportFullscreen ? (\n <Title\n logo={config.logo}\n title={title}\n fullscreen={fullscreen}\n supportFullscreen={supportFullscreen}\n onClose={onCancel}\n onToggleFullscreen={() => {\n setFullscreen(!fullscreen)\n if (!fullscreen) {\n }\n }}\n />\n ) : (\n title\n )\n }\n onCancel={onCancel}\n centered={supportFullscreen ? true : rest.centered ? true : false}\n width={computeWidth}\n style={style}\n className={cn([\n {\n 'support-fullscreen': supportFullscreen,\n fullscreen: fullscreen,\n 'no-header': supportFullscreen && !(config.logo || title),\n },\n className,\n ])}\n footer={footer}\n {...rest}\n >\n {children}\n </AntdModal>\n )\n}\n\nexport default Modal\n"]}
|