@zat-design/sisyphus-react 4.1.3-beta.2 → 4.1.3-beta.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.
@@ -24,6 +24,7 @@ var BaseTable = _ref => {
24
24
  var tableProps = _ref.tableProps,
25
25
  resetProps = _objectWithoutProperties(_ref, _excluded);
26
26
  var rowKey = tableProps.rowKey,
27
+ tableRowKey = tableProps.tableRowKey,
27
28
  value = tableProps.value,
28
29
  headerRender = tableProps.headerRender,
29
30
  tableRef = tableProps.tableRef,
@@ -78,7 +79,7 @@ var BaseTable = _ref => {
78
79
  onClick: () => {}
79
80
  })
80
81
  }, resetProps), {}, {
81
- rowKey: rowKey || 'rowKey',
82
+ rowKey: tableRowKey,
82
83
  summary,
83
84
  pagination: pagination ? _objectSpread(_objectSpread({
84
85
  showSizeChanger: true,
@@ -117,6 +117,7 @@ var DraggableTable = _ref3 => {
117
117
  draggableProps = _ref3.draggableProps,
118
118
  resetProps = _objectWithoutProperties(_ref3, _excluded2);
119
119
  var rowKey = tableProps.rowKey,
120
+ tableRowKey = tableProps.tableRowKey,
120
121
  value = tableProps.value,
121
122
  headerRender = tableProps.headerRender,
122
123
  tableRef = tableProps.tableRef,
@@ -173,7 +174,7 @@ var DraggableTable = _ref3 => {
173
174
  }),
174
175
  dataSource: value !== null && value !== void 0 && (_value$2 = value[0]) !== null && _value$2 !== void 0 && _value$2.rowKey ? value : []
175
176
  }, resetProps), {}, {
176
- rowKey: rowKey || 'rowKey',
177
+ rowKey: tableRowKey,
177
178
  pagination: pagination ? _objectSpread({
178
179
  current: page.pageNum,
179
180
  pageSize: page.pageSize,
@@ -1,4 +1,10 @@
1
1
  var _excluded = ["type", "valueType", "names", "fieldProps", "labelRequired", "editRender", "component", "viewRender", "title", "originTitle", "label", "dataIndex", "formItemProps", "isEditable", "required", "rules", "onDiff", "className", "trim", "confirm", "dependencies", "desensitization"];
2
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
3
+ 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."); }
4
+ 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); }
5
+ 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; }
6
+ 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; } }
7
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
2
8
  function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(typeof e + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
3
9
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
4
10
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
@@ -26,6 +32,7 @@ import transformNames from "../../../ProForm/utils/transformNames";
26
32
  import { FieldProvider } from "../../../ProForm/utils/useFieldProps";
27
33
  import useRules from "../../../ProForm/utils/useRules";
28
34
  import { isSelect, isTrim } from "../../../ProForm/utils";
35
+ import locale from "../../../locale";
29
36
  import ConfirmWrapper from "../../../ProForm/components/render/ConfirmWrapper";
30
37
  import { getDefaultProps } from "../../utils/getDefaultProps";
31
38
  import ListChangedWrapper from "./ListChangedWrapper";
@@ -37,7 +44,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
37
44
  var OMIT_FORM_ITEM_AND_DOM_KEYS = ['format', 'toISOString', 'toCSTString', 'switchValue', 'precision', 'clearNotShow', 'dependNames', 'shouldCellUpdate' // 表格内部性能优化属性,不应传递给 Form.Item
38
45
  ];
39
46
  var RenderField = _ref => {
40
- var _type, _type$replace, _fieldProps2, _fieldProps4, _names, _TargetComponent5, _componentProps2;
47
+ var _type, _type$replace, _fieldProps2, _fieldProps4, _names, _TargetComponent5, _componentProps3;
41
48
  var value = _ref.text,
42
49
  record = _ref.record,
43
50
  index = _ref.index,
@@ -209,13 +216,13 @@ var RenderField = _ref => {
209
216
  // 将Hooks调用移到组件顶层
210
217
  var proConfig = useProConfig();
211
218
 
212
- // 设置校验规则 - 修复Hooks使用规则
219
+ // 设置校验规则 - 不在此处过滤 isView,由 getFieldItem 内根据 latestIsView 动态决定是否应用规则
213
220
  var internalRule = useRules({
214
221
  names,
215
222
  label: label,
216
223
  labelRequired,
217
- required: !isView && _required,
218
- rules: !isView ? _rules : [],
224
+ required: _required,
225
+ rules: _rules,
219
226
  isSelect: isSelect({
220
227
  dataSource: (_fieldProps2 = _fieldProps) === null || _fieldProps2 === void 0 ? void 0 : _fieldProps2.dataSource,
221
228
  type
@@ -252,7 +259,7 @@ var RenderField = _ref => {
252
259
  // required 是函数
253
260
  isFunction(rules) ||
254
261
  // rules 是函数
255
- isFunction(isEditable) ||
262
+ isFunction(column === null || column === void 0 ? void 0 : column.isEditable) ||
256
263
  // isEditable 是函数
257
264
  isFunction(component) ||
258
265
  // component 是函数
@@ -749,10 +756,8 @@ var RenderField = _ref => {
749
756
  });
750
757
  }, [_formItemProps, defaultTransform, namesTransform, type, trim, proConfig]);
751
758
 
752
- // 编辑&保存模式,在查看状态下移除表单的rules不做校验
753
- if (isView) {
754
- delete finalFormItemProps.rules;
755
- }
759
+ // rules 的 isView 过滤已移至 getFieldItem 内处理(支持 shouldUpdate 模式下的动态 isEditable)
760
+
756
761
  var _className = useMemo(() => classNames({
757
762
  [className]: className
758
763
  }), [className]);
@@ -763,6 +768,12 @@ var RenderField = _ref => {
763
768
  var shouldUpdateMode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
764
769
  // 如果处于 shouldUpdate 模式,需要重新获取最新的行数据并重新计算依赖值
765
770
  var finalComponentProps = componentProps;
771
+ // shouldUpdate 模式下会被更新为最新值,供外层 FieldProvider 消费
772
+ var latestIsView = isView;
773
+ // 用于在 shouldUpdate 模式下重建正确的 Form.Item rules(外层 finalFormItemProps 是旧闭包)
774
+ var effectiveRequired = _required;
775
+ var effectiveRules = _rules;
776
+ var effectiveFieldProps = _fieldProps;
766
777
  if (shouldUpdateMode) {
767
778
  var _column$isEditable2;
768
779
  // 重新获取最新的行数据(shouldUpdate 触发时,通过 getFieldValue 拿到最新值)
@@ -792,6 +803,11 @@ var RenderField = _ref => {
792
803
  latestRules = rules(latestRowData, latestReactiveParams);
793
804
  }
794
805
 
806
+ // 同步到外层变量,用于后续构建 activeFinalFormItemProps
807
+ effectiveRequired = latestRequired;
808
+ effectiveRules = latestRules;
809
+ effectiveFieldProps = latestFieldProps;
810
+
795
811
  // 重新计算 desensitization
796
812
  var latestDesensitization = desensitization || [];
797
813
  if (isFunction(desensitization)) {
@@ -841,7 +857,7 @@ var RenderField = _ref => {
841
857
  }
842
858
 
843
859
  // 然后处理自定义 component
844
- var latestIsView = !latestIsEditable || (record === null || record === void 0 ? void 0 : record['is-view']) || config.isView || virtualKey && !_isEditing || getDisabled({
860
+ latestIsView = !latestIsEditable || (record === null || record === void 0 ? void 0 : record['is-view']) || config.isView || virtualKey && !_isEditing || getDisabled({
845
861
  globalControl: otherProps === null || otherProps === void 0 ? void 0 : otherProps.globalControl,
846
862
  formDisabled: otherProps === null || otherProps === void 0 ? void 0 : otherProps.formDisabled,
847
863
  column,
@@ -876,6 +892,13 @@ var RenderField = _ref => {
876
892
  // 使用重新计算的 TargetComponent
877
893
  TargetComponent = latestTargetComponent;
878
894
 
895
+ // shouldUpdate 触发时外层 componentProps.otherProps.isView 是旧快照,需用最新值覆盖
896
+ finalComponentProps = _objectSpread(_objectSpread({}, finalComponentProps), {}, {
897
+ otherProps: _objectSpread(_objectSpread({}, finalComponentProps.otherProps), {}, {
898
+ isView: latestIsView
899
+ })
900
+ });
901
+
879
902
  // componentProps 里展开了外层旧 TargetComponent?.props(如 { formType: "Input" }),
880
903
  // 用 latestTargetComponent?.props 覆盖,确保不会被旧 cloneElement props 污染
881
904
  if ( /*#__PURE__*/React.isValidElement(latestTargetComponent)) {
@@ -890,6 +913,34 @@ var RenderField = _ref => {
890
913
  }
891
914
  }
892
915
  }
916
+
917
+ // 根据 latestIsView 和最新的 required/rules 构建正确的 Form.Item props
918
+ // 解决 shouldUpdate 触发时外层 finalFormItemProps 是旧闭包(rules 基于旧 isView 计算)的问题
919
+ var activeFinalFormItemProps = finalFormItemProps;
920
+ if (latestIsView) {
921
+ // 查看模式:移除 rules 不做校验
922
+ activeFinalFormItemProps = omit(finalFormItemProps, ['rules']);
923
+ } else if (shouldUpdateMode) {
924
+ // shouldUpdate 模式下 finalFormItemProps 是旧闭包,需用最新 effectiveRequired/effectiveRules 重建 rules
925
+ var activeRules = Array.isArray(effectiveRules) ? [...effectiveRules] : [];
926
+ var hasRequiredRule = activeRules.some(r => (r === null || r === void 0 ? void 0 : r.required) === true);
927
+ if (effectiveRequired && !hasRequiredRule) {
928
+ var _effectiveFieldProps;
929
+ var _isSelectVal = isSelect({
930
+ dataSource: (_effectiveFieldProps = effectiveFieldProps) === null || _effectiveFieldProps === void 0 ? void 0 : _effectiveFieldProps.dataSource,
931
+ type
932
+ });
933
+ activeRules.push({
934
+ required: true,
935
+ message: `${_isSelectVal ? locale.ProForm.selectPlaceHolder : locale.ProForm.inputPlaceholder}${label || ''}`
936
+ });
937
+ }
938
+ activeFinalFormItemProps = _objectSpread(_objectSpread({}, finalFormItemProps), {}, {
939
+ rules: activeRules.length > 0 ? activeRules : [{
940
+ required: false
941
+ }]
942
+ });
943
+ }
893
944
  var FormItem = null;
894
945
  // 当 viewRender 存在时,需要排除 finalComponentProps 中的 children,避免覆盖 Container 的 children
895
946
  var propsForTarget = isView && typeof viewRender === 'function' ? omit(finalComponentProps, ['children']) : finalComponentProps;
@@ -937,7 +988,7 @@ var RenderField = _ref => {
937
988
  }
938
989
  FormItem = TargetComponent ? /*#__PURE__*/_jsx(Form.Item, _objectSpread(_objectSpread({
939
990
  validateFirst: true
940
- }, omit(finalFormItemProps, ['render', 'key', 'width', 'hiddenNames', 'name', 'onCell', 'disabled', _formItemProps.shouldUpdate ? 'shouldUpdate' : null])), {}, {
991
+ }, omit(activeFinalFormItemProps, ['render', 'key', 'width', 'hiddenNames', 'name', 'onCell', 'disabled', _formItemProps.shouldUpdate ? 'shouldUpdate' : null])), {}, {
941
992
  // 移除非必要字段,但保留 dependencies
942
993
  className: _className,
943
994
  name: formNamePath ? cellName.slice((formNamePath === null || formNamePath === void 0 ? void 0 : formNamePath.length) - 1) : cellName,
@@ -948,7 +999,7 @@ var RenderField = _ref => {
948
999
  if (type === 'FormList') {
949
1000
  FormItem = /*#__PURE__*/_jsx(Form.List, _objectSpread(_objectSpread({
950
1001
  name: formNamePath ? cellName.slice((formNamePath === null || formNamePath === void 0 ? void 0 : formNamePath.length) - 1) : cellName
951
- }, omit(finalFormItemProps, ['render', 'key', 'width', 'hiddenNames', 'name'])), {}, {
1002
+ }, omit(activeFinalFormItemProps, ['render', 'key', 'width', 'hiddenNames', 'name'])), {}, {
952
1003
  children: (fields, operation, meta) => /*#__PURE__*/_jsx(TargetComponent, _objectSpread(_objectSpread({}, finalComponentProps), {}, {
953
1004
  otherProps: otherProps,
954
1005
  fields: fields,
@@ -957,15 +1008,32 @@ var RenderField = _ref => {
957
1008
  }))
958
1009
  }));
959
1010
  }
960
- return FormItem;
1011
+ // shouldUpdateMode 返回元组,将 latestIsView 暴露给外层用于更新 FieldProvider context
1012
+ return shouldUpdateMode ? [FormItem, latestIsView] : FormItem;
961
1013
  };
962
- return /*#__PURE__*/_jsx(FieldProvider, {
963
- value: ((_componentProps2 = componentProps) === null || _componentProps2 === void 0 ? void 0 : _componentProps2.otherProps) || {},
1014
+ return /*#__PURE__*/_jsx(_Fragment, {
964
1015
  children: finalFormItemProps.shouldUpdate ? /*#__PURE__*/_jsx(Form.Item, {
965
1016
  noStyle: true,
966
1017
  shouldUpdate: finalFormItemProps.shouldUpdate,
967
- children: () => getFieldItem(true)
968
- }) : getFieldItem()
1018
+ children: () => {
1019
+ var _componentProps2;
1020
+ // shouldUpdate 触发时外层组件可能因 memo 未重渲染,FieldProvider context 是旧快照
1021
+ // 从 getFieldItem(true) 的元组返回值获取 latestIsView,更新 context 确保 Input 组件读到最新 isView
1022
+ var _ref5 = getFieldItem(true),
1023
+ _ref6 = _slicedToArray(_ref5, 2),
1024
+ formItem = _ref6[0],
1025
+ latestIsView = _ref6[1];
1026
+ return /*#__PURE__*/_jsx(FieldProvider, {
1027
+ value: _objectSpread(_objectSpread({}, (_componentProps2 = componentProps) === null || _componentProps2 === void 0 ? void 0 : _componentProps2.otherProps), {}, {
1028
+ isView: latestIsView
1029
+ }),
1030
+ children: formItem
1031
+ });
1032
+ }
1033
+ }) : /*#__PURE__*/_jsx(FieldProvider, {
1034
+ value: ((_componentProps3 = componentProps) === null || _componentProps3 === void 0 ? void 0 : _componentProps3.otherProps) || {},
1035
+ children: getFieldItem()
1036
+ })
969
1037
  });
970
1038
  };
971
1039
  export default /*#__PURE__*/memo(RenderField, (prevProps, nextProps) => {
@@ -22,7 +22,7 @@ import { useLocalStorageState, useSetState } from 'ahooks';
22
22
  import { ConfigProvider, Form, Affix } from 'antd';
23
23
  import classnames from 'classnames';
24
24
  import { transformColumns } from "./utils";
25
- import { getRandom, getNamePath, handleScrollToError, onPageCheck } from "./utils/tools";
25
+ import { getRandom, getNamePath, handleScrollToError, onPageCheck, buildTableRowKey } from "./utils/tools";
26
26
  import { Validator, Summary, RenderToolbar } from "./components";
27
27
  import ProForm from "../ProForm";
28
28
  import Empty from "../assets/empty.png";
@@ -436,8 +436,10 @@ var ProEditTable = (_ref, ref) => {
436
436
  _dragIndex: idx
437
437
  } : {}));
438
438
  }, [value, virtualKey, editingKeys, draggable]);
439
+ var tableRowKey = useMemo(() => buildTableRowKey(rowKey), [rowKey]);
439
440
  var tableProps = useMemo(() => ({
440
441
  rowKey,
442
+ tableRowKey,
441
443
  value: enrichedValue,
442
444
  headerRender,
443
445
  tableRef,
@@ -457,7 +459,7 @@ var ProEditTable = (_ref, ref) => {
457
459
  formatMessage,
458
460
  locale,
459
461
  handlePageChange
460
- }), [_className, _columns, _rowClassName, disabled, editingKeys, formatMessage, handlePageChange, headerRender, isHideCheckBox, locale, page, pagination, renderRowSelection, rowDraggable, rowKey, scroll, _summary, tableRef, enrichedValue, virtualKey]);
462
+ }), [_className, _columns, _rowClassName, disabled, editingKeys, formatMessage, handlePageChange, headerRender, isHideCheckBox, locale, page, pagination, renderRowSelection, rowDraggable, rowKey, tableRowKey, scroll, _summary, tableRef, enrichedValue, virtualKey]);
461
463
 
462
464
  // 拖拽排序后,enrichedValue 中含 _dragIndex(内部字段),需清除后再传给外部 onChange
463
465
  var handleDragChange = useCallback(newValue => {
@@ -433,4 +433,16 @@
433
433
  }
434
434
  }
435
435
  }
436
+ table .@{ant-prefix}-table-tbody{
437
+ td.@{ant-prefix}-table-selection-column {
438
+ padding-left: 38px;
439
+ }
440
+ }
441
+ }
442
+
443
+ .pro-edit-table{
444
+ .pro-tree-modal .pro-tree-modal-isView .pro-enum-input-addonAfter{
445
+ border: none;
446
+ padding-left: 0;
447
+ }
436
448
  }
@@ -284,14 +284,8 @@ export var transformColumns = function transformColumns() {
284
284
 
285
285
  var required = isBoolean(item.required) ? item.required : false;
286
286
  if (isFunction(item.required)) {
287
- var namePath = getNamePath(name, virtualKey);
288
- var namePathArray = Array.isArray(namePath) ? namePath : [namePath];
289
- var rowData = form.getFieldValue([...namePathArray, index]) || {};
290
- required = item.required(rowData[columnName], rowData, {
291
- form,
292
- index,
293
- namePath: [...namePathArray, index]
294
- });
287
+ // 列配置预处理阶段没有稳定行上下文,required 函数交给 RenderField 内按行计算
288
+ required = false;
295
289
  }
296
290
 
297
291
  // 样式处理
@@ -6,6 +6,13 @@ import { NamePath } from 'antd/es/form/interface';
6
6
  * @returns 随机字符串
7
7
  */
8
8
  export declare const getRandom: () => string;
9
+ /**
10
+ * 构建 AntD Table 的 rowKey 函数,支持字符串/函数两种形式,
11
+ * 当用户指定字段值无效时(新增行尚未填写业务 key),自动降级到内部 record.rowKey。
12
+ * @param rowKey 用户传入的 rowKey prop
13
+ * @returns AntD Table 可用的 rowKey 字符串或函数
14
+ */
15
+ export declare const buildTableRowKey: (rowKey?: string | number | symbol | ((record: any) => any)) => (record: any) => string;
9
16
  /**
10
17
  * 深层次对比两个对象且取出来差异值
11
18
  * @param object 比较对象
@@ -21,6 +21,23 @@ export var getRandom = () => {
21
21
  return Math.random().toString(36).slice(-6);
22
22
  };
23
23
 
24
+ /**
25
+ * 构建 AntD Table 的 rowKey 函数,支持字符串/函数两种形式,
26
+ * 当用户指定字段值无效时(新增行尚未填写业务 key),自动降级到内部 record.rowKey。
27
+ * @param rowKey 用户传入的 rowKey prop
28
+ * @returns AntD Table 可用的 rowKey 字符串或函数
29
+ */
30
+ export var buildTableRowKey = rowKey => {
31
+ return record => {
32
+ if (!rowKey) return String(record.rowKey || '');
33
+ var userKey = typeof rowKey === 'function' ? rowKey(record) : record[rowKey];
34
+ if (userKey != null && !Number.isNaN(userKey) && userKey !== '') {
35
+ return String(userKey);
36
+ }
37
+ return String(record.rowKey || '');
38
+ };
39
+ };
40
+
24
41
  /**
25
42
  * 深层次对比两个对象且取出来差异值
26
43
  * @param object 比较对象
@@ -43,11 +43,15 @@ var FormList = (props, ref) => {
43
43
  name = _ref.name,
44
44
  isView = _ref.isView,
45
45
  diffConfig = _ref.diffConfig,
46
- namePath = _ref.namePath;
46
+ namePath = _ref.namePath,
47
+ source = _ref.source;
47
48
  var _useProConfig = useProConfig('ProForm'),
48
49
  isDiffAll = _useProConfig.isDiffAll;
49
50
  var errors = meta.errors;
50
- var _namePath = namePath ? [...namePath.slice(0, -1), ...toArray(name)] : toArray(name);
51
+
52
+ // 当 FormList 作为 ProEditTable 的列时,otherProps 中的 name 是完整绝对路径(如 ['bindClauseCategoryList', 0, 'test'])
53
+ // 此时直接使用 toArray(name) 作为 _namePath,避免公式拼接导致前缀重复
54
+ var _namePath = source === 'ProEditTable' ? toArray(name) : namePath ? [...namePath.slice(0, -1), ...toArray(name)] : toArray(name);
51
55
  var orgValues = get(diffConfig === null || diffConfig === void 0 ? void 0 : diffConfig.originalValues, name);
52
56
  var _diffConfig = _objectSpread(_objectSpread({}, diffConfig), {}, {
53
57
  originalValues: diffConfig !== null && diffConfig !== void 0 && diffConfig.originalValues && isDiffAll ? orgValues || [] : orgValues
@@ -11,6 +11,24 @@
11
11
  @import '../components/combination/Container/style/index.less';
12
12
 
13
13
  .pro-form {
14
+ .pro-container{
15
+ .pro-collapse {
16
+ .pro-collapse-panel{
17
+ .@{ant-prefix}-collapse-header{
18
+ border-radius:var(--zaui-border-radius, 8px) !important;
19
+ }
20
+ &.@{ant-prefix}-collapse-item-active{
21
+ .@{ant-prefix}-collapse-header{
22
+ border-radius:var(--zaui-border-radius, 8px) var(--zaui-border-radius, 8px) 0 0 !important;
23
+ }
24
+ }
25
+ }
26
+ }
27
+ .pro-collapse-content{
28
+ margin: 0;
29
+ border-radius: 0 0 var(--zaui-border-radius, 8px) var(--zaui-border-radius, 8px);
30
+ }
31
+ }
14
32
  .@{ant-prefix}-input-disabled {
15
33
  border-radius: 6px !important;
16
34
  }
@@ -70,9 +70,6 @@
70
70
  }
71
71
 
72
72
  &-content {
73
- flex: 1;
74
- overflow-y: auto;
75
- min-height: 0; // 重要:允许 flex 子元素缩小到内容以下
76
73
 
77
74
  .tab-pane {
78
75
  &.hidden {
@@ -263,6 +263,41 @@ export var ProSelect = (props, ref) => {
263
263
  };
264
264
  return isFunction(props.optionRender) && record.length ? _optionRender() : labelList === null || labelList === void 0 ? void 0 : labelList.join('、');
265
265
  };
266
+
267
+ // 必须在早期 return 之前声明,确保每次渲染 hooks 调用数量一致(React Rules of Hooks)
268
+ var defaultFilterOption = useCallback((input, option) => {
269
+ var _ref5, _option$searchText;
270
+ if ((option === null || option === void 0 ? void 0 : option.value) == null) return false;
271
+ var optionLabel = (_ref5 = (_option$searchText = option === null || option === void 0 ? void 0 : option.searchText) !== null && _option$searchText !== void 0 ? _option$searchText : option === null || option === void 0 ? void 0 : option.title) !== null && _ref5 !== void 0 ? _ref5 : option === null || option === void 0 ? void 0 : option.label;
272
+ return String(optionLabel !== null && optionLabel !== void 0 ? optionLabel : '').toLowerCase().includes(input.toLowerCase());
273
+ }, []);
274
+ var mergedShowSearch = useMemo(() => {
275
+ var defaultConfig = {
276
+ enabled: true,
277
+ filterOption: isFunction(_onSearch) ? false : defaultFilterOption,
278
+ onSearch: searchValue => {
279
+ _onSearch === null || _onSearch === void 0 || _onSearch(searchValue, _objectSpread({}, fetchFunctionRef.current));
280
+ }
281
+ };
282
+ var customShowSearch = selectProps.showSearch;
283
+ if (customShowSearch === false) {
284
+ return _objectSpread(_objectSpread({}, defaultConfig), {}, {
285
+ enabled: false
286
+ });
287
+ }
288
+ if (customShowSearch === true || customShowSearch == null) {
289
+ return defaultConfig;
290
+ }
291
+ if (isObject(customShowSearch)) {
292
+ var _customShowSearch$fil, _customShowSearch$onS;
293
+ return _objectSpread(_objectSpread(_objectSpread({}, defaultConfig), customShowSearch), {}, {
294
+ enabled: true,
295
+ filterOption: (_customShowSearch$fil = customShowSearch.filterOption) !== null && _customShowSearch$fil !== void 0 ? _customShowSearch$fil : defaultConfig.filterOption,
296
+ onSearch: (_customShowSearch$onS = customShowSearch.onSearch) !== null && _customShowSearch$onS !== void 0 ? _customShowSearch$onS : defaultConfig.onSearch
297
+ });
298
+ }
299
+ return defaultConfig;
300
+ }, [_onSearch, defaultFilterOption, selectProps.showSearch]);
266
301
  if (isView || props.isView) {
267
302
  if (Array.isArray(value)) {
268
303
  // 如果设置了maxTagCount且超出数量,需要截断显示
@@ -347,9 +382,9 @@ export var ProSelect = (props, ref) => {
347
382
  };
348
383
  };
349
384
  var selectOptionRender = option => {
350
- var _option$data2, _ref5, _ref6, _option$data$searchTe, _option$data3, _option$data4;
385
+ var _option$data2, _ref6, _ref7, _option$data$searchTe, _option$data3, _option$data4;
351
386
  var currentRecord = (option === null || option === void 0 || (_option$data2 = option.data) === null || _option$data2 === void 0 ? void 0 : _option$data2.record) || (option === null || option === void 0 ? void 0 : option.record);
352
- var text = (_ref5 = (_ref6 = (_option$data$searchTe = option === null || option === void 0 || (_option$data3 = option.data) === null || _option$data3 === void 0 ? void 0 : _option$data3.searchText) !== null && _option$data$searchTe !== void 0 ? _option$data$searchTe : option === null || option === void 0 || (_option$data4 = option.data) === null || _option$data4 === void 0 ? void 0 : _option$data4.title) !== null && _ref6 !== void 0 ? _ref6 : option === null || option === void 0 ? void 0 : option.label) !== null && _ref5 !== void 0 ? _ref5 : '';
387
+ var text = (_ref6 = (_ref7 = (_option$data$searchTe = option === null || option === void 0 || (_option$data3 = option.data) === null || _option$data3 === void 0 ? void 0 : _option$data3.searchText) !== null && _option$data$searchTe !== void 0 ? _option$data$searchTe : option === null || option === void 0 || (_option$data4 = option.data) === null || _option$data4 === void 0 ? void 0 : _option$data4.title) !== null && _ref7 !== void 0 ? _ref7 : option === null || option === void 0 ? void 0 : option.label) !== null && _ref6 !== void 0 ? _ref6 : '';
353
388
  if (!currentRecord) {
354
389
  return /*#__PURE__*/_jsx(TooltipOption, {
355
390
  title: String(text),
@@ -365,39 +400,6 @@ export var ProSelect = (props, ref) => {
365
400
  })
366
401
  });
367
402
  };
368
- var defaultFilterOption = useCallback((input, option) => {
369
- var _ref7, _option$searchText;
370
- if ((option === null || option === void 0 ? void 0 : option.value) == null) return false;
371
- var optionLabel = (_ref7 = (_option$searchText = option === null || option === void 0 ? void 0 : option.searchText) !== null && _option$searchText !== void 0 ? _option$searchText : option === null || option === void 0 ? void 0 : option.title) !== null && _ref7 !== void 0 ? _ref7 : option === null || option === void 0 ? void 0 : option.label;
372
- return String(optionLabel !== null && optionLabel !== void 0 ? optionLabel : '').toLowerCase().includes(input.toLowerCase());
373
- }, []);
374
- var mergedShowSearch = useMemo(() => {
375
- var defaultConfig = {
376
- enabled: true,
377
- filterOption: isFunction(_onSearch) ? false : defaultFilterOption,
378
- onSearch: searchValue => {
379
- _onSearch === null || _onSearch === void 0 || _onSearch(searchValue, _objectSpread({}, fetchFunctionRef.current));
380
- }
381
- };
382
- var customShowSearch = selectProps.showSearch;
383
- if (customShowSearch === false) {
384
- return _objectSpread(_objectSpread({}, defaultConfig), {}, {
385
- enabled: false
386
- });
387
- }
388
- if (customShowSearch === true || customShowSearch == null) {
389
- return defaultConfig;
390
- }
391
- if (isObject(customShowSearch)) {
392
- var _customShowSearch$fil, _customShowSearch$onS;
393
- return _objectSpread(_objectSpread(_objectSpread({}, defaultConfig), customShowSearch), {}, {
394
- enabled: true,
395
- filterOption: (_customShowSearch$fil = customShowSearch.filterOption) !== null && _customShowSearch$fil !== void 0 ? _customShowSearch$fil : defaultConfig.filterOption,
396
- onSearch: (_customShowSearch$onS = customShowSearch.onSearch) !== null && _customShowSearch$onS !== void 0 ? _customShowSearch$onS : defaultConfig.onSearch
397
- });
398
- }
399
- return defaultConfig;
400
- }, [_onSearch, defaultFilterOption, selectProps.showSearch]);
401
403
  var handleChange = (value, _option) => {
402
404
  // option/其第一层子节点是react节点且是labelInValue就拿record
403
405
  var option = _option;
@@ -29,6 +29,7 @@ var BaseTable = _ref => {
29
29
  var tableProps = _ref.tableProps,
30
30
  resetProps = _objectWithoutProperties(_ref, _excluded);
31
31
  var rowKey = tableProps.rowKey,
32
+ tableRowKey = tableProps.tableRowKey,
32
33
  value = tableProps.value,
33
34
  headerRender = tableProps.headerRender,
34
35
  tableRef = tableProps.tableRef,
@@ -83,7 +84,7 @@ var BaseTable = _ref => {
83
84
  onClick: () => {}
84
85
  })
85
86
  }, resetProps), {}, {
86
- rowKey: rowKey || 'rowKey',
87
+ rowKey: tableRowKey,
87
88
  summary,
88
89
  pagination: pagination ? _objectSpread(_objectSpread({
89
90
  showSizeChanger: true,
@@ -125,6 +125,7 @@ var DraggableTable = _ref3 => {
125
125
  draggableProps = _ref3.draggableProps,
126
126
  resetProps = _objectWithoutProperties(_ref3, _excluded2);
127
127
  var rowKey = tableProps.rowKey,
128
+ tableRowKey = tableProps.tableRowKey,
128
129
  value = tableProps.value,
129
130
  headerRender = tableProps.headerRender,
130
131
  tableRef = tableProps.tableRef,
@@ -181,7 +182,7 @@ var DraggableTable = _ref3 => {
181
182
  }),
182
183
  dataSource: value !== null && value !== void 0 && (_value$2 = value[0]) !== null && _value$2 !== void 0 && _value$2.rowKey ? value : []
183
184
  }, resetProps), {}, {
184
- rowKey: rowKey || 'rowKey',
185
+ rowKey: tableRowKey,
185
186
  pagination: pagination ? _objectSpread({
186
187
  current: page.pageNum,
187
188
  pageSize: page.pageSize,