@nokecy/qc-ui 1.1.87 → 1.1.89

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.
Files changed (98) hide show
  1. package/dist/cjs/ag-grid-plus/ag-gridPlus.js +151 -145
  2. package/dist/cjs/ag-grid-plus/context/useSchemeDataFlow.js +4 -4
  3. package/dist/cjs/ag-grid-plus/interface.d.ts +8 -0
  4. package/dist/cjs/ag-grid-plus/queryForm/index.d.ts +4 -0
  5. package/dist/cjs/ag-grid-plus/queryForm/index.js +63 -53
  6. package/dist/cjs/ag-grid-plus/queryForm/queryColumns.d.ts +8 -0
  7. package/dist/cjs/ag-grid-plus/queryForm/queryColumns.js +52 -0
  8. package/dist/cjs/ag-grid-plus/queryForm/schemaKey.d.ts +15 -8
  9. package/dist/cjs/ag-grid-plus/queryForm/schemaKey.js +64 -12
  10. package/dist/cjs/ag-grid-plus/setting/ColumnConfigForm.js +3 -0
  11. package/dist/cjs/ag-grid-plus/setting/ColumnSetting.js +69 -106
  12. package/dist/cjs/ag-grid-plus/setting/QuerySchemeManager.js +3 -1
  13. package/dist/cjs/ag-grid-plus/setting/columnGroupTypes.d.ts +2 -0
  14. package/dist/cjs/ag-grid-plus/setting/columnGroupUtils.d.ts +14 -0
  15. package/dist/cjs/ag-grid-plus/setting/columnGroupUtils.js +98 -110
  16. package/dist/cjs/ag-grid-plus/types.d.ts +6 -0
  17. package/dist/cjs/array-table/batchRemove.d.ts +36 -0
  18. package/dist/cjs/array-table/batchRemove.js +299 -0
  19. package/dist/cjs/array-table/cellFocusScope.js +44 -8
  20. package/dist/cjs/array-table/cellInteractionLock.d.ts +13 -0
  21. package/dist/cjs/array-table/cellInteractionLock.js +26 -0
  22. package/dist/cjs/array-table/hooks.d.ts +11 -6
  23. package/dist/cjs/array-table/hooks.js +138 -88
  24. package/dist/cjs/array-table/index.d.ts +8 -2
  25. package/dist/cjs/array-table/index.js +55 -32
  26. package/dist/cjs/array-table/indexColumn.d.ts +1 -1
  27. package/dist/cjs/array-table/indexColumn.js +3 -2
  28. package/dist/cjs/array-table/interface.d.ts +13 -1
  29. package/dist/cjs/array-table/preview.js +8 -0
  30. package/dist/cjs/array-table/readOnlyFormatters.d.ts +9 -1
  31. package/dist/cjs/array-table/readOnlyFormatters.js +41 -13
  32. package/dist/cjs/array-table/rowIdentity.d.ts +17 -0
  33. package/dist/cjs/array-table/rowIdentity.js +43 -0
  34. package/dist/cjs/array-table/sorting.d.ts +3 -0
  35. package/dist/cjs/array-table/sorting.js +46 -0
  36. package/dist/cjs/array-table/utils.js +146 -67
  37. package/dist/cjs/dialogSelect/index.d.ts +3 -0
  38. package/dist/cjs/dialogSelect/index.js +13 -3
  39. package/dist/cjs/editable/index.js +101 -139
  40. package/dist/cjs/index.d.ts +2 -2
  41. package/dist/cjs/index.js +14 -0
  42. package/dist/cjs/readPretty/arrayTable.js +29 -14
  43. package/dist/cjs/readPretty/formily.d.ts +1 -0
  44. package/dist/cjs/readPretty/formily.js +7 -0
  45. package/dist/cjs/readPretty/index.d.ts +1 -0
  46. package/dist/cjs/readPretty/index.js +7 -0
  47. package/dist/cjs/readPretty/schemaScope.d.ts +2 -0
  48. package/dist/cjs/readPretty/schemaScope.js +49 -0
  49. package/dist/esm/ag-grid-plus/ag-gridPlus.js +151 -145
  50. package/dist/esm/ag-grid-plus/context/useSchemeDataFlow.js +4 -4
  51. package/dist/esm/ag-grid-plus/interface.d.ts +8 -0
  52. package/dist/esm/ag-grid-plus/queryForm/index.d.ts +4 -0
  53. package/dist/esm/ag-grid-plus/queryForm/index.js +64 -55
  54. package/dist/esm/ag-grid-plus/queryForm/queryColumns.d.ts +8 -0
  55. package/dist/esm/ag-grid-plus/queryForm/queryColumns.js +46 -0
  56. package/dist/esm/ag-grid-plus/queryForm/schemaKey.d.ts +15 -8
  57. package/dist/esm/ag-grid-plus/queryForm/schemaKey.js +64 -12
  58. package/dist/esm/ag-grid-plus/setting/ColumnConfigForm.js +3 -0
  59. package/dist/esm/ag-grid-plus/setting/ColumnSetting.js +70 -107
  60. package/dist/esm/ag-grid-plus/setting/QuerySchemeManager.js +3 -1
  61. package/dist/esm/ag-grid-plus/setting/columnGroupTypes.d.ts +2 -0
  62. package/dist/esm/ag-grid-plus/setting/columnGroupUtils.d.ts +14 -0
  63. package/dist/esm/ag-grid-plus/setting/columnGroupUtils.js +95 -110
  64. package/dist/esm/ag-grid-plus/types.d.ts +6 -0
  65. package/dist/esm/array-table/batchRemove.d.ts +36 -0
  66. package/dist/esm/array-table/batchRemove.js +289 -0
  67. package/dist/esm/array-table/cellFocusScope.js +45 -9
  68. package/dist/esm/array-table/cellInteractionLock.d.ts +13 -0
  69. package/dist/esm/array-table/cellInteractionLock.js +21 -0
  70. package/dist/esm/array-table/hooks.d.ts +11 -6
  71. package/dist/esm/array-table/hooks.js +139 -89
  72. package/dist/esm/array-table/index.d.ts +8 -2
  73. package/dist/esm/array-table/index.js +55 -32
  74. package/dist/esm/array-table/indexColumn.d.ts +1 -1
  75. package/dist/esm/array-table/indexColumn.js +3 -2
  76. package/dist/esm/array-table/interface.d.ts +13 -1
  77. package/dist/esm/array-table/preview.js +8 -0
  78. package/dist/esm/array-table/readOnlyFormatters.d.ts +9 -1
  79. package/dist/esm/array-table/readOnlyFormatters.js +41 -12
  80. package/dist/esm/array-table/rowIdentity.d.ts +17 -0
  81. package/dist/esm/array-table/rowIdentity.js +37 -0
  82. package/dist/esm/array-table/sorting.d.ts +3 -0
  83. package/dist/esm/array-table/sorting.js +40 -0
  84. package/dist/esm/array-table/utils.js +147 -68
  85. package/dist/esm/dialogSelect/index.d.ts +3 -0
  86. package/dist/esm/dialogSelect/index.js +13 -3
  87. package/dist/esm/editable/index.js +102 -140
  88. package/dist/esm/index.d.ts +2 -2
  89. package/dist/esm/index.js +1 -1
  90. package/dist/esm/readPretty/arrayTable.js +30 -13
  91. package/dist/esm/readPretty/formily.d.ts +1 -0
  92. package/dist/esm/readPretty/formily.js +1 -0
  93. package/dist/esm/readPretty/index.d.ts +1 -0
  94. package/dist/esm/readPretty/index.js +1 -0
  95. package/dist/esm/readPretty/schemaScope.d.ts +2 -0
  96. package/dist/esm/readPretty/schemaScope.js +42 -0
  97. package/dist/umd/qc-ui.min.js +1 -1
  98. package/package.json +1 -1
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.resolveQueryColumns = void 0;
7
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
8
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
9
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
10
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
11
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
12
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
13
+ /**
14
+ * 从同一轮渲染的列定义快照派生查询项,不在副作用中读取 AG Grid 的上一轮定义。
15
+ * 表头名称跟随生效列方案;查询专用元数据和独立标题由页面声明。
16
+ * @author nokecy
17
+ */
18
+ var resolveQueryColumns = exports.resolveQueryColumns = function resolveQueryColumns(sourceColumns, effectiveColumns, columnStates) {
19
+ var effectiveById = new Map();
20
+ effectiveColumns.forEach(function (column) {
21
+ if (column.colId) effectiveById.set(column.colId, column);
22
+ if (column.field) effectiveById.set(column.field, column);
23
+ });
24
+ var stateById = new Map(columnStates.map(function (state) {
25
+ return [state.colId, state];
26
+ }));
27
+ return sourceColumns.map(function (source) {
28
+ var _source$colId, _ref, _state$hide, _effective$headerName;
29
+ var columnId = (_source$colId = source.colId) !== null && _source$colId !== void 0 ? _source$colId : source.field;
30
+ var effective = columnId ? effectiveById.get(columnId) : undefined;
31
+ var state = columnId ? stateById.get(columnId) : undefined;
32
+ return _objectSpread(_objectSpread(_objectSpread({}, source), effective), {}, {
33
+ // 查询只使用列状态的显隐;null 表示沿用生效列定义。@author nokecy
34
+ hide: (_ref = (_state$hide = state === null || state === void 0 ? void 0 : state.hide) !== null && _state$hide !== void 0 ? _state$hide : effective === null || effective === void 0 ? void 0 : effective.hide) !== null && _ref !== void 0 ? _ref : source.hide,
35
+ // 查询元数据不从持久表格方案反向覆盖源码。@author nokecy
36
+ field: source.field,
37
+ queryField: source.queryField,
38
+ headerName: (_effective$headerName = effective === null || effective === void 0 ? void 0 : effective.headerName) !== null && _effective$headerName !== void 0 ? _effective$headerName : source.headerName,
39
+ searchTitle: source.searchTitle,
40
+ hideInSearch: source.hideInSearch,
41
+ hideInTable: source.hideInTable,
42
+ filter: source.filter,
43
+ type: source.type,
44
+ enum: source.enum,
45
+ searchComponent: source.searchComponent,
46
+ searchComponentProps: source.searchComponentProps
47
+ });
48
+ }).filter(function (column) {
49
+ var _column$queryField;
50
+ return Boolean((_column$queryField = column.queryField) !== null && _column$queryField !== void 0 ? _column$queryField : column.field) && column.filter !== false && !column.hideInSearch && (column.hideInTable || column.visible !== false && !column.hide);
51
+ });
52
+ };
@@ -1,19 +1,26 @@
1
1
  type ColumnStateLike = {
2
2
  colId?: string | null;
3
+ hide?: boolean | null;
3
4
  };
