@hw-component/form 0.0.1-beta → 0.0.1-beta-v2
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 +16 -24
- package/es/CheckboxGroup/hooks.d.ts +3 -9
- package/es/CheckboxGroup/hooks.js +64 -115
- package/es/CheckboxGroup/index.d.ts +1 -6
- package/es/CheckboxGroup/index.js +58 -117
- package/es/CheckboxGroup/modal.d.ts +8 -9
- package/es/Form/Context/FormConfigProvider.js +19 -64
- package/es/Form/Context/index.d.ts +1 -4
- package/es/Form/Context/index.js +3 -3
- package/es/Form/FormItem/BasicItem.js +42 -80
- package/es/Form/FormItem/Helper.d.ts +1 -1
- package/es/Form/FormItem/Helper.js +9 -17
- package/es/Form/FormItem/RegularFormItem.js +8 -11
- package/es/Form/FormItem/UpFormItem.d.ts +1 -6
- package/es/Form/FormItem/UpFormItem.js +17 -27
- package/es/Form/FormItem/hooks.d.ts +4 -21
- package/es/Form/FormItem/hooks.js +9 -12
- package/es/Form/FormItem/index.js +5 -5
- package/es/Form/HFormConnect.d.ts +1 -9
- package/es/Form/HFormConnect.js +30 -90
- package/es/Form/InitSet.d.ts +1 -4
- package/es/Form/InitSet.js +6 -7
- package/es/Form/Label.d.ts +4 -4
- package/es/Form/Label.js +19 -36
- package/es/Form/config.d.ts +22 -100
- package/es/Form/config.js +19 -19
- package/es/Form/hooks/index.d.ts +1 -14
- package/es/Form/hooks/index.js +32 -80
- package/es/Form/hooks/useHForm.js +143 -224
- package/es/Form/hooks/useInitConfigData.d.ts +1 -4
- package/es/Form/hooks/useInitConfigData.js +61 -143
- package/es/Form/index.d.ts +1 -11
- package/es/Form/index.js +79 -79
- package/es/Form/modal.d.ts +54 -89
- package/es/Input/ButtonInput.js +51 -73
- package/es/Input/InputNumber.js +12 -21
- package/es/Input/SelectInput.d.ts +4 -16
- package/es/Input/SelectInput.js +62 -116
- 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 +13 -15
- package/es/ModalForm/hooks.d.ts +12 -0
- package/es/ModalForm/hooks.js +63 -0
- package/es/ModalForm/index.d.ts +4 -0
- package/es/ModalForm/index.js +72 -0
- package/es/ModalForm/modal.d.ts +20 -0
- package/es/PageHandler/ErrorComponent.js +25 -47
- package/es/PageHandler/LoadingComponent.js +13 -17
- package/es/PageHandler/index.js +7 -7
- package/es/PageHandler/modal.d.ts +4 -4
- package/es/RadioGroup/index.d.ts +5 -12
- package/es/RadioGroup/index.js +33 -46
- package/es/Select/components/AllSelect.d.ts +1 -1
- package/es/Select/components/AllSelect.js +18 -40
- package/es/Select/components/CheckBoxOption.d.ts +3 -6
- package/es/Select/components/CheckBoxOption.js +7 -12
- package/es/Select/components/DropdownComponent.d.ts +4 -4
- package/es/Select/components/DropdownComponent.js +17 -30
- package/es/Select/components/NoFindItem.d.ts +1 -1
- package/es/Select/components/NoFindItem.js +7 -11
- package/es/Select/components/NotFoundContent.d.ts +2 -2
- package/es/Select/components/NotFoundContent.js +27 -49
- package/es/Select/defaultConfig.d.ts +1 -1
- package/es/Select/defaultConfig.js +16 -20
- package/es/Select/hooks/changeHooks.d.ts +2 -2
- package/es/Select/hooks/changeHooks.js +71 -147
- package/es/Select/hooks/norHooks.d.ts +9 -27
- package/es/Select/hooks/norHooks.js +39 -51
- package/es/Select/index.d.ts +1 -22
- package/es/Select/index.js +65 -124
- package/es/Select/modal.d.ts +15 -15
- package/es/Select/utils.js +15 -60
- package/es/Submit/index.d.ts +3 -9
- package/es/Submit/index.js +13 -18
- package/es/Switch/index.d.ts +4 -4
- package/es/Switch/index.js +20 -46
- package/es/TDPicker/RangePicker.d.ts +3 -8
- package/es/TDPicker/RangePicker.js +67 -138
- package/es/TDPicker/TimePicker.d.ts +1 -6
- package/es/TDPicker/TimePicker.js +13 -19
- package/es/TDPicker/hooks.d.ts +22 -42
- package/es/TDPicker/hooks.js +72 -106
- package/es/TDPicker/index.d.ts +1 -7
- package/es/TDPicker/index.js +14 -20
- package/es/TDPicker/modal.d.ts +16 -21
- package/es/TextArea/index.d.ts +1 -0
- package/es/Upload/Btn.d.ts +1 -5
- package/es/Upload/Btn.js +19 -35
- package/es/Upload/MediaTypeEle/TypeEle.d.ts +5 -10
- package/es/Upload/MediaTypeEle/TypeEle.js +23 -31
- package/es/Upload/MediaTypeEle/index.d.ts +1 -5
- package/es/Upload/MediaTypeEle/index.js +18 -21
- package/es/Upload/Preview/index.d.ts +1 -5
- package/es/Upload/Preview/index.js +13 -17
- package/es/Upload/UrlUpload/index.d.ts +1 -7
- package/es/Upload/UrlUpload/index.js +51 -72
- package/es/Upload/enums.d.ts +3 -3
- package/es/Upload/enums.js +3 -3
- package/es/Upload/hooks/change.d.ts +1 -8
- package/es/Upload/hooks/change.js +58 -115
- package/es/Upload/hooks/customRequest.d.ts +1 -5
- package/es/Upload/hooks/customRequest.js +46 -63
- package/es/Upload/hooks/propsMaker.d.ts +1 -5
- package/es/Upload/hooks/propsMaker.js +13 -52
- package/es/Upload/index.d.ts +1 -3
- package/es/Upload/index.js +61 -131
- package/es/Upload/modal.d.ts +15 -17
- package/es/Upload/util.d.ts +2 -8
- package/es/Upload/util.js +7 -15
- package/es/config.js +31 -34
- package/es/hooks/index.d.ts +7 -14
- package/es/hooks/index.js +49 -124
- package/es/index.d.ts +18 -98
- package/es/index.js +8 -22
- package/es/modal.d.ts +6 -6
- package/lib/CheckboxGroup/CheckBox/index.js +18 -26
- package/lib/CheckboxGroup/hooks.d.ts +3 -9
- package/lib/CheckboxGroup/hooks.js +65 -116
- package/lib/CheckboxGroup/index.d.ts +1 -6
- package/lib/CheckboxGroup/index.js +60 -119
- package/lib/CheckboxGroup/modal.d.ts +8 -9
- package/lib/Form/Context/FormConfigProvider.js +21 -66
- package/lib/Form/Context/index.d.ts +1 -4
- package/lib/Form/Context/index.js +4 -4
- package/lib/Form/FormItem/BasicItem.js +44 -82
- package/lib/Form/FormItem/Helper.d.ts +1 -1
- package/lib/Form/FormItem/Helper.js +11 -19
- package/lib/Form/FormItem/RegularFormItem.js +10 -13
- package/lib/Form/FormItem/UpFormItem.d.ts +1 -6
- package/lib/Form/FormItem/UpFormItem.js +19 -29
- package/lib/Form/FormItem/hooks.d.ts +4 -21
- package/lib/Form/FormItem/hooks.js +10 -13
- package/lib/Form/FormItem/index.js +7 -7
- package/lib/Form/HFormConnect.d.ts +1 -9
- package/lib/Form/HFormConnect.js +32 -92
- package/lib/Form/InitSet.d.ts +1 -4
- package/lib/Form/InitSet.js +8 -9
- package/lib/Form/Label.d.ts +4 -4
- package/lib/Form/Label.js +21 -41
- package/lib/Form/config.d.ts +22 -100
- package/lib/Form/config.js +21 -21
- package/lib/Form/hooks/index.d.ts +1 -14
- package/lib/Form/hooks/index.js +32 -81
- package/lib/Form/hooks/useHForm.js +145 -226
- package/lib/Form/hooks/useInitConfigData.d.ts +1 -4
- package/lib/Form/hooks/useInitConfigData.js +63 -144
- package/lib/Form/index.d.ts +1 -11
- package/lib/Form/index.js +83 -83
- package/lib/Form/modal.d.ts +54 -89
- package/lib/Input/ButtonInput.js +53 -75
- package/lib/Input/InputNumber.js +14 -23
- package/lib/Input/SelectInput.d.ts +4 -16
- package/lib/Input/SelectInput.js +66 -128
- 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 +13 -15
- package/lib/ModalForm/hooks.d.ts +12 -0
- package/lib/ModalForm/hooks.js +66 -0
- package/lib/ModalForm/index.d.ts +4 -0
- package/lib/ModalForm/index.js +75 -0
- package/lib/ModalForm/modal.d.ts +20 -0
- package/lib/PageHandler/ErrorComponent.js +27 -49
- package/lib/PageHandler/LoadingComponent.js +15 -19
- package/lib/PageHandler/index.js +9 -9
- package/lib/PageHandler/modal.d.ts +4 -4
- package/lib/RadioGroup/index.d.ts +5 -12
- package/lib/RadioGroup/index.js +35 -48
- package/lib/Select/components/AllSelect.d.ts +1 -1
- package/lib/Select/components/AllSelect.js +20 -42
- package/lib/Select/components/CheckBoxOption.d.ts +3 -6
- package/lib/Select/components/CheckBoxOption.js +9 -14
- package/lib/Select/components/DropdownComponent.d.ts +4 -4
- package/lib/Select/components/DropdownComponent.js +19 -32
- package/lib/Select/components/NoFindItem.d.ts +1 -1
- package/lib/Select/components/NoFindItem.js +9 -13
- package/lib/Select/components/NotFoundContent.d.ts +2 -2
- package/lib/Select/components/NotFoundContent.js +29 -51
- package/lib/Select/defaultConfig.d.ts +1 -1
- package/lib/Select/defaultConfig.js +17 -21
- package/lib/Select/hooks/changeHooks.d.ts +2 -2
- package/lib/Select/hooks/changeHooks.js +72 -148
- package/lib/Select/hooks/norHooks.d.ts +9 -27
- package/lib/Select/hooks/norHooks.js +40 -52
- package/lib/Select/index.d.ts +1 -22
- package/lib/Select/index.js +67 -128
- package/lib/Select/modal.d.ts +15 -15
- package/lib/Select/utils.js +16 -61
- package/lib/Submit/index.d.ts +3 -9
- package/lib/Submit/index.js +15 -20
- package/lib/Switch/index.d.ts +4 -4
- package/lib/Switch/index.js +22 -48
- package/lib/TDPicker/RangePicker.d.ts +3 -8
- package/lib/TDPicker/RangePicker.js +69 -136
- package/lib/TDPicker/TimePicker.d.ts +1 -6
- package/lib/TDPicker/TimePicker.js +15 -21
- package/lib/TDPicker/hooks.d.ts +22 -42
- package/lib/TDPicker/hooks.js +72 -98
- package/lib/TDPicker/index.d.ts +1 -7
- package/lib/TDPicker/index.js +16 -22
- package/lib/TDPicker/modal.d.ts +16 -21
- package/lib/TextArea/index.d.ts +1 -0
- package/lib/Upload/Btn.d.ts +1 -5
- package/lib/Upload/Btn.js +21 -37
- package/lib/Upload/MediaTypeEle/TypeEle.d.ts +5 -10
- package/lib/Upload/MediaTypeEle/TypeEle.js +25 -33
- package/lib/Upload/MediaTypeEle/index.d.ts +1 -5
- package/lib/Upload/MediaTypeEle/index.js +20 -23
- package/lib/Upload/Preview/index.d.ts +1 -5
- package/lib/Upload/Preview/index.js +15 -19
- package/lib/Upload/UrlUpload/index.d.ts +1 -7
- package/lib/Upload/UrlUpload/index.js +53 -74
- package/lib/Upload/enums.d.ts +3 -3
- package/lib/Upload/enums.js +4 -4
- package/lib/Upload/hooks/change.d.ts +1 -8
- package/lib/Upload/hooks/change.js +59 -116
- package/lib/Upload/hooks/customRequest.d.ts +1 -5
- package/lib/Upload/hooks/customRequest.js +47 -64
- package/lib/Upload/hooks/propsMaker.d.ts +1 -5
- package/lib/Upload/hooks/propsMaker.js +15 -55
- package/lib/Upload/index.d.ts +1 -3
- package/lib/Upload/index.js +63 -133
- package/lib/Upload/modal.d.ts +15 -17
- package/lib/Upload/util.d.ts +2 -8
- package/lib/Upload/util.js +8 -16
- package/lib/config.js +32 -35
- package/lib/hooks/index.d.ts +7 -14
- package/lib/hooks/index.js +50 -125
- package/lib/index.d.ts +18 -98
- package/lib/index.js +10 -5
- package/lib/modal.d.ts +6 -6
- package/package.json +1 -1
- package/src/components/Form/InitSet.tsx +3 -5
- package/src/components/Form/hooks/index.ts +0 -20
- package/src/components/Form/hooks/useHForm.ts +8 -4
- package/src/components/Form/index.tsx +25 -7
- package/src/components/Form/modal.ts +4 -2
- package/src/components/Input/SelectInput.tsx +3 -2
- package/src/components/Input/modal.ts +2 -0
- package/src/components/ModalForm/hooks.ts +45 -0
- package/src/components/ModalForm/index.tsx +69 -0
- package/src/components/ModalForm/modal.ts +22 -0
- package/src/components/index.tsx +4 -0
- package/src/pages/ModalForm/index.tsx +127 -0
- package/src/routes.tsx +6 -1
|
@@ -1,90 +1,45 @@
|
|
|
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
|
-
|
|
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
|
-
}
|
|
21
|
+
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; }
|
|
22
|
+
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; }
|
|
62
23
|
var single = function single(_ref) {
|
|
63
24
|
var options = _ref.options,
|
|
64
25
|
value = _ref.value,
|
|
65
26
|
noMatchItemRender = _ref.noMatchItemRender;
|
|
66
27
|
var newOptions = options || [];
|
|
67
|
-
var index = _findIndexInstanceProperty(newOptions).call(
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
return item.value === value;
|
|
71
|
-
}
|
|
72
|
-
);
|
|
28
|
+
var index = _findIndexInstanceProperty(newOptions).call(newOptions, function (item) {
|
|
29
|
+
return item.value === value;
|
|
30
|
+
});
|
|
73
31
|
if (index !== -1) {
|
|
74
32
|
var label = newOptions[index].label;
|
|
75
33
|
return {
|
|
76
34
|
value: value,
|
|
77
|
-
label: label
|
|
35
|
+
label: label
|
|
78
36
|
};
|
|
79
37
|
}
|
|
80
38
|
return {
|
|
81
39
|
value: value,
|
|
82
|
-
label:
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
: noMatchItemRender({
|
|
86
|
-
value: value,
|
|
87
|
-
})) || value,
|
|
40
|
+
label: (noMatchItemRender === null || noMatchItemRender === void 0 ? void 0 : noMatchItemRender({
|
|
41
|
+
value: value
|
|
42
|
+
})) || value
|
|
88
43
|
};
|
|
89
44
|
};
|
|
90
45
|
var findNewValInOldVal = function findNewValInOldVal(val, oldVal) {
|
|
@@ -97,7 +52,7 @@ var findNewValInOldVal = function findNewValInOldVal(val, oldVal) {
|
|
|
97
52
|
};
|
|
98
53
|
var sourceDataProvider = function sourceDataProvider(_ref2, oldVal) {
|
|
99
54
|
_ref2.options;
|
|
100
|
-
|
|
55
|
+
var value = _ref2.value;
|
|
101
56
|
var oldData = [];
|
|
102
57
|
var newData = [];
|
|
103
58
|
_forEachInstanceProperty(value).call(value, function (item, i) {
|
|
@@ -105,24 +60,18 @@ var sourceDataProvider = function sourceDataProvider(_ref2, oldVal) {
|
|
|
105
60
|
if (index === -1) {
|
|
106
61
|
newData.push({
|
|
107
62
|
value: item,
|
|
108
|
-
index: i
|
|
63
|
+
index: i
|
|
109
64
|
});
|
|
110
65
|
return;
|
|
111
66
|
}
|
|
112
67
|
var newVal = oldVal === null || oldVal === void 0 ? void 0 : oldVal[index];
|
|
113
|
-
oldData.push(
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
{},
|
|
117
|
-
{
|
|
118
|
-
index: i,
|
|
119
|
-
}
|
|
120
|
-
)
|
|
121
|
-
);
|
|
68
|
+
oldData.push(_objectSpread(_objectSpread({}, newVal), {}, {
|
|
69
|
+
index: i
|
|
70
|
+
}));
|
|
122
71
|
});
|
|
123
72
|
return {
|
|
124
73
|
oldData: oldData,
|
|
125
|
-
newData: newData
|
|
74
|
+
newData: newData
|
|
126
75
|
};
|
|
127
76
|
};
|
|
128
77
|
var resultProvider = function resultProvider(newData, oldData, value) {
|
|
@@ -143,46 +92,33 @@ var multiple = function multiple(_ref3, oldVal) {
|
|
|
143
92
|
var options = _ref3.options,
|
|
144
93
|
value = _ref3.value,
|
|
145
94
|
noMatchItemRender = _ref3.noMatchItemRender;
|
|
146
|
-
var _sourceDataProvider = sourceDataProvider(
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
},
|
|
151
|
-
oldVal
|
|
152
|
-
),
|
|
95
|
+
var _sourceDataProvider = sourceDataProvider({
|
|
96
|
+
options: options,
|
|
97
|
+
value: value
|
|
98
|
+
}, oldVal),
|
|
153
99
|
newData = _sourceDataProvider.newData,
|
|
154
100
|
oldData = _sourceDataProvider.oldData;
|
|
155
|
-
var newMatchVal = _mapInstanceProperty(newData).call(
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
{},
|
|
168
|
-
{
|
|
169
|
-
index: index,
|
|
170
|
-
}
|
|
171
|
-
);
|
|
172
|
-
}
|
|
173
|
-
);
|
|
101
|
+
var newMatchVal = _mapInstanceProperty(newData).call(newData, function (item) {
|
|
102
|
+
var itemVal = item.value,
|
|
103
|
+
index = item.index;
|
|
104
|
+
var newItem = single({
|
|
105
|
+
options: options,
|
|
106
|
+
value: itemVal,
|
|
107
|
+
noMatchItemRender: noMatchItemRender
|
|
108
|
+
});
|
|
109
|
+
return _objectSpread(_objectSpread({}, newItem), {}, {
|
|
110
|
+
index: index
|
|
111
|
+
});
|
|
112
|
+
});
|
|
174
113
|
return resultProvider(newMatchVal, oldData, value);
|
|
175
114
|
};
|
|
176
115
|
var tag = function tag(_ref4, oldVal) {
|
|
177
116
|
var options = _ref4.options,
|
|
178
117
|
value = _ref4.value;
|
|
179
|
-
var _sourceDataProvider2 = sourceDataProvider(
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
},
|
|
184
|
-
oldVal
|
|
185
|
-
),
|
|
118
|
+
var _sourceDataProvider2 = sourceDataProvider({
|
|
119
|
+
options: options,
|
|
120
|
+
value: value
|
|
121
|
+
}, oldVal),
|
|
186
122
|
newData = _sourceDataProvider2.newData,
|
|
187
123
|
oldData = _sourceDataProvider2.oldData;
|
|
188
124
|
return resultProvider(newData, oldData, value);
|
|
@@ -196,26 +132,20 @@ var matchNotFind = function matchNotFind(_ref5, oldVale) {
|
|
|
196
132
|
return single({
|
|
197
133
|
options: options,
|
|
198
134
|
value: value,
|
|
199
|
-
noMatchItemRender: noMatchItemRender
|
|
135
|
+
noMatchItemRender: noMatchItemRender
|
|
200
136
|
});
|
|
201
137
|
}
|
|
202
138
|
if (mode === "multiple") {
|
|
203
|
-
return multiple(
|
|
204
|
-
{
|
|
205
|
-
options: options,
|
|
206
|
-
value: value,
|
|
207
|
-
noMatchItemRender: noMatchItemRender,
|
|
208
|
-
},
|
|
209
|
-
oldVale
|
|
210
|
-
);
|
|
211
|
-
}
|
|
212
|
-
return tag(
|
|
213
|
-
{
|
|
139
|
+
return multiple({
|
|
214
140
|
options: options,
|
|
215
141
|
value: value,
|
|
216
|
-
|
|
217
|
-
oldVale
|
|
218
|
-
|
|
142
|
+
noMatchItemRender: noMatchItemRender
|
|
143
|
+
}, oldVale);
|
|
144
|
+
}
|
|
145
|
+
return tag({
|
|
146
|
+
options: options,
|
|
147
|
+
value: value
|
|
148
|
+
}, oldVale);
|
|
219
149
|
};
|
|
220
150
|
var useValueChange = function useValueChange(params) {
|
|
221
151
|
var labelInValue = params.labelInValue,
|
|
@@ -240,29 +170,23 @@ var useValueChange = function useValueChange(params) {
|
|
|
240
170
|
newChangeVal = changeVal;
|
|
241
171
|
}
|
|
242
172
|
if (_Array$isArray(changeVal)) {
|
|
243
|
-
newChangeVal = _mapInstanceProperty(changeVal).call(
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
return item.value;
|
|
247
|
-
}
|
|
248
|
-
);
|
|
173
|
+
newChangeVal = _mapInstanceProperty(changeVal).call(changeVal, function (item) {
|
|
174
|
+
return item.value;
|
|
175
|
+
});
|
|
249
176
|
}
|
|
250
177
|
var subItemOps = itemOpProvider(itemOps, fieldNames);
|
|
251
178
|
onChange(newChangeVal, subItemOps);
|
|
252
179
|
};
|
|
253
|
-
useEffect(
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
},
|
|
261
|
-
[value, options, mode, noMatchItemRender]
|
|
262
|
-
);
|
|
180
|
+
useEffect(function () {
|
|
181
|
+
if (options && value) {
|
|
182
|
+
setVal(function (oldVale) {
|
|
183
|
+
return matchNotFind(params, oldVale);
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
}, [value, options, mode, noMatchItemRender]);
|
|
263
187
|
return {
|
|
264
188
|
val: val,
|
|
265
|
-
change: change
|
|
189
|
+
change: change
|
|
266
190
|
};
|
|
267
191
|
};
|
|
268
192
|
|
|
@@ -1,28 +1,10 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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;
|
|
1
|
+
import type { OptionType, PartialHSelectProps } from "@/components/Select/modal";
|
|
2
|
+
export declare const useOptionReq: ({ manual, request, options, serviceSearch, showSearch, onSearch: propsOnSearch, }: PartialHSelectProps) => {
|
|
3
|
+
run: (params?: any, type?: any) => Promise<OptionType[] | undefined>;
|
|
4
|
+
loading: boolean;
|
|
5
|
+
error: Error | undefined;
|
|
6
|
+
data: OptionType[] | undefined;
|
|
7
|
+
onSearch: ((value: string) => void) | undefined;
|
|
8
|
+
mathShowSearch: boolean | undefined;
|
|
19
9
|
};
|
|
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;
|
|
10
|
+
export declare const useFilterOption: ({ filterOption, serviceSearch, }: PartialHSelectProps) => boolean | import("rc-select/lib/Select").FilterFunc<import("rc-select/lib/Select").DefaultOptionType> | 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,59 +17,47 @@ 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
|
-
|
|
49
|
-
}
|
|
50
|
-
}, _callee);
|
|
51
|
-
})
|
|
52
|
-
),
|
|
53
|
-
{
|
|
54
|
-
manual: manual,
|
|
55
|
-
debounceInterval: 300,
|
|
56
|
-
onSuccess: function onSuccess(resultData) {
|
|
57
|
-
setData(resultData);
|
|
58
|
-
},
|
|
20
|
+
var _useRequest = useRequest( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
21
|
+
var params,
|
|
22
|
+
type,
|
|
23
|
+
_args = arguments;
|
|
24
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
25
|
+
while (1) switch (_context.prev = _context.next) {
|
|
26
|
+
case 0:
|
|
27
|
+
params = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
|
|
28
|
+
type = _args.length > 1 && _args[1] !== undefined ? _args[1] : "init";
|
|
29
|
+
if (type === "init") {
|
|
30
|
+
setData(undefined);
|
|
31
|
+
}
|
|
32
|
+
if (!request) {
|
|
33
|
+
_context.next = 5;
|
|
34
|
+
break;
|
|
35
|
+
}
|
|
36
|
+
return _context.abrupt("return", request(params));
|
|
37
|
+
case 5:
|
|
38
|
+
return _context.abrupt("return", _Promise.resolve(options));
|
|
39
|
+
case 6:
|
|
40
|
+
case "end":
|
|
41
|
+
return _context.stop();
|
|
42
|
+
}
|
|
43
|
+
}, _callee);
|
|
44
|
+
})), {
|
|
45
|
+
manual: manual,
|
|
46
|
+
debounceInterval: 300,
|
|
47
|
+
onSuccess: function onSuccess(resultData) {
|
|
48
|
+
setData(resultData);
|
|
59
49
|
}
|
|
60
|
-
),
|
|
50
|
+
}),
|
|
61
51
|
run = _useRequest.run,
|
|
62
52
|
loading = _useRequest.loading,
|
|
63
53
|
error = _useRequest.error;
|
|
64
54
|
var onSearch = function onSearch(inputValue) {
|
|
65
55
|
if (!serviceSearch) {
|
|
66
|
-
propsOnSearch === null || propsOnSearch === void 0
|
|
67
|
-
? void 0
|
|
68
|
-
: propsOnSearch(inputValue);
|
|
56
|
+
propsOnSearch === null || propsOnSearch === void 0 ? void 0 : propsOnSearch(inputValue);
|
|
69
57
|
return;
|
|
70
58
|
}
|
|
71
59
|
run({
|
|
72
|
-
inputValue: inputValue
|
|
60
|
+
inputValue: inputValue
|
|
73
61
|
});
|
|
74
62
|
};
|
|
75
63
|
var mathShowSearch = showSearch || serviceSearch;
|
|
@@ -79,7 +67,7 @@ var useOptionReq = function useOptionReq(_ref) {
|
|
|
79
67
|
error: error,
|
|
80
68
|
data: data,
|
|
81
69
|
onSearch: mathShowSearch ? onSearch : propsOnSearch,
|
|
82
|
-
mathShowSearch: showSearch || serviceSearch
|
|
70
|
+
mathShowSearch: showSearch || serviceSearch
|
|
83
71
|
};
|
|
84
72
|
};
|
|
85
73
|
var useFilterOption = function useFilterOption(_ref3) {
|
package/es/Select/index.d.ts
CHANGED
|
@@ -1,25 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { HSelectProps } from "./modal";
|
|
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;
|
|
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;
|
|
25
4
|
export default _default;
|