@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.
Files changed (195) hide show
  1. package/lib/cjs/formula/FormulaDataTypeResolver.d.ts +12 -0
  2. package/lib/cjs/formula/FormulaDataTypeResolver.js +50 -0
  3. package/lib/cjs/formula/FormulaDataTypeResolver.js.map +1 -0
  4. package/lib/cjs/formula/FormulaFunctionProvider.js +59 -59
  5. package/lib/cjs/formula/FormulaFunctionProvider.js.map +1 -1
  6. package/lib/cjs/formula/FormulaOperatorsProvider.js +7 -7
  7. package/lib/cjs/formula/FormulaOperatorsProvider.js.map +1 -1
  8. package/lib/cjs/formula/FormulaTokensDataTypeResolver.d.ts +6 -0
  9. package/lib/cjs/formula/{FormulaTokensValidator.js → FormulaTokensDataTypeResolver.js} +32 -32
  10. package/lib/cjs/formula/FormulaTokensDataTypeResolver.js.map +1 -0
  11. package/lib/cjs/formula/Types.d.ts +2 -2
  12. package/lib/cjs/formula/Types.js.map +1 -1
  13. package/lib/cjs/grouping-mapping-widget.d.ts +9 -0
  14. package/lib/cjs/grouping-mapping-widget.js +9 -1
  15. package/lib/cjs/grouping-mapping-widget.js.map +1 -1
  16. package/lib/cjs/widget/GroupingMappingWidget.d.ts +3 -4
  17. package/lib/cjs/widget/GroupingMappingWidget.js +3 -4
  18. package/lib/cjs/widget/GroupingMappingWidget.js.map +1 -1
  19. package/lib/cjs/widget/IMappingClient.d.ts +327 -0
  20. package/lib/cjs/widget/IMappingClient.js +7 -0
  21. package/lib/cjs/widget/IMappingClient.js.map +1 -0
  22. package/lib/cjs/widget/components/CalculatedPropertyAction.js +7 -5
  23. package/lib/cjs/widget/components/CalculatedPropertyAction.js.map +1 -1
  24. package/lib/cjs/widget/components/CalculatedPropertyTable.js +6 -5
  25. package/lib/cjs/widget/components/CalculatedPropertyTable.js.map +1 -1
  26. package/lib/cjs/widget/components/ConfirmMappingsImport.js +6 -4
  27. package/lib/cjs/widget/components/ConfirmMappingsImport.js.map +1 -1
  28. package/lib/cjs/widget/components/CustomCalculationAction.js +7 -5
  29. package/lib/cjs/widget/components/CustomCalculationAction.js.map +1 -1
  30. package/lib/cjs/widget/components/CustomCalculationTable.js +6 -5
  31. package/lib/cjs/widget/components/CustomCalculationTable.js.map +1 -1
  32. package/lib/cjs/widget/components/GroupAction.d.ts +2 -1
  33. package/lib/cjs/widget/components/GroupAction.js +21 -13
  34. package/lib/cjs/widget/components/GroupAction.js.map +1 -1
  35. package/lib/cjs/widget/components/GroupPropertyAction.js +19 -9
  36. package/lib/cjs/widget/components/GroupPropertyAction.js.map +1 -1
  37. package/lib/cjs/widget/components/GroupPropertyTable.js +6 -5
  38. package/lib/cjs/widget/components/GroupPropertyTable.js.map +1 -1
  39. package/lib/cjs/widget/components/GroupQueryBuilderContainer.js +8 -5
  40. package/lib/cjs/widget/components/GroupQueryBuilderContainer.js.map +1 -1
  41. package/lib/cjs/widget/components/GroupTile.d.ts +13 -0
  42. package/lib/cjs/widget/components/GroupTile.js +18 -0
  43. package/lib/cjs/widget/components/GroupTile.js.map +1 -0
  44. package/lib/cjs/widget/components/GroupTile.scss +32 -0
  45. package/lib/cjs/widget/components/Grouping.js +215 -165
  46. package/lib/cjs/widget/components/Grouping.js.map +1 -1
  47. package/lib/cjs/widget/components/Grouping.scss +39 -4
  48. package/lib/cjs/widget/components/GroupingMapping.d.ts +18 -11
  49. package/lib/cjs/widget/components/GroupingMapping.js +24 -15
  50. package/lib/cjs/widget/components/GroupingMapping.js.map +1 -1
  51. package/lib/cjs/widget/components/Mapping.js +20 -16
  52. package/lib/cjs/widget/components/Mapping.js.map +1 -1
  53. package/lib/cjs/widget/components/MappingAction.js +7 -5
  54. package/lib/cjs/widget/components/MappingAction.js.map +1 -1
  55. package/lib/cjs/widget/components/PropertyMenu.js +17 -18
  56. package/lib/cjs/widget/components/PropertyMenu.js.map +1 -1
  57. package/lib/cjs/widget/components/QueryBuilder.d.ts +10 -5
  58. package/lib/cjs/widget/components/QueryBuilder.js +223 -142
  59. package/lib/cjs/widget/components/QueryBuilder.js.map +1 -1
  60. package/lib/cjs/widget/components/SelectIModel.js +13 -4
  61. package/lib/cjs/widget/components/SelectIModel.js.map +1 -1
  62. package/lib/cjs/widget/components/SelectMappings.js +9 -7
  63. package/lib/cjs/widget/components/SelectMappings.js.map +1 -1
  64. package/lib/cjs/widget/components/SelectProject.js +13 -4
  65. package/lib/cjs/widget/components/SelectProject.js.map +1 -1
  66. package/lib/cjs/widget/components/{GroupQueryBuilderContext.d.ts → context/GroupQueryBuilderContext.d.ts} +2 -1
  67. package/lib/cjs/widget/components/{GroupQueryBuilderContext.js → context/GroupQueryBuilderContext.js} +2 -1
  68. package/lib/cjs/widget/components/context/GroupQueryBuilderContext.js.map +1 -0
  69. package/lib/cjs/widget/components/context/GroupingApiConfigContext.d.ts +11 -0
  70. package/lib/cjs/widget/components/context/GroupingApiConfigContext.js +37 -0
  71. package/lib/cjs/widget/components/context/GroupingApiConfigContext.js.map +1 -0
  72. package/lib/cjs/widget/components/context/MappingClientContext.d.ts +7 -0
  73. package/lib/cjs/widget/components/context/MappingClientContext.js +30 -0
  74. package/lib/cjs/widget/components/context/MappingClientContext.js.map +1 -0
  75. package/lib/cjs/widget/components/property-grid/PropertyGrid.d.ts +1 -1
  76. package/lib/cjs/widget/components/property-grid/PropertyGrid.js +5 -5
  77. package/lib/cjs/widget/components/property-grid/PropertyGrid.js.map +1 -1
  78. package/lib/cjs/widget/components/property-grid/PropertyGridWrapper.d.ts +1 -1
  79. package/lib/cjs/widget/components/property-grid/PropertyGridWrapper.js +2 -2
  80. package/lib/cjs/widget/components/property-grid/PropertyGridWrapper.js.map +1 -1
  81. package/lib/cjs/widget/components/property-grid/PropertyView.js +14 -6
  82. package/lib/cjs/widget/components/property-grid/PropertyView.js.map +1 -1
  83. package/lib/cjs/widget/components/utils.d.ts +6 -2
  84. package/lib/cjs/widget/components/utils.js +9 -13
  85. package/lib/cjs/widget/components/utils.js.map +1 -1
  86. package/lib/cjs/widget/components/utils.scss +12 -3
  87. package/lib/cjs/widget/components/viewerUtils.d.ts +19 -0
  88. package/lib/cjs/widget/components/viewerUtils.js +224 -3
  89. package/lib/cjs/widget/components/viewerUtils.js.map +1 -1
  90. package/lib/cjs/widget/hooks/useFormulaValidation.js +3 -2
  91. package/lib/cjs/widget/hooks/useFormulaValidation.js.map +1 -1
  92. package/lib/esm/formula/FormulaDataTypeResolver.d.ts +12 -0
  93. package/lib/esm/formula/FormulaDataTypeResolver.js +46 -0
  94. package/lib/esm/formula/FormulaDataTypeResolver.js.map +1 -0
  95. package/lib/esm/formula/FormulaFunctionProvider.js +59 -59
  96. package/lib/esm/formula/FormulaFunctionProvider.js.map +1 -1
  97. package/lib/esm/formula/FormulaOperatorsProvider.js +7 -7
  98. package/lib/esm/formula/FormulaOperatorsProvider.js.map +1 -1
  99. package/lib/esm/formula/FormulaTokensDataTypeResolver.d.ts +6 -0
  100. package/lib/esm/formula/{FormulaTokensValidator.js → FormulaTokensDataTypeResolver.js} +30 -30
  101. package/lib/esm/formula/FormulaTokensDataTypeResolver.js.map +1 -0
  102. package/lib/esm/formula/Types.d.ts +2 -2
  103. package/lib/esm/formula/Types.js.map +1 -1
  104. package/lib/esm/grouping-mapping-widget.d.ts +9 -0
  105. package/lib/esm/grouping-mapping-widget.js +6 -0
  106. package/lib/esm/grouping-mapping-widget.js.map +1 -1
  107. package/lib/esm/widget/GroupingMappingWidget.d.ts +3 -4
  108. package/lib/esm/widget/GroupingMappingWidget.js +3 -4
  109. package/lib/esm/widget/GroupingMappingWidget.js.map +1 -1
  110. package/lib/esm/widget/IMappingClient.d.ts +327 -0
  111. package/lib/esm/widget/IMappingClient.js +6 -0
  112. package/lib/esm/widget/IMappingClient.js.map +1 -0
  113. package/lib/esm/widget/components/CalculatedPropertyAction.js +9 -7
  114. package/lib/esm/widget/components/CalculatedPropertyAction.js.map +1 -1
  115. package/lib/esm/widget/components/CalculatedPropertyTable.js +7 -6
  116. package/lib/esm/widget/components/CalculatedPropertyTable.js.map +1 -1
  117. package/lib/esm/widget/components/ConfirmMappingsImport.js +8 -6
  118. package/lib/esm/widget/components/ConfirmMappingsImport.js.map +1 -1
  119. package/lib/esm/widget/components/CustomCalculationAction.js +9 -7
  120. package/lib/esm/widget/components/CustomCalculationAction.js.map +1 -1
  121. package/lib/esm/widget/components/CustomCalculationTable.js +7 -6
  122. package/lib/esm/widget/components/CustomCalculationTable.js.map +1 -1
  123. package/lib/esm/widget/components/GroupAction.d.ts +2 -1
  124. package/lib/esm/widget/components/GroupAction.js +24 -16
  125. package/lib/esm/widget/components/GroupAction.js.map +1 -1
  126. package/lib/esm/widget/components/GroupPropertyAction.js +21 -11
  127. package/lib/esm/widget/components/GroupPropertyAction.js.map +1 -1
  128. package/lib/esm/widget/components/GroupPropertyTable.js +7 -6
  129. package/lib/esm/widget/components/GroupPropertyTable.js.map +1 -1
  130. package/lib/esm/widget/components/GroupQueryBuilderContainer.js +8 -5
  131. package/lib/esm/widget/components/GroupQueryBuilderContainer.js.map +1 -1
  132. package/lib/esm/widget/components/GroupTile.d.ts +13 -0
  133. package/lib/esm/widget/components/GroupTile.js +11 -0
  134. package/lib/esm/widget/components/GroupTile.js.map +1 -0
  135. package/lib/esm/widget/components/GroupTile.scss +32 -0
  136. package/lib/esm/widget/components/Grouping.js +220 -170
  137. package/lib/esm/widget/components/Grouping.js.map +1 -1
  138. package/lib/esm/widget/components/Grouping.scss +39 -4
  139. package/lib/esm/widget/components/GroupingMapping.d.ts +18 -11
  140. package/lib/esm/widget/components/GroupingMapping.js +25 -15
  141. package/lib/esm/widget/components/GroupingMapping.js.map +1 -1
  142. package/lib/esm/widget/components/Mapping.js +22 -18
  143. package/lib/esm/widget/components/Mapping.js.map +1 -1
  144. package/lib/esm/widget/components/MappingAction.js +9 -7
  145. package/lib/esm/widget/components/MappingAction.js.map +1 -1
  146. package/lib/esm/widget/components/PropertyMenu.js +20 -21
  147. package/lib/esm/widget/components/PropertyMenu.js.map +1 -1
  148. package/lib/esm/widget/components/QueryBuilder.d.ts +10 -5
  149. package/lib/esm/widget/components/QueryBuilder.js +224 -143
  150. package/lib/esm/widget/components/QueryBuilder.js.map +1 -1
  151. package/lib/esm/widget/components/SelectIModel.js +14 -5
  152. package/lib/esm/widget/components/SelectIModel.js.map +1 -1
  153. package/lib/esm/widget/components/SelectMappings.js +11 -9
  154. package/lib/esm/widget/components/SelectMappings.js.map +1 -1
  155. package/lib/esm/widget/components/SelectProject.js +14 -5
  156. package/lib/esm/widget/components/SelectProject.js.map +1 -1
  157. package/lib/esm/widget/components/{GroupQueryBuilderContext.d.ts → context/GroupQueryBuilderContext.d.ts} +2 -1
  158. package/lib/esm/widget/components/{GroupQueryBuilderContext.js → context/GroupQueryBuilderContext.js} +2 -1
  159. package/lib/esm/widget/components/context/GroupQueryBuilderContext.js.map +1 -0
  160. package/lib/esm/widget/components/context/GroupingApiConfigContext.d.ts +11 -0
  161. package/lib/esm/widget/components/context/GroupingApiConfigContext.js +14 -0
  162. package/lib/esm/widget/components/context/GroupingApiConfigContext.js.map +1 -0
  163. package/lib/esm/widget/components/context/MappingClientContext.d.ts +7 -0
  164. package/lib/esm/widget/components/context/MappingClientContext.js +25 -0
  165. package/lib/esm/widget/components/context/MappingClientContext.js.map +1 -0
  166. package/lib/esm/widget/components/property-grid/PropertyGrid.d.ts +1 -1
  167. package/lib/esm/widget/components/property-grid/PropertyGrid.js +6 -6
  168. package/lib/esm/widget/components/property-grid/PropertyGrid.js.map +1 -1
  169. package/lib/esm/widget/components/property-grid/PropertyGridWrapper.d.ts +1 -1
  170. package/lib/esm/widget/components/property-grid/PropertyGridWrapper.js +2 -2
  171. package/lib/esm/widget/components/property-grid/PropertyGridWrapper.js.map +1 -1
  172. package/lib/esm/widget/components/property-grid/PropertyView.js +14 -6
  173. package/lib/esm/widget/components/property-grid/PropertyView.js.map +1 -1
  174. package/lib/esm/widget/components/utils.d.ts +6 -2
  175. package/lib/esm/widget/components/utils.js +6 -11
  176. package/lib/esm/widget/components/utils.js.map +1 -1
  177. package/lib/esm/widget/components/utils.scss +12 -3
  178. package/lib/esm/widget/components/viewerUtils.d.ts +19 -0
  179. package/lib/esm/widget/components/viewerUtils.js +207 -3
  180. package/lib/esm/widget/components/viewerUtils.js.map +1 -1
  181. package/lib/esm/widget/hooks/useFormulaValidation.js +3 -2
  182. package/lib/esm/widget/hooks/useFormulaValidation.js.map +1 -1
  183. package/package.json +29 -29
  184. package/lib/cjs/formula/FormulaTokensValidator.d.ts +0 -5
  185. package/lib/cjs/formula/FormulaTokensValidator.js.map +0 -1
  186. package/lib/cjs/formula/FormulaValidator.d.ts +0 -3
  187. package/lib/cjs/formula/FormulaValidator.js +0 -35
  188. package/lib/cjs/formula/FormulaValidator.js.map +0 -1
  189. package/lib/cjs/widget/components/GroupQueryBuilderContext.js.map +0 -1
  190. package/lib/esm/formula/FormulaTokensValidator.d.ts +0 -5
  191. package/lib/esm/formula/FormulaTokensValidator.js.map +0 -1
  192. package/lib/esm/formula/FormulaValidator.d.ts +0 -3
  193. package/lib/esm/formula/FormulaValidator.js +0 -31
  194. package/lib/esm/formula/FormulaValidator.js.map +0 -1
  195. 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.validateTokens = void 0;
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 validateTokens(formulaName, tokens, properties) {
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("number");
32
+ argStack.push("Number");
33
33
  break;
34
34
  case InfixToPostfixConverter_1.TokenType.String:
35
- argStack.push("string");
35
+ argStack.push("String");
36
36
  break;
37
37
  case InfixToPostfixConverter_1.TokenType.Boolean:
38
- argStack.push("boolean");
38
+ argStack.push("Boolean");
39
39
  break;
40
40
  case InfixToPostfixConverter_1.TokenType.Null:
41
- argStack.push("undefined");
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("number");
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 === "undefined") {
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.validateTokens = validateTokens;
137
- //# sourceMappingURL=FormulaTokensValidator.js.map
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,GAAG,MAAM,CAAC,OAAO,EAAG,CAAC;QAEhC,QAAQ,KAAK,CAAC,IAAI,EAAE;YAClB,KAAK,mCAAS,CAAC,MAAM;gBACnB,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;gBACxB,MAAM;YACR,KAAK,mCAAS,CAAC,MAAM;gBACnB,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;gBACxB,MAAM;YACR,KAAK,mCAAS,CAAC,OAAO;gBACpB,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;gBACzB,MAAM;YACR,KAAK,mCAAS,CAAC,IAAI;gBACjB,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC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,GAAG,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,OAAO,EAAE,CAAC;gBACtD,IAAI,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC,QAAQ,EAAE;oBACjC,OAAO,EAAE,YAAY,EAAE,yCAAyC,KAAK,CAAC,KAAK,IAAI,EAAE,CAAC;iBACnF;gBAED,MAAM,cAAc,GAAG,sDAA4B,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;gBAClE,IAAI,cAAc,CAAC,YAAY;oBAC7B,OAAO,EAAE,YAAY,EAAE,aAAa,KAAK,CAAC,KAAK,iBAAiB,cAAc,CAAC,YAAY,EAAE,EAAE,CAAC;;oBAEhG,QAAQ,CAAC,IAAI,CAAC,cAAc,CAAC,KAAM,CAAC,CAAC;gBAEvC,MAAM;SACT;KACF;IAED,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;QACzB,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAAE,CAAC;KAChD;IAED,MAAM,UAAU,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC;IAClC,IAAI,CAAC,UAAU,IAAI,UAAU,KAAK,WAAW,EAAE;QAC7C,OAAO,EAAE,YAAY,EAAE,oCAAoC,EAAE,CAAC;KAC/D;IAED,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 = "number" | "string" | "boolean";
4
- export declare type PossibleDataType = DataType | "undefined";
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 = \"number\" | \"string\" | \"boolean\";\n\nexport type PossibleDataType = DataType | \"undefined\";\n\nexport interface PropertyMap { [key: string]: PossibleDataType }\n"]}
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 { AccessToken } from "@itwin/core-bentley";
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
- private readonly _accessToken?;
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(accessToken, prefix) {
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, { accessToken: this._accessToken, prefix: this._prefix });
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;AAE/B,kDAA0B;AAC1B,mFAA2D;AAE3D,MAAa,uBAAuB;IAMlC,YAAY,WAAyB,EAAE,MAA0B;QALjD,OAAE,GAAG,yBAAyB,CAAC;QAM7C,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;QAChC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAEM,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,IAAC,WAAW,EAAE,IAAI,CAAC,YAAY,EAAE,MAAM,EAAE,IAAI,CAAC,OAAO,GAAI,CAAC;gBACnF,CAAC;aACF,CAAC;YAEF,OAAO,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;SACrC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AAtCD,0DAsCC","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 type { AccessToken } from \"@itwin/core-bentley\";\nimport React from \"react\";\nimport GroupingMapping from \"./components/GroupingMapping\";\n\nexport class GroupingMappingProvider implements UiItemsProvider {\n public readonly id = \"GroupingMappingProvider\";\n\n private readonly _accessToken?: AccessToken;\n private readonly _prefix?: \"\" | \"dev\" | \"qa\";\n\n constructor(accessToken?: AccessToken, prefix?: \"\" | \"dev\" | \"qa\") {\n this._accessToken = accessToken;\n this._prefix = prefix;\n }\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 accessToken={this._accessToken} prefix={this._prefix} />;\n },\n };\n\n widgets.push(GroupingMappingWidget);\n }\n\n return widgets;\n }\n}\n"]}
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"]}