@itwin/map-layers 4.0.0-dev.48 → 4.0.0-dev.50

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 (79) hide show
  1. package/lib/cjs/MapLayerPreferences.js +2 -1
  2. package/lib/cjs/MapLayerPreferences.js.map +1 -1
  3. package/lib/cjs/mapLayers.js +3 -2
  4. package/lib/cjs/mapLayers.js.map +1 -1
  5. package/lib/cjs/ui/FeatureInfoUiItemsProvider.js +3 -2
  6. package/lib/cjs/ui/FeatureInfoUiItemsProvider.js.map +1 -1
  7. package/lib/cjs/ui/MapLayersUiItemsProvider.js +2 -2
  8. package/lib/cjs/ui/MapLayersUiItemsProvider.js.map +1 -1
  9. package/lib/cjs/ui/widget/AttachLayerPopupButton.js +15 -12
  10. package/lib/cjs/ui/widget/AttachLayerPopupButton.js.map +1 -1
  11. package/lib/cjs/ui/widget/BasemapPanel.js +1 -1
  12. package/lib/cjs/ui/widget/BasemapPanel.js.map +1 -1
  13. package/lib/cjs/ui/widget/ConfirmMessageDialog.js +7 -4
  14. package/lib/cjs/ui/widget/ConfirmMessageDialog.js.map +1 -1
  15. package/lib/cjs/ui/widget/FeatureInfoDataProvider.d.ts +2 -7
  16. package/lib/cjs/ui/widget/FeatureInfoDataProvider.d.ts.map +1 -1
  17. package/lib/cjs/ui/widget/FeatureInfoDataProvider.js +27 -25
  18. package/lib/cjs/ui/widget/FeatureInfoDataProvider.js.map +1 -1
  19. package/lib/cjs/ui/widget/FeatureInfoWidget.d.ts.map +1 -1
  20. package/lib/cjs/ui/widget/FeatureInfoWidget.js +21 -10
  21. package/lib/cjs/ui/widget/FeatureInfoWidget.js.map +1 -1
  22. package/lib/cjs/ui/widget/MapLayerDroppable.js +7 -4
  23. package/lib/cjs/ui/widget/MapLayerDroppable.js.map +1 -1
  24. package/lib/cjs/ui/widget/MapLayerManager.js +19 -17
  25. package/lib/cjs/ui/widget/MapLayerManager.js.map +1 -1
  26. package/lib/cjs/ui/widget/MapLayerSettingsMenu.js +3 -2
  27. package/lib/cjs/ui/widget/MapLayerSettingsMenu.js.map +1 -1
  28. package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.js +2 -2
  29. package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.js.map +1 -1
  30. package/lib/cjs/ui/widget/MapLayersWidget.js +4 -4
  31. package/lib/cjs/ui/widget/MapLayersWidget.js.map +1 -1
  32. package/lib/cjs/ui/widget/MapUrlDialog.js +27 -24
  33. package/lib/cjs/ui/widget/MapUrlDialog.js.map +1 -1
  34. package/lib/cjs/ui/widget/SelectMapFormat.js +12 -7
  35. package/lib/cjs/ui/widget/SelectMapFormat.js.map +1 -1
  36. package/lib/cjs/ui/widget/SubLayersDataProvider.js +5 -4
  37. package/lib/cjs/ui/widget/SubLayersDataProvider.js.map +1 -1
  38. package/lib/cjs/ui/widget/SubLayersTree.js +34 -28
  39. package/lib/cjs/ui/widget/SubLayersTree.js.map +1 -1
  40. package/lib/esm/MapLayerPreferences.js +2 -1
  41. package/lib/esm/MapLayerPreferences.js.map +1 -1
  42. package/lib/esm/mapLayers.js +3 -2
  43. package/lib/esm/mapLayers.js.map +1 -1
  44. package/lib/esm/ui/FeatureInfoUiItemsProvider.js +3 -2
  45. package/lib/esm/ui/FeatureInfoUiItemsProvider.js.map +1 -1
  46. package/lib/esm/ui/MapLayersUiItemsProvider.js +2 -2
  47. package/lib/esm/ui/MapLayersUiItemsProvider.js.map +1 -1
  48. package/lib/esm/ui/widget/AttachLayerPopupButton.js +15 -12
  49. package/lib/esm/ui/widget/AttachLayerPopupButton.js.map +1 -1
  50. package/lib/esm/ui/widget/BasemapPanel.js +1 -1
  51. package/lib/esm/ui/widget/BasemapPanel.js.map +1 -1
  52. package/lib/esm/ui/widget/ConfirmMessageDialog.js +7 -4
  53. package/lib/esm/ui/widget/ConfirmMessageDialog.js.map +1 -1
  54. package/lib/esm/ui/widget/FeatureInfoDataProvider.d.ts +2 -7
  55. package/lib/esm/ui/widget/FeatureInfoDataProvider.d.ts.map +1 -1
  56. package/lib/esm/ui/widget/FeatureInfoDataProvider.js +27 -25
  57. package/lib/esm/ui/widget/FeatureInfoDataProvider.js.map +1 -1
  58. package/lib/esm/ui/widget/FeatureInfoWidget.d.ts.map +1 -1
  59. package/lib/esm/ui/widget/FeatureInfoWidget.js +23 -12
  60. package/lib/esm/ui/widget/FeatureInfoWidget.js.map +1 -1
  61. package/lib/esm/ui/widget/MapLayerDroppable.js +7 -4
  62. package/lib/esm/ui/widget/MapLayerDroppable.js.map +1 -1
  63. package/lib/esm/ui/widget/MapLayerManager.js +19 -17
  64. package/lib/esm/ui/widget/MapLayerManager.js.map +1 -1
  65. package/lib/esm/ui/widget/MapLayerSettingsMenu.js +3 -2
  66. package/lib/esm/ui/widget/MapLayerSettingsMenu.js.map +1 -1
  67. package/lib/esm/ui/widget/MapLayerSettingsPopupButton.js +2 -2
  68. package/lib/esm/ui/widget/MapLayerSettingsPopupButton.js.map +1 -1
  69. package/lib/esm/ui/widget/MapLayersWidget.js +4 -4
  70. package/lib/esm/ui/widget/MapLayersWidget.js.map +1 -1
  71. package/lib/esm/ui/widget/MapUrlDialog.js +27 -24
  72. package/lib/esm/ui/widget/MapUrlDialog.js.map +1 -1
  73. package/lib/esm/ui/widget/SelectMapFormat.js +12 -7
  74. package/lib/esm/ui/widget/SelectMapFormat.js.map +1 -1
  75. package/lib/esm/ui/widget/SubLayersDataProvider.js +5 -4
  76. package/lib/esm/ui/widget/SubLayersDataProvider.js.map +1 -1
  77. package/lib/esm/ui/widget/SubLayersTree.js +34 -28
  78. package/lib/esm/ui/widget/SubLayersTree.js.map +1 -1
  79. package/package.json +29 -22
