@itwin/grouping-mapping-widget 0.26.1 → 0.28.0

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 (173) hide show
  1. package/lib/cjs/WidgetShell/GroupingMapping.d.ts +3 -1
  2. package/lib/cjs/WidgetShell/GroupingMapping.js +1 -1
  3. package/lib/cjs/WidgetShell/GroupingMapping.js.map +1 -1
  4. package/lib/cjs/WidgetShell/GroupingMappingContent.d.ts +2 -1
  5. package/lib/cjs/WidgetShell/GroupingMappingContent.js +2 -2
  6. package/lib/cjs/WidgetShell/GroupingMappingContent.js.map +1 -1
  7. package/lib/cjs/WidgetShell/Router/GroupingMappingRouter.d.ts +2 -1
  8. package/lib/cjs/WidgetShell/Router/GroupingMappingRouter.js +5 -19
  9. package/lib/cjs/WidgetShell/Router/GroupingMappingRouter.js.map +1 -1
  10. package/lib/cjs/components/Groups/Groups.d.ts +2 -1
  11. package/lib/cjs/components/Groups/Groups.js +2 -2
  12. package/lib/cjs/components/Groups/Groups.js.map +1 -1
  13. package/lib/cjs/components/Groups/GroupsView.d.ts +2 -1
  14. package/lib/cjs/components/Groups/GroupsView.js +5 -5
  15. package/lib/cjs/components/Groups/GroupsView.js.map +1 -1
  16. package/lib/cjs/components/Groups/GroupsVisualization.d.ts +3 -1
  17. package/lib/cjs/components/Groups/GroupsVisualization.js +8 -3
  18. package/lib/cjs/components/Groups/GroupsVisualization.js.map +1 -1
  19. package/lib/cjs/components/Groups/GroupsVisualizationActions.d.ts +2 -1
  20. package/lib/cjs/components/Groups/GroupsVisualizationActions.js +36 -9
  21. package/lib/cjs/components/Groups/GroupsVisualizationActions.js.map +1 -1
  22. package/lib/cjs/components/Groups/hooks/useKeySetHiliteQueries.d.ts +1 -1
  23. package/lib/cjs/components/Mappings/MappingViewActionGroup.d.ts +1 -1
  24. package/lib/cjs/components/Mappings/MappingViewActionGroup.js +1 -2
  25. package/lib/cjs/components/Mappings/MappingViewActionGroup.js.map +1 -1
  26. package/lib/cjs/components/Mappings/Mappings.d.ts +1 -0
  27. package/lib/cjs/components/Mappings/Mappings.js.map +1 -1
  28. package/lib/cjs/components/Mappings/MappingsView.d.ts +2 -1
  29. package/lib/cjs/components/Mappings/MappingsView.js +4 -4
  30. package/lib/cjs/components/Mappings/MappingsView.js.map +1 -1
  31. package/lib/cjs/components/Properties/CalculatedProperties/CalculatedPropertyAction.d.ts +2 -0
  32. package/lib/cjs/components/Properties/CalculatedProperties/CalculatedPropertyAction.js +2 -1
  33. package/lib/cjs/components/Properties/CalculatedProperties/CalculatedPropertyAction.js.map +1 -1
  34. package/lib/cjs/components/Properties/CalculatedProperties/CalculatedPropertyActionWithVisuals.d.ts +7 -8
  35. package/lib/cjs/components/Properties/CalculatedProperties/CalculatedPropertyActionWithVisuals.js +21 -61
  36. package/lib/cjs/components/Properties/CalculatedProperties/CalculatedPropertyActionWithVisuals.js.map +1 -1
  37. package/lib/cjs/components/Properties/CalculatedProperties/SharedCalculatedPropertyForms.d.ts +5 -9
  38. package/lib/cjs/components/Properties/CalculatedProperties/SharedCalculatedPropertyForms.js +3 -12
  39. package/lib/cjs/components/Properties/CalculatedProperties/SharedCalculatedPropertyForms.js.map +1 -1
  40. package/lib/cjs/components/Properties/CustomCalculations/CustomCalculationAction.d.ts +8 -9
  41. package/lib/cjs/components/Properties/CustomCalculations/CustomCalculationAction.js +17 -164
  42. package/lib/cjs/components/Properties/CustomCalculations/CustomCalculationAction.js.map +1 -1
  43. package/lib/cjs/components/Properties/CustomCalculations/CustomCalculationAction.scss +4 -3
  44. package/lib/cjs/components/Properties/GroupProperties/GroupPropertyAction.js +76 -19
  45. package/lib/cjs/components/Properties/GroupProperties/GroupPropertyAction.js.map +1 -1
  46. package/lib/cjs/components/Properties/GroupProperties/GroupPropertyAction.scss +3 -2
  47. package/lib/cjs/components/Properties/GroupProperties/GroupPropertyTable.d.ts +2 -1
  48. package/lib/cjs/components/Properties/GroupProperties/GroupPropertyTable.js +12 -4
  49. package/lib/cjs/components/Properties/GroupProperties/GroupPropertyTable.js.map +1 -1
  50. package/lib/cjs/components/Properties/PropertyMenu.d.ts +2 -1
  51. package/lib/cjs/components/Properties/PropertyMenu.js +2 -7
  52. package/lib/cjs/components/Properties/PropertyMenu.js.map +1 -1
  53. package/lib/cjs/components/Properties/PropertyMenuWithVisualization.d.ts +1 -1
  54. package/lib/cjs/components/Properties/PropertyMenuWithVisualization.js +2 -2
  55. package/lib/cjs/components/Properties/PropertyMenuWithVisualization.js.map +1 -1
  56. package/lib/cjs/components/Properties/PropertyTable.d.ts +2 -1
  57. package/lib/cjs/components/Properties/PropertyTable.js +2 -2
  58. package/lib/cjs/components/Properties/PropertyTable.js.map +1 -1
  59. package/lib/cjs/components/Properties/PropertyTableToolbar.d.ts +2 -1
  60. package/lib/cjs/components/Properties/PropertyTableToolbar.js +3 -3
  61. package/lib/cjs/components/Properties/PropertyTableToolbar.js.map +1 -1
  62. package/lib/cjs/components/Properties/ScrollableExpandableBlock.d.ts +11 -0
  63. package/lib/cjs/components/Properties/ScrollableExpandableBlock.js +55 -0
  64. package/lib/cjs/components/Properties/ScrollableExpandableBlock.js.map +1 -0
  65. package/lib/cjs/components/Properties/hooks/useFormulaValidation.d.ts +6 -3
  66. package/lib/cjs/components/Properties/hooks/useFormulaValidation.js +59 -13
  67. package/lib/cjs/components/Properties/hooks/useFormulaValidation.js.map +1 -1
  68. package/lib/cjs/components/Properties/hooks/useForwardRef.d.ts +3 -0
  69. package/lib/cjs/components/Properties/hooks/useForwardRef.js +20 -0
  70. package/lib/cjs/components/Properties/hooks/useForwardRef.js.map +1 -0
  71. package/lib/cjs/components/SharedComponents/ActionPanel.d.ts +3 -1
  72. package/lib/cjs/components/SharedComponents/ActionPanel.js +3 -3
  73. package/lib/cjs/components/SharedComponents/ActionPanel.js.map +1 -1
  74. package/lib/cjs/formula/FormulaDataTypeResolver.d.ts +3 -2
  75. package/lib/cjs/formula/FormulaDataTypeResolver.js +10 -6
  76. package/lib/cjs/formula/FormulaDataTypeResolver.js.map +1 -1
  77. package/lib/cjs/grouping-mapping-widget.d.ts +0 -2
  78. package/lib/cjs/grouping-mapping-widget.js +1 -5
  79. package/lib/cjs/grouping-mapping-widget.js.map +1 -1
  80. package/lib/esm/WidgetShell/GroupingMapping.d.ts +3 -1
  81. package/lib/esm/WidgetShell/GroupingMapping.js +1 -1
  82. package/lib/esm/WidgetShell/GroupingMapping.js.map +1 -1
  83. package/lib/esm/WidgetShell/GroupingMappingContent.d.ts +2 -1
  84. package/lib/esm/WidgetShell/GroupingMappingContent.js +2 -2
  85. package/lib/esm/WidgetShell/GroupingMappingContent.js.map +1 -1
  86. package/lib/esm/WidgetShell/Router/GroupingMappingRouter.d.ts +2 -1
  87. package/lib/esm/WidgetShell/Router/GroupingMappingRouter.js +5 -19
  88. package/lib/esm/WidgetShell/Router/GroupingMappingRouter.js.map +1 -1
  89. package/lib/esm/components/Groups/Groups.d.ts +2 -1
  90. package/lib/esm/components/Groups/Groups.js +2 -2
  91. package/lib/esm/components/Groups/Groups.js.map +1 -1
  92. package/lib/esm/components/Groups/GroupsView.d.ts +2 -1
  93. package/lib/esm/components/Groups/GroupsView.js +5 -5
  94. package/lib/esm/components/Groups/GroupsView.js.map +1 -1
  95. package/lib/esm/components/Groups/GroupsVisualization.d.ts +3 -1
  96. package/lib/esm/components/Groups/GroupsVisualization.js +8 -3
  97. package/lib/esm/components/Groups/GroupsVisualization.js.map +1 -1
  98. package/lib/esm/components/Groups/GroupsVisualizationActions.d.ts +2 -1
  99. package/lib/esm/components/Groups/GroupsVisualizationActions.js +14 -7
  100. package/lib/esm/components/Groups/GroupsVisualizationActions.js.map +1 -1
  101. package/lib/esm/components/Groups/hooks/useKeySetHiliteQueries.d.ts +1 -1
  102. package/lib/esm/components/Mappings/MappingViewActionGroup.d.ts +1 -1
  103. package/lib/esm/components/Mappings/MappingViewActionGroup.js +1 -2
  104. package/lib/esm/components/Mappings/MappingViewActionGroup.js.map +1 -1
  105. package/lib/esm/components/Mappings/Mappings.d.ts +1 -0
  106. package/lib/esm/components/Mappings/Mappings.js.map +1 -1
  107. package/lib/esm/components/Mappings/MappingsView.d.ts +2 -1
  108. package/lib/esm/components/Mappings/MappingsView.js +4 -4
  109. package/lib/esm/components/Mappings/MappingsView.js.map +1 -1
  110. package/lib/esm/components/Properties/CalculatedProperties/CalculatedPropertyAction.d.ts +2 -0
  111. package/lib/esm/components/Properties/CalculatedProperties/CalculatedPropertyAction.js +2 -1
  112. package/lib/esm/components/Properties/CalculatedProperties/CalculatedPropertyAction.js.map +1 -1
  113. package/lib/esm/components/Properties/CalculatedProperties/CalculatedPropertyActionWithVisuals.d.ts +7 -8
  114. package/lib/esm/components/Properties/CalculatedProperties/CalculatedPropertyActionWithVisuals.js +23 -60
  115. package/lib/esm/components/Properties/CalculatedProperties/CalculatedPropertyActionWithVisuals.js.map +1 -1
  116. package/lib/esm/components/Properties/CalculatedProperties/SharedCalculatedPropertyForms.d.ts +5 -9
  117. package/lib/esm/components/Properties/CalculatedProperties/SharedCalculatedPropertyForms.js +4 -13
  118. package/lib/esm/components/Properties/CalculatedProperties/SharedCalculatedPropertyForms.js.map +1 -1
  119. package/lib/esm/components/Properties/CustomCalculations/CustomCalculationAction.d.ts +8 -9
  120. package/lib/esm/components/Properties/CustomCalculations/CustomCalculationAction.js +18 -142
  121. package/lib/esm/components/Properties/CustomCalculations/CustomCalculationAction.js.map +1 -1
  122. package/lib/esm/components/Properties/CustomCalculations/CustomCalculationAction.scss +4 -3
  123. package/lib/esm/components/Properties/GroupProperties/GroupPropertyAction.js +79 -22
  124. package/lib/esm/components/Properties/GroupProperties/GroupPropertyAction.js.map +1 -1
  125. package/lib/esm/components/Properties/GroupProperties/GroupPropertyAction.scss +3 -2
  126. package/lib/esm/components/Properties/GroupProperties/GroupPropertyTable.d.ts +2 -1
  127. package/lib/esm/components/Properties/GroupProperties/GroupPropertyTable.js +14 -6
  128. package/lib/esm/components/Properties/GroupProperties/GroupPropertyTable.js.map +1 -1
  129. package/lib/esm/components/Properties/PropertyMenu.d.ts +2 -1
  130. package/lib/esm/components/Properties/PropertyMenu.js +2 -7
  131. package/lib/esm/components/Properties/PropertyMenu.js.map +1 -1
  132. package/lib/esm/components/Properties/PropertyMenuWithVisualization.d.ts +1 -1
  133. package/lib/esm/components/Properties/PropertyMenuWithVisualization.js +2 -2
  134. package/lib/esm/components/Properties/PropertyMenuWithVisualization.js.map +1 -1
  135. package/lib/esm/components/Properties/PropertyTable.d.ts +2 -1
  136. package/lib/esm/components/Properties/PropertyTable.js +2 -2
  137. package/lib/esm/components/Properties/PropertyTable.js.map +1 -1
  138. package/lib/esm/components/Properties/PropertyTableToolbar.d.ts +2 -1
  139. package/lib/esm/components/Properties/PropertyTableToolbar.js +3 -3
  140. package/lib/esm/components/Properties/PropertyTableToolbar.js.map +1 -1
  141. package/lib/esm/components/Properties/ScrollableExpandableBlock.d.ts +11 -0
  142. package/lib/esm/components/Properties/ScrollableExpandableBlock.js +29 -0
  143. package/lib/esm/components/Properties/ScrollableExpandableBlock.js.map +1 -0
  144. package/lib/esm/components/Properties/hooks/useFormulaValidation.d.ts +6 -3
  145. package/lib/esm/components/Properties/hooks/useFormulaValidation.js +57 -12
  146. package/lib/esm/components/Properties/hooks/useFormulaValidation.js.map +1 -1
  147. package/lib/esm/components/Properties/hooks/useForwardRef.d.ts +3 -0
  148. package/lib/esm/components/Properties/hooks/useForwardRef.js +16 -0
  149. package/lib/esm/components/Properties/hooks/useForwardRef.js.map +1 -0
  150. package/lib/esm/components/SharedComponents/ActionPanel.d.ts +3 -1
  151. package/lib/esm/components/SharedComponents/ActionPanel.js +3 -3
  152. package/lib/esm/components/SharedComponents/ActionPanel.js.map +1 -1
  153. package/lib/esm/formula/FormulaDataTypeResolver.d.ts +3 -2
  154. package/lib/esm/formula/FormulaDataTypeResolver.js +10 -6
  155. package/lib/esm/formula/FormulaDataTypeResolver.js.map +1 -1
  156. package/lib/esm/grouping-mapping-widget.d.ts +0 -2
  157. package/lib/esm/grouping-mapping-widget.js +0 -2
  158. package/lib/esm/grouping-mapping-widget.js.map +1 -1
  159. package/package.json +1 -1
  160. package/lib/cjs/components/Properties/CalculatedProperties/CalculatedPropertyTable.d.ts +0 -14
  161. package/lib/cjs/components/Properties/CalculatedProperties/CalculatedPropertyTable.js +0 -87
  162. package/lib/cjs/components/Properties/CalculatedProperties/CalculatedPropertyTable.js.map +0 -1
  163. package/lib/cjs/components/Properties/CalculatedProperties/CalculatedPropertyTable.scss +0 -9
  164. package/lib/cjs/components/Properties/CustomCalculations/CustomCalculationTable.d.ts +0 -13
  165. package/lib/cjs/components/Properties/CustomCalculations/CustomCalculationTable.js +0 -91
  166. package/lib/cjs/components/Properties/CustomCalculations/CustomCalculationTable.js.map +0 -1
  167. package/lib/esm/components/Properties/CalculatedProperties/CalculatedPropertyTable.d.ts +0 -14
  168. package/lib/esm/components/Properties/CalculatedProperties/CalculatedPropertyTable.js +0 -60
  169. package/lib/esm/components/Properties/CalculatedProperties/CalculatedPropertyTable.js.map +0 -1
  170. package/lib/esm/components/Properties/CalculatedProperties/CalculatedPropertyTable.scss +0 -9
  171. package/lib/esm/components/Properties/CustomCalculations/CustomCalculationTable.d.ts +0 -13
  172. package/lib/esm/components/Properties/CustomCalculations/CustomCalculationTable.js +0 -64
  173. package/lib/esm/components/Properties/CustomCalculations/CustomCalculationTable.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"MappingsView.js","sourceRoot":"","sources":["../../../../src/components/Mappings/MappingsView.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE9D,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACpF,OA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AAC,6BAA6B,CAAC,KAAK,CAAC,EACnD,qBAAqB,EAAE,qBAAqB,EAC5C,SAAS,EAAE,qBAAqB,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,IAAI,GAClF,CACH;QACA,eAAe,IAAI,CAClB,oBAAC,WAAW,IACV,UAAU,EAAE,eAAe,EAAE,WAAW,EACxC,OAAO,EAAE,GAAG,EAAE,CAAC,kBAAkB,CAAC,SAAS,CAAC,EAC5C,QAAQ,EAAE,KAAK,IAAI,EAAE;gBACnB,MAAM,QAAQ,CAAC,eAAe,CAAC,CAAC;YAClC,CAAC,GACD,CACH;QACA,eAAe,IAAI,kBAAkB,IAAI,CACxC,oBAAC,wBAAwB,IAAC,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,iBAAiB,EAAE,cAAc,EAAE,cAAc,GAAI,CAC9I,CACA,CACJ,CAAC;AACJ,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 React, { useCallback, useMemo, useState } from \"react\";\nimport type { Alert } from \"@itwin/itwinui-react\";\nimport { Button, IconButton, List } from \"@itwin/itwinui-react\";\nimport { SvgAdd, SvgImport, SvgPlay, SvgRefresh } from \"@itwin/itwinui-icons-react\";\nimport { EmptyMessage } from \"../SharedComponents/EmptyMessage\";\nimport { LoadingOverlay } from \"../SharedComponents/LoadingOverlay\";\nimport \"./MappingsView.scss\";\nimport DeleteModal from \"../SharedComponents/DeleteModal\";\nimport { MappingImportWizardModal } from \"./Import/MappingImportWizardModal\";\nimport type { Mapping } from \"@itwin/insights-client\";\nimport { BlockingOverlay } from \"./BlockingOverlay\";\nimport type { ExtractionStatusData } from \"./Extraction/ExtractionStatusIcon\";\nimport { ExtractionStatusIcon } from \"./Extraction/ExtractionStatusIcon\";\nimport { MappingListItem } from \"./MappingListItem\";\nimport type { ExtractionMessageData } from \"./Extraction/ExtractionMessageModal\";\nimport { ExtractionMessageModal } from \"./Extraction/ExtractionMessageModal\";\nimport { BeEvent } from \"@itwin/core-bentley\";\nimport { useExtractionStateJobContext } from \"../context/ExtractionStateJobContext\";\nimport { useGroupingMappingApiConfig } from \"../context/GroupingApiConfigContext\";\nimport { useRunExtraction } from \"./hooks/useRunExtraction\";\n\nexport const mappingViewDefaultDisplayStrings = {\n mappings: \"Mappings\",\n iTwins: \"iTwins\",\n iTwinNumber: \"Number\",\n iTwinName: \"Name\",\n iTwinStatus: \"Status\",\n iModels: \"iModels\",\n iModelName: \"Name\",\n iModelDescription: \"Description\",\n};\n\n/**\n * @internal\n */\nexport interface MappingsViewProps {\n mappings: Mapping[];\n isLoading: boolean;\n extractionStatusData: ExtractionStatusData;\n showExtractionMessageModal: boolean;\n extractionMessageData: ExtractionMessageData[];\n setShowExtractionMessageModal: (show: boolean) => void;\n isTogglingExtraction: boolean;\n onRefreshMappings: () => Promise<void>;\n onRefreshExtractionStatus: () => Promise<void>;\n onToggleExtraction: (mapping: Mapping) => Promise<void>;\n onDelete: (mapping: Mapping) => Promise<void>;\n showDeleteModal: Mapping | undefined;\n setShowDeleteModal: (mapping?: Mapping) => void;\n displayStrings?: Partial<typeof mappingViewDefaultDisplayStrings>;\n showImportModal?: boolean;\n setShowImportModal?: (show: boolean) => void;\n onClickAddMapping?: () => void;\n onClickMappingTitle?: (mapping: Mapping) => void;\n onClickMappingModify?: (mapping: Mapping) => void;\n alert?: React.ReactElement<typeof Alert>;\n initialStateExtractionFlag?: boolean;\n setInitialExtractionStateFlag?: (initialStateExtractionFlag: boolean) => void;\n}\n\n/**\n * UI Component to list mappings and handle extraction.\n * @internal\n */\nexport const MappingsView = ({\n mappings,\n isLoading,\n extractionStatusData,\n showExtractionMessageModal,\n extractionMessageData,\n setShowExtractionMessageModal,\n isTogglingExtraction,\n onRefreshMappings,\n onRefreshExtractionStatus,\n onToggleExtraction,\n onDelete,\n showDeleteModal,\n setShowDeleteModal,\n displayStrings: userDisplayStrings,\n showImportModal,\n setShowImportModal,\n onClickAddMapping,\n onClickMappingTitle,\n onClickMappingModify,\n alert,\n}: MappingsViewProps) => {\n const displayStrings = React.useMemo(() => ({ ...mappingViewDefaultDisplayStrings, ...userDisplayStrings }), [userDisplayStrings]);\n const [selectedMappings, setSelectedMappings] = useState<Mapping[]>([]);\n const groupingMappingApiConfig = useGroupingMappingApiConfig();\n const { mappingIdJobInfo } = useExtractionStateJobContext();\n const { runExtraction } = useRunExtraction(groupingMappingApiConfig);\n\n const jobStartEvent = useMemo(() => new BeEvent<(mappingId: string) => void>(), []);\n\n const refreshAll = useCallback(async () => {\n await Promise.all([onRefreshMappings(), onRefreshExtractionStatus()]);\n }, [onRefreshMappings, onRefreshExtractionStatus]);\n\n const onSelectionChange = (mapping: Mapping) => {\n setSelectedMappings((mappingIdList) => {\n return mappingIdList.some((eachId) => mapping.id === eachId.id)\n ? mappingIdList.filter((eachId) => mapping.id !== eachId.id)\n : [...mappingIdList, mapping];\n });\n };\n\n const onRunExtraction = useCallback(async () => {\n await runExtraction(selectedMappings);\n selectedMappings.map((mapping) => {\n jobStartEvent.raiseEvent(mapping.id);\n });\n setSelectedMappings([]);\n }, [selectedMappings, jobStartEvent, runExtraction]);\n\n return (\n <>\n <BlockingOverlay isVisible={isTogglingExtraction} />\n <div className=\"gmw-mappings-view-container\">\n <div className=\"gmw-table-toolbar\">\n <div className=\"gmw-button-spacing\">\n {onClickAddMapping && (\n <Button startIcon={<SvgAdd />} onClick={onClickAddMapping} styleType=\"high-visibility\" title=\"New Mapping\">\n New\n </Button>\n )}\n {showImportModal !== undefined && setShowImportModal && (\n <IconButton title={`Import ${displayStrings.mappings}`} onClick={() => setShowImportModal(true)}>\n <SvgImport />\n </IconButton>\n )}\n <IconButton title=\"Run extraction\" onClick={onRunExtraction} disabled={selectedMappings.length === 0}>\n <SvgPlay />\n </IconButton>\n </div>\n <div className=\"gmw-button-spacing\">\n <ExtractionStatusIcon\n iconStatus={extractionStatusData.iconStatus}\n onClick={() => {\n if (extractionStatusData.iconStatus === \"negative\") {\n setShowExtractionMessageModal(true);\n }\n }}\n iconMessage={extractionStatusData.iconMessage}\n />\n <IconButton title=\"Refresh\" onClick={refreshAll} disabled={isLoading} styleType=\"borderless\">\n <SvgRefresh />\n </IconButton>\n </div>\n </div>\n {alert}\n <div className=\"gmw-mappings-border\" />\n {isLoading ? (\n <LoadingOverlay />\n ) : mappings.length === 0 ? (\n <EmptyMessage message={`No ${displayStrings.mappings} available.`} />\n ) : (\n <List className=\"gmw-mappings-list\">\n {mappings.map((mapping) => (\n <MappingListItem\n key={mapping.id}\n mapping={mapping}\n jobId={mappingIdJobInfo?.get(mapping.id) ?? \"\"}\n jobStartEvent={jobStartEvent}\n onClickMappingTitle={onClickMappingTitle}\n onSelectionChange={onSelectionChange}\n selected={selectedMappings.some((eachMapping) => mapping.id === eachMapping.id)}\n onToggleExtraction={onToggleExtraction}\n onRefreshMappings={onRefreshMappings}\n onClickMappingModify={onClickMappingModify}\n setShowDeleteModal={setShowDeleteModal}\n />\n ))}\n </List>\n )}\n </div>\n {showExtractionMessageModal && (\n <ExtractionMessageModal\n isOpen={showExtractionMessageModal}\n onClose={() => setShowExtractionMessageModal(false)}\n extractionMessageData={extractionMessageData}\n timestamp={extractionMessageData.length === 0 ? \"\" : extractionMessageData[0].date}\n />\n )}\n {showDeleteModal && (\n <DeleteModal\n entityName={showDeleteModal?.mappingName}\n onClose={() => setShowDeleteModal(undefined)}\n onDelete={async () => {\n await onDelete(showDeleteModal);\n }}\n />\n )}\n {showImportModal && setShowImportModal && (\n <MappingImportWizardModal show={showImportModal} setShow={setShowImportModal} onFinish={onRefreshMappings} displayStrings={displayStrings} />\n )}\n </>\n );\n};\n"]}
