@hw-component/form 0.0.1-bate
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/.babelrc +23 -0
- package/.eslintrc.js +8 -0
- package/.husky/pre-commit +4 -0
- package/.stylelintrc.js +5 -0
- package/LICENSE +201 -0
- package/es/CheckboxGroup/CheckBox/index.d.ts +4 -0
- package/es/CheckboxGroup/CheckBox/index.js +40 -0
- package/es/CheckboxGroup/hooks.d.ts +5 -0
- package/es/CheckboxGroup/hooks.js +123 -0
- package/es/CheckboxGroup/index.d.ts +3 -0
- package/es/CheckboxGroup/index.js +89 -0
- package/es/CheckboxGroup/modal.d.ts +13 -0
- package/es/Form/Context/FormConfigProvider.d.ts +5 -0
- package/es/Form/Context/FormConfigProvider.js +47 -0
- package/es/Form/Context/index.d.ts +5 -0
- package/es/Form/Context/index.js +11 -0
- package/es/Form/FormItem/BasicItem.d.ts +4 -0
- package/es/Form/FormItem/BasicItem.js +73 -0
- package/es/Form/FormItem/Helper.d.ts +7 -0
- package/es/Form/FormItem/Helper.js +24 -0
- package/es/Form/FormItem/RegularFormItem.d.ts +4 -0
- package/es/Form/FormItem/RegularFormItem.js +15 -0
- package/es/Form/FormItem/UpFormItem.d.ts +4 -0
- package/es/Form/FormItem/UpFormItem.js +31 -0
- package/es/Form/FormItem/hooks.d.ts +10 -0
- package/es/Form/FormItem/hooks.js +38 -0
- package/es/Form/FormItem/index.d.ts +4 -0
- package/es/Form/FormItem/index.js +11 -0
- package/es/Form/HFormConnect.d.ts +6 -0
- package/es/Form/HFormConnect.js +54 -0
- package/es/Form/InitSet.d.ts +6 -0
- package/es/Form/InitSet.js +16 -0
- package/es/Form/Label.d.ts +10 -0
- package/es/Form/Label.js +46 -0
- package/es/Form/config.d.ts +28 -0
- package/es/Form/config.js +43 -0
- package/es/Form/hooks/index.d.ts +12 -0
- package/es/Form/hooks/index.js +77 -0
- package/es/Form/hooks/useHForm.d.ts +3 -0
- package/es/Form/hooks/useHForm.js +111 -0
- package/es/Form/hooks/useInitConfigData.d.ts +4 -0
- package/es/Form/hooks/useInitConfigData.js +124 -0
- package/es/Form/index.d.ts +4 -0
- package/es/Form/index.js +73 -0
- package/es/Form/modal.d.ts +92 -0
- package/es/Input/ButtonInput.d.ts +4 -0
- package/es/Input/ButtonInput.js +80 -0
- package/es/Input/InputNumber.d.ts +4 -0
- package/es/Input/InputNumber.js +20 -0
- package/es/Input/SelectInput.d.ts +9 -0
- package/es/Input/SelectInput.js +94 -0
- package/es/Input/defaultConfig.d.ts +7 -0
- package/es/Input/defaultConfig.js +11 -0
- package/es/Input/index.d.ts +4 -0
- package/es/Input/index.js +13 -0
- package/es/Input/modal.d.ts +25 -0
- package/es/PageHandler/ErrorComponent.d.ts +4 -0
- package/es/PageHandler/ErrorComponent.js +33 -0
- package/es/PageHandler/LoadingComponent.d.ts +3 -0
- package/es/PageHandler/LoadingComponent.js +18 -0
- package/es/PageHandler/index.d.ts +4 -0
- package/es/PageHandler/index.js +24 -0
- package/es/PageHandler/modal.d.ts +6 -0
- package/es/RadioGroup/index.d.ts +9 -0
- package/es/RadioGroup/index.js +48 -0
- package/es/Select/components/AllSelect.d.ts +7 -0
- package/es/Select/components/AllSelect.js +50 -0
- package/es/Select/components/CheckBoxOption.d.ts +7 -0
- package/es/Select/components/CheckBoxOption.js +14 -0
- package/es/Select/components/DropdownComponent.d.ts +9 -0
- package/es/Select/components/DropdownComponent.js +39 -0
- package/es/Select/components/NoFindItem.d.ts +6 -0
- package/es/Select/components/NoFindItem.js +13 -0
- package/es/Select/components/NotFoundContent.d.ts +7 -0
- package/es/Select/components/NotFoundContent.js +38 -0
- package/es/Select/defaultConfig.d.ts +6 -0
- package/es/Select/defaultConfig.js +33 -0
- package/es/Select/hooks/changeHooks.d.ts +5 -0
- package/es/Select/hooks/changeHooks.js +194 -0
- package/es/Select/hooks/norHooks.d.ts +10 -0
- package/es/Select/hooks/norHooks.js +85 -0
- package/es/Select/index.d.ts +4 -0
- package/es/Select/index.js +128 -0
- package/es/Select/modal.d.ts +30 -0
- package/es/Select/utils.d.ts +2 -0
- package/es/Select/utils.js +39 -0
- package/es/Submit/index.d.ts +8 -0
- package/es/Submit/index.js +28 -0
- package/es/Switch/index.d.ts +11 -0
- package/es/Switch/index.js +45 -0
- package/es/TDPicker/RangePicker.d.ts +8 -0
- package/es/TDPicker/RangePicker.js +116 -0
- package/es/TDPicker/TimePicker.d.ts +4 -0
- package/es/TDPicker/TimePicker.js +31 -0
- package/es/TDPicker/hooks.d.ts +33 -0
- package/es/TDPicker/hooks.js +132 -0
- package/es/TDPicker/index.d.ts +4 -0
- package/es/TDPicker/index.js +33 -0
- package/es/TDPicker/modal.d.ts +28 -0
- package/es/TextArea/index.d.ts +3 -0
- package/es/Upload/Btn.d.ts +4 -0
- package/es/Upload/Btn.js +31 -0
- package/es/Upload/MediaTypeEle/TypeEle.d.ts +10 -0
- package/es/Upload/MediaTypeEle/TypeEle.js +40 -0
- package/es/Upload/MediaTypeEle/index.d.ts +4 -0
- package/es/Upload/MediaTypeEle/index.js +36 -0
- package/es/Upload/Preview/index.d.ts +6 -0
- package/es/Upload/Preview/index.js +21 -0
- package/es/Upload/UrlUpload/index.d.ts +4 -0
- package/es/Upload/UrlUpload/index.js +119 -0
- package/es/Upload/enums.d.ts +5 -0
- package/es/Upload/enums.js +10 -0
- package/es/Upload/hooks/change.d.ts +3 -0
- package/es/Upload/hooks/change.js +109 -0
- package/es/Upload/hooks/customRequest.d.ts +3 -0
- package/es/Upload/hooks/customRequest.js +69 -0
- package/es/Upload/hooks/propsMaker.d.ts +2 -0
- package/es/Upload/hooks/propsMaker.js +37 -0
- package/es/Upload/index.d.ts +4 -0
- package/es/Upload/index.js +106 -0
- package/es/Upload/modal.d.ts +28 -0
- package/es/Upload/util.d.ts +5 -0
- package/es/Upload/util.js +34 -0
- package/es/config.d.ts +2 -0
- package/es/config.js +64 -0
- package/es/hooks/index.d.ts +13 -0
- package/es/hooks/index.js +75 -0
- package/es/index.css +35 -0
- package/es/index.d.ts +20 -0
- package/es/index.js +25 -0
- package/es/modal.d.ts +15 -0
- package/lib/CheckboxGroup/CheckBox/index.d.ts +4 -0
- package/lib/CheckboxGroup/CheckBox/index.js +43 -0
- package/lib/CheckboxGroup/hooks.d.ts +5 -0
- package/lib/CheckboxGroup/hooks.js +124 -0
- package/lib/CheckboxGroup/index.d.ts +3 -0
- package/lib/CheckboxGroup/index.js +92 -0
- package/lib/CheckboxGroup/modal.d.ts +13 -0
- package/lib/Form/Context/FormConfigProvider.d.ts +5 -0
- package/lib/Form/Context/FormConfigProvider.js +51 -0
- package/lib/Form/Context/index.d.ts +5 -0
- package/lib/Form/Context/index.js +14 -0
- package/lib/Form/FormItem/BasicItem.d.ts +4 -0
- package/lib/Form/FormItem/BasicItem.js +76 -0
- package/lib/Form/FormItem/Helper.d.ts +7 -0
- package/lib/Form/FormItem/Helper.js +27 -0
- package/lib/Form/FormItem/RegularFormItem.d.ts +4 -0
- package/lib/Form/FormItem/RegularFormItem.js +18 -0
- package/lib/Form/FormItem/UpFormItem.d.ts +4 -0
- package/lib/Form/FormItem/UpFormItem.js +34 -0
- package/lib/Form/FormItem/hooks.d.ts +10 -0
- package/lib/Form/FormItem/hooks.js +41 -0
- package/lib/Form/FormItem/index.d.ts +4 -0
- package/lib/Form/FormItem/index.js +14 -0
- package/lib/Form/HFormConnect.d.ts +6 -0
- package/lib/Form/HFormConnect.js +57 -0
- package/lib/Form/InitSet.d.ts +6 -0
- package/lib/Form/InitSet.js +19 -0
- package/lib/Form/Label.d.ts +10 -0
- package/lib/Form/Label.js +49 -0
- package/lib/Form/config.d.ts +28 -0
- package/lib/Form/config.js +47 -0
- package/lib/Form/hooks/index.d.ts +12 -0
- package/lib/Form/hooks/index.js +80 -0
- package/lib/Form/hooks/useHForm.d.ts +3 -0
- package/lib/Form/hooks/useHForm.js +114 -0
- package/lib/Form/hooks/useInitConfigData.d.ts +4 -0
- package/lib/Form/hooks/useInitConfigData.js +127 -0
- package/lib/Form/index.d.ts +4 -0
- package/lib/Form/index.js +76 -0
- package/lib/Form/modal.d.ts +92 -0
- package/lib/Input/ButtonInput.d.ts +4 -0
- package/lib/Input/ButtonInput.js +83 -0
- package/lib/Input/InputNumber.d.ts +4 -0
- package/lib/Input/InputNumber.js +23 -0
- package/lib/Input/SelectInput.d.ts +9 -0
- package/lib/Input/SelectInput.js +98 -0
- package/lib/Input/defaultConfig.d.ts +7 -0
- package/lib/Input/defaultConfig.js +13 -0
- package/lib/Input/index.d.ts +4 -0
- package/lib/Input/index.js +16 -0
- package/lib/Input/modal.d.ts +25 -0
- package/lib/PageHandler/ErrorComponent.d.ts +4 -0
- package/lib/PageHandler/ErrorComponent.js +36 -0
- package/lib/PageHandler/LoadingComponent.d.ts +3 -0
- package/lib/PageHandler/LoadingComponent.js +21 -0
- package/lib/PageHandler/index.d.ts +4 -0
- package/lib/PageHandler/index.js +27 -0
- package/lib/PageHandler/modal.d.ts +6 -0
- package/lib/RadioGroup/index.d.ts +9 -0
- package/lib/RadioGroup/index.js +51 -0
- package/lib/Select/components/AllSelect.d.ts +7 -0
- package/lib/Select/components/AllSelect.js +53 -0
- package/lib/Select/components/CheckBoxOption.d.ts +7 -0
- package/lib/Select/components/CheckBoxOption.js +17 -0
- package/lib/Select/components/DropdownComponent.d.ts +9 -0
- package/lib/Select/components/DropdownComponent.js +42 -0
- package/lib/Select/components/NoFindItem.d.ts +6 -0
- package/lib/Select/components/NoFindItem.js +16 -0
- package/lib/Select/components/NotFoundContent.d.ts +7 -0
- package/lib/Select/components/NotFoundContent.js +41 -0
- package/lib/Select/defaultConfig.d.ts +6 -0
- package/lib/Select/defaultConfig.js +35 -0
- package/lib/Select/hooks/changeHooks.d.ts +5 -0
- package/lib/Select/hooks/changeHooks.js +195 -0
- package/lib/Select/hooks/norHooks.d.ts +10 -0
- package/lib/Select/hooks/norHooks.js +87 -0
- package/lib/Select/index.d.ts +4 -0
- package/lib/Select/index.js +131 -0
- package/lib/Select/modal.d.ts +30 -0
- package/lib/Select/utils.d.ts +2 -0
- package/lib/Select/utils.js +41 -0
- package/lib/Submit/index.d.ts +8 -0
- package/lib/Submit/index.js +31 -0
- package/lib/Switch/index.d.ts +11 -0
- package/lib/Switch/index.js +48 -0
- package/lib/TDPicker/RangePicker.d.ts +8 -0
- package/lib/TDPicker/RangePicker.js +119 -0
- package/lib/TDPicker/TimePicker.d.ts +4 -0
- package/lib/TDPicker/TimePicker.js +34 -0
- package/lib/TDPicker/hooks.d.ts +33 -0
- package/lib/TDPicker/hooks.js +139 -0
- package/lib/TDPicker/index.d.ts +4 -0
- package/lib/TDPicker/index.js +36 -0
- package/lib/TDPicker/modal.d.ts +28 -0
- package/lib/TextArea/index.d.ts +3 -0
- package/lib/Upload/Btn.d.ts +4 -0
- package/lib/Upload/Btn.js +34 -0
- package/lib/Upload/MediaTypeEle/TypeEle.d.ts +10 -0
- package/lib/Upload/MediaTypeEle/TypeEle.js +43 -0
- package/lib/Upload/MediaTypeEle/index.d.ts +4 -0
- package/lib/Upload/MediaTypeEle/index.js +39 -0
- package/lib/Upload/Preview/index.d.ts +6 -0
- package/lib/Upload/Preview/index.js +24 -0
- package/lib/Upload/UrlUpload/index.d.ts +4 -0
- package/lib/Upload/UrlUpload/index.js +122 -0
- package/lib/Upload/enums.d.ts +5 -0
- package/lib/Upload/enums.js +9 -0
- package/lib/Upload/hooks/change.d.ts +3 -0
- package/lib/Upload/hooks/change.js +110 -0
- package/lib/Upload/hooks/customRequest.d.ts +3 -0
- package/lib/Upload/hooks/customRequest.js +70 -0
- package/lib/Upload/hooks/propsMaker.d.ts +2 -0
- package/lib/Upload/hooks/propsMaker.js +38 -0
- package/lib/Upload/index.d.ts +4 -0
- package/lib/Upload/index.js +109 -0
- package/lib/Upload/modal.d.ts +28 -0
- package/lib/Upload/util.d.ts +5 -0
- package/lib/Upload/util.js +38 -0
- package/lib/config.d.ts +2 -0
- package/lib/config.js +65 -0
- package/lib/hooks/index.d.ts +13 -0
- package/lib/hooks/index.js +78 -0
- package/lib/index.css +35 -0
- package/lib/index.d.ts +20 -0
- package/lib/index.js +43 -0
- package/lib/modal.d.ts +15 -0
- package/package.json +81 -0
- package/public/index.html +19 -0
- package/scripts/rollup.config.js +75 -0
- package/scripts/webpack.config.js +76 -0
- package/src/Layout.tsx +61 -0
- package/src/app.tsx +33 -0
- package/src/components/CheckboxGroup/CheckBox/index.tsx +38 -0
- package/src/components/CheckboxGroup/hooks.ts +102 -0
- package/src/components/CheckboxGroup/index.tsx +79 -0
- package/src/components/CheckboxGroup/modal.ts +15 -0
- package/src/components/Form/Context/FormConfigProvider.tsx +38 -0
- package/src/components/Form/Context/index.tsx +14 -0
- package/src/components/Form/FormItem/BasicItem.tsx +70 -0
- package/src/components/Form/FormItem/Helper.tsx +26 -0
- package/src/components/Form/FormItem/RegularFormItem.tsx +7 -0
- package/src/components/Form/FormItem/UpFormItem.tsx +20 -0
- package/src/components/Form/FormItem/hooks.tsx +44 -0
- package/src/components/Form/FormItem/index.tsx +8 -0
- package/src/components/Form/HFormConnect.tsx +49 -0
- package/src/components/Form/InitSet.tsx +12 -0
- package/src/components/Form/Label.tsx +50 -0
- package/src/components/Form/config.ts +40 -0
- package/src/components/Form/hooks/index.ts +42 -0
- package/src/components/Form/hooks/useHForm.ts +89 -0
- package/src/components/Form/hooks/useInitConfigData.tsx +100 -0
- package/src/components/Form/index.less +22 -0
- package/src/components/Form/index.tsx +61 -0
- package/src/components/Form/modal.ts +142 -0
- package/src/components/Input/ButtonInput.tsx +41 -0
- package/src/components/Input/InputNumber.tsx +5 -0
- package/src/components/Input/SelectInput.tsx +74 -0
- package/src/components/Input/defaultConfig.ts +8 -0
- package/src/components/Input/index.tsx +6 -0
- package/src/components/Input/modal.ts +31 -0
- package/src/components/PageHandler/ErrorComponent.tsx +20 -0
- package/src/components/PageHandler/LoadingComponent.tsx +9 -0
- package/src/components/PageHandler/index.tsx +14 -0
- package/src/components/PageHandler/modal.ts +6 -0
- package/src/components/RadioGroup/index.tsx +45 -0
- package/src/components/Select/components/AllSelect.tsx +54 -0
- package/src/components/Select/components/CheckBoxOption.tsx +14 -0
- package/src/components/Select/components/DropdownComponent.tsx +36 -0
- package/src/components/Select/components/NoFindItem.tsx +7 -0
- package/src/components/Select/components/NotFoundContent.tsx +25 -0
- package/src/components/Select/defaultConfig.tsx +23 -0
- package/src/components/Select/hooks/changeHooks.tsx +151 -0
- package/src/components/Select/hooks/norHooks.ts +63 -0
- package/src/components/Select/index.less +22 -0
- package/src/components/Select/index.tsx +120 -0
- package/src/components/Select/modal.ts +30 -0
- package/src/components/Select/utils.ts +18 -0
- package/src/components/Submit/index.tsx +28 -0
- package/src/components/Switch/index.tsx +52 -0
- package/src/components/TDPicker/RangePicker.tsx +103 -0
- package/src/components/TDPicker/TimePicker.tsx +15 -0
- package/src/components/TDPicker/hooks.ts +150 -0
- package/src/components/TDPicker/index.tsx +22 -0
- package/src/components/TDPicker/modal.ts +30 -0
- package/src/components/TextArea/index.tsx +8 -0
- package/src/components/Upload/Btn.tsx +24 -0
- package/src/components/Upload/MediaTypeEle/TypeEle.tsx +26 -0
- package/src/components/Upload/MediaTypeEle/index.tsx +34 -0
- package/src/components/Upload/Preview/index.tsx +14 -0
- package/src/components/Upload/UrlUpload/index.tsx +91 -0
- package/src/components/Upload/enums.ts +5 -0
- package/src/components/Upload/hooks/change.ts +79 -0
- package/src/components/Upload/hooks/customRequest.ts +44 -0
- package/src/components/Upload/hooks/propsMaker.ts +20 -0
- package/src/components/Upload/index.tsx +85 -0
- package/src/components/Upload/modal.ts +31 -0
- package/src/components/Upload/util.ts +27 -0
- package/src/components/config.ts +40 -0
- package/src/components/hooks/index.ts +53 -0
- package/src/components/index.tsx +21 -0
- package/src/components/modal.ts +15 -0
- package/src/components/styles/index.less +2 -0
- package/src/components/styles/local.less +1 -0
- package/src/components/typings.d.ts +11 -0
- package/src/index.less +20 -0
- package/src/index.tsx +12 -0
- package/src/pages/Checkbox/index.tsx +15 -0
- package/src/pages/DatePicker/index.tsx +33 -0
- package/src/pages/Form/index.tsx +146 -0
- package/src/pages/Input/index.tsx +22 -0
- package/src/pages/Radio/index.tsx +18 -0
- package/src/pages/Select/index.tsx +57 -0
- package/src/pages/Switch/index.tsx +18 -0
- package/src/pages/Upload/index.tsx +14 -0
- package/src/routes.tsx +68 -0
- package/tsconfig.json +29 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var React = require('react');
|
|
6
|
+
var antd = require('antd');
|
|
7
|
+
var NotFoundContent = require('./NotFoundContent.js');
|
|
8
|
+
|
|
9
|
+
var Text = antd.Typography.Text;
|
|
10
|
+
var Index = function Index(_ref) {
|
|
11
|
+
var loading = _ref.loading,
|
|
12
|
+
error = _ref.error,
|
|
13
|
+
_ref$options = _ref.options,
|
|
14
|
+
options = _ref$options === void 0 ? [] : _ref$options,
|
|
15
|
+
reload = _ref.reload,
|
|
16
|
+
children = _ref.children;
|
|
17
|
+
var len = options === null || options === void 0 ? void 0 : options.length;
|
|
18
|
+
if (loading && len === 0) {
|
|
19
|
+
return /*#__PURE__*/React.createElement(antd.Row, {
|
|
20
|
+
style: {
|
|
21
|
+
height: 125
|
|
22
|
+
},
|
|
23
|
+
justify: "center",
|
|
24
|
+
align: "middle"
|
|
25
|
+
}, /*#__PURE__*/React.createElement(antd.Space, {
|
|
26
|
+
direction: "vertical",
|
|
27
|
+
align: "center"
|
|
28
|
+
}, /*#__PURE__*/React.createElement(antd.Spin, null), /*#__PURE__*/React.createElement(Text, {
|
|
29
|
+
type: "secondary"
|
|
30
|
+
}, "\u62FC\u547D\u52A0\u8F7D\u4E2D...")));
|
|
31
|
+
}
|
|
32
|
+
if (error && len === 0) {
|
|
33
|
+
return /*#__PURE__*/React.createElement(NotFoundContent.default, {
|
|
34
|
+
error: error,
|
|
35
|
+
reload: reload
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, children);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
exports.default = Index;
|
|
42
|
+
// powered by h
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var React = require('react');
|
|
6
|
+
var antd = require('antd');
|
|
7
|
+
|
|
8
|
+
var NoFindItem = (function (_ref) {
|
|
9
|
+
var label = _ref.label;
|
|
10
|
+
return /*#__PURE__*/React.createElement(antd.Typography.Text, {
|
|
11
|
+
type: "danger"
|
|
12
|
+
}, label);
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
exports.default = NoFindItem;
|
|
16
|
+
// powered by h
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var React = require('react');
|
|
6
|
+
var antd = require('antd');
|
|
7
|
+
var icons = require('@ant-design/icons');
|
|
8
|
+
|
|
9
|
+
var Text = antd.Typography.Text;
|
|
10
|
+
var NotFoundContent = (function (_ref) {
|
|
11
|
+
var error = _ref.error,
|
|
12
|
+
reload = _ref.reload;
|
|
13
|
+
if (error) {
|
|
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")));
|
|
34
|
+
}
|
|
35
|
+
return /*#__PURE__*/React.createElement(antd.Empty, {
|
|
36
|
+
image: antd.Empty.PRESENTED_IMAGE_SIMPLE
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
exports.default = NotFoundContent;
|
|
41
|
+
// powered by h
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
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
|
+
|
|
9
|
+
var defaultModeConfig = {
|
|
10
|
+
multiple: {
|
|
11
|
+
icon: null,
|
|
12
|
+
render: function render(item, value) {
|
|
13
|
+
var checkVal = value === null || value === void 0 ? void 0 : _mapInstanceProperty(value).call(value, function (itemVal) {
|
|
14
|
+
return itemVal.value;
|
|
15
|
+
});
|
|
16
|
+
var newVal = checkVal || [];
|
|
17
|
+
var checked = _indexOfInstanceProperty(newVal).call(newVal, item.value) !== -1;
|
|
18
|
+
return /*#__PURE__*/React.createElement(CheckBoxOption.default, {
|
|
19
|
+
label: item.label,
|
|
20
|
+
checked: checked
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
var defaultSelectConfig = {
|
|
26
|
+
noMatchItemRender: function noMatchItemRender() {
|
|
27
|
+
return /*#__PURE__*/React.createElement(NoFindItem.default, {
|
|
28
|
+
label: "选项被删除,请重新选择"
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
exports.defaultModeConfig = defaultModeConfig;
|
|
34
|
+
exports.defaultSelectConfig = defaultSelectConfig;
|
|
35
|
+
// powered by h
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
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
|
+
|
|
20
|
+
var _excluded = ["index"],
|
|
21
|
+
_excluded2 = ["index"];
|
|
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; }
|
|
24
|
+
var single = function single(_ref) {
|
|
25
|
+
var options = _ref.options,
|
|
26
|
+
value = _ref.value,
|
|
27
|
+
noMatchItemRender = _ref.noMatchItemRender;
|
|
28
|
+
var newOptions = options || [];
|
|
29
|
+
var index = _findIndexInstanceProperty(newOptions).call(newOptions, function (item) {
|
|
30
|
+
return item.value === value;
|
|
31
|
+
});
|
|
32
|
+
if (index !== -1) {
|
|
33
|
+
var label = newOptions[index].label;
|
|
34
|
+
return {
|
|
35
|
+
value: value,
|
|
36
|
+
label: label
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
return {
|
|
40
|
+
value: value,
|
|
41
|
+
label: (noMatchItemRender === null || noMatchItemRender === void 0 ? void 0 : noMatchItemRender({
|
|
42
|
+
value: value
|
|
43
|
+
})) || value
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
var findNewValInOldVal = function findNewValInOldVal(val, oldVal) {
|
|
47
|
+
if (!oldVal) {
|
|
48
|
+
return -1;
|
|
49
|
+
}
|
|
50
|
+
return _findIndexInstanceProperty(oldVal).call(oldVal, function (item) {
|
|
51
|
+
return item.value === val;
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
var sourceDataProvider = function sourceDataProvider(_ref2, oldVal) {
|
|
55
|
+
_ref2.options;
|
|
56
|
+
var value = _ref2.value;
|
|
57
|
+
var oldData = [];
|
|
58
|
+
var newData = [];
|
|
59
|
+
_forEachInstanceProperty(value).call(value, function (item, i) {
|
|
60
|
+
var index = findNewValInOldVal(item, oldVal);
|
|
61
|
+
if (index === -1) {
|
|
62
|
+
newData.push({
|
|
63
|
+
value: item,
|
|
64
|
+
index: i
|
|
65
|
+
});
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
var newVal = oldVal === null || oldVal === void 0 ? void 0 : oldVal[index];
|
|
69
|
+
oldData.push(_objectSpread(_objectSpread({}, newVal), {}, {
|
|
70
|
+
index: i
|
|
71
|
+
}));
|
|
72
|
+
});
|
|
73
|
+
return {
|
|
74
|
+
oldData: oldData,
|
|
75
|
+
newData: newData
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
var resultProvider = function resultProvider(newData, oldData, value) {
|
|
79
|
+
var newResult = new Array(value.length);
|
|
80
|
+
_forEachInstanceProperty(oldData).call(oldData, function (item) {
|
|
81
|
+
var index = item.index,
|
|
82
|
+
val = _objectWithoutProperties(item, _excluded);
|
|
83
|
+
newResult[index] = _objectSpread({}, val);
|
|
84
|
+
});
|
|
85
|
+
_forEachInstanceProperty(newData).call(newData, function (item) {
|
|
86
|
+
var index = item.index,
|
|
87
|
+
val = _objectWithoutProperties(item, _excluded2);
|
|
88
|
+
newResult[index] = _objectSpread({}, val);
|
|
89
|
+
});
|
|
90
|
+
return newResult;
|
|
91
|
+
};
|
|
92
|
+
var multiple = function multiple(_ref3, oldVal) {
|
|
93
|
+
var options = _ref3.options,
|
|
94
|
+
value = _ref3.value,
|
|
95
|
+
noMatchItemRender = _ref3.noMatchItemRender;
|
|
96
|
+
var _sourceDataProvider = sourceDataProvider({
|
|
97
|
+
options: options,
|
|
98
|
+
value: value
|
|
99
|
+
}, oldVal),
|
|
100
|
+
newData = _sourceDataProvider.newData,
|
|
101
|
+
oldData = _sourceDataProvider.oldData;
|
|
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
|
+
});
|
|
114
|
+
return resultProvider(newMatchVal, oldData, value);
|
|
115
|
+
};
|
|
116
|
+
var tag = function tag(_ref4, oldVal) {
|
|
117
|
+
var options = _ref4.options,
|
|
118
|
+
value = _ref4.value;
|
|
119
|
+
var _sourceDataProvider2 = sourceDataProvider({
|
|
120
|
+
options: options,
|
|
121
|
+
value: value
|
|
122
|
+
}, oldVal),
|
|
123
|
+
newData = _sourceDataProvider2.newData,
|
|
124
|
+
oldData = _sourceDataProvider2.oldData;
|
|
125
|
+
return resultProvider(newData, oldData, value);
|
|
126
|
+
};
|
|
127
|
+
var matchNotFind = function matchNotFind(_ref5, oldVale) {
|
|
128
|
+
var options = _ref5.options,
|
|
129
|
+
value = _ref5.value,
|
|
130
|
+
mode = _ref5.mode,
|
|
131
|
+
noMatchItemRender = _ref5.noMatchItemRender;
|
|
132
|
+
if (!mode) {
|
|
133
|
+
return single({
|
|
134
|
+
options: options,
|
|
135
|
+
value: value,
|
|
136
|
+
noMatchItemRender: noMatchItemRender
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
if (mode === "multiple") {
|
|
140
|
+
return multiple({
|
|
141
|
+
options: options,
|
|
142
|
+
value: value,
|
|
143
|
+
noMatchItemRender: noMatchItemRender
|
|
144
|
+
}, oldVale);
|
|
145
|
+
}
|
|
146
|
+
return tag({
|
|
147
|
+
options: options,
|
|
148
|
+
value: value
|
|
149
|
+
}, oldVale);
|
|
150
|
+
};
|
|
151
|
+
var useValueChange = function useValueChange(params) {
|
|
152
|
+
var labelInValue = params.labelInValue,
|
|
153
|
+
onChange = params.onChange,
|
|
154
|
+
value = params.value,
|
|
155
|
+
options = params.options,
|
|
156
|
+
mode = params.mode,
|
|
157
|
+
noMatchItemRender = params.noMatchItemRender,
|
|
158
|
+
_params$fieldNames = params.fieldNames,
|
|
159
|
+
fieldNames = _params$fieldNames === void 0 ? {} : _params$fieldNames;
|
|
160
|
+
var _useState = React.useState(),
|
|
161
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
162
|
+
val = _useState2[0],
|
|
163
|
+
setVal = _useState2[1];
|
|
164
|
+
var change = function change(changeVal, itemOps) {
|
|
165
|
+
if (!onChange) {
|
|
166
|
+
setVal(changeVal);
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
var newChangeVal = changeVal.value;
|
|
170
|
+
if (labelInValue) {
|
|
171
|
+
newChangeVal = changeVal;
|
|
172
|
+
}
|
|
173
|
+
if (_Array$isArray(changeVal)) {
|
|
174
|
+
newChangeVal = _mapInstanceProperty(changeVal).call(changeVal, function (item) {
|
|
175
|
+
return item.value;
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
var subItemOps = utils.itemOpProvider(itemOps, fieldNames);
|
|
179
|
+
onChange(newChangeVal, subItemOps);
|
|
180
|
+
};
|
|
181
|
+
React.useEffect(function () {
|
|
182
|
+
if (options && value) {
|
|
183
|
+
setVal(function (oldVale) {
|
|
184
|
+
return matchNotFind(params, oldVale);
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
}, [value, options, mode, noMatchItemRender]);
|
|
188
|
+
return {
|
|
189
|
+
val: val,
|
|
190
|
+
change: change
|
|
191
|
+
};
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
exports.useValueChange = useValueChange;
|
|
195
|
+
// powered by h
|
|
@@ -0,0 +1,10 @@
|
|
|
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<any>;
|
|
4
|
+
loading: boolean;
|
|
5
|
+
error: Error | undefined;
|
|
6
|
+
data: OptionType[] | undefined;
|
|
7
|
+
onSearch: ((value: string) => void) | undefined;
|
|
8
|
+
mathShowSearch: boolean | undefined;
|
|
9
|
+
};
|
|
10
|
+
export declare const useFilterOption: ({ filterOption, serviceSearch, }: PartialHSelectProps) => boolean | import("rc-select/lib/Select").FilterFunc<import("rc-select/lib/Select").DefaultOptionType> | undefined;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
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
|
+
|
|
10
|
+
var useOptionReq = function useOptionReq(_ref) {
|
|
11
|
+
var manual = _ref.manual,
|
|
12
|
+
request = _ref.request,
|
|
13
|
+
options = _ref.options,
|
|
14
|
+
serviceSearch = _ref.serviceSearch,
|
|
15
|
+
showSearch = _ref.showSearch,
|
|
16
|
+
propsOnSearch = _ref.onSearch;
|
|
17
|
+
var _useState = React.useState(),
|
|
18
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
19
|
+
data = _useState2[0],
|
|
20
|
+
setData = _useState2[1];
|
|
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);
|
|
50
|
+
}
|
|
51
|
+
}),
|
|
52
|
+
run = _useRequest.run,
|
|
53
|
+
loading = _useRequest.loading,
|
|
54
|
+
error = _useRequest.error;
|
|
55
|
+
var onSearch = function onSearch(inputValue) {
|
|
56
|
+
if (!serviceSearch) {
|
|
57
|
+
propsOnSearch === null || propsOnSearch === void 0 ? void 0 : propsOnSearch(inputValue);
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
run({
|
|
61
|
+
inputValue: inputValue
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
var mathShowSearch = showSearch || serviceSearch;
|
|
65
|
+
return {
|
|
66
|
+
run: run,
|
|
67
|
+
loading: loading,
|
|
68
|
+
error: error,
|
|
69
|
+
data: data,
|
|
70
|
+
onSearch: mathShowSearch ? onSearch : propsOnSearch,
|
|
71
|
+
mathShowSearch: showSearch || serviceSearch
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
var useFilterOption = function useFilterOption(_ref3) {
|
|
75
|
+
var filterOption = _ref3.filterOption,
|
|
76
|
+
serviceSearch = _ref3.serviceSearch;
|
|
77
|
+
if (serviceSearch) {
|
|
78
|
+
return function () {
|
|
79
|
+
return true;
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
return filterOption;
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
exports.useFilterOption = useFilterOption;
|
|
86
|
+
exports.useOptionReq = useOptionReq;
|
|
87
|
+
// powered by h
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { HSelectProps } from "./modal";
|
|
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;
|
|
4
|
+
export default _default;
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var _extends = require('@babel/runtime-corejs3/helpers/extends');
|
|
6
|
+
var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
7
|
+
var _objectWithoutProperties = require('@babel/runtime-corejs3/helpers/objectWithoutProperties');
|
|
8
|
+
var _mapInstanceProperty = require('@babel/runtime-corejs3/core-js/instance/map');
|
|
9
|
+
var antd = require('antd');
|
|
10
|
+
var React = require('react');
|
|
11
|
+
var norHooks = require('./hooks/norHooks.js');
|
|
12
|
+
var changeHooks = require('./hooks/changeHooks.js');
|
|
13
|
+
var defaultConfig = require('./defaultConfig.js');
|
|
14
|
+
var DropdownComponent = require('./components/DropdownComponent.js');
|
|
15
|
+
var AllSelect = require('./components/AllSelect.js');
|
|
16
|
+
var index = require('../hooks/index.js');
|
|
17
|
+
|
|
18
|
+
var _excluded = ["style", "mode", "options", "modeConfig", "value", "onChange", "fieldNames", "request", "manual", "optionLabelProp", "filterProvider", "optionFilterProp", "serviceSearch", "onSearch", "filterOption", "showSearch", "labelInValue", "noMatchItemRender", "allSelect"];
|
|
19
|
+
var Option = antd.Select.Option;
|
|
20
|
+
var HSelect = (function (_ref) {
|
|
21
|
+
var _ref$style = _ref.style,
|
|
22
|
+
style = _ref$style === void 0 ? {
|
|
23
|
+
width: "100%"
|
|
24
|
+
} : _ref$style,
|
|
25
|
+
mode = _ref.mode,
|
|
26
|
+
options = _ref.options,
|
|
27
|
+
_ref$modeConfig = _ref.modeConfig,
|
|
28
|
+
modeConfig = _ref$modeConfig === void 0 ? defaultConfig.defaultModeConfig : _ref$modeConfig,
|
|
29
|
+
value = _ref.value,
|
|
30
|
+
onChange = _ref.onChange,
|
|
31
|
+
propsFieldNames = _ref.fieldNames,
|
|
32
|
+
request = _ref.request,
|
|
33
|
+
manual = _ref.manual,
|
|
34
|
+
_ref$optionLabelProp = _ref.optionLabelProp,
|
|
35
|
+
optionLabelProp = _ref$optionLabelProp === void 0 ? "label" : _ref$optionLabelProp,
|
|
36
|
+
filterProvider = _ref.filterProvider,
|
|
37
|
+
_ref$optionFilterProp = _ref.optionFilterProp,
|
|
38
|
+
optionFilterProp = _ref$optionFilterProp === void 0 ? "filterLabel" : _ref$optionFilterProp,
|
|
39
|
+
serviceSearch = _ref.serviceSearch,
|
|
40
|
+
propsOnSearch = _ref.onSearch,
|
|
41
|
+
filterOption = _ref.filterOption,
|
|
42
|
+
showSearch = _ref.showSearch,
|
|
43
|
+
labelInValue = _ref.labelInValue,
|
|
44
|
+
_ref$noMatchItemRende = _ref.noMatchItemRender,
|
|
45
|
+
noMatchItemRender = _ref$noMatchItemRende === void 0 ? defaultConfig.defaultSelectConfig.noMatchItemRender : _ref$noMatchItemRende,
|
|
46
|
+
allSelect = _ref.allSelect,
|
|
47
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
48
|
+
var _ref2 = (modeConfig === null || modeConfig === void 0 ? void 0 : modeConfig[mode || ""]) || {},
|
|
49
|
+
icon = _ref2.icon,
|
|
50
|
+
render = _ref2.render;
|
|
51
|
+
var _useMatchConfigProps = index.useMatchConfigProps({
|
|
52
|
+
fieldNames: propsFieldNames
|
|
53
|
+
}),
|
|
54
|
+
fieldNames = _useMatchConfigProps.fieldNames;
|
|
55
|
+
var selfFilterOption = norHooks.useFilterOption({
|
|
56
|
+
filterOption: filterOption,
|
|
57
|
+
serviceSearch: serviceSearch
|
|
58
|
+
});
|
|
59
|
+
var _useOptionReq = norHooks.useOptionReq({
|
|
60
|
+
options: options,
|
|
61
|
+
manual: manual,
|
|
62
|
+
fieldNames: fieldNames,
|
|
63
|
+
request: request,
|
|
64
|
+
serviceSearch: serviceSearch,
|
|
65
|
+
showSearch: showSearch,
|
|
66
|
+
onSearch: propsOnSearch
|
|
67
|
+
}),
|
|
68
|
+
run = _useOptionReq.run,
|
|
69
|
+
loading = _useOptionReq.loading,
|
|
70
|
+
resultData = _useOptionReq.data,
|
|
71
|
+
error = _useOptionReq.error,
|
|
72
|
+
onSearch = _useOptionReq.onSearch,
|
|
73
|
+
mathShowSearch = _useOptionReq.mathShowSearch;
|
|
74
|
+
var data = index.useChangeOptions({
|
|
75
|
+
options: resultData,
|
|
76
|
+
fieldNames: fieldNames
|
|
77
|
+
});
|
|
78
|
+
var _useValueChange = changeHooks.useValueChange({
|
|
79
|
+
labelInValue: labelInValue,
|
|
80
|
+
onChange: onChange,
|
|
81
|
+
value: value,
|
|
82
|
+
options: data,
|
|
83
|
+
mode: mode,
|
|
84
|
+
noMatchItemRender: noMatchItemRender,
|
|
85
|
+
fieldNames: fieldNames
|
|
86
|
+
}),
|
|
87
|
+
val = _useValueChange.val,
|
|
88
|
+
change = _useValueChange.change;
|
|
89
|
+
return /*#__PURE__*/React.createElement(antd.Select, _extends({
|
|
90
|
+
style: style,
|
|
91
|
+
mode: mode,
|
|
92
|
+
loading: loading,
|
|
93
|
+
value: val,
|
|
94
|
+
onSearch: onSearch,
|
|
95
|
+
onChange: change,
|
|
96
|
+
dropdownRender: function dropdownRender(node) {
|
|
97
|
+
return /*#__PURE__*/React.createElement(DropdownComponent.default, {
|
|
98
|
+
loading: loading,
|
|
99
|
+
reload: run,
|
|
100
|
+
error: error,
|
|
101
|
+
options: data
|
|
102
|
+
}, /*#__PURE__*/React.createElement(AllSelect.default, {
|
|
103
|
+
allSelect: allSelect,
|
|
104
|
+
options: data,
|
|
105
|
+
mode: mode,
|
|
106
|
+
value: val,
|
|
107
|
+
onChange: change
|
|
108
|
+
}, node));
|
|
109
|
+
},
|
|
110
|
+
optionLabelProp: optionLabelProp,
|
|
111
|
+
menuItemSelectedIcon: icon,
|
|
112
|
+
optionFilterProp: optionFilterProp,
|
|
113
|
+
filterOption: selfFilterOption,
|
|
114
|
+
showSearch: mathShowSearch,
|
|
115
|
+
labelInValue: true
|
|
116
|
+
}, props), data === null || data === void 0 ? void 0 : _mapInstanceProperty(data).call(data, function (item) {
|
|
117
|
+
var optionValue = item.value,
|
|
118
|
+
label = item.label;
|
|
119
|
+
var result = (filterProvider === null || filterProvider === void 0 ? void 0 : filterProvider(item)) || label;
|
|
120
|
+
var filter = _defineProperty({}, optionFilterProp, result);
|
|
121
|
+
return /*#__PURE__*/React.createElement(Option, _extends({
|
|
122
|
+
value: optionValue,
|
|
123
|
+
key: optionValue,
|
|
124
|
+
label: label,
|
|
125
|
+
mode: mode
|
|
126
|
+
}, filter), render ? render(item, val) : label);
|
|
127
|
+
}));
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
exports.default = HSelect;
|
|
131
|
+
// powered by h
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { SelectProps } from "antd";
|
|
2
|
+
import type React from "react";
|
|
3
|
+
import type { PromiseFnResult } from "../modal";
|
|
4
|
+
export type OptionType = Record<string, any>;
|
|
5
|
+
export type PartialHSelectProps = Partial<HSelectProps>;
|
|
6
|
+
export type RenderFn = (data: OptionType) => React.ReactNode;
|
|
7
|
+
interface ModeConfigItem {
|
|
8
|
+
icon?: React.ReactNode | null;
|
|
9
|
+
render?: (item: OptionType, value: any[]) => React.ReactNode;
|
|
10
|
+
}
|
|
11
|
+
export interface ModeConfig {
|
|
12
|
+
multiple?: ModeConfigItem;
|
|
13
|
+
tags?: ModeConfigItem;
|
|
14
|
+
}
|
|
15
|
+
export interface HSelectProps extends Omit<SelectProps, "options"> {
|
|
16
|
+
style?: React.CSSProperties;
|
|
17
|
+
request?: PromiseFnResult<any, OptionType[]>;
|
|
18
|
+
manual?: boolean;
|
|
19
|
+
modeConfig?: ModeConfig;
|
|
20
|
+
filterProvider?: (item: any) => string;
|
|
21
|
+
serviceSearch?: boolean;
|
|
22
|
+
options?: OptionType[];
|
|
23
|
+
noMatchItemRender?: RenderFn;
|
|
24
|
+
allSelect?: boolean;
|
|
25
|
+
}
|
|
26
|
+
export interface FilterDataModal {
|
|
27
|
+
value: any;
|
|
28
|
+
index: number;
|
|
29
|
+
}
|
|
30
|
+
export {};
|