@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
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var React = require('react');
|
|
6
|
+
var _extends = require('@babel/runtime-corejs3/helpers/extends');
|
|
7
|
+
var _objectWithoutProperties = require('@babel/runtime-corejs3/helpers/objectWithoutProperties');
|
|
8
|
+
var antd = require('antd');
|
|
9
|
+
var index = require('../Form/index.js');
|
|
10
|
+
var hooks = require('./hooks.js');
|
|
11
|
+
|
|
12
|
+
var _excluded = ["visible", "title", "onCancel", "configData", "infoRequest", "request", "afterClose", "modalForm", "initialValues"];
|
|
13
|
+
var ModalForm = (function (_ref) {
|
|
14
|
+
var visible = _ref.visible,
|
|
15
|
+
title = _ref.title,
|
|
16
|
+
onCancel = _ref.onCancel,
|
|
17
|
+
configData = _ref.configData,
|
|
18
|
+
infoRequest = _ref.infoRequest;
|
|
19
|
+
_ref.request;
|
|
20
|
+
var _afterClose = _ref.afterClose,
|
|
21
|
+
modalForm = _ref.modalForm,
|
|
22
|
+
_ref$initialValues = _ref.initialValues,
|
|
23
|
+
initialValues = _ref$initialValues === void 0 ? {} : _ref$initialValues,
|
|
24
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
25
|
+
var _useModifyProps = hooks.useModifyProps({
|
|
26
|
+
configData: configData,
|
|
27
|
+
visible: visible,
|
|
28
|
+
initialValues: initialValues
|
|
29
|
+
}),
|
|
30
|
+
modalVisible = _useModifyProps.modalVisible,
|
|
31
|
+
modalFormData = _useModifyProps.modalFormData,
|
|
32
|
+
setModalVisible = _useModifyProps.setModalVisible,
|
|
33
|
+
setModalFormData = _useModifyProps.setModalFormData,
|
|
34
|
+
initValue = _useModifyProps.initValue,
|
|
35
|
+
setInitValue = _useModifyProps.setInitValue;
|
|
36
|
+
var currentForm = hooks.useCurrentForm(modalForm);
|
|
37
|
+
React.useEffect(function () {
|
|
38
|
+
currentForm.show = function (_ref2) {
|
|
39
|
+
var changeConfigData = _ref2.configData,
|
|
40
|
+
changeInitialValues = _ref2.initialValues;
|
|
41
|
+
if (!!changeConfigData) {
|
|
42
|
+
setModalFormData(changeConfigData);
|
|
43
|
+
}
|
|
44
|
+
setInitValue(changeInitialValues);
|
|
45
|
+
setModalVisible(true);
|
|
46
|
+
};
|
|
47
|
+
currentForm.hide = function () {
|
|
48
|
+
setModalVisible(false);
|
|
49
|
+
};
|
|
50
|
+
}, []);
|
|
51
|
+
var cancel = function cancel(e) {
|
|
52
|
+
if (onCancel) {
|
|
53
|
+
return onCancel === null || onCancel === void 0 ? void 0 : onCancel(e);
|
|
54
|
+
}
|
|
55
|
+
setModalVisible(false);
|
|
56
|
+
};
|
|
57
|
+
return /*#__PURE__*/React.createElement(antd.Modal, _extends({
|
|
58
|
+
title: title,
|
|
59
|
+
visible: modalVisible,
|
|
60
|
+
onCancel: cancel,
|
|
61
|
+
afterClose: function afterClose() {
|
|
62
|
+
currentForm.resetFields();
|
|
63
|
+
_afterClose === null || _afterClose === void 0 ? void 0 : _afterClose();
|
|
64
|
+
}
|
|
65
|
+
}, props), /*#__PURE__*/React.createElement(index.default, _extends({
|
|
66
|
+
configData: modalFormData,
|
|
67
|
+
initialValues: initValue
|
|
68
|
+
}, props, {
|
|
69
|
+
form: currentForm,
|
|
70
|
+
infoRequest: infoRequest
|
|
71
|
+
})));
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
exports.default = ModalForm;
|
|
75
|
+
// powered by h
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { HFormProps } from "@/components/Form/modal";
|
|
2
|
+
import type { ModalProps } from "antd";
|
|
3
|
+
import type { HFormInstance, HItemProps } from "@/components/Form/modal";
|
|
4
|
+
type RootProps = HFormProps & ModalProps;
|
|
5
|
+
export interface ModifyPropsModal {
|
|
6
|
+
configData: HItemProps[];
|
|
7
|
+
visible?: boolean;
|
|
8
|
+
initialValues?: Record<string, any>;
|
|
9
|
+
}
|
|
10
|
+
export interface ShowParamsModal extends Partial<ModifyPropsModal> {
|
|
11
|
+
initialValues?: Record<string, any>;
|
|
12
|
+
}
|
|
13
|
+
export interface HModalFormInstance extends HFormInstance {
|
|
14
|
+
show: (data: ShowParamsModal) => void;
|
|
15
|
+
hide: VoidFunction;
|
|
16
|
+
}
|
|
17
|
+
export interface ModalFormProps extends RootProps {
|
|
18
|
+
modalForm?: HModalFormInstance;
|
|
19
|
+
}
|
|
20
|
+
export {};
|
|
@@ -1,58 +1,36 @@
|
|
|
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 ErrorComponent = function (_ref) {
|
|
10
|
+
var ErrorComponent = (function (_ref) {
|
|
11
11
|
var error = _ref.error,
|
|
12
12
|
reload = _ref.reload;
|
|
13
|
-
return /*#__PURE__*/
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
size: 24,
|
|
35
|
-
})
|
|
36
|
-
),
|
|
37
|
-
/*#__PURE__*/ React.createElement(
|
|
38
|
-
Text,
|
|
39
|
-
{
|
|
40
|
-
type: "danger",
|
|
41
|
-
},
|
|
42
|
-
error === null || error === void 0 ? void 0 : error.message
|
|
43
|
-
),
|
|
44
|
-
/*#__PURE__*/ React.createElement(
|
|
45
|
-
antd.Button,
|
|
46
|
-
{
|
|
47
|
-
type: "primary",
|
|
48
|
-
size: "small",
|
|
49
|
-
onClick: reload,
|
|
50
|
-
},
|
|
51
|
-
"\u91CD\u65B0\u52A0\u8F7D"
|
|
52
|
-
)
|
|
53
|
-
)
|
|
54
|
-
);
|
|
55
|
-
};
|
|
13
|
+
return /*#__PURE__*/React.createElement(antd.Row, {
|
|
14
|
+
justify: "center",
|
|
15
|
+
align: "middle",
|
|
16
|
+
style: {
|
|
17
|
+
height: 125
|
|
18
|
+
}
|
|
19
|
+
}, /*#__PURE__*/React.createElement(antd.Space, {
|
|
20
|
+
align: "center",
|
|
21
|
+
direction: "vertical"
|
|
22
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
23
|
+
type: "danger"
|
|
24
|
+
}, /*#__PURE__*/React.createElement(icons.ExclamationCircleOutlined, {
|
|
25
|
+
size: 24
|
|
26
|
+
})), /*#__PURE__*/React.createElement(Text, {
|
|
27
|
+
type: "danger"
|
|
28
|
+
}, error === null || error === void 0 ? void 0 : error.message), /*#__PURE__*/React.createElement(antd.Button, {
|
|
29
|
+
type: "primary",
|
|
30
|
+
size: "small",
|
|
31
|
+
onClick: reload
|
|
32
|
+
}, "\u91CD\u65B0\u52A0\u8F7D")));
|
|
33
|
+
});
|
|
56
34
|
|
|
57
35
|
exports.default = ErrorComponent;
|
|
58
36
|
// powered by h
|
|
@@ -1,25 +1,21 @@
|
|
|
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(
|
|
5
|
+
var React = require('react');
|
|
6
|
+
var antd = require('antd');
|
|
7
7
|
|
|
8
|
-
var Loading = function () {
|
|
9
|
-
return /*#__PURE__*/
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
size: "large",
|
|
20
|
-
})
|
|
21
|
-
);
|
|
22
|
-
};
|
|
8
|
+
var Loading = (function () {
|
|
9
|
+
return /*#__PURE__*/React.createElement(antd.Row, {
|
|
10
|
+
justify: "center",
|
|
11
|
+
align: "middle",
|
|
12
|
+
style: {
|
|
13
|
+
height: 125
|
|
14
|
+
}
|
|
15
|
+
}, /*#__PURE__*/React.createElement(antd.Spin, {
|
|
16
|
+
size: "large"
|
|
17
|
+
}));
|
|
18
|
+
});
|
|
23
19
|
|
|
24
20
|
exports.default = Loading;
|
|
25
21
|
// powered by h
|
package/lib/PageHandler/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
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 LoadingComponent = require(
|
|
7
|
-
var ErrorComponent = require(
|
|
5
|
+
var React = require('react');
|
|
6
|
+
var LoadingComponent = require('./LoadingComponent.js');
|
|
7
|
+
var ErrorComponent = require('./ErrorComponent.js');
|
|
8
8
|
|
|
9
9
|
var Index = function Index(_ref) {
|
|
10
10
|
var error = _ref.error,
|
|
@@ -12,15 +12,15 @@ var Index = function Index(_ref) {
|
|
|
12
12
|
reload = _ref.reload,
|
|
13
13
|
children = _ref.children;
|
|
14
14
|
if (error) {
|
|
15
|
-
return /*#__PURE__*/
|
|
15
|
+
return /*#__PURE__*/React.createElement(ErrorComponent.default, {
|
|
16
16
|
error: error,
|
|
17
|
-
reload: reload
|
|
17
|
+
reload: reload
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
20
|
if (data) {
|
|
21
|
-
return /*#__PURE__*/
|
|
21
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, children);
|
|
22
22
|
}
|
|
23
|
-
return /*#__PURE__*/
|
|
23
|
+
return /*#__PURE__*/React.createElement(LoadingComponent.default, null);
|
|
24
24
|
};
|
|
25
25
|
|
|
26
26
|
exports.default = Index;
|
|
@@ -1,16 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { SelectProps, RadioGroupProps } from "antd/es";
|
|
3
|
-
export interface HRadioGroupProps
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
options?: (Record<string, any> | string | number)[];
|
|
3
|
+
export interface HRadioGroupProps extends Omit<RadioGroupProps, "onChange" | "options"> {
|
|
4
|
+
onChange?: (value: any) => void;
|
|
5
|
+
fieldNames?: SelectProps["fieldNames"];
|
|
6
|
+
options?: (Record<string, any> | string | number)[];
|
|
8
7
|
}
|
|
9
|
-
declare const _default: ({
|
|
10
|
-
value,
|
|
11
|
-
options,
|
|
12
|
-
onChange,
|
|
13
|
-
fieldNames: propsFieldNames,
|
|
14
|
-
...props
|
|
15
|
-
}: HRadioGroupProps) => JSX.Element;
|
|
8
|
+
declare const _default: ({ value, options, onChange, fieldNames: propsFieldNames, ...props }: HRadioGroupProps) => JSX.Element;
|
|
16
9
|
export default _default;
|
package/lib/RadioGroup/index.js
CHANGED
|
@@ -1,64 +1,51 @@
|
|
|
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 _extends = require(
|
|
7
|
-
var _typeof = require(
|
|
8
|
-
var _objectWithoutProperties = require(
|
|
9
|
-
var _mapInstanceProperty = require(
|
|
10
|
-
var antd = require(
|
|
11
|
-
var index = require(
|
|
5
|
+
var React = require('react');
|
|
6
|
+
var _extends = require('@babel/runtime-corejs3/helpers/extends');
|
|
7
|
+
var _typeof = require('@babel/runtime-corejs3/helpers/typeof');
|
|
8
|
+
var _objectWithoutProperties = require('@babel/runtime-corejs3/helpers/objectWithoutProperties');
|
|
9
|
+
var _mapInstanceProperty = require('@babel/runtime-corejs3/core-js/instance/map');
|
|
10
|
+
var antd = require('antd');
|
|
11
|
+
var index = require('../hooks/index.js');
|
|
12
12
|
|
|
13
13
|
var _excluded = ["value", "options", "onChange", "fieldNames"];
|
|
14
|
-
var HRadioGroup = function (_ref) {
|
|
14
|
+
var HRadioGroup = (function (_ref) {
|
|
15
15
|
var value = _ref.value,
|
|
16
16
|
options = _ref.options,
|
|
17
17
|
_onChange = _ref.onChange,
|
|
18
18
|
propsFieldNames = _ref.fieldNames,
|
|
19
19
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
20
20
|
var _useMatchConfigProps = index.useMatchConfigProps({
|
|
21
|
-
fieldNames: propsFieldNames
|
|
21
|
+
fieldNames: propsFieldNames
|
|
22
22
|
}),
|
|
23
23
|
_useMatchConfigProps$ = _useMatchConfigProps.fieldNames,
|
|
24
24
|
fieldNames = _useMatchConfigProps$ === void 0 ? {} : _useMatchConfigProps$;
|
|
25
|
-
var relOptions = React.useMemo(
|
|
26
|
-
function () {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
{
|
|
50
|
-
options: relOptions,
|
|
51
|
-
value: value,
|
|
52
|
-
onChange: function onChange(e) {
|
|
53
|
-
_onChange === null || _onChange === void 0
|
|
54
|
-
? void 0
|
|
55
|
-
: _onChange(e.target.value);
|
|
56
|
-
},
|
|
57
|
-
},
|
|
58
|
-
props
|
|
59
|
-
)
|
|
60
|
-
);
|
|
61
|
-
};
|
|
25
|
+
var relOptions = React.useMemo(function () {
|
|
26
|
+
return options === null || options === void 0 ? void 0 : _mapInstanceProperty(options).call(options, function (item) {
|
|
27
|
+
var type = _typeof(item);
|
|
28
|
+
if (type === "string" || type === "number") {
|
|
29
|
+
return item;
|
|
30
|
+
}
|
|
31
|
+
var _fieldNames$label = fieldNames.label,
|
|
32
|
+
labelKey = _fieldNames$label === void 0 ? "" : _fieldNames$label,
|
|
33
|
+
_fieldNames$value = fieldNames.value,
|
|
34
|
+
valueKey = _fieldNames$value === void 0 ? "" : _fieldNames$value;
|
|
35
|
+
return {
|
|
36
|
+
label: item[labelKey],
|
|
37
|
+
value: item[valueKey]
|
|
38
|
+
};
|
|
39
|
+
});
|
|
40
|
+
}, [options, fieldNames]);
|
|
41
|
+
return /*#__PURE__*/React.createElement(antd.Radio.Group, _extends({
|
|
42
|
+
options: relOptions,
|
|
43
|
+
value: value,
|
|
44
|
+
onChange: function onChange(e) {
|
|
45
|
+
_onChange === null || _onChange === void 0 ? void 0 : _onChange(e.target.value);
|
|
46
|
+
}
|
|
47
|
+
}, props));
|
|
48
|
+
});
|
|
62
49
|
|
|
63
50
|
exports.default = HRadioGroup;
|
|
64
51
|
// powered by h
|
|
@@ -1,21 +1,17 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports,
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var _concatInstanceProperty = require(
|
|
6
|
-
var antd = require(
|
|
7
|
-
var utils = require(
|
|
8
|
-
var index = require(
|
|
9
|
-
var React = require(
|
|
5
|
+
var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js/instance/concat');
|
|
6
|
+
var antd = require('antd');
|
|
7
|
+
var utils = require('../utils.js');
|
|
8
|
+
var index = require('../../hooks/index.js');
|
|
9
|
+
var React = require('react');
|
|
10
10
|
|
|
11
11
|
var useRootClassName = function useRootClassName(checked) {
|
|
12
12
|
var _context;
|
|
13
13
|
var norClassNames = ["select-item", "select-item-option"];
|
|
14
|
-
return checked
|
|
15
|
-
? _concatInstanceProperty((_context = [])).call(_context, norClassNames, [
|
|
16
|
-
"select-item-option-selected",
|
|
17
|
-
])
|
|
18
|
-
: norClassNames;
|
|
14
|
+
return checked ? _concatInstanceProperty(_context = []).call(_context, norClassNames, ["select-item-option-selected"]) : norClassNames;
|
|
19
15
|
};
|
|
20
16
|
var Index = function Index(_ref) {
|
|
21
17
|
var allSelect = _ref.allSelect,
|
|
@@ -27,48 +23,30 @@ var Index = function Index(_ref) {
|
|
|
27
23
|
_ref$fieldNames = _ref.fieldNames,
|
|
28
24
|
fieldNames = _ref$fieldNames === void 0 ? {} : _ref$fieldNames,
|
|
29
25
|
children = _ref.children;
|
|
30
|
-
var opLen =
|
|
31
|
-
|
|
32
|
-
var checked =
|
|
33
|
-
(value === null || value === void 0 ? void 0 : value.length) >= opLen;
|
|
26
|
+
var opLen = (options === null || options === void 0 ? void 0 : options.length) || 0;
|
|
27
|
+
var checked = (value === null || value === void 0 ? void 0 : value.length) >= opLen;
|
|
34
28
|
var classNames = useRootClassName(checked);
|
|
35
29
|
var optionsClassName = index.useClassName(classNames);
|
|
36
30
|
var allCheckBox = index.useClassName("hw-all-check-box");
|
|
37
31
|
var change = function change() {
|
|
38
32
|
if (!checked) {
|
|
39
33
|
var subItemOps = utils.itemOpProvider(options, fieldNames);
|
|
40
|
-
onChange === null || onChange === void 0
|
|
41
|
-
? void 0
|
|
42
|
-
: onChange(options, subItemOps);
|
|
34
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(options, subItemOps);
|
|
43
35
|
return;
|
|
44
36
|
}
|
|
45
37
|
onChange === null || onChange === void 0 ? void 0 : onChange([], []);
|
|
46
38
|
};
|
|
47
39
|
if (!allSelect || mode !== "multiple" || serviceSearch) {
|
|
48
|
-
return /*#__PURE__*/
|
|
40
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, children);
|
|
49
41
|
}
|
|
50
|
-
return /*#__PURE__*/
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
className: optionsClassName,
|
|
59
|
-
onClick: change,
|
|
60
|
-
},
|
|
61
|
-
/*#__PURE__*/ React.createElement(
|
|
62
|
-
antd.Space,
|
|
63
|
-
null,
|
|
64
|
-
/*#__PURE__*/ React.createElement(antd.Checkbox, {
|
|
65
|
-
checked: checked,
|
|
66
|
-
}),
|
|
67
|
-
"\u5168\u90E8"
|
|
68
|
-
)
|
|
69
|
-
),
|
|
70
|
-
children
|
|
71
|
-
);
|
|
42
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
43
|
+
className: allCheckBox
|
|
44
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
45
|
+
className: optionsClassName,
|
|
46
|
+
onClick: change
|
|
47
|
+
}, /*#__PURE__*/React.createElement(antd.Space, null, /*#__PURE__*/React.createElement(antd.Checkbox, {
|
|
48
|
+
checked: checked
|
|
49
|
+
}), "\u5168\u90E8")), children);
|
|
72
50
|
};
|
|
73
51
|
|
|
74
52
|
exports.default = Index;
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
interface ICheckBoxOptionProps {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
label?: React.ReactNode;
|
|
4
|
+
checked: boolean;
|
|
5
5
|
}
|
|
6
|
-
declare const _default: ({
|
|
7
|
-
label,
|
|
8
|
-
checked,
|
|
9
|
-
}: ICheckBoxOptionProps) => JSX.Element;
|
|
6
|
+
declare const _default: ({ label, checked }: ICheckBoxOptionProps) => JSX.Element;
|
|
10
7
|
export default _default;
|
|
@@ -1,22 +1,17 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports,
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var antd = require(
|
|
6
|
-
var React = require(
|
|
5
|
+
var antd = require('antd');
|
|
6
|
+
var React = require('react');
|
|
7
7
|
|
|
8
|
-
var CheckBoxOption = function (_ref) {
|
|
8
|
+
var CheckBoxOption = (function (_ref) {
|
|
9
9
|
var label = _ref.label,
|
|
10
10
|
checked = _ref.checked;
|
|
11
|
-
return /*#__PURE__*/ React.createElement(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
checked: checked,
|
|
16
|
-
}),
|
|
17
|
-
label
|
|
18
|
-
);
|
|
19
|
-
};
|
|
11
|
+
return /*#__PURE__*/React.createElement(antd.Space, null, /*#__PURE__*/React.createElement(antd.Checkbox, {
|
|
12
|
+
checked: checked
|
|
13
|
+
}), label);
|
|
14
|
+
});
|
|
20
15
|
|
|
21
16
|
exports.default = CheckBoxOption;
|
|
22
17
|
// powered by h
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
interface IProps {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
loading?: boolean;
|
|
4
|
+
options?: any[];
|
|
5
|
+
error?: Error;
|
|
6
|
+
reload: VoidFunction;
|
|
7
7
|
}
|
|
8
8
|
declare const Index: React.FC<IProps>;
|
|
9
9
|
export default Index;
|
|
@@ -1,10 +1,10 @@
|
|
|
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 NotFoundContent = require(
|
|
5
|
+
var React = require('react');
|
|
6
|
+
var antd = require('antd');
|
|
7
|
+
var NotFoundContent = require('./NotFoundContent.js');
|
|
8
8
|
|
|
9
9
|
var Text = antd.Typography.Text;
|
|
10
10
|
var Index = function Index(_ref) {
|
|
@@ -16,39 +16,26 @@ var Index = function Index(_ref) {
|
|
|
16
16
|
children = _ref.children;
|
|
17
17
|
var len = options === null || options === void 0 ? void 0 : options.length;
|
|
18
18
|
if (loading && len === 0) {
|
|
19
|
-
return /*#__PURE__*/
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
style: {
|
|
23
|
-
height: 125,
|
|
24
|
-
},
|
|
25
|
-
justify: "center",
|
|
26
|
-
align: "middle",
|
|
19
|
+
return /*#__PURE__*/React.createElement(antd.Row, {
|
|
20
|
+
style: {
|
|
21
|
+
height: 125
|
|
27
22
|
},
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
Text,
|
|
37
|
-
{
|
|
38
|
-
type: "secondary",
|
|
39
|
-
},
|
|
40
|
-
"\u62FC\u547D\u52A0\u8F7D\u4E2D..."
|
|
41
|
-
)
|
|
42
|
-
)
|
|
43
|
-
);
|
|
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...")));
|
|
44
31
|
}
|
|
45
32
|
if (error && len === 0) {
|
|
46
|
-
return /*#__PURE__*/
|
|
33
|
+
return /*#__PURE__*/React.createElement(NotFoundContent.default, {
|
|
47
34
|
error: error,
|
|
48
|
-
reload: reload
|
|
35
|
+
reload: reload
|
|
49
36
|
});
|
|
50
37
|
}
|
|
51
|
-
return /*#__PURE__*/
|
|
38
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, children);
|
|
52
39
|
};
|
|
53
40
|
|
|
54
41
|
exports.default = Index;
|