@itwin/map-layers 4.0.0 → 5.0.0-dev.3

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 (95) hide show
  1. package/lib/cjs/MapLayerPreferences.js +1 -2
  2. package/lib/cjs/MapLayerPreferences.js.map +1 -1
  3. package/lib/cjs/mapLayers.js +2 -3
  4. package/lib/cjs/mapLayers.js.map +1 -1
  5. package/lib/cjs/ui/FeatureInfoUiItemsProvider.js +2 -3
  6. package/lib/cjs/ui/FeatureInfoUiItemsProvider.js.map +1 -1
  7. package/lib/cjs/ui/Interfaces.d.ts.map +1 -1
  8. package/lib/cjs/ui/Interfaces.js.map +1 -1
  9. package/lib/cjs/ui/MapLayersUiItemsProvider.js +2 -2
  10. package/lib/cjs/ui/MapLayersUiItemsProvider.js.map +1 -1
  11. package/lib/cjs/ui/widget/AttachLayerPopupButton.d.ts.map +1 -1
  12. package/lib/cjs/ui/widget/AttachLayerPopupButton.js +13 -17
  13. package/lib/cjs/ui/widget/AttachLayerPopupButton.js.map +1 -1
  14. package/lib/cjs/ui/widget/BasemapPanel.d.ts.map +1 -1
  15. package/lib/cjs/ui/widget/BasemapPanel.js +1 -6
  16. package/lib/cjs/ui/widget/BasemapPanel.js.map +1 -1
  17. package/lib/cjs/ui/widget/ConfirmMessageDialog.js +4 -7
  18. package/lib/cjs/ui/widget/ConfirmMessageDialog.js.map +1 -1
  19. package/lib/cjs/ui/widget/FeatureInfoDataProvider.js +3 -4
  20. package/lib/cjs/ui/widget/FeatureInfoDataProvider.js.map +1 -1
  21. package/lib/cjs/ui/widget/FeatureInfoWidget.js +10 -16
  22. package/lib/cjs/ui/widget/FeatureInfoWidget.js.map +1 -1
  23. package/lib/cjs/ui/widget/MapLayerDroppable.js +5 -8
  24. package/lib/cjs/ui/widget/MapLayerDroppable.js.map +1 -1
  25. package/lib/cjs/ui/widget/MapLayerManager.d.ts.map +1 -1
  26. package/lib/cjs/ui/widget/MapLayerManager.js +30 -34
  27. package/lib/cjs/ui/widget/MapLayerManager.js.map +1 -1
  28. package/lib/cjs/ui/widget/MapLayerSettingsMenu.d.ts.map +1 -1
  29. package/lib/cjs/ui/widget/MapLayerSettingsMenu.js +4 -8
  30. package/lib/cjs/ui/widget/MapLayerSettingsMenu.js.map +1 -1
  31. package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.js +2 -2
  32. package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.js.map +1 -1
  33. package/lib/cjs/ui/widget/MapLayersWidget.js +4 -4
  34. package/lib/cjs/ui/widget/MapLayersWidget.js.map +1 -1
  35. package/lib/cjs/ui/widget/MapManagerSettings.d.ts.map +1 -1
  36. package/lib/cjs/ui/widget/MapManagerSettings.js +0 -5
  37. package/lib/cjs/ui/widget/MapManagerSettings.js.map +1 -1
  38. package/lib/cjs/ui/widget/MapUrlDialog.d.ts.map +1 -1
  39. package/lib/cjs/ui/widget/MapUrlDialog.js +32 -37
  40. package/lib/cjs/ui/widget/MapUrlDialog.js.map +1 -1
  41. package/lib/cjs/ui/widget/SelectMapFormat.js +7 -12
  42. package/lib/cjs/ui/widget/SelectMapFormat.js.map +1 -1
  43. package/lib/cjs/ui/widget/SubLayersDataProvider.js +4 -5
  44. package/lib/cjs/ui/widget/SubLayersDataProvider.js.map +1 -1
  45. package/lib/cjs/ui/widget/SubLayersTree.d.ts.map +1 -1
  46. package/lib/cjs/ui/widget/SubLayersTree.js +39 -50
  47. package/lib/cjs/ui/widget/SubLayersTree.js.map +1 -1
  48. package/lib/esm/MapLayerPreferences.js +1 -2
  49. package/lib/esm/MapLayerPreferences.js.map +1 -1
  50. package/lib/esm/mapLayers.js +2 -3
  51. package/lib/esm/mapLayers.js.map +1 -1
  52. package/lib/esm/ui/FeatureInfoUiItemsProvider.js +2 -3
  53. package/lib/esm/ui/FeatureInfoUiItemsProvider.js.map +1 -1
  54. package/lib/esm/ui/Interfaces.d.ts.map +1 -1
  55. package/lib/esm/ui/Interfaces.js.map +1 -1
  56. package/lib/esm/ui/MapLayersUiItemsProvider.js +2 -2
  57. package/lib/esm/ui/MapLayersUiItemsProvider.js.map +1 -1
  58. package/lib/esm/ui/widget/AttachLayerPopupButton.d.ts.map +1 -1
  59. package/lib/esm/ui/widget/AttachLayerPopupButton.js +13 -17
  60. package/lib/esm/ui/widget/AttachLayerPopupButton.js.map +1 -1
  61. package/lib/esm/ui/widget/BasemapPanel.d.ts.map +1 -1
  62. package/lib/esm/ui/widget/BasemapPanel.js +1 -6
  63. package/lib/esm/ui/widget/BasemapPanel.js.map +1 -1
  64. package/lib/esm/ui/widget/ConfirmMessageDialog.js +4 -7
  65. package/lib/esm/ui/widget/ConfirmMessageDialog.js.map +1 -1
  66. package/lib/esm/ui/widget/FeatureInfoDataProvider.js +3 -4
  67. package/lib/esm/ui/widget/FeatureInfoDataProvider.js.map +1 -1
  68. package/lib/esm/ui/widget/FeatureInfoWidget.js +10 -16
  69. package/lib/esm/ui/widget/FeatureInfoWidget.js.map +1 -1
  70. package/lib/esm/ui/widget/MapLayerDroppable.js +5 -8
  71. package/lib/esm/ui/widget/MapLayerDroppable.js.map +1 -1
  72. package/lib/esm/ui/widget/MapLayerManager.d.ts.map +1 -1
  73. package/lib/esm/ui/widget/MapLayerManager.js +30 -34
  74. package/lib/esm/ui/widget/MapLayerManager.js.map +1 -1
  75. package/lib/esm/ui/widget/MapLayerSettingsMenu.d.ts.map +1 -1
  76. package/lib/esm/ui/widget/MapLayerSettingsMenu.js +4 -8
  77. package/lib/esm/ui/widget/MapLayerSettingsMenu.js.map +1 -1
  78. package/lib/esm/ui/widget/MapLayerSettingsPopupButton.js +2 -2
  79. package/lib/esm/ui/widget/MapLayerSettingsPopupButton.js.map +1 -1
  80. package/lib/esm/ui/widget/MapLayersWidget.js +4 -4
  81. package/lib/esm/ui/widget/MapLayersWidget.js.map +1 -1
  82. package/lib/esm/ui/widget/MapManagerSettings.d.ts.map +1 -1
  83. package/lib/esm/ui/widget/MapManagerSettings.js +0 -5
  84. package/lib/esm/ui/widget/MapManagerSettings.js.map +1 -1
  85. package/lib/esm/ui/widget/MapUrlDialog.d.ts.map +1 -1
  86. package/lib/esm/ui/widget/MapUrlDialog.js +32 -37
  87. package/lib/esm/ui/widget/MapUrlDialog.js.map +1 -1
  88. package/lib/esm/ui/widget/SelectMapFormat.js +7 -12
  89. package/lib/esm/ui/widget/SelectMapFormat.js.map +1 -1
  90. package/lib/esm/ui/widget/SubLayersDataProvider.js +4 -5
  91. package/lib/esm/ui/widget/SubLayersDataProvider.js.map +1 -1
  92. package/lib/esm/ui/widget/SubLayersTree.d.ts.map +1 -1
  93. package/lib/esm/ui/widget/SubLayersTree.js +39 -50
  94. package/lib/esm/ui/widget/SubLayersTree.js.map +1 -1
  95. package/package.json +16 -16
