@nokecy/qc-ui 1.1.31 → 1.1.32

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.
Files changed (27) hide show
  1. package/dist/cjs/ag-grid-plus/ag-gridPlus.js +14 -3
  2. package/dist/cjs/ag-grid-plus/context/gridContext.d.ts +22 -0
  3. package/dist/cjs/ag-grid-plus/context/useSchemeManager.d.ts +3 -0
  4. package/dist/cjs/ag-grid-plus/context/useSchemeManager.js +160 -1
  5. package/dist/cjs/ag-grid-plus/index.d.ts +1 -0
  6. package/dist/cjs/ag-grid-plus/setting/ColumnSetting.js +192 -50
  7. package/dist/cjs/ag-grid-plus/shared/permissions/globalConfigPermissions.d.ts +22 -0
  8. package/dist/cjs/ag-grid-plus/shared/permissions/globalConfigPermissions.js +5 -0
  9. package/dist/cjs/ag-grid-plus/shared/storage/localStorageAdapter.d.ts +18 -0
  10. package/dist/cjs/ag-grid-plus/shared/storage/localStorageAdapter.js +114 -0
  11. package/dist/cjs/ag-grid-plus/shared/storage/schemeStorageAdapter.d.ts +25 -0
  12. package/dist/cjs/index.d.ts +1 -1
  13. package/dist/esm/ag-grid-plus/ag-gridPlus.js +14 -3
  14. package/dist/esm/ag-grid-plus/context/gridContext.d.ts +22 -0
  15. package/dist/esm/ag-grid-plus/context/useSchemeManager.d.ts +3 -0
  16. package/dist/esm/ag-grid-plus/context/useSchemeManager.js +160 -1
  17. package/dist/esm/ag-grid-plus/index.d.ts +1 -0
  18. package/dist/esm/ag-grid-plus/index.js +2 -0
  19. package/dist/esm/ag-grid-plus/setting/ColumnSetting.js +195 -51
  20. package/dist/esm/ag-grid-plus/shared/permissions/globalConfigPermissions.d.ts +22 -0
  21. package/dist/esm/ag-grid-plus/shared/permissions/globalConfigPermissions.js +1 -0
  22. package/dist/esm/ag-grid-plus/shared/storage/localStorageAdapter.d.ts +18 -0
  23. package/dist/esm/ag-grid-plus/shared/storage/localStorageAdapter.js +114 -0
  24. package/dist/esm/ag-grid-plus/shared/storage/schemeStorageAdapter.d.ts +25 -0
  25. package/dist/esm/index.d.ts +1 -1
  26. package/dist/umd/qc-ui.min.js +1 -1
  27. package/package.json +1 -1
