tntd 2.6.9 → 2.6.11
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 +26 -0
- package/es/actions/index.js.map +1 -0
- package/es/actions/index.less +70 -0
- package/es/cascader/index.js +5 -1
- package/es/cascader/index.js.map +1 -1
- package/es/check-card/group.js +197 -0
- package/es/check-card/group.js.map +1 -0
- package/es/check-card/index.js +163 -0
- package/es/check-card/index.js.map +1 -0
- package/es/check-card/index.less +179 -0
- package/es/checkbox/checkbox-group.js +5 -0
- package/es/checkbox/checkbox-group.js.map +1 -0
- package/es/checkbox/index.js +5 -0
- package/es/checkbox/index.js.map +1 -1
- 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/config-provider/DisabledContext.js +12 -0
- package/es/config-provider/DisabledContext.js.map +1 -0
- package/es/config-provider/SizeContext.js +9 -0
- package/es/config-provider/SizeContext.js.map +1 -0
- package/es/config-provider/index.js +4 -0
- package/es/config-provider/index.js.map +1 -1
- package/es/connect/index.js +29 -0
- package/es/connect/index.js.map +1 -0
- package/es/date-picker/index.js +15 -1
- package/es/date-picker/index.js.map +1 -1
- package/es/ellipsis/index.js +2 -2
- package/es/ellipsis/index.js.map +1 -1
- package/es/ellipsis/index.less +1 -1
- package/es/handle/index.js +1 -1
- package/es/handle/index.js.map +1 -1
- package/es/handle/index.less +1 -1
- package/es/index.js +8 -1
- package/es/index.js.map +1 -1
- package/es/index.less +5 -0
- package/es/input/input.js +19 -10
- package/es/input/input.js.map +1 -1
- package/es/input-number/index.js +3 -1
- package/es/input-number/index.js.map +1 -1
- package/es/locale/en_US.js +4 -2
- package/es/locale/en_US.js.map +1 -1
- package/es/locale/zh_CN.js +4 -2
- package/es/locale/zh_CN.js.map +1 -1
- 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/preview-text/index.js +265 -0
- package/es/preview-text/index.js.map +1 -0
- package/es/preview-text/index.less +3 -0
- package/es/radio/index.js +3 -0
- package/es/radio/index.js.map +1 -1
- package/es/radio/radio-group.js +5 -0
- package/es/radio/radio-group.js.map +1 -0
- package/es/segmented/index.js +67 -0
- package/es/segmented/index.js.map +1 -0
- package/es/segmented/index.less +138 -0
- package/es/select/index.js.map +1 -1
- package/es/select/select.js +25 -3
- package/es/select/select.js.map +1 -1
- package/es/switch/index.js +2 -3
- package/es/switch/index.js.map +1 -1
- package/es/switch/switch.js +10 -0
- package/es/switch/switch.js.map +1 -0
- package/es/table/hooks/use-column-setting.js.map +1 -1
- package/es/table/table.js +40 -5
- package/es/table/table.js.map +1 -1
- package/es/table/total-shower.js +10 -0
- package/es/table/total-shower.js.map +1 -0
- package/es/time-picker/index.js +3 -1
- package/es/time-picker/index.js.map +1 -1
- package/es/title/index.js +9 -11
- package/es/title/index.js.map +1 -1
- package/es/title/index.less +10 -10
- package/es/tntd-form/ErrorList.js +87 -0
- package/es/tntd-form/ErrorList.js.map +1 -0
- package/es/tntd-form/Form.js +122 -0
- package/es/tntd-form/Form.js.map +1 -0
- package/es/tntd-form/FormItem/ItemHolder.js +144 -0
- package/es/tntd-form/FormItem/ItemHolder.js.map +1 -0
- package/es/tntd-form/FormItem/index.js +264 -0
- package/es/tntd-form/FormItem/index.js.map +1 -0
- package/es/tntd-form/FormItemInput.js +79 -0
- package/es/tntd-form/FormItemInput.js.map +1 -0
- package/es/tntd-form/FormItemLabel.js +98 -0
- package/es/tntd-form/FormItemLabel.js.map +1 -0
- package/es/tntd-form/FormList.js +40 -0
- package/es/tntd-form/FormList.js.map +1 -0
- package/es/tntd-form/_util/motion.js +47 -0
- package/es/tntd-form/_util/motion.js.map +1 -0
- package/es/tntd-form/_util/reactNode.js +16 -0
- package/es/tntd-form/_util/reactNode.js.map +1 -0
- package/es/tntd-form/_util/scrollTo.js +35 -0
- package/es/tntd-form/_util/scrollTo.js.map +1 -0
- package/es/tntd-form/_util/type.js +3 -0
- package/es/tntd-form/_util/type.js.map +1 -0
- package/es/tntd-form/_util/warning.js +5 -0
- package/es/tntd-form/_util/warning.js.map +1 -0
- package/es/tntd-form/_util/wave.js +168 -0
- package/es/tntd-form/_util/wave.js.map +1 -0
- package/es/tntd-form/context.js +40 -0
- package/es/tntd-form/context.js.map +1 -0
- package/es/tntd-form/hooks/useDebounce.js +13 -0
- package/es/tntd-form/hooks/useDebounce.js.map +1 -0
- package/es/tntd-form/hooks/useForm.js +40 -0
- package/es/tntd-form/hooks/useForm.js.map +1 -0
- package/es/tntd-form/hooks/useFormInstance.js +8 -0
- package/es/tntd-form/hooks/useFormInstance.js.map +1 -0
- package/es/tntd-form/hooks/useFormItemStatus.js +13 -0
- package/es/tntd-form/hooks/useFormItemStatus.js.map +1 -0
- package/es/tntd-form/hooks/useFrameState.js +37 -0
- package/es/tntd-form/hooks/useFrameState.js.map +1 -0
- package/es/tntd-form/hooks/useItemRef.js +20 -0
- package/es/tntd-form/hooks/useItemRef.js.map +1 -0
- package/es/tntd-form/index.js +17 -1
- package/es/tntd-form/index.js.map +1 -1
- package/es/tntd-form/interface.js +2 -0
- package/es/tntd-form/interface.js.map +1 -0
- package/es/tntd-form/style/components.less +16 -0
- package/es/tntd-form/style/horizontal.less +26 -0
- package/es/tntd-form/style/index.js +5 -0
- package/es/tntd-form/style/index.js.map +1 -0
- package/es/tntd-form/style/index.less +342 -0
- package/es/tntd-form/style/inline.less +40 -0
- package/es/tntd-form/style/mixin.less +90 -0
- package/es/tntd-form/style/rtl.less +204 -0
- package/es/tntd-form/style/status.less +45 -0
- package/es/tntd-form/style/vertical.less +95 -0
- package/es/tntd-form/tntd-form.stories.js +786 -0
- package/es/tntd-form/tntd-form.stories.js.map +1 -0
- package/es/tntd-form/util.js +18 -0
- package/es/tntd-form/util.js.map +1 -0
- package/es/tntd-form/validateMessagesContext.js +5 -0
- package/es/tntd-form/validateMessagesContext.js.map +1 -0
- package/es/tntd-modal/index.js +71 -56
- package/es/tntd-modal/index.js.map +1 -1
- package/es/tntd-modal/index.less +83 -63
- package/es/tree-select/index.js +4 -1
- package/es/tree-select/index.js.map +1 -1
- package/es/upload/index.js +8 -1
- package/es/upload/index.js.map +1 -1
- package/es/utils/index.js +1 -0
- package/es/utils/index.js.map +1 -1
- package/es/utils/simple-template.js +10 -0
- package/es/utils/simple-template.js.map +1 -0
- package/es/water-mark/index.js +110 -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 +34 -0
- package/lib/actions/index.js.map +1 -0
- package/lib/actions/index.less +70 -0
- package/lib/cascader/index.d.ts +6 -1
- package/lib/cascader/index.d.ts.map +1 -1
- package/lib/cascader/index.js +10 -3
- package/lib/cascader/index.js.map +1 -1
- 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 +236 -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 +178 -0
- package/lib/check-card/index.js.map +1 -0
- package/lib/check-card/index.less +179 -0
- package/lib/checkbox/checkbox-group.d.ts +8 -0
- package/lib/checkbox/checkbox-group.d.ts.map +1 -0
- package/lib/checkbox/checkbox-group.js +13 -0
- package/lib/checkbox/checkbox-group.js.map +1 -0
- package/lib/checkbox/index.d.ts +1 -0
- package/lib/checkbox/index.d.ts.map +1 -1
- package/lib/checkbox/index.js +16 -0
- package/lib/checkbox/index.js.map +1 -1
- 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/config-provider/DisabledContext.d.ts +10 -0
- package/lib/config-provider/DisabledContext.d.ts.map +1 -0
- package/lib/config-provider/DisabledContext.js +22 -0
- package/lib/config-provider/DisabledContext.js.map +1 -0
- package/lib/config-provider/SizeContext.d.ts +10 -0
- package/lib/config-provider/SizeContext.d.ts.map +1 -0
- package/lib/config-provider/SizeContext.js +23 -0
- package/lib/config-provider/SizeContext.js.map +1 -0
- package/lib/config-provider/index.d.ts +1 -0
- package/lib/config-provider/index.d.ts.map +1 -1
- package/lib/config-provider/index.js +15 -0
- package/lib/config-provider/index.js.map +1 -1
- package/lib/connect/index.d.ts +12 -0
- package/lib/connect/index.d.ts.map +1 -0
- package/lib/connect/index.js +50 -0
- package/lib/connect/index.js.map +1 -0
- package/lib/date-picker/index.d.ts +6 -1
- package/lib/date-picker/index.d.ts.map +1 -1
- package/lib/date-picker/index.js +29 -3
- package/lib/date-picker/index.js.map +1 -1
- package/lib/ellipsis/index.js +2 -2
- package/lib/ellipsis/index.js.map +1 -1
- package/lib/ellipsis/index.less +1 -1
- package/lib/handle/index.d.ts.map +1 -1
- package/lib/handle/index.js +1 -1
- 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 +22 -0
- package/lib/index.js.map +1 -1
- package/lib/index.less +5 -0
- package/lib/input/input.d.ts +5 -0
- package/lib/input/input.d.ts.map +1 -1
- package/lib/input/input.js +18 -8
- package/lib/input/input.js.map +1 -1
- package/lib/input-number/index.d.ts +7 -2
- package/lib/input-number/index.d.ts.map +1 -1
- package/lib/input-number/index.js +4 -1
- package/lib/input-number/index.js.map +1 -1
- 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 +4 -2
- 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 +4 -2
- package/lib/locale/zh_CN.js.map +1 -1
- 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/preview-text/index.d.ts +20 -0
- package/lib/preview-text/index.d.ts.map +1 -0
- package/lib/preview-text/index.js +278 -0
- package/lib/preview-text/index.js.map +1 -0
- package/lib/preview-text/index.less +3 -0
- package/lib/radio/index.d.ts.map +1 -1
- package/lib/radio/index.js +4 -0
- package/lib/radio/index.js.map +1 -1
- package/lib/radio/radio-group.d.ts +8 -0
- package/lib/radio/radio-group.d.ts.map +1 -0
- package/lib/radio/radio-group.js +13 -0
- package/lib/radio/radio-group.js.map +1 -0
- package/lib/segmented/index.d.ts +23 -0
- package/lib/segmented/index.d.ts.map +1 -0
- package/lib/segmented/index.js +80 -0
- package/lib/segmented/index.js.map +1 -0
- package/lib/segmented/index.less +138 -0
- package/lib/select/index.d.ts +2 -1
- package/lib/select/index.d.ts.map +1 -1
- package/lib/select/index.js.map +1 -1
- package/lib/select/select.d.ts +12 -0
- package/lib/select/select.d.ts.map +1 -1
- package/lib/select/select.js +25 -4
- package/lib/select/select.js.map +1 -1
- package/lib/svg-components/illustration-403.d.ts +1 -1
- package/lib/svg-components/illustration-404.d.ts +1 -1
- package/lib/svg-components/illustration-500.d.ts +1 -1
- package/lib/svg-components/illustration-empty.d.ts +1 -1
- package/lib/svg-components/illustration-failure.d.ts +1 -1
- package/lib/svg-components/illustration-no-access.d.ts +1 -1
- package/lib/svg-components/illustration-no-chart.d.ts +1 -1
- package/lib/svg-components/illustration-no-result.d.ts +1 -1
- package/lib/svg-components/illustration-offline.d.ts +1 -1
- package/lib/svg-components/illustration-success.d.ts +1 -1
- package/lib/switch/index.d.ts +2 -3
- package/lib/switch/index.d.ts.map +1 -1
- package/lib/switch/index.js +1 -2
- package/lib/switch/index.js.map +1 -1
- package/lib/switch/switch.d.ts +10 -0
- package/lib/switch/switch.d.ts.map +1 -0
- package/lib/switch/switch.js +37 -0
- package/lib/switch/switch.js.map +1 -0
- package/lib/table/assets/image-loading-background.d.ts +1 -1
- package/lib/table/assets/image-loading.d.ts +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.map +1 -1
- package/lib/table/table.js +44 -8
- package/lib/table/table.js.map +1 -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 +17 -0
- package/lib/table/total-shower.js.map +1 -0
- package/lib/time-picker/index.d.ts +7 -2
- package/lib/time-picker/index.d.ts.map +1 -1
- package/lib/time-picker/index.js +3 -1
- package/lib/time-picker/index.js.map +1 -1
- package/lib/title/index.d.ts +11 -1
- package/lib/title/index.d.ts.map +1 -1
- package/lib/title/index.js +8 -10
- package/lib/title/index.js.map +1 -1
- package/lib/title/index.less +10 -10
- package/lib/tntd-cascader/AntdCascader/config/utils.d.ts +1 -1
- package/lib/tntd-form/ErrorList.d.ts +13 -0
- package/lib/tntd-form/ErrorList.d.ts.map +1 -0
- package/lib/tntd-form/ErrorList.js +104 -0
- package/lib/tntd-form/ErrorList.js.map +1 -0
- package/lib/tntd-form/Form.d.ts +36 -0
- package/lib/tntd-form/Form.d.ts.map +1 -0
- package/lib/tntd-form/Form.js +160 -0
- package/lib/tntd-form/Form.js.map +1 -0
- package/lib/tntd-form/FormItem/ItemHolder.d.ts +18 -0
- package/lib/tntd-form/FormItem/ItemHolder.d.ts.map +1 -0
- package/lib/tntd-form/FormItem/ItemHolder.js +163 -0
- package/lib/tntd-form/FormItem/ItemHolder.js.map +1 -0
- package/lib/tntd-form/FormItem/index.d.ts +36 -0
- package/lib/tntd-form/FormItem/index.d.ts.map +1 -0
- package/lib/tntd-form/FormItem/index.js +301 -0
- package/lib/tntd-form/FormItem/index.js.map +1 -0
- package/lib/tntd-form/FormItemInput.d.ts +30 -0
- package/lib/tntd-form/FormItemInput.d.ts.map +1 -0
- package/lib/tntd-form/FormItemInput.js +92 -0
- package/lib/tntd-form/FormItemInput.js.map +1 -0
- package/lib/tntd-form/FormItemLabel.d.ts +24 -0
- package/lib/tntd-form/FormItemLabel.d.ts.map +1 -0
- package/lib/tntd-form/FormItemLabel.js +106 -0
- package/lib/tntd-form/FormItemLabel.js.map +1 -0
- package/lib/tntd-form/FormList.d.ts +26 -0
- package/lib/tntd-form/FormList.d.ts.map +1 -0
- package/lib/tntd-form/FormList.js +56 -0
- package/lib/tntd-form/FormList.js.map +1 -0
- package/lib/tntd-form/_util/motion.d.ts +9 -0
- package/lib/tntd-form/_util/motion.d.ts.map +1 -0
- package/lib/tntd-form/_util/motion.js +59 -0
- package/lib/tntd-form/_util/motion.js.map +1 -0
- package/lib/tntd-form/_util/reactNode.d.ts +9 -0
- package/lib/tntd-form/_util/reactNode.d.ts.map +1 -0
- package/lib/tntd-form/_util/reactNode.js +27 -0
- package/lib/tntd-form/_util/reactNode.js.map +1 -0
- package/lib/tntd-form/_util/scrollTo.d.ts +1 -0
- package/lib/tntd-form/_util/scrollTo.d.ts.map +1 -0
- package/lib/tntd-form/_util/scrollTo.js +35 -0
- package/lib/tntd-form/_util/scrollTo.js.map +1 -0
- package/lib/tntd-form/_util/type.d.ts +4 -0
- package/lib/tntd-form/_util/type.d.ts.map +1 -0
- package/lib/tntd-form/_util/type.js +21 -0
- package/lib/tntd-form/_util/type.js.map +1 -0
- package/lib/tntd-form/_util/warning.d.ts +5 -0
- package/lib/tntd-form/_util/warning.d.ts.map +1 -0
- package/lib/tntd-form/_util/warning.js +20 -0
- package/lib/tntd-form/_util/warning.js.map +1 -0
- package/lib/tntd-form/_util/wave.d.ts +1 -0
- package/lib/tntd-form/_util/wave.d.ts.map +1 -0
- package/lib/tntd-form/_util/wave.js +168 -0
- package/lib/tntd-form/_util/wave.js.map +1 -0
- package/lib/tntd-form/context.d.ts +51 -0
- package/lib/tntd-form/context.d.ts.map +1 -0
- package/lib/tntd-form/context.js +54 -0
- package/lib/tntd-form/context.js.map +1 -0
- package/lib/tntd-form/hooks/useDebounce.d.ts +2 -0
- package/lib/tntd-form/hooks/useDebounce.d.ts.map +1 -0
- package/lib/tntd-form/hooks/useDebounce.js +31 -0
- package/lib/tntd-form/hooks/useDebounce.js.map +1 -0
- package/lib/tntd-form/hooks/useForm.d.ts +16 -0
- package/lib/tntd-form/hooks/useForm.d.ts.map +1 -0
- package/lib/tntd-form/hooks/useForm.js +63 -0
- package/lib/tntd-form/hooks/useForm.js.map +1 -0
- package/lib/tntd-form/hooks/useFormInstance.d.ts +3 -0
- package/lib/tntd-form/hooks/useFormInstance.d.ts.map +1 -0
- package/lib/tntd-form/hooks/useFormInstance.js +13 -0
- package/lib/tntd-form/hooks/useFormInstance.js.map +1 -0
- package/lib/tntd-form/hooks/useFormItemStatus.d.ts +7 -0
- package/lib/tntd-form/hooks/useFormItemStatus.d.ts.map +1 -0
- package/lib/tntd-form/hooks/useFormItemStatus.js +20 -0
- package/lib/tntd-form/hooks/useFormItemStatus.js.map +1 -0
- package/lib/tntd-form/hooks/useFrameState.d.ts +4 -0
- package/lib/tntd-form/hooks/useFrameState.d.ts.map +1 -0
- package/lib/tntd-form/hooks/useFrameState.js +55 -0
- package/lib/tntd-form/hooks/useFrameState.js.map +1 -0
- package/lib/tntd-form/hooks/useItemRef.d.ts +4 -0
- package/lib/tntd-form/hooks/useItemRef.d.ts.map +1 -0
- package/lib/tntd-form/hooks/useItemRef.js +28 -0
- package/lib/tntd-form/hooks/useItemRef.js.map +1 -0
- package/lib/tntd-form/index.d.ts +23 -1
- package/lib/tntd-form/index.d.ts.map +1 -1
- package/lib/tntd-form/index.js +24 -8
- package/lib/tntd-form/index.js.map +1 -1
- package/lib/tntd-form/interface.d.ts +4 -0
- package/lib/tntd-form/interface.d.ts.map +1 -0
- package/lib/tntd-form/interface.js +7 -0
- package/lib/tntd-form/interface.js.map +1 -0
- package/lib/tntd-form/style/components.less +16 -0
- package/lib/tntd-form/style/horizontal.less +26 -0
- package/lib/tntd-form/style/index.d.ts +5 -0
- package/lib/tntd-form/style/index.d.ts.map +1 -0
- package/lib/tntd-form/style/index.js +6 -0
- package/lib/tntd-form/style/index.js.map +1 -0
- package/lib/tntd-form/style/index.less +342 -0
- package/lib/tntd-form/style/inline.less +40 -0
- package/lib/tntd-form/style/mixin.less +90 -0
- package/lib/tntd-form/style/rtl.less +204 -0
- package/lib/tntd-form/style/status.less +45 -0
- package/lib/tntd-form/style/vertical.less +95 -0
- package/lib/tntd-form/tntd-form.stories.d.ts +33 -0
- package/lib/tntd-form/tntd-form.stories.d.ts.map +1 -0
- package/lib/tntd-form/tntd-form.stories.js +888 -0
- package/lib/tntd-form/tntd-form.stories.js.map +1 -0
- package/lib/tntd-form/util.d.ts +4 -0
- package/lib/tntd-form/util.d.ts.map +1 -0
- package/lib/tntd-form/util.js +25 -0
- package/lib/tntd-form/util.js.map +1 -0
- package/lib/tntd-form/validateMessagesContext.d.ts +5 -0
- package/lib/tntd-form/validateMessagesContext.d.ts.map +1 -0
- package/lib/tntd-form/validateMessagesContext.js +12 -0
- package/lib/tntd-form/validateMessagesContext.js.map +1 -0
- 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 +76 -61
- package/lib/tntd-modal/index.js.map +1 -1
- package/lib/tntd-modal/index.less +83 -63
- package/lib/tree-select/index.d.ts +7 -1
- package/lib/tree-select/index.d.ts.map +1 -1
- package/lib/tree-select/index.js +9 -3
- package/lib/tree-select/index.js.map +1 -1
- package/lib/upload/index.d.ts +6 -1
- package/lib/upload/index.d.ts.map +1 -1
- package/lib/upload/index.js +11 -1
- package/lib/upload/index.js.map +1 -1
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.d.ts.map +1 -1
- package/lib/utils/index.js +12 -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 +19 -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 +142 -0
- package/lib/water-mark/index.js.map +1 -0
- package/package.json +26 -5
- package/themes/default/variables.less +43 -0
package/es/title/index.less
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
.
|
|
1
|
+
.tntd-title {
|
|
2
2
|
& {
|
|
3
3
|
position: relative;
|
|
4
4
|
height: 32px;
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
&.has-number {
|
|
11
|
-
.
|
|
11
|
+
.tntd-title-text {
|
|
12
12
|
h3 {
|
|
13
13
|
margin-left: 0;
|
|
14
14
|
}
|
|
@@ -58,14 +58,14 @@
|
|
|
58
58
|
.count {
|
|
59
59
|
position: relative;
|
|
60
60
|
top: -1px;
|
|
61
|
-
color:
|
|
61
|
+
color: @primary-color;
|
|
62
62
|
font-size: 22px;
|
|
63
63
|
font-style: normal;
|
|
64
64
|
margin-right: 12px;
|
|
65
65
|
position: relative;
|
|
66
66
|
vertical-align: top;
|
|
67
67
|
font-weight: 400;
|
|
68
|
-
font-family: Roboto, 'Helvetica Neue', Helvetica, Tahoma, Arial, 'PingFang SC',
|
|
68
|
+
font-family: 'OswaldLight', Roboto, 'Helvetica Neue', Helvetica, Tahoma, Arial, 'PingFang SC',
|
|
69
69
|
'Microsoft YaHei' !important;
|
|
70
70
|
letter-spacing: 1px;
|
|
71
71
|
}
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
content: '';
|
|
76
76
|
width: 22px;
|
|
77
77
|
height: 15px;
|
|
78
|
-
border-top: 1px solid
|
|
78
|
+
border-top: 1px solid @primary-color;
|
|
79
79
|
background-color: #fff;
|
|
80
80
|
top: 45%;
|
|
81
81
|
left: 58%;
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
height: 28px;
|
|
89
89
|
line-height: 28px;
|
|
90
90
|
}
|
|
91
|
-
.
|
|
91
|
+
.tntd-title-text {
|
|
92
92
|
h3 {
|
|
93
93
|
font-size: 14px;
|
|
94
94
|
}
|
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
height: 36px;
|
|
104
104
|
line-height: 36px;
|
|
105
105
|
}
|
|
106
|
-
.
|
|
106
|
+
.tntd-title-text {
|
|
107
107
|
h3 {
|
|
108
108
|
font-size: 18px;
|
|
109
109
|
}
|
|
@@ -118,7 +118,7 @@
|
|
|
118
118
|
height: 40px;
|
|
119
119
|
line-height: 40px;
|
|
120
120
|
}
|
|
121
|
-
.
|
|
121
|
+
.tntd-title-text {
|
|
122
122
|
h3 {
|
|
123
123
|
font-size: 20px;
|
|
124
124
|
}
|
|
@@ -128,7 +128,7 @@
|
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
|
-
.
|
|
131
|
+
.tntd-title-text {
|
|
132
132
|
& {
|
|
133
133
|
position: relative;
|
|
134
134
|
float: left;
|
|
@@ -161,7 +161,7 @@
|
|
|
161
161
|
margin-right: 8px;
|
|
162
162
|
}
|
|
163
163
|
}
|
|
164
|
-
.
|
|
164
|
+
.tntd-title-extra {
|
|
165
165
|
& {
|
|
166
166
|
position: relative;
|
|
167
167
|
float: right;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import classNames from 'classnames';
|
|
2
|
+
import CSSMotion, { CSSMotionList } from 'rc-motion';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { ConfigContext } from '../config-provider';
|
|
5
|
+
import collapseMotion from './_util/motion';
|
|
6
|
+
import { FormItemPrefixContext } from './context';
|
|
7
|
+
import useDebounce from './hooks/useDebounce';
|
|
8
|
+
const EMPTY_LIST = [];
|
|
9
|
+
function toErrorEntity(error, errorStatus, prefix, index = 0) {
|
|
10
|
+
return {
|
|
11
|
+
key: typeof error === 'string' ? error : `${prefix}-${index}`,
|
|
12
|
+
error,
|
|
13
|
+
errorStatus
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export default function ErrorList({
|
|
17
|
+
help,
|
|
18
|
+
helpStatus,
|
|
19
|
+
errors = EMPTY_LIST,
|
|
20
|
+
warnings = EMPTY_LIST,
|
|
21
|
+
className: rootClassName,
|
|
22
|
+
fieldId,
|
|
23
|
+
onVisibleChanged
|
|
24
|
+
}) {
|
|
25
|
+
const {
|
|
26
|
+
prefixCls
|
|
27
|
+
} = React.useContext(FormItemPrefixContext);
|
|
28
|
+
// TODO
|
|
29
|
+
// @ts-ignore
|
|
30
|
+
const {
|
|
31
|
+
getPrefixCls
|
|
32
|
+
} = React.useContext(ConfigContext);
|
|
33
|
+
const baseClassName = `${prefixCls}-item-explain`;
|
|
34
|
+
// TODO:
|
|
35
|
+
// @ts-ignore
|
|
36
|
+
const rootPrefixCls = getPrefixCls();
|
|
37
|
+
// We have to debounce here again since somewhere use ErrorList directly still need no shaking
|
|
38
|
+
// ref: https://github.com/ant-design/ant-design/issues/36336
|
|
39
|
+
const debounceErrors = useDebounce(errors);
|
|
40
|
+
const debounceWarnings = useDebounce(warnings);
|
|
41
|
+
const fullKeyList = React.useMemo(() => {
|
|
42
|
+
if (help !== undefined && help !== null) {
|
|
43
|
+
return [toErrorEntity(help, helpStatus, 'help')];
|
|
44
|
+
}
|
|
45
|
+
return [...debounceErrors.map((error, index) => toErrorEntity(error, 'error', 'error', index)), ...debounceWarnings.map((warning, index) => toErrorEntity(warning, 'warning', 'warning', index))];
|
|
46
|
+
}, [help, helpStatus, debounceErrors, debounceWarnings]);
|
|
47
|
+
const helpProps = {};
|
|
48
|
+
if (fieldId) {
|
|
49
|
+
helpProps.id = `${fieldId}_help`;
|
|
50
|
+
}
|
|
51
|
+
return React.createElement(CSSMotion, {
|
|
52
|
+
motionDeadline: collapseMotion.motionDeadline,
|
|
53
|
+
motionName: `${rootPrefixCls}-show-help`,
|
|
54
|
+
visible: !!fullKeyList.length,
|
|
55
|
+
onVisibleChanged: onVisibleChanged
|
|
56
|
+
}, holderProps => {
|
|
57
|
+
const {
|
|
58
|
+
className: holderClassName,
|
|
59
|
+
style: holderStyle
|
|
60
|
+
} = holderProps;
|
|
61
|
+
return React.createElement("div", Object.assign({}, helpProps, {
|
|
62
|
+
className: classNames(baseClassName, holderClassName, rootClassName),
|
|
63
|
+
style: holderStyle,
|
|
64
|
+
role: "alert"
|
|
65
|
+
}), React.createElement(CSSMotionList, Object.assign({
|
|
66
|
+
keys: fullKeyList
|
|
67
|
+
}, collapseMotion, {
|
|
68
|
+
motionName: `${rootPrefixCls}-show-help-item`,
|
|
69
|
+
component: false
|
|
70
|
+
}), itemProps => {
|
|
71
|
+
const {
|
|
72
|
+
key,
|
|
73
|
+
error,
|
|
74
|
+
errorStatus,
|
|
75
|
+
className: itemClassName,
|
|
76
|
+
style: itemStyle
|
|
77
|
+
} = itemProps;
|
|
78
|
+
return React.createElement("div", {
|
|
79
|
+
key: key,
|
|
80
|
+
className: classNames(itemClassName, {
|
|
81
|
+
[`${baseClassName}-${errorStatus}`]: errorStatus
|
|
82
|
+
}),
|
|
83
|
+
style: itemStyle
|
|
84
|
+
}, error);
|
|
85
|
+
}));
|
|
86
|
+
});
|
|
87
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ErrorList.js","sourceRoot":"","sources":["../../src/tntd-form/ErrorList.tsx"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,YAAY,CAAA;AACnC,OAAO,SAAS,EAAE,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AACpD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,cAAc,MAAM,gBAAgB,CAAA;AAC3C,OAAO,EAAE,q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aAAa,EAAE;wBACnC,CAAC,GAAG,aAAa,IAAI,WAAW,EAAE,CAAC,EAAE,WAAW;qBACjD,CAAC,EACF,KAAK,EAAE,SAAS,IAEf,KAAK,CACF,CACP,CAAA;YACH,CAAC,CACa,CACZ,CACP,CAAA;IACH,CAAC,CACS,CACb,CAAA;AACH,CAAC","sourcesContent":["import classNames from 'classnames'\nimport CSSMotion, { CSSMotionList } from 'rc-motion'\nimport * as React from 'react'\nimport { ConfigContext } from '../config-provider'\nimport collapseMotion from './_util/motion'\nimport { FormItemPrefixContext } from './context'\nimport useDebounce from './hooks/useDebounce'\nimport type { ValidateStatus } from './FormItem'\n\nconst EMPTY_LIST: React.ReactNode[] = []\n\ninterface ErrorEntity {\n error: React.ReactNode\n errorStatus?: ValidateStatus\n key: string\n}\n\nfunction toErrorEntity(\n error: React.ReactNode,\n errorStatus: ValidateStatus | undefined,\n prefix: string,\n index: number = 0\n): ErrorEntity {\n return {\n key: typeof error === 'string' ? error : `${prefix}-${index}`,\n error,\n errorStatus,\n }\n}\n\nexport interface ErrorListProps {\n fieldId?: string\n help?: React.ReactNode\n helpStatus?: ValidateStatus\n errors?: React.ReactNode[]\n warnings?: React.ReactNode[]\n className?: string\n onVisibleChanged?: (visible: boolean) => void\n}\n\nexport default function ErrorList({\n help,\n helpStatus,\n errors = EMPTY_LIST,\n warnings = EMPTY_LIST,\n className: rootClassName,\n fieldId,\n onVisibleChanged,\n}: ErrorListProps) {\n const { prefixCls } = React.useContext(FormItemPrefixContext)\n // TODO\n // @ts-ignore\n const { getPrefixCls } = React.useContext(ConfigContext)\n\n const baseClassName = `${prefixCls}-item-explain`\n // TODO:\n // @ts-ignore\n const rootPrefixCls = getPrefixCls()\n\n // We have to debounce here again since somewhere use ErrorList directly still need no shaking\n // ref: https://github.com/ant-design/ant-design/issues/36336\n const debounceErrors = useDebounce(errors)\n const debounceWarnings = useDebounce(warnings)\n\n const fullKeyList = React.useMemo(() => {\n if (help !== undefined && help !== null) {\n return [toErrorEntity(help, helpStatus, 'help')]\n }\n\n return [\n ...debounceErrors.map((error, index) => toErrorEntity(error, 'error', 'error', index)),\n ...debounceWarnings.map((warning, index) =>\n toErrorEntity(warning, 'warning', 'warning', index)\n ),\n ]\n }, [help, helpStatus, debounceErrors, debounceWarnings])\n\n const helpProps: { id?: string } = {}\n\n if (fieldId) {\n helpProps.id = `${fieldId}_help`\n }\n\n return (\n <CSSMotion\n motionDeadline={collapseMotion.motionDeadline}\n motionName={`${rootPrefixCls}-show-help`}\n visible={!!fullKeyList.length}\n onVisibleChanged={onVisibleChanged}\n >\n {(holderProps) => {\n const { className: holderClassName, style: holderStyle } = holderProps\n\n return (\n <div\n {...helpProps}\n className={classNames(baseClassName, holderClassName, rootClassName)}\n style={holderStyle}\n role=\"alert\"\n >\n <CSSMotionList\n keys={fullKeyList}\n {...collapseMotion}\n motionName={`${rootPrefixCls}-show-help-item`}\n component={false}\n >\n {(itemProps) => {\n const {\n key,\n error,\n errorStatus,\n className: itemClassName,\n style: itemStyle,\n } = itemProps\n\n return (\n <div\n key={key}\n className={classNames(itemClassName, {\n [`${baseClassName}-${errorStatus}`]: errorStatus,\n })}\n style={itemStyle}\n >\n {error}\n </div>\n )\n }}\n </CSSMotionList>\n </div>\n )\n }}\n </CSSMotion>\n )\n}\n"]}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
var __rest = this && this.__rest || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
4
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
5
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
6
|
+
}
|
|
7
|
+
return t;
|
|
8
|
+
};
|
|
9
|
+
import classNames from 'classnames';
|
|
10
|
+
import FieldForm, { List, useWatch } from 'rc-field-form';
|
|
11
|
+
import * as React from 'react';
|
|
12
|
+
import { useMemo } from 'react';
|
|
13
|
+
import { ConfigContext } from '../config-provider';
|
|
14
|
+
import DisabledContext, { DisabledContextProvider } from '../config-provider/DisabledContext';
|
|
15
|
+
import SizeContext, { SizeContextProvider } from '../config-provider/SizeContext';
|
|
16
|
+
import { FormContext, FormProvider } from './context';
|
|
17
|
+
import ValidateMessagesContext from './validateMessagesContext';
|
|
18
|
+
import useForm from './hooks/useForm';
|
|
19
|
+
const InternalForm = (props, ref) => {
|
|
20
|
+
const contextSize = React.useContext(SizeContext);
|
|
21
|
+
const contextDisabled = React.useContext(DisabledContext);
|
|
22
|
+
// TODO
|
|
23
|
+
// @ts-ignore
|
|
24
|
+
const {
|
|
25
|
+
getPrefixCls,
|
|
26
|
+
direction,
|
|
27
|
+
form: contextForm
|
|
28
|
+
} = React.useContext(ConfigContext);
|
|
29
|
+
const {
|
|
30
|
+
prefixCls: customizePrefixCls,
|
|
31
|
+
className = '',
|
|
32
|
+
size = contextSize,
|
|
33
|
+
disabled = contextDisabled,
|
|
34
|
+
form,
|
|
35
|
+
colon,
|
|
36
|
+
labelAlign,
|
|
37
|
+
labelWrap,
|
|
38
|
+
labelCol,
|
|
39
|
+
wrapperCol,
|
|
40
|
+
hideRequiredMark,
|
|
41
|
+
layout = 'horizontal',
|
|
42
|
+
scrollToFirstError,
|
|
43
|
+
requiredMark,
|
|
44
|
+
onFinishFailed,
|
|
45
|
+
name,
|
|
46
|
+
readonly
|
|
47
|
+
} = props,
|
|
48
|
+
restFormProps = __rest(props, ["prefixCls", "className", "size", "disabled", "form", "colon", "labelAlign", "labelWrap", "labelCol", "wrapperCol", "hideRequiredMark", "layout", "scrollToFirstError", "requiredMark", "onFinishFailed", "name", "readonly"]);
|
|
49
|
+
const contextValidateMessages = React.useContext(ValidateMessagesContext);
|
|
50
|
+
const mergedRequiredMark = useMemo(() => {
|
|
51
|
+
if (requiredMark !== undefined) {
|
|
52
|
+
return requiredMark;
|
|
53
|
+
}
|
|
54
|
+
if (contextForm && contextForm.requiredMark !== undefined) {
|
|
55
|
+
return contextForm.requiredMark;
|
|
56
|
+
}
|
|
57
|
+
if (hideRequiredMark) {
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
return true;
|
|
61
|
+
}, [hideRequiredMark, requiredMark, contextForm]);
|
|
62
|
+
const mergedColon = colon !== null && colon !== void 0 ? colon : contextForm === null || contextForm === void 0 ? void 0 : contextForm.colon;
|
|
63
|
+
const prefixCls = getPrefixCls('form', customizePrefixCls);
|
|
64
|
+
const formClassName = classNames(prefixCls, {
|
|
65
|
+
[`${prefixCls}-tntd`]: true,
|
|
66
|
+
[`${prefixCls}-${layout}`]: true,
|
|
67
|
+
[`${prefixCls}-hide-required-mark`]: mergedRequiredMark === false,
|
|
68
|
+
[`${prefixCls}-rtl`]: direction === 'rtl',
|
|
69
|
+
[`${prefixCls}-${size}`]: size
|
|
70
|
+
}, className);
|
|
71
|
+
const [wrapForm] = useForm(form);
|
|
72
|
+
const {
|
|
73
|
+
__INTERNAL__
|
|
74
|
+
} = wrapForm;
|
|
75
|
+
__INTERNAL__.name = name;
|
|
76
|
+
const formContextValue = useMemo(() => ({
|
|
77
|
+
name,
|
|
78
|
+
labelAlign,
|
|
79
|
+
labelCol,
|
|
80
|
+
labelWrap,
|
|
81
|
+
wrapperCol,
|
|
82
|
+
vertical: layout === 'vertical',
|
|
83
|
+
colon: mergedColon,
|
|
84
|
+
requiredMark: mergedRequiredMark,
|
|
85
|
+
itemRef: __INTERNAL__.itemRef,
|
|
86
|
+
form: wrapForm,
|
|
87
|
+
readonly
|
|
88
|
+
}), [name, labelAlign, labelCol, labelWrap, wrapperCol, layout, mergedColon, mergedRequiredMark, wrapForm, readonly]);
|
|
89
|
+
React.useImperativeHandle(ref, () => wrapForm);
|
|
90
|
+
const onInternalFinishFailed = errorInfo => {
|
|
91
|
+
onFinishFailed === null || onFinishFailed === void 0 ? void 0 : onFinishFailed(errorInfo);
|
|
92
|
+
let defaultScrollToFirstError = {
|
|
93
|
+
block: 'nearest'
|
|
94
|
+
};
|
|
95
|
+
if (scrollToFirstError && errorInfo.errorFields.length) {
|
|
96
|
+
if (typeof scrollToFirstError === 'object') {
|
|
97
|
+
defaultScrollToFirstError = scrollToFirstError;
|
|
98
|
+
}
|
|
99
|
+
wrapForm.scrollToField(errorInfo.errorFields[0].name, defaultScrollToFirstError);
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
return React.createElement(DisabledContextProvider, {
|
|
103
|
+
disabled: disabled
|
|
104
|
+
}, React.createElement(SizeContextProvider, {
|
|
105
|
+
size: size
|
|
106
|
+
}, React.createElement(FormProvider, Object.assign({}, {
|
|
107
|
+
// This is not list in API, we pass with spread
|
|
108
|
+
validateMessages: contextValidateMessages
|
|
109
|
+
}), React.createElement(FormContext.Provider, {
|
|
110
|
+
value: formContextValue
|
|
111
|
+
}, React.createElement(FieldForm, Object.assign({
|
|
112
|
+
id: name
|
|
113
|
+
}, restFormProps, {
|
|
114
|
+
name: name,
|
|
115
|
+
onFinishFailed: onInternalFinishFailed,
|
|
116
|
+
form: wrapForm,
|
|
117
|
+
className: formClassName
|
|
118
|
+
}))))));
|
|
119
|
+
};
|
|
120
|
+
const Form = React.forwardRef(InternalForm);
|
|
121
|
+
export { useForm, List, useWatch };
|
|
122
|
+
export default Form;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Form.js","sourceRoot":"","sources":["../../src/tntd-form/Form.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,UAAU,MAAM,YAAY,CAAA;AACnC,OAAO,SAAS,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAGzD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAE/B,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB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esContent":["import classNames from 'classnames'\nimport FieldForm, { List, useWatch } from 'rc-field-form'\nimport type { FormProps as RcFormProps } from 'rc-field-form/lib/Form'\nimport type { ValidateErrorEntity } from 'rc-field-form/lib/interface'\nimport * as React from 'react'\nimport { useMemo } from 'react'\nimport type { Options } from 'scroll-into-view-if-needed'\nimport { ConfigContext } from '../config-provider'\nimport DisabledContext, { DisabledContextProvider } from '../config-provider/DisabledContext'\nimport type { SizeType } from '../config-provider/SizeContext'\nimport SizeContext, { SizeContextProvider } from '../config-provider/SizeContext'\nimport type { ColProps } from '../col'\nimport type { FormContextProps } from './context'\nimport { FormContext, FormProvider } from './context'\nimport ValidateMessagesContext from './validateMessagesContext'\nimport useForm, { FormInstance } from './hooks/useForm'\nimport type { FormLabelAlign } from './interface'\n\nexport type RequiredMark = boolean | 'optional'\nexport type FormLayout = 'horizontal' | 'inline' | 'vertical'\n\nexport interface FormProps<Values = any> extends Omit<RcFormProps<Values>, 'form'> {\n prefixCls?: string\n colon?: boolean\n name?: string\n layout?: FormLayout\n labelAlign?: FormLabelAlign\n labelWrap?: boolean\n labelCol?: ColProps\n wrapperCol?: ColProps\n form?: FormInstance<Values>\n size?: SizeType\n disabled?: boolean\n readonly?: boolean\n scrollToFirstError?: Options | boolean\n requiredMark?: RequiredMark\n /** @deprecated Will warning in future branch. Pls use `requiredMark` instead. */\n hideRequiredMark?: boolean\n}\n\nconst InternalForm: React.ForwardRefRenderFunction<FormInstance, FormProps> = (props, ref) => {\n const contextSize = React.useContext(SizeContext)\n const contextDisabled = React.useContext(DisabledContext)\n // TODO\n // @ts-ignore\n const { getPrefixCls, direction, form: contextForm } = React.useContext(ConfigContext)\n\n const {\n prefixCls: customizePrefixCls,\n className = '',\n size = contextSize,\n disabled = contextDisabled,\n form,\n colon,\n labelAlign,\n labelWrap,\n labelCol,\n wrapperCol,\n hideRequiredMark,\n layout = 'horizontal',\n scrollToFirstError,\n requiredMark,\n onFinishFailed,\n name,\n readonly,\n ...restFormProps\n } = props\n\n const contextValidateMessages = React.useContext(ValidateMessagesContext)\n\n const mergedRequiredMark = useMemo(() => {\n if (requiredMark !== undefined) {\n return requiredMark\n }\n\n if (contextForm && contextForm.requiredMark !== undefined) {\n return contextForm.requiredMark\n }\n\n if (hideRequiredMark) {\n return false\n }\n\n return true\n }, [hideRequiredMark, requiredMark, contextForm])\n\n const mergedColon = colon ?? contextForm?.colon\n\n const prefixCls = getPrefixCls('form', customizePrefixCls)\n\n const formClassName = classNames(\n prefixCls,\n {\n [`${prefixCls}-tntd`]: true,\n [`${prefixCls}-${layout}`]: true,\n [`${prefixCls}-hide-required-mark`]: mergedRequiredMark === false,\n [`${prefixCls}-rtl`]: direction === 'rtl',\n [`${prefixCls}-${size}`]: size,\n },\n className\n )\n\n const [wrapForm] = useForm(form)\n const { __INTERNAL__ } = wrapForm\n __INTERNAL__.name = name\n\n const formContextValue = useMemo<FormContextProps>(\n () => ({\n name,\n labelAlign,\n labelCol,\n labelWrap,\n wrapperCol,\n vertical: layout === 'vertical',\n colon: mergedColon,\n requiredMark: mergedRequiredMark,\n itemRef: __INTERNAL__.itemRef,\n form: wrapForm,\n readonly,\n }),\n [\n name,\n labelAlign,\n labelCol,\n labelWrap,\n wrapperCol,\n layout,\n mergedColon,\n mergedRequiredMark,\n wrapForm,\n readonly,\n ]\n )\n\n React.useImperativeHandle(ref, () => wrapForm)\n\n const onInternalFinishFailed = (errorInfo: ValidateErrorEntity) => {\n onFinishFailed?.(errorInfo)\n\n let defaultScrollToFirstError: Options = { block: 'nearest' }\n\n if (scrollToFirstError && errorInfo.errorFields.length) {\n if (typeof scrollToFirstError === 'object') {\n defaultScrollToFirstError = scrollToFirstError\n }\n wrapForm.scrollToField(errorInfo.errorFields[0].name, defaultScrollToFirstError)\n }\n }\n\n return (\n <DisabledContextProvider disabled={disabled}>\n <SizeContextProvider size={size}>\n <FormProvider\n {...{\n // This is not list in API, we pass with spread\n validateMessages: contextValidateMessages,\n }}\n >\n <FormContext.Provider value={formContextValue}>\n <FieldForm\n id={name}\n {...restFormProps}\n name={name}\n onFinishFailed={onInternalFinishFailed}\n form={wrapForm}\n className={formClassName}\n />\n </FormContext.Provider>\n </FormProvider>\n </SizeContextProvider>\n </DisabledContextProvider>\n )\n}\n\nconst Form = React.forwardRef<FormInstance, FormProps>(InternalForm) as <Values = any>(\n props: React.PropsWithChildren<FormProps<Values>> & { ref?: React.Ref<FormInstance<Values>> }\n) => React.ReactElement\n\nexport { useForm, List, FormInstance, useWatch }\n\nexport default Form\n"]}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
var __rest = this && this.__rest || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
4
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
5
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
6
|
+
}
|
|
7
|
+
return t;
|
|
8
|
+
};
|
|
9
|
+
import useLayoutEffect from 'rc-util/lib/hooks/useLayoutEffect';
|
|
10
|
+
import classNames from 'classnames';
|
|
11
|
+
import * as React from 'react';
|
|
12
|
+
import omit from 'rc-util/lib/omit';
|
|
13
|
+
import Row from '../../row';
|
|
14
|
+
import FormItemLabel from '../FormItemLabel';
|
|
15
|
+
import FormItemInput from '../FormItemInput';
|
|
16
|
+
import { FormContext, FormItemInputContext, NoStyleItemContext } from '../context';
|
|
17
|
+
import useDebounce from '../hooks/useDebounce';
|
|
18
|
+
import Icon from '../../icon';
|
|
19
|
+
const iconMap = {
|
|
20
|
+
success: () => React.createElement(Icon, {
|
|
21
|
+
type: "check-circle"
|
|
22
|
+
}),
|
|
23
|
+
warning: () => React.createElement(Icon, {
|
|
24
|
+
type: "exclamation-circle"
|
|
25
|
+
}),
|
|
26
|
+
error: () => React.createElement(Icon, {
|
|
27
|
+
type: "close-circle"
|
|
28
|
+
}),
|
|
29
|
+
validating: () => React.createElement(Icon, {
|
|
30
|
+
type: "loading"
|
|
31
|
+
})
|
|
32
|
+
};
|
|
33
|
+
export default function ItemHolder(props) {
|
|
34
|
+
const {
|
|
35
|
+
prefixCls,
|
|
36
|
+
className,
|
|
37
|
+
style,
|
|
38
|
+
help,
|
|
39
|
+
errors,
|
|
40
|
+
warnings,
|
|
41
|
+
validateStatus,
|
|
42
|
+
meta,
|
|
43
|
+
hasFeedback,
|
|
44
|
+
hidden,
|
|
45
|
+
children,
|
|
46
|
+
fieldId,
|
|
47
|
+
isRequired,
|
|
48
|
+
onSubItemMetaChange
|
|
49
|
+
} = props,
|
|
50
|
+
restProps = __rest(props, ["prefixCls", "className", "style", "help", "errors", "warnings", "validateStatus", "meta", "hasFeedback", "hidden", "children", "fieldId", "isRequired", "onSubItemMetaChange"]);
|
|
51
|
+
const itemPrefixCls = `${prefixCls}-item`;
|
|
52
|
+
const {
|
|
53
|
+
requiredMark
|
|
54
|
+
} = React.useContext(FormContext);
|
|
55
|
+
// ======================== Margin ========================
|
|
56
|
+
const itemRef = React.useRef(null);
|
|
57
|
+
const debounceErrors = useDebounce(errors);
|
|
58
|
+
const debounceWarnings = useDebounce(warnings);
|
|
59
|
+
const hasHelp = help !== undefined && help !== null;
|
|
60
|
+
const hasError = !!(hasHelp || errors.length || warnings.length);
|
|
61
|
+
const [marginBottom, setMarginBottom] = React.useState(null);
|
|
62
|
+
useLayoutEffect(() => {
|
|
63
|
+
if (hasError && itemRef.current) {
|
|
64
|
+
const itemStyle = getComputedStyle(itemRef.current);
|
|
65
|
+
setMarginBottom(parseInt(itemStyle.marginBottom, 10));
|
|
66
|
+
}
|
|
67
|
+
}, [hasError]);
|
|
68
|
+
const onErrorVisibleChanged = nextVisible => {
|
|
69
|
+
if (!nextVisible) {
|
|
70
|
+
setMarginBottom(null);
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
// ======================== Status ========================
|
|
74
|
+
let mergedValidateStatus = '';
|
|
75
|
+
if (validateStatus !== undefined) {
|
|
76
|
+
mergedValidateStatus = validateStatus;
|
|
77
|
+
} else if (meta.validating) {
|
|
78
|
+
mergedValidateStatus = 'validating';
|
|
79
|
+
} else if (debounceErrors.length) {
|
|
80
|
+
mergedValidateStatus = 'error';
|
|
81
|
+
} else if (debounceWarnings.length) {
|
|
82
|
+
mergedValidateStatus = 'warning';
|
|
83
|
+
} else if (meta.touched) {
|
|
84
|
+
mergedValidateStatus = 'success';
|
|
85
|
+
}
|
|
86
|
+
const formItemStatusContext = React.useMemo(() => {
|
|
87
|
+
let feedbackIcon;
|
|
88
|
+
if (hasFeedback) {
|
|
89
|
+
const IconNode = mergedValidateStatus && iconMap[mergedValidateStatus];
|
|
90
|
+
feedbackIcon = IconNode ? React.createElement("span", {
|
|
91
|
+
className: classNames(`${itemPrefixCls}-feedback-icon`, `${itemPrefixCls}-feedback-icon-${mergedValidateStatus}`)
|
|
92
|
+
}, React.createElement(IconNode, null)) : null;
|
|
93
|
+
}
|
|
94
|
+
return {
|
|
95
|
+
status: mergedValidateStatus,
|
|
96
|
+
hasFeedback,
|
|
97
|
+
feedbackIcon,
|
|
98
|
+
isFormItemInput: true
|
|
99
|
+
};
|
|
100
|
+
}, [mergedValidateStatus, hasFeedback]);
|
|
101
|
+
// ======================== Render ========================
|
|
102
|
+
const itemClassName = {
|
|
103
|
+
[itemPrefixCls]: true,
|
|
104
|
+
[`${itemPrefixCls}-with-help`]: hasHelp || debounceErrors.length || debounceWarnings.length,
|
|
105
|
+
[`${className}`]: !!className,
|
|
106
|
+
// Status
|
|
107
|
+
[`${itemPrefixCls}-has-feedback has-feedback`]: mergedValidateStatus && hasFeedback,
|
|
108
|
+
[`${itemPrefixCls}-has-success has-success`]: mergedValidateStatus === 'success',
|
|
109
|
+
[`${itemPrefixCls}-has-warning has-warning`]: mergedValidateStatus === 'warning',
|
|
110
|
+
[`${itemPrefixCls}-has-error has-error`]: mergedValidateStatus === 'error',
|
|
111
|
+
[`${itemPrefixCls}-is-validating is-validating`]: mergedValidateStatus === 'validating',
|
|
112
|
+
[`${itemPrefixCls}-hidden hidden`]: hidden
|
|
113
|
+
};
|
|
114
|
+
return React.createElement("div", {
|
|
115
|
+
className: classNames(itemClassName),
|
|
116
|
+
style: style,
|
|
117
|
+
ref: itemRef
|
|
118
|
+
}, React.createElement(Row, Object.assign({
|
|
119
|
+
className: `${itemPrefixCls}-row`
|
|
120
|
+
}, omit(restProps, ['_internalItemRender', 'colon', 'dependencies', 'extra', 'fieldKey', 'getValueFromEvent', 'getValueProps', 'htmlFor', 'id', 'initialValue', 'isListField', 'label', 'labelAlign', 'labelCol', 'labelWrap', 'messageVariables', 'name', 'normalize', 'noStyle', 'preserve', 'required', 'requiredMark', 'rules', 'shouldUpdate', 'trigger', 'tooltip', 'validateFirst', 'validateTrigger', 'valuePropName', 'wrapperCol'])), React.createElement(FormItemLabel, Object.assign({
|
|
121
|
+
htmlFor: fieldId,
|
|
122
|
+
required: isRequired,
|
|
123
|
+
requiredMark: requiredMark
|
|
124
|
+
}, props, {
|
|
125
|
+
prefixCls: prefixCls
|
|
126
|
+
})), React.createElement(FormItemInput, Object.assign({}, props, meta, {
|
|
127
|
+
errors: debounceErrors,
|
|
128
|
+
warnings: debounceWarnings,
|
|
129
|
+
prefixCls: prefixCls,
|
|
130
|
+
status: mergedValidateStatus,
|
|
131
|
+
help: help,
|
|
132
|
+
marginBottom: marginBottom,
|
|
133
|
+
onErrorVisibleChanged: onErrorVisibleChanged
|
|
134
|
+
}), React.createElement(NoStyleItemContext.Provider, {
|
|
135
|
+
value: onSubItemMetaChange
|
|
136
|
+
}, React.createElement(FormItemInputContext.Provider, {
|
|
137
|
+
value: formItemStatusContext
|
|
138
|
+
}, children)))), !!marginBottom && React.createElement("div", {
|
|
139
|
+
className: `${itemPrefixCls}-margin-offset`,
|
|
140
|
+
style: {
|
|
141
|
+
marginBottom: -marginB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EAAE,qBAAqB,IACxD,QAAQ,CACqB,CACJ,CAChB,CACZ;QAEL,CAAC,CAAC,YAAY,IAAI,CACjB,6BACE,SAAS,EAAE,GAAG,aAAa,gBAAgB,EAC3C,KAAK,EAAE;gBACL,YAAY,EAAE,CAAC,YAAY;aAC5B,GACD,CACH,CACG,CACP,CAAA;AACH,CAAC","sourcesContent":["import useLayoutEffect from 'rc-util/lib/hooks/useLayoutEffect'\nimport classNames from 'classnames'\nimport * as React from 'react'\nimport omit from 'rc-util/lib/omit'\nimport type { Meta } from 'rc-field-form/lib/interface'\nimport Row from '../../row'\nimport FormItemLabel from '../FormItemLabel'\nimport FormItemInput from '../FormItemInput'\nimport type { FormItemStatusContextProps, ReportMetaChange } from '../context'\nimport { FormContext, FormItemInputContext, NoStyleItemContext } from '../context'\nimport type { FormItemProps, ValidateStatus } from '.'\nimport useDebounce from '../hooks/useDebounce'\nimport Icon from '../../icon'\n\nconst iconMap = {\n success: () => <Icon type=\"check-circle\" />,\n warning: () => <Icon type=\"exclamation-circle\" />,\n error: () => <Icon type=\"close-circle\" />,\n validating: () => <Icon type=\"loading\" />,\n}\n\nexport interface ItemHolderProps extends FormItemProps {\n prefixCls: string\n className?: string\n style?: React.CSSProperties\n errors: React.ReactNode[]\n warnings: React.ReactNode[]\n meta: Meta\n children?: React.ReactNode\n fieldId?: string\n isRequired?: boolean\n onSubItemMetaChange: ReportMetaChange\n}\n\nexport default function ItemHolder(props: ItemHolderProps) {\n const {\n prefixCls,\n className,\n style,\n help,\n errors,\n warnings,\n validateStatus,\n meta,\n hasFeedback,\n hidden,\n children,\n fieldId,\n isRequired,\n onSubItemMetaChange,\n ...restProps\n } = props\n\n const itemPrefixCls = `${prefixCls}-item`\n const { requiredMark } = React.useContext(FormContext)\n\n // ======================== Margin ========================\n const itemRef = React.useRef<HTMLDivElement>(null)\n const debounceErrors = useDebounce(errors)\n const debounceWarnings = useDebounce(warnings)\n const hasHelp = help !== undefined && help !== null\n const hasError = !!(hasHelp || errors.length || warnings.length)\n const [marginBottom, setMarginBottom] = React.useState<number | null>(null)\n\n useLayoutEffect(() => {\n if (hasError && itemRef.current) {\n const itemStyle = getComputedStyle(itemRef.current)\n setMarginBottom(parseInt(itemStyle.marginBottom, 10))\n }\n }, [hasError])\n\n const onErrorVisibleChanged = (nextVisible: boolean) => {\n if (!nextVisible) {\n setMarginBottom(null)\n }\n }\n\n // ======================== Status ========================\n let mergedValidateStatus: ValidateStatus = ''\n if (validateStatus !== undefined) {\n mergedValidateStatus = validateStatus\n } else if (meta.validating) {\n mergedValidateStatus = 'validating'\n } else if (debounceErrors.length) {\n mergedValidateStatus = 'error'\n } else if (debounceWarnings.length) {\n mergedValidateStatus = 'warning'\n } else if (meta.touched) {\n mergedValidateStatus = 'success'\n }\n\n const formItemStatusContext = React.useMemo<FormItemStatusContextProps>(() => {\n let feedbackIcon: React.ReactNode\n if (hasFeedback) {\n const IconNode = mergedValidateStatus && iconMap[mergedValidateStatus]\n feedbackIcon = IconNode ? (\n <span\n className={classNames(\n `${itemPrefixCls}-feedback-icon`,\n `${itemPrefixCls}-feedback-icon-${mergedValidateStatus}`\n )}\n >\n <IconNode />\n </span>\n ) : null\n }\n\n return {\n status: mergedValidateStatus,\n hasFeedback,\n feedbackIcon,\n isFormItemInput: true,\n }\n }, [mergedValidateStatus, hasFeedback])\n\n // ======================== Render ========================\n const itemClassName = {\n [itemPrefixCls]: true,\n [`${itemPrefixCls}-with-help`]: hasHelp || debounceErrors.length || debounceWarnings.length,\n [`${className}`]: !!className,\n\n // Status\n [`${itemPrefixCls}-has-feedback has-feedback`]: mergedValidateStatus && hasFeedback,\n [`${itemPrefixCls}-has-success has-success`]: mergedValidateStatus === 'success',\n [`${itemPrefixCls}-has-warning has-warning`]: mergedValidateStatus === 'warning',\n [`${itemPrefixCls}-has-error has-error`]: mergedValidateStatus === 'error',\n [`${itemPrefixCls}-is-validating is-validating`]: mergedValidateStatus === 'validating',\n [`${itemPrefixCls}-hidden hidden`]: hidden,\n }\n\n return (\n <div className={classNames(itemClassName)} style={style} ref={itemRef}>\n <Row\n className={`${itemPrefixCls}-row`}\n {...omit(restProps, [\n '_internalItemRender' as any,\n 'colon',\n 'dependencies',\n 'extra',\n 'fieldKey',\n 'getValueFromEvent',\n 'getValueProps',\n 'htmlFor',\n 'id', // It is deprecated because `htmlFor` is its replacement.\n 'initialValue',\n 'isListField',\n 'label',\n 'labelAlign',\n 'labelCol',\n 'labelWrap',\n 'messageVariables',\n 'name',\n 'normalize',\n 'noStyle',\n 'preserve',\n 'required',\n 'requiredMark',\n 'rules',\n 'shouldUpdate',\n 'trigger',\n 'tooltip',\n 'validateFirst',\n 'validateTrigger',\n 'valuePropName',\n 'wrapperCol',\n ])}\n >\n {/* Label */}\n <FormItemLabel\n htmlFor={fieldId}\n required={isRequired}\n requiredMark={requiredMark}\n {...props}\n prefixCls={prefixCls}\n />\n {/* Input Group */}\n <FormItemInput\n {...props}\n {...meta}\n errors={debounceErrors}\n warnings={debounceWarnings}\n prefixCls={prefixCls}\n status={mergedValidateStatus}\n help={help}\n marginBottom={marginBottom}\n onErrorVisibleChanged={onErrorVisibleChanged}\n >\n <NoStyleItemContext.Provider value={onSubItemMetaChange}>\n <FormItemInputContext.Provider value={formItemStatusContext}>\n {children}\n </FormItemInputContext.Provider>\n </NoStyleItemContext.Provider>\n </FormItemInput>\n </Row>\n\n {!!marginBottom && (\n <div\n className={`${itemPrefixCls}-margin-offset`}\n style={{\n marginBottom: -marginBottom,\n }}\n />\n )}\n </div>\n )\n}\n"]}
|