@zat-design/sisyphus-react 3.14.4 → 3.14.5

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.
@@ -600,6 +600,7 @@ var RenderField = _ref => {
600
600
  // 如果处于 shouldUpdate 模式,需要重新获取最新的行数据并重新计算依赖值
601
601
  var finalComponentProps = componentProps;
602
602
  if (shouldUpdateMode) {
603
+ var _props;
603
604
  // 重新获取最新的行数据
604
605
  var latestRowData = form.getFieldValue([...namePath, index]) || record || {};
605
606
  var latestCurrentValue = dataIndex ? latestRowData === null || latestRowData === void 0 ? void 0 : latestRowData[dataIndex] : null;
@@ -626,11 +627,16 @@ var RenderField = _ref => {
626
627
  columnFieldProps: latestFieldProps,
627
628
  params: latestRowParams
628
629
  });
629
-
630
+ var nextLatestFieldProps = _objectSpread({}, latestFieldProps);
631
+ var hasTargetChildren = /*#__PURE__*/React.isValidElement(TargetComponent) && ((_props = TargetComponent.props) === null || _props === void 0 ? void 0 : _props.children) !== undefined;
632
+ var hasLatestChildren = Object.prototype.hasOwnProperty.call(nextLatestFieldProps, 'children');
633
+ if (isView && hasTargetChildren && hasLatestChildren) {
634
+ delete nextLatestFieldProps.children;
635
+ }
630
636
  // 更新 componentProps 中的 disabled 和 fieldProps
631
637
  finalComponentProps = _objectSpread(_objectSpread({}, componentProps), {}, {
632
638
  disabled: latestDisabled
633
- }, latestFieldProps);
639
+ }, nextLatestFieldProps);
634
640
  }
635
641
  var FormItem = null;
636
642
  var FieldComponent = /*#__PURE__*/React.isValidElement(TargetComponent) ? ( /*#__PURE__*/React.cloneElement(TargetComponent, finalComponentProps)) : /*#__PURE__*/_jsx(TargetComponent, _objectSpread({}, finalComponentProps));
@@ -9,9 +9,16 @@ var Container = props => {
9
9
  tooltip = props.tooltip,
10
10
  nowrap = props.nowrap,
11
11
  viewEmpty = props.viewEmpty;
12
+ var hasInvalidChild = Array.isArray(children) && children.some(item => {
13
+ if (item === null || item === undefined) return false;
14
+ if ( /*#__PURE__*/React.isValidElement(item)) return false;
15
+ var itemType = typeof item;
16
+ return itemType === 'object' || itemType === 'function';
17
+ });
18
+ var safeChildren = hasInvalidChild ? null : children;
12
19
 
13
20
  // 值为false但不为0, 或者值为空数组
14
- var nullValue = children !== 0 && !children || isEmptyArray(children);
21
+ var nullValue = safeChildren !== 0 && !safeChildren || isEmptyArray(safeChildren);
15
22
  var _className = classNames({
16
23
  'pro-form-view-container': true,
17
24
  'pro-form-view-container_nowrap': nowrap !== null && nowrap !== void 0 ? nowrap : tooltip
@@ -19,16 +26,16 @@ var Container = props => {
19
26
  if (tooltip && !nullValue) {
20
27
  return /*#__PURE__*/_jsx(_Tooltip, {
21
28
  placement: "topLeft",
22
- title: children,
29
+ title: safeChildren,
23
30
  children: /*#__PURE__*/_jsx("div", {
24
31
  className: _className,
25
- children: children
32
+ children: safeChildren
26
33
  })
27
34
  });
28
35
  }
29
36
  return /*#__PURE__*/_jsx("div", {
30
37
  className: _className,
31
- children: nullValue ? viewEmpty : children
38
+ children: nullValue ? viewEmpty : safeChildren
32
39
  });
33
40
  };
34
41
  export default Container;
@@ -607,6 +607,7 @@ var RenderField = _ref => {
607
607
  // 如果处于 shouldUpdate 模式,需要重新获取最新的行数据并重新计算依赖值
608
608
  var finalComponentProps = componentProps;
609
609
  if (shouldUpdateMode) {
610
+ var _props;
610
611
  // 重新获取最新的行数据
611
612
  var latestRowData = form.getFieldValue([...namePath, index]) || record || {};
612
613
  var latestCurrentValue = dataIndex ? latestRowData === null || latestRowData === void 0 ? void 0 : latestRowData[dataIndex] : null;
@@ -633,11 +634,16 @@ var RenderField = _ref => {
633
634
  columnFieldProps: latestFieldProps,
634
635
  params: latestRowParams
635
636
  });
636
-
637
+ var nextLatestFieldProps = (0, _objectSpread2.default)({}, latestFieldProps);
638
+ var hasTargetChildren = /*#__PURE__*/_react.default.isValidElement(TargetComponent) && ((_props = TargetComponent.props) === null || _props === void 0 ? void 0 : _props.children) !== undefined;
639
+ var hasLatestChildren = Object.prototype.hasOwnProperty.call(nextLatestFieldProps, 'children');
640
+ if (isView && hasTargetChildren && hasLatestChildren) {
641
+ delete nextLatestFieldProps.children;
642
+ }
637
643
  // 更新 componentProps 中的 disabled 和 fieldProps
638
644
  finalComponentProps = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, componentProps), {}, {
639
645
  disabled: latestDisabled
640
- }, latestFieldProps);
646
+ }, nextLatestFieldProps);
641
647
  }
