@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
@@ -1,5 +1,9 @@
1
1
  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); }
2
- 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; } } }; }
2
+ var _excluded = ["createdAt", "updatedAt"],
3
+ _excluded2 = ["createdAt", "updatedAt"],
4
+ _excluded3 = ["createdAt", "updatedAt"];
5
+ 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; }
6
+ 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; }
3
7
  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; }
4
8
  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); } }
5
9
  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); }); }; }
@@ -8,6 +12,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
8
12
  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; }
9
13
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
10
14
  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); }
15
+ 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; } } }; }
11
16
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
12
17
  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."); }
13
18
  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); }
@@ -43,6 +48,7 @@ var ColumnSetting = function ColumnSetting(_ref) {
43
48
  columnSchemes = _useGridSchemes.columnSchemes,
44
49
  currentSchemes = _useGridSchemes.currentSchemes,
45
50
  allColDefs = _useGridSchemes.allColDefs,
51
+ initialColumnDefs = _useGridSchemes.initialColumnDefs,
46
52
  saveColumnScheme = _useGridSchemes.saveColumnScheme,
47
53
  deleteColumnScheme = _useGridSchemes.deleteColumnScheme,
48
54
  setCurrentColumnScheme = _useGridSchemes.setCurrentColumnScheme;
@@ -90,8 +96,10 @@ var ColumnSetting = function ColumnSetting(_ref) {
90
96
  searchText = _useState16[0],
91
97
  setSearchText = _useState16[1];
92
98
 
93
- // 【修复】从 Context 获取原始完整的列定义
94
- var originalColumnDefs = allColDefs || undefined;
99
+ // 【修复】从 Context 获取初始列定义(用于获取原始 headerName)
100
+ // initialColumnDefs 来自组件初始化时的 props,不会被列方案修改
101
+ // allColDefs 包含自定义属性(cellRenderer 等),用于方案应用时保留这些属性
102
+ var originalColumnDefs = initialColumnDefs || allColDefs || undefined;
95
103
 
96
104
  // 【修复】保存快照用于取消时恢复(改名避免与Context的originalColumnDefs冲突)
97
105
  var _useState17 = useState(null),
@@ -99,6 +107,57 @@ var ColumnSetting = function ColumnSetting(_ref) {
99
107
  snapshotColumnDefs = _useState18[0],
100
108
  setSnapshotColumnDefs = _useState18[1];
101
109
 
110
+ /**
111
+ * 修正列配置中的 originalHeaderName
112
+ * 确保 originalHeaderName 始终从 initialColumnDefs 中获取,而不是使用方案中保存的值
113
+ */
114
+ var fixOriginalHeaderName = useCallback(function (items) {
115
+ if (!originalColumnDefs || originalColumnDefs.length === 0) {
116
+ return items;
117
+ }
118
+
119
+ // 递归查找 originalColumnDefs 中指定 field 的 headerName
120
+ var findOriginalHeaderName = function findOriginalHeaderName(field) {
121
+ var _iterator = _createForOfIteratorHelper(originalColumnDefs),
122
+ _step;
123
+ try {
124
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
125
+ var def = _step.value;
126
+ // 检查分组
127
+ if ('children' in def && def.children) {
128
+ for (var _i = 0, _arr = def.children; _i < _arr.length; _i++) {
129
+ var child = _arr[_i];
130
+ if (child.field === field) {
131
+ return child.headerName;
132
+ }
133
+ }
134
+ } else {
135
+ // 检查普通列
136
+ if (def.field === field) {
137
+ return def.headerName;
138
+ }
139
+ }
140
+ }
141
+ } catch (err) {
142
+ _iterator.e(err);
143
+ } finally {
144
+ _iterator.f();
145
+ }
146
+ return undefined;
147
+ };
148
+ return items.map(function (item) {
149
+ if (item.type === 'column' && item.field) {
150
+ var originalHeaderName = findOriginalHeaderName(item.field);
151
+ if (originalHeaderName) {
152
+ return _objectSpread(_objectSpread({}, item), {}, {
153
+ originalHeaderName: originalHeaderName
154
+ });
155
+ }
156
+ }
157
+ return item;
158
+ });
159
+ }, [originalColumnDefs]);
160
+
102
161
  /**
103
162
  * 获取列数据 - 将 Grid 的列定义转换为扁平化配置
104
163
  * 新版本使用树形结构,兼容旧版本的 groupName 结构
@@ -106,15 +165,16 @@ var ColumnSetting = function ColumnSetting(_ref) {
106
165
  var getColumnData = useCallback(function () {
107
166
  // 优先使用当前方案中保存的完整列配置(包含分组结构)
108
167
  if (currentScheme !== null && currentScheme !== void 0 && currentScheme.columnConfig) {
109
- return currentScheme.columnConfig;
168
+ // 【修复】修正 originalHeaderName,确保使用 initialColumnDefs 中的原始值
169
+ return fixOriginalHeaderName(currentScheme.columnConfig);
110
170
  }
111
171
 
112
172
  // 如果方案中没有 columnConfig,则从 Grid 读取
113
173
  var columnDefs = gridApi.getColumnDefs() || [];
114
174
  var columnStates = gridApi.getColumnState();
115
175
 
116
- // 将 Grid 状态转换为扁平化配置
117
- var flatConfig = gridStateToFlatConfig(columnDefs);
176
+ // 将 Grid 状态转换为扁平化配置,传入原始列定义以获取 originalHeaderName
177
+ var flatConfig = gridStateToFlatConfig(columnDefs, originalColumnDefs);
118
178
 
119
179
  // 同步列状态(宽度、隐藏等)
120
180
  flatConfig = flatConfig.map(function (item) {
@@ -146,7 +206,7 @@ var ColumnSetting = function ColumnSetting(_ref) {
146
206
  return item;
147
207
  });
148
208
  return flatConfig;
149
- }, [gridApi, currentScheme]);
209
+ }, [gridApi, currentScheme, fixOriginalHeaderName, originalColumnDefs]);
150
210
 
151
211
  // 创建 Formily Form 实例
152
212
  var form = useMemo(function () {
@@ -187,8 +247,8 @@ var ColumnSetting = function ColumnSetting(_ref) {
187
247
  items: newItems
188
248
  });
189
249
 
190
- // 2. 【修复】转换为 AG-Grid 列定义,传入原始列定义以保留自定义属性
191
- var gridColumnDefs = flatConfigToGridState(newItems, originalColumnDefs);
250
+ // 2. 【修复】转换为 AG-Grid 列定义,传入 allColDefs 以保留自定义属性(cellRenderer 等)
251
+ var gridColumnDefs = flatConfigToGridState(newItems, allColDefs);
192
252
 
193
253
  // 3. 立即应用到 Grid(实时预览,不保存到方案)
194
254
  // 【修复】同时应用列顺序和状态,确保拖拽排序能够生效
@@ -197,7 +257,7 @@ var ColumnSetting = function ColumnSetting(_ref) {
197
257
  state: columnState,
198
258
  applyOrder: true // 强制应用列顺序
199
259
  });
200
- }, [form, gridApi, originalColumnDefs]);
260
+ }, [form, gridApi, allColDefs]);
201
261
 
202
262
  /**
203
263
  * 关闭弹窗处理 - 取消时恢复原始状态
@@ -233,8 +293,8 @@ var ColumnSetting = function ColumnSetting(_ref) {
233
293
  _context.next = 12;
234
294
  break;
235
295
  }
236
- // 【关键修复】先更新 columnDefs(处理分组结构)
237
- gridColumnDefs = flatConfigToGridState(scheme.columnConfig, originalColumnDefs);
296
+ // 【关键修复】先更新 columnDefs(处理分组结构),使用 allColDefs 保留自定义属性
297
+ gridColumnDefs = flatConfigToGridState(scheme.columnConfig, allColDefs);
238
298
  gridApi.setGridOption('columnDefs', gridColumnDefs);
239
299
 
240
300
  // 等待 columnDefs 更新完成
@@ -284,14 +344,14 @@ var ColumnSetting = function ColumnSetting(_ref) {
284
344
  return function (_x) {
285
345
  return _ref2.apply(this, arguments);
286
346
  };
287
- }(), [setCurrentColumnScheme, gridKey, schemes, gridApi, originalColumnDefs, form, getColumnData, onClose]);
347
+ }(), [setCurrentColumnScheme, gridKey, schemes, gridApi, allColDefs, form, getColumnData, onClose]);
288
348
 
289
349
  /**
290
350
  * 保存列配置
291
351
  * 优化逻辑:先保存配置到存储,再直接应用到 Grid,不依赖 handleLoadScheme
292
352
  */
293
353
  var handleSaveColumns = useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
294
- var values, flatConfig, configToSave, invalidColumns, filterModel, savedScheme, defaultScheme, hasGroups, gridColumnDefs, columnState;
354
+ var values, flatConfig, configToSave, invalidColumns, filterModel, savedScheme, createdAt, updatedAt, schemeWithoutTimestamps, defaultScheme, _createdAt, _updatedAt, _schemeWithoutTimestamps, hasGroups, gridColumnDefs, columnState;
295
355
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
296
356
  while (1) switch (_context2.prev = _context2.next) {
297
357
  case 0:
@@ -323,43 +383,45 @@ var ColumnSetting = function ColumnSetting(_ref) {
323
383
  _context2.prev = 8;
324
384
  filterModel = gridApi.getFilterModel();
325
385
  if (!currentScheme) {
326
- _context2.next = 17;
386
+ _context2.next = 18;
327
387
  break;
328
388
  }
329
389
  // 如果有激活的方案,更新该方案
330
- savedScheme = _objectSpread(_objectSpread({}, currentScheme), {}, {
390
+ createdAt = currentScheme.createdAt, updatedAt = currentScheme.updatedAt, schemeWithoutTimestamps = _objectWithoutProperties(currentScheme, _excluded);
391
+ savedScheme = _objectSpread(_objectSpread({}, schemeWithoutTimestamps), {}, {
331
392
  columnConfig: configToSave,
332
393
  filterModel: filterModel
333
- // updatedAt 由存储适配器自动生成
394
+ // createdAt 和 updatedAt 由存储适配器自动生成
334
395
  });
335
- _context2.next = 14;
396
+ _context2.next = 15;
336
397
  return saveColumnScheme === null || saveColumnScheme === void 0 ? void 0 : saveColumnScheme(gridKey, savedScheme);
337
- case 14:
398
+ case 15:
338
399
  message.success('列配置已保存到方案');
339
- _context2.next = 29;
400
+ _context2.next = 31;
340
401
  break;
341
- case 17:
402
+ case 18:
342
403
  // 如果没有激活的方案,自动创建或更新默认方案
343
404
  defaultScheme = schemes.find(function (s) {
344
405
  return s.isDefault;
345
406
  });
346
407
  if (!defaultScheme) {
347
- _context2.next = 25;
408
+ _context2.next = 27;
348
409
  break;
349
410
  }
350
411
  // 更新默认方案
351
- savedScheme = _objectSpread(_objectSpread({}, defaultScheme), {}, {
412
+ _createdAt = defaultScheme.createdAt, _updatedAt = defaultScheme.updatedAt, _schemeWithoutTimestamps = _objectWithoutProperties(defaultScheme, _excluded2);
413
+ savedScheme = _objectSpread(_objectSpread({}, _schemeWithoutTimestamps), {}, {
352
414
  columnConfig: configToSave,
353
415
  filterModel: filterModel
354
- // updatedAt 由存储适配器自动生成
416
+ // createdAt 和 updatedAt 由存储适配器自动生成
355
417
  });
356
- _context2.next = 22;
418
+ _context2.next = 24;
357
419
  return saveColumnScheme === null || saveColumnScheme === void 0 ? void 0 : saveColumnScheme(gridKey, savedScheme);
358
- case 22:
420
+ case 24:
359
421
  message.success('列配置已保存到默认方案');
360
- _context2.next = 29;
422
+ _context2.next = 31;
361
423
  break;
362
- case 25:
424
+ case 27:
363
425
  // 创建新的默认方案
364
426
  savedScheme = {
365
427
  id: uuidv4(),
@@ -371,33 +433,33 @@ var ColumnSetting = function ColumnSetting(_ref) {
371
433
  isSystem: false
372
434
  // createdAt 和 updatedAt 由存储适配器自动生成
373
435
  };
374
- _context2.next = 28;
436
+ _context2.next = 30;
375
437
  return saveColumnScheme === null || saveColumnScheme === void 0 ? void 0 : saveColumnScheme(gridKey, savedScheme);
376
- case 28:
438
+ case 30:
377
439
  message.success('已创建并保存到默认方案');
378
- case 29:
379
- _context2.next = 31;
440
+ case 31:
441
+ _context2.next = 33;
380
442
  return new Promise(function (resolve) {
381
443
  return setTimeout(resolve, 100);
382
444
  });
383
- case 31:
445
+ case 33:
384
446
  // 1. 检查是否包含分组配置
385
447
  hasGroups = savedScheme.columnConfig.some(function (item) {
386
448
  return item.type === 'group';
387
449
  }); // 如果包含分组,先更新 columnDefs
388
450
  if (!hasGroups) {
389
- _context2.next = 37;
451
+ _context2.next = 39;
390
452
  break;
391
453
  }
392
- gridColumnDefs = flatConfigToGridState(savedScheme.columnConfig, originalColumnDefs);
454
+ gridColumnDefs = flatConfigToGridState(savedScheme.columnConfig, allColDefs);
393
455
  gridApi.setGridOption('columnDefs', gridColumnDefs);
394
456
 
395
457
  // 等待 columnDefs 更新完成
396
- _context2.next = 37;
458
+ _context2.next = 39;
397
459
  return new Promise(function (resolve) {
398
460
  return setTimeout(resolve, 100);
399
461
  });
400
- case 37:
462
+ case 39:
401
463
  columnState = flatConfigToColumnState(savedScheme.columnConfig);
402
464
  gridApi.applyColumnState({
403
465
  state: columnState,
@@ -411,32 +473,32 @@ var ColumnSetting = function ColumnSetting(_ref) {
411
473
 
412
474
  // 4. 设置为当前方案(如果不是当前方案)
413
475
  if (!(!currentScheme || savedScheme.id !== currentScheme.id)) {
414
- _context2.next = 43;
476
+ _context2.next = 45;
415
477
  break;
416
478
  }
417
- _context2.next = 43;
418
- return setCurrentColumnScheme === null || setCurrentColumnScheme === void 0 ? void 0 : setCurrentColumnScheme(gridKey, savedScheme.id);
419
- case 43:
420
479
  _context2.next = 45;
480
+ return setCurrentColumnScheme === null || setCurrentColumnScheme === void 0 ? void 0 : setCurrentColumnScheme(gridKey, savedScheme.id);
481
+ case 45:
482
+ _context2.next = 47;
421
483
  return new Promise(function (resolve) {
422
484
  return setTimeout(resolve, 50);
423
485
  });
424
- case 45:
486
+ case 47:
425
487
  // 5. 关闭弹窗
426
488
  onClose();
427
- _context2.next = 52;
489
+ _context2.next = 54;
428
490
  break;
429
- case 48:
430
- _context2.prev = 48;
491
+ case 50:
492
+ _context2.prev = 50;
431
493
  _context2.t0 = _context2["catch"](8);
432
494
  console.error('保存列配置到方案失败:', _context2.t0);
433
495
  message.error('保存列配置失败');
434
- case 52:
496
+ case 54:
435
497
  case "end":
436
498
  return _context2.stop();
437
499
  }
438
- }, _callee2, null, [[8, 48]]);
439
- })), [form, gridApi, saveColumnScheme, setCurrentColumnScheme, currentScheme, schemes, gridKey, originalColumnDefs, onClose]);
500
+ }, _callee2, null, [[8, 50]]);
501
+ })), [form, gridApi, saveColumnScheme, setCurrentColumnScheme, currentScheme, schemes, gridKey, allColDefs, onClose]);
440
502
 
