@itwin/tree-widget-react 3.17.4 → 3.17.6

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.
Files changed (110) hide show
  1. package/CHANGELOG.md +19 -2
  2. package/lib/cjs/tree-widget-react/TreeWidget.js +1 -0
  3. package/lib/cjs/tree-widget-react/TreeWidget.js.map +1 -1
  4. package/lib/cjs/tree-widget-react/components/SelectableTree.d.ts +1 -1
  5. package/lib/cjs/tree-widget-react/components/TreeSelector.d.ts +1 -1
  6. package/lib/cjs/tree-widget-react/components/TreeWidgetUiItemsProvider.d.ts +1 -1
  7. package/lib/cjs/tree-widget-react/components/tree-header/TreeHeader.d.ts +1 -1
  8. package/lib/cjs/tree-widget-react/components/tree-header/TreeHeader.js +4 -4
  9. package/lib/cjs/tree-widget-react/components/tree-header/TreeHeader.js.map +1 -1
  10. package/lib/cjs/tree-widget-react/components/tree-header/TreeWithHeader.d.ts +1 -1
  11. package/lib/cjs/tree-widget-react/components/trees/categories-tree/CategoriesTree.d.ts +1 -1
  12. package/lib/cjs/tree-widget-react/components/trees/categories-tree/CategoriesTreeButtons.d.ts +5 -4
  13. package/lib/cjs/tree-widget-react/components/trees/categories-tree/CategoriesTreeButtons.js.map +1 -1
  14. package/lib/cjs/tree-widget-react/components/trees/categories-tree/CategoriesTreeComponent.d.ts +1 -5
  15. package/lib/cjs/tree-widget-react/components/trees/categories-tree/CategoriesTreeComponent.js.map +1 -1
  16. package/lib/cjs/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeIdsCache.d.ts +1 -0
  17. package/lib/cjs/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeIdsCache.js +3 -0
  18. package/lib/cjs/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeIdsCache.js.map +1 -1
  19. package/lib/cjs/tree-widget-react/components/trees/categories-tree/internal/CategoriesVisibilityHandler.js +11 -1
  20. package/lib/cjs/tree-widget-react/components/trees/categories-tree/internal/CategoriesVisibilityHandler.js.map +1 -1
  21. package/lib/cjs/tree-widget-react/components/trees/common/FocusedInstancesContext.d.ts +1 -1
  22. package/lib/cjs/tree-widget-react/components/trees/common/Rxjs.js +1 -0
  23. package/lib/cjs/tree-widget-react/components/trees/common/Rxjs.js.map +1 -1
  24. package/lib/cjs/tree-widget-react/components/trees/common/UseHierarchyFiltering.d.ts +1 -1
  25. package/lib/cjs/tree-widget-react/components/trees/common/UseHierarchyVisibility.js.map +1 -1
  26. package/lib/cjs/tree-widget-react/components/trees/common/UseTelemetryContext.d.ts +1 -1
  27. package/lib/cjs/tree-widget-react/components/trees/common/components/Delayed.d.ts +1 -1
  28. package/lib/cjs/tree-widget-react/components/trees/common/components/ProgressOverlay.d.ts +1 -1
  29. package/lib/cjs/tree-widget-react/components/trees/common/components/Tree.d.ts +2 -2
  30. package/lib/cjs/tree-widget-react/components/trees/common/components/TreeNodeCheckbox.d.ts +1 -1
  31. package/lib/cjs/tree-widget-react/components/trees/common/components/TreeRenderer.d.ts +1 -1
  32. package/lib/cjs/tree-widget-react/components/trees/common/components/VisibilityTree.d.ts +1 -1
  33. package/lib/cjs/tree-widget-react/components/trees/common/components/VisibilityTreeRenderer.d.ts +1 -1
  34. package/lib/cjs/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTree.d.ts +1 -1
  35. package/lib/cjs/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTreeComponent.d.ts +1 -5
  36. package/lib/cjs/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTreeComponent.js.map +1 -1
  37. package/lib/cjs/tree-widget-react/components/trees/imodel-content-tree/IModelContentTree.d.ts +1 -1
  38. package/lib/cjs/tree-widget-react/components/trees/imodel-content-tree/IModelContentTreeComponent.d.ts +1 -5
  39. package/lib/cjs/tree-widget-react/components/trees/imodel-content-tree/IModelContentTreeComponent.js.map +1 -1
  40. package/lib/cjs/tree-widget-react/components/trees/imodel-content-tree/internal/IModelContentTreeIdsCache.js +1 -0
  41. package/lib/cjs/tree-widget-react/components/trees/imodel-content-tree/internal/IModelContentTreeIdsCache.js.map +1 -1
  42. package/lib/cjs/tree-widget-react/components/trees/models-tree/ModelsTree.d.ts +1 -1
  43. package/lib/cjs/tree-widget-react/components/trees/models-tree/ModelsTreeButtons.d.ts +8 -7
  44. package/lib/cjs/tree-widget-react/components/trees/models-tree/ModelsTreeButtons.js.map +1 -1
  45. package/lib/cjs/tree-widget-react/components/trees/models-tree/ModelsTreeComponent.d.ts +1 -5
  46. package/lib/cjs/tree-widget-react/components/trees/models-tree/ModelsTreeComponent.js.map +1 -1
  47. package/lib/cjs/tree-widget-react/components/trees/models-tree/ModelsTreeDefinition.js +13 -16
  48. package/lib/cjs/tree-widget-react/components/trees/models-tree/ModelsTreeDefinition.js.map +1 -1
  49. package/lib/cjs/tree-widget-react/components/trees/models-tree/UseModelsTree.js +1 -1
  50. package/lib/cjs/tree-widget-react/components/trees/models-tree/UseModelsTree.js.map +1 -1
  51. package/lib/cjs/tree-widget-react/components/trees/models-tree/Utils.d.ts +3 -3
  52. package/lib/cjs/tree-widget-react/components/trees/models-tree/Utils.js.map +1 -1
  53. package/lib/cjs/tree-widget-react/components/trees/models-tree/internal/ModelsTreeIdsCache.d.ts +1 -0
  54. package/lib/cjs/tree-widget-react/components/trees/models-tree/internal/ModelsTreeIdsCache.js +7 -0
  55. package/lib/cjs/tree-widget-react/components/trees/models-tree/internal/ModelsTreeIdsCache.js.map +1 -1
  56. package/lib/esm/tree-widget-react/TreeWidget.js +2 -1
  57. package/lib/esm/tree-widget-react/TreeWidget.js.map +1 -1
  58. package/lib/esm/tree-widget-react/components/SelectableTree.d.ts +1 -1
  59. package/lib/esm/tree-widget-react/components/TreeSelector.d.ts +1 -1
  60. package/lib/esm/tree-widget-react/components/TreeWidgetUiItemsProvider.d.ts +1 -1
  61. package/lib/esm/tree-widget-react/components/tree-header/TreeHeader.d.ts +1 -1
  62. package/lib/esm/tree-widget-react/components/tree-header/TreeHeader.js +4 -4
  63. package/lib/esm/tree-widget-react/components/tree-header/TreeHeader.js.map +1 -1
  64. package/lib/esm/tree-widget-react/components/tree-header/TreeWithHeader.d.ts +1 -1
  65. package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTree.d.ts +1 -1
  66. package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeButtons.d.ts +5 -4
  67. package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeButtons.js.map +1 -1
  68. package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeComponent.d.ts +1 -5
  69. package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeComponent.js.map +1 -1
  70. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeIdsCache.d.ts +1 -0
  71. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeIdsCache.js +3 -0
  72. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeIdsCache.js.map +1 -1
  73. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesVisibilityHandler.js +12 -2
  74. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesVisibilityHandler.js.map +1 -1
  75. package/lib/esm/tree-widget-react/components/trees/common/FocusedInstancesContext.d.ts +1 -1
  76. package/lib/esm/tree-widget-react/components/trees/common/Rxjs.js +1 -0
  77. package/lib/esm/tree-widget-react/components/trees/common/Rxjs.js.map +1 -1
  78. package/lib/esm/tree-widget-react/components/trees/common/UseHierarchyFiltering.d.ts +1 -1
  79. package/lib/esm/tree-widget-react/components/trees/common/UseHierarchyVisibility.js.map +1 -1
  80. package/lib/esm/tree-widget-react/components/trees/common/UseTelemetryContext.d.ts +1 -1
  81. package/lib/esm/tree-widget-react/components/trees/common/components/Delayed.d.ts +1 -1
  82. package/lib/esm/tree-widget-react/components/trees/common/components/ProgressOverlay.d.ts +1 -1
  83. package/lib/esm/tree-widget-react/components/trees/common/components/Tree.d.ts +2 -2
  84. package/lib/esm/tree-widget-react/components/trees/common/components/TreeNodeCheckbox.d.ts +1 -1
  85. package/lib/esm/tree-widget-react/components/trees/common/components/TreeRenderer.d.ts +1 -1
  86. package/lib/esm/tree-widget-react/components/trees/common/components/VisibilityTree.d.ts +1 -1
  87. package/lib/esm/tree-widget-react/components/trees/common/components/VisibilityTreeRenderer.d.ts +1 -1
  88. package/lib/esm/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTree.d.ts +1 -1
  89. package/lib/esm/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTreeComponent.d.ts +1 -5
  90. package/lib/esm/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTreeComponent.js.map +1 -1
  91. package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTree.d.ts +1 -1
  92. package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTreeComponent.d.ts +1 -5
  93. package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTreeComponent.js.map +1 -1
  94. package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/internal/IModelContentTreeIdsCache.js +1 -0
  95. package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/internal/IModelContentTreeIdsCache.js.map +1 -1
  96. package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTree.d.ts +1 -1
  97. package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeButtons.d.ts +8 -7
  98. package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeButtons.js.map +1 -1
  99. package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeComponent.d.ts +1 -5
  100. package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeComponent.js.map +1 -1
  101. package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeDefinition.js +13 -16
  102. package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeDefinition.js.map +1 -1
  103. package/lib/esm/tree-widget-react/components/trees/models-tree/UseModelsTree.js +1 -1
  104. package/lib/esm/tree-widget-react/components/trees/models-tree/UseModelsTree.js.map +1 -1
  105. package/lib/esm/tree-widget-react/components/trees/models-tree/Utils.d.ts +3 -3
  106. package/lib/esm/tree-widget-react/components/trees/models-tree/Utils.js.map +1 -1
  107. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeIdsCache.d.ts +1 -0
  108. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeIdsCache.js +7 -0
  109. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeIdsCache.js.map +1 -1
  110. package/package.json +78 -87
package/CHANGELOG.md CHANGED
@@ -1,12 +1,29 @@
1
1
  # Change Log - @itwin/tree-widget-react
2
2
 
