@nokecy/qc-ui 1.0.94 → 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 (150) hide show
  1. package/dist/cjs/ag-grid-plus/ag-gridPlus.js +252 -173
  2. package/dist/cjs/ag-grid-plus/context/gridContext.d.ts +77 -19
  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 -2
  11. package/dist/cjs/ag-grid-plus/index.js +11 -93
  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 +279 -145
  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} +193 -108
  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/{schemes → shared}/storage/localStorageAdapter.js +253 -271
  24. package/dist/cjs/ag-grid-plus/shared/storage/schemeStorageAdapter.d.ts +132 -0
  25. package/dist/cjs/array-table/index.js +167 -45
  26. package/dist/cjs/index.d.ts +3 -3
  27. package/dist/cjs/index.js +14 -86
  28. package/dist/esm/ag-grid-plus/ag-gridPlus.js +252 -173
  29. package/dist/esm/ag-grid-plus/context/gridContext.d.ts +77 -19
  30. package/dist/esm/ag-grid-plus/context/gridContext.js +0 -4
  31. package/dist/esm/ag-grid-plus/context/useSchemeDataFlow.d.ts +88 -0
  32. package/dist/esm/ag-grid-plus/context/useSchemeDataFlow.js +165 -0
  33. package/dist/esm/ag-grid-plus/context/useSchemeManager.d.ts +78 -0
  34. package/dist/esm/ag-grid-plus/{querySchemes/hooks/useQuerySchemes.js → context/useSchemeManager.js} +420 -449
  35. package/dist/esm/ag-grid-plus/hooks/useAgGridCalculation.d.ts +1 -1
  36. package/dist/esm/ag-grid-plus/hooks/useAgGridData.d.ts +2 -2
  37. package/dist/esm/ag-grid-plus/index.d.ts +7 -2
  38. package/dist/esm/ag-grid-plus/index.js +9 -5
  39. package/dist/esm/ag-grid-plus/interface.d.ts +0 -31
  40. package/dist/esm/ag-grid-plus/interface.js +2 -0
  41. package/dist/esm/ag-grid-plus/setting/ColumnSetting.d.ts +0 -3
  42. package/dist/esm/ag-grid-plus/setting/ColumnSetting.js +281 -147
  43. package/dist/esm/ag-grid-plus/setting/QuerySchemeManager.d.ts +11 -0
  44. package/dist/esm/ag-grid-plus/{querySchemes/components/QuerySchemesManager.js → setting/QuerySchemeManager.js} +192 -107
  45. package/dist/esm/ag-grid-plus/setting/index.d.ts +2 -2
  46. package/dist/esm/ag-grid-plus/setting/index.js +33 -48
  47. package/dist/esm/ag-grid-plus/shared/storage/backendApiAdapter.d.ts +58 -0
  48. package/dist/esm/ag-grid-plus/shared/storage/backendApiAdapter.js +444 -0
  49. package/dist/esm/ag-grid-plus/shared/storage/localStorageAdapter.d.ts +57 -0
  50. package/dist/esm/ag-grid-plus/{schemes → shared}/storage/localStorageAdapter.js +252 -271
  51. package/dist/esm/ag-grid-plus/shared/storage/schemeStorageAdapter.d.ts +132 -0
  52. package/dist/esm/array-table/index.js +168 -46
  53. package/dist/esm/index.d.ts +3 -3
  54. package/dist/esm/index.js +11 -11
  55. package/dist/esm/standardFormDialog/useStandardFormSchema.d.ts +1 -1
  56. package/dist/umd/qc-ui.min.css +1 -1
  57. package/dist/umd/qc-ui.min.js +1 -1
  58. package/package.json +1 -1
  59. package/dist/cjs/ag-grid-plus/querySchemes/components/QuerySchemesManager.d.ts +0 -21
  60. package/dist/cjs/ag-grid-plus/querySchemes/components/QuerySchemesManager.less +0 -86
  61. package/dist/cjs/ag-grid-plus/querySchemes/components/index.d.ts +0 -5
  62. package/dist/cjs/ag-grid-plus/querySchemes/components/index.js +0 -12
  63. package/dist/cjs/ag-grid-plus/querySchemes/constants.d.ts +0 -17
  64. package/dist/cjs/ag-grid-plus/querySchemes/constants.js +0 -30
  65. package/dist/cjs/ag-grid-plus/querySchemes/hooks/useQueryOrderManager.d.ts +0 -10
  66. package/dist/cjs/ag-grid-plus/querySchemes/hooks/useQueryOrderManager.js +0 -65
  67. package/dist/cjs/ag-grid-plus/querySchemes/hooks/useQuerySchemes.d.ts +0 -6
  68. package/dist/cjs/ag-grid-plus/querySchemes/index.d.ts +0 -11
  69. package/dist/cjs/ag-grid-plus/querySchemes/index.js +0 -113
  70. package/dist/cjs/ag-grid-plus/querySchemes/storage/localStorageAdapter.d.ts +0 -44
  71. package/dist/cjs/ag-grid-plus/querySchemes/storage/localStorageAdapter.js +0 -261
  72. package/dist/cjs/ag-grid-plus/querySchemes/types.d.ts +0 -145
  73. package/dist/cjs/ag-grid-plus/querySchemes/utils/validator.d.ts +0 -36
  74. package/dist/cjs/ag-grid-plus/querySchemes/utils/validator.js +0 -155
  75. package/dist/cjs/ag-grid-plus/schemes/components/SchemeManager.d.ts +0 -16
  76. package/dist/cjs/ag-grid-plus/schemes/components/SchemeManager.js +0 -342
  77. package/dist/cjs/ag-grid-plus/schemes/components/SchemeManager.less +0 -35
  78. package/dist/cjs/ag-grid-plus/schemes/components/SchemeSelector.d.ts +0 -20
  79. package/dist/cjs/ag-grid-plus/schemes/components/SchemeSelector.js +0 -289
  80. package/dist/cjs/ag-grid-plus/schemes/components/SchemeSelector.less +0 -39
  81. package/dist/cjs/ag-grid-plus/schemes/components/index.d.ts +0 -4
  82. package/dist/cjs/ag-grid-plus/schemes/components/index.js +0 -19
  83. package/dist/cjs/ag-grid-plus/schemes/constants.d.ts +0 -23
  84. package/dist/cjs/ag-grid-plus/schemes/constants.js +0 -39
  85. package/dist/cjs/ag-grid-plus/schemes/hooks/useColumnSchemes.d.ts +0 -6
  86. package/dist/cjs/ag-grid-plus/schemes/hooks/useColumnSchemes.js +0 -617
  87. package/dist/cjs/ag-grid-plus/schemes/index.d.ts +0 -23
  88. package/dist/cjs/ag-grid-plus/schemes/index.js +0 -164
  89. package/dist/cjs/ag-grid-plus/schemes/storage/configMerger.d.ts +0 -10
  90. package/dist/cjs/ag-grid-plus/schemes/storage/configMerger.js +0 -34
  91. package/dist/cjs/ag-grid-plus/schemes/storage/localStorageAdapter.d.ts +0 -79
  92. package/dist/cjs/ag-grid-plus/schemes/storage/priorityStorageAdapter.d.ts +0 -122
  93. package/dist/cjs/ag-grid-plus/schemes/storage/priorityStorageAdapter.js +0 -476
  94. package/dist/cjs/ag-grid-plus/schemes/storage/remoteStorageAdapter.d.ts +0 -139
  95. package/dist/cjs/ag-grid-plus/schemes/storage/remoteStorageAdapter.js +0 -746
  96. package/dist/cjs/ag-grid-plus/schemes/storage/useRemoteStorage.d.ts +0 -29
  97. package/dist/cjs/ag-grid-plus/schemes/storage/useRemoteStorage.js +0 -45
  98. package/dist/cjs/ag-grid-plus/schemes/types.d.ts +0 -131
  99. package/dist/cjs/ag-grid-plus/schemes/types.js +0 -5
  100. package/dist/cjs/ag-grid-plus/schemes/utils/validator.d.ts +0 -27
  101. package/dist/cjs/ag-grid-plus/schemes/utils/validator.js +0 -109
  102. package/dist/cjs/ag-grid-plus/storage/index.d.ts +0 -13
  103. package/dist/cjs/ag-grid-plus/storage/index.js +0 -5
  104. package/dist/esm/ag-grid-plus/querySchemes/components/QuerySchemesManager.d.ts +0 -21
  105. package/dist/esm/ag-grid-plus/querySchemes/components/QuerySchemesManager.less +0 -86
  106. package/dist/esm/ag-grid-plus/querySchemes/components/index.d.ts +0 -5
  107. package/dist/esm/ag-grid-plus/querySchemes/components/index.js +0 -5
  108. package/dist/esm/ag-grid-plus/querySchemes/constants.d.ts +0 -17
  109. package/dist/esm/ag-grid-plus/querySchemes/constants.js +0 -24
  110. package/dist/esm/ag-grid-plus/querySchemes/hooks/useQueryOrderManager.d.ts +0 -10
  111. package/dist/esm/ag-grid-plus/querySchemes/hooks/useQueryOrderManager.js +0 -60
  112. package/dist/esm/ag-grid-plus/querySchemes/hooks/useQuerySchemes.d.ts +0 -6
  113. package/dist/esm/ag-grid-plus/querySchemes/index.d.ts +0 -11
  114. package/dist/esm/ag-grid-plus/querySchemes/index.js +0 -20
  115. package/dist/esm/ag-grid-plus/querySchemes/storage/localStorageAdapter.d.ts +0 -44
  116. package/dist/esm/ag-grid-plus/querySchemes/storage/localStorageAdapter.js +0 -256
  117. package/dist/esm/ag-grid-plus/querySchemes/types.d.ts +0 -145
  118. package/dist/esm/ag-grid-plus/querySchemes/utils/validator.d.ts +0 -36
  119. package/dist/esm/ag-grid-plus/querySchemes/utils/validator.js +0 -144
  120. package/dist/esm/ag-grid-plus/schemes/components/SchemeManager.d.ts +0 -16
  121. package/dist/esm/ag-grid-plus/schemes/components/SchemeManager.js +0 -334
  122. package/dist/esm/ag-grid-plus/schemes/components/SchemeManager.less +0 -35
  123. package/dist/esm/ag-grid-plus/schemes/components/SchemeSelector.d.ts +0 -20
  124. package/dist/esm/ag-grid-plus/schemes/components/SchemeSelector.js +0 -281
  125. package/dist/esm/ag-grid-plus/schemes/components/SchemeSelector.less +0 -39
  126. package/dist/esm/ag-grid-plus/schemes/components/index.d.ts +0 -4
  127. package/dist/esm/ag-grid-plus/schemes/components/index.js +0 -2
  128. package/dist/esm/ag-grid-plus/schemes/constants.d.ts +0 -23
  129. package/dist/esm/ag-grid-plus/schemes/constants.js +0 -33
  130. package/dist/esm/ag-grid-plus/schemes/hooks/useColumnSchemes.d.ts +0 -6
  131. package/dist/esm/ag-grid-plus/schemes/hooks/useColumnSchemes.js +0 -612
  132. package/dist/esm/ag-grid-plus/schemes/index.d.ts +0 -23
  133. package/dist/esm/ag-grid-plus/schemes/index.js +0 -30
  134. package/dist/esm/ag-grid-plus/schemes/storage/configMerger.d.ts +0 -10
  135. package/dist/esm/ag-grid-plus/schemes/storage/configMerger.js +0 -28
  136. package/dist/esm/ag-grid-plus/schemes/storage/localStorageAdapter.d.ts +0 -79
  137. package/dist/esm/ag-grid-plus/schemes/storage/priorityStorageAdapter.d.ts +0 -122
  138. package/dist/esm/ag-grid-plus/schemes/storage/priorityStorageAdapter.js +0 -471
  139. package/dist/esm/ag-grid-plus/schemes/storage/remoteStorageAdapter.d.ts +0 -139
  140. package/dist/esm/ag-grid-plus/schemes/storage/remoteStorageAdapter.js +0 -746
  141. package/dist/esm/ag-grid-plus/schemes/storage/useRemoteStorage.d.ts +0 -29
  142. package/dist/esm/ag-grid-plus/schemes/storage/useRemoteStorage.js +0 -40
  143. package/dist/esm/ag-grid-plus/schemes/types.d.ts +0 -131
  144. package/dist/esm/ag-grid-plus/schemes/types.js +0 -1
  145. package/dist/esm/ag-grid-plus/schemes/utils/validator.d.ts +0 -27
  146. package/dist/esm/ag-grid-plus/schemes/utils/validator.js +0 -100
  147. package/dist/esm/ag-grid-plus/storage/index.d.ts +0 -13
  148. package/dist/esm/ag-grid-plus/storage/index.js +0 -17
  149. /package/dist/cjs/ag-grid-plus/{querySchemes/types.js → shared/storage/schemeStorageAdapter.js} +0 -0
  150. /package/dist/esm/ag-grid-plus/{querySchemes/types.js → shared/storage/schemeStorageAdapter.js} +0 -0