@@ -0,0 +1,22 @@
1
+ /**
2
+ * 全局配置权限信息
3
+ * 由使用端(业务应用)统一传入,而非从后端 API 获取
4
+ * @author nokecy
5
+ *
6
+ * @example
7
+ * ```tsx
8
+ * <GridPlusContext.Provider value={{
9
+ * ...schemeManager,
10
+ * globalConfigPermissions: {
11
+ * canApplyToGlobal: currentUser.hasPermission('TableScheme.ManageGlobalConfig'),
12
+ * canResetAllUsers: currentUser.hasPermission('TableScheme.ManageGlobalConfig'),
13
+ * }
14
+ * }}>
15
+ * ```
16
+ */
17
+ export interface GlobalConfigPermissions {
18
+ /** 是否可以应用到全局 */
19
+ canApplyToGlobal: boolean;
20
+ /** 是否可以重置所有用户配置 */
21
+ canResetAllUsers: boolean;
22
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -42,6 +42,24 @@ export declare class LocalStorageSchemeAdapter implements SchemeStorageAdapter {
42
42
  saveQueryScheme(gridId: string, scheme: QueryScheme): Promise<QueryScheme>;
43
43
  deleteQueryScheme(gridId: string, schemeId: string): Promise<void>;
44
44
  setCurrentScheme(gridId: string, columnSchemeId: string | null, querySchemeId: string | null): Promise<void>;
45
+ /**
46
+ * 将方案应用到全局
47
+ * LocalStorage 实现: 将方案标记为 isGlobal=true
48
+ * @author nokecy
49
+ */
50
+ applyToGlobal(gridId: string, schemeId: string): Promise<string>;
51
+ /**
52
+ * 重置为全局配置
53
+ * LocalStorage 实现: 清除当前方案选择,让其回退到全局方案
54
+ * @author nokecy
55
+ */
56
+ resetToGlobal(gridId: string): Promise<void>;
57
+ /**
58
+ * 重置所有用户配置
59
+ * LocalStorage 实现: 删除所有非全局方案,清除当前方案选择
60
+ * @author nokecy
61
+ */
62
+ resetAllUsers(gridId: string): Promise<void>;
45
63
  /**
46
64
  * 清除所有数据
47
65
  */
@@ -325,10 +325,124 @@ var LocalStorageSchemeAdapter = exports.LocalStorageSchemeAdapter = /*#__PURE__*
325
325
  return _setCurrentScheme.apply(this, arguments);
326
326
  }
327
327
  return setCurrentScheme;
328
+ }() // ========== 全局配置操作(模拟实现) ==========
329
+ /**
330
+ * 将方案应用到全局
331
+ * LocalStorage 实现: 将方案标记为 isGlobal=true
332
+ * @author nokecy
333
+ */
334
+ }, {
335
+ key: "applyToGlobal",
336
+ value: function () {
337
+ var _applyToGlobal = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(gridId, schemeId) {
338
+ var data, schemes, scheme;
339
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
340
+ while (1) switch (_context7.prev = _context7.next) {
341
+ case 0:
342
+ data = this.readData();
343
+ schemes = data.columnSchemes[gridId] || [];
344
+ scheme = schemes.find(function (s) {
345
+ return s.id === schemeId;
346
+ });
347
+ if (scheme) {
348
+ _context7.next = 5;
349
+ break;
350
+ }
351
+ throw new Error("\u65B9\u6848\u4E0D\u5B58\u5728: ".concat(schemeId));
352
+ case 5:
353
+ // 先将所有方案的 isGlobal 设为 false
354
+ schemes.forEach(function (s) {
355
+ s.isGlobal = false;
356
+ });
357
+
358
+ // 将目标方案标记为全局方案
359
+ scheme.isGlobal = true;
360
+ scheme.updatedAt = Date.now();
361
+ this.log("\u5E94\u7528\u5230\u5168\u5C40: ".concat(gridId, " - ").concat(scheme.name));
362
+ this.writeData(data);
363
+ return _context7.abrupt("return", schemeId);
364
+ case 11:
365
+ case "end":
366
+ return _context7.stop();
367
+ }
368
+ }, _callee7, this);
369
+ }));
370
+ function applyToGlobal(_x12, _x13) {
371
+ return _applyToGlobal.apply(this, arguments);
372
+ }
373
+ return applyToGlobal;
374
+ }()
375
+ /**
376
+ * 重置为全局配置
377
+ * LocalStorage 实现: 清除当前方案选择,让其回退到全局方案
378
+ * @author nokecy
379
+ */
380
+ }, {
381
+ key: "resetToGlobal",
382
+ value: (function () {
383
+ var _resetToGlobal = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(gridId) {
384
+ var data;
385
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
386
+ while (1) switch (_context8.prev = _context8.next) {
387
+ case 0:
388
+ data = this.readData(); // 清除当前用户的列方案选择
389
+ if (data.currentSchemes[gridId]) {
390
+ data.currentSchemes[gridId].columnSchemeId = null;
391
+ }
392
+ this.log("\u91CD\u7F6E\u4E3A\u5168\u5C40\u914D\u7F6E: ".concat(gridId));
393
+ this.writeData(data);
394
+ case 4:
395
+ case "end":
396
+ return _context8.stop();
397
+ }
398
+ }, _callee8, this);
399
+ }));
400
+ function resetToGlobal(_x14) {
401
+ return _resetToGlobal.apply(this, arguments);
402
+ }
403
+ return resetToGlobal;
404
+ }()
405
+ /**
406
+ * 重置所有用户配置
407
+ * LocalStorage 实现: 删除所有非全局方案,清除当前方案选择
408
+ * @author nokecy
409
+ */
410
+ )
411
+ }, {
412
+ key: "resetAllUsers",
413
+ value: (function () {
414
+ var _resetAllUsers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(gridId) {
415
+ var data, schemes;
416
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
417
+ while (1) switch (_context9.prev = _context9.next) {
418
+ case 0:
419
+ data = this.readData();
420
+ schemes = data.columnSchemes[gridId] || []; // 只保留全局方案
421
+ data.columnSchemes[gridId] = schemes.filter(function (s) {
422
+ return s.isGlobal;
423
+ });
424
+
425
+ // 清除当前方案选择
426
+ if (data.currentSchemes[gridId]) {
427
+ data.currentSchemes[gridId].columnSchemeId = null;
428
+ }
429
+ this.log("\u91CD\u7F6E\u6240\u6709\u7528\u6237\u914D\u7F6E: ".concat(gridId, "\uFF0C\u4FDD\u7559 ").concat(data.columnSchemes[gridId].length, " \u4E2A\u5168\u5C40\u65B9\u6848"));
430
+ this.writeData(data);
431
+ case 6:
432
+ case "end":
433
+ return _context9.stop();
434
+ }
435
+ }, _callee9, this);
436
+ }));
437
+ function resetAllUsers(_x15) {
438
+ return _resetAllUsers.apply(this, arguments);
439
+ }
440
+ return resetAllUsers;
328
441
  }() // ========== 工具方法 ==========