3
- <!-- This log was last generated on Thu, 15 Jan 2026 14:30:09 GMT and should not be manually modified. -->
3
+ <!-- This log was last generated on Mon, 09 Feb 2026 12:16:48 GMT and should not be manually modified. -->
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## 3.17.6
8
+
9
+ Mon, 09 Feb 2026 12:16:48 GMT
10
+
11
+ ### Patches
12
+
13
+ - Bump dependencies ([#1583](https://github.com/iTwin/viewer-components-react/pull/1583))
14
+ - Models tree: use cached category ids to query model children. ([#1585](https://github.com/iTwin/viewer-components-react/pull/1585))
15
+
16
+ ## 3.17.5
17
+
18
+ Wed, 21 Jan 2026 12:50:36 GMT
19
+
20
+ ### Patches
21
+
22
+ - Fix enabling category display in categories tree making other categories also visible, when their elements are under hidden model. ([#1556](https://github.com/iTwin/viewer-components-react/pull/1556))
23
+
7
24
  ## 3.17.4
8
25
 
9
- Thu, 15 Jan 2026 14:30:09 GMT
26
+ Thu, 15 Jan 2026 14:30:28 GMT
10
27
 
11
28
  ### Patches
12
29
 
@@ -48,6 +48,7 @@ class TreeWidget {
48
48
  /** Calls i18n.translateWithNamespace with the "TreeWidget" namespace. Do NOT include the namespace in the key.
49
49
  */
50
50
  static translate(key, options) {
51
+ (0, core_bentley_1.assert)(!Array.isArray(key));
51
52
  const stringKey = `${TreeWidget.i18nNamespace}:${key}`;
52
53
  return TreeWidget.i18n.getLocalizedString(stringKey, options);
53
54
  }
@@ -1 +1 @@
1
- {"version":3,"file":"TreeWidget.js","sourceRoot":"","sources":["../../../src/tree-widget-react/TreeWidget.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAEhG,sDAAkE;AAClE,wDAAiD;AAIjD;;;GAGG;AACH,MAAa,UAAU;IACrB,MAAM,CAAC,KAAK,CAAgB;IAC5B,MAAM,CAAC,YAAY,CAAW;IAE9B;;;OAGG;IACI,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,IAAmB;QAChD,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;YACtB,OAAO;QACT,CAAC;QAED,UAAU,CAAC,YAAY,GAAG,IAAI,CAAC;QAC/B,UAAU,CAAC,KAAK,GAAG,IAAI,IAAI,yBAAS,CAAC,YAAY,CAAC;QAClD,OAAO,UAAU,CAAC,KAAK,CAAC,iBAAiB,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;IACtE,CAAC;IAED,wEAAwE;IACjE,MAAM,CAAC,SAAS;QACrB,IAAI,UAAU,CAAC,KAAK,EAAE,CAAC;YACrB,UAAU,CAAC,KAAK,CAAC,mBAAmB,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;YAC/D,UAAU,CAAC,KAAK,GAAG,SAAS,CAAC;QAC/B,CAAC;QAED,UAAU,CAAC,YAAY,GAAG,KAAK,CAAC;IAClC,CAAC;IAED,iEAAiE;IAC1D,MAAM,KAAK,IAAI;QACpB,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC;YACtB,MAAM,IAAI,2BAAY,CAAC,4BAAa,CAAC,KAAK,EAAE,4BAA4B,CAAC,CAAC;QAC5E,CAAC;QACD,OAAO,UAAU,CAAC,KAAK,CAAC;IAC1B,CAAC;IAED,kDAAkD;IAC3C,MAAM,KAAK,aAAa;QAC7B,OAAO,YAAY,CAAC;IACtB,CAAC;IAED;OACG;IACI,MAAM,CAAC,SAAS,CAAC,GAAsB,EAAE,OAA4B;QAC1E,MAAM,SAAS,GAAG,GAAG,UAAU,CAAC,aAAa,IAAI,GAAG,EAAE,CAAC;QACvD,OAAO,UAAU,CAAC,IAAI,CAAC,kBAAkB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IAChE,CAAC;CACF;AA/CD,gCA+CC","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 { BentleyError, BentleyStatus } from \"@itwin/core-bentley\";\nimport { IModelApp } from \"@itwin/core-frontend\";\n\nimport type { Localization, TranslationOptions } from \"@itwin/core-common\";\n\n/**\n * Entry point for static initialization required by various components used in the package.\n * @public\n */\nexport class TreeWidget {\n static #i18n?: Localization;\n static #initialized?: boolean;\n\n /**\n * Called by IModelApp to initialize the Tree Widget\n * @param i18n - The internationalization service created by the IModelApp.\n */\n public static async initialize(i18n?: Localization): Promise<void> {\n if (this.#initialized) {\n return;\n }\n\n TreeWidget.#initialized = true;\n TreeWidget.#i18n = i18n ?? IModelApp.localization;\n return TreeWidget.#i18n.registerNamespace(TreeWidget.i18nNamespace);\n }\n\n /** Unregisters the TreeWidget internationalization service namespace */\n public static terminate() {\n if (TreeWidget.#i18n) {\n TreeWidget.#i18n.unregisterNamespace(TreeWidget.i18nNamespace);\n TreeWidget.#i18n = undefined;\n }\n\n TreeWidget.#initialized = false;\n }\n\n /** The internationalization service created by the IModelApp. */\n public static get i18n(): Localization {\n if (!TreeWidget.#i18n) {\n throw new BentleyError(BentleyStatus.ERROR, \"TreeWidget not initialized\");\n }\n return TreeWidget.#i18n;\n }\n\n /** The internationalization service namespace. */\n public static get i18nNamespace(): string {\n return \"TreeWidget\";\n }\n\n /** Calls i18n.translateWithNamespace with the \"TreeWidget\" namespace. Do NOT include the namespace in the key.\n */\n public static translate(key: string | string[], options?: TranslationOptions): string {\n const stringKey = `${TreeWidget.i18nNamespace}:${key}`;\n return TreeWidget.i18n.getLocalizedString(stringKey, options);\n }\n}\n"]}
1
+ {"version":3,"file":"TreeWidget.js","sourceRoot":"","sources":["../../../src/tree-widget-react/TreeWidget.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAEhG,sDAA0E;AAC1E,wDAAiD;AAIjD;;;GAGG;AACH,MAAa,UAAU;IACrB,MAAM,CAAC,KAAK,CAAgB;IAC5B,MAAM,CAAC,YAAY,CAAW;IAE9B;;;OAGG;IACI,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,IAAmB;QAChD,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;YACtB,OAAO;QACT,CAAC;QAED,UAAU,CAAC,YAAY,GAAG,IAAI,CAAC;QAC/B,UAAU,CAAC,KAAK,GAAG,IAAI,IAAI,yBAAS,CAAC,YAAY,CAAC;QAClD,OAAO,UAAU,CAAC,KAAK,CAAC,iBAAiB,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;IACtE,CAAC;IAED,wEAAwE;IACjE,MAAM,CAAC,SAAS;QACrB,IAAI,UAAU,CAAC,KAAK,EAAE,CAAC;YACrB,UAAU,CAAC,KAAK,CAAC,mBAAmB,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;YAC/D,UAAU,CAAC,KAAK,GAAG,SAAS,CAAC;QAC/B,CAAC;QAED,UAAU,CAAC,YAAY,GAAG,KAAK,CAAC;IAClC,CAAC;IAED,iEAAiE;IAC1D,MAAM,KAAK,IAAI;QACpB,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC;YACtB,MAAM,IAAI,2BAAY,CAAC,4BAAa,CAAC,KAAK,EAAE,4BAA4B,CAAC,CAAC;QAC5E,CAAC;QACD,OAAO,UAAU,CAAC,KAAK,CAAC;IAC1B,CAAC;IAED,kDAAkD;IAC3C,MAAM,KAAK,aAAa;QAC7B,OAAO,YAAY,CAAC;IACtB,CAAC;IAED;OACG;IACI,MAAM,CAAC,SAAS,CAAC,GAAsB,EAAE,OAA4B;QAC1E,IAAA,qBAAM,EAAC,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;QAC5B,MAAM,SAAS,GAAG,GAAG,UAAU,CAAC,aAAa,IAAI,GAAG,EAAE,CAAC;QACvD,OAAO,UAAU,CAAC,IAAI,CAAC,kBAAkB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IAChE,CAAC;CACF;AAhDD,gCAgDC","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 { assert, BentleyError, BentleyStatus } from \"@itwin/core-bentley\";\nimport { IModelApp } from \"@itwin/core-frontend\";\n\nimport type { Localization, TranslationOptions } from \"@itwin/core-common\";\n\n/**\n * Entry point for static initialization required by various components used in the package.\n * @public\n */\nexport class TreeWidget {\n static #i18n?: Localization;\n static #initialized?: boolean;\n\n /**\n * Called by IModelApp to initialize the Tree Widget\n * @param i18n - The internationalization service created by the IModelApp.\n */\n public static async initialize(i18n?: Localization): Promise<void> {\n if (this.#initialized) {\n return;\n }\n\n TreeWidget.#initialized = true;\n TreeWidget.#i18n = i18n ?? IModelApp.localization;\n return TreeWidget.#i18n.registerNamespace(TreeWidget.i18nNamespace);\n }\n\n /** Unregisters the TreeWidget internationalization service namespace */\n public static terminate() {\n if (TreeWidget.#i18n) {\n TreeWidget.#i18n.unregisterNamespace(TreeWidget.i18nNamespace);\n TreeWidget.#i18n = undefined;\n }\n\n TreeWidget.#initialized = false;\n }\n\n /** The internationalization service created by the IModelApp. */\n public static get i18n(): Localization {\n if (!TreeWidget.#i18n) {\n throw new BentleyError(BentleyStatus.ERROR, \"TreeWidget not initialized\");\n }\n return TreeWidget.#i18n;\n }\n\n /** The internationalization service namespace. */\n public static get i18nNamespace(): string {\n return \"TreeWidget\";\n }\n\n /** Calls i18n.translateWithNamespace with the \"TreeWidget\" namespace. Do NOT include the namespace in the key.\n */\n public static translate(key: string | string[], options?: TranslationOptions): string {\n assert(!Array.isArray(key));\n const stringKey = `${TreeWidget.i18nNamespace}:${key}`;\n return TreeWidget.i18n.getLocalizedString(stringKey, options);\n }\n}\n"]}
@@ -42,5 +42,5 @@ export interface SelectableTreeProps {
42
42
  * A component that renders a tree (combo box) selector and the selected tree component.
43
43
  * @public
44
44
  */
45
- export declare function SelectableTree(props: SelectableTreeProps): JSX.Element | null;
45
+ export declare function SelectableTree(props: SelectableTreeProps): import("react/jsx-runtime").JSX.Element | null;
46
46
  //# sourceMappingURL=SelectableTree.d.ts.map
@@ -26,5 +26,5 @@ export interface TreeSelectorProps {
26
26
  * allowing to choose which of the provided tree components should be rendered at the bottom.
27
27
  * @internal
28
28
  */
29
- export declare function TreeSelector(props: TreeSelectorProps): JSX.Element;
29
+ export declare function TreeSelector(props: TreeSelectorProps): import("react/jsx-runtime").JSX.Element;
30
30
  //# sourceMappingURL=TreeSelector.d.ts.map
@@ -30,6 +30,6 @@ export declare function createTreeWidget(props: TreeWidgetProps): Widget;
30
30
  * Tree widget component which allows selecting which tree to render.
31
31
  * @public
32
32
  */
33
- export declare function TreeWidgetComponent(props: SelectableTreeProps): JSX.Element;
33
+ export declare function TreeWidgetComponent(props: SelectableTreeProps): import("react/jsx-runtime").JSX.Element;
34
34
  export {};
35
35
  //# sourceMappingURL=TreeWidgetUiItemsProvider.d.ts.map
@@ -28,6 +28,6 @@ interface TreeHeaderProps {
28
28
  density?: "default" | "enlarged";
29
29
  className?: string;
30
30
  }
31
- export declare function TreeHeader(props: PropsWithChildren<TreeHeaderProps>): JSX.Element;
31
+ export declare function TreeHeader(props: PropsWithChildren<TreeHeaderProps>): import("react/jsx-runtime").JSX.Element;
32
32
  export {};
33
33
  //# sourceMappingURL=TreeHeader.d.ts.map
@@ -45,10 +45,10 @@ function DebouncedSearchBox({ isOpened, selectedResultIndex, resultCount, onSele
45
45
  clearTimeout(timeoutId);
46
46
  };
47
47
  }, [inputValue, delay]);
48
- return ((0, jsx_runtime_1.jsxs)(itwinui_react_1.SearchBox, { expandable: true, isExpanded: isOpened, onExpand: onOpen, onCollapse: onClose, size: size, className: (0, classnames_1.default)("tree-widget-search-box", !isOpened && "contracted"), isDisabled: isDisabled, children: [(0, jsx_runtime_1.jsx)(itwinui_react_1.SearchBox.CollapsedState, { children: (0, jsx_runtime_1.jsx)(itwinui_react_1.SearchBox.ExpandButton, { title: TreeWidget_js_1.TreeWidget.translate("header.searchBox.searchForSomething"), "aria-label": TreeWidget_js_1.TreeWidget.translate("header.searchBox.open"), size: size, styleType: "borderless" }) }), (0, jsx_runtime_1.jsxs)(itwinui_react_1.SearchBox.ExpandedState, { children: [(0, jsx_runtime_1.jsx)(itwinui_react_1.SearchBox.Input, { placeholder: TreeWidget_js_1.TreeWidget.translate("header.searchBox.search"), onChange: (e) => setInputValue(e.currentTarget.value) }), (0, jsx_runtime_1.jsx)(SearchResultStepper, { selectedIndex: selectedResultIndex, total: resultCount, onStep: onSelectedResultChanged, size: size }), (0, jsx_runtime_1.jsx)(itwinui_react_1.SearchBox.CollapseButton, { onClick: () => {
48
+ return ((0, jsx_runtime_1.jsxs)(itwinui_react_1.SearchBox, { expandable: true, isExpanded: isOpened, onExpand: onOpen, onCollapse: onClose, size: size, className: (0, classnames_1.default)("tree-widget-search-box", !isOpened && "contracted"), isDisabled: isDisabled, children: [(0, jsx_runtime_1.jsx)(itwinui_react_1.SearchBox.CollapsedState, { children: (0, jsx_runtime_1.jsx)(itwinui_react_1.SearchBox.ExpandButton, { label: TreeWidget_js_1.TreeWidget.translate("header.searchBox.open"), "aria-label": TreeWidget_js_1.TreeWidget.translate("header.searchBox.open"), size: size, styleType: "borderless" }) }), (0, jsx_runtime_1.jsxs)(itwinui_react_1.SearchBox.ExpandedState, { children: [(0, jsx_runtime_1.jsx)(itwinui_react_1.SearchBox.Input, { placeholder: TreeWidget_js_1.TreeWidget.translate("header.searchBox.search"), onChange: (e) => setInputValue(e.currentTarget.value) }), (0, jsx_runtime_1.jsx)(SearchResultStepper, { selectedIndex: selectedResultIndex, total: resultCount, onStep: onSelectedResultChanged, size: size }), (0, jsx_runtime_1.jsx)(itwinui_react_1.SearchBox.CollapseButton, { onClick: () => {
49
49
  setInputValue("");
50
50
  onClose();
51
- }, size: size, "aria-label": TreeWidget_js_1.TreeWidget.translate("header.searchBox.close") })] })] }));
51
+ }, size: size, "aria-label": TreeWidget_js_1.TreeWidget.translate("header.searchBox.close"), label: TreeWidget_js_1.TreeWidget.translate("header.searchBox.close") })] })] }));
52
52
  }
53
53
  function HeaderButtons(props) {
54
54
  const className = (0, classnames_1.default)("button-container", props.contracted && "contracted");
@@ -61,11 +61,11 @@ function SearchResultStepper(props) {
61
61
  if (!total) {
62
62
  return null;
63
63
  }
64
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("span", { className: "searchbox-stepping-count", children: `${selectedIndex}/${total}` }), (0, jsx_runtime_1.jsx)(itwinui_react_1.Divider, { orientation: "vertical" }), (0, jsx_runtime_1.jsx)(itwinui_react_1.SearchBox.Button, { title: TreeWidget_js_1.TreeWidget.translate("header.searchBox.previous"), size: props.size, onClick: () => {
64
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("span", { className: "searchbox-stepping-count", children: `${selectedIndex}/${total}` }), (0, jsx_runtime_1.jsx)(itwinui_react_1.Divider, { orientation: "vertical" }), (0, jsx_runtime_1.jsx)(itwinui_react_1.SearchBox.Button, { label: TreeWidget_js_1.TreeWidget.translate("header.searchBox.previous"), size: props.size, onClick: () => {
65
65
  if (selectedIndex > 1) {
66
66
  onStep(selectedIndex - 1);
67
67
  }
68
- }, children: (0, jsx_runtime_1.jsx)(itwinui_icons_react_1.SvgCaretUpSmall, {}) }), (0, jsx_runtime_1.jsx)(itwinui_react_1.SearchBox.Button, { title: TreeWidget_js_1.TreeWidget.translate("header.searchBox.next"), size: props.size, onClick: () => {
68
+ }, children: (0, jsx_runtime_1.jsx)(itwinui_icons_react_1.SvgCaretUpSmall, {}) }), (0, jsx_runtime_1.jsx)(itwinui_react_1.SearchBox.Button, { label: TreeWidget_js_1.TreeWidget.translate("header.searchBox.next"), size: props.size, onClick: () => {
69
69
  if (selectedIndex < total) {
70
70
  onStep(selectedIndex + 1);
71
71
  }
@@ -1 +1 @@
1
- {"version":3,"file":"TreeHeader.js","sourceRoot":"","sources":["../../../../../src/tree-widget-react/components/tree-header/TreeHeader.tsx"],"names":[],"mappings":";;;;;AA+CA,gCAiCC;;AAhFD;;;gGAGgG;AAEhG,6BAA2B;AAE3B,4DAAoC;AACpC,iCAA8D;AAC9D,oEAAyF;AACzF,wDAAiG;AACjG,uDAAiD;AACjD,2FAAwF;AAmCxF,SAAgB,UAAU,CAAC,KAAyC;IAClE,MAAM,EAAE,cAAc,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAC/D,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,IAAA,gBAAQ,EAAU,KAAK,CAAC,CAAC;IACjE,MAAM,EAAE,OAAO,EAAE,oBAAoB,EAAE,GAAG,IAAA,uDAA0B,GAAE,CAAC;IACvE,MAAM,IAAI,GAAG,OAAO,KAAK,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;IAExD,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,IAAI,cAAc,EAAE,UAAU,EAAE,CAAC;YAC/B,eAAe,CAAC,KAAK,CAAC,CAAC;QACzB,CAAC;IACH,CAAC,EAAE,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC,CAAC;IAEjC,OAAO,CACL,iCAAK,SAAS,EAAE,IAAA,oBAAU,EAAC,yBAAyB,EAAE,SAAS,CAAC,aAC9D,uBAAC,aAAa,IAAC,UAAU,EAAE,YAAY,EAAE,IAAI,EAAE,IAAI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AG,EAClC,uBAAC,yBAAS,CAAC,MAAM,IACf,KAAK,EAAE,0BAAU,CAAC,SAAS,CAAC,2BAA2B,CAAC,EACxD,IAAI,EAAE,KAAK,CAAC,IAAI,EAChB,OAAO,EAAE,GAAG,EAAE;oBACZ,IAAI,aAAa,GAAG,CAAC,EAAE,CAAC;wBACtB,MAAM,CAAC,aAAa,GAAG,CAAC,CAAC,CAAC;oBAC5B,CAAC;gBACH,CAAC,YAED,uBAAC,qCAAe,KAAG,GACF,EACnB,uBAAC,yBAAS,CAAC,MAAM,IACf,KAAK,EAAE,0BAAU,CAAC,SAAS,CAAC,uBAAuB,CAAC,EACpD,IAAI,EAAE,KAAK,CAAC,IAAI,EAChB,OAAO,EAAE,GAAG,EAAE;oBACZ,IAAI,aAAa,GAAG,KAAK,EAAE,CAAC;wBAC1B,MAAM,CAAC,aAAa,GAAG,CAAC,CAAC,CAAC;oBAC5B,CAAC;gBACH,CAAC,YAED,uBAAC,uCAAiB,KAAG,GACJ,IAClB,CACJ,CAAC;AACJ,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 \"./TreeHeader.scss\";\n\nimport classnames from \"classnames\";\nimport { Children, useEffect, useRef, useState } from \"react\";\nimport { SvgCaretDownSmall, SvgCaretUpSmall, SvgMore } from \"@itwin/itwinui-icons-react\";\nimport { ButtonGroup, Divider, DropdownMenu, IconButton, SearchBox } from \"@itwin/itwinui-react\";\nimport { TreeWidget } from \"../../TreeWidget.js\";\nimport { useFocusedInstancesContext } from \"../trees/common/FocusedInstancesContext.js\";\n\nimport type { PropsWithChildren } from \"react\";\nimport type { Viewport } from \"@itwin/core-frontend\";\n\n/** @public */\nexport interface TreeHeaderButtonProps {\n viewport: Viewport;\n density?: \"default\" | \"enlarged\";\n onFeatureUsed?: (feature: string) => void;\n}\n\n/** @beta */\nexport interface TreeFilteringProps {\n /** Filtering is cleared after everything's loaded */\n onFilterStart: (newFilter: string) => void;\n /** listens for onClick event for Clear (x) icon */\n onFilterClear: () => void;\n /** Total number of results/entries */\n resultCount?: number;\n /** Current selected result index */\n selectedIndex?: number;\n /** Callback to currently selected result/entry change */\n onSelectedChanged?: (index: number) => void;\n /** Should the search box be disabled */\n isDisabled?: boolean;\n}\n\ninterface TreeHeaderProps {\n filteringProps?: TreeFilteringProps;\n /** Modifies the density of tree header. `enlarged` header contains larger content */\n density?: \"default\" | \"enlarged\";\n className?: string;\n}\n\nexport function TreeHeader(props: PropsWithChildren<TreeHeaderProps>) {\n const { filteringProps, density, className, children } = props;\n const [isSearchOpen, setIsSearchOpen] = useState<boolean>(false);\n const { enabled: instanceFocusEnabled } = useFocusedInstancesContext();\n const size = density === \"enlarged\" ? \"large\" : \"small\";\n\n useEffect(() => {\n if (filteringProps?.isDisabled) {\n setIsSearchOpen(false);\n }\n }, [filteringProps?.isDisabled]);\n\n return (\n <div className={classnames(\"tree-widget-tree-header\", className)}>\n <HeaderButtons contracted={isSearchOpen} size={size}>\n {children}\n </HeaderButtons>\n {filteringProps ? (\n <DebouncedSearchBox\n isOpened={isSearchOpen}\n onOpen={() => setIsSearchOpen(true)}\n onClose={() => setIsSearchOpen(false)}\n onChange={(value) => (value ? filteringProps.onFilterStart(value) : filteringProps.onFilterClear())}\n delay={500}\n selectedResultIndex={filteringProps.selectedIndex}\n resultCount={filteringProps.resultCount}\n onSelectedResultChanged={(index) => filteringProps.onSelectedChanged?.(index)}\n size={size}\n isDisabled={instanceFocusEnabled || props.filteringProps?.isDisabled}\n />\n ) : null}\n </div>\n );\n}\n\ninterface DebouncedSearchBoxProps {\n isOpened: boolean;\n onOpen: () => void;\n onClose: () => void;\n onChange: (value: string) => void;\n delay: number;\n selectedResultIndex?: number;\n resultCount?: number;\n onSelectedResultChanged: (index: number) => void;\n size: \"large\" | \"small\";\n isDisabled?: boolean;\n}\n\nfunction DebouncedSearchBox({\n isOpened,\n selectedResultIndex,\n resultCount,\n onSelectedResultChanged,\n onChange,\n onOpen,\n onClose,\n delay,\n size,\n isDisabled,\n}: DebouncedSearchBoxProps) {\n const [inputValue, setInputValue] = useState<string>(\"\");\n const onChangeRef = useRef(onChange);\n // save latest `onChange` reference into `useRef` to avoid restarting timeout when `onChange` reference changes.\n onChangeRef.current = onChange;\n\n useEffect(() => {\n if (!inputValue) {\n onChangeRef.current(\"\");\n return;\n }\n\n const timeoutId = setTimeout(() => {\n onChangeRef.current(inputValue);\n }, delay);\n\n return () => {\n clearTimeout(timeoutId);\n };\n }, [inputValue, delay]);\n\n return (\n <SearchBox\n expandable\n isExpanded={isOpened}\n onExpand={onOpen}\n onCollapse={onClose}\n size={size}\n className={classnames(\"tree-widget-search-box\", !isOpened && \"contracted\")}\n isDisabled={isDisabled}\n >\n <SearchBox.CollapsedState>\n <SearchBox.ExpandButton\n title={TreeWidget.translate(\"header.searchBox.searchForSomething\")}\n aria-label={TreeWidget.translate(\"header.searchBox.open\")}\n size={size}\n styleType=\"borderless\"\n />\n </SearchBox.CollapsedState>\n <SearchBox.ExpandedState>\n <SearchBox.Input placeholder={TreeWidget.translate(\"header.searchBox.search\")} onChange={(e) => setInputValue(e.currentTarget.value)} />\n <SearchResultStepper selectedIndex={selectedResultIndex} total={resultCount} onStep={onSelectedResultChanged} size={size} />\n <SearchBox.CollapseButton\n onClick={() => {\n setInputValue(\"\");\n onClose();\n }}\n size={size}\n aria-label={TreeWidget.translate(\"header.searchBox.close\")}\n />\n </SearchBox.ExpandedState>\n </SearchBox>\n );\n}\n\ninterface HeaderButtonsProps {\n contracted: boolean;\n size: \"large\" | \"small\";\n}\n\nfunction HeaderButtons(props: PropsWithChildren<HeaderButtonsProps>) {\n const className = classnames(\"button-container\", props.contracted && \"contracted\");\n\n return (\n <ButtonGroup\n className={className}\n overflowButton={(overflowStart) => (\n <DropdownMenu\n menuItems={() =>\n Children.toArray(props.children)\n .slice(overflowStart)\n .map((btn, index) => (\n <li key={index} className=\"dropdown-item\" role=\"menuitem\">\n {btn}\n </li>\n ))\n }\n className=\"tree-header-button-dropdown-container\"\n >\n <IconButton label={TreeWidget.translate(\"header.dropdownMore\")} styleType=\"borderless\" size={props.size}>\n <SvgMore />\n </IconButton>\n </DropdownMenu>\n )}\n >\n {props.children}\n </ButtonGroup>\n );\n}\n\ninterface SearchResultStepperProps {\n total?: number;\n onStep: (newIndex: number) => void;\n selectedIndex?: number;\n size: \"large\" | \"small\";\n}\n\nfunction SearchResultStepper(props: SearchResultStepperProps) {\n const { selectedIndex = 1, total, onStep } = props;\n if (!total) {\n return null;\n }\n\n return (\n <>\n <span className=\"searchbox-stepping-count\">{`${selectedIndex}/${total}`}</span>\n <Divider orientation=\"vertical\" />\n <SearchBox.Button\n title={TreeWidget.translate(\"header.searchBox.previous\")}\n size={props.size}\n onClick={() => {\n if (selectedIndex > 1) {\n onStep(selectedIndex - 1);\n }\n }}\n >\n <SvgCaretUpSmall />\n </SearchBox.Button>\n <SearchBox.Button\n title={TreeWidget.translate(\"header.searchBox.next\")}\n size={props.size}\n onClick={() => {\n if (selectedIndex < total) {\n onStep(selectedIndex + 1);\n }\n }}\n >\n <SvgCaretDownSmall />\n </SearchBox.Button>\n </>\n );\n}\n"]}
1
+ {"version":3,"file":"TreeHeader.js","sourceRoot":"","sources":["../../../../../src/tree-widget-react/components/tree-header/TreeHeader.tsx"],"names":[],"mappings":";;;;;AA+CA,gCAiCC;;AAhFD;;;gGAGgG;AAEhG,6BAA2B;AAE3B,4DAAoC;AACpC,iCAA8D;AAC9D,oEAAyF;AACzF,wDAAiG;AACjG,uDAAiD;AACjD,2FAAwF;AAmCxF,SAAgB,UAAU,CAAC,KAAyC;IAClE,MAAM,EAAE,cAAc,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAC/D,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,IAAA,gBAAQ,EAAU,KAAK,CAAC,C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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 *--------------------------------------------------------------------------------------------*/\n\nimport \"./TreeHeader.scss\";\n\nimport classnames from \"classnames\";\nimport { Children, useEffect, useRef, useState } from \"react\";\nimport { SvgCaretDownSmall, SvgCaretUpSmall, SvgMore } from \"@itwin/itwinui-icons-react\";\nimport { ButtonGroup, Divider, DropdownMenu, IconButton, SearchBox } from \"@itwin/itwinui-react\";\nimport { TreeWidget } from \"../../TreeWidget.js\";\nimport { useFocusedInstancesContext } from \"../trees/common/FocusedInstancesContext.js\";\n\nimport type { PropsWithChildren } from \"react\";\nimport type { Viewport } from \"@itwin/core-frontend\";\n\n/** @public */\nexport interface TreeHeaderButtonProps {\n viewport: Viewport;\n density?: \"default\" | \"enlarged\";\n onFeatureUsed?: (feature: string) => void;\n}\n\n/** @beta */\nexport interface TreeFilteringProps {\n /** Filtering is cleared after everything's loaded */\n onFilterStart: (newFilter: string) => void;\n /** listens for onClick event for Clear (x) icon */\n onFilterClear: () => void;\n /** Total number of results/entries */\n resultCount?: number;\n /** Current selected result index */\n selectedIndex?: number;\n /** Callback to currently selected result/entry change */\n onSelectedChanged?: (index: number) => void;\n /** Should the search box be disabled */\n isDisabled?: boolean;\n}\n\ninterface TreeHeaderProps {\n filteringProps?: TreeFilteringProps;\n /** Modifies the density of tree header. `enlarged` header contains larger content */\n density?: \"default\" | \"enlarged\";\n className?: string;\n}\n\nexport function TreeHeader(props: PropsWithChildren<TreeHeaderProps>) {\n const { filteringProps, density, className, children } = props;\n const [isSearchOpen, setIsSearchOpen] = useState<boolean>(false);\n const { enabled: instanceFocusEnabled } = useFocusedInstancesContext();\n const size = density === \"enlarged\" ? \"large\" : \"small\";\n\n useEffect(() => {\n if (filteringProps?.isDisabled) {\n setIsSearchOpen(false);\n }\n }, [filteringProps?.isDisabled]);\n\n return (\n <div className={classnames(\"tree-widget-tree-header\", className)}>\n <HeaderButtons contracted={isSearchOpen} size={size}>\n {children}\n </HeaderButtons>\n {filteringProps ? (\n <DebouncedSearchBox\n isOpened={isSearchOpen}\n onOpen={() => setIsSearchOpen(true)}\n onClose={() => setIsSearchOpen(false)}\n onChange={(value) => (value ? filteringProps.onFilterStart(value) : filteringProps.onFilterClear())}\n delay={500}\n selectedResultIndex={filteringProps.selectedIndex}\n resultCount={filteringProps.resultCount}\n onSelectedResultChanged={(index) => filteringProps.onSelectedChanged?.(index)}\n size={size}\n isDisabled={instanceFocusEnabled || props.filteringProps?.isDisabled}\n />\n ) : null}\n </div>\n );\n}\n\ninterface DebouncedSearchBoxProps {\n isOpened: boolean;\n onOpen: () => void;\n onClose: () => void;\n onChange: (value: string) => void;\n delay: number;\n selectedResultIndex?: number;\n resultCount?: number;\n onSelectedResultChanged: (index: number) => void;\n size: \"large\" | \"small\";\n isDisabled?: boolean;\n}\n\nfunction DebouncedSearchBox({\n isOpened,\n selectedResultIndex,\n resultCount,\n onSelectedResultChanged,\n onChange,\n onOpen,\n onClose,\n delay,\n size,\n isDisabled,\n}: DebouncedSearchBoxProps) {\n const [inputValue, setInputValue] = useState<string>(\"\");\n const onChangeRef = useRef(onChange);\n // save latest `onChange` reference into `useRef` to avoid restarting timeout when `onChange` reference changes.\n onChangeRef.current = onChange;\n\n useEffect(() => {\n if (!inputValue) {\n onChangeRef.current(\"\");\n return;\n }\n\n const timeoutId = setTimeout(() => {\n onChangeRef.current(inputValue);\n }, delay);\n\n return () => {\n clearTimeout(timeoutId);\n };\n }, [inputValue, delay]);\n\n return (\n <SearchBox\n expandable\n isExpanded={isOpened}\n onExpand={onOpen}\n onCollapse={onClose}\n size={size}\n className={classnames(\"tree-widget-search-box\", !isOpened && \"contracted\")}\n isDisabled={isDisabled}\n >\n <SearchBox.CollapsedState>\n <SearchBox.ExpandButton\n label={TreeWidget.translate(\"header.searchBox.open\")}\n aria-label={TreeWidget.translate(\"header.searchBox.open\")}\n size={size}\n styleType=\"borderless\"\n />\n </SearchBox.CollapsedState>\n <SearchBox.ExpandedState>\n <SearchBox.Input placeholder={TreeWidget.translate(\"header.searchBox.search\")} onChange={(e) => setInputValue(e.currentTarget.value)} />\n <SearchResultStepper selectedIndex={selectedResultIndex} total={resultCount} onStep={onSelectedResultChanged} size={size} />\n <SearchBox.CollapseButton\n onClick={() => {\n setInputValue(\"\");\n onClose();\n }}\n size={size}\n aria-label={TreeWidget.translate(\"header.searchBox.close\")}\n label={TreeWidget.translate(\"header.searchBox.close\")}\n />\n </SearchBox.ExpandedState>\n </SearchBox>\n );\n}\n\ninterface HeaderButtonsProps {\n contracted: boolean;\n size: \"large\" | \"small\";\n}\n\nfunction HeaderButtons(props: PropsWithChildren<HeaderButtonsProps>) {\n const className = classnames(\"button-container\", props.contracted && \"contracted\");\n\n return (\n <ButtonGroup\n className={className}\n overflowButton={(overflowStart) => (\n <DropdownMenu\n menuItems={() =>\n Children.toArray(props.children)\n .slice(overflowStart)\n .map((btn, index) => (\n <li key={index} className=\"dropdown-item\" role=\"menuitem\">\n {btn}\n </li>\n ))\n }\n className=\"tree-header-button-dropdown-container\"\n >\n <IconButton label={TreeWidget.translate(\"header.dropdownMore\")} styleType=\"borderless\" size={props.size}>\n <SvgMore />\n </IconButton>\n </DropdownMenu>\n )}\n >\n {props.children}\n </ButtonGroup>\n );\n}\n\ninterface SearchResultStepperProps {\n total?: number;\n onStep: (newIndex: number) => void;\n selectedIndex?: number;\n size: \"large\" | \"small\";\n}\n\nfunction SearchResultStepper(props: SearchResultStepperProps) {\n const { selectedIndex = 1, total, onStep } = props;\n if (!total) {\n return null;\n }\n\n return (\n <>\n <span className=\"searchbox-stepping-count\">{`${selectedIndex}/${total}`}</span>\n <Divider orientation=\"vertical\" />\n <SearchBox.Button\n label={TreeWidget.translate(\"header.searchBox.previous\")}\n size={props.size}\n onClick={() => {\n if (selectedIndex > 1) {\n onStep(selectedIndex - 1);\n }\n }}\n >\n <SvgCaretUpSmall />\n </SearchBox.Button>\n <SearchBox.Button\n label={TreeWidget.translate(\"header.searchBox.next\")}\n size={props.size}\n onClick={() => {\n if (selectedIndex < total) {\n onStep(selectedIndex + 1);\n }\n }}\n >\n <SvgCaretDownSmall />\n </SearchBox.Button>\n </>\n );\n}\n"]}
@@ -8,6 +8,6 @@ interface TreeWithHeaderProps {
8
8
  buttons?: ReactNode;
9
9
  }
10
10
  /** @beta */
11
- export declare function TreeWithHeader({ filteringProps, buttons, density, children }: PropsWithChildren<TreeWithHeaderProps>): JSX.Element;
11
+ export declare function TreeWithHeader({ filteringProps, buttons, density, children }: PropsWithChildren<TreeWithHeaderProps>): import("react/jsx-runtime").JSX.Element;
12
12
  export {};
13
13
  //# sourceMappingURL=TreeWithHeader.d.ts.map
@@ -7,5 +7,5 @@ export type CategoriesTreeProps = Pick<VisibilityTreeProps, "imodel" | "getSchem
7
7
  };
8
8
  };
9
9
  /** @beta */
10
- export declare function CategoriesTree({ imodel, getSchemaContext, selectionStorage, activeView, filter, density, hierarchyLevelConfig, hierarchyConfig, selectionMode, onCategoriesFiltered, }: CategoriesTreeProps): JSX.Element;
10
+ export declare function CategoriesTree({ imodel, getSchemaContext, selectionStorage, activeView, filter, density, hierarchyLevelConfig, hierarchyConfig, selectionMode, onCategoriesFiltered, }: CategoriesTreeProps): import("react/jsx-runtime.js").JSX.Element;
11
11
  //# sourceMappingURL=CategoriesTree.d.ts.map
@@ -1,3 +1,4 @@
1
+ import type { ReactElement } from "react";
1
2
  import type { Viewport } from "@itwin/core-frontend";
2
3
  import type { TreeHeaderButtonProps } from "../../tree-header/TreeHeader.js";
3
4
  import type { CategoryInfo } from "../common/CategoriesVisibilityUtils.js";
@@ -35,11 +36,11 @@ export declare function useCategoriesTreeButtonProps({ viewport }: {
35
36
  onCategoriesFiltered: (categories: CategoryInfo[] | undefined) => void;
36
37
  };
37
38
  /** @public */
38
- export type CategoriesTreeHeaderButtonType = (props: CategoriesTreeHeaderButtonProps) => JSX.Element | null;
39
+ export type CategoriesTreeHeaderButtonType = (props: CategoriesTreeHeaderButtonProps) => ReactElement | null;
39
40
  /** @public */
40
- export declare function ShowAllButton(props: CategoriesTreeHeaderButtonProps): JSX.Element;
41
+ export declare function ShowAllButton(props: CategoriesTreeHeaderButtonProps): import("react/jsx-runtime.js").JSX.Element;
41
42
  /** @public */
42
- export declare function HideAllButton(props: CategoriesTreeHeaderButtonProps): JSX.Element;
43
+ export declare function HideAllButton(props: CategoriesTreeHeaderButtonProps): import("react/jsx-runtime.js").JSX.Element;
43
44
  /** @public */
44
- export declare function InvertAllButton(props: CategoriesTreeHeaderButtonProps): JSX.Element;
45
+ export declare function InvertAllButton(props: CategoriesTreeHeaderButtonProps): import("react/jsx-runtime.js").JSX.Element;
45
46
  //# sourceMappingURL=CategoriesTreeButtons.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CategoriesTreeButtons.js","sourceRoot":"","sources":["../../../../../../src/tree-widget-react/components/trees/categories-tree/CategoriesTreeButtons.tsx"],"names":[],"mappings":";;AA8CA,oEAcC;AAMD,sCAkBC;AAGD,sCAkBC;AAGD,0CAcC;;AA1HD;;;gGAGgG;AAEhG,iCAA0C;AAC1C,8DAAwD;AACxD,oEAAqG;AACrG,wDAAkD;AAClD,0DAAoD;AACpD,yFAA+I;AAC/I,qDAA+C;AAiB/C;;;;;;;;;;;;;;;;;GAiBG;AACH,SAAgB,4BAA4B,CAAC,EAAE,QAAQ,EAA0B;IAI/E,MAAM,CAAC,kBAAkB,EAAE,qBAAqB,CAAC,GAAG,IAAA,gBAAQ,GAA8B,CAAC;IAC3F,MAAM,WAAW,GAAG,IAAA,oBAAO,GAAE,CAAC;IAC9B,MAAM,UAAU,GAAG,aAAa,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;IACxD,OAAO;QACL,WAAW,EAAE;YACX,QAAQ;YACR,UAAU,EAAE,kBAAkB,IAAI,UAAU;SAC7C;QACD,oBAAoB,EAAE,qBAAqB;KAC5C,CAAC;AACJ,CAAC;AAKD,cAAc;AACd,SAAg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AAU,CAAC,SAAS,CAAC,uCAAuC,CAAC,EACpE,IAAI,EAAE,KAAK,CAAC,OAAO,KAAK,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,EACtD,SAAS,EAAC,YAAY,EACtB,OAAO,EAAE,GAAG,EAAE;YACZ,KAAK,CAAC,aAAa,EAAE,CAAC,wBAAwB,CAAC,CAAC;YAChD,KAAK,IAAA,kDAAmB,EAAC,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;QAC7D,CAAC,YAED,uBAAC,uCAAiB,KAAG,GACV,CACd,CAAC;AACJ,CAAC;AAED,MAAM,sBAAsB,GAAmB,EAAE,CAAC;AAElD,SAAS,aAAa,CAAC,QAAkB,EAAE,WAAuB;IAChE,MAAM,iBAAiB,GAAG,IAAA,eAAO,EAAC,KAAK,IAAI,EAAE,CAAC,IAAA,yDAA0B,EAAC,QAAQ,EAAE,WAAW,CAAC,EAAE,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAC;IAC1H,OAAO,IAAA,gCAAa,EAAC,iBAAiB,CAAC,IAAI,sBAAsB,CAAC;AACpE,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 { useMemo, useState } from \"react\";\nimport { useAsyncValue } from \"@itwin/components-react\";\nimport { SvgVisibilityHalf, SvgVisibilityHide, SvgVisibilityShow } from \"@itwin/itwinui-icons-react\";\nimport { IconButton } from \"@itwin/itwinui-react\";\nimport { TreeWidget } from \"../../../TreeWidget.js\";\nimport { hideAllCategories, invertAllCategories, loadCategoriesFromViewport, showAllCategories } from \"../common/CategoriesVisibilityUtils.js\";\nimport { useGuid } from \"../common/useGuid.js\";\n\nimport type { GuidString } from \"@itwin/core-bentley\";\nimport type { Viewport } from \"@itwin/core-frontend\";\nimport type { TreeHeaderButtonProps } from \"../../tree-header/TreeHeader.js\";\nimport type { CategoryInfo } from \"../common/CategoriesVisibilityUtils.js\";\n\n/**\n * Props that get passed to `CategoriesTreeComponent` header button renderer.\n * @see CategoriesTreeComponentProps.headerButtons\n * @public\n */\nexport interface CategoriesTreeHeaderButtonProps extends TreeHeaderButtonProps {\n /** A list of categories available in the iModel */\n categories: CategoryInfo[];\n}\n\n/**\n * Custom hook that creates props required to render `CategoriesTreeComponent` header button.\n *\n * Example:\n * ```tsx\n * const { buttonProps, onCategoriesFiltered } = useCategoriesTreeButtonProps({ viewport });\n * <TreeWithHeader\n * buttons={[\n * <CategoriesTreeComponent.ShowAllButton {...buttonProps} />,\n * <CategoriesTreeComponent.HideAllButton {...buttonProps} />,\n * ]}\n * >\n * <CategoriesTree {...treeProps} onCategoriesFiltered={onCategoriesFiltered} />\n * </TreeWithHeader>\n * ```\n *\n * @public\n */\nexport function useCategoriesTreeButtonProps({ viewport }: { viewport: Viewport }): {\n buttonProps: Pick<CategoriesTreeHeaderButtonProps, \"categories\" | \"viewport\">;\n onCategoriesFiltered: (categories: CategoryInfo[] | undefined) => void;\n} {\n const [filteredCategories, setFilteredCategories] = useState<CategoryInfo[] | undefined>();\n const componentId = useGuid();\n const categories = useCategories(viewport, componentId);\n return {\n buttonProps: {\n viewport,\n categories: filteredCategories ?? categories,\n },\n onCategoriesFiltered: setFilteredCategories,\n };\n}\n\n/** @public */\nexport type CategoriesTreeHeaderButtonType = (props: CategoriesTreeHeaderButtonProps) => JSX.Element | null;\n\n/** @public */\nexport function ShowAllButton(props: CategoriesTreeHeaderButtonProps) {\n return (\n <IconButton\n size={props.density === \"enlarged\" ? \"large\" : \"small\"}\n styleType=\"borderless\"\n label={TreeWidget.translate(\"categoriesTree.buttons.showAll.tooltip\")}\n onClick={() => {\n // cspell:disable-next-line\n props.onFeatureUsed?.(`categories-tree-showall`);\n void showAllCategories(\n props.categories.map((category) => category.categoryId),\n props.viewport,\n );\n }}\n >\n <SvgVisibilityShow />\n </IconButton>\n );\n}\n\n/** @public */\nexport function HideAllButton(props: CategoriesTreeHeaderButtonProps) {\n return (\n <IconButton\n size={props.density === \"enlarged\" ? \"large\" : \"small\"}\n styleType=\"borderless\"\n label={TreeWidget.translate(\"categoriesTree.buttons.hideAll.tooltip\")}\n onClick={() => {\n // cspell:disable-next-line\n props.onFeatureUsed?.(`categories-tree-hideall`);\n void hideAllCategories(\n props.categories.map((category) => category.categoryId),\n props.viewport,\n );\n }}\n >\n <SvgVisibilityHide />\n </IconButton>\n );\n}\n\n/** @public */\nexport function InvertAllButton(props: CategoriesTreeHeaderButtonProps) {\n return (\n <IconButton\n label={TreeWidget.translate(\"categoriesTree.buttons.invert.tooltip\")}\n size={props.density === \"enlarged\" ? \"large\" : \"small\"}\n styleType=\"borderless\"\n onClick={() => {\n props.onFeatureUsed?.(`categories-tree-invert`);\n void invertAllCategories(props.categories, props.viewport);\n }}\n >\n <SvgVisibilityHalf />\n </IconButton>\n );\n}\n\nconst EMPTY_CATEGORIES_ARRAY: CategoryInfo[] = [];\n\nfunction useCategories(viewport: Viewport, componentId: GuidString) {\n const categoriesPromise = useMemo(async () => loadCategoriesFromViewport(viewport, componentId), [viewport, componentId]);\n return useAsyncValue(categoriesPromise) ?? EMPTY_CATEGORIES_ARRAY;\n}\n"]}
1
+ {"version":3,"file":"CategoriesTreeButtons.js","sourceRoot":"","sources":["../../../../../../src/tree-widget-react/components/trees/categories-tree/CategoriesTreeButtons.tsx"],"names":[],"mappings":";;AA+CA,oEAcC;AAMD,sCAkBC;AAGD,sCAkBC;AAGD,0CAcC;;AA3HD;;;gGAGgG;AAEhG,iCAA0C;AAC1C,8DAAwD;AACxD,oEAAqG;AACrG,wDAAkD;AAClD,0DAAoD;AACpD,yFAA+I;AAC/I,qDAA+C;AAkB/C;;;;;;;;;;;;;;;;;GAiBG;AACH,SAAgB,4BAA4B,CAAC,EAAE,QAAQ,EAA0B;IAI/E,MAAM,CAAC,kBAAkB,EAAE,qBAAqB,CA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D,KAAK,IAAA,gDAAiB,EACpB,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,EACvD,KAAK,CAAC,QAAQ,CACf,CAAC;QACJ,CAAC,YAED,uBAAC,uCAAiB,KAAG,GACV,CACd,CAAC;AACJ,CAAC;AAED,cAAc;AACd,SAAgB,eAAe,CAAC,KAAsC;IACpE,OAAO,CACL,uBAAC,0BAAU,IACT,KAAK,EAAE,0BAAU,CAAC,SAAS,CAAC,uCAAuC,CAAC,EACpE,IAAI,EAAE,KAAK,CAAC,OAAO,KAAK,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,EACtD,SAAS,EAAC,YAAY,EACtB,OAAO,EAAE,GAAG,EAAE;YACZ,KAAK,CAAC,aAAa,EAAE,CAAC,wBAAwB,CAAC,CAAC;YAChD,KAAK,IAAA,kDAAmB,EAAC,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;QAC7D,CAAC,YAED,uBAAC,uCAAiB,KAAG,GACV,CACd,CAAC;AACJ,CAAC;AAED,MAAM,sBAAsB,GAAmB,EAAE,CAAC;AAElD,SAAS,aAAa,CAAC,QAAkB,EAAE,WAAuB;IAChE,MAAM,iBAAiB,GAAG,IAAA,eAAO,EAAC,KAAK,IAAI,EAAE,CAAC,IAAA,yDAA0B,EAAC,QAAQ,EAAE,WAAW,CAAC,EAAE,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAC;IAC1H,OAAO,IAAA,gCAAa,EAAC,iBAAiB,CAAC,IAAI,sBAAsB,CAAC;AACpE,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 { useMemo, useState } from \"react\";\nimport { useAsyncValue } from \"@itwin/components-react\";\nimport { SvgVisibilityHalf, SvgVisibilityHide, SvgVisibilityShow } from \"@itwin/itwinui-icons-react\";\nimport { IconButton } from \"@itwin/itwinui-react\";\nimport { TreeWidget } from \"../../../TreeWidget.js\";\nimport { hideAllCategories, invertAllCategories, loadCategoriesFromViewport, showAllCategories } from \"../common/CategoriesVisibilityUtils.js\";\nimport { useGuid } from \"../common/useGuid.js\";\n\nimport type { ReactElement } from \"react\";\nimport type { GuidString } from \"@itwin/core-bentley\";\nimport type { Viewport } from \"@itwin/core-frontend\";\nimport type { TreeHeaderButtonProps } from \"../../tree-header/TreeHeader.js\";\nimport type { CategoryInfo } from \"../common/CategoriesVisibilityUtils.js\";\n\n/**\n * Props that get passed to `CategoriesTreeComponent` header button renderer.\n * @see CategoriesTreeComponentProps.headerButtons\n * @public\n */\nexport interface CategoriesTreeHeaderButtonProps extends TreeHeaderButtonProps {\n /** A list of categories available in the iModel */\n categories: CategoryInfo[];\n}\n\n/**\n * Custom hook that creates props required to render `CategoriesTreeComponent` header button.\n *\n * Example:\n * ```tsx\n * const { buttonProps, onCategoriesFiltered } = useCategoriesTreeButtonProps({ viewport });\n * <TreeWithHeader\n * buttons={[\n * <CategoriesTreeComponent.ShowAllButton {...buttonProps} />,\n * <CategoriesTreeComponent.HideAllButton {...buttonProps} />,\n * ]}\n * >\n * <CategoriesTree {...treeProps} onCategoriesFiltered={onCategoriesFiltered} />\n * </TreeWithHeader>\n * ```\n *\n * @public\n */\nexport function useCategoriesTreeButtonProps({ viewport }: { viewport: Viewport }): {\n buttonProps: Pick<CategoriesTreeHeaderButtonProps, \"categories\" | \"viewport\">;\n onCategoriesFiltered: (categories: CategoryInfo[] | undefined) => void;\n} {\n const [filteredCategories, setFilteredCategories] = useState<CategoryInfo[] | undefined>();\n const componentId = useGuid();\n const categories = useCategories(viewport, componentId);\n return {\n buttonProps: {\n viewport,\n categories: filteredCategories ?? categories,\n },\n onCategoriesFiltered: setFilteredCategories,\n };\n}\n\n/** @public */\nexport type CategoriesTreeHeaderButtonType = (props: CategoriesTreeHeaderButtonProps) => ReactElement | null;\n\n/** @public */\nexport function ShowAllButton(props: CategoriesTreeHeaderButtonProps) {\n return (\n <IconButton\n size={props.density === \"enlarged\" ? \"large\" : \"small\"}\n styleType=\"borderless\"\n label={TreeWidget.translate(\"categoriesTree.buttons.showAll.tooltip\")}\n onClick={() => {\n // cspell:disable-next-line\n props.onFeatureUsed?.(`categories-tree-showall`);\n void showAllCategories(\n props.categories.map((category) => category.categoryId),\n props.viewport,\n );\n }}\n >\n <SvgVisibilityShow />\n </IconButton>\n );\n}\n\n/** @public */\nexport function HideAllButton(props: CategoriesTreeHeaderButtonProps) {\n return (\n <IconButton\n size={props.density === \"enlarged\" ? \"large\" : \"small\"}\n styleType=\"borderless\"\n label={TreeWidget.translate(\"categoriesTree.buttons.hideAll.tooltip\")}\n onClick={() => {\n // cspell:disable-next-line\n props.onFeatureUsed?.(`categories-tree-hideall`);\n void hideAllCategories(\n props.categories.map((category) => category.categoryId),\n props.viewport,\n );\n }}\n >\n <SvgVisibilityHide />\n </IconButton>\n );\n}\n\n/** @public */\nexport function InvertAllButton(props: CategoriesTreeHeaderButtonProps) {\n return (\n <IconButton\n label={TreeWidget.translate(\"categoriesTree.buttons.invert.tooltip\")}\n size={props.density === \"enlarged\" ? \"large\" : \"small\"}\n styleType=\"borderless\"\n onClick={() => {\n props.onFeatureUsed?.(`categories-tree-invert`);\n void invertAllCategories(props.categories, props.viewport);\n }}\n >\n <SvgVisibilityHalf />\n </IconButton>\n );\n}\n\nconst EMPTY_CATEGORIES_ARRAY: CategoryInfo[] = [];\n\nfunction useCategories(viewport: Viewport, componentId: GuidString) {\n const categoriesPromise = useMemo(async () => loadCategoriesFromViewport(viewport, componentId), [viewport, componentId]);\n return useAsyncValue(categoriesPromise) ?? EMPTY_CATEGORIES_ARRAY;\n}\n"]}
@@ -21,7 +21,7 @@ interface CategoriesTreeComponentProps extends Pick<CategoriesTreeProps, "getSch
21
21
  * @public
22
22
  */
23
23
  export declare const CategoriesTreeComponent: {
24
- (props: CategoriesTreeComponentProps): JSX.Element | null;
24
+ (props: CategoriesTreeComponentProps): import("react/jsx-runtime.js").JSX.Element | null;
25
25
  /**
26
26
  * Renders a "Show all" button that enables display of all categories and their subcategories.
27
27
  * @public
@@ -42,10 +42,6 @@ export declare const CategoriesTreeComponent: {
42
42
  * @public
43
43
  */
44
44
  id: string;
45
- /**
46
- * Label of the component. May be used when a creating a `TreeDefinition` for `SelectableTree`.
47
- * @public
48
- */
49
45
  getLabel(): string;
50
46
  };
51
47
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"CategoriesTreeComponent.js","sourceRoot":"","sources":["../../../../../../src/tree-widget-react/components/trees/categories-tree/CategoriesTreeComponent.tsx"],"names":[],"mappings":";;;;;AAAA;;;gGAGgG;AAEhG,iCAAiC;AACjC,oDAA+D;AAC/D,0DAAoD;AACpD,2EAAqE;AACrE,yEAAmE;AACnE,+DAAyD;AACzD,6EAA4E;AAC5E,2DAAqD;AACrD,yEAAyH;AAyBzH;;;GAGG;AACI,MAAM,uBAAuB,GAAG,CAAC,KAAmC,EAAE,EAAE;IAC7E,MAAM,MAAM,GAAG,IAAA,uCAAyB,GAAE,CAAC;IAC3C,MAAM,QAAQ,GAAG,IAAA,wCAAiB,GAAE,CAAC;IAErC,IAAI,CAAC,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC;QACzB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,uBAAC,2BAA2B,OAAK,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAI,CAAC;AACxF,CAAC,CAAC;AATW,QAAA,uBAAuB,2BASlC;AAEF;;;GAGG;AACH,+BAAuB,CAAC,aAAa,GAAG,wCAA+C,CAAC;AAExF;;;GAGG;AACH,+BAAuB,CAAC,aAAa,GAAG,wCAA+C,CAAC;AAExF;;;GAGG;AACH,+BAAuB,CAAC,eAAe,GAAG,0CAAiD,CAAC;AAE5F;;;G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,kCAAc,IACb,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,EAChB,cAAc,EAAE;gBACd,aAAa,EAAE,WAAW;gBAC1B,aAAa,EAAE,WAAW;aAC3B,YAED,uBAAC,kCAAc,OAAK,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,oBAAoB,EAAE,oBAAoB,GAAI,GACpH,GACQ,CAC5B,CAAC;AACJ,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 { Fragment } from \"react\";\nimport { useActiveIModelConnection } from \"@itwin/appui-react\";\nimport { TreeWidget } from \"../../../TreeWidget.js\";\nimport { TreeWithHeader } from \"../../tree-header/TreeWithHeader.js\";\nimport { useActiveViewport } from \"../common/UseActiveViewport.js\";\nimport { useFiltering } from \"../common/UseFiltering.js\";\nimport { TelemetryContextProvider } from \"../common/UseTelemetryContext.js\";\nimport { CategoriesTree } from \"./CategoriesTree.js\";\nimport { HideAllButton, InvertAllButton, ShowAllButton, useCategoriesTreeButtonProps } from \"./CategoriesTreeButtons.js\";\n\nimport type { ReactNode } from \"react\";\nimport type { IModelConnection, ScreenViewport } from \"@itwin/core-frontend\";\nimport type { CategoriesTreeProps } from \"./CategoriesTree.js\";\nimport type { CategoriesTreeHeaderButtonProps, CategoriesTreeHeaderButtonType } from \"./CategoriesTreeButtons.js\";\n\n/** @public */\ninterface CategoriesTreeComponentProps\n extends Pick<CategoriesTreeProps, \"getSchemaContext\" | \"selectionStorage\" | \"density\" | \"hierarchyLevelConfig\" | \"selectionMode\" | \"hierarchyConfig\"> {\n /**\n * Renderers of header buttons. Defaults to:\n * ```ts\n * [\n * CategoriesTreeComponent.ShowAllButton,\n * CategoriesTreeComponent.HideAllButton,\n * CategoriesTreeComponent.InvertAllButton,\n * ]\n * ```\n */\n headerButtons?: Array<(props: CategoriesTreeHeaderButtonProps) => React.ReactNode>;\n onPerformanceMeasured?: (featureId: string, duration: number) => void;\n onFeatureUsed?: (feature: string) => void;\n}\n\n/**\n * A component that renders `CategoriesTree` and a header with filtering capabilities and header buttons.\n * @public\n */\nexport const CategoriesTreeComponent = (props: CategoriesTreeComponentProps) => {\n const iModel = useActiveIModelConnection();\n const viewport = useActiveViewport();\n\n if (!iModel || !viewport) {\n return null;\n }\n\n return <CategoriesTreeComponentImpl {...props} iModel={iModel} viewport={viewport} />;\n};\n\n/**\n * Renders a \"Show all\" button that enables display of all categories and their subcategories.\n * @public\n */\nCategoriesTreeComponent.ShowAllButton = ShowAllButton as CategoriesTreeHeaderButtonType;\n\n/**\n * Renders a \"Hide all\" button that disables display of all categories.\n * @public\n */\nCategoriesTreeComponent.HideAllButton = HideAllButton as CategoriesTreeHeaderButtonType;\n\n/**\n * Renders an \"Invert all\" button that inverts display of all categories.\n * @public\n */\nCategoriesTreeComponent.InvertAllButton = InvertAllButton as CategoriesTreeHeaderButtonType;\n\n/**\n * Id of the component. May be used when a creating a `TreeDefinition` for `SelectableTree`.\n * @public\n */\nCategoriesTreeComponent.id = \"categories-tree-v2\";\n\n/**\n * Label of the component. May be used when a creating a `TreeDefinition` for `SelectableTree`.\n * @public\n */\nCategoriesTreeComponent.getLabel = () => TreeWidget.translate(\"categoriesTree.label\");\n\nfunction CategoriesTreeComponentImpl({\n iModel,\n viewport,\n headerButtons,\n onPerformanceMeasured,\n onFeatureUsed,\n ...treeProps\n}: CategoriesTreeComponentProps & { iModel: IModelConnection; viewport: ScreenViewport }) {\n const { buttonProps, onCategoriesFiltered } = useCategoriesTreeButtonProps({ viewport });\n const { filter, applyFilter, clearFilter } = useFiltering();\n const density = treeProps.density;\n\n const buttons: ReactNode = headerButtons\n ? headerButtons.map((btn, index) => <Fragment key={index}>{btn({ ...buttonProps, onFeatureUsed })}</Fragment>)\n : [\n <ShowAllButton {...buttonProps} key=\"show-all-btn\" density={density} onFeatureUsed={onFeatureUsed} />,\n <HideAllButton {...buttonProps} key=\"hide-all-btn\" density={density} onFeatureUsed={onFeatureUsed} />,\n <InvertAllButton {...buttonProps} key=\"invert-all-btn\" density={density} onFeatureUsed={onFeatureUsed} />,\n ];\n\n return (\n <TelemetryContextProvider componentIdentifier={CategoriesTreeComponent.id} onFeatureUsed={onFeatureUsed} onPerformanceMeasured={onPerformanceMeasured}>\n <TreeWithHeader\n buttons={buttons}\n density={density}\n filteringProps={{\n onFilterStart: applyFilter,\n onFilterClear: clearFilter,\n }}\n >\n <CategoriesTree {...treeProps} imodel={iModel} activeView={viewport} filter={filter} onCategoriesFiltered={onCategoriesFiltered} />\n </TreeWithHeader>\n </TelemetryContextProvider>\n );\n}\n"]}
1
+ {"version":3,"file":"CategoriesTreeComponent.js","sourceRoot":"","sources":["../../../../../../src/tree-widget-react/components/trees/categories-tree/CategoriesTreeComponent.tsx"],"names":[],"mappings":";;;;;AAAA;;;gGAGgG;AAEhG,iCAAiC;AACjC,oDAA+D;AAC/D,0DAAoD;AACpD,2EAAqE;AACrE,yEAAmE;AACnE,+DAAyD;AACzD,6EAA4E;AAC5E,2DAAqD;AACrD,yEAAyH;AA2BzH;;;GAGG;AACI,MAAM,uBAAuB,GAAG,CAAC,KAAmC,EAAE,EAAE;IAC7E,MAAM,MAAM,GAAG,IAAA,uCAAyB,GAAE,CAAC;IAC3C,MAAM,QAAQ,GAAG,IAAA,wCAAiB,GAAE,CAAC;IAErC,IAAI,CAAC,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC;QACzB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,uBAAC,2BAA2B,OAAK,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAI,CAAC;AACxF,CAAC,CAAC;AATW,QAAA,uBAAuB,2BASlC;AAEF;;;GAGG;AACH,+BAAuB,CAAC,aAAa,GAAG,wCAA+C,CAAC;AAExF;;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,uBAAC,iDAAwB,IAAC,mBAAmB,EAAE,+BAAuB,CAAC,EAAE,EAAE,aAAa,EAAE,aAAa,EAAE,qBAAqB,EAAE,qBAAqB,YACnJ,uBAAC,kCAAc,IACb,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,EAChB,cAAc,EAAE;gBACd,aAAa,EAAE,WAAW;gBAC1B,aAAa,EAAE,WAAW;aAC3B,YAED,uBAAC,kCAAc,OAAK,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,oBAAoB,EAAE,oBAAoB,GAAI,GACpH,GACQ,CAC5B,CAAC;AACJ,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 { Fragment } from \"react\";\nimport { useActiveIModelConnection } from \"@itwin/appui-react\";\nimport { TreeWidget } from \"../../../TreeWidget.js\";\nimport { TreeWithHeader } from \"../../tree-header/TreeWithHeader.js\";\nimport { useActiveViewport } from \"../common/UseActiveViewport.js\";\nimport { useFiltering } from \"../common/UseFiltering.js\";\nimport { TelemetryContextProvider } from \"../common/UseTelemetryContext.js\";\nimport { CategoriesTree } from \"./CategoriesTree.js\";\nimport { HideAllButton, InvertAllButton, ShowAllButton, useCategoriesTreeButtonProps } from \"./CategoriesTreeButtons.js\";\n\nimport type { ReactNode } from \"react\";\nimport type { IModelConnection, ScreenViewport } from \"@itwin/core-frontend\";\nimport type { CategoriesTreeProps } from \"./CategoriesTree.js\";\nimport type { CategoriesTreeHeaderButtonProps, CategoriesTreeHeaderButtonType } from \"./CategoriesTreeButtons.js\";\n\n/** @public */\ninterface CategoriesTreeComponentProps extends Pick<\n CategoriesTreeProps,\n \"getSchemaContext\" | \"selectionStorage\" | \"density\" | \"hierarchyLevelConfig\" | \"selectionMode\" | \"hierarchyConfig\"\n> {\n /**\n * Renderers of header buttons. Defaults to:\n * ```ts\n * [\n * CategoriesTreeComponent.ShowAllButton,\n * CategoriesTreeComponent.HideAllButton,\n * CategoriesTreeComponent.InvertAllButton,\n * ]\n * ```\n */\n headerButtons?: Array<(props: CategoriesTreeHeaderButtonProps) => React.ReactNode>;\n onPerformanceMeasured?: (featureId: string, duration: number) => void;\n onFeatureUsed?: (feature: string) => void;\n}\n\n/**\n * A component that renders `CategoriesTree` and a header with filtering capabilities and header buttons.\n * @public\n */\nexport const CategoriesTreeComponent = (props: CategoriesTreeComponentProps) => {\n const iModel = useActiveIModelConnection();\n const viewport = useActiveViewport();\n\n if (!iModel || !viewport) {\n return null;\n }\n\n return <CategoriesTreeComponentImpl {...props} iModel={iModel} viewport={viewport} />;\n};\n\n/**\n * Renders a \"Show all\" button that enables display of all categories and their subcategories.\n * @public\n */\nCategoriesTreeComponent.ShowAllButton = ShowAllButton as CategoriesTreeHeaderButtonType;\n\n/**\n * Renders a \"Hide all\" button that disables display of all categories.\n * @public\n */\nCategoriesTreeComponent.HideAllButton = HideAllButton as CategoriesTreeHeaderButtonType;\n\n/**\n * Renders an \"Invert all\" button that inverts display of all categories.\n * @public\n */\nCategoriesTreeComponent.InvertAllButton = InvertAllButton as CategoriesTreeHeaderButtonType;\n\n/**\n * Id of the component. May be used when a creating a `TreeDefinition` for `SelectableTree`.\n * @public\n */\nCategoriesTreeComponent.id = \"categories-tree-v2\";\n\n/**\n * Label of the component. May be used when a creating a `TreeDefinition` for `SelectableTree`.\n * @public\n */\nCategoriesTreeComponent.getLabel = () => TreeWidget.translate(\"categoriesTree.label\");\n\nfunction CategoriesTreeComponentImpl({\n iModel,\n viewport,\n headerButtons,\n onPerformanceMeasured,\n onFeatureUsed,\n ...treeProps\n}: CategoriesTreeComponentProps & { iModel: IModelConnection; viewport: ScreenViewport }) {\n const { buttonProps, onCategoriesFiltered } = useCategoriesTreeButtonProps({ viewport });\n const { filter, applyFilter, clearFilter } = useFiltering();\n const density = treeProps.density;\n\n const buttons: ReactNode = headerButtons\n ? headerButtons.map((btn, index) => <Fragment key={index}>{btn({ ...buttonProps, onFeatureUsed })}</Fragment>)\n : [\n <ShowAllButton {...buttonProps} key=\"show-all-btn\" density={density} onFeatureUsed={onFeatureUsed} />,\n <HideAllButton {...buttonProps} key=\"hide-all-btn\" density={density} onFeatureUsed={onFeatureUsed} />,\n <InvertAllButton {...buttonProps} key=\"invert-all-btn\" density={density} onFeatureUsed={onFeatureUsed} />,\n ];\n\n return (\n <TelemetryContextProvider componentIdentifier={CategoriesTreeComponent.id} onFeatureUsed={onFeatureUsed} onPerformanceMeasured={onPerformanceMeasured}>\n <TreeWithHeader\n buttons={buttons}\n density={density}\n filteringProps={{\n onFilterStart: applyFilter,\n onFilterClear: clearFilter,\n }}\n >\n <CategoriesTree {...treeProps} imodel={iModel} activeView={viewport} filter={filter} onCategoriesFiltered={onCategoriesFiltered} />\n </TreeWithHeader>\n </TelemetryContextProvider>\n );\n}\n"]}
@@ -29,6 +29,7 @@ export declare class CategoriesTreeIdsCache implements Disposable {
29
29
  definitionContainers: Id64Array;
30
30
  }>;
31
31
  getCategoriesElementModels(categoryIds: Id64Arg): Observable<Map<Id64String, Id64Set>>;
32
+ getCategoriesOfElementModel(modelId: Id64String): Observable<Id64Set | undefined>;
32
33
  getAllContainedCategories({ definitionContainerIds, includeEmptyCategories, }: {
33
34
  definitionContainerIds: Id64Array;
34
35
  includeEmptyCategories?: boolean;
@@ -281,6 +281,9 @@ class CategoriesTreeIdsCache {
281
281
  return acc;
282
282
  }, new Map()));
283
283
  }
284
+ getCategoriesOfElementModel(modelId) {
285
+ return this.getElementModelsCategories().pipe((0, rxjs_1.map)((elementModelsCategories) => elementModelsCategories.get(modelId)));
286
+ }
284
287
  getAllContainedCategories({ definitionContainerIds, includeEmptyCategories, }) {
285
288
  return this.getDefinitionContainersInfo().pipe((0, rxjs_1.mergeMap)((definitionContainersInfo) => (0, rxjs_1.from)(definitionContainerIds).pipe((0, rxjs_1.mergeMap)((definitionContainerId) => {
286
289
  const definitionContainerInfo = definitionContainersInfo.get(definitionContainerId);
@@ -1 +1 @@
1
- {"version":3,"file":"CategoriesTreeIdsCache.js","sourceRoot":"","sources":["../../../../../../../src/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeIdsCache.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAyiBhG,4CAIC;AA3iBD,+BAA8F;AAC9F,sDAAiD;AACjD,6DAAiE;AACjE,uEAA2F;AA0B3F,gBAAgB;AAChB,MAAa,sBAAsB;IACjC,yBAAyB,CAAmE;IAC5F,qBAAqB,CAA0D;IAC/E,kBAAkB,CAAmD;IACrE,wBAAwB,CAAmD;IAC3E,cAAc,CAAS;IACvB,qBAAqB,CAAS;IAC9B,mBAAmB,CAAS;IAC5B,+BAA+B,CAAkC;IACjE,cAAc,CAA6B;IAC3C,YAAY,CAAa;IACzB,cAAc,CAAS;IAEvB,YAAY,aAAyC,EAAE,QAAqB,EAAE,WAAwB;QACpG,IAAI,CAAC,cAAc,GAAG,aAAa,CAAC;QACpC,MAAM,EAAE,aAAa,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,GAAG,gBAAgB,CAAC,QAAQ,CAAC,CAAC;QAC/F,IAAI,CAAC,cAAc,GAAG,aAAa,CAAC;QACpC,IAAI,CAAC,qBAAqB,GAAG,oBAAoB,CAAC;QAClD,IAAI,CAAC,mBAAmB,GAAG,kBAAkB,CAAC;QAC9C,IAAI,CAAC,YAAY,GAAG,WAAW,IAAI,mBAAI,CAAC,WAAW,EAAE,CAAC;QACtD,IAAI,CAAC,cAAc,GAAG,wBAAwB,CAAC;IACjD,CAAC;IAEM,CAAC,MAAM,CAAC,OAAO,CAAC,KAAI,CAAC;IAEpB,2BAA2B;QAIjC,OAAO,IAAA,YAAK,EAAC,GAAG,EAAE;YAChB,MAAM,KAAK,GAAG;;eAEL,IAAI,CAAC,mBAAmB;eACxB,IAAI,CAAC,qBAAqB;;;OAGlC,CAAC;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CAAoC,EAAE,CAAC,IAAI,CAAC,IAAA,kBAAW,GAAE,CAAC,CAAC;QACzG,OAAO,IAAI,CAAC,+BAA+B,CAAC;IAC9C,CAAC;CACF;AAtgBD,wDAsgBC;AAED,gBAAgB;AAChB,SAAgB,gBAAgB,CAAC,QAAqB;IACpD,OAAO,QAAQ,KAAK,IAAI;QACtB,CAAC,CAAC,EAAE,aAAa,EAAE,yBAAyB,EAAE,oBAAoB,EAAE,4BAA4B,EAAE,kBAAkB,EAAE,0BAA0B,EAAE;QAClJ,CAAC,CAAC,EAAE,aAAa,EAAE,yBAAyB,EAAE,oBAAoB,EAAE,4BAA4B,EAAE,kBAAkB,EAAE,0BAA0B,EAAE,CAAC;AACvJ,CAAC;AAED,SAAS,mBAAmB,CAAsC,IAAS,EAAE,YAAiC;IAC5G,OAAO,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC;AAC/E,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 { defer, forkJoin, from, map, mergeMap, of, reduce, shareReplay, toArray } from \"rxjs\";\nimport { Guid, Id64 } from \"@itwin/core-bentley\";\nimport { setIntersection } from \"../../common/internal/Utils.js\";\nimport { DEFINITION_CONTAINER_CLASS, SUB_CATEGORY_CLASS } from \"./ClassNameDefinitions.js\";\n\nimport type { Observable } from \"rxjs\";\nimport type { GuidString, Id64Arg, Id64Array, Id64Set, Id64String } from \"@itwin/core-bentley\";\nimport type { LimitingECSqlQueryExecutor } from \"@itwin/presentation-hierarchies\";\nimport type { InstanceKey } from \"@itwin/presentation-shared\";\n\ninterface DefinitionContainerInfo {\n modelId: Id64String;\n parentDefinitionContainerExists: boolean;\n childCategories: CategoryInfo[];\n childDefinitionContainers: Array<{ id: Id64String; hasElements: boolean }>;\n hasElements: boolean;\n}\n\ninterface CategoriesInfo {\n childCategories: CategoryInfo[];\n parentDefinitionContainerExists: boolean;\n}\n\ninterface CategoryInfo {\n id: Id64String;\n childCount: number;\n hasElements: boolean;\n}\n\n/** @internal */\nexport class CategoriesTreeIdsCache implements Disposable {\n #definitionContainersInfo: Observable<Map<Id64String, DefinitionContainerInfo>> | undefined;\n #modelsCategoriesInfo: Observable<Map<Id64String, CategoriesInfo>> | undefined;\n #subCategoriesInfo: Observable<Map<Id64String, Id64Set>> | undefined;\n #elementModelsCategories: Observable<Map<Id64String, Id64Set>> | undefined;\n #categoryClass: string;\n #categoryElementClass: string;\n #categoryModelClass: string;\n #isDefinitionContainerSupported: Observable<boolean> | undefined;\n #queryExecutor: LimitingECSqlQueryExecutor;\n #componentId: GuidString;\n #componentName: string;\n\n constructor(queryExecutor: LimitingECSqlQueryExecutor, viewType: \"3d\" | \"2d\", componentId?: GuidString) {\n this.#queryExecutor = queryExecutor;\n const { categoryClass, categoryElementClass, categoryModelClass } = getClassesByView(viewType);\n this.#categoryClass = categoryClass;\n this.#categoryElementClass = categoryElementClass;\n this.#categoryModelClass = categoryModelClass;\n this.#componentId = componentId ?? Guid.createValue();\n this.#componentName = \"CategoriesTreeIdsCache\";\n }\n\n public [Symbol.dispose]() {}\n\n private queryElementModelCategories(): Observable<{\n modelId: Id64String;\n categoryId: Id64String;\n }> {\n return defer(() => {\n const query = `\n SELECT this.Model.Id modelId, this.Category.Id categoryId\n FROM ${this.#categoryModelClass} m\n JOIN ${this.#categoryElementClass} this ON m.ECInstanceId = this.Model.Id\n WHERE m.IsPrivate = false\n GROUP BY modelId, categoryId\n `;\n return this.#queryExecutor.createQueryReader(\n { ecsql: query },\n {\n rowFormat: \"ECSqlPropertyNames\",\n limit: \"unbounded\",\n restartToken: `${this.#componentName}/${this.#componentId}/element-models-and-categories`,\n },\n );\n }).pipe(\n map((row) => {\n return { modelId: row.modelId, categoryId: row.categoryId };\n }),\n );\n }\n\n private queryCategories(): Observable<{\n id: Id64String;\n modelId: Id64String;\n parentDefinitionContainerExists: boolean;\n childCount: number;\n hasElements: boolean;\n }> {\n return this.getIsDefinitionContainerSupported().pipe(\n mergeMap((isDefinitionContainerSupported) =>\n defer(() => {\n const categoriesQuery = `\n SELECT\n this.ECInstanceId id,\n COUNT(sc.ECInstanceId) childCount,\n this.Model.Id modelId,\n ${\n isDefinitionContainerSupported\n ? `\n IIF(this.Model.Id IN (SELECT dc.ECInstanceId FROM ${DEFINITION_CONTAINER_CLASS} dc),\n true,\n false\n )`\n : \"false\"\n } parentDefinitionContainerExists,\n IFNULL(\n (SELECT 1 FROM ${this.#categoryElementClass} e WHERE e.Category.Id = this.ECInstanceId LIMIT 1),\n 0\n ) hasElements\n FROM\n ${this.#categoryClass} this\n JOIN ${SUB_CATEGORY_CLASS} sc ON sc.Parent.Id = this.ECInstanceId\n JOIN BisCore.Model m ON m.ECInstanceId = this.Model.Id\n WHERE\n NOT this.IsPrivate\n AND (NOT m.IsPrivate OR m.ECClassId IS (BisCore.DictionaryModel))\n GROUP BY this.ECInstanceId\n `;\n return this.#queryExecutor.createQueryReader(\n { ecsql: categoriesQuery },\n { rowFormat: \"ECSqlPropertyNames\", limit: \"unbounded\", restartToken: `${this.#componentName}/${this.#componentId}/categories` },\n );\n }).pipe(\n map((row) => {\n return {\n id: row.id,\n modelId: row.modelId,\n parentDefinitionContainerExists: row.parentDefinitionContainerExists,\n childCount: row.childCount,\n hasElements: !!row.hasElements,\n };\n }),\n ),\n ),\n );\n }\n\n private queryIsDefinitionContainersSupported(): Observable<boolean> {\n return defer(() => {\n const query = `\n SELECT\n 1\n FROM\n ECDbMeta.ECSchemaDef s\n JOIN ECDbMeta.ECClassDef c ON c.Schema.Id = s.ECInstanceId\n WHERE\n s.Name = 'BisCore'\n AND c.Name = 'DefinitionContainer'\n LIMIT 1\n `;\n return this.#queryExecutor.createQueryReader(\n { ecsql: query },\n { restartToken: `${this.#componentName}/${this.#componentId}/is-definition-container-supported` },\n );\n }).pipe(\n toArray(),\n map((rows) => rows.length > 0),\n );\n }\n\n private queryDefinitionContainers(): Observable<{ id: Id64String; modelId: Id64String; hasElements: boolean }> {\n return defer(() => {\n // DefinitionModel ECInstanceId will always be the same as modeled DefinitionContainer ECInstanceId, if this wasn't the case, we would need to do something like:\n // JOIN BisCore.DefinitionModel dm ON dm.ECInstanceId = ${modelIdAccessor}\n // JOIN BisCore.DefinitionModelBreaksDownDefinitionContainer dr ON dr.SourceECInstanceId = dm.ECInstanceId\n // JOIN BisCore.DefinitionContainer dc ON dc.ECInstanceId = dr.TargetECInstanceId\n const DEFINITION_CONTAINERS_CTE = \"DefinitionContainers\";\n const CATEGORIES_MODELS_CTE = \"CategoriesModels\";\n const ctes = [\n `${CATEGORIES_MODELS_CTE}(ModelId, HasElements) AS (\n SELECT\n c.Model.Id,\n IFNULL((\n SELECT 1\n FROM ${this.#categoryElementClass} e\n WHERE e.Category.Id = c.ECInstanceId\n LIMIT 1\n ), 0)\n FROM\n ${this.#categoryClass} c\n WHERE\n NOT c.IsPrivate\n )`,\n `\n ${DEFINITION_CONTAINERS_CTE}(ECInstanceId, ModelId, HasElements) AS (\n SELECT\n dc.ECInstanceId,\n dc.Model.Id,\n c.HasElements\n FROM ${DEFINITION_CONTAINER_CLASS} dc\n JOIN ${CATEGORIES_MODELS_CTE} c ON dc.ECInstanceId = c.ModelId\n WHERE NOT dc.IsPrivate\n\n UNION ALL\n\n SELECT\n pdc.ECInstanceId,\n pdc.Model.Id,\n cdc.HasElements\n FROM\n ${DEFINITION_CONTAINERS_CTE} cdc\n JOIN ${DEFINITION_CONTAINER_CLASS} pdc ON pdc.ECInstanceId = cdc.ModelId\n WHERE NOT pdc.IsPrivate\n )\n `,\n ];\n const definitionsQuery = `\n SELECT dc.ECInstanceId id, dc.ModelId modelId, MAX(dc.HasElements) hasElements FROM ${DEFINITION_CONTAINERS_CTE} dc GROUP BY dc.ECInstanceId\n `;\n return this.#queryExecutor.createQueryReader(\n { ctes, ecsql: definitionsQuery },\n { rowFormat: \"ECSqlPropertyNames\", limit: \"unbounded\", restartToken: `${this.#componentName}/${this.#componentId}/definition-containers` },\n );\n }).pipe(\n map((row) => {\n return { id: row.id, modelId: row.modelId, hasElements: !!row.hasElements };\n }),\n );\n }\n\n private queryVisibleSubCategories(categoriesInfo: Id64Array): Observable<{ id: Id64String; parentId: Id64String }> {\n return defer(() => {\n const definitionsQuery = `\n SELECT\n sc.ECInstanceId id,\n sc.Parent.Id categoryId\n FROM\n ${SUB_CATEGORY_CLASS} sc\n WHERE\n NOT sc.IsPrivate\n AND sc.Parent.Id IN (${categoriesInfo.join(\",\")})\n `;\n return this.#queryExecutor.createQueryReader(\n { ecsql: definitionsQuery },\n { rowFormat: \"ECSqlPropertyNames\", limit: \"unbounded\", restartToken: `${this.#componentName}/${this.#componentId}/visible-sub-categories` },\n );\n }).pipe(\n map((row) => {\n return { id: row.id, parentId: row.categoryId };\n }),\n );\n }\n\n private getModelsCategoriesInfo() {\n this.#modelsCategoriesInfo ??= this.queryCategories()\n .pipe(\n reduce((acc, queriedCategory) => {\n let modelCategories = acc.get(queriedCategory.modelId);\n if (modelCategories === undefined) {\n modelCategories = { parentDefinitionContainerExists: queriedCategory.parentDefinitionContainerExists, childCategories: [] };\n acc.set(queriedCategory.modelId, modelCategories);\n }\n modelCategories.childCategories.push({ id: queriedCategory.id, childCount: queriedCategory.childCount, hasElements: queriedCategory.hasElements });\n return acc;\n }, new Map<Id64String, CategoriesInfo>()),\n )\n .pipe(shareReplay());\n return this.#modelsCategoriesInfo;\n }\n\n private getElementModelsCategories() {\n this.#elementModelsCategories ??= this.queryElementModelCategories()\n .pipe(\n reduce((acc, queriedCategory) => {\n let modelEntry = acc.get(queriedCategory.modelId);\n if (modelEntry === undefined) {\n modelEntry = new Set();\n acc.set(queriedCategory.modelId, modelEntry);\n }\n modelEntry.add(queriedCategory.categoryId);\n return acc;\n }, new Map<Id64String, Id64Set>()),\n )\n .pipe(shareReplay());\n return this.#elementModelsCategories;\n }\n\n private getSubCategoriesInfo() {\n this.#subCategoriesInfo ??= this.getModelsCategoriesInfo()\n .pipe(\n mergeMap((modelsCategoriesInfo) => from(modelsCategoriesInfo.values())),\n reduce((acc, modelCategoriesInfo) => {\n acc.push(...modelCategoriesInfo.childCategories.filter((categoryInfo) => categoryInfo.childCount > 1).map((categoryInfo) => categoryInfo.id));\n return acc;\n }, new Array<Id64String>()),\n mergeMap((categoriesWithMoreThanOneSubCategory) => {\n const allSubCategories = new Map<Id64String, Id64Set>();\n if (categoriesWithMoreThanOneSubCategory.length === 0) {\n return of(allSubCategories);\n }\n return this.queryVisibleSubCategories(categoriesWithMoreThanOneSubCategory).pipe(\n reduce((acc, queriedSubCategory) => {\n const entry = acc.get(queriedSubCategory.parentId);\n if (!entry) {\n acc.set(queriedSubCategory.parentId, new Set([queriedSubCategory.id]));\n return acc;\n }\n entry.add(queriedSubCategory.id);\n return acc;\n }, allSubCategories),\n );\n }),\n )\n .pipe(shareReplay());\n return this.#subCategoriesInfo;\n }\n\n private getDefinitionContainersInfo() {\n this.#definitionContainersInfo ??= forkJoin({\n isDefinitionContainerSupported: this.getIsDefinitionContainerSupported(),\n modelsCategoriesInfo: this.getModelsCategoriesInfo(),\n })\n .pipe(\n mergeMap(({ isDefinitionContainerSupported, modelsCategoriesInfo }) => {\n const definitionContainersInfo = new Map<Id64String, DefinitionContainerInfo>();\n if (!isDefinitionContainerSupported || modelsCategoriesInfo.size === 0) {\n return of(definitionContainersInfo);\n }\n return this.queryDefinitionContainers().pipe(\n reduce((acc, queriedDefinitionContainer) => {\n const modelCategoriesInfo = modelsCategoriesInfo.get(queriedDefinitionContainer.id);\n acc.set(queriedDefinitionContainer.id, {\n childCategories: modelCategoriesInfo?.childCategories ?? [],\n modelId: queriedDefinitionContainer.modelId,\n childDefinitionContainers: [],\n parentDefinitionContainerExists: false,\n hasElements: queriedDefinitionContainer.hasElements,\n });\n return acc;\n }, definitionContainersInfo),\n map((result) => {\n for (const [definitionContainerId, definitionContainerInfo] of result) {\n const parentDefinitionContainer = result.get(definitionContainerInfo.modelId);\n if (parentDefinitionContainer !== undefined) {\n parentDefinitionContainer.childDefinitionContainers.push({ id: definitionContainerId, hasElements: definitionContainerInfo.hasElements });\n definitionContainerInfo.parentDefinitionContainerExists = true;\n parentDefinitionContainer.hasElements = parentDefinitionContainer.hasElements || definitionContainerInfo.hasElements;\n }\n }\n\n return result;\n }),\n );\n }),\n )\n .pipe(shareReplay());\n return this.#definitionContainersInfo;\n }\n\n public getDirectChildDefinitionContainersAndCategories({\n parentDefinitionContainerIds,\n includeEmpty,\n }: {\n parentDefinitionContainerIds: Id64Array;\n includeEmpty?: boolean;\n }): Observable<{ categories: CategoryInfo[]; definitionContainers: Id64Array }> {\n return this.getDefinitionContainersInfo().pipe(\n mergeMap((definitionContainersInfo) =>\n from(parentDefinitionContainerIds).pipe(\n reduce(\n (acc, parentDefinitionContainerId) => {\n const parentDefinitionContainerInfo = definitionContainersInfo.get(parentDefinitionContainerId);\n if (parentDefinitionContainerInfo !== undefined) {\n acc.definitionContainers.push(...applyElementsFilter(parentDefinitionContainerInfo.childDefinitionContainers, includeEmpty).map((dc) => dc.id));\n acc.categories.push(...applyElementsFilter(parentDefinitionContainerInfo.childCategories, includeEmpty));\n }\n return acc;\n },\n { definitionContainers: new Array<Id64String>(), categories: new Array<CategoryInfo>() },\n ),\n ),\n ),\n );\n }\n\n public getCategoriesElementModels(categoryIds: Id64Arg): Observable<Map<Id64String, Id64Set>> {\n return this.getElementModelsCategories().pipe(\n mergeMap((elementModelsCategories) => elementModelsCategories.entries()),\n reduce((acc, [modelId, modelCategoryIds]) => {\n const sharedCategories = setIntersection(Id64.iterable(categoryIds), modelCategoryIds);\n if (sharedCategories.size > 0) {\n acc.set(modelId, sharedCategories);\n }\n return acc;\n }, new Map<Id64String, Id64Set>()),\n );\n }\n\n public getAllContainedCategories({\n definitionContainerIds,\n includeEmptyCategories,\n }: {\n definitionContainerIds: Id64Array;\n includeEmptyCategories?: boolean;\n }): Observable<Id64Set> {\n return this.getDefinitionContainersInfo().pipe(\n mergeMap((definitionContainersInfo) =>\n from(definitionContainerIds).pipe(\n mergeMap((definitionContainerId) => {\n const definitionContainerInfo = definitionContainersInfo.get(definitionContainerId);\n if (definitionContainerInfo === undefined) {\n return of({ directCategories: undefined, indirectCategories: undefined });\n }\n const childDefinitionContainerIds = definitionContainerInfo.childDefinitionContainers.map(({ id }) => id);\n return (\n childDefinitionContainerIds.length > 0\n ? this.getAllContainedCategories({\n definitionContainerIds: childDefinitionContainerIds,\n includeEmptyCategories,\n })\n : of(new Set<string>())\n ).pipe(\n map((indirectCategories) => {\n return {\n directCategories: applyElementsFilter(definitionContainerInfo.childCategories, includeEmptyCategories).map((category) => category.id),\n indirectCategories,\n };\n }),\n );\n }),\n reduce((acc, { directCategories, indirectCategories }) => {\n directCategories?.forEach((categoryId) => acc.add(categoryId));\n indirectCategories?.forEach((categoryId) => acc.add(categoryId));\n return acc;\n }, new Set<Id64String>()),\n ),\n ),\n );\n }\n\n public getInstanceKeyPaths(\n props: { categoryId: Id64String } | { definitionContainerId: Id64String } | { subCategoryId: Id64String },\n ): Observable<InstanceKey[]> {\n if (\"subCategoryId\" in props) {\n return this.getSubCategoriesInfo().pipe(\n mergeMap((subCategoriesInfo) => {\n let categoryOfSubCategory: Id64String | undefined;\n for (const [categoryId, subCategories] of subCategoriesInfo.entries()) {\n if (subCategories.has(props.subCategoryId)) {\n categoryOfSubCategory = categoryId;\n break;\n }\n }\n if (categoryOfSubCategory === undefined) {\n return of([]);\n }\n return this.getInstanceKeyPaths({ categoryId: categoryOfSubCategory }).pipe(\n map((pathToCategory) => [...pathToCategory, { id: props.subCategoryId, className: SUB_CATEGORY_CLASS }]),\n );\n }),\n );\n }\n\n if (\"categoryId\" in props) {\n return this.getModelsCategoriesInfo().pipe(\n mergeMap((modelsCategoriesInfo) => {\n for (const [modelId, modelCategoriesInfo] of modelsCategoriesInfo) {\n if (modelCategoriesInfo.childCategories.find((childCategory) => childCategory.id === props.categoryId)) {\n const instanceKey = { id: props.categoryId, className: this.#categoryClass };\n if (!modelCategoriesInfo.parentDefinitionContainerExists) {\n return of([instanceKey]);\n }\n\n return this.getInstanceKeyPaths({ definitionContainerId: modelId }).pipe(\n map((pathToDefinitionContainer) => [...pathToDefinitionContainer, instanceKey]),\n );\n }\n }\n return of([]);\n }),\n );\n }\n return this.getDefinitionContainersInfo().pipe(\n mergeMap((definitionContainersInfo) => {\n const definitionContainerInfo = definitionContainersInfo.get(props.definitionContainerId);\n if (definitionContainerInfo === undefined) {\n return of([]);\n }\n const instanceKey = { id: props.definitionContainerId, className: DEFINITION_CONTAINER_CLASS };\n if (!definitionContainerInfo.parentDefinitionContainerExists) {\n return of([instanceKey]);\n }\n return this.getInstanceKeyPaths({ definitionContainerId: definitionContainerInfo.modelId }).pipe(\n map((pathToParentDefinitionContainer) => [...pathToParentDefinitionContainer, instanceKey]),\n );\n }),\n );\n }\n\n public getAllDefinitionContainersAndCategories(props?: { includeEmpty?: boolean }): Observable<{\n categories: Id64Array;\n definitionContainers: Id64Array;\n }> {\n return forkJoin({\n categories: this.getModelsCategoriesInfo().pipe(\n mergeMap((modelsCategoriesInfo) => modelsCategoriesInfo.values()),\n reduce((acc, modelCategoriesInfo) => {\n applyElementsFilter(modelCategoriesInfo.childCategories, props?.includeEmpty).forEach((categoryInfo) => acc.push(categoryInfo.id));\n return acc;\n }, new Array<Id64String>()),\n ),\n definitionContainers: this.getDefinitionContainersInfo().pipe(\n mergeMap((definitionContainersInfo) => definitionContainersInfo.entries()),\n reduce((acc, [definitionContainerId, definitionContainerInfo]) => {\n if (definitionContainerInfo.hasElements || !!props?.includeEmpty) {\n acc.push(definitionContainerId);\n }\n return acc;\n }, new Array<Id64String>()),\n ),\n });\n }\n\n public getRootDefinitionContainersAndCategories(props?: { includeEmpty?: boolean }): Observable<{\n categories: CategoryInfo[];\n definitionContainers: Id64Array;\n }> {\n return forkJoin({\n categories: this.getModelsCategoriesInfo().pipe(\n mergeMap((modelsCategoriesInfo) => modelsCategoriesInfo.values()),\n reduce((acc, modelCategoriesInfo) => {\n if (!modelCategoriesInfo.parentDefinitionContainerExists) {\n applyElementsFilter(modelCategoriesInfo.childCategories, props?.includeEmpty).forEach((categoryInfo) => acc.push(categoryInfo));\n }\n return acc;\n }, new Array<CategoryInfo>()),\n ),\n definitionContainers: this.getDefinitionContainersInfo().pipe(\n mergeMap((definitionContainersInfo) => definitionContainersInfo.entries()),\n reduce((acc, [definitionContainerId, definitionContainerInfo]) => {\n if (!definitionContainerInfo.parentDefinitionContainerExists && (definitionContainerInfo.hasElements || !!props?.includeEmpty)) {\n acc.push(definitionContainerId);\n }\n return acc;\n }, new Array<Id64String>()),\n ),\n });\n }\n\n public getSubCategories(categoryId: Id64String): Observable<Id64Set> {\n return this.getSubCategoriesInfo().pipe(map((subCategoriesInfo) => subCategoriesInfo.get(categoryId) ?? new Set()));\n }\n\n public getIsDefinitionContainerSupported(): Observable<boolean> {\n this.#isDefinitionContainerSupported ??= this.queryIsDefinitionContainersSupported().pipe(shareReplay());\n return this.#isDefinitionContainerSupported;\n }\n}\n\n/** @internal */\nexport function getClassesByView(viewType: \"2d\" | \"3d\") {\n return viewType === \"2d\"\n ? { categoryClass: \"BisCore.DrawingCategory\", categoryElementClass: \"BisCore.GeometricElement2d\", categoryModelClass: \"BisCore.GeometricModel2d\" }\n : { categoryClass: \"BisCore.SpatialCategory\", categoryElementClass: \"BisCore.GeometricElement3d\", categoryModelClass: \"BisCore.GeometricModel3d\" };\n}\n\nfunction applyElementsFilter<T extends { hasElements?: boolean }>(list: T[], includeEmpty: boolean | undefined): T[] {\n return includeEmpty ? list : list.filter(({ hasElements }) => !!hasElements);\n}\n"]}
1
+ {"version":3,"file":"CategoriesTreeIdsCache.js","sourceRoot":"","sources":["../../../../../../../src/tree-widget-react/components/trees/categories-tree/internal/Categ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AA+B,KAAK,IAAI,CAAC,oCAAoC,EAAE,CAAC,IAAI,CAAC,IAAA,kBAAW,GAAE,CAAC,CAAC;QACzG,OAAO,IAAI,CAAC,+BAA+B,CAAC;IAC9C,CAAC;CACF;AA1gBD,wDA0gBC;AAED,gBAAgB;AAChB,SAAgB,gBAAgB,CAAC,QAAqB;IACpD,OAAO,QAAQ,KAAK,IAAI;QACtB,CAAC,CAAC,EAAE,aAAa,EAAE,yBAAyB,EAAE,oBAAoB,EAAE,4BAA4B,EAAE,kBAAkB,EAAE,0BAA0B,EAAE;QAClJ,CAAC,CAAC,EAAE,aAAa,EAAE,yBAAyB,EAAE,oBAAoB,EAAE,4BAA4B,EAAE,kBAAkB,EAAE,0BAA0B,EAAE,CAAC;AACvJ,CAAC;AAED,SAAS,mBAAmB,CAAsC,IAAS,EAAE,YAAiC;IAC5G,OAAO,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC;AAC/E,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 { defer, forkJoin, from, map, mergeMap, of, reduce, shareReplay, toArray } from \"rxjs\";\nimport { Guid, Id64 } from \"@itwin/core-bentley\";\nimport { setIntersection } from \"../../common/internal/Utils.js\";\nimport { DEFINITION_CONTAINER_CLASS, SUB_CATEGORY_CLASS } from \"./ClassNameDefinitions.js\";\n\nimport type { Observable } from \"rxjs\";\nimport type { GuidString, Id64Arg, Id64Array, Id64Set, Id64String } from \"@itwin/core-bentley\";\nimport type { LimitingECSqlQueryExecutor } from \"@itwin/presentation-hierarchies\";\nimport type { InstanceKey } from \"@itwin/presentation-shared\";\n\ninterface DefinitionContainerInfo {\n modelId: Id64String;\n parentDefinitionContainerExists: boolean;\n childCategories: CategoryInfo[];\n childDefinitionContainers: Array<{ id: Id64String; hasElements: boolean }>;\n hasElements: boolean;\n}\n\ninterface CategoriesInfo {\n childCategories: CategoryInfo[];\n parentDefinitionContainerExists: boolean;\n}\n\ninterface CategoryInfo {\n id: Id64String;\n childCount: number;\n hasElements: boolean;\n}\n\n/** @internal */\nexport class CategoriesTreeIdsCache implements Disposable {\n #definitionContainersInfo: Observable<Map<Id64String, DefinitionContainerInfo>> | undefined;\n #modelsCategoriesInfo: Observable<Map<Id64String, CategoriesInfo>> | undefined;\n #subCategoriesInfo: Observable<Map<Id64String, Id64Set>> | undefined;\n #elementModelsCategories: Observable<Map<Id64String, Id64Set>> | undefined;\n #categoryClass: string;\n #categoryElementClass: string;\n #categoryModelClass: string;\n #isDefinitionContainerSupported: Observable<boolean> | undefined;\n #queryExecutor: LimitingECSqlQueryExecutor;\n #componentId: GuidString;\n #componentName: string;\n\n constructor(queryExecutor: LimitingECSqlQueryExecutor, viewType: \"3d\" | \"2d\", componentId?: GuidString) {\n this.#queryExecutor = queryExecutor;\n const { categoryClass, categoryElementClass, categoryModelClass } = getClassesByView(viewType);\n this.#categoryClass = categoryClass;\n this.#categoryElementClass = categoryElementClass;\n this.#categoryModelClass = categoryModelClass;\n this.#componentId = componentId ?? Guid.createValue();\n this.#componentName = \"CategoriesTreeIdsCache\";\n }\n\n public [Symbol.dispose]() {}\n\n private queryElementModelCategories(): Observable<{\n modelId: Id64String;\n categoryId: Id64String;\n }> {\n return defer(() => {\n const query = `\n SELECT this.Model.Id modelId, this.Category.Id categoryId\n FROM ${this.#categoryModelClass} m\n JOIN ${this.#categoryElementClass} this ON m.ECInstanceId = this.Model.Id\n WHERE m.IsPrivate = false\n GROUP BY modelId, categoryId\n `;\n return this.#queryExecutor.createQueryReader(\n { ecsql: query },\n {\n rowFormat: \"ECSqlPropertyNames\",\n limit: \"unbounded\",\n restartToken: `${this.#componentName}/${this.#componentId}/element-models-and-categories`,\n },\n );\n }).pipe(\n map((row) => {\n return { modelId: row.modelId, categoryId: row.categoryId };\n }),\n );\n }\n\n private queryCategories(): Observable<{\n id: Id64String;\n modelId: Id64String;\n parentDefinitionContainerExists: boolean;\n childCount: number;\n hasElements: boolean;\n }> {\n return this.getIsDefinitionContainerSupported().pipe(\n mergeMap((isDefinitionContainerSupported) =>\n defer(() => {\n const categoriesQuery = `\n SELECT\n this.ECInstanceId id,\n COUNT(sc.ECInstanceId) childCount,\n this.Model.Id modelId,\n ${\n isDefinitionContainerSupported\n ? `\n IIF(this.Model.Id IN (SELECT dc.ECInstanceId FROM ${DEFINITION_CONTAINER_CLASS} dc),\n true,\n false\n )`\n : \"false\"\n } parentDefinitionContainerExists,\n IFNULL(\n (SELECT 1 FROM ${this.#categoryElementClass} e WHERE e.Category.Id = this.ECInstanceId LIMIT 1),\n 0\n ) hasElements\n FROM\n ${this.#categoryClass} this\n JOIN ${SUB_CATEGORY_CLASS} sc ON sc.Parent.Id = this.ECInstanceId\n JOIN BisCore.Model m ON m.ECInstanceId = this.Model.Id\n WHERE\n NOT this.IsPrivate\n AND (NOT m.IsPrivate OR m.ECClassId IS (BisCore.DictionaryModel))\n GROUP BY this.ECInstanceId\n `;\n return this.#queryExecutor.createQueryReader(\n { ecsql: categoriesQuery },\n { rowFormat: \"ECSqlPropertyNames\", limit: \"unbounded\", restartToken: `${this.#componentName}/${this.#componentId}/categories` },\n );\n }).pipe(\n map((row) => {\n return {\n id: row.id,\n modelId: row.modelId,\n parentDefinitionContainerExists: row.parentDefinitionContainerExists,\n childCount: row.childCount,\n hasElements: !!row.hasElements,\n };\n }),\n ),\n ),\n );\n }\n\n private queryIsDefinitionContainersSupported(): Observable<boolean> {\n return defer(() => {\n const query = `\n SELECT\n 1\n FROM\n ECDbMeta.ECSchemaDef s\n JOIN ECDbMeta.ECClassDef c ON c.Schema.Id = s.ECInstanceId\n WHERE\n s.Name = 'BisCore'\n AND c.Name = 'DefinitionContainer'\n LIMIT 1\n `;\n return this.#queryExecutor.createQueryReader(\n { ecsql: query },\n { restartToken: `${this.#componentName}/${this.#componentId}/is-definition-container-supported` },\n );\n }).pipe(\n toArray(),\n map((rows) => rows.length > 0),\n );\n }\n\n private queryDefinitionContainers(): Observable<{ id: Id64String; modelId: Id64String; hasElements: boolean }> {\n return defer(() => {\n // DefinitionModel ECInstanceId will always be the same as modeled DefinitionContainer ECInstanceId, if this wasn't the case, we would need to do something like:\n // JOIN BisCore.DefinitionModel dm ON dm.ECInstanceId = ${modelIdAccessor}\n // JOIN BisCore.DefinitionModelBreaksDownDefinitionContainer dr ON dr.SourceECInstanceId = dm.ECInstanceId\n // JOIN BisCore.DefinitionContainer dc ON dc.ECInstanceId = dr.TargetECInstanceId\n const DEFINITION_CONTAINERS_CTE = \"DefinitionContainers\";\n const CATEGORIES_MODELS_CTE = \"CategoriesModels\";\n const ctes = [\n `${CATEGORIES_MODELS_CTE}(ModelId, HasElements) AS (\n SELECT\n c.Model.Id,\n IFNULL((\n SELECT 1\n FROM ${this.#categoryElementClass} e\n WHERE e.Category.Id = c.ECInstanceId\n LIMIT 1\n ), 0)\n FROM\n ${this.#categoryClass} c\n WHERE\n NOT c.IsPrivate\n )`,\n `\n ${DEFINITION_CONTAINERS_CTE}(ECInstanceId, ModelId, HasElements) AS (\n SELECT\n dc.ECInstanceId,\n dc.Model.Id,\n c.HasElements\n FROM ${DEFINITION_CONTAINER_CLASS} dc\n JOIN ${CATEGORIES_MODELS_CTE} c ON dc.ECInstanceId = c.ModelId\n WHERE NOT dc.IsPrivate\n\n UNION ALL\n\n SELECT\n pdc.ECInstanceId,\n pdc.Model.Id,\n cdc.HasElements\n FROM\n ${DEFINITION_CONTAINERS_CTE} cdc\n JOIN ${DEFINITION_CONTAINER_CLASS} pdc ON pdc.ECInstanceId = cdc.ModelId\n WHERE NOT pdc.IsPrivate\n )\n `,\n ];\n const definitionsQuery = `\n SELECT dc.ECInstanceId id, dc.ModelId modelId, MAX(dc.HasElements) hasElements FROM ${DEFINITION_CONTAINERS_CTE} dc GROUP BY dc.ECInstanceId\n `;\n return this.#queryExecutor.createQueryReader(\n { ctes, ecsql: definitionsQuery },\n { rowFormat: \"ECSqlPropertyNames\", limit: \"unbounded\", restartToken: `${this.#componentName}/${this.#componentId}/definition-containers` },\n );\n }).pipe(\n map((row) => {\n return { id: row.id, modelId: row.modelId, hasElements: !!row.hasElements };\n }),\n );\n }\n\n private queryVisibleSubCategories(categoriesInfo: Id64Array): Observable<{ id: Id64String; parentId: Id64String }> {\n return defer(() => {\n const definitionsQuery = `\n SELECT\n sc.ECInstanceId id,\n sc.Parent.Id categoryId\n FROM\n ${SUB_CATEGORY_CLASS} sc\n WHERE\n NOT sc.IsPrivate\n AND sc.Parent.Id IN (${categoriesInfo.join(\",\")})\n `;\n return this.#queryExecutor.createQueryReader(\n { ecsql: definitionsQuery },\n { rowFormat: \"ECSqlPropertyNames\", limit: \"unbounded\", restartToken: `${this.#componentName}/${this.#componentId}/visible-sub-categories` },\n );\n }).pipe(\n map((row) => {\n return { id: row.id, parentId: row.categoryId };\n }),\n );\n }\n\n private getModelsCategoriesInfo() {\n this.#modelsCategoriesInfo ??= this.queryCategories()\n .pipe(\n reduce((acc, queriedCategory) => {\n let modelCategories = acc.get(queriedCategory.modelId);\n if (modelCategories === undefined) {\n modelCategories = { parentDefinitionContainerExists: queriedCategory.parentDefinitionContainerExists, childCategories: [] };\n acc.set(queriedCategory.modelId, modelCategories);\n }\n modelCategories.childCategories.push({ id: queriedCategory.id, childCount: queriedCategory.childCount, hasElements: queriedCategory.hasElements });\n return acc;\n }, new Map<Id64String, CategoriesInfo>()),\n )\n .pipe(shareReplay());\n return this.#modelsCategoriesInfo;\n }\n\n private getElementModelsCategories() {\n this.#elementModelsCategories ??= this.queryElementModelCategories()\n .pipe(\n reduce((acc, queriedCategory) => {\n let modelEntry = acc.get(queriedCategory.modelId);\n if (modelEntry === undefined) {\n modelEntry = new Set();\n acc.set(queriedCategory.modelId, modelEntry);\n }\n modelEntry.add(queriedCategory.categoryId);\n return acc;\n }, new Map<Id64String, Id64Set>()),\n )\n .pipe(shareReplay());\n return this.#elementModelsCategories;\n }\n\n private getSubCategoriesInfo() {\n this.#subCategoriesInfo ??= this.getModelsCategoriesInfo()\n .pipe(\n mergeMap((modelsCategoriesInfo) => from(modelsCategoriesInfo.values())),\n reduce((acc, modelCategoriesInfo) => {\n acc.push(...modelCategoriesInfo.childCategories.filter((categoryInfo) => categoryInfo.childCount > 1).map((categoryInfo) => categoryInfo.id));\n return acc;\n }, new Array<Id64String>()),\n mergeMap((categoriesWithMoreThanOneSubCategory) => {\n const allSubCategories = new Map<Id64String, Id64Set>();\n if (categoriesWithMoreThanOneSubCategory.length === 0) {\n return of(allSubCategories);\n }\n return this.queryVisibleSubCategories(categoriesWithMoreThanOneSubCategory).pipe(\n reduce((acc, queriedSubCategory) => {\n const entry = acc.get(queriedSubCategory.parentId);\n if (!entry) {\n acc.set(queriedSubCategory.parentId, new Set([queriedSubCategory.id]));\n return acc;\n }\n entry.add(queriedSubCategory.id);\n return acc;\n }, allSubCategories),\n );\n }),\n )\n .pipe(shareReplay());\n return this.#subCategoriesInfo;\n }\n\n private getDefinitionContainersInfo() {\n this.#definitionContainersInfo ??= forkJoin({\n isDefinitionContainerSupported: this.getIsDefinitionContainerSupported(),\n modelsCategoriesInfo: this.getModelsCategoriesInfo(),\n })\n .pipe(\n mergeMap(({ isDefinitionContainerSupported, modelsCategoriesInfo }) => {\n const definitionContainersInfo = new Map<Id64String, DefinitionContainerInfo>();\n if (!isDefinitionContainerSupported || modelsCategoriesInfo.size === 0) {\n return of(definitionContainersInfo);\n }\n return this.queryDefinitionContainers().pipe(\n reduce((acc, queriedDefinitionContainer) => {\n const modelCategoriesInfo = modelsCategoriesInfo.get(queriedDefinitionContainer.id);\n acc.set(queriedDefinitionContainer.id, {\n childCategories: modelCategoriesInfo?.childCategories ?? [],\n modelId: queriedDefinitionContainer.modelId,\n childDefinitionContainers: [],\n parentDefinitionContainerExists: false,\n hasElements: queriedDefinitionContainer.hasElements,\n });\n return acc;\n }, definitionContainersInfo),\n map((result) => {\n for (const [definitionContainerId, definitionContainerInfo] of result) {\n const parentDefinitionContainer = result.get(definitionContainerInfo.modelId);\n if (parentDefinitionContainer !== undefined) {\n parentDefinitionContainer.childDefinitionContainers.push({ id: definitionContainerId, hasElements: definitionContainerInfo.hasElements });\n definitionContainerInfo.parentDefinitionContainerExists = true;\n parentDefinitionContainer.hasElements = parentDefinitionContainer.hasElements || definitionContainerInfo.hasElements;\n }\n }\n\n return result;\n }),\n );\n }),\n )\n .pipe(shareReplay());\n return this.#definitionContainersInfo;\n }\n\n public getDirectChildDefinitionContainersAndCategories({\n parentDefinitionContainerIds,\n includeEmpty,\n }: {\n parentDefinitionContainerIds: Id64Array;\n includeEmpty?: boolean;\n }): Observable<{ categories: CategoryInfo[]; definitionContainers: Id64Array }> {\n return this.getDefinitionContainersInfo().pipe(\n mergeMap((definitionContainersInfo) =>\n from(parentDefinitionContainerIds).pipe(\n reduce(\n (acc, parentDefinitionContainerId) => {\n const parentDefinitionContainerInfo = definitionContainersInfo.get(parentDefinitionContainerId);\n if (parentDefinitionContainerInfo !== undefined) {\n acc.definitionContainers.push(...applyElementsFilter(parentDefinitionContainerInfo.childDefinitionContainers, includeEmpty).map((dc) => dc.id));\n acc.categories.push(...applyElementsFilter(parentDefinitionContainerInfo.childCategories, includeEmpty));\n }\n return acc;\n },\n { definitionContainers: new Array<Id64String>(), categories: new Array<CategoryInfo>() },\n ),\n ),\n ),\n );\n }\n\n public getCategoriesElementModels(categoryIds: Id64Arg): Observable<Map<Id64String, Id64Set>> {\n return this.getElementModelsCategories().pipe(\n mergeMap((elementModelsCategories) => elementModelsCategories.entries()),\n reduce((acc, [modelId, modelCategoryIds]) => {\n const sharedCategories = setIntersection(Id64.iterable(categoryIds), modelCategoryIds);\n if (sharedCategories.size > 0) {\n acc.set(modelId, sharedCategories);\n }\n return acc;\n }, new Map<Id64String, Id64Set>()),\n );\n }\n\n public getCategoriesOfElementModel(modelId: Id64String): Observable<Id64Set | undefined> {\n return this.getElementModelsCategories().pipe(map((elementModelsCategories) => elementModelsCategories.get(modelId)));\n }\n\n public getAllContainedCategories({\n definitionContainerIds,\n includeEmptyCategories,\n }: {\n definitionContainerIds: Id64Array;\n includeEmptyCategories?: boolean;\n }): Observable<Id64Set> {\n return this.getDefinitionContainersInfo().pipe(\n mergeMap((definitionContainersInfo) =>\n from(definitionContainerIds).pipe(\n mergeMap((definitionContainerId) => {\n const definitionContainerInfo = definitionContainersInfo.get(definitionContainerId);\n if (definitionContainerInfo === undefined) {\n return of({ directCategories: undefined, indirectCategories: undefined });\n }\n const childDefinitionContainerIds = definitionContainerInfo.childDefinitionContainers.map(({ id }) => id);\n return (\n childDefinitionContainerIds.length > 0\n ? this.getAllContainedCategories({\n definitionContainerIds: childDefinitionContainerIds,\n includeEmptyCategories,\n })\n : of(new Set<string>())\n ).pipe(\n map((indirectCategories) => {\n return {\n directCategories: applyElementsFilter(definitionContainerInfo.childCategories, includeEmptyCategories).map((category) => category.id),\n indirectCategories,\n };\n }),\n );\n }),\n reduce((acc, { directCategories, indirectCategories }) => {\n directCategories?.forEach((categoryId) => acc.add(categoryId));\n indirectCategories?.forEach((categoryId) => acc.add(categoryId));\n return acc;\n }, new Set<Id64String>()),\n ),\n ),\n );\n }\n\n public getInstanceKeyPaths(\n props: { categoryId: Id64String } | { definitionContainerId: Id64String } | { subCategoryId: Id64String },\n ): Observable<InstanceKey[]> {\n if (\"subCategoryId\" in props) {\n return this.getSubCategoriesInfo().pipe(\n mergeMap((subCategoriesInfo) => {\n let categoryOfSubCategory: Id64String | undefined;\n for (const [categoryId, subCategories] of subCategoriesInfo.entries()) {\n if (subCategories.has(props.subCategoryId)) {\n categoryOfSubCategory = categoryId;\n break;\n }\n }\n if (categoryOfSubCategory === undefined) {\n return of([]);\n }\n return this.getInstanceKeyPaths({ categoryId: categoryOfSubCategory }).pipe(\n map((pathToCategory) => [...pathToCategory, { id: props.subCategoryId, className: SUB_CATEGORY_CLASS }]),\n );\n }),\n );\n }\n\n if (\"categoryId\" in props) {\n return this.getModelsCategoriesInfo().pipe(\n mergeMap((modelsCategoriesInfo) => {\n for (const [modelId, modelCategoriesInfo] of modelsCategoriesInfo) {\n if (modelCategoriesInfo.childCategories.find((childCategory) => childCategory.id === props.categoryId)) {\n const instanceKey = { id: props.categoryId, className: this.#categoryClass };\n if (!modelCategoriesInfo.parentDefinitionContainerExists) {\n return of([instanceKey]);\n }\n\n return this.getInstanceKeyPaths({ definitionContainerId: modelId }).pipe(\n map((pathToDefinitionContainer) => [...pathToDefinitionContainer, instanceKey]),\n );\n }\n }\n return of([]);\n }),\n );\n }\n return this.getDefinitionContainersInfo().pipe(\n mergeMap((definitionContainersInfo) => {\n const definitionContainerInfo = definitionContainersInfo.get(props.definitionContainerId);\n if (definitionContainerInfo === undefined) {\n return of([]);\n }\n const instanceKey = { id: props.definitionContainerId, className: DEFINITION_CONTAINER_CLASS };\n if (!definitionContainerInfo.parentDefinitionContainerExists) {\n return of([instanceKey]);\n }\n return this.getInstanceKeyPaths({ definitionContainerId: definitionContainerInfo.modelId }).pipe(\n map((pathToParentDefinitionContainer) => [...pathToParentDefinitionContainer, instanceKey]),\n );\n }),\n );\n }\n\n public getAllDefinitionContainersAndCategories(props?: { includeEmpty?: boolean }): Observable<{\n categories: Id64Array;\n definitionContainers: Id64Array;\n }> {\n return forkJoin({\n categories: this.getModelsCategoriesInfo().pipe(\n mergeMap((modelsCategoriesInfo) => modelsCategoriesInfo.values()),\n reduce((acc, modelCategoriesInfo) => {\n applyElementsFilter(modelCategoriesInfo.childCategories, props?.includeEmpty).forEach((categoryInfo) => acc.push(categoryInfo.id));\n return acc;\n }, new Array<Id64String>()),\n ),\n definitionContainers: this.getDefinitionContainersInfo().pipe(\n mergeMap((definitionContainersInfo) => definitionContainersInfo.entries()),\n reduce((acc, [definitionContainerId, definitionContainerInfo]) => {\n if (definitionContainerInfo.hasElements || !!props?.includeEmpty) {\n acc.push(definitionContainerId);\n }\n return acc;\n }, new Array<Id64String>()),\n ),\n });\n }\n\n public getRootDefinitionContainersAndCategories(props?: { includeEmpty?: boolean }): Observable<{\n categories: CategoryInfo[];\n definitionContainers: Id64Array;\n }> {\n return forkJoin({\n categories: this.getModelsCategoriesInfo().pipe(\n mergeMap((modelsCategoriesInfo) => modelsCategoriesInfo.values()),\n reduce((acc, modelCategoriesInfo) => {\n if (!modelCategoriesInfo.parentDefinitionContainerExists) {\n applyElementsFilter(modelCategoriesInfo.childCategories, props?.includeEmpty).forEach((categoryInfo) => acc.push(categoryInfo));\n }\n return acc;\n }, new Array<CategoryInfo>()),\n ),\n definitionContainers: this.getDefinitionContainersInfo().pipe(\n mergeMap((definitionContainersInfo) => definitionContainersInfo.entries()),\n reduce((acc, [definitionContainerId, definitionContainerInfo]) => {\n if (!definitionContainerInfo.parentDefinitionContainerExists && (definitionContainerInfo.hasElements || !!props?.includeEmpty)) {\n acc.push(definitionContainerId);\n }\n return acc;\n }, new Array<Id64String>()),\n ),\n });\n }\n\n public getSubCategories(categoryId: Id64String): Observable<Id64Set> {\n return this.getSubCategoriesInfo().pipe(map((subCategoriesInfo) => subCategoriesInfo.get(categoryId) ?? new Set()));\n }\n\n public getIsDefinitionContainerSupported(): Observable<boolean> {\n this.#isDefinitionContainerSupported ??= this.queryIsDefinitionContainersSupported().pipe(shareReplay());\n return this.#isDefinitionContainerSupported;\n }\n}\n\n/** @internal */\nexport function getClassesByView(viewType: \"2d\" | \"3d\") {\n return viewType === \"2d\"\n ? { categoryClass: \"BisCore.DrawingCategory\", categoryElementClass: \"BisCore.GeometricElement2d\", categoryModelClass: \"BisCore.GeometricModel2d\" }\n : { categoryClass: \"BisCore.SpatialCategory\", categoryElementClass: \"BisCore.GeometricElement3d\", categoryModelClass: \"BisCore.GeometricModel3d\" };\n}\n\nfunction applyElementsFilter<T extends { hasElements?: boolean }>(list: T[], includeEmpty: boolean | undefined): T[] {\n return includeEmpty ? list : list.filter(({ hasElements }) => !!hasElements);\n}\n"]}
@@ -110,7 +110,17 @@ class CategoriesVisibilityHandler {
110
110
  }));
111
111
  }
112
112
  enableCategoriesElementModelsVisibility(categoryIds) {
113
- return this.#idsCache.getCategoriesElementModels(categoryIds).pipe((0, rxjs_1.mergeMap)((categoriesModelsMap) => categoriesModelsMap.keys()), (0, rxjs_1.filter)((modelId) => !this.#viewport.view.viewsModel(modelId)), (0, rxjs_1.toArray)(), (0, rxjs_1.mergeMap)(async (hiddenModels) => {
113
+ return this.#idsCache.getCategoriesElementModels(categoryIds).pipe((0, rxjs_1.mergeMap)((categoriesModelsMap) => categoriesModelsMap.entries()), (0, rxjs_1.mergeMap)(([modelId, categoriesFromPropsInModel]) => this.#viewport.view.viewsModel(modelId)
114
+ ? rxjs_1.EMPTY
115
+ : this.#idsCache.getCategoriesOfElementModel(modelId).pipe((0, rxjs_1.map)((allModelCategories) => {
116
+ // Add 'Hide' override to categories that were hidden before model is turned on
117
+ allModelCategories?.forEach((categoryId) => {
118
+ if (!categoriesFromPropsInModel.has(categoryId)) {
119
+ this.#viewport.perModelCategoryVisibility.setOverride(modelId, categoryId, core_frontend_1.PerModelCategoryVisibility.Override.Hide);
120
+ }
121
+ });
122
+ return modelId;
123
+ }))), (0, rxjs_1.toArray)(), (0, rxjs_1.mergeMap)(async (hiddenModels) => {
114
124
  if (hiddenModels.length > 0) {
115
125
  await this.#viewport.addViewedModels(hiddenModels);
116
126
  }