@itwin/grouping-mapping-widget 0.3.5 → 0.5.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/formula/FormulaDataTypeResolver.d.ts +12 -0
- package/lib/cjs/formula/FormulaDataTypeResolver.js +50 -0
- package/lib/cjs/formula/FormulaDataTypeResolver.js.map +1 -0
- package/lib/cjs/formula/FormulaFunctionProvider.js +59 -59
- package/lib/cjs/formula/FormulaFunctionProvider.js.map +1 -1
- package/lib/cjs/formula/FormulaOperatorsProvider.js +7 -7
- package/lib/cjs/formula/FormulaOperatorsProvider.js.map +1 -1
- package/lib/cjs/formula/FormulaTokensDataTypeResolver.d.ts +6 -0
- package/lib/cjs/formula/{FormulaTokensValidator.js → FormulaTokensDataTypeResolver.js} +32 -32
- package/lib/cjs/formula/FormulaTokensDataTypeResolver.js.map +1 -0
- package/lib/cjs/formula/Types.d.ts +2 -2
- package/lib/cjs/formula/Types.js.map +1 -1
- package/lib/cjs/grouping-mapping-widget.d.ts +9 -0
- package/lib/cjs/grouping-mapping-widget.js +9 -1
- package/lib/cjs/grouping-mapping-widget.js.map +1 -1
- package/lib/cjs/widget/GroupingMappingWidget.d.ts +3 -4
- package/lib/cjs/widget/GroupingMappingWidget.js +3 -4
- package/lib/cjs/widget/GroupingMappingWidget.js.map +1 -1
- package/lib/cjs/widget/IMappingClient.d.ts +327 -0
- package/lib/cjs/widget/IMappingClient.js +7 -0
- package/lib/cjs/widget/IMappingClient.js.map +1 -0
- package/lib/cjs/widget/components/CalculatedPropertyAction.js +7 -5
- package/lib/cjs/widget/components/CalculatedPropertyAction.js.map +1 -1
- package/lib/cjs/widget/components/CalculatedPropertyTable.js +6 -5
- package/lib/cjs/widget/components/CalculatedPropertyTable.js.map +1 -1
- package/lib/cjs/widget/components/ConfirmMappingsImport.js +6 -4
- package/lib/cjs/widget/components/ConfirmMappingsImport.js.map +1 -1
- package/lib/cjs/widget/components/CustomCalculationAction.js +7 -5
- package/lib/cjs/widget/components/CustomCalculationAction.js.map +1 -1
- package/lib/cjs/widget/components/CustomCalculationTable.js +6 -5
- package/lib/cjs/widget/components/CustomCalculationTable.js.map +1 -1
- package/lib/cjs/widget/components/GroupAction.d.ts +2 -1
- package/lib/cjs/widget/components/GroupAction.js +21 -13
- package/lib/cjs/widget/components/GroupAction.js.map +1 -1
- package/lib/cjs/widget/components/GroupPropertyAction.js +19 -9
- package/lib/cjs/widget/components/GroupPropertyAction.js.map +1 -1
- package/lib/cjs/widget/components/GroupPropertyTable.js +6 -5
- package/lib/cjs/widget/components/GroupPropertyTable.js.map +1 -1
- package/lib/cjs/widget/components/GroupQueryBuilderContainer.js +8 -5
- package/lib/cjs/widget/components/GroupQueryBuilderContainer.js.map +1 -1
- package/lib/cjs/widget/components/GroupTile.d.ts +13 -0
- package/lib/cjs/widget/components/GroupTile.js +18 -0
- package/lib/cjs/widget/components/GroupTile.js.map +1 -0
- package/lib/cjs/widget/components/GroupTile.scss +32 -0
- package/lib/cjs/widget/components/Grouping.js +215 -165
- package/lib/cjs/widget/components/Grouping.js.map +1 -1
- package/lib/cjs/widget/components/Grouping.scss +39 -4
- package/lib/cjs/widget/components/GroupingMapping.d.ts +18 -11
- package/lib/cjs/widget/components/GroupingMapping.js +24 -15
- package/lib/cjs/widget/components/GroupingMapping.js.map +1 -1
- package/lib/cjs/widget/components/Mapping.js +20 -16
- package/lib/cjs/widget/components/Mapping.js.map +1 -1
- package/lib/cjs/widget/components/MappingAction.js +7 -5
- package/lib/cjs/widget/components/MappingAction.js.map +1 -1
- package/lib/cjs/widget/components/PropertyMenu.js +17 -18
- package/lib/cjs/widget/components/PropertyMenu.js.map +1 -1
- package/lib/cjs/widget/components/QueryBuilder.d.ts +10 -5
- package/lib/cjs/widget/components/QueryBuilder.js +223 -142
- package/lib/cjs/widget/components/QueryBuilder.js.map +1 -1
- package/lib/cjs/widget/components/SelectIModel.js +13 -4
- package/lib/cjs/widget/components/SelectIModel.js.map +1 -1
- package/lib/cjs/widget/components/SelectMappings.js +9 -7
- package/lib/cjs/widget/components/SelectMappings.js.map +1 -1
- package/lib/cjs/widget/components/SelectProject.js +13 -4
- package/lib/cjs/widget/components/SelectProject.js.map +1 -1
- package/lib/cjs/widget/components/{GroupQueryBuilderContext.d.ts → context/GroupQueryBuilderContext.d.ts} +2 -1
- package/lib/cjs/widget/components/{GroupQueryBuilderContext.js → context/GroupQueryBuilderContext.js} +2 -1
- package/lib/cjs/widget/components/context/GroupQueryBuilderContext.js.map +1 -0
- package/lib/cjs/widget/components/context/GroupingApiConfigContext.d.ts +11 -0
- package/lib/cjs/widget/components/context/GroupingApiConfigContext.js +37 -0
- package/lib/cjs/widget/components/context/GroupingApiConfigContext.js.map +1 -0
- package/lib/cjs/widget/components/context/MappingClientContext.d.ts +7 -0
- package/lib/cjs/widget/components/context/MappingClientContext.js +30 -0
- package/lib/cjs/widget/components/context/MappingClientContext.js.map +1 -0
- package/lib/cjs/widget/components/property-grid/PropertyGrid.d.ts +1 -1
- package/lib/cjs/widget/components/property-grid/PropertyGrid.js +5 -5
- package/lib/cjs/widget/components/property-grid/PropertyGrid.js.map +1 -1
- package/lib/cjs/widget/components/property-grid/PropertyGridWrapper.d.ts +1 -1
- package/lib/cjs/widget/components/property-grid/PropertyGridWrapper.js +2 -2
- package/lib/cjs/widget/components/property-grid/PropertyGridWrapper.js.map +1 -1
- package/lib/cjs/widget/components/property-grid/PropertyView.js +14 -6
- package/lib/cjs/widget/components/property-grid/PropertyView.js.map +1 -1
- package/lib/cjs/widget/components/utils.d.ts +6 -2
- package/lib/cjs/widget/components/utils.js +9 -13
- package/lib/cjs/widget/components/utils.js.map +1 -1
- package/lib/cjs/widget/components/utils.scss +12 -3
- package/lib/cjs/widget/components/viewerUtils.d.ts +19 -0
- package/lib/cjs/widget/components/viewerUtils.js +224 -3
- package/lib/cjs/widget/components/viewerUtils.js.map +1 -1
- package/lib/cjs/widget/hooks/useFormulaValidation.js +3 -2
- package/lib/cjs/widget/hooks/useFormulaValidation.js.map +1 -1
- package/lib/esm/formula/FormulaDataTypeResolver.d.ts +12 -0
- package/lib/esm/formula/FormulaDataTypeResolver.js +46 -0
- package/lib/esm/formula/FormulaDataTypeResolver.js.map +1 -0
- package/lib/esm/formula/FormulaFunctionProvider.js +59 -59
- package/lib/esm/formula/FormulaFunctionProvider.js.map +1 -1
- package/lib/esm/formula/FormulaOperatorsProvider.js +7 -7
- package/lib/esm/formula/FormulaOperatorsProvider.js.map +1 -1
- package/lib/esm/formula/FormulaTokensDataTypeResolver.d.ts +6 -0
- package/lib/esm/formula/{FormulaTokensValidator.js → FormulaTokensDataTypeResolver.js} +30 -30
- package/lib/esm/formula/FormulaTokensDataTypeResolver.js.map +1 -0
- package/lib/esm/formula/Types.d.ts +2 -2
- package/lib/esm/formula/Types.js.map +1 -1
- package/lib/esm/grouping-mapping-widget.d.ts +9 -0
- package/lib/esm/grouping-mapping-widget.js +6 -0
- package/lib/esm/grouping-mapping-widget.js.map +1 -1
- package/lib/esm/widget/GroupingMappingWidget.d.ts +3 -4
- package/lib/esm/widget/GroupingMappingWidget.js +3 -4
- package/lib/esm/widget/GroupingMappingWidget.js.map +1 -1
- package/lib/esm/widget/IMappingClient.d.ts +327 -0
- package/lib/esm/widget/IMappingClient.js +6 -0
- package/lib/esm/widget/IMappingClient.js.map +1 -0
- package/lib/esm/widget/components/CalculatedPropertyAction.js +9 -7
- package/lib/esm/widget/components/CalculatedPropertyAction.js.map +1 -1
- package/lib/esm/widget/components/CalculatedPropertyTable.js +7 -6
- package/lib/esm/widget/components/CalculatedPropertyTable.js.map +1 -1
- package/lib/esm/widget/components/ConfirmMappingsImport.js +8 -6
- package/lib/esm/widget/components/ConfirmMappingsImport.js.map +1 -1
- package/lib/esm/widget/components/CustomCalculationAction.js +9 -7
- package/lib/esm/widget/components/CustomCalculationAction.js.map +1 -1
- package/lib/esm/widget/components/CustomCalculationTable.js +7 -6
- package/lib/esm/widget/components/CustomCalculationTable.js.map +1 -1
- package/lib/esm/widget/components/GroupAction.d.ts +2 -1
- package/lib/esm/widget/components/GroupAction.js +24 -16
- package/lib/esm/widget/components/GroupAction.js.map +1 -1
- package/lib/esm/widget/components/GroupPropertyAction.js +21 -11
- package/lib/esm/widget/components/GroupPropertyAction.js.map +1 -1
- package/lib/esm/widget/components/GroupPropertyTable.js +7 -6
- package/lib/esm/widget/components/GroupPropertyTable.js.map +1 -1
- package/lib/esm/widget/components/GroupQueryBuilderContainer.js +8 -5
- package/lib/esm/widget/components/GroupQueryBuilderContainer.js.map +1 -1
- package/lib/esm/widget/components/GroupTile.d.ts +13 -0
- package/lib/esm/widget/components/GroupTile.js +11 -0
- package/lib/esm/widget/components/GroupTile.js.map +1 -0
- package/lib/esm/widget/components/GroupTile.scss +32 -0
- package/lib/esm/widget/components/Grouping.js +220 -170
- package/lib/esm/widget/components/Grouping.js.map +1 -1
- package/lib/esm/widget/components/Grouping.scss +39 -4
- package/lib/esm/widget/components/GroupingMapping.d.ts +18 -11
- package/lib/esm/widget/components/GroupingMapping.js +25 -15
- package/lib/esm/widget/components/GroupingMapping.js.map +1 -1
- package/lib/esm/widget/components/Mapping.js +22 -18
- package/lib/esm/widget/components/Mapping.js.map +1 -1
- package/lib/esm/widget/components/MappingAction.js +9 -7
- package/lib/esm/widget/components/MappingAction.js.map +1 -1
- package/lib/esm/widget/components/PropertyMenu.js +20 -21
- package/lib/esm/widget/components/PropertyMenu.js.map +1 -1
- package/lib/esm/widget/components/QueryBuilder.d.ts +10 -5
- package/lib/esm/widget/components/QueryBuilder.js +224 -143
- package/lib/esm/widget/components/QueryBuilder.js.map +1 -1
- package/lib/esm/widget/components/SelectIModel.js +14 -5
- package/lib/esm/widget/components/SelectIModel.js.map +1 -1
- package/lib/esm/widget/components/SelectMappings.js +11 -9
- package/lib/esm/widget/components/SelectMappings.js.map +1 -1
- package/lib/esm/widget/components/SelectProject.js +14 -5
- package/lib/esm/widget/components/SelectProject.js.map +1 -1
- package/lib/esm/widget/components/{GroupQueryBuilderContext.d.ts → context/GroupQueryBuilderContext.d.ts} +2 -1
- package/lib/esm/widget/components/{GroupQueryBuilderContext.js → context/GroupQueryBuilderContext.js} +2 -1
- package/lib/esm/widget/components/context/GroupQueryBuilderContext.js.map +1 -0
- package/lib/esm/widget/components/context/GroupingApiConfigContext.d.ts +11 -0
- package/lib/esm/widget/components/context/GroupingApiConfigContext.js +14 -0
- package/lib/esm/widget/components/context/GroupingApiConfigContext.js.map +1 -0
- package/lib/esm/widget/components/context/MappingClientContext.d.ts +7 -0
- package/lib/esm/widget/components/context/MappingClientContext.js +25 -0
- package/lib/esm/widget/components/context/MappingClientContext.js.map +1 -0
- package/lib/esm/widget/components/property-grid/PropertyGrid.d.ts +1 -1
- package/lib/esm/widget/components/property-grid/PropertyGrid.js +6 -6
- package/lib/esm/widget/components/property-grid/PropertyGrid.js.map +1 -1
- package/lib/esm/widget/components/property-grid/PropertyGridWrapper.d.ts +1 -1
- package/lib/esm/widget/components/property-grid/PropertyGridWrapper.js +2 -2
- package/lib/esm/widget/components/property-grid/PropertyGridWrapper.js.map +1 -1
- package/lib/esm/widget/components/property-grid/PropertyView.js +14 -6
- package/lib/esm/widget/components/property-grid/PropertyView.js.map +1 -1
- package/lib/esm/widget/components/utils.d.ts +6 -2
- package/lib/esm/widget/components/utils.js +6 -11
- package/lib/esm/widget/components/utils.js.map +1 -1
- package/lib/esm/widget/components/utils.scss +12 -3
- package/lib/esm/widget/components/viewerUtils.d.ts +19 -0
- package/lib/esm/widget/components/viewerUtils.js +207 -3
- package/lib/esm/widget/components/viewerUtils.js.map +1 -1
- package/lib/esm/widget/hooks/useFormulaValidation.js +3 -2
- package/lib/esm/widget/hooks/useFormulaValidation.js.map +1 -1
- package/package.json +29 -29
- package/lib/cjs/formula/FormulaTokensValidator.d.ts +0 -5
- package/lib/cjs/formula/FormulaTokensValidator.js.map +0 -1
- package/lib/cjs/formula/FormulaValidator.d.ts +0 -3
- package/lib/cjs/formula/FormulaValidator.js +0 -35
- package/lib/cjs/formula/FormulaValidator.js.map +0 -1
- package/lib/cjs/widget/components/GroupQueryBuilderContext.js.map +0 -1
- package/lib/esm/formula/FormulaTokensValidator.d.ts +0 -5
- package/lib/esm/formula/FormulaTokensValidator.js.map +0 -1
- package/lib/esm/formula/FormulaValidator.d.ts +0 -3
- package/lib/esm/formula/FormulaValidator.js +0 -31
- package/lib/esm/formula/FormulaValidator.js.map +0 -1
- package/lib/esm/widget/components/GroupQueryBuilderContext.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.resolveTokensDataType = void 0;
|
|
4
4
|
/*---------------------------------------------------------------------------------------------
|
|
5
5
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
6
6
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
@@ -21,49 +21,49 @@ function isNumericalConstant(name) {
|
|
|
21
21
|
"sqrt2",
|
|
22
22
|
].includes(name.toLowerCase());
|
|
23
23
|
}
|
|
24
|
-
function
|
|
24
|
+
function resolveTokensDataType(formulaName, tokens, properties) {
|
|
25
25
|
if (tokens.length === 0)
|
|
26
|
-
return "Formula cannot be empty.";
|
|
26
|
+
return { errorMessage: "Formula cannot be empty." };
|
|
27
27
|
const argStack = new Stack_1.Stack();
|
|
28
28
|
while (tokens.length > 0) {
|
|
29
29
|
const token = tokens.dequeue();
|
|
30
30
|
switch (token.type) {
|
|
31
31
|
case InfixToPostfixConverter_1.TokenType.Number:
|
|
32
|
-
argStack.push("
|
|
32
|
+
argStack.push("Number");
|
|
33
33
|
break;
|
|
34
34
|
case InfixToPostfixConverter_1.TokenType.String:
|
|
35
|
-
argStack.push("
|
|
35
|
+
argStack.push("String");
|
|
36
36
|
break;
|
|
37
37
|
case InfixToPostfixConverter_1.TokenType.Boolean:
|
|
38
|
-
argStack.push("
|
|
38
|
+
argStack.push("Boolean");
|
|
39
39
|
break;
|
|
40
40
|
case InfixToPostfixConverter_1.TokenType.Null:
|
|
41
|
-
argStack.push("
|
|
41
|
+
argStack.push("Undefined");
|
|
42
42
|
break;
|
|
43
43
|
case InfixToPostfixConverter_1.TokenType.Variable:
|
|
44
44
|
const isConstant = isNumericalConstant(token.value);
|
|
45
45
|
if (isConstant) {
|
|
46
|
-
argStack.push("
|
|
46
|
+
argStack.push("Number");
|
|
47
47
|
}
|
|
48
48
|
else {
|
|
49
49
|
if (token.value === formulaName)
|
|
50
|
-
return "Formula cannot reference itself.";
|
|
50
|
+
return { errorMessage: "Formula cannot reference itself." };
|
|
51
51
|
const prop = properties[token.value];
|
|
52
52
|
if (!prop)
|
|
53
|
-
return `Variable "${token.value}" is not available
|
|
53
|
+
return { errorMessage: `Variable "${token.value}" is not available.` };
|
|
54
54
|
argStack.push(prop);
|
|
55
55
|
}
|
|
56
56
|
break;
|
|
57
57
|
case InfixToPostfixConverter_1.TokenType.Operator:
|
|
58
58
|
if (!FormulaOperatorsProvider_1.isOperator(token.value))
|
|
59
|
-
return `Operator "${token.value}" is not supported
|
|
59
|
+
return { errorMessage: `Operator "${token.value}" is not supported.` };
|
|
60
60
|
const operatorBounds = FormulaOperatorsProvider_1.getOperatorArgumentCountBounds(token.value);
|
|
61
61
|
if (!operatorBounds)
|
|
62
|
-
return `Operator "${token.value}" is not supported
|
|
62
|
+
return { errorMessage: `Operator "${token.value}" is not supported.` };
|
|
63
63
|
if (operatorBounds[0] === 2 && token.argCount === 1)
|
|
64
|
-
return `Unary operator "${token.value}" is not supported
|
|
64
|
+
return { errorMessage: `Unary operator "${token.value}" is not supported.` };
|
|
65
65
|
if (argStack.length < token.argCount) {
|
|
66
|
-
return `Too few arguments given for ${token.argCount === 1 ? "unary" : "binary"} operator "${token.value}"
|
|
66
|
+
return { errorMessage: `Too few arguments given for ${token.argCount === 1 ? "unary" : "binary"} operator "${token.value}".` };
|
|
67
67
|
}
|
|
68
68
|
const opArgs = argStack.popN(token.argCount).reverse();
|
|
69
69
|
let operationResult;
|
|
@@ -72,66 +72,66 @@ function validateTokens(formulaName, tokens, properties) {
|
|
|
72
72
|
else if (opArgs.length === 2)
|
|
73
73
|
operationResult = FormulaOperatorsProvider_1.getOperatorReturnType(token.value, opArgs[0], opArgs[1]);
|
|
74
74
|
else
|
|
75
|
-
return `Operator "${token.value}" does not support ${token.argCount} operands
|
|
75
|
+
return { errorMessage: `Operator "${token.value}" does not support ${token.argCount} operands.` };
|
|
76
76
|
if (operationResult.errorMessage)
|
|
77
|
-
return operationResult.errorMessage;
|
|
77
|
+
return { errorMessage: operationResult.errorMessage };
|
|
78
78
|
else
|
|
79
79
|
argStack.push(operationResult.value);
|
|
80
80
|
break;
|
|
81
81
|
case InfixToPostfixConverter_1.TokenType.Function:
|
|
82
82
|
const fnArg = FormulaFunctionProvider_1.getFunction(token.value);
|
|
83
83
|
if (!fnArg)
|
|
84
|
-
return `Function "${token.value}" is not supported
|
|
84
|
+
return { errorMessage: `Function "${token.value}" is not supported.` };
|
|
85
85
|
const fnArgBounds = fnArg.argumentCountBounds;
|
|
86
86
|
if (fnArgBounds[0] === 0 && fnArgBounds[1] === 0 && token.argCount > 0) {
|
|
87
|
-
return `Function "${token.value}" does not accept any arguments
|
|
87
|
+
return { errorMessage: `Function "${token.value}" does not accept any arguments.` };
|
|
88
88
|
}
|
|
89
89
|
else if (fnArgBounds[1] === -1 && token.argCount < fnArgBounds[0]) {
|
|
90
90
|
if (fnArgBounds[0] === 1) {
|
|
91
|
-
return `Function "${token.value}" requires at least 1 argument
|
|
91
|
+
return { errorMessage: `Function "${token.value}" requires at least 1 argument.` };
|
|
92
92
|
}
|
|
93
93
|
else {
|
|
94
94
|
if (token.argCount === 1) {
|
|
95
|
-
return `Function "${token.value}" requires at least ${fnArgBounds[0]} arguments, but only 1 argument was given
|
|
95
|
+
return { errorMessage: `Function "${token.value}" requires at least ${fnArgBounds[0]} arguments, but only 1 argument was given.` };
|
|
96
96
|
}
|
|
97
97
|
else {
|
|
98
|
-
return `Function "${token.value}" requires at least ${fnArgBounds[0]} arguments, but only ${token.argCount} arguments were given
|
|
98
|
+
return { errorMessage: `Function "${token.value}" requires at least ${fnArgBounds[0]} arguments, but only ${token.argCount} arguments were given.` };
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
else if (fnArgBounds[0] === fnArgBounds[1] && token.argCount !== fnArgBounds[0]) {
|
|
103
103
|
if (fnArgBounds[0] === 1) {
|
|
104
|
-
return `Function "${token.value}" requires exactly 1 argument, but ${token.argCount} arguments were given
|
|
104
|
+
return { errorMessage: `Function "${token.value}" requires exactly 1 argument, but ${token.argCount} arguments were given.` };
|
|
105
105
|
}
|
|
106
106
|
else {
|
|
107
107
|
if (token.argCount === 1) {
|
|
108
|
-
return `Function "${token.value}" requires exactly ${fnArgBounds[0]} arguments, but 1 argument was given
|
|
108
|
+
return { errorMessage: `Function "${token.value}" requires exactly ${fnArgBounds[0]} arguments, but 1 argument was given.` };
|
|
109
109
|
}
|
|
110
110
|
else {
|
|
111
|
-
return `Function "${token.value}" requires exactly ${fnArgBounds[0]} arguments, but ${token.argCount} arguments were given
|
|
111
|
+
return { errorMessage: `Function "${token.value}" requires exactly ${fnArgBounds[0]} arguments, but ${token.argCount} arguments were given.` };
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
115
|
const fArgs = argStack.popN(token.argCount).reverse();
|
|
116
116
|
if (fArgs.length < token.argCount) {
|
|
117
|
-
return `Too few arguments given for function "${token.value}"
|
|
117
|
+
return { errorMessage: `Too few arguments given for function "${token.value}".` };
|
|
118
118
|
}
|
|
119
119
|
const functionResult = FormulaFunctionProvider_1.getFormulaFunctionReturnType(fnArg, fArgs);
|
|
120
120
|
if (functionResult.errorMessage)
|
|
121
|
-
return `Function "${token.value}" is invalid. ${functionResult.errorMessage}
|
|
121
|
+
return { errorMessage: `Function "${token.value}" is invalid. ${functionResult.errorMessage}` };
|
|
122
122
|
else
|
|
123
123
|
argStack.push(functionResult.value);
|
|
124
124
|
break;
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
127
|
if (argStack.length !== 1) {
|
|
128
|
-
return "Formula is invalid.";
|
|
128
|
+
return { errorMessage: "Formula is invalid." };
|
|
129
129
|
}
|
|
130
130
|
const resultType = argStack.pop();
|
|
131
|
-
if (!resultType || resultType === "
|
|
132
|
-
return "Formula cannot always return null.";
|
|
131
|
+
if (!resultType || resultType === "Undefined") {
|
|
132
|
+
return { errorMessage: "Formula cannot always return null." };
|
|
133
133
|
}
|
|
134
|
-
return
|
|
134
|
+
return { value: resultType };
|
|
135
135
|
}
|
|
136
|
-
exports.
|
|
137
|
-
//# sourceMappingURL=
|
|
136
|
+
exports.resolveTokensDataType = resolveTokensDataType;
|
|
137
|
+
//# sourceMappingURL=FormulaTokensDataTypeResolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormulaTokensDataTypeResolver.js","sourceRoot":"","sources":["../../../src/formula/FormulaTokensDataTypeResolver.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,uEAAsF;AACtF,yEAA+G;AAE/G,uEAAsD;AAGtD,mCAAgC;AAGhC,SAAS,mBAAmB,CAAC,IAAY;IACvC,OAAO;QACL,GAAG;QACH,KAAK;QACL,MAAM;QACN,OAAO;QACP,QAAQ;QACR,IAAI;QACJ,SAAS;QACT,OAAO;KACR,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;AACjC,CAAC;AAED,SAAgB,qBAAqB,CAAC,WAAmB,EAAE,MAAoB,EAAE,UAAuB;IACtG,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QACrB,OAAO,EAAE,YAAY,EAAE,0BAA0B,EAAE,CAAC;IAEtD,MAAM,QAAQ,GAAG,IAAI,aAAK,EAAoB,CAAC;IAE/C,OAAO,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE;QACxB,MAAM,KAAK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ED,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC;AAC/B,CAAC;AAzHD,sDAyHC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport { getFormulaFunctionReturnType, getFunction } from \"./FormulaFunctionProvider\";\nimport { getOperatorArgumentCountBounds, getOperatorReturnType, isOperator } from \"./FormulaOperatorsProvider\";\nimport type { Token } from \"./InfixToPostfixConverter\";\nimport { TokenType } from \"./InfixToPostfixConverter\";\nimport type { IResult } from \"./IResult\";\nimport type { Queue } from \"./Queue\";\nimport { Stack } from \"./Stack\";\nimport type { DataType, PossibleDataType, PropertyMap } from \"./Types\";\n\nfunction isNumericalConstant(name: string): boolean {\n return [\n \"e\",\n \"ln2\",\n \"ln10\",\n \"log2e\",\n \"log10e\",\n \"pi\",\n \"sqrt1_2\",\n \"sqrt2\",\n ].includes(name.toLowerCase());\n}\n\nexport function resolveTokensDataType(formulaName: string, tokens: Queue<Token>, properties: PropertyMap): IResult<DataType> {\n if (tokens.length === 0)\n return { errorMessage: \"Formula cannot be empty.\" };\n\n const argStack = new Stack<PossibleDataType>();\n\n while (tokens.length > 0) {\n const token = tokens.dequeue()!;\n\n switch (token.type) {\n case TokenType.Number:\n argStack.push(\"Number\");\n break;\n case TokenType.String:\n argStack.push(\"String\");\n break;\n case TokenType.Boolean:\n argStack.push(\"Boolean\");\n break;\n case TokenType.Null:\n argStack.push(\"Undefined\");\n break;\n case TokenType.Variable:\n const isConstant = isNumericalConstant(token.value);\n if (isConstant) {\n argStack.push(\"Number\");\n } else {\n if (token.value === formulaName)\n return { errorMessage: \"Formula cannot reference itself.\" };\n\n const prop = properties[token.value];\n if (!prop)\n return { errorMessage: `Variable \"${token.value}\" is not available.` };\n\n argStack.push(prop);\n }\n break;\n case TokenType.Operator:\n if (!isOperator(token.value))\n return { errorMessage: `Operator \"${token.value}\" is not supported.` };\n\n const operatorBounds = getOperatorArgumentCountBounds(token.value);\n if (!operatorBounds)\n return { errorMessage: `Operator \"${token.value}\" is not supported.` };\n\n if (operatorBounds[0] === 2 && token.argCount === 1)\n return { errorMessage: `Unary operator \"${token.value}\" is not supported.` };\n\n if (argStack.length < token.argCount) {\n return { errorMessage: `Too few arguments given for ${token.argCount === 1 ? \"unary\" : \"binary\"} operator \"${token.value}\".` };\n }\n const opArgs = argStack.popN(token.argCount).reverse();\n let operationResult;\n if (opArgs.length === 1)\n operationResult = getOperatorReturnType(token.value, opArgs[0]);\n else if (opArgs.length === 2)\n operationResult = getOperatorReturnType(token.value, opArgs[0], opArgs[1]);\n else\n return { errorMessage: `Operator \"${token.value}\" does not support ${token.argCount} operands.` };\n\n if (operationResult.errorMessage)\n return { errorMessage: operationResult.errorMessage };\n else\n argStack.push(operationResult.value!);\n\n break;\n case TokenType.Function:\n const fnArg = getFunction(token.value);\n if (!fnArg)\n return { errorMessage: `Function \"${token.value}\" is not supported.` };\n\n const fnArgBounds = fnArg.argumentCountBounds;\n if (fnArgBounds[0] === 0 && fnArgBounds[1] === 0 && token.argCount > 0) {\n return { errorMessage: `Function \"${token.value}\" does not accept any arguments.` };\n } else if (fnArgBounds[1] === -1 && token.argCount < fnArgBounds[0]) {\n if (fnArgBounds[0] === 1) {\n return { errorMessage: `Function \"${token.value}\" requires at least 1 argument.` };\n } else {\n if (token.argCount === 1) {\n return { errorMessage: `Function \"${token.value}\" requires at least ${fnArgBounds[0]} arguments, but only 1 argument was given.` };\n } else {\n return { errorMessage: `Function \"${token.value}\" requires at least ${fnArgBounds[0]} arguments, but only ${token.argCount} arguments were given.` };\n }\n }\n } else if (fnArgBounds[0] === fnArgBounds[1] && token.argCount !== fnArgBounds[0]) {\n if (fnArgBounds[0] === 1) {\n return { errorMessage: `Function \"${token.value}\" requires exactly 1 argument, but ${token.argCount} arguments were given.` };\n } else {\n if (token.argCount === 1) {\n return { errorMessage: `Function \"${token.value}\" requires exactly ${fnArgBounds[0]} arguments, but 1 argument was given.` };\n } else {\n return { errorMessage: `Function \"${token.value}\" requires exactly ${fnArgBounds[0]} arguments, but ${token.argCount} arguments were given.` };\n }\n }\n }\n\n const fArgs = argStack.popN(token.argCount).reverse();\n if (fArgs.length < token.argCount) {\n return { errorMessage: `Too few arguments given for function \"${token.value}\".` };\n }\n\n const functionResult = getFormulaFunctionReturnType(fnArg, fArgs);\n if (functionResult.errorMessage)\n return { errorMessage: `Function \"${token.value}\" is invalid. ${functionResult.errorMessage}` };\n else\n argStack.push(functionResult.value!);\n\n break;\n }\n }\n\n if (argStack.length !== 1) {\n return { errorMessage: \"Formula is invalid.\" };\n }\n\n const resultType = argStack.pop();\n if (!resultType || resultType === \"Undefined\") {\n return { errorMessage: \"Formula cannot always return null.\" };\n }\n\n return { value: resultType };\n}\n\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare type ValueType = number | string | boolean;
|
|
2
2
|
export declare type PossibleValueType = ValueType | undefined;
|
|
3
|
-
export declare type DataType = "
|
|
4
|
-
export declare type PossibleDataType = DataType | "
|
|
3
|
+
export declare type DataType = "Number" | "String" | "Boolean";
|
|
4
|
+
export declare type PossibleDataType = DataType | "Undefined";
|
|
5
5
|
export interface PropertyMap {
|
|
6
6
|
[key: string]: PossibleDataType;
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Types.js","sourceRoot":"","sources":["../../../src/formula/Types.ts"],"names":[],"mappings":"","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nexport type ValueType = number | string | boolean;\n\nexport type PossibleValueType = ValueType | undefined;\n\nexport type DataType = \"
|
|
1
|
+
{"version":3,"file":"Types.js","sourceRoot":"","sources":["../../../src/formula/Types.ts"],"names":[],"mappings":"","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nexport type ValueType = number | string | boolean;\n\nexport type PossibleValueType = ValueType | undefined;\n\nexport type DataType = \"Number\" | \"String\" | \"Boolean\";\n\nexport type PossibleDataType = DataType | \"Undefined\";\n\nexport interface PropertyMap { [key: string]: PossibleDataType }\n"]}
|
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
/** UI Provider for iTwin Viewer Applications */
|
|
2
2
|
export * from "./widget/GroupingMappingWidget";
|
|
3
|
+
/** Interfaces for providing custom MappingClient */
|
|
4
|
+
export { createDefaultMappingClient } from "./widget/components/context/MappingClientContext";
|
|
5
|
+
export { ClientPrefix } from "./widget/components/context/GroupingApiConfigContext";
|
|
6
|
+
export * from "@itwin/insights-client";
|
|
7
|
+
export * from "./widget/IMappingClient";
|
|
3
8
|
/** Internal components for custom UIs */
|
|
4
9
|
export { Mappings } from "./widget/components/Mapping";
|
|
5
10
|
export { Groupings } from "./widget/components/Grouping";
|
|
6
11
|
export { PropertyMenu } from "./widget/components/PropertyMenu";
|
|
12
|
+
/** Formula DataType resolver */
|
|
13
|
+
export { resolveFormulaDataType } from "./formula/FormulaDataTypeResolver";
|
|
14
|
+
export { DataType, PropertyMap } from "./formula/Types";
|
|
15
|
+
export { IResult } from "./formula/IResult";
|
|
7
16
|
//# sourceMappingURL=grouping-mapping-widget.d.ts.map
|
|
@@ -10,13 +10,18 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
10
10
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.PropertyMenu = exports.Groupings = exports.Mappings = void 0;
|
|
13
|
+
exports.resolveFormulaDataType = exports.PropertyMenu = exports.Groupings = exports.Mappings = exports.createDefaultMappingClient = void 0;
|
|
14
14
|
/*---------------------------------------------------------------------------------------------
|
|
15
15
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
16
16
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
17
17
|
*--------------------------------------------------------------------------------------------*/
|
|
18
18
|
/** UI Provider for iTwin Viewer Applications */
|
|
19
19
|
__exportStar(require("./widget/GroupingMappingWidget"), exports);
|
|
20
|
+
/** Interfaces for providing custom MappingClient */
|
|
21
|
+
var MappingClientContext_1 = require("./widget/components/context/MappingClientContext");
|
|
22
|
+
Object.defineProperty(exports, "createDefaultMappingClient", { enumerable: true, get: function () { return MappingClientContext_1.createDefaultMappingClient; } });
|
|
23
|
+
__exportStar(require("@itwin/insights-client"), exports);
|
|
24
|
+
__exportStar(require("./widget/IMappingClient"), exports);
|
|
20
25
|
/** Internal components for custom UIs */
|
|
21
26
|
var Mapping_1 = require("./widget/components/Mapping");
|
|
22
27
|
Object.defineProperty(exports, "Mappings", { enumerable: true, get: function () { return Mapping_1.Mappings; } });
|
|
@@ -24,4 +29,7 @@ var Grouping_1 = require("./widget/components/Grouping");
|
|
|
24
29
|
Object.defineProperty(exports, "Groupings", { enumerable: true, get: function () { return Grouping_1.Groupings; } });
|
|
25
30
|
var PropertyMenu_1 = require("./widget/components/PropertyMenu");
|
|
26
31
|
Object.defineProperty(exports, "PropertyMenu", { enumerable: true, get: function () { return PropertyMenu_1.PropertyMenu; } });
|
|
32
|
+
/** Formula DataType resolver */
|
|
33
|
+
var FormulaDataTypeResolver_1 = require("./formula/FormulaDataTypeResolver");
|
|
34
|
+
Object.defineProperty(exports, "resolveFormulaDataType", { enumerable: true, get: function () { return FormulaDataTypeResolver_1.resolveFormulaDataType; } });
|
|
27
35
|
//# sourceMappingURL=grouping-mapping-widget.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grouping-mapping-widget.js","sourceRoot":"","sources":["../../src/grouping-mapping-widget.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,gDAAgD;AAChD,iEAA+C;AAE/C,yCAAyC;AACzC,uDAAuD;AAA9C,mGAAA,QAAQ,OAAA;AACjB,yDAAyD;AAAhD,qGAAA,SAAS,OAAA;AAClB,iEAAgE;AAAvD,4GAAA,YAAY,OAAA","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** UI Provider for iTwin Viewer Applications */\nexport * from \"./widget/GroupingMappingWidget\";\n\n/** Internal components for custom UIs */\nexport { Mappings } from \"./widget/components/Mapping\";\nexport { Groupings } from \"./widget/components/Grouping\";\nexport { PropertyMenu } from \"./widget/components/PropertyMenu\";\n"]}
|
|
1
|
+
{"version":3,"file":"grouping-mapping-widget.js","sourceRoot":"","sources":["../../src/grouping-mapping-widget.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,gDAAgD;AAChD,iEAA+C;AAE/C,oDAAoD;AACpD,yFAA8F;AAArF,kIAAA,0BAA0B,OAAA;AAEnC,yDAAuC;AACvC,0DAAwC;AAExC,yCAAyC;AACzC,uDAAuD;AAA9C,mGAAA,QAAQ,OAAA;AACjB,yDAAyD;AAAhD,qGAAA,SAAS,OAAA;AAClB,iEAAgE;AAAvD,4GAAA,YAAY,OAAA;AAErB,gCAAgC;AAChC,6EAA2E;AAAlE,iIAAA,sBAAsB,OAAA","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** UI Provider for iTwin Viewer Applications */\nexport * from \"./widget/GroupingMappingWidget\";\n\n/** Interfaces for providing custom MappingClient */\nexport { createDefaultMappingClient } from \"./widget/components/context/MappingClientContext\";\nexport { ClientPrefix } from \"./widget/components/context/GroupingApiConfigContext\";\nexport * from \"@itwin/insights-client\";\nexport * from \"./widget/IMappingClient\";\n\n/** Internal components for custom UIs */\nexport { Mappings } from \"./widget/components/Mapping\";\nexport { Groupings } from \"./widget/components/Grouping\";\nexport { PropertyMenu } from \"./widget/components/PropertyMenu\";\n\n/** Formula DataType resolver */\nexport { resolveFormulaDataType } from \"./formula/FormulaDataTypeResolver\";\nexport { DataType, PropertyMap } from \"./formula/Types\";\nexport { IResult } from \"./formula/IResult\";\n"]}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import type { AbstractWidgetProps, UiItemsProvider } from "@itwin/appui-abstract";
|
|
2
2
|
import { AbstractZoneLocation, StagePanelLocation, StagePanelSection } from "@itwin/appui-abstract";
|
|
3
|
-
import type {
|
|
3
|
+
import type { GroupingMappingProps } from "./components/GroupingMapping";
|
|
4
4
|
export declare class GroupingMappingProvider implements UiItemsProvider {
|
|
5
|
+
private readonly _props;
|
|
5
6
|
readonly id = "GroupingMappingProvider";
|
|
6
|
-
|
|
7
|
-
private readonly _prefix?;
|
|
8
|
-
constructor(accessToken?: AccessToken, prefix?: "" | "dev" | "qa");
|
|
7
|
+
constructor(_props?: GroupingMappingProps);
|
|
9
8
|
provideWidgets(_stageId: string, stageUsage: string, location: StagePanelLocation, section?: StagePanelSection, zonelocation?: AbstractZoneLocation): ReadonlyArray<AbstractWidgetProps>;
|
|
10
9
|
}
|
|
11
10
|
//# sourceMappingURL=GroupingMappingWidget.d.ts.map
|
|
@@ -8,10 +8,9 @@ const appui_abstract_1 = require("@itwin/appui-abstract");
|
|
|
8
8
|
const react_1 = __importDefault(require("react"));
|
|
9
9
|
const GroupingMapping_1 = __importDefault(require("./components/GroupingMapping"));
|
|
10
10
|
class GroupingMappingProvider {
|
|
11
|
-
constructor(
|
|
11
|
+
constructor(_props = {}) {
|
|
12
|
+
this._props = _props;
|
|
12
13
|
this.id = "GroupingMappingProvider";
|
|
13
|
-
this._accessToken = accessToken;
|
|
14
|
-
this._prefix = prefix;
|
|
15
14
|
}
|
|
16
15
|
provideWidgets(_stageId, stageUsage, location, section, zonelocation) {
|
|
17
16
|
const widgets = [];
|
|
@@ -23,7 +22,7 @@ class GroupingMappingProvider {
|
|
|
23
22
|
id: "GroupingMappingWidget",
|
|
24
23
|
label: "Grouping & Mapping",
|
|
25
24
|
getWidgetContent: () => {
|
|
26
|
-
return react_1.default.createElement(GroupingMapping_1.default, {
|
|
25
|
+
return react_1.default.createElement(GroupingMapping_1.default, { ...this._props });
|
|
27
26
|
},
|
|
28
27
|
};
|
|
29
28
|
widgets.push(GroupingMappingWidget);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GroupingMappingWidget.js","sourceRoot":"","sources":["../../../src/widget/GroupingMappingWidget.tsx"],"names":[],"mappings":";;;;;;AAQA,0DAK+B;
|
|
1
|
+
{"version":3,"file":"GroupingMappingWidget.js","sourceRoot":"","sources":["../../../src/widget/GroupingMappingWidget.tsx"],"names":[],"mappings":";;;;;;AAQA,0DAK+B;AAC/B,kDAA0B;AAE1B,mFAA2D;AAE3D,MAAa,uBAAuB;IAGlC,YAA6B,SAA+B,EAAE;QAAjC,WAAM,GAAN,MAAM,CAA2B;QAF9C,OAAE,GAAG,yBAAyB,CAAC;IAEmB,CAAC;IAE5D,cAAc,CACnB,QAAgB,EAChB,UAAkB,EAClB,QAA4B,EAC5B,OAA2B,EAC3B,YAAmC;QAEnC,MAAM,OAAO,GAA0B,EAAE,CAAC;QAC1C,IACE,CAAC,QAAQ,KAAK,mCAAkB,CAAC,IAAI;YACnC,OAAO,KAAK,kCAAiB,CAAC,KAAK;YACnC,UAAU,KAAK,2BAAU,CAAC,OAAO,CAAC;YACpC,YAAY,KAAK,qCAAoB,CAAC,UAAU,EAChD;YACA,MAAM,qBAAqB,GAAwB;gBACjD,EAAE,EAAE,uBAAuB;gBAC3B,KAAK,EAAE,oBAAoB;gBAC3B,gBAAgB,EAAE,GAAG,EAAE;oBACrB,OAAO,8BAAC,yBAAe,OAAK,IAAI,CAAC,MAAM,GAAI,CAAC;gBAC9C,CAAC;aACF,CAAC;YAEF,OAAO,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;SACrC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AAhCD,0DAgCC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport type {\n AbstractWidgetProps,\n UiItemsProvider,\n} from \"@itwin/appui-abstract\";\nimport {\n AbstractZoneLocation,\n StagePanelLocation,\n StagePanelSection,\n StageUsage,\n} from \"@itwin/appui-abstract\";\nimport React from \"react\";\nimport type { GroupingMappingProps } from \"./components/GroupingMapping\";\nimport GroupingMapping from \"./components/GroupingMapping\";\n\nexport class GroupingMappingProvider implements UiItemsProvider {\n public readonly id = \"GroupingMappingProvider\";\n\n constructor(private readonly _props: GroupingMappingProps = {}) { }\n\n public provideWidgets(\n _stageId: string,\n stageUsage: string,\n location: StagePanelLocation,\n section?: StagePanelSection,\n zonelocation?: AbstractZoneLocation\n ): ReadonlyArray<AbstractWidgetProps> {\n const widgets: AbstractWidgetProps[] = [];\n if (\n (location === StagePanelLocation.Left &&\n section === StagePanelSection.Start &&\n stageUsage === StageUsage.General) ||\n zonelocation === AbstractZoneLocation.CenterLeft\n ) {\n const GroupingMappingWidget: AbstractWidgetProps = {\n id: \"GroupingMappingWidget\",\n label: \"Grouping & Mapping\",\n getWidgetContent: () => {\n return <GroupingMapping {...this._props} />;\n },\n };\n\n widgets.push(GroupingMappingWidget);\n }\n\n return widgets;\n }\n}\n"]}
|