@itwin/grouping-mapping-widget 0.9.2 → 0.10.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/lib/cjs/grouping-mapping-widget.d.ts +11 -5
- package/lib/cjs/grouping-mapping-widget.js +21 -3
- package/lib/cjs/grouping-mapping-widget.js.map +1 -1
- package/lib/cjs/test/GroupingMappingCustomUI.test.js +49 -86
- package/lib/cjs/test/GroupingMappingCustomUI.test.js.map +1 -1
- package/lib/cjs/test/test-utils.d.ts +0 -6
- package/lib/cjs/test/test-utils.js +8 -24
- package/lib/cjs/test/test-utils.js.map +1 -1
- package/lib/cjs/widget/components/ActionPanel.d.ts +1 -1
- package/lib/cjs/widget/components/ActionPanel.js +1 -1
- package/lib/cjs/widget/components/ActionPanel.js.map +1 -1
- package/lib/cjs/widget/components/ConfirmMappingsImport.js +1 -4
- package/lib/cjs/widget/components/ConfirmMappingsImport.js.map +1 -1
- package/lib/cjs/widget/components/GroupAction.d.ts +13 -9
- package/lib/cjs/widget/components/GroupAction.js +56 -58
- package/lib/cjs/widget/components/GroupAction.js.map +1 -1
- package/lib/cjs/widget/components/GroupPropertyAction.d.ts +1 -1
- package/lib/cjs/widget/components/GroupPropertyAction.js.map +1 -1
- package/lib/cjs/widget/components/GroupPropertyUtils.js +4 -0
- package/lib/cjs/widget/components/GroupPropertyUtils.js.map +1 -1
- package/lib/cjs/widget/components/Grouping.d.ts +8 -9
- package/lib/cjs/widget/components/Grouping.js +118 -273
- package/lib/cjs/widget/components/Grouping.js.map +1 -1
- package/lib/cjs/widget/components/Grouping.scss +2 -2
- package/lib/cjs/widget/components/GroupingMapping.d.ts +28 -21
- package/lib/cjs/widget/components/GroupingMapping.js +59 -38
- package/lib/cjs/widget/components/GroupingMapping.js.map +1 -1
- package/lib/cjs/widget/components/GroupingMappingContent.d.ts +8 -0
- package/lib/cjs/widget/components/GroupingMappingContent.js +47 -0
- package/lib/cjs/widget/components/GroupingMappingContent.js.map +1 -0
- package/lib/cjs/widget/components/GroupingMappingContext.d.ts +31 -0
- package/lib/cjs/widget/components/GroupingMappingContext.js +84 -0
- package/lib/cjs/widget/components/GroupingMappingContext.js.map +1 -0
- package/lib/cjs/widget/components/GroupingMappingHeader.d.ts +8 -0
- package/lib/cjs/widget/components/GroupingMappingHeader.js +17 -0
- package/lib/cjs/widget/components/GroupingMappingHeader.js.map +1 -0
- package/lib/cjs/widget/components/GroupingMappingRouter.d.ts +8 -0
- package/lib/cjs/widget/components/GroupingMappingRouter.js +87 -0
- package/lib/cjs/widget/components/GroupingMappingRouter.js.map +1 -0
- package/lib/cjs/widget/components/Mapping.d.ts +7 -2
- package/lib/cjs/widget/components/Mapping.js +53 -84
- package/lib/cjs/widget/components/Mapping.js.map +1 -1
- package/lib/cjs/widget/components/MappingAction.d.ts +9 -5
- package/lib/cjs/widget/components/MappingAction.js +19 -8
- package/lib/cjs/widget/components/MappingAction.js.map +1 -1
- package/lib/cjs/widget/components/QueryBuilder.js +2 -7
- package/lib/cjs/widget/components/QueryBuilder.js.map +1 -1
- package/lib/cjs/widget/components/context/GroupHilitedElementsContext.d.ts +15 -0
- package/lib/cjs/widget/components/context/GroupHilitedElementsContext.js +45 -0
- package/lib/cjs/widget/components/context/GroupHilitedElementsContext.js.map +1 -0
- package/lib/cjs/widget/components/context/GroupingApiConfigContext.d.ts +1 -0
- package/lib/cjs/widget/components/context/GroupingApiConfigContext.js +1 -0
- package/lib/cjs/widget/components/context/GroupingApiConfigContext.js.map +1 -1
- package/lib/cjs/widget/components/context/GroupingMappingCustomUIContext.d.ts +6 -2
- package/lib/cjs/widget/components/context/GroupingMappingCustomUIContext.js +5 -5
- package/lib/cjs/widget/components/context/GroupingMappingCustomUIContext.js.map +1 -1
- package/lib/cjs/widget/components/customUI/DefaultGroupingUI.d.ts +3 -0
- package/lib/cjs/widget/components/customUI/DefaultGroupingUI.js +40 -0
- package/lib/cjs/widget/components/customUI/DefaultGroupingUI.js.map +1 -0
- package/lib/cjs/widget/components/customUI/GroupQueryBuilderCustomUI.d.ts +5 -0
- package/lib/cjs/widget/components/{GroupQueryBuilderContainer.js → customUI/GroupQueryBuilderCustomUI.js} +36 -16
- package/lib/cjs/widget/components/customUI/GroupQueryBuilderCustomUI.js.map +1 -0
- package/lib/cjs/widget/components/customUI/GroupingMappingCustomUI.d.ts +3 -2
- package/lib/cjs/widget/components/customUI/GroupingMappingCustomUI.js.map +1 -1
- package/lib/cjs/widget/components/customUI/ManualGroupingCustomUI.d.ts +1 -2
- package/lib/cjs/widget/components/customUI/ManualGroupingCustomUI.js +2 -1
- package/lib/cjs/widget/components/customUI/ManualGroupingCustomUI.js.map +1 -1
- package/lib/cjs/widget/components/customUI/SearchGroupingCustomUI.d.ts +1 -2
- package/lib/cjs/widget/components/customUI/SearchGroupingCustomUI.js +2 -1
- package/lib/cjs/widget/components/customUI/SearchGroupingCustomUI.js.map +1 -1
- package/lib/cjs/widget/components/groupsHelpers.d.ts +7 -0
- package/lib/cjs/widget/components/groupsHelpers.js +84 -0
- package/lib/cjs/widget/components/groupsHelpers.js.map +1 -0
- package/lib/cjs/widget/components/property-grid/PropertyGridWrapper.d.ts +1 -1
- package/lib/cjs/widget/components/property-grid/PropertyGridWrapper.js +1 -1
- package/lib/cjs/widget/components/property-grid/PropertyGridWrapper.js.map +1 -1
- package/lib/cjs/widget/components/property-grid/PropertyView.js +29 -15
- package/lib/cjs/widget/components/property-grid/PropertyView.js.map +1 -1
- package/lib/cjs/widget/components/utils.d.ts +1 -3
- package/lib/cjs/widget/components/utils.js +1 -26
- package/lib/cjs/widget/components/utils.js.map +1 -1
- package/lib/esm/grouping-mapping-widget.d.ts +11 -5
- package/lib/esm/grouping-mapping-widget.js +9 -2
- package/lib/esm/grouping-mapping-widget.js.map +1 -1
- package/lib/esm/test/GroupingMappingCustomUI.test.js +46 -83
- package/lib/esm/test/GroupingMappingCustomUI.test.js.map +1 -1
- package/lib/esm/test/test-utils.d.ts +0 -6
- package/lib/esm/test/test-utils.js +7 -22
- package/lib/esm/test/test-utils.js.map +1 -1
- package/lib/esm/widget/components/ActionPanel.d.ts +1 -1
- package/lib/esm/widget/components/ActionPanel.js +1 -1
- package/lib/esm/widget/components/ActionPanel.js.map +1 -1
- package/lib/esm/widget/components/ConfirmMappingsImport.js +1 -4
- package/lib/esm/widget/components/ConfirmMappingsImport.js.map +1 -1
- package/lib/esm/widget/components/GroupAction.d.ts +13 -9
- package/lib/esm/widget/components/GroupAction.js +57 -61
- package/lib/esm/widget/components/GroupAction.js.map +1 -1
- package/lib/esm/widget/components/GroupPropertyAction.d.ts +1 -1
- package/lib/esm/widget/components/GroupPropertyAction.js.map +1 -1
- package/lib/esm/widget/components/GroupPropertyUtils.js +4 -0
- package/lib/esm/widget/components/GroupPropertyUtils.js.map +1 -1
- package/lib/esm/widget/components/Grouping.d.ts +8 -9
- package/lib/esm/widget/components/Grouping.js +122 -277
- package/lib/esm/widget/components/Grouping.js.map +1 -1
- package/lib/esm/widget/components/Grouping.scss +2 -2
- package/lib/esm/widget/components/GroupingMapping.d.ts +28 -21
- package/lib/esm/widget/components/GroupingMapping.js +59 -39
- package/lib/esm/widget/components/GroupingMapping.js.map +1 -1
- package/lib/esm/widget/components/GroupingMappingContent.d.ts +8 -0
- package/lib/esm/widget/components/GroupingMappingContent.js +24 -0
- package/lib/esm/widget/components/GroupingMappingContent.js.map +1 -0
- package/lib/esm/widget/components/GroupingMappingContext.d.ts +31 -0
- package/lib/esm/widget/components/GroupingMappingContext.js +61 -0
- package/lib/esm/widget/components/GroupingMappingContext.js.map +1 -0
- package/lib/esm/widget/components/GroupingMappingHeader.d.ts +8 -0
- package/lib/esm/widget/components/GroupingMappingHeader.js +10 -0
- package/lib/esm/widget/components/GroupingMappingHeader.js.map +1 -0
- package/lib/esm/widget/components/GroupingMappingRouter.d.ts +8 -0
- package/lib/esm/widget/components/GroupingMappingRouter.js +80 -0
- package/lib/esm/widget/components/GroupingMappingRouter.js.map +1 -0
- package/lib/esm/widget/components/Mapping.d.ts +7 -2
- package/lib/esm/widget/components/Mapping.js +55 -86
- package/lib/esm/widget/components/Mapping.js.map +1 -1
- package/lib/esm/widget/components/MappingAction.d.ts +9 -5
- package/lib/esm/widget/components/MappingAction.js +18 -9
- package/lib/esm/widget/components/MappingAction.js.map +1 -1
- package/lib/esm/widget/components/QueryBuilder.js +2 -7
- package/lib/esm/widget/components/QueryBuilder.js.map +1 -1
- package/lib/esm/widget/components/context/GroupHilitedElementsContext.d.ts +15 -0
- package/lib/esm/widget/components/context/GroupHilitedElementsContext.js +22 -0
- package/lib/esm/widget/components/context/GroupHilitedElementsContext.js.map +1 -0
- package/lib/esm/widget/components/context/GroupingApiConfigContext.d.ts +1 -0
- package/lib/esm/widget/components/context/GroupingApiConfigContext.js +1 -0
- package/lib/esm/widget/components/context/GroupingApiConfigContext.js.map +1 -1
- package/lib/esm/widget/components/context/GroupingMappingCustomUIContext.d.ts +6 -2
- package/lib/esm/widget/components/context/GroupingMappingCustomUIContext.js +5 -5
- package/lib/esm/widget/components/context/GroupingMappingCustomUIContext.js.map +1 -1
- package/lib/esm/widget/components/customUI/DefaultGroupingUI.d.ts +3 -0
- package/lib/esm/widget/components/customUI/DefaultGroupingUI.js +34 -0
- package/lib/esm/widget/components/customUI/DefaultGroupingUI.js.map +1 -0
- package/lib/esm/widget/components/customUI/GroupQueryBuilderCustomUI.d.ts +5 -0
- package/lib/esm/widget/components/{GroupQueryBuilderContainer.js → customUI/GroupQueryBuilderCustomUI.js} +11 -7
- package/lib/esm/widget/components/customUI/GroupQueryBuilderCustomUI.js.map +1 -0
- package/lib/esm/widget/components/customUI/GroupingMappingCustomUI.d.ts +3 -2
- package/lib/esm/widget/components/customUI/GroupingMappingCustomUI.js.map +1 -1
- package/lib/esm/widget/components/customUI/ManualGroupingCustomUI.d.ts +1 -2
- package/lib/esm/widget/components/customUI/ManualGroupingCustomUI.js +1 -2
- package/lib/esm/widget/components/customUI/ManualGroupingCustomUI.js.map +1 -1
- package/lib/esm/widget/components/customUI/SearchGroupingCustomUI.d.ts +1 -2
- package/lib/esm/widget/components/customUI/SearchGroupingCustomUI.js +1 -2
- package/lib/esm/widget/components/customUI/SearchGroupingCustomUI.js.map +1 -1
- package/lib/esm/widget/components/groupsHelpers.d.ts +7 -0
- package/lib/esm/widget/components/groupsHelpers.js +77 -0
- package/lib/esm/widget/components/groupsHelpers.js.map +1 -0
- package/lib/esm/widget/components/property-grid/PropertyGridWrapper.d.ts +1 -1
- package/lib/esm/widget/components/property-grid/PropertyGridWrapper.js +1 -1
- package/lib/esm/widget/components/property-grid/PropertyGridWrapper.js.map +1 -1
- package/lib/esm/widget/components/property-grid/PropertyView.js +1 -3
- package/lib/esm/widget/components/property-grid/PropertyView.js.map +1 -1
- package/lib/esm/widget/components/utils.d.ts +1 -3
- package/lib/esm/widget/components/utils.js +0 -24
- package/lib/esm/widget/components/utils.js.map +1 -1
- package/package.json +3 -3
- package/lib/cjs/widget/components/GroupQueryBuilderContainer.d.ts +0 -5
- package/lib/cjs/widget/components/GroupQueryBuilderContainer.js.map +0 -1
- package/lib/esm/widget/components/GroupQueryBuilderContainer.d.ts +0 -5
- package/lib/esm/widget/components/GroupQueryBuilderContainer.js.map +0 -1
- /package/lib/cjs/widget/components/{GroupQueryBuilder.scss → customUI/GroupQueryBuilderCustomUI.scss} +0 -0
- /package/lib/esm/widget/components/{GroupQueryBuilder.scss → customUI/GroupQueryBuilderCustomUI.scss} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QueryBuilder.js","sourceRoot":"","sources":["../../../../src/widget/components/QueryBuilder.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAyC/C,4FAA4F;AAC5F,MAAM,OAAO,YAAY;IAUvB,YAAY,QAA0C;QAI/C,eAAU,GAAG,GAAG,EAAE;YACvB,IAAI,CAAC,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AkB,CAAC,SAAiB;QAC1C,OAAO,mCAAmC,SAAS,wCAAwC,SAAS,KAAK,CAAC;IAC5G,CAAC;IAEO,OAAO,CAAC,CAAU;QACxB,OAAO,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACxC,CAAC;;AA1ZuB,uCAA0B,GAChD,iCAAiC,CAAC;AACZ,wCAA2B,GACjD,iCAAiC,CAAC;AACZ,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 {\n InstanceKey,\n PropertiesField,\n} from \"@itwin/presentation-common\";\nimport type { Primitives, PropertyRecord } from \"@itwin/appui-abstract\";\nimport { PropertyValueFormat } from \"@itwin/appui-abstract\";\nimport { toaster } from \"@itwin/itwinui-react\";\n\nexport interface Query {\n unions: QueryUnion[];\n}\n\nexport interface QueryUnion {\n classes: QueryClass[];\n properties: QueryProperty[];\n}\n\nexport interface QueryClass {\n // schemaName.className\n className: string;\n classJoins: ClassJoin[];\n}\n\nexport interface ClassJoin {\n classProperty: string;\n joinClassName: string;\n joinClassProperty: string;\n}\n\nexport interface QueryProperty {\n className: string;\n classProperties: ClassProperty[];\n isCategory: boolean;\n isAspect: boolean;\n}\n\nexport interface ClassProperty {\n name: string;\n value: Primitives.Value;\n needsQuote: boolean;\n}\n\nexport interface AddedProperty {\n propertyRecord: PropertyRecord;\n propertiesField: PropertiesField;\n}\n\n/* This class is to build adaptive and dynamic query for find similar property selections */\nexport class QueryBuilder {\n private static readonly MULTI_ASPECT_PRIMARY_CLASS =\n \"BisCore:ElementOwnsMultiAspects\";\n private static readonly UNIQUE_ASPECT_PRIMARY_CLASS =\n \"BisCore:ElementOwnsUniqueAspect\";\n private static readonly DEFAULT_DOUBLE_PRECISION = 4;\n\n private dataProvider: PresentationPropertyDataProvider;\n private query: Query | undefined;\n\n constructor(provider: PresentationPropertyDataProvider) {\n this.dataProvider = provider;\n }\n\n public resetQuery = () => {\n this.query = undefined;\n }\n\n private isCategory(propertyField: PropertiesField): boolean {\n const classInfo =\n propertyField.properties[0].property.navigationPropertyInfo?.classInfo;\n return classInfo?.name === \"BisCore:GeometricElement3dIsInCategory\";\n }\n\n private _propertyMap: Map<string, AddedProperty> = new Map();\n\n private regenerateQuery = () => {\n this.resetQuery();\n\n for (const property of this._propertyMap.values()) {\n this.buildProperty(property.propertyRecord, property.propertiesField);\n }\n }\n\n public async addProperty(prop: PropertyRecord): Promise<boolean> {\n // TODO: only handle primitive properties now\n if (prop.value?.valueFormat !== PropertyValueFormat.Primitive) {\n toaster.warning(\"Only primitive types are supported for now.\");\n return false;\n }\n if (prop.value.value === undefined) {\n return false;\n }\n\n const propertyField = (await this.dataProvider.getFieldByPropertyRecord(\n prop,\n )) as PropertiesField;\n\n if (!propertyField) {\n toaster.negative(\n \"Error. Failed to fetch field for this property record.\",\n );\n return false;\n }\n\n this._propertyMap.set(JSON.stringify(propertyField.getFieldDescriptor()), { propertyRecord: prop, propertiesField: propertyField });\n return true;\n }\n\n public async removeProperty(prop: PropertyRecord) {\n const propertyField = (await this.dataProvider.getFieldByPropertyRecord(\n prop,\n )) as PropertiesField;\n\n this._propertyMap.delete(JSON.stringify(propertyField.getFieldDescriptor()));\n }\n\n private buildProperty(prop: PropertyRecord, propertiesField: PropertiesField) {\n if (prop.value?.valueFormat !== PropertyValueFormat.Primitive || prop.value.value === undefined) {\n toaster.negative(\n \"Error. An unexpected error has occured while building a query.\",\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 pathToPrimaryClass = propertiesField.parent?.pathToPrimaryClass;\n\n // get the special cases\n const isNavigation: boolean =\n prop.property.typename.toLowerCase() === \"navigation\";\n const isCategory: boolean = isNavigation && this.isCategory(propertiesField);\n\n const isAspect: boolean =\n 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 for (let i = 0; i < propertiesField.properties.length; i++) {\n const property = propertiesField.properties[i].property;\n\n const className = property.classInfo.name.replace(\":\", \".\");\n const propertyName = isNavigation\n ? isCategory\n ? `${property.name}.CodeValue`\n : `${property.name}.id`\n : property.name;\n const propertyValue = isNavigation\n ? isCategory\n ? prop.value.displayValue ?? \"\"\n : (prop.value.value as InstanceKey).id\n : prop.value.value;\n\n if (\n !isAspect &&\n pathToPrimaryClass &&\n pathToPrimaryClass.length > 0\n ) {\n this.addRelatedToQuery(\n i,\n propertiesField,\n propertyName,\n propertyValue,\n );\n } else {\n this.addPropertyToQuery(\n i,\n className,\n propertyName,\n propertyValue,\n this.needsQuote(propertiesField),\n isCategory,\n isAspect,\n );\n }\n }\n return true;\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 private addRelatedToQuery(\n unionIndex: number,\n propertyField: PropertiesField,\n propertyName: string,\n propertyValue: Primitives.Value,\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\n const relClassProperty = path.isForwardRelationship\n ? `SourceECInstanceId`\n : `TargetECInstanceId`;\n\n const relPropertyValue = path.isForwardRelationship\n ? `TargetECInstanceId`\n : `SourceECInstanceId`;\n\n this.addClassToQuery(\n unionIndex,\n targetClassName,\n `ECInstanceId`,\n relClassName,\n relPropertyValue\n );\n\n this.addClassToQuery(\n unionIndex,\n relClassName,\n relClassProperty,\n sourceClassName,\n `ECInstanceId`\n );\n\n if (path.sourceClassInfo?.name\n === propertyField.parent?.contentClassInfo.name) {\n this.addPropertyToQuery(\n unionIndex,\n sourceClassName,\n propertyName,\n propertyValue,\n this.needsQuote(propertyField),\n false,\n false,\n );\n }\n });\n }\n\n private addClassToQuery(\n unionIndex: number,\n className: string,\n classProperty: string,\n joinClassName: string,\n joinClassProperty: string,\n ) {\n if (this.query === undefined) {\n this.query = { unions: [] };\n }\n\n const classJoin: ClassJoin = {\n classProperty,\n joinClassName,\n joinClassProperty,\n };\n\n const queryClass: QueryClass = {\n className,\n classJoins: [classJoin],\n };\n\n if (this.query.unions.length <= unionIndex) {\n this.query.unions.push({\n classes: [queryClass],\n properties: [],\n });\n return;\n }\n\n const foundClass = this.query.unions[unionIndex].classes.find((c) =>\n c.className === className\n );\n\n if (foundClass) {\n const foundJoin = foundClass.classJoins.find((join) =>\n join.classProperty === classProperty && join.joinClassName === joinClassName && join.joinClassProperty === joinClassProperty\n );\n\n if (!foundJoin)\n foundClass.classJoins.push(classJoin);\n return;\n }\n\n this.query.unions[unionIndex].classes.push(queryClass);\n }\n\n private addPropertyToQuery(\n unionIndex: number,\n className: string,\n propertyName: string,\n propertyValue: Primitives.Value,\n needsQuote: boolean,\n isCategory: boolean,\n isAspect: boolean,\n ) {\n if (this.query === undefined) {\n this.query = { unions: [] };\n }\n\n const queryJoin: ClassProperty = {\n name: propertyName,\n value: propertyValue,\n needsQuote,\n };\n\n const queryProperty: QueryProperty = {\n className,\n isCategory,\n isAspect,\n classProperties: [queryJoin],\n };\n\n if (this.query.unions.length <= unionIndex) {\n this.query.unions.push({\n classes: [],\n properties: [queryProperty],\n });\n return;\n }\n\n const foundPropertyClass = this.query.unions[unionIndex].properties.find((p) =>\n p.className === className\n );\n\n if (foundPropertyClass) {\n const foundJoin = foundPropertyClass?.classProperties.find((join) =>\n join.name === propertyName\n );\n\n if (foundJoin) {\n foundJoin.value = propertyValue;\n return;\n }\n\n foundPropertyClass.classProperties.push(queryJoin);\n return;\n }\n\n this.query.unions[unionIndex].properties.push(queryProperty);\n }\n\n public buildQueryString() {\n this.regenerateQuery();\n if (\n this.query === undefined ||\n (this.query.unions.find((u) => u.classes.length === 0 && u.properties.length === 0))\n ) {\n return \"\";\n }\n\n const unionSegments: string[] = [];\n for (const union of this.query.unions) {\n\n const baseClass = union.classes[0];\n const baseProperty = union.properties[0];\n const baseClassName = baseClass ? baseClass.className : baseProperty?.className;\n const baseIdName = `${baseClassName}.ECInstanceId`;\n\n const selectClause = this.selectClause(baseProperty, baseClass);\n\n let querySegments: Map<string, string[]> = new Map();\n querySegments = this.relationalJoinSegments(union.classes, querySegments);\n\n const whereSegments: string[] = [];\n for (const property of union.properties) {\n if (property.isCategory) {\n if (property.className !== baseClassName)\n querySegments.set(\"BisCore.GeometricElement3d\", [`BisCore.GeometricElement3d.ECInstanceId = ${baseIdName}`]);\n\n querySegments.set(\"BisCore.Category\", [`BisCore.Category.ECInstanceId = BisCore.GeometricElement3d.category.id`]);\n whereSegments.push(this.categoryWhereQuery(property.classProperties[0].value.toString()));\n continue;\n }\n\n const joinIdName = property.isAspect\n ? `${property.className}.Element.id`\n : `${property.className}.ECInstanceId`;\n\n if (!querySegments.has(property.className) && property.className !== baseClassName)\n querySegments.set(property.className, [`${joinIdName} = ${baseIdName}`]);\n\n for (const prop of property.classProperties) {\n whereSegments.push(this.propertyQuerySegment(property.className, prop, prop.needsQuote));\n }\n }\n\n const joinClauses: string[] = [];\n for (const key of querySegments.keys()) {\n joinClauses.push(`JOIN ${key} ON ${querySegments.get(key)?.join(\" AND \")}`);\n }\n\n const whereClause = `WHERE ${whereSegments.join(\" AND \")}`;\n\n unionSegments.push([selectClause, ...joinClauses, whereClause].join(\" \"));\n }\n\n return unionSegments.join(\" UNION \");\n }\n\n private selectClause(baseProperty: QueryProperty | undefined, baseClass: QueryClass | undefined) {\n if (baseClass) {\n return `SELECT ${baseClass.className}.ECInstanceId, ${baseClass.className}.ECClassId FROM ${baseClass.className}`;\n }\n\n if (baseProperty) {\n const baseIdName = baseProperty.isAspect\n ? `${baseProperty.className}.Element.id ECInstanceId`\n : `${baseProperty.className}.ECInstanceId, ${baseProperty.className}.ECClassId`;\n\n return `SELECT ${baseIdName} FROM ${baseProperty.className}`;\n }\n\n return \"\";\n }\n\n private relationalJoinSegments = (classes: QueryClass[], querySegments: Map<string, string[]>): Map<string, string[]> => {\n for (const queryClass of classes) {\n for (const classJoin of queryClass.classJoins) {\n const querySegment = [\n ...querySegments.get(classJoin.joinClassName) ?? [],\n `${queryClass.className}.${classJoin.classProperty} = ${classJoin.joinClassName}.${classJoin.joinClassProperty}`,\n ];\n querySegments.set(classJoin.joinClassName, querySegment);\n }\n }\n\n return querySegments;\n }\n\n private propertyQuerySegment = (className: string, property: ClassProperty, needsQuote: boolean): string => {\n if (this.isFloat(property.value))\n return `ROUND(${className}.${property.name}, ` +\n `${QueryBuilder.DEFAULT_DOUBLE_PRECISION}) = ` +\n `${Number(property.value).toFixed(QueryBuilder.DEFAULT_DOUBLE_PRECISION)}`;\n\n const propertyValue = needsQuote ? `'${property.value}'` : property.value;\n return `${className}.${property.name} = ${propertyValue}`;\n }\n\n private categoryWhereQuery(codeValue: string): string {\n return `((BisCore.Category.CodeValue = '${codeValue}') OR (BisCore.Category.UserLabel = '${codeValue}'))`;\n }\n\n private isFloat(n: unknown): boolean {\n return Number(n) === n && n % 1 !== 0;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"QueryBuilder.js","sourceRoot":"","sources":["../../../../src/widget/components/QueryBuilder.ts"],"names":[],"mappings":"AAUA,O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C;YAElF,OAAO,UAAU,UAAU,SAAS,YAAY,CAAC,SAAS,EAAE,CAAC;SAC9D;QAED,OAAO,EAAE,CAAC;IACZ,CAAC;IA0BO,kBAAkB,CAAC,SAAiB;QAC1C,OAAO,mCAAmC,SAAS,wCAAwC,SAAS,KAAK,CAAC;IAC5G,CAAC;IAEO,OAAO,CAAC,CAAU;QACxB,OAAO,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACxC,CAAC;;AArZuB,uCAA0B,GAChD,iCAAiC,CAAC;AACZ,wCAA2B,GACjD,iCAAiC,CAAC;AACZ,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 {\n InstanceKey,\n PropertiesField,\n} from \"@itwin/presentation-common\";\nimport type { Primitives, PropertyRecord } from \"@itwin/appui-abstract\";\nimport { PropertyValueFormat } from \"@itwin/appui-abstract\";\nimport { toaster } from \"@itwin/itwinui-react\";\n\nexport interface Query {\n unions: QueryUnion[];\n}\n\nexport interface QueryUnion {\n classes: QueryClass[];\n properties: QueryProperty[];\n}\n\nexport interface QueryClass {\n // schemaName.className\n className: string;\n classJoins: ClassJoin[];\n}\n\nexport interface ClassJoin {\n classProperty: string;\n joinClassName: string;\n joinClassProperty: string;\n}\n\nexport interface QueryProperty {\n className: string;\n classProperties: ClassProperty[];\n isCategory: boolean;\n isAspect: boolean;\n}\n\nexport interface ClassProperty {\n name: string;\n value: Primitives.Value;\n needsQuote: boolean;\n}\n\nexport interface AddedProperty {\n propertyRecord: PropertyRecord;\n propertiesField: PropertiesField;\n}\n\n/* This class is to build adaptive and dynamic query for find similar property selections */\nexport class QueryBuilder {\n private static readonly MULTI_ASPECT_PRIMARY_CLASS =\n \"BisCore:ElementOwnsMultiAspects\";\n private static readonly UNIQUE_ASPECT_PRIMARY_CLASS =\n \"BisCore:ElementOwnsUniqueAspect\";\n private static readonly DEFAULT_DOUBLE_PRECISION = 4;\n\n private dataProvider: PresentationPropertyDataProvider;\n private query: Query | undefined;\n\n constructor(provider: PresentationPropertyDataProvider) {\n this.dataProvider = provider;\n }\n\n public resetQuery = () => {\n this.query = undefined;\n }\n\n private isCategory(propertyField: PropertiesField): boolean {\n const classInfo =\n propertyField.properties[0].property.navigationPropertyInfo?.classInfo;\n return classInfo?.name === \"BisCore:GeometricElement3dIsInCategory\";\n }\n\n private _propertyMap: Map<string, AddedProperty> = new Map();\n\n private regenerateQuery = () => {\n this.resetQuery();\n\n for (const property of this._propertyMap.values()) {\n this.buildProperty(property.propertyRecord, property.propertiesField);\n }\n }\n\n public async addProperty(prop: PropertyRecord): Promise<boolean> {\n // TODO: only handle primitive properties now\n if (prop.value?.valueFormat !== PropertyValueFormat.Primitive) {\n toaster.warning(\"Only primitive types are supported for now.\");\n return false;\n }\n if (prop.value.value === undefined) {\n return false;\n }\n\n const propertyField = (await this.dataProvider.getFieldByPropertyRecord(\n prop,\n )) as PropertiesField;\n\n if (!propertyField) {\n toaster.negative(\n \"Error. Failed to fetch field for this property record.\",\n );\n return false;\n }\n\n this._propertyMap.set(JSON.stringify(propertyField.getFieldDescriptor()), { propertyRecord: prop, propertiesField: propertyField });\n return true;\n }\n\n public async removeProperty(prop: PropertyRecord) {\n const propertyField = (await this.dataProvider.getFieldByPropertyRecord(\n prop,\n )) as PropertiesField;\n\n this._propertyMap.delete(JSON.stringify(propertyField.getFieldDescriptor()));\n }\n\n private buildProperty(prop: PropertyRecord, propertiesField: PropertiesField) {\n if (prop.value?.valueFormat !== PropertyValueFormat.Primitive || prop.value.value === undefined) {\n toaster.negative(\n \"Error. An unexpected error has occured while building a query.\",\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 pathToPrimaryClass = propertiesField.parent?.pathToPrimaryClass;\n\n // get the special cases\n const isNavigation: boolean =\n prop.property.typename.toLowerCase() === \"navigation\";\n const isCategory: boolean = isNavigation && this.isCategory(propertiesField);\n\n const isAspect: boolean =\n 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 for (let i = 0; i < propertiesField.properties.length; i++) {\n const property = propertiesField.properties[i].property;\n\n const className = property.classInfo.name.replace(\":\", \".\");\n const propertyName = isNavigation\n ? isCategory\n ? `${property.name}.CodeValue`\n : `${property.name}.id`\n : property.name;\n const propertyValue = isNavigation\n ? isCategory\n ? prop.value.displayValue ?? \"\"\n : (prop.value.value as InstanceKey).id\n : prop.value.value;\n\n if (\n !isAspect &&\n pathToPrimaryClass &&\n pathToPrimaryClass.length > 0\n ) {\n this.addRelatedToQuery(\n i,\n propertiesField,\n propertyName,\n propertyValue,\n );\n } else {\n this.addPropertyToQuery(\n i,\n className,\n propertyName,\n propertyValue,\n this.needsQuote(propertiesField),\n isCategory,\n isAspect,\n );\n }\n }\n return true;\n }\n\n private needsQuote(propertyField: PropertiesField): boolean {\n // list of property types that need quote around property value\n const typeName = propertyField.type.typeName.toLowerCase();\n return \"string\" === typeName || \"uri\" === typeName;\n }\n\n private addRelatedToQuery(\n unionIndex: number,\n propertyField: PropertiesField,\n propertyName: string,\n propertyValue: Primitives.Value,\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\n const relClassProperty = path.isForwardRelationship\n ? `SourceECInstanceId`\n : `TargetECInstanceId`;\n\n const relPropertyValue = path.isForwardRelationship\n ? `TargetECInstanceId`\n : `SourceECInstanceId`;\n\n this.addClassToQuery(\n unionIndex,\n targetClassName,\n `ECInstanceId`,\n relClassName,\n relPropertyValue\n );\n\n this.addClassToQuery(\n unionIndex,\n relClassName,\n relClassProperty,\n sourceClassName,\n `ECInstanceId`\n );\n\n if (path.sourceClassInfo?.name\n === propertyField.parent?.contentClassInfo.name) {\n this.addPropertyToQuery(\n unionIndex,\n sourceClassName,\n propertyName,\n propertyValue,\n this.needsQuote(propertyField),\n false,\n false,\n );\n }\n });\n }\n\n private addClassToQuery(\n unionIndex: number,\n className: string,\n classProperty: string,\n joinClassName: string,\n joinClassProperty: string,\n ) {\n if (this.query === undefined) {\n this.query = { unions: [] };\n }\n\n const classJoin: ClassJoin = {\n classProperty,\n joinClassName,\n joinClassProperty,\n };\n\n const queryClass: QueryClass = {\n className,\n classJoins: [classJoin],\n };\n\n if (this.query.unions.length <= unionIndex) {\n this.query.unions.push({\n classes: [queryClass],\n properties: [],\n });\n return;\n }\n\n const foundClass = this.query.unions[unionIndex].classes.find((c) =>\n c.className === className\n );\n\n if (foundClass) {\n const foundJoin = foundClass.classJoins.find((join) =>\n join.classProperty === classProperty && join.joinClassName === joinClassName && join.joinClassProperty === joinClassProperty\n );\n\n if (!foundJoin)\n foundClass.classJoins.push(classJoin);\n return;\n }\n\n this.query.unions[unionIndex].classes.push(queryClass);\n }\n\n private addPropertyToQuery(\n unionIndex: number,\n className: string,\n propertyName: string,\n propertyValue: Primitives.Value,\n needsQuote: boolean,\n isCategory: boolean,\n isAspect: boolean,\n ) {\n if (this.query === undefined) {\n this.query = { unions: [] };\n }\n\n const queryJoin: ClassProperty = {\n name: propertyName,\n value: propertyValue,\n needsQuote,\n };\n\n const queryProperty: QueryProperty = {\n className,\n isCategory,\n isAspect,\n classProperties: [queryJoin],\n };\n\n if (this.query.unions.length <= unionIndex) {\n this.query.unions.push({\n classes: [],\n properties: [queryProperty],\n });\n return;\n }\n\n const foundPropertyClass = this.query.unions[unionIndex].properties.find((p) =>\n p.className === className\n );\n\n if (foundPropertyClass) {\n const foundJoin = foundPropertyClass?.classProperties.find((join) =>\n join.name === propertyName\n );\n\n if (foundJoin) {\n foundJoin.value = propertyValue;\n return;\n }\n\n foundPropertyClass.classProperties.push(queryJoin);\n return;\n }\n\n this.query.unions[unionIndex].properties.push(queryProperty);\n }\n\n public buildQueryString() {\n this.regenerateQuery();\n if (\n this.query === undefined ||\n (this.query.unions.find((u) => u.classes.length === 0 && u.properties.length === 0))\n ) {\n return \"\";\n }\n\n const unionSegments: string[] = [];\n for (const union of this.query.unions) {\n\n const baseClass = union.classes[0];\n const baseProperty = union.properties[0];\n const baseClassName = baseClass ? baseClass.className : baseProperty?.className;\n const baseIdName = `${baseClassName}.ECInstanceId`;\n\n const selectClause = this.selectClause(baseProperty, baseClass);\n\n let querySegments: Map<string, string[]> = new Map();\n querySegments = this.relationalJoinSegments(union.classes, querySegments);\n\n const whereSegments: string[] = [];\n for (const property of union.properties) {\n if (property.isCategory) {\n if (property.className !== baseClassName)\n querySegments.set(\"BisCore.GeometricElement3d\", [`BisCore.GeometricElement3d.ECInstanceId = ${baseIdName}`]);\n\n querySegments.set(\"BisCore.Category\", [`BisCore.Category.ECInstanceId = BisCore.GeometricElement3d.category.id`]);\n whereSegments.push(this.categoryWhereQuery(property.classProperties[0].value.toString()));\n continue;\n }\n\n const joinIdName = property.isAspect\n ? `${property.className}.Element.id`\n : `${property.className}.ECInstanceId`;\n\n if (!querySegments.has(property.className) && property.className !== baseClassName)\n querySegments.set(property.className, [`${joinIdName} = ${baseIdName}`]);\n\n for (const prop of property.classProperties) {\n whereSegments.push(this.propertyQuerySegment(property.className, prop, prop.needsQuote));\n }\n }\n\n const joinClauses: string[] = [];\n for (const key of querySegments.keys()) {\n joinClauses.push(`JOIN ${key} ON ${querySegments.get(key)?.join(\" AND \")}`);\n }\n\n const whereClause = `WHERE ${whereSegments.join(\" AND \")}`;\n\n unionSegments.push([selectClause, ...joinClauses, whereClause].join(\" \"));\n }\n\n return unionSegments.join(\" UNION \");\n }\n\n private selectClause(baseProperty: QueryProperty | undefined, baseClass: QueryClass | undefined) {\n if (baseClass) {\n return `SELECT ${baseClass.className}.ECInstanceId, ${baseClass.className}.ECClassId FROM ${baseClass.className}`;\n }\n\n if (baseProperty) {\n const baseIdName = baseProperty.isAspect\n ? `${baseProperty.className}.Element.id ECInstanceId`\n : `${baseProperty.className}.ECInstanceId, ${baseProperty.className}.ECClassId`;\n\n return `SELECT ${baseIdName} FROM ${baseProperty.className}`;\n }\n\n return \"\";\n }\n\n private relationalJoinSegments = (classes: QueryClass[], querySegments: Map<string, string[]>): Map<string, string[]> => {\n for (const queryClass of classes) {\n for (const classJoin of queryClass.classJoins) {\n const querySegment = [\n ...querySegments.get(classJoin.joinClassName) ?? [],\n `${queryClass.className}.${classJoin.classProperty} = ${classJoin.joinClassName}.${classJoin.joinClassProperty}`,\n ];\n querySegments.set(classJoin.joinClassName, querySegment);\n }\n }\n\n return querySegments;\n }\n\n private propertyQuerySegment = (className: string, property: ClassProperty, needsQuote: boolean): string => {\n if (this.isFloat(property.value))\n return `ROUND(${className}.${property.name}, ` +\n `${QueryBuilder.DEFAULT_DOUBLE_PRECISION}) = ` +\n `${Number(property.value).toFixed(QueryBuilder.DEFAULT_DOUBLE_PRECISION)}`;\n\n const propertyValue = needsQuote ? `'${property.value}'` : property.value;\n return `${className}.${property.name} = ${propertyValue}`;\n }\n\n private categoryWhereQuery(codeValue: string): string {\n return `((BisCore.Category.CodeValue = '${codeValue}') OR (BisCore.Category.UserLabel = '${codeValue}'))`;\n }\n\n private isFloat(n: unknown): boolean {\n return Number(n) === n && n % 1 !== 0;\n }\n}\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { MutableRefObject } from "react";
|
|
3
|
+
import type { Group } from "@itwin/insights-client";
|
|
4
|
+
export interface GroupHilitedElements {
|
|
5
|
+
hilitedElementsQueryCache: MutableRefObject<Map<string, string[]>>;
|
|
6
|
+
hiddenGroupsIds: string[];
|
|
7
|
+
showGroupColor: boolean;
|
|
8
|
+
groups: Group[];
|
|
9
|
+
setGroups: (groups: Group[]) => void;
|
|
10
|
+
setHiddenGroupsIds: (hiddenGroupIds: string[]) => void;
|
|
11
|
+
setShowGroupColor: (showGroupColor: boolean | ((showGroupColor: boolean) => boolean)) => void;
|
|
12
|
+
}
|
|
13
|
+
export declare const GroupHilitedElementsContext: React.Context<GroupHilitedElements>;
|
|
14
|
+
export declare const useGroupHilitedElementsContext: () => GroupHilitedElements;
|
|
15
|
+
//# sourceMappingURL=GroupHilitedElementsContext.d.ts.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
export const GroupHilitedElementsContext = React.createContext({
|
|
7
|
+
hilitedElementsQueryCache: { current: new Map() },
|
|
8
|
+
hiddenGroupsIds: [],
|
|
9
|
+
showGroupColor: false,
|
|
10
|
+
groups: [],
|
|
11
|
+
setGroups: () => { },
|
|
12
|
+
setHiddenGroupsIds: () => { },
|
|
13
|
+
setShowGroupColor: () => { },
|
|
14
|
+
});
|
|
15
|
+
export const useGroupHilitedElementsContext = () => {
|
|
16
|
+
const context = React.useContext(GroupHilitedElementsContext);
|
|
17
|
+
if (!context) {
|
|
18
|
+
throw new Error("useGroupHilitedElementsContext should be used within a GroupHilitedElementsContext provider");
|
|
19
|
+
}
|
|
20
|
+
return context;
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=GroupHilitedElementsContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GroupHilitedElementsContext.js","sourceRoot":"","sources":["../../../../../src/widget/components/context/GroupHilitedElementsContext.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAc/B,MAAM,CAAC,MAAM,2BAA2B,GAAG,KAAK,CAAC,aAAa,CAAuB;IACnF,yBAAyB,EAAE,EAAE,OAAO,EAAE,IAAI,GAAG,EAAE,EAAE;IACjD,eAAe,EAAE,EAAE;IACnB,cAAc,EAAE,KAAK;IACrB,MAAM,EAAE,EAAE;IACV,SAAS,EAAE,GAAG,EAAE,GAAG,CAAC;IACpB,kBAAkB,EAAE,GAAG,EAAE,GAAG,CAAC;IAC7B,iBAAiB,EAAE,GAAG,EAAE,GAAG,CAAC;CAC7B,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,8BAA8B,GAAG,GAAyB,EAAE;IACvE,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC,2BAA2B,CAAC,CAAC;IAC9D,IAAI,CAAC,OAAO,EAAE;QACZ,MAAM,IAAI,KAAK,CACb,6FAA6F,CAC9F,CAAC;KACH;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport * as React from \"react\";\nimport type { MutableRefObject } from \"react\";\nimport type { Group } from \"@itwin/insights-client\";\n\nexport interface GroupHilitedElements {\n hilitedElementsQueryCache: MutableRefObject<Map<string, string[]>>;\n hiddenGroupsIds: string[];\n showGroupColor: boolean;\n groups: Group[];\n setGroups: (groups: Group[]) => void;\n setHiddenGroupsIds: (hiddenGroupIds: string[]) => void;\n setShowGroupColor: (showGroupColor: boolean | ((showGroupColor: boolean) => boolean)) => void;\n}\n\nexport const GroupHilitedElementsContext = React.createContext<GroupHilitedElements>({\n hilitedElementsQueryCache: { current: new Map() },\n hiddenGroupsIds: [],\n showGroupColor: false,\n groups: [],\n setGroups: () => { },\n setHiddenGroupsIds: () => { },\n setShowGroupColor: () => { },\n});\n\nexport const useGroupHilitedElementsContext = (): GroupHilitedElements => {\n const context = React.useContext(GroupHilitedElementsContext);\n if (!context) {\n throw new Error(\n \"useGroupHilitedElementsContext should be used within a GroupHilitedElementsContext provider\"\n );\n }\n return context;\n};\n"]}
|
|
@@ -4,6 +4,7 @@ export declare type ClientPrefix = "" | "dev" | "qa" | undefined;
|
|
|
4
4
|
export declare type GetAccessTokenFn = () => Promise<AccessToken>;
|
|
5
5
|
export interface GroupingMappingApiConfig {
|
|
6
6
|
getAccessToken: GetAccessTokenFn;
|
|
7
|
+
iModelId: string;
|
|
7
8
|
prefix?: ClientPrefix;
|
|
8
9
|
}
|
|
9
10
|
export declare const GroupingMappingApiConfigContext: React.Context<GroupingMappingApiConfig>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GroupingApiConfigContext.js","sourceRoot":"","sources":["../../../../../src/widget/components/context/GroupingApiConfigContext.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"GroupingApiConfigContext.js","sourceRoot":"","sources":["../../../../../src/widget/components/context/GroupingApiConfigContext.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAUtC,MAAM,CAAC,MAAM,+BAA+B,GAC1C,aAAa,CAA2B;IACtC,cAAc,EAAE,KAAK,IAAI,EAAE,CAAC,EAAE;IAC9B,QAAQ,EAAE,EAAE;IACZ,MAAM,EAAE,SAAS;CAClB,CAAC,CAAC;AAEL,MAAM,CAAC,MAAM,2BAA2B,GAAG,GAAG,EAAE;IAC9C,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC,+BAA+B,CAAC,CAAC;IAClE,IAAI,CAAC,OAAO,EAAE;QACZ,MAAM,IAAI,KAAK,CACb,8FAA8F,CAC/F,CAAC;KACH;IACD,OAAO,OAAO,CAAC;AACjB,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 { AccessToken } from \"@itwin/core-bentley\";\nimport * as React from \"react\";\nimport { createContext } from \"react\";\n\nexport type ClientPrefix = \"\" | \"dev\" | \"qa\" | undefined;\nexport type GetAccessTokenFn = () => Promise<AccessToken>;\nexport interface GroupingMappingApiConfig {\n getAccessToken: GetAccessTokenFn;\n iModelId: string;\n prefix?: ClientPrefix;\n}\n\nexport const GroupingMappingApiConfigContext =\n createContext<GroupingMappingApiConfig>({\n getAccessToken: async () => \"\",\n iModelId: \"\",\n prefix: undefined,\n });\n\nexport const useGroupingMappingApiConfig = () => {\n const context = React.useContext(GroupingMappingApiConfigContext);\n if (!context) {\n throw new Error(\n \"useGroupingMappingApiConfig should be used within a GroupingMappingApiConfigContext provider\"\n );\n }\n return context;\n};\n"]}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { GroupingMappingCustomUI } from "../customUI/GroupingMappingCustomUI";
|
|
3
3
|
export declare const createGroupingMappingCustomUI: (customUIs: GroupingMappingCustomUI[] | undefined) => GroupingMappingCustomUI[];
|
|
4
|
-
export
|
|
5
|
-
|
|
4
|
+
export interface IGroupingMappingCustomUI {
|
|
5
|
+
customUIs: GroupingMappingCustomUI[];
|
|
6
|
+
setCustomUIs: (customUI: GroupingMappingCustomUI[] | ((customUI: GroupingMappingCustomUI[]) => GroupingMappingCustomUI[])) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare const GroupingMappingCustomUIContext: import("react").Context<IGroupingMappingCustomUI>;
|
|
9
|
+
export declare const useGroupingMappingCustomUI: () => IGroupingMappingCustomUI;
|
|
6
10
|
//# sourceMappingURL=GroupingMappingCustomUIContext.d.ts.map
|
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
import { createContext, useContext } from "react";
|
|
6
6
|
export const createGroupingMappingCustomUI = (customUIs) => {
|
|
7
|
-
|
|
8
|
-
return [];
|
|
9
|
-
}
|
|
10
|
-
return customUIs;
|
|
7
|
+
return customUIs !== null && customUIs !== void 0 ? customUIs : [];
|
|
11
8
|
};
|
|
12
|
-
export const GroupingMappingCustomUIContext = createContext(
|
|
9
|
+
export const GroupingMappingCustomUIContext = createContext({
|
|
10
|
+
customUIs: [],
|
|
11
|
+
setCustomUIs: () => { },
|
|
12
|
+
});
|
|
13
13
|
export const useGroupingMappingCustomUI = () => {
|
|
14
14
|
const context = useContext(GroupingMappingCustomUIContext);
|
|
15
15
|
if (!context) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GroupingMappingCustomUIContext.js","sourceRoot":"","sources":["../../../../../src/widget/components/context/GroupingMappingCustomUIContext.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAGlD,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAC3C,SAAgD,EACrB,EAAE;IAC7B,
|
|
1
|
+
{"version":3,"file":"GroupingMappingCustomUIContext.js","sourceRoot":"","sources":["../../../../../src/widget/components/context/GroupingMappingCustomUIContext.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAGlD,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAC3C,SAAgD,EACrB,EAAE;IAC7B,OAAO,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,EAAE,CAAC;AACzB,CAAC,CAAC;AAOF,MAAM,CAAC,MAAM,8BAA8B,GAAG,aAAa,CAA2B;IACpF,SAAS,EAAE,EAAE;IACb,YAAY,EAAE,GAAG,EAAE,GAAG,CAAC;CACxB,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,0BAA0B,GAAG,GAAG,EAAE;IAC7C,MAAM,OAAO,GAAG,UAAU,CAAC,8BAA8B,CAAC,CAAC;IAC3D,IAAI,CAAC,OAAO,EAAE;QACZ,MAAM,IAAI,KAAK,CACb,4FAA4F,CAC7F,CAAC;KACH;IACD,OAAO,OAAO,CAAC;AACjB,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 { createContext, useContext } from \"react\";\nimport type { GroupingMappingCustomUI } from \"../customUI/GroupingMappingCustomUI\";\n\nexport const createGroupingMappingCustomUI = (\n customUIs: GroupingMappingCustomUI[] | undefined,\n): GroupingMappingCustomUI[] => {\n return customUIs ?? [];\n};\n\nexport interface IGroupingMappingCustomUI {\n customUIs: GroupingMappingCustomUI[];\n setCustomUIs: (customUI: GroupingMappingCustomUI[] | ((customUI: GroupingMappingCustomUI[]) => GroupingMappingCustomUI[])) => void;\n}\n\nexport const GroupingMappingCustomUIContext = createContext<IGroupingMappingCustomUI>({\n customUIs: [],\n setCustomUIs: () => { },\n});\n\nexport const useGroupingMappingCustomUI = () => {\n const context = useContext(GroupingMappingCustomUIContext);\n if (!context) {\n throw new Error(\n \"useGroupingMappingCustomUI should be used within a GroupingMappingCustomUIContext provider\",\n );\n }\n return context;\n};\n"]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
import React from "react";
|
|
6
|
+
import { SvgCursor, SvgDraw, SvgSearch } from "@itwin/itwinui-icons-react";
|
|
7
|
+
import { GroupingMappingCustomUIType } from "./GroupingMappingCustomUI";
|
|
8
|
+
import { GroupQueryBuilderCustomUI } from "./GroupQueryBuilderCustomUI";
|
|
9
|
+
import { ManualGroupingCustomUI } from "./ManualGroupingCustomUI";
|
|
10
|
+
import { SearchGroupingCustomUI } from "./SearchGroupingCustomUI";
|
|
11
|
+
export const defaultGroupingUI = [
|
|
12
|
+
{
|
|
13
|
+
name: "Selection",
|
|
14
|
+
displayLabel: "Selection",
|
|
15
|
+
type: GroupingMappingCustomUIType.Grouping,
|
|
16
|
+
icon: React.createElement(SvgCursor, null),
|
|
17
|
+
uiComponent: GroupQueryBuilderCustomUI,
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
name: "Query Keywords",
|
|
21
|
+
displayLabel: "Query Keywords",
|
|
22
|
+
type: GroupingMappingCustomUIType.Grouping,
|
|
23
|
+
icon: React.createElement(SvgSearch, null),
|
|
24
|
+
uiComponent: SearchGroupingCustomUI,
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
name: "Manual",
|
|
28
|
+
displayLabel: "Manual",
|
|
29
|
+
type: GroupingMappingCustomUIType.Grouping,
|
|
30
|
+
icon: React.createElement(SvgDraw, null),
|
|
31
|
+
uiComponent: ManualGroupingCustomUI,
|
|
32
|
+
},
|
|
33
|
+
];
|
|
34
|
+
//# sourceMappingURL=DefaultGroupingUI.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DefaultGroupingUI.js","sourceRoot":"","sources":["../../../../../src/widget/components/customUI/DefaultGroupingUI.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAE3E,OAAO,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAC;AACxE,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAElE,MAAM,CAAC,MAAM,iBAAiB,GAA8B;IAC1D;QACE,IAAI,EAAE,WAAW;QACjB,YAAY,EAAE,WAAW;QACzB,IAAI,EAAE,2BAA2B,CAAC,QAAQ;QAC1C,IAAI,EAAE,oBAAC,SAAS,OAAG;QACnB,WAAW,EAAE,yBAAyB;KACvC;IACD;QACE,IAAI,EAAE,gBAAgB;QACtB,YAAY,EAAE,gBAAgB;QAC9B,IAAI,EAAE,2BAA2B,CAAC,QAAQ;QAC1C,IAAI,EAAE,oBAAC,SAAS,OAAG;QACnB,WAAW,EAAE,sBAAsB;KACpC;IACD;QACE,IAAI,EAAE,QAAQ;QACd,YAAY,EAAE,QAAQ;QACtB,IAAI,EAAE,2BAA2B,CAAC,QAAQ;QAC1C,IAAI,EAAE,oBAAC,OAAO,OAAG;QACjB,WAAW,EAAE,sBAAsB;KACpC;CACF,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport React from \"react\";\nimport { SvgCursor, SvgDraw, SvgSearch } from \"@itwin/itwinui-icons-react\";\nimport type { GroupingMappingCustomUI } from \"./GroupingMappingCustomUI\";\nimport { GroupingMappingCustomUIType } from \"./GroupingMappingCustomUI\";\nimport { GroupQueryBuilderCustomUI } from \"./GroupQueryBuilderCustomUI\";\nimport { ManualGroupingCustomUI } from \"./ManualGroupingCustomUI\";\nimport { SearchGroupingCustomUI } from \"./SearchGroupingCustomUI\";\n\nexport const defaultGroupingUI: GroupingMappingCustomUI[] = [\n {\n name: \"Selection\",\n displayLabel: \"Selection\",\n type: GroupingMappingCustomUIType.Grouping,\n icon: <SvgCursor />,\n uiComponent: GroupQueryBuilderCustomUI,\n },\n {\n name: \"Query Keywords\",\n displayLabel: \"Query Keywords\",\n type: GroupingMappingCustomUIType.Grouping,\n icon: <SvgSearch />,\n uiComponent: SearchGroupingCustomUI,\n },\n {\n name: \"Manual\",\n displayLabel: \"Manual\",\n type: GroupingMappingCustomUIType.Grouping,\n icon: <SvgDraw />,\n uiComponent: ManualGroupingCustomUI,\n },\n];\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import "./GroupQueryBuilderCustomUI.scss";
|
|
3
|
+
import type { GroupingCustomUIProps } from "./GroupingMappingCustomUI";
|
|
4
|
+
export declare const GroupQueryBuilderCustomUI: ({ isUpdating, resetView, updateQuery }: GroupingCustomUIProps) => JSX.Element;
|
|
5
|
+
//# sourceMappingURL=GroupQueryBuilderCustomUI.d.ts.map
|
|
@@ -2,21 +2,25 @@
|
|
|
2
2
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
3
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
|
-
import { useEffect, useState } from "react";
|
|
5
|
+
import React, { useEffect, useState } from "react";
|
|
6
6
|
import { useActiveIModelConnection } from "@itwin/appui-react";
|
|
7
7
|
import { Presentation } from "@itwin/presentation-frontend";
|
|
8
8
|
import { KeySet } from "@itwin/presentation-common";
|
|
9
|
-
import { PropertyGridWrapper } from "
|
|
10
|
-
import { PropertyGridWrapperContext } from "
|
|
9
|
+
import { PropertyGridWrapper } from "../property-grid/PropertyGridWrapper";
|
|
10
|
+
import { PropertyGridWrapperContext } from "../context/PropertyGridWrapperContext";
|
|
11
11
|
import { Button } from "@itwin/itwinui-react";
|
|
12
|
-
import "./
|
|
13
|
-
|
|
14
|
-
export const GroupQueryBuilderContainer = ({ isUpdating, resetView, updateQuery }) => {
|
|
12
|
+
import "./GroupQueryBuilderCustomUI.scss";
|
|
13
|
+
export const GroupQueryBuilderCustomUI = ({ isUpdating, resetView, updateQuery }) => {
|
|
15
14
|
const iModelConnection = useActiveIModelConnection();
|
|
16
15
|
const [keysState, setKeysState] = useState(new KeySet());
|
|
17
16
|
const [selected, setSelected] = useState(false);
|
|
18
17
|
const [queryBuilder, setQueryBuilder] = useState();
|
|
19
18
|
const [currentPropertyList, setCurrentPropertyList] = useState([]);
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
if (!iModelConnection) {
|
|
21
|
+
throw new Error("This component requires an active iModelConnection.");
|
|
22
|
+
}
|
|
23
|
+
}, [iModelConnection]);
|
|
20
24
|
useEffect(() => {
|
|
21
25
|
const _onSelectionChanged = async (evt, selectionProvider) => {
|
|
22
26
|
setSelected(true);
|
|
@@ -52,4 +56,4 @@ export const GroupQueryBuilderContainer = ({ isUpdating, resetView, updateQuery
|
|
|
52
56
|
selected && (React.createElement("div", { className: "gmw-button-container" },
|
|
53
57
|
React.createElement(Button, { styleType: "default", size: "small", className: "gmw-reset-button", onClick: _onClickResetButton }, "Reset")))));
|
|
54
58
|
};
|
|
55
|
-
//# sourceMappingURL=
|
|
59
|
+
//# sourceMappingURL=GroupQueryBuilderCustomUI.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GroupQueryBuilderCustomUI.js","sourceRoot":"","sources":["../../../../../src/widget/components/customUI/GroupQueryBuilderCustomUI.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAE5D,OAAO,EAAE,MAAM,EAAE,MAAM,4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------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport React, { useEffect, useState } from \"react\";\nimport { useActiveIModelConnection } from \"@itwin/appui-react\";\nimport { Presentation } from \"@itwin/presentation-frontend\";\nimport type { ISelectionProvider, SelectionChangeEventArgs } from \"@itwin/presentation-frontend\";\nimport { KeySet } from \"@itwin/presentation-common\";\nimport { PropertyGridWrapper } from \"../property-grid/PropertyGridWrapper\";\nimport { PropertyGridWrapperContext } from \"../context/PropertyGridWrapperContext\";\nimport { Button } from \"@itwin/itwinui-react\";\nimport \"./GroupQueryBuilderCustomUI.scss\";\nimport type { QueryBuilder } from \"../QueryBuilder\";\nimport type { PropertyRecord } from \"@itwin/appui-abstract\";\nimport type { GroupingCustomUIProps } from \"./GroupingMappingCustomUI\";\n\nexport const GroupQueryBuilderCustomUI = ({ isUpdating, resetView, updateQuery }: GroupingCustomUIProps) => {\n const iModelConnection = useActiveIModelConnection();\n\n const [keysState, setKeysState] = useState<KeySet>(new KeySet());\n const [selected, setSelected] = useState<boolean>(false);\n\n const [queryBuilder, setQueryBuilder] = useState<QueryBuilder | undefined>();\n const [currentPropertyList, setCurrentPropertyList] = useState<PropertyRecord[]>([]);\n\n useEffect(() => {\n if (!iModelConnection) {\n throw new Error(\"This component requires an active iModelConnection.\");\n }\n }, [iModelConnection]);\n\n useEffect(() => {\n const _onSelectionChanged = async (\n evt: SelectionChangeEventArgs,\n selectionProvider: ISelectionProvider\n ) => {\n setSelected(true);\n setCurrentPropertyList([]);\n\n const selection = selectionProvider.getSelection(evt.imodel, evt.level);\n const keys = new KeySet(selection);\n setKeysState(keys);\n };\n\n return iModelConnection\n ? Presentation.selection.selectionChange.addListener(_onSelectionChanged) :\n () => { };\n }, [iModelConnection]);\n\n const _onClickResetButton = async () => {\n updateQuery(\"\");\n queryBuilder?.resetQuery();\n setCurrentPropertyList([]);\n if (resetView)\n await resetView().catch((e) =>\n /* eslint-disable no-console */\n console.error(e)\n );\n };\n\n return (\n <div className=\"gmw-find-similar-container\">\n <PropertyGridWrapperContext.Provider\n value={{\n currentPropertyList,\n setCurrentPropertyList,\n queryBuilder,\n setQueryBuilder,\n resetView: resetView ?? (async () => { }),\n setQuery: updateQuery,\n isUpdating: isUpdating ?? false,\n }}>\n <PropertyGridWrapper keys={keysState} imodel={iModelConnection} />\n </PropertyGridWrapperContext.Provider>\n {\n selected && (\n <div className=\"gmw-button-container\">\n <Button\n styleType=\"default\"\n size=\"small\"\n className=\"gmw-reset-button\"\n onClick={_onClickResetButton}\n >\n Reset\n </Button>\n </div>\n )\n }\n </div >\n );\n};\n"]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Group, Mapping } from "@itwin/insights-client";
|
|
1
2
|
import type { ReactElement } from "react";
|
|
2
3
|
export declare enum GroupingMappingCustomUIType {
|
|
3
4
|
Grouping = 0,
|
|
@@ -34,11 +35,11 @@ export interface ContextCustomUI extends IGroupingMappingCustomUI {
|
|
|
34
35
|
/**
|
|
35
36
|
* User defined component for UI interaction with grouping mapping widget.
|
|
36
37
|
*/
|
|
37
|
-
uiComponent?:
|
|
38
|
+
uiComponent?: React.ComponentType<ContextCustomUIProps>;
|
|
38
39
|
/**
|
|
39
40
|
* Callback function for context custom UI menu item click event.
|
|
40
41
|
*/
|
|
41
|
-
onClick?: (
|
|
42
|
+
onClick?: (group: Group, mapping: Mapping, iModelId: string) => void;
|
|
42
43
|
}
|
|
43
44
|
/**
|
|
44
45
|
* Group custom UI type definition.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GroupingMappingCustomUI.js","sourceRoot":"","sources":["../../../../../src/widget/components/customUI/GroupingMappingCustomUI.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"GroupingMappingCustomUI.js","sourceRoot":"","sources":["../../../../../src/widget/components/customUI/GroupingMappingCustomUI.ts"],"names":[],"mappings":"AAOA,MAAM,CAAN,IAAY,2BAGX;AAHD,WAAY,2BAA2B;IACrC,qFAAQ,CAAA;IACR,mFAAO,CAAA;AACT,CAAC,EAHW,2BAA2B,KAA3B,2BAA2B,QAGtC","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 { Group, Mapping } from \"@itwin/insights-client\";\nimport type { ReactElement } from \"react\";\n\nexport enum GroupingMappingCustomUIType {\n Grouping,\n Context,\n}\n\nexport type GroupingMappingCustomUI = GroupingCustomUI | ContextCustomUI;\n\n/** Custom UI Definitions. */\n\nexport interface IGroupingMappingCustomUI {\n /**\n * See GroupingMappingCustomUIType.\n */\n type: GroupingMappingCustomUIType;\n /**\n * Unique identifier of the custom UI.\n */\n name: string;\n /**\n * Display label in the widget.\n */\n displayLabel: string;\n /**\n * Optional icon, will be shown before display label in widget.\n */\n icon?: ReactElement;\n}\n\n/**\n * Context custom UI type definition.\n */\nexport interface ContextCustomUI extends IGroupingMappingCustomUI {\n /**\n * See GroupingMappingCustomUIType.\n */\n type: GroupingMappingCustomUIType.Context;\n /**\n * User defined component for UI interaction with grouping mapping widget.\n */\n uiComponent?: React.ComponentType<ContextCustomUIProps>;\n /**\n * Callback function for context custom UI menu item click event.\n */\n onClick?: (group: Group, mapping: Mapping, iModelId: string) => void;\n}\n\n/**\n * Group custom UI type definition.\n */\nexport interface GroupingCustomUI extends IGroupingMappingCustomUI {\n /**\n * See GroupingMappingCustomUIType.\n */\n type: GroupingMappingCustomUIType.Grouping;\n /**\n * Custom UI Component to build query interactively. Refer to SearchGroupingCustomUI/ManualGroupingCustomUI.\n */\n uiComponent: (props: GroupingCustomUIProps) => JSX.Element;\n}\n\n/** Custom UI Component props definitions. */\n\n/**\n * Context custom UI component arguments definition.\n */\nexport interface ContextCustomUIProps {\n /**\n * IModel Id.\n */\n iModelId: string;\n /**\n * Mapping Id.\n */\n mappingId: string;\n /**\n * Group Id.\n */\n groupId: string;\n}\n\n/**\n * Group custom UI component arguments definition.\n */\nexport interface GroupingCustomUIProps {\n /**\n * To validate and update current query.\n */\n updateQuery: (query: string) => void;\n /**\n * To get the query loading status.\n */\n isUpdating?: boolean;\n /**\n * To reset the viewer.\n */\n resetView?: () => Promise<void>;\n}\n"]}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import "./ManualGroupingCustomUI.scss";
|
|
3
3
|
import type { GroupingCustomUIProps } from "./GroupingMappingCustomUI";
|
|
4
|
-
declare const ManualGroupingCustomUI: ({ updateQuery, isUpdating, resetView, }: GroupingCustomUIProps) => JSX.Element;
|
|
5
|
-
export default ManualGroupingCustomUI;
|
|
4
|
+
export declare const ManualGroupingCustomUI: ({ updateQuery, isUpdating, resetView, }: GroupingCustomUIProps) => JSX.Element;
|
|
6
5
|
//# sourceMappingURL=ManualGroupingCustomUI.d.ts.map
|
|
@@ -6,7 +6,7 @@ import React from "react";
|
|
|
6
6
|
import { Button, LabeledTextarea, Text } from "@itwin/itwinui-react";
|
|
7
7
|
import { LoadingSpinner } from "../utils";
|
|
8
8
|
import "./ManualGroupingCustomUI.scss";
|
|
9
|
-
const ManualGroupingCustomUI = ({ updateQuery, isUpdating, resetView, }) => {
|
|
9
|
+
export const ManualGroupingCustomUI = ({ updateQuery, isUpdating, resetView, }) => {
|
|
10
10
|
const [manualInput, setManualInput] = React.useState("");
|
|
11
11
|
return (React.createElement("div", { className: 'gmw-manual-form' },
|
|
12
12
|
React.createElement(Text, null, "Generate group using an ECSQL query. Please select ECInstanceId and ECClassId columns in the query."),
|
|
@@ -22,5 +22,4 @@ const ManualGroupingCustomUI = ({ updateQuery, isUpdating, resetView, }) => {
|
|
|
22
22
|
}
|
|
23
23
|
} }, "Clear"))));
|
|
24
24
|
};
|
|
25
|
-
export default ManualGroupingCustomUI;
|
|
26
25
|
//# sourceMappingURL=ManualGroupingCustomUI.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ManualGroupingCustomUI.js","sourceRoot":"","sources":["../../../../../src/widget/components/customUI/ManualGroupingCustomUI.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,+BAA+B,CAAC;AAGvC,MAAM,sBAAsB,GAAG,CAAC,
|
|
1
|
+
{"version":3,"file":"ManualGroupingCustomUI.js","sourceRoot":"","sources":["../../../../../src/widget/components/customUI/ManualGroupingCustomUI.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,+BAA+B,CAAC;AAGvC,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,EACrC,WAAW,EACX,UAAU,EACV,SAAS,GACa,EAAE,EAAE;IAC1B,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IAEzD,OAAO,CACL,6BAAK,SAAS,EAAC,iBAAiB;QAC9B,oBAAC,IAAI,8GAEE;QACP,oBAAC,eAAe,IACd,KAAK,EAAC,OAAO,EACb,QAAQ,QACR,KAAK,EAAE,WAAW,EAClB,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,cAAc,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,EACvD,QAAQ,EAAE,UAAU,EACpB,WAAW,EAAE,oEAAoE,GACjF;QACF,6BAAK,SAAS,EAAC,oBAAoB;YAChC,UAAU,IAAI,oBAAC,cAAc,OAAG;YACjC,oBAAC,MAAM,IAAC,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,WAAW,CAAC,YAE5D;YACT,oBAAC,MAAM,IACL,QAAQ,EAAE,UAAU,EACpB,OAAO,EAAE,KAAK,IAAI,EAAE;oBAClB,WAAW,CAAC,EAAE,CAAC,CAAC;oBAChB,cAAc,CAAC,EAAE,CAAC,CAAC;oBACnB,IAAI,SAAS,EAAE;wBACb,MAAM,SAAS,EAAE,CAAC;qBACnB;gBACH,CAAC,YAGM,CACL,CACF,CACP,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport React from \"react\";\nimport { Button, LabeledTextarea, Text } from \"@itwin/itwinui-react\";\nimport { LoadingSpinner } from \"../utils\";\nimport \"./ManualGroupingCustomUI.scss\";\nimport type { GroupingCustomUIProps } from \"./GroupingMappingCustomUI\";\n\nexport const ManualGroupingCustomUI = ({\n updateQuery,\n isUpdating,\n resetView,\n}: GroupingCustomUIProps) => {\n const [manualInput, setManualInput] = React.useState(\"\");\n\n return (\n <div className='gmw-manual-form'>\n <Text>\n Generate group using an ECSQL query. Please select ECInstanceId and ECClassId columns in the query.\n </Text>\n <LabeledTextarea\n label='Query'\n required\n value={manualInput}\n onChange={(event) => setManualInput(event.target.value)}\n disabled={isUpdating}\n placeholder={`E.g. \"SELECT ECInstanceId, ECClassId FROM BisCore:PhysicalElement\"`}\n />\n <div className='gmw-manual-actions'>\n {isUpdating && <LoadingSpinner />}\n <Button disabled={isUpdating} onClick={() => updateQuery(manualInput)}>\n Apply\n </Button>\n <Button\n disabled={isUpdating}\n onClick={async () => {\n updateQuery(\"\");\n setManualInput(\"\");\n if (resetView) {\n await resetView();\n }\n }}\n >\n Clear\n </Button>\n </div>\n </div>\n );\n};\n"]}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { GroupingCustomUIProps } from "./GroupingMappingCustomUI";
|
|
3
3
|
import "./SearchGroupingCustomUI.scss";
|
|
4
|
-
declare const SearchGroupingCustomUI: ({ updateQuery, isUpdating, resetView, }: GroupingCustomUIProps) => JSX.Element;
|
|
5
|
-
export default SearchGroupingCustomUI;
|
|
4
|
+
export declare const SearchGroupingCustomUI: ({ updateQuery, isUpdating, resetView, }: GroupingCustomUIProps) => JSX.Element;
|
|
6
5
|
//# sourceMappingURL=SearchGroupingCustomUI.d.ts.map
|
|
@@ -6,7 +6,7 @@ import React from "react";
|
|
|
6
6
|
import { Button, LabeledTextarea, Text } from "@itwin/itwinui-react";
|
|
7
7
|
import { LoadingSpinner } from "../utils";
|
|
8
8
|
import "./SearchGroupingCustomUI.scss";
|
|
9
|
-
const SearchGroupingCustomUI = ({ updateQuery, isUpdating, resetView, }) => {
|
|
9
|
+
export const SearchGroupingCustomUI = ({ updateQuery, isUpdating, resetView, }) => {
|
|
10
10
|
const [searchInput, setSearchInput] = React.useState("");
|
|
11
11
|
const isWrappedInQuotes = (text) => {
|
|
12
12
|
return text.startsWith(`"`) && text.endsWith(`"`);
|
|
@@ -88,5 +88,4 @@ const SearchGroupingCustomUI = ({ updateQuery, isUpdating, resetView, }) => {
|
|
|
88
88
|
}
|
|
89
89
|
} }, "Clear"))));
|
|
90
90
|
};
|
|
91
|
-
export default SearchGroupingCustomUI;
|
|
92
91
|
//# sourceMappingURL=SearchGroupingCustomUI.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchGroupingCustomUI.js","sourceRoot":"","sources":["../../../../../src/widget/components/customUI/SearchGroupingCustomUI.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAErE,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,+BAA+B,CAAC;AAEvC,MAAM,sBAAsB,GAAG,CAAC,
|
|
1
|
+
{"version":3,"file":"SearchGroupingCustomUI.js","sourceRoot":"","sources":["../../../../../src/widget/components/customUI/SearchGroupingCustomUI.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAErE,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,+BAA+B,CAAC;AAEvC,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,EACrC,WAAW,EACX,UAAU,EACV,SAAS,GACa,EAAE,EAAE;IAC1B,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IACzD,MAAM,iBAAiB,GAAG,CAAC,IAAY,EAAE,EAAE;QACzC,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;IACpD,CAAC,CAAC;IAEF,MAAM,gBAAgB,GAAG,CACvB,KAAa,EACb,KAAa,EACb,WAAqB,EACrB,EAAE,CACF,iBAAiB,CAAC,KAAK,CAAC;QACxB,CAAC,KAAK,KAAK,CAAC,IAAI,iBAAiB,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAErD,MAAM,mBAAmB,GAAG,CAAC,WAAqB,EAAE,EAAE;QACpD,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE;YAC5B,WAAW,CAAC,EAAE,CAAC,CAAC;YAChB,OAAO;SACR;QAED,IAAI,oBAAoB,GAAG,sEAAsE,CAAC;QAClG,oBAAoB,IAAI,8IA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;YACT,oBAAC,MAAM,IACL,QAAQ,EAAE,UAAU,EACpB,OAAO,EAAE,KAAK,IAAI,EAAE;oBAClB,WAAW,CAAC,EAAE,CAAC,CAAC;oBAChB,cAAc,CAAC,EAAE,CAAC,CAAC;oBACnB,IAAI,SAAS,EAAE;wBACb,MAAM,SAAS,EAAE,CAAC;qBACnB;gBACH,CAAC,YAGM,CACL,CACF,CACP,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport React from \"react\";\nimport { Button, LabeledTextarea, Text } from \"@itwin/itwinui-react\";\nimport type { GroupingCustomUIProps } from \"./GroupingMappingCustomUI\";\nimport { LoadingSpinner } from \"../utils\";\nimport \"./SearchGroupingCustomUI.scss\";\n\nexport const SearchGroupingCustomUI = ({\n updateQuery,\n isUpdating,\n resetView,\n}: GroupingCustomUIProps) => {\n const [searchInput, setSearchInput] = React.useState(\"\");\n const isWrappedInQuotes = (text: string) => {\n return text.startsWith(`\"`) && text.endsWith(`\"`);\n };\n\n const needsAndOperator = (\n token: string,\n index: number,\n searchQuery: string[],\n ) =>\n isWrappedInQuotes(token) ||\n (index === 1 && isWrappedInQuotes(searchQuery[0]));\n\n const generateSearchQuery = (searchQuery: string[]) => {\n if (searchQuery.length === 0) {\n updateQuery(\"\");\n return;\n }\n\n let generatedSearchQuery = `SELECT be.ECInstanceId, be.ECClassId FROM bis.geometricelement3d be `;\n generatedSearchQuery += `LEFT JOIN bis.SpatialCategory cat ON be.Category.Id = cat.ECInstanceID LEFT JOIN ecdbmeta.ECClassDef ecc ON be.ECClassId = ecc.ECInstanceId `;\n generatedSearchQuery += `LEFT JOIN bis.PhysicalType pt ON be.TypeDefinition.Id = pt.ECInstanceID`;\n generatedSearchQuery += ` WHERE `;\n generatedSearchQuery += `((${searchQuery\n .map(\n (token, index) =>\n `${index === 0\n ? \"\"\n : needsAndOperator(token, index, searchQuery)\n ? \"AND\"\n : \"OR\"\n } be.codevalue LIKE '%${isWrappedInQuotes(token) ? token.slice(1, -1) : token\n }%'`,\n )\n .join(\" \")}) OR (${searchQuery\n .map(\n (token, index) =>\n `${index === 0\n ? \"\"\n : needsAndOperator(token, index, searchQuery)\n ? \"AND\"\n : \"OR\"\n } be.userlabel LIKE '%${isWrappedInQuotes(token) ? token.slice(1, -1) : token\n }%'`,\n )\n .join(\" \")})) OR ((${searchQuery\n .map(\n (token, index) =>\n `${index === 0\n ? \"\"\n : needsAndOperator(token, index, searchQuery)\n ? \"AND\"\n : \"OR\"\n } cat.codevalue LIKE '%${isWrappedInQuotes(token) ? token.slice(1, -1) : token\n }%'`,\n )\n .join(\" \")}) OR (${searchQuery\n .map(\n (token, index) =>\n `${index === 0\n ? \"\"\n : needsAndOperator(token, index, searchQuery)\n ? \"AND\"\n : \"OR\"\n } cat.userlabel LIKE '%${isWrappedInQuotes(token) ? token.slice(1, -1) : token\n }%'`,\n )\n .join(\" \")})) OR (${searchQuery\n .map(\n (token, index) =>\n `${index === 0\n ? \"\"\n : needsAndOperator(token, index, searchQuery)\n ? \"AND\"\n : \"OR\"\n } ecc.name LIKE '%${isWrappedInQuotes(token) ? token.slice(1, -1) : token\n }%'`,\n )\n .join(\" \")})`;\n // Physical Types\n generatedSearchQuery += ` OR ((${searchQuery\n .map(\n (token, index) =>\n `${index === 0\n ? \"\"\n : needsAndOperator(token, index, searchQuery)\n ? \"AND\"\n : \"OR\"\n } pt.codevalue LIKE '%${isWrappedInQuotes(token) ? token.slice(1, -1) : token\n }%'`,\n )\n .join(\" \")}) OR (${searchQuery\n .map(\n (token, index) =>\n `${index === 0\n ? \"\"\n : needsAndOperator(token, index, searchQuery)\n ? \"AND\"\n : \"OR\"\n } pt.userlabel LIKE '%${isWrappedInQuotes(token) ? token.slice(1, -1) : token\n }%'`,\n )\n .join(\" \")})) `;\n\n updateQuery(generatedSearchQuery);\n };\n\n return (\n <div className='gmw-search-form'>\n <Text>\n Generate a query by keywords. Keywords wrapped in double quotes will be\n considered a required criteria.\n </Text>\n <LabeledTextarea\n label='Query Keywords'\n required\n value={searchInput}\n onChange={(event) => setSearchInput(event.target.value)}\n disabled={isUpdating}\n placeholder={`E.g. \"red\" chair`}\n />\n <div className='gmw-search-actions'>\n {isUpdating && <LoadingSpinner />}\n <Button\n disabled={isUpdating}\n onClick={() =>\n generateSearchQuery(\n searchInput\n ? searchInput\n .replace(/(\\r\\n|\\n|\\r)/gm, \"\")\n .trim()\n .split(\" \")\n : [],\n )\n }\n >\n Apply\n </Button>\n <Button\n disabled={isUpdating}\n onClick={async () => {\n updateQuery(\"\");\n setSearchInput(\"\");\n if (resetView) {\n await resetView();\n }\n }}\n >\n Clear\n </Button>\n </div>\n </div>\n );\n};\n\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { IModelConnection } from "@itwin/core-frontend";
|
|
2
|
+
import type { Group } from "@itwin/insights-client";
|
|
3
|
+
export declare const getGroupColor: (index: number) => string;
|
|
4
|
+
export declare const getHiliteIdsFromGroups: (iModelConnection: IModelConnection, groups: Group[], hilitedElementsQueryCache: React.MutableRefObject<Map<string, string[]>>) => Promise<string[]>;
|
|
5
|
+
export declare const hideGroups: (iModelConnection: IModelConnection, viewGroups: Group[], hilitedElementsQueryCache: React.MutableRefObject<Map<string, string[]>>) => Promise<void>;
|
|
6
|
+
export declare const visualizeGroupColors: (iModelConnection: IModelConnection, groups: Group[], viewGroups: Group[], hiddenGroupsIds: string[], hilitedElementsQueryCache: React.MutableRefObject<Map<string, string[]>>, doEmphasizeElements?: boolean) => Promise<void>;
|
|
7
|
+
//# sourceMappingURL=groupsHelpers.d.ts.map
|