@itwin/grouping-mapping-widget 0.4.0 → 0.5.2

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 (165) 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 +6 -1
  14. package/lib/cjs/grouping-mapping-widget.js +6 -3
  15. package/lib/cjs/grouping-mapping-widget.js.map +1 -1
  16. package/lib/cjs/widget/GroupingMappingWidget.d.ts +3 -6
  17. package/lib/cjs/widget/GroupingMappingWidget.js +3 -5
  18. package/lib/cjs/widget/GroupingMappingWidget.js.map +1 -1
  19. package/lib/cjs/widget/components/CalculatedPropertyAction.js +7 -5
  20. package/lib/cjs/widget/components/CalculatedPropertyAction.js.map +1 -1
  21. package/lib/cjs/widget/components/CalculatedPropertyTable.js +6 -4
  22. package/lib/cjs/widget/components/CalculatedPropertyTable.js.map +1 -1
  23. package/lib/cjs/widget/components/ConfirmMappingsImport.js +6 -4
  24. package/lib/cjs/widget/components/ConfirmMappingsImport.js.map +1 -1
  25. package/lib/cjs/widget/components/CustomCalculationAction.js +7 -5
  26. package/lib/cjs/widget/components/CustomCalculationAction.js.map +1 -1
  27. package/lib/cjs/widget/components/CustomCalculationTable.js +6 -4
  28. package/lib/cjs/widget/components/CustomCalculationTable.js.map +1 -1
  29. package/lib/cjs/widget/components/GroupAction.js +26 -21
  30. package/lib/cjs/widget/components/GroupAction.js.map +1 -1
  31. package/lib/cjs/widget/components/GroupPropertyAction.js +19 -8
  32. package/lib/cjs/widget/components/GroupPropertyAction.js.map +1 -1
  33. package/lib/cjs/widget/components/GroupPropertyTable.js +6 -4
  34. package/lib/cjs/widget/components/GroupPropertyTable.js.map +1 -1
  35. package/lib/cjs/widget/components/GroupQueryBuilderContainer.js +8 -6
  36. package/lib/cjs/widget/components/GroupQueryBuilderContainer.js.map +1 -1
  37. package/lib/cjs/widget/components/Grouping.js +54 -65
  38. package/lib/cjs/widget/components/Grouping.js.map +1 -1
  39. package/lib/cjs/widget/components/GroupingMapping.d.ts +8 -13
  40. package/lib/cjs/widget/components/GroupingMapping.js +16 -36
  41. package/lib/cjs/widget/components/GroupingMapping.js.map +1 -1
  42. package/lib/cjs/widget/components/Mapping.js +18 -14
  43. package/lib/cjs/widget/components/Mapping.js.map +1 -1
  44. package/lib/cjs/widget/components/MappingAction.js +7 -5
  45. package/lib/cjs/widget/components/MappingAction.js.map +1 -1
  46. package/lib/cjs/widget/components/PropertyMenu.js +16 -15
  47. package/lib/cjs/widget/components/PropertyMenu.js.map +1 -1
  48. package/lib/cjs/widget/components/QueryBuilder.d.ts +2 -3
  49. package/lib/cjs/widget/components/QueryBuilder.js +6 -13
  50. package/lib/cjs/widget/components/QueryBuilder.js.map +1 -1
  51. package/lib/cjs/widget/components/SelectIModel.js +13 -4
  52. package/lib/cjs/widget/components/SelectIModel.js.map +1 -1
  53. package/lib/cjs/widget/components/SelectMappings.js +9 -7
  54. package/lib/cjs/widget/components/SelectMappings.js.map +1 -1
  55. package/lib/cjs/widget/components/SelectProject.js +13 -4
  56. package/lib/cjs/widget/components/SelectProject.js.map +1 -1
  57. package/lib/cjs/widget/components/{GroupQueryBuilderContext.d.ts → context/GroupQueryBuilderContext.d.ts} +1 -1
  58. package/lib/cjs/widget/components/{GroupQueryBuilderContext.js → context/GroupQueryBuilderContext.js} +1 -1
  59. package/lib/cjs/widget/components/context/GroupQueryBuilderContext.js.map +1 -0
  60. package/lib/cjs/widget/components/context/GroupingApiConfigContext.d.ts +11 -0
  61. package/lib/cjs/widget/components/context/GroupingApiConfigContext.js +37 -0
  62. package/lib/cjs/widget/components/context/GroupingApiConfigContext.js.map +1 -0
  63. package/lib/cjs/widget/components/context/MappingClientContext.d.ts +8 -0
  64. package/lib/cjs/widget/components/context/MappingClientContext.js +37 -0
  65. package/lib/cjs/widget/components/context/MappingClientContext.js.map +1 -0
  66. package/lib/cjs/widget/components/property-grid/PropertyGrid.d.ts +1 -1
  67. package/lib/cjs/widget/components/property-grid/PropertyGrid.js +5 -5
  68. package/lib/cjs/widget/components/property-grid/PropertyGrid.js.map +1 -1
  69. package/lib/cjs/widget/components/property-grid/PropertyGridWrapper.d.ts +1 -1
  70. package/lib/cjs/widget/components/property-grid/PropertyGridWrapper.js +2 -2
  71. package/lib/cjs/widget/components/property-grid/PropertyGridWrapper.js.map +1 -1
  72. package/lib/cjs/widget/components/property-grid/PropertyView.js +9 -6
  73. package/lib/cjs/widget/components/property-grid/PropertyView.js.map +1 -1
  74. package/lib/cjs/widget/components/viewerUtils.js.map +1 -1
  75. package/lib/cjs/widget/hooks/useFormulaValidation.js +3 -2
  76. package/lib/cjs/widget/hooks/useFormulaValidation.js.map +1 -1
  77. package/lib/esm/formula/FormulaDataTypeResolver.d.ts +12 -0
  78. package/lib/esm/formula/FormulaDataTypeResolver.js +46 -0
  79. package/lib/esm/formula/FormulaDataTypeResolver.js.map +1 -0
  80. package/lib/esm/formula/FormulaFunctionProvider.js +59 -59
  81. package/lib/esm/formula/FormulaFunctionProvider.js.map +1 -1
  82. package/lib/esm/formula/FormulaOperatorsProvider.js +7 -7
  83. package/lib/esm/formula/FormulaOperatorsProvider.js.map +1 -1
  84. package/lib/esm/formula/FormulaTokensDataTypeResolver.d.ts +6 -0
  85. package/lib/esm/formula/{FormulaTokensValidator.js → FormulaTokensDataTypeResolver.js} +30 -30
  86. package/lib/esm/formula/FormulaTokensDataTypeResolver.js.map +1 -0
  87. package/lib/esm/formula/Types.d.ts +2 -2
  88. package/lib/esm/formula/Types.js.map +1 -1
  89. package/lib/esm/grouping-mapping-widget.d.ts +6 -1
  90. package/lib/esm/grouping-mapping-widget.js +3 -1
  91. package/lib/esm/grouping-mapping-widget.js.map +1 -1
  92. package/lib/esm/widget/GroupingMappingWidget.d.ts +3 -6
  93. package/lib/esm/widget/GroupingMappingWidget.js +3 -5
  94. package/lib/esm/widget/GroupingMappingWidget.js.map +1 -1
  95. package/lib/esm/widget/components/CalculatedPropertyAction.js +8 -6
  96. package/lib/esm/widget/components/CalculatedPropertyAction.js.map +1 -1
  97. package/lib/esm/widget/components/CalculatedPropertyTable.js +7 -5
  98. package/lib/esm/widget/components/CalculatedPropertyTable.js.map +1 -1
  99. package/lib/esm/widget/components/ConfirmMappingsImport.js +7 -5
  100. package/lib/esm/widget/components/ConfirmMappingsImport.js.map +1 -1
  101. package/lib/esm/widget/components/CustomCalculationAction.js +8 -6
  102. package/lib/esm/widget/components/CustomCalculationAction.js.map +1 -1
  103. package/lib/esm/widget/components/CustomCalculationTable.js +7 -5
  104. package/lib/esm/widget/components/CustomCalculationTable.js.map +1 -1
  105. package/lib/esm/widget/components/GroupAction.js +27 -22
  106. package/lib/esm/widget/components/GroupAction.js.map +1 -1
  107. package/lib/esm/widget/components/GroupPropertyAction.js +20 -9
  108. package/lib/esm/widget/components/GroupPropertyAction.js.map +1 -1
  109. package/lib/esm/widget/components/GroupPropertyTable.js +7 -5
  110. package/lib/esm/widget/components/GroupPropertyTable.js.map +1 -1
  111. package/lib/esm/widget/components/GroupQueryBuilderContainer.js +8 -6
  112. package/lib/esm/widget/components/GroupQueryBuilderContainer.js.map +1 -1
  113. package/lib/esm/widget/components/Grouping.js +56 -67
  114. package/lib/esm/widget/components/Grouping.js.map +1 -1
  115. package/lib/esm/widget/components/GroupingMapping.d.ts +8 -13
  116. package/lib/esm/widget/components/GroupingMapping.js +16 -34
  117. package/lib/esm/widget/components/GroupingMapping.js.map +1 -1
  118. package/lib/esm/widget/components/Mapping.js +19 -15
  119. package/lib/esm/widget/components/Mapping.js.map +1 -1
  120. package/lib/esm/widget/components/MappingAction.js +8 -6
  121. package/lib/esm/widget/components/MappingAction.js.map +1 -1
  122. package/lib/esm/widget/components/PropertyMenu.js +17 -16
  123. package/lib/esm/widget/components/PropertyMenu.js.map +1 -1
  124. package/lib/esm/widget/components/QueryBuilder.d.ts +2 -3
  125. package/lib/esm/widget/components/QueryBuilder.js +6 -13
  126. package/lib/esm/widget/components/QueryBuilder.js.map +1 -1
  127. package/lib/esm/widget/components/SelectIModel.js +14 -5
  128. package/lib/esm/widget/components/SelectIModel.js.map +1 -1
  129. package/lib/esm/widget/components/SelectMappings.js +10 -8
  130. package/lib/esm/widget/components/SelectMappings.js.map +1 -1
  131. package/lib/esm/widget/components/SelectProject.js +14 -5
  132. package/lib/esm/widget/components/SelectProject.js.map +1 -1
  133. package/lib/esm/widget/components/{GroupQueryBuilderContext.d.ts → context/GroupQueryBuilderContext.d.ts} +1 -1
  134. package/lib/esm/widget/components/{GroupQueryBuilderContext.js → context/GroupQueryBuilderContext.js} +1 -1
  135. package/lib/esm/widget/components/context/GroupQueryBuilderContext.js.map +1 -0
  136. package/lib/esm/widget/components/context/GroupingApiConfigContext.d.ts +11 -0
  137. package/lib/esm/widget/components/context/GroupingApiConfigContext.js +14 -0
  138. package/lib/esm/widget/components/context/GroupingApiConfigContext.js.map +1 -0
  139. package/lib/esm/widget/components/context/MappingClientContext.d.ts +8 -0
  140. package/lib/esm/widget/components/context/MappingClientContext.js +31 -0
  141. package/lib/esm/widget/components/context/MappingClientContext.js.map +1 -0
  142. package/lib/esm/widget/components/property-grid/PropertyGrid.d.ts +1 -1
  143. package/lib/esm/widget/components/property-grid/PropertyGrid.js +6 -6
  144. package/lib/esm/widget/components/property-grid/PropertyGrid.js.map +1 -1
  145. package/lib/esm/widget/components/property-grid/PropertyGridWrapper.d.ts +1 -1
  146. package/lib/esm/widget/components/property-grid/PropertyGridWrapper.js +2 -2
  147. package/lib/esm/widget/components/property-grid/PropertyGridWrapper.js.map +1 -1
  148. package/lib/esm/widget/components/property-grid/PropertyView.js +9 -6
  149. package/lib/esm/widget/components/property-grid/PropertyView.js.map +1 -1
  150. package/lib/esm/widget/components/viewerUtils.js.map +1 -1
  151. package/lib/esm/widget/hooks/useFormulaValidation.js +3 -2
  152. package/lib/esm/widget/hooks/useFormulaValidation.js.map +1 -1
  153. package/package.json +1 -1
  154. package/lib/cjs/formula/FormulaTokensValidator.d.ts +0 -5
  155. package/lib/cjs/formula/FormulaTokensValidator.js.map +0 -1
  156. package/lib/cjs/formula/FormulaValidator.d.ts +0 -3
  157. package/lib/cjs/formula/FormulaValidator.js +0 -35
  158. package/lib/cjs/formula/FormulaValidator.js.map +0 -1
  159. package/lib/cjs/widget/components/GroupQueryBuilderContext.js.map +0 -1
  160. package/lib/esm/formula/FormulaTokensValidator.d.ts +0 -5
  161. package/lib/esm/formula/FormulaTokensValidator.js.map +0 -1
  162. package/lib/esm/formula/FormulaValidator.d.ts +0 -3
  163. package/lib/esm/formula/FormulaValidator.js +0 -31
  164. package/lib/esm/formula/FormulaValidator.js.map +0 -1
  165. package/lib/esm/widget/components/GroupQueryBuilderContext.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"viewerUtils.js","sourceRoot":"","sources":["../../../../src/widget/components/viewerUtils.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEpE,OAAO,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO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,EAAE;QACvC,OAAO;KACR;IACD,MAAM,EAAE,GAAG,SAAS,CAAC,WAAW,CAAC,YAAY,CAAC;IAC9C,MAAM,IAAI,GAAG,iBAAiB,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;IAC/C,IAAI,CAAC,uBAAuB,CAAC,EAAE,CAAC,CAAC;AACnC,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,iCAAiC,GAAG,GAAG,EAAE;IACpD,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,YAAY,EAAE;QACvC,OAAO;KACR;IACD,MAAM,EAAE,GAAG,SAAS,CAAC,WAAW,CAAC,YAAY,CAAC;IAC9C,MAAM,IAAI,GAAG,iBAAiB,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;IAC/C,IAAI,CAAC,uBAAuB,CAAC,EAAE,CAAC,CAAC;IACjC,IAAI,CAAC,uBAAuB,CAAC,EAAE,CAAC,CAAC;AACnC,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAG,GAAG,EAAE;IAC3B,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,YAAY,EAAE;QACvC,OAAO;KACR;IACD,MAAM,EAAE,GAAG,SAAS,CAAC,WAAW,CAAC,YAAY,CAAC;IAC9C,MAAM,IAAI,GAAG,iBAAiB,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;IAC/C,IAAI,CAAC,uBAAuB,CAAC,EAAE,CAAC,CAAC;IACjC,IAAI,CAAC,uBAAuB,CAAC,EAAE,CAAC,CAAC;IACjC,IAAI,CAAC,mBAAmB,CAAC,EAAE,CAAC,CAAC;AAC/B,CAAC,CAAC","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 { ViewChangeOptions } from \"@itwin/core-frontend\";\nimport type { IModelConnection } from \"@itwin/core-frontend\";\nimport { EmphasizeElements, IModelApp } from \"@itwin/core-frontend\";\nimport type { ElementProps, FeatureAppearance } from \"@itwin/core-common\";\nimport { ColorDef, FeatureOverrideType } from \"@itwin/core-common\";\nimport { KeySet } from \"@itwin/presentation-common\";\nimport { HiliteSetProvider } from \"@itwin/presentation-frontend\";\n\nexport const isolateElementsByKeys = async (\n keySet: KeySet,\n replace = false,\n) => {\n if (!IModelApp.viewManager.selectedView) {\n return [];\n }\n\n const vp = IModelApp.viewManager.selectedView;\n\n const hiliteProvider: HiliteSetProvider = HiliteSetProvider.create({\n imodel: vp.iModel,\n });\n const set = await hiliteProvider.getHiliteSet(keySet);\n if (set.elements) {\n const ids = [...set.elements];\n isolateElements(ids, replace);\n return ids;\n }\n return [];\n};\n\nexport const isolateElementsById = async (\n elementIds: string[],\n iModelConnection: IModelConnection,\n replace = false,\n) => {\n if (!IModelApp.viewManager.selectedView) {\n return [];\n }\n\n const vp = IModelApp.viewManager.selectedView;\n\n const keySet = await manufactureKeys(elementIds, iModelConnection);\n const hiliteProvider: HiliteSetProvider = HiliteSetProvider.create({\n imodel: vp.iModel,\n });\n const set = await hiliteProvider.getHiliteSet(keySet);\n if (set.elements) {\n const ids = [...set.elements];\n isolateElements(ids, replace);\n return ids;\n }\n return [];\n};\n\nexport const isolateElements = (hilitedIds: string[], replace = false) => {\n if (!IModelApp.viewManager.selectedView) {\n return;\n }\n\n const vp = IModelApp.viewManager.selectedView;\n const emph = EmphasizeElements.getOrCreate(vp);\n\n emph.isolateElements(hilitedIds, vp, replace);\n};\n\nexport const clearIsolatedElements = () => {\n if (!IModelApp.viewManager.selectedView) {\n return;\n }\n const vp = IModelApp.viewManager.selectedView;\n const emph = EmphasizeElements.getOrCreate(vp);\n emph.clearIsolatedElements(vp);\n};\n\nexport const hideElementsById = async (\n elementIds: string[],\n iModelConnection: IModelConnection,\n replace = false,\n) => {\n if (!IModelApp.viewManager.selectedView) {\n return [];\n }\n\n const vp = IModelApp.viewManager.selectedView;\n\n const keySet = await manufactureKeys(elementIds, iModelConnection);\n const hiliteProvider: HiliteSetProvider = HiliteSetProvider.create({\n imodel: vp.iModel,\n });\n const set = await hiliteProvider.getHiliteSet(keySet);\n if (set.elements) {\n const ids = [...set.elements];\n hideElements(ids, replace);\n return ids;\n }\n return [];\n};\n\nexport const hideElements = (hilitedIds: string[], replace = false) => {\n if (!IModelApp.viewManager.selectedView) {\n return;\n }\n\n const vp = IModelApp.viewManager.selectedView;\n const emph = EmphasizeElements.getOrCreate(vp);\n\n emph.hideElements(hilitedIds, vp, replace);\n};\n\nexport const clearHiddenElements = () => {\n if (!IModelApp.viewManager.selectedView) {\n return;\n }\n const vp = IModelApp.viewManager.selectedView;\n const emph = EmphasizeElements.getOrCreate(vp);\n emph.clearHiddenElements(vp);\n};\n\nexport const overrideElementsById = async (\n iModelConnection: IModelConnection,\n elementIds: string[],\n color: string,\n overrideType = FeatureOverrideType.ColorOnly,\n) => {\n if (!IModelApp.viewManager.selectedView) {\n return [];\n }\n\n const vp = IModelApp.viewManager.selectedView;\n\n const keySet = await manufactureKeys(elementIds, iModelConnection);\n const hiliteProvider: HiliteSetProvider = HiliteSetProvider.create({\n imodel: vp.iModel,\n });\n const set = await hiliteProvider.getHiliteSet(keySet);\n if (set.elements) {\n const ids = [...set.elements];\n overrideElements(ids, color, overrideType);\n return ids;\n }\n return [];\n};\n\nexport const overrideElements = (\n hilitedIds: string[],\n color: string,\n overrideType = FeatureOverrideType.ColorOnly,\n) => {\n if (!IModelApp.viewManager.selectedView) {\n return;\n }\n\n const vp = IModelApp.viewManager.selectedView;\n const emph = EmphasizeElements.getOrCreate(vp);\n\n emph.overrideElements(\n hilitedIds,\n vp,\n ColorDef.fromString(color),\n overrideType,\n true,\n );\n};\n\nexport const clearOverriddenElements = () => {\n if (!IModelApp.viewManager.selectedView) {\n return;\n }\n const vp = IModelApp.viewManager.selectedView;\n const emph = EmphasizeElements.getOrCreate(vp);\n emph.clearOverriddenElements(vp);\n};\n\nexport const emphasizeElements = (\n hilitedIds: string[],\n defaultAppearance: FeatureAppearance | undefined = undefined,\n replace = false,\n) => {\n if (!IModelApp.viewManager.selectedView) {\n return;\n }\n\n const vp = IModelApp.viewManager.selectedView;\n const emph = EmphasizeElements.getOrCreate(vp);\n\n emph.wantEmphasis = true;\n emph.emphasizeElements(hilitedIds, vp, defaultAppearance, replace);\n};\n\nexport const emphasisElementsById = async (\n iModelConnection: IModelConnection,\n elementIds: string[],\n defaultAppearance: FeatureAppearance | undefined = undefined,\n replace = false,\n) => {\n if (!IModelApp.viewManager.selectedView) {\n return [];\n }\n\n const vp = IModelApp.viewManager.selectedView;\n\n const keySet = await manufactureKeys(elementIds, iModelConnection);\n const hiliteProvider: HiliteSetProvider = HiliteSetProvider.create({\n imodel: vp.iModel,\n });\n const set = await hiliteProvider.getHiliteSet(keySet);\n if (set.elements) {\n const ids = [...set.elements];\n emphasizeElements(ids, defaultAppearance, replace);\n return ids;\n }\n return [];\n};\n\nexport const emphasizeElementsByKeys = async (\n keySet: KeySet,\n defaultAppearance: FeatureAppearance | undefined = undefined,\n replace = false,\n) => {\n if (!IModelApp.viewManager.selectedView) {\n return [];\n }\n\n const vp = IModelApp.viewManager.selectedView;\n\n const hiliteProvider: HiliteSetProvider = HiliteSetProvider.create({\n imodel: vp.iModel,\n });\n const set = await hiliteProvider.getHiliteSet(keySet);\n if (set.elements) {\n const ids = [...set.elements];\n emphasizeElements(ids, defaultAppearance, replace);\n return ids;\n }\n return [];\n};\n\nexport const visualizeElementsById = async (\n elementIds: string[],\n color: string,\n iModelConnection: IModelConnection,\n replace = false,\n wantEmphasis = true,\n) => {\n if (!IModelApp.viewManager.selectedView) {\n return [];\n }\n\n const vp = IModelApp.viewManager.selectedView;\n\n const keySet = await manufactureKeys(elementIds, iModelConnection);\n const hiliteProvider: HiliteSetProvider = HiliteSetProvider.create({\n imodel: vp.iModel,\n });\n const set = await hiliteProvider.getHiliteSet(keySet);\n if (set.elements) {\n const ids = [...set.elements];\n visualizeElements(ids, color, replace, wantEmphasis);\n return ids;\n }\n return [];\n};\n\nexport const visualizeElementsByKeys = async (\n keySet: KeySet,\n color: string,\n replace = false,\n wantEmphasis = true,\n) => {\n if (!IModelApp.viewManager.selectedView) {\n return [];\n }\n\n const vp = IModelApp.viewManager.selectedView;\n\n const hiliteProvider: HiliteSetProvider = HiliteSetProvider.create({\n imodel: vp.iModel,\n });\n const set = await hiliteProvider.getHiliteSet(keySet);\n if (set.elements) {\n const ids = [...set.elements];\n visualizeElements(ids, color, replace, wantEmphasis);\n return ids;\n }\n return [];\n};\n\nexport const visualizeElements = (\n elementIds: string[],\n color: string,\n replace = false,\n wantEmphasis = true,\n) => {\n if (!IModelApp.viewManager.selectedView) {\n return;\n }\n\n const vp = IModelApp.viewManager.selectedView;\n const emph = EmphasizeElements.getOrCreate(vp);\n\n emph.overrideElements(\n elementIds,\n vp,\n ColorDef.fromString(color),\n FeatureOverrideType.ColorAndAlpha,\n true,\n );\n if (!wantEmphasis) {\n return;\n }\n emph.wantEmphasis = true;\n emph.emphasizeElements(elementIds, vp, undefined, replace);\n};\n\nexport const transparentOverriddenElements = () => {\n if (!IModelApp.viewManager.selectedView) {\n return;\n }\n\n const vp = IModelApp.viewManager.selectedView;\n const emph = EmphasizeElements.getOrCreate(vp);\n const ids = emph.getOverriddenElements()?.values();\n if (ids) {\n const toOverride = new Set<string>();\n Array.from(ids).forEach((a) => a.forEach((id) => toOverride.add(id)));\n emph.overrideElements(\n toOverride,\n vp,\n ColorDef.red.withAlpha(50),\n FeatureOverrideType.AlphaOnly,\n true,\n );\n }\n};\n\nexport const zoomToElements = async (elementIds: string[]) => {\n if (!IModelApp.viewManager.selectedView || elementIds.length === 0) {\n return;\n }\n\n const vp = IModelApp.viewManager.selectedView;\n const viewChangeOpts: ViewChangeOptions = {};\n viewChangeOpts.animateFrustumChange = true;\n // It was removed. Should be a prop to be passed to lookAtViewAlignedVolume within the implementation.\n // viewChangeOpts.marginPercent = new MarginPercent(0.1, 0.1, 0.1, 0.1);\n await vp.zoomToElements(elementIds, { ...viewChangeOpts });\n};\n\nexport const getHiliteIds = async (\n elementIds: string[],\n iModelConnection: IModelConnection,\n) => {\n if (!IModelApp.viewManager.selectedView) {\n return [];\n }\n\n const vp = IModelApp.viewManager.selectedView;\n\n const keySet = await manufactureKeys(elementIds, iModelConnection);\n const hiliteProvider: HiliteSetProvider = HiliteSetProvider.create({\n imodel: vp.iModel,\n });\n const set = await hiliteProvider.getHiliteSet(keySet);\n if (set.elements) {\n return [...set.elements];\n }\n return [];\n};\n\nexport const manufactureKeys = async (\n elementIds: string[],\n iModelConnection: IModelConnection,\n): Promise<KeySet> => {\n // segment ids into batches\n const batches: string[][] = [];\n let currBatch: string[] = [];\n const batchSize = 100000;\n for (const id of elementIds) {\n if (currBatch.length < batchSize) {\n currBatch.push(id);\n } else {\n batches.push(currBatch);\n currBatch = [id];\n }\n }\n if (currBatch.length > 0 && currBatch.length <= batchSize) {\n batches.push(currBatch);\n }\n\n // retrieve element properties in batches\n let elemProps: ElementProps[] = [];\n for (const batch of batches) {\n const props = await iModelConnection.elements.getProps(batch);\n elemProps = elemProps.concat(props);\n }\n\n const isElementId = (elem: {\n id: string | undefined;\n className: string;\n }): elem is {\n id: string;\n className: string;\n } => {\n return elem.id !== undefined;\n };\n\n // create keyset from the element properties\n const keys = elemProps\n .map((elem: ElementProps) => ({\n id: elem.id,\n className: elem.classFullName,\n }))\n .filter(isElementId);\n return new KeySet(keys);\n};\n\nexport const clearEmphasizedElements = () => {\n if (!IModelApp.viewManager.selectedView) {\n return;\n }\n const vp = IModelApp.viewManager.selectedView;\n const emph = EmphasizeElements.getOrCreate(vp);\n emph.clearEmphasizedElements(vp);\n};\n\nexport const clearEmphasizedOverriddenElements = () => {\n if (!IModelApp.viewManager.selectedView) {\n return;\n }\n const vp = IModelApp.viewManager.selectedView;\n const emph = EmphasizeElements.getOrCreate(vp);\n emph.clearEmphasizedElements(vp);\n emph.clearOverriddenElements(vp);\n};\n\nexport const clearAll = () => {\n if (!IModelApp.viewManager.selectedView) {\n return;\n }\n const vp = IModelApp.viewManager.selectedView;\n const emph = EmphasizeElements.getOrCreate(vp);\n emph.clearEmphasizedElements(vp);\n emph.clearOverriddenElements(vp);\n emph.clearHiddenElements(vp);\n};\n"]}
