@gingkoo/pandora-metabase 1.0.118 → 1.0.119
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/Portal/index.js +0 -2
- package/lib/cjs/common/SplitView/index.d.ts +0 -4
- package/lib/cjs/common/SplitView/index.js +0 -10
- package/lib/cjs/components/dialog/custom-column/config.js +4 -48
- package/lib/cjs/components/dialog/custom-column/expression-editor.js +3 -14
- package/lib/cjs/components/dialog/custom-column/expressions/suggest.d.ts +2 -34
- package/lib/cjs/components/dialog/custom-column/expressions/suggest.js +2 -43
- package/lib/cjs/components/dialog/custom-column/expressions/tokenizer.js +8 -65
- package/lib/cjs/components/dialog/custom-column/index.js +2 -4
- package/lib/cjs/components/dialog/custom-column/tokenized-expression.js +2 -3
- package/lib/cjs/components/dialog/custom-column/tokenizedI-input.js +1 -1
- package/lib/cjs/components/dialog/custom-editor/index.js +2 -7
- package/lib/cjs/components/dialog/diff-viewer/index copy.js +1 -16
- package/lib/cjs/components/dialog/expression/date-format-picker.js +2 -20
- package/lib/cjs/components/dialog/expression/date-format.js +2 -8
- package/lib/cjs/components/dialog/expression/index.d.ts +0 -3
- package/lib/cjs/components/dialog/expression/index.js +2 -83
- package/lib/cjs/components/dialog/formula/index.js +1 -30
- package/lib/cjs/components/dialog/formula/utils.js +2 -10
- package/lib/cjs/components/dialog/formula-list/CaseWhenGroup.d.ts +19 -0
- package/lib/cjs/components/dialog/formula-list/CaseWhenGroup.js +109 -0
- package/lib/cjs/components/dialog/formula-list/LogicGroup.d.ts +9 -0
- package/lib/cjs/components/dialog/formula-list/LogicGroup.js +43 -0
- package/lib/cjs/components/dialog/formula-list/index.d.ts +3 -0
- package/lib/cjs/components/dialog/formula-list/index.js +967 -503
- package/lib/cjs/components/dialog/formula-list/index.less +724 -0
- package/lib/cjs/components/dialog/formula-list/utils.d.ts +0 -7
- package/lib/cjs/components/dialog/formula-list/utils.js +117 -113
- package/lib/cjs/components/dialog/select-column/index.d.ts +0 -6
- package/lib/cjs/components/dialog/select-column/index.js +4 -15
- package/lib/cjs/components/dialog/select-column-multiple/index.d.ts +0 -8
- package/lib/cjs/components/dialog/select-column-multiple/index.js +6 -45
- package/lib/cjs/components/dialog/select-join/index.d.ts +0 -5
- package/lib/cjs/components/dialog/select-join/index.js +0 -6
- package/lib/cjs/components/dialog/select-join-column/index.d.ts +0 -8
- package/lib/cjs/components/dialog/select-join-column/index.js +7 -21
- package/lib/cjs/components/dialog/select-join-column-multiple/index.d.ts +0 -8
- package/lib/cjs/components/dialog/select-join-column-multiple/index.js +5 -35
- package/lib/cjs/components/dialog/select-permission-table/index.d.ts +0 -5
- package/lib/cjs/components/dialog/select-permission-table/index.js +0 -6
- package/lib/cjs/components/dialog/select-summarize/index.d.ts +3 -3
- package/lib/cjs/components/dialog/select-summarize/index.js +105 -18
- package/lib/cjs/components/dialog/select-summarize/index.less +23 -0
- package/lib/cjs/components/dialog/select-table/index.d.ts +0 -6
- package/lib/cjs/components/dialog/select-table/index.js +1 -9
- package/lib/cjs/components/metabase/index.js +72 -86
- package/lib/cjs/components/metabase/index.less +7 -7
- package/lib/cjs/components/modules/components/Wrapper.js +1 -1
- package/lib/cjs/components/modules/components/header.js +2 -2
- package/lib/cjs/components/modules/components/meta-icon.d.ts +0 -3
- package/lib/cjs/components/modules/components/meta-icon.js +2 -47
- package/lib/cjs/components/modules/custom-column.js +3 -29
- package/lib/cjs/components/modules/enum/filter-enum.js +9 -88
- package/lib/cjs/components/modules/filter.js +2 -20
- package/lib/cjs/components/modules/index.d.ts +4 -2
- package/lib/cjs/components/modules/index.js +24 -1
- package/lib/cjs/components/modules/join-data.js +13 -291
- package/lib/cjs/components/modules/row-limit.js +0 -1
- package/lib/cjs/components/modules/sort.js +1 -61
- package/lib/cjs/components/modules/summarize/group-by.d.ts +0 -5
- package/lib/cjs/components/modules/summarize/group-by.js +231 -76
- package/lib/cjs/components/modules/summarize/select-index.js +96 -46
- package/lib/cjs/components/modules/table-data.js +11 -64
- package/lib/cjs/components/popup.js +26 -32
- package/lib/cjs/hooks/patch.d.ts +1 -0
- package/lib/cjs/hooks/patch.js +104 -6
- package/lib/cjs/hooks/patch2.js +3 -165
- package/lib/cjs/hooks/use-provider.js +0 -3
- package/lib/cjs/hooks/use-state.js +55 -135
- package/lib/cjs/index.js +0 -15
- package/lib/cjs/locale/en.js +5 -0
- package/lib/cjs/locale/index.js +1 -4
- package/lib/cjs/locale/zh.js +5 -0
- package/lib/cjs/sql-formula.js +0 -1
- package/lib/cjs/store/enum.d.ts +6 -6
- package/lib/cjs/store/enum.js +0 -13
- package/lib/cjs/store/helper.d.ts +2 -1
- package/lib/cjs/store/helper.js +15 -225
- package/lib/cjs/store/types.d.ts +45 -67
- package/lib/cjs/store/types.js +3 -49
- package/lib/cjs/types.d.ts +1 -0
- package/lib/cjs/utils/cookies.js +0 -3
- package/lib/cjs/utils/event.js +1 -1
- package/lib/cjs/utils/helper-dom.d.ts +1 -0
- package/lib/cjs/utils/helper-dom.js +17 -10
- package/lib/cjs/utils/helper.js +1 -24
- package/lib/cjs/utils/keydown.js +4 -7
- package/lib/cjs/utils/platform.d.ts +0 -9
- package/lib/cjs/utils/platform.js +0 -10
- package/lib/cjs/utils/selection.js +0 -6
- package/lib/cjs/utils/storage.d.ts +0 -9
- package/lib/cjs/utils/storage.js +1 -11
- package/lib/cjs/utils/transformSql.d.ts +5 -0
- package/lib/cjs/utils/transformSql.js +42 -113
- package/lib/cjs/utils.d.ts +1 -6
- package/lib/cjs/utils.js +115 -255
- package/lib/es/common/Portal/index.js +0 -2
- package/lib/es/common/SplitView/index.d.ts +0 -4
- package/lib/es/common/SplitView/index.js +0 -10
- package/lib/es/components/dialog/custom-column/config.js +4 -48
- package/lib/es/components/dialog/custom-column/expression-editor.js +3 -14
- package/lib/es/components/dialog/custom-column/expressions/suggest.d.ts +2 -34
- package/lib/es/components/dialog/custom-column/expressions/suggest.js +2 -43
- package/lib/es/components/dialog/custom-column/expressions/tokenizer.js +8 -65
- package/lib/es/components/dialog/custom-column/index.js +2 -4
- package/lib/es/components/dialog/custom-column/tokenized-expression.js +1 -3
- package/lib/es/components/dialog/custom-column/tokenizedI-input.js +1 -1
- package/lib/es/components/dialog/custom-editor/index.js +1 -7
- package/lib/es/components/dialog/diff-viewer/index copy.js +1 -15
- package/lib/es/components/dialog/expression/date-format-picker.js +2 -20
- package/lib/es/components/dialog/expression/date-format.js +2 -8
- package/lib/es/components/dialog/expression/index.d.ts +0 -3
- package/lib/es/components/dialog/expression/index.js +2 -82
- package/lib/es/components/dialog/formula/index.js +0 -30
- package/lib/es/components/dialog/formula/utils.js +2 -10
- package/lib/es/components/dialog/formula-list/CaseWhenGroup.d.ts +19 -0
- package/lib/es/components/dialog/formula-list/CaseWhenGroup.js +102 -0
- package/lib/es/components/dialog/formula-list/LogicGroup.d.ts +9 -0
- package/lib/es/components/dialog/formula-list/LogicGroup.js +36 -0
- package/lib/es/components/dialog/formula-list/index.d.ts +3 -0
- package/lib/es/components/dialog/formula-list/index.js +966 -503
- package/lib/es/components/dialog/formula-list/index.less +724 -0
- package/lib/es/components/dialog/formula-list/utils.d.ts +0 -7
- package/lib/es/components/dialog/formula-list/utils.js +117 -113
- package/lib/es/components/dialog/index.js +3 -3
- package/lib/es/components/dialog/select-column/index.d.ts +0 -6
- package/lib/es/components/dialog/select-column/index.js +4 -14
- package/lib/es/components/dialog/select-column-multiple/index.d.ts +0 -8
- package/lib/es/components/dialog/select-column-multiple/index.js +7 -47
- package/lib/es/components/dialog/select-join/index.d.ts +0 -5
- package/lib/es/components/dialog/select-join/index.js +0 -5
- package/lib/es/components/dialog/select-join-column/index.d.ts +0 -8
- package/lib/es/components/dialog/select-join-column/index.js +7 -20
- package/lib/es/components/dialog/select-join-column-multiple/index.d.ts +0 -8
- package/lib/es/components/dialog/select-join-column-multiple/index.js +5 -34
- package/lib/es/components/dialog/select-permission-table/index.d.ts +0 -5
- package/lib/es/components/dialog/select-permission-table/index.js +0 -5
- package/lib/es/components/dialog/select-summarize/index.d.ts +3 -3
- package/lib/es/components/dialog/select-summarize/index.js +106 -18
- package/lib/es/components/dialog/select-summarize/index.less +23 -0
- package/lib/es/components/dialog/select-table/index.d.ts +0 -6
- package/lib/es/components/dialog/select-table/index.js +1 -8
- package/lib/es/components/metabase/index.js +72 -87
- package/lib/es/components/metabase/index.less +7 -7
- package/lib/es/components/modules/components/Wrapper.js +1 -1
- package/lib/es/components/modules/components/header.js +2 -2
- package/lib/es/components/modules/components/meta-icon.d.ts +0 -3
- package/lib/es/components/modules/components/meta-icon.js +2 -46
- package/lib/es/components/modules/custom-column.js +3 -29
- package/lib/es/components/modules/enum/filter-enum.js +9 -88
- package/lib/es/components/modules/filter.js +2 -19
- package/lib/es/components/modules/index.d.ts +4 -2
- package/lib/es/components/modules/index.js +24 -1
- package/lib/es/components/modules/join-data.js +13 -291
- package/lib/es/components/modules/row-limit.js +0 -1
- package/lib/es/components/modules/sort.js +1 -61
- package/lib/es/components/modules/summarize/group-by.d.ts +0 -5
- package/lib/es/components/modules/summarize/group-by.js +233 -78
- package/lib/es/components/modules/summarize/select-index.js +96 -46
- package/lib/es/components/modules/table-data.js +11 -64
- package/lib/es/components/popup.js +27 -33
- package/lib/es/hooks/patch.d.ts +1 -0
- package/lib/es/hooks/patch.js +103 -5
- package/lib/es/hooks/patch2.js +2 -164
- package/lib/es/hooks/use-provider.js +0 -3
- package/lib/es/hooks/use-state.js +55 -135
- package/lib/es/index.js +0 -14
- package/lib/es/locale/en.js +5 -0
- package/lib/es/locale/index.js +1 -4
- package/lib/es/locale/zh.js +5 -0
- package/lib/es/sql-formula.js +0 -1
- package/lib/es/store/enum.d.ts +6 -6
- package/lib/es/store/enum.js +0 -13
- package/lib/es/store/helper.d.ts +2 -1
- package/lib/es/store/helper.js +13 -224
- package/lib/es/store/types.d.ts +45 -67
- package/lib/es/store/types.js +3 -49
- package/lib/es/types.d.ts +1 -0
- package/lib/es/types.js +1 -18
- package/lib/es/utils/cookies.js +0 -3
- package/lib/es/utils/event.js +1 -1
- package/lib/es/utils/helper-dom.d.ts +1 -0
- package/lib/es/utils/helper-dom.js +16 -9
- package/lib/es/utils/helper.js +1 -24
- package/lib/es/utils/keydown.js +4 -7
- package/lib/es/utils/platform.d.ts +0 -9
- package/lib/es/utils/platform.js +0 -10
- package/lib/es/utils/selection.js +0 -6
- package/lib/es/utils/storage.d.ts +0 -9
- package/lib/es/utils/storage.js +1 -10
- package/lib/es/utils/transformSql.d.ts +5 -0
- package/lib/es/utils/transformSql.js +42 -112
- package/lib/es/utils.d.ts +1 -6
- package/lib/es/utils.js +116 -255
- package/package.json +1 -1
|
@@ -13,11 +13,9 @@ var Portal = (0, _react.forwardRef)(function (props, ref) {
|
|
|
13
13
|
_props$children = props.children,
|
|
14
14
|
children = _props$children === void 0 ? null : _props$children;
|
|
15
15
|
var containerRef = (0, _react.useRef)();
|
|
16
|
-
// Ref return nothing, only for wrapper check exist
|
|
17
16
|
(0, _react.useImperativeHandle)(ref, function () {
|
|
18
17
|
return {};
|
|
19
18
|
});
|
|
20
|
-
// Create container in client side with sync to avoid useEffect not get ref
|
|
21
19
|
var initRef = (0, _react.useRef)(false);
|
|
22
20
|
if (!initRef.current) {
|
|
23
21
|
containerRef.current = getContainer();
|
|
@@ -9,9 +9,5 @@ interface SplitViewProps {
|
|
|
9
9
|
topMinH?: number;
|
|
10
10
|
bottomMinH?: number;
|
|
11
11
|
}
|
|
12
|
-
/**
|
|
13
|
-
* 先不考虑局部情况,只考虑该组件占据整个浏览器窗口
|
|
14
|
-
* @returns React.ReactNode
|
|
15
|
-
*/
|
|
16
12
|
declare const SplitView: React.ForwardRefExoticComponent<SplitViewProps & React.RefAttributes<unknown>>;
|
|
17
13
|
export default SplitView;
|
|
@@ -21,10 +21,6 @@ var StyledSashHorizontal = _styledComponents["default"].div.attrs({
|
|
|
21
21
|
})(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n top: ", ";\n"])), function (props) {
|
|
22
22
|
return props.top + 'px';
|
|
23
23
|
});
|
|
24
|
-
/**
|
|
25
|
-
* 先不考虑局部情况,只考虑该组件占据整个浏览器窗口
|
|
26
|
-
* @returns React.ReactNode
|
|
27
|
-
*/
|
|
28
24
|
var SplitView = _react["default"].forwardRef(function (props, ref) {
|
|
29
25
|
var _props$direction = props.direction,
|
|
30
26
|
direction = _props$direction === void 0 ? 'vertical' : _props$direction,
|
|
@@ -88,7 +84,6 @@ var SplitView = _react["default"].forwardRef(function (props, ref) {
|
|
|
88
84
|
setSashClicked(true);
|
|
89
85
|
}
|
|
90
86
|
var onMouseMove = (0, _react.useCallback)(function (e) {
|
|
91
|
-
// 按下
|
|
92
87
|
if (sashClicked) {
|
|
93
88
|
var x = e.clientX || e.pageX;
|
|
94
89
|
var y = e.clientY || e.pageY;
|
|
@@ -147,13 +142,9 @@ var SplitView = _react["default"].forwardRef(function (props, ref) {
|
|
|
147
142
|
return (0, _jsxRuntime.jsxs)("div", {
|
|
148
143
|
className: (0, _classnames["default"])('split-view-container', {
|
|
149
144
|
'sash-horizontal': sashClicked,
|
|
150
|
-
// 'sash-vertical': sashClicked,
|
|
151
145
|
'h-center': !vMinimum && !vMaximum,
|
|
152
146
|
'h-minimum': vMinimum,
|
|
153
147
|
'h-maximum': vMaximum
|
|
154
|
-
// 'v-center': !vMinimum && !vMaximum,
|
|
155
|
-
// 'v-minimum': vMinimum,
|
|
156
|
-
// 'v-maximum': vMaximum,
|
|
157
148
|
}),
|
|
158
149
|
onMouseUp: onMouseUp,
|
|
159
150
|
onMouseMove: onMouseMove,
|
|
@@ -161,7 +152,6 @@ var SplitView = _react["default"].forwardRef(function (props, ref) {
|
|
|
161
152
|
className: 'sash-container',
|
|
162
153
|
children: (0, _jsxRuntime.jsx)(StyledSashHorizontal, {
|
|
163
154
|
top: sashY - 2,
|
|
164
|
-
// @ts-ignore
|
|
165
155
|
className: (0, _classnames["default"])({
|
|
166
156
|
active: sashClicked
|
|
167
157
|
}),
|
|
@@ -11,40 +11,24 @@ exports.getMBQLName = getMBQLName;
|
|
|
11
11
|
exports.isExpressionType = void 0;
|
|
12
12
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/toConsumableArray"));
|
|
13
13
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
|
|
14
|
-
// @ts-nocheck
|
|
15
14
|
var DISPLAY_QUOTES = exports.DISPLAY_QUOTES = {
|
|
16
15
|
identifierQuoteDefault: '',
|
|
17
16
|
literalQuoteDefault: ''
|
|
18
17
|
};
|
|
19
18
|
var EDITOR_QUOTES = exports.EDITOR_QUOTES = {
|
|
20
|
-
// specifies where different quoting is used:
|
|
21
19
|
characters: {
|
|
22
20
|
'[': 'identifier',
|
|
23
21
|
"'": 'literal',
|
|
24
22
|
'"': 'literal'
|
|
25
23
|
},
|
|
26
|
-
// specifies the default quoting style:
|
|
27
24
|
literalQuoteDefault: '"',
|
|
28
25
|
identifierQuoteDefault: '[',
|
|
29
|
-
// always quote identifiers even if they have non-word characters or conflict with reserved words
|
|
30
26
|
identifierAlwaysQuoted: true
|
|
31
27
|
};
|
|
32
|
-
// export const EDITOR_QUOTES = {
|
|
33
|
-
// characters: {
|
|
34
|
-
// "'": "literal",
|
|
35
|
-
// '"': "identifier",
|
|
36
|
-
// },
|
|
37
|
-
// literalQuoteDefault: "'",
|
|
38
|
-
// identifierQuoteDefault: '"',
|
|
39
|
-
// identifierAlwaysQuoted: false,
|
|
40
|
-
// };
|
|
41
28
|
var EDITOR_FK_SYMBOLS = exports.EDITOR_FK_SYMBOLS = {
|
|
42
|
-
// specifies which symbols can be used to delimit foreign/joined fields
|
|
43
29
|
symbols: ['.', ' → '],
|
|
44
|
-
// specifies the default/canonical symbol
|
|
45
30
|
"default": ' → '
|
|
46
31
|
};
|
|
47
|
-
// copied relevant parts from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Operator_Precedence
|
|
48
32
|
var OPERATOR_PRECEDENCE = exports.OPERATOR_PRECEDENCE = {
|
|
49
33
|
not: 17,
|
|
50
34
|
'*': 15,
|
|
@@ -56,7 +40,6 @@ var OPERATOR_PRECEDENCE = exports.OPERATOR_PRECEDENCE = {
|
|
|
56
40
|
};
|
|
57
41
|
var EXPRESSION_TYPES = exports.EXPRESSION_TYPES = ['expression', 'aggregation', 'boolean', 'string', 'number'];
|
|
58
42
|
var EXPRESSION_SUBTYPES = exports.EXPRESSION_SUBTYPES = {
|
|
59
|
-
// can't currently add "boolean" as a subtype of expression due to conflict between segments and fields
|
|
60
43
|
expression: new Set(['string', 'number'])
|
|
61
44
|
};
|
|
62
45
|
var isExpressionType = exports.isExpressionType = function isExpressionType(typeA, typeB) {
|
|
@@ -66,7 +49,6 @@ function getFunctionArgType(clause, index) {
|
|
|
66
49
|
return clause.multiple ? clause.args[0] : clause.args[index];
|
|
67
50
|
}
|
|
68
51
|
var MBQL_CLAUSES = exports.MBQL_CLAUSES = {
|
|
69
|
-
// aggregation functions
|
|
70
52
|
count: {
|
|
71
53
|
displayName: "Count",
|
|
72
54
|
type: 'aggregation',
|
|
@@ -146,7 +128,6 @@ var MBQL_CLAUSES = exports.MBQL_CLAUSES = {
|
|
|
146
128
|
args: ['number', 'number'],
|
|
147
129
|
requiresFeature: 'percentile-aggregations'
|
|
148
130
|
},
|
|
149
|
-
// string functions
|
|
150
131
|
lower: {
|
|
151
132
|
displayName: "lower",
|
|
152
133
|
type: 'string',
|
|
@@ -199,7 +180,6 @@ var MBQL_CLAUSES = exports.MBQL_CLAUSES = {
|
|
|
199
180
|
type: 'string',
|
|
200
181
|
args: ['string']
|
|
201
182
|
},
|
|
202
|
-
// numeric functions
|
|
203
183
|
abs: {
|
|
204
184
|
displayName: "abs",
|
|
205
185
|
type: 'number',
|
|
@@ -248,7 +228,6 @@ var MBQL_CLAUSES = exports.MBQL_CLAUSES = {
|
|
|
248
228
|
args: ['number'],
|
|
249
229
|
requiresFeature: 'advanced-math-expressions'
|
|
250
230
|
},
|
|
251
|
-
// boolean functions
|
|
252
231
|
contains: {
|
|
253
232
|
displayName: "contains",
|
|
254
233
|
type: 'boolean',
|
|
@@ -287,7 +266,6 @@ var MBQL_CLAUSES = exports.MBQL_CLAUSES = {
|
|
|
287
266
|
type: 'boolean',
|
|
288
267
|
args: ['expression']
|
|
289
268
|
},
|
|
290
|
-
// other expression functions
|
|
291
269
|
coalesce: {
|
|
292
270
|
displayName: "coalesce",
|
|
293
271
|
type: 'expression',
|
|
@@ -298,10 +276,8 @@ var MBQL_CLAUSES = exports.MBQL_CLAUSES = {
|
|
|
298
276
|
displayName: "case",
|
|
299
277
|
type: 'expression',
|
|
300
278
|
args: ['expression', 'expression'],
|
|
301
|
-
// ideally we'd alternate boolean/expression
|
|
302
279
|
multiple: true
|
|
303
280
|
},
|
|
304
|
-
// boolean operators
|
|
305
281
|
and: {
|
|
306
282
|
displayName: "AND",
|
|
307
283
|
type: 'boolean',
|
|
@@ -317,7 +293,6 @@ var MBQL_CLAUSES = exports.MBQL_CLAUSES = {
|
|
|
317
293
|
type: 'boolean',
|
|
318
294
|
args: ['boolean']
|
|
319
295
|
},
|
|
320
|
-
// numeric operators
|
|
321
296
|
'*': {
|
|
322
297
|
displayName: '*',
|
|
323
298
|
tokenName: 'Multi',
|
|
@@ -342,7 +317,6 @@ var MBQL_CLAUSES = exports.MBQL_CLAUSES = {
|
|
|
342
317
|
type: 'number',
|
|
343
318
|
args: ['number', 'number']
|
|
344
319
|
},
|
|
345
|
-
// comparison operators
|
|
346
320
|
'!=': {
|
|
347
321
|
displayName: '!=',
|
|
348
322
|
tokenName: 'NotEqual',
|
|
@@ -384,12 +358,9 @@ for (var _i = 0, _Object$entries = Object.entries(MBQL_CLAUSES); _i < _Object$en
|
|
|
384
358
|
var _Object$entries$_i = (0, _slicedToArray2["default"])(_Object$entries[_i], 2),
|
|
385
359
|
name = _Object$entries$_i[0],
|
|
386
360
|
clause = _Object$entries$_i[1];
|
|
387
|
-
if (clause.name !== undefined && clause.name !== name) {
|
|
388
|
-
console.warn('Mismatched name for MBQL_CLAUSES ' + name);
|
|
389
|
-
}
|
|
361
|
+
if (clause.name !== undefined && clause.name !== name) {}
|
|
390
362
|
clause.name = name;
|
|
391
363
|
}
|
|
392
|
-
// Reserved token names
|
|
393
364
|
var MBQL_TO_EXPRESSION_NAME = new Map(Object.entries(MBQL_CLAUSES).map(function (_ref) {
|
|
394
365
|
var _ref2 = (0, _slicedToArray2["default"])(_ref, 2),
|
|
395
366
|
mbql = _ref2[0],
|
|
@@ -400,29 +371,16 @@ var EXPRESSION_TO_MBQL_NAME = new Map(Object.entries(MBQL_CLAUSES).map(function
|
|
|
400
371
|
var _ref4 = (0, _slicedToArray2["default"])(_ref3, 2),
|
|
401
372
|
mbql = _ref4[0],
|
|
402
373
|
displayName = _ref4[1].displayName;
|
|
403
|
-
return [
|
|
404
|
-
// case-insensitive
|
|
405
|
-
displayName.toLowerCase(), mbql];
|
|
374
|
+
return [displayName.toLowerCase(), mbql];
|
|
406
375
|
}));
|
|
407
376
|
function getExpressionName(mbqlName) {
|
|
408
377
|
return MBQL_TO_EXPRESSION_NAME.get(mbqlName);
|
|
409
378
|
}
|
|
410
379
|
function getMBQLName(expressionName) {
|
|
411
|
-
// case-insensitive
|
|
412
380
|
return EXPRESSION_TO_MBQL_NAME.get(expressionName.toLowerCase());
|
|
413
381
|
}
|
|
414
|
-
var AGGREGATION_FUNCTIONS = exports.AGGREGATION_FUNCTIONS = new Set([
|
|
415
|
-
|
|
416
|
-
'count-where', 'sum-where', 'count', 'cum-count', 'sum', 'cum-sum', 'distinct', 'stddev', 'avg', 'min', 'max', 'share', 'var', 'median', 'percentile']);
|
|
417
|
-
var EXPRESSION_FUNCTIONS = exports.EXPRESSION_FUNCTIONS = new Set([
|
|
418
|
-
// string
|
|
419
|
-
'lower', 'upper', 'substring', 'regex-match-first', 'concat', 'replace', 'trim', 'rtrim', 'ltrim', 'length',
|
|
420
|
-
// number
|
|
421
|
-
'abs', 'floor', 'ceil', 'round', 'sqrt', 'power', 'log', 'exp',
|
|
422
|
-
// boolean
|
|
423
|
-
'contains', 'ends-with', 'starts-with', 'between', 'time-interval', 'is-null', 'is-empty',
|
|
424
|
-
// other
|
|
425
|
-
'coalesce']);
|
|
382
|
+
var AGGREGATION_FUNCTIONS = exports.AGGREGATION_FUNCTIONS = new Set(['count-where', 'sum-where', 'count', 'cum-count', 'sum', 'cum-sum', 'distinct', 'stddev', 'avg', 'min', 'max', 'share', 'var', 'median', 'percentile']);
|
|
383
|
+
var EXPRESSION_FUNCTIONS = exports.EXPRESSION_FUNCTIONS = new Set(['lower', 'upper', 'substring', 'regex-match-first', 'concat', 'replace', 'trim', 'rtrim', 'ltrim', 'length', 'abs', 'floor', 'ceil', 'round', 'sqrt', 'power', 'log', 'exp', 'contains', 'ends-with', 'starts-with', 'between', 'time-interval', 'is-null', 'is-empty', 'coalesce']);
|
|
426
384
|
var EXPRESSION_OPERATORS = exports.EXPRESSION_OPERATORS = new Set(['+', '-', '*', '/']);
|
|
427
385
|
var FILTER_OPERATORS = exports.FILTER_OPERATORS = new Set(['!=', '<=', '>=', '<', '>', '=']);
|
|
428
386
|
var BOOLEAN_UNARY_OPERATORS = exports.BOOLEAN_UNARY_OPERATORS = new Set(['not']);
|
|
@@ -430,7 +388,5 @@ var LOGICAL_AND_OPERATOR = exports.LOGICAL_AND_OPERATOR = new Set(['and']);
|
|
|
430
388
|
var LOGICAL_OR_OPERATOR = exports.LOGICAL_OR_OPERATOR = new Set(['or']);
|
|
431
389
|
var FUNCTIONS = exports.FUNCTIONS = new Set([].concat((0, _toConsumableArray2["default"])(EXPRESSION_FUNCTIONS), (0, _toConsumableArray2["default"])(AGGREGATION_FUNCTIONS)));
|
|
432
390
|
var OPERATORS = exports.OPERATORS = new Set([].concat((0, _toConsumableArray2["default"])(EXPRESSION_OPERATORS), (0, _toConsumableArray2["default"])(FILTER_OPERATORS), (0, _toConsumableArray2["default"])(BOOLEAN_UNARY_OPERATORS), (0, _toConsumableArray2["default"])(LOGICAL_AND_OPERATOR), (0, _toConsumableArray2["default"])(LOGICAL_OR_OPERATOR)));
|
|
433
|
-
// "standard" filters, can be edited using UI
|
|
434
391
|
var STANDARD_FILTERS = exports.STANDARD_FILTERS = new Set(['!=', '<=', '>=', '<', '>', '=', 'contains', 'does-not-contain', 'ends-with', 'starts-with', 'between', 'time-interval', 'is-null', 'not-null', 'is-empty', 'not-empty', 'inside']);
|
|
435
|
-
// "standard" aggregations, can be edited using UI
|
|
436
392
|
var STANDARD_AGGREGATIONS = exports.STANDARD_AGGREGATIONS = new Set(['count', 'cum-count', 'sum', 'cum-sum', 'distinct', 'stddev', 'avg', 'min', 'max']);
|
|
@@ -38,7 +38,7 @@ var ExpressionEditor = function ExpressionEditor(props) {
|
|
|
38
38
|
}),
|
|
39
39
|
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
40
40
|
popup = _useState2[0],
|
|
41
|
-
setPopup = _useState2[1];
|
|
41
|
+
setPopup = _useState2[1];
|
|
42
42
|
var input = (0, _react.useRef)(null);
|
|
43
43
|
var _useState3 = (0, _react.useState)(expression),
|
|
44
44
|
_useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
|
|
@@ -47,7 +47,7 @@ var ExpressionEditor = function ExpressionEditor(props) {
|
|
|
47
47
|
var _useState5 = (0, _react.useState)(''),
|
|
48
48
|
_useState6 = (0, _slicedToArray2["default"])(_useState5, 2),
|
|
49
49
|
errorMessage = _useState6[0],
|
|
50
|
-
setErrorMessage = _useState6[1];
|
|
50
|
+
setErrorMessage = _useState6[1];
|
|
51
51
|
var _useState7 = (0, _react.useState)(false),
|
|
52
52
|
_useState8 = (0, _slicedToArray2["default"])(_useState7, 2),
|
|
53
53
|
error = _useState8[0],
|
|
@@ -71,7 +71,6 @@ var ExpressionEditor = function ExpressionEditor(props) {
|
|
|
71
71
|
});
|
|
72
72
|
store.setClosable(true);
|
|
73
73
|
}
|
|
74
|
-
// 设置关闭位置
|
|
75
74
|
function _setCaretPosition(position, autosuggest) {
|
|
76
75
|
(0, _selection.setCaretPosition)(input.current, position);
|
|
77
76
|
if (autosuggest) {
|
|
@@ -80,7 +79,6 @@ var ExpressionEditor = function ExpressionEditor(props) {
|
|
|
80
79
|
});
|
|
81
80
|
}
|
|
82
81
|
}
|
|
83
|
-
// 根据当前光标位置判断弹出框内容
|
|
84
82
|
function onExpressionChange(source) {
|
|
85
83
|
var inputElement = input.current;
|
|
86
84
|
if (!inputElement) return;
|
|
@@ -92,7 +90,7 @@ var ExpressionEditor = function ExpressionEditor(props) {
|
|
|
92
90
|
selectionEnd = _getSelectionPosition2[1];
|
|
93
91
|
var hasSelection = selectionStart !== selectionEnd;
|
|
94
92
|
var targetOffset = !hasSelection ? selectionEnd : null;
|
|
95
|
-
if (targetOffset === null) return void 0;
|
|
93
|
+
if (targetOffset === null) return void 0;
|
|
96
94
|
(0, _selection.setCaretPosition)(input.current, selectionStart);
|
|
97
95
|
var popupInfo = _suggest["default"].choosePopup({
|
|
98
96
|
source: source,
|
|
@@ -117,11 +115,9 @@ var ExpressionEditor = function ExpressionEditor(props) {
|
|
|
117
115
|
if (matchPrefix && !/^\[.*\]$/.test(matchPrefix)) {
|
|
118
116
|
partialSource = partialSource.slice(0, -matchPrefix.length);
|
|
119
117
|
}
|
|
120
|
-
// 去掉后面空格
|
|
121
118
|
if (/.*\s$/.test(partialSource)) {
|
|
122
119
|
partialSource = partialSource.slice(0, -1);
|
|
123
120
|
}
|
|
124
|
-
// 去掉前面空格
|
|
125
121
|
if (/^\s.*/.test(leftoverSource)) {
|
|
126
122
|
leftoverSource = leftoverSource.slice(1);
|
|
127
123
|
}
|
|
@@ -161,7 +157,6 @@ var ExpressionEditor = function ExpressionEditor(props) {
|
|
|
161
157
|
});
|
|
162
158
|
store.setClosable(false);
|
|
163
159
|
}
|
|
164
|
-
// 键盘点击 方向键 & 回车 & esc
|
|
165
160
|
function onInputKeyDown(e) {
|
|
166
161
|
if (e.keyCode === _keyboard.KEYCODE_LEFT || e.keyCode === _keyboard.KEYCODE_RIGHT) {
|
|
167
162
|
setTimeout(function () {
|
|
@@ -183,15 +178,11 @@ var ExpressionEditor = function ExpressionEditor(props) {
|
|
|
183
178
|
e.preventDefault();
|
|
184
179
|
}
|
|
185
180
|
}
|
|
186
|
-
// TODO 校验公式待完成
|
|
187
181
|
function checkExpression(expression) {
|
|
188
|
-
// let _expression = expression.replace(/\s/g, '');
|
|
189
182
|
return [true];
|
|
190
183
|
}
|
|
191
|
-
// 失去焦点 检查语法错误情况,并将表达式传给父级
|
|
192
184
|
function onInputBlur(e) {
|
|
193
185
|
if (e.target === document.activeElement) {
|
|
194
|
-
// `Invalid expression`
|
|
195
186
|
return;
|
|
196
187
|
}
|
|
197
188
|
var _checkExpression = checkExpression(source),
|
|
@@ -202,11 +193,9 @@ var ExpressionEditor = function ExpressionEditor(props) {
|
|
|
202
193
|
props.onChange(source);
|
|
203
194
|
setErrorMessage('');
|
|
204
195
|
} else {
|
|
205
|
-
// props.onError(errorMessage);
|
|
206
196
|
setErrorMessage(errorMessage);
|
|
207
197
|
}
|
|
208
198
|
}
|
|
209
|
-
// 计算当前是否弹框,和弹框内容
|
|
210
199
|
function _triggerAutosuggest() {
|
|
211
200
|
onExpressionChange(source);
|
|
212
201
|
}
|
|
@@ -7,8 +7,8 @@ export declare enum OptionsTypeEnum {
|
|
|
7
7
|
OTHER = "other"
|
|
8
8
|
}
|
|
9
9
|
export declare enum SelectPopupTypeEnum {
|
|
10
|
-
FUNCTION_DESC = "function_desc"
|
|
11
|
-
SELECT_LIST = "select_list"
|
|
10
|
+
FUNCTION_DESC = "function_desc",
|
|
11
|
+
SELECT_LIST = "select_list",
|
|
12
12
|
EMPTY = "empty"
|
|
13
13
|
}
|
|
14
14
|
type SelectPopup = {
|
|
@@ -29,38 +29,6 @@ interface ChoosePopupType {
|
|
|
29
29
|
fields: MetaData_ColumnsType[];
|
|
30
30
|
}
|
|
31
31
|
declare class Suggest {
|
|
32
|
-
/**
|
|
33
|
-
* 主要是看光标前面是什么
|
|
34
|
-
* 1、主动识别的有
|
|
35
|
-
* 1)字段
|
|
36
|
-
* ① 光标在[]中间 筛选只能在表字段列表筛选 如果没有匹配 则不显示弹框
|
|
37
|
-
* ② 光标在]后面 显示运算符
|
|
38
|
-
* ③ 光标在[前面 不用理
|
|
39
|
-
* 2)字符串
|
|
40
|
-
* ① 光标在字符串中间 筛选 函数、表字段
|
|
41
|
-
* ② 光标在字符串后面 如果有匹配同上面① 如果没匹配 则不显示弹框
|
|
42
|
-
* ③ 光标在字符串前面 不用理
|
|
43
|
-
* 3)函数
|
|
44
|
-
* ① 点函数名 筛选 函数、表字段
|
|
45
|
-
* ② 函数括号里面 如果光标前面是(,或者后面是)提示函数详情
|
|
46
|
-
* ③ 在)后面,显示运算符
|
|
47
|
-
* ④ 在函数名前面 不用理会
|
|
48
|
-
* 4)括号
|
|
49
|
-
* ① 光标在(后面 显示所有函数、表字段
|
|
50
|
-
* ① 光标在)后面 显示运算符弹框
|
|
51
|
-
* ② 光标在(前面 或者在)前面 都不用理会
|
|
52
|
-
* 5)运算符
|
|
53
|
-
* ① 光标在前面显示运算符弹框
|
|
54
|
-
* ② 光标在后面显示所有函数、表字段
|
|
55
|
-
* 6)起点
|
|
56
|
-
* ① 显示所有函数、表字段
|
|
57
|
-
*
|
|
58
|
-
* 2、不识别的有
|
|
59
|
-
* 1)"aaa" 双引号字符串里面的 都不提示
|
|
60
|
-
* 2)1234 数字里面
|
|
61
|
-
* 3)前面包含特殊符号 ! @ ...
|
|
62
|
-
*
|
|
63
|
-
*/
|
|
64
32
|
choosePopup({ source, targetOffset, fields }: ChoosePopupType): ChoosePopupResultType;
|
|
65
33
|
}
|
|
66
34
|
declare const _default: Suggest;
|
|
@@ -27,67 +27,29 @@ var SelectPopupTypeEnum;
|
|
|
27
27
|
SelectPopupTypeEnum["EMPTY"] = "empty";
|
|
28
28
|
})(SelectPopupTypeEnum || (exports.SelectPopupTypeEnum = SelectPopupTypeEnum = {}));
|
|
29
29
|
var Operator = ['*', '+', '-', '/'];
|
|
30
|
-
var Suggest =
|
|
30
|
+
var Suggest = function () {
|
|
31
31
|
function Suggest() {
|
|
32
32
|
(0, _classCallCheck2["default"])(this, Suggest);
|
|
33
33
|
}
|
|
34
34
|
return (0, _createClass2["default"])(Suggest, [{
|
|
35
35
|
key: "choosePopup",
|
|
36
|
-
value:
|
|
37
|
-
/**
|
|
38
|
-
* 主要是看光标前面是什么
|
|
39
|
-
* 1、主动识别的有
|
|
40
|
-
* 1)字段
|
|
41
|
-
* ① 光标在[]中间 筛选只能在表字段列表筛选 如果没有匹配 则不显示弹框
|
|
42
|
-
* ② 光标在]后面 显示运算符
|
|
43
|
-
* ③ 光标在[前面 不用理
|
|
44
|
-
* 2)字符串
|
|
45
|
-
* ① 光标在字符串中间 筛选 函数、表字段
|
|
46
|
-
* ② 光标在字符串后面 如果有匹配同上面① 如果没匹配 则不显示弹框
|
|
47
|
-
* ③ 光标在字符串前面 不用理
|
|
48
|
-
* 3)函数
|
|
49
|
-
* ① 点函数名 筛选 函数、表字段
|
|
50
|
-
* ② 函数括号里面 如果光标前面是(,或者后面是)提示函数详情
|
|
51
|
-
* ③ 在)后面,显示运算符
|
|
52
|
-
* ④ 在函数名前面 不用理会
|
|
53
|
-
* 4)括号
|
|
54
|
-
* ① 光标在(后面 显示所有函数、表字段
|
|
55
|
-
* ① 光标在)后面 显示运算符弹框
|
|
56
|
-
* ② 光标在(前面 或者在)前面 都不用理会
|
|
57
|
-
* 5)运算符
|
|
58
|
-
* ① 光标在前面显示运算符弹框
|
|
59
|
-
* ② 光标在后面显示所有函数、表字段
|
|
60
|
-
* 6)起点
|
|
61
|
-
* ① 显示所有函数、表字段
|
|
62
|
-
*
|
|
63
|
-
* 2、不识别的有
|
|
64
|
-
* 1)"aaa" 双引号字符串里面的 都不提示
|
|
65
|
-
* 2)1234 数字里面
|
|
66
|
-
* 3)前面包含特殊符号 ! @ ...
|
|
67
|
-
*
|
|
68
|
-
*/
|
|
69
|
-
// [ID] + power([ID], 2) * ([ID] - [ID]) + 123 + aaa
|
|
70
|
-
function choosePopup(_ref) {
|
|
36
|
+
value: function choosePopup(_ref) {
|
|
71
37
|
var source = _ref.source,
|
|
72
38
|
targetOffset = _ref.targetOffset,
|
|
73
39
|
fields = _ref.fields;
|
|
74
40
|
var partialSource = source.slice(0, targetOffset);
|
|
75
|
-
// matchPrefix 只匹配 字符串 如:字段[id]、函数abs、字符串 aaa 其他都返回null,如果字符串外面“有双引号” 也是null
|
|
76
41
|
var matchPrefix = partialMatch(partialSource);
|
|
77
42
|
var _fields = fields.map(function (v) {
|
|
78
43
|
return v.name;
|
|
79
44
|
});
|
|
80
|
-
// ① 没有匹配到 或者匹配到字段的
|
|
81
45
|
if (!matchPrefix || _underscore["default"].last(matchPrefix) === ']') {
|
|
82
46
|
var functionDisplayName = enclosingFunction(partialSource);
|
|
83
|
-
// 匹配到在函数里面
|
|
84
47
|
if (functionDisplayName) {
|
|
85
48
|
return {
|
|
86
49
|
type: SelectPopupTypeEnum.FUNCTION_DESC,
|
|
87
50
|
functionName: functionDisplayName
|
|
88
51
|
};
|
|
89
52
|
}
|
|
90
|
-
// 匹配到是字段后面
|
|
91
53
|
if (matchPrefix && _underscore["default"].last(matchPrefix) === ']') {
|
|
92
54
|
return {
|
|
93
55
|
type: SelectPopupTypeEnum.SELECT_LIST,
|
|
@@ -98,7 +60,6 @@ var Suggest = /*#__PURE__*/function () {
|
|
|
98
60
|
}]
|
|
99
61
|
};
|
|
100
62
|
}
|
|
101
|
-
// 没有匹配到
|
|
102
63
|
if (!matchPrefix) {
|
|
103
64
|
var _partialSource = partialSource.replace(/\s/g, '');
|
|
104
65
|
var prevStr = _partialSource.substr(-1);
|
|
@@ -137,7 +98,6 @@ var Suggest = /*#__PURE__*/function () {
|
|
|
137
98
|
var funcList = Object.keys(_sqlFormula.functions).filter(function (v) {
|
|
138
99
|
return v.includes(matchPrefix);
|
|
139
100
|
});
|
|
140
|
-
// ② 匹配到前面是字符串
|
|
141
101
|
if (_underscore["default"].first(matchPrefix) !== '[') {
|
|
142
102
|
var data = [];
|
|
143
103
|
fieldList.length && data.push({
|
|
@@ -160,7 +120,6 @@ var Suggest = /*#__PURE__*/function () {
|
|
|
160
120
|
fieldList = _fields.filter(function (v) {
|
|
161
121
|
return v.includes(matchPrefix.substr(1));
|
|
162
122
|
});
|
|
163
|
-
// ③ 匹配到前面是字段
|
|
164
123
|
if (_underscore["default"].first(matchPrefix) === '[') {
|
|
165
124
|
if (fieldList.length) {
|
|
166
125
|
return {
|
|
@@ -10,7 +10,6 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
|
|
|
10
10
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/taggedTemplateLiteral"));
|
|
11
11
|
var _excluded = ["error"];
|
|
12
12
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7;
|
|
13
|
-
// @ts-nocheck
|
|
14
13
|
var t = function t(msg) {
|
|
15
14
|
return msg;
|
|
16
15
|
};
|
|
@@ -43,64 +42,14 @@ function tokenize(expression) {
|
|
|
43
42
|
var length = expression.length;
|
|
44
43
|
var index = 0;
|
|
45
44
|
var isWhiteSpace = function isWhiteSpace(cp) {
|
|
46
|
-
return cp === 0x0009 ||
|
|
47
|
-
|
|
48
|
-
cp === 0x000a ||
|
|
49
|
-
// line feed
|
|
50
|
-
cp === 0x000b ||
|
|
51
|
-
// vertical tab
|
|
52
|
-
cp === 0x000c ||
|
|
53
|
-
// form feed
|
|
54
|
-
cp === 0x000d ||
|
|
55
|
-
// carriage return
|
|
56
|
-
cp === 0x0020 ||
|
|
57
|
-
// space
|
|
58
|
-
cp === 0x0085 ||
|
|
59
|
-
// next line
|
|
60
|
-
cp === 0x00a0 ||
|
|
61
|
-
// non-breking space
|
|
62
|
-
cp === 0x1680 ||
|
|
63
|
-
// ogham space
|
|
64
|
-
cp === 0x2000 ||
|
|
65
|
-
// en quad
|
|
66
|
-
cp === 0x2001 ||
|
|
67
|
-
// em quad
|
|
68
|
-
cp === 0x2002 ||
|
|
69
|
-
// en space
|
|
70
|
-
cp === 0x2003 ||
|
|
71
|
-
// em space
|
|
72
|
-
cp === 0x2004 ||
|
|
73
|
-
// third em space
|
|
74
|
-
cp === 0x2005 ||
|
|
75
|
-
// fourth em space
|
|
76
|
-
cp === 0x2006 ||
|
|
77
|
-
// sixth em space
|
|
78
|
-
cp === 0x2007 ||
|
|
79
|
-
// figure space
|
|
80
|
-
cp === 0x2008 ||
|
|
81
|
-
// punctuation space
|
|
82
|
-
cp === 0x2009 ||
|
|
83
|
-
// thin space
|
|
84
|
-
cp === 0x200a ||
|
|
85
|
-
// hair space
|
|
86
|
-
cp === 0x2028 ||
|
|
87
|
-
// line separator
|
|
88
|
-
cp === 0x2029 ||
|
|
89
|
-
// paragraph separator
|
|
90
|
-
cp === 0x202f ||
|
|
91
|
-
// no break narrow space
|
|
92
|
-
cp === 0x205f ||
|
|
93
|
-
// four-eighteenths em space
|
|
94
|
-
cp === 0x3000;
|
|
95
|
-
}; // cjk language space
|
|
45
|
+
return cp === 0x0009 || cp === 0x000a || cp === 0x000b || cp === 0x000c || cp === 0x000d || cp === 0x0020 || cp === 0x0085 || cp === 0x00a0 || cp === 0x1680 || cp === 0x2000 || cp === 0x2001 || cp === 0x2002 || cp === 0x2003 || cp === 0x2004 || cp === 0x2005 || cp === 0x2006 || cp === 0x2007 || cp === 0x2008 || cp === 0x2009 || cp === 0x200a || cp === 0x2028 || cp === 0x2029 || cp === 0x202f || cp === 0x205f || cp === 0x3000;
|
|
46
|
+
};
|
|
96
47
|
var isDigit = function isDigit(cp) {
|
|
97
48
|
return cp >= 0x30 && cp <= 0x39;
|
|
98
|
-
};
|
|
49
|
+
};
|
|
99
50
|
var isAlpha = function isAlpha(cp) {
|
|
100
|
-
return cp >= 0x41 && cp <= 0x5a ||
|
|
101
|
-
|
|
102
|
-
cp >= 0x61 && cp <= 0x7a;
|
|
103
|
-
}; // a..z
|
|
51
|
+
return cp >= 0x41 && cp <= 0x5a || cp >= 0x61 && cp <= 0x7a;
|
|
52
|
+
};
|
|
104
53
|
var skipWhitespaces = function skipWhitespaces() {
|
|
105
54
|
while (index < length) {
|
|
106
55
|
var cp = source.charCodeAt(index);
|
|
@@ -128,14 +77,11 @@ function tokenize(expression) {
|
|
|
128
77
|
case OPERATOR.GreaterThan:
|
|
129
78
|
++index;
|
|
130
79
|
if (source[index] === OPERATOR.Equal) {
|
|
131
|
-
// OPERATOR.LessThanEqual (<=) or
|
|
132
|
-
// OPERATOR.GreaterThanEqual (>=)
|
|
133
80
|
++index;
|
|
134
81
|
}
|
|
135
82
|
break;
|
|
136
83
|
case '!':
|
|
137
84
|
if (source[start + 1] === OPERATOR.Equal) {
|
|
138
|
-
// OPERATOR.NotEqual (!=)
|
|
139
85
|
index += 2;
|
|
140
86
|
}
|
|
141
87
|
break;
|
|
@@ -294,7 +240,6 @@ function tokenize(expression) {
|
|
|
294
240
|
error: _error2
|
|
295
241
|
};
|
|
296
242
|
} else if (ch === '\\') {
|
|
297
|
-
// ignore the next char, even if it's [ or ]
|
|
298
243
|
index++;
|
|
299
244
|
}
|
|
300
245
|
}
|
|
@@ -311,12 +256,10 @@ function tokenize(expression) {
|
|
|
311
256
|
};
|
|
312
257
|
var isIdentifierStart = function isIdentifierStart(cp) {
|
|
313
258
|
return isAlpha(cp) || cp === 0x5f;
|
|
314
|
-
};
|
|
259
|
+
};
|
|
315
260
|
var isIdentifierChar = function isIdentifierChar(cp) {
|
|
316
|
-
return isAlpha(cp) || isDigit(cp) || cp === 0x2e ||
|
|
317
|
-
|
|
318
|
-
cp === 0x5f;
|
|
319
|
-
}; // underscore
|
|
261
|
+
return isAlpha(cp) || isDigit(cp) || cp === 0x2e || cp === 0x5f;
|
|
262
|
+
};
|
|
320
263
|
var scanIdentifier = function scanIdentifier() {
|
|
321
264
|
var start = index;
|
|
322
265
|
var initial = source.charCodeAt(start);
|
|
@@ -14,7 +14,6 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
14
14
|
var _locale = require("../../../locale");
|
|
15
15
|
var _expressionEditor = _interopRequireDefault(require("./expression-editor"));
|
|
16
16
|
var WIDTH = 480;
|
|
17
|
-
// 自定义列
|
|
18
17
|
var CustomColumn = function CustomColumn(_ref) {
|
|
19
18
|
var value = _ref.value,
|
|
20
19
|
_ref$data = _ref.data,
|
|
@@ -25,13 +24,12 @@ var CustomColumn = function CustomColumn(_ref) {
|
|
|
25
24
|
var _useState = (0, _react.useState)((value === null || value === void 0 ? void 0 : value.name) || ''),
|
|
26
25
|
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
27
26
|
name = _useState2[0],
|
|
28
|
-
setName = _useState2[1];
|
|
27
|
+
setName = _useState2[1];
|
|
29
28
|
var _useState3 = (0, _react.useState)(''),
|
|
30
29
|
_useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
|
|
31
30
|
expression = _useState4[0],
|
|
32
|
-
setExpression = _useState4[1];
|
|
31
|
+
setExpression = _useState4[1];
|
|
33
32
|
var isUpdate = !!value;
|
|
34
|
-
// 提交按钮是否可用
|
|
35
33
|
var usable = (0, _react.useMemo)(function () {
|
|
36
34
|
return expression && name;
|
|
37
35
|
}, [expression, name]);
|
|
@@ -17,7 +17,7 @@ require("./tokenized-expression.less");
|
|
|
17
17
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
18
18
|
var _tokenizer = require("./expressions/tokenizer");
|
|
19
19
|
var _config = require("./config");
|
|
20
|
-
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, (0, _isNativeReflectConstruct2["default"])() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
|
|
20
|
+
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, (0, _isNativeReflectConstruct2["default"])() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
|
|
21
21
|
function mapTokenType(token) {
|
|
22
22
|
var type = token.type,
|
|
23
23
|
op = token.op;
|
|
@@ -29,7 +29,6 @@ function mapTokenType(token) {
|
|
|
29
29
|
case _tokenizer.TOKEN.String:
|
|
30
30
|
return 'string-literal';
|
|
31
31
|
case _tokenizer.TOKEN.Identifier:
|
|
32
|
-
// FIXME metric vs dimension vs segment
|
|
33
32
|
return 'dimension';
|
|
34
33
|
default:
|
|
35
34
|
return 'token';
|
|
@@ -68,7 +67,7 @@ function createSpans(source) {
|
|
|
68
67
|
}
|
|
69
68
|
return spans;
|
|
70
69
|
}
|
|
71
|
-
var TokenizedExpression = exports["default"] =
|
|
70
|
+
var TokenizedExpression = exports["default"] = function (_React$Component) {
|
|
72
71
|
function TokenizedExpression() {
|
|
73
72
|
(0, _classCallCheck2["default"])(this, TokenizedExpression);
|
|
74
73
|
return _callSuper(this, TokenizedExpression, arguments);
|
|
@@ -22,7 +22,7 @@ var _selection = require("../../../utils/selection");
|
|
|
22
22
|
var _tokenizedExpression = _interopRequireDefault(require("./tokenized-expression"));
|
|
23
23
|
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); }
|
|
24
24
|
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, (0, _isNativeReflectConstruct2["default"])() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
|
|
25
|
-
var TokenizedInput =
|
|
25
|
+
var TokenizedInput = function (_React$Component) {
|
|
26
26
|
function TokenizedInput() {
|
|
27
27
|
var _this;
|
|
28
28
|
(0, _classCallCheck2["default"])(this, TokenizedInput);
|