329
442
  /**
330
443
  * 清除所有数据
331
444
  */
445
+ )
332
446
  }, {
333
447
  key: "clearAll",
334
448
  value: function clearAll() {
@@ -101,6 +101,8 @@ export interface ColumnScheme {
101
101
  updatedAt?: number;
102
102
  /** 创建用户ID(可选) */
103
103
  createdBy?: string;
104
+ /** 方案来源标识(便于前端区分展示,由前端计算) */
105
+ isGlobal?: boolean;
104
106
  }
105
107
  /**
106
108
  * 方案同步数据结构
@@ -172,6 +174,29 @@ export interface SchemeStorageAdapter {
172
174
  * @param querySchemeId 查询方案ID (null 表示清除)
173
175
  */
174
176
  setCurrentScheme(gridId: string, columnSchemeId: string | null, querySchemeId: string | null): Promise<void>;
177
+ /**
178
+ * 将方案应用到全局(管理员操作)
179
+ * 将指定的用户方案复制为 UserId=null 的全局方案
180
+ * @param gridId 表格标识
181
+ * @param schemeId 源方案ID(用户的方案)
182
+ * @returns 全局方案ID
183
+ * @throws 403 - 无权限
184
+ * @throws 404 - 源方案不存在
185
+ */
186
+ applyToGlobal?(gridId: string, schemeId: string): Promise<string>;
187
+ /**
188
+ * 重置当前用户配置,回退到全局配置
189
+ * 删除当前用户在指定表格的所有个人方案
190
+ * @param gridId 表格标识
191
+ */
192
+ resetToGlobal?(gridId: string): Promise<void>;
193
+ /**
194
+ * 重置所有用户配置(管理员操作)
195
+ * 删除指定表格下所有用户的个人方案,保留全局方案
196
+ * @param gridId 表格标识
197
+ * @throws 403 - 无权限
198
+ */
199
+ resetAllUsers?(gridId: string): Promise<void>;
175
200
  }
176
201
  /**
177
202
  * 适配器配置基类
@@ -29,5 +29,5 @@ export type * from "./importModal";
29
29
  export type * from "./fullScreenAlert";
30
30
  export type * from "./RuleBuilder";
31
31
  export type { ColumnConfig } from "./array-table/columnHelper";
32
- export type { CentralizedColumnScheme, QueryScheme, SchemeStorageAdapter, SchemeSyncDataDto, CurrentSchemeDto, SchemeStorageConfig, LocalStorageAdapterConfig, BackendApiAdapterConfig, UseSchemeManagerConfig, GridPlusContextValue, } from "./ag-grid-plus";
32
+ export type { CentralizedColumnScheme, QueryScheme, SchemeStorageAdapter, SchemeSyncDataDto, CurrentSchemeDto, SchemeStorageConfig, LocalStorageAdapterConfig, BackendApiAdapterConfig, UseSchemeManagerConfig, GridPlusContextValue, GlobalConfigPermissions, } from "./ag-grid-plus";
33
33
  export type { ParseResult as RegexParseResult, ValidationResult as RegexValidationResult, RegexError, ComplexityMetrics, ASTNode, AstRegExp, RegexTemplate, TestResult as RegexTestResult, CodeMirrorWrapperProps, RegexEditorProps, RegexFlags, MatchResult, RegexTesterProps, FlagsSelectorProps, MatchItemProps, RegexRailroadDiagramProps, } from "./components/RegexEditor";
@@ -92,7 +92,11 @@ function AgGridPlus(props) {
92
92
  extensibleColumns = _useGridPlusColumnSta.extensibleColumns,
93
93
  applyToGlobal = _useGridPlusColumnSta.applyToGlobal,
94
94
  resetCurrent = _useGridPlusColumnSta.resetCurrent,
95
- resetAll = _useGridPlusColumnSta.resetAll;
95
+ resetAll = _useGridPlusColumnSta.resetAll,
96
+ globalConfigPermissions = _useGridPlusColumnSta.globalConfigPermissions,
97
+ applySchemeToGlobal = _useGridPlusColumnSta.applySchemeToGlobal,
98
+ resetToGlobal = _useGridPlusColumnSta.resetToGlobal,
99
+ resetAllUsers = _useGridPlusColumnSta.resetAllUsers;
96
100
  var gridRef = useRef();
97
101
  var apiRef = useRef();
98
102
  var allColDefsRef = useRef([]);
@@ -1245,7 +1249,12 @@ function AgGridPlus(props) {
1245
1249
  refreshSchemes: refreshSchemes,
1246
1250
  getColumnSchemes: getColumnSchemes,
1247
1251
  getQuerySchemes: getQuerySchemes,
1248
- getCurrentScheme: getCurrentScheme
1252
+ getCurrentScheme: getCurrentScheme,
1253
+ // ========== 全局配置 API(透传给子组件) ==========
1254
+ globalConfigPermissions: globalConfigPermissions,
1255
+ applySchemeToGlobal: applySchemeToGlobal,
1256
+ resetToGlobal: resetToGlobal,
1257
+ resetAllUsers: resetAllUsers
1249
1258
  };
1250
1259
  }, [extensibleColumns, gridPlusColumnState, allColDefsRef.current,
1251
1260
  // 【修复】添加到依赖数组
@@ -1253,7 +1262,9 @@ function AgGridPlus(props) {
1253
1262
  // 【新增】添加初始列定义到依赖数组
1254
1263
  onSaveColumnState, applyToGlobal, resetCurrent, resetAll, currentQueryScheme, queryItemsOrder, queryFormItems,
1255
1264
  // 方案管理依赖
1256
- columnSchemes, querySchemes, currentSchemes, schemesLoading, lastSyncTime, saveColumnScheme, deleteColumnScheme, saveQueryScheme, deleteQueryScheme, setCurrentColumnScheme, setCurrentQueryScheme, refreshSchemes, getColumnSchemes, getQuerySchemes, getCurrentScheme]);
1265
+ columnSchemes, querySchemes, currentSchemes, schemesLoading, lastSyncTime, saveColumnScheme, deleteColumnScheme, saveQueryScheme, deleteQueryScheme, setCurrentColumnScheme, setCurrentQueryScheme, refreshSchemes, getColumnSchemes, getQuerySchemes, getCurrentScheme,
1266
+ // 全局配置依赖
1267
+ globalConfigPermissions, applySchemeToGlobal, resetToGlobal, resetAllUsers]);
1257
1268
  return /*#__PURE__*/React.createElement(GridPlusContext.Provider, {
1258
1269
  value: gridPlusContextValue
1259
1270
  }, /*#__PURE__*/React.createElement(Spin, {
@@ -1,5 +1,6 @@
1
1
  import React from "react";
2
2
  import type { ColumnScheme, QueryScheme, CurrentSchemeDto } from "../shared/storage/schemeStorageAdapter";
3
+ import type { GlobalConfigPermissions } from '../shared/permissions/globalConfigPermissions';
3
4
  /**
4
5
  * 方案管理 API 接口
5
6
  *
@@ -144,5 +145,26 @@ export interface GridPlusContextValue extends SchemeManagementAPI {
144
145
  * 此字段由 useSchemeManager 自动管理,无需手动设置
145
146
  */
146
147
  currentUserId?: string | null;
148
+ /**
149
+ * 将当前列配置应用为全局默认(管理员操作)
150
+ * @param gridId 表格标识
151
+ * @param schemeId 源方案ID(可选,不传则使用当前激活的方案)
152
+ */
153
+ applySchemeToGlobal?: (gridId: string, schemeId?: string) => Promise<void>;
154
+ /**
155
+ * 重置当前用户配置,回退到全局配置
156
+ * @param gridId 表格标识
157
+ */
158
+ resetToGlobal?: (gridId: string) => Promise<void>;
159
+ /**
160
+ * 重置所有用户配置(管理员操作)
161
+ * @param gridId 表格标识
162
+ */
163
+ resetAllUsers?: (gridId: string) => Promise<void>;
164
+ /**
165
+ * 全局配置权限信息
166
+ * 由使用端(业务应用)传入,用于前端根据权限动态显示/隐藏操作按钮
167
+ */
168
+ globalConfigPermissions?: GlobalConfigPermissions;
147
169
  }
148
170
  export declare const GridPlusContext: React.Context<GridPlusContextValue>;
@@ -51,6 +51,9 @@ export declare function useSchemeManager(config: UseSchemeManagerConfig): {
51
51
  getColumnSchemes: (gridId: string) => ColumnScheme[];
52
52
  getQuerySchemes: (gridId: string) => QueryScheme[];
53
53
  getCurrentScheme: (gridId: string) => CurrentSchemeDto | null;
54
+ applySchemeToGlobal: (gridId: string, schemeId?: string) => Promise<string>;
55
+ resetToGlobal: (gridId: string) => Promise<void>;
56
+ resetAllUsers: (gridId: string) => Promise<void>;
54
57
  };
55
58
  /**
56
59
  * 在组件中使用集中式方案管理
@@ -430,6 +430,161 @@ export function useSchemeManager(config) {
430
430
  }
431
431
  }, _callee8);
432
432
  })), [loadAllSchemes]);
433
+
434
+ // ========== 全局配置操作 ==========
435
+
436
+ /**
437
+ * 处理全局配置操作的错误
438
+ * @author nokecy
439
+ */
440
+ var handleGlobalConfigError = useCallback(function (error, defaultMessage) {
441
+ var _error$response;
442
+ if (((_error$response = error.response) === null || _error$response === void 0 ? void 0 : _error$response.status) === 403) {
443
+ message.error('没有权限执行此操作');
444
+ } else {
445
+ message.error(error.message || defaultMessage);
446
+ }
447
+ }, []);
448
+
449
+ /**
450
+ * 将方案应用到全局(管理员操作)
451
+ * @author nokecy
452
+ */
453
+ var applySchemeToGlobal = useCallback( /*#__PURE__*/function () {
454
+ var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(gridId, schemeId) {
455
+ var _currentSchemes$gridI3;
456
+ var targetSchemeId, globalSchemeId;
457
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
458
+ while (1) switch (_context9.prev = _context9.next) {
459
+ case 0:
460
+ targetSchemeId = schemeId || ((_currentSchemes$gridI3 = currentSchemes[gridId]) === null || _currentSchemes$gridI3 === void 0 ? void 0 : _currentSchemes$gridI3.columnSchemeId);
461
+ if (targetSchemeId) {
462
+ _context9.next = 3;
463
+ break;
464
+ }
465
+ throw new Error('没有可应用的方案');
466
+ case 3:
467
+ if (adapter.applyToGlobal) {
468
+ _context9.next = 5;
469
+ break;
470
+ }
471
+ throw new Error('当前存储适配器不支持全局配置功能');
472
+ case 5:
473
+ _context9.prev = 5;
474
+ _context9.next = 8;
475
+ return adapter.applyToGlobal(gridId, targetSchemeId);
476
+ case 8:
477
+ globalSchemeId = _context9.sent;
478
+ message.success('已应用到全局配置');
479
+ _context9.next = 12;
480
+ return refreshSchemes();
481
+ case 12:
482
+ return _context9.abrupt("return", globalSchemeId);
483
+ case 15:
484
+ _context9.prev = 15;
485
+ _context9.t0 = _context9["catch"](5);
486
+ console.error('[useSchemeManager] 应用到全局失败:', _context9.t0);
487
+ handleGlobalConfigError(_context9.t0, '应用到全局失败');
488
+ throw _context9.t0;
489
+ case 20:
490
+ case "end":
491
+ return _context9.stop();
492
+ }
493
+ }, _callee9, null, [[5, 15]]);
494
+ }));
495
+ return function (_x13, _x14) {
496
+ return _ref9.apply(this, arguments);
497
+ };
498
+ }(), [adapter, currentSchemes, refreshSchemes, handleGlobalConfigError]);
499
+
500
+ /**
501
+ * 重置当前用户配置,回退到全局配置
502
+ * @author nokecy
503
+ */
504
+ var resetToGlobal = useCallback( /*#__PURE__*/function () {
505
+ var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(gridId) {
506
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
507
+ while (1) switch (_context10.prev = _context10.next) {
508
+ case 0:
509
+ if (adapter.resetToGlobal) {
510
+ _context10.next = 2;
511
+ break;
512
+ }
513
+ throw new Error('当前存储适配器不支持全局配置功能');
514
+ case 2:
515
+ _context10.prev = 2;
516
+ _context10.next = 5;
517
+ return adapter.resetToGlobal(gridId);
518
+ case 5:
519
+ setCurrentSchemes(function (prev) {
520
+ return _objectSpread(_objectSpread({}, prev), {}, _defineProperty({}, gridId, _objectSpread(_objectSpread({}, prev[gridId]), {}, {
521
+ columnSchemeId: null
522
+ })));
523
+ });
524
+ _context10.next = 8;
525
+ return refreshSchemes();
526
+ case 8:
527
+ message.success('已重置为全局配置');
528
+ _context10.next = 16;
529
+ break;
530
+ case 11:
531
+ _context10.prev = 11;
532
+ _context10.t0 = _context10["catch"](2);
533
+ console.error('[useSchemeManager] 重置为全局配置失败:', _context10.t0);
534
+ handleGlobalConfigError(_context10.t0, '重置失败');
535
+ throw _context10.t0;
536
+ case 16:
537
+ case "end":
538
+ return _context10.stop();
539
+ }
540
+ }, _callee10, null, [[2, 11]]);
541
+ }));
542
+ return function (_x15) {
543
+ return _ref10.apply(this, arguments);
544
+ };
545
+ }(), [adapter, refreshSchemes, handleGlobalConfigError]);
546
+
547
+ /**
548
+ * 重置所有用户配置(管理员操作)
549
+ * @author nokecy
550
+ */
551
+ var resetAllUsers = useCallback( /*#__PURE__*/function () {
552
+ var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(gridId) {
553
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
554
+ while (1) switch (_context11.prev = _context11.next) {
555
+ case 0:
556
+ if (adapter.resetAllUsers) {
557
+ _context11.next = 2;
558
+ break;
559
+ }
560
+ throw new Error('当前存储适配器不支持全局配置功能');
561
+ case 2:
562
+ _context11.prev = 2;
563
+ _context11.next = 5;
564
+ return adapter.resetAllUsers(gridId);
565
+ case 5:
566
+ _context11.next = 7;
567
+ return refreshSchemes();
568
+ case 7:
569
+ message.success('已重置所有用户配置');
570
+ _context11.next = 15;
571
+ break;
572
+ case 10:
573
+ _context11.prev = 10;
574
+ _context11.t0 = _context11["catch"](2);
575
+ console.error('[useSchemeManager] 重置所有用户配置失败:', _context11.t0);
576
+ handleGlobalConfigError(_context11.t0, '重置失败');
577
+ throw _context11.t0;
578
+ case 15:
579
+ case "end":
580
+ return _context11.stop();
581
+ }
582
+ }, _callee11, null, [[2, 10]]);
583
+ }));
584
+ return function (_x16) {
585
+ return _ref11.apply(this, arguments);
586
+ };
587
+ }(), [adapter, refreshSchemes, handleGlobalConfigError]);
433
588
  var getColumnSchemes = useCallback(function (gridId) {
434
589
  return columnSchemes[gridId] || [];
435
590
  }, [columnSchemes]);