1
+ {"version":3,"file":"viewerUtils.js","sourceRoot":"","sources":["../../../../src/widget/components/viewerUtils.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEpE,OAAO,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAEjE,MAAM,CAAC,MAAM,qBAAqB,GAAG,KAAK,EACxC,MAAc,EACd,OAAO,GAAG,KAAK,EACf,EAAE;IACF,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,YAAY,EAAE;QACvC,OAAO,EAAE,CAAC;KACX;IAED,MAAM,EAAE,GAAG,SAAS,CAAC,WAAW,CAAC,YAAY,CAAC;IAE9C,MAAM,cAAc,GAAsB,iBAAiB,CAAC,MAAM,CAAC;QACjE,MAAM,EAAE,EAAE,CAAC,MAAM;KAClB,CAAC,CAAC;IACH,MAAM,GAAG,GAAG,MAAM,cAAc,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;IACtD,IAAI,GAAG,CAAC,QAAQ,EAAE;QAChB,MAAM,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,QAAQ,CAAC,CAAC;QAC9B,eAAe,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;QAC9B,OAAO,GAAG,CAAC;KACZ;IACD,OAAO,EAAE,CAAC;AACZ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG,KAAK,EACtC,UAAoB,EACpB,gBAAkC,EAClC,OAAO,GAAG,KAAK,EACf,EAAE;IACF,IAAI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AG,iBAAiB,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;IAC/C,IAAI,CAAC,uBAAuB,CAAC,EAAE,CAAC,CAAC;IACjC,IAAI,CAAC,uBAAuB,CAAC,EAAE,CAAC,CAAC;IACjC,IAAI,CAAC,mBAAmB,CAAC,EAAE,CAAC,CAAC;AAC/B,CAAC,CAAC","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 { IModelConnection, ViewChangeOptions } from \"@itwin/core-frontend\";\nimport { EmphasizeElements, IModelApp } from \"@itwin/core-frontend\";\nimport type { ElementProps, FeatureAppearance } from \"@itwin/core-common\";\nimport { ColorDef, FeatureOverrideType } from \"@itwin/core-common\";\nimport { KeySet } from \"@itwin/presentation-common\";\nimport { HiliteSetProvider } from \"@itwin/presentation-frontend\";\n\nexport const isolateElementsByKeys = async (\n keySet: KeySet,\n replace = false,\n) => {\n if (!IModelApp.viewManager.selectedView) {\n return [];\n }\n\n const vp = IModelApp.viewManager.selectedView;\n\n const hiliteProvider: HiliteSetProvider = HiliteSetProvider.create({\n imodel: vp.iModel,\n });\n const set = await hiliteProvider.getHiliteSet(keySet);\n if (set.elements) {\n const ids = [...set.elements];\n isolateElements(ids, replace);\n return ids;\n }\n return [];\n};\n\nexport const isolateElementsById = async (\n elementIds: string[],\n iModelConnection: IModelConnection,\n replace = false,\n) => {\n if (!IModelApp.viewManager.selectedView) {\n return [];\n }\n\n const vp = IModelApp.viewManager.selectedView;\n\n const keySet = await manufactureKeys(elementIds, iModelConnection);\n const hiliteProvider: HiliteSetProvider = HiliteSetProvider.create({\n imodel: vp.iModel,\n });\n const set = await hiliteProvider.getHiliteSet(keySet);\n if (set.elements) {\n const ids = [...set.elements];\n isolateElements(ids, replace);\n return ids;\n }\n return [];\n};\n\nexport const isolateElements = (hilitedIds: string[], replace = false) => {\n if (!IModelApp.viewManager.selectedView) {\n return;\n }\n\n const vp = IModelApp.viewManager.selectedView;\n const emph = EmphasizeElements.getOrCreate(vp);\n\n emph.isolateElements(hilitedIds, vp, replace);\n};\n\nexport const clearIsolatedElements = () => {\n if (!IModelApp.viewManager.selectedView) {\n return;\n }\n const vp = IModelApp.viewManager.selectedView;\n const emph = EmphasizeElements.getOrCreate(vp);\n emph.clearIsolatedElements(vp);\n};\n\nexport const hideElementsById = async (\n elementIds: string[],\n iModelConnection: IModelConnection,\n replace = false,\n) => {\n if (!IModelApp.viewManager.selectedView) {\n return [];\n }\n\n const vp = IModelApp.viewManager.selectedView;\n\n const keySet = await manufactureKeys(elementIds, iModelConnection);\n const hiliteProvider: HiliteSetProvider = HiliteSetProvider.create({\n imodel: vp.iModel,\n });\n const set = await hiliteProvider.getHiliteSet(keySet);\n if (set.elements) {\n const ids = [...set.elements];\n hideElements(ids, replace);\n return ids;\n }\n return [];\n};\n\nexport const hideElements = (hilitedIds: string[], replace = false) => {\n if (!IModelApp.viewManager.selectedView) {\n return;\n }\n\n const vp = IModelApp.viewManager.selectedView;\n const emph = EmphasizeElements.getOrCreate(vp);\n\n emph.hideElements(hilitedIds, vp, replace);\n};\n\nexport const clearHiddenElements = () => {\n if (!IModelApp.viewManager.selectedView) {\n return;\n }\n const vp = IModelApp.viewManager.selectedView;\n const emph = EmphasizeElements.getOrCreate(vp);\n emph.clearHiddenElements(vp);\n};\n\nexport const overrideElementsById = async (\n iModelConnection: IModelConnection,\n elementIds: string[],\n color: string,\n overrideType = FeatureOverrideType.ColorOnly,\n) => {\n if (!IModelApp.viewManager.selectedView) {\n return [];\n }\n\n const vp = IModelApp.viewManager.selectedView;\n\n const keySet = await manufactureKeys(elementIds, iModelConnection);\n const hiliteProvider: HiliteSetProvider = HiliteSetProvider.create({\n imodel: vp.iModel,\n });\n const set = await hiliteProvider.getHiliteSet(keySet);\n if (set.elements) {\n const ids = [...set.elements];\n overrideElements(ids, color, overrideType);\n return ids;\n }\n return [];\n};\n\nexport const overrideElements = (\n hilitedIds: string[],\n color: string,\n overrideType = FeatureOverrideType.ColorOnly,\n) => {\n if (!IModelApp.viewManager.selectedView) {\n return;\n }\n\n const vp = IModelApp.viewManager.selectedView;\n const emph = EmphasizeElements.getOrCreate(vp);\n\n emph.overrideElements(\n hilitedIds,\n vp,\n ColorDef.fromString(color),\n overrideType,\n true,\n );\n};\n\nexport const clearOverriddenElements = () => {\n if (!IModelApp.viewManager.selectedView) {\n return;\n }\n const vp = IModelApp.viewManager.selectedView;\n const emph = EmphasizeElements.getOrCreate(vp);\n emph.clearOverriddenElements(vp);\n};\n\nexport const emphasizeElements = (\n hilitedIds: string[],\n defaultAppearance: FeatureAppearance | undefined = undefined,\n replace = false,\n) => {\n if (!IModelApp.viewManager.selectedView) {\n return;\n }\n\n const vp = IModelApp.viewManager.selectedView;\n const emph = EmphasizeElements.getOrCreate(vp);\n\n emph.wantEmphasis = true;\n emph.emphasizeElements(hilitedIds, vp, defaultAppearance, replace);\n};\n\nexport const emphasisElementsById = async (\n iModelConnection: IModelConnection,\n elementIds: string[],\n defaultAppearance: FeatureAppearance | undefined = undefined,\n replace = false,\n) => {\n if (!IModelApp.viewManager.selectedView) {\n return [];\n }\n\n const vp = IModelApp.viewManager.selectedView;\n\n const keySet = await manufactureKeys(elementIds, iModelConnection);\n const hiliteProvider: HiliteSetProvider = HiliteSetProvider.create({\n imodel: vp.iModel,\n });\n const set = await hiliteProvider.getHiliteSet(keySet);\n if (set.elements) {\n const ids = [...set.elements];\n emphasizeElements(ids, defaultAppearance, replace);\n return ids;\n }\n return [];\n};\n\nexport const emphasizeElementsByKeys = async (\n keySet: KeySet,\n defaultAppearance: FeatureAppearance | undefined = undefined,\n replace = false,\n) => {\n if (!IModelApp.viewManager.selectedView) {\n return [];\n }\n\n const vp = IModelApp.viewManager.selectedView;\n\n const hiliteProvider: HiliteSetProvider = HiliteSetProvider.create({\n imodel: vp.iModel,\n });\n const set = await hiliteProvider.getHiliteSet(keySet);\n if (set.elements) {\n const ids = [...set.elements];\n emphasizeElements(ids, defaultAppearance, replace);\n return ids;\n }\n return [];\n};\n\nexport const visualizeElementsById = async (\n elementIds: string[],\n color: string,\n iModelConnection: IModelConnection,\n replace = false,\n wantEmphasis = true,\n) => {\n if (!IModelApp.viewManager.selectedView) {\n return [];\n }\n\n const vp = IModelApp.viewManager.selectedView;\n\n const keySet = await manufactureKeys(elementIds, iModelConnection);\n const hiliteProvider: HiliteSetProvider = HiliteSetProvider.create({\n imodel: vp.iModel,\n });\n const set = await hiliteProvider.getHiliteSet(keySet);\n if (set.elements) {\n const ids = [...set.elements];\n visualizeElements(ids, color, replace, wantEmphasis);\n return ids;\n }\n return [];\n};\n\nexport const visualizeElementsByKeys = async (\n keySet: KeySet,\n color: string,\n replace = false,\n wantEmphasis = true,\n) => {\n if (!IModelApp.viewManager.selectedView) {\n return [];\n }\n\n const vp = IModelApp.viewManager.selectedView;\n\n const hiliteProvider: HiliteSetProvider = HiliteSetProvider.create({\n imodel: vp.iModel,\n });\n const set = await hiliteProvider.getHiliteSet(keySet);\n if (set.elements) {\n const ids = [...set.elements];\n visualizeElements(ids, color, replace, wantEmphasis);\n return ids;\n }\n return [];\n};\n\nexport const visualizeElements = (\n elementIds: string[],\n color: string,\n replace = false,\n wantEmphasis = true,\n) => {\n if (!IModelApp.viewManager.selectedView) {\n return;\n }\n\n const vp = IModelApp.viewManager.selectedView;\n const emph = EmphasizeElements.getOrCreate(vp);\n\n emph.overrideElements(\n elementIds,\n vp,\n ColorDef.fromString(color),\n FeatureOverrideType.ColorAndAlpha,\n true,\n );\n if (!wantEmphasis) {\n return;\n }\n emph.wantEmphasis = true;\n emph.emphasizeElements(elementIds, vp, undefined, replace);\n};\n\nexport const transparentOverriddenElements = () => {\n if (!IModelApp.viewManager.selectedView) {\n return;\n }\n\n const vp = IModelApp.viewManager.selectedView;\n const emph = EmphasizeElements.getOrCreate(vp);\n const ids = emph.getOverriddenElements()?.values();\n if (ids) {\n const toOverride = new Set<string>();\n Array.from(ids).forEach((a) => a.forEach((id) => toOverride.add(id)));\n emph.overrideElements(\n toOverride,\n vp,\n ColorDef.red.withAlpha(50),\n FeatureOverrideType.AlphaOnly,\n true,\n );\n }\n};\n\nexport const zoomToElements = async (elementIds: string[]) => {\n if (!IModelApp.viewManager.selectedView || elementIds.length === 0) {\n return;\n }\n\n const vp = IModelApp.viewManager.selectedView;\n const viewChangeOpts: ViewChangeOptions = {};\n viewChangeOpts.animateFrustumChange = true;\n // It was removed. Should be a prop to be passed to lookAtViewAlignedVolume within the implementation.\n // viewChangeOpts.marginPercent = new MarginPercent(0.1, 0.1, 0.1, 0.1);\n await vp.zoomToElements(elementIds, { ...viewChangeOpts });\n};\n\nexport const getHiliteIds = async (\n elementIds: string[],\n iModelConnection: IModelConnection,\n) => {\n if (!IModelApp.viewManager.selectedView) {\n return [];\n }\n\n const vp = IModelApp.viewManager.selectedView;\n\n const keySet = await manufactureKeys(elementIds, iModelConnection);\n const hiliteProvider: HiliteSetProvider = HiliteSetProvider.create({\n imodel: vp.iModel,\n });\n const set = await hiliteProvider.getHiliteSet(keySet);\n if (set.elements) {\n return [...set.elements];\n }\n return [];\n};\n\nexport const manufactureKeys = async (\n elementIds: string[],\n iModelConnection: IModelConnection,\n): Promise<KeySet> => {\n // segment ids into batches\n const batches: string[][] = [];\n let currBatch: string[] = [];\n const batchSize = 100000;\n for (const id of elementIds) {\n if (currBatch.length < batchSize) {\n currBatch.push(id);\n } else {\n batches.push(currBatch);\n currBatch = [id];\n }\n }\n if (currBatch.length > 0 && currBatch.length <= batchSize) {\n batches.push(currBatch);\n }\n\n // retrieve element properties in batches\n let elemProps: ElementProps[] = [];\n for (const batch of batches) {\n const props = await iModelConnection.elements.getProps(batch);\n elemProps = elemProps.concat(props);\n }\n\n const isElementId = (elem: {\n id: string | undefined;\n className: string;\n }): elem is {\n id: string;\n className: string;\n } => {\n return elem.id !== undefined;\n };\n\n // create keyset from the element properties\n const keys = elemProps\n .map((elem: ElementProps) => ({\n id: elem.id,\n className: elem.classFullName,\n }))\n .filter(isElementId);\n return new KeySet(keys);\n};\n\nexport const clearEmphasizedElements = () => {\n if (!IModelApp.viewManager.selectedView) {\n return;\n }\n const vp = IModelApp.viewManager.selectedView;\n const emph = EmphasizeElements.getOrCreate(vp);\n emph.clearEmphasizedElements(vp);\n};\n\nexport const clearEmphasizedOverriddenElements = () => {\n if (!IModelApp.viewManager.selectedView) {\n return;\n }\n const vp = IModelApp.viewManager.selectedView;\n const emph = EmphasizeElements.getOrCreate(vp);\n emph.clearEmphasizedElements(vp);\n emph.clearOverriddenElements(vp);\n};\n\nexport const clearAll = () => {\n if (!IModelApp.viewManager.selectedView) {\n return;\n }\n const vp = IModelApp.viewManager.selectedView;\n const emph = EmphasizeElements.getOrCreate(vp);\n emph.clearEmphasizedElements(vp);\n emph.clearOverriddenElements(vp);\n emph.clearHiddenElements(vp);\n};\n"]}
@@ -3,15 +3,16 @@
3
3
  * See LICENSE.md in the project root for license terms and full copyright notice.
