@itwin/appui-react 3.4.0-dev.3 → 3.4.0-dev.33

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 (37) hide show
  1. package/CHANGELOG.md +48 -1
  2. package/lib/cjs/appui-react/content/FloatingViewportContent.d.ts.map +1 -1
  3. package/lib/cjs/appui-react/content/FloatingViewportContent.js +5 -5
  4. package/lib/cjs/appui-react/content/FloatingViewportContent.js.map +1 -1
  5. package/lib/cjs/appui-react/imodel-components/models-tree/ModelsTree.d.ts +1 -1
  6. package/lib/cjs/appui-react/imodel-components/models-tree/ModelsTree.d.ts.map +1 -1
  7. package/lib/cjs/appui-react/imodel-components/models-tree/ModelsTree.js +11 -8
  8. package/lib/cjs/appui-react/imodel-components/models-tree/ModelsTree.js.map +1 -1
  9. package/lib/cjs/appui-react/imodel-components/models-tree/ModelsVisibilityHandler.d.ts +15 -1
  10. package/lib/cjs/appui-react/imodel-components/models-tree/ModelsVisibilityHandler.d.ts.map +1 -1
  11. package/lib/cjs/appui-react/imodel-components/models-tree/ModelsVisibilityHandler.js +5 -2
  12. package/lib/cjs/appui-react/imodel-components/models-tree/ModelsVisibilityHandler.js.map +1 -1
  13. package/lib/cjs/appui-react/tools/CoreToolDefinitions.d.ts.map +1 -1
  14. package/lib/cjs/appui-react/tools/CoreToolDefinitions.js +14 -4
  15. package/lib/cjs/appui-react/tools/CoreToolDefinitions.js.map +1 -1
  16. package/lib/cjs/appui-react/widget-panels/Frontstage.d.ts.map +1 -1
  17. package/lib/cjs/appui-react/widget-panels/Frontstage.js +9 -1
  18. package/lib/cjs/appui-react/widget-panels/Frontstage.js.map +1 -1
  19. package/lib/esm/appui-react/content/FloatingViewportContent.d.ts.map +1 -1
  20. package/lib/esm/appui-react/content/FloatingViewportContent.js +5 -5
  21. package/lib/esm/appui-react/content/FloatingViewportContent.js.map +1 -1
  22. package/lib/esm/appui-react/imodel-components/models-tree/ModelsTree.d.ts +1 -1
  23. package/lib/esm/appui-react/imodel-components/models-tree/ModelsTree.d.ts.map +1 -1
  24. package/lib/esm/appui-react/imodel-components/models-tree/ModelsTree.js +12 -9
  25. package/lib/esm/appui-react/imodel-components/models-tree/ModelsTree.js.map +1 -1
  26. package/lib/esm/appui-react/imodel-components/models-tree/ModelsVisibilityHandler.d.ts +15 -1
  27. package/lib/esm/appui-react/imodel-components/models-tree/ModelsVisibilityHandler.d.ts.map +1 -1
  28. package/lib/esm/appui-react/imodel-components/models-tree/ModelsVisibilityHandler.js +4 -2
  29. package/lib/esm/appui-react/imodel-components/models-tree/ModelsVisibilityHandler.js.map +1 -1
  30. package/lib/esm/appui-react/tools/CoreToolDefinitions.d.ts.map +1 -1
  31. package/lib/esm/appui-react/tools/CoreToolDefinitions.js +15 -5
  32. package/lib/esm/appui-react/tools/CoreToolDefinitions.js.map +1 -1
  33. package/lib/esm/appui-react/widget-panels/Frontstage.d.ts.map +1 -1
  34. package/lib/esm/appui-react/widget-panels/Frontstage.js +9 -1
  35. package/lib/esm/appui-react/widget-panels/Frontstage.js.map +1 -1
  36. package/lib/public/locales/en/UiFramework.json +3 -1
  37. package/package.json +34 -33
package/CHANGELOG.md CHANGED
@@ -1,6 +1,53 @@
1
1
  # Change Log - @itwin/appui-react
2
2
 
3
- This log was last generated on Mon, 01 Aug 2022 13:36:56 GMT and should not be manually modified.
3
+ This log was last generated on Thu, 01 Sep 2022 14:37:22 GMT and should not be manually modified.
4
+
5
+ ## 3.3.2
6
+ Thu, 01 Sep 2022 14:37:22 GMT
7
+
8
+ ### Updates
9
+
10
+ - Update camera icon and make camera tooltip conditional on the camera's on/off state.
11
+
12
+ ## 3.3.1
13
+ Fri, 26 Aug 2022 15:40:02 GMT
14
+
15
+ _Version update only_
16
+
17
+ ## 3.3.0
18
+ Thu, 18 Aug 2022 19:08:01 GMT
19
+
20
+ ### Updates
21
+
22
+ - remove alpha tag from AutoCollapseUnpinnedPanels
23
+ - upgrade mocha to version 10.0.0
24
+ - Set `hideWithUiWhenFloating` flag of a widget when restoring a layout.
25
+ - Fix an issue where a widget is added to the layout multiple times.
26
+ - [ModelsTree]: Make sure all child elements visibility is changed
27
+ - Deprecated `isInFooterMode` in `StatusFieldProps`, should always be considered true. Deprecated `withStatusFieldProps` which provides only deprecated props to components.
28
+ - Deprecated `isInFooterMode` in `FrontstageProps` and `ContentLayoutComponentProps`, should alays be considered true.
29
+ - Deprecated `withMessageCenterFieldProps`, components should directly use `MessageManager.registerAnimateOutToElement`.
30
+ - Deprecate `openWidget` and `onOpenWidget` props from `StatusBarFields` interface.
31
+ - Add option to display active tool name as the Tool Settings tab label.
32
+ - Export useTransientState hook.
33
+ - Do not require list of static backstage items to be specified with BackstageComposer. Allow StandardFrontstageProvider to hideToolSetting in modal stages.
34
+ - Avoid slow keyin browser filtering when processing long keyins.
35
+ - Change to only log the inability to find a content view when the content is required.
36
+ - Models Tree: Optimize creating subjects hierarchy
37
+ - Add hideWithUiWhenFloating prop to widgets so that an app can opt into hiding specific floating widgets when the UI automatically hides.
38
+ - Save state of floating widgets when they are hidden
39
+ - Use toaster from iTwinUI to display messages
40
+ - Update iTwinUI-react to 1.38.1
41
+
42
+ ## 3.2.9
43
+ Fri, 26 Aug 2022 14:21:40 GMT
44
+
45
+ _Version update only_
46
+
47
+ ## 3.2.8
48
+ Tue, 09 Aug 2022 15:52:41 GMT
49
+
50
+ _Version update only_
4
51
 
5
52
  ## 3.2.7
6
53
  Mon, 01 Aug 2022 13:36:56 GMT
@@ -1 +1 @@
1
- {"version":3,"file":"FloatingViewportContent.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/content/FloatingViewportContent.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,+BAA+B,CAAC;AACvC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAA6B,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAW5E;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C,wFAAwF;IACxF,aAAa,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,KAAK,OAAO,CAAC;IACjD,wCAAwC;IACxC,SAAS,EAAE,MAAM,CAAC;IAClB,yDAAyD;IACzD,gBAAgB,EAAE,SAAS,CAAC;CAC7B;AAED;;;;;GAKG;AAEH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,4BAA4B,eA0D1E"}
1
+ {"version":3,"file":"FloatingViewportContent.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/content/FloatingViewportContent.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,+BAA+B,CAAC;AACvC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAA6B,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAW5E;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C,wFAAwF;IACxF,aAAa,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,KAAK,OAAO,CAAC;IACjD,wCAAwC;IACxC,SAAS,EAAE,MAAM,CAAC;IAClB,yDAAyD;IACzD,gBAAgB,EAAE,SAAS,CAAC;CAC7B;AAED;;;;;GAKG;AAEH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,4BAA4B,eA2D1E"}
@@ -43,16 +43,16 @@ function FloatingViewportContent(props) {
43
43
  }
