@zat-design/sisyphus-react 4.1.3-beta.3 → 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.
@@ -32,6 +32,7 @@ import transformNames from "../../../ProForm/utils/transformNames";
32
32
  import { FieldProvider } from "../../../ProForm/utils/useFieldProps";
33
33
  import useRules from "../../../ProForm/utils/useRules";
34
34
  import { isSelect, isTrim } from "../../../ProForm/utils";
35
+ import locale from "../../../locale";
35
36
  import ConfirmWrapper from "../../../ProForm/components/render/ConfirmWrapper";
36
37
  import { getDefaultProps } from "../../utils/getDefaultProps";
37
38
  import ListChangedWrapper from "./ListChangedWrapper";
@@ -215,13 +216,13 @@ var RenderField = _ref => {
215
216
  // 将Hooks调用移到组件顶层
216
217
  var proConfig = useProConfig();
217
218
 
218
- // 设置校验规则 - 修复Hooks使用规则
219
+ // 设置校验规则 - 不在此处过滤 isView,由 getFieldItem 内根据 latestIsView 动态决定是否应用规则
219
220
  var internalRule = useRules({
220
221
  names,
221
222
  label: label,
222
223
  labelRequired,
223
- required: !isView && _required,
224
- rules: !isView ? _rules : [],
224
+ required: _required,
225
+ rules: _rules,
225
226
  isSelect: isSelect({
226
227
  dataSource: (_fieldProps2 = _fieldProps) === null || _fieldProps2 === void 0 ? void 0 : _fieldProps2.dataSource,
227
228
  type
@@ -755,10 +756,8 @@ var RenderField = _ref => {
755
756
  });
756
757
  }, [_formItemProps, defaultTransform, namesTransform, type, trim, proConfig]);
757
758
 
758
- // 编辑&保存模式,在查看状态下移除表单的rules不做校验
759
- if (isView) {
760
- delete finalFormItemProps.rules;
761
- }
759
+ // rules 的 isView 过滤已移至 getFieldItem 内处理(支持 shouldUpdate 模式下的动态 isEditable)
760
+
762
761
  var _className = useMemo(() => classNames({
763
762
  [className]: className
764
763
  }), [className]);
@@ -771,6 +770,10 @@ var RenderField = _ref => {
771
770
  var finalComponentProps = componentProps;
772
771
  // shouldUpdate 模式下会被更新为最新值,供外层 FieldProvider 消费
773
772
  var latestIsView = isView;
773
+ // 用于在 shouldUpdate 模式下重建正确的 Form.Item rules(外层 finalFormItemProps 是旧闭包)
774
+ var effectiveRequired = _required;
775
+ var effectiveRules = _rules;
776
+ var effectiveFieldProps = _fieldProps;
774
777
  if (shouldUpdateMode) {
775
778
  var _column$isEditable2;
776
779
  // 重新获取最新的行数据(shouldUpdate 触发时,通过 getFieldValue 拿到最新值)
@@ -800,6 +803,11 @@ var RenderField = _ref => {
800
803
  latestRules = rules(latestRowData, latestReactiveParams);
801
804
  }
802
805
 
806
+ // 同步到外层变量,用于后续构建 activeFinalFormItemProps
807
+ effectiveRequired = latestRequired;
808
+ effectiveRules = latestRules;
809
+ effectiveFieldProps = latestFieldProps;
810
+
803
811
  // 重新计算 desensitization
804
812
  var latestDesensitization = desensitization || [];
805
813
  if (isFunction(desensitization)) {
@@ -905,6 +913,34 @@ var RenderField = _ref => {
905
913
  }
906
914
  }
907
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
+ }
908
944
  var FormItem = null;
909
945
  // 当 viewRender 存在时,需要排除 finalComponentProps 中的 children,避免覆盖 Container 的 children
910
946
  var propsForTarget = isView && typeof viewRender === 'function' ? omit(finalComponentProps, ['children']) : finalComponentProps;
@@ -952,7 +988,7 @@ var RenderField = _ref => {
952
988
  }
953
989
  FormItem = TargetComponent ? /*#__PURE__*/_jsx(Form.Item, _objectSpread(_objectSpread({
954
990
  validateFirst: true
955
- }, 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])), {}, {
956
992
  // 移除非必要字段,但保留 dependencies
957
993
  className: _className,
958
994
  name: formNamePath ? cellName.slice((formNamePath === null || formNamePath === void 0 ? void 0 : formNamePath.length) - 1) : cellName,
@@ -963,7 +999,7 @@ var RenderField = _ref => {
963
999
  if (type === 'FormList') {
964
1000
  FormItem = /*#__PURE__*/_jsx(Form.List, _objectSpread(_objectSpread({
965
1001
  name: formNamePath ? cellName.slice((formNamePath === null || formNamePath === void 0 ? void 0 : formNamePath.length) - 1) : cellName
966
- }, omit(finalFormItemProps, ['render', 'key', 'width', 'hiddenNames', 'name'])), {}, {
1002
+ }, omit(activeFinalFormItemProps, ['render', 'key', 'width', 'hiddenNames', 'name'])), {}, {
967
1003
  children: (fields, operation, meta) => /*#__PURE__*/_jsx(TargetComponent, _objectSpread(_objectSpread({}, finalComponentProps), {}, {
968
1004
  otherProps: otherProps,
969
1005
  fields: fields,
@@ -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
  // 样式处理
@@ -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;
@@ -19,6 +19,7 @@ var _transformNames = _interopRequireDefault(require("../../../ProForm/utils/tra
19
19
  var _useFieldProps = require("../../../ProForm/utils/useFieldProps");
20
20
  var _useRules = _interopRequireDefault(require("../../../ProForm/utils/useRules"));
21
21
  var _utils2 = require("../../../ProForm/utils");
22
+ var _locale = _interopRequireDefault(require("../../../locale"));
22
23
  var _ConfirmWrapper = _interopRequireDefault(require("../../../ProForm/components/render/ConfirmWrapper"));
23
24
  var _getDefaultProps = require("../../utils/getDefaultProps");
24
25
  var _ListChangedWrapper = _interopRequireDefault(require("./ListChangedWrapper"));
@@ -222,13 +223,13 @@ var RenderField = _ref => {
222
223
  // 将Hooks调用移到组件顶层
223
224
  var proConfig = (0, _ProConfigProvider.useProConfig)();
224
225
 
225
- // 设置校验规则 - 修复Hooks使用规则
226
+ // 设置校验规则 - 不在此处过滤 isView,由 getFieldItem 内根据 latestIsView 动态决定是否应用规则
226
227
  var internalRule = (0, _useRules.default)({
227
228
  names,
228
229
  label: label,
229
230
  labelRequired,
230
- required: !isView && _required,
231
- rules: !isView ? _rules : [],
231
+ required: _required,
232
+ rules: _rules,
232
233
  isSelect: (0, _utils2.isSelect)({
233
234
  dataSource: (_fieldProps2 = _fieldProps) === null || _fieldProps2 === void 0 ? void 0 : _fieldProps2.dataSource,
234
235
  type
@@ -762,10 +763,8 @@ var RenderField = _ref => {
762
763
  });
763
764
  }, [_formItemProps, defaultTransform, namesTransform, type, trim, proConfig]);
764
765
 
765
- // 编辑&保存模式,在查看状态下移除表单的rules不做校验
766
- if (isView) {
767
- delete finalFormItemProps.rules;
768
- }
766
+ // rules 的 isView 过滤已移至 getFieldItem 内处理(支持 shouldUpdate 模式下的动态 isEditable)
767
+
769
768
  var _className = (0, _react.useMemo)(() => (0, _classnames.default)({
770
769
  [className]: className
771
770
  }), [className]);
@@ -778,6 +777,10 @@ var RenderField = _ref => {
778
777
  var finalComponentProps = componentProps;
779
778
  // shouldUpdate 模式下会被更新为最新值,供外层 FieldProvider 消费
780
779
  var latestIsView = isView;
780
+ // 用于在 shouldUpdate 模式下重建正确的 Form.Item rules(外层 finalFormItemProps 是旧闭包)
781
+ var effectiveRequired = _required;
782
+ var effectiveRules = _rules;
783
+ var effectiveFieldProps = _fieldProps;
781
784
  if (shouldUpdateMode) {
782
785
  var _column$isEditable2;
783
786
  // 重新获取最新的行数据(shouldUpdate 触发时,通过 getFieldValue 拿到最新值)
@@ -807,6 +810,11 @@ var RenderField = _ref => {
807
810
  latestRules = rules(latestRowData, latestReactiveParams);
808
811
  }
809
812
 
813
+ // 同步到外层变量,用于后续构建 activeFinalFormItemProps
814
+ effectiveRequired = latestRequired;
815
+ effectiveRules = latestRules;
816
+ effectiveFieldProps = latestFieldProps;
817
+
810
818
  // 重新计算 desensitization
811
819
  var latestDesensitization = desensitization || [];
812
820
  if ((0, _lodash.isFunction)(desensitization)) {
@@ -912,6 +920,34 @@ var RenderField = _ref => {
912
920
  }
913
921
  }
914
922
  }
923
+
924
+ // 根据 latestIsView 和最新的 required/rules 构建正确的 Form.Item props
925
+ // 解决 shouldUpdate 触发时外层 finalFormItemProps 是旧闭包(rules 基于旧 isView 计算)的问题
926
+ var activeFinalFormItemProps = finalFormItemProps;
927
+ if (latestIsView) {
928
+ // 查看模式:移除 rules 不做校验
929
+ activeFinalFormItemProps = (0, _lodash.omit)(finalFormItemProps, ['rules']);
930
+ } else if (shouldUpdateMode) {
931
+ // shouldUpdate 模式下 finalFormItemProps 是旧闭包,需用最新 effectiveRequired/effectiveRules 重建 rules
932
+ var activeRules = Array.isArray(effectiveRules) ? [...effectiveRules] : [];
933
+ var hasRequiredRule = activeRules.some(r => (r === null || r === void 0 ? void 0 : r.required) === true);
934
+ if (effectiveRequired && !hasRequiredRule) {
935
+ var _effectiveFieldProps;
936
+ var _isSelectVal = (0, _utils2.isSelect)({
937
+ dataSource: (_effectiveFieldProps = effectiveFieldProps) === null || _effectiveFieldProps === void 0 ? void 0 : _effectiveFieldProps.dataSource,
938
+ type
939
+ });
940
+ activeRules.push({
941
+ required: true,
942
+ message: `${_isSelectVal ? _locale.default.ProForm.selectPlaceHolder : _locale.default.ProForm.inputPlaceholder}${label || ''}`
943
+ });
944
+ }
945
+ activeFinalFormItemProps = _objectSpread(_objectSpread({}, finalFormItemProps), {}, {
946
+ rules: activeRules.length > 0 ? activeRules : [{
947
+ required: false
948
+ }]
949
+ });
950
+ }
915
951
  var FormItem = null;
916
952
  // 当 viewRender 存在时,需要排除 finalComponentProps 中的 children,避免覆盖 Container 的 children
917
953
  var propsForTarget = isView && typeof viewRender === 'function' ? (0, _lodash.omit)(finalComponentProps, ['children']) : finalComponentProps;
@@ -959,7 +995,7 @@ var RenderField = _ref => {
959
995
  }
960
996
  FormItem = TargetComponent ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Form.Item, _objectSpread(_objectSpread({
961
997
  validateFirst: true
962
- }, (0, _lodash.omit)(finalFormItemProps, ['render', 'key', 'width', 'hiddenNames', 'name', 'onCell', 'disabled', _formItemProps.shouldUpdate ? 'shouldUpdate' : null])), {}, {
998
+ }, (0, _lodash.omit)(activeFinalFormItemProps, ['render', 'key', 'width', 'hiddenNames', 'name', 'onCell', 'disabled', _formItemProps.shouldUpdate ? 'shouldUpdate' : null])), {}, {
963
999
  // 移除非必要字段,但保留 dependencies
964
1000
  className: _className,
965
1001
  name: formNamePath ? cellName.slice((formNamePath === null || formNamePath === void 0 ? void 0 : formNamePath.length) - 1) : cellName,
@@ -970,7 +1006,7 @@ var RenderField = _ref => {
970
1006
  if (type === 'FormList') {
971
1007
  FormItem = /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Form.List, _objectSpread(_objectSpread({
972
1008
  name: formNamePath ? cellName.slice((formNamePath === null || formNamePath === void 0 ? void 0 : formNamePath.length) - 1) : cellName
973
- }, (0, _lodash.omit)(finalFormItemProps, ['render', 'key', 'width', 'hiddenNames', 'name'])), {}, {
1009
+ }, (0, _lodash.omit)(activeFinalFormItemProps, ['render', 'key', 'width', 'hiddenNames', 'name'])), {}, {
974
1010
  children: (fields, operation, meta) => /*#__PURE__*/(0, _jsxRuntime.jsx)(TargetComponent, _objectSpread(_objectSpread({}, finalComponentProps), {}, {
975
1011
  otherProps: otherProps,
976
1012
  fields: fields,
@@ -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
  }
@@ -290,14 +290,8 @@ var transformColumns = exports.transformColumns = function transformColumns() {
290
290
 
291
291
  var required = (0, _lodash.isBoolean)(item.required) ? item.required : false;
292
292
  if ((0, _lodash.isFunction)(item.required)) {
293
- var namePath = (0, _tools.getNamePath)(name, virtualKey);
294
- var namePathArray = Array.isArray(namePath) ? namePath : [namePath];
295
- var rowData = form.getFieldValue([...namePathArray, index]) || {};
296
- required = item.required(rowData[columnName], rowData, {
297
- form,
298
- index,
299
- namePath: [...namePathArray, index]
300
- });
293
+ // 列配置预处理阶段没有稳定行上下文,required 函数交给 RenderField 内按行计算
294
+ required = false;
301
295
  }
302
296
 
303
297
  // 样式处理
@@ -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 {
@@ -269,6 +269,41 @@ var ProSelect = (props, ref) => {
269
269
  };
270
270
  return (0, _lodash.isFunction)(props.optionRender) && record.length ? _optionRender() : labelList === null || labelList === void 0 ? void 0 : labelList.join('、');
271
271
  };
272
+
273
+ // 必须在早期 return 之前声明,确保每次渲染 hooks 调用数量一致(React Rules of Hooks)
274
+ var defaultFilterOption = (0, _react.useCallback)((input, option) => {
275
+ var _ref5, _option$searchText;
276
+ if ((option === null || option === void 0 ? void 0 : option.value) == null) return false;
277
+ 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;
278
+ return String(optionLabel !== null && optionLabel !== void 0 ? optionLabel : '').toLowerCase().includes(input.toLowerCase());
279
+ }, []);
280
+ var mergedShowSearch = (0, _react.useMemo)(() => {
281
+ var defaultConfig = {
282
+ enabled: true,
283
+ filterOption: (0, _lodash.isFunction)(_onSearch) ? false : defaultFilterOption,
284
+ onSearch: searchValue => {
285
+ _onSearch === null || _onSearch === void 0 || _onSearch(searchValue, _objectSpread({}, fetchFunctionRef.current));
286
+ }
287
+ };
288
+ var customShowSearch = selectProps.showSearch;
289
+ if (customShowSearch === false) {
290
+ return _objectSpread(_objectSpread({}, defaultConfig), {}, {
291
+ enabled: false
292
+ });
293
+ }
294
+ if (customShowSearch === true || customShowSearch == null) {
295
+ return defaultConfig;
296
+ }
297
+ if ((0, _lodash.isObject)(customShowSearch)) {
298
+ var _customShowSearch$fil, _customShowSearch$onS;
299
+ return _objectSpread(_objectSpread(_objectSpread({}, defaultConfig), customShowSearch), {}, {
300
+ enabled: true,
301
+ filterOption: (_customShowSearch$fil = customShowSearch.filterOption) !== null && _customShowSearch$fil !== void 0 ? _customShowSearch$fil : defaultConfig.filterOption,
302
+ onSearch: (_customShowSearch$onS = customShowSearch.onSearch) !== null && _customShowSearch$onS !== void 0 ? _customShowSearch$onS : defaultConfig.onSearch
303
+ });
304
+ }
305
+ return defaultConfig;
306
+ }, [_onSearch, defaultFilterOption, selectProps.showSearch]);
272
307
  if (isView || props.isView) {
273
308
  if (Array.isArray(value)) {
274
309
  // 如果设置了maxTagCount且超出数量,需要截断显示
@@ -353,9 +388,9 @@ var ProSelect = (props, ref) => {
353
388
  };
354
389
  };
355
390
  var selectOptionRender = option => {
356
- var _option$data2, _ref5, _ref6, _option$data$searchTe, _option$data3, _option$data4;
391
+ var _option$data2, _ref6, _ref7, _option$data$searchTe, _option$data3, _option$data4;
357
392
  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);
358
- 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 : '';
393
+ 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 : '';
359
394
  if (!currentRecord) {
360
395
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(TooltipOption, {
361
396
  title: String(text),
@@ -371,39 +406,6 @@ var ProSelect = (props, ref) => {
371
406
  })
372
407
  });
373
408
  };
374
- var defaultFilterOption = (0, _react.useCallback)((input, option) => {
375
- var _ref7, _option$searchText;
376
- if ((option === null || option === void 0 ? void 0 : option.value) == null) return false;
377
- 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;
378
- return String(optionLabel !== null && optionLabel !== void 0 ? optionLabel : '').toLowerCase().includes(input.toLowerCase());
379
- }, []);
380
- var mergedShowSearch = (0, _react.useMemo)(() => {
381
- var defaultConfig = {
382
- enabled: true,
383
- filterOption: (0, _lodash.isFunction)(_onSearch) ? false : defaultFilterOption,
384
- onSearch: searchValue => {
385
- _onSearch === null || _onSearch === void 0 || _onSearch(searchValue, _objectSpread({}, fetchFunctionRef.current));
386
- }
387
- };
388
- var customShowSearch = selectProps.showSearch;
389
- if (customShowSearch === false) {
390
- return _objectSpread(_objectSpread({}, defaultConfig), {}, {
391
- enabled: false
392
- });
393
- }
394
- if (customShowSearch === true || customShowSearch == null) {
395
- return defaultConfig;
396
- }
397
- if ((0, _lodash.isObject)(customShowSearch)) {
398
- var _customShowSearch$fil, _customShowSearch$onS;
399
- return _objectSpread(_objectSpread(_objectSpread({}, defaultConfig), customShowSearch), {}, {
400
- enabled: true,
401
- filterOption: (_customShowSearch$fil = customShowSearch.filterOption) !== null && _customShowSearch$fil !== void 0 ? _customShowSearch$fil : defaultConfig.filterOption,
402
- onSearch: (_customShowSearch$onS = customShowSearch.onSearch) !== null && _customShowSearch$onS !== void 0 ? _customShowSearch$onS : defaultConfig.onSearch
403
- });
404
- }
405
- return defaultConfig;
406
- }, [_onSearch, defaultFilterOption, selectProps.showSearch]);
407
409
  var handleChange = (value, _option) => {
408
410
  // option/其第一层子节点是react节点且是labelInValue就拿record
409
411
  var option = _option;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zat-design/sisyphus-react",
3
- "version": "4.1.3-beta.3",
3
+ "version": "4.1.3-beta.5",
4
4
  "license": "MIT",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -45,6 +45,7 @@
45
45
  "lint-staged": "lint-staged",
46
46
  "lint-staged:js": "eslint --ext .js,.jsx,.ts,.tsx --ignore-pattern '**/__tests__/**' --ignore-pattern '**/*.test.*' --ignore-pattern '**/*.spec.*'",
47
47
  "code-standards:check": "node ./scripts/code-standards-check.mjs",
48
+ "commit-msg:format": "node ./scripts/format-commit-msg.mjs",
48
49
  "git:pull:dev_4": "git pull --tags --no-rebase origin dev_4",
49
50
  "lint:fix": "eslint --fix --cache --ext .js,.jsx,.ts,.tsx --format=pretty ./src",
50
51
  "lint:js": "eslint --cache --ext .js,.jsx,.ts,.tsx --format=pretty ./src",
@@ -63,7 +64,7 @@
63
64
  },
64
65
  "husky": {
65
66
  "hooks": {
66
- "commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
67
+ "commit-msg": "npm run commit-msg:format -- \"$HUSKY_GIT_PARAMS\" && commitlint -E HUSKY_GIT_PARAMS",
67
68
  "pre-commit": "npm run lint-staged && npm run code-standards:check"
68
69
  }
69
70
  },