@gingkoo/pandora-metabase 1.0.130 → 1.0.131
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/components/dialog/expression/index.js +0 -1
- package/lib/cjs/components/dialog/formula-list/utils.js +0 -3
- package/lib/cjs/components/dialog/select-column/index.js +2 -2
- package/lib/cjs/components/dialog/select-column-multiple/index.d.ts +0 -1
- package/lib/cjs/components/dialog/select-column-multiple/index.js +44 -19
- package/lib/cjs/components/dialog/select-join-column/index.js +23 -7
- package/lib/cjs/components/dialog/select-join-column-multiple/index.js +15 -6
- package/lib/cjs/components/dialog/select-permission-table/index.js +2 -2
- package/lib/cjs/components/dialog/select-summarize/index.js +1 -3
- package/lib/cjs/components/dialog/select-table/index.d.ts +1 -2
- package/lib/cjs/components/dialog/select-table/index.js +231 -261
- package/lib/cjs/components/dialog/select-table/index.less +51 -36
- package/lib/cjs/components/metabase/index.js +34 -16
- package/lib/cjs/components/modules/components/item-name.js +0 -1
- package/lib/cjs/components/modules/custom-column.js +3 -7
- package/lib/cjs/components/modules/filter.js +3 -6
- package/lib/cjs/components/modules/join-data.js +41 -87
- package/lib/cjs/components/modules/permission-table.js +5 -9
- package/lib/cjs/components/modules/sort.js +1 -2
- package/lib/cjs/components/modules/summarize/group-by.js +1 -8
- package/lib/cjs/components/modules/summarize/select-index.js +1 -4
- package/lib/cjs/components/modules/table-data.js +28 -44
- package/lib/cjs/hooks/use-state.js +22 -147
- package/lib/cjs/index.js +1 -7
- package/lib/cjs/locale/en.js +1 -0
- package/lib/cjs/locale/zh.js +1 -0
- package/lib/cjs/store/types.d.ts +4 -5
- package/lib/cjs/types.d.ts +0 -8
- package/lib/cjs/utils/helper.d.ts +4 -0
- package/lib/cjs/utils/helper.js +102 -1
- package/lib/cjs/utils/transformSql.js +0 -2
- package/lib/cjs/utils.js +38 -18
- package/lib/es/components/dialog/expression/index.js +0 -1
- package/lib/es/components/dialog/formula-list/utils.js +0 -3
- package/lib/es/components/dialog/select-column/index.js +3 -3
- package/lib/es/components/dialog/select-column-multiple/index.d.ts +0 -1
- package/lib/es/components/dialog/select-column-multiple/index.js +45 -21
- package/lib/es/components/dialog/select-join-column/index.js +24 -8
- package/lib/es/components/dialog/select-join-column-multiple/index.js +16 -7
- package/lib/es/components/dialog/select-permission-table/index.js +3 -3
- package/lib/es/components/dialog/select-summarize/index.js +1 -3
- package/lib/es/components/dialog/select-table/index.d.ts +1 -2
- package/lib/es/components/dialog/select-table/index.js +233 -263
- package/lib/es/components/dialog/select-table/index.less +51 -36
- package/lib/es/components/metabase/index.js +34 -16
- package/lib/es/components/modules/components/item-name.js +0 -1
- package/lib/es/components/modules/custom-column.js +3 -7
- package/lib/es/components/modules/filter.js +3 -6
- package/lib/es/components/modules/join-data.js +42 -88
- package/lib/es/components/modules/permission-table.js +6 -10
- package/lib/es/components/modules/sort.js +1 -2
- package/lib/es/components/modules/summarize/group-by.js +1 -8
- package/lib/es/components/modules/summarize/select-index.js +1 -4
- package/lib/es/components/modules/table-data.js +29 -45
- package/lib/es/hooks/use-state.js +23 -148
- package/lib/es/index.js +1 -7
- package/lib/es/locale/en.js +1 -0
- package/lib/es/locale/zh.js +1 -0
- package/lib/es/store/types.d.ts +4 -5
- package/lib/es/types.d.ts +0 -8
- package/lib/es/utils/helper.d.ts +4 -0
- package/lib/es/utils/helper.js +101 -0
- package/lib/es/utils/transformSql.js +0 -2
- package/lib/es/utils.js +39 -19
- package/package.json +1 -1
|
@@ -13,7 +13,7 @@ import { FfPlus, FfLine, Repeat, RelatedWork } from '@gingkoo/pandora-icons';
|
|
|
13
13
|
import Metabase from '../../index';
|
|
14
14
|
import isEqual from 'lodash/isEqual';
|
|
15
15
|
import cloneDeep from 'lodash/cloneDeep';
|
|
16
|
-
import { uuidv4, getAlias, mergeNameAlias } from '../../utils/helper';
|
|
16
|
+
import { uuidv4, getAlias, mergeNameAlias, isSameColumnByIdFirst, isSameTableByIdFirst } from '../../utils/helper';
|
|
17
17
|
import { getTopLayerZIndex } from '../../utils/helper-dom';
|
|
18
18
|
import { getConstantLabel } from '../dialog/formula-list/utils';
|
|
19
19
|
import { __ } from '../../locale';
|
|
@@ -67,7 +67,7 @@ var menuOperator = operators.map(function (v) {
|
|
|
67
67
|
};
|
|
68
68
|
});
|
|
69
69
|
var JoinData = function JoinData(props) {
|
|
70
|
-
var _meta$subquery, _meta$subquery2, _meta$subquery3, _meta$table5, _meta$
|
|
70
|
+
var _meta$subquery, _meta$subquery2, _meta$subquery3, _meta$table4, _meta$table5, _meta$table7, _meta$table8, _meta$table9, _meta$table0, _meta$expressions, _meta$table1, _meta$table10, _meta$expressions2, _store$showMainColumn, _store$showMainColumn2;
|
|
71
71
|
var meta = props.meta,
|
|
72
72
|
groupIndex = props.groupIndex;
|
|
73
73
|
var store = useStore();
|
|
@@ -87,13 +87,13 @@ var JoinData = function JoinData(props) {
|
|
|
87
87
|
setIsDel = _useState2[1];
|
|
88
88
|
var tableIsDel = function () {
|
|
89
89
|
var _ref = _asyncToGenerator(_regeneratorRuntime.mark(function _callee() {
|
|
90
|
-
var _meta$table
|
|
91
|
-
var
|
|
90
|
+
var _meta$table;
|
|
91
|
+
var tableInfo, tables;
|
|
92
92
|
return _regeneratorRuntime.wrap(function (_context) {
|
|
93
93
|
while (1) switch (_context.prev = _context.next) {
|
|
94
94
|
case 0:
|
|
95
|
-
|
|
96
|
-
if ((_meta$
|
|
95
|
+
tableInfo = meta.table2;
|
|
96
|
+
if ((_meta$table = meta.table2) !== null && _meta$table !== void 0 && _meta$table.datasourceId) {
|
|
97
97
|
_context.next = 1;
|
|
98
98
|
break;
|
|
99
99
|
}
|
|
@@ -101,13 +101,12 @@ var JoinData = function JoinData(props) {
|
|
|
101
101
|
return _context.abrupt("return");
|
|
102
102
|
case 1:
|
|
103
103
|
_context.next = 2;
|
|
104
|
-
return store === null || store === void 0 ? void 0 : store.fetchDataset(meta.table2.datasourceId
|
|
104
|
+
return store === null || store === void 0 ? void 0 : store.fetchDataset(meta.table2.datasourceId);
|
|
105
105
|
case 2:
|
|
106
106
|
tables = _context.sent;
|
|
107
|
-
|
|
108
|
-
return v
|
|
109
|
-
}))
|
|
110
|
-
if (!ids.includes(tableId)) {
|
|
107
|
+
if (!(tables !== null && tables !== void 0 && tables.some(function (v) {
|
|
108
|
+
return isSameTableByIdFirst(tableInfo, v);
|
|
109
|
+
}))) {
|
|
111
110
|
setIsDel(true);
|
|
112
111
|
} else {
|
|
113
112
|
setIsDel(false);
|
|
@@ -143,7 +142,6 @@ var JoinData = function JoinData(props) {
|
|
|
143
142
|
name_zh: prevGroupBy.alias,
|
|
144
143
|
datasourceId: '',
|
|
145
144
|
datasourceName: '',
|
|
146
|
-
datasourceType: '',
|
|
147
145
|
columns: []
|
|
148
146
|
};
|
|
149
147
|
if (prevGroupBy !== null && prevGroupBy !== void 0 && (_prevGroupBy$group = prevGroupBy.group) !== null && _prevGroupBy$group !== void 0 && _prevGroupBy$group.length) {
|
|
@@ -188,7 +186,6 @@ var JoinData = function JoinData(props) {
|
|
|
188
186
|
tableUuid: v.table2.tableUuid || uuidv4('table'),
|
|
189
187
|
datasourceId: v.table2.datasourceId,
|
|
190
188
|
datasourceName: v.table2.datasourceName,
|
|
191
|
-
datasourceType: v.table2.datasourceType,
|
|
192
189
|
columns: v.columns || []
|
|
193
190
|
};
|
|
194
191
|
}));
|
|
@@ -204,8 +201,7 @@ var JoinData = function JoinData(props) {
|
|
|
204
201
|
tableUuid: v.table.tableUuid || uuidv4('table'),
|
|
205
202
|
columns: v.columns,
|
|
206
203
|
datasourceId: v.table.datasourceId,
|
|
207
|
-
datasourceName: v.table.datasourceName
|
|
208
|
-
datasourceType: v.table.datasourceType
|
|
204
|
+
datasourceName: v.table.datasourceName
|
|
209
205
|
}));
|
|
210
206
|
} else if (v.type === TypeEnum.joinData) {
|
|
211
207
|
mo.push({
|
|
@@ -216,8 +212,7 @@ var JoinData = function JoinData(props) {
|
|
|
216
212
|
tableUuid: v.table2.tableUuid || uuidv4('table'),
|
|
217
213
|
columns: v.columns,
|
|
218
214
|
datasourceId: v.table2.datasourceId,
|
|
219
|
-
datasourceName: v.table2.datasourceName
|
|
220
|
-
datasourceType: v.table2.datasourceType
|
|
215
|
+
datasourceName: v.table2.datasourceName
|
|
221
216
|
});
|
|
222
217
|
}
|
|
223
218
|
return mo;
|
|
@@ -233,7 +228,6 @@ var JoinData = function JoinData(props) {
|
|
|
233
228
|
tableUuid: meta.table2.tableUuid || uuidv4('table'),
|
|
234
229
|
datasourceId: meta.table2.datasourceId,
|
|
235
230
|
datasourceName: meta.table2.datasourceName,
|
|
236
|
-
datasourceType: meta.table2.datasourceType,
|
|
237
231
|
columns: meta.columns
|
|
238
232
|
}]);
|
|
239
233
|
var newMeta = store.metaList[groupIndex].list.slice();
|
|
@@ -258,7 +252,6 @@ var JoinData = function JoinData(props) {
|
|
|
258
252
|
name_zh: prevGroupBy.alias,
|
|
259
253
|
datasourceId: '',
|
|
260
254
|
datasourceName: '',
|
|
261
|
-
datasourceType: '',
|
|
262
255
|
columns: []
|
|
263
256
|
};
|
|
264
257
|
if (prevGroupBy !== null && prevGroupBy !== void 0 && (_prevGroupBy$group2 = prevGroupBy.group) !== null && _prevGroupBy$group2 !== void 0 && _prevGroupBy$group2.length) {
|
|
@@ -303,7 +296,6 @@ var JoinData = function JoinData(props) {
|
|
|
303
296
|
tableUuid: v.table2.tableUuid || uuidv4('table'),
|
|
304
297
|
datasourceId: v.table2.datasourceId,
|
|
305
298
|
datasourceName: v.table2.datasourceName,
|
|
306
|
-
datasourceType: v.table2.datasourceType,
|
|
307
299
|
columns: v.columns || []
|
|
308
300
|
};
|
|
309
301
|
}));
|
|
@@ -319,8 +311,7 @@ var JoinData = function JoinData(props) {
|
|
|
319
311
|
tableUuid: v.table.tableUuid || uuidv4('table'),
|
|
320
312
|
columns: v.columns,
|
|
321
313
|
datasourceId: v.table.datasourceId,
|
|
322
|
-
datasourceName: v.table.datasourceName
|
|
323
|
-
datasourceType: v.table.datasourceType
|
|
314
|
+
datasourceName: v.table.datasourceName
|
|
324
315
|
}));
|
|
325
316
|
} else if (v.type === TypeEnum.joinData) {
|
|
326
317
|
mo.push({
|
|
@@ -331,8 +322,7 @@ var JoinData = function JoinData(props) {
|
|
|
331
322
|
tableUuid: v.table2.tableUuid || uuidv4('table'),
|
|
332
323
|
columns: v.columns,
|
|
333
324
|
datasourceId: v.table2.datasourceId,
|
|
334
|
-
datasourceName: v.table2.datasourceName
|
|
335
|
-
datasourceType: v.table2.datasourceType
|
|
325
|
+
datasourceName: v.table2.datasourceName
|
|
336
326
|
});
|
|
337
327
|
}
|
|
338
328
|
return mo;
|
|
@@ -346,7 +336,6 @@ var JoinData = function JoinData(props) {
|
|
|
346
336
|
tableUuid: meta.table2.tableUuid || uuidv4('table'),
|
|
347
337
|
datasourceId: meta.table2.datasourceId,
|
|
348
338
|
datasourceName: meta.table2.datasourceName,
|
|
349
|
-
datasourceType: meta.table2.datasourceType,
|
|
350
339
|
columns: meta.columns
|
|
351
340
|
}]);
|
|
352
341
|
return data;
|
|
@@ -391,8 +380,7 @@ var JoinData = function JoinData(props) {
|
|
|
391
380
|
name: prevGroupBy.alias,
|
|
392
381
|
name_zh: prevGroupBy.alias,
|
|
393
382
|
datasourceId: '',
|
|
394
|
-
datasourceName: ''
|
|
395
|
-
datasourceType: ''
|
|
383
|
+
datasourceName: ''
|
|
396
384
|
};
|
|
397
385
|
if (prevGroupBy !== null && prevGroupBy !== void 0 && (_prevGroupBy$group3 = prevGroupBy.group) !== null && _prevGroupBy$group3 !== void 0 && _prevGroupBy$group3.length) {}
|
|
398
386
|
if (prevGroupBy !== null && prevGroupBy !== void 0 && (_prevGroupBy$by3 = prevGroupBy.by) !== null && _prevGroupBy$by3 !== void 0 && _prevGroupBy$by3.length) {}
|
|
@@ -412,7 +400,6 @@ var JoinData = function JoinData(props) {
|
|
|
412
400
|
tableUuid: v.table2.tableUuid || uuidv4('table'),
|
|
413
401
|
datasourceId: v.table2.datasourceId,
|
|
414
402
|
datasourceName: v.table2.datasourceName,
|
|
415
|
-
datasourceType: v.table2.datasourceType,
|
|
416
403
|
columns: []
|
|
417
404
|
};
|
|
418
405
|
}));
|
|
@@ -428,8 +415,7 @@ var JoinData = function JoinData(props) {
|
|
|
428
415
|
tableUuid: v.table.tableUuid || uuidv4('table'),
|
|
429
416
|
columns: [],
|
|
430
417
|
datasourceId: v.table.datasourceId,
|
|
431
|
-
datasourceName: v.table.datasourceName
|
|
432
|
-
datasourceType: v.table.datasourceType
|
|
418
|
+
datasourceName: v.table.datasourceName
|
|
433
419
|
});
|
|
434
420
|
} else if (v.type === TypeEnum.joinData) {
|
|
435
421
|
mo.push({
|
|
@@ -440,8 +426,7 @@ var JoinData = function JoinData(props) {
|
|
|
440
426
|
tableUuid: v.table2.tableUuid || uuidv4('table'),
|
|
441
427
|
columns: [],
|
|
442
428
|
datasourceId: v.table2.datasourceId,
|
|
443
|
-
datasourceName: v.table2.datasourceName
|
|
444
|
-
datasourceType: v.table2.datasourceType
|
|
429
|
+
datasourceName: v.table2.datasourceName
|
|
445
430
|
});
|
|
446
431
|
}
|
|
447
432
|
return mo;
|
|
@@ -477,7 +462,6 @@ var JoinData = function JoinData(props) {
|
|
|
477
462
|
alias: meta.table2.alias,
|
|
478
463
|
datasourceId: meta.table2.datasourceId,
|
|
479
464
|
datasourceName: meta.table2.datasourceName,
|
|
480
|
-
datasourceType: meta.table2.datasourceType,
|
|
481
465
|
tableUuid: meta.table2.tableUuid || ''
|
|
482
466
|
};
|
|
483
467
|
!meta.readonly && store.setPopup({
|
|
@@ -488,25 +472,9 @@ var JoinData = function JoinData(props) {
|
|
|
488
472
|
tableFlat: store.tableFlat,
|
|
489
473
|
data: store.sourceList,
|
|
490
474
|
value: value,
|
|
491
|
-
onDatasourceTypeChange: function onDatasourceTypeChange(data) {
|
|
492
|
-
var newMeta = cloneDeep(store.metaList[groupIndex].list);
|
|
493
|
-
var joinMeta = newMeta[index];
|
|
494
|
-
joinMeta.table2 = _objectSpread(_objectSpread(_objectSpread({}, joinMeta.table2), data), {}, {
|
|
495
|
-
datasourceType: data.datasourceType
|
|
496
|
-
});
|
|
497
|
-
joinMeta.columns = joinMeta.columns.map(function (column) {
|
|
498
|
-
return _objectSpread(_objectSpread({}, column), {}, {
|
|
499
|
-
datasourceType: data.datasourceType
|
|
500
|
-
});
|
|
501
|
-
});
|
|
502
|
-
store.setMeta(newMeta, groupIndex, {
|
|
503
|
-
obj: data,
|
|
504
|
-
type: ChangeType.table2
|
|
505
|
-
});
|
|
506
|
-
},
|
|
507
475
|
onChange: function onChange(data) {
|
|
508
476
|
var tableName = data.name;
|
|
509
|
-
if (meta.table2
|
|
477
|
+
if (!isSameTableByIdFirst(meta.table2, data)) {
|
|
510
478
|
var _store$preProps;
|
|
511
479
|
var newMeta = cloneDeep(store.metaList[groupIndex].list);
|
|
512
480
|
var alias = getAlias(tableName, newMeta, ((_store$preProps = store.preProps) === null || _store$preProps === void 0 ? void 0 : _store$preProps.notExistsColumns) || []);
|
|
@@ -518,8 +486,7 @@ var JoinData = function JoinData(props) {
|
|
|
518
486
|
fieldUuid: '',
|
|
519
487
|
quotes: '',
|
|
520
488
|
datasourceId: data.datasourceId,
|
|
521
|
-
datasourceName: data.datasourceName
|
|
522
|
-
datasourceType: data.datasourceType
|
|
489
|
+
datasourceName: data.datasourceName
|
|
523
490
|
});
|
|
524
491
|
newMeta[index].table2 = _table2;
|
|
525
492
|
initExpressions(newMeta);
|
|
@@ -557,7 +524,6 @@ var JoinData = function JoinData(props) {
|
|
|
557
524
|
tableUuid: '',
|
|
558
525
|
datasourceName: '',
|
|
559
526
|
datasourceId: '',
|
|
560
|
-
datasourceType: '',
|
|
561
527
|
type: AtomsTypeEnum.FIELD
|
|
562
528
|
}],
|
|
563
529
|
condition: '',
|
|
@@ -574,7 +540,6 @@ var JoinData = function JoinData(props) {
|
|
|
574
540
|
tableUuid: '',
|
|
575
541
|
datasourceName: '',
|
|
576
542
|
datasourceId: '',
|
|
577
|
-
datasourceType: '',
|
|
578
543
|
type: AtomsTypeEnum.FIELD
|
|
579
544
|
}],
|
|
580
545
|
type: AtomsTypeEnum.JOIN_DEFAULT
|
|
@@ -619,7 +584,6 @@ var JoinData = function JoinData(props) {
|
|
|
619
584
|
alias: prevGroupBy.alias,
|
|
620
585
|
datasourceId: '',
|
|
621
586
|
datasourceName: '',
|
|
622
|
-
datasourceType: '',
|
|
623
587
|
columns: []
|
|
624
588
|
};
|
|
625
589
|
if (prevGroupBy !== null && prevGroupBy !== void 0 && (_prevGroupBy$group4 = prevGroupBy.group) !== null && _prevGroupBy$group4 !== void 0 && _prevGroupBy$group4.length) {
|
|
@@ -664,7 +628,6 @@ var JoinData = function JoinData(props) {
|
|
|
664
628
|
tableUuid: v.table2.tableUuid || uuidv4('table'),
|
|
665
629
|
datasourceId: v.table2.datasourceId,
|
|
666
630
|
datasourceName: v.table2.datasourceName,
|
|
667
|
-
datasourceType: v.table2.datasourceType,
|
|
668
631
|
columns: v.columns
|
|
669
632
|
};
|
|
670
633
|
}));
|
|
@@ -680,8 +643,7 @@ var JoinData = function JoinData(props) {
|
|
|
680
643
|
tableUuid: v.table.tableUuid || uuidv4('table'),
|
|
681
644
|
columns: v.columns,
|
|
682
645
|
datasourceId: v.table.datasourceId,
|
|
683
|
-
datasourceName: v.table.datasourceName
|
|
684
|
-
datasourceType: v.table.datasourceType
|
|
646
|
+
datasourceName: v.table.datasourceName
|
|
685
647
|
});
|
|
686
648
|
} else if (v.type === TypeEnum.joinData) {
|
|
687
649
|
mo.push({
|
|
@@ -692,8 +654,7 @@ var JoinData = function JoinData(props) {
|
|
|
692
654
|
tableUuid: v.table2.tableUuid || uuidv4('table'),
|
|
693
655
|
columns: v.columns,
|
|
694
656
|
datasourceId: v.table2.datasourceId,
|
|
695
|
-
datasourceName: v.table2.datasourceName
|
|
696
|
-
datasourceType: v.table2.datasourceType
|
|
657
|
+
datasourceName: v.table2.datasourceName
|
|
697
658
|
});
|
|
698
659
|
}
|
|
699
660
|
return mo;
|
|
@@ -714,7 +675,6 @@ var JoinData = function JoinData(props) {
|
|
|
714
675
|
tableUuid: meta.table2.tableUuid || uuidv4('table'),
|
|
715
676
|
datasourceId: meta.table2.datasourceId,
|
|
716
677
|
datasourceName: meta.table2.datasourceName,
|
|
717
|
-
datasourceType: meta.table2.datasourceType,
|
|
718
678
|
columns: meta.columns
|
|
719
679
|
}];
|
|
720
680
|
}
|
|
@@ -743,7 +703,6 @@ var JoinData = function JoinData(props) {
|
|
|
743
703
|
alias: prevGroupBy.alias,
|
|
744
704
|
datasourceId: '',
|
|
745
705
|
datasourceName: '',
|
|
746
|
-
datasourceType: '',
|
|
747
706
|
columns: []
|
|
748
707
|
};
|
|
749
708
|
if (prevGroupBy !== null && prevGroupBy !== void 0 && (_prevGroupBy$group5 = prevGroupBy.group) !== null && _prevGroupBy$group5 !== void 0 && _prevGroupBy$group5.length) {
|
|
@@ -788,7 +747,6 @@ var JoinData = function JoinData(props) {
|
|
|
788
747
|
tableUuid: v.table2.tableUuid || uuidv4('table'),
|
|
789
748
|
datasourceId: v.table2.datasourceId,
|
|
790
749
|
datasourceName: v.table2.datasourceName,
|
|
791
|
-
datasourceType: v.table2.datasourceType,
|
|
792
750
|
columns: v.columns
|
|
793
751
|
};
|
|
794
752
|
}));
|
|
@@ -804,8 +762,7 @@ var JoinData = function JoinData(props) {
|
|
|
804
762
|
tableUuid: v.table.tableUuid || uuidv4('table'),
|
|
805
763
|
columns: v.columns,
|
|
806
764
|
datasourceId: v.table.datasourceId,
|
|
807
|
-
datasourceName: v.table.datasourceName
|
|
808
|
-
datasourceType: v.table.datasourceType
|
|
765
|
+
datasourceName: v.table.datasourceName
|
|
809
766
|
});
|
|
810
767
|
} else if (v.type === TypeEnum.joinData) {
|
|
811
768
|
mo.push({
|
|
@@ -816,8 +773,7 @@ var JoinData = function JoinData(props) {
|
|
|
816
773
|
tableUuid: v.table2.tableUuid || uuidv4('table'),
|
|
817
774
|
columns: v.columns,
|
|
818
775
|
datasourceId: v.table2.datasourceId,
|
|
819
|
-
datasourceName: v.table2.datasourceName
|
|
820
|
-
datasourceType: v.table2.datasourceType
|
|
776
|
+
datasourceName: v.table2.datasourceName
|
|
821
777
|
});
|
|
822
778
|
}
|
|
823
779
|
return mo;
|
|
@@ -838,7 +794,6 @@ var JoinData = function JoinData(props) {
|
|
|
838
794
|
tableUuid: meta.table2.tableUuid || uuidv4('table'),
|
|
839
795
|
datasourceId: meta.table2.datasourceId,
|
|
840
796
|
datasourceName: meta.table2.datasourceName,
|
|
841
|
-
datasourceType: meta.table2.datasourceType,
|
|
842
797
|
columns: meta.columns
|
|
843
798
|
}];
|
|
844
799
|
}
|
|
@@ -867,7 +822,6 @@ var JoinData = function JoinData(props) {
|
|
|
867
822
|
tableUuid: '',
|
|
868
823
|
datasourceName: '',
|
|
869
824
|
datasourceId: '',
|
|
870
|
-
datasourceType: '',
|
|
871
825
|
type: AtomsTypeEnum.FIELD
|
|
872
826
|
}];
|
|
873
827
|
store.setMeta(newMeta, groupIndex, {
|
|
@@ -964,7 +918,6 @@ var JoinData = function JoinData(props) {
|
|
|
964
918
|
tableUuid: '',
|
|
965
919
|
datasourceName: '',
|
|
966
920
|
datasourceId: '',
|
|
967
|
-
datasourceType: '',
|
|
968
921
|
type: AtomsTypeEnum.FIELD
|
|
969
922
|
}];
|
|
970
923
|
}
|
|
@@ -1022,20 +975,23 @@ var JoinData = function JoinData(props) {
|
|
|
1022
975
|
});
|
|
1023
976
|
var items = getSubColumns(newList);
|
|
1024
977
|
var newColumns = items.flatMap(function (item) {
|
|
1025
|
-
return item.columns
|
|
978
|
+
return item.columns.map(function (column) {
|
|
979
|
+
return _objectSpread(_objectSpread({}, column), {}, {
|
|
980
|
+
tableId: column.tableId || column.id || item.id,
|
|
981
|
+
tableUuid: column.tableUuid || item.tableUuid,
|
|
982
|
+
datasourceId: column.datasourceId || item.datasourceId || ''
|
|
983
|
+
});
|
|
984
|
+
});
|
|
1026
985
|
}).map(function (v) {
|
|
1027
986
|
return _objectSpread(_objectSpread({}, v), {}, {
|
|
1028
987
|
select: false
|
|
1029
988
|
});
|
|
1030
989
|
});
|
|
1031
990
|
newMeta[index].columns = newColumns.map(function (newCol) {
|
|
1032
|
-
var _existingCol$select;
|
|
1033
991
|
var existingCol = newMeta[index].columns.find(function (oldCol) {
|
|
1034
|
-
return
|
|
1035
|
-
});
|
|
1036
|
-
var _column = _objectSpread(_objectSpread({}, newCol), {}, {
|
|
1037
|
-
select: (_existingCol$select = existingCol === null || existingCol === void 0 ? void 0 : existingCol.select) !== null && _existingCol$select !== void 0 ? _existingCol$select : newCol.select
|
|
992
|
+
return isSameColumnByIdFirst(oldCol, newCol);
|
|
1038
993
|
});
|
|
994
|
+
var _column = existingCol ? existingCol : newCol;
|
|
1039
995
|
_column.select = store.isSelectFields || _column.select;
|
|
1040
996
|
return _column;
|
|
1041
997
|
});
|
|
@@ -1155,7 +1111,6 @@ var JoinData = function JoinData(props) {
|
|
|
1155
1111
|
tableUuid: '',
|
|
1156
1112
|
datasourceName: '',
|
|
1157
1113
|
datasourceId: '',
|
|
1158
|
-
datasourceType: '',
|
|
1159
1114
|
type: AtomsTypeEnum.FIELD
|
|
1160
1115
|
}],
|
|
1161
1116
|
condition: '',
|
|
@@ -1172,7 +1127,6 @@ var JoinData = function JoinData(props) {
|
|
|
1172
1127
|
tableUuid: '',
|
|
1173
1128
|
datasourceName: '',
|
|
1174
1129
|
datasourceId: '',
|
|
1175
|
-
datasourceType: '',
|
|
1176
1130
|
type: AtomsTypeEnum.FIELD
|
|
1177
1131
|
}],
|
|
1178
1132
|
type: type
|
|
@@ -1296,11 +1250,11 @@ var JoinData = function JoinData(props) {
|
|
|
1296
1250
|
}
|
|
1297
1251
|
};
|
|
1298
1252
|
var tableIsError = function tableIsError() {
|
|
1299
|
-
var _store$preProps4, _meta$
|
|
1253
|
+
var _store$preProps4, _meta$table2;
|
|
1300
1254
|
var aliass = ((_store$preProps4 = store.preProps) === null || _store$preProps4 === void 0 || (_store$preProps4 = _store$preProps4.notExistsColumns) === null || _store$preProps4 === void 0 ? void 0 : _store$preProps4.map(function (v) {
|
|
1301
1255
|
return v.alias;
|
|
1302
1256
|
})) || [];
|
|
1303
|
-
var tableAlias = (_meta$
|
|
1257
|
+
var tableAlias = (_meta$table2 = meta.table2) === null || _meta$table2 === void 0 ? void 0 : _meta$table2.alias;
|
|
1304
1258
|
if (tableAlias && aliass.includes(tableAlias) || isDel) {
|
|
1305
1259
|
return true;
|
|
1306
1260
|
}
|
|
@@ -1383,15 +1337,15 @@ var JoinData = function JoinData(props) {
|
|
|
1383
1337
|
size: 'small',
|
|
1384
1338
|
onClick: function onClick(e) {
|
|
1385
1339
|
if (store.tableEnableAlias) {
|
|
1386
|
-
var _meta$
|
|
1340
|
+
var _meta$table3;
|
|
1387
1341
|
e.stopPropagation();
|
|
1388
|
-
onChangeTableAlias(((_meta$
|
|
1342
|
+
onChangeTableAlias(((_meta$table3 = meta.table2) === null || _meta$table3 === void 0 ? void 0 : _meta$table3.alias) || '');
|
|
1389
1343
|
}
|
|
1390
1344
|
}
|
|
1391
1345
|
})
|
|
1392
1346
|
}) : null;
|
|
1393
1347
|
}()
|
|
1394
|
-
}), subQuerySelected ? "".concat(((_meta$subquery2 = meta.subquery) === null || _meta$subquery2 === void 0 ? void 0 : _meta$subquery2[0]).table.datasourceName, ".").concat(((_meta$subquery3 = meta.subquery) === null || _meta$subquery3 === void 0 ? void 0 : _meta$subquery3[0]).table.name, " ").concat((_meta$
|
|
1348
|
+
}), subQuerySelected ? "".concat(((_meta$subquery2 = meta.subquery) === null || _meta$subquery2 === void 0 ? void 0 : _meta$subquery2[0]).table.datasourceName, ".").concat(((_meta$subquery3 = meta.subquery) === null || _meta$subquery3 === void 0 ? void 0 : _meta$subquery3[0]).table.name, " ").concat((_meta$table4 = meta.table2) !== null && _meta$table4 !== void 0 && _meta$table4.alias && store.tableEnableAlias ? "as ".concat((_meta$table5 = meta.table2) === null || _meta$table5 === void 0 ? void 0 : _meta$table5.alias) : '', " ") : __('SqlQueryBuilder.setSubQuery')]
|
|
1395
1349
|
}) : _jsxs("div", {
|
|
1396
1350
|
className: cx("Sqb-TableName", {
|
|
1397
1351
|
notSelected: !table2Selected
|
|
@@ -1421,15 +1375,15 @@ var JoinData = function JoinData(props) {
|
|
|
1421
1375
|
size: 'small',
|
|
1422
1376
|
onClick: function onClick(e) {
|
|
1423
1377
|
if (store.tableEnableAlias) {
|
|
1424
|
-
var _meta$
|
|
1378
|
+
var _meta$table6;
|
|
1425
1379
|
e.stopPropagation();
|
|
1426
|
-
onChangeTableAlias(((_meta$
|
|
1380
|
+
onChangeTableAlias(((_meta$table6 = meta.table2) === null || _meta$table6 === void 0 ? void 0 : _meta$table6.alias) || '');
|
|
1427
1381
|
}
|
|
1428
1382
|
}
|
|
1429
1383
|
})
|
|
1430
1384
|
}) : null;
|
|
1431
1385
|
}()
|
|
1432
|
-
}), table2Selected ? "".concat(meta.table2.datasourceName, ".").concat(meta.table2.name, " ").concat((_meta$
|
|
1386
|
+
}), table2Selected ? "".concat(meta.table2.datasourceName, ".").concat(meta.table2.name, " ").concat((_meta$table7 = meta.table2) !== null && _meta$table7 !== void 0 && _meta$table7.alias && store.tableEnableAlias ? "as ".concat((_meta$table8 = meta.table2) === null || _meta$table8 === void 0 ? void 0 : _meta$table8.alias) : '') : __('SqlQueryBuilder.pickTable')]
|
|
1433
1387
|
}), store.showSubquery && _jsx(Tooltip, {
|
|
1434
1388
|
title: __('SqlQueryBuilder.switchSubQuery'),
|
|
1435
1389
|
children: _jsx(Button, {
|
|
@@ -1440,7 +1394,7 @@ var JoinData = function JoinData(props) {
|
|
|
1440
1394
|
icon: _jsx(RelatedWork, {}),
|
|
1441
1395
|
onClick: switchSubQuery
|
|
1442
1396
|
})
|
|
1443
|
-
}), ((_meta$
|
|
1397
|
+
}), ((_meta$table9 = meta.table2) === null || _meta$table9 === void 0 ? void 0 : _meta$table9.name) && ((_meta$table0 = meta.table1) === null || _meta$table0 === void 0 ? void 0 : _meta$table0.name) && ((_meta$expressions = meta.expressions) === null || _meta$expressions === void 0 ? void 0 : _meta$expressions.map(function (v, i) {
|
|
1444
1398
|
if (v.type === AtomsTypeEnum.JOIN_DEFAULT) {
|
|
1445
1399
|
return _jsxs("div", {
|
|
1446
1400
|
className: cx("Sqb-where block"),
|
|
@@ -1667,7 +1621,7 @@ var JoinData = function JoinData(props) {
|
|
|
1667
1621
|
})]
|
|
1668
1622
|
}, i);
|
|
1669
1623
|
}
|
|
1670
|
-
})), ((_meta$
|
|
1624
|
+
})), ((_meta$table1 = meta.table2) === null || _meta$table1 === void 0 ? void 0 : _meta$table1.name) && ((_meta$table10 = meta.table1) === null || _meta$table10 === void 0 ? void 0 : _meta$table10.name) && (((_meta$expressions2 = meta.expressions) === null || _meta$expressions2 === void 0 ? void 0 : _meta$expressions2.length) || 0) < 1 && _jsx(Tooltip, {
|
|
1671
1625
|
title: __('SqlQueryBuilder.add'),
|
|
1672
1626
|
children: _jsx(Dropdown, {
|
|
1673
1627
|
trigger: ['click'],
|
|
@@ -10,7 +10,7 @@ import NextDom from './components/meta-icon';
|
|
|
10
10
|
import Header from './components/header';
|
|
11
11
|
import ItemWrapper from './components/item-wrapper';
|
|
12
12
|
import { useStore } from '../../hooks/use-provider';
|
|
13
|
-
import { uuidv4 } from '../../utils/helper';
|
|
13
|
+
import { isSameTableByIdFirst, uuidv4 } from '../../utils/helper';
|
|
14
14
|
import ItemName from './components/item-name';
|
|
15
15
|
import { SummarizeAlias } from '../../store/helper';
|
|
16
16
|
var PrevResult = 'Previous results';
|
|
@@ -35,8 +35,7 @@ var PermissionTable = function PermissionTable(props) {
|
|
|
35
35
|
tableUuid: uuidv4('table'),
|
|
36
36
|
alias: prevGroupBy.alias,
|
|
37
37
|
datasourceId: '',
|
|
38
|
-
datasourceName: ''
|
|
39
|
-
datasourceType: ''
|
|
38
|
+
datasourceName: ''
|
|
40
39
|
};
|
|
41
40
|
data = [_data];
|
|
42
41
|
var joinData = prevList.filter(function (v) {
|
|
@@ -53,8 +52,7 @@ var PermissionTable = function PermissionTable(props) {
|
|
|
53
52
|
tableUuid: v.table2.tableUuid,
|
|
54
53
|
id: v.table2.id,
|
|
55
54
|
datasourceId: v.table2.datasourceId,
|
|
56
|
-
datasourceName: v.table2.datasourceName
|
|
57
|
-
datasourceType: v.table2.datasourceType
|
|
55
|
+
datasourceName: v.table2.datasourceName
|
|
58
56
|
};
|
|
59
57
|
}));
|
|
60
58
|
}
|
|
@@ -68,8 +66,7 @@ var PermissionTable = function PermissionTable(props) {
|
|
|
68
66
|
id: v.table.id,
|
|
69
67
|
tableUuid: v.table.tableUuid,
|
|
70
68
|
datasourceId: v.table.datasourceId,
|
|
71
|
-
datasourceName: v.table.datasourceName
|
|
72
|
-
datasourceType: v.table.datasourceType
|
|
69
|
+
datasourceName: v.table.datasourceName
|
|
73
70
|
});
|
|
74
71
|
} else if (v.type === TypeEnum.joinData) {
|
|
75
72
|
mo.push({
|
|
@@ -79,8 +76,7 @@ var PermissionTable = function PermissionTable(props) {
|
|
|
79
76
|
id: v.table2.id,
|
|
80
77
|
tableUuid: v.table2.tableUuid,
|
|
81
78
|
datasourceId: v.table2.datasourceId,
|
|
82
|
-
datasourceName: v.table2.datasourceName
|
|
83
|
-
datasourceType: v.table2.datasourceType
|
|
79
|
+
datasourceName: v.table2.datasourceName
|
|
84
80
|
});
|
|
85
81
|
}
|
|
86
82
|
return mo;
|
|
@@ -94,7 +90,7 @@ var PermissionTable = function PermissionTable(props) {
|
|
|
94
90
|
data: data,
|
|
95
91
|
value: meta.table,
|
|
96
92
|
onChange: function onChange(data) {
|
|
97
|
-
if (meta.table
|
|
93
|
+
if (!isSameTableByIdFirst(meta.table, data)) {
|
|
98
94
|
meta.table = data;
|
|
99
95
|
}
|
|
100
96
|
store.setPopup({
|
|
@@ -83,8 +83,7 @@ var Sort = function Sort(props) {
|
|
|
83
83
|
id: v.table2.id,
|
|
84
84
|
columns: v.columns,
|
|
85
85
|
datasourceId: v.table2.datasourceId,
|
|
86
|
-
datasourceName: v.table2.datasourceName
|
|
87
|
-
datasourceType: v.table2.datasourceType
|
|
86
|
+
datasourceName: v.table2.datasourceName
|
|
88
87
|
};
|
|
89
88
|
} else {
|
|
90
89
|
return {
|
|
@@ -102,7 +102,6 @@ var GroupByEditor = function GroupByEditor(_ref) {
|
|
|
102
102
|
tableUuid: value.tableUuid || '',
|
|
103
103
|
datasourceName: value.datasourceName || '',
|
|
104
104
|
datasourceId: value.datasourceId || '',
|
|
105
|
-
datasourceType: value.datasourceType || '',
|
|
106
105
|
type: AtomsTypeEnum.FIELD
|
|
107
106
|
};
|
|
108
107
|
return [fieldAtom];
|
|
@@ -222,7 +221,6 @@ var GroupBy = function GroupBy(props) {
|
|
|
222
221
|
tableUuid: v.table2.tableUuid,
|
|
223
222
|
datasourceId: v.table2.datasourceId,
|
|
224
223
|
datasourceName: v.table2.datasourceName,
|
|
225
|
-
datasourceType: v.table2.datasourceType,
|
|
226
224
|
columns: v.columns
|
|
227
225
|
};
|
|
228
226
|
}));
|
|
@@ -238,7 +236,6 @@ var GroupBy = function GroupBy(props) {
|
|
|
238
236
|
tableUuid: v.table.tableUuid,
|
|
239
237
|
datasourceId: v.table.datasourceId,
|
|
240
238
|
datasourceName: v.table.datasourceName,
|
|
241
|
-
datasourceType: v.table.datasourceType,
|
|
242
239
|
columns: v.columns
|
|
243
240
|
};
|
|
244
241
|
} else if (v.type === TypeEnum.joinData) {
|
|
@@ -250,7 +247,6 @@ var GroupBy = function GroupBy(props) {
|
|
|
250
247
|
tableUuid: v.table2.tableUuid,
|
|
251
248
|
datasourceId: v.table2.datasourceId,
|
|
252
249
|
datasourceName: v.table2.datasourceName,
|
|
253
|
-
datasourceType: v.table2.datasourceType,
|
|
254
250
|
columns: v.columns
|
|
255
251
|
};
|
|
256
252
|
} else {
|
|
@@ -309,7 +305,6 @@ var GroupBy = function GroupBy(props) {
|
|
|
309
305
|
quotes: '',
|
|
310
306
|
datasourceId: '',
|
|
311
307
|
datasourceName: '',
|
|
312
|
-
datasourceType: '',
|
|
313
308
|
atoms: [],
|
|
314
309
|
summarizeType: MetaSummarize_Enum.BY
|
|
315
310
|
};
|
|
@@ -396,8 +391,7 @@ var GroupBy = function GroupBy(props) {
|
|
|
396
391
|
tableUuid: v.tableUuid,
|
|
397
392
|
alias: v.alias,
|
|
398
393
|
datasourceName: '',
|
|
399
|
-
datasourceId: ''
|
|
400
|
-
datasourceType: ''
|
|
394
|
+
datasourceId: ''
|
|
401
395
|
});
|
|
402
396
|
});
|
|
403
397
|
};
|
|
@@ -416,7 +410,6 @@ var GroupBy = function GroupBy(props) {
|
|
|
416
410
|
tableUuid: v.tableUuid,
|
|
417
411
|
datasourceName: '',
|
|
418
412
|
datasourceId: '',
|
|
419
|
-
datasourceType: '',
|
|
420
413
|
type: AtomsTypeEnum.FIELD
|
|
421
414
|
});
|
|
422
415
|
};
|
|
@@ -198,7 +198,6 @@ var SelectIndex = function SelectIndex(props) {
|
|
|
198
198
|
quotes: '',
|
|
199
199
|
datasourceId: '',
|
|
200
200
|
datasourceName: '',
|
|
201
|
-
datasourceType: '',
|
|
202
201
|
summarizeType: MetaSummarize_Enum.GROUP
|
|
203
202
|
};
|
|
204
203
|
store.setPopup2({
|
|
@@ -302,8 +301,7 @@ var SelectIndex = function SelectIndex(props) {
|
|
|
302
301
|
tableUuid: v.tableUuid,
|
|
303
302
|
alias: v.alias,
|
|
304
303
|
datasourceName: '',
|
|
305
|
-
datasourceId: ''
|
|
306
|
-
datasourceType: ''
|
|
304
|
+
datasourceId: ''
|
|
307
305
|
});
|
|
308
306
|
});
|
|
309
307
|
};
|
|
@@ -322,7 +320,6 @@ var SelectIndex = function SelectIndex(props) {
|
|
|
322
320
|
tableUuid: v.tableUuid,
|
|
323
321
|
datasourceName: '',
|
|
324
322
|
datasourceId: '',
|
|
325
|
-
datasourceType: '',
|
|
326
323
|
type: AtomsTypeEnum.FIELD
|
|
327
324
|
});
|
|
328
325
|
};
|