@@ -1 +1 @@
1
- {"version":3,"file":"BasemapPanel.js","sourceRoot":"","sources":["../../../../src/ui/widget/BasemapPanel.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F,4CAA4C;AAC5C,2CAA2C;;;AAE3C,oDAAiD;AACjD,oDAAuH;AAEvH,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BAAW,CAAC,YAAY,CAAC,kBAAkB,CAAC,mCAAmC,CAAC,CAAC,CAAC;IAE5H,OAAO,CACL;QACE,6BAAK,SAAS,EAAC,uBAAuB;YACpC,oBAAC,sBAAM,IAAC,IAAI,EAAC,OAAO,EAAC,SAAS,EAAC,YAAY,EAAE,KAAK,EAAE,gBAAgB,EAAE,OAAO,EAAE,sBAAsB,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,IAAI,CAAC,cAAc,IAAI,CAAC,CAAC,cAAc,CAAC,YAAY,CAAC,iBAAiB,YAAY,mCAAqB,CAAC;gBACrO,oBAAC,wBAAW,IAAC,QAAQ,EAAE,cAAc,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,wBAAwB,GAAI,CACjF;YACT,8BAAM,SAAS,EAAC,wBAAwB,IAAE,cAAc,CAAQ;YAChE,oBAAC,sBAAM,IAAC,SAAS,EAAC,8BAA8B,EAC9C,OAAO,EAAE,cAAc,EACvB,WAAW,EAAE,kBAAkB,EAC/B,KAAK,EAAE,oBAAoB,CAAC,KAAK,EACjC,QAAQ,EAAE,sBAAsB,EAAE,IAAI,EAAC,OAAO,EAC9C,QAAQ,EAAE,KAAK,CAAC,QAAQ,GACxB;YAEA,WAAW;gBACX,oBAAC,qCAAW,IAAC,SAAS,EAAC,6BAA6B,EAAC,QAAQ,EAAE,sBAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,kBAAkB,GAAI;YAE9I,oBAAC,iDAAuB,IAAC,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,YAAY,EAAE,wBAAwB,EAAE,oBAAoB,EAAE,+BAA+B,GAAG,CAC/I,CACL,CACJ,CAAC;AACJ,CAAC;AAxJD,oCAwJC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/* eslint-disable deprecation/deprecation */\n// cSpell:ignore droppable Sublayer Basemap\n\nimport { UiFramework } from \"@itwin/appui-react\";\nimport { BaseMapLayerSettings, ColorByName, ColorDef, ImageMapLayerSettings, MapLayerProps } from \"@itwin/core-common\";\nimport { DisplayStyleState } from \"@itwin/core-frontend\";\nimport { WebFontIcon } from \"@itwin/core-react\";\nimport { ColorPickerDialog, ColorSwatch } from \"@itwin/imodel-components-react\";\nimport { Button, Select, SelectOption } from \"@itwin/itwinui-react\";\nimport * as React from \"react\";\nimport { MapLayersUI } from \"../../mapLayers\";\nimport \"./BasemapPanel.scss\";\nimport { useSourceMapContext } from \"./MapLayerManager\";\nimport { TransparencyPopupButton } from \"./TransparencyPopupButton\";\n\nfunction getBaseMapFromStyle(displayStyle: DisplayStyleState | undefined) {\n if (!displayStyle)\n return undefined;\n\n if (displayStyle.settings.mapImagery.backgroundBase instanceof ImageMapLayerSettings || displayStyle.settings.mapImagery.backgroundBase instanceof ColorDef)\n return displayStyle.settings.mapImagery.backgroundBase.toJSON();\n\n return undefined;\n}\n\ninterface BasemapPanelProps {\n disabled?: boolean;\n}\n\n/** @internal */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function BasemapPanel(props: BasemapPanelProps) {\n const [useColorLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Basemap.ColorFill\"));\n const { activeViewport, bases } = useSourceMapContext();\n const [selectedBaseMap, setSelectedBaseMap] = React.useState<MapLayerProps | number | undefined>(getBaseMapFromStyle(activeViewport?.displayStyle));\n const [baseMapTransparencyValue, setBaseMapTransparencyValue] = React.useState(() => {\n if (activeViewport)\n return activeViewport.displayStyle.baseMapTransparency;\n return 0;\n });\n const [baseMapVisible, setBaseMapVisible] = React.useState(() => {\n if (activeViewport && activeViewport.displayStyle.backgroundMapBase instanceof ImageMapLayerSettings) {\n return activeViewport.displayStyle.backgroundMapBase.visible;\n }\n return false;\n });\n\n // Monitor viewport updates, and refresh the widget accordingly.\n // Note: This is needed for multiple viewport applications.\n React.useEffect(() => {\n if (activeViewport) {\n setBaseMapTransparencyValue(activeViewport.displayStyle.baseMapTransparency);\n setSelectedBaseMap(getBaseMapFromStyle(activeViewport.displayStyle));\n if (activeViewport.displayStyle.backgroundMapBase instanceof ImageMapLayerSettings) {\n setBaseMapVisible(activeViewport.displayStyle.backgroundMapBase.visible);\n }\n }\n }, [activeViewport]);\n\n const handleBasemapTransparencyChange = React.useCallback((transparency: number) => {\n if (activeViewport) {\n activeViewport.displayStyle.changeBaseMapTransparency(transparency);\n activeViewport.invalidateRenderPlan();\n setBaseMapTransparencyValue(transparency);\n }\n }, [activeViewport]);\n\n const baseMapOptions = React.useMemo<SelectOption<string>[]>(() => {\n const baseOptions: SelectOption<string>[] = [];\n\n baseOptions.push({ value: useColorLabel, label: useColorLabel });\n\n if (bases)\n baseOptions.push(...bases.map((value) => ({ value: value.name, label: value.name })));\n return baseOptions;\n }, [bases, useColorLabel]);\n\n const [presetColors] = React.useState([\n ColorDef.create(ColorByName.grey),\n ColorDef.create(ColorByName.lightGrey),\n ColorDef.create(ColorByName.darkGrey),\n ColorDef.create(ColorByName.lightBlue),\n ColorDef.create(ColorByName.lightGreen),\n ColorDef.create(ColorByName.darkGreen),\n ColorDef.create(ColorByName.tan),\n ColorDef.create(ColorByName.darkBrown),\n ]);\n\n const baseIsColor = React.useMemo(() => typeof selectedBaseMap === \"number\", [selectedBaseMap]);\n const baseIsMap = React.useMemo(() => !baseIsColor && (selectedBaseMap !== undefined), [baseIsColor, selectedBaseMap]);\n const bgColor = React.useMemo(() => baseIsColor ? selectedBaseMap as number : presetColors[0].toJSON(), [baseIsColor, selectedBaseMap, presetColors]);\n const [colorDialogTitle] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:ColorDialog.Title\"));\n const selectedBaseMapValue = React.useMemo(() => {\n if (baseIsMap) {\n const mapName = (selectedBaseMap! as MapLayerProps).name;\n const foundItem = baseMapOptions.find((value) => value.label === mapName);\n if (foundItem)\n return foundItem;\n }\n return baseMapOptions[0];\n }, [selectedBaseMap, baseMapOptions, baseIsMap]);\n\n const handleBackgroundColorDialogOk = React.useCallback((bgColorDef: ColorDef) => {\n UiFramework.dialogs.modal.close();\n if (activeViewport) {\n // change color and make sure previously set transparency is not lost.\n const curTransparency = activeViewport.displayStyle.backgroundMapBase instanceof ColorDef ? activeViewport.displayStyle.backgroundMapBase.getTransparency() : 0;\n activeViewport.displayStyle.backgroundMapBase = bgColorDef.withTransparency(curTransparency);\n activeViewport.invalidateRenderPlan();\n setSelectedBaseMap(bgColorDef.toJSON());\n }\n }, [activeViewport]);\n\n const handleBackgroundColorDialogCancel = React.useCallback(() => {\n UiFramework.dialogs.modal.close();\n }, []);\n\n const handleBgColorClick = React.useCallback((newColor: ColorDef, e: React.MouseEvent<Element, MouseEvent>) => {\n e.preventDefault();\n UiFramework.dialogs.modal.open(<ColorPickerDialog dialogTitle={colorDialogTitle} color={newColor} colorPresets={presetColors} colorInputType={\"rgb\"}\n onOkResult={handleBackgroundColorDialogOk} onCancelResult={handleBackgroundColorDialogCancel} />);\n }, [presetColors, handleBackgroundColorDialogOk]); // eslint-disable-line react-hooks/exhaustive-deps\n\n const handleBaseMapSelection = React.useCallback((value: string) => {\n if (bases && activeViewport && value) {\n const baseMap = bases.find((map) => map.name === value);\n if (baseMap) {\n const baseProps: MapLayerProps = baseMap.toJSON();\n if (activeViewport.displayStyle.backgroundMapBase instanceof BaseMapLayerSettings) {\n activeViewport.displayStyle.backgroundMapBase = activeViewport.displayStyle.backgroundMapBase.clone(baseProps);\n } else {\n activeViewport.displayStyle.backgroundMapBase = BaseMapLayerSettings.fromJSON(baseProps);\n }\n activeViewport.invalidateRenderPlan();\n setSelectedBaseMap(baseProps);\n } else {\n const bgColorDef = ColorDef.fromJSON(bgColor);\n const curTransparency = activeViewport.displayStyle.backgroundMapBase instanceof ColorDef ? activeViewport.displayStyle.backgroundMapBase.getTransparency() : 0;\n activeViewport.displayStyle.backgroundMapBase = bgColorDef.withTransparency(curTransparency);\n activeViewport.invalidateRenderPlan();\n setSelectedBaseMap(bgColorDef.toJSON());\n }\n }\n }, [bases, activeViewport, bgColor]);\n\n const handleVisibilityChange = React.useCallback(() => {\n if (activeViewport) {\n const newState = !baseMapVisible;\n // BaseMap visibility is only support when backgroundBase is an instance of BaseMapLayerSettings (i.e not a color)...\n if (activeViewport.displayStyle.backgroundMapBase instanceof BaseMapLayerSettings) {\n activeViewport.displayStyle.backgroundMapBase = activeViewport.displayStyle.backgroundMapBase.clone({ visible: newState });\n activeViewport.invalidateRenderPlan();\n }\n setBaseMapVisible(newState);\n }\n }, [baseMapVisible, activeViewport]);\n\n const [baseLayerLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Basemap.BaseLayer\"));\n const [selectBaseMapLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Basemap.SelectBaseMap\"));\n const [toggleVisibility] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Widget.ToggleVisibility\"));\n\n return (\n <>\n <div className=\"map-manager-base-item\" >\n <Button size=\"small\" styleType=\"borderless\" title={toggleVisibility} onClick={handleVisibilityChange} disabled={props.disabled || !activeViewport || !(activeViewport.displayStyle.backgroundMapBase instanceof ImageMapLayerSettings)}>\n <WebFontIcon iconName={baseMapVisible ? \"icon-visibility\" : \"icon-visibility-hide-2\"} />\n </Button>\n <span className=\"map-manager-base-label\">{baseLayerLabel}</span>\n <Select className=\"map-manager-base-item-select\"\n options={baseMapOptions}\n placeholder={selectBaseMapLabel}\n value={selectedBaseMapValue.value}\n onChange={handleBaseMapSelection} size=\"small\"\n disabled={props.disabled}\n />\n {\n baseIsColor &&\n <ColorSwatch className=\"map-manager-base-item-color\" colorDef={ColorDef.fromJSON(bgColor)} round={false} onColorPick={handleBgColorClick} />\n }\n <TransparencyPopupButton disabled={props.disabled} transparency={baseMapTransparencyValue} onTransparencyChange={handleBasemapTransparencyChange}/>\n </div>\n </>\n );\n}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B,EAAE,oBAAoB,EAAE,+BAA+B,GAAG,CAC/I,CACL,CACJ,CAAC;AACJ,CAAC;AAxJD,oCAwJC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/* eslint-disable deprecation/deprecation */\n// cSpell:ignore droppable Sublayer Basemap\n\nimport { UiFramework } from \"@itwin/appui-react\";\nimport { BaseMapLayerSettings, ColorByName, ColorDef, ImageMapLayerSettings, MapLayerProps } from \"@itwin/core-common\";\nimport { DisplayStyleState } from \"@itwin/core-frontend\";\nimport { WebFontIcon } from \"@itwin/core-react\";\nimport { ColorPickerDialog, ColorSwatch } from \"@itwin/imodel-components-react\";\nimport { Button, Select, SelectOption } from \"@itwin/itwinui-react\";\nimport * as React from \"react\";\nimport { MapLayersUI } from \"../../mapLayers\";\nimport \"./BasemapPanel.scss\";\nimport { useSourceMapContext } from \"./MapLayerManager\";\nimport { TransparencyPopupButton } from \"./TransparencyPopupButton\";\n\nfunction getBaseMapFromStyle(displayStyle: DisplayStyleState | undefined) {\n if (!displayStyle)\n return undefined;\n\n if (displayStyle.settings.mapImagery.backgroundBase instanceof ImageMapLayerSettings || displayStyle.settings.mapImagery.backgroundBase instanceof ColorDef)\n return displayStyle.settings.mapImagery.backgroundBase.toJSON();\n\n return undefined;\n}\n\ninterface BasemapPanelProps {\n disabled?: boolean;\n}\n\n/** @internal */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function BasemapPanel(props: BasemapPanelProps) {\n const [useColorLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Basemap.ColorFill\"));\n const { activeViewport, bases } = useSourceMapContext();\n const [selectedBaseMap, setSelectedBaseMap] = React.useState<MapLayerProps | number | undefined>(getBaseMapFromStyle(activeViewport?.displayStyle));\n const [baseMapTransparencyValue, setBaseMapTransparencyValue] = React.useState(() => {\n if (activeViewport)\n return activeViewport.displayStyle.baseMapTransparency;\n return 0;\n });\n const [baseMapVisible, setBaseMapVisible] = React.useState(() => {\n if (activeViewport && activeViewport.displayStyle.backgroundMapBase instanceof ImageMapLayerSettings) {\n return activeViewport.displayStyle.backgroundMapBase.visible;\n }\n return false;\n });\n\n // Monitor viewport updates, and refresh the widget accordingly.\n // Note: This is needed for multiple viewport applications.\n React.useEffect(() => {\n if (activeViewport) {\n setBaseMapTransparencyValue(activeViewport.displayStyle.baseMapTransparency);\n setSelectedBaseMap(getBaseMapFromStyle(activeViewport.displayStyle));\n if (activeViewport.displayStyle.backgroundMapBase instanceof ImageMapLayerSettings) {\n setBaseMapVisible(activeViewport.displayStyle.backgroundMapBase.visible);\n }\n }\n }, [activeViewport]);\n\n const handleBasemapTransparencyChange = React.useCallback((transparency: number) => {\n if (activeViewport) {\n activeViewport.displayStyle.changeBaseMapTransparency(transparency);\n activeViewport.invalidateRenderPlan();\n setBaseMapTransparencyValue(transparency);\n }\n }, [activeViewport]);\n\n const baseMapOptions = React.useMemo<SelectOption<string>[]>(() => {\n const baseOptions: SelectOption<string>[] = [];\n\n baseOptions.push({ value: useColorLabel, label: useColorLabel });\n\n if (bases)\n baseOptions.push(...bases.map((value) => ({ value: value.name, label: value.name })));\n return baseOptions;\n }, [bases, useColorLabel]);\n\n const [presetColors] = React.useState([\n ColorDef.create(ColorByName.grey),\n ColorDef.create(ColorByName.lightGrey),\n ColorDef.create(ColorByName.darkGrey),\n ColorDef.create(ColorByName.lightBlue),\n ColorDef.create(ColorByName.lightGreen),\n ColorDef.create(ColorByName.darkGreen),\n ColorDef.create(ColorByName.tan),\n ColorDef.create(ColorByName.darkBrown),\n ]);\n\n const baseIsColor = React.useMemo(() => typeof selectedBaseMap === \"number\", [selectedBaseMap]);\n const baseIsMap = React.useMemo(() => !baseIsColor && (selectedBaseMap !== undefined), [baseIsColor, selectedBaseMap]);\n const bgColor = React.useMemo(() => baseIsColor ? selectedBaseMap as number : presetColors[0].toJSON(), [baseIsColor, selectedBaseMap, presetColors]);\n const [colorDialogTitle] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:ColorDialog.Title\"));\n const selectedBaseMapValue = React.useMemo(() => {\n if (baseIsMap) {\n const mapName = (selectedBaseMap! as MapLayerProps).name;\n const foundItem = baseMapOptions.find((value) => value.label === mapName);\n if (foundItem)\n return foundItem;\n }\n return baseMapOptions[0];\n }, [selectedBaseMap, baseMapOptions, baseIsMap]);\n\n const handleBackgroundColorDialogOk = React.useCallback((bgColorDef: ColorDef) => {\n UiFramework.dialogs.modal.close();\n if (activeViewport) {\n // change color and make sure previously set transparency is not lost.\n const curTransparency = activeViewport.displayStyle.backgroundMapBase instanceof ColorDef ? activeViewport.displayStyle.backgroundMapBase.getTransparency() : 0;\n activeViewport.displayStyle.backgroundMapBase = bgColorDef.withTransparency(curTransparency);\n activeViewport.invalidateRenderPlan();\n setSelectedBaseMap(bgColorDef.toJSON());\n }\n }, [activeViewport]);\n\n const handleBackgroundColorDialogCancel = React.useCallback(() => {\n UiFramework.dialogs.modal.close();\n }, []);\n\n const handleBgColorClick = React.useCallback((newColor: ColorDef, e: React.MouseEvent<Element, MouseEvent>) => {\n e.preventDefault();\n UiFramework.dialogs.modal.open(<ColorPickerDialog dialogTitle={colorDialogTitle} color={newColor} colorPresets={presetColors} colorInputType={\"rgb\"}\n onOkResult={handleBackgroundColorDialogOk} onCancelResult={handleBackgroundColorDialogCancel} />);\n }, [presetColors, handleBackgroundColorDialogOk]); // eslint-disable-line react-hooks/exhaustive-deps\n\n const handleBaseMapSelection = React.useCallback((value: string) => {\n if (bases && activeViewport && value) {\n const baseMap = bases.find((map) => map.name === value);\n if (baseMap) {\n const baseProps: MapLayerProps = baseMap.toJSON();\n if (activeViewport.displayStyle.backgroundMapBase instanceof BaseMapLayerSettings) {\n activeViewport.displayStyle.backgroundMapBase = activeViewport.displayStyle.backgroundMapBase.clone(baseProps);\n } else {\n activeViewport.displayStyle.backgroundMapBase = BaseMapLayerSettings.fromJSON(baseProps);\n }\n activeViewport.invalidateRenderPlan();\n setSelectedBaseMap(baseProps);\n } else {\n const bgColorDef = ColorDef.fromJSON(bgColor);\n const curTransparency = activeViewport.displayStyle.backgroundMapBase instanceof ColorDef ? activeViewport.displayStyle.backgroundMapBase.getTransparency() : 0;\n activeViewport.displayStyle.backgroundMapBase = bgColorDef.withTransparency(curTransparency);\n activeViewport.invalidateRenderPlan();\n setSelectedBaseMap(bgColorDef.toJSON());\n }\n }\n }, [bases, activeViewport, bgColor]);\n\n const handleVisibilityChange = React.useCallback(() => {\n if (activeViewport) {\n const newState = !baseMapVisible;\n // BaseMap visibility is only support when backgroundBase is an instance of BaseMapLayerSettings (i.e not a color)...\n if (activeViewport.displayStyle.backgroundMapBase instanceof BaseMapLayerSettings) {\n activeViewport.displayStyle.backgroundMapBase = activeViewport.displayStyle.backgroundMapBase.clone({ visible: newState });\n activeViewport.invalidateRenderPlan();\n }\n setBaseMapVisible(newState);\n }\n }, [baseMapVisible, activeViewport]);\n\n const [baseLayerLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Basemap.BaseLayer\"));\n const [selectBaseMapLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Basemap.SelectBaseMap\"));\n const [toggleVisibility] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Widget.ToggleVisibility\"));\n\n return (\n <>\n <div className=\"map-manager-base-item\" >\n <Button size=\"small\" styleType=\"borderless\" title={toggleVisibility} onClick={handleVisibilityChange} disabled={props.disabled || !activeViewport || !(activeViewport.displayStyle.backgroundMapBase instanceof ImageMapLayerSettings)}>\n <WebFontIcon iconName={baseMapVisible ? \"icon-visibility\" : \"icon-visibility-hide-2\"} />\n </Button>\n <span className=\"map-manager-base-label\">{baseLayerLabel}</span>\n <Select className=\"map-manager-base-item-select\"\n options={baseMapOptions}\n placeholder={selectBaseMapLabel}\n value={selectedBaseMapValue.value}\n onChange={handleBaseMapSelection} size=\"small\"\n disabled={props.disabled}\n />\n {\n baseIsColor &&\n <ColorSwatch className=\"map-manager-base-item-color\" colorDef={ColorDef.fromJSON(bgColor)} round={false} onColorPick={handleBgColorClick} />\n }\n <TransparencyPopupButton disabled={props.disabled} transparency={baseMapTransparencyValue} onTransparencyChange={handleBasemapTransparencyChange}/>\n </div>\n </>\n );\n}\n"]}
@@ -12,10 +12,13 @@ require("./MapUrlDialog.scss");
12
12
  const appui_abstract_1 = require("@itwin/appui-abstract");
