@nokecy/qc-ui 1.1.93 → 1.1.94

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.
@@ -229,7 +229,19 @@ var ArrayTableInner = (0, _react2.observer)(function (props) {
229
229
  */
230
230
  (0, _react.useEffect)(function () {
231
231
  // 检查必要条件
232
- if (!props.gridKey || !gridApiState || !currentScheme) return;
232
+ if (!props.gridKey || !gridApiState) return;
233
+ // 方案被重置或删除后即时恢复基础列,保留表单实例与未保存的行值。@author nokecy
234
+ if (!currentScheme) {
235
+ if (lastAppliedSchemeRef.current.id) {
236
+ gridApiState.setGridOption('columnDefs', stableColumnDefs);
237
+ gridApiState.resetColumnState();
238
+ lastAppliedSchemeRef.current = {
239
+ id: null,
240
+ updatedAt: undefined
241
+ };
242
+ }
243
+ return;
244
+ }
233
245
  if (!currentScheme.columnConfig || currentScheme.columnConfig.length === 0) return;
234
246
 
235
247
  // 【关键修复】检查方案是否真正变化(比对 ID 和 updatedAt)
@@ -264,6 +276,11 @@ var ArrayTableInner = (0, _react2.observer)(function (props) {
264
276
  state: columnState,
265
277
  applyOrder: true
266
278
  });
279
+ // 在实际应用后立即记账,重置无需等后续 RAF 完成。@author nokecy
280
+ lastAppliedSchemeRef.current = {
281
+ id: currentScheme.id,
282
+ updatedAt: currentScheme.updatedAt
283
+ };
267
284
  }).then(function () {
268
285
  // 等待 Grid 状态稳定(使用 requestAnimationFrame 而非固定延迟)
269
286
  return new Promise(function (resolve) {
@@ -30,7 +30,7 @@ var ARRAY_TABLE_ROW_HEIGHT = exports.ARRAY_TABLE_ROW_HEIGHT = 38;
30
30
  */
31
31
  var arrayTableCellFit = (0, _agGridCommunity.createPart)({
32
32
  feature: 'arrayTableCellFit',
33
- css: "\n .ag-cell .ag-cell-wrapper { height: 100%; }\n .ag-cell .ant-formily-item { margin-bottom: 0; }\n .ag-cell .ant-formily-item-help { position: absolute; }\n .ag-header-cell.qc-array-table-required .ag-header-cell-text::before {\n content: '*';\n color: var(--ag-invalid-color);\n margin-inline-end: 4px;\n }\n "
33
+ css: "\n .ag-cell .ag-cell-wrapper { height: 100%; }\n .ag-cell .ant-formily-item { margin-bottom: 0; }\n /* \u6807\u9898\u548C\u8BF4\u660E\u7531\u5217\u5934\u627F\u8F7D\uFF0ClabelWidth:0 \u672C\u8EAB\u4E0D\u4F1A\u9690\u85CF\u5B57\u6BB5\u6807\u9898\u3002@author nokecy */\n .ag-cell .ant-formily-item-label { display: none; }\n .ag-cell .ant-formily-item-control { flex: 1; min-width: 0; width: 100%; }\n .ag-cell .ant-formily-item-help { position: absolute; }\n .ag-header-cell.qc-array-table-required .ag-header-cell-text::before {\n content: '*';\n color: var(--ag-invalid-color);\n margin-inline-end: 4px;\n }\n "
34
34
  });
35
35
 
36
36
  /** 根据当前 antd 主题生成编辑态或阅读态明细表格主题。@author nokecy */
@@ -709,7 +709,7 @@ var applyNumberInputDefaults = function applyNumberInputDefaults(dataField) {
709
709
  var buildArrayTableColumns = exports.buildArrayTableColumns = function buildArrayTableColumns(dataSource, field, sources) {
710
710
  var arrayPattern = field === null || field === void 0 ? void 0 : field.pattern;
711
711
  return sources.reduce(function (buf, _ref7, key) {
712
- var _ref8, _getReadOnlyFormatter, _dataField$xComponen, _dataField$xComponen2;
712
+ var _dataField$xDecorato, _ref8, _getReadOnlyFormatter, _dataField$xComponen, _dataField$xComponen2;
713
713
  var name = _ref7.name,
714
714
  columnProps = _ref7.columnProps,
715
715
  schema = _ref7.schema,
@@ -745,6 +745,9 @@ var buildArrayTableColumns = exports.buildArrayTableColumns = function buildArra
745
745
  // 这里产出的仍是扁平列定义。@author nokecy
746
746
  var isSequenceColumn = (0, _indexColumn.containsIndexComponent)(schema);
747
747
  var dataField = findDataFieldSchema(schema, name);
748
+ // 单元格不重复显示 FormItem 标签,字段说明统一由列头提示承载。@author nokecy
749
+ var fieldTooltip = dataField === null || dataField === void 0 || (_dataField$xDecorato = dataField['x-decorator-props']) === null || _dataField$xDecorato === void 0 ? void 0 : _dataField$xDecorato.tooltip;
750
+ if (!base.headerTooltip && typeof fieldTooltip === 'string' && !fieldTooltip.includes('{{')) base.headerTooltip = fieldTooltip;
748
751
  var readOnly = isColumnReadOnlyEligible(arrayPattern, dataField, columnProps);
749
752
  var emit = function emit(colDef) {
750
753
  return buf.concat((0, _columnGroup.markHeaderGroup)(isSequenceColumn ? (0, _gridSequence.withDisplaySequencePolicy)(colDef) : (0, _requiredHeader.withRequiredColumnHeader)(colDef, (0, _requiredHeader.isRequiredColumn)(dataField, requiredMark), readOnly), isSequenceColumn ? undefined : headerGroup));
@@ -225,7 +225,19 @@ var ArrayTableInner = observer(function (props) {
225
225
  */
226
226
  useEffect(function () {
227
227
  // 检查必要条件
228
- if (!props.gridKey || !gridApiState || !currentScheme) return;
228
+ if (!props.gridKey || !gridApiState) return;
229
+ // 方案被重置或删除后即时恢复基础列,保留表单实例与未保存的行值。@author nokecy
230
+ if (!currentScheme) {
231
+ if (lastAppliedSchemeRef.current.id) {
232
+ gridApiState.setGridOption('columnDefs', stableColumnDefs);
233
+ gridApiState.resetColumnState();
234
+ lastAppliedSchemeRef.current = {
235
+ id: null,
236
+ updatedAt: undefined
237
+ };
238
+ }
239
+ return;
240
+ }
229
241
  if (!currentScheme.columnConfig || currentScheme.columnConfig.length === 0) return;
230
242
 
231
243
  // 【关键修复】检查方案是否真正变化(比对 ID 和 updatedAt)
@@ -260,6 +272,11 @@ var ArrayTableInner = observer(function (props) {
260
272
  state: columnState,
261
273
  applyOrder: true
262
274
  });
275
+ // 在实际应用后立即记账,重置无需等后续 RAF 完成。@author nokecy
276
+ lastAppliedSchemeRef.current = {
277
+ id: currentScheme.id,
278
+ updatedAt: currentScheme.updatedAt
279
+ };
263
280
  }).then(function () {
264
281
  // 等待 Grid 状态稳定(使用 requestAnimationFrame 而非固定延迟)
265
282
  return new Promise(function (resolve) {
@@ -23,7 +23,7 @@ export var ARRAY_TABLE_ROW_HEIGHT = 38;
23
23
  */
24
24
  var arrayTableCellFit = createPart({
25
25
  feature: 'arrayTableCellFit',
26
- css: "\n .ag-cell .ag-cell-wrapper { height: 100%; }\n .ag-cell .ant-formily-item { margin-bottom: 0; }\n .ag-cell .ant-formily-item-help { position: absolute; }\n .ag-header-cell.qc-array-table-required .ag-header-cell-text::before {\n content: '*';\n color: var(--ag-invalid-color);\n margin-inline-end: 4px;\n }\n "
26
+ css: "\n .ag-cell .ag-cell-wrapper { height: 100%; }\n .ag-cell .ant-formily-item { margin-bottom: 0; }\n /* \u6807\u9898\u548C\u8BF4\u660E\u7531\u5217\u5934\u627F\u8F7D\uFF0ClabelWidth:0 \u672C\u8EAB\u4E0D\u4F1A\u9690\u85CF\u5B57\u6BB5\u6807\u9898\u3002@author nokecy */\n .ag-cell .ant-formily-item-label { display: none; }\n .ag-cell .ant-formily-item-control { flex: 1; min-width: 0; width: 100%; }\n .ag-cell .ant-formily-item-help { position: absolute; }\n .ag-header-cell.qc-array-table-required .ag-header-cell-text::before {\n content: '*';\n color: var(--ag-invalid-color);\n margin-inline-end: 4px;\n }\n "
27
27
  });
28
28
 
29
29
  /** 根据当前 antd 主题生成编辑态或阅读态明细表格主题。@author nokecy */
@@ -700,7 +700,7 @@ var applyNumberInputDefaults = function applyNumberInputDefaults(dataField) {
700
700
  var buildArrayTableColumns = function buildArrayTableColumns(dataSource, field, sources) {
701
701
  var arrayPattern = field === null || field === void 0 ? void 0 : field.pattern;
702
702
  return sources.reduce(function (buf, _ref7, key) {
703
- var _ref8, _getReadOnlyFormatter, _dataField$xComponen, _dataField$xComponen2;
703
+ var _dataField$xDecorato, _ref8, _getReadOnlyFormatter, _dataField$xComponen, _dataField$xComponen2;
704
704
  var name = _ref7.name,
705
705
  columnProps = _ref7.columnProps,
706
706
  schema = _ref7.schema,
@@ -736,6 +736,9 @@ var buildArrayTableColumns = function buildArrayTableColumns(dataSource, field,
736
736
  // 这里产出的仍是扁平列定义。@author nokecy
737
737
  var isSequenceColumn = containsIndexComponent(schema);
738
738
  var dataField = findDataFieldSchema(schema, name);
739
+ // 单元格不重复显示 FormItem 标签,字段说明统一由列头提示承载。@author nokecy
740
+ var fieldTooltip = dataField === null || dataField === void 0 || (_dataField$xDecorato = dataField['x-decorator-props']) === null || _dataField$xDecorato === void 0 ? void 0 : _dataField$xDecorato.tooltip;
741
+ if (!base.headerTooltip && typeof fieldTooltip === 'string' && !fieldTooltip.includes('{{')) base.headerTooltip = fieldTooltip;
739
742
  var readOnly = isColumnReadOnlyEligible(arrayPattern, dataField, columnProps);
740
743
  var emit = function emit(colDef) {
741
744
  return buf.concat(markHeaderGroup(isSequenceColumn ? withDisplaySequencePolicy(colDef) : withRequiredColumnHeader(colDef, isRequiredColumn(dataField, requiredMark), readOnly), isSequenceColumn ? undefined : headerGroup));