@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
|
@@ -1,45 +1,90 @@
|
|
|
1
1
|
// welcome to hoo hoo hoo
|
|
2
|
-
import _Object$keys from
|
|
3
|
-
import _Object$getOwnPropertySymbols from
|
|
4
|
-
import _filterInstanceProperty from
|
|
5
|
-
import _Object$getOwnPropertyDescriptor from
|
|
6
|
-
import _Object$getOwnPropertyDescriptors from
|
|
7
|
-
import _Object$defineProperties from
|
|
8
|
-
import _Object$defineProperty from
|
|
9
|
-
import _slicedToArray from
|
|
10
|
-
import _objectWithoutProperties from
|
|
11
|
-
import _defineProperty from
|
|
12
|
-
import _findIndexInstanceProperty from
|
|
13
|
-
import _forEachInstanceProperty from
|
|
14
|
-
import _mapInstanceProperty from
|
|
15
|
-
import _Array$isArray from
|
|
16
|
-
import { useState, useEffect } from
|
|
17
|
-
import { itemOpProvider } from
|
|
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 _Object$getOwnPropertyDescriptors from "@babel/runtime-corejs3/core-js/object/get-own-property-descriptors";
|
|
7
|
+
import _Object$defineProperties from "@babel/runtime-corejs3/core-js/object/define-properties";
|
|
8
|
+
import _Object$defineProperty from "@babel/runtime-corejs3/core-js/object/define-property";
|
|
9
|
+
import _slicedToArray from "@babel/runtime-corejs3/helpers/slicedToArray";
|
|
10
|
+
import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/objectWithoutProperties";
|
|
11
|
+
import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
|
|
12
|
+
import _findIndexInstanceProperty from "@babel/runtime-corejs3/core-js/instance/find-index";
|
|
13
|
+
import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js/instance/for-each";
|
|
14
|
+
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js/instance/map";
|
|
15
|
+
import _Array$isArray from "@babel/runtime-corejs3/core-js/array/is-array";
|
|
16
|
+
import { useState, useEffect } from "react";
|
|
17
|
+
import { itemOpProvider } from "../utils.js";
|
|
18
18
|
|
|
19
19
|
var _excluded = ["index"],
|
|
20
20
|
_excluded2 = ["index"];
|
|
21
|
-
function ownKeys(object, enumerableOnly) {
|
|
22
|
-
|
|
21
|
+
function ownKeys(object, enumerableOnly) {
|
|
22
|
+
var keys = _Object$keys(object);
|
|
23
|
+
if (_Object$getOwnPropertySymbols) {
|
|
24
|
+
var symbols = _Object$getOwnPropertySymbols(object);
|
|
25
|
+
enumerableOnly &&
|
|
26
|
+
(symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) {
|
|
27
|
+
return _Object$getOwnPropertyDescriptor(object, sym).enumerable;
|
|
28
|
+
})),
|
|
29
|
+
keys.push.apply(keys, symbols);
|
|
30
|
+
}
|
|
31
|
+
return keys;
|
|
32
|
+
}
|
|
33
|
+
function _objectSpread(target) {
|
|
34
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
35
|
+
var _context, _context2;
|
|
36
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
37
|
+
i % 2
|
|
38
|
+
? _forEachInstanceProperty((_context = ownKeys(Object(source), !0))).call(
|
|
39
|
+
_context,
|
|
40
|
+
function (key) {
|
|
41
|
+
_defineProperty(target, key, source[key]);
|
|
42
|
+
}
|
|
43
|
+
)
|
|
44
|
+
: _Object$getOwnPropertyDescriptors
|
|
45
|
+
? _Object$defineProperties(
|
|
46
|
+
target,
|
|
47
|
+
_Object$getOwnPropertyDescriptors(source)
|
|
48
|
+
)
|
|
49
|
+
: _forEachInstanceProperty((_context2 = ownKeys(Object(source)))).call(
|
|
50
|
+
_context2,
|
|
51
|
+
function (key) {
|
|
52
|
+
_Object$defineProperty(
|
|
53
|
+
target,
|
|
54
|
+
key,
|
|
55
|
+
_Object$getOwnPropertyDescriptor(source, key)
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
return target;
|
|
61
|
+
}
|
|
23
62
|
var single = function single(_ref) {
|
|
24
63
|
var options = _ref.options,
|
|
25
64
|
value = _ref.value,
|
|
26
65
|
noMatchItemRender = _ref.noMatchItemRender;
|
|
27
66
|
var newOptions = options || [];
|
|
28
|
-
var index = _findIndexInstanceProperty(newOptions).call(
|
|
29
|
-
|
|
30
|
-
|
|
67
|
+
var index = _findIndexInstanceProperty(newOptions).call(
|
|
68
|
+
newOptions,
|
|
69
|
+
function (item) {
|
|
70
|
+
return item.value === value;
|
|
71
|
+
}
|
|
72
|
+
);
|
|
31
73
|
if (index !== -1) {
|
|
32
74
|
var label = newOptions[index].label;
|
|
33
75
|
return {
|
|
34
76
|
value: value,
|
|
35
|
-
label: label
|
|
77
|
+
label: label,
|
|
36
78
|
};
|
|
37
79
|
}
|
|
38
80
|
return {
|
|
39
81
|
value: value,
|
|
40
|
-
label:
|
|
41
|
-
|
|
42
|
-
|
|
82
|
+
label:
|
|
83
|
+
(noMatchItemRender === null || noMatchItemRender === void 0
|
|
84
|
+
? void 0
|
|
85
|
+
: noMatchItemRender({
|
|
86
|
+
value: value,
|
|
87
|
+
})) || value,
|
|
43
88
|
};
|
|
44
89
|
};
|
|
45
90
|
var findNewValInOldVal = function findNewValInOldVal(val, oldVal) {
|
|
@@ -52,7 +97,7 @@ var findNewValInOldVal = function findNewValInOldVal(val, oldVal) {
|
|
|
52
97
|
};
|
|
53
98
|
var sourceDataProvider = function sourceDataProvider(_ref2, oldVal) {
|
|
54
99
|
_ref2.options;
|
|
55
|
-
|
|
100
|
+
var value = _ref2.value;
|
|
56
101
|
var oldData = [];
|
|
57
102
|
var newData = [];
|
|
58
103
|
_forEachInstanceProperty(value).call(value, function (item, i) {
|
|
@@ -60,18 +105,24 @@ var sourceDataProvider = function sourceDataProvider(_ref2, oldVal) {
|
|
|
60
105
|
if (index === -1) {
|
|
61
106
|
newData.push({
|
|
62
107
|
value: item,
|
|
63
|
-
index: i
|
|
108
|
+
index: i,
|
|
64
109
|
});
|
|
65
110
|
return;
|
|
66
111
|
}
|
|
67
112
|
var newVal = oldVal === null || oldVal === void 0 ? void 0 : oldVal[index];
|
|
68
|
-
oldData.push(
|
|
69
|
-
|
|
70
|
-
|
|
113
|
+
oldData.push(
|
|
114
|
+
_objectSpread(
|
|
115
|
+
_objectSpread({}, newVal),
|
|
116
|
+
{},
|
|
117
|
+
{
|
|
118
|
+
index: i,
|
|
119
|
+
}
|
|
120
|
+
)
|
|
121
|
+
);
|
|
71
122
|
});
|
|
72
123
|
return {
|
|
73
124
|
oldData: oldData,
|
|
74
|
-
newData: newData
|
|
125
|
+
newData: newData,
|
|
75
126
|
};
|
|
76
127
|
};
|
|
77
128
|
var resultProvider = function resultProvider(newData, oldData, value) {
|
|
@@ -92,33 +143,46 @@ var multiple = function multiple(_ref3, oldVal) {
|
|
|
92
143
|
var options = _ref3.options,
|
|
93
144
|
value = _ref3.value,
|
|
94
145
|
noMatchItemRender = _ref3.noMatchItemRender;
|
|
95
|
-
var _sourceDataProvider = sourceDataProvider(
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
146
|
+
var _sourceDataProvider = sourceDataProvider(
|
|
147
|
+
{
|
|
148
|
+
options: options,
|
|
149
|
+
value: value,
|
|
150
|
+
},
|
|
151
|
+
oldVal
|
|
152
|
+
),
|
|
99
153
|
newData = _sourceDataProvider.newData,
|
|
100
154
|
oldData = _sourceDataProvider.oldData;
|
|
101
|
-
var newMatchVal = _mapInstanceProperty(newData).call(
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
155
|
+
var newMatchVal = _mapInstanceProperty(newData).call(
|
|
156
|
+
newData,
|
|
157
|
+
function (item) {
|
|
158
|
+
var itemVal = item.value,
|
|
159
|
+
index = item.index;
|
|
160
|
+
var newItem = single({
|
|
161
|
+
options: options,
|
|
162
|
+
value: itemVal,
|
|
163
|
+
noMatchItemRender: noMatchItemRender,
|
|
164
|
+
});
|
|
165
|
+
return _objectSpread(
|
|
166
|
+
_objectSpread({}, newItem),
|
|
167
|
+
{},
|
|
168
|
+
{
|
|
169
|
+
index: index,
|
|
170
|
+
}
|
|
171
|
+
);
|
|
172
|
+
}
|
|
173
|
+
);
|
|
113
174
|
return resultProvider(newMatchVal, oldData, value);
|
|
114
175
|
};
|
|
115
176
|
var tag = function tag(_ref4, oldVal) {
|
|
116
177
|
var options = _ref4.options,
|
|
117
178
|
value = _ref4.value;
|
|
118
|
-
var _sourceDataProvider2 = sourceDataProvider(
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
179
|
+
var _sourceDataProvider2 = sourceDataProvider(
|
|
180
|
+
{
|
|
181
|
+
options: options,
|
|
182
|
+
value: value,
|
|
183
|
+
},
|
|
184
|
+
oldVal
|
|
185
|
+
),
|
|
122
186
|
newData = _sourceDataProvider2.newData,
|
|
123
187
|
oldData = _sourceDataProvider2.oldData;
|
|
124
188
|
return resultProvider(newData, oldData, value);
|
|
@@ -132,20 +196,26 @@ var matchNotFind = function matchNotFind(_ref5, oldVale) {
|
|
|
132
196
|
return single({
|
|
133
197
|
options: options,
|
|
134
198
|
value: value,
|
|
135
|
-
noMatchItemRender: noMatchItemRender
|
|
199
|
+
noMatchItemRender: noMatchItemRender,
|
|
136
200
|
});
|
|
137
201
|
}
|
|
138
202
|
if (mode === "multiple") {
|
|
139
|
-
return multiple(
|
|
203
|
+
return multiple(
|
|
204
|
+
{
|
|
205
|
+
options: options,
|
|
206
|
+
value: value,
|
|
207
|
+
noMatchItemRender: noMatchItemRender,
|
|
208
|
+
},
|
|
209
|
+
oldVale
|
|
210
|
+
);
|
|
211
|
+
}
|
|
212
|
+
return tag(
|
|
213
|
+
{
|
|
140
214
|
options: options,
|
|
141
215
|
value: value,
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
return tag({
|
|
146
|
-
options: options,
|
|
147
|
-
value: value
|
|
148
|
-
}, oldVale);
|
|
216
|
+
},
|
|
217
|
+
oldVale
|
|
218
|
+
);
|
|
149
219
|
};
|
|
150
220
|
var useValueChange = function useValueChange(params) {
|
|
151
221
|
var labelInValue = params.labelInValue,
|
|
@@ -170,23 +240,29 @@ var useValueChange = function useValueChange(params) {
|
|
|
170
240
|
newChangeVal = changeVal;
|
|
171
241
|
}
|
|
172
242
|
if (_Array$isArray(changeVal)) {
|
|
173
|
-
newChangeVal = _mapInstanceProperty(changeVal).call(
|
|
174
|
-
|
|
175
|
-
|
|
243
|
+
newChangeVal = _mapInstanceProperty(changeVal).call(
|
|
244
|
+
changeVal,
|
|
245
|
+
function (item) {
|
|
246
|
+
return item.value;
|
|
247
|
+
}
|
|
248
|
+
);
|
|
176
249
|
}
|
|
177
250
|
var subItemOps = itemOpProvider(itemOps, fieldNames);
|
|
178
251
|
onChange(newChangeVal, subItemOps);
|
|
179
252
|
};
|
|
180
|
-
useEffect(
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
253
|
+
useEffect(
|
|
254
|
+
function () {
|
|
255
|
+
if (options && value) {
|
|
256
|
+
setVal(function (oldVale) {
|
|
257
|
+
return matchNotFind(params, oldVale);
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
},
|
|
261
|
+
[value, options, mode, noMatchItemRender]
|
|
262
|
+
);
|
|
187
263
|
return {
|
|
188
264
|
val: val,
|
|
189
|
-
change: change
|
|
265
|
+
change: change,
|
|
190
266
|
};
|
|
191
267
|
};
|
|
192
268
|
|
|
@@ -1,10 +1,28 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import type {
|
|
2
|
+
OptionType,
|
|
3
|
+
PartialHSelectProps,
|
|
4
|
+
} from "@/components/Select/modal";
|
|
5
|
+
export declare const useOptionReq: ({
|
|
6
|
+
manual,
|
|
7
|
+
request,
|
|
8
|
+
options,
|
|
9
|
+
serviceSearch,
|
|
10
|
+
showSearch,
|
|
11
|
+
onSearch: propsOnSearch,
|
|
12
|
+
}: PartialHSelectProps) => {
|
|
13
|
+
run: (params?: any, type?: any) => Promise<any>;
|
|
14
|
+
loading: boolean;
|
|
15
|
+
error: Error | undefined;
|
|
16
|
+
data: OptionType[] | undefined;
|
|
17
|
+
onSearch: ((value: string) => void) | undefined;
|
|
18
|
+
mathShowSearch: boolean | undefined;
|
|
9
19
|
};
|
|
10
|
-
export declare const useFilterOption: ({
|
|
20
|
+
export declare const useFilterOption: ({
|
|
21
|
+
filterOption,
|
|
22
|
+
serviceSearch,
|
|
23
|
+
}: PartialHSelectProps) =>
|
|
24
|
+
| boolean
|
|
25
|
+
| import("rc-select/lib/Select").FilterFunc<
|
|
26
|
+
import("rc-select/lib/Select").DefaultOptionType
|
|
27
|
+
>
|
|
28
|
+
| undefined;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// welcome to hoo hoo hoo
|
|
2
|
-
import _asyncToGenerator from
|
|
3
|
-
import _slicedToArray from
|
|
4
|
-
import _regeneratorRuntime from
|
|
5
|
-
import _Promise from
|
|
6
|
-
import { useState } from
|
|
7
|
-
import { useRequest } from
|
|
2
|
+
import _asyncToGenerator from "@babel/runtime-corejs3/helpers/asyncToGenerator";
|
|
3
|
+
import _slicedToArray from "@babel/runtime-corejs3/helpers/slicedToArray";
|
|
4
|
+
import _regeneratorRuntime from "@babel/runtime-corejs3/regenerator";
|
|
5
|
+
import _Promise from "@babel/runtime-corejs3/core-js/promise";
|
|
6
|
+
import { useState } from "react";
|
|
7
|
+
import { useRequest } from "ahooks";
|
|
8
8
|
|
|
9
9
|
var useOptionReq = function useOptionReq(_ref) {
|
|
10
10
|
var manual = _ref.manual,
|
|
@@ -17,47 +17,59 @@ var useOptionReq = function useOptionReq(_ref) {
|
|
|
17
17
|
_useState2 = _slicedToArray(_useState, 2),
|
|
18
18
|
data = _useState2[0],
|
|
19
19
|
setData = _useState2[1];
|
|
20
|
-
var _useRequest = useRequest(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
20
|
+
var _useRequest = useRequest(
|
|
21
|
+
/*#__PURE__*/ _asyncToGenerator(
|
|
22
|
+
/*#__PURE__*/ _regeneratorRuntime.mark(function _callee() {
|
|
23
|
+
var params,
|
|
24
|
+
type,
|
|
25
|
+
_args = arguments;
|
|
26
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
27
|
+
while (1)
|
|
28
|
+
switch ((_context.prev = _context.next)) {
|
|
29
|
+
case 0:
|
|
30
|
+
params =
|
|
31
|
+
_args.length > 0 && _args[0] !== undefined ? _args[0] : {};
|
|
32
|
+
type =
|
|
33
|
+
_args.length > 1 && _args[1] !== undefined
|
|
34
|
+
? _args[1]
|
|
35
|
+
: "init";
|
|
36
|
+
if (type === "init") {
|
|
37
|
+
setData(undefined);
|
|
38
|
+
}
|
|
39
|
+
if (!request) {
|
|
40
|
+
_context.next = 5;
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
43
|
+
return _context.abrupt("return", request(params));
|
|
44
|
+
case 5:
|
|
45
|
+
return _context.abrupt("return", _Promise.resolve(options));
|
|
46
|
+
case 6:
|
|
47
|
+
case "end":
|
|
48
|
+
return _context.stop();
|
|
49
|
+
}
|
|
50
|
+
}, _callee);
|
|
51
|
+
})
|
|
52
|
+
),
|
|
53
|
+
{
|
|
54
|
+
manual: manual,
|
|
55
|
+
debounceInterval: 300,
|
|
56
|
+
onSuccess: function onSuccess(resultData) {
|
|
57
|
+
setData(resultData);
|
|
58
|
+
},
|
|
49
59
|
}
|
|
50
|
-
|
|
60
|
+
),
|
|
51
61
|
run = _useRequest.run,
|
|
52
62
|
loading = _useRequest.loading,
|
|
53
63
|
error = _useRequest.error;
|
|
54
64
|
var onSearch = function onSearch(inputValue) {
|
|
55
65
|
if (!serviceSearch) {
|
|
56
|
-
propsOnSearch === null || propsOnSearch === void 0
|
|
66
|
+
propsOnSearch === null || propsOnSearch === void 0
|
|
67
|
+
? void 0
|
|
68
|
+
: propsOnSearch(inputValue);
|
|
57
69
|
return;
|
|
58
70
|
}
|
|
59
71
|
run({
|
|
60
|
-
inputValue: inputValue
|
|
72
|
+
inputValue: inputValue,
|
|
61
73
|
});
|
|
62
74
|
};
|
|
63
75
|
var mathShowSearch = showSearch || serviceSearch;
|
|
@@ -67,7 +79,7 @@ var useOptionReq = function useOptionReq(_ref) {
|
|
|
67
79
|
error: error,
|
|
68
80
|
data: data,
|
|
69
81
|
onSearch: mathShowSearch ? onSearch : propsOnSearch,
|
|
70
|
-
mathShowSearch: showSearch || serviceSearch
|
|
82
|
+
mathShowSearch: showSearch || serviceSearch,
|
|
71
83
|
};
|
|
72
84
|
};
|
|
73
85
|
var useFilterOption = function useFilterOption(_ref3) {
|
package/es/Select/index.d.ts
CHANGED
|
@@ -1,4 +1,25 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { HSelectProps } from "./modal";
|
|
3
|
-
declare const _default: ({
|
|
3
|
+
declare const _default: ({
|
|
4
|
+
style,
|
|
5
|
+
mode,
|
|
6
|
+
options,
|
|
7
|
+
modeConfig,
|
|
8
|
+
value,
|
|
9
|
+
onChange,
|
|
10
|
+
fieldNames: propsFieldNames,
|
|
11
|
+
request,
|
|
12
|
+
manual,
|
|
13
|
+
optionLabelProp,
|
|
14
|
+
filterProvider,
|
|
15
|
+
optionFilterProp,
|
|
16
|
+
serviceSearch,
|
|
17
|
+
onSearch: propsOnSearch,
|
|
18
|
+
filterOption,
|
|
19
|
+
showSearch,
|
|
20
|
+
labelInValue,
|
|
21
|
+
noMatchItemRender,
|
|
22
|
+
allSelect,
|
|
23
|
+
...props
|
|
24
|
+
}: HSelectProps) => JSX.Element;
|
|
4
25
|
export default _default;
|