1
+ {"version":3,"file":"MappingsView.js","sourceRoot":"","sources":["../../../../src/components/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QAAQ,EAAE,gBAAgB,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,KAAK,WAAW,CAAC,EAAE,CAAC,EAC/E,kBAAkB,EAAE,kBAAkB,EACtC,iBAAiB,EAAE,iBAAiB,EACpC,oBAAoB,EAAE,oBAAoB,EAC1C,kBAAkB,EAAE,kBAAkB,GACtC,CACH,CAAC,CACG,CACR,CACG;QACL,0BAA0B,IAAI,CAC7B,oBAAC,sBAAsB,IACrB,MAAM,EAAE,0BAA0B,EAClC,OAAO,EAAE,GAAG,EAAE,CAAC,6BAA6B,CAAC,KAAK,CAAC,EACnD,qBAAqB,EAAE,qBAAqB,EAC5C,SAAS,EAAE,qBAAqB,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,IAAI,GAClF,CACH;QACA,eAAe,IAAI,CAClB,oBAAC,WAAW,IACV,UAAU,EAAE,eAAe,EAAE,WAAW,EACxC,OAAO,EAAE,GAAG,EAAE,CAAC,kBAAkB,CAAC,SAAS,CAAC,EAC5C,QAAQ,EAAE,KAAK,IAAI,EAAE;gBACnB,MAAM,QAAQ,CAAC,eAAe,CAAC,CAAC;YAClC,CAAC,GACD,CACH;QACA,eAAe,IAAI,kBAAkB,IAAI,CACxC,oBAAC,wBAAwB,IAAC,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,iBAAiB,EAAE,cAAc,EAAE,cAAc,GAAI,CAC9I,CACA,CACJ,CAAC;AACJ,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 React, { useCallback, useMemo, useState } from \"react\";\nimport type { Alert } from \"@itwin/itwinui-react\";\nimport { Button, IconButton, List } from \"@itwin/itwinui-react\";\nimport { SvgAdd, SvgImport, SvgPlay, SvgRefresh } from \"@itwin/itwinui-icons-react\";\nimport { EmptyMessage } from \"../SharedComponents/EmptyMessage\";\nimport { LoadingOverlay } from \"../SharedComponents/LoadingOverlay\";\nimport \"./MappingsView.scss\";\nimport DeleteModal from \"../SharedComponents/DeleteModal\";\nimport { MappingImportWizardModal } from \"./Import/MappingImportWizardModal\";\nimport type { Mapping } from \"@itwin/insights-client\";\nimport { BlockingOverlay } from \"./BlockingOverlay\";\nimport type { ExtractionStatusData } from \"./Extraction/ExtractionStatusIcon\";\nimport { ExtractionStatusIcon } from \"./Extraction/ExtractionStatusIcon\";\nimport { MappingListItem } from \"./MappingListItem\";\nimport type { ExtractionMessageData } from \"./Extraction/ExtractionMessageModal\";\nimport { ExtractionMessageModal } from \"./Extraction/ExtractionMessageModal\";\nimport { BeEvent } from \"@itwin/core-bentley\";\nimport { useExtractionStateJobContext } from \"../context/ExtractionStateJobContext\";\nimport { useGroupingMappingApiConfig } from \"../context/GroupingApiConfigContext\";\nimport { useRunExtraction } from \"./hooks/useRunExtraction\";\n\nexport const mappingViewDefaultDisplayStrings = {\n mappings: \"Mappings\",\n iTwins: \"iTwins\",\n iTwinNumber: \"Number\",\n iTwinName: \"Name\",\n iTwinStatus: \"Status\",\n iModels: \"iModels\",\n iModelName: \"Name\",\n iModelDescription: \"Description\",\n};\n\n/**\n * @internal\n */\nexport interface MappingsViewProps {\n mappings: Mapping[];\n isLoading: boolean;\n extractionStatusData: ExtractionStatusData;\n showExtractionMessageModal: boolean;\n extractionMessageData: ExtractionMessageData[];\n setShowExtractionMessageModal: (show: boolean) => void;\n isTogglingExtraction: boolean;\n onRefreshMappings: () => Promise<void>;\n onRefreshExtractionStatus: () => Promise<void>;\n onToggleExtraction: (mapping: Mapping) => Promise<void>;\n onDelete: (mapping: Mapping) => Promise<void>;\n showDeleteModal: Mapping | undefined;\n setShowDeleteModal: (mapping?: Mapping) => void;\n displayStrings?: Partial<typeof mappingViewDefaultDisplayStrings>;\n showImportModal?: boolean;\n setShowImportModal?: (show: boolean) => void;\n onClickAddMapping?: () => void;\n onClickMappingTitle?: (mapping: Mapping) => void;\n onClickMappingModify?: (mapping: Mapping) => void;\n alert?: React.ReactElement<typeof Alert>;\n initialStateExtractionFlag?: boolean;\n setInitialExtractionStateFlag?: (initialStateExtractionFlag: boolean) => void;\n hideRefreshIcon?: boolean;\n}\n\n/**\n * UI Component to list mappings and handle extraction.\n * @internal\n */\nexport const MappingsView = ({\n mappings,\n isLoading,\n extractionStatusData,\n showExtractionMessageModal,\n extractionMessageData,\n setShowExtractionMessageModal,\n isTogglingExtraction,\n onRefreshMappings,\n onRefreshExtractionStatus,\n onToggleExtraction,\n onDelete,\n showDeleteModal,\n setShowDeleteModal,\n displayStrings: userDisplayStrings,\n showImportModal,\n setShowImportModal,\n onClickAddMapping,\n onClickMappingTitle,\n onClickMappingModify,\n alert,\n hideRefreshIcon,\n}: MappingsViewProps) => {\n const displayStrings = React.useMemo(() => ({ ...mappingViewDefaultDisplayStrings, ...userDisplayStrings }), [userDisplayStrings]);\n const [selectedMappings, setSelectedMappings] = useState<Mapping[]>([]);\n const groupingMappingApiConfig = useGroupingMappingApiConfig();\n const { mappingIdJobInfo } = useExtractionStateJobContext();\n const { runExtraction } = useRunExtraction(groupingMappingApiConfig);\n\n const jobStartEvent = useMemo(() => new BeEvent<(mappingId: string) => void>(), []);\n\n const refreshAll = useCallback(async () => {\n await Promise.all([onRefreshMappings(), onRefreshExtractionStatus()]);\n }, [onRefreshMappings, onRefreshExtractionStatus]);\n\n const onSelectionChange = (mapping: Mapping) => {\n setSelectedMappings((mappingIdList) => {\n return mappingIdList.some((eachId) => mapping.id === eachId.id)\n ? mappingIdList.filter((eachId) => mapping.id !== eachId.id)\n : [...mappingIdList, mapping];\n });\n };\n\n const onRunExtraction = useCallback(async () => {\n await runExtraction(selectedMappings);\n selectedMappings.map((mapping) => {\n jobStartEvent.raiseEvent(mapping.id);\n });\n setSelectedMappings([]);\n }, [selectedMappings, jobStartEvent, runExtraction]);\n\n return (\n <>\n <BlockingOverlay isVisible={isTogglingExtraction} />\n <div className=\"gmw-mappings-view-container\">\n <div className=\"gmw-table-toolbar\">\n <div className=\"gmw-button-spacing\">\n {onClickAddMapping && (\n <Button startIcon={<SvgAdd />} onClick={onClickAddMapping} styleType=\"high-visibility\" title=\"New Mapping\">\n New\n </Button>\n )}\n {showImportModal !== undefined && setShowImportModal && (\n <IconButton title={`Import ${displayStrings.mappings}`} onClick={() => setShowImportModal(true)}>\n <SvgImport />\n </IconButton>\n )}\n <IconButton title=\"Run extraction\" onClick={onRunExtraction} disabled={selectedMappings.length === 0}>\n <SvgPlay />\n </IconButton>\n </div>\n <div className=\"gmw-button-spacing\">\n <ExtractionStatusIcon\n iconStatus={extractionStatusData.iconStatus}\n onClick={() => {\n if (extractionStatusData.iconStatus === \"negative\") {\n setShowExtractionMessageModal(true);\n }\n }}\n iconMessage={extractionStatusData.iconMessage}\n />\n {!hideRefreshIcon && (\n <IconButton title=\"Refresh\" onClick={refreshAll} disabled={isLoading} styleType=\"borderless\">\n <SvgRefresh />\n </IconButton>\n )}\n </div>\n </div>\n {alert}\n <div className=\"gmw-mappings-border\" />\n {isLoading && !isTogglingExtraction ? (\n <LoadingOverlay />\n ) : mappings.length === 0 ? (\n <EmptyMessage message={`No ${displayStrings.mappings} available.`} />\n ) : (\n <List className=\"gmw-mappings-list\">\n {mappings.map((mapping) => (\n <MappingListItem\n key={mapping.id}\n mapping={mapping}\n jobId={mappingIdJobInfo?.get(mapping.id) ?? \"\"}\n jobStartEvent={jobStartEvent}\n onClickMappingTitle={onClickMappingTitle}\n onSelectionChange={onSelectionChange}\n selected={selectedMappings.some((eachMapping) => mapping.id === eachMapping.id)}\n onToggleExtraction={onToggleExtraction}\n onRefreshMappings={onRefreshMappings}\n onClickMappingModify={onClickMappingModify}\n setShowDeleteModal={setShowDeleteModal}\n />\n ))}\n </List>\n )}\n </div>\n {showExtractionMessageModal && (\n <ExtractionMessageModal\n isOpen={showExtractionMessageModal}\n onClose={() => setShowExtractionMessageModal(false)}\n extractionMessageData={extractionMessageData}\n timestamp={extractionMessageData.length === 0 ? \"\" : extractionMessageData[0].date}\n />\n )}\n {showDeleteModal && (\n <DeleteModal\n entityName={showDeleteModal?.mappingName}\n onClose={() => setShowDeleteModal(undefined)}\n onDelete={async () => {\n await onDelete(showDeleteModal);\n }}\n />\n )}\n {showImportModal && setShowImportModal && (\n <MappingImportWizardModal show={showImportModal} setShow={setShowImportModal} onFinish={onRefreshMappings} displayStrings={displayStrings} />\n )}\n </>\n );\n};\n"]}
@@ -2,6 +2,7 @@
2
2
  import "./CalculatedPropertyAction.scss";
