@nokecy/qc-ui 1.0.94 → 1.0.96
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 +108 -20
- package/dist/cjs/ag-grid-plus/context/gridContext.js +12 -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 +111 -0
- package/dist/cjs/ag-grid-plus/context/useSchemeManager.js +596 -0
- 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 +108 -20
- package/dist/esm/ag-grid-plus/context/gridContext.js +13 -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 +111 -0
- package/dist/esm/ag-grid-plus/context/useSchemeManager.js +590 -0
- 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/hooks/useQuerySchemes.js +0 -564
- 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/hooks/useQuerySchemes.js +0 -559
- 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
|
@@ -14,12 +14,13 @@ var _locale = require("../locale");
|
|
|
14
14
|
var _core = require("@formily/core");
|
|
15
15
|
var _columnGroupUtils = require("./columnGroupUtils");
|
|
16
16
|
var _ColumnConfigTable = _interopRequireDefault(require("./ColumnConfigTable"));
|
|
17
|
-
var _processColumnGroups = _interopRequireDefault(require("../_utils/processColumnGroups"));
|
|
18
17
|
var _draggableModal = _interopRequireDefault(require("../../draggableModal"));
|
|
19
|
-
var
|
|
18
|
+
var _useSchemeManager = require("../context/useSchemeManager");
|
|
19
|
+
var _uuid = require("uuid");
|
|
20
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
21
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
22
22
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
23
|
+
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; } } }; }
|
|
23
24
|
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; }
|
|
24
25
|
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); } }
|
|
25
26
|
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); }); }; }
|
|
@@ -40,14 +41,27 @@ var TextArea = _antd.Input.TextArea;
|
|
|
40
41
|
* 列方案管理组件 - 集成列配置和列方案管理
|
|
41
42
|
*/
|
|
42
43
|
var ColumnSetting = function ColumnSetting(_ref) {
|
|
43
|
-
var
|
|
44
|
+
var _currentSchemes$gridK3;
|
|
44
45
|
var gridKey = _ref.gridKey,
|
|
45
46
|
gridApi = _ref.gridApi,
|
|
46
47
|
visible = _ref.visible,
|
|
47
48
|
onClose = _ref.onClose,
|
|
48
|
-
onSaveColumnState = _ref.onSaveColumnState
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
onSaveColumnState = _ref.onSaveColumnState;
|
|
50
|
+
// 使用新的集中式方案管理 API(包含状态数据和操作方法)
|
|
51
|
+
var _useGridSchemes = (0, _useSchemeManager.useGridSchemes)(),
|
|
52
|
+
columnSchemes = _useGridSchemes.columnSchemes,
|
|
53
|
+
currentSchemes = _useGridSchemes.currentSchemes,
|
|
54
|
+
allColDefs = _useGridSchemes.allColDefs,
|
|
55
|
+
saveColumnScheme = _useGridSchemes.saveColumnScheme,
|
|
56
|
+
deleteColumnScheme = _useGridSchemes.deleteColumnScheme,
|
|
57
|
+
setCurrentColumnScheme = _useGridSchemes.setCurrentColumnScheme;
|
|
58
|
+
|
|
59
|
+
// 获取当前表格的方案列表
|
|
60
|
+
var schemes = (columnSchemes === null || columnSchemes === void 0 ? void 0 : columnSchemes[gridKey]) || [];
|
|
61
|
+
var currentScheme = schemes.find(function (s) {
|
|
62
|
+
var _currentSchemes$gridK;
|
|
63
|
+
return s.id === (currentSchemes === null || currentSchemes === void 0 || (_currentSchemes$gridK = currentSchemes[gridKey]) === null || _currentSchemes$gridK === void 0 ? void 0 : _currentSchemes$gridK.columnSchemeId);
|
|
64
|
+
});
|
|
51
65
|
var _useState = (0, _react.useState)('columns'),
|
|
52
66
|
_useState2 = _slicedToArray(_useState, 2),
|
|
53
67
|
activeTab = _useState2[0],
|
|
@@ -86,8 +100,7 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
86
100
|
setSearchText = _useState16[1];
|
|
87
101
|
|
|
88
102
|
// 【修复】从 Context 获取原始完整的列定义
|
|
89
|
-
var
|
|
90
|
-
var originalColumnDefs = (gridPlusContext === null || gridPlusContext === void 0 ? void 0 : gridPlusContext.allColDefs) || undefined;
|
|
103
|
+
var originalColumnDefs = allColDefs || undefined;
|
|
91
104
|
|
|
92
105
|
// 【修复】保存快照用于取消时恢复(改名避免与Context的originalColumnDefs冲突)
|
|
93
106
|
var _useState17 = (0, _react.useState)(null),
|
|
@@ -100,10 +113,9 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
100
113
|
* 新版本使用树形结构,兼容旧版本的 groupName 结构
|
|
101
114
|
*/
|
|
102
115
|
var getColumnData = (0, _react.useCallback)(function () {
|
|
103
|
-
var _schemeManager$curren;
|
|
104
116
|
// 优先使用当前方案中保存的完整列配置(包含分组结构)
|
|
105
|
-
if (
|
|
106
|
-
return
|
|
117
|
+
if (currentScheme !== null && currentScheme !== void 0 && currentScheme.columnConfig) {
|
|
118
|
+
return currentScheme.columnConfig;
|
|
107
119
|
}
|
|
108
120
|
|
|
109
121
|
// 如果方案中没有 columnConfig,则从 Grid 读取
|
|
@@ -143,7 +155,7 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
143
155
|
return item;
|
|
144
156
|
});
|
|
145
157
|
return flatConfig;
|
|
146
|
-
}, [gridApi,
|
|
158
|
+
}, [gridApi, currentScheme]);
|
|
147
159
|
|
|
148
160
|
// 创建 Formily Form 实例
|
|
149
161
|
var form = (0, _react.useMemo)(function () {
|
|
@@ -164,7 +176,7 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
164
176
|
items: newData
|
|
165
177
|
});
|
|
166
178
|
}
|
|
167
|
-
}, [
|
|
179
|
+
}, [currentScheme, visible, form, getColumnData]);
|
|
168
180
|
|
|
169
181
|
// 【修复】弹窗打开时保存快照,用于取消时恢复
|
|
170
182
|
(0, _react.useEffect)(function () {
|
|
@@ -188,34 +200,32 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
188
200
|
var gridColumnDefs = (0, _columnGroupUtils.flatConfigToGridState)(newItems, originalColumnDefs);
|
|
189
201
|
|
|
190
202
|
// 3. 立即应用到 Grid(实时预览,不保存到方案)
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
203
|
+
// 【修复】同时应用列顺序和状态,确保拖拽排序能够生效
|
|
204
|
+
var columnState = (0, _columnGroupUtils.flatConfigToColumnState)(newItems);
|
|
205
|
+
gridApi.applyColumnState({
|
|
206
|
+
state: columnState,
|
|
207
|
+
applyOrder: true // 强制应用列顺序
|
|
208
|
+
});
|
|
209
|
+
}, [form, gridApi, originalColumnDefs]);
|
|
195
210
|
|
|
196
211
|
/**
|
|
197
212
|
* 关闭弹窗处理 - 取消时恢复原始状态
|
|
198
213
|
* 如果用户取消操作,恢复到打开弹窗前的列定义状态
|
|
199
214
|
*/
|
|
200
215
|
var handleClose = (0, _react.useCallback)(function () {
|
|
201
|
-
// 【修复】如果有保存的快照,恢复它
|
|
202
|
-
if (snapshotColumnDefs && type !== 'formArrayTable') {
|
|
203
|
-
gridApi.setGridOption("columnDefs", snapshotColumnDefs);
|
|
204
|
-
}
|
|
205
|
-
|
|
206
216
|
// 清空快照
|
|
207
217
|
setSnapshotColumnDefs(null);
|
|
208
218
|
|
|
209
219
|
// 调用父组件的 onClose
|
|
210
220
|
onClose();
|
|
211
|
-
}, [snapshotColumnDefs, gridApi,
|
|
221
|
+
}, [snapshotColumnDefs, gridApi, onClose]);
|
|
212
222
|
|
|
213
223
|
/**
|
|
214
224
|
* 保存列配置
|
|
215
225
|
* 将扁平化配置转换回 Grid State 并应用到 AG-Grid
|
|
216
226
|
*/
|
|
217
227
|
var handleSaveColumns = (0, _react.useCallback)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
218
|
-
var values, flatConfig, configToSave, gridColumnDefs;
|
|
228
|
+
var values, flatConfig, configToSave, gridColumnDefs, columnState;
|
|
219
229
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
220
230
|
while (1) switch (_context2.prev = _context2.next) {
|
|
221
231
|
case 0:
|
|
@@ -234,101 +244,117 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
234
244
|
}
|
|
235
245
|
|
|
236
246
|
// 【修复】转换为 AG-Grid 的列定义,传入原始列定义以保留自定义属性
|
|
237
|
-
gridColumnDefs = (0, _columnGroupUtils.flatConfigToGridState)(configToSave, originalColumnDefs); //
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
}
|
|
247
|
+
gridColumnDefs = (0, _columnGroupUtils.flatConfigToGridState)(configToSave, originalColumnDefs); // 【关键修复】先更新 columnDefs(处理分组结构变化)
|
|
248
|
+
console.log('[ColumnSetting] 更新 columnDefs:', gridColumnDefs);
|
|
249
|
+
gridApi.setGridOption('columnDefs', gridColumnDefs);
|
|
241
250
|
|
|
242
|
-
//
|
|
251
|
+
// 等待 columnDefs 更新完成
|
|
252
|
+
_context2.next = 11;
|
|
253
|
+
return new Promise(function (resolve) {
|
|
254
|
+
return setTimeout(resolve, 100);
|
|
255
|
+
});
|
|
256
|
+
case 11:
|
|
257
|
+
// 【修复】然后应用列状态(宽度、隐藏、顺序等)
|
|
258
|
+
columnState = (0, _columnGroupUtils.flatConfigToColumnState)(configToSave);
|
|
259
|
+
gridApi.applyColumnState({
|
|
260
|
+
state: columnState,
|
|
261
|
+
applyOrder: true // 强制应用列顺序
|
|
262
|
+
});
|
|
243
263
|
|
|
244
264
|
// 等待 Grid 状态更新完成后再保存到方案
|
|
245
265
|
setTimeout( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
246
|
-
var
|
|
266
|
+
var filterModel, defaultScheme, newScheme;
|
|
247
267
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
248
268
|
while (1) switch (_context.prev = _context.next) {
|
|
249
269
|
case 0:
|
|
250
|
-
|
|
251
|
-
_context.next = 25;
|
|
252
|
-
break;
|
|
253
|
-
}
|
|
254
|
-
_context.prev = 1;
|
|
255
|
-
// 从 Grid 获取应用后的最新列状态和过滤器状态
|
|
256
|
-
updatedState = gridApi.getColumnState();
|
|
270
|
+
_context.prev = 0;
|
|
257
271
|
filterModel = gridApi.getFilterModel();
|
|
258
|
-
if (!
|
|
259
|
-
_context.next =
|
|
272
|
+
if (!currentScheme) {
|
|
273
|
+
_context.next = 8;
|
|
260
274
|
break;
|
|
261
275
|
}
|
|
262
|
-
_context.next =
|
|
263
|
-
return
|
|
276
|
+
_context.next = 5;
|
|
277
|
+
return saveColumnScheme === null || saveColumnScheme === void 0 ? void 0 : saveColumnScheme(gridKey, _objectSpread(_objectSpread({}, currentScheme), {}, {
|
|
264
278
|
columnConfig: configToSave,
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
});
|
|
268
|
-
case
|
|
269
|
-
|
|
279
|
+
filterModel: filterModel,
|
|
280
|
+
updatedAt: Date.now()
|
|
281
|
+
}));
|
|
282
|
+
case 5:
|
|
283
|
+
_antd.message.success('列配置已保存到方案');
|
|
284
|
+
_context.next = 23;
|
|
270
285
|
break;
|
|
271
|
-
case
|
|
272
|
-
//
|
|
273
|
-
defaultScheme =
|
|
286
|
+
case 8:
|
|
287
|
+
// 如果没有激活的方案,自动创建默认方案
|
|
288
|
+
defaultScheme = schemes.find(function (s) {
|
|
274
289
|
return s.isDefault;
|
|
275
290
|
});
|
|
276
291
|
if (!defaultScheme) {
|
|
277
292
|
_context.next = 17;
|
|
278
293
|
break;
|
|
279
294
|
}
|
|
280
|
-
_context.next =
|
|
281
|
-
return
|
|
282
|
-
case 13:
|
|
283
|
-
_context.next = 15;
|
|
284
|
-
return schemeManager.saveScheme({
|
|
295
|
+
_context.next = 12;
|
|
296
|
+
return saveColumnScheme === null || saveColumnScheme === void 0 ? void 0 : saveColumnScheme(gridKey, _objectSpread(_objectSpread({}, defaultScheme), {}, {
|
|
285
297
|
columnConfig: configToSave,
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
});
|
|
289
|
-
case
|
|
290
|
-
_context.next =
|
|
298
|
+
filterModel: filterModel,
|
|
299
|
+
updatedAt: Date.now()
|
|
300
|
+
}));
|
|
301
|
+
case 12:
|
|
302
|
+
_context.next = 14;
|
|
303
|
+
return setCurrentColumnScheme === null || setCurrentColumnScheme === void 0 ? void 0 : setCurrentColumnScheme(gridKey, defaultScheme.id);
|
|
304
|
+
case 14:
|
|
305
|
+
_antd.message.success('列配置已保存到默认方案');
|
|
306
|
+
_context.next = 23;
|
|
291
307
|
break;
|
|
292
308
|
case 17:
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
309
|
+
// 创建新的默认方案并激活
|
|
310
|
+
newScheme = {
|
|
311
|
+
id: (0, _uuid.v4)(),
|
|
312
|
+
name: '默认配置',
|
|
313
|
+
description: '自动创建的默认列配置',
|
|
314
|
+
columnConfig: configToSave,
|
|
299
315
|
filterModel: filterModel,
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
316
|
+
isDefault: true,
|
|
317
|
+
isSystem: false,
|
|
318
|
+
createdAt: Date.now(),
|
|
319
|
+
updatedAt: Date.now()
|
|
320
|
+
};
|
|
321
|
+
_context.next = 20;
|
|
322
|
+
return saveColumnScheme === null || saveColumnScheme === void 0 ? void 0 : saveColumnScheme(gridKey, newScheme);
|
|
304
323
|
case 20:
|
|
305
|
-
_context.next =
|
|
306
|
-
|
|
324
|
+
_context.next = 22;
|
|
325
|
+
return setCurrentColumnScheme === null || setCurrentColumnScheme === void 0 ? void 0 : setCurrentColumnScheme(gridKey, newScheme.id);
|
|
307
326
|
case 22:
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
327
|
+
_antd.message.success('已创建并保存到默认方案');
|
|
328
|
+
case 23:
|
|
329
|
+
_context.next = 29;
|
|
330
|
+
break;
|
|
311
331
|
case 25:
|
|
332
|
+
_context.prev = 25;
|
|
333
|
+
_context.t0 = _context["catch"](0);
|
|
334
|
+
console.error('保存列配置到方案失败:', _context.t0);
|
|
335
|
+
_antd.message.error('保存列配置失败');
|
|
336
|
+
case 29:
|
|
312
337
|
case "end":
|
|
313
338
|
return _context.stop();
|
|
314
339
|
}
|
|
315
|
-
}, _callee, null, [[
|
|
340
|
+
}, _callee, null, [[0, 25]]);
|
|
316
341
|
})), 50);
|
|
317
342
|
|
|
318
343
|
// 【修复】保存成功后清除快照
|
|
319
344
|
setSnapshotColumnDefs(null);
|
|
320
|
-
|
|
345
|
+
|
|
346
|
+
// message.success 已经在上面的逻辑中处理了
|
|
321
347
|
onClose();
|
|
322
|
-
case
|
|
348
|
+
case 16:
|
|
323
349
|
case "end":
|
|
324
350
|
return _context2.stop();
|
|
325
351
|
}
|
|
326
352
|
}, _callee2);
|
|
327
|
-
})), [form, gridApi, onSaveColumnState,
|
|
353
|
+
})), [form, gridApi, onSaveColumnState, onClose, saveColumnScheme, setCurrentColumnScheme, currentScheme, schemes, gridKey, originalColumnDefs]);
|
|
328
354
|
|
|
329
355
|
// 保存为新方案
|
|
330
356
|
var handleSaveScheme = (0, _react.useCallback)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
331
|
-
var columnConfigToSave, values,
|
|
357
|
+
var columnConfigToSave, values, gridColumnDefs, columnState, _values, filterModel, newScheme;
|
|
332
358
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
333
359
|
while (1) switch (_context3.prev = _context3.next) {
|
|
334
360
|
case 0:
|
|
@@ -341,39 +367,58 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
341
367
|
case 3:
|
|
342
368
|
_context3.prev = 3;
|
|
343
369
|
if (!(activeTab === 'columns' && form)) {
|
|
344
|
-
_context3.next =
|
|
370
|
+
_context3.next = 18;
|
|
345
371
|
break;
|
|
346
372
|
}
|
|
347
373
|
values = form.values;
|
|
348
374
|
columnConfigToSave = values.items; // 直接使用 FlatColumnItem[] 数据
|
|
349
375
|
// 【修复】传入原始列定义以保留自定义属性
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
376
|
+
gridColumnDefs = (0, _columnGroupUtils.flatConfigToGridState)(values.items, originalColumnDefs); // 【关键修复】先更新 columnDefs(处理分组结构变化)
|
|
377
|
+
console.log('[ColumnSetting] 另存为方案 - 更新 columnDefs');
|
|
378
|
+
gridApi.setGridOption('columnDefs', gridColumnDefs);
|
|
379
|
+
|
|
380
|
+
// 等待 columnDefs 更新完成
|
|
381
|
+
_context3.next = 12;
|
|
382
|
+
return new Promise(function (resolve) {
|
|
383
|
+
return setTimeout(resolve, 100);
|
|
384
|
+
});
|
|
385
|
+
case 12:
|
|
386
|
+
// 【修复】然后应用列状态(宽度、隐藏、顺序等)
|
|
387
|
+
columnState = (0, _columnGroupUtils.flatConfigToColumnState)(values.items);
|
|
388
|
+
gridApi.applyColumnState({
|
|
389
|
+
state: columnState,
|
|
390
|
+
applyOrder: true // 强制应用列顺序
|
|
391
|
+
});
|
|
354
392
|
|
|
355
393
|
// 等待状态更新
|
|
356
|
-
_context3.next =
|
|
394
|
+
_context3.next = 16;
|
|
357
395
|
return new Promise(function (resolve) {
|
|
358
396
|
return setTimeout(resolve, 50);
|
|
359
397
|
});
|
|
360
|
-
case
|
|
361
|
-
_context3.next =
|
|
398
|
+
case 16:
|
|
399
|
+
_context3.next = 20;
|
|
362
400
|
break;
|
|
363
|
-
case
|
|
401
|
+
case 18:
|
|
364
402
|
// 如果在"方案管理"标签页,使用当前表单数据
|
|
365
403
|
_values = form === null || form === void 0 ? void 0 : form.values;
|
|
366
404
|
columnConfigToSave = (_values === null || _values === void 0 ? void 0 : _values.items) || [];
|
|
367
|
-
case
|
|
405
|
+
case 20:
|
|
368
406
|
// 获取过滤器模型
|
|
369
407
|
filterModel = gridApi.getFilterModel();
|
|
370
|
-
|
|
371
|
-
|
|
408
|
+
newScheme = {
|
|
409
|
+
id: (0, _uuid.v4)(),
|
|
410
|
+
name: schemeName.trim(),
|
|
372
411
|
description: schemeDescription.trim() || "\u521B\u5EFA\u4E8E ".concat(new Date().toLocaleString()),
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
412
|
+
columnConfig: columnConfigToSave,
|
|
413
|
+
filterModel: filterModel,
|
|
414
|
+
isDefault: false,
|
|
415
|
+
isSystem: false,
|
|
416
|
+
createdAt: Date.now(),
|
|
417
|
+
updatedAt: Date.now()
|
|
418
|
+
};
|
|
419
|
+
_context3.next = 24;
|
|
420
|
+
return saveColumnScheme === null || saveColumnScheme === void 0 ? void 0 : saveColumnScheme(gridKey, newScheme);
|
|
421
|
+
case 24:
|
|
377
422
|
_antd.message.success('方案保存成功');
|
|
378
423
|
setSaveSchemeVisible(false);
|
|
379
424
|
setSchemeName('');
|
|
@@ -381,29 +426,61 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
381
426
|
|
|
382
427
|
// 切换到方案管理标签页,显示新创建的方案
|
|
383
428
|
setActiveTab('schemes');
|
|
384
|
-
_context3.next =
|
|
429
|
+
_context3.next = 34;
|
|
385
430
|
break;
|
|
386
|
-
case
|
|
387
|
-
_context3.prev =
|
|
431
|
+
case 31:
|
|
432
|
+
_context3.prev = 31;
|
|
388
433
|
_context3.t0 = _context3["catch"](3);
|
|
389
434
|
_antd.message.error(_context3.t0.message || '保存方案失败');
|
|
390
|
-
case
|
|
435
|
+
case 34:
|
|
391
436
|
case "end":
|
|
392
437
|
return _context3.stop();
|
|
393
438
|
}
|
|
394
|
-
}, _callee3, null, [[3,
|
|
395
|
-
})), [gridApi,
|
|
439
|
+
}, _callee3, null, [[3, 31]]);
|
|
440
|
+
})), [gridApi, saveColumnScheme, gridKey, schemeName, schemeDescription, activeTab, form, originalColumnDefs]);
|
|
396
441
|
|
|
397
442
|
// 加载方案
|
|
398
443
|
var handleLoadScheme = (0, _react.useCallback)( /*#__PURE__*/function () {
|
|
399
444
|
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(schemeId) {
|
|
445
|
+
var scheme, gridColumnDefs, columnState;
|
|
400
446
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
401
447
|
while (1) switch (_context4.prev = _context4.next) {
|
|
402
448
|
case 0:
|
|
403
449
|
_context4.prev = 0;
|
|
404
450
|
_context4.next = 3;
|
|
405
|
-
return
|
|
451
|
+
return setCurrentColumnScheme === null || setCurrentColumnScheme === void 0 ? void 0 : setCurrentColumnScheme(gridKey, schemeId);
|
|
406
452
|
case 3:
|
|
453
|
+
// 应用方案到 Grid
|
|
454
|
+
scheme = schemes.find(function (s) {
|
|
455
|
+
return s.id === schemeId;
|
|
456
|
+
});
|
|
457
|
+
if (!(scheme && gridApi)) {
|
|
458
|
+
_context4.next = 13;
|
|
459
|
+
break;
|
|
460
|
+
}
|
|
461
|
+
// 【关键修复】先更新 columnDefs(处理分组结构)
|
|
462
|
+
gridColumnDefs = (0, _columnGroupUtils.flatConfigToGridState)(scheme.columnConfig, originalColumnDefs);
|
|
463
|
+
console.log('[ColumnSetting] 加载方案 - 更新 columnDefs');
|
|
464
|
+
gridApi.setGridOption('columnDefs', gridColumnDefs);
|
|
465
|
+
|
|
466
|
+
// 等待 columnDefs 更新完成
|
|
467
|
+
_context4.next = 10;
|
|
468
|
+
return new Promise(function (resolve) {
|
|
469
|
+
return setTimeout(resolve, 100);
|
|
470
|
+
});
|
|
471
|
+
case 10:
|
|
472
|
+
// 【修复】然后应用列状态(宽度、隐藏、顺序等)
|
|
473
|
+
columnState = (0, _columnGroupUtils.flatConfigToColumnState)(scheme.columnConfig);
|
|
474
|
+
gridApi.applyColumnState({
|
|
475
|
+
state: columnState,
|
|
476
|
+
applyOrder: true // 强制应用列顺序
|
|
477
|
+
});
|
|
478
|
+
|
|
479
|
+
// 应用过滤器
|
|
480
|
+
if (scheme.filterModel) {
|
|
481
|
+
gridApi.setFilterModel(scheme.filterModel);
|
|
482
|
+
}
|
|
483
|
+
case 13:
|
|
407
484
|
_antd.message.success('方案已加载');
|
|
408
485
|
|
|
409
486
|
// 等待Grid状态更新后再刷新表单
|
|
@@ -418,50 +495,96 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
418
495
|
|
|
419
496
|
// 自动关闭弹窗,让用户看到Grid的变化
|
|
420
497
|
onClose();
|
|
421
|
-
_context4.next =
|
|
498
|
+
_context4.next = 21;
|
|
422
499
|
break;
|
|
423
|
-
case
|
|
424
|
-
_context4.prev =
|
|
500
|
+
case 18:
|
|
501
|
+
_context4.prev = 18;
|
|
425
502
|
_context4.t0 = _context4["catch"](0);
|
|
426
503
|
_antd.message.error(_context4.t0.message || '加载方案失败');
|
|
427
|
-
case
|
|
504
|
+
case 21:
|
|
428
505
|
case "end":
|
|
429
506
|
return _context4.stop();
|
|
430
507
|
}
|
|
431
|
-
}, _callee4, null, [[0,
|
|
508
|
+
}, _callee4, null, [[0, 18]]);
|
|
432
509
|
}));
|
|
433
510
|
return function (_x) {
|
|
434
511
|
return _ref5.apply(this, arguments);
|
|
435
512
|
};
|
|
436
|
-
}(), [
|
|
513
|
+
}(), [setCurrentColumnScheme, gridKey, schemes, gridApi, originalColumnDefs, form, getColumnData, onClose]);
|
|
437
514
|
|
|
438
515
|
// 设置默认方案
|
|
439
516
|
var handleSetDefault = (0, _react.useCallback)( /*#__PURE__*/function () {
|
|
440
517
|
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(schemeId) {
|
|
518
|
+
var scheme, _iterator, _step, s;
|
|
441
519
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
442
520
|
while (1) switch (_context5.prev = _context5.next) {
|
|
443
521
|
case 0:
|
|
444
522
|
_context5.prev = 0;
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
523
|
+
scheme = schemes.find(function (s) {
|
|
524
|
+
return s.id === schemeId;
|
|
525
|
+
});
|
|
526
|
+
if (!scheme) {
|
|
527
|
+
_context5.next = 24;
|
|
528
|
+
break;
|
|
529
|
+
}
|
|
530
|
+
// 将其他方案设为非默认
|
|
531
|
+
_iterator = _createForOfIteratorHelper(schemes);
|
|
532
|
+
_context5.prev = 4;
|
|
533
|
+
_iterator.s();
|
|
534
|
+
case 6:
|
|
535
|
+
if ((_step = _iterator.n()).done) {
|
|
536
|
+
_context5.next = 13;
|
|
537
|
+
break;
|
|
538
|
+
}
|
|
539
|
+
s = _step.value;
|
|
540
|
+
if (!(s.isDefault && s.id !== schemeId)) {
|
|
541
|
+
_context5.next = 11;
|
|
542
|
+
break;
|
|
543
|
+
}
|
|
544
|
+
_context5.next = 11;
|
|
545
|
+
return saveColumnScheme === null || saveColumnScheme === void 0 ? void 0 : saveColumnScheme(gridKey, _objectSpread(_objectSpread({}, s), {}, {
|
|
546
|
+
isDefault: false,
|
|
547
|
+
updatedAt: Date.now()
|
|
548
|
+
}));
|
|
549
|
+
case 11:
|
|
550
|
+
_context5.next = 6;
|
|
551
|
+
break;
|
|
552
|
+
case 13:
|
|
553
|
+
_context5.next = 18;
|
|
554
|
+
break;
|
|
555
|
+
case 15:
|
|
556
|
+
_context5.prev = 15;
|
|
557
|
+
_context5.t0 = _context5["catch"](4);
|
|
558
|
+
_iterator.e(_context5.t0);
|
|
559
|
+
case 18:
|
|
560
|
+
_context5.prev = 18;
|
|
561
|
+
_iterator.f();
|
|
562
|
+
return _context5.finish(18);
|
|
563
|
+
case 21:
|
|
564
|
+
_context5.next = 23;
|
|
565
|
+
return saveColumnScheme === null || saveColumnScheme === void 0 ? void 0 : saveColumnScheme(gridKey, _objectSpread(_objectSpread({}, scheme), {}, {
|
|
566
|
+
isDefault: true,
|
|
567
|
+
updatedAt: Date.now()
|
|
568
|
+
}));
|
|
569
|
+
case 23:
|
|
448
570
|
_antd.message.success('已设置为默认方案');
|
|
449
|
-
|
|
571
|
+
case 24:
|
|
572
|
+
_context5.next = 29;
|
|
450
573
|
break;
|
|
451
|
-
case
|
|
452
|
-
_context5.prev =
|
|
453
|
-
_context5.
|
|
454
|
-
_antd.message.error(_context5.
|
|
455
|
-
case
|
|
574
|
+
case 26:
|
|
575
|
+
_context5.prev = 26;
|
|
576
|
+
_context5.t1 = _context5["catch"](0);
|
|
577
|
+
_antd.message.error(_context5.t1.message || '设置失败');
|
|
578
|
+
case 29:
|
|
456
579
|
case "end":
|
|
457
580
|
return _context5.stop();
|
|
458
581
|
}
|
|
459
|
-
}, _callee5, null, [[0,
|
|
582
|
+
}, _callee5, null, [[0, 26], [4, 15, 18, 21]]);
|
|
460
583
|
}));
|
|
461
584
|
return function (_x2) {
|
|
462
585
|
return _ref6.apply(this, arguments);
|
|
463
586
|
};
|
|
464
|
-
}(), [
|
|
587
|
+
}(), [schemes, saveColumnScheme, gridKey]);
|
|
465
588
|
|
|
466
589
|
// 删除方案
|
|
467
590
|
var handleDeleteScheme = (0, _react.useCallback)( /*#__PURE__*/function () {
|
|
@@ -471,7 +594,7 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
471
594
|
case 0:
|
|
472
595
|
_context6.prev = 0;
|
|
473
596
|
_context6.next = 3;
|
|
474
|
-
return
|
|
597
|
+
return deleteColumnScheme === null || deleteColumnScheme === void 0 ? void 0 : deleteColumnScheme(gridKey, schemeId);
|
|
475
598
|
case 3:
|
|
476
599
|
_antd.message.success("\u65B9\u6848\"".concat(schemeName, "\"\u5DF2\u5220\u9664"));
|
|
477
600
|
_context6.next = 9;
|
|
@@ -489,7 +612,7 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
489
612
|
return function (_x3, _x4) {
|
|
490
613
|
return _ref7.apply(this, arguments);
|
|
491
614
|
};
|
|
492
|
-
}(), [
|
|
615
|
+
}(), [deleteColumnScheme, gridKey]);
|
|
493
616
|
|
|
494
617
|
// 编辑方案
|
|
495
618
|
var handleEditScheme = (0, _react.useCallback)(function (scheme) {
|
|
@@ -500,6 +623,7 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
500
623
|
|
|
501
624
|
// 保存编辑
|
|
502
625
|
var handleSaveEdit = (0, _react.useCallback)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
626
|
+
var scheme;
|
|
503
627
|
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
504
628
|
while (1) switch (_context7.prev = _context7.next) {
|
|
505
629
|
case 0:
|
|
@@ -510,36 +634,45 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
510
634
|
return _context7.abrupt("return");
|
|
511
635
|
case 2:
|
|
512
636
|
_context7.prev = 2;
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
name: editingName.trim(),
|
|
516
|
-
description: editingDescription.trim() || undefined
|
|
637
|
+
scheme = schemes.find(function (s) {
|
|
638
|
+
return s.id === editingId;
|
|
517
639
|
});
|
|
518
|
-
|
|
640
|
+
if (!scheme) {
|
|
641
|
+
_context7.next = 9;
|
|
642
|
+
break;
|
|
643
|
+
}
|
|
644
|
+
_context7.next = 7;
|
|
645
|
+
return saveColumnScheme === null || saveColumnScheme === void 0 ? void 0 : saveColumnScheme(gridKey, _objectSpread(_objectSpread({}, scheme), {}, {
|
|
646
|
+
name: editingName.trim(),
|
|
647
|
+
description: editingDescription.trim() || undefined,
|
|
648
|
+
updatedAt: Date.now()
|
|
649
|
+
}));
|
|
650
|
+
case 7:
|
|
519
651
|
_antd.message.success('更新成功');
|
|
520
652
|
setEditingId(null);
|
|
521
|
-
_context7.next = 12;
|
|
522
|
-
break;
|
|
523
653
|
case 9:
|
|
524
|
-
_context7.
|
|
654
|
+
_context7.next = 14;
|
|
655
|
+
break;
|
|
656
|
+
case 11:
|
|
657
|
+
_context7.prev = 11;
|
|
525
658
|
_context7.t0 = _context7["catch"](2);
|
|
526
659
|
_antd.message.error(_context7.t0.message || '更新失败');
|
|
527
|
-
case
|
|
660
|
+
case 14:
|
|
528
661
|
case "end":
|
|
529
662
|
return _context7.stop();
|
|
530
663
|
}
|
|
531
|
-
}, _callee7, null, [[2,
|
|
532
|
-
})), [
|
|
664
|
+
}, _callee7, null, [[2, 11]]);
|
|
665
|
+
})), [schemes, saveColumnScheme, gridKey, editingId, editingName, editingDescription]);
|
|
533
666
|
|
|
534
667
|
// 筛选方案列表
|
|
535
668
|
var filteredSchemes = (0, _react.useMemo)(function () {
|
|
536
|
-
if (
|
|
669
|
+
if (schemes.length === 0) return [];
|
|
537
670
|
var text = searchText.toLowerCase().trim();
|
|
538
|
-
if (!text) return
|
|
539
|
-
return
|
|
671
|
+
if (!text) return schemes;
|
|
672
|
+
return schemes.filter(function (scheme) {
|
|
540
673
|
return scheme.name.toLowerCase().includes(text) || scheme.description && scheme.description.toLowerCase().includes(text);
|
|
541
674
|
});
|
|
542
|
-
}, [
|
|
675
|
+
}, [schemes, searchText]);
|
|
543
676
|
|
|
544
677
|
// AG-Grid 列定义
|
|
545
678
|
var schemeColumnDefs = (0, _react.useMemo)(function () {
|
|
@@ -549,7 +682,7 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
549
682
|
flex: 1,
|
|
550
683
|
minWidth: 200,
|
|
551
684
|
cellRenderer: function cellRenderer(params) {
|
|
552
|
-
var
|
|
685
|
+
var _currentSchemes$gridK2;
|
|
553
686
|
var record = params.data;
|
|
554
687
|
if (!record) return null;
|
|
555
688
|
if (editingId === record.id) {
|
|
@@ -569,7 +702,7 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
569
702
|
size: "small"
|
|
570
703
|
}, /*#__PURE__*/_react.default.createElement("span", null, record.name), record.isDefault && /*#__PURE__*/_react.default.createElement(_antd.Tag, {
|
|
571
704
|
color: "blue"
|
|
572
|
-
}, "\u9ED8\u8BA4"), record.id === (
|
|
705
|
+
}, "\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.default.createElement(_antd.Tag, {
|
|
573
706
|
color: "green"
|
|
574
707
|
}, "\u5F53\u524D"));
|
|
575
708
|
}
|
|
@@ -672,16 +805,16 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
672
805
|
}))));
|
|
673
806
|
}
|
|
674
807
|
}];
|
|
675
|
-
}, [editingId, editingName, editingDescription,
|
|
808
|
+
}, [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]);
|
|
676
809
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_draggableModal.default, {
|
|
677
|
-
title: /*#__PURE__*/_react.default.createElement("span", null, "\u5217\u65B9\u6848\u7BA1\u7406",
|
|
810
|
+
title: /*#__PURE__*/_react.default.createElement("span", null, "\u5217\u65B9\u6848\u7BA1\u7406", currentScheme && /*#__PURE__*/_react.default.createElement("span", {
|
|
678
811
|
style: {
|
|
679
812
|
marginLeft: 16,
|
|
680
813
|
fontSize: 14,
|
|
681
814
|
fontWeight: 'normal',
|
|
682
815
|
color: '#1890ff'
|
|
683
816
|
}
|
|
684
|
-
}, "- \u5F53\u524D\u65B9\u6848: ",
|
|
817
|
+
}, "- \u5F53\u524D\u65B9\u6848: ", currentScheme.name)),
|
|
685
818
|
open: visible,
|
|
686
819
|
onCancel: handleClose,
|
|
687
820
|
width: 1100,
|
|
@@ -694,7 +827,7 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
694
827
|
onClick: onClose
|
|
695
828
|
}, "\u53D6\u6D88"), /*#__PURE__*/_react.default.createElement(_antd.Button, {
|
|
696
829
|
onClick: handleSaveColumns
|
|
697
|
-
}, "\u4FDD\u5B58\u914D\u7F6E"),
|
|
830
|
+
}, "\u4FDD\u5B58\u914D\u7F6E"), /*#__PURE__*/_react.default.createElement(_antd.Button, {
|
|
698
831
|
type: "primary",
|
|
699
832
|
icon: /*#__PURE__*/_react.default.createElement(_icons.SaveOutlined, null),
|
|
700
833
|
onClick: function onClick() {
|
|
@@ -713,8 +846,8 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
713
846
|
}, /*#__PURE__*/_react.default.createElement(_ColumnConfigTable.default, {
|
|
714
847
|
items: form.values.items || [],
|
|
715
848
|
onChange: handleColumnChange,
|
|
716
|
-
simple:
|
|
717
|
-
})),
|
|
849
|
+
simple: false
|
|
850
|
+
})), /*#__PURE__*/_react.default.createElement(TabPane, {
|
|
718
851
|
tab: "\u65B9\u6848\u7BA1\u7406",
|
|
719
852
|
key: "schemes"
|
|
720
853
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -767,7 +900,8 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
767
900
|
setSchemeDescription('');
|
|
768
901
|
},
|
|
769
902
|
okText: "\u4FDD\u5B58",
|
|
770
|
-
cancelText: "\u53D6\u6D88"
|
|
903
|
+
cancelText: "\u53D6\u6D88",
|
|
904
|
+
destroyOnClose: true
|
|
771
905
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
772
906
|
style: {
|
|
773
907
|
marginBottom: 16
|