@itwin/tree-widget-react 0.10.0-dev.1 → 1.0.0-dev.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +331 -0
- package/README.md +146 -29
- package/lib/cjs/TreeWidget.d.ts +0 -1
- package/lib/cjs/TreeWidget.js +1 -6
- package/lib/cjs/TreeWidget.js.map +1 -1
- package/lib/cjs/components/TreeFilteringState.d.ts +3 -1
- package/lib/cjs/components/TreeFilteringState.js +19 -40
- package/lib/cjs/components/TreeFilteringState.js.map +1 -1
- package/lib/cjs/components/TreeWidgetComponent.d.ts +29 -5
- package/lib/cjs/components/TreeWidgetComponent.js +85 -29
- package/lib/cjs/components/TreeWidgetComponent.js.map +1 -1
- package/lib/cjs/components/TreeWidgetComponent.scss +4 -24
- package/lib/cjs/components/TreeWidgetUiItemsProvider.d.ts +25 -2
- package/lib/cjs/components/TreeWidgetUiItemsProvider.js +31 -46
- package/lib/cjs/components/TreeWidgetUiItemsProvider.js.map +1 -1
- package/lib/cjs/components/tree-header/TreeHeader.d.ts +26 -0
- package/lib/cjs/components/tree-header/TreeHeader.js +43 -0
- package/lib/cjs/components/tree-header/TreeHeader.js.map +1 -0
- package/lib/cjs/components/tree-header/TreeHeader.scss +69 -0
- package/lib/cjs/components/trees/CategoriesVisibilityUtils.d.ts +12 -6
- package/lib/cjs/components/trees/CategoriesVisibilityUtils.js +10 -4
- package/lib/cjs/components/trees/CategoriesVisibilityUtils.js.map +1 -1
- package/lib/cjs/components/trees/Common.d.ts +2 -2
- package/lib/cjs/components/trees/Common.js +1 -1
- package/lib/cjs/components/trees/Common.js.map +1 -1
- package/lib/cjs/components/trees/VisibilityTreeBase.scss +66 -10
- package/lib/cjs/components/trees/VisibilityTreeEventHandler.d.ts +13 -12
- package/lib/cjs/components/trees/VisibilityTreeEventHandler.js +6 -17
- package/lib/cjs/components/trees/VisibilityTreeEventHandler.js.map +1 -1
- package/lib/cjs/components/trees/VisibilityTreeRenderer.d.ts +38 -14
- package/lib/cjs/components/trees/VisibilityTreeRenderer.js +35 -41
- package/lib/cjs/components/trees/VisibilityTreeRenderer.js.map +1 -1
- package/lib/cjs/components/trees/category-tree/CategoriesTree.d.ts +12 -11
- package/lib/cjs/components/trees/category-tree/CategoriesTree.js +17 -41
- package/lib/cjs/components/trees/category-tree/CategoriesTree.js.map +1 -1
- package/lib/cjs/components/trees/category-tree/CategoriesTreeComponent.d.ts +67 -6
- package/lib/cjs/components/trees/category-tree/CategoriesTreeComponent.js +61 -72
- package/lib/cjs/components/trees/category-tree/CategoriesTreeComponent.js.map +1 -1
- package/lib/cjs/components/trees/category-tree/CategoryVisibilityHandler.d.ts +30 -8
- package/lib/cjs/components/trees/category-tree/CategoryVisibilityHandler.js +61 -34
- package/lib/cjs/components/trees/category-tree/CategoryVisibilityHandler.js.map +1 -1
- package/lib/cjs/components/trees/external-sources-tree/ExternalSources.json +230 -0
- package/lib/cjs/components/trees/external-sources-tree/ExternalSourcesTree.d.ts +27 -0
- package/lib/cjs/components/trees/external-sources-tree/ExternalSourcesTree.js +61 -0
- package/lib/cjs/components/trees/external-sources-tree/ExternalSourcesTree.js.map +1 -0
- package/lib/cjs/components/trees/external-sources-tree/ExternalSourcesTreeComponent.d.ts +20 -0
- package/lib/cjs/components/trees/external-sources-tree/ExternalSourcesTreeComponent.js +39 -0
- package/lib/cjs/components/trees/external-sources-tree/ExternalSourcesTreeComponent.js.map +1 -0
- package/lib/cjs/components/trees/imodel-content-tree/IModelContentTree.d.ts +30 -0
- package/lib/cjs/components/trees/imodel-content-tree/IModelContentTree.js +39 -0
- package/lib/cjs/components/trees/imodel-content-tree/IModelContentTree.js.map +1 -0
- package/lib/cjs/components/trees/imodel-content-tree/IModelContentTreeComponent.d.ts +26 -0
- package/lib/cjs/components/trees/imodel-content-tree/IModelContentTreeComponent.js +35 -0
- package/lib/cjs/components/trees/imodel-content-tree/IModelContentTreeComponent.js.map +1 -0
- package/lib/cjs/components/trees/index.d.ts +5 -1
- package/lib/cjs/components/trees/index.js +10 -2
- package/lib/cjs/components/trees/index.js.map +1 -1
- package/lib/cjs/components/trees/models-tree/ModelsTree.d.ts +26 -18
- package/lib/cjs/components/trees/models-tree/ModelsTree.js +22 -50
- package/lib/cjs/components/trees/models-tree/ModelsTree.js.map +1 -1
- package/lib/cjs/components/trees/models-tree/ModelsTreeComponent.d.ts +70 -2
- package/lib/cjs/components/trees/models-tree/ModelsTreeComponent.js +68 -105
- package/lib/cjs/components/trees/models-tree/ModelsTreeComponent.js.map +1 -1
- package/lib/cjs/components/trees/models-tree/ModelsVisibilityHandler.d.ts +40 -12
- package/lib/cjs/components/trees/models-tree/ModelsVisibilityHandler.js +65 -5
- package/lib/cjs/components/trees/models-tree/ModelsVisibilityHandler.js.map +1 -1
- package/lib/cjs/components/trees/models-tree/Utils.d.ts +12 -0
- package/lib/cjs/components/trees/models-tree/Utils.js +625 -1
- package/lib/cjs/components/trees/models-tree/Utils.js.map +1 -1
- package/lib/cjs/components/utils/AutoSizer.d.ts +6 -3
- package/lib/cjs/components/utils/AutoSizer.js +9 -29
- package/lib/cjs/components/utils/AutoSizer.js.map +1 -1
- package/lib/cjs/components/utils/IsPromiseLike.d.ts +4 -1
- package/lib/cjs/components/utils/IsPromiseLike.js +6 -3
- package/lib/cjs/components/utils/IsPromiseLike.js.map +1 -1
- package/lib/cjs/tree-widget-react.d.ts +0 -1
- package/lib/cjs/tree-widget-react.js +5 -2
- package/lib/cjs/tree-widget-react.js.map +1 -1
- package/lib/esm/TreeWidget.d.ts +0 -1
- package/lib/esm/TreeWidget.js +2 -7
- package/lib/esm/TreeWidget.js.map +1 -1
- package/lib/esm/components/TreeFilteringState.d.ts +3 -1
- package/lib/esm/components/TreeFilteringState.js +17 -19
- package/lib/esm/components/TreeFilteringState.js.map +1 -1
- package/lib/esm/components/TreeWidgetComponent.d.ts +29 -5
- package/lib/esm/components/TreeWidgetComponent.js +82 -7
- package/lib/esm/components/TreeWidgetComponent.js.map +1 -1
- package/lib/esm/components/TreeWidgetComponent.scss +4 -24
- package/lib/esm/components/TreeWidgetUiItemsProvider.d.ts +25 -2
- package/lib/esm/components/TreeWidgetUiItemsProvider.js +29 -41
- package/lib/esm/components/TreeWidgetUiItemsProvider.js.map +1 -1
- package/lib/esm/components/tree-header/TreeHeader.d.ts +26 -0
- package/lib/esm/components/tree-header/TreeHeader.js +36 -0
- package/lib/esm/components/tree-header/TreeHeader.js.map +1 -0
- package/lib/esm/components/tree-header/TreeHeader.scss +69 -0
- package/lib/esm/components/trees/CategoriesVisibilityUtils.d.ts +12 -6
- package/lib/esm/components/trees/CategoriesVisibilityUtils.js +10 -4
- package/lib/esm/components/trees/CategoriesVisibilityUtils.js.map +1 -1
- package/lib/esm/components/trees/Common.d.ts +2 -2
- package/lib/esm/components/trees/Common.js +1 -1
- package/lib/esm/components/trees/Common.js.map +1 -1
- package/lib/esm/components/trees/VisibilityTreeBase.scss +66 -10
- package/lib/esm/components/trees/VisibilityTreeEventHandler.d.ts +13 -12
- package/lib/esm/components/trees/VisibilityTreeEventHandler.js +6 -17
- package/lib/esm/components/trees/VisibilityTreeEventHandler.js.map +1 -1
- package/lib/esm/components/trees/VisibilityTreeRenderer.d.ts +38 -14
- package/lib/esm/components/trees/VisibilityTreeRenderer.js +29 -19
- package/lib/esm/components/trees/VisibilityTreeRenderer.js.map +1 -1
- package/lib/esm/components/trees/category-tree/CategoriesTree.d.ts +12 -11
- package/lib/esm/components/trees/category-tree/CategoriesTree.js +16 -21
- package/lib/esm/components/trees/category-tree/CategoriesTree.js.map +1 -1
- package/lib/esm/components/trees/category-tree/CategoriesTreeComponent.d.ts +67 -6
- package/lib/esm/components/trees/category-tree/CategoriesTreeComponent.js +60 -52
- package/lib/esm/components/trees/category-tree/CategoriesTreeComponent.js.map +1 -1
- package/lib/esm/components/trees/category-tree/CategoryVisibilityHandler.d.ts +30 -8
- package/lib/esm/components/trees/category-tree/CategoryVisibilityHandler.js +57 -14
- package/lib/esm/components/trees/category-tree/CategoryVisibilityHandler.js.map +1 -1
- package/lib/esm/components/trees/external-sources-tree/ExternalSources.json +230 -0
- package/lib/esm/components/trees/external-sources-tree/ExternalSourcesTree.d.ts +27 -0
- package/lib/esm/components/trees/external-sources-tree/ExternalSourcesTree.js +34 -0
- package/lib/esm/components/trees/external-sources-tree/ExternalSourcesTree.js.map +1 -0
- package/lib/esm/components/trees/external-sources-tree/ExternalSourcesTreeComponent.d.ts +20 -0
- package/lib/esm/components/trees/external-sources-tree/ExternalSourcesTreeComponent.js +35 -0
- package/lib/esm/components/trees/external-sources-tree/ExternalSourcesTreeComponent.js.map +1 -0
- package/lib/esm/components/trees/imodel-content-tree/IModelContentTree.d.ts +30 -0
- package/lib/esm/components/trees/imodel-content-tree/IModelContentTree.js +32 -0
- package/lib/esm/components/trees/imodel-content-tree/IModelContentTree.js.map +1 -0
- package/lib/esm/components/trees/imodel-content-tree/IModelContentTreeComponent.d.ts +26 -0
- package/lib/esm/components/trees/imodel-content-tree/IModelContentTreeComponent.js +31 -0
- package/lib/esm/components/trees/imodel-content-tree/IModelContentTreeComponent.js.map +1 -0
- package/lib/esm/components/trees/index.d.ts +5 -1
- package/lib/esm/components/trees/index.js +5 -1
- package/lib/esm/components/trees/index.js.map +1 -1
- package/lib/esm/components/trees/models-tree/ModelsTree.d.ts +26 -18
- package/lib/esm/components/trees/models-tree/ModelsTree.js +23 -32
- package/lib/esm/components/trees/models-tree/ModelsTree.js.map +1 -1
- package/lib/esm/components/trees/models-tree/ModelsTreeComponent.d.ts +70 -2
- package/lib/esm/components/trees/models-tree/ModelsTreeComponent.js +66 -84
- package/lib/esm/components/trees/models-tree/ModelsTreeComponent.js.map +1 -1
- package/lib/esm/components/trees/models-tree/ModelsVisibilityHandler.d.ts +40 -12
- package/lib/esm/components/trees/models-tree/ModelsVisibilityHandler.js +60 -5
- package/lib/esm/components/trees/models-tree/ModelsVisibilityHandler.js.map +1 -1
- package/lib/esm/components/trees/models-tree/Utils.d.ts +12 -0
- package/lib/esm/components/trees/models-tree/Utils.js +622 -0
- package/lib/esm/components/trees/models-tree/Utils.js.map +1 -1
- package/lib/esm/components/utils/AutoSizer.d.ts +6 -3
- package/lib/esm/components/utils/AutoSizer.js +9 -10
- package/lib/esm/components/utils/AutoSizer.js.map +1 -1
- package/lib/esm/components/utils/IsPromiseLike.d.ts +4 -1
- package/lib/esm/components/utils/IsPromiseLike.js +4 -1
- package/lib/esm/components/utils/IsPromiseLike.js.map +1 -1
- package/lib/esm/tree-widget-react.d.ts +0 -1
- package/lib/esm/tree-widget-react.js +0 -1
- package/lib/esm/tree-widget-react.js.map +1 -1
- package/lib/public/locales/en/TreeWidget.json +13 -4
- package/package.json +61 -66
- package/lib/cjs/components/rulesets/ClassificationSystems.json +0 -122
- package/lib/cjs/components/search-bar/SearchBar.d.ts +0 -48
- package/lib/cjs/components/search-bar/SearchBar.js +0 -86
- package/lib/cjs/components/search-bar/SearchBar.js.map +0 -1
- package/lib/cjs/components/search-bar/SearchBar.scss +0 -118
- package/lib/cjs/components/search-bar/SearchBox.d.ts +0 -70
- package/lib/cjs/components/search-bar/SearchBox.js +0 -186
- package/lib/cjs/components/search-bar/SearchBox.js.map +0 -1
- package/lib/cjs/components/search-bar/SearchBox.scss +0 -70
- package/lib/cjs/components/trees/IModelContentTree.d.ts +0 -4
- package/lib/cjs/components/trees/IModelContentTree.js +0 -50
- package/lib/cjs/components/trees/IModelContentTree.js.map +0 -1
- package/lib/cjs/components/trees/models-tree/Hierarchy.GroupedByClass.json +0 -391
- package/lib/cjs/components/trees/models-tree/Hierarchy.json +0 -386
- package/lib/cjs/components/trees/models-tree/ModelsTreeSearch.json +0 -239
- package/lib/cjs/types.d.ts +0 -44
- package/lib/cjs/types.js +0 -11
- package/lib/cjs/types.js.map +0 -1
- package/lib/esm/components/rulesets/ClassificationSystems.json +0 -122
- package/lib/esm/components/search-bar/SearchBar.d.ts +0 -48
- package/lib/esm/components/search-bar/SearchBar.js +0 -60
- package/lib/esm/components/search-bar/SearchBar.js.map +0 -1
- package/lib/esm/components/search-bar/SearchBar.scss +0 -118
- package/lib/esm/components/search-bar/SearchBox.d.ts +0 -70
- package/lib/esm/components/search-bar/SearchBox.js +0 -160
- package/lib/esm/components/search-bar/SearchBox.js.map +0 -1
- package/lib/esm/components/search-bar/SearchBox.scss +0 -70
- package/lib/esm/components/trees/IModelContentTree.d.ts +0 -4
- package/lib/esm/components/trees/IModelContentTree.js +0 -24
- package/lib/esm/components/trees/IModelContentTree.js.map +0 -1
- package/lib/esm/components/trees/models-tree/Hierarchy.GroupedByClass.json +0 -391
- package/lib/esm/components/trees/models-tree/Hierarchy.json +0 -386
- package/lib/esm/components/trees/models-tree/ModelsTreeSearch.json +0 -239
- package/lib/esm/types.d.ts +0 -44
- package/lib/esm/types.js +0 -8
- package/lib/esm/types.js.map +0 -1
- /package/lib/cjs/components/{rulesets → trees/imodel-content-tree}/IModelContent.json +0 -0
- /package/lib/esm/components/{rulesets → trees/imodel-content-tree}/IModelContent.json +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Utils.js","sourceRoot":"","sources":["../../../../../src/components/trees/models-tree/Utils.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAI/F,gBAAgB;AAChB,MAAa,0BAA0B;IAErC,YAAoB,UAAsC;QAAtC,eAAU,GAAV,UAAU,CAA4B;QADlD,SAAI,GAAG,IAAI,KAAK,EAAc,CAAC;IAEvC,CAAC;IAEO,KAAK,CAAC,IAAI,KAAK,OAAO,CAAC,MAAM,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;IAE9D,KAAK,CAAA,CAAE,aAAa;QACzB,KAAK,MAAM,EAAE,IAAI,IAAI,CAAC,IAAI,EAAE;YAC1B,MAAM,EAAE,CAAC;SACV;QAED,IAAI,MAAM,CAAC;QACX,OAAO,MAAM,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,EAAE;YACjC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACvB,MAAM,MAAM,CAAC;SACd;IACH,CAAC;CACF;AAlBD,gEAkBC","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 type { Id64String } from \"@itwin/core-bentley\";\n\n/** @internal */\nexport class CachingElementIdsContainer {\n private _ids = new Array<Id64String>();\n constructor(private _generator: AsyncGenerator<Id64String>) {\n }\n\n private async next() { return (await this._generator.next()).value; }\n\n public async* getElementIds() {\n for (const id of this._ids) {\n yield id;\n }\n\n let nextId;\n while (nextId = await this.next()) {\n this._ids.push(nextId);\n yield nextId;\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Utils.js","sourceRoot":"","sources":["../../../../../src/components/trees/models-tree/Utils.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAM/F,gBAAgB;AAChB,MAAa,0BAA0B;IAErC,YAAoB,UAAsC;QAAtC,eAAU,GAAV,UAAU,CAA4B;QADlD,SAAI,GAAG,IAAI,KAAK,EAAc,CAAC;IAEvC,CAAC;IAEO,KAAK,CAAC,IAAI,KAAK,OAAO,CAAC,MAAM,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;IAE9D,KAAK,CAAA,CAAE,aAAa;QACzB,KAAK,MAAM,EAAE,IAAI,IAAI,CAAC,IAAI,EAAE;YAC1B,MAAM,EAAE,CAAC;SACV;QAED,IAAI,MAAM,CAAC;QACX,OAAO,MAAM,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,EAAE;YACjC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACvB,MAAM,MAAM,CAAC;SACd;IACH,CAAC;CACF;AAlBD,gEAkBC;AAOD,gBAAgB;AAChB,SAAgB,aAA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IAAI;wBACrhB,oBAAoB,EAAE,IAAI;wBAC1B,YAAY,EAAE,KAAK;wBACnB,YAAY,EAAE,KAAK;qBACpB;iBACF;gBACD,kBAAkB,EAAE;oBAClB;wBACE,QAAQ,EAAE,eAAe;wBACzB,KAAK,EAAE;4BACL,cAAc,EAAE,MAAM;yBACvB;qBACF;oBACD;wBACE,QAAQ,EAAE,cAAc;wBACxB,KAAK,EAAE;4BACL,OAAO,EAAE,MAAM;yBAChB;qBACF;iBACF;aACF;YACD;gBACE,QAAQ,EAAE,YAAY;gBACtB,SAAS,EAAE,qDAAqD;gBAChE,cAAc,EAAE;oBACd;wBACE,QAAQ,EAAE,sBAAsB;wBAChC,iBAAiB,EAAE;4BACjB;gCACE,YAAY,EAAE;oCACZ,UAAU,EAAE,SAAS;oCACrB,SAAS,EAAE,mBAAmB;iCAC/B;gCACD,SAAS,EAAE,SAAS;gCACpB,WAAW,EAAE;oCACX,UAAU,EAAE,SAAS;oCACrB,SAAS,EAAE,kBAAkB;iCAC9B;6BACF;yBACF;wBACD,cAAc,EAAE,+FAA+F,yBAAyB,CAAC,UAAU,IAAI,yBAAyB,CAAC,SAAS,IAAI;wBAC9L,YAAY,EAAE,KAAK;wBACnB,YAAY,EAAE,KAAK;qBACpB;iBACF;gBACD,kBAAkB,EAAE;oBAClB;wBACE,QAAQ,EAAE,cAAc;wBACxB,KAAK,EAAE;4BACL,OAAO,EAAE,MAAM;yBAChB;qBACF;iBACF;aACF;YACD;gBACE,QAAQ,EAAE,iBAAiB;gBAC3B,SAAS,EAAE,0CAA0C;gBACrD,iBAAiB,EAAE,mEAAmE;aACvF;YACD;gBACE,QAAQ,EAAE,iBAAiB;gBAC3B,SAAS,EAAE,wCAAwC;gBACnD,iBAAiB,EAAE,cAAc;aAClC;SACF;KACF,CAAC;AACJ,CAAC;AAhPD,kDAgPC","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 type { Id64String } from \"@itwin/core-bentley\";\nimport type { Ruleset } from \"@itwin/presentation-common\";\nimport type { ModelsTreeHierarchyConfiguration } from \"./ModelsTree\";\n\n/** @internal */\nexport class CachingElementIdsContainer {\n private _ids = new Array<Id64String>();\n constructor(private _generator: AsyncGenerator<Id64String>) {\n }\n\n private async next() { return (await this._generator.next()).value; }\n\n public async* getElementIds() {\n for (const id of this._ids) {\n yield id;\n }\n\n let nextId;\n while (nextId = await this.next()) {\n this._ids.push(nextId);\n yield nextId;\n }\n }\n}\n\n/** @internal */\nexport type CreateRulesetProps = Omit<ModelsTreeHierarchyConfiguration, \"enableElementsClassGrouping\"> & {\n enableElementsClassGrouping?: boolean;\n};\n\n/** @internal */\nexport function createRuleset(props: CreateRulesetProps): Ruleset {\n const elementClassSpecification = props.elementClassSpecification ?? { schemaName: \"BisCore\", className: \"GeometricElement3d\" };\n return {\n id: \"tree-widget-react/ModelsTree\",\n requiredSchemas: [\n {\n name: \"BisCore\",\n },\n ],\n rules: [\n {\n ruleType: \"RootNodes\",\n autoExpand: true,\n specifications: [\n {\n specType: \"InstanceNodesOfSpecificClasses\",\n classes: [\n {\n schemaName: \"BisCore\",\n classNames: [\n \"Subject\",\n ],\n },\n ],\n instanceFilter: `this.Parent = NULL`,\n groupByClass: false,\n groupByLabel: false,\n },\n ],\n customizationRules: [\n {\n ruleType: \"ExtendedData\",\n items: {\n isSubject: \"true\",\n },\n },\n ],\n },\n {\n ruleType: \"ChildNodes\",\n condition: `ParentNode.IsOfClass(\"Subject\", \"BisCore\")`,\n specifications: [\n {\n specType: \"RelatedInstanceNodes\",\n relationshipPaths: [\n {\n relationship: {\n schemaName: \"BisCore\",\n className: \"SubjectOwnsSubjects\",\n },\n direction: \"Forward\",\n targetClass: {\n schemaName: \"BisCore\",\n className: \"Subject\",\n },\n },\n ],\n instanceFilter: `json_extract(this.JsonProperties, \"$.Subject.Job.Bridge\") <> NULL OR ifnull(json_extract(this.JsonProperties, \"$.Subject.Model.Type\"), \"\") = \"Hierarchy\"`,\n hideNodesInHierarchy: true,\n groupByClass: false,\n groupByLabel: false,\n },\n {\n specType: \"RelatedInstanceNodes\",\n relationshipPaths: [\n {\n relationship: {\n schemaName: \"BisCore\",\n className: \"SubjectOwnsSubjects\",\n },\n direction: \"Forward\",\n targetClass: {\n schemaName: \"BisCore\",\n className: \"Subject\",\n },\n },\n ],\n instanceFilter: `json_extract(this.JsonProperties, \"$.Subject.Job.Bridge\") = NULL AND ifnull(json_extract(this.JsonProperties, \"$.Subject.Model.Type\"), \"\") <> \"Hierarchy\"`,\n hideIfNoChildren: true,\n groupByClass: false,\n groupByLabel: false,\n },\n ],\n customizationRules: [\n {\n ruleType: \"ExtendedData\",\n items: {\n isSubject: \"true\",\n },\n },\n ],\n },\n {\n ruleType: \"ChildNodes\",\n condition: `ParentNode.IsOfClass(\"Subject\", \"BisCore\")`,\n specifications: [\n {\n specType: \"InstanceNodesOfSpecificClasses\",\n classes: {\n schemaName: \"BisCore\",\n classNames: [\n \"GeometricModel3d\",\n ],\n arePolymorphic: true,\n },\n relatedInstances: [\n {\n relationshipPath: {\n relationship: {\n schemaName: \"BisCore\",\n className: \"ModelModelsElement\",\n },\n direction: \"Forward\",\n targetClass: {\n schemaName: \"BisCore\",\n className: \"InformationPartitionElement\",\n },\n },\n alias: \"partition\",\n isRequired: true,\n },\n ],\n 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 AND this.HasRelatedInstance(\"BisCore:ModelContainsElements\", \"Forward\", \"${elementClassSpecification.schemaName}:${elementClassSpecification.className}\")`,\n hasChildren: \"Always\",\n hideIfNoChildren: true,\n groupByClass: false,\n groupByLabel: false,\n },\n {\n specType: \"InstanceNodesOfSpecificClasses\",\n classes: {\n schemaName: \"BisCore\",\n classNames: [\n \"GeometricModel3d\",\n ],\n arePolymorphic: true,\n },\n relatedInstances: [\n {\n relationshipPath: {\n relationship: {\n schemaName: \"BisCore\",\n className: \"ModelModelsElement\",\n },\n direction: \"Forward\",\n targetClass: {\n schemaName: \"BisCore\",\n className: \"InformationPartitionElement\",\n },\n },\n alias: \"partition\",\n isRequired: true,\n },\n ],\n 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) AND this.HasRelatedInstance(\"BisCore:ModelContainsElements\", \"Forward\", \"${elementClassSpecification.schemaName}:${elementClassSpecification.className}\")`,\n hasChildren: \"Always\",\n hideNodesInHierarchy: true,\n groupByClass: false,\n groupByLabel: false,\n },\n ],\n customizationRules: [\n {\n ruleType: \"ExtendedData\",\n items: {\n isModel: \"true\",\n },\n },\n ],\n },\n {\n ruleType: \"ChildNodes\",\n condition: `ParentNode.IsOfClass(\"ISubModeledElement\", \"BisCore\")`,\n specifications: [\n {\n specType: \"RelatedInstanceNodes\",\n relationshipPaths: [\n {\n relationship: {\n schemaName: \"BisCore\",\n className: \"ModelModelsElement\",\n },\n direction: \"Backward\",\n },\n ],\n instanceFilter: `NOT this.IsPrivate AND this.HasRelatedInstance(\"BisCore:ModelContainsElements\", \"Forward\", \"${elementClassSpecification.schemaName}:${elementClassSpecification.className}\")`,\n hideNodesInHierarchy: true,\n groupByClass: false,\n groupByLabel: false,\n },\n ],\n customizationRules: [\n {\n ruleType: \"ExtendedData\",\n items: {\n isModel: \"true\",\n },\n },\n ],\n },\n {\n ruleType: \"ChildNodes\",\n condition: `ParentNode.IsOfClass(\"GeometricModel3d\", \"BisCore\")`,\n specifications: [\n {\n specType: \"RelatedInstanceNodes\",\n relationshipPaths: [\n [\n {\n relationship: {\n schemaName: \"BisCore\",\n className: \"ModelContainsElements\",\n },\n direction: \"Forward\",\n targetClass: elementClassSpecification,\n },\n {\n relationship: {\n schemaName: \"BisCore\",\n className: \"GeometricElement3dIsInCategory\",\n },\n direction: \"Forward\",\n },\n ],\n ],\n instanceFilter: `NOT this.IsPrivate`,\n suppressSimilarAncestorsCheck: true,\n hideIfNoChildren: true,\n groupByClass: false,\n groupByLabel: false,\n },\n ],\n customizationRules: [\n {\n ruleType: \"ExtendedData\",\n items: {\n isCategory: \"true\",\n modelId: \"ParentNode.InstanceId\",\n },\n },\n ],\n },\n {\n ruleType: \"ChildNodes\",\n condition: `ParentNode.IsOfClass(\"SpatialCategory\", \"BisCore\")`,\n specifications: [\n {\n specType: \"RelatedInstanceNodes\",\n relationshipPaths: [\n {\n relationship: {\n schemaName: \"BisCore\",\n className: \"GeometricElement3dIsInCategory\",\n },\n direction: \"Backward\",\n targetClass: elementClassSpecification,\n },\n ],\n instanceFilter: `this.Model.Id = parent.parent.ECInstanceId ANDALSO this.Parent = NULL`,\n groupByClass: !!props.enableElementsClassGrouping,\n groupByLabel: false,\n },\n ],\n customizationRules: [\n {\n ruleType: \"ExtendedData\",\n items: {\n modelId: \"this.Model.Id\",\n categoryId: \"this.Category.Id\",\n },\n },\n ],\n },\n {\n ruleType: \"ChildNodes\",\n condition: `ParentNode.IsOfClass(\"GeometricElement3d\", \"BisCore\")`,\n specifications: [\n {\n specType: \"RelatedInstanceNodes\",\n relationshipPaths: [\n {\n relationship: {\n schemaName: \"BisCore\",\n className: \"ElementOwnsChildElements\",\n },\n direction: \"Forward\",\n targetClass: elementClassSpecification,\n },\n ],\n groupByClass: !!props.enableElementsClassGrouping,\n groupByLabel: false,\n },\n ],\n customizationRules: [\n {\n ruleType: \"ExtendedData\",\n items: {\n modelId: \"this.Model.Id\",\n categoryId: \"this.Category.Id\",\n },\n },\n ],\n },\n {\n ruleType: \"Grouping\",\n class: {\n schemaName: \"BisCore\",\n className: \"Subject\",\n },\n groups: [\n {\n specType: \"SameLabelInstance\",\n applicationStage: \"PostProcess\",\n },\n ],\n },\n {\n ruleType: \"Grouping\",\n class: {\n schemaName: \"BisCore\",\n className: \"SpatialCategory\",\n },\n groups: [\n {\n specType: \"SameLabelInstance\",\n applicationStage: \"PostProcess\",\n },\n ],\n },\n {\n ruleType: \"ImageIdOverride\",\n condition: `ThisNode.IsInstanceNode ANDALSO ThisNode.IsOfClass(\"Subject\", \"BisCore\")`,\n imageIdExpression: `IIF(this.Parent.Id = NULL, \"icon-imodel-hollow-2\", \"icon-folder\")`,\n },\n {\n ruleType: \"ImageIdOverride\",\n condition: `ThisNode.IsInstanceNode ANDALSO ThisNode.IsOfClass(\"Model\", \"BisCore\")`,\n imageIdExpression: `\"icon-model\"`,\n },\n {\n ruleType: \"ImageIdOverride\",\n condition: `ThisNode.IsInstanceNode ANDALSO ThisNode.IsOfClass(\"Category\", \"BisCore\")`,\n imageIdExpression: `\"icon-layers\"`,\n },\n {\n ruleType: \"ImageIdOverride\",\n condition: `ThisNode.IsInstanceNode ANDALSO ThisNode.IsOfClass(\"Element\", \"BisCore\")`,\n imageIdExpression: `\"icon-item\"`,\n },\n {\n ruleType: \"ImageIdOverride\",\n condition: `ThisNode.IsClassGroupingNode`,\n imageIdExpression: `\"icon-ec-class\"`,\n },\n {\n ruleType: \"Content\",\n condition: `ContentDisplayType = \"AssemblyElementsRequest\"`,\n specifications: [\n {\n specType: \"SelectedNodeInstances\",\n },\n {\n specType: \"ContentRelatedInstances\",\n relationshipPaths: [\n {\n relationship: {\n schemaName: \"BisCore\",\n className: \"ElementOwnsChildElements\",\n },\n direction: \"Forward\",\n count: \"*\",\n },\n ],\n },\n ],\n },\n ],\n };\n}\n\n/** @internal */\nexport type CreateSearchRulesetProps = Omit<ModelsTreeHierarchyConfiguration, \"enableElementsClassGrouping\">;\n\n/** @internal */\nexport function createSearchRuleset(props: CreateSearchRulesetProps): Ruleset {\n const elementClassSpecification = props.elementClassSpecification ?? { schemaName: \"BisCore\", className: \"GeometricElement3d\" };\n return {\n id: \"tree-widget-react/ModelsTreeSearch\",\n rules: [\n {\n ruleType: \"RootNodes\",\n specifications: [\n {\n specType: \"InstanceNodesOfSpecificClasses\",\n classes: [\n {\n schemaName: \"BisCore\",\n classNames: [\n \"Subject\",\n ],\n },\n ],\n instanceFilter: \"this.Parent = NULL\",\n arePolymorphic: false,\n groupByClass: false,\n groupByLabel: false,\n },\n ],\n customizationRules: [\n {\n ruleType: \"ExtendedData\",\n items: {\n isSubject: \"true\",\n },\n },\n ],\n },\n {\n ruleType: \"ChildNodes\",\n condition: `ParentNode.IsOfClass(\"Subject\", \"BisCore\")`,\n specifications: [\n {\n specType: \"RelatedInstanceNodes\",\n relationshipPaths: [\n {\n relationship: {\n schemaName: \"BisCore\",\n className: \"SubjectOwnsSubjects\",\n },\n direction: \"Forward\",\n targetClass: {\n schemaName: \"BisCore\",\n className: \"Subject\",\n },\n },\n ],\n instanceFilter: `json_extract(this.JsonProperties, \"$.Subject.Job.Bridge\") <> NULL OR ifnull(json_extract(this.JsonProperties, \"$.Subject.Model.Type\"), \"\") = \"Hierarchy\"`,\n hideNodesInHierarchy: true,\n groupByClass: false,\n groupByLabel: false,\n },\n {\n specType: \"RelatedInstanceNodes\",\n relationshipPaths: [\n {\n relationship: {\n schemaName: \"BisCore\",\n className: \"SubjectOwnsSubjects\",\n },\n direction: \"Forward\",\n targetClass: {\n schemaName: \"BisCore\",\n className: \"Subject\",\n },\n },\n ],\n instanceFilter: `json_extract(this.JsonProperties, \"$.Subject.Job.Bridge\") = NULL AND ifnull(json_extract(this.JsonProperties, \"$.Subject.Model.Type\"), \"\") <> \"Hierarchy\"`,\n hideExpression: `NOT ThisNode.HasChildren ANDALSO NOT ThisNode.ChildrenArtifacts.AnyMatches(x => x.isContentModel)`,\n groupByClass: false,\n groupByLabel: false,\n },\n ],\n customizationRules: [\n {\n ruleType: \"ExtendedData\",\n items: {\n isSubject: \"true\",\n },\n },\n {\n ruleType: \"Grouping\",\n class: {\n schemaName: \"BisCore\",\n className: \"Subject\",\n },\n groups: [\n {\n specType: \"SameLabelInstance\",\n applicationStage: \"PostProcess\",\n },\n ],\n },\n ],\n },\n {\n ruleType: \"ChildNodes\",\n condition: `ParentNode.IsOfClass(\"Subject\", \"BisCore\")`,\n specifications: [\n {\n specType: \"InstanceNodesOfSpecificClasses\",\n classes: {\n schemaName: \"BisCore\",\n classNames: [\n \"GeometricModel3d\",\n ],\n },\n arePolymorphic: true,\n relatedInstances: [\n {\n relationshipPath: {\n relationship: {\n schemaName: \"BisCore\",\n className: \"ModelModelsElement\",\n },\n direction: \"Forward\",\n targetClass: {\n schemaName: \"BisCore\",\n className: \"InformationPartitionElement\",\n },\n },\n alias: \"partition\",\n isRequired: true,\n },\n ],\n 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 AND this.HasRelatedInstance(\"BisCore:ModelContainsElements\", \"Forward\", \"${elementClassSpecification.schemaName}:${elementClassSpecification.className}\")`,\n groupByClass: false,\n groupByLabel: false,\n },\n ],\n customizationRules: [\n {\n ruleType: \"ExtendedData\",\n items: {\n isModel: \"true\",\n },\n },\n ],\n },\n {\n ruleType: \"ChildNodes\",\n condition: `ParentNode.IsOfClass(\"Subject\", \"BisCore\")`,\n specifications: [\n {\n specType: \"InstanceNodesOfSpecificClasses\",\n classes: {\n schemaName: \"BisCore\",\n classNames: [\n \"GeometricModel3d\",\n ],\n },\n arePolymorphic: true,\n relatedInstances: [\n {\n relationshipPath: {\n relationship: {\n schemaName: \"BisCore\",\n className: \"ModelModelsElement\",\n },\n direction: \"Forward\",\n targetClass: {\n schemaName: \"BisCore\",\n className: \"InformationPartitionElement\",\n },\n },\n alias: \"partition\",\n isRequired: true,\n },\n ],\n 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) AND this.HasRelatedInstance(\"BisCore:ModelContainsElements\", \"Forward\", \"${elementClassSpecification.schemaName}:${elementClassSpecification.className}\")`,\n hideNodesInHierarchy: true,\n groupByClass: false,\n groupByLabel: false,\n },\n ],\n customizationRules: [\n {\n ruleType: \"NodeArtifacts\",\n items: {\n isContentModel: \"true\",\n },\n },\n {\n ruleType: \"ExtendedData\",\n items: {\n isModel: \"true\",\n },\n },\n ],\n },\n {\n ruleType: \"ChildNodes\",\n condition: `ParentNode.IsOfClass(\"GeometricModel3d\", \"BisCore\")`,\n specifications: [\n {\n specType: \"RelatedInstanceNodes\",\n relationshipPaths: [\n {\n relationship: {\n schemaName: \"BisCore\",\n className: \"ModelOwnsSubModel\",\n },\n direction: \"Forward\",\n targetClass: {\n schemaName: \"BisCore\",\n className: \"GeometricModel3d\",\n },\n },\n ],\n instanceFilter: `NOT this.IsPrivate AND this.HasRelatedInstance(\"BisCore:ModelContainsElements\", \"Forward\", \"${elementClassSpecification.schemaName}:${elementClassSpecification.className}\")`,\n groupByClass: false,\n groupByLabel: false,\n },\n ],\n customizationRules: [\n {\n ruleType: \"ExtendedData\",\n items: {\n isModel: \"true\",\n },\n },\n ],\n },\n {\n ruleType: \"ImageIdOverride\",\n condition: `ThisNode.IsOfClass(\"Subject\", \"BisCore\")`,\n imageIdExpression: `IIF(this.Parent.Id = NULL, \"icon-imodel-hollow-2\", \"icon-folder\")`,\n },\n {\n ruleType: \"ImageIdOverride\",\n condition: `ThisNode.IsOfClass(\"Model\", \"BisCore\")`,\n imageIdExpression: `\"icon-model\"`,\n },\n ],\n };\n}\n"]}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
/** @internal */
|
|
2
3
|
export interface Size {
|
|
3
4
|
width: number;
|
|
4
5
|
height: number;
|
|
5
6
|
}
|
|
7
|
+
/** @internal */
|
|
6
8
|
export interface AutoSizerProps {
|
|
7
|
-
children: (size: Size) => React.
|
|
9
|
+
children: (size: Size) => React.ReactNode;
|
|
8
10
|
}
|
|
9
|
-
|
|
11
|
+
/** @internal */
|
|
12
|
+
export declare function AutoSizer(props: AutoSizerProps): JSX.Element;
|
|
10
13
|
//# sourceMappingURL=AutoSizer.d.ts.map
|
|
@@ -1,39 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
-
}) : function(o, v) {
|
|
12
|
-
o["default"] = v;
|
|
13
|
-
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
-
if (mod && mod.__esModule) return mod;
|
|
16
|
-
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
3
|
exports.AutoSizer = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
23
5
|
/*---------------------------------------------------------------------------------------------
|
|
24
6
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
25
7
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
26
8
|
*--------------------------------------------------------------------------------------------*/
|
|
27
|
-
const react_1 =
|
|
9
|
+
const react_1 = require("react");
|
|
28
10
|
const core_react_1 = require("@itwin/core-react");
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
return (react_1.default.createElement(core_react_1.ResizableContainerObserver, { onResize: handleResize }, props.children({ height, width })));
|
|
37
|
-
};
|
|
11
|
+
// istanbul ignore next
|
|
12
|
+
/** @internal */
|
|
13
|
+
function AutoSizer(props) {
|
|
14
|
+
const [{ height, width }, setSize] = (0, react_1.useState)({ height: 0, width: 0 });
|
|
15
|
+
const handleResize = (0, react_1.useCallback)((w, h) => { setSize({ height: h, width: w }); }, []);
|
|
16
|
+
return ((0, jsx_runtime_1.jsx)(core_react_1.ResizableContainerObserver, { onResize: handleResize, children: props.children({ height, width }) }));
|
|
17
|
+
}
|
|
38
18
|
exports.AutoSizer = AutoSizer;
|
|
39
19
|
//# sourceMappingURL=AutoSizer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AutoSizer.js","sourceRoot":"","sources":["../../../../src/components/utils/AutoSizer.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AutoSizer.js","sourceRoot":"","sources":["../../../../src/components/utils/AutoSizer.tsx"],"names":[],"mappings":";;;;AAAA;;;+FAG+F;AAE/F,iCAA8C;AAC9C,kDAA+D;AAa/D,uBAAuB;AACvB,gBAAgB;AAChB,SAAgB,SAAS,CAAC,KAAqB;IAC7C,MAAM,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,CAAC,GAAG,IAAA,gBAAQ,EAAO,EAAE,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC;IAC7E,MAAM,YAAY,GAAG,IAAA,mBAAW,EAAC,CAAC,CAAS,EAAE,CAAS,EAAE,EAAE,GAAG,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAEtG,OAAO,CACL,uBAAC,uCAA0B,IAAC,QAAQ,EAAE,YAAY,YAC/C,KAAK,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,GACP,CAC9B,CAAC;AACJ,CAAC;AATD,8BASC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\nimport { useCallback, useState } from \"react\";\nimport { ResizableContainerObserver } from \"@itwin/core-react\";\n\n/** @internal */\nexport interface Size {\n width: number;\n height: number;\n}\n\n/** @internal */\nexport interface AutoSizerProps {\n children: (size: Size) => React.ReactNode;\n}\n\n// istanbul ignore next\n/** @internal */\nexport function AutoSizer(props: AutoSizerProps) {\n const [{ height, width }, setSize] = useState<Size>({ height: 0, width: 0 });\n const handleResize = useCallback((w: number, h: number) => { setSize({ height: h, width: w }); }, []);\n\n return (\n <ResizableContainerObserver onResize={handleResize}>\n {props.children({ height, width })}\n </ResizableContainerObserver>\n );\n}\n"]}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isPromiseLike = void 0;
|
|
4
2
|
/*---------------------------------------------------------------------------------------------
|
|
5
3
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
6
4
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
7
5
|
*--------------------------------------------------------------------------------------------*/
|
|
8
|
-
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.isPromiseLike = void 0;
|
|
8
|
+
/**
|
|
9
|
+
* Checks if the specified argument is a promise
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
9
12
|
function isPromiseLike(obj) {
|
|
10
13
|
return !!(obj && (typeof obj === "object") && (typeof obj.then === "function"));
|
|
11
14
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IsPromiseLike.js","sourceRoot":"","sources":["../../../../src/components/utils/IsPromiseLike.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"IsPromiseLike.js","sourceRoot":"","sources":["../../../../src/components/utils/IsPromiseLike.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;;GAGG;AACH,SAAgB,aAAa,CAAC,GAAY;IACxC,OAAO,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,OAAO,GAAG,KAAK,QAAQ,CAAC,IAAI,CAAC,OAAQ,GAAW,CAAC,IAAI,KAAK,UAAU,CAAC,CAAC,CAAC;AAC3F,CAAC;AAFD,sCAEC","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\n/**\n * Checks if the specified argument is a promise\n * @internal\n */\nexport function isPromiseLike(obj: unknown): obj is PromiseLike<unknown> {\n return !!(obj && (typeof obj === \"object\") && (typeof (obj as any).then === \"function\"));\n}\n"]}
|
|
@@ -5,7 +5,11 @@
|
|
|
5
5
|
*--------------------------------------------------------------------------------------------*/
|
|
6
6
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
7
|
if (k2 === undefined) k2 = k;
|
|
8
|
-
Object.
|
|
8
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
10
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
11
|
+
}
|
|
12
|
+
Object.defineProperty(o, k2, desc);
|
|
9
13
|
}) : (function(o, m, k, k2) {
|
|
10
14
|
if (k2 === undefined) k2 = k;
|
|
11
15
|
o[k2] = m[k];
|
|
@@ -14,7 +18,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
18
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
19
|
};
|
|
16
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./types"), exports);
|
|
18
21
|
__exportStar(require("./TreeWidget"), exports);
|
|
19
22
|
__exportStar(require("./components/TreeWidgetComponent"), exports);
|
|
20
23
|
__exportStar(require("./components/trees"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tree-widget-react.js","sourceRoot":"","sources":["../../src/tree-widget-react.ts"],"names":[],"mappings":";AAAA;;;+FAG+F
|
|
1
|
+
{"version":3,"file":"tree-widget-react.js","sourceRoot":"","sources":["../../src/tree-widget-react.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;;;;;;;;;;;;;;AAE/F,+CAA6B;AAC7B,mEAAiD;AACjD,qDAAmC;AACnC,yEAAuD","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\nexport * from \"./TreeWidget\";\nexport * from \"./components/TreeWidgetComponent\";\nexport * from \"./components/trees\";\nexport * from \"./components/TreeWidgetUiItemsProvider\";\n"]}
|
package/lib/esm/TreeWidget.d.ts
CHANGED
|
@@ -22,6 +22,5 @@ export declare class TreeWidget {
|
|
|
22
22
|
/** Calls i18n.translateWithNamespace with the "TreeWidget" namespace. Do NOT include the namespace in the key.
|
|
23
23
|
*/
|
|
24
24
|
static translate(key: string | string[], options?: LocalizationOptions): string;
|
|
25
|
-
static loggerCategory(obj: any): string;
|
|
26
25
|
}
|
|
27
26
|
//# sourceMappingURL=TreeWidget.d.ts.map
|
package/lib/esm/TreeWidget.js
CHANGED
|
@@ -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 {
|
|
5
|
+
import { UiError } from "@itwin/appui-abstract";
|
|
6
6
|
import { IModelApp } from "@itwin/core-frontend";
|
|
7
7
|
/**
|
|
8
8
|
* Entry point for static initialization required by various components used in the package.
|
|
@@ -30,7 +30,7 @@ export class TreeWidget {
|
|
|
30
30
|
/** The internationalization service created by the IModelApp. */
|
|
31
31
|
static get i18n() {
|
|
32
32
|
if (!TreeWidget._i18n)
|
|
33
|
-
throw new UiError(TreeWidget.
|
|
33
|
+
throw new UiError(TreeWidget.packageName, "TreeWidget not initialized");
|
|
34
34
|
return TreeWidget._i18n;
|
|
35
35
|
}
|
|
36
36
|
/** The internationalization service namespace. */
|
|
@@ -46,10 +46,5 @@ export class TreeWidget {
|
|
|
46
46
|
const stringKey = `${TreeWidget.i18nNamespace}:${key}`;
|
|
47
47
|
return TreeWidget.i18n.getLocalizedString(stringKey, options);
|
|
48
48
|
}
|
|
49
|
-
static loggerCategory(obj) {
|
|
50
|
-
const className = getClassName(obj);
|
|
51
|
-
const category = TreeWidget.packageName + (className ? `.${className}` : "");
|
|
52
|
-
return category;
|
|
53
|
-
}
|
|
54
49
|
}
|
|
55
50
|
//# sourceMappingURL=TreeWidget.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeWidget.js","sourceRoot":"","sources":["../../src/TreeWidget.ts"],"names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AsB,EACtB,OAA6B;QAE7B,MAAM,SAAS,GAAG,GAAG,UAAU,CAAC,aAAa,IAAI,GAAG,EAAE,CAAC;QACvD,OAAO,UAAU,CAAC,IAAI,CAAC,kBAAkB,CACvC,SAAS,EACT,OAAO,CACR,CAAC;IACJ,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\nimport { UiError } from \"@itwin/appui-abstract\";\nimport { IModelApp } from \"@itwin/core-frontend\";\n\nimport type { Localization } from \"@itwin/core-common\";\nimport type { LocalizationOptions } from \"@itwin/core-i18n\";\n\n/**\n * Entry point for static initialization required by various components used in the package.\n * @public\n */\nexport class TreeWidget {\n private static _i18n?: Localization;\n private 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) return;\n\n TreeWidget._initialized = true;\n TreeWidget._i18n = i18n ?? IModelApp.localization;\n\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); // eslint-disable-line @itwin/no-internal\n TreeWidget._i18n = undefined;\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 UiError(\n TreeWidget.packageName,\n \"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 public static get packageName(): string {\n return \"tree-widget-react\";\n }\n\n /** Calls i18n.translateWithNamespace with the \"TreeWidget\" namespace. Do NOT include the namespace in the key.\n */\n public static translate(\n key: string | string[],\n options?: LocalizationOptions\n ): string {\n const stringKey = `${TreeWidget.i18nNamespace}:${key}`;\n return TreeWidget.i18n.getLocalizedString(\n stringKey,\n options\n );\n }\n}\n"]}
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import type { IPresentationTreeDataProvider } from "@itwin/presentation-components";
|
|
2
|
+
/** @internal */
|
|
2
3
|
export interface SearchOptions {
|
|
3
4
|
isFiltering: boolean;
|
|
4
5
|
onFilterCancel: () => void;
|
|
5
6
|
onFilterStart: (newFilter: string) => void;
|
|
6
7
|
onResultSelectedChanged: (index: number) => void;
|
|
7
8
|
matchedResultCount: number | undefined;
|
|
9
|
+
activeMatchIndex: number | undefined;
|
|
8
10
|
}
|
|
11
|
+
/** @internal */
|
|
9
12
|
export declare const useTreeFilteringState: () => {
|
|
10
13
|
searchOptions: SearchOptions;
|
|
11
14
|
filterString: string;
|
|
12
|
-
activeMatchIndex: number | undefined;
|
|
13
15
|
onFilterApplied: (provider: IPresentationTreeDataProvider, matches: number) => void;
|
|
14
16
|
filteredProvider: IPresentationTreeDataProvider | undefined;
|
|
15
17
|
};
|
|
@@ -2,28 +2,26 @@
|
|
|
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
|
|
5
|
+
import { useCallback, useState } from "react";
|
|
6
|
+
/** @internal */
|
|
6
7
|
export const useTreeFilteringState = () => {
|
|
7
|
-
const [filterString,
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
const [filteredProvider, setFilteredProvider] = useState();
|
|
11
|
-
const onFilterCancel = React.useCallback(() => {
|
|
12
|
-
setFilterString("");
|
|
13
|
-
setMatchedResultCount(undefined);
|
|
14
|
-
setFilteredProvider(undefined);
|
|
8
|
+
const [{ filterString, matchedResultCount, activeMatchIndex, filteredProvider }, setState] = useState({ filterString: "" });
|
|
9
|
+
const onFilterCancel = useCallback(() => {
|
|
10
|
+
setState({ filterString: "" });
|
|
15
11
|
}, []);
|
|
16
|
-
const onFilterStart =
|
|
17
|
-
|
|
18
|
-
setMatchedResultCount(undefined);
|
|
19
|
-
setFilteredProvider(undefined);
|
|
12
|
+
const onFilterStart = useCallback((newFilter) => {
|
|
13
|
+
setState({ filterString: newFilter });
|
|
20
14
|
}, []);
|
|
21
|
-
const onResultSelectedChanged =
|
|
22
|
-
|
|
15
|
+
const onResultSelectedChanged = useCallback((index) => {
|
|
16
|
+
setState((prev) => ({ ...prev, activeMatchIndex: index }));
|
|
23
17
|
}, []);
|
|
24
|
-
const onFilterApplied =
|
|
25
|
-
|
|
26
|
-
|
|
18
|
+
const onFilterApplied = useCallback((provider, matches) => {
|
|
19
|
+
setState((prev) => ({
|
|
20
|
+
...prev,
|
|
21
|
+
activeMatchIndex: prev.activeMatchIndex === undefined ? 1 : Math.min(prev.activeMatchIndex, matches),
|
|
22
|
+
matchedResultCount: matches,
|
|
23
|
+
filteredProvider: provider,
|
|
24
|
+
}));
|
|
27
25
|
}, []);
|
|
28
26
|
const isFiltering = !!filterString && matchedResultCount === undefined;
|
|
29
27
|
const searchOptions = {
|
|
@@ -32,11 +30,11 @@ export const useTreeFilteringState = () => {
|
|
|
32
30
|
onFilterStart,
|
|
33
31
|
onResultSelectedChanged,
|
|
34
32
|
matchedResultCount,
|
|
33
|
+
activeMatchIndex,
|
|
35
34
|
};
|
|
36
35
|
return {
|
|
37
36
|
searchOptions,
|
|
38
37
|
filterString,
|
|
39
|
-
activeMatchIndex,
|
|
40
38
|
onFilterApplied,
|
|
41
39
|
filteredProvider,
|
|
42
40
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeFilteringState.js","sourceRoot":"","sources":["../../../src/components/TreeFilteringState.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;
|
|
1
|
+
{"version":3,"file":"TreeFilteringState.js","sourceRoot":"","sources":["../../../src/components/TreeFilteringState.ts"],"names":[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;IACN,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,WAAW,GAAG,CAAC,CAAC,YAAY,IAAI,kBAAkB,KAAK,SAAS,CAAC;IACvE,MAAM,aAAa,GAAkB;QACnC,WAAW;QACX,cAAc;QACd,aAAa;QACb,uBAAuB;QACvB,kBAAkB;QAClB,gBAAgB;KACjB,CAAC;IAEF,OAAO;QACL,aAAa;QACb,YAAY;QACZ,eAAe;QACf,gBAAgB;KACjB,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\nimport { useCallback, useState } from \"react\";\n\nimport type { IPresentationTreeDataProvider } from \"@itwin/presentation-components\";\n\n/** @internal */\nexport interface SearchOptions {\n isFiltering: boolean;\n onFilterCancel: () => void;\n onFilterStart: (newFilter: string) => void;\n onResultSelectedChanged: (index: number) => void;\n matchedResultCount: number | undefined;\n activeMatchIndex: number | undefined;\n}\n\ninterface TreeFilteringState {\n filterString: string;\n matchedResultCount?: number;\n activeMatchIndex?: number;\n filteredProvider?: IPresentationTreeDataProvider;\n}\n\n/** @internal */\nexport const useTreeFilteringState = () => {\n const [{ filterString, matchedResultCount, activeMatchIndex, filteredProvider }, setState] = useState<TreeFilteringState>({ filterString: \"\" });\n\n const onFilterCancel = useCallback(() => {\n setState({ filterString: \"\" });\n }, []);\n\n const onFilterStart = useCallback((newFilter: string) => {\n setState({ filterString: newFilter });\n }, []);\n\n const onResultSelectedChanged = useCallback((index: number) => {\n setState((prev) => ({ ...prev, activeMatchIndex: index }));\n }, []);\n\n const onFilterApplied = useCallback((provider: IPresentationTreeDataProvider, matches: number) => {\n setState((prev) => ({\n ...prev,\n activeMatchIndex: prev.activeMatchIndex === undefined ? 1 : Math.min(prev.activeMatchIndex, matches),\n matchedResultCount: matches,\n filteredProvider: provider,\n }));\n }, []);\n\n const isFiltering = !!filterString && matchedResultCount === undefined;\n const searchOptions: SearchOptions = {\n isFiltering,\n onFilterCancel,\n onFilterStart,\n onResultSelectedChanged,\n matchedResultCount,\n activeMatchIndex,\n };\n\n return {\n searchOptions,\n filterString,\n onFilterApplied,\n filteredProvider,\n };\n};\n"]}
|
|
@@ -1,9 +1,33 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import "./TreeWidgetComponent.scss";
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
import type { IModelConnection } from "@itwin/core-frontend";
|
|
4
|
+
/**
|
|
5
|
+
* Definition of a tree component displayed in [[TreeWidgetComponent]]
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
export interface TreeDefinition {
|
|
9
|
+
/** Id of the tree */
|
|
10
|
+
id: string;
|
|
11
|
+
/** Callback that is used to get tree label */
|
|
12
|
+
getLabel: () => string;
|
|
13
|
+
/** Callback that is used to render tree component */
|
|
14
|
+
render: () => React.ReactNode;
|
|
15
|
+
/**
|
|
16
|
+
* Callback that is used to determine if tree should be shown for current active iModel connection.
|
|
17
|
+
* If callback is `undefined` tree is shown for all iModel connections.
|
|
18
|
+
*/
|
|
19
|
+
shouldShow?: (imodel: IModelConnection) => Promise<boolean>;
|
|
6
20
|
}
|
|
7
|
-
|
|
8
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Props for [[TreeWidgetComponent]]
|
|
23
|
+
* @public
|
|
24
|
+
*/
|
|
25
|
+
export interface TreeWidgetComponentProps {
|
|
26
|
+
trees: TreeDefinition[];
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* A component that renders a tree (combo box) selector and the selected tree component.
|
|
30
|
+
* @public
|
|
31
|
+
*/
|
|
32
|
+
export declare function TreeWidgetComponent(props: TreeWidgetComponentProps): JSX.Element | null;
|
|
9
33
|
//# sourceMappingURL=TreeWidgetComponent.d.ts.map
|
|
@@ -1,18 +1,93 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
1
2
|
/*---------------------------------------------------------------------------------------------
|
|
2
3
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
4
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
5
|
*--------------------------------------------------------------------------------------------*/
|
|
5
6
|
import "./TreeWidgetComponent.scss";
|
|
6
|
-
import
|
|
7
|
+
import { useEffect, useState } from "react";
|
|
8
|
+
import { useActiveIModelConnection } from "@itwin/appui-react";
|
|
7
9
|
import { SelectableContent } from "@itwin/components-react";
|
|
10
|
+
import { FillCentered } from "@itwin/core-react";
|
|
11
|
+
import { ProgressLinear } from "@itwin/itwinui-react";
|
|
12
|
+
import { TreeWidget } from "../TreeWidget";
|
|
13
|
+
/**
|
|
14
|
+
* A component that renders a tree (combo box) selector and the selected tree component.
|
|
15
|
+
* @public
|
|
16
|
+
*/
|
|
8
17
|
export function TreeWidgetComponent(props) {
|
|
9
|
-
const
|
|
10
|
-
if (
|
|
11
|
-
|
|
12
|
-
|
|
18
|
+
const imodel = useActiveIModelConnection();
|
|
19
|
+
if (!imodel)
|
|
20
|
+
return null;
|
|
21
|
+
return _jsx(TreeWidgetComponentContent, { ...props, imodel: imodel });
|
|
22
|
+
}
|
|
23
|
+
function TreeWidgetComponentContent(props) {
|
|
24
|
+
const { trees: treeDefinitions, imodel } = props;
|
|
25
|
+
const trees = useActiveTrees(treeDefinitions, imodel);
|
|
26
|
+
return (_jsx("div", { className: "tree-widget-visibility-widget", children: _jsx(SelectableContent, { ...getSelectableContentProps(trees) }) }));
|
|
27
|
+
}
|
|
28
|
+
function useActiveTrees(treeDefinitions, imodel) {
|
|
29
|
+
const [trees, setTrees] = useState();
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
let disposed = false;
|
|
32
|
+
(async () => {
|
|
33
|
+
const visibleTrees = await getActiveTrees(treeDefinitions, imodel);
|
|
34
|
+
// istanbul ignore else
|
|
35
|
+
if (!disposed) {
|
|
36
|
+
setTrees(visibleTrees);
|
|
37
|
+
}
|
|
38
|
+
})();
|
|
39
|
+
return () => { disposed = true; };
|
|
40
|
+
}, [treeDefinitions, imodel]);
|
|
41
|
+
return trees;
|
|
42
|
+
}
|
|
43
|
+
async function getActiveTrees(treeDefinitions, imodel) {
|
|
44
|
+
const handleDefinition = async (treeDef) => {
|
|
45
|
+
if (treeDef.shouldShow !== undefined && !(await treeDef.shouldShow(imodel))) {
|
|
46
|
+
return undefined;
|
|
13
47
|
}
|
|
48
|
+
return {
|
|
49
|
+
id: treeDef.id,
|
|
50
|
+
label: treeDef.getLabel(),
|
|
51
|
+
render: treeDef.render,
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
return (await Promise.all(treeDefinitions.map(handleDefinition))).filter((tree) => tree !== undefined);
|
|
55
|
+
}
|
|
56
|
+
function getSelectableContentProps(trees) {
|
|
57
|
+
if (trees === undefined) {
|
|
58
|
+
return {
|
|
59
|
+
defaultSelectedContentId: "loading",
|
|
60
|
+
children: [{
|
|
61
|
+
id: "loading",
|
|
62
|
+
label: "",
|
|
63
|
+
render: () => (_jsx(Delayed, { children: _jsx(ProgressLinear, { indeterminate: true }) })),
|
|
64
|
+
}],
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
if (trees.length === 0) {
|
|
68
|
+
return {
|
|
69
|
+
defaultSelectedContentId: "no-trees",
|
|
70
|
+
children: [{
|
|
71
|
+
id: "no-trees",
|
|
72
|
+
label: "",
|
|
73
|
+
render: () => (_jsx(FillCentered, { children: TreeWidget.translate("noTrees") })),
|
|
74
|
+
}],
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
return {
|
|
78
|
+
defaultSelectedContentId: trees[0].id,
|
|
79
|
+
children: trees,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
function Delayed({ delay = 200, children }) {
|
|
83
|
+
const [show, setShow] = useState(false);
|
|
84
|
+
useEffect(() => {
|
|
85
|
+
const id = setTimeout(() => { setShow(true); }, delay);
|
|
86
|
+
return () => { clearTimeout(id); };
|
|
87
|
+
}, [delay]);
|
|
88
|
+
if (!show) {
|
|
89
|
+
return null;
|
|
14
90
|
}
|
|
15
|
-
return (
|
|
16
|
-
React.createElement(SelectableContent, { children: trees, defaultSelectedContentId: trees[0].id })));
|
|
91
|
+
return _jsx(_Fragment, { children: children });
|
|
17
92
|
}
|
|
18
93
|
//# sourceMappingURL=TreeWidgetComponent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeWidgetComponent.js","sourceRoot":"","sources":["../../../src/components/TreeWidgetComponent.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,OAAO,4BAA4B,CAAC;AACpC,OAAO,
|
|
1
|
+
{"version":3,"file":"TreeWidgetComponent.js","sourceRoot":"","sources":["../../../src/components/TreeWidgetComponent.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAE/F,OAAO,4BAA4B,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAgC3C;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAA+B;IACjE,MAAM,MAAM,GAAG,yBAAyB,EAAE,CAAC;IAE3C,IAAI,CAAC,MAAM;QACT,OAAO,IAAI,CAAC;IAEd,OAAO,KAAC,0BAA0B,OAAK,KAAK,EAAE,MAAM,EAAE,MAAM,GAAI,CAAC;AACnE,CAAC;AAED,SAAS,0BAA0B,CAAC,KAA6D;IAC/F,MAAM,EAAE,KAAK,EAAE,eAAe,EAAE,MAAM,EAAE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,CAAC,CAAC,CAAC,CAAC;IACrC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAEZ,IAAI,CAAC,IAAI,EAAE;QACT,OAAO,IAAI,CAAC;KACb;IAED,OAAO,4BAAG,QAAQ,GAAI,CAAC;AACzB,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 \"./TreeWidgetComponent.scss\";\nimport { useEffect, useState } from \"react\";\nimport { useActiveIModelConnection } from \"@itwin/appui-react\";\nimport { SelectableContent } from \"@itwin/components-react\";\nimport { FillCentered } from \"@itwin/core-react\";\nimport { ProgressLinear } from \"@itwin/itwinui-react\";\nimport { TreeWidget } from \"../TreeWidget\";\n\nimport type { PropsWithChildren } from \"react\";\nimport type { SelectableContentDefinition, SelectableContentProps } from \"@itwin/components-react\";\nimport type { IModelConnection } from \"@itwin/core-frontend\";\n\n/**\n * Definition of a tree component displayed in [[TreeWidgetComponent]]\n * @public\n */\nexport interface TreeDefinition {\n /** Id of the tree */\n id: string;\n /** Callback that is used to get tree label */\n getLabel: () => string;\n /** Callback that is used to render tree component */\n render: () => React.ReactNode;\n /**\n * Callback that is used to determine if tree should be shown for current active iModel connection.\n * If callback is `undefined` tree is shown for all iModel connections.\n */\n shouldShow?: (imodel: IModelConnection) => Promise<boolean>;\n}\n\n/**\n * Props for [[TreeWidgetComponent]]\n * @public\n */\nexport interface TreeWidgetComponentProps {\n trees: TreeDefinition[];\n}\n\n/**\n * A component that renders a tree (combo box) selector and the selected tree component.\n * @public\n */\nexport function TreeWidgetComponent(props: TreeWidgetComponentProps) {\n const imodel = useActiveIModelConnection();\n\n if (!imodel)\n return null;\n\n return <TreeWidgetComponentContent {...props} imodel={imodel} />;\n}\n\nfunction TreeWidgetComponentContent(props: TreeWidgetComponentProps & { imodel: IModelConnection}) {\n const { trees: treeDefinitions, imodel } = props;\n const trees = useActiveTrees(treeDefinitions, imodel);\n\n return (\n <div className=\"tree-widget-visibility-widget\">\n <SelectableContent {...getSelectableContentProps(trees)} />\n </div>\n );\n}\n\nfunction useActiveTrees(treeDefinitions: TreeDefinition[], imodel: IModelConnection) {\n const [trees, setTrees] = useState<SelectableContentDefinition[]>();\n\n useEffect(() => {\n let disposed = false;\n (async () => {\n const visibleTrees = await getActiveTrees(treeDefinitions, imodel);\n // istanbul ignore else\n if (!disposed) {\n setTrees(visibleTrees);\n }\n })();\n\n return () => { disposed = true; };\n }, [treeDefinitions, imodel]);\n\n return trees;\n}\n\nasync function getActiveTrees(treeDefinitions: TreeDefinition[], imodel: IModelConnection): Promise<SelectableContentDefinition[]> {\n const handleDefinition = async (treeDef: TreeDefinition) => {\n if (treeDef.shouldShow !== undefined && !(await treeDef.shouldShow(imodel))) {\n return undefined;\n }\n return {\n id: treeDef.id,\n label: treeDef.getLabel(),\n render: treeDef.render,\n };\n };\n\n return (await Promise.all(treeDefinitions.map(handleDefinition))).filter((tree) => tree !== undefined) as SelectableContentDefinition[];\n}\n\nfunction getSelectableContentProps(trees?: SelectableContentDefinition[]): SelectableContentProps {\n if (trees === undefined) {\n return {\n defaultSelectedContentId: \"loading\",\n children: [{\n id: \"loading\",\n label: \"\",\n render: () => (\n <Delayed>\n <ProgressLinear indeterminate={true} />\n </Delayed>\n ),\n }],\n };\n }\n\n if (trees.length === 0) {\n return {\n defaultSelectedContentId: \"no-trees\",\n children: [{\n id: \"no-trees\",\n label: \"\",\n render: () => (\n <FillCentered>\n {TreeWidget.translate(\"noTrees\")}\n </FillCentered>\n ),\n }],\n };\n }\n\n return {\n defaultSelectedContentId: trees[0].id,\n children: trees,\n };\n}\n\nfunction Delayed({ delay = 200, children }: PropsWithChildren<{ delay?: number }>) {\n const [show, setShow] = useState(false);\n\n useEffect(() => {\n const id = setTimeout(() => { setShow(true); }, delay);\n return () => { clearTimeout(id); };\n }, [delay]);\n\n if (!show) {\n return null;\n }\n\n return <>{children}</>;\n}\n"]}
|