@hw-component/form 0.0.1-beta → 0.0.1-beta-v3
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 +78 -0
- package/es/ModalForm/index.d.ts +4 -0
- package/es/ModalForm/index.js +59 -0
- package/es/ModalForm/modal.d.ts +23 -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 +81 -0
- package/lib/ModalForm/index.d.ts +4 -0
- package/lib/ModalForm/index.js +62 -0
- package/lib/ModalForm/modal.d.ts +23 -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 +61 -0
- package/src/components/ModalForm/index.tsx +52 -0
- package/src/components/ModalForm/modal.ts +25 -0
- package/src/components/index.tsx +4 -0
- package/src/pages/ModalForm/index.tsx +127 -0
- package/src/routes.tsx +6 -1
|
@@ -1,63 +1,41 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports,
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var React = require(
|
|
6
|
-
var antd = require(
|
|
7
|
-
var icons = require(
|
|
5
|
+
var React = require('react');
|
|
6
|
+
var antd = require('antd');
|
|
7
|
+
var icons = require('@ant-design/icons');
|
|
8
8
|
|
|
9
9
|
var Text = antd.Typography.Text;
|
|
10
|
-
var NotFoundContent = function (_ref) {
|
|
10
|
+
var NotFoundContent = (function (_ref) {
|
|
11
11
|
var error = _ref.error,
|
|
12
12
|
reload = _ref.reload;
|
|
13
13
|
if (error) {
|
|
14
|
-
return /*#__PURE__*/
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
/*#__PURE__*/ React.createElement(icons.ExclamationCircleOutlined, {
|
|
35
|
-
size: 24,
|
|
36
|
-
})
|
|
37
|
-
),
|
|
38
|
-
/*#__PURE__*/ React.createElement(
|
|
39
|
-
Text,
|
|
40
|
-
{
|
|
41
|
-
type: "danger",
|
|
42
|
-
},
|
|
43
|
-
error.message
|
|
44
|
-
),
|
|
45
|
-
/*#__PURE__*/ React.createElement(
|
|
46
|
-
antd.Button,
|
|
47
|
-
{
|
|
48
|
-
type: "primary",
|
|
49
|
-
size: "small",
|
|
50
|
-
onClick: reload,
|
|
51
|
-
},
|
|
52
|
-
"\u91CD\u65B0\u52A0\u8F7D"
|
|
53
|
-
)
|
|
54
|
-
)
|
|
55
|
-
);
|
|
14
|
+
return /*#__PURE__*/React.createElement(antd.Row, {
|
|
15
|
+
justify: "center",
|
|
16
|
+
align: "middle",
|
|
17
|
+
style: {
|
|
18
|
+
height: 125
|
|
19
|
+
}
|
|
20
|
+
}, /*#__PURE__*/React.createElement(antd.Space, {
|
|
21
|
+
align: "center",
|
|
22
|
+
direction: "vertical"
|
|
23
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
24
|
+
type: "danger"
|
|
25
|
+
}, /*#__PURE__*/React.createElement(icons.ExclamationCircleOutlined, {
|
|
26
|
+
size: 24
|
|
27
|
+
})), /*#__PURE__*/React.createElement(Text, {
|
|
28
|
+
type: "danger"
|
|
29
|
+
}, error.message), /*#__PURE__*/React.createElement(antd.Button, {
|
|
30
|
+
type: "primary",
|
|
31
|
+
size: "small",
|
|
32
|
+
onClick: reload
|
|
33
|
+
}, "\u91CD\u65B0\u52A0\u8F7D")));
|
|
56
34
|
}
|
|
57
|
-
return /*#__PURE__*/
|
|
58
|
-
image: antd.Empty.PRESENTED_IMAGE_SIMPLE
|
|
35
|
+
return /*#__PURE__*/React.createElement(antd.Empty, {
|
|
36
|
+
image: antd.Empty.PRESENTED_IMAGE_SIMPLE
|
|
59
37
|
});
|
|
60
|
-
};
|
|
38
|
+
});
|
|
61
39
|
|
|
62
40
|
exports.default = NotFoundContent;
|
|
63
41
|
// powered by h
|
|
@@ -1,37 +1,33 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
2
|
|
|
3
|
-
var React = require(
|
|
4
|
-
var _mapInstanceProperty = require(
|
|
5
|
-
var _indexOfInstanceProperty = require(
|
|
6
|
-
var CheckBoxOption = require(
|
|
7
|
-
var NoFindItem = require(
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var _mapInstanceProperty = require('@babel/runtime-corejs3/core-js/instance/map');
|
|
5
|
+
var _indexOfInstanceProperty = require('@babel/runtime-corejs3/core-js/instance/index-of');
|
|
6
|
+
var CheckBoxOption = require('./components/CheckBoxOption.js');
|
|
7
|
+
var NoFindItem = require('./components/NoFindItem.js');
|
|
8
8
|
|
|
9
9
|
var defaultModeConfig = {
|
|
10
10
|
multiple: {
|
|
11
11
|
icon: null,
|
|
12
12
|
render: function render(item, value) {
|
|
13
|
-
var checkVal =
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
: _mapInstanceProperty(value).call(value, function (itemVal) {
|
|
17
|
-
return itemVal.value;
|
|
18
|
-
});
|
|
13
|
+
var checkVal = value === null || value === void 0 ? void 0 : _mapInstanceProperty(value).call(value, function (itemVal) {
|
|
14
|
+
return itemVal.value;
|
|
15
|
+
});
|
|
19
16
|
var newVal = checkVal || [];
|
|
20
|
-
var checked =
|
|
21
|
-
|
|
22
|
-
return /*#__PURE__*/ React.createElement(CheckBoxOption.default, {
|
|
17
|
+
var checked = _indexOfInstanceProperty(newVal).call(newVal, item.value) !== -1;
|
|
18
|
+
return /*#__PURE__*/React.createElement(CheckBoxOption.default, {
|
|
23
19
|
label: item.label,
|
|
24
|
-
checked: checked
|
|
20
|
+
checked: checked
|
|
25
21
|
});
|
|
26
|
-
}
|
|
27
|
-
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
28
24
|
};
|
|
29
25
|
var defaultSelectConfig = {
|
|
30
26
|
noMatchItemRender: function noMatchItemRender() {
|
|
31
|
-
return /*#__PURE__*/
|
|
32
|
-
label: "选项被删除,请重新选择"
|
|
27
|
+
return /*#__PURE__*/React.createElement(NoFindItem.default, {
|
|
28
|
+
label: "选项被删除,请重新选择"
|
|
33
29
|
});
|
|
34
|
-
}
|
|
30
|
+
}
|
|
35
31
|
};
|
|
36
32
|
|
|
37
33
|
exports.defaultModeConfig = defaultModeConfig;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { PartialHSelectProps } from "@/components/Select/modal";
|
|
2
2
|
export declare const useValueChange: (params: PartialHSelectProps) => {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
val: any;
|
|
4
|
+
change: (changeVal: any, itemOps: any) => void;
|
|
5
5
|
};
|
|
@@ -1,91 +1,46 @@
|
|
|
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
|
-
|
|
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
|
-
}
|
|
22
|
+
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; }
|
|
23
|
+
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; }
|
|
63
24
|
var single = function single(_ref) {
|
|
64
25
|
var options = _ref.options,
|
|
65
26
|
value = _ref.value,
|
|
66
27
|
noMatchItemRender = _ref.noMatchItemRender;
|
|
67
28
|
var newOptions = options || [];
|
|
68
|
-
var index = _findIndexInstanceProperty(newOptions).call(
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
return item.value === value;
|
|
72
|
-
}
|
|
73
|
-
);
|
|
29
|
+
var index = _findIndexInstanceProperty(newOptions).call(newOptions, function (item) {
|
|
30
|
+
return item.value === value;
|
|
31
|
+
});
|
|
74
32
|
if (index !== -1) {
|
|
75
33
|
var label = newOptions[index].label;
|
|
76
34
|
return {
|
|
77
35
|
value: value,
|
|
78
|
-
label: label
|
|
36
|
+
label: label
|
|
79
37
|
};
|
|
80
38
|
}
|
|
81
39
|
return {
|
|
82
40
|
value: value,
|
|
83
|
-
label:
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
: noMatchItemRender({
|
|
87
|
-
value: value,
|
|
88
|
-
})) || value,
|
|
41
|
+
label: (noMatchItemRender === null || noMatchItemRender === void 0 ? void 0 : noMatchItemRender({
|
|
42
|
+
value: value
|
|
43
|
+
})) || value
|
|
89
44
|
};
|
|
90
45
|
};
|
|
91
46
|
var findNewValInOldVal = function findNewValInOldVal(val, oldVal) {
|
|
@@ -98,7 +53,7 @@ var findNewValInOldVal = function findNewValInOldVal(val, oldVal) {
|
|
|
98
53
|
};
|
|
99
54
|
var sourceDataProvider = function sourceDataProvider(_ref2, oldVal) {
|
|
100
55
|
_ref2.options;
|
|
101
|
-
|
|
56
|
+
var value = _ref2.value;
|
|
102
57
|
var oldData = [];
|
|
103
58
|
var newData = [];
|
|
104
59
|
_forEachInstanceProperty(value).call(value, function (item, i) {
|
|
@@ -106,24 +61,18 @@ var sourceDataProvider = function sourceDataProvider(_ref2, oldVal) {
|
|
|
106
61
|
if (index === -1) {
|
|
107
62
|
newData.push({
|
|
108
63
|
value: item,
|
|
109
|
-
index: i
|
|
64
|
+
index: i
|
|
110
65
|
});
|
|
111
66
|
return;
|
|
112
67
|
}
|
|
113
68
|
var newVal = oldVal === null || oldVal === void 0 ? void 0 : oldVal[index];
|
|
114
|
-
oldData.push(
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
{},
|
|
118
|
-
{
|
|
119
|
-
index: i,
|
|
120
|
-
}
|
|
121
|
-
)
|
|
122
|
-
);
|
|
69
|
+
oldData.push(_objectSpread(_objectSpread({}, newVal), {}, {
|
|
70
|
+
index: i
|
|
71
|
+
}));
|
|
123
72
|
});
|
|
124
73
|
return {
|
|
125
74
|
oldData: oldData,
|
|
126
|
-
newData: newData
|
|
75
|
+
newData: newData
|
|
127
76
|
};
|
|
128
77
|
};
|
|
129
78
|
var resultProvider = function resultProvider(newData, oldData, value) {
|
|
@@ -144,46 +93,33 @@ var multiple = function multiple(_ref3, oldVal) {
|
|
|
144
93
|
var options = _ref3.options,
|
|
145
94
|
value = _ref3.value,
|
|
146
95
|
noMatchItemRender = _ref3.noMatchItemRender;
|
|
147
|
-
var _sourceDataProvider = sourceDataProvider(
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
},
|
|
152
|
-
oldVal
|
|
153
|
-
),
|
|
96
|
+
var _sourceDataProvider = sourceDataProvider({
|
|
97
|
+
options: options,
|
|
98
|
+
value: value
|
|
99
|
+
}, oldVal),
|
|
154
100
|
newData = _sourceDataProvider.newData,
|
|
155
101
|
oldData = _sourceDataProvider.oldData;
|
|
156
|
-
var newMatchVal = _mapInstanceProperty(newData).call(
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
{},
|
|
169
|
-
{
|
|
170
|
-
index: index,
|
|
171
|
-
}
|
|
172
|
-
);
|
|
173
|
-
}
|
|
174
|
-
);
|
|
102
|
+
var newMatchVal = _mapInstanceProperty(newData).call(newData, function (item) {
|
|
103
|
+
var itemVal = item.value,
|
|
104
|
+
index = item.index;
|
|
105
|
+
var newItem = single({
|
|
106
|
+
options: options,
|
|
107
|
+
value: itemVal,
|
|
108
|
+
noMatchItemRender: noMatchItemRender
|
|
109
|
+
});
|
|
110
|
+
return _objectSpread(_objectSpread({}, newItem), {}, {
|
|
111
|
+
index: index
|
|
112
|
+
});
|
|
113
|
+
});
|
|
175
114
|
return resultProvider(newMatchVal, oldData, value);
|
|
176
115
|
};
|
|
177
116
|
var tag = function tag(_ref4, oldVal) {
|
|
178
117
|
var options = _ref4.options,
|
|
179
118
|
value = _ref4.value;
|
|
180
|
-
var _sourceDataProvider2 = sourceDataProvider(
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
},
|
|
185
|
-
oldVal
|
|
186
|
-
),
|
|
119
|
+
var _sourceDataProvider2 = sourceDataProvider({
|
|
120
|
+
options: options,
|
|
121
|
+
value: value
|
|
122
|
+
}, oldVal),
|
|
187
123
|
newData = _sourceDataProvider2.newData,
|
|
188
124
|
oldData = _sourceDataProvider2.oldData;
|
|
189
125
|
return resultProvider(newData, oldData, value);
|
|
@@ -197,26 +133,20 @@ var matchNotFind = function matchNotFind(_ref5, oldVale) {
|
|
|
197
133
|
return single({
|
|
198
134
|
options: options,
|
|
199
135
|
value: value,
|
|
200
|
-
noMatchItemRender: noMatchItemRender
|
|
136
|
+
noMatchItemRender: noMatchItemRender
|
|
201
137
|
});
|
|
202
138
|
}
|
|
203
139
|
if (mode === "multiple") {
|
|
204
|
-
return multiple(
|
|
205
|
-
{
|
|
206
|
-
options: options,
|
|
207
|
-
value: value,
|
|
208
|
-
noMatchItemRender: noMatchItemRender,
|
|
209
|
-
},
|
|
210
|
-
oldVale
|
|
211
|
-
);
|
|
212
|
-
}
|
|
213
|
-
return tag(
|
|
214
|
-
{
|
|
140
|
+
return multiple({
|
|
215
141
|
options: options,
|
|
216
142
|
value: value,
|
|
217
|
-
|
|
218
|
-
oldVale
|
|
219
|
-
|
|
143
|
+
noMatchItemRender: noMatchItemRender
|
|
144
|
+
}, oldVale);
|
|
145
|
+
}
|
|
146
|
+
return tag({
|
|
147
|
+
options: options,
|
|
148
|
+
value: value
|
|
149
|
+
}, oldVale);
|
|
220
150
|
};
|
|
221
151
|
var useValueChange = function useValueChange(params) {
|
|
222
152
|
var labelInValue = params.labelInValue,
|
|
@@ -241,29 +171,23 @@ var useValueChange = function useValueChange(params) {
|
|
|
241
171
|
newChangeVal = changeVal;
|
|
242
172
|
}
|
|
243
173
|
if (_Array$isArray(changeVal)) {
|
|
244
|
-
newChangeVal = _mapInstanceProperty(changeVal).call(
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
return item.value;
|
|
248
|
-
}
|
|
249
|
-
);
|
|
174
|
+
newChangeVal = _mapInstanceProperty(changeVal).call(changeVal, function (item) {
|
|
175
|
+
return item.value;
|
|
176
|
+
});
|
|
250
177
|
}
|
|
251
178
|
var subItemOps = utils.itemOpProvider(itemOps, fieldNames);
|
|
252
179
|
onChange(newChangeVal, subItemOps);
|
|
253
180
|
};
|
|
254
|
-
React.useEffect(
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
},
|
|
262
|
-
[value, options, mode, noMatchItemRender]
|
|
263
|
-
);
|
|
181
|
+
React.useEffect(function () {
|
|
182
|
+
if (options && value) {
|
|
183
|
+
setVal(function (oldVale) {
|
|
184
|
+
return matchNotFind(params, oldVale);
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
}, [value, options, mode, noMatchItemRender]);
|
|
264
188
|
return {
|
|
265
189
|
val: val,
|
|
266
|
-
change: change
|
|
190
|
+
change: change
|
|
267
191
|
};
|
|
268
192
|
};
|
|
269
193
|
|
|
@@ -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,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,59 +18,47 @@ 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
|
-
|
|
50
|
-
}
|
|
51
|
-
}, _callee);
|
|
52
|
-
})
|
|
53
|
-
),
|
|
54
|
-
{
|
|
55
|
-
manual: manual,
|
|
56
|
-
debounceInterval: 300,
|
|
57
|
-
onSuccess: function onSuccess(resultData) {
|
|
58
|
-
setData(resultData);
|
|
59
|
-
},
|
|
21
|
+
var _useRequest = ahooks.useRequest( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
22
|
+
var params,
|
|
23
|
+
type,
|
|
24
|
+
_args = arguments;
|
|
25
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
26
|
+
while (1) switch (_context.prev = _context.next) {
|
|
27
|
+
case 0:
|
|
28
|
+
params = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
|
|
29
|
+
type = _args.length > 1 && _args[1] !== undefined ? _args[1] : "init";
|
|
30
|
+
if (type === "init") {
|
|
31
|
+
setData(undefined);
|
|
32
|
+
}
|
|
33
|
+
if (!request) {
|
|
34
|
+
_context.next = 5;
|
|
35
|
+
break;
|
|
36
|
+
}
|
|
37
|
+
return _context.abrupt("return", request(params));
|
|
38
|
+
case 5:
|
|
39
|
+
return _context.abrupt("return", _Promise.resolve(options));
|
|
40
|
+
case 6:
|
|
41
|
+
case "end":
|
|
42
|
+
return _context.stop();
|
|
43
|
+
}
|
|
44
|
+
}, _callee);
|
|
45
|
+
})), {
|
|
46
|
+
manual: manual,
|
|
47
|
+
debounceInterval: 300,
|
|
48
|
+
onSuccess: function onSuccess(resultData) {
|
|
49
|
+
setData(resultData);
|
|
60
50
|
}
|
|
61
|
-
),
|
|
51
|
+
}),
|
|
62
52
|
run = _useRequest.run,
|
|
63
53
|
loading = _useRequest.loading,
|
|
64
54
|
error = _useRequest.error;
|
|
65
55
|
var onSearch = function onSearch(inputValue) {
|
|
66
56
|
if (!serviceSearch) {
|
|
67
|
-
propsOnSearch === null || propsOnSearch === void 0
|
|
68
|
-
? void 0
|
|
69
|
-
: propsOnSearch(inputValue);
|
|
57
|
+
propsOnSearch === null || propsOnSearch === void 0 ? void 0 : propsOnSearch(inputValue);
|
|
70
58
|
return;
|
|
71
59
|
}
|
|
72
60
|
run({
|
|
73
|
-
inputValue: inputValue
|
|
61
|
+
inputValue: inputValue
|
|
74
62
|
});
|
|
75
63
|
};
|
|
76
64
|
var mathShowSearch = showSearch || serviceSearch;
|
|
@@ -80,7 +68,7 @@ var useOptionReq = function useOptionReq(_ref) {
|
|
|
80
68
|
error: error,
|
|
81
69
|
data: data,
|
|
82
70
|
onSearch: mathShowSearch ? onSearch : propsOnSearch,
|
|
83
|
-
mathShowSearch: showSearch || serviceSearch
|
|
71
|
+
mathShowSearch: showSearch || serviceSearch
|
|
84
72
|
};
|
|
85
73
|
};
|
|
86
74
|
var useFilterOption = function useFilterOption(_ref3) {
|
package/lib/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;
|