@itwin/map-layers 4.0.0-dev.47 → 4.0.0-dev.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/MapLayerPreferences.js +2 -1
- package/lib/cjs/MapLayerPreferences.js.map +1 -1
- package/lib/cjs/mapLayers.js +3 -2
- package/lib/cjs/mapLayers.js.map +1 -1
- package/lib/cjs/ui/FeatureInfoUiItemsProvider.js +3 -2
- package/lib/cjs/ui/FeatureInfoUiItemsProvider.js.map +1 -1
- package/lib/cjs/ui/MapLayersUiItemsProvider.js +2 -2
- package/lib/cjs/ui/MapLayersUiItemsProvider.js.map +1 -1
- package/lib/cjs/ui/widget/AttachLayerPopupButton.js +15 -12
- package/lib/cjs/ui/widget/AttachLayerPopupButton.js.map +1 -1
- package/lib/cjs/ui/widget/BasemapPanel.js +1 -1
- package/lib/cjs/ui/widget/BasemapPanel.js.map +1 -1
- package/lib/cjs/ui/widget/ConfirmMessageDialog.js +7 -4
- package/lib/cjs/ui/widget/ConfirmMessageDialog.js.map +1 -1
- package/lib/cjs/ui/widget/FeatureInfoDataProvider.js +4 -3
- package/lib/cjs/ui/widget/FeatureInfoDataProvider.js.map +1 -1
- package/lib/cjs/ui/widget/FeatureInfoWidget.js +16 -10
- package/lib/cjs/ui/widget/FeatureInfoWidget.js.map +1 -1
- package/lib/cjs/ui/widget/MapLayerDroppable.js +7 -4
- package/lib/cjs/ui/widget/MapLayerDroppable.js.map +1 -1
- package/lib/cjs/ui/widget/MapLayerManager.js +19 -17
- package/lib/cjs/ui/widget/MapLayerManager.js.map +1 -1
- package/lib/cjs/ui/widget/MapLayerManager.scss +1 -1
- package/lib/cjs/ui/widget/MapLayerSettingsMenu.js +3 -2
- package/lib/cjs/ui/widget/MapLayerSettingsMenu.js.map +1 -1
- package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.js +2 -2
- package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.js.map +1 -1
- package/lib/cjs/ui/widget/MapLayersWidget.js +4 -4
- package/lib/cjs/ui/widget/MapLayersWidget.js.map +1 -1
- package/lib/cjs/ui/widget/MapUrlDialog.js +27 -24
- package/lib/cjs/ui/widget/MapUrlDialog.js.map +1 -1
- package/lib/cjs/ui/widget/MapUrlDialog.scss +1 -1
- package/lib/cjs/ui/widget/SelectMapFormat.js +12 -7
- package/lib/cjs/ui/widget/SelectMapFormat.js.map +1 -1
- package/lib/cjs/ui/widget/SubLayersDataProvider.js +5 -4
- package/lib/cjs/ui/widget/SubLayersDataProvider.js.map +1 -1
- package/lib/cjs/ui/widget/SubLayersTree.js +34 -28
- package/lib/cjs/ui/widget/SubLayersTree.js.map +1 -1
- package/lib/cjs/ui/widget/SubLayersTree.scss +2 -1
- package/lib/esm/MapLayerPreferences.js +2 -1
- package/lib/esm/MapLayerPreferences.js.map +1 -1
- package/lib/esm/mapLayers.js +3 -2
- package/lib/esm/mapLayers.js.map +1 -1
- package/lib/esm/ui/FeatureInfoUiItemsProvider.js +3 -2
- package/lib/esm/ui/FeatureInfoUiItemsProvider.js.map +1 -1
- package/lib/esm/ui/MapLayersUiItemsProvider.js +2 -2
- package/lib/esm/ui/MapLayersUiItemsProvider.js.map +1 -1
- package/lib/esm/ui/widget/AttachLayerPopupButton.js +15 -12
- package/lib/esm/ui/widget/AttachLayerPopupButton.js.map +1 -1
- package/lib/esm/ui/widget/BasemapPanel.js +1 -1
- package/lib/esm/ui/widget/BasemapPanel.js.map +1 -1
- package/lib/esm/ui/widget/ConfirmMessageDialog.js +7 -4
- package/lib/esm/ui/widget/ConfirmMessageDialog.js.map +1 -1
- package/lib/esm/ui/widget/FeatureInfoDataProvider.js +4 -3
- package/lib/esm/ui/widget/FeatureInfoDataProvider.js.map +1 -1
- package/lib/esm/ui/widget/FeatureInfoWidget.js +16 -10
- package/lib/esm/ui/widget/FeatureInfoWidget.js.map +1 -1
- package/lib/esm/ui/widget/MapLayerDroppable.js +7 -4
- package/lib/esm/ui/widget/MapLayerDroppable.js.map +1 -1
- package/lib/esm/ui/widget/MapLayerManager.js +19 -17
- package/lib/esm/ui/widget/MapLayerManager.js.map +1 -1
- package/lib/esm/ui/widget/MapLayerManager.scss +1 -1
- package/lib/esm/ui/widget/MapLayerSettingsMenu.js +3 -2
- package/lib/esm/ui/widget/MapLayerSettingsMenu.js.map +1 -1
- package/lib/esm/ui/widget/MapLayerSettingsPopupButton.js +2 -2
- package/lib/esm/ui/widget/MapLayerSettingsPopupButton.js.map +1 -1
- package/lib/esm/ui/widget/MapLayersWidget.js +4 -4
- package/lib/esm/ui/widget/MapLayersWidget.js.map +1 -1
- package/lib/esm/ui/widget/MapUrlDialog.js +27 -24
- package/lib/esm/ui/widget/MapUrlDialog.js.map +1 -1
- package/lib/esm/ui/widget/MapUrlDialog.scss +1 -1
- package/lib/esm/ui/widget/SelectMapFormat.js +12 -7
- package/lib/esm/ui/widget/SelectMapFormat.js.map +1 -1
- package/lib/esm/ui/widget/SubLayersDataProvider.js +5 -4
- package/lib/esm/ui/widget/SubLayersDataProvider.js.map +1 -1
- package/lib/esm/ui/widget/SubLayersTree.js +34 -28
- package/lib/esm/ui/widget/SubLayersTree.js.map +1 -1
- package/lib/esm/ui/widget/SubLayersTree.scss +2 -1
- package/package.json +29 -22
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectMapFormat.js","sourceRoot":"","sources":["../../../../src/ui/widget/SelectMapFormat.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,8BAA8B;AAE9B,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAgB,MAAM,sBAAsB,CAAC;AAClF,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,qBAAqB,CAAC;AAC7B,OAAO,EAAC,uBAAuB,EAAC,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAs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,EACxB,QAAQ,EAAE,cAAc,EACxB,IAAI,EAAC,OAAO,EACZ,YAAY,EACV,CAAC,MAAM,EAAE,EAAE;;YAAC,OAAA,CACV,oBAAC,QAAQ,IACP,KAAK,EAAE,CAAA,MAAA,MAAM,CAAC,EAAE,0CAAE,QAAQ,CAAC,aAAa,CAAC,EAAC,CAAC;oBACzC,6BAAK,KAAK,EAAE,kBAAkB;wBAC5B,oBAAC,UAAU,IAAC,SAAS,EAAC,sCAAsC,EAAE,IAAI,EAAC,OAAO;4BACxE,oBAAC,uBAAuB,OAAG,CAChB,CACT;oBACN,CAAC,CAAC,SAAS,IACZ,MAAM,CAAC,KAAK,CACJ,CAAC,CAAA;SAAA,GAChB,CACH,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n// cSpell:ignore Modeless WMTS\n\nimport { IconButton, MenuItem, Select, SelectOption } from \"@itwin/itwinui-react\";\nimport * as React from \"react\";\nimport { MapTypesOptions } from \"../Interfaces\";\nimport \"./MapUrlDialog.scss\";\nimport {SvgTechnicalPreviewMini} from \"@itwin/itwinui-icons-color-react\";\nimport { MapLayersUI } from \"../../mapLayers\";\nimport { IModelApp } from \"@itwin/core-frontend\";\n\n// TODO:\n// Remove this structure and iterate over the registry's active formats.\n// Still need a proper way to exclude some format, like we currently do with\n// 'TileUrl' without the need to hardcode any format Id.\nexport const MAP_TYPES = {\n wms: \"WMS\",\n arcGis: \"ArcGIS\",\n wmts: \"WMTS\",\n tileUrl: \"TileURL\",\n arcGisFeature: \"ArcGISFeature\",\n};\n\ninterface SelectMapFormatProps {\n value?: string;\n disabled?: boolean;\n mapTypesOptions?: MapTypesOptions;\n onChange?: (mapType: string) => void;\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function SelectMapFormat(props: SelectMapFormatProps) {\n\n const [mapFormat, setMapFormat] = React.useState(props.value ?? MAP_TYPES.arcGis);\n const [techPreviewTooltip] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.TechPreviewBadgeTooltip\"));\n\n const [mapFormats] = React.useState((): SelectOption<string>[] => {\n const formats: SelectOption<string>[] = [\n { value: MAP_TYPES.arcGis, label: MAP_TYPES.arcGis },\n { value: MAP_TYPES.wms, label: MAP_TYPES.wms },\n { value: MAP_TYPES.wmts, label: MAP_TYPES.wmts },\n ];\n if (props.mapTypesOptions?.supportTileUrl)\n formats.push({ value: MAP_TYPES.tileUrl, label: MAP_TYPES.tileUrl });\n\n if (IModelApp.mapLayerFormatRegistry.isRegistered(MAP_TYPES.arcGisFeature))\n formats.push( { value: MAP_TYPES.arcGisFeature, label: MAP_TYPES.arcGisFeature, id:\"techPreview\" });\n\n return formats;\n });\n\n const handleOnChange = React.useCallback((value: string) => {\n setMapFormat(value);\n if (props.onChange) {\n props.onChange(value);\n }\n }, [props]);\n\n return (\n\n <Select\n className=\"map-layer-source-select\"\n options={mapFormats}\n value={mapFormat}\n disabled={props.disabled}\n onChange={handleOnChange}\n size=\"small\"\n itemRenderer={\n (option) => (\n <MenuItem\n badge={option.id?.includes(\"techPreview\") ?\n <div title={techPreviewTooltip}>\n <IconButton className=\"map-layer-source-select-previewBadge\" size=\"small\">\n <SvgTechnicalPreviewMini />\n </IconButton>\n </div>\n : undefined}>\n {option.label}\n </MenuItem>) }\n />\n );\n}\n"]}
|
|
@@ -23,9 +23,10 @@ export class SubLayersDataProvider {
|
|
|
23
23
|
return undefined !== props.id ? `${props.id}` : props.name ? props.name : "no-id";
|
|
24
24
|
}
|
|
25
25
|
createNode(props, expanded, isCheckboxDisabled, icon) {
|
|
26
|
+
var _a, _b;
|
|
26
27
|
return {
|
|
27
28
|
id: this.createId(props),
|
|
28
|
-
label: PropertyRecord.fromString(props.title
|
|
29
|
+
label: PropertyRecord.fromString((_b = (_a = props.title) !== null && _a !== void 0 ? _a : props.name) !== null && _b !== void 0 ? _b : "unknown"),
|
|
29
30
|
hasChildren: !!props.children,
|
|
30
31
|
isCheckboxVisible: true,
|
|
31
32
|
checkBoxState: props.visible && !isCheckboxDisabled ? CheckBoxState.On : CheckBoxState.Off,
|
|
@@ -38,10 +39,10 @@ export class SubLayersDataProvider {
|
|
|
38
39
|
loadChildNodes(allSubLayers, parentId) {
|
|
39
40
|
const filteredProps = allSubLayers.filter((props) => parentId === props.parent);
|
|
40
41
|
if (filteredProps.length) {
|
|
41
|
-
filteredProps
|
|
42
|
+
filteredProps === null || filteredProps === void 0 ? void 0 : filteredProps.sort((a, b) => compareStringsOrUndefined(a.title, b.title));
|
|
42
43
|
const treeNodes = [];
|
|
43
44
|
filteredProps.forEach((props) => {
|
|
44
|
-
treeNodes.push(this.createNode(props, (!parentId && props
|
|
45
|
+
treeNodes.push(this.createNode(props, (!parentId && (props === null || props === void 0 ? void 0 : props.children) !== undefined) ? true : undefined, // expand root group only (i.e. not the entire tree),
|
|
45
46
|
undefined, SubLayersDataProvider.isUnnamedGroup(props) ? "icon-folder" : "icon-layers"));
|
|
46
47
|
if (props.children)
|
|
47
48
|
this.loadChildNodes(allSubLayers, props.id);
|
|
@@ -50,7 +51,7 @@ export class SubLayersDataProvider {
|
|
|
50
51
|
}
|
|
51
52
|
}
|
|
52
53
|
loadNodes(subLayerNodes) {
|
|
53
|
-
subLayerNodes
|
|
54
|
+
subLayerNodes === null || subLayerNodes === void 0 ? void 0 : subLayerNodes.sort((a, b) => compareStringsOrUndefined(a.title, b.title));
|
|
54
55
|
if (subLayerNodes) {
|
|
55
56
|
this.loadChildNodes(subLayerNodes, undefined);
|
|
56
57
|
}
|
|
@@ -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;AAEh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,aAAb,aAAa,uBAAb,aAAa,CAAE,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"]}
|
|
@@ -18,13 +18,14 @@ const getWindow = () => {
|
|
|
18
18
|
const useResizeObserver = (onResize) => {
|
|
19
19
|
const resizeObserver = React.useRef();
|
|
20
20
|
const elementRef = React.useCallback((element) => {
|
|
21
|
-
|
|
21
|
+
var _a, _b, _c;
|
|
22
|
+
if (!((_a = getWindow()) === null || _a === void 0 ? void 0 : _a.ResizeObserver)) {
|
|
22
23
|
return;
|
|
23
24
|
}
|
|
24
|
-
resizeObserver.current
|
|
25
|
+
(_b = resizeObserver.current) === null || _b === void 0 ? void 0 : _b.disconnect();
|
|
25
26
|
if (element) {
|
|
26
27
|
resizeObserver.current = new ResizeObserver(([{ contentRect }]) => onResize(contentRect));
|
|
27
|
-
resizeObserver.current
|
|
28
|
+
(_c = resizeObserver.current) === null || _c === void 0 ? void 0 : _c.observe(element);
|
|
28
29
|
}
|
|
29
30
|
}, [onResize]);
|
|
30
31
|
return [elementRef, resizeObserver.current];
|
|
@@ -81,6 +82,7 @@ function getStyleMapLayerSettings(settings, isOverlay, layerIndex, treeVisibilit
|
|
|
81
82
|
*/
|
|
82
83
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
83
84
|
export function SubLayersTree(props) {
|
|
85
|
+
var _a;
|
|
84
86
|
const [placeholderLabel] = React.useState(MapLayersUI.localization.getLocalizedString("mapLayers:SubLayers.SearchPlaceholder"));
|
|
85
87
|
const [allOnLabel] = React.useState(MapLayersUI.localization.getLocalizedString("mapLayers:SubLayers.AllOn"));
|
|
86
88
|
const [allOffLabel] = React.useState(MapLayersUI.localization.getLocalizedString("mapLayers:SubLayers.AllOff"));
|
|
@@ -100,7 +102,7 @@ export function SubLayersTree(props) {
|
|
|
100
102
|
const treeModel = useTreeModel(modelSource);
|
|
101
103
|
const showAll = React.useCallback(async () => {
|
|
102
104
|
const vp = IModelApp.viewManager.selectedView;
|
|
103
|
-
const displayStyle = vp
|
|
105
|
+
const displayStyle = vp === null || vp === void 0 ? void 0 : vp.displayStyle;
|
|
104
106
|
if (displayStyle && vp) {
|
|
105
107
|
const indexInDisplayStyle = displayStyle ? displayStyle.findMapLayerIndexByNameAndSource(mapLayer.name, mapLayer.source, mapLayer.isOverlay) : -1;
|
|
106
108
|
displayStyle.changeMapSubLayerProps({ visible: true }, -1, indexInDisplayStyle, mapLayer.isOverlay);
|
|
@@ -116,7 +118,7 @@ export function SubLayersTree(props) {
|
|
|
116
118
|
}, [mapLayer]);
|
|
117
119
|
const hideAll = React.useCallback(async () => {
|
|
118
120
|
const vp = IModelApp.viewManager.selectedView;
|
|
119
|
-
const displayStyle = vp
|
|
121
|
+
const displayStyle = vp === null || vp === void 0 ? void 0 : vp.displayStyle;
|
|
120
122
|
if (displayStyle && vp) {
|
|
121
123
|
const indexInDisplayStyle = displayStyle ? displayStyle.findMapLayerIndexByNameAndSource(mapLayer.name, mapLayer.source, mapLayer.isOverlay) : -1;
|
|
122
124
|
displayStyle.changeMapSubLayerProps({ visible: false }, -1, indexInDisplayStyle, mapLayer.isOverlay);
|
|
@@ -134,7 +136,7 @@ export function SubLayersTree(props) {
|
|
|
134
136
|
const { width, height, ref: containerRef } = useResizeDetector();
|
|
135
137
|
return React.createElement(React.Fragment, null,
|
|
136
138
|
React.createElement("div", { className: "map-manager-sublayer-tree" },
|
|
137
|
-
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
|
|
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 : [
|
|
138
140
|
React.createElement(Button, { size: "small", styleType: "borderless", key: "show-all-btn", title: allOnLabel, onClick: showAll },
|
|
139
141
|
React.createElement(WebFontIcon, { iconName: "icon-visibility" })),
|
|
140
142
|
React.createElement(Button, { size: "small", styleType: "borderless", key: "hide-all-btn", title: allOffLabel, onClick: hideAll },
|
|
@@ -190,10 +192,10 @@ class SubLayerCheckboxHandler extends TreeEventHandler {
|
|
|
190
192
|
}
|
|
191
193
|
applyMutualExclusiveState(model, nodeId) {
|
|
192
194
|
const changedNode = model.getNode(nodeId);
|
|
193
|
-
if (changedNode
|
|
195
|
+
if ((changedNode === null || changedNode === void 0 ? void 0 : changedNode.checkbox.state) === CheckBoxState.Off)
|
|
194
196
|
return;
|
|
195
197
|
for (const node of model.iterateTreeModelNodes()) {
|
|
196
|
-
if (node.id === changedNode
|
|
198
|
+
if (node.id === (changedNode === null || changedNode === void 0 ? void 0 : changedNode.id))
|
|
197
199
|
continue;
|
|
198
200
|
if (node && node.checkbox.state === CheckBoxState.On)
|
|
199
201
|
node.checkbox.state = CheckBoxState.Off;
|
|
@@ -206,6 +208,7 @@ class SubLayerCheckboxHandler extends TreeEventHandler {
|
|
|
206
208
|
}
|
|
207
209
|
// Ensure the state of changed node matches the state of its parent.
|
|
208
210
|
syncNodeStateWithParent(model, changedNode) {
|
|
211
|
+
var _a, _b, _c, _d, _e, _f;
|
|
209
212
|
// Lookup node parent. If non exists, I assume thats the root node,
|
|
210
213
|
// and it must have a proper initial state.
|
|
211
214
|
const parentNode = changedNode.parentId ? model.getNode(changedNode.parentId) : undefined;
|
|
@@ -213,8 +216,8 @@ class SubLayerCheckboxHandler extends TreeEventHandler {
|
|
|
213
216
|
return;
|
|
214
217
|
if (!changedNode.checkbox)
|
|
215
218
|
return; // don't see why this would happen, but if there is no checkbox, we cant do much here.
|
|
216
|
-
const parentLayerId = undefined !== parentNode.item.extendedData
|
|
217
|
-
const parentSubLayer = this._mapLayer.subLayers
|
|
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);
|
|
218
221
|
// If parent is disabled, then children must be too.
|
|
219
222
|
// Also, Non-visible unnamed group must have their children disabled (unamed groups have visibility inherence)
|
|
220
223
|
if (parentNode.checkbox.isDisabled || (SubLayerCheckboxHandler.isUnnamedGroup(parentSubLayer) && parentNode.checkbox.state === CheckBoxState.Off)) {
|
|
@@ -223,10 +226,10 @@ class SubLayerCheckboxHandler extends TreeEventHandler {
|
|
|
223
226
|
}
|
|
224
227
|
else {
|
|
225
228
|
// Visibility state from StyleMapLayerSettings applies
|
|
226
|
-
const subLayerId = undefined !== changedNode.item.extendedData
|
|
227
|
-
const foundSubLayer = this._mapLayer.subLayers
|
|
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);
|
|
228
231
|
changedNode.checkbox.isDisabled = false;
|
|
229
|
-
changedNode.checkbox.state = foundSubLayer
|
|
232
|
+
changedNode.checkbox.state = (foundSubLayer === null || foundSubLayer === void 0 ? void 0 : foundSubLayer.visible) ? CheckBoxState.On : CheckBoxState.Off;
|
|
230
233
|
}
|
|
231
234
|
}
|
|
232
235
|
/** Changes nodes checkboxes states until event is handled or handler is disposed */
|
|
@@ -237,21 +240,22 @@ class SubLayerCheckboxHandler extends TreeEventHandler {
|
|
|
237
240
|
const selectionHandling = stateChanges.subscribe({
|
|
238
241
|
next: (changes) => {
|
|
239
242
|
const vp = IModelApp.viewManager.selectedView;
|
|
240
|
-
const displayStyle = vp
|
|
243
|
+
const displayStyle = vp === null || vp === void 0 ? void 0 : vp.displayStyle;
|
|
241
244
|
const indexInDisplayStyle = displayStyle ? displayStyle.findMapLayerIndexByNameAndSource(this._mapLayer.name, this._mapLayer.source, this._mapLayer.isOverlay) : -1;
|
|
242
245
|
changes.forEach((change) => {
|
|
246
|
+
var _a, _b, _c, _d, _e;
|
|
243
247
|
const isSelected = (change.newState === CheckBoxState.On);
|
|
244
|
-
const subLayerId = undefined !== change.nodeItem.extendedData
|
|
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;
|
|
245
249
|
// Get the previously visible node if any
|
|
246
250
|
let prevVisibleLayer;
|
|
247
|
-
if (this._mapLayer.provider
|
|
248
|
-
prevVisibleLayer = this._mapLayer.subLayers
|
|
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);
|
|
249
253
|
}
|
|
250
254
|
// Update sublayer object, otherwise state would get out of sync with DisplayStyle each time the TreeView is re-rendered
|
|
251
|
-
const foundSubLayer = this._mapLayer.subLayers
|
|
255
|
+
const foundSubLayer = (_e = this._mapLayer.subLayers) === null || _e === void 0 ? void 0 : _e.find((subLayer) => subLayer.id === subLayerId);
|
|
252
256
|
if (foundSubLayer)
|
|
253
257
|
foundSubLayer.visible = isSelected;
|
|
254
|
-
if (prevVisibleLayer
|
|
258
|
+
if (prevVisibleLayer === null || prevVisibleLayer === void 0 ? void 0 : prevVisibleLayer.visible)
|
|
255
259
|
prevVisibleLayer.visible = false;
|
|
256
260
|
// Update displaystyle state
|
|
257
261
|
if (-1 !== indexInDisplayStyle && displayStyle) {
|
|
@@ -261,7 +265,8 @@ class SubLayerCheckboxHandler extends TreeEventHandler {
|
|
|
261
265
|
}
|
|
262
266
|
// Cascade state
|
|
263
267
|
this.modelSource.modifyModel((model) => {
|
|
264
|
-
|
|
268
|
+
var _a;
|
|
269
|
+
if ((_a = this._mapLayer.provider) === null || _a === void 0 ? void 0 : _a.mutualExclusiveSubLayer)
|
|
265
270
|
this.applyMutualExclusiveState(model, change.nodeItem.id);
|
|
266
271
|
this.cascadeStateToAllChildren(model, change.nodeItem.id);
|
|
267
272
|
});
|
|
@@ -271,7 +276,7 @@ class SubLayerCheckboxHandler extends TreeEventHandler {
|
|
|
271
276
|
},
|
|
272
277
|
});
|
|
273
278
|
// stop handling selection when checkboxes handling is stopped
|
|
274
|
-
baseHandling
|
|
279
|
+
baseHandling === null || baseHandling === void 0 ? void 0 : baseHandling.add(selectionHandling);
|
|
275
280
|
return baseHandling;
|
|
276
281
|
}
|
|
277
282
|
}
|
|
@@ -324,7 +329,7 @@ class FullTreeHierarchy {
|
|
|
324
329
|
}
|
|
325
330
|
async initNode(parent) {
|
|
326
331
|
const nodes = await this._dataProvider.getNodes(parent);
|
|
327
|
-
this._hierarchy.set(parent
|
|
332
|
+
this._hierarchy.set(parent === null || parent === void 0 ? void 0 : parent.id, nodes);
|
|
328
333
|
for (const node of nodes) {
|
|
329
334
|
await this.initNode(node);
|
|
330
335
|
}
|
|
@@ -354,7 +359,7 @@ class FilteredTreeHierarchy {
|
|
|
354
359
|
/** Initializes `this._filtered` field. Returns a node if it matches a filter. */
|
|
355
360
|
filterNodes(hierarchy, current) {
|
|
356
361
|
const matches = current ? this.matchesFilter(current) : false;
|
|
357
|
-
const children = hierarchy.get(current
|
|
362
|
+
const children = hierarchy.get(current === null || current === void 0 ? void 0 : current.id);
|
|
358
363
|
if (!children)
|
|
359
364
|
return matches ? current : undefined;
|
|
360
365
|
const matchedChildren = new Array();
|
|
@@ -366,7 +371,7 @@ class FilteredTreeHierarchy {
|
|
|
366
371
|
const included = matches || hasChildren;
|
|
367
372
|
let filtered;
|
|
368
373
|
if (included) {
|
|
369
|
-
this._filtered.set(current
|
|
374
|
+
this._filtered.set(current === null || current === void 0 ? void 0 : current.id, matchedChildren);
|
|
370
375
|
// Return a modified copy of current node (to persist initial hierarchy when filter is cleared).
|
|
371
376
|
if (current) {
|
|
372
377
|
filtered = {
|
|
@@ -379,9 +384,10 @@ class FilteredTreeHierarchy {
|
|
|
379
384
|
return filtered;
|
|
380
385
|
}
|
|
381
386
|
matchesFilter(node) {
|
|
387
|
+
var _a;
|
|
382
388
|
if (node.label.value.valueFormat !== PropertyValueFormat.Primitive)
|
|
383
389
|
return false;
|
|
384
|
-
const value = node.label.value.displayValue
|
|
390
|
+
const value = (_a = node.label.value.displayValue) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
|
385
391
|
if (!value)
|
|
386
392
|
return false;
|
|
387
393
|
return value.includes(this._filter.toLowerCase());
|
|
@@ -397,13 +403,13 @@ class FilteredTreeDataProvider {
|
|
|
397
403
|
}
|
|
398
404
|
async getNodes(parent) {
|
|
399
405
|
const hierarchy = await this._hierarchy.getHierarchy();
|
|
400
|
-
const nodes = hierarchy.get(parent
|
|
406
|
+
const nodes = hierarchy.get(parent === null || parent === void 0 ? void 0 : parent.id);
|
|
401
407
|
return nodes || [];
|
|
402
408
|
}
|
|
403
409
|
async getNodesCount(parent) {
|
|
404
410
|
const hierarchy = await this._hierarchy.getHierarchy();
|
|
405
|
-
const nodes = hierarchy.get(parent
|
|
406
|
-
return nodes
|
|
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;
|
|
407
413
|
}
|
|
408
414
|
}
|
|
409
415
|
//# sourceMappingURL=SubLayersTree.js.map
|
|
@@ -1 +1 @@
|
|
|
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,CAAC,CAAC,MAAM,CAAC;AAC5D,CAAC,CAAC;AAEF,MAAM,iBAAiB,GAAG,CACxB,QAAyC,EACzC,EAAE;IACF,MAAM,cAAc,GAAG,KAA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G,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/**\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,CAAC,CAAC,MAAM,CAAC;AAC5D,CAAC,CAAC;AAEF,MAAM,iBAAiB,GAAG,CACxB,QAAyC,EACzC,EAAE;IACF,MAAM,cAAc,GAAG,KAAK,CAAC,MAAM,EAAkB,CAAC;IAEtD,MAAM,UAAU,GAAG,KAAK,CAAC,WAAW,CAClC,CAAC,OAAiB,EAAE,EAAE;;QACpB,IAAI,CAAC,CAAA,MAAA,SAAS,EAAE,0CAAE,cAAc,CAAA,EAA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O,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,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"]}
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
.core-tree-node {
|
|
14
14
|
>.contents {
|
|
15
15
|
padding-left: 31px;
|
|
16
|
+
|
|
16
17
|
>.core-image-checkbox {
|
|
17
18
|
top: 5px;
|
|
18
19
|
}
|
|
@@ -49,7 +50,7 @@
|
|
|
49
50
|
}
|
|
50
51
|
|
|
51
52
|
&:focus {
|
|
52
|
-
box-shadow:
|
|
53
|
+
box-shadow: rgba(var(--iui-color-border-accent), var(--iui-opacity-4)) 0px 0px 0px 2px;
|
|
53
54
|
outline: none;
|
|
54
55
|
}
|
|
55
56
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itwin/map-layers",
|
|
3
|
-
"version": "4.0.0-dev.
|
|
3
|
+
"version": "4.0.0-dev.49",
|
|
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,20 +26,24 @@
|
|
|
26
26
|
"react-beautiful-dnd": "^13.0.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@itwin/appui-abstract": "^
|
|
30
|
-
"@itwin/appui-react": "^4.0.0-dev.
|
|
31
|
-
"@itwin/
|
|
32
|
-
"@itwin/
|
|
33
|
-
"@itwin/
|
|
34
|
-
"@itwin/core-
|
|
35
|
-
"@itwin/core-
|
|
36
|
-
"@itwin/core-
|
|
37
|
-
"@itwin/core-
|
|
38
|
-
"@itwin/
|
|
39
|
-
"@itwin/
|
|
29
|
+
"@itwin/appui-abstract": "^3.7.1",
|
|
30
|
+
"@itwin/appui-layout-react": "^4.0.0-dev.17",
|
|
31
|
+
"@itwin/appui-react": "^4.0.0-dev.17",
|
|
32
|
+
"@itwin/build-tools": "^3.7.1",
|
|
33
|
+
"@itwin/components-react": "^4.0.0-dev.17",
|
|
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",
|
|
40
|
+
"@itwin/core-react": "^4.0.0-dev.17",
|
|
41
|
+
"@itwin/core-telemetry": "^3.7.1",
|
|
42
|
+
"@itwin/eslint-plugin": "^3.7.1",
|
|
43
|
+
"@itwin/imodel-components-react": "^4.0.0-dev.17",
|
|
40
44
|
"@itwin/itwinui-variables": "^2.0.0",
|
|
41
|
-
"@itwin/itwinui-react": "^2.
|
|
42
|
-
"@itwin/
|
|
45
|
+
"@itwin/itwinui-react": "^2.7.0",
|
|
46
|
+
"@itwin/webgl-compatibility": "^3.7.1",
|
|
43
47
|
"@testing-library/react": "^12.0.0",
|
|
44
48
|
"@testing-library/react-hooks": "^7.0.2",
|
|
45
49
|
"@types/chai": "4.3.1",
|
|
@@ -65,6 +69,8 @@
|
|
|
65
69
|
"nyc": "^15.1.0",
|
|
66
70
|
"react": "^17.0.0",
|
|
67
71
|
"react-dom": "^17.0.0",
|
|
72
|
+
"react-redux": "^7.2.2",
|
|
73
|
+
"redux": "^4.1.0",
|
|
68
74
|
"rimraf": "^3.0.2",
|
|
69
75
|
"sinon": "^9.0.2",
|
|
70
76
|
"sinon-chai": "^3.2.0",
|
|
@@ -72,14 +78,15 @@
|
|
|
72
78
|
"typescript": "~4.4.0"
|
|
73
79
|
},
|
|
74
80
|
"peerDependencies": {
|
|
75
|
-
"@itwin/appui-abstract": "^
|
|
76
|
-
"@itwin/appui-react": "^4.0.0-dev.
|
|
77
|
-
"@itwin/
|
|
78
|
-
"@itwin/
|
|
79
|
-
"@itwin/core-
|
|
80
|
-
"@itwin/core-
|
|
81
|
-
"@itwin/core-
|
|
82
|
-
"@itwin/
|
|
81
|
+
"@itwin/appui-abstract": "^3.7.1",
|
|
82
|
+
"@itwin/appui-layout-react": "^4.0.0-dev.17",
|
|
83
|
+
"@itwin/appui-react": "^4.0.0-dev.17",
|
|
84
|
+
"@itwin/components-react": "^4.0.0-dev.17",
|
|
85
|
+
"@itwin/core-bentley": "^3.7.1",
|
|
86
|
+
"@itwin/core-common": "^3.7.1",
|
|
87
|
+
"@itwin/core-frontend": "^3.7.1",
|
|
88
|
+
"@itwin/core-react": "^4.0.0-dev.17",
|
|
89
|
+
"@itwin/imodel-components-react": "^4.0.0-dev.17",
|
|
83
90
|
"react": "^17.0.0",
|
|
84
91
|
"react-dom": "^17.0.0"
|
|
85
92
|
},
|