@hw-component/form 0.0.1-bate → 0.0.1-beta
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.js +24 -16
- package/es/CheckboxGroup/hooks.d.ts +9 -3
- package/es/CheckboxGroup/hooks.js +115 -64
- package/es/CheckboxGroup/index.d.ts +6 -1
- package/es/CheckboxGroup/index.js +117 -56
- package/es/CheckboxGroup/modal.d.ts +9 -8
- package/es/Form/Context/FormConfigProvider.js +64 -19
- package/es/Form/Context/index.d.ts +4 -1
- package/es/Form/Context/index.js +3 -3
- package/es/Form/FormItem/BasicItem.js +80 -42
- package/es/Form/FormItem/Helper.d.ts +1 -1
- package/es/Form/FormItem/Helper.js +17 -9
- package/es/Form/FormItem/RegularFormItem.js +11 -8
- package/es/Form/FormItem/UpFormItem.d.ts +6 -1
- package/es/Form/FormItem/UpFormItem.js +27 -17
- package/es/Form/FormItem/hooks.d.ts +21 -4
- package/es/Form/FormItem/hooks.js +12 -9
- package/es/Form/FormItem/index.js +5 -5
- package/es/Form/HFormConnect.d.ts +9 -1
- package/es/Form/HFormConnect.js +94 -26
- package/es/Form/InitSet.d.ts +1 -1
- package/es/Form/InitSet.js +5 -5
- package/es/Form/Label.d.ts +4 -4
- package/es/Form/Label.js +36 -19
- package/es/Form/config.d.ts +100 -22
- package/es/Form/config.js +19 -19
- package/es/Form/hooks/index.d.ts +12 -5
- package/es/Form/hooks/index.js +65 -49
- package/es/Form/hooks/useHForm.js +233 -95
- package/es/Form/hooks/useInitConfigData.d.ts +4 -1
- package/es/Form/hooks/useInitConfigData.js +143 -61
- package/es/Form/index.d.ts +11 -1
- package/es/Form/index.js +71 -40
- package/es/Form/modal.d.ts +92 -51
- package/es/Input/ButtonInput.js +73 -51
- package/es/Input/InputNumber.js +21 -12
- package/es/Input/SelectInput.d.ts +16 -4
- package/es/Input/SelectInput.js +113 -56
- package/es/Input/defaultConfig.d.ts +3 -3
- package/es/Input/defaultConfig.js +2 -2
- package/es/Input/index.js +7 -7
- package/es/Input/modal.d.ts +15 -11
- package/es/PageHandler/ErrorComponent.js +47 -25
- package/es/PageHandler/LoadingComponent.js +17 -13
- package/es/PageHandler/index.js +7 -7
- package/es/PageHandler/modal.d.ts +4 -4
- package/es/RadioGroup/index.d.ts +12 -5
- package/es/RadioGroup/index.js +46 -33
- package/es/Select/components/AllSelect.d.ts +1 -1
- package/es/Select/components/AllSelect.js +40 -18
- package/es/Select/components/CheckBoxOption.d.ts +6 -3
- package/es/Select/components/CheckBoxOption.js +12 -7
- package/es/Select/components/DropdownComponent.d.ts +4 -4
- package/es/Select/components/DropdownComponent.js +30 -17
- package/es/Select/components/NoFindItem.d.ts +1 -1
- package/es/Select/components/NoFindItem.js +11 -7
- package/es/Select/components/NotFoundContent.d.ts +2 -2
- package/es/Select/components/NotFoundContent.js +49 -27
- package/es/Select/defaultConfig.d.ts +1 -1
- package/es/Select/defaultConfig.js +20 -16
- package/es/Select/hooks/changeHooks.d.ts +2 -2
- package/es/Select/hooks/changeHooks.js +147 -71
- package/es/Select/hooks/norHooks.d.ts +27 -9
- package/es/Select/hooks/norHooks.js +51 -39
- package/es/Select/index.d.ts +22 -1
- package/es/Select/index.js +124 -65
- package/es/Select/modal.d.ts +15 -15
- package/es/Select/utils.js +60 -15
- package/es/Submit/index.d.ts +9 -3
- package/es/Submit/index.js +18 -13
- package/es/Switch/index.d.ts +4 -4
- package/es/Switch/index.js +46 -20
- package/es/TDPicker/RangePicker.d.ts +8 -3
- package/es/TDPicker/RangePicker.js +138 -62
- package/es/TDPicker/TimePicker.d.ts +6 -1
- package/es/TDPicker/TimePicker.js +19 -13
- package/es/TDPicker/hooks.d.ts +42 -22
- package/es/TDPicker/hooks.js +106 -72
- package/es/TDPicker/index.d.ts +7 -1
- package/es/TDPicker/index.js +20 -14
- package/es/TDPicker/modal.d.ts +21 -16
- package/es/Upload/Btn.d.ts +5 -1
- package/es/Upload/Btn.js +35 -19
- package/es/Upload/MediaTypeEle/TypeEle.d.ts +10 -5
- package/es/Upload/MediaTypeEle/TypeEle.js +31 -23
- package/es/Upload/MediaTypeEle/index.d.ts +5 -1
- package/es/Upload/MediaTypeEle/index.js +21 -18
- package/es/Upload/Preview/index.d.ts +5 -1
- package/es/Upload/Preview/index.js +17 -13
- package/es/Upload/UrlUpload/index.d.ts +7 -1
- package/es/Upload/UrlUpload/index.js +72 -51
- package/es/Upload/enums.d.ts +3 -3
- package/es/Upload/enums.js +3 -3
- package/es/Upload/hooks/change.d.ts +8 -1
- package/es/Upload/hooks/change.js +115 -58
- package/es/Upload/hooks/customRequest.d.ts +5 -1
- package/es/Upload/hooks/customRequest.js +63 -46
- package/es/Upload/hooks/propsMaker.d.ts +5 -1
- package/es/Upload/hooks/propsMaker.js +52 -13
- package/es/Upload/index.d.ts +3 -1
- package/es/Upload/index.js +131 -61
- package/es/Upload/modal.d.ts +17 -15
- package/es/Upload/util.d.ts +8 -2
- package/es/Upload/util.js +15 -7
- package/es/config.js +34 -31
- package/es/hooks/index.d.ts +14 -7
- package/es/hooks/index.js +124 -49
- package/es/index.d.ts +98 -16
- package/es/index.js +22 -5
- package/es/modal.d.ts +6 -6
- package/lib/CheckboxGroup/CheckBox/index.js +26 -18
- package/lib/CheckboxGroup/hooks.d.ts +9 -3
- package/lib/CheckboxGroup/hooks.js +116 -65
- package/lib/CheckboxGroup/index.d.ts +6 -1
- package/lib/CheckboxGroup/index.js +119 -58
- package/lib/CheckboxGroup/modal.d.ts +9 -8
- package/lib/Form/Context/FormConfigProvider.js +66 -21
- package/lib/Form/Context/index.d.ts +4 -1
- package/lib/Form/Context/index.js +4 -4
- package/lib/Form/FormItem/BasicItem.js +82 -44
- package/lib/Form/FormItem/Helper.d.ts +1 -1
- package/lib/Form/FormItem/Helper.js +19 -11
- package/lib/Form/FormItem/RegularFormItem.js +13 -10
- package/lib/Form/FormItem/UpFormItem.d.ts +6 -1
- package/lib/Form/FormItem/UpFormItem.js +29 -19
- package/lib/Form/FormItem/hooks.d.ts +21 -4
- package/lib/Form/FormItem/hooks.js +13 -10
- package/lib/Form/FormItem/index.js +7 -7
- package/lib/Form/HFormConnect.d.ts +9 -1
- package/lib/Form/HFormConnect.js +96 -28
- package/lib/Form/InitSet.d.ts +1 -1
- package/lib/Form/InitSet.js +7 -7
- package/lib/Form/Label.d.ts +4 -4
- package/lib/Form/Label.js +41 -21
- package/lib/Form/config.d.ts +100 -22
- package/lib/Form/config.js +21 -21
- package/lib/Form/hooks/index.d.ts +12 -5
- package/lib/Form/hooks/index.js +66 -50
- package/lib/Form/hooks/useHForm.js +235 -97
- package/lib/Form/hooks/useInitConfigData.d.ts +4 -1
- package/lib/Form/hooks/useInitConfigData.js +144 -63
- package/lib/Form/index.d.ts +11 -1
- package/lib/Form/index.js +73 -42
- package/lib/Form/modal.d.ts +92 -51
- package/lib/Input/ButtonInput.js +75 -53
- package/lib/Input/InputNumber.js +23 -14
- package/lib/Input/SelectInput.d.ts +16 -4
- package/lib/Input/SelectInput.js +125 -60
- package/lib/Input/defaultConfig.d.ts +3 -3
- package/lib/Input/defaultConfig.js +3 -3
- package/lib/Input/index.js +9 -9
- package/lib/Input/modal.d.ts +15 -11
- package/lib/PageHandler/ErrorComponent.js +49 -27
- package/lib/PageHandler/LoadingComponent.js +19 -15
- package/lib/PageHandler/index.js +9 -9
- package/lib/PageHandler/modal.d.ts +4 -4
- package/lib/RadioGroup/index.d.ts +12 -5
- package/lib/RadioGroup/index.js +48 -35
- package/lib/Select/components/AllSelect.d.ts +1 -1
- package/lib/Select/components/AllSelect.js +42 -20
- package/lib/Select/components/CheckBoxOption.d.ts +6 -3
- package/lib/Select/components/CheckBoxOption.js +14 -9
- package/lib/Select/components/DropdownComponent.d.ts +4 -4
- package/lib/Select/components/DropdownComponent.js +32 -19
- package/lib/Select/components/NoFindItem.d.ts +1 -1
- package/lib/Select/components/NoFindItem.js +13 -9
- package/lib/Select/components/NotFoundContent.d.ts +2 -2
- package/lib/Select/components/NotFoundContent.js +51 -29
- package/lib/Select/defaultConfig.d.ts +1 -1
- package/lib/Select/defaultConfig.js +21 -17
- package/lib/Select/hooks/changeHooks.d.ts +2 -2
- package/lib/Select/hooks/changeHooks.js +148 -72
- package/lib/Select/hooks/norHooks.d.ts +27 -9
- package/lib/Select/hooks/norHooks.js +52 -40
- package/lib/Select/index.d.ts +22 -1
- package/lib/Select/index.js +128 -67
- package/lib/Select/modal.d.ts +15 -15
- package/lib/Select/utils.js +61 -16
- package/lib/Submit/index.d.ts +9 -3
- package/lib/Submit/index.js +20 -15
- package/lib/Switch/index.d.ts +4 -4
- package/lib/Switch/index.js +48 -22
- package/lib/TDPicker/RangePicker.d.ts +8 -3
- package/lib/TDPicker/RangePicker.js +136 -64
- package/lib/TDPicker/TimePicker.d.ts +6 -1
- package/lib/TDPicker/TimePicker.js +21 -15
- package/lib/TDPicker/hooks.d.ts +42 -22
- package/lib/TDPicker/hooks.js +98 -72
- package/lib/TDPicker/index.d.ts +7 -1
- package/lib/TDPicker/index.js +22 -16
- package/lib/TDPicker/modal.d.ts +21 -16
- package/lib/Upload/Btn.d.ts +5 -1
- package/lib/Upload/Btn.js +37 -21
- package/lib/Upload/MediaTypeEle/TypeEle.d.ts +10 -5
- package/lib/Upload/MediaTypeEle/TypeEle.js +33 -25
- package/lib/Upload/MediaTypeEle/index.d.ts +5 -1
- package/lib/Upload/MediaTypeEle/index.js +23 -20
- package/lib/Upload/Preview/index.d.ts +5 -1
- package/lib/Upload/Preview/index.js +19 -15
- package/lib/Upload/UrlUpload/index.d.ts +7 -1
- package/lib/Upload/UrlUpload/index.js +74 -53
- package/lib/Upload/enums.d.ts +3 -3
- package/lib/Upload/enums.js +4 -4
- package/lib/Upload/hooks/change.d.ts +8 -1
- package/lib/Upload/hooks/change.js +116 -59
- package/lib/Upload/hooks/customRequest.d.ts +5 -1
- package/lib/Upload/hooks/customRequest.js +64 -47
- package/lib/Upload/hooks/propsMaker.d.ts +5 -1
- package/lib/Upload/hooks/propsMaker.js +55 -15
- package/lib/Upload/index.d.ts +3 -1
- package/lib/Upload/index.js +133 -63
- package/lib/Upload/modal.d.ts +17 -15
- package/lib/Upload/util.d.ts +8 -2
- package/lib/Upload/util.js +16 -8
- package/lib/config.js +35 -32
- package/lib/hooks/index.d.ts +14 -7
- package/lib/hooks/index.js +125 -50
- package/lib/index.d.ts +98 -16
- package/lib/index.js +5 -5
- package/lib/modal.d.ts +6 -6
- package/package.json +2 -2
- package/src/components/CheckboxGroup/index.tsx +2 -2
- package/src/components/Form/FormItem/Helper.tsx +3 -4
- package/src/components/Form/HFormConnect.tsx +6 -2
- package/src/components/Form/hooks/useHForm.ts +59 -10
- package/src/components/Form/modal.ts +12 -8
- package/src/components/TDPicker/RangePicker.tsx +7 -5
- package/src/components/TDPicker/modal.ts +1 -0
- package/src/pages/Form/index.tsx +2 -2
package/es/index.d.ts
CHANGED
|
@@ -2,19 +2,101 @@
|
|
|
2
2
|
import "./styles/index.less";
|
|
3
3
|
export { default as HForm } from "./Form";
|
|
4
4
|
export { default as useHForm } from "./Form/hooks/useHForm";
|
|
5
|
-
export declare const HSelect: ({
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
5
|
+
export declare const HSelect: ({
|
|
6
|
+
style,
|
|
7
|
+
mode,
|
|
8
|
+
options,
|
|
9
|
+
modeConfig,
|
|
10
|
+
value,
|
|
11
|
+
onChange,
|
|
12
|
+
fieldNames: propsFieldNames,
|
|
13
|
+
request,
|
|
14
|
+
manual,
|
|
15
|
+
optionLabelProp,
|
|
16
|
+
filterProvider,
|
|
17
|
+
optionFilterProp,
|
|
18
|
+
serviceSearch,
|
|
19
|
+
onSearch: propsOnSearch,
|
|
20
|
+
filterOption,
|
|
21
|
+
showSearch,
|
|
22
|
+
labelInValue,
|
|
23
|
+
noMatchItemRender,
|
|
24
|
+
allSelect,
|
|
25
|
+
...props
|
|
26
|
+
}: import("./Select/modal").HSelectProps) => JSX.Element;
|
|
27
|
+
export declare const HInput: ({
|
|
28
|
+
...props
|
|
29
|
+
}: import("antd").InputProps) => JSX.Element;
|
|
30
|
+
export declare const HSelectInput: ({
|
|
31
|
+
selectProps,
|
|
32
|
+
value,
|
|
33
|
+
onChange,
|
|
34
|
+
valueName,
|
|
35
|
+
...props
|
|
36
|
+
}: import("./Input/modal").HSelectInputProps) => JSX.Element;
|
|
37
|
+
export declare const HUpload: import("react").ForwardRefExoticComponent<
|
|
38
|
+
import("./Upload/modal").IUpLoadProps &
|
|
39
|
+
import("react").RefAttributes<import("./Upload/modal").IUploadRefModal>
|
|
40
|
+
>;
|
|
41
|
+
export declare const HUrlUpload: ({
|
|
42
|
+
placeholder,
|
|
43
|
+
value,
|
|
44
|
+
onChange,
|
|
45
|
+
mediaType,
|
|
46
|
+
...props
|
|
47
|
+
}: import("./Upload/modal").IUrlUploadProps) => JSX.Element;
|
|
48
|
+
export declare const HButtonInput: import("react").FC<
|
|
49
|
+
import("./Input/modal").HButtonInputProps
|
|
50
|
+
>;
|
|
51
|
+
export declare const HCheckBox: import("react").FC<
|
|
52
|
+
import("./CheckboxGroup/modal").HCheckboxProps
|
|
53
|
+
>;
|
|
54
|
+
export declare const HSwitch: import("react").FC<
|
|
55
|
+
import("./Switch").HSwitchProps
|
|
56
|
+
>;
|
|
57
|
+
export declare const HCheckboxGroup: (
|
|
58
|
+
props: import("./Form/modal").HFormItemProps
|
|
59
|
+
) => import("react").ReactElement<
|
|
60
|
+
import("./Form/modal").ConnectResultProps,
|
|
61
|
+
string | import("react").JSXElementConstructor<any>
|
|
62
|
+
>;
|
|
63
|
+
export declare const HDatePicker: ({
|
|
64
|
+
value,
|
|
65
|
+
onChange,
|
|
66
|
+
showTime,
|
|
67
|
+
format,
|
|
68
|
+
...props
|
|
69
|
+
}: import("./TDPicker/modal").HDatePickerProps) => JSX.Element;
|
|
70
|
+
export declare const HRangePicker: ({
|
|
71
|
+
value,
|
|
72
|
+
onChange,
|
|
73
|
+
showTime,
|
|
74
|
+
format,
|
|
75
|
+
valueMap,
|
|
76
|
+
ranges,
|
|
77
|
+
name,
|
|
78
|
+
...props
|
|
79
|
+
}: import("./TDPicker/modal").HRangePickerProps) => JSX.Element;
|
|
80
|
+
export declare const HRadioGroup: ({
|
|
81
|
+
value,
|
|
82
|
+
options,
|
|
83
|
+
onChange,
|
|
84
|
+
fieldNames: propsFieldNames,
|
|
85
|
+
...props
|
|
86
|
+
}: import("./RadioGroup").HRadioGroupProps) => JSX.Element;
|
|
87
|
+
export declare const HTimePicker: ({
|
|
88
|
+
value,
|
|
89
|
+
format,
|
|
90
|
+
onChange,
|
|
91
|
+
...props
|
|
92
|
+
}: import("./TDPicker/modal").HTimePickerProps) => JSX.Element;
|
|
93
|
+
export declare const HInputNumber: ({
|
|
94
|
+
style,
|
|
95
|
+
...props
|
|
96
|
+
}: import("antd").InputNumberProps<string | number>) => JSX.Element;
|
|
97
|
+
export declare const HPageHandler: import("react").FC<
|
|
98
|
+
import("./PageHandler/modal").IHPageHandler<any>
|
|
99
|
+
>;
|
|
100
|
+
export declare const HFormConfigProvider: import("react").FC<
|
|
101
|
+
import("./Form/modal").IFormConfigContextProps
|
|
102
|
+
>;
|
package/es/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// welcome to hoo hoo hoo
|
|
2
|
-
import FormConfig from
|
|
3
|
-
import Index from
|
|
4
|
-
export { default as HForm } from
|
|
5
|
-
export { default as useHForm } from
|
|
2
|
+
import FormConfig from "./Form/config.js";
|
|
3
|
+
import Index from "./PageHandler/index.js";
|
|
4
|
+
export { default as HForm } from "./Form/index.js";
|
|
5
|
+
export { default as useHForm } from "./Form/hooks/useHForm.js";
|
|
6
6
|
|
|
7
7
|
var HSelect = FormConfig.select;
|
|
8
8
|
var HInput = FormConfig.input;
|
|
@@ -21,5 +21,22 @@ var HInputNumber = FormConfig.inputNumber;
|
|
|
21
21
|
var HPageHandler = Index;
|
|
22
22
|
var HFormConfigProvider = FormConfig.formConfigProvider;
|
|
23
23
|
|
|
24
|
-
export {
|
|
24
|
+
export {
|
|
25
|
+
HButtonInput,
|
|
26
|
+
HCheckBox,
|
|
27
|
+
HCheckboxGroup,
|
|
28
|
+
HDatePicker,
|
|
29
|
+
HFormConfigProvider,
|
|
30
|
+
HInput,
|
|
31
|
+
HInputNumber,
|
|
32
|
+
HPageHandler,
|
|
33
|
+
HRadioGroup,
|
|
34
|
+
HRangePicker,
|
|
35
|
+
HSelect,
|
|
36
|
+
HSelectInput,
|
|
37
|
+
HSwitch,
|
|
38
|
+
HTimePicker,
|
|
39
|
+
HUpload,
|
|
40
|
+
HUrlUpload,
|
|
41
|
+
};
|
|
25
42
|
// powered by hdj
|
package/es/modal.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
export interface ValueCheckMapModal {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
checked?: any;
|
|
3
|
+
noChecked?: any;
|
|
4
4
|
}
|
|
5
5
|
export type PromiseFnResult<T = any, R = any> = (params: T) => Promise<R>;
|
|
6
6
|
export interface ValueSwitchMapModal {
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
open?: any;
|
|
8
|
+
close?: any;
|
|
9
9
|
}
|
|
10
10
|
type NameProvider = (name: string) => string;
|
|
11
11
|
export interface DateRangePickerValueMapModal {
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
start?: string | NameProvider;
|
|
13
|
+
end?: string | NameProvider;
|
|
14
14
|
}
|
|
15
15
|
export {};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports,
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
|
|
5
|
-
var antd = require(
|
|
6
|
-
var React = require(
|
|
7
|
-
var index = require(
|
|
5
|
+
var antd = require("antd");
|
|
6
|
+
var React = require("react");
|
|
7
|
+
var index = require("../../hooks/index.js");
|
|
8
8
|
|
|
9
9
|
var Index = function Index(_ref) {
|
|
10
10
|
var value = _ref.value,
|
|
@@ -12,17 +12,21 @@ var Index = function Index(_ref) {
|
|
|
12
12
|
children = _ref.children,
|
|
13
13
|
propsValueCheckMap = _ref.valueMap;
|
|
14
14
|
var _useMatchConfigProps = index.useMatchConfigProps({
|
|
15
|
-
valueCheckMap: propsValueCheckMap
|
|
15
|
+
valueCheckMap: propsValueCheckMap,
|
|
16
16
|
}),
|
|
17
17
|
_useMatchConfigProps$ = _useMatchConfigProps.valueCheckMap,
|
|
18
|
-
valueCheckMap =
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
18
|
+
valueCheckMap =
|
|
19
|
+
_useMatchConfigProps$ === void 0 ? {} : _useMatchConfigProps$;
|
|
20
|
+
var checkedVal = React.useMemo(
|
|
21
|
+
function () {
|
|
22
|
+
var checked = valueCheckMap.checked;
|
|
23
|
+
if (value === checked) {
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
return false;
|
|
27
|
+
},
|
|
28
|
+
[value]
|
|
29
|
+
);
|
|
26
30
|
var change = function change(e) {
|
|
27
31
|
var checked = valueCheckMap.checked,
|
|
28
32
|
noChecked = valueCheckMap.noChecked;
|
|
@@ -33,10 +37,14 @@ var Index = function Index(_ref) {
|
|
|
33
37
|
}
|
|
34
38
|
onChange === null || onChange === void 0 ? void 0 : onChange(subVal);
|
|
35
39
|
};
|
|
36
|
-
return /*#__PURE__*/React.createElement(
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
+
return /*#__PURE__*/ React.createElement(
|
|
41
|
+
antd.Checkbox,
|
|
42
|
+
{
|
|
43
|
+
checked: checkedVal,
|
|
44
|
+
onChange: change,
|
|
45
|
+
},
|
|
46
|
+
children
|
|
47
|
+
);
|
|
40
48
|
};
|
|
41
49
|
|
|
42
50
|
exports.default = Index;
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import type { HCheckboxProps } from "@/components/CheckboxGroup/modal";
|
|
2
|
-
export declare const useValueProvider: ({
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
export declare const useValueProvider: ({
|
|
3
|
+
value,
|
|
4
|
+
valueMap,
|
|
5
|
+
keyInValue,
|
|
6
|
+
onChange,
|
|
7
|
+
options,
|
|
8
|
+
}: HCheckboxProps) => {
|
|
9
|
+
val: Record<any, any>;
|
|
10
|
+
change: (key: any, changeVal: any) => void;
|
|
5
11
|
};
|
|
@@ -1,20 +1,58 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
|
-
var _Object$getOwnPropertySymbols = require(
|
|
4
|
-
var _Object$getOwnPropertyDescriptor = require(
|
|
5
|
-
var _Object$getOwnPropertyDescriptors = require(
|
|
6
|
-
var _Object$defineProperties = require(
|
|
7
|
-
var _Object$defineProperty = require(
|
|
8
|
-
var _slicedToArray = require(
|
|
9
|
-
var _defineProperty = require(
|
|
10
|
-
var _forEachInstanceProperty = require(
|
|
11
|
-
var _Object$keys = require(
|
|
12
|
-
var _Array$isArray = require(
|
|
13
|
-
var _filterInstanceProperty = require(
|
|
14
|
-
var React = require(
|
|
3
|
+
var _Object$getOwnPropertySymbols = require("@babel/runtime-corejs3/core-js/object/get-own-property-symbols");
|
|
4
|
+
var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs3/core-js/object/get-own-property-descriptor");
|
|
5
|
+
var _Object$getOwnPropertyDescriptors = require("@babel/runtime-corejs3/core-js/object/get-own-property-descriptors");
|
|
6
|
+
var _Object$defineProperties = require("@babel/runtime-corejs3/core-js/object/define-properties");
|
|
7
|
+
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js/object/define-property");
|
|
8
|
+
var _slicedToArray = require("@babel/runtime-corejs3/helpers/slicedToArray");
|
|
9
|
+
var _defineProperty = require("@babel/runtime-corejs3/helpers/defineProperty");
|
|
10
|
+
var _forEachInstanceProperty = require("@babel/runtime-corejs3/core-js/instance/for-each");
|
|
11
|
+
var _Object$keys = require("@babel/runtime-corejs3/core-js/object/keys");
|
|
12
|
+
var _Array$isArray = require("@babel/runtime-corejs3/core-js/array/is-array");
|
|
13
|
+
var _filterInstanceProperty = require("@babel/runtime-corejs3/core-js/instance/filter");
|
|
14
|
+
var React = require("react");
|
|
15
15
|
|
|
16
|
-
function ownKeys(object, enumerableOnly) {
|
|
17
|
-
|
|
16
|
+
function ownKeys(object, enumerableOnly) {
|
|
17
|
+
var keys = _Object$keys(object);
|
|
18
|
+
if (_Object$getOwnPropertySymbols) {
|
|
19
|
+
var symbols = _Object$getOwnPropertySymbols(object);
|
|
20
|
+
enumerableOnly &&
|
|
21
|
+
(symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) {
|
|
22
|
+
return _Object$getOwnPropertyDescriptor(object, sym).enumerable;
|
|
23
|
+
})),
|
|
24
|
+
keys.push.apply(keys, symbols);
|
|
25
|
+
}
|
|
26
|
+
return keys;
|
|
27
|
+
}
|
|
28
|
+
function _objectSpread(target) {
|
|
29
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
30
|
+
var _context2, _context3;
|
|
31
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
32
|
+
i % 2
|
|
33
|
+
? _forEachInstanceProperty(
|
|
34
|
+
(_context2 = ownKeys(Object(source), !0))
|
|
35
|
+
).call(_context2, function (key) {
|
|
36
|
+
_defineProperty(target, key, source[key]);
|
|
37
|
+
})
|
|
38
|
+
: _Object$getOwnPropertyDescriptors
|
|
39
|
+
? _Object$defineProperties(
|
|
40
|
+
target,
|
|
41
|
+
_Object$getOwnPropertyDescriptors(source)
|
|
42
|
+
)
|
|
43
|
+
: _forEachInstanceProperty((_context3 = ownKeys(Object(source)))).call(
|
|
44
|
+
_context3,
|
|
45
|
+
function (key) {
|
|
46
|
+
_Object$defineProperty(
|
|
47
|
+
target,
|
|
48
|
+
key,
|
|
49
|
+
_Object$getOwnPropertyDescriptor(source, key)
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
return target;
|
|
55
|
+
}
|
|
18
56
|
var changValProvider = function changValProvider(_ref) {
|
|
19
57
|
var value = _ref.value,
|
|
20
58
|
options = _ref.options,
|
|
@@ -23,12 +61,14 @@ var changValProvider = function changValProvider(_ref) {
|
|
|
23
61
|
var newVal = _objectSpread({}, value);
|
|
24
62
|
var checked = valueMap.checked,
|
|
25
63
|
noChecked = valueMap.noChecked;
|
|
26
|
-
options === null || options === void 0
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
64
|
+
options === null || options === void 0
|
|
65
|
+
? void 0
|
|
66
|
+
: _forEachInstanceProperty(options).call(options, function (item) {
|
|
67
|
+
var itemVal = item.value;
|
|
68
|
+
if (newVal[itemVal] !== checked) {
|
|
69
|
+
newVal[itemVal] = noChecked;
|
|
70
|
+
}
|
|
71
|
+
});
|
|
32
72
|
return newVal;
|
|
33
73
|
};
|
|
34
74
|
var useValueProvider = function useValueProvider(_ref2) {
|
|
@@ -45,53 +85,62 @@ var useValueProvider = function useValueProvider(_ref2) {
|
|
|
45
85
|
setVal = _useState2[1];
|
|
46
86
|
var oldValueCheckMap = React.useMemo(function () {
|
|
47
87
|
return {
|
|
48
|
-
valueMap: valueMap
|
|
88
|
+
valueMap: valueMap,
|
|
49
89
|
};
|
|
50
90
|
}, []);
|
|
51
|
-
React.useEffect(
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
91
|
+
React.useEffect(
|
|
92
|
+
function () {
|
|
93
|
+
setVal(function (oldVal) {
|
|
94
|
+
return changValProvider({
|
|
95
|
+
value: oldVal,
|
|
96
|
+
options: options,
|
|
97
|
+
valueMap: oldValueCheckMap.valueMap,
|
|
98
|
+
});
|
|
57
99
|
});
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
100
|
+
},
|
|
101
|
+
[options]
|
|
102
|
+
);
|
|
103
|
+
React.useEffect(
|
|
104
|
+
function () {
|
|
105
|
+
var oldChecked = oldValueCheckMap.valueMap.checked;
|
|
106
|
+
var checked = valueMap.checked,
|
|
107
|
+
noChecked = valueMap.noChecked;
|
|
108
|
+
setVal(function (oldVal) {
|
|
109
|
+
var newVal = _objectSpread({}, oldVal);
|
|
110
|
+
var keys = _Object$keys(newVal);
|
|
111
|
+
_forEachInstanceProperty(keys).call(keys, function (key) {
|
|
112
|
+
if (newVal[key] === oldChecked) {
|
|
113
|
+
newVal[key] = checked;
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
newVal[key] = noChecked;
|
|
117
|
+
});
|
|
118
|
+
oldValueCheckMap.valueMap = valueMap;
|
|
119
|
+
return newVal;
|
|
73
120
|
});
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
121
|
+
},
|
|
122
|
+
[valueMap]
|
|
123
|
+
);
|
|
124
|
+
React.useEffect(
|
|
125
|
+
function () {
|
|
126
|
+
var checked = oldValueCheckMap.valueMap.checked;
|
|
127
|
+
if (!value) {
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
if (!_Array$isArray(value)) {
|
|
131
|
+
setVal(value);
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
setVal(function (oldVal) {
|
|
135
|
+
var newVal = _objectSpread({}, oldVal);
|
|
136
|
+
_forEachInstanceProperty(value).call(value, function (itemVal) {
|
|
137
|
+
newVal[itemVal] = checked;
|
|
138
|
+
});
|
|
139
|
+
return newVal;
|
|
91
140
|
});
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
141
|
+
},
|
|
142
|
+
[value]
|
|
143
|
+
);
|
|
95
144
|
var change = function change(key, changeVal) {
|
|
96
145
|
var _context;
|
|
97
146
|
var checked = valueMap.checked,
|
|
@@ -109,14 +158,16 @@ var useValueProvider = function useValueProvider(_ref2) {
|
|
|
109
158
|
onChange(newVal);
|
|
110
159
|
return;
|
|
111
160
|
}
|
|
112
|
-
var subVal = _filterInstanceProperty(
|
|
161
|
+
var subVal = _filterInstanceProperty(
|
|
162
|
+
(_context = _Object$keys(newVal))
|
|
163
|
+
).call(_context, function (valKey) {
|
|
113
164
|
return newVal[valKey] === checked;
|
|
114
165
|
});
|
|
115
166
|
onChange(subVal);
|
|
116
167
|
};
|
|
117
168
|
return {
|
|
118
169
|
val: val,
|
|
119
|
-
change: change
|
|
170
|
+
change: change,
|
|
120
171
|
};
|
|
121
172
|
};
|
|
122
173
|
|
|
@@ -1,3 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
declare const _default: (
|
|
2
|
+
declare const _default: (
|
|
3
|
+
props: import("../Form/modal").HFormItemProps
|
|
4
|
+
) => React.ReactElement<
|
|
5
|
+
import("../Form/modal").ConnectResultProps,
|
|
6
|
+
string | React.JSXElementConstructor<any>
|
|
7
|
+
>;
|
|
3
8
|
export default _default;
|