3
3
  import type { Group, Property } from "@itwin/insights-client";
4
4
  /**
5
+ * @deprecated in 0.27.0 The CalculatedPropertyActionProps has been superseded by the CalculatedPropertyActionWithVisualsProps and should not be used, use GroupPropertyActionProps and GroupPropertyAction component instead.
5
6
  * Props for the {@link CalculatedPropertyAction} component.
6
7
  * @public
7
8
  */
@@ -13,6 +14,7 @@ export interface CalculatedPropertyActionProps {
13
14
  onClickCancel?: () => void;
14
15
  }
15
16
  /**
17
+ * @deprecated in 0.27.0 The CalculatedPropertyAction has been superseded by the CalculatedPropertyActionWithVisuals and should not be used as a stand alone component, use GroupPropertyAction component instead.
16
18
  * Component to create or update a calculated property.
17
19
  * @public
18
20
  */
@@ -13,6 +13,7 @@ import { useGroupingMappingApiConfig } from "../../context/GroupingApiConfigCont
13
13
  import { useMutation, useQueryClient } from "@tanstack/react-query";
14
14
  import { usePropertiesClient } from "../../context/PropertiesClientContext";
15
15
  /**
16
+ * @deprecated in 0.27.0 The CalculatedPropertyAction has been superseded by the CalculatedPropertyActionWithVisuals and should not be used as a stand alone component, use GroupPropertyAction component instead.
16
17
  * Component to create or update a calculated property.
17
18
  * @public
18
19
  */