@@ -1,3 +1,7 @@
1
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
2
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
4
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
1
5
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
6
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
7
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
@@ -5,58 +9,42 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
5
9
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
6
10
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
11
  import { SettingOutlined } from '@ant-design/icons';
12
+ import React, { useState } from "react";
8
13
  import { Dropdown } from 'antd';
9
- import React, { useState, useContext } from "react";
10
- import { GridPlusContext } from "../context/gridContext";
11
- import { QuerySchemesManager } from "../querySchemes/components/QuerySchemesManager";
12
14
  import ColumnSetting from "./ColumnSetting";
15
+ import QuerySchemeManager from "./QuerySchemeManager";
13
16
  var Setting = function Setting(props) {
14
17
  var gridKey = props.gridKey,
15
18
  gridApi = props.gridApi,
16
- gridApiState = props.gridApiState,
17
- onSaveColumnState = props.onSaveColumnState;
18
- var gridPlusContext = useContext(GridPlusContext);
19
- // 优先使用外部传入的 schemeManager,否则使用 Context 中的
20
- var schemeManager = props.schemeManager || (gridPlusContext === null || gridPlusContext === void 0 ? void 0 : gridPlusContext.schemeManager);
21
- var querySchemeManager = gridPlusContext === null || gridPlusContext === void 0 ? void 0 : gridPlusContext.querySchemeManager;
22
- var currentQueryOrder = (gridPlusContext === null || gridPlusContext === void 0 ? void 0 : gridPlusContext.currentQueryOrder) || [];
23
- var updateQueryOrder = gridPlusContext === null || gridPlusContext === void 0 ? void 0 : gridPlusContext.updateQueryOrder;
24
- var queryFormItems = (gridPlusContext === null || gridPlusContext === void 0 ? void 0 : gridPlusContext.queryFormItems) || [];
19
+ onSaveColumnState = props.onSaveColumnState,
20
+ _props$showQuerySchem = props.showQueryScheme,
21
+ showQueryScheme = _props$showQuerySchem === void 0 ? true : _props$showQuerySchem;
25
22
  var _useState = useState(false),
26
23
  _useState2 = _slicedToArray(_useState, 2),
27
24
  columnSettingVisible = _useState2[0],
28
25
  setColumnSettingVisible = _useState2[1];
29
26
  var _useState3 = useState(false),
30
27
  _useState4 = _slicedToArray(_useState3, 2),
31
- querySchemesManagerVisible = _useState4[0],
32
- setQuerySchemesManagerVisible = _useState4[1];
28
+ querySchemeVisible = _useState4[0],
29
+ setQuerySchemeVisible = _useState4[1];
33
30
  if (!gridKey) {
34
31
  return null;
35
32
  }
36
33
 
37
- // 构建菜单项
34
+ // 下拉菜单配置
38
35
  var menuItems = [{
39
- key: 'column-setting',
40
- label: /*#__PURE__*/React.createElement("a", {
41
- onClick: function onClick() {
42
- return setColumnSettingVisible(true);
43
- }
44
- }, "\u5217\u65B9\u6848\u7BA1\u7406")
45
- }];
46
-
47
- // 如果存在 querySchemeManager,添加查询方案相关菜单项
48
- if (querySchemeManager) {
49
- menuItems.push({
50
- type: 'divider'
51
- }, {
52
- key: 'query-scheme-manager',
53
- label: /*#__PURE__*/React.createElement("a", {
54
- onClick: function onClick() {
55
- return setQuerySchemesManagerVisible(true);
56
- }
57
- }, "\u67E5\u8BE2\u65B9\u6848\u7BA1\u7406")
58
- });
59
- }
36
+ key: 'columnScheme',
37
+ label: '列方案管理',
38
+ onClick: function onClick() {
39
+ return setColumnSettingVisible(true);
40
+ }
41
+ }].concat(_toConsumableArray(showQueryScheme ? [{
42
+ key: 'queryScheme',
43
+ label: '查询方案管理',
44
+ onClick: function onClick() {
45
+ return setQuerySchemeVisible(true);
46
+ }
47
+ }] : []));
60
48
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Dropdown, {
61
49
  menu: {
62
50
  items: menuItems
@@ -69,6 +57,9 @@ var Setting = function Setting(props) {
69
57
  color: "#000",
70
58
  fontSize: 16,
71
59
  cursor: "pointer"
60
+ },
61
+ onClick: function onClick(e) {
62
+ return e.preventDefault();
72
63
  }
73
64
  }, /*#__PURE__*/React.createElement(SettingOutlined, null))), gridApi && /*#__PURE__*/React.createElement(ColumnSetting, {
74
65
  gridKey: gridKey,
@@ -77,19 +68,13 @@ var Setting = function Setting(props) {
77
68
  onClose: function onClose() {
78
69
  return setColumnSettingVisible(false);
79
70
  },
80
- onSaveColumnState: onSaveColumnState || function () {} // 保留兼容性,但 formArrayTable 不再使用
81
- ,
82
- schemeManager: schemeManager,
83
- type: props.type
84
- }), querySchemeManager && gridApi && updateQueryOrder && /*#__PURE__*/React.createElement(QuerySchemesManager, {
85
- schemeManager: querySchemeManager,
86
- formItems: queryFormItems,
87
- currentOrder: currentQueryOrder,
88
- visible: querySchemesManagerVisible,
71
+ onSaveColumnState: onSaveColumnState || function () {}
72
+ }), gridKey && showQueryScheme && /*#__PURE__*/React.createElement(QuerySchemeManager, {
73
+ gridKey: gridKey,
74
+ visible: querySchemeVisible,
89
75
  onClose: function onClose() {
90
- return setQuerySchemesManagerVisible(false);
91
- },
92
- onOrderChange: updateQueryOrder
76
+ return setQuerySchemeVisible(false);
77
+ }
93
78
  }));