4
5
  type QueryColumnLike = {
5
6
  field?: string;
7
+ colId?: string;
8
+ queryField?: string;
6
9
  headerName?: string;
7
- searchComponentProps?: {
8
- options?: readonly {
9
- value?: unknown;
10
- label?: unknown;
11
- }[];
12
- };
10
+ searchTitle?: string;
11
+ hide?: boolean;
12
+ hideInSearch?: boolean;
13
+ hideInTable?: boolean;
14
+ visible?: boolean;
15
+ filter?: unknown;
16
+ type?: unknown;
17
+ enum?: unknown;
18
+ searchComponent?: unknown;
19
+ searchComponentProps?: unknown;
13
20
  };
14
21
  /**
15
- * 查询区 schema 的重建键:列(id、字段、标题)或下拉选项变了才重建。
16
- * 下拉选项常在首帧之后才到(如从基础资料接口取名称),只看列与标题时选项停在首帧。
22
+ * 查询区只在有效查询元数据变化时更新 schema,列宽、固定位置和排序不参与。
23
+ * 接受列状态参数以兼容原调用方;表单传入已经合并状态的有效查询列快照。
17
24
  * @author nokecy
18
25
  */
19
26
  export declare const queryFormSchemaKey: (columnStates?: readonly ColumnStateLike[] | null, colDefs?: readonly QueryColumnLike[] | null) => string;