@@ -57,7 +58,7 @@ export const CalculatedPropertyAction = ({ mappingId, group, calculatedProperty,
57
58
  React.createElement(Fieldset, { legend: "Calculated Property Details", className: "gmw-details-form" },
58
59
  React.createElement("div", { className: "gmw-field-legend-container" },
59
60
  React.createElement(Text, { variant: "small", as: "small", className: "gmw-field-legend" }, "Asterisk * indicates mandatory fields.")),
60
- React.createElement(SharedCalculatedPropertyForms, { validator: validator, propertyName: propertyName, setPropertyName: setPropertyName, type: type, setType: setType }))),
61
+ React.createElement(SharedCalculatedPropertyForms, { calculatedPropertyType: type, setCalculatedPropertyType: setType }))),
61
62
  React.createElement(ActionPanel, { onSave: onSave, onCancel: onClickCancel, isSavingDisabled: !(type && propertyName), isLoading: isLoading })));
62
63
  };
63
64
  //# sourceMappingURL=CalculatedPropertyAction.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CalculatedPropertyAction.js","sourceRoot":"","sources":["../../../../../src/components/Properties/CalculatedProperties/CalculatedPropertyAction.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,WAAW,MAAM,oCAAoC,CAAC;AAC7D,OAAO,YAAY,MAAM,uBAAuB,CAAC;AACjD,OAAO,iCAAiC,CAAC;AAEzC,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAChF,OAAO,EAAE,2BAA2B,EAAE,MAAM,wCAAwC,CAAC;AACrF,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAc5E;;;GAGG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,kBAAkB,EAAE,aAAa,EAAE,aAAa,EAAiC,EAAE,EAAE;IAChJ,MAAM,EAAE,cAAc,EAAE,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AAC;YAChB,eAAe,CAAC,EAAE,CAAC,CAAC;YACpB,OAAO,CAAC,SAAS,CAAC,CAAC;QACrB,CAAC;KACF,CACF,CAAC;IAEF,MAAM,MAAM,GAAG,GAAG,EAAE;QAClB,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,CAAC,IAAI,EAAE;YAClC,qBAAqB,CAAC,IAAI,CAAC,CAAC;YAC5B,OAAO;SACR;QAED,YAAY,CAAC,IAAI,CAAC,CAAC;IACrB,CAAC,CAAC;IAEF,OAAO,CACL;QACE,6BAAK,SAAS,EAAC,4CAA4C;YACzD,oBAAC,QAAQ,IAAC,MAAM,EAAC,6BAA6B,EAAC,SAAS,EAAC,kBAAkB;gBACzE,6BAAK,SAAS,EAAC,4BAA4B;oBACzC,oBAAC,IAAI,IAAC,OAAO,EAAC,OAAO,EAAC,EAAE,EAAC,OAAO,EAAC,SAAS,EAAC,kBAAkB,6CAEtD,CACH;gBACN,oBAAC,6BAA6B,IAAC,SAAS,EAAE,SAAS,EAAE,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,eAAe,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,GAAI,CAC1I,CACP;QACN,oBAAC,WAAW,IAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,EAAE,gBAAgB,EAAE,CAAC,CAAC,IAAI,IAAI,YAAY,CAAC,EAAE,SAAS,EAAE,SAAS,GAAI,CACxH,CACJ,CAAC;AACJ,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 { Fieldset, Text } from \"@itwin/itwinui-react\";\nimport React, { useState } from \"react\";\nimport ActionPanel from \"../../SharedComponents/ActionPanel\";\nimport useValidator from \"../hooks/useValidator\";\nimport \"./CalculatedPropertyAction.scss\";\nimport type { CalculatedPropertyType, Group, Property } from \"@itwin/insights-client\";\nimport { DataType } from \"@itwin/insights-client\";\nimport { SharedCalculatedPropertyForms } from \"./SharedCalculatedPropertyForms\";\nimport { useGroupingMappingApiConfig } from \"../../context/GroupingApiConfigContext\";\nimport { useMutation, useQueryClient } from \"@tanstack/react-query\";\nimport { usePropertiesClient } from \"../../context/PropertiesClientContext\";\n\n/**\n * Props for the {@link CalculatedPropertyAction} component.\n * @public\n */\nexport interface CalculatedPropertyActionProps {\n mappingId: string;\n group: Group;\n calculatedProperty?: Property;\n onSaveSuccess: () => void;\n onClickCancel?: () => void;\n}\n\n/**\n * Component to create or update a calculated property.\n * @public\n */\nexport const CalculatedPropertyAction = ({ mappingId, group, calculatedProperty, onSaveSuccess, onClickCancel }: CalculatedPropertyActionProps) => {\n const { getAccessToken, iModelId } = useGroupingMappingApiConfig();\n const propertiesClient = usePropertiesClient();\n const [propertyName, setPropertyName] = useState<string>(calculatedProperty?.propertyName ?? \"\");\n const [type, setType] = useState<CalculatedPropertyType | undefined>(calculatedProperty?.calculatedPropertyType ?? undefined);\n const [validator, showValidationMessage] = useValidator();\n const queryClient = useQueryClient();\n\n const { mutate: saveMutation, isLoading } = useMutation(\n async (type: CalculatedPropertyType) => {\n const accessToken = await getAccessToken();\n\n return calculatedProperty\n ? propertiesClient.updateProperty(accessToken, mappingId, group.id, calculatedProperty.id, {\n ...calculatedProperty,\n propertyName,\n dataType: calculatedProperty.dataType,\n calculatedPropertyType: type,\n })\n : propertiesClient.createProperty(accessToken, mappingId, group.id, {\n propertyName,\n dataType: DataType.Double,\n calculatedPropertyType: type,\n });\n },\n {\n onSuccess: async () => {\n await queryClient.invalidateQueries({ queryKey: [\"properties\", iModelId, mappingId, group.id] });\n onSaveSuccess();\n setPropertyName(\"\");\n setType(undefined);\n },\n },\n );\n\n const onSave = () => {\n if (!validator.allValid() || !type) {\n showValidationMessage(true);\n return;\n }\n\n saveMutation(type);\n };\n\n return (\n <>\n <div className=\"gmw-calculated-properties-action-container\">\n <Fieldset legend=\"Calculated Property Details\" className=\"gmw-details-form\">\n <div className=\"gmw-field-legend-container\">\n <Text variant=\"small\" as=\"small\" className=\"gmw-field-legend\">\n Asterisk * indicates mandatory fields.\n </Text>\n </div>\n <SharedCalculatedPropertyForms validator={validator} propertyName={propertyName} setPropertyName={setPropertyName} type={type} setType={setType} />\n </Fieldset>\n </div>\n <ActionPanel onSave={onSave} onCancel={onClickCancel} isSavingDisabled={!(type && propertyName)} isLoading={isLoading} />\n </>\n );\n};\n"]}
