@gingkoo/pandora-metabase 1.0.87 → 1.0.89
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/lib/cjs/common/SplitView/index.js +12 -11
- package/lib/cjs/components/dialog/custom-column/expression-editor.js +2 -1
- package/lib/cjs/components/dialog/custom-column/tokenizedI-input.js +2 -1
- package/lib/cjs/components/dialog/expression/index.js +12 -11
- package/lib/cjs/components/dialog/formula/index.js +22 -15
- package/lib/cjs/components/dialog/formula/utils.js +5 -2
- package/lib/cjs/components/dialog/formula-list/index.js +31 -27
- package/lib/cjs/components/dialog/formula-list/index.less +5 -0
- package/lib/cjs/components/dialog/index.js +2 -2
- package/lib/cjs/components/dialog/select-column/index.js +4 -4
- package/lib/cjs/components/dialog/select-join-column/index.js +3 -3
- package/lib/cjs/components/dialog/select-table/index.js +13 -12
- package/lib/cjs/components/icons.js +36 -36
- package/lib/cjs/components/metabase/index.js +9 -9
- package/lib/cjs/components/metabase/index.less +1 -1
- package/lib/cjs/components/modules/components/Wrapper.js +6 -6
- package/lib/cjs/components/modules/components/header.js +4 -4
- package/lib/cjs/components/modules/components/meta-icon.js +2 -1
- package/lib/cjs/components/modules/custom-column.js +8 -8
- package/lib/cjs/components/modules/filter.js +4 -4
- package/lib/cjs/components/modules/join-data.js +13 -13
- package/lib/cjs/components/modules/summarize/group-by.js +4 -4
- package/lib/cjs/components/modules/summarize/select-index.js +4 -4
- package/lib/cjs/components/modules/table-data.js +10 -10
- package/lib/cjs/components/popup.js +2 -1
- package/lib/cjs/hooks/use-state.js +125 -112
- package/lib/cjs/index.js +2 -1
- package/lib/cjs/store/types.d.ts +2 -0
- package/lib/cjs/utils/transformSql.js +8 -8
- package/lib/es/common/SplitView/index.js +10 -10
- package/lib/es/components/dialog/expression/index.js +10 -10
- package/lib/es/components/dialog/formula/index.js +20 -14
- package/lib/es/components/dialog/formula/utils.js +5 -2
- package/lib/es/components/dialog/formula-list/index.js +29 -26
- package/lib/es/components/dialog/formula-list/index.less +5 -0
- package/lib/es/components/dialog/select-column/index.js +4 -4
- package/lib/es/components/dialog/select-join-column/index.js +3 -3
- package/lib/es/components/dialog/select-table/index.js +11 -11
- package/lib/es/components/icons.js +36 -36
- package/lib/es/components/metabase/index.js +9 -9
- package/lib/es/components/metabase/index.less +1 -1
- package/lib/es/components/modules/components/Wrapper.js +6 -6
- package/lib/es/components/modules/components/header.js +4 -4
- package/lib/es/components/modules/custom-column.js +8 -8
- package/lib/es/components/modules/filter.js +4 -4
- package/lib/es/components/modules/join-data.js +13 -13
- package/lib/es/components/modules/summarize/group-by.js +4 -4
- package/lib/es/components/modules/summarize/select-index.js +4 -4
- package/lib/es/components/modules/table-data.js +10 -10
- package/lib/es/hooks/use-state.js +125 -112
- package/lib/es/store/types.d.ts +2 -0
- package/lib/es/utils/transformSql.js +8 -8
- package/package.json +2 -2
|
@@ -8,8 +8,8 @@ exports["default"] = exports.SummarizeAlias = void 0;
|
|
|
8
8
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/toConsumableArray"));
|
|
9
9
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectWithoutProperties"));
|
|
10
10
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
-
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
|
|
12
11
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/asyncToGenerator"));
|
|
12
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
|
|
13
13
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
|
|
14
14
|
var _react = require("react");
|
|
15
15
|
var _helper = require("../utils/helper");
|
|
@@ -64,133 +64,146 @@ var useStore = function useStore() {
|
|
|
64
64
|
toolbar = _useState8[0],
|
|
65
65
|
setToolbar = _useState8[1]; //工具列表
|
|
66
66
|
var _useState9 = (0, _react.useState)('${name}'),
|
|
67
|
-
|
|
68
|
-
fieldNameTpl =
|
|
69
|
-
setFieldNameTpl =
|
|
70
|
-
var
|
|
71
|
-
_useState10 = (0, _slicedToArray2["default"])(_useState1, 2),
|
|
72
|
-
tableNameTpl = _useState10[0],
|
|
73
|
-
setTableNameTpl = _useState10[1]; //显示字段
|
|
74
|
-
var _useState11 = (0, _react.useState)([]),
|
|
67
|
+
_useState10 = (0, _slicedToArray2["default"])(_useState9, 2),
|
|
68
|
+
fieldNameTpl = _useState10[0],
|
|
69
|
+
setFieldNameTpl = _useState10[1]; //显示字段
|
|
70
|
+
var _useState11 = (0, _react.useState)('${name}'),
|
|
75
71
|
_useState12 = (0, _slicedToArray2["default"])(_useState11, 2),
|
|
76
|
-
|
|
77
|
-
|
|
72
|
+
tableNameTpl = _useState12[0],
|
|
73
|
+
setTableNameTpl = _useState12[1]; //显示字段
|
|
78
74
|
var _useState13 = (0, _react.useState)([]),
|
|
79
75
|
_useState14 = (0, _slicedToArray2["default"])(_useState13, 2),
|
|
80
|
-
|
|
81
|
-
|
|
76
|
+
sourceList = _useState14[0],
|
|
77
|
+
setSourceList = _useState14[1]; //数据源列表
|
|
82
78
|
var _useState15 = (0, _react.useState)([]),
|
|
83
79
|
_useState16 = (0, _slicedToArray2["default"])(_useState15, 2),
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
var _useState17 = (0, _react.useState)(
|
|
80
|
+
constantList = _useState16[0],
|
|
81
|
+
setConstantList = _useState16[1]; //常量列表
|
|
82
|
+
var _useState17 = (0, _react.useState)([]),
|
|
87
83
|
_useState18 = (0, _slicedToArray2["default"])(_useState17, 2),
|
|
88
|
-
|
|
89
|
-
|
|
84
|
+
formulaTemplates = _useState18[0],
|
|
85
|
+
_setFormulaTemplates = _useState18[1]; //公式配置数组
|
|
90
86
|
var _useState19 = (0, _react.useState)(false),
|
|
91
87
|
_useState20 = (0, _slicedToArray2["default"])(_useState19, 2),
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
var _useState21 = (0, _react.useState)(
|
|
88
|
+
ignoreGroupByType = _useState20[0],
|
|
89
|
+
setIgnoreGroupByType = _useState20[1]; // 忽略groupBy类型
|
|
90
|
+
var _useState21 = (0, _react.useState)(false),
|
|
95
91
|
_useState22 = (0, _slicedToArray2["default"])(_useState21, 2),
|
|
96
|
-
|
|
97
|
-
|
|
92
|
+
filterCustomType = _useState22[0],
|
|
93
|
+
setfilterCustomType = _useState22[1]; // 过滤器自定义类型
|
|
98
94
|
var _useState23 = (0, _react.useState)({}),
|
|
99
95
|
_useState24 = (0, _slicedToArray2["default"])(_useState23, 2),
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
var _useState25 = (0, _react.useState)(
|
|
96
|
+
_cacheSource2TableMap = _useState24[0],
|
|
97
|
+
set_cacheSource2TableMap = _useState24[1]; //数据源id 对应数据集列表
|
|
98
|
+
var _useState25 = (0, _react.useState)({}),
|
|
103
99
|
_useState26 = (0, _slicedToArray2["default"])(_useState25, 2),
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
var _useState27 = (0, _react.useState)(
|
|
100
|
+
_cacheColumnsMap = _useState26[0],
|
|
101
|
+
set_cacheColumnsMap = _useState26[1]; //数据源id 对应数据集列表
|
|
102
|
+
var _useState27 = (0, _react.useState)(defaultMeta),
|
|
103
|
+
_useState28 = (0, _slicedToArray2["default"])(_useState27, 2),
|
|
104
|
+
metaList = _useState28[0],
|
|
105
|
+
_setMeta = _useState28[1]; //数据源id 对应数据集列表
|
|
106
|
+
var _useState29 = (0, _react.useState)({
|
|
107
107
|
visible: false,
|
|
108
108
|
node: null,
|
|
109
109
|
content: null
|
|
110
110
|
}),
|
|
111
|
-
|
|
112
|
-
popupData =
|
|
113
|
-
setPopup =
|
|
114
|
-
var
|
|
111
|
+
_useState30 = (0, _slicedToArray2["default"])(_useState29, 2),
|
|
112
|
+
popupData = _useState30[0],
|
|
113
|
+
setPopup = _useState30[1]; //弹窗
|
|
114
|
+
var _useState31 = (0, _react.useState)({
|
|
115
115
|
visible: false,
|
|
116
116
|
node: null,
|
|
117
117
|
content: null
|
|
118
118
|
}),
|
|
119
|
-
_useState30 = (0, _slicedToArray2["default"])(_useState29, 2),
|
|
120
|
-
popupData2 = _useState30[0],
|
|
121
|
-
setPopup2 = _useState30[1]; //弹窗
|
|
122
|
-
var _useState31 = (0, _react.useState)(true),
|
|
123
119
|
_useState32 = (0, _slicedToArray2["default"])(_useState31, 2),
|
|
124
|
-
|
|
125
|
-
|
|
120
|
+
popupData2 = _useState32[0],
|
|
121
|
+
setPopup2 = _useState32[1]; //弹窗
|
|
126
122
|
var _useState33 = (0, _react.useState)(true),
|
|
127
123
|
_useState34 = (0, _slicedToArray2["default"])(_useState33, 2),
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
var _useState35 = (0, _react.useState)(
|
|
124
|
+
popupClosable = _useState34[0],
|
|
125
|
+
setClosable = _useState34[1]; //是否可关闭 如果弹框里面再弹框 则不可关闭
|
|
126
|
+
var _useState35 = (0, _react.useState)(true),
|
|
131
127
|
_useState36 = (0, _slicedToArray2["default"])(_useState35, 2),
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
var _useState37 = (0, _react.useState)(
|
|
128
|
+
popupClosable2 = _useState36[0],
|
|
129
|
+
setClosable2 = _useState36[1]; //是否可关闭 如果弹框里面再弹框 则不可关闭
|
|
130
|
+
var _useState37 = (0, _react.useState)({}),
|
|
135
131
|
_useState38 = (0, _slicedToArray2["default"])(_useState37, 2),
|
|
136
|
-
|
|
137
|
-
|
|
132
|
+
currentTable = _useState38[0],
|
|
133
|
+
setCurrentTable = _useState38[1]; // 当前存在的表
|
|
138
134
|
var _useState39 = (0, _react.useState)(false),
|
|
139
135
|
_useState40 = (0, _slicedToArray2["default"])(_useState39, 2),
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
var _useState41 = (0, _react.useState)(
|
|
136
|
+
isExit = _useState40[0],
|
|
137
|
+
setIsExit = _useState40[1]; // 是否是notExit
|
|
138
|
+
var _useState41 = (0, _react.useState)(false),
|
|
143
139
|
_useState42 = (0, _slicedToArray2["default"])(_useState41, 2),
|
|
144
|
-
|
|
145
|
-
|
|
140
|
+
isSubquery = _useState42[0],
|
|
141
|
+
setIsSubquery = _useState42[1]; // 是否是子查询
|
|
146
142
|
var _useState43 = (0, _react.useState)(true),
|
|
147
143
|
_useState44 = (0, _slicedToArray2["default"])(_useState43, 2),
|
|
148
|
-
|
|
149
|
-
|
|
144
|
+
tableEnableAlias = _useState44[0],
|
|
145
|
+
setTableEnableAlias = _useState44[1]; // 表名是否开启别名
|
|
150
146
|
var _useState45 = (0, _react.useState)(true),
|
|
151
147
|
_useState46 = (0, _slicedToArray2["default"])(_useState45, 2),
|
|
152
|
-
|
|
153
|
-
|
|
148
|
+
fieldEnableAlias = _useState46[0],
|
|
149
|
+
setFieldEnableAlias = _useState46[1]; // 字段名是否开启别名
|
|
154
150
|
var _useState47 = (0, _react.useState)(true),
|
|
155
151
|
_useState48 = (0, _slicedToArray2["default"])(_useState47, 2),
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
var _useState49 = (0, _react.useState)(
|
|
152
|
+
groupByEnableAlias = _useState48[0],
|
|
153
|
+
setGroupByEnableAlias = _useState48[1]; // 聚合是否开启别名
|
|
154
|
+
var _useState49 = (0, _react.useState)(true),
|
|
159
155
|
_useState50 = (0, _slicedToArray2["default"])(_useState49, 2),
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
var _useState51 = (0, _react.useState)(
|
|
156
|
+
isSelectFields = _useState50[0],
|
|
157
|
+
setIsSelectFields = _useState50[1]; // 是否默认勾选字段
|
|
158
|
+
var _useState51 = (0, _react.useState)(false),
|
|
163
159
|
_useState52 = (0, _slicedToArray2["default"])(_useState51, 2),
|
|
164
|
-
|
|
165
|
-
|
|
160
|
+
tableFlat = _useState52[0],
|
|
161
|
+
setTableFlat = _useState52[1]; // 是否平铺数据表
|
|
166
162
|
var _useState53 = (0, _react.useState)([]),
|
|
167
163
|
_useState54 = (0, _slicedToArray2["default"])(_useState53, 2),
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
var _useState55 = (0, _react.useState)(
|
|
164
|
+
sourceTable = _useState54[0],
|
|
165
|
+
setSourceTable = _useState54[1];
|
|
166
|
+
var _useState55 = (0, _react.useState)([]),
|
|
171
167
|
_useState56 = (0, _slicedToArray2["default"])(_useState55, 2),
|
|
172
|
-
|
|
173
|
-
|
|
168
|
+
copyType = _useState56[0],
|
|
169
|
+
setCopyType = _useState56[1]; // 复制类型
|
|
174
170
|
var _useState57 = (0, _react.useState)(false),
|
|
175
171
|
_useState58 = (0, _slicedToArray2["default"])(_useState57, 2),
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
var _useState59 = (0, _react.useState)(
|
|
172
|
+
metabaseCopy = _useState58[0],
|
|
173
|
+
setMetabaseCopy = _useState58[1]; // 是否开启复制功能
|
|
174
|
+
var _useState59 = (0, _react.useState)(false),
|
|
179
175
|
_useState60 = (0, _slicedToArray2["default"])(_useState59, 2),
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
var _useState61 = (0, _react.useState)(
|
|
176
|
+
moduleDiff = _useState60[0],
|
|
177
|
+
setModuleDiff = _useState60[1]; // 是否开启模块比对功能
|
|
178
|
+
var _useState61 = (0, _react.useState)([]),
|
|
183
179
|
_useState62 = (0, _slicedToArray2["default"])(_useState61, 2),
|
|
184
|
-
|
|
185
|
-
|
|
180
|
+
sourceData = _useState62[0],
|
|
181
|
+
setSourceData = _useState62[1]; // 原始数据
|
|
186
182
|
var _useState63 = (0, _react.useState)(false),
|
|
187
183
|
_useState64 = (0, _slicedToArray2["default"])(_useState63, 2),
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
var _useState65 = (0, _react.useState)(
|
|
184
|
+
moduleCopy = _useState64[0],
|
|
185
|
+
setModuleCopy = _useState64[1]; // 是否开启模块复制功能
|
|
186
|
+
var _useState65 = (0, _react.useState)(false),
|
|
191
187
|
_useState66 = (0, _slicedToArray2["default"])(_useState65, 2),
|
|
192
|
-
|
|
193
|
-
|
|
188
|
+
isMetabaseCopy = _useState66[0],
|
|
189
|
+
setIsMetabaseCopy = _useState66[1]; // 是否开启勾选组复制
|
|
190
|
+
var _useState67 = (0, _react.useState)(_storage["default"]._metabaseCopyModule || []),
|
|
191
|
+
_useState68 = (0, _slicedToArray2["default"])(_useState67, 2),
|
|
192
|
+
metabaseCopyModule = _useState68[0],
|
|
193
|
+
setMetabaseCopyModule = _useState68[1]; // 复制的内容
|
|
194
|
+
var setFormulaTemplates = function setFormulaTemplates(data) {
|
|
195
|
+
var newData = data === null || data === void 0 ? void 0 : data.map(function (v) {
|
|
196
|
+
var children = v.children.map(function (vv) {
|
|
197
|
+
return (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, vv), {}, {
|
|
198
|
+
id: vv.id || vv.name
|
|
199
|
+
});
|
|
200
|
+
});
|
|
201
|
+
return (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, v), {}, {
|
|
202
|
+
children: children
|
|
203
|
+
});
|
|
204
|
+
});
|
|
205
|
+
_setFormulaTemplates(newData);
|
|
206
|
+
};
|
|
194
207
|
// 外层ref
|
|
195
208
|
var popupContainer = (0, _react.useRef)();
|
|
196
209
|
// const [fetchDatasetFn, setFetchDatasetFn] = useState<(id: string) => Promise<any>>(
|
|
@@ -216,20 +229,20 @@ var useStore = function useStore() {
|
|
|
216
229
|
newCode,
|
|
217
230
|
data,
|
|
218
231
|
_args = arguments;
|
|
219
|
-
return _regenerator["default"].wrap(function (_context) {
|
|
232
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
220
233
|
while (1) switch (_context.prev = _context.next) {
|
|
221
234
|
case 0:
|
|
222
235
|
oldCode = _args.length > 0 && _args[0] !== undefined ? _args[0] : [];
|
|
223
236
|
newCode = _args.length > 1 ? _args[1] : undefined;
|
|
224
|
-
_context.next =
|
|
237
|
+
_context.next = 4;
|
|
225
238
|
return fetchDiffFn.current({
|
|
226
239
|
oldCode: oldCode,
|
|
227
240
|
newCode: newCode
|
|
228
241
|
});
|
|
229
|
-
case
|
|
242
|
+
case 4:
|
|
230
243
|
data = _context.sent;
|
|
231
244
|
return _context.abrupt("return", data);
|
|
232
|
-
case
|
|
245
|
+
case 6:
|
|
233
246
|
case "end":
|
|
234
247
|
return _context.stop();
|
|
235
248
|
}
|
|
@@ -279,24 +292,24 @@ var useStore = function useStore() {
|
|
|
279
292
|
var getSourceTable = /*#__PURE__*/function () {
|
|
280
293
|
var _ref2 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee3(source) {
|
|
281
294
|
var results;
|
|
282
|
-
return _regenerator["default"].wrap(function (_context3) {
|
|
295
|
+
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
283
296
|
while (1) switch (_context3.prev = _context3.next) {
|
|
284
297
|
case 0:
|
|
285
|
-
_context3.next =
|
|
298
|
+
_context3.next = 2;
|
|
286
299
|
return Promise.all(source.map(/*#__PURE__*/function () {
|
|
287
300
|
var _ref3 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee2(v) {
|
|
288
301
|
var tables;
|
|
289
|
-
return _regenerator["default"].wrap(function (_context2) {
|
|
302
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
290
303
|
while (1) switch (_context2.prev = _context2.next) {
|
|
291
304
|
case 0:
|
|
292
|
-
_context2.next =
|
|
305
|
+
_context2.next = 2;
|
|
293
306
|
return fetchDataset(v.datasourceId);
|
|
294
|
-
case
|
|
307
|
+
case 2:
|
|
295
308
|
tables = _context2.sent;
|
|
296
309
|
return _context2.abrupt("return", (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, v), {}, {
|
|
297
310
|
children: tables
|
|
298
311
|
}));
|
|
299
|
-
case
|
|
312
|
+
case 4:
|
|
300
313
|
case "end":
|
|
301
314
|
return _context2.stop();
|
|
302
315
|
}
|
|
@@ -306,10 +319,10 @@ var useStore = function useStore() {
|
|
|
306
319
|
return _ref3.apply(this, arguments);
|
|
307
320
|
};
|
|
308
321
|
}()));
|
|
309
|
-
case
|
|
322
|
+
case 2:
|
|
310
323
|
results = _context3.sent;
|
|
311
324
|
setSourceTable(results || []);
|
|
312
|
-
case
|
|
325
|
+
case 4:
|
|
313
326
|
case "end":
|
|
314
327
|
return _context3.stop();
|
|
315
328
|
}
|
|
@@ -337,25 +350,25 @@ var useStore = function useStore() {
|
|
|
337
350
|
var fetchDataset = /*#__PURE__*/function () {
|
|
338
351
|
var _ref4 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee4(datasourceId) {
|
|
339
352
|
var tables, _tables;
|
|
340
|
-
return _regenerator["default"].wrap(function (_context4) {
|
|
353
|
+
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
341
354
|
while (1) switch (_context4.prev = _context4.next) {
|
|
342
355
|
case 0:
|
|
343
356
|
tables = getDataset(datasourceId);
|
|
344
357
|
if (!tables.length) {
|
|
345
|
-
_context4.next =
|
|
358
|
+
_context4.next = 3;
|
|
346
359
|
break;
|
|
347
360
|
}
|
|
348
361
|
return _context4.abrupt("return", tables);
|
|
349
|
-
case
|
|
350
|
-
_context4.next =
|
|
362
|
+
case 3:
|
|
363
|
+
_context4.next = 5;
|
|
351
364
|
return fetchDatasetFn.current(datasourceId, {
|
|
352
365
|
isExit: isExit
|
|
353
366
|
});
|
|
354
|
-
case
|
|
367
|
+
case 5:
|
|
355
368
|
_tables = _context4.sent;
|
|
356
369
|
setDataset(datasourceId, _tables);
|
|
357
370
|
return _context4.abrupt("return", _tables);
|
|
358
|
-
case
|
|
371
|
+
case 8:
|
|
359
372
|
case "end":
|
|
360
373
|
return _context4.stop();
|
|
361
374
|
}
|
|
@@ -388,7 +401,7 @@ var useStore = function useStore() {
|
|
|
388
401
|
columns,
|
|
389
402
|
_columns,
|
|
390
403
|
_args5 = arguments;
|
|
391
|
-
return _regenerator["default"].wrap(function (_context5) {
|
|
404
|
+
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
|
392
405
|
while (1) switch (_context5.prev = _context5.next) {
|
|
393
406
|
case 0:
|
|
394
407
|
oldColumns = _args5.length > 2 && _args5[2] !== undefined ? _args5[2] : [];
|
|
@@ -414,17 +427,17 @@ var useStore = function useStore() {
|
|
|
414
427
|
tableName = table.name;
|
|
415
428
|
columns = getColumns(tableName);
|
|
416
429
|
if (columns.length) {
|
|
417
|
-
_context5.next =
|
|
430
|
+
_context5.next = 16;
|
|
418
431
|
break;
|
|
419
432
|
}
|
|
420
|
-
_context5.next =
|
|
433
|
+
_context5.next = 14;
|
|
421
434
|
return fetchColumnsFn.current(extra, datasourceId, {
|
|
422
435
|
isExit: _isExit
|
|
423
436
|
});
|
|
424
|
-
case
|
|
437
|
+
case 14:
|
|
425
438
|
columns = _context5.sent;
|
|
426
439
|
setColumns(tableName, columns);
|
|
427
|
-
case
|
|
440
|
+
case 16:
|
|
428
441
|
_columns = (_columns2 = columns) === null || _columns2 === void 0 ? void 0 : _columns2.map(function (v) {
|
|
429
442
|
var select = selectId.includes(v.id);
|
|
430
443
|
var obj = {};
|
|
@@ -435,7 +448,7 @@ var useStore = function useStore() {
|
|
|
435
448
|
});
|
|
436
449
|
});
|
|
437
450
|
typeof callback === 'function' && callback(_columns);
|
|
438
|
-
case
|
|
451
|
+
case 18:
|
|
439
452
|
case "end":
|
|
440
453
|
return _context5.stop();
|
|
441
454
|
}
|
|
@@ -452,7 +465,7 @@ var useStore = function useStore() {
|
|
|
452
465
|
newMeta,
|
|
453
466
|
isChange,
|
|
454
467
|
_args6 = arguments;
|
|
455
|
-
return _regenerator["default"].wrap(function (_context6) {
|
|
468
|
+
return _regenerator["default"].wrap(function _callee6$(_context6) {
|
|
456
469
|
while (1) switch (_context6.prev = _context6.next) {
|
|
457
470
|
case 0:
|
|
458
471
|
changeObj = _args6.length > 2 && _args6[2] !== undefined ? _args6[2] : {};
|
|
@@ -464,22 +477,22 @@ var useStore = function useStore() {
|
|
|
464
477
|
}
|
|
465
478
|
// 过滤掉初始化
|
|
466
479
|
if (!(changeObj === 'init')) {
|
|
467
|
-
_context6.next =
|
|
480
|
+
_context6.next = 6;
|
|
468
481
|
break;
|
|
469
482
|
}
|
|
470
483
|
return _context6.abrupt("return");
|
|
471
|
-
case
|
|
472
|
-
_context6.next =
|
|
484
|
+
case 6:
|
|
485
|
+
_context6.next = 8;
|
|
473
486
|
return fetchChangeFn.current((0, _utils.splitByUnion)(_metaList), changeObj, {
|
|
474
487
|
isExit: isExit
|
|
475
488
|
});
|
|
476
|
-
case
|
|
489
|
+
case 8:
|
|
477
490
|
isChange = _context6.sent;
|
|
478
491
|
// 是否还原
|
|
479
492
|
if (isChange === false) {
|
|
480
493
|
_setMeta(_metaList);
|
|
481
494
|
}
|
|
482
|
-
case
|
|
495
|
+
case 10:
|
|
483
496
|
case "end":
|
|
484
497
|
return _context6.stop();
|
|
485
498
|
}
|
package/lib/cjs/index.js
CHANGED
|
@@ -18,7 +18,8 @@ var _Loading = _interopRequireDefault(require("./common/Loading"));
|
|
|
18
18
|
var _metabase = _interopRequireDefault(require("./components/metabase"));
|
|
19
19
|
var _utils = require("./utils");
|
|
20
20
|
var _cloneDeep = _interopRequireDefault(require("lodash/cloneDeep"));
|
|
21
|
-
function
|
|
21
|
+
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); }
|
|
22
|
+
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 && {}.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; }
|
|
22
23
|
// export { restoreStructure, handleSqlStruct, compressionStructure } from './store/helper';
|
|
23
24
|
|
|
24
25
|
/**
|
package/lib/cjs/store/types.d.ts
CHANGED
|
@@ -71,6 +71,7 @@ export interface AtomsFormula {
|
|
|
71
71
|
arity?: Arity;
|
|
72
72
|
quotes: string;
|
|
73
73
|
name: string;
|
|
74
|
+
id?: string;
|
|
74
75
|
type: AtomsTypeEnum.FORMULA;
|
|
75
76
|
}
|
|
76
77
|
export interface AtomsExpression {
|
|
@@ -365,6 +366,7 @@ export interface PopupData {
|
|
|
365
366
|
}
|
|
366
367
|
export interface FormulaTemplatesItem {
|
|
367
368
|
name: string;
|
|
369
|
+
id: string;
|
|
368
370
|
args: {
|
|
369
371
|
type: AtomsTypeEnum;
|
|
370
372
|
check?: string | null;
|
|
@@ -604,9 +604,9 @@ var _handleNesting = function handleNesting(data) {
|
|
|
604
604
|
var customColumnsConstants = [];
|
|
605
605
|
var handleCustomColumn = function handleCustomColumn(data) {
|
|
606
606
|
return data.map(function (it) {
|
|
607
|
-
var
|
|
608
|
-
field_sql =
|
|
609
|
-
constants =
|
|
607
|
+
var _handleBaseType2Sql10 = _handleBaseType2Sql8(it.formulaList, db),
|
|
608
|
+
field_sql = _handleBaseType2Sql10.sql,
|
|
609
|
+
constants = _handleBaseType2Sql10.constants;
|
|
610
610
|
customColumnsConstants.push.apply(customColumnsConstants, (0, _toConsumableArray2["default"])(constants));
|
|
611
611
|
return {
|
|
612
612
|
field_sql: "".concat(field_sql, " as ").concat(it.name),
|
|
@@ -621,9 +621,9 @@ var _handleNesting = function handleNesting(data) {
|
|
|
621
621
|
obj.customColumnsConstants = customColumnsConstants;
|
|
622
622
|
}
|
|
623
623
|
if (filterData && filterData.filter.length) {
|
|
624
|
-
var
|
|
625
|
-
sql =
|
|
626
|
-
constants =
|
|
624
|
+
var _handleBaseType2Sql11 = _handleBaseType2Sql8(filterData.filter, db),
|
|
625
|
+
sql = _handleBaseType2Sql11.sql,
|
|
626
|
+
constants = _handleBaseType2Sql11.constants;
|
|
627
627
|
obj.filters = 'WHERE ' + sql;
|
|
628
628
|
obj.filtersConstants = constants;
|
|
629
629
|
}
|
|
@@ -668,8 +668,8 @@ var _handleNesting = function handleNesting(data) {
|
|
|
668
668
|
}
|
|
669
669
|
if (sortData && sortData.sort.length) {
|
|
670
670
|
obj.orderInfos = "ORDER BY ".concat(sortData.sort.map(function (v) {
|
|
671
|
-
var
|
|
672
|
-
sql =
|
|
671
|
+
var _handleBaseType2Sql12 = _handleBaseType2Sql8(v.expression, db),
|
|
672
|
+
sql = _handleBaseType2Sql12.sql;
|
|
673
673
|
return "".concat(sql, " ").concat(v.sort);
|
|
674
674
|
}).join(', '));
|
|
675
675
|
}
|
|
@@ -51,17 +51,17 @@ var SplitView = React.forwardRef(function (props, ref) {
|
|
|
51
51
|
hMaximum = _useState8[0],
|
|
52
52
|
setHMaximum = _useState8[1];
|
|
53
53
|
var _useState9 = useState(false),
|
|
54
|
-
|
|
55
|
-
vMinimum =
|
|
56
|
-
setVMinimum =
|
|
57
|
-
var
|
|
58
|
-
_useState10 = _slicedToArray(_useState1, 2),
|
|
59
|
-
vMaximum = _useState10[0],
|
|
60
|
-
setVMaximum = _useState10[1];
|
|
61
|
-
var _useState11 = useState(0),
|
|
54
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
55
|
+
vMinimum = _useState10[0],
|
|
56
|
+
setVMinimum = _useState10[1];
|
|
57
|
+
var _useState11 = useState(false),
|
|
62
58
|
_useState12 = _slicedToArray(_useState11, 2),
|
|
63
|
-
|
|
64
|
-
|
|
59
|
+
vMaximum = _useState12[0],
|
|
60
|
+
setVMaximum = _useState12[1];
|
|
61
|
+
var _useState13 = useState(0),
|
|
62
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
|
63
|
+
bottomHeight = _useState14[0],
|
|
64
|
+
setBottomHeight = _useState14[1];
|
|
65
65
|
React.useImperativeHandle(ref, function () {
|
|
66
66
|
return {
|
|
67
67
|
open: function open() {
|
|
@@ -79,18 +79,18 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
|
|
|
79
79
|
special_type = _useState8[0],
|
|
80
80
|
setSpecial_type = _useState8[1];
|
|
81
81
|
var _useState9 = useState(value.formula || {}),
|
|
82
|
-
|
|
83
|
-
formula =
|
|
84
|
-
setFormula =
|
|
82
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
83
|
+
formula = _useState10[0],
|
|
84
|
+
setFormula = _useState10[1];
|
|
85
85
|
var store = useStore();
|
|
86
|
-
var
|
|
87
|
-
_useState10 = _slicedToArray(_useState1, 2),
|
|
88
|
-
popupVisible = _useState10[0],
|
|
89
|
-
setPopupVisible = _useState10[1];
|
|
90
|
-
var _useState11 = useState((value === null || value === void 0 || (_value$lhs = value.lhs) === null || _value$lhs === void 0 ? void 0 : _value$lhs.length) > 0 || false),
|
|
86
|
+
var _useState11 = useState(false),
|
|
91
87
|
_useState12 = _slicedToArray(_useState11, 2),
|
|
92
|
-
|
|
93
|
-
|
|
88
|
+
popupVisible = _useState12[0],
|
|
89
|
+
setPopupVisible = _useState12[1];
|
|
90
|
+
var _useState13 = useState((value === null || value === void 0 || (_value$lhs = value.lhs) === null || _value$lhs === void 0 ? void 0 : _value$lhs.length) > 0 || false),
|
|
91
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
|
92
|
+
isNext = _useState14[0],
|
|
93
|
+
setIsNext = _useState14[1];
|
|
94
94
|
var table2Selected = Boolean(rhsVal && (rhsVal === null || rhsVal === void 0 ? void 0 : rhsVal.length) > 0);
|
|
95
95
|
var disabled = useMemo(function () {
|
|
96
96
|
if (!condition) return true;
|
|
@@ -21,13 +21,17 @@ var VisualBox = Styled.div.attrs({
|
|
|
21
21
|
className: 'visual-box'
|
|
22
22
|
})(_templateObject || (_templateObject = _taggedTemplateLiteral([""])));
|
|
23
23
|
var CaseEditor = React.forwardRef(function (props, ref) {
|
|
24
|
-
var _store$formulaTemplat, _fun$args;
|
|
24
|
+
var _store$formulaTemplat, _formulaList$fun$name, _formulaList$fun$name2, _fun$args;
|
|
25
25
|
var store = useStore();
|
|
26
26
|
var value = props.value,
|
|
27
27
|
data = props.data,
|
|
28
28
|
onOk = props.onOk,
|
|
29
29
|
onCancel = props.onCancel;
|
|
30
|
-
var _useState = useState(
|
|
30
|
+
var _useState = useState(function () {
|
|
31
|
+
return _objectSpread(_objectSpread({}, value), {}, {
|
|
32
|
+
id: value.id || value.name
|
|
33
|
+
});
|
|
34
|
+
}),
|
|
31
35
|
_useState2 = _slicedToArray(_useState, 2),
|
|
32
36
|
fun = _useState2[0],
|
|
33
37
|
setFun = _useState2[1];
|
|
@@ -72,13 +76,15 @@ var CaseEditor = React.forwardRef(function (props, ref) {
|
|
|
72
76
|
})));
|
|
73
77
|
};
|
|
74
78
|
// 选择公式名
|
|
75
|
-
var handleFunName = function handleFunName(
|
|
76
|
-
var _formulaList$
|
|
79
|
+
var handleFunName = function handleFunName(id) {
|
|
80
|
+
var _formulaList$id, _formulaList$id2, _formulaList$id3;
|
|
81
|
+
var isId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
77
82
|
// formulaList?.[name].args;
|
|
78
83
|
setFun(_objectSpread(_objectSpread({}, fun), {}, {
|
|
79
|
-
args: getTemArgs(formulaList === null || formulaList === void 0 ? void 0 : formulaList[
|
|
80
|
-
arity: formulaList === null || formulaList === void 0 || (_formulaList$
|
|
81
|
-
|
|
84
|
+
args: getTemArgs(formulaList === null || formulaList === void 0 ? void 0 : formulaList[id].args, formulaList === null || formulaList === void 0 || (_formulaList$id = formulaList[id]) === null || _formulaList$id === void 0 ? void 0 : _formulaList$id.arity),
|
|
85
|
+
arity: formulaList === null || formulaList === void 0 || (_formulaList$id2 = formulaList[id]) === null || _formulaList$id2 === void 0 ? void 0 : _formulaList$id2.arity,
|
|
86
|
+
id: id,
|
|
87
|
+
name: formulaList === null || formulaList === void 0 || (_formulaList$id3 = formulaList[id]) === null || _formulaList$id3 === void 0 ? void 0 : _formulaList$id3.name
|
|
82
88
|
}));
|
|
83
89
|
};
|
|
84
90
|
var getQuotes = function getQuotes(_args) {
|
|
@@ -139,7 +145,7 @@ var CaseEditor = React.forwardRef(function (props, ref) {
|
|
|
139
145
|
triggerProps: {
|
|
140
146
|
clickToClose: true
|
|
141
147
|
},
|
|
142
|
-
value: fun.name,
|
|
148
|
+
value: fun.id || fun.name,
|
|
143
149
|
triggerElement: function triggerElement(value) {
|
|
144
150
|
return _jsx("div", {
|
|
145
151
|
className: cx("Sqb-TableName Sqb-TableName-OPERATOR", {
|
|
@@ -156,9 +162,9 @@ var CaseEditor = React.forwardRef(function (props, ref) {
|
|
|
156
162
|
label: options.name,
|
|
157
163
|
children: Array.from(options.children || []).map(function (option, ind) {
|
|
158
164
|
return _jsx(Select.Option, {
|
|
159
|
-
value: option.
|
|
165
|
+
value: option.id,
|
|
160
166
|
children: option.name
|
|
161
|
-
}, String(option.name + ind));
|
|
167
|
+
}, option.id || String(option.name + ind));
|
|
162
168
|
})
|
|
163
169
|
}, index);
|
|
164
170
|
// <Select.Option key={index} value={option.name}>
|
|
@@ -173,14 +179,14 @@ var CaseEditor = React.forwardRef(function (props, ref) {
|
|
|
173
179
|
color: '#949aab'
|
|
174
180
|
},
|
|
175
181
|
children: [_jsxs("p", {
|
|
176
|
-
children: ["\u63CF\u8FF0\uFF1A", formulaList[fun.name].description]
|
|
182
|
+
children: ["\u63CF\u8FF0\uFF1A", (_formulaList$fun$name = formulaList[fun.name]) === null || _formulaList$fun$name === void 0 ? void 0 : _formulaList$fun$name.description]
|
|
177
183
|
}), _jsxs("p", {
|
|
178
|
-
children: ["\u6848\u4F8B\uFF1A", formulaList[fun.name].example]
|
|
184
|
+
children: ["\u6848\u4F8B\uFF1A", (_formulaList$fun$name2 = formulaList[fun.name]) === null || _formulaList$fun$name2 === void 0 ? void 0 : _formulaList$fun$name2.example]
|
|
179
185
|
})]
|
|
180
186
|
})]
|
|
181
187
|
}), fun === null || fun === void 0 || (_fun$args = fun.args) === null || _fun$args === void 0 ? void 0 : _fun$args.map(function (v, i) {
|
|
182
188
|
if (v.type === AtomsTypeEnum.COLLECTION) {
|
|
183
|
-
var _formulaList$fun$
|
|
189
|
+
var _formulaList$fun$name3;
|
|
184
190
|
return _jsxs("div", {
|
|
185
191
|
className: 'Sqb-item-formula-args',
|
|
186
192
|
children: [_jsxs("div", {
|
|
@@ -193,7 +199,7 @@ var CaseEditor = React.forwardRef(function (props, ref) {
|
|
|
193
199
|
},
|
|
194
200
|
children: ["\u53C2\u6570", i + 1, ":"]
|
|
195
201
|
}), _jsx(FormulaList, {
|
|
196
|
-
check: (formulaList === null || formulaList === void 0 || (_formulaList$fun$
|
|
202
|
+
check: (formulaList === null || formulaList === void 0 || (_formulaList$fun$name3 = formulaList[fun.name]) === null || _formulaList$fun$name3 === void 0 || (_formulaList$fun$name3 = _formulaList$fun$name3.args) === null || _formulaList$fun$name3 === void 0 || (_formulaList$fun$name3 = _formulaList$fun$name3[i]) === null || _formulaList$fun$name3 === void 0 ? void 0 : _formulaList$fun$name3.check) || '',
|
|
197
203
|
value: v.list,
|
|
198
204
|
data: data,
|
|
199
205
|
ref: _ref,
|
|
@@ -4,8 +4,11 @@ export var getObjTem = function getObjTem(arr) {
|
|
|
4
4
|
var obj = {};
|
|
5
5
|
arr === null || arr === void 0 || arr.map(function (v) {
|
|
6
6
|
v.children.map(function (vv) {
|
|
7
|
-
if (vv.name) {
|
|
8
|
-
|
|
7
|
+
// if (vv.name) {
|
|
8
|
+
// obj[vv.name] = vv;
|
|
9
|
+
// }
|
|
10
|
+
if (vv.id) {
|
|
11
|
+
obj[vv.id] = vv;
|
|
9
12
|
}
|
|
10
13
|
});
|
|
11
14
|
});
|