@itwin/tree-widget-react 3.17.2 → 3.17.4
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/CHANGELOG.md +19 -2
- package/lib/cjs/tree-widget-react/components/trees/categories-tree/UseCategoriesTree.js +7 -2
- package/lib/cjs/tree-widget-react/components/trees/categories-tree/UseCategoriesTree.js.map +1 -1
- package/lib/cjs/tree-widget-react/components/trees/models-tree/ModelsTreeDefinition.d.ts +1 -1
- package/lib/cjs/tree-widget-react/components/trees/models-tree/ModelsTreeDefinition.js +22 -45
- package/lib/cjs/tree-widget-react/components/trees/models-tree/ModelsTreeDefinition.js.map +1 -1
- package/lib/cjs/tree-widget-react/components/trees/models-tree/UseModelsTree.js +9 -3
- package/lib/cjs/tree-widget-react/components/trees/models-tree/UseModelsTree.js.map +1 -1
- package/lib/cjs/tree-widget-react/components/trees/models-tree/internal/ModelsTreeVisibilityHandler.js +14 -19
- package/lib/cjs/tree-widget-react/components/trees/models-tree/internal/ModelsTreeVisibilityHandler.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/UseCategoriesTree.js +8 -3
- package/lib/esm/tree-widget-react/components/trees/categories-tree/UseCategoriesTree.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeDefinition.d.ts +1 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeDefinition.js +22 -45
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeDefinition.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/UseModelsTree.js +9 -3
- package/lib/esm/tree-widget-react/components/trees/models-tree/UseModelsTree.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeVisibilityHandler.js +14 -19
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeVisibilityHandler.js.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3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,YAAY,EAAE,WAAW,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,eAAe,EAAE,EAAE,iBAAiB,EAAE,CAAC,CAAC,CAAC;IAChG,IAAI,WAAiD,CAAC;IACtD,IAAI,CAAC;QACH,IAAI,YAAY,IAAI,WAAW,EAAE,CAAC;YAChC,OAAO,CAAC,WAAW,GAAG,2BAA2B,CAAC,YAAY,EAAE,WAAW,CAAC,CAAC,CAAC;QAChF,CAAC;QACD,IAAI,YAAY,EAAE,CAAC;YACjB,OAAO,CAAC,WAAW,GAAG,YAAY,CAAC,CAAC;QACtC,CAAC;QACD,IAAI,WAAW,EAAE,CAAC;YAChB,OAAO,CAAC,WAAW,GAAG,WAAW,CAAC,CAAC;QACrC,CAAC;IACH,CAAC;YAAS,CAAC;QACT,KAAK,WAAW,CAAC,WAAW,CAAC,CAAC;IAChC,CAAC;IACD,OAAO,WAAW,CAAC;AACrB,CAAC;AAED,SAAS,WAAW,CAAC,KAA8E;IACjG,OAAO,IAAI,kBAAkB,CAAC,wBAAwB,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,eAAe,CAAC,CAAC;AAC7G,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 *--------------------------------------------------------------------------------------------*/\n\nimport { useCallback, useEffect, useMemo, useRef, useState } from \"react\";\nimport { firstValueFrom } from \"rxjs\";\nimport { IModelApp } from \"@itwin/core-frontend\";\nimport { SvgFolder, SvgImodelHollow, SvgItem, SvgLayers, SvgModel } from \"@itwin/itwinui-icons-react\";\nimport { Anchor, Text } from \"@itwin/itwinui-react\";\nimport { createECSqlQueryExecutor } from \"@itwin/presentation-core-interop\";\nimport { HierarchyFilteringPath, HierarchyNode, HierarchyNodeIdentifier, HierarchyNodeKey } from \"@itwin/presentation-hierarchies\";\nimport { TreeWidget } from \"../../../TreeWidget.js\";\nimport { useFocusedInstancesContext } from \"../common/FocusedInstancesContext.js\";\nimport { useIdsCache } from \"../common/internal/useTreeHooks/UseIdsCache.js\";\nimport { FilterLimitExceededError } from \"../common/TreeErrors.js\";\nimport { useGuid } from \"../common/useGuid.js\";\nimport { useTelemetryContext } from \"../common/UseTelemetryContext.js\";\nimport { joinHierarchyFilteringPaths } from \"../common/Utils.js\";\nimport { ModelsTreeIdsCache } from \"./internal/ModelsTreeIdsCache.js\";\nimport { ModelsTreeNode } from \"./internal/ModelsTreeNode.js\";\nimport { createModelsTreeVisibilityHandler } from \"./internal/ModelsTreeVisibilityHandler.js\";\nimport { defaultHierarchyConfiguration, ModelsTreeDefinition } from \"./ModelsTreeDefinition.js\";\n\nimport type { ReactElement } from \"react\";\nimport type { GuidString, Id64String } from \"@itwin/core-bentley\";\nimport type { Viewport } from \"@itwin/core-frontend\";\nimport type { GroupingHierarchyNode, HierarchyNodeIdentifiersPath, InstancesNodeKey } from \"@itwin/presentation-hierarchies\";\nimport type { PresentationHierarchyNode } from \"@itwin/presentation-hierarchies-react\";\nimport type { ECClassHierarchyInspector, InstanceKey } from \"@itwin/presentation-shared\";\nimport type { VisibilityTreeProps } from \"../common/components/VisibilityTree.js\";\nimport type { VisibilityTreeRendererProps } from \"../common/components/VisibilityTreeRenderer.js\";\nimport type { CreateCacheProps } from \"../common/internal/useTreeHooks/UseIdsCache.js\";\nimport type { NormalizedHierarchyFilteringPath } from \"../common/Utils.js\";\nimport type { ModelsTreeVisibilityHandlerOverrides } from \"./internal/ModelsTreeVisibilityHandler.js\";\nimport type { ClassGroupingHierarchyNode, ElementsGroupInfo, ModelsTreeHierarchyConfiguration } from \"./ModelsTreeDefinition.js\";\n\ntype ModelsTreeFilteringError = \"tooManyFilterMatches\" | \"tooManyInstancesFocused\" | \"unknownFilterError\" | \"unknownInstanceFocusError\";\ntype ModelsTreeSubTreeError = \"unknownSubTreeError\";\n\n/** @beta */\nexport interface UseModelsTreeProps {\n /**\n * Optional search string used to filter tree nodes by label, as well as highlight matching substrings in the tree.\n * Nodes that do not contain this string in their label will be filtered out.\n *\n * If `getFilteredPaths` function is provided, it will take precedence and automatic filtering by this string will not be applied.\n * Instead, the string will be supplied to the given `getFilteredPaths` function for consumers to apply the filtering.\n */\n filter?: string;\n activeView: Viewport;\n hierarchyConfig?: Partial<ModelsTreeHierarchyConfiguration>;\n visibilityHandlerOverrides?: ModelsTreeVisibilityHandlerOverrides;\n /**\n * Optional function for applying custom filtering on the hierarchy. Use it when you want full control over which nodes should be displayed, based on more complex logic or known instance keys.\n *\n * When defined, this function takes precedence over filtering by `filter` string. If both are supplied, the `filter` is provided as an argument to `getFilteredPaths`.\n *\n * @param props Parameters provided when `getFilteredPaths` is called:\n * - `createInstanceKeyPaths`: Helper function to create filter paths.\n * - `filter`: The filter string which would otherwise be used for default filtering.\n *\n * **Example use cases:**\n * - You have a list of `InstanceKey` items, which you want to use for filtering the hierarchy.\n * - You want to create filter paths based on node label, but also apply some extra conditions (for example exclude paths with sub-models).\n * - You want to construct custom filtered paths. For example: create a filter path for each geometric element which has a parent element.\n *\n * @note Paths returned by `createInstanceKeyPaths` will not have `autoExpand` flag set. If you want nodes to be expanded, iterate over the paths and\n * set `autoExpand: true` manually.\n */\n getFilteredPaths?: (props: {\n /** A function that creates filtering paths based on provided target instance keys or node label. */\n createInstanceKeyPaths: (props: { targetItems: Array<InstanceKey | ElementsGroupInfo> } | { label: string }) => Promise<NormalizedHierarchyFilteringPath[]>;\n /** Filter which would be used to create filter paths if `getFilteredPaths` wouldn't be provided. */\n filter?: string;\n }) => Promise<HierarchyFilteringPath[] | undefined>;\n /**\n * Optional function for restricting the visible hierarchy to a specific sub-tree of nodes, without changing how filtering works.\n *\n * Use when you want to display only part of the hierarchy, but still allow normal filtering within that sub-tree.\n *\n * When defined, only nodes that are in the provided paths or children of target nodes will be part of the hierarchy.\n * Filtering (by label or custom logic) will still apply within this sub-tree.\n *\n * Key difference:\n * - `getFilteredPaths` determines which nodes should be shown, giving you full control over filtering logic.\n * - `getSubTreePaths` restricts the hierarchy to a sub-tree, but does not override the filtering logic — filtering is still applied within the restricted sub-tree.\n */\n getSubTreePaths?: (props: {\n /** A function that creates filtering paths based on provided target instance keys. */\n createInstanceKeyPaths: (props: { targetItems: Array<InstanceKey | ElementsGroupInfo> }) => Promise<NormalizedHierarchyFilteringPath[]>;\n }) => Promise<HierarchyFilteringPath[]>;\n onModelsFiltered?: (modelIds: Id64String[] | undefined) => void;\n /**\n * An optional predicate to allow or prohibit selection of a node.\n * When not supplied, all nodes are selectable.\n */\n selectionPredicate?: (props: { node: PresentationHierarchyNode; type: \"subject\" | \"model\" | \"category\" | \"element\" | \"elements-class-group\" }) => boolean;\n}\n\n/** @beta */\ninterface UseModelsTreeResult {\n modelsTreeProps: Pick<\n VisibilityTreeProps,\n \"treeName\" | \"getHierarchyDefinition\" | \"getFilteredPaths\" | \"visibilityHandlerFactory\" | \"highlight\" | \"noDataMessage\" | \"selectionPredicate\"\n >;\n rendererProps: Required<Pick<VisibilityTreeRendererProps, \"getIcon\" | \"onNodeDoubleClick\">>;\n}\n\n/**\n * Custom hook to create and manage state for the models tree.\n * @beta\n */\nexport function useModelsTree({\n activeView,\n filter,\n hierarchyConfig,\n visibilityHandlerOverrides,\n getFilteredPaths,\n onModelsFiltered,\n selectionPredicate: nodeTypeSelectionPredicate,\n getSubTreePaths,\n}: UseModelsTreeProps): UseModelsTreeResult {\n const [filteringError, setFilteringError] = useState<ModelsTreeFilteringError | undefined>(undefined);\n const [subTreeError, setSubTreeError] = useState<ModelsTreeSubTreeError | undefined>(undefined);\n const hierarchyConfiguration = useMemo<ModelsTreeHierarchyConfiguration>(\n () => ({\n ...defaultHierarchyConfiguration,\n ...hierarchyConfig,\n }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n Object.values(hierarchyConfig ?? {}),\n );\n const componentId = useGuid();\n const { onFeatureUsed } = useTelemetryContext();\n\n const { getCache: getModelsTreeIdsCache } = useIdsCache<ModelsTreeIdsCache, { hierarchyConfig: ModelsTreeHierarchyConfiguration }>({\n imodel: activeView.iModel,\n createCache,\n cacheSpecificProps: useMemo(() => ({ hierarchyConfig: hierarchyConfiguration }), [hierarchyConfiguration]),\n componentId,\n });\n\n const { visibilityHandlerFactory, onFilteredPathsChanged } = useCachedVisibility({\n activeView,\n overrides: visibilityHandlerOverrides,\n getModelsTreeIdsCache,\n componentId,\n });\n const { loadFocusedItems } = useFocusedInstancesContext();\n\n const getHierarchyDefinition = useCallback<VisibilityTreeProps[\"getHierarchyDefinition\"]>(\n ({ imodelAccess }) => new ModelsTreeDefinition({ imodelAccess, idsCache: getModelsTreeIdsCache(), hierarchyConfig: hierarchyConfiguration, componentId }),\n [getModelsTreeIdsCache, hierarchyConfiguration, componentId],\n );\n\n const onNodeDoubleClick = useCallback(\n async ({ nodeData, extendedData }: PresentationHierarchyNode) => {\n if (!HierarchyNode.isInstancesNode(nodeData) || (extendedData && (extendedData.isSubject || extendedData.isModel || extendedData.isCategory))) {\n return;\n }\n const instanceIds = nodeData.key.instanceKeys.map((instanceKey) => instanceKey.id);\n await IModelApp.viewManager.selectedView?.zoomToElements(instanceIds);\n onFeatureUsed({ featureId: \"zoom-to-node\", reportInteraction: false });\n },\n [onFeatureUsed],\n );\n\n const getSubTreePathsInternal = useMemo<\n ((...props: Parameters<Required<VisibilityTreeProps>[\"getFilteredPaths\"]>) => Promise<HierarchyNodeIdentifiersPath[]>) | undefined\n >(() => {\n if (!getSubTreePaths) {\n return undefined;\n }\n return async ({ imodelAccess, abortSignal }) => {\n try {\n const paths = await getSubTreePaths({\n createInstanceKeyPaths: async ({ targetItems }) =>\n ModelsTreeDefinition.createInstanceKeyPaths({\n imodelAccess,\n targetItems,\n idsCache: getModelsTreeIdsCache(),\n hierarchyConfig: hierarchyConfiguration,\n limit: \"unbounded\",\n abortSignal,\n componentId: `${componentId}/subTree`,\n }),\n });\n return paths.map(HierarchyFilteringPath.normalize).map(({ path }) => path);\n } catch (e) {\n const newError = \"unknownSubTreeError\";\n setSubTreeError(newError);\n return [];\n }\n };\n }, [getModelsTreeIdsCache, hierarchyConfiguration, getSubTreePaths, componentId]);\n\n const getPaths = useMemo<VisibilityTreeProps[\"getFilteredPaths\"] | undefined>(() => {\n setFilteringError(undefined);\n onModelsFiltered?.(undefined);\n\n // reset filtered paths if there is no filters applied. This allows to keep current filtered paths until new paths are loaded.\n if (!loadFocusedItems && !getFilteredPaths && !filter && !getSubTreePathsInternal) {\n onFilteredPathsChanged(undefined);\n }\n\n const handlePaths = async (filteredPaths: HierarchyFilteringPath[] | undefined, classInspector: ECClassHierarchyInspector) => {\n onFilteredPathsChanged(filteredPaths);\n if (!onModelsFiltered) {\n return;\n }\n\n const modelIds = filteredPaths ? await getModels(filteredPaths, getModelsTreeIdsCache(), classInspector) : undefined;\n onModelsFiltered(modelIds);\n };\n\n if (loadFocusedItems) {\n return async ({ imodelAccess, abortSignal }) => {\n try {\n const focusedItems = await collectFocusedItems(loadFocusedItems);\n return await createFilteringPathsResult({\n getFilteringPaths: async () => {\n const paths = await ModelsTreeDefinition.createInstanceKeyPaths({\n imodelAccess,\n idsCache: getModelsTreeIdsCache(),\n targetItems: focusedItems,\n hierarchyConfig: hierarchyConfiguration,\n abortSignal,\n componentId,\n });\n return paths.map(({ path, options }) => ({ path, options: { ...options, autoExpand: true } }));\n },\n getSubTreePaths: async () => (getSubTreePathsInternal ? getSubTreePathsInternal({ imodelAccess, abortSignal }) : undefined),\n handlePaths: async (paths) => handlePaths(paths, imodelAccess),\n });\n } catch (e) {\n const newError = e instanceof FilterLimitExceededError ? \"tooManyInstancesFocused\" : \"unknownInstanceFocusError\";\n if (newError !== \"tooManyInstancesFocused\") {\n const feature = e instanceof Error && e.message.includes(\"query too long to execute or server is too busy\") ? \"error-timeout\" : \"error-unknown\";\n onFeatureUsed({ featureId: feature, reportInteraction: false });\n }\n setFilteringError(newError);\n return [];\n }\n };\n }\n\n if (getFilteredPaths) {\n return async ({ imodelAccess, abortSignal }) => {\n try {\n return await createFilteringPathsResult({\n getFilteringPaths: async () => {\n const paths = await getFilteredPaths({\n createInstanceKeyPaths: async (props) =>\n ModelsTreeDefinition.createInstanceKeyPaths({\n ...props,\n imodelAccess,\n idsCache: getModelsTreeIdsCache(),\n hierarchyConfig: hierarchyConfiguration,\n limit: \"unbounded\",\n abortSignal,\n componentId,\n }),\n filter,\n });\n return paths?.map(HierarchyFilteringPath.normalize);\n },\n getSubTreePaths: async () => (getSubTreePathsInternal ? getSubTreePathsInternal({ imodelAccess, abortSignal }) : undefined),\n handlePaths: async (paths) => handlePaths(paths, imodelAccess),\n });\n } catch (e) {\n const newError = e instanceof FilterLimitExceededError ? \"tooManyFilterMatches\" : \"unknownFilterError\";\n if (newError !== \"tooManyFilterMatches\") {\n const feature = e instanceof Error && e.message.includes(\"query too long to execute or server is too busy\") ? \"error-timeout\" : \"error-unknown\";\n onFeatureUsed({ featureId: feature, reportInteraction: false });\n }\n setFilteringError(newError);\n return [];\n }\n };\n }\n\n if (filter) {\n return async ({ imodelAccess, abortSignal }) => {\n onFeatureUsed({ featureId: \"filtering\", reportInteraction: true });\n try {\n return await createFilteringPathsResult({\n getFilteringPaths: async () => {\n const paths = await ModelsTreeDefinition.createInstanceKeyPaths({\n imodelAccess,\n label: filter,\n idsCache: getModelsTreeIdsCache(),\n hierarchyConfig: hierarchyConfiguration,\n abortSignal,\n componentId,\n });\n return paths.map(({ path, options }) => ({ path, options: { ...options, autoExpand: true } }));\n },\n getSubTreePaths: async () => (getSubTreePathsInternal ? getSubTreePathsInternal({ imodelAccess, abortSignal }) : undefined),\n handlePaths: async (paths) => handlePaths(paths, imodelAccess),\n });\n } catch (e) {\n const newError = e instanceof FilterLimitExceededError ? \"tooManyFilterMatches\" : \"unknownFilterError\";\n if (newError !== \"tooManyFilterMatches\") {\n const feature = e instanceof Error && e.message.includes(\"query too long to execute or server is too busy\") ? \"error-timeout\" : \"error-unknown\";\n onFeatureUsed({ featureId: feature, reportInteraction: false });\n }\n setFilteringError(newError);\n return [];\n }\n };\n }\n return getSubTreePathsInternal;\n }, [\n filter,\n loadFocusedItems,\n getModelsTreeIdsCache,\n onFeatureUsed,\n getFilteredPaths,\n hierarchyConfiguration,\n onModelsFiltered,\n onFilteredPathsChanged,\n getSubTreePathsInternal,\n componentId,\n ]);\n\n const nodeSelectionPredicate = useCallback<NonNullable<VisibilityTreeProps[\"selectionPredicate\"]>>(\n (node) => {\n if (!nodeTypeSelectionPredicate) {\n return true;\n }\n return nodeTypeSelectionPredicate({ node, type: ModelsTreeNode.getType(node.nodeData) });\n },\n [nodeTypeSelectionPredicate],\n );\n\n return {\n modelsTreeProps: {\n treeName: \"models-tree-v2\",\n visibilityHandlerFactory,\n getHierarchyDefinition,\n getFilteredPaths: getPaths,\n noDataMessage: getNoDataMessage(filter, subTreeError, filteringError),\n highlight: filter ? { text: filter } : undefined,\n selectionPredicate: nodeSelectionPredicate,\n },\n rendererProps: {\n onNodeDoubleClick,\n getIcon,\n },\n };\n}\n\nasync function getModels(paths: HierarchyFilteringPath[], idsCache: ModelsTreeIdsCache, classInspector: ECClassHierarchyInspector) {\n if (!paths) {\n return undefined;\n }\n\n const targetModels = new Set<Id64String>();\n const targetSubjects = new Set<Id64String>();\n for (const path of paths) {\n const currPath = Array.isArray(path) ? path : path.path;\n for (let i = 0; i < currPath.length; i++) {\n const currStep = currPath[i];\n if (!HierarchyNodeIdentifier.isInstanceNodeIdentifier(currStep)) {\n break;\n }\n\n // if paths end with subject need to get all models under that subject\n if (i === currPath.length - 1 && currStep.className === \"BisCore.Subject\") {\n targetSubjects.add(currStep.id);\n break;\n }\n\n // collect all the models from the filtered path\n if (await classInspector.classDerivesFrom(currStep.className, \"BisCore.GeometricModel3d\")) {\n targetModels.add(currStep.id);\n }\n }\n }\n\n const matchingModels = await firstValueFrom(idsCache.getSubjectModelIds([...targetSubjects]));\n return [...targetModels, ...matchingModels];\n}\n\nfunction getNoDataMessage(filter?: string, subTreeError?: ModelsTreeSubTreeError, filteringError?: ModelsTreeFilteringError) {\n if (isSubTreeError(subTreeError)) {\n return <Text>{TreeWidget.translate(`modelsTree.subTree.${subTreeError}`)}</Text>;\n }\n if (isInstanceFocusError(filteringError)) {\n return <InstanceFocusError error={filteringError} />;\n }\n if (isFilterError(filteringError)) {\n return <Text>{TreeWidget.translate(`modelsTree.filtering.${filteringError}`)}</Text>;\n }\n if (filter) {\n return <Text>{TreeWidget.translate(\"modelsTree.filtering.noMatches\", { filter })}</Text>;\n }\n return undefined;\n}\n\nfunction isSubTreeError(error: ModelsTreeSubTreeError | undefined) {\n return error === \"unknownSubTreeError\";\n}\n\nfunction isFilterError(error: ModelsTreeFilteringError | undefined) {\n return error === \"tooManyFilterMatches\" || error === \"unknownFilterError\";\n}\n\nfunction isInstanceFocusError(error: ModelsTreeFilteringError | undefined) {\n return error === \"tooManyInstancesFocused\" || error === \"unknownInstanceFocusError\";\n}\n\nfunction InstanceFocusError({ error }: { error: ModelsTreeFilteringError }) {\n const { toggle } = useFocusedInstancesContext();\n const localizedMessage = createLocalizedMessage(TreeWidget.translate(`modelsTree.filtering.${error}`), () => toggle());\n return <Text>{localizedMessage}</Text>;\n}\n\nfunction getIcon(node: PresentationHierarchyNode): ReactElement | undefined {\n if (node.extendedData?.imageId === undefined) {\n return undefined;\n }\n\n switch (node.extendedData.imageId) {\n case \"icon-layers\":\n return <SvgLayers />;\n case \"icon-item\":\n return <SvgItem />;\n case \"icon-ec-class\":\n return <SvgClassGrouping />;\n case \"icon-imodel-hollow-2\":\n return <SvgImodelHollow />;\n case \"icon-folder\":\n return <SvgFolder />;\n case \"icon-model\":\n return <SvgModel />;\n }\n\n return undefined;\n}\n\nfunction createVisibilityHandlerFactory(props: {\n activeView: Viewport;\n idsCacheGetter: () => ModelsTreeIdsCache;\n overrides?: ModelsTreeVisibilityHandlerOverrides;\n filteredPaths?: HierarchyFilteringPath[];\n componentId: GuidString;\n}): VisibilityTreeProps[\"visibilityHandlerFactory\"] {\n const { activeView, componentId, idsCacheGetter, filteredPaths, overrides } = props;\n return ({ imodelAccess }) =>\n createModelsTreeVisibilityHandler({ viewport: activeView, idsCache: idsCacheGetter(), imodelAccess, overrides, filteredPaths, componentId });\n}\n\nfunction useCachedVisibility(props: {\n activeView: Viewport;\n getModelsTreeIdsCache: () => ModelsTreeIdsCache;\n overrides?: ModelsTreeVisibilityHandlerOverrides;\n componentId: GuidString;\n}) {\n const { activeView, getModelsTreeIdsCache, overrides, componentId } = props;\n const currentIModelRef = useRef(activeView.iModel);\n\n const [filteredPaths, setFilteredPaths] = useState<HierarchyFilteringPath[]>();\n const [visibilityHandlerFactory, setVisibilityHandlerFactory] = useState<VisibilityTreeProps[\"visibilityHandlerFactory\"]>(() =>\n createVisibilityHandlerFactory({ activeView, idsCacheGetter: getModelsTreeIdsCache, overrides, filteredPaths, componentId }),\n );\n\n useEffect(() => {\n currentIModelRef.current = activeView.iModel;\n setVisibilityHandlerFactory(() =>\n createVisibilityHandlerFactory({ activeView, idsCacheGetter: getModelsTreeIdsCache, overrides, filteredPaths, componentId }),\n );\n }, [activeView, getModelsTreeIdsCache, overrides, filteredPaths, componentId]);\n\n return {\n visibilityHandlerFactory,\n onFilteredPathsChanged: useCallback((paths: HierarchyFilteringPath[] | undefined) => setFilteredPaths(paths), []),\n };\n}\n\nfunction SvgClassGrouping() {\n return (\n <svg id=\"Calque_1\" data-name=\"Calque 1\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\">\n <path d=\"M8.00933,0,0,3.97672V11.986L8.00933,16,16,11.93V3.97651ZM1.66173,11.27642c-.26155.03734-.59754-.26154-.76553-.69085-.168-.41066-.09334-.784.168-.82152.26154-.03734.59754.26154.76553.67219C1.99772,10.86577,1.92306,11.23909,1.66173,11.27642Zm0-3.32319c-.26155.03733-.59754-.28-.76553-.69086-.168-.42932-.09334-.80285.168-.84.26133-.03733.59754.28.76532.69086C1.99772,7.54236,1.92306,7.89723,1.66173,7.95323Zm4.31276,5.52621a.18186.18186,0,0,1-.16821-.01866L3.41657,12.15394a.94275.94275,0,0,1-.29887-.80285c.03754-.33621.22421-.52265.41108-.41066L5.9185,12.24727a.88656.88656,0,0,1,.28.80285A.5057.5057,0,0,1,5.97449,13.47944Zm0-3.37919a.18184.18184,0,0,1-.16821-.01867L3.41657,8.77475a.943.943,0,0,1-.29887-.80286c.03754-.3362.22421-.52286.41108-.42953L5.9185,8.86786a.83112.83112,0,0,1,.28.78419A.51684.51684,0,0,1,5.97449,10.10025Z\" />\n </svg>\n );\n}\n\nasync function collectFocusedItems(loadFocusedItems: () => AsyncIterableIterator<InstanceKey | GroupingHierarchyNode>) {\n const focusedItems: Array<InstanceKey | ElementsGroupInfo> = [];\n const groupingNodeInfos: Array<{\n parentKey: InstancesNodeKey;\n parentType: \"element\" | \"category\";\n groupingNode: ClassGroupingHierarchyNode;\n modelIds: Id64String[];\n }> = [];\n for await (const key of loadFocusedItems()) {\n if (\"id\" in key) {\n focusedItems.push(key);\n continue;\n }\n\n if (!HierarchyNodeKey.isClassGrouping(key.key)) {\n continue;\n }\n\n const groupingNode = key as ClassGroupingHierarchyNode;\n if (!groupingNode.nonGroupingAncestor || !HierarchyNodeKey.isInstances(groupingNode.nonGroupingAncestor.key)) {\n continue;\n }\n\n const parentKey = groupingNode.nonGroupingAncestor.key;\n const type = groupingNode.nonGroupingAncestor.extendedData?.isCategory ? \"category\" : \"element\";\n const modelIds = ((groupingNode.nonGroupingAncestor.extendedData?.modelIds as Id64String[][]) ?? []).flatMap((ids) => ids);\n groupingNodeInfos.push({ groupingNode, parentType: type, parentKey, modelIds });\n }\n focusedItems.push(\n ...groupingNodeInfos.map(({ parentKey, parentType, groupingNode, modelIds }) => ({\n parent:\n parentType === \"element\"\n ? { type: \"element\" as const, ids: parentKey.instanceKeys.map((key) => key.id) }\n : { type: \"category\" as const, ids: parentKey.instanceKeys.map((key) => key.id), modelIds },\n groupingNode,\n })),\n );\n return focusedItems;\n}\n\nfunction createLocalizedMessage(message: string, onClick?: () => void) {\n const exp = new RegExp(\"<link>(.*)</link>\");\n const match = message.match(exp);\n if (!match) {\n return message;\n }\n\n const [fullText, innerText] = match;\n const [textBefore, textAfter] = message.split(fullText);\n\n return (\n <>\n {textBefore ? textBefore : null}\n <Anchor\n underline\n onClick={(e) => {\n e.stopPropagation();\n onClick?.();\n }}\n >\n {innerText}\n </Anchor>\n {textAfter ? textAfter : null}\n </>\n );\n}\n\nasync function createFilteringPathsResult({\n getSubTreePaths,\n getFilteringPaths,\n handlePaths,\n}: {\n getSubTreePaths: () => Promise<HierarchyNodeIdentifiersPath[] | undefined>;\n getFilteringPaths: () => Promise<NormalizedHierarchyFilteringPath[] | undefined>;\n handlePaths: (filteredPaths: HierarchyFilteringPath[] | undefined) => Promise<void>;\n}): Promise<HierarchyFilteringPath[] | undefined> {\n const [subTreePaths, filterPaths] = await Promise.all([getSubTreePaths(), getFilteringPaths()]);\n let joinedPaths: HierarchyFilteringPath[] | undefined;\n try {\n if (subTreePaths && filterPaths) {\n return (joinedPaths = joinHierarchyFilteringPaths(subTreePaths, filterPaths));\n }\n if (subTreePaths) {\n return (joinedPaths = subTreePaths);\n }\n if (filterPaths) {\n return (joinedPaths = filterPaths);\n }\n } finally {\n void handlePaths(joinedPaths);\n }\n return joinedPaths;\n}\n\nfunction createCache(props: CreateCacheProps<{ hierarchyConfig: ModelsTreeHierarchyConfiguration }>) {\n return new ModelsTreeIdsCache(createECSqlQueryExecutor(props.imodel), props.specificProps.hierarchyConfig);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"UseModelsTree.js","sourceRoot":"","sources":["../../../../../../src/tree-widget-react/components/trees/models-tree/UseModelsTree.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,MAAM,CAAC;AACtC,OAAO,EAAE,SA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B,WAAW,GAKZ;IACC,MAAM,CAAC,YAAY,EAAE,WAAW,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,eAAe,EAAE,EAAE,iBAAiB,EAAE,CAAC,CAAC,CAAC;IAChG,IAAI,WAAiD,CAAC;IACtD,IAAI,CAAC;QACH,IAAI,YAAY,IAAI,WAAW,EAAE,CAAC;YAChC,OAAO,CAAC,WAAW,GAAG,2BAA2B,CAAC,YAAY,EAAE,WAAW,CAAC,CAAC,CAAC;QAChF,CAAC;QACD,IAAI,YAAY,EAAE,CAAC;YACjB,OAAO,CAAC,WAAW,GAAG,YAAY,CAAC,CAAC;QACtC,CAAC;QACD,IAAI,WAAW,EAAE,CAAC;YAChB,OAAO,CAAC,WAAW,GAAG,WAAW,CAAC,CAAC;QACrC,CAAC;IACH,CAAC;YAAS,CAAC;QACT,KAAK,WAAW,CAAC,WAAW,CAAC,CAAC;IAChC,CAAC;IACD,OAAO,WAAW,CAAC;AACrB,CAAC;AAED,SAAS,WAAW,CAAC,KAA8E;IACjG,OAAO,IAAI,kBAAkB,CAAC,wBAAwB,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,eAAe,CAAC,CAAC;AAC7G,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 *--------------------------------------------------------------------------------------------*/\n\nimport { useCallback, useEffect, useMemo, useRef, useState } from \"react\";\nimport { firstValueFrom } from \"rxjs\";\nimport { IModelApp } from \"@itwin/core-frontend\";\nimport { SvgFolder, SvgImodelHollow, SvgItem, SvgLayers, SvgModel } from \"@itwin/itwinui-icons-react\";\nimport { Anchor, Text } from \"@itwin/itwinui-react\";\nimport { createECSqlQueryExecutor } from \"@itwin/presentation-core-interop\";\nimport { HierarchyFilteringPath, HierarchyNode, HierarchyNodeIdentifier, HierarchyNodeKey } from \"@itwin/presentation-hierarchies\";\nimport { TreeWidget } from \"../../../TreeWidget.js\";\nimport { useFocusedInstancesContext } from \"../common/FocusedInstancesContext.js\";\nimport { useIdsCache } from \"../common/internal/useTreeHooks/UseIdsCache.js\";\nimport { FilterLimitExceededError } from \"../common/TreeErrors.js\";\nimport { useGuid } from \"../common/useGuid.js\";\nimport { useTelemetryContext } from \"../common/UseTelemetryContext.js\";\nimport { joinHierarchyFilteringPaths } from \"../common/Utils.js\";\nimport { ModelsTreeIdsCache } from \"./internal/ModelsTreeIdsCache.js\";\nimport { ModelsTreeNode } from \"./internal/ModelsTreeNode.js\";\nimport { createModelsTreeVisibilityHandler } from \"./internal/ModelsTreeVisibilityHandler.js\";\nimport { defaultHierarchyConfiguration, ModelsTreeDefinition } from \"./ModelsTreeDefinition.js\";\n\nimport type { ReactElement } from \"react\";\nimport type { GuidString, Id64String } from \"@itwin/core-bentley\";\nimport type { Viewport } from \"@itwin/core-frontend\";\nimport type { GroupingHierarchyNode, HierarchyNodeIdentifiersPath, InstancesNodeKey } from \"@itwin/presentation-hierarchies\";\nimport type { PresentationHierarchyNode } from \"@itwin/presentation-hierarchies-react\";\nimport type { ECClassHierarchyInspector, InstanceKey } from \"@itwin/presentation-shared\";\nimport type { VisibilityTreeProps } from \"../common/components/VisibilityTree.js\";\nimport type { VisibilityTreeRendererProps } from \"../common/components/VisibilityTreeRenderer.js\";\nimport type { CreateCacheProps } from \"../common/internal/useTreeHooks/UseIdsCache.js\";\nimport type { NormalizedHierarchyFilteringPath } from \"../common/Utils.js\";\nimport type { ModelsTreeVisibilityHandlerOverrides } from \"./internal/ModelsTreeVisibilityHandler.js\";\nimport type { ClassGroupingHierarchyNode, ElementsGroupInfo, ModelsTreeHierarchyConfiguration } from \"./ModelsTreeDefinition.js\";\n\ntype ModelsTreeFilteringError = \"tooManyFilterMatches\" | \"tooManyInstancesFocused\" | \"unknownFilterError\" | \"unknownInstanceFocusError\";\ntype ModelsTreeSubTreeError = \"unknownSubTreeError\";\n\n/** @beta */\nexport interface UseModelsTreeProps {\n /**\n * Optional search string used to filter tree nodes by label, as well as highlight matching substrings in the tree.\n * Nodes that do not contain this string in their label will be filtered out.\n *\n * If `getFilteredPaths` function is provided, it will take precedence and automatic filtering by this string will not be applied.\n * Instead, the string will be supplied to the given `getFilteredPaths` function for consumers to apply the filtering.\n */\n filter?: string;\n activeView: Viewport;\n hierarchyConfig?: Partial<ModelsTreeHierarchyConfiguration>;\n visibilityHandlerOverrides?: ModelsTreeVisibilityHandlerOverrides;\n /**\n * Optional function for applying custom filtering on the hierarchy. Use it when you want full control over which nodes should be displayed, based on more complex logic or known instance keys.\n *\n * When defined, this function takes precedence over filtering by `filter` string. If both are supplied, the `filter` is provided as an argument to `getFilteredPaths`.\n *\n * @param props Parameters provided when `getFilteredPaths` is called:\n * - `createInstanceKeyPaths`: Helper function to create filter paths.\n * - `filter`: The filter string which would otherwise be used for default filtering.\n *\n * **Example use cases:**\n * - You have a list of `InstanceKey` items, which you want to use for filtering the hierarchy.\n * - You want to create filter paths based on node label, but also apply some extra conditions (for example exclude paths with sub-models).\n * - You want to construct custom filtered paths. For example: create a filter path for each geometric element which has a parent element.\n *\n * @note Paths returned by `createInstanceKeyPaths` will not have `autoExpand` flag set. If you want nodes to be expanded, iterate over the paths and\n * set `autoExpand: true` manually.\n */\n getFilteredPaths?: (props: {\n /** A function that creates filtering paths based on provided target instance keys or node label. */\n createInstanceKeyPaths: (props: { targetItems: Array<InstanceKey | ElementsGroupInfo> } | { label: string }) => Promise<NormalizedHierarchyFilteringPath[]>;\n /** Filter which would be used to create filter paths if `getFilteredPaths` wouldn't be provided. */\n filter?: string;\n }) => Promise<HierarchyFilteringPath[] | undefined>;\n /**\n * Optional function for restricting the visible hierarchy to a specific sub-tree of nodes, without changing how filtering works.\n *\n * Use when you want to display only part of the hierarchy, but still allow normal filtering within that sub-tree.\n *\n * When defined, only nodes that are in the provided paths or children of target nodes will be part of the hierarchy.\n * Filtering (by label or custom logic) will still apply within this sub-tree.\n *\n * Key difference:\n * - `getFilteredPaths` determines which nodes should be shown, giving you full control over filtering logic.\n * - `getSubTreePaths` restricts the hierarchy to a sub-tree, but does not override the filtering logic — filtering is still applied within the restricted sub-tree.\n */\n getSubTreePaths?: (props: {\n /** A function that creates filtering paths based on provided target instance keys. */\n createInstanceKeyPaths: (props: { targetItems: Array<InstanceKey | ElementsGroupInfo> }) => Promise<NormalizedHierarchyFilteringPath[]>;\n }) => Promise<HierarchyFilteringPath[]>;\n onModelsFiltered?: (modelIds: Id64String[] | undefined) => void;\n /**\n * An optional predicate to allow or prohibit selection of a node.\n * When not supplied, all nodes are selectable.\n */\n selectionPredicate?: (props: { node: PresentationHierarchyNode; type: \"subject\" | \"model\" | \"category\" | \"element\" | \"elements-class-group\" }) => boolean;\n}\n\n/** @beta */\ninterface UseModelsTreeResult {\n modelsTreeProps: Pick<\n VisibilityTreeProps,\n \"treeName\" | \"getHierarchyDefinition\" | \"getFilteredPaths\" | \"visibilityHandlerFactory\" | \"highlight\" | \"noDataMessage\" | \"selectionPredicate\"\n >;\n rendererProps: Required<Pick<VisibilityTreeRendererProps, \"getIcon\" | \"onNodeDoubleClick\">>;\n}\n\n/**\n * Custom hook to create and manage state for the models tree.\n * @beta\n */\nexport function useModelsTree({\n activeView,\n filter,\n hierarchyConfig,\n visibilityHandlerOverrides,\n getFilteredPaths,\n onModelsFiltered,\n selectionPredicate: nodeTypeSelectionPredicate,\n getSubTreePaths,\n}: UseModelsTreeProps): UseModelsTreeResult {\n const [filteringError, setFilteringError] = useState<ModelsTreeFilteringError | undefined>(undefined);\n const [subTreeError, setSubTreeError] = useState<ModelsTreeSubTreeError | undefined>(undefined);\n const hierarchyConfiguration = useMemo<ModelsTreeHierarchyConfiguration>(\n () => ({\n ...defaultHierarchyConfiguration,\n ...hierarchyConfig,\n }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n Object.values(hierarchyConfig ?? {}),\n );\n const componentId = useGuid();\n const { onFeatureUsed } = useTelemetryContext();\n\n const { getCache: getModelsTreeIdsCache } = useIdsCache<ModelsTreeIdsCache, { hierarchyConfig: ModelsTreeHierarchyConfiguration }>({\n imodel: activeView.iModel,\n createCache,\n cacheSpecificProps: useMemo(() => ({ hierarchyConfig: hierarchyConfiguration }), [hierarchyConfiguration]),\n componentId,\n });\n\n const { visibilityHandlerFactory, onFilteredPathsChanged } = useCachedVisibility({\n activeView,\n overrides: visibilityHandlerOverrides,\n getModelsTreeIdsCache,\n componentId,\n });\n const { loadFocusedItems } = useFocusedInstancesContext();\n\n const getHierarchyDefinition = useCallback<VisibilityTreeProps[\"getHierarchyDefinition\"]>(\n ({ imodelAccess }) => new ModelsTreeDefinition({ imodelAccess, idsCache: getModelsTreeIdsCache(), hierarchyConfig: hierarchyConfiguration, componentId }),\n [getModelsTreeIdsCache, hierarchyConfiguration, componentId],\n );\n\n const onNodeDoubleClick = useCallback(\n async ({ nodeData, extendedData }: PresentationHierarchyNode) => {\n if (!HierarchyNode.isInstancesNode(nodeData) || (extendedData && (extendedData.isSubject || extendedData.isModel || extendedData.isCategory))) {\n return;\n }\n const instanceIds = nodeData.key.instanceKeys.map((instanceKey) => instanceKey.id);\n await IModelApp.viewManager.selectedView?.zoomToElements(instanceIds);\n onFeatureUsed({ featureId: \"zoom-to-node\", reportInteraction: false });\n },\n [onFeatureUsed],\n );\n\n const getSubTreePathsInternal = useMemo<\n ((...props: Parameters<Required<VisibilityTreeProps>[\"getFilteredPaths\"]>) => Promise<HierarchyNodeIdentifiersPath[]>) | undefined\n >(() => {\n if (!getSubTreePaths) {\n return undefined;\n }\n return async ({ imodelAccess, abortSignal }) => {\n try {\n setSubTreeError(undefined);\n const paths = await getSubTreePaths({\n createInstanceKeyPaths: async ({ targetItems }) =>\n ModelsTreeDefinition.createInstanceKeyPaths({\n imodelAccess,\n targetItems,\n idsCache: getModelsTreeIdsCache(),\n hierarchyConfig: hierarchyConfiguration,\n limit: \"unbounded\",\n abortSignal,\n componentId: `${componentId}/subTree`,\n }),\n });\n return paths.map(HierarchyFilteringPath.normalize).map(({ path }) => path);\n } catch (e) {\n const newError = \"unknownSubTreeError\";\n setSubTreeError(newError);\n return [];\n }\n };\n }, [getModelsTreeIdsCache, hierarchyConfiguration, getSubTreePaths, componentId]);\n\n useEffect(() => {\n // reset filtered paths if there is no filters applied. This allows to keep current filtered paths until new paths are loaded.\n if (!loadFocusedItems && !getFilteredPaths && !filter && !getSubTreePathsInternal) {\n onFilteredPathsChanged(undefined);\n setFilteringError(undefined);\n onModelsFiltered?.(undefined);\n }\n }, [loadFocusedItems, getFilteredPaths, filter, getSubTreePathsInternal, onFilteredPathsChanged, onModelsFiltered]);\n\n const getPaths = useMemo<VisibilityTreeProps[\"getFilteredPaths\"] | undefined>(() => {\n const handlePaths = async (filteredPaths: HierarchyFilteringPath[] | undefined, classInspector: ECClassHierarchyInspector) => {\n onFilteredPathsChanged(filteredPaths);\n if (!onModelsFiltered) {\n return;\n }\n\n const modelIds = filteredPaths ? await getModels(filteredPaths, getModelsTreeIdsCache(), classInspector) : undefined;\n onModelsFiltered(modelIds);\n };\n\n if (loadFocusedItems) {\n return async ({ imodelAccess, abortSignal }) => {\n try {\n setFilteringError(undefined);\n const focusedItems = await collectFocusedItems(loadFocusedItems);\n return await createFilteringPathsResult({\n getFilteringPaths: async () => {\n const paths = await ModelsTreeDefinition.createInstanceKeyPaths({\n imodelAccess,\n idsCache: getModelsTreeIdsCache(),\n targetItems: focusedItems,\n hierarchyConfig: hierarchyConfiguration,\n abortSignal,\n componentId,\n });\n return paths.map(({ path, options }) => ({ path, options: { ...options, autoExpand: true } }));\n },\n getSubTreePaths: async () => (getSubTreePathsInternal ? getSubTreePathsInternal({ imodelAccess, abortSignal }) : undefined),\n handlePaths: async (paths) => handlePaths(paths, imodelAccess),\n });\n } catch (e) {\n const newError = e instanceof FilterLimitExceededError ? \"tooManyInstancesFocused\" : \"unknownInstanceFocusError\";\n if (newError !== \"tooManyInstancesFocused\") {\n const feature = e instanceof Error && e.message.includes(\"query too long to execute or server is too busy\") ? \"error-timeout\" : \"error-unknown\";\n onFeatureUsed({ featureId: feature, reportInteraction: false });\n }\n setFilteringError(newError);\n return [];\n }\n };\n }\n\n if (getFilteredPaths) {\n return async ({ imodelAccess, abortSignal }) => {\n try {\n setFilteringError(undefined);\n return await createFilteringPathsResult({\n getFilteringPaths: async () => {\n const paths = await getFilteredPaths({\n createInstanceKeyPaths: async (props) =>\n ModelsTreeDefinition.createInstanceKeyPaths({\n ...props,\n imodelAccess,\n idsCache: getModelsTreeIdsCache(),\n hierarchyConfig: hierarchyConfiguration,\n limit: \"unbounded\",\n abortSignal,\n componentId,\n }),\n filter,\n });\n return paths?.map(HierarchyFilteringPath.normalize);\n },\n getSubTreePaths: async () => (getSubTreePathsInternal ? getSubTreePathsInternal({ imodelAccess, abortSignal }) : undefined),\n handlePaths: async (paths) => handlePaths(paths, imodelAccess),\n });\n } catch (e) {\n const newError = e instanceof FilterLimitExceededError ? \"tooManyFilterMatches\" : \"unknownFilterError\";\n if (newError !== \"tooManyFilterMatches\") {\n const feature = e instanceof Error && e.message.includes(\"query too long to execute or server is too busy\") ? \"error-timeout\" : \"error-unknown\";\n onFeatureUsed({ featureId: feature, reportInteraction: false });\n }\n setFilteringError(newError);\n return [];\n }\n };\n }\n\n if (filter) {\n return async ({ imodelAccess, abortSignal }) => {\n onFeatureUsed({ featureId: \"filtering\", reportInteraction: true });\n try {\n setFilteringError(undefined);\n return await createFilteringPathsResult({\n getFilteringPaths: async () => {\n const paths = await ModelsTreeDefinition.createInstanceKeyPaths({\n imodelAccess,\n label: filter,\n idsCache: getModelsTreeIdsCache(),\n hierarchyConfig: hierarchyConfiguration,\n abortSignal,\n componentId,\n });\n return paths.map(({ path, options }) => ({ path, options: { ...options, autoExpand: true } }));\n },\n getSubTreePaths: async () => (getSubTreePathsInternal ? getSubTreePathsInternal({ imodelAccess, abortSignal }) : undefined),\n handlePaths: async (paths) => handlePaths(paths, imodelAccess),\n });\n } catch (e) {\n const newError = e instanceof FilterLimitExceededError ? \"tooManyFilterMatches\" : \"unknownFilterError\";\n if (newError !== \"tooManyFilterMatches\") {\n const feature = e instanceof Error && e.message.includes(\"query too long to execute or server is too busy\") ? \"error-timeout\" : \"error-unknown\";\n onFeatureUsed({ featureId: feature, reportInteraction: false });\n }\n setFilteringError(newError);\n return [];\n }\n };\n }\n return getSubTreePathsInternal;\n }, [\n filter,\n loadFocusedItems,\n getModelsTreeIdsCache,\n onFeatureUsed,\n getFilteredPaths,\n hierarchyConfiguration,\n onModelsFiltered,\n onFilteredPathsChanged,\n getSubTreePathsInternal,\n componentId,\n ]);\n\n const nodeSelectionPredicate = useCallback<NonNullable<VisibilityTreeProps[\"selectionPredicate\"]>>(\n (node) => {\n if (!nodeTypeSelectionPredicate) {\n return true;\n }\n return nodeTypeSelectionPredicate({ node, type: ModelsTreeNode.getType(node.nodeData) });\n },\n [nodeTypeSelectionPredicate],\n );\n\n return {\n modelsTreeProps: {\n treeName: \"models-tree-v2\",\n visibilityHandlerFactory,\n getHierarchyDefinition,\n getFilteredPaths: getPaths,\n noDataMessage: getNoDataMessage(filter, subTreeError, filteringError),\n highlight: filter ? { text: filter } : undefined,\n selectionPredicate: nodeSelectionPredicate,\n },\n rendererProps: {\n onNodeDoubleClick,\n getIcon,\n },\n };\n}\n\nasync function getModels(paths: HierarchyFilteringPath[], idsCache: ModelsTreeIdsCache, classInspector: ECClassHierarchyInspector) {\n if (!paths) {\n return undefined;\n }\n\n const targetModels = new Set<Id64String>();\n const targetSubjects = new Set<Id64String>();\n for (const path of paths) {\n const currPath = Array.isArray(path) ? path : path.path;\n for (let i = 0; i < currPath.length; i++) {\n const currStep = currPath[i];\n if (!HierarchyNodeIdentifier.isInstanceNodeIdentifier(currStep)) {\n break;\n }\n\n // if paths end with subject need to get all models under that subject\n if (i === currPath.length - 1 && currStep.className === \"BisCore.Subject\") {\n targetSubjects.add(currStep.id);\n break;\n }\n\n // collect all the models from the filtered path\n if (await classInspector.classDerivesFrom(currStep.className, \"BisCore.GeometricModel3d\")) {\n targetModels.add(currStep.id);\n }\n }\n }\n\n const matchingModels = await firstValueFrom(idsCache.getSubjectModelIds([...targetSubjects]));\n return [...targetModels, ...matchingModels];\n}\n\nfunction getNoDataMessage(filter?: string, subTreeError?: ModelsTreeSubTreeError, filteringError?: ModelsTreeFilteringError) {\n if (isSubTreeError(subTreeError)) {\n return <Text>{TreeWidget.translate(`modelsTree.subTree.${subTreeError}`)}</Text>;\n }\n if (isInstanceFocusError(filteringError)) {\n return <InstanceFocusError error={filteringError} />;\n }\n if (isFilterError(filteringError)) {\n return <Text>{TreeWidget.translate(`modelsTree.filtering.${filteringError}`)}</Text>;\n }\n if (filter) {\n return <Text>{TreeWidget.translate(\"modelsTree.filtering.noMatches\", { filter })}</Text>;\n }\n return undefined;\n}\n\nfunction isSubTreeError(error: ModelsTreeSubTreeError | undefined) {\n return error === \"unknownSubTreeError\";\n}\n\nfunction isFilterError(error: ModelsTreeFilteringError | undefined) {\n return error === \"tooManyFilterMatches\" || error === \"unknownFilterError\";\n}\n\nfunction isInstanceFocusError(error: ModelsTreeFilteringError | undefined) {\n return error === \"tooManyInstancesFocused\" || error === \"unknownInstanceFocusError\";\n}\n\nfunction InstanceFocusError({ error }: { error: ModelsTreeFilteringError }) {\n const { toggle } = useFocusedInstancesContext();\n const localizedMessage = createLocalizedMessage(TreeWidget.translate(`modelsTree.filtering.${error}`), () => toggle());\n return <Text>{localizedMessage}</Text>;\n}\n\nfunction getIcon(node: PresentationHierarchyNode): ReactElement | undefined {\n if (node.extendedData?.imageId === undefined) {\n return undefined;\n }\n\n switch (node.extendedData.imageId) {\n case \"icon-layers\":\n return <SvgLayers />;\n case \"icon-item\":\n return <SvgItem />;\n case \"icon-ec-class\":\n return <SvgClassGrouping />;\n case \"icon-imodel-hollow-2\":\n return <SvgImodelHollow />;\n case \"icon-folder\":\n return <SvgFolder />;\n case \"icon-model\":\n return <SvgModel />;\n }\n\n return undefined;\n}\n\nfunction createVisibilityHandlerFactory(props: {\n activeView: Viewport;\n idsCacheGetter: () => ModelsTreeIdsCache;\n overrides?: ModelsTreeVisibilityHandlerOverrides;\n filteredPaths?: HierarchyFilteringPath[];\n componentId: GuidString;\n}): VisibilityTreeProps[\"visibilityHandlerFactory\"] {\n const { activeView, componentId, idsCacheGetter, filteredPaths, overrides } = props;\n return ({ imodelAccess }) =>\n createModelsTreeVisibilityHandler({ viewport: activeView, idsCache: idsCacheGetter(), imodelAccess, overrides, filteredPaths, componentId });\n}\n\nfunction useCachedVisibility(props: {\n activeView: Viewport;\n getModelsTreeIdsCache: () => ModelsTreeIdsCache;\n overrides?: ModelsTreeVisibilityHandlerOverrides;\n componentId: GuidString;\n}) {\n const { activeView, getModelsTreeIdsCache, overrides, componentId } = props;\n const currentIModelRef = useRef(activeView.iModel);\n\n const [filteredPaths, setFilteredPaths] = useState<HierarchyFilteringPath[]>();\n const [visibilityHandlerFactory, setVisibilityHandlerFactory] = useState<VisibilityTreeProps[\"visibilityHandlerFactory\"]>(() =>\n createVisibilityHandlerFactory({ activeView, idsCacheGetter: getModelsTreeIdsCache, overrides, filteredPaths, componentId }),\n );\n\n useEffect(() => {\n currentIModelRef.current = activeView.iModel;\n setVisibilityHandlerFactory(() =>\n createVisibilityHandlerFactory({ activeView, idsCacheGetter: getModelsTreeIdsCache, overrides, filteredPaths, componentId }),\n );\n }, [activeView, getModelsTreeIdsCache, overrides, filteredPaths, componentId]);\n\n return {\n visibilityHandlerFactory,\n onFilteredPathsChanged: useCallback((paths: HierarchyFilteringPath[] | undefined) => setFilteredPaths(paths), []),\n };\n}\n\nfunction SvgClassGrouping() {\n return (\n <svg id=\"Calque_1\" data-name=\"Calque 1\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\">\n <path d=\"M8.00933,0,0,3.97672V11.986L8.00933,16,16,11.93V3.97651ZM1.66173,11.27642c-.26155.03734-.59754-.26154-.76553-.69085-.168-.41066-.09334-.784.168-.82152.26154-.03734.59754.26154.76553.67219C1.99772,10.86577,1.92306,11.23909,1.66173,11.27642Zm0-3.32319c-.26155.03733-.59754-.28-.76553-.69086-.168-.42932-.09334-.80285.168-.84.26133-.03733.59754.28.76532.69086C1.99772,7.54236,1.92306,7.89723,1.66173,7.95323Zm4.31276,5.52621a.18186.18186,0,0,1-.16821-.01866L3.41657,12.15394a.94275.94275,0,0,1-.29887-.80285c.03754-.33621.22421-.52265.41108-.41066L5.9185,12.24727a.88656.88656,0,0,1,.28.80285A.5057.5057,0,0,1,5.97449,13.47944Zm0-3.37919a.18184.18184,0,0,1-.16821-.01867L3.41657,8.77475a.943.943,0,0,1-.29887-.80286c.03754-.3362.22421-.52286.41108-.42953L5.9185,8.86786a.83112.83112,0,0,1,.28.78419A.51684.51684,0,0,1,5.97449,10.10025Z\" />\n </svg>\n );\n}\n\nasync function collectFocusedItems(loadFocusedItems: () => AsyncIterableIterator<InstanceKey | GroupingHierarchyNode>) {\n const focusedItems: Array<InstanceKey | ElementsGroupInfo> = [];\n const groupingNodeInfos: Array<{\n parentKey: InstancesNodeKey;\n parentType: \"element\" | \"category\";\n groupingNode: ClassGroupingHierarchyNode;\n modelIds: Id64String[];\n }> = [];\n for await (const key of loadFocusedItems()) {\n if (\"id\" in key) {\n focusedItems.push(key);\n continue;\n }\n\n if (!HierarchyNodeKey.isClassGrouping(key.key)) {\n continue;\n }\n\n const groupingNode = key as ClassGroupingHierarchyNode;\n if (!groupingNode.nonGroupingAncestor || !HierarchyNodeKey.isInstances(groupingNode.nonGroupingAncestor.key)) {\n continue;\n }\n\n const parentKey = groupingNode.nonGroupingAncestor.key;\n const type = groupingNode.nonGroupingAncestor.extendedData?.isCategory ? \"category\" : \"element\";\n const modelIds = ((groupingNode.nonGroupingAncestor.extendedData?.modelIds as Id64String[][]) ?? []).flatMap((ids) => ids);\n groupingNodeInfos.push({ groupingNode, parentType: type, parentKey, modelIds });\n }\n focusedItems.push(\n ...groupingNodeInfos.map(({ parentKey, parentType, groupingNode, modelIds }) => ({\n parent:\n parentType === \"element\"\n ? { type: \"element\" as const, ids: parentKey.instanceKeys.map((key) => key.id) }\n : { type: \"category\" as const, ids: parentKey.instanceKeys.map((key) => key.id), modelIds },\n groupingNode,\n })),\n );\n return focusedItems;\n}\n\nfunction createLocalizedMessage(message: string, onClick?: () => void) {\n const exp = new RegExp(\"<link>(.*)</link>\");\n const match = message.match(exp);\n if (!match) {\n return message;\n }\n\n const [fullText, innerText] = match;\n const [textBefore, textAfter] = message.split(fullText);\n\n return (\n <>\n {textBefore ? textBefore : null}\n <Anchor\n underline\n onClick={(e) => {\n e.stopPropagation();\n onClick?.();\n }}\n >\n {innerText}\n </Anchor>\n {textAfter ? textAfter : null}\n </>\n );\n}\n\nasync function createFilteringPathsResult({\n getSubTreePaths,\n getFilteringPaths,\n handlePaths,\n}: {\n getSubTreePaths: () => Promise<HierarchyNodeIdentifiersPath[] | undefined>;\n getFilteringPaths: () => Promise<NormalizedHierarchyFilteringPath[] | undefined>;\n handlePaths: (filteredPaths: HierarchyFilteringPath[] | undefined) => Promise<void>;\n}): Promise<HierarchyFilteringPath[] | undefined> {\n const [subTreePaths, filterPaths] = await Promise.all([getSubTreePaths(), getFilteringPaths()]);\n let joinedPaths: HierarchyFilteringPath[] | undefined;\n try {\n if (subTreePaths && filterPaths) {\n return (joinedPaths = joinHierarchyFilteringPaths(subTreePaths, filterPaths));\n }\n if (subTreePaths) {\n return (joinedPaths = subTreePaths);\n }\n if (filterPaths) {\n return (joinedPaths = filterPaths);\n }\n } finally {\n void handlePaths(joinedPaths);\n }\n return joinedPaths;\n}\n\nfunction createCache(props: CreateCacheProps<{ hierarchyConfig: ModelsTreeHierarchyConfiguration }>) {\n return new ModelsTreeIdsCache(createECSqlQueryExecutor(props.imodel), props.specificProps.hierarchyConfig);\n}\n"]}
|
|
@@ -86,9 +86,7 @@ class ModelsTreeVisibilityHandlerImpl {
|
|
|
86
86
|
}
|
|
87
87
|
return this.getClassGroupingNodeDisplayStatus(node);
|
|
88
88
|
}
|
|
89
|
-
|
|
90
|
-
return of(createVisibilityStatus("disabled"));
|
|
91
|
-
}
|
|
89
|
+
assert(HierarchyNode.isInstancesNode(node));
|
|
92
90
|
// Only call getFilteredNodeVisibility when node is not a filter target, is not a child of filter target and has filtered children.
|
|
93
91
|
// Otherwise, it can be handled normally.
|
|
94
92
|
if (node.filtering?.filteredChildrenIdentifierPaths?.length && !node.filtering.isFilterTarget && !node.filtering.hasFilterTargetAncestor) {
|
|
@@ -102,9 +100,7 @@ class ModelsTreeVisibilityHandlerImpl {
|
|
|
102
100
|
return this.getModelVisibilityStatus({ modelIds: node.key.instanceKeys.map(({ id }) => id) });
|
|
103
101
|
}
|
|
104
102
|
const modelId = ModelsTreeNode.getModelId(node);
|
|
105
|
-
|
|
106
|
-
return of(createVisibilityStatus("disabled"));
|
|
107
|
-
}
|
|
103
|
+
assert(modelId !== undefined);
|
|
108
104
|
if (ModelsTreeNode.isCategoryNode(node)) {
|
|
109
105
|
return this.getCategoryDisplayStatus({
|
|
110
106
|
categoryIds: node.key.instanceKeys.map(({ id }) => id),
|
|
@@ -113,10 +109,7 @@ class ModelsTreeVisibilityHandlerImpl {
|
|
|
113
109
|
}
|
|
114
110
|
const categoryId = ModelsTreeNode.getCategoryId(node);
|
|
115
111
|
const rootCategoryIds = getRootCategoryIds({ parentKeys: node.parentKeys, modelId });
|
|
116
|
-
assert(rootCategoryIds !== undefined);
|
|
117
|
-
if (!categoryId) {
|
|
118
|
-
return of(createVisibilityStatus("disabled"));
|
|
119
|
-
}
|
|
112
|
+
assert(rootCategoryIds !== undefined && categoryId !== undefined);
|
|
120
113
|
return this.getElementDisplayStatus({
|
|
121
114
|
elementIds: node.key.instanceKeys.map(({ id }) => id),
|
|
122
115
|
parentKeys: node.parentKeys,
|
|
@@ -312,15 +305,17 @@ class ModelsTreeVisibilityHandlerImpl {
|
|
|
312
305
|
}
|
|
313
306
|
getClassGroupingNodeDisplayStatus(node) {
|
|
314
307
|
const { elementIds, modelId, categoryId, childrenCount } = this.getGroupingNodeInfo(node);
|
|
315
|
-
const
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
308
|
+
const result = defer(() => {
|
|
309
|
+
const rootCategoryIds = getRootCategoryIds({ parentKeys: node.parentKeys, modelId });
|
|
310
|
+
assert(rootCategoryIds !== undefined);
|
|
311
|
+
return this.getElementsDisplayStatus({
|
|
312
|
+
elementIds,
|
|
313
|
+
modelId,
|
|
314
|
+
categoryId,
|
|
315
|
+
rootCategoryIds,
|
|
316
|
+
parentElementIdsPath: getParentElementsIdsPath({ parentKeys: node.parentKeys, modelId }),
|
|
317
|
+
childrenCount: childrenCount ?? 0,
|
|
318
|
+
});
|
|
324
319
|
});
|
|
325
320
|
return createVisibilityHandlerResult(this, { node }, result, this.#props.overrides?.getElementGroupingNodeDisplayStatus);
|
|
326
321
|
}
|