@itwin/tree-widget-react 0.2.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/README.md +30 -1
  2. package/lib/cjs/components/IconButton.scss +2 -2
  3. package/lib/cjs/components/TreeWidgetComponent.d.ts +1 -0
  4. package/lib/cjs/components/TreeWidgetComponent.scss +1 -1
  5. package/lib/cjs/components/TreeWidgetUiItemsProvider.d.ts +7 -16
  6. package/lib/cjs/components/TreeWidgetUiItemsProvider.js +45 -47
  7. package/lib/cjs/components/TreeWidgetUiItemsProvider.js.map +1 -1
  8. package/lib/cjs/components/header/TreeHeader.d.ts +1 -0
  9. package/lib/cjs/components/header/TreeHeader.scss +1 -1
  10. package/lib/cjs/components/rulesets/IModelContent.json +435 -0
  11. package/lib/cjs/components/search-bar/Popup.scss +1 -1
  12. package/lib/cjs/components/search-bar/SearchBar.scss +1 -1
  13. package/lib/cjs/components/search-bar/SearchBox.scss +1 -1
  14. package/lib/cjs/components/trees/CategoriesTree.d.ts +3 -7
  15. package/lib/cjs/components/trees/CategoriesTree.js +21 -23
  16. package/lib/cjs/components/trees/CategoriesTree.js.map +1 -1
  17. package/lib/cjs/components/trees/CategoriesTree.scss +1 -1
  18. package/lib/cjs/components/trees/IModelContentTree.d.ts +4 -0
  19. package/lib/cjs/components/trees/{ClassificationsTree.js → IModelContentTree.js} +19 -12
  20. package/lib/cjs/components/trees/IModelContentTree.js.map +1 -0
  21. package/lib/cjs/components/trees/ModelsTree.d.ts +3 -8
  22. package/lib/cjs/components/trees/ModelsTree.js +8 -16
  23. package/lib/cjs/components/trees/ModelsTree.js.map +1 -1
  24. package/lib/cjs/components/trees/ModelsTree.scss +1 -1
  25. package/lib/cjs/components/trees/SpatialTree.d.ts +3 -2
  26. package/lib/cjs/components/trees/SpatialTree.js +11 -28
  27. package/lib/cjs/components/trees/SpatialTree.js.map +1 -1
  28. package/lib/cjs/components/trees/index.d.ts +1 -2
  29. package/lib/cjs/components/trees/index.js +5 -6
  30. package/lib/cjs/components/trees/index.js.map +1 -1
  31. package/lib/cjs/components/utils/AutoSizer.d.ts +10 -0
  32. package/lib/cjs/components/utils/AutoSizer.js +36 -0
  33. package/lib/cjs/components/utils/AutoSizer.js.map +1 -0
  34. package/lib/cjs/tree-widget-react.d.ts +1 -1
  35. package/lib/cjs/tree-widget-react.js +4 -4
  36. package/lib/cjs/tree-widget-react.js.map +1 -1
  37. package/lib/cjs/types.d.ts +23 -0
  38. package/lib/cjs/types.js +3 -0
  39. package/lib/cjs/types.js.map +1 -0
  40. package/lib/esm/components/IconButton.scss +2 -2
  41. package/lib/esm/components/TreeWidgetComponent.d.ts +1 -0
  42. package/lib/esm/components/TreeWidgetComponent.scss +1 -1
  43. package/lib/esm/components/TreeWidgetUiItemsProvider.d.ts +7 -16
  44. package/lib/esm/components/TreeWidgetUiItemsProvider.js +45 -47
  45. package/lib/esm/components/TreeWidgetUiItemsProvider.js.map +1 -1
  46. package/lib/esm/components/header/TreeHeader.d.ts +1 -0
  47. package/lib/esm/components/header/TreeHeader.scss +1 -1
  48. package/lib/esm/components/rulesets/IModelContent.json +435 -0
  49. package/lib/esm/components/search-bar/Popup.scss +1 -1
  50. package/lib/esm/components/search-bar/SearchBar.scss +1 -1
  51. package/lib/esm/components/search-bar/SearchBox.scss +1 -1
  52. package/lib/esm/components/trees/CategoriesTree.d.ts +3 -7
  53. package/lib/esm/components/trees/CategoriesTree.js +23 -25
  54. package/lib/esm/components/trees/CategoriesTree.js.map +1 -1
  55. package/lib/esm/components/trees/CategoriesTree.scss +1 -1
  56. package/lib/esm/components/trees/IModelContentTree.d.ts +4 -0
  57. package/lib/esm/components/trees/IModelContentTree.js +24 -0
  58. package/lib/esm/components/trees/IModelContentTree.js.map +1 -0
  59. package/lib/esm/components/trees/ModelsTree.d.ts +3 -8
  60. package/lib/esm/components/trees/ModelsTree.js +9 -17
  61. package/lib/esm/components/trees/ModelsTree.js.map +1 -1
  62. package/lib/esm/components/trees/ModelsTree.scss +1 -1
  63. package/lib/esm/components/trees/SpatialTree.d.ts +3 -2
  64. package/lib/esm/components/trees/SpatialTree.js +10 -11
  65. package/lib/esm/components/trees/SpatialTree.js.map +1 -1
  66. package/lib/esm/components/trees/index.d.ts +1 -2
  67. package/lib/esm/components/trees/index.js +4 -5
  68. package/lib/esm/components/trees/index.js.map +1 -1
  69. package/lib/esm/components/utils/AutoSizer.d.ts +10 -0
  70. package/lib/esm/components/utils/AutoSizer.js +13 -0
  71. package/lib/esm/components/utils/AutoSizer.js.map +1 -0
  72. package/lib/esm/tree-widget-react.d.ts +1 -1
  73. package/lib/esm/tree-widget-react.js +4 -4
  74. package/lib/esm/tree-widget-react.js.map +1 -1
  75. package/lib/esm/types.d.ts +23 -0
  76. package/lib/esm/types.js +2 -0
  77. package/lib/esm/types.js.map +1 -0
  78. package/package.json +1 -2
  79. package/lib/cjs/components/TreeWidgetControl.d.ts +0 -26
  80. package/lib/cjs/components/TreeWidgetControl.js +0 -66
  81. package/lib/cjs/components/TreeWidgetControl.js.map +0 -1
  82. package/lib/cjs/components/rulesets/ClassificationSystems.json +0 -122
  83. package/lib/cjs/components/trees/ClassificationsTree.d.ts +0 -6
  84. package/lib/cjs/components/trees/ClassificationsTree.js.map +0 -1
  85. package/lib/cjs/components/trees/TreeWithRuleset.d.ts +0 -35
  86. package/lib/cjs/components/trees/TreeWithRuleset.js +0 -110
  87. package/lib/cjs/components/trees/TreeWithRuleset.js.map +0 -1
  88. package/lib/cjs/components/trees/TreeWithRulesetTree.scss +0 -17
  89. package/lib/esm/components/TreeWidgetControl.d.ts +0 -26
  90. package/lib/esm/components/TreeWidgetControl.js +0 -59
  91. package/lib/esm/components/TreeWidgetControl.js.map +0 -1
  92. package/lib/esm/components/rulesets/ClassificationSystems.json +0 -122
  93. package/lib/esm/components/trees/ClassificationsTree.d.ts +0 -6
  94. package/lib/esm/components/trees/ClassificationsTree.js +0 -17
  95. package/lib/esm/components/trees/ClassificationsTree.js.map +0 -1
  96. package/lib/esm/components/trees/TreeWithRuleset.d.ts +0 -35
  97. package/lib/esm/components/trees/TreeWithRuleset.js +0 -85
  98. package/lib/esm/components/trees/TreeWithRuleset.js.map +0 -1
  99. package/lib/esm/components/trees/TreeWithRulesetTree.scss +0 -17
