@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.
- package/dist/cjs/ag-grid-plus/ag-gridPlus.js +23 -0
- package/dist/cjs/ag-grid-plus/context/gridContext.d.ts +5 -0
- package/dist/cjs/ag-grid-plus/index.less +13 -0
- package/dist/cjs/ag-grid-plus/setting/ColumnConfigTable.js +79 -76
- package/dist/cjs/ag-grid-plus/setting/ColumnNameCellRenderer.d.ts +22 -0
- package/dist/cjs/ag-grid-plus/setting/ColumnNameCellRenderer.js +211 -0
- package/dist/cjs/ag-grid-plus/setting/ColumnSetting.js +133 -70
- package/dist/cjs/ag-grid-plus/setting/DebounceInputs.d.ts +1 -0
- package/dist/cjs/ag-grid-plus/setting/DebounceInputs.js +2 -0
- package/dist/cjs/ag-grid-plus/setting/QuerySchemeManager.js +64 -54
- package/dist/cjs/ag-grid-plus/setting/columnGroupTypes.d.ts +3 -1
- package/dist/cjs/ag-grid-plus/setting/columnGroupUtils.d.ts +2 -1
- package/dist/cjs/ag-grid-plus/setting/columnGroupUtils.js +49 -9
- package/dist/esm/ag-grid-plus/ag-gridPlus.js +23 -0
- package/dist/esm/ag-grid-plus/context/gridContext.d.ts +5 -0
- package/dist/esm/ag-grid-plus/index.less +13 -0
- package/dist/esm/ag-grid-plus/setting/ColumnConfigTable.js +81 -78
- package/dist/esm/ag-grid-plus/setting/ColumnNameCellRenderer.d.ts +22 -0
- package/dist/esm/ag-grid-plus/setting/ColumnNameCellRenderer.js +204 -0
- package/dist/esm/ag-grid-plus/setting/ColumnSetting.js +133 -70
- package/dist/esm/ag-grid-plus/setting/DebounceInputs.d.ts +1 -0
- package/dist/esm/ag-grid-plus/setting/DebounceInputs.js +2 -0
- package/dist/esm/ag-grid-plus/setting/QuerySchemeManager.js +64 -54
- package/dist/esm/ag-grid-plus/setting/columnGroupTypes.d.ts +3 -1
- package/dist/esm/ag-grid-plus/setting/columnGroupUtils.d.ts +2 -1
- package/dist/esm/ag-grid-plus/setting/columnGroupUtils.js +49 -9
- package/dist/esm/standardFormDialog/withStandardForm.d.ts +2 -2
- package/dist/umd/qc-ui.min.css +1 -1
- package/dist/umd/qc-ui.min.js +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,12 @@
|
|
|
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
|
+
var _excluded = ["createdAt", "updatedAt"],
|
|
3
|
+
_excluded2 = ["createdAt", "updatedAt"],
|
|
4
|
+
_excluded3 = ["createdAt", "updatedAt"],
|
|
5
|
+
_excluded4 = ["createdAt", "updatedAt"];
|
|
2
6
|
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; } } }; }
|
|
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; }
|
|
8
|
+
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; }
|
|
9
|
+
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; }
|
|
4
10
|
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
11
|
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); }); }; }
|
|
6
12
|
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; }
|
|
@@ -185,7 +191,7 @@ var QuerySchemeManager = function QuerySchemeManager(_ref) {
|
|
|
185
191
|
* 应用当前顺序和隐藏设置
|
|
186
192
|
*/
|
|
187
193
|
var handleApplyOrder = useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
188
|
-
var editingOrder, hiddenFields, queryConfig, newScheme;
|
|
194
|
+
var editingOrder, hiddenFields, queryConfig, createdAt, updatedAt, schemeWithoutTimestamps, newScheme;
|
|
189
195
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
190
196
|
while (1) switch (_context.prev = _context.next) {
|
|
191
197
|
case 0:
|
|
@@ -200,19 +206,20 @@ var QuerySchemeManager = function QuerySchemeManager(_ref) {
|
|
|
200
206
|
}); // 构建新格式的配置
|
|
201
207
|
queryConfig = buildQueryConfig(editingOrder, hiddenFields); // 如果有当前方案,更新方案
|
|
202
208
|
if (!currentScheme) {
|
|
203
|
-
_context.next =
|
|
209
|
+
_context.next = 11;
|
|
204
210
|
break;
|
|
205
211
|
}
|
|
206
|
-
|
|
207
|
-
|
|
212
|
+
createdAt = currentScheme.createdAt, updatedAt = currentScheme.updatedAt, schemeWithoutTimestamps = _objectWithoutProperties(currentScheme, _excluded);
|
|
213
|
+
_context.next = 8;
|
|
214
|
+
return saveQueryScheme === null || saveQueryScheme === void 0 ? void 0 : saveQueryScheme(gridKey, _objectSpread(_objectSpread({}, schemeWithoutTimestamps), {}, {
|
|
208
215
|
queryConfig: queryConfig
|
|
209
|
-
// updatedAt 由存储适配器自动生成
|
|
216
|
+
// createdAt 和 updatedAt 由存储适配器自动生成
|
|
210
217
|
}));
|
|
211
|
-
case
|
|
218
|
+
case 8:
|
|
212
219
|
message.success('已应用新配置');
|
|
213
|
-
_context.next =
|
|
220
|
+
_context.next = 17;
|
|
214
221
|
break;
|
|
215
|
-
case
|
|
222
|
+
case 11:
|
|
216
223
|
// 创建新方案
|
|
217
224
|
newScheme = {
|
|
218
225
|
id: uuidv4(),
|
|
@@ -223,28 +230,28 @@ var QuerySchemeManager = function QuerySchemeManager(_ref) {
|
|
|
223
230
|
isSystem: false
|
|
224
231
|
// createdAt 和 updatedAt 由存储适配器自动生成
|
|
225
232
|
};
|
|
226
|
-
_context.next =
|
|
233
|
+
_context.next = 14;
|
|
227
234
|
return saveQueryScheme === null || saveQueryScheme === void 0 ? void 0 : saveQueryScheme(gridKey, newScheme);
|
|
228
|
-
case
|
|
229
|
-
_context.next =
|
|
235
|
+
case 14:
|
|
236
|
+
_context.next = 16;
|
|
230
237
|
return setCurrentQueryScheme === null || setCurrentQueryScheme === void 0 ? void 0 : setCurrentQueryScheme(gridKey, newScheme.id);
|
|
231
|
-
case 15:
|
|
232
|
-
message.success('已自动创建并应用默认方案');
|
|
233
238
|
case 16:
|
|
239
|
+
message.success('已自动创建并应用默认方案');
|
|
240
|
+
case 17:
|
|
234
241
|
// 应用顺序到表单
|
|
235
242
|
updateQueryOrder === null || updateQueryOrder === void 0 || updateQueryOrder(editingOrder);
|
|
236
243
|
onClose();
|
|
237
|
-
_context.next =
|
|
244
|
+
_context.next = 24;
|
|
238
245
|
break;
|
|
239
|
-
case
|
|
240
|
-
_context.prev =
|
|
246
|
+
case 21:
|
|
247
|
+
_context.prev = 21;
|
|
241
248
|
_context.t0 = _context["catch"](0);
|
|
242
249
|
message.error(_context.t0.message || '应用失败');
|
|
243
|
-
case
|
|
250
|
+
case 24:
|
|
244
251
|
case "end":
|
|
245
252
|
return _context.stop();
|
|
246
253
|
}
|
|
247
|
-
}, _callee, null, [[0,
|
|
254
|
+
}, _callee, null, [[0, 21]]);
|
|
248
255
|
})), [queryItemsData, currentScheme, saveQueryScheme, gridKey, updateQueryOrder, onClose, setCurrentQueryScheme]);
|
|
249
256
|
|
|
250
257
|
/**
|
|
@@ -312,7 +319,7 @@ var QuerySchemeManager = function QuerySchemeManager(_ref) {
|
|
|
312
319
|
* 保存编辑
|
|
313
320
|
*/
|
|
314
321
|
var handleSaveEdit = useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
315
|
-
var scheme;
|
|
322
|
+
var scheme, createdAt, updatedAt, schemeWithoutTimestamps;
|
|
316
323
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
317
324
|
while (1) switch (_context3.prev = _context3.next) {
|
|
318
325
|
case 0:
|
|
@@ -332,26 +339,27 @@ var QuerySchemeManager = function QuerySchemeManager(_ref) {
|
|
|
332
339
|
}
|
|
333
340
|
return _context3.abrupt("return");
|
|
334
341
|
case 6:
|
|
335
|
-
|
|
336
|
-
|
|
342
|
+
createdAt = scheme.createdAt, updatedAt = scheme.updatedAt, schemeWithoutTimestamps = _objectWithoutProperties(scheme, _excluded2);
|
|
343
|
+
_context3.next = 9;
|
|
344
|
+
return saveQueryScheme === null || saveQueryScheme === void 0 ? void 0 : saveQueryScheme(gridKey, _objectSpread(_objectSpread({}, schemeWithoutTimestamps), {}, {
|
|
337
345
|
name: editingName.trim(),
|
|
338
346
|
description: editingDescription.trim() || undefined
|
|
339
|
-
// updatedAt 由存储适配器自动生成
|
|
347
|
+
// createdAt 和 updatedAt 由存储适配器自动生成
|
|
340
348
|
}));
|
|
341
|
-
case
|
|
349
|
+
case 9:
|
|
342
350
|
message.success('更新成功');
|
|
343
351
|
setEditingId(null);
|
|
344
|
-
_context3.next =
|
|
352
|
+
_context3.next = 16;
|
|
345
353
|
break;
|
|
346
|
-
case
|
|
347
|
-
_context3.prev =
|
|
354
|
+
case 13:
|
|
355
|
+
_context3.prev = 13;
|
|
348
356
|
_context3.t0 = _context3["catch"](2);
|
|
349
357
|
message.error(_context3.t0.message || '更新失败');
|
|
350
|
-
case
|
|
358
|
+
case 16:
|
|
351
359
|
case "end":
|
|
352
360
|
return _context3.stop();
|
|
353
361
|
}
|
|
354
|
-
}, _callee3, null, [[2,
|
|
362
|
+
}, _callee3, null, [[2, 13]]);
|
|
355
363
|
})), [editingId, editingName, editingDescription, schemes, saveQueryScheme, gridKey]);
|
|
356
364
|
|
|
357
365
|
/**
|
|
@@ -398,7 +406,7 @@ var QuerySchemeManager = function QuerySchemeManager(_ref) {
|
|
|
398
406
|
*/
|
|
399
407
|
var handleSetDefault = useCallback( /*#__PURE__*/function () {
|
|
400
408
|
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(schemeId, schemeName) {
|
|
401
|
-
var _iterator, _step, _scheme, scheme;
|
|
409
|
+
var _iterator, _step, _scheme, _createdAt, _updatedAt, _schemeWithoutTimestamps, scheme, createdAt, updatedAt, schemeWithoutTimestamps;
|
|
402
410
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
403
411
|
while (1) switch (_context5.prev = _context5.next) {
|
|
404
412
|
case 0:
|
|
@@ -409,61 +417,63 @@ var QuerySchemeManager = function QuerySchemeManager(_ref) {
|
|
|
409
417
|
_iterator.s();
|
|
410
418
|
case 4:
|
|
411
419
|
if ((_step = _iterator.n()).done) {
|
|
412
|
-
_context5.next =
|
|
420
|
+
_context5.next = 12;
|
|
413
421
|
break;
|
|
414
422
|
}
|
|
415
423
|
_scheme = _step.value;
|
|
416
424
|
if (!(_scheme.isDefault && _scheme.id !== schemeId)) {
|
|
417
|
-
_context5.next =
|
|
425
|
+
_context5.next = 10;
|
|
418
426
|
break;
|
|
419
427
|
}
|
|
420
|
-
|
|
421
|
-
|
|
428
|
+
_createdAt = _scheme.createdAt, _updatedAt = _scheme.updatedAt, _schemeWithoutTimestamps = _objectWithoutProperties(_scheme, _excluded4);
|
|
429
|
+
_context5.next = 10;
|
|
430
|
+
return saveQueryScheme === null || saveQueryScheme === void 0 ? void 0 : saveQueryScheme(gridKey, _objectSpread(_objectSpread({}, _schemeWithoutTimestamps), {}, {
|
|
422
431
|
isDefault: false
|
|
423
|
-
// updatedAt 由存储适配器自动生成
|
|
432
|
+
// createdAt 和 updatedAt 由存储适配器自动生成
|
|
424
433
|
}));
|
|
425
|
-
case
|
|
434
|
+
case 10:
|
|
426
435
|
_context5.next = 4;
|
|
427
436
|
break;
|
|
428
|
-
case
|
|
429
|
-
_context5.next =
|
|
437
|
+
case 12:
|
|
438
|
+
_context5.next = 17;
|
|
430
439
|
break;
|
|
431
|
-
case
|
|
432
|
-
_context5.prev =
|
|
440
|
+
case 14:
|
|
441
|
+
_context5.prev = 14;
|
|
433
442
|
_context5.t0 = _context5["catch"](2);
|
|
434
443
|
_iterator.e(_context5.t0);
|
|
435
|
-
case
|
|
436
|
-
_context5.prev =
|
|
444
|
+
case 17:
|
|
445
|
+
_context5.prev = 17;
|
|
437
446
|
_iterator.f();
|
|
438
|
-
return _context5.finish(
|
|
439
|
-
case
|
|
447
|
+
return _context5.finish(17);
|
|
448
|
+
case 20:
|
|
440
449
|
// 设置新的默认方案
|
|
441
450
|
scheme = schemes.find(function (s) {
|
|
442
451
|
return s.id === schemeId;
|
|
443
452
|
});
|
|
444
453
|
if (!scheme) {
|
|
445
|
-
_context5.next =
|
|
454
|
+
_context5.next = 26;
|
|
446
455
|
break;
|
|
447
456
|
}
|
|
448
|
-
|
|
449
|
-
|
|
457
|
+
createdAt = scheme.createdAt, updatedAt = scheme.updatedAt, schemeWithoutTimestamps = _objectWithoutProperties(scheme, _excluded3);
|
|
458
|
+
_context5.next = 25;
|
|
459
|
+
return saveQueryScheme === null || saveQueryScheme === void 0 ? void 0 : saveQueryScheme(gridKey, _objectSpread(_objectSpread({}, schemeWithoutTimestamps), {}, {
|
|
450
460
|
isDefault: true
|
|
451
|
-
// updatedAt 由存储适配器自动生成
|
|
461
|
+
// createdAt 和 updatedAt 由存储适配器自动生成
|
|
452
462
|
}));
|
|
453
|
-
case
|
|
463
|
+
case 25:
|
|
454
464
|
message.success("\u5DF2\u5C06\"".concat(schemeName, "\"\u8BBE\u4E3A\u9ED8\u8BA4\u65B9\u6848"));
|
|
455
|
-
case 24:
|
|
456
|
-
_context5.next = 29;
|
|
457
|
-
break;
|
|
458
465
|
case 26:
|
|
459
|
-
_context5.
|
|
466
|
+
_context5.next = 31;
|
|
467
|
+
break;
|
|
468
|
+
case 28:
|
|
469
|
+
_context5.prev = 28;
|
|
460
470
|
_context5.t1 = _context5["catch"](0);
|
|
461
471
|
message.error(_context5.t1.message || '设置失败');
|
|
462
|
-
case
|
|
472
|
+
case 31:
|
|
463
473
|
case "end":
|
|
464
474
|
return _context5.stop();
|
|
465
475
|
}
|
|
466
|
-
}, _callee5, null, [[0,
|
|
476
|
+
}, _callee5, null, [[0, 28], [2, 14, 17, 20]]);
|
|
467
477
|
}));
|
|
468
478
|
return function (_x3, _x4) {
|
|
469
479
|
return _ref6.apply(this, arguments);
|
|
@@ -17,8 +17,10 @@ export interface FlatColumnItem {
|
|
|
17
17
|
level: number;
|
|
18
18
|
/** 排序序号,用于维护节点顺序 */
|
|
19
19
|
order: number;
|
|
20
|
-
/** 显示名称 */
|
|
20
|
+
/** 显示名称 (当前值,可被用户修改) */
|
|
21
21
|
headerName: string;
|
|
22
|
+
/** 原始显示名称 (用于对比和重置) */
|
|
23
|
+
originalHeaderName?: string;
|
|
22
24
|
/** AG-Grid 分组标识(仅分组类型) */
|
|
23
25
|
groupId?: string;
|
|
24
26
|
/** 子列是否必须保持一起(仅分组类型) */
|
|
@@ -13,9 +13,10 @@ export declare const generateId: () => string;
|
|
|
13
13
|
* 将 AG-Grid 的树形结构转换为扁平化数组,用于 UI 展示和编辑
|
|
14
14
|
*
|
|
15
15
|
* @param columnDefs AG-Grid 列定义数组
|
|
16
|
+
* @param originalColumnDefs 原始列定义数组(可选),用于获取 originalHeaderName
|
|
16
17
|
* @returns 扁平化配置数组
|
|
17
18
|
*/
|
|
18
|
-
export declare function gridStateToFlatConfig(columnDefs: (ColDef | ColGroupDef)[]): FlatColumnItem[];
|
|
19
|
+
export declare function gridStateToFlatConfig(columnDefs: (ColDef | ColGroupDef)[], originalColumnDefs?: (ColDef | ColGroupDef)[]): FlatColumnItem[];
|
|
19
20
|
/**
|
|
20
21
|
* 扁平化配置 → Grid State
|
|
21
22
|
* 将扁平化数组重建为 AG-Grid 的树形结构
|
|
@@ -24,12 +24,44 @@ export var generateId = function generateId() {
|
|
|
24
24
|
* 将 AG-Grid 的树形结构转换为扁平化数组,用于 UI 展示和编辑
|
|
25
25
|
*
|
|
26
26
|
* @param columnDefs AG-Grid 列定义数组
|
|
27
|
+
* @param originalColumnDefs 原始列定义数组(可选),用于获取 originalHeaderName
|
|
27
28
|
* @returns 扁平化配置数组
|
|
28
29
|
*/
|
|
29
|
-
export function gridStateToFlatConfig(columnDefs) {
|
|
30
|
+
export function gridStateToFlatConfig(columnDefs, originalColumnDefs) {
|
|
30
31
|
var result = [];
|
|
31
32
|
var order = 0;
|
|
32
33
|
|
|
34
|
+
/**
|
|
35
|
+
* 从原始列定义中查找指定字段的原始 headerName
|
|
36
|
+
*/
|
|
37
|
+
function findOriginalHeaderName(field, defs) {
|
|
38
|
+
if (!defs || !field) return undefined;
|
|
39
|
+
var _iterator = _createForOfIteratorHelper(defs),
|
|
40
|
+
_step;
|
|
41
|
+
try {
|
|
42
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
43
|
+
var def = _step.value;
|
|
44
|
+
// 检查是否是分组
|
|
45
|
+
if ('children' in def && def.children) {
|
|
46
|
+
// 递归查找分组内的列
|
|
47
|
+
var found = findOriginalHeaderName(field, def.children);
|
|
48
|
+
if (found) return found;
|
|
49
|
+
} else {
|
|
50
|
+
// 检查是否是目标列
|
|
51
|
+
var colDef = def;
|
|
52
|
+
if (colDef.field === field) {
|
|
53
|
+
return colDef.headerName;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
} catch (err) {
|
|
58
|
+
_iterator.e(err);
|
|
59
|
+
} finally {
|
|
60
|
+
_iterator.f();
|
|
61
|
+
}
|
|
62
|
+
return undefined;
|
|
63
|
+
}
|
|
64
|
+
|
|
33
65
|
/**
|
|
34
66
|
* 递归遍历列定义树
|
|
35
67
|
*/
|
|
@@ -38,13 +70,16 @@ export function gridStateToFlatConfig(columnDefs) {
|
|
|
38
70
|
if (item.children && item.children.length > 0) {
|
|
39
71
|
// 这是一个分组节点
|
|
40
72
|
var groupId = generateId();
|
|
73
|
+
var headerName = item.headerName || '未命名分组';
|
|
41
74
|
result.push({
|
|
42
75
|
id: groupId,
|
|
43
76
|
type: 'group',
|
|
44
77
|
parentId: parentId,
|
|
45
78
|
level: level,
|
|
46
79
|
order: order++,
|
|
47
|
-
headerName:
|
|
80
|
+
headerName: headerName,
|
|
81
|
+
originalHeaderName: headerName,
|
|
82
|
+
// 保存原始 headerName
|
|
48
83
|
groupId: item.groupId || item.field || generateId(),
|
|
49
84
|
marryChildren: item.marryChildren
|
|
50
85
|
});
|
|
@@ -52,6 +87,9 @@ export function gridStateToFlatConfig(columnDefs) {
|
|
|
52
87
|
traverse(item.children, level + 1, groupId);
|
|
53
88
|
} else {
|
|
54
89
|
// 这是一个列节点
|
|
90
|
+
var _headerName = item.headerName || item.field || '未命名列';
|
|
91
|
+
// 从原始列定义中获取 originalHeaderName,如果没有则使用当前 headerName
|
|
92
|
+
var originalHeaderName = item.field ? findOriginalHeaderName(item.field, originalColumnDefs) || _headerName : _headerName;
|
|
55
93
|
result.push({
|
|
56
94
|
id: generateId(),
|
|
57
95
|
type: 'column',
|
|
@@ -59,7 +97,9 @@ export function gridStateToFlatConfig(columnDefs) {
|
|
|
59
97
|
level: level,
|
|
60
98
|
order: order++,
|
|
61
99
|
field: item.field,
|
|
62
|
-
headerName:
|
|
100
|
+
headerName: _headerName,
|
|
101
|
+
originalHeaderName: originalHeaderName,
|
|
102
|
+
// 从原始定义获取,或使用当前值
|
|
63
103
|
width: item.width,
|
|
64
104
|
hide: item.hide,
|
|
65
105
|
pinned: item.pinned === null ? 'notPinned' : item.pinned,
|
|
@@ -91,11 +131,11 @@ export function flatConfigToGridState(flatConfig, originalColumnDefs) {
|
|
|
91
131
|
*/
|
|
92
132
|
function findOriginalColDef(field, defs) {
|
|
93
133
|
if (!defs) return undefined;
|
|
94
|
-
var
|
|
95
|
-
|
|
134
|
+
var _iterator2 = _createForOfIteratorHelper(defs),
|
|
135
|
+
_step2;
|
|
96
136
|
try {
|
|
97
|
-
for (
|
|
98
|
-
var def =
|
|
137
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
138
|
+
var def = _step2.value;
|
|
99
139
|
// 检查是否是分组
|
|
100
140
|
if ('children' in def && def.children) {
|
|
101
141
|
// 递归查找分组内的列
|
|
@@ -110,9 +150,9 @@ export function flatConfigToGridState(flatConfig, originalColumnDefs) {
|
|
|
110
150
|
}
|
|
111
151
|
}
|
|
112
152
|
} catch (err) {
|
|
113
|
-
|
|
153
|
+
_iterator2.e(err);
|
|
114
154
|
} finally {
|
|
115
|
-
|
|
155
|
+
_iterator2.f();
|
|
116
156
|
}
|
|
117
157
|
return undefined;
|
|
118
158
|
}
|
|
@@ -173,7 +173,7 @@ export declare const createSelectField: (title: string, options: {
|
|
|
173
173
|
export declare const createCascaderField: (title: string, options: any[], config?: {
|
|
174
174
|
required?: boolean | undefined;
|
|
175
175
|
changeOnSelect?: boolean | undefined;
|
|
176
|
-
expandTrigger?: "
|
|
176
|
+
expandTrigger?: "click" | "hover" | undefined;
|
|
177
177
|
placeholder?: string | undefined;
|
|
178
178
|
}) => {
|
|
179
179
|
type: string;
|
|
@@ -187,7 +187,7 @@ export declare const createCascaderField: (title: string, options: any[], config
|
|
|
187
187
|
};
|
|
188
188
|
options: any[];
|
|
189
189
|
changeOnSelect: boolean;
|
|
190
|
-
expandTrigger: "
|
|
190
|
+
expandTrigger: "click" | "hover";
|
|
191
191
|
};
|
|
192
192
|
};
|
|
193
193
|
export default withStandardForm;
|