@gingkoo/pandora-metabase 1.0.96 → 1.0.98
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/hooks/patch.js +32 -9
- package/lib/es/hooks/patch.js +32 -9
- package/package.json +1 -1
package/lib/cjs/hooks/patch.js
CHANGED
|
@@ -8,7 +8,7 @@ exports.patchMetas = exports.joinDataPatch = exports.filterPatch = exports.custo
|
|
|
8
8
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
|
|
9
9
|
var _enum = require("../store/enum");
|
|
10
10
|
var setConstantId = function setConstantId(item, constantList) {
|
|
11
|
-
constantList.map(function (v) {
|
|
11
|
+
constantList === null || constantList === void 0 || constantList.map(function (v) {
|
|
12
12
|
if (v.label === item.val) {
|
|
13
13
|
item.id = v.value;
|
|
14
14
|
}
|
|
@@ -26,13 +26,14 @@ var setFormulaId = function setFormulaId(item, formulaTemplates) {
|
|
|
26
26
|
var joinDataPatch = exports.joinDataPatch = function joinDataPatch(newMeta, constantList, formulaTemplates) {
|
|
27
27
|
var _newMeta$expressions;
|
|
28
28
|
newMeta.expressions = (_newMeta$expressions = newMeta.expressions) === null || _newMeta$expressions === void 0 ? void 0 : _newMeta$expressions.map(function (v, i) {
|
|
29
|
-
|
|
29
|
+
var _v$lhs, _v$rhs;
|
|
30
|
+
v.lhs = (_v$lhs = v.lhs) === null || _v$lhs === void 0 ? void 0 : _v$lhs.map(function (vv) {
|
|
30
31
|
if (vv.type === 'constant' && !vv.id) {
|
|
31
32
|
return setConstantId(vv, constantList);
|
|
32
33
|
}
|
|
33
34
|
return vv;
|
|
34
35
|
});
|
|
35
|
-
v.rhs = v.rhs.map(function (vv) {
|
|
36
|
+
v.rhs = (_v$rhs = v.rhs) === null || _v$rhs === void 0 ? void 0 : _v$rhs.map(function (vv) {
|
|
36
37
|
if (vv.type === 'constant' && !vv.id) {
|
|
37
38
|
return setConstantId(vv, constantList);
|
|
38
39
|
}
|
|
@@ -50,15 +51,35 @@ var filterPatch = exports.filterPatch = function filterPatch(newMeta, constantLi
|
|
|
50
51
|
return setConstantId(v, constantList);
|
|
51
52
|
}
|
|
52
53
|
if (v.type === 'expression') {
|
|
53
|
-
|
|
54
|
+
var _v$rhs2;
|
|
55
|
+
v.rhs = (_v$rhs2 = v.rhs) === null || _v$rhs2 === void 0 ? void 0 : _v$rhs2.map(function (item) {
|
|
54
56
|
if (item.type === 'constant' && !item.id) {
|
|
55
57
|
return setConstantId(item, constantList);
|
|
56
58
|
}
|
|
57
59
|
return item;
|
|
58
60
|
});
|
|
59
61
|
}
|
|
60
|
-
if (v.type === 'FORMULA'
|
|
61
|
-
|
|
62
|
+
if (v.type === 'FORMULA') {
|
|
63
|
+
var _v$args;
|
|
64
|
+
var _v = v;
|
|
65
|
+
if (!_v.id) {
|
|
66
|
+
_v = setFormulaId(v, formulaTemplates);
|
|
67
|
+
}
|
|
68
|
+
(_v$args = _v.args) === null || _v$args === void 0 || _v$args.map(function (arg) {
|
|
69
|
+
var _arg$list;
|
|
70
|
+
arg.list = (_arg$list = arg.list) === null || _arg$list === void 0 ? void 0 : _arg$list.map(function (argItem) {
|
|
71
|
+
if (argItem.type === 'constant' && !argItem.id) {
|
|
72
|
+
return setConstantId(argItem, constantList);
|
|
73
|
+
}
|
|
74
|
+
if (argItem.type === 'FORMULA' && !argItem.id) {
|
|
75
|
+
return setFormulaId(argItem, formulaTemplates);
|
|
76
|
+
}
|
|
77
|
+
return argItem;
|
|
78
|
+
});
|
|
79
|
+
return arg;
|
|
80
|
+
});
|
|
81
|
+
return _v;
|
|
82
|
+
// return setFormulaId(v, formulaTemplates);
|
|
62
83
|
}
|
|
63
84
|
if (v.type === 'exists' || v.type === 'notExists') {
|
|
64
85
|
v.notExists = _patchMetas(v.notExists, constantList, formulaTemplates);
|
|
@@ -72,15 +93,17 @@ var filterPatch = exports.filterPatch = function filterPatch(newMeta, constantLi
|
|
|
72
93
|
var customColumnPatch = exports.customColumnPatch = function customColumnPatch(newMeta, constantList, formulaTemplates) {
|
|
73
94
|
var _newMeta$customColumn;
|
|
74
95
|
newMeta.customColumn = (newMeta === null || newMeta === void 0 || (_newMeta$customColumn = newMeta.customColumn) === null || _newMeta$customColumn === void 0 ? void 0 : _newMeta$customColumn.map(function (v) {
|
|
75
|
-
var
|
|
96
|
+
var _v$formulaList;
|
|
97
|
+
var _formulaList = (_v$formulaList = v.formulaList) === null || _v$formulaList === void 0 ? void 0 : _v$formulaList.map(function (formula) {
|
|
76
98
|
if (formula.type === 'expression') {
|
|
77
|
-
|
|
99
|
+
var _formula$lhs, _formula$rhs;
|
|
100
|
+
formula.lhs = (_formula$lhs = formula.lhs) === null || _formula$lhs === void 0 ? void 0 : _formula$lhs.map(function (vv) {
|
|
78
101
|
if (vv.type === 'constant' && !vv.id) {
|
|
79
102
|
return setConstantId(vv, constantList);
|
|
80
103
|
}
|
|
81
104
|
return vv;
|
|
82
105
|
});
|
|
83
|
-
formula.rhs = formula.rhs.map(function (vv) {
|
|
106
|
+
formula.rhs = (_formula$rhs = formula.rhs) === null || _formula$rhs === void 0 ? void 0 : _formula$rhs.map(function (vv) {
|
|
84
107
|
if (vv.type === 'constant' && !vv.id) {
|
|
85
108
|
return setConstantId(vv, constantList);
|
|
86
109
|
}
|
package/lib/es/hooks/patch.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
2
|
import { TypeEnum } from '../store/enum';
|
|
3
3
|
var setConstantId = function setConstantId(item, constantList) {
|
|
4
|
-
constantList.map(function (v) {
|
|
4
|
+
constantList === null || constantList === void 0 || constantList.map(function (v) {
|
|
5
5
|
if (v.label === item.val) {
|
|
6
6
|
item.id = v.value;
|
|
7
7
|
}
|
|
@@ -19,13 +19,14 @@ var setFormulaId = function setFormulaId(item, formulaTemplates) {
|
|
|
19
19
|
export var joinDataPatch = function joinDataPatch(newMeta, constantList, formulaTemplates) {
|
|
20
20
|
var _newMeta$expressions;
|
|
21
21
|
newMeta.expressions = (_newMeta$expressions = newMeta.expressions) === null || _newMeta$expressions === void 0 ? void 0 : _newMeta$expressions.map(function (v, i) {
|
|
22
|
-
|
|
22
|
+
var _v$lhs, _v$rhs;
|
|
23
|
+
v.lhs = (_v$lhs = v.lhs) === null || _v$lhs === void 0 ? void 0 : _v$lhs.map(function (vv) {
|
|
23
24
|
if (vv.type === 'constant' && !vv.id) {
|
|
24
25
|
return setConstantId(vv, constantList);
|
|
25
26
|
}
|
|
26
27
|
return vv;
|
|
27
28
|
});
|
|
28
|
-
v.rhs = v.rhs.map(function (vv) {
|
|
29
|
+
v.rhs = (_v$rhs = v.rhs) === null || _v$rhs === void 0 ? void 0 : _v$rhs.map(function (vv) {
|
|
29
30
|
if (vv.type === 'constant' && !vv.id) {
|
|
30
31
|
return setConstantId(vv, constantList);
|
|
31
32
|
}
|
|
@@ -43,15 +44,35 @@ export var filterPatch = function filterPatch(newMeta, constantList, formulaTemp
|
|
|
43
44
|
return setConstantId(v, constantList);
|
|
44
45
|
}
|
|
45
46
|
if (v.type === 'expression') {
|
|
46
|
-
|
|
47
|
+
var _v$rhs2;
|
|
48
|
+
v.rhs = (_v$rhs2 = v.rhs) === null || _v$rhs2 === void 0 ? void 0 : _v$rhs2.map(function (item) {
|
|
47
49
|
if (item.type === 'constant' && !item.id) {
|
|
48
50
|
return setConstantId(item, constantList);
|
|
49
51
|
}
|
|
50
52
|
return item;
|
|
51
53
|
});
|
|
52
54
|
}
|
|
53
|
-
if (v.type === 'FORMULA'
|
|
54
|
-
|
|
55
|
+
if (v.type === 'FORMULA') {
|
|
56
|
+
var _v$args;
|
|
57
|
+
var _v = v;
|
|
58
|
+
if (!_v.id) {
|
|
59
|
+
_v = setFormulaId(v, formulaTemplates);
|
|
60
|
+
}
|
|
61
|
+
(_v$args = _v.args) === null || _v$args === void 0 || _v$args.map(function (arg) {
|
|
62
|
+
var _arg$list;
|
|
63
|
+
arg.list = (_arg$list = arg.list) === null || _arg$list === void 0 ? void 0 : _arg$list.map(function (argItem) {
|
|
64
|
+
if (argItem.type === 'constant' && !argItem.id) {
|
|
65
|
+
return setConstantId(argItem, constantList);
|
|
66
|
+
}
|
|
67
|
+
if (argItem.type === 'FORMULA' && !argItem.id) {
|
|
68
|
+
return setFormulaId(argItem, formulaTemplates);
|
|
69
|
+
}
|
|
70
|
+
return argItem;
|
|
71
|
+
});
|
|
72
|
+
return arg;
|
|
73
|
+
});
|
|
74
|
+
return _v;
|
|
75
|
+
// return setFormulaId(v, formulaTemplates);
|
|
55
76
|
}
|
|
56
77
|
if (v.type === 'exists' || v.type === 'notExists') {
|
|
57
78
|
v.notExists = _patchMetas(v.notExists, constantList, formulaTemplates);
|
|
@@ -65,15 +86,17 @@ export var filterPatch = function filterPatch(newMeta, constantList, formulaTemp
|
|
|
65
86
|
export var customColumnPatch = function customColumnPatch(newMeta, constantList, formulaTemplates) {
|
|
66
87
|
var _newMeta$customColumn;
|
|
67
88
|
newMeta.customColumn = (newMeta === null || newMeta === void 0 || (_newMeta$customColumn = newMeta.customColumn) === null || _newMeta$customColumn === void 0 ? void 0 : _newMeta$customColumn.map(function (v) {
|
|
68
|
-
var
|
|
89
|
+
var _v$formulaList;
|
|
90
|
+
var _formulaList = (_v$formulaList = v.formulaList) === null || _v$formulaList === void 0 ? void 0 : _v$formulaList.map(function (formula) {
|
|
69
91
|
if (formula.type === 'expression') {
|
|
70
|
-
|
|
92
|
+
var _formula$lhs, _formula$rhs;
|
|
93
|
+
formula.lhs = (_formula$lhs = formula.lhs) === null || _formula$lhs === void 0 ? void 0 : _formula$lhs.map(function (vv) {
|
|
71
94
|
if (vv.type === 'constant' && !vv.id) {
|
|
72
95
|
return setConstantId(vv, constantList);
|
|
73
96
|
}
|
|
74
97
|
return vv;
|
|
75
98
|
});
|
|
76
|
-
formula.rhs = formula.rhs.map(function (vv) {
|
|
99
|
+
formula.rhs = (_formula$rhs = formula.rhs) === null || _formula$rhs === void 0 ? void 0 : _formula$rhs.map(function (vv) {
|
|
77
100
|
if (vv.type === 'constant' && !vv.id) {
|
|
78
101
|
return setConstantId(vv, constantList);
|
|
79
102
|
}
|