@nokecy/qc-ui 1.1.17 → 1.1.19

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 (30) hide show
  1. package/dist/cjs/ag-grid-plus/ag-gridPlus.js +23 -0
  2. package/dist/cjs/ag-grid-plus/context/gridContext.d.ts +5 -0
  3. package/dist/cjs/ag-grid-plus/index.less +13 -0
  4. package/dist/cjs/ag-grid-plus/setting/ColumnConfigTable.js +79 -76
  5. package/dist/cjs/ag-grid-plus/setting/ColumnNameCellRenderer.d.ts +22 -0
  6. package/dist/cjs/ag-grid-plus/setting/ColumnNameCellRenderer.js +211 -0
  7. package/dist/cjs/ag-grid-plus/setting/ColumnSetting.js +133 -70
  8. package/dist/cjs/ag-grid-plus/setting/DebounceInputs.d.ts +1 -0
  9. package/dist/cjs/ag-grid-plus/setting/DebounceInputs.js +2 -0
  10. package/dist/cjs/ag-grid-plus/setting/QuerySchemeManager.js +64 -54
  11. package/dist/cjs/ag-grid-plus/setting/columnGroupTypes.d.ts +3 -1
  12. package/dist/cjs/ag-grid-plus/setting/columnGroupUtils.d.ts +2 -1
  13. package/dist/cjs/ag-grid-plus/setting/columnGroupUtils.js +49 -9
  14. package/dist/esm/ag-grid-plus/ag-gridPlus.js +23 -0
  15. package/dist/esm/ag-grid-plus/context/gridContext.d.ts +5 -0
  16. package/dist/esm/ag-grid-plus/index.less +13 -0
  17. package/dist/esm/ag-grid-plus/setting/ColumnConfigTable.js +81 -78
  18. package/dist/esm/ag-grid-plus/setting/ColumnNameCellRenderer.d.ts +22 -0
  19. package/dist/esm/ag-grid-plus/setting/ColumnNameCellRenderer.js +204 -0
  20. package/dist/esm/ag-grid-plus/setting/ColumnSetting.js +133 -70
  21. package/dist/esm/ag-grid-plus/setting/DebounceInputs.d.ts +1 -0
  22. package/dist/esm/ag-grid-plus/setting/DebounceInputs.js +2 -0
  23. package/dist/esm/ag-grid-plus/setting/QuerySchemeManager.js +64 -54
  24. package/dist/esm/ag-grid-plus/setting/columnGroupTypes.d.ts +3 -1
  25. package/dist/esm/ag-grid-plus/setting/columnGroupUtils.d.ts +2 -1
  26. package/dist/esm/ag-grid-plus/setting/columnGroupUtils.js +49 -9
  27. package/dist/esm/standardFormDialog/withStandardForm.d.ts +2 -2
  28. package/dist/umd/qc-ui.min.css +1 -1
  29. package/dist/umd/qc-ui.min.js +1 -1
  30. package/package.json +1 -1
@@ -17,10 +17,14 @@ var _ColumnConfigTable = _interopRequireDefault(require("./ColumnConfigTable"));
17
17
  var _draggableModal = _interopRequireDefault(require("../../draggableModal"));
18
18
  var _useSchemeManager = require("../context/useSchemeManager");
19
19
  var _uuid = require("uuid");
20
+ var _excluded = ["createdAt", "updatedAt"],
21
+ _excluded2 = ["createdAt", "updatedAt"],
22
+ _excluded3 = ["createdAt", "updatedAt"];
20
23
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
24
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
22
25
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
23
- 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; } } }; }
26
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
27
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
24
28
  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; }
25
29
  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); } }
26
30
  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); }); }; }
@@ -29,6 +33,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
29
33
  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; }
30
34
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
31
35
  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); }
36
+ 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; } } }; }
32
37
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
33
38
  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."); }
34
39
  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); }
