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