13
13
  // eslint-disable-next-line @typescript-eslint/naming-convention
14
14
  function ConfirmMessageDialog(props) {
15
- const buttonCluster = React.useMemo(() => [
16
- { type: appui_abstract_1.DialogButtonType.Yes, onClick: props.onYesResult ?? (() => { }) },
17
- { type: appui_abstract_1.DialogButtonType.No, onClick: props.onNoResult ?? (() => { }) },
18
- ], [props.onYesResult, props.onNoResult]);
15
+ const buttonCluster = React.useMemo(() => {
16
+ var _a, _b;
17
+ return [
18
+ { type: appui_abstract_1.DialogButtonType.Yes, onClick: (_a = props.onYesResult) !== null && _a !== void 0 ? _a : (() => { }) },
19
+ { type: appui_abstract_1.DialogButtonType.No, onClick: (_b = props.onNoResult) !== null && _b !== void 0 ? _b : (() => { }) },
20
+ ];
21
+ }, [props.onYesResult, props.onNoResult]);
19
22
  return (React.createElement(core_react_1.Dialog, { className: props.className, title: props.title, opened: true, resizable: false, movable: true, modal: true, buttonCluster: buttonCluster, onClose: props.onClose, onEscape: props.onEscape, minHeight: props.minHeight, maxHeight: props.maxHeight, minWidth: props.minWidth, maxWidth: props.maxWidth, trapFocus: false },
20
23
  React.createElement("div", null, props.message)));
21
24
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ConfirmMessageDialog.js","sourceRoot":"","sources":["../../../../src/ui/widget/ConfirmMessageDialog.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F,8BAA8B;;;AAE9B,+BAA+B;AAC/B,kDAAwD;AAExD,+BAA6B;AAC7B,0DAAyD;AAoBzD,gEAAgE;AAChE,SAAgB,oBAAoB,CAAC,KAAgC;IAEnE,MAAM,aAAa,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC;QACxC,EAAE,IAAI,EAAE,iCAAgB,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,CAAC,WAAW,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,EAAE;QACzE,EAAE,IAAI,EAAE,iCAAgB,CAAC,EAAE,EAAE,OAAO,EAAE,KAAK,CAAC,UAAU,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,EAAE;KACxE,EAAE,CAAC,KAAK,CAAC,WAAW,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC;IAE1C,OAAO,CACL,oBAAC,mBAAM,IACL,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,MAAM,EAAE,IAAI,EACZ,SAAS,EAAE,KAAK,EAChB,OAAO,EAAE,IAAI,EACb,KAAK,EAAE,IAAI,EACX,aAAa,EAAE,aAAa,EAC5B,OAAO,EAAE,KAAK,CAAC,OAAO,EACtB,QAAQ,EAAE,KAAK,CAAC,QAAQ,EACxB,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,QAAQ,EAAE,KAAK,CAAC,QAAQ,EACxB,QAAQ,EAAE,KAAK,CAAC,QAAQ,EACxB,SAAS,EAAE,KAAK;QAEhB,iCAAM,KAAK,CAAC,OAAO,CAAO,CACnB,CACV,CAAC;AACJ,CAAC;AA3BD,oDA2BC","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 * as React from \"react\";\nimport { CommonProps, Dialog } from \"@itwin/core-react\";\n\nimport \"./MapUrlDialog.scss\";\nimport { DialogButtonType } from \"@itwin/appui-abstract\";\n\ninterface ConfirmMessageDialogProps extends CommonProps {\n\n /** Title to show in title bar of dialog */\n title?: string | JSX.Element;\n message?: string | JSX.Element;\n onYesResult?: () => void;\n onNoResult?: () => void;\n onClose?: () => void;\n onEscape?: () => void;\n minWidth?: string | number;\n /** Minimum height that the dialog may be resized to. Displayed in px if value is a number; otherwise, displayed in specified CSS unit. Default: 100px */\n minHeight?: string | number;\n /** Maximum width that the dialog may be resized to. Displayed in px if value is a number; otherwise, displayed in specified CSS unit. */\n maxWidth?: string | number;\n /** Maximum height that the dialog may be resized to. Displayed in px if value is a number; otherwise, displayed in specified CSS unit. */\n maxHeight?: string | number;\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function ConfirmMessageDialog(props: ConfirmMessageDialogProps) {\n\n const buttonCluster = React.useMemo(() => [\n { type: DialogButtonType.Yes, onClick: props.onYesResult ?? (() => { }) },\n { type: DialogButtonType.No, onClick: props.onNoResult ?? (() => { }) },\n ], [props.onYesResult, props.onNoResult]);\n\n return (\n <Dialog\n className={props.className}\n title={props.title}\n opened={true}\n resizable={false}\n movable={true}\n modal={true}\n buttonCluster={buttonCluster}\n onClose={props.onClose}\n onEscape={props.onEscape}\n minHeight={props.minHeight}\n maxHeight={props.maxHeight}\n minWidth={props.minWidth}\n maxWidth={props.maxWidth}\n trapFocus={false}\n >\n <div>{props.message}</div>\n </Dialog>\n );\n}\n"]}
1
+ {"version":3,"file":"ConfirmMessageDialog.js","sourceRoot":"","sources":["../../../../src/ui/widget/ConfirmMessageDialog.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F,8BAA8B;;;AAE9B,+BAA+B;AAC/B,kDAAwD;AAExD,+BAA6B;AAC7B,0DAAyD;AAoBzD,gEAAgE;AAChE,SAAgB,oBAAoB,CAAC,KAAgC;IAEnE,MAAM,aAAa,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE;;QAAC,OAAA;YACxC,EAAE,IAAI,EAAE,iCAAgB,CAAC,GAAG,EAAE,OAAO,EAAE,MAAA,KAAK,CAAC,WAAW,mCAAI,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,EAAE;YACzE,EAAE,IAAI,EAAE,iCAAgB,CAAC,EAAE,EAAE,OAAO,EAAE,MAAA,KAAK,CAAC,UAAU,mCAAI,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,EAAE;SACxE,CAAA;KAAA,EAAE,CAAC,KAAK,CAAC,WAAW,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC;IAE1C,OAAO,CACL,oBAAC,mBAAM,IACL,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,MAAM,EAAE,IAAI,EACZ,SAAS,EAAE,KAAK,EAChB,OAAO,EAAE,IAAI,EACb,KAAK,EAAE,IAAI,EACX,aAAa,EAAE,aAAa,EAC5B,OAAO,EAAE,KAAK,CAAC,OAAO,EACtB,QAAQ,EAAE,KAAK,CAAC,QAAQ,EACxB,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,QAAQ,EAAE,KAAK,CAAC,QAAQ,EACxB,QAAQ,EAAE,KAAK,CAAC,QAAQ,EACxB,SAAS,EAAE,KAAK;QAEhB,iCAAM,KAAK,CAAC,OAAO,CAAO,CACnB,CACV,CAAC;AACJ,CAAC;AA3BD,oDA2BC","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 * as React from \"react\";\nimport { CommonProps, Dialog } from \"@itwin/core-react\";\n\nimport \"./MapUrlDialog.scss\";\nimport { DialogButtonType } from \"@itwin/appui-abstract\";\n\ninterface ConfirmMessageDialogProps extends CommonProps {\n\n /** Title to show in title bar of dialog */\n title?: string | JSX.Element;\n message?: string | JSX.Element;\n onYesResult?: () => void;\n onNoResult?: () => void;\n onClose?: () => void;\n onEscape?: () => void;\n minWidth?: string | number;\n /** Minimum height that the dialog may be resized to. Displayed in px if value is a number; otherwise, displayed in specified CSS unit. Default: 100px */\n minHeight?: string | number;\n /** Maximum width that the dialog may be resized to. Displayed in px if value is a number; otherwise, displayed in specified CSS unit. */\n maxWidth?: string | number;\n /** Maximum height that the dialog may be resized to. Displayed in px if value is a number; otherwise, displayed in specified CSS unit. */\n maxHeight?: string | number;\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function ConfirmMessageDialog(props: ConfirmMessageDialogProps) {\n\n const buttonCluster = React.useMemo(() => [\n { type: DialogButtonType.Yes, onClick: props.onYesResult ?? (() => { }) },\n { type: DialogButtonType.No, onClick: props.onNoResult ?? (() => { }) },\n ], [props.onYesResult, props.onNoResult]);\n\n return (\n <Dialog\n className={props.className}\n title={props.title}\n opened={true}\n resizable={false}\n movable={true}\n modal={true}\n buttonCluster={buttonCluster}\n onClose={props.onClose}\n onEscape={props.onEscape}\n minHeight={props.minHeight}\n maxHeight={props.maxHeight}\n minWidth={props.minWidth}\n maxWidth={props.maxWidth}\n trapFocus={false}\n >\n <div>{props.message}</div>\n </Dialog>\n );\n}\n"]}
@@ -15,17 +15,12 @@ export interface MapFeatureInfoDataUpdate {
15
15
  recordCount: number;
16
16
  }
17
17
  export declare type MapFeatureInfoDataUpdatedListener = (data: MapFeatureInfoDataUpdate) => void;
