@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
@@ -0,0 +1,99 @@
1
+ 'use strict';
2
+
3
+ var _toConsumableArray = require('@babel/runtime-corejs3/helpers/toConsumableArray');
4
+ var React = require('react');
5
+
6
+ var useTagControl = function useTagControl(_ref) {
7
+ var value = _ref.value,
8
+ options = _ref.options,
9
+ title = _ref.title;
10
+ var _useMemo = React.useMemo(function () {
11
+ var len = value === null || value === void 0 ? void 0 : value.length;
12
+ var opLen = options === null || options === void 0 ? void 0 : options.length;
13
+ if (!opLen) {
14
+ return {
15
+ checked: false
16
+ };
17
+ }
18
+ if (len === opLen) {
19
+ return {
20
+ checked: true
21
+ };
22
+ }
23
+ return {
24
+ indeterminate: !!len
25
+ };
26
+ }, [value, options]),
27
+ checked = _useMemo.checked,
28
+ indeterminate = _useMemo.indeterminate;
29
+ var labelNode = React.useMemo(function () {
30
+ if (title) {
31
+ return title;
32
+ }
33
+ if (checked) {
34
+ return "取消";
35
+ }
36
+ return "全选";
37
+ }, [title, checked, indeterminate]);
38
+ return {
39
+ labelNode: labelNode,
40
+ checked: checked,
41
+ indeterminate: indeterminate
42
+ };
43
+ };
44
+ var useChangeControl = function useChangeControl(_ref2) {
45
+ var options = _ref2.options,
46
+ value = _ref2.value,
47
+ onChange = _ref2.onChange,
48
+ fieldNames = _ref2.fieldNames;
49
+ var _ref3 = fieldNames || {},
50
+ _ref3$value = _ref3.value,
51
+ valueKey = _ref3$value === void 0 ? "value" : _ref3$value;
52
+ var optsNk = function optsNk(newVal) {
53
+ var newOpts = [];
54
+ newVal === null || newVal === void 0 || newVal.forEach(function (itemVal) {
55
+ var index = options === null || options === void 0 ? void 0 : options.findIndex(function (item) {
56
+ return itemVal === item[valueKey];
57
+ });
58
+ if (typeof index !== "undefined") {
59
+ newOpts.push(options === null || options === void 0 ? void 0 : options[index]);
60
+ }
61
+ });
62
+ return newOpts;
63
+ };
64
+ var checkedVal = function checkedVal(val) {
65
+ var newVal = _toConsumableArray(value);
66
+ newVal.push(val);
67
+ onChange === null || onChange === void 0 || onChange(newVal, optsNk(newVal));
68
+ };
69
+ var removeVal = function removeVal(index) {
70
+ var newVal = _toConsumableArray(value);
71
+ newVal.splice(index, 1);
72
+ onChange === null || onChange === void 0 || onChange(newVal, optsNk(newVal));
73
+ };
74
+ var change = function change(val) {
75
+ var index = value === null || value === void 0 ? void 0 : value.indexOf(val);
76
+ var checked = index === -1;
77
+ if (checked) {
78
+ return checkedVal(val);
79
+ }
80
+ return removeVal(index);
81
+ };
82
+ var allCheck = function allCheck(e) {
83
+ if (!e.target.checked) {
84
+ return onChange === null || onChange === void 0 ? void 0 : onChange([], []);
85
+ }
86
+ var newVal = options === null || options === void 0 ? void 0 : options.map(function (item) {
87
+ return item[valueKey];
88
+ });
89
+ return onChange === null || onChange === void 0 ? void 0 : onChange(newVal, options);
90
+ };
91
+ return {
92
+ change: change,
93
+ allCheck: allCheck
94
+ };
95
+ };
96
+
97
+ exports.useChangeControl = useChangeControl;
98
+ exports.useTagControl = useTagControl;
99
+ // powered by h
@@ -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,103 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
6
+ var _objectWithoutProperties = require('@babel/runtime-corejs3/helpers/objectWithoutProperties');
7
+ var jsxRuntime = require('react/jsx-runtime');
8
+ var antd = require('antd');
9
+ var index = require('../../hooks/index.js');
10
+ var norHooks = require('../hooks/norHooks.js');
11
+ var Content = require('./Content.js');
12
+ var hooks = require('./hooks.js');
13
+ var HFormConnect = require('../../Form/HFormConnect.js');
14
+
15
+ var _excluded = ["children"];
16
+ 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; }
17
+ 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; }
18
+ var Panel = antd.Collapse.Panel;
19
+ var ItemTitle = function ItemTitle(_ref) {
20
+ var children = _ref.children,
21
+ props = _objectWithoutProperties(_ref, _excluded);
22
+ return jsxRuntime.jsx("div", {
23
+ onClick: function onClick(event) {
24
+ event.stopPropagation();
25
+ },
26
+ children: jsxRuntime.jsx(antd.Checkbox, _objectSpread(_objectSpread({}, props), {}, {
27
+ children: children
28
+ }))
29
+ });
30
+ };
31
+ var Index = function Index(_ref2) {
32
+ var options = _ref2.options,
33
+ _ref2$value = _ref2.value,
34
+ value = _ref2$value === void 0 ? [] : _ref2$value,
35
+ onChange = _ref2.onChange,
36
+ dispatch = _ref2.dispatch,
37
+ propsFieldNames = _ref2.fieldNames,
38
+ request = _ref2.request,
39
+ title = _ref2.title,
40
+ manual = _ref2.manual,
41
+ _ref2$className = _ref2.className,
42
+ className = _ref2$className === void 0 ? "" : _ref2$className,
43
+ collapseProps = _ref2.collapseProps,
44
+ addDispatchListener = _ref2.addDispatchListener;
45
+ var collapseClassName = index.useClassName("hw-tag-select");
46
+ var _useMatchConfigProps = index.useMatchConfigProps({
47
+ fieldNames: propsFieldNames
48
+ }),
49
+ fieldNames = _useMatchConfigProps.fieldNames;
50
+ var _useSelectReq = norHooks.useSelectReq({
51
+ options: options,
52
+ manual: manual,
53
+ request: request,
54
+ dispatch: dispatch
55
+ }),
56
+ loading = _useSelectReq.loading,
57
+ resultData = _useSelectReq.data,
58
+ error = _useSelectReq.error,
59
+ reload = _useSelectReq.reload;
60
+ var _useTagControl = hooks.useTagControl({
61
+ value: value,
62
+ options: resultData,
63
+ title: title
64
+ }),
65
+ labelNode = _useTagControl.labelNode,
66
+ checked = _useTagControl.checked,
67
+ indeterminate = _useTagControl.indeterminate;
68
+ var _useChangeControl = hooks.useChangeControl({
69
+ value: value,
70
+ options: resultData,
71
+ onChange: onChange,
72
+ fieldNames: fieldNames
73
+ }),
74
+ allCheck = _useChangeControl.allCheck;
75
+ addDispatchListener === null || addDispatchListener === void 0 || addDispatchListener("reload", reload);
76
+ return jsxRuntime.jsx(antd.Collapse, _objectSpread(_objectSpread({
77
+ bordered: false,
78
+ ghost: true
79
+ }, collapseProps), {}, {
80
+ className: "".concat(collapseClassName, " ").concat(className),
81
+ children: jsxRuntime.jsx(Panel, {
82
+ header: jsxRuntime.jsx(ItemTitle, {
83
+ indeterminate: indeterminate,
84
+ checked: checked,
85
+ onChange: allCheck,
86
+ children: labelNode
87
+ }),
88
+ children: jsxRuntime.jsx(Content.default, {
89
+ loading: loading,
90
+ options: resultData,
91
+ value: value,
92
+ error: error,
93
+ onChange: onChange,
94
+ reload: reload,
95
+ fieldNames: fieldNames
96
+ })
97
+ }, "1")
98
+ }));
99
+ };
100
+ var HTagSelect = HFormConnect.default(Index);
101
+
102
+ exports.default = HTagSelect;
103
+ // powered by h
@@ -70,7 +70,6 @@ var Index = function Index(_ref) {
70
70
  var _useSelectReq = norHooks.useSelectReq({
71
71
  options: options,
72
72
  manual: manual,
73
- fieldNames: fieldNames,
74
73
  request: request,
75
74
  serviceSearch: serviceSearch,
76
75
  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/lib/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/lib/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/lib/index.js CHANGED
@@ -37,6 +37,7 @@ var HVerificationCodeInput = config.default.verificationCodeInput;
37
37
  var HTrimInput = config.default.trimInput;
38
38
  var HTrimTextArea = config.default.trimTextArea;
39
39
  var HInputNumberGroup = config.default.inputNumberGroup.Component;
40
+ var HTagSelect = config.default.tagSelect;
40
41
 
41
42
  exports.HForm = index.default;
42
43
  exports.useHForm = useHForm.default;
@@ -63,6 +64,7 @@ exports.HRichEditor = HRichEditor;
63
64
  exports.HSelect = HSelect;
64
65
  exports.HSelectInput = HSelectInput;
65
66
  exports.HSwitch = HSwitch;
67
+ exports.HTagSelect = HTagSelect;
66
68
  exports.HTextArea = HTextArea;
67
69
  exports.HTimePicker = HTimePicker;
68
70
  exports.HTrimInput = HTrimInput;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hw-component/form",
3
- "version": "1.9.85",
3
+ "version": "1.9.87",
4
4
  "description": "基于antd二次开发",
5
5
  "repository": {
6
6
  "type": "git",
@@ -4,41 +4,41 @@ import React from "react";
4
4
  import { useRequest } from "ahooks";
5
5
 
6
6
  export interface BtnProps<R = any> extends ButtonProps {
7
- request?: () => Promise<any>;
8
- onSuccess?: (data: R) => void;
7
+ request?: () => Promise<any>;
8
+ onSuccess?: (data: R) => void;
9
9
  }
10
10
  export default ({
11
- loading,
12
- request,
13
- children,
14
- onClick,
15
- style,
16
- type,
17
- onSuccess,
18
- ...props
19
- }:BtnProps) => {
20
- const { run, loading: reqLoading } = useRequest(
21
- () => {
22
- return request?.();
23
- },
24
- { manual: true, onSuccess }
25
- );
26
- const click = (e) => {
27
- if (request) {
28
- run();
29
- return;
30
- }
31
- onClick?.(e);
32
- };
33
- return (
34
- <Button
35
- {...props}
36
- type={type}
37
- style={{ borderRadius: 4, ...style }}
38
- onClick={click}
39
- loading={loading || reqLoading}
40
- >
41
- {children}
42
- </Button>
43
- );
44
- };
11
+ loading,
12
+ request,
13
+ children,
14
+ onClick,
15
+ style,
16
+ type,
17
+ onSuccess,
18
+ ...props
19
+ }: BtnProps) => {
20
+ const { run, loading: reqLoading } = useRequest(
21
+ () => {
22
+ return request?.();
23
+ },
24
+ { manual: true, onSuccess }
25
+ );
26
+ const click = (e) => {
27
+ if (request) {
28
+ run();
29
+ return;
30
+ }
31
+ onClick?.(e);
32
+ };
33
+ return (
34
+ <Button
35
+ {...props}
36
+ type={type}
37
+ style={{ borderRadius: 4, ...style }}
38
+ onClick={click}
39
+ loading={loading || reqLoading}
40
+ >
41
+ {children}
42
+ </Button>
43
+ );
44
+ };
@@ -20,7 +20,7 @@ const Index = ({
20
20
  }: HCheckboxProps) => {
21
21
  const { valueCheckMap: resultValueCheckMap, fieldNames: resultFieldNames } =
22
22
  useMatchConfigProps({ fieldNames, valueCheckMap: valueMap }); //匹配全局
23
- const checkOptions:Record<string, any>[]|undefined = useChangeOptions({
23
+ const checkOptions: Record<string, any>[] | undefined = useChangeOptions({
24
24
  options,
25
25
  fieldNames: resultFieldNames,
26
26
  });
@@ -63,9 +63,10 @@ const Index = ({
63
63
  return (
64
64
  <Space direction={direction} wrap={wrap}>
65
65
  {checkOptions?.map((item) => {
66
- const { label, value: itemVal ,disabled:itemDisabled} = item;
66
+ const { label, value: itemVal, disabled: itemDisabled } = item;
67
67
  const checked = val[itemVal];
68
- const nDis=typeof itemDisabled==="undefined"?disabled:itemDisabled;
68
+ const nDis =
69
+ typeof itemDisabled === "undefined" ? disabled : itemDisabled;
69
70
  return (
70
71
  <Checkbox
71
72
  value={checked}
@@ -35,7 +35,7 @@ const Index: React.FC<DialogFormProps> = ({
35
35
  autoClear = true,
36
36
  contentRender,
37
37
  children,
38
- destroyOnClose=true,
38
+ destroyOnClose = true,
39
39
  ...props
40
40
  }: DialogFormProps) => {
41
41
  const currentForm = useCurrentForm(dialogForm);
@@ -67,29 +67,29 @@ const Index: React.FC<DialogFormProps> = ({
67
67
  setModalVisible(false);
68
68
  };
69
69
  const { loading, run } = useSub({ request, onFinish });
70
- const finish=async (values, subParams) => {
70
+ const finish = async (values, subParams) => {
71
71
  const result = await run(values, subParams);
72
72
  const close = onOk?.(result, subParams);
73
73
  if (close === false) {
74
74
  return;
75
75
  }
76
76
  cancel();
77
- }
78
- const footerOnOk=()=>{
79
- if (modalFormData){
77
+ };
78
+ const footerOnOk = () => {
79
+ if (modalFormData) {
80
80
  dialogForm?.submit();
81
81
  return;
82
82
  }
83
- finish({},formParams);
84
- }
83
+ finish({}, formParams);
84
+ };
85
85
  const defaultFooter = useFooterRender({
86
86
  dialogForm,
87
87
  footer,
88
88
  confirmLoading: loading,
89
89
  params: formParams,
90
- onOk :footerOnOk
90
+ onOk: footerOnOk,
91
91
  });
92
- const node = modalFormData&&(
92
+ const node = modalFormData && (
93
93
  <HForm
94
94
  configData={modalFormData}
95
95
  initialValues={initValue}
@@ -102,13 +102,13 @@ const Index: React.FC<DialogFormProps> = ({
102
102
  labelWidth={labelWidth}
103
103
  />
104
104
  );
105
- const selfAfterClose=()=>{
106
- if (autoClear){
105
+ const selfAfterClose = () => {
106
+ if (autoClear) {
107
107
  dialogForm?.clear();
108
108
  return;
109
109
  }
110
110
  dialogForm?.resetFormStatus();
111
- }
111
+ };
112
112
  return (
113
113
  <Drawer
114
114
  visible={modalVisible}
@@ -116,7 +116,7 @@ const Index: React.FC<DialogFormProps> = ({
116
116
  {...props}
117
117
  onClose={cancel}
118
118
  afterVisibleChange={(changeVisible) => {
119
- if (changeVisible){
119
+ if (changeVisible) {
120
120
  return;
121
121
  }
122
122
  selfAfterClose();
@@ -30,7 +30,7 @@ const Index: React.FC<DialogFormProps> = ({
30
30
  contentRender,
31
31
  footer,
32
32
  children,
33
- destroyOnClose=true,
33
+ destroyOnClose = true,
34
34
  ...props
35
35
  }) => {
36
36
  const currentForm = useCurrentForm(dialogForm);
@@ -52,7 +52,7 @@ const Index: React.FC<DialogFormProps> = ({
52
52
  params,
53
53
  title,
54
54
  onCancel,
55
- autoClear
55
+ autoClear,
56
56
  });
57
57
  const cancel = () => {
58
58
  saveOldParams();
@@ -62,22 +62,22 @@ const Index: React.FC<DialogFormProps> = ({
62
62
  setModalVisible(false);
63
63
  };
64
64
  const { loading, run } = useSub({ request, onFinish });
65
- const finish=async (values, outParams)=>{
65
+ const finish = async (values, outParams) => {
66
66
  const result = await run(values, outParams);
67
67
  const close = onOk?.(result, outParams);
68
68
  if (close === false) {
69
69
  return;
70
70
  }
71
71
  cancel();
72
- }
73
- const footerOnOk=()=>{
74
- if (modalFormData){
75
- dialogForm?.submit();
76
- return;
77
- }
78
- finish({},formParams);
79
- }
80
- const node = modalFormData&&(
72
+ };
73
+ const footerOnOk = () => {
74
+ if (modalFormData) {
75
+ dialogForm?.submit();
76
+ return;
77
+ }
78
+ finish({}, formParams);
79
+ };
80
+ const node = modalFormData && (
81
81
  <HForm
82
82
  configData={modalFormData}
83
83
  initialValues={initValue}
@@ -94,15 +94,15 @@ const Index: React.FC<DialogFormProps> = ({
94
94
  footer,
95
95
  confirmLoading: loading,
96
96
  params: formParams,
97
- onOk:footerOnOk
97
+ onOk: footerOnOk,
98
98
  });
99
- const selfAfterClose=()=>{
100
- if (autoClear){
99
+ const selfAfterClose = () => {
100
+ if (autoClear) {
101
101
  dialogForm?.clear();
102
102
  return;
103
103
  }
104
104
  dialogForm?.resetFormStatus();
105
- }
105
+ };
106
106
  return (
107
107
  <Modal
108
108
  title={modalTitle}
@@ -119,8 +119,8 @@ export const useSub = ({ request, onFinish }: Partial<DialogFormProps>) => {
119
119
  { manual: true }
120
120
  );
121
121
  };
122
- interface FooterRenderParamsModal extends Omit<DialogFormProps, "configData">{
123
- onOk:VoidFunction;
122
+ interface FooterRenderParamsModal extends Omit<DialogFormProps, "configData"> {
123
+ onOk: VoidFunction;
124
124
  }
125
125
 
126
126
  export const useFooterRender = ({
@@ -128,7 +128,7 @@ export const useFooterRender = ({
128
128
  confirmLoading,
129
129
  dialogForm,
130
130
  params,
131
- onOk
131
+ onOk,
132
132
  }: FooterRenderParamsModal) => {
133
133
  if (footer === null) {
134
134
  return null;
@@ -38,10 +38,16 @@ export type FooterRender = (
38
38
  export interface DialogFormProps<P = any, T = any>
39
39
  extends Omit<
40
40
  RootProps,
41
- "onFinish" | "onCancel" | "onOk" | "infoRequest" | "title" | "footer"|"configData"
41
+ | "onFinish"
42
+ | "onCancel"
43
+ | "onOk"
44
+ | "infoRequest"
45
+ | "title"
46
+ | "footer"
47
+ | "configData"
42
48
  > {
43
49
  dialogForm?: HDialogFormInstance;
44
- configData?:HFormProps["configData"];
50
+ configData?: HFormProps["configData"];
45
51
  onFinish?: (values: T, params: P) => Promise<any>;
46
52
  onCancel?: VoidFunction;
47
53
  onOk?: (data: T, params: P) => boolean | void;
@@ -1,13 +1,18 @@
1
1
  import { useFormContext } from "./Context";
2
2
  import React from "react";
3
- import type { addFormatItemModal ,HFormItemProps,ConnectResultProps,argsFn} from "./modal";
4
- import {formatMaker} from "./hooks/useAddFormat";
3
+ import type {
4
+ addFormatItemModal,
5
+ HFormItemProps,
6
+ ConnectResultProps,
7
+ argsFn,
8
+ } from "./modal";
9
+ import { formatMaker } from "./hooks/useAddFormat";
5
10
 
6
11
  export default (
7
12
  component:
8
13
  | React.FunctionComponent
9
14
  | React.ComponentClass
10
- | React.ForwardRefRenderFunction<any, any>,
15
+ | React.ForwardRefRenderFunction<any, any>
11
16
  ) => {
12
17
  const Index: React.ForwardRefRenderFunction<any, HFormItemProps> = (
13
18
  props: HFormItemProps,
@@ -5,10 +5,10 @@ export default () => {
5
5
  const { form } = useFormContext();
6
6
  useEffect(() => {
7
7
  form.initValues();
8
- form.inited=true;
9
- return ()=>{
10
- form.inited=false;
11
- }
8
+ form.inited = true;
9
+ return () => {
10
+ form.inited = false;
11
+ };
12
12
  }, []);
13
13
  return <></>;
14
14
  };
@@ -23,7 +23,7 @@ import TrimTextArea from "../TextArea/TrimTextArea";
23
23
  import HInputNumberGroup from "../Input/InputNumberGroup";
24
24
  import HText from "../Text";
25
25
  import HRichEditor from "../RichEditor";
26
-
26
+ import HTagSelect from '../Select/TagSelect';
27
27
  export const placeholderConfig = {
28
28
  inputType: [
29
29
  "input",
@@ -70,6 +70,7 @@ const componentConfig = {
70
70
  treeSelect: HTreeSelect,
71
71
  text: HText,
72
72
  richEditor: HRichEditor,
73
+ tagSelect:HTagSelect
73
74
  };
74
75
 
75
76
  export default componentConfig;
@@ -129,6 +129,4 @@ export const useValuesChange = ({
129
129
  };
130
130
  };
131
131
 
132
- export const useAddFormat=()=>{
133
-
134
- }
132
+ export const useAddFormat = () => {};