@@ -52,6 +57,7 @@ var ColumnSetting = function ColumnSetting(_ref) {
52
57
  columnSchemes = _useGridSchemes.columnSchemes,
53
58
  currentSchemes = _useGridSchemes.currentSchemes,
54
59
  allColDefs = _useGridSchemes.allColDefs,
60
+ initialColumnDefs = _useGridSchemes.initialColumnDefs,
55
61
  saveColumnScheme = _useGridSchemes.saveColumnScheme,
56
62
  deleteColumnScheme = _useGridSchemes.deleteColumnScheme,
57
63
  setCurrentColumnScheme = _useGridSchemes.setCurrentColumnScheme;
@@ -99,8 +105,10 @@ var ColumnSetting = function ColumnSetting(_ref) {
99
105
  searchText = _useState16[0],
100
106
  setSearchText = _useState16[1];
101
107
 
102
- // 【修复】从 Context 获取原始完整的列定义
103
- var originalColumnDefs = allColDefs || undefined;
108
+ // 【修复】从 Context 获取初始列定义(用于获取原始 headerName)
109
+ // initialColumnDefs 来自组件初始化时的 props,不会被列方案修改
110
+ // allColDefs 包含自定义属性(cellRenderer 等),用于方案应用时保留这些属性
111
+ var originalColumnDefs = initialColumnDefs || allColDefs || undefined;
104
112
 
105
113
  // 【修复】保存快照用于取消时恢复(改名避免与Context的originalColumnDefs冲突)
106
114
  var _useState17 = (0, _react.useState)(null),
@@ -108,6 +116,57 @@ var ColumnSetting = function ColumnSetting(_ref) {
108
116
  snapshotColumnDefs = _useState18[0],
109
117
  setSnapshotColumnDefs = _useState18[1];
110
118
 
119
+ /**
120
+ * 修正列配置中的 originalHeaderName
121
+ * 确保 originalHeaderName 始终从 initialColumnDefs 中获取,而不是使用方案中保存的值
122
+ */
123
+ var fixOriginalHeaderName = (0, _react.useCallback)(function (items) {
124
+ if (!originalColumnDefs || originalColumnDefs.length === 0) {
125
+ return items;
126
+ }
127
+
128
+ // 递归查找 originalColumnDefs 中指定 field 的 headerName
129
+ var findOriginalHeaderName = function findOriginalHeaderName(field) {
130
+ var _iterator = _createForOfIteratorHelper(originalColumnDefs),
131
+ _step;
132
+ try {
133
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
134
+ var def = _step.value;
135
+ // 检查分组
136
+ if ('children' in def && def.children) {
137
+ for (var _i = 0, _arr = def.children; _i < _arr.length; _i++) {
138
+ var child = _arr[_i];
139
+ if (child.field === field) {
140
+ return child.headerName;
141
+ }
142
+ }
143
+ } else {
144
+ // 检查普通列
145
+ if (def.field === field) {
146
+ return def.headerName;
147
+ }
148
+ }
149
+ }
150
+ } catch (err) {
151
+ _iterator.e(err);
152
+ } finally {
153
+ _iterator.f();
154
+ }
155
+ return undefined;
156
+ };
157
+ return items.map(function (item) {
158
+ if (item.type === 'column' && item.field) {
159
+ var originalHeaderName = findOriginalHeaderName(item.field);
160
+ if (originalHeaderName) {
161
+ return _objectSpread(_objectSpread({}, item), {}, {
162
+ originalHeaderName: originalHeaderName
163
+ });
164
+ }
165
+ }
166
+ return item;
167
+ });
168
+ }, [originalColumnDefs]);
169
+
111
170
  /**
112
171
  * 获取列数据 - 将 Grid 的列定义转换为扁平化配置
113
172
  * 新版本使用树形结构,兼容旧版本的 groupName 结构
@@ -115,15 +174,16 @@ var ColumnSetting = function ColumnSetting(_ref) {
115
174
  var getColumnData = (0, _react.useCallback)(function () {
116
175
  // 优先使用当前方案中保存的完整列配置(包含分组结构)
117
176
  if (currentScheme !== null && currentScheme !== void 0 && currentScheme.columnConfig) {
118
- return currentScheme.columnConfig;
177
+ // 【修复】修正 originalHeaderName,确保使用 initialColumnDefs 中的原始值
178
+ return fixOriginalHeaderName(currentScheme.columnConfig);
119
179
  }
120
180
 
121
181
  // 如果方案中没有 columnConfig,则从 Grid 读取
122
182
  var columnDefs = gridApi.getColumnDefs() || [];
123
183
  var columnStates = gridApi.getColumnState();
124
184
 
125
- // 将 Grid 状态转换为扁平化配置
126
- var flatConfig = (0, _columnGroupUtils.gridStateToFlatConfig)(columnDefs);
185
+ // 将 Grid 状态转换为扁平化配置,传入原始列定义以获取 originalHeaderName
186
+ var flatConfig = (0, _columnGroupUtils.gridStateToFlatConfig)(columnDefs, originalColumnDefs);
127
187
 
128
188
  // 同步列状态(宽度、隐藏等)
129
189
  flatConfig = flatConfig.map(function (item) {
@@ -155,7 +215,7 @@ var ColumnSetting = function ColumnSetting(_ref) {
155
215
  return item;
156
216
  });
157
217
  return flatConfig;
158
- }, [gridApi, currentScheme]);
218
+ }, [gridApi, currentScheme, fixOriginalHeaderName, originalColumnDefs]);
159
219
 
160
220
  // 创建 Formily Form 实例
161
221
  var form = (0, _react.useMemo)(function () {
@@ -196,8 +256,8 @@ var ColumnSetting = function ColumnSetting(_ref) {
196
256
  items: newItems
197
257
  });
198
258
 
199
- // 2. 【修复】转换为 AG-Grid 列定义,传入原始列定义以保留自定义属性
200
- var gridColumnDefs = (0, _columnGroupUtils.flatConfigToGridState)(newItems, originalColumnDefs);
259
+ // 2. 【修复】转换为 AG-Grid 列定义,传入 allColDefs 以保留自定义属性(cellRenderer 等)
260
+ var gridColumnDefs = (0, _columnGroupUtils.flatConfigToGridState)(newItems, allColDefs);
201
261
 
202
262
  // 3. 立即应用到 Grid(实时预览,不保存到方案)
203
263
  // 【修复】同时应用列顺序和状态,确保拖拽排序能够生效
@@ -206,7 +266,7 @@ var ColumnSetting = function ColumnSetting(_ref) {
206
266
  state: columnState,
207
267
  applyOrder: true // 强制应用列顺序
208
268
  });
209
- }, [form, gridApi, originalColumnDefs]);
269
+ }, [form, gridApi, allColDefs]);
210
270
 
211
271
  /**
212
272
  * 关闭弹窗处理 - 取消时恢复原始状态
@@ -242,8 +302,8 @@ var ColumnSetting = function ColumnSetting(_ref) {
242
302
  _context.next = 12;
243
303
  break;
244
304
  }
245
- // 【关键修复】先更新 columnDefs(处理分组结构)
246
- gridColumnDefs = (0, _columnGroupUtils.flatConfigToGridState)(scheme.columnConfig, originalColumnDefs);
305
+ // 【关键修复】先更新 columnDefs(处理分组结构),使用 allColDefs 保留自定义属性
306
+ gridColumnDefs = (0, _columnGroupUtils.flatConfigToGridState)(scheme.columnConfig, allColDefs);
247
307
  gridApi.setGridOption('columnDefs', gridColumnDefs);
248
308
 
249
309
  // 等待 columnDefs 更新完成
@@ -293,14 +353,14 @@ var ColumnSetting = function ColumnSetting(_ref) {
293
353
  return function (_x) {
294
354
  return _ref2.apply(this, arguments);
295
355
  };
296
- }(), [setCurrentColumnScheme, gridKey, schemes, gridApi, originalColumnDefs, form, getColumnData, onClose]);
356
+ }(), [setCurrentColumnScheme, gridKey, schemes, gridApi, allColDefs, form, getColumnData, onClose]);
297
357
 
298
358
  /**
299
359
  * 保存列配置
300
360
  * 优化逻辑:先保存配置到存储,再直接应用到 Grid,不依赖 handleLoadScheme
301
361
  */
302
362
  var handleSaveColumns = (0, _react.useCallback)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
303
- var values, flatConfig, configToSave, invalidColumns, filterModel, savedScheme, defaultScheme, hasGroups, gridColumnDefs, columnState;
363
+ var values, flatConfig, configToSave, invalidColumns, filterModel, savedScheme, createdAt, updatedAt, schemeWithoutTimestamps, defaultScheme, _createdAt, _updatedAt, _schemeWithoutTimestamps, hasGroups, gridColumnDefs, columnState;
304
364
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
305
365
  while (1) switch (_context2.prev = _context2.next) {
306
366
  case 0:
@@ -332,43 +392,45 @@ var ColumnSetting = function ColumnSetting(_ref) {
332
392
  _context2.prev = 8;
333
393
  filterModel = gridApi.getFilterModel();
334
394
  if (!currentScheme) {
335
- _context2.next = 17;
395
+ _context2.next = 18;
336
396
  break;
337
397
  }
338
398
  // 如果有激活的方案,更新该方案
339
- savedScheme = _objectSpread(_objectSpread({}, currentScheme), {}, {
399
+ createdAt = currentScheme.createdAt, updatedAt = currentScheme.updatedAt, schemeWithoutTimestamps = _objectWithoutProperties(currentScheme, _excluded);
400
+ savedScheme = _objectSpread(_objectSpread({}, schemeWithoutTimestamps), {}, {
340
401
  columnConfig: configToSave,
341
402
  filterModel: filterModel
342
- // updatedAt 由存储适配器自动生成
403
+ // createdAt 和 updatedAt 由存储适配器自动生成
343
404
  });
344
- _context2.next = 14;
405
+ _context2.next = 15;
345
406
  return saveColumnScheme === null || saveColumnScheme === void 0 ? void 0 : saveColumnScheme(gridKey, savedScheme);
346
- case 14:
407
+ case 15:
347
408
  _antd.message.success('列配置已保存到方案');
348
- _context2.next = 29;
409
+ _context2.next = 31;
349
410
  break;
350
- case 17:
411
+ case 18:
351
412
  // 如果没有激活的方案,自动创建或更新默认方案
352
413
  defaultScheme = schemes.find(function (s) {
353
414
  return s.isDefault;
354
415
  });
355
416
  if (!defaultScheme) {
356
- _context2.next = 25;
417
+ _context2.next = 27;
357
418
  break;
358
419
  }
359
420
  // 更新默认方案
360
- savedScheme = _objectSpread(_objectSpread({}, defaultScheme), {}, {
421
+ _createdAt = defaultScheme.createdAt, _updatedAt = defaultScheme.updatedAt, _schemeWithoutTimestamps = _objectWithoutProperties(defaultScheme, _excluded2);
422
+ savedScheme = _objectSpread(_objectSpread({}, _schemeWithoutTimestamps), {}, {
361
423
  columnConfig: configToSave,
362
424
  filterModel: filterModel
363
- // updatedAt 由存储适配器自动生成
425
+ // createdAt 和 updatedAt 由存储适配器自动生成
364
426
  });
365
- _context2.next = 22;
427
+ _context2.next = 24;
366
428
  return saveColumnScheme === null || saveColumnScheme === void 0 ? void 0 : saveColumnScheme(gridKey, savedScheme);
367
- case 22:
429
+ case 24:
368
430
  _antd.message.success('列配置已保存到默认方案');
369
- _context2.next = 29;
431
+ _context2.next = 31;
370
432
  break;
371
- case 25:
433
+ case 27:
372
434
  // 创建新的默认方案
373
435
  savedScheme = {
374
436
  id: (0, _uuid.v4)(),
@@ -380,33 +442,33 @@ var ColumnSetting = function ColumnSetting(_ref) {
380
442
  isSystem: false
381
443
  // createdAt 和 updatedAt 由存储适配器自动生成
382
444
  };
383
- _context2.next = 28;
445
+ _context2.next = 30;
384
446
  return saveColumnScheme === null || saveColumnScheme === void 0 ? void 0 : saveColumnScheme(gridKey, savedScheme);
385
- case 28:
447
+ case 30:
386
448
  _antd.message.success('已创建并保存到默认方案');
387
- case 29:
388
- _context2.next = 31;
449
+ case 31:
450
+ _context2.next = 33;
389
451
  return new Promise(function (resolve) {
390
452
  return setTimeout(resolve, 100);
391
453
  });
392
- case 31:
454
+ case 33:
393
455
  // 1. 检查是否包含分组配置
394
456
  hasGroups = savedScheme.columnConfig.some(function (item) {
395
457
  return item.type === 'group';
396
458
  }); // 如果包含分组,先更新 columnDefs
397
459
  if (!hasGroups) {
398
- _context2.next = 37;
460
+ _context2.next = 39;
399
461
  break;
400
462
  }
401
- gridColumnDefs = (0, _columnGroupUtils.flatConfigToGridState)(savedScheme.columnConfig, originalColumnDefs);
463
+ gridColumnDefs = (0, _columnGroupUtils.flatConfigToGridState)(savedScheme.columnConfig, allColDefs);
402
464
  gridApi.setGridOption('columnDefs', gridColumnDefs);
403
465
 
404
466
  // 等待 columnDefs 更新完成
405
- _context2.next = 37;
467
+ _context2.next = 39;
406
468
  return new Promise(function (resolve) {
407
469
  return setTimeout(resolve, 100);
408
470
  });
409
- case 37:
471
+ case 39:
410
472
  columnState = (0, _columnGroupUtils.flatConfigToColumnState)(savedScheme.columnConfig);
411
473
  gridApi.applyColumnState({
412
474
  state: columnState,
@@ -420,32 +482,32 @@ var ColumnSetting = function ColumnSetting(_ref) {
420
482
 
421
483
  // 4. 设置为当前方案(如果不是当前方案)
422
484
  if (!(!currentScheme || savedScheme.id !== currentScheme.id)) {
423
- _context2.next = 43;
485
+ _context2.next = 45;
424
486
  break;
425
487
  }
426
- _context2.next = 43;
427
- return setCurrentColumnScheme === null || setCurrentColumnScheme === void 0 ? void 0 : setCurrentColumnScheme(gridKey, savedScheme.id);
428
- case 43:
429
488
  _context2.next = 45;
489
+ return setCurrentColumnScheme === null || setCurrentColumnScheme === void 0 ? void 0 : setCurrentColumnScheme(gridKey, savedScheme.id);
490
+ case 45:
491
+ _context2.next = 47;
430
492
  return new Promise(function (resolve) {
431
493
  return setTimeout(resolve, 50);
432
494
  });
433
- case 45:
495
+ case 47:
434
496
  // 5. 关闭弹窗
435
497
  onClose();
436
- _context2.next = 52;
498
+ _context2.next = 54;
437
499
  break;
438
- case 48:
439
- _context2.prev = 48;
500
+ case 50:
501
+ _context2.prev = 50;
440
502
  _context2.t0 = _context2["catch"](8);
441
503
  console.error('保存列配置到方案失败:', _context2.t0);
442
504
  _antd.message.error('保存列配置失败');
443
- case 52:
505
+ case 54:
444
506
  case "end":
445
507
  return _context2.stop();
446
508
  }
447
- }, _callee2, null, [[8, 48]]);
448
- })), [form, gridApi, saveColumnScheme, setCurrentColumnScheme, currentScheme, schemes, gridKey, originalColumnDefs, onClose]);
509
+ }, _callee2, null, [[8, 50]]);
510
+ })), [form, gridApi, saveColumnScheme, setCurrentColumnScheme, currentScheme, schemes, gridKey, allColDefs, onClose]);
449
511
 
