@nokecy/qc-ui 1.0.83 → 1.0.84
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 +12 -5
- package/dist/cjs/ag-grid-plus/querySchemes/components/QuerySchemesManager.js +19 -9
- package/dist/cjs/ag-grid-plus/querySchemes/hooks/useQuerySchemes.js +25 -3
- package/dist/cjs/ag-grid-plus/setting/ColumnConfigTable.js +9 -9
- package/dist/cjs/draggableModal/index.js +3 -1
- package/dist/esm/ag-grid-plus/ag-gridPlus.js +12 -5
- package/dist/esm/ag-grid-plus/querySchemes/components/QuerySchemesManager.js +19 -10
- package/dist/esm/ag-grid-plus/querySchemes/hooks/useQuerySchemes.js +25 -3
- package/dist/esm/ag-grid-plus/setting/ColumnConfigTable.js +9 -9
- package/dist/esm/draggableModal/index.js +3 -1
- package/dist/umd/qc-ui.min.css +1 -1
- package/dist/umd/qc-ui.min.js +1 -1
- package/package.json +1 -1
|
@@ -337,6 +337,18 @@ function AgGridPlus(props) {
|
|
|
337
337
|
// 1. 先设置列定义(包含分组结构)
|
|
338
338
|
if (apiRef.current) {
|
|
339
339
|
apiRef.current.setGridOption("columnDefs", gridColumnDefs);
|
|
340
|
+
|
|
341
|
+
// 等待 columnDefs 应用完成后再设置过滤器
|
|
342
|
+
// 原因: setGridOption("columnDefs") 会触发 Grid 重新渲染,可能重置内部状态
|
|
343
|
+
// 必须在下一个渲染周期后应用 filterModel,否则会被覆盖
|
|
344
|
+
if (currentScheme.filterModel) {
|
|
345
|
+
requestAnimationFrame(function () {
|
|
346
|
+
if (apiRef.current) {
|
|
347
|
+
console.log('[AgGridPlus] 应用过滤器状态:', currentScheme.filterModel);
|
|
348
|
+
apiRef.current.setFilterModel(currentScheme.filterModel);
|
|
349
|
+
}
|
|
350
|
+
});
|
|
351
|
+
}
|
|
340
352
|
}
|
|
341
353
|
|
|
342
354
|
// 2. 【重要修改】使用 columnConfig 时,不应用 columnState
|
|
@@ -344,11 +356,6 @@ function AgGridPlus(props) {
|
|
|
344
356
|
// 如果再应用 columnState,会导致分组子列被视为独立列,破坏分组结构
|
|
345
357
|
console.log('[AgGridPlus] useEffect: 使用 columnConfig,跳过 columnState 应用');
|
|
346
358
|
}
|
|
347
|
-
|
|
348
|
-
// 应用过滤器状态
|
|
349
|
-
if (currentScheme.filterModel && apiRef.current) {
|
|
350
|
-
apiRef.current.setFilterModel(currentScheme.filterModel);
|
|
351
|
-
}
|
|
352
359
|
}, 10);
|
|
353
360
|
return function () {
|
|
354
361
|
return clearTimeout(timer);
|
|
@@ -7,10 +7,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.QuerySchemesManager = void 0;
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
var _antd = require("antd");
|
|
10
|
+
var _draggableModal = _interopRequireDefault(require("../../../draggableModal"));
|
|
10
11
|
var _icons = require("@ant-design/icons");
|
|
11
12
|
var _reactDnd = require("react-dnd");
|
|
12
13
|
var _reactDndHtml5Backend = require("react-dnd-html5-backend");
|
|
13
14
|
require("./QuerySchemesManager.less");
|
|
15
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
16
|
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); }
|
|
15
17
|
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; }
|
|
16
18
|
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; }
|
|
@@ -202,7 +204,7 @@ var QuerySchemesManager = exports.QuerySchemesManager = function QuerySchemesMan
|
|
|
202
204
|
case 0:
|
|
203
205
|
_context.prev = 0;
|
|
204
206
|
if (!currentScheme) {
|
|
205
|
-
_context.next =
|
|
207
|
+
_context.next = 7;
|
|
206
208
|
break;
|
|
207
209
|
}
|
|
208
210
|
_context.next = 4;
|
|
@@ -210,24 +212,32 @@ var QuerySchemesManager = exports.QuerySchemesManager = function QuerySchemesMan
|
|
|
210
212
|
itemsOrder: editingOrder
|
|
211
213
|
});
|
|
212
214
|
case 4:
|
|
215
|
+
_antd.message.success('已应用新顺序');
|
|
216
|
+
_context.next = 10;
|
|
217
|
+
break;
|
|
218
|
+
case 7:
|
|
219
|
+
_context.next = 9;
|
|
220
|
+
return createScheme('默认方案', editingOrder);
|
|
221
|
+
case 9:
|
|
222
|
+
_antd.message.success('已自动创建并应用默认方案');
|
|
223
|
+
case 10:
|
|
213
224
|
// 应用顺序到表单
|
|
214
225
|
onOrderChange(editingOrder);
|
|
215
|
-
_antd.message.success('已应用新顺序');
|
|
216
226
|
|
|
217
227
|
// 关闭弹窗,让用户看到效果
|
|
218
228
|
onClose();
|
|
219
|
-
_context.next =
|
|
229
|
+
_context.next = 17;
|
|
220
230
|
break;
|
|
221
|
-
case
|
|
222
|
-
_context.prev =
|
|
231
|
+
case 14:
|
|
232
|
+
_context.prev = 14;
|
|
223
233
|
_context.t0 = _context["catch"](0);
|
|
224
234
|
_antd.message.error(_context.t0.message || '应用失败');
|
|
225
|
-
case
|
|
235
|
+
case 17:
|
|
226
236
|
case "end":
|
|
227
237
|
return _context.stop();
|
|
228
238
|
}
|
|
229
|
-
}, _callee, null, [[0,
|
|
230
|
-
})), [editingOrder, onOrderChange, currentScheme, saveScheme, onClose]);
|
|
239
|
+
}, _callee, null, [[0, 14]]);
|
|
240
|
+
})), [editingOrder, onOrderChange, currentScheme, saveScheme, createScheme, onClose]);
|
|
231
241
|
|
|
232
242
|
/**
|
|
233
243
|
* 保存为新方案
|
|
@@ -445,7 +455,7 @@ var QuerySchemesManager = exports.QuerySchemesManager = function QuerySchemesMan
|
|
|
445
455
|
return _ref9.apply(this, arguments);
|
|
446
456
|
};
|
|
447
457
|
}(), [loadScheme, schemes, onOrderChange]);
|
|
448
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
458
|
+
return /*#__PURE__*/_react.default.createElement(_draggableModal.default, {
|
|
449
459
|
title: "\u67E5\u8BE2\u65B9\u6848\u8BBE\u7F6E",
|
|
450
460
|
open: visible,
|
|
451
461
|
onCancel: onClose,
|
|
@@ -329,18 +329,40 @@ function useQuerySchemes(config) {
|
|
|
329
329
|
_context5.next = 12;
|
|
330
330
|
return saveSchemesToStorage(updatedSchemes);
|
|
331
331
|
case 12:
|
|
332
|
+
// 自动激活新创建的方案
|
|
333
|
+
setCurrentScheme(newScheme);
|
|
334
|
+
setIsDirty(false);
|
|
335
|
+
|
|
336
|
+
// 保存当前方案ID,用于刷新后恢复
|
|
337
|
+
if (!storageAdapter.saveCurrentSchemeId) {
|
|
338
|
+
_context5.next = 23;
|
|
339
|
+
break;
|
|
340
|
+
}
|
|
341
|
+
_context5.prev = 15;
|
|
342
|
+
_context5.next = 18;
|
|
343
|
+
return storageAdapter.saveCurrentSchemeId(gridId, newScheme.id);
|
|
344
|
+
case 18:
|
|
345
|
+
_context5.next = 23;
|
|
346
|
+
break;
|
|
347
|
+
case 20:
|
|
348
|
+
_context5.prev = 20;
|
|
349
|
+
_context5.t0 = _context5["catch"](15);
|
|
350
|
+
console.error('[useQuerySchemes] 保存当前方案ID失败:', _context5.t0);
|
|
351
|
+
case 23:
|
|
352
|
+
// 触发方案变更回调
|
|
353
|
+
onSchemeChange === null || onSchemeChange === void 0 || onSchemeChange(newScheme);
|
|
332
354
|
onSchemeSave === null || onSchemeSave === void 0 || onSchemeSave(newScheme);
|
|
333
355
|
return _context5.abrupt("return", newScheme);
|
|
334
|
-
case
|
|
356
|
+
case 26:
|
|
335
357
|
case "end":
|
|
336
358
|
return _context5.stop();
|
|
337
359
|
}
|
|
338
|
-
}, _callee5);
|
|
360
|
+
}, _callee5, null, [[15, 20]]);
|
|
339
361
|
}));
|
|
340
362
|
return function (_x4, _x5, _x6) {
|
|
341
363
|
return _ref5.apply(this, arguments);
|
|
342
364
|
};
|
|
343
|
-
}(), [schemes, saveSchemesToStorage, onSchemeSave]);
|
|
365
|
+
}(), [schemes, gridId, storageAdapter, saveSchemesToStorage, onSchemeChange, onSchemeSave]);
|
|
344
366
|
|
|
345
367
|
/**
|
|
346
368
|
* 更新方案信息(不影响 itemsOrder)
|
|
@@ -721,7 +721,7 @@ var ColumnConfigTable = function ColumnConfigTable(_ref2) {
|
|
|
721
721
|
return [{
|
|
722
722
|
title: '排序',
|
|
723
723
|
key: 'sort',
|
|
724
|
-
width:
|
|
724
|
+
width: 40,
|
|
725
725
|
align: 'center',
|
|
726
726
|
render: function render() {
|
|
727
727
|
return /*#__PURE__*/_react.default.createElement(_antd.Tooltip, {
|
|
@@ -744,13 +744,13 @@ var ColumnConfigTable = function ColumnConfigTable(_ref2) {
|
|
|
744
744
|
title: '名称',
|
|
745
745
|
dataIndex: 'headerName',
|
|
746
746
|
key: 'headerName',
|
|
747
|
-
width:
|
|
747
|
+
width: 100,
|
|
748
748
|
render: renderNameCell
|
|
749
749
|
}, {
|
|
750
750
|
title: '宽度',
|
|
751
751
|
dataIndex: 'width',
|
|
752
752
|
key: 'width',
|
|
753
|
-
width:
|
|
753
|
+
width: 80,
|
|
754
754
|
align: 'center',
|
|
755
755
|
render: function render(value, record) {
|
|
756
756
|
if (record.type !== 'column') return '-';
|
|
@@ -772,7 +772,7 @@ var ColumnConfigTable = function ColumnConfigTable(_ref2) {
|
|
|
772
772
|
title: '占满',
|
|
773
773
|
dataIndex: 'flex',
|
|
774
774
|
key: 'flex',
|
|
775
|
-
width:
|
|
775
|
+
width: 50,
|
|
776
776
|
align: 'center',
|
|
777
777
|
render: function render(value, record) {
|
|
778
778
|
if (record.type !== 'column') return '-';
|
|
@@ -799,7 +799,7 @@ var ColumnConfigTable = function ColumnConfigTable(_ref2) {
|
|
|
799
799
|
title: '固定',
|
|
800
800
|
dataIndex: 'pinned',
|
|
801
801
|
key: 'pinned',
|
|
802
|
-
width:
|
|
802
|
+
width: 50,
|
|
803
803
|
align: 'center',
|
|
804
804
|
render: function render(value, record) {
|
|
805
805
|
if (record.type !== 'column') return '-';
|
|
@@ -829,7 +829,7 @@ var ColumnConfigTable = function ColumnConfigTable(_ref2) {
|
|
|
829
829
|
title: '隐藏',
|
|
830
830
|
dataIndex: 'hide',
|
|
831
831
|
key: 'hide',
|
|
832
|
-
width:
|
|
832
|
+
width: 50,
|
|
833
833
|
align: 'center',
|
|
834
834
|
render: function render(value, record) {
|
|
835
835
|
if (record.type !== 'column') return '-';
|
|
@@ -846,7 +846,7 @@ var ColumnConfigTable = function ColumnConfigTable(_ref2) {
|
|
|
846
846
|
title: '布局',
|
|
847
847
|
dataIndex: 'cellClass',
|
|
848
848
|
key: 'cellClass',
|
|
849
|
-
width:
|
|
849
|
+
width: 50,
|
|
850
850
|
align: 'center',
|
|
851
851
|
render: function render(value, record) {
|
|
852
852
|
if (record.type !== 'column') return '-';
|
|
@@ -876,7 +876,7 @@ var ColumnConfigTable = function ColumnConfigTable(_ref2) {
|
|
|
876
876
|
title: '列过滤',
|
|
877
877
|
dataIndex: 'suppressHeaderFilterButton',
|
|
878
878
|
key: 'suppressHeaderFilterButton',
|
|
879
|
-
width:
|
|
879
|
+
width: 50,
|
|
880
880
|
align: 'center',
|
|
881
881
|
render: function render(value, record) {
|
|
882
882
|
if (record.type !== 'column') return '-';
|
|
@@ -909,7 +909,7 @@ var ColumnConfigTable = function ColumnConfigTable(_ref2) {
|
|
|
909
909
|
bordered: true,
|
|
910
910
|
size: "small",
|
|
911
911
|
scroll: {
|
|
912
|
-
x:
|
|
912
|
+
x: 1000
|
|
913
913
|
},
|
|
914
914
|
components: {
|
|
915
915
|
body: {
|
|
@@ -286,11 +286,13 @@ var DraggableModal = function DraggableModal(props) {
|
|
|
286
286
|
style: isResizing && modalSize.width > 0 ? {
|
|
287
287
|
position: 'relative',
|
|
288
288
|
height: '100%',
|
|
289
|
+
width: "".concat(modalSize.width, "px"),
|
|
289
290
|
'--modal-width': "".concat(modalSize.width, "px"),
|
|
290
291
|
'--modal-height': "".concat(modalSize.height, "px")
|
|
291
292
|
} : {
|
|
292
293
|
position: 'relative',
|
|
293
|
-
height: '100%'
|
|
294
|
+
height: '100%',
|
|
295
|
+
width: '100%'
|
|
294
296
|
}
|
|
295
297
|
}, modal, !fullScreen && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
296
298
|
className: "resize-handle resize-handle-e",
|
|
@@ -330,6 +330,18 @@ function AgGridPlus(props) {
|
|
|
330
330
|
// 1. 先设置列定义(包含分组结构)
|
|
331
331
|
if (apiRef.current) {
|
|
332
332
|
apiRef.current.setGridOption("columnDefs", gridColumnDefs);
|
|
333
|
+
|
|
334
|
+
// 等待 columnDefs 应用完成后再设置过滤器
|
|
335
|
+
// 原因: setGridOption("columnDefs") 会触发 Grid 重新渲染,可能重置内部状态
|
|
336
|
+
// 必须在下一个渲染周期后应用 filterModel,否则会被覆盖
|
|
337
|
+
if (currentScheme.filterModel) {
|
|
338
|
+
requestAnimationFrame(function () {
|
|
339
|
+
if (apiRef.current) {
|
|
340
|
+
console.log('[AgGridPlus] 应用过滤器状态:', currentScheme.filterModel);
|
|
341
|
+
apiRef.current.setFilterModel(currentScheme.filterModel);
|
|
342
|
+
}
|
|
343
|
+
});
|
|
344
|
+
}
|
|
333
345
|
}
|
|
334
346
|
|
|
335
347
|
// 2. 【重要修改】使用 columnConfig 时,不应用 columnState
|
|
@@ -337,11 +349,6 @@ function AgGridPlus(props) {
|
|
|
337
349
|
// 如果再应用 columnState,会导致分组子列被视为独立列,破坏分组结构
|
|
338
350
|
console.log('[AgGridPlus] useEffect: 使用 columnConfig,跳过 columnState 应用');
|
|
339
351
|
}
|
|
340
|
-
|
|
341
|
-
// 应用过滤器状态
|
|
342
|
-
if (currentScheme.filterModel && apiRef.current) {
|
|
343
|
-
apiRef.current.setFilterModel(currentScheme.filterModel);
|
|
344
|
-
}
|
|
345
352
|
}, 10);
|
|
346
353
|
return function () {
|
|
347
354
|
return clearTimeout(timer);
|
|
@@ -13,7 +13,8 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
13
13
|
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; } }
|
|
14
14
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
15
15
|
import React, { useState, useCallback, useMemo } from 'react';
|
|
16
|
-
import {
|
|
16
|
+
import { Tabs, Button, Input, Space, List, message, Popconfirm, Tag, Tooltip } from 'antd';
|
|
17
|
+
import DraggableModal from "../../../draggableModal";
|
|
17
18
|
import { EditOutlined, DeleteOutlined, StarOutlined, StarFilled, HolderOutlined } from '@ant-design/icons';
|
|
18
19
|
import { DndProvider, useDrag, useDrop } from 'react-dnd';
|
|
19
20
|
import { HTML5Backend } from 'react-dnd-html5-backend';
|
|
@@ -194,7 +195,7 @@ export var QuerySchemesManager = function QuerySchemesManager(_ref2) {
|
|
|
194
195
|
case 0:
|
|
195
196
|
_context.prev = 0;
|
|
196
197
|
if (!currentScheme) {
|
|
197
|
-
_context.next =
|
|
198
|
+
_context.next = 7;
|
|
198
199
|
break;
|
|
199
200
|
}
|
|
200
201
|
_context.next = 4;
|
|
@@ -202,24 +203,32 @@ export var QuerySchemesManager = function QuerySchemesManager(_ref2) {
|
|
|
202
203
|
itemsOrder: editingOrder
|
|
203
204
|
});
|
|
204
205
|
case 4:
|
|
206
|
+
message.success('已应用新顺序');
|
|
207
|
+
_context.next = 10;
|
|
208
|
+
break;
|
|
209
|
+
case 7:
|
|
210
|
+
_context.next = 9;
|
|
211
|
+
return createScheme('默认方案', editingOrder);
|
|
212
|
+
case 9:
|
|
213
|
+
message.success('已自动创建并应用默认方案');
|
|
214
|
+
case 10:
|
|
205
215
|
// 应用顺序到表单
|
|
206
216
|
onOrderChange(editingOrder);
|
|
207
|
-
message.success('已应用新顺序');
|
|
208
217
|
|
|
209
218
|
// 关闭弹窗,让用户看到效果
|
|
210
219
|
onClose();
|
|
211
|
-
_context.next =
|
|
220
|
+
_context.next = 17;
|
|
212
221
|
break;
|
|
213
|
-
case
|
|
214
|
-
_context.prev =
|
|
222
|
+
case 14:
|
|
223
|
+
_context.prev = 14;
|
|
215
224
|
_context.t0 = _context["catch"](0);
|
|
216
225
|
message.error(_context.t0.message || '应用失败');
|
|
217
|
-
case
|
|
226
|
+
case 17:
|
|
218
227
|
case "end":
|
|
219
228
|
return _context.stop();
|
|
220
229
|
}
|
|
221
|
-
}, _callee, null, [[0,
|
|
222
|
-
})), [editingOrder, onOrderChange, currentScheme, saveScheme, onClose]);
|
|
230
|
+
}, _callee, null, [[0, 14]]);
|
|
231
|
+
})), [editingOrder, onOrderChange, currentScheme, saveScheme, createScheme, onClose]);
|
|
223
232
|
|
|
224
233
|
/**
|
|
225
234
|
* 保存为新方案
|
|
@@ -437,7 +446,7 @@ export var QuerySchemesManager = function QuerySchemesManager(_ref2) {
|
|
|
437
446
|
return _ref9.apply(this, arguments);
|
|
438
447
|
};
|
|
439
448
|
}(), [loadScheme, schemes, onOrderChange]);
|
|
440
|
-
return /*#__PURE__*/React.createElement(
|
|
449
|
+
return /*#__PURE__*/React.createElement(DraggableModal, {
|
|
441
450
|
title: "\u67E5\u8BE2\u65B9\u6848\u8BBE\u7F6E",
|
|
442
451
|
open: visible,
|
|
443
452
|
onCancel: onClose,
|
|
@@ -324,18 +324,40 @@ export function useQuerySchemes(config) {
|
|
|
324
324
|
_context5.next = 12;
|
|
325
325
|
return saveSchemesToStorage(updatedSchemes);
|
|
326
326
|
case 12:
|
|
327
|
+
// 自动激活新创建的方案
|
|
328
|
+
setCurrentScheme(newScheme);
|
|
329
|
+
setIsDirty(false);
|
|
330
|
+
|
|
331
|
+
// 保存当前方案ID,用于刷新后恢复
|
|
332
|
+
if (!storageAdapter.saveCurrentSchemeId) {
|
|
333
|
+
_context5.next = 23;
|
|
334
|
+
break;
|
|
335
|
+
}
|
|
336
|
+
_context5.prev = 15;
|
|
337
|
+
_context5.next = 18;
|
|
338
|
+
return storageAdapter.saveCurrentSchemeId(gridId, newScheme.id);
|
|
339
|
+
case 18:
|
|
340
|
+
_context5.next = 23;
|
|
341
|
+
break;
|
|
342
|
+
case 20:
|
|
343
|
+
_context5.prev = 20;
|
|
344
|
+
_context5.t0 = _context5["catch"](15);
|
|
345
|
+
console.error('[useQuerySchemes] 保存当前方案ID失败:', _context5.t0);
|
|
346
|
+
case 23:
|
|
347
|
+
// 触发方案变更回调
|
|
348
|
+
onSchemeChange === null || onSchemeChange === void 0 || onSchemeChange(newScheme);
|
|
327
349
|
onSchemeSave === null || onSchemeSave === void 0 || onSchemeSave(newScheme);
|
|
328
350
|
return _context5.abrupt("return", newScheme);
|
|
329
|
-
case
|
|
351
|
+
case 26:
|
|
330
352
|
case "end":
|
|
331
353
|
return _context5.stop();
|
|
332
354
|
}
|
|
333
|
-
}, _callee5);
|
|
355
|
+
}, _callee5, null, [[15, 20]]);
|
|
334
356
|
}));
|
|
335
357
|
return function (_x4, _x5, _x6) {
|
|
336
358
|
return _ref5.apply(this, arguments);
|
|
337
359
|
};
|
|
338
|
-
}(), [schemes, saveSchemesToStorage, onSchemeSave]);
|
|
360
|
+
}(), [schemes, gridId, storageAdapter, saveSchemesToStorage, onSchemeChange, onSchemeSave]);
|
|
339
361
|
|
|
340
362
|
/**
|
|
341
363
|
* 更新方案信息(不影响 itemsOrder)
|
|
@@ -713,7 +713,7 @@ var ColumnConfigTable = function ColumnConfigTable(_ref2) {
|
|
|
713
713
|
return [{
|
|
714
714
|
title: '排序',
|
|
715
715
|
key: 'sort',
|
|
716
|
-
width:
|
|
716
|
+
width: 40,
|
|
717
717
|
align: 'center',
|
|
718
718
|
render: function render() {
|
|
719
719
|
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
@@ -736,13 +736,13 @@ var ColumnConfigTable = function ColumnConfigTable(_ref2) {
|
|
|
736
736
|
title: '名称',
|
|
737
737
|
dataIndex: 'headerName',
|
|
738
738
|
key: 'headerName',
|
|
739
|
-
width:
|
|
739
|
+
width: 100,
|
|
740
740
|
render: renderNameCell
|
|
741
741
|
}, {
|
|
742
742
|
title: '宽度',
|
|
743
743
|
dataIndex: 'width',
|
|
744
744
|
key: 'width',
|
|
745
|
-
width:
|
|
745
|
+
width: 80,
|
|
746
746
|
align: 'center',
|
|
747
747
|
render: function render(value, record) {
|
|
748
748
|
if (record.type !== 'column') return '-';
|
|
@@ -764,7 +764,7 @@ var ColumnConfigTable = function ColumnConfigTable(_ref2) {
|
|
|
764
764
|
title: '占满',
|
|
765
765
|
dataIndex: 'flex',
|
|
766
766
|
key: 'flex',
|
|
767
|
-
width:
|
|
767
|
+
width: 50,
|
|
768
768
|
align: 'center',
|
|
769
769
|
render: function render(value, record) {
|
|
770
770
|
if (record.type !== 'column') return '-';
|
|
@@ -791,7 +791,7 @@ var ColumnConfigTable = function ColumnConfigTable(_ref2) {
|
|
|
791
791
|
title: '固定',
|
|
792
792
|
dataIndex: 'pinned',
|
|
793
793
|
key: 'pinned',
|
|
794
|
-
width:
|
|
794
|
+
width: 50,
|
|
795
795
|
align: 'center',
|
|
796
796
|
render: function render(value, record) {
|
|
797
797
|
if (record.type !== 'column') return '-';
|
|
@@ -821,7 +821,7 @@ var ColumnConfigTable = function ColumnConfigTable(_ref2) {
|
|
|
821
821
|
title: '隐藏',
|
|
822
822
|
dataIndex: 'hide',
|
|
823
823
|
key: 'hide',
|
|
824
|
-
width:
|
|
824
|
+
width: 50,
|
|
825
825
|
align: 'center',
|
|
826
826
|
render: function render(value, record) {
|
|
827
827
|
if (record.type !== 'column') return '-';
|
|
@@ -838,7 +838,7 @@ var ColumnConfigTable = function ColumnConfigTable(_ref2) {
|
|
|
838
838
|
title: '布局',
|
|
839
839
|
dataIndex: 'cellClass',
|
|
840
840
|
key: 'cellClass',
|
|
841
|
-
width:
|
|
841
|
+
width: 50,
|
|
842
842
|
align: 'center',
|
|
843
843
|
render: function render(value, record) {
|
|
844
844
|
if (record.type !== 'column') return '-';
|
|
@@ -868,7 +868,7 @@ var ColumnConfigTable = function ColumnConfigTable(_ref2) {
|
|
|
868
868
|
title: '列过滤',
|
|
869
869
|
dataIndex: 'suppressHeaderFilterButton',
|
|
870
870
|
key: 'suppressHeaderFilterButton',
|
|
871
|
-
width:
|
|
871
|
+
width: 50,
|
|
872
872
|
align: 'center',
|
|
873
873
|
render: function render(value, record) {
|
|
874
874
|
if (record.type !== 'column') return '-';
|
|
@@ -901,7 +901,7 @@ var ColumnConfigTable = function ColumnConfigTable(_ref2) {
|
|
|
901
901
|
bordered: true,
|
|
902
902
|
size: "small",
|
|
903
903
|
scroll: {
|
|
904
|
-
x:
|
|
904
|
+
x: 1000
|
|
905
905
|
},
|
|
906
906
|
components: {
|
|
907
907
|
body: {
|
|
@@ -276,11 +276,13 @@ var DraggableModal = function DraggableModal(props) {
|
|
|
276
276
|
style: isResizing && modalSize.width > 0 ? {
|
|
277
277
|
position: 'relative',
|
|
278
278
|
height: '100%',
|
|
279
|
+
width: "".concat(modalSize.width, "px"),
|
|
279
280
|
'--modal-width': "".concat(modalSize.width, "px"),
|
|
280
281
|
'--modal-height': "".concat(modalSize.height, "px")
|
|
281
282
|
} : {
|
|
282
283
|
position: 'relative',
|
|
283
|
-
height: '100%'
|
|
284
|
+
height: '100%',
|
|
285
|
+
width: '100%'
|
|
284
286
|
}
|
|
285
287
|
}, modal, !fullScreen && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
286
288
|
className: "resize-handle resize-handle-e",
|