@teamias/rex-design 0.0.35 → 0.0.37

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.
@@ -5,7 +5,13 @@ export declare const BaseDescriptions: FC<IBaseDescriptionsProps>;
5
5
  type TDataCellItem = GetProps<typeof DataCell>['items'][number];
6
6
  /** 允许自定义参数 */
7
7
  type TDataCellItemExtend = TDataCellItem & Record<string, any>;
8
- export interface IBaseDescriptionsProps extends Omit<GetProps<typeof Descriptions>, 'items'> {
8
+ export interface IBaseDescriptionsProps extends Omit<GetProps<typeof Descriptions>, 'items' | 'column'> {
9
+ /** table layout fixed */
10
+ isFixed?: boolean;
11
+ /** 每个 label 宽度 */
12
+ labelWidth?: string;
13
+ /** 列数 */
14
+ column?: number;
9
15
  /** 主要渲染数据 */
10
16
  items?: Array<{
11
17
  label: React.ReactNode;
@@ -1,5 +1,5 @@
1
1
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
- var _excluded = ["items", "useDataCellRender", "onDataCellClick"];
2
+ var _excluded = ["column", "labelWidth", "useDataCellRender", "items", "onDataCellClick", "isFixed", "styles"];
3
3
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4
4
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
5
5
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
@@ -8,52 +8,76 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
8
8
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
9
9
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
10
10
  import { Descriptions } from 'antd';
11
+ import { merge } from 'lodash';
11
12
  import { DataCell } from "../data-cell";
13
+ import { Box } from "./style";
12
14
  import { jsx as _jsx } from "react/jsx-runtime";
13
15
  export var BaseDescriptions = function BaseDescriptions(_ref) {
14
- var items = _ref.items,
16
+ var _ref$column = _ref.column,
17
+ column = _ref$column === void 0 ? 3 : _ref$column,
18
+ _ref$labelWidth = _ref.labelWidth,
19
+ labelWidth = _ref$labelWidth === void 0 ? '120px' : _ref$labelWidth,
15
20
  _ref$useDataCellRende = _ref.useDataCellRender,
16
21
  useDataCellRender = _ref$useDataCellRende === void 0 ? true : _ref$useDataCellRende,
22
+ items = _ref.items,
17
23
  onDataCellClick = _ref.onDataCellClick,
24
+ isFixed = _ref.isFixed,
25
+ styles = _ref.styles,
18
26
  otherProps = _objectWithoutProperties(_ref, _excluded);
19
- return /*#__PURE__*/_jsx(Descriptions, _objectSpread(_objectSpread({
20
- size: "small"
21
- }, otherProps), {}, {
22
- items: items === null || items === void 0 ? void 0 : items.map(function (item, index) {
23
- try {
24
- var _item$children;
25
- var children = useDataCellRender ? ((_item$children = item.children) === null || _item$children === void 0 ? void 0 : _item$children.map(function (topItem, topIndex) {
26
- return /*#__PURE__*/_jsx(DataCell, {
27
- items: topItem,
28
- onClick: function onClick(cellItem, subItem) {
29
- // console.log(cellItem, subItem);
30
- onDataCellClick === null || onDataCellClick === void 0 || onDataCellClick({
31
- item: topItem,
32
- cellItem: cellItem,
33
- subItem: subItem,
34
- index: index
35
- });
36
- }
37
- }, topIndex);
38
- })) || '-' : item.children || '-';
39
- return _objectSpread(_objectSpread({}, item), {}, {
40
- key: "".concat(index),
41
- children: children
42
- });
43
- } catch (error) {
44
- console.error('BaseDescriptions Error:', error, item, index);
45
- return _objectSpread(_objectSpread({}, item), {}, {
46
- key: "".concat(index),
47
- children: /*#__PURE__*/_jsx("div", {
48
- style: {
49
- color: 'red'
50
- },
51
- children: "\u6570\u636E\u51FA\u73B0\u95EE\u9898,\u8BF7\u67E5\u770B\u63A7\u5236\u53F0\u8F93\u51FA"
52
- })
53
- });
54
- }
55
- })
56
- }));
27
+ return /*#__PURE__*/_jsx(Box, {
28
+ style: {
29
+ '--table-layout': isFixed ? 'fixed' : 'auto',
30
+ '--label-width': labelWidth,
31
+ '--content-width': "".concat(100 / column, "%")
32
+ },
33
+ children: /*#__PURE__*/_jsx(Descriptions, _objectSpread(_objectSpread({
34
+ size: "small"
35
+ }, otherProps), {}, {
36
+ styles: merge({}, {
37
+ content: {
38
+ padding: '24px 12px'
39
+ },
40
+ label: {
41
+ padding: '12px'
42
+ }
43
+ }, styles),
44
+ column: column,
45
+ items: items === null || items === void 0 ? void 0 : items.map(function (item, index) {
46
+ try {
47
+ var _item$children;
48
+ var children = useDataCellRender ? ((_item$children = item.children) === null || _item$children === void 0 ? void 0 : _item$children.map(function (topItem, topIndex) {
49
+ return /*#__PURE__*/_jsx(DataCell, {
50
+ items: topItem,
51
+ onClick: function onClick(cellItem, subItem) {
52
+ // console.log(cellItem, subItem);
53
+ onDataCellClick === null || onDataCellClick === void 0 || onDataCellClick({
54
+ item: topItem,
55
+ cellItem: cellItem,
56
+ subItem: subItem,
57
+ index: index
58
+ });
59
+ }
60
+ }, topIndex);
61
+ })) || '-' : item.children || '-';
62
+ return _objectSpread(_objectSpread({}, item), {}, {
63
+ key: "".concat(index),
64
+ children: children
65
+ });
66
+ } catch (error) {
67
+ console.error('BaseDescriptions Error:', error, item, index);
68
+ return _objectSpread(_objectSpread({}, item), {}, {
69
+ key: "".concat(index),
70
+ children: /*#__PURE__*/_jsx("div", {
71
+ style: {
72
+ color: 'red'
73
+ },
74
+ children: "\u6570\u636E\u51FA\u73B0\u95EE\u9898,\u8BF7\u67E5\u770B\u63A7\u5236\u53F0\u8F93\u51FA"
75
+ })
76
+ });
77
+ }
78
+ })
79
+ }))
80
+ });
57
81
  };
58
82
 
59
83
  /** 允许自定义参数 */
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare const Box: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
@@ -0,0 +1,5 @@
1
+ import styled from 'styled-components';
2
+ export var Box = styled.div.withConfig({
3
+ displayName: "Box",
4
+ componentId: "rex-design-aaf4__sc-1bifo7s-0"
5
+ })(["table{table-layout:var(--table-layout) !important;}th.ant-descriptions-item-label{width:var(--label-width);max-width:var(--label-width);min-width:var(--label-width);}td.ant-descriptions-item-content{width:var(--content-width);max-width:var(--content-width);min-width:var(--label-width);}"]);
@@ -1,3 +1,3 @@
1
1
  import { FC } from 'react';
2
2
  import { IBaseFormProps } from '../types';
3
- export declare const BaseForm: FC<IBaseFormProps>;
3
+ export declare const Core: FC<IBaseFormProps>;
@@ -19,7 +19,7 @@ import { BaseFormStyle } from "../style";
19
19
  import { jsx as _jsx } from "react/jsx-runtime";
20
20
  import { Fragment as _Fragment } from "react/jsx-runtime";
21
21
  import { jsxs as _jsxs } from "react/jsx-runtime";
22
- export var BaseForm = function BaseForm(props) {
22
+ export var Core = function Core(props) {
23
23
  var rawAllProps = props;
24
24
  var outFields = props.fields,
25
25
  outFieldProps = props.fieldProps,
@@ -1,6 +1,7 @@
1
1
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
- var _excluded = ["descriptionsProps", "fields", "labelWidth"],
3
- _excluded2 = ["label", "tooltip", "formItemProps", "rules"];
2
+ var _excluded = ["isFixed", "column", "styles"],
3
+ _excluded2 = ["descriptionsProps", "fields", "labelWidth"],
4
+ _excluded3 = ["label", "tooltip", "formItemProps", "rules"];
4
5
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
5
6
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
6
7
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
@@ -9,17 +10,23 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
9
10
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
10
11
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
11
12
  import { Descriptions, Form } from 'antd';
13
+ import { merge } from 'lodash';
12
14
  import { useMemo } from 'react';
13
15
  import { DescriptionsStyle } from "../style";
14
- import { BaseForm } from "./base-form";
16
+ import { Core } from "./core";
15
17
  import { jsx as _jsx } from "react/jsx-runtime";
16
18
  export var DescriptionsModel = function DescriptionsModel(_ref) {
17
- var descriptionsProps = _ref.descriptionsProps,
19
+ var _ref$descriptionsProp = _ref.descriptionsProps,
20
+ _ref$descriptionsProp2 = _ref$descriptionsProp === void 0 ? {} : _ref$descriptionsProp,
21
+ isFixed = _ref$descriptionsProp2.isFixed,
22
+ _ref$descriptionsProp3 = _ref$descriptionsProp2.column,
23
+ column = _ref$descriptionsProp3 === void 0 ? 3 : _ref$descriptionsProp3,
24
+ styles = _ref$descriptionsProp2.styles,
25
+ descriptionsProps = _objectWithoutProperties(_ref$descriptionsProp2, _excluded),
18
26
  fields = _ref.fields,
19
27
  _ref$labelWidth = _ref.labelWidth,
20
28
  labelWidth = _ref$labelWidth === void 0 ? '120px' : _ref$labelWidth,
21
- baseFormProps = _objectWithoutProperties(_ref, _excluded);
22
- var column = (descriptionsProps === null || descriptionsProps === void 0 ? void 0 : descriptionsProps.column) || 3;
29
+ baseFormProps = _objectWithoutProperties(_ref, _excluded2);
23
30
  var descriptionsItems = useMemo(function () {
24
31
  /** 检查field或其subItems是否包含rules */
25
32
  var hasRules = function hasRules(field) {
@@ -41,7 +48,7 @@ export var DescriptionsModel = function DescriptionsModel(_ref) {
41
48
  tooltip = field.tooltip,
42
49
  formItemProps = field.formItemProps,
43
50
  rules = field.rules,
44
- otherData = _objectWithoutProperties(field, _excluded2);
51
+ otherData = _objectWithoutProperties(field, _excluded3);
45
52
  return {
46
53
  label: /*#__PURE__*/_jsx(Form.Item, {
47
54
  label: label,
@@ -66,7 +73,7 @@ export var DescriptionsModel = function DescriptionsModel(_ref) {
66
73
  }
67
74
  }
68
75
  }),
69
- children: /*#__PURE__*/_jsx(BaseForm, _objectSpread(_objectSpread({}, baseFormProps), {}, {
76
+ children: /*#__PURE__*/_jsx(Core, _objectSpread(_objectSpread({}, baseFormProps), {}, {
70
77
  itemMarginBottom: 0,
71
78
  fields: [_objectSpread(_objectSpread({}, otherData), {}, {
72
79
  rules: rules,
@@ -79,20 +86,22 @@ export var DescriptionsModel = function DescriptionsModel(_ref) {
79
86
  }, [fields]);
80
87
  return /*#__PURE__*/_jsx(DescriptionsStyle, {
81
88
  style: {
89
+ '--table-layout': isFixed ? 'fixed' : 'auto',
82
90
  '--label-width': labelWidth,
83
91
  '--content-width': "".concat(100 / column, "%")
84
92
  },
85
93
  children: /*#__PURE__*/_jsx(Descriptions, _objectSpread(_objectSpread({
86
- bordered: true,
87
- styles: {
94
+ bordered: true
95
+ }, descriptionsProps), {}, {
96
+ styles: merge({}, {
88
97
  content: {
89
98
  padding: '24px 12px'
90
99
  },
91
100
  label: {
92
101
  padding: '12px'
93
102
  }
94
- }
95
- }, descriptionsProps), {}, {
103
+ }, styles),
104
+ column: column,
96
105
  items: descriptionsItems
97
106
  }))
98
107
  });
@@ -1,4 +1,4 @@
1
- import { BaseForm as RawBaseForm } from './base-form';
1
+ import { Core } from './core';
2
2
  import { DescriptionsModel as BaseDescriptionsForm } from './descriptions-model';
3
- declare const BaseForm: typeof RawBaseForm;
3
+ declare const BaseForm: typeof Core;
4
4
  export { BaseDescriptionsForm, BaseForm };
@@ -4,13 +4,13 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
4
4
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
5
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
6
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
- import { BaseForm as RawBaseForm } from "./base-form";
7
+ import { Core } from "./core";
8
8
  import { DescriptionsModel as BaseDescriptionsForm } from "./descriptions-model";
9
9
  import { jsx as _jsx } from "react/jsx-runtime";
10
10
  var BaseForm = function BaseForm(props) {
11
11
  if (props.type === 'descriptions') {
12
12
  return /*#__PURE__*/_jsx(BaseDescriptionsForm, _objectSpread({}, props));
13
13
  }
14
- return /*#__PURE__*/_jsx(RawBaseForm, _objectSpread({}, props));
14
+ return /*#__PURE__*/_jsx(Core, _objectSpread({}, props));
15
15
  };
16
16
  export { BaseDescriptionsForm, BaseForm };
@@ -4,16 +4,25 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
4
4
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
5
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
6
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
8
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
9
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
10
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
11
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
12
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
13
  import enUS from "../../../locales/en-US.json";
8
14
  import { UserOutlined } from '@ant-design/icons';
9
15
  import { ProForm } from '@ant-design/pro-components';
10
- import { RexProConfigProvider } from "../../..";
16
+ import { resetFormTouched, RexProConfigProvider } from "../../..";
11
17
  import { crush } from 'radash';
12
18
  import { createIntl } from 'react-intl';
13
19
  import { BaseForm } from "../core";
14
20
  import { getFieldsDefaultValues } from "../modules/handlerData";
15
21
  import { jsx as _jsx } from "react/jsx-runtime";
16
22
  export default (function () {
23
+ var _ProForm$useForm = ProForm.useForm(),
24
+ _ProForm$useForm2 = _slicedToArray(_ProForm$useForm, 1),
25
+ form = _ProForm$useForm2[0];
17
26
  var fields = [{
18
27
  label: '成本区间',
19
28
  valueType: 'multipleComponents',
@@ -70,7 +79,11 @@ export default (function () {
70
79
  }, {
71
80
  valueType: 'datePicker',
72
81
  field: 'multipleComponents-datePicker',
73
- defaultValue: '2025-05-05'
82
+ defaultValue: '2025-05-05',
83
+ dependenciesV2: [{
84
+ action: 'clear',
85
+ field: 'multipleComponents-treeSelect'
86
+ }]
74
87
  }, {
75
88
  valueType: 'treeSelect',
76
89
  field: 'multipleComponents-treeSelect2',
@@ -237,6 +250,47 @@ export default (function () {
237
250
  // target: true,
238
251
  // }
239
252
  // ],
253
+ }, {
254
+ valueType: 'select',
255
+ field: 'org_id',
256
+ label: '部门',
257
+ itemWidth: '200px',
258
+ options: [{
259
+ label: '1',
260
+ value: '1'
261
+ }, {
262
+ label: '2',
263
+ value: '2'
264
+ }, {
265
+ label: '3',
266
+ value: '3'
267
+ }]
268
+ }, {
269
+ valueType: 'select',
270
+ field: 'job_id',
271
+ label: '岗位',
272
+ itemWidth: '200px',
273
+ options: [{
274
+ label: '1',
275
+ value: '1'
276
+ }, {
277
+ label: '2',
278
+ value: '2'
279
+ }, {
280
+ label: '3',
281
+ value: '3'
282
+ }],
283
+ dependenciesV2: [{
284
+ field: 'org_id',
285
+ action: 'show',
286
+ op: 'notEmpty'
287
+ }, {
288
+ field: 'org_id',
289
+ action: 'updateData'
290
+ }, {
291
+ field: 'org_id',
292
+ action: 'clear'
293
+ }]
240
294
  }];
241
295
  var initialValues = getFieldsDefaultValues(fields);
242
296
  // console.log(initialValues);
@@ -251,9 +305,12 @@ export default (function () {
251
305
  children: /*#__PURE__*/_jsx(ProForm, {
252
306
  initialValues: initialValues
253
307
  // size="small"
308
+ ,
309
+ form: form
254
310
  // readonly
255
311
  ,
256
312
  onFinish: function onFinish(values) {
313
+ resetFormTouched(values, form);
257
314
  console.log(values);
258
315
  },
259
316
  children: /*#__PURE__*/_jsx(BaseForm, {
@@ -2,3 +2,4 @@ export * from './core';
2
2
  export * from './modules/handlerData';
3
3
  export * from './modules/valuesToFields';
4
4
  export * from './types';
5
+ export * from './utils';
@@ -1,4 +1,5 @@
1
1
  export * from "./core";
2
2
  export * from "./modules/handlerData";
3
3
  export * from "./modules/valuesToFields";
4
- export * from "./types";
4
+ export * from "./types";
5
+ export * from "./utils";
@@ -22,7 +22,7 @@ import classNames from 'classnames';
22
22
  import dayjs from 'dayjs';
23
23
  import { ProFormDateRangePickerV2 } from "../components/ProFormDateRangePickerV2";
24
24
  import { ProFormDigitRangeV2 } from "../components/ProFormDigitRangeV2";
25
- import { BaseForm } from "../core/base-form";
25
+ import { Core } from "../core/core";
26
26
  import { getFieldsDefaultValues } from "./handlerData";
27
27
  import { createElement as _createElement } from "react";
28
28
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -167,7 +167,7 @@ export var renderComponentNode = function renderComponentNode(outConfig, values,
167
167
  className: classNames('base-form-field-multiple-group', {
168
168
  compact: inlineItem.compact
169
169
  }),
170
- children: /*#__PURE__*/_jsx(BaseForm, _objectSpread(_objectSpread({}, outConfig.rawAllProps), {}, {
170
+ children: /*#__PURE__*/_jsx(Core, _objectSpread(_objectSpread({}, outConfig.rawAllProps), {}, {
171
171
  itemWidth: "".concat(100 / ((_inlineItem$subItems$ = (_inlineItem$subItems = inlineItem.subItems) === null || _inlineItem$subItems === void 0 ? void 0 : _inlineItem$subItems.length) !== null && _inlineItem$subItems$ !== void 0 ? _inlineItem$subItems$ : 1), "%"),
172
172
  fields: inlineItem.subItems,
173
173
  itemMarginBottom: 0
@@ -8,4 +8,4 @@ export var BaseFormStyle = createGlobalStyle([".base-form-field-group{display:fl
8
8
  export var DescriptionsStyle = styled.div.withConfig({
9
9
  displayName: "DescriptionsStyle",
10
10
  componentId: "rex-design-aaf4__sc-1e1tacy-0"
11
- })(["table{table-layout:fixed;}.ant-descriptions-view{overflow:auto;}th.ant-descriptions-item-label{width:var(--label-width);max-width:var(--label-width);min-width:var(--label-width);}td.ant-descriptions-item-content{width:var(--content-width);max-width:var(--content-width);min-width:var(--content-width);}.ant-form-item-additional{position:absolute;}.ant-descriptions-row{th.ant-descriptions-item-label:has( + td.ant-descriptions-item-content > span:empty ){display:none;}td.ant-descriptions-item-content:has(> span:empty){display:none;}th label.ant-form-item-no-colon{display:block;word-wrap:break-word;&:after{content:initial;}> *{vertical-align:middle;}}}"]);
11
+ })(["table{table-layout:var(--table-layout) !important;}.ant-descriptions-view{overflow:auto;}th.ant-descriptions-item-label{width:var(--label-width);max-width:var(--label-width);min-width:var(--label-width);}td.ant-descriptions-item-content{width:var(--content-width);max-width:var(--content-width);min-width:var(--label-width);}.ant-form-item-additional{position:absolute;}.ant-descriptions-row{th.ant-descriptions-item-label:has( + td.ant-descriptions-item-content > span:empty ){display:none;}td.ant-descriptions-item-content:has(> span:empty){display:none;}th label.ant-form-item-no-colon{display:block;word-wrap:break-word;&:after{content:initial;}> *{vertical-align:middle;}}}"]);
@@ -26,7 +26,12 @@ export interface IBaseFormProps {
26
26
  /**
27
27
  * Descriptions 组件属性
28
28
  */
29
- descriptionsProps?: Omit<GetProps<typeof Descriptions>, 'items' | 'column'> & {
30
- column?: number;
31
- };
29
+ descriptionsProps?: IDescriptionsProps;
32
30
  }
31
+ interface IDescriptionsProps extends Omit<GetProps<typeof Descriptions>, 'items' | 'column'> {
32
+ /** 列数 */
33
+ column?: number;
34
+ /** table layout fixed */
35
+ isFixed?: boolean;
36
+ }
37
+ export {};
@@ -0,0 +1,47 @@
1
+ import { FormInstance } from 'antd';
2
+ /**
3
+ * @desc 重置表单的 touched 状态
4
+ * @example 解决场景:表单提交后,某些字段依赖其他字段变化触发清空,导致表单项的 touched 状态异常,从而影响表单提交后自动清空值。
5
+ * - 使用该函数可以在表单提交后,重置所有字段的 touched 状态,确保表单能够正确显示。
6
+ * @example 使用示例:
7
+ ```tsx
8
+ const fields: GetProps<typeof BaseForm>['fields'] = [
9
+ {
10
+ valueType: 'select',
11
+ field: 'org_id',
12
+ label: '部门',
13
+ options: [
14
+ { label: '1', value: '1' },
15
+ { label: '2', value: '2' },
16
+ { label: '3', value: '3' },
17
+ ],
18
+ },
19
+ {
20
+ valueType: 'select',
21
+ field: 'job_id',
22
+ label: '岗位',
23
+ options: [
24
+ { label: '1', value: '1' },
25
+ { label: '2', value: '2' },
26
+ { label: '3', value: '3' },
27
+ ],
28
+ dependenciesV2: [
29
+ {
30
+ field: 'org_id',
31
+ action: 'show',
32
+ op: 'notEmpty',
33
+ },
34
+ {
35
+ field: 'org_id',
36
+ action: 'updateData',
37
+ },
38
+ {
39
+ field: 'org_id',
40
+ action: 'clear',
41
+ },
42
+ ],
43
+ },
44
+ ]
45
+ ```
46
+ */
47
+ export declare const resetFormTouched: (data: Record<string, any>, form: FormInstance) => void;
@@ -0,0 +1,56 @@
1
+ import { crush } from 'radash';
2
+
3
+ /**
4
+ * @desc 重置表单的 touched 状态
5
+ * @example 解决场景:表单提交后,某些字段依赖其他字段变化触发清空,导致表单项的 touched 状态异常,从而影响表单提交后自动清空值。
6
+ * - 使用该函数可以在表单提交后,重置所有字段的 touched 状态,确保表单能够正确显示。
7
+ * @example 使用示例:
8
+ ```tsx
9
+ const fields: GetProps<typeof BaseForm>['fields'] = [
10
+ {
11
+ valueType: 'select',
12
+ field: 'org_id',
13
+ label: '部门',
14
+ options: [
15
+ { label: '1', value: '1' },
16
+ { label: '2', value: '2' },
17
+ { label: '3', value: '3' },
18
+ ],
19
+ },
20
+ {
21
+ valueType: 'select',
22
+ field: 'job_id',
23
+ label: '岗位',
24
+ options: [
25
+ { label: '1', value: '1' },
26
+ { label: '2', value: '2' },
27
+ { label: '3', value: '3' },
28
+ ],
29
+ dependenciesV2: [
30
+ {
31
+ field: 'org_id',
32
+ action: 'show',
33
+ op: 'notEmpty',
34
+ },
35
+ {
36
+ field: 'org_id',
37
+ action: 'updateData',
38
+ },
39
+ {
40
+ field: 'org_id',
41
+ action: 'clear',
42
+ },
43
+ ],
44
+ },
45
+ ]
46
+ ```
47
+ */
48
+ export var resetFormTouched = function resetFormTouched(data, form) {
49
+ var keys = Object.keys(crush(data));
50
+ form.setFields(keys.map(function (key) {
51
+ return {
52
+ name: key.split('.'),
53
+ touched: false
54
+ };
55
+ }));
56
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teamias/rex-design",
3
- "version": "0.0.35",
3
+ "version": "0.0.37",
4
4
  "description": "A react library developed with dumi",
5
5
  "license": "MIT",
6
6
  "module": "dist/index.js",