18
- export declare class FeatureInfoDataProvider implements IPropertyDataProvider, PropertyData {
18
+ export declare class FeatureInfoDataProvider implements IPropertyDataProvider {
19
19
  private _removeListener;
20
- label: PropertyRecord;
21
- description?: string;
22
- categories: PropertyCategory[];
23
- records: {
24
- [categoryName: string]: PropertyRecord[];
25
- };
26
20
  onDataChanged: PropertyDataChangeEvent;
27
21
  onDataLoadStateChanged: BeEvent<MapFeatureInfoLoadListener>;
28
22
  onDataUpdated: BeEvent<MapFeatureInfoDataUpdatedListener>;
23
+ private _data;
29
24
  constructor(onMapHit: MapHitEvent);
30
25
  onUnload(): void;
31
26
  private _handleMapHit;
@@ -1 +1 @@
1
- {"version":3,"file":"FeatureInfoDataProvider.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/FeatureInfoDataProvider.ts"],"names":[],"mappings":"AAKA,OAAO,EAAG,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,YAAY,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AACzH,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAE9C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAG5C;;;GAGG;AAEH,oBAAY,uBAAuB;IAAE,aAAa,IAAA;IAAE,WAAW,IAAA;CAAC;AAChE,MAAM,CAAC,OAAO,MAAM,0BAA0B,GAAG,CAAC,KAAK,EAAE,uBAAuB,KAAK,IAAI,CAAC;AAE1F,MAAM,WAAW,wBAAwB;IACvC,WAAW,EAAE,MAAM,CAAC;CACrB;AACD,MAAM,CAAC,OAAO,MAAM,iCAAiC,GAAG,CAAC,IAAI,EAAE,wBAAwB,KAAK,IAAI,CAAC;AAEjG,qBAAa,uBAAwB,YAAW,qBAAqB,EAAE,YAAY;IACjF,OAAO,CAAC,eAAe,CAAa;IAC7B,KAAK,EAAE,cAAc,CAAiC;IACtD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,gBAAgB,EAAE,CAAM;IACpC,OAAO,EAAE;QAAE,CAAC,YAAY,EAAE,MAAM,GAAG,cAAc,EAAE,CAAA;KAAE,CAAM;IAC3D,aAAa,0BAAiC;IAC9C,sBAAsB,sCAA6C;IACnE,aAAa,6CAAoD;gBAC5D,QAAQ,EAAE,WAAW;IAK1B,QAAQ;YAID,aAAa;IAkDpB,cAAc,CAAC,YAAY,EAAE,MAAM;IAGnC,WAAW,CAAC,QAAQ,EAAE,gBAAgB,GAAG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,CAA4B;gBAC7B,QAAQ,EAAE,WAAW;IAI1B,QAAQ;YAID,aAAa;IAkDpB,cAAc,CAAC,YAAY,EAAE,MAAM;IAGnC,WAAW,CAAC,QAAQ,EAAE,gBAAgB,GAAG,MAAM;IAO/C,iBAAiB,CAAC,QAAQ,EAAE,gBAAgB,GAAG,MAAM;IAMrD,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAO7C,WAAW,CAAC,cAAc,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,GAAG,IAAI;IAUvE,cAAc,CAAC,cAAc,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO;IAe5E,eAAe,CAAC,cAAc,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,cAAc,GAAG,OAAO;IAclG,OAAO,IAAI,OAAO,CAAC,YAAY,CAAC;CAG9C"}
@@ -8,7 +8,6 @@ exports.FeatureInfoDataProvider = exports.MapFeatureInfoLoadState = void 0;
8
8
  const appui_abstract_1 = require("@itwin/appui-abstract");
9
9
  const components_react_1 = require("@itwin/components-react");
10
10
  const core_bentley_1 = require("@itwin/core-bentley");
11
- // import { IPropertyDataProvider, PropertyCategory, PropertyData, PropertyDataChangeEvent } from ""
12
11
  /**
13
12
  * Implementation of [IPropertyDataProvider] that uses an associative array.
14
13
  * @public
@@ -18,25 +17,29 @@ var MapFeatureInfoLoadState;
18
17
  MapFeatureInfoLoadState[MapFeatureInfoLoadState["DataLoadStart"] = 0] = "DataLoadStart";
19
18
  MapFeatureInfoLoadState[MapFeatureInfoLoadState["DataLoadEnd"] = 1] = "DataLoadEnd";
20
19
  })(MapFeatureInfoLoadState = exports.MapFeatureInfoLoadState || (exports.MapFeatureInfoLoadState = {}));
21
- class FeatureInfoDataProvider {
22
- constructor(onMapHit) {
20
+ class SimplePropertyData {
21
+ constructor() {
23
22
  this.label = appui_abstract_1.PropertyRecord.fromString("");
24
23
  this.categories = [];
25
24
  this.records = {};
25
+ }
26
+ }
27
+ class FeatureInfoDataProvider {
28
+ constructor(onMapHit) {
26
29
  this.onDataChanged = new components_react_1.PropertyDataChangeEvent();
27
30
  this.onDataLoadStateChanged = new core_bentley_1.BeEvent();
28
31
  this.onDataUpdated = new core_bentley_1.BeEvent();
29
- // eslint-disable-next-line @typescript-eslint/unbound-method
32
+ this._data = new SimplePropertyData();
30
33
  this._removeListener = onMapHit.addListener(this._handleMapHit, this);
31
34
  }
32
35
  onUnload() {
33
36
  this._removeListener();
34
37
  }
35
38
  async _handleMapHit(mapHit) {
36
- this.records = {};
37
- this.categories = [];
39
+ var _a, _b;
40
+ this._data = new SimplePropertyData();
38
41
  let recordCount = 0;
39
- if (mapHit?.isMapHit) {
42
+ if (mapHit === null || mapHit === void 0 ? void 0 : mapHit.isMapHit) {
40
43
  this.onDataLoadStateChanged.raiseEvent(MapFeatureInfoLoadState.DataLoadStart);
41
44
  const mapInfo = await mapHit.viewport.getMapFeatureInfo(mapHit);
42
45
  this.onDataLoadStateChanged.raiseEvent(MapFeatureInfoLoadState.DataLoadEnd);
@@ -46,19 +49,19 @@ class FeatureInfoDataProvider {
46
49
  let nbRecords = 0;
47
50
  const layerCategory = (layerCatIdx === -1 ?
48
51
  { name: curLayerInfo.layerName, label: curLayerInfo.layerName, expand: true, childCategories: [] }
49
- : this.categories[layerCatIdx]);
52
+ : this._data.categories[layerCatIdx]);
50
53
  if (curLayerInfo.info && !(curLayerInfo.info instanceof HTMLElement)) {
51
54
  // This is not an HTMLElement, so iterate over each sub-layer info
52
55
  for (const subLayerInfo of curLayerInfo.info) {
53
56
  nbRecords++;
54
- const subCatIdx = layerCategory.childCategories?.findIndex((testCategory) => {
57
+ const subCatIdx = (_a = layerCategory.childCategories) === null || _a === void 0 ? void 0 : _a.findIndex((testCategory) => {
55
58
  return testCategory.name === subLayerInfo.subLayerName;
56
59
  });
57
60
  let subLayerCategory;
58
61
  if (subCatIdx === -1) {
59
62
  subLayerCategory = { name: subLayerInfo.subLayerName, label: subLayerInfo.subLayerName, expand: true };
60
63
  this.addSubCategory(subLayerCategory.name);
61
- layerCategory.childCategories?.push(subLayerCategory);
64
+ (_b = layerCategory.childCategories) === null || _b === void 0 ? void 0 : _b.push(subLayerCategory);
62
65
  }
63
66
  if (subLayerInfo.records) {
64
67
  for (const record of subLayerInfo.records) {
@@ -78,61 +81,60 @@ class FeatureInfoDataProvider {
78
81
  this.onDataChanged.raiseEvent();
79
82
  }
80
83
  addSubCategory(categoryName) {
81
- this.records[categoryName] = [];
84
+ this._data.records[categoryName] = [];
82
85
  }
83
86
  addCategory(category) {
84
- const categoryIdx = this.categories.push(category) - 1;
85
- this.records[this.categories[categoryIdx].name] = [];
87
+ const categoryIdx = this._data.categories.push(category) - 1;
88
+ this._data.records[this._data.categories[categoryIdx].name] = [];
86
89
  return categoryIdx;
87
90
  }
88
91
  findCategoryIndex(category) {
89
- const index = this.categories.findIndex((testCategory) => {
92
+ const index = this._data.categories.findIndex((testCategory) => {
90
93
  return testCategory.name === category.name;
91
94
  });
92
95
  return index;
93
96
  }
94
97
  findCategoryIndexByName(name) {
95
- const index = this.categories.findIndex((testCategory) => {
98
+ const index = this._data.categories.findIndex((testCategory) => {
96
99
  return testCategory.name === name;
97
100
  });
98
101
  return index;
99
102
  }
100
103
  addProperty(propertyRecord, categoryName) {
101
- const idx = this.records[categoryName].findIndex((prop) => prop.property.name === propertyRecord.property.name);
104
+ const idx = this._data.records[categoryName].findIndex((prop) => prop.property.name === propertyRecord.property.name);
102
105
  if (idx === -1) {
103
- this.records[categoryName].push(propertyRecord);
106
+ this._data.records[categoryName].push(propertyRecord);
104
107
  }
105
108
  else {
106
- this.records[categoryName][idx].isMerged = true;
107
- this.records[categoryName][idx].isReadonly = true;
109
+ this._data.records[categoryName][idx].isMerged = true;
110
+ this._data.records[categoryName][idx].isReadonly = true;
108
111
  }
109
112
  }
110
113
  removeProperty(propertyRecord, categoryIdx) {
111
- const index = this.records[this.categories[categoryIdx].name].findIndex((record) => {
114
+ const index = this._data.records[this._data.categories[categoryIdx].name].findIndex((record) => {
112
115
  return record === propertyRecord;
113
116
  });
114
117
  let result = false;
115
118
  if (index >= 0) {
116
- this.records[this.categories[categoryIdx].name].splice(index, 1);
119
+ this._data.records[this._data.categories[categoryIdx].name].splice(index, 1);
117
120
  this.onDataChanged.raiseEvent();
118
121
  result = true;
119
122
  }
120
123
  return result;
121
124
  }
122
125
  replaceProperty(propertyRecord, categoryIdx, newRecord) {
123
- const index = this.records[this.categories[categoryIdx].name].findIndex((record) => {
126
+ const index = this._data.records[this._data.categories[categoryIdx].name].findIndex((record) => {
124
127
  return record === propertyRecord;
125
128
  });
126
129
  let result = false;
127
- // istanbul ignore else
128
130
  if (index >= 0) {
129
- this.records[this.categories[categoryIdx].name].splice(index, 1, newRecord);
131
+ this._data.records[this._data.categories[categoryIdx].name].splice(index, 1, newRecord);
130
132
  result = true;
131
133
  }
132
134
  return result;
133
135
  }
134
136
  async getData() {
135
- return this;
137
+ return this._data;
136
138
  }
137
139
  }
138
140
  exports.FeatureInfoDataProvider = FeatureInfoDataProvider;
@@ -1 +1 @@
1
- {"version":3,"file":"FeatureInfoDataProvider.js","sourceRoot":"","sources":["../../../../src/ui/widget/FeatureInfoDataProvider.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F,0DAAwD;AACxD,8DAAyH;AACzH,sDAA8C;AAG9C,oGAAoG;AAEpG;;;GAGG;AAEH,IAAY,uBAAoD;AAAhE,WAAY,uBAAuB;IAAE,uFAAa,CAAA;IAAE,mFAAW,CAAA;AAAA,CAAC,EAApD,uBAAuB,GAAvB,+BAAuB,KAAvB,+BAAuB,QAA6B;AAQhE,MAAa,uBAAuB;IASlC,YAAY,QAAqB;QAP1B,UAAK,GAAmB,+BAAc,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;QAEtD,eAAU,GAAuB,EAAE,CAAC;QACpC,YAAO,GAAiD,EAAE,CAAC;QAC3D,kBAAa,GAAG,IAAI,0CAAuB,EAA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AAC,OAAO;QAClB,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AArID,0DAqIC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\nimport { PropertyRecord } from \"@itwin/appui-abstract\";\nimport { IPropertyDataProvider, PropertyCategory, PropertyData, PropertyDataChangeEvent } from \"@itwin/components-react\";\nimport { BeEvent } from \"@itwin/core-bentley\";\nimport { HitDetail } from \"@itwin/core-frontend\";\nimport { MapHitEvent } from \"../Interfaces\";\n// import { IPropertyDataProvider, PropertyCategory, PropertyData, PropertyDataChangeEvent } from \"\"\n\n/**\n * Implementation of [IPropertyDataProvider] that uses an associative array.\n * @public\n */\n\nexport enum MapFeatureInfoLoadState {DataLoadStart, DataLoadEnd}\nexport declare type MapFeatureInfoLoadListener = (state: MapFeatureInfoLoadState) => void;\n\nexport interface MapFeatureInfoDataUpdate {\n recordCount: number;\n}\nexport declare type MapFeatureInfoDataUpdatedListener = (data: MapFeatureInfoDataUpdate) => void;\n\nexport class FeatureInfoDataProvider implements IPropertyDataProvider, PropertyData {\n private _removeListener: () => void;\n public label: PropertyRecord = PropertyRecord.fromString(\"\");\n public description?: string;\n public categories: PropertyCategory[] = [];\n public records: { [categoryName: string]: PropertyRecord[] } = {};\n public onDataChanged = new PropertyDataChangeEvent();\n public onDataLoadStateChanged = new BeEvent<MapFeatureInfoLoadListener>();\n public onDataUpdated = new BeEvent<MapFeatureInfoDataUpdatedListener>();\n constructor(onMapHit: MapHitEvent) {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n this._removeListener = onMapHit.addListener(this._handleMapHit, this);\n }\n\n public onUnload() {\n this._removeListener();\n }\n\n private async _handleMapHit(mapHit: HitDetail) {\n this.records = {};\n this.categories = [];\n let recordCount = 0;\n if (mapHit?.isMapHit) {\n this.onDataLoadStateChanged.raiseEvent(MapFeatureInfoLoadState.DataLoadStart);\n const mapInfo = await mapHit.viewport.getMapFeatureInfo(mapHit);\n this.onDataLoadStateChanged.raiseEvent(MapFeatureInfoLoadState.DataLoadEnd);\n if (mapInfo.layerInfo !== undefined ) {\n for (const curLayerInfo of mapInfo.layerInfo) {\n const layerCatIdx = this.findCategoryIndexByName(curLayerInfo.layerName);\n let nbRecords = 0;\n const layerCategory = (\n layerCatIdx === -1 ?\n {name:curLayerInfo.layerName, label:curLayerInfo.layerName, expand:true, childCategories:[]}\n : this.categories[layerCatIdx] );\n\n if (curLayerInfo.info && !(curLayerInfo.info instanceof HTMLElement)) {\n // This is not an HTMLElement, so iterate over each sub-layer info\n for (const subLayerInfo of curLayerInfo.info) {\n nbRecords++;\n const subCatIdx = layerCategory.childCategories?.findIndex((testCategory: PropertyCategory) => {\n return testCategory.name === subLayerInfo.subLayerName;\n });\n let subLayerCategory;\n if (subCatIdx === -1) {\n subLayerCategory = {name:subLayerInfo.subLayerName, label:subLayerInfo.subLayerName, expand:true};\n this.addSubCategory(subLayerCategory.name);\n layerCategory.childCategories?.push(subLayerCategory);\n }\n if (subLayerInfo.records) {\n for (const record of subLayerInfo.records) {\n // Always use the string value for now\n this.addProperty(record, subLayerInfo.subLayerName);\n\n }\n }\n }\n }\n if (layerCatIdx === -1 && nbRecords>0)\n this.addCategory(layerCategory);\n\n recordCount = recordCount + nbRecords;\n }\n }\n }\n this.onDataUpdated.raiseEvent({recordCount});\n this.onDataChanged.raiseEvent();\n }\n\n public addSubCategory(categoryName: string) {\n this.records[categoryName] = [];\n }\n public addCategory(category: PropertyCategory): number {\n const categoryIdx = this.categories.push(category) - 1;\n this.records[this.categories[categoryIdx].name] = [];\n return categoryIdx;\n }\n\n public findCategoryIndex(category: PropertyCategory): number {\n const index = this.categories.findIndex((testCategory: PropertyCategory) => {\n return testCategory.name === category.name;\n });\n return index;\n }\n public findCategoryIndexByName(name: string): number {\n const index = this.categories.findIndex((testCategory: PropertyCategory) => {\n return testCategory.name === name;\n });\n return index;\n }\n\n public addProperty(propertyRecord: PropertyRecord, categoryName: string): void {\n const idx = this.records[categoryName].findIndex((prop)=> prop.property.name === propertyRecord.property.name);\n if (idx === -1) {\n this.records[categoryName].push(propertyRecord);\n } else {\n this.records[categoryName][idx].isMerged = true;\n this.records[categoryName][idx].isReadonly = true;\n }\n }\n\n public removeProperty(propertyRecord: PropertyRecord, categoryIdx: number): boolean {\n const index = this.records[this.categories[categoryIdx].name].findIndex((record: PropertyRecord) => {\n return record === propertyRecord;\n });\n\n let result = false;\n\n if (index >= 0) {\n this.records[this.categories[categoryIdx].name].splice(index, 1);\n this.onDataChanged.raiseEvent();\n result = true;\n }\n return result;\n }\n\n public replaceProperty(propertyRecord: PropertyRecord, categoryIdx: number, newRecord: PropertyRecord): boolean {\n const index = this.records[this.categories[categoryIdx].name].findIndex((record: PropertyRecord) => {\n return record === propertyRecord;\n });\n\n let result = false;\n\n // istanbul ignore else\n if (index >= 0) {\n this.records[this.categories[categoryIdx].name].splice(index, 1, newRecord);\n result = true;\n }\n return result;\n }\n\n public async getData(): Promise<PropertyData> {\n return this;\n }\n}\n"]}
1
+ {"version":3,"file":"FeatureInfoDataProvider.js","sourceRoot":"","sources":["../../../../src/ui/widget/FeatureInfoDataProvider.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F,0DAAuD;AACvD,8DAAyH;AACzH,sDAA8C;AAI9C;;;GAGG;AAEH,IAAY,uBAAsD;AAAlE,WAAY,uBAAuB;IAAG,uFAAa,CAAA;IAAE,mFAAW,CAAA;AAAC,CAAC,EAAtD,uBAAuB,GAAvB,+BAAuB,KAAvB,+BAAuB,QAA+B;AAQlE,MAAM,kBAAkB;IAAxB;QACS,UAAK,GAAmB,+BAAc,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;QAEtD,eAAU,GAAuB,EAAE,CAAC;QACpC,YAAO,GAAiD,EAAE,CAAC;IACpE,CAAC;CAAA;AAED,MAAa,uBAAuB;IAMlC,YAAY,QAAqB;QAJ1B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,CAAC;QAEnB,IAAI,KAAK,IAAI,CAAC,EAAE;YACd,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,EAAE,SAAS,CAAC,CAAC;YACxF,MAAM,GAAG,IAAI,CAAC;SACf;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IAEM,KAAK,CAAC,OAAO;QAClB,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;CACF;AAjID,0DAiIC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\nimport { PropertyRecord } from \"@itwin/appui-abstract\";\nimport { IPropertyDataProvider, PropertyCategory, PropertyData, PropertyDataChangeEvent } from \"@itwin/components-react\";\nimport { BeEvent } from \"@itwin/core-bentley\";\nimport { HitDetail } from \"@itwin/core-frontend\";\nimport { MapHitEvent } from \"../Interfaces\";\n\n/**\n * Implementation of [IPropertyDataProvider] that uses an associative array.\n * @public\n */\n\nexport enum MapFeatureInfoLoadState { DataLoadStart, DataLoadEnd }\nexport declare type MapFeatureInfoLoadListener = (state: MapFeatureInfoLoadState) => void;\n\nexport interface MapFeatureInfoDataUpdate {\n recordCount: number;\n}\nexport declare type MapFeatureInfoDataUpdatedListener = (data: MapFeatureInfoDataUpdate) => void;\n\nclass SimplePropertyData implements PropertyData {\n public label: PropertyRecord = PropertyRecord.fromString(\"\");\n public description?: string;\n public categories: PropertyCategory[] = [];\n public records: { [categoryName: string]: PropertyRecord[] } = {};\n}\n\nexport class FeatureInfoDataProvider implements IPropertyDataProvider {\n private _removeListener: () => void;\n public onDataChanged = new PropertyDataChangeEvent();\n public onDataLoadStateChanged = new BeEvent<MapFeatureInfoLoadListener>();\n public onDataUpdated = new BeEvent<MapFeatureInfoDataUpdatedListener>();\n private _data = new SimplePropertyData();\n constructor(onMapHit: MapHitEvent) {\n this._removeListener = onMapHit.addListener(this._handleMapHit, this);\n }\n\n public onUnload() {\n this._removeListener();\n }\n\n private async _handleMapHit(mapHit: HitDetail) {\n this._data = new SimplePropertyData();\n\n let recordCount = 0;\n if (mapHit?.isMapHit) {\n this.onDataLoadStateChanged.raiseEvent(MapFeatureInfoLoadState.DataLoadStart);\n const mapInfo = await mapHit.viewport.getMapFeatureInfo(mapHit);\n this.onDataLoadStateChanged.raiseEvent(MapFeatureInfoLoadState.DataLoadEnd);\n if (mapInfo.layerInfo !== undefined) {\n for (const curLayerInfo of mapInfo.layerInfo) {\n const layerCatIdx = this.findCategoryIndexByName(curLayerInfo.layerName);\n let nbRecords = 0;\n const layerCategory = (\n layerCatIdx === -1 ?\n { name: curLayerInfo.layerName, label: curLayerInfo.layerName, expand: true, childCategories: [] }\n : this._data.categories[layerCatIdx]);\n\n if (curLayerInfo.info && !(curLayerInfo.info instanceof HTMLElement)) {\n // This is not an HTMLElement, so iterate over each sub-layer info\n for (const subLayerInfo of curLayerInfo.info) {\n nbRecords++;\n const subCatIdx = layerCategory.childCategories?.findIndex((testCategory: PropertyCategory) => {\n return testCategory.name === subLayerInfo.subLayerName;\n });\n let subLayerCategory;\n if (subCatIdx === -1) {\n subLayerCategory = { name: subLayerInfo.subLayerName, label: subLayerInfo.subLayerName, expand: true };\n this.addSubCategory(subLayerCategory.name);\n layerCategory.childCategories?.push(subLayerCategory);\n }\n if (subLayerInfo.records) {\n for (const record of subLayerInfo.records) {\n // Always use the string value for now\n this.addProperty(record, subLayerInfo.subLayerName);\n\n }\n }\n }\n }\n if (layerCatIdx === -1 && nbRecords > 0)\n this.addCategory(layerCategory);\n\n recordCount = recordCount + nbRecords;\n }\n }\n }\n this.onDataUpdated.raiseEvent({ recordCount });\n this.onDataChanged.raiseEvent();\n }\n\n public addSubCategory(categoryName: string) {\n this._data.records[categoryName] = [];\n }\n public addCategory(category: PropertyCategory): number {\n\n const categoryIdx = this._data.categories.push(category) - 1;\n this._data.records[this._data.categories[categoryIdx].name] = [];\n return categoryIdx;\n }\n\n public findCategoryIndex(category: PropertyCategory): number {\n const index = this._data.categories.findIndex((testCategory: PropertyCategory) => {\n return testCategory.name === category.name;\n });\n return index;\n }\n public findCategoryIndexByName(name: string): number {\n const index = this._data.categories.findIndex((testCategory: PropertyCategory) => {\n return testCategory.name === name;\n });\n return index;\n }\n\n public addProperty(propertyRecord: PropertyRecord, categoryName: string): void {\n const idx = this._data.records[categoryName].findIndex((prop) => prop.property.name === propertyRecord.property.name);\n if (idx === -1) {\n this._data.records[categoryName].push(propertyRecord);\n } else {\n this._data.records[categoryName][idx].isMerged = true;\n this._data.records[categoryName][idx].isReadonly = true;\n }\n }\n\n public removeProperty(propertyRecord: PropertyRecord, categoryIdx: number): boolean {\n const index = this._data.records[this._data.categories[categoryIdx].name].findIndex((record: PropertyRecord) => {\n return record === propertyRecord;\n });\n\n let result = false;\n\n if (index >= 0) {\n this._data.records[this._data.categories[categoryIdx].name].splice(index, 1);\n this.onDataChanged.raiseEvent();\n result = true;\n }\n return result;\n }\n\n public replaceProperty(propertyRecord: PropertyRecord, categoryIdx: number, newRecord: PropertyRecord): boolean {\n const index = this._data.records[this._data.categories[categoryIdx].name].findIndex((record: PropertyRecord) => {\n return record === propertyRecord;\n });\n\n let result = false;\n\n if (index >= 0) {\n this._data.records[this._data.categories[categoryIdx].name].splice(index, 1, newRecord);\n result = true;\n }\n return result;\n }\n\n public async getData(): Promise<PropertyData> {\n return this._data;\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"FeatureInfoWidget.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/FeatureInfoWidget.tsx"],"names":[],"mappings":"AAWA,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAGtD,UAAU,yBAAyB;IACjC,eAAe,EAAE,qBAAqB,CAAC;CACxC;AAGD,wBAAgB,oBAAoB,CAAC,EAAE,eAAe,EAAE,EAAE,yBAAyB,eAsDlF"}
1
+ {"version":3,"file":"FeatureInfoWidget.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/FeatureInfoWidget.tsx"],"names":[],"mappings":"AAWA,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAGtD,UAAU,yBAAyB;IACjC,eAAe,EAAE,qBAAqB,CAAC;CACxC;AAGD,wBAAgB,oBAAoB,CAAC,EAAE,eAAe,EAAE,EAAE,yBAAyB,eAoElF"}
@@ -13,10 +13,12 @@ const itwinui_react_1 = require("@itwin/itwinui-react");
13
13
  const mapLayers_1 = require("../../mapLayers");
14
14
  // eslint-disable-next-line @typescript-eslint/naming-convention
15
15
  function MapFeatureInfoWidget({ featureInfoOpts }) {
16
+ var _a;
16
17
  const dataProvider = React.useRef();
17
18
  const [loadingData, setLoadingData] = React.useState(false);
18
19
  const [hasData, setHasData] = React.useState(false);
19
20
  const [noRecordsMessage] = React.useState(mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:FeatureInfoWidget.NoRecords"));
21
+ const [{ width, height }, setSize] = React.useState({ width: 0, height: 0 });
20
22
  const handleLoadStateChange = (state) => {
21
23
  setLoadingData(state === FeatureInfoDataProvider_1.MapFeatureInfoLoadState.DataLoadStart);
22
24
  };
@@ -24,28 +26,36 @@ function MapFeatureInfoWidget({ featureInfoOpts }) {
24
26
  setHasData(state.recordCount !== 0);
25
27
  };
26
28
  React.useEffect(() => {
27
- if (featureInfoOpts?.onMapHit) {
29
+ if (featureInfoOpts === null || featureInfoOpts === void 0 ? void 0 : featureInfoOpts.onMapHit) {
28
30
  dataProvider.current = new FeatureInfoDataProvider_1.FeatureInfoDataProvider(featureInfoOpts.onMapHit);
29
31
  }
30
32
  return () => {
31
- dataProvider?.current?.onUnload();
33
+ var _a;
34
+ (_a = dataProvider === null || dataProvider === void 0 ? void 0 : dataProvider.current) === null || _a === void 0 ? void 0 : _a.onUnload();
32
35
  };
33
- }, [featureInfoOpts?.onMapHit]);
36
+ }, [featureInfoOpts === null || featureInfoOpts === void 0 ? void 0 : featureInfoOpts.onMapHit]);
34
37
  React.useEffect(() => {
35
- dataProvider.current?.onDataUpdated.addListener(handleDataUpdated);
38
+ var _a;
39
+ (_a = dataProvider.current) === null || _a === void 0 ? void 0 : _a.onDataUpdated.addListener(handleDataUpdated);
36
40
  return () => {
37
- dataProvider.current?.onDataUpdated.removeListener(handleDataUpdated);
41
+ var _a;
42
+ (_a = dataProvider.current) === null || _a === void 0 ? void 0 : _a.onDataUpdated.removeListener(handleDataUpdated);
38
43
  };
39
44
  }, []);
40
45
  React.useEffect(() => {
41
- if (featureInfoOpts?.showLoadProgressAnimation) {
42
- dataProvider.current?.onDataLoadStateChanged.addListener(handleLoadStateChange);
46
+ var _a;
47
+ if (featureInfoOpts === null || featureInfoOpts === void 0 ? void 0 : featureInfoOpts.showLoadProgressAnimation) {
48
+ (_a = dataProvider.current) === null || _a === void 0 ? void 0 : _a.onDataLoadStateChanged.addListener(handleLoadStateChange);
43
49
  return () => {
44
- dataProvider.current?.onDataLoadStateChanged.removeListener(handleLoadStateChange);
50
+ var _a;
51
+ (_a = dataProvider.current) === null || _a === void 0 ? void 0 : _a.onDataLoadStateChanged.removeListener(handleLoadStateChange);
45
52
  };
46
53
  }
47
54
  return;
48
- }, [featureInfoOpts?.showLoadProgressAnimation]);
55
+ }, [featureInfoOpts === null || featureInfoOpts === void 0 ? void 0 : featureInfoOpts.showLoadProgressAnimation]);
56
+ const handleResize = React.useCallback((w, h) => {
57
+ setSize({ width: w, height: h });
58
+ }, []);
49
59
  if (loadingData) {
50
60
  return (React.createElement(core_react_1.FillCentered, null,
51
61
  React.createElement(itwinui_react_1.ProgressRadial, { indeterminate: true })));
@@ -57,7 +67,8 @@ function MapFeatureInfoWidget({ featureInfoOpts }) {
57
67
  }
58
68
  else {
59
69
  if (dataProvider.current)
60
- return (React.createElement(components_react_1.PropertyGrid, { dataProvider: dataProvider.current, orientation: core_react_1.Orientation.Vertical, isPropertySelectionEnabled: featureInfoOpts?.propertyGridOptions?.isPropertySelectionEnabled }));
70
+ return (React.createElement(core_react_1.ResizableContainerObserver, { onResize: handleResize },
71
+ React.createElement(components_react_1.VirtualizedPropertyGridWithDataProvider, { width: width, height: height, dataProvider: dataProvider.current, orientation: core_react_1.Orientation.Vertical, isPropertySelectionEnabled: (_a = featureInfoOpts === null || featureInfoOpts === void 0 ? void 0 : featureInfoOpts.propertyGridOptions) === null || _a === void 0 ? void 0 : _a.isPropertySelectionEnabled })));
61
72
  else
62
73
  return (React.createElement(React.Fragment, null));
63
74
  }
@@ -1 +1 @@
1
- {"version":3,"file":"FeatureInfoWidget.js","sourceRoot":"","sources":["../../../../src/ui/widget/FeatureInfoWidget.tsx"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,+BAA+B;AAE/B,8DAAuD;AACvD,kDAA8D;AAE9D,uEAAuH;AACvH,wDAAsD;AAEtD,+CAA8C;AAM9C,gEAAgE;AAChE,SAAgB,oBAAoB,CAAC,EAAE,eAAe,EAA6B;IAEjF,MAAM,YAAY,GAAG,KAAK,CAAC,MAAM,EAA2B,CAAC;IAC7D,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAU,KAAK,CAAC,CAAC;IACrE,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAU,KAAK,CAAC,CAAC;IAC7D,MAAM,CAAC,gBAAgB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,uBAAW,CAAC,YAAY,CAAC,kBAAkB,CAAC,uCAAuC,CAAC,CAAC,CAAC;IAEhI,MAAM,qBAAqB,GAAG,CAAC,KAA8B,EAAE,EAAE;QAC/D,cAAc,CAAC,KAAK,KAAK,iDAAuB,CAAC,aAAa,CAAC,CAAC;IAClE,CAAC,CAAC;IACF,MAAM,iBAAiB,GAAG,CAAC,KAA+B,EAAE,EAAE;QAC5D,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AI,gBAAgB,CAAK,CAAO,CAAe,CAAC,CAAC;KAC9E;SAAM;QACL,IAAI,YAAY,CAAC,OAAO;YACtB,OAAO,CAAC,oBAAC,+BAAY,IAAC,YAAY,EAAE,YAAY,CAAC,OAAO,EAAE,WAAW,EAAE,wBAAW,CAAC,QAAQ,EACzF,0BAA0B,EAAE,eAAe,EAAE,mBAAmB,EAAE,0BAA0B,GAAI,CAAC,CAAC;;YAEpG,OAAO,CAAC,yCAAK,CAAC,CAAC;KAClB;AACH,CAAC;AAtDD,oDAsDC","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 * as React from \"react\";\n\nimport { PropertyGrid } from \"@itwin/components-react\";\nimport { FillCentered, Orientation } from \"@itwin/core-react\";\n\nimport { FeatureInfoDataProvider, MapFeatureInfoDataUpdate, MapFeatureInfoLoadState } from \"./FeatureInfoDataProvider\";\nimport { ProgressRadial } from \"@itwin/itwinui-react\";\nimport { MapFeatureInfoOptions } from \"../Interfaces\";\nimport { MapLayersUI } from \"../../mapLayers\";\n\ninterface MapFeatureInfoWidgetProps {\n featureInfoOpts: MapFeatureInfoOptions;\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function MapFeatureInfoWidget({ featureInfoOpts }: MapFeatureInfoWidgetProps) {\n\n const dataProvider = React.useRef<FeatureInfoDataProvider>();\n const [loadingData, setLoadingData] = React.useState<boolean>(false);\n const [hasData, setHasData] = React.useState<boolean>(false);\n const [noRecordsMessage] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:FeatureInfoWidget.NoRecords\"));\n\n const handleLoadStateChange = (state: MapFeatureInfoLoadState) => {\n setLoadingData(state === MapFeatureInfoLoadState.DataLoadStart);\n };\n const handleDataUpdated = (state: MapFeatureInfoDataUpdate) => {\n setHasData(state.recordCount !== 0);\n };\n\n React.useEffect(() => {\n if (featureInfoOpts?.onMapHit) {\n dataProvider.current = new FeatureInfoDataProvider(featureInfoOpts.onMapHit);\n }\n return () => {\n dataProvider?.current?.onUnload();\n };\n }, [featureInfoOpts?.onMapHit]);\n\n React.useEffect(() => {\n\n dataProvider.current?.onDataUpdated.addListener(handleDataUpdated);\n return () => {\n dataProvider.current?.onDataUpdated.removeListener(handleDataUpdated);\n };\n\n }, []);\n\n React.useEffect(() => {\n if (featureInfoOpts?.showLoadProgressAnimation) {\n dataProvider.current?.onDataLoadStateChanged.addListener(handleLoadStateChange);\n return () => {\n dataProvider.current?.onDataLoadStateChanged.removeListener(handleLoadStateChange);\n };\n }\n return;\n\n }, [featureInfoOpts?.showLoadProgressAnimation]);\n\n if (loadingData) {\n return (<FillCentered><ProgressRadial indeterminate={true}></ProgressRadial></FillCentered>);\n } else if (!hasData) {\n return (<FillCentered><span><i>{noRecordsMessage}</i></span></FillCentered>);\n } else {\n if (dataProvider.current)\n return (<PropertyGrid dataProvider={dataProvider.current} orientation={Orientation.Vertical} // eslint-disable-line deprecation/deprecation\n isPropertySelectionEnabled={featureInfoOpts?.propertyGridOptions?.isPropertySelectionEnabled} />);\n else\n return (<></>);\n }\n}\n"]}
1
+ {"version":3,"file":"FeatureInfoWidget.js","sourceRoot":"","sources":["../../../../src/ui/widget/FeatureInfoWidget.tsx"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,+BAA+B;AAE/B,8DAAkF;AAClF,kDAA0F;AAE1F,uEAAuH;AACvH,wDAAsD;AAEtD,+CAA8C;AAM9C,gEAAgE;AAChE,SAAgB,oBAAoB,CAAC,EAAE,eAAe,EAA6B;;IAEjF,MAAM,YAAY,GAAG,KAAK,CAAC,MAAM,EAA2B,CAAC;IAC7D,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAU,KAAK,CAAC,CAAC;IACrE,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,KAAK,CAAC,QAAQ,CA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AAE,mBAAmB,0CAAE,0BAA0B,GAAI,CACvE,CAC9B,CAAC;;YAEF,OAAO,CAAC,yCAAK,CAAC,CAAC;KAClB;AACH,CAAC;AApED,oDAoEC","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 * as React from \"react\";\n\nimport { VirtualizedPropertyGridWithDataProvider } from \"@itwin/components-react\";\nimport { FillCentered, Orientation, ResizableContainerObserver } from \"@itwin/core-react\";\n\nimport { FeatureInfoDataProvider, MapFeatureInfoDataUpdate, MapFeatureInfoLoadState } from \"./FeatureInfoDataProvider\";\nimport { ProgressRadial } from \"@itwin/itwinui-react\";\nimport { MapFeatureInfoOptions } from \"../Interfaces\";\nimport { MapLayersUI } from \"../../mapLayers\";\n\ninterface MapFeatureInfoWidgetProps {\n featureInfoOpts: MapFeatureInfoOptions;\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function MapFeatureInfoWidget({ featureInfoOpts }: MapFeatureInfoWidgetProps) {\n\n const dataProvider = React.useRef<FeatureInfoDataProvider>();\n const [loadingData, setLoadingData] = React.useState<boolean>(false);\n const [hasData, setHasData] = React.useState<boolean>(false);\n const [noRecordsMessage] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:FeatureInfoWidget.NoRecords\"));\n\n const [{ width, height }, setSize] = React.useState({ width: 0, height: 0 });\n\n const handleLoadStateChange = (state: MapFeatureInfoLoadState) => {\n setLoadingData(state === MapFeatureInfoLoadState.DataLoadStart);\n };\n const handleDataUpdated = (state: MapFeatureInfoDataUpdate) => {\n setHasData(state.recordCount !== 0);\n };\n\n React.useEffect(() => {\n if (featureInfoOpts?.onMapHit) {\n dataProvider.current = new FeatureInfoDataProvider(featureInfoOpts.onMapHit);\n }\n return () => {\n dataProvider?.current?.onUnload();\n };\n }, [featureInfoOpts?.onMapHit]);\n\n React.useEffect(() => {\n\n dataProvider.current?.onDataUpdated.addListener(handleDataUpdated);\n return () => {\n dataProvider.current?.onDataUpdated.removeListener(handleDataUpdated);\n };\n\n }, []);\n\n React.useEffect(() => {\n if (featureInfoOpts?.showLoadProgressAnimation) {\n dataProvider.current?.onDataLoadStateChanged.addListener(handleLoadStateChange);\n return () => {\n dataProvider.current?.onDataLoadStateChanged.removeListener(handleLoadStateChange);\n };\n }\n return;\n\n }, [featureInfoOpts?.showLoadProgressAnimation]);\n\n const handleResize = React.useCallback((w: number, h: number) => {\n setSize({ width: w, height: h });\n }, []);\n\n if (loadingData) {\n return (<FillCentered><ProgressRadial indeterminate={true}></ProgressRadial></FillCentered>);\n } else if (!hasData) {\n return (<FillCentered><span><i>{noRecordsMessage}</i></span></FillCentered>);\n } else {\n if (dataProvider.current)\n return (\n <ResizableContainerObserver onResize={handleResize}>\n <VirtualizedPropertyGridWithDataProvider\n width={width}\n height={height}\n dataProvider={dataProvider.current}\n orientation={Orientation.Vertical}\n isPropertySelectionEnabled={featureInfoOpts?.propertyGridOptions?.isPropertySelectionEnabled} />\n </ResizableContainerObserver>\n );\n else\n return (<></>);\n }\n}\n"]}
@@ -34,6 +34,7 @@ function MapLayerDroppable(props) {
34
34
  const [dropLayerLabel] = React.useState(mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:Widget.DropLayerLabel"));
35
35
  const [outOfRangeTitle] = React.useState(mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:Widget.layerOutOfRange"));
36
36
  const renderItem = (dragProvided, _, rubric) => {
37
+ var _a;
37
38
  (0, core_bentley_1.assert)(props.layersList !== undefined);
38
39
  const activeLayer = props.layersList[rubric.source.index];
39
40
  const outOfRange = activeLayer.treeVisibility === core_frontend_1.MapTileTreeScaleRangeVisibility.Hidden;
@@ -43,13 +44,14 @@ function MapLayerDroppable(props) {
43
44
  React.createElement("span", { className: props.disabled || outOfRange ? "map-manager-item-label-disabled" : "map-manager-item-label", title: outOfRange ? outOfRangeTitle : undefined, ...dragProvided.dragHandleProps }, activeLayer.name),
44
45
  React.createElement("div", { className: "map-manager-item-sub-layer-container" }, activeLayer.subLayers && activeLayer.subLayers.length > 1 &&
45
46
  React.createElement(SubLayersPopupButton_1.SubLayersPopupButton, { mapLayerSettings: activeLayer, activeViewport: props.activeViewport })),
46
- activeLayer.provider?.status === core_frontend_1.MapLayerImageryProviderStatus.RequireAuth &&
47
+ ((_a = activeLayer.provider) === null || _a === void 0 ? void 0 : _a.status) === core_frontend_1.MapLayerImageryProviderStatus.RequireAuth &&
47
48
  React.createElement(itwinui_react_1.Button, { disabled: props.disabled, size: "small", styleType: "borderless", onClick: () => {
48
- const indexInDisplayStyle = props.activeViewport?.displayStyle.findMapLayerIndexByNameAndSource(activeLayer.name, activeLayer.source, activeLayer.isOverlay);
49
+ var _a;
50
+ const indexInDisplayStyle = (_a = props.activeViewport) === null || _a === void 0 ? void 0 : _a.displayStyle.findMapLayerIndexByNameAndSource(activeLayer.name, activeLayer.source, activeLayer.isOverlay);
49
51
  if (indexInDisplayStyle !== undefined && indexInDisplayStyle >= 0) {
50
52
  const layerSettings = props.activeViewport.displayStyle.mapLayerAtIndex(indexInDisplayStyle, activeLayer.isOverlay);
51
53
  if (layerSettings instanceof core_common_1.ImageMapLayerSettings) {
52
- appui_react_1.UiFramework.dialogs.modal.open(React.createElement(MapUrlDialog_1.MapUrlDialog, { activeViewport: props.activeViewport, isOverlay: props.isOverlay, layerRequiringCredentials: layerSettings?.toJSON(), onOkResult: props.onItemEdited, mapTypesOptions: props.mapTypesOptions }));
54
+ appui_react_1.UiFramework.dialogs.modal.open(React.createElement(MapUrlDialog_1.MapUrlDialog, { activeViewport: props.activeViewport, isOverlay: props.isOverlay, layerRequiringCredentials: layerSettings === null || layerSettings === void 0 ? void 0 : layerSettings.toJSON(), onOkResult: props.onItemEdited, mapTypesOptions: props.mapTypesOptions }));
53
55
  }
54
56
  }
55
57
  }, title: requireAuthTooltip },
@@ -57,10 +59,11 @@ function MapLayerDroppable(props) {
57
59
  React.createElement(MapLayerSettingsMenu_1.MapLayerSettingsMenu, { activeViewport: props.activeViewport, mapLayerSettings: activeLayer, onMenuItemSelection: props.onMenuItemSelected, disabled: props.disabled })));
58
60
  };
59
61
  function renderDraggableContent(snapshot) {
62
+ var _a;
60
63
  let node;
61
64
  if (containsLayer) {
62
65
  // Render a <Draggable>
63
- node = (props.layersList?.map((mapLayerSettings, i) => React.createElement(react_beautiful_dnd_1.Draggable, { isDragDisabled: props.disabled, key: mapLayerSettings.name, draggableId: mapLayerSettings.name, index: i }, renderItem)));
66
+ node = ((_a = props.layersList) === null || _a === void 0 ? void 0 : _a.map((mapLayerSettings, i) => React.createElement(react_beautiful_dnd_1.Draggable, { isDragDisabled: props.disabled, key: mapLayerSettings.name, draggableId: mapLayerSettings.name, index: i }, renderItem)));
64
67
  }
65
68
  else {
66
69
  // Render a label that provide a 'Drop here' hint
@@ -1 +1 @@
1
- {"version":3,"file":"MapLayerDroppable.js","sourceRoot":"","sources":["../../../../src/ui/widget/MapLayerDroppable.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F,2CAA2C;;;AAE3C,oEAAoE;AACpE,sDAAsD;AAEtD,+BAA+B;AAC/B,6DAA2H;AAC3H,wDAAsH;AACtH,kDAAyC;AACzC,sDAA6C;AAC7C,oDAAiD;AACjD,wDAA8C;AAC9C,iEAA8D;AAC9D,qEAAyF;AAEzF,iEAA8D;AAC9D,iDAA8C;AAC9C,kCAAgC;AAChC,+CAA8C;AAC9C,oDAA2D;AAe3D,gBAAgB;AAChB,gEAAgE;AAChE,SAAgB,iBAAiB,CAAC,KAA6B;IAC7D,MAAM,aAAa,GAAG,KAAK,CAAC,UAAU,IAAI,KAAK,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC;IACtE,MAAM,WAAW,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,qBAAqB,CAAC;IACjF,MAAM,CAAC,gB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D,MAAM,KAAK,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,yBAAyB,CAAC,CAAC,CAAC,8BAA8B,CAAC;YAC3F,IAAI;gBACF,6BAAK,KAAK,EAAE,KAAK,EAAE,SAAS,EAAC,iCAAiC,IAC3D,QAAQ,CAAC,cAAc,CAAC,CAAC;oBACxB,8BAAM,SAAS,EAAC,6BAA6B,IAAE,cAAc,CAAQ;oBACrE,CAAC;wBACD;4BACE,8BAAM,SAAS,EAAC,6BAA6B,IAAE,KAAK,CAAQ;4BAC5D,oBAAC,+CAAsB,IAAC,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,UAAU,EAAE,8CAAqB,CAAC,IAAI,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,GAAI,CACvH,CAED,CAAC;SACV;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,SAAS,eAAe,CAAC,YAA+B,EAAE,YAAoC;QAC5F,OAAO,CACL,6BAAK,SAAS,EAAE,0BAA0B,YAAY,CAAC,cAAc,IAAI,aAAa,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,GAAG,EAAE,YAAY,CAAC,QAAQ,KAAM,YAAY,CAAC,cAAc;YAEjL,sBAAsB,CAAC,YAAY,CAAC;YAOrC,6BAAK,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,IAAG,YAAY,CAAC,WAAW,CAAO,CACzF,CAAC,CAAC;IACZ,CAAC;IAED,OAAO,CACL,oBAAC,+BAAS,IACR,WAAW,EAAE,WAAW,EACxB,WAAW,EAAE,UAAU,EACvB,oBAAoB,EAAE,KAAK,CAAC,oBAA2B,IAEtD,eAAe,CACN,CACb,CAAC;AACJ,CAAC;AAnHD,8CAmHC","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 droppable Sublayer Basemap\n\n// the following quiet warning caused by react-beautiful-dnd package\n/* eslint-disable @typescript-eslint/unbound-method */\n\nimport * as React from \"react\";\nimport { Draggable, DraggableChildrenFn, Droppable, DroppableProvided, DroppableStateSnapshot } from \"react-beautiful-dnd\";\nimport { MapLayerImageryProviderStatus, MapTileTreeScaleRangeVisibility, ScreenViewport } from \"@itwin/core-frontend\";\nimport { Icon } from \"@itwin/core-react\";\nimport { assert } from \"@itwin/core-bentley\";\nimport { UiFramework } from \"@itwin/appui-react\";\nimport { Button } from \"@itwin/itwinui-react\";\nimport { SubLayersPopupButton } from \"./SubLayersPopupButton\";\nimport { AttachLayerButtonType, AttachLayerPopupButton } from \"./AttachLayerPopupButton\";\nimport { MapTypesOptions, StyleMapLayerSettings } from \"../Interfaces\";\nimport { MapLayerSettingsMenu } from \"./MapLayerSettingsMenu\";\nimport { MapUrlDialog } from \"./MapUrlDialog\";\nimport \"./MapLayerManager.scss\";\nimport { MapLayersUI } from \"../../mapLayers\";\nimport { ImageMapLayerSettings } from \"@itwin/core-common\";\n\n/** @internal */\ninterface MapLayerDroppableProps {\n isOverlay: boolean;\n layersList?: StyleMapLayerSettings[];\n mapTypesOptions?: MapTypesOptions;\n getContainerForClone: () => HTMLElement;\n activeViewport: ScreenViewport;\n onMenuItemSelected: (action: string, mapLayerSettings: StyleMapLayerSettings) => void;\n onItemVisibilityToggleClicked: (mapLayerSettings: StyleMapLayerSettings) => void;\n onItemEdited: () => void;\n disabled?: boolean;\n}\n\n/** @internal */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function MapLayerDroppable(props: MapLayerDroppableProps) {\n const containsLayer = props.layersList && props.layersList.length > 0;\n const droppableId = props.isOverlay ? \"overlayMapLayers\" : \"backgroundMapLayers\";\n const [toggleVisibility] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Widget.ToggleVisibility\"));\n const [requireAuthTooltip] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Widget.RequireAuthTooltip\"));\n const [noBackgroundMapsSpecifiedLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Widget.NoBackgroundLayers\"));\n const [noUnderlaysSpecifiedLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Widget.NoOverlayLayers\"));\n const [dropLayerLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Widget.DropLayerLabel\"));\n const [outOfRangeTitle] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Widget.layerOutOfRange\"));\n\n const renderItem: DraggableChildrenFn = (dragProvided, _, rubric) => {\n assert(props.layersList !== undefined);\n const activeLayer = props.layersList[rubric.source.index];\n const outOfRange = activeLayer.treeVisibility === MapTileTreeScaleRangeVisibility.Hidden;\n\n return (\n <div className=\"map-manager-source-item\" data-id={rubric.source.index} key={activeLayer.name}\n {...dragProvided.draggableProps}\n ref={dragProvided.innerRef} >\n {/* Visibility icon */}\n <Button disabled={props.disabled} size=\"small\" styleType=\"borderless\" className=\"map-manager-item-visibility\" title={toggleVisibility} onClick={() => { props.onItemVisibilityToggleClicked(activeLayer); }}>\n <Icon iconSpec={activeLayer.visible ? \"icon-visibility\" : \"icon-visibility-hide-2\"} />\n </Button>\n {/* Label */}\n <span className={props.disabled||outOfRange ? \"map-manager-item-label-disabled\" : \"map-manager-item-label\"}\n title = {outOfRange ? outOfRangeTitle : undefined }\n {...dragProvided.dragHandleProps}\n\n >\n {activeLayer.name}\n </span>\n <div className=\"map-manager-item-sub-layer-container\">\n {activeLayer.subLayers && activeLayer.subLayers.length > 1 &&\n <SubLayersPopupButton mapLayerSettings={activeLayer} activeViewport={props.activeViewport} />\n }\n </div>\n {activeLayer.provider?.status === MapLayerImageryProviderStatus.RequireAuth &&\n <Button\n disabled={props.disabled}\n size=\"small\"\n styleType=\"borderless\"\n onClick={() => {\n const indexInDisplayStyle = props.activeViewport?.displayStyle.findMapLayerIndexByNameAndSource(activeLayer.name, activeLayer.source, activeLayer.isOverlay);\n if (indexInDisplayStyle !== undefined && indexInDisplayStyle >= 0) {\n const layerSettings = props.activeViewport.displayStyle.mapLayerAtIndex(indexInDisplayStyle, activeLayer.isOverlay);\n if (layerSettings instanceof ImageMapLayerSettings) {\n UiFramework.dialogs.modal.open(<MapUrlDialog activeViewport={props.activeViewport}\n isOverlay={props.isOverlay}\n layerRequiringCredentials={layerSettings?.toJSON()}\n onOkResult={props.onItemEdited}\n mapTypesOptions={props.mapTypesOptions}></MapUrlDialog>);\n }\n }\n\n }}\n title={requireAuthTooltip}\n >\n <Icon className=\"map-layer-source-item-warnMessage-icon\" iconSpec=\"icon-status-warning\" />\n </Button>\n }\n <MapLayerSettingsMenu activeViewport={props.activeViewport} mapLayerSettings={activeLayer} onMenuItemSelection={props.onMenuItemSelected} disabled={props.disabled} />\n </div>\n );\n };\n\n function renderDraggableContent(snapshot: DroppableStateSnapshot): React.ReactNode {\n let node: React.ReactNode;\n if (containsLayer) {\n // Render a <Draggable>\n node = (props.layersList?.map((mapLayerSettings, i) =>\n <Draggable isDragDisabled={props.disabled} key={mapLayerSettings.name} draggableId={mapLayerSettings.name} index={i}>\n {renderItem}\n </Draggable>));\n } else {\n // Render a label that provide a 'Drop here' hint\n const label = props.isOverlay ? noUnderlaysSpecifiedLabel : noBackgroundMapsSpecifiedLabel;\n node =\n <div title={label} className=\"map-manager-no-layers-container\">\n {snapshot.isDraggingOver ?\n <span className=\"map-manager-no-layers-label\">{dropLayerLabel}</span>\n :\n <>\n <span className=\"map-manager-no-layers-label\">{label}</span>\n <AttachLayerPopupButton disabled={props.disabled} buttonType={AttachLayerButtonType.Blue} isOverlay={props.isOverlay} />\n </>\n }\n </div>;\n }\n return node;\n }\n\n function renderDraggable(dropProvided: DroppableProvided, dropSnapshot: DroppableStateSnapshot): React.ReactElement<HTMLElement> {\n return (\n <div className={`map-manager-attachments${dropSnapshot.isDraggingOver && containsLayer ? \" is-dragging-map-over\" : \"\"}`} ref={dropProvided.innerRef} {...dropProvided.droppableProps} >\n\n {renderDraggableContent(dropSnapshot)}\n\n {\n /* We don't want a placeholder when displaying the 'Drop here' message\n Unfortunately, if don't add it, 'react-beautiful-dnd' show an error message in the console.\n So I simply make it hidden. See https://github.com/atlassian/react-beautiful-dnd/issues/518 */\n }\n <div style={containsLayer ? undefined : { display: \"none\" }}>{dropProvided.placeholder}</div>\n </div>);\n }\n\n return (\n <Droppable\n droppableId={droppableId}\n renderClone={renderItem}\n getContainerForClone={props.getContainerForClone as any}\n >\n {renderDraggable}\n </Droppable>\n );\n}\n"]}
1
+ {"version":3,"file":"MapLayerDroppable.js","sourceRoot":"","sources":["../../../../src/ui/widget/MapLayerDroppable.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F,2CAA2C;;;AAE3C,oEAAoE;AACpE,sDAAsD;AAEtD,+BAA+B;AAC/B,6DAA2H;AAC3H,wDAAsH;AACtH,kDAAyC;AACzC,sDAA6C;AAC7C,oDAAiD;AACjD,wDAA8C;AAC9C,iEAA8D;AAC9D,qEAAyF;AAEzF,iEAA8D;AAC9D,iDAA8C;AAC9C,kCAAgC;AAChC,+CAA8C;AAC9C,oDAA2D;AAe3D,gBAAgB;AAChB,gEAAgE;AAChE,SAAgB,iBAAiB,CAAC,KAA6B;IAC7D,MAAM,aAAa,GAAG,KAAK,CAAC,UAAU,IAAI,KAAK,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC;IACtE,MAAM,WAAW,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,qBAAqB,CAAC;IACjF,MAAM,CAAC,gBAAgB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,uBAAW,CAAC,YAAY,CAAC,kBAAkB,CAAC,mCAAmC,CAAC,CAAC,CAAC;IAC5H,MAAM,CAAC,kBAAkB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,uBAAW,CAAC,YAA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,KAAK,EAAE,SAAS,EAAC,iCAAiC,IAC3D,QAAQ,CAAC,cAAc,CAAC,CAAC;oBACxB,8BAAM,SAAS,EAAC,6BAA6B,IAAE,cAAc,CAAQ;oBACrE,CAAC;wBACD;4BACE,8BAAM,SAAS,EAAC,6BAA6B,IAAE,KAAK,CAAQ;4BAC5D,oBAAC,+CAAsB,IAAC,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,UAAU,EAAE,8CAAqB,CAAC,IAAI,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,GAAI,CACvH,CAED,CAAC;SACV;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,SAAS,eAAe,CAAC,YAA+B,EAAE,YAAoC;QAC5F,OAAO,CACL,6BAAK,SAAS,EAAE,0BAA0B,YAAY,CAAC,cAAc,IAAI,aAAa,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,GAAG,EAAE,YAAY,CAAC,QAAQ,KAAM,YAAY,CAAC,cAAc;YAEjL,sBAAsB,CAAC,YAAY,CAAC;YAOrC,6BAAK,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,IAAG,YAAY,CAAC,WAAW,CAAO,CACzF,CAAC,CAAC;IACZ,CAAC;IAED,OAAO,CACL,oBAAC,+BAAS,IACR,WAAW,EAAE,WAAW,EACxB,WAAW,EAAE,UAAU,EACvB,oBAAoB,EAAE,KAAK,CAAC,oBAA2B,IAEtD,eAAe,CACN,CACb,CAAC;AACJ,CAAC;AAnHD,8CAmHC","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 droppable Sublayer Basemap\n\n// the following quiet warning caused by react-beautiful-dnd package\n/* eslint-disable @typescript-eslint/unbound-method */\n\nimport * as React from \"react\";\nimport { Draggable, DraggableChildrenFn, Droppable, DroppableProvided, DroppableStateSnapshot } from \"react-beautiful-dnd\";\nimport { MapLayerImageryProviderStatus, MapTileTreeScaleRangeVisibility, ScreenViewport } from \"@itwin/core-frontend\";\nimport { Icon } from \"@itwin/core-react\";\nimport { assert } from \"@itwin/core-bentley\";\nimport { UiFramework } from \"@itwin/appui-react\";\nimport { Button } from \"@itwin/itwinui-react\";\nimport { SubLayersPopupButton } from \"./SubLayersPopupButton\";\nimport { AttachLayerButtonType, AttachLayerPopupButton } from \"./AttachLayerPopupButton\";\nimport { MapTypesOptions, StyleMapLayerSettings } from \"../Interfaces\";\nimport { MapLayerSettingsMenu } from \"./MapLayerSettingsMenu\";\nimport { MapUrlDialog } from \"./MapUrlDialog\";\nimport \"./MapLayerManager.scss\";\nimport { MapLayersUI } from \"../../mapLayers\";\nimport { ImageMapLayerSettings } from \"@itwin/core-common\";\n\n/** @internal */\ninterface MapLayerDroppableProps {\n isOverlay: boolean;\n layersList?: StyleMapLayerSettings[];\n mapTypesOptions?: MapTypesOptions;\n getContainerForClone: () => HTMLElement;\n activeViewport: ScreenViewport;\n onMenuItemSelected: (action: string, mapLayerSettings: StyleMapLayerSettings) => void;\n onItemVisibilityToggleClicked: (mapLayerSettings: StyleMapLayerSettings) => void;\n onItemEdited: () => void;\n disabled?: boolean;\n}\n\n/** @internal */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function MapLayerDroppable(props: MapLayerDroppableProps) {\n const containsLayer = props.layersList && props.layersList.length > 0;\n const droppableId = props.isOverlay ? \"overlayMapLayers\" : \"backgroundMapLayers\";\n const [toggleVisibility] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Widget.ToggleVisibility\"));\n const [requireAuthTooltip] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Widget.RequireAuthTooltip\"));\n const [noBackgroundMapsSpecifiedLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Widget.NoBackgroundLayers\"));\n const [noUnderlaysSpecifiedLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Widget.NoOverlayLayers\"));\n const [dropLayerLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Widget.DropLayerLabel\"));\n const [outOfRangeTitle] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Widget.layerOutOfRange\"));\n\n const renderItem: DraggableChildrenFn = (dragProvided, _, rubric) => {\n assert(props.layersList !== undefined);\n const activeLayer = props.layersList[rubric.source.index];\n const outOfRange = activeLayer.treeVisibility === MapTileTreeScaleRangeVisibility.Hidden;\n\n return (\n <div className=\"map-manager-source-item\" data-id={rubric.source.index} key={activeLayer.name}\n {...dragProvided.draggableProps}\n ref={dragProvided.innerRef} >\n {/* Visibility icon */}\n <Button disabled={props.disabled} size=\"small\" styleType=\"borderless\" className=\"map-manager-item-visibility\" title={toggleVisibility} onClick={() => { props.onItemVisibilityToggleClicked(activeLayer); }}>\n <Icon iconSpec={activeLayer.visible ? \"icon-visibility\" : \"icon-visibility-hide-2\"} />\n </Button>\n {/* Label */}\n <span className={props.disabled||outOfRange ? \"map-manager-item-label-disabled\" : \"map-manager-item-label\"}\n title = {outOfRange ? outOfRangeTitle : undefined }\n {...dragProvided.dragHandleProps}\n\n >\n {activeLayer.name}\n </span>\n <div className=\"map-manager-item-sub-layer-container\">\n {activeLayer.subLayers && activeLayer.subLayers.length > 1 &&\n <SubLayersPopupButton mapLayerSettings={activeLayer} activeViewport={props.activeViewport} />\n }\n </div>\n {activeLayer.provider?.status === MapLayerImageryProviderStatus.RequireAuth &&\n <Button\n disabled={props.disabled}\n size=\"small\"\n styleType=\"borderless\"\n onClick={() => {\n const indexInDisplayStyle = props.activeViewport?.displayStyle.findMapLayerIndexByNameAndSource(activeLayer.name, activeLayer.source, activeLayer.isOverlay);\n if (indexInDisplayStyle !== undefined && indexInDisplayStyle >= 0) {\n const layerSettings = props.activeViewport.displayStyle.mapLayerAtIndex(indexInDisplayStyle, activeLayer.isOverlay);\n if (layerSettings instanceof ImageMapLayerSettings) {\n UiFramework.dialogs.modal.open(<MapUrlDialog activeViewport={props.activeViewport}\n isOverlay={props.isOverlay}\n layerRequiringCredentials={layerSettings?.toJSON()}\n onOkResult={props.onItemEdited}\n mapTypesOptions={props.mapTypesOptions}></MapUrlDialog>);\n }\n }\n\n }}\n title={requireAuthTooltip}\n >\n <Icon className=\"map-layer-source-item-warnMessage-icon\" iconSpec=\"icon-status-warning\" />\n </Button>\n }\n <MapLayerSettingsMenu activeViewport={props.activeViewport} mapLayerSettings={activeLayer} onMenuItemSelection={props.onMenuItemSelected} disabled={props.disabled} />\n </div>\n );\n };\n\n function renderDraggableContent(snapshot: DroppableStateSnapshot): React.ReactNode {\n let node: React.ReactNode;\n if (containsLayer) {\n // Render a <Draggable>\n node = (props.layersList?.map((mapLayerSettings, i) =>\n <Draggable isDragDisabled={props.disabled} key={mapLayerSettings.name} draggableId={mapLayerSettings.name} index={i}>\n {renderItem}\n </Draggable>));\n } else {\n // Render a label that provide a 'Drop here' hint\n const label = props.isOverlay ? noUnderlaysSpecifiedLabel : noBackgroundMapsSpecifiedLabel;\n node =\n <div title={label} className=\"map-manager-no-layers-container\">\n {snapshot.isDraggingOver ?\n <span className=\"map-manager-no-layers-label\">{dropLayerLabel}</span>\n :\n <>\n <span className=\"map-manager-no-layers-label\">{label}</span>\n <AttachLayerPopupButton disabled={props.disabled} buttonType={AttachLayerButtonType.Blue} isOverlay={props.isOverlay} />\n </>\n }\n </div>;\n }\n return node;\n }\n\n function renderDraggable(dropProvided: DroppableProvided, dropSnapshot: DroppableStateSnapshot): React.ReactElement<HTMLElement> {\n return (\n <div className={`map-manager-attachments${dropSnapshot.isDraggingOver && containsLayer ? \" is-dragging-map-over\" : \"\"}`} ref={dropProvided.innerRef} {...dropProvided.droppableProps} >\n\n {renderDraggableContent(dropSnapshot)}\n\n {\n /* We don't want a placeholder when displaying the 'Drop here' message\n Unfortunately, if don't add it, 'react-beautiful-dnd' show an error message in the console.\n So I simply make it hidden. See https://github.com/atlassian/react-beautiful-dnd/issues/518 */\n }\n <div style={containsLayer ? undefined : { display: \"none\" }}>{dropProvided.placeholder}</div>\n </div>);\n }\n\n return (\n <Droppable\n droppableId={droppableId}\n renderClone={renderItem}\n getContainerForClone={props.getContainerForClone as any}\n >\n {renderDraggable}\n </Droppable>\n );\n}\n"]}