450
512
  // 保存为新方案
451
513
  var handleSaveScheme = (0, _react.useCallback)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
@@ -467,8 +529,8 @@ var ColumnSetting = function ColumnSetting(_ref) {
467
529
  }
468
530
  values = form.values;
469
531
  columnConfigToSave = values.items; // 直接使用 FlatColumnItem[] 数据
470
- // 【修复】传入原始列定义以保留自定义属性
471
- gridColumnDefs = (0, _columnGroupUtils.flatConfigToGridState)(values.items, originalColumnDefs); // 【关键修复】先更新 columnDefs(处理分组结构变化)
532
+ // 【修复】传入 allColDefs 以保留自定义属性(cellRenderer 等)
533
+ gridColumnDefs = (0, _columnGroupUtils.flatConfigToGridState)(values.items, allColDefs); // 【关键修复】先更新 columnDefs(处理分组结构变化)
472
534
  gridApi.setGridOption('columnDefs', gridColumnDefs);
473
535
 
474
536
  // 等待 columnDefs 更新完成
@@ -530,12 +592,12 @@ var ColumnSetting = function ColumnSetting(_ref) {
530
592
  return _context3.stop();
531
593
  }
532
594
  }, _callee3, null, [[3, 30]]);
533
- })), [gridApi, saveColumnScheme, gridKey, schemeName, schemeDescription, activeTab, form, originalColumnDefs]);
595
+ })), [gridApi, saveColumnScheme, gridKey, schemeName, schemeDescription, activeTab, form, allColDefs]);
534
596
 
