@itwin/grouping-mapping-widget 0.2.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.
- package/LICENSE.md +9 -0
- package/README.md +26 -0
- package/lib/cjs/api/GroupQueryBuilderApi.d.ts +15 -0
- package/lib/cjs/api/GroupQueryBuilderApi.js +27 -0
- package/lib/cjs/api/GroupQueryBuilderApi.js.map +1 -0
- package/lib/cjs/api/generated/api.d.ts +3222 -0
- package/lib/cjs/api/generated/api.js +5291 -0
- package/lib/cjs/api/generated/api.js.map +1 -0
- package/lib/cjs/api/generated/configuration.d.ts +56 -0
- package/lib/cjs/api/generated/configuration.js +30 -0
- package/lib/cjs/api/generated/configuration.js.map +1 -0
- package/lib/cjs/api/generated/index.d.ts +14 -0
- package/lib/cjs/api/generated/index.js +31 -0
- package/lib/cjs/api/generated/index.js.map +1 -0
- package/lib/cjs/api/reportingClient.d.ts +34 -0
- package/lib/cjs/api/reportingClient.js +177 -0
- package/lib/cjs/api/reportingClient.js.map +1 -0
- package/lib/cjs/decorators/BboxDimensionsDecorator.d.ts +82 -0
- package/lib/cjs/decorators/BboxDimensionsDecorator.js +418 -0
- package/lib/cjs/decorators/BboxDimensionsDecorator.js.map +1 -0
- package/lib/cjs/grouping-mapping-widget.d.ts +7 -0
- package/lib/cjs/grouping-mapping-widget.js +27 -0
- package/lib/cjs/grouping-mapping-widget.js.map +1 -0
- package/lib/cjs/widget/GroupingMappingWidget.d.ts +7 -0
- package/lib/cjs/widget/GroupingMappingWidget.js +51 -0
- package/lib/cjs/widget/GroupingMappingWidget.js.map +1 -0
- package/lib/cjs/widget/components/ActionPanel.d.ts +11 -0
- package/lib/cjs/widget/components/ActionPanel.js +37 -0
- package/lib/cjs/widget/components/ActionPanel.js.map +1 -0
- package/lib/cjs/widget/components/ActionPanel.scss +12 -0
- package/lib/cjs/widget/components/CalculatedPropertyAction.d.ts +14 -0
- package/lib/cjs/widget/components/CalculatedPropertyAction.js +160 -0
- package/lib/cjs/widget/components/CalculatedPropertyAction.js.map +1 -0
- package/lib/cjs/widget/components/CalculatedPropertyAction.scss +27 -0
- package/lib/cjs/widget/components/CalculatedPropertyTable.d.ts +18 -0
- package/lib/cjs/widget/components/CalculatedPropertyTable.js +109 -0
- package/lib/cjs/widget/components/CalculatedPropertyTable.js.map +1 -0
- package/lib/cjs/widget/components/ConfirmMappingsImport.d.ts +16 -0
- package/lib/cjs/widget/components/ConfirmMappingsImport.js +112 -0
- package/lib/cjs/widget/components/ConfirmMappingsImport.js.map +1 -0
- package/lib/cjs/widget/components/ConfirmMappingsImport.scss +84 -0
- package/lib/cjs/widget/components/CustomCalculationAction.d.ts +14 -0
- package/lib/cjs/widget/components/CustomCalculationAction.js +103 -0
- package/lib/cjs/widget/components/CustomCalculationAction.js.map +1 -0
- package/lib/cjs/widget/components/CustomCalculationAction.scss +16 -0
- package/lib/cjs/widget/components/CustomCalculationTable.d.ts +18 -0
- package/lib/cjs/widget/components/CustomCalculationTable.js +114 -0
- package/lib/cjs/widget/components/CustomCalculationTable.js.map +1 -0
- package/lib/cjs/widget/components/DeleteModal.d.ts +12 -0
- package/lib/cjs/widget/components/DeleteModal.js +64 -0
- package/lib/cjs/widget/components/DeleteModal.js.map +1 -0
- package/lib/cjs/widget/components/DeleteModal.scss +12 -0
- package/lib/cjs/widget/components/GroupAction.d.ts +12 -0
- package/lib/cjs/widget/components/GroupAction.js +166 -0
- package/lib/cjs/widget/components/GroupAction.js.map +1 -0
- package/lib/cjs/widget/components/GroupAction.scss +19 -0
- package/lib/cjs/widget/components/GroupPropertyAction.d.ts +17 -0
- package/lib/cjs/widget/components/GroupPropertyAction.js +372 -0
- package/lib/cjs/widget/components/GroupPropertyAction.js.map +1 -0
- package/lib/cjs/widget/components/GroupPropertyAction.scss +36 -0
- package/lib/cjs/widget/components/GroupPropertyTable.d.ts +18 -0
- package/lib/cjs/widget/components/GroupPropertyTable.js +109 -0
- package/lib/cjs/widget/components/GroupPropertyTable.js.map +1 -0
- package/lib/cjs/widget/components/GroupQueryBuilder.scss +24 -0
- package/lib/cjs/widget/components/GroupQueryBuilderContainer.d.ts +4 -0
- package/lib/cjs/widget/components/GroupQueryBuilderContainer.js +66 -0
- package/lib/cjs/widget/components/GroupQueryBuilderContainer.js.map +1 -0
- package/lib/cjs/widget/components/GroupQueryBuilderContext.d.ts +13 -0
- package/lib/cjs/widget/components/GroupQueryBuilderContext.js +37 -0
- package/lib/cjs/widget/components/GroupQueryBuilderContext.js.map +1 -0
- package/lib/cjs/widget/components/Grouping.d.ts +12 -0
- package/lib/cjs/widget/components/Grouping.js +214 -0
- package/lib/cjs/widget/components/Grouping.js.map +1 -0
- package/lib/cjs/widget/components/Grouping.scss +15 -0
- package/lib/cjs/widget/components/GroupingMapping.d.ts +5 -0
- package/lib/cjs/widget/components/GroupingMapping.js +34 -0
- package/lib/cjs/widget/components/GroupingMapping.js.map +1 -0
- package/lib/cjs/widget/components/GroupingMapping.scss +24 -0
- package/lib/cjs/widget/components/Mapping.d.ts +7 -0
- package/lib/cjs/widget/components/Mapping.js +162 -0
- package/lib/cjs/widget/components/Mapping.js.map +1 -0
- package/lib/cjs/widget/components/Mapping.scss +26 -0
- package/lib/cjs/widget/components/MappingAction.d.ts +11 -0
- package/lib/cjs/widget/components/MappingAction.js +98 -0
- package/lib/cjs/widget/components/MappingAction.js.map +1 -0
- package/lib/cjs/widget/components/MappingAction.scss +16 -0
- package/lib/cjs/widget/components/MappingImportWizardModal.d.ts +10 -0
- package/lib/cjs/widget/components/MappingImportWizardModal.js +102 -0
- package/lib/cjs/widget/components/MappingImportWizardModal.js.map +1 -0
- package/lib/cjs/widget/components/MappingImportWizardModal.scss +21 -0
- package/lib/cjs/widget/components/PropertyMenu.d.ts +24 -0
- package/lib/cjs/widget/components/PropertyMenu.js +141 -0
- package/lib/cjs/widget/components/PropertyMenu.js.map +1 -0
- package/lib/cjs/widget/components/PropertyMenu.scss +48 -0
- package/lib/cjs/widget/components/QueryBuilder.d.ts +39 -0
- package/lib/cjs/widget/components/QueryBuilder.js +345 -0
- package/lib/cjs/widget/components/QueryBuilder.js.map +1 -0
- package/lib/cjs/widget/components/SelectIModel.d.ts +12 -0
- package/lib/cjs/widget/components/SelectIModel.js +42 -0
- package/lib/cjs/widget/components/SelectIModel.js.map +1 -0
- package/lib/cjs/widget/components/SelectIModel.scss +20 -0
- package/lib/cjs/widget/components/SelectMapping.scss +17 -0
- package/lib/cjs/widget/components/SelectMappings.d.ts +12 -0
- package/lib/cjs/widget/components/SelectMappings.js +82 -0
- package/lib/cjs/widget/components/SelectMappings.js.map +1 -0
- package/lib/cjs/widget/components/SelectProject.d.ts +10 -0
- package/lib/cjs/widget/components/SelectProject.js +71 -0
- package/lib/cjs/widget/components/SelectProject.js.map +1 -0
- package/lib/cjs/widget/components/SelectProject.scss +38 -0
- package/lib/cjs/widget/components/property-grid/NonPrimitivePropertyRenderer.d.ts +33 -0
- package/lib/cjs/widget/components/property-grid/NonPrimitivePropertyRenderer.js +92 -0
- package/lib/cjs/widget/components/property-grid/NonPrimitivePropertyRenderer.js.map +1 -0
- package/lib/cjs/widget/components/property-grid/NonPrimitivePropertyRenderer.scss +16 -0
- package/lib/cjs/widget/components/property-grid/PrimitivePropertyRenderer.d.ts +26 -0
- package/lib/cjs/widget/components/property-grid/PrimitivePropertyRenderer.js +58 -0
- package/lib/cjs/widget/components/property-grid/PrimitivePropertyRenderer.js.map +1 -0
- package/lib/cjs/widget/components/property-grid/PropertyGrid.d.ts +67 -0
- package/lib/cjs/widget/components/property-grid/PropertyGrid.js +198 -0
- package/lib/cjs/widget/components/property-grid/PropertyGrid.js.map +1 -0
- package/lib/cjs/widget/components/property-grid/PropertyGrid.scss +71 -0
- package/lib/cjs/widget/components/property-grid/PropertyGridWrapper.d.ts +17 -0
- package/lib/cjs/widget/components/property-grid/PropertyGridWrapper.js +67 -0
- package/lib/cjs/widget/components/property-grid/PropertyGridWrapper.js.map +1 -0
- package/lib/cjs/widget/components/property-grid/PropertyList.d.ts +69 -0
- package/lib/cjs/widget/components/property-grid/PropertyList.js +87 -0
- package/lib/cjs/widget/components/property-grid/PropertyList.js.map +1 -0
- package/lib/cjs/widget/components/property-grid/PropertyRender.d.ts +92 -0
- package/lib/cjs/widget/components/property-grid/PropertyRender.js +111 -0
- package/lib/cjs/widget/components/property-grid/PropertyRender.js.map +1 -0
- package/lib/cjs/widget/components/property-grid/PropertyView.d.ts +20 -0
- package/lib/cjs/widget/components/property-grid/PropertyView.js +218 -0
- package/lib/cjs/widget/components/property-grid/PropertyView.js.map +1 -0
- package/lib/cjs/widget/components/property-grid/PropertyView.scss +111 -0
- package/lib/cjs/widget/components/utils.d.ts +14 -0
- package/lib/cjs/widget/components/utils.js +82 -0
- package/lib/cjs/widget/components/utils.js.map +1 -0
- package/lib/cjs/widget/components/utils.scss +36 -0
- package/lib/cjs/widget/components/viewerUtils.d.ts +9 -0
- package/lib/cjs/widget/components/viewerUtils.js +115 -0
- package/lib/cjs/widget/components/viewerUtils.js.map +1 -0
- package/lib/cjs/widget/hooks/useFetchAccessToken.d.ts +3 -0
- package/lib/cjs/widget/hooks/useFetchAccessToken.js +22 -0
- package/lib/cjs/widget/hooks/useFetchAccessToken.js.map +1 -0
- package/lib/cjs/widget/hooks/useValidator.d.ts +45 -0
- package/lib/cjs/widget/hooks/useValidator.js +53 -0
- package/lib/cjs/widget/hooks/useValidator.js.map +1 -0
- package/lib/cjs/widget/icons/DatabaseInfo.d.ts +5 -0
- package/lib/cjs/widget/icons/DatabaseInfo.js +19 -0
- package/lib/cjs/widget/icons/DatabaseInfo.js.map +1 -0
- package/lib/cjs/widget/icons/DatabaseInfo.scss +12 -0
- package/lib/cjs/widget/utils.d.ts +4 -0
- package/lib/cjs/widget/utils.js +3 -0
- package/lib/cjs/widget/utils.js.map +1 -0
- package/lib/esm/api/GroupQueryBuilderApi.d.ts +15 -0
- package/lib/esm/api/GroupQueryBuilderApi.js +23 -0
- package/lib/esm/api/GroupQueryBuilderApi.js.map +1 -0
- package/lib/esm/api/generated/api.d.ts +3222 -0
- package/lib/esm/api/generated/api.js +5248 -0
- package/lib/esm/api/generated/api.js.map +1 -0
- package/lib/esm/api/generated/configuration.d.ts +56 -0
- package/lib/esm/api/generated/configuration.js +26 -0
- package/lib/esm/api/generated/configuration.js.map +1 -0
- package/lib/esm/api/generated/index.d.ts +14 -0
- package/lib/esm/api/generated/index.js +19 -0
- package/lib/esm/api/generated/index.js.map +1 -0
- package/lib/esm/api/reportingClient.d.ts +34 -0
- package/lib/esm/api/reportingClient.js +173 -0
- package/lib/esm/api/reportingClient.js.map +1 -0
- package/lib/esm/decorators/BboxDimensionsDecorator.d.ts +82 -0
- package/lib/esm/decorators/BboxDimensionsDecorator.js +414 -0
- package/lib/esm/decorators/BboxDimensionsDecorator.js.map +1 -0
- package/lib/esm/grouping-mapping-widget.d.ts +7 -0
- package/lib/esm/grouping-mapping-widget.js +11 -0
- package/lib/esm/grouping-mapping-widget.js.map +1 -0
- package/lib/esm/widget/GroupingMappingWidget.d.ts +7 -0
- package/lib/esm/widget/GroupingMappingWidget.js +25 -0
- package/lib/esm/widget/GroupingMappingWidget.js.map +1 -0
- package/lib/esm/widget/components/ActionPanel.d.ts +11 -0
- package/lib/esm/widget/components/ActionPanel.js +16 -0
- package/lib/esm/widget/components/ActionPanel.js.map +1 -0
- package/lib/esm/widget/components/ActionPanel.scss +12 -0
- package/lib/esm/widget/components/CalculatedPropertyAction.d.ts +14 -0
- package/lib/esm/widget/components/CalculatedPropertyAction.js +136 -0
- package/lib/esm/widget/components/CalculatedPropertyAction.js.map +1 -0
- package/lib/esm/widget/components/CalculatedPropertyAction.scss +27 -0
- package/lib/esm/widget/components/CalculatedPropertyTable.d.ts +18 -0
- package/lib/esm/widget/components/CalculatedPropertyTable.js +85 -0
- package/lib/esm/widget/components/CalculatedPropertyTable.js.map +1 -0
- package/lib/esm/widget/components/ConfirmMappingsImport.d.ts +16 -0
- package/lib/esm/widget/components/ConfirmMappingsImport.js +91 -0
- package/lib/esm/widget/components/ConfirmMappingsImport.js.map +1 -0
- package/lib/esm/widget/components/ConfirmMappingsImport.scss +84 -0
- package/lib/esm/widget/components/CustomCalculationAction.d.ts +14 -0
- package/lib/esm/widget/components/CustomCalculationAction.js +79 -0
- package/lib/esm/widget/components/CustomCalculationAction.js.map +1 -0
- package/lib/esm/widget/components/CustomCalculationAction.scss +16 -0
- package/lib/esm/widget/components/CustomCalculationTable.d.ts +18 -0
- package/lib/esm/widget/components/CustomCalculationTable.js +90 -0
- package/lib/esm/widget/components/CustomCalculationTable.js.map +1 -0
- package/lib/esm/widget/components/DeleteModal.d.ts +12 -0
- package/lib/esm/widget/components/DeleteModal.js +41 -0
- package/lib/esm/widget/components/DeleteModal.js.map +1 -0
- package/lib/esm/widget/components/DeleteModal.scss +12 -0
- package/lib/esm/widget/components/GroupAction.d.ts +12 -0
- package/lib/esm/widget/components/GroupAction.js +142 -0
- package/lib/esm/widget/components/GroupAction.js.map +1 -0
- package/lib/esm/widget/components/GroupAction.scss +19 -0
- package/lib/esm/widget/components/GroupPropertyAction.d.ts +17 -0
- package/lib/esm/widget/components/GroupPropertyAction.js +347 -0
- package/lib/esm/widget/components/GroupPropertyAction.js.map +1 -0
- package/lib/esm/widget/components/GroupPropertyAction.scss +36 -0
- package/lib/esm/widget/components/GroupPropertyTable.d.ts +18 -0
- package/lib/esm/widget/components/GroupPropertyTable.js +85 -0
- package/lib/esm/widget/components/GroupPropertyTable.js.map +1 -0
- package/lib/esm/widget/components/GroupQueryBuilder.scss +24 -0
- package/lib/esm/widget/components/GroupQueryBuilderContainer.d.ts +4 -0
- package/lib/esm/widget/components/GroupQueryBuilderContainer.js +43 -0
- package/lib/esm/widget/components/GroupQueryBuilderContainer.js.map +1 -0
- package/lib/esm/widget/components/GroupQueryBuilderContext.d.ts +13 -0
- package/lib/esm/widget/components/GroupQueryBuilderContext.js +15 -0
- package/lib/esm/widget/components/GroupQueryBuilderContext.js.map +1 -0
- package/lib/esm/widget/components/Grouping.d.ts +12 -0
- package/lib/esm/widget/components/Grouping.js +188 -0
- package/lib/esm/widget/components/Grouping.js.map +1 -0
- package/lib/esm/widget/components/Grouping.scss +15 -0
- package/lib/esm/widget/components/GroupingMapping.d.ts +5 -0
- package/lib/esm/widget/components/GroupingMapping.js +13 -0
- package/lib/esm/widget/components/GroupingMapping.js.map +1 -0
- package/lib/esm/widget/components/GroupingMapping.scss +24 -0
- package/lib/esm/widget/components/Mapping.d.ts +7 -0
- package/lib/esm/widget/components/Mapping.js +136 -0
- package/lib/esm/widget/components/Mapping.js.map +1 -0
- package/lib/esm/widget/components/Mapping.scss +26 -0
- package/lib/esm/widget/components/MappingAction.d.ts +11 -0
- package/lib/esm/widget/components/MappingAction.js +74 -0
- package/lib/esm/widget/components/MappingAction.js.map +1 -0
- package/lib/esm/widget/components/MappingAction.scss +16 -0
- package/lib/esm/widget/components/MappingImportWizardModal.d.ts +10 -0
- package/lib/esm/widget/components/MappingImportWizardModal.js +76 -0
- package/lib/esm/widget/components/MappingImportWizardModal.js.map +1 -0
- package/lib/esm/widget/components/MappingImportWizardModal.scss +21 -0
- package/lib/esm/widget/components/PropertyMenu.d.ts +24 -0
- package/lib/esm/widget/components/PropertyMenu.js +115 -0
- package/lib/esm/widget/components/PropertyMenu.js.map +1 -0
- package/lib/esm/widget/components/PropertyMenu.scss +48 -0
- package/lib/esm/widget/components/QueryBuilder.d.ts +39 -0
- package/lib/esm/widget/components/QueryBuilder.js +341 -0
- package/lib/esm/widget/components/QueryBuilder.js.map +1 -0
- package/lib/esm/widget/components/SelectIModel.d.ts +12 -0
- package/lib/esm/widget/components/SelectIModel.js +18 -0
- package/lib/esm/widget/components/SelectIModel.js.map +1 -0
- package/lib/esm/widget/components/SelectIModel.scss +20 -0
- package/lib/esm/widget/components/SelectMapping.scss +17 -0
- package/lib/esm/widget/components/SelectMappings.d.ts +12 -0
- package/lib/esm/widget/components/SelectMappings.js +61 -0
- package/lib/esm/widget/components/SelectMappings.js.map +1 -0
- package/lib/esm/widget/components/SelectProject.d.ts +10 -0
- package/lib/esm/widget/components/SelectProject.js +47 -0
- package/lib/esm/widget/components/SelectProject.js.map +1 -0
- package/lib/esm/widget/components/SelectProject.scss +38 -0
- package/lib/esm/widget/components/property-grid/NonPrimitivePropertyRenderer.d.ts +33 -0
- package/lib/esm/widget/components/property-grid/NonPrimitivePropertyRenderer.js +69 -0
- package/lib/esm/widget/components/property-grid/NonPrimitivePropertyRenderer.js.map +1 -0
- package/lib/esm/widget/components/property-grid/NonPrimitivePropertyRenderer.scss +16 -0
- package/lib/esm/widget/components/property-grid/PrimitivePropertyRenderer.d.ts +26 -0
- package/lib/esm/widget/components/property-grid/PrimitivePropertyRenderer.js +35 -0
- package/lib/esm/widget/components/property-grid/PrimitivePropertyRenderer.js.map +1 -0
- package/lib/esm/widget/components/property-grid/PropertyGrid.d.ts +67 -0
- package/lib/esm/widget/components/property-grid/PropertyGrid.js +172 -0
- package/lib/esm/widget/components/property-grid/PropertyGrid.js.map +1 -0
- package/lib/esm/widget/components/property-grid/PropertyGrid.scss +71 -0
- package/lib/esm/widget/components/property-grid/PropertyGridWrapper.d.ts +17 -0
- package/lib/esm/widget/components/property-grid/PropertyGridWrapper.js +44 -0
- package/lib/esm/widget/components/property-grid/PropertyGridWrapper.js.map +1 -0
- package/lib/esm/widget/components/property-grid/PropertyList.d.ts +69 -0
- package/lib/esm/widget/components/property-grid/PropertyList.js +60 -0
- package/lib/esm/widget/components/property-grid/PropertyList.js.map +1 -0
- package/lib/esm/widget/components/property-grid/PropertyRender.d.ts +92 -0
- package/lib/esm/widget/components/property-grid/PropertyRender.js +88 -0
- package/lib/esm/widget/components/property-grid/PropertyRender.js.map +1 -0
- package/lib/esm/widget/components/property-grid/PropertyView.d.ts +20 -0
- package/lib/esm/widget/components/property-grid/PropertyView.js +195 -0
- package/lib/esm/widget/components/property-grid/PropertyView.js.map +1 -0
- package/lib/esm/widget/components/property-grid/PropertyView.scss +111 -0
- package/lib/esm/widget/components/utils.d.ts +14 -0
- package/lib/esm/widget/components/utils.js +72 -0
- package/lib/esm/widget/components/utils.js.map +1 -0
- package/lib/esm/widget/components/utils.scss +36 -0
- package/lib/esm/widget/components/viewerUtils.d.ts +9 -0
- package/lib/esm/widget/components/viewerUtils.js +106 -0
- package/lib/esm/widget/components/viewerUtils.js.map +1 -0
- package/lib/esm/widget/hooks/useFetchAccessToken.d.ts +3 -0
- package/lib/esm/widget/hooks/useFetchAccessToken.js +20 -0
- package/lib/esm/widget/hooks/useFetchAccessToken.js.map +1 -0
- package/lib/esm/widget/hooks/useValidator.d.ts +45 -0
- package/lib/esm/widget/hooks/useValidator.js +47 -0
- package/lib/esm/widget/hooks/useValidator.js.map +1 -0
- package/lib/esm/widget/icons/DatabaseInfo.d.ts +5 -0
- package/lib/esm/widget/icons/DatabaseInfo.js +14 -0
- package/lib/esm/widget/icons/DatabaseInfo.js.map +1 -0
- package/lib/esm/widget/icons/DatabaseInfo.scss +12 -0
- package/lib/esm/widget/utils.d.ts +4 -0
- package/lib/esm/widget/utils.js +2 -0
- package/lib/esm/widget/utils.js.map +1 -0
- package/package.json +116 -0
|
@@ -0,0 +1,43 @@
|
|
|
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 React, { useEffect } from "react";
|
|
6
|
+
import { useActiveIModelConnection } from "@itwin/appui-react";
|
|
7
|
+
import { KeySet } from "@itwin/presentation-common";
|
|
8
|
+
import { GroupQueryBuilderApi } from "../../api/GroupQueryBuilderApi";
|
|
9
|
+
import { PropertyGridWrapperApp } from "./property-grid/PropertyGridWrapper";
|
|
10
|
+
import { GroupQueryBuilderContext } from "./GroupQueryBuilderContext";
|
|
11
|
+
import { Button } from "@itwin/itwinui-react";
|
|
12
|
+
import "./GroupQueryBuilder.scss";
|
|
13
|
+
export const GroupQueryBuilderContainer = () => {
|
|
14
|
+
const iModelConnection = useActiveIModelConnection();
|
|
15
|
+
const context = React.useContext(GroupQueryBuilderContext);
|
|
16
|
+
const [keysState, setKeysState] = React.useState(new KeySet());
|
|
17
|
+
const [selected, SetSelected] = React.useState(false);
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
const _onSelectionChanged = async (evt, selectionProvider) => {
|
|
20
|
+
SetSelected(true);
|
|
21
|
+
context.setCurrentPropertyList([]);
|
|
22
|
+
const selection = selectionProvider.getSelection(evt.imodel, evt.level);
|
|
23
|
+
const keys = new KeySet(selection);
|
|
24
|
+
setKeysState(keys);
|
|
25
|
+
};
|
|
26
|
+
if (iModelConnection) {
|
|
27
|
+
GroupQueryBuilderApi.addSelectionListener(_onSelectionChanged);
|
|
28
|
+
}
|
|
29
|
+
return () => {
|
|
30
|
+
GroupQueryBuilderApi.removeSelectionListener();
|
|
31
|
+
};
|
|
32
|
+
}, [iModelConnection, context]);
|
|
33
|
+
const _onClickResetButton = async () => {
|
|
34
|
+
context.setQuery("");
|
|
35
|
+
context.queryBuilder.query = undefined;
|
|
36
|
+
context.setCurrentPropertyList([]);
|
|
37
|
+
};
|
|
38
|
+
return (React.createElement("div", { className: 'find-similar-container' },
|
|
39
|
+
React.createElement(PropertyGridWrapperApp, { keys: keysState, imodel: iModelConnection }),
|
|
40
|
+
selected && (React.createElement("div", { className: 'button-container' },
|
|
41
|
+
React.createElement(Button, { styleType: 'default', size: 'small', className: 'reset-button', onClick: _onClickResetButton }, "Reset")))));
|
|
42
|
+
};
|
|
43
|
+
//# sourceMappingURL=GroupQueryBuilderContainer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GroupQueryBuilderContainer.js","sourceRoot":"","sources":["../../../../src/widget/components/GroupQueryBuilderContainer.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,C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;YACV,oBAAoB,CAAC,uBAAuB,EAAE,CAAC;QACjD,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC,CAAC;IAEhC,MAAM,mBAAmB,GAAG,KAAK,IAAI,EAAE;QACrC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QACrB,OAAO,CAAC,YAAY,CAAC,KAAK,GAAG,SAAS,CAAC;QACvC,OAAO,CAAC,sBAAsB,CAAC,EAAE,CAAC,CAAC;IACrC,CAAC,CAAC;IAEF,OAAO,CACL,6BAAK,SAAS,EAAC,wBAAwB;QACrC,oBAAC,sBAAsB,IAAC,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,gBAAgB,GAAI;QACpE,QAAQ,IAAI,CACX,6BAAK,SAAS,EAAC,kBAAkB;YAC/B,oBAAC,MAAM,IACL,SAAS,EAAC,SAAS,EACnB,IAAI,EAAC,OAAO,EACZ,SAAS,EAAC,cAAc,EACxB,OAAO,EAAE,mBAAmB,YAGrB,CACL,CACP,CACG,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 React, { useEffect } from \"react\";\nimport { useActiveIModelConnection } from \"@itwin/appui-react\";\nimport type {\n ISelectionProvider,\n SelectionChangeEventArgs,\n} from \"@itwin/presentation-frontend\";\nimport { KeySet } from \"@itwin/presentation-common\";\nimport { GroupQueryBuilderApi } from \"../../api/GroupQueryBuilderApi\";\nimport { PropertyGridWrapperApp } from \"./property-grid/PropertyGridWrapper\";\nimport { GroupQueryBuilderContext } from \"./GroupQueryBuilderContext\";\nimport { Button } from \"@itwin/itwinui-react\";\nimport \"./GroupQueryBuilder.scss\";\n\nexport const GroupQueryBuilderContainer: React.FunctionComponent = () => {\n const iModelConnection = useActiveIModelConnection();\n const context = React.useContext(GroupQueryBuilderContext);\n\n const [keysState, setKeysState] = React.useState<KeySet>(new KeySet());\n const [selected, SetSelected] = React.useState<boolean>(false);\n\n useEffect(() => {\n const _onSelectionChanged = async (\n evt: SelectionChangeEventArgs,\n selectionProvider: ISelectionProvider,\n ) => {\n SetSelected(true);\n context.setCurrentPropertyList([]);\n\n const selection = selectionProvider.getSelection(evt.imodel, evt.level);\n const keys = new KeySet(selection);\n setKeysState(keys);\n };\n\n if (iModelConnection) {\n GroupQueryBuilderApi.addSelectionListener(_onSelectionChanged);\n }\n return () => {\n GroupQueryBuilderApi.removeSelectionListener();\n };\n }, [iModelConnection, context]);\n\n const _onClickResetButton = async () => {\n context.setQuery(\"\");\n context.queryBuilder.query = undefined;\n context.setCurrentPropertyList([]);\n };\n\n return (\n <div className='find-similar-container'>\n <PropertyGridWrapperApp keys={keysState} imodel={iModelConnection} />\n {selected && (\n <div className='button-container'>\n <Button\n styleType='default'\n size='small'\n className='reset-button'\n onClick={_onClickResetButton}\n >\n Reset\n </Button>\n </div>\n )}\n </div>\n );\n};\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { PropertyRecord } from "@itwin/appui-abstract";
|
|
3
|
+
import { QueryBuilder } from "./QueryBuilder";
|
|
4
|
+
export interface PropertySelection {
|
|
5
|
+
currentPropertyList: PropertyRecord[];
|
|
6
|
+
setCurrentPropertyList: React.Dispatch<React.SetStateAction<PropertyRecord[]>>;
|
|
7
|
+
query: string;
|
|
8
|
+
setQuery: React.Dispatch<React.SetStateAction<string>>;
|
|
9
|
+
queryBuilder: QueryBuilder;
|
|
10
|
+
setQueryBuilder: React.Dispatch<React.SetStateAction<QueryBuilder>>;
|
|
11
|
+
}
|
|
12
|
+
export declare const GroupQueryBuilderContext: React.Context<PropertySelection>;
|
|
13
|
+
//# sourceMappingURL=GroupQueryBuilderContext.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
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 * as React from "react";
|
|
6
|
+
import { QueryBuilder } from "./QueryBuilder";
|
|
7
|
+
export const GroupQueryBuilderContext = React.createContext({
|
|
8
|
+
currentPropertyList: [],
|
|
9
|
+
setCurrentPropertyList: () => [],
|
|
10
|
+
query: "",
|
|
11
|
+
setQuery: () => "",
|
|
12
|
+
queryBuilder: new QueryBuilder(undefined),
|
|
13
|
+
setQueryBuilder: () => new QueryBuilder(undefined),
|
|
14
|
+
});
|
|
15
|
+
//# sourceMappingURL=GroupQueryBuilderContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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;AAY9C,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;CACnD,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}\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});\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { GroupReportingAPI, MappingReportingAPI } from "../../api/generated/api";
|
|
3
|
+
import type { CreateTypeFromInterface } from "../utils";
|
|
4
|
+
import "./Grouping.scss";
|
|
5
|
+
export declare type Group = CreateTypeFromInterface<GroupReportingAPI>;
|
|
6
|
+
interface GroupsTreeProps {
|
|
7
|
+
mapping: MappingReportingAPI;
|
|
8
|
+
goBack: () => Promise<void>;
|
|
9
|
+
}
|
|
10
|
+
export declare const Groupings: ({ mapping, goBack }: GroupsTreeProps) => JSX.Element | null;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=Grouping.d.ts.map
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { useActiveIModelConnection } from "@itwin/appui-react";
|
|
2
|
+
import React, { useCallback, useEffect, useMemo, useRef, useState, } from "react";
|
|
3
|
+
import { reportingClientApi } from "../../api/reportingClient";
|
|
4
|
+
import { Button, DropdownMenu, IconButton, MenuItem, ProgressRadial, Table, } from "@itwin/itwinui-react";
|
|
5
|
+
import { SvgAdd, SvgDelete, SvgEdit, SvgList, SvgMore, } from "@itwin/itwinui-icons-react";
|
|
6
|
+
import DeleteModal from "./DeleteModal";
|
|
7
|
+
import "./Grouping.scss";
|
|
8
|
+
import { PropertyMenu } from "./PropertyMenu";
|
|
9
|
+
import { clearEmphasizedElements, visualizeElements, visualizeElementsById, zoomToElements, } from "./viewerUtils";
|
|
10
|
+
import { fetchIdsFromQuery, WidgetHeader } from "./utils";
|
|
11
|
+
import GroupAction from "./GroupAction";
|
|
12
|
+
var GroupsView;
|
|
13
|
+
(function (GroupsView) {
|
|
14
|
+
GroupsView["GROUPS"] = "groups";
|
|
15
|
+
GroupsView["MODIFYING"] = "modifying";
|
|
16
|
+
GroupsView["ADD"] = "ADD";
|
|
17
|
+
GroupsView["PROPERTIES"] = "properties";
|
|
18
|
+
})(GroupsView || (GroupsView = {}));
|
|
19
|
+
const fetchGroups = async (setGroups, iModelId, mappingId, setIsLoading) => {
|
|
20
|
+
var _a;
|
|
21
|
+
try {
|
|
22
|
+
setIsLoading(true);
|
|
23
|
+
const groups = await reportingClientApi.getGroups(iModelId, mappingId);
|
|
24
|
+
setGroups((_a = groups.groups) !== null && _a !== void 0 ? _a : []);
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
}
|
|
28
|
+
finally {
|
|
29
|
+
setIsLoading(false);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
const useFetchGroups = (iModelId, mappingId, setIsLoading) => {
|
|
33
|
+
const [groups, setGroups] = useState([]);
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
void fetchGroups(setGroups, iModelId, mappingId, setIsLoading);
|
|
36
|
+
}, [iModelId, mappingId, setIsLoading]);
|
|
37
|
+
return [groups, setGroups];
|
|
38
|
+
};
|
|
39
|
+
export const Groupings = ({ mapping, goBack }) => {
|
|
40
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
41
|
+
const iModelConnection = useActiveIModelConnection();
|
|
42
|
+
const iModelId = (_a = useActiveIModelConnection()) === null || _a === void 0 ? void 0 : _a.iModelId;
|
|
43
|
+
const [showDeleteModal, setShowDeleteModal] = useState(false);
|
|
44
|
+
const [isLoading, setIsLoading] = useState(true);
|
|
45
|
+
const [groupsView, setGroupsView] = useState(GroupsView.GROUPS);
|
|
46
|
+
const [selectedGroup, setSelectedGroup] = useState(undefined);
|
|
47
|
+
const [groups, setGroups] = useFetchGroups(iModelId, (_b = mapping.id) !== null && _b !== void 0 ? _b : "", setIsLoading);
|
|
48
|
+
const hilitedElements = useRef(new Map());
|
|
49
|
+
const [isLoadingQuery, setLoadingQuery] = useState(false);
|
|
50
|
+
const refresh = useCallback(async () => {
|
|
51
|
+
var _a;
|
|
52
|
+
setGroupsView(GroupsView.GROUPS);
|
|
53
|
+
setSelectedGroup(undefined);
|
|
54
|
+
setGroups([]);
|
|
55
|
+
await fetchGroups(setGroups, iModelId, (_a = mapping.id) !== null && _a !== void 0 ? _a : "", setIsLoading);
|
|
56
|
+
}, [iModelId, mapping.id, setGroups]);
|
|
57
|
+
const addGroup = () => {
|
|
58
|
+
// TODO Retain selection in view without emphasizes. Goal is to make it so we can distinguish
|
|
59
|
+
// hilited elements from regular elements without emphasis due to it blocking selection. For now clearing
|
|
60
|
+
// selection.
|
|
61
|
+
clearEmphasizedElements();
|
|
62
|
+
setGroupsView(GroupsView.ADD);
|
|
63
|
+
};
|
|
64
|
+
const onModify = useCallback((value) => {
|
|
65
|
+
clearEmphasizedElements();
|
|
66
|
+
setSelectedGroup(value.row.original);
|
|
67
|
+
setGroupsView(GroupsView.MODIFYING);
|
|
68
|
+
}, []);
|
|
69
|
+
const openProperties = useCallback((value) => {
|
|
70
|
+
clearEmphasizedElements();
|
|
71
|
+
setSelectedGroup(value.row.original);
|
|
72
|
+
setGroupsView(GroupsView.PROPERTIES);
|
|
73
|
+
}, []);
|
|
74
|
+
const groupsColumns = useMemo(() => [
|
|
75
|
+
{
|
|
76
|
+
Header: "Table",
|
|
77
|
+
columns: [
|
|
78
|
+
{
|
|
79
|
+
id: "groupName",
|
|
80
|
+
Header: "Group",
|
|
81
|
+
accessor: "groupName",
|
|
82
|
+
Cell: (value) => (React.createElement(React.Fragment, null, isLoadingQuery ? (value.row.original.groupName) : (React.createElement("div", { className: 'iui-anchor', onClick: (e) => {
|
|
83
|
+
e.stopPropagation();
|
|
84
|
+
openProperties(value);
|
|
85
|
+
} }, value.row.original.groupName)))),
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
id: "description",
|
|
89
|
+
Header: "Description",
|
|
90
|
+
accessor: "description",
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
id: "dropdown",
|
|
94
|
+
Header: "",
|
|
95
|
+
width: 80,
|
|
96
|
+
Cell: (value) => {
|
|
97
|
+
return (React.createElement("div", { onClick: (e) => e.stopPropagation() },
|
|
98
|
+
React.createElement(DropdownMenu, { disabled: isLoadingQuery, menuItems: (close) => [
|
|
99
|
+
React.createElement(MenuItem, { key: 0, onClick: () => onModify(value), icon: React.createElement(SvgEdit, null) }, "Modify"),
|
|
100
|
+
React.createElement(MenuItem, { key: 1, onClick: () => openProperties(value), icon: React.createElement(SvgList, null) }, "Properties"),
|
|
101
|
+
React.createElement(MenuItem, { key: 2, onClick: () => {
|
|
102
|
+
setSelectedGroup(value.row.original);
|
|
103
|
+
setShowDeleteModal(true);
|
|
104
|
+
close();
|
|
105
|
+
}, icon: React.createElement(SvgDelete, null) }, "Remove"),
|
|
106
|
+
] },
|
|
107
|
+
React.createElement(IconButton, { disabled: isLoadingQuery, styleType: 'borderless' },
|
|
108
|
+
React.createElement(SvgMore, { style: {
|
|
109
|
+
width: "16px",
|
|
110
|
+
height: "16px",
|
|
111
|
+
} })))));
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
],
|
|
115
|
+
},
|
|
116
|
+
], [isLoadingQuery, onModify, openProperties]);
|
|
117
|
+
// Temp
|
|
118
|
+
const stringToColor = function (str) {
|
|
119
|
+
let hash = 0;
|
|
120
|
+
for (let i = 0; i < str.length; i++) {
|
|
121
|
+
hash = str.charCodeAt(i) + ((hash << 5) - hash);
|
|
122
|
+
}
|
|
123
|
+
let colour = "#";
|
|
124
|
+
for (let i = 0; i < 3; i++) {
|
|
125
|
+
const value = (hash >> (i * 8)) & 0xff;
|
|
126
|
+
colour += (`00${value.toString(16)}`).substr(-2);
|
|
127
|
+
}
|
|
128
|
+
return colour;
|
|
129
|
+
};
|
|
130
|
+
const onSelect = useCallback(async (selectedData) => {
|
|
131
|
+
var _a, _b, _c, _d, _e, _f;
|
|
132
|
+
clearEmphasizedElements();
|
|
133
|
+
if (selectedData && selectedData.length > 0) {
|
|
134
|
+
setLoadingQuery(true);
|
|
135
|
+
let allIds = [];
|
|
136
|
+
for (const row of selectedData) {
|
|
137
|
+
const query = (_a = row.query) !== null && _a !== void 0 ? _a : "";
|
|
138
|
+
if (hilitedElements.current.has(query)) {
|
|
139
|
+
const hilitedIds = (_b = hilitedElements.current.get(query)) !== null && _b !== void 0 ? _b : [];
|
|
140
|
+
visualizeElements(hilitedIds, stringToColor((_c = row.id) !== null && _c !== void 0 ? _c : ""));
|
|
141
|
+
allIds = allIds.concat(hilitedIds);
|
|
142
|
+
}
|
|
143
|
+
else {
|
|
144
|
+
const ids = await fetchIdsFromQuery((_d = row.query) !== null && _d !== void 0 ? _d : "", iModelConnection);
|
|
145
|
+
const hiliteIds = await visualizeElementsById(ids, stringToColor((_e = row.id) !== null && _e !== void 0 ? _e : ""), iModelConnection);
|
|
146
|
+
hilitedElements.current.set((_f = row.query) !== null && _f !== void 0 ? _f : "", hiliteIds);
|
|
147
|
+
allIds = allIds.concat(ids);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
await zoomToElements(allIds);
|
|
151
|
+
setLoadingQuery(false);
|
|
152
|
+
}
|
|
153
|
+
}, [iModelConnection]);
|
|
154
|
+
switch (groupsView) {
|
|
155
|
+
case GroupsView.ADD:
|
|
156
|
+
return (React.createElement(GroupAction, { iModelId: iModelId, mappingId: (_c = mapping.id) !== null && _c !== void 0 ? _c : "", goBack: async () => {
|
|
157
|
+
clearEmphasizedElements();
|
|
158
|
+
setGroupsView(GroupsView.GROUPS);
|
|
159
|
+
await refresh();
|
|
160
|
+
} }));
|
|
161
|
+
case GroupsView.MODIFYING:
|
|
162
|
+
return selectedGroup ? (React.createElement(GroupAction, { iModelId: iModelId, mappingId: (_d = mapping.id) !== null && _d !== void 0 ? _d : "", group: selectedGroup, goBack: async () => {
|
|
163
|
+
clearEmphasizedElements();
|
|
164
|
+
setGroupsView(GroupsView.GROUPS);
|
|
165
|
+
await refresh();
|
|
166
|
+
} })) : null;
|
|
167
|
+
case GroupsView.PROPERTIES:
|
|
168
|
+
return selectedGroup ? (React.createElement(PropertyMenu, { iModelId: iModelId, mappingId: (_e = mapping.id) !== null && _e !== void 0 ? _e : "", group: selectedGroup, goBack: async () => {
|
|
169
|
+
clearEmphasizedElements();
|
|
170
|
+
setGroupsView(GroupsView.GROUPS);
|
|
171
|
+
await refresh();
|
|
172
|
+
} })) : null;
|
|
173
|
+
default:
|
|
174
|
+
return (React.createElement(React.Fragment, null,
|
|
175
|
+
React.createElement(WidgetHeader, { title: (_f = mapping.mappingName) !== null && _f !== void 0 ? _f : "", disabled: isLoading || isLoadingQuery, returnFn: async () => {
|
|
176
|
+
clearEmphasizedElements();
|
|
177
|
+
await goBack();
|
|
178
|
+
} }),
|
|
179
|
+
React.createElement("div", { className: 'groups-container' },
|
|
180
|
+
React.createElement(Button, { startIcon: isLoadingQuery ? React.createElement(ProgressRadial, { size: "small", indeterminate: true }) : React.createElement(SvgAdd, null), styleType: 'high-visibility', disabled: isLoadingQuery, onClick: () => addGroup() }, isLoadingQuery ? "Loading Group(s)" : "Add Group"),
|
|
181
|
+
React.createElement(Table, { data: groups, density: 'extra-condensed', columns: groupsColumns, emptyTableContent: 'No Groups available.', isSortable: true, isSelectable: true, onSelect: onSelect, isLoading: isLoading, isRowDisabled: () => isLoadingQuery })),
|
|
182
|
+
React.createElement(DeleteModal, { entityName: (_g = selectedGroup === null || selectedGroup === void 0 ? void 0 : selectedGroup.groupName) !== null && _g !== void 0 ? _g : "", show: showDeleteModal, setShow: setShowDeleteModal, onDelete: async () => {
|
|
183
|
+
var _a, _b;
|
|
184
|
+
await reportingClientApi.deleteGroup(iModelId, (_a = mapping.id) !== null && _a !== void 0 ? _a : "", (_b = selectedGroup === null || selectedGroup === void 0 ? void 0 : selectedGroup.id) !== null && _b !== void 0 ? _b : "");
|
|
185
|
+
}, refresh: refresh })));
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
//# sourceMappingURL=Grouping.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Grouping.js","sourceRoot":"","sources":["../../../../src/widget/components/Grouping.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,KAAK,EAAE,EACZ,WAAW,EACX,SAAS,EACT,OAAO,EACP,MAAM,EACN,QAAQ,GACT,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAE/D,OAAO,EACL,MAAM,EACN,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,cAAc,EACd,KAAK,GACN,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,MAAM,EACN,SAAS,EACT,OAAO,EACP,OAAO,EACP,OAAO,GACR,MAAM,4BAA4B,CAAC;AACpC,OAAO,WAAW,MAAM,eAAe,CAAC;AACxC,OAAO,iBAAiB,CAAC;AAEzB,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EACL,uBAAuB,EACvB,iBAAiB,EACjB,qBAAqB,EACrB,cAAc,GACf,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC1D,OAAO,WAAW,MAAM,eAAe,CAAC;AAIxC,IAAK,UAKJ;AALD,WAAK,UAAU;IACb,+BAAiB,CAAA;IACjB,qCAAuB,CAAA;IACvB,yBAAW,CAAA;IACX,uCAAyB,CAAA;AAC3B,CAAC,EALI,UAAU,KAAV,UAAU,QAKd;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AE,mCAAI,EAAE,EAChB,MAAA,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,EAAE,mCAAI,EAAE,CACxB,CAAC;oBACJ,CAAC,EACD,OAAO,EAAE,OAAO,GAChB,CACD,CACJ,CAAC;KACL;AACH,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 { CellProps } from \"react-table\";\nimport { useActiveIModelConnection } from \"@itwin/appui-react\";\nimport React, {\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport type { GroupReportingAPI, MappingReportingAPI } from \"../../api/generated/api\";\nimport { reportingClientApi } from \"../../api/reportingClient\";\nimport type { CreateTypeFromInterface } from \"../utils\";\nimport {\n Button,\n DropdownMenu,\n IconButton,\n MenuItem,\n ProgressRadial,\n Table,\n} from \"@itwin/itwinui-react\";\nimport {\n SvgAdd,\n SvgDelete,\n SvgEdit,\n SvgList,\n SvgMore,\n} from \"@itwin/itwinui-icons-react\";\nimport DeleteModal from \"./DeleteModal\";\nimport \"./Grouping.scss\";\nimport type { IModelConnection } from \"@itwin/core-frontend\";\nimport { PropertyMenu } from \"./PropertyMenu\";\nimport {\n clearEmphasizedElements,\n visualizeElements,\n visualizeElementsById,\n zoomToElements,\n} from \"./viewerUtils\";\nimport { fetchIdsFromQuery, WidgetHeader } from \"./utils\";\nimport GroupAction from \"./GroupAction\";\n\nexport type Group = CreateTypeFromInterface<GroupReportingAPI>;\n\nenum GroupsView {\n GROUPS = \"groups\",\n MODIFYING = \"modifying\",\n ADD = \"ADD\",\n PROPERTIES = \"properties\",\n}\n\ninterface GroupsTreeProps {\n mapping: MappingReportingAPI;\n goBack: () => Promise<void>;\n}\n\nconst fetchGroups = async (\n setGroups: React.Dispatch<React.SetStateAction<Group[]>>,\n iModelId: string,\n mappingId: string,\n setIsLoading: React.Dispatch<React.SetStateAction<boolean>>,\n) => {\n try {\n setIsLoading(true);\n const groups = await reportingClientApi.getGroups(iModelId, mappingId);\n setGroups(groups.groups ?? []);\n } catch {\n } finally {\n setIsLoading(false);\n }\n};\n\nconst useFetchGroups = (\n iModelId: string,\n mappingId: string,\n setIsLoading: React.Dispatch<React.SetStateAction<boolean>>,\n): [Group[], React.Dispatch<React.SetStateAction<Group[]>>] => {\n const [groups, setGroups] = useState<GroupReportingAPI[]>([]);\n\n useEffect(() => {\n void fetchGroups(setGroups, iModelId, mappingId, setIsLoading);\n }, [iModelId, mappingId, setIsLoading]);\n\n return [groups, setGroups];\n};\n\nexport const Groupings = ({ mapping, goBack }: GroupsTreeProps) => {\n const iModelConnection = useActiveIModelConnection() as IModelConnection;\n const iModelId = useActiveIModelConnection()?.iModelId as string;\n const [showDeleteModal, setShowDeleteModal] = useState<boolean>(false);\n const [isLoading, setIsLoading] = useState<boolean>(true);\n const [groupsView, setGroupsView] = useState<GroupsView>(GroupsView.GROUPS);\n const [selectedGroup, setSelectedGroup] = useState<Group | undefined>(\n undefined,\n );\n const [groups, setGroups] = useFetchGroups(\n iModelId,\n mapping.id ?? \"\",\n setIsLoading,\n );\n const hilitedElements = useRef<Map<string, string[]>>(new Map());\n const [isLoadingQuery, setLoadingQuery] = useState<boolean>(false);\n\n const refresh = useCallback(async () => {\n setGroupsView(GroupsView.GROUPS);\n setSelectedGroup(undefined);\n setGroups([]);\n await fetchGroups(setGroups, iModelId, mapping.id ?? \"\", setIsLoading);\n }, [iModelId, mapping.id, setGroups]);\n\n const addGroup = () => {\n // TODO Retain selection in view without emphasizes. Goal is to make it so we can distinguish\n // hilited elements from regular elements without emphasis due to it blocking selection. For now clearing\n // selection.\n clearEmphasizedElements();\n setGroupsView(GroupsView.ADD);\n };\n\n const onModify = useCallback((value) => {\n clearEmphasizedElements();\n setSelectedGroup(value.row.original);\n setGroupsView(GroupsView.MODIFYING);\n }, []);\n\n const openProperties = useCallback((value) => {\n clearEmphasizedElements();\n setSelectedGroup(value.row.original);\n setGroupsView(GroupsView.PROPERTIES);\n }, []);\n\n const groupsColumns = useMemo(\n () => [\n {\n Header: \"Table\",\n columns: [\n {\n id: \"groupName\",\n Header: \"Group\",\n accessor: \"groupName\",\n Cell: (value: CellProps<Group>) => (\n <>\n {isLoadingQuery ? (\n value.row.original.groupName\n ) : (\n <div\n className='iui-anchor'\n onClick={(e) => {\n e.stopPropagation();\n openProperties(value);\n }}\n >\n {value.row.original.groupName}\n </div>\n )}\n </>\n ),\n },\n {\n id: \"description\",\n Header: \"Description\",\n accessor: \"description\",\n },\n {\n id: \"dropdown\",\n Header: \"\",\n width: 80,\n Cell: (value: CellProps<Group>) => {\n return (\n <div onClick={(e) => e.stopPropagation()}>\n <DropdownMenu\n disabled={isLoadingQuery}\n menuItems={(close: () => void) => [\n <MenuItem\n key={0}\n onClick={() => onModify(value)}\n icon={<SvgEdit />}\n >\n Modify\n </MenuItem>,\n <MenuItem\n key={1}\n onClick={() => openProperties(value)}\n icon={<SvgList />}\n >\n Properties\n </MenuItem>,\n <MenuItem\n key={2}\n onClick={() => {\n setSelectedGroup(value.row.original);\n setShowDeleteModal(true);\n close();\n }}\n icon={<SvgDelete />}\n >\n Remove\n </MenuItem>,\n ]}\n >\n <IconButton\n disabled={isLoadingQuery}\n styleType='borderless'\n >\n <SvgMore\n style={{\n width: \"16px\",\n height: \"16px\",\n }}\n />\n </IconButton>\n </DropdownMenu>\n </div>\n );\n },\n },\n ],\n },\n ],\n [isLoadingQuery, onModify, openProperties],\n );\n\n // Temp\n const stringToColor = function (str: string) {\n let hash = 0;\n for (let i = 0; i < str.length; i++) {\n hash = str.charCodeAt(i) + ((hash << 5) - hash);\n }\n let colour = \"#\";\n for (let i = 0; i < 3; i++) {\n const value = (hash >> (i * 8)) & 0xff;\n colour += (`00${value.toString(16)}`).substr(-2);\n }\n return colour;\n };\n\n const onSelect = useCallback(\n async (selectedData: Group[] | undefined) => {\n clearEmphasizedElements();\n if (selectedData && selectedData.length > 0) {\n setLoadingQuery(true);\n let allIds: string[] = [];\n for (const row of selectedData) {\n const query = row.query ?? \"\";\n if (hilitedElements.current.has(query)) {\n const hilitedIds = hilitedElements.current.get(query) ?? [];\n visualizeElements(hilitedIds, stringToColor(row.id ?? \"\"));\n allIds = allIds.concat(hilitedIds);\n } else {\n const ids: string[] = await fetchIdsFromQuery(\n row.query ?? \"\",\n iModelConnection,\n );\n const hiliteIds = await visualizeElementsById(\n ids,\n stringToColor(row.id ?? \"\"),\n iModelConnection,\n );\n hilitedElements.current.set(row.query ?? \"\", hiliteIds);\n\n allIds = allIds.concat(ids);\n }\n }\n await zoomToElements(allIds);\n setLoadingQuery(false);\n }\n },\n [iModelConnection],\n );\n\n switch (groupsView) {\n case GroupsView.ADD:\n return (\n <GroupAction\n iModelId={iModelId}\n mappingId={mapping.id ?? \"\"}\n goBack={async () => {\n clearEmphasizedElements();\n setGroupsView(GroupsView.GROUPS);\n await refresh();\n }}\n />\n );\n case GroupsView.MODIFYING:\n return selectedGroup ? (\n <GroupAction\n iModelId={iModelId}\n mappingId={mapping.id ?? \"\"}\n group={selectedGroup}\n goBack={async () => {\n clearEmphasizedElements();\n setGroupsView(GroupsView.GROUPS);\n await refresh();\n }}\n />\n ) : null;\n case GroupsView.PROPERTIES:\n return selectedGroup ? (\n <PropertyMenu\n iModelId={iModelId}\n mappingId={mapping.id ?? \"\"}\n group={selectedGroup}\n goBack={async () => {\n clearEmphasizedElements();\n setGroupsView(GroupsView.GROUPS);\n await refresh();\n }}\n />\n ) : null;\n default:\n return (\n <>\n <WidgetHeader\n title={mapping.mappingName ?? \"\"}\n disabled={isLoading || isLoadingQuery}\n returnFn={async () => {\n clearEmphasizedElements();\n await goBack();\n }}\n />\n <div className='groups-container'>\n <Button\n startIcon={\n isLoadingQuery ? <ProgressRadial size=\"small\" indeterminate /> : <SvgAdd />\n }\n styleType='high-visibility'\n disabled={isLoadingQuery}\n onClick={() => addGroup()}\n >\n {isLoadingQuery ? \"Loading Group(s)\" : \"Add Group\"}\n </Button>\n <Table<Group>\n data={groups}\n density='extra-condensed'\n columns={groupsColumns}\n emptyTableContent='No Groups available.'\n isSortable\n isSelectable\n onSelect={onSelect}\n isLoading={isLoading}\n isRowDisabled={() => isLoadingQuery}\n />\n </div>\n <DeleteModal\n entityName={selectedGroup?.groupName ?? \"\"}\n show={showDeleteModal}\n setShow={setShowDeleteModal}\n onDelete={async () => {\n await reportingClientApi.deleteGroup(\n iModelId,\n mapping.id ?? \"\",\n selectedGroup?.id ?? \"\",\n );\n }}\n refresh={refresh}\n />\n </>\n );\n }\n};\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
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 '~@itwin/itwinui-css/scss/variables';
|
|
6
|
+
|
|
7
|
+
.groups-container {
|
|
8
|
+
display: flex;
|
|
9
|
+
flex-direction: column;
|
|
10
|
+
gap: $iui-baseline;
|
|
11
|
+
|
|
12
|
+
button {
|
|
13
|
+
align-self: flex-start;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
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 * as React from "react";
|
|
6
|
+
import { Mappings } from "./Mapping";
|
|
7
|
+
import "./GroupingMapping.scss";
|
|
8
|
+
const GroupingMapping = () => {
|
|
9
|
+
return (React.createElement("div", { className: 'group-mapping-container' },
|
|
10
|
+
React.createElement(Mappings, null)));
|
|
11
|
+
};
|
|
12
|
+
export default GroupingMapping;
|
|
13
|
+
//# sourceMappingURL=GroupingMapping.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GroupingMapping.js","sourceRoot":"","sources":["../../../../src/widget/components/GroupingMapping.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,wBAAwB,CAAC;AAEhC,MAAM,eAAe,GAAG,GAAG,EAAE;IAC3B,OAAO,CACL,6BAAK,SAAS,EAAC,yBAAyB;QACtC,oBAAC,QAAQ,OAAG,CACR,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,eAAe,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 { Mappings } from \"./Mapping\";\nimport \"./GroupingMapping.scss\";\n\nconst GroupingMapping = () => {\n return (\n <div className='group-mapping-container'>\n <Mappings />\n </div>\n );\n};\n\nexport default GroupingMapping;\n"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
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 '~@itwin/itwinui-css/scss/variables';
|
|
6
|
+
|
|
7
|
+
// Widgets by default don't get horizontal scrollbars...
|
|
8
|
+
/* stylelint-disable-next-line selector-class-pattern */
|
|
9
|
+
.nz-widget-contentRenderer {
|
|
10
|
+
width: 100%;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.group-mapping-container {
|
|
14
|
+
display: flex;
|
|
15
|
+
flex-direction: column;
|
|
16
|
+
padding: $iui-baseline $iui-m;
|
|
17
|
+
box-sizing: border-box;
|
|
18
|
+
height: 100%;
|
|
19
|
+
overflow: auto;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.field-legend {
|
|
23
|
+
color: $iui-color-system-gray;
|
|
24
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { MappingReportingAPI } from "../../api/generated/api";
|
|
3
|
+
import type { CreateTypeFromInterface } from "../utils";
|
|
4
|
+
import "./Mapping.scss";
|
|
5
|
+
export declare type Mapping = CreateTypeFromInterface<MappingReportingAPI>;
|
|
6
|
+
export declare const Mappings: () => JSX.Element;
|
|
7
|
+
//# sourceMappingURL=Mapping.d.ts.map
|
|
@@ -0,0 +1,136 @@
|
|
|
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 { Presentation } from "@itwin/presentation-frontend";
|
|
6
|
+
import { useActiveIModelConnection } from "@itwin/appui-react";
|
|
7
|
+
import { SvgAdd, SvgDelete, SvgEdit, SvgImport, SvgMore, } from "@itwin/itwinui-icons-react";
|
|
8
|
+
import { Button, ButtonGroup, DropdownMenu, IconButton, MenuItem, Table, } from "@itwin/itwinui-react";
|
|
9
|
+
import React, { useCallback, useEffect, useMemo, useState } from "react";
|
|
10
|
+
import { onSelectionChanged, WidgetHeader } from "./utils";
|
|
11
|
+
import "./Mapping.scss";
|
|
12
|
+
import { reportingClientApi } from "../../api/reportingClient";
|
|
13
|
+
import DeleteModal from "./DeleteModal";
|
|
14
|
+
import { Groupings } from "./Grouping";
|
|
15
|
+
import MappingAction from "./MappingAction";
|
|
16
|
+
import { MappingImportWizardModal } from "./MappingImportWizardModal";
|
|
17
|
+
var MappingView;
|
|
18
|
+
(function (MappingView) {
|
|
19
|
+
MappingView["MAPPINGS"] = "mappings";
|
|
20
|
+
MappingView["GROUPS"] = "groups";
|
|
21
|
+
MappingView["ADDING"] = "adding";
|
|
22
|
+
MappingView["MODIFYING"] = "modifying";
|
|
23
|
+
MappingView["IMPORT"] = "import";
|
|
24
|
+
})(MappingView || (MappingView = {}));
|
|
25
|
+
const fetchMappings = async (setMappings, iModelId, setIsLoading) => {
|
|
26
|
+
try {
|
|
27
|
+
setIsLoading(true);
|
|
28
|
+
const mappings = await reportingClientApi.getMappings(iModelId);
|
|
29
|
+
setMappings(mappings);
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
}
|
|
33
|
+
finally {
|
|
34
|
+
setIsLoading(false);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
const useFetchMappings = (iModelId, setIsLoading) => {
|
|
38
|
+
const [mappings, setMappings] = useState([]);
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
void fetchMappings(setMappings, iModelId, setIsLoading);
|
|
41
|
+
}, [iModelId, setIsLoading]);
|
|
42
|
+
return [mappings, setMappings];
|
|
43
|
+
};
|
|
44
|
+
export const Mappings = () => {
|
|
45
|
+
var _a, _b;
|
|
46
|
+
const iModelId = (_a = useActiveIModelConnection()) === null || _a === void 0 ? void 0 : _a.iModelId;
|
|
47
|
+
const [showDeleteModal, setShowDeleteModal] = useState(false);
|
|
48
|
+
const [showImportModal, setShowImportModal] = useState(false);
|
|
49
|
+
const [mappingView, setMappingView] = useState(MappingView.MAPPINGS);
|
|
50
|
+
const [selectedMapping, setSelectedMapping] = useState(undefined);
|
|
51
|
+
const [isLoading, setIsLoading] = useState(true);
|
|
52
|
+
const [mappings, setMappings] = useFetchMappings(iModelId, setIsLoading);
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
const removeListener = Presentation.selection.selectionChange.addListener(onSelectionChanged);
|
|
55
|
+
return () => {
|
|
56
|
+
removeListener();
|
|
57
|
+
};
|
|
58
|
+
}, []);
|
|
59
|
+
const refresh = useCallback(async () => {
|
|
60
|
+
setMappingView(MappingView.MAPPINGS);
|
|
61
|
+
setSelectedMapping(undefined);
|
|
62
|
+
setMappings([]);
|
|
63
|
+
await fetchMappings(setMappings, iModelId, setIsLoading);
|
|
64
|
+
}, [iModelId, setMappings]);
|
|
65
|
+
const addMapping = async () => {
|
|
66
|
+
setMappingView(MappingView.ADDING);
|
|
67
|
+
};
|
|
68
|
+
const mappingsColumns = useMemo(() => [
|
|
69
|
+
{
|
|
70
|
+
Header: "Table",
|
|
71
|
+
columns: [
|
|
72
|
+
{
|
|
73
|
+
id: "mappingName",
|
|
74
|
+
Header: "Mapping Name",
|
|
75
|
+
accessor: "mappingName",
|
|
76
|
+
Cell: (value) => (React.createElement("div", { className: "iui-anchor", onClick: () => {
|
|
77
|
+
setSelectedMapping(value.row.original);
|
|
78
|
+
setMappingView(MappingView.GROUPS);
|
|
79
|
+
} }, value.row.original.mappingName)),
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
id: "description",
|
|
83
|
+
Header: "Description",
|
|
84
|
+
accessor: "description",
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
id: "dropdown",
|
|
88
|
+
Header: "",
|
|
89
|
+
width: 80,
|
|
90
|
+
Cell: (value) => {
|
|
91
|
+
return (React.createElement(DropdownMenu, { menuItems: (close) => [
|
|
92
|
+
React.createElement(MenuItem, { key: 0, onClick: () => {
|
|
93
|
+
setSelectedMapping(value.row.original);
|
|
94
|
+
setMappingView(MappingView.MODIFYING);
|
|
95
|
+
}, icon: React.createElement(SvgEdit, null) }, "Modify"),
|
|
96
|
+
React.createElement(MenuItem, { key: 1, onClick: () => {
|
|
97
|
+
setSelectedMapping(value.row.original);
|
|
98
|
+
setShowDeleteModal(true);
|
|
99
|
+
close();
|
|
100
|
+
}, icon: React.createElement(SvgDelete, null) }, "Remove"),
|
|
101
|
+
] },
|
|
102
|
+
React.createElement(IconButton, { styleType: "borderless" },
|
|
103
|
+
React.createElement(SvgMore, { style: {
|
|
104
|
+
width: "16px",
|
|
105
|
+
height: "16px",
|
|
106
|
+
} }))));
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
],
|
|
110
|
+
},
|
|
111
|
+
], []);
|
|
112
|
+
switch (mappingView) {
|
|
113
|
+
case MappingView.ADDING:
|
|
114
|
+
return React.createElement(MappingAction, { iModelId: iModelId, returnFn: refresh });
|
|
115
|
+
case MappingView.MODIFYING:
|
|
116
|
+
return (React.createElement(MappingAction, { iModelId: iModelId, mapping: selectedMapping, returnFn: refresh }));
|
|
117
|
+
case MappingView.GROUPS:
|
|
118
|
+
return (React.createElement(Groupings, { mapping: selectedMapping, goBack: refresh }));
|
|
119
|
+
default:
|
|
120
|
+
return (React.createElement(React.Fragment, null,
|
|
121
|
+
React.createElement(WidgetHeader, { title: "Mappings" }),
|
|
122
|
+
React.createElement("div", { className: "mappings-container" },
|
|
123
|
+
React.createElement("div", { className: "table-toolbar" },
|
|
124
|
+
React.createElement(Button, { startIcon: React.createElement(SvgAdd, null), onClick: async () => addMapping(), styleType: "high-visibility" }, "New"),
|
|
125
|
+
React.createElement(ButtonGroup, { onClick: () => setShowImportModal(true) },
|
|
126
|
+
React.createElement(IconButton, { title: "Import Mappings" },
|
|
127
|
+
React.createElement(SvgImport, null)))),
|
|
128
|
+
React.createElement(Table, { data: mappings, density: "extra-condensed", columns: mappingsColumns, emptyTableContent: "No Mappings available.", isSortable: true, isLoading: isLoading })),
|
|
129
|
+
React.createElement(DeleteModal, { entityName: (_b = selectedMapping === null || selectedMapping === void 0 ? void 0 : selectedMapping.mappingName) !== null && _b !== void 0 ? _b : "", show: showDeleteModal, setShow: setShowDeleteModal, onDelete: async () => {
|
|
130
|
+
var _a;
|
|
131
|
+
await reportingClientApi.deleteMapping(iModelId, (_a = selectedMapping === null || selectedMapping === void 0 ? void 0 : selectedMapping.id) !== null && _a !== void 0 ? _a : "");
|
|
132
|
+
}, refresh: refresh }),
|
|
133
|
+
React.createElement(MappingImportWizardModal, { show: showImportModal, setShow: setShowImportModal, onFinish: refresh })));
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
//# sourceMappingURL=Mapping.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Mapping.js","sourceRoot":"","sources":["../../../../src/widget/components/Mapping.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EACL,MAAM,EACN,SAAS,EACT,OAAO,EACP,SAAS,EACT,OAAO,GACR,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,MAAM,EACN,WAAW,EACX,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,KAAK,GACN,MAAM,sBAAsB,CAAC;AAE9B,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAGzE,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC3D,OAAO,gBAAgB,CAAC;AACxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,WAAW,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAItE,IAAK,WAMJ;AAND,WAAK,WAAW;IACd,oCAAqB,CAAA;IACrB,gCAAiB,CAAA;IACjB,gCAAiB,CAAA;IACjB,sCAAuB,CAAA;IACvB,gCAAiB,CAAA;AACnB,CAAC,EANI,WAAW,KAAX,WAAW,QAMf;AAED,MAAM,aAAa,GAAG,KAAK,EACzB,WAAwE,EACxE,QAAgB,EAChB,YAA2D,EAC3D,EAAE;IACF,IAAI;QACF,YAAY,CAAC,IAAI,CAAC,CAAC;QACnB,MAAM,QAAQ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,OAAO,EAAE,eAAsC,EAC/C,MAAM,EAAE,OAAO,GACf,CACH,CAAC;QACJ;YACE,OAAO,CACL;gBACE,oBAAC,YAAY,IAAC,KAAK,EAAC,UAAU,GAAG;gBACjC,6BAAK,SAAS,EAAC,oBAAoB;oBACjC,6BAAK,SAAS,EAAC,eAAe;wBAC5B,oBAAC,MAAM,IACL,SAAS,EAAE,oBAAC,MAAM,OAAG,EACrB,OAAO,EAAE,KAAK,IAAI,EAAE,CAAC,UAAU,EAAE,EACjC,SAAS,EAAC,iBAAiB,UAGpB;wBACT,oBAAC,WAAW,IAAC,OAAO,EAAE,GAAG,EAAE,CAAC,kBAAkB,CAAC,IAAI,CAAC;4BAClD,oBAAC,UAAU,IAAC,KAAK,EAAC,iBAAiB;gCACjC,oBAAC,SAAS,OAAG,CACF,CACD,CACV;oBACN,oBAAC,KAAK,IACJ,IAAI,EAAE,QAAQ,EACd,OAAO,EAAC,iBAAiB,EACzB,OAAO,EAAE,eAAe,EACxB,iBAAiB,EAAC,wBAAwB,EAC1C,UAAU,QACV,SAAS,EAAE,SAAS,GACpB,CACE;gBACN,oBAAC,WAAW,IACV,UAAU,EAAE,MAAA,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,WAAW,mCAAI,EAAE,EAC9C,IAAI,EAAE,eAAe,EACrB,OAAO,EAAE,kBAAkB,EAC3B,QAAQ,EAAE,KAAK,IAAI,EAAE;;wBACnB,MAAM,kBAAkB,CAAC,aAAa,CACpC,QAAQ,EACR,MAAA,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,EAAE,mCAAI,EAAE,CAC1B,CAAC;oBACJ,CAAC,EACD,OAAO,EAAE,OAAO,GAChB;gBACF,oBAAC,wBAAwB,IACvB,IAAI,EAAE,eAAe,EACrB,OAAO,EAAE,kBAAkB,EAC3B,QAAQ,EAAE,OAAO,GACjB,CACD,CACJ,CAAC;KACL;AACH,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 { Presentation } from \"@itwin/presentation-frontend\";\nimport { useActiveIModelConnection } from \"@itwin/appui-react\";\nimport {\n SvgAdd,\n SvgDelete,\n SvgEdit,\n SvgImport,\n SvgMore,\n} from \"@itwin/itwinui-icons-react\";\nimport {\n Button,\n ButtonGroup,\n DropdownMenu,\n IconButton,\n MenuItem,\n Table,\n} from \"@itwin/itwinui-react\";\nimport type { CellProps } from \"react-table\";\nimport React, { useCallback, useEffect, useMemo, useState } from \"react\";\nimport type { MappingReportingAPI } from \"../../api/generated/api\";\nimport type { CreateTypeFromInterface } from \"../utils\";\nimport { onSelectionChanged, WidgetHeader } from \"./utils\";\nimport \"./Mapping.scss\";\nimport { reportingClientApi } from \"../../api/reportingClient\";\nimport DeleteModal from \"./DeleteModal\";\nimport { Groupings } from \"./Grouping\";\nimport MappingAction from \"./MappingAction\";\nimport { MappingImportWizardModal } from \"./MappingImportWizardModal\";\n\nexport type Mapping = CreateTypeFromInterface<MappingReportingAPI>;\n\nenum MappingView {\n MAPPINGS = \"mappings\",\n GROUPS = \"groups\",\n ADDING = \"adding\",\n MODIFYING = \"modifying\",\n IMPORT = \"import\",\n}\n\nconst fetchMappings = async (\n setMappings: React.Dispatch<React.SetStateAction<MappingReportingAPI[]>>,\n iModelId: string,\n setIsLoading: React.Dispatch<React.SetStateAction<boolean>>\n) => {\n try {\n setIsLoading(true);\n const mappings = await reportingClientApi.getMappings(iModelId);\n setMappings(mappings);\n } catch {\n } finally {\n setIsLoading(false);\n }\n};\n\nconst useFetchMappings = (\n iModelId: string,\n setIsLoading: React.Dispatch<React.SetStateAction<boolean>>\n): [\n MappingReportingAPI[],\n React.Dispatch<React.SetStateAction<MappingReportingAPI[]>>\n] => {\n const [mappings, setMappings] = useState<MappingReportingAPI[]>([]);\n useEffect(() => {\n void fetchMappings(setMappings, iModelId, setIsLoading);\n }, [iModelId, setIsLoading]);\n\n return [mappings, setMappings];\n};\n\nexport const Mappings = () => {\n const iModelId = useActiveIModelConnection()?.iModelId as string;\n const [showDeleteModal, setShowDeleteModal] = useState<boolean>(false);\n const [showImportModal, setShowImportModal] = useState<boolean>(false);\n const [mappingView, setMappingView] = useState<MappingView>(\n MappingView.MAPPINGS\n );\n const [selectedMapping, setSelectedMapping] = useState<\n MappingReportingAPI | undefined\n >(undefined);\n const [isLoading, setIsLoading] = useState<boolean>(true);\n const [mappings, setMappings] = useFetchMappings(iModelId, setIsLoading);\n\n useEffect(() => {\n const removeListener =\n Presentation.selection.selectionChange.addListener(onSelectionChanged);\n return () => {\n removeListener();\n };\n }, []);\n\n const refresh = useCallback(async () => {\n setMappingView(MappingView.MAPPINGS);\n setSelectedMapping(undefined);\n setMappings([]);\n await fetchMappings(setMappings, iModelId, setIsLoading);\n }, [iModelId, setMappings]);\n\n const addMapping = async () => {\n setMappingView(MappingView.ADDING);\n };\n\n const mappingsColumns = useMemo(\n () => [\n {\n Header: \"Table\",\n columns: [\n {\n id: \"mappingName\",\n Header: \"Mapping Name\",\n accessor: \"mappingName\",\n Cell: (value: CellProps<{ mappingName: string }>) => (\n <div\n className=\"iui-anchor\"\n onClick={() => {\n setSelectedMapping(value.row.original);\n setMappingView(MappingView.GROUPS);\n }}\n >\n {value.row.original.mappingName}\n </div>\n ),\n },\n {\n id: \"description\",\n Header: \"Description\",\n accessor: \"description\",\n },\n {\n id: \"dropdown\",\n Header: \"\",\n width: 80,\n Cell: (value: CellProps<Mapping>) => {\n return (\n <DropdownMenu\n menuItems={(close: () => void) => [\n <MenuItem\n key={0}\n onClick={() => {\n setSelectedMapping(value.row.original);\n setMappingView(MappingView.MODIFYING);\n }}\n icon={<SvgEdit />}\n >\n Modify\n </MenuItem>,\n\n <MenuItem\n key={1}\n onClick={() => {\n setSelectedMapping(value.row.original);\n setShowDeleteModal(true);\n close();\n }}\n icon={<SvgDelete />}\n >\n Remove\n </MenuItem>,\n ]}\n >\n <IconButton styleType=\"borderless\">\n <SvgMore\n style={{\n width: \"16px\",\n height: \"16px\",\n }}\n />\n </IconButton>\n </DropdownMenu>\n );\n },\n },\n ],\n },\n ],\n []\n );\n\n switch (mappingView) {\n case MappingView.ADDING:\n return <MappingAction iModelId={iModelId} returnFn={refresh} />;\n case MappingView.MODIFYING:\n return (\n <MappingAction\n iModelId={iModelId}\n mapping={selectedMapping}\n returnFn={refresh}\n />\n );\n case MappingView.GROUPS:\n return (\n <Groupings\n mapping={selectedMapping as MappingReportingAPI}\n goBack={refresh}\n />\n );\n default:\n return (\n <>\n <WidgetHeader title=\"Mappings\" />\n <div className=\"mappings-container\">\n <div className=\"table-toolbar\">\n <Button\n startIcon={<SvgAdd />}\n onClick={async () => addMapping()}\n styleType=\"high-visibility\"\n >\n New\n </Button>\n <ButtonGroup onClick={() => setShowImportModal(true)}>\n <IconButton title=\"Import Mappings\">\n <SvgImport />\n </IconButton>\n </ButtonGroup>\n </div>\n <Table<Mapping>\n data={mappings}\n density=\"extra-condensed\"\n columns={mappingsColumns}\n emptyTableContent=\"No Mappings available.\"\n isSortable\n isLoading={isLoading}\n />\n </div>\n <DeleteModal\n entityName={selectedMapping?.mappingName ?? \"\"}\n show={showDeleteModal}\n setShow={setShowDeleteModal}\n onDelete={async () => {\n await reportingClientApi.deleteMapping(\n iModelId,\n selectedMapping?.id ?? \"\"\n );\n }}\n refresh={refresh}\n />\n <MappingImportWizardModal\n show={showImportModal}\n setShow={setShowImportModal}\n onFinish={refresh}\n />\n </>\n );\n }\n};\n"]}
|
|
@@ -0,0 +1,26 @@
|
|
|
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 '~@itwin/itwinui-css/scss/variables';
|
|
6
|
+
|
|
7
|
+
.mappings-container {
|
|
8
|
+
display: flex;
|
|
9
|
+
flex-direction: column;
|
|
10
|
+
gap: $iui-baseline;
|
|
11
|
+
|
|
12
|
+
.table-toolbar {
|
|
13
|
+
display: flex;
|
|
14
|
+
gap: $iui-s;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
button {
|
|
18
|
+
align-self: flex-start;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.action-panel {
|
|
23
|
+
display: flex;
|
|
24
|
+
justify-content: right;
|
|
25
|
+
column-gap: $iui-s;
|
|
26
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { MappingReportingAPI } from "../../api/generated/api";
|
|
3
|
+
import "./MappingAction.scss";
|
|
4
|
+
interface MappingActionProps {
|
|
5
|
+
iModelId: string;
|
|
6
|
+
mapping?: MappingReportingAPI;
|
|
7
|
+
returnFn: () => Promise<void>;
|
|
8
|
+
}
|
|
9
|
+
declare const MappingAction: ({ iModelId, mapping, returnFn }: MappingActionProps) => JSX.Element;
|
|
10
|
+
export default MappingAction;
|
|
11
|
+
//# sourceMappingURL=MappingAction.d.ts.map
|