@@ -4,22 +4,74 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.queryFormSchemaKey = void 0;
7
- var optionsSignature = function optionsSignature(options) {
8
- return Array.isArray(options) ? options.map(function (option) {
9
- return "".concat(String(option === null || option === void 0 ? void 0 : option.value), "=").concat(String(option === null || option === void 0 ? void 0 : option.label));
10
- }).join(',') : '';
7
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
8
+ var referenceIds = new WeakMap();
9
+ var nextReferenceId = 1;
10
+
11
+ /** 保持组件、回调及非普通对象的引用标识稳定。@author nokecy */
12
+ var referenceKey = function referenceKey(value) {
13
+ if (!referenceIds.has(value)) referenceIds.set(value, nextReferenceId++);
14
+ return referenceIds.get(value);
15
+ };
16
+
17
+ /**
18
+ * 对查询元数据生成稳定签名:普通对象按内容比较,组件与回调按引用比较。
19
+ * 排除 React 元素的内部 owner;循环引用只终止当前分支。
20
+ * @author nokecy
21
+ */
22
+ var metadataKey = function metadataKey(value) {
23
+ var ancestors = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Set();
24
+ if (typeof value === 'function') return "function:".concat(referenceKey(value));
25
+ if (value === null || _typeof(value) !== 'object') return "".concat(_typeof(value), ":").concat(JSON.stringify(String(value)));
26
+ if (ancestors.has(value)) return 'circular';
27
+ if (value instanceof Date) return "date:".concat(value.getTime());
28
+ var nextAncestors = new Set(ancestors).add(value);
29
+ if (Array.isArray(value)) return "[".concat(value.map(function (item) {
30
+ return metadataKey(item, nextAncestors);
31
+ }).join(','), "]");
32
+ var prototype = Object.getPrototypeOf(value);
33
+ if (prototype !== Object.prototype && prototype !== null) return "reference:".concat(referenceKey(value));
34
+ var object = value;
35
+ var keys = Object.keys(object).filter(function (key) {
36
+ return !object.$$typeof || key !== '_owner';
37
+ }).sort();
38
+ return "{".concat(keys.map(function (key) {
39
+ return "".concat(JSON.stringify(key), ":").concat(metadataKey(object[key], nextAncestors));
40
+ }).join(','), "}");
11
41
  };
12
42
 
13
43
  /**
14
- * 查询区 schema 的重建键:列(id、字段、标题)或下拉选项变了才重建。
15
- * 下拉选项常在首帧之后才到(如从基础资料接口取名称),只看列与标题时选项停在首帧。
44
+ * 查询区只在有效查询元数据变化时更新 schema,列宽、固定位置和排序不参与。
45
+ * 接受列状态参数以兼容原调用方;表单传入已经合并状态的有效查询列快照。
16
46
  * @author nokecy
17
47
  */
18
48
  var queryFormSchemaKey = exports.queryFormSchemaKey = function queryFormSchemaKey(columnStates, colDefs) {
19
- return [columnStates === null || columnStates === void 0 ? void 0 : columnStates.map(function (column) {
20
- return column.colId;
21
- }).join('|'), colDefs === null || colDefs === void 0 ? void 0 : colDefs.map(function (column) {
22
- var _column$searchCompone;
23
- return "".concat(column.field, "|").concat(column.headerName, "|").concat(optionsSignature((_column$searchCompone = column.searchComponentProps) === null || _column$searchCompone === void 0 ? void 0 : _column$searchCompone.options));
24
- }).join('|')].join('#');
49
+ return metadataKey({
50
+ states: columnStates === null || columnStates === void 0 ? void 0 : columnStates.map(function (_ref) {
51
+ var colId = _ref.colId,
52
+ hide = _ref.hide;
53
+ return {
54
+ colId: colId,
55
+ hide: hide
56
+ };
57
+ }),
58
+ columns: colDefs === null || colDefs === void 0 ? void 0 : colDefs.map(function (column) {
59
+ var _column$searchTitle;
60
+ return {
61
+ field: column.field,
62
+ colId: column.colId,
63
+ queryField: column.queryField,
64
+ title: (_column$searchTitle = column.searchTitle) !== null && _column$searchTitle !== void 0 ? _column$searchTitle : column.headerName,
65
+ hide: column.hide,
66
+ hideInSearch: column.hideInSearch,
67
+ hideInTable: column.hideInTable,
68
+ visible: column.visible,
69
+ filter: column.filter,
70
+ type: column.type,
71
+ enum: column.enum,
72
+ searchComponent: column.searchComponent,
73
+ searchComponentProps: column.searchComponentProps
74
+ };
75
+ })
76
+ });
25
77
  };
@@ -132,6 +132,9 @@ var ColumnConfigForm = function ColumnConfigForm(_ref) {
132
132
  }), /*#__PURE__*/_react.default.createElement(SchemaField.String, {
133
133
  name: "field",
134
134
  "x-display": "hidden"
135
+ }), /*#__PURE__*/_react.default.createElement(SchemaField.String, {
136
+ name: "colId",
137
+ "x-display": "hidden"
135
138
  }), /*#__PURE__*/_react.default.createElement(SchemaField.Boolean, {
136
139
  name: "_isNew",
137
140
  "x-display": "hidden"
@@ -29,16 +29,16 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
29
29
  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; }
30
30
  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); } }
