@hw-component/form 0.0.9-beta-v3 → 0.0.9-beta-v5

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.
@@ -27,7 +27,8 @@ var Index = function Index(_ref) {
27
27
  disabled = _ref.disabled,
28
28
  _ref$keyInValue = _ref.keyInValue,
29
29
  keyInValue = _ref$keyInValue === void 0 ? true : _ref$keyInValue,
30
- addFormat = _ref.addFormat;
30
+ addFormat = _ref.addFormat,
31
+ direction = _ref.direction;
31
32
  var _useMatchConfigProps = useMatchConfigProps({
32
33
  fieldNames: fieldNames,
33
34
  valueCheckMap: valueMap
@@ -74,6 +75,7 @@ var Index = function Index(_ref) {
74
75
  }
75
76
  });
76
77
  return jsx(Space, {
78
+ direction: direction,
77
79
  children: checkOptions === null || checkOptions === void 0 ? void 0 : checkOptions.map(function (item) {
78
80
  var label = item.label,
79
81
  itemVal = item.value;
@@ -11,4 +11,5 @@ export interface HCheckboxProps extends Omit<CheckboxProps, "value" | "onChange"
11
11
  onChange?: (value: Record<string, any> | any[]) => void;
12
12
  addFormat?: (config: Record<string, addFormatItemModal>) => void;
13
13
  subParams?: (formatValue: Record<string, any>, sourceValue: any[]) => any;
14
+ direction?: "horizontal" | "vertical";
14
15
  }
@@ -19,7 +19,7 @@ import { useFormContext } from '../Context/index.js';
19
19
  import { useDefaultRender } from '../hooks/useDefaultRender.js';
20
20
  import { useDefaultComponents } from '../hooks/index.js';
21
21
 
22
- var _excluded = ["hover", "labelWidth", "required", "colon", "label", "itemProps", "children", "helper", "hide", "render", "itemSpan"];
22
+ var _excluded = ["hover", "labelWidth", "required", "colon", "label", "itemProps", "children", "helper", "hide", "render", "itemSpan", "hideLabel"];
23
23
  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; }
24
24
  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; }
25
25
  var Content = function Content(_ref) {
@@ -62,6 +62,8 @@ var Index = function Index(props) {
62
62
  itemSpan = _props$itemSpan === void 0 ? {
63
63
  span: 24
64
64
  } : _props$itemSpan,
65
+ _props$hideLabel = props.hideLabel,
66
+ hideLabel = _props$hideLabel === void 0 ? false : _props$hideLabel,
65
67
  oProps = _objectWithoutProperties(props, _excluded);
66
68
  var _useFormContext = useFormContext(),
67
69
  form = _useFormContext.form;
@@ -76,7 +78,7 @@ var Index = function Index(props) {
76
78
  }
77
79
  return jsx(Col, _objectSpread(_objectSpread({}, itemSpan), {}, {
78
80
  children: jsx(Form.Item, _objectSpread(_objectSpread({
79
- label: jsx(Index$1, {
81
+ label: !hideLabel && jsx(Index$1, {
80
82
  hover: hover,
81
83
  labelWidth: labelWidth,
82
84
  required: required,
@@ -1,3 +1,3 @@
1
1
  import type { HFormProps } from "./modal";
2
- declare const _default: ({ configData, labelWidth, form, request, onFinish, infoRequest, valueType, initialValues, params, onValuesChange, itemSpan, ...props }: HFormProps) => JSX.Element;
2
+ declare const _default: ({ configData, labelWidth, form, request, onFinish, infoRequest, valueType, initialValues, params, onValuesChange, itemSpan, hideLabel: formHideLabel, ...props }: HFormProps) => JSX.Element;
3
3
  export default _default;
package/es/Form/index.js CHANGED
@@ -19,7 +19,7 @@ import Index from '../PageHandler/index.js';
19
19
  import useInitConfigData from './hooks/useInitConfigData.js';
20
20
  import InitSet from './InitSet.js';
21
21
 
22
- var _excluded = ["configData", "labelWidth", "form", "request", "onFinish", "infoRequest", "valueType", "initialValues", "params", "onValuesChange", "itemSpan"];
22
+ var _excluded = ["configData", "labelWidth", "form", "request", "onFinish", "infoRequest", "valueType", "initialValues", "params", "onValuesChange", "itemSpan", "hideLabel"];
23
23
  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; }
24
24
  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; }
25
25
  var HForm = (function (_ref) {
@@ -36,6 +36,8 @@ var HForm = (function (_ref) {
36
36
  params = _ref$params === void 0 ? {} : _ref$params,
37
37
  onValuesChange = _ref.onValuesChange,
38
38
  itemSpan = _ref.itemSpan,
39
+ _ref$hideLabel = _ref.hideLabel,
40
+ formHideLabel = _ref$hideLabel === void 0 ? false : _ref$hideLabel,
39
41
  props = _objectWithoutProperties(_ref, _excluded);
40
42
  var hForm = useCurrentForm(form);
41
43
  var _useInitConfigData = useInitConfigData({
@@ -89,9 +91,12 @@ var HForm = (function (_ref) {
89
91
  }, props), {}, {
90
92
  children: [jsx(Row, {
91
93
  children: newConfigData.map(function (itemData, index) {
92
- var itemLabelWidth = itemData.labelWidth;
94
+ var itemLabelWidth = itemData.labelWidth,
95
+ _itemData$hideLabel = itemData.hideLabel,
96
+ hideLabel = _itemData$hideLabel === void 0 ? formHideLabel : _itemData$hideLabel;
93
97
  return /*#__PURE__*/createElement(Item, _objectSpread(_objectSpread({}, itemData), {}, {
94
98
  key: index,
99
+ hideLabel: hideLabel,
95
100
  itemSpan: itemSpan,
96
101
  labelWidth: itemLabelWidth || labelWidth
97
102
  }));
@@ -43,6 +43,7 @@ export interface HItemProps extends Omit<FormItemProps, "name"> {
43
43
  name?: string;
44
44
  dispatch?: DispatchModal;
45
45
  itemSpan?: ColProps;
46
+ hideLabel?: boolean;
46
47
  }
47
48
  export interface HFormProps<T = any, R = any> extends Omit<FormProps, "form" | "onFinish"> {
48
49
  configData: HItemProps[];
@@ -54,6 +55,7 @@ export interface HFormProps<T = any, R = any> extends Omit<FormProps, "form" | "
54
55
  params?: any;
55
56
  onFinish?: (values: T, params?: any) => void;
56
57
  itemSpan?: ColProps;
58
+ hideLabel?: boolean;
57
59
  }
58
60
  export interface HFormItemProps extends HItemProps {
59
61
  required?: boolean;
@@ -13,7 +13,7 @@ import { DatePicker } from 'antd';
13
13
  import { useTimeVal, useTimeChange } from './hooks.js';
14
14
  import HFormConnect from '../Form/HFormConnect.js';
15
15
 
16
- var _excluded = ["value", "onChange", "showTime", "format", "disabledDate", "addFormat"];
16
+ var _excluded = ["value", "onChange", "showTime", "format", "disabledDate", "addFormat", "style"];
17
17
  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
18
  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
19
  var Picker = DatePicker;
@@ -26,6 +26,10 @@ var Index = function Index(_ref) {
26
26
  format = _ref$format === void 0 ? "X" : _ref$format,
27
27
  _disabledDate = _ref.disabledDate,
28
28
  addFormat = _ref.addFormat,
29
+ _ref$style = _ref.style,
30
+ style = _ref$style === void 0 ? {
31
+ width: "100%"
32
+ } : _ref$style,
29
33
  props = _objectWithoutProperties(_ref, _excluded);
30
34
  addFormat === null || addFormat === void 0 || addFormat({});
31
35
  var timeVal = useTimeVal({
@@ -40,6 +44,7 @@ var Index = function Index(_ref) {
40
44
  value: timeVal,
41
45
  onChange: change,
42
46
  showTime: showTime,
47
+ style: style,
43
48
  disabledDate: function disabledDate(currentDate) {
44
49
  return !!(_disabledDate !== null && _disabledDate !== void 0 && _disabledDate(currentDate, timeVal));
45
50
  }
@@ -30,7 +30,8 @@ var Index = function Index(_ref) {
30
30
  disabled = _ref.disabled,
31
31
  _ref$keyInValue = _ref.keyInValue,
32
32
  keyInValue = _ref$keyInValue === void 0 ? true : _ref$keyInValue,
33
- addFormat = _ref.addFormat;
33
+ addFormat = _ref.addFormat,
34
+ direction = _ref.direction;
34
35
  var _useMatchConfigProps = index.useMatchConfigProps({
35
36
  fieldNames: fieldNames,
36
37
  valueCheckMap: valueMap
@@ -77,6 +78,7 @@ var Index = function Index(_ref) {
77
78
  }
78
79
  });
79
80
  return jsxRuntime.jsx(antd.Space, {
81
+ direction: direction,
80
82
  children: checkOptions === null || checkOptions === void 0 ? void 0 : checkOptions.map(function (item) {
81
83
  var label = item.label,
82
84
  itemVal = item.value;
@@ -11,4 +11,5 @@ export interface HCheckboxProps extends Omit<CheckboxProps, "value" | "onChange"
11
11
  onChange?: (value: Record<string, any> | any[]) => void;
12
12
  addFormat?: (config: Record<string, addFormatItemModal>) => void;
13
13
  subParams?: (formatValue: Record<string, any>, sourceValue: any[]) => any;
14
+ direction?: "horizontal" | "vertical";
14
15
  }
@@ -22,7 +22,7 @@ var index = require('../Context/index.js');
22
22
  var useDefaultRender = require('../hooks/useDefaultRender.js');
23
23
  var index$1 = require('../hooks/index.js');
24
24
 
25
- var _excluded = ["hover", "labelWidth", "required", "colon", "label", "itemProps", "children", "helper", "hide", "render", "itemSpan"];
25
+ var _excluded = ["hover", "labelWidth", "required", "colon", "label", "itemProps", "children", "helper", "hide", "render", "itemSpan", "hideLabel"];
26
26
  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; }
27
27
  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; }
28
28
  var Content = function Content(_ref) {
@@ -65,6 +65,8 @@ var Index = function Index(props) {
65
65
  itemSpan = _props$itemSpan === void 0 ? {
66
66
  span: 24
67
67
  } : _props$itemSpan,
68
+ _props$hideLabel = props.hideLabel,
69
+ hideLabel = _props$hideLabel === void 0 ? false : _props$hideLabel,
68
70
  oProps = _objectWithoutProperties(props, _excluded);
69
71
  var _useFormContext = index.useFormContext(),
70
72
  form = _useFormContext.form;
@@ -79,7 +81,7 @@ var Index = function Index(props) {
79
81
  }
80
82
  return jsxRuntime.jsx(antd.Col, _objectSpread(_objectSpread({}, itemSpan), {}, {
81
83
  children: jsxRuntime.jsx(antd.Form.Item, _objectSpread(_objectSpread({
82
- label: jsxRuntime.jsx(Label.default, {
84
+ label: !hideLabel && jsxRuntime.jsx(Label.default, {
83
85
  hover: hover,
84
86
  labelWidth: labelWidth,
85
87
  required: required,
@@ -1,3 +1,3 @@
1
1
  import type { HFormProps } from "./modal";
2
- declare const _default: ({ configData, labelWidth, form, request, onFinish, infoRequest, valueType, initialValues, params, onValuesChange, itemSpan, ...props }: HFormProps) => JSX.Element;
2
+ declare const _default: ({ configData, labelWidth, form, request, onFinish, infoRequest, valueType, initialValues, params, onValuesChange, itemSpan, hideLabel: formHideLabel, ...props }: HFormProps) => JSX.Element;
3
3
  export default _default;
package/lib/Form/index.js CHANGED
@@ -22,7 +22,7 @@ var index$1 = require('../PageHandler/index.js');
22
22
  var useInitConfigData = require('./hooks/useInitConfigData.js');
23
23
  var InitSet = require('./InitSet.js');
24
24
 
25
- var _excluded = ["configData", "labelWidth", "form", "request", "onFinish", "infoRequest", "valueType", "initialValues", "params", "onValuesChange", "itemSpan"];
25
+ var _excluded = ["configData", "labelWidth", "form", "request", "onFinish", "infoRequest", "valueType", "initialValues", "params", "onValuesChange", "itemSpan", "hideLabel"];
26
26
  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; }
27
27
  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; }
28
28
  var HForm = (function (_ref) {
@@ -39,6 +39,8 @@ var HForm = (function (_ref) {
39
39
  params = _ref$params === void 0 ? {} : _ref$params,
40
40
  onValuesChange = _ref.onValuesChange,
41
41
  itemSpan = _ref.itemSpan,
42
+ _ref$hideLabel = _ref.hideLabel,
43
+ formHideLabel = _ref$hideLabel === void 0 ? false : _ref$hideLabel,
42
44
  props = _objectWithoutProperties(_ref, _excluded);
43
45
  var hForm = index.useCurrentForm(form);
44
46
  var _useInitConfigData = useInitConfigData.default({
@@ -92,9 +94,12 @@ var HForm = (function (_ref) {
92
94
  }, props), {}, {
93
95
  children: [jsxRuntime.jsx(antd.Row, {
94
96
  children: newConfigData.map(function (itemData, index) {
95
- var itemLabelWidth = itemData.labelWidth;
97
+ var itemLabelWidth = itemData.labelWidth,
98
+ _itemData$hideLabel = itemData.hideLabel,
99
+ hideLabel = _itemData$hideLabel === void 0 ? formHideLabel : _itemData$hideLabel;
96
100
  return /*#__PURE__*/React.createElement(index$3.default, _objectSpread(_objectSpread({}, itemData), {}, {
97
101
  key: index,
102
+ hideLabel: hideLabel,
98
103
  itemSpan: itemSpan,
99
104
  labelWidth: itemLabelWidth || labelWidth
100
105
  }));
@@ -43,6 +43,7 @@ export interface HItemProps extends Omit<FormItemProps, "name"> {
43
43
  name?: string;
44
44
  dispatch?: DispatchModal;
45
45
  itemSpan?: ColProps;
46
+ hideLabel?: boolean;
46
47
  }
47
48
  export interface HFormProps<T = any, R = any> extends Omit<FormProps, "form" | "onFinish"> {
48
49
  configData: HItemProps[];
@@ -54,6 +55,7 @@ export interface HFormProps<T = any, R = any> extends Omit<FormProps, "form" | "
54
55
  params?: any;
55
56
  onFinish?: (values: T, params?: any) => void;
56
57
  itemSpan?: ColProps;
58
+ hideLabel?: boolean;
57
59
  }
58
60
  export interface HFormItemProps extends HItemProps {
59
61
  required?: boolean;
@@ -16,7 +16,7 @@ var antd = require('antd');
16
16
  var hooks = require('./hooks.js');
17
17
  var HFormConnect = require('../Form/HFormConnect.js');
18
18
 
19
- var _excluded = ["value", "onChange", "showTime", "format", "disabledDate", "addFormat"];
19
+ var _excluded = ["value", "onChange", "showTime", "format", "disabledDate", "addFormat", "style"];
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 Picker = antd.DatePicker;
@@ -29,6 +29,10 @@ var Index = function Index(_ref) {
29
29
  format = _ref$format === void 0 ? "X" : _ref$format,
30
30
  _disabledDate = _ref.disabledDate,
31
31
  addFormat = _ref.addFormat,
32
+ _ref$style = _ref.style,
33
+ style = _ref$style === void 0 ? {
34
+ width: "100%"
35
+ } : _ref$style,
32
36
  props = _objectWithoutProperties(_ref, _excluded);
33
37
  addFormat === null || addFormat === void 0 || addFormat({});
34
38
  var timeVal = hooks.useTimeVal({
@@ -43,6 +47,7 @@ var Index = function Index(_ref) {
43
47
  value: timeVal,
44
48
  onChange: change,
45
49
  showTime: showTime,
50
+ style: style,
46
51
  disabledDate: function disabledDate(currentDate) {
47
52
  return !!(_disabledDate !== null && _disabledDate !== void 0 && _disabledDate(currentDate, timeVal));
48
53
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hw-component/form",
3
- "version": "0.0.9-beta-v3",
3
+ "version": "0.0.9-beta-v5",
4
4
  "description": "基于antd二次开发",
5
5
  "repository": {
6
6
  "type": "git",
@@ -15,6 +15,7 @@ const Index = ({
15
15
  disabled,
16
16
  keyInValue = true,
17
17
  addFormat,
18
+ direction,
18
19
  }: HCheckboxProps) => {
19
20
  const { valueCheckMap: resultValueCheckMap, fieldNames: resultFieldNames } =
20
21
  useMatchConfigProps({ fieldNames, valueCheckMap: valueMap }); //匹配全局
@@ -59,7 +60,7 @@ const Index = ({
59
60
  },
60
61
  });
61
62
  return (
62
- <Space>
63
+ <Space direction={direction}>
63
64
  {checkOptions?.map((item) => {
64
65
  const { label, value: itemVal } = item;
65
66
  const checked = val[itemVal];
@@ -13,4 +13,5 @@ export interface HCheckboxProps
13
13
  onChange?: (value: Record<string, any> | any[]) => void;
14
14
  addFormat?: (config: Record<string, addFormatItemModal>) => void;
15
15
  subParams?: (formatValue: Record<string, any>, sourceValue: any[]) => any;
16
+ direction?: "horizontal" | "vertical";
16
17
  }
@@ -44,6 +44,7 @@ const Index: React.FC<HFormItemProps> = (props) => {
44
44
  hide,
45
45
  render,
46
46
  itemSpan = { span: 24 },
47
+ hideLabel = false,
47
48
  ...oProps
48
49
  } = props;
49
50
  const { form } = useFormContext();
@@ -57,14 +58,16 @@ const Index: React.FC<HFormItemProps> = (props) => {
57
58
  <Col {...itemSpan}>
58
59
  <Form.Item
59
60
  label={
60
- <Label
61
- hover={hover}
62
- labelWidth={labelWidth}
63
- required={required}
64
- colon={colon}
65
- >
66
- {label}
67
- </Label>
61
+ !hideLabel && (
62
+ <Label
63
+ hover={hover}
64
+ labelWidth={labelWidth}
65
+ required={required}
66
+ colon={colon}
67
+ >
68
+ {label}
69
+ </Label>
70
+ )
68
71
  }
69
72
  {...oProps}
70
73
  colon={false}
@@ -16,7 +16,7 @@ export default () => {
16
16
  const initDispatch: Record<string, argsFn> = {};
17
17
  let cacheValues: Record<string, any> = {};
18
18
  let isLoading = false;
19
- let initSaveValue={};
19
+ let initSaveValue = {};
20
20
  const norAddItemDispatch = (name, manual, fn) => {
21
21
  if (manual === false && name) {
22
22
  initDispatch[name] = fn;
@@ -42,7 +42,7 @@ export default () => {
42
42
  let newValue = {};
43
43
  if (cacheValues) {
44
44
  newValue = this.formatValues(cacheValues);
45
- initSaveValue=newValue;
45
+ initSaveValue = newValue;
46
46
  form.setFieldsValue(newValue);
47
47
  }
48
48
  const initKeys = Object.keys(initDispatch);
@@ -161,17 +161,17 @@ export default () => {
161
161
  });
162
162
  });
163
163
  },
164
- resetFieldsInitValue:()=>{
165
- const oldValue=form.getFieldsValue();
166
- const keys=Object.keys(oldValue);
167
- const newVale={};
168
- keys.forEach((key)=>{
169
- newVale[key]=undefined;
170
- });
171
- form.setFieldsValue({
172
- ...newVale,
173
- ...initSaveValue,
174
- });
164
+ resetFieldsInitValue: () => {
165
+ const oldValue = form.getFieldsValue();
166
+ const keys = Object.keys(oldValue);
167
+ const newVale = {};
168
+ keys.forEach((key) => {
169
+ newVale[key] = undefined;
170
+ });
171
+ form.setFieldsValue({
172
+ ...newVale,
173
+ ...initSaveValue,
174
+ });
175
175
  },
176
176
  clear: () => {
177
177
  form.resetFields();
@@ -20,6 +20,7 @@ export default ({
20
20
  params = {},
21
21
  onValuesChange,
22
22
  itemSpan,
23
+ hideLabel: formHideLabel = false,
23
24
  ...props
24
25
  }: HFormProps) => {
25
26
  const hForm = useCurrentForm(form);
@@ -70,11 +71,13 @@ export default ({
70
71
  >
71
72
  <Row>
72
73
  {newConfigData.map((itemData: HItemProps, index) => {
73
- const { labelWidth: itemLabelWidth } = itemData;
74
+ const { labelWidth: itemLabelWidth, hideLabel = formHideLabel } =
75
+ itemData;
74
76
  return (
75
77
  <Item
76
78
  {...itemData}
77
79
  key={index}
80
+ hideLabel={hideLabel}
78
81
  itemSpan={itemSpan}
79
82
  labelWidth={itemLabelWidth || labelWidth}
80
83
  />
@@ -88,6 +88,7 @@ export interface HItemProps extends Omit<FormItemProps, "name"> {
88
88
  name?: string;
89
89
  dispatch?: DispatchModal;
90
90
  itemSpan?: ColProps;
91
+ hideLabel?: boolean;
91
92
  }
92
93
 
93
94
  export interface HFormProps<T = any, R = any>
@@ -101,6 +102,7 @@ export interface HFormProps<T = any, R = any>
101
102
  params?: any;
102
103
  onFinish?: (values: T, params?: any) => void;
103
104
  itemSpan?: ColProps;
105
+ hideLabel?: boolean;
104
106
  }
105
107
  export interface HFormItemProps extends HItemProps {
106
108
  required?: boolean;
@@ -160,7 +162,7 @@ export interface HFormInstance extends FormInstance {
160
162
  removeDispatchListener: (action?: ActionModal, fn?: argsFn) => void;
161
163
  reload: PromiseFnResult;
162
164
  clear: VoidFunction;
163
- resetFieldsInitValue:VoidFunction;
165
+ resetFieldsInitValue: VoidFunction;
164
166
  }
165
167
 
166
168
  export interface ConnectConfigModal {
@@ -11,6 +11,7 @@ const Index: React.FC<HDatePickerProps> = ({
11
11
  format = "X",
12
12
  disabledDate,
13
13
  addFormat,
14
+ style = { width: "100%" },
14
15
  ...props
15
16
  }) => {
16
17
  addFormat?.({});
@@ -21,6 +22,7 @@ const Index: React.FC<HDatePickerProps> = ({
21
22
  value={timeVal}
22
23
  onChange={change}
23
24
  showTime={showTime}
25
+ style={style}
24
26
  disabledDate={(currentDate) => {
25
27
  return !!disabledDate?.(currentDate, timeVal);
26
28
  }}
@@ -1,6 +1,6 @@
1
1
  import { HForm, HFormConfigProvider, useHForm } from "../../components";
2
2
  import { useState } from "react";
3
- import {Button, DatePicker, Form, Input} from "antd";
3
+ import { Button, DatePicker, Form, Input } from "antd";
4
4
 
5
5
  const formData = (options) => {
6
6
  const op = [
@@ -77,6 +77,7 @@ const formData = (options) => {
77
77
  { value: "选择1", key: "check1" },
78
78
  { value: "选择2", key: "check2" },
79
79
  ],
80
+ direction: "vertical",
80
81
  },
81
82
  {
82
83
  label: "开关",
@@ -241,12 +242,12 @@ const Test = (props) => {
241
242
  export default () => {
242
243
  const form = useHForm();
243
244
  const [options, setOptions] = useState([{ label: "1", value: 1 }]);
244
- const [aForm]=Form.useForm();
245
+ const [aForm] = Form.useForm();
245
246
  return (
246
247
  <div style={{ overflow: "auto", height: "90vh" }}>
247
- <Form form={aForm} initialValues={{ttim:"132123"}}>
248
- <Form.Item name="ttim" rules={[{required:true}]}>
249
- <Input/>
248
+ <Form form={aForm} initialValues={{ ttim: "132123" }}>
249
+ <Form.Item name="ttim" rules={[{ required: true }]}>
250
+ <Input />
250
251
  </Form.Item>
251
252
  </Form>
252
253
  <HFormConfigProvider
@@ -264,12 +265,13 @@ export default () => {
264
265
  configData={formData(options)}
265
266
  labelWidth={200}
266
267
  form={form}
268
+ hideLabel={true}
267
269
  initialValues={{
268
270
  name: "fff",
269
271
  trimInput: "trimInput",
270
272
  trimTextArea: "trimTextArea",
271
273
  }}
272
- itemSpan={{ span: 12 }}
274
+ itemSpan={{ span: 12, xs: 24, md: 12 }}
273
275
  onFinish={(value) => {
274
276
  console.log(value);
275
277
  }}