@nokecy/qc-ui 1.1.34 → 1.1.35
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 +10 -3
- package/dist/cjs/ag-grid-plus/context/gridContext.d.ts +9 -0
- package/dist/cjs/ag-grid-plus/context/useSchemeDataFlow.d.ts +8 -0
- package/dist/cjs/ag-grid-plus/context/useSchemeDataFlow.js +62 -1
- package/dist/cjs/ag-grid-plus/setting/ColumnSetting.js +8 -2
- package/dist/cjs/ag-grid-plus/shared/storage/localStorageAdapter.js +34 -6
- package/dist/cjs/ag-grid-plus/shared/storage/schemeStorageAdapter.d.ts +2 -0
- package/dist/esm/ag-grid-plus/ag-gridPlus.js +10 -3
- package/dist/esm/ag-grid-plus/context/gridContext.d.ts +9 -0
- package/dist/esm/ag-grid-plus/context/useSchemeDataFlow.d.ts +8 -0
- package/dist/esm/ag-grid-plus/context/useSchemeDataFlow.js +62 -1
- package/dist/esm/ag-grid-plus/setting/ColumnSetting.js +8 -2
- package/dist/esm/ag-grid-plus/shared/storage/localStorageAdapter.js +34 -6
- package/dist/esm/ag-grid-plus/shared/storage/schemeStorageAdapter.d.ts +2 -0
- package/dist/umd/qc-ui.min.js +1 -1
- package/package.json +1 -1
|
@@ -282,7 +282,9 @@ function AgGridPlus(props) {
|
|
|
282
282
|
currentQuerySchemes = schemeDataFlow.querySchemes,
|
|
283
283
|
currentQueryScheme = schemeDataFlow.currentQueryScheme,
|
|
284
284
|
derivedColumnDefs = schemeDataFlow.derivedColumnDefs,
|
|
285
|
-
derivedColumnState = schemeDataFlow.derivedColumnState
|
|
285
|
+
derivedColumnState = schemeDataFlow.derivedColumnState,
|
|
286
|
+
isUsingGlobalFallback = schemeDataFlow.isUsingGlobalFallback,
|
|
287
|
+
isUsingGlobalQueryFallback = schemeDataFlow.isUsingGlobalQueryFallback;
|
|
286
288
|
(0, _react.useImperativeHandle)(propsGridRef, function () {
|
|
287
289
|
return gridRef.current;
|
|
288
290
|
});
|
|
@@ -1262,7 +1264,10 @@ function AgGridPlus(props) {
|
|
|
1262
1264
|
globalConfigPermissions: globalConfigPermissions,
|
|
1263
1265
|
applySchemeToGlobal: applySchemeToGlobal,
|
|
1264
1266
|
resetToGlobal: resetToGlobal,
|
|
1265
|
-
resetAllUsers: resetAllUsers
|
|
1267
|
+
resetAllUsers: resetAllUsers,
|
|
1268
|
+
// ========== 全局方案回退状态 @author nokecy ==========
|
|
1269
|
+
isUsingGlobalFallback: isUsingGlobalFallback,
|
|
1270
|
+
isUsingGlobalQueryFallback: isUsingGlobalQueryFallback
|
|
1266
1271
|
};
|
|
1267
1272
|
}, [extensibleColumns, gridPlusColumnState, allColDefsRef.current,
|
|
1268
1273
|
// 【修复】添加到依赖数组
|
|
@@ -1272,7 +1277,9 @@ function AgGridPlus(props) {
|
|
|
1272
1277
|
// 方案管理依赖
|
|
1273
1278
|
columnSchemes, querySchemes, currentSchemes, schemesLoading, lastSyncTime, saveColumnScheme, deleteColumnScheme, saveQueryScheme, deleteQueryScheme, setCurrentColumnScheme, setCurrentQueryScheme, refreshSchemes, getColumnSchemes, getQuerySchemes, getCurrentScheme,
|
|
1274
1279
|
// 全局配置依赖
|
|
1275
|
-
globalConfigPermissions, applySchemeToGlobal, resetToGlobal, resetAllUsers
|
|
1280
|
+
globalConfigPermissions, applySchemeToGlobal, resetToGlobal, resetAllUsers,
|
|
1281
|
+
// 全局方案回退状态依赖 @author nokecy
|
|
1282
|
+
isUsingGlobalFallback, isUsingGlobalQueryFallback]);
|
|
1276
1283
|
return /*#__PURE__*/_react.default.createElement(_gridContext.GridPlusContext.Provider, {
|
|
1277
1284
|
value: gridPlusContextValue
|
|
1278
1285
|
}, /*#__PURE__*/_react.default.createElement(_antd.Spin, {
|
|
@@ -166,5 +166,14 @@ export interface GridPlusContextValue extends SchemeManagementAPI {
|
|
|
166
166
|
* 由使用端(业务应用)传入,用于前端根据权限动态显示/隐藏操作按钮
|
|
167
167
|
*/
|
|
168
168
|
globalConfigPermissions?: GlobalConfigPermissions;
|
|
169
|
+
/**
|
|
170
|
+
* 是否使用全局列方案作为回退
|
|
171
|
+
* 当没有用户方案时自动使用全局方案,此时为 true
|
|
172
|
+
*/
|
|
173
|
+
isUsingGlobalFallback?: boolean;
|
|
174
|
+
/**
|
|
175
|
+
* 是否使用全局查询方案作为回退
|
|
176
|
+
*/
|
|
177
|
+
isUsingGlobalQueryFallback?: boolean;
|
|
169
178
|
}
|
|
170
179
|
export declare const GridPlusContext: React.Context<GridPlusContextValue>;
|
|
@@ -32,9 +32,13 @@ export declare function useSchemeSource(gridKey: string, schemeData: SchemeData)
|
|
|
32
32
|
columnSchemes: ColumnScheme[];
|
|
33
33
|
currentColumnSchemeId: string | null | undefined;
|
|
34
34
|
currentColumnScheme: ColumnScheme | undefined;
|
|
35
|
+
/** 是否使用全局方案作为回退(没有用户方案时自动使用全局方案) */
|
|
36
|
+
isUsingGlobalFallback: boolean;
|
|
35
37
|
querySchemes: QueryScheme[];
|
|
36
38
|
currentQuerySchemeId: string | null | undefined;
|
|
37
39
|
currentQueryScheme: QueryScheme | undefined;
|
|
40
|
+
/** 是否使用全局查询方案作为回退 */
|
|
41
|
+
isUsingGlobalQueryFallback: boolean;
|
|
38
42
|
};
|
|
39
43
|
/**
|
|
40
44
|
* 派生层 - 计算 Grid 状态(只读派生)
|
|
@@ -83,7 +87,11 @@ export declare function useSchemeDataFlow(gridKey: string, allColDefs: ExtendedC
|
|
|
83
87
|
columnSchemes: ColumnScheme[];
|
|
84
88
|
currentColumnSchemeId: string | null | undefined;
|
|
85
89
|
currentColumnScheme: ColumnScheme | undefined;
|
|
90
|
+
/** 是否使用全局方案作为回退(没有用户方案时自动使用全局方案) */
|
|
91
|
+
isUsingGlobalFallback: boolean;
|
|
86
92
|
querySchemes: QueryScheme[];
|
|
87
93
|
currentQuerySchemeId: string | null | undefined;
|
|
88
94
|
currentQueryScheme: QueryScheme | undefined;
|
|
95
|
+
/** 是否使用全局查询方案作为回退 */
|
|
96
|
+
isUsingGlobalQueryFallback: boolean;
|
|
89
97
|
};
|
|
@@ -47,23 +47,84 @@ function useSchemeSource(gridKey, schemeData) {
|
|
|
47
47
|
var _currentSchemes$gridK, _currentSchemes$gridK2;
|
|
48
48
|
var schemes = (columnSchemes === null || columnSchemes === void 0 ? void 0 : columnSchemes[gridKey]) || [];
|
|
49
49
|
var currentColumnSchemeId = currentSchemes === null || currentSchemes === void 0 || (_currentSchemes$gridK = currentSchemes[gridKey]) === null || _currentSchemes$gridK === void 0 ? void 0 : _currentSchemes$gridK.columnSchemeId;
|
|
50
|
+
|
|
51
|
+
// 优先使用当前用户方案,如果没有则自动使用全局方案
|
|
52
|
+
// @author nokecy
|
|
50
53
|
var currentColumnScheme = schemes.find(function (s) {
|
|
51
54
|
return s.id === currentColumnSchemeId;
|
|
52
55
|
});
|
|
56
|
+
var isUsingGlobalFallback = false;
|
|
57
|
+
if (!currentColumnScheme && schemes.length > 0) {
|
|
58
|
+
// 没有当前用户方案,查找全局方案
|
|
59
|
+
var globalSchemes = schemes.filter(function (s) {
|
|
60
|
+
return s.isGlobal === true;
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
// 多个全局方案警告 @author nokecy
|
|
64
|
+
if (globalSchemes.length > 1) {
|
|
65
|
+
console.warn('[useSchemeSource] 检测到多个全局方案,将使用第一个', {
|
|
66
|
+
gridKey: gridKey,
|
|
67
|
+
globalSchemeCount: globalSchemes.length,
|
|
68
|
+
globalSchemes: globalSchemes.map(function (s) {
|
|
69
|
+
return {
|
|
70
|
+
id: s.id,
|
|
71
|
+
name: s.name
|
|
72
|
+
};
|
|
73
|
+
})
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
var globalScheme = globalSchemes[0];
|
|
77
|
+
if (globalScheme) {
|
|
78
|
+
currentColumnScheme = globalScheme;
|
|
79
|
+
isUsingGlobalFallback = true;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
53
82
|
var querySchemeList = (querySchemes === null || querySchemes === void 0 ? void 0 : querySchemes[gridKey]) || [];
|
|
54
83
|
var currentQuerySchemeId = currentSchemes === null || currentSchemes === void 0 || (_currentSchemes$gridK2 = currentSchemes[gridKey]) === null || _currentSchemes$gridK2 === void 0 ? void 0 : _currentSchemes$gridK2.querySchemeId;
|
|
84
|
+
|
|
85
|
+
// 查询方案也采用相同的回退逻辑
|
|
86
|
+
// @author nokecy
|
|
55
87
|
var currentQueryScheme = querySchemeList.find(function (s) {
|
|
56
88
|
return s.id === currentQuerySchemeId;
|
|
57
89
|
});
|
|
90
|
+
var isUsingGlobalQueryFallback = false;
|
|
91
|
+
if (!currentQueryScheme && querySchemeList.length > 0) {
|
|
92
|
+
var globalQuerySchemes = querySchemeList.filter(function (s) {
|
|
93
|
+
return s.isGlobal === true;
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
// 多个全局查询方案警告 @author nokecy
|
|
97
|
+
if (globalQuerySchemes.length > 1) {
|
|
98
|
+
console.warn('[useSchemeSource] 检测到多个全局查询方案,将使用第一个', {
|
|
99
|
+
gridKey: gridKey,
|
|
100
|
+
globalSchemeCount: globalQuerySchemes.length,
|
|
101
|
+
globalSchemes: globalQuerySchemes.map(function (s) {
|
|
102
|
+
return {
|
|
103
|
+
id: s.id,
|
|
104
|
+
name: s.name
|
|
105
|
+
};
|
|
106
|
+
})
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
var globalQueryScheme = globalQuerySchemes[0];
|
|
110
|
+
if (globalQueryScheme) {
|
|
111
|
+
currentQueryScheme = globalQueryScheme;
|
|
112
|
+
isUsingGlobalQueryFallback = true;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
58
115
|
return {
|
|
59
116
|
// 列方案
|
|
60
117
|
columnSchemes: schemes,
|
|
61
118
|
currentColumnSchemeId: currentColumnSchemeId,
|
|
62
119
|
currentColumnScheme: currentColumnScheme,
|
|
120
|
+
/** 是否使用全局方案作为回退(没有用户方案时自动使用全局方案) */
|
|
121
|
+
isUsingGlobalFallback: isUsingGlobalFallback,
|
|
63
122
|
// 查询方案
|
|
64
123
|
querySchemes: querySchemeList,
|
|
65
124
|
currentQuerySchemeId: currentQuerySchemeId,
|
|
66
|
-
currentQueryScheme: currentQueryScheme
|
|
125
|
+
currentQueryScheme: currentQueryScheme,
|
|
126
|
+
/** 是否使用全局查询方案作为回退 */
|
|
127
|
+
isUsingGlobalQueryFallback: isUsingGlobalQueryFallback
|
|
67
128
|
};
|
|
68
129
|
}, [columnSchemes, querySchemes, currentSchemes, gridKey]);
|
|
69
130
|
}
|
|
@@ -68,7 +68,8 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
68
68
|
applySchemeToGlobal = _useGridSchemes.applySchemeToGlobal,
|
|
69
69
|
resetToGlobal = _useGridSchemes.resetToGlobal,
|
|
70
70
|
resetAllUsers = _useGridSchemes.resetAllUsers,
|
|
71
|
-
globalConfigPermissions = _useGridSchemes.globalConfigPermissions
|
|
71
|
+
globalConfigPermissions = _useGridSchemes.globalConfigPermissions,
|
|
72
|
+
isUsingGlobalFallback = _useGridSchemes.isUsingGlobalFallback;
|
|
72
73
|
|
|
73
74
|
// 解构权限信息
|
|
74
75
|
var canApplyToGlobal = (_globalConfigPermissi = globalConfigPermissions === null || globalConfigPermissions === void 0 ? void 0 : globalConfigPermissions.canApplyToGlobal) !== null && _globalConfigPermissi !== void 0 ? _globalConfigPermissi : false;
|
|
@@ -1162,7 +1163,12 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
1162
1163
|
fontWeight: 'normal',
|
|
1163
1164
|
color: '#1890ff'
|
|
1164
1165
|
}
|
|
1165
|
-
}, "- \u5F53\u524D\u65B9\u6848: ", currentScheme.name
|
|
1166
|
+
}, "- \u5F53\u524D\u65B9\u6848: ", currentScheme.name, isUsingGlobalFallback && currentScheme.isGlobal && /*#__PURE__*/_react.default.createElement(_antd.Tag, {
|
|
1167
|
+
color: "orange",
|
|
1168
|
+
style: {
|
|
1169
|
+
marginLeft: 8
|
|
1170
|
+
}
|
|
1171
|
+
}, "\u81EA\u52A8\u4F7F\u7528\u5168\u5C40"))),
|
|
1166
1172
|
open: visible,
|
|
1167
1173
|
onCancel: handleClose,
|
|
1168
1174
|
width: 1100,
|
|
@@ -5,9 +5,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.defaultLocalStorageAdapter = exports.LocalStorageSchemeAdapter = void 0;
|
|
7
7
|
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); }
|
|
8
|
+
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
9
|
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; }
|
|
9
10
|
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; }
|
|
10
|
-
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; }
|
|
11
11
|
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); } }
|
|
12
12
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
13
13
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
@@ -115,13 +115,35 @@ var LocalStorageSchemeAdapter = exports.LocalStorageSchemeAdapter = /*#__PURE__*
|
|
|
115
115
|
while (1) switch (_context.prev = _context.next) {
|
|
116
116
|
case 0:
|
|
117
117
|
this.log('加载所有方案数据');
|
|
118
|
-
data = this.readData();
|
|
118
|
+
data = this.readData(); // 【修复】确保所有方案都有 isGlobal 字段
|
|
119
|
+
// 如果没有设置,默认为 false(非全局方案)
|
|
120
|
+
// @author nokecy
|
|
121
|
+
if (data.columnSchemes) {
|
|
122
|
+
Object.keys(data.columnSchemes).forEach(function (gridId) {
|
|
123
|
+
data.columnSchemes[gridId] = data.columnSchemes[gridId].map(function (scheme) {
|
|
124
|
+
var _scheme$isGlobal;
|
|
125
|
+
return _objectSpread(_objectSpread({}, scheme), {}, {
|
|
126
|
+
isGlobal: (_scheme$isGlobal = scheme.isGlobal) !== null && _scheme$isGlobal !== void 0 ? _scheme$isGlobal : false
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
if (data.querySchemes) {
|
|
132
|
+
Object.keys(data.querySchemes).forEach(function (gridId) {
|
|
133
|
+
data.querySchemes[gridId] = data.querySchemes[gridId].map(function (scheme) {
|
|
134
|
+
var _isGlobal;
|
|
135
|
+
return _objectSpread(_objectSpread({}, scheme), {}, {
|
|
136
|
+
isGlobal: (_isGlobal = scheme.isGlobal) !== null && _isGlobal !== void 0 ? _isGlobal : false
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
}
|
|
119
141
|
this.log('加载完成', {
|
|
120
142
|
columnSchemes: Object.keys(data.columnSchemes).length,
|
|
121
143
|
querySchemes: Object.keys(data.querySchemes).length
|
|
122
144
|
});
|
|
123
145
|
return _context.abrupt("return", data);
|
|
124
|
-
case
|
|
146
|
+
case 6:
|
|
125
147
|
case "end":
|
|
126
148
|
return _context.stop();
|
|
127
149
|
}
|
|
@@ -136,7 +158,8 @@ var LocalStorageSchemeAdapter = exports.LocalStorageSchemeAdapter = /*#__PURE__*
|
|
|
136
158
|
key: "saveColumnScheme",
|
|
137
159
|
value: function () {
|
|
138
160
|
var _saveColumnScheme = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(gridId, scheme) {
|
|
139
|
-
var
|
|
161
|
+
var _savedScheme$isGlobal;
|
|
162
|
+
var data, index, newScheme, savedScheme;
|
|
140
163
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
141
164
|
while (1) switch (_context2.prev = _context2.next) {
|
|
142
165
|
case 0:
|
|
@@ -163,8 +186,13 @@ var LocalStorageSchemeAdapter = exports.LocalStorageSchemeAdapter = /*#__PURE__*
|
|
|
163
186
|
this.log("\u65B0\u589E\u5217\u65B9\u6848: ".concat(gridId, " - ").concat(scheme.name));
|
|
164
187
|
}
|
|
165
188
|
this.writeData(data);
|
|
166
|
-
|
|
167
|
-
|
|
189
|
+
|
|
190
|
+
// 【修复】确保返回的方案包含 isGlobal 字段 @author nokecy
|
|
191
|
+
savedScheme = data.columnSchemes[gridId][index >= 0 ? index : data.columnSchemes[gridId].length - 1];
|
|
192
|
+
return _context2.abrupt("return", _objectSpread(_objectSpread({}, savedScheme), {}, {
|
|
193
|
+
isGlobal: (_savedScheme$isGlobal = savedScheme.isGlobal) !== null && _savedScheme$isGlobal !== void 0 ? _savedScheme$isGlobal : false
|
|
194
|
+
}));
|
|
195
|
+
case 7:
|
|
168
196
|
case "end":
|
|
169
197
|
return _context2.stop();
|
|
170
198
|
}
|
|
@@ -274,7 +274,9 @@ function AgGridPlus(props) {
|
|
|
274
274
|
currentQuerySchemes = schemeDataFlow.querySchemes,
|
|
275
275
|
currentQueryScheme = schemeDataFlow.currentQueryScheme,
|
|
276
276
|
derivedColumnDefs = schemeDataFlow.derivedColumnDefs,
|
|
277
|
-
derivedColumnState = schemeDataFlow.derivedColumnState
|
|
277
|
+
derivedColumnState = schemeDataFlow.derivedColumnState,
|
|
278
|
+
isUsingGlobalFallback = schemeDataFlow.isUsingGlobalFallback,
|
|
279
|
+
isUsingGlobalQueryFallback = schemeDataFlow.isUsingGlobalQueryFallback;
|
|
278
280
|
useImperativeHandle(propsGridRef, function () {
|
|
279
281
|
return gridRef.current;
|
|
280
282
|
});
|
|
@@ -1254,7 +1256,10 @@ function AgGridPlus(props) {
|
|
|
1254
1256
|
globalConfigPermissions: globalConfigPermissions,
|
|
1255
1257
|
applySchemeToGlobal: applySchemeToGlobal,
|
|
1256
1258
|
resetToGlobal: resetToGlobal,
|
|
1257
|
-
resetAllUsers: resetAllUsers
|
|
1259
|
+
resetAllUsers: resetAllUsers,
|
|
1260
|
+
// ========== 全局方案回退状态 @author nokecy ==========
|
|
1261
|
+
isUsingGlobalFallback: isUsingGlobalFallback,
|
|
1262
|
+
isUsingGlobalQueryFallback: isUsingGlobalQueryFallback
|
|
1258
1263
|
};
|
|
1259
1264
|
}, [extensibleColumns, gridPlusColumnState, allColDefsRef.current,
|
|
1260
1265
|
// 【修复】添加到依赖数组
|
|
@@ -1264,7 +1269,9 @@ function AgGridPlus(props) {
|
|
|
1264
1269
|
// 方案管理依赖
|
|
1265
1270
|
columnSchemes, querySchemes, currentSchemes, schemesLoading, lastSyncTime, saveColumnScheme, deleteColumnScheme, saveQueryScheme, deleteQueryScheme, setCurrentColumnScheme, setCurrentQueryScheme, refreshSchemes, getColumnSchemes, getQuerySchemes, getCurrentScheme,
|
|
1266
1271
|
// 全局配置依赖
|
|
1267
|
-
globalConfigPermissions, applySchemeToGlobal, resetToGlobal, resetAllUsers
|
|
1272
|
+
globalConfigPermissions, applySchemeToGlobal, resetToGlobal, resetAllUsers,
|
|
1273
|
+
// 全局方案回退状态依赖 @author nokecy
|
|
1274
|
+
isUsingGlobalFallback, isUsingGlobalQueryFallback]);
|
|
1268
1275
|
return /*#__PURE__*/React.createElement(GridPlusContext.Provider, {
|
|
1269
1276
|
value: gridPlusContextValue
|
|
1270
1277
|
}, /*#__PURE__*/React.createElement(Spin, {
|
|
@@ -166,5 +166,14 @@ export interface GridPlusContextValue extends SchemeManagementAPI {
|
|
|
166
166
|
* 由使用端(业务应用)传入,用于前端根据权限动态显示/隐藏操作按钮
|
|
167
167
|
*/
|
|
168
168
|
globalConfigPermissions?: GlobalConfigPermissions;
|
|
169
|
+
/**
|
|
170
|
+
* 是否使用全局列方案作为回退
|
|
171
|
+
* 当没有用户方案时自动使用全局方案,此时为 true
|
|
172
|
+
*/
|
|
173
|
+
isUsingGlobalFallback?: boolean;
|
|
174
|
+
/**
|
|
175
|
+
* 是否使用全局查询方案作为回退
|
|
176
|
+
*/
|
|
177
|
+
isUsingGlobalQueryFallback?: boolean;
|
|
169
178
|
}
|
|
170
179
|
export declare const GridPlusContext: React.Context<GridPlusContextValue>;
|
|
@@ -32,9 +32,13 @@ export declare function useSchemeSource(gridKey: string, schemeData: SchemeData)
|
|
|
32
32
|
columnSchemes: ColumnScheme[];
|
|
33
33
|
currentColumnSchemeId: string | null | undefined;
|
|
34
34
|
currentColumnScheme: ColumnScheme | undefined;
|
|
35
|
+
/** 是否使用全局方案作为回退(没有用户方案时自动使用全局方案) */
|
|
36
|
+
isUsingGlobalFallback: boolean;
|
|
35
37
|
querySchemes: QueryScheme[];
|
|
36
38
|
currentQuerySchemeId: string | null | undefined;
|
|
37
39
|
currentQueryScheme: QueryScheme | undefined;
|
|
40
|
+
/** 是否使用全局查询方案作为回退 */
|
|
41
|
+
isUsingGlobalQueryFallback: boolean;
|
|
38
42
|
};
|
|
39
43
|
/**
|
|
40
44
|
* 派生层 - 计算 Grid 状态(只读派生)
|
|
@@ -83,7 +87,11 @@ export declare function useSchemeDataFlow(gridKey: string, allColDefs: ExtendedC
|
|
|
83
87
|
columnSchemes: ColumnScheme[];
|
|
84
88
|
currentColumnSchemeId: string | null | undefined;
|
|
85
89
|
currentColumnScheme: ColumnScheme | undefined;
|
|
90
|
+
/** 是否使用全局方案作为回退(没有用户方案时自动使用全局方案) */
|
|
91
|
+
isUsingGlobalFallback: boolean;
|
|
86
92
|
querySchemes: QueryScheme[];
|
|
87
93
|
currentQuerySchemeId: string | null | undefined;
|
|
88
94
|
currentQueryScheme: QueryScheme | undefined;
|
|
95
|
+
/** 是否使用全局查询方案作为回退 */
|
|
96
|
+
isUsingGlobalQueryFallback: boolean;
|
|
89
97
|
};
|
|
@@ -39,23 +39,84 @@ export function useSchemeSource(gridKey, schemeData) {
|
|
|
39
39
|
var _currentSchemes$gridK, _currentSchemes$gridK2;
|
|
40
40
|
var schemes = (columnSchemes === null || columnSchemes === void 0 ? void 0 : columnSchemes[gridKey]) || [];
|
|
41
41
|
var currentColumnSchemeId = currentSchemes === null || currentSchemes === void 0 || (_currentSchemes$gridK = currentSchemes[gridKey]) === null || _currentSchemes$gridK === void 0 ? void 0 : _currentSchemes$gridK.columnSchemeId;
|
|
42
|
+
|
|
43
|
+
// 优先使用当前用户方案,如果没有则自动使用全局方案
|
|
44
|
+
// @author nokecy
|
|
42
45
|
var currentColumnScheme = schemes.find(function (s) {
|
|
43
46
|
return s.id === currentColumnSchemeId;
|
|
44
47
|
});
|
|
48
|
+
var isUsingGlobalFallback = false;
|
|
49
|
+
if (!currentColumnScheme && schemes.length > 0) {
|
|
50
|
+
// 没有当前用户方案,查找全局方案
|
|
51
|
+
var globalSchemes = schemes.filter(function (s) {
|
|
52
|
+
return s.isGlobal === true;
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
// 多个全局方案警告 @author nokecy
|
|
56
|
+
if (globalSchemes.length > 1) {
|
|
57
|
+
console.warn('[useSchemeSource] 检测到多个全局方案,将使用第一个', {
|
|
58
|
+
gridKey: gridKey,
|
|
59
|
+
globalSchemeCount: globalSchemes.length,
|
|
60
|
+
globalSchemes: globalSchemes.map(function (s) {
|
|
61
|
+
return {
|
|
62
|
+
id: s.id,
|
|
63
|
+
name: s.name
|
|
64
|
+
};
|
|
65
|
+
})
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
var globalScheme = globalSchemes[0];
|
|
69
|
+
if (globalScheme) {
|
|
70
|
+
currentColumnScheme = globalScheme;
|
|
71
|
+
isUsingGlobalFallback = true;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
45
74
|
var querySchemeList = (querySchemes === null || querySchemes === void 0 ? void 0 : querySchemes[gridKey]) || [];
|
|
46
75
|
var currentQuerySchemeId = currentSchemes === null || currentSchemes === void 0 || (_currentSchemes$gridK2 = currentSchemes[gridKey]) === null || _currentSchemes$gridK2 === void 0 ? void 0 : _currentSchemes$gridK2.querySchemeId;
|
|
76
|
+
|
|
77
|
+
// 查询方案也采用相同的回退逻辑
|
|
78
|
+
// @author nokecy
|
|
47
79
|
var currentQueryScheme = querySchemeList.find(function (s) {
|
|
48
80
|
return s.id === currentQuerySchemeId;
|
|
49
81
|
});
|
|
82
|
+
var isUsingGlobalQueryFallback = false;
|
|
83
|
+
if (!currentQueryScheme && querySchemeList.length > 0) {
|
|
84
|
+
var globalQuerySchemes = querySchemeList.filter(function (s) {
|
|
85
|
+
return s.isGlobal === true;
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
// 多个全局查询方案警告 @author nokecy
|
|
89
|
+
if (globalQuerySchemes.length > 1) {
|
|
90
|
+
console.warn('[useSchemeSource] 检测到多个全局查询方案,将使用第一个', {
|
|
91
|
+
gridKey: gridKey,
|
|
92
|
+
globalSchemeCount: globalQuerySchemes.length,
|
|
93
|
+
globalSchemes: globalQuerySchemes.map(function (s) {
|
|
94
|
+
return {
|
|
95
|
+
id: s.id,
|
|
96
|
+
name: s.name
|
|
97
|
+
};
|
|
98
|
+
})
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
var globalQueryScheme = globalQuerySchemes[0];
|
|
102
|
+
if (globalQueryScheme) {
|
|
103
|
+
currentQueryScheme = globalQueryScheme;
|
|
104
|
+
isUsingGlobalQueryFallback = true;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
50
107
|
return {
|
|
51
108
|
// 列方案
|
|
52
109
|
columnSchemes: schemes,
|
|
53
110
|
currentColumnSchemeId: currentColumnSchemeId,
|
|
54
111
|
currentColumnScheme: currentColumnScheme,
|
|
112
|
+
/** 是否使用全局方案作为回退(没有用户方案时自动使用全局方案) */
|
|
113
|
+
isUsingGlobalFallback: isUsingGlobalFallback,
|
|
55
114
|
// 查询方案
|
|
56
115
|
querySchemes: querySchemeList,
|
|
57
116
|
currentQuerySchemeId: currentQuerySchemeId,
|
|
58
|
-
currentQueryScheme: currentQueryScheme
|
|
117
|
+
currentQueryScheme: currentQueryScheme,
|
|
118
|
+
/** 是否使用全局查询方案作为回退 */
|
|
119
|
+
isUsingGlobalQueryFallback: isUsingGlobalQueryFallback
|
|
59
120
|
};
|
|
60
121
|
}, [columnSchemes, querySchemes, currentSchemes, gridKey]);
|
|
61
122
|
}
|
|
@@ -61,7 +61,8 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
61
61
|
applySchemeToGlobal = _useGridSchemes.applySchemeToGlobal,
|
|
62
62
|
resetToGlobal = _useGridSchemes.resetToGlobal,
|
|
63
63
|
resetAllUsers = _useGridSchemes.resetAllUsers,
|
|
64
|
-
globalConfigPermissions = _useGridSchemes.globalConfigPermissions
|
|
64
|
+
globalConfigPermissions = _useGridSchemes.globalConfigPermissions,
|
|
65
|
+
isUsingGlobalFallback = _useGridSchemes.isUsingGlobalFallback;
|
|
65
66
|
|
|
66
67
|
// 解构权限信息
|
|
67
68
|
var canApplyToGlobal = (_globalConfigPermissi = globalConfigPermissions === null || globalConfigPermissions === void 0 ? void 0 : globalConfigPermissions.canApplyToGlobal) !== null && _globalConfigPermissi !== void 0 ? _globalConfigPermissi : false;
|
|
@@ -1155,7 +1156,12 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
1155
1156
|
fontWeight: 'normal',
|
|
1156
1157
|
color: '#1890ff'
|
|
1157
1158
|
}
|
|
1158
|
-
}, "- \u5F53\u524D\u65B9\u6848: ", currentScheme.name
|
|
1159
|
+
}, "- \u5F53\u524D\u65B9\u6848: ", currentScheme.name, isUsingGlobalFallback && currentScheme.isGlobal && /*#__PURE__*/React.createElement(Tag, {
|
|
1160
|
+
color: "orange",
|
|
1161
|
+
style: {
|
|
1162
|
+
marginLeft: 8
|
|
1163
|
+
}
|
|
1164
|
+
}, "\u81EA\u52A8\u4F7F\u7528\u5168\u5C40"))),
|
|
1159
1165
|
open: visible,
|
|
1160
1166
|
onCancel: handleClose,
|
|
1161
1167
|
width: 1100,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _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; }
|
|
2
3
|
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; }
|
|
3
4
|
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; }
|
|
4
|
-
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; }
|
|
5
5
|
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); } }
|
|
6
6
|
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); }); }; }
|
|
7
7
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
@@ -110,13 +110,35 @@ export var LocalStorageSchemeAdapter = /*#__PURE__*/function () {
|
|
|
110
110
|
while (1) switch (_context.prev = _context.next) {
|
|
111
111
|
case 0:
|
|
112
112
|
this.log('加载所有方案数据');
|
|
113
|
-
data = this.readData();
|
|
113
|
+
data = this.readData(); // 【修复】确保所有方案都有 isGlobal 字段
|
|
114
|
+
// 如果没有设置,默认为 false(非全局方案)
|
|
115
|
+
// @author nokecy
|
|
116
|
+
if (data.columnSchemes) {
|
|
117
|
+
Object.keys(data.columnSchemes).forEach(function (gridId) {
|
|
118
|
+
data.columnSchemes[gridId] = data.columnSchemes[gridId].map(function (scheme) {
|
|
119
|
+
var _scheme$isGlobal;
|
|
120
|
+
return _objectSpread(_objectSpread({}, scheme), {}, {
|
|
121
|
+
isGlobal: (_scheme$isGlobal = scheme.isGlobal) !== null && _scheme$isGlobal !== void 0 ? _scheme$isGlobal : false
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
if (data.querySchemes) {
|
|
127
|
+
Object.keys(data.querySchemes).forEach(function (gridId) {
|
|
128
|
+
data.querySchemes[gridId] = data.querySchemes[gridId].map(function (scheme) {
|
|
129
|
+
var _isGlobal;
|
|
130
|
+
return _objectSpread(_objectSpread({}, scheme), {}, {
|
|
131
|
+
isGlobal: (_isGlobal = scheme.isGlobal) !== null && _isGlobal !== void 0 ? _isGlobal : false
|
|
132
|
+
});
|
|
133
|
+
});
|
|
134
|
+
});
|
|
135
|
+
}
|
|
114
136
|
this.log('加载完成', {
|
|
115
137
|
columnSchemes: Object.keys(data.columnSchemes).length,
|
|
116
138
|
querySchemes: Object.keys(data.querySchemes).length
|
|
117
139
|
});
|
|
118
140
|
return _context.abrupt("return", data);
|
|
119
|
-
case
|
|
141
|
+
case 6:
|
|
120
142
|
case "end":
|
|
121
143
|
return _context.stop();
|
|
122
144
|
}
|
|
@@ -131,7 +153,8 @@ export var LocalStorageSchemeAdapter = /*#__PURE__*/function () {
|
|
|
131
153
|
key: "saveColumnScheme",
|
|
132
154
|
value: function () {
|
|
133
155
|
var _saveColumnScheme = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(gridId, scheme) {
|
|
134
|
-
var
|
|
156
|
+
var _savedScheme$isGlobal;
|
|
157
|
+
var data, index, newScheme, savedScheme;
|
|
135
158
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
136
159
|
while (1) switch (_context2.prev = _context2.next) {
|
|
137
160
|
case 0:
|
|
@@ -158,8 +181,13 @@ export var LocalStorageSchemeAdapter = /*#__PURE__*/function () {
|
|
|
158
181
|
this.log("\u65B0\u589E\u5217\u65B9\u6848: ".concat(gridId, " - ").concat(scheme.name));
|
|
159
182
|
}
|
|
160
183
|
this.writeData(data);
|
|
161
|
-
|
|
162
|
-
|
|
184
|
+
|
|
185
|
+
// 【修复】确保返回的方案包含 isGlobal 字段 @author nokecy
|
|
186
|
+
savedScheme = data.columnSchemes[gridId][index >= 0 ? index : data.columnSchemes[gridId].length - 1];
|
|
187
|
+
return _context2.abrupt("return", _objectSpread(_objectSpread({}, savedScheme), {}, {
|
|
188
|
+
isGlobal: (_savedScheme$isGlobal = savedScheme.isGlobal) !== null && _savedScheme$isGlobal !== void 0 ? _savedScheme$isGlobal : false
|
|
189
|
+
}));
|
|
190
|
+
case 7:
|
|
163
191
|
case "end":
|
|
164
192
|
return _context2.stop();
|
|
165
193
|
}
|