31
31
  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); }); }; }
32
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
33
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
34
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
35
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
36
32
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
37
33
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
38
34
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
39
35
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
40
36
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
41
37
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
38
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
39
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
40
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
41
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
42
42
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
43
43
  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."); }
44
44
  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); }
@@ -146,47 +146,7 @@ var ColumnSetting = function ColumnSetting(_ref) {
146
146
  if (!originalColumnDefs || originalColumnDefs.length === 0) {
147
147
  return items;
148
148
  }
149
-
150
- // 递归查找 originalColumnDefs 中指定 field 的 headerName
151
- var findOriginalHeaderName = function findOriginalHeaderName(field) {
152
- var _iterator = _createForOfIteratorHelper(originalColumnDefs),
153
- _step;
154
- try {
155
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
156
- var def = _step.value;
157
- // 检查分组
158
- if ('children' in def && def.children) {
159
- for (var _i = 0, _arr = def.children; _i < _arr.length; _i++) {
160
- var child = _arr[_i];
161
- if (child.field === field) {
162
- return child.headerName;
163
- }
164
- }
165
- } else {
166
- // 检查普通列
167
- if (def.field === field) {
168
- return def.headerName;
169
- }
170
- }
171
- }
172
- } catch (err) {
173
- _iterator.e(err);
174
- } finally {
175
- _iterator.f();
176
- }
177
- return undefined;
178
- };
179
- return items.map(function (item) {
180
- if (item.type === 'column' && item.field) {
181
- var originalHeaderName = findOriginalHeaderName(item.field);
182
- if (originalHeaderName) {
183
- return _objectSpread(_objectSpread({}, item), {}, {
184
- originalHeaderName: originalHeaderName
185
- });
186
- }
187
- }
188
- return item;
189
- });
149
+ return (0, _columnGroupUtils.normalizeColumnConfig)(items, originalColumnDefs);
190
150
  }, [originalColumnDefs]);
