@nokecy/qc-ui 1.0.93 → 1.0.95

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 (156) hide show
  1. package/dist/cjs/ag-grid-plus/ag-gridPlus.js +262 -177
  2. package/dist/cjs/ag-grid-plus/context/gridContext.d.ts +79 -15
  3. package/dist/cjs/ag-grid-plus/context/gridContext.js +0 -4
  4. package/dist/cjs/ag-grid-plus/context/useSchemeDataFlow.d.ts +88 -0
  5. package/dist/cjs/ag-grid-plus/context/useSchemeDataFlow.js +173 -0
  6. package/dist/cjs/ag-grid-plus/context/useSchemeManager.d.ts +78 -0
  7. package/dist/cjs/ag-grid-plus/{querySchemes/hooks/useQuerySchemes.js → context/useSchemeManager.js} +421 -449
  8. package/dist/cjs/ag-grid-plus/hooks/useAgGridCalculation.d.ts +1 -1
  9. package/dist/cjs/ag-grid-plus/hooks/useAgGridData.d.ts +2 -2
  10. package/dist/cjs/ag-grid-plus/index.d.ts +7 -4
  11. package/dist/cjs/ag-grid-plus/index.js +11 -154
  12. package/dist/cjs/ag-grid-plus/interface.d.ts +0 -31
  13. package/dist/cjs/ag-grid-plus/interface.js +3 -0
  14. package/dist/cjs/ag-grid-plus/setting/ColumnSetting.d.ts +0 -3
  15. package/dist/cjs/ag-grid-plus/setting/ColumnSetting.js +430 -412
  16. package/dist/cjs/ag-grid-plus/setting/QuerySchemeManager.d.ts +11 -0
  17. package/dist/cjs/ag-grid-plus/{querySchemes/components/QuerySchemesManager.js → setting/QuerySchemeManager.js} +304 -202
  18. package/dist/cjs/ag-grid-plus/setting/index.d.ts +2 -2
  19. package/dist/cjs/ag-grid-plus/setting/index.js +33 -48
  20. package/dist/cjs/ag-grid-plus/shared/storage/backendApiAdapter.d.ts +58 -0
  21. package/dist/cjs/ag-grid-plus/shared/storage/backendApiAdapter.js +446 -0
  22. package/dist/cjs/ag-grid-plus/shared/storage/localStorageAdapter.d.ts +57 -0
  23. package/dist/cjs/ag-grid-plus/{storage/MemoryStorageAdapter.js → shared/storage/localStorageAdapter.js} +264 -184
  24. package/dist/cjs/ag-grid-plus/shared/storage/schemeStorageAdapter.d.ts +132 -0
  25. package/dist/cjs/array-table/index.js +172 -48
  26. package/dist/cjs/draggableModal/index.d.ts +1 -1
  27. package/dist/cjs/draggableModal/index.js +23 -93
  28. package/dist/cjs/draggableModal/style.less +0 -73
  29. package/dist/cjs/index.d.ts +3 -4
  30. package/dist/cjs/index.js +16 -160
  31. package/dist/esm/ag-grid-plus/ag-gridPlus.js +262 -177
  32. package/dist/esm/ag-grid-plus/context/gridContext.d.ts +79 -15
  33. package/dist/esm/ag-grid-plus/context/gridContext.js +0 -4
  34. package/dist/esm/ag-grid-plus/context/useSchemeDataFlow.d.ts +88 -0
  35. package/dist/esm/ag-grid-plus/context/useSchemeDataFlow.js +165 -0
  36. package/dist/esm/ag-grid-plus/context/useSchemeManager.d.ts +78 -0
  37. package/dist/esm/ag-grid-plus/{querySchemes/hooks/useQuerySchemes.js → context/useSchemeManager.js} +420 -449
  38. package/dist/esm/ag-grid-plus/errors/ErrorBoundary.d.ts +1 -1
  39. package/dist/esm/ag-grid-plus/hooks/useAgGridCalculation.d.ts +1 -1
  40. package/dist/esm/ag-grid-plus/hooks/useAgGridData.d.ts +2 -2
  41. package/dist/esm/ag-grid-plus/index.d.ts +7 -4
  42. package/dist/esm/ag-grid-plus/index.js +10 -4
  43. package/dist/esm/ag-grid-plus/interface.d.ts +0 -31
  44. package/dist/esm/ag-grid-plus/interface.js +2 -0
  45. package/dist/esm/ag-grid-plus/setting/ColumnSetting.d.ts +0 -3
  46. package/dist/esm/ag-grid-plus/setting/ColumnSetting.js +434 -416
  47. package/dist/esm/ag-grid-plus/setting/QuerySchemeManager.d.ts +11 -0
  48. package/dist/esm/ag-grid-plus/{querySchemes/components/QuerySchemesManager.js → setting/QuerySchemeManager.js} +304 -202
  49. package/dist/esm/ag-grid-plus/setting/index.d.ts +2 -2
  50. package/dist/esm/ag-grid-plus/setting/index.js +33 -48
  51. package/dist/esm/ag-grid-plus/shared/storage/backendApiAdapter.d.ts +58 -0
  52. package/dist/esm/ag-grid-plus/shared/storage/backendApiAdapter.js +444 -0
  53. package/dist/esm/ag-grid-plus/shared/storage/localStorageAdapter.d.ts +57 -0
  54. package/dist/esm/ag-grid-plus/{storage/MemoryStorageAdapter.js → shared/storage/localStorageAdapter.js} +263 -184
  55. package/dist/esm/ag-grid-plus/shared/storage/schemeStorageAdapter.d.ts +132 -0
  56. package/dist/esm/array-table/index.js +174 -48
  57. package/dist/esm/draggableModal/index.d.ts +1 -1
  58. package/dist/esm/draggableModal/index.js +24 -93
  59. package/dist/esm/draggableModal/style.less +0 -73
  60. package/dist/esm/index.d.ts +3 -4
  61. package/dist/esm/index.js +13 -10
  62. package/dist/umd/qc-ui.min.css +1 -1
  63. package/dist/umd/qc-ui.min.js +1 -1
  64. package/package.json +1 -1
  65. package/dist/cjs/ag-grid-plus/querySchemes/components/QuerySchemesManager.d.ts +0 -21
  66. package/dist/cjs/ag-grid-plus/querySchemes/components/QuerySchemesManager.less +0 -86
  67. package/dist/cjs/ag-grid-plus/querySchemes/components/index.d.ts +0 -5
  68. package/dist/cjs/ag-grid-plus/querySchemes/components/index.js +0 -12
  69. package/dist/cjs/ag-grid-plus/querySchemes/constants.d.ts +0 -17
  70. package/dist/cjs/ag-grid-plus/querySchemes/constants.js +0 -30
  71. package/dist/cjs/ag-grid-plus/querySchemes/hooks/useQueryOrderManager.d.ts +0 -10
  72. package/dist/cjs/ag-grid-plus/querySchemes/hooks/useQueryOrderManager.js +0 -65
  73. package/dist/cjs/ag-grid-plus/querySchemes/hooks/useQuerySchemes.d.ts +0 -6
  74. package/dist/cjs/ag-grid-plus/querySchemes/index.d.ts +0 -11
  75. package/dist/cjs/ag-grid-plus/querySchemes/index.js +0 -113
  76. package/dist/cjs/ag-grid-plus/querySchemes/storage/localStorageAdapter.d.ts +0 -44
  77. package/dist/cjs/ag-grid-plus/querySchemes/storage/localStorageAdapter.js +0 -261
  78. package/dist/cjs/ag-grid-plus/querySchemes/types.d.ts +0 -143
  79. package/dist/cjs/ag-grid-plus/querySchemes/utils/validator.d.ts +0 -36
  80. package/dist/cjs/ag-grid-plus/querySchemes/utils/validator.js +0 -155
  81. package/dist/cjs/ag-grid-plus/schemes/components/SchemeManager.d.ts +0 -16
  82. package/dist/cjs/ag-grid-plus/schemes/components/SchemeManager.js +0 -342
  83. package/dist/cjs/ag-grid-plus/schemes/components/SchemeManager.less +0 -35
  84. package/dist/cjs/ag-grid-plus/schemes/components/SchemeSelector.d.ts +0 -20
  85. package/dist/cjs/ag-grid-plus/schemes/components/SchemeSelector.js +0 -289
  86. package/dist/cjs/ag-grid-plus/schemes/components/SchemeSelector.less +0 -39
  87. package/dist/cjs/ag-grid-plus/schemes/components/index.d.ts +0 -4
  88. package/dist/cjs/ag-grid-plus/schemes/components/index.js +0 -19
  89. package/dist/cjs/ag-grid-plus/schemes/constants.d.ts +0 -23
  90. package/dist/cjs/ag-grid-plus/schemes/constants.js +0 -39
  91. package/dist/cjs/ag-grid-plus/schemes/hooks/useColumnSchemes.d.ts +0 -6
  92. package/dist/cjs/ag-grid-plus/schemes/hooks/useColumnSchemes.js +0 -617
  93. package/dist/cjs/ag-grid-plus/schemes/index.d.ts +0 -16
  94. package/dist/cjs/ag-grid-plus/schemes/index.js +0 -124
  95. package/dist/cjs/ag-grid-plus/schemes/storage/localStorageAdapter.d.ts +0 -64
  96. package/dist/cjs/ag-grid-plus/schemes/storage/localStorageAdapter.js +0 -354
  97. package/dist/cjs/ag-grid-plus/schemes/types.d.ts +0 -131
  98. package/dist/cjs/ag-grid-plus/schemes/types.js +0 -5
  99. package/dist/cjs/ag-grid-plus/schemes/utils/validator.d.ts +0 -27
  100. package/dist/cjs/ag-grid-plus/schemes/utils/validator.js +0 -109
  101. package/dist/cjs/ag-grid-plus/storage/MemoryStorageAdapter.d.ts +0 -76
  102. package/dist/cjs/ag-grid-plus/storage/SchemeSyncManager.d.ts +0 -141
  103. package/dist/cjs/ag-grid-plus/storage/SchemeSyncManager.js +0 -902
  104. package/dist/cjs/ag-grid-plus/storage/globalSyncManager.d.ts +0 -106
  105. package/dist/cjs/ag-grid-plus/storage/globalSyncManager.js +0 -364
  106. package/dist/cjs/ag-grid-plus/storage/index.d.ts +0 -8
  107. package/dist/cjs/ag-grid-plus/storage/index.js +0 -49
  108. package/dist/cjs/ag-grid-plus/storage/types.d.ts +0 -150
  109. package/dist/cjs/ag-grid-plus/storage/types.js +0 -5
  110. package/dist/esm/ag-grid-plus/querySchemes/components/QuerySchemesManager.d.ts +0 -21
  111. package/dist/esm/ag-grid-plus/querySchemes/components/QuerySchemesManager.less +0 -86
  112. package/dist/esm/ag-grid-plus/querySchemes/components/index.d.ts +0 -5
  113. package/dist/esm/ag-grid-plus/querySchemes/components/index.js +0 -5
  114. package/dist/esm/ag-grid-plus/querySchemes/constants.d.ts +0 -17
  115. package/dist/esm/ag-grid-plus/querySchemes/constants.js +0 -24
  116. package/dist/esm/ag-grid-plus/querySchemes/hooks/useQueryOrderManager.d.ts +0 -10
  117. package/dist/esm/ag-grid-plus/querySchemes/hooks/useQueryOrderManager.js +0 -60
  118. package/dist/esm/ag-grid-plus/querySchemes/hooks/useQuerySchemes.d.ts +0 -6
  119. package/dist/esm/ag-grid-plus/querySchemes/index.d.ts +0 -11
  120. package/dist/esm/ag-grid-plus/querySchemes/index.js +0 -20
  121. package/dist/esm/ag-grid-plus/querySchemes/storage/localStorageAdapter.d.ts +0 -44
  122. package/dist/esm/ag-grid-plus/querySchemes/storage/localStorageAdapter.js +0 -256
  123. package/dist/esm/ag-grid-plus/querySchemes/types.d.ts +0 -143
  124. package/dist/esm/ag-grid-plus/querySchemes/utils/validator.d.ts +0 -36
  125. package/dist/esm/ag-grid-plus/querySchemes/utils/validator.js +0 -144
  126. package/dist/esm/ag-grid-plus/schemes/components/SchemeManager.d.ts +0 -16
  127. package/dist/esm/ag-grid-plus/schemes/components/SchemeManager.js +0 -334
  128. package/dist/esm/ag-grid-plus/schemes/components/SchemeManager.less +0 -35
  129. package/dist/esm/ag-grid-plus/schemes/components/SchemeSelector.d.ts +0 -20
  130. package/dist/esm/ag-grid-plus/schemes/components/SchemeSelector.js +0 -281
  131. package/dist/esm/ag-grid-plus/schemes/components/SchemeSelector.less +0 -39
  132. package/dist/esm/ag-grid-plus/schemes/components/index.d.ts +0 -4
  133. package/dist/esm/ag-grid-plus/schemes/components/index.js +0 -2
  134. package/dist/esm/ag-grid-plus/schemes/constants.d.ts +0 -23
  135. package/dist/esm/ag-grid-plus/schemes/constants.js +0 -33
  136. package/dist/esm/ag-grid-plus/schemes/hooks/useColumnSchemes.d.ts +0 -6
  137. package/dist/esm/ag-grid-plus/schemes/hooks/useColumnSchemes.js +0 -612
  138. package/dist/esm/ag-grid-plus/schemes/index.d.ts +0 -16
  139. package/dist/esm/ag-grid-plus/schemes/index.js +0 -25
  140. package/dist/esm/ag-grid-plus/schemes/storage/localStorageAdapter.d.ts +0 -64
  141. package/dist/esm/ag-grid-plus/schemes/storage/localStorageAdapter.js +0 -349
  142. package/dist/esm/ag-grid-plus/schemes/types.d.ts +0 -131
  143. package/dist/esm/ag-grid-plus/schemes/types.js +0 -1
  144. package/dist/esm/ag-grid-plus/schemes/utils/validator.d.ts +0 -27
  145. package/dist/esm/ag-grid-plus/schemes/utils/validator.js +0 -100
  146. package/dist/esm/ag-grid-plus/storage/MemoryStorageAdapter.d.ts +0 -76
  147. package/dist/esm/ag-grid-plus/storage/SchemeSyncManager.d.ts +0 -141
  148. package/dist/esm/ag-grid-plus/storage/SchemeSyncManager.js +0 -896
  149. package/dist/esm/ag-grid-plus/storage/globalSyncManager.d.ts +0 -106
  150. package/dist/esm/ag-grid-plus/storage/globalSyncManager.js +0 -350
  151. package/dist/esm/ag-grid-plus/storage/index.d.ts +0 -8
  152. package/dist/esm/ag-grid-plus/storage/index.js +0 -9
  153. package/dist/esm/ag-grid-plus/storage/types.d.ts +0 -150
  154. package/dist/esm/ag-grid-plus/storage/types.js +0 -1
  155. /package/dist/cjs/ag-grid-plus/{querySchemes/types.js → shared/storage/schemeStorageAdapter.js} +0 -0
  156. /package/dist/esm/ag-grid-plus/{querySchemes/types.js → shared/storage/schemeStorageAdapter.js} +0 -0