44
44
  };
45
45
  }, [contentId]);
46
- const viewPortControl = React.useMemo(() => initialViewState ? (React.createElement(FloatingViewport, { viewportRef: onViewportRef, imodel: initialViewState.iModel, viewState: initialViewState, onContextMenu: props.onContextMenu })) : undefined, [onViewportRef, props.onContextMenu, initialViewState]);
46
+ const viewPortControl = React.useMemo(() => initialViewState ? (React.createElement(FloatingViewport, { viewportRef: onViewportRef, imodel: initialViewState.iModel, viewState: initialViewState, onContextMenu: props.onContextMenu, controlId: contentId })) : undefined, [onViewportRef, props.onContextMenu, initialViewState, contentId]);
47
47
  React.useEffect(() => {
48
48
  if (viewport && contentControl.current) {
49
49
  contentControl.current.viewport = viewport;
50
50
  if (null === contentControl.current.reactNode) {
51
51
  contentControl.current.reactNode = viewPortControl;
52
- if (initialViewState) {
53
- // eslint-disable-next-line @typescript-eslint/no-floating-promises
54
- contentControl.current.processViewSelectorChange(initialViewState.iModel, initialViewState.id, initialViewState, initialViewState.name);
55
- }
52
+ }
53
+ if (initialViewState) {
54
+ // eslint-disable-next-line @typescript-eslint/no-floating-promises
55
+ contentControl.current.processViewSelectorChange(initialViewState.iModel, initialViewState.id, initialViewState, initialViewState.name);
56
56
  }
57
57
  }
58
58
  }, [initialViewState, viewPortControl, viewport]);