191
151
 
192
152
  /**
@@ -202,9 +162,9 @@ var ColumnSetting = function ColumnSetting(_ref) {
202
162
  // 创建 field -> config item 的映射(用于快速查找已保存的列配置)
203
163
  var existingFields = new Set();
204
164
  config.filter(function (item) {
205
- return item.type === 'column' && item.field;
165
+ return item.type === 'column' && (0, _columnGroupUtils.getColumnIdentity)(item);
206
166
  }).forEach(function (item) {
207
- existingFields.add(item.field);
167
+ existingFields.add((0, _columnGroupUtils.getColumnIdentity)(item));
208
168
  });
209
169
 
210
170
  // 创建 groupId -> config item 的映射(用于快速查找已保存的分组配置)
@@ -225,11 +185,11 @@ var ColumnSetting = function ColumnSetting(_ref) {
225
185
  * 递归处理列定义,查找新增的列和分组
226
186
  */
227
187
  var findNewColumns = function findNewColumns(defs, level, parentId) {
228
- var _iterator2 = _createForOfIteratorHelper(defs),
229
- _step2;
188
+ var _iterator = _createForOfIteratorHelper(defs),
189
+ _step;
230
190
  try {
231
191
  var _loop = function _loop() {
232
- var def = _step2.value;
192
+ var def = _step.value;
233
193
  // 检查是否是分组
234
194
  if ('children' in def && def.children && def.children.length > 0) {
235
195
  var groupDef = def;
@@ -260,8 +220,9 @@ var ColumnSetting = function ColumnSetting(_ref) {
260
220
  } else {
261
221
  // 普通列
262
222
  var colDef = def;
263
- if (!colDef.field) return 1; // continue
264
- if (!existingFields.has(colDef.field)) {
223
+ var columnId = (0, _columnGroupUtils.getColumnIdentity)(colDef);
224
+ if (!columnId) return 1; // continue
225
+ if (!existingFields.has(columnId)) {
265
226
  // 新列 - 追加到末尾
266
227
  newItems.push({
267
228
  id: (0, _columnGroupUtils.generateId)(),
@@ -270,6 +231,7 @@ var ColumnSetting = function ColumnSetting(_ref) {
270
231
  level: level,
271
232
  order: ++maxOrder,
272
233
  field: colDef.field,
234
+ colId: colDef.colId,
273
235
  headerName: colDef.headerName || colDef.field || '未命名列',
274
236
  originalHeaderName: colDef.headerName || colDef.field || '未命名列',
275
237
  width: colDef.width,
@@ -282,13 +244,13 @@ var ColumnSetting = function ColumnSetting(_ref) {
282
244
  }
283
245
  }
284
246
  };
285
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
247
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
286
248
  if (_loop()) continue;
287
249
  }
288
250
  } catch (err) {
289
- _iterator2.e(err);
251
+ _iterator.e(err);
290
252
  } finally {
291
- _iterator2.f();
253
+ _iterator.f();
292
254
  }
293
255
  };
294
256
 
@@ -331,9 +293,9 @@ var ColumnSetting = function ColumnSetting(_ref) {
331
293
 
332
294
  // 同步列状态(宽度、隐藏等)
333
295
  flatConfig = flatConfig.map(function (item) {
334
- if (item.type === 'column' && item.field) {
296
+ if (item.type === 'column' && (0, _columnGroupUtils.getColumnIdentity)(item)) {
335
297
  var _state = columnStates.find(function (s) {
336
- return s.colId === item.field;
298
+ return s.colId === (0, _columnGroupUtils.getColumnIdentity)(item);
337
299
  });
338
300
  if (_state) {
339
301
  // 处理 pinned: 可能是 true/false/null/'left'/'right'
@@ -405,7 +367,7 @@ var ColumnSetting = function ColumnSetting(_ref) {
405
367
 
406
368
  // 3. 立即应用到 Grid(实时预览,不保存到方案)
407
369
  // 【修复】同时应用列顺序和状态,确保拖拽排序能够生效
408
- var columnState = (0, _columnGroupUtils.flatConfigToColumnState)(newItems);
370
+ var columnState = (0, _columnGroupUtils.flatConfigToColumnState)(newItems, allColDefs);
409
371
  gridApi.applyColumnState({
410
372
  state: columnState,
411
373
  applyOrder: true // 强制应用列顺序
@@ -458,7 +420,7 @@ var ColumnSetting = function ColumnSetting(_ref) {
458
420
  });
459
421
  case 10:
460
422
  // 【修复】然后应用列状态(宽度、隐藏、顺序等)
461
- columnState = (0, _columnGroupUtils.flatConfigToColumnState)(scheme.columnConfig);
423
+ columnState = (0, _columnGroupUtils.flatConfigToColumnState)(scheme.columnConfig, allColDefs);
462
424
  gridApi.applyColumnState({
463
425
  state: columnState,
464
426
  applyOrder: true // 强制应用列顺序
@@ -524,29 +486,30 @@ var ColumnSetting = function ColumnSetting(_ref) {
524
486
  }
525
487
 
526
488
  // 验证数据完整性,过滤掉无效的列配置
489
+ configToSave = (0, _columnGroupUtils.normalizeColumnConfig)(configToSave, allColDefs);
527
490
  invalidColumns = configToSave.filter(function (item) {
528
- return item.type === 'column' && item.field !== "" && !item.field;
491
+ return item.type === 'column' && !(0, _columnGroupUtils.getColumnIdentity)(item);
529
492
  });
530
493
  if (invalidColumns.length > 0) {
531
- _antd.message.warning("\u68C0\u6D4B\u5230 ".concat(invalidColumns.length, " \u4E2A\u5217\u7F3A\u5C11 field \u5B57\u6BB5\uFF0C\u5DF2\u81EA\u52A8\u8FC7\u6EE4"));
494
+ _antd.message.warning("\u68C0\u6D4B\u5230 ".concat(invalidColumns.length, " \u4E2A\u5217\u7F3A\u5C11\u5217\u6807\u8BC6\uFF0C\u5DF2\u81EA\u52A8\u8FC7\u6EE4"));
532
495
  console.warn('[ColumnSetting] 无效的列配置:', invalidColumns);
533
496
  configToSave = configToSave.filter(function (item) {
534
- return item.type === 'group' || item.type === 'column' && item.field;
497
+ return item.type === 'group' || item.type === 'column' && (0, _columnGroupUtils.getColumnIdentity)(item);
535
498
  });
536
499
  }
537
- _context2.prev = 8;
500
+ _context2.prev = 9;
538
501
  filterModel = gridApi.getFilterModel();
539
502
  if (!currentScheme) {
540
- _context2.next = 21;
503
+ _context2.next = 22;
541
504
  break;
542
505
  }
543
506
  if (!(currentScheme.isGlobal && !canApplyToGlobal)) {
544
- _context2.next = 14;
507
+ _context2.next = 15;
545
508
  break;
546
509
  }
547
510
  _antd.message.error('没有权限修改全局方案');
548
511
  return _context2.abrupt("return");
549
- case 14:
512
+ case 15:
550
513
  // 如果有激活的方案,更新该方案
551
514
  createdAt = currentScheme.createdAt, updatedAt = currentScheme.updatedAt, schemeWithoutTimestamps = _objectWithoutProperties(currentScheme, _excluded);
552
515
  savedScheme = _objectSpread(_objectSpread({}, schemeWithoutTimestamps), {}, {
@@ -554,28 +517,28 @@ var ColumnSetting = function ColumnSetting(_ref) {
554
517
  filterModel: filterModel
555
518
  // createdAt 和 updatedAt 由存储适配器自动生成
556
519
  });
557
- _context2.next = 18;
520
+ _context2.next = 19;
558
521
  return saveColumnScheme === null || saveColumnScheme === void 0 ? void 0 : saveColumnScheme(gridKey, savedScheme);
559
- case 18:
522
+ case 19:
560
523
  _antd.message.success('列配置已保存到方案');
561
- _context2.next = 37;
524
+ _context2.next = 38;
562
525
  break;
563
- case 21:
526
+ case 22:
564
527
  // 如果没有激活的方案,自动创建或更新默认方案
565
528
  defaultScheme = schemes.find(function (s) {
566
529
  return s.isDefault;
567
530
  });
568
531
  if (!defaultScheme) {
569
- _context2.next = 33;
532
+ _context2.next = 34;
570
533
  break;
571
534
  }
572
535
  if (!(defaultScheme.isGlobal && !canApplyToGlobal)) {
573
- _context2.next = 26;
536
+ _context2.next = 27;
574
537
  break;
575
538
  }
576
539
  _antd.message.error('没有权限修改全局方案');
577
540
  return _context2.abrupt("return");
578
- case 26:
541
+ case 27:
579
542
  // 更新默认方案
580
543
  _createdAt = defaultScheme.createdAt, _updatedAt = defaultScheme.updatedAt, _schemeWithoutTimestamps = _objectWithoutProperties(defaultScheme, _excluded2);
581
544
  savedScheme = _objectSpread(_objectSpread({}, _schemeWithoutTimestamps), {}, {
@@ -583,13 +546,13 @@ var ColumnSetting = function ColumnSetting(_ref) {
583
546
  filterModel: filterModel
584
547
  // createdAt 和 updatedAt 由存储适配器自动生成
585
548
  });
586
- _context2.next = 30;
549
+ _context2.next = 31;
587
550
  return saveColumnScheme === null || saveColumnScheme === void 0 ? void 0 : saveColumnScheme(gridKey, savedScheme);
588
- case 30:
551
+ case 31:
589
552
  _antd.message.success('列配置已保存到默认方案');
590
- _context2.next = 37;
553
+ _context2.next = 38;
591
554
  break;
592
- case 33:
555
+ case 34:
593
556
  // 创建新的默认方案
594
557
  savedScheme = {
595
558
  id: (0, _uuid.v4)(),
@@ -601,16 +564,16 @@ var ColumnSetting = function ColumnSetting(_ref) {
601
564
  isSystem: false
602
565
  // createdAt 和 updatedAt 由存储适配器自动生成
603
566
  };
604
- _context2.next = 36;
567
+ _context2.next = 37;
605
568
  return saveColumnScheme === null || saveColumnScheme === void 0 ? void 0 : saveColumnScheme(gridKey, savedScheme);
606
- case 36:
607
- _antd.message.success('已创建并保存到默认方案');
608
569
  case 37:
609
- _context2.next = 39;
570
+ _antd.message.success('已创建并保存到默认方案');
571
+ case 38:
572
+ _context2.next = 40;
610
573
  return new Promise(function (resolve) {
611
574
  return setTimeout(resolve, 100);
612
575
  });
613
- case 39:
576
+ case 40:
614
577
  // 【关键修复】直接应用方案到 Grid,不通过 handleLoadScheme
615
578
  // 这样可以避免依赖 Context 状态更新的时序问题
616
579
  _logger.logger.debug('[ColumnSetting] 保存后直接应用方案到 Grid');
@@ -622,14 +585,14 @@ var ColumnSetting = function ColumnSetting(_ref) {
622
585
  gridApi.setGridOption('columnDefs', gridColumnDefs);
623
586
 
624
587
  // 等待 columnDefs 更新完成
625
- _context2.next = 45;
588
+ _context2.next = 46;
626
589
  return new Promise(function (resolve) {
627
590
  return setTimeout(resolve, 100);
628
591
  });
629
- case 45:
592
+ case 46:
630
593
  // 2. 应用列状态(列顺序、宽度、隐藏、固定等)
631
594
  _logger.logger.debug('[ColumnSetting] 应用列状态');
632
- columnState = (0, _columnGroupUtils.flatConfigToColumnState)(savedScheme.columnConfig);
595
+ columnState = (0, _columnGroupUtils.flatConfigToColumnState)(savedScheme.columnConfig, allColDefs);
633
596
  gridApi.applyColumnState({
634
597
  state: columnState,
635
598
  applyOrder: true
@@ -643,31 +606,31 @@ var ColumnSetting = function ColumnSetting(_ref) {
643
606
 
644
607
  // 4. 设置为当前方案(如果不是当前方案)
645
608
  if (!(!currentScheme || savedScheme.id !== currentScheme.id)) {
646
- _context2.next = 52;
609
+ _context2.next = 53;
647
610
  break;
648
611
  }
649
- _context2.next = 52;
612
+ _context2.next = 53;
650
613
  return setCurrentColumnScheme === null || setCurrentColumnScheme === void 0 ? void 0 : setCurrentColumnScheme(gridKey, savedScheme.id);
651
- case 52:
652
- _context2.next = 54;
614
+ case 53:
615
+ _context2.next = 55;
653
616
  return new Promise(function (resolve) {
654
617
  return setTimeout(resolve, 50);
655
618
  });
656
- case 54:
619
+ case 55:
657
620
  // 5. 关闭弹窗
658
621
  onClose();
659
- _context2.next = 61;
622
+ _context2.next = 62;
660
623
  break;
661
- case 57:
662
- _context2.prev = 57;
663
- _context2.t0 = _context2["catch"](8);
624
+ case 58:
625
+ _context2.prev = 58;
626
+ _context2.t0 = _context2["catch"](9);
664
627
  console.error('保存列配置到方案失败:', _context2.t0);
665
628
  _antd.message.error('保存列配置失败');
666
- case 61:
629
+ case 62:
667
630
  case "end":
668
631
  return _context2.stop();
669
632
  }
670
- }, _callee2, null, [[8, 57]]);
633
+ }, _callee2, null, [[9, 58]]);
671
634
  })), [form, gridApi, saveColumnScheme, setCurrentColumnScheme, currentScheme, schemes, gridKey, allColDefs, onClose]);
672
635
 
673
636
  // 保存为新方案
@@ -689,9 +652,9 @@ var ColumnSetting = function ColumnSetting(_ref) {
689
652
  break;
690
653
  }
691
654
  values = form.values;
692
- columnConfigToSave = values.items; // 直接使用 FlatColumnItem[] 数据
655
+ columnConfigToSave = (0, _columnGroupUtils.normalizeColumnConfig)(values.items || [], allColDefs);
693
656
  // 【修复】传入 allColDefs 以保留自定义属性(cellRenderer 等)
694
- gridColumnDefs = (0, _columnGroupUtils.flatConfigToGridState)(values.items, allColDefs); // 【关键修复】先更新 columnDefs(处理分组结构变化)
657
+ gridColumnDefs = (0, _columnGroupUtils.flatConfigToGridState)(columnConfigToSave, allColDefs); // 【关键修复】先更新 columnDefs(处理分组结构变化)
695
658
  _logger.logger.debug('[ColumnSetting] 另存为方案 - 更新 columnDefs');
696
659
  gridApi.setGridOption('columnDefs', gridColumnDefs);
697
660
 
@@ -702,7 +665,7 @@ var ColumnSetting = function ColumnSetting(_ref) {
702
665
  });
703
666
  case 12:
704
667
  // 【修复】然后应用列状态(宽度、隐藏、顺序等)
705
- columnState = (0, _columnGroupUtils.flatConfigToColumnState)(values.items);
668
+ columnState = (0, _columnGroupUtils.flatConfigToColumnState)(columnConfigToSave, allColDefs);
706
669
  gridApi.applyColumnState({
707
670
  state: columnState,
708
671
  applyOrder: true // 强制应用列顺序
@@ -759,7 +722,7 @@ var ColumnSetting = function ColumnSetting(_ref) {
759
722
  // 设置默认方案
760
723
  var handleSetDefault = (0, _react.useCallback)( /*#__PURE__*/function () {
761
724
  var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(schemeId) {
762
- var scheme, _iterator3, _step3, s;
725
+ var scheme, _iterator2, _step2, s;
763
726
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
764
727
  while (1) switch (_context4.prev = _context4.next) {
765
728
  case 0:
@@ -772,15 +735,15 @@ var ColumnSetting = function ColumnSetting(_ref) {
772
735
  break;
773
736
  }
774
737
  // 将其他方案设为非默认
775
- _iterator3 = _createForOfIteratorHelper(schemes);
738
+ _iterator2 = _createForOfIteratorHelper(schemes);
776
739
  _context4.prev = 4;
777
- _iterator3.s();
740
+ _iterator2.s();
778
741
  case 6:
779
- if ((_step3 = _iterator3.n()).done) {
742
+ if ((_step2 = _iterator2.n()).done) {
780
743
  _context4.next = 13;
781
744
  break;
782
745
  }
783
- s = _step3.value;
746
+ s = _step2.value;
784
747
  if (!(s.isDefault && s.id !== schemeId)) {
785
748
  _context4.next = 11;
786
749
  break;
@@ -798,10 +761,10 @@ var ColumnSetting = function ColumnSetting(_ref) {
798
761
  case 15:
799
762
  _context4.prev = 15;
800
763
  _context4.t0 = _context4["catch"](4);
801
- _iterator3.e(_context4.t0);
764
+ _iterator2.e(_context4.t0);
802
765
  case 18:
803
766
  _context4.prev = 18;
804
- _iterator3.f();
767
+ _iterator2.f();
805
768
  return _context4.finish(18);
806
769
  case 21:
807
770
  _context4.next = 23;
@@ -113,7 +113,9 @@ var QuerySchemeManager = function QuerySchemeManager(_ref) {
113
113
  var map = new Map();
114
114
  if (queryFormItems) {
115
115
  queryFormItems.forEach(function (item) {
116
- map.set(item.field, item.headerName || item.field);
116
+ var _item$searchTitle;
117
+ // 查询方案管理显示独立查询标题,保持字段标识和持久化结构不变。@author nokecy
118
+ map.set(item.field, (_item$searchTitle = item.searchTitle) !== null && _item$searchTitle !== void 0 ? _item$searchTitle : item.headerName || item.field);
117
119
  });
118
120
  }
119
121
  return map;
@@ -27,6 +27,8 @@ export interface FlatColumnItem {
27
27
  marryChildren?: boolean;
28
28
  /** 列字段名(仅列类型) */
29
29
  field?: string;
30
+ /** AG-Grid 列标识;业务控件列可以只有 colId,多列也可共用同一 field。@author nokecy */
31
+ colId?: string;
30
32
  /** 列宽 */
31
33
  width?: number;
32
34
  /** 是否隐藏 */