642
648
  var FormItem = null;
643
649
  var FieldComponent = /*#__PURE__*/_react.default.isValidElement(TargetComponent) ? ( /*#__PURE__*/_react.default.cloneElement(TargetComponent, finalComponentProps)) : /*#__PURE__*/(0, _jsxRuntime.jsx)(TargetComponent, (0, _objectSpread2.default)({}, finalComponentProps));
@@ -16,9 +16,16 @@ var Container = props => {
16
16
  tooltip = props.tooltip,
17
17
  nowrap = props.nowrap,
18
18
  viewEmpty = props.viewEmpty;
19
+ var hasInvalidChild = Array.isArray(children) && children.some(item => {
20
+ if (item === null || item === undefined) return false;
21
+ if ( /*#__PURE__*/_react.default.isValidElement(item)) return false;
22
+ var itemType = typeof item;
23
+ return itemType === 'object' || itemType === 'function';
24
+ });
25
+ var safeChildren = hasInvalidChild ? null : children;
19
26
 
20
27
  // 值为false但不为0, 或者值为空数组
21
- var nullValue = children !== 0 && !children || (0, _utils.isEmptyArray)(children);
28
+ var nullValue = safeChildren !== 0 && !safeChildren || (0, _utils.isEmptyArray)(safeChildren);
22
29
  var _className = (0, _classnames.default)({
23
30
  'pro-form-view-container': true,
24
31
  'pro-form-view-container_nowrap': nowrap !== null && nowrap !== void 0 ? nowrap : tooltip
@@ -26,16 +33,16 @@ var Container = props => {
26
33
  if (tooltip && !nullValue) {
27
34
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_tooltip.default, {
28
35
  placement: "topLeft",
29
- title: children,
36
+ title: safeChildren,
30
37
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
31
38
  className: _className,
32
- children: children
39
+ children: safeChildren
33
40
  })
34
41
  });
35
42
  }
36
43
  return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
37
44
  className: _className,
38
- children: nullValue ? viewEmpty : children
45
+ children: nullValue ? viewEmpty : safeChildren
39
46
  });
40
47
  };
41
48
  var _default = exports.default = Container;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zat-design/sisyphus-react",
3
- "version": "3.14.4",
3
+ "version": "3.14.5",
4
4
  "license": "MIT",
5
5
  "engines": {
6
6
  "node": ">=18.19.0"