441
503
  // 保存为新方案
442
504
  var handleSaveScheme = useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
@@ -458,8 +520,8 @@ var ColumnSetting = function ColumnSetting(_ref) {
458
520
  }
459
521
  values = form.values;
460
522
  columnConfigToSave = values.items; // 直接使用 FlatColumnItem[] 数据
461
- // 【修复】传入原始列定义以保留自定义属性
462
- gridColumnDefs = flatConfigToGridState(values.items, originalColumnDefs); // 【关键修复】先更新 columnDefs(处理分组结构变化)
523
+ // 【修复】传入 allColDefs 以保留自定义属性(cellRenderer 等)
524
+ gridColumnDefs = flatConfigToGridState(values.items, allColDefs); // 【关键修复】先更新 columnDefs(处理分组结构变化)
463
525
  gridApi.setGridOption('columnDefs', gridColumnDefs);
464
526
 
465
527
  // 等待 columnDefs 更新完成
@@ -521,12 +583,12 @@ var ColumnSetting = function ColumnSetting(_ref) {
521
583
  return _context3.stop();
522
584
  }
523
585
  }, _callee3, null, [[3, 30]]);
524
- })), [gridApi, saveColumnScheme, gridKey, schemeName, schemeDescription, activeTab, form, originalColumnDefs]);
586
+ })), [gridApi, saveColumnScheme, gridKey, schemeName, schemeDescription, activeTab, form, allColDefs]);
525
587
 