94
79
  };
95
80
  export default Setting;
@@ -0,0 +1,58 @@
1
+ import type { SchemeStorageAdapter, SchemeSyncDataDto, SchemeStorageConfig, ColumnScheme, QueryScheme } from './schemeStorageAdapter';
2
+ /**
3
+ * 后端 API 适配器配置
4
+ */
5
+ export interface BackendApiAdapterConfig extends SchemeStorageConfig {
6
+ /** API 基础路径 */
7
+ apiBaseUrl: string;
8
+ /** 认证令牌获取函数 */
9
+ getToken?: () => string | null;
10
+ /** 用户标识获取函数 */
11
+ getUserId?: () => string | null;
12
+ /** 请求超时时间(毫秒),默认 10000 */
13
+ timeout?: number;
14
+ /** 最大重试次数,默认 3 */
15
+ maxRetries?: number;
16
+ /** 重试延迟(毫秒),默认 1000 */
17
+ retryDelay?: number;
18
+ }
19
+ /**
20
+ * 后端 API 方案存储适配器
21
+ *
22
+ * 特点:
23
+ * - 调用后端细粒度 REST API
24
+ * - 每个操作立即发送请求
25
+ * - 支持错误重试
26
+ * - 自动处理认证
27
+ *
28
+ * 数据格式:
29
+ * - 使用扩展的列配置格式 (columnConfig: FlatColumnItem[])
30
+ * - 包含列分组层级结构
31
+ * - 后端需要存储和返回完整的 columnConfig 数据
32
+ */
33
+ export declare class BackendApiSchemeAdapter implements SchemeStorageAdapter {
34
+ private config;
35
+ constructor(config: BackendApiAdapterConfig);
36
+ /**
37
+ * 日志输出
38
+ */
39
+ private log;
40
+ /**
41
+ * 生成请求头
42
+ */
43
+ private getHeaders;
44
+ /**
45
+ * 延迟函数
46
+ */
47
+ private delay;
48
+ /**
49
+ * 发送 HTTP 请求(带重试机制)
50
+ */
51
+ private request;
52
+ loadAllSchemes(): Promise<SchemeSyncDataDto>;
53
+ saveColumnScheme(gridId: string, scheme: ColumnScheme): Promise<ColumnScheme>;
54
+ deleteColumnScheme(gridId: string, schemeId: string): Promise<void>;
55
+ saveQueryScheme(gridId: string, scheme: QueryScheme): Promise<QueryScheme>;
56
+ deleteQueryScheme(gridId: string, schemeId: string): Promise<void>;
57
+ setCurrentScheme(gridId: string, columnSchemeId: string | null, querySchemeId: string | null): Promise<void>;
58
+ }
@@ -0,0 +1,444 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
3
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
5
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
6
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
7
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
8
+ 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); } }
9
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
10
+ 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; }
11
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
12
+ 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); }
13
+ import { message } from 'antd';
14
+
15
+ /**
16
+ * 后端 API 适配器配置
17
+ */
18
+
19
+ /**
20
+ * 内部配置类型(所有字段必填)
21
+ */
22
+
23
+ /**
24
+ * 后端 API 响应格式
25
+ */
26
+
27
+ /**
28
+ * 后端 API 方案存储适配器
29
+ *
30
+ * 特点:
31
+ * - 调用后端细粒度 REST API
32
+ * - 每个操作立即发送请求
33
+ * - 支持错误重试
34
+ * - 自动处理认证
35
+ *
36
+ * 数据格式:
37
+ * - 使用扩展的列配置格式 (columnConfig: FlatColumnItem[])
38
+ * - 包含列分组层级结构
39
+ * - 后端需要存储和返回完整的 columnConfig 数据
40
+ */
41
+ export var BackendApiSchemeAdapter = /*#__PURE__*/function () {
42
+ function BackendApiSchemeAdapter(config) {
43
+ var _config$maxRetries;
44
+ _classCallCheck(this, BackendApiSchemeAdapter);
45
+ _defineProperty(this, "config", void 0);
46
+ this.config = {
47
+ apiBaseUrl: config.apiBaseUrl,
48
+ getToken: config.getToken || function () {
49
+ return null;
50
+ },
51
+ getUserId: config.getUserId || function () {
52
+ return null;
53
+ },
54
+ timeout: config.timeout || 10000,
55
+ maxRetries: (_config$maxRetries = config.maxRetries) !== null && _config$maxRetries !== void 0 ? _config$maxRetries : 3,
56
+ retryDelay: config.retryDelay || 1000,
57
+ enableDebugLog: config.enableDebugLog || false
58
+ };
59
+ }
60
+
61
+ /**
62
+ * 日志输出
63
+ */
64
+ _createClass(BackendApiSchemeAdapter, [{
65
+ key: "log",
66
+ value: function log(message) {
67
+ if (this.config.enableDebugLog) {
68
+ var _console;
69
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
70
+ args[_key - 1] = arguments[_key];
71
+ }
72
+ (_console = console).log.apply(_console, ["[BackendApiAdapter] ".concat(message)].concat(args));
73
+ }
74
+ }
75
+
76
+ /**
77
+ * 生成请求头
78
+ */
79
+ }, {
80
+ key: "getHeaders",
81
+ value: function getHeaders() {
82
+ var headers = {
83
+ 'Content-Type': 'application/json'
84
+ };
85
+ var token = this.config.getToken();
86
+ if (token) {
87
+ headers['Authorization'] = "Bearer ".concat(token);
88
+ }
89
+ return headers;
90
+ }
91
+
92
+ /**
93
+ * 延迟函数
94
+ */
95
+ }, {
96
+ key: "delay",
97
+ value: function delay(ms) {
98
+ return new Promise(function (resolve) {
99
+ return setTimeout(resolve, ms);
100
+ });
101
+ }
102
+
103
+ /**
104
+ * 发送 HTTP 请求(带重试机制)
105
+ */
106
+ }, {
107
+ key: "request",
108
+ value: (function () {
109
+ var _request = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(url) {
110
+ var options,
111
+ retries,
112
+ controller,
113
+ timeoutId,
114
+ response,
115
+ errorText,
116
+ _args = arguments;
117
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
118
+ while (1) switch (_context.prev = _context.next) {
119
+ case 0:
120
+ options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
121
+ retries = _args.length > 2 && _args[2] !== undefined ? _args[2] : this.config.maxRetries;
122
+ _context.prev = 2;
123
+ controller = new AbortController();
124
+ timeoutId = setTimeout(function () {
125
+ return controller.abort();
126
+ }, this.config.timeout);
127
+ _context.next = 7;
128
+ return fetch(url, _objectSpread(_objectSpread({}, options), {}, {
129
+ headers: this.getHeaders(),
130
+ signal: controller.signal
131
+ }));
132
+ case 7:
133
+ response = _context.sent;
134
+ clearTimeout(timeoutId);
135
+ if (response.ok) {
136
+ _context.next = 14;
137
+ break;
138
+ }
139
+ _context.next = 12;
140
+ return response.text();
141
+ case 12:
142
+ errorText = _context.sent;
143
+ throw new Error("\u8BF7\u6C42\u5931\u8D25 (".concat(response.status, "): ").concat(errorText));
144
+ case 14:
145
+ _context.next = 16;
146
+ return response.json();
147
+ case 16:
148
+ return _context.abrupt("return", _context.sent);
149
+ case 19:
150
+ _context.prev = 19;
151
+ _context.t0 = _context["catch"](2);
152
+ if (!(retries > 0)) {
153
+ _context.next = 26;
154
+ break;
155
+ }
156
+ this.log("\u8BF7\u6C42\u5931\u8D25,\u91CD\u8BD5\u4E2D... (\u5269\u4F59 ".concat(retries, " \u6B21)"), _context.t0);
157
+ _context.next = 25;
158
+ return this.delay(this.config.retryDelay);
159
+ case 25:
160
+ return _context.abrupt("return", this.request(url, options, retries - 1));
161
+ case 26:
162
+ throw _context.t0;
163
+ case 27:
164
+ case "end":
165
+ return _context.stop();
166
+ }
167
+ }, _callee, this, [[2, 19]]);
168
+ }));
169
+ function request(_x) {
170
+ return _request.apply(this, arguments);
171
+ }
172
+ return request;
173
+ }() // ========== 初始化加载 ==========
174
+ )
175
+ }, {
176
+ key: "loadAllSchemes",
177
+ value: function () {
178
+ var _loadAllSchemes = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
179
+ var url, response;
180
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
181
+ while (1) switch (_context2.prev = _context2.next) {
182
+ case 0:
183
+ _context2.prev = 0;
184
+ this.log('加载所有方案数据');
185
+ url = "".concat(this.config.apiBaseUrl, "/api/extra-object/table-scheme/user-schemes");
186
+ _context2.next = 5;
187
+ return this.request(url);
188
+ case 5:
189
+ response = _context2.sent;
190
+ this.log('加载完成', {
191
+ columnSchemes: Object.keys(response.columnSchemes || {}).length,
192
+ querySchemes: Object.keys(response.querySchemes || {}).length,
193
+ version: response.version
194
+ });
195
+ return _context2.abrupt("return", response);
196
+ case 10:
197
+ _context2.prev = 10;
198
+ _context2.t0 = _context2["catch"](0);
199
+ console.error('[BackendApiAdapter] 加载方案失败:', _context2.t0);
200
+ message.error('加载方案失败');
201
+ throw _context2.t0;
202
+ case 15:
203
+ case "end":
204
+ return _context2.stop();
205
+ }
206
+ }, _callee2, this, [[0, 10]]);
207
+ }));
208
+ function loadAllSchemes() {
209
+ return _loadAllSchemes.apply(this, arguments);
210
+ }
211
+ return loadAllSchemes;
212
+ }() // ========== 列方案操作 ==========
213
+ }, {
214
+ key: "saveColumnScheme",
215
+ value: function () {
216
+ var _saveColumnScheme = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(gridId, scheme) {
217
+ var _response$data, url, response;
218
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
219
+ while (1) switch (_context3.prev = _context3.next) {
220
+ case 0:
221
+ _context3.prev = 0;
222
+ this.log("\u4FDD\u5B58\u5217\u65B9\u6848: ".concat(gridId, " - ").concat(scheme.name));
223
+ url = "".concat(this.config.apiBaseUrl, "/api/extra-object/table-scheme/column-scheme");
224
+ _context3.next = 5;
225
+ return this.request(url, {
226
+ method: 'POST',
227
+ body: JSON.stringify({
228
+ gridId: gridId,
229
+ scheme: scheme
230
+ })
231
+ });
232
+ case 5:
233
+ response = _context3.sent;
234
+ if (response.success) {
235
+ _context3.next = 8;
236
+ break;
237
+ }
238
+ throw new Error(response.message || '保存失败');
239
+ case 8:
240
+ this.log('保存成功', (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.scheme.id);
241
+ return _context3.abrupt("return", response.data.scheme);
242
+ case 12:
243
+ _context3.prev = 12;
244
+ _context3.t0 = _context3["catch"](0);
245
+ console.error('[BackendApiAdapter] 保存列方案失败:', _context3.t0);
246
+ message.error('保存列方案失败');
247
+ throw _context3.t0;
248
+ case 17:
249
+ case "end":
250
+ return _context3.stop();
251
+ }
252
+ }, _callee3, this, [[0, 12]]);
253
+ }));
254
+ function saveColumnScheme(_x2, _x3) {
255
+ return _saveColumnScheme.apply(this, arguments);
256
+ }
257
+ return saveColumnScheme;
258
+ }()
259
+ }, {
260
+ key: "deleteColumnScheme",
261
+ value: function () {
262
+ var _deleteColumnScheme = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(gridId, schemeId) {
263
+ var url, response;
264
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
265
+ while (1) switch (_context4.prev = _context4.next) {
266
+ case 0:
267
+ _context4.prev = 0;
268
+ this.log("\u5220\u9664\u5217\u65B9\u6848: ".concat(gridId, " - ").concat(schemeId));
269
+ url = "".concat(this.config.apiBaseUrl, "/api/extra-object/table-scheme/column-scheme/").concat(schemeId, "?gridId=").concat(gridId);
270
+ _context4.next = 5;
271
+ return this.request(url, {
272
+ method: 'DELETE'
273
+ });
274
+ case 5:
275
+ response = _context4.sent;
276
+ if (response.success) {
277
+ _context4.next = 8;
278
+ break;
279
+ }
280
+ throw new Error(response.message || '删除失败');
281
+ case 8:
282
+ this.log('删除成功');
283
+ _context4.next = 16;
284
+ break;
285
+ case 11:
286
+ _context4.prev = 11;
287
+ _context4.t0 = _context4["catch"](0);
288
+ console.error('[BackendApiAdapter] 删除列方案失败:', _context4.t0);
289
+ message.error('删除列方案失败');
290
+ throw _context4.t0;
291
+ case 16:
292
+ case "end":
293
+ return _context4.stop();
294
+ }
295
+ }, _callee4, this, [[0, 11]]);
296
+ }));
297
+ function deleteColumnScheme(_x4, _x5) {
298
+ return _deleteColumnScheme.apply(this, arguments);
299
+ }
300
+ return deleteColumnScheme;
301
+ }() // ========== 查询方案操作 ==========
302
+ }, {
303
+ key: "saveQueryScheme",
304
+ value: function () {
305
+ var _saveQueryScheme = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(gridId, scheme) {
306
+ var _response$data2, url, response;
307
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
308
+ while (1) switch (_context5.prev = _context5.next) {
309
+ case 0:
310
+ _context5.prev = 0;
311
+ this.log("\u4FDD\u5B58\u67E5\u8BE2\u65B9\u6848: ".concat(gridId, " - ").concat(scheme.name));
312
+ url = "".concat(this.config.apiBaseUrl, "/api/extra-object/table-scheme/query-scheme");
313
+ _context5.next = 5;
314
+ return this.request(url, {
315
+ method: 'POST',
316
+ body: JSON.stringify({
317
+ gridId: gridId,
318
+ scheme: scheme
319
+ })
320
+ });
321
+ case 5:
322
+ response = _context5.sent;
323
+ if (response.success) {
324
+ _context5.next = 8;
325
+ break;
326
+ }
327
+ throw new Error(response.message || '保存失败');
328
+ case 8:
329
+ this.log('保存成功', (_response$data2 = response.data) === null || _response$data2 === void 0 ? void 0 : _response$data2.scheme.id);
330
+ return _context5.abrupt("return", response.data.scheme);
331
+ case 12:
332
+ _context5.prev = 12;
333
+ _context5.t0 = _context5["catch"](0);
334
+ console.error('[BackendApiAdapter] 保存查询方案失败:', _context5.t0);
335
+ message.error('保存查询方案失败');
336
+ throw _context5.t0;
337
+ case 17:
338
+ case "end":
339
+ return _context5.stop();
340
+ }
341
+ }, _callee5, this, [[0, 12]]);
342
+ }));
343
+ function saveQueryScheme(_x6, _x7) {
344
+ return _saveQueryScheme.apply(this, arguments);
345
+ }
346
+ return saveQueryScheme;
347
+ }()
348
+ }, {
349
+ key: "deleteQueryScheme",
350
+ value: function () {
351
+ var _deleteQueryScheme = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(gridId, schemeId) {
352
+ var url, response;
353
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
354
+ while (1) switch (_context6.prev = _context6.next) {
355
+ case 0:
356
+ _context6.prev = 0;
357
+ this.log("\u5220\u9664\u67E5\u8BE2\u65B9\u6848: ".concat(gridId, " - ").concat(schemeId));
358
+ url = "".concat(this.config.apiBaseUrl, "/api/extra-object/table-scheme/query-scheme/").concat(schemeId, "?gridId=").concat(gridId);
359
+ _context6.next = 5;
360
+ return this.request(url, {
361
+ method: 'DELETE'
362
+ });
363
+ case 5:
364
+ response = _context6.sent;
365
+ if (response.success) {
366
+ _context6.next = 8;
367
+ break;
368
+ }
369
+ throw new Error(response.message || '删除失败');
370
+ case 8:
371
+ this.log('删除成功');
372
+ _context6.next = 16;
373
+ break;
374
+ case 11:
375
+ _context6.prev = 11;
376
+ _context6.t0 = _context6["catch"](0);
377
+ console.error('[BackendApiAdapter] 删除查询方案失败:', _context6.t0);
378
+ message.error('删除查询方案失败');
379
+ throw _context6.t0;
380
+ case 16:
381
+ case "end":
382
+ return _context6.stop();
383
+ }
384
+ }, _callee6, this, [[0, 11]]);
385
+ }));
386
+ function deleteQueryScheme(_x8, _x9) {
387
+ return _deleteQueryScheme.apply(this, arguments);
388
+ }
389
+ return deleteQueryScheme;
390
+ }() // ========== 当前方案操作 ==========
391
+ }, {
392
+ key: "setCurrentScheme",
393
+ value: function () {
394
+ var _setCurrentScheme = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(gridId, columnSchemeId, querySchemeId) {
395
+ var url, response;
396
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
397
+ while (1) switch (_context7.prev = _context7.next) {
398
+ case 0:
399
+ _context7.prev = 0;
400
+ this.log("\u8BBE\u7F6E\u5F53\u524D\u65B9\u6848: ".concat(gridId), {
401
+ columnSchemeId: columnSchemeId,
402
+ querySchemeId: querySchemeId
403
+ });
404
+ url = "".concat(this.config.apiBaseUrl, "/api/extra-object/table-scheme/current-scheme");
405
+ _context7.next = 5;
406
+ return this.request(url, {
407
+ method: 'PUT',
408
+ body: JSON.stringify({
409
+ gridId: gridId,
410
+ columnSchemeId: columnSchemeId,
411
+ querySchemeId: querySchemeId
412
+ })
413
+ });
414
+ case 5:
415
+ response = _context7.sent;
416
+ if (response.success) {
417
+ _context7.next = 8;
418
+ break;
419
+ }
420
+ throw new Error(response.message || '设置失败');
421
+ case 8:
422
+ this.log('设置成功');
423
+ _context7.next = 16;
424
+ break;
425
+ case 11:
426
+ _context7.prev = 11;
427
+ _context7.t0 = _context7["catch"](0);
428
+ console.error('[BackendApiAdapter] 设置当前方案失败:', _context7.t0);
429
+ message.error('设置当前方案失败');
430
+ throw _context7.t0;
431
+ case 16:
432
+ case "end":
433
+ return _context7.stop();
434
+ }
435
+ }, _callee7, this, [[0, 11]]);
436
+ }));
437
+ function setCurrentScheme(_x10, _x11, _x12) {
438
+ return _setCurrentScheme.apply(this, arguments);
439
+ }
440
+ return setCurrentScheme;
441
+ }()
442
+ }]);
443
+ return BackendApiSchemeAdapter;
444
+ }();