@hw-component/form 1.9.85 → 1.9.87

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.
Files changed (70) hide show
  1. package/.eslintcache +1 -1
  2. package/es/DialogForm/hooks.d.ts +1 -1
  3. package/es/Form/config.d.ts +2 -1
  4. package/es/Form/config.js +3 -1
  5. package/es/Form/hooks/useHForm.js +10 -0
  6. package/es/Form/modal.d.ts +1 -0
  7. package/es/Select/TagSelect/Content.d.ts +7 -0
  8. package/es/Select/TagSelect/Content.js +90 -0
  9. package/es/Select/TagSelect/hooks.d.ts +10 -0
  10. package/es/Select/TagSelect/hooks.js +97 -0
  11. package/es/Select/TagSelect/index.d.ts +3 -0
  12. package/es/Select/TagSelect/index.js +100 -0
  13. package/es/Select/index.js +0 -1
  14. package/es/Select/modal.d.ts +7 -1
  15. package/es/index.css +15 -0
  16. package/es/index.d.ts +2 -1
  17. package/es/index.js +2 -1
  18. package/lib/DialogForm/hooks.d.ts +1 -1
  19. package/lib/Form/config.d.ts +2 -1
  20. package/lib/Form/config.js +3 -1
  21. package/lib/Form/hooks/useHForm.js +10 -0
  22. package/lib/Form/modal.d.ts +1 -0
  23. package/lib/Select/TagSelect/Content.d.ts +7 -0
  24. package/lib/Select/TagSelect/Content.js +93 -0
  25. package/lib/Select/TagSelect/hooks.d.ts +10 -0
  26. package/lib/Select/TagSelect/hooks.js +99 -0
  27. package/lib/Select/TagSelect/index.d.ts +3 -0
  28. package/lib/Select/TagSelect/index.js +103 -0
  29. package/lib/Select/index.js +0 -1
  30. package/lib/Select/modal.d.ts +7 -1
  31. package/lib/index.css +15 -0
  32. package/lib/index.d.ts +2 -1
  33. package/lib/index.js +2 -0
  34. package/package.json +1 -1
  35. package/src/components/Btn.tsx +36 -36
  36. package/src/components/CheckboxGroup/index.tsx +4 -3
  37. package/src/components/DialogForm/DrawerForm/index.tsx +13 -13
  38. package/src/components/DialogForm/ModalForm.tsx +16 -16
  39. package/src/components/DialogForm/hooks.tsx +3 -3
  40. package/src/components/DialogForm/modal.ts +8 -2
  41. package/src/components/Form/HFormConnect.tsx +8 -3
  42. package/src/components/Form/InitSet.tsx +4 -4
  43. package/src/components/Form/config.ts +2 -1
  44. package/src/components/Form/hooks/index.ts +1 -3
  45. package/src/components/Form/hooks/useAddFormat.tsx +34 -36
  46. package/src/components/Form/hooks/useHForm.ts +14 -2
  47. package/src/components/Form/index.less +6 -0
  48. package/src/components/Form/modal.ts +3 -2
  49. package/src/components/RichEditor/hooks.ts +36 -34
  50. package/src/components/RichEditor/index.tsx +31 -23
  51. package/src/components/RichEditor/modal.ts +2 -2
  52. package/src/components/Select/TagSelect/Content.tsx +50 -0
  53. package/src/components/Select/TagSelect/hooks.ts +83 -0
  54. package/src/components/Select/TagSelect/index.tsx +63 -0
  55. package/src/components/Select/index.less +13 -0
  56. package/src/components/Select/index.tsx +0 -1
  57. package/src/components/Select/modal.ts +7 -1
  58. package/src/components/TDPicker/TimePicker.tsx +1 -1
  59. package/src/components/TDPicker/hooks.ts +1 -1
  60. package/src/components/TextArea/index.tsx +2 -2
  61. package/src/components/Upload/Btn.tsx +13 -9
  62. package/src/components/Upload/hooks/customRequest.ts +1 -1
  63. package/src/components/Upload/index.tsx +8 -8
  64. package/src/components/Upload/modal.ts +5 -4
  65. package/src/components/index.tsx +2 -0
  66. package/src/pages/DrawerForm/index.tsx +17 -15
  67. package/src/pages/Form/index.tsx +161 -144
  68. package/src/pages/ModalForm/index.tsx +12 -8
  69. package/src/pages/Select/index.tsx +25 -4
  70. package/src/pages/Upload/index.tsx +2 -2
