@gingkoo/pandora-metabase 1.0.137 → 1.0.139-alpha.1
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 +2 -1
- package/lib/cjs/components/dialog/formula/index.js +1 -1
- package/lib/cjs/components/dialog/formula-list/CaseWhenGroup.js +2 -2
- package/lib/cjs/components/dialog/formula-list/index.js +2 -2
- package/lib/cjs/components/dialog/formula-list/index.less +108 -2
- package/lib/cjs/components/dialog/formula-list/utils.js +6 -0
- package/lib/cjs/components/dialog/select-column-multiple/index.js +79 -34
- package/lib/cjs/components/metabase/helper.less +36 -0
- package/lib/cjs/components/metabase/index.js +1 -1
- package/lib/cjs/components/modules/join-data.js +64 -65
- package/lib/cjs/hooks/use-state.js +1 -1
- package/lib/cjs/utils/helper.js +1 -5
- package/lib/cjs/utils.d.ts +1 -0
- package/lib/cjs/utils.js +114 -48
- package/lib/es/components/dialog/expression/index.js +2 -1
- package/lib/es/components/dialog/formula/index.js +1 -1
- package/lib/es/components/dialog/formula-list/CaseWhenGroup.js +2 -2
- package/lib/es/components/dialog/formula-list/index.js +2 -2
- package/lib/es/components/dialog/formula-list/index.less +108 -2
- package/lib/es/components/dialog/formula-list/utils.js +6 -0
- package/lib/es/components/dialog/select-column-multiple/index.js +80 -35
- package/lib/es/components/metabase/helper.less +36 -0
- package/lib/es/components/metabase/index.js +1 -1
- package/lib/es/components/modules/join-data.js +64 -65
- package/lib/es/hooks/use-state.js +1 -1
- package/lib/es/utils/helper.js +1 -5
- package/lib/es/utils.d.ts +1 -0
- package/lib/es/utils.js +114 -48
- package/package.json +1 -1
|
@@ -86,6 +86,7 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
|
|
|
86
86
|
_useState12 = (0, _slicedToArray2["default"])(_useState11, 2),
|
|
87
87
|
isNext = _useState12[0],
|
|
88
88
|
setIsNext = _useState12[1];
|
|
89
|
+
var showLeftFormula = Boolean(formula.type);
|
|
89
90
|
var setParentClosable = function setParentClosable(closable) {
|
|
90
91
|
if (parentPopupChannel === 'secondary') {
|
|
91
92
|
store.setClosable2(closable);
|
|
@@ -789,7 +790,7 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
|
|
|
789
790
|
className: 'span-name',
|
|
790
791
|
onClick: goPrevPage,
|
|
791
792
|
children: [(0, _jsxRuntime.jsx)(_icons.LeftArrowIcon, {}), getName(curColumn.lhs)]
|
|
792
|
-
}), leftFormula()]
|
|
793
|
+
}), showLeftFormula && leftFormula()]
|
|
793
794
|
}), (0, _jsxRuntime.jsxs)("div", {
|
|
794
795
|
className: 'right-info',
|
|
795
796
|
children: [filterCustomType && (0, _jsxRuntime.jsx)(_pandora.Dropdown, {
|
|
@@ -29,7 +29,7 @@ var _helperDom = require("../../../utils/helper-dom");
|
|
|
29
29
|
var _templateObject;
|
|
30
30
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
31
31
|
var VisualBox = _styledComponents["default"].div.attrs({
|
|
32
|
-
className: 'visual-box'
|
|
32
|
+
className: 'visual-box scroller'
|
|
33
33
|
})(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])([""])));
|
|
34
34
|
var CaseEditor = _react["default"].forwardRef(function (props, ref) {
|
|
35
35
|
var _store$formulaTemplat, _fun$args;
|
|
@@ -162,7 +162,7 @@ var CaseWhenGroup = function CaseWhenGroup(_ref) {
|
|
|
162
162
|
className: 'Sqb-CaseBranchIndex',
|
|
163
163
|
children: branchIndex + 1
|
|
164
164
|
}), (0, _jsxRuntime.jsx)("div", {
|
|
165
|
-
className: 'Sqb-CaseBranch-body',
|
|
165
|
+
className: 'Sqb-CaseBranch-body scroller-x',
|
|
166
166
|
children: renderBranchContent((0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
167
167
|
children: [(0, _jsxRuntime.jsxs)("div", {
|
|
168
168
|
className: 'Sqb-CaseSection Sqb-CaseSection-condition',
|
|
@@ -233,7 +233,7 @@ var CaseWhenGroup = function CaseWhenGroup(_ref) {
|
|
|
233
233
|
className: 'Sqb-CaseBranchIndex Sqb-CaseBranchIndex--else',
|
|
234
234
|
"aria-hidden": 'true'
|
|
235
235
|
}), (0, _jsxRuntime.jsx)("div", {
|
|
236
|
-
className: 'Sqb-CaseBranch-body',
|
|
236
|
+
className: 'Sqb-CaseBranch-body scroller-x',
|
|
237
237
|
children: renderBranchContent((0, _jsxRuntime.jsxs)("div", {
|
|
238
238
|
className: 'Sqb-CaseSection Sqb-CaseSection-result Sqb-CaseSection-else',
|
|
239
239
|
children: [(0, _jsxRuntime.jsx)("span", {
|
|
@@ -496,7 +496,7 @@ var FormulaList = (0, _react.forwardRef)(function (props, ref) {
|
|
|
496
496
|
children: (0, _jsxRuntime.jsxs)("div", {
|
|
497
497
|
className: 'Sqb-FormulaListZoomEditor',
|
|
498
498
|
children: [(0, _jsxRuntime.jsx)("div", {
|
|
499
|
-
className: 'Sqb-FormulaListZoomEditor-body',
|
|
499
|
+
className: 'Sqb-FormulaListZoomEditor-body scroller scroller-x',
|
|
500
500
|
children: (0, _jsxRuntime.jsx)("div", {
|
|
501
501
|
className: 'Sqb-NotebookCell Sqb-FormulaListZoomEditor-cell',
|
|
502
502
|
children: (0, _jsxRuntime.jsx)(_CaseWhenGroup["default"], {
|
|
@@ -658,7 +658,7 @@ var FormulaList = (0, _react.forwardRef)(function (props, ref) {
|
|
|
658
658
|
children: (0, _jsxRuntime.jsxs)("div", {
|
|
659
659
|
className: 'Sqb-FormulaListZoomEditor',
|
|
660
660
|
children: [(0, _jsxRuntime.jsx)("div", {
|
|
661
|
-
className: 'Sqb-FormulaListZoomEditor-body Sqb-FormulaListZoomEditor-body--formulaList',
|
|
661
|
+
className: 'Sqb-FormulaListZoomEditor-body Sqb-FormulaListZoomEditor-body--formulaList scroller scroller-x',
|
|
662
662
|
children: (0, _jsxRuntime.jsx)(FormulaList, {
|
|
663
663
|
ref: ref,
|
|
664
664
|
value: draftList,
|
|
@@ -1649,8 +1649,8 @@
|
|
|
1649
1649
|
width: 100%;
|
|
1650
1650
|
min-width: 100%;
|
|
1651
1651
|
box-sizing: border-box;
|
|
1652
|
-
padding
|
|
1653
|
-
padding
|
|
1652
|
+
padding: var(--sqb-item-shell-margin-x, 14px);
|
|
1653
|
+
// padding: var(--sqb-item-shell-margin-x, 14px);
|
|
1654
1654
|
}
|
|
1655
1655
|
|
|
1656
1656
|
.Sqb-FormulaListZoomEditor-body .Sqb-FormulaListZoomEditor-cell {
|
|
@@ -1736,6 +1736,14 @@
|
|
|
1736
1736
|
padding-bottom: 4px;
|
|
1737
1737
|
}
|
|
1738
1738
|
|
|
1739
|
+
.Sqb-FormulaListZoomEditor-body
|
|
1740
|
+
.Sqb-CaseWhenGroup:not(.Sqb-CaseWhenGroup--nested)
|
|
1741
|
+
> .Sqb-FormulaGroup-row
|
|
1742
|
+
> .Sqb-CaseBranch-body:has(.Sqb-CaseWhenGroup--nested) {
|
|
1743
|
+
overflow: visible;
|
|
1744
|
+
padding-bottom: 0;
|
|
1745
|
+
}
|
|
1746
|
+
|
|
1739
1747
|
.Sqb-FormulaListZoomEditor-body
|
|
1740
1748
|
.Sqb-CaseWhenGroup:not(.Sqb-CaseWhenGroup--nested)
|
|
1741
1749
|
> .Sqb-FormulaGroup-row
|
|
@@ -2162,3 +2170,101 @@
|
|
|
2162
2170
|
background: rgba(80, 158, 227, 0.88);
|
|
2163
2171
|
border-color: rgba(80, 158, 227, 0.88);
|
|
2164
2172
|
}
|
|
2173
|
+
|
|
2174
|
+
.Sqb-FormulaGroup.logic-group > .Sqb-LogicGroup-content:has(.Sqb-CaseWhenGroup--nested),
|
|
2175
|
+
.Sqb-FormulaGroup.logic-group
|
|
2176
|
+
> .Sqb-LogicGroup-content:has(.Sqb-CaseWhenGroup--nested)
|
|
2177
|
+
> .Sqb-NestedFormulaList,
|
|
2178
|
+
.Sqb-FormulaGroup.logic-group
|
|
2179
|
+
> .Sqb-LogicGroup-content:has(.Sqb-CaseWhenGroup--nested)
|
|
2180
|
+
> .Sqb-NestedFormulaList
|
|
2181
|
+
> .Sqb-NotebookCell,
|
|
2182
|
+
.Sqb-FormulaGroup.logic-group
|
|
2183
|
+
> .Sqb-LogicGroup-content:has(.Sqb-CaseWhenGroup--nested)
|
|
2184
|
+
> .Sqb-NestedFormulaList
|
|
2185
|
+
> .Sqb-NotebookCell.Sqb-NotebookCell--embedded,
|
|
2186
|
+
.Sqb-FormulaGroup.logic-group
|
|
2187
|
+
> .Sqb-LogicGroup-content:has(.Sqb-CaseWhenGroup--nested)
|
|
2188
|
+
> .Sqb-NestedFormulaList
|
|
2189
|
+
> .Sqb-NotebookCell.Sqb-NotebookCell--embedded
|
|
2190
|
+
> .Sqb-Filter-item.item-composite,
|
|
2191
|
+
.Sqb-FormulaGroup.logic-group
|
|
2192
|
+
> .Sqb-LogicGroup-content:has(.Sqb-CaseWhenGroup--nested)
|
|
2193
|
+
> .Sqb-NestedFormulaList
|
|
2194
|
+
> .Sqb-NotebookCell.Sqb-NotebookCell--embedded
|
|
2195
|
+
> .Sqb-Filter-item.item-composite
|
|
2196
|
+
> .Sqb-Filter-item-node,
|
|
2197
|
+
.Sqb-FormulaGroup.logic-group
|
|
2198
|
+
> .Sqb-LogicGroup-content:has(.Sqb-CaseWhenGroup--nested)
|
|
2199
|
+
.Sqb-CaseWhenGroup.Sqb-CaseWhenGroup--nested {
|
|
2200
|
+
min-width: 0;
|
|
2201
|
+
max-width: 100%;
|
|
2202
|
+
box-sizing: border-box;
|
|
2203
|
+
}
|
|
2204
|
+
|
|
2205
|
+
.Sqb-FormulaGroup.logic-group > .Sqb-LogicGroup-content:has(.Sqb-CaseWhenGroup--nested) {
|
|
2206
|
+
flex: 1 1 auto;
|
|
2207
|
+
}
|
|
2208
|
+
|
|
2209
|
+
.Sqb-FormulaGroup.logic-group
|
|
2210
|
+
> .Sqb-LogicGroup-content:has(.Sqb-CaseWhenGroup--nested)
|
|
2211
|
+
> .Sqb-NestedFormulaList,
|
|
2212
|
+
.Sqb-FormulaGroup.logic-group
|
|
2213
|
+
> .Sqb-LogicGroup-content:has(.Sqb-CaseWhenGroup--nested)
|
|
2214
|
+
> .Sqb-NestedFormulaList
|
|
2215
|
+
> .Sqb-NotebookCell,
|
|
2216
|
+
.Sqb-FormulaGroup.logic-group
|
|
2217
|
+
> .Sqb-LogicGroup-content:has(.Sqb-CaseWhenGroup--nested)
|
|
2218
|
+
> .Sqb-NestedFormulaList
|
|
2219
|
+
> .Sqb-NotebookCell.Sqb-NotebookCell--embedded,
|
|
2220
|
+
.Sqb-FormulaGroup.logic-group
|
|
2221
|
+
> .Sqb-LogicGroup-content:has(.Sqb-CaseWhenGroup--nested)
|
|
2222
|
+
> .Sqb-NestedFormulaList
|
|
2223
|
+
> .Sqb-NotebookCell.Sqb-NotebookCell--embedded
|
|
2224
|
+
> .Sqb-Filter-item.item-composite,
|
|
2225
|
+
.Sqb-FormulaGroup.logic-group
|
|
2226
|
+
> .Sqb-LogicGroup-content:has(.Sqb-CaseWhenGroup--nested)
|
|
2227
|
+
> .Sqb-NestedFormulaList
|
|
2228
|
+
> .Sqb-NotebookCell.Sqb-NotebookCell--embedded
|
|
2229
|
+
> .Sqb-Filter-item.item-composite
|
|
2230
|
+
> .Sqb-Filter-item-node,
|
|
2231
|
+
.Sqb-FormulaGroup.logic-group
|
|
2232
|
+
> .Sqb-LogicGroup-content:has(.Sqb-CaseWhenGroup--nested)
|
|
2233
|
+
.Sqb-CaseWhenGroup.Sqb-CaseWhenGroup--nested {
|
|
2234
|
+
flex: 1 1 auto;
|
|
2235
|
+
width: 100%;
|
|
2236
|
+
}
|
|
2237
|
+
|
|
2238
|
+
.Sqb-FormulaGroup.logic-group
|
|
2239
|
+
> .Sqb-LogicGroup-content:has(.Sqb-CaseWhenGroup--nested)
|
|
2240
|
+
.Sqb-CaseWhenGroup.Sqb-CaseWhenGroup--nested
|
|
2241
|
+
> .Sqb-FormulaGroup-row.row-when,
|
|
2242
|
+
.Sqb-FormulaGroup.logic-group
|
|
2243
|
+
> .Sqb-LogicGroup-content:has(.Sqb-CaseWhenGroup--nested)
|
|
2244
|
+
.Sqb-CaseWhenGroup.Sqb-CaseWhenGroup--nested
|
|
2245
|
+
> .Sqb-FormulaGroup-row.row-else {
|
|
2246
|
+
grid-template-columns:
|
|
2247
|
+
var(--sqb-case-index-column) minmax(0, 1fr)
|
|
2248
|
+
var(--sqb-case-action-column);
|
|
2249
|
+
width: 100%;
|
|
2250
|
+
min-width: 0;
|
|
2251
|
+
max-width: 100%;
|
|
2252
|
+
}
|
|
2253
|
+
|
|
2254
|
+
.Sqb-FormulaGroup.logic-group
|
|
2255
|
+
> .Sqb-LogicGroup-content:has(.Sqb-CaseWhenGroup--nested)
|
|
2256
|
+
.Sqb-CaseWhenGroup.Sqb-CaseWhenGroup--nested
|
|
2257
|
+
> .Sqb-FormulaGroup-row.row-when
|
|
2258
|
+
> .Sqb-CaseBranch-body,
|
|
2259
|
+
.Sqb-FormulaGroup.logic-group
|
|
2260
|
+
> .Sqb-LogicGroup-content:has(.Sqb-CaseWhenGroup--nested)
|
|
2261
|
+
.Sqb-CaseWhenGroup.Sqb-CaseWhenGroup--nested
|
|
2262
|
+
> .Sqb-FormulaGroup-row.row-else
|
|
2263
|
+
> .Sqb-CaseBranch-body {
|
|
2264
|
+
width: 100%;
|
|
2265
|
+
min-width: 0;
|
|
2266
|
+
max-width: 100%;
|
|
2267
|
+
overflow-x: auto;
|
|
2268
|
+
overflow-y: hidden;
|
|
2269
|
+
padding-bottom: 4px;
|
|
2270
|
+
}
|
|
@@ -108,6 +108,12 @@ var customTypes = exports.customTypes = [{
|
|
|
108
108
|
}, {
|
|
109
109
|
value: _types.AtomsTypeEnum.EXPRESSION,
|
|
110
110
|
label: (0, _locale.__)('customColumn.expression')
|
|
111
|
+
}, {
|
|
112
|
+
value: _types.AtomsTypeEnum.CASE_WHEN,
|
|
113
|
+
label: (0, _locale.__)('customColumn.caseWhen')
|
|
114
|
+
}, {
|
|
115
|
+
value: _types.AtomsTypeEnum.AND_OR,
|
|
116
|
+
label: (0, _locale.__)('customColumn.andOr')
|
|
111
117
|
}, {
|
|
112
118
|
value: _types.AtomsTypeEnum.INPUT_STRING,
|
|
113
119
|
label: (0, _locale.__)('customColumn.input')
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports["default"] = exports.NUMBER_GROUP_MAP = exports.DATE_GROUP_MAP = void 0;
|
|
8
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/toConsumableArray"));
|
|
8
9
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
|
|
9
10
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
|
|
10
11
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
@@ -95,32 +96,74 @@ var SelectJoinColumn = function SelectJoinColumn(_ref) {
|
|
|
95
96
|
setCurTable(selectedTableUuid);
|
|
96
97
|
}
|
|
97
98
|
}, [_value]);
|
|
98
|
-
var
|
|
99
|
-
|
|
99
|
+
var normalizeIdentityValue = function normalizeIdentityValue(val) {
|
|
100
|
+
if (val === undefined || val === null) return '';
|
|
101
|
+
return "".concat(val);
|
|
100
102
|
};
|
|
101
|
-
var
|
|
102
|
-
|
|
103
|
-
|
|
103
|
+
var isSourceLikeDatasource = function isSourceLikeDatasource(datasourceId) {
|
|
104
|
+
var normalizedDatasourceId = normalizeIdentityValue(datasourceId);
|
|
105
|
+
return !normalizedDatasourceId || normalizedDatasourceId === _helper.SummarizeAlias;
|
|
106
|
+
};
|
|
107
|
+
var getFieldTableKey = function getFieldTableKey(tableId, tableUuid, tableAlias, datasourceId) {
|
|
108
|
+
var normalizedTableId = normalizeIdentityValue(tableId);
|
|
109
|
+
var normalizedTableAlias = normalizeIdentityValue(tableAlias);
|
|
110
|
+
var normalizedTableUuid = normalizeIdentityValue(tableUuid);
|
|
111
|
+
var normalizedDatasourceId = normalizeIdentityValue(datasourceId);
|
|
112
|
+
var datasourceKey = isSourceLikeDatasource(normalizedDatasourceId) ? '' : normalizedDatasourceId;
|
|
113
|
+
if (normalizedTableId) {
|
|
114
|
+
return "".concat(datasourceKey, "|id:").concat(normalizedTableId, "|alias:").concat(normalizedTableAlias);
|
|
104
115
|
}
|
|
105
|
-
if (
|
|
106
|
-
return
|
|
116
|
+
if (normalizedTableUuid) {
|
|
117
|
+
return "".concat(datasourceKey, "|uuid:").concat(normalizedTableUuid);
|
|
107
118
|
}
|
|
108
|
-
return
|
|
119
|
+
return datasourceKey;
|
|
109
120
|
};
|
|
110
|
-
var
|
|
111
|
-
if (!
|
|
112
|
-
var
|
|
113
|
-
var
|
|
114
|
-
|
|
121
|
+
var isSameSelectedTable = function isSameSelectedTable(field, tableItem) {
|
|
122
|
+
if (!tableItem) return false;
|
|
123
|
+
var fieldDatasourceId = normalizeIdentityValue(field.datasourceId);
|
|
124
|
+
var tableDatasourceId = normalizeIdentityValue(tableItem.datasourceId);
|
|
125
|
+
if (fieldDatasourceId && tableDatasourceId && !isSourceLikeDatasource(fieldDatasourceId) && !isSourceLikeDatasource(tableDatasourceId) && fieldDatasourceId !== tableDatasourceId) {
|
|
126
|
+
return false;
|
|
127
|
+
}
|
|
128
|
+
var fieldTableId = normalizeIdentityValue(field.tableId);
|
|
129
|
+
var tableId = normalizeIdentityValue(tableItem.id);
|
|
130
|
+
if (fieldTableId && tableId) {
|
|
131
|
+
if (fieldTableId !== tableId) return false;
|
|
132
|
+
var fieldTableAlias = normalizeIdentityValue(field.tableAlias);
|
|
133
|
+
var tableAlias = normalizeIdentityValue(tableItem.alias);
|
|
134
|
+
if (fieldTableAlias && tableAlias) {
|
|
135
|
+
return fieldTableAlias === tableAlias;
|
|
136
|
+
}
|
|
137
|
+
return true;
|
|
138
|
+
}
|
|
139
|
+
var fieldTableUuid = normalizeIdentityValue(field.tableUuid);
|
|
140
|
+
var tableUuid = normalizeIdentityValue(tableItem.tableUuid);
|
|
141
|
+
return Boolean(fieldTableUuid && tableUuid && fieldTableUuid === tableUuid);
|
|
115
142
|
};
|
|
116
|
-
var
|
|
117
|
-
var
|
|
118
|
-
|
|
119
|
-
return
|
|
143
|
+
var getFieldStableValues = function getFieldStableValues(field) {
|
|
144
|
+
var includeAlias = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
145
|
+
if (!field) return [];
|
|
146
|
+
return [field.fieldId, field.id, field.fieldName].concat((0, _toConsumableArray2["default"])(includeAlias ? [field.fieldAlias] : [])).map(normalizeIdentityValue).filter(Boolean);
|
|
147
|
+
};
|
|
148
|
+
var getColumnStableValues = function getColumnStableValues(column) {
|
|
149
|
+
var includeAlias = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
150
|
+
if (!column) return [];
|
|
151
|
+
return [column.id, column.fieldId, column.fieldName, column.name, column.realName].concat((0, _toConsumableArray2["default"])(includeAlias ? [column.fieldAlias] : [])).map(normalizeIdentityValue).filter(Boolean);
|
|
152
|
+
};
|
|
153
|
+
var isSameSelectedField = function isSameSelectedField(field, column) {
|
|
154
|
+
var includeAlias = Boolean(column.summarizeType);
|
|
155
|
+
var fieldValues = getFieldStableValues(field, includeAlias);
|
|
156
|
+
var columnValues = getColumnStableValues(column, includeAlias);
|
|
157
|
+
if (fieldValues.some(function (value) {
|
|
158
|
+
return columnValues.includes(value);
|
|
159
|
+
})) {
|
|
160
|
+
return true;
|
|
161
|
+
}
|
|
162
|
+
return Boolean(field.fieldUuid && column.fieldUuid && field.fieldUuid === column.fieldUuid);
|
|
120
163
|
};
|
|
121
|
-
var isActive = function isActive(
|
|
164
|
+
var isActive = function isActive(column, tableItem) {
|
|
122
165
|
return (value === null || value === void 0 ? void 0 : value.filter(function (v) {
|
|
123
|
-
return isSameSelectedTable(v,
|
|
166
|
+
return isSameSelectedTable(v, tableItem) && isSameSelectedField(v, column);
|
|
124
167
|
}).length) > 0;
|
|
125
168
|
};
|
|
126
169
|
(0, _react.useEffect)(function () {
|
|
@@ -174,14 +217,8 @@ var SelectJoinColumn = function SelectJoinColumn(_ref) {
|
|
|
174
217
|
};
|
|
175
218
|
var getMatchedColumnByField = function getMatchedColumnByField(field, tableItem) {
|
|
176
219
|
if (!tableItem) return null;
|
|
177
|
-
var tableId = tableItem.id || '';
|
|
178
|
-
var tableUuid = tableItem.tableUuid || '';
|
|
179
220
|
return (tableItem.columns || []).find(function (column) {
|
|
180
|
-
return (
|
|
181
|
-
tableId: tableId,
|
|
182
|
-
tableUuid: tableUuid,
|
|
183
|
-
datasourceId: tableItem.datasourceId || ''
|
|
184
|
-
}), field);
|
|
221
|
+
return isSameSelectedField(field, column);
|
|
185
222
|
}) || null;
|
|
186
223
|
};
|
|
187
224
|
var syncSelectedFieldByColumn = function syncSelectedFieldByColumn(field, column, tableItem) {
|
|
@@ -206,7 +243,7 @@ var SelectJoinColumn = function SelectJoinColumn(_ref) {
|
|
|
206
243
|
(0, _react.useEffect)(function () {
|
|
207
244
|
var syncedValue = (_value || []).map(function (field) {
|
|
208
245
|
var tableItem = data.find(function (item) {
|
|
209
|
-
return isSameSelectedTable(field, item
|
|
246
|
+
return isSameSelectedTable(field, item);
|
|
210
247
|
});
|
|
211
248
|
var matchedColumn = getMatchedColumnByField(field, tableItem);
|
|
212
249
|
return matchedColumn ? syncSelectedFieldByColumn(field, matchedColumn, tableItem) : field;
|
|
@@ -226,7 +263,12 @@ var SelectJoinColumn = function SelectJoinColumn(_ref) {
|
|
|
226
263
|
return;
|
|
227
264
|
}
|
|
228
265
|
var isHas = (value === null || value === void 0 ? void 0 : value.filter(function (v) {
|
|
229
|
-
return val && isSameSelectedTable(v,
|
|
266
|
+
return val && isSameSelectedTable(v, {
|
|
267
|
+
id: val.tableId,
|
|
268
|
+
tableUuid: val.tableUuid,
|
|
269
|
+
alias: val.tableAlias,
|
|
270
|
+
datasourceId: val.datasourceId
|
|
271
|
+
}) && isSameSelectedField(v, val);
|
|
230
272
|
}).length) > 0;
|
|
231
273
|
var _value = value.slice();
|
|
232
274
|
if (tableUuid != selectedTable) {
|
|
@@ -234,22 +276,26 @@ var SelectJoinColumn = function SelectJoinColumn(_ref) {
|
|
|
234
276
|
}
|
|
235
277
|
if (!isHas && val) {
|
|
236
278
|
_value = _value.filter(function (v) {
|
|
237
|
-
var hasTableKey = getFieldTableKey(v.tableId, v.tableUuid);
|
|
279
|
+
var hasTableKey = getFieldTableKey(v.tableId, v.tableUuid, v.tableAlias, v.datasourceId);
|
|
238
280
|
var isLegacySameField = !hasTableKey && (v.fieldId && v.fieldId === val.fieldId || v.fieldName && v.fieldName === val.fieldName);
|
|
239
281
|
return !isLegacySameField;
|
|
240
282
|
});
|
|
241
283
|
_value.push(val);
|
|
242
284
|
} else {
|
|
243
285
|
_value = _value.filter(function (v) {
|
|
244
|
-
return !(val && isSameSelectedTable(v,
|
|
286
|
+
return !(val && isSameSelectedTable(v, {
|
|
287
|
+
id: val.tableId,
|
|
288
|
+
tableUuid: val.tableUuid,
|
|
289
|
+
alias: val.tableAlias,
|
|
290
|
+
datasourceId: val.datasourceId
|
|
291
|
+
}) && isSameSelectedField(v, val));
|
|
245
292
|
});
|
|
246
293
|
}
|
|
247
294
|
var curTableItem = data.find(function (v) {
|
|
248
295
|
return v.tableUuid === tableUuid;
|
|
249
296
|
});
|
|
250
|
-
var curTableId = (curTableItem === null || curTableItem === void 0 ? void 0 : curTableItem.id) || '';
|
|
251
297
|
_value = _value.map(function (item2) {
|
|
252
|
-
if (!isSameSelectedTable(item2,
|
|
298
|
+
if (!isSameSelectedTable(item2, curTableItem)) return null;
|
|
253
299
|
var matchedColumn = getMatchedColumnByField(item2, curTableItem);
|
|
254
300
|
return matchedColumn ? syncSelectedFieldByColumn(item2, matchedColumn, curTableItem) : null;
|
|
255
301
|
}).filter(Boolean);
|
|
@@ -400,7 +446,6 @@ var SelectJoinColumn = function SelectJoinColumn(_ref) {
|
|
|
400
446
|
_v$database_type = v.database_type,
|
|
401
447
|
database_type = _v$database_type === void 0 ? '' : _v$database_type,
|
|
402
448
|
name = v.name;
|
|
403
|
-
var columnKey = getColumnKey(v, isSummarize, tableId || '', tableUuid);
|
|
404
449
|
var fieldAlias = isSummarize ? v.fieldAlias || name || '' : v.fieldAlias || '';
|
|
405
450
|
var fieldName = name || '';
|
|
406
451
|
var fieldId = v.id || '';
|
|
@@ -416,7 +461,7 @@ var SelectJoinColumn = function SelectJoinColumn(_ref) {
|
|
|
416
461
|
className: (0, _classnames["default"])("Sqb-List-section"),
|
|
417
462
|
children: (0, _jsxRuntime.jsx)("div", {
|
|
418
463
|
className: (0, _classnames["default"])("Sqb-List-item mx-2", {
|
|
419
|
-
active: isActive(
|
|
464
|
+
active: isActive(v, tableItem)
|
|
420
465
|
}),
|
|
421
466
|
onClick: function onClick() {
|
|
422
467
|
changeValue(tableUuid, {
|
|
@@ -1,3 +1,39 @@
|
|
|
1
|
+
.scroller::-webkit-scrollbar {
|
|
2
|
+
width: 4px;
|
|
3
|
+
height: 100%;
|
|
4
|
+
background: transparent;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.scroller::-webkit-scrollbar-thumb {
|
|
8
|
+
background: rgba(100, 100, 100, 0.4);
|
|
9
|
+
border-radius: 2px;
|
|
10
|
+
|
|
11
|
+
&:hover {
|
|
12
|
+
background: rgba(100, 100, 100, 0.7);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.scroller-x::-webkit-scrollbar {
|
|
17
|
+
width: 100%;
|
|
18
|
+
height: 8px;
|
|
19
|
+
background: transparent;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.scroller.scroller-x::-webkit-scrollbar {
|
|
23
|
+
width: 4px;
|
|
24
|
+
height: 8px;
|
|
25
|
+
background: transparent;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.scroller-x::-webkit-scrollbar-thumb {
|
|
29
|
+
background: rgba(100, 100, 100, 0.4);
|
|
30
|
+
border-radius: 2px;
|
|
31
|
+
|
|
32
|
+
&:hover {
|
|
33
|
+
background: rgba(100, 100, 100, 0.7);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
1
37
|
.mx-4 {
|
|
2
38
|
margin-left: 1rem;
|
|
3
39
|
margin-right: 1rem;
|
|
@@ -24,7 +24,7 @@ var _useProvider = require("../../hooks/use-provider");
|
|
|
24
24
|
var _storage = _interopRequireDefault(require("../../utils/storage"));
|
|
25
25
|
var _templateObject;
|
|
26
26
|
var VisualBox = _styledComponents["default"].div.attrs({
|
|
27
|
-
className: 'visual-box'
|
|
27
|
+
className: 'visual-box scroller'
|
|
28
28
|
})(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])([""])));
|
|
29
29
|
var Metabase = function Metabase(props) {
|
|
30
30
|
var _props$btnText = props.btnText,
|