@@ -1 +1 @@
1
- {"version":3,"file":"FloatingViewportContent.js","sourceRoot":"","sources":["../../../../src/appui-react/content/FloatingViewportContent.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,yCAAuC;AACvC,+BAA+B;AAC/B,wDAA4E;AAC5E,4EAA0E;AAC1E,4EAAmE;AACnE,qEAA0E;AAC1E,6DAA0D;AAC1D,kEAA+D;AAC/D,mDAAiD;AAEjD,gEAAgE;AAChE,MAAM,gBAAgB,GAAG,IAAA,kDAAwB,EAAC,2CAAiB,CAAC,CAAC;AAcrE;;;;;GAKG;AACH,uBAAuB;AACvB,SAAgB,uBAAuB,CAAC,KAAmC;IACzE,MAAM,EAAE,SAAS,EAAE,gBAAgB,EAAE,GAAG,KAAK,CAAC;IAC9C,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,KAAK,CAAC,QAAQ,EAA8B,CAAC;IAC7E,MAAM,cAAc,GAAG,KAAK,CAAC,MAAM,EAA8C,CAAC;IAElF,MAAM,aAAa,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,CAAiB,EAAE,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAEnF,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE;YAC3B,cAAc,CAAC,OAA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AAgB,EAAE,eAAe,EAAE,QAAQ,CAAC,CAAC,CAAC;IAElD,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,MAAM,WAAW,GAAG,CAAC,EAAkB,EAAE,EAAE;;YACzC,IAAI,CAAA,MAAA,cAAc,CAAC,OAAO,0CAAE,QAAQ,MAAK,EAAE,EAAE;gBAC3C,uCAAkB,CAAC,0BAA0B,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;gBACtE,cAAc,CAAC,OAAO,GAAG,SAAS,CAAC;aACpC;QACH,CAAC,CAAC;QACF,OAAO,yBAAS,CAAC,WAAW,CAAC,WAAW,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;IACpE,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,CACL,6BAAK,WAAW,EAAE,qCAAiB,CAAC,sBAAsB,EAAE,SAAS,EAAC,4BAA4B,EAAC,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE;QAChJ,oBAAC,8BAAc,IAAC,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAI,CACzF,CACP,CAAC;AACJ,CAAC;AA1DD,0DA0DC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module ContentView\r\n */\r\n\r\nimport \"./FloatingViewportContent.css\";\r\nimport * as React from \"react\";\r\nimport { IModelApp, ScreenViewport, ViewState } from \"@itwin/core-frontend\";\r\nimport { viewWithUnifiedSelection } from \"@itwin/presentation-components\";\r\nimport { ViewportComponent } from \"@itwin/imodel-components-react\";\r\nimport { FloatingViewportContentControl } from \"./ViewportContentControl\";\r\nimport { ContentViewManager } from \"./ContentViewManager\";\r\nimport { UiShowHideManager } from \"../utils/UiShowHideManager\";\r\nimport { ContentWrapper } from \"./ContentLayout\";\r\n\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nconst FloatingViewport = viewWithUnifiedSelection(ViewportComponent);\r\n\r\n/**\r\n * @beta\r\n */\r\nexport interface FloatingViewportContentProps {\r\n /** callback used to construct context menu when user right-clicks on canvas/viewport */\r\n onContextMenu?: (e: React.MouseEvent) => boolean;\r\n /** viewport/content control uniqueId */\r\n contentId: string;\r\n /** The initial view state used to create the viewport */\r\n initialViewState: ViewState;\r\n}\r\n\r\n/**\r\n * FloatingViewportContent component that creates its own [FloatingViewportContentControl].\r\n * This allows it to be recognized as an \"active\" content control so that tools operate on this\r\n * content.\r\n * @beta\r\n */\r\n// istanbul ignore next\r\nexport function FloatingViewportContent(props: FloatingViewportContentProps) { // eslint-disable-line @typescript-eslint/naming-convention\r\n const { contentId, initialViewState } = props;\r\n const [viewport, setViewport] = React.useState<ScreenViewport | undefined>();\r\n const contentControl = React.useRef<FloatingViewportContentControl | undefined>();\r\n\r\n const onViewportRef = React.useCallback((v: ScreenViewport) => setViewport(v), []);\r\n\r\n React.useEffect(() => {\r\n if (!contentControl.current) {\r\n contentControl.current = new FloatingViewportContentControl(contentId, contentId, null);\r\n ContentViewManager.addFloatingContentControl(contentControl.current);\r\n }\r\n return () => {\r\n if (contentControl.current) {\r\n ContentViewManager.dropFloatingContentControl(contentControl.current);\r\n contentControl.current = undefined;\r\n }\r\n };\r\n }, [contentId]);\r\n\r\n const viewPortControl = React.useMemo(() =>\r\n initialViewState ? (\r\n <FloatingViewport\r\n viewportRef={onViewportRef}\r\n imodel={initialViewState.iModel}\r\n viewState={initialViewState}\r\n onContextMenu={props.onContextMenu}\r\n />\r\n ) : undefined, [onViewportRef, props.onContextMenu, initialViewState]);\r\n\r\n React.useEffect(() => {\r\n if (viewport && contentControl.current) {\r\n contentControl.current.viewport = viewport;\r\n if (null === contentControl.current.reactNode) {\r\n contentControl.current.reactNode = viewPortControl;\r\n if (initialViewState) {\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n contentControl.current.processViewSelectorChange(initialViewState.iModel, initialViewState.id, initialViewState, initialViewState.name);\r\n }\r\n }\r\n }\r\n }, [initialViewState, viewPortControl, viewport]);\r\n\r\n React.useEffect(() => {\r\n const onViewClose = (vp: ScreenViewport) => {\r\n if (contentControl.current?.viewport === vp) {\r\n ContentViewManager.dropFloatingContentControl(contentControl.current);\r\n contentControl.current = undefined;\r\n }\r\n };\r\n return IModelApp.viewManager.onViewClose.addListener(onViewClose);\r\n }, []);\r\n\r\n return (\r\n <div onMouseMove={UiShowHideManager.handleContentMouseMove} className=\"uifw-dialog-imodel-content\" style={{ height: \"100%\", position: \"relative\" }}>\r\n <ContentWrapper content={viewPortControl} style={{ height: \"100%\", position: \"relative\" }} />\r\n </div>\r\n );\r\n}\r\n"]}
1
+ {"version":3,"file":"FloatingViewportContent.js","sourceRoot":"","sources":["../../../../src/appui-react/content/FloatingViewportContent.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,yCAAuC;AACvC,+BAA+B;AAC/B,wDAA4E;AAC5E,4EAA0E;AAC1E,4EAAmE;AACnE,qEAA0E;AAC1E,6DAA0D;AAC1D,kEAA+D;AAC/D,mDAAiD;AAEjD,gEAAgE;AAChE,MAAM,gBAAgB,GAAG,IAAA,kDAAwB,EAAC,2CAAiB,CAAC,CAAC;AAcrE;;;;;GAKG;AACH,uBAAuB;AACvB,SAAgB,uBAAuB,CAAC,KAAmC;IACzE,MAAM,EAAE,SAAS,EAAE,gBAAgB,EAAE,GAAG,KAAK,CAAC;IAC9C,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,KAAK,CAAC,QAAQ,EAA8B,CAAC;IAC7E,MAAM,cAAc,GAAG,KAAK,CAAC,MAAM,EAA8C,CAAC;IAElF,MAAM,aAAa,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,CAAiB,EAAE,EAAE,CA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pB,mEAAmE;gBACnE,cAAc,CAAC,OAAO,CAAC,yBAAyB,CAAC,gBAAgB,CAAC,MAAM,EAAE,gBAAgB,CAAC,EAAE,EAAE,gBAAgB,EAAE,gBAAgB,CAAC,IAAI,CAAC,CAAC;aACzI;SACF;IACH,CAAC,EAAE,CAAC,gBAAgB,EAAE,eAAe,EAAE,QAAQ,CAAC,CAAC,CAAC;IAElD,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,MAAM,WAAW,GAAG,CAAC,EAAkB,EAAE,EAAE;;YACzC,IAAI,CAAA,MAAA,cAAc,CAAC,OAAO,0CAAE,QAAQ,MAAK,EAAE,EAAE;gBAC3C,uCAAkB,CAAC,0BAA0B,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;gBACtE,cAAc,CAAC,OAAO,GAAG,SAAS,CAAC;aACpC;QACH,CAAC,CAAC;QACF,OAAO,yBAAS,CAAC,WAAW,CAAC,WAAW,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;IACpE,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,CACL,6BAAK,WAAW,EAAE,qCAAiB,CAAC,sBAAsB,EAAE,SAAS,EAAC,4BAA4B,EAAC,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE;QAChJ,oBAAC,8BAAc,IAAC,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAI,CACzF,CACP,CAAC;AACJ,CAAC;AA3DD,0DA2DC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module ContentView\r\n */\r\n\r\nimport \"./FloatingViewportContent.css\";\r\nimport * as React from \"react\";\r\nimport { IModelApp, ScreenViewport, ViewState } from \"@itwin/core-frontend\";\r\nimport { viewWithUnifiedSelection } from \"@itwin/presentation-components\";\r\nimport { ViewportComponent } from \"@itwin/imodel-components-react\";\r\nimport { FloatingViewportContentControl } from \"./ViewportContentControl\";\r\nimport { ContentViewManager } from \"./ContentViewManager\";\r\nimport { UiShowHideManager } from \"../utils/UiShowHideManager\";\r\nimport { ContentWrapper } from \"./ContentLayout\";\r\n\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nconst FloatingViewport = viewWithUnifiedSelection(ViewportComponent);\r\n\r\n/**\r\n * @beta\r\n */\r\nexport interface FloatingViewportContentProps {\r\n /** callback used to construct context menu when user right-clicks on canvas/viewport */\r\n onContextMenu?: (e: React.MouseEvent) => boolean;\r\n /** viewport/content control uniqueId */\r\n contentId: string;\r\n /** The initial view state used to create the viewport */\r\n initialViewState: ViewState;\r\n}\r\n\r\n/**\r\n * FloatingViewportContent component that creates its own [FloatingViewportContentControl].\r\n * This allows it to be recognized as an \"active\" content control so that tools operate on this\r\n * content.\r\n * @beta\r\n */\r\n// istanbul ignore next\r\nexport function FloatingViewportContent(props: FloatingViewportContentProps) { // eslint-disable-line @typescript-eslint/naming-convention\r\n const { contentId, initialViewState } = props;\r\n const [viewport, setViewport] = React.useState<ScreenViewport | undefined>();\r\n const contentControl = React.useRef<FloatingViewportContentControl | undefined>();\r\n\r\n const onViewportRef = React.useCallback((v: ScreenViewport) => setViewport(v), []);\r\n\r\n React.useEffect(() => {\r\n if (!contentControl.current) {\r\n contentControl.current = new FloatingViewportContentControl(contentId, contentId, null);\r\n ContentViewManager.addFloatingContentControl(contentControl.current);\r\n }\r\n return () => {\r\n if (contentControl.current) {\r\n ContentViewManager.dropFloatingContentControl(contentControl.current);\r\n contentControl.current = undefined;\r\n }\r\n };\r\n }, [contentId]);\r\n\r\n const viewPortControl = React.useMemo(() =>\r\n initialViewState ? (\r\n <FloatingViewport\r\n viewportRef={onViewportRef}\r\n imodel={initialViewState.iModel}\r\n viewState={initialViewState}\r\n onContextMenu={props.onContextMenu}\r\n controlId={contentId}\r\n />\r\n ) : undefined, [onViewportRef, props.onContextMenu, initialViewState, contentId]);\r\n\r\n React.useEffect(() => {\r\n if (viewport && contentControl.current) {\r\n contentControl.current.viewport = viewport;\r\n if (null === contentControl.current.reactNode) {\r\n contentControl.current.reactNode = viewPortControl;\r\n }\r\n if (initialViewState) {\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n contentControl.current.processViewSelectorChange(initialViewState.iModel, initialViewState.id, initialViewState, initialViewState.name);\r\n }\r\n }\r\n }, [initialViewState, viewPortControl, viewport]);\r\n\r\n React.useEffect(() => {\r\n const onViewClose = (vp: ScreenViewport) => {\r\n if (contentControl.current?.viewport === vp) {\r\n ContentViewManager.dropFloatingContentControl(contentControl.current);\r\n contentControl.current = undefined;\r\n }\r\n };\r\n return IModelApp.viewManager.onViewClose.addListener(onViewClose);\r\n }, []);\r\n\r\n return (\r\n <div onMouseMove={UiShowHideManager.handleContentMouseMove} className=\"uifw-dialog-imodel-content\" style={{ height: \"100%\", position: \"relative\" }}>\r\n <ContentWrapper content={viewPortControl} style={{ height: \"100%\", position: \"relative\" }} />\r\n </div>\r\n );\r\n}\r\n"]}
@@ -3,11 +3,11 @@
3
3
  */
4
4
  import "./ModelsTree.scss";
5
5
  import * as React from "react";
6
+ import { SelectionMode } from "@itwin/components-react";
6
7
  import { Id64Array } from "@itwin/core-bentley";
7
8
  import { IModelConnection, Viewport } from "@itwin/core-frontend";
8
9
  import { Ruleset } from "@itwin/presentation-common";
9
10
  import { IPresentationTreeDataProvider } from "@itwin/presentation-components";
10
- import { SelectionMode } from "@itwin/components-react";
11
11
  import { ClassGroupingOption, VisibilityTreeFilterInfo } from "../Common";
12
12
  import { ModelsTreeSelectionPredicate, ModelsVisibilityHandler } from "./ModelsVisibilityHandler";
13
13
  /** @internal */
