@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,341 @@
|
|
|
1
|
+
import { PropertyValueFormat, } from "@itwin/appui-abstract";
|
|
2
|
+
import "core-js/features/string/virtual";
|
|
3
|
+
/* This class is to build adaptive and dynamic query for find similar property selections */
|
|
4
|
+
export class QueryBuilder {
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
constructor(provider) {
|
|
9
|
+
this.dataProvider = provider;
|
|
10
|
+
}
|
|
11
|
+
async addProperty(prop) {
|
|
12
|
+
var _a, _b, _c, _d, _e;
|
|
13
|
+
// TODO: only handle primitive properties now
|
|
14
|
+
if (((_a = prop.value) === null || _a === void 0 ? void 0 : _a.valueFormat) !== PropertyValueFormat.Primitive ||
|
|
15
|
+
prop.value.value === undefined) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
function replaceAll(str, match, replacement) {
|
|
19
|
+
return str.split(match).join(replacement);
|
|
20
|
+
}
|
|
21
|
+
// if property value has single quote, escape
|
|
22
|
+
if ((typeof prop.value.value === "string" ||
|
|
23
|
+
prop.value.value instanceof String) &&
|
|
24
|
+
String(prop.value.value).indexOf("'") >= 0) {
|
|
25
|
+
prop.value.value = replaceAll(prop.value.value.toString(), "'", "''");
|
|
26
|
+
}
|
|
27
|
+
const propertyField = (await ((_b = this.dataProvider) === null || _b === void 0 ? void 0 : _b.getFieldByPropertyRecord(prop)));
|
|
28
|
+
if (propertyField === undefined) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
// get the special cases
|
|
32
|
+
const isNavigation = prop.property.typename.toLowerCase() === "navigation";
|
|
33
|
+
const isAspect = ((_c = propertyField.parent) === null || _c === void 0 ? void 0 : _c.pathToPrimaryClass.find((a) => {
|
|
34
|
+
var _a, _b;
|
|
35
|
+
return ((_a = a.relationshipInfo) === null || _a === void 0 ? void 0 : _a.name) ===
|
|
36
|
+
QueryBuilder.UNIQUE_ASPECT_PRIMARY_CLASS ||
|
|
37
|
+
((_b = a.relationshipInfo) === null || _b === void 0 ? void 0 : _b.name) === QueryBuilder.MULTI_ASPECT_PRIMARY_CLASS;
|
|
38
|
+
})) !== undefined;
|
|
39
|
+
const className = propertyField.properties[0].property.classInfo.name.replace(":", ".");
|
|
40
|
+
const propertyName = isNavigation
|
|
41
|
+
? `${propertyField.properties[0].property.name}.id`
|
|
42
|
+
: propertyField.properties[0].property.name;
|
|
43
|
+
const propertyValue = isNavigation
|
|
44
|
+
? prop.value.value.id
|
|
45
|
+
: prop.value.value;
|
|
46
|
+
// console.log(prop);
|
|
47
|
+
// console.log(propertyField);
|
|
48
|
+
if (!isAspect &&
|
|
49
|
+
((_d = propertyField.parent) === null || _d === void 0 ? void 0 : _d.pathToPrimaryClass) &&
|
|
50
|
+
((_e = propertyField.parent) === null || _e === void 0 ? void 0 : _e.pathToPrimaryClass.length) > 0) {
|
|
51
|
+
this.addRelatedProperty(propertyField, propertyName, propertyValue, isAspect);
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
this.addPropertyToQuery(className, propertyName, propertyValue, isAspect, this._needsQuote(propertyField), false);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
_needsQuote(propertyField) {
|
|
58
|
+
// list of property types that need quote around property value
|
|
59
|
+
if (propertyField.type.typeName.toLowerCase() === "string") {
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
62
|
+
if (propertyField.type.typeName.toLowerCase() === "uri") {
|
|
63
|
+
return true;
|
|
64
|
+
}
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
addRelatedProperty(propertyField, propertyName, propertyValue, isAspect) {
|
|
68
|
+
var _a, _b;
|
|
69
|
+
const paths = [...((_b = (_a = propertyField.parent) === null || _a === void 0 ? void 0 : _a.pathToPrimaryClass) !== null && _b !== void 0 ? _b : [])];
|
|
70
|
+
paths.reverse().forEach((path) => {
|
|
71
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
72
|
+
const sourceClassName = (_a = path.sourceClassInfo) === null || _a === void 0 ? void 0 : _a.name.replace(":", ".");
|
|
73
|
+
const targetClassName = (_b = path.targetClassInfo) === null || _b === void 0 ? void 0 : _b.name.replace(":", ".");
|
|
74
|
+
const relClassName = (_c = path.relationshipInfo) === null || _c === void 0 ? void 0 : _c.name.replace(":", ".");
|
|
75
|
+
if (!path.isForwardRelationship) {
|
|
76
|
+
this.addPropertyToQuery(targetClassName, `ECInstanceId`, `${relClassName}.SourceECInstanceId`, isAspect, false, true);
|
|
77
|
+
this.addPropertyToQuery(relClassName, `TargetECInstanceId`, `${sourceClassName}.ECInstanceId`, isAspect, false, true);
|
|
78
|
+
if (((_d = path.sourceClassInfo) === null || _d === void 0 ? void 0 : _d.name) ===
|
|
79
|
+
((_e = propertyField.parent) === null || _e === void 0 ? void 0 : _e.contentClassInfo.name)) {
|
|
80
|
+
this.addPropertyToQuery(sourceClassName, propertyName, propertyValue, isAspect, this._needsQuote(propertyField), true);
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
this.addPropertyToQuery(sourceClassName, `ECInstanceId`, `${relClassName}.TargetECInstanceId`, isAspect, false, true);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
this.addPropertyToQuery(targetClassName, `ECInstanceId`, `${relClassName}.TargetECInstanceId`, isAspect, false, true);
|
|
88
|
+
this.addPropertyToQuery(relClassName, `SourceECInstanceId`, `${sourceClassName}.ECInstanceId`, isAspect, false, true);
|
|
89
|
+
if (((_f = path.sourceClassInfo) === null || _f === void 0 ? void 0 : _f.name) ===
|
|
90
|
+
((_g = propertyField.parent) === null || _g === void 0 ? void 0 : _g.contentClassInfo.name)) {
|
|
91
|
+
this.addPropertyToQuery(sourceClassName, propertyName, propertyValue, isAspect, this._needsQuote(propertyField), true);
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
this.addPropertyToQuery(sourceClassName, `ECInstanceId`, `${relClassName}.SourceECInstanceId`, isAspect, false, true);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
addPropertyToQuery(className, propertyName, propertyValue, isAspect, needsQuote, isRelational) {
|
|
100
|
+
if (this.query === undefined || this.query.classes.length === 0) {
|
|
101
|
+
this.query = {
|
|
102
|
+
classes: [
|
|
103
|
+
{
|
|
104
|
+
className,
|
|
105
|
+
isAspect,
|
|
106
|
+
isRelational,
|
|
107
|
+
properties: [
|
|
108
|
+
{
|
|
109
|
+
name: propertyName,
|
|
110
|
+
value: propertyValue,
|
|
111
|
+
needsQuote,
|
|
112
|
+
},
|
|
113
|
+
],
|
|
114
|
+
},
|
|
115
|
+
],
|
|
116
|
+
};
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
const foundClass = this.query.classes.find((c) => c.className === className);
|
|
120
|
+
if (foundClass) {
|
|
121
|
+
foundClass.isRelational = isRelational;
|
|
122
|
+
if (!foundClass.properties.find((x) => x.name === propertyName)) {
|
|
123
|
+
foundClass.properties.push({
|
|
124
|
+
name: propertyName,
|
|
125
|
+
value: propertyValue,
|
|
126
|
+
needsQuote,
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
this.query.classes.push({
|
|
132
|
+
className,
|
|
133
|
+
isRelational,
|
|
134
|
+
properties: [
|
|
135
|
+
{
|
|
136
|
+
name: propertyName,
|
|
137
|
+
value: propertyValue,
|
|
138
|
+
needsQuote,
|
|
139
|
+
},
|
|
140
|
+
],
|
|
141
|
+
isAspect,
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
async removeProperty(prop) {
|
|
146
|
+
var _a, _b, _c, _d;
|
|
147
|
+
if (this.query === undefined || this.query.classes.length === 0) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
const propertyField = (await ((_a = this.dataProvider) === null || _a === void 0 ? void 0 : _a.getFieldByPropertyRecord(prop)));
|
|
151
|
+
if (propertyField === undefined) {
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
const isAspect = ((_b = propertyField.parent) === null || _b === void 0 ? void 0 : _b.pathToPrimaryClass.find((a) => {
|
|
155
|
+
var _a, _b;
|
|
156
|
+
return ((_a = a.relationshipInfo) === null || _a === void 0 ? void 0 : _a.name) ===
|
|
157
|
+
QueryBuilder.UNIQUE_ASPECT_PRIMARY_CLASS ||
|
|
158
|
+
((_b = a.relationshipInfo) === null || _b === void 0 ? void 0 : _b.name) === QueryBuilder.MULTI_ASPECT_PRIMARY_CLASS;
|
|
159
|
+
})) !== undefined;
|
|
160
|
+
const isNavigation = prop.property.typename.toLowerCase() === "navigation";
|
|
161
|
+
const propertyName = isNavigation
|
|
162
|
+
? `${propertyField.properties[0].property.name}.id`
|
|
163
|
+
: propertyField.properties[0].property.name;
|
|
164
|
+
const className = propertyField.properties[0].property.classInfo.name.replace(":", ".");
|
|
165
|
+
if (!isAspect &&
|
|
166
|
+
((_c = propertyField.parent) === null || _c === void 0 ? void 0 : _c.pathToPrimaryClass) &&
|
|
167
|
+
((_d = propertyField.parent) === null || _d === void 0 ? void 0 : _d.pathToPrimaryClass.length) > 0) {
|
|
168
|
+
this.removeRelatedProperty(propertyField, propertyName);
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
this.removePropertyFromQuery(className, propertyName);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
removeRelatedProperty(propertyField, propertyName) {
|
|
175
|
+
var _a, _b;
|
|
176
|
+
const paths = [...((_b = (_a = propertyField.parent) === null || _a === void 0 ? void 0 : _a.pathToPrimaryClass) !== null && _b !== void 0 ? _b : [])];
|
|
177
|
+
paths.reverse().forEach((path) => {
|
|
178
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
179
|
+
const sourceClassName = (_a = path.sourceClassInfo) === null || _a === void 0 ? void 0 : _a.name.replace(":", ".");
|
|
180
|
+
const targetClassName = (_b = path.targetClassInfo) === null || _b === void 0 ? void 0 : _b.name.replace(":", ".");
|
|
181
|
+
const relClassName = (_c = path.relationshipInfo) === null || _c === void 0 ? void 0 : _c.name.replace(":", ".");
|
|
182
|
+
if (!path.isForwardRelationship) {
|
|
183
|
+
this.removePropertyFromQuery(targetClassName, `ECInstanceId`);
|
|
184
|
+
this.removePropertyFromQuery(relClassName, `TargetECInstanceId`);
|
|
185
|
+
if (((_d = path.sourceClassInfo) === null || _d === void 0 ? void 0 : _d.name) ===
|
|
186
|
+
((_e = propertyField.parent) === null || _e === void 0 ? void 0 : _e.contentClassInfo.name)) {
|
|
187
|
+
this.removePropertyFromQuery(sourceClassName, propertyName);
|
|
188
|
+
}
|
|
189
|
+
else {
|
|
190
|
+
this.removePropertyFromQuery(sourceClassName, `ECInstanceId`);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
else {
|
|
194
|
+
this.removePropertyFromQuery(targetClassName, `ECInstanceId`);
|
|
195
|
+
this.removePropertyFromQuery(relClassName, `SourceECInstanceId`);
|
|
196
|
+
if (((_f = path.sourceClassInfo) === null || _f === void 0 ? void 0 : _f.name) ===
|
|
197
|
+
((_g = propertyField.parent) === null || _g === void 0 ? void 0 : _g.contentClassInfo.name)) {
|
|
198
|
+
this.removePropertyFromQuery(sourceClassName, propertyName);
|
|
199
|
+
}
|
|
200
|
+
else {
|
|
201
|
+
this.removePropertyFromQuery(sourceClassName, `ECInstanceId`);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
removePropertyFromQuery(className, propertyName) {
|
|
207
|
+
var _a, _b, _c, _d;
|
|
208
|
+
const foundClass = (_a = this.query) === null || _a === void 0 ? void 0 : _a.classes.find((c) => c.className === className);
|
|
209
|
+
if (foundClass) {
|
|
210
|
+
const foundPropertyIndex = foundClass.properties.findIndex((p) => p.name === propertyName);
|
|
211
|
+
if (foundPropertyIndex > -1) {
|
|
212
|
+
foundClass.properties.splice(foundPropertyIndex, 1);
|
|
213
|
+
}
|
|
214
|
+
if (foundClass.properties.length === 0) {
|
|
215
|
+
// remove the entire class if all properties are removed
|
|
216
|
+
const foundClassIndex = (_c = (_b = this.query) === null || _b === void 0 ? void 0 : _b.classes.findIndex((c) => c.className === className)) !== null && _c !== void 0 ? _c : -1;
|
|
217
|
+
if (foundClassIndex > -1) {
|
|
218
|
+
(_d = this.query) === null || _d === void 0 ? void 0 : _d.classes.splice(foundClassIndex, 1);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
buildQueryString() {
|
|
224
|
+
if (this.query === undefined || this.query.classes.length === 0) {
|
|
225
|
+
return "";
|
|
226
|
+
}
|
|
227
|
+
const baseClass = this.query.classes[0];
|
|
228
|
+
const baseClassName = baseClass.className;
|
|
229
|
+
const baseIdName = baseClass.isAspect
|
|
230
|
+
? `${baseClassName}.Element.id`
|
|
231
|
+
: `${baseClassName}.ECInstanceId`;
|
|
232
|
+
let queryString = `SELECT ${baseIdName} FROM ${baseClassName}`;
|
|
233
|
+
if (this.query.classes.length > 1) {
|
|
234
|
+
for (let i = 1; i < this.query.classes.length; i++) {
|
|
235
|
+
const joinClass = this.query.classes[i];
|
|
236
|
+
const joinClassName = joinClass.className;
|
|
237
|
+
const joinIdName = joinClass.isAspect
|
|
238
|
+
? `${joinClassName}.Element.id`
|
|
239
|
+
: `${joinClassName}.ECInstanceId`;
|
|
240
|
+
if (joinClass.isRelational) {
|
|
241
|
+
queryString += ` JOIN ${joinClassName}`;
|
|
242
|
+
if (joinClass.properties.length > 0) {
|
|
243
|
+
if (joinClass.properties[0].needsQuote) {
|
|
244
|
+
queryString += ` ON ${joinClassName}.${joinClass.properties[0].name}='${joinClass.properties[0].value}'`;
|
|
245
|
+
}
|
|
246
|
+
else {
|
|
247
|
+
if (this._isFloat(joinClass.properties[0].value)) {
|
|
248
|
+
queryString += ` ON ROUND(${joinClassName}.${joinClass.properties[0].name}, `;
|
|
249
|
+
queryString += `${QueryBuilder.DEFAULT_DOUBLE_PRECISION})=`;
|
|
250
|
+
queryString += `${Number(joinClass.properties[0].value).toFixed(QueryBuilder.DEFAULT_DOUBLE_PRECISION)}`;
|
|
251
|
+
}
|
|
252
|
+
else {
|
|
253
|
+
queryString += ` ON ${joinClassName}.${joinClass.properties[0].name}=${joinClass.properties[0].value}`;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
// when base is regular property, link base to first joined relational property
|
|
258
|
+
if (!baseClass.isRelational && i === 1) {
|
|
259
|
+
queryString += ` AND ${joinIdName} = ${baseIdName}`;
|
|
260
|
+
}
|
|
261
|
+
for (const property of joinClass.properties) {
|
|
262
|
+
if (property.needsQuote) {
|
|
263
|
+
queryString += ` AND ${joinClassName}.${property.name}='${property.value}'`;
|
|
264
|
+
}
|
|
265
|
+
else {
|
|
266
|
+
if (this._isFloat(property.value)) {
|
|
267
|
+
queryString += ` AND ROUND(${joinClassName}.${property.name}, `;
|
|
268
|
+
queryString += `${QueryBuilder.DEFAULT_DOUBLE_PRECISION})=`;
|
|
269
|
+
queryString += `${Number(property.value).toFixed(QueryBuilder.DEFAULT_DOUBLE_PRECISION)}`;
|
|
270
|
+
}
|
|
271
|
+
else {
|
|
272
|
+
queryString += ` AND ${joinClassName}.${property.name}=${property.value}`;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
else {
|
|
278
|
+
queryString += ` JOIN ${joinClassName} ON ${joinIdName} = ${baseIdName}`;
|
|
279
|
+
for (const property of joinClass.properties) {
|
|
280
|
+
if (property.needsQuote) {
|
|
281
|
+
queryString += ` AND ${joinClassName}.${property.name}='${property.value}'`;
|
|
282
|
+
}
|
|
283
|
+
else {
|
|
284
|
+
if (this._isFloat(property.value)) {
|
|
285
|
+
queryString += ` AND ROUND(${joinClassName}.${property.name}, `;
|
|
286
|
+
queryString += `${QueryBuilder.DEFAULT_DOUBLE_PRECISION})=`;
|
|
287
|
+
queryString += `${Number(property.value).toFixed(QueryBuilder.DEFAULT_DOUBLE_PRECISION)}`;
|
|
288
|
+
}
|
|
289
|
+
else {
|
|
290
|
+
queryString += ` AND ${joinClassName}.${property.name}=${property.value}`;
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
const properties = baseClass.properties;
|
|
298
|
+
if (properties.length > 0) {
|
|
299
|
+
if (properties[0].needsQuote) {
|
|
300
|
+
queryString += ` WHERE ${baseClassName}.${properties[0].name}='${properties[0].value}'`;
|
|
301
|
+
}
|
|
302
|
+
else {
|
|
303
|
+
if (this._isFloat(properties[0].value)) {
|
|
304
|
+
queryString += ` WHERE ROUND(${baseClassName}.${properties[0].name}, `;
|
|
305
|
+
queryString += `${QueryBuilder.DEFAULT_DOUBLE_PRECISION})=`;
|
|
306
|
+
queryString += `${Number(properties[0].value).toFixed(QueryBuilder.DEFAULT_DOUBLE_PRECISION)}`;
|
|
307
|
+
}
|
|
308
|
+
else {
|
|
309
|
+
queryString += ` WHERE ${baseClassName}.${properties[0].name}=${properties[0].value}`;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
if (properties.length > 1) {
|
|
313
|
+
for (let i = 1; i < properties.length; i++) {
|
|
314
|
+
if (properties[i].needsQuote) {
|
|
315
|
+
queryString += ` AND ${baseClassName}.${properties[i].name}='${properties[i].value}'`;
|
|
316
|
+
}
|
|
317
|
+
else {
|
|
318
|
+
if (this._isFloat(properties[i].value)) {
|
|
319
|
+
queryString += ` AND ROUND(${baseClassName}.${properties[i].name}, `;
|
|
320
|
+
queryString += `${QueryBuilder.DEFAULT_DOUBLE_PRECISION})=`;
|
|
321
|
+
queryString += `${Number(properties[i].value).toFixed(QueryBuilder.DEFAULT_DOUBLE_PRECISION)}`;
|
|
322
|
+
}
|
|
323
|
+
else {
|
|
324
|
+
queryString += ` AND ${baseClassName}.${properties[i].name}=${properties[i].value}`;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
// console.log(queryString);
|
|
331
|
+
// console.log(this.query);
|
|
332
|
+
return queryString;
|
|
333
|
+
}
|
|
334
|
+
_isFloat(n) {
|
|
335
|
+
return Number(n) === n && n % 1 !== 0;
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
QueryBuilder.MULTI_ASPECT_PRIMARY_CLASS = "BisCore:ElementOwnsMultiAspects";
|
|
339
|
+
QueryBuilder.UNIQUE_ASPECT_PRIMARY_CLASS = "BisCore:ElementOwnsUniqueAspect";
|
|
340
|
+
QueryBuilder.DEFAULT_DOUBLE_PRECISION = 4;
|
|
341
|
+
//# sourceMappingURL=QueryBuilder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QueryBuilder.js","sourceRoot":"","sources":["../../../../src/widget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K,EAAE,CAAC;yBACrF;qBACF;iBACF;aACF;SACF;QAED,4BAA4B;QAC5B,2BAA2B;QAC3B,OAAO,WAAW,CAAC;IACrB,CAAC;IAEO,QAAQ,CAAC,CAAU;QACzB,OAAO,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACxC,CAAC;;AAndsB,uCAA0B,GAC/C,iCAAiC,CAAC;AACb,wCAA2B,GAChD,iCAAiC,CAAC;AACb,qCAAwB,GAAG,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 { PresentationPropertyDataProvider } from \"@itwin/presentation-components\";\nimport type { InstanceKey, PropertiesField } from \"@itwin/presentation-common\";\nimport type {\n Primitives,\n PropertyRecord} from \"@itwin/appui-abstract\";\nimport {\n PropertyValueFormat,\n} from \"@itwin/appui-abstract\";\nimport \"core-js/features/string/virtual\";\n\nexport interface Query {\n classes: QueryClass[];\n}\n\nexport interface QueryClass {\n // schemaName.className\n className: string;\n properties: QueryProperty[];\n isAspect: boolean;\n isRelational?: boolean;\n}\n\nexport interface QueryProperty {\n name: string;\n value: Primitives.Value;\n needsQuote: boolean;\n}\n\n/* This class is to build adaptive and dynamic query for find similar property selections */\nexport class QueryBuilder {\n public static readonly MULTI_ASPECT_PRIMARY_CLASS =\n \"BisCore:ElementOwnsMultiAspects\";\n public static readonly UNIQUE_ASPECT_PRIMARY_CLASS =\n \"BisCore:ElementOwnsUniqueAspect\";\n public static readonly DEFAULT_DOUBLE_PRECISION = 4;\n\n public dataProvider: PresentationPropertyDataProvider | undefined;\n public query: Query | undefined;\n\n /**\n *\n */\n constructor(provider: PresentationPropertyDataProvider | undefined) {\n this.dataProvider = provider;\n }\n\n public async addProperty(prop: PropertyRecord) {\n // TODO: only handle primitive properties now\n if (\n prop.value?.valueFormat !== PropertyValueFormat.Primitive ||\n prop.value.value === undefined\n ) {\n return;\n }\n\n function replaceAll(str: string, match: string, replacement: string) {\n return str.split(match).join(replacement);\n }\n // if property value has single quote, escape\n if (\n (typeof prop.value.value === \"string\" ||\n prop.value.value instanceof String) &&\n String(prop.value.value).indexOf(\"'\") >= 0\n ) {\n prop.value.value = replaceAll(prop.value.value.toString(), \"'\", \"''\");\n }\n\n const propertyField = (await this.dataProvider?.getFieldByPropertyRecord(\n prop,\n )) as PropertiesField;\n if (propertyField === undefined) {\n return;\n }\n\n // get the special cases\n const isNavigation: boolean =\n prop.property.typename.toLowerCase() === \"navigation\";\n\n const isAspect: boolean =\n propertyField.parent?.pathToPrimaryClass.find(\n (a) =>\n a.relationshipInfo?.name ===\n QueryBuilder.UNIQUE_ASPECT_PRIMARY_CLASS ||\n a.relationshipInfo?.name === QueryBuilder.MULTI_ASPECT_PRIMARY_CLASS,\n ) !== undefined;\n\n const className =\n propertyField.properties[0].property.classInfo.name.replace(\":\", \".\");\n const propertyName = isNavigation\n ? `${propertyField.properties[0].property.name}.id`\n : propertyField.properties[0].property.name;\n const propertyValue = isNavigation\n ? (prop.value.value as InstanceKey).id\n : prop.value.value;\n\n // console.log(prop);\n // console.log(propertyField);\n\n if (\n !isAspect &&\n propertyField.parent?.pathToPrimaryClass &&\n propertyField.parent?.pathToPrimaryClass.length > 0\n ) {\n this.addRelatedProperty(\n propertyField,\n propertyName,\n propertyValue,\n isAspect,\n );\n } else {\n this.addPropertyToQuery(\n className,\n propertyName,\n propertyValue,\n isAspect,\n this._needsQuote(propertyField),\n false,\n );\n }\n }\n\n private _needsQuote(propertyField: PropertiesField): boolean {\n // list of property types that need quote around property value\n if (propertyField.type.typeName.toLowerCase() === \"string\") {\n return true;\n }\n if (propertyField.type.typeName.toLowerCase() === \"uri\") {\n return true;\n }\n return false;\n }\n\n public addRelatedProperty(\n propertyField: PropertiesField,\n propertyName: string,\n propertyValue: Primitives.Value,\n isAspect: boolean,\n ) {\n const paths = [...(propertyField.parent?.pathToPrimaryClass ?? [])];\n paths.reverse().forEach((path) => {\n const sourceClassName = path.sourceClassInfo?.name.replace(\":\", \".\");\n const targetClassName = path.targetClassInfo?.name.replace(\":\", \".\");\n const relClassName = path.relationshipInfo?.name.replace(\":\", \".\");\n if (!path.isForwardRelationship) {\n this.addPropertyToQuery(\n targetClassName,\n `ECInstanceId`,\n `${relClassName}.SourceECInstanceId`,\n isAspect,\n false,\n true,\n );\n this.addPropertyToQuery(\n relClassName,\n `TargetECInstanceId`,\n `${sourceClassName}.ECInstanceId`,\n isAspect,\n false,\n true,\n );\n if (\n path.sourceClassInfo?.name ===\n propertyField.parent?.contentClassInfo.name\n ) {\n this.addPropertyToQuery(\n sourceClassName,\n propertyName,\n propertyValue,\n isAspect,\n this._needsQuote(propertyField),\n true,\n );\n } else {\n this.addPropertyToQuery(\n sourceClassName,\n `ECInstanceId`,\n `${relClassName}.TargetECInstanceId`,\n isAspect,\n false,\n true,\n );\n }\n } else {\n this.addPropertyToQuery(\n targetClassName,\n `ECInstanceId`,\n `${relClassName}.TargetECInstanceId`,\n isAspect,\n false,\n true,\n );\n this.addPropertyToQuery(\n relClassName,\n `SourceECInstanceId`,\n `${sourceClassName}.ECInstanceId`,\n isAspect,\n false,\n true,\n );\n if (\n path.sourceClassInfo?.name ===\n propertyField.parent?.contentClassInfo.name\n ) {\n this.addPropertyToQuery(\n sourceClassName,\n propertyName,\n propertyValue,\n isAspect,\n this._needsQuote(propertyField),\n true,\n );\n } else {\n this.addPropertyToQuery(\n sourceClassName,\n `ECInstanceId`,\n `${relClassName}.SourceECInstanceId`,\n isAspect,\n false,\n true,\n );\n }\n }\n });\n }\n\n public addPropertyToQuery(\n className: string,\n propertyName: string,\n propertyValue: Primitives.Value,\n isAspect: boolean,\n needsQuote: boolean,\n isRelational?: boolean,\n ) {\n if (this.query === undefined || this.query.classes.length === 0) {\n this.query = {\n classes: [\n {\n className,\n isAspect,\n isRelational,\n properties: [\n {\n name: propertyName,\n value: propertyValue,\n needsQuote,\n },\n ],\n },\n ],\n };\n return;\n }\n\n const foundClass = this.query.classes.find(\n (c) => c.className === className,\n );\n if (foundClass) {\n foundClass.isRelational = isRelational;\n if (!foundClass.properties.find((x) => x.name === propertyName)) {\n foundClass.properties.push({\n name: propertyName,\n value: propertyValue,\n needsQuote,\n });\n }\n } else {\n this.query.classes.push({\n className,\n isRelational,\n properties: [\n {\n name: propertyName,\n value: propertyValue,\n needsQuote,\n },\n ],\n isAspect,\n });\n }\n }\n\n public async removeProperty(prop: PropertyRecord) {\n if (this.query === undefined || this.query.classes.length === 0) {\n return;\n }\n\n const propertyField = (await this.dataProvider?.getFieldByPropertyRecord(\n prop,\n )) as PropertiesField;\n if (propertyField === undefined) {\n return;\n }\n\n const isAspect: boolean =\n propertyField.parent?.pathToPrimaryClass.find(\n (a) =>\n a.relationshipInfo?.name ===\n QueryBuilder.UNIQUE_ASPECT_PRIMARY_CLASS ||\n a.relationshipInfo?.name === QueryBuilder.MULTI_ASPECT_PRIMARY_CLASS,\n ) !== undefined;\n\n const isNavigation: boolean =\n prop.property.typename.toLowerCase() === \"navigation\";\n\n const propertyName = isNavigation\n ? `${propertyField.properties[0].property.name}.id`\n : propertyField.properties[0].property.name;\n const className =\n propertyField.properties[0].property.classInfo.name.replace(\":\", \".\");\n\n if (\n !isAspect &&\n propertyField.parent?.pathToPrimaryClass &&\n propertyField.parent?.pathToPrimaryClass.length > 0\n ) {\n this.removeRelatedProperty(propertyField, propertyName);\n } else {\n this.removePropertyFromQuery(className, propertyName);\n }\n }\n\n public removeRelatedProperty(\n propertyField: PropertiesField,\n propertyName: string,\n ) {\n const paths = [...(propertyField.parent?.pathToPrimaryClass ?? [])];\n paths.reverse().forEach((path) => {\n const sourceClassName = path.sourceClassInfo?.name.replace(\":\", \".\");\n const targetClassName = path.targetClassInfo?.name.replace(\":\", \".\");\n const relClassName = path.relationshipInfo?.name.replace(\":\", \".\");\n if (!path.isForwardRelationship) {\n this.removePropertyFromQuery(targetClassName, `ECInstanceId`);\n this.removePropertyFromQuery(relClassName, `TargetECInstanceId`);\n if (\n path.sourceClassInfo?.name ===\n propertyField.parent?.contentClassInfo.name\n ) {\n this.removePropertyFromQuery(sourceClassName, propertyName);\n } else {\n this.removePropertyFromQuery(sourceClassName, `ECInstanceId`);\n }\n } else {\n this.removePropertyFromQuery(targetClassName, `ECInstanceId`);\n this.removePropertyFromQuery(relClassName, `SourceECInstanceId`);\n if (\n path.sourceClassInfo?.name ===\n propertyField.parent?.contentClassInfo.name\n ) {\n this.removePropertyFromQuery(sourceClassName, propertyName);\n } else {\n this.removePropertyFromQuery(sourceClassName, `ECInstanceId`);\n }\n }\n });\n }\n\n public removePropertyFromQuery(className: string, propertyName: string) {\n const foundClass = this.query?.classes.find(\n (c) => c.className === className,\n );\n if (foundClass) {\n const foundPropertyIndex = foundClass.properties.findIndex(\n (p) => p.name === propertyName,\n );\n if (foundPropertyIndex > -1) {\n foundClass.properties.splice(foundPropertyIndex, 1);\n }\n if (foundClass.properties.length === 0) {\n // remove the entire class if all properties are removed\n const foundClassIndex =\n this.query?.classes.findIndex((c) => c.className === className) ?? -1;\n if (foundClassIndex > -1) {\n this.query?.classes.splice(foundClassIndex, 1);\n }\n }\n }\n }\n\n public buildQueryString() {\n if (this.query === undefined || this.query.classes.length === 0) {\n return \"\";\n }\n\n const baseClass = this.query.classes[0];\n const baseClassName = baseClass.className;\n const baseIdName = baseClass.isAspect\n ? `${baseClassName}.Element.id`\n : `${baseClassName}.ECInstanceId`;\n\n let queryString = `SELECT ${baseIdName} FROM ${baseClassName}`;\n\n if (this.query.classes.length > 1) {\n for (let i = 1; i < this.query.classes.length; i++) {\n const joinClass = this.query.classes[i];\n const joinClassName = joinClass.className;\n const joinIdName = joinClass.isAspect\n ? `${joinClassName}.Element.id`\n : `${joinClassName}.ECInstanceId`;\n\n if (joinClass.isRelational) {\n queryString += ` JOIN ${joinClassName}`;\n if (joinClass.properties.length > 0) {\n if (joinClass.properties[0].needsQuote) {\n queryString += ` ON ${joinClassName}.${joinClass.properties[0].name}='${joinClass.properties[0].value}'`;\n } else {\n if (this._isFloat(joinClass.properties[0].value)) {\n queryString += ` ON ROUND(${joinClassName}.${joinClass.properties[0].name}, `;\n queryString += `${QueryBuilder.DEFAULT_DOUBLE_PRECISION})=`;\n queryString += `${Number(joinClass.properties[0].value).toFixed(\n QueryBuilder.DEFAULT_DOUBLE_PRECISION,\n )}`;\n } else {\n queryString += ` ON ${joinClassName}.${joinClass.properties[0].name}=${joinClass.properties[0].value}`;\n }\n }\n }\n // when base is regular property, link base to first joined relational property\n if (!baseClass.isRelational && i === 1) {\n queryString += ` AND ${joinIdName} = ${baseIdName}`;\n }\n for (const property of joinClass.properties) {\n if (property.needsQuote) {\n queryString += ` AND ${joinClassName}.${property.name}='${property.value}'`;\n } else {\n if (this._isFloat(property.value)) {\n queryString += ` AND ROUND(${joinClassName}.${property.name}, `;\n queryString += `${QueryBuilder.DEFAULT_DOUBLE_PRECISION})=`;\n queryString += `${Number(property.value).toFixed(\n QueryBuilder.DEFAULT_DOUBLE_PRECISION,\n )}`;\n } else {\n queryString += ` AND ${joinClassName}.${property.name}=${property.value}`;\n }\n }\n }\n } else {\n queryString += ` JOIN ${joinClassName} ON ${joinIdName} = ${baseIdName}`;\n for (const property of joinClass.properties) {\n if (property.needsQuote) {\n queryString += ` AND ${joinClassName}.${property.name}='${property.value}'`;\n } else {\n if (this._isFloat(property.value)) {\n queryString += ` AND ROUND(${joinClassName}.${property.name}, `;\n queryString += `${QueryBuilder.DEFAULT_DOUBLE_PRECISION})=`;\n queryString += `${Number(property.value).toFixed(\n QueryBuilder.DEFAULT_DOUBLE_PRECISION,\n )}`;\n } else {\n queryString += ` AND ${joinClassName}.${property.name}=${property.value}`;\n }\n }\n }\n }\n }\n }\n\n const properties = baseClass.properties;\n if (properties.length > 0) {\n if (properties[0].needsQuote) {\n queryString += ` WHERE ${baseClassName}.${properties[0].name}='${properties[0].value}'`;\n } else {\n if (this._isFloat(properties[0].value)) {\n queryString += ` WHERE ROUND(${baseClassName}.${properties[0].name}, `;\n queryString += `${QueryBuilder.DEFAULT_DOUBLE_PRECISION})=`;\n queryString += `${Number(properties[0].value).toFixed(\n QueryBuilder.DEFAULT_DOUBLE_PRECISION,\n )}`;\n } else {\n queryString += ` WHERE ${baseClassName}.${properties[0].name}=${properties[0].value}`;\n }\n }\n if (properties.length > 1) {\n for (let i = 1; i < properties.length; i++) {\n if (properties[i].needsQuote) {\n queryString += ` AND ${baseClassName}.${properties[i].name}='${properties[i].value}'`;\n } else {\n if (this._isFloat(properties[i].value)) {\n queryString += ` AND ROUND(${baseClassName}.${properties[i].name}, `;\n queryString += `${QueryBuilder.DEFAULT_DOUBLE_PRECISION})=`;\n queryString += `${Number(properties[i].value).toFixed(\n QueryBuilder.DEFAULT_DOUBLE_PRECISION,\n )}`;\n } else {\n queryString += ` AND ${baseClassName}.${properties[i].name}=${properties[i].value}`;\n }\n }\n }\n }\n }\n\n // console.log(queryString);\n // console.log(this.query);\n return queryString;\n }\n\n private _isFloat(n: unknown): boolean {\n return Number(n) === n && n % 1 !== 0;\n }\n}\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { IModelFull } from "@itwin/imodel-browser-react";
|
|
3
|
+
import "./SelectIModel.scss";
|
|
4
|
+
interface SelectIModelProps {
|
|
5
|
+
projectId: string;
|
|
6
|
+
onSelect: (project: IModelFull) => void;
|
|
7
|
+
onCancel: () => void;
|
|
8
|
+
backFn: () => void;
|
|
9
|
+
}
|
|
10
|
+
declare const SelectIModel: ({ projectId, onSelect, onCancel, backFn, }: SelectIModelProps) => JSX.Element;
|
|
11
|
+
export default SelectIModel;
|
|
12
|
+
//# sourceMappingURL=SelectIModel.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { IModelGrid, } from "@itwin/imodel-browser-react";
|
|
2
|
+
import { Button } from "@itwin/itwinui-react";
|
|
3
|
+
import React, { useMemo } from "react";
|
|
4
|
+
import { getUrlPrefix } from "../../api/reportingClient";
|
|
5
|
+
import useFetchAccessToken from "../hooks/useFetchAccessToken";
|
|
6
|
+
import "./SelectIModel.scss";
|
|
7
|
+
const SelectIModel = ({ projectId, onSelect, onCancel, backFn, }) => {
|
|
8
|
+
const accessToken = useFetchAccessToken();
|
|
9
|
+
const apiOverrides = useMemo(() => ({ serverEnvironmentPrefix: getUrlPrefix() }), []);
|
|
10
|
+
return (React.createElement("div", { className: 'imodel-grid-container' },
|
|
11
|
+
React.createElement("div", { className: 'imodel-grid' },
|
|
12
|
+
React.createElement(IModelGrid, { projectId: projectId, onThumbnailClick: onSelect, accessToken: accessToken, apiOverrides: apiOverrides })),
|
|
13
|
+
React.createElement("div", { className: 'import-action-panel' },
|
|
14
|
+
React.createElement(Button, { onClick: backFn }, "Back"),
|
|
15
|
+
React.createElement(Button, { onClick: onCancel }, "Cancel"))));
|
|
16
|
+
};
|
|
17
|
+
export default SelectIModel;
|
|
18
|
+
//# sourceMappingURL=SelectIModel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectIModel.js","sourceRoot":"","sources":["../../../../src/widget/components/SelectIModel.tsx"],"names":[],"mappings":"AAQA,OAAO,EACL,UAAU,GACX,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,mBAAmB,MAAM,8BAA8B,CAAC;AAC/D,OAAO,qBAAqB,CAAC;AAQ7B,MAAM,YAAY,GAAG,CAAC,EACpB,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,MAAM,GACY,EAAE,EAAE;IACtB,MAAM,WAAW,GAAG,mBAAmB,EAAE,CAAC;IAE1C,MAAM,YAAY,GAAG,OAAO,CAC1B,GAAG,EAAE,CAAC,CAAC,EAAE,uBAAuB,EAAE,YAAY,EAAE,EAAE,CAAC,EACnD,EAAE,CACH,CAAC;IAEF,OAAO,CACL,6BAAK,SAAS,EAAC,uBAAuB;QACpC,6BAAK,SAAS,EAAC,aAAa;YAC1B,oBAAC,UAAU,IACT,SAAS,EAAE,SAAS,EACpB,gBAAgB,EAAE,QAAQ,EAC1B,WAAW,EAAE,WAAW,EACxB,YAAY,EAAE,YAAY,GAC1B,CACE;QACN,6BAAK,SAAS,EAAC,qBAAqB;YAClC,oBAAC,MAAM,IAAC,OAAO,EAAE,MAAM,WAAe;YACtC,oBAAC,MAAM,IAAC,OAAO,EAAE,QAAQ,aAAiB,CACtC,CACF,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,YAAY,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 {\n ApiOverrides,\n IModelFull,\n} from \"@itwin/imodel-browser-react\";\nimport {\n IModelGrid,\n} from \"@itwin/imodel-browser-react\";\nimport { Button } from \"@itwin/itwinui-react\";\nimport React, { useMemo } from \"react\";\nimport { getUrlPrefix } from \"../../api/reportingClient\";\nimport useFetchAccessToken from \"../hooks/useFetchAccessToken\";\nimport \"./SelectIModel.scss\";\n\ninterface SelectIModelProps {\n projectId: string;\n onSelect: (project: IModelFull) => void;\n onCancel: () => void;\n backFn: () => void;\n}\nconst SelectIModel = ({\n projectId,\n onSelect,\n onCancel,\n backFn,\n}: SelectIModelProps) => {\n const accessToken = useFetchAccessToken();\n\n const apiOverrides = useMemo<ApiOverrides<IModelFull[]>>(\n () => ({ serverEnvironmentPrefix: getUrlPrefix() }),\n []\n );\n\n return (\n <div className='imodel-grid-container'>\n <div className='imodel-grid'>\n <IModelGrid\n projectId={projectId}\n onThumbnailClick={onSelect}\n accessToken={accessToken}\n apiOverrides={apiOverrides}\n />\n </div>\n <div className='import-action-panel'>\n <Button onClick={backFn}>Back</Button>\n <Button onClick={onCancel}>Cancel</Button>\n </div>\n </div>\n );\n};\n\nexport default SelectIModel;\n"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
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
|
+
.imodel-grid-container {
|
|
8
|
+
display: flex;
|
|
9
|
+
flex-direction: column;
|
|
10
|
+
height: 66vh;
|
|
11
|
+
|
|
12
|
+
.imodel-grid {
|
|
13
|
+
overflow: auto;
|
|
14
|
+
flex-grow: 1;
|
|
15
|
+
|
|
16
|
+
.search-input {
|
|
17
|
+
margin-left: auto;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
.select-mapping-container {
|
|
8
|
+
display: flex;
|
|
9
|
+
flex-direction: column;
|
|
10
|
+
height: 66vh;
|
|
11
|
+
gap: $iui-baseline * 2;
|
|
12
|
+
|
|
13
|
+
.select-mapping-table {
|
|
14
|
+
flex-grow: 1;
|
|
15
|
+
overflow: auto;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { Mapping } from "./Mapping";
|
|
3
|
+
import "./SelectMapping.scss";
|
|
4
|
+
interface SelectMappingsProps {
|
|
5
|
+
iModelId: string;
|
|
6
|
+
onSelect: (selectedMappings: Mapping[]) => void;
|
|
7
|
+
onCancel: () => void;
|
|
8
|
+
backFn: () => void;
|
|
9
|
+
}
|
|
10
|
+
declare const SelectMappings: ({ iModelId, onSelect, onCancel, backFn, }: SelectMappingsProps) => JSX.Element;
|
|
11
|
+
export default SelectMappings;
|
|
12
|
+
//# sourceMappingURL=SelectMappings.d.ts.map
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { Button, Table, tableFilters, TablePaginator, } from "@itwin/itwinui-react";
|
|
2
|
+
import React, { useCallback, useEffect, useMemo, useState } from "react";
|
|
3
|
+
import { reportingClientApi } from "../../api/reportingClient";
|
|
4
|
+
import "./SelectMapping.scss";
|
|
5
|
+
const fetchMappings = async (setMappings, iModelId, setIsLoading) => {
|
|
6
|
+
try {
|
|
7
|
+
setIsLoading(true);
|
|
8
|
+
const mappings = await reportingClientApi.getMappings(iModelId);
|
|
9
|
+
setMappings(mappings);
|
|
10
|
+
}
|
|
11
|
+
catch {
|
|
12
|
+
}
|
|
13
|
+
finally {
|
|
14
|
+
setIsLoading(false);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
const useFetchMappings = (iModelId, setIsLoading) => {
|
|
18
|
+
const [mappings, setMappings] = useState([]);
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
void fetchMappings(setMappings, iModelId, setIsLoading);
|
|
21
|
+
}, [iModelId, setIsLoading]);
|
|
22
|
+
return [mappings, setMappings];
|
|
23
|
+
};
|
|
24
|
+
const SelectMappings = ({ iModelId, onSelect, onCancel, backFn, }) => {
|
|
25
|
+
const [isLoading, setIsLoading] = useState(true);
|
|
26
|
+
const [mappings] = useFetchMappings(iModelId, setIsLoading);
|
|
27
|
+
const [selectedMappings, setSelectedMappings] = useState([]);
|
|
28
|
+
const mappingsColumns = useMemo(() => [
|
|
29
|
+
{
|
|
30
|
+
Header: "Table",
|
|
31
|
+
columns: [
|
|
32
|
+
{
|
|
33
|
+
id: "mappingName",
|
|
34
|
+
Header: "Mapping Name",
|
|
35
|
+
accessor: "mappingName",
|
|
36
|
+
Filter: tableFilters.TextFilter(),
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
id: "description",
|
|
40
|
+
Header: "Description",
|
|
41
|
+
accessor: "description",
|
|
42
|
+
Filter: tableFilters.TextFilter(),
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
},
|
|
46
|
+
], []);
|
|
47
|
+
const pageSizeList = useMemo(() => [10, 25, 50], []);
|
|
48
|
+
const paginator = useCallback((props) => (React.createElement(TablePaginator, { ...props, pageSizeList: pageSizeList })), [pageSizeList]);
|
|
49
|
+
return (React.createElement("div", { className: 'select-mapping-container' },
|
|
50
|
+
React.createElement(Table, { data: mappings, columns: mappingsColumns, className: 'select-mapping-table', emptyTableContent: 'No Mappings available.', isSortable: true, isSelectable: true, isLoading: isLoading, onSelect: (selectData) => {
|
|
51
|
+
selectData && setSelectedMappings(selectData);
|
|
52
|
+
}, paginatorRenderer: paginator }),
|
|
53
|
+
React.createElement("div", { className: 'import-action-panel' },
|
|
54
|
+
React.createElement(Button, { onClick: backFn }, "Back"),
|
|
55
|
+
React.createElement(Button, { styleType: 'high-visibility', onClick: () => {
|
|
56
|
+
onSelect(selectedMappings);
|
|
57
|
+
}, disabled: isLoading || selectedMappings.length === 0 }, "Next"),
|
|
58
|
+
React.createElement(Button, { onClick: onCancel }, "Cancel"))));
|
|
59
|
+
};
|
|
60
|
+
export default SelectMappings;
|
|
61
|
+
//# sourceMappingURL=SelectMappings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectMappings.js","sourceRoot":"","sources":["../../../../src/widget/components/SelectMappings.tsx"],"names":[],"mappings":"AAMA,OAAO,EACL,MAAM,EACN,KAAK,EACL,YAAY,EACZ,cAAc,GACf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,EA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EACD,QAAQ,EAAE,SAAS,IAAI,gBAAgB,CAAC,MAAM,KAAK,CAAC,WAG7C;YACT,oBAAC,MAAM,IAAC,OAAO,EAAE,QAAQ,aAAiB,CACtC,CACF,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,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 {\n TablePaginatorRendererProps} from \"@itwin/itwinui-react\";\nimport {\n Button,\n Table,\n tableFilters,\n TablePaginator,\n} from \"@itwin/itwinui-react\";\nimport React, { useCallback, useEffect, useMemo, useState } from \"react\";\nimport type { MappingReportingAPI } from \"../../api/generated/api\";\nimport { reportingClientApi } from \"../../api/reportingClient\";\nimport type { Mapping } from \"./Mapping\";\nimport \"./SelectMapping.scss\";\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\ninterface SelectMappingsProps {\n iModelId: string;\n onSelect: (selectedMappings: Mapping[]) => void;\n onCancel: () => void;\n backFn: () => void;\n}\n\nconst SelectMappings = ({\n iModelId,\n onSelect,\n onCancel,\n backFn,\n}: SelectMappingsProps) => {\n const [isLoading, setIsLoading] = useState<boolean>(true);\n const [mappings] = useFetchMappings(iModelId, setIsLoading);\n const [selectedMappings, setSelectedMappings] = useState<Mapping[]>([]);\n\n const mappingsColumns = useMemo(\n () => [\n {\n Header: \"Table\",\n columns: [\n {\n id: \"mappingName\",\n Header: \"Mapping Name\",\n accessor: \"mappingName\",\n Filter: tableFilters.TextFilter(),\n },\n {\n id: \"description\",\n Header: \"Description\",\n accessor: \"description\",\n Filter: tableFilters.TextFilter(),\n },\n ],\n },\n ],\n []\n );\n\n const pageSizeList = useMemo(() => [10, 25, 50], []);\n const paginator = useCallback(\n (props: TablePaginatorRendererProps) => (\n <TablePaginator {...props} pageSizeList={pageSizeList} />\n ),\n [pageSizeList]\n );\n\n return (\n <div className='select-mapping-container'>\n <Table<Mapping>\n data={mappings}\n columns={mappingsColumns}\n className='select-mapping-table'\n emptyTableContent='No Mappings available.'\n isSortable\n isSelectable\n isLoading={isLoading}\n onSelect={(selectData: Mapping[] | undefined) => {\n selectData && setSelectedMappings(selectData);\n }}\n paginatorRenderer={paginator}\n />\n <div className='import-action-panel'>\n <Button onClick={backFn}>Back</Button>\n <Button\n styleType='high-visibility'\n onClick={() => {\n onSelect(selectedMappings);\n }}\n disabled={isLoading || selectedMappings.length === 0}\n >\n Next\n </Button>\n <Button onClick={onCancel}>Cancel</Button>\n </div>\n </div>\n );\n};\n\nexport default SelectMappings;\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { ProjectFull } from "@itwin/imodel-browser-react";
|
|
3
|
+
import "./SelectProject.scss";
|
|
4
|
+
interface SelectProjectProps {
|
|
5
|
+
onSelect: (project: ProjectFull) => void;
|
|
6
|
+
onCancel: () => void;
|
|
7
|
+
}
|
|
8
|
+
declare const SelectProject: ({ onSelect, onCancel }: SelectProjectProps) => JSX.Element;
|
|
9
|
+
export default SelectProject;
|
|
10
|
+
//# sourceMappingURL=SelectProject.d.ts.map
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { ProjectGrid, } from "@itwin/imodel-browser-react";
|
|
2
|
+
import { SvgCalendar, SvgList, SvgSearch, SvgStarHollow, } from "@itwin/itwinui-icons-react";
|
|
3
|
+
import { Button, HorizontalTabs, IconButton, LabeledInput, Tab, } from "@itwin/itwinui-react";
|
|
4
|
+
import React, { useCallback, useMemo, useState } from "react";
|
|
5
|
+
import { getUrlPrefix } from "../../api/reportingClient";
|
|
6
|
+
import useFetchAccessToken from "../hooks/useFetchAccessToken";
|
|
7
|
+
import "./SelectProject.scss";
|
|
8
|
+
const tabsWithIcons = [
|
|
9
|
+
React.createElement(Tab, { key: 'favorite', label: 'Favorite projects', startIcon: React.createElement(SvgStarHollow, null) }),
|
|
10
|
+
React.createElement(Tab, { key: 'recents', label: 'Recent projects', startIcon: React.createElement(SvgCalendar, null) }),
|
|
11
|
+
React.createElement(Tab, { key: 'all', label: 'My projects', startIcon: React.createElement(SvgList, null) }),
|
|
12
|
+
];
|
|
13
|
+
const SelectProject = ({ onSelect, onCancel }) => {
|
|
14
|
+
const accessToken = useFetchAccessToken();
|
|
15
|
+
const [projectType, setProjectType] = useState(0);
|
|
16
|
+
const [searchInput, setSearchInput] = useState("");
|
|
17
|
+
const [activeSearchInput, setActiveSearchInput] = useState("");
|
|
18
|
+
const startSearch = useCallback(() => {
|
|
19
|
+
setActiveSearchInput(searchInput);
|
|
20
|
+
}, [searchInput]);
|
|
21
|
+
const apiOverrides = useMemo(() => ({ serverEnvironmentPrefix: getUrlPrefix() }), []);
|
|
22
|
+
return (React.createElement("div", { className: 'select-project-grid-container' },
|
|
23
|
+
React.createElement(HorizontalTabs, { labels: tabsWithIcons, onTabSelected: setProjectType, activeIndex: projectType, type: "borderless", contentClassName: 'grid-holding-tab' },
|
|
24
|
+
React.createElement(LabeledInput, { displayStyle: 'inline', iconDisplayStyle: 'inline', className: 'search-input', label: 'Search', value: searchInput, onChange: (event) => {
|
|
25
|
+
const { target: { value }, } = event;
|
|
26
|
+
setSearchInput(value);
|
|
27
|
+
}, onKeyDown: (event) => {
|
|
28
|
+
if (event.key === "Enter") {
|
|
29
|
+
startSearch();
|
|
30
|
+
}
|
|
31
|
+
if (event.key === "Escape") {
|
|
32
|
+
setSearchInput("");
|
|
33
|
+
setActiveSearchInput("");
|
|
34
|
+
}
|
|
35
|
+
}, svgIcon: React.createElement(IconButton, { onClick: () => startSearch(), styleType: 'borderless' },
|
|
36
|
+
React.createElement(SvgSearch, null)) }),
|
|
37
|
+
React.createElement("div", { className: 'project-grid' },
|
|
38
|
+
React.createElement(ProjectGrid, { onThumbnailClick: onSelect, accessToken: accessToken, apiOverrides: apiOverrides, filterOptions: activeSearchInput, requestType: projectType === 0
|
|
39
|
+
? "favorites"
|
|
40
|
+
: projectType === 1
|
|
41
|
+
? "recents"
|
|
42
|
+
: "" })),
|
|
43
|
+
React.createElement("div", { className: 'select-project-action-panel' },
|
|
44
|
+
React.createElement(Button, { onClick: onCancel }, "Cancel")))));
|
|
45
|
+
};
|
|
46
|
+
export default SelectProject;
|
|
47
|
+
//# sourceMappingURL=SelectProject.js.map
|