526
588
  // 设置默认方案
527
589
  var handleSetDefault = useCallback( /*#__PURE__*/function () {
528
590
  var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(schemeId) {
529
- var scheme, _iterator, _step, s;
591
+ var scheme, _iterator2, _step2, s;
530
592
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
531
593
  while (1) switch (_context4.prev = _context4.next) {
532
594
  case 0:
@@ -539,15 +601,15 @@ var ColumnSetting = function ColumnSetting(_ref) {
539
601
  break;
540
602
  }
541
603
  // 将其他方案设为非默认
542
- _iterator = _createForOfIteratorHelper(schemes);
604
+ _iterator2 = _createForOfIteratorHelper(schemes);
543
605
  _context4.prev = 4;
544
- _iterator.s();
606
+ _iterator2.s();
545
607
  case 6:
546
- if ((_step = _iterator.n()).done) {
608
+ if ((_step2 = _iterator2.n()).done) {
547
609
  _context4.next = 13;
548
610
  break;
549
611
  }
550
- s = _step.value;
612
+ s = _step2.value;
551
613
  if (!(s.isDefault && s.id !== schemeId)) {
552
614
  _context4.next = 11;
553
615
  break;
@@ -565,10 +627,10 @@ var ColumnSetting = function ColumnSetting(_ref) {
565
627
  case 15:
566
628
  _context4.prev = 15;
567
629
  _context4.t0 = _context4["catch"](4);
568
- _iterator.e(_context4.t0);
630
+ _iterator2.e(_context4.t0);
569
631
  case 18:
570
632
  _context4.prev = 18;
571
- _iterator.f();
633
+ _iterator2.f();
572
634
  return _context4.finish(18);
573
635
  case 21:
574
636
  _context4.next = 23;
@@ -645,7 +707,7 @@ var ColumnSetting = function ColumnSetting(_ref) {
645
707
 
646
708
  // 保存编辑
647
709
  var handleSaveEdit = useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
648
- var scheme;
710
+ var scheme, createdAt, updatedAt, schemeWithoutTimestamps;
649
711
  return _regeneratorRuntime().wrap(function _callee6$(_context6) {
650
712
  while (1) switch (_context6.prev = _context6.next) {
651
713
  case 0:
@@ -660,30 +722,31 @@ var ColumnSetting = function ColumnSetting(_ref) {
660
722
  return s.id === editingId;
661
723
  });
662
724
  if (!scheme) {
663
- _context6.next = 9;
725
+ _context6.next = 10;
664
726
  break;
665
727
  }
666
- _context6.next = 7;
667
- return saveColumnScheme === null || saveColumnScheme === void 0 ? void 0 : saveColumnScheme(gridKey, _objectSpread(_objectSpread({}, scheme), {}, {
728
+ createdAt = scheme.createdAt, updatedAt = scheme.updatedAt, schemeWithoutTimestamps = _objectWithoutProperties(scheme, _excluded3);
729
+ _context6.next = 8;
730
+ return saveColumnScheme === null || saveColumnScheme === void 0 ? void 0 : saveColumnScheme(gridKey, _objectSpread(_objectSpread({}, schemeWithoutTimestamps), {}, {
668
731
  name: editingName.trim(),
669
732
  description: editingDescription.trim() || undefined
670
- // updatedAt 由存储适配器自动生成
733
+ // createdAt 和 updatedAt 由存储适配器自动生成
671
734
  }));
672
- case 7:
735
+ case 8:
673
736
  message.success('更新成功');
674
737
  setEditingId(null);
675
- case 9:
676
- _context6.next = 14;
738
+ case 10:
739
+ _context6.next = 15;
677
740
  break;
678
- case 11:
679
- _context6.prev = 11;
741
+ case 12:
742
+ _context6.prev = 12;
680
743
  _context6.t0 = _context6["catch"](2);
681
744
  message.error(_context6.t0.message || '更新失败');
682
- case 14:
745
+ case 15:
683
746
  case "end":
684
747
  return _context6.stop();
685
748
  }
686
- }, _callee6, null, [[2, 11]]);
749
+ }, _callee6, null, [[2, 12]]);
687
750
  })), [schemes, saveColumnScheme, gridKey, editingId, editingName, editingDescription]);
688
751
 
689
752
  // 筛选方案列表
@@ -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
  /**
@@ -18,6 +18,7 @@ export var DebounceNumberInput = function DebounceNumberInput(_ref) {
18
18
  min = _ref.min,
19
19
  max = _ref.max,
20
20
  step = _ref.step,
21
+ size = _ref.size,
21
22
  style = _ref.style;
22
23
  var _useState = useState(value),
23
24
  _useState2 = _slicedToArray(_useState, 2),
@@ -53,6 +54,7 @@ export var DebounceNumberInput = function DebounceNumberInput(_ref) {
53
54
  min: min,
54
55
  max: max,
55
56
  step: step,
57
+ size: size,
56
58
  style: style || {
57
59
  width: '100%'
58
60
  }