@nokecy/qc-ui 1.0.70 → 1.0.72

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 (189) hide show
  1. package/dist/cjs/ag-grid-plus/ag-gridPlus.js +409 -206
  2. package/dist/cjs/ag-grid-plus/context/gridContext.d.ts +30 -5
  3. package/dist/cjs/ag-grid-plus/context/gridContext.js +6 -1
  4. package/dist/cjs/ag-grid-plus/errors/ErrorBoundary.d.ts +36 -0
  5. package/dist/cjs/ag-grid-plus/errors/ErrorBoundary.js +143 -0
  6. package/dist/cjs/ag-grid-plus/errors/index.d.ts +3 -0
  7. package/dist/cjs/ag-grid-plus/errors/index.js +31 -0
  8. package/dist/cjs/ag-grid-plus/errors/types.d.ts +71 -0
  9. package/dist/cjs/ag-grid-plus/errors/types.js +137 -0
  10. package/dist/cjs/ag-grid-plus/hooks/index.d.ts +7 -0
  11. package/dist/cjs/ag-grid-plus/hooks/index.js +51 -0
  12. package/dist/cjs/ag-grid-plus/hooks/useAgGridCalculation.d.ts +88 -0
  13. package/dist/cjs/ag-grid-plus/hooks/useAgGridCalculation.js +224 -0
  14. package/dist/cjs/ag-grid-plus/hooks/useAgGridData.d.ts +91 -0
  15. package/dist/cjs/ag-grid-plus/hooks/useAgGridData.js +230 -0
  16. package/dist/cjs/ag-grid-plus/hooks/useGridPlusColumnState.d.ts +1 -8
  17. package/dist/cjs/ag-grid-plus/hooks/useGridState.d.ts +153 -0
  18. package/dist/cjs/ag-grid-plus/hooks/useGridState.js +258 -0
  19. package/dist/cjs/ag-grid-plus/index.d.ts +5 -0
  20. package/dist/cjs/ag-grid-plus/index.js +164 -0
  21. package/dist/cjs/ag-grid-plus/interface.d.ts +37 -0
  22. package/dist/cjs/ag-grid-plus/querySchemes/components/QuerySchemesManager.d.ts +21 -0
  23. package/dist/cjs/ag-grid-plus/querySchemes/components/QuerySchemesManager.js +580 -0
  24. package/dist/cjs/ag-grid-plus/querySchemes/components/QuerySchemesManager.less +86 -0
  25. package/dist/cjs/ag-grid-plus/querySchemes/components/index.d.ts +5 -0
  26. package/dist/cjs/ag-grid-plus/querySchemes/components/index.js +12 -0
  27. package/dist/cjs/ag-grid-plus/querySchemes/constants.d.ts +17 -0
  28. package/dist/cjs/ag-grid-plus/querySchemes/constants.js +30 -0
  29. package/dist/cjs/ag-grid-plus/querySchemes/hooks/useQueryOrderManager.d.ts +10 -0
  30. package/dist/cjs/ag-grid-plus/querySchemes/hooks/useQueryOrderManager.js +65 -0
  31. package/dist/cjs/ag-grid-plus/querySchemes/hooks/useQuerySchemes.d.ts +6 -0
  32. package/dist/cjs/ag-grid-plus/querySchemes/hooks/useQuerySchemes.js +542 -0
  33. package/dist/cjs/ag-grid-plus/querySchemes/hooks/useQuerySchemes.refactored.d.ts +7 -0
  34. package/dist/cjs/ag-grid-plus/querySchemes/hooks/useQuerySchemes.refactored.js +32 -0
  35. package/dist/cjs/ag-grid-plus/querySchemes/index.d.ts +11 -0
  36. package/dist/cjs/ag-grid-plus/querySchemes/index.js +113 -0
  37. package/dist/cjs/ag-grid-plus/querySchemes/storage/localStorageAdapter.d.ts +44 -0
  38. package/dist/cjs/ag-grid-plus/querySchemes/storage/localStorageAdapter.js +261 -0
  39. package/dist/cjs/ag-grid-plus/querySchemes/types.d.ts +143 -0
  40. package/dist/cjs/ag-grid-plus/querySchemes/types.js +5 -0
  41. package/dist/cjs/ag-grid-plus/querySchemes/utils/validator.d.ts +36 -0
  42. package/dist/cjs/ag-grid-plus/querySchemes/utils/validator.js +155 -0
  43. package/dist/cjs/ag-grid-plus/schemes/components/SchemeManager.d.ts +16 -0
  44. package/dist/cjs/ag-grid-plus/schemes/components/SchemeManager.js +342 -0
  45. package/dist/cjs/ag-grid-plus/schemes/components/SchemeManager.less +35 -0
  46. package/dist/cjs/ag-grid-plus/schemes/components/SchemeSelector.d.ts +20 -0
  47. package/dist/cjs/ag-grid-plus/schemes/components/SchemeSelector.js +289 -0
  48. package/dist/cjs/ag-grid-plus/schemes/components/SchemeSelector.less +39 -0
  49. package/dist/cjs/ag-grid-plus/schemes/components/index.d.ts +4 -0
  50. package/dist/cjs/ag-grid-plus/schemes/components/index.js +19 -0
  51. package/dist/cjs/ag-grid-plus/schemes/constants.d.ts +23 -0
  52. package/dist/cjs/ag-grid-plus/schemes/constants.js +39 -0
  53. package/dist/cjs/ag-grid-plus/schemes/hooks/useColumnSchemes.d.ts +6 -0
  54. package/dist/cjs/ag-grid-plus/schemes/hooks/useColumnSchemes.js +542 -0
  55. package/dist/cjs/ag-grid-plus/schemes/hooks/useColumnSchemes.refactored.d.ts +7 -0
  56. package/dist/cjs/ag-grid-plus/schemes/hooks/useColumnSchemes.refactored.js +32 -0
  57. package/dist/cjs/ag-grid-plus/schemes/index.d.ts +16 -0
  58. package/dist/cjs/ag-grid-plus/schemes/index.js +124 -0
  59. package/dist/cjs/ag-grid-plus/schemes/storage/localStorageAdapter.d.ts +64 -0
  60. package/dist/cjs/ag-grid-plus/schemes/storage/localStorageAdapter.js +368 -0
  61. package/dist/cjs/ag-grid-plus/schemes/types.d.ts +126 -0
  62. package/dist/cjs/ag-grid-plus/schemes/types.js +5 -0
  63. package/dist/cjs/ag-grid-plus/schemes/utils/validator.d.ts +27 -0
  64. package/dist/cjs/ag-grid-plus/schemes/utils/validator.js +113 -0
  65. package/dist/cjs/ag-grid-plus/setting/ColumnSetting.d.ts +17 -0
  66. package/dist/cjs/ag-grid-plus/setting/ColumnSetting.js +955 -0
  67. package/dist/cjs/ag-grid-plus/setting/index.d.ts +1 -1
  68. package/dist/cjs/ag-grid-plus/setting/index.js +74 -111
  69. package/dist/cjs/ag-grid-plus/shared/hooks/useSchemeManager.d.ts +66 -0
  70. package/dist/cjs/ag-grid-plus/shared/hooks/useSchemeManager.js +648 -0
  71. package/dist/cjs/ag-grid-plus/storage/MemoryStorageAdapter.d.ts +76 -0
  72. package/dist/cjs/ag-grid-plus/storage/MemoryStorageAdapter.js +276 -0
  73. package/dist/cjs/ag-grid-plus/storage/SchemeSyncManager.d.ts +114 -0
  74. package/dist/cjs/ag-grid-plus/storage/SchemeSyncManager.js +615 -0
  75. package/dist/cjs/ag-grid-plus/storage/globalSyncManager.d.ts +100 -0
  76. package/dist/cjs/ag-grid-plus/storage/globalSyncManager.js +335 -0
  77. package/dist/cjs/ag-grid-plus/storage/index.d.ts +8 -0
  78. package/dist/cjs/ag-grid-plus/storage/index.js +49 -0
  79. package/dist/cjs/ag-grid-plus/storage/types.d.ts +144 -0
  80. package/dist/cjs/ag-grid-plus/storage/types.js +5 -0
  81. package/dist/cjs/ag-grid-plus/types.d.ts +310 -0
  82. package/dist/cjs/ag-grid-plus/types.js +5 -0
  83. package/dist/cjs/ag-grid-plus/utils/columnProcessors.d.ts +95 -0
  84. package/dist/cjs/ag-grid-plus/utils/columnProcessors.js +265 -0
  85. package/dist/cjs/ag-grid-plus/utils/constants.d.ts +41 -0
  86. package/dist/cjs/ag-grid-plus/utils/constants.js +56 -0
  87. package/dist/cjs/ag-grid-plus/utils/logger.d.ts +34 -0
  88. package/dist/cjs/ag-grid-plus/utils/logger.js +119 -0
  89. package/dist/cjs/ag-grid-plus/utils/sanitize.d.ts +15 -0
  90. package/dist/cjs/ag-grid-plus/utils/sanitize.js +39 -0
  91. package/dist/cjs/index.d.ts +3 -2
  92. package/dist/cjs/index.js +84 -0
  93. package/dist/esm/ag-grid-plus/ag-gridPlus.js +410 -206
  94. package/dist/esm/ag-grid-plus/context/gridContext.d.ts +30 -5
  95. package/dist/esm/ag-grid-plus/context/gridContext.js +6 -1
  96. package/dist/esm/ag-grid-plus/errors/ErrorBoundary.d.ts +36 -0
  97. package/dist/esm/ag-grid-plus/errors/ErrorBoundary.js +137 -0
  98. package/dist/esm/ag-grid-plus/errors/index.d.ts +3 -0
  99. package/dist/esm/ag-grid-plus/errors/index.js +2 -0
  100. package/dist/esm/ag-grid-plus/errors/types.d.ts +71 -0
  101. package/dist/esm/ag-grid-plus/errors/types.js +135 -0
  102. package/dist/esm/ag-grid-plus/hooks/index.d.ts +7 -0
  103. package/dist/esm/ag-grid-plus/hooks/index.js +10 -0
  104. package/dist/esm/ag-grid-plus/hooks/useAgGridCalculation.d.ts +88 -0
  105. package/dist/esm/ag-grid-plus/hooks/useAgGridCalculation.js +217 -0
  106. package/dist/esm/ag-grid-plus/hooks/useAgGridData.d.ts +91 -0
  107. package/dist/esm/ag-grid-plus/hooks/useAgGridData.js +225 -0
  108. package/dist/esm/ag-grid-plus/hooks/useGridPlusColumnState.d.ts +1 -8
  109. package/dist/esm/ag-grid-plus/hooks/useGridState.d.ts +153 -0
  110. package/dist/esm/ag-grid-plus/hooks/useGridState.js +258 -0
  111. package/dist/esm/ag-grid-plus/index.d.ts +5 -0
  112. package/dist/esm/ag-grid-plus/index.js +6 -1
  113. package/dist/esm/ag-grid-plus/interface.d.ts +37 -0
  114. package/dist/esm/ag-grid-plus/querySchemes/components/QuerySchemesManager.d.ts +21 -0
  115. package/dist/esm/ag-grid-plus/querySchemes/components/QuerySchemesManager.js +572 -0
  116. package/dist/esm/ag-grid-plus/querySchemes/components/QuerySchemesManager.less +86 -0
  117. package/dist/esm/ag-grid-plus/querySchemes/components/index.d.ts +5 -0
  118. package/dist/esm/ag-grid-plus/querySchemes/components/index.js +5 -0
  119. package/dist/esm/ag-grid-plus/querySchemes/constants.d.ts +17 -0
  120. package/dist/esm/ag-grid-plus/querySchemes/constants.js +24 -0
  121. package/dist/esm/ag-grid-plus/querySchemes/hooks/useQueryOrderManager.d.ts +10 -0
  122. package/dist/esm/ag-grid-plus/querySchemes/hooks/useQueryOrderManager.js +60 -0
  123. package/dist/esm/ag-grid-plus/querySchemes/hooks/useQuerySchemes.d.ts +6 -0
  124. package/dist/esm/ag-grid-plus/querySchemes/hooks/useQuerySchemes.js +537 -0
  125. package/dist/esm/ag-grid-plus/querySchemes/hooks/useQuerySchemes.refactored.d.ts +7 -0
  126. package/dist/esm/ag-grid-plus/querySchemes/hooks/useQuerySchemes.refactored.js +27 -0
  127. package/dist/esm/ag-grid-plus/querySchemes/index.d.ts +11 -0
  128. package/dist/esm/ag-grid-plus/querySchemes/index.js +20 -0
  129. package/dist/esm/ag-grid-plus/querySchemes/storage/localStorageAdapter.d.ts +44 -0
  130. package/dist/esm/ag-grid-plus/querySchemes/storage/localStorageAdapter.js +256 -0
  131. package/dist/esm/ag-grid-plus/querySchemes/types.d.ts +143 -0
  132. package/dist/esm/ag-grid-plus/querySchemes/types.js +1 -0
  133. package/dist/esm/ag-grid-plus/querySchemes/utils/validator.d.ts +36 -0
  134. package/dist/esm/ag-grid-plus/querySchemes/utils/validator.js +144 -0
  135. package/dist/esm/ag-grid-plus/schemes/components/SchemeManager.d.ts +16 -0
  136. package/dist/esm/ag-grid-plus/schemes/components/SchemeManager.js +334 -0
  137. package/dist/esm/ag-grid-plus/schemes/components/SchemeManager.less +35 -0
  138. package/dist/esm/ag-grid-plus/schemes/components/SchemeSelector.d.ts +20 -0
  139. package/dist/esm/ag-grid-plus/schemes/components/SchemeSelector.js +281 -0
  140. package/dist/esm/ag-grid-plus/schemes/components/SchemeSelector.less +39 -0
  141. package/dist/esm/ag-grid-plus/schemes/components/index.d.ts +4 -0
  142. package/dist/esm/ag-grid-plus/schemes/components/index.js +2 -0
  143. package/dist/esm/ag-grid-plus/schemes/constants.d.ts +23 -0
  144. package/dist/esm/ag-grid-plus/schemes/constants.js +33 -0
  145. package/dist/esm/ag-grid-plus/schemes/hooks/useColumnSchemes.d.ts +6 -0
  146. package/dist/esm/ag-grid-plus/schemes/hooks/useColumnSchemes.js +537 -0
  147. package/dist/esm/ag-grid-plus/schemes/hooks/useColumnSchemes.refactored.d.ts +7 -0
  148. package/dist/esm/ag-grid-plus/schemes/hooks/useColumnSchemes.refactored.js +27 -0
  149. package/dist/esm/ag-grid-plus/schemes/index.d.ts +16 -0
  150. package/dist/esm/ag-grid-plus/schemes/index.js +25 -0
  151. package/dist/esm/ag-grid-plus/schemes/storage/localStorageAdapter.d.ts +64 -0
  152. package/dist/esm/ag-grid-plus/schemes/storage/localStorageAdapter.js +363 -0
  153. package/dist/esm/ag-grid-plus/schemes/types.d.ts +126 -0
  154. package/dist/esm/ag-grid-plus/schemes/types.js +1 -0
  155. package/dist/esm/ag-grid-plus/schemes/utils/validator.d.ts +27 -0
  156. package/dist/esm/ag-grid-plus/schemes/utils/validator.js +104 -0
  157. package/dist/esm/ag-grid-plus/setting/ColumnSetting.d.ts +17 -0
  158. package/dist/esm/ag-grid-plus/setting/ColumnSetting.js +946 -0
  159. package/dist/esm/ag-grid-plus/setting/index.d.ts +1 -1
  160. package/dist/esm/ag-grid-plus/setting/index.js +69 -107
  161. package/dist/esm/ag-grid-plus/shared/hooks/useSchemeManager.d.ts +66 -0
  162. package/dist/esm/ag-grid-plus/shared/hooks/useSchemeManager.js +643 -0
  163. package/dist/esm/ag-grid-plus/storage/MemoryStorageAdapter.d.ts +76 -0
  164. package/dist/esm/ag-grid-plus/storage/MemoryStorageAdapter.js +273 -0
  165. package/dist/esm/ag-grid-plus/storage/SchemeSyncManager.d.ts +114 -0
  166. package/dist/esm/ag-grid-plus/storage/SchemeSyncManager.js +609 -0
  167. package/dist/esm/ag-grid-plus/storage/globalSyncManager.d.ts +100 -0
  168. package/dist/esm/ag-grid-plus/storage/globalSyncManager.js +321 -0
  169. package/dist/esm/ag-grid-plus/storage/index.d.ts +8 -0
  170. package/dist/esm/ag-grid-plus/storage/index.js +9 -0
  171. package/dist/esm/ag-grid-plus/storage/types.d.ts +144 -0
  172. package/dist/esm/ag-grid-plus/storage/types.js +1 -0
  173. package/dist/esm/ag-grid-plus/types.d.ts +310 -0
  174. package/dist/esm/ag-grid-plus/types.js +1 -0
  175. package/dist/esm/ag-grid-plus/utils/columnProcessors.d.ts +95 -0
  176. package/dist/esm/ag-grid-plus/utils/columnProcessors.js +251 -0
  177. package/dist/esm/ag-grid-plus/utils/constants.d.ts +41 -0
  178. package/dist/esm/ag-grid-plus/utils/constants.js +50 -0
  179. package/dist/esm/ag-grid-plus/utils/logger.d.ts +34 -0
  180. package/dist/esm/ag-grid-plus/utils/logger.js +114 -0
  181. package/dist/esm/ag-grid-plus/utils/sanitize.d.ts +15 -0
  182. package/dist/esm/ag-grid-plus/utils/sanitize.js +32 -0
  183. package/dist/esm/index.d.ts +3 -2
  184. package/dist/esm/index.js +8 -2
  185. package/dist/esm/standardFormDialog/useStandardFormSchema.d.ts +1 -1
  186. package/dist/esm/standardFormDialog/withStandardForm.d.ts +2 -2
  187. package/dist/umd/qc-ui.min.css +1 -1
  188. package/dist/umd/qc-ui.min.js +1 -1
  189. package/package.json +3 -2