1
+ {"version":3,"file":"CalculatedPropertyAction.js","sourceRoot":"","sources":["../../../../../src/components/Properties/CalculatedProperties/CalculatedPropertyAction.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,WAAW,MAAM,oCAAoC,CAAC;AAC7D,OAAO,YAAY,MAAM,uBAAuB,CAAC;AACjD,OAAO,iCAAiC,CAAC;AAEzC,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAChF,OAAO,EAAE,2BAA2B,EAAE,MAAM,wCAAwC,CAAC;AACrF,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAe5E;;;;GAIG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,kBAAkB,EAAE,aAAa,EAAE,aAAa,EAAiC,EAAE,EAAE;IAChJ,MAAM,EAAE,cAAc,EAAE,QAAQ,EAAE,GAAG,2BAA2B,EAAE,CAAC;IACnE,MAAM,gBAAgB,GAAG,mBAAmB,EAAE,CAAC;IAC/C,MAAM,CAAC,YAAY,EAA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,MAAM,GAAG,GAAG,EAAE;QAClB,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,CAAC,IAAI,EAAE;YAClC,qBAAqB,CAAC,IAAI,CAAC,CAAC;YAC5B,OAAO;SACR;QAED,YAAY,CAAC,IAAI,CAAC,CAAC;IACrB,CAAC,CAAC;IAEF,OAAO,CACL;QACE,6BAAK,SAAS,EAAC,4CAA4C;YACzD,oBAAC,QAAQ,IAAC,MAAM,EAAC,6BAA6B,EAAC,SAAS,EAAC,kBAAkB;gBACzE,6BAAK,SAAS,EAAC,4BAA4B;oBACzC,oBAAC,IAAI,IAAC,OAAO,EAAC,OAAO,EAAC,EAAE,EAAC,OAAO,EAAC,SAAS,EAAC,kBAAkB,6CAEtD,CACH;gBACN,oBAAC,6BAA6B,IAAC,sBAAsB,EAAE,IAAI,EAAE,yBAAyB,EAAE,OAAO,GAAI,CAC1F,CACP;QACN,oBAAC,WAAW,IAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,EAAE,gBAAgB,EAAE,CAAC,CAAC,IAAI,IAAI,YAAY,CAAC,EAAE,SAAS,EAAE,SAAS,GAAI,CACxH,CACJ,CAAC;AACJ,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 { Fieldset, Text } from \"@itwin/itwinui-react\";\nimport React, { useState } from \"react\";\nimport ActionPanel from \"../../SharedComponents/ActionPanel\";\nimport useValidator from \"../hooks/useValidator\";\nimport \"./CalculatedPropertyAction.scss\";\nimport type { CalculatedPropertyType, Group, Property } from \"@itwin/insights-client\";\nimport { DataType } from \"@itwin/insights-client\";\nimport { SharedCalculatedPropertyForms } from \"./SharedCalculatedPropertyForms\";\nimport { useGroupingMappingApiConfig } from \"../../context/GroupingApiConfigContext\";\nimport { useMutation, useQueryClient } from \"@tanstack/react-query\";\nimport { usePropertiesClient } from \"../../context/PropertiesClientContext\";\n\n/**\n * @deprecated in 0.27.0 The CalculatedPropertyActionProps has been superseded by the CalculatedPropertyActionWithVisualsProps and should not be used, use GroupPropertyActionProps and GroupPropertyAction component instead.\n * Props for the {@link CalculatedPropertyAction} component.\n * @public\n */\nexport interface CalculatedPropertyActionProps {\n mappingId: string;\n group: Group;\n calculatedProperty?: Property;\n onSaveSuccess: () => void;\n onClickCancel?: () => void;\n}\n\n/**\n * @deprecated in 0.27.0 The CalculatedPropertyAction has been superseded by the CalculatedPropertyActionWithVisuals and should not be used as a stand alone component, use GroupPropertyAction component instead.\n * Component to create or update a calculated property.\n * @public\n */\nexport const CalculatedPropertyAction = ({ mappingId, group, calculatedProperty, onSaveSuccess, onClickCancel }: CalculatedPropertyActionProps) => {\n const { getAccessToken, iModelId } = useGroupingMappingApiConfig();\n const propertiesClient = usePropertiesClient();\n const [propertyName, setPropertyName] = useState<string>(calculatedProperty?.propertyName ?? \"\");\n const [type, setType] = useState<CalculatedPropertyType | undefined>(calculatedProperty?.calculatedPropertyType ?? undefined);\n const [validator, showValidationMessage] = useValidator();\n const queryClient = useQueryClient();\n\n const { mutate: saveMutation, isLoading } = useMutation(\n async (type: CalculatedPropertyType) => {\n const accessToken = await getAccessToken();\n\n return calculatedProperty\n ? propertiesClient.updateProperty(accessToken, mappingId, group.id, calculatedProperty.id, {\n ...calculatedProperty,\n propertyName,\n dataType: calculatedProperty.dataType,\n calculatedPropertyType: type,\n })\n : propertiesClient.createProperty(accessToken, mappingId, group.id, {\n propertyName,\n dataType: DataType.Double,\n calculatedPropertyType: type,\n });\n },\n {\n onSuccess: async () => {\n await queryClient.invalidateQueries({ queryKey: [\"properties\", iModelId, mappingId, group.id] });\n onSaveSuccess();\n setPropertyName(\"\");\n setType(undefined);\n },\n },\n );\n\n const onSave = () => {\n if (!validator.allValid() || !type) {\n showValidationMessage(true);\n return;\n }\n\n saveMutation(type);\n };\n\n return (\n <>\n <div className=\"gmw-calculated-properties-action-container\">\n <Fieldset legend=\"Calculated Property Details\" className=\"gmw-details-form\">\n <div className=\"gmw-field-legend-container\">\n <Text variant=\"small\" as=\"small\" className=\"gmw-field-legend\">\n Asterisk * indicates mandatory fields.\n </Text>\n </div>\n <SharedCalculatedPropertyForms calculatedPropertyType={type} setCalculatedPropertyType={setType} />\n </Fieldset>\n </div>\n <ActionPanel onSave={onSave} onCancel={onClickCancel} isSavingDisabled={!(type && propertyName)} isLoading={isLoading} />\n </>\n );\n};\n"]}
@@ -1,20 +1,19 @@
1
1
  /// <reference types="react" />
2
2
  import "./CalculatedPropertyActionWithVisuals.scss";
3
- import type { GroupMinimal, Property } from "@itwin/insights-client";
3
+ import type { CalculatedPropertyType, GroupMinimal } from "@itwin/insights-client";
4
4
  /**
5
5
  * Props for the {@link CalculatedPropertyActionWithVisuals} component.
6
- * @public
6
+ * @internal
7
7
  */
8
8
  export interface CalculatedPropertyActionWithVisualsProps {
9
- mappingId: string;
10
9
  group: GroupMinimal;
11
- calculatedProperty?: Property;
12
- onSaveSuccess: () => void;
13
- onClickCancel?: () => void;
10
+ calculatedPropertyType?: CalculatedPropertyType;
11
+ isLoading?: boolean;
12
+ setCalculatedPropertyType: (calculatedPropertyType: CalculatedPropertyType | undefined) => void;
14
13
  }
15
14
  /**
16
15
  * Component to create or update a calculated property with visualizations.
17
- * @public
16
+ * @internal
18
17
  */
19
- export declare const CalculatedPropertyActionWithVisuals: ({ mappingId, group, calculatedProperty, onSaveSuccess, onClickCancel, }: CalculatedPropertyActionWithVisualsProps) => JSX.Element;
18
+ export declare const CalculatedPropertyActionWithVisuals: ({ group, calculatedPropertyType, isLoading, setCalculatedPropertyType, }: CalculatedPropertyActionWithVisualsProps) => JSX.Element;
20
19
  //# sourceMappingURL=CalculatedPropertyActionWithVisuals.d.ts.map
@@ -3,37 +3,27 @@
3
3
  * See LICENSE.md in the project root for license terms and full copyright notice.
4
4
  *--------------------------------------------------------------------------------------------*/
5
5
  import { IModelApp } from "@itwin/core-frontend";
6
- import { Fieldset, MenuItem, Text, ToggleSwitch } from "@itwin/itwinui-react";
6
+ import { InputGroup, MenuItem, ToggleSwitch } from "@itwin/itwinui-react";
7
7
  import React, { useEffect, useMemo, useState } from "react";
8
- import ActionPanel from "../../SharedComponents/ActionPanel";
9
8
  import { BboxDimension, BboxDimensionsDecorator } from "../../../decorators/BboxDimensionsDecorator";
10
- import useValidator from "../hooks/useValidator";
11
- import { visualizeElements, zoomToElements } from "../../../common/viewerUtils";
9
+ import { clearAll, visualizeElements, zoomToElements } from "../../../common/viewerUtils";
12
10
  import "./CalculatedPropertyActionWithVisuals.scss";
13
11
  import { useGroupingMappingApiConfig } from "../../context/GroupingApiConfigContext";
14
- import { DataType } from "@itwin/insights-client";
15
12
  import { SharedCalculatedPropertyForms } from "./SharedCalculatedPropertyForms";
16
13
  import { useGroupKeySetQuery } from "../../Groups/hooks/useKeySetHiliteQueries";
17
- import { useMutation, useQueryClient } from "@tanstack/react-query";
18
- import { usePropertiesClient } from "../../context/PropertiesClientContext";
19
14
  /**
20
15
  * Component to create or update a calculated property with visualizations.
21
- * @public
16
+ * @internal
22
17
  */
