@nokecy/qc-ui 1.0.94 → 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 +252 -173
- package/dist/cjs/ag-grid-plus/context/gridContext.d.ts +77 -19
- 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 -2
- package/dist/cjs/ag-grid-plus/index.js +11 -93
- 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 +279 -145
- 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} +193 -108
- 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/{schemes → shared}/storage/localStorageAdapter.js +253 -271
- package/dist/cjs/ag-grid-plus/shared/storage/schemeStorageAdapter.d.ts +132 -0
- package/dist/cjs/array-table/index.js +167 -45
- package/dist/cjs/index.d.ts +3 -3
- package/dist/cjs/index.js +14 -86
- package/dist/esm/ag-grid-plus/ag-gridPlus.js +252 -173
- package/dist/esm/ag-grid-plus/context/gridContext.d.ts +77 -19
- 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/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 -2
- package/dist/esm/ag-grid-plus/index.js +9 -5
- 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 +281 -147
- 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} +192 -107
- 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/{schemes → shared}/storage/localStorageAdapter.js +252 -271
- package/dist/esm/ag-grid-plus/shared/storage/schemeStorageAdapter.d.ts +132 -0
- package/dist/esm/array-table/index.js +168 -46
- package/dist/esm/index.d.ts +3 -3
- package/dist/esm/index.js +11 -11
- package/dist/esm/standardFormDialog/useStandardFormSchema.d.ts +1 -1
- 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 -145
- 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 -23
- package/dist/cjs/ag-grid-plus/schemes/index.js +0 -164
- package/dist/cjs/ag-grid-plus/schemes/storage/configMerger.d.ts +0 -10
- package/dist/cjs/ag-grid-plus/schemes/storage/configMerger.js +0 -34
- package/dist/cjs/ag-grid-plus/schemes/storage/localStorageAdapter.d.ts +0 -79
- package/dist/cjs/ag-grid-plus/schemes/storage/priorityStorageAdapter.d.ts +0 -122
- package/dist/cjs/ag-grid-plus/schemes/storage/priorityStorageAdapter.js +0 -476
- package/dist/cjs/ag-grid-plus/schemes/storage/remoteStorageAdapter.d.ts +0 -139
- package/dist/cjs/ag-grid-plus/schemes/storage/remoteStorageAdapter.js +0 -746
- package/dist/cjs/ag-grid-plus/schemes/storage/useRemoteStorage.d.ts +0 -29
- package/dist/cjs/ag-grid-plus/schemes/storage/useRemoteStorage.js +0 -45
- 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/index.d.ts +0 -13
- package/dist/cjs/ag-grid-plus/storage/index.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 -145
- 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 -23
- package/dist/esm/ag-grid-plus/schemes/index.js +0 -30
- package/dist/esm/ag-grid-plus/schemes/storage/configMerger.d.ts +0 -10
- package/dist/esm/ag-grid-plus/schemes/storage/configMerger.js +0 -28
- package/dist/esm/ag-grid-plus/schemes/storage/localStorageAdapter.d.ts +0 -79
- package/dist/esm/ag-grid-plus/schemes/storage/priorityStorageAdapter.d.ts +0 -122
- package/dist/esm/ag-grid-plus/schemes/storage/priorityStorageAdapter.js +0 -471
- package/dist/esm/ag-grid-plus/schemes/storage/remoteStorageAdapter.d.ts +0 -139
- package/dist/esm/ag-grid-plus/schemes/storage/remoteStorageAdapter.js +0 -746
- package/dist/esm/ag-grid-plus/schemes/storage/useRemoteStorage.d.ts +0 -29
- package/dist/esm/ag-grid-plus/schemes/storage/useRemoteStorage.js +0 -40
- 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/index.d.ts +0 -13
- package/dist/esm/ag-grid-plus/storage/index.js +0 -17
- /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,32 +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 React, { useState, useCallback, useMemo, useEffect } from 'react';
|
|
17
18
|
import { Modal, Tabs, Space, Button, Input, message, Popconfirm, Tag, Tooltip, Empty } from 'antd';
|
|
18
19
|
import { SaveOutlined, ReloadOutlined, EditOutlined, DeleteOutlined, StarOutlined, StarFilled, SearchOutlined } from '@ant-design/icons';
|
|
19
20
|
import { AgGridReact } from 'ag-grid-react';
|
|
20
21
|
import { agGridTheme } from "../theme";
|
|
21
22
|
import { localeText } from "../locale";
|
|
22
23
|
import { createForm, onFormInit } from '@formily/core';
|
|
23
|
-
import { gridStateToFlatConfig, flatConfigToGridState, isOldSchemeData, migrateOldScheme } from "./columnGroupUtils";
|
|
24
|
+
import { gridStateToFlatConfig, flatConfigToGridState, flatConfigToColumnState, isOldSchemeData, migrateOldScheme } from "./columnGroupUtils";
|
|
24
25
|
import ColumnConfigTable from "./ColumnConfigTable";
|
|
25
|
-
import processColumnGroups from "../_utils/processColumnGroups";
|
|
26
26
|
import DraggableModal from "../../draggableModal";
|
|
27
|
-
import {
|
|
27
|
+
import { useGridSchemes } from "../context/useSchemeManager";
|
|
28
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
28
29
|
var TabPane = Tabs.TabPane;
|
|
29
30
|
var TextArea = Input.TextArea;
|
|
30
31
|
/**
|
|
31
32
|
* 列方案管理组件 - 集成列配置和列方案管理
|
|
32
33
|
*/
|
|
33
34
|
var ColumnSetting = function ColumnSetting(_ref) {
|
|
34
|
-
var
|
|
35
|
+
var _currentSchemes$gridK3;
|
|
35
36
|
var gridKey = _ref.gridKey,
|
|
36
37
|
gridApi = _ref.gridApi,
|
|
37
38
|
visible = _ref.visible,
|
|
38
39
|
onClose = _ref.onClose,
|
|
39
|
-
onSaveColumnState = _ref.onSaveColumnState
|
|
40
|
-
|
|
41
|
-
|
|
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
|
+
});
|
|
42
56
|
var _useState = useState('columns'),
|
|
43
57
|
_useState2 = _slicedToArray(_useState, 2),
|
|
44
58
|
activeTab = _useState2[0],
|
|
@@ -77,8 +91,7 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
77
91
|
setSearchText = _useState16[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
97
|
var _useState17 = useState(null),
|
|
@@ -91,10 +104,9 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
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,36 +625,45 @@ 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
|
-
}, [
|
|
666
|
+
}, [schemes, searchText]);
|
|
534
667
|
|
|
535
668
|
// AG-Grid 列定义
|
|
536
669
|
var schemeColumnDefs = useMemo(function () {
|
|
@@ -540,7 +673,7 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
540
673
|
flex: 1,
|
|
541
674
|
minWidth: 200,
|
|
542
675
|
cellRenderer: function cellRenderer(params) {
|
|
543
|
-
var
|
|
676
|
+
var _currentSchemes$gridK2;
|
|
544
677
|
var record = params.data;
|
|
545
678
|
if (!record) return null;
|
|
546
679
|
if (editingId === record.id) {
|
|
@@ -560,7 +693,7 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
560
693
|
size: "small"
|
|
561
694
|
}, /*#__PURE__*/React.createElement("span", null, record.name), record.isDefault && /*#__PURE__*/React.createElement(Tag, {
|
|
562
695
|
color: "blue"
|
|
563
|
-
}, "\u9ED8\u8BA4"), record.id === (
|
|
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, {
|
|
564
697
|
color: "green"
|
|
565
698
|
}, "\u5F53\u524D"));
|
|
566
699
|
}
|
|
@@ -663,16 +796,16 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
663
796
|
}))));
|
|
664
797
|
}
|
|
665
798
|
}];
|
|
666
|
-
}, [editingId, editingName, editingDescription,
|
|
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]);
|
|
667
800
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(DraggableModal, {
|
|
668
|
-
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", {
|
|
669
802
|
style: {
|
|
670
803
|
marginLeft: 16,
|
|
671
804
|
fontSize: 14,
|
|
672
805
|
fontWeight: 'normal',
|
|
673
806
|
color: '#1890ff'
|
|
674
807
|
}
|
|
675
|
-
}, "- \u5F53\u524D\u65B9\u6848: ",
|
|
808
|
+
}, "- \u5F53\u524D\u65B9\u6848: ", currentScheme.name)),
|
|
676
809
|
open: visible,
|
|
677
810
|
onCancel: handleClose,
|
|
678
811
|
width: 1100,
|
|
@@ -685,7 +818,7 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
685
818
|
onClick: onClose
|
|
686
819
|
}, "\u53D6\u6D88"), /*#__PURE__*/React.createElement(Button, {
|
|
687
820
|
onClick: handleSaveColumns
|
|
688
|
-
}, "\u4FDD\u5B58\u914D\u7F6E"),
|
|
821
|
+
}, "\u4FDD\u5B58\u914D\u7F6E"), /*#__PURE__*/React.createElement(Button, {
|
|
689
822
|
type: "primary",
|
|
690
823
|
icon: /*#__PURE__*/React.createElement(SaveOutlined, null),
|
|
691
824
|
onClick: function onClick() {
|
|
@@ -704,8 +837,8 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
704
837
|
}, /*#__PURE__*/React.createElement(ColumnConfigTable, {
|
|
705
838
|
items: form.values.items || [],
|
|
706
839
|
onChange: handleColumnChange,
|
|
707
|
-
simple:
|
|
708
|
-
})),
|
|
840
|
+
simple: false
|
|
841
|
+
})), /*#__PURE__*/React.createElement(TabPane, {
|
|
709
842
|
tab: "\u65B9\u6848\u7BA1\u7406",
|
|
710
843
|
key: "schemes"
|
|
711
844
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -758,7 +891,8 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
758
891
|
setSchemeDescription('');
|
|
759
892
|
},
|
|
760
893
|
okText: "\u4FDD\u5B58",
|
|
761
|
-
cancelText: "\u53D6\u6D88"
|
|
894
|
+
cancelText: "\u53D6\u6D88",
|
|
895
|
+
destroyOnClose: true
|
|
762
896
|
}, /*#__PURE__*/React.createElement("div", {
|
|
763
897
|
style: {
|
|
764
898
|
marginBottom: 16
|