@@ -0,0 +1,76 @@
1
+ /**
2
+ * 内存存储适配器
3
+ * 实现 StorageAdapter 接口,数据存储在内存中,通过 SchemeSyncManager 同步到服务器
4
+ */
5
+ import { StorageAdapter } from '../shared/hooks/useSchemeManager';
6
+ import { ColumnScheme } from '../schemes/types';
7
+ import { QueryScheme } from '../querySchemes/types';
8
+ import { SchemeSyncManager } from './SchemeSyncManager';
9
+ /**
10
+ * 列方案内存存储适配器
11
+ */
12
+ export declare class ColumnMemoryStorageAdapter implements StorageAdapter<ColumnScheme> {
13
+ private syncManager;
14
+ constructor(syncManager: SchemeSyncManager);
15
+ /**
16
+ * 获取方案列表
17
+ */
18
+ getSchemes(gridId: string): Promise<ColumnScheme[]>;
19
+ /**
20
+ * 保存方案列表
21
+ */
22
+ saveSchemes(gridId: string, schemes: ColumnScheme[]): Promise<void>;
23
+ /**
24
+ * 获取当前方案ID
25
+ */
26
+ getCurrentSchemeId(gridId: string): Promise<string | null>;
27
+ /**
28
+ * 保存当前方案ID
29
+ */
30
+ saveCurrentSchemeId(gridId: string, schemeId: string | null): Promise<void>;
31
+ }
32
+ /**
33
+ * 查询方案内存存储适配器
34
+ */
35
+ export declare class QueryMemoryStorageAdapter implements StorageAdapter<QueryScheme> {
36
+ private syncManager;
37
+ constructor(syncManager: SchemeSyncManager);
38
+ /**
39
+ * 获取方案列表
40
+ */
41
+ getSchemes(gridId: string): Promise<QueryScheme[]>;
42
+ /**
43
+ * 保存方案列表
44
+ */
45
+ saveSchemes(gridId: string, schemes: QueryScheme[]): Promise<void>;
46
+ /**
47
+ * 获取当前方案ID
48
+ */
49
+ getCurrentSchemeId(gridId: string): Promise<string | null>;
50
+ /**
51
+ * 保存当前方案ID
52
+ */
53
+ saveCurrentSchemeId(gridId: string, schemeId: string | null): Promise<void>;
54
+ }
55
+ /**
56
+ * 通用内存存储适配器工厂
57
+ * 根据方案类型创建对应的内存存储适配器
58
+ */
59
+ export declare class MemoryStorageAdapterFactory {
60
+ private syncManager;
61
+ private columnAdapter?;
62
+ private queryAdapter?;
63
+ constructor(syncManager: SchemeSyncManager);
64
+ /**
65
+ * 获取列方案存储适配器
66
+ */
67
+ getColumnAdapter(): ColumnMemoryStorageAdapter;
68
+ /**
69
+ * 获取查询方案存储适配器
70
+ */
71
+ getQueryAdapter(): QueryMemoryStorageAdapter;
72
+ /**
73
+ * 获取同步管理器
74
+ */
75
+ getSyncManager(): SchemeSyncManager;
76
+ }
@@ -0,0 +1,276 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.QueryMemoryStorageAdapter = exports.MemoryStorageAdapterFactory = exports.ColumnMemoryStorageAdapter = void 0;
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; }
9
+ 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); } }
10
+ 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); }); }; }
11
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
12
+ 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); } }
13
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
14
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
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
+ * 内存存储适配器
19
+ * 实现 StorageAdapter 接口,数据存储在内存中,通过 SchemeSyncManager 同步到服务器
20
+ */
21
+ /**
22
+ * 列方案内存存储适配器
23
+ */
24
+ var ColumnMemoryStorageAdapter = exports.ColumnMemoryStorageAdapter = /*#__PURE__*/function () {
25
+ function ColumnMemoryStorageAdapter(syncManager) {
26
+ _classCallCheck(this, ColumnMemoryStorageAdapter);
27
+ _defineProperty(this, "syncManager", void 0);
28
+ this.syncManager = syncManager;
29
+ }
30
+
31
+ /**
32
+ * 获取方案列表
33
+ */
34
+ _createClass(ColumnMemoryStorageAdapter, [{
35
+ key: "getSchemes",
36
+ value: (function () {
37
+ var _getSchemes = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(gridId) {
38
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
39
+ while (1) switch (_context.prev = _context.next) {
40
+ case 0:
41
+ return _context.abrupt("return", this.syncManager.getColumnSchemes(gridId));
42
+ case 1:
43
+ case "end":
44
+ return _context.stop();
45
+ }
46
+ }, _callee, this);
47
+ }));
48
+ function getSchemes(_x) {
49
+ return _getSchemes.apply(this, arguments);
50
+ }
51
+ return getSchemes;
52
+ }()
53
+ /**
54
+ * 保存方案列表
55
+ */
56
+ )
57
+ }, {
58
+ key: "saveSchemes",
59
+ value: (function () {
60
+ var _saveSchemes = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(gridId, schemes) {
61
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
62
+ while (1) switch (_context2.prev = _context2.next) {
63
+ case 0:
64
+ this.syncManager.saveColumnSchemes(gridId, schemes);
65
+ case 1:
66
+ case "end":
67
+ return _context2.stop();
68
+ }
69
+ }, _callee2, this);
70
+ }));
71
+ function saveSchemes(_x2, _x3) {
72
+ return _saveSchemes.apply(this, arguments);
73
+ }
74
+ return saveSchemes;
75
+ }()
76
+ /**
77
+ * 获取当前方案ID
78
+ */
79
+ )
80
+ }, {
81
+ key: "getCurrentSchemeId",
82
+ value: (function () {
83
+ var _getCurrentSchemeId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(gridId) {
84
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
85
+ while (1) switch (_context3.prev = _context3.next) {
86
+ case 0:
87
+ return _context3.abrupt("return", this.syncManager.getCurrentSchemeId(gridId, 'column'));
88
+ case 1:
89
+ case "end":
90
+ return _context3.stop();
91
+ }
92
+ }, _callee3, this);
93
+ }));
94
+ function getCurrentSchemeId(_x4) {
95
+ return _getCurrentSchemeId.apply(this, arguments);
96
+ }
97
+ return getCurrentSchemeId;
98
+ }()
99
+ /**
100
+ * 保存当前方案ID
101
+ */
102
+ )
103
+ }, {
104
+ key: "saveCurrentSchemeId",
105
+ value: (function () {
106
+ var _saveCurrentSchemeId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(gridId, schemeId) {
107
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
108
+ while (1) switch (_context4.prev = _context4.next) {
109
+ case 0:
110
+ this.syncManager.saveCurrentSchemeId(gridId, 'column', schemeId);
111
+ case 1:
112
+ case "end":
113
+ return _context4.stop();
114
+ }
115
+ }, _callee4, this);
116
+ }));
117
+ function saveCurrentSchemeId(_x5, _x6) {
118
+ return _saveCurrentSchemeId.apply(this, arguments);
119
+ }
120
+ return saveCurrentSchemeId;
121
+ }())
122
+ }]);
123
+ return ColumnMemoryStorageAdapter;
124
+ }();
125
+ /**
126
+ * 查询方案内存存储适配器
127
+ */
128
+ var QueryMemoryStorageAdapter = exports.QueryMemoryStorageAdapter = /*#__PURE__*/function () {
129
+ function QueryMemoryStorageAdapter(syncManager) {
130
+ _classCallCheck(this, QueryMemoryStorageAdapter);
131
+ _defineProperty(this, "syncManager", void 0);
132
+ this.syncManager = syncManager;
133
+ }
134
+
135
+ /**
136
+ * 获取方案列表
137
+ */
138
+ _createClass(QueryMemoryStorageAdapter, [{
139
+ key: "getSchemes",
140
+ value: (function () {
141
+ var _getSchemes2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(gridId) {
142
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
143
+ while (1) switch (_context5.prev = _context5.next) {
144
+ case 0:
145
+ return _context5.abrupt("return", this.syncManager.getQuerySchemes(gridId));
146
+ case 1:
147
+ case "end":
148
+ return _context5.stop();
149
+ }
150
+ }, _callee5, this);
151
+ }));
152
+ function getSchemes(_x7) {
153
+ return _getSchemes2.apply(this, arguments);
154
+ }
155
+ return getSchemes;
156
+ }()
157
+ /**
158
+ * 保存方案列表
159
+ */
160
+ )
161
+ }, {
162
+ key: "saveSchemes",
163
+ value: (function () {
164
+ var _saveSchemes2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(gridId, schemes) {
165
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
166
+ while (1) switch (_context6.prev = _context6.next) {
167
+ case 0:
168
+ this.syncManager.saveQuerySchemes(gridId, schemes);
169
+ case 1:
170
+ case "end":
171
+ return _context6.stop();
172
+ }
173
+ }, _callee6, this);
174
+ }));
175
+ function saveSchemes(_x8, _x9) {
176
+ return _saveSchemes2.apply(this, arguments);
177
+ }
178
+ return saveSchemes;
179
+ }()
180
+ /**
181
+ * 获取当前方案ID
182
+ */
183
+ )
184
+ }, {
185
+ key: "getCurrentSchemeId",
186
+ value: (function () {
187
+ var _getCurrentSchemeId2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(gridId) {
188
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
189
+ while (1) switch (_context7.prev = _context7.next) {
190
+ case 0:
191
+ return _context7.abrupt("return", this.syncManager.getCurrentSchemeId(gridId, 'query'));
192
+ case 1:
193
+ case "end":
194
+ return _context7.stop();
195
+ }
196
+ }, _callee7, this);
197
+ }));
198
+ function getCurrentSchemeId(_x10) {
199
+ return _getCurrentSchemeId2.apply(this, arguments);
200
+ }
201
+ return getCurrentSchemeId;
202
+ }()
203
+ /**
204
+ * 保存当前方案ID
205
+ */
206
+ )
207
+ }, {
208
+ key: "saveCurrentSchemeId",
209
+ value: (function () {
210
+ var _saveCurrentSchemeId2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(gridId, schemeId) {
211
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
212
+ while (1) switch (_context8.prev = _context8.next) {
213
+ case 0:
214
+ this.syncManager.saveCurrentSchemeId(gridId, 'query', schemeId);
215
+ case 1:
216
+ case "end":
217
+ return _context8.stop();
218
+ }
219
+ }, _callee8, this);
220
+ }));
221
+ function saveCurrentSchemeId(_x11, _x12) {
222
+ return _saveCurrentSchemeId2.apply(this, arguments);
223
+ }
224
+ return saveCurrentSchemeId;
225
+ }())
226
+ }]);
227
+ return QueryMemoryStorageAdapter;
228
+ }();
229
+ /**
230
+ * 通用内存存储适配器工厂
231
+ * 根据方案类型创建对应的内存存储适配器
232
+ */
233
+ var MemoryStorageAdapterFactory = exports.MemoryStorageAdapterFactory = /*#__PURE__*/function () {
234
+ function MemoryStorageAdapterFactory(syncManager) {
235
+ _classCallCheck(this, MemoryStorageAdapterFactory);
236
+ _defineProperty(this, "syncManager", void 0);
237
+ _defineProperty(this, "columnAdapter", void 0);
238
+ _defineProperty(this, "queryAdapter", void 0);
239
+ this.syncManager = syncManager;
240
+ }
241
+
242
+ /**
243
+ * 获取列方案存储适配器
244
+ */
245
+ _createClass(MemoryStorageAdapterFactory, [{
246
+ key: "getColumnAdapter",
247
+ value: function getColumnAdapter() {
248
+ if (!this.columnAdapter) {
249
+ this.columnAdapter = new ColumnMemoryStorageAdapter(this.syncManager);
250
+ }
251
+ return this.columnAdapter;
252
+ }
253
+
254
+ /**
255
+ * 获取查询方案存储适配器
256
+ */
257
+ }, {
258
+ key: "getQueryAdapter",
259
+ value: function getQueryAdapter() {
260
+ if (!this.queryAdapter) {
261
+ this.queryAdapter = new QueryMemoryStorageAdapter(this.syncManager);
262
+ }
263
+ return this.queryAdapter;
264
+ }
265
+
266
+ /**
267
+ * 获取同步管理器
268
+ */
269
+ }, {
270
+ key: "getSyncManager",
271
+ value: function getSyncManager() {
272
+ return this.syncManager;
273
+ }
274
+ }]);
275
+ return MemoryStorageAdapterFactory;
276
+ }();
@@ -0,0 +1,114 @@
1
+ /**
2
+ * 方案同步管理器
3
+ * 负责所有与后端的数据同步操作
4
+ */
5
+ import { DirtyType, SyncConfig, SyncManagerEvents } from './types';
6
+ import { ColumnScheme } from '../schemes/types';
7
+ import { QueryScheme } from '../querySchemes/types';
8
+ /**
9
+ * 方案同步管理器类
10
+ */
11
+ export declare class SchemeSyncManager {
12
+ private config;
13
+ private events;
14
+ private allData;
15
+ private lastSyncTime;
16
+ private syncing;
17
+ private initialized;
18
+ private dirtyGrids;
19
+ private autoSaveTimer?;
20
+ private backgroundSyncTimer?;
21
+ constructor(config: SyncConfig, events?: SyncManagerEvents);
22
+ /**
23
+ * 获取方案的完整 API URL (GET请求)
24
+ * @private
25
+ */
26
+ private getGetApiUrl;
27
+ /**
28
+ * 同步方案的完整 API URL (PUT请求)
29
+ * @private
30
+ */
31
+ private getSyncApiUrl;
32
+ /**
33
+ * 初始化:从服务器加载所有数据
34
+ */
35
+ initialize(): Promise<void>;
36
+ /**
37
+ * 销毁管理器
38
+ */
39
+ destroy(): void;
40
+ /**
41
+ * 获取列方案数据
42
+ */
43
+ getColumnSchemes(gridId: string): ColumnScheme[];
44
+ /**
45
+ * 保存列方案数据
46
+ */
47
+ saveColumnSchemes(gridId: string, schemes: ColumnScheme[]): void;
48
+ /**
49
+ * 获取查询方案数据
50
+ */
51
+ getQuerySchemes(gridId: string): QueryScheme[];
52
+ /**
53
+ * 保存查询方案数据
54
+ */
55
+ saveQuerySchemes(gridId: string, schemes: QueryScheme[]): void;
56
+ /**
57
+ * 获取当前方案ID
58
+ */
59
+ getCurrentSchemeId(gridId: string, type: 'column' | 'query'): string | null;
60
+ /**
61
+ * 保存当前方案ID
62
+ */
63
+ saveCurrentSchemeId(gridId: string, type: 'column' | 'query', schemeId: string | null): void;
64
+ /**
65
+ * 标记数据为脏数据
66
+ */
67
+ markDirty(gridId: string, type: DirtyType): void;
68
+ /**
69
+ * 检查是否有未同步的数据
70
+ */
71
+ hasDirtyData(): boolean;
72
+ /**
73
+ * 获取所有脏数据的 gridId 列表
74
+ */
75
+ getDirtyGridIds(): string[];
76
+ /**
77
+ * 调度自动保存
78
+ */
79
+ private scheduleAutoSave;
80
+ /**
81
+ * 启动后台同步
82
+ */
83
+ private startBackgroundSync;
84
+ /**
85
+ * 立即同步数据到服务器
86
+ */
87
+ syncNow(): Promise<void>;
88
+ /**
89
+ * 处理冲突
90
+ */
91
+ private handleConflicts;
92
+ /**
93
+ * 应用服务器版本
94
+ */
95
+ private applyServerVersion;
96
+ /**
97
+ * 页面卸载前同步
98
+ */
99
+ private handleBeforeUnload;
100
+ /**
101
+ * 带重试的 fetch 请求
102
+ */
103
+ private fetchWithRetry;
104
+ /**
105
+ * 获取同步状态信息
106
+ */
107
+ getSyncStatus(): {
108
+ initialized: boolean;
109
+ syncing: boolean;
110
+ lastSyncTime: number;
111
+ hasDirtyData: boolean;
112
+ dirtyGrids: string[];
113
+ };
114
+ }