23
- export const CalculatedPropertyActionWithVisuals = ({ mappingId, group, calculatedProperty, onSaveSuccess, onClickCancel, }) => {
24
- const { getAccessToken, iModelId, iModelConnection } = useGroupingMappingApiConfig();
18
+ export const CalculatedPropertyActionWithVisuals = ({ group, calculatedPropertyType, isLoading, setCalculatedPropertyType, }) => {
19
+ const { iModelConnection } = useGroupingMappingApiConfig();
25
20
  if (!iModelConnection) {
26
21
  throw new Error("This component requires an active iModelConnection.");
27
22
  }
28
- const propertiesClient = usePropertiesClient();
29
- const [propertyName, setPropertyName] = useState(calculatedProperty?.propertyName ?? "");
30
- const [type, setType] = useState(calculatedProperty?.calculatedPropertyType);
31
23
  const [bboxDecorator, setBboxDecorator] = useState();
32
24
  const [inferredSpatialData, setInferredSpatialData] = useState();
33
- const [validator, showValidationMessage] = useValidator();
34
25
  const [colorProperty, setColorProperty] = useState(false);
35
26
  const { data } = useGroupKeySetQuery(group, iModelConnection, true);
36
- const queryClient = useQueryClient();
37
27
  const resolvedHiliteIds = useMemo(() => {
38
28
  // Resolved ids, default to an empty array if not available
39
29
  return data?.result?.ids ?? [];
@@ -48,10 +38,11 @@ export const CalculatedPropertyActionWithVisuals = ({ mappingId, group, calculat
48
38
  }, []);
49
39
  useEffect(() => {
50
40
  if (!colorProperty || resolvedHiliteIds.length === 0) {
41
+ clearAll();
51
42
  return;
52
43
  }
53
44
  visualizeElements(resolvedHiliteIds, "red");
54
- void zoomToElements(resolvedHiliteIds);
45
+ void zoomToElements([resolvedHiliteIds[0]]);
55
46
  }, [colorProperty, resolvedHiliteIds]);
56
47
  useEffect(() => {
57
48
  if (!colorProperty || resolvedHiliteIds.length === 0) {
@@ -66,53 +57,25 @@ export const CalculatedPropertyActionWithVisuals = ({ mappingId, group, calculat
66
57
  void setContext();
67
58
  }, [bboxDecorator, colorProperty, resolvedHiliteIds]);
68
59
  useEffect(() => {
69
- if (bboxDecorator && type && inferredSpatialData) {
70
- inferredSpatialData.has(BboxDimension[type]) && colorProperty
71
- ? bboxDecorator.drawContext(BboxDimension[type])
60
+ if (bboxDecorator && calculatedPropertyType && inferredSpatialData) {
61
+ inferredSpatialData.has(BboxDimension[calculatedPropertyType]) && colorProperty
62
+ ? bboxDecorator.drawContext(BboxDimension[calculatedPropertyType])
72
63
  : bboxDecorator.clearContext();
73
64
  }
74
- }, [bboxDecorator, colorProperty, inferredSpatialData, type]);
75
- const { mutate: saveMutation, isLoading } = useMutation(async (type) => {
76
- const accessToken = await getAccessToken();
77
- return calculatedProperty
78
- ? propertiesClient.updateProperty(accessToken, mappingId, group.id, calculatedProperty.id, {
79
- propertyName,
80
- dataType: calculatedProperty.dataType,
81
- calculatedPropertyType: type,
82
- })
83
- : propertiesClient.createProperty(accessToken, mappingId, group.id, {
84
- propertyName,
85
- dataType: DataType.Double,
86
- calculatedPropertyType: type,
87
- });
88
- }, {
89
- onSuccess: async () => {
90
- await queryClient.invalidateQueries({ queryKey: ["properties", iModelId, mappingId, group.id] });
91
- onSaveSuccess();
92
- setPropertyName("");
93
- setType(undefined);
94
- },
95
- });
96
- const onSave = () => {
97
- if (!validator.allValid() || !type) {
98
- showValidationMessage(true);
99
- return;
65
+ else {
66
+ bboxDecorator?.clearContext();
100
67
  }
101
- saveMutation(type);
102
- };
103
- const getSpatialData = (value) => inferredSpatialData?.has(BboxDimension[value]) && (React.createElement("div", null, `${inferredSpatialData?.get(BboxDimension[value])?.toPrecision(4)}m`));
104
- return (React.createElement(React.Fragment, null,
105
- React.createElement("div", { className: "gmw-calculated-properties-action-container" },
106
- React.createElement(Fieldset, { legend: "Calculated Property Details", className: "gmw-details-form" },
107
- React.createElement("div", { className: "gmw-field-legend-container" },
108
- React.createElement(Text, { variant: "small", as: "small", className: "gmw-field-legend" }, "Asterisk * indicates mandatory fields."),
109
- React.createElement(ToggleSwitch, { label: "Visualize Dimensions", labelPosition: "left", disabled: isLoading, checked: colorProperty, onChange: () => setColorProperty((b) => !b) })),
110
- React.createElement(SharedCalculatedPropertyForms, { validator: validator, propertyName: propertyName, setPropertyName: setPropertyName, type: type, setType: setType, itemRenderer: (option) => (React.createElement(MenuItem, null,
111
- React.createElement("div", { className: "gmw-gr-cp-menu-item" },
112
- React.createElement("div", null, option.label),
113
- getSpatialData(option.value)))), selectedItemRenderer: (option) => (React.createElement("div", { className: "gmw-select-item" },
68
+ }, [bboxDecorator, colorProperty, inferredSpatialData, calculatedPropertyType]);
69
+ const getSpatialData = (value) => value &&
70
+ inferredSpatialData?.has(BboxDimension[value]) && (React.createElement("div", null, `${inferredSpatialData?.get(BboxDimension[value])?.toPrecision(4)}m`));
71
+ return (React.createElement("div", { className: "gmw-calculated-properties-action-container" },
72
+ React.createElement(InputGroup, { className: "gmw-details-form" },
73
+ React.createElement(ToggleSwitch, { className: "gmw-field-legend-container", label: "Visualize Dimensions", labelPosition: "left", disabled: isLoading, checked: colorProperty, onChange: () => setColorProperty((b) => !b) }),
74
+ React.createElement(SharedCalculatedPropertyForms, { calculatedPropertyType: calculatedPropertyType, setCalculatedPropertyType: setCalculatedPropertyType, itemRenderer: (option) => (React.createElement(MenuItem, null,
75
+ React.createElement("div", { className: "gmw-gr-cp-menu-item" },
114
76
  React.createElement("div", null, option.label),
115
- getSpatialData(option.value))) }))),
116
- React.createElement(ActionPanel, { onSave: onSave, onCancel: onClickCancel, isSavingDisabled: !(type && propertyName), isLoading: isLoading })));
77
+ getSpatialData(option.value)))), selectedItemRenderer: (option) => (React.createElement("div", { className: "gmw-select-item" },
78
+ React.createElement("div", null, option.label),
79
+ getSpatialData(option.value))) }))));
117
80
  };
118
81
  //# sourceMappingURL=CalculatedPropertyActionWithVisuals.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CalculatedPropertyActionWithVisuals.js","sourceRoot":"","sources":["../../../../../src/components/Properties/CalculatedProperties/CalculatedPropertyActionWithVisuals.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAC9E,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5D,OAAO,WAAW,MAAM,oCAAoC,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,uBAAuB,EAAE,MAAM,6CAA6C,CAAC;AACrG,OAAO,YAAY,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAChF,OAAO,4CAA4C,CAAC;AACpD,OAAO,EAAE,2BAA2B,EAAE,MAAM,wCAAwC,CAAC;AACrF,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAElD,OAAO,EAAE,6BAA6B,EAAE,MA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CAAO;4BACxB,cAAc,CAAC,MAAM,CAAC,KAAK,CAAC,CACzB,CACG,CACZ,EACD,oBAAoB,EAAE,CAAC,MAA4B,EAAE,EAAE,CAAC,CACtD,6BAAK,SAAS,EAAC,iBAAiB;wBAC9B,iCAAM,MAAM,CAAC,KAAK,CAAO;wBACxB,cAAc,CAAC,MAAM,CAAC,KAAK,CAAC,CACzB,CACP,GACD,CACO,CACP;QACN,oBAAC,WAAW,IAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,EAAE,gBAAgB,EAAE,CAAC,CAAC,IAAI,IAAI,YAAY,CAAC,EAAE,SAAS,EAAE,SAAS,GAAI,CACxH,CACJ,CAAC;AACJ,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 { IModelApp } from \"@itwin/core-frontend\";\nimport type { SelectOption } from \"@itwin/itwinui-react\";\nimport { Fieldset, MenuItem, Text, ToggleSwitch } from \"@itwin/itwinui-react\";\nimport React, { useEffect, useMemo, useState } from \"react\";\nimport ActionPanel from \"../../SharedComponents/ActionPanel\";\nimport { BboxDimension, BboxDimensionsDecorator } from \"../../../decorators/BboxDimensionsDecorator\";\nimport useValidator from \"../hooks/useValidator\";\nimport { visualizeElements, zoomToElements } from \"../../../common/viewerUtils\";\nimport \"./CalculatedPropertyActionWithVisuals.scss\";\nimport { useGroupingMappingApiConfig } from \"../../context/GroupingApiConfigContext\";\nimport { DataType } from \"@itwin/insights-client\";\nimport type { CalculatedPropertyType, GroupMinimal, Property } from \"@itwin/insights-client\";\nimport { SharedCalculatedPropertyForms } from \"./SharedCalculatedPropertyForms\";\nimport { useGroupKeySetQuery } from \"../../Groups/hooks/useKeySetHiliteQueries\";\nimport { useMutation, useQueryClient } from \"@tanstack/react-query\";\nimport { usePropertiesClient } from \"../../context/PropertiesClientContext\";\n\n/**\n * Props for the {@link CalculatedPropertyActionWithVisuals} component.\n * @public\n */\nexport interface CalculatedPropertyActionWithVisualsProps {\n mappingId: string;\n group: GroupMinimal;\n calculatedProperty?: Property;\n onSaveSuccess: () => void;\n onClickCancel?: () => void;\n}\n\n/**\n * Component to create or update a calculated property with visualizations.\n * @public\n */\nexport const CalculatedPropertyActionWithVisuals = ({\n mappingId,\n group,\n calculatedProperty,\n onSaveSuccess,\n onClickCancel,\n}: CalculatedPropertyActionWithVisualsProps) => {\n const { getAccessToken, iModelId, iModelConnection } = useGroupingMappingApiConfig();\n if (!iModelConnection) {\n throw new Error(\"This component requires an active iModelConnection.\");\n }\n const propertiesClient = usePropertiesClient();\n const [propertyName, setPropertyName] = useState<string>(calculatedProperty?.propertyName ?? \"\");\n const [type, setType] = useState<CalculatedPropertyType | undefined>(calculatedProperty?.calculatedPropertyType);\n const [bboxDecorator, setBboxDecorator] = useState<BboxDimensionsDecorator | undefined>();\n const [inferredSpatialData, setInferredSpatialData] = useState<Map<BboxDimension, number> | undefined>();\n const [validator, showValidationMessage] = useValidator();\n const [colorProperty, setColorProperty] = useState<boolean>(false);\n const { data } = useGroupKeySetQuery(group, iModelConnection, true);\n const queryClient = useQueryClient();\n\n const resolvedHiliteIds = useMemo(() => {\n // Resolved ids, default to an empty array if not available\n return data?.result?.ids ?? [];\n }, [data?.result?.ids]);\n\n useEffect(() => {\n const decorator = new BboxDimensionsDecorator();\n IModelApp.viewManager.addDecorator(decorator);\n setBboxDecorator(decorator);\n return () => {\n IModelApp.viewManager.dropDecorator(decorator);\n };\n }, []);\n\n useEffect(() => {\n if (!colorProperty || resolvedHiliteIds.length === 0) {\n return;\n }\n visualizeElements(resolvedHiliteIds, \"red\");\n void zoomToElements(resolvedHiliteIds);\n }, [colorProperty, resolvedHiliteIds]);\n\n useEffect(() => {\n if (!colorProperty || resolvedHiliteIds.length === 0) {\n return;\n }\n const setContext = async () => {\n if (bboxDecorator) {\n await bboxDecorator.setContext(resolvedHiliteIds[0]);\n setInferredSpatialData(bboxDecorator.getInferredSpatialData());\n }\n };\n void setContext();\n }, [bboxDecorator, colorProperty, resolvedHiliteIds]);\n\n useEffect(() => {\n if (bboxDecorator && type && inferredSpatialData) {\n inferredSpatialData.has(BboxDimension[type as keyof typeof BboxDimension]) && colorProperty\n ? bboxDecorator.drawContext(BboxDimension[type as keyof typeof BboxDimension])\n : bboxDecorator.clearContext();\n }\n }, [bboxDecorator, colorProperty, inferredSpatialData, type]);\n\n const { mutate: saveMutation, isLoading } = useMutation(\n async (type: CalculatedPropertyType) => {\n const accessToken = await getAccessToken();\n\n return calculatedProperty\n ? propertiesClient.updateProperty(accessToken, mappingId, group.id, calculatedProperty.id, {\n propertyName,\n dataType: calculatedProperty.dataType,\n calculatedPropertyType: type,\n })\n : propertiesClient.createProperty(accessToken, mappingId, group.id, {\n propertyName,\n dataType: DataType.Double,\n calculatedPropertyType: type,\n });\n },\n {\n onSuccess: async () => {\n await queryClient.invalidateQueries({ queryKey: [\"properties\", iModelId, mappingId, group.id] });\n onSaveSuccess();\n setPropertyName(\"\");\n setType(undefined);\n },\n },\n );\n\n const onSave = () => {\n if (!validator.allValid() || !type) {\n showValidationMessage(true);\n return;\n }\n\n saveMutation(type);\n };\n\n const getSpatialData = (value: string) =>\n inferredSpatialData?.has(BboxDimension[value as keyof typeof BboxDimension]) && (\n <div>{`${inferredSpatialData?.get(BboxDimension[value as keyof typeof BboxDimension])?.toPrecision(4)}m`}</div>\n );\n\n return (\n <>\n <div className=\"gmw-calculated-properties-action-container\">\n <Fieldset legend=\"Calculated Property Details\" className=\"gmw-details-form\">\n <div className=\"gmw-field-legend-container\">\n <Text variant=\"small\" as=\"small\" className=\"gmw-field-legend\">\n Asterisk * indicates mandatory fields.\n </Text>\n <ToggleSwitch\n label=\"Visualize Dimensions\"\n labelPosition=\"left\"\n disabled={isLoading}\n checked={colorProperty}\n onChange={() => setColorProperty((b) => !b)}\n ></ToggleSwitch>\n </div>\n <SharedCalculatedPropertyForms\n validator={validator}\n propertyName={propertyName}\n setPropertyName={setPropertyName}\n type={type}\n setType={setType}\n itemRenderer={(option: SelectOption<string>) => (\n <MenuItem>\n <div className=\"gmw-gr-cp-menu-item\">\n <div>{option.label}</div>\n {getSpatialData(option.value)}\n </div>\n </MenuItem>\n )}\n selectedItemRenderer={(option: SelectOption<string>) => (\n <div className=\"gmw-select-item\">\n <div>{option.label}</div>\n {getSpatialData(option.value)}\n </div>\n )}\n />\n </Fieldset>\n </div>\n <ActionPanel onSave={onSave} onCancel={onClickCancel} isSavingDisabled={!(type && propertyName)} isLoading={isLoading} />\n </>\n );\n};\n"]}
1
+ {"version":3,"file":"CalculatedPropertyActionWithVisuals.js","sourceRoot":"","sources":["../../../../../src/components/Properties/CalculatedProperties/CalculatedPropertyActionWithVisuals.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAC1E,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,uBAAuB,EAAE,MAAM,6CAA6C,CAAC;AACrG,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC1F,OAAO,4CAA4C,CAAC;AACpD,OAAO,EAAE,2BAA2B,EAAE,MAAM,wCAAwC,CAAC;AAErF,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAChF,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAahF;;;GAGG;AACH,MAAM,CAAC,MAAM,mCAAmC,GAAG,CAAC,EAClD,KAAK,EACL,sBAAsB,EACtB,SAAS,EACT,yBAAyB,GACgB,EAAE,EAAE;IAC7C,MAAM,EAAE,gBAAgB,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4CAA4C;QACzD,oBAAC,UAAU,IAAC,SAAS,EAAC,kBAAkB;YACtC,oBAAC,YAAY,IACX,SAAS,EAAC,4BAA4B,EACtC,KAAK,EAAC,sBAAsB,EAC5B,aAAa,EAAC,MAAM,EACpB,QAAQ,EAAE,SAAS,EACnB,OAAO,EAAE,aAAa,EACtB,QAAQ,EAAE,GAAG,EAAE,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,GAC7B;YAChB,oBAAC,6BAA6B,IAC5B,sBAAsB,EAAE,sBAAsB,EAC9C,yBAAyB,EAAE,yBAAyB,EACpD,YAAY,EAAE,CAAC,MAAwC,EAAE,EAAE,CAAC,CAC1D,oBAAC,QAAQ;oBACP,6BAAK,SAAS,EAAC,qBAAqB;wBAClC,iCAAM,MAAM,CAAC,KAAK,CAAO;wBACxB,cAAc,CAAC,MAAM,CAAC,KAAK,CAAC,CACzB,CACG,CACZ,EACD,oBAAoB,EAAE,CAAC,MAAwC,EAAE,EAAE,CAAC,CAClE,6BAAK,SAAS,EAAC,iBAAiB;oBAC9B,iCAAM,MAAM,CAAC,KAAK,CAAO;oBACxB,cAAc,CAAC,MAAM,CAAC,KAAK,CAAC,CACzB,CACP,GACD,CACS,CACT,CACP,CAAC;AACJ,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 { IModelApp } from \"@itwin/core-frontend\";\nimport type { SelectOption } from \"@itwin/itwinui-react\";\nimport { InputGroup, MenuItem, ToggleSwitch } from \"@itwin/itwinui-react\";\nimport React, { useEffect, useMemo, useState } from \"react\";\nimport { BboxDimension, BboxDimensionsDecorator } from \"../../../decorators/BboxDimensionsDecorator\";\nimport { clearAll, visualizeElements, zoomToElements } from \"../../../common/viewerUtils\";\nimport \"./CalculatedPropertyActionWithVisuals.scss\";\nimport { useGroupingMappingApiConfig } from \"../../context/GroupingApiConfigContext\";\nimport type { CalculatedPropertyType, GroupMinimal } from \"@itwin/insights-client\";\nimport { SharedCalculatedPropertyForms } from \"./SharedCalculatedPropertyForms\";\nimport { useGroupKeySetQuery } from \"../../Groups/hooks/useKeySetHiliteQueries\";\n\n/**\n * Props for the {@link CalculatedPropertyActionWithVisuals} component.\n * @internal\n */\nexport interface CalculatedPropertyActionWithVisualsProps {\n group: GroupMinimal;\n calculatedPropertyType?: CalculatedPropertyType;\n isLoading?: boolean;\n setCalculatedPropertyType: (calculatedPropertyType: CalculatedPropertyType | undefined) => void;\n}\n\n/**\n * Component to create or update a calculated property with visualizations.\n * @internal\n */\nexport const CalculatedPropertyActionWithVisuals = ({\n group,\n calculatedPropertyType,\n isLoading,\n setCalculatedPropertyType,\n}: CalculatedPropertyActionWithVisualsProps) => {\n const { iModelConnection } = useGroupingMappingApiConfig();\n if (!iModelConnection) {\n throw new Error(\"This component requires an active iModelConnection.\");\n }\n const [bboxDecorator, setBboxDecorator] = useState<BboxDimensionsDecorator | undefined>();\n const [inferredSpatialData, setInferredSpatialData] = useState<Map<BboxDimension, number> | undefined>();\n const [colorProperty, setColorProperty] = useState<boolean>(false);\n const { data } = useGroupKeySetQuery(group, iModelConnection, true);\n\n const resolvedHiliteIds = useMemo(() => {\n // Resolved ids, default to an empty array if not available\n return data?.result?.ids ?? [];\n }, [data?.result?.ids]);\n\n useEffect(() => {\n const decorator = new BboxDimensionsDecorator();\n IModelApp.viewManager.addDecorator(decorator);\n setBboxDecorator(decorator);\n return () => {\n IModelApp.viewManager.dropDecorator(decorator);\n };\n }, []);\n\n useEffect(() => {\n if (!colorProperty || resolvedHiliteIds.length === 0) {\n clearAll();\n return;\n }\n visualizeElements(resolvedHiliteIds, \"red\");\n void zoomToElements([resolvedHiliteIds[0]]);\n }, [colorProperty, resolvedHiliteIds]);\n\n useEffect(() => {\n if (!colorProperty || resolvedHiliteIds.length === 0) {\n return;\n }\n const setContext = async () => {\n if (bboxDecorator) {\n await bboxDecorator.setContext(resolvedHiliteIds[0]);\n setInferredSpatialData(bboxDecorator.getInferredSpatialData());\n }\n };\n void setContext();\n }, [bboxDecorator, colorProperty, resolvedHiliteIds]);\n\n useEffect(() => {\n if (bboxDecorator && calculatedPropertyType && inferredSpatialData) {\n inferredSpatialData.has(BboxDimension[calculatedPropertyType as keyof typeof BboxDimension]) && colorProperty\n ? bboxDecorator.drawContext(BboxDimension[calculatedPropertyType as keyof typeof BboxDimension])\n : bboxDecorator.clearContext();\n } else {\n bboxDecorator?.clearContext();\n }\n }, [bboxDecorator, colorProperty, inferredSpatialData, calculatedPropertyType]);\n\n const getSpatialData = (value: string | undefined) =>\n value &&\n inferredSpatialData?.has(BboxDimension[value as keyof typeof BboxDimension]) && (\n <div>{`${inferredSpatialData?.get(BboxDimension[value as keyof typeof BboxDimension])?.toPrecision(4)}m`}</div>\n );\n\n return (\n <div className=\"gmw-calculated-properties-action-container\">\n <InputGroup className=\"gmw-details-form\">\n <ToggleSwitch\n className=\"gmw-field-legend-container\"\n label=\"Visualize Dimensions\"\n labelPosition=\"left\"\n disabled={isLoading}\n checked={colorProperty}\n onChange={() => setColorProperty((b) => !b)}\n ></ToggleSwitch>\n <SharedCalculatedPropertyForms\n calculatedPropertyType={calculatedPropertyType}\n setCalculatedPropertyType={setCalculatedPropertyType}\n itemRenderer={(option: SelectOption<string | undefined>) => (\n <MenuItem>\n <div className=\"gmw-gr-cp-menu-item\">\n <div>{option.label}</div>\n {getSpatialData(option.value)}\n </div>\n </MenuItem>\n )}\n selectedItemRenderer={(option: SelectOption<string | undefined>) => (\n <div className=\"gmw-select-item\">\n <div>{option.label}</div>\n {getSpatialData(option.value)}\n </div>\n )}\n />\n </InputGroup>\n </div>\n );\n};\n"]}
@@ -1,16 +1,12 @@
1
1
  /// <reference types="react" />
2
2
  import { CalculatedPropertyType } from "@itwin/insights-client";
3
3
  import type { SelectOption } from "@itwin/itwinui-react";
4
- import type SimpleReactValidator from "simple-react-validator";
5
4
  interface SharedCalculatedPropertyFormsProps {
6
- propertyName: string;
7
- setPropertyName: (value: string) => void;
8
- type: CalculatedPropertyType | undefined;
9
- setType: (value: CalculatedPropertyType | undefined) => void;
10
- validator: SimpleReactValidator;
11
- itemRenderer?: (option: SelectOption<string>) => JSX.Element;
12
- selectedItemRenderer?: (option: SelectOption<string>) => JSX.Element;
5
+ calculatedPropertyType: CalculatedPropertyType | undefined;
6
+ setCalculatedPropertyType: (value: CalculatedPropertyType | undefined) => void;
7
+ itemRenderer?: (option: SelectOption<string | undefined>) => JSX.Element;
8
+ selectedItemRenderer?: (option: SelectOption<string | undefined>) => JSX.Element;
13
9
  }
14
- export declare const SharedCalculatedPropertyForms: ({ propertyName, setPropertyName, type, setType, validator, itemRenderer, selectedItemRenderer, }: SharedCalculatedPropertyFormsProps) => JSX.Element;
10
+ export declare const SharedCalculatedPropertyForms: ({ calculatedPropertyType, setCalculatedPropertyType, itemRenderer, selectedItemRenderer, }: SharedCalculatedPropertyFormsProps) => JSX.Element;
15
11
  export {};
16
12
  //# sourceMappingURL=SharedCalculatedPropertyForms.d.ts.map
@@ -4,12 +4,12 @@
4
4
  *--------------------------------------------------------------------------------------------*/
5
5
  import { CalculatedPropertyType } from "@itwin/insights-client";
6
6
  import React, { useCallback } from "react";
7
- import { NAME_REQUIREMENTS } from "../hooks/useValidator";
8
- import { LabeledInput, LabeledSelect } from "@itwin/itwinui-react";
9
- export const SharedCalculatedPropertyForms = ({ propertyName, setPropertyName, type, setType, validator, itemRenderer, selectedItemRenderer, }) => {
7
+ import { LabeledSelect } from "@itwin/itwinui-react";
8
+ export const SharedCalculatedPropertyForms = ({ calculatedPropertyType, setCalculatedPropertyType, itemRenderer, selectedItemRenderer, }) => {
10
9
  const generateOptionsFromCalculatedPropertyType = useCallback(() => {
11
10
  const options = [];
12
11
  const indexableEnum = CalculatedPropertyType;
12
+ options.push({ value: undefined, label: "No Calculated Property Type" });
13
13
  for (const key in indexableEnum) {
14
14
  if (typeof indexableEnum[key] === "string" && key !== "Undefined") {
15
15
  // Generate labels by adding space between capitals
@@ -23,15 +23,6 @@ export const SharedCalculatedPropertyForms = ({ propertyName, setPropertyName, t
23
23
  return options;
24
24
  }, []);
25
25
  return (React.createElement(React.Fragment, null,
26
- React.createElement(LabeledInput, { value: propertyName, required: true, name: "name", label: "Name", onChange: (event) => {
27
- setPropertyName(event.target.value);
28
- validator.showMessageFor("name");
29
- }, message: validator.message("name", propertyName, NAME_REQUIREMENTS), status: validator.message("name", propertyName, NAME_REQUIREMENTS) ? "negative" : undefined, onBlur: () => {
30
- validator.showMessageFor("name");
31
- }, onBlurCapture: (event) => {
32
- setPropertyName(event.target.value);
33
- validator.showMessageFor("name");
34
- } }),
35
- React.createElement(LabeledSelect, { label: "Quantity Type", required: true, options: generateOptionsFromCalculatedPropertyType(), value: type, onChange: setType, itemRenderer: itemRenderer, selectedItemRenderer: selectedItemRenderer, onShow: () => { }, onHide: () => { } })));
26
+ React.createElement(LabeledSelect, { label: "Calculated Property Type", options: generateOptionsFromCalculatedPropertyType(), value: calculatedPropertyType, onChange: setCalculatedPropertyType, itemRenderer: itemRenderer, selectedItemRenderer: selectedItemRenderer, placeholder: 'No Calculated Property Type', onShow: () => { }, onHide: () => { } })));
36
27
  };
37
28
  //# sourceMappingURL=SharedCalculatedPropertyForms.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SharedCalculatedPropertyForms.js","sourceRoot":"","sources":["../../../../../src/components/Properties/CalculatedProperties/SharedCalculatedPropertyForms.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE1D,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAanE,MAAM,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,UAAU,CAAC,CAAC,CAAC,SAAS,EAC3F,MAAM,EAAE,GAAG,EAAE;gBACX,SAAS,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;YACnC,CAAC,EACD,aAAa,EAAE,CAAC,KAAK,EAAE,EAAE;gBACvB,eAAe,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;gBACpC,SAAS,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;YACnC,CAAC,GACD;QACF,oBAAC,aAAa,IACZ,KAAK,EAAC,eAAe,EACrB,QAAQ,QACR,OAAO,EAAE,yCAAyC,EAAE,EACpD,KAAK,EAAE,IAAI,EACX,QAAQ,EAAE,OAAO,EACjB,YAAY,EAAE,YAAY,EAC1B,oBAAoB,EAAE,oBAAoB,EAC1C,MAAM,EAAE,GAAG,EAAE,GAAE,CAAC,EAChB,MAAM,EAAE,GAAG,EAAE,GAAE,CAAC,GAChB,CACD,CACJ,CAAC;AACJ,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 { CalculatedPropertyType } from \"@itwin/insights-client\";\nimport React, { useCallback } from \"react\";\nimport { NAME_REQUIREMENTS } from \"../hooks/useValidator\";\nimport type { SelectOption } from \"@itwin/itwinui-react\";\nimport { LabeledInput, LabeledSelect } from \"@itwin/itwinui-react\";\nimport type SimpleReactValidator from \"simple-react-validator\";\n\ninterface SharedCalculatedPropertyFormsProps {\n propertyName: string;\n setPropertyName: (value: string) => void;\n type: CalculatedPropertyType | undefined;\n setType: (value: CalculatedPropertyType | undefined) => void;\n validator: SimpleReactValidator;\n itemRenderer?: (option: SelectOption<string>) => JSX.Element;\n selectedItemRenderer?: (option: SelectOption<string>) => JSX.Element;\n}\n\nexport const SharedCalculatedPropertyForms = ({\n propertyName,\n setPropertyName,\n type,\n setType,\n validator,\n itemRenderer,\n selectedItemRenderer,\n}: SharedCalculatedPropertyFormsProps) => {\n const generateOptionsFromCalculatedPropertyType = useCallback(() => {\n const options: SelectOption<CalculatedPropertyType>[] = [];\n\n const indexableEnum = CalculatedPropertyType as unknown as { [key: string]: string };\n\n for (const key in indexableEnum) {\n if (typeof indexableEnum[key] === \"string\" && key !== \"Undefined\") {\n // Generate labels by adding space between capitals\n const label = key\n .replace(/([A-Z])/g, \" $1\")\n .trim()\n .replace(/^\\w/, (c) => c.toUpperCase());\n options.push({ value: indexableEnum[key] as CalculatedPropertyType, label });\n }\n }\n return options;\n }, []);\n\n return (\n <>\n <LabeledInput\n value={propertyName}\n required\n name=\"name\"\n label=\"Name\"\n onChange={(event) => {\n setPropertyName(event.target.value);\n validator.showMessageFor(\"name\");\n }}\n message={validator.message(\"name\", propertyName, NAME_REQUIREMENTS)}\n status={validator.message(\"name\", propertyName, NAME_REQUIREMENTS) ? \"negative\" : undefined}\n onBlur={() => {\n validator.showMessageFor(\"name\");\n }}\n onBlurCapture={(event) => {\n setPropertyName(event.target.value);\n validator.showMessageFor(\"name\");\n }}\n />\n <LabeledSelect<CalculatedPropertyType>\n label=\"Quantity Type\"\n required\n options={generateOptionsFromCalculatedPropertyType()}\n value={type}\n onChange={setType}\n itemRenderer={itemRenderer}\n selectedItemRenderer={selectedItemRenderer}\n onShow={() => {}}\n onHide={() => {}}\n />\n </>\n );\n};\n"]}
1
+ {"version":3,"file":"SharedCalculatedPropertyForms.js","sourceRoot":"","sources":["../../../../../src/components/Properties/CalculatedProperties/SharedCalculatedPropertyForms.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAE3C,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AASrD,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,EAC5C,sBAAsB,EACtB,yBAAyB,EACzB,YAAY,EACZ,oBAAoB,GACe,EAAE,EAAE;IACvC,MAAM,yCAAyC,GAAG,WAAW,CAAC,GAAG,EAAE;QACjE,MAAM,OAAO,GAAuD,EAAE,CAAC;QACvE,MAAM,aAAa,GAAG,sBAA8D,CAAC;QAErF,OAAO,CAAC,IAAI,CAAC,EAAC,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,6BAA6B,EAAC,CAAC,CAAC;QACvE,KAAK,MAAM,GAAG,IAAI,aAAa,EAAE;YAC/B,IAAI,OAAO,aAAa,CAAC,GAAG,CAAC,KAAK,QAAQ,IAAI,GAAG,KAAK,WAAW,EAAE;gBACjE,mDAAmD;gBACnD,MAAM,KAAK,GAAG,GAAG;qBACd,OAAO,CAAC,UAAU,EAAE,KAAK,CAAC;qBAC1B,IAAI,EAAE;qBACN,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;gBAC1C,OAAO,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,aAAa,CAAC,GAAG,CAA2B,EAAE,KAAK,EAAE,CAAC,CAAC;aAC9E;SACF;QACD,OAAO,OAAO,CAAC;IACjB,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,CACL;QACE,oBAAC,aAAa,IACZ,KAAK,EAAC,0BAA0B,EAChC,OAAO,EAAE,yCAAyC,EAAE,EACpD,KAAK,EAAE,sBAAsB,EAC7B,QAAQ,EAAE,yBAAyB,EACnC,YAAY,EAAE,YAAY,EAC1B,oBAAoB,EAAE,oBAAoB,EAC1C,WAAW,EAAG,6BAA6B,EAC3C,MAAM,EAAE,GAAG,EAAE,GAAG,CAAC,EACjB,MAAM,EAAE,GAAG,EAAE,GAAG,CAAC,GACjB,CACD,CACJ,CAAC;AACJ,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 { CalculatedPropertyType } from \"@itwin/insights-client\";\nimport React, { useCallback } from \"react\";\nimport type { SelectOption } from \"@itwin/itwinui-react\";\nimport { LabeledSelect } from \"@itwin/itwinui-react\";\n\ninterface SharedCalculatedPropertyFormsProps {\n calculatedPropertyType: CalculatedPropertyType | undefined;\n setCalculatedPropertyType: (value: CalculatedPropertyType | undefined) => void;\n itemRenderer?: (option: SelectOption<string | undefined>) => JSX.Element;\n selectedItemRenderer?: (option: SelectOption<string | undefined>) => JSX.Element;\n}\n\nexport const SharedCalculatedPropertyForms = ({\n calculatedPropertyType,\n setCalculatedPropertyType,\n itemRenderer,\n selectedItemRenderer,\n}: SharedCalculatedPropertyFormsProps) => {\n const generateOptionsFromCalculatedPropertyType = useCallback(() => {\n const options: SelectOption<CalculatedPropertyType | undefined>[] = [];\n const indexableEnum = CalculatedPropertyType as unknown as { [key: string]: string };\n \n options.push({value: undefined, label: \"No Calculated Property Type\"});\n for (const key in indexableEnum) {\n if (typeof indexableEnum[key] === \"string\" && key !== \"Undefined\") {\n // Generate labels by adding space between capitals\n const label = key\n .replace(/([A-Z])/g, \" $1\")\n .trim()\n .replace(/^\\w/, (c) => c.toUpperCase());\n options.push({ value: indexableEnum[key] as CalculatedPropertyType, label });\n }\n }\n return options;\n }, []);\n\n return (\n <>\n <LabeledSelect<CalculatedPropertyType | undefined>\n label=\"Calculated Property Type\"\n options={generateOptionsFromCalculatedPropertyType()}\n value={calculatedPropertyType}\n onChange={setCalculatedPropertyType}\n itemRenderer={itemRenderer}\n selectedItemRenderer={selectedItemRenderer}\n placeholder = 'No Calculated Property Type'\n onShow={() => { }}\n onHide={() => { }}\n />\n </>\n );\n};\n"]}
@@ -1,20 +1,19 @@
1
1
  /// <reference types="react" />
2
2
  import "./CustomCalculationAction.scss";
3
- import type { Property } from "@itwin/insights-client";
4
3
  /**
5
4
  * Props for the {@link CustomCalculationAction} component.
6
- * @public
5
+ * @internal
7
6
  */
8
7
  export interface CustomCalculationActionProps {
9
- mappingId: string;
10
- groupId: string;
11
- customCalculation?: Property;
12
- onSaveSuccess: () => void;
13
- onClickCancel?: () => void;
8
+ formula?: string;
9
+ setFormula: (formula: string | undefined) => void;
10
+ formulaErrorMessage?: string;
11
+ forceValidation: () => void;
12
+ disabled?: boolean;
14
13
  }
15
14
  /**
16
15
  * Component to create or update a custom calculation property.
17
- * @public
16
+ * @internal
18
17
  */
19
- export declare const CustomCalculationAction: ({ mappingId, groupId, customCalculation, onSaveSuccess, onClickCancel }: CustomCalculationActionProps) => JSX.Element;
18
+ export declare const CustomCalculationAction: ({ formula, setFormula, formulaErrorMessage, forceValidation, disabled }: CustomCalculationActionProps) => JSX.Element;
20
19
  //# sourceMappingURL=CustomCalculationAction.d.ts.map