@@ -461,7 +616,11 @@ export function useSchemeManager(config) {
461
616
  refreshSchemes: refreshSchemes,
462
617
  getColumnSchemes: getColumnSchemes,
463
618
  getQuerySchemes: getQuerySchemes,
464
- getCurrentScheme: getCurrentScheme
619
+ getCurrentScheme: getCurrentScheme,
620
+ // 全局配置操作
621
+ applySchemeToGlobal: applySchemeToGlobal,
622
+ resetToGlobal: resetToGlobal,
623
+ resetAllUsers: resetAllUsers
465
624
  };
466
625
  }
467
626
 
@@ -12,3 +12,4 @@ export type { SchemeStorageAdapter, SchemeSyncDataDto, CurrentSchemeDto, SchemeS
12
12
  export type { UseSchemeManagerConfig } from "./context/useSchemeManager";
13
13
  export type { BackendApiAdapterConfig } from "./shared/storage/backendApiAdapter";
14
14
  export type { LocalStorageAdapterConfig } from "./shared/storage/localStorageAdapter";
15
+ export type { GlobalConfigPermissions } from "./shared/permissions/globalConfigPermissions";
@@ -13,5 +13,7 @@ export { useSchemeManager, useGridSchemes } from "./context/useSchemeManager";
13
13
  export { LocalStorageSchemeAdapter } from "./shared/storage/localStorageAdapter";
14
14
  export { BackendApiSchemeAdapter } from "./shared/storage/backendApiAdapter";
15
15
 
16
+ // 权限相关类型
17
+
16
18
  // 注意: 旧的查询方案管理功能已废弃
17
19
  // 相关导出已移除,请使用集中式方案管理 API (useSchemeManager/useGridSchemes)