@hw-component/form 0.0.4 → 0.0.5-beta-v1
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 +15 -9
- package/es/CheckboxGroup/hooks.d.ts +1 -1
- package/es/CheckboxGroup/hooks.js +18 -19
- package/es/CheckboxGroup/index.d.ts +2 -3
- package/es/CheckboxGroup/index.js +70 -26
- 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 +138 -0
- package/es/DialogForm/ModalForm.d.ts +3 -0
- package/es/DialogForm/ModalForm.js +119 -0
- package/es/DialogForm/hooks.d.ts +16 -0
- package/es/DialogForm/hooks.js +150 -0
- package/es/DialogForm/modal.d.ts +33 -0
- package/es/Form/Context/FormConfigProvider.d.ts +5 -0
- package/es/Form/Context/FormConfigProvider.js +49 -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 +93 -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 +25 -0
- package/es/Form/FormItem/UpFormItem.d.ts +3 -0
- package/es/Form/FormItem/UpFormItem.js +43 -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 +22 -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 +158 -0
- package/es/Form/hooks/useDefaultRender.d.ts +3 -0
- package/es/Form/hooks/useDefaultRender.js +49 -0
- package/es/Form/hooks/useHForm.d.ts +3 -0
- package/es/Form/hooks/useHForm.js +194 -0
- package/es/Form/hooks/useInitConfigData.d.ts +8 -0
- package/es/Form/hooks/useInitConfigData.js +172 -0
- package/es/Form/index.d.ts +3 -0
- package/es/Form/index.js +103 -0
- package/es/Form/modal.d.ts +123 -0
- package/es/Input/ButtonInput.d.ts +2 -2
- package/es/Input/ButtonInput.js +34 -19
- 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 +87 -0
- package/es/Input/InputNumber.d.ts +0 -1
- package/es/Input/InputNumber.js +18 -8
- package/es/Input/SelectInput.d.ts +2 -1
- package/es/Input/SelectInput.js +43 -14
- package/es/Input/defaultConfig.js +2 -2
- package/es/Input/index.d.ts +0 -1
- package/es/Input/index.js +17 -6
- package/es/Input/modal.d.ts +30 -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 +25 -10
- package/es/Select/components/AllSelect.d.ts +3 -4
- package/es/Select/components/AllSelect.js +36 -18
- 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 +5 -5
- package/es/Select/hooks/changeHooks.js +7 -4
- package/es/Select/hooks/norHooks.d.ts +10 -3
- package/es/Select/hooks/norHooks.js +53 -17
- package/es/Select/index.d.ts +2 -3
- package/es/Select/index.js +65 -36
- package/es/Select/modal.d.ts +9 -1
- package/es/Select/utils.js +2 -2
- package/es/Submit/index.d.ts +9 -0
- package/es/Submit/index.js +55 -0
- package/es/Switch/index.d.ts +4 -3
- package/es/Switch/index.js +37 -18
- package/es/TDPicker/RangePicker.d.ts +8 -0
- package/es/TDPicker/RangePicker.js +126 -0
- package/es/TDPicker/TimePicker.d.ts +3 -0
- package/es/TDPicker/TimePicker.js +45 -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 +48 -0
- package/es/TDPicker/modal.d.ts +35 -0
- package/es/TextArea/index.d.ts +3 -0
- package/es/TextArea/index.js +31 -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 +37 -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 +132 -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 +109 -0
- package/es/Upload/hooks/customRequest.d.ts +3 -0
- package/es/Upload/hooks/customRequest.js +132 -0
- package/es/Upload/hooks/propsMaker.d.ts +2 -0
- package/es/Upload/hooks/propsMaker.js +37 -0
- package/es/Upload/index.d.ts +3 -0
- package/es/Upload/index.js +144 -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 +2 -14
- package/es/config.js +57 -10
- package/{lib/hooks/useChangeOptions.d.ts → es/hooks/index.d.ts} +3 -0
- package/es/hooks/index.js +75 -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 +12 -6
- package/lib/CheckboxGroup/hooks.d.ts +1 -1
- package/lib/CheckboxGroup/hooks.js +16 -17
- package/lib/CheckboxGroup/index.d.ts +2 -3
- package/lib/CheckboxGroup/index.js +68 -24
- 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 +141 -0
- package/lib/DialogForm/ModalForm.d.ts +3 -0
- package/lib/DialogForm/ModalForm.js +122 -0
- package/lib/DialogForm/hooks.d.ts +16 -0
- package/lib/DialogForm/hooks.js +154 -0
- package/lib/DialogForm/modal.d.ts +33 -0
- package/lib/Form/Context/FormConfigProvider.d.ts +5 -0
- package/lib/Form/Context/FormConfigProvider.js +53 -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 +96 -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 +28 -0
- package/lib/Form/FormItem/UpFormItem.d.ts +3 -0
- package/lib/Form/FormItem/UpFormItem.js +46 -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 +25 -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 +162 -0
- package/lib/Form/hooks/useDefaultRender.d.ts +3 -0
- package/lib/Form/hooks/useDefaultRender.js +50 -0
- package/lib/Form/hooks/useHForm.d.ts +3 -0
- package/lib/Form/hooks/useHForm.js +197 -0
- package/lib/Form/hooks/useInitConfigData.d.ts +8 -0
- package/lib/Form/hooks/useInitConfigData.js +175 -0
- package/lib/Form/index.d.ts +3 -0
- package/lib/Form/index.js +106 -0
- package/lib/Form/modal.d.ts +123 -0
- package/lib/Input/ButtonInput.d.ts +2 -2
- package/lib/Input/ButtonInput.js +32 -17
- 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 +90 -0
- package/lib/Input/InputNumber.d.ts +0 -1
- package/lib/Input/InputNumber.js +15 -5
- package/lib/Input/SelectInput.d.ts +2 -1
- package/lib/Input/SelectInput.js +42 -12
- package/lib/Input/index.d.ts +0 -1
- package/lib/Input/index.js +15 -4
- package/lib/Input/modal.d.ts +30 -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 +23 -8
- package/lib/Select/components/AllSelect.d.ts +3 -4
- package/lib/Select/components/AllSelect.js +34 -16
- 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 +3 -3
- package/lib/Select/hooks/changeHooks.js +5 -2
- package/lib/Select/hooks/norHooks.d.ts +10 -3
- package/lib/Select/hooks/norHooks.js +50 -14
- package/lib/Select/index.d.ts +2 -3
- package/lib/Select/index.js +62 -33
- package/lib/Select/modal.d.ts +9 -1
- package/lib/Submit/index.d.ts +9 -0
- package/lib/Submit/index.js +58 -0
- package/lib/Switch/index.d.ts +4 -3
- package/lib/Switch/index.js +34 -15
- package/lib/TDPicker/RangePicker.d.ts +8 -0
- package/lib/TDPicker/RangePicker.js +129 -0
- package/lib/TDPicker/TimePicker.d.ts +3 -0
- package/lib/TDPicker/TimePicker.js +48 -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 +51 -0
- package/lib/TDPicker/modal.d.ts +35 -0
- package/lib/TextArea/index.d.ts +3 -0
- package/lib/TextArea/index.js +34 -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 +40 -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 +135 -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 +110 -0
- package/lib/Upload/hooks/customRequest.d.ts +3 -0
- package/lib/Upload/hooks/customRequest.js +133 -0
- package/lib/Upload/hooks/propsMaker.d.ts +2 -0
- package/lib/Upload/hooks/propsMaker.js +38 -0
- package/lib/Upload/index.d.ts +3 -0
- package/lib/Upload/index.js +147 -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 +2 -14
- package/lib/config.js +55 -8
- package/{es/hooks/useChangeOptions.d.ts → lib/hooks/index.d.ts} +3 -0
- package/lib/hooks/index.js +78 -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 +7 -4
- package/scripts/rollup.config.js +2 -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 +111 -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 +48 -0
- package/src/components/Input/SelectInput.tsx +33 -3
- package/src/components/Input/modal.ts +36 -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 +35 -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 -0
- 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,78 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var _typeof = require('@babel/runtime-corejs3/helpers/typeof');
|
|
4
|
+
var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
5
|
+
var _objectWithoutProperties = require('@babel/runtime-corejs3/helpers/objectWithoutProperties');
|
|
6
|
+
var _mapInstanceProperty = require('@babel/runtime-corejs3/core-js/instance/map');
|
|
7
|
+
var _Array$isArray = require('@babel/runtime-corejs3/core-js/array/is-array');
|
|
8
|
+
var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js/instance/concat');
|
|
9
|
+
var _Object$keys = require('@babel/runtime-corejs3/core-js/object/keys');
|
|
10
|
+
var _forEachInstanceProperty = require('@babel/runtime-corejs3/core-js/instance/for-each');
|
|
11
|
+
var _Symbol$toPrimitive = require('@babel/runtime-corejs3/core-js/symbol/to-primitive');
|
|
12
|
+
var _Object$getOwnPropertySymbols = require('@babel/runtime-corejs3/core-js/object/get-own-property-symbols');
|
|
13
|
+
var _filterInstanceProperty = require('@babel/runtime-corejs3/core-js/instance/filter');
|
|
14
|
+
var _Object$getOwnPropertyDescriptor = require('@babel/runtime-corejs3/core-js/object/get-own-property-descriptor');
|
|
15
|
+
var _Object$getOwnPropertyDescriptors = require('@babel/runtime-corejs3/core-js/object/get-own-property-descriptors');
|
|
16
|
+
var _Object$defineProperties = require('@babel/runtime-corejs3/core-js/object/define-properties');
|
|
17
|
+
var _Object$defineProperty = require('@babel/runtime-corejs3/core-js/object/define-property');
|
|
18
|
+
var React = require('react');
|
|
19
|
+
var configProvider = require('antd/es/config-provider');
|
|
20
|
+
var FormConfigProvider = require('../Form/Context/FormConfigProvider.js');
|
|
21
|
+
|
|
22
|
+
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
23
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context4, _context5; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context4 = ownKeys(Object(source), !0)).call(_context4, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context5 = ownKeys(Object(source))).call(_context5, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
24
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
25
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[_Symbol$toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
26
|
+
var useChangeOptions = function useChangeOptions(_ref) {
|
|
27
|
+
var options = _ref.options,
|
|
28
|
+
_ref$fieldNames = _ref.fieldNames,
|
|
29
|
+
fieldNames = _ref$fieldNames === void 0 ? {} : _ref$fieldNames;
|
|
30
|
+
return React.useMemo(function () {
|
|
31
|
+
return options === null || options === void 0 ? void 0 : _mapInstanceProperty(options).call(options, function (item) {
|
|
32
|
+
var _context;
|
|
33
|
+
var _fieldNames$label = fieldNames.label,
|
|
34
|
+
label = _fieldNames$label === void 0 ? "" : _fieldNames$label,
|
|
35
|
+
_fieldNames$value = fieldNames.value,
|
|
36
|
+
value = _fieldNames$value === void 0 ? "" : _fieldNames$value;
|
|
37
|
+
var relLabel = item[label],
|
|
38
|
+
relVal = item[value],
|
|
39
|
+
oItem = _objectWithoutProperties(item, _mapInstanceProperty(_context = [label, value]).call(_context, _toPropertyKey));
|
|
40
|
+
return _objectSpread(_objectSpread({}, oItem), {}, {
|
|
41
|
+
label: relLabel,
|
|
42
|
+
value: relVal
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
}, [options]);
|
|
46
|
+
};
|
|
47
|
+
var useClassName = function useClassName(className) {
|
|
48
|
+
var config = React.useContext(configProvider.ConfigContext);
|
|
49
|
+
return React.useMemo(function () {
|
|
50
|
+
var _context3;
|
|
51
|
+
if (_Array$isArray(className)) {
|
|
52
|
+
var classNames = _mapInstanceProperty(className).call(className, function (item) {
|
|
53
|
+
var _context2;
|
|
54
|
+
return _concatInstanceProperty(_context2 = "".concat(config.getPrefixCls(), "-")).call(_context2, item);
|
|
55
|
+
});
|
|
56
|
+
return classNames.join(" ");
|
|
57
|
+
}
|
|
58
|
+
return _concatInstanceProperty(_context3 = "".concat(config.getPrefixCls(), "-")).call(_context3, className);
|
|
59
|
+
}, [className]);
|
|
60
|
+
};
|
|
61
|
+
var useMatchConfigProps = function useMatchConfigProps(matchProps) {
|
|
62
|
+
var globalConfig = FormConfigProvider.useFormConfigContext();
|
|
63
|
+
var keys = _Object$keys(matchProps);
|
|
64
|
+
var resultMatchProps = {};
|
|
65
|
+
_forEachInstanceProperty(keys).call(keys, function (key) {
|
|
66
|
+
if (!matchProps[key]) {
|
|
67
|
+
resultMatchProps[key] = globalConfig[key];
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
resultMatchProps[key] = matchProps[key];
|
|
71
|
+
});
|
|
72
|
+
return resultMatchProps;
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
exports.useChangeOptions = useChangeOptions;
|
|
76
|
+
exports.useClassName = useClassName;
|
|
77
|
+
exports.useMatchConfigProps = useMatchConfigProps;
|
|
78
|
+
// powered by h
|
package/lib/index.css
CHANGED
|
@@ -1,3 +1,44 @@
|
|
|
1
|
-
.ant-hw-option:
|
|
1
|
+
.ant-hw-all-check-box .ant-select-item-option-active:not( .ant-select-item-option-disabled) {
|
|
2
|
+
background-color: transparent;
|
|
3
|
+
}
|
|
4
|
+
.ant-hw-all-check-box .ant-select-item-option-selected:not( .ant-select-item-option-disabled) {
|
|
5
|
+
background-color: #e6f7ff;
|
|
6
|
+
}
|
|
7
|
+
.ant-hw-all-check-box .ant-select-item-option:not( .ant-select-item-option-selected):hover {
|
|
2
8
|
background-color: #f5f5f5;
|
|
3
9
|
}
|
|
10
|
+
.ant-hw-form-item-colon:after {
|
|
11
|
+
position: relative;
|
|
12
|
+
top: -0.5px;
|
|
13
|
+
margin: 0 0 0 2px;
|
|
14
|
+
content: ":";
|
|
15
|
+
}
|
|
16
|
+
.ant-hw-form-item-required:before {
|
|
17
|
+
display: inline-block;
|
|
18
|
+
margin-right: 4px;
|
|
19
|
+
color: #ff4d4f;
|
|
20
|
+
font-size: 14px;
|
|
21
|
+
font-family: SimSun, sans-serif;
|
|
22
|
+
line-height: 1;
|
|
23
|
+
content: "*";
|
|
24
|
+
}
|
|
25
|
+
.ant-hw-form-base-item {
|
|
26
|
+
display: -webkit-box;
|
|
27
|
+
display: -webkit-flex;
|
|
28
|
+
display: -ms-flexbox;
|
|
29
|
+
display: flex;
|
|
30
|
+
-webkit-box-align: center;
|
|
31
|
+
-webkit-align-items: center;
|
|
32
|
+
-ms-flex-align: center;
|
|
33
|
+
align-items: center;
|
|
34
|
+
min-height: 32px;
|
|
35
|
+
}
|
|
36
|
+
.ant-hw-color-box {
|
|
37
|
+
width: 22px;
|
|
38
|
+
height: 22px;
|
|
39
|
+
border-radius: 4px;
|
|
40
|
+
cursor: pointer;
|
|
41
|
+
}
|
|
42
|
+
.ant-hw-color-input-picker {
|
|
43
|
+
box-shadow: 0 0 0 0 !important;
|
|
44
|
+
}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,11 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export { default as
|
|
4
|
-
export { default as
|
|
5
|
-
export {
|
|
6
|
-
export { default as
|
|
7
|
-
export { default as
|
|
8
|
-
export {
|
|
9
|
-
export
|
|
10
|
-
export
|
|
11
|
-
export
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import "./styles/index.less";
|
|
3
|
+
export { default as HForm } from "./Form";
|
|
4
|
+
export { default as useHForm } from "./Form/hooks/useHForm";
|
|
5
|
+
export { useHDialogForm } from "./DialogForm/hooks";
|
|
6
|
+
export { default as HFormConnect } from "./Form/HFormConnect";
|
|
7
|
+
export { default as HFormConfigProvider } from "./Form/Context/FormConfigProvider";
|
|
8
|
+
export declare const HSelect: ({ style, mode, options, modeConfig, value, onChange, fieldNames: propsFieldNames, request, manual, optionLabelProp, filterProvider, optionFilterProp, serviceSearch, onSearch: propsOnSearch, filterOption, showSearch, labelInValue, noMatchItemRender, allSelect, ...props }: import("./Select/modal").HSelectProps) => JSX.Element;
|
|
9
|
+
export declare const HInput: ({ ...props }: import("./Input/modal").HInputProps<any>) => JSX.Element;
|
|
10
|
+
export declare const HSelectInput: import("react").ForwardRefExoticComponent<import("./Form/modal").HFormItemProps & import("react").RefAttributes<any>>;
|
|
11
|
+
export declare const HUpload: import("react").ForwardRefExoticComponent<import("./Form/modal").HFormItemProps & import("react").RefAttributes<any>>;
|
|
12
|
+
export declare const HUrlUpload: ({ placeholder, value, onChange, mediaType, ...props }: import("./Upload/modal").IUrlUploadProps) => JSX.Element;
|
|
13
|
+
export declare const HButtonInput: import("react").FC<import("./Input/modal").HButtonInputProps>;
|
|
14
|
+
export declare const HCheckBox: import("react").FC<import("./CheckboxGroup/modal").HCheckboxProps>;
|
|
15
|
+
export declare const HSwitch: import("react").FC<import("./Switch").HSwitchProps>;
|
|
16
|
+
export declare const HCheckboxGroup: import("react").ForwardRefExoticComponent<import("./Form/modal").HFormItemProps & import("react").RefAttributes<any>>;
|
|
17
|
+
export declare const HDatePicker: import("react").FC<import("./TDPicker/modal").HDatePickerProps>;
|
|
18
|
+
export declare const HRangePicker: import("react").ForwardRefExoticComponent<import("./Form/modal").HFormItemProps & import("react").RefAttributes<any>>;
|
|
19
|
+
export declare const HRadioGroup: ({ value, options, onChange, fieldNames: propsFieldNames, ...props }: import("./RadioGroup").HRadioGroupProps) => JSX.Element;
|
|
20
|
+
export declare const HTimePicker: ({ value, format, onChange, ...props }: import("./TDPicker/modal").HTimePickerProps) => JSX.Element;
|
|
21
|
+
export declare const HInputNumber: ({ style, ...props }: import("antd").InputNumberProps<string | number>) => JSX.Element;
|
|
22
|
+
export declare const HPageHandler: import("react").FC<import("./PageHandler/modal").IHPageHandler<any>>;
|
|
23
|
+
export declare const HTextArea: ({ autoSize, ...props }: import("antd/es/input").TextAreaProps) => JSX.Element;
|
|
24
|
+
export declare const HColorInput: ({ value, onChange, ...props }: import("./Input/modal").HInputProps<any>) => JSX.Element;
|
|
25
|
+
export declare const HModalForm: ({ visible, title, onCancel, configData, infoRequest, request, afterClose, dialogForm, initialValues, onFinish, params, onOk, ...props }: import("./DialogForm/modal").DialogFormProps<any, any>) => JSX.Element;
|
|
26
|
+
export declare const HDrawerForm: ({ visible, title, onCancel, configData, infoRequest, request, afterClose, dialogForm, closable, initialValues, labelWidth, onOk, onFinish, size, form, footer, params, ...props }: import("./DialogForm/modal").DialogFormProps<any, any>) => JSX.Element;
|
package/lib/index.js
CHANGED
|
@@ -1,28 +1,57 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var index$1 = require('./
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var index$
|
|
12
|
-
var index$6 = require('./DatePicker/index.js');
|
|
13
|
-
var RangePicker = require('./DatePicker/RangePicker.js');
|
|
3
|
+
var config = require('./Form/config.js');
|
|
4
|
+
var index$1 = require('./PageHandler/index.js');
|
|
5
|
+
var index = require('./Form/index.js');
|
|
6
|
+
var useHForm = require('./Form/hooks/useHForm.js');
|
|
7
|
+
var hooks = require('./DialogForm/hooks.js');
|
|
8
|
+
var HFormConnect = require('./Form/HFormConnect.js');
|
|
9
|
+
var FormConfigProvider = require('./Form/Context/FormConfigProvider.js');
|
|
10
|
+
var ModalForm = require('./DialogForm/ModalForm.js');
|
|
11
|
+
var index$2 = require('./DialogForm/DrawerForm/index.js');
|
|
14
12
|
|
|
13
|
+
var HSelect = config.default.select;
|
|
14
|
+
var HInput = config.default.input;
|
|
15
|
+
var HSelectInput = config.default.selectInput;
|
|
16
|
+
var HUpload = config.default.upload;
|
|
17
|
+
var HUrlUpload = config.default.urlUpload;
|
|
18
|
+
var HButtonInput = config.default.buttonInput;
|
|
19
|
+
var HCheckBox = config.default.checkBox;
|
|
20
|
+
var HSwitch = config.default["switch"];
|
|
21
|
+
var HCheckboxGroup = config.default.checkboxGroup;
|
|
22
|
+
var HDatePicker = config.default.datePicker;
|
|
23
|
+
var HRangePicker = config.default.rangePicker.Component;
|
|
24
|
+
var HRadioGroup = config.default.radioGroup;
|
|
25
|
+
var HTimePicker = config.default.timePicker;
|
|
26
|
+
var HInputNumber = config.default.inputNumber;
|
|
27
|
+
var HPageHandler = index$1.default;
|
|
28
|
+
var HTextArea = config.default.textArea;
|
|
29
|
+
var HColorInput = config.default.colorInput;
|
|
30
|
+
var HModalForm = ModalForm.default;
|
|
31
|
+
var HDrawerForm = index$2.default;
|
|
15
32
|
|
|
16
|
-
|
|
17
|
-
exports.
|
|
18
|
-
exports.
|
|
19
|
-
exports.
|
|
20
|
-
exports.
|
|
21
|
-
exports.HButtonInput =
|
|
22
|
-
exports.
|
|
23
|
-
exports.
|
|
24
|
-
exports.
|
|
25
|
-
exports.
|
|
26
|
-
exports.
|
|
27
|
-
exports.
|
|
33
|
+
exports.HForm = index.default;
|
|
34
|
+
exports.useHForm = useHForm.default;
|
|
35
|
+
exports.useHDialogForm = hooks.useHDialogForm;
|
|
36
|
+
exports.HFormConnect = HFormConnect.default;
|
|
37
|
+
exports.HFormConfigProvider = FormConfigProvider.default;
|
|
38
|
+
exports.HButtonInput = HButtonInput;
|
|
39
|
+
exports.HCheckBox = HCheckBox;
|
|
40
|
+
exports.HCheckboxGroup = HCheckboxGroup;
|
|
41
|
+
exports.HColorInput = HColorInput;
|
|
42
|
+
exports.HDatePicker = HDatePicker;
|
|
43
|
+
exports.HDrawerForm = HDrawerForm;
|
|
44
|
+
exports.HInput = HInput;
|
|
45
|
+
exports.HInputNumber = HInputNumber;
|
|
46
|
+
exports.HModalForm = HModalForm;
|
|
47
|
+
exports.HPageHandler = HPageHandler;
|
|
48
|
+
exports.HRadioGroup = HRadioGroup;
|
|
49
|
+
exports.HRangePicker = HRangePicker;
|
|
50
|
+
exports.HSelect = HSelect;
|
|
51
|
+
exports.HSelectInput = HSelectInput;
|
|
52
|
+
exports.HSwitch = HSwitch;
|
|
53
|
+
exports.HTextArea = HTextArea;
|
|
54
|
+
exports.HTimePicker = HTimePicker;
|
|
55
|
+
exports.HUpload = HUpload;
|
|
56
|
+
exports.HUrlUpload = HUrlUpload;
|
|
28
57
|
// powered by h
|
package/lib/modal.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface ValueCheckMapModal {
|
|
2
|
+
checked?: any;
|
|
3
|
+
noChecked?: any;
|
|
4
|
+
}
|
|
5
|
+
export type PromiseFnResult<T = any, R = any> = (params: T, formDataValues?: any) => Promise<R>;
|
|
6
|
+
export interface ValueSwitchMapModal {
|
|
7
|
+
open?: any;
|
|
8
|
+
close?: any;
|
|
9
|
+
}
|
|
10
|
+
export interface DataFnProvider<P = any, R = any> {
|
|
11
|
+
(name: P): R;
|
|
12
|
+
}
|
|
13
|
+
export interface DateRangePickerValueMapModal {
|
|
14
|
+
start?: string | DataFnProvider<string, string>;
|
|
15
|
+
end?: string | DataFnProvider<string, string>;
|
|
16
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hw-component/form",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5-beta-v1",
|
|
4
4
|
"description": "基于antd二次开发",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -27,9 +27,12 @@
|
|
|
27
27
|
]
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
+
"@ant-design/icons": "4.6.2",
|
|
31
|
+
"@types/react-color": "^3.0.9",
|
|
30
32
|
"ahooks": "2.10.9",
|
|
31
|
-
"antd": "4.
|
|
32
|
-
"react": "
|
|
33
|
+
"antd": "4.20.7",
|
|
34
|
+
"react": "17.0.0",
|
|
35
|
+
"react-color": "^2.19.3",
|
|
33
36
|
"react-dom": "17.0.2",
|
|
34
37
|
"react-router-dom": "^6.11.2"
|
|
35
38
|
},
|
|
@@ -45,7 +48,7 @@
|
|
|
45
48
|
"@rollup/plugin-inject": "^5.0.3",
|
|
46
49
|
"@rollup/plugin-node-resolve": "^15.0.2",
|
|
47
50
|
"@rollup/plugin-url": "^8.0.1",
|
|
48
|
-
"@types/react": "17.0.
|
|
51
|
+
"@types/react": "17.0.17",
|
|
49
52
|
"@types/react-dom": "17.0.9",
|
|
50
53
|
"@typescript-eslint/eslint-plugin": "^5.59.7",
|
|
51
54
|
"@umijs/fabric": "^2.14.1",
|
package/scripts/rollup.config.js
CHANGED
|
@@ -7,9 +7,7 @@ const typescript = require("rollup-plugin-typescript2");
|
|
|
7
7
|
const autoprefixer = require("autoprefixer");
|
|
8
8
|
const inject = require("@rollup/plugin-inject");
|
|
9
9
|
const url = require("@rollup/plugin-url");
|
|
10
|
-
const pkg = require("../package.json");
|
|
11
10
|
const postcss = require("rollup-plugin-postcss");
|
|
12
|
-
const prefix = pkg.cssPrefix;
|
|
13
11
|
const input = path.resolve(__dirname, "../src/components/index.tsx");
|
|
14
12
|
const outDir = path.resolve(__dirname, "../lib");
|
|
15
13
|
const esOutDir = path.resolve(__dirname, "../es");
|
|
@@ -27,8 +25,8 @@ module.exports = {
|
|
|
27
25
|
{
|
|
28
26
|
dir: esOutDir,
|
|
29
27
|
format: "es",
|
|
30
|
-
banner: "// welcome to
|
|
31
|
-
footer: "// powered by
|
|
28
|
+
banner: "// welcome to hoo hoo hoo",
|
|
29
|
+
footer: "// powered by hdj",
|
|
32
30
|
entryFileNames: "[name].js",
|
|
33
31
|
exports: "named",
|
|
34
32
|
preserveModules: true,
|
|
@@ -42,18 +42,15 @@ module.exports = {
|
|
|
42
42
|
"style-loader",
|
|
43
43
|
{
|
|
44
44
|
loader: "css-loader",
|
|
45
|
-
options: {
|
|
46
|
-
modules: true,
|
|
47
|
-
},
|
|
48
45
|
},
|
|
49
46
|
{
|
|
50
47
|
loader: "less-loader",
|
|
51
|
-
options:{
|
|
52
|
-
lessOptions:{
|
|
48
|
+
options: {
|
|
49
|
+
lessOptions: {
|
|
53
50
|
javascriptEnabled: true,
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
},
|
|
57
54
|
],
|
|
58
55
|
},
|
|
59
56
|
],
|
package/src/Layout.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useEffect, useState } from "react";
|
|
2
2
|
import { Menu } from "antd";
|
|
3
|
-
import
|
|
3
|
+
import "./index.less";
|
|
4
4
|
import type { RouteModal } from "./routes";
|
|
5
5
|
import routes from "./routes";
|
|
6
6
|
import { Outlet, useNavigate, useLocation } from "react-router-dom";
|
|
@@ -35,9 +35,9 @@ export default () => {
|
|
|
35
35
|
setOpenKey(openKeys);
|
|
36
36
|
}, [pathname]);
|
|
37
37
|
return (
|
|
38
|
-
<div className=
|
|
38
|
+
<div className="layout">
|
|
39
39
|
<Menu
|
|
40
|
-
className=
|
|
40
|
+
className="menu"
|
|
41
41
|
selectedKeys={keys}
|
|
42
42
|
openKeys={openKey}
|
|
43
43
|
onOpenChange={(openKeys) => {
|
|
@@ -53,7 +53,7 @@ export default () => {
|
|
|
53
53
|
return menuItem(item);
|
|
54
54
|
})}
|
|
55
55
|
</Menu>
|
|
56
|
-
<div className=
|
|
56
|
+
<div className="body">
|
|
57
57
|
<Outlet />
|
|
58
58
|
</div>
|
|
59
59
|
</div>
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import type { CheckboxProps } from "antd/lib/checkbox/Checkbox";
|
|
2
1
|
import { Checkbox } from "antd";
|
|
3
2
|
import React, { useMemo } from "react";
|
|
4
|
-
import { baseConfig } from "../../config";
|
|
5
3
|
import type { CheckboxChangeEvent } from "antd/es/checkbox";
|
|
4
|
+
import type { HCheckboxProps } from "@/components/CheckboxGroup/modal";
|
|
5
|
+
import { useMatchConfigProps } from "../../hooks";
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
valueCheckMap?: ValueCheckMapModal;
|
|
9
|
-
}
|
|
10
|
-
const Index: React.FC<IProps> = ({
|
|
7
|
+
const Index: React.FC<HCheckboxProps> = ({
|
|
11
8
|
value,
|
|
12
9
|
onChange,
|
|
13
10
|
children,
|
|
14
|
-
|
|
11
|
+
valueMap: propsValueCheckMap,
|
|
15
12
|
}) => {
|
|
13
|
+
const { valueCheckMap = {} } = useMatchConfigProps({
|
|
14
|
+
valueCheckMap: propsValueCheckMap,
|
|
15
|
+
}); //匹配全局
|
|
16
16
|
const checkedVal = useMemo(() => {
|
|
17
17
|
const { checked } = valueCheckMap;
|
|
18
18
|
if (value === checked) {
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { useEffect, useMemo, useState } from "react";
|
|
2
2
|
import type { HCheckboxProps } from "@/components/CheckboxGroup/modal";
|
|
3
|
-
import { baseConfig } from "../config";
|
|
4
3
|
|
|
5
4
|
const changValProvider = ({
|
|
6
5
|
value,
|
|
7
6
|
options,
|
|
8
|
-
|
|
7
|
+
valueMap = {},
|
|
9
8
|
}: HCheckboxProps) => {
|
|
10
9
|
const newVal = { ...value };
|
|
11
|
-
const { checked, noChecked } =
|
|
10
|
+
const { checked, noChecked } = valueMap;
|
|
12
11
|
options?.forEach((item) => {
|
|
13
12
|
const { value: itemVal } = item;
|
|
14
13
|
if (newVal[itemVal] !== checked) {
|
|
@@ -20,7 +19,7 @@ const changValProvider = ({
|
|
|
20
19
|
|
|
21
20
|
export const useValueProvider = ({
|
|
22
21
|
value,
|
|
23
|
-
|
|
22
|
+
valueMap = {},
|
|
24
23
|
keyInValue = true,
|
|
25
24
|
onChange,
|
|
26
25
|
options,
|
|
@@ -28,21 +27,21 @@ export const useValueProvider = ({
|
|
|
28
27
|
const [val, setVal] = useState<Record<any, any>>({});
|
|
29
28
|
const oldValueCheckMap = useMemo(() => {
|
|
30
29
|
return {
|
|
31
|
-
|
|
30
|
+
valueMap,
|
|
32
31
|
};
|
|
33
|
-
}, []);
|
|
32
|
+
}, []); //存储老的map
|
|
34
33
|
useEffect(() => {
|
|
35
34
|
setVal((oldVal) => {
|
|
36
35
|
return changValProvider({
|
|
37
36
|
value: oldVal,
|
|
38
37
|
options,
|
|
39
|
-
|
|
38
|
+
valueMap: oldValueCheckMap.valueMap,
|
|
40
39
|
});
|
|
41
40
|
});
|
|
42
41
|
}, [options]); //初始化数据
|
|
43
42
|
useEffect(() => {
|
|
44
|
-
const { checked: oldChecked } = oldValueCheckMap.
|
|
45
|
-
const { checked, noChecked } =
|
|
43
|
+
const { checked: oldChecked } = oldValueCheckMap.valueMap;
|
|
44
|
+
const { checked, noChecked } = valueMap;
|
|
46
45
|
setVal((oldVal) => {
|
|
47
46
|
const newVal = { ...oldVal };
|
|
48
47
|
const keys = Object.keys(newVal);
|
|
@@ -53,13 +52,13 @@ export const useValueProvider = ({
|
|
|
53
52
|
}
|
|
54
53
|
newVal[key] = noChecked;
|
|
55
54
|
});
|
|
56
|
-
oldValueCheckMap.
|
|
55
|
+
oldValueCheckMap.valueMap = valueMap;
|
|
57
56
|
return newVal;
|
|
58
57
|
});
|
|
59
|
-
}, [
|
|
58
|
+
}, [valueMap]);
|
|
60
59
|
|
|
61
60
|
useEffect(() => {
|
|
62
|
-
const { checked } = oldValueCheckMap.
|
|
61
|
+
const { checked } = oldValueCheckMap.valueMap;
|
|
63
62
|
if (!value) {
|
|
64
63
|
return;
|
|
65
64
|
}
|
|
@@ -77,7 +76,7 @@ export const useValueProvider = ({
|
|
|
77
76
|
}, [value]);
|
|
78
77
|
|
|
79
78
|
const change = (key: any, changeVal: any) => {
|
|
80
|
-
const { checked, noChecked } =
|
|
79
|
+
const { checked, noChecked } = valueMap;
|
|
81
80
|
const newVal = { ...val };
|
|
82
81
|
newVal[key] = noChecked;
|
|
83
82
|
if (changeVal === checked) {
|
|
@@ -1,27 +1,58 @@
|
|
|
1
1
|
import { Space } from "antd";
|
|
2
|
-
import { useChangeOptions } from "../hooks/useChangeOptions";
|
|
3
2
|
import type { HCheckboxProps } from "@/components/CheckboxGroup/modal";
|
|
4
3
|
import { useValueProvider } from "./hooks";
|
|
5
4
|
import Checkbox from "./CheckBox";
|
|
5
|
+
import { useMatchConfigProps, useChangeOptions } from "../hooks";
|
|
6
|
+
import HFormConnect from "../Form/HFormConnect";
|
|
7
|
+
import React from "react";
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
const Index = ({
|
|
8
10
|
options,
|
|
9
11
|
fieldNames,
|
|
10
12
|
onChange,
|
|
11
|
-
|
|
13
|
+
valueMap,
|
|
12
14
|
value,
|
|
13
15
|
disabled,
|
|
14
16
|
keyInValue = true,
|
|
17
|
+
addFormat,
|
|
15
18
|
}: HCheckboxProps) => {
|
|
16
|
-
const
|
|
19
|
+
const { valueCheckMap: resultValueCheckMap, fieldNames: resultFieldNames } =
|
|
20
|
+
useMatchConfigProps({ fieldNames, valueCheckMap: valueMap }); //匹配全局
|
|
21
|
+
const checkOptions = useChangeOptions({
|
|
22
|
+
options,
|
|
23
|
+
fieldNames: resultFieldNames,
|
|
24
|
+
});
|
|
17
25
|
const { val, change } = useValueProvider({
|
|
18
26
|
options: checkOptions,
|
|
19
27
|
onChange,
|
|
20
|
-
|
|
28
|
+
valueMap: resultValueCheckMap,
|
|
21
29
|
keyInValue,
|
|
22
30
|
value,
|
|
23
31
|
});
|
|
24
|
-
|
|
32
|
+
addFormat?.({
|
|
33
|
+
float: {
|
|
34
|
+
inputValue: (item, initValue) => {
|
|
35
|
+
const { name = "" } = item;
|
|
36
|
+
const keys = checkOptions?.map((optItem) => {
|
|
37
|
+
return optItem.value;
|
|
38
|
+
});
|
|
39
|
+
const resultObj = {};
|
|
40
|
+
keys?.forEach((key) => {
|
|
41
|
+
resultObj[key] = initValue[key];
|
|
42
|
+
});
|
|
43
|
+
return {
|
|
44
|
+
[name]: resultObj,
|
|
45
|
+
};
|
|
46
|
+
},
|
|
47
|
+
outputValue: (item, outputValue) => {
|
|
48
|
+
const { name = "" } = item;
|
|
49
|
+
const { [name]: itemVal = {} } = outputValue;
|
|
50
|
+
return {
|
|
51
|
+
...itemVal,
|
|
52
|
+
};
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
});
|
|
25
56
|
return (
|
|
26
57
|
<Space>
|
|
27
58
|
{checkOptions?.map((item) => {
|
|
@@ -34,7 +65,7 @@ export default ({
|
|
|
34
65
|
onChange={(changeVal) => {
|
|
35
66
|
change(itemVal, changeVal);
|
|
36
67
|
}}
|
|
37
|
-
|
|
68
|
+
valueMap={valueMap}
|
|
38
69
|
disabled={disabled}
|
|
39
70
|
>
|
|
40
71
|
{label}
|
|
@@ -44,3 +75,5 @@ export default ({
|
|
|
44
75
|
</Space>
|
|
45
76
|
);
|
|
46
77
|
};
|
|
78
|
+
|
|
79
|
+
export default HFormConnect(Index);
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import type { CheckboxProps } from "antd/lib/checkbox/Checkbox";
|
|
2
2
|
import type { SelectProps } from "antd";
|
|
3
|
+
import type { addFormatItemModal } from "../Form/modal";
|
|
4
|
+
import type { ValueCheckMapModal } from "../modal";
|
|
3
5
|
|
|
4
6
|
export interface HCheckboxProps
|
|
5
7
|
extends Omit<CheckboxProps, "value" | "onChange"> {
|
|
6
8
|
options?: Record<string, any>[];
|
|
7
9
|
fieldNames?: SelectProps["fieldNames"];
|
|
8
|
-
|
|
10
|
+
valueMap?: ValueCheckMapModal;
|
|
9
11
|
keyInValue?: boolean;
|
|
10
12
|
value?: Record<string, any> | any[];
|
|
11
13
|
onChange?: (value: Record<string, any> | any[]) => void;
|
|
14
|
+
addFormat?: (config: Record<string, addFormatItemModal>) => void;
|
|
12
15
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Row, Space, Button } from "antd";
|
|
2
|
+
|
|
3
|
+
interface IProps {
|
|
4
|
+
onOk?: VoidFunction;
|
|
5
|
+
onCancel?: VoidFunction;
|
|
6
|
+
confirmLoading?: boolean;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export default ({ onCancel, onOk, confirmLoading }: IProps) => {
|
|
10
|
+
return (
|
|
11
|
+
<Row justify={"end"}>
|
|
12
|
+
<Space size={"middle"}>
|
|
13
|
+
<Button onClick={onCancel}>关闭</Button>
|
|
14
|
+
<Button type={"primary"} onClick={onOk} loading={confirmLoading}>
|
|
15
|
+
确定
|
|
16
|
+
</Button>
|
|
17
|
+
</Space>
|
|
18
|
+
</Row>
|
|
19
|
+
);
|
|
20
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ModalProps } from "antd";
|
|
2
|
+
import { Row } from "antd";
|
|
3
|
+
import { CloseOutlined } from "@ant-design/icons";
|
|
4
|
+
|
|
5
|
+
export default ({ title, closable, onCancel }: ModalProps) => {
|
|
6
|
+
return (
|
|
7
|
+
<Row justify={"space-between"}>
|
|
8
|
+
<div>{title}</div>
|
|
9
|
+
{closable && <CloseOutlined onClick={onCancel} />}
|
|
10
|
+
</Row>
|
|
11
|
+
);
|
|
12
|
+
};
|