@nokecy/qc-ui 1.1.87 → 1.1.88
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 +148 -144
- package/dist/cjs/ag-grid-plus/context/useSchemeDataFlow.js +4 -4
- package/dist/cjs/ag-grid-plus/interface.d.ts +2 -0
- package/dist/cjs/ag-grid-plus/queryForm/index.d.ts +2 -0
- package/dist/cjs/ag-grid-plus/queryForm/index.js +47 -51
- package/dist/cjs/ag-grid-plus/queryForm/queryColumns.d.ts +8 -0
- package/dist/cjs/ag-grid-plus/queryForm/queryColumns.js +52 -0
- package/dist/cjs/ag-grid-plus/queryForm/schemaKey.d.ts +15 -8
- package/dist/cjs/ag-grid-plus/queryForm/schemaKey.js +64 -12
- package/dist/cjs/ag-grid-plus/setting/ColumnConfigForm.js +3 -0
- package/dist/cjs/ag-grid-plus/setting/ColumnSetting.js +69 -106
- package/dist/cjs/ag-grid-plus/setting/QuerySchemeManager.js +3 -1
- package/dist/cjs/ag-grid-plus/setting/columnGroupTypes.d.ts +2 -0
- package/dist/cjs/ag-grid-plus/setting/columnGroupUtils.d.ts +14 -0
- package/dist/cjs/ag-grid-plus/setting/columnGroupUtils.js +98 -110
- package/dist/cjs/ag-grid-plus/types.d.ts +6 -0
- package/dist/cjs/array-table/batchRemove.d.ts +36 -0
- package/dist/cjs/array-table/batchRemove.js +299 -0
- package/dist/cjs/array-table/cellFocusScope.js +44 -8
- package/dist/cjs/array-table/cellInteractionLock.d.ts +13 -0
- package/dist/cjs/array-table/cellInteractionLock.js +26 -0
- package/dist/cjs/array-table/hooks.d.ts +11 -6
- package/dist/cjs/array-table/hooks.js +138 -88
- package/dist/cjs/array-table/index.d.ts +8 -2
- package/dist/cjs/array-table/index.js +55 -32
- package/dist/cjs/array-table/indexColumn.d.ts +1 -1
- package/dist/cjs/array-table/indexColumn.js +3 -2
- package/dist/cjs/array-table/interface.d.ts +13 -1
- package/dist/cjs/array-table/preview.js +8 -0
- package/dist/cjs/array-table/readOnlyFormatters.d.ts +9 -1
- package/dist/cjs/array-table/readOnlyFormatters.js +41 -13
- package/dist/cjs/array-table/rowIdentity.d.ts +17 -0
- package/dist/cjs/array-table/rowIdentity.js +43 -0
- package/dist/cjs/array-table/sorting.d.ts +3 -0
- package/dist/cjs/array-table/sorting.js +46 -0
- package/dist/cjs/array-table/utils.js +146 -67
- package/dist/cjs/dialogSelect/index.d.ts +3 -0
- package/dist/cjs/dialogSelect/index.js +13 -3
- package/dist/cjs/editable/index.js +101 -139
- package/dist/cjs/index.d.ts +2 -2
- package/dist/cjs/index.js +14 -0
- package/dist/cjs/readPretty/arrayTable.js +29 -14
- package/dist/cjs/readPretty/formily.d.ts +1 -0
- package/dist/cjs/readPretty/formily.js +7 -0
- package/dist/cjs/readPretty/index.d.ts +1 -0
- package/dist/cjs/readPretty/index.js +7 -0
- package/dist/cjs/readPretty/schemaScope.d.ts +2 -0
- package/dist/cjs/readPretty/schemaScope.js +49 -0
- package/dist/esm/ag-grid-plus/ag-gridPlus.js +148 -144
- package/dist/esm/ag-grid-plus/context/useSchemeDataFlow.js +4 -4
- package/dist/esm/ag-grid-plus/interface.d.ts +2 -0
- package/dist/esm/ag-grid-plus/queryForm/index.d.ts +2 -0
- package/dist/esm/ag-grid-plus/queryForm/index.js +47 -52
- package/dist/esm/ag-grid-plus/queryForm/queryColumns.d.ts +8 -0
- package/dist/esm/ag-grid-plus/queryForm/queryColumns.js +46 -0
- package/dist/esm/ag-grid-plus/queryForm/schemaKey.d.ts +15 -8
- package/dist/esm/ag-grid-plus/queryForm/schemaKey.js +64 -12
- package/dist/esm/ag-grid-plus/setting/ColumnConfigForm.js +3 -0
- package/dist/esm/ag-grid-plus/setting/ColumnSetting.js +70 -107
- package/dist/esm/ag-grid-plus/setting/QuerySchemeManager.js +3 -1
- package/dist/esm/ag-grid-plus/setting/columnGroupTypes.d.ts +2 -0
- package/dist/esm/ag-grid-plus/setting/columnGroupUtils.d.ts +14 -0
- package/dist/esm/ag-grid-plus/setting/columnGroupUtils.js +95 -110
- package/dist/esm/ag-grid-plus/types.d.ts +6 -0
- package/dist/esm/array-table/batchRemove.d.ts +36 -0
- package/dist/esm/array-table/batchRemove.js +289 -0
- package/dist/esm/array-table/cellFocusScope.js +45 -9
- package/dist/esm/array-table/cellInteractionLock.d.ts +13 -0
- package/dist/esm/array-table/cellInteractionLock.js +21 -0
- package/dist/esm/array-table/hooks.d.ts +11 -6
- package/dist/esm/array-table/hooks.js +139 -89
- package/dist/esm/array-table/index.d.ts +8 -2
- package/dist/esm/array-table/index.js +55 -32
- package/dist/esm/array-table/indexColumn.d.ts +1 -1
- package/dist/esm/array-table/indexColumn.js +3 -2
- package/dist/esm/array-table/interface.d.ts +13 -1
- package/dist/esm/array-table/preview.js +8 -0
- package/dist/esm/array-table/readOnlyFormatters.d.ts +9 -1
- package/dist/esm/array-table/readOnlyFormatters.js +41 -12
- package/dist/esm/array-table/rowIdentity.d.ts +17 -0
- package/dist/esm/array-table/rowIdentity.js +37 -0
- package/dist/esm/array-table/sorting.d.ts +3 -0
- package/dist/esm/array-table/sorting.js +40 -0
- package/dist/esm/array-table/utils.js +147 -68
- package/dist/esm/dialogSelect/index.d.ts +3 -0
- package/dist/esm/dialogSelect/index.js +13 -3
- package/dist/esm/editable/index.js +102 -140
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/index.js +1 -1
- package/dist/esm/readPretty/arrayTable.js +30 -13
- package/dist/esm/readPretty/formily.d.ts +1 -0
- package/dist/esm/readPretty/formily.js +1 -0
- package/dist/esm/readPretty/index.d.ts +1 -0
- package/dist/esm/readPretty/index.js +1 -0
- package/dist/esm/readPretty/schemaScope.d.ts +2 -0
- package/dist/esm/readPretty/schemaScope.js +42 -0
- package/dist/umd/qc-ui.min.js +1 -1
- package/package.json +1 -1
|
@@ -1,19 +1,26 @@
|
|
|
1
1
|
type ColumnStateLike = {
|
|
2
2
|
colId?: string | null;
|
|
3
|
+
hide?: boolean | null;
|
|
3
4
|
};
|
|
4
5
|
type QueryColumnLike = {
|
|
5
6
|
field?: string;
|
|
7
|
+
colId?: string;
|
|
8
|
+
queryField?: string;
|
|
6
9
|
headerName?: string;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
searchTitle?: string;
|
|
11
|
+
hide?: boolean;
|
|
12
|
+
hideInSearch?: boolean;
|
|
13
|
+
hideInTable?: boolean;
|
|
14
|
+
visible?: boolean;
|
|
15
|
+
filter?: unknown;
|
|
16
|
+
type?: unknown;
|
|
17
|
+
enum?: unknown;
|
|
18
|
+
searchComponent?: unknown;
|
|
19
|
+
searchComponentProps?: unknown;
|
|
13
20
|
};
|
|
14
21
|
/**
|
|
15
|
-
*
|
|
16
|
-
*
|
|
22
|
+
* 查询区只在有效查询元数据变化时更新 schema,列宽、固定位置和排序不参与。
|
|
23
|
+
* 接受列状态参数以兼容原调用方;表单传入已经合并状态的有效查询列快照。
|
|
17
24
|
* @author nokecy
|
|
18
25
|
*/
|
|
19
26
|
export declare const queryFormSchemaKey: (columnStates?: readonly ColumnStateLike[] | null, colDefs?: readonly QueryColumnLike[] | null) => string;
|
|
@@ -1,19 +1,71 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
var referenceIds = new WeakMap();
|
|
3
|
+
var nextReferenceId = 1;
|
|
4
|
+
|
|
5
|
+
/** 保持组件、回调及非普通对象的引用标识稳定。@author nokecy */
|
|
6
|
+
var referenceKey = function referenceKey(value) {
|
|
7
|
+
if (!referenceIds.has(value)) referenceIds.set(value, nextReferenceId++);
|
|
8
|
+
return referenceIds.get(value);
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* 对查询元数据生成稳定签名:普通对象按内容比较,组件与回调按引用比较。
|
|
13
|
+
* 排除 React 元素的内部 owner;循环引用只终止当前分支。
|
|
14
|
+
* @author nokecy
|
|
15
|
+
*/
|
|
16
|
+
var metadataKey = function metadataKey(value) {
|
|
17
|
+
var ancestors = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Set();
|
|
18
|
+
if (typeof value === 'function') return "function:".concat(referenceKey(value));
|
|
19
|
+
if (value === null || _typeof(value) !== 'object') return "".concat(_typeof(value), ":").concat(JSON.stringify(String(value)));
|
|
20
|
+
if (ancestors.has(value)) return 'circular';
|
|
21
|
+
if (value instanceof Date) return "date:".concat(value.getTime());
|
|
22
|
+
var nextAncestors = new Set(ancestors).add(value);
|
|
23
|
+
if (Array.isArray(value)) return "[".concat(value.map(function (item) {
|
|
24
|
+
return metadataKey(item, nextAncestors);
|
|
25
|
+
}).join(','), "]");
|
|
26
|
+
var prototype = Object.getPrototypeOf(value);
|
|
27
|
+
if (prototype !== Object.prototype && prototype !== null) return "reference:".concat(referenceKey(value));
|
|
28
|
+
var object = value;
|
|
29
|
+
var keys = Object.keys(object).filter(function (key) {
|
|
30
|
+
return !object.$$typeof || key !== '_owner';
|
|
31
|
+
}).sort();
|
|
32
|
+
return "{".concat(keys.map(function (key) {
|
|
33
|
+
return "".concat(JSON.stringify(key), ":").concat(metadataKey(object[key], nextAncestors));
|
|
34
|
+
}).join(','), "}");
|
|
5
35
|
};
|
|
6
36
|
|
|
7
37
|
/**
|
|
8
|
-
*
|
|
9
|
-
*
|
|
38
|
+
* 查询区只在有效查询元数据变化时更新 schema,列宽、固定位置和排序不参与。
|
|
39
|
+
* 接受列状态参数以兼容原调用方;表单传入已经合并状态的有效查询列快照。
|
|
10
40
|
* @author nokecy
|
|
11
41
|
*/
|
|
12
42
|
export var queryFormSchemaKey = function queryFormSchemaKey(columnStates, colDefs) {
|
|
13
|
-
return
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
43
|
+
return metadataKey({
|
|
44
|
+
states: columnStates === null || columnStates === void 0 ? void 0 : columnStates.map(function (_ref) {
|
|
45
|
+
var colId = _ref.colId,
|
|
46
|
+
hide = _ref.hide;
|
|
47
|
+
return {
|
|
48
|
+
colId: colId,
|
|
49
|
+
hide: hide
|
|
50
|
+
};
|
|
51
|
+
}),
|
|
52
|
+
columns: colDefs === null || colDefs === void 0 ? void 0 : colDefs.map(function (column) {
|
|
53
|
+
var _column$searchTitle;
|
|
54
|
+
return {
|
|
55
|
+
field: column.field,
|
|
56
|
+
colId: column.colId,
|
|
57
|
+
queryField: column.queryField,
|
|
58
|
+
title: (_column$searchTitle = column.searchTitle) !== null && _column$searchTitle !== void 0 ? _column$searchTitle : column.headerName,
|
|
59
|
+
hide: column.hide,
|
|
60
|
+
hideInSearch: column.hideInSearch,
|
|
61
|
+
hideInTable: column.hideInTable,
|
|
62
|
+
visible: column.visible,
|
|
63
|
+
filter: column.filter,
|
|
64
|
+
type: column.type,
|
|
65
|
+
enum: column.enum,
|
|
66
|
+
searchComponent: column.searchComponent,
|
|
67
|
+
searchComponentProps: column.searchComponentProps
|
|
68
|
+
};
|
|
69
|
+
})
|
|
70
|
+
});
|
|
19
71
|
};
|
|
@@ -122,6 +122,9 @@ var ColumnConfigForm = function ColumnConfigForm(_ref) {
|
|
|
122
122
|
}), /*#__PURE__*/React.createElement(SchemaField.String, {
|
|
123
123
|
name: "field",
|
|
124
124
|
"x-display": "hidden"
|
|
125
|
+
}), /*#__PURE__*/React.createElement(SchemaField.String, {
|
|
126
|
+
name: "colId",
|
|
127
|
+
"x-display": "hidden"
|
|
125
128
|
}), /*#__PURE__*/React.createElement(SchemaField.Boolean, {
|
|
126
129
|
name: "_isNew",
|
|
127
130
|
"x-display": "hidden"
|
|
@@ -7,16 +7,16 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
7
7
|
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
8
8
|
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); } }
|
|
9
9
|
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); }); }; }
|
|
10
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
11
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
12
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
13
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
14
10
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
15
11
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
16
12
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
17
13
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
18
14
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
19
15
|
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; } } }; }
|
|
16
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
17
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
18
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
19
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
20
20
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
21
21
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
22
22
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
@@ -33,7 +33,7 @@ import { AgGridReact } from 'ag-grid-react';
|
|
|
33
33
|
import { useAgGridTheme } from "../theme";
|
|
34
34
|
import { localeText } from "../locale";
|
|
35
35
|
import { createForm, onFormInit } from '@formily/core';
|
|
36
|
-
import { gridStateToFlatConfig, flatConfigToGridState, flatConfigToColumnState, dropQueryOnlyItems, excludeQueryOnlyColumns, isOldSchemeData, migrateOldScheme, generateId } from "./columnGroupUtils";
|
|
36
|
+
import { gridStateToFlatConfig, flatConfigToGridState, flatConfigToColumnState, dropQueryOnlyItems, excludeQueryOnlyColumns, isOldSchemeData, migrateOldScheme, generateId, getColumnIdentity, normalizeColumnConfig } from "./columnGroupUtils";
|
|
37
37
|
import ColumnConfigTable from "./ColumnConfigTable";
|
|
38
38
|
import DraggableModal from "../../draggableModal";
|
|
39
39
|
import { useGridSchemes } from "../context/useSchemeManager";
|
|
@@ -139,47 +139,7 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
139
139
|
if (!originalColumnDefs || originalColumnDefs.length === 0) {
|
|
140
140
|
return items;
|
|
141
141
|
}
|
|
142
|
-
|
|
143
|
-
// 递归查找 originalColumnDefs 中指定 field 的 headerName
|
|
144
|
-
var findOriginalHeaderName = function findOriginalHeaderName(field) {
|
|
145
|
-
var _iterator = _createForOfIteratorHelper(originalColumnDefs),
|
|
146
|
-
_step;
|
|
147
|
-
try {
|
|
148
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
149
|
-
var def = _step.value;
|
|
150
|
-
// 检查分组
|
|
151
|
-
if ('children' in def && def.children) {
|
|
152
|
-
for (var _i = 0, _arr = def.children; _i < _arr.length; _i++) {
|
|
153
|
-
var child = _arr[_i];
|
|
154
|
-
if (child.field === field) {
|
|
155
|
-
return child.headerName;
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
} else {
|
|
159
|
-
// 检查普通列
|
|
160
|
-
if (def.field === field) {
|
|
161
|
-
return def.headerName;
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
} catch (err) {
|
|
166
|
-
_iterator.e(err);
|
|
167
|
-
} finally {
|
|
168
|
-
_iterator.f();
|
|
169
|
-
}
|
|
170
|
-
return undefined;
|
|
171
|
-
};
|
|
172
|
-
return items.map(function (item) {
|
|
173
|
-
if (item.type === 'column' && item.field) {
|
|
174
|
-
var originalHeaderName = findOriginalHeaderName(item.field);
|
|
175
|
-
if (originalHeaderName) {
|
|
176
|
-
return _objectSpread(_objectSpread({}, item), {}, {
|
|
177
|
-
originalHeaderName: originalHeaderName
|
|
178
|
-
});
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
return item;
|
|
182
|
-
});
|
|
142
|
+
return normalizeColumnConfig(items, originalColumnDefs);
|
|
183
143
|
}, [originalColumnDefs]);
|
|
184
144
|
|
|
185
145
|
/**
|
|
@@ -195,9 +155,9 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
195
155
|
// 创建 field -> config item 的映射(用于快速查找已保存的列配置)
|
|
196
156
|
var existingFields = new Set();
|
|
197
157
|
config.filter(function (item) {
|
|
198
|
-
return item.type === 'column' && item
|
|
158
|
+
return item.type === 'column' && getColumnIdentity(item);
|
|
199
159
|
}).forEach(function (item) {
|
|
200
|
-
existingFields.add(item
|
|
160
|
+
existingFields.add(getColumnIdentity(item));
|
|
201
161
|
});
|
|
202
162
|
|
|
203
163
|
// 创建 groupId -> config item 的映射(用于快速查找已保存的分组配置)
|
|
@@ -218,11 +178,11 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
218
178
|
* 递归处理列定义,查找新增的列和分组
|
|
219
179
|
*/
|
|
220
180
|
var findNewColumns = function findNewColumns(defs, level, parentId) {
|
|
221
|
-
var
|
|
222
|
-
|
|
181
|
+
var _iterator = _createForOfIteratorHelper(defs),
|
|
182
|
+
_step;
|
|
223
183
|
try {
|
|
224
184
|
var _loop = function _loop() {
|
|
225
|
-
var def =
|
|
185
|
+
var def = _step.value;
|
|
226
186
|
// 检查是否是分组
|
|
227
187
|
if ('children' in def && def.children && def.children.length > 0) {
|
|
228
188
|
var groupDef = def;
|
|
@@ -253,8 +213,9 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
253
213
|
} else {
|
|
254
214
|
// 普通列
|
|
255
215
|
var colDef = def;
|
|
256
|
-
|
|
257
|
-
if (!
|
|
216
|
+
var columnId = getColumnIdentity(colDef);
|
|
217
|
+
if (!columnId) return 1; // continue
|
|
218
|
+
if (!existingFields.has(columnId)) {
|
|
258
219
|
// 新列 - 追加到末尾
|
|
259
220
|
newItems.push({
|
|
260
221
|
id: generateId(),
|
|
@@ -263,6 +224,7 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
263
224
|
level: level,
|
|
264
225
|
order: ++maxOrder,
|
|
265
226
|
field: colDef.field,
|
|
227
|
+
colId: colDef.colId,
|
|
266
228
|
headerName: colDef.headerName || colDef.field || '未命名列',
|
|
267
229
|
originalHeaderName: colDef.headerName || colDef.field || '未命名列',
|
|
268
230
|
width: colDef.width,
|
|
@@ -275,13 +237,13 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
275
237
|
}
|
|
276
238
|
}
|
|
277
239
|
};
|
|
278
|
-
for (
|
|
240
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
279
241
|
if (_loop()) continue;
|
|
280
242
|
}
|
|
281
243
|
} catch (err) {
|
|
282
|
-
|
|
244
|
+
_iterator.e(err);
|
|
283
245
|
} finally {
|
|
284
|
-
|
|
246
|
+
_iterator.f();
|
|
285
247
|
}
|
|
286
248
|
};
|
|
287
249
|
|
|
@@ -324,9 +286,9 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
324
286
|
|
|
325
287
|
// 同步列状态(宽度、隐藏等)
|
|
326
288
|
flatConfig = flatConfig.map(function (item) {
|
|
327
|
-
if (item.type === 'column' && item
|
|
289
|
+
if (item.type === 'column' && getColumnIdentity(item)) {
|
|
328
290
|
var _state = columnStates.find(function (s) {
|
|
329
|
-
return s.colId === item
|
|
291
|
+
return s.colId === getColumnIdentity(item);
|
|
330
292
|
});
|
|
331
293
|
if (_state) {
|
|
332
294
|
// 处理 pinned: 可能是 true/false/null/'left'/'right'
|
|
@@ -398,7 +360,7 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
398
360
|
|
|
399
361
|
// 3. 立即应用到 Grid(实时预览,不保存到方案)
|
|
400
362
|
// 【修复】同时应用列顺序和状态,确保拖拽排序能够生效
|
|
401
|
-
var columnState = flatConfigToColumnState(newItems);
|
|
363
|
+
var columnState = flatConfigToColumnState(newItems, allColDefs);
|
|
402
364
|
gridApi.applyColumnState({
|
|
403
365
|
state: columnState,
|
|
404
366
|
applyOrder: true // 强制应用列顺序
|
|
@@ -451,7 +413,7 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
451
413
|
});
|
|
452
414
|
case 10:
|
|
453
415
|
// 【修复】然后应用列状态(宽度、隐藏、顺序等)
|
|
454
|
-
columnState = flatConfigToColumnState(scheme.columnConfig);
|
|
416
|
+
columnState = flatConfigToColumnState(scheme.columnConfig, allColDefs);
|
|
455
417
|
gridApi.applyColumnState({
|
|
456
418
|
state: columnState,
|
|
457
419
|
applyOrder: true // 强制应用列顺序
|
|
@@ -517,29 +479,30 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
517
479
|
}
|
|
518
480
|
|
|
519
481
|
// 验证数据完整性,过滤掉无效的列配置
|
|
482
|
+
configToSave = normalizeColumnConfig(configToSave, allColDefs);
|
|
520
483
|
invalidColumns = configToSave.filter(function (item) {
|
|
521
|
-
return item.type === 'column' &&
|
|
484
|
+
return item.type === 'column' && !getColumnIdentity(item);
|
|
522
485
|
});
|
|
523
486
|
if (invalidColumns.length > 0) {
|
|
524
|
-
message.warning("\u68C0\u6D4B\u5230 ".concat(invalidColumns.length, " \u4E2A\u5217\u7F3A\u5C11
|
|
487
|
+
message.warning("\u68C0\u6D4B\u5230 ".concat(invalidColumns.length, " \u4E2A\u5217\u7F3A\u5C11\u5217\u6807\u8BC6\uFF0C\u5DF2\u81EA\u52A8\u8FC7\u6EE4"));
|
|
525
488
|
console.warn('[ColumnSetting] 无效的列配置:', invalidColumns);
|
|
526
489
|
configToSave = configToSave.filter(function (item) {
|
|
527
|
-
return item.type === 'group' || item.type === 'column' && item
|
|
490
|
+
return item.type === 'group' || item.type === 'column' && getColumnIdentity(item);
|
|
528
491
|
});
|
|
529
492
|
}
|
|
530
|
-
_context2.prev =
|
|
493
|
+
_context2.prev = 9;
|
|
531
494
|
filterModel = gridApi.getFilterModel();
|
|
532
495
|
if (!currentScheme) {
|
|
533
|
-
_context2.next =
|
|
496
|
+
_context2.next = 22;
|
|
534
497
|
break;
|
|
535
498
|
}
|
|
536
499
|
if (!(currentScheme.isGlobal && !canApplyToGlobal)) {
|
|
537
|
-
_context2.next =
|
|
500
|
+
_context2.next = 15;
|
|
538
501
|
break;
|
|
539
502
|
}
|
|
540
503
|
message.error('没有权限修改全局方案');
|
|
541
504
|
return _context2.abrupt("return");
|
|
542
|
-
case
|
|
505
|
+
case 15:
|
|
543
506
|
// 如果有激活的方案,更新该方案
|
|
544
507
|
createdAt = currentScheme.createdAt, updatedAt = currentScheme.updatedAt, schemeWithoutTimestamps = _objectWithoutProperties(currentScheme, _excluded);
|
|
545
508
|
savedScheme = _objectSpread(_objectSpread({}, schemeWithoutTimestamps), {}, {
|
|
@@ -547,28 +510,28 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
547
510
|
filterModel: filterModel
|
|
548
511
|
// createdAt 和 updatedAt 由存储适配器自动生成
|
|
549
512
|
});
|
|
550
|
-
_context2.next =
|
|
513
|
+
_context2.next = 19;
|
|
551
514
|
return saveColumnScheme === null || saveColumnScheme === void 0 ? void 0 : saveColumnScheme(gridKey, savedScheme);
|
|
552
|
-
case
|
|
515
|
+
case 19:
|
|
553
516
|
message.success('列配置已保存到方案');
|
|
554
|
-
_context2.next =
|
|
517
|
+
_context2.next = 38;
|
|
555
518
|
break;
|
|
556
|
-
case
|
|
519
|
+
case 22:
|
|
557
520
|
// 如果没有激活的方案,自动创建或更新默认方案
|
|
558
521
|
defaultScheme = schemes.find(function (s) {
|
|
559
522
|
return s.isDefault;
|
|
560
523
|
});
|
|
561
524
|
if (!defaultScheme) {
|
|
562
|
-
_context2.next =
|
|
525
|
+
_context2.next = 34;
|
|
563
526
|
break;
|
|
564
527
|
}
|
|
565
528
|
if (!(defaultScheme.isGlobal && !canApplyToGlobal)) {
|
|
566
|
-
_context2.next =
|
|
529
|
+
_context2.next = 27;
|
|
567
530
|
break;
|
|
568
531
|
}
|
|
569
532
|
message.error('没有权限修改全局方案');
|
|
570
533
|
return _context2.abrupt("return");
|
|
571
|
-
case
|
|
534
|
+
case 27:
|
|
572
535
|
// 更新默认方案
|
|
573
536
|
_createdAt = defaultScheme.createdAt, _updatedAt = defaultScheme.updatedAt, _schemeWithoutTimestamps = _objectWithoutProperties(defaultScheme, _excluded2);
|
|
574
537
|
savedScheme = _objectSpread(_objectSpread({}, _schemeWithoutTimestamps), {}, {
|
|
@@ -576,13 +539,13 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
576
539
|
filterModel: filterModel
|
|
577
540
|
// createdAt 和 updatedAt 由存储适配器自动生成
|
|
578
541
|
});
|
|
579
|
-
_context2.next =
|
|
542
|
+
_context2.next = 31;
|
|
580
543
|
return saveColumnScheme === null || saveColumnScheme === void 0 ? void 0 : saveColumnScheme(gridKey, savedScheme);
|
|
581
|
-
case
|
|
544
|
+
case 31:
|
|
582
545
|
message.success('列配置已保存到默认方案');
|
|
583
|
-
_context2.next =
|
|
546
|
+
_context2.next = 38;
|
|
584
547
|
break;
|
|
585
|
-
case
|
|
548
|
+
case 34:
|
|
586
549
|
// 创建新的默认方案
|
|
587
550
|
savedScheme = {
|
|
588
551
|
id: uuidv4(),
|
|
@@ -594,16 +557,16 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
594
557
|
isSystem: false
|
|
595
558
|
// createdAt 和 updatedAt 由存储适配器自动生成
|
|
596
559
|
};
|
|
597
|
-
_context2.next =
|
|
560
|
+
_context2.next = 37;
|
|
598
561
|
return saveColumnScheme === null || saveColumnScheme === void 0 ? void 0 : saveColumnScheme(gridKey, savedScheme);
|
|
599
|
-
case 36:
|
|
600
|
-
message.success('已创建并保存到默认方案');
|
|
601
562
|
case 37:
|
|
602
|
-
|
|
563
|
+
message.success('已创建并保存到默认方案');
|
|
564
|
+
case 38:
|
|
565
|
+
_context2.next = 40;
|
|
603
566
|
return new Promise(function (resolve) {
|
|
604
567
|
return setTimeout(resolve, 100);
|
|
605
568
|
});
|
|
606
|
-
case
|
|
569
|
+
case 40:
|
|
607
570
|
// 【关键修复】直接应用方案到 Grid,不通过 handleLoadScheme
|
|
608
571
|
// 这样可以避免依赖 Context 状态更新的时序问题
|
|
609
572
|
logger.debug('[ColumnSetting] 保存后直接应用方案到 Grid');
|
|
@@ -615,14 +578,14 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
615
578
|
gridApi.setGridOption('columnDefs', gridColumnDefs);
|
|
616
579
|
|
|
617
580
|
// 等待 columnDefs 更新完成
|
|
618
|
-
_context2.next =
|
|
581
|
+
_context2.next = 46;
|
|
619
582
|
return new Promise(function (resolve) {
|
|
620
583
|
return setTimeout(resolve, 100);
|
|
621
584
|
});
|
|
622
|
-
case
|
|
585
|
+
case 46:
|
|
623
586
|
// 2. 应用列状态(列顺序、宽度、隐藏、固定等)
|
|
624
587
|
logger.debug('[ColumnSetting] 应用列状态');
|
|
625
|
-
columnState = flatConfigToColumnState(savedScheme.columnConfig);
|
|
588
|
+
columnState = flatConfigToColumnState(savedScheme.columnConfig, allColDefs);
|
|
626
589
|
gridApi.applyColumnState({
|
|
627
590
|
state: columnState,
|
|
628
591
|
applyOrder: true
|
|
@@ -636,31 +599,31 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
636
599
|
|
|
637
600
|
// 4. 设置为当前方案(如果不是当前方案)
|
|
638
601
|
if (!(!currentScheme || savedScheme.id !== currentScheme.id)) {
|
|
639
|
-
_context2.next =
|
|
602
|
+
_context2.next = 53;
|
|
640
603
|
break;
|
|
641
604
|
}
|
|
642
|
-
_context2.next =
|
|
605
|
+
_context2.next = 53;
|
|
643
606
|
return setCurrentColumnScheme === null || setCurrentColumnScheme === void 0 ? void 0 : setCurrentColumnScheme(gridKey, savedScheme.id);
|
|
644
|
-
case
|
|
645
|
-
_context2.next =
|
|
607
|
+
case 53:
|
|
608
|
+
_context2.next = 55;
|
|
646
609
|
return new Promise(function (resolve) {
|
|
647
610
|
return setTimeout(resolve, 50);
|
|
648
611
|
});
|
|
649
|
-
case
|
|
612
|
+
case 55:
|
|
650
613
|
// 5. 关闭弹窗
|
|
651
614
|
onClose();
|
|
652
|
-
_context2.next =
|
|
615
|
+
_context2.next = 62;
|
|
653
616
|
break;
|
|
654
|
-
case
|
|
655
|
-
_context2.prev =
|
|
656
|
-
_context2.t0 = _context2["catch"](
|
|
617
|
+
case 58:
|
|
618
|
+
_context2.prev = 58;
|
|
619
|
+
_context2.t0 = _context2["catch"](9);
|
|
657
620
|
console.error('保存列配置到方案失败:', _context2.t0);
|
|
658
621
|
message.error('保存列配置失败');
|
|
659
|
-
case
|
|
622
|
+
case 62:
|
|
660
623
|
case "end":
|
|
661
624
|
return _context2.stop();
|
|
662
625
|
}
|
|
663
|
-
}, _callee2, null, [[
|
|
626
|
+
}, _callee2, null, [[9, 58]]);
|
|
664
627
|
})), [form, gridApi, saveColumnScheme, setCurrentColumnScheme, currentScheme, schemes, gridKey, allColDefs, onClose]);
|
|
665
628
|
|
|
666
629
|
// 保存为新方案
|
|
@@ -682,9 +645,9 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
682
645
|
break;
|
|
683
646
|
}
|
|
684
647
|
values = form.values;
|
|
685
|
-
columnConfigToSave = values.items
|
|
648
|
+
columnConfigToSave = normalizeColumnConfig(values.items || [], allColDefs);
|
|
686
649
|
// 【修复】传入 allColDefs 以保留自定义属性(cellRenderer 等)
|
|
687
|
-
gridColumnDefs = flatConfigToGridState(
|
|
650
|
+
gridColumnDefs = flatConfigToGridState(columnConfigToSave, allColDefs); // 【关键修复】先更新 columnDefs(处理分组结构变化)
|
|
688
651
|
logger.debug('[ColumnSetting] 另存为方案 - 更新 columnDefs');
|
|
689
652
|
gridApi.setGridOption('columnDefs', gridColumnDefs);
|
|
690
653
|
|
|
@@ -695,7 +658,7 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
695
658
|
});
|
|
696
659
|
case 12:
|
|
697
660
|
// 【修复】然后应用列状态(宽度、隐藏、顺序等)
|
|
698
|
-
columnState = flatConfigToColumnState(
|
|
661
|
+
columnState = flatConfigToColumnState(columnConfigToSave, allColDefs);
|
|
699
662
|
gridApi.applyColumnState({
|
|
700
663
|
state: columnState,
|
|
701
664
|
applyOrder: true // 强制应用列顺序
|
|
@@ -752,7 +715,7 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
752
715
|
// 设置默认方案
|
|
753
716
|
var handleSetDefault = useCallback( /*#__PURE__*/function () {
|
|
754
717
|
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(schemeId) {
|
|
755
|
-
var scheme,
|
|
718
|
+
var scheme, _iterator2, _step2, s;
|
|
756
719
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
757
720
|
while (1) switch (_context4.prev = _context4.next) {
|
|
758
721
|
case 0:
|
|
@@ -765,15 +728,15 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
765
728
|
break;
|
|
766
729
|
}
|
|
767
730
|
// 将其他方案设为非默认
|
|
768
|
-
|
|
731
|
+
_iterator2 = _createForOfIteratorHelper(schemes);
|
|
769
732
|
_context4.prev = 4;
|
|
770
|
-
|
|
733
|
+
_iterator2.s();
|
|
771
734
|
case 6:
|
|
772
|
-
if ((
|
|
735
|
+
if ((_step2 = _iterator2.n()).done) {
|
|
773
736
|
_context4.next = 13;
|
|
774
737
|
break;
|
|
775
738
|
}
|
|
776
|
-
s =
|
|
739
|
+
s = _step2.value;
|
|
777
740
|
if (!(s.isDefault && s.id !== schemeId)) {
|
|
778
741
|
_context4.next = 11;
|
|
779
742
|
break;
|
|
@@ -791,10 +754,10 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
791
754
|
case 15:
|
|
792
755
|
_context4.prev = 15;
|
|
793
756
|
_context4.t0 = _context4["catch"](4);
|
|
794
|
-
|
|
757
|
+
_iterator2.e(_context4.t0);
|
|
795
758
|
case 18:
|
|
796
759
|
_context4.prev = 18;
|
|
797
|
-
|
|
760
|
+
_iterator2.f();
|
|
798
761
|
return _context4.finish(18);
|
|
799
762
|
case 21:
|
|
800
763
|
_context4.next = 23;
|
|
@@ -105,7 +105,9 @@ var QuerySchemeManager = function QuerySchemeManager(_ref) {
|
|
|
105
105
|
var map = new Map();
|
|
106
106
|
if (queryFormItems) {
|
|
107
107
|
queryFormItems.forEach(function (item) {
|
|
108
|
-
|
|
108
|
+
var _item$searchTitle;
|
|
109
|
+
// 查询方案管理显示独立查询标题,保持字段标识和持久化结构不变。@author nokecy
|
|
110
|
+
map.set(item.field, (_item$searchTitle = item.searchTitle) !== null && _item$searchTitle !== void 0 ? _item$searchTitle : item.headerName || item.field);
|
|
109
111
|
});
|
|
110
112
|
}
|
|
111
113
|
return map;
|
|
@@ -8,6 +8,20 @@ import type { FlatColumnItem, OldColumnState } from './columnGroupTypes';
|
|
|
8
8
|
* 生成唯一 ID
|
|
9
9
|
*/
|
|
10
10
|
export declare const generateId: () => string;
|
|
11
|
+
/** 方案与 AG-Grid 使用相同的列标识规则。@author nokecy */
|
|
12
|
+
export declare function getColumnIdentity(column: {
|
|
13
|
+
colId?: string;
|
|
14
|
+
field?: string;
|
|
15
|
+
}): string | undefined;
|
|
16
|
+
/** 递归匹配业务列;仅对缺失标识的已存方案使用唯一原始标题恢复。@author nokecy */
|
|
17
|
+
export declare function findOriginalColumn(item: {
|
|
18
|
+
colId?: string;
|
|
19
|
+
field?: string;
|
|
20
|
+
originalHeaderName?: string;
|
|
21
|
+
headerName?: string;
|
|
22
|
+
}, definitions?: (ColDef | ColGroupDef)[]): ColDef | undefined;
|
|
23
|
+
/** 为列方案补齐业务列身份,保留用户的顺序、标题与布局设置。@author nokecy */
|
|
24
|
+
export declare function normalizeColumnConfig(items: FlatColumnItem[], definitions?: (ColDef | ColGroupDef)[]): FlatColumnItem[];
|
|
11
25
|
/**
|
|
12
26
|
* 去掉只做查询条件的列(hideInTable),含分组内的
|
|
13
27
|
* 这类列只进查询表单,不是表格列:列方案的还原、新增列检测都不能把它带进表格
|