@hw-component/form 0.0.5 → 0.0.6-beta-v2
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/es/CheckboxGroup/CheckBox/index.d.ts +2 -5
- package/es/CheckboxGroup/CheckBox/index.js +16 -10
- package/es/CheckboxGroup/hooks.d.ts +1 -1
- package/es/CheckboxGroup/hooks.js +33 -37
- package/es/CheckboxGroup/index.d.ts +2 -3
- package/es/CheckboxGroup/index.js +71 -27
- package/es/CheckboxGroup/modal.d.ts +13 -0
- package/es/DialogForm/DrawerForm/Footer.d.ts +7 -0
- package/es/DialogForm/DrawerForm/Footer.js +27 -0
- package/es/DialogForm/DrawerForm/Title.d.ts +3 -0
- package/es/DialogForm/DrawerForm/Title.js +21 -0
- package/es/DialogForm/DrawerForm/index.d.ts +3 -0
- package/es/DialogForm/DrawerForm/index.js +137 -0
- package/es/DialogForm/ModalForm.d.ts +3 -0
- package/es/DialogForm/ModalForm.js +118 -0
- package/es/DialogForm/hooks.d.ts +16 -0
- package/es/DialogForm/hooks.js +148 -0
- package/es/DialogForm/modal.d.ts +33 -0
- package/es/Form/Context/FormConfigProvider.d.ts +5 -0
- package/es/Form/Context/FormConfigProvider.js +48 -0
- package/es/Form/Context/index.d.ts +5 -0
- package/es/Form/Context/index.js +11 -0
- package/es/Form/FormItem/BasicItem.d.ts +4 -0
- package/es/Form/FormItem/BasicItem.js +92 -0
- package/es/Form/FormItem/Helper.d.ts +7 -0
- package/es/Form/FormItem/Helper.js +26 -0
- package/es/Form/FormItem/RegularFormItem.d.ts +3 -0
- package/es/Form/FormItem/RegularFormItem.js +24 -0
- package/es/Form/FormItem/UpFormItem.d.ts +3 -0
- package/es/Form/FormItem/UpFormItem.js +42 -0
- package/es/Form/FormItem/hooks.d.ts +8 -0
- package/es/Form/FormItem/hooks.js +38 -0
- package/es/Form/FormItem/index.d.ts +3 -0
- package/es/Form/FormItem/index.js +21 -0
- package/es/Form/HFormConnect.d.ts +5 -0
- package/es/Form/HFormConnect.js +68 -0
- package/es/Form/InitSet.d.ts +2 -0
- package/es/Form/InitSet.js +16 -0
- package/es/Form/Label.d.ts +10 -0
- package/es/Form/Label.js +49 -0
- package/es/Form/config.d.ts +29 -0
- package/es/Form/config.js +45 -0
- package/es/Form/hooks/index.d.ts +16 -0
- package/es/Form/hooks/index.js +157 -0
- package/es/Form/hooks/useDefaultRender.d.ts +3 -0
- package/es/Form/hooks/useDefaultRender.js +48 -0
- package/es/Form/hooks/useHForm.d.ts +3 -0
- package/es/Form/hooks/useHForm.js +193 -0
- package/es/Form/hooks/useInitConfigData.d.ts +8 -0
- package/es/Form/hooks/useInitConfigData.js +169 -0
- package/es/Form/index.d.ts +3 -0
- package/es/Form/index.js +102 -0
- package/es/Form/modal.d.ts +123 -0
- package/es/Input/ButtonInput.d.ts +2 -2
- package/es/Input/ButtonInput.js +34 -20
- package/es/Input/ColorInput/Picker.d.ts +3 -0
- package/es/Input/ColorInput/Picker.js +22 -0
- package/es/Input/ColorInput/data.d.ts +1 -0
- package/es/Input/ColorInput/data.js +5 -0
- package/es/Input/ColorInput/index.d.ts +3 -0
- package/es/Input/ColorInput/index.js +99 -0
- package/es/Input/InputNumber.d.ts +0 -1
- package/es/Input/InputNumber.js +17 -8
- package/es/Input/SelectInput.d.ts +2 -1
- package/es/Input/SelectInput.js +51 -23
- package/es/Input/defaultConfig.js +2 -2
- package/es/Input/index.d.ts +0 -1
- package/es/Input/index.js +18 -8
- package/es/Input/modal.d.ts +31 -0
- package/es/PageHandler/ErrorComponent.d.ts +3 -0
- package/es/PageHandler/ErrorComponent.js +38 -0
- package/es/PageHandler/LoadingComponent.d.ts +2 -0
- package/es/PageHandler/LoadingComponent.js +19 -0
- package/es/PageHandler/index.d.ts +4 -0
- package/es/PageHandler/index.js +26 -0
- package/es/PageHandler/modal.d.ts +6 -0
- package/es/RadioGroup/index.d.ts +2 -3
- package/es/RadioGroup/index.js +27 -13
- package/es/Select/components/AllSelect.d.ts +3 -4
- package/es/Select/components/AllSelect.js +37 -20
- package/es/Select/components/CheckBoxOption.js +8 -6
- package/es/Select/components/DropdownComponent.js +18 -13
- package/es/Select/components/NoFindItem.d.ts +0 -1
- package/es/Select/components/NoFindItem.js +7 -6
- package/es/Select/components/NotFoundContent.d.ts +0 -1
- package/es/Select/components/NotFoundContent.js +25 -22
- package/es/Select/defaultConfig.d.ts +0 -1
- package/es/Select/defaultConfig.js +8 -9
- package/es/Select/hooks/changeHooks.js +26 -25
- package/es/Select/hooks/norHooks.d.ts +10 -3
- package/es/Select/hooks/norHooks.js +56 -18
- package/es/Select/index.d.ts +2 -3
- package/es/Select/index.js +65 -37
- package/es/Select/modal.d.ts +9 -1
- package/es/Select/utils.js +14 -16
- package/es/Submit/index.d.ts +9 -0
- package/es/Submit/index.js +54 -0
- package/es/Switch/index.d.ts +4 -3
- package/es/Switch/index.js +37 -19
- package/es/TDPicker/RangePicker.d.ts +8 -0
- package/es/TDPicker/RangePicker.js +125 -0
- package/es/TDPicker/TimePicker.d.ts +3 -0
- package/es/TDPicker/TimePicker.js +44 -0
- package/es/TDPicker/hooks.d.ts +33 -0
- package/es/TDPicker/hooks.js +132 -0
- package/es/TDPicker/index.d.ts +4 -0
- package/es/TDPicker/index.js +47 -0
- package/es/TDPicker/modal.d.ts +35 -0
- package/es/TextArea/index.d.ts +3 -0
- package/es/TextArea/index.js +30 -0
- package/es/Upload/Btn.d.ts +3 -0
- package/es/Upload/Btn.js +36 -0
- package/es/Upload/MediaTypeEle/TypeEle.d.ts +9 -0
- package/es/Upload/MediaTypeEle/TypeEle.js +42 -0
- package/es/Upload/MediaTypeEle/index.d.ts +3 -0
- package/es/Upload/MediaTypeEle/index.js +36 -0
- package/es/Upload/Preview/index.d.ts +5 -0
- package/es/Upload/Preview/index.js +22 -0
- package/es/Upload/UrlUpload/index.d.ts +3 -0
- package/es/Upload/UrlUpload/index.js +133 -0
- package/es/Upload/enums.d.ts +5 -0
- package/es/Upload/enums.js +10 -0
- package/es/Upload/hooks/change.d.ts +3 -0
- package/es/Upload/hooks/change.js +107 -0
- package/es/Upload/hooks/customRequest.d.ts +3 -0
- package/es/Upload/hooks/customRequest.js +131 -0
- package/es/Upload/hooks/propsMaker.d.ts +2 -0
- package/es/Upload/hooks/propsMaker.js +36 -0
- package/es/Upload/index.d.ts +3 -0
- package/es/Upload/index.js +145 -0
- package/es/Upload/modal.d.ts +30 -0
- package/es/Upload/util.d.ts +5 -0
- package/es/Upload/util.js +34 -0
- package/es/config.d.ts +5 -13
- package/es/config.js +57 -10
- package/{lib/hooks/useChangeOptions.d.ts → es/hooks/index.d.ts} +3 -0
- package/es/hooks/index.js +74 -0
- package/es/index.css +42 -1
- package/es/index.d.ts +26 -11
- package/es/index.js +33 -13
- package/es/modal.d.ts +16 -0
- package/lib/CheckboxGroup/CheckBox/index.d.ts +2 -5
- package/lib/CheckboxGroup/CheckBox/index.js +13 -7
- package/lib/CheckboxGroup/hooks.d.ts +1 -1
- package/lib/CheckboxGroup/hooks.js +31 -35
- package/lib/CheckboxGroup/index.d.ts +2 -3
- package/lib/CheckboxGroup/index.js +69 -25
- package/lib/CheckboxGroup/modal.d.ts +13 -0
- package/lib/DialogForm/DrawerForm/Footer.d.ts +7 -0
- package/lib/DialogForm/DrawerForm/Footer.js +30 -0
- package/lib/DialogForm/DrawerForm/Title.d.ts +3 -0
- package/lib/DialogForm/DrawerForm/Title.js +24 -0
- package/lib/DialogForm/DrawerForm/index.d.ts +3 -0
- package/lib/DialogForm/DrawerForm/index.js +140 -0
- package/lib/DialogForm/ModalForm.d.ts +3 -0
- package/lib/DialogForm/ModalForm.js +121 -0
- package/lib/DialogForm/hooks.d.ts +16 -0
- package/lib/DialogForm/hooks.js +152 -0
- package/lib/DialogForm/modal.d.ts +33 -0
- package/lib/Form/Context/FormConfigProvider.d.ts +5 -0
- package/lib/Form/Context/FormConfigProvider.js +52 -0
- package/lib/Form/Context/index.d.ts +5 -0
- package/lib/Form/Context/index.js +14 -0
- package/lib/Form/FormItem/BasicItem.d.ts +4 -0
- package/lib/Form/FormItem/BasicItem.js +95 -0
- package/lib/Form/FormItem/Helper.d.ts +7 -0
- package/lib/Form/FormItem/Helper.js +29 -0
- package/lib/Form/FormItem/RegularFormItem.d.ts +3 -0
- package/lib/Form/FormItem/RegularFormItem.js +27 -0
- package/lib/Form/FormItem/UpFormItem.d.ts +3 -0
- package/lib/Form/FormItem/UpFormItem.js +45 -0
- package/lib/Form/FormItem/hooks.d.ts +8 -0
- package/lib/Form/FormItem/hooks.js +41 -0
- package/lib/Form/FormItem/index.d.ts +3 -0
- package/lib/Form/FormItem/index.js +24 -0
- package/lib/Form/HFormConnect.d.ts +5 -0
- package/lib/Form/HFormConnect.js +71 -0
- package/lib/Form/InitSet.d.ts +2 -0
- package/lib/Form/InitSet.js +19 -0
- package/lib/Form/Label.d.ts +10 -0
- package/lib/Form/Label.js +52 -0
- package/lib/Form/config.d.ts +29 -0
- package/lib/Form/config.js +49 -0
- package/lib/Form/hooks/index.d.ts +16 -0
- package/lib/Form/hooks/index.js +161 -0
- package/lib/Form/hooks/useDefaultRender.d.ts +3 -0
- package/lib/Form/hooks/useDefaultRender.js +49 -0
- package/lib/Form/hooks/useHForm.d.ts +3 -0
- package/lib/Form/hooks/useHForm.js +196 -0
- package/lib/Form/hooks/useInitConfigData.d.ts +8 -0
- package/lib/Form/hooks/useInitConfigData.js +172 -0
- package/lib/Form/index.d.ts +3 -0
- package/lib/Form/index.js +105 -0
- package/lib/Form/modal.d.ts +123 -0
- package/lib/Input/ButtonInput.d.ts +2 -2
- package/lib/Input/ButtonInput.js +32 -18
- package/lib/Input/ColorInput/Picker.d.ts +3 -0
- package/lib/Input/ColorInput/Picker.js +25 -0
- package/lib/Input/ColorInput/data.d.ts +1 -0
- package/lib/Input/ColorInput/data.js +6 -0
- package/lib/Input/ColorInput/index.d.ts +3 -0
- package/lib/Input/ColorInput/index.js +102 -0
- package/lib/Input/InputNumber.d.ts +0 -1
- package/lib/Input/InputNumber.js +14 -5
- package/lib/Input/SelectInput.d.ts +2 -1
- package/lib/Input/SelectInput.js +50 -21
- package/lib/Input/index.d.ts +0 -1
- package/lib/Input/index.js +16 -6
- package/lib/Input/modal.d.ts +31 -0
- package/lib/PageHandler/ErrorComponent.d.ts +3 -0
- package/lib/PageHandler/ErrorComponent.js +41 -0
- package/lib/PageHandler/LoadingComponent.d.ts +2 -0
- package/lib/PageHandler/LoadingComponent.js +22 -0
- package/lib/PageHandler/index.d.ts +4 -0
- package/lib/PageHandler/index.js +29 -0
- package/lib/PageHandler/modal.d.ts +6 -0
- package/lib/RadioGroup/index.d.ts +2 -3
- package/lib/RadioGroup/index.js +25 -11
- package/lib/Select/components/AllSelect.d.ts +3 -4
- package/lib/Select/components/AllSelect.js +35 -18
- package/lib/Select/components/CheckBoxOption.js +6 -4
- package/lib/Select/components/DropdownComponent.js +16 -11
- package/lib/Select/components/NoFindItem.d.ts +0 -1
- package/lib/Select/components/NoFindItem.js +5 -4
- package/lib/Select/components/NotFoundContent.d.ts +0 -1
- package/lib/Select/components/NotFoundContent.js +23 -20
- package/lib/Select/defaultConfig.d.ts +0 -1
- package/lib/Select/defaultConfig.js +6 -7
- package/lib/Select/hooks/changeHooks.js +24 -23
- package/lib/Select/hooks/norHooks.d.ts +10 -3
- package/lib/Select/hooks/norHooks.js +53 -15
- package/lib/Select/index.d.ts +2 -3
- package/lib/Select/index.js +62 -34
- package/lib/Select/modal.d.ts +9 -1
- package/lib/Select/utils.js +12 -14
- package/lib/Submit/index.d.ts +9 -0
- package/lib/Submit/index.js +57 -0
- package/lib/Switch/index.d.ts +4 -3
- package/lib/Switch/index.js +34 -16
- package/lib/TDPicker/RangePicker.d.ts +8 -0
- package/lib/TDPicker/RangePicker.js +128 -0
- package/lib/TDPicker/TimePicker.d.ts +3 -0
- package/lib/TDPicker/TimePicker.js +47 -0
- package/lib/TDPicker/hooks.d.ts +33 -0
- package/lib/TDPicker/hooks.js +139 -0
- package/lib/TDPicker/index.d.ts +4 -0
- package/lib/TDPicker/index.js +50 -0
- package/lib/TDPicker/modal.d.ts +35 -0
- package/lib/TextArea/index.d.ts +3 -0
- package/lib/TextArea/index.js +33 -0
- package/lib/Upload/Btn.d.ts +3 -0
- package/lib/Upload/Btn.js +39 -0
- package/lib/Upload/MediaTypeEle/TypeEle.d.ts +9 -0
- package/lib/Upload/MediaTypeEle/TypeEle.js +45 -0
- package/lib/Upload/MediaTypeEle/index.d.ts +3 -0
- package/lib/Upload/MediaTypeEle/index.js +39 -0
- package/lib/Upload/Preview/index.d.ts +5 -0
- package/lib/Upload/Preview/index.js +25 -0
- package/lib/Upload/UrlUpload/index.d.ts +3 -0
- package/lib/Upload/UrlUpload/index.js +136 -0
- package/lib/Upload/enums.d.ts +5 -0
- package/lib/Upload/enums.js +9 -0
- package/lib/Upload/hooks/change.d.ts +3 -0
- package/lib/Upload/hooks/change.js +108 -0
- package/lib/Upload/hooks/customRequest.d.ts +3 -0
- package/lib/Upload/hooks/customRequest.js +132 -0
- package/lib/Upload/hooks/propsMaker.d.ts +2 -0
- package/lib/Upload/hooks/propsMaker.js +37 -0
- package/lib/Upload/index.d.ts +3 -0
- package/lib/Upload/index.js +148 -0
- package/lib/Upload/modal.d.ts +30 -0
- package/lib/Upload/util.d.ts +5 -0
- package/lib/Upload/util.js +38 -0
- package/lib/config.d.ts +5 -13
- package/lib/config.js +55 -8
- package/{es/hooks/useChangeOptions.d.ts → lib/hooks/index.d.ts} +3 -0
- package/lib/hooks/index.js +77 -0
- package/lib/index.css +42 -1
- package/lib/index.d.ts +26 -11
- package/lib/index.js +52 -23
- package/lib/modal.d.ts +16 -0
- package/package.json +17 -7
- package/scripts/rollup.config.js +14 -4
- package/scripts/webpack.config.js +5 -8
- package/src/Layout.tsx +4 -4
- package/src/components/CheckboxGroup/CheckBox/index.tsx +7 -7
- package/src/components/CheckboxGroup/hooks.ts +12 -13
- package/src/components/CheckboxGroup/index.tsx +40 -7
- package/src/components/CheckboxGroup/{modal.d.ts → modal.ts} +4 -1
- package/src/components/DialogForm/DrawerForm/Footer.tsx +20 -0
- package/src/components/DialogForm/DrawerForm/Title.tsx +12 -0
- package/src/components/DialogForm/DrawerForm/index.tsx +95 -0
- package/src/components/DialogForm/ModalForm.tsx +77 -0
- package/src/components/DialogForm/hooks.ts +109 -0
- package/src/components/DialogForm/modal.ts +36 -0
- package/src/components/Form/Context/FormConfigProvider.tsx +38 -0
- package/src/components/Form/Context/index.tsx +14 -0
- package/src/components/Form/FormItem/BasicItem.tsx +76 -0
- package/src/components/Form/FormItem/Helper.tsx +25 -0
- package/src/components/Form/FormItem/RegularFormItem.tsx +7 -0
- package/src/components/Form/FormItem/UpFormItem.tsx +20 -0
- package/src/components/Form/FormItem/hooks.tsx +40 -0
- package/src/components/Form/FormItem/index.tsx +8 -0
- package/src/components/Form/HFormConnect.tsx +67 -0
- package/src/components/Form/InitSet.tsx +10 -0
- package/src/components/Form/Label.tsx +50 -0
- package/src/components/Form/config.ts +43 -0
- package/src/components/Form/hooks/index.ts +115 -0
- package/src/components/Form/hooks/useDefaultRender.tsx +42 -0
- package/src/components/Form/hooks/useHForm.ts +164 -0
- package/src/components/Form/hooks/useInitConfigData.tsx +194 -0
- package/src/components/Form/index.less +22 -0
- package/src/components/Form/index.tsx +85 -0
- package/src/components/Form/modal.ts +179 -0
- package/src/components/Input/ButtonInput.tsx +11 -5
- package/src/components/Input/ColorInput/Picker.tsx +18 -0
- package/src/components/Input/ColorInput/data.ts +102 -0
- package/src/components/Input/ColorInput/index.less +10 -0
- package/src/components/Input/ColorInput/index.tsx +50 -0
- package/src/components/Input/SelectInput.tsx +33 -3
- package/src/components/Input/modal.ts +37 -0
- package/src/components/PageHandler/ErrorComponent.tsx +20 -0
- package/src/components/PageHandler/LoadingComponent.tsx +9 -0
- package/src/components/PageHandler/index.tsx +14 -0
- package/src/components/PageHandler/modal.ts +6 -0
- package/src/components/RadioGroup/index.tsx +8 -4
- package/src/components/Select/components/AllSelect.tsx +28 -17
- package/src/components/Select/components/DropdownComponent.tsx +1 -0
- package/src/components/Select/components/NotFoundContent.tsx +1 -1
- package/src/components/Select/hooks/changeHooks.tsx +6 -2
- package/src/components/Select/hooks/norHooks.ts +33 -6
- package/src/components/Select/index.less +20 -4
- package/src/components/Select/index.tsx +25 -11
- package/src/components/Select/modal.ts +17 -8
- package/src/components/Submit/index.tsx +46 -0
- package/src/components/Switch/index.tsx +14 -9
- package/src/components/TDPicker/RangePicker.tsx +109 -0
- package/src/components/TDPicker/TimePicker.tsx +25 -0
- package/src/components/TDPicker/hooks.ts +150 -0
- package/src/components/TDPicker/index.tsx +28 -0
- package/src/components/TDPicker/modal.ts +46 -0
- package/src/components/TextArea/index.tsx +8 -0
- package/src/components/Upload/Btn.tsx +24 -0
- package/src/components/Upload/MediaTypeEle/TypeEle.tsx +26 -0
- package/src/components/Upload/MediaTypeEle/index.tsx +34 -0
- package/src/components/Upload/Preview/index.tsx +14 -0
- package/src/components/Upload/UrlUpload/index.tsx +91 -0
- package/src/components/Upload/enums.ts +5 -0
- package/src/components/Upload/hooks/change.ts +79 -0
- package/src/components/Upload/hooks/customRequest.ts +87 -0
- package/src/components/Upload/hooks/propsMaker.ts +20 -0
- package/src/components/Upload/index.tsx +119 -0
- package/src/components/Upload/modal.ts +33 -0
- package/src/components/Upload/util.ts +27 -0
- package/src/components/config.ts +39 -8
- package/src/components/hooks/index.ts +53 -0
- package/src/components/index.tsx +30 -11
- package/src/components/modal.ts +20 -0
- package/src/components/styles/index.less +3 -1
- package/src/components/styles/local.less +1 -1
- package/src/components/typings.d.ts +0 -5
- package/src/pages/Checkbox/index.tsx +4 -5
- package/src/pages/DatePicker/index.tsx +20 -2
- package/src/pages/DrawerForm/index.tsx +127 -0
- package/src/pages/Form/index.tsx +203 -0
- package/src/pages/Input/index.tsx +2 -0
- package/src/pages/ModalForm/index.tsx +147 -0
- package/src/pages/Select/index.tsx +6 -3
- package/src/pages/Switch/index.tsx +1 -1
- package/src/pages/Upload/index.tsx +14 -0
- package/src/routes.tsx +24 -0
- package/tsconfig.json +1 -1
- package/es/DatePicker/RangePicker.d.ts +0 -4
- package/es/DatePicker/RangePicker.js +0 -23
- package/es/DatePicker/index.d.ts +0 -4
- package/es/DatePicker/index.js +0 -39
- package/es/TimePicker/index.d.ts +0 -2
- package/es/hooks/useChangeOptions.js +0 -25
- package/es/hooks/useClassName.d.ts +0 -1
- package/es/hooks/useClassName.js +0 -15
- package/lib/DatePicker/RangePicker.d.ts +0 -4
- package/lib/DatePicker/RangePicker.js +0 -26
- package/lib/DatePicker/index.d.ts +0 -4
- package/lib/DatePicker/index.js +0 -42
- package/lib/TimePicker/index.d.ts +0 -2
- package/lib/hooks/useChangeOptions.js +0 -26
- package/lib/hooks/useClassName.d.ts +0 -1
- package/lib/hooks/useClassName.js +0 -16
- package/src/components/DatePicker/RangePicker.tsx +0 -19
- package/src/components/DatePicker/index.tsx +0 -38
- package/src/components/DatePicker/modal.d.ts +0 -17
- package/src/components/Input/modal.d.ts +0 -26
- package/src/components/TimePicker/index.tsx +0 -1
- package/src/components/hooks/useChangeOptions.ts +0 -22
- package/src/components/hooks/useClassName.ts +0 -9
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
// welcome to hoo hoo hoo
|
|
2
|
+
import 'core-js/modules/es.object.keys.js';
|
|
3
|
+
import 'core-js/modules/es.symbol.js';
|
|
4
|
+
import 'core-js/modules/es.array.filter.js';
|
|
5
|
+
import 'core-js/modules/es.object.to-string.js';
|
|
6
|
+
import 'core-js/modules/es.object.get-own-property-descriptor.js';
|
|
7
|
+
import 'core-js/modules/web.dom-collections.for-each.js';
|
|
8
|
+
import 'core-js/modules/es.object.get-own-property-descriptors.js';
|
|
9
|
+
import _asyncToGenerator from '@babel/runtime-corejs3/helpers/asyncToGenerator';
|
|
10
|
+
import _defineProperty from '@babel/runtime-corejs3/helpers/defineProperty';
|
|
11
|
+
import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/objectWithoutProperties';
|
|
12
|
+
import _regeneratorRuntime from '@babel/runtime-corejs3/regenerator';
|
|
13
|
+
import { jsx } from 'react/jsx-runtime';
|
|
14
|
+
import { Modal } from 'antd';
|
|
15
|
+
import HForm from '../Form/index.js';
|
|
16
|
+
import { useCurrentForm, useModifyProps, useSub } from './hooks.js';
|
|
17
|
+
|
|
18
|
+
var _excluded = ["visible", "title", "onCancel", "configData", "infoRequest", "request", "afterClose", "dialogForm", "initialValues", "onFinish", "params", "onOk", "onValuesChange"];
|
|
19
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
20
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
21
|
+
var ModalForm = (function (_ref) {
|
|
22
|
+
var visible = _ref.visible,
|
|
23
|
+
title = _ref.title,
|
|
24
|
+
onCancel = _ref.onCancel,
|
|
25
|
+
configData = _ref.configData,
|
|
26
|
+
infoRequest = _ref.infoRequest,
|
|
27
|
+
request = _ref.request,
|
|
28
|
+
_afterClose = _ref.afterClose,
|
|
29
|
+
dialogForm = _ref.dialogForm,
|
|
30
|
+
_ref$initialValues = _ref.initialValues,
|
|
31
|
+
initialValues = _ref$initialValues === void 0 ? {} : _ref$initialValues,
|
|
32
|
+
onFinish = _ref.onFinish,
|
|
33
|
+
params = _ref.params,
|
|
34
|
+
onOk = _ref.onOk,
|
|
35
|
+
onValuesChange = _ref.onValuesChange,
|
|
36
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
37
|
+
var currentForm = useCurrentForm(dialogForm);
|
|
38
|
+
var _useModifyProps = useModifyProps({
|
|
39
|
+
configData: configData,
|
|
40
|
+
visible: visible,
|
|
41
|
+
initialValues: initialValues,
|
|
42
|
+
dialogForm: currentForm,
|
|
43
|
+
params: params,
|
|
44
|
+
title: title
|
|
45
|
+
}),
|
|
46
|
+
modalVisible = _useModifyProps.modalVisible,
|
|
47
|
+
modalFormData = _useModifyProps.modalFormData,
|
|
48
|
+
setModalVisible = _useModifyProps.setModalVisible,
|
|
49
|
+
initValue = _useModifyProps.initValue,
|
|
50
|
+
formParams = _useModifyProps.formParams,
|
|
51
|
+
modalTitle = _useModifyProps.title;
|
|
52
|
+
var cancel = function cancel() {
|
|
53
|
+
if (onCancel) {
|
|
54
|
+
return onCancel === null || onCancel === void 0 ? void 0 : onCancel();
|
|
55
|
+
}
|
|
56
|
+
setModalVisible(false);
|
|
57
|
+
};
|
|
58
|
+
var _useSub = useSub({
|
|
59
|
+
request: request,
|
|
60
|
+
onFinish: onFinish
|
|
61
|
+
}),
|
|
62
|
+
loading = _useSub.loading,
|
|
63
|
+
run = _useSub.run;
|
|
64
|
+
return jsx(Modal, _objectSpread(_objectSpread({
|
|
65
|
+
title: modalTitle,
|
|
66
|
+
visible: modalVisible,
|
|
67
|
+
onCancel: cancel,
|
|
68
|
+
confirmLoading: loading,
|
|
69
|
+
afterClose: function afterClose() {
|
|
70
|
+
currentForm.resetFields();
|
|
71
|
+
_afterClose === null || _afterClose === void 0 || _afterClose();
|
|
72
|
+
}
|
|
73
|
+
}, props), {}, {
|
|
74
|
+
onOk: currentForm.submit,
|
|
75
|
+
destroyOnClose: true,
|
|
76
|
+
children: jsx(HForm, _objectSpread(_objectSpread({
|
|
77
|
+
configData: modalFormData,
|
|
78
|
+
initialValues: initValue,
|
|
79
|
+
onValuesChange: onValuesChange,
|
|
80
|
+
onFinish: function () {
|
|
81
|
+
var _onFinish = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(values, outParams) {
|
|
82
|
+
var result, close;
|
|
83
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
84
|
+
while (1) switch (_context.prev = _context.next) {
|
|
85
|
+
case 0:
|
|
86
|
+
_context.next = 2;
|
|
87
|
+
return run(values, outParams);
|
|
88
|
+
case 2:
|
|
89
|
+
result = _context.sent;
|
|
90
|
+
close = onOk === null || onOk === void 0 ? void 0 : onOk(result, outParams);
|
|
91
|
+
if (!(close === false)) {
|
|
92
|
+
_context.next = 6;
|
|
93
|
+
break;
|
|
94
|
+
}
|
|
95
|
+
return _context.abrupt("return");
|
|
96
|
+
case 6:
|
|
97
|
+
cancel();
|
|
98
|
+
case 7:
|
|
99
|
+
case "end":
|
|
100
|
+
return _context.stop();
|
|
101
|
+
}
|
|
102
|
+
}, _callee);
|
|
103
|
+
}));
|
|
104
|
+
function onFinish(_x, _x2) {
|
|
105
|
+
return _onFinish.apply(this, arguments);
|
|
106
|
+
}
|
|
107
|
+
return onFinish;
|
|
108
|
+
}()
|
|
109
|
+
}, props), {}, {
|
|
110
|
+
params: formParams,
|
|
111
|
+
form: currentForm,
|
|
112
|
+
infoRequest: infoRequest
|
|
113
|
+
}))
|
|
114
|
+
}));
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
export { ModalForm as default };
|
|
118
|
+
// powered by hdj
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { DialogFormProps, HDialogFormInstance, ModifyPropsModal } from "./modal";
|
|
3
|
+
export declare const useModifyProps: ({ visible, configData, initialValues, dialogForm, afterClose, params, title, }: ModifyPropsModal) => {
|
|
4
|
+
modalFormData: import("../Form/modal").HItemProps[];
|
|
5
|
+
modalVisible: boolean | undefined;
|
|
6
|
+
setModalVisible: import("react").Dispatch<import("react").SetStateAction<boolean | undefined>>;
|
|
7
|
+
setModalFormData: import("react").Dispatch<import("react").SetStateAction<import("../Form/modal").HItemProps[]>>;
|
|
8
|
+
initValue: Record<string, any> | undefined;
|
|
9
|
+
setInitValue: import("react").Dispatch<import("react").SetStateAction<Record<string, any> | undefined>>;
|
|
10
|
+
onAfterClose: () => void;
|
|
11
|
+
formParams: any;
|
|
12
|
+
title: string | (string & import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>) | (string & import("react").ReactNodeArray) | (string & import("react").ReactPortal) | undefined;
|
|
13
|
+
};
|
|
14
|
+
export declare const useHDialogForm: () => HDialogFormInstance<any, any>;
|
|
15
|
+
export declare const useCurrentForm: (hDialogForm?: HDialogFormInstance) => HDialogFormInstance<any, any>;
|
|
16
|
+
export declare const useSub: ({ request, onFinish }: Partial<DialogFormProps>) => import("@ahooksjs/use-request/lib/types").BaseResult<any, [values: any, params: any]>;
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
// welcome to hoo hoo hoo
|
|
2
|
+
import 'core-js/modules/es.object.keys.js';
|
|
3
|
+
import 'core-js/modules/es.symbol.js';
|
|
4
|
+
import 'core-js/modules/es.array.filter.js';
|
|
5
|
+
import 'core-js/modules/es.object.to-string.js';
|
|
6
|
+
import 'core-js/modules/es.object.get-own-property-descriptor.js';
|
|
7
|
+
import 'core-js/modules/web.dom-collections.for-each.js';
|
|
8
|
+
import 'core-js/modules/es.object.get-own-property-descriptors.js';
|
|
9
|
+
import _asyncToGenerator from '@babel/runtime-corejs3/helpers/asyncToGenerator';
|
|
10
|
+
import _defineProperty from '@babel/runtime-corejs3/helpers/defineProperty';
|
|
11
|
+
import _slicedToArray from '@babel/runtime-corejs3/helpers/slicedToArray';
|
|
12
|
+
import _regeneratorRuntime from '@babel/runtime-corejs3/regenerator';
|
|
13
|
+
import { useMemo, useState, useEffect } from 'react';
|
|
14
|
+
import useHForm from '../Form/hooks/useHForm.js';
|
|
15
|
+
import { useRequest } from 'ahooks';
|
|
16
|
+
|
|
17
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
18
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
19
|
+
var useModifyProps = function useModifyProps(_ref) {
|
|
20
|
+
var visible = _ref.visible,
|
|
21
|
+
configData = _ref.configData,
|
|
22
|
+
initialValues = _ref.initialValues,
|
|
23
|
+
dialogForm = _ref.dialogForm,
|
|
24
|
+
afterClose = _ref.afterClose,
|
|
25
|
+
params = _ref.params,
|
|
26
|
+
title = _ref.title;
|
|
27
|
+
var _useState = useState(visible),
|
|
28
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
29
|
+
modalVisible = _useState2[0],
|
|
30
|
+
setModalVisible = _useState2[1];
|
|
31
|
+
var _useState3 = useState(configData),
|
|
32
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
33
|
+
modalFormData = _useState4[0],
|
|
34
|
+
setModalFormData = _useState4[1];
|
|
35
|
+
var _useState5 = useState(initialValues),
|
|
36
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
37
|
+
initValue = _useState6[0],
|
|
38
|
+
setInitValue = _useState6[1];
|
|
39
|
+
var _useState7 = useState(params),
|
|
40
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
41
|
+
formParams = _useState8[0],
|
|
42
|
+
setFormParams = _useState8[1];
|
|
43
|
+
var _useState9 = useState(title),
|
|
44
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
45
|
+
modalTitle = _useState10[0],
|
|
46
|
+
setModalTitle = _useState10[1];
|
|
47
|
+
var onAfterClose = function onAfterClose() {
|
|
48
|
+
setTimeout(function () {
|
|
49
|
+
dialogForm.resetFields();
|
|
50
|
+
afterClose === null || afterClose === void 0 || afterClose();
|
|
51
|
+
}, 100);
|
|
52
|
+
};
|
|
53
|
+
useEffect(function () {
|
|
54
|
+
setModalVisible(visible);
|
|
55
|
+
}, [visible]);
|
|
56
|
+
useEffect(function () {
|
|
57
|
+
setModalFormData(configData);
|
|
58
|
+
}, [configData]);
|
|
59
|
+
useEffect(function () {
|
|
60
|
+
setFormParams(params);
|
|
61
|
+
}, [params]);
|
|
62
|
+
useEffect(function () {
|
|
63
|
+
setModalTitle(title);
|
|
64
|
+
}, [title]);
|
|
65
|
+
useEffect(function () {
|
|
66
|
+
dialogForm.show = function () {
|
|
67
|
+
var showParams = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
68
|
+
var changeConfigData = showParams.configData,
|
|
69
|
+
changeInitialValues = showParams.initialValues,
|
|
70
|
+
changeParams = showParams.params,
|
|
71
|
+
changeTitle = showParams.title;
|
|
72
|
+
if (!!changeConfigData) {
|
|
73
|
+
setModalFormData(changeConfigData);
|
|
74
|
+
}
|
|
75
|
+
if (!!changeParams) {
|
|
76
|
+
setFormParams(changeParams);
|
|
77
|
+
}
|
|
78
|
+
if (!!changeTitle) {
|
|
79
|
+
setModalTitle(changeTitle);
|
|
80
|
+
}
|
|
81
|
+
setInitValue(changeInitialValues);
|
|
82
|
+
setModalVisible(true);
|
|
83
|
+
};
|
|
84
|
+
dialogForm.hide = function () {
|
|
85
|
+
setModalVisible(false);
|
|
86
|
+
onAfterClose();
|
|
87
|
+
};
|
|
88
|
+
}, [afterClose]);
|
|
89
|
+
return {
|
|
90
|
+
modalFormData: modalFormData,
|
|
91
|
+
modalVisible: modalVisible,
|
|
92
|
+
setModalVisible: setModalVisible,
|
|
93
|
+
setModalFormData: setModalFormData,
|
|
94
|
+
initValue: initValue,
|
|
95
|
+
setInitValue: setInitValue,
|
|
96
|
+
onAfterClose: onAfterClose,
|
|
97
|
+
formParams: formParams,
|
|
98
|
+
title: modalTitle
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
var useHDialogForm = function useHDialogForm() {
|
|
102
|
+
var hForm = useHForm();
|
|
103
|
+
return useMemo(function () {
|
|
104
|
+
return _objectSpread(_objectSpread({}, hForm), {}, {
|
|
105
|
+
show: function show(params) {},
|
|
106
|
+
hide: function hide() {}
|
|
107
|
+
});
|
|
108
|
+
}, []);
|
|
109
|
+
};
|
|
110
|
+
var useCurrentForm = function useCurrentForm(hDialogForm) {
|
|
111
|
+
var defaultHModalForm = useHDialogForm();
|
|
112
|
+
return hDialogForm || defaultHModalForm;
|
|
113
|
+
};
|
|
114
|
+
var useSub = function useSub(_ref2) {
|
|
115
|
+
var request = _ref2.request,
|
|
116
|
+
onFinish = _ref2.onFinish;
|
|
117
|
+
return useRequest( /*#__PURE__*/function () {
|
|
118
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(values, params) {
|
|
119
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
120
|
+
while (1) switch (_context.prev = _context.next) {
|
|
121
|
+
case 0:
|
|
122
|
+
if (!onFinish) {
|
|
123
|
+
_context.next = 2;
|
|
124
|
+
break;
|
|
125
|
+
}
|
|
126
|
+
return _context.abrupt("return", onFinish(values, params));
|
|
127
|
+
case 2:
|
|
128
|
+
if (!request) {
|
|
129
|
+
_context.next = 4;
|
|
130
|
+
break;
|
|
131
|
+
}
|
|
132
|
+
return _context.abrupt("return", request(values, params));
|
|
133
|
+
case 4:
|
|
134
|
+
case "end":
|
|
135
|
+
return _context.stop();
|
|
136
|
+
}
|
|
137
|
+
}, _callee);
|
|
138
|
+
}));
|
|
139
|
+
return function (_x, _x2) {
|
|
140
|
+
return _ref3.apply(this, arguments);
|
|
141
|
+
};
|
|
142
|
+
}(), {
|
|
143
|
+
manual: true
|
|
144
|
+
});
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
export { useCurrentForm, useHDialogForm, useModifyProps, useSub };
|
|
148
|
+
// powered by hdj
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { ModalProps } from "antd";
|
|
2
|
+
import type { HFormInstance, HItemProps, HFormProps } from "../Form/modal";
|
|
3
|
+
import type { PromiseFnResult } from "../modal";
|
|
4
|
+
type RootProps = HFormProps & ModalProps;
|
|
5
|
+
export interface ModifyPropsModal<P = any> {
|
|
6
|
+
configData: HItemProps[];
|
|
7
|
+
visible?: boolean;
|
|
8
|
+
initialValues?: Record<string, any>;
|
|
9
|
+
dialogForm: HDialogFormInstance;
|
|
10
|
+
afterClose?: VoidFunction;
|
|
11
|
+
params?: P;
|
|
12
|
+
title?: DialogFormProps["title"];
|
|
13
|
+
}
|
|
14
|
+
export interface ShowParamsModal<P = any, T = any> {
|
|
15
|
+
configData?: HItemProps[];
|
|
16
|
+
visible?: boolean;
|
|
17
|
+
initialValues?: Record<string, any>;
|
|
18
|
+
infoRequest?: PromiseFnResult<P, T>;
|
|
19
|
+
params?: P;
|
|
20
|
+
title?: DialogFormProps["title"];
|
|
21
|
+
}
|
|
22
|
+
export interface HDialogFormInstance<P = any, T = any> extends HFormInstance {
|
|
23
|
+
show: (data?: ShowParamsModal<P, T>) => void;
|
|
24
|
+
hide: VoidFunction;
|
|
25
|
+
}
|
|
26
|
+
export interface DialogFormProps<P = any, T = any> extends Omit<RootProps, "onFinish" | "onCancel" | "onOk" | "infoRequest"> {
|
|
27
|
+
dialogForm?: HDialogFormInstance;
|
|
28
|
+
onFinish?: (values: T, params: P) => Promise<any>;
|
|
29
|
+
onCancel?: VoidFunction;
|
|
30
|
+
onOk?: (data: T, params: P) => boolean | undefined;
|
|
31
|
+
infoRequest?: (params: P) => Promise<T>;
|
|
32
|
+
}
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// welcome to hoo hoo hoo
|
|
2
|
+
import 'core-js/modules/es.symbol.js';
|
|
3
|
+
import 'core-js/modules/es.array.filter.js';
|
|
4
|
+
import 'core-js/modules/es.object.get-own-property-descriptor.js';
|
|
5
|
+
import 'core-js/modules/es.object.get-own-property-descriptors.js';
|
|
6
|
+
import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/objectWithoutProperties';
|
|
7
|
+
import _defineProperty from '@babel/runtime-corejs3/helpers/defineProperty';
|
|
8
|
+
import 'core-js/modules/es.object.keys.js';
|
|
9
|
+
import 'core-js/modules/es.object.to-string.js';
|
|
10
|
+
import 'core-js/modules/web.dom-collections.for-each.js';
|
|
11
|
+
import { jsx } from 'react/jsx-runtime';
|
|
12
|
+
import { FormConfigContext } from './index.js';
|
|
13
|
+
import { useContext } from 'react';
|
|
14
|
+
import { baseConfig } from '../../config.js';
|
|
15
|
+
|
|
16
|
+
var _excluded = ["children"];
|
|
17
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
18
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
19
|
+
var useFormConfigContext = function useFormConfigContext(key) {
|
|
20
|
+
var defaultProps = useContext(FormConfigContext);
|
|
21
|
+
if (!key) {
|
|
22
|
+
return Object.keys(defaultProps).length === 0 ? _objectSpread({}, baseConfig) : defaultProps;
|
|
23
|
+
}
|
|
24
|
+
return defaultProps[key] || _objectSpread({}, baseConfig[key]);
|
|
25
|
+
};
|
|
26
|
+
var mergeProps = function mergeProps(props) {
|
|
27
|
+
var newProps = _objectSpread({}, baseConfig);
|
|
28
|
+
var keys = Object.keys(props);
|
|
29
|
+
keys.forEach(function (key) {
|
|
30
|
+
var defaultItem = newProps[key];
|
|
31
|
+
if (!defaultItem) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
newProps[key] = _objectSpread(_objectSpread({}, defaultItem), props[key]);
|
|
35
|
+
});
|
|
36
|
+
return newProps;
|
|
37
|
+
};
|
|
38
|
+
var Index = function Index(_ref) {
|
|
39
|
+
var children = _ref.children,
|
|
40
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
41
|
+
return jsx(FormConfigContext.Provider, {
|
|
42
|
+
value: mergeProps(props),
|
|
43
|
+
children: children
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export { Index as default, useFormConfigContext };
|
|
48
|
+
// powered by hdj
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { IFormConfigContextProps, FormContextProps } from "@/components/Form/modal";
|
|
3
|
+
export declare const FormContext: React.Context<Partial<FormContextProps>>;
|
|
4
|
+
export declare const useFormContext: () => FormContextProps;
|
|
5
|
+
export declare const FormConfigContext: React.Context<IFormConfigContextProps>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// welcome to hoo hoo hoo
|
|
2
|
+
import React, { useContext } from 'react';
|
|
3
|
+
|
|
4
|
+
var FormContext = /*#__PURE__*/React.createContext({});
|
|
5
|
+
var useFormContext = function useFormContext() {
|
|
6
|
+
return useContext(FormContext);
|
|
7
|
+
};
|
|
8
|
+
var FormConfigContext = /*#__PURE__*/React.createContext({});
|
|
9
|
+
|
|
10
|
+
export { FormConfigContext, FormContext, useFormContext };
|
|
11
|
+
// powered by hdj
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
// welcome to hoo hoo hoo
|
|
2
|
+
import 'core-js/modules/es.object.keys.js';
|
|
3
|
+
import 'core-js/modules/es.symbol.js';
|
|
4
|
+
import 'core-js/modules/es.array.filter.js';
|
|
5
|
+
import 'core-js/modules/es.object.to-string.js';
|
|
6
|
+
import 'core-js/modules/es.object.get-own-property-descriptor.js';
|
|
7
|
+
import 'core-js/modules/web.dom-collections.for-each.js';
|
|
8
|
+
import 'core-js/modules/es.object.get-own-property-descriptors.js';
|
|
9
|
+
import _defineProperty from '@babel/runtime-corejs3/helpers/defineProperty';
|
|
10
|
+
import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/objectWithoutProperties';
|
|
11
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
12
|
+
import Index$1 from '../Label.js';
|
|
13
|
+
import { Form, Space } from 'antd';
|
|
14
|
+
import React from 'react';
|
|
15
|
+
import Index$2 from './Helper.js';
|
|
16
|
+
import { useClassName } from '../../hooks/index.js';
|
|
17
|
+
import { useHide } from './hooks.js';
|
|
18
|
+
import { useFormContext } from '../Context/index.js';
|
|
19
|
+
import { useDefaultRender } from '../hooks/useDefaultRender.js';
|
|
20
|
+
import { useDefaultComponents } from '../hooks/index.js';
|
|
21
|
+
|
|
22
|
+
var _excluded = ["hover", "labelWidth", "required", "colon", "label", "itemProps", "children", "helper", "hide", "render"];
|
|
23
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
24
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
25
|
+
var Content = function Content(_ref) {
|
|
26
|
+
var children = _ref.children,
|
|
27
|
+
helper = _ref.helper,
|
|
28
|
+
value = _ref.value,
|
|
29
|
+
onChange = _ref.onChange;
|
|
30
|
+
var className = useClassName("hw-form-base-item");
|
|
31
|
+
var relChild = children && /*#__PURE__*/React.cloneElement(children, {
|
|
32
|
+
value: value,
|
|
33
|
+
onChange: onChange
|
|
34
|
+
});
|
|
35
|
+
return jsxs(Space, {
|
|
36
|
+
direction: "vertical",
|
|
37
|
+
size: 4,
|
|
38
|
+
style: {
|
|
39
|
+
width: "100%"
|
|
40
|
+
},
|
|
41
|
+
children: [jsx("div", {
|
|
42
|
+
className: className,
|
|
43
|
+
children: relChild
|
|
44
|
+
}), jsx(Index$2, {
|
|
45
|
+
helper: helper
|
|
46
|
+
})]
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
var Index = function Index(props) {
|
|
50
|
+
var hover = props.hover,
|
|
51
|
+
labelWidth = props.labelWidth,
|
|
52
|
+
required = props.required,
|
|
53
|
+
_props$colon = props.colon,
|
|
54
|
+
colon = _props$colon === void 0 ? true : _props$colon,
|
|
55
|
+
label = props.label;
|
|
56
|
+
props.itemProps;
|
|
57
|
+
props.children;
|
|
58
|
+
var helper = props.helper,
|
|
59
|
+
hide = props.hide;
|
|
60
|
+
props.render;
|
|
61
|
+
var oProps = _objectWithoutProperties(props, _excluded);
|
|
62
|
+
var _useFormContext = useFormContext(),
|
|
63
|
+
form = _useFormContext.form;
|
|
64
|
+
var defaultComponent = useDefaultComponents();
|
|
65
|
+
var defaultRender = useDefaultRender(props, defaultComponent);
|
|
66
|
+
var hideItem = useHide({
|
|
67
|
+
hide: hide,
|
|
68
|
+
form: form
|
|
69
|
+
});
|
|
70
|
+
if (hideItem) {
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
return jsx(Form.Item, _objectSpread(_objectSpread({
|
|
74
|
+
label: jsx(Index$1, {
|
|
75
|
+
hover: hover,
|
|
76
|
+
labelWidth: labelWidth,
|
|
77
|
+
required: required,
|
|
78
|
+
colon: colon,
|
|
79
|
+
children: label
|
|
80
|
+
})
|
|
81
|
+
}, oProps), {}, {
|
|
82
|
+
colon: false,
|
|
83
|
+
required: false,
|
|
84
|
+
children: jsx(Content, {
|
|
85
|
+
helper: helper,
|
|
86
|
+
children: defaultRender(form)
|
|
87
|
+
})
|
|
88
|
+
}));
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
export { Index as default };
|
|
92
|
+
// powered by hdj
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// welcome to hoo hoo hoo
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { Typography } from 'antd';
|
|
4
|
+
import { useFormContext } from '../Context/index.js';
|
|
5
|
+
|
|
6
|
+
var Index = function Index(_ref) {
|
|
7
|
+
var helper = _ref.helper;
|
|
8
|
+
var _useFormContext = useFormContext(),
|
|
9
|
+
form = _useFormContext.form;
|
|
10
|
+
if (!helper) {
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
if (typeof helper === "function") {
|
|
14
|
+
return jsx(Typography.Text, {
|
|
15
|
+
type: "secondary",
|
|
16
|
+
children: helper(form)
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
return jsx(Typography.Text, {
|
|
20
|
+
type: "secondary",
|
|
21
|
+
children: helper
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export { Index as default };
|
|
26
|
+
// powered by hdj
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// welcome to hoo hoo hoo
|
|
2
|
+
import 'core-js/modules/es.object.keys.js';
|
|
3
|
+
import 'core-js/modules/es.symbol.js';
|
|
4
|
+
import 'core-js/modules/es.array.filter.js';
|
|
5
|
+
import 'core-js/modules/es.object.to-string.js';
|
|
6
|
+
import 'core-js/modules/es.object.get-own-property-descriptor.js';
|
|
7
|
+
import 'core-js/modules/web.dom-collections.for-each.js';
|
|
8
|
+
import 'core-js/modules/es.object.get-own-property-descriptors.js';
|
|
9
|
+
import _defineProperty from '@babel/runtime-corejs3/helpers/defineProperty';
|
|
10
|
+
import { jsx } from 'react/jsx-runtime';
|
|
11
|
+
import Index from './BasicItem.js';
|
|
12
|
+
|
|
13
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
14
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
15
|
+
var RegularFormItem = (function (props) {
|
|
16
|
+
var type = props.type,
|
|
17
|
+
colon = props.colon;
|
|
18
|
+
return jsx(Index, _objectSpread(_objectSpread({}, props), {}, {
|
|
19
|
+
colon: type === "submit" ? false : colon
|
|
20
|
+
}));
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
export { RegularFormItem as default };
|
|
24
|
+
// powered by hdj
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// welcome to hoo hoo hoo
|
|
2
|
+
import 'core-js/modules/es.object.keys.js';
|
|
3
|
+
import 'core-js/modules/es.symbol.js';
|
|
4
|
+
import 'core-js/modules/es.array.filter.js';
|
|
5
|
+
import 'core-js/modules/es.object.to-string.js';
|
|
6
|
+
import 'core-js/modules/es.object.get-own-property-descriptor.js';
|
|
7
|
+
import 'core-js/modules/web.dom-collections.for-each.js';
|
|
8
|
+
import 'core-js/modules/es.object.get-own-property-descriptors.js';
|
|
9
|
+
import _defineProperty from '@babel/runtime-corejs3/helpers/defineProperty';
|
|
10
|
+
import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/objectWithoutProperties';
|
|
11
|
+
import { jsx } from 'react/jsx-runtime';
|
|
12
|
+
import { Form } from 'antd';
|
|
13
|
+
import Index from './BasicItem.js';
|
|
14
|
+
import { useShouldUpdate } from './hooks.js';
|
|
15
|
+
|
|
16
|
+
var _excluded = ["shouldUpdate", "dependencies", "hide"];
|
|
17
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
18
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
19
|
+
var Item = Form.Item;
|
|
20
|
+
var UpFormItem = (function (_ref) {
|
|
21
|
+
var shouldUpdate = _ref.shouldUpdate,
|
|
22
|
+
dependencies = _ref.dependencies,
|
|
23
|
+
hide = _ref.hide,
|
|
24
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
25
|
+
var resultShouldUpdate = useShouldUpdate({
|
|
26
|
+
shouldUpdate: shouldUpdate,
|
|
27
|
+
hide: hide
|
|
28
|
+
});
|
|
29
|
+
return jsx(Item, {
|
|
30
|
+
shouldUpdate: resultShouldUpdate,
|
|
31
|
+
dependencies: dependencies,
|
|
32
|
+
noStyle: true,
|
|
33
|
+
children: function children() {
|
|
34
|
+
return jsx(Index, _objectSpread({
|
|
35
|
+
hide: hide
|
|
36
|
+
}, props));
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
export { UpFormItem as default };
|
|
42
|
+
// powered by hdj
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { HFormInstance, HItemProps } from "../modal";
|
|
2
|
+
export declare const useFormItemDomControl: ({ shouldUpdate, hide, dependencies, }: HItemProps) => ({ shouldUpdate, dependencies, hide, ...props }: import("../modal").HFormItemProps) => JSX.Element;
|
|
3
|
+
interface UseHideUpItemModal extends Omit<HItemProps, "name"> {
|
|
4
|
+
form: HFormInstance;
|
|
5
|
+
}
|
|
6
|
+
export declare const useShouldUpdate: ({ hide, shouldUpdate, }: Omit<HItemProps, "name">) => import("rc-field-form/lib/Field").ShouldUpdate<any> | undefined;
|
|
7
|
+
export declare const useHide: ({ hide, form }: UseHideUpItemModal) => boolean;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// welcome to hoo hoo hoo
|
|
2
|
+
import UpFormItem from './UpFormItem.js';
|
|
3
|
+
import RegularFormItem from './RegularFormItem.js';
|
|
4
|
+
import { useMemo } from 'react';
|
|
5
|
+
|
|
6
|
+
var useFormItemDomControl = function useFormItemDomControl(_ref) {
|
|
7
|
+
var shouldUpdate = _ref.shouldUpdate,
|
|
8
|
+
hide = _ref.hide,
|
|
9
|
+
dependencies = _ref.dependencies;
|
|
10
|
+
return useMemo(function () {
|
|
11
|
+
if (shouldUpdate || typeof hide === "function" || dependencies) {
|
|
12
|
+
return UpFormItem;
|
|
13
|
+
}
|
|
14
|
+
return RegularFormItem;
|
|
15
|
+
}, [shouldUpdate, hide]);
|
|
16
|
+
};
|
|
17
|
+
var useShouldUpdate = function useShouldUpdate(_ref2) {
|
|
18
|
+
var hide = _ref2.hide,
|
|
19
|
+
shouldUpdate = _ref2.shouldUpdate;
|
|
20
|
+
if (typeof hide === "function" && !shouldUpdate) {
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
return shouldUpdate;
|
|
24
|
+
};
|
|
25
|
+
var useHide = function useHide(_ref3) {
|
|
26
|
+
var hide = _ref3.hide,
|
|
27
|
+
form = _ref3.form;
|
|
28
|
+
if (hide === true) {
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
if (typeof hide === "function") {
|
|
32
|
+
return hide(form);
|
|
33
|
+
}
|
|
34
|
+
return !!hide;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export { useFormItemDomControl, useHide, useShouldUpdate };
|
|
38
|
+
// powered by hdj
|