@@ -1 +1 @@
1
- {"version":3,"file":"TreeWidgetUiItemsProvider.js","sourceRoot":"","sources":["../../../src/components/TreeWidgetUiItemsProvider.tsx"],"names":[],"mappings":"AASA,OAAO,EACL,kBAAkB,EAClB,UAAU,GACX,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtE,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAG3D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,MAAM,OAAO,yBAAyB;IAepC,YAAY,KAAyC;;QAdrC,OAAE,GAAG,2BAA2B,CAAC;QAe/C,IAAI,CAAC,OAAO,GAAG,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,gBAAgB,CAAC;QACvC,IAAI,CAAC,WAAW,GAAG,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,UAAU,CAAC;QACrC,IAAI,CAAC,4BAA4B,GAAG,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,2BAA2B,CAAC;QACvE,IAAI,CAAC,aAAa,GAAG,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,YAAY,CAAC;QACzC,IAAI,CAAC,gBAAgB,GAAG,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,eAAe,CAAC;QAC/C,I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aACtC;YAED,OAAO,CAAC,IAAI,CAAC;gBACX,EAAE,EAAE,MAAM;gBACV,KAAK,EAAE,UAAU,CAAC,SAAS,CAAC,UAAU,CAAC;gBACvC,8CAA8C;gBAC9C,gBAAgB,EAAE,GAAG,EAAE,CAAC,oBAAC,mBAAmB,IAAC,KAAK,EAAE,KAAK,GAAI;aAC9D,CAAC,CAAC;SACJ;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport type {\n AbstractWidgetProps,\n StagePanelSection,\n UiItemsProvider,\n} from \"@itwin/appui-abstract\";\nimport {\n StagePanelLocation,\n StageUsage,\n} from \"@itwin/appui-abstract\";\nimport { ClassGroupingOption, UiFramework } from \"@itwin/appui-react\";\nimport React from \"react\";\nimport { TreeWidgetComponent } from \"./TreeWidgetComponent\";\nimport { CategoriesTreeComponent } from \"./trees/CategoriesTree\";\nimport { ModelsTreeComponent } from \"./trees/ModelsTree\";\nimport { SpatialTreeComponent } from \"./trees/SpatialTree\";\nimport type { IModelConnection, Viewport } from \"@itwin/core-frontend\";\nimport type { SelectableContentDefinition } from \"@itwin/components-react\";\nimport { TreeWidget } from \"../TreeWidget\";\nimport type { TreeWidgetControlOptions } from \"./TreeWidgetControl\";\n\nexport class TreeWidgetUiItemsProvider implements UiItemsProvider {\n public readonly id = \"TreeWidgetUiitemsProvider\";\n\n private _imodel?: IModelConnection;\n private _activeView?: Viewport;\n private _enableElementsClassGrouping?: boolean;\n private _allViewports?: boolean;\n private _additionalTrees?: SelectableContentDefinition[];\n private _modelsTreeProps?: {};\n private _categoriesTreeProps?: {};\n private _spatialTreeProps?: {};\n private _modelsTreeReplacement?: () => React.ReactNode;\n private _categoriesTreeReplacement?: () => React.ReactNode;\n private _spatialTreeReplacement?: () => React.ReactNode;\n\n constructor(props?: Partial<TreeWidgetControlOptions>) {\n this._imodel = props?.iModelConnection;\n this._activeView = props?.activeView;\n this._enableElementsClassGrouping = props?.enableElementsClassGrouping;\n this._allViewports = props?.allViewports;\n this._additionalTrees = props?.additionalTrees;\n this._modelsTreeProps = props?.additionalProps?.modelsTree;\n this._categoriesTreeProps = props?.additionalProps?.categoriesTree;\n this._spatialTreeProps = props?.additionalProps?.spatialTree;\n this._modelsTreeReplacement = props?.treeReplacements?.modelsTree;\n this._categoriesTreeReplacement = props?.treeReplacements?.categoriesTree;\n this._spatialTreeReplacement = props?.treeReplacements?.spatialTree;\n }\n\n public provideWidgets(\n _stageId: string,\n stageUsage: string,\n location: StagePanelLocation,\n _section: StagePanelSection | undefined\n ): ReadonlyArray<AbstractWidgetProps> {\n const widgets: AbstractWidgetProps[] = [];\n const imodel = UiFramework.getIModelConnection();\n if (\n stageUsage === StageUsage.General &&\n location === StagePanelLocation.Right &&\n imodel !== undefined\n ) {\n const modelsTreeComponent = (\n <ModelsTreeComponent\n iModel={this._imodel ?? imodel}\n allViewports={this._allViewports}\n activeView={this._activeView}\n enableElementsClassGrouping={this._enableElementsClassGrouping}\n {...this._modelsTreeProps}\n />\n );\n\n const categoriesTreeComponent = (\n <CategoriesTreeComponent\n iModel={this._imodel ?? imodel}\n allViewports={this._allViewports}\n activeView={this._activeView}\n {...this._categoriesTreeProps}\n />\n );\n\n const spatialContainmentComponent = (\n <SpatialTreeComponent\n iModel={this._imodel ?? imodel}\n enableElementsClassGrouping={\n this._enableElementsClassGrouping\n ? ClassGroupingOption.Yes\n : ClassGroupingOption.No\n }\n {...this._spatialTreeProps}\n />\n );\n\n const trees: SelectableContentDefinition[] = [\n {\n label: TreeWidget.translate(\"modeltree\"),\n id: \"model-tree\",\n render: this._modelsTreeReplacement\n ? this._modelsTreeReplacement\n : () => modelsTreeComponent,\n },\n {\n label: TreeWidget.translate(\"categories\"),\n id: \"categories-tree\",\n render: this._categoriesTreeReplacement\n ? this._categoriesTreeReplacement\n : () => categoriesTreeComponent,\n },\n {\n label: TreeWidget.translate(\"containment\"),\n id: \"spatial-containment-tree\",\n render: this._spatialTreeReplacement\n ? this._spatialTreeReplacement\n : () => spatialContainmentComponent,\n },\n ];\n\n if (this._additionalTrees) {\n trees.push(...this._additionalTrees);\n }\n\n widgets.push({\n id: \"tree\",\n label: TreeWidget.translate(\"treeview\"),\n // eslint-disable-next-line react/display-name\n getWidgetContent: () => <TreeWidgetComponent trees={trees} />,\n });\n }\n\n return widgets;\n }\n}\n"]}
1
+ {"version":3,"file":"TreeWidgetUiItemsProvider.js","sourceRoot":"","sources":["../../../src/components/TreeWidgetUiItemsProvider.tsx"],"names":[],"mappings":"AAUA,OAAO,EACL,oBAAoB,EACpB,kBAAkB,EAClB,UAAU,GACX,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtE,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAE3D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,MAAM,CAAC,MAAM,YAAY,GAAG,yBAAyB,CAAC;AACtD,MAAM,OAAO,yBAAyB;IAGpC,YAAoB,kBAAsC;QAAtC,uBAAkB,GAAlB,kBAAkB,CAAoB;QAF1C,OAAE,GAAG,2BAA2B,CAAC;IAEa,CAAC;IAExD,cAAc,CACnB,QAAgB,EAChB,UAAkB,EAClB,QAA4B,EAC5B,OAA2B;IAC3B,mDAAmD;IACnD,YAAmC;;QAEnC,MAAM,OAAO,GAA0B,EAAE,CAAC;QAC1C;QACE,mDAAmD;QACnD,CAAC,CAAC,OAAO,IA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ACpD,KAAK,CAAC,IAAI,CAAC;oBACT,KAAK,EAAE,UAAU,CAAC,SAAS,CAAC,aAAa,CAAC;oBAC1C,EAAE,EAAE,0BAA0B;oBAC9B,MAAM,EAAE,GAAG,EAAE;;wBAAC,OAAA,CACZ,oBAAC,oBAAoB,IACnB,2BAA2B,EACzB,CAAA,MAAA,IAAI,CAAC,kBAAkB,0CAAE,2BAA2B;gCAClD,CAAC,CAAC,mBAAmB,CAAC,aAAa;gCACnC,CAAC,CAAC,mBAAmB,CAAC,EAAE,KAExB,MAAA,IAAI,CAAC,kBAAkB,0CAAE,gBAAgB,GAC7C,CACH,CAAA;qBAAA;iBACF,CAAC,CAAC;aACJ;YAED,IAAI,MAAA,IAAI,CAAC,kBAAkB,0CAAE,eAAe,EAAE;gBAC5C,KAAK,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,kBAAkB,CAAC,eAAe,CAAC,CAAC;aACxD;YAED,OAAO,CAAC,IAAI,CAAC;gBACX,EAAE,EAAE,YAAY;gBAChB,KAAK,EAAE,UAAU,CAAC,SAAS,CAAC,UAAU,CAAC;gBACvC,gBAAgB,EAAE,GAAG,EAAE,CAAC,oBAAC,mBAAmB,IAAC,KAAK,EAAE,KAAK,GAAI;aAC9D,CAAC,CAAC;SACJ;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;CACF","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/* eslint-disable react/display-name */\nimport type {\n AbstractWidgetProps,\n StagePanelSection,\n UiItemsProvider,\n} from \"@itwin/appui-abstract\";\nimport {\n AbstractZoneLocation,\n StagePanelLocation,\n StageUsage,\n} from \"@itwin/appui-abstract\";\nimport { ClassGroupingOption, UiFramework } from \"@itwin/appui-react\";\nimport React from \"react\";\nimport { TreeWidgetComponent } from \"./TreeWidgetComponent\";\nimport { CategoriesTreeComponent } from \"./trees/CategoriesTree\";\nimport { ModelsTreeComponent } from \"./trees/ModelsTree\";\nimport { SpatialTreeComponent } from \"./trees/SpatialTree\";\nimport type { SelectableContentDefinition } from \"@itwin/components-react\";\nimport { TreeWidget } from \"../TreeWidget\";\nimport type { TreeWidgetOptions } from \"../types\";\n\nexport const TreeWidgetId = \"tree-widget-react:trees\";\nexport class TreeWidgetUiItemsProvider implements UiItemsProvider {\n public readonly id = \"TreeWidgetUiItemsProvider\";\n\n constructor(private _treeWidgetOptions?: TreeWidgetOptions) { }\n\n public provideWidgets(\n _stageId: string,\n stageUsage: string,\n location: StagePanelLocation,\n section?: StagePanelSection,\n // eslint-disable-next-line deprecation/deprecation\n zoneLocation?: AbstractZoneLocation,\n ): ReadonlyArray<AbstractWidgetProps> {\n const widgets: AbstractWidgetProps[] = [];\n if (\n // eslint-disable-next-line deprecation/deprecation\n (!section && stageUsage === StageUsage.General && zoneLocation === AbstractZoneLocation.CenterRight) ||\n (stageUsage === StageUsage.General && location === StagePanelLocation.Right && UiFramework.uiVersion !== \"1\")\n ) {\n const trees: SelectableContentDefinition[] = [];\n\n if (!this._treeWidgetOptions?.hideTrees?.modelsTree) {\n trees.push({\n label: TreeWidget.translate(\"modeltree\"),\n id: \"model-tree\",\n render: () => (\n <ModelsTreeComponent\n enableElementsClassGrouping={\n this._treeWidgetOptions?.enableElementsClassGrouping\n ? ClassGroupingOption.YesWithCounts\n : ClassGroupingOption.No\n }\n {...this._treeWidgetOptions?.modelsTreeProps}\n />\n ),\n });\n }\n\n if (!this._treeWidgetOptions?.hideTrees?.categoriesTree) {\n trees.push({\n label: TreeWidget.translate(\"categories\"),\n id: \"categories-tree\",\n render: () => (\n <CategoriesTreeComponent {...this._treeWidgetOptions?.categoriesTreeProps} />\n ),\n });\n }\n\n if (!this._treeWidgetOptions?.hideTrees?.spatialTree) {\n trees.push({\n label: TreeWidget.translate(\"containment\"),\n id: \"spatial-containment-tree\",\n render: () => (\n <SpatialTreeComponent\n enableElementsClassGrouping={\n this._treeWidgetOptions?.enableElementsClassGrouping\n ? ClassGroupingOption.YesWithCounts\n : ClassGroupingOption.No\n }\n {...this._treeWidgetOptions?.spatialTreeProps}\n />\n ),\n });\n }\n\n if (this._treeWidgetOptions?.additionalTrees) {\n trees.push(...this._treeWidgetOptions.additionalTrees);\n }\n\n widgets.push({\n id: TreeWidgetId,\n label: TreeWidget.translate(\"treeview\"),\n getWidgetContent: () => <TreeWidgetComponent trees={trees} />,\n });\n }\n\n return widgets;\n }\n}\n"]}
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { SearchOptions } from "../TreeFilteringState";
2
3
  import "./TreeHeader.scss";
