@hw-component/form 0.0.8-beta-v6 → 0.0.8-beta-v8

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 (49) hide show
  1. package/es/DialogForm/DrawerForm/index.d.ts +1 -1
  2. package/es/DialogForm/DrawerForm/index.js +42 -40
  3. package/es/DialogForm/ModalForm.d.ts +1 -1
  4. package/es/DialogForm/ModalForm.js +41 -39
  5. package/es/DialogForm/modal.d.ts +2 -0
  6. package/es/Form/config.d.ts +6 -4
  7. package/es/Form/config.js +11 -7
  8. package/es/Input/TrimInput.d.ts +3 -0
  9. package/es/Input/TrimInput.js +43 -0
  10. package/es/Input/VerificationCodeInput.d.ts +3 -3
  11. package/es/Input/VerificationCodeInput.js +2 -2
  12. package/es/Input/modal.d.ts +1 -0
  13. package/es/Switch/index.d.ts +4 -2
  14. package/es/Switch/index.js +28 -4
  15. package/es/TextArea/TrimTextArea.d.ts +3 -0
  16. package/es/TextArea/TrimTextArea.js +43 -0
  17. package/es/index.d.ts +8 -6
  18. package/es/index.js +3 -1
  19. package/lib/DialogForm/DrawerForm/index.d.ts +1 -1
  20. package/lib/DialogForm/DrawerForm/index.js +42 -40
  21. package/lib/DialogForm/ModalForm.d.ts +1 -1
  22. package/lib/DialogForm/ModalForm.js +41 -39
  23. package/lib/DialogForm/modal.d.ts +2 -0
  24. package/lib/Form/config.d.ts +6 -4
  25. package/lib/Form/config.js +6 -2
  26. package/lib/Input/TrimInput.d.ts +3 -0
  27. package/lib/Input/TrimInput.js +46 -0
  28. package/lib/Input/VerificationCodeInput.d.ts +3 -3
  29. package/lib/Input/VerificationCodeInput.js +2 -2
  30. package/lib/Input/modal.d.ts +1 -0
  31. package/lib/Switch/index.d.ts +4 -2
  32. package/lib/Switch/index.js +28 -4
  33. package/lib/TextArea/TrimTextArea.d.ts +3 -0
  34. package/lib/TextArea/TrimTextArea.js +46 -0
  35. package/lib/index.d.ts +8 -6
  36. package/lib/index.js +4 -0
  37. package/package.json +1 -1
  38. package/src/components/DialogForm/DrawerForm/index.tsx +22 -18
  39. package/src/components/DialogForm/ModalForm.tsx +21 -17
  40. package/src/components/DialogForm/modal.ts +5 -0
  41. package/src/components/Form/config.ts +8 -3
  42. package/src/components/Input/TrimInput.tsx +26 -0
  43. package/src/components/Input/VerificationCodeInput.tsx +4 -4
  44. package/src/components/Input/modal.ts +1 -0
  45. package/src/components/Switch/index.tsx +27 -1
  46. package/src/components/TextArea/TrimTextArea.tsx +30 -0
  47. package/src/components/index.tsx +5 -0
  48. package/src/pages/Form/index.tsx +20 -0
  49. package/src/pages/ModalForm/index.tsx +8 -0
@@ -1,3 +1,3 @@
1
1
  import type { DialogFormProps } from "../modal";
2
- declare const _default: ({ visible, title, onCancel, configData, infoRequest, request, afterClose, dialogForm, closable, initialValues, labelWidth, onOk, onFinish, size, form, footer, params, onValuesChange, autoClear, ...props }: DialogFormProps) => JSX.Element;
2
+ declare const _default: ({ visible, title, onCancel, configData, infoRequest, request, afterClose, dialogForm, closable, initialValues, labelWidth, onOk, onFinish, size, form, footer, params, onValuesChange, autoClear, contentRender, ...props }: DialogFormProps) => JSX.Element;
3
3
  export default _default;
@@ -18,7 +18,7 @@ import Title from './Title.js';
18
18
  import Footer from './Footer.js';
19
19
  import Index, { useFormConfigContext } from '../../Form/Context/FormConfigProvider.js';
20
20
 
