@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,13 @@
|
|
|
1
|
+
// welcome to hoo hoo hoo
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import _objectDestructuringEmpty from '@babel/runtime-corejs3/helpers/objectDestructuringEmpty';
|
|
4
|
+
import _extends from '@babel/runtime-corejs3/helpers/extends';
|
|
5
|
+
import { Input } from 'antd';
|
|
6
|
+
|
|
7
|
+
var HInput = (function (_ref) {
|
|
8
|
+
var props = _extends({}, (_objectDestructuringEmpty(_ref), _ref));
|
|
9
|
+
return /*#__PURE__*/React.createElement(Input, props);
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export { HInput as default };
|
|
13
|
+
// powered by hdj
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ButtonProps, InputProps } from "antd";
|
|
2
|
+
import type { HSelectProps } from "../Select/modal";
|
|
3
|
+
import type { SelectInputType } from "./SelectInput";
|
|
4
|
+
import type { PromiseFnResult } from "../modal";
|
|
5
|
+
import type { addFormatItemModal } from "../Form/modal";
|
|
6
|
+
export type HInputProps = InputProps;
|
|
7
|
+
interface ValueNameModal {
|
|
8
|
+
input?: string;
|
|
9
|
+
select?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface HSelectInputProps extends Omit<HInputProps, "value" | "onChange"> {
|
|
12
|
+
selectProps?: HSelectProps;
|
|
13
|
+
value?: Record<string, any>;
|
|
14
|
+
onChange?: (value: Record<string, any>, type: SelectInputType) => void;
|
|
15
|
+
valueName?: ValueNameModal;
|
|
16
|
+
addFormat?: (config: Record<string, addFormatItemModal>) => void;
|
|
17
|
+
}
|
|
18
|
+
export interface HButtonProps extends Omit<ButtonProps, "onClick"> {
|
|
19
|
+
onClick: (value: string | readonly string[] | number | undefined, e: HTMLElement) => void;
|
|
20
|
+
}
|
|
21
|
+
export interface HButtonInputProps extends HInputProps {
|
|
22
|
+
buttonProps?: HButtonProps;
|
|
23
|
+
request?: PromiseFnResult;
|
|
24
|
+
}
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// welcome to hoo hoo hoo
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Typography, Row, Space, Button } from 'antd';
|
|
4
|
+
import { ExclamationCircleOutlined } from '@ant-design/icons';
|
|
5
|
+
|
|
6
|
+
var Text = Typography.Text;
|
|
7
|
+
var ErrorComponent = (function (_ref) {
|
|
8
|
+
var error = _ref.error,
|
|
9
|
+
reload = _ref.reload;
|
|
10
|
+
return /*#__PURE__*/React.createElement(Row, {
|
|
11
|
+
justify: "center",
|
|
12
|
+
align: "middle",
|
|
13
|
+
style: {
|
|
14
|
+
height: 125
|
|
15
|
+
}
|
|
16
|
+
}, /*#__PURE__*/React.createElement(Space, {
|
|
17
|
+
align: "center",
|
|
18
|
+
direction: "vertical"
|
|
19
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
20
|
+
type: "danger"
|
|
21
|
+
}, /*#__PURE__*/React.createElement(ExclamationCircleOutlined, {
|
|
22
|
+
size: 24
|
|
23
|
+
})), /*#__PURE__*/React.createElement(Text, {
|
|
24
|
+
type: "danger"
|
|
25
|
+
}, error === null || error === void 0 ? void 0 : error.message), /*#__PURE__*/React.createElement(Button, {
|
|
26
|
+
type: "primary",
|
|
27
|
+
size: "small",
|
|
28
|
+
onClick: reload
|
|
29
|
+
}, "\u91CD\u65B0\u52A0\u8F7D")));
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
export { ErrorComponent as default };
|
|
33
|
+
// powered by hdj
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// welcome to hoo hoo hoo
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Row, Spin } from 'antd';
|
|
4
|
+
|
|
5
|
+
var Loading = (function () {
|
|
6
|
+
return /*#__PURE__*/React.createElement(Row, {
|
|
7
|
+
justify: "center",
|
|
8
|
+
align: "middle",
|
|
9
|
+
style: {
|
|
10
|
+
height: 125
|
|
11
|
+
}
|
|
12
|
+
}, /*#__PURE__*/React.createElement(Spin, {
|
|
13
|
+
size: "large"
|
|
14
|
+
}));
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export { Loading as default };
|
|
18
|
+
// powered by hdj
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// welcome to hoo hoo hoo
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import Loading from './LoadingComponent.js';
|
|
4
|
+
import ErrorComponent from './ErrorComponent.js';
|
|
5
|
+
|
|
6
|
+
var Index = function Index(_ref) {
|
|
7
|
+
var error = _ref.error,
|
|
8
|
+
data = _ref.data,
|
|
9
|
+
reload = _ref.reload,
|
|
10
|
+
children = _ref.children;
|
|
11
|
+
if (error) {
|
|
12
|
+
return /*#__PURE__*/React.createElement(ErrorComponent, {
|
|
13
|
+
error: error,
|
|
14
|
+
reload: reload
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
if (data) {
|
|
18
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, children);
|
|
19
|
+
}
|
|
20
|
+
return /*#__PURE__*/React.createElement(Loading, null);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export { Index as default };
|
|
24
|
+
// powered by hdj
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { SelectProps, RadioGroupProps } from "antd/es";
|
|
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)[];
|
|
7
|
+
}
|
|
8
|
+
declare const _default: ({ value, options, onChange, fieldNames: propsFieldNames, ...props }: HRadioGroupProps) => JSX.Element;
|
|
9
|
+
export default _default;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// welcome to hoo hoo hoo
|
|
2
|
+
import React, { useMemo } from 'react';
|
|
3
|
+
import _extends from '@babel/runtime-corejs3/helpers/extends';
|
|
4
|
+
import _typeof from '@babel/runtime-corejs3/helpers/typeof';
|
|
5
|
+
import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/objectWithoutProperties';
|
|
6
|
+
import _mapInstanceProperty from '@babel/runtime-corejs3/core-js/instance/map';
|
|
7
|
+
import { Radio } from 'antd';
|
|
8
|
+
import { useMatchConfigProps } from '../hooks/index.js';
|
|
9
|
+
|
|
10
|
+
var _excluded = ["value", "options", "onChange", "fieldNames"];
|
|
11
|
+
var HRadioGroup = (function (_ref) {
|
|
12
|
+
var value = _ref.value,
|
|
13
|
+
options = _ref.options,
|
|
14
|
+
_onChange = _ref.onChange,
|
|
15
|
+
propsFieldNames = _ref.fieldNames,
|
|
16
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
17
|
+
var _useMatchConfigProps = useMatchConfigProps({
|
|
18
|
+
fieldNames: propsFieldNames
|
|
19
|
+
}),
|
|
20
|
+
_useMatchConfigProps$ = _useMatchConfigProps.fieldNames,
|
|
21
|
+
fieldNames = _useMatchConfigProps$ === void 0 ? {} : _useMatchConfigProps$;
|
|
22
|
+
var relOptions = useMemo(function () {
|
|
23
|
+
return options === null || options === void 0 ? void 0 : _mapInstanceProperty(options).call(options, function (item) {
|
|
24
|
+
var type = _typeof(item);
|
|
25
|
+
if (type === "string" || type === "number") {
|
|
26
|
+
return item;
|
|
27
|
+
}
|
|
28
|
+
var _fieldNames$label = fieldNames.label,
|
|
29
|
+
labelKey = _fieldNames$label === void 0 ? "" : _fieldNames$label,
|
|
30
|
+
_fieldNames$value = fieldNames.value,
|
|
31
|
+
valueKey = _fieldNames$value === void 0 ? "" : _fieldNames$value;
|
|
32
|
+
return {
|
|
33
|
+
label: item[labelKey],
|
|
34
|
+
value: item[valueKey]
|
|
35
|
+
};
|
|
36
|
+
});
|
|
37
|
+
}, [options, fieldNames]);
|
|
38
|
+
return /*#__PURE__*/React.createElement(Radio.Group, _extends({
|
|
39
|
+
options: relOptions,
|
|
40
|
+
value: value,
|
|
41
|
+
onChange: function onChange(e) {
|
|
42
|
+
_onChange === null || _onChange === void 0 ? void 0 : _onChange(e.target.value);
|
|
43
|
+
}
|
|
44
|
+
}, props));
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
export { HRadioGroup as default };
|
|
48
|
+
// powered by hdj
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// welcome to hoo hoo hoo
|
|
2
|
+
import _concatInstanceProperty from '@babel/runtime-corejs3/core-js/instance/concat';
|
|
3
|
+
import { Space, Checkbox } from 'antd';
|
|
4
|
+
import { itemOpProvider } from '../utils.js';
|
|
5
|
+
import { useClassName } from '../../hooks/index.js';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
|
|
8
|
+
var useRootClassName = function useRootClassName(checked) {
|
|
9
|
+
var _context;
|
|
10
|
+
var norClassNames = ["select-item", "select-item-option"];
|
|
11
|
+
return checked ? _concatInstanceProperty(_context = []).call(_context, norClassNames, ["select-item-option-selected"]) : norClassNames;
|
|
12
|
+
};
|
|
13
|
+
var Index = function Index(_ref) {
|
|
14
|
+
var allSelect = _ref.allSelect,
|
|
15
|
+
mode = _ref.mode,
|
|
16
|
+
onChange = _ref.onChange,
|
|
17
|
+
value = _ref.value,
|
|
18
|
+
serviceSearch = _ref.serviceSearch,
|
|
19
|
+
options = _ref.options,
|
|
20
|
+
_ref$fieldNames = _ref.fieldNames,
|
|
21
|
+
fieldNames = _ref$fieldNames === void 0 ? {} : _ref$fieldNames,
|
|
22
|
+
children = _ref.children;
|
|
23
|
+
var opLen = (options === null || options === void 0 ? void 0 : options.length) || 0;
|
|
24
|
+
var checked = (value === null || value === void 0 ? void 0 : value.length) >= opLen;
|
|
25
|
+
var classNames = useRootClassName(checked);
|
|
26
|
+
var optionsClassName = useClassName(classNames);
|
|
27
|
+
var allCheckBox = useClassName("hw-all-check-box");
|
|
28
|
+
var change = function change() {
|
|
29
|
+
if (!checked) {
|
|
30
|
+
var subItemOps = itemOpProvider(options, fieldNames);
|
|
31
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(options, subItemOps);
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
onChange === null || onChange === void 0 ? void 0 : onChange([], []);
|
|
35
|
+
};
|
|
36
|
+
if (!allSelect || mode !== "multiple" || serviceSearch) {
|
|
37
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, children);
|
|
38
|
+
}
|
|
39
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
40
|
+
className: allCheckBox
|
|
41
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
42
|
+
className: optionsClassName,
|
|
43
|
+
onClick: change
|
|
44
|
+
}, /*#__PURE__*/React.createElement(Space, null, /*#__PURE__*/React.createElement(Checkbox, {
|
|
45
|
+
checked: checked
|
|
46
|
+
}), "\u5168\u90E8")), children);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export { Index as default };
|
|
50
|
+
// powered by hdj
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// welcome to hoo hoo hoo
|
|
2
|
+
import { Space, Checkbox } from 'antd';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
|
|
5
|
+
var CheckBoxOption = (function (_ref) {
|
|
6
|
+
var label = _ref.label,
|
|
7
|
+
checked = _ref.checked;
|
|
8
|
+
return /*#__PURE__*/React.createElement(Space, null, /*#__PURE__*/React.createElement(Checkbox, {
|
|
9
|
+
checked: checked
|
|
10
|
+
}), label);
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export { CheckBoxOption as default };
|
|
14
|
+
// powered by hdj
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// welcome to hoo hoo hoo
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Typography, Row, Space, Spin } from 'antd';
|
|
4
|
+
import NotFoundContent from './NotFoundContent.js';
|
|
5
|
+
|
|
6
|
+
var Text = Typography.Text;
|
|
7
|
+
var Index = function Index(_ref) {
|
|
8
|
+
var loading = _ref.loading,
|
|
9
|
+
error = _ref.error,
|
|
10
|
+
_ref$options = _ref.options,
|
|
11
|
+
options = _ref$options === void 0 ? [] : _ref$options,
|
|
12
|
+
reload = _ref.reload,
|
|
13
|
+
children = _ref.children;
|
|
14
|
+
var len = options === null || options === void 0 ? void 0 : options.length;
|
|
15
|
+
if (loading && len === 0) {
|
|
16
|
+
return /*#__PURE__*/React.createElement(Row, {
|
|
17
|
+
style: {
|
|
18
|
+
height: 125
|
|
19
|
+
},
|
|
20
|
+
justify: "center",
|
|
21
|
+
align: "middle"
|
|
22
|
+
}, /*#__PURE__*/React.createElement(Space, {
|
|
23
|
+
direction: "vertical",
|
|
24
|
+
align: "center"
|
|
25
|
+
}, /*#__PURE__*/React.createElement(Spin, null), /*#__PURE__*/React.createElement(Text, {
|
|
26
|
+
type: "secondary"
|
|
27
|
+
}, "\u62FC\u547D\u52A0\u8F7D\u4E2D...")));
|
|
28
|
+
}
|
|
29
|
+
if (error && len === 0) {
|
|
30
|
+
return /*#__PURE__*/React.createElement(NotFoundContent, {
|
|
31
|
+
error: error,
|
|
32
|
+
reload: reload
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, children);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export { Index as default };
|
|
39
|
+
// powered by hdj
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// welcome to hoo hoo hoo
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Typography } from 'antd';
|
|
4
|
+
|
|
5
|
+
var NoFindItem = (function (_ref) {
|
|
6
|
+
var label = _ref.label;
|
|
7
|
+
return /*#__PURE__*/React.createElement(Typography.Text, {
|
|
8
|
+
type: "danger"
|
|
9
|
+
}, label);
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export { NoFindItem as default };
|
|
13
|
+
// powered by hdj
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// welcome to hoo hoo hoo
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Typography, Row, Space, Button, Empty } from 'antd';
|
|
4
|
+
import { ExclamationCircleOutlined } from '@ant-design/icons';
|
|
5
|
+
|
|
6
|
+
var Text = Typography.Text;
|
|
7
|
+
var NotFoundContent = (function (_ref) {
|
|
8
|
+
var error = _ref.error,
|
|
9
|
+
reload = _ref.reload;
|
|
10
|
+
if (error) {
|
|
11
|
+
return /*#__PURE__*/React.createElement(Row, {
|
|
12
|
+
justify: "center",
|
|
13
|
+
align: "middle",
|
|
14
|
+
style: {
|
|
15
|
+
height: 125
|
|
16
|
+
}
|
|
17
|
+
}, /*#__PURE__*/React.createElement(Space, {
|
|
18
|
+
align: "center",
|
|
19
|
+
direction: "vertical"
|
|
20
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
21
|
+
type: "danger"
|
|
22
|
+
}, /*#__PURE__*/React.createElement(ExclamationCircleOutlined, {
|
|
23
|
+
size: 24
|
|
24
|
+
})), /*#__PURE__*/React.createElement(Text, {
|
|
25
|
+
type: "danger"
|
|
26
|
+
}, error.message), /*#__PURE__*/React.createElement(Button, {
|
|
27
|
+
type: "primary",
|
|
28
|
+
size: "small",
|
|
29
|
+
onClick: reload
|
|
30
|
+
}, "\u91CD\u65B0\u52A0\u8F7D")));
|
|
31
|
+
}
|
|
32
|
+
return /*#__PURE__*/React.createElement(Empty, {
|
|
33
|
+
image: Empty.PRESENTED_IMAGE_SIMPLE
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
export { NotFoundContent as default };
|
|
38
|
+
// powered by hdj
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// welcome to hoo hoo hoo
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import _mapInstanceProperty from '@babel/runtime-corejs3/core-js/instance/map';
|
|
4
|
+
import _indexOfInstanceProperty from '@babel/runtime-corejs3/core-js/instance/index-of';
|
|
5
|
+
import CheckBoxOption from './components/CheckBoxOption.js';
|
|
6
|
+
import NoFindItem from './components/NoFindItem.js';
|
|
7
|
+
|
|
8
|
+
var defaultModeConfig = {
|
|
9
|
+
multiple: {
|
|
10
|
+
icon: null,
|
|
11
|
+
render: function render(item, value) {
|
|
12
|
+
var checkVal = value === null || value === void 0 ? void 0 : _mapInstanceProperty(value).call(value, function (itemVal) {
|
|
13
|
+
return itemVal.value;
|
|
14
|
+
});
|
|
15
|
+
var newVal = checkVal || [];
|
|
16
|
+
var checked = _indexOfInstanceProperty(newVal).call(newVal, item.value) !== -1;
|
|
17
|
+
return /*#__PURE__*/React.createElement(CheckBoxOption, {
|
|
18
|
+
label: item.label,
|
|
19
|
+
checked: checked
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
var defaultSelectConfig = {
|
|
25
|
+
noMatchItemRender: function noMatchItemRender() {
|
|
26
|
+
return /*#__PURE__*/React.createElement(NoFindItem, {
|
|
27
|
+
label: "选项被删除,请重新选择"
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export { defaultModeConfig, defaultSelectConfig };
|
|
33
|
+
// powered by hdj
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
// welcome to hoo hoo hoo
|
|
2
|
+
import _Object$keys from '@babel/runtime-corejs3/core-js/object/keys';
|
|
3
|
+
import _Object$getOwnPropertySymbols from '@babel/runtime-corejs3/core-js/object/get-own-property-symbols';
|
|
4
|
+
import _filterInstanceProperty from '@babel/runtime-corejs3/core-js/instance/filter';
|
|
5
|
+
import _Object$getOwnPropertyDescriptor from '@babel/runtime-corejs3/core-js/object/get-own-property-descriptor';
|
|
6
|
+
import _Object$getOwnPropertyDescriptors from '@babel/runtime-corejs3/core-js/object/get-own-property-descriptors';
|
|
7
|
+
import _Object$defineProperties from '@babel/runtime-corejs3/core-js/object/define-properties';
|
|
8
|
+
import _Object$defineProperty from '@babel/runtime-corejs3/core-js/object/define-property';
|
|
9
|
+
import _slicedToArray from '@babel/runtime-corejs3/helpers/slicedToArray';
|
|
10
|
+
import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/objectWithoutProperties';
|
|
11
|
+
import _defineProperty from '@babel/runtime-corejs3/helpers/defineProperty';
|
|
12
|
+
import _findIndexInstanceProperty from '@babel/runtime-corejs3/core-js/instance/find-index';
|
|
13
|
+
import _forEachInstanceProperty from '@babel/runtime-corejs3/core-js/instance/for-each';
|
|
14
|
+
import _mapInstanceProperty from '@babel/runtime-corejs3/core-js/instance/map';
|
|
15
|
+
import _Array$isArray from '@babel/runtime-corejs3/core-js/array/is-array';
|
|
16
|
+
import { useState, useEffect } from 'react';
|
|
17
|
+
import { itemOpProvider } from '../utils.js';
|
|
18
|
+
|
|
19
|
+
var _excluded = ["index"],
|
|
20
|
+
_excluded2 = ["index"];
|
|
21
|
+
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
22
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
23
|
+
var single = function single(_ref) {
|
|
24
|
+
var options = _ref.options,
|
|
25
|
+
value = _ref.value,
|
|
26
|
+
noMatchItemRender = _ref.noMatchItemRender;
|
|
27
|
+
var newOptions = options || [];
|
|
28
|
+
var index = _findIndexInstanceProperty(newOptions).call(newOptions, function (item) {
|
|
29
|
+
return item.value === value;
|
|
30
|
+
});
|
|
31
|
+
if (index !== -1) {
|
|
32
|
+
var label = newOptions[index].label;
|
|
33
|
+
return {
|
|
34
|
+
value: value,
|
|
35
|
+
label: label
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
return {
|
|
39
|
+
value: value,
|
|
40
|
+
label: (noMatchItemRender === null || noMatchItemRender === void 0 ? void 0 : noMatchItemRender({
|
|
41
|
+
value: value
|
|
42
|
+
})) || value
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
var findNewValInOldVal = function findNewValInOldVal(val, oldVal) {
|
|
46
|
+
if (!oldVal) {
|
|
47
|
+
return -1;
|
|
48
|
+
}
|
|
49
|
+
return _findIndexInstanceProperty(oldVal).call(oldVal, function (item) {
|
|
50
|
+
return item.value === val;
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
var sourceDataProvider = function sourceDataProvider(_ref2, oldVal) {
|
|
54
|
+
_ref2.options;
|
|
55
|
+
var value = _ref2.value;
|
|
56
|
+
var oldData = [];
|
|
57
|
+
var newData = [];
|
|
58
|
+
_forEachInstanceProperty(value).call(value, function (item, i) {
|
|
59
|
+
var index = findNewValInOldVal(item, oldVal);
|
|
60
|
+
if (index === -1) {
|
|
61
|
+
newData.push({
|
|
62
|
+
value: item,
|
|
63
|
+
index: i
|
|
64
|
+
});
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
var newVal = oldVal === null || oldVal === void 0 ? void 0 : oldVal[index];
|
|
68
|
+
oldData.push(_objectSpread(_objectSpread({}, newVal), {}, {
|
|
69
|
+
index: i
|
|
70
|
+
}));
|
|
71
|
+
});
|
|
72
|
+
return {
|
|
73
|
+
oldData: oldData,
|
|
74
|
+
newData: newData
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
var resultProvider = function resultProvider(newData, oldData, value) {
|
|
78
|
+
var newResult = new Array(value.length);
|
|
79
|
+
_forEachInstanceProperty(oldData).call(oldData, function (item) {
|
|
80
|
+
var index = item.index,
|
|
81
|
+
val = _objectWithoutProperties(item, _excluded);
|
|
82
|
+
newResult[index] = _objectSpread({}, val);
|
|
83
|
+
});
|
|
84
|
+
_forEachInstanceProperty(newData).call(newData, function (item) {
|
|
85
|
+
var index = item.index,
|
|
86
|
+
val = _objectWithoutProperties(item, _excluded2);
|
|
87
|
+
newResult[index] = _objectSpread({}, val);
|
|
88
|
+
});
|
|
89
|
+
return newResult;
|
|
90
|
+
};
|
|
91
|
+
var multiple = function multiple(_ref3, oldVal) {
|
|
92
|
+
var options = _ref3.options,
|
|
93
|
+
value = _ref3.value,
|
|
94
|
+
noMatchItemRender = _ref3.noMatchItemRender;
|
|
95
|
+
var _sourceDataProvider = sourceDataProvider({
|
|
96
|
+
options: options,
|
|
97
|
+
value: value
|
|
98
|
+
}, oldVal),
|
|
99
|
+
newData = _sourceDataProvider.newData,
|
|
100
|
+
oldData = _sourceDataProvider.oldData;
|
|
101
|
+
var newMatchVal = _mapInstanceProperty(newData).call(newData, function (item) {
|
|
102
|
+
var itemVal = item.value,
|
|
103
|
+
index = item.index;
|
|
104
|
+
var newItem = single({
|
|
105
|
+
options: options,
|
|
106
|
+
value: itemVal,
|
|
107
|
+
noMatchItemRender: noMatchItemRender
|
|
108
|
+
});
|
|
109
|
+
return _objectSpread(_objectSpread({}, newItem), {}, {
|
|
110
|
+
index: index
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
return resultProvider(newMatchVal, oldData, value);
|
|
114
|
+
};
|
|
115
|
+
var tag = function tag(_ref4, oldVal) {
|
|
116
|
+
var options = _ref4.options,
|
|
117
|
+
value = _ref4.value;
|
|
118
|
+
var _sourceDataProvider2 = sourceDataProvider({
|
|
119
|
+
options: options,
|
|
120
|
+
value: value
|
|
121
|
+
}, oldVal),
|
|
122
|
+
newData = _sourceDataProvider2.newData,
|
|
123
|
+
oldData = _sourceDataProvider2.oldData;
|
|
124
|
+
return resultProvider(newData, oldData, value);
|
|
125
|
+
};
|
|
126
|
+
var matchNotFind = function matchNotFind(_ref5, oldVale) {
|
|
127
|
+
var options = _ref5.options,
|
|
128
|
+
value = _ref5.value,
|
|
129
|
+
mode = _ref5.mode,
|
|
130
|
+
noMatchItemRender = _ref5.noMatchItemRender;
|
|
131
|
+
if (!mode) {
|
|
132
|
+
return single({
|
|
133
|
+
options: options,
|
|
134
|
+
value: value,
|
|
135
|
+
noMatchItemRender: noMatchItemRender
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
if (mode === "multiple") {
|
|
139
|
+
return multiple({
|
|
140
|
+
options: options,
|
|
141
|
+
value: value,
|
|
142
|
+
noMatchItemRender: noMatchItemRender
|
|
143
|
+
}, oldVale);
|
|
144
|
+
}
|
|
145
|
+
return tag({
|
|
146
|
+
options: options,
|
|
147
|
+
value: value
|
|
148
|
+
}, oldVale);
|
|
149
|
+
};
|
|
150
|
+
var useValueChange = function useValueChange(params) {
|
|
151
|
+
var labelInValue = params.labelInValue,
|
|
152
|
+
onChange = params.onChange,
|
|
153
|
+
value = params.value,
|
|
154
|
+
options = params.options,
|
|
155
|
+
mode = params.mode,
|
|
156
|
+
noMatchItemRender = params.noMatchItemRender,
|
|
157
|
+
_params$fieldNames = params.fieldNames,
|
|
158
|
+
fieldNames = _params$fieldNames === void 0 ? {} : _params$fieldNames;
|
|
159
|
+
var _useState = useState(),
|
|
160
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
161
|
+
val = _useState2[0],
|
|
162
|
+
setVal = _useState2[1];
|
|
163
|
+
var change = function change(changeVal, itemOps) {
|
|
164
|
+
if (!onChange) {
|
|
165
|
+
setVal(changeVal);
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
var newChangeVal = changeVal.value;
|
|
169
|
+
if (labelInValue) {
|
|
170
|
+
newChangeVal = changeVal;
|
|
171
|
+
}
|
|
172
|
+
if (_Array$isArray(changeVal)) {
|
|
173
|
+
newChangeVal = _mapInstanceProperty(changeVal).call(changeVal, function (item) {
|
|
174
|
+
return item.value;
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
var subItemOps = itemOpProvider(itemOps, fieldNames);
|
|
178
|
+
onChange(newChangeVal, subItemOps);
|
|
179
|
+
};
|
|
180
|
+
useEffect(function () {
|
|
181
|
+
if (options && value) {
|
|
182
|
+
setVal(function (oldVale) {
|
|
183
|
+
return matchNotFind(params, oldVale);
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
}, [value, options, mode, noMatchItemRender]);
|
|
187
|
+
return {
|
|
188
|
+
val: val,
|
|
189
|
+
change: change
|
|
190
|
+
};
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
export { useValueChange };
|
|
194
|
+
// powered by hdj
|
|
@@ -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;
|