@gingkoo/pandora-metabase 1.0.143-alpha.0 → 1.0.143-alpha.2
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/select-permission-table/index.js +1 -1
- package/lib/cjs/components/dialog/select-table/index.js +2 -2
- package/lib/cjs/components/modules/join-data.js +2 -2
- package/lib/cjs/components/modules/permission-table.js +1 -1
- package/lib/cjs/components/modules/table-data.js +2 -2
- package/lib/cjs/utils/helper.d.ts +1 -0
- package/lib/cjs/utils/helper.js +13 -1
- package/lib/es/components/dialog/select-permission-table/index.js +2 -2
- package/lib/es/components/dialog/select-table/index.js +3 -3
- package/lib/es/components/modules/join-data.js +3 -3
- package/lib/es/components/modules/permission-table.js +2 -2
- package/lib/es/components/modules/table-data.js +3 -3
- package/lib/es/utils/helper.d.ts +1 -0
- package/lib/es/utils/helper.js +12 -0
- package/package.json +1 -1
|
@@ -351,7 +351,7 @@ var SelectTable = function SelectTable(_ref) {
|
|
|
351
351
|
})]
|
|
352
352
|
})
|
|
353
353
|
})
|
|
354
|
-
}, (0, _helper.
|
|
354
|
+
}, (0, _helper.getTableIdNameKey)(tableValue));
|
|
355
355
|
}))]
|
|
356
356
|
}, table.datasourceId);
|
|
357
357
|
})]
|
|
@@ -473,7 +473,7 @@ var SelectTable = function SelectTable(_ref) {
|
|
|
473
473
|
})]
|
|
474
474
|
})
|
|
475
475
|
})
|
|
476
|
-
}, (0, _helper.
|
|
476
|
+
}, (0, _helper.getTableIdNameKey)(tableValue));
|
|
477
477
|
})]
|
|
478
478
|
})]
|
|
479
479
|
})
|
|
@@ -112,7 +112,7 @@ var JoinData = function JoinData(props) {
|
|
|
112
112
|
case 2:
|
|
113
113
|
tables = _context.sent;
|
|
114
114
|
if (!(tables !== null && tables !== void 0 && tables.some(function (v) {
|
|
115
|
-
return (0, _helper.
|
|
115
|
+
return (0, _helper.isSameTableByIdName)(tableInfo, v);
|
|
116
116
|
}))) {
|
|
117
117
|
setIsDel(true);
|
|
118
118
|
} else {
|
|
@@ -501,7 +501,7 @@ var JoinData = function JoinData(props) {
|
|
|
501
501
|
value: value,
|
|
502
502
|
onChange: function onChange(data) {
|
|
503
503
|
var tableName = data.name;
|
|
504
|
-
if (!(0, _helper.
|
|
504
|
+
if (!(0, _helper.isSameTableByIdName)(meta.table2, data)) {
|
|
505
505
|
var _store$preProps;
|
|
506
506
|
var newMeta = (0, _cloneDeep["default"])(store.metaList[groupIndex].list);
|
|
507
507
|
var aliasMetaList = newMeta.filter(function (_, i) {
|
|
@@ -96,7 +96,7 @@ var PermissionTable = function PermissionTable(props) {
|
|
|
96
96
|
data: data,
|
|
97
97
|
value: meta.table,
|
|
98
98
|
onChange: function onChange(data) {
|
|
99
|
-
if (!(0, _helper.
|
|
99
|
+
if (!(0, _helper.isSameTableByIdName)(meta.table, data)) {
|
|
100
100
|
meta.table = data;
|
|
101
101
|
}
|
|
102
102
|
store.setPopup({
|
|
@@ -62,7 +62,7 @@ var TableData = function TableData(props) {
|
|
|
62
62
|
case 2:
|
|
63
63
|
tables = _context.sent;
|
|
64
64
|
if (!(tables !== null && tables !== void 0 && tables.some(function (v) {
|
|
65
|
-
return (0, _helper.
|
|
65
|
+
return (0, _helper.isSameTableByIdName)(tableInfo, v);
|
|
66
66
|
}))) {
|
|
67
67
|
setIsDel(true);
|
|
68
68
|
} else {
|
|
@@ -93,7 +93,7 @@ var TableData = function TableData(props) {
|
|
|
93
93
|
sourceTable: store.sourceTable || [],
|
|
94
94
|
value: meta.table,
|
|
95
95
|
onChange: function onChange(data) {
|
|
96
|
-
if (!(0, _helper.
|
|
96
|
+
if (!(0, _helper.isSameTableByIdName)(meta.table, data)) {
|
|
97
97
|
var _store$preProps;
|
|
98
98
|
var newMetaList = store.metaList[groupIndex].list.slice()[0];
|
|
99
99
|
newMetaList.table = (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, data), {}, {
|
|
@@ -2,6 +2,7 @@ import type { MetaListType } from '../store/types';
|
|
|
2
2
|
export declare const isSameTableByIdName: (left?: any, right?: any) => boolean;
|
|
3
3
|
export declare const isSameColumnByIdName: (left?: any, right?: any) => boolean;
|
|
4
4
|
export declare const getTableIdFirstKey: (table?: any) => string;
|
|
5
|
+
export declare const getTableIdNameKey: (table?: any) => string;
|
|
5
6
|
export declare const isSameTableByIdFirst: (left?: any, right?: any) => boolean;
|
|
6
7
|
export declare const getColumnIdFirstKey: (column?: any) => string;
|
|
7
8
|
export declare const isSameColumnByIdFirst: (left?: any, right?: any) => boolean;
|
package/lib/cjs/utils/helper.js
CHANGED
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.uuidv4 = exports.throttle = exports.sleep = exports.replaceTpl = exports.mobx2Object = exports.mergeNameAlias = exports.isSameTableByIdName = exports.isSameTableByIdFirst = exports.isSameColumnByIdName = exports.isSameColumnByIdFirst = exports.getUrlParams = exports.getTableIdFirstKey = exports.getScreenInfo = exports.getColumnIdFirstKey = exports.getAlias = exports.fullScreen = exports.flatArray = exports.exitFullscreen = exports.debounce = void 0;
|
|
7
|
+
exports.uuidv4 = exports.throttle = exports.sleep = exports.replaceTpl = exports.mobx2Object = exports.mergeNameAlias = exports.isSameTableByIdName = exports.isSameTableByIdFirst = exports.isSameColumnByIdName = exports.isSameColumnByIdFirst = exports.getUrlParams = exports.getTableIdNameKey = exports.getTableIdFirstKey = exports.getScreenInfo = exports.getColumnIdFirstKey = exports.getAlias = exports.fullScreen = exports.flatArray = exports.exitFullscreen = exports.debounce = void 0;
|
|
8
8
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/toConsumableArray"));
|
|
9
9
|
var _enum = require("../store/enum");
|
|
10
10
|
var normalizeId = function normalizeId(val) {
|
|
@@ -59,6 +59,18 @@ var getTableIdFirstKey = exports.getTableIdFirstKey = function getTableIdFirstKe
|
|
|
59
59
|
var tableAlias = normalizeId(table.alias || table.tableAlias);
|
|
60
60
|
return tableName ? "".concat(datasourceId, "|name:").concat(tableName, "|alias:").concat(tableAlias) : datasourceId;
|
|
61
61
|
};
|
|
62
|
+
var getTableIdNameKey = exports.getTableIdNameKey = function getTableIdNameKey() {
|
|
63
|
+
var table = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
64
|
+
var datasourceId = normalizeId(table.datasourceId);
|
|
65
|
+
var tableId = normalizeId(table.id || table.tableId);
|
|
66
|
+
var tableName = normalizeId(table.name || table.tableName || table.table);
|
|
67
|
+
var tableAlias = normalizeId(table.alias || table.tableAlias);
|
|
68
|
+
if (tableId || tableName) {
|
|
69
|
+
return "".concat(datasourceId, "|id:").concat(tableId, "|name:").concat(tableName, "|alias:").concat(tableAlias);
|
|
70
|
+
}
|
|
71
|
+
var tableUuid = normalizeId(table.tableUuid);
|
|
72
|
+
return tableUuid ? "".concat(datasourceId, "|uuid:").concat(tableUuid) : datasourceId;
|
|
73
|
+
};
|
|
62
74
|
var isSameTableByIdFirst = exports.isSameTableByIdFirst = function isSameTableByIdFirst() {
|
|
63
75
|
var left = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
64
76
|
var right = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
@@ -6,7 +6,7 @@ import cx from 'classnames';
|
|
|
6
6
|
import cloneDeep from 'lodash/cloneDeep';
|
|
7
7
|
import { __ } from '../../../locale';
|
|
8
8
|
import { TableIcon, SearchIcon } from '../../icons';
|
|
9
|
-
import {
|
|
9
|
+
import { getTableIdNameKey, isSameTableByIdName, mergeNameAlias } from '../../../utils/helper';
|
|
10
10
|
var PrevResult = 'Previous results';
|
|
11
11
|
var SelectPermissionTable = function SelectPermissionTable(_ref) {
|
|
12
12
|
var _ref$data = _ref.data,
|
|
@@ -78,7 +78,7 @@ var SelectPermissionTable = function SelectPermissionTable(_ref) {
|
|
|
78
78
|
})]
|
|
79
79
|
})
|
|
80
80
|
})
|
|
81
|
-
},
|
|
81
|
+
}, getTableIdNameKey(v));
|
|
82
82
|
})]
|
|
83
83
|
})
|
|
84
84
|
})
|
|
@@ -8,7 +8,7 @@ import './index.less';
|
|
|
8
8
|
import React, { useState, useEffect, useMemo, useRef } from 'react';
|
|
9
9
|
import cx from 'classnames';
|
|
10
10
|
import { Tag } from '@gingkoo/pandora';
|
|
11
|
-
import {
|
|
11
|
+
import { getTableIdNameKey, isSameTableByIdName, uuidv4 } from '../../../utils/helper';
|
|
12
12
|
import { useStore } from '../../../hooks/use-provider';
|
|
13
13
|
import Loading from '../../../common/Loading';
|
|
14
14
|
import { __ } from '../../../locale';
|
|
@@ -343,7 +343,7 @@ var SelectTable = function SelectTable(_ref) {
|
|
|
343
343
|
})]
|
|
344
344
|
})
|
|
345
345
|
})
|
|
346
|
-
},
|
|
346
|
+
}, getTableIdNameKey(tableValue));
|
|
347
347
|
}))]
|
|
348
348
|
}, table.datasourceId);
|
|
349
349
|
})]
|
|
@@ -465,7 +465,7 @@ var SelectTable = function SelectTable(_ref) {
|
|
|
465
465
|
})]
|
|
466
466
|
})
|
|
467
467
|
})
|
|
468
|
-
},
|
|
468
|
+
}, getTableIdNameKey(tableValue));
|
|
469
469
|
})]
|
|
470
470
|
})]
|
|
471
471
|
})
|
|
@@ -12,7 +12,7 @@ import { Button, Tooltip, Input, Modal2, Modal, Toast, Dropdown, InputNumber } f
|
|
|
12
12
|
import { FfPlus, FfLine, Repeat, RelatedWork } from '@gingkoo/pandora-icons';
|
|
13
13
|
import Metabase from '../../index';
|
|
14
14
|
import cloneDeep from 'lodash/cloneDeep';
|
|
15
|
-
import { uuidv4, getAlias, mergeNameAlias,
|
|
15
|
+
import { uuidv4, getAlias, mergeNameAlias, isSameTableByIdName } from '../../utils/helper';
|
|
16
16
|
import { getTopLayerZIndex } from '../../utils/helper-dom';
|
|
17
17
|
import { getConstantLabel } from '../dialog/formula-list/utils';
|
|
18
18
|
import { __ } from '../../locale';
|
|
@@ -107,7 +107,7 @@ var JoinData = function JoinData(props) {
|
|
|
107
107
|
case 2:
|
|
108
108
|
tables = _context.sent;
|
|
109
109
|
if (!(tables !== null && tables !== void 0 && tables.some(function (v) {
|
|
110
|
-
return
|
|
110
|
+
return isSameTableByIdName(tableInfo, v);
|
|
111
111
|
}))) {
|
|
112
112
|
setIsDel(true);
|
|
113
113
|
} else {
|
|
@@ -496,7 +496,7 @@ var JoinData = function JoinData(props) {
|
|
|
496
496
|
value: value,
|
|
497
497
|
onChange: function onChange(data) {
|
|
498
498
|
var tableName = data.name;
|
|
499
|
-
if (!
|
|
499
|
+
if (!isSameTableByIdName(meta.table2, data)) {
|
|
500
500
|
var _store$preProps;
|
|
501
501
|
var newMeta = cloneDeep(store.metaList[groupIndex].list);
|
|
502
502
|
var aliasMetaList = newMeta.filter(function (_, i) {
|
|
@@ -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 {
|
|
13
|
+
import { isSameTableByIdName, 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';
|
|
@@ -90,7 +90,7 @@ var PermissionTable = function PermissionTable(props) {
|
|
|
90
90
|
data: data,
|
|
91
91
|
value: meta.table,
|
|
92
92
|
onChange: function onChange(data) {
|
|
93
|
-
if (!
|
|
93
|
+
if (!isSameTableByIdName(meta.table, data)) {
|
|
94
94
|
meta.table = data;
|
|
95
95
|
}
|
|
96
96
|
store.setPopup({
|
|
@@ -12,7 +12,7 @@ import { __ } from '../../locale';
|
|
|
12
12
|
import { ChangeType } from '../../store/types';
|
|
13
13
|
import { Tooltip, Button, Modal, Modal2, Input, Toast } from '@gingkoo/pandora';
|
|
14
14
|
import Metabase from '../../index';
|
|
15
|
-
import { uuidv4, getAlias,
|
|
15
|
+
import { uuidv4, getAlias, isSameTableByIdName } from '../../utils/helper';
|
|
16
16
|
import { getTopLayerZIndex } from '../../utils/helper-dom';
|
|
17
17
|
import { changeTableAlias, getSubColumns, mergeSubQueryColumns, isValidSQLAlias, isExistsError, syncSubQueryFieldReferences } from '../../utils';
|
|
18
18
|
import { RelatedWork } from '@gingkoo/pandora-icons';
|
|
@@ -56,7 +56,7 @@ var TableData = function TableData(props) {
|
|
|
56
56
|
case 2:
|
|
57
57
|
tables = _context.sent;
|
|
58
58
|
if (!(tables !== null && tables !== void 0 && tables.some(function (v) {
|
|
59
|
-
return
|
|
59
|
+
return isSameTableByIdName(tableInfo, v);
|
|
60
60
|
}))) {
|
|
61
61
|
setIsDel(true);
|
|
62
62
|
} else {
|
|
@@ -87,7 +87,7 @@ var TableData = function TableData(props) {
|
|
|
87
87
|
sourceTable: store.sourceTable || [],
|
|
88
88
|
value: meta.table,
|
|
89
89
|
onChange: function onChange(data) {
|
|
90
|
-
if (!
|
|
90
|
+
if (!isSameTableByIdName(meta.table, data)) {
|
|
91
91
|
var _store$preProps;
|
|
92
92
|
var newMetaList = store.metaList[groupIndex].list.slice()[0];
|
|
93
93
|
newMetaList.table = _objectSpread(_objectSpread({}, data), {}, {
|
package/lib/es/utils/helper.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { MetaListType } from '../store/types';
|
|
|
2
2
|
export declare const isSameTableByIdName: (left?: any, right?: any) => boolean;
|
|
3
3
|
export declare const isSameColumnByIdName: (left?: any, right?: any) => boolean;
|
|
4
4
|
export declare const getTableIdFirstKey: (table?: any) => string;
|
|
5
|
+
export declare const getTableIdNameKey: (table?: any) => string;
|
|
5
6
|
export declare const isSameTableByIdFirst: (left?: any, right?: any) => boolean;
|
|
6
7
|
export declare const getColumnIdFirstKey: (column?: any) => string;
|
|
7
8
|
export declare const isSameColumnByIdFirst: (left?: any, right?: any) => boolean;
|
package/lib/es/utils/helper.js
CHANGED
|
@@ -52,6 +52,18 @@ export var getTableIdFirstKey = function getTableIdFirstKey() {
|
|
|
52
52
|
var tableAlias = normalizeId(table.alias || table.tableAlias);
|
|
53
53
|
return tableName ? "".concat(datasourceId, "|name:").concat(tableName, "|alias:").concat(tableAlias) : datasourceId;
|
|
54
54
|
};
|
|
55
|
+
export var getTableIdNameKey = function getTableIdNameKey() {
|
|
56
|
+
var table = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
57
|
+
var datasourceId = normalizeId(table.datasourceId);
|
|
58
|
+
var tableId = normalizeId(table.id || table.tableId);
|
|
59
|
+
var tableName = normalizeId(table.name || table.tableName || table.table);
|
|
60
|
+
var tableAlias = normalizeId(table.alias || table.tableAlias);
|
|
61
|
+
if (tableId || tableName) {
|
|
62
|
+
return "".concat(datasourceId, "|id:").concat(tableId, "|name:").concat(tableName, "|alias:").concat(tableAlias);
|
|
63
|
+
}
|
|
64
|
+
var tableUuid = normalizeId(table.tableUuid);
|
|
65
|
+
return tableUuid ? "".concat(datasourceId, "|uuid:").concat(tableUuid) : datasourceId;
|
|
66
|
+
};
|
|
55
67
|
export var isSameTableByIdFirst = function isSameTableByIdFirst() {
|
|
56
68
|
var left = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
57
69
|
var right = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|