21
- var _excluded = ["visible", "title", "onCancel", "configData", "infoRequest", "request", "afterClose", "dialogForm", "closable", "initialValues", "labelWidth", "onOk", "onFinish", "size", "form", "footer", "params", "onValuesChange", "autoClear"];
21
+ var _excluded = ["visible", "title", "onCancel", "configData", "infoRequest", "request", "afterClose", "dialogForm", "closable", "initialValues", "labelWidth", "onOk", "onFinish", "size", "form", "footer", "params", "onValuesChange", "autoClear", "contentRender"];
22
22
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
23
23
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
24
24
  var DrawerForm = (function (_ref) {
@@ -43,6 +43,7 @@ var DrawerForm = (function (_ref) {
43
43
  onValuesChange = _ref.onValuesChange,
44
44
  _ref$autoClear = _ref.autoClear,
45
45
  autoClear = _ref$autoClear === void 0 ? true : _ref$autoClear,
46
+ contentRender = _ref.contentRender,
46
47
  props = _objectWithoutProperties(_ref, _excluded);
47
48
  var currentForm = useCurrentForm(dialogForm);
48
49
  var providerConfig = useFormConfigContext();
@@ -86,6 +87,45 @@ var DrawerForm = (function (_ref) {
86
87
  confirmLoading: loading
87
88
  });
88
89
  };
90
+ var node = jsx(HForm, _objectSpread(_objectSpread({
91
+ configData: modalFormData,
92
+ initialValues: initValue,
93
+ onValuesChange: onValuesChange
94
+ }, props), {}, {
95
+ form: currentForm,
96
+ params: formParams,
97
+ onFinish: function () {
98
+ var _onFinish = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(values, subParams) {
99
+ var result, close;
100
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
101
+ while (1) switch (_context.prev = _context.next) {
102
+ case 0:
103
+ _context.next = 2;
104
+ return run(values, subParams);
105
+ case 2:
106
+ result = _context.sent;
107
+ close = onOk === null || onOk === void 0 ? void 0 : onOk(result, subParams);
108
+ if (!(close === false)) {
109
+ _context.next = 6;
110
+ break;
111
+ }
112
+ return _context.abrupt("return");
113
+ case 6:
114
+ cancel();
115
+ case 7:
116
+ case "end":
117
+ return _context.stop();
118
+ }
119
+ }, _callee);
120
+ }));
121
+ function onFinish(_x, _x2) {
122
+ return _onFinish.apply(this, arguments);
123
+ }
124
+ return onFinish;
125
+ }(),
126
+ infoRequest: infoRequest,
127
+ labelWidth: labelWidth
128
+ }));
89
129
  return jsx(Drawer, _objectSpread(_objectSpread({
90
130
  visible: modalVisible,
91
131
  title: jsx(Title, {
@@ -99,45 +139,7 @@ var DrawerForm = (function (_ref) {
99
139
  destroyOnClose: true,
100
140
  footer: footerComponent(),
101
141
  children: jsx(Index, _objectSpread(_objectSpread({}, providerConfig), {}, {
102
- children: jsx(HForm, _objectSpread(_objectSpread({
103
- configData: modalFormData,
104
- initialValues: initValue,
105
- onValuesChange: onValuesChange
106
- }, props), {}, {
107
- form: currentForm,
108
- params: formParams,
109
- onFinish: function () {
110
- var _onFinish = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(values, subParams) {
111
- var result, close;
112
- return _regeneratorRuntime.wrap(function _callee$(_context) {
113
- while (1) switch (_context.prev = _context.next) {
114
- case 0:
115
- _context.next = 2;
116
- return run(values, subParams);
117
- case 2:
118
- result = _context.sent;
119
- close = onOk === null || onOk === void 0 ? void 0 : onOk(result, subParams);
120
- if (!(close === false)) {
121
- _context.next = 6;
122
- break;
123
- }
124
- return _context.abrupt("return");
125
- case 6:
126
- cancel();
127
- case 7:
128
- case "end":
129
- return _context.stop();
130
- }
131
- }, _callee);
132
- }));
133
- function onFinish(_x, _x2) {
134
- return _onFinish.apply(this, arguments);
135
- }
136
- return onFinish;
137
- }(),
138
- infoRequest: infoRequest,
139
- labelWidth: labelWidth
140
- }))
142
+ children: contentRender ? contentRender(node, currentForm) : node
141
143
  }))
142
144
  }));
143
145
  });
@@ -1,3 +1,3 @@
1
1
  import type { DialogFormProps } from "./modal";
2
- declare const _default: ({ visible, title, onCancel, configData, infoRequest, request, afterClose, dialogForm, initialValues, onFinish, params, onOk, onValuesChange, autoClear, ...props }: DialogFormProps) => JSX.Element;
2
+ declare const _default: ({ visible, title, onCancel, configData, infoRequest, request, afterClose, dialogForm, initialValues, onFinish, params, onOk, onValuesChange, autoClear, contentRender, ...props }: DialogFormProps) => JSX.Element;
3
3
  export default _default;
@@ -16,7 +16,7 @@ import HForm from '../Form/index.js';
16
16
  import Index, { useFormConfigContext } from '../Form/Context/FormConfigProvider.js';
17
17
  import { useCurrentForm, useModifyProps, useSub } from './hooks.js';
18
18
 
19
- var _excluded = ["visible", "title", "onCancel", "configData", "infoRequest", "request", "afterClose", "dialogForm", "initialValues", "onFinish", "params", "onOk", "onValuesChange", "autoClear"];
19
+ var _excluded = ["visible", "title", "onCancel", "configData", "infoRequest", "request", "afterClose", "dialogForm", "initialValues", "onFinish", "params", "onOk", "onValuesChange", "autoClear", "contentRender"];
20
20
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
21
21
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
22
22
  var ModalForm = (function (_ref) {
@@ -35,6 +35,7 @@ var ModalForm = (function (_ref) {
35
35
  onValuesChange = _ref.onValuesChange,
36
36
  _ref$autoClear = _ref.autoClear,
37
37
  autoClear = _ref$autoClear === void 0 ? true : _ref$autoClear,
38
+ contentRender = _ref.contentRender,
38
39
  props = _objectWithoutProperties(_ref, _excluded);
39
40
  var currentForm = useCurrentForm(dialogForm);
40
41
  var providerConfig = useFormConfigContext();
@@ -65,6 +66,44 @@ var ModalForm = (function (_ref) {
65
66
  }),
66
67
  loading = _useSub.loading,
67
68
  run = _useSub.run;
69
+ var node = jsx(HForm, _objectSpread(_objectSpread({
70
+ configData: modalFormData,
71
+ initialValues: initValue,
72
+ onValuesChange: onValuesChange,
73
+ onFinish: function () {
74
+ var _onFinish = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(values, outParams) {
75
+ var result, close;
76
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
77
+ while (1) switch (_context.prev = _context.next) {
78
+ case 0:
79
+ _context.next = 2;
80
+ return run(values, outParams);
81
+ case 2:
82
+ result = _context.sent;
83
+ close = onOk === null || onOk === void 0 ? void 0 : onOk(result, outParams);
84
+ if (!(close === false)) {
85
+ _context.next = 6;
86
+ break;
87
+ }
88
+ return _context.abrupt("return");
89
+ case 6:
90
+ cancel();
91
+ case 7:
92
+ case "end":
93
+ return _context.stop();
94
+ }
95
+ }, _callee);
96
+ }));
97
+ function onFinish(_x, _x2) {
98
+ return _onFinish.apply(this, arguments);
99
+ }
100
+ return onFinish;
101
+ }()
102
+ }, props), {}, {
103
+ params: formParams,
104
+ form: currentForm,
105
+ infoRequest: infoRequest
106
+ }));
68
107
  return jsx(Modal, _objectSpread(_objectSpread({
69
108
  title: modalTitle,
70
109
  visible: modalVisible,
@@ -80,44 +119,7 @@ var ModalForm = (function (_ref) {
80
119
  onOk: currentForm.submit,
81
120
  destroyOnClose: true,
82
121
  children: jsx(Index, _objectSpread(_objectSpread({}, providerConfig), {}, {
83
- children: jsx(HForm, _objectSpread(_objectSpread({
84
- configData: modalFormData,
85
- initialValues: initValue,
86
- onValuesChange: onValuesChange,
87
- onFinish: function () {
88
- var _onFinish = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(values, outParams) {
89
- var result, close;
90
- return _regeneratorRuntime.wrap(function _callee$(_context) {
91
- while (1) switch (_context.prev = _context.next) {
92
- case 0:
93
- _context.next = 2;
94
- return run(values, outParams);
95
- case 2:
96
- result = _context.sent;
97
- close = onOk === null || onOk === void 0 ? void 0 : onOk(result, outParams);
98
- if (!(close === false)) {
99
- _context.next = 6;
100
- break;
101
- }
102
- return _context.abrupt("return");
103
- case 6:
104
- cancel();
105
- case 7:
106
- case "end":
107
- return _context.stop();
108
- }
109
- }, _callee);
110
- }));
111
- function onFinish(_x, _x2) {
112
- return _onFinish.apply(this, arguments);
113
- }
114
- return onFinish;
115
- }()
116
- }, props), {}, {
117
- params: formParams,
118
- form: currentForm,
119
- infoRequest: infoRequest
120
- }))
122
+ children: contentRender ? contentRender === null || contentRender === void 0 ? void 0 : contentRender(node, currentForm) : node
121
123
  }))
122
124
  }));
123
125
  });
