@nokecy/qc-ui 1.0.94 → 1.0.96
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/ag-grid-plus/ag-gridPlus.js +252 -173
- package/dist/cjs/ag-grid-plus/context/gridContext.d.ts +108 -20
- package/dist/cjs/ag-grid-plus/context/gridContext.js +12 -4
- package/dist/cjs/ag-grid-plus/context/useSchemeDataFlow.d.ts +88 -0
- package/dist/cjs/ag-grid-plus/context/useSchemeDataFlow.js +173 -0
- package/dist/cjs/ag-grid-plus/context/useSchemeManager.d.ts +111 -0
- package/dist/cjs/ag-grid-plus/context/useSchemeManager.js +596 -0
- package/dist/cjs/ag-grid-plus/hooks/useAgGridCalculation.d.ts +1 -1
- package/dist/cjs/ag-grid-plus/hooks/useAgGridData.d.ts +2 -2
- package/dist/cjs/ag-grid-plus/index.d.ts +7 -2
- package/dist/cjs/ag-grid-plus/index.js +11 -93
- package/dist/cjs/ag-grid-plus/interface.d.ts +0 -31
- package/dist/cjs/ag-grid-plus/interface.js +3 -0
- package/dist/cjs/ag-grid-plus/setting/ColumnSetting.d.ts +0 -3
- package/dist/cjs/ag-grid-plus/setting/ColumnSetting.js +279 -145
- package/dist/cjs/ag-grid-plus/setting/QuerySchemeManager.d.ts +11 -0
- package/dist/cjs/ag-grid-plus/{querySchemes/components/QuerySchemesManager.js → setting/QuerySchemeManager.js} +193 -108
- package/dist/cjs/ag-grid-plus/setting/index.d.ts +2 -2
- package/dist/cjs/ag-grid-plus/setting/index.js +33 -48
- package/dist/cjs/ag-grid-plus/shared/storage/backendApiAdapter.d.ts +58 -0
- package/dist/cjs/ag-grid-plus/shared/storage/backendApiAdapter.js +446 -0
- package/dist/cjs/ag-grid-plus/shared/storage/localStorageAdapter.d.ts +57 -0
- package/dist/cjs/ag-grid-plus/{schemes → shared}/storage/localStorageAdapter.js +253 -271
- package/dist/cjs/ag-grid-plus/shared/storage/schemeStorageAdapter.d.ts +132 -0
- package/dist/cjs/array-table/index.js +167 -45
- package/dist/cjs/index.d.ts +3 -3
- package/dist/cjs/index.js +14 -86
- package/dist/esm/ag-grid-plus/ag-gridPlus.js +252 -173
- package/dist/esm/ag-grid-plus/context/gridContext.d.ts +108 -20
- package/dist/esm/ag-grid-plus/context/gridContext.js +13 -4
- package/dist/esm/ag-grid-plus/context/useSchemeDataFlow.d.ts +88 -0
- package/dist/esm/ag-grid-plus/context/useSchemeDataFlow.js +165 -0
- package/dist/esm/ag-grid-plus/context/useSchemeManager.d.ts +111 -0
- package/dist/esm/ag-grid-plus/context/useSchemeManager.js +590 -0
- package/dist/esm/ag-grid-plus/hooks/useAgGridCalculation.d.ts +1 -1
- package/dist/esm/ag-grid-plus/hooks/useAgGridData.d.ts +2 -2
- package/dist/esm/ag-grid-plus/index.d.ts +7 -2
- package/dist/esm/ag-grid-plus/index.js +9 -5
- package/dist/esm/ag-grid-plus/interface.d.ts +0 -31
- package/dist/esm/ag-grid-plus/interface.js +2 -0
- package/dist/esm/ag-grid-plus/setting/ColumnSetting.d.ts +0 -3
- package/dist/esm/ag-grid-plus/setting/ColumnSetting.js +281 -147
- package/dist/esm/ag-grid-plus/setting/QuerySchemeManager.d.ts +11 -0
- package/dist/esm/ag-grid-plus/{querySchemes/components/QuerySchemesManager.js → setting/QuerySchemeManager.js} +192 -107
- package/dist/esm/ag-grid-plus/setting/index.d.ts +2 -2
- package/dist/esm/ag-grid-plus/setting/index.js +33 -48
- package/dist/esm/ag-grid-plus/shared/storage/backendApiAdapter.d.ts +58 -0
- package/dist/esm/ag-grid-plus/shared/storage/backendApiAdapter.js +444 -0
- package/dist/esm/ag-grid-plus/shared/storage/localStorageAdapter.d.ts +57 -0
- package/dist/esm/ag-grid-plus/{schemes → shared}/storage/localStorageAdapter.js +252 -271
- package/dist/esm/ag-grid-plus/shared/storage/schemeStorageAdapter.d.ts +132 -0
- package/dist/esm/array-table/index.js +168 -46
- package/dist/esm/index.d.ts +3 -3
- package/dist/esm/index.js +11 -11
- package/dist/esm/standardFormDialog/useStandardFormSchema.d.ts +1 -1
- package/dist/umd/qc-ui.min.css +1 -1
- package/dist/umd/qc-ui.min.js +1 -1
- package/package.json +1 -1
- package/dist/cjs/ag-grid-plus/querySchemes/components/QuerySchemesManager.d.ts +0 -21
- package/dist/cjs/ag-grid-plus/querySchemes/components/QuerySchemesManager.less +0 -86
- package/dist/cjs/ag-grid-plus/querySchemes/components/index.d.ts +0 -5
- package/dist/cjs/ag-grid-plus/querySchemes/components/index.js +0 -12
- package/dist/cjs/ag-grid-plus/querySchemes/constants.d.ts +0 -17
- package/dist/cjs/ag-grid-plus/querySchemes/constants.js +0 -30
- package/dist/cjs/ag-grid-plus/querySchemes/hooks/useQueryOrderManager.d.ts +0 -10
- package/dist/cjs/ag-grid-plus/querySchemes/hooks/useQueryOrderManager.js +0 -65
- package/dist/cjs/ag-grid-plus/querySchemes/hooks/useQuerySchemes.d.ts +0 -6
- package/dist/cjs/ag-grid-plus/querySchemes/hooks/useQuerySchemes.js +0 -564
- package/dist/cjs/ag-grid-plus/querySchemes/index.d.ts +0 -11
- package/dist/cjs/ag-grid-plus/querySchemes/index.js +0 -113
- package/dist/cjs/ag-grid-plus/querySchemes/storage/localStorageAdapter.d.ts +0 -44
- package/dist/cjs/ag-grid-plus/querySchemes/storage/localStorageAdapter.js +0 -261
- package/dist/cjs/ag-grid-plus/querySchemes/types.d.ts +0 -145
- package/dist/cjs/ag-grid-plus/querySchemes/utils/validator.d.ts +0 -36
- package/dist/cjs/ag-grid-plus/querySchemes/utils/validator.js +0 -155
- package/dist/cjs/ag-grid-plus/schemes/components/SchemeManager.d.ts +0 -16
- package/dist/cjs/ag-grid-plus/schemes/components/SchemeManager.js +0 -342
- package/dist/cjs/ag-grid-plus/schemes/components/SchemeManager.less +0 -35
- package/dist/cjs/ag-grid-plus/schemes/components/SchemeSelector.d.ts +0 -20
- package/dist/cjs/ag-grid-plus/schemes/components/SchemeSelector.js +0 -289
- package/dist/cjs/ag-grid-plus/schemes/components/SchemeSelector.less +0 -39
- package/dist/cjs/ag-grid-plus/schemes/components/index.d.ts +0 -4
- package/dist/cjs/ag-grid-plus/schemes/components/index.js +0 -19
- package/dist/cjs/ag-grid-plus/schemes/constants.d.ts +0 -23
- package/dist/cjs/ag-grid-plus/schemes/constants.js +0 -39
- package/dist/cjs/ag-grid-plus/schemes/hooks/useColumnSchemes.d.ts +0 -6
- package/dist/cjs/ag-grid-plus/schemes/hooks/useColumnSchemes.js +0 -617
- package/dist/cjs/ag-grid-plus/schemes/index.d.ts +0 -23
- package/dist/cjs/ag-grid-plus/schemes/index.js +0 -164
- package/dist/cjs/ag-grid-plus/schemes/storage/configMerger.d.ts +0 -10
- package/dist/cjs/ag-grid-plus/schemes/storage/configMerger.js +0 -34
- package/dist/cjs/ag-grid-plus/schemes/storage/localStorageAdapter.d.ts +0 -79
- package/dist/cjs/ag-grid-plus/schemes/storage/priorityStorageAdapter.d.ts +0 -122
- package/dist/cjs/ag-grid-plus/schemes/storage/priorityStorageAdapter.js +0 -476
- package/dist/cjs/ag-grid-plus/schemes/storage/remoteStorageAdapter.d.ts +0 -139
- package/dist/cjs/ag-grid-plus/schemes/storage/remoteStorageAdapter.js +0 -746
- package/dist/cjs/ag-grid-plus/schemes/storage/useRemoteStorage.d.ts +0 -29
- package/dist/cjs/ag-grid-plus/schemes/storage/useRemoteStorage.js +0 -45
- package/dist/cjs/ag-grid-plus/schemes/types.d.ts +0 -131
- package/dist/cjs/ag-grid-plus/schemes/types.js +0 -5
- package/dist/cjs/ag-grid-plus/schemes/utils/validator.d.ts +0 -27
- package/dist/cjs/ag-grid-plus/schemes/utils/validator.js +0 -109
- package/dist/cjs/ag-grid-plus/storage/index.d.ts +0 -13
- package/dist/cjs/ag-grid-plus/storage/index.js +0 -5
- package/dist/esm/ag-grid-plus/querySchemes/components/QuerySchemesManager.d.ts +0 -21
- package/dist/esm/ag-grid-plus/querySchemes/components/QuerySchemesManager.less +0 -86
- package/dist/esm/ag-grid-plus/querySchemes/components/index.d.ts +0 -5
- package/dist/esm/ag-grid-plus/querySchemes/components/index.js +0 -5
- package/dist/esm/ag-grid-plus/querySchemes/constants.d.ts +0 -17
- package/dist/esm/ag-grid-plus/querySchemes/constants.js +0 -24
- package/dist/esm/ag-grid-plus/querySchemes/hooks/useQueryOrderManager.d.ts +0 -10
- package/dist/esm/ag-grid-plus/querySchemes/hooks/useQueryOrderManager.js +0 -60
- package/dist/esm/ag-grid-plus/querySchemes/hooks/useQuerySchemes.d.ts +0 -6
- package/dist/esm/ag-grid-plus/querySchemes/hooks/useQuerySchemes.js +0 -559
- package/dist/esm/ag-grid-plus/querySchemes/index.d.ts +0 -11
- package/dist/esm/ag-grid-plus/querySchemes/index.js +0 -20
- package/dist/esm/ag-grid-plus/querySchemes/storage/localStorageAdapter.d.ts +0 -44
- package/dist/esm/ag-grid-plus/querySchemes/storage/localStorageAdapter.js +0 -256
- package/dist/esm/ag-grid-plus/querySchemes/types.d.ts +0 -145
- package/dist/esm/ag-grid-plus/querySchemes/utils/validator.d.ts +0 -36
- package/dist/esm/ag-grid-plus/querySchemes/utils/validator.js +0 -144
- package/dist/esm/ag-grid-plus/schemes/components/SchemeManager.d.ts +0 -16
- package/dist/esm/ag-grid-plus/schemes/components/SchemeManager.js +0 -334
- package/dist/esm/ag-grid-plus/schemes/components/SchemeManager.less +0 -35
- package/dist/esm/ag-grid-plus/schemes/components/SchemeSelector.d.ts +0 -20
- package/dist/esm/ag-grid-plus/schemes/components/SchemeSelector.js +0 -281
- package/dist/esm/ag-grid-plus/schemes/components/SchemeSelector.less +0 -39
- package/dist/esm/ag-grid-plus/schemes/components/index.d.ts +0 -4
- package/dist/esm/ag-grid-plus/schemes/components/index.js +0 -2
- package/dist/esm/ag-grid-plus/schemes/constants.d.ts +0 -23
- package/dist/esm/ag-grid-plus/schemes/constants.js +0 -33
- package/dist/esm/ag-grid-plus/schemes/hooks/useColumnSchemes.d.ts +0 -6
- package/dist/esm/ag-grid-plus/schemes/hooks/useColumnSchemes.js +0 -612
- package/dist/esm/ag-grid-plus/schemes/index.d.ts +0 -23
- package/dist/esm/ag-grid-plus/schemes/index.js +0 -30
- package/dist/esm/ag-grid-plus/schemes/storage/configMerger.d.ts +0 -10
- package/dist/esm/ag-grid-plus/schemes/storage/configMerger.js +0 -28
- package/dist/esm/ag-grid-plus/schemes/storage/localStorageAdapter.d.ts +0 -79
- package/dist/esm/ag-grid-plus/schemes/storage/priorityStorageAdapter.d.ts +0 -122
- package/dist/esm/ag-grid-plus/schemes/storage/priorityStorageAdapter.js +0 -471
- package/dist/esm/ag-grid-plus/schemes/storage/remoteStorageAdapter.d.ts +0 -139
- package/dist/esm/ag-grid-plus/schemes/storage/remoteStorageAdapter.js +0 -746
- package/dist/esm/ag-grid-plus/schemes/storage/useRemoteStorage.d.ts +0 -29
- package/dist/esm/ag-grid-plus/schemes/storage/useRemoteStorage.js +0 -40
- package/dist/esm/ag-grid-plus/schemes/types.d.ts +0 -131
- package/dist/esm/ag-grid-plus/schemes/types.js +0 -1
- package/dist/esm/ag-grid-plus/schemes/utils/validator.d.ts +0 -27
- package/dist/esm/ag-grid-plus/schemes/utils/validator.js +0 -100
- package/dist/esm/ag-grid-plus/storage/index.d.ts +0 -13
- package/dist/esm/ag-grid-plus/storage/index.js +0 -17
- /package/dist/cjs/ag-grid-plus/{querySchemes/types.js → shared/storage/schemeStorageAdapter.js} +0 -0
- /package/dist/esm/ag-grid-plus/{querySchemes/types.js → shared/storage/schemeStorageAdapter.js} +0 -0
|
@@ -6,14 +6,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _icons = require("@ant-design/icons");
|
|
9
|
-
var _antd = require("antd");
|
|
10
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
-
var
|
|
12
|
-
var _QuerySchemesManager = require("../querySchemes/components/QuerySchemesManager");
|
|
10
|
+
var _antd = require("antd");
|
|
13
11
|
var _ColumnSetting = _interopRequireDefault(require("./ColumnSetting"));
|
|
12
|
+
var _QuerySchemeManager = _interopRequireDefault(require("./QuerySchemeManager"));
|
|
14
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
14
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
16
15
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
16
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
17
|
+
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."); }
|
|
18
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
19
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
17
20
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
18
21
|
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."); }
|
|
19
22
|
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); }
|
|
@@ -23,50 +26,35 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
23
26
|
var Setting = function Setting(props) {
|
|
24
27
|
var gridKey = props.gridKey,
|
|
25
28
|
gridApi = props.gridApi,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
// 优先使用外部传入的 schemeManager,否则使用 Context 中的
|
|
30
|
-
var schemeManager = props.schemeManager || (gridPlusContext === null || gridPlusContext === void 0 ? void 0 : gridPlusContext.schemeManager);
|
|
31
|
-
var querySchemeManager = gridPlusContext === null || gridPlusContext === void 0 ? void 0 : gridPlusContext.querySchemeManager;
|
|
32
|
-
var currentQueryOrder = (gridPlusContext === null || gridPlusContext === void 0 ? void 0 : gridPlusContext.currentQueryOrder) || [];
|
|
33
|
-
var updateQueryOrder = gridPlusContext === null || gridPlusContext === void 0 ? void 0 : gridPlusContext.updateQueryOrder;
|
|
34
|
-
var queryFormItems = (gridPlusContext === null || gridPlusContext === void 0 ? void 0 : gridPlusContext.queryFormItems) || [];
|
|
29
|
+
onSaveColumnState = props.onSaveColumnState,
|
|
30
|
+
_props$showQuerySchem = props.showQueryScheme,
|
|
31
|
+
showQueryScheme = _props$showQuerySchem === void 0 ? true : _props$showQuerySchem;
|
|
35
32
|
var _useState = (0, _react.useState)(false),
|
|
36
33
|
_useState2 = _slicedToArray(_useState, 2),
|
|
37
34
|
columnSettingVisible = _useState2[0],
|
|
38
35
|
setColumnSettingVisible = _useState2[1];
|
|
39
36
|
var _useState3 = (0, _react.useState)(false),
|
|
40
37
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
41
|
-
|
|
42
|
-
|
|
38
|
+
querySchemeVisible = _useState4[0],
|
|
39
|
+
setQuerySchemeVisible = _useState4[1];
|
|
43
40
|
if (!gridKey) {
|
|
44
41
|
return null;
|
|
45
42
|
}
|
|
46
43
|
|
|
47
|
-
//
|
|
44
|
+
// 下拉菜单配置
|
|
48
45
|
var menuItems = [{
|
|
49
|
-
key: '
|
|
50
|
-
label:
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}, {
|
|
62
|
-
key: 'query-scheme-manager',
|
|
63
|
-
label: /*#__PURE__*/_react.default.createElement("a", {
|
|
64
|
-
onClick: function onClick() {
|
|
65
|
-
return setQuerySchemesManagerVisible(true);
|
|
66
|
-
}
|
|
67
|
-
}, "\u67E5\u8BE2\u65B9\u6848\u7BA1\u7406")
|
|
68
|
-
});
|
|
69
|
-
}
|
|
46
|
+
key: 'columnScheme',
|
|
47
|
+
label: '列方案管理',
|
|
48
|
+
onClick: function onClick() {
|
|
49
|
+
return setColumnSettingVisible(true);
|
|
50
|
+
}
|
|
51
|
+
}].concat(_toConsumableArray(showQueryScheme ? [{
|
|
52
|
+
key: 'queryScheme',
|
|
53
|
+
label: '查询方案管理',
|
|
54
|
+
onClick: function onClick() {
|
|
55
|
+
return setQuerySchemeVisible(true);
|
|
56
|
+
}
|
|
57
|
+
}] : []));
|
|
70
58
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_antd.Dropdown, {
|
|
71
59
|
menu: {
|
|
72
60
|
items: menuItems
|
|
@@ -79,6 +67,9 @@ var Setting = function Setting(props) {
|
|
|
79
67
|
color: "#000",
|
|
80
68
|
fontSize: 16,
|
|
81
69
|
cursor: "pointer"
|
|
70
|
+
},
|
|
71
|
+
onClick: function onClick(e) {
|
|
72
|
+
return e.preventDefault();
|
|
82
73
|
}
|
|
83
74
|
}, /*#__PURE__*/_react.default.createElement(_icons.SettingOutlined, null))), gridApi && /*#__PURE__*/_react.default.createElement(_ColumnSetting.default, {
|
|
84
75
|
gridKey: gridKey,
|
|
@@ -87,19 +78,13 @@ var Setting = function Setting(props) {
|
|
|
87
78
|
onClose: function onClose() {
|
|
88
79
|
return setColumnSettingVisible(false);
|
|
89
80
|
},
|
|
90
|
-
onSaveColumnState: onSaveColumnState || function () {}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}), querySchemeManager && gridApi && updateQueryOrder && /*#__PURE__*/_react.default.createElement(_QuerySchemesManager.QuerySchemesManager, {
|
|
95
|
-
schemeManager: querySchemeManager,
|
|
96
|
-
formItems: queryFormItems,
|
|
97
|
-
currentOrder: currentQueryOrder,
|
|
98
|
-
visible: querySchemesManagerVisible,
|
|
81
|
+
onSaveColumnState: onSaveColumnState || function () {}
|
|
82
|
+
}), gridKey && showQueryScheme && /*#__PURE__*/_react.default.createElement(_QuerySchemeManager.default, {
|
|
83
|
+
gridKey: gridKey,
|
|
84
|
+
visible: querySchemeVisible,
|
|
99
85
|
onClose: function onClose() {
|
|
100
|
-
return
|
|
101
|
-
}
|
|
102
|
-
onOrderChange: updateQueryOrder
|
|
86
|
+
return setQuerySchemeVisible(false);
|
|
87
|
+
}
|
|
103
88
|
}));
|
|
104
89
|
};
|
|
105
90
|
var _default = exports.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,446 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.BackendApiSchemeAdapter = void 0;
|
|
7
|
+
var _antd = require("antd");
|
|
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 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; }
|
|
11
|
+
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; }
|
|
12
|
+
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); } }
|
|
13
|
+
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); }); }; }
|
|
14
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
15
|
+
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); } }
|
|
16
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
17
|
+
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; }
|
|
18
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
19
|
+
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); }
|
|
20
|
+
/**
|
|
21
|
+
* 后端 API 适配器配置
|
|
22
|
+
*/
|
|
23
|
+
/**
|
|
24
|
+
* 内部配置类型(所有字段必填)
|
|
25
|
+
*/
|
|
26
|
+
/**
|
|
27
|
+
* 后端 API 响应格式
|
|
28
|
+
*/
|
|
29
|
+
/**
|
|
30
|
+
* 后端 API 方案存储适配器
|
|
31
|
+
*
|
|
32
|
+
* 特点:
|
|
33
|
+
* - 调用后端细粒度 REST API
|
|
34
|
+
* - 每个操作立即发送请求
|
|
35
|
+
* - 支持错误重试
|
|
36
|
+
* - 自动处理认证
|
|
37
|
+
*
|
|
38
|
+
* 数据格式:
|
|
39
|
+
* - 使用扩展的列配置格式 (columnConfig: FlatColumnItem[])
|
|
40
|
+
* - 包含列分组层级结构
|
|
41
|
+
* - 后端需要存储和返回完整的 columnConfig 数据
|
|
42
|
+
*/
|
|
43
|
+
var BackendApiSchemeAdapter = exports.BackendApiSchemeAdapter = /*#__PURE__*/function () {
|
|
44
|
+
function BackendApiSchemeAdapter(config) {
|
|
45
|
+
var _config$maxRetries;
|
|
46
|
+
_classCallCheck(this, BackendApiSchemeAdapter);
|
|
47
|
+
_defineProperty(this, "config", void 0);
|
|
48
|
+
this.config = {
|
|
49
|
+
apiBaseUrl: config.apiBaseUrl,
|
|
50
|
+
getToken: config.getToken || function () {
|
|
51
|
+
return null;
|
|
52
|
+
},
|
|
53
|
+
getUserId: config.getUserId || function () {
|
|
54
|
+
return null;
|
|
55
|
+
},
|
|
56
|
+
timeout: config.timeout || 10000,
|
|
57
|
+
maxRetries: (_config$maxRetries = config.maxRetries) !== null && _config$maxRetries !== void 0 ? _config$maxRetries : 3,
|
|
58
|
+
retryDelay: config.retryDelay || 1000,
|
|
59
|
+
enableDebugLog: config.enableDebugLog || false
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* 日志输出
|
|
65
|
+
*/
|
|
66
|
+
_createClass(BackendApiSchemeAdapter, [{
|
|
67
|
+
key: "log",
|
|
68
|
+
value: function log(message) {
|
|
69
|
+
if (this.config.enableDebugLog) {
|
|
70
|
+
var _console;
|
|
71
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
72
|
+
args[_key - 1] = arguments[_key];
|
|
73
|
+
}
|
|
74
|
+
(_console = console).log.apply(_console, ["[BackendApiAdapter] ".concat(message)].concat(args));
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* 生成请求头
|
|
80
|
+
*/
|
|
81
|
+
}, {
|
|
82
|
+
key: "getHeaders",
|
|
83
|
+
value: function getHeaders() {
|
|
84
|
+
var headers = {
|
|
85
|
+
'Content-Type': 'application/json'
|
|
86
|
+
};
|
|
87
|
+
var token = this.config.getToken();
|
|
88
|
+
if (token) {
|
|
89
|
+
headers['Authorization'] = "Bearer ".concat(token);
|
|
90
|
+
}
|
|
91
|
+
return headers;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* 延迟函数
|
|
96
|
+
*/
|
|
97
|
+
}, {
|
|
98
|
+
key: "delay",
|
|
99
|
+
value: function delay(ms) {
|
|
100
|
+
return new Promise(function (resolve) {
|
|
101
|
+
return setTimeout(resolve, ms);
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* 发送 HTTP 请求(带重试机制)
|
|
107
|
+
*/
|
|
108
|
+
}, {
|
|
109
|
+
key: "request",
|
|
110
|
+
value: (function () {
|
|
111
|
+
var _request = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(url) {
|
|
112
|
+
var options,
|
|
113
|
+
retries,
|
|
114
|
+
controller,
|
|
115
|
+
timeoutId,
|
|
116
|
+
response,
|
|
117
|
+
errorText,
|
|
118
|
+
_args = arguments;
|
|
119
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
120
|
+
while (1) switch (_context.prev = _context.next) {
|
|
121
|
+
case 0:
|
|
122
|
+
options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
|
|
123
|
+
retries = _args.length > 2 && _args[2] !== undefined ? _args[2] : this.config.maxRetries;
|
|
124
|
+
_context.prev = 2;
|
|
125
|
+
controller = new AbortController();
|
|
126
|
+
timeoutId = setTimeout(function () {
|
|
127
|
+
return controller.abort();
|
|
128
|
+
}, this.config.timeout);
|
|
129
|
+
_context.next = 7;
|
|
130
|
+
return fetch(url, _objectSpread(_objectSpread({}, options), {}, {
|
|
131
|
+
headers: this.getHeaders(),
|
|
132
|
+
signal: controller.signal
|
|
133
|
+
}));
|
|
134
|
+
case 7:
|
|
135
|
+
response = _context.sent;
|
|
136
|
+
clearTimeout(timeoutId);
|
|
137
|
+
if (response.ok) {
|
|
138
|
+
_context.next = 14;
|
|
139
|
+
break;
|
|
140
|
+
}
|
|
141
|
+
_context.next = 12;
|
|
142
|
+
return response.text();
|
|
143
|
+
case 12:
|
|
144
|
+
errorText = _context.sent;
|
|
145
|
+
throw new Error("\u8BF7\u6C42\u5931\u8D25 (".concat(response.status, "): ").concat(errorText));
|
|
146
|
+
case 14:
|
|
147
|
+
_context.next = 16;
|
|
148
|
+
return response.json();
|
|
149
|
+
case 16:
|
|
150
|
+
return _context.abrupt("return", _context.sent);
|
|
151
|
+
case 19:
|
|
152
|
+
_context.prev = 19;
|
|
153
|
+
_context.t0 = _context["catch"](2);
|
|
154
|
+
if (!(retries > 0)) {
|
|
155
|
+
_context.next = 26;
|
|
156
|
+
break;
|
|
157
|
+
}
|
|
158
|
+
this.log("\u8BF7\u6C42\u5931\u8D25,\u91CD\u8BD5\u4E2D... (\u5269\u4F59 ".concat(retries, " \u6B21)"), _context.t0);
|
|
159
|
+
_context.next = 25;
|
|
160
|
+
return this.delay(this.config.retryDelay);
|
|
161
|
+
case 25:
|
|
162
|
+
return _context.abrupt("return", this.request(url, options, retries - 1));
|
|
163
|
+
case 26:
|
|
164
|
+
throw _context.t0;
|
|
165
|
+
case 27:
|
|
166
|
+
case "end":
|
|
167
|
+
return _context.stop();
|
|
168
|
+
}
|
|
169
|
+
}, _callee, this, [[2, 19]]);
|
|
170
|
+
}));
|
|
171
|
+
function request(_x) {
|
|
172
|
+
return _request.apply(this, arguments);
|
|
173
|
+
}
|
|
174
|
+
return request;
|
|
175
|
+
}() // ========== 初始化加载 ==========
|
|
176
|
+
)
|
|
177
|
+
}, {
|
|
178
|
+
key: "loadAllSchemes",
|
|
179
|
+
value: function () {
|
|
180
|
+
var _loadAllSchemes = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
181
|
+
var url, response;
|
|
182
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
183
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
184
|
+
case 0:
|
|
185
|
+
_context2.prev = 0;
|
|
186
|
+
this.log('加载所有方案数据');
|
|
187
|
+
url = "".concat(this.config.apiBaseUrl, "/api/extra-object/table-scheme/user-schemes");
|
|
188
|
+
_context2.next = 5;
|
|
189
|
+
return this.request(url);
|
|
190
|
+
case 5:
|
|
191
|
+
response = _context2.sent;
|
|
192
|
+
this.log('加载完成', {
|
|
193
|
+
columnSchemes: Object.keys(response.columnSchemes || {}).length,
|
|
194
|
+
querySchemes: Object.keys(response.querySchemes || {}).length,
|
|
195
|
+
version: response.version
|
|
196
|
+
});
|
|
197
|
+
return _context2.abrupt("return", response);
|
|
198
|
+
case 10:
|
|
199
|
+
_context2.prev = 10;
|
|
200
|
+
_context2.t0 = _context2["catch"](0);
|
|
201
|
+
console.error('[BackendApiAdapter] 加载方案失败:', _context2.t0);
|
|
202
|
+
_antd.message.error('加载方案失败');
|
|
203
|
+
throw _context2.t0;
|
|
204
|
+
case 15:
|
|
205
|
+
case "end":
|
|
206
|
+
return _context2.stop();
|
|
207
|
+
}
|
|
208
|
+
}, _callee2, this, [[0, 10]]);
|
|
209
|
+
}));
|
|
210
|
+
function loadAllSchemes() {
|
|
211
|
+
return _loadAllSchemes.apply(this, arguments);
|
|
212
|
+
}
|
|
213
|
+
return loadAllSchemes;
|
|
214
|
+
}() // ========== 列方案操作 ==========
|
|
215
|
+
}, {
|
|
216
|
+
key: "saveColumnScheme",
|
|
217
|
+
value: function () {
|
|
218
|
+
var _saveColumnScheme = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(gridId, scheme) {
|
|
219
|
+
var _response$data, url, response;
|
|
220
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
221
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
222
|
+
case 0:
|
|
223
|
+
_context3.prev = 0;
|
|
224
|
+
this.log("\u4FDD\u5B58\u5217\u65B9\u6848: ".concat(gridId, " - ").concat(scheme.name));
|
|
225
|
+
url = "".concat(this.config.apiBaseUrl, "/api/extra-object/table-scheme/column-scheme");
|
|
226
|
+
_context3.next = 5;
|
|
227
|
+
return this.request(url, {
|
|
228
|
+
method: 'POST',
|
|
229
|
+
body: JSON.stringify({
|
|
230
|
+
gridId: gridId,
|
|
231
|
+
scheme: scheme
|
|
232
|
+
})
|
|
233
|
+
});
|
|
234
|
+
case 5:
|
|
235
|
+
response = _context3.sent;
|
|
236
|
+
if (response.success) {
|
|
237
|
+
_context3.next = 8;
|
|
238
|
+
break;
|
|
239
|
+
}
|
|
240
|
+
throw new Error(response.message || '保存失败');
|
|
241
|
+
case 8:
|
|
242
|
+
this.log('保存成功', (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.scheme.id);
|
|
243
|
+
return _context3.abrupt("return", response.data.scheme);
|
|
244
|
+
case 12:
|
|
245
|
+
_context3.prev = 12;
|
|
246
|
+
_context3.t0 = _context3["catch"](0);
|
|
247
|
+
console.error('[BackendApiAdapter] 保存列方案失败:', _context3.t0);
|
|
248
|
+
_antd.message.error('保存列方案失败');
|
|
249
|
+
throw _context3.t0;
|
|
250
|
+
case 17:
|
|
251
|
+
case "end":
|
|
252
|
+
return _context3.stop();
|
|
253
|
+
}
|
|
254
|
+
}, _callee3, this, [[0, 12]]);
|
|
255
|
+
}));
|
|
256
|
+
function saveColumnScheme(_x2, _x3) {
|
|
257
|
+
return _saveColumnScheme.apply(this, arguments);
|
|
258
|
+
}
|
|
259
|
+
return saveColumnScheme;
|
|
260
|
+
}()
|
|
261
|
+
}, {
|
|
262
|
+
key: "deleteColumnScheme",
|
|
263
|
+
value: function () {
|
|
264
|
+
var _deleteColumnScheme = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(gridId, schemeId) {
|
|
265
|
+
var url, response;
|
|
266
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
267
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
268
|
+
case 0:
|
|
269
|
+
_context4.prev = 0;
|
|
270
|
+
this.log("\u5220\u9664\u5217\u65B9\u6848: ".concat(gridId, " - ").concat(schemeId));
|
|
271
|
+
url = "".concat(this.config.apiBaseUrl, "/api/extra-object/table-scheme/column-scheme/").concat(schemeId, "?gridId=").concat(gridId);
|
|
272
|
+
_context4.next = 5;
|
|
273
|
+
return this.request(url, {
|
|
274
|
+
method: 'DELETE'
|
|
275
|
+
});
|
|
276
|
+
case 5:
|
|
277
|
+
response = _context4.sent;
|
|
278
|
+
if (response.success) {
|
|
279
|
+
_context4.next = 8;
|
|
280
|
+
break;
|
|
281
|
+
}
|
|
282
|
+
throw new Error(response.message || '删除失败');
|
|
283
|
+
case 8:
|
|
284
|
+
this.log('删除成功');
|
|
285
|
+
_context4.next = 16;
|
|
286
|
+
break;
|
|
287
|
+
case 11:
|
|
288
|
+
_context4.prev = 11;
|
|
289
|
+
_context4.t0 = _context4["catch"](0);
|
|
290
|
+
console.error('[BackendApiAdapter] 删除列方案失败:', _context4.t0);
|
|
291
|
+
_antd.message.error('删除列方案失败');
|
|
292
|
+
throw _context4.t0;
|
|
293
|
+
case 16:
|
|
294
|
+
case "end":
|
|
295
|
+
return _context4.stop();
|
|
296
|
+
}
|
|
297
|
+
}, _callee4, this, [[0, 11]]);
|
|
298
|
+
}));
|
|
299
|
+
function deleteColumnScheme(_x4, _x5) {
|
|
300
|
+
return _deleteColumnScheme.apply(this, arguments);
|
|
301
|
+
}
|
|
302
|
+
return deleteColumnScheme;
|
|
303
|
+
}() // ========== 查询方案操作 ==========
|
|
304
|
+
}, {
|
|
305
|
+
key: "saveQueryScheme",
|
|
306
|
+
value: function () {
|
|
307
|
+
var _saveQueryScheme = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(gridId, scheme) {
|
|
308
|
+
var _response$data2, url, response;
|
|
309
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
310
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
311
|
+
case 0:
|
|
312
|
+
_context5.prev = 0;
|
|
313
|
+
this.log("\u4FDD\u5B58\u67E5\u8BE2\u65B9\u6848: ".concat(gridId, " - ").concat(scheme.name));
|
|
314
|
+
url = "".concat(this.config.apiBaseUrl, "/api/extra-object/table-scheme/query-scheme");
|
|
315
|
+
_context5.next = 5;
|
|
316
|
+
return this.request(url, {
|
|
317
|
+
method: 'POST',
|
|
318
|
+
body: JSON.stringify({
|
|
319
|
+
gridId: gridId,
|
|
320
|
+
scheme: scheme
|
|
321
|
+
})
|
|
322
|
+
});
|
|
323
|
+
case 5:
|
|
324
|
+
response = _context5.sent;
|
|
325
|
+
if (response.success) {
|
|
326
|
+
_context5.next = 8;
|
|
327
|
+
break;
|
|
328
|
+
}
|
|
329
|
+
throw new Error(response.message || '保存失败');
|
|
330
|
+
case 8:
|
|
331
|
+
this.log('保存成功', (_response$data2 = response.data) === null || _response$data2 === void 0 ? void 0 : _response$data2.scheme.id);
|
|
332
|
+
return _context5.abrupt("return", response.data.scheme);
|
|
333
|
+
case 12:
|
|
334
|
+
_context5.prev = 12;
|
|
335
|
+
_context5.t0 = _context5["catch"](0);
|
|
336
|
+
console.error('[BackendApiAdapter] 保存查询方案失败:', _context5.t0);
|
|
337
|
+
_antd.message.error('保存查询方案失败');
|
|
338
|
+
throw _context5.t0;
|
|
339
|
+
case 17:
|
|
340
|
+
case "end":
|
|
341
|
+
return _context5.stop();
|
|
342
|
+
}
|
|
343
|
+
}, _callee5, this, [[0, 12]]);
|
|
344
|
+
}));
|
|
345
|
+
function saveQueryScheme(_x6, _x7) {
|
|
346
|
+
return _saveQueryScheme.apply(this, arguments);
|
|
347
|
+
}
|
|
348
|
+
return saveQueryScheme;
|
|
349
|
+
}()
|
|
350
|
+
}, {
|
|
351
|
+
key: "deleteQueryScheme",
|
|
352
|
+
value: function () {
|
|
353
|
+
var _deleteQueryScheme = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(gridId, schemeId) {
|
|
354
|
+
var url, response;
|
|
355
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
356
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
357
|
+
case 0:
|
|
358
|
+
_context6.prev = 0;
|
|
359
|
+
this.log("\u5220\u9664\u67E5\u8BE2\u65B9\u6848: ".concat(gridId, " - ").concat(schemeId));
|
|
360
|
+
url = "".concat(this.config.apiBaseUrl, "/api/extra-object/table-scheme/query-scheme/").concat(schemeId, "?gridId=").concat(gridId);
|
|
361
|
+
_context6.next = 5;
|
|
362
|
+
return this.request(url, {
|
|
363
|
+
method: 'DELETE'
|
|
364
|
+
});
|
|
365
|
+
case 5:
|
|
366
|
+
response = _context6.sent;
|
|
367
|
+
if (response.success) {
|
|
368
|
+
_context6.next = 8;
|
|
369
|
+
break;
|
|
370
|
+
}
|
|
371
|
+
throw new Error(response.message || '删除失败');
|
|
372
|
+
case 8:
|
|
373
|
+
this.log('删除成功');
|
|
374
|
+
_context6.next = 16;
|
|
375
|
+
break;
|
|
376
|
+
case 11:
|
|
377
|
+
_context6.prev = 11;
|
|
378
|
+
_context6.t0 = _context6["catch"](0);
|
|
379
|
+
console.error('[BackendApiAdapter] 删除查询方案失败:', _context6.t0);
|
|
380
|
+
_antd.message.error('删除查询方案失败');
|
|
381
|
+
throw _context6.t0;
|
|
382
|
+
case 16:
|
|
383
|
+
case "end":
|
|
384
|
+
return _context6.stop();
|
|
385
|
+
}
|
|
386
|
+
}, _callee6, this, [[0, 11]]);
|
|
387
|
+
}));
|
|
388
|
+
function deleteQueryScheme(_x8, _x9) {
|
|
389
|
+
return _deleteQueryScheme.apply(this, arguments);
|
|
390
|
+
}
|
|
391
|
+
return deleteQueryScheme;
|
|
392
|
+
}() // ========== 当前方案操作 ==========
|
|
393
|
+
}, {
|
|
394
|
+
key: "setCurrentScheme",
|
|
395
|
+
value: function () {
|
|
396
|
+
var _setCurrentScheme = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(gridId, columnSchemeId, querySchemeId) {
|
|
397
|
+
var url, response;
|
|
398
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
399
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
400
|
+
case 0:
|
|
401
|
+
_context7.prev = 0;
|
|
402
|
+
this.log("\u8BBE\u7F6E\u5F53\u524D\u65B9\u6848: ".concat(gridId), {
|
|
403
|
+
columnSchemeId: columnSchemeId,
|
|
404
|
+
querySchemeId: querySchemeId
|
|
405
|
+
});
|
|
406
|
+
url = "".concat(this.config.apiBaseUrl, "/api/extra-object/table-scheme/current-scheme");
|
|
407
|
+
_context7.next = 5;
|
|
408
|
+
return this.request(url, {
|
|
409
|
+
method: 'PUT',
|
|
410
|
+
body: JSON.stringify({
|
|
411
|
+
gridId: gridId,
|
|
412
|
+
columnSchemeId: columnSchemeId,
|
|
413
|
+
querySchemeId: querySchemeId
|
|
414
|
+
})
|
|
415
|
+
});
|
|
416
|
+
case 5:
|
|
417
|
+
response = _context7.sent;
|
|
418
|
+
if (response.success) {
|
|
419
|
+
_context7.next = 8;
|
|
420
|
+
break;
|
|
421
|
+
}
|
|
422
|
+
throw new Error(response.message || '设置失败');
|
|
423
|
+
case 8:
|
|
424
|
+
this.log('设置成功');
|
|
425
|
+
_context7.next = 16;
|
|
426
|
+
break;
|
|
427
|
+
case 11:
|
|
428
|
+
_context7.prev = 11;
|
|
429
|
+
_context7.t0 = _context7["catch"](0);
|
|
430
|
+
console.error('[BackendApiAdapter] 设置当前方案失败:', _context7.t0);
|
|
431
|
+
_antd.message.error('设置当前方案失败');
|
|
432
|
+
throw _context7.t0;
|
|
433
|
+
case 16:
|
|
434
|
+
case "end":
|
|
435
|
+
return _context7.stop();
|
|
436
|
+
}
|
|
437
|
+
}, _callee7, this, [[0, 11]]);
|
|
438
|
+
}));
|
|
439
|
+
function setCurrentScheme(_x10, _x11, _x12) {
|
|
440
|
+
return _setCurrentScheme.apply(this, arguments);
|
|
441
|
+
}
|
|
442
|
+
return setCurrentScheme;
|
|
443
|
+
}()
|
|
444
|
+
}]);
|
|
445
|
+
return BackendApiSchemeAdapter;
|
|
446
|
+
}();
|