@@ -1 +1 @@
1
- {"version":3,"file":"SubLayersDataProvider.js","sourceRoot":"","sources":["../../../../src/ui/widget/SubLayersDataProvider.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAEhE,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAGlD;;GAEG;AACH,MAAM,OAAO,qBAAqB;IAIhC,YAAY,QAA+B;QAH1B,aAAQ,GAAG,IAAI,GAAG,EAA0B,CAAC;QAI5D,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IACrC,CAAC;IAEM,MAAM,CAAC,cAAc,CAAC,QAAsC;QACjE,IAAI,CAAC,QAAQ;YACX,OAAO,KAAK,CAAC;QAEf,OAAO,CAAC,CAAC,QAAQ,CAAC,IAAI,IAAI,QAAQ,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,KAAK,SAAS,IAAI,QAAQ,CA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AI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAC5G,IAAI,SAAS;YACX,OAAO,SAAS,CAAC,MAAM,CAAC;QAE1B,OAAO,CAAC,CAAC;IACX,CAAC;IAEM,KAAK,CAAC,QAAQ,CAAC,MAAqB;QACzC,MAAM,SAAS,GAA+B,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAC5G,IAAI,SAAS;YACX,OAAO,SAAS,CAAC;QAEnB,OAAO,EAAE,CAAC;IACZ,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport { compareStringsOrUndefined } from \"@itwin/core-bentley\";\nimport { MapSubLayerProps, SubLayerId } from \"@itwin/core-common\";\nimport { PropertyRecord } from \"@itwin/appui-abstract\";\nimport { DelayLoadedTreeNodeItem, ITreeDataProvider, TreeNodeItem } from \"@itwin/components-react\";\nimport { CheckBoxState } from \"@itwin/core-react\";\nimport { StyleMapLayerSettings } from \"../Interfaces\";\n\n/**\n * Data provider that returns some fake nodes to show in tree.\n */\nexport class SubLayersDataProvider implements ITreeDataProvider {\n private readonly _nodeMap = new Map<string, TreeNodeItem[]>();\n private readonly _mapLayer: StyleMapLayerSettings;\n\n constructor(mapLayer: StyleMapLayerSettings) {\n this._mapLayer = mapLayer;\n this.loadNodes(mapLayer.subLayers);\n }\n\n public static isUnnamedGroup(subLayer: MapSubLayerProps | undefined): boolean {\n if (!subLayer)\n return false;\n\n return (!subLayer.name || subLayer.name.length === 0) && (subLayer.children !== undefined && subLayer.children.length > 0);\n }\n\n private createId(props: MapSubLayerProps): string {\n return undefined !== props.id ? `${props.id}` : props.name ? props.name : \"no-id\";\n }\n\n private createNode(props: MapSubLayerProps, expanded?: boolean, isCheckboxDisabled?: boolean, icon?: string): DelayLoadedTreeNodeItem {\n return {\n id: this.createId(props),\n label: PropertyRecord.fromString(props.title ?? props.name ?? \"unknown\"),\n hasChildren: !!props.children,\n isCheckboxVisible: true,\n checkBoxState: props.visible && !isCheckboxDisabled ? CheckBoxState.On : CheckBoxState.Off,\n extendedData: { subLayerId: props.id },\n isCheckboxDisabled,\n autoExpand: expanded,\n icon,\n };\n }\n\n private loadChildNodes(allSubLayers: MapSubLayerProps[], parentId?: SubLayerId) {\n const filteredProps = allSubLayers.filter((props) => parentId === props.parent);\n if (filteredProps.length) {\n filteredProps?.sort((a: MapSubLayerProps, b: MapSubLayerProps) => compareStringsOrUndefined(a.title, b.title));\n const treeNodes: TreeNodeItem[] = [];\n\n filteredProps.forEach((props) => {\n treeNodes.push(this.createNode(props,\n (!parentId && props?.children !== undefined) ? true : undefined, // expand root group only (i.e. not the entire tree),\n undefined,\n SubLayersDataProvider.isUnnamedGroup(props) ? \"icon-folder\" : \"icon-layers\"\n\n ));\n if (props.children)\n this.loadChildNodes(allSubLayers, props.id);\n });\n\n this._nodeMap.set(undefined !== parentId ? `${parentId}` : \"\", treeNodes);\n }\n }\n\n private loadNodes(subLayerNodes: MapSubLayerProps[] | undefined) {\n subLayerNodes?.sort((a: MapSubLayerProps, b: MapSubLayerProps) => compareStringsOrUndefined(a.title, b.title));\n if (subLayerNodes) {\n this.loadChildNodes(subLayerNodes, undefined);\n }\n }\n\n public async getNodesCount(parent?: TreeNodeItem) {\n const nodeArray: TreeNodeItem[] | undefined = parent ? this._nodeMap.get(parent.id) : this._nodeMap.get(\"\");\n if (nodeArray)\n return nodeArray.length;\n\n return 0;\n }\n\n public async getNodes(parent?: TreeNodeItem) {\n const nodeArray: TreeNodeItem[] | undefined = parent ? this._nodeMap.get(parent.id) : this._nodeMap.get(\"\");\n if (nodeArray)\n return nodeArray;\n\n return [];\n }\n}\n"]}
1
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AChD,CAAC,CAAC,CAAC;YAEH,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,SAAS,CAAC,CAAC;SAC3E;IACH,CAAC;IAEO,SAAS,CAAC,aAA6C;QAC7D,aAAa,EAAE,IAAI,CAAC,CAAC,CAAmB,EAAE,CAAmB,EAAE,EAAE,CAAC,yBAAyB,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;QAC/G,IAAI,aAAa,EAAE;YACjB,IAAI,CAAC,cAAc,CAAC,aAAa,EAAE,SAAS,CAAC,CAAC;SAC/C;IACH,CAAC;IAEM,KAAK,CAAC,aAAa,CAAC,MAAqB;QAC9C,MAAM,SAAS,GAA+B,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAC5G,IAAI,SAAS;YACX,OAAO,SAAS,CAAC,MAAM,CAAC;QAE1B,OAAO,CAAC,CAAC;IACX,CAAC;IAEM,KAAK,CAAC,QAAQ,CAAC,MAAqB;QACzC,MAAM,SAAS,GAA+B,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAC5G,IAAI,SAAS;YACX,OAAO,SAAS,CAAC;QAEnB,OAAO,EAAE,CAAC;IACZ,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport { compareStringsOrUndefined } from \"@itwin/core-bentley\";\nimport { MapSubLayerProps, SubLayerId } from \"@itwin/core-common\";\nimport { PropertyRecord } from \"@itwin/appui-abstract\";\nimport { DelayLoadedTreeNodeItem, ITreeDataProvider, TreeNodeItem } from \"@itwin/components-react\";\nimport { CheckBoxState } from \"@itwin/core-react\";\nimport { StyleMapLayerSettings } from \"../Interfaces\";\n\n/**\n * Data provider that returns some fake nodes to show in tree.\n */\nexport class SubLayersDataProvider implements ITreeDataProvider {\n private readonly _nodeMap = new Map<string, TreeNodeItem[]>();\n private readonly _mapLayer: StyleMapLayerSettings;\n\n constructor(mapLayer: StyleMapLayerSettings) {\n this._mapLayer = mapLayer;\n this.loadNodes(mapLayer.subLayers);\n }\n\n public static isUnnamedGroup(subLayer: MapSubLayerProps | undefined): boolean {\n if (!subLayer)\n return false;\n\n return (!subLayer.name || subLayer.name.length === 0) && (subLayer.children !== undefined && subLayer.children.length > 0);\n }\n\n private createId(props: MapSubLayerProps): string {\n return undefined !== props.id ? `${props.id}` : props.name ? props.name : \"no-id\";\n }\n\n private createNode(props: MapSubLayerProps, expanded?: boolean, isCheckboxDisabled?: boolean, icon?: string): DelayLoadedTreeNodeItem {\n return {\n id: this.createId(props),\n label: PropertyRecord.fromString(props.title ?? props.name ?? \"unknown\"),\n hasChildren: !!props.children,\n isCheckboxVisible: true,\n checkBoxState: props.visible && !isCheckboxDisabled ? CheckBoxState.On : CheckBoxState.Off,\n extendedData: { subLayerId: props.id },\n isCheckboxDisabled,\n autoExpand: expanded,\n icon,\n };\n }\n\n private loadChildNodes(allSubLayers: MapSubLayerProps[], parentId?: SubLayerId) {\n const filteredProps = allSubLayers.filter((props) => parentId === props.parent);\n if (filteredProps.length) {\n filteredProps?.sort((a: MapSubLayerProps, b: MapSubLayerProps) => compareStringsOrUndefined(a.title, b.title));\n const treeNodes: TreeNodeItem[] = [];\n\n filteredProps.forEach((props) => {\n treeNodes.push(this.createNode(props,\n (!parentId && props?.children !== undefined) ? true : undefined, // expand root group only (i.e. not the entire tree),\n undefined,\n SubLayersDataProvider.isUnnamedGroup(props) ? \"icon-folder\" : \"icon-layers\"\n\n ));\n if (props.children)\n this.loadChildNodes(allSubLayers, props.id);\n });\n\n this._nodeMap.set(undefined !== parentId ? `${parentId}` : \"\", treeNodes);\n }\n }\n\n private loadNodes(subLayerNodes: MapSubLayerProps[] | undefined) {\n subLayerNodes?.sort((a: MapSubLayerProps, b: MapSubLayerProps) => compareStringsOrUndefined(a.title, b.title));\n if (subLayerNodes) {\n this.loadChildNodes(subLayerNodes, undefined);\n }\n }\n\n public async getNodesCount(parent?: TreeNodeItem) {\n const nodeArray: TreeNodeItem[] | undefined = parent ? this._nodeMap.get(parent.id) : this._nodeMap.get(\"\");\n if (nodeArray)\n return nodeArray.length;\n\n return 0;\n }\n\n public async getNodes(parent?: TreeNodeItem) {\n const nodeArray: TreeNodeItem[] | undefined = parent ? this._nodeMap.get(parent.id) : this._nodeMap.get(\"\");\n if (nodeArray)\n return nodeArray;\n\n return [];\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"SubLayersTree.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/SubLayersTree.tsx"],"names":[],"mappings":"AAaA,OAAO,EAA8C,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAIlG,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAEtD,OAAO,sBAAsB,CAAC;AAkE9B,wBAAgB,cAAc,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,qBAAqB,CAAC;IAAC,QAAQ,EAAE,cAAc,GAAG,SAAS,CAAA;CAAE,eAW/H;AAsBD;;;GAGG;AAEH,wBAAgB,aAAa,CAAC,KAAK,EAAE;IAAE,QAAQ,EAAE,qBAAqB,CAAA;CAAE,eAoGvE"}
1
+ {"version":3,"file":"SubLayersTree.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/SubLayersTree.tsx"],"names":[],"mappings":"AAaA,OAAO,EAA8C,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAIlG,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAEtD,OAAO,sBAAsB,CAAC;AAiE9B,wBAAgB,cAAc,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,qBAAqB,CAAC;IAAC,QAAQ,EAAE,cAAc,GAAG,SAAS,CAAA;CAAE,eAW/H;AAsBD;;;GAGG;AAEH,wBAAgB,aAAa,CAAC,KAAK,EAAE;IAAE,QAAQ,EAAE,qBAAqB,CAAA;CAAE,eAkGvE"}
@@ -18,21 +18,19 @@ const getWindow = () => {
18
18
  const useResizeObserver = (onResize) => {
19
19
  const resizeObserver = React.useRef();
20
20
  const elementRef = React.useCallback((element) => {
21
- var _a, _b, _c;
22
- if (!((_a = getWindow()) === null || _a === void 0 ? void 0 : _a.ResizeObserver)) {
21
+ if (!getWindow()?.ResizeObserver) {
23
22
  return;
24
23
  }
25
- (_b = resizeObserver.current) === null || _b === void 0 ? void 0 : _b.disconnect();
24
+ resizeObserver.current?.disconnect();
26
25
  if (element) {
27
26
  resizeObserver.current = new ResizeObserver(([{ contentRect }]) => onResize(contentRect));
28
- (_c = resizeObserver.current) === null || _c === void 0 ? void 0 : _c.observe(element);
27
+ resizeObserver.current?.observe(element);
29
28
  }
30
29
  }, [onResize]);
31
30
  return [elementRef, resizeObserver.current];
32
31
  };
33
- /**
34
- Mimic processing of `react-resize-detector` to return width and height.
35
- * @internal
32
+ /** Mimic processing of `react-resize-detector` to return width and height.
33
+ * @internal
36
34
  */
37
35
  function useResizeDetector() {
38
36
  const [width, setWidth] = React.useState();
@@ -72,7 +70,7 @@ function getStyleMapLayerSettings(settings, isOverlay, layerIndex, treeVisibilit
72
70
  showSubLayers: true,
73
71
  isOverlay,
74
72
  layerIndex,
75
- provider: IModelApp.mapLayerFormatRegistry.createImageryProvider(settings),
73
+ provider: IModelApp.viewManager.selectedView?.getMapLayerImageryProvider({ index: layerIndex, isOverlay }),
76
74
  treeVisibility,
77
75
  };
78
76
  }
@@ -82,7 +80,6 @@ function getStyleMapLayerSettings(settings, isOverlay, layerIndex, treeVisibilit
82
80
  */
83
81
  // eslint-disable-next-line @typescript-eslint/naming-convention
84
82
  export function SubLayersTree(props) {
85
- var _a;
86
83
  const [placeholderLabel] = React.useState(MapLayersUI.localization.getLocalizedString("mapLayers:SubLayers.SearchPlaceholder"));
87
84
  const [allOnLabel] = React.useState(MapLayersUI.localization.getLocalizedString("mapLayers:SubLayers.AllOn"));
88
85
  const [allOffLabel] = React.useState(MapLayersUI.localization.getLocalizedString("mapLayers:SubLayers.AllOff"));
@@ -102,15 +99,14 @@ export function SubLayersTree(props) {
102
99
  const treeModel = useTreeModel(modelSource);
103
100
  const showAll = React.useCallback(async () => {
104
101
  const vp = IModelApp.viewManager.selectedView;
105
- const displayStyle = vp === null || vp === void 0 ? void 0 : vp.displayStyle;
102
+ const displayStyle = vp?.displayStyle;
106
103
  if (displayStyle && vp) {
107
104
  const indexInDisplayStyle = displayStyle ? displayStyle.findMapLayerIndexByNameAndSource(mapLayer.name, mapLayer.source, mapLayer.isOverlay) : -1;
108
- displayStyle.changeMapSubLayerProps({ visible: true }, -1, indexInDisplayStyle, mapLayer.isOverlay);
109
- vp.invalidateRenderPlan();
110
- const updatedMapLayer = displayStyle.mapLayerAtIndex(indexInDisplayStyle, mapLayer.isOverlay);
105
+ displayStyle.changeMapSubLayerProps({ visible: true }, -1, { index: indexInDisplayStyle, isOverlay: mapLayer.isOverlay });
106
+ const updatedMapLayer = displayStyle.mapLayerAtIndex({ index: indexInDisplayStyle, isOverlay: mapLayer.isOverlay });
111
107
  if (updatedMapLayer) {
112
108
  if (updatedMapLayer instanceof ImageMapLayerSettings) {
113
- const treeVisibility = vp.getMapLayerScaleRangeVisibility(indexInDisplayStyle, mapLayer.isOverlay);
109
+ const treeVisibility = vp.getMapLayerScaleRangeVisibility({ index: indexInDisplayStyle, isOverlay: mapLayer.isOverlay });
114
110
  setMapLayer(getStyleMapLayerSettings(updatedMapLayer, mapLayer.isOverlay, indexInDisplayStyle, treeVisibility));
115
111
  }
116
112
  }
@@ -118,16 +114,15 @@ export function SubLayersTree(props) {
118
114
  }, [mapLayer]);
119
115
  const hideAll = React.useCallback(async () => {
120
116
  const vp = IModelApp.viewManager.selectedView;
121
- const displayStyle = vp === null || vp === void 0 ? void 0 : vp.displayStyle;
117
+ const displayStyle = vp?.displayStyle;
122
118
  if (displayStyle && vp) {
123
119
  const indexInDisplayStyle = displayStyle ? displayStyle.findMapLayerIndexByNameAndSource(mapLayer.name, mapLayer.source, mapLayer.isOverlay) : -1;
124
- displayStyle.changeMapSubLayerProps({ visible: false }, -1, indexInDisplayStyle, mapLayer.isOverlay);
125
- const updatedMapLayer = displayStyle.mapLayerAtIndex(indexInDisplayStyle, mapLayer.isOverlay);
120
+ displayStyle.changeMapSubLayerProps({ visible: false }, -1, { index: indexInDisplayStyle, isOverlay: mapLayer.isOverlay });
121
+ const updatedMapLayer = displayStyle.mapLayerAtIndex({ index: indexInDisplayStyle, isOverlay: mapLayer.isOverlay });
126
122
  if (updatedMapLayer && updatedMapLayer instanceof ImageMapLayerSettings) {
127
- const treeVisibility = vp.getMapLayerScaleRangeVisibility(indexInDisplayStyle, mapLayer.isOverlay);
123
+ const treeVisibility = vp.getMapLayerScaleRangeVisibility({ index: indexInDisplayStyle, isOverlay: mapLayer.isOverlay });
128
124
  setMapLayer(getStyleMapLayerSettings(updatedMapLayer, mapLayer.isOverlay, indexInDisplayStyle, treeVisibility));
129
125
  }
130
- vp.invalidateRenderPlan();
131
126
  }
132
127
  }, [mapLayer]);
133
128
  const handleFilterTextChanged = React.useCallback((event) => {
@@ -136,7 +131,7 @@ export function SubLayersTree(props) {
136
131
  const { width, height, ref: containerRef } = useResizeDetector();
137
132
  return React.createElement(React.Fragment, null,
138
133
  React.createElement("div", { className: "map-manager-sublayer-tree" },
139
- React.createElement(Toolbar, { searchField: React.createElement(Input, { type: "text", className: "map-manager-source-list-filter", placeholder: placeholderLabel, value: layerFilterString, onChange: handleFilterTextChanged, size: "small" }) }, ((_a = mapLayer.provider) === null || _a === void 0 ? void 0 : _a.mutualExclusiveSubLayer) ? undefined : [
134
+ React.createElement(Toolbar, { searchField: React.createElement(Input, { type: "text", className: "map-manager-source-list-filter", placeholder: placeholderLabel, value: layerFilterString, onChange: handleFilterTextChanged, size: "small" }) }, mapLayer.provider?.mutualExclusiveSubLayer ? undefined : [
140
135
  React.createElement(Button, { size: "small", styleType: "borderless", key: "show-all-btn", title: allOnLabel, onClick: showAll },
141
136
  React.createElement(WebFontIcon, { iconName: "icon-visibility" })),
142
137
  React.createElement(Button, { size: "small", styleType: "borderless", key: "hide-all-btn", title: allOffLabel, onClick: hideAll },
@@ -192,10 +187,10 @@ class SubLayerCheckboxHandler extends TreeEventHandler {
192
187
  }
193
188
  applyMutualExclusiveState(model, nodeId) {
194
189
  const changedNode = model.getNode(nodeId);
195
- if ((changedNode === null || changedNode === void 0 ? void 0 : changedNode.checkbox.state) === CheckBoxState.Off)
190
+ if (changedNode?.checkbox.state === CheckBoxState.Off)
196
191
  return;
197
192
  for (const node of model.iterateTreeModelNodes()) {
198
- if (node.id === (changedNode === null || changedNode === void 0 ? void 0 : changedNode.id))
193
+ if (node.id === changedNode?.id)
199
194
  continue;
200
195
  if (node && node.checkbox.state === CheckBoxState.On)
201
196
  node.checkbox.state = CheckBoxState.Off;
@@ -208,7 +203,6 @@ class SubLayerCheckboxHandler extends TreeEventHandler {
208
203
  }
209
204
  // Ensure the state of changed node matches the state of its parent.
210
205
  syncNodeStateWithParent(model, changedNode) {
211
- var _a, _b, _c, _d, _e, _f;
212
206
  // Lookup node parent. If non exists, I assume thats the root node,
213
207
  // and it must have a proper initial state.
214
208
  const parentNode = changedNode.parentId ? model.getNode(changedNode.parentId) : undefined;
@@ -216,8 +210,8 @@ class SubLayerCheckboxHandler extends TreeEventHandler {
216
210
  return;
217
211
  if (!changedNode.checkbox)
218
212
  return; // don't see why this would happen, but if there is no checkbox, we cant do much here.
219
- const parentLayerId = undefined !== ((_a = parentNode.item.extendedData) === null || _a === void 0 ? void 0 : _a.subLayerId) ? (_b = parentNode.item.extendedData) === null || _b === void 0 ? void 0 : _b.subLayerId : parentNode.item.id;
220
- const parentSubLayer = (_c = this._mapLayer.subLayers) === null || _c === void 0 ? void 0 : _c.find((subLayer) => subLayer.id === parentLayerId);
213
+ const parentLayerId = undefined !== parentNode.item.extendedData?.subLayerId ? parentNode.item.extendedData?.subLayerId : parentNode.item.id;
214
+ const parentSubLayer = this._mapLayer.subLayers?.find((subLayer) => subLayer.id === parentLayerId);
221
215
  // If parent is disabled, then children must be too.
222
216
  // Also, Non-visible unnamed group must have their children disabled (unamed groups have visibility inherence)
223
217
  if (parentNode.checkbox.isDisabled || (SubLayerCheckboxHandler.isUnnamedGroup(parentSubLayer) && parentNode.checkbox.state === CheckBoxState.Off)) {
@@ -226,10 +220,10 @@ class SubLayerCheckboxHandler extends TreeEventHandler {
226
220
  }
227
221
  else {
228
222
  // Visibility state from StyleMapLayerSettings applies
229
- const subLayerId = undefined !== ((_d = changedNode.item.extendedData) === null || _d === void 0 ? void 0 : _d.subLayerId) ? (_e = changedNode.item.extendedData) === null || _e === void 0 ? void 0 : _e.subLayerId : changedNode.item.id;
230
- const foundSubLayer = (_f = this._mapLayer.subLayers) === null || _f === void 0 ? void 0 : _f.find((subLayer) => subLayer.id === subLayerId);
223
+ const subLayerId = undefined !== changedNode.item.extendedData?.subLayerId ? changedNode.item.extendedData?.subLayerId : changedNode.item.id;
224
+ const foundSubLayer = this._mapLayer.subLayers?.find((subLayer) => subLayer.id === subLayerId);
231
225
  changedNode.checkbox.isDisabled = false;
232
- changedNode.checkbox.state = (foundSubLayer === null || foundSubLayer === void 0 ? void 0 : foundSubLayer.visible) ? CheckBoxState.On : CheckBoxState.Off;
226
+ changedNode.checkbox.state = foundSubLayer?.visible ? CheckBoxState.On : CheckBoxState.Off;
233
227
  }
234
228
  }
235
229
  /** Changes nodes checkboxes states until event is handled or handler is disposed */
@@ -240,43 +234,39 @@ class SubLayerCheckboxHandler extends TreeEventHandler {
240
234
  const selectionHandling = stateChanges.subscribe({
241
235
  next: (changes) => {
242
236
  const vp = IModelApp.viewManager.selectedView;
243
- const displayStyle = vp === null || vp === void 0 ? void 0 : vp.displayStyle;
237
+ const displayStyle = vp?.displayStyle;
244
238
  const indexInDisplayStyle = displayStyle ? displayStyle.findMapLayerIndexByNameAndSource(this._mapLayer.name, this._mapLayer.source, this._mapLayer.isOverlay) : -1;
245
239
  changes.forEach((change) => {
246
- var _a, _b, _c, _d, _e;
247
240
  const isSelected = (change.newState === CheckBoxState.On);
248
- const subLayerId = undefined !== ((_a = change.nodeItem.extendedData) === null || _a === void 0 ? void 0 : _a.subLayerId) ? (_b = change.nodeItem.extendedData) === null || _b === void 0 ? void 0 : _b.subLayerId : change.nodeItem.id;
241
+ const subLayerId = undefined !== change.nodeItem.extendedData?.subLayerId ? change.nodeItem.extendedData?.subLayerId : change.nodeItem.id;
249
242
  // Get the previously visible node if any
250
243
  let prevVisibleLayer;
251
- if ((_c = this._mapLayer.provider) === null || _c === void 0 ? void 0 : _c.mutualExclusiveSubLayer) {
252
- prevVisibleLayer = (_d = this._mapLayer.subLayers) === null || _d === void 0 ? void 0 : _d.find((subLayer) => subLayer.visible && subLayer.id !== subLayerId);
244
+ if (this._mapLayer.provider?.mutualExclusiveSubLayer) {
245
+ prevVisibleLayer = this._mapLayer.subLayers?.find((subLayer) => subLayer.visible && subLayer.id !== subLayerId);
253
246
  }
254
247
  // Update sublayer object, otherwise state would get out of sync with DisplayStyle each time the TreeView is re-rendered
255
- const foundSubLayer = (_e = this._mapLayer.subLayers) === null || _e === void 0 ? void 0 : _e.find((subLayer) => subLayer.id === subLayerId);
248
+ const foundSubLayer = this._mapLayer.subLayers?.find((subLayer) => subLayer.id === subLayerId);
256
249
  if (foundSubLayer)
257
250
  foundSubLayer.visible = isSelected;
258
- if (prevVisibleLayer === null || prevVisibleLayer === void 0 ? void 0 : prevVisibleLayer.visible)
251
+ if (prevVisibleLayer?.visible)
259
252
  prevVisibleLayer.visible = false;
260
253
  // Update displaystyle state
261
254
  if (-1 !== indexInDisplayStyle && displayStyle) {
262
255
  if (prevVisibleLayer && prevVisibleLayer.id !== undefined)
263
- displayStyle.changeMapSubLayerProps({ visible: false }, prevVisibleLayer.id, indexInDisplayStyle, this._mapLayer.isOverlay);
264
- displayStyle.changeMapSubLayerProps({ visible: isSelected }, subLayerId, indexInDisplayStyle, this._mapLayer.isOverlay);
256
+ displayStyle.changeMapSubLayerProps({ visible: false }, prevVisibleLayer.id, { index: indexInDisplayStyle, isOverlay: this._mapLayer.isOverlay });
257
+ displayStyle.changeMapSubLayerProps({ visible: isSelected }, subLayerId, { index: indexInDisplayStyle, isOverlay: this._mapLayer.isOverlay });
265
258
  }
266
259
  // Cascade state
267
260
  this.modelSource.modifyModel((model) => {
268
- var _a;
269
- if ((_a = this._mapLayer.provider) === null || _a === void 0 ? void 0 : _a.mutualExclusiveSubLayer)
261
+ if (this._mapLayer.provider?.mutualExclusiveSubLayer)
270
262
  this.applyMutualExclusiveState(model, change.nodeItem.id);
271
263
  this.cascadeStateToAllChildren(model, change.nodeItem.id);
272
264
  });
273
265
  });
274
- if (vp)
275
- vp.invalidateRenderPlan();
276
266
  },
277
267
  });
278
268
  // stop handling selection when checkboxes handling is stopped
279
- baseHandling === null || baseHandling === void 0 ? void 0 : baseHandling.add(selectionHandling);
269
+ baseHandling?.add(selectionHandling);
280
270
  return baseHandling;
281
271
  }
282
272
  }
@@ -329,7 +319,7 @@ class FullTreeHierarchy {
329
319
  }
330
320
  async initNode(parent) {
331
321
  const nodes = await this._dataProvider.getNodes(parent);
332
- this._hierarchy.set(parent === null || parent === void 0 ? void 0 : parent.id, nodes);
322
+ this._hierarchy.set(parent?.id, nodes);
333
323
  for (const node of nodes) {
334
324
  await this.initNode(node);
335
325
  }
@@ -359,7 +349,7 @@ class FilteredTreeHierarchy {
359
349
  /** Initializes `this._filtered` field. Returns a node if it matches a filter. */
360
350
  filterNodes(hierarchy, current) {
361
351
  const matches = current ? this.matchesFilter(current) : false;
362
- const children = hierarchy.get(current === null || current === void 0 ? void 0 : current.id);
352
+ const children = hierarchy.get(current?.id);
363
353
  if (!children)
364
354
  return matches ? current : undefined;
365
355
  const matchedChildren = new Array();
@@ -371,7 +361,7 @@ class FilteredTreeHierarchy {
371
361
  const included = matches || hasChildren;
372
362
  let filtered;
373
363
  if (included) {
374
- this._filtered.set(current === null || current === void 0 ? void 0 : current.id, matchedChildren);
364
+ this._filtered.set(current?.id, matchedChildren);
375
365
  // Return a modified copy of current node (to persist initial hierarchy when filter is cleared).
376
366
  if (current) {
377
367
  filtered = {
@@ -384,10 +374,9 @@ class FilteredTreeHierarchy {
384
374
  return filtered;
385
375
  }
386
376
  matchesFilter(node) {
387
- var _a;
388
377
  if (node.label.value.valueFormat !== PropertyValueFormat.Primitive)
389
378
  return false;
390
- const value = (_a = node.label.value.displayValue) === null || _a === void 0 ? void 0 : _a.toLowerCase();
379
+ const value = node.label.value.displayValue?.toLowerCase();
391
380
  if (!value)
392
381
  return false;
393
382
  return value.includes(this._filter.toLowerCase());
@@ -403,13 +392,13 @@ class FilteredTreeDataProvider {
403
392
  }
404
393
  async getNodes(parent) {
405
394
  const hierarchy = await this._hierarchy.getHierarchy();
406
- const nodes = hierarchy.get(parent === null || parent === void 0 ? void 0 : parent.id);
395
+ const nodes = hierarchy.get(parent?.id);
407
396
  return nodes || [];
408
397
  }
409
398
  async getNodesCount(parent) {
410
399
  const hierarchy = await this._hierarchy.getHierarchy();
411
- const nodes = hierarchy.get(parent === null || parent === void 0 ? void 0 : parent.id);
412
- return (nodes === null || nodes === void 0 ? void 0 : nodes.length) || 0;
400
+ const nodes = hierarchy.get(parent?.id);
401
+ return nodes?.length || 0;
413
402
  }
414
403
  }
415
404
  //# sourceMappingURL=SubLayersTree.js.map
@@ -1 +1 @@
1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C,CAAC;IACpD,CAAC;IAEM,KAAK,CAAC,YAAY;QACvB,MAAM,IAAI,CAAC,KAAK,CAAC;QACjB,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;CACF;AAED,MAAM,wBAAwB;IAG5B,YACE,kBAAqC,EACrC,MAAc;QAEd,IAAI,CAAC,UAAU,GAAG,IAAI,qBAAqB,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAAC;IAC1E,CAAC;IAEM,KAAK,CAAC,QAAQ,CAAC,MAAqB;QACzC,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,YAAY,EAAE,CAAC;QACvD,MAAM,KAAK,GAAG,SAAS,CAAC,GAAG,CAAC,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,EAAE,CAAC,CAAC;QACxC,OAAO,KAAK,IAAI,EAAE,CAAC;IACrB,CAAC;IAEM,KAAK,CAAC,aAAa,CAAC,MAAqB;QAC9C,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,YAAY,EAAE,CAAC;QACvD,MAAM,KAAK,GAAG,SAAS,CAAC,GAAG,CAAC,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,EAAE,CAAC,CAAC;QACxC,OAAO,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,MAAM,KAAI,CAAC,CAAC;IAC5B,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport { PropertyValueFormat } from \"@itwin/appui-abstract\";\nimport {\n AbstractTreeNodeLoaderWithProvider, ControlledTree, DelayLoadedTreeNodeItem, HighlightableTreeProps, ITreeDataProvider,\n MutableTreeModel,\n MutableTreeModelNode,\n SelectionMode, TreeCheckboxStateChangeEventArgs, TreeDataProvider, TreeEventHandler, TreeImageLoader, TreeModel, TreeModelChanges, TreeModelSource, TreeNodeItem, TreeNodeLoader,\n TreeNodeRenderer, TreeNodeRendererProps, TreeRenderer, TreeRendererProps, useTreeModel,\n} from \"@itwin/components-react\";\nimport { ImageMapLayerSettings, MapSubLayerProps, MapSubLayerSettings } from \"@itwin/core-common\";\nimport { IModelApp, MapTileTreeScaleRangeVisibility, ScreenViewport } from \"@itwin/core-frontend\";\nimport { CheckBoxState, ImageCheckBox, NodeCheckboxRenderProps, useDisposable, WebFontIcon } from \"@itwin/core-react\";\nimport { Button, Input } from \"@itwin/itwinui-react\";\nimport * as React from \"react\";\nimport { StyleMapLayerSettings } from \"../Interfaces\";\nimport { SubLayersDataProvider } from \"./SubLayersDataProvider\";\nimport \"./SubLayersTree.scss\";\nimport { MapLayersUI } from \"../../mapLayers\";\n\nconst getWindow = () => {\n return typeof window === \"undefined\" ? undefined : window;\n};\n\nconst useResizeObserver = <T extends HTMLElement>(\n onResize: (size: DOMRectReadOnly) => void,\n) => {\n const resizeObserver = React.useRef<ResizeObserver>();\n\n const elementRef = React.useCallback(\n (element: T | null) => {\n if (!getWindow()?.ResizeObserver) {\n return;\n }\n\n resizeObserver.current?.disconnect();\n if (element) {\n resizeObserver.current = new ResizeObserver(([{ contentRect }]) =>\n onResize(contentRect),\n );\n resizeObserver.current?.observe(element);\n }\n },\n [onResize],\n );\n\n return [elementRef, resizeObserver.current] as const;\n};\n\n/**\n Mimic processing of `react-resize-detector` to return width and height.\n* @internal\n */\nfunction useResizeDetector(): { width: number | undefined, height: number | undefined, ref: React.Ref<HTMLDivElement> } {\n const [width, setWidth] = React.useState<number>();\n const [height, setHeight] = React.useState<number>();\n const [ref] = useResizeObserver(React.useCallback((size: DOMRectReadOnly) => {\n setWidth(size.width);\n setHeight(size.height);\n }, []));\n return { width, height, ref };\n}\n\ninterface ToolbarProps {\n searchField?: React.ReactNode;\n children?: React.ReactNode[];\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nfunction Toolbar(props: ToolbarProps) {\n return (\n <div className=\"map-manager-sublayer-tree-toolbar\">\n <div className=\"tree-toolbar-action-buttons\">\n {props.children}\n </div>\n {props.searchField && <div className=\"tree-toolbar-searchbox\">\n {props.searchField}\n </div>}\n </div>\n );\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function SubLayersPanel({ mapLayer, viewport }: { mapLayer: StyleMapLayerSettings, viewport: ScreenViewport | undefined }) {\n const [noneAvailableLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:SubLayers.NoSubLayers\"));\n if (!viewport || (undefined === mapLayer.subLayers || 0 === mapLayer.subLayers.length)) {\n return <div className=\"map-manager-sublayer-panel\">\n <div>{noneAvailableLabel}</div>\n </div>;\n }\n\n return (\n <SubLayersTree mapLayer={mapLayer} />\n );\n}\n\nfunction getSubLayerProps(subLayerSettings: MapSubLayerSettings[]): MapSubLayerProps[] {\n return subLayerSettings.map((subLayer) => subLayer.toJSON());\n}\n\nfunction getStyleMapLayerSettings(settings: ImageMapLayerSettings, isOverlay: boolean, layerIndex: number, treeVisibility: MapTileTreeScaleRangeVisibility): StyleMapLayerSettings {\n return {\n visible: settings.visible,\n name: settings.name,\n source: settings.source,\n transparency: settings.transparency,\n transparentBackground: settings.transparentBackground,\n subLayers: settings.subLayers ? getSubLayerProps(settings.subLayers) : undefined,\n showSubLayers: true,\n isOverlay,\n layerIndex,\n provider: IModelApp.mapLayerFormatRegistry.createImageryProvider(settings),\n treeVisibility,\n };\n}\n\n/**\n * Tree Control that displays sub-layer hierarchy\n * @internal\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function SubLayersTree(props: { mapLayer: StyleMapLayerSettings }) {\n const [placeholderLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:SubLayers.SearchPlaceholder\"));\n const [allOnLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:SubLayers.AllOn\"));\n const [allOffLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:SubLayers.AllOff\"));\n const [mapLayer, setMapLayer] = React.useState(props.mapLayer);\n const [layerFilterString, setLayerFilterString] = React.useState<string>(\"\");\n\n // create data provider to get some nodes to show in tree\n // `React.useMemo' is used avoid creating new object on each render cycle\n const dataProvider = React.useMemo(() => new SubLayersDataProvider(mapLayer), [mapLayer]);\n\n const {\n modelSource,\n nodeLoader,\n nodeHighlightingProps,\n } = useTreeFiltering(dataProvider, layerFilterString);\n\n // create custom event handler. It handles all tree event same as `TreeEventHandler` but additionally\n // it selects/deselects node when checkbox is checked/unchecked and vice versa.\n // `useDisposable` takes care of disposing old event handler when new is created in case 'nodeLoader' has changed\n // `React.useCallback` is used to avoid creating new callback that creates handler on each render\n const eventHandler = useDisposable(React.useCallback(() => new SubLayerCheckboxHandler(mapLayer, nodeLoader), [nodeLoader, mapLayer]));\n\n // Get an immutable tree model from the model source. The model is regenerated every time the model source\n // emits the `onModelChanged` event.\n const treeModel = useTreeModel(modelSource);\n\n const showAll = React.useCallback(async () => {\n const vp = IModelApp.viewManager.selectedView;\n const displayStyle = vp?.displayStyle;\n if (displayStyle && vp) {\n const indexInDisplayStyle = displayStyle ? displayStyle.findMapLayerIndexByNameAndSource(mapLayer.name, mapLayer.source, mapLayer.isOverlay) : -1;\n displayStyle.changeMapSubLayerProps({ visible: true }, -1, indexInDisplayStyle, mapLayer.isOverlay);\n vp.invalidateRenderPlan();\n const updatedMapLayer = displayStyle.mapLayerAtIndex(indexInDisplayStyle, mapLayer.isOverlay);\n if (updatedMapLayer) {\n if (updatedMapLayer instanceof ImageMapLayerSettings) {\n const treeVisibility = vp.getMapLayerScaleRangeVisibility(indexInDisplayStyle, mapLayer.isOverlay);\n setMapLayer(getStyleMapLayerSettings(updatedMapLayer, mapLayer.isOverlay, indexInDisplayStyle, treeVisibility));\n }\n\n }\n }\n }, [mapLayer]);\n\n const hideAll = React.useCallback(async () => {\n const vp = IModelApp.viewManager.selectedView;\n const displayStyle = vp?.displayStyle;\n if (displayStyle && vp) {\n const indexInDisplayStyle = displayStyle ? displayStyle.findMapLayerIndexByNameAndSource(mapLayer.name, mapLayer.source, mapLayer.isOverlay) : -1;\n displayStyle.changeMapSubLayerProps({ visible: false }, -1, indexInDisplayStyle, mapLayer.isOverlay);\n const updatedMapLayer = displayStyle.mapLayerAtIndex(indexInDisplayStyle, mapLayer.isOverlay);\n if (updatedMapLayer && updatedMapLayer instanceof ImageMapLayerSettings) {\n const treeVisibility = vp.getMapLayerScaleRangeVisibility(indexInDisplayStyle, mapLayer.isOverlay);\n setMapLayer(getStyleMapLayerSettings(updatedMapLayer, mapLayer.isOverlay, indexInDisplayStyle, treeVisibility));\n }\n vp.invalidateRenderPlan();\n }\n }, [mapLayer]);\n\n const handleFilterTextChanged = React.useCallback((event: React.ChangeEvent<HTMLInputElement>) => {\n setLayerFilterString(event.target.value);\n }, []);\n\n const { width, height, ref: containerRef } = useResizeDetector();\n\n return <>\n <div className=\"map-manager-sublayer-tree\">\n <Toolbar\n searchField={\n <Input type=\"text\" className=\"map-manager-source-list-filter\"\n placeholder={placeholderLabel}\n value={layerFilterString}\n onChange={handleFilterTextChanged}\n size=\"small\" />\n }\n >\n {mapLayer.provider?.mutualExclusiveSubLayer ? undefined : [\n <Button size=\"small\" styleType=\"borderless\" key=\"show-all-btn\" title={allOnLabel} onClick={showAll}>\n <WebFontIcon iconName=\"icon-visibility\" />\n </Button>,\n <Button size=\"small\" styleType=\"borderless\" key=\"hide-all-btn\" title={allOffLabel} onClick={hideAll}>\n <WebFontIcon iconName=\"icon-visibility-hide-2\" />\n </Button>,\n ]}\n </Toolbar>\n <div ref={containerRef} className=\"map-manager-sublayer-tree-content\">\n {width !== undefined && height !== undefined && <ControlledTree\n nodeLoader={nodeLoader}\n selectionMode={SelectionMode.None}\n eventsHandler={eventHandler}\n model={treeModel}\n treeRenderer={nodeWithEyeCheckboxTreeRenderer}\n nodeHighlightingProps={nodeHighlightingProps}\n width={width}\n height={height}\n />}\n </div>\n </div>\n </>;\n}\n\n/** TreeEventHandler derived class that handler processing changes to subLayer visibility */\nclass SubLayerCheckboxHandler extends TreeEventHandler {\n private _removeModelChangedListener: () => void;\n\n constructor(private _mapLayer: StyleMapLayerSettings, nodeLoader: AbstractTreeNodeLoaderWithProvider<TreeDataProvider>) {\n super({ modelSource: nodeLoader.modelSource, nodeLoader, collapsedChildrenDisposalEnabled: true });\n this._removeModelChangedListener = this.modelSource.onModelChanged.addListener(this.onModelChanged);\n }\n\n public override dispose() {\n this._removeModelChangedListener();\n super.dispose();\n }\n\n // Cascade state\n // Children on unnamed groups must get disabled in the tree view, because\n // they get rendered anyway.\n private cascadeStateToAllChildren(model: MutableTreeModel, parentId?: string) {\n const children = model.getChildren(parentId);\n if (children === undefined)\n return;\n\n for (const childID of children) {\n const childNode = childID ? model.getNode(childID) : undefined;\n\n if (childNode)\n this.syncNodeStateWithParent(model, childNode);\n\n // Drill down the tree.\n this.cascadeStateToAllChildren(model, childID);\n }\n }\n\n private applyMutualExclusiveState(model: MutableTreeModel, nodeId: string) {\n const changedNode = model.getNode(nodeId);\n if (changedNode?.checkbox.state === CheckBoxState.Off)\n return;\n\n for (const node of model.iterateTreeModelNodes()) {\n if (node.id === changedNode?.id)\n continue;\n\n if (node && node.checkbox.state === CheckBoxState.On)\n node.checkbox.state = CheckBoxState.Off;\n }\n }\n\n //-----------------------------------------------------------------------\n // Listen to model changes\n //------------------------------------------------------------------------\n // This is required because nodes are delay loaded in the model until\n // they are made visible (i.e. parent node is expanded). So even though\n // you might have created nodes in the data provided with a proper\n // initial state, by the time it gets loaded, their state might have became\n // out of date in the TreeView's active model. So whenever a node\n // is added, when must confirm its state matches the current model\n // (i.e. state of their parent.)\n public onModelChanged = (args: [TreeModel, TreeModelChanges]) => {\n this.modelSource.modifyModel((model) => {\n const addedNodes = args[1].addedNodeIds.map((id) => model.getNode(id));\n addedNodes.forEach((node) => {\n if (!node)\n return;\n\n this.syncNodeStateWithParent(model, node);\n });\n });\n };\n\n private static isUnnamedGroup(subLayer: MapSubLayerProps | undefined): boolean {\n if (!subLayer)\n return false;\n\n return (!subLayer.name || subLayer.name.length === 0) && (subLayer.children !== undefined && subLayer.children.length > 0);\n }\n\n // Ensure the state of changed node matches the state of its parent.\n private syncNodeStateWithParent(model: MutableTreeModel, changedNode: MutableTreeModelNode) {\n // Lookup node parent. If non exists, I assume thats the root node,\n // and it must have a proper initial state.\n const parentNode = changedNode.parentId ? model.getNode(changedNode.parentId) : undefined;\n if (!parentNode)\n return;\n\n if (!changedNode.checkbox)\n return; // don't see why this would happen, but if there is no checkbox, we cant do much here.\n\n const parentLayerId = undefined !== parentNode.item.extendedData?.subLayerId ? parentNode.item.extendedData?.subLayerId : parentNode.item.id;\n const parentSubLayer = this._mapLayer.subLayers?.find((subLayer) => subLayer.id === parentLayerId);\n\n // If parent is disabled, then children must be too.\n // Also, Non-visible unnamed group must have their children disabled (unamed groups have visibility inherence)\n if (parentNode.checkbox.isDisabled || (SubLayerCheckboxHandler.isUnnamedGroup(parentSubLayer) && parentNode.checkbox.state === CheckBoxState.Off)) {\n changedNode.checkbox.isDisabled = true;\n changedNode.checkbox.state = CheckBoxState.Off;\n } else {\n // Visibility state from StyleMapLayerSettings applies\n const subLayerId = undefined !== changedNode.item.extendedData?.subLayerId ? changedNode.item.extendedData?.subLayerId : changedNode.item.id;\n const foundSubLayer = this._mapLayer.subLayers?.find((subLayer) => subLayer.id === subLayerId);\n changedNode.checkbox.isDisabled = false;\n changedNode.checkbox.state = foundSubLayer?.visible ? CheckBoxState.On : CheckBoxState.Off;\n }\n }\n\n /** Changes nodes checkboxes states until event is handled or handler is disposed */\n public override onCheckboxStateChanged({ stateChanges }: TreeCheckboxStateChangeEventArgs) {\n // call base checkbox handling\n const baseHandling = super.onCheckboxStateChanged({ stateChanges });\n\n // subscribe to checkbox state changes to new checkbox states and do some additional work with them\n const selectionHandling = stateChanges.subscribe({\n next: (changes) => {\n const vp = IModelApp.viewManager.selectedView;\n const displayStyle = vp?.displayStyle;\n const indexInDisplayStyle = displayStyle ? displayStyle.findMapLayerIndexByNameAndSource(this._mapLayer.name, this._mapLayer.source, this._mapLayer.isOverlay) : -1;\n changes.forEach((change) => {\n const isSelected = (change.newState === CheckBoxState.On);\n\n const subLayerId = undefined !== change.nodeItem.extendedData?.subLayerId ? change.nodeItem.extendedData?.subLayerId : change.nodeItem.id;\n\n // Get the previously visible node if any\n let prevVisibleLayer: MapSubLayerProps | undefined;\n if (this._mapLayer.provider?.mutualExclusiveSubLayer) {\n prevVisibleLayer = this._mapLayer.subLayers?.find((subLayer) => subLayer.visible && subLayer.id !== subLayerId);\n }\n\n // Update sublayer object, otherwise state would get out of sync with DisplayStyle each time the TreeView is re-rendered\n const foundSubLayer = this._mapLayer.subLayers?.find((subLayer) => subLayer.id === subLayerId);\n if (foundSubLayer)\n foundSubLayer.visible = isSelected;\n if (prevVisibleLayer?.visible)\n prevVisibleLayer.visible = false;\n\n // Update displaystyle state\n if (-1 !== indexInDisplayStyle && displayStyle) {\n if (prevVisibleLayer && prevVisibleLayer.id !== undefined)\n displayStyle.changeMapSubLayerProps({ visible: false }, prevVisibleLayer.id, indexInDisplayStyle, this._mapLayer.isOverlay);\n displayStyle.changeMapSubLayerProps({ visible: isSelected }, subLayerId, indexInDisplayStyle, this._mapLayer.isOverlay);\n }\n\n // Cascade state\n this.modelSource.modifyModel((model) => {\n if (this._mapLayer.provider?.mutualExclusiveSubLayer)\n this.applyMutualExclusiveState(model, change.nodeItem.id);\n this.cascadeStateToAllChildren(model, change.nodeItem.id);\n });\n });\n\n if (vp)\n vp.invalidateRenderPlan();\n },\n });\n // stop handling selection when checkboxes handling is stopped\n baseHandling?.add(selectionHandling);\n return baseHandling;\n }\n}\n\n/** Custom checkbox renderer that renders checkbox as an eye */\nconst eyeCheckboxRenderer = (props: NodeCheckboxRenderProps) => (\n <ImageCheckBox\n checked={props.checked}\n disabled={props.disabled}\n imageOn=\"icon-visibility\"\n imageOff=\"icon-visibility-hide-2\"\n onClick={props.onChange}\n tooltip={props.title}\n />\n);\n\n/** Custom node renderer. It uses default 'TreeNodeRenderer' but overrides default checkbox renderer to render checkbox as an eye */\nconst imageLoader = new TreeImageLoader();\nconst nodeWithEyeCheckboxRenderer = (props: TreeNodeRendererProps) => (\n <TreeNodeRenderer\n {...props}\n checkboxRenderer={eyeCheckboxRenderer}\n imageLoader={imageLoader}\n />\n);\n\n/** Custom tree renderer. It uses default `TreeRenderer` but overrides default node renderer to render node with custom checkbox */\nconst nodeWithEyeCheckboxTreeRenderer = (props: TreeRendererProps) => (\n <TreeRenderer\n {...props}\n nodeRenderer={nodeWithEyeCheckboxRenderer}\n />\n);\n\nfunction useTreeFiltering(\n dataProvider: ITreeDataProvider,\n filter: string,\n) {\n const nodeLoader = useFilteredProvider(dataProvider, filter);\n const nodeHighlightingProps = useNodeHighlightingProps(filter);\n return {\n nodeLoader,\n modelSource: nodeLoader.modelSource,\n nodeHighlightingProps,\n };\n}\n\nfunction useFilteredProvider(\n dataProvider: ITreeDataProvider,\n filter: string,\n) {\n const filteredProvider = React.useMemo(() => {\n return new FilteredTreeDataProvider(dataProvider, filter);\n }, [dataProvider, filter]);\n\n const nodeLoader = React.useMemo(() => {\n return new TreeNodeLoader(filteredProvider, new TreeModelSource());\n }, [filteredProvider]);\n\n return nodeLoader;\n}\n\nfunction useNodeHighlightingProps(\n filter: string,\n) {\n const [nodeHighlightingProps, setNodeHighlightingProps] = React.useState<HighlightableTreeProps>();\n\n React.useEffect(() => {\n if (filter === \"\") {\n setNodeHighlightingProps(undefined);\n return;\n }\n setNodeHighlightingProps({\n searchText: filter,\n activeMatch: undefined,\n });\n }, [filter]);\n\n return nodeHighlightingProps;\n}\n\nclass FullTreeHierarchy {\n private _dataProvider: ITreeDataProvider;\n private _hierarchy = new Map<string | undefined, DelayLoadedTreeNodeItem[]>();\n private _init: Promise<void>;\n\n public constructor(dataProvider: ITreeDataProvider) {\n this._dataProvider = dataProvider;\n\n this._init = (async () => {\n await this.initNode();\n })();\n }\n\n private async initNode(parent?: TreeNodeItem) {\n const nodes = await this._dataProvider.getNodes(parent);\n this._hierarchy.set(parent?.id, nodes);\n for (const node of nodes) {\n await this.initNode(node);\n }\n }\n\n public async getHierarchy() {\n await this._init;\n return this._hierarchy;\n }\n}\n\nclass FilteredTreeHierarchy {\n private _fullHierarchy: FullTreeHierarchy;\n private _filter: string;\n private _filtered = new Map<string | undefined, DelayLoadedTreeNodeItem[]>();\n private _init: Promise<void>;\n\n public constructor(dataProvider: ITreeDataProvider, filter: string) {\n this._fullHierarchy = new FullTreeHierarchy(dataProvider);\n this._filter = filter;\n\n this._init = (async () => {\n await this.init();\n })();\n }\n\n private async init() {\n const hierarchy = await this._fullHierarchy.getHierarchy();\n if (this._filter === \"\") {\n this._filtered = hierarchy;\n return;\n }\n this.filterNodes(hierarchy);\n }\n\n /** Initializes `this._filtered` field. Returns a node if it matches a filter. */\n private filterNodes(hierarchy: Map<string | undefined, DelayLoadedTreeNodeItem[]>, current?: DelayLoadedTreeNodeItem): DelayLoadedTreeNodeItem | undefined {\n const matches = current ? this.matchesFilter(current) : false;\n const children = hierarchy.get(current?.id);\n if (!children)\n return matches ? current : undefined;\n\n const matchedChildren = new Array<DelayLoadedTreeNodeItem>();\n for (const child of children) {\n const matchedChild = this.filterNodes(hierarchy, child);\n matchedChild && matchedChildren.push(matchedChild);\n }\n\n const hasChildren = matchedChildren.length > 0;\n const included = matches || hasChildren;\n let filtered: DelayLoadedTreeNodeItem | undefined;\n if (included) {\n this._filtered.set(current?.id, matchedChildren);\n\n // Return a modified copy of current node (to persist initial hierarchy when filter is cleared).\n if (current) {\n filtered = {\n ...current,\n hasChildren,\n autoExpand: hasChildren ? true : current.autoExpand,\n };\n }\n }\n return filtered;\n }\n\n private matchesFilter(node: TreeNodeItem) {\n if (node.label.value.valueFormat !== PropertyValueFormat.Primitive)\n return false;\n\n const value = node.label.value.displayValue?.toLowerCase();\n if (!value)\n return false;\n return value.includes(this._filter.toLowerCase());\n }\n\n public async getHierarchy() {\n await this._init;\n return this._filtered;\n }\n}\n\nclass FilteredTreeDataProvider implements ITreeDataProvider {\n private _hierarchy: FilteredTreeHierarchy;\n\n public constructor(\n parentDataProvider: ITreeDataProvider,\n filter: string,\n ) {\n this._hierarchy = new FilteredTreeHierarchy(parentDataProvider, filter);\n }\n\n public async getNodes(parent?: TreeNodeItem) {\n const hierarchy = await this._hierarchy.getHierarchy();\n const nodes = hierarchy.get(parent?.id);\n return nodes || [];\n }\n\n public async getNodesCount(parent?: TreeNodeItem) {\n const hierarchy = await this._hierarchy.getHierarchy();\n const nodes = hierarchy.get(parent?.id);\n return nodes?.length || 0;\n }\n}\n"]}
1
+ {"version":3,"file":"SubLayersTree.js","sourceRoot":"","sources":["../../../../src/ui/widget/SubLayersTree.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAC+B,cAAc,EAGlD,aAAa,EAAsD,gBAAgB,EAAE,eAAe,EAA+B,eAAe,EAAgB,cAAc,EAChL,gBAAgB,EAAyB,YAAY,EAAqB,YAAY,GACvF,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,qBAAqB,EAAyC,MAAM,oBAAoB,CAAC;AAClG,OAAO,EAAE,SAAS,EAAmD,MAAM,sBAAsB,CAAC;AAClG,OAAO,EAAE,aAAa,EAAE,aAAa,EAA2B,aAAa,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACtH,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,sBAAsB,CAAC;AAC9B,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,OAAO,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,CA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YACR,OAAO,KAAK,CAAC;QACf,OAAO,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC;IACpD,CAAC;IAEM,KAAK,CAAC,YAAY;QACvB,MAAM,IAAI,CAAC,KAAK,CAAC;QACjB,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;CACF;AAED,MAAM,wBAAwB;IAG5B,YACE,kBAAqC,EACrC,MAAc;QAEd,IAAI,CAAC,UAAU,GAAG,IAAI,qBAAqB,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAAC;IAC1E,CAAC;IAEM,KAAK,CAAC,QAAQ,CAAC,MAAqB;QACzC,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,YAAY,EAAE,CAAC;QACvD,MAAM,KAAK,GAAG,SAAS,CAAC,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QACxC,OAAO,KAAK,IAAI,EAAE,CAAC;IACrB,CAAC;IAEM,KAAK,CAAC,aAAa,CAAC,MAAqB;QAC9C,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,YAAY,EAAE,CAAC;QACvD,MAAM,KAAK,GAAG,SAAS,CAAC,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QACxC,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC,CAAC;IAC5B,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport { PropertyValueFormat } from \"@itwin/appui-abstract\";\nimport {\n AbstractTreeNodeLoaderWithProvider, ControlledTree, DelayLoadedTreeNodeItem, HighlightableTreeProps, ITreeDataProvider,\n MutableTreeModel,\n MutableTreeModelNode,\n SelectionMode, TreeCheckboxStateChangeEventArgs, TreeDataProvider, TreeEventHandler, TreeImageLoader, TreeModel, TreeModelChanges, TreeModelSource, TreeNodeItem, TreeNodeLoader,\n TreeNodeRenderer, TreeNodeRendererProps, TreeRenderer, TreeRendererProps, useTreeModel,\n} from \"@itwin/components-react\";\nimport { ImageMapLayerSettings, MapSubLayerProps, MapSubLayerSettings } from \"@itwin/core-common\";\nimport { IModelApp, MapTileTreeScaleRangeVisibility, ScreenViewport } from \"@itwin/core-frontend\";\nimport { CheckBoxState, ImageCheckBox, NodeCheckboxRenderProps, useDisposable, WebFontIcon } from \"@itwin/core-react\";\nimport { Button, Input } from \"@itwin/itwinui-react\";\nimport * as React from \"react\";\nimport { StyleMapLayerSettings } from \"../Interfaces\";\nimport { SubLayersDataProvider } from \"./SubLayersDataProvider\";\nimport \"./SubLayersTree.scss\";\nimport { MapLayersUI } from \"../../mapLayers\";\n\nconst getWindow = () => {\n return typeof window === \"undefined\" ? undefined : window;\n};\n\nconst useResizeObserver = <T extends HTMLElement>(\n onResize: (size: DOMRectReadOnly) => void,\n) => {\n const resizeObserver = React.useRef<ResizeObserver>();\n\n const elementRef = React.useCallback(\n (element: T | null) => {\n if (!getWindow()?.ResizeObserver) {\n return;\n }\n\n resizeObserver.current?.disconnect();\n if (element) {\n resizeObserver.current = new ResizeObserver(([{ contentRect }]) =>\n onResize(contentRect),\n );\n resizeObserver.current?.observe(element);\n }\n },\n [onResize],\n );\n\n return [elementRef, resizeObserver.current] as const;\n};\n\n/** Mimic processing of `react-resize-detector` to return width and height.\n * @internal\n */\nfunction useResizeDetector(): { width: number | undefined, height: number | undefined, ref: React.Ref<HTMLDivElement> } {\n const [width, setWidth] = React.useState<number>();\n const [height, setHeight] = React.useState<number>();\n const [ref] = useResizeObserver(React.useCallback((size: DOMRectReadOnly) => {\n setWidth(size.width);\n setHeight(size.height);\n }, []));\n return { width, height, ref };\n}\n\ninterface ToolbarProps {\n searchField?: React.ReactNode;\n children?: React.ReactNode[];\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nfunction Toolbar(props: ToolbarProps) {\n return (\n <div className=\"map-manager-sublayer-tree-toolbar\">\n <div className=\"tree-toolbar-action-buttons\">\n {props.children}\n </div>\n {props.searchField && <div className=\"tree-toolbar-searchbox\">\n {props.searchField}\n </div>}\n </div>\n );\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function SubLayersPanel({ mapLayer, viewport }: { mapLayer: StyleMapLayerSettings, viewport: ScreenViewport | undefined }) {\n const [noneAvailableLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:SubLayers.NoSubLayers\"));\n if (!viewport || (undefined === mapLayer.subLayers || 0 === mapLayer.subLayers.length)) {\n return <div className=\"map-manager-sublayer-panel\">\n <div>{noneAvailableLabel}</div>\n </div>;\n }\n\n return (\n <SubLayersTree mapLayer={mapLayer} />\n );\n}\n\nfunction getSubLayerProps(subLayerSettings: MapSubLayerSettings[]): MapSubLayerProps[] {\n return subLayerSettings.map((subLayer) => subLayer.toJSON());\n}\n\nfunction getStyleMapLayerSettings(settings: ImageMapLayerSettings, isOverlay: boolean, layerIndex: number, treeVisibility: MapTileTreeScaleRangeVisibility): StyleMapLayerSettings {\n return {\n visible: settings.visible,\n name: settings.name,\n source: settings.source,\n transparency: settings.transparency,\n transparentBackground: settings.transparentBackground,\n subLayers: settings.subLayers ? getSubLayerProps(settings.subLayers) : undefined,\n showSubLayers: true,\n isOverlay,\n layerIndex,\n provider: IModelApp.viewManager.selectedView?.getMapLayerImageryProvider({ index: layerIndex, isOverlay }),\n treeVisibility,\n };\n}\n\n/**\n * Tree Control that displays sub-layer hierarchy\n * @internal\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function SubLayersTree(props: { mapLayer: StyleMapLayerSettings }) {\n const [placeholderLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:SubLayers.SearchPlaceholder\"));\n const [allOnLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:SubLayers.AllOn\"));\n const [allOffLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:SubLayers.AllOff\"));\n const [mapLayer, setMapLayer] = React.useState(props.mapLayer);\n const [layerFilterString, setLayerFilterString] = React.useState<string>(\"\");\n\n // create data provider to get some nodes to show in tree\n // `React.useMemo' is used avoid creating new object on each render cycle\n const dataProvider = React.useMemo(() => new SubLayersDataProvider(mapLayer), [mapLayer]);\n\n const {\n modelSource,\n nodeLoader,\n nodeHighlightingProps,\n } = useTreeFiltering(dataProvider, layerFilterString);\n\n // create custom event handler. It handles all tree event same as `TreeEventHandler` but additionally\n // it selects/deselects node when checkbox is checked/unchecked and vice versa.\n // `useDisposable` takes care of disposing old event handler when new is created in case 'nodeLoader' has changed\n // `React.useCallback` is used to avoid creating new callback that creates handler on each render\n const eventHandler = useDisposable(React.useCallback(() => new SubLayerCheckboxHandler(mapLayer, nodeLoader), [nodeLoader, mapLayer]));\n\n // Get an immutable tree model from the model source. The model is regenerated every time the model source\n // emits the `onModelChanged` event.\n const treeModel = useTreeModel(modelSource);\n\n const showAll = React.useCallback(async () => {\n const vp = IModelApp.viewManager.selectedView;\n const displayStyle = vp?.displayStyle;\n if (displayStyle && vp) {\n const indexInDisplayStyle = displayStyle ? displayStyle.findMapLayerIndexByNameAndSource(mapLayer.name, mapLayer.source, mapLayer.isOverlay) : -1;\n displayStyle.changeMapSubLayerProps({ visible: true }, -1, { index: indexInDisplayStyle, isOverlay: mapLayer.isOverlay });\n const updatedMapLayer = displayStyle.mapLayerAtIndex({ index: indexInDisplayStyle, isOverlay: mapLayer.isOverlay });\n if (updatedMapLayer) {\n if (updatedMapLayer instanceof ImageMapLayerSettings) {\n const treeVisibility = vp.getMapLayerScaleRangeVisibility({ index: indexInDisplayStyle, isOverlay: mapLayer.isOverlay });\n setMapLayer(getStyleMapLayerSettings(updatedMapLayer, mapLayer.isOverlay, indexInDisplayStyle, treeVisibility));\n }\n\n }\n }\n }, [mapLayer]);\n\n const hideAll = React.useCallback(async () => {\n const vp = IModelApp.viewManager.selectedView;\n const displayStyle = vp?.displayStyle;\n if (displayStyle && vp) {\n const indexInDisplayStyle = displayStyle ? displayStyle.findMapLayerIndexByNameAndSource(mapLayer.name, mapLayer.source, mapLayer.isOverlay) : -1;\n displayStyle.changeMapSubLayerProps({ visible: false }, -1, { index: indexInDisplayStyle, isOverlay: mapLayer.isOverlay });\n const updatedMapLayer = displayStyle.mapLayerAtIndex({ index: indexInDisplayStyle, isOverlay: mapLayer.isOverlay });\n if (updatedMapLayer && updatedMapLayer instanceof ImageMapLayerSettings) {\n const treeVisibility = vp.getMapLayerScaleRangeVisibility({ index: indexInDisplayStyle, isOverlay: mapLayer.isOverlay });\n setMapLayer(getStyleMapLayerSettings(updatedMapLayer, mapLayer.isOverlay, indexInDisplayStyle, treeVisibility));\n }\n }\n }, [mapLayer]);\n\n const handleFilterTextChanged = React.useCallback((event: React.ChangeEvent<HTMLInputElement>) => {\n setLayerFilterString(event.target.value);\n }, []);\n\n const { width, height, ref: containerRef } = useResizeDetector();\n\n return <>\n <div className=\"map-manager-sublayer-tree\">\n <Toolbar\n searchField={\n <Input type=\"text\" className=\"map-manager-source-list-filter\"\n placeholder={placeholderLabel}\n value={layerFilterString}\n onChange={handleFilterTextChanged}\n size=\"small\" />\n }\n >\n {mapLayer.provider?.mutualExclusiveSubLayer ? undefined : [\n <Button size=\"small\" styleType=\"borderless\" key=\"show-all-btn\" title={allOnLabel} onClick={showAll}>\n <WebFontIcon iconName=\"icon-visibility\" />\n </Button>,\n <Button size=\"small\" styleType=\"borderless\" key=\"hide-all-btn\" title={allOffLabel} onClick={hideAll}>\n <WebFontIcon iconName=\"icon-visibility-hide-2\" />\n </Button>,\n ]}\n </Toolbar>\n <div ref={containerRef} className=\"map-manager-sublayer-tree-content\">\n {width !== undefined && height !== undefined && <ControlledTree\n nodeLoader={nodeLoader}\n selectionMode={SelectionMode.None}\n eventsHandler={eventHandler}\n model={treeModel}\n treeRenderer={nodeWithEyeCheckboxTreeRenderer}\n nodeHighlightingProps={nodeHighlightingProps}\n width={width}\n height={height}\n />}\n </div>\n </div>\n </>;\n}\n\n/** TreeEventHandler derived class that handler processing changes to subLayer visibility */\nclass SubLayerCheckboxHandler extends TreeEventHandler {\n private _removeModelChangedListener: () => void;\n\n constructor(private _mapLayer: StyleMapLayerSettings, nodeLoader: AbstractTreeNodeLoaderWithProvider<TreeDataProvider>) {\n super({ modelSource: nodeLoader.modelSource, nodeLoader, collapsedChildrenDisposalEnabled: true });\n this._removeModelChangedListener = this.modelSource.onModelChanged.addListener(this.onModelChanged);\n }\n\n public override dispose() {\n this._removeModelChangedListener();\n super.dispose();\n }\n\n // Cascade state\n // Children on unnamed groups must get disabled in the tree view, because\n // they get rendered anyway.\n private cascadeStateToAllChildren(model: MutableTreeModel, parentId?: string) {\n const children = model.getChildren(parentId);\n if (children === undefined)\n return;\n\n for (const childID of children) {\n const childNode = childID ? model.getNode(childID) : undefined;\n\n if (childNode)\n this.syncNodeStateWithParent(model, childNode);\n\n // Drill down the tree.\n this.cascadeStateToAllChildren(model, childID);\n }\n }\n\n private applyMutualExclusiveState(model: MutableTreeModel, nodeId: string) {\n const changedNode = model.getNode(nodeId);\n if (changedNode?.checkbox.state === CheckBoxState.Off)\n return;\n\n for (const node of model.iterateTreeModelNodes()) {\n if (node.id === changedNode?.id)\n continue;\n\n if (node && node.checkbox.state === CheckBoxState.On)\n node.checkbox.state = CheckBoxState.Off;\n }\n }\n\n //-----------------------------------------------------------------------\n // Listen to model changes\n //------------------------------------------------------------------------\n // This is required because nodes are delay loaded in the model until\n // they are made visible (i.e. parent node is expanded). So even though\n // you might have created nodes in the data provided with a proper\n // initial state, by the time it gets loaded, their state might have became\n // out of date in the TreeView's active model. So whenever a node\n // is added, when must confirm its state matches the current model\n // (i.e. state of their parent.)\n public onModelChanged = (args: [TreeModel, TreeModelChanges]) => {\n this.modelSource.modifyModel((model) => {\n const addedNodes = args[1].addedNodeIds.map((id) => model.getNode(id));\n addedNodes.forEach((node) => {\n if (!node)\n return;\n\n this.syncNodeStateWithParent(model, node);\n });\n });\n };\n\n private static isUnnamedGroup(subLayer: MapSubLayerProps | undefined): boolean {\n if (!subLayer)\n return false;\n\n return (!subLayer.name || subLayer.name.length === 0) && (subLayer.children !== undefined && subLayer.children.length > 0);\n }\n\n // Ensure the state of changed node matches the state of its parent.\n private syncNodeStateWithParent(model: MutableTreeModel, changedNode: MutableTreeModelNode) {\n // Lookup node parent. If non exists, I assume thats the root node,\n // and it must have a proper initial state.\n const parentNode = changedNode.parentId ? model.getNode(changedNode.parentId) : undefined;\n if (!parentNode)\n return;\n\n if (!changedNode.checkbox)\n return; // don't see why this would happen, but if there is no checkbox, we cant do much here.\n\n const parentLayerId = undefined !== parentNode.item.extendedData?.subLayerId ? parentNode.item.extendedData?.subLayerId : parentNode.item.id;\n const parentSubLayer = this._mapLayer.subLayers?.find((subLayer) => subLayer.id === parentLayerId);\n\n // If parent is disabled, then children must be too.\n // Also, Non-visible unnamed group must have their children disabled (unamed groups have visibility inherence)\n if (parentNode.checkbox.isDisabled || (SubLayerCheckboxHandler.isUnnamedGroup(parentSubLayer) && parentNode.checkbox.state === CheckBoxState.Off)) {\n changedNode.checkbox.isDisabled = true;\n changedNode.checkbox.state = CheckBoxState.Off;\n } else {\n // Visibility state from StyleMapLayerSettings applies\n const subLayerId = undefined !== changedNode.item.extendedData?.subLayerId ? changedNode.item.extendedData?.subLayerId : changedNode.item.id;\n const foundSubLayer = this._mapLayer.subLayers?.find((subLayer) => subLayer.id === subLayerId);\n changedNode.checkbox.isDisabled = false;\n changedNode.checkbox.state = foundSubLayer?.visible ? CheckBoxState.On : CheckBoxState.Off;\n }\n }\n\n /** Changes nodes checkboxes states until event is handled or handler is disposed */\n public override onCheckboxStateChanged({ stateChanges }: TreeCheckboxStateChangeEventArgs) {\n // call base checkbox handling\n const baseHandling = super.onCheckboxStateChanged({ stateChanges });\n\n // subscribe to checkbox state changes to new checkbox states and do some additional work with them\n const selectionHandling = stateChanges.subscribe({\n next: (changes) => {\n const vp = IModelApp.viewManager.selectedView;\n const displayStyle = vp?.displayStyle;\n const indexInDisplayStyle = displayStyle ? displayStyle.findMapLayerIndexByNameAndSource(this._mapLayer.name, this._mapLayer.source, this._mapLayer.isOverlay) : -1;\n changes.forEach((change) => {\n const isSelected = (change.newState === CheckBoxState.On);\n\n const subLayerId = undefined !== change.nodeItem.extendedData?.subLayerId ? change.nodeItem.extendedData?.subLayerId : change.nodeItem.id;\n\n // Get the previously visible node if any\n let prevVisibleLayer: MapSubLayerProps | undefined;\n if (this._mapLayer.provider?.mutualExclusiveSubLayer) {\n prevVisibleLayer = this._mapLayer.subLayers?.find((subLayer) => subLayer.visible && subLayer.id !== subLayerId);\n }\n\n // Update sublayer object, otherwise state would get out of sync with DisplayStyle each time the TreeView is re-rendered\n const foundSubLayer = this._mapLayer.subLayers?.find((subLayer) => subLayer.id === subLayerId);\n if (foundSubLayer)\n foundSubLayer.visible = isSelected;\n if (prevVisibleLayer?.visible)\n prevVisibleLayer.visible = false;\n\n // Update displaystyle state\n if (-1 !== indexInDisplayStyle && displayStyle) {\n if (prevVisibleLayer && prevVisibleLayer.id !== undefined)\n displayStyle.changeMapSubLayerProps({ visible: false }, prevVisibleLayer.id, { index: indexInDisplayStyle, isOverlay: this._mapLayer.isOverlay });\n displayStyle.changeMapSubLayerProps({ visible: isSelected }, subLayerId, { index: indexInDisplayStyle, isOverlay: this._mapLayer.isOverlay });\n }\n\n // Cascade state\n this.modelSource.modifyModel((model) => {\n if (this._mapLayer.provider?.mutualExclusiveSubLayer)\n this.applyMutualExclusiveState(model, change.nodeItem.id);\n this.cascadeStateToAllChildren(model, change.nodeItem.id);\n });\n });\n },\n });\n // stop handling selection when checkboxes handling is stopped\n baseHandling?.add(selectionHandling);\n return baseHandling;\n }\n}\n\n/** Custom checkbox renderer that renders checkbox as an eye */\nconst eyeCheckboxRenderer = (props: NodeCheckboxRenderProps) => (\n <ImageCheckBox\n checked={props.checked}\n disabled={props.disabled}\n imageOn=\"icon-visibility\"\n imageOff=\"icon-visibility-hide-2\"\n onClick={props.onChange}\n tooltip={props.title}\n />\n);\n\n/** Custom node renderer. It uses default 'TreeNodeRenderer' but overrides default checkbox renderer to render checkbox as an eye */\nconst imageLoader = new TreeImageLoader();\nconst nodeWithEyeCheckboxRenderer = (props: TreeNodeRendererProps) => (\n <TreeNodeRenderer\n {...props}\n checkboxRenderer={eyeCheckboxRenderer}\n imageLoader={imageLoader}\n />\n);\n\n/** Custom tree renderer. It uses default `TreeRenderer` but overrides default node renderer to render node with custom checkbox */\nconst nodeWithEyeCheckboxTreeRenderer = (props: TreeRendererProps) => (\n <TreeRenderer\n {...props}\n nodeRenderer={nodeWithEyeCheckboxRenderer}\n />\n);\n\nfunction useTreeFiltering(\n dataProvider: ITreeDataProvider,\n filter: string,\n) {\n const nodeLoader = useFilteredProvider(dataProvider, filter);\n const nodeHighlightingProps = useNodeHighlightingProps(filter);\n return {\n nodeLoader,\n modelSource: nodeLoader.modelSource,\n nodeHighlightingProps,\n };\n}\n\nfunction useFilteredProvider(\n dataProvider: ITreeDataProvider,\n filter: string,\n) {\n const filteredProvider = React.useMemo(() => {\n return new FilteredTreeDataProvider(dataProvider, filter);\n }, [dataProvider, filter]);\n\n const nodeLoader = React.useMemo(() => {\n return new TreeNodeLoader(filteredProvider, new TreeModelSource());\n }, [filteredProvider]);\n\n return nodeLoader;\n}\n\nfunction useNodeHighlightingProps(\n filter: string,\n) {\n const [nodeHighlightingProps, setNodeHighlightingProps] = React.useState<HighlightableTreeProps>();\n\n React.useEffect(() => {\n if (filter === \"\") {\n setNodeHighlightingProps(undefined);\n return;\n }\n setNodeHighlightingProps({\n searchText: filter,\n activeMatch: undefined,\n });\n }, [filter]);\n\n return nodeHighlightingProps;\n}\n\nclass FullTreeHierarchy {\n private _dataProvider: ITreeDataProvider;\n private _hierarchy = new Map<string | undefined, DelayLoadedTreeNodeItem[]>();\n private _init: Promise<void>;\n\n public constructor(dataProvider: ITreeDataProvider) {\n this._dataProvider = dataProvider;\n\n this._init = (async () => {\n await this.initNode();\n })();\n }\n\n private async initNode(parent?: TreeNodeItem) {\n const nodes = await this._dataProvider.getNodes(parent);\n this._hierarchy.set(parent?.id, nodes);\n for (const node of nodes) {\n await this.initNode(node);\n }\n }\n\n public async getHierarchy() {\n await this._init;\n return this._hierarchy;\n }\n}\n\nclass FilteredTreeHierarchy {\n private _fullHierarchy: FullTreeHierarchy;\n private _filter: string;\n private _filtered = new Map<string | undefined, DelayLoadedTreeNodeItem[]>();\n private _init: Promise<void>;\n\n public constructor(dataProvider: ITreeDataProvider, filter: string) {\n this._fullHierarchy = new FullTreeHierarchy(dataProvider);\n this._filter = filter;\n\n this._init = (async () => {\n await this.init();\n })();\n }\n\n private async init() {\n const hierarchy = await this._fullHierarchy.getHierarchy();\n if (this._filter === \"\") {\n this._filtered = hierarchy;\n return;\n }\n this.filterNodes(hierarchy);\n }\n\n /** Initializes `this._filtered` field. Returns a node if it matches a filter. */\n private filterNodes(hierarchy: Map<string | undefined, DelayLoadedTreeNodeItem[]>, current?: DelayLoadedTreeNodeItem): DelayLoadedTreeNodeItem | undefined {\n const matches = current ? this.matchesFilter(current) : false;\n const children = hierarchy.get(current?.id);\n if (!children)\n return matches ? current : undefined;\n\n const matchedChildren = new Array<DelayLoadedTreeNodeItem>();\n for (const child of children) {\n const matchedChild = this.filterNodes(hierarchy, child);\n matchedChild && matchedChildren.push(matchedChild);\n }\n\n const hasChildren = matchedChildren.length > 0;\n const included = matches || hasChildren;\n let filtered: DelayLoadedTreeNodeItem | undefined;\n if (included) {\n this._filtered.set(current?.id, matchedChildren);\n\n // Return a modified copy of current node (to persist initial hierarchy when filter is cleared).\n if (current) {\n filtered = {\n ...current,\n hasChildren,\n autoExpand: hasChildren ? true : current.autoExpand,\n };\n }\n }\n return filtered;\n }\n\n private matchesFilter(node: TreeNodeItem) {\n if (node.label.value.valueFormat !== PropertyValueFormat.Primitive)\n return false;\n\n const value = node.label.value.displayValue?.toLowerCase();\n if (!value)\n return false;\n return value.includes(this._filter.toLowerCase());\n }\n\n public async getHierarchy() {\n await this._init;\n return this._filtered;\n }\n}\n\nclass FilteredTreeDataProvider implements ITreeDataProvider {\n private _hierarchy: FilteredTreeHierarchy;\n\n public constructor(\n parentDataProvider: ITreeDataProvider,\n filter: string,\n ) {\n this._hierarchy = new FilteredTreeHierarchy(parentDataProvider, filter);\n }\n\n public async getNodes(parent?: TreeNodeItem) {\n const hierarchy = await this._hierarchy.getHierarchy();\n const nodes = hierarchy.get(parent?.id);\n return nodes || [];\n }\n\n public async getNodesCount(parent?: TreeNodeItem) {\n const hierarchy = await this._hierarchy.getHierarchy();\n const nodes = hierarchy.get(parent?.id);\n return nodes?.length || 0;\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itwin/map-layers",
3
- "version": "4.0.0",
3
+ "version": "5.0.0-dev.3",
4
4
  "description": "Extension that adds a Map Layers Widget",
5
5
  "main": "lib/cjs/map-layers.js",
6
6
  "module": "lib/esm/map-layers.js",
@@ -26,24 +26,24 @@
26
26
  "react-beautiful-dnd": "^13.0.0"
27
27
  },
28
28
  "devDependencies": {
29
- "@itwin/appui-abstract": "^3.7.1",
29
+ "@itwin/appui-abstract": "^4.0.0-dev.104",
30
30
  "@itwin/appui-layout-react": "^4.0.0",
31
31
  "@itwin/appui-react": "^4.0.0",
32
- "@itwin/build-tools": "^3.7.1",
32
+ "@itwin/build-tools": "^4.0.0-dev.104",
33
33
  "@itwin/components-react": "^4.0.0",
34
- "@itwin/core-bentley": "^3.7.1",
35
- "@itwin/core-common": "^3.7.1",
36
- "@itwin/core-frontend": "^3.7.1",
37
- "@itwin/core-geometry": "^3.7.1",
38
- "@itwin/core-orbitgt": "^3.7.1",
39
- "@itwin/core-quantity": "^3.7.1",
34
+ "@itwin/core-bentley": "^4.0.0-dev.104",
35
+ "@itwin/core-common": "^4.0.0-dev.104",
36
+ "@itwin/core-frontend": "^4.0.0-dev.104",
37
+ "@itwin/core-geometry": "^4.0.0-dev.104",
38
+ "@itwin/core-orbitgt": "^4.0.0-dev.104",
39
+ "@itwin/core-quantity": "^4.0.0-dev.104",
40
40
  "@itwin/core-react": "^4.0.0",
41
- "@itwin/core-telemetry": "^3.7.1",
42
- "@itwin/eslint-plugin": "^3.7.1",
41
+ "@itwin/core-telemetry": "^4.0.0-dev.104",
42
+ "@itwin/eslint-plugin": "^4.0.0-dev.38",
43
43
  "@itwin/imodel-components-react": "^4.0.0",
44
44
  "@itwin/itwinui-variables": "^2.0.0",
45
45
  "@itwin/itwinui-react": "^2.7.0",
46
- "@itwin/webgl-compatibility": "^3.7.1",
46
+ "@itwin/webgl-compatibility": "^4.0.0-dev.104",
47
47
  "@testing-library/react": "^12.0.0",
48
48
  "@testing-library/react-hooks": "^7.0.2",
49
49
  "@types/chai": "4.3.1",
@@ -78,13 +78,13 @@
78
78
  "typescript": "~4.4.0"
79
79
  },
80
80
  "peerDependencies": {
81
- "@itwin/appui-abstract": "^3.7.1",
81
+ "@itwin/appui-abstract": "^4.0.0-dev.104",
82
82
  "@itwin/appui-layout-react": "^4.0.0",
83
83
  "@itwin/appui-react": "^4.0.0",
84
84
  "@itwin/components-react": "^4.0.0",
85
- "@itwin/core-bentley": "^3.7.1",
86
- "@itwin/core-common": "^3.7.1",
87
- "@itwin/core-frontend": "^3.7.1",
85
+ "@itwin/core-bentley": "^4.0.0-dev.104",
86
+ "@itwin/core-common": "^4.0.0-dev.104",
87
+ "@itwin/core-frontend": "^4.0.0-dev.104",
88
88
  "@itwin/core-react": "^4.0.0",
89
89
  "@itwin/imodel-components-react": "^4.0.0",
90
90
  "react": "^17.0.0",