@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,166 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
|
+
};
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
const presentation_frontend_1 = require("@itwin/presentation-frontend");
|
|
26
|
+
const appui_react_1 = require("@itwin/appui-react");
|
|
27
|
+
const itwinui_react_1 = require("@itwin/itwinui-react");
|
|
28
|
+
const react_1 = __importStar(require("react"));
|
|
29
|
+
const reportingClient_1 = require("../../api/reportingClient");
|
|
30
|
+
const utils_1 = require("./utils");
|
|
31
|
+
require("./GroupAction.scss");
|
|
32
|
+
const ActionPanel_1 = __importDefault(require("./ActionPanel"));
|
|
33
|
+
const useValidator_1 = __importStar(require("../hooks/useValidator"));
|
|
34
|
+
const GroupQueryBuilderContainer_1 = require("./GroupQueryBuilderContainer");
|
|
35
|
+
const GroupQueryBuilderContext_1 = require("./GroupQueryBuilderContext");
|
|
36
|
+
const QueryBuilder_1 = require("./QueryBuilder");
|
|
37
|
+
const viewerUtils_1 = require("./viewerUtils");
|
|
38
|
+
const GroupAction = ({ iModelId, mappingId, group, goBack, }) => {
|
|
39
|
+
var _a, _b, _c;
|
|
40
|
+
const iModelConnection = appui_react_1.useActiveIModelConnection();
|
|
41
|
+
const [details, setDetails] = react_1.useState({
|
|
42
|
+
groupName: (_a = group === null || group === void 0 ? void 0 : group.groupName) !== null && _a !== void 0 ? _a : "",
|
|
43
|
+
description: (_b = group === null || group === void 0 ? void 0 : group.description) !== null && _b !== void 0 ? _b : "",
|
|
44
|
+
});
|
|
45
|
+
const [query, setQuery] = react_1.useState("");
|
|
46
|
+
const [simpleQuery, setSimpleQuery] = react_1.useState("");
|
|
47
|
+
const [validator, showValidationMessage] = useValidator_1.default();
|
|
48
|
+
const [isLoading, setIsLoading] = react_1.useState(false);
|
|
49
|
+
const [currentPropertyList, setCurrentPropertyList] = react_1.default.useState([]);
|
|
50
|
+
const [queryBuilder, setQueryBuilder] = react_1.default.useState(new QueryBuilder_1.QueryBuilder(undefined));
|
|
51
|
+
react_1.useEffect(() => {
|
|
52
|
+
const removeListener = presentation_frontend_1.Presentation.selection.selectionChange.addListener(async (evt, selectionProvider) => {
|
|
53
|
+
const selection = selectionProvider.getSelection(evt.imodel, evt.level);
|
|
54
|
+
const query = `SELECT ECInstanceId FROM ${selection.instanceKeys.keys().next().value}`;
|
|
55
|
+
// Selects all instances of the class
|
|
56
|
+
// const ids = await fetchIdsFromQuery(query, iModelConnection);
|
|
57
|
+
// const keySet = await manufactureKeys(ids, iModelConnection);
|
|
58
|
+
// Presentation.selection.replaceSelection(
|
|
59
|
+
// "GroupingMappingWidget",
|
|
60
|
+
// iModelConnection,
|
|
61
|
+
// keySet
|
|
62
|
+
// );
|
|
63
|
+
// setSelectionInstanceKeys(selection.instanceKeys);
|
|
64
|
+
setSimpleQuery(query);
|
|
65
|
+
});
|
|
66
|
+
return () => {
|
|
67
|
+
removeListener();
|
|
68
|
+
};
|
|
69
|
+
}, [iModelConnection]);
|
|
70
|
+
react_1.useEffect(() => {
|
|
71
|
+
const reemphasize = async () => {
|
|
72
|
+
viewerUtils_1.clearEmphasizedElements();
|
|
73
|
+
if (!query || query === "") {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
const ids = await utils_1.fetchIdsFromQuery(query !== null && query !== void 0 ? query : "", iModelConnection);
|
|
77
|
+
const resolvedHiliteIds = await viewerUtils_1.visualizeElementsById(ids, "red", iModelConnection);
|
|
78
|
+
await viewerUtils_1.zoomToElements(resolvedHiliteIds);
|
|
79
|
+
};
|
|
80
|
+
void reemphasize();
|
|
81
|
+
}, [iModelConnection, query]);
|
|
82
|
+
react_1.useEffect(() => {
|
|
83
|
+
presentation_frontend_1.Presentation.selection.clearSelection("GroupingMappingWidget", iModelConnection);
|
|
84
|
+
}, [iModelConnection]);
|
|
85
|
+
const save = react_1.useCallback(async () => {
|
|
86
|
+
var _a;
|
|
87
|
+
if (!validator.allValid()) {
|
|
88
|
+
showValidationMessage(true);
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
try {
|
|
92
|
+
setIsLoading(true);
|
|
93
|
+
const currentQuery = query || simpleQuery;
|
|
94
|
+
group
|
|
95
|
+
? await reportingClient_1.reportingClientApi.updateGroup(iModelId, mappingId, (_a = group.id) !== null && _a !== void 0 ? _a : "", { ...details, query: currentQuery })
|
|
96
|
+
: await reportingClient_1.reportingClientApi.createGroup(iModelId, mappingId, {
|
|
97
|
+
...details,
|
|
98
|
+
query: currentQuery,
|
|
99
|
+
});
|
|
100
|
+
presentation_frontend_1.Presentation.selection.clearSelection("GroupingMappingWidget", iModelConnection);
|
|
101
|
+
await goBack();
|
|
102
|
+
}
|
|
103
|
+
catch {
|
|
104
|
+
setIsLoading(false);
|
|
105
|
+
}
|
|
106
|
+
}, [
|
|
107
|
+
details,
|
|
108
|
+
goBack,
|
|
109
|
+
group,
|
|
110
|
+
iModelConnection,
|
|
111
|
+
iModelId,
|
|
112
|
+
mappingId,
|
|
113
|
+
query,
|
|
114
|
+
showValidationMessage,
|
|
115
|
+
simpleQuery,
|
|
116
|
+
validator,
|
|
117
|
+
]);
|
|
118
|
+
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
119
|
+
react_1.default.createElement(utils_1.WidgetHeader, { title: group ? (_c = group.groupName) !== null && _c !== void 0 ? _c : "" : "Add Group", returnFn: async () => {
|
|
120
|
+
presentation_frontend_1.Presentation.selection.clearSelection("GroupingMappingWidget", iModelConnection);
|
|
121
|
+
await goBack();
|
|
122
|
+
} }),
|
|
123
|
+
react_1.default.createElement("div", { className: 'group-add-modify-container' },
|
|
124
|
+
react_1.default.createElement(itwinui_react_1.Fieldset, { legend: 'Group Details', className: 'group-details' },
|
|
125
|
+
react_1.default.createElement(itwinui_react_1.Small, { className: 'field-legend' }, "Asterisk * indicates mandatory fields."),
|
|
126
|
+
react_1.default.createElement(itwinui_react_1.LabeledInput, { id: 'groupName', name: 'groupName', label: 'Name', value: details.groupName, required: true, onChange: (event) => {
|
|
127
|
+
utils_1.handleInputChange(event, details, setDetails);
|
|
128
|
+
validator.showMessageFor("groupName");
|
|
129
|
+
}, message: validator.message("groupName", details.groupName, useValidator_1.NAME_REQUIREMENTS), status: validator.message("groupName", details.groupName, useValidator_1.NAME_REQUIREMENTS)
|
|
130
|
+
? "negative"
|
|
131
|
+
: undefined, onBlur: () => {
|
|
132
|
+
validator.showMessageFor("groupName");
|
|
133
|
+
}, onBlurCapture: (event) => {
|
|
134
|
+
utils_1.handleInputChange(event, details, setDetails);
|
|
135
|
+
validator.showMessageFor("groupName");
|
|
136
|
+
} }),
|
|
137
|
+
react_1.default.createElement(itwinui_react_1.LabeledInput, { id: 'description', required: true, name: 'description', label: 'Description', value: details.description, onChange: (event) => {
|
|
138
|
+
utils_1.handleInputChange(event, details, setDetails);
|
|
139
|
+
validator.showMessageFor("description");
|
|
140
|
+
}, message: validator.message("description", details.description, "required"), status: validator.message("description", details.description, "required")
|
|
141
|
+
? "negative"
|
|
142
|
+
: undefined, onBlur: () => {
|
|
143
|
+
validator.showMessageFor("description");
|
|
144
|
+
}, onBlurCapture: (event) => {
|
|
145
|
+
utils_1.handleInputChange(event, details, setDetails);
|
|
146
|
+
validator.showMessageFor("description");
|
|
147
|
+
} })),
|
|
148
|
+
react_1.default.createElement(itwinui_react_1.Fieldset, { legend: 'Group By', className: 'find-similar' },
|
|
149
|
+
react_1.default.createElement(GroupQueryBuilderContext_1.GroupQueryBuilderContext.Provider, { value: {
|
|
150
|
+
currentPropertyList,
|
|
151
|
+
setCurrentPropertyList,
|
|
152
|
+
query,
|
|
153
|
+
setQuery,
|
|
154
|
+
queryBuilder,
|
|
155
|
+
setQueryBuilder,
|
|
156
|
+
} },
|
|
157
|
+
react_1.default.createElement(GroupQueryBuilderContainer_1.GroupQueryBuilderContainer, null)))),
|
|
158
|
+
react_1.default.createElement(ActionPanel_1.default, { onSave: async () => {
|
|
159
|
+
await save();
|
|
160
|
+
}, onCancel: async () => {
|
|
161
|
+
presentation_frontend_1.Presentation.selection.clearSelection("GroupingMappingWidget", iModelConnection);
|
|
162
|
+
await goBack();
|
|
163
|
+
}, disabled: !(details.groupName && details.description && (query || simpleQuery)), isLoading: isLoading })));
|
|
164
|
+
};
|
|
165
|
+
exports.default = GroupAction;
|
|
166
|
+
//# sourceMappingURL=GroupAction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GroupAction.js","sourceRoot":"","sources":["../../../../src/widget/components/GroupAction.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAQA,wEAEsC;AACtC,oDAA+D;AAC/D,wDAAqE;AACrE,+CAAgE;AAChE,+DAA+D;AAC/D,mCAA6E;AAE7E,8BAA4B;AAC5B,gEAAwC;AACxC,sEAAwE;AAExE,6EAA0E;AAC1E,yEAAsE;AACtE,iDAA8C;AAC9C,+CAIuB;AASvB,MAAM,WAAW,GAAG,CAAC,EACnB,QAAQ,EACR,SAAS,EACT,KAAK,EACL,MAAM,GACW,EAAE,EAAE;;IACrB,MAAM,gBAAgB,GAAG,uCAAyB,EAAsB,CAAC;IACzE,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,gBAAQ,CAAC;QACrC,SAAS,EAAE,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,SAAS,mCAAI,EAAE;QACjC,WAAW,EAAE,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,WAAW,mCAAI,EAAE;KACtC,CAAC,CAAC;IACH,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,gBAAQ,CAAS,EAAE,CAAC,CAAC;IAC/C,MAAM,C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ACL,QAAQ;wBACR,YAAY;wBACZ,eAAe;qBAChB;oBAED,8BAAC,uDAA0B,OAAG,CACI,CAC3B,CACP;QACN,8BAAC,qBAAW,IACV,MAAM,EAAE,KAAK,IAAI,EAAE;gBACjB,MAAM,IAAI,EAAE,CAAC;YACf,CAAC,EACD,QAAQ,EAAE,KAAK,IAAI,EAAE;gBACnB,oCAAY,CAAC,SAAS,CAAC,cAAc,CACnC,uBAAuB,EACvB,gBAAgB,CACjB,CAAC;gBACF,MAAM,MAAM,EAAE,CAAC;YACjB,CAAC,EACD,QAAQ,EACN,CAAC,CAAC,OAAO,CAAC,SAAS,IAAI,OAAO,CAAC,WAAW,IAAI,CAAC,KAAK,IAAI,WAAW,CAAC,CAAC,EAEvE,SAAS,EAAE,SAAS,GACpB,CACD,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,WAAW,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport type { IModelConnection } from \"@itwin/core-frontend\";\nimport type {\n ISelectionProvider,\n SelectionChangeEventArgs} from \"@itwin/presentation-frontend\";\nimport {\n Presentation,\n} from \"@itwin/presentation-frontend\";\nimport { useActiveIModelConnection } from \"@itwin/appui-react\";\nimport { Fieldset, LabeledInput, Small } from \"@itwin/itwinui-react\";\nimport React, { useCallback, useEffect, useState } from \"react\";\nimport { reportingClientApi } from \"../../api/reportingClient\";\nimport { fetchIdsFromQuery, handleInputChange, WidgetHeader } from \"./utils\";\nimport type { Group } from \"./Grouping\";\nimport \"./GroupAction.scss\";\nimport ActionPanel from \"./ActionPanel\";\nimport useValidator, { NAME_REQUIREMENTS } from \"../hooks/useValidator\";\nimport type { PropertyRecord } from \"@itwin/appui-abstract\";\nimport { GroupQueryBuilderContainer } from \"./GroupQueryBuilderContainer\";\nimport { GroupQueryBuilderContext } from \"./GroupQueryBuilderContext\";\nimport { QueryBuilder } from \"./QueryBuilder\";\nimport {\n clearEmphasizedElements,\n visualizeElementsById,\n zoomToElements,\n} from \"./viewerUtils\";\n\ninterface GroupActionProps {\n iModelId: string;\n mappingId: string;\n group?: Group;\n goBack: () => Promise<void>;\n}\n\nconst GroupAction = ({\n iModelId,\n mappingId,\n group,\n goBack,\n}: GroupActionProps) => {\n const iModelConnection = useActiveIModelConnection() as IModelConnection;\n const [details, setDetails] = useState({\n groupName: group?.groupName ?? \"\",\n description: group?.description ?? \"\",\n });\n const [query, setQuery] = useState<string>(\"\");\n const [simpleQuery, setSimpleQuery] = useState<string>(\"\");\n const [validator, showValidationMessage] = useValidator();\n const [isLoading, setIsLoading] = useState<boolean>(false);\n const [currentPropertyList, setCurrentPropertyList] = React.useState<\n PropertyRecord[]\n >([]);\n const [queryBuilder, setQueryBuilder] = React.useState<QueryBuilder>(\n new QueryBuilder(undefined),\n );\n\n useEffect(() => {\n const removeListener = Presentation.selection.selectionChange.addListener(\n async (\n evt: SelectionChangeEventArgs,\n selectionProvider: ISelectionProvider,\n ) => {\n const selection = selectionProvider.getSelection(evt.imodel, evt.level);\n const query = `SELECT ECInstanceId FROM ${selection.instanceKeys.keys().next().value\n }`;\n // Selects all instances of the class\n // const ids = await fetchIdsFromQuery(query, iModelConnection);\n // const keySet = await manufactureKeys(ids, iModelConnection);\n // Presentation.selection.replaceSelection(\n // \"GroupingMappingWidget\",\n // iModelConnection,\n // keySet\n // );\n // setSelectionInstanceKeys(selection.instanceKeys);\n setSimpleQuery(query);\n },\n );\n return () => {\n removeListener();\n };\n }, [iModelConnection]);\n\n useEffect(() => {\n const reemphasize = async () => {\n clearEmphasizedElements();\n if (!query || query === \"\") {\n return;\n }\n const ids = await fetchIdsFromQuery(query ?? \"\", iModelConnection);\n const resolvedHiliteIds = await visualizeElementsById(\n ids,\n \"red\",\n iModelConnection,\n );\n await zoomToElements(resolvedHiliteIds);\n };\n\n void reemphasize();\n }, [iModelConnection, query]);\n\n useEffect(() => {\n Presentation.selection.clearSelection(\n \"GroupingMappingWidget\",\n iModelConnection,\n );\n }, [iModelConnection]);\n\n const save = useCallback(async () => {\n if (!validator.allValid()) {\n showValidationMessage(true);\n return;\n }\n try {\n setIsLoading(true);\n const currentQuery = query || simpleQuery;\n\n group\n ? await reportingClientApi.updateGroup(\n iModelId,\n mappingId,\n group.id ?? \"\",\n { ...details, query: currentQuery },\n )\n : await reportingClientApi.createGroup(iModelId, mappingId, {\n ...details,\n query: currentQuery,\n });\n Presentation.selection.clearSelection(\n \"GroupingMappingWidget\",\n iModelConnection,\n );\n await goBack();\n } catch {\n setIsLoading(false);\n }\n }, [\n details,\n goBack,\n group,\n iModelConnection,\n iModelId,\n mappingId,\n query,\n showValidationMessage,\n simpleQuery,\n validator,\n ]);\n\n return (\n <>\n <WidgetHeader\n title={group ? group.groupName ?? \"\" : \"Add Group\"}\n returnFn={async () => {\n Presentation.selection.clearSelection(\n \"GroupingMappingWidget\",\n iModelConnection,\n );\n await goBack();\n }}\n />\n <div className='group-add-modify-container'>\n <Fieldset legend='Group Details' className='group-details'>\n <Small className='field-legend'>\n Asterisk * indicates mandatory fields.\n </Small>\n <LabeledInput\n id='groupName'\n name='groupName'\n label='Name'\n value={details.groupName}\n required\n onChange={(event) => {\n handleInputChange(event, details, setDetails);\n validator.showMessageFor(\"groupName\");\n }}\n message={validator.message(\n \"groupName\",\n details.groupName,\n NAME_REQUIREMENTS,\n )}\n status={\n validator.message(\n \"groupName\",\n details.groupName,\n NAME_REQUIREMENTS,\n )\n ? \"negative\"\n : undefined\n }\n onBlur={() => {\n validator.showMessageFor(\"groupName\");\n }}\n onBlurCapture={(event) => {\n handleInputChange(event, details, setDetails);\n validator.showMessageFor(\"groupName\");\n }}\n />\n <LabeledInput\n id='description'\n required\n name='description'\n label='Description'\n value={details.description}\n onChange={(event) => {\n handleInputChange(event, details, setDetails);\n validator.showMessageFor(\"description\");\n }}\n message={validator.message(\n \"description\",\n details.description,\n \"required\",\n )}\n status={\n validator.message(\"description\", details.description, \"required\")\n ? \"negative\"\n : undefined\n }\n onBlur={() => {\n validator.showMessageFor(\"description\");\n }}\n onBlurCapture={(event) => {\n handleInputChange(event, details, setDetails);\n validator.showMessageFor(\"description\");\n }}\n />\n </Fieldset>\n\n <Fieldset legend='Group By' className='find-similar'>\n <GroupQueryBuilderContext.Provider\n value={{\n currentPropertyList,\n setCurrentPropertyList,\n query,\n setQuery,\n queryBuilder,\n setQueryBuilder,\n }}\n >\n <GroupQueryBuilderContainer />\n </GroupQueryBuilderContext.Provider>\n </Fieldset>\n </div>\n <ActionPanel\n onSave={async () => {\n await save();\n }}\n onCancel={async () => {\n Presentation.selection.clearSelection(\n \"GroupingMappingWidget\",\n iModelConnection,\n );\n await goBack();\n }}\n disabled={\n !(details.groupName && details.description && (query || simpleQuery))\n }\n isLoading={isLoading}\n />\n </>\n );\n};\n\nexport default GroupAction;\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
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
|
+
.group-add-modify-container {
|
|
8
|
+
display: flex;
|
|
9
|
+
flex-direction: column;
|
|
10
|
+
gap: $iui-baseline;
|
|
11
|
+
overflow-x: auto;
|
|
12
|
+
height: 100%;
|
|
13
|
+
|
|
14
|
+
.group-details {
|
|
15
|
+
display: flex;
|
|
16
|
+
flex-direction: column;
|
|
17
|
+
gap: $iui-baseline;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { KeySet } from "@itwin/presentation-common";
|
|
3
|
+
import type { SelectOption } from "@itwin/itwinui-react";
|
|
4
|
+
import "./GroupPropertyAction.scss";
|
|
5
|
+
interface GroupPropertyActionProps {
|
|
6
|
+
iModelId: string;
|
|
7
|
+
mappingId: string;
|
|
8
|
+
groupId: string;
|
|
9
|
+
groupPropertyId?: string;
|
|
10
|
+
groupPropertyName?: string;
|
|
11
|
+
keySet: KeySet;
|
|
12
|
+
returnFn: () => Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
export declare const quantityTypesSelectionOptions: SelectOption<string>[];
|
|
15
|
+
declare const GroupPropertyAction: ({ iModelId, mappingId, groupId, groupPropertyId, groupPropertyName, keySet, returnFn, }: GroupPropertyActionProps) => JSX.Element;
|
|
16
|
+
export default GroupPropertyAction;
|
|
17
|
+
//# sourceMappingURL=GroupPropertyAction.d.ts.map
|
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
|
+
};
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.quantityTypesSelectionOptions = void 0;
|
|
26
|
+
const presentation_common_1 = require("@itwin/presentation-common");
|
|
27
|
+
const presentation_frontend_1 = require("@itwin/presentation-frontend");
|
|
28
|
+
const appui_react_1 = require("@itwin/appui-react");
|
|
29
|
+
const itwinui_icons_react_1 = require("@itwin/itwinui-icons-react");
|
|
30
|
+
const itwinui_react_1 = require("@itwin/itwinui-react");
|
|
31
|
+
const react_1 = __importStar(require("react"));
|
|
32
|
+
const reportingClient_1 = require("../../api/reportingClient");
|
|
33
|
+
const ActionPanel_1 = __importDefault(require("./ActionPanel"));
|
|
34
|
+
const useValidator_1 = __importStar(require("../hooks/useValidator"));
|
|
35
|
+
const utils_1 = require("./utils");
|
|
36
|
+
require("./GroupPropertyAction.scss");
|
|
37
|
+
exports.quantityTypesSelectionOptions = [
|
|
38
|
+
{ value: "Area", label: "Area" },
|
|
39
|
+
{ value: "Distance", label: "Distance" },
|
|
40
|
+
{ value: "Force", label: "Force" },
|
|
41
|
+
{ value: "Mass", label: "Mass" },
|
|
42
|
+
{ value: "Monetary", label: "Monetary" },
|
|
43
|
+
{ value: "Time", label: "Time" },
|
|
44
|
+
{ value: "Volume", label: "Volume" },
|
|
45
|
+
{ value: "Undefined", label: "No Quantity Type" },
|
|
46
|
+
];
|
|
47
|
+
const extractPrimitive = (propertiesField, classToPropertiesMapping, navigation) => {
|
|
48
|
+
var _a, _b;
|
|
49
|
+
// There are rare cases which only happens in multiple selections where it returns more than one.
|
|
50
|
+
// This also checks if this property comes from a navigation property
|
|
51
|
+
const className = (_a = navigation === null || navigation === void 0 ? void 0 : navigation.rootClassName) !== null && _a !== void 0 ? _a : propertiesField.properties[0].property.classInfo.name;
|
|
52
|
+
// Sometimes class names are not defined. Type error. Not guaranteed.
|
|
53
|
+
if (!className) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
if (!classToPropertiesMapping.has(className)) {
|
|
57
|
+
classToPropertiesMapping.set(className, []);
|
|
58
|
+
}
|
|
59
|
+
// Gets property name. Appends path if from navigation.
|
|
60
|
+
const propertyName = navigation
|
|
61
|
+
? `${navigation.navigationName}.${propertiesField.properties[0].property.name}`
|
|
62
|
+
: propertiesField.properties[0].property.name;
|
|
63
|
+
const label = navigation
|
|
64
|
+
? `${propertiesField.label} (${navigation === null || navigation === void 0 ? void 0 : navigation.navigationName})`
|
|
65
|
+
: propertiesField.label;
|
|
66
|
+
(_b = classToPropertiesMapping.get(className)) === null || _b === void 0 ? void 0 : _b.push({
|
|
67
|
+
name: propertyName,
|
|
68
|
+
label,
|
|
69
|
+
type: propertiesField.properties[0].property.type,
|
|
70
|
+
});
|
|
71
|
+
};
|
|
72
|
+
const extractStructProperties = (name, className, classToPropertiesMapping, members) => {
|
|
73
|
+
var _a;
|
|
74
|
+
for (const member of members) {
|
|
75
|
+
if (member.type.valueFormat === presentation_common_1.PropertyValueFormat.Primitive) {
|
|
76
|
+
if (!classToPropertiesMapping.has(className)) {
|
|
77
|
+
classToPropertiesMapping.set(className, []);
|
|
78
|
+
}
|
|
79
|
+
(_a = classToPropertiesMapping.get(className)) === null || _a === void 0 ? void 0 : _a.push({
|
|
80
|
+
name: `${name}.${member.name}`,
|
|
81
|
+
label: member.label,
|
|
82
|
+
type: member.type.typeName,
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
else if (member.type.valueFormat === presentation_common_1.PropertyValueFormat.Struct) {
|
|
86
|
+
extractStructProperties(`${name}.${member.name}`, className, classToPropertiesMapping, member.type.members);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
const extractProperties = (properties, classToPropertiesMapping, navigation) => {
|
|
91
|
+
for (const property of properties) {
|
|
92
|
+
switch (property.type.valueFormat) {
|
|
93
|
+
case presentation_common_1.PropertyValueFormat.Primitive: {
|
|
94
|
+
extractPrimitive(property, classToPropertiesMapping, navigation);
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
// Get structs
|
|
98
|
+
case presentation_common_1.PropertyValueFormat.Struct: {
|
|
99
|
+
const nestedContentField = property;
|
|
100
|
+
// Only handling single path and not handling nested content fields within navigations
|
|
101
|
+
if (nestedContentField.pathToPrimaryClass &&
|
|
102
|
+
nestedContentField.pathToPrimaryClass.length > 1) {
|
|
103
|
+
break;
|
|
104
|
+
}
|
|
105
|
+
switch (nestedContentField.relationshipMeaning) {
|
|
106
|
+
case presentation_common_1.RelationshipMeaning.SameInstance: {
|
|
107
|
+
// Some elements don't have a path to primary class..
|
|
108
|
+
// Most likely a simple struct property
|
|
109
|
+
if (!nestedContentField.pathToPrimaryClass) {
|
|
110
|
+
const columnName = property.properties[0]
|
|
111
|
+
.property.name;
|
|
112
|
+
const className = property.properties[0]
|
|
113
|
+
.property.classInfo.name;
|
|
114
|
+
extractStructProperties(navigation
|
|
115
|
+
? `${navigation.navigationName}.${columnName}`
|
|
116
|
+
: columnName, navigation ? navigation.rootClassName : className, classToPropertiesMapping, property.type.members);
|
|
117
|
+
// Check for aspects. Ignore them if coming from navigation.
|
|
118
|
+
}
|
|
119
|
+
else if (!navigation &&
|
|
120
|
+
(nestedContentField.pathToPrimaryClass[0].relationshipInfo
|
|
121
|
+
.name === "BisCore:ElementOwnsUniqueAspect" ||
|
|
122
|
+
nestedContentField.pathToPrimaryClass[0].relationshipInfo
|
|
123
|
+
.name === "BisCore:ElementOwnsMultiAspects")) {
|
|
124
|
+
const className = nestedContentField.contentClassInfo.name;
|
|
125
|
+
if (!classToPropertiesMapping.has(className)) {
|
|
126
|
+
classToPropertiesMapping.set(className, []);
|
|
127
|
+
}
|
|
128
|
+
extractProperties(nestedContentField.nestedFields, classToPropertiesMapping, navigation);
|
|
129
|
+
}
|
|
130
|
+
break;
|
|
131
|
+
}
|
|
132
|
+
// Navigation properties
|
|
133
|
+
case presentation_common_1.RelationshipMeaning.RelatedInstance: {
|
|
134
|
+
if (
|
|
135
|
+
// Deal with a TypeDefinition
|
|
136
|
+
nestedContentField.pathToPrimaryClass[0].relationshipInfo.name ===
|
|
137
|
+
"BisCore:GeometricElement3dHasTypeDefinition") {
|
|
138
|
+
const className = nestedContentField.pathToPrimaryClass[0].targetClassInfo.name;
|
|
139
|
+
extractProperties(nestedContentField.nestedFields, classToPropertiesMapping, {
|
|
140
|
+
navigationName: "TypeDefinition",
|
|
141
|
+
rootClassName: className,
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
break;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
const GroupPropertyAction = ({ iModelId, mappingId, groupId, groupPropertyId, groupPropertyName, keySet, returnFn, }) => {
|
|
152
|
+
const iModelConnection = appui_react_1.useActiveIModelConnection();
|
|
153
|
+
const [propertyName, setPropertyName] = react_1.useState("");
|
|
154
|
+
const [dataType, setDataType] = react_1.useState();
|
|
155
|
+
const [quantityType, setQuantityType] = react_1.useState("Undefined");
|
|
156
|
+
const [classToPropertiesMapping, setClassToPropertiesMapping] = react_1.useState();
|
|
157
|
+
const [ecProperties, setEcProperties] = react_1.useState([]);
|
|
158
|
+
const [validator, showValidationMessage] = useValidator_1.default();
|
|
159
|
+
const [propertyAlert, setPropertyAlert] = react_1.useState(false);
|
|
160
|
+
const [isLoading, setIsLoading] = react_1.useState(false);
|
|
161
|
+
react_1.useEffect(() => {
|
|
162
|
+
const getContent = async () => {
|
|
163
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
164
|
+
setIsLoading(true);
|
|
165
|
+
const ruleSet = {
|
|
166
|
+
id: "element-properties",
|
|
167
|
+
rules: [
|
|
168
|
+
{
|
|
169
|
+
ruleType: presentation_common_1.RuleTypes.Content,
|
|
170
|
+
specifications: [
|
|
171
|
+
{
|
|
172
|
+
specType: presentation_common_1.ContentSpecificationTypes.SelectedNodeInstances,
|
|
173
|
+
// relationshipPaths: [
|
|
174
|
+
// {
|
|
175
|
+
// relationship: {
|
|
176
|
+
// schemaName: "BisCore",
|
|
177
|
+
// className: "ElementMultiAspect",
|
|
178
|
+
// },
|
|
179
|
+
// direction: RelationshipDirection.Forward,
|
|
180
|
+
// },
|
|
181
|
+
// ],
|
|
182
|
+
},
|
|
183
|
+
],
|
|
184
|
+
},
|
|
185
|
+
],
|
|
186
|
+
};
|
|
187
|
+
const requestOptions = {
|
|
188
|
+
imodel: iModelConnection,
|
|
189
|
+
keys: keySet,
|
|
190
|
+
rulesetOrId: ruleSet,
|
|
191
|
+
displayType: presentation_common_1.DefaultContentDisplayTypes.PropertyPane,
|
|
192
|
+
};
|
|
193
|
+
const content = await presentation_frontend_1.Presentation.presentation.getContentDescriptor(requestOptions);
|
|
194
|
+
// Only primitives and structs for now
|
|
195
|
+
const properties = (_a = content === null || content === void 0 ? void 0 : content.fields.filter((field) => field.type.valueFormat === presentation_common_1.PropertyValueFormat.Primitive ||
|
|
196
|
+
field.type.valueFormat === presentation_common_1.PropertyValueFormat.Struct)) !== null && _a !== void 0 ? _a : [];
|
|
197
|
+
// Map properties to their classes
|
|
198
|
+
const classToPropertiesMapping = new Map();
|
|
199
|
+
extractProperties(properties, classToPropertiesMapping);
|
|
200
|
+
setClassToPropertiesMapping(classToPropertiesMapping);
|
|
201
|
+
let newEcProperties;
|
|
202
|
+
// Fetch already existing ec properties then add all classes from presentation
|
|
203
|
+
if (groupPropertyId) {
|
|
204
|
+
// TODO Error handling
|
|
205
|
+
const response = await reportingClient_1.reportingClientApi.getGroupProperty(iModelId, mappingId, groupId, groupPropertyId);
|
|
206
|
+
newEcProperties = (_c = (_b = response.property) === null || _b === void 0 ? void 0 : _b.ecProperties) !== null && _c !== void 0 ? _c : [];
|
|
207
|
+
let keys = Array.from(classToPropertiesMapping.keys()).reverse();
|
|
208
|
+
for (const ecProperty of newEcProperties) {
|
|
209
|
+
keys = keys.filter((key) => `${ecProperty.ecSchemaName}:${ecProperty.ecClassName}` !== key);
|
|
210
|
+
}
|
|
211
|
+
newEcProperties.push(...keys.map((key) => ({
|
|
212
|
+
ecSchemaName: key.split(":")[0],
|
|
213
|
+
ecClassName: key.split(":")[1],
|
|
214
|
+
// Placeholders for properties
|
|
215
|
+
ecPropertyName: "",
|
|
216
|
+
ecPropertyType: "",
|
|
217
|
+
})));
|
|
218
|
+
setPropertyName((_e = (_d = response.property) === null || _d === void 0 ? void 0 : _d.propertyName) !== null && _e !== void 0 ? _e : "");
|
|
219
|
+
setDataType((_g = (_f = response.property) === null || _f === void 0 ? void 0 : _f.dataType) !== null && _g !== void 0 ? _g : "");
|
|
220
|
+
setQuantityType((_j = (_h = response.property) === null || _h === void 0 ? void 0 : _h.quantityType) !== null && _j !== void 0 ? _j : "");
|
|
221
|
+
}
|
|
222
|
+
else {
|
|
223
|
+
newEcProperties = Array.from(classToPropertiesMapping)
|
|
224
|
+
.map(([key]) => ({
|
|
225
|
+
ecSchemaName: key.split(":")[0],
|
|
226
|
+
ecClassName: key.split(":")[1],
|
|
227
|
+
// Placeholders for properties
|
|
228
|
+
ecPropertyName: "",
|
|
229
|
+
ecPropertyType: "",
|
|
230
|
+
}))
|
|
231
|
+
.reverse();
|
|
232
|
+
}
|
|
233
|
+
setEcProperties(newEcProperties);
|
|
234
|
+
setIsLoading(false);
|
|
235
|
+
};
|
|
236
|
+
void getContent();
|
|
237
|
+
}, [groupId, groupPropertyId, iModelConnection, iModelId, keySet, mappingId]);
|
|
238
|
+
const onSave = async () => {
|
|
239
|
+
const filteredEcProperties = ecProperties.filter((ecProperty) => ecProperty.ecPropertyName && ecProperty.ecPropertyType);
|
|
240
|
+
if (!(filteredEcProperties === null || filteredEcProperties === void 0 ? void 0 : filteredEcProperties.length) || !validator.allValid()) {
|
|
241
|
+
showValidationMessage(true);
|
|
242
|
+
if (!(filteredEcProperties === null || filteredEcProperties === void 0 ? void 0 : filteredEcProperties.length)) {
|
|
243
|
+
setPropertyAlert(true);
|
|
244
|
+
}
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
try {
|
|
248
|
+
setIsLoading(true);
|
|
249
|
+
const groupProperty = {
|
|
250
|
+
propertyName,
|
|
251
|
+
dataType,
|
|
252
|
+
quantityType,
|
|
253
|
+
ecProperties: filteredEcProperties,
|
|
254
|
+
};
|
|
255
|
+
groupPropertyId
|
|
256
|
+
? await reportingClient_1.reportingClientApi.updateGroupProperty(iModelId, mappingId, groupId, groupPropertyId, groupProperty)
|
|
257
|
+
: await reportingClient_1.reportingClientApi.createGroupProperty(iModelId, mappingId, groupId, groupProperty);
|
|
258
|
+
await returnFn();
|
|
259
|
+
}
|
|
260
|
+
catch {
|
|
261
|
+
setIsLoading(false);
|
|
262
|
+
}
|
|
263
|
+
};
|
|
264
|
+
const onChange = react_1.useCallback((value, index) => {
|
|
265
|
+
setPropertyAlert(false);
|
|
266
|
+
const property = JSON.parse(value);
|
|
267
|
+
setEcProperties((ecProperties) => {
|
|
268
|
+
const updatedEcProperties = [...ecProperties];
|
|
269
|
+
updatedEcProperties[index].ecPropertyName = property.name;
|
|
270
|
+
// Unique types
|
|
271
|
+
let type = "";
|
|
272
|
+
switch (property.type) {
|
|
273
|
+
case "long":
|
|
274
|
+
type = "integer";
|
|
275
|
+
break;
|
|
276
|
+
default:
|
|
277
|
+
type = property.type;
|
|
278
|
+
}
|
|
279
|
+
updatedEcProperties[index].ecPropertyType = type;
|
|
280
|
+
return updatedEcProperties;
|
|
281
|
+
});
|
|
282
|
+
}, []);
|
|
283
|
+
const propertyOptions = react_1.useMemo(() => {
|
|
284
|
+
return ecProperties.map((ecProperty) => {
|
|
285
|
+
var _a, _b;
|
|
286
|
+
return (_b = (_a = classToPropertiesMapping === null || classToPropertiesMapping === void 0 ? void 0 : classToPropertiesMapping.get(`${ecProperty.ecSchemaName}:${ecProperty.ecClassName}`)) === null || _a === void 0 ? void 0 : _a.map((property) => ({
|
|
287
|
+
value: JSON.stringify({
|
|
288
|
+
name: property.name,
|
|
289
|
+
type: property.type,
|
|
290
|
+
}),
|
|
291
|
+
label: property.label,
|
|
292
|
+
}))) !== null && _b !== void 0 ? _b : [];
|
|
293
|
+
});
|
|
294
|
+
}, [classToPropertiesMapping, ecProperties]);
|
|
295
|
+
const getValue = react_1.useCallback((ecProperty, index) => {
|
|
296
|
+
var _a;
|
|
297
|
+
const property = (_a = classToPropertiesMapping === null || classToPropertiesMapping === void 0 ? void 0 : classToPropertiesMapping.get(`${ecProperty.ecSchemaName}:${ecProperty.ecClassName}`)) === null || _a === void 0 ? void 0 : _a.find((property) => property.name === ecProperties[index].ecPropertyName);
|
|
298
|
+
const result = JSON.stringify({
|
|
299
|
+
name: property === null || property === void 0 ? void 0 : property.name,
|
|
300
|
+
type: property === null || property === void 0 ? void 0 : property.type,
|
|
301
|
+
});
|
|
302
|
+
return result;
|
|
303
|
+
}, [classToPropertiesMapping, ecProperties]);
|
|
304
|
+
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
305
|
+
react_1.default.createElement(utils_1.WidgetHeader, { title: groupPropertyName !== null && groupPropertyName !== void 0 ? groupPropertyName : "Add Property", returnFn: returnFn }),
|
|
306
|
+
react_1.default.createElement("div", { className: 'group-property-action-container' },
|
|
307
|
+
react_1.default.createElement(itwinui_react_1.Fieldset, { className: 'property-options', legend: 'Property Details' },
|
|
308
|
+
react_1.default.createElement(itwinui_react_1.Small, { className: 'field-legend' }, "Asterisk * indicates mandatory fields."),
|
|
309
|
+
react_1.default.createElement(itwinui_react_1.LabeledInput, { id: 'propertyName', label: 'Property Name', value: propertyName, required: true, disabled: isLoading, onChange: (event) => {
|
|
310
|
+
setPropertyName(event.target.value);
|
|
311
|
+
validator.showMessageFor("propertyName");
|
|
312
|
+
}, message: validator.message("propertyName", propertyName, useValidator_1.NAME_REQUIREMENTS), status: validator.message("propertyName", propertyName, useValidator_1.NAME_REQUIREMENTS)
|
|
313
|
+
? "negative"
|
|
314
|
+
: undefined, onBlur: () => {
|
|
315
|
+
validator.showMessageFor("propertyName");
|
|
316
|
+
} }),
|
|
317
|
+
react_1.default.createElement(itwinui_react_1.LabeledSelect, { label: "Data Type", id: 'dataType', disabled: isLoading, options: [
|
|
318
|
+
{ value: "Boolean", label: "Boolean" },
|
|
319
|
+
{ value: "Number", label: "Number" },
|
|
320
|
+
{ value: "String", label: "String" },
|
|
321
|
+
], required: true, value: dataType, onChange: (value) => {
|
|
322
|
+
validator.showMessageFor("dataType");
|
|
323
|
+
setDataType(value);
|
|
324
|
+
}, message: validator.message("dataType", propertyName, "required"), status: validator.message("dataType", propertyName, "required")
|
|
325
|
+
? "negative"
|
|
326
|
+
: undefined, onBlur: () => {
|
|
327
|
+
validator.showMessageFor("dataType");
|
|
328
|
+
}, onShow: () => { }, onHide: () => { } }),
|
|
329
|
+
react_1.default.createElement(itwinui_react_1.LabeledSelect, { label: 'Quantity Type', disabled: isLoading, options: exports.quantityTypesSelectionOptions, value: quantityType, onChange: setQuantityType, onShow: () => { }, onHide: () => { } })),
|
|
330
|
+
react_1.default.createElement(itwinui_react_1.Fieldset, { className: 'property-selection-container', legend: 'Properties' },
|
|
331
|
+
propertyAlert && (react_1.default.createElement(itwinui_react_1.Alert, { type: "negative" }, "Please select at least one property.")),
|
|
332
|
+
isLoading &&
|
|
333
|
+
Array(3)
|
|
334
|
+
.fill(null)
|
|
335
|
+
.map((_, index) => (react_1.default.createElement(itwinui_react_1.Text, { key: index, variant: 'headline', isSkeleton: true }, "LOADING SKELETON"))), ecProperties === null || ecProperties === void 0 ? void 0 :
|
|
336
|
+
ecProperties.map((ecProperty, index) => {
|
|
337
|
+
return (react_1.default.createElement("div", { className: 'property-select-item', key: `${ecProperty.ecSchemaName}${ecProperty.ecClassName}` },
|
|
338
|
+
react_1.default.createElement(itwinui_react_1.Text, { variant: 'leading' }, ecProperty.ecClassName),
|
|
339
|
+
react_1.default.createElement(itwinui_react_1.Text, { isMuted: true, variant: 'small' }, ecProperty.ecSchemaName),
|
|
340
|
+
react_1.default.createElement("div", { className: 'selection-and-reorder' },
|
|
341
|
+
react_1.default.createElement(itwinui_react_1.ComboBox, { options: propertyOptions[index], value: getValue(ecProperty, index), onChange: (value) => onChange(value, index), inputProps: {
|
|
342
|
+
placeholder: "<No Property Mapped>",
|
|
343
|
+
}, style: { width: "100%" } }),
|
|
344
|
+
react_1.default.createElement(itwinui_react_1.IconButton, { onClick: () => {
|
|
345
|
+
const updatedEcPropertyList = [...ecProperties];
|
|
346
|
+
updatedEcPropertyList[index] = {
|
|
347
|
+
...updatedEcPropertyList[index],
|
|
348
|
+
ecPropertyName: "",
|
|
349
|
+
ecPropertyType: "",
|
|
350
|
+
};
|
|
351
|
+
setEcProperties(updatedEcPropertyList);
|
|
352
|
+
}, disabled: !ecProperty.ecPropertyName && !ecProperty.ecPropertyType },
|
|
353
|
+
react_1.default.createElement(itwinui_icons_react_1.SvgRemove, null)),
|
|
354
|
+
react_1.default.createElement(itwinui_react_1.IconButton, { onClick: () => {
|
|
355
|
+
const tab = [...ecProperties];
|
|
356
|
+
const item = tab.splice(index, 1);
|
|
357
|
+
tab.splice(index - 1, 0, item[0]);
|
|
358
|
+
setEcProperties(tab);
|
|
359
|
+
}, disabled: index === 0 },
|
|
360
|
+
react_1.default.createElement(itwinui_icons_react_1.SvgChevronUp, null)),
|
|
361
|
+
react_1.default.createElement(itwinui_react_1.IconButton, { onClick: () => {
|
|
362
|
+
const tab = [...ecProperties];
|
|
363
|
+
const item = tab.splice(index, 1);
|
|
364
|
+
tab.splice(index + 1, 0, item[0]);
|
|
365
|
+
setEcProperties(tab);
|
|
366
|
+
}, disabled: index === ecProperties.length - 1 },
|
|
367
|
+
react_1.default.createElement(itwinui_icons_react_1.SvgChevronDown, null)))));
|
|
368
|
+
}))),
|
|
369
|
+
react_1.default.createElement(ActionPanel_1.default, { onSave: onSave, onCancel: returnFn, isLoading: isLoading })));
|
|
370
|
+
};
|
|
371
|
+
exports.default = GroupPropertyAction;
|
|
372
|
+
//# sourceMappingURL=GroupPropertyAction.js.map
|