@hw-component/form 1.9.41 → 1.9.42

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.
@@ -37,29 +37,28 @@ var HFormConnect = (function (component) {
37
37
  form = _useFormContext.form,
38
38
  _useFormContext$value = _useFormContext.valueType,
39
39
  valueType = _useFormContext$value === void 0 ? "float" : _useFormContext$value;
40
+ var name = props.name;
41
+ var relName = Array.isArray(name) ? name.join(".") : name;
40
42
  useEffect(function () {
41
- var name = props.name;
42
- if (!name) {
43
+ if (!relName) {
43
44
  return;
44
45
  }
45
- form === null || form === void 0 || form.addFormat(name, formatMaker(props, format[valueType]));
46
+ form === null || form === void 0 || form.addFormat(relName, formatMaker(props, format[valueType]));
46
47
  }, [valueType, props]);
47
48
  var addFormat = function addFormat(aFormat) {
48
- var name = props.name;
49
- if (!name) {
49
+ if (!relName) {
50
50
  return;
51
51
  }
52
- form === null || form === void 0 || form.addFormat(name, formatMaker(props, aFormat[valueType]));
52
+ form === null || form === void 0 || form.addFormat(relName, formatMaker(props, aFormat[valueType]));
53
53
  };
54
54
  var addDispatchListener = function addDispatchListener(key, fn) {
55
- var name = props.name,
56
- dispatch = props.dispatch;
57
- if (!name) {
55
+ var dispatch = props.dispatch;
56
+ if (!relName) {
58
57
  return;
59
58
  }
60
59
  form === null || form === void 0 || form.addDispatchListener({
61
60
  key: key,
62
- name: name,
61
+ name: relName,
63
62
  dispatch: dispatch
64
63
  }, fn);
65
64
  };
@@ -35,10 +35,7 @@ declare const componentConfig: {
35
35
  Component: import("react").ForwardRefExoticComponent<import("./modal").HFormItemProps & import("react").RefAttributes<any>>;
36
36
  placeholder: ({ label }: import("./modal").HItemProps) => string[];
37
37
  };
38
- treeSelect: ({ request, options, ...props }: {
39
- [x: string]: any;
40
- request: any;
41
- options: any;
42
- }) => JSX.Element;
38
+ treeSelect: ({ request, onlyCheckChild, multiple, treeCheckable, treeData, fieldNames, ...props }: import("../Select/TreeSelect").HTreeSelectProps) => JSX.Element;
39
+ text: ({ value }: import("antd").FormItemProps) => JSX.Element;
43
40
  };
44
41
  export default componentConfig;
package/es/Form/config.js CHANGED
@@ -22,6 +22,7 @@ import VerificationCodeInput from '../Input/VerificationCodeInput/index.js';
22
22
  import TrimInput from '../Input/TrimInput.js';
23
23
  import TrimTextArea from '../TextArea/TrimTextArea.js';
24
24
  import HInputNumberGroup from '../Input/InputNumberGroup.js';
25
+ import HText from '../Text/index.js';
25
26
 
26
27
  var placeholderConfig = {
27
28
  inputType: ["input", "inputNumber", "selectInput", "buttonInput", "verificationCodeInput", "trimInput", "urlUpload", "textArea"],
@@ -50,7 +51,8 @@ var componentConfig = {
50
51
  trimInput: TrimInput,
51
52
  trimTextArea: TrimTextArea,
52
53
  inputNumberGroup: HInputNumberGroup,
53
- treeSelect: HTreeSelect
54
+ treeSelect: HTreeSelect,
55
+ text: HText
54
56
  };
55
57
 
56
58
  export { componentConfig as default, placeholderConfig };
@@ -1,8 +1,8 @@
1
1
  import { TreeSelectProps } from "antd/lib/tree-select";
2
2
  import { PromiseFnResult } from "../modal";
3
- interface IProps extends TreeSelectProps {
3
+ export interface HTreeSelectProps extends TreeSelectProps {
4
4
  request?: PromiseFnResult;
5
5
  onlyCheckChild?: boolean;
6
6
  }
7
- declare const _default: ({ request, onlyCheckChild, multiple, treeCheckable, treeData, fieldNames, ...props }: IProps) => JSX.Element;
7
+ declare const _default: ({ request, onlyCheckChild, multiple, treeCheckable, treeData, fieldNames, ...props }: HTreeSelectProps) => JSX.Element;
8
8
  export default _default;
@@ -0,0 +1,3 @@
1
+ import { HFormItemProps } from "../Form/modal";
2
+ declare const _default: ({ value }: HFormItemProps) => JSX.Element;
3
+ export default _default;
@@ -0,0 +1,13 @@
1
+ // welcome to hoo hoo hoo
2
+ import { jsx } from 'react/jsx-runtime';
3
+ import { Typography } from 'antd';
4
+
5
+ var HText = (function (_ref) {
6
+ var value = _ref.value;
7
+ return jsx(Typography.Text, {
8
+ children: value
9
+ });
10
+ });
11
+
12
+ export { HText as default };
13
+ // powered by hdj
@@ -40,29 +40,28 @@ var HFormConnect = (function (component) {
40
40
  form = _useFormContext.form,
41
41
  _useFormContext$value = _useFormContext.valueType,
42
42
  valueType = _useFormContext$value === void 0 ? "float" : _useFormContext$value;
43
+ var name = props.name;
44
+ var relName = Array.isArray(name) ? name.join(".") : name;
43
45
  React.useEffect(function () {
44
- var name = props.name;
45
- if (!name) {
46
+ if (!relName) {
46
47
  return;
47
48
  }
48
- form === null || form === void 0 || form.addFormat(name, formatMaker(props, format[valueType]));
49
+ form === null || form === void 0 || form.addFormat(relName, formatMaker(props, format[valueType]));
49
50
  }, [valueType, props]);
50
51
  var addFormat = function addFormat(aFormat) {
51
- var name = props.name;
52
- if (!name) {
52
+ if (!relName) {
53
53
  return;
54
54
  }
55
- form === null || form === void 0 || form.addFormat(name, formatMaker(props, aFormat[valueType]));
55
+ form === null || form === void 0 || form.addFormat(relName, formatMaker(props, aFormat[valueType]));
56
56
  };
57
57
  var addDispatchListener = function addDispatchListener(key, fn) {
58
- var name = props.name,
59
- dispatch = props.dispatch;
60
- if (!name) {
58
+ var dispatch = props.dispatch;
59
+ if (!relName) {
61
60
  return;
62
61
  }
63
62
  form === null || form === void 0 || form.addDispatchListener({
64
63
  key: key,
65
- name: name,
64
+ name: relName,
66
65
  dispatch: dispatch
67
66
  }, fn);
68
67
  };
@@ -35,10 +35,7 @@ declare const componentConfig: {
35
35
  Component: import("react").ForwardRefExoticComponent<import("./modal").HFormItemProps & import("react").RefAttributes<any>>;
36
36
  placeholder: ({ label }: import("./modal").HItemProps) => string[];
37
37
  };
38
- treeSelect: ({ request, options, ...props }: {
39
- [x: string]: any;
40
- request: any;
41
- options: any;
42
- }) => JSX.Element;
38
+ treeSelect: ({ request, onlyCheckChild, multiple, treeCheckable, treeData, fieldNames, ...props }: import("../Select/TreeSelect").HTreeSelectProps) => JSX.Element;
39
+ text: ({ value }: import("antd").FormItemProps) => JSX.Element;
43
40
  };
44
41
  export default componentConfig;
@@ -25,6 +25,7 @@ var index$d = require('../Input/VerificationCodeInput/index.js');
25
25
  var TrimInput = require('../Input/TrimInput.js');
26
26
  var TrimTextArea = require('../TextArea/TrimTextArea.js');
27
27
  var InputNumberGroup = require('../Input/InputNumberGroup.js');
28
+ var index$e = require('../Text/index.js');
28
29
 
29
30
  var placeholderConfig = {
30
31
  inputType: ["input", "inputNumber", "selectInput", "buttonInput", "verificationCodeInput", "trimInput", "urlUpload", "textArea"],
@@ -53,7 +54,8 @@ var componentConfig = {
53
54
  trimInput: TrimInput.default,
54
55
  trimTextArea: TrimTextArea.default,
55
56
  inputNumberGroup: InputNumberGroup.default,
56
- treeSelect: TreeSelect.default
57
+ treeSelect: TreeSelect.default,
58
+ text: index$e.default
57
59
  };
58
60
 
59
61
  exports.default = componentConfig;
@@ -1,8 +1,8 @@
1
1
  import { TreeSelectProps } from "antd/lib/tree-select";
2
2
  import { PromiseFnResult } from "../modal";
3
- interface IProps extends TreeSelectProps {
3
+ export interface HTreeSelectProps extends TreeSelectProps {
4
4
  request?: PromiseFnResult;
5
5
  onlyCheckChild?: boolean;
6
6
  }
7
- declare const _default: ({ request, onlyCheckChild, multiple, treeCheckable, treeData, fieldNames, ...props }: IProps) => JSX.Element;
7
+ declare const _default: ({ request, onlyCheckChild, multiple, treeCheckable, treeData, fieldNames, ...props }: HTreeSelectProps) => JSX.Element;
8
8
  export default _default;
@@ -0,0 +1,3 @@
1
+ import { HFormItemProps } from "../Form/modal";
2
+ declare const _default: ({ value }: HFormItemProps) => JSX.Element;
3
+ export default _default;
@@ -0,0 +1,16 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var jsxRuntime = require('react/jsx-runtime');
6
+ var antd = require('antd');
7
+
8
+ var HText = (function (_ref) {
9
+ var value = _ref.value;
10
+ return jsxRuntime.jsx(antd.Typography.Text, {
11
+ children: value
12
+ });
13
+ });
14
+
15
+ exports.default = HText;
16
+ // powered by h
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hw-component/form",
3
- "version": "1.9.41",
3
+ "version": "1.9.42",
4
4
  "description": "基于antd二次开发",
5
5
  "repository": {
6
6
  "type": "git",
@@ -43,15 +43,15 @@ const Index = ({
43
43
  resultObj[key] = initValue[key];
44
44
  });
45
45
  return {
46
- [name]: resultObj,
46
+ [(name as string)]: resultObj,
47
47
  };
48
48
  },
49
49
  outputValue: (item, outputValue) => {
50
50
  const { name = "" } = item;
51
- const { [name]: itemVal = {} } = outputValue;
51
+ const { [(name as string)]: itemVal = {} } = outputValue;
52
52
  if (Array.isArray(itemVal)) {
53
53
  return {
54
- [name]: itemVal,
54
+ [(name as string)]: itemVal,
55
55
  };
56
56
  }
57
57
  return {
@@ -44,27 +44,26 @@ export default (
44
44
  ref
45
45
  ) => {
46
46
  const { form, valueType = "float" } = useFormContext();
47
-
47
+ const { name } = props;
48
+ const relName=Array.isArray(name)?name.join("."):name;
48
49
  useEffect(() => {
49
- const { name } = props;
50
- if (!name) {
50
+ if (!relName) {
51
51
  return;
52
52
  }
53
- form?.addFormat(name, formatMaker(props, format[valueType]));
53
+ form?.addFormat(relName, formatMaker(props, format[valueType]));
54
54
  }, [valueType, props]);
55
55
  const addFormat = (aFormat: Record<string, addFormatItemModal>) => {
56
- const { name } = props;
57
- if (!name) {
56
+ if (!relName) {
58
57
  return;
59
58
  }
60
- form?.addFormat(name, formatMaker(props, aFormat[valueType]));
59
+ form?.addFormat(relName, formatMaker(props, aFormat[valueType]));
61
60
  };
62
61
  const addDispatchListener = (key: string, fn: argsFn) => {
63
- const { name, dispatch } = props;
64
- if (!name) {
62
+ const {dispatch } = props;
63
+ if (!relName) {
65
64
  return;
66
65
  }
67
- form?.addDispatchListener({ key, name, dispatch }, fn);
66
+ form?.addDispatchListener({ key, name:relName, dispatch }, fn);
68
67
  };
69
68
  const Component = component as React.ForwardRefRenderFunction<
70
69
  any,
@@ -21,6 +21,7 @@ import VerificationCodeInput from "../Input/VerificationCodeInput";
21
21
  import TrimInput from "../Input/TrimInput";
22
22
  import TrimTextArea from "../TextArea/TrimTextArea";
23
23
  import HInputNumberGroup from "../Input/InputNumberGroup";
24
+ import HText from '../Text'
24
25
  export const placeholderConfig = {
25
26
  inputType: [
26
27
  "input",
@@ -64,6 +65,7 @@ const componentConfig = {
64
65
  trimTextArea: TrimTextArea,
65
66
  inputNumberGroup: HInputNumberGroup,
66
67
  treeSelect: HTreeSelect,
68
+ text: HText,
67
69
  };
68
70
 
69
71
  export default componentConfig;
@@ -80,11 +80,11 @@ const InputNumberGroup = ({
80
80
  inputValue: (item, initValue) => {
81
81
  const { name: valueName = "" } = item;
82
82
  const { min: minKey, max: maxKey } = valueMap;
83
- const cuValue = initValue[valueName];
83
+ const cuValue = initValue[(valueName as string)];
84
84
  const minInitVal = initValue[minKey];
85
85
  const maxInitVal = initValue[maxKey];
86
86
  return {
87
- [valueName]: {
87
+ [(valueName as string)]: {
88
88
  [min]: minInitVal,
89
89
  [max]: maxInitVal,
90
90
  ...cuValue,
@@ -93,7 +93,7 @@ const InputNumberGroup = ({
93
93
  },
94
94
  outputValue: (item, outputValue) => {
95
95
  const { name: valueName = "" } = item;
96
- const { [valueName]: itemVal = {} } = outputValue;
96
+ const { [(valueName as string)]: itemVal = {} } = outputValue;
97
97
  const { min: minKey, max: maxKey } = valueMap;
98
98
  const {
99
99
  [minKey]: minSubVal,
@@ -103,7 +103,7 @@ const InputNumberGroup = ({
103
103
  return {
104
104
  [maxKey]: maxSubVal,
105
105
  [minKey]: minSubVal,
106
- [valueName]: oItemVal,
106
+ [(valueName as string)]: oItemVal,
107
107
  };
108
108
  },
109
109
  },
@@ -38,12 +38,12 @@ export const Index = ({
38
38
  resultObj[key] = initValue[key];
39
39
  });
40
40
  return {
41
- [name]: resultObj,
41
+ [(name as string)]: resultObj,
42
42
  };
43
43
  },
44
44
  outputValue: (item, outputValue) => {
45
45
  const { name = "" } = item;
46
- const { [name]: itemVal = {} } = outputValue;
46
+ const { [(name as string)]: itemVal = {} } = outputValue;
47
47
  const newItemVal = { [itemVal[select]]: itemVal[input] };
48
48
  return {
49
49
  ...newItemVal,
@@ -8,14 +8,14 @@ const Index = ({ addFormat, ...props }: HInputProps) => {
8
8
  inputValue: (item, initValue) => {
9
9
  const { name: valueName = "" } = item;
10
10
  return {
11
- [valueName]: initValue[valueName],
11
+ [(valueName as string)]: initValue[(valueName as string)],
12
12
  };
13
13
  },
14
14
  outputValue: (item, outputValue) => {
15
15
  const { name = "" } = item;
16
- const { [name]: itemVal } = outputValue;
16
+ const { [(name as string)]: itemVal } = outputValue;
17
17
  return {
18
- [name]: itemVal?.trim(),
18
+ [(name as string)]: itemVal?.trim(),
19
19
  };
20
20
  },
21
21
  },
@@ -2,7 +2,7 @@ import { TreeSelect } from "antd";
2
2
  import { TreeSelectProps } from "antd/lib/tree-select";
3
3
  import { PromiseFnResult } from "../modal";
4
4
  import { useRequest } from "ahooks";
5
- interface IProps extends TreeSelectProps {
5
+ export interface HTreeSelectProps extends TreeSelectProps {
6
6
  request?: PromiseFnResult;
7
7
  onlyCheckChild?:boolean;
8
8
  }
@@ -29,7 +29,7 @@ const opMk=({options,onlyCheckChild=false,fieldNames}:OpMkParamsModal)=>{
29
29
  }
30
30
  })
31
31
  }
32
- export default ({ request,onlyCheckChild,multiple,treeCheckable,treeData,fieldNames, ...props }: IProps) => {
32
+ export default ({ request,onlyCheckChild,multiple,treeCheckable,treeData,fieldNames, ...props }: HTreeSelectProps) => {
33
33
  const { loading, data } = useRequest(async () => {
34
34
  let options=treeData;
35
35
  if (request) {
@@ -56,18 +56,18 @@ const Index: React.FC<HSwitchProps> = ({
56
56
  inputValue: (item, initValue) => {
57
57
  const { close } = valueSwitchMap;
58
58
  const { name: valueName = "" } = item;
59
- let val = initValue[valueName];
59
+ let val = initValue[(valueName as string)];
60
60
  if (typeof val === "undefined" || val === null) {
61
61
  val = close;
62
62
  }
63
63
  return {
64
- [valueName]: val,
64
+ [(valueName as string)]: val,
65
65
  };
66
66
  },
67
67
  outputValue: (item, outputValue) => {
68
68
  const { name = "" } = item;
69
69
  return {
70
- [name]: outputValue[name],
70
+ [(name as string)]: outputValue[(name as string)],
71
71
  };
72
72
  },
73
73
  },
@@ -62,12 +62,12 @@ const HRangePicker: React.FC<HRangePickerProps> = ({
62
62
  });
63
63
  const hasKeys = Object.keys(resultObj).length !== 0;
64
64
  return {
65
- [valueName]: hasKeys ? resultObj : null,
65
+ [(valueName as string)]: hasKeys ? resultObj : null,
66
66
  };
67
67
  },
68
68
  outputValue: (item, outputValue) => {
69
69
  const { name: valueName = "" } = item;
70
- const { [valueName]: itemVal = {} } = outputValue;
70
+ const { [(valueName as string)]: itemVal = {} } = outputValue;
71
71
  return {
72
72
  ...itemVal,
73
73
  };
@@ -0,0 +1,6 @@
1
+ import {Typography} from "antd";
2
+ import {HFormItemProps} from "../Form/modal";
3
+
4
+ export default ({value}:HFormItemProps)=>{
5
+ return <Typography.Text>{value}</Typography.Text>
6
+ }
@@ -12,14 +12,14 @@ const Index = ({ addFormat, ...props }: TrimTextAreaProps) => {
12
12
  inputValue: (item, initValue) => {
13
13
  const { name: valueName = "" } = item;
14
14
  return {
15
- [valueName]: initValue[valueName],
15
+ [(valueName as string)]: initValue[(valueName as string)],
16
16
  };
17
17
  },
18
18
  outputValue: (item, outputValue) => {
19
19
  const { name = "" } = item;
20
- const { [name]: itemVal } = outputValue;
20
+ const { [(name as string)]: itemVal } = outputValue;
21
21
  return {
22
- [name]: itemVal?.trim(),
22
+ [(name as string)]: itemVal?.trim(),
23
23
  };
24
24
  },
25
25
  },
@@ -63,7 +63,7 @@ const Index: React.ForwardRefRenderFunction<IUploadRefModal, IUpLoadProps> = (
63
63
  float: {
64
64
  inputValue: (item, initValue) => {
65
65
  const { name = "" } = item;
66
- const initFileList = initValue[name] || [];
66
+ const initFileList = initValue[(name as string)] || [];
67
67
  const relInitFileList =
68
68
  typeof initFileList === "string" ? [initFileList] : initFileList;
69
69
  const fileList = relInitFileList.map((itemData, index) => {
@@ -81,17 +81,17 @@ const Index: React.ForwardRefRenderFunction<IUploadRefModal, IUpLoadProps> = (
81
81
  return { ...itemData };
82
82
  });
83
83
  return {
84
- [name]: fileList,
84
+ [(name as string)]: fileList,
85
85
  };
86
86
  },
87
87
  outputValue: (item, outputValue) => {
88
88
  const { name: valueName = "" } = item;
89
- const { [valueName]: itemVal = [] } = outputValue;
89
+ const { [(valueName as string)]: itemVal = [] } = outputValue;
90
90
  const urls = itemVal.map((fileItem) => {
91
91
  return fileItem.response.url;
92
92
  });
93
93
  return {
94
- [valueName]: maxCount === 1 ? urls[0] : urls,
94
+ [(valueName as string)]: maxCount === 1 ? urls[0] : urls,
95
95
  };
96
96
  },
97
97
  },