@hw-component/form 0.0.1 → 0.0.2-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/LICENSE +201 -0
- package/es/CheckboxGroup/CheckBox/index.d.ts +4 -0
- package/es/CheckboxGroup/CheckBox/index.js +40 -0
- package/es/CheckboxGroup/hooks.d.ts +5 -0
- package/es/CheckboxGroup/hooks.js +123 -0
- package/es/CheckboxGroup/index.d.ts +3 -0
- package/es/CheckboxGroup/index.js +91 -0
- package/es/CheckboxGroup/modal.d.ts +13 -0
- package/es/DialogForm/DrawerForm/Footer.d.ts +4 -0
- package/es/DialogForm/DrawerForm/Footer.js +23 -0
- package/es/DialogForm/DrawerForm/Title.d.ts +4 -0
- package/es/DialogForm/DrawerForm/Title.js +18 -0
- package/es/DialogForm/DrawerForm/index.d.ts +4 -0
- package/es/DialogForm/DrawerForm/index.js +111 -0
- package/es/DialogForm/ModalForm.d.ts +4 -0
- package/es/DialogForm/ModalForm.js +89 -0
- package/es/DialogForm/hooks.d.ts +14 -0
- package/es/DialogForm/hooks.js +124 -0
- package/es/DialogForm/modal.d.ts +25 -0
- package/es/Form/Context/FormConfigProvider.d.ts +5 -0
- package/es/Form/Context/FormConfigProvider.js +47 -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 +73 -0
- package/es/Form/FormItem/Helper.d.ts +7 -0
- package/es/Form/FormItem/Helper.js +24 -0
- package/es/Form/FormItem/RegularFormItem.d.ts +4 -0
- package/es/Form/FormItem/RegularFormItem.js +15 -0
- package/es/Form/FormItem/UpFormItem.d.ts +4 -0
- package/es/Form/FormItem/UpFormItem.js +31 -0
- package/es/Form/FormItem/hooks.d.ts +10 -0
- package/es/Form/FormItem/hooks.js +38 -0
- package/es/Form/FormItem/index.d.ts +4 -0
- package/es/Form/FormItem/index.js +11 -0
- package/es/Form/HFormConnect.d.ts +5 -0
- package/es/Form/HFormConnect.js +55 -0
- package/es/Form/InitSet.d.ts +3 -0
- package/es/Form/InitSet.js +15 -0
- package/es/Form/Label.d.ts +10 -0
- package/es/Form/Label.js +46 -0
- package/es/Form/config.d.ts +29 -0
- package/es/Form/config.js +45 -0
- package/es/Form/hooks/index.d.ts +6 -0
- package/es/Form/hooks/index.js +45 -0
- package/es/Form/hooks/useHForm.d.ts +3 -0
- package/es/Form/hooks/useHForm.js +168 -0
- package/es/Form/hooks/useInitConfigData.d.ts +4 -0
- package/es/Form/hooks/useInitConfigData.js +124 -0
- package/es/Form/index.d.ts +4 -0
- package/es/Form/index.js +104 -0
- package/es/Form/modal.d.ts +104 -0
- package/es/Input/ButtonInput.d.ts +4 -0
- package/es/Input/ButtonInput.js +80 -0
- package/es/Input/InputNumber.d.ts +4 -0
- package/es/Input/InputNumber.js +20 -0
- package/es/Input/SelectInput.d.ts +9 -0
- package/es/Input/SelectInput.js +97 -0
- package/es/Input/defaultConfig.d.ts +7 -0
- package/es/Input/defaultConfig.js +11 -0
- package/es/Input/index.d.ts +4 -0
- package/es/Input/index.js +13 -0
- package/es/Input/modal.d.ts +27 -0
- package/es/PageHandler/ErrorComponent.d.ts +4 -0
- package/es/PageHandler/ErrorComponent.js +33 -0
- package/es/PageHandler/LoadingComponent.d.ts +3 -0
- package/es/PageHandler/LoadingComponent.js +18 -0
- package/es/PageHandler/index.d.ts +4 -0
- package/es/PageHandler/index.js +24 -0
- package/es/PageHandler/modal.d.ts +6 -0
- package/es/RadioGroup/index.d.ts +9 -0
- package/es/RadioGroup/index.js +48 -0
- package/es/Select/components/AllSelect.d.ts +3 -3
- package/es/Select/components/AllSelect.js +31 -15
- package/es/Select/components/CheckBoxOption.js +2 -2
- package/es/Select/components/DropdownComponent.js +2 -2
- package/es/Select/components/NoFindItem.js +2 -2
- package/es/Select/components/NotFoundContent.js +3 -5
- package/es/Select/defaultConfig.d.ts +0 -1
- package/es/Select/defaultConfig.js +3 -7
- package/es/Select/hooks/changeHooks.d.ts +1 -1
- package/es/Select/hooks/changeHooks.js +9 -5
- package/es/Select/hooks/norHooks.d.ts +4 -6
- package/es/Select/hooks/norHooks.js +20 -37
- package/es/Select/index.d.ts +1 -1
- package/es/Select/index.js +31 -19
- package/es/Select/modal.d.ts +2 -2
- package/es/Select/utils.d.ts +2 -0
- package/es/Select/utils.js +39 -0
- package/es/Submit/index.d.ts +8 -0
- package/es/Submit/index.js +28 -0
- package/es/Switch/index.d.ts +11 -0
- package/es/Switch/index.js +45 -0
- package/es/TDPicker/RangePicker.d.ts +8 -0
- package/es/TDPicker/RangePicker.js +121 -0
- package/es/TDPicker/TimePicker.d.ts +4 -0
- package/es/TDPicker/TimePicker.js +31 -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 +33 -0
- package/es/TDPicker/modal.d.ts +28 -0
- package/es/TextArea/index.d.ts +4 -0
- package/es/TextArea/index.js +21 -0
- package/es/Upload/Btn.d.ts +4 -0
- package/es/Upload/Btn.js +31 -0
- package/es/Upload/MediaTypeEle/TypeEle.d.ts +10 -0
- package/es/Upload/MediaTypeEle/TypeEle.js +40 -0
- package/es/Upload/MediaTypeEle/index.d.ts +4 -0
- package/es/Upload/MediaTypeEle/index.js +36 -0
- package/es/Upload/Preview/index.d.ts +6 -0
- package/es/Upload/Preview/index.js +21 -0
- package/es/Upload/UrlUpload/index.d.ts +4 -0
- package/es/Upload/UrlUpload/index.js +119 -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 +140 -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 -0
- package/es/config.js +64 -0
- package/es/hooks/index.d.ts +13 -0
- package/es/hooks/index.js +75 -0
- package/es/index.css +33 -1
- package/es/index.d.ts +24 -1
- package/es/index.js +31 -3
- package/es/modal.d.ts +15 -0
- package/lib/CheckboxGroup/CheckBox/index.d.ts +4 -0
- package/lib/CheckboxGroup/CheckBox/index.js +43 -0
- package/lib/CheckboxGroup/hooks.d.ts +5 -0
- package/lib/CheckboxGroup/hooks.js +124 -0
- package/lib/CheckboxGroup/index.d.ts +3 -0
- package/lib/CheckboxGroup/index.js +94 -0
- package/lib/CheckboxGroup/modal.d.ts +13 -0
- package/lib/DialogForm/DrawerForm/Footer.d.ts +4 -0
- package/lib/DialogForm/DrawerForm/Footer.js +26 -0
- package/lib/DialogForm/DrawerForm/Title.d.ts +4 -0
- package/lib/DialogForm/DrawerForm/Title.js +21 -0
- package/lib/DialogForm/DrawerForm/index.d.ts +4 -0
- package/lib/DialogForm/DrawerForm/index.js +114 -0
- package/lib/DialogForm/ModalForm.d.ts +4 -0
- package/lib/DialogForm/ModalForm.js +92 -0
- package/lib/DialogForm/hooks.d.ts +14 -0
- package/lib/DialogForm/hooks.js +128 -0
- package/lib/DialogForm/modal.d.ts +25 -0
- package/lib/Form/Context/FormConfigProvider.d.ts +5 -0
- package/lib/Form/Context/FormConfigProvider.js +51 -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 +76 -0
- package/lib/Form/FormItem/Helper.d.ts +7 -0
- package/lib/Form/FormItem/Helper.js +27 -0
- package/lib/Form/FormItem/RegularFormItem.d.ts +4 -0
- package/lib/Form/FormItem/RegularFormItem.js +18 -0
- package/lib/Form/FormItem/UpFormItem.d.ts +4 -0
- package/lib/Form/FormItem/UpFormItem.js +34 -0
- package/lib/Form/FormItem/hooks.d.ts +10 -0
- package/lib/Form/FormItem/hooks.js +41 -0
- package/lib/Form/FormItem/index.d.ts +4 -0
- package/lib/Form/FormItem/index.js +14 -0
- package/lib/Form/HFormConnect.d.ts +5 -0
- package/lib/Form/HFormConnect.js +58 -0
- package/lib/Form/InitSet.d.ts +3 -0
- package/lib/Form/InitSet.js +18 -0
- package/lib/Form/Label.d.ts +10 -0
- package/lib/Form/Label.js +49 -0
- package/lib/Form/config.d.ts +29 -0
- package/lib/Form/config.js +49 -0
- package/lib/Form/hooks/index.d.ts +6 -0
- package/lib/Form/hooks/index.js +47 -0
- package/lib/Form/hooks/useHForm.d.ts +3 -0
- package/lib/Form/hooks/useHForm.js +171 -0
- package/lib/Form/hooks/useInitConfigData.d.ts +4 -0
- package/lib/Form/hooks/useInitConfigData.js +127 -0
- package/lib/Form/index.d.ts +4 -0
- package/lib/Form/index.js +107 -0
- package/lib/Form/modal.d.ts +104 -0
- package/lib/Input/ButtonInput.d.ts +4 -0
- package/lib/Input/ButtonInput.js +83 -0
- package/lib/Input/InputNumber.d.ts +4 -0
- package/lib/Input/InputNumber.js +23 -0
- package/lib/Input/SelectInput.d.ts +9 -0
- package/lib/Input/SelectInput.js +101 -0
- package/lib/Input/defaultConfig.d.ts +7 -0
- package/lib/Input/defaultConfig.js +13 -0
- package/lib/Input/index.d.ts +4 -0
- package/lib/Input/index.js +16 -0
- package/lib/Input/modal.d.ts +27 -0
- package/lib/PageHandler/ErrorComponent.d.ts +4 -0
- package/lib/PageHandler/ErrorComponent.js +36 -0
- package/lib/PageHandler/LoadingComponent.d.ts +3 -0
- package/lib/PageHandler/LoadingComponent.js +21 -0
- package/lib/PageHandler/index.d.ts +4 -0
- package/lib/PageHandler/index.js +27 -0
- package/lib/PageHandler/modal.d.ts +6 -0
- package/lib/RadioGroup/index.d.ts +9 -0
- package/lib/RadioGroup/index.js +51 -0
- package/lib/Select/components/AllSelect.d.ts +3 -3
- package/lib/Select/components/AllSelect.js +29 -13
- package/lib/Select/components/NotFoundContent.js +1 -3
- package/lib/Select/defaultConfig.d.ts +0 -1
- package/lib/Select/defaultConfig.js +0 -5
- package/lib/Select/hooks/changeHooks.d.ts +1 -1
- package/lib/Select/hooks/changeHooks.js +7 -3
- package/lib/Select/hooks/norHooks.d.ts +4 -6
- package/lib/Select/hooks/norHooks.js +18 -35
- package/lib/Select/index.d.ts +1 -1
- package/lib/Select/index.js +26 -14
- package/lib/Select/modal.d.ts +2 -2
- package/lib/Select/utils.d.ts +2 -0
- package/lib/Select/utils.js +41 -0
- package/lib/Submit/index.d.ts +8 -0
- package/lib/Submit/index.js +31 -0
- package/lib/Switch/index.d.ts +11 -0
- package/lib/Switch/index.js +48 -0
- package/lib/TDPicker/RangePicker.d.ts +8 -0
- package/lib/TDPicker/RangePicker.js +124 -0
- package/lib/TDPicker/TimePicker.d.ts +4 -0
- package/lib/TDPicker/TimePicker.js +34 -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 +36 -0
- package/lib/TDPicker/modal.d.ts +28 -0
- package/lib/TextArea/index.d.ts +4 -0
- package/lib/TextArea/index.js +24 -0
- package/lib/Upload/Btn.d.ts +4 -0
- package/lib/Upload/Btn.js +34 -0
- package/lib/Upload/MediaTypeEle/TypeEle.d.ts +10 -0
- package/lib/Upload/MediaTypeEle/TypeEle.js +43 -0
- package/lib/Upload/MediaTypeEle/index.d.ts +4 -0
- package/lib/Upload/MediaTypeEle/index.js +39 -0
- package/lib/Upload/Preview/index.d.ts +6 -0
- package/lib/Upload/Preview/index.js +24 -0
- package/lib/Upload/UrlUpload/index.d.ts +4 -0
- package/lib/Upload/UrlUpload/index.js +122 -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 +143 -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 -0
- package/lib/config.js +65 -0
- package/lib/hooks/index.d.ts +13 -0
- package/lib/hooks/index.js +78 -0
- package/lib/index.css +33 -1
- package/lib/index.d.ts +24 -1
- package/lib/index.js +48 -3
- package/lib/modal.d.ts +15 -0
- package/package.json +4 -3
- package/scripts/rollup.config.js +3 -8
- package/scripts/webpack.config.js +6 -2
- package/src/Layout.tsx +4 -4
- package/src/components/CheckboxGroup/CheckBox/index.tsx +38 -0
- package/src/components/CheckboxGroup/hooks.ts +102 -0
- package/src/components/CheckboxGroup/index.tsx +79 -0
- package/src/components/CheckboxGroup/modal.ts +15 -0
- package/src/components/DialogForm/DrawerForm/Footer.tsx +19 -0
- package/src/components/DialogForm/DrawerForm/Title.tsx +12 -0
- package/src/components/DialogForm/DrawerForm/index.tsx +85 -0
- package/src/components/DialogForm/ModalForm.tsx +60 -0
- package/src/components/DialogForm/hooks.ts +87 -0
- package/src/components/DialogForm/modal.ts +27 -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 +70 -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 +44 -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 +41 -0
- package/src/components/Form/hooks/index.ts +22 -0
- package/src/components/Form/hooks/useHForm.ts +142 -0
- package/src/components/Form/hooks/useInitConfigData.tsx +100 -0
- package/src/components/Form/index.less +22 -0
- package/src/components/Form/index.tsx +79 -0
- package/src/components/Form/modal.ts +154 -0
- package/src/components/Input/ButtonInput.tsx +41 -0
- package/src/components/Input/InputNumber.tsx +5 -0
- package/src/components/Input/SelectInput.tsx +76 -0
- package/src/components/Input/defaultConfig.ts +8 -0
- package/src/components/Input/index.tsx +6 -0
- package/src/components/Input/modal.ts +33 -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 +45 -0
- package/src/components/Select/components/AllSelect.tsx +32 -16
- package/src/components/Select/components/DropdownComponent.tsx +1 -0
- package/src/components/Select/components/NotFoundContent.tsx +1 -1
- package/src/components/Select/defaultConfig.tsx +0 -5
- package/src/components/Select/hooks/changeHooks.tsx +14 -4
- package/src/components/Select/hooks/norHooks.ts +8 -19
- package/src/components/Select/index.less +20 -3
- package/src/components/Select/index.tsx +29 -17
- package/src/components/Select/modal.ts +9 -9
- package/src/components/Select/utils.ts +18 -0
- package/src/components/Submit/index.tsx +28 -0
- package/src/components/Switch/index.tsx +52 -0
- package/src/components/TDPicker/RangePicker.tsx +105 -0
- package/src/components/TDPicker/TimePicker.tsx +15 -0
- package/src/components/TDPicker/hooks.ts +150 -0
- package/src/components/TDPicker/index.tsx +22 -0
- package/src/components/TDPicker/modal.ts +30 -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 +117 -0
- package/src/components/Upload/modal.ts +33 -0
- package/src/components/Upload/util.ts +27 -0
- package/src/components/config.ts +40 -0
- package/src/components/hooks/index.ts +53 -0
- package/src/components/index.tsx +27 -1
- package/src/components/modal.ts +15 -0
- package/src/components/styles/index.less +2 -0
- package/src/components/styles/local.less +1 -0
- package/src/pages/Checkbox/index.tsx +15 -0
- package/src/pages/DatePicker/index.tsx +33 -0
- package/src/pages/DrawerForm/index.tsx +127 -0
- package/src/pages/Form/index.tsx +149 -0
- package/src/pages/Input/index.tsx +22 -0
- package/src/pages/ModalForm/index.tsx +127 -0
- package/src/pages/Radio/index.tsx +18 -0
- package/src/pages/Select/index.tsx +7 -4
- package/src/pages/Switch/index.tsx +18 -0
- package/src/pages/Upload/index.tsx +14 -0
- package/src/routes.tsx +55 -10
- package/es/Select/index.less.js +0 -5
- package/lib/Select/index.less.js +0 -8
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// welcome to
|
|
1
|
+
// welcome to hoo hoo hoo
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { Typography, Row, Space, Spin } from 'antd';
|
|
4
4
|
import NotFoundContent from './NotFoundContent.js';
|
|
@@ -36,4 +36,4 @@ var Index = function Index(_ref) {
|
|
|
36
36
|
};
|
|
37
37
|
|
|
38
38
|
export { Index as default };
|
|
39
|
-
// powered by
|
|
39
|
+
// powered by hdj
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// welcome to
|
|
1
|
+
// welcome to hoo hoo hoo
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { Typography } from 'antd';
|
|
4
4
|
|
|
@@ -10,4 +10,4 @@ var NoFindItem = (function (_ref) {
|
|
|
10
10
|
});
|
|
11
11
|
|
|
12
12
|
export { NoFindItem as default };
|
|
13
|
-
// powered by
|
|
13
|
+
// powered by hdj
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// welcome to
|
|
1
|
+
// welcome to hoo hoo hoo
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { Typography, Row, Space, Button, Empty } from 'antd';
|
|
4
4
|
import { ExclamationCircleOutlined } from '@ant-design/icons';
|
|
@@ -20,9 +20,7 @@ var NotFoundContent = (function (_ref) {
|
|
|
20
20
|
}, /*#__PURE__*/React.createElement(Text, {
|
|
21
21
|
type: "danger"
|
|
22
22
|
}, /*#__PURE__*/React.createElement(ExclamationCircleOutlined, {
|
|
23
|
-
|
|
24
|
-
fontSize: 24
|
|
25
|
-
}
|
|
23
|
+
size: 24
|
|
26
24
|
})), /*#__PURE__*/React.createElement(Text, {
|
|
27
25
|
type: "danger"
|
|
28
26
|
}, error.message), /*#__PURE__*/React.createElement(Button, {
|
|
@@ -37,4 +35,4 @@ var NotFoundContent = (function (_ref) {
|
|
|
37
35
|
});
|
|
38
36
|
|
|
39
37
|
export { NotFoundContent as default };
|
|
40
|
-
// powered by
|
|
38
|
+
// powered by hdj
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { HSelectProps } from "@/components/Select/modal";
|
|
3
3
|
export declare const defaultModeConfig: HSelectProps["modeConfig"];
|
|
4
|
-
export declare const defaultFieldNames: HSelectProps["fieldNames"];
|
|
5
4
|
export declare const defaultSelectConfig: {
|
|
6
5
|
noMatchItemRender: () => JSX.Element;
|
|
7
6
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// welcome to
|
|
1
|
+
// welcome to hoo hoo hoo
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import _mapInstanceProperty from '@babel/runtime-corejs3/core-js/instance/map';
|
|
4
4
|
import _indexOfInstanceProperty from '@babel/runtime-corejs3/core-js/instance/index-of';
|
|
@@ -21,10 +21,6 @@ var defaultModeConfig = {
|
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
};
|
|
24
|
-
var defaultFieldNames = {
|
|
25
|
-
label: "label",
|
|
26
|
-
value: "value"
|
|
27
|
-
};
|
|
28
24
|
var defaultSelectConfig = {
|
|
29
25
|
noMatchItemRender: function noMatchItemRender() {
|
|
30
26
|
return /*#__PURE__*/React.createElement(NoFindItem, {
|
|
@@ -33,5 +29,5 @@ var defaultSelectConfig = {
|
|
|
33
29
|
}
|
|
34
30
|
};
|
|
35
31
|
|
|
36
|
-
export {
|
|
37
|
-
// powered by
|
|
32
|
+
export { defaultModeConfig, defaultSelectConfig };
|
|
33
|
+
// powered by hdj
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// welcome to
|
|
1
|
+
// welcome to hoo hoo hoo
|
|
2
2
|
import _Object$keys from '@babel/runtime-corejs3/core-js/object/keys';
|
|
3
3
|
import _Object$getOwnPropertySymbols from '@babel/runtime-corejs3/core-js/object/get-own-property-symbols';
|
|
4
4
|
import _filterInstanceProperty from '@babel/runtime-corejs3/core-js/instance/filter';
|
|
@@ -14,6 +14,7 @@ import _forEachInstanceProperty from '@babel/runtime-corejs3/core-js/instance/fo
|
|
|
14
14
|
import _mapInstanceProperty from '@babel/runtime-corejs3/core-js/instance/map';
|
|
15
15
|
import _Array$isArray from '@babel/runtime-corejs3/core-js/array/is-array';
|
|
16
16
|
import { useState, useEffect } from 'react';
|
|
17
|
+
import { itemOpProvider } from '../utils.js';
|
|
17
18
|
|
|
18
19
|
var _excluded = ["index"],
|
|
19
20
|
_excluded2 = ["index"];
|
|
@@ -152,12 +153,14 @@ var useValueChange = function useValueChange(params) {
|
|
|
152
153
|
value = params.value,
|
|
153
154
|
options = params.options,
|
|
154
155
|
mode = params.mode,
|
|
155
|
-
noMatchItemRender = params.noMatchItemRender
|
|
156
|
+
noMatchItemRender = params.noMatchItemRender,
|
|
157
|
+
_params$fieldNames = params.fieldNames,
|
|
158
|
+
fieldNames = _params$fieldNames === void 0 ? {} : _params$fieldNames;
|
|
156
159
|
var _useState = useState(),
|
|
157
160
|
_useState2 = _slicedToArray(_useState, 2),
|
|
158
161
|
val = _useState2[0],
|
|
159
162
|
setVal = _useState2[1];
|
|
160
|
-
var change = function change(changeVal) {
|
|
163
|
+
var change = function change(changeVal, itemOps) {
|
|
161
164
|
if (!onChange) {
|
|
162
165
|
setVal(changeVal);
|
|
163
166
|
return;
|
|
@@ -171,7 +174,8 @@ var useValueChange = function useValueChange(params) {
|
|
|
171
174
|
return item.value;
|
|
172
175
|
});
|
|
173
176
|
}
|
|
174
|
-
|
|
177
|
+
var subItemOps = itemOpProvider(itemOps, fieldNames);
|
|
178
|
+
onChange(newChangeVal, subItemOps);
|
|
175
179
|
};
|
|
176
180
|
useEffect(function () {
|
|
177
181
|
if (options && value) {
|
|
@@ -187,4 +191,4 @@ var useValueChange = function useValueChange(params) {
|
|
|
187
191
|
};
|
|
188
192
|
|
|
189
193
|
export { useValueChange };
|
|
190
|
-
// powered by
|
|
194
|
+
// powered by hdj
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import type { OptionType, PartialHSelectProps } from "@/components/Select/modal";
|
|
2
|
-
export declare const useOptionReq: ({ manual,
|
|
3
|
-
run: (params?: any, type?: any) => Promise<
|
|
4
|
-
label: any;
|
|
5
|
-
value: any;
|
|
6
|
-
}[] | undefined>;
|
|
2
|
+
export declare const useOptionReq: ({ manual, request, options, serviceSearch, showSearch, onSearch: propsOnSearch, }: PartialHSelectProps) => {
|
|
3
|
+
run: (params?: any, type?: any) => Promise<OptionType[] | undefined>;
|
|
7
4
|
loading: boolean;
|
|
8
5
|
error: Error | undefined;
|
|
9
6
|
data: OptionType[] | undefined;
|
|
10
|
-
onSearch: (
|
|
7
|
+
onSearch: ((value: string) => void) | undefined;
|
|
8
|
+
mathShowSearch: boolean | undefined;
|
|
11
9
|
};
|
|
12
10
|
export declare const useFilterOption: ({ filterOption, serviceSearch, }: PartialHSelectProps) => boolean | import("rc-select/lib/Select").FilterFunc<import("rc-select/lib/Select").DefaultOptionType> | undefined;
|
|
@@ -1,31 +1,18 @@
|
|
|
1
|
-
// welcome to
|
|
1
|
+
// welcome to hoo hoo hoo
|
|
2
2
|
import _asyncToGenerator from '@babel/runtime-corejs3/helpers/asyncToGenerator';
|
|
3
3
|
import _slicedToArray from '@babel/runtime-corejs3/helpers/slicedToArray';
|
|
4
4
|
import _regeneratorRuntime from '@babel/runtime-corejs3/regenerator';
|
|
5
|
-
import _mapInstanceProperty from '@babel/runtime-corejs3/core-js/instance/map';
|
|
6
5
|
import _Promise from '@babel/runtime-corejs3/core-js/promise';
|
|
7
6
|
import { useState } from 'react';
|
|
8
7
|
import { useRequest } from 'ahooks';
|
|
9
8
|
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
return {
|
|
18
|
-
label: item[label],
|
|
19
|
-
value: item[value]
|
|
20
|
-
};
|
|
21
|
-
});
|
|
22
|
-
};
|
|
23
|
-
var useOptionReq = function useOptionReq(_ref2) {
|
|
24
|
-
var manual = _ref2.manual,
|
|
25
|
-
fieldNames = _ref2.fieldNames,
|
|
26
|
-
request = _ref2.request,
|
|
27
|
-
options = _ref2.options,
|
|
28
|
-
serviceSearch = _ref2.serviceSearch;
|
|
9
|
+
var useOptionReq = function useOptionReq(_ref) {
|
|
10
|
+
var manual = _ref.manual,
|
|
11
|
+
request = _ref.request,
|
|
12
|
+
options = _ref.options,
|
|
13
|
+
serviceSearch = _ref.serviceSearch,
|
|
14
|
+
showSearch = _ref.showSearch,
|
|
15
|
+
propsOnSearch = _ref.onSearch;
|
|
29
16
|
var _useState = useState(),
|
|
30
17
|
_useState2 = _slicedToArray(_useState, 2),
|
|
31
18
|
data = _useState2[0],
|
|
@@ -33,8 +20,6 @@ var useOptionReq = function useOptionReq(_ref2) {
|
|
|
33
20
|
var _useRequest = useRequest( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
34
21
|
var params,
|
|
35
22
|
type,
|
|
36
|
-
result,
|
|
37
|
-
resultOpt,
|
|
38
23
|
_args = arguments;
|
|
39
24
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
40
25
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -45,18 +30,13 @@ var useOptionReq = function useOptionReq(_ref2) {
|
|
|
45
30
|
setData(undefined);
|
|
46
31
|
}
|
|
47
32
|
if (!request) {
|
|
48
|
-
_context.next =
|
|
33
|
+
_context.next = 5;
|
|
49
34
|
break;
|
|
50
35
|
}
|
|
51
|
-
_context.
|
|
52
|
-
|
|
36
|
+
return _context.abrupt("return", request(params));
|
|
37
|
+
case 5:
|
|
38
|
+
return _context.abrupt("return", _Promise.resolve(options));
|
|
53
39
|
case 6:
|
|
54
|
-
result = _context.sent;
|
|
55
|
-
return _context.abrupt("return", resultProvider(result, fieldNames));
|
|
56
|
-
case 8:
|
|
57
|
-
resultOpt = resultProvider(options, fieldNames);
|
|
58
|
-
return _context.abrupt("return", _Promise.resolve(resultOpt));
|
|
59
|
-
case 10:
|
|
60
40
|
case "end":
|
|
61
41
|
return _context.stop();
|
|
62
42
|
}
|
|
@@ -73,23 +53,26 @@ var useOptionReq = function useOptionReq(_ref2) {
|
|
|
73
53
|
error = _useRequest.error;
|
|
74
54
|
var onSearch = function onSearch(inputValue) {
|
|
75
55
|
if (!serviceSearch) {
|
|
56
|
+
propsOnSearch === null || propsOnSearch === void 0 ? void 0 : propsOnSearch(inputValue);
|
|
76
57
|
return;
|
|
77
58
|
}
|
|
78
59
|
run({
|
|
79
60
|
inputValue: inputValue
|
|
80
61
|
});
|
|
81
62
|
};
|
|
63
|
+
var mathShowSearch = showSearch || serviceSearch;
|
|
82
64
|
return {
|
|
83
65
|
run: run,
|
|
84
66
|
loading: loading,
|
|
85
67
|
error: error,
|
|
86
68
|
data: data,
|
|
87
|
-
onSearch: onSearch
|
|
69
|
+
onSearch: mathShowSearch ? onSearch : propsOnSearch,
|
|
70
|
+
mathShowSearch: showSearch || serviceSearch
|
|
88
71
|
};
|
|
89
72
|
};
|
|
90
|
-
var useFilterOption = function useFilterOption(
|
|
91
|
-
var filterOption =
|
|
92
|
-
serviceSearch =
|
|
73
|
+
var useFilterOption = function useFilterOption(_ref3) {
|
|
74
|
+
var filterOption = _ref3.filterOption,
|
|
75
|
+
serviceSearch = _ref3.serviceSearch;
|
|
93
76
|
if (serviceSearch) {
|
|
94
77
|
return function () {
|
|
95
78
|
return true;
|
|
@@ -99,4 +82,4 @@ var useFilterOption = function useFilterOption(_ref4) {
|
|
|
99
82
|
};
|
|
100
83
|
|
|
101
84
|
export { useFilterOption, useOptionReq };
|
|
102
|
-
// powered by
|
|
85
|
+
// powered by hdj
|
package/es/Select/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { HSelectProps } from "./modal";
|
|
3
|
-
declare const _default: ({ style, mode, options, modeConfig, value, onChange, fieldNames, request, manual, optionLabelProp, filterProvider, optionFilterProp, serviceSearch, onSearch: propsOnSearch, filterOption, showSearch, labelInValue, noMatchItemRender, allSelect, ...props }: HSelectProps) => JSX.Element;
|
|
3
|
+
declare const _default: ({ style, mode, options, modeConfig, value, onChange, fieldNames: propsFieldNames, request, manual, optionLabelProp, filterProvider, optionFilterProp, serviceSearch, onSearch: propsOnSearch, filterOption, showSearch, labelInValue, noMatchItemRender, allSelect, ...props }: HSelectProps) => JSX.Element;
|
|
4
4
|
export default _default;
|
package/es/Select/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// welcome to
|
|
1
|
+
// welcome to hoo hoo hoo
|
|
2
2
|
import _extends from '@babel/runtime-corejs3/helpers/extends';
|
|
3
3
|
import _defineProperty from '@babel/runtime-corejs3/helpers/defineProperty';
|
|
4
4
|
import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/objectWithoutProperties';
|
|
@@ -7,13 +7,14 @@ import { Select } from 'antd';
|
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import { useFilterOption, useOptionReq } from './hooks/norHooks.js';
|
|
9
9
|
import { useValueChange } from './hooks/changeHooks.js';
|
|
10
|
-
import { defaultModeConfig,
|
|
10
|
+
import { defaultModeConfig, defaultSelectConfig } from './defaultConfig.js';
|
|
11
11
|
import Index from './components/DropdownComponent.js';
|
|
12
|
-
import
|
|
12
|
+
import Index$1 from './components/AllSelect.js';
|
|
13
|
+
import { useMatchConfigProps, useChangeOptions } from '../hooks/index.js';
|
|
13
14
|
|
|
14
15
|
var _excluded = ["style", "mode", "options", "modeConfig", "value", "onChange", "fieldNames", "request", "manual", "optionLabelProp", "filterProvider", "optionFilterProp", "serviceSearch", "onSearch", "filterOption", "showSearch", "labelInValue", "noMatchItemRender", "allSelect"];
|
|
15
16
|
var Option = Select.Option;
|
|
16
|
-
var
|
|
17
|
+
var HSelect = (function (_ref) {
|
|
17
18
|
var _ref$style = _ref.style,
|
|
18
19
|
style = _ref$style === void 0 ? {
|
|
19
20
|
width: "100%"
|
|
@@ -24,15 +25,14 @@ var index = (function (_ref) {
|
|
|
24
25
|
modeConfig = _ref$modeConfig === void 0 ? defaultModeConfig : _ref$modeConfig,
|
|
25
26
|
value = _ref.value,
|
|
26
27
|
onChange = _ref.onChange,
|
|
27
|
-
|
|
28
|
-
fieldNames = _ref$fieldNames === void 0 ? defaultFieldNames : _ref$fieldNames,
|
|
28
|
+
propsFieldNames = _ref.fieldNames,
|
|
29
29
|
request = _ref.request,
|
|
30
30
|
manual = _ref.manual,
|
|
31
31
|
_ref$optionLabelProp = _ref.optionLabelProp,
|
|
32
32
|
optionLabelProp = _ref$optionLabelProp === void 0 ? "label" : _ref$optionLabelProp,
|
|
33
33
|
filterProvider = _ref.filterProvider,
|
|
34
34
|
_ref$optionFilterProp = _ref.optionFilterProp,
|
|
35
|
-
optionFilterProp = _ref$optionFilterProp === void 0 ? "
|
|
35
|
+
optionFilterProp = _ref$optionFilterProp === void 0 ? "filterLabel" : _ref$optionFilterProp,
|
|
36
36
|
serviceSearch = _ref.serviceSearch,
|
|
37
37
|
propsOnSearch = _ref.onSearch,
|
|
38
38
|
filterOption = _ref.filterOption,
|
|
@@ -45,6 +45,10 @@ var index = (function (_ref) {
|
|
|
45
45
|
var _ref2 = (modeConfig === null || modeConfig === void 0 ? void 0 : modeConfig[mode || ""]) || {},
|
|
46
46
|
icon = _ref2.icon,
|
|
47
47
|
render = _ref2.render;
|
|
48
|
+
var _useMatchConfigProps = useMatchConfigProps({
|
|
49
|
+
fieldNames: propsFieldNames
|
|
50
|
+
}),
|
|
51
|
+
fieldNames = _useMatchConfigProps.fieldNames;
|
|
48
52
|
var selfFilterOption = useFilterOption({
|
|
49
53
|
filterOption: filterOption,
|
|
50
54
|
serviceSearch: serviceSearch
|
|
@@ -54,20 +58,28 @@ var index = (function (_ref) {
|
|
|
54
58
|
manual: manual,
|
|
55
59
|
fieldNames: fieldNames,
|
|
56
60
|
request: request,
|
|
57
|
-
serviceSearch: serviceSearch
|
|
61
|
+
serviceSearch: serviceSearch,
|
|
62
|
+
showSearch: showSearch,
|
|
63
|
+
onSearch: propsOnSearch
|
|
58
64
|
}),
|
|
59
65
|
run = _useOptionReq.run,
|
|
60
66
|
loading = _useOptionReq.loading,
|
|
61
|
-
|
|
67
|
+
resultData = _useOptionReq.data,
|
|
62
68
|
error = _useOptionReq.error,
|
|
63
|
-
onSearch = _useOptionReq.onSearch
|
|
69
|
+
onSearch = _useOptionReq.onSearch,
|
|
70
|
+
mathShowSearch = _useOptionReq.mathShowSearch;
|
|
71
|
+
var data = useChangeOptions({
|
|
72
|
+
options: resultData,
|
|
73
|
+
fieldNames: fieldNames
|
|
74
|
+
});
|
|
64
75
|
var _useValueChange = useValueChange({
|
|
65
76
|
labelInValue: labelInValue,
|
|
66
77
|
onChange: onChange,
|
|
67
78
|
value: value,
|
|
68
79
|
options: data,
|
|
69
80
|
mode: mode,
|
|
70
|
-
noMatchItemRender: noMatchItemRender
|
|
81
|
+
noMatchItemRender: noMatchItemRender,
|
|
82
|
+
fieldNames: fieldNames
|
|
71
83
|
}),
|
|
72
84
|
val = _useValueChange.val,
|
|
73
85
|
change = _useValueChange.change;
|
|
@@ -76,7 +88,7 @@ var index = (function (_ref) {
|
|
|
76
88
|
mode: mode,
|
|
77
89
|
loading: loading,
|
|
78
90
|
value: val,
|
|
79
|
-
onSearch:
|
|
91
|
+
onSearch: onSearch,
|
|
80
92
|
onChange: change,
|
|
81
93
|
dropdownRender: function dropdownRender(node) {
|
|
82
94
|
return /*#__PURE__*/React.createElement(Index, {
|
|
@@ -84,33 +96,33 @@ var index = (function (_ref) {
|
|
|
84
96
|
reload: run,
|
|
85
97
|
error: error,
|
|
86
98
|
options: data
|
|
87
|
-
}, /*#__PURE__*/React.createElement(
|
|
99
|
+
}, /*#__PURE__*/React.createElement(Index$1, {
|
|
88
100
|
allSelect: allSelect,
|
|
89
101
|
options: data,
|
|
90
102
|
mode: mode,
|
|
91
103
|
value: val,
|
|
92
104
|
onChange: change
|
|
93
|
-
}
|
|
105
|
+
}, node));
|
|
94
106
|
},
|
|
95
107
|
optionLabelProp: optionLabelProp,
|
|
96
108
|
menuItemSelectedIcon: icon,
|
|
97
109
|
optionFilterProp: optionFilterProp,
|
|
98
110
|
filterOption: selfFilterOption,
|
|
99
|
-
showSearch:
|
|
111
|
+
showSearch: mathShowSearch,
|
|
100
112
|
labelInValue: true
|
|
101
113
|
}, props), data === null || data === void 0 ? void 0 : _mapInstanceProperty(data).call(data, function (item) {
|
|
102
114
|
var optionValue = item.value,
|
|
103
115
|
label = item.label;
|
|
104
116
|
var result = (filterProvider === null || filterProvider === void 0 ? void 0 : filterProvider(item)) || label;
|
|
105
|
-
var
|
|
117
|
+
var filter = _defineProperty({}, optionFilterProp, result);
|
|
106
118
|
return /*#__PURE__*/React.createElement(Option, _extends({
|
|
107
119
|
value: optionValue,
|
|
108
120
|
key: optionValue,
|
|
109
121
|
label: label,
|
|
110
122
|
mode: mode
|
|
111
|
-
},
|
|
123
|
+
}, filter), render ? render(item, val) : label);
|
|
112
124
|
}));
|
|
113
125
|
});
|
|
114
126
|
|
|
115
|
-
export {
|
|
116
|
-
// powered by
|
|
127
|
+
export { HSelect as default };
|
|
128
|
+
// powered by hdj
|
package/es/Select/modal.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { SelectProps } from "antd";
|
|
2
2
|
import type React from "react";
|
|
3
|
+
import type { PromiseFnResult } from "../modal";
|
|
3
4
|
export type OptionType = Record<string, any>;
|
|
4
5
|
export type PartialHSelectProps = Partial<HSelectProps>;
|
|
5
6
|
export type RenderFn = (data: OptionType) => React.ReactNode;
|
|
@@ -13,10 +14,9 @@ export interface ModeConfig {
|
|
|
13
14
|
}
|
|
14
15
|
export interface HSelectProps extends Omit<SelectProps, "options"> {
|
|
15
16
|
style?: React.CSSProperties;
|
|
16
|
-
request?:
|
|
17
|
+
request?: PromiseFnResult<any, OptionType[]>;
|
|
17
18
|
manual?: boolean;
|
|
18
19
|
modeConfig?: ModeConfig;
|
|
19
|
-
onChange?: (val: any) => void;
|
|
20
20
|
filterProvider?: (item: any) => string;
|
|
21
21
|
serviceSearch?: boolean;
|
|
22
22
|
options?: OptionType[];
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// welcome to hoo hoo hoo
|
|
2
|
+
import _Object$keys from '@babel/runtime-corejs3/core-js/object/keys';
|
|
3
|
+
import _Object$getOwnPropertySymbols from '@babel/runtime-corejs3/core-js/object/get-own-property-symbols';
|
|
4
|
+
import _filterInstanceProperty from '@babel/runtime-corejs3/core-js/instance/filter';
|
|
5
|
+
import _Object$getOwnPropertyDescriptor from '@babel/runtime-corejs3/core-js/object/get-own-property-descriptor';
|
|
6
|
+
import _forEachInstanceProperty from '@babel/runtime-corejs3/core-js/instance/for-each';
|
|
7
|
+
import _Object$getOwnPropertyDescriptors from '@babel/runtime-corejs3/core-js/object/get-own-property-descriptors';
|
|
8
|
+
import _Object$defineProperties from '@babel/runtime-corejs3/core-js/object/define-properties';
|
|
9
|
+
import _Object$defineProperty from '@babel/runtime-corejs3/core-js/object/define-property';
|
|
10
|
+
import _defineProperty from '@babel/runtime-corejs3/helpers/defineProperty';
|
|
11
|
+
import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/objectWithoutProperties';
|
|
12
|
+
import _Array$isArray from '@babel/runtime-corejs3/core-js/array/is-array';
|
|
13
|
+
import _mapInstanceProperty from '@babel/runtime-corejs3/core-js/instance/map';
|
|
14
|
+
|
|
15
|
+
var _excluded = ["label", "value"];
|
|
16
|
+
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; }
|
|
17
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
18
|
+
var itemOpMaker = function itemOpMaker(itemOp, fieldNames) {
|
|
19
|
+
var _objectSpread2;
|
|
20
|
+
var label = itemOp.label,
|
|
21
|
+
itemVal = itemOp.value,
|
|
22
|
+
oItemOp = _objectWithoutProperties(itemOp, _excluded);
|
|
23
|
+
var _fieldNames$label = fieldNames.label,
|
|
24
|
+
labelKey = _fieldNames$label === void 0 ? "" : _fieldNames$label,
|
|
25
|
+
_fieldNames$value = fieldNames.value,
|
|
26
|
+
valKey = _fieldNames$value === void 0 ? "" : _fieldNames$value;
|
|
27
|
+
return _objectSpread((_objectSpread2 = {}, _defineProperty(_objectSpread2, labelKey, label), _defineProperty(_objectSpread2, valKey, itemVal), _objectSpread2), oItemOp);
|
|
28
|
+
};
|
|
29
|
+
var itemOpProvider = function itemOpProvider(itemOps, fieldNames) {
|
|
30
|
+
if (_Array$isArray(itemOps)) {
|
|
31
|
+
return _mapInstanceProperty(itemOps).call(itemOps, function (item) {
|
|
32
|
+
return itemOpMaker(item, fieldNames);
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
return itemOpMaker(itemOps, fieldNames);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export { itemOpMaker, itemOpProvider };
|
|
39
|
+
// powered by hdj
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { ButtonProps, FormInstance } from "antd/es";
|
|
3
|
+
export interface ISubmitProps extends Omit<ButtonProps, "form"> {
|
|
4
|
+
text?: string;
|
|
5
|
+
form: FormInstance;
|
|
6
|
+
}
|
|
7
|
+
declare const _default: ({ text, type, form, loading, ...props }: ISubmitProps) => JSX.Element;
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// welcome to hoo hoo hoo
|
|
2
|
+
import _extends from '@babel/runtime-corejs3/helpers/extends';
|
|
3
|
+
import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/objectWithoutProperties';
|
|
4
|
+
import { Button } from 'antd';
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import { useFormContext } from '../Form/Context/index.js';
|
|
7
|
+
|
|
8
|
+
var _excluded = ["text", "type", "form", "loading"];
|
|
9
|
+
var HSubmit = (function (_ref) {
|
|
10
|
+
var _ref$text = _ref.text,
|
|
11
|
+
text = _ref$text === void 0 ? "提交" : _ref$text,
|
|
12
|
+
_ref$type = _ref.type,
|
|
13
|
+
type = _ref$type === void 0 ? "primary" : _ref$type,
|
|
14
|
+
form = _ref.form,
|
|
15
|
+
loading = _ref.loading,
|
|
16
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
17
|
+
var _useFormContext = useFormContext(),
|
|
18
|
+
_useFormContext$loadi = _useFormContext.loading,
|
|
19
|
+
formSubLoading = _useFormContext$loadi === void 0 ? loading : _useFormContext$loadi;
|
|
20
|
+
return /*#__PURE__*/React.createElement(Button, _extends({}, props, {
|
|
21
|
+
type: type,
|
|
22
|
+
onClick: form.submit,
|
|
23
|
+
loading: formSubLoading
|
|
24
|
+
}), text);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
export { HSubmit as default };
|
|
28
|
+
// powered by hdj
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { SwitchProps } from "antd";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import type { ValueSwitchMapModal } from "../modal";
|
|
4
|
+
export interface HSwitchProps extends Omit<SwitchProps, "onChange"> {
|
|
5
|
+
valueMap?: ValueSwitchMapModal;
|
|
6
|
+
value?: any;
|
|
7
|
+
onChange?: (val: any) => void;
|
|
8
|
+
beforeText?: React.ReactNode;
|
|
9
|
+
}
|
|
10
|
+
declare const Index: React.FC<HSwitchProps>;
|
|
11
|
+
export default Index;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// welcome to hoo hoo hoo
|
|
2
|
+
import _extends from '@babel/runtime-corejs3/helpers/extends';
|
|
3
|
+
import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/objectWithoutProperties';
|
|
4
|
+
import { Space, Switch } from 'antd';
|
|
5
|
+
import React, { useMemo } from 'react';
|
|
6
|
+
import { useMatchConfigProps } from '../hooks/index.js';
|
|
7
|
+
|
|
8
|
+
var _excluded = ["value", "onChange", "valueMap", "children", "unCheckedChildren", "checkedChildren", "beforeText"];
|
|
9
|
+
var Index = function Index(_ref) {
|
|
10
|
+
var value = _ref.value,
|
|
11
|
+
onChange = _ref.onChange,
|
|
12
|
+
propsValueSwitchMap = _ref.valueMap,
|
|
13
|
+
children = _ref.children,
|
|
14
|
+
_ref$unCheckedChildre = _ref.unCheckedChildren,
|
|
15
|
+
unCheckedChildren = _ref$unCheckedChildre === void 0 ? "关闭" : _ref$unCheckedChildre,
|
|
16
|
+
_ref$checkedChildren = _ref.checkedChildren,
|
|
17
|
+
checkedChildren = _ref$checkedChildren === void 0 ? "开启" : _ref$checkedChildren,
|
|
18
|
+
beforeText = _ref.beforeText,
|
|
19
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
20
|
+
var _useMatchConfigProps = useMatchConfigProps({
|
|
21
|
+
valueSwitchMap: propsValueSwitchMap
|
|
22
|
+
}),
|
|
23
|
+
_useMatchConfigProps$ = _useMatchConfigProps.valueSwitchMap,
|
|
24
|
+
valueSwitchMap = _useMatchConfigProps$ === void 0 ? {} : _useMatchConfigProps$;
|
|
25
|
+
var swChecked = useMemo(function () {
|
|
26
|
+
var open = valueSwitchMap.open;
|
|
27
|
+
return value === open;
|
|
28
|
+
}, [value]);
|
|
29
|
+
var change = function change(checked) {
|
|
30
|
+
var subVal = valueSwitchMap.close;
|
|
31
|
+
if (checked) {
|
|
32
|
+
subVal = valueSwitchMap.open;
|
|
33
|
+
}
|
|
34
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(subVal);
|
|
35
|
+
};
|
|
36
|
+
return /*#__PURE__*/React.createElement(Space, null, beforeText, /*#__PURE__*/React.createElement(Switch, _extends({
|
|
37
|
+
checked: swChecked,
|
|
38
|
+
checkedChildren: checkedChildren,
|
|
39
|
+
unCheckedChildren: unCheckedChildren,
|
|
40
|
+
onChange: change
|
|
41
|
+
}, props)), /*#__PURE__*/React.createElement("span", null, children));
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export { Index as default };
|
|
45
|
+
// powered by hdj
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { HItemProps } from "../Form/modal";
|
|
3
|
+
declare const _default: {
|
|
4
|
+
Component: React.ForwardRefExoticComponent<import("../Form/modal").HFormItemProps & React.RefAttributes<any>>;
|
|
5
|
+
placeholder: ({ label }: HItemProps) => string[];
|
|
6
|
+
requiredErrMsg: ({ label }: HItemProps) => string;
|
|
7
|
+
};
|
|
8
|
+
export default _default;
|