535
597
  // 设置默认方案
536
598
  var handleSetDefault = (0, _react.useCallback)( /*#__PURE__*/function () {
537
599
  var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(schemeId) {
538
- var scheme, _iterator, _step, s;
600
+ var scheme, _iterator2, _step2, s;
539
601
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
540
602
  while (1) switch (_context4.prev = _context4.next) {
541
603
  case 0:
@@ -548,15 +610,15 @@ var ColumnSetting = function ColumnSetting(_ref) {
548
610
  break;
549
611
  }
550
612
  // 将其他方案设为非默认
551
- _iterator = _createForOfIteratorHelper(schemes);
613
+ _iterator2 = _createForOfIteratorHelper(schemes);
552
614
  _context4.prev = 4;
553
- _iterator.s();
615
+ _iterator2.s();
554
616
  case 6:
555
- if ((_step = _iterator.n()).done) {
617
+ if ((_step2 = _iterator2.n()).done) {
556
618
  _context4.next = 13;
557
619
  break;
558
620
  }
559
- s = _step.value;
621
+ s = _step2.value;
560
622
  if (!(s.isDefault && s.id !== schemeId)) {
561
623
  _context4.next = 11;
562
624
  break;
@@ -574,10 +636,10 @@ var ColumnSetting = function ColumnSetting(_ref) {
574
636
  case 15:
575
637
  _context4.prev = 15;
576
638
  _context4.t0 = _context4["catch"](4);
577
- _iterator.e(_context4.t0);
639
+ _iterator2.e(_context4.t0);
578
640
  case 18:
579
641
  _context4.prev = 18;
580
- _iterator.f();
642
+ _iterator2.f();
581
643
  return _context4.finish(18);
582
644
  case 21:
583
645
  _context4.next = 23;
@@ -654,7 +716,7 @@ var ColumnSetting = function ColumnSetting(_ref) {
654
716
 
655
717
  // 保存编辑
656
718
  var handleSaveEdit = (0, _react.useCallback)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
657
- var scheme;
719
+ var scheme, createdAt, updatedAt, schemeWithoutTimestamps;
658
720
  return _regeneratorRuntime().wrap(function _callee6$(_context6) {
659
721
  while (1) switch (_context6.prev = _context6.next) {
660
722
  case 0:
@@ -669,30 +731,31 @@ var ColumnSetting = function ColumnSetting(_ref) {
669
731
  return s.id === editingId;
670
732
  });
671
733
  if (!scheme) {
672
- _context6.next = 9;
734
+ _context6.next = 10;
673
735
  break;
674
736
  }
675
- _context6.next = 7;
676
- return saveColumnScheme === null || saveColumnScheme === void 0 ? void 0 : saveColumnScheme(gridKey, _objectSpread(_objectSpread({}, scheme), {}, {
737
+ createdAt = scheme.createdAt, updatedAt = scheme.updatedAt, schemeWithoutTimestamps = _objectWithoutProperties(scheme, _excluded3);
738
+ _context6.next = 8;
739
+ return saveColumnScheme === null || saveColumnScheme === void 0 ? void 0 : saveColumnScheme(gridKey, _objectSpread(_objectSpread({}, schemeWithoutTimestamps), {}, {
677
740
  name: editingName.trim(),
678
741
  description: editingDescription.trim() || undefined
679
- // updatedAt 由存储适配器自动生成
742
+ // createdAt 和 updatedAt 由存储适配器自动生成
680
743
  }));
681
- case 7:
744
+ case 8:
682
745
  _antd.message.success('更新成功');
683
746
  setEditingId(null);
684
- case 9:
685
- _context6.next = 14;
747
+ case 10:
748
+ _context6.next = 15;
686
749
  break;
687
- case 11:
688
- _context6.prev = 11;
750
+ case 12:
751
+ _context6.prev = 12;
689
752
  _context6.t0 = _context6["catch"](2);
690
753
  _antd.message.error(_context6.t0.message || '更新失败');
691
- case 14:
754
+ case 15:
692
755
  case "end":
693
756
  return _context6.stop();
694
757
  }
695
- }, _callee6, null, [[2, 11]]);
758
+ }, _callee6, null, [[2, 12]]);
696
759
  })), [schemes, saveColumnScheme, gridKey, editingId, editingName, editingDescription]);
697
760
 
698
761
  // 筛选方案列表
@@ -10,6 +10,7 @@ export declare const DebounceNumberInput: React.FC<{
10
10
  min?: number;
11
11
  max?: number;
12
12
  step?: number;
13
+ size?: 'large' | 'middle' | 'small';
13
14
  style?: React.CSSProperties;
14
15
  }>;
15
16
  /**
@@ -26,6 +26,7 @@ var DebounceNumberInput = exports.DebounceNumberInput = function DebounceNumberI
26
26
  min = _ref.min,
27
27
  max = _ref.max,
28
28
  step = _ref.step,
29
+ size = _ref.size,
29
30
  style = _ref.style;
30
31
  var _useState = (0, _react.useState)(value),
31
32
  _useState2 = _slicedToArray(_useState, 2),
@@ -61,6 +62,7 @@ var DebounceNumberInput = exports.DebounceNumberInput = function DebounceNumberI
61
62
  min: min,
62
63
  max: max,
63
64
  step: step,
65
+ size: size,
64
66
  style: style || {
65
67
  width: '100%'
66
68
  }