3
4
  export interface TreeHeaderComponentProps {
@@ -2,7 +2,7 @@
2
2
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
3
  * See LICENSE.md in the project root for license terms and full copyright notice.
4
4
  *--------------------------------------------------------------------------------------------*/
5
- @import "~@itwin/core-react/lib/esm/core-react/index";
5
+ @import "~@itwin/core-react/lib/cjs/core-react/index";
6
6
 
7
7
  .tree-widget-header-tree-search-bar {
8
8
  margin-bottom: $uicore-s;
@@ -0,0 +1,435 @@
1
+ {
2
+ "$schema": "../../node_modules/@itwin/presentation-common/Ruleset.schema.json",
3
+ "id": "tree-widget-react/imodel-content",
4
+ "requiredSchemas": [
5
+ {
6
+ "name": "BisCore"
7
+ }
8
+ ],
9
+ "rules": [
10
+ {
11
+ "ruleType": "RootNodes",
12
+ "autoExpand": true,
13
+ "specifications": [
14
+ {
15
+ "specType": "InstanceNodesOfSpecificClasses",
16
+ "classes": [
17
+ {
18
+ "schemaName": "BisCore",
19
+ "classNames": ["Subject"],
20
+ "arePolymorphic": false
21
+ }
22
+ ],
23
+ "instanceFilter": "this.Parent = NULL",
24
+ "groupByClass": false,
25
+ "groupByLabel": false
26
+ }
27
+ ]
28
+ },
29
+ {
30
+ "ruleType": "ChildNodes",
31
+ "condition": "ParentNode.IsOfClass(\"Subject\", \"BisCore\")",
32
+ "specifications": [
33
+ {
34
+ "specType": "RelatedInstanceNodes",
35
+ "relationshipPaths": [
36
+ {
37
+ "relationship": {
38
+ "schemaName": "BisCore",
39
+ "className": "SubjectOwnsSubjects"
40
+ },
41
+ "direction": "Forward",
42
+ "targetClass": {
43
+ "schemaName": "BisCore",
44
+ "className": "Subject"
45
+ }
46
+ }
47
+ ],
48
+ "instanceFilter": "json_extract(this.JsonProperties, \"$.Subject.Job.Bridge\") <> NULL OR ifnull(json_extract(this.JsonProperties, \"$.Subject.Model.Type\"), \"\") = \"Hierarchy\"",
49
+ "hideNodesInHierarchy": true,
50
+ "groupByClass": false,
51
+ "groupByLabel": false
52
+ },
53
+ {
54
+ "specType": "RelatedInstanceNodes",
55
+ "relationshipPaths": [
56
+ {
57
+ "relationship": {
58
+ "schemaName": "BisCore",
59
+ "className": "SubjectOwnsSubjects"
60
+ },
61
+ "direction": "Forward",
62
+ "targetClass": {
63
+ "schemaName": "BisCore",
64
+ "className": "Subject"
65
+ }
66
+ }
67
+ ],
68
+ "instanceFilter": "json_extract(this.JsonProperties, \"$.Subject.Job.Bridge\") = NULL AND ifnull(json_extract(this.JsonProperties, \"$.Subject.Model.Type\"), \"\") <> \"Hierarchy\"",
69
+ "groupByClass": false,
70
+ "groupByLabel": false
71
+ }
72
+ ]
73
+ },
74
+ {
75
+ "ruleType": "ChildNodes",
76
+ "condition": "ParentNode.IsOfClass(\"Subject\", \"BisCore\")",
77
+ "specifications": [
78
+ {
79
+ "specType": "InstanceNodesOfSpecificClasses",
80
+ "classes": {
81
+ "schemaName": "BisCore",
82
+ "classNames": ["Model"],
83
+ "arePolymorphic": true
84
+ },
85
+ "relatedInstances": [
86
+ {
87
+ "relationshipPath": {
88
+ "relationship": {
89
+ "schemaName": "BisCore",
90
+ "className": "ModelModelsElement"
91
+ },
92
+ "direction": "Forward",
93
+ "targetClass": {
94
+ "schemaName": "BisCore",
95
+ "className": "InformationPartitionElement"
96
+ }
97
+ },
98
+ "alias": "partition",
99
+ "isRequired": true
100
+ }
101
+ ],
102
+ "instanceFilter": "(parent.ECInstanceId = partition.Parent.Id OR json_extract(parent.JsonProperties, \"$.Subject.Model.TargetPartition\") = printf(\"0x%x\", partition.ECInstanceId)) AND NOT this.IsPrivate AND json_extract(partition.JsonProperties, \"$.PhysicalPartition.Model.Content\") = NULL AND json_extract(partition.JsonProperties, \"$.GraphicalPartition3d.Model.Content\") = NULL",
103
+ "groupByClass": false,
104
+ "groupByLabel": false
105
+ },
106
+ {
107
+ "specType": "InstanceNodesOfSpecificClasses",
108
+ "classes": {
109
+ "schemaName": "BisCore",
110
+ "classNames": ["Model"],
111
+ "arePolymorphic": true
112
+ },
113
+ "relatedInstances": [
114
+ {
115
+ "relationshipPath": {
116
+ "relationship": {
117
+ "schemaName": "BisCore",
118
+ "className": "ModelModelsElement"
119
+ },
120
+ "direction": "Forward",
121
+ "targetClass": {
122
+ "schemaName": "BisCore",
123
+ "className": "InformationPartitionElement"
124
+ }
125
+ },
126
+ "alias": "partition",
127
+ "isRequired": true
128
+ }
129
+ ],
130
+ "instanceFilter": "(parent.ECInstanceId = partition.Parent.Id OR json_extract(parent.JsonProperties, \"$.Subject.Model.TargetPartition\") = printf(\"0x%x\", partition.ECInstanceId)) AND NOT this.IsPrivate AND (json_extract(partition.JsonProperties, \"$.PhysicalPartition.Model.Content\") <> NULL OR json_extract(partition.JsonProperties, \"$.GraphicalPartition3d.Model.Content\") <> NULL)",
131
+ "hideNodesInHierarchy": true,
132
+ "groupByClass": false,
133
+ "groupByLabel": false
134
+ }
135
+ ]
136
+ },
137
+ {
138
+ "ruleType": "ChildNodes",
139
+ "condition": "ParentNode.IsOfClass(\"ISubModeledElement\", \"BisCore\")",
140
+ "specifications": [
141
+ {
142
+ "specType": "RelatedInstanceNodes",
143
+ "relationshipPaths": [
144
+ {
145
+ "relationship": {
146
+ "schemaName": "BisCore",
147
+ "className": "ModelModelsElement"
148
+ },
149
+ "direction": "Backward"
150
+ }
151
+ ],
152
+ "instanceFilter": "NOT this.IsPrivate",
153
+ "hideNodesInHierarchy": true,
154
+ "groupByClass": false,
155
+ "groupByLabel": false
156
+ }
157
+ ]
158
+ },
159
+ {
160
+ "ruleType": "ChildNodes",
161
+ "condition": "ParentNode.IsOfClass(\"GeometricModel3d\", \"BisCore\")",
162
+ "specifications": [
163
+ {
164
+ "specType": "RelatedInstanceNodes",
165
+ "relationshipPaths": [
166
+ [
167
+ {
168
+ "relationship": {
169
+ "schemaName": "BisCore",
170
+ "className": "ModelContainsElements"
171
+ },
172
+ "direction": "Forward"
173
+ },
174
+ {
175
+ "relationship": {
176
+ "schemaName": "BisCore",
177
+ "className": "GeometricElement3dIsInCategory"
178
+ },
179
+ "direction": "Forward"
180
+ }
181
+ ]
182
+ ],
183
+ "suppressSimilarAncestorsCheck": true,
184
+ "groupByClass": false,
185
+ "groupByLabel": false,
186
+ "nestedRules": [
187
+ {
188
+ "ruleType": "ChildNodes",
189
+ "condition": "ParentNode.IsOfClass(\"SpatialCategory\", \"BisCore\")",
190
+ "specifications": [
191
+ {
192
+ "specType": "RelatedInstanceNodes",
193
+ "relationshipPaths": [
194
+ {
195
+ "relationship": {
196
+ "schemaName": "BisCore",
197
+ "className": "GeometricElement3dIsInCategory"
198
+ },
199
+ "direction": "Backward"
200
+ }
201
+ ],
202
+ "instanceFilter": "this.Model.Id = parent.parent.ECInstanceId ANDALSO this.Parent = NULL",
203
+ "groupByClass": true,
204
+ "groupByLabel": false
205
+ }
206
+ ]
207
+ }
208
+ ]
209
+ },
210
+ {
211
+ "specType": "RelatedInstanceNodes",
212
+ "relationshipPaths": [
213
+ {
214
+ "relationship": {
215
+ "schemaName": "BisCore",
216
+ "className": "ModelContainsElements"
217
+ },
218
+ "direction": "Forward",
219
+ "targetClass": {
220
+ "schemaName": "BisCore",
221
+ "className": "InformationContentElement"
222
+ }
223
+ }
224
+ ],
225
+ "groupByClass": true,
226
+ "groupByLabel": false
227
+ }
228
+ ]
229
+ },
230
+ {
231
+ "ruleType": "ChildNodes",
232
+ "condition": "ParentNode.IsOfClass(\"GeometricModel2d\", \"BisCore\")",
233
+ "specifications": [
234
+ {
235
+ "specType": "RelatedInstanceNodes",
236
+ "relationshipPaths": [
237
+ [
238
+ {
239
+ "relationship": {
240
+ "schemaName": "BisCore",
241
+ "className": "ModelContainsElements"
242
+ },
243
+ "direction": "Forward"
244
+ },
245
+ {
246
+ "relationship": {
247
+ "schemaName": "BisCore",
248
+ "className": "GeometricElement2dIsInCategory"
249
+ },
250
+ "direction": "Forward"
251
+ }
252
+ ]
253
+ ],
254
+ "suppressSimilarAncestorsCheck": true,
255
+ "groupByClass": false,
256
+ "groupByLabel": false,
257
+ "nestedRules": [
258
+ {
259
+ "ruleType": "ChildNodes",
260
+ "condition": "ParentNode.IsOfClass(\"DrawingCategory\", \"BisCore\")",
261
+ "specifications": [
262
+ {
263
+ "specType": "RelatedInstanceNodes",
264
+ "relationshipPaths": [
265
+ {
266
+ "relationship": {
267
+ "schemaName": "BisCore",
268
+ "className": "GeometricElement2dIsInCategory"
269
+ },
270
+ "direction": "Backward"
271
+ }
272
+ ],
273
+ "instanceFilter": "this.Model.Id = parent.parent.ECInstanceId ANDALSO this.Parent = NULL",
274
+ "groupByClass": true,
275
+ "groupByLabel": false
276
+ }
277
+ ]
278
+ }
279
+ ]
280
+ },
281
+ {
282
+ "specType": "RelatedInstanceNodes",
283
+ "relationshipPaths": [
284
+ {
285
+ "relationship": {
286
+ "schemaName": "BisCore",
287
+ "className": "ModelContainsElements"
288
+ },
289
+ "direction": "Forward",
290
+ "targetClass": {
291
+ "schemaName": "BisCore",
292
+ "className": "InformationContentElement"
293
+ }
294
+ }
295
+ ],
296
+ "groupByClass": true,
297
+ "groupByLabel": false
298
+ }
299
+ ]
300
+ },
301
+ {
302
+ "ruleType": "ChildNodes",
303
+ "condition": "ParentNode.IsOfClass(\"Model\", \"BisCore\")",
304
+ "onlyIfNotHandled": true,
305
+ "specifications": [
306
+ {
307
+ "specType": "RelatedInstanceNodes",
308
+ "relationshipPaths": [
309
+ [
310
+ {
311
+ "relationship": {
312
+ "schemaName": "BisCore",
313
+ "className": "ModelContainsElements"
314
+ },
315
+ "direction": "Forward"
316
+ }
317
+ ]
318
+ ],
319
+ "instanceFilter": "this.Parent = NULL",
320
+ "groupByClass": true,
321
+ "groupByLabel": false
322
+ }
323
+ ]
324
+ },
325
+ {
326
+ "ruleType": "ChildNodes",
327
+ "condition": "ParentNode.IsOfClass(\"GroupInformationElement\", \"BisCore\")",
328
+ "onlyIfNotHandled": true,
329
+ "specifications": [
330
+ {
331
+ "specType": "CustomNode",
332
+ "type": "T_CHILDREN",
333
+ "label": "Children",
334
+ "imageId": "icon-hierarchy-tree",
335
+ "hideIfNoChildren": true,
336
+ "nestedRules": [
337
+ {
338
+ "ruleType": "ChildNodes",
339
+ "specifications": [
340
+ {
341
+ "specType": "RelatedInstanceNodes",
342
+ "relationshipPaths": [
343
+ {
344
+ "relationship": {
345
+ "schemaName": "BisCore",
346
+ "className": "ElementOwnsChildElements"
347
+ },
348
+ "direction": "Forward"
349
+ }
350
+ ],
351
+ "groupByClass": true,
352
+ "groupByLabel": false
353
+ }
354
+ ]
355
+ }
356
+ ]
357
+ },
358
+ {
359
+ "specType": "CustomNode",
360
+ "type": "T_GROUPED_MEMBERS",
361
+ "label": "Members",
362
+ "imageId": "icon-group",
363
+ "hideIfNoChildren": true,
364
+ "nestedRules": [
365
+ {
366
+ "ruleType": "ChildNodes",
367
+ "specifications": [
368
+ {
369
+ "specType": "RelatedInstanceNodes",
370
+ "relationshipPaths": [
371
+ {
372
+ "relationship": {
373
+ "schemaName": "BisCore",
374
+ "className": "ElementGroupsMembers"
375
+ },
376
+ "direction": "Forward"
377
+ }
378
+ ],
379
+ "groupByClass": true,
380
+ "groupByLabel": false
381
+ }
382
+ ]
383
+ }
384
+ ]
385
+ }
386
+ ]
387
+ },
388
+ {
389
+ "ruleType": "ChildNodes",
390
+ "condition": "ParentNode.IsOfClass(\"Element\", \"BisCore\")",
391
+ "onlyIfNotHandled": true,
392
+ "specifications": [
393
+ {
394
+ "specType": "RelatedInstanceNodes",
395
+ "relationshipPaths": [
396
+ {
397
+ "relationship": {
398
+ "schemaName": "BisCore",
399
+ "className": "ElementOwnsChildElements"
400
+ },
401
+ "direction": "Forward"
402
+ }
403
+ ],
404
+ "groupByClass": true,
405
+ "groupByLabel": false
406
+ }
407
+ ]
408
+ },
409
+ {
410
+ "ruleType": "ImageIdOverride",
411
+ "condition": "ThisNode.IsInstanceNode ANDALSO ThisNode.IsOfClass(\"Subject\", \"BisCore\")",
412
+ "imageIdExpression": "IIF(this.Parent.Id = NULL, \"icon-imodel-hollow-2\", \"icon-folder\")"
413
+ },
414
+ {
415
+ "ruleType": "ImageIdOverride",
416
+ "condition": "ThisNode.IsInstanceNode ANDALSO ThisNode.IsOfClass(\"Model\", \"BisCore\")",
417
+ "imageIdExpression": "\"icon-model\""
418
+ },
419
+ {
420
+ "ruleType": "ImageIdOverride",
421
+ "condition": "ThisNode.IsInstanceNode ANDALSO ThisNode.IsOfClass(\"Category\", \"BisCore\")",
422
+ "imageIdExpression": "\"icon-layers\""
423
+ },
424
+ {
425
+ "ruleType": "ImageIdOverride",
426
+ "condition": "ThisNode.IsInstanceNode ANDALSO ThisNode.IsOfClass(\"Element\", \"BisCore\")",
427
+ "imageIdExpression": "\"icon-item\""
428
+ },
429
+ {
430
+ "ruleType": "ImageIdOverride",
431
+ "condition": "ThisNode.IsClassGroupingNode",
432
+ "imageIdExpression": "\"icon-ec-class\""
433
+ }
434
+ ]
435
+ }
@@ -2,7 +2,7 @@
2
2
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
3
  * See LICENSE.md in the project root for license terms and full copyright notice.
4
4
  *--------------------------------------------------------------------------------------------*/
5
- @import "~@itwin/core-react/lib/esm/core-react/index";
5
+ @import "~@itwin/core-react/lib/cjs/core-react/index";
6
6
 
7
7
  .tree-widget-search-popup {
8
8
  display: block;
@@ -2,7 +2,7 @@
2
2
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
3
  * See LICENSE.md in the project root for license terms and full copyright notice.
4
4
  *--------------------------------------------------------------------------------------------*/
5
- @import "~@itwin/core-react/lib/esm/core-react/index";
5
+ @import "~@itwin/core-react/lib/cjs/core-react/index";
6
6
 
7
7
  .tree-widget-search-bar {
8
8
  display: flex;
@@ -2,7 +2,7 @@
2
2
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
3
  * See LICENSE.md in the project root for license terms and full copyright notice.
4
4
  *--------------------------------------------------------------------------------------------*/
5
- @import "~@itwin/core-react/lib/esm/core-react/index";
5
+ @import "~@itwin/core-react/lib/cjs/core-react/index";
6
6
 
7
7
  .tree-widget-searchbox {
8
8
  @include uicore-font-family;
@@ -1,9 +1,5 @@
1
- import type { IModelConnection, Viewport } from "@itwin/core-frontend";
1
+ /// <reference types="react" />
2
2
  import "./CategoriesTree.scss";
3
- export interface CategoriesTreeComponentProps {
4
- iModel: IModelConnection;
5
- allViewports?: boolean;
6
- activeView?: Viewport;
7
- }
8
- export declare function CategoriesTreeComponent(props: CategoriesTreeComponentProps): JSX.Element;
3
+ import type { CategoriesTreeProps } from "../../types";
4
+ export declare function CategoriesTreeComponent(props: CategoriesTreeProps): JSX.Element;
9
5
  //# sourceMappingURL=CategoriesTree.d.ts.map
@@ -2,39 +2,36 @@
2
2
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
3
  * See LICENSE.md in the project root for license terms and full copyright notice.
4
4
  *--------------------------------------------------------------------------------------------*/
5
- import React, { useCallback, useState } from "react";
5
+ import React, { useCallback } from "react";
6
6
  import { IModelApp } from "@itwin/core-frontend";
7
- import { CategoryTree, getCategories, toggleAllCategories } from "@itwin/appui-react";
7
+ import { CategoryTree, getCategories, toggleAllCategories, useActiveIModelConnection, useActiveViewport } from "@itwin/appui-react";
8
8
  import { useTreeFilteringState } from "../TreeFilteringState";
9
9
  import "./CategoriesTree.scss";
10
10
  import { TreeHeaderComponent } from "../header/TreeHeader";
11
11
  import { CategoryVisibilityHandler } from "@itwin/appui-react";
12
- import { useResizeObserver } from "@itwin/core-react";
12
+ import { AutoSizer } from "../utils/AutoSizer";
13
13
  export function CategoriesTreeComponent(props) {
14
+ const iModel = useActiveIModelConnection();
15
+ const viewport = useActiveViewport();
14
16
  const { searchOptions, filterString, activeMatchIndex, onFilterApplied, filteredProvider, } = useTreeFilteringState();
15
- const [height, setHeight] = useState(0);
16
- const [width, setWidth] = useState(0);
17
- const handleResize = useCallback((w, h) => {
18
- setHeight(h);
19
- setWidth(w);
20
- }, []);
21
- const ref = useResizeObserver(handleResize);
22
17
  const showAll = useCallback(async () => {
23
- return toggleAllCategories(IModelApp.viewManager, props.iModel, true, undefined, true, filteredProvider);
24
- }, [props.iModel, filteredProvider]);
18
+ if (!iModel)
19
+ return;
20
+ return toggleAllCategories(IModelApp.viewManager, iModel, true, undefined, true, filteredProvider);
21
+ }, [iModel, filteredProvider]);
25
22
  const hideAll = useCallback(async () => {
26
- return toggleAllCategories(IModelApp.viewManager, props.iModel, false, undefined, true, filteredProvider);
27
- }, [props.iModel, filteredProvider]);
23
+ if (!iModel)
24
+ return;
25
+ return toggleAllCategories(IModelApp.viewManager, iModel, false, undefined, true, filteredProvider);
26
+ }, [iModel, filteredProvider]);
28
27
  const invert = useCallback(async () => {
29
- const activeView = IModelApp.viewManager.getFirstOpenView();
30
- if (!activeView) {
28
+ if (!iModel || !viewport)
31
29
  return;
32
- }
33
- const ids = await getCategories(props.iModel, activeView, filteredProvider);
30
+ const ids = await getCategories(iModel, viewport, filteredProvider);
34
31
  const enabled = [];
35
32
  const disabled = [];
36
33
  for (const id of ids) {
37
- if (activeView.view.viewsCategory(id)) {
34
+ if (viewport.view.viewsCategory(id)) {
38
35
  enabled.push(id);
39
36
  }
40
37
  else {
@@ -42,12 +39,13 @@ export function CategoriesTreeComponent(props) {
42
39
  }
43
40
  }
44
41
  // Disable enabled
45
- CategoryVisibilityHandler.enableCategory(IModelApp.viewManager, props.iModel, enabled, false, true);
42
+ CategoryVisibilityHandler.enableCategory(IModelApp.viewManager, iModel, enabled, false, true);
46
43
  // Enable disabled
47
- CategoryVisibilityHandler.enableCategory(IModelApp.viewManager, props.iModel, disabled, true, true);
48
- }, [props.iModel, filteredProvider]);
49
- return (React.createElement(React.Fragment, null,
50
- React.createElement(TreeHeaderComponent, { searchOptions: searchOptions, showAll: showAll, hideAll: hideAll, invert: invert }),
51
- React.createElement("div", { ref: ref, style: { width: "100%", height: "100%" } }, width && height && (React.createElement(CategoryTree, { ...props, filterInfo: { filter: filterString, activeMatchIndex }, onFilterApplied: onFilterApplied, width: width, height: height })))));
44
+ CategoryVisibilityHandler.enableCategory(IModelApp.viewManager, iModel, disabled, true, true);
45
+ }, [iModel, viewport, filteredProvider]);
46
+ return (React.createElement(React.Fragment, null, iModel && viewport &&
47
+ React.createElement(React.Fragment, null,
48
+ React.createElement(TreeHeaderComponent, { searchOptions: searchOptions, showAll: showAll, hideAll: hideAll, invert: invert }),
49
+ React.createElement(AutoSizer, null, ({ width, height }) => (React.createElement(CategoryTree, { ...props, iModel: iModel, width: width, height: height, filterInfo: { filter: filterString, activeMatchIndex }, onFilterApplied: onFilterApplied }))))));
52
50
  }
53
51
  //# sourceMappingURL=CategoriesTree.js.map