@nokecy/qc-ui 1.1.15 → 1.1.18
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/setting/ColumnSetting.js +62 -58
- package/dist/cjs/ag-grid-plus/setting/QuerySchemeManager.js +72 -64
- package/dist/cjs/ag-grid-plus/shared/storage/schemeStorageAdapter.d.ts +8 -8
- package/dist/cjs/array-table/index.js +1 -1
- package/dist/esm/ag-grid-plus/setting/ColumnSetting.js +62 -58
- package/dist/esm/ag-grid-plus/setting/QuerySchemeManager.js +72 -64
- package/dist/esm/ag-grid-plus/shared/storage/schemeStorageAdapter.d.ts +8 -8
- package/dist/esm/array-table/index.js +1 -1
- package/dist/esm/standardFormDialog/withStandardForm.d.ts +2 -2
- package/dist/umd/qc-ui.min.js +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,10 @@
|
|
|
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"];
|
|
2
5
|
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; } } }; }
|
|
6
|
+
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; }
|
|
7
|
+
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
8
|
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
9
|
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
10
|
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); }); }; }
|
|
@@ -291,7 +296,7 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
291
296
|
* 优化逻辑:先保存配置到存储,再直接应用到 Grid,不依赖 handleLoadScheme
|
|
292
297
|
*/
|
|
293
298
|
var handleSaveColumns = useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
294
|
-
var values, flatConfig, configToSave, invalidColumns, filterModel, savedScheme, defaultScheme, hasGroups, gridColumnDefs, columnState;
|
|
299
|
+
var values, flatConfig, configToSave, invalidColumns, filterModel, savedScheme, createdAt, updatedAt, schemeWithoutTimestamps, defaultScheme, _createdAt, _updatedAt, _schemeWithoutTimestamps, hasGroups, gridColumnDefs, columnState;
|
|
295
300
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
296
301
|
while (1) switch (_context2.prev = _context2.next) {
|
|
297
302
|
case 0:
|
|
@@ -323,43 +328,45 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
323
328
|
_context2.prev = 8;
|
|
324
329
|
filterModel = gridApi.getFilterModel();
|
|
325
330
|
if (!currentScheme) {
|
|
326
|
-
_context2.next =
|
|
331
|
+
_context2.next = 18;
|
|
327
332
|
break;
|
|
328
333
|
}
|
|
329
334
|
// 如果有激活的方案,更新该方案
|
|
330
|
-
|
|
335
|
+
createdAt = currentScheme.createdAt, updatedAt = currentScheme.updatedAt, schemeWithoutTimestamps = _objectWithoutProperties(currentScheme, _excluded);
|
|
336
|
+
savedScheme = _objectSpread(_objectSpread({}, schemeWithoutTimestamps), {}, {
|
|
331
337
|
columnConfig: configToSave,
|
|
332
|
-
filterModel: filterModel
|
|
333
|
-
updatedAt
|
|
338
|
+
filterModel: filterModel
|
|
339
|
+
// createdAt 和 updatedAt 由存储适配器自动生成
|
|
334
340
|
});
|
|
335
|
-
_context2.next =
|
|
341
|
+
_context2.next = 15;
|
|
336
342
|
return saveColumnScheme === null || saveColumnScheme === void 0 ? void 0 : saveColumnScheme(gridKey, savedScheme);
|
|
337
|
-
case
|
|
343
|
+
case 15:
|
|
338
344
|
message.success('列配置已保存到方案');
|
|
339
|
-
_context2.next =
|
|
345
|
+
_context2.next = 31;
|
|
340
346
|
break;
|
|
341
|
-
case
|
|
347
|
+
case 18:
|
|
342
348
|
// 如果没有激活的方案,自动创建或更新默认方案
|
|
343
349
|
defaultScheme = schemes.find(function (s) {
|
|
344
350
|
return s.isDefault;
|
|
345
351
|
});
|
|
346
352
|
if (!defaultScheme) {
|
|
347
|
-
_context2.next =
|
|
353
|
+
_context2.next = 27;
|
|
348
354
|
break;
|
|
349
355
|
}
|
|
350
356
|
// 更新默认方案
|
|
351
|
-
|
|
357
|
+
_createdAt = defaultScheme.createdAt, _updatedAt = defaultScheme.updatedAt, _schemeWithoutTimestamps = _objectWithoutProperties(defaultScheme, _excluded2);
|
|
358
|
+
savedScheme = _objectSpread(_objectSpread({}, _schemeWithoutTimestamps), {}, {
|
|
352
359
|
columnConfig: configToSave,
|
|
353
|
-
filterModel: filterModel
|
|
354
|
-
updatedAt
|
|
360
|
+
filterModel: filterModel
|
|
361
|
+
// createdAt 和 updatedAt 由存储适配器自动生成
|
|
355
362
|
});
|
|
356
|
-
_context2.next =
|
|
363
|
+
_context2.next = 24;
|
|
357
364
|
return saveColumnScheme === null || saveColumnScheme === void 0 ? void 0 : saveColumnScheme(gridKey, savedScheme);
|
|
358
|
-
case
|
|
365
|
+
case 24:
|
|
359
366
|
message.success('列配置已保存到默认方案');
|
|
360
|
-
_context2.next =
|
|
367
|
+
_context2.next = 31;
|
|
361
368
|
break;
|
|
362
|
-
case
|
|
369
|
+
case 27:
|
|
363
370
|
// 创建新的默认方案
|
|
364
371
|
savedScheme = {
|
|
365
372
|
id: uuidv4(),
|
|
@@ -368,37 +375,36 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
368
375
|
columnConfig: configToSave,
|
|
369
376
|
filterModel: filterModel,
|
|
370
377
|
isDefault: true,
|
|
371
|
-
isSystem: false
|
|
372
|
-
createdAt
|
|
373
|
-
updatedAt: Date.now()
|
|
378
|
+
isSystem: false
|
|
379
|
+
// createdAt 和 updatedAt 由存储适配器自动生成
|
|
374
380
|
};
|
|
375
|
-
_context2.next =
|
|
381
|
+
_context2.next = 30;
|
|
376
382
|
return saveColumnScheme === null || saveColumnScheme === void 0 ? void 0 : saveColumnScheme(gridKey, savedScheme);
|
|
377
|
-
case
|
|
383
|
+
case 30:
|
|
378
384
|
message.success('已创建并保存到默认方案');
|
|
379
|
-
case
|
|
380
|
-
_context2.next =
|
|
385
|
+
case 31:
|
|
386
|
+
_context2.next = 33;
|
|
381
387
|
return new Promise(function (resolve) {
|
|
382
388
|
return setTimeout(resolve, 100);
|
|
383
389
|
});
|
|
384
|
-
case
|
|
390
|
+
case 33:
|
|
385
391
|
// 1. 检查是否包含分组配置
|
|
386
392
|
hasGroups = savedScheme.columnConfig.some(function (item) {
|
|
387
393
|
return item.type === 'group';
|
|
388
394
|
}); // 如果包含分组,先更新 columnDefs
|
|
389
395
|
if (!hasGroups) {
|
|
390
|
-
_context2.next =
|
|
396
|
+
_context2.next = 39;
|
|
391
397
|
break;
|
|
392
398
|
}
|
|
393
399
|
gridColumnDefs = flatConfigToGridState(savedScheme.columnConfig, originalColumnDefs);
|
|
394
400
|
gridApi.setGridOption('columnDefs', gridColumnDefs);
|
|
395
401
|
|
|
396
402
|
// 等待 columnDefs 更新完成
|
|
397
|
-
_context2.next =
|
|
403
|
+
_context2.next = 39;
|
|
398
404
|
return new Promise(function (resolve) {
|
|
399
405
|
return setTimeout(resolve, 100);
|
|
400
406
|
});
|
|
401
|
-
case
|
|
407
|
+
case 39:
|
|
402
408
|
columnState = flatConfigToColumnState(savedScheme.columnConfig);
|
|
403
409
|
gridApi.applyColumnState({
|
|
404
410
|
state: columnState,
|
|
@@ -412,31 +418,31 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
412
418
|
|
|
413
419
|
// 4. 设置为当前方案(如果不是当前方案)
|
|
414
420
|
if (!(!currentScheme || savedScheme.id !== currentScheme.id)) {
|
|
415
|
-
_context2.next =
|
|
421
|
+
_context2.next = 45;
|
|
416
422
|
break;
|
|
417
423
|
}
|
|
418
|
-
_context2.next = 43;
|
|
419
|
-
return setCurrentColumnScheme === null || setCurrentColumnScheme === void 0 ? void 0 : setCurrentColumnScheme(gridKey, savedScheme.id);
|
|
420
|
-
case 43:
|
|
421
424
|
_context2.next = 45;
|
|
425
|
+
return setCurrentColumnScheme === null || setCurrentColumnScheme === void 0 ? void 0 : setCurrentColumnScheme(gridKey, savedScheme.id);
|
|
426
|
+
case 45:
|
|
427
|
+
_context2.next = 47;
|
|
422
428
|
return new Promise(function (resolve) {
|
|
423
429
|
return setTimeout(resolve, 50);
|
|
424
430
|
});
|
|
425
|
-
case
|
|
431
|
+
case 47:
|
|
426
432
|
// 5. 关闭弹窗
|
|
427
433
|
onClose();
|
|
428
|
-
_context2.next =
|
|
434
|
+
_context2.next = 54;
|
|
429
435
|
break;
|
|
430
|
-
case
|
|
431
|
-
_context2.prev =
|
|
436
|
+
case 50:
|
|
437
|
+
_context2.prev = 50;
|
|
432
438
|
_context2.t0 = _context2["catch"](8);
|
|
433
439
|
console.error('保存列配置到方案失败:', _context2.t0);
|
|
434
440
|
message.error('保存列配置失败');
|
|
435
|
-
case
|
|
441
|
+
case 54:
|
|
436
442
|
case "end":
|
|
437
443
|
return _context2.stop();
|
|
438
444
|
}
|
|
439
|
-
}, _callee2, null, [[8,
|
|
445
|
+
}, _callee2, null, [[8, 50]]);
|
|
440
446
|
})), [form, gridApi, saveColumnScheme, setCurrentColumnScheme, currentScheme, schemes, gridKey, originalColumnDefs, onClose]);
|
|
441
447
|
|
|
442
448
|
// 保存为新方案
|
|
@@ -498,9 +504,8 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
498
504
|
columnConfig: columnConfigToSave,
|
|
499
505
|
filterModel: filterModel,
|
|
500
506
|
isDefault: false,
|
|
501
|
-
isSystem: false
|
|
502
|
-
createdAt
|
|
503
|
-
updatedAt: Date.now()
|
|
507
|
+
isSystem: false
|
|
508
|
+
// createdAt 和 updatedAt 由存储适配器自动生成
|
|
504
509
|
};
|
|
505
510
|
_context3.next = 23;
|
|
506
511
|
return saveColumnScheme === null || saveColumnScheme === void 0 ? void 0 : saveColumnScheme(gridKey, newScheme);
|
|
@@ -556,8 +561,7 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
556
561
|
}
|
|
557
562
|
_context4.next = 11;
|
|
558
563
|
return saveColumnScheme === null || saveColumnScheme === void 0 ? void 0 : saveColumnScheme(gridKey, _objectSpread(_objectSpread({}, s), {}, {
|
|
559
|
-
isDefault: false
|
|
560
|
-
updatedAt: Date.now()
|
|
564
|
+
isDefault: false
|
|
561
565
|
}));
|
|
562
566
|
case 11:
|
|
563
567
|
_context4.next = 6;
|
|
@@ -576,8 +580,7 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
576
580
|
case 21:
|
|
577
581
|
_context4.next = 23;
|
|
578
582
|
return saveColumnScheme === null || saveColumnScheme === void 0 ? void 0 : saveColumnScheme(gridKey, _objectSpread(_objectSpread({}, scheme), {}, {
|
|
579
|
-
isDefault: true
|
|
580
|
-
updatedAt: Date.now()
|
|
583
|
+
isDefault: true
|
|
581
584
|
}));
|
|
582
585
|
case 23:
|
|
583
586
|
message.success('已设置为默认方案');
|
|
@@ -649,7 +652,7 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
649
652
|
|
|
650
653
|
// 保存编辑
|
|
651
654
|
var handleSaveEdit = useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
652
|
-
var scheme;
|
|
655
|
+
var scheme, createdAt, updatedAt, schemeWithoutTimestamps;
|
|
653
656
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
654
657
|
while (1) switch (_context6.prev = _context6.next) {
|
|
655
658
|
case 0:
|
|
@@ -664,30 +667,31 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
664
667
|
return s.id === editingId;
|
|
665
668
|
});
|
|
666
669
|
if (!scheme) {
|
|
667
|
-
_context6.next =
|
|
670
|
+
_context6.next = 10;
|
|
668
671
|
break;
|
|
669
672
|
}
|
|
670
|
-
|
|
671
|
-
|
|
673
|
+
createdAt = scheme.createdAt, updatedAt = scheme.updatedAt, schemeWithoutTimestamps = _objectWithoutProperties(scheme, _excluded3);
|
|
674
|
+
_context6.next = 8;
|
|
675
|
+
return saveColumnScheme === null || saveColumnScheme === void 0 ? void 0 : saveColumnScheme(gridKey, _objectSpread(_objectSpread({}, schemeWithoutTimestamps), {}, {
|
|
672
676
|
name: editingName.trim(),
|
|
673
|
-
description: editingDescription.trim() || undefined
|
|
674
|
-
updatedAt
|
|
677
|
+
description: editingDescription.trim() || undefined
|
|
678
|
+
// createdAt 和 updatedAt 由存储适配器自动生成
|
|
675
679
|
}));
|
|
676
|
-
case
|
|
680
|
+
case 8:
|
|
677
681
|
message.success('更新成功');
|
|
678
682
|
setEditingId(null);
|
|
679
|
-
case
|
|
680
|
-
_context6.next =
|
|
683
|
+
case 10:
|
|
684
|
+
_context6.next = 15;
|
|
681
685
|
break;
|
|
682
|
-
case
|
|
683
|
-
_context6.prev =
|
|
686
|
+
case 12:
|
|
687
|
+
_context6.prev = 12;
|
|
684
688
|
_context6.t0 = _context6["catch"](2);
|
|
685
689
|
message.error(_context6.t0.message || '更新失败');
|
|
686
|
-
case
|
|
690
|
+
case 15:
|
|
687
691
|
case "end":
|
|
688
692
|
return _context6.stop();
|
|
689
693
|
}
|
|
690
|
-
}, _callee6, null, [[2,
|
|
694
|
+
}, _callee6, null, [[2, 12]]);
|
|
691
695
|
})), [schemes, saveColumnScheme, gridKey, editingId, editingName, editingDescription]);
|
|
692
696
|
|
|
693
697
|
// 筛选方案列表
|
|
@@ -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
|
-
|
|
208
|
-
|
|
209
|
-
|
|
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), {}, {
|
|
215
|
+
queryConfig: queryConfig
|
|
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(),
|
|
@@ -220,32 +227,31 @@ var QuerySchemeManager = function QuerySchemeManager(_ref) {
|
|
|
220
227
|
description: '自动创建的默认查询方案',
|
|
221
228
|
queryConfig: queryConfig,
|
|
222
229
|
isDefault: true,
|
|
223
|
-
isSystem: false
|
|
224
|
-
createdAt
|
|
225
|
-
updatedAt: Date.now()
|
|
230
|
+
isSystem: false
|
|
231
|
+
// createdAt 和 updatedAt 由存储适配器自动生成
|
|
226
232
|
};
|
|
227
|
-
_context.next =
|
|
233
|
+
_context.next = 14;
|
|
228
234
|
return saveQueryScheme === null || saveQueryScheme === void 0 ? void 0 : saveQueryScheme(gridKey, newScheme);
|
|
229
|
-
case
|
|
230
|
-
_context.next =
|
|
235
|
+
case 14:
|
|
236
|
+
_context.next = 16;
|
|
231
237
|
return setCurrentQueryScheme === null || setCurrentQueryScheme === void 0 ? void 0 : setCurrentQueryScheme(gridKey, newScheme.id);
|
|
232
|
-
case 15:
|
|
233
|
-
message.success('已自动创建并应用默认方案');
|
|
234
238
|
case 16:
|
|
239
|
+
message.success('已自动创建并应用默认方案');
|
|
240
|
+
case 17:
|
|
235
241
|
// 应用顺序到表单
|
|
236
242
|
updateQueryOrder === null || updateQueryOrder === void 0 || updateQueryOrder(editingOrder);
|
|
237
243
|
onClose();
|
|
238
|
-
_context.next =
|
|
244
|
+
_context.next = 24;
|
|
239
245
|
break;
|
|
240
|
-
case
|
|
241
|
-
_context.prev =
|
|
246
|
+
case 21:
|
|
247
|
+
_context.prev = 21;
|
|
242
248
|
_context.t0 = _context["catch"](0);
|
|
243
249
|
message.error(_context.t0.message || '应用失败');
|
|
244
|
-
case
|
|
250
|
+
case 24:
|
|
245
251
|
case "end":
|
|
246
252
|
return _context.stop();
|
|
247
253
|
}
|
|
248
|
-
}, _callee, null, [[0,
|
|
254
|
+
}, _callee, null, [[0, 21]]);
|
|
249
255
|
})), [queryItemsData, currentScheme, saveQueryScheme, gridKey, updateQueryOrder, onClose, setCurrentQueryScheme]);
|
|
250
256
|
|
|
251
257
|
/**
|
|
@@ -279,9 +285,8 @@ var QuerySchemeManager = function QuerySchemeManager(_ref) {
|
|
|
279
285
|
description: '',
|
|
280
286
|
queryConfig: queryConfig,
|
|
281
287
|
isDefault: false,
|
|
282
|
-
isSystem: false
|
|
283
|
-
createdAt
|
|
284
|
-
updatedAt: Date.now()
|
|
288
|
+
isSystem: false
|
|
289
|
+
// createdAt 和 updatedAt 由存储适配器自动生成
|
|
285
290
|
};
|
|
286
291
|
_context2.next = 10;
|
|
287
292
|
return saveQueryScheme === null || saveQueryScheme === void 0 ? void 0 : saveQueryScheme(gridKey, newScheme);
|
|
@@ -314,7 +319,7 @@ var QuerySchemeManager = function QuerySchemeManager(_ref) {
|
|
|
314
319
|
* 保存编辑
|
|
315
320
|
*/
|
|
316
321
|
var handleSaveEdit = useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
317
|
-
var scheme;
|
|
322
|
+
var scheme, createdAt, updatedAt, schemeWithoutTimestamps;
|
|
318
323
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
319
324
|
while (1) switch (_context3.prev = _context3.next) {
|
|
320
325
|
case 0:
|
|
@@ -334,26 +339,27 @@ var QuerySchemeManager = function QuerySchemeManager(_ref) {
|
|
|
334
339
|
}
|
|
335
340
|
return _context3.abrupt("return");
|
|
336
341
|
case 6:
|
|
337
|
-
|
|
338
|
-
|
|
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), {}, {
|
|
339
345
|
name: editingName.trim(),
|
|
340
|
-
description: editingDescription.trim() || undefined
|
|
341
|
-
updatedAt
|
|
346
|
+
description: editingDescription.trim() || undefined
|
|
347
|
+
// createdAt 和 updatedAt 由存储适配器自动生成
|
|
342
348
|
}));
|
|
343
|
-
case
|
|
349
|
+
case 9:
|
|
344
350
|
message.success('更新成功');
|
|
345
351
|
setEditingId(null);
|
|
346
|
-
_context3.next =
|
|
352
|
+
_context3.next = 16;
|
|
347
353
|
break;
|
|
348
|
-
case
|
|
349
|
-
_context3.prev =
|
|
354
|
+
case 13:
|
|
355
|
+
_context3.prev = 13;
|
|
350
356
|
_context3.t0 = _context3["catch"](2);
|
|
351
357
|
message.error(_context3.t0.message || '更新失败');
|
|
352
|
-
case
|
|
358
|
+
case 16:
|
|
353
359
|
case "end":
|
|
354
360
|
return _context3.stop();
|
|
355
361
|
}
|
|
356
|
-
}, _callee3, null, [[2,
|
|
362
|
+
}, _callee3, null, [[2, 13]]);
|
|
357
363
|
})), [editingId, editingName, editingDescription, schemes, saveQueryScheme, gridKey]);
|
|
358
364
|
|
|
359
365
|
/**
|
|
@@ -400,7 +406,7 @@ var QuerySchemeManager = function QuerySchemeManager(_ref) {
|
|
|
400
406
|
*/
|
|
401
407
|
var handleSetDefault = useCallback( /*#__PURE__*/function () {
|
|
402
408
|
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(schemeId, schemeName) {
|
|
403
|
-
var _iterator, _step, _scheme, scheme;
|
|
409
|
+
var _iterator, _step, _scheme, _createdAt, _updatedAt, _schemeWithoutTimestamps, scheme, createdAt, updatedAt, schemeWithoutTimestamps;
|
|
404
410
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
405
411
|
while (1) switch (_context5.prev = _context5.next) {
|
|
406
412
|
case 0:
|
|
@@ -411,61 +417,63 @@ var QuerySchemeManager = function QuerySchemeManager(_ref) {
|
|
|
411
417
|
_iterator.s();
|
|
412
418
|
case 4:
|
|
413
419
|
if ((_step = _iterator.n()).done) {
|
|
414
|
-
_context5.next =
|
|
420
|
+
_context5.next = 12;
|
|
415
421
|
break;
|
|
416
422
|
}
|
|
417
423
|
_scheme = _step.value;
|
|
418
424
|
if (!(_scheme.isDefault && _scheme.id !== schemeId)) {
|
|
419
|
-
_context5.next =
|
|
425
|
+
_context5.next = 10;
|
|
420
426
|
break;
|
|
421
427
|
}
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
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), {}, {
|
|
431
|
+
isDefault: false
|
|
432
|
+
// createdAt 和 updatedAt 由存储适配器自动生成
|
|
426
433
|
}));
|
|
427
|
-
case
|
|
434
|
+
case 10:
|
|
428
435
|
_context5.next = 4;
|
|
429
436
|
break;
|
|
430
|
-
case
|
|
431
|
-
_context5.next =
|
|
437
|
+
case 12:
|
|
438
|
+
_context5.next = 17;
|
|
432
439
|
break;
|
|
433
|
-
case
|
|
434
|
-
_context5.prev =
|
|
440
|
+
case 14:
|
|
441
|
+
_context5.prev = 14;
|
|
435
442
|
_context5.t0 = _context5["catch"](2);
|
|
436
443
|
_iterator.e(_context5.t0);
|
|
437
|
-
case
|
|
438
|
-
_context5.prev =
|
|
444
|
+
case 17:
|
|
445
|
+
_context5.prev = 17;
|
|
439
446
|
_iterator.f();
|
|
440
|
-
return _context5.finish(
|
|
441
|
-
case
|
|
447
|
+
return _context5.finish(17);
|
|
448
|
+
case 20:
|
|
442
449
|
// 设置新的默认方案
|
|
443
450
|
scheme = schemes.find(function (s) {
|
|
444
451
|
return s.id === schemeId;
|
|
445
452
|
});
|
|
446
453
|
if (!scheme) {
|
|
447
|
-
_context5.next =
|
|
454
|
+
_context5.next = 26;
|
|
448
455
|
break;
|
|
449
456
|
}
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
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), {}, {
|
|
460
|
+
isDefault: true
|
|
461
|
+
// createdAt 和 updatedAt 由存储适配器自动生成
|
|
454
462
|
}));
|
|
455
|
-
case
|
|
463
|
+
case 25:
|
|
456
464
|
message.success("\u5DF2\u5C06\"".concat(schemeName, "\"\u8BBE\u4E3A\u9ED8\u8BA4\u65B9\u6848"));
|
|
457
|
-
case 24:
|
|
458
|
-
_context5.next = 29;
|
|
459
|
-
break;
|
|
460
465
|
case 26:
|
|
461
|
-
_context5.
|
|
466
|
+
_context5.next = 31;
|
|
467
|
+
break;
|
|
468
|
+
case 28:
|
|
469
|
+
_context5.prev = 28;
|
|
462
470
|
_context5.t1 = _context5["catch"](0);
|
|
463
471
|
message.error(_context5.t1.message || '设置失败');
|
|
464
|
-
case
|
|
472
|
+
case 31:
|
|
465
473
|
case "end":
|
|
466
474
|
return _context5.stop();
|
|
467
475
|
}
|
|
468
|
-
}, _callee5, null, [[0,
|
|
476
|
+
}, _callee5, null, [[0, 28], [2, 14, 17, 20]]);
|
|
469
477
|
}));
|
|
470
478
|
return function (_x3, _x4) {
|
|
471
479
|
return _ref6.apply(this, arguments);
|
|
@@ -33,10 +33,10 @@ export interface QueryScheme {
|
|
|
33
33
|
isDefault: boolean;
|
|
34
34
|
/** 是否为系统方案(不可删除) */
|
|
35
35
|
isSystem: boolean;
|
|
36
|
-
/**
|
|
37
|
-
createdAt
|
|
38
|
-
/**
|
|
39
|
-
updatedAt
|
|
36
|
+
/** 创建时间戳(由存储适配器自动生成) */
|
|
37
|
+
createdAt?: number;
|
|
38
|
+
/** 最后更新时间戳(由存储适配器自动生成) */
|
|
39
|
+
updatedAt?: number;
|
|
40
40
|
/** 创建用户ID(可选) */
|
|
41
41
|
createdBy?: string;
|
|
42
42
|
}
|
|
@@ -59,10 +59,10 @@ export interface ColumnScheme {
|
|
|
59
59
|
isDefault: boolean;
|
|
60
60
|
/** 是否为系统方案(不可删除) */
|
|
61
61
|
isSystem: boolean;
|
|
62
|
-
/**
|
|
63
|
-
createdAt
|
|
64
|
-
/**
|
|
65
|
-
updatedAt
|
|
62
|
+
/** 创建时间戳(由存储适配器自动生成) */
|
|
63
|
+
createdAt?: number;
|
|
64
|
+
/** 最后更新时间戳(由存储适配器自动生成) */
|
|
65
|
+
updatedAt?: number;
|
|
66
66
|
/** 创建用户ID(可选) */
|
|
67
67
|
createdBy?: string;
|
|
68
68
|
}
|
|
@@ -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;
|