@nokecy/qc-ui 1.0.93 → 1.0.95
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 +262 -177
- package/dist/cjs/ag-grid-plus/context/gridContext.d.ts +79 -15
- package/dist/cjs/ag-grid-plus/context/gridContext.js +0 -4
- package/dist/cjs/ag-grid-plus/context/useSchemeDataFlow.d.ts +88 -0
- package/dist/cjs/ag-grid-plus/context/useSchemeDataFlow.js +173 -0
- package/dist/cjs/ag-grid-plus/context/useSchemeManager.d.ts +78 -0
- package/dist/cjs/ag-grid-plus/{querySchemes/hooks/useQuerySchemes.js → context/useSchemeManager.js} +421 -449
- package/dist/cjs/ag-grid-plus/hooks/useAgGridCalculation.d.ts +1 -1
- package/dist/cjs/ag-grid-plus/hooks/useAgGridData.d.ts +2 -2
- package/dist/cjs/ag-grid-plus/index.d.ts +7 -4
- package/dist/cjs/ag-grid-plus/index.js +11 -154
- package/dist/cjs/ag-grid-plus/interface.d.ts +0 -31
- package/dist/cjs/ag-grid-plus/interface.js +3 -0
- package/dist/cjs/ag-grid-plus/setting/ColumnSetting.d.ts +0 -3
- package/dist/cjs/ag-grid-plus/setting/ColumnSetting.js +430 -412
- package/dist/cjs/ag-grid-plus/setting/QuerySchemeManager.d.ts +11 -0
- package/dist/cjs/ag-grid-plus/{querySchemes/components/QuerySchemesManager.js → setting/QuerySchemeManager.js} +304 -202
- package/dist/cjs/ag-grid-plus/setting/index.d.ts +2 -2
- package/dist/cjs/ag-grid-plus/setting/index.js +33 -48
- package/dist/cjs/ag-grid-plus/shared/storage/backendApiAdapter.d.ts +58 -0
- package/dist/cjs/ag-grid-plus/shared/storage/backendApiAdapter.js +446 -0
- package/dist/cjs/ag-grid-plus/shared/storage/localStorageAdapter.d.ts +57 -0
- package/dist/cjs/ag-grid-plus/{storage/MemoryStorageAdapter.js → shared/storage/localStorageAdapter.js} +264 -184
- package/dist/cjs/ag-grid-plus/shared/storage/schemeStorageAdapter.d.ts +132 -0
- package/dist/cjs/array-table/index.js +172 -48
- package/dist/cjs/draggableModal/index.d.ts +1 -1
- package/dist/cjs/draggableModal/index.js +23 -93
- package/dist/cjs/draggableModal/style.less +0 -73
- package/dist/cjs/index.d.ts +3 -4
- package/dist/cjs/index.js +16 -160
- package/dist/esm/ag-grid-plus/ag-gridPlus.js +262 -177
- package/dist/esm/ag-grid-plus/context/gridContext.d.ts +79 -15
- package/dist/esm/ag-grid-plus/context/gridContext.js +0 -4
- package/dist/esm/ag-grid-plus/context/useSchemeDataFlow.d.ts +88 -0
- package/dist/esm/ag-grid-plus/context/useSchemeDataFlow.js +165 -0
- package/dist/esm/ag-grid-plus/context/useSchemeManager.d.ts +78 -0
- package/dist/esm/ag-grid-plus/{querySchemes/hooks/useQuerySchemes.js → context/useSchemeManager.js} +420 -449
- package/dist/esm/ag-grid-plus/errors/ErrorBoundary.d.ts +1 -1
- package/dist/esm/ag-grid-plus/hooks/useAgGridCalculation.d.ts +1 -1
- package/dist/esm/ag-grid-plus/hooks/useAgGridData.d.ts +2 -2
- package/dist/esm/ag-grid-plus/index.d.ts +7 -4
- package/dist/esm/ag-grid-plus/index.js +10 -4
- package/dist/esm/ag-grid-plus/interface.d.ts +0 -31
- package/dist/esm/ag-grid-plus/interface.js +2 -0
- package/dist/esm/ag-grid-plus/setting/ColumnSetting.d.ts +0 -3
- package/dist/esm/ag-grid-plus/setting/ColumnSetting.js +434 -416
- package/dist/esm/ag-grid-plus/setting/QuerySchemeManager.d.ts +11 -0
- package/dist/esm/ag-grid-plus/{querySchemes/components/QuerySchemesManager.js → setting/QuerySchemeManager.js} +304 -202
- package/dist/esm/ag-grid-plus/setting/index.d.ts +2 -2
- package/dist/esm/ag-grid-plus/setting/index.js +33 -48
- package/dist/esm/ag-grid-plus/shared/storage/backendApiAdapter.d.ts +58 -0
- package/dist/esm/ag-grid-plus/shared/storage/backendApiAdapter.js +444 -0
- package/dist/esm/ag-grid-plus/shared/storage/localStorageAdapter.d.ts +57 -0
- package/dist/esm/ag-grid-plus/{storage/MemoryStorageAdapter.js → shared/storage/localStorageAdapter.js} +263 -184
- package/dist/esm/ag-grid-plus/shared/storage/schemeStorageAdapter.d.ts +132 -0
- package/dist/esm/array-table/index.js +174 -48
- package/dist/esm/draggableModal/index.d.ts +1 -1
- package/dist/esm/draggableModal/index.js +24 -93
- package/dist/esm/draggableModal/style.less +0 -73
- package/dist/esm/index.d.ts +3 -4
- package/dist/esm/index.js +13 -10
- package/dist/umd/qc-ui.min.css +1 -1
- package/dist/umd/qc-ui.min.js +1 -1
- package/package.json +1 -1
- package/dist/cjs/ag-grid-plus/querySchemes/components/QuerySchemesManager.d.ts +0 -21
- package/dist/cjs/ag-grid-plus/querySchemes/components/QuerySchemesManager.less +0 -86
- package/dist/cjs/ag-grid-plus/querySchemes/components/index.d.ts +0 -5
- package/dist/cjs/ag-grid-plus/querySchemes/components/index.js +0 -12
- package/dist/cjs/ag-grid-plus/querySchemes/constants.d.ts +0 -17
- package/dist/cjs/ag-grid-plus/querySchemes/constants.js +0 -30
- package/dist/cjs/ag-grid-plus/querySchemes/hooks/useQueryOrderManager.d.ts +0 -10
- package/dist/cjs/ag-grid-plus/querySchemes/hooks/useQueryOrderManager.js +0 -65
- package/dist/cjs/ag-grid-plus/querySchemes/hooks/useQuerySchemes.d.ts +0 -6
- package/dist/cjs/ag-grid-plus/querySchemes/index.d.ts +0 -11
- package/dist/cjs/ag-grid-plus/querySchemes/index.js +0 -113
- package/dist/cjs/ag-grid-plus/querySchemes/storage/localStorageAdapter.d.ts +0 -44
- package/dist/cjs/ag-grid-plus/querySchemes/storage/localStorageAdapter.js +0 -261
- package/dist/cjs/ag-grid-plus/querySchemes/types.d.ts +0 -143
- package/dist/cjs/ag-grid-plus/querySchemes/utils/validator.d.ts +0 -36
- package/dist/cjs/ag-grid-plus/querySchemes/utils/validator.js +0 -155
- package/dist/cjs/ag-grid-plus/schemes/components/SchemeManager.d.ts +0 -16
- package/dist/cjs/ag-grid-plus/schemes/components/SchemeManager.js +0 -342
- package/dist/cjs/ag-grid-plus/schemes/components/SchemeManager.less +0 -35
- package/dist/cjs/ag-grid-plus/schemes/components/SchemeSelector.d.ts +0 -20
- package/dist/cjs/ag-grid-plus/schemes/components/SchemeSelector.js +0 -289
- package/dist/cjs/ag-grid-plus/schemes/components/SchemeSelector.less +0 -39
- package/dist/cjs/ag-grid-plus/schemes/components/index.d.ts +0 -4
- package/dist/cjs/ag-grid-plus/schemes/components/index.js +0 -19
- package/dist/cjs/ag-grid-plus/schemes/constants.d.ts +0 -23
- package/dist/cjs/ag-grid-plus/schemes/constants.js +0 -39
- package/dist/cjs/ag-grid-plus/schemes/hooks/useColumnSchemes.d.ts +0 -6
- package/dist/cjs/ag-grid-plus/schemes/hooks/useColumnSchemes.js +0 -617
- package/dist/cjs/ag-grid-plus/schemes/index.d.ts +0 -16
- package/dist/cjs/ag-grid-plus/schemes/index.js +0 -124
- package/dist/cjs/ag-grid-plus/schemes/storage/localStorageAdapter.d.ts +0 -64
- package/dist/cjs/ag-grid-plus/schemes/storage/localStorageAdapter.js +0 -354
- package/dist/cjs/ag-grid-plus/schemes/types.d.ts +0 -131
- package/dist/cjs/ag-grid-plus/schemes/types.js +0 -5
- package/dist/cjs/ag-grid-plus/schemes/utils/validator.d.ts +0 -27
- package/dist/cjs/ag-grid-plus/schemes/utils/validator.js +0 -109
- package/dist/cjs/ag-grid-plus/storage/MemoryStorageAdapter.d.ts +0 -76
- package/dist/cjs/ag-grid-plus/storage/SchemeSyncManager.d.ts +0 -141
- package/dist/cjs/ag-grid-plus/storage/SchemeSyncManager.js +0 -902
- package/dist/cjs/ag-grid-plus/storage/globalSyncManager.d.ts +0 -106
- package/dist/cjs/ag-grid-plus/storage/globalSyncManager.js +0 -364
- package/dist/cjs/ag-grid-plus/storage/index.d.ts +0 -8
- package/dist/cjs/ag-grid-plus/storage/index.js +0 -49
- package/dist/cjs/ag-grid-plus/storage/types.d.ts +0 -150
- package/dist/cjs/ag-grid-plus/storage/types.js +0 -5
- package/dist/esm/ag-grid-plus/querySchemes/components/QuerySchemesManager.d.ts +0 -21
- package/dist/esm/ag-grid-plus/querySchemes/components/QuerySchemesManager.less +0 -86
- package/dist/esm/ag-grid-plus/querySchemes/components/index.d.ts +0 -5
- package/dist/esm/ag-grid-plus/querySchemes/components/index.js +0 -5
- package/dist/esm/ag-grid-plus/querySchemes/constants.d.ts +0 -17
- package/dist/esm/ag-grid-plus/querySchemes/constants.js +0 -24
- package/dist/esm/ag-grid-plus/querySchemes/hooks/useQueryOrderManager.d.ts +0 -10
- package/dist/esm/ag-grid-plus/querySchemes/hooks/useQueryOrderManager.js +0 -60
- package/dist/esm/ag-grid-plus/querySchemes/hooks/useQuerySchemes.d.ts +0 -6
- package/dist/esm/ag-grid-plus/querySchemes/index.d.ts +0 -11
- package/dist/esm/ag-grid-plus/querySchemes/index.js +0 -20
- package/dist/esm/ag-grid-plus/querySchemes/storage/localStorageAdapter.d.ts +0 -44
- package/dist/esm/ag-grid-plus/querySchemes/storage/localStorageAdapter.js +0 -256
- package/dist/esm/ag-grid-plus/querySchemes/types.d.ts +0 -143
- package/dist/esm/ag-grid-plus/querySchemes/utils/validator.d.ts +0 -36
- package/dist/esm/ag-grid-plus/querySchemes/utils/validator.js +0 -144
- package/dist/esm/ag-grid-plus/schemes/components/SchemeManager.d.ts +0 -16
- package/dist/esm/ag-grid-plus/schemes/components/SchemeManager.js +0 -334
- package/dist/esm/ag-grid-plus/schemes/components/SchemeManager.less +0 -35
- package/dist/esm/ag-grid-plus/schemes/components/SchemeSelector.d.ts +0 -20
- package/dist/esm/ag-grid-plus/schemes/components/SchemeSelector.js +0 -281
- package/dist/esm/ag-grid-plus/schemes/components/SchemeSelector.less +0 -39
- package/dist/esm/ag-grid-plus/schemes/components/index.d.ts +0 -4
- package/dist/esm/ag-grid-plus/schemes/components/index.js +0 -2
- package/dist/esm/ag-grid-plus/schemes/constants.d.ts +0 -23
- package/dist/esm/ag-grid-plus/schemes/constants.js +0 -33
- package/dist/esm/ag-grid-plus/schemes/hooks/useColumnSchemes.d.ts +0 -6
- package/dist/esm/ag-grid-plus/schemes/hooks/useColumnSchemes.js +0 -612
- package/dist/esm/ag-grid-plus/schemes/index.d.ts +0 -16
- package/dist/esm/ag-grid-plus/schemes/index.js +0 -25
- package/dist/esm/ag-grid-plus/schemes/storage/localStorageAdapter.d.ts +0 -64
- package/dist/esm/ag-grid-plus/schemes/storage/localStorageAdapter.js +0 -349
- package/dist/esm/ag-grid-plus/schemes/types.d.ts +0 -131
- package/dist/esm/ag-grid-plus/schemes/types.js +0 -1
- package/dist/esm/ag-grid-plus/schemes/utils/validator.d.ts +0 -27
- package/dist/esm/ag-grid-plus/schemes/utils/validator.js +0 -100
- package/dist/esm/ag-grid-plus/storage/MemoryStorageAdapter.d.ts +0 -76
- package/dist/esm/ag-grid-plus/storage/SchemeSyncManager.d.ts +0 -141
- package/dist/esm/ag-grid-plus/storage/SchemeSyncManager.js +0 -896
- package/dist/esm/ag-grid-plus/storage/globalSyncManager.d.ts +0 -106
- package/dist/esm/ag-grid-plus/storage/globalSyncManager.js +0 -350
- package/dist/esm/ag-grid-plus/storage/index.d.ts +0 -8
- package/dist/esm/ag-grid-plus/storage/index.js +0 -9
- package/dist/esm/ag-grid-plus/storage/types.d.ts +0 -150
- package/dist/esm/ag-grid-plus/storage/types.js +0 -1
- /package/dist/cjs/ag-grid-plus/{querySchemes/types.js → shared/storage/schemeStorageAdapter.js} +0 -0
- /package/dist/esm/ag-grid-plus/{querySchemes/types.js → shared/storage/schemeStorageAdapter.js} +0 -0
|
@@ -1,4 +1,5 @@
|
|
|
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
3
|
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; }
|
|
3
4
|
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); } }
|
|
4
5
|
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); }); }; }
|
|
@@ -13,28 +14,45 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
13
14
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
14
15
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
15
16
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
16
|
-
import React, { useState, useCallback, useMemo, useEffect
|
|
17
|
-
import { Modal, Tabs, Space, Button, Input, message, Popconfirm,
|
|
18
|
-
import { SaveOutlined, ReloadOutlined, EditOutlined, DeleteOutlined, StarOutlined, StarFilled,
|
|
17
|
+
import React, { useState, useCallback, useMemo, useEffect } from 'react';
|
|
18
|
+
import { Modal, Tabs, Space, Button, Input, message, Popconfirm, Tag, Tooltip, Empty } from 'antd';
|
|
19
|
+
import { SaveOutlined, ReloadOutlined, EditOutlined, DeleteOutlined, StarOutlined, StarFilled, SearchOutlined } from '@ant-design/icons';
|
|
20
|
+
import { AgGridReact } from 'ag-grid-react';
|
|
21
|
+
import { agGridTheme } from "../theme";
|
|
22
|
+
import { localeText } from "../locale";
|
|
19
23
|
import { createForm, onFormInit } from '@formily/core';
|
|
20
|
-
import { gridStateToFlatConfig, flatConfigToGridState, isOldSchemeData, migrateOldScheme } from "./columnGroupUtils";
|
|
24
|
+
import { gridStateToFlatConfig, flatConfigToGridState, flatConfigToColumnState, isOldSchemeData, migrateOldScheme } from "./columnGroupUtils";
|
|
21
25
|
import ColumnConfigTable from "./ColumnConfigTable";
|
|
22
|
-
import processColumnGroups from "../_utils/processColumnGroups";
|
|
23
26
|
import DraggableModal from "../../draggableModal";
|
|
24
|
-
import {
|
|
27
|
+
import { useGridSchemes } from "../context/useSchemeManager";
|
|
28
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
25
29
|
var TabPane = Tabs.TabPane;
|
|
26
30
|
var TextArea = Input.TextArea;
|
|
27
31
|
/**
|
|
28
32
|
* 列方案管理组件 - 集成列配置和列方案管理
|
|
29
33
|
*/
|
|
30
34
|
var ColumnSetting = function ColumnSetting(_ref) {
|
|
35
|
+
var _currentSchemes$gridK3;
|
|
31
36
|
var gridKey = _ref.gridKey,
|
|
32
37
|
gridApi = _ref.gridApi,
|
|
33
38
|
visible = _ref.visible,
|
|
34
39
|
onClose = _ref.onClose,
|
|
35
|
-
onSaveColumnState = _ref.onSaveColumnState
|
|
36
|
-
|
|
37
|
-
|
|
40
|
+
onSaveColumnState = _ref.onSaveColumnState;
|
|
41
|
+
// 使用新的集中式方案管理 API(包含状态数据和操作方法)
|
|
42
|
+
var _useGridSchemes = useGridSchemes(),
|
|
43
|
+
columnSchemes = _useGridSchemes.columnSchemes,
|
|
44
|
+
currentSchemes = _useGridSchemes.currentSchemes,
|
|
45
|
+
allColDefs = _useGridSchemes.allColDefs,
|
|
46
|
+
saveColumnScheme = _useGridSchemes.saveColumnScheme,
|
|
47
|
+
deleteColumnScheme = _useGridSchemes.deleteColumnScheme,
|
|
48
|
+
setCurrentColumnScheme = _useGridSchemes.setCurrentColumnScheme;
|
|
49
|
+
|
|
50
|
+
// 获取当前表格的方案列表
|
|
51
|
+
var schemes = (columnSchemes === null || columnSchemes === void 0 ? void 0 : columnSchemes[gridKey]) || [];
|
|
52
|
+
var currentScheme = schemes.find(function (s) {
|
|
53
|
+
var _currentSchemes$gridK;
|
|
54
|
+
return s.id === (currentSchemes === null || currentSchemes === void 0 || (_currentSchemes$gridK = currentSchemes[gridKey]) === null || _currentSchemes$gridK === void 0 ? void 0 : _currentSchemes$gridK.columnSchemeId);
|
|
55
|
+
});
|
|
38
56
|
var _useState = useState('columns'),
|
|
39
57
|
_useState2 = _slicedToArray(_useState, 2),
|
|
40
58
|
activeTab = _useState2[0],
|
|
@@ -66,35 +84,29 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
66
84
|
schemeDescription = _useState14[0],
|
|
67
85
|
setSchemeDescription = _useState14[1];
|
|
68
86
|
|
|
69
|
-
//
|
|
87
|
+
// 搜索状态
|
|
70
88
|
var _useState15 = useState(''),
|
|
71
89
|
_useState16 = _slicedToArray(_useState15, 2),
|
|
72
90
|
searchText = _useState16[0],
|
|
73
91
|
setSearchText = _useState16[1];
|
|
74
|
-
var _useState17 = useState('grid'),
|
|
75
|
-
_useState18 = _slicedToArray(_useState17, 2),
|
|
76
|
-
viewMode = _useState18[0],
|
|
77
|
-
setViewMode = _useState18[1];
|
|
78
92
|
|
|
79
93
|
// 【修复】从 Context 获取原始完整的列定义
|
|
80
|
-
var
|
|
81
|
-
var originalColumnDefs = (gridPlusContext === null || gridPlusContext === void 0 ? void 0 : gridPlusContext.allColDefs) || undefined;
|
|
94
|
+
var originalColumnDefs = allColDefs || undefined;
|
|
82
95
|
|
|
83
96
|
// 【修复】保存快照用于取消时恢复(改名避免与Context的originalColumnDefs冲突)
|
|
84
|
-
var
|
|
85
|
-
|
|
86
|
-
snapshotColumnDefs =
|
|
87
|
-
setSnapshotColumnDefs =
|
|
97
|
+
var _useState17 = useState(null),
|
|
98
|
+
_useState18 = _slicedToArray(_useState17, 2),
|
|
99
|
+
snapshotColumnDefs = _useState18[0],
|
|
100
|
+
setSnapshotColumnDefs = _useState18[1];
|
|
88
101
|
|
|
89
102
|
/**
|
|
90
103
|
* 获取列数据 - 将 Grid 的列定义转换为扁平化配置
|
|
91
104
|
* 新版本使用树形结构,兼容旧版本的 groupName 结构
|
|
92
105
|
*/
|
|
93
106
|
var getColumnData = useCallback(function () {
|
|
94
|
-
var _schemeManager$curren;
|
|
95
107
|
// 优先使用当前方案中保存的完整列配置(包含分组结构)
|
|
96
|
-
if (
|
|
97
|
-
return
|
|
108
|
+
if (currentScheme !== null && currentScheme !== void 0 && currentScheme.columnConfig) {
|
|
109
|
+
return currentScheme.columnConfig;
|
|
98
110
|
}
|
|
99
111
|
|
|
100
112
|
// 如果方案中没有 columnConfig,则从 Grid 读取
|
|
@@ -134,7 +146,7 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
134
146
|
return item;
|
|
135
147
|
});
|
|
136
148
|
return flatConfig;
|
|
137
|
-
}, [gridApi,
|
|
149
|
+
}, [gridApi, currentScheme]);
|
|
138
150
|
|
|
139
151
|
// 创建 Formily Form 实例
|
|
140
152
|
var form = useMemo(function () {
|
|
@@ -155,7 +167,7 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
155
167
|
items: newData
|
|
156
168
|
});
|
|
157
169
|
}
|
|
158
|
-
}, [
|
|
170
|
+
}, [currentScheme, visible, form, getColumnData]);
|
|
159
171
|
|
|
160
172
|
// 【修复】弹窗打开时保存快照,用于取消时恢复
|
|
161
173
|
useEffect(function () {
|
|
@@ -179,34 +191,32 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
179
191
|
var gridColumnDefs = flatConfigToGridState(newItems, originalColumnDefs);
|
|
180
192
|
|
|
181
193
|
// 3. 立即应用到 Grid(实时预览,不保存到方案)
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
194
|
+
// 【修复】同时应用列顺序和状态,确保拖拽排序能够生效
|
|
195
|
+
var columnState = flatConfigToColumnState(newItems);
|
|
196
|
+
gridApi.applyColumnState({
|
|
197
|
+
state: columnState,
|
|
198
|
+
applyOrder: true // 强制应用列顺序
|
|
199
|
+
});
|
|
200
|
+
}, [form, gridApi, originalColumnDefs]);
|
|
186
201
|
|
|
187
202
|
/**
|
|
188
203
|
* 关闭弹窗处理 - 取消时恢复原始状态
|
|
189
204
|
* 如果用户取消操作,恢复到打开弹窗前的列定义状态
|
|
190
205
|
*/
|
|
191
206
|
var handleClose = useCallback(function () {
|
|
192
|
-
// 【修复】如果有保存的快照,恢复它
|
|
193
|
-
if (snapshotColumnDefs && type !== 'formArrayTable') {
|
|
194
|
-
gridApi.setGridOption("columnDefs", snapshotColumnDefs);
|
|
195
|
-
}
|
|
196
|
-
|
|
197
207
|
// 清空快照
|
|
198
208
|
setSnapshotColumnDefs(null);
|
|
199
209
|
|
|
200
210
|
// 调用父组件的 onClose
|
|
201
211
|
onClose();
|
|
202
|
-
}, [snapshotColumnDefs, gridApi,
|
|
212
|
+
}, [snapshotColumnDefs, gridApi, onClose]);
|
|
203
213
|
|
|
204
214
|
/**
|
|
205
215
|
* 保存列配置
|
|
206
216
|
* 将扁平化配置转换回 Grid State 并应用到 AG-Grid
|
|
207
217
|
*/
|
|
208
218
|
var handleSaveColumns = useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
209
|
-
var values, flatConfig, configToSave, gridColumnDefs;
|
|
219
|
+
var values, flatConfig, configToSave, gridColumnDefs, columnState;
|
|
210
220
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
211
221
|
while (1) switch (_context2.prev = _context2.next) {
|
|
212
222
|
case 0:
|
|
@@ -225,101 +235,117 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
225
235
|
}
|
|
226
236
|
|
|
227
237
|
// 【修复】转换为 AG-Grid 的列定义,传入原始列定义以保留自定义属性
|
|
228
|
-
gridColumnDefs = flatConfigToGridState(configToSave, originalColumnDefs); //
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
}
|
|
238
|
+
gridColumnDefs = flatConfigToGridState(configToSave, originalColumnDefs); // 【关键修复】先更新 columnDefs(处理分组结构变化)
|
|
239
|
+
console.log('[ColumnSetting] 更新 columnDefs:', gridColumnDefs);
|
|
240
|
+
gridApi.setGridOption('columnDefs', gridColumnDefs);
|
|
232
241
|
|
|
233
|
-
//
|
|
242
|
+
// 等待 columnDefs 更新完成
|
|
243
|
+
_context2.next = 11;
|
|
244
|
+
return new Promise(function (resolve) {
|
|
245
|
+
return setTimeout(resolve, 100);
|
|
246
|
+
});
|
|
247
|
+
case 11:
|
|
248
|
+
// 【修复】然后应用列状态(宽度、隐藏、顺序等)
|
|
249
|
+
columnState = flatConfigToColumnState(configToSave);
|
|
250
|
+
gridApi.applyColumnState({
|
|
251
|
+
state: columnState,
|
|
252
|
+
applyOrder: true // 强制应用列顺序
|
|
253
|
+
});
|
|
234
254
|
|
|
235
255
|
// 等待 Grid 状态更新完成后再保存到方案
|
|
236
256
|
setTimeout( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
237
|
-
var
|
|
257
|
+
var filterModel, defaultScheme, newScheme;
|
|
238
258
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
239
259
|
while (1) switch (_context.prev = _context.next) {
|
|
240
260
|
case 0:
|
|
241
|
-
|
|
242
|
-
_context.next = 25;
|
|
243
|
-
break;
|
|
244
|
-
}
|
|
245
|
-
_context.prev = 1;
|
|
246
|
-
// 从 Grid 获取应用后的最新列状态和过滤器状态
|
|
247
|
-
updatedState = gridApi.getColumnState();
|
|
261
|
+
_context.prev = 0;
|
|
248
262
|
filterModel = gridApi.getFilterModel();
|
|
249
|
-
if (!
|
|
250
|
-
_context.next =
|
|
263
|
+
if (!currentScheme) {
|
|
264
|
+
_context.next = 8;
|
|
251
265
|
break;
|
|
252
266
|
}
|
|
253
|
-
_context.next =
|
|
254
|
-
return
|
|
267
|
+
_context.next = 5;
|
|
268
|
+
return saveColumnScheme === null || saveColumnScheme === void 0 ? void 0 : saveColumnScheme(gridKey, _objectSpread(_objectSpread({}, currentScheme), {}, {
|
|
255
269
|
columnConfig: configToSave,
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
});
|
|
259
|
-
case
|
|
260
|
-
|
|
270
|
+
filterModel: filterModel,
|
|
271
|
+
updatedAt: Date.now()
|
|
272
|
+
}));
|
|
273
|
+
case 5:
|
|
274
|
+
message.success('列配置已保存到方案');
|
|
275
|
+
_context.next = 23;
|
|
261
276
|
break;
|
|
262
|
-
case
|
|
263
|
-
//
|
|
264
|
-
defaultScheme =
|
|
277
|
+
case 8:
|
|
278
|
+
// 如果没有激活的方案,自动创建默认方案
|
|
279
|
+
defaultScheme = schemes.find(function (s) {
|
|
265
280
|
return s.isDefault;
|
|
266
281
|
});
|
|
267
282
|
if (!defaultScheme) {
|
|
268
283
|
_context.next = 17;
|
|
269
284
|
break;
|
|
270
285
|
}
|
|
271
|
-
_context.next =
|
|
272
|
-
return
|
|
273
|
-
case 13:
|
|
274
|
-
_context.next = 15;
|
|
275
|
-
return schemeManager.saveScheme({
|
|
286
|
+
_context.next = 12;
|
|
287
|
+
return saveColumnScheme === null || saveColumnScheme === void 0 ? void 0 : saveColumnScheme(gridKey, _objectSpread(_objectSpread({}, defaultScheme), {}, {
|
|
276
288
|
columnConfig: configToSave,
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
});
|
|
280
|
-
case
|
|
281
|
-
_context.next =
|
|
289
|
+
filterModel: filterModel,
|
|
290
|
+
updatedAt: Date.now()
|
|
291
|
+
}));
|
|
292
|
+
case 12:
|
|
293
|
+
_context.next = 14;
|
|
294
|
+
return setCurrentColumnScheme === null || setCurrentColumnScheme === void 0 ? void 0 : setCurrentColumnScheme(gridKey, defaultScheme.id);
|
|
295
|
+
case 14:
|
|
296
|
+
message.success('列配置已保存到默认方案');
|
|
297
|
+
_context.next = 23;
|
|
282
298
|
break;
|
|
283
299
|
case 17:
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
300
|
+
// 创建新的默认方案并激活
|
|
301
|
+
newScheme = {
|
|
302
|
+
id: uuidv4(),
|
|
303
|
+
name: '默认配置',
|
|
304
|
+
description: '自动创建的默认列配置',
|
|
305
|
+
columnConfig: configToSave,
|
|
290
306
|
filterModel: filterModel,
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
307
|
+
isDefault: true,
|
|
308
|
+
isSystem: false,
|
|
309
|
+
createdAt: Date.now(),
|
|
310
|
+
updatedAt: Date.now()
|
|
311
|
+
};
|
|
312
|
+
_context.next = 20;
|
|
313
|
+
return saveColumnScheme === null || saveColumnScheme === void 0 ? void 0 : saveColumnScheme(gridKey, newScheme);
|
|
295
314
|
case 20:
|
|
296
|
-
_context.next =
|
|
297
|
-
|
|
315
|
+
_context.next = 22;
|
|
316
|
+
return setCurrentColumnScheme === null || setCurrentColumnScheme === void 0 ? void 0 : setCurrentColumnScheme(gridKey, newScheme.id);
|
|
298
317
|
case 22:
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
318
|
+
message.success('已创建并保存到默认方案');
|
|
319
|
+
case 23:
|
|
320
|
+
_context.next = 29;
|
|
321
|
+
break;
|
|
302
322
|
case 25:
|
|
323
|
+
_context.prev = 25;
|
|
324
|
+
_context.t0 = _context["catch"](0);
|
|
325
|
+
console.error('保存列配置到方案失败:', _context.t0);
|
|
326
|
+
message.error('保存列配置失败');
|
|
327
|
+
case 29:
|
|
303
328
|
case "end":
|
|
304
329
|
return _context.stop();
|
|
305
330
|
}
|
|
306
|
-
}, _callee, null, [[
|
|
331
|
+
}, _callee, null, [[0, 25]]);
|
|
307
332
|
})), 50);
|
|
308
333
|
|
|
309
334
|
// 【修复】保存成功后清除快照
|
|
310
335
|
setSnapshotColumnDefs(null);
|
|
311
|
-
|
|
336
|
+
|
|
337
|
+
// message.success 已经在上面的逻辑中处理了
|
|
312
338
|
onClose();
|
|
313
|
-
case
|
|
339
|
+
case 16:
|
|
314
340
|
case "end":
|
|
315
341
|
return _context2.stop();
|
|
316
342
|
}
|
|
317
343
|
}, _callee2);
|
|
318
|
-
})), [form, gridApi, onSaveColumnState,
|
|
344
|
+
})), [form, gridApi, onSaveColumnState, onClose, saveColumnScheme, setCurrentColumnScheme, currentScheme, schemes, gridKey, originalColumnDefs]);
|
|
319
345
|
|
|
320
346
|
// 保存为新方案
|
|
321
347
|
var handleSaveScheme = useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
322
|
-
var columnConfigToSave, values,
|
|
348
|
+
var columnConfigToSave, values, gridColumnDefs, columnState, _values, filterModel, newScheme;
|
|
323
349
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
324
350
|
while (1) switch (_context3.prev = _context3.next) {
|
|
325
351
|
case 0:
|
|
@@ -332,39 +358,58 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
332
358
|
case 3:
|
|
333
359
|
_context3.prev = 3;
|
|
334
360
|
if (!(activeTab === 'columns' && form)) {
|
|
335
|
-
_context3.next =
|
|
361
|
+
_context3.next = 18;
|
|
336
362
|
break;
|
|
337
363
|
}
|
|
338
364
|
values = form.values;
|
|
339
365
|
columnConfigToSave = values.items; // 直接使用 FlatColumnItem[] 数据
|
|
340
366
|
// 【修复】传入原始列定义以保留自定义属性
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
367
|
+
gridColumnDefs = flatConfigToGridState(values.items, originalColumnDefs); // 【关键修复】先更新 columnDefs(处理分组结构变化)
|
|
368
|
+
console.log('[ColumnSetting] 另存为方案 - 更新 columnDefs');
|
|
369
|
+
gridApi.setGridOption('columnDefs', gridColumnDefs);
|
|
370
|
+
|
|
371
|
+
// 等待 columnDefs 更新完成
|
|
372
|
+
_context3.next = 12;
|
|
373
|
+
return new Promise(function (resolve) {
|
|
374
|
+
return setTimeout(resolve, 100);
|
|
375
|
+
});
|
|
376
|
+
case 12:
|
|
377
|
+
// 【修复】然后应用列状态(宽度、隐藏、顺序等)
|
|
378
|
+
columnState = flatConfigToColumnState(values.items);
|
|
379
|
+
gridApi.applyColumnState({
|
|
380
|
+
state: columnState,
|
|
381
|
+
applyOrder: true // 强制应用列顺序
|
|
382
|
+
});
|
|
345
383
|
|
|
346
384
|
// 等待状态更新
|
|
347
|
-
_context3.next =
|
|
385
|
+
_context3.next = 16;
|
|
348
386
|
return new Promise(function (resolve) {
|
|
349
387
|
return setTimeout(resolve, 50);
|
|
350
388
|
});
|
|
351
|
-
case
|
|
352
|
-
_context3.next =
|
|
389
|
+
case 16:
|
|
390
|
+
_context3.next = 20;
|
|
353
391
|
break;
|
|
354
|
-
case
|
|
392
|
+
case 18:
|
|
355
393
|
// 如果在"方案管理"标签页,使用当前表单数据
|
|
356
394
|
_values = form === null || form === void 0 ? void 0 : form.values;
|
|
357
395
|
columnConfigToSave = (_values === null || _values === void 0 ? void 0 : _values.items) || [];
|
|
358
|
-
case
|
|
396
|
+
case 20:
|
|
359
397
|
// 获取过滤器模型
|
|
360
398
|
filterModel = gridApi.getFilterModel();
|
|
361
|
-
|
|
362
|
-
|
|
399
|
+
newScheme = {
|
|
400
|
+
id: uuidv4(),
|
|
401
|
+
name: schemeName.trim(),
|
|
363
402
|
description: schemeDescription.trim() || "\u521B\u5EFA\u4E8E ".concat(new Date().toLocaleString()),
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
403
|
+
columnConfig: columnConfigToSave,
|
|
404
|
+
filterModel: filterModel,
|
|
405
|
+
isDefault: false,
|
|
406
|
+
isSystem: false,
|
|
407
|
+
createdAt: Date.now(),
|
|
408
|
+
updatedAt: Date.now()
|
|
409
|
+
};
|
|
410
|
+
_context3.next = 24;
|
|
411
|
+
return saveColumnScheme === null || saveColumnScheme === void 0 ? void 0 : saveColumnScheme(gridKey, newScheme);
|
|
412
|
+
case 24:
|
|
368
413
|
message.success('方案保存成功');
|
|
369
414
|
setSaveSchemeVisible(false);
|
|
370
415
|
setSchemeName('');
|
|
@@ -372,29 +417,61 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
372
417
|
|
|
373
418
|
// 切换到方案管理标签页,显示新创建的方案
|
|
374
419
|
setActiveTab('schemes');
|
|
375
|
-
_context3.next =
|
|
420
|
+
_context3.next = 34;
|
|
376
421
|
break;
|
|
377
|
-
case
|
|
378
|
-
_context3.prev =
|
|
422
|
+
case 31:
|
|
423
|
+
_context3.prev = 31;
|
|
379
424
|
_context3.t0 = _context3["catch"](3);
|
|
380
425
|
message.error(_context3.t0.message || '保存方案失败');
|
|
381
|
-
case
|
|
426
|
+
case 34:
|
|
382
427
|
case "end":
|
|
383
428
|
return _context3.stop();
|
|
384
429
|
}
|
|
385
|
-
}, _callee3, null, [[3,
|
|
386
|
-
})), [gridApi,
|
|
430
|
+
}, _callee3, null, [[3, 31]]);
|
|
431
|
+
})), [gridApi, saveColumnScheme, gridKey, schemeName, schemeDescription, activeTab, form, originalColumnDefs]);
|
|
387
432
|
|
|
388
433
|
// 加载方案
|
|
389
434
|
var handleLoadScheme = useCallback( /*#__PURE__*/function () {
|
|
390
435
|
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(schemeId) {
|
|
436
|
+
var scheme, gridColumnDefs, columnState;
|
|
391
437
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
392
438
|
while (1) switch (_context4.prev = _context4.next) {
|
|
393
439
|
case 0:
|
|
394
440
|
_context4.prev = 0;
|
|
395
441
|
_context4.next = 3;
|
|
396
|
-
return
|
|
442
|
+
return setCurrentColumnScheme === null || setCurrentColumnScheme === void 0 ? void 0 : setCurrentColumnScheme(gridKey, schemeId);
|
|
397
443
|
case 3:
|
|
444
|
+
// 应用方案到 Grid
|
|
445
|
+
scheme = schemes.find(function (s) {
|
|
446
|
+
return s.id === schemeId;
|
|
447
|
+
});
|
|
448
|
+
if (!(scheme && gridApi)) {
|
|
449
|
+
_context4.next = 13;
|
|
450
|
+
break;
|
|
451
|
+
}
|
|
452
|
+
// 【关键修复】先更新 columnDefs(处理分组结构)
|
|
453
|
+
gridColumnDefs = flatConfigToGridState(scheme.columnConfig, originalColumnDefs);
|
|
454
|
+
console.log('[ColumnSetting] 加载方案 - 更新 columnDefs');
|
|
455
|
+
gridApi.setGridOption('columnDefs', gridColumnDefs);
|
|
456
|
+
|
|
457
|
+
// 等待 columnDefs 更新完成
|
|
458
|
+
_context4.next = 10;
|
|
459
|
+
return new Promise(function (resolve) {
|
|
460
|
+
return setTimeout(resolve, 100);
|
|
461
|
+
});
|
|
462
|
+
case 10:
|
|
463
|
+
// 【修复】然后应用列状态(宽度、隐藏、顺序等)
|
|
464
|
+
columnState = flatConfigToColumnState(scheme.columnConfig);
|
|
465
|
+
gridApi.applyColumnState({
|
|
466
|
+
state: columnState,
|
|
467
|
+
applyOrder: true // 强制应用列顺序
|
|
468
|
+
});
|
|
469
|
+
|
|
470
|
+
// 应用过滤器
|
|
471
|
+
if (scheme.filterModel) {
|
|
472
|
+
gridApi.setFilterModel(scheme.filterModel);
|
|
473
|
+
}
|
|
474
|
+
case 13:
|
|
398
475
|
message.success('方案已加载');
|
|
399
476
|
|
|
400
477
|
// 等待Grid状态更新后再刷新表单
|
|
@@ -409,50 +486,96 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
409
486
|
|
|
410
487
|
// 自动关闭弹窗,让用户看到Grid的变化
|
|
411
488
|
onClose();
|
|
412
|
-
_context4.next =
|
|
489
|
+
_context4.next = 21;
|
|
413
490
|
break;
|
|
414
|
-
case
|
|
415
|
-
_context4.prev =
|
|
491
|
+
case 18:
|
|
492
|
+
_context4.prev = 18;
|
|
416
493
|
_context4.t0 = _context4["catch"](0);
|
|
417
494
|
message.error(_context4.t0.message || '加载方案失败');
|
|
418
|
-
case
|
|
495
|
+
case 21:
|
|
419
496
|
case "end":
|
|
420
497
|
return _context4.stop();
|
|
421
498
|
}
|
|
422
|
-
}, _callee4, null, [[0,
|
|
499
|
+
}, _callee4, null, [[0, 18]]);
|
|
423
500
|
}));
|
|
424
501
|
return function (_x) {
|
|
425
502
|
return _ref5.apply(this, arguments);
|
|
426
503
|
};
|
|
427
|
-
}(), [
|
|
504
|
+
}(), [setCurrentColumnScheme, gridKey, schemes, gridApi, originalColumnDefs, form, getColumnData, onClose]);
|
|
428
505
|
|
|
429
506
|
// 设置默认方案
|
|
430
507
|
var handleSetDefault = useCallback( /*#__PURE__*/function () {
|
|
431
508
|
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(schemeId) {
|
|
509
|
+
var scheme, _iterator, _step, s;
|
|
432
510
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
433
511
|
while (1) switch (_context5.prev = _context5.next) {
|
|
434
512
|
case 0:
|
|
435
513
|
_context5.prev = 0;
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
514
|
+
scheme = schemes.find(function (s) {
|
|
515
|
+
return s.id === schemeId;
|
|
516
|
+
});
|
|
517
|
+
if (!scheme) {
|
|
518
|
+
_context5.next = 24;
|
|
519
|
+
break;
|
|
520
|
+
}
|
|
521
|
+
// 将其他方案设为非默认
|
|
522
|
+
_iterator = _createForOfIteratorHelper(schemes);
|
|
523
|
+
_context5.prev = 4;
|
|
524
|
+
_iterator.s();
|
|
525
|
+
case 6:
|
|
526
|
+
if ((_step = _iterator.n()).done) {
|
|
527
|
+
_context5.next = 13;
|
|
528
|
+
break;
|
|
529
|
+
}
|
|
530
|
+
s = _step.value;
|
|
531
|
+
if (!(s.isDefault && s.id !== schemeId)) {
|
|
532
|
+
_context5.next = 11;
|
|
533
|
+
break;
|
|
534
|
+
}
|
|
535
|
+
_context5.next = 11;
|
|
536
|
+
return saveColumnScheme === null || saveColumnScheme === void 0 ? void 0 : saveColumnScheme(gridKey, _objectSpread(_objectSpread({}, s), {}, {
|
|
537
|
+
isDefault: false,
|
|
538
|
+
updatedAt: Date.now()
|
|
539
|
+
}));
|
|
540
|
+
case 11:
|
|
541
|
+
_context5.next = 6;
|
|
542
|
+
break;
|
|
543
|
+
case 13:
|
|
544
|
+
_context5.next = 18;
|
|
545
|
+
break;
|
|
546
|
+
case 15:
|
|
547
|
+
_context5.prev = 15;
|
|
548
|
+
_context5.t0 = _context5["catch"](4);
|
|
549
|
+
_iterator.e(_context5.t0);
|
|
550
|
+
case 18:
|
|
551
|
+
_context5.prev = 18;
|
|
552
|
+
_iterator.f();
|
|
553
|
+
return _context5.finish(18);
|
|
554
|
+
case 21:
|
|
555
|
+
_context5.next = 23;
|
|
556
|
+
return saveColumnScheme === null || saveColumnScheme === void 0 ? void 0 : saveColumnScheme(gridKey, _objectSpread(_objectSpread({}, scheme), {}, {
|
|
557
|
+
isDefault: true,
|
|
558
|
+
updatedAt: Date.now()
|
|
559
|
+
}));
|
|
560
|
+
case 23:
|
|
439
561
|
message.success('已设置为默认方案');
|
|
440
|
-
|
|
562
|
+
case 24:
|
|
563
|
+
_context5.next = 29;
|
|
441
564
|
break;
|
|
442
|
-
case
|
|
443
|
-
_context5.prev =
|
|
444
|
-
_context5.
|
|
445
|
-
message.error(_context5.
|
|
446
|
-
case
|
|
565
|
+
case 26:
|
|
566
|
+
_context5.prev = 26;
|
|
567
|
+
_context5.t1 = _context5["catch"](0);
|
|
568
|
+
message.error(_context5.t1.message || '设置失败');
|
|
569
|
+
case 29:
|
|
447
570
|
case "end":
|
|
448
571
|
return _context5.stop();
|
|
449
572
|
}
|
|
450
|
-
}, _callee5, null, [[0,
|
|
573
|
+
}, _callee5, null, [[0, 26], [4, 15, 18, 21]]);
|
|
451
574
|
}));
|
|
452
575
|
return function (_x2) {
|
|
453
576
|
return _ref6.apply(this, arguments);
|
|
454
577
|
};
|
|
455
|
-
}(), [
|
|
578
|
+
}(), [schemes, saveColumnScheme, gridKey]);
|
|
456
579
|
|
|
457
580
|
// 删除方案
|
|
458
581
|
var handleDeleteScheme = useCallback( /*#__PURE__*/function () {
|
|
@@ -462,7 +585,7 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
462
585
|
case 0:
|
|
463
586
|
_context6.prev = 0;
|
|
464
587
|
_context6.next = 3;
|
|
465
|
-
return
|
|
588
|
+
return deleteColumnScheme === null || deleteColumnScheme === void 0 ? void 0 : deleteColumnScheme(gridKey, schemeId);
|
|
466
589
|
case 3:
|
|
467
590
|
message.success("\u65B9\u6848\"".concat(schemeName, "\"\u5DF2\u5220\u9664"));
|
|
468
591
|
_context6.next = 9;
|
|
@@ -480,7 +603,7 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
480
603
|
return function (_x3, _x4) {
|
|
481
604
|
return _ref7.apply(this, arguments);
|
|
482
605
|
};
|
|
483
|
-
}(), [
|
|
606
|
+
}(), [deleteColumnScheme, gridKey]);
|
|
484
607
|
|
|
485
608
|
// 编辑方案
|
|
486
609
|
var handleEditScheme = useCallback(function (scheme) {
|
|
@@ -491,6 +614,7 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
491
614
|
|
|
492
615
|
// 保存编辑
|
|
493
616
|
var handleSaveEdit = useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
617
|
+
var scheme;
|
|
494
618
|
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
495
619
|
while (1) switch (_context7.prev = _context7.next) {
|
|
496
620
|
case 0:
|
|
@@ -501,154 +625,187 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
501
625
|
return _context7.abrupt("return");
|
|
502
626
|
case 2:
|
|
503
627
|
_context7.prev = 2;
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
name: editingName.trim(),
|
|
507
|
-
description: editingDescription.trim() || undefined
|
|
628
|
+
scheme = schemes.find(function (s) {
|
|
629
|
+
return s.id === editingId;
|
|
508
630
|
});
|
|
509
|
-
|
|
631
|
+
if (!scheme) {
|
|
632
|
+
_context7.next = 9;
|
|
633
|
+
break;
|
|
634
|
+
}
|
|
635
|
+
_context7.next = 7;
|
|
636
|
+
return saveColumnScheme === null || saveColumnScheme === void 0 ? void 0 : saveColumnScheme(gridKey, _objectSpread(_objectSpread({}, scheme), {}, {
|
|
637
|
+
name: editingName.trim(),
|
|
638
|
+
description: editingDescription.trim() || undefined,
|
|
639
|
+
updatedAt: Date.now()
|
|
640
|
+
}));
|
|
641
|
+
case 7:
|
|
510
642
|
message.success('更新成功');
|
|
511
643
|
setEditingId(null);
|
|
512
|
-
_context7.next = 12;
|
|
513
|
-
break;
|
|
514
644
|
case 9:
|
|
515
|
-
_context7.
|
|
645
|
+
_context7.next = 14;
|
|
646
|
+
break;
|
|
647
|
+
case 11:
|
|
648
|
+
_context7.prev = 11;
|
|
516
649
|
_context7.t0 = _context7["catch"](2);
|
|
517
650
|
message.error(_context7.t0.message || '更新失败');
|
|
518
|
-
case
|
|
651
|
+
case 14:
|
|
519
652
|
case "end":
|
|
520
653
|
return _context7.stop();
|
|
521
654
|
}
|
|
522
|
-
}, _callee7, null, [[2,
|
|
523
|
-
})), [
|
|
655
|
+
}, _callee7, null, [[2, 11]]);
|
|
656
|
+
})), [schemes, saveColumnScheme, gridKey, editingId, editingName, editingDescription]);
|
|
524
657
|
|
|
525
658
|
// 筛选方案列表
|
|
526
659
|
var filteredSchemes = useMemo(function () {
|
|
527
|
-
if (
|
|
660
|
+
if (schemes.length === 0) return [];
|
|
528
661
|
var text = searchText.toLowerCase().trim();
|
|
529
|
-
if (!text) return
|
|
530
|
-
return
|
|
662
|
+
if (!text) return schemes;
|
|
663
|
+
return schemes.filter(function (scheme) {
|
|
531
664
|
return scheme.name.toLowerCase().includes(text) || scheme.description && scheme.description.toLowerCase().includes(text);
|
|
532
665
|
});
|
|
533
|
-
}, [
|
|
534
|
-
|
|
535
|
-
//
|
|
536
|
-
var
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
666
|
+
}, [schemes, searchText]);
|
|
667
|
+
|
|
668
|
+
// AG-Grid 列定义
|
|
669
|
+
var schemeColumnDefs = useMemo(function () {
|
|
670
|
+
return [{
|
|
671
|
+
headerName: '方案名称',
|
|
672
|
+
field: 'name',
|
|
673
|
+
flex: 1,
|
|
674
|
+
minWidth: 200,
|
|
675
|
+
cellRenderer: function cellRenderer(params) {
|
|
676
|
+
var _currentSchemes$gridK2;
|
|
677
|
+
var record = params.data;
|
|
678
|
+
if (!record) return null;
|
|
679
|
+
if (editingId === record.id) {
|
|
680
|
+
return /*#__PURE__*/React.createElement(Input, {
|
|
681
|
+
value: editingName,
|
|
682
|
+
onChange: function onChange(e) {
|
|
683
|
+
return setEditingName(e.target.value);
|
|
684
|
+
},
|
|
685
|
+
onPressEnter: handleSaveEdit,
|
|
686
|
+
size: "small",
|
|
687
|
+
style: {
|
|
688
|
+
width: '100%'
|
|
689
|
+
}
|
|
690
|
+
});
|
|
691
|
+
}
|
|
692
|
+
return /*#__PURE__*/React.createElement(Space, {
|
|
693
|
+
size: "small"
|
|
694
|
+
}, /*#__PURE__*/React.createElement("span", null, record.name), record.isDefault && /*#__PURE__*/React.createElement(Tag, {
|
|
695
|
+
color: "blue"
|
|
696
|
+
}, "\u9ED8\u8BA4"), record.id === (currentSchemes === null || currentSchemes === void 0 || (_currentSchemes$gridK2 = currentSchemes[gridKey]) === null || _currentSchemes$gridK2 === void 0 ? void 0 : _currentSchemes$gridK2.columnSchemeId) && /*#__PURE__*/React.createElement(Tag, {
|
|
697
|
+
color: "green"
|
|
698
|
+
}, "\u5F53\u524D"));
|
|
550
699
|
}
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
700
|
+
}, {
|
|
701
|
+
headerName: '描述',
|
|
702
|
+
field: 'description',
|
|
703
|
+
flex: 1,
|
|
704
|
+
minWidth: 200,
|
|
705
|
+
cellRenderer: function cellRenderer(params) {
|
|
706
|
+
var record = params.data;
|
|
707
|
+
if (!record) return null;
|
|
708
|
+
if (editingId === record.id) {
|
|
709
|
+
return /*#__PURE__*/React.createElement(Input, {
|
|
710
|
+
value: editingDescription,
|
|
711
|
+
onChange: function onChange(e) {
|
|
712
|
+
return setEditingDescription(e.target.value);
|
|
713
|
+
},
|
|
714
|
+
onPressEnter: handleSaveEdit,
|
|
715
|
+
size: "small",
|
|
716
|
+
style: {
|
|
717
|
+
width: '100%'
|
|
718
|
+
}
|
|
719
|
+
});
|
|
720
|
+
}
|
|
721
|
+
return record.description || '-';
|
|
570
722
|
}
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
723
|
+
}, {
|
|
724
|
+
headerName: '更新时间',
|
|
725
|
+
field: 'updatedAt',
|
|
726
|
+
width: 180,
|
|
727
|
+
valueFormatter: function valueFormatter(params) {
|
|
728
|
+
if (!params.value) return '';
|
|
729
|
+
return new Date(params.value).toLocaleString();
|
|
730
|
+
}
|
|
731
|
+
}, {
|
|
732
|
+
headerName: '操作',
|
|
733
|
+
colId: 'actions',
|
|
734
|
+
width: 220,
|
|
735
|
+
cellRenderer: function cellRenderer(params) {
|
|
736
|
+
var record = params.data;
|
|
737
|
+
if (!record) return null;
|
|
738
|
+
if (editingId === record.id) {
|
|
739
|
+
return /*#__PURE__*/React.createElement(Space, {
|
|
740
|
+
size: "small"
|
|
741
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
742
|
+
size: "small",
|
|
743
|
+
type: "link",
|
|
744
|
+
onClick: handleSaveEdit
|
|
745
|
+
}, "\u4FDD\u5B58"), /*#__PURE__*/React.createElement(Button, {
|
|
746
|
+
size: "small",
|
|
747
|
+
type: "link",
|
|
748
|
+
onClick: function onClick() {
|
|
749
|
+
return setEditingId(null);
|
|
750
|
+
}
|
|
751
|
+
}, "\u53D6\u6D88"));
|
|
752
|
+
}
|
|
753
|
+
return /*#__PURE__*/React.createElement(Space, {
|
|
754
|
+
size: "small"
|
|
755
|
+
}, /*#__PURE__*/React.createElement(Tooltip, {
|
|
756
|
+
title: "\u52A0\u8F7D\u65B9\u6848"
|
|
757
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
758
|
+
type: "link",
|
|
588
759
|
size: "small",
|
|
760
|
+
icon: /*#__PURE__*/React.createElement(ReloadOutlined, null),
|
|
761
|
+
onClick: function onClick() {
|
|
762
|
+
return handleLoadScheme(record.id);
|
|
763
|
+
}
|
|
764
|
+
}, "\u52A0\u8F7D")), /*#__PURE__*/React.createElement(Tooltip, {
|
|
765
|
+
title: record.isDefault ? '取消默认' : '设为默认'
|
|
766
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
589
767
|
type: "link",
|
|
590
|
-
onClick: handleSaveEdit
|
|
591
|
-
}, "\u4FDD\u5B58"), /*#__PURE__*/React.createElement(Button, {
|
|
592
768
|
size: "small",
|
|
769
|
+
icon: record.isDefault ? /*#__PURE__*/React.createElement(StarFilled, null) : /*#__PURE__*/React.createElement(StarOutlined, null),
|
|
770
|
+
onClick: function onClick() {
|
|
771
|
+
return handleSetDefault(record.id);
|
|
772
|
+
}
|
|
773
|
+
})), /*#__PURE__*/React.createElement(Tooltip, {
|
|
774
|
+
title: "\u7F16\u8F91"
|
|
775
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
593
776
|
type: "link",
|
|
777
|
+
size: "small",
|
|
778
|
+
icon: /*#__PURE__*/React.createElement(EditOutlined, null),
|
|
594
779
|
onClick: function onClick() {
|
|
595
|
-
return
|
|
780
|
+
return handleEditScheme(record);
|
|
596
781
|
}
|
|
597
|
-
},
|
|
782
|
+
})), /*#__PURE__*/React.createElement(Popconfirm, {
|
|
783
|
+
title: "\u786E\u5B9A\u8981\u5220\u9664\u6B64\u65B9\u6848\u5417?",
|
|
784
|
+
onConfirm: function onConfirm() {
|
|
785
|
+
return handleDeleteScheme(record.id, record.name);
|
|
786
|
+
},
|
|
787
|
+
okText: "\u786E\u5B9A",
|
|
788
|
+
cancelText: "\u53D6\u6D88"
|
|
789
|
+
}, /*#__PURE__*/React.createElement(Tooltip, {
|
|
790
|
+
title: "\u5220\u9664"
|
|
791
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
792
|
+
type: "link",
|
|
793
|
+
size: "small",
|
|
794
|
+
danger: true,
|
|
795
|
+
icon: /*#__PURE__*/React.createElement(DeleteOutlined, null)
|
|
796
|
+
}))));
|
|
598
797
|
}
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
}, /*#__PURE__*/React.createElement(Button, {
|
|
602
|
-
type: "link",
|
|
603
|
-
size: "small",
|
|
604
|
-
icon: /*#__PURE__*/React.createElement(ReloadOutlined, null),
|
|
605
|
-
onClick: function onClick() {
|
|
606
|
-
return handleLoadScheme(record.id);
|
|
607
|
-
}
|
|
608
|
-
}, "\u52A0\u8F7D")), /*#__PURE__*/React.createElement(Tooltip, {
|
|
609
|
-
title: record.isDefault ? '取消默认' : '设为默认'
|
|
610
|
-
}, /*#__PURE__*/React.createElement(Button, {
|
|
611
|
-
type: "link",
|
|
612
|
-
size: "small",
|
|
613
|
-
icon: record.isDefault ? /*#__PURE__*/React.createElement(StarFilled, null) : /*#__PURE__*/React.createElement(StarOutlined, null),
|
|
614
|
-
onClick: function onClick() {
|
|
615
|
-
return handleSetDefault(record.id);
|
|
616
|
-
}
|
|
617
|
-
})), /*#__PURE__*/React.createElement(Tooltip, {
|
|
618
|
-
title: "\u7F16\u8F91"
|
|
619
|
-
}, /*#__PURE__*/React.createElement(Button, {
|
|
620
|
-
type: "link",
|
|
621
|
-
size: "small",
|
|
622
|
-
icon: /*#__PURE__*/React.createElement(EditOutlined, null),
|
|
623
|
-
onClick: function onClick() {
|
|
624
|
-
return handleEditScheme(record);
|
|
625
|
-
}
|
|
626
|
-
})), /*#__PURE__*/React.createElement(Popconfirm, {
|
|
627
|
-
title: "\u786E\u5B9A\u8981\u5220\u9664\u6B64\u65B9\u6848\u5417?",
|
|
628
|
-
onConfirm: function onConfirm() {
|
|
629
|
-
return handleDeleteScheme(record.id, record.name);
|
|
630
|
-
},
|
|
631
|
-
okText: "\u786E\u5B9A",
|
|
632
|
-
cancelText: "\u53D6\u6D88"
|
|
633
|
-
}, /*#__PURE__*/React.createElement(Tooltip, {
|
|
634
|
-
title: "\u5220\u9664"
|
|
635
|
-
}, /*#__PURE__*/React.createElement(Button, {
|
|
636
|
-
type: "link",
|
|
637
|
-
size: "small",
|
|
638
|
-
danger: true,
|
|
639
|
-
icon: /*#__PURE__*/React.createElement(DeleteOutlined, null)
|
|
640
|
-
}))));
|
|
641
|
-
}
|
|
642
|
-
}];
|
|
798
|
+
}];
|
|
799
|
+
}, [editingId, editingName, editingDescription, currentSchemes === null || currentSchemes === void 0 || (_currentSchemes$gridK3 = currentSchemes[gridKey]) === null || _currentSchemes$gridK3 === void 0 ? void 0 : _currentSchemes$gridK3.columnSchemeId, handleSaveEdit, handleLoadScheme, handleSetDefault, handleEditScheme, handleDeleteScheme]);
|
|
643
800
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(DraggableModal, {
|
|
644
|
-
title: /*#__PURE__*/React.createElement("span", null, "\u5217\u65B9\u6848\u7BA1\u7406",
|
|
801
|
+
title: /*#__PURE__*/React.createElement("span", null, "\u5217\u65B9\u6848\u7BA1\u7406", currentScheme && /*#__PURE__*/React.createElement("span", {
|
|
645
802
|
style: {
|
|
646
803
|
marginLeft: 16,
|
|
647
804
|
fontSize: 14,
|
|
648
805
|
fontWeight: 'normal',
|
|
649
806
|
color: '#1890ff'
|
|
650
807
|
}
|
|
651
|
-
}, "- \u5F53\u524D\u65B9\u6848: ",
|
|
808
|
+
}, "- \u5F53\u524D\u65B9\u6848: ", currentScheme.name)),
|
|
652
809
|
open: visible,
|
|
653
810
|
onCancel: handleClose,
|
|
654
811
|
width: 1100,
|
|
@@ -661,7 +818,7 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
661
818
|
onClick: onClose
|
|
662
819
|
}, "\u53D6\u6D88"), /*#__PURE__*/React.createElement(Button, {
|
|
663
820
|
onClick: handleSaveColumns
|
|
664
|
-
}, "\u4FDD\u5B58\u914D\u7F6E"),
|
|
821
|
+
}, "\u4FDD\u5B58\u914D\u7F6E"), /*#__PURE__*/React.createElement(Button, {
|
|
665
822
|
type: "primary",
|
|
666
823
|
icon: /*#__PURE__*/React.createElement(SaveOutlined, null),
|
|
667
824
|
onClick: function onClick() {
|
|
@@ -680,16 +837,13 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
680
837
|
}, /*#__PURE__*/React.createElement(ColumnConfigTable, {
|
|
681
838
|
items: form.values.items || [],
|
|
682
839
|
onChange: handleColumnChange,
|
|
683
|
-
simple:
|
|
684
|
-
})),
|
|
840
|
+
simple: false
|
|
841
|
+
})), /*#__PURE__*/React.createElement(TabPane, {
|
|
685
842
|
tab: "\u65B9\u6848\u7BA1\u7406",
|
|
686
843
|
key: "schemes"
|
|
687
844
|
}, /*#__PURE__*/React.createElement("div", {
|
|
688
845
|
style: {
|
|
689
|
-
marginBottom: 16
|
|
690
|
-
display: 'flex',
|
|
691
|
-
justifyContent: 'space-between',
|
|
692
|
-
alignItems: 'center'
|
|
846
|
+
marginBottom: 16
|
|
693
847
|
}
|
|
694
848
|
}, /*#__PURE__*/React.createElement(Input, {
|
|
695
849
|
placeholder: "\u641C\u7D22\u65B9\u6848\u540D\u79F0\u6216\u63CF\u8FF0...",
|
|
@@ -702,169 +856,32 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
702
856
|
width: 300
|
|
703
857
|
},
|
|
704
858
|
allowClear: true
|
|
705
|
-
}), /*#__PURE__*/React.createElement(
|
|
706
|
-
value: viewMode,
|
|
707
|
-
onChange: function onChange(e) {
|
|
708
|
-
return setViewMode(e.target.value);
|
|
709
|
-
},
|
|
710
|
-
buttonStyle: "solid"
|
|
711
|
-
}, /*#__PURE__*/React.createElement(Radio.Button, {
|
|
712
|
-
value: "grid"
|
|
713
|
-
}, /*#__PURE__*/React.createElement(AppstoreOutlined, null), " \u7F51\u683C"), /*#__PURE__*/React.createElement(Radio.Button, {
|
|
714
|
-
value: "list"
|
|
715
|
-
}, /*#__PURE__*/React.createElement(UnorderedListOutlined, null), " \u5217\u8868"))), viewMode === 'grid' && /*#__PURE__*/React.createElement("div", {
|
|
859
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
716
860
|
style: {
|
|
717
|
-
|
|
718
|
-
|
|
861
|
+
height: 400,
|
|
862
|
+
width: '100%'
|
|
719
863
|
}
|
|
720
864
|
}, filteredSchemes.length === 0 ? /*#__PURE__*/React.createElement(Empty, {
|
|
721
|
-
description: "\u6682\u65E0\u65B9\u6848,\u8BF7\u5148\u4FDD\u5B58\u4E00\u4E2A\u65B9\u6848"
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
borderColor: scheme.id === ((_schemeManager$curren3 = schemeManager.currentScheme) === null || _schemeManager$curren3 === void 0 ? void 0 : _schemeManager$curren3.id) ? '#1890ff' : undefined,
|
|
734
|
-
borderWidth: scheme.id === ((_schemeManager$curren4 = schemeManager.currentScheme) === null || _schemeManager$curren4 === void 0 ? void 0 : _schemeManager$curren4.id) ? 2 : 1
|
|
735
|
-
},
|
|
736
|
-
actions: [/*#__PURE__*/React.createElement(Tooltip, {
|
|
737
|
-
title: "\u52A0\u8F7D\u65B9\u6848"
|
|
738
|
-
}, /*#__PURE__*/React.createElement(ReloadOutlined, {
|
|
739
|
-
key: "load",
|
|
740
|
-
onClick: function onClick() {
|
|
741
|
-
return handleLoadScheme(scheme.id);
|
|
742
|
-
},
|
|
743
|
-
style: {
|
|
744
|
-
fontSize: 16
|
|
745
|
-
}
|
|
746
|
-
})), /*#__PURE__*/React.createElement(Tooltip, {
|
|
747
|
-
title: scheme.isDefault ? '取消默认' : '设为默认'
|
|
748
|
-
}, scheme.isDefault ? /*#__PURE__*/React.createElement(StarFilled, {
|
|
749
|
-
key: "default",
|
|
750
|
-
onClick: function onClick() {
|
|
751
|
-
return handleSetDefault(scheme.id);
|
|
752
|
-
},
|
|
753
|
-
style: {
|
|
754
|
-
fontSize: 16,
|
|
755
|
-
color: '#faad14'
|
|
756
|
-
}
|
|
757
|
-
}) : /*#__PURE__*/React.createElement(StarOutlined, {
|
|
758
|
-
key: "default",
|
|
759
|
-
onClick: function onClick() {
|
|
760
|
-
return handleSetDefault(scheme.id);
|
|
761
|
-
},
|
|
762
|
-
style: {
|
|
763
|
-
fontSize: 16
|
|
764
|
-
}
|
|
765
|
-
})), /*#__PURE__*/React.createElement(Tooltip, {
|
|
766
|
-
title: "\u7F16\u8F91"
|
|
767
|
-
}, /*#__PURE__*/React.createElement(EditOutlined, {
|
|
768
|
-
key: "edit",
|
|
769
|
-
onClick: function onClick() {
|
|
770
|
-
return handleEditScheme(scheme);
|
|
771
|
-
},
|
|
772
|
-
style: {
|
|
773
|
-
fontSize: 16
|
|
774
|
-
}
|
|
775
|
-
})), /*#__PURE__*/React.createElement(Popconfirm, {
|
|
776
|
-
title: "\u786E\u5B9A\u8981\u5220\u9664\u6B64\u65B9\u6848\u5417?",
|
|
777
|
-
onConfirm: function onConfirm() {
|
|
778
|
-
return handleDeleteScheme(scheme.id, scheme.name);
|
|
779
|
-
},
|
|
780
|
-
okText: "\u786E\u5B9A",
|
|
781
|
-
cancelText: "\u53D6\u6D88"
|
|
782
|
-
}, /*#__PURE__*/React.createElement(Tooltip, {
|
|
783
|
-
title: "\u5220\u9664"
|
|
784
|
-
}, /*#__PURE__*/React.createElement(DeleteOutlined, {
|
|
785
|
-
key: "delete",
|
|
786
|
-
style: {
|
|
787
|
-
fontSize: 16,
|
|
788
|
-
color: '#ff4d4f'
|
|
789
|
-
}
|
|
790
|
-
})))]
|
|
791
|
-
}, editingId === scheme.id ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
792
|
-
style: {
|
|
793
|
-
marginBottom: 8
|
|
794
|
-
}
|
|
795
|
-
}, /*#__PURE__*/React.createElement(Input, {
|
|
796
|
-
value: editingName,
|
|
797
|
-
onChange: function onChange(e) {
|
|
798
|
-
return setEditingName(e.target.value);
|
|
799
|
-
},
|
|
800
|
-
onPressEnter: handleSaveEdit,
|
|
801
|
-
placeholder: "\u65B9\u6848\u540D\u79F0"
|
|
802
|
-
})), /*#__PURE__*/React.createElement("div", {
|
|
803
|
-
style: {
|
|
804
|
-
marginBottom: 8
|
|
805
|
-
}
|
|
806
|
-
}, /*#__PURE__*/React.createElement(Input.TextArea, {
|
|
807
|
-
value: editingDescription,
|
|
808
|
-
onChange: function onChange(e) {
|
|
809
|
-
return setEditingDescription(e.target.value);
|
|
810
|
-
},
|
|
811
|
-
placeholder: "\u65B9\u6848\u63CF\u8FF0",
|
|
812
|
-
rows: 2
|
|
813
|
-
})), /*#__PURE__*/React.createElement(Space, null, /*#__PURE__*/React.createElement(Button, {
|
|
814
|
-
size: "small",
|
|
815
|
-
type: "primary",
|
|
816
|
-
onClick: handleSaveEdit
|
|
817
|
-
}, "\u4FDD\u5B58"), /*#__PURE__*/React.createElement(Button, {
|
|
818
|
-
size: "small",
|
|
819
|
-
onClick: function onClick() {
|
|
820
|
-
return setEditingId(null);
|
|
821
|
-
}
|
|
822
|
-
}, "\u53D6\u6D88"))) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Card.Meta, {
|
|
823
|
-
title: /*#__PURE__*/React.createElement("div", {
|
|
824
|
-
style: {
|
|
825
|
-
display: 'flex',
|
|
826
|
-
alignItems: 'center',
|
|
827
|
-
gap: 8
|
|
828
|
-
}
|
|
829
|
-
}, /*#__PURE__*/React.createElement("span", {
|
|
830
|
-
style: {
|
|
831
|
-
fontWeight: 600
|
|
832
|
-
}
|
|
833
|
-
}, scheme.name), scheme.isDefault && /*#__PURE__*/React.createElement(Tag, {
|
|
834
|
-
color: "blue"
|
|
835
|
-
}, "\u9ED8\u8BA4"), scheme.id === ((_schemeManager$curren5 = schemeManager.currentScheme) === null || _schemeManager$curren5 === void 0 ? void 0 : _schemeManager$curren5.id) && /*#__PURE__*/React.createElement(Tag, {
|
|
836
|
-
color: "green"
|
|
837
|
-
}, "\u5F53\u524D")),
|
|
838
|
-
description: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
839
|
-
style: {
|
|
840
|
-
fontSize: 12,
|
|
841
|
-
color: '#666',
|
|
842
|
-
marginBottom: 8,
|
|
843
|
-
overflow: 'hidden',
|
|
844
|
-
textOverflow: 'ellipsis',
|
|
845
|
-
display: '-webkit-box',
|
|
846
|
-
WebkitLineClamp: 2,
|
|
847
|
-
WebkitBoxOrient: 'vertical'
|
|
848
|
-
}
|
|
849
|
-
}, scheme.description || '暂无描述'), /*#__PURE__*/React.createElement("div", {
|
|
850
|
-
style: {
|
|
851
|
-
fontSize: 12,
|
|
852
|
-
color: '#999'
|
|
853
|
-
}
|
|
854
|
-
}, "\u66F4\u65B0\u4E8E ", new Date(scheme.updatedAt).toLocaleString()))
|
|
855
|
-
}))));
|
|
856
|
-
}))), viewMode === 'list' && /*#__PURE__*/React.createElement(Table, {
|
|
857
|
-
dataSource: filteredSchemes,
|
|
858
|
-
columns: schemeColumns,
|
|
859
|
-
rowKey: "id",
|
|
860
|
-
pagination: false,
|
|
861
|
-
scroll: {
|
|
862
|
-
y: 400
|
|
865
|
+
description: "\u6682\u65E0\u65B9\u6848,\u8BF7\u5148\u4FDD\u5B58\u4E00\u4E2A\u65B9\u6848",
|
|
866
|
+
style: {
|
|
867
|
+
marginTop: 100
|
|
868
|
+
}
|
|
869
|
+
}) : /*#__PURE__*/React.createElement(AgGridReact, {
|
|
870
|
+
theme: agGridTheme,
|
|
871
|
+
localeText: localeText,
|
|
872
|
+
rowData: filteredSchemes,
|
|
873
|
+
columnDefs: schemeColumnDefs,
|
|
874
|
+
defaultColDef: {
|
|
875
|
+
sortable: true,
|
|
876
|
+
resizable: true
|
|
863
877
|
},
|
|
864
|
-
|
|
865
|
-
|
|
878
|
+
rowSelection: "single",
|
|
879
|
+
animateRows: true,
|
|
880
|
+
suppressCellFocus: true,
|
|
881
|
+
getRowId: function getRowId(params) {
|
|
882
|
+
return params.data.id;
|
|
866
883
|
}
|
|
867
|
-
})))), /*#__PURE__*/React.createElement(Modal, {
|
|
884
|
+
}))))), /*#__PURE__*/React.createElement(Modal, {
|
|
868
885
|
title: "\u4FDD\u5B58\u4E3A\u65B0\u65B9\u6848",
|
|
869
886
|
open: saveSchemeVisible,
|
|
870
887
|
onOk: handleSaveScheme,
|
|
@@ -874,7 +891,8 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
874
891
|
setSchemeDescription('');
|
|
875
892
|
},
|
|
876
893
|
okText: "\u4FDD\u5B58",
|
|
877
|
-
cancelText: "\u53D6\u6D88"
|
|
894
|
+
cancelText: "\u53D6\u6D88",
|
|
895
|
+
destroyOnClose: true
|
|
878
896
|
}, /*#__PURE__*/React.createElement("div", {
|
|
879
897
|
style: {
|
|
880
898
|
marginBottom: 16
|