4
4
  *--------------------------------------------------------------------------------------------*/
5
5
  import { useEffect, useState } from "react";
6
- import { validateFormula } from "../../formula/FormulaValidator";
6
+ import { resolveFormulaDataType } from "../../formula/FormulaDataTypeResolver";
7
7
  import { debounce } from "../utils";
8
8
  function validate(formulaName, formula, properties, setFormulaErrorMessage, setIsValid) {
9
+ var _a;
9
10
  if (!formula) {
10
11
  setFormulaErrorMessage("");
11
12
  setIsValid(false);
12
13
  return false;
13
14
  }
14
- const error = validateFormula(formulaName, formula, properties);
15
+ const error = (_a = resolveFormulaDataType(formulaName, formula, properties).errorMessage) !== null && _a !== void 0 ? _a : "";
15
16
  setFormulaErrorMessage(error);
16
17
  setIsValid(!error);
17
18
  return !error;
@@ -1 +1 @@
1
- {"version":3,"file":"useFormulaValidation.js","sourceRoot":"","sources":["../../../../src/widget/hooks/useFormulaValidation.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAEjE,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEpC,SAAS,QAAQ,CAAC,WAAmB,EAAE,OAAe,EAAE,UAAuB,EAAE,sBAA2C,EAAE,UAAgC;IAC5J,IAAI,CAAC,OAAO,EAAE;QACZ,sBAAsB,CAAC,EAAE,CAAC,CAAC;QAC3B,UAAU,CAAC,KAAK,CAAC,CAAC;QAClB,OAAO,KAAK,CAAC;KACd;IAED,MAAM,KAAK,GAAG,eAAe,CAAC,WAAW,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;IAChE,sBAAsB,CAAC,KAAK,CAAC,CAAC;IAC9B,UAAU,CAAC,CAAC,KAAK,CAAC,CAAC;IACnB,OAAO,CAAC,KAAK,CAAC;AAChB,CAAC;AAED,MAAM,uBAAuB,GAAG,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;AAEzD,MAAM,UAAU,oBAAoB,CAAC,WAAmB,EAAE,OAAe,EAAE,UAAuB,EAAE,sBAA2C;IAC7I,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC9C,SAAS,CAAC,GAAG,EAAE,CAAC,uBAAuB,CAAC,WAAW,EAAE,OAAO,EAAE,UAAU,EAAE,sBAAsB,EAAE,UAAU,CAAC,EAAE,CAAC,WAAW,EAAE,OAAO,EAAE,UAAU,EAAE,sBAAsB,CAAC,CAAC,CAAC;IAC3K,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,WAAW,EAAE,OAAO,EAAE,UAAU,EAAE,sBAAsB,EAAE,UAAU,CAAC,EAAE,CAAC;AAC5H,CAAC","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 { useEffect, useState } from \"react\";\nimport { validateFormula } from \"../../formula/FormulaValidator\";\nimport type { PropertyMap } from \"../../formula/Types\";\nimport { debounce } from \"../utils\";\n\nfunction validate(formulaName: string, formula: string, properties: PropertyMap, setFormulaErrorMessage: (s: string) => void, setIsValid: (b: boolean) => void): boolean {\n if (!formula) {\n setFormulaErrorMessage(\"\");\n setIsValid(false);\n return false;\n }\n\n const error = validateFormula(formulaName, formula, properties);\n setFormulaErrorMessage(error);\n setIsValid(!error);\n return !error;\n}\n\nconst debouncedValidationFunc = debounce(validate, 1000);\n\nexport function useFormulaValidation(formulaName: string, formula: string, properties: PropertyMap, setFormulaErrorMessage: (s: string) => void) {\n const [isValid, setIsValid] = useState(false);\n useEffect(() => debouncedValidationFunc(formulaName, formula, properties, setFormulaErrorMessage, setIsValid), [formulaName, formula, properties, setFormulaErrorMessage]);\n return { isValid, forceValidation: () => validate(formulaName, formula, properties, setFormulaErrorMessage, setIsValid) };\n}\n"]}
1
+ {"version":3,"file":"useFormulaValidation.js","sourceRoot":"","sources":["../../../../src/widget/hooks/useFormulaValidation.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAE/E,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEpC,SAAS,QAAQ,CAAC,WAAmB,EAAE,OAAe,EAAE,UAAuB,EAAE,sBAA2C,EAAE,UAAgC;;IAC5J,IAAI,CAAC,OAAO,EAAE;QACZ,sBAAsB,CAAC,EAAE,CAAC,CAAC;QAC3B,UAAU,CAAC,KAAK,CAAC,CAAC;QAClB,OAAO,KAAK,CAAC;KACd;IAED,MAAM,KAAK,GAAG,MAAA,sBAAsB,CAAC,WAAW,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC,YAAY,mCAAI,EAAE,CAAC;IAC1F,sBAAsB,CAAC,KAAK,CAAC,CAAC;IAC9B,UAAU,CAAC,CAAC,KAAK,CAAC,CAAC;IACnB,OAAO,CAAC,KAAK,CAAC;AAChB,CAAC;AAED,MAAM,uBAAuB,GAAG,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;AAEzD,MAAM,UAAU,oBAAoB,CAAC,WAAmB,EAAE,OAAe,EAAE,UAAuB,EAAE,sBAA2C;IAC7I,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC9C,SAAS,CAAC,GAAG,EAAE,CAAC,uBAAuB,CAAC,WAAW,EAAE,OAAO,EAAE,UAAU,EAAE,sBAAsB,EAAE,UAAU,CAAC,EAAE,CAAC,WAAW,EAAE,OAAO,EAAE,UAAU,EAAE,sBAAsB,CAAC,CAAC,CAAC;IAC3K,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,WAAW,EAAE,OAAO,EAAE,UAAU,EAAE,sBAAsB,EAAE,UAAU,CAAC,EAAE,CAAC;AAC5H,CAAC","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 { useEffect, useState } from \"react\";\nimport { resolveFormulaDataType } from \"../../formula/FormulaDataTypeResolver\";\nimport type { PropertyMap } from \"../../formula/Types\";\nimport { debounce } from \"../utils\";\n\nfunction validate(formulaName: string, formula: string, properties: PropertyMap, setFormulaErrorMessage: (s: string) => void, setIsValid: (b: boolean) => void): boolean {\n if (!formula) {\n setFormulaErrorMessage(\"\");\n setIsValid(false);\n return false;\n }\n\n const error = resolveFormulaDataType(formulaName, formula, properties).errorMessage ?? \"\";\n setFormulaErrorMessage(error);\n setIsValid(!error);\n return !error;\n}\n\nconst debouncedValidationFunc = debounce(validate, 1000);\n\nexport function useFormulaValidation(formulaName: string, formula: string, properties: PropertyMap, setFormulaErrorMessage: (s: string) => void) {\n const [isValid, setIsValid] = useState(false);\n useEffect(() => debouncedValidationFunc(formulaName, formula, properties, setFormulaErrorMessage, setIsValid), [formulaName, formula, properties, setFormulaErrorMessage]);\n return { isValid, forceValidation: () => validate(formulaName, formula, properties, setFormulaErrorMessage, setIsValid) };\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itwin/grouping-mapping-widget",
3
- "version": "0.4.0",
3
+ "version": "0.5.2",
4
4
  "description": "An iTwin.js 3D Viewer Widget that interfaces with the iTwin Reporting Platform.",
5
5
  "keywords": [
6
6
  "Bentley",
@@ -1,5 +0,0 @@
1
- import type { Token } from "./InfixToPostfixConverter";
2
- import type { Queue } from "./Queue";
3
- import type { PropertyMap } from "./Types";
4
- export declare function validateTokens(formulaName: string, tokens: Queue<Token>, properties: PropertyMap): string;
5
- //# sourceMappingURL=FormulaTokensValidator.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FormulaTokensValidator.js","sourceRoot":"","sources":["../../../src/formula/FormulaTokensValidator.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,uEAAsF;AACtF,yEAA+G;AAE/G,uEAAsD;AAEtD,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,cAAc,CAAC,WAAmB,EAAE,MAAoB,EAAE,UAAuB;IAC/F,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QACrB,OAAO,0BAA0B,CAAC;IAEpC,MAAM,QAAQ,GAAG,IAAI,aAAK,EAAoB,CAAC;IAE/C,OAAO,MAAM,CAAC,MAAM,G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C,CAAC,mBAAmB,KAAK,CAAC,QAAQ,wBAAwB,CAAC;yBAC9H;qBACF;iBACF;gBAED,MAAM,KAAK,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,yCAAyC,KAAK,CAAC,KAAK,IAAI,CAAC;iBACjE;gBAED,MAAM,cAAc,GAAG,sDAA4B,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;gBAClE,IAAI,cAAc,CAAC,YAAY;oBAC7B,OAAO,aAAa,KAAK,CAAC,KAAK,iBAAiB,cAAc,CAAC,YAAY,EAAE,CAAC;;oBAE9E,QAAQ,CAAC,IAAI,CAAC,cAAc,CAAC,KAAM,CAAC,CAAC;gBAEvC,MAAM;SACT;KACF;IAED,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;QACzB,OAAO,qBAAqB,CAAC;KAC9B;IAED,MAAM,UAAU,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC;IAClC,IAAI,CAAC,UAAU,IAAI,UAAU,KAAK,WAAW,EAAE;QAC7C,OAAO,oCAAoC,CAAC;KAC7C;IAED,OAAO,EAAE,CAAC;AACZ,CAAC;AAzHD,wCAyHC","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 { Queue } from \"./Queue\";\nimport { Stack } from \"./Stack\";\nimport type { 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 validateTokens(formulaName: string, tokens: Queue<Token>, properties: PropertyMap): string {\n if (tokens.length === 0)\n return \"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 \"Formula cannot reference itself.\";\n\n const prop = properties[token.value];\n if (!prop)\n return `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 `Operator \"${token.value}\" is not supported.`;\n\n const operatorBounds = getOperatorArgumentCountBounds(token.value);\n if (!operatorBounds)\n return `Operator \"${token.value}\" is not supported.`;\n\n if (operatorBounds[0] === 2 && token.argCount === 1)\n return `Unary operator \"${token.value}\" is not supported.`;\n\n if (argStack.length < token.argCount) {\n return `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 `Operator \"${token.value}\" does not support ${token.argCount} operands.`;\n\n if (operationResult.errorMessage)\n return 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 `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 `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 `Function \"${token.value}\" requires at least 1 argument.`;\n } else {\n if (token.argCount === 1) {\n return `Function \"${token.value}\" requires at least ${fnArgBounds[0]} arguments, but only 1 argument was given.`;\n } else {\n return `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 `Function \"${token.value}\" requires exactly 1 argument, but ${token.argCount} arguments were given.`;\n } else {\n if (token.argCount === 1) {\n return `Function \"${token.value}\" requires exactly ${fnArgBounds[0]} arguments, but 1 argument was given.`;\n } else {\n return `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 `Too few arguments given for function \"${token.value}\".`;\n }\n\n const functionResult = getFormulaFunctionReturnType(fnArg, fArgs);\n if (functionResult.errorMessage)\n return `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 \"Formula is invalid.\";\n }\n\n const resultType = argStack.pop();\n if (!resultType || resultType === \"undefined\") {\n return \"Formula cannot always return null.\";\n }\n\n return \"\";\n}\n\n"]}
@@ -1,3 +0,0 @@
1
- import type { PropertyMap } from "./Types";
2
- export declare function validateFormula(formulaName: string, formula: string, properties: PropertyMap): string;
3
- //# sourceMappingURL=FormulaValidator.d.ts.map
@@ -1,35 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validateFormula = void 0;
4
- /*---------------------------------------------------------------------------------------------
5
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
6
- * See LICENSE.md in the project root for license terms and full copyright notice.
7
- *--------------------------------------------------------------------------------------------*/
8
- const FormulaSplitter_1 = require("./FormulaSplitter");
9
- const FormulaTokensValidator_1 = require("./FormulaTokensValidator");
10
- const InfixToPostfixConverter_1 = require("./InfixToPostfixConverter");
11
- const ParenthesisValidator_1 = require("./ParenthesisValidator");
12
- function validateFormula(formulaName, formula, properties) {
13
- var _a;
14
- const parenthesisState = ParenthesisValidator_1.validateParenthesis(formula);
15
- if (ParenthesisValidator_1.ParenthesisState.NotClosed === parenthesisState) {
16
- return "Opened but not closed parenthesis found.";
17
- }
18
- else if (ParenthesisValidator_1.ParenthesisState.NotOpened === parenthesisState) {
19
- return "Closed but not opened parenthesis found.";
20
- }
21
- let infixFormulaTokens;
22
- try {
23
- infixFormulaTokens = FormulaSplitter_1.splitFormula(formula);
24
- }
25
- catch (ex) {
26
- return ex.message;
27
- }
28
- const postfixFormulaTokens = InfixToPostfixConverter_1.convertInfixToPostfix(infixFormulaTokens);
29
- if (undefined === postfixFormulaTokens.value) {
30
- return (_a = postfixFormulaTokens.errorMessage) !== null && _a !== void 0 ? _a : "Unknown error";
31
- }
32
- return FormulaTokensValidator_1.validateTokens(formulaName, postfixFormulaTokens.value, properties);
33
- }
34
- exports.validateFormula = validateFormula;
35
- //# sourceMappingURL=FormulaValidator.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FormulaValidator.js","sourceRoot":"","sources":["../../../src/formula/FormulaValidator.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,uDAAiD;AACjD,qEAA0D;AAC1D,uEAAkE;AAClE,iEAA+E;AAG/E,SAAgB,eAAe,CAAC,WAAmB,EAAE,OAAe,EAAE,UAAuB;;IAC3F,MAAM,gBAAgB,GAAG,0CAAmB,CAAC,OAAO,CAAC,CAAC;IACtD,IAAI,uCAAgB,CAAC,SAAS,KAAK,gBAAgB,EAAE;QACnD,OAAO,0CAA0C,CAAC;KACnD;SAAM,IAAI,uCAAgB,CAAC,SAAS,KAAK,gBAAgB,EAAE;QAC1D,OAAO,0CAA0C,CAAC;KACnD;IAED,IAAI,kBAAkB,CAAC;IACvB,IAAI;QACF,kBAAkB,GAAG,8BAAY,CAAC,OAAO,CAAC,CAAC;KAC5C;IAAC,OAAO,EAAE,EAAE;QACX,OAAQ,EAAY,CAAC,OAAO,CAAC;KAC9B;IAED,MAAM,oBAAoB,GAAG,+CAAqB,CAAC,kBAAkB,CAAC,CAAC;IAEvE,IAAI,SAAS,KAAK,oBAAoB,CAAC,KAAK,EAAE;QAC5C,OAAO,MAAA,oBAAoB,CAAC,YAAY,mCAAI,eAAe,CAAC;KAC7D;IAED,OAAO,uCAAc,CAAC,WAAW,EAAE,oBAAoB,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;AAC7E,CAAC;AAtBD,0CAsBC","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 { splitFormula } from \"./FormulaSplitter\";\nimport { validateTokens } from \"./FormulaTokensValidator\";\nimport { convertInfixToPostfix } from \"./InfixToPostfixConverter\";\nimport { ParenthesisState, validateParenthesis } from \"./ParenthesisValidator\";\nimport type { PropertyMap } from \"./Types\";\n\nexport function validateFormula(formulaName: string, formula: string, properties: PropertyMap): string {\n const parenthesisState = validateParenthesis(formula);\n if (ParenthesisState.NotClosed === parenthesisState) {\n return \"Opened but not closed parenthesis found.\";\n } else if (ParenthesisState.NotOpened === parenthesisState) {\n return \"Closed but not opened parenthesis found.\";\n }\n\n let infixFormulaTokens;\n try {\n infixFormulaTokens = splitFormula(formula);\n } catch (ex) {\n return (ex as Error).message;\n }\n\n const postfixFormulaTokens = convertInfixToPostfix(infixFormulaTokens);\n\n if (undefined === postfixFormulaTokens.value) {\n return postfixFormulaTokens.errorMessage ?? \"Unknown error\";\n }\n\n return validateTokens(formulaName, postfixFormulaTokens.value, properties);\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"GroupQueryBuilderContext.js","sourceRoot":"","sources":["../../../../src/widget/components/GroupQueryBuilderContext.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,6CAA+B;AAE/B,iDAA8C;AAejC,QAAA,wBAAwB,GAAG,KAAK,CAAC,aAAa,CAAoB;IAC7E,mBAAmB,EAAE,EAAE;IACvB,sBAAsB,EAAE,GAAG,EAAE,CAAC,EAAE;IAChC,KAAK,EAAE,EAAE;IACT,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE;IAClB,YAAY,EAAE,IAAI,2BAAY,CAAC,SAAS,CAAC;IACzC,eAAe,EAAE,GAAG,EAAE,CAAC,IAAI,2BAAY,CAAC,SAAS,CAAC;IAClD,SAAS,EAAE,KAAK;IAChB,WAAW,EAAE,KAAK;IAClB,SAAS,EAAE,KAAK,IAAI,EAAE,GAAE,CAAC;CAC1B,CAAC,CAAC","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 * as React from \"react\";\nimport type { PropertyRecord } from \"@itwin/appui-abstract\";\nimport { QueryBuilder } from \"./QueryBuilder\";\n\nexport interface PropertySelection {\n currentPropertyList: PropertyRecord[];\n setCurrentPropertyList: React.Dispatch<\n React.SetStateAction<PropertyRecord[]>\n >;\n query: string;\n setQuery: React.Dispatch<React.SetStateAction<string>>;\n queryBuilder: QueryBuilder;\n setQueryBuilder: React.Dispatch<React.SetStateAction<QueryBuilder>>;\n isLoading: boolean;\n isRendering: boolean;\n resetView: () => Promise<void>;\n}\nexport const GroupQueryBuilderContext = React.createContext<PropertySelection>({\n currentPropertyList: [],\n setCurrentPropertyList: () => [],\n query: \"\",\n setQuery: () => \"\",\n queryBuilder: new QueryBuilder(undefined),\n setQueryBuilder: () => new QueryBuilder(undefined),\n isLoading: false,\n isRendering: false,\n resetView: async () => {},\n});\n"]}
@@ -1,5 +0,0 @@
1
- import type { Token } from "./InfixToPostfixConverter";
2
- import type { Queue } from "./Queue";
3
- import type { PropertyMap } from "./Types";
4
- export declare function validateTokens(formulaName: string, tokens: Queue<Token>, properties: PropertyMap): string;
5
- //# sourceMappingURL=FormulaTokensValidator.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FormulaTokensValidator.js","sourceRoot":"","sources":["../../../src/formula/FormulaTokensValidator.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,EAAE,4BAA4B,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACtF,OAAO,EAAE,8BAA8B,EAAE,qBAAqB,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAE/G,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAEtD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;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,MAAM,UAAU,cAAc,CAAC,WAAmB,EAAE,MAAoB,EAAE,UAAuB;IAC/F,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QACrB,OAAO,0BAA0B,CAAC;IAEpC,MAAM,QAAQ,GAAG,IAAI,KAAK,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,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CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,OAAO,EAAE,CAAC;gBACtD,IAAI,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC,QAAQ,EAAE;oBACjC,OAAO,yCAAyC,KAAK,CAAC,KAAK,IAAI,CAAC;iBACjE;gBAED,MAAM,cAAc,GAAG,4BAA4B,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;gBAClE,IAAI,cAAc,CAAC,YAAY;oBAC7B,OAAO,aAAa,KAAK,CAAC,KAAK,iBAAiB,cAAc,CAAC,YAAY,EAAE,CAAC;;oBAE9E,QAAQ,CAAC,IAAI,CAAC,cAAc,CAAC,KAAM,CAAC,CAAC;gBAEvC,MAAM;SACT;KACF;IAED,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;QACzB,OAAO,qBAAqB,CAAC;KAC9B;IAED,MAAM,UAAU,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC;IAClC,IAAI,CAAC,UAAU,IAAI,UAAU,KAAK,WAAW,EAAE;QAC7C,OAAO,oCAAoC,CAAC;KAC7C;IAED,OAAO,EAAE,CAAC;AACZ,CAAC","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 { Queue } from \"./Queue\";\nimport { Stack } from \"./Stack\";\nimport type { 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 validateTokens(formulaName: string, tokens: Queue<Token>, properties: PropertyMap): string {\n if (tokens.length === 0)\n return \"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 \"Formula cannot reference itself.\";\n\n const prop = properties[token.value];\n if (!prop)\n return `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 `Operator \"${token.value}\" is not supported.`;\n\n const operatorBounds = getOperatorArgumentCountBounds(token.value);\n if (!operatorBounds)\n return `Operator \"${token.value}\" is not supported.`;\n\n if (operatorBounds[0] === 2 && token.argCount === 1)\n return `Unary operator \"${token.value}\" is not supported.`;\n\n if (argStack.length < token.argCount) {\n return `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 `Operator \"${token.value}\" does not support ${token.argCount} operands.`;\n\n if (operationResult.errorMessage)\n return 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 `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 `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 `Function \"${token.value}\" requires at least 1 argument.`;\n } else {\n if (token.argCount === 1) {\n return `Function \"${token.value}\" requires at least ${fnArgBounds[0]} arguments, but only 1 argument was given.`;\n } else {\n return `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 `Function \"${token.value}\" requires exactly 1 argument, but ${token.argCount} arguments were given.`;\n } else {\n if (token.argCount === 1) {\n return `Function \"${token.value}\" requires exactly ${fnArgBounds[0]} arguments, but 1 argument was given.`;\n } else {\n return `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 `Too few arguments given for function \"${token.value}\".`;\n }\n\n const functionResult = getFormulaFunctionReturnType(fnArg, fArgs);\n if (functionResult.errorMessage)\n return `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 \"Formula is invalid.\";\n }\n\n const resultType = argStack.pop();\n if (!resultType || resultType === \"undefined\") {\n return \"Formula cannot always return null.\";\n }\n\n return \"\";\n}\n\n"]}
@@ -1,3 +0,0 @@
1
- import type { PropertyMap } from "./Types";
2
- export declare function validateFormula(formulaName: string, formula: string, properties: PropertyMap): string;
3
- //# sourceMappingURL=FormulaValidator.d.ts.map
@@ -1,31 +0,0 @@
1
- /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
5
- import { splitFormula } from "./FormulaSplitter";
6
- import { validateTokens } from "./FormulaTokensValidator";
7
- import { convertInfixToPostfix } from "./InfixToPostfixConverter";
8
- import { ParenthesisState, validateParenthesis } from "./ParenthesisValidator";
9
- export function validateFormula(formulaName, formula, properties) {
10
- var _a;
11
- const parenthesisState = validateParenthesis(formula);
12
- if (ParenthesisState.NotClosed === parenthesisState) {
13
- return "Opened but not closed parenthesis found.";
14
- }
15
- else if (ParenthesisState.NotOpened === parenthesisState) {
16
- return "Closed but not opened parenthesis found.";
17
- }
18
- let infixFormulaTokens;
19
- try {
20
- infixFormulaTokens = splitFormula(formula);
21
- }
22
- catch (ex) {
23
- return ex.message;
24
- }
25
- const postfixFormulaTokens = convertInfixToPostfix(infixFormulaTokens);
26
- if (undefined === postfixFormulaTokens.value) {
27
- return (_a = postfixFormulaTokens.errorMessage) !== null && _a !== void 0 ? _a : "Unknown error";
28
- }
29
- return validateTokens(formulaName, postfixFormulaTokens.value, properties);
30
- }
31
- //# sourceMappingURL=FormulaValidator.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FormulaValidator.js","sourceRoot":"","sources":["../../../src/formula/FormulaValidator.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAG/E,MAAM,UAAU,eAAe,CAAC,WAAmB,EAAE,OAAe,EAAE,UAAuB;;IAC3F,MAAM,gBAAgB,GAAG,mBAAmB,CAAC,OAAO,CAAC,CAAC;IACtD,IAAI,gBAAgB,CAAC,SAAS,KAAK,gBAAgB,EAAE;QACnD,OAAO,0CAA0C,CAAC;KACnD;SAAM,IAAI,gBAAgB,CAAC,SAAS,KAAK,gBAAgB,EAAE;QAC1D,OAAO,0CAA0C,CAAC;KACnD;IAED,IAAI,kBAAkB,CAAC;IACvB,IAAI;QACF,kBAAkB,GAAG,YAAY,CAAC,OAAO,CAAC,CAAC;KAC5C;IAAC,OAAO,EAAE,EAAE;QACX,OAAQ,EAAY,CAAC,OAAO,CAAC;KAC9B;IAED,MAAM,oBAAoB,GAAG,qBAAqB,CAAC,kBAAkB,CAAC,CAAC;IAEvE,IAAI,SAAS,KAAK,oBAAoB,CAAC,KAAK,EAAE;QAC5C,OAAO,MAAA,oBAAoB,CAAC,YAAY,mCAAI,eAAe,CAAC;KAC7D;IAED,OAAO,cAAc,CAAC,WAAW,EAAE,oBAAoB,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;AAC7E,CAAC","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 { splitFormula } from \"./FormulaSplitter\";\nimport { validateTokens } from \"./FormulaTokensValidator\";\nimport { convertInfixToPostfix } from \"./InfixToPostfixConverter\";\nimport { ParenthesisState, validateParenthesis } from \"./ParenthesisValidator\";\nimport type { PropertyMap } from \"./Types\";\n\nexport function validateFormula(formulaName: string, formula: string, properties: PropertyMap): string {\n const parenthesisState = validateParenthesis(formula);\n if (ParenthesisState.NotClosed === parenthesisState) {\n return \"Opened but not closed parenthesis found.\";\n } else if (ParenthesisState.NotOpened === parenthesisState) {\n return \"Closed but not opened parenthesis found.\";\n }\n\n let infixFormulaTokens;\n try {\n infixFormulaTokens = splitFormula(formula);\n } catch (ex) {\n return (ex as Error).message;\n }\n\n const postfixFormulaTokens = convertInfixToPostfix(infixFormulaTokens);\n\n if (undefined === postfixFormulaTokens.value) {\n return postfixFormulaTokens.errorMessage ?? \"Unknown error\";\n }\n\n return validateTokens(formulaName, postfixFormulaTokens.value, properties);\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"GroupQueryBuilderContext.js","sourceRoot":"","sources":["../../../../src/widget/components/GroupQueryBuilderContext.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAe9C,MAAM,CAAC,MAAM,wBAAwB,GAAG,KAAK,CAAC,aAAa,CAAoB;IAC7E,mBAAmB,EAAE,EAAE;IACvB,sBAAsB,EAAE,GAAG,EAAE,CAAC,EAAE;IAChC,KAAK,EAAE,EAAE;IACT,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE;IAClB,YAAY,EAAE,IAAI,YAAY,CAAC,SAAS,CAAC;IACzC,eAAe,EAAE,GAAG,EAAE,CAAC,IAAI,YAAY,CAAC,SAAS,CAAC;IAClD,SAAS,EAAE,KAAK;IAChB,WAAW,EAAE,KAAK;IAClB,SAAS,EAAE,KAAK,IAAI,EAAE,GAAE,CAAC;CAC1B,CAAC,CAAC","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 * as React from \"react\";\nimport type { PropertyRecord } from \"@itwin/appui-abstract\";\nimport { QueryBuilder } from \"./QueryBuilder\";\n\nexport interface PropertySelection {\n currentPropertyList: PropertyRecord[];\n setCurrentPropertyList: React.Dispatch<\n React.SetStateAction<PropertyRecord[]>\n >;\n query: string;\n setQuery: React.Dispatch<React.SetStateAction<string>>;\n queryBuilder: QueryBuilder;\n setQueryBuilder: React.Dispatch<React.SetStateAction<QueryBuilder>>;\n isLoading: boolean;\n isRendering: boolean;\n resetView: () => Promise<void>;\n}\nexport const GroupQueryBuilderContext = React.createContext<PropertySelection>({\n currentPropertyList: [],\n setCurrentPropertyList: () => [],\n query: \"\",\n setQuery: () => \"\",\n queryBuilder: new QueryBuilder(undefined),\n setQueryBuilder: () => new QueryBuilder(undefined),\n isLoading: false,\n isRendering: false,\n resetView: async () => {},\n});\n"]}