@hw-component/form 0.0.8-beta-v7 → 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 (41) hide show
  1. package/es/DialogForm/modal.d.ts +1 -1
  2. package/es/Form/config.d.ts +6 -4
  3. package/es/Form/config.js +11 -7
  4. package/es/Input/TrimInput.d.ts +3 -0
  5. package/es/Input/TrimInput.js +43 -0
  6. package/es/Input/VerificationCodeInput.d.ts +3 -3
  7. package/es/Input/VerificationCodeInput.js +2 -2
  8. package/es/Input/modal.d.ts +1 -0
  9. package/es/Switch/index.d.ts +4 -2
  10. package/es/Switch/index.js +28 -4
  11. package/es/TextArea/TrimTextArea.d.ts +3 -0
  12. package/es/TextArea/TrimTextArea.js +43 -0
  13. package/es/index.d.ts +8 -6
  14. package/es/index.js +3 -1
  15. package/lib/DialogForm/modal.d.ts +1 -1
  16. package/lib/Form/config.d.ts +6 -4
  17. package/lib/Form/config.js +6 -2
  18. package/lib/Input/TrimInput.d.ts +3 -0
  19. package/lib/Input/TrimInput.js +46 -0
  20. package/lib/Input/VerificationCodeInput.d.ts +3 -3
  21. package/lib/Input/VerificationCodeInput.js +2 -2
  22. package/lib/Input/modal.d.ts +1 -0
  23. package/lib/Switch/index.d.ts +4 -2
  24. package/lib/Switch/index.js +28 -4
  25. package/lib/TextArea/TrimTextArea.d.ts +3 -0
  26. package/lib/TextArea/TrimTextArea.js +46 -0
  27. package/lib/index.d.ts +8 -6
  28. package/lib/index.js +4 -0
  29. package/package.json +1 -1
  30. package/src/components/DialogForm/DrawerForm/index.tsx +5 -3
  31. package/src/components/DialogForm/ModalForm.tsx +5 -3
  32. package/src/components/DialogForm/modal.ts +5 -2
  33. package/src/components/Form/config.ts +8 -3
  34. package/src/components/Input/TrimInput.tsx +26 -0
  35. package/src/components/Input/VerificationCodeInput.tsx +4 -4
  36. package/src/components/Input/modal.ts +1 -0
  37. package/src/components/Switch/index.tsx +27 -1
  38. package/src/components/TextArea/TrimTextArea.tsx +30 -0
  39. package/src/components/index.tsx +5 -0
  40. package/src/pages/Form/index.tsx +20 -0
  41. package/src/pages/ModalForm/index.tsx +7 -5
@@ -1,7 +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 React from "react";
4
+ import type React from "react";
5
5
  type RootProps = HFormProps & ModalProps;