@@ -197,6 +197,16 @@ var useHForm = (function () {
197
197
  });
198
198
  form.setFieldsValue(_objectSpread(_objectSpread(_objectSpread({}, newVale), initSaveValue), values));
199
199
  },
200
+ resetFieldsValues: function resetFieldsValues() {
201
+ var values = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
202
+ var oldValue = form.getFieldsValue(true);
203
+ var keys = Object.keys(oldValue);
204
+ var newVale = {};
205
+ keys.forEach(function (key) {
206
+ newVale[key] = undefined;
207
+ });
208
+ form.setFieldsValue(_objectSpread(_objectSpread({}, newVale), values));
209
+ },
200
210
  clear: function clear() {
201
211
  form.resetFields();
202
212
  isLoading = false;
@@ -149,6 +149,7 @@ export interface HFormInstance extends FormInstance {
149
149
  reload: PromiseFnResult;
150
150
  clear: VoidFunction;
151
151
  resetFieldsInitValue: (values?: Record<string, any>) => void;
152
+ resetFieldsValues: (values?: Record<string, any>) => void;
152
153
  clearFormat: (name: string) => void;
153
154
  inited: boolean;
154
155
  resetFormStatus: VoidFunction;
@@ -0,0 +1,7 @@
1
+ import { HTagSelectProps } from "../modal";
2
+ interface IContentProps extends HTagSelectProps {
3
+ error?: Error;
4
+ reload: VoidFunction;
5
+ }
6
+ declare const _default: ({ loading, value, options, onChange, fieldNames, error, reload }: IContentProps) => JSX.Element;
7
+ export default _default;
@@ -0,0 +1,90 @@
1
+ // welcome to hoo hoo hoo
2
+ import { jsxs, jsx } from 'react/jsx-runtime';
3
+ import { useClassName } from '../../hooks/index.js';
4
+ import { Space, Skeleton, Empty, Row, Tag } from 'antd';
5
+ import { useChangeControl } from './hooks.js';
6
+ import NotFoundContent from '../components/NotFoundContent.js';
7
+
8
+ var ItemOption = function ItemOption(_ref) {
9
+ var options = _ref.options,
10
+ value = _ref.value,
11
+ onChange = _ref.onChange,
12
+ fieldNames = _ref.fieldNames;
13
+ var tagClassName = useClassName("hw-tag-item");
14
+ var _ref2 = fieldNames || {},
15
+ _ref2$label = _ref2.label,
16
+ labelKey = _ref2$label === void 0 ? "label" : _ref2$label,
17
+ _ref2$value = _ref2.value,
18
+ valueKey = _ref2$value === void 0 ? "value" : _ref2$value;
19
+ var _useChangeControl = useChangeControl({
20
+ options: options,
21
+ value: value,
22
+ onChange: onChange,
23
+ fieldNames: fieldNames
24
+ }),
25
+ change = _useChangeControl.change;
26
+ return jsx(Row, {
27
+ gutter: [0, 8],
28
+ children: options === null || options === void 0 ? void 0 : options.map(function (item) {
29
+ var label = item[labelKey],
30
+ itemVal = item[valueKey];
31
+ var index = value === null || value === void 0 ? void 0 : value.indexOf(itemVal);
32
+ var checkedTag = index !== -1;
33
+ return jsx(Tag, {
34
+ color: checkedTag ? "processing" : undefined,
35
+ className: tagClassName,
36
+ onClick: function onClick() {
37
+ change(itemVal);
38
+ },
39
+ children: label
40
+ }, itemVal);
41
+ })
42
+ });
43
+ };
44
+ var Content = (function (_ref3) {
45
+ var loading = _ref3.loading,
46
+ value = _ref3.value,
47
+ options = _ref3.options,
48
+ onChange = _ref3.onChange,
49
+ fieldNames = _ref3.fieldNames,
50
+ error = _ref3.error,
51
+ reload = _ref3.reload;
52
+ var len = (options === null || options === void 0 ? void 0 : options.length) || 0;
53
+ if (loading && len === 0) {
54
+ return jsxs(Space, {
55
+ direction: "vertical",
56
+ style: {
57
+ width: "100%"
58
+ },
59
+ children: [jsx(Skeleton.Button, {
60
+ active: true,
61
+ size: "small",
62
+ block: true
63
+ }), jsx(Skeleton.Button, {
64
+ active: true,
65
+ size: "small",
66
+ block: true
67
+ })]
68
+ });
69
+ }
70
+ if (error && len === 0) {
71
+ return jsx(NotFoundContent, {
72
+ error: error,
73
+ reload: reload
74
+ });
75
+ }
76
+ if (len === 0) {
77
+ return jsx(Empty, {
78
+ image: Empty.PRESENTED_IMAGE_SIMPLE
79
+ });
80
+ }
81
+ return jsx(ItemOption, {
82
+ options: options,
83
+ value: value,
84
+ onChange: onChange,
85
+ fieldNames: fieldNames
86
+ });
87
+ });
88
+
89
+ export { Content as default };
90
+ // powered by hdj
@@ -0,0 +1,10 @@
1
+ import { HTagSelectProps } from "@/components/Select/modal";
2
+ export declare const useTagControl: ({ value, options, title }: HTagSelectProps) => {
3
+ labelNode: {};
4
+ checked: boolean | undefined;
5
+ indeterminate: boolean | undefined;
6
+ };
7
+ export declare const useChangeControl: ({ options, value, onChange, fieldNames }: HTagSelectProps) => {
8
+ change: (val: any) => void;
9
+ allCheck: (e: any) => void | undefined;
10
+ };
@@ -0,0 +1,97 @@
1
+ // welcome to hoo hoo hoo
2
+ import _toConsumableArray from '@babel/runtime-corejs3/helpers/toConsumableArray';
3
+ import { useMemo } from 'react';
4
+
5
+ var useTagControl = function useTagControl(_ref) {
6
+ var value = _ref.value,
7
+ options = _ref.options,
8
+ title = _ref.title;
9
+ var _useMemo = useMemo(function () {
10
+ var len = value === null || value === void 0 ? void 0 : value.length;
11
+ var opLen = options === null || options === void 0 ? void 0 : options.length;
12
+ if (!opLen) {
13
+ return {
14
+ checked: false
15
+ };
16
+ }
17
+ if (len === opLen) {
18
+ return {
19
+ checked: true
20
+ };
21
+ }
22
+ return {
23
+ indeterminate: !!len
24
+ };
25
+ }, [value, options]),
26
+ checked = _useMemo.checked,
27
+ indeterminate = _useMemo.indeterminate;
28
+ var labelNode = useMemo(function () {
29
+ if (title) {
30
+ return title;
31
+ }
32
+ if (checked) {
33
+ return "取消";
34
+ }
35
+ return "全选";
36
+ }, [title, checked, indeterminate]);
37
+ return {
38
+ labelNode: labelNode,
39
+ checked: checked,
40
+ indeterminate: indeterminate
41
+ };
42
+ };
43
+ var useChangeControl = function useChangeControl(_ref2) {
44
+ var options = _ref2.options,
45
+ value = _ref2.value,
46
+ onChange = _ref2.onChange,
47
+ fieldNames = _ref2.fieldNames;
48
+ var _ref3 = fieldNames || {},
49
+ _ref3$value = _ref3.value,
50
+ valueKey = _ref3$value === void 0 ? "value" : _ref3$value;
51
+ var optsNk = function optsNk(newVal) {
52
+ var newOpts = [];
53
+ newVal === null || newVal === void 0 || newVal.forEach(function (itemVal) {
54
+ var index = options === null || options === void 0 ? void 0 : options.findIndex(function (item) {
55
+ return itemVal === item[valueKey];
56
+ });
57
+ if (typeof index !== "undefined") {
58
+ newOpts.push(options === null || options === void 0 ? void 0 : options[index]);
59
+ }
60
+ });
61
+ return newOpts;
62
+ };
63
+ var checkedVal = function checkedVal(val) {
64
+ var newVal = _toConsumableArray(value);
65
+ newVal.push(val);
66
+ onChange === null || onChange === void 0 || onChange(newVal, optsNk(newVal));
67
+ };
68
+ var removeVal = function removeVal(index) {
69
+ var newVal = _toConsumableArray(value);
70
+ newVal.splice(index, 1);
71
+ onChange === null || onChange === void 0 || onChange(newVal, optsNk(newVal));
72
+ };
73
+ var change = function change(val) {
74
+ var index = value === null || value === void 0 ? void 0 : value.indexOf(val);
75
+ var checked = index === -1;
76
+ if (checked) {
77
+ return checkedVal(val);
78
+ }
79
+ return removeVal(index);
80
+ };
81
+ var allCheck = function allCheck(e) {
82
+ if (!e.target.checked) {
83
+ return onChange === null || onChange === void 0 ? void 0 : onChange([], []);
84
+ }
85
+ var newVal = options === null || options === void 0 ? void 0 : options.map(function (item) {
86
+ return item[valueKey];
87
+ });
88
+ return onChange === null || onChange === void 0 ? void 0 : onChange(newVal, options);
89
+ };
90
+ return {
91
+ change: change,
92
+ allCheck: allCheck
93
+ };
94
+ };
95
+
96
+ export { useChangeControl, useTagControl };
97
+ // powered by hdj
@@ -0,0 +1,3 @@
1
+ import React from "react";
2
+ declare const _default: React.ForwardRefExoticComponent<import("../../Form/modal").HFormItemProps & React.RefAttributes<any>>;
3
+ export default _default;
@@ -0,0 +1,100 @@
1
+ // welcome to hoo hoo hoo
2
+ import _defineProperty from '@babel/runtime-corejs3/helpers/defineProperty';
3
+ import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/objectWithoutProperties';
4
+ import { jsx } from 'react/jsx-runtime';
5
+ import { Collapse, Checkbox } from 'antd';
6
+ import { useClassName, useMatchConfigProps } from '../../hooks/index.js';
7
+ import { useSelectReq } from '../hooks/norHooks.js';
8
+ import Content from './Content.js';
9
+ import { useTagControl, useChangeControl } from './hooks.js';
10
+ import HFormConnect from '../../Form/HFormConnect.js';
11
+
12
+ var _excluded = ["children"];
13
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
14
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
15
+ var Panel = Collapse.Panel;
16
+ var ItemTitle = function ItemTitle(_ref) {
17
+ var children = _ref.children,
18
+ props = _objectWithoutProperties(_ref, _excluded);
19
+ return jsx("div", {
20
+ onClick: function onClick(event) {
21
+ event.stopPropagation();
22
+ },
23
+ children: jsx(Checkbox, _objectSpread(_objectSpread({}, props), {}, {
24
+ children: children
25
+ }))
26
+ });
27
+ };
28
+ var Index = function Index(_ref2) {
29
+ var options = _ref2.options,
30
+ _ref2$value = _ref2.value,
31
+ value = _ref2$value === void 0 ? [] : _ref2$value,
32
+ onChange = _ref2.onChange,
33
+ dispatch = _ref2.dispatch,
34
+ propsFieldNames = _ref2.fieldNames,
35
+ request = _ref2.request,
36
+ title = _ref2.title,
37
+ manual = _ref2.manual,
38
+ _ref2$className = _ref2.className,
39
+ className = _ref2$className === void 0 ? "" : _ref2$className,
40
+ collapseProps = _ref2.collapseProps,
41
+ addDispatchListener = _ref2.addDispatchListener;
42
+ var collapseClassName = useClassName("hw-tag-select");
43
+ var _useMatchConfigProps = useMatchConfigProps({
44
+ fieldNames: propsFieldNames
45
+ }),
46
+ fieldNames = _useMatchConfigProps.fieldNames;
47
+ var _useSelectReq = useSelectReq({
48
+ options: options,
49
+ manual: manual,
50
+ request: request,
51
+ dispatch: dispatch
52
+ }),
53
+ loading = _useSelectReq.loading,
54
+ resultData = _useSelectReq.data,
55
+ error = _useSelectReq.error,
56
+ reload = _useSelectReq.reload;
57
+ var _useTagControl = useTagControl({
58
+ value: value,
59
+ options: resultData,
60
+ title: title
61
+ }),
62
+ labelNode = _useTagControl.labelNode,
63
+ checked = _useTagControl.checked,
64
+ indeterminate = _useTagControl.indeterminate;
65
+ var _useChangeControl = useChangeControl({
66
+ value: value,
67
+ options: resultData,
68
+ onChange: onChange,
69
+ fieldNames: fieldNames
70
+ }),
71
+ allCheck = _useChangeControl.allCheck;
72
+ addDispatchListener === null || addDispatchListener === void 0 || addDispatchListener("reload", reload);
73
+ return jsx(Collapse, _objectSpread(_objectSpread({
74
+ bordered: false,
75
+ ghost: true
76
+ }, collapseProps), {}, {
77
+ className: "".concat(collapseClassName, " ").concat(className),
78
+ children: jsx(Panel, {
79
+ header: jsx(ItemTitle, {
80
+ indeterminate: indeterminate,
81
+ checked: checked,
82
+ onChange: allCheck,
83
+ children: labelNode
84
+ }),
85
+ children: jsx(Content, {
86
+ loading: loading,
87
+ options: resultData,
88
+ value: value,
89
+ error: error,
90
+ onChange: onChange,
91
+ reload: reload,
92
+ fieldNames: fieldNames
93
+ })
94
+ }, "1")
95
+ }));
96
+ };
97
+ var HTagSelect = HFormConnect(Index);
98
+
99
+ export { HTagSelect as default };
100
+ // powered by hdj
@@ -67,7 +67,6 @@ var Index = function Index(_ref) {
67
67
  var _useSelectReq = useSelectReq({
68
68
  options: options,
69
69
  manual: manual,
70
- fieldNames: fieldNames,
71
70
  request: request,
72
71
  serviceSearch: serviceSearch,
73
72
  showSearch: showSearch,
@@ -2,6 +2,7 @@ import type { SelectProps } from "antd";
2
2
  import type React from "react";
3
3
  import type { PromiseFnResult } from "../modal";
4
4
  import type { addFormatItemModal, argsFn, DispatchModal } from "../Form/modal";
5
+ import { CollapseProps } from "antd/lib/collapse/Collapse";
5
6
  export type OptionType = Record<string, any>;
6
7
  export type RenderFn = (data: OptionType) => React.ReactNode;
7
8
  interface ModeConfigItem {
@@ -21,7 +22,7 @@ export interface OptionsPageResultModal {
21
22
  total: number;
22
23
  }
23
24
  export type OptionsDataType = OptionsListType | OptionsPageResultModal;
24
- export interface HSelectProps extends Omit<SelectProps, "options" | "placeholder"> {
25
+ export interface HSelectProps extends Omit<SelectProps, "options" | "placeholder" | "onChange"> {
25
26
  style?: React.CSSProperties;
26
27
  request?: PromiseFnResult<any, OptionsDataType>;
27
28
  manual?: boolean;
@@ -38,10 +39,15 @@ export interface HSelectProps extends Omit<SelectProps, "options" | "placeholder
38
39
  isList?: boolean;
39
40
  addonBefore?: React.ReactNode;
40
41
  addonAfter?: React.ReactNode;
42
+ onChange?: (value: any, opts?: OptionType[] | OptionType) => void;
41
43
  }
42
44
  export interface FilterDataModal {
43
45
  value: any;
44
46
  index: number;
45
47
  }
48
+ export interface HTagSelectProps extends HSelectProps {
49
+ title?: React.ReactNode;
50
+ collapseProps?: CollapseProps;
51
+ }
46
52
  export type PartialHSelectProps = Partial<HSelectProps>;
47
53
  export {};
package/es/index.css CHANGED
@@ -42,6 +42,18 @@
42
42
  border-top-right-radius: 0 !important;
43
43
  border-bottom-right-radius: 0 !important;
44
44
  }
45
+ .ant-hw-tag-select {
46
+ width: 100%;
47
+ }
48
+ .ant-hw-tag-select .ant-collapse-content-box {
49
+ padding: 0px 40px !important;
50
+ }
51
+ .ant-hw-tag-select .ant-hw-tag-select {
52
+ cursor: pointer;
53
+ }
54
+ .ant-hw-tag-select .ant-collapse-header {
55
+ padding: 5px 16px !important;
56
+ }
45
57
  .ant-hw-form-item-colon:after {
46
58
  position: relative;
47
59
  top: -0.5px;
@@ -167,6 +179,9 @@
167
179
  display: -ms-flexbox;
168
180
  display: flex;
169
181
  }
182
+ .ant-hw-tag-select .ant-hw-tag-item {
183
+ cursor: pointer;
184
+ }
170
185
  .ant-hw-input-group .ant-hw-input-group-disabled {
171
186
  background-color: #f5f5f5;
172
187
  }
package/es/index.d.ts CHANGED
@@ -22,7 +22,7 @@ export declare const HRadioGroup: ({ value, options, onChange, fieldNames: props
22
22
  export declare const HTimePicker: import("react").ForwardRefExoticComponent<import("./Form/modal").HFormItemProps & import("react").RefAttributes<any>>;
23
23
  export declare const HInputNumber: ({ style, ...props }: import("antd").InputNumberProps) => JSX.Element;
24
24
  export declare const HPageHandler: import("react").FC<import("./PageHandler/modal").IHPageHandler<any>>;
25
- export declare const HTextArea: ({ autoSize, bordered, className, ...props }: import("./TextArea").HTextAreaProps) => JSX.Element;
25
+ export declare const HTextArea: ({ autoSize, bordered, className, style, ...props }: import("./TextArea").HTextAreaProps) => JSX.Element;
26
26
  export declare const HColorInput: ({ value, onChange, defaultColor, ...props }: import("./Input/modal").HInputProps) => JSX.Element;
27
27
  export declare const HModalForm: import("react").FC<import("./DialogForm/modal").DialogFormProps<any, any>>;
28
28
  export declare const HDrawerForm: import("react").FC<import("./DialogForm/modal").DialogFormProps<any, any>>;
@@ -31,3 +31,4 @@ export declare const HVerificationCodeInput: import("react").ForwardRefExoticCom
31
31
  export declare const HTrimInput: import("react").ForwardRefExoticComponent<import("./Form/modal").HFormItemProps & import("react").RefAttributes<any>>;
32
32
  export declare const HTrimTextArea: import("react").ForwardRefExoticComponent<import("./Form/modal").HFormItemProps & import("react").RefAttributes<any>>;
33
33
  export declare const HInputNumberGroup: import("react").ForwardRefExoticComponent<import("./Form/modal").HFormItemProps & import("react").RefAttributes<any>>;
34
+ export declare const HTagSelect: import("react").ForwardRefExoticComponent<import("./Form/modal").HFormItemProps & import("react").RefAttributes<any>>;
package/es/index.js CHANGED
@@ -36,6 +36,7 @@ var HVerificationCodeInput = componentConfig.verificationCodeInput;
36
36
  var HTrimInput = componentConfig.trimInput;
37
37
  var HTrimTextArea = componentConfig.trimTextArea;
38
38
  var HInputNumberGroup = componentConfig.inputNumberGroup.Component;
39
+ var HTagSelect = componentConfig.tagSelect;
39
40
 
40
- export { HButtonInput, HCascader, HCheckBox, HCheckboxGroup, HColorInput, HDatePicker, HDrawerForm, HInput, HInputNumber, HInputNumberGroup, HModalForm, HPageHandler, HRadioGroup, HRangePicker, HRichEditor, HSelect, HSelectInput, HSwitch, HTextArea, HTimePicker, HTrimInput, HTrimTextArea, HUpload, HUrlUpload, HVerificationCodeInput };
41
+ export { HButtonInput, HCascader, HCheckBox, HCheckboxGroup, HColorInput, HDatePicker, HDrawerForm, HInput, HInputNumber, HInputNumberGroup, HModalForm, HPageHandler, HRadioGroup, HRangePicker, HRichEditor, HSelect, HSelectInput, HSwitch, HTagSelect, HTextArea, HTimePicker, HTrimInput, HTrimTextArea, HUpload, HUrlUpload, HVerificationCodeInput };
41
42
  // powered by hdj
@@ -17,5 +17,5 @@ export declare const useSub: ({ request, onFinish }: Partial<DialogFormProps>) =
17
17
  interface FooterRenderParamsModal extends Omit<DialogFormProps, "configData"> {
18
18
  onOk: VoidFunction;
19
19
  }
20
- export declare const useFooterRender: ({ footer, confirmLoading, dialogForm, params, onOk }: FooterRenderParamsModal) => any;
20
+ export declare const useFooterRender: ({ footer, confirmLoading, dialogForm, params, onOk, }: FooterRenderParamsModal) => any;
21
21
  export {};
@@ -25,7 +25,7 @@ declare const componentConfig: {
25
25
  placeholder: ({ label }: import("./modal").HItemProps) => string;
26
26
  };
27
27
  submit: ({ position, reset, extraList, ...props }: import("../Submit").ISubmitProps) => JSX.Element;
28
- textArea: ({ autoSize, bordered, className, ...props }: import("../TextArea").HTextAreaProps) => JSX.Element;
28
+ textArea: ({ autoSize, bordered, className, style, ...props }: import("../TextArea").HTextAreaProps) => JSX.Element;
29
29
  colorInput: ({ value, onChange, defaultColor, ...props }: import("../Input/modal").HInputProps) => JSX.Element;
30
30
  cascader: ({ request, options, fieldNames: propsFieldNames, ...props }: import("../Cascader").HCascaderProps) => JSX.Element;
31
31
  verificationCodeInput: import("react").ForwardRefExoticComponent<import("./modal").HFormItemProps & import("react").RefAttributes<any>>;
@@ -38,5 +38,6 @@ declare const componentConfig: {
38
38
  treeSelect: ({ request, onlyCheckChild, multiple, treeCheckable, treeData, fieldNames, ...props }: import("../Select/TreeSelect").HTreeSelectProps) => JSX.Element;
39
39
  text: ({ value, addonBefore, addonAfter, size, ...props }: import("../Text").HFormTextProps) => JSX.Element;
40
40
  richEditor: import("react").ForwardRefExoticComponent<import("./modal").HFormItemProps & import("react").RefAttributes<any>>;
41
+ tagSelect: import("react").ForwardRefExoticComponent<import("./modal").HFormItemProps & import("react").RefAttributes<any>>;
41
42
  };
42
43
  export default componentConfig;
@@ -27,6 +27,7 @@ var TrimTextArea = require('../TextArea/TrimTextArea.js');
27
27
  var InputNumberGroup = require('../Input/InputNumberGroup.js');
28
28
  var index$e = require('../Text/index.js');
29
29
  var index$f = require('../RichEditor/index.js');
30
+ var index$g = require('../Select/TagSelect/index.js');
30
31
 
31
32
  var placeholderConfig = {
32
33
  inputType: ["input", "inputNumber", "selectInput", "buttonInput", "verificationCodeInput", "trimInput", "urlUpload", "textArea", "richEditor"],
@@ -57,7 +58,8 @@ var componentConfig = {
57
58
  inputNumberGroup: InputNumberGroup.default,
58
59
  treeSelect: TreeSelect.default,
59
60
  text: index$e.default,
60
- richEditor: index$f.default
61
+ richEditor: index$f.default,
62
+ tagSelect: index$g.default
61
63
  };
62
64
 
63
65
  exports.default = componentConfig;
@@ -200,6 +200,16 @@ var useHForm = (function () {
200
200
  });
201
201
  form.setFieldsValue(_objectSpread(_objectSpread(_objectSpread({}, newVale), initSaveValue), values));
202
202
  },
203
+ resetFieldsValues: function resetFieldsValues() {
204
+ var values = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
205
+ var oldValue = form.getFieldsValue(true);
206
+ var keys = Object.keys(oldValue);
207
+ var newVale = {};
208
+ keys.forEach(function (key) {
209
+ newVale[key] = undefined;
210
+ });
211
+ form.setFieldsValue(_objectSpread(_objectSpread({}, newVale), values));
212
+ },
203
213
  clear: function clear() {
204
214
  form.resetFields();
205
215
  isLoading = false;
@@ -149,6 +149,7 @@ export interface HFormInstance extends FormInstance {
149
149
  reload: PromiseFnResult;
150
150
  clear: VoidFunction;
151
151
  resetFieldsInitValue: (values?: Record<string, any>) => void;
152
+ resetFieldsValues: (values?: Record<string, any>) => void;
152
153
  clearFormat: (name: string) => void;
153
154
  inited: boolean;
154
155
  resetFormStatus: VoidFunction;
@@ -0,0 +1,7 @@
1
+ import { HTagSelectProps } from "../modal";
2
+ interface IContentProps extends HTagSelectProps {
3
+ error?: Error;
4
+ reload: VoidFunction;
5
+ }
6
+ declare const _default: ({ loading, value, options, onChange, fieldNames, error, reload }: IContentProps) => JSX.Element;
7
+ export default _default;
@@ -0,0 +1,93 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var jsxRuntime = require('react/jsx-runtime');
6
+ var index = require('../../hooks/index.js');
7
+ var antd = require('antd');
8
+ var hooks = require('./hooks.js');
9
+ var NotFoundContent = require('../components/NotFoundContent.js');
10
+
11
+ var ItemOption = function ItemOption(_ref) {
12
+ var options = _ref.options,
13
+ value = _ref.value,
14
+ onChange = _ref.onChange,
15
+ fieldNames = _ref.fieldNames;
16
+ var tagClassName = index.useClassName("hw-tag-item");
17
+ var _ref2 = fieldNames || {},
18
+ _ref2$label = _ref2.label,
19
+ labelKey = _ref2$label === void 0 ? "label" : _ref2$label,
20
+ _ref2$value = _ref2.value,
21
+ valueKey = _ref2$value === void 0 ? "value" : _ref2$value;
22
+ var _useChangeControl = hooks.useChangeControl({
23
+ options: options,
24
+ value: value,
25
+ onChange: onChange,
26
+ fieldNames: fieldNames
27
+ }),
28
+ change = _useChangeControl.change;
29
+ return jsxRuntime.jsx(antd.Row, {
30
+ gutter: [0, 8],
31
+ children: options === null || options === void 0 ? void 0 : options.map(function (item) {
32
+ var label = item[labelKey],
33
+ itemVal = item[valueKey];
34
+ var index = value === null || value === void 0 ? void 0 : value.indexOf(itemVal);
35
+ var checkedTag = index !== -1;
36
+ return jsxRuntime.jsx(antd.Tag, {
37
+ color: checkedTag ? "processing" : undefined,
38
+ className: tagClassName,
39
+ onClick: function onClick() {
40
+ change(itemVal);
41
+ },
42
+ children: label
43
+ }, itemVal);
44
+ })
45
+ });
46
+ };
47
+ var Content = (function (_ref3) {
48
+ var loading = _ref3.loading,
49
+ value = _ref3.value,
50
+ options = _ref3.options,
51
+ onChange = _ref3.onChange,
52
+ fieldNames = _ref3.fieldNames,
53
+ error = _ref3.error,
54
+ reload = _ref3.reload;
55
+ var len = (options === null || options === void 0 ? void 0 : options.length) || 0;
56
+ if (loading && len === 0) {
57
+ return jsxRuntime.jsxs(antd.Space, {
58
+ direction: "vertical",
59
+ style: {
60
+ width: "100%"
61
+ },
62
+ children: [jsxRuntime.jsx(antd.Skeleton.Button, {
63
+ active: true,
64
+ size: "small",
65
+ block: true
66
+ }), jsxRuntime.jsx(antd.Skeleton.Button, {
67
+ active: true,
68
+ size: "small",
69
+ block: true
70
+ })]
71
+ });
72
+ }
73
+ if (error && len === 0) {
74
+ return jsxRuntime.jsx(NotFoundContent.default, {
75
+ error: error,
76
+ reload: reload
77
+ });
78
+ }
79
+ if (len === 0) {
80
+ return jsxRuntime.jsx(antd.Empty, {
81
+ image: antd.Empty.PRESENTED_IMAGE_SIMPLE
82
+ });
83
+ }
84
+ return jsxRuntime.jsx(ItemOption, {
85
+ options: options,
86
+ value: value,
87
+ onChange: onChange,
88
+ fieldNames: fieldNames
89
+ });
90
+ });
91
+
92
+ exports.default = Content;
93
+ // powered by h
@@ -0,0 +1,10 @@
1
+ import { HTagSelectProps } from "@/components/Select/modal";
2
+ export declare const useTagControl: ({ value, options, title }: HTagSelectProps) => {
3
+ labelNode: {};
4
+ checked: boolean | undefined;
5
+ indeterminate: boolean | undefined;
6
+ };
7
+ export declare const useChangeControl: ({ options, value, onChange, fieldNames }: HTagSelectProps) => {
8
+ change: (val: any) => void;
9
+ allCheck: (e: any) => void | undefined;
10
+ };