@@ -1 +1 @@
1
- {"version":3,"file":"ModelsTree.d.ts","sourceRoot":"","sources":["../../../../../src/appui-react/imodel-components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EAAE,MAAM,KAAK,IAAI,CAAC;IACtG;;;OAGG;IACH,2BAA2B,CAAC,EAAE,mBAAmB,CAAC;IAClD;;;OAGG;IACH,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC;;;OAGG;IACH,uBAAuB,CAAC,EAAE,uBAAuB,CAAC;CACnD;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,eAqDhD"}
1
+ {"version":3,"file":"ModelsTree.d.ts","sourceRoot":"","sources":["../../../../../src/appui-react/imodel-components/models-tree/ModelsTree.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,mBAAmB,CAAC;AAC3B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAkB,aAAa,EAA8B,MAAM,yBAAyB,CAAC;AACpG,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAElE,OAAO,EAAW,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAyC,6BAA6B,EAAiC,MAAM,gCAAgC,CAAC;AAGrJ,OAAO,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AAG1E,OAAO,EAAE,4BAA4B,EAAE,uBAAuB,EAAwB,MAAM,2BAA2B,CAAC;AAIxH,gBAAgB;AAChB,eAAO,MAAM,cAAc,EAAE,OAAqC,CAAC;AACnE,gBAAgB;AAChB,eAAO,MAAM,+BAA+B,EAAE,OAAoD,CAAC;AAInG;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,MAAM,EAAE,gBAAgB,CAAC;IACzB,6BAA6B;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,8BAA8B;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B;;;OAGG;IACH,kBAAkB,CAAC,EAAE,4BAA4B,CAAC;IAClD;;OAEG;IACH,UAAU,CAAC,EAAE,QAAQ,CAAC;IACtB;;OAEG;IACH,cAAc,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAC3C;;;OAGG;IACH,UAAU,CAAC,EAAE,wBAAwB,CAAC;IACtC;;;OAGG;IACH,kBAAkB,CAAC,EAAE,SAAS,CAAC;IAC/B;;OAEG;IACH,eAAe,CAAC,EAAE,CAAC,oBAAoB,EAAE,6BAA6B,EAAE,YAAY,EAAE,MAAM,KAAK,IAAI,CAAC;IACtG;;;OAGG;IACH,2BAA2B,CAAC,EAAE,mBAAmB,CAAC;IAClD;;;OAGG;IACH,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC;;;OAGG;IACH,uBAAuB,CAAC,EAAE,uBAAuB,CAAC;CACnD;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,eAsDhD"}
@@ -10,10 +10,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.ModelsTree = exports.RULESET_MODELS_GROUPED_BY_CLASS = exports.RULESET_MODELS = void 0;
11
11
  require("./ModelsTree.scss");
12
12
  const React = require("react");
13
- const presentation_components_1 = require("@itwin/presentation-components");
14
- const presentation_frontend_1 = require("@itwin/presentation-frontend");
15
13
  const components_react_1 = require("@itwin/components-react");
16
14
  const core_react_1 = require("@itwin/core-react");
15
+ const presentation_components_1 = require("@itwin/presentation-components");
16
+ const presentation_frontend_1 = require("@itwin/presentation-frontend");
17
17
  const UiFramework_1 = require("../../../appui-react/UiFramework");
18
18
  const Common_1 = require("../Common");
19
19
  const VisibilityTreeEventHandler_1 = require("../VisibilityTreeEventHandler");
@@ -39,7 +39,7 @@ function ModelsTree(props) {
39
39
  const nodeSelectionPredicate = React.useCallback((key, node) => {
40
40
  return !selectionPredicate ? true : selectionPredicate(key, ModelsVisibilityHandler_1.ModelsVisibilityHandler.getNodeType(node, nodeLoader.dataProvider));
41
41
  }, [selectionPredicate, nodeLoader.dataProvider]);
42
- const visibilityHandler = useVisibilityHandler(nodeLoader.dataProvider.rulesetId, activeView, modelsVisibilityHandler, getFilteredDataProvider(filteredNodeLoader.dataProvider), props.enableHierarchyAutoUpdate);
42
+ const visibilityHandler = useVisibilityHandler(nodeLoader.dataProvider.rulesetId, props.iModel, activeView, modelsVisibilityHandler, getFilteredDataProvider(filteredNodeLoader.dataProvider), props.enableHierarchyAutoUpdate);
43
43
  const eventHandler = (0, core_react_1.useDisposable)(React.useCallback(() => new VisibilityTreeEventHandler_1.VisibilityTreeEventHandler({
44
44
  nodeLoader: filteredNodeLoader,
45
45
  visibilityHandler,
@@ -101,19 +101,22 @@ function useModelsTreeNodeLoader(props) {
101
101
  onItemsRendered: activeItemsRenderedCallback,
102
102
  };
103
103
  }
104
- function useVisibilityHandler(rulesetId, activeView, visibilityHandler, filteredDataProvider, hierarchyAutoUpdateEnabled) {
104
+ function useVisibilityHandler(rulesetId, iModel, activeView, visibilityHandler, filteredDataProvider, hierarchyAutoUpdateEnabled) {
105
+ const subjectModelIdsCache = React.useMemo(() => new ModelsVisibilityHandler_1.SubjectModelIdsCache(iModel), [iModel]);
105
106
  const defaultVisibilityHandler = (0, core_react_1.useOptionalDisposable)(React.useCallback(() => {
106
- return visibilityHandler ? undefined : createVisibilityHandler(rulesetId, activeView, hierarchyAutoUpdateEnabled);
107
- }, [visibilityHandler, rulesetId, activeView, hierarchyAutoUpdateEnabled]));
107
+ if (activeView)
108
+ return createVisibilityHandler(rulesetId, activeView, subjectModelIdsCache, hierarchyAutoUpdateEnabled);
109
+ return undefined;
110
+ }, [rulesetId, activeView, subjectModelIdsCache, hierarchyAutoUpdateEnabled]));
108
111
  const handler = visibilityHandler !== null && visibilityHandler !== void 0 ? visibilityHandler : defaultVisibilityHandler;
109
112
  React.useEffect(() => {
110
113
  handler && handler.setFilteredDataProvider(filteredDataProvider);
111
114
  }, [handler, filteredDataProvider]);
112
115
  return handler;
113
116
  }
114
- const createVisibilityHandler = (rulesetId, activeView, hierarchyAutoUpdateEnabled) => {
117
+ const createVisibilityHandler = (rulesetId, activeView, subjectModelIdsCache, hierarchyAutoUpdateEnabled) => {
115
118
  // istanbul ignore next
116
- return activeView ? new ModelsVisibilityHandler_1.ModelsVisibilityHandler({ rulesetId, viewport: activeView, hierarchyAutoUpdateEnabled }) : undefined;
119
+ return new ModelsVisibilityHandler_1.ModelsVisibilityHandler({ rulesetId, viewport: activeView, hierarchyAutoUpdateEnabled, subjectModelIdsCache });
117
120
  };
118
121
  const isFilteredDataProvider = (dataProvider) => {
119
122
  const filteredProvider = dataProvider;
@@ -1 +1 @@
1
- {"version":3,"file":"ModelsTree.js","sourceRoot":"","sources":["../../../../../src/appui-react/imodel-components/models-tree/ModelsTree.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,6BAA2B;AAC3B,+BAA+B;AAI/B,4EAEwC;AACxC,wEAA4D;AAC5D,8DAAoG;AACpG,kDAAyE;AACzE,kEAA+D;AAC/D,sCAA0E;AAC1E,8EAA2E;AAC3E,sEAAgI;AAChI,uEAAkG;AAElG,MAAM,WAAW,GAAG,EAAE,CAAC;AAEvB,gBAAgB;AACH,QAAA,cAAc,GAAY,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC,yDAAyD;AAC7H,gBAAgB;AACH,QAAA,+BAA+B,GAAY,OAAO,CAAC,iCAAiC,CAAC,CAAC,CAAC,yDAAyD;AAE7J,MAAM,qBAAqB,GAAY,OAAO,CAAC,yBAAyB,CAAC,CAAC,CAAC,yDAAyD;AA8DpI;;;;;GAKG;AACH,SAAgB,UAAU,CAAC,KAAsB;IAC/C,MAAM,EAAE,UAAU,EAAE,eAAe,EAAE,GAAG,uBAAuB,CAAC,KAAK,CAAC,CAAC;IACvE,MAAM,EAAE,kBAAkB,EAAE,WAAW,EAAE,qBAAqB,EAAE,GAAG,IAAA,mDAA0B,EAAC,UAAU,EAAE,KAA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CAAC,qBAAqB,KAAK,SAAS,CAAC;AACnK,CAAC,CAAC;AAEF,MAAM,uBAAuB,GAAG,CAAC,YAAmF,EAAqD,EAAE;IACzK,OAAO,sBAAsB,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS,CAAC;AACzE,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module IModelComponents\r\n */\r\n\r\nimport \"./ModelsTree.scss\";\r\nimport * as React from \"react\";\r\nimport { Id64Array } from \"@itwin/core-bentley\";\r\nimport { IModelConnection, Viewport } from \"@itwin/core-frontend\";\r\nimport { NodeKey, Ruleset } from \"@itwin/presentation-common\";\r\nimport {\r\n IFilteredPresentationTreeDataProvider, IPresentationTreeDataProvider, usePresentationTreeNodeLoader,\r\n} from \"@itwin/presentation-components\";\r\nimport { Presentation } from \"@itwin/presentation-frontend\";\r\nimport { ControlledTree, SelectionMode, TreeNodeItem, useTreeModel } from \"@itwin/components-react\";\r\nimport { useDisposable, useOptionalDisposable } from \"@itwin/core-react\";\r\nimport { UiFramework } from \"../../../appui-react/UiFramework\";\r\nimport { ClassGroupingOption, VisibilityTreeFilterInfo } from \"../Common\";\r\nimport { VisibilityTreeEventHandler } from \"../VisibilityTreeEventHandler\";\r\nimport { useVisibilityTreeFiltering, useVisibilityTreeRenderer, VisibilityTreeNoFilteredData } from \"../VisibilityTreeRenderer\";\r\nimport { ModelsTreeSelectionPredicate, ModelsVisibilityHandler } from \"./ModelsVisibilityHandler\";\r\n\r\nconst PAGING_SIZE = 20;\r\n\r\n/** @internal */\r\nexport const RULESET_MODELS: Ruleset = require(\"./Hierarchy.json\"); // eslint-disable-line @typescript-eslint/no-var-requires\r\n/** @internal */\r\nexport const RULESET_MODELS_GROUPED_BY_CLASS: Ruleset = require(\"./Hierarchy.GroupedByClass.json\"); // eslint-disable-line @typescript-eslint/no-var-requires\r\n\r\nconst RULESET_MODELS_SEARCH: Ruleset = require(\"./ModelsTreeSearch.json\"); // eslint-disable-line @typescript-eslint/no-var-requires\r\n\r\n/** Props for [[ModelsTree]] component\r\n * @public\r\n */\r\nexport interface ModelsTreeProps {\r\n /**\r\n * An IModel to pull data from\r\n */\r\n iModel: IModelConnection;\r\n /** Width of the component */\r\n width: number;\r\n /** Height of the component */\r\n height: number;\r\n /**\r\n * Selection mode in the tree\r\n */\r\n selectionMode?: SelectionMode;\r\n /**\r\n * Predicate which indicates whether node can be selected or no\r\n * @alpha\r\n */\r\n selectionPredicate?: ModelsTreeSelectionPredicate;\r\n /**\r\n * Active view used to determine and control visibility\r\n */\r\n activeView?: Viewport;\r\n /**\r\n * Ref to the root HTML element used by this component\r\n */\r\n rootElementRef?: React.Ref<HTMLDivElement>;\r\n /**\r\n * Information for tree filtering.\r\n * @alpha\r\n */\r\n filterInfo?: VisibilityTreeFilterInfo;\r\n /**\r\n * Filter the hierarchy by given element IDs.\r\n * @alpha\r\n */\r\n filteredElementIds?: Id64Array;\r\n /**\r\n * Callback invoked when tree is filtered.\r\n */\r\n onFilterApplied?: (filteredDataProvider: IPresentationTreeDataProvider, matchesCount: number) => void;\r\n /**\r\n * Should the tree group displayed element nodes by class.\r\n * @beta\r\n */\r\n enableElementsClassGrouping?: ClassGroupingOption;\r\n /**\r\n * Auto-update the hierarchy when data in the iModel changes.\r\n * @alpha\r\n */\r\n enableHierarchyAutoUpdate?: boolean;\r\n /**\r\n * Custom visibility handler.\r\n * @alpha\r\n */\r\n modelsVisibilityHandler?: ModelsVisibilityHandler;\r\n}\r\n\r\n/**\r\n * A tree component that shows a subject - model - category - element\r\n * hierarchy along with checkboxes that represent and allow changing\r\n * the display of those instances.\r\n * @public\r\n */\r\nexport function ModelsTree(props: ModelsTreeProps) {\r\n const { nodeLoader, onItemsRendered } = useModelsTreeNodeLoader(props);\r\n const { filteredNodeLoader, isFiltering, nodeHighlightingProps } = useVisibilityTreeFiltering(nodeLoader, props.filterInfo, props.onFilterApplied);\r\n const filterApplied = filteredNodeLoader !== nodeLoader;\r\n\r\n const { activeView, modelsVisibilityHandler, selectionPredicate } = props;\r\n const nodeSelectionPredicate = React.useCallback((key: NodeKey, node: TreeNodeItem) => {\r\n return !selectionPredicate ? true : selectionPredicate(key, ModelsVisibilityHandler.getNodeType(node, nodeLoader.dataProvider));\r\n }, [selectionPredicate, nodeLoader.dataProvider]);\r\n\r\n const visibilityHandler = useVisibilityHandler(\r\n nodeLoader.dataProvider.rulesetId,\r\n activeView,\r\n modelsVisibilityHandler,\r\n getFilteredDataProvider(filteredNodeLoader.dataProvider),\r\n props.enableHierarchyAutoUpdate);\r\n const eventHandler = useDisposable(React.useCallback(() => new VisibilityTreeEventHandler({\r\n nodeLoader: filteredNodeLoader,\r\n visibilityHandler,\r\n collapsedChildrenDisposalEnabled: true,\r\n selectionPredicate: nodeSelectionPredicate,\r\n }), [filteredNodeLoader, visibilityHandler, nodeSelectionPredicate]));\r\n\r\n const treeModel = useTreeModel(filteredNodeLoader.modelSource);\r\n const treeRenderer = useVisibilityTreeRenderer(true, false);\r\n\r\n const overlay = isFiltering ? <div className=\"filteredTreeOverlay\" /> : undefined;\r\n\r\n // istanbul ignore next\r\n const noFilteredDataRenderer = React.useCallback(() => {\r\n return <VisibilityTreeNoFilteredData\r\n title={UiFramework.localization.getLocalizedString(\"UiFramework:modelTree.noModelFound\")}\r\n message={UiFramework.localization.getLocalizedString(\"UiFramework:modelTree.noMatchingModelNames\")}\r\n />;\r\n }, []);\r\n\r\n return (\r\n <div className=\"ui-fw-models-tree\" ref={props.rootElementRef}>\r\n <ControlledTree\r\n nodeLoader={filteredNodeLoader}\r\n model={treeModel}\r\n selectionMode={props.selectionMode || SelectionMode.None}\r\n eventsHandler={eventHandler}\r\n treeRenderer={treeRenderer}\r\n nodeHighlightingProps={nodeHighlightingProps}\r\n noDataRenderer={filterApplied ? noFilteredDataRenderer : undefined}\r\n onItemsRendered={onItemsRendered}\r\n width={props.width}\r\n height={props.height}\r\n />\r\n {overlay}\r\n </div>\r\n );\r\n}\r\n\r\nfunction useModelsTreeNodeLoader(props: ModelsTreeProps) {\r\n // note: this is a temporary workaround for auto-update not working on ruleset variable changes - instead\r\n // of auto-updating we just re-create the node loader by re-creating the ruleset\r\n const rulesets = React.useMemo(() => {\r\n return {\r\n general: (!props.enableElementsClassGrouping) ? { ...RULESET_MODELS } : /* istanbul ignore next */ { ...RULESET_MODELS_GROUPED_BY_CLASS },\r\n search: { ...RULESET_MODELS_SEARCH },\r\n };\r\n }, [props.filteredElementIds]); // eslint-disable-line react-hooks/exhaustive-deps\r\n // const rulesets = {\r\n // general: (!props.enableElementsClassGrouping) ? RULESET_MODELS : /* istanbul ignore next */ RULESET_MODELS_GROUPED_BY_CLASS,\r\n // search: RULESET_MODELS_SEARCH,\r\n // };\r\n\r\n const { nodeLoader, onItemsRendered } = usePresentationTreeNodeLoader({\r\n imodel: props.iModel,\r\n ruleset: rulesets.general,\r\n appendChildrenCountForGroupingNodes: (props.enableElementsClassGrouping === ClassGroupingOption.YesWithCounts),\r\n pagingSize: PAGING_SIZE,\r\n enableHierarchyAutoUpdate: props.enableHierarchyAutoUpdate,\r\n });\r\n const { nodeLoader: searchNodeLoader, onItemsRendered: onSearchItemsRendered } = usePresentationTreeNodeLoader({\r\n imodel: props.iModel,\r\n ruleset: rulesets.search,\r\n pagingSize: PAGING_SIZE,\r\n enableHierarchyAutoUpdate: props.enableHierarchyAutoUpdate,\r\n });\r\n\r\n const activeNodeLoader = props.filterInfo?.filter ? searchNodeLoader : nodeLoader;\r\n const activeItemsRenderedCallback = props.filterInfo?.filter ? onSearchItemsRendered : onItemsRendered;\r\n\r\n const vars = Presentation.presentation.vars(activeNodeLoader.dataProvider.rulesetId);\r\n if (props.filteredElementIds) {\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n vars.setId64s(\"filtered-element-ids\", props.filteredElementIds);\r\n } else {\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n vars.unset(\"filtered-element-ids\");\r\n }\r\n\r\n return {\r\n nodeLoader: activeNodeLoader,\r\n onItemsRendered: activeItemsRenderedCallback,\r\n };\r\n}\r\n\r\nfunction useVisibilityHandler(\r\n rulesetId: string,\r\n activeView?: Viewport,\r\n visibilityHandler?: ModelsVisibilityHandler,\r\n filteredDataProvider?: IFilteredPresentationTreeDataProvider,\r\n hierarchyAutoUpdateEnabled?: boolean,\r\n) {\r\n const defaultVisibilityHandler = useOptionalDisposable(React.useCallback(() => {\r\n return visibilityHandler ? undefined : createVisibilityHandler(rulesetId, activeView, hierarchyAutoUpdateEnabled);\r\n }, [visibilityHandler, rulesetId, activeView, hierarchyAutoUpdateEnabled]));\r\n\r\n const handler = visibilityHandler ?? defaultVisibilityHandler;\r\n\r\n React.useEffect(() => {\r\n handler && handler.setFilteredDataProvider(filteredDataProvider);\r\n }, [handler, filteredDataProvider]);\r\n\r\n return handler;\r\n}\r\n\r\nconst createVisibilityHandler = (rulesetId: string, activeView?: Viewport, hierarchyAutoUpdateEnabled?: boolean): ModelsVisibilityHandler | undefined => {\r\n // istanbul ignore next\r\n return activeView ? new ModelsVisibilityHandler({ rulesetId, viewport: activeView, hierarchyAutoUpdateEnabled }) : undefined;\r\n};\r\n\r\nconst isFilteredDataProvider = (dataProvider: IPresentationTreeDataProvider | IFilteredPresentationTreeDataProvider): dataProvider is IFilteredPresentationTreeDataProvider => {\r\n const filteredProvider = dataProvider as IFilteredPresentationTreeDataProvider;\r\n return filteredProvider.nodeMatchesFilter !== undefined && filteredProvider.getActiveMatch !== undefined && filteredProvider.countFilteringResults !== undefined;\r\n};\r\n\r\nconst getFilteredDataProvider = (dataProvider: IPresentationTreeDataProvider | IFilteredPresentationTreeDataProvider): IFilteredPresentationTreeDataProvider | undefined => {\r\n return isFilteredDataProvider(dataProvider) ? dataProvider : undefined;\r\n};\r\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------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module IModelComponents\r\n */\r\n\r\nimport \"./ModelsTree.scss\";\r\nimport * as React from \"react\";\r\nimport { ControlledTree, SelectionMode, TreeNodeItem, useTreeModel } from \"@itwin/components-react\";\r\nimport { Id64Array } from \"@itwin/core-bentley\";\r\nimport { IModelConnection, Viewport } from \"@itwin/core-frontend\";\r\nimport { useDisposable, useOptionalDisposable } from \"@itwin/core-react\";\r\nimport { NodeKey, Ruleset } from \"@itwin/presentation-common\";\r\nimport { IFilteredPresentationTreeDataProvider, IPresentationTreeDataProvider, usePresentationTreeNodeLoader } from \"@itwin/presentation-components\";\r\nimport { Presentation } from \"@itwin/presentation-frontend\";\r\nimport { UiFramework } from \"../../../appui-react/UiFramework\";\r\nimport { ClassGroupingOption, VisibilityTreeFilterInfo } from \"../Common\";\r\nimport { VisibilityTreeEventHandler } from \"../VisibilityTreeEventHandler\";\r\nimport { useVisibilityTreeFiltering, useVisibilityTreeRenderer, VisibilityTreeNoFilteredData } from \"../VisibilityTreeRenderer\";\r\nimport { ModelsTreeSelectionPredicate, ModelsVisibilityHandler, SubjectModelIdsCache } from \"./ModelsVisibilityHandler\";\r\n\r\nconst PAGING_SIZE = 20;\r\n\r\n/** @internal */\r\nexport const RULESET_MODELS: Ruleset = require(\"./Hierarchy.json\"); // eslint-disable-line @typescript-eslint/no-var-requires\r\n/** @internal */\r\nexport const RULESET_MODELS_GROUPED_BY_CLASS: Ruleset = require(\"./Hierarchy.GroupedByClass.json\"); // eslint-disable-line @typescript-eslint/no-var-requires\r\n\r\nconst RULESET_MODELS_SEARCH: Ruleset = require(\"./ModelsTreeSearch.json\"); // eslint-disable-line @typescript-eslint/no-var-requires\r\n\r\n/** Props for [[ModelsTree]] component\r\n * @public\r\n */\r\nexport interface ModelsTreeProps {\r\n /**\r\n * An IModel to pull data from\r\n */\r\n iModel: IModelConnection;\r\n /** Width of the component */\r\n width: number;\r\n /** Height of the component */\r\n height: number;\r\n /**\r\n * Selection mode in the tree\r\n */\r\n selectionMode?: SelectionMode;\r\n /**\r\n * Predicate which indicates whether node can be selected or no\r\n * @alpha\r\n */\r\n selectionPredicate?: ModelsTreeSelectionPredicate;\r\n /**\r\n * Active view used to determine and control visibility\r\n */\r\n activeView?: Viewport;\r\n /**\r\n * Ref to the root HTML element used by this component\r\n */\r\n rootElementRef?: React.Ref<HTMLDivElement>;\r\n /**\r\n * Information for tree filtering.\r\n * @alpha\r\n */\r\n filterInfo?: VisibilityTreeFilterInfo;\r\n /**\r\n * Filter the hierarchy by given element IDs.\r\n * @alpha\r\n */\r\n filteredElementIds?: Id64Array;\r\n /**\r\n * Callback invoked when tree is filtered.\r\n */\r\n onFilterApplied?: (filteredDataProvider: IPresentationTreeDataProvider, matchesCount: number) => void;\r\n /**\r\n * Should the tree group displayed element nodes by class.\r\n * @beta\r\n */\r\n enableElementsClassGrouping?: ClassGroupingOption;\r\n /**\r\n * Auto-update the hierarchy when data in the iModel changes.\r\n * @alpha\r\n */\r\n enableHierarchyAutoUpdate?: boolean;\r\n /**\r\n * Custom visibility handler.\r\n * @alpha\r\n */\r\n modelsVisibilityHandler?: ModelsVisibilityHandler;\r\n}\r\n\r\n/**\r\n * A tree component that shows a subject - model - category - element\r\n * hierarchy along with checkboxes that represent and allow changing\r\n * the display of those instances.\r\n * @public\r\n */\r\nexport function ModelsTree(props: ModelsTreeProps) {\r\n const { nodeLoader, onItemsRendered } = useModelsTreeNodeLoader(props);\r\n const { filteredNodeLoader, isFiltering, nodeHighlightingProps } = useVisibilityTreeFiltering(nodeLoader, props.filterInfo, props.onFilterApplied);\r\n const filterApplied = filteredNodeLoader !== nodeLoader;\r\n\r\n const { activeView, modelsVisibilityHandler, selectionPredicate } = props;\r\n const nodeSelectionPredicate = React.useCallback((key: NodeKey, node: TreeNodeItem) => {\r\n return !selectionPredicate ? true : selectionPredicate(key, ModelsVisibilityHandler.getNodeType(node, nodeLoader.dataProvider));\r\n }, [selectionPredicate, nodeLoader.dataProvider]);\r\n\r\n const visibilityHandler = useVisibilityHandler(\r\n nodeLoader.dataProvider.rulesetId,\r\n props.iModel,\r\n activeView,\r\n modelsVisibilityHandler,\r\n getFilteredDataProvider(filteredNodeLoader.dataProvider),\r\n props.enableHierarchyAutoUpdate);\r\n const eventHandler = useDisposable(React.useCallback(() => new VisibilityTreeEventHandler({\r\n nodeLoader: filteredNodeLoader,\r\n visibilityHandler,\r\n collapsedChildrenDisposalEnabled: true,\r\n selectionPredicate: nodeSelectionPredicate,\r\n }), [filteredNodeLoader, visibilityHandler, nodeSelectionPredicate]));\r\n\r\n const treeModel = useTreeModel(filteredNodeLoader.modelSource);\r\n const treeRenderer = useVisibilityTreeRenderer(true, false);\r\n\r\n const overlay = isFiltering ? <div className=\"filteredTreeOverlay\" /> : undefined;\r\n\r\n // istanbul ignore next\r\n const noFilteredDataRenderer = React.useCallback(() => {\r\n return <VisibilityTreeNoFilteredData\r\n title={UiFramework.localization.getLocalizedString(\"UiFramework:modelTree.noModelFound\")}\r\n message={UiFramework.localization.getLocalizedString(\"UiFramework:modelTree.noMatchingModelNames\")}\r\n />;\r\n }, []);\r\n\r\n return (\r\n <div className=\"ui-fw-models-tree\" ref={props.rootElementRef}>\r\n <ControlledTree\r\n nodeLoader={filteredNodeLoader}\r\n model={treeModel}\r\n selectionMode={props.selectionMode || SelectionMode.None}\r\n eventsHandler={eventHandler}\r\n treeRenderer={treeRenderer}\r\n nodeHighlightingProps={nodeHighlightingProps}\r\n noDataRenderer={filterApplied ? noFilteredDataRenderer : undefined}\r\n onItemsRendered={onItemsRendered}\r\n width={props.width}\r\n height={props.height}\r\n />\r\n {overlay}\r\n </div>\r\n );\r\n}\r\n\r\nfunction useModelsTreeNodeLoader(props: ModelsTreeProps) {\r\n // note: this is a temporary workaround for auto-update not working on ruleset variable changes - instead\r\n // of auto-updating we just re-create the node loader by re-creating the ruleset\r\n const rulesets = React.useMemo(() => {\r\n return {\r\n general: (!props.enableElementsClassGrouping) ? { ...RULESET_MODELS } : /* istanbul ignore next */ { ...RULESET_MODELS_GROUPED_BY_CLASS },\r\n search: { ...RULESET_MODELS_SEARCH },\r\n };\r\n }, [props.filteredElementIds]); // eslint-disable-line react-hooks/exhaustive-deps\r\n // const rulesets = {\r\n // general: (!props.enableElementsClassGrouping) ? RULESET_MODELS : /* istanbul ignore next */ RULESET_MODELS_GROUPED_BY_CLASS,\r\n // search: RULESET_MODELS_SEARCH,\r\n // };\r\n\r\n const { nodeLoader, onItemsRendered } = usePresentationTreeNodeLoader({\r\n imodel: props.iModel,\r\n ruleset: rulesets.general,\r\n appendChildrenCountForGroupingNodes: (props.enableElementsClassGrouping === ClassGroupingOption.YesWithCounts),\r\n pagingSize: PAGING_SIZE,\r\n enableHierarchyAutoUpdate: props.enableHierarchyAutoUpdate,\r\n });\r\n const { nodeLoader: searchNodeLoader, onItemsRendered: onSearchItemsRendered } = usePresentationTreeNodeLoader({\r\n imodel: props.iModel,\r\n ruleset: rulesets.search,\r\n pagingSize: PAGING_SIZE,\r\n enableHierarchyAutoUpdate: props.enableHierarchyAutoUpdate,\r\n });\r\n\r\n const activeNodeLoader = props.filterInfo?.filter ? searchNodeLoader : nodeLoader;\r\n const activeItemsRenderedCallback = props.filterInfo?.filter ? onSearchItemsRendered : onItemsRendered;\r\n\r\n const vars = Presentation.presentation.vars(activeNodeLoader.dataProvider.rulesetId);\r\n if (props.filteredElementIds) {\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n vars.setId64s(\"filtered-element-ids\", props.filteredElementIds);\r\n } else {\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n vars.unset(\"filtered-element-ids\");\r\n }\r\n\r\n return {\r\n nodeLoader: activeNodeLoader,\r\n onItemsRendered: activeItemsRenderedCallback,\r\n };\r\n}\r\n\r\nfunction useVisibilityHandler(\r\n rulesetId: string,\r\n iModel: IModelConnection,\r\n activeView?: Viewport,\r\n visibilityHandler?: ModelsVisibilityHandler,\r\n filteredDataProvider?: IFilteredPresentationTreeDataProvider,\r\n hierarchyAutoUpdateEnabled?: boolean,\r\n) {\r\n const subjectModelIdsCache = React.useMemo(() => new SubjectModelIdsCache(iModel), [iModel]);\r\n const defaultVisibilityHandler = useOptionalDisposable(React.useCallback(() => {\r\n if (activeView)\r\n return createVisibilityHandler(rulesetId, activeView, subjectModelIdsCache, hierarchyAutoUpdateEnabled);\r\n return undefined;\r\n }, [rulesetId, activeView, subjectModelIdsCache, hierarchyAutoUpdateEnabled]));\r\n\r\n const handler = visibilityHandler ?? defaultVisibilityHandler;\r\n\r\n React.useEffect(() => {\r\n handler && handler.setFilteredDataProvider(filteredDataProvider);\r\n }, [handler, filteredDataProvider]);\r\n\r\n return handler;\r\n}\r\n\r\nconst createVisibilityHandler = (rulesetId: string, activeView: Viewport, subjectModelIdsCache: SubjectModelIdsCache, hierarchyAutoUpdateEnabled?: boolean): ModelsVisibilityHandler | undefined => {\r\n // istanbul ignore next\r\n return new ModelsVisibilityHandler({ rulesetId, viewport: activeView, hierarchyAutoUpdateEnabled, subjectModelIdsCache });\r\n};\r\n\r\nconst isFilteredDataProvider = (dataProvider: IPresentationTreeDataProvider | IFilteredPresentationTreeDataProvider): dataProvider is IFilteredPresentationTreeDataProvider => {\r\n const filteredProvider = dataProvider as IFilteredPresentationTreeDataProvider;\r\n return filteredProvider.nodeMatchesFilter !== undefined && filteredProvider.getActiveMatch !== undefined && filteredProvider.countFilteringResults !== undefined;\r\n};\r\n\r\nconst getFilteredDataProvider = (dataProvider: IPresentationTreeDataProvider | IFilteredPresentationTreeDataProvider): IFilteredPresentationTreeDataProvider | undefined => {\r\n return isFilteredDataProvider(dataProvider) ? dataProvider : undefined;\r\n};\r\n"]}
@@ -3,7 +3,7 @@
3
3
  */
4
4
  import { TreeNodeItem } from "@itwin/components-react";
5
5
  import { BeEvent, Id64String } from "@itwin/core-bentley";
6
- import { Viewport } from "@itwin/core-frontend";
6
+ import { IModelConnection, Viewport } from "@itwin/core-frontend";
7
7
  import { ECClassGroupingNodeKey, NodeKey } from "@itwin/presentation-common";
8
8
  import { IFilteredPresentationTreeDataProvider, IPresentationTreeDataProvider } from "@itwin/presentation-components";
9
9
  import { IVisibilityHandler, VisibilityChangeListener, VisibilityStatus } from "../VisibilityTreeEventHandler";
@@ -32,6 +32,8 @@ export interface ModelsVisibilityHandlerProps {
32
32
  rulesetId: string;
33
33
  viewport: Viewport;
34
34
  hierarchyAutoUpdateEnabled?: boolean;
35
+ /** @internal */
36
+ subjectModelIdsCache?: SubjectModelIdsCache;
35
37
  }
36
38
  /**
37
39
  * Visibility handler used by [[ModelsTree]] to control visibility of the tree items.
@@ -84,4 +86,16 @@ export declare class ModelsVisibilityHandler implements IVisibilityHandler {
84
86
  private getAssemblyElementIds;
85
87
  private getGroupedElementIds;
86
88
  }
89
+ /** @internal */
90
+ export declare class SubjectModelIdsCache {
91
+ private _imodel;
92
+ private _subjectsHierarchy;
93
+ private _subjectModels;
94
+ private _init;
95
+ constructor(imodel: IModelConnection);
96
+ private initSubjectModels;
97
+ private initCache;
98
+ private appendSubjectModelsRecursively;
99
+ getSubjectModelIds(subjectId: Id64String): Promise<Id64String[]>;
100
+ }
87
101
  //# sourceMappingURL=ModelsVisibilityHandler.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ModelsVisibilityHandler.d.ts","sourceRoot":"","sources":["../../../../../src/appui-react/imodel-components/models-tree/ModelsVisibilityHandler.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAE1D,OAAO,EAAgD,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAC9F,OAAO,EAAE,sBAAsB,EAAiC,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAC5G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;cAUnH,mBAAmB,CAAC,OAAO,EAAE,UAAU,GAAG,SAAS,EAAE,UAAU,EAAE,UAAU,GAAG,SAAS,EAAE,UAAU,EAAE,cAAc,CAAC,UAAU,CAAC,EAAE,EAAE,EAAE,OAAO;IAuB5J,OAAO,CAAC,0BAA0B;IAWlC,OAAO,CAAC,aAAa,CAEnB;IAGF,OAAO,CAAC,2BAA2B,CAEjC;IAGF,OAAO,CAAC,0BAA0B,CAEhC;IAEF,OAAO,CAAC,wBAAwB;IAIhC,OAAO,CAAC,iBAAiB;IAIzB,OAAO,CAAC,oBAAoB;YAId,kBAAkB;IAMhC,OAAO,CAAC,qBAAqB;YAKf,oBAAoB;CAGnC"}
1
+ {"version":3,"file":"ModelsVisibilityHandler.d.ts","sourceRoot":"","sources":["../../../../../src/appui-react/imodel-components/models-tree/ModelsVisibilityHandler.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAE1D,OAAO,EAAE,gBAAgB,EAA8B,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAC9F,OAAO,EAAE,sBAAsB,EAAiC,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAC5G,OAAO,EAAE,qCAAqC,EAAE,6BAA6B,EAAE,MAAM,gCAAgC,CAAC;AAGtH,OAAO,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAG/G;;;GAGG;AACH,oBAAY,kBAAkB;IAC5B,OAAO,IAAA;IACP,OAAO,IAAA;IACP,KAAK,IAAA;IACL,QAAQ,IAAA;IACR,OAAO,IAAA;IACP,QAAQ,IAAA;CACT;AAED;;;GAGG;AACH,oBAAY,4BAA4B,GAAG,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,kBAAkB,KAAK,OAAO,CAAC;AAE/F;;;GAGG;A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AoB;YAId,kBAAkB;IAMhC,OAAO,CAAC,qBAAqB;YAKf,oBAAoB;CAGnC;AAED,gBAAgB;AAChB,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,OAAO,CAAmB;IAClC,OAAO,CAAC,kBAAkB,CAA4C;IACtE,OAAO,CAAC,cAAc,CAA4C;IAClE,OAAO,CAAC,KAAK,CAA4B;gBAE7B,MAAM,EAAE,gBAAgB;YAItB,iBAAiB;YAoDjB,SAAS;IAOvB,OAAO,CAAC,8BAA8B;IAUzB,kBAAkB,CAAC,SAAS,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;CAM9E"}
@@ -7,7 +7,7 @@
7
7
  * @module IModelComponents
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.ModelsVisibilityHandler = exports.ModelsTreeNodeType = void 0;
10
+ exports.SubjectModelIdsCache = exports.ModelsVisibilityHandler = exports.ModelsTreeNodeType = void 0;
11
11
  const core_bentley_1 = require("@itwin/core-bentley");
12
12
  const core_common_1 = require("@itwin/core-common");
13
13
  const core_frontend_1 = require("@itwin/core-frontend");
@@ -34,6 +34,7 @@ var ModelsTreeNodeType;
34
34
  */
35
35
  class ModelsVisibilityHandler {
36
36
  constructor(props) {
37
+ var _a;
37
38
  this._listeners = new Array();
38
39
  this.onVisibilityChange = new core_bentley_1.BeEvent();
39
40
  // eslint-disable-next-line @typescript-eslint/naming-convention
@@ -49,7 +50,7 @@ class ModelsVisibilityHandler {
49
50
  this.onVisibilityChangeInternal();
50
51
  };
51
52
  this._props = props;
52
- this._subjectModelIdsCache = new SubjectModelIdsCache(this._props.viewport.iModel);
53
+ this._subjectModelIdsCache = (_a = props.subjectModelIdsCache) !== null && _a !== void 0 ? _a : new SubjectModelIdsCache(this._props.viewport.iModel);
53
54
  this._elementIdsCache = new ElementIdsCache(this._props.viewport.iModel, this._props.rulesetId);
54
55
  this._listeners.push(this._props.viewport.onViewedCategoriesPerModelChanged.addListener(this.onViewChanged));
55
56
  this._listeners.push(this._props.viewport.onViewedCategoriesChanged.addListener(this.onViewChanged));
@@ -331,6 +332,7 @@ class ModelsVisibilityHandler {
331
332
  }
332
333
  }
333
334
  exports.ModelsVisibilityHandler = ModelsVisibilityHandler;
335
+ /** @internal */
334
336
  class SubjectModelIdsCache {
335
337
  constructor(imodel) {
336
338
  this._imodel = imodel;
@@ -404,6 +406,7 @@ class SubjectModelIdsCache {
404
406
  return modelIds;
405
407
  }
406
408
  }
409
+ exports.SubjectModelIdsCache = SubjectModelIdsCache;
407
410
  // istanbul ignore next
408
411
  class ElementIdsCache {
409
412
  constructor(_imodel, _rulesetId) {