@@ -1,124 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "DEFAULT_SCHEME_NAME", {
7
- enumerable: true,
8
- get: function get() {
9
- return _constants.DEFAULT_SCHEME_NAME;
10
- }
11
- });
12
- Object.defineProperty(exports, "LEGACY_STORAGE_PREFIX", {
13
- enumerable: true,
14
- get: function get() {
15
- return _constants.LEGACY_STORAGE_PREFIX;
16
- }
17
- });
18
- Object.defineProperty(exports, "LocalStorageAdapter", {
19
- enumerable: true,
20
- get: function get() {
21
- return _localStorageAdapter.LocalStorageAdapter;
22
- }
23
- });
24
- Object.defineProperty(exports, "MAX_SCHEMES_PER_GRID", {
25
- enumerable: true,
26
- get: function get() {
27
- return _constants.MAX_SCHEMES_PER_GRID;
28
- }
29
- });
30
- Object.defineProperty(exports, "MAX_SCHEME_DESCRIPTION_LENGTH", {
31
- enumerable: true,
32
- get: function get() {
33
- return _constants.MAX_SCHEME_DESCRIPTION_LENGTH;
34
- }
35
- });
36
- Object.defineProperty(exports, "MAX_SCHEME_NAME_LENGTH", {
37
- enumerable: true,
38
- get: function get() {
39
- return _constants.MAX_SCHEME_NAME_LENGTH;
40
- }
41
- });
42
- Object.defineProperty(exports, "MIGRATED_DEFAULT_SCHEME_ID", {
43
- enumerable: true,
44
- get: function get() {
45
- return _constants.MIGRATED_DEFAULT_SCHEME_ID;
46
- }
47
- });
48
- Object.defineProperty(exports, "STORAGE_MAX_SIZE", {
49
- enumerable: true,
50
- get: function get() {
51
- return _constants.STORAGE_MAX_SIZE;
52
- }
53
- });
54
- Object.defineProperty(exports, "STORAGE_PREFIX", {
55
- enumerable: true,
56
- get: function get() {
57
- return _constants.STORAGE_PREFIX;
58
- }
59
- });
60
- Object.defineProperty(exports, "SYSTEM_SCHEME_PREFIX", {
61
- enumerable: true,
62
- get: function get() {
63
- return _constants.SYSTEM_SCHEME_PREFIX;
64
- }
65
- });
66
- Object.defineProperty(exports, "SchemeManager", {
67
- enumerable: true,
68
- get: function get() {
69
- return _components.SchemeManager;
70
- }
71
- });
72
- Object.defineProperty(exports, "SchemeSelector", {
73
- enumerable: true,
74
- get: function get() {
75
- return _components.SchemeSelector;
76
- }
77
- });
78
- Object.defineProperty(exports, "checkDuplicateName", {
79
- enumerable: true,
80
- get: function get() {
81
- return _validator.checkDuplicateName;
82
- }
83
- });
84
- Object.defineProperty(exports, "defaultStorageAdapter", {
85
- enumerable: true,
86
- get: function get() {
87
- return _localStorageAdapter.defaultStorageAdapter;
88
- }
89
- });
90
- Object.defineProperty(exports, "generateUniqueName", {
91
- enumerable: true,
92
- get: function get() {
93
- return _validator.generateUniqueName;
94
- }
95
- });
96
- Object.defineProperty(exports, "useColumnSchemes", {
97
- enumerable: true,
98
- get: function get() {
99
- return _useColumnSchemes.useColumnSchemes;
100
- }
101
- });
102
- Object.defineProperty(exports, "validateScheme", {
103
- enumerable: true,
104
- get: function get() {
105
- return _validator.validateScheme;
106
- }
107
- });
108
- Object.defineProperty(exports, "validateSchemeDescription", {
109
- enumerable: true,
110
- get: function get() {
111
- return _validator.validateSchemeDescription;
112
- }
113
- });
114
- Object.defineProperty(exports, "validateSchemeName", {
115
- enumerable: true,
116
- get: function get() {
117
- return _validator.validateSchemeName;
118
- }
119
- });
120
- var _useColumnSchemes = require("./hooks/useColumnSchemes");
121
- var _components = require("./components");
122
- var _localStorageAdapter = require("./storage/localStorageAdapter");
123
- var _validator = require("./utils/validator");
124
- var _constants = require("./constants");
@@ -1,64 +0,0 @@
1
- import { ColumnScheme, StorageAdapter } from '../types';
2
- /**
3
- * LocalStorage 存储适配器实现
4
- * 默认的方案存储方式,支持自动迁移旧数据
5
- */
6
- export declare class LocalStorageAdapter implements StorageAdapter {
7
- /**
8
- * 生成存储键名
9
- */
10
- private getStorageKey;
11
- /**
12
- * 生成旧版本存储键名
13
- */
14
- private getLegacyStorageKey;
15
- /**
16
- * 检查是否需要迁移旧数据
17
- */
18
- private needsMigration;
19
- /**
20
- * 迁移旧数据到新格式
21
- */
22
- private migrateOldData;
23
- /**
24
- * 检查存储空间是否足够
25
- */
26
- private checkStorageQuota;
27
- /**
28
- * 获取指定表格的所有方案
29
- */
30
- getSchemes(gridId: string): Promise<ColumnScheme[]>;
31
- /**
32
- * 保存方案列表到 LocalStorage
33
- */
34
- saveSchemes(gridId: string, schemes: ColumnScheme[]): Promise<void>;
35
- /**
36
- * 清除指定表格的所有方案
37
- */
38
- clearSchemes(gridId: string): Promise<void>;
39
- /**
40
- * 获取存储使用情况统计
41
- */
42
- getStorageStats(): {
43
- totalSize: number;
44
- usedSize: number;
45
- usagePercentage: number;
46
- itemCount: number;
47
- };
48
- /**
49
- * 生成当前方案ID存储键名
50
- */
51
- private getCurrentSchemeKey;
52
- /**
53
- * 获取当前激活的方案ID
54
- */
55
- getCurrentSchemeId(gridId: string): Promise<string | null>;
56
- /**
57
- * 保存当前激活的方案ID
58
- */
59
- saveCurrentSchemeId(gridId: string, schemeId: string | null): Promise<void>;
60
- }
61
- /**
62
- * 导出默认实例
63
- */
64
- export declare const defaultStorageAdapter: LocalStorageAdapter;
@@ -1,354 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.defaultStorageAdapter = exports.LocalStorageAdapter = void 0;
7
- var _constants = require("../constants");
8
- 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); }
9
- 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; }
10
- 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); } }
11
- 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); }); }; }
12
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
13
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
14
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
15
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
16
- 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); }
17
- /**
18
- * LocalStorage 存储适配器实现
19
- * 默认的方案存储方式,支持自动迁移旧数据
20
- */
21
- var LocalStorageAdapter = exports.LocalStorageAdapter = /*#__PURE__*/function () {
22
- function LocalStorageAdapter() {
23
- _classCallCheck(this, LocalStorageAdapter);
24
- }
25
- _createClass(LocalStorageAdapter, [{
26
- key: "getStorageKey",
27
- value:
28
- /**
29
- * 生成存储键名
30
- */
31
- function getStorageKey(gridId) {
32
- return "".concat(_constants.STORAGE_PREFIX, "-").concat(gridId);
33
- }
34
-
35
- /**
36
- * 生成旧版本存储键名
37
- */
38
- }, {
39
- key: "getLegacyStorageKey",
40
- value: function getLegacyStorageKey(gridId) {
41
- return "".concat(_constants.LEGACY_STORAGE_PREFIX, "-").concat(gridId);
42
- }
43
-
44
- /**
45
- * 检查是否需要迁移旧数据
46
- */
47
- }, {
48
- key: "needsMigration",
49
- value: function needsMigration(gridId) {
50
- var newKey = this.getStorageKey(gridId);
51
- var oldKey = this.getLegacyStorageKey(gridId);
52
- var hasNewData = localStorage.getItem(newKey) !== null;
53
- var hasOldData = localStorage.getItem(oldKey) !== null;
54
- return !hasNewData && hasOldData;
55
- }
56
-
57
- /**
58
- * 迁移旧数据到新格式
59
- */
60
- }, {
61
- key: "migrateOldData",
62
- value: (function () {
63
- var _migrateOldData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(gridId) {
64
- var oldKey, oldData;
65
- return _regeneratorRuntime().wrap(function _callee$(_context) {
66
- while (1) switch (_context.prev = _context.next) {
67
- case 0:
68
- oldKey = this.getLegacyStorageKey(gridId);
69
- oldData = localStorage.getItem(oldKey);
70
- if (oldData) {
71
- _context.next = 4;
72
- break;
73
- }
74
- return _context.abrupt("return", []);
75
- case 4:
76
- _context.prev = 4;
77
- // 注意:旧数据已无法自动迁移,因为缺少 columnConfig
78
- // 建议手动处理或提示用户重新配置
79
- console.warn("[SchemeManager] \u68C0\u6D4B\u5230\u65E7\u683C\u5F0F\u6570\u636E,\u4F46\u65E0\u6CD5\u81EA\u52A8\u8FC1\u79FB: ".concat(gridId));
80
- console.warn('[SchemeManager] 请手动重新配置列方案');
81
- return _context.abrupt("return", []);
82
- case 10:
83
- _context.prev = 10;
84
- _context.t0 = _context["catch"](4);
85
- console.error('[SchemeManager] 检查旧数据失败:', _context.t0);
86
- return _context.abrupt("return", []);
87
- case 14:
88
- case "end":
89
- return _context.stop();
90
- }
91
- }, _callee, this, [[4, 10]]);
92
- }));
93
- function migrateOldData(_x) {
94
- return _migrateOldData.apply(this, arguments);
95
- }
96
- return migrateOldData;
97
- }()
98
- /**
99
- * 检查存储空间是否足够
100
- */
101
- )
102
- }, {
103
- key: "checkStorageQuota",
104
- value: function checkStorageQuota(data) {
105
- try {
106
- // 估算当前使用量
107
- var totalSize = 0;
108
- for (var key in localStorage) {
109
- if (localStorage.hasOwnProperty(key)) {
110
- totalSize += localStorage[key].length + key.length;
111
- }
112
- }
113
- var newDataSize = data.length;
114
- if (totalSize + newDataSize > _constants.STORAGE_MAX_SIZE) {
115
- console.warn('[SchemeManager] LocalStorage 接近容量限制');
116
- return false;
117
- }
118
- return true;
119
- } catch (error) {
120
- console.error('[SchemeManager] 检查存储空间失败:', error);
121
- return false;
122
- }
123
- }
124
-
125
- /**
126
- * 获取指定表格的所有方案
127
- */
128
- }, {
129
- key: "getSchemes",
130
- value: (function () {
131
- var _getSchemes = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(gridId) {
132
- var key, data, schemes;
133
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
134
- while (1) switch (_context2.prev = _context2.next) {
135
- case 0:
136
- _context2.prev = 0;
137
- if (!this.needsMigration(gridId)) {
138
- _context2.next = 5;
139
- break;
140
- }
141
- _context2.next = 4;
142
- return this.migrateOldData(gridId);
143
- case 4:
144
- return _context2.abrupt("return", _context2.sent);
145
- case 5:
146
- key = this.getStorageKey(gridId);
147
- data = localStorage.getItem(key);
148
- if (data) {
149
- _context2.next = 9;
150
- break;
151
- }
152
- return _context2.abrupt("return", []);
153
- case 9:
154
- schemes = JSON.parse(data); // 验证数据完整性
155
- return _context2.abrupt("return", schemes.filter(function (scheme) {
156
- return scheme.id && scheme.name && scheme.columnConfig && Array.isArray(scheme.columnConfig);
157
- }));
158
- case 13:
159
- _context2.prev = 13;
160
- _context2.t0 = _context2["catch"](0);
161
- console.error('[SchemeManager] 加载方案失败:', _context2.t0);
162
- return _context2.abrupt("return", []);
163
- case 17:
164
- case "end":
165
- return _context2.stop();
166
- }
167
- }, _callee2, this, [[0, 13]]);
168
- }));
169
- function getSchemes(_x2) {
170
- return _getSchemes.apply(this, arguments);
171
- }
172
- return getSchemes;
173
- }()
174
- /**
175
- * 保存方案列表到 LocalStorage
176
- */
177
- )
178
- }, {
179
- key: "saveSchemes",
180
- value: (function () {
181
- var _saveSchemes = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(gridId, schemes) {
182
- var key, data;
183
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
184
- while (1) switch (_context3.prev = _context3.next) {
185
- case 0:
186
- _context3.prev = 0;
187
- key = this.getStorageKey(gridId);
188
- data = JSON.stringify(schemes); // 检查存储空间
189
- if (this.checkStorageQuota(data)) {
190
- _context3.next = 5;
191
- break;
192
- }
193
- throw new Error('LocalStorage 空间不足,请删除一些方案');
194
- case 5:
195
- localStorage.setItem(key, data);
196
- _context3.next = 12;
197
- break;
198
- case 8:
199
- _context3.prev = 8;
200
- _context3.t0 = _context3["catch"](0);
201
- console.error('[SchemeManager] 保存方案失败:', _context3.t0);
202
- throw _context3.t0;
203
- case 12:
204
- case "end":
205
- return _context3.stop();
206
- }
207
- }, _callee3, this, [[0, 8]]);
208
- }));
209
- function saveSchemes(_x3, _x4) {
210
- return _saveSchemes.apply(this, arguments);
211
- }
212
- return saveSchemes;
213
- }()
214
- /**
215
- * 清除指定表格的所有方案
216
- */
217
- )
218
- }, {
219
- key: "clearSchemes",
220
- value: (function () {
221
- var _clearSchemes = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(gridId) {
222
- var key;
223
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
224
- while (1) switch (_context4.prev = _context4.next) {
225
- case 0:
226
- _context4.prev = 0;
227
- key = this.getStorageKey(gridId);
228
- localStorage.removeItem(key);
229
- console.log("[SchemeManager] \u5DF2\u6E05\u9664\u8868\u683C ".concat(gridId, " \u7684\u6240\u6709\u65B9\u6848"));
230
- _context4.next = 10;
231
- break;
232
- case 6:
233
- _context4.prev = 6;
234
- _context4.t0 = _context4["catch"](0);
235
- console.error('[SchemeManager] 清除方案失败:', _context4.t0);
236
- throw _context4.t0;
237
- case 10:
238
- case "end":
239
- return _context4.stop();
240
- }
241
- }, _callee4, this, [[0, 6]]);
242
- }));
243
- function clearSchemes(_x5) {
244
- return _clearSchemes.apply(this, arguments);
245
- }
246
- return clearSchemes;
247
- }()
248
- /**
249
- * 获取存储使用情况统计
250
- */
251
- )
252
- }, {
253
- key: "getStorageStats",
254
- value: function getStorageStats() {
255
- var totalSize = 0;
256
- var itemCount = 0;
257
- for (var key in localStorage) {
258
- if (localStorage.hasOwnProperty(key) && key.startsWith(_constants.STORAGE_PREFIX)) {
259
- totalSize += localStorage[key].length + key.length;
260
- itemCount++;
261
- }
262
- }
263
- return {
264
- totalSize: _constants.STORAGE_MAX_SIZE,
265
- usedSize: totalSize,
266
- usagePercentage: totalSize / _constants.STORAGE_MAX_SIZE * 100,
267
- itemCount: itemCount
268
- };
269
- }
270
-
271
- /**
272
- * 生成当前方案ID存储键名
273
- */
274
- }, {
275
- key: "getCurrentSchemeKey",
276
- value: function getCurrentSchemeKey(gridId) {
277
- return "".concat(_constants.STORAGE_PREFIX, "-").concat(gridId).concat(_constants.CURRENT_SCHEME_SUFFIX);
278
- }
279
-
280
- /**
281
- * 获取当前激活的方案ID
282
- */
283
- }, {
284
- key: "getCurrentSchemeId",
285
- value: (function () {
286
- var _getCurrentSchemeId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(gridId) {
287
- var key, schemeId;
288
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
289
- while (1) switch (_context5.prev = _context5.next) {
290
- case 0:
291
- _context5.prev = 0;
292
- key = this.getCurrentSchemeKey(gridId);
293
- schemeId = localStorage.getItem(key);
294
- return _context5.abrupt("return", schemeId || null);
295
- case 6:
296
- _context5.prev = 6;
297
- _context5.t0 = _context5["catch"](0);
298
- console.error('[SchemeManager] 获取当前方案ID失败:', _context5.t0);
299
- return _context5.abrupt("return", null);
300
- case 10:
301
- case "end":
302
- return _context5.stop();
303
- }
304
- }, _callee5, this, [[0, 6]]);
305
- }));
306
- function getCurrentSchemeId(_x6) {
307
- return _getCurrentSchemeId.apply(this, arguments);
308
- }
309
- return getCurrentSchemeId;
310
- }()
311
- /**
312
- * 保存当前激活的方案ID
313
- */
314
- )
315
- }, {
316
- key: "saveCurrentSchemeId",
317
- value: (function () {
318
- var _saveCurrentSchemeId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(gridId, schemeId) {
319
- var key;
320
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
321
- while (1) switch (_context6.prev = _context6.next) {
322
- case 0:
323
- _context6.prev = 0;
324
- key = this.getCurrentSchemeKey(gridId);
325
- if (schemeId === null) {
326
- localStorage.removeItem(key);
327
- } else {
328
- localStorage.setItem(key, schemeId);
329
- }
330
- _context6.next = 9;
331
- break;
332
- case 5:
333
- _context6.prev = 5;
334
- _context6.t0 = _context6["catch"](0);
335
- console.error('[SchemeManager] 保存当前方案ID失败:', _context6.t0);
336
- throw _context6.t0;
337
- case 9:
338
- case "end":
339
- return _context6.stop();
340
- }
341
- }, _callee6, this, [[0, 5]]);
342
- }));
343
- function saveCurrentSchemeId(_x7, _x8) {
344
- return _saveCurrentSchemeId.apply(this, arguments);
345
- }
346
- return saveCurrentSchemeId;
347
- }())
348
- }]);
349
- return LocalStorageAdapter;
350
- }();
351
- /**
352
- * 导出默认实例
353
- */
354
- var defaultStorageAdapter = exports.defaultStorageAdapter = new LocalStorageAdapter();
@@ -1,131 +0,0 @@
1
- import { ColumnState } from 'ag-grid-community';
2
- import type { FlatColumnItem } from '../setting/columnGroupTypes';
3
- /**
4
- * 列配置方案数据结构
5
- */
6
- export interface ColumnScheme {
7
- /** 方案唯一标识(UUID) */
8
- id: string;
9
- /** 方案名称(用户可编辑) */
10
- name: string;
11
- /** 是否为默认方案(首次加载自动应用) */
12
- isDefault?: boolean;
13
- /** 是否为系统预设方案(不可删除) */
14
- isSystem?: boolean;
15
- /** 创建时间戳 */
16
- createdAt: number;
17
- /** 更新时间戳 */
18
- updatedAt: number;
19
- /** 完整的列配置数据(包含分组层级结构) */
20
- columnConfig: FlatColumnItem[];
21
- /** AG-Grid 过滤器模型数据(可选) */
22
- filterModel?: any;
23
- /** 方案描述(可选) */
24
- description?: string;
25
- /** 标签分类(可选,扩展功能) */
26
- tags?: string[];
27
- /** 共享级别(可选,扩展功能) */
28
- shareLevel?: 'private' | 'team' | 'public';
29
- }
30
- /**
31
- * 方案管理器配置
32
- */
33
- export interface SchemeManagerConfig {
34
- /** 表格唯一标识 */
35
- gridId: string;
36
- /** 自定义存储适配器(可选) */
37
- storageAdapter?: StorageAdapter;
38
- /** 是否启用自动保存到当前方案(默认 true) */
39
- enableAutoSave?: boolean;
40
- /** 方案切换回调 */
41
- onSchemeChange?: (scheme: ColumnScheme | null) => void;
42
- /** 方案保存回调 */
43
- onSchemeSave?: (scheme: ColumnScheme) => void;
44
- /** 方案删除回调 */
45
- onSchemeDelete?: (schemeId: string) => void;
46
- }
47
- /**
48
- * 存储适配器接口
49
- * 允许自定义存储实现(LocalStorage / IndexedDB / 后端API等)
50
- */
51
- export interface StorageAdapter {
52
- /**
53
- * 获取指定表格的所有方案
54
- * @param gridId 表格唯一标识
55
- * @returns 方案列表
56
- */
57
- getSchemes(gridId: string): Promise<ColumnScheme[]>;
58
- /**
59
- * 保存方案列表到存储
60
- * @param gridId 表格唯一标识
61
- * @param schemes 方案列表
62
- */
63
- saveSchemes(gridId: string, schemes: ColumnScheme[]): Promise<void>;
64
- /**
65
- * 清除指定表格的所有方案
66
- * @param gridId 表格唯一标识
67
- */
68
- clearSchemes?(gridId: string): Promise<void>;
69
- /**
70
- * 获取当前激活的方案ID(用于刷新后恢复)
71
- * @param gridId 表格唯一标识
72
- * @returns 方案ID,如果没有则返回 null
73
- */
74
- getCurrentSchemeId?(gridId: string): Promise<string | null>;
75
- /**
76
- * 保存当前激活的方案ID
77
- * @param gridId 表格唯一标识
78
- * @param schemeId 方案ID,null 表示清除
79
- */
80
- saveCurrentSchemeId?(gridId: string, schemeId: string | null): Promise<void>;
81
- }
82
- /**
83
- * 方案验证结果
84
- */
85
- export interface SchemeValidationResult {
86
- /** 是否有效 */
87
- valid: boolean;
88
- /** 无效的列 ID 列表 */
89
- invalidColumns: string[];
90
- /** 验证后的有效列状态 */
91
- validatedState: ColumnState[];
92
- /** 警告信息 */
93
- warnings?: string[];
94
- }
95
- /**
96
- * 方案管理器 Hook 返回值
97
- */
98
- export interface UseColumnSchemesReturn {
99
- /** 当前激活的方案 */
100
- currentScheme: ColumnScheme | null;
101
- /** 所有可用方案列表 */
102
- schemes: ColumnScheme[];
103
- /** 当前配置是否有未保存的修改 */
104
- isDirty: boolean;
105
- /** 是否正在加载 */
106
- loading: boolean;
107
- /** 加载指定方案 */
108
- loadScheme: (schemeId: string) => Promise<void>;
109
- /** 保存当前方案(更新现有方案) */
110
- saveScheme: (updates?: Partial<ColumnScheme>) => Promise<void>;
111
- /** 创建新方案 */
112
- createScheme: (name: string, columnConfig: FlatColumnItem[], options?: Partial<ColumnScheme> & {
113
- activate?: boolean;
114
- }) => Promise<ColumnScheme>;
115
- /** 更新方案信息(不影响 columnConfig) */
116
- updateScheme: (schemeId: string, updates: Partial<Omit<ColumnScheme, 'id' | 'columnConfig'>>) => Promise<void>;
117
- /** 删除方案 */
118
- deleteScheme: (schemeId: string) => Promise<void>;
119
- /** 重置到方案原始状态 */
120
- resetToScheme: () => void;
121
- /** 设置默认方案 */
122
- setDefaultScheme: (schemeId: string) => Promise<void>;
123
- /** 验证方案有效性 */
124
- validateScheme: (scheme: ColumnScheme, currentColumnDefs: any[]) => SchemeValidationResult;
125
- }
126
- /**
127
- * 旧格式列状态数据(用于迁移)
128
- */
129
- export interface LegacyColumnState {
130
- [gridKey: string]: ColumnState[];
131
- }