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,116 +1,123 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
* @LastEditors: 郑泳健
|
|
7
|
-
* @LastEditTime: 2023-04-06 17:42:31
|
|
8
|
-
*/
|
|
9
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
-
}
|
|
15
|
-
Object.defineProperty(o, k2, desc);
|
|
16
|
-
}) : (function(o, m, k, k2) {
|
|
17
|
-
if (k2 === undefined) k2 = k;
|
|
18
|
-
o[k2] = m[k];
|
|
19
|
-
}));
|
|
20
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
21
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
22
|
-
}) : function(o, v) {
|
|
23
|
-
o["default"] = v;
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
24
6
|
});
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
};
|
|
32
|
-
Object.defineProperty(
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
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
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
7
|
+
exports["default"] = void 0;
|
|
8
|
+
var _isEqual2 = _interopRequireDefault(require("lodash/isEqual"));
|
|
9
|
+
var _cloneDeep2 = _interopRequireDefault(require("lodash/cloneDeep"));
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
var _utils = require("../utils");
|
|
12
|
+
var _store = require("../store");
|
|
13
|
+
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); }
|
|
14
|
+
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; }
|
|
15
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
16
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
17
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
18
|
+
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."); }
|
|
19
|
+
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); }
|
|
20
|
+
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; }
|
|
21
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0) { ; } } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
22
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
23
|
+
var List = function List(_ref) {
|
|
24
|
+
var name = _ref.name,
|
|
25
|
+
children = _ref.children;
|
|
26
|
+
var maxRef = (0, _react.useRef)(-1);
|
|
27
|
+
var _useContext = (0, _react.useContext)(_store.FormContext),
|
|
28
|
+
form = _useContext.form,
|
|
29
|
+
initialValues = _useContext.initialValues,
|
|
30
|
+
compsRefs = _useContext.compsRefs,
|
|
31
|
+
updateRefs = _useContext.updateRefs;
|
|
32
|
+
var _useState = (0, _react.useState)([]),
|
|
33
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
34
|
+
dataLevel = _useState2[0],
|
|
35
|
+
setDataLevel = _useState2[1];
|
|
36
|
+
/** 根据一开始记录的渲染shouldUpdate 和 dependencies组件 */
|
|
37
|
+
var updateRender = function updateRender() {
|
|
38
|
+
if (Array.isArray(updateRefs.current.shouldUpdateList)) {
|
|
39
|
+
updateRefs.current.shouldUpdateList.forEach(function (i) {
|
|
40
|
+
var _a, _b;
|
|
41
|
+
(_b = (_a = compsRefs === null || compsRefs === void 0 ? void 0 : compsRefs.current) === null || _a === void 0 ? void 0 : _a[i]) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
var list = updateRefs.current.dependencies[(0, _utils.getNames)(name).join('.')];
|
|
45
|
+
if (Array.isArray(list)) {
|
|
46
|
+
list.forEach(function (i) {
|
|
47
|
+
var _a, _b;
|
|
48
|
+
(_b = (_a = compsRefs === null || compsRefs === void 0 ? void 0 : compsRefs.current) === null || _a === void 0 ? void 0 : _a[i]) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
/** 根据默认数值自动生成dataLevel */
|
|
53
|
+
(0, _react.useEffect)(function () {
|
|
54
|
+
var dataSource = initialValues;
|
|
55
|
+
var attrs = (0, _utils.getNames)(name);
|
|
56
|
+
var key = Array.isArray(name) ? name === null || name === void 0 ? void 0 : name[0] : name;
|
|
57
|
+
var _iterator = _createForOfIteratorHelper(attrs),
|
|
58
|
+
_step;
|
|
59
|
+
try {
|
|
60
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
61
|
+
var _key = _step.value;
|
|
62
|
+
dataSource = (dataSource === null || dataSource === void 0 ? void 0 : dataSource[_key]) || [{}];
|
|
63
|
+
}
|
|
64
|
+
} catch (err) {
|
|
65
|
+
_iterator.e(err);
|
|
66
|
+
} finally {
|
|
67
|
+
_iterator.f();
|
|
68
|
+
}
|
|
69
|
+
if (Array.isArray(dataSource)) {
|
|
70
|
+
var _level = dataSource.map(function (i, index) {
|
|
71
|
+
return {
|
|
72
|
+
key: index,
|
|
73
|
+
name: "".concat(attrs.join('.'), ".").concat(index)
|
|
74
|
+
};
|
|
75
|
+
});
|
|
76
|
+
setDataLevel(_level);
|
|
77
|
+
maxRef.current = dataSource.length - 1;
|
|
78
|
+
if (form) {
|
|
79
|
+
form.dataLevel[key] = _level;
|
|
80
|
+
}
|
|
81
|
+
updateRender();
|
|
82
|
+
}
|
|
83
|
+
}, [form, initialValues, name]);
|
|
84
|
+
/** 新增一列 */
|
|
85
|
+
var handleAdd = function handleAdd(index) {
|
|
86
|
+
var tempDataLevel = (0, _cloneDeep2["default"])(dataLevel);
|
|
87
|
+
var key = Array.isArray(name) ? name === null || name === void 0 ? void 0 : name[0] : name;
|
|
88
|
+
maxRef.current++;
|
|
89
|
+
var attrs = (0, _utils.getNames)(name);
|
|
90
|
+
tempDataLevel.splice(index + 1, 0, {
|
|
91
|
+
key: maxRef.current,
|
|
92
|
+
name: "".concat(attrs === null || attrs === void 0 ? void 0 : attrs.join('.'), ".").concat(maxRef.current)
|
|
93
|
+
});
|
|
94
|
+
setDataLevel(tempDataLevel);
|
|
95
|
+
if (form) {
|
|
96
|
+
form.dataLevel[key] = tempDataLevel;
|
|
97
|
+
}
|
|
98
|
+
updateRender();
|
|
99
|
+
};
|
|
100
|
+
/** 删除一列 */
|
|
101
|
+
var handleDel = function handleDel(index) {
|
|
102
|
+
var temp = (0, _cloneDeep2["default"])(dataLevel);
|
|
103
|
+
var key = Array.isArray(name) ? name === null || name === void 0 ? void 0 : name[0] : name;
|
|
104
|
+
temp.splice(index, 1);
|
|
105
|
+
setDataLevel(temp);
|
|
106
|
+
if (form) {
|
|
107
|
+
form.dataLevel[key] = temp;
|
|
108
|
+
}
|
|
109
|
+
updateRender();
|
|
110
|
+
};
|
|
111
|
+
return _react["default"].createElement(_react["default"].Fragment, null, children === null || children === void 0 ? void 0 : children(dataLevel, {
|
|
112
|
+
add: handleAdd,
|
|
113
|
+
remove: handleDel
|
|
114
|
+
}));
|
|
108
115
|
};
|
|
109
116
|
// name 没有改变就不需要重复render
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
117
|
+
var _default = (0, _react.memo)(List, function (nextProps, prevProps) {
|
|
118
|
+
if ((0, _isEqual2["default"])(nextProps.name, prevProps.name) && !!prevProps.name) {
|
|
119
|
+
return true;
|
|
120
|
+
}
|
|
121
|
+
return false;
|
|
115
122
|
});
|
|
116
|
-
|
|
123
|
+
exports["default"] = _default;
|
|
@@ -1,31 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
17
6
|
});
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
25
|
-
var
|
|
26
|
-
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports["default"] = void 0;
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _utils = require("./utils");
|
|
10
|
+
var _store = require("./store");
|
|
11
|
+
var _List = _interopRequireDefault(require("./components/List"));
|
|
12
|
+
var _Item = _interopRequireDefault(require("./components/Item"));
|
|
13
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
14
|
+
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); }
|
|
15
|
+
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; }
|
|
29
16
|
/*
|
|
30
17
|
* @Descripttion: 高性能动态增删form表单
|
|
31
18
|
* @Author: 郑泳健
|
|
@@ -33,46 +20,53 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
33
20
|
* @LastEditors: 郑泳健
|
|
34
21
|
* @LastEditTime: 2023-04-06 15:32:07
|
|
35
22
|
*/
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
23
|
+
|
|
24
|
+
var TntdForm = function TntdForm(_ref) {
|
|
25
|
+
var form = _ref.form,
|
|
26
|
+
initialValues = _ref.initialValues,
|
|
27
|
+
children = _ref.children;
|
|
28
|
+
var updateRefs = (0, _react.useRef)({
|
|
29
|
+
shouldUpdateList: [],
|
|
30
|
+
dependencies: {}
|
|
31
|
+
});
|
|
32
|
+
var compsRefs = (0, _react.useRef)({});
|
|
33
|
+
return _react["default"].createElement(_store.FormContext.Provider, {
|
|
34
|
+
value: {
|
|
35
|
+
form: form,
|
|
36
|
+
initialValues: initialValues,
|
|
37
|
+
updateRefs: updateRefs,
|
|
38
|
+
compsRefs: compsRefs
|
|
39
|
+
}
|
|
40
|
+
}, children);
|
|
53
41
|
};
|
|
54
|
-
TntdForm.useForm = ()
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
42
|
+
TntdForm.useForm = function () {
|
|
43
|
+
var form = (0, _react.useRef)({
|
|
44
|
+
dataLevel: {},
|
|
45
|
+
formData: {},
|
|
46
|
+
validateFields: function validateFields() {
|
|
47
|
+
return (0, _utils.validateFields)(form.current);
|
|
48
|
+
},
|
|
49
|
+
getFieldsValue: function getFieldsValue() {
|
|
50
|
+
return (0, _utils.getFieldsValue)(form.current);
|
|
51
|
+
},
|
|
52
|
+
getFieldValue: function getFieldValue(field) {
|
|
53
|
+
return (0, _utils.getFieldValue)(form.current, field);
|
|
54
|
+
},
|
|
55
|
+
setFieldsValue: function setFieldsValue(obj) {
|
|
56
|
+
for (var i in obj) {
|
|
57
|
+
if (Object.prototype.hasOwnProperty.call(obj, i)) {
|
|
58
|
+
var prefix = (i === null || i === void 0 ? void 0 : i.split('.')) || [];
|
|
59
|
+
var attr = prefix.pop();
|
|
60
|
+
if (attr && form.current.formData[prefix.join('.')][attr]) {
|
|
61
|
+
form.current.formData[prefix.join('.')][attr].setItemValue(obj[i]);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
return [form.current];
|
|
74
68
|
};
|
|
75
|
-
TntdForm.List =
|
|
76
|
-
TntdForm.Item =
|
|
77
|
-
|
|
78
|
-
|
|
69
|
+
TntdForm.List = _List["default"];
|
|
70
|
+
TntdForm.Item = _Item["default"];
|
|
71
|
+
var _default = TntdForm;
|
|
72
|
+
exports["default"] = _default;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
6
|
exports.FormContext = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
9
|
+
var FormContext = _react["default"].createContext({});
|
|
10
|
+
exports.FormContext = FormContext;
|