6
6
  export interface ModifyPropsModal<P = any> {
7
7
  configData: HItemProps[];
@@ -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,7 +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 React from "react";
4
+ import type React from "react";
5
5
  type RootProps = HFormProps & ModalProps;
6
6
  export interface ModifyPropsModal<P = any> {
7
7
  configData: HItemProps[];
@@ -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;
@@ -21,9 +21,11 @@ var index$a = require('../TextArea/index.js');
21
21
  var index$b = require('../Input/ColorInput/index.js');
22
22
  var index$c = require('../Cascader/index.js');
23
23
  var VerificationCodeInput = require('../Input/VerificationCodeInput.js');
24
+ var TrimInput = require('../Input/TrimInput.js');
25
+ var TrimTextArea = require('../TextArea/TrimTextArea.js');
24
26
 
25
27
  var placeholderConfig = {
26
- inputType: ["input", "inputNumber", "selectInput", "buttonInput", "verificationCodeInput"],
28
+ inputType: ["input", "inputNumber", "selectInput", "buttonInput", "verificationCodeInput", "trimInput", ""],
27
29
  selectType: ["select", "datePicker", "timePicker", "colorInput"]
28
30
  };
29
31
  var componentConfig = {
@@ -45,7 +47,9 @@ var componentConfig = {
45
47
  textArea: index$a.default,
46
48
  colorInput: index$b.default,
47
49
  cascader: index$c.default,
48
- verificationCodeInput: VerificationCodeInput.default
50
+ verificationCodeInput: VerificationCodeInput.default,
51
+ trimInput: TrimInput.default,
52
+ trimTextArea: TrimTextArea.default
49
53
  };
50
54
 
51
55
  exports.default = componentConfig;
@@ -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,46 @@
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
+ require('core-js/modules/es.function.name.js');
8
+ require('core-js/modules/es.string.trim.js');
9
+ require('core-js/modules/es.object.keys.js');
10
+ require('core-js/modules/es.symbol.js');
11
+ require('core-js/modules/es.array.filter.js');
12
+ require('core-js/modules/es.object.to-string.js');
13
+ require('core-js/modules/es.object.get-own-property-descriptor.js');
14
+ require('core-js/modules/web.dom-collections.for-each.js');
15
+ require('core-js/modules/es.object.get-own-property-descriptors.js');
16
+ var jsxRuntime = require('react/jsx-runtime');
17
+ var index = require('./index.js');
18
+ var HFormConnect = require('../Form/HFormConnect.js');
19
+
20
+ var _excluded = ["addFormat"];
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
+ 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 Index = function Index(_ref) {
24
+ var addFormat = _ref.addFormat,
25
+ props = _objectWithoutProperties(_ref, _excluded);
26
+ addFormat === null || addFormat === void 0 || addFormat({
27
+ float: {
28
+ inputValue: function inputValue(item, initValue) {
29
+ var _item$name = item.name,
30
+ valueName = _item$name === void 0 ? "" : _item$name;
31
+ return _defineProperty({}, valueName, initValue[valueName]);
32
+ },
33
+ outputValue: function outputValue(item, _outputValue) {
34
+ var _item$name2 = item.name,
35
+ name = _item$name2 === void 0 ? "" : _item$name2;
36
+ var itemVal = _outputValue[name];
37
+ return _defineProperty({}, name, itemVal === null || itemVal === void 0 ? void 0 : itemVal.trim());
38
+ }
39
+ }
40
+ });
41
+ return jsxRuntime.jsx(index.default, _objectSpread({}, props));
42
+ };
43
+ var TrimInput = HFormConnect.default(Index);
44
+
45
+ exports.default = TrimInput;
46
+ // powered by h
@@ -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;
@@ -23,7 +23,7 @@ var ahooks = require('ahooks');
23
23
  var _excluded = ["value", "request", "form", "onChange"];
24
24
  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; }
25
25
  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; }
26
- var HVerificationCodeInput = (function (_ref) {
26
+ var VerificationCodeInput = (function (_ref) {
27
27
  var value = _ref.value,
28
28
  request = _ref.request,
29
29
  form = _ref.form,
@@ -109,5 +109,5 @@ var HVerificationCodeInput = (function (_ref) {
109
109
  }));
110
110
  });
111
111
 
112
- exports.default = HVerificationCodeInput;
112
+ exports.default = VerificationCodeInput;
113
113
  // powered by h
@@ -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;
@@ -2,6 +2,9 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
6
+ var _objectWithoutProperties = require('@babel/runtime-corejs3/helpers/objectWithoutProperties');
7
+ require('core-js/modules/es.function.name.js');
5
8
  require('core-js/modules/es.object.keys.js');
6
9
  require('core-js/modules/es.symbol.js');
7
10
  require('core-js/modules/es.array.filter.js');
@@ -9,14 +12,13 @@ require('core-js/modules/es.object.to-string.js');
9
12
  require('core-js/modules/es.object.get-own-property-descriptor.js');
10
13
  require('core-js/modules/web.dom-collections.for-each.js');
11
14
  require('core-js/modules/es.object.get-own-property-descriptors.js');
12
- var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
13
- var _objectWithoutProperties = require('@babel/runtime-corejs3/helpers/objectWithoutProperties');
14
15
  var jsxRuntime = require('react/jsx-runtime');
15
16
  var antd = require('antd');
16
17
  var React = require('react');
17
18
  var index = require('../hooks/index.js');
19
+ var HFormConnect = require('../Form/HFormConnect.js');
18
20
 
19
- var _excluded = ["value", "onChange", "valueMap", "children", "unCheckedChildren", "checkedChildren", "beforeText"];
21
+ var _excluded = ["value", "onChange", "valueMap", "children", "unCheckedChildren", "checkedChildren", "beforeText", "addFormat"];
20
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; }
21
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; }
22
24
  var Index = function Index(_ref) {
@@ -29,6 +31,7 @@ var Index = function Index(_ref) {
29
31
  _ref$checkedChildren = _ref.checkedChildren,
30
32
  checkedChildren = _ref$checkedChildren === void 0 ? "开启" : _ref$checkedChildren,
31
33
  beforeText = _ref.beforeText,
34
+ addFormat = _ref.addFormat,
32
35
  props = _objectWithoutProperties(_ref, _excluded);
33
36
  var _useMatchConfigProps = index.useMatchConfigProps({
34
37
  valueSwitchMap: propsValueSwitchMap
@@ -46,6 +49,26 @@ var Index = function Index(_ref) {
46
49
  }
47
50
  onChange === null || onChange === void 0 || onChange(subVal);
48
51
  };
52
+ addFormat === null || addFormat === void 0 || addFormat({
53
+ float: {
54
+ inputValue: function inputValue(item, initValue) {
55
+ var close = valueSwitchMap.close;
56
+ var _item$name = item.name,
57
+ valueName = _item$name === void 0 ? "" : _item$name;
58
+ var val = initValue[valueName];
59
+ if (typeof val === "undefined" || val === null) {
60
+ val = close;
61
+ }
62
+ console.log(val, "");
63
+ return _defineProperty({}, valueName, val);
64
+ },
65
+ outputValue: function outputValue(item, _outputValue) {
66
+ var _item$name2 = item.name,
67
+ name = _item$name2 === void 0 ? "" : _item$name2;
68
+ return _defineProperty({}, name, _outputValue[name]);
69
+ }
70
+ }
71
+ });
49
72
  return jsxRuntime.jsxs(antd.Space, {
50
73
  children: [beforeText, jsxRuntime.jsx(antd.Switch, _objectSpread({
51
74
  checked: swChecked,
@@ -57,6 +80,7 @@ var Index = function Index(_ref) {
57
80
  })]
58
81
  });
59
82
  };
83
+ var HSwitch = HFormConnect.default(Index);
60
84
 
61
- exports.default = Index;
85
+ exports.default = HSwitch;
62
86
  // powered by h
@@ -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,46 @@
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
+ require('core-js/modules/es.function.name.js');
8
+ require('core-js/modules/es.string.trim.js');
9
+ require('core-js/modules/es.object.keys.js');
10
+ require('core-js/modules/es.symbol.js');
11
+ require('core-js/modules/es.array.filter.js');
12
+ require('core-js/modules/es.object.to-string.js');
13
+ require('core-js/modules/es.object.get-own-property-descriptor.js');
14
+ require('core-js/modules/web.dom-collections.for-each.js');
15
+ require('core-js/modules/es.object.get-own-property-descriptors.js');
16
+ var jsxRuntime = require('react/jsx-runtime');
17
+ var index = require('./index.js');
18
+ var HFormConnect = require('../Form/HFormConnect.js');
19
+
20
+ var _excluded = ["addFormat"];
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
+ 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 Index = function Index(_ref) {
24
+ var addFormat = _ref.addFormat,
25
+ props = _objectWithoutProperties(_ref, _excluded);
26
+ addFormat === null || addFormat === void 0 || addFormat({
27
+ float: {
28
+ inputValue: function inputValue(item, initValue) {
29
+ var _item$name = item.name,
30
+ valueName = _item$name === void 0 ? "" : _item$name;
31
+ return _defineProperty({}, valueName, initValue[valueName]);
32
+ },
33
+ outputValue: function outputValue(item, _outputValue) {
34
+ var _item$name2 = item.name,
35
+ name = _item$name2 === void 0 ? "" : _item$name2;
36
+ var itemVal = _outputValue[name];
37
+ return _defineProperty({}, name, itemVal === null || itemVal === void 0 ? void 0 : itemVal.trim());
38
+ }
39
+ }
40
+ });
41
+ return jsxRuntime.jsx(index.default, _objectSpread({}, props));
42
+ };
43
+ var TrimTextArea = HFormConnect.default(Index);
44
+
45
+ exports.default = TrimTextArea;
46
+ // powered by h
package/lib/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/lib/index.js CHANGED
@@ -31,6 +31,8 @@ var HModalForm = ModalForm.default;
31
31
  var HDrawerForm = index$2.default;
32
32
  var HCascader = config.default.cascader;
33
33
  var HVerificationCodeInput = config.default.verificationCodeInput;
34
+ var HTrimInput = config.default.trimInput;
35
+ var HTrimTextArea = config.default.trimTextArea;
34
36
 
35
37
  exports.HForm = index.default;
36
38
  exports.useHForm = useHForm.default;
@@ -55,6 +57,8 @@ exports.HSelectInput = HSelectInput;
55
57
  exports.HSwitch = HSwitch;
56
58
  exports.HTextArea = HTextArea;
57
59
  exports.HTimePicker = HTimePicker;
60
+ exports.HTrimInput = HTrimInput;
61
+ exports.HTrimTextArea = HTrimTextArea;
58
62
  exports.HUpload = HUpload;
59
63
  exports.HUrlUpload = HUrlUpload;
60
64
  exports.HVerificationCodeInput = HVerificationCodeInput;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hw-component/form",
3
- "version": "0.0.8-beta-v7",
3
+ "version": "0.0.8-beta-v8",
4
4
  "description": "基于antd二次开发",
5
5
  "repository": {
6
6
  "type": "git",
@@ -72,7 +72,8 @@ export default ({
72
72
  )
73
73
  );
74
74
  };
75
- const node=<HForm
75
+ const node = (
76
+ <HForm
76
77
  configData={modalFormData}
77
78
  initialValues={initValue}
78
79
  onValuesChange={onValuesChange}
@@ -89,7 +90,8 @@ export default ({
89
90
  }}
90
91
  infoRequest={infoRequest}
91
92
  labelWidth={labelWidth}
92
- />;
93
+ />
94
+ );
93
95
  return (
94
96
  <Drawer
95
97
  visible={modalVisible}
@@ -101,7 +103,7 @@ export default ({
101
103
  footer={footerComponent()}
102
104
  >
103
105
  <FormConfigProvider {...providerConfig}>
104
- {contentRender?contentRender(node,currentForm):node}
106
+ {contentRender ? contentRender(node, currentForm) : node}
105
107
  </FormConfigProvider>
106
108
  </Drawer>
107
109
  );
@@ -48,7 +48,8 @@ export default ({
48
48
  setModalVisible(false);
49
49
  };
50
50
  const { loading, run } = useSub({ request, onFinish });
51
- const node=<HForm
51
+ const node = (
52
+ <HForm
52
53
  configData={modalFormData}
53
54
  initialValues={initValue}
54
55
  onValuesChange={onValuesChange}
@@ -64,7 +65,8 @@ export default ({
64
65
  params={formParams}
65
66
  form={currentForm}
66
67
  infoRequest={infoRequest}
67
- />;
68
+ />
69
+ );
68
70
  return (
69
71
  <Modal
70
72
  title={modalTitle}
@@ -82,7 +84,7 @@ export default ({
82
84
  destroyOnClose={true}
83
85
  >
84
86
  <FormConfigProvider {...providerConfig}>
85
- {contentRender?contentRender?.(node, currentForm):node}
87
+ {contentRender ? contentRender?.(node, currentForm) : node}
86
88
  </FormConfigProvider>
87
89
  </Modal>
88
90
  );
@@ -1,7 +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 React from "react";
4
+ import type React from "react";
5
5
 
6
6
  type RootProps = HFormProps & ModalProps;
7
7
 
@@ -37,5 +37,8 @@ export interface DialogFormProps<P = any, T = any>
37
37
  onOk?: (data: T, params: P) => boolean | void;
38
38
  infoRequest?: (params: P) => Promise<T>;
39
39
  autoClear?: boolean;
40
- contentRender?:(dom:React.ReactNode,form:HDialogFormInstance)=>React.ReactNode;
40
+ contentRender?: (
41
+ dom: React.ReactNode,
42
+ form: HDialogFormInstance
43
+ ) => React.ReactNode;
41
44
  }
@@ -16,8 +16,9 @@ import HSubmit from "../Submit";
16
16
  import TextArea from "../TextArea";
17
17
  import ColorInput from "../Input/ColorInput";
18
18
  import Cascader from "../Cascader";
19
- import HVerificationCodeInput from "../Input/VerificationCodeInput";
20
-
19
+ import VerificationCodeInput from "../Input/VerificationCodeInput";
20
+ import TrimInput from "../Input/TrimInput";
21
+ import TrimTextArea from "../TextArea/TrimTextArea";
21
22
  export const placeholderConfig = {
22
23
  inputType: [
23
24
  "input",
@@ -25,6 +26,8 @@ export const placeholderConfig = {
25
26
  "selectInput",
26
27
  "buttonInput",
27
28
  "verificationCodeInput",
29
+ "trimInput",
30
+ "",
28
31
  ],
29
32
  selectType: ["select", "datePicker", "timePicker", "colorInput"],
30
33
  };
@@ -47,7 +50,9 @@ const componentConfig = {
47
50
  textArea: TextArea,
48
51
  colorInput: ColorInput,
49
52
  cascader: Cascader,
50
- verificationCodeInput: HVerificationCodeInput,
53
+ verificationCodeInput: VerificationCodeInput,
54
+ trimInput: TrimInput,
55
+ trimTextArea: TrimTextArea,
51
56
  };
52
57
 
53
58
  export default componentConfig;
@@ -0,0 +1,26 @@
1
+ import Input from "./index";
2
+ import type { HInputProps } from "./modal";
3
+ import HFormConnect from "../Form/HFormConnect";
4
+
5
+ const Index = ({ addFormat, ...props }: HInputProps) => {
6
+ addFormat?.({
7
+ float: {
8
+ inputValue: (item, initValue) => {
9
+ const { name: valueName = "" } = item;
10
+ return {
11
+ [valueName]: initValue[valueName],
12
+ };
13
+ },
14
+ outputValue: (item, outputValue) => {
15
+ const { name = "" } = item;
16
+ const { [name]: itemVal } = outputValue;
17
+ return {
18
+ [name]: itemVal?.trim(),
19
+ };
20
+ },
21
+ },
22
+ });
23
+ return <Input {...props} />;
24
+ };
25
+
26
+ export default HFormConnect(Index);
@@ -1,10 +1,10 @@
1
1
  import React, { useCallback, useEffect, useMemo, useState } from "react";
2
2
  import ButtonInput from "./ButtonInput";
3
3
  import { useRequest } from "ahooks";
4
- import type { HFormInstance } from "@/components/Form/modal";
4
+ import type { HFormInstance } from "../Form/modal";
5
5
  import type { InputProps } from "antd";
6
- interface IVerificationCodeInputProps extends Omit<InputProps, "form"> {
7
- request?: (value) => Promise<any>;
6
+ export interface HVerificationCodeInputProps extends Omit<InputProps, "form"> {
7
+ request?: (value: any) => Promise<any>;
8
8
  form?: HFormInstance;
9
9
  }
10
10
  export default ({
@@ -13,7 +13,7 @@ export default ({
13
13
  form,
14
14
  onChange,
15
15
  ...props
16
- }: IVerificationCodeInputProps) => {
16
+ }: HVerificationCodeInputProps) => {
17
17
  const [countdown, setCountdown] = useState<number>(0);
18
18
  const timer = useMemo<{ time: any }>(() => {
19
19
  return {
@@ -10,6 +10,7 @@ export interface HInputProps<V = any>
10
10
  value?: V;
11
11
  defaultColor?: string;
12
12
  copy?: boolean;
13
+ addFormat?: (config: Record<string, addFormatItemModal>) => void;
13
14
  }
14
15
 
15
16
  interface ValueNameModal {
@@ -3,12 +3,15 @@ import { Space, Switch } from "antd";
3
3
  import React, { useMemo } from "react";
4
4
  import { useMatchConfigProps } from "../hooks";
5
5
  import type { ValueSwitchMapModal } from "../modal";
6
+ import type { addFormatItemModal } from "../Form/modal";
7
+ import HFormConnect from "../Form/HFormConnect";
6
8
 
7
9
  export interface HSwitchProps extends Omit<SwitchProps, "onChange"> {
8
10
  valueMap?: ValueSwitchMapModal;
9
11
  value?: any;
10
12
  onChange?: (val: any) => void;
11
13
  beforeText?: React.ReactNode;
14
+ addFormat?: (format: Record<string, addFormatItemModal>) => void;
12
15
  }
13
16
  const Index: React.FC<HSwitchProps> = ({
14
17
  value,
@@ -18,6 +21,7 @@ const Index: React.FC<HSwitchProps> = ({
18
21
  unCheckedChildren = "关闭",
19
22
  checkedChildren = "开启",
20
23
  beforeText,
24
+ addFormat,
21
25
  ...props
22
26
  }) => {
23
27
  const { valueSwitchMap = {} } = useMatchConfigProps({
@@ -34,6 +38,28 @@ const Index: React.FC<HSwitchProps> = ({
34
38
  }
35
39
  onChange?.(subVal);
36
40
  };
41
+ addFormat?.({
42
+ float: {
43
+ inputValue: (item, initValue) => {
44
+ const { close } = valueSwitchMap;
45
+ const { name: valueName = "" } = item;
46
+ let val = initValue[valueName];
47
+ if (typeof val === "undefined" || val === null) {
48
+ val = close;
49
+ }
50
+ console.log(val, "");
51
+ return {
52
+ [valueName]: val,
53
+ };
54
+ },
55
+ outputValue: (item, outputValue) => {
56
+ const { name = "" } = item;
57
+ return {
58
+ [name]: outputValue[name],
59
+ };
60
+ },
61
+ },
62
+ });
37
63
  return (
38
64
  <Space>
39
65
  {beforeText}
@@ -49,4 +75,4 @@ const Index: React.FC<HSwitchProps> = ({
49
75
  );
50
76
  };
51
77
 
52
- export default Index;
78
+ export default HFormConnect(Index);
@@ -0,0 +1,30 @@
1
+ import TextArea from "./index";
2
+ import type { TextAreaProps } from "antd/es/input";
3
+ import type { addFormatItemModal } from "../Form/modal";
4
+ import HFormConnect from "../Form/HFormConnect";
5
+
6
+ interface TrimTextAreaProps extends TextAreaProps {
7
+ addFormat?: (config: Record<string, addFormatItemModal>) => void;
8
+ }
9
+ const Index = ({ addFormat, ...props }: TrimTextAreaProps) => {
10
+ addFormat?.({
11
+ float: {
12
+ inputValue: (item, initValue) => {
13
+ const { name: valueName = "" } = item;
14
+ return {
15
+ [valueName]: initValue[valueName],
16
+ };
17
+ },
18
+ outputValue: (item, outputValue) => {
19
+ const { name = "" } = item;
20
+ const { [name]: itemVal } = outputValue;
21
+ return {
22
+ [name]: itemVal?.trim(),
23
+ };
24
+ },
25
+ },
26
+ });
27
+ return <TextArea {...props} />;
28
+ };
29
+
30
+ export default HFormConnect(Index);
@@ -29,4 +29,9 @@ export const HColorInput = FormConfig.colorInput;
29
29
  export const HModalForm = ModalForm;
30
30
  export const HDrawerForm = DrawerForm;
31
31
  export const HCascader = FormConfig.cascader;
32
+ // @ts-ignore
32
33
  export const HVerificationCodeInput = FormConfig.verificationCodeInput;
34
+
35
+ export const HTrimInput = FormConfig.trimInput;
36
+
37
+ export const HTrimTextArea = FormConfig.trimTextArea;
@@ -82,6 +82,12 @@ const formData = (options) => {
82
82
  name: "switch",
83
83
  type: "switch",
84
84
  rules: [{ required: true }],
85
+ itemProps: {
86
+ valueMap: {
87
+ open: 1,
88
+ close: 0,
89
+ },
90
+ },
85
91
  },
86
92
  {
87
93
  label: "时间",
@@ -170,6 +176,16 @@ const formData = (options) => {
170
176
  },
171
177
  },
172
178
  },
179
+ {
180
+ label: "去空input",
181
+ type: "trimInput",
182
+ name: "trimInput",
183
+ },
184
+ {
185
+ label: "去空textArea",
186
+ type: "trimTextArea",
187
+ name: "trimTextArea",
188
+ },
173
189
  {
174
190
  type: "submit",
175
191
  },
@@ -201,6 +217,8 @@ export default () => {
201
217
  form={form}
202
218
  initialValues={{
203
219
  name: "fff",
220
+ trimInput: "trimInput",
221
+ trimTextArea: "trimTextArea",
204
222
  }}
205
223
  itemSpan={{ span: 12 }}
206
224
  onFinish={(value) => {
@@ -219,6 +237,8 @@ export default () => {
219
237
  colorInput: "rgba(24, 144, 255,1)",
220
238
  upload:
221
239
  "https://img2.baidu.com/it/u=2048195462,703560066&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=333",
240
+ trimInput: "trimInput",
241
+ trimTextArea: "trimTextArea",
222
242
  });
223
243
  }, 3000);
224
244
  });
@@ -176,11 +176,13 @@ export default () => {
176
176
  configData={data}
177
177
  labelWidth={88}
178
178
  autoClear={false}
179
- contentRender={(node,form)=>{
180
- return <div>
181
- <div>测试一些</div>
182
- {node}
183
- </div>
179
+ contentRender={(node, form) => {
180
+ return (
181
+ <div>
182
+ <div>测试一些</div>
183
+ {node}
184
+ </div>
185
+ );
184
186
  }}
185
187
  request={(val, params) => {
186
188
  console.log(val, params);