@@ -1,6 +1,7 @@
1
1
  import type { ModalProps } from "antd";
2
2
  import type { HFormInstance, HItemProps, HFormProps } from "../Form/modal";
3
3
  import type { PromiseFnResult } from "../modal";
4
+ import type React from "react";
4
5
  type RootProps = HFormProps & ModalProps;
5
6
  export interface ModifyPropsModal<P = any> {
6
7
  configData: HItemProps[];
@@ -32,5 +33,6 @@ export interface DialogFormProps<P = any, T = any> extends Omit<RootProps, "onFi
32
33
  onOk?: (data: T, params: P) => boolean | void;
33
34
  infoRequest?: (params: P) => Promise<T>;
34
35
  autoClear?: boolean;
36
+ contentRender?: (dom: React.ReactNode, form: HDialogFormInstance) => React.ReactNode;
35
37
  }
36
38
  export {};
@@ -11,14 +11,14 @@ declare const componentConfig: {
11
11
  checkboxGroup: import("react").ForwardRefExoticComponent<import("./modal").HFormItemProps & import("react").RefAttributes<any>>;
12
12
  checkBox: import("react").FC<import("../CheckboxGroup/modal").HCheckboxProps>;
13
13
  radioGroup: ({ value, options, onChange, fieldNames: propsFieldNames, ...props }: import("../RadioGroup").HRadioGroupProps) => JSX.Element;
14
- switch: import("react").FC<import("../Switch").HSwitchProps>;
15
- datePicker: import("react").FC<import("../TDPicker/modal").HDatePickerProps>;
14
+ switch: import("react").ForwardRefExoticComponent<import("./modal").HFormItemProps & import("react").RefAttributes<any>>;
15
+ datePicker: import("react").ForwardRefExoticComponent<import("./modal").HFormItemProps & import("react").RefAttributes<any>>;
16
16
  rangePicker: {
17
17
  Component: import("react").ForwardRefExoticComponent<import("./modal").HFormItemProps & import("react").RefAttributes<any>>;
18
18
  placeholder: ({ label }: import("./modal").HItemProps) => string[];
19
19
  requiredErrMsg: ({ label }: import("./modal").HItemProps) => string;
20
20
  };
21
- timePicker: ({ value, format, onChange, disabledDate, ...props }: import("../TDPicker/modal").HTimePickerProps) => JSX.Element;
21
+ timePicker: import("react").ForwardRefExoticComponent<import("./modal").HFormItemProps & import("react").RefAttributes<any>>;
22
22
  input: ({ copy, value, addonAfter, ...props }: import("../Input/modal").HInputProps<any>) => JSX.Element;
23
23
  upload: import("react").ForwardRefExoticComponent<import("./modal").HFormItemProps & import("react").RefAttributes<any>>;
24
24
  urlUpload: ({ placeholder, value, onChange, mediaType, ...props }: import("../Upload/modal").IUrlUploadProps) => JSX.Element;
@@ -26,6 +26,8 @@ declare const componentConfig: {
26
26
  textArea: ({ autoSize, ...props }: import("antd/es/input").TextAreaProps) => JSX.Element;
27
27
  colorInput: ({ value, onChange, defaultColor, ...props }: import("../Input/modal").HInputProps<any>) => JSX.Element;
28
28
  cascader: ({ request, options, fieldNames: propsFieldNames, ...props }: import("../Cascader").HCascaderProps) => JSX.Element;
29
- verificationCodeInput: () => JSX.Element;
29
+ verificationCodeInput: ({ value, request, form, onChange, ...props }: import("../Input/VerificationCodeInput").HVerificationCodeInputProps) => JSX.Element;
30
+ trimInput: import("react").ForwardRefExoticComponent<import("./modal").HFormItemProps & import("react").RefAttributes<any>>;
31
+ trimTextArea: import("react").ForwardRefExoticComponent<import("./modal").HFormItemProps & import("react").RefAttributes<any>>;
30
32
  };
31
33
  export default componentConfig;
package/es/Form/config.js CHANGED
@@ -7,20 +7,22 @@ import Index from '../Input/ButtonInput.js';
7
7
  import HCheckboxGroup from '../CheckboxGroup/index.js';
8
8
  import Index$1 from '../CheckboxGroup/CheckBox/index.js';
9
9
  import HRadioGroup from '../RadioGroup/index.js';
10
- import Index$2 from '../Switch/index.js';
10
+ import HSwitch from '../Switch/index.js';
11
11
  import HDatePicker from '../TDPicker/index.js';
12
12
  import HRangePicker from '../TDPicker/RangePicker.js';
13
13
  import HTimePicker from '../TDPicker/TimePicker.js';
14
14
  import HUpload from '../Upload/index.js';
15
- import Index$3 from '../Upload/UrlUpload/index.js';
15
+ import Index$2 from '../Upload/UrlUpload/index.js';
16
16
  import HSubmit from '../Submit/index.js';
17
17
  import TextArea from '../TextArea/index.js';
18
18
  import ColorInput from '../Input/ColorInput/index.js';
19
19
  import Cascader from '../Cascader/index.js';
20
- import HVerificationCodeInput from '../Input/VerificationCodeInput.js';
20
+ import VerificationCodeInput from '../Input/VerificationCodeInput.js';
21
+ import TrimInput from '../Input/TrimInput.js';
22
+ import TrimTextArea from '../TextArea/TrimTextArea.js';
21
23
 
22
24
  var placeholderConfig = {
23
- inputType: ["input", "inputNumber", "selectInput", "buttonInput", "verificationCodeInput"],
25
+ inputType: ["input", "inputNumber", "selectInput", "buttonInput", "verificationCodeInput", "trimInput", ""],
24
26
  selectType: ["select", "datePicker", "timePicker", "colorInput"]
25
27
  };
26
28
  var componentConfig = {
@@ -31,18 +33,20 @@ var componentConfig = {
31
33
  checkboxGroup: HCheckboxGroup,
32
34
  checkBox: Index$1,
33
35
  radioGroup: HRadioGroup,
34
- switch: Index$2,
36
+ switch: HSwitch,
35
37
  datePicker: HDatePicker,
36
38
  rangePicker: HRangePicker,
37
39
  timePicker: HTimePicker,
38
40
  input: HInput,
39
41
  upload: HUpload,
40
- urlUpload: Index$3,
42
+ urlUpload: Index$2,
41
43
  submit: HSubmit,
42
44
  textArea: TextArea,
43
45
  colorInput: ColorInput,
44
46
  cascader: Cascader,
45
- verificationCodeInput: HVerificationCodeInput
47
+ verificationCodeInput: VerificationCodeInput,
48
+ trimInput: TrimInput,
49
+ trimTextArea: TrimTextArea
46
50
  };
47
51
 
48
52
  export { componentConfig as default, placeholderConfig };
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ declare const _default: import("react").ForwardRefExoticComponent<import("../Form/modal").HFormItemProps & import("react").RefAttributes<any>>;
3
+ export default _default;
@@ -0,0 +1,43 @@
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 'core-js/modules/es.function.name.js';
5
+ import 'core-js/modules/es.string.trim.js';
6
+ import 'core-js/modules/es.object.keys.js';
7
+ import 'core-js/modules/es.symbol.js';
8
+ import 'core-js/modules/es.array.filter.js';
9
+ import 'core-js/modules/es.object.to-string.js';
10
+ import 'core-js/modules/es.object.get-own-property-descriptor.js';
11
+ import 'core-js/modules/web.dom-collections.for-each.js';
12
+ import 'core-js/modules/es.object.get-own-property-descriptors.js';
13
+ import { jsx } from 'react/jsx-runtime';
14
+ import HInput from './index.js';
15
+ import HFormConnect from '../Form/HFormConnect.js';
16
+
17
+ var _excluded = ["addFormat"];
18
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
19
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
20
+ var Index = function Index(_ref) {
21
+ var addFormat = _ref.addFormat,
22
+ props = _objectWithoutProperties(_ref, _excluded);
23
+ addFormat === null || addFormat === void 0 || addFormat({
24
+ float: {
25
+ inputValue: function inputValue(item, initValue) {
26
+ var _item$name = item.name,
27
+ valueName = _item$name === void 0 ? "" : _item$name;
28
+ return _defineProperty({}, valueName, initValue[valueName]);
29
+ },
30
+ outputValue: function outputValue(item, _outputValue) {
31
+ var _item$name2 = item.name,
32
+ name = _item$name2 === void 0 ? "" : _item$name2;
33
+ var itemVal = _outputValue[name];
34
+ return _defineProperty({}, name, itemVal === null || itemVal === void 0 ? void 0 : itemVal.trim());
35
+ }
36
+ }
37
+ });
38
+ return jsx(HInput, _objectSpread({}, props));
39
+ };
40
+ var TrimInput = HFormConnect(Index);
41
+
42
+ export { TrimInput as default };
43
+ // powered by hdj
@@ -1,8 +1,8 @@
1
- import type { HFormInstance } from "@/components/Form/modal";
1
+ import type { HFormInstance } from "../Form/modal";
2
2
  import type { InputProps } from "antd";
3
- interface IVerificationCodeInputProps extends Omit<InputProps, "form"> {
3
+ export interface HVerificationCodeInputProps extends Omit<InputProps, "form"> {
4
4
  request?: (value: any) => Promise<any>;
5
5
  form?: HFormInstance;
6
6
  }
7
- declare const _default: ({ value, request, form, onChange, ...props }: IVerificationCodeInputProps) => JSX.Element;
7
+ declare const _default: ({ value, request, form, onChange, ...props }: HVerificationCodeInputProps) => JSX.Element;
8
8
  export default _default;
@@ -20,7 +20,7 @@ import { useRequest } from 'ahooks';
20
20
  var _excluded = ["value", "request", "form", "onChange"];
21
21
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
22
22
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
23
- var HVerificationCodeInput = (function (_ref) {
23
+ var VerificationCodeInput = (function (_ref) {
24
24
  var value = _ref.value,
25
25
  request = _ref.request,
26
26
  form = _ref.form,
@@ -106,5 +106,5 @@ var HVerificationCodeInput = (function (_ref) {
106
106
  }));
107
107
  });
108
108
 
109
- export { HVerificationCodeInput as default };
109
+ export { VerificationCodeInput as default };
110
110
  // powered by hdj
@@ -9,6 +9,7 @@ export interface HInputProps<V = any> extends Omit<InputProps, "onChange" | "val
9
9
  value?: V;
10
10
  defaultColor?: string;
11
11
  copy?: boolean;
12
+ addFormat?: (config: Record<string, addFormatItemModal>) => void;
12
13
  }
13
14
  interface ValueNameModal {
14
15
  input?: string;
@@ -1,11 +1,13 @@
1
1
  import type { SwitchProps } from "antd";
2
2
  import React from "react";
3
3
  import type { ValueSwitchMapModal } from "../modal";
4
+ import type { addFormatItemModal } from "../Form/modal";
4
5
  export interface HSwitchProps extends Omit<SwitchProps, "onChange"> {
5
6
  valueMap?: ValueSwitchMapModal;
6
7
  value?: any;
7
8
  onChange?: (val: any) => void;
8
9
  beforeText?: React.ReactNode;
10
+ addFormat?: (format: Record<string, addFormatItemModal>) => void;
9
11
  }
10
- declare const Index: React.FC<HSwitchProps>;
11
- export default Index;
12
+ declare const _default: React.ForwardRefExoticComponent<import("../Form/modal").HFormItemProps & React.RefAttributes<any>>;
13
+ export default _default;
@@ -1,4 +1,7 @@
1
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 'core-js/modules/es.function.name.js';
2
5
  import 'core-js/modules/es.object.keys.js';
3
6
  import 'core-js/modules/es.symbol.js';
4
7
  import 'core-js/modules/es.array.filter.js';
@@ -6,14 +9,13 @@ import 'core-js/modules/es.object.to-string.js';
6
9
  import 'core-js/modules/es.object.get-own-property-descriptor.js';
7
10
  import 'core-js/modules/web.dom-collections.for-each.js';
8
11
  import 'core-js/modules/es.object.get-own-property-descriptors.js';
9
- import _defineProperty from '@babel/runtime-corejs3/helpers/defineProperty';
10
- import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/objectWithoutProperties';
11
12
  import { jsxs, jsx } from 'react/jsx-runtime';
12
13
  import { Space, Switch } from 'antd';
13
14
  import { useMemo } from 'react';
14
15
  import { useMatchConfigProps } from '../hooks/index.js';
16
+ import HFormConnect from '../Form/HFormConnect.js';
15
17
 
16
- var _excluded = ["value", "onChange", "valueMap", "children", "unCheckedChildren", "checkedChildren", "beforeText"];
18
+ var _excluded = ["value", "onChange", "valueMap", "children", "unCheckedChildren", "checkedChildren", "beforeText", "addFormat"];
17
19
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
18
20
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
19
21
  var Index = function Index(_ref) {
@@ -26,6 +28,7 @@ var Index = function Index(_ref) {
26
28
  _ref$checkedChildren = _ref.checkedChildren,
27
29
  checkedChildren = _ref$checkedChildren === void 0 ? "开启" : _ref$checkedChildren,
28
30
  beforeText = _ref.beforeText,
31
+ addFormat = _ref.addFormat,
29
32
  props = _objectWithoutProperties(_ref, _excluded);
30
33
  var _useMatchConfigProps = useMatchConfigProps({
31
34
  valueSwitchMap: propsValueSwitchMap
@@ -43,6 +46,26 @@ var Index = function Index(_ref) {
43
46
  }
44
47
  onChange === null || onChange === void 0 || onChange(subVal);
45
48
  };
49
+ addFormat === null || addFormat === void 0 || addFormat({
50
+ float: {
51
+ inputValue: function inputValue(item, initValue) {
52
+ var close = valueSwitchMap.close;
53
+ var _item$name = item.name,
54
+ valueName = _item$name === void 0 ? "" : _item$name;
55
+ var val = initValue[valueName];
56
+ if (typeof val === "undefined" || val === null) {
57
+ val = close;
58
+ }
59
+ console.log(val, "");
60
+ return _defineProperty({}, valueName, val);
61
+ },
62
+ outputValue: function outputValue(item, _outputValue) {
63
+ var _item$name2 = item.name,
64
+ name = _item$name2 === void 0 ? "" : _item$name2;
65
+ return _defineProperty({}, name, _outputValue[name]);
66
+ }
67
+ }
68
+ });
46
69
  return jsxs(Space, {
47
70
  children: [beforeText, jsx(Switch, _objectSpread({
48
71
  checked: swChecked,
@@ -54,6 +77,7 @@ var Index = function Index(_ref) {
54
77
  })]
55
78
  });
56
79
  };
80
+ var HSwitch = HFormConnect(Index);
57
81
 
58
- export { Index as default };
82
+ export { HSwitch as default };
59
83
  // powered by hdj
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ declare const _default: import("react").ForwardRefExoticComponent<import("../Form/modal").HFormItemProps & import("react").RefAttributes<any>>;
3
+ export default _default;
@@ -0,0 +1,43 @@
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 'core-js/modules/es.function.name.js';
5
+ import 'core-js/modules/es.string.trim.js';
6
+ import 'core-js/modules/es.object.keys.js';
7
+ import 'core-js/modules/es.symbol.js';
8
+ import 'core-js/modules/es.array.filter.js';
9
+ import 'core-js/modules/es.object.to-string.js';
10
+ import 'core-js/modules/es.object.get-own-property-descriptor.js';
11
+ import 'core-js/modules/web.dom-collections.for-each.js';
12
+ import 'core-js/modules/es.object.get-own-property-descriptors.js';
13
+ import { jsx } from 'react/jsx-runtime';
14
+ import TextArea from './index.js';
15
+ import HFormConnect from '../Form/HFormConnect.js';
16
+
17
+ var _excluded = ["addFormat"];
18
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
19
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
20
+ var Index = function Index(_ref) {
21
+ var addFormat = _ref.addFormat,
22
+ props = _objectWithoutProperties(_ref, _excluded);
23
+ addFormat === null || addFormat === void 0 || addFormat({
24
+ float: {
25
+ inputValue: function inputValue(item, initValue) {
26
+ var _item$name = item.name,
27
+ valueName = _item$name === void 0 ? "" : _item$name;
28
+ return _defineProperty({}, valueName, initValue[valueName]);
29
+ },
30
+ outputValue: function outputValue(item, _outputValue) {
31
+ var _item$name2 = item.name,
32
+ name = _item$name2 === void 0 ? "" : _item$name2;
33
+ var itemVal = _outputValue[name];
34
+ return _defineProperty({}, name, itemVal === null || itemVal === void 0 ? void 0 : itemVal.trim());
35
+ }
36
+ }
37
+ });
38
+ return jsx(TextArea, _objectSpread({}, props));
39
+ };
40
+ var TrimTextArea = HFormConnect(Index);
41
+
42
+ export { TrimTextArea as default };
43
+ // powered by hdj
package/es/index.d.ts CHANGED
@@ -12,17 +12,19 @@ export declare const HUpload: import("react").ForwardRefExoticComponent<import("
12
12
  export declare const HUrlUpload: ({ placeholder, value, onChange, mediaType, ...props }: import("./Upload/modal").IUrlUploadProps) => JSX.Element;
13
13
  export declare const HButtonInput: import("react").FC<import("./Input/modal").HButtonInputProps>;
14
14
  export declare const HCheckBox: import("react").FC<import("./CheckboxGroup/modal").HCheckboxProps>;
15
- export declare const HSwitch: import("react").FC<import("./Switch").HSwitchProps>;
15
+ export declare const HSwitch: import("react").ForwardRefExoticComponent<import("./Form/modal").HFormItemProps & import("react").RefAttributes<any>>;
16
16
  export declare const HCheckboxGroup: import("react").ForwardRefExoticComponent<import("./Form/modal").HFormItemProps & import("react").RefAttributes<any>>;
17
- export declare const HDatePicker: import("react").FC<import("./TDPicker/modal").HDatePickerProps>;
17
+ export declare const HDatePicker: import("react").ForwardRefExoticComponent<import("./Form/modal").HFormItemProps & import("react").RefAttributes<any>>;
18
18
  export declare const HRangePicker: import("react").ForwardRefExoticComponent<import("./Form/modal").HFormItemProps & import("react").RefAttributes<any>>;
19
19
  export declare const HRadioGroup: ({ value, options, onChange, fieldNames: propsFieldNames, ...props }: import("./RadioGroup").HRadioGroupProps) => JSX.Element;
20
- export declare const HTimePicker: ({ value, format, onChange, disabledDate, ...props }: import("./TDPicker/modal").HTimePickerProps) => JSX.Element;
20
+ export declare const HTimePicker: import("react").ForwardRefExoticComponent<import("./Form/modal").HFormItemProps & import("react").RefAttributes<any>>;
21
21
  export declare const HInputNumber: ({ style, ...props }: import("antd").InputNumberProps<string | number>) => JSX.Element;
22
22
  export declare const HPageHandler: import("react").FC<import("./PageHandler/modal").IHPageHandler<any>>;
23
23
  export declare const HTextArea: ({ autoSize, ...props }: import("antd/es/input").TextAreaProps) => JSX.Element;
24
24
  export declare const HColorInput: ({ value, onChange, defaultColor, ...props }: import("./Input/modal").HInputProps<any>) => JSX.Element;
25
- export declare const HModalForm: ({ visible, title, onCancel, configData, infoRequest, request, afterClose, dialogForm, initialValues, onFinish, params, onOk, onValuesChange, ...props }: import("./DialogForm/modal").DialogFormProps<any, any>) => JSX.Element;
26
- export declare const HDrawerForm: ({ visible, title, onCancel, configData, infoRequest, request, afterClose, dialogForm, closable, initialValues, labelWidth, onOk, onFinish, size, form, footer, params, onValuesChange, ...props }: import("./DialogForm/modal").DialogFormProps<any, any>) => JSX.Element;
25
+ export declare const HModalForm: ({ visible, title, onCancel, configData, infoRequest, request, afterClose, dialogForm, initialValues, onFinish, params, onOk, onValuesChange, autoClear, contentRender, ...props }: import("./DialogForm/modal").DialogFormProps<any, any>) => JSX.Element;
26
+ export declare const HDrawerForm: ({ visible, title, onCancel, configData, infoRequest, request, afterClose, dialogForm, closable, initialValues, labelWidth, onOk, onFinish, size, form, footer, params, onValuesChange, autoClear, contentRender, ...props }: import("./DialogForm/modal").DialogFormProps<any, any>) => JSX.Element;
27
27
  export declare const HCascader: ({ request, options, fieldNames: propsFieldNames, ...props }: import("./Cascader").HCascaderProps) => JSX.Element;
28
- export declare const HVerificationCodeInput: () => JSX.Element;
28
+ export declare const HVerificationCodeInput: ({ value, request, form, onChange, ...props }: import("./Input/VerificationCodeInput").HVerificationCodeInputProps) => JSX.Element;
29
+ export declare const HTrimInput: import("react").ForwardRefExoticComponent<import("./Form/modal").HFormItemProps & import("react").RefAttributes<any>>;
30
+ export declare const HTrimTextArea: import("react").ForwardRefExoticComponent<import("./Form/modal").HFormItemProps & import("react").RefAttributes<any>>;
package/es/index.js CHANGED
@@ -30,6 +30,8 @@ var HModalForm = ModalForm;
30
30
  var HDrawerForm = DrawerForm;
31
31
  var HCascader = componentConfig.cascader;
32
32
  var HVerificationCodeInput = componentConfig.verificationCodeInput;
33
+ var HTrimInput = componentConfig.trimInput;
34
+ var HTrimTextArea = componentConfig.trimTextArea;
33
35
 
34
- export { HButtonInput, HCascader, HCheckBox, HCheckboxGroup, HColorInput, HDatePicker, HDrawerForm, HInput, HInputNumber, HModalForm, HPageHandler, HRadioGroup, HRangePicker, HSelect, HSelectInput, HSwitch, HTextArea, HTimePicker, HUpload, HUrlUpload, HVerificationCodeInput };
36
+ export { HButtonInput, HCascader, HCheckBox, HCheckboxGroup, HColorInput, HDatePicker, HDrawerForm, HInput, HInputNumber, HModalForm, HPageHandler, HRadioGroup, HRangePicker, HSelect, HSelectInput, HSwitch, HTextArea, HTimePicker, HTrimInput, HTrimTextArea, HUpload, HUrlUpload, HVerificationCodeInput };
35
37
  // powered by hdj
@@ -1,3 +1,3 @@
1
1
  import type { DialogFormProps } from "../modal";
2
- declare const _default: ({ visible, title, onCancel, configData, infoRequest, request, afterClose, dialogForm, closable, initialValues, labelWidth, onOk, onFinish, size, form, footer, params, onValuesChange, autoClear, ...props }: DialogFormProps) => JSX.Element;
2
+ declare const _default: ({ visible, title, onCancel, configData, infoRequest, request, afterClose, dialogForm, closable, initialValues, labelWidth, onOk, onFinish, size, form, footer, params, onValuesChange, autoClear, contentRender, ...props }: DialogFormProps) => JSX.Element;
3
3
  export default _default;