@zat-design/sisyphus-react 4.6.0 → 4.6.1-beta.2

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.
@@ -44,9 +44,8 @@ const useTransformColumns = (params) => {
44
44
  if (names) {
45
45
  form.resetFields([columnName]);
46
46
  }
47
- if (!names && (value == null ? void 0 : value.length)) {
48
- value[index] = null;
49
- form.setFieldValue(columnName, [...value]);
47
+ if (!names && (value == null ? void 0 : value.length) && value[index] !== void 0 && value[index] !== null) {
48
+ internalChange == null ? void 0 : internalChange(null, void 0, index);
50
49
  }
51
50
  }, 200);
52
51
  } else {
@@ -3,7 +3,8 @@ import type { GroupType } from './propsType';
3
3
  /**
4
4
  * Group组件 - 支持传统模式和灵活模式
5
5
  * - 有names属性 → 传统数组模式(保持向后兼容)
6
- * - 无names属性新的灵活模式(子组件必须配置name)
6
+ * - 有外层name且子组件未配置name传统单字段数组模式
7
+ * - 其他情况 → 新的灵活模式(子组件必须配置name)
7
8
  */
8
9
  declare const Group: React.FC<GroupType>;
9
10
  export default Group;
@@ -10,9 +10,9 @@ import ProForm from "../../../../ProForm";
10
10
  import ComRender from "./component/ComRender";
11
11
  import FlexibleGroup from "./component/FlexibleGroup";
12
12
  const LegacyGroup = (props) => {
13
- var _a;
13
+ var _a, _b;
14
14
  const {
15
- children,
15
+ children: propsChildren,
16
16
  className,
17
17
  space: propsSpace = {
18
18
  size: 12
@@ -27,8 +27,9 @@ const LegacyGroup = (props) => {
27
27
  split
28
28
  // 弃用属性,保持向后兼容
29
29
  } = props;
30
+ const children = propsChildren || ((_a = props.fieldProps) == null ? void 0 : _a.children) || [];
30
31
  const finalSeparator = separator ?? split ?? "/";
31
- const fieldPropsSpace = (_a = props.fieldProps) == null ? void 0 : _a.space;
32
+ const fieldPropsSpace = (_b = props.fieldProps) == null ? void 0 : _b.space;
32
33
  const space = fieldPropsSpace || propsSpace;
33
34
  const contextProps = ProForm.useFieldProps() || {};
34
35
  const { names, name, form, namePath, index, isView } = contextProps;
@@ -57,8 +58,8 @@ const LegacyGroup = (props) => {
57
58
  "pro-group": true,
58
59
  "pro-group-unflexible": true,
59
60
  "pro-group-diy-width": columns.some((item) => {
60
- var _a2, _b;
61
- return (_b = (_a2 = item == null ? void 0 : item.fieldProps) == null ? void 0 : _a2.style) == null ? void 0 : _b.width;
61
+ var _a2, _b2;
62
+ return (_b2 = (_a2 = item == null ? void 0 : item.fieldProps) == null ? void 0 : _a2.style) == null ? void 0 : _b2.width;
62
63
  }),
63
64
  "pro-group-width-auto": columns.some((item) => {
64
65
  return ["Radio", "Checkbox", "Switch"].includes(item.type);
@@ -72,8 +73,8 @@ const LegacyGroup = (props) => {
72
73
  const renderCompactFormItems = () => {
73
74
  const elements = [];
74
75
  columns.forEach((column, index2) => {
75
- var _a2, _b, _c;
76
- const childWidth = (_b = (_a2 = column == null ? void 0 : column.fieldProps) == null ? void 0 : _a2.style) == null ? void 0 : _b.width;
76
+ var _a2, _b2, _c;
77
+ const childWidth = (_b2 = (_a2 = column == null ? void 0 : column.fieldProps) == null ? void 0 : _a2.style) == null ? void 0 : _b2.width;
77
78
  const formItemStyle = childWidth ? { width: childWidth } : void 0;
78
79
  const formItemClassName = childWidth ? "pro-group-form-item pro-group-form-item-has-width" : "pro-group-form-item";
79
80
  const newColumn = { ...column };
@@ -147,9 +148,14 @@ const LegacyGroup = (props) => {
147
148
  ) });
148
149
  };
149
150
  const Group = (props) => {
151
+ var _a;
150
152
  const { children, names, otherProps } = props;
153
+ const { name: outerName } = ProForm.useFieldProps() || {};
151
154
  const actualNames = names || (otherProps == null ? void 0 : otherProps.names);
152
- const isLegacyMode = Array.isArray(actualNames) && actualNames.length > 0;
155
+ const actualChildren = children || ((_a = props.fieldProps) == null ? void 0 : _a.children) || [];
156
+ const hasOuterName = outerName !== void 0 && outerName !== null && (!Array.isArray(outerName) || outerName.length > 0);
157
+ const hasNamelessChild = Array.isArray(actualChildren) && actualChildren.some((child) => !(child == null ? void 0 : child.name));
158
+ const isLegacyMode = Array.isArray(actualNames) && actualNames.length > 0 || hasOuterName && hasNamelessChild;
153
159
  if (isLegacyMode) {
154
160
  return /* @__PURE__ */ jsx(LegacyGroup, { ...props, names: actualNames });
155
161
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zat-design/sisyphus-react",
3
- "version": "4.6.0",
3
+ "version": "4.6.1-beta.2",
4
4
  "license": "MIT",
5
5
  "publishConfig": {
6
6
  "access": "public",