@itwin/map-layers 5.3.0 → 5.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (161) hide show
  1. package/CHANGELOG.md +25 -2
  2. package/lib/cjs/BrowserStorage.d.ts +25 -0
  3. package/lib/cjs/BrowserStorage.d.ts.map +1 -0
  4. package/lib/cjs/BrowserStorage.js +80 -0
  5. package/lib/cjs/BrowserStorage.js.map +1 -0
  6. package/lib/cjs/CustomParamUtils.d.ts +5 -0
  7. package/lib/cjs/CustomParamUtils.d.ts.map +1 -0
  8. package/lib/cjs/CustomParamUtils.js +26 -0
  9. package/lib/cjs/CustomParamUtils.js.map +1 -0
  10. package/lib/cjs/CustomParamsMappingStorage.d.ts +6 -0
  11. package/lib/cjs/CustomParamsMappingStorage.d.ts.map +1 -0
  12. package/lib/cjs/CustomParamsMappingStorage.js +15 -0
  13. package/lib/cjs/CustomParamsMappingStorage.js.map +1 -0
  14. package/lib/cjs/CustomParamsStorage.d.ts +6 -0
  15. package/lib/cjs/CustomParamsStorage.d.ts.map +1 -0
  16. package/lib/cjs/CustomParamsStorage.js +15 -0
  17. package/lib/cjs/CustomParamsStorage.js.map +1 -0
  18. package/lib/cjs/MapLayerPreferences.d.ts.map +1 -1
  19. package/lib/cjs/MapLayerPreferences.js +2 -0
  20. package/lib/cjs/MapLayerPreferences.js.map +1 -1
  21. package/lib/cjs/PreferencesBrowserStorage.d.ts +9 -2
  22. package/lib/cjs/PreferencesBrowserStorage.d.ts.map +1 -1
  23. package/lib/cjs/PreferencesBrowserStorage.js +11 -51
  24. package/lib/cjs/PreferencesBrowserStorage.js.map +1 -1
  25. package/lib/cjs/public/locales/en/mapLayers.json +29 -3
  26. package/lib/cjs/ui/FeatureInfoUiItemsProvider.d.ts +1 -1
  27. package/lib/cjs/ui/FeatureInfoUiItemsProvider.js +1 -1
  28. package/lib/cjs/ui/FeatureInfoUiItemsProvider.js.map +1 -1
  29. package/lib/cjs/ui/Interfaces.d.ts +11 -0
  30. package/lib/cjs/ui/Interfaces.d.ts.map +1 -1
  31. package/lib/cjs/ui/Interfaces.js.map +1 -1
  32. package/lib/cjs/ui/widget/AttachLayerPopupButton.d.ts.map +1 -1
  33. package/lib/cjs/ui/widget/AttachLayerPopupButton.js +20 -18
  34. package/lib/cjs/ui/widget/AttachLayerPopupButton.js.map +1 -1
  35. package/lib/cjs/ui/widget/CustomParamEditDialog.d.ts +11 -0
  36. package/lib/cjs/ui/widget/CustomParamEditDialog.d.ts.map +1 -0
  37. package/lib/cjs/ui/widget/CustomParamEditDialog.js +57 -0
  38. package/lib/cjs/ui/widget/CustomParamEditDialog.js.map +1 -0
  39. package/lib/cjs/ui/widget/CustomParamEditDialog.scss +26 -0
  40. package/lib/cjs/ui/widget/CustomParamsSettings.d.ts +4 -0
  41. package/lib/cjs/ui/widget/CustomParamsSettings.d.ts.map +1 -0
  42. package/lib/cjs/ui/widget/CustomParamsSettings.js +116 -0
  43. package/lib/cjs/ui/widget/CustomParamsSettings.js.map +1 -0
  44. package/lib/cjs/ui/widget/CustomParamsSettings.scss +67 -0
  45. package/lib/cjs/ui/widget/MapLayerDroppable.d.ts +3 -3
  46. package/lib/cjs/ui/widget/MapLayerDroppable.d.ts.map +1 -1
  47. package/lib/cjs/ui/widget/MapLayerDroppable.js +23 -10
  48. package/lib/cjs/ui/widget/MapLayerDroppable.js.map +1 -1
  49. package/lib/cjs/ui/widget/MapLayerManager.d.ts +2 -2
  50. package/lib/cjs/ui/widget/MapLayerManager.d.ts.map +1 -1
  51. package/lib/cjs/ui/widget/MapLayerManager.js +19 -11
  52. package/lib/cjs/ui/widget/MapLayerManager.js.map +1 -1
  53. package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.d.ts.map +1 -1
  54. package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.js +1 -1
  55. package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.js.map +1 -1
  56. package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.scss +4 -1
  57. package/lib/cjs/ui/widget/MapManagerSettings.d.ts.map +1 -1
  58. package/lib/cjs/ui/widget/MapManagerSettings.js +37 -29
  59. package/lib/cjs/ui/widget/MapManagerSettings.js.map +1 -1
  60. package/lib/cjs/ui/widget/MapUrlDialog.d.ts +15 -5
  61. package/lib/cjs/ui/widget/MapUrlDialog.d.ts.map +1 -1
  62. package/lib/cjs/ui/widget/MapUrlDialog.js +129 -58
  63. package/lib/cjs/ui/widget/MapUrlDialog.js.map +1 -1
  64. package/lib/cjs/ui/widget/MapUrlDialog.scss +12 -1
  65. package/lib/cjs/ui/widget/SelectApiKey.d.ts +10 -0
  66. package/lib/cjs/ui/widget/SelectApiKey.d.ts.map +1 -0
  67. package/lib/cjs/ui/widget/SelectApiKey.js +39 -0
  68. package/lib/cjs/ui/widget/SelectApiKey.js.map +1 -0
  69. package/lib/cjs/ui/widget/SelectCustomParam.d.ts +10 -0
  70. package/lib/cjs/ui/widget/SelectCustomParam.d.ts.map +1 -0
  71. package/lib/cjs/ui/widget/SelectCustomParam.js +49 -0
  72. package/lib/cjs/ui/widget/SelectCustomParam.js.map +1 -0
  73. package/lib/cjs/ui/widget/SelectMapFormat.d.ts +11 -2
  74. package/lib/cjs/ui/widget/SelectMapFormat.d.ts.map +1 -1
  75. package/lib/cjs/ui/widget/SelectMapFormat.js +5 -6
  76. package/lib/cjs/ui/widget/SelectMapFormat.js.map +1 -1
  77. package/lib/cjs/ui/widget/UserPreferencesStorageOptions.d.ts +10 -0
  78. package/lib/cjs/ui/widget/UserPreferencesStorageOptions.d.ts.map +1 -0
  79. package/lib/cjs/ui/widget/UserPreferencesStorageOptions.js +17 -0
  80. package/lib/cjs/ui/widget/UserPreferencesStorageOptions.js.map +1 -0
  81. package/lib/esm/BrowserStorage.d.ts +25 -0
  82. package/lib/esm/BrowserStorage.d.ts.map +1 -0
  83. package/lib/esm/BrowserStorage.js +76 -0
  84. package/lib/esm/BrowserStorage.js.map +1 -0
  85. package/lib/esm/CustomParamUtils.d.ts +5 -0
  86. package/lib/esm/CustomParamUtils.d.ts.map +1 -0
  87. package/lib/esm/CustomParamUtils.js +22 -0
  88. package/lib/esm/CustomParamUtils.js.map +1 -0
  89. package/lib/esm/CustomParamsMappingStorage.d.ts +6 -0
  90. package/lib/esm/CustomParamsMappingStorage.d.ts.map +1 -0
  91. package/lib/esm/CustomParamsMappingStorage.js +11 -0
  92. package/lib/esm/CustomParamsMappingStorage.js.map +1 -0
  93. package/lib/esm/CustomParamsStorage.d.ts +6 -0
  94. package/lib/esm/CustomParamsStorage.d.ts.map +1 -0
  95. package/lib/esm/CustomParamsStorage.js +11 -0
  96. package/lib/esm/CustomParamsStorage.js.map +1 -0
  97. package/lib/esm/MapLayerPreferences.d.ts.map +1 -1
  98. package/lib/esm/MapLayerPreferences.js +2 -0
  99. package/lib/esm/MapLayerPreferences.js.map +1 -1
  100. package/lib/esm/PreferencesBrowserStorage.d.ts +9 -2
  101. package/lib/esm/PreferencesBrowserStorage.d.ts.map +1 -1
  102. package/lib/esm/PreferencesBrowserStorage.js +11 -51
  103. package/lib/esm/PreferencesBrowserStorage.js.map +1 -1
  104. package/lib/esm/public/locales/en/mapLayers.json +29 -3
  105. package/lib/esm/ui/FeatureInfoUiItemsProvider.d.ts +1 -1
  106. package/lib/esm/ui/FeatureInfoUiItemsProvider.js +1 -1
  107. package/lib/esm/ui/FeatureInfoUiItemsProvider.js.map +1 -1
  108. package/lib/esm/ui/Interfaces.d.ts +11 -0
  109. package/lib/esm/ui/Interfaces.d.ts.map +1 -1
  110. package/lib/esm/ui/Interfaces.js.map +1 -1
  111. package/lib/esm/ui/widget/AttachLayerPopupButton.d.ts.map +1 -1
  112. package/lib/esm/ui/widget/AttachLayerPopupButton.js +20 -18
  113. package/lib/esm/ui/widget/AttachLayerPopupButton.js.map +1 -1
  114. package/lib/esm/ui/widget/CustomParamEditDialog.d.ts +11 -0
  115. package/lib/esm/ui/widget/CustomParamEditDialog.d.ts.map +1 -0
  116. package/lib/esm/ui/widget/CustomParamEditDialog.js +53 -0
  117. package/lib/esm/ui/widget/CustomParamEditDialog.js.map +1 -0
  118. package/lib/esm/ui/widget/CustomParamEditDialog.scss +26 -0
  119. package/lib/esm/ui/widget/CustomParamsSettings.d.ts +4 -0
  120. package/lib/esm/ui/widget/CustomParamsSettings.d.ts.map +1 -0
  121. package/lib/esm/ui/widget/CustomParamsSettings.js +112 -0
  122. package/lib/esm/ui/widget/CustomParamsSettings.js.map +1 -0
  123. package/lib/esm/ui/widget/CustomParamsSettings.scss +67 -0
  124. package/lib/esm/ui/widget/MapLayerDroppable.d.ts +3 -3
  125. package/lib/esm/ui/widget/MapLayerDroppable.d.ts.map +1 -1
  126. package/lib/esm/ui/widget/MapLayerDroppable.js +24 -11
  127. package/lib/esm/ui/widget/MapLayerDroppable.js.map +1 -1
  128. package/lib/esm/ui/widget/MapLayerManager.d.ts +2 -2
  129. package/lib/esm/ui/widget/MapLayerManager.d.ts.map +1 -1
  130. package/lib/esm/ui/widget/MapLayerManager.js +20 -12
  131. package/lib/esm/ui/widget/MapLayerManager.js.map +1 -1
  132. package/lib/esm/ui/widget/MapLayerSettingsPopupButton.d.ts.map +1 -1
  133. package/lib/esm/ui/widget/MapLayerSettingsPopupButton.js +1 -1
  134. package/lib/esm/ui/widget/MapLayerSettingsPopupButton.js.map +1 -1
  135. package/lib/esm/ui/widget/MapLayerSettingsPopupButton.scss +4 -1
  136. package/lib/esm/ui/widget/MapManagerSettings.d.ts.map +1 -1
  137. package/lib/esm/ui/widget/MapManagerSettings.js +38 -30
  138. package/lib/esm/ui/widget/MapManagerSettings.js.map +1 -1
  139. package/lib/esm/ui/widget/MapUrlDialog.d.ts +15 -5
  140. package/lib/esm/ui/widget/MapUrlDialog.d.ts.map +1 -1
  141. package/lib/esm/ui/widget/MapUrlDialog.js +129 -58
  142. package/lib/esm/ui/widget/MapUrlDialog.js.map +1 -1
  143. package/lib/esm/ui/widget/MapUrlDialog.scss +12 -1
  144. package/lib/esm/ui/widget/SelectApiKey.d.ts +10 -0
  145. package/lib/esm/ui/widget/SelectApiKey.d.ts.map +1 -0
  146. package/lib/esm/ui/widget/SelectApiKey.js +35 -0
  147. package/lib/esm/ui/widget/SelectApiKey.js.map +1 -0
  148. package/lib/esm/ui/widget/SelectCustomParam.d.ts +10 -0
  149. package/lib/esm/ui/widget/SelectCustomParam.d.ts.map +1 -0
  150. package/lib/esm/ui/widget/SelectCustomParam.js +45 -0
  151. package/lib/esm/ui/widget/SelectCustomParam.js.map +1 -0
  152. package/lib/esm/ui/widget/SelectMapFormat.d.ts +11 -2
  153. package/lib/esm/ui/widget/SelectMapFormat.d.ts.map +1 -1
  154. package/lib/esm/ui/widget/SelectMapFormat.js +5 -6
  155. package/lib/esm/ui/widget/SelectMapFormat.js.map +1 -1
  156. package/lib/esm/ui/widget/UserPreferencesStorageOptions.d.ts +10 -0
  157. package/lib/esm/ui/widget/UserPreferencesStorageOptions.d.ts.map +1 -0
  158. package/lib/esm/ui/widget/UserPreferencesStorageOptions.js +13 -0
  159. package/lib/esm/ui/widget/UserPreferencesStorageOptions.js.map +1 -0
  160. package/lib/public/locales/en/mapLayers.json +29 -3
  161. package/package.json +6 -6
@@ -1 +1 @@
1
- {"version":3,"file":"AttachLayerPopupButton.js","sourceRoot":"","sources":["../../../../src/ui/widget/AttachLayerPopupButton.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,EACL,SAAS,EAAE,cAAc,EAAE,oBAAoB,EAA4B,oBAAoB,EAAE,qBAAqB,GACvH,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,O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AAG,kBAAkB,EAAE,CAAC;YACvC,MAAM,GAAG,CACP,oBAAC,MAAM,IAAC,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,GAAG,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,oBAAoB,EACpI,OAAO,EAAE,WAAW,IAAG,yBAAyB,CAAU,CAC7D,CAAC;SACH;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,OAAO,CACL;QACG,YAAY,EAAE;QACf,oBAAC,MAAM,CAAC,KAAK,IACX,MAAM,EAAE,SAAS,EACjB,QAAQ,EAAE,gBAAgB,CAAC,WAAW,EACtC,OAAO,EAAE,gBAAgB,EACzB,cAAc,EAAE,oBAAoB,EACpC,YAAY,EAAE,KAAK,EACnB,MAAM,EAAE,SAAS,CAAC,OAAO,EACzB,YAAY,EAAE,KAAK,EACnB,kBAAkB,EAAE,KAAK;YAEzB,6BAAK,GAAG,EAAE,QAAQ,EAAE,SAAS,EAAC,yBAAyB;gBACrD,oBAAC,gBAAgB,IACf,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,eAAe,EAAE,mBAAmB,EACpC,oBAAoB,EAAE,qBAAqB,GAAI,CAC7C,CACQ,CACf,CACJ,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\nimport * as React from \"react\";\r\nimport { RelativePosition } from \"@itwin/appui-abstract\";\r\nimport { UiFramework } from \"@itwin/appui-react\";\r\nimport { MapSubLayerProps } from \"@itwin/core-common\";\r\nimport {\r\n IModelApp, MapLayerSource, MapLayerSourceStatus, MapLayerSourceValidation, NotifyMessageDetails, OutputMessagePriority,\r\n} from \"@itwin/core-frontend\";\r\nimport * as UiCore from \"@itwin/core-react\";\r\nimport { SvgAdd } from \"@itwin/itwinui-icons-react\";\r\nimport { Button, IconButton, Input } from \"@itwin/itwinui-react\";\r\nimport { MapLayerPreferences } from \"../../MapLayerPreferences\";\r\nimport { MapLayersUI } from \"../../mapLayers\";\r\nimport { ConfirmMessageDialog } from \"./ConfirmMessageDialog\";\r\nimport { useSourceMapContext } from \"./MapLayerManager\";\r\nimport { MapSelectFeaturesDialog } from \"./MapSelectFeaturesDialog\";\r\nimport { MapUrlDialog, SourceState } from \"./MapUrlDialog\";\r\n\r\n// cSpell:ignore droppable Sublayer\r\n\r\nenum LayerAction {\r\n New,\r\n Edit\r\n}\r\n\r\ninterface AttachLayerPanelProps {\r\n isOverlay: boolean;\r\n onLayerAttached: () => void;\r\n onHandleOutsideClick?: (shouldHandle: boolean) => void;\r\n}\r\n\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nfunction AttachLayerPanel({ isOverlay, onLayerAttached, onHandleOutsideClick }: AttachLayerPanelProps) {\r\n const [layerNameToAdd, setLayerNameToAdd] = React.useState<string | undefined>();\r\n const [sourceFilterString, setSourceFilterString] = React.useState<string | undefined>();\r\n\r\n const { placeholderLabel, addCustomLayerLabel, addCustomLayerToolTip, loadingMapSources, removeLayerDefButtonTitle, editLayerDefButtonTitle, removeLayerDefDialogTitle } = React.useMemo(() => {\r\n return {\r\n placeholderLabel: MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.SearchPlaceholder\"),\r\n addCustomLayerLabel: MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.Custom\"),\r\n addCustomLayerToolTip: MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.AttachCustomLayer\"),\r\n loadingMapSources: MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.LoadingMapSources\"),\r\n removeLayerDefButtonTitle: MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.RemoveLayerDefButtonTitle\"),\r\n editLayerDefButtonTitle: MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.EditLayerDefButtonTitle\"),\r\n removeLayerDefDialogTitle: MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.RemoveLayerDefDialogTitle\"),\r\n };\r\n }, []);\r\n\r\n const [loading, setLoading] = React.useState(false);\r\n const [layerNameUnderCursor, setLayerNameUnderCursor] = React.useState<string | undefined>();\r\n\r\n const resumeOutsideClick = React.useCallback(() => {\r\n if (onHandleOutsideClick) {\r\n onHandleOutsideClick(true);\r\n }\r\n }, [onHandleOutsideClick]);\r\n\r\n // 'isMounted' is used to prevent any async operation once the hook has been\r\n // unloaded. Otherwise we get a 'Can't perform a React state update on an unmounted component.' warning in the console.\r\n const isMounted = React.useRef(false);\r\n React.useEffect(() => {\r\n isMounted.current = true;\r\n return () => {\r\n isMounted.current = false;\r\n\r\n // We close any open dialogs that we might have opened\r\n // This was added because the modal dialog remained remained displayed after the session expired.\r\n UiFramework.dialogs.modal.close();\r\n };\r\n }, []);\r\n\r\n const handleFilterTextChanged = React.useCallback((event: React.ChangeEvent<HTMLInputElement>) => {\r\n setSourceFilterString(event.target.value);\r\n }, []);\r\n\r\n const { loadingSources, sources, activeViewport, backgroundLayers, overlayLayers, mapLayerOptions } = useSourceMapContext();\r\n const mapTypesOptions = mapLayerOptions?.mapTypeOptions;\r\n const iTwinId = activeViewport?.iModel?.iTwinId;\r\n const iModelId = activeViewport?.iModel?.iModelId;\r\n\r\n const attachLayer = React.useCallback((source: MapLayerSource, subLayers: MapSubLayerProps[]|undefined, oneMapLayerPerSubLayer: boolean) => {\r\n if (activeViewport) {\r\n const generateUniqueMapLayerName = (layerName: string) => {\r\n let uniqueLayerName = layerName;\r\n let layerNameIdx = 1;\r\n while (\r\n (backgroundLayers && backgroundLayers.some((layer) => uniqueLayerName === layer.name))\r\n || (overlayLayers && overlayLayers.some((layer) => uniqueLayerName === layer.name)) ) {\r\n uniqueLayerName = `${layerName} (${layerNameIdx++})`;\r\n }\r\n return {layerNameUpdate: layerNameIdx>1, uniqueLayerName};\r\n };\r\n\r\n const doAttachLayer = (layerName: string, subLayer?: MapSubLayerProps) => {\r\n const generatedName = generateUniqueMapLayerName(layerName);\r\n let sourceToAdd = source;\r\n if (generatedName.layerNameUpdate || sourceToAdd.name !== generatedName.uniqueLayerName) {\r\n // create a source with a unique name\r\n const clonedSource = MapLayerSource.fromJSON({...source.toJSON(), name: generatedName.uniqueLayerName});\r\n if (clonedSource !== undefined) {\r\n clonedSource.userName = source.userName;\r\n clonedSource.password = source.password;\r\n sourceToAdd = clonedSource;\r\n }\r\n\r\n }\r\n\r\n const settings = sourceToAdd.toLayerSettings(subLayer ? [subLayer] : subLayers);\r\n if (settings) {\r\n activeViewport.displayStyle.attachMapLayer({ settings, mapLayerIndex: {index: -1, isOverlay} });\r\n return generatedName.uniqueLayerName;\r\n }\r\n return undefined;\r\n };\r\n\r\n if (oneMapLayerPerSubLayer && subLayers) {\r\n const layerNamesAttached: string[] = [];\r\n for (const subLayer of subLayers) {\r\n\r\n const attachedLayerName = doAttachLayer(`${source.name} - ${subLayer.name}`, subLayer);\r\n if (attachedLayerName !== undefined) {\r\n layerNamesAttached.push(attachedLayerName);\r\n }\r\n }\r\n\r\n if (layerNamesAttached.length > 0) {\r\n const msg = IModelApp.localization.getLocalizedString(\"mapLayers:Messages.MapLayersAttached\", { layerNames: layerNamesAttached.join(\", \") });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Info, msg));\r\n }\r\n } else {\r\n const attachedLayerName = doAttachLayer(source.name);\r\n if (attachedLayerName !== undefined) {\r\n const msg = IModelApp.localization.getLocalizedString(\"mapLayers:Messages.MapLayerAttached\", { sourceName: attachedLayerName });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Info, msg));\r\n }\r\n }\r\n\r\n if (isMounted.current) {\r\n setLoading(false);\r\n }\r\n }\r\n if (isMounted.current) {\r\n onLayerAttached();\r\n resumeOutsideClick();\r\n }\r\n\r\n }, [activeViewport, backgroundLayers, isOverlay, onLayerAttached, overlayLayers, resumeOutsideClick]);\r\n\r\n const handleSelectFeaturesCancel = React.useCallback( () => {\r\n if (isMounted.current) {\r\n setLoading(false);\r\n }\r\n resumeOutsideClick();\r\n UiFramework.dialogs.modal.close();\r\n\r\n }, [resumeOutsideClick, setLoading]);\r\n\r\n const handleSelectFeaturesOk = React.useCallback((source: MapLayerSource, sourceSubLayers: MapSubLayerProps[], selectedSubLayers: MapSubLayerProps[] ) => {\r\n // keep only visible subLayers\r\n const visibleSubLayers = selectedSubLayers.filter((value) => value.visible);\r\n\r\n // Re-apply default visibility from the source validation\r\n visibleSubLayers.forEach((visible) => {\r\n const found = sourceSubLayers.find((value) => {visible.name === value.name;});\r\n if (found)\r\n visible.visible = found?.visible;\r\n });\r\n attachLayer(source, visibleSubLayers, true);\r\n\r\n }, [attachLayer]);\r\n\r\n const openFeatureSelectionDialog = React.useCallback((subLayers: MapSubLayerProps[], source: MapLayerSource ) => {\r\n // Keep leafs sub-layers and force default visibility to false\r\n const noGroupLayers = subLayers.filter((value: MapSubLayerProps) => value.children === undefined);\r\n const visibleLayers = noGroupLayers.map((value: MapSubLayerProps) => {return {...value, visible: false};});\r\n UiFramework.dialogs.modal.open(\r\n <MapSelectFeaturesDialog\r\n handleOk={(selectedLayers) => {handleSelectFeaturesOk(source, subLayers, selectedLayers);}}\r\n handleCancel={handleSelectFeaturesCancel}\r\n source={source}\r\n subLayers={visibleLayers}/>);\r\n }, [handleSelectFeaturesCancel, handleSelectFeaturesOk]);\r\n\r\n const needsFeatureSelection = React.useCallback((source: MapLayerSource, validation: MapLayerSourceValidation ) => {\r\n return (source.formatId === \"ArcGISFeature\" || source.formatId === \"WMTS\") // TODO, replace this with a flag in MapLayerSourceStatus\r\n && validation.subLayers\r\n && validation.subLayers.length > 1;\r\n }, []);\r\n\r\n const handleModalUrlDialogOk = React.useCallback((action: LayerAction, sourceState?: SourceState) => {\r\n UiFramework.dialogs.modal.close();\r\n if (LayerAction.New === action\r\n && sourceState\r\n && (sourceState.validation.status === MapLayerSourceStatus.Valid)) {\r\n if (needsFeatureSelection(sourceState.source, sourceState.validation)) {\r\n openFeatureSelectionDialog(sourceState.validation.subLayers!, sourceState.source);\r\n } else {\r\n attachLayer(sourceState.source, sourceState.validation.subLayers, false);\r\n }\r\n } else {\r\n resumeOutsideClick();\r\n }\r\n }, [attachLayer, needsFeatureSelection, openFeatureSelectionDialog, resumeOutsideClick]);\r\n\r\n const handleModalUrlDialogCancel = React.useCallback(() => {\r\n // close popup and refresh UI\r\n setLoading(false);\r\n UiFramework.dialogs.modal.close();\r\n resumeOutsideClick();\r\n }, [setLoading, resumeOutsideClick]);\r\n\r\n React.useEffect(() => {\r\n async function attemptToAddLayer() {\r\n if (layerNameToAdd && activeViewport) {\r\n // if the layer is not in the style add it now.\r\n const mapLayerSettings = sources?.find((source) => source.name === layerNameToAdd);\r\n if (mapLayerSettings === undefined) {\r\n return;\r\n }\r\n\r\n try {\r\n if (isMounted.current) {\r\n setLoading(true);\r\n }\r\n\r\n const sourceValidation = await mapLayerSettings.validateSource();\r\n if (sourceValidation.status === MapLayerSourceStatus.Valid || sourceValidation.status === MapLayerSourceStatus.RequireAuth) {\r\n if (sourceValidation.status === MapLayerSourceStatus.Valid) {\r\n if (sourceValidation.subLayers && needsFeatureSelection(mapLayerSettings, sourceValidation)) {\r\n openFeatureSelectionDialog(sourceValidation.subLayers, mapLayerSettings);\r\n if (onHandleOutsideClick) {\r\n onHandleOutsideClick(false);\r\n }\r\n } else {\r\n attachLayer(mapLayerSettings, sourceValidation.subLayers, false);\r\n }\r\n } else if (sourceValidation.status === MapLayerSourceStatus.RequireAuth && isMounted.current) {\r\n UiFramework.dialogs.modal.open(\r\n <MapUrlDialog\r\n activeViewport={activeViewport}\r\n isOverlay={isOverlay}\r\n layerRequiringCredentials={mapLayerSettings.toJSON()}\r\n onOkResult={(sourceState?: SourceState) => handleModalUrlDialogOk(LayerAction.New, sourceState)}\r\n onCancelResult={handleModalUrlDialogCancel}\r\n mapTypesOptions={mapTypesOptions} />\r\n );\r\n if (onHandleOutsideClick) {\r\n onHandleOutsideClick(false);\r\n }\r\n }\r\n\r\n } else {\r\n const msg = IModelApp.localization.getLocalizedString(\"mapLayers:Messages.MapLayerValidationFailed\", { sourceUrl: mapLayerSettings.url });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, msg));\r\n if (isMounted.current) {\r\n setLoading(false);\r\n }\r\n }\r\n } catch (err) {\r\n if (isMounted.current) {\r\n setLoading(false);\r\n }\r\n const msg = IModelApp.localization.getLocalizedString(\"mapLayers:Messages.MapLayerAttachError\", { error: err, sourceName: mapLayerSettings.name });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, msg));\r\n }\r\n }\r\n return;\r\n }\r\n\r\n attemptToAddLayer(); // eslint-disable-line @typescript-eslint/no-floating-promises\r\n\r\n if (isMounted.current) {\r\n setLayerNameToAdd(undefined);\r\n }\r\n }, [attachLayer, needsFeatureSelection, setLayerNameToAdd, layerNameToAdd, activeViewport, sources, backgroundLayers, isOverlay, overlayLayers,\r\n onLayerAttached, handleModalUrlDialogOk, handleSelectFeaturesCancel, handleSelectFeaturesOk, mapTypesOptions,\r\n handleModalUrlDialogCancel, onHandleOutsideClick, openFeatureSelectionDialog]);\r\n\r\n const options = React.useMemo(() => sources, [sources]);\r\n\r\n const filteredOptions = React.useMemo(() => {\r\n if (undefined === sourceFilterString || 0 === sourceFilterString.length) {\r\n return options;\r\n } else {\r\n return options?.filter((option) => option.name.toLowerCase().includes(sourceFilterString?.toLowerCase()));\r\n }\r\n }, [options, sourceFilterString]);\r\n\r\n const handleAddNewMapSource = React.useCallback(() => {\r\n UiFramework.dialogs.modal.open(<MapUrlDialog\r\n activeViewport={activeViewport}\r\n isOverlay={isOverlay}\r\n onOkResult={(result?: SourceState) => handleModalUrlDialogOk(LayerAction.New, result)}\r\n onCancelResult={handleModalUrlDialogCancel}\r\n mapTypesOptions={mapTypesOptions} />);\r\n if (onHandleOutsideClick) {\r\n onHandleOutsideClick(false);\r\n }\r\n return;\r\n }, [activeViewport, handleModalUrlDialogCancel, handleModalUrlDialogOk, isOverlay, mapTypesOptions, onHandleOutsideClick]);\r\n\r\n const handleAttach = React.useCallback((mapName: string) => {\r\n setLayerNameToAdd(mapName);\r\n }, []);\r\n\r\n const handleKeypressOnSourceList = React.useCallback((event: React.KeyboardEvent<HTMLUListElement>) => {\r\n const key = event.key;\r\n if (key === \"Enter\") {\r\n event.preventDefault();\r\n const mapName = event.currentTarget?.dataset?.value;\r\n if (mapName && mapName.length) {\r\n handleAttach(mapName);\r\n }\r\n }\r\n }, [handleAttach]);\r\n\r\n const onListboxValueChange = React.useCallback((mapName: string) => {\r\n setLayerNameToAdd(mapName);\r\n }, []);\r\n\r\n const handleNoConfirmation = React.useCallback((_layerName: string) => {\r\n UiFramework.dialogs.modal.close();\r\n resumeOutsideClick();\r\n }, [resumeOutsideClick]);\r\n\r\n const handleYesConfirmation = React.useCallback(async (source: MapLayerSource) => {\r\n const layerName = source.name;\r\n if (!!iTwinId) {\r\n try {\r\n await MapLayerPreferences.deleteByName(source, iTwinId, iModelId);\r\n const msg = MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.RemoveLayerDefSuccess\", { layerName });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Info, msg));\r\n } catch (err: any) {\r\n const msg = MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.RemoveLayerDefError\", { layerName });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, msg));\r\n }\r\n }\r\n\r\n UiFramework.dialogs.modal.close();\r\n resumeOutsideClick();\r\n }, [iTwinId, iModelId, resumeOutsideClick]);\r\n\r\n /*\r\n Handle Remove layer button clicked\r\n */\r\n const onItemRemoveButtonClicked = React.useCallback((source, event) => {\r\n event.stopPropagation(); // We don't want the owning ListBox to react on mouse click.\r\n\r\n const layerName = source.name;\r\n\r\n const msg = MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.RemoveLayerDefDialogMessage\", { layerName });\r\n UiFramework.dialogs.modal.open(\r\n <ConfirmMessageDialog\r\n className=\"map-sources-delete-confirmation\"\r\n title={removeLayerDefDialogTitle}\r\n message={msg}\r\n maxWidth={400}\r\n onClose={() => handleNoConfirmation(layerName)}\r\n onEscape={() => handleNoConfirmation(layerName)}\r\n onYesResult={async () => handleYesConfirmation(source)}\r\n onNoResult={() => handleNoConfirmation(layerName)}\r\n />\r\n );\r\n if (onHandleOutsideClick) {\r\n onHandleOutsideClick(false);\r\n }\r\n }, [handleNoConfirmation, handleYesConfirmation, onHandleOutsideClick, removeLayerDefDialogTitle]);\r\n\r\n /*\r\n Handle Edit layer button clicked\r\n */\r\n const onItemEditButtonClicked = React.useCallback((event) => {\r\n event.stopPropagation(); // We don't want the owning ListBox to react on mouse click.\r\n\r\n const targetLayerName = event?.currentTarget?.parentNode?.dataset?.value;\r\n const matchingSource = sources.find((layerSource) => layerSource.name === targetLayerName);\r\n\r\n // we expect a single layer source matching this name\r\n if (matchingSource === undefined) {\r\n return;\r\n }\r\n UiFramework.dialogs.modal.open(<MapUrlDialog\r\n activeViewport={activeViewport}\r\n isOverlay={isOverlay}\r\n mapLayerSourceToEdit={matchingSource}\r\n onOkResult={(result?: SourceState) => handleModalUrlDialogOk(LayerAction.Edit, result)}\r\n onCancelResult={handleModalUrlDialogCancel}\r\n mapTypesOptions={mapTypesOptions} />);\r\n\r\n if (onHandleOutsideClick) {\r\n onHandleOutsideClick(false);\r\n }\r\n }, [activeViewport, handleModalUrlDialogCancel, handleModalUrlDialogOk, isOverlay, mapTypesOptions, onHandleOutsideClick, sources]);\r\n\r\n return (\r\n <div className=\"map-manager-header\">\r\n {(loading || loadingSources) && <UiCore.LoadingSpinner message={loadingMapSources} />}\r\n <div className=\"map-manager-source-listbox-header\">\r\n <Input type=\"text\" className=\"map-manager-source-list-filter\"\r\n placeholder={placeholderLabel}\r\n value={sourceFilterString}\r\n onChange={handleFilterTextChanged}\r\n size=\"small\" />\r\n <Button className=\"map-manager-add-source-button\" title={addCustomLayerToolTip} onClick={handleAddNewMapSource}>\r\n {addCustomLayerLabel}</Button>\r\n </div>\r\n <div className=\"map-manager-sources\">\r\n <UiCore.Listbox\r\n id=\"map-sources\"\r\n selectedValue={layerNameToAdd}\r\n className=\"map-manager-source-list\"\r\n onKeyPress={handleKeypressOnSourceList}\r\n onListboxValueChange={onListboxValueChange} >\r\n {\r\n filteredOptions?.map((source) =>\r\n <UiCore.ListboxItem\r\n key={source.name}\r\n className=\"map-source-list-entry\"\r\n value={source.name}\r\n onMouseEnter={() => setLayerNameUnderCursor(source.name)}\r\n onMouseLeave={() => setLayerNameUnderCursor(undefined)}>\r\n <span className=\"map-source-list-entry-name\" title={source.name}>{source.name}</span>\r\n\r\n { // Display the delete icon only when the mouse over a specific item\r\n // otherwise list feels cluttered.\r\n (!!iTwinId && layerNameUnderCursor && layerNameUnderCursor === source.name) &&\r\n <>\r\n <Button\r\n size=\"small\"\r\n styleType=\"borderless\"\r\n className=\"map-source-list-entry-button\"\r\n title={editLayerDefButtonTitle}\r\n onClick={onItemEditButtonClicked}>\r\n <UiCore.Icon iconSpec=\"icon-edit\" />\r\n </Button>\r\n <Button\r\n size=\"small\"\r\n styleType=\"borderless\"\r\n className=\"map-source-list-entry-button\"\r\n title={removeLayerDefButtonTitle}\r\n onClick={(event: React.MouseEvent) => { onItemRemoveButtonClicked(source, event); }}>\r\n <UiCore.Icon iconSpec=\"icon-delete\" />\r\n </Button>\r\n </>}\r\n\r\n </UiCore.ListboxItem>\r\n )\r\n }\r\n </UiCore.Listbox>\r\n </div>\r\n </div>\r\n\r\n );\r\n}\r\n\r\n/** @internal */\r\nexport enum AttachLayerButtonType {\r\n Primary,\r\n Blue,\r\n Icon\r\n}\r\nexport interface AttachLayerPopupButtonProps {\r\n isOverlay: boolean;\r\n buttonType?: AttachLayerButtonType;\r\n disabled?: boolean;\r\n}\r\n\r\n/** @internal */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport function AttachLayerPopupButton(props: AttachLayerPopupButtonProps) {\r\n const { showAttachLayerLabel, hideAttachLayerLabel, addCustomLayerButtonLabel } = React.useMemo(() => {\r\n return {\r\n showAttachLayerLabel: MapLayersUI.localization.getLocalizedString(\"mapLayers:AttachLayerPopup.Attach\"),\r\n hideAttachLayerLabel: MapLayersUI.localization.getLocalizedString(\"mapLayers:AttachLayerPopup.Close\"),\r\n addCustomLayerButtonLabel: MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.AddCustomLayerButtonLabel\"),\r\n };\r\n }, []);\r\n\r\n const [handleOutsideClick, setHandleOutsideClick] = React.useState(true);\r\n const [popupOpen, setPopupOpen] = React.useState(false);\r\n const buttonRef = React.useRef<HTMLButtonElement>(null);\r\n const panelRef = React.useRef<HTMLDivElement>(null);\r\n\r\n // 'isMounted' is used to prevent any async operation once the hook has been\r\n // unloaded. Otherwise we get a 'Can't perform a React state update on an unmounted component.' warning in the console.\r\n const isMounted = React.useRef(false);\r\n React.useEffect(() => {\r\n isMounted.current = true;\r\n return () => {\r\n isMounted.current = false;\r\n };\r\n }, []);\r\n\r\n const togglePopup = React.useCallback(() => {\r\n setPopupOpen(!popupOpen);\r\n }, [popupOpen]);\r\n\r\n const handleClosePopup = React.useCallback(() => {\r\n setPopupOpen(false);\r\n }, []);\r\n\r\n const onHandleOutsideClick = React.useCallback((event: MouseEvent) => {\r\n if (!handleOutsideClick) {\r\n return;\r\n }\r\n\r\n // If clicking on button that open panel - don't trigger outside click processing\r\n if (buttonRef?.current && buttonRef?.current.contains(event.target as Node)) {\r\n return;\r\n }\r\n\r\n // If clicking the panel, this is not an outside clicked\r\n if (panelRef.current && panelRef?.current.contains(event.target as Node)) {\r\n return;\r\n }\r\n\r\n // If we reach this point, we got an outside clicked, no close the popup\r\n setPopupOpen(false);\r\n\r\n }, [handleOutsideClick]);\r\n\r\n const { refreshFromStyle } = useSourceMapContext();\r\n\r\n const handleLayerAttached = React.useCallback(() => {\r\n if (!isMounted.current) {\r\n return;\r\n }\r\n setPopupOpen(false);\r\n refreshFromStyle();\r\n }, [refreshFromStyle]);\r\n\r\n function renderButton(): React.ReactNode {\r\n let button: React.ReactNode;\r\n\r\n if (props.buttonType === undefined || props.buttonType === AttachLayerButtonType.Icon) {\r\n button = (\r\n <IconButton disabled={props.disabled} size=\"small\" styleType=\"borderless\" ref={buttonRef} className=\"map-manager-attach-layer-button\" title={popupOpen ? hideAttachLayerLabel : showAttachLayerLabel}\r\n onClick={togglePopup}>\r\n <SvgAdd/>\r\n </IconButton>\r\n );\r\n } else {\r\n const determineStyleType = () => {\r\n switch (props.buttonType) {\r\n case AttachLayerButtonType.Blue:\r\n return \"high-visibility\";\r\n case AttachLayerButtonType.Primary:\r\n default:\r\n return \"cta\";\r\n }\r\n };\r\n const styleType = determineStyleType();\r\n button = (\r\n <Button disabled={props.disabled} ref={buttonRef} styleType={styleType} title={popupOpen ? hideAttachLayerLabel : showAttachLayerLabel}\r\n onClick={togglePopup}>{addCustomLayerButtonLabel}</Button>\r\n );\r\n }\r\n\r\n return button;\r\n }\r\n\r\n return (\r\n <>\r\n {renderButton()}\r\n <UiCore.Popup\r\n isOpen={popupOpen}\r\n position={RelativePosition.BottomRight}\r\n onClose={handleClosePopup}\r\n onOutsideClick={onHandleOutsideClick}\r\n closeOnWheel={false}\r\n target={buttonRef.current}\r\n closeOnEnter={false}\r\n closeOnContextMenu={false}\r\n >\r\n <div ref={panelRef} className=\"map-sources-popup-panel\" >\r\n <AttachLayerPanel\r\n isOverlay={props.isOverlay}\r\n onLayerAttached={handleLayerAttached}\r\n onHandleOutsideClick={setHandleOutsideClick} />\r\n </div>\r\n </UiCore.Popup >\r\n </>\r\n );\r\n}\r\n"]}
1
+ {"version":3,"file":"AttachLayerPopupButton.js","sourceRoot":"","sources":["../../../../src/ui/widget/AttachLayerPopupButton.tsx"],"names":[],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EAAC,yBAAyB;gBACrD,oBAAC,gBAAgB,IACf,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,eAAe,EAAE,mBAAmB,EACpC,oBAAoB,EAAE,qBAAqB,GAAI,CAC7C,CACQ,CACf,CACJ,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\nimport * as React from \"react\";\r\nimport { RelativePosition } from \"@itwin/appui-abstract\";\r\nimport { UiFramework } from \"@itwin/appui-react\";\r\nimport { MapSubLayerProps } from \"@itwin/core-common\";\r\nimport {\r\n IModelApp, MapLayerSource, MapLayerSourceStatus, MapLayerSourceValidation, NotifyMessageDetails, OutputMessagePriority,\r\n} from \"@itwin/core-frontend\";\r\nimport * as UiCore from \"@itwin/core-react\";\r\nimport { SvgAdd } from \"@itwin/itwinui-icons-react\";\r\nimport { Button, IconButton, Input } from \"@itwin/itwinui-react\";\r\nimport { MapLayerPreferences } from \"../../MapLayerPreferences\";\r\nimport { MapLayersUI } from \"../../mapLayers\";\r\nimport { ConfirmMessageDialog } from \"./ConfirmMessageDialog\";\r\nimport { useSourceMapContext } from \"./MapLayerManager\";\r\nimport { MapSelectFeaturesDialog } from \"./MapSelectFeaturesDialog\";\r\nimport { MapUrlDialog, SourceState } from \"./MapUrlDialog\";\r\n\r\n// cSpell:ignore droppable Sublayer\r\n\r\nenum LayerAction {\r\n New,\r\n Edit\r\n}\r\n\r\ninterface AttachLayerPanelProps {\r\n isOverlay: boolean;\r\n onLayerAttached: () => void;\r\n onHandleOutsideClick?: (shouldHandle: boolean) => void;\r\n}\r\n\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nfunction AttachLayerPanel({ isOverlay, onLayerAttached, onHandleOutsideClick }: AttachLayerPanelProps) {\r\n const [layerNameToAdd, setLayerNameToAdd] = React.useState<string | undefined>();\r\n const [sourceFilterString, setSourceFilterString] = React.useState<string | undefined>();\r\n\r\n const { placeholderLabel, addCustomLayerLabel, addCustomLayerToolTip, loadingMapSources, removeLayerDefButtonTitle, editLayerDefButtonTitle, removeLayerDefDialogTitle } = React.useMemo(() => {\r\n return {\r\n placeholderLabel: MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.SearchPlaceholder\"),\r\n addCustomLayerLabel: MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.Custom\"),\r\n addCustomLayerToolTip: MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.AttachCustomLayer\"),\r\n loadingMapSources: MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.LoadingMapSources\"),\r\n removeLayerDefButtonTitle: MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.RemoveLayerDefButtonTitle\"),\r\n editLayerDefButtonTitle: MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.EditLayerDefButtonTitle\"),\r\n removeLayerDefDialogTitle: MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.RemoveLayerDefDialogTitle\"),\r\n };\r\n }, []);\r\n\r\n const [loading, setLoading] = React.useState(false);\r\n const [layerNameUnderCursor, setLayerNameUnderCursor] = React.useState<string | undefined>();\r\n\r\n const resumeOutsideClick = React.useCallback(() => {\r\n if (onHandleOutsideClick) {\r\n onHandleOutsideClick(true);\r\n }\r\n }, [onHandleOutsideClick]);\r\n\r\n // 'isMounted' is used to prevent any async operation once the hook has been\r\n // unloaded. Otherwise we get a 'Can't perform a React state update on an unmounted component.' warning in the console.\r\n const isMounted = React.useRef(false);\r\n React.useEffect(() => {\r\n isMounted.current = true;\r\n return () => {\r\n isMounted.current = false;\r\n\r\n // We close any open dialogs that we might have opened\r\n // This was added because the modal dialog remained remained displayed after the session expired.\r\n UiFramework.dialogs.modal.close();\r\n };\r\n }, []);\r\n\r\n const handleFilterTextChanged = React.useCallback((event: React.ChangeEvent<HTMLInputElement>) => {\r\n setSourceFilterString(event.target.value);\r\n }, []);\r\n\r\n const { loadingSources, sources, activeViewport, backgroundLayers, overlayLayers, mapLayerOptions } = useSourceMapContext();\r\n const iTwinId = activeViewport?.iModel?.iTwinId;\r\n const iModelId = activeViewport?.iModel?.iModelId;\r\n\r\n const attachLayer = React.useCallback((source: MapLayerSource, subLayers: MapSubLayerProps[]|undefined, oneMapLayerPerSubLayer: boolean) => {\r\n if (activeViewport) {\r\n const generateUniqueMapLayerName = (layerName: string) => {\r\n let uniqueLayerName = layerName;\r\n let layerNameIdx = 1;\r\n while (\r\n (backgroundLayers && backgroundLayers.some((layer) => uniqueLayerName === layer.name))\r\n || (overlayLayers && overlayLayers.some((layer) => uniqueLayerName === layer.name)) ) {\r\n uniqueLayerName = `${layerName} (${layerNameIdx++})`;\r\n }\r\n return {layerNameUpdate: layerNameIdx>1, uniqueLayerName};\r\n };\r\n\r\n const doAttachLayer = (layerName: string, subLayer?: MapSubLayerProps) => {\r\n const generatedName = generateUniqueMapLayerName(layerName);\r\n let sourceToAdd = source;\r\n if (generatedName.layerNameUpdate || sourceToAdd.name !== generatedName.uniqueLayerName) {\r\n // create a source with a unique name\r\n const clonedSource = MapLayerSource.fromJSON({...source.toJSON(), name: generatedName.uniqueLayerName});\r\n if (clonedSource !== undefined) {\r\n clonedSource.userName = source.userName;\r\n clonedSource.password = source.password;\r\n clonedSource.unsavedQueryParams = {...source.unsavedQueryParams};\r\n clonedSource.savedQueryParams = {...source.savedQueryParams};\r\n sourceToAdd = clonedSource;\r\n }\r\n }\r\n\r\n const settings = sourceToAdd.toLayerSettings(subLayer ? [subLayer] : subLayers);\r\n if (settings) {\r\n activeViewport.displayStyle.attachMapLayer({ settings, mapLayerIndex: {index: -1, isOverlay} });\r\n return generatedName.uniqueLayerName;\r\n }\r\n return undefined;\r\n };\r\n\r\n if (oneMapLayerPerSubLayer && subLayers) {\r\n const layerNamesAttached: string[] = [];\r\n for (const subLayer of subLayers) {\r\n const attachedLayerName = doAttachLayer(`${source.name} - ${subLayer.name}`, subLayer);\r\n if (attachedLayerName !== undefined) {\r\n layerNamesAttached.push(attachedLayerName);\r\n }\r\n }\r\n\r\n if (layerNamesAttached.length > 0) {\r\n const msg = IModelApp.localization.getLocalizedString(\"mapLayers:Messages.MapLayersAttached\", { layerNames: layerNamesAttached.join(\", \") });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Info, msg));\r\n }\r\n } else {\r\n const attachedLayerName = doAttachLayer(source.name, undefined);\r\n if (attachedLayerName !== undefined) {\r\n const msg = IModelApp.localization.getLocalizedString(\"mapLayers:Messages.MapLayerAttached\", { sourceName: attachedLayerName });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Info, msg));\r\n }\r\n }\r\n\r\n if (isMounted.current) {\r\n setLoading(false);\r\n }\r\n }\r\n if (isMounted.current) {\r\n onLayerAttached();\r\n resumeOutsideClick();\r\n }\r\n\r\n }, [activeViewport, backgroundLayers, isOverlay, onLayerAttached, overlayLayers, resumeOutsideClick]);\r\n\r\n const handleSelectFeaturesCancel = React.useCallback( () => {\r\n if (isMounted.current) {\r\n setLoading(false);\r\n }\r\n resumeOutsideClick();\r\n UiFramework.dialogs.modal.close();\r\n\r\n }, [resumeOutsideClick, setLoading]);\r\n\r\n const handleSelectFeaturesOk = React.useCallback((source: MapLayerSource, sourceSubLayers: MapSubLayerProps[], selectedSubLayers: MapSubLayerProps[] ) => {\r\n // keep only visible subLayers\r\n const visibleSubLayers = selectedSubLayers.filter((value) => value.visible);\r\n\r\n // Re-apply default visibility from the source validation\r\n visibleSubLayers.forEach((visible) => {\r\n const found = sourceSubLayers.find((value) => {visible.name === value.name;});\r\n if (found)\r\n visible.visible = found?.visible;\r\n });\r\n attachLayer(source, visibleSubLayers, true);\r\n\r\n }, [attachLayer]);\r\n\r\n const openFeatureSelectionDialog = React.useCallback((subLayers: MapSubLayerProps[], source: MapLayerSource ) => {\r\n // Keep leafs sub-layers and force default visibility to false\r\n const noGroupLayers = subLayers.filter((value: MapSubLayerProps) => value.children === undefined);\r\n const visibleLayers = noGroupLayers.map((value: MapSubLayerProps) => {return {...value, visible: false};});\r\n UiFramework.dialogs.modal.open(\r\n <MapSelectFeaturesDialog\r\n handleOk={(selectedLayers) => {handleSelectFeaturesOk(source, subLayers, selectedLayers);}}\r\n handleCancel={handleSelectFeaturesCancel}\r\n source={source}\r\n subLayers={visibleLayers}/>);\r\n }, [handleSelectFeaturesCancel, handleSelectFeaturesOk]);\r\n\r\n const needsFeatureSelection = React.useCallback((source: MapLayerSource, validation: MapLayerSourceValidation ) => {\r\n return (source.formatId === \"ArcGISFeature\" || source.formatId === \"WMTS\") // TODO, replace this with a flag in MapLayerSourceStatus\r\n && validation.subLayers\r\n && validation.subLayers.length > 1;\r\n }, []);\r\n\r\n const handleModalUrlDialogOk = React.useCallback((action: LayerAction, sourceState?: SourceState) => {\r\n UiFramework.dialogs.modal.close();\r\n if (LayerAction.New === action\r\n && sourceState\r\n && (sourceState.validation.status === MapLayerSourceStatus.Valid)) {\r\n if (needsFeatureSelection(sourceState.source, sourceState.validation)) {\r\n openFeatureSelectionDialog(sourceState.validation.subLayers!, sourceState.source);\r\n } else {\r\n attachLayer(sourceState.source, sourceState.validation.subLayers, false);\r\n }\r\n } else {\r\n resumeOutsideClick();\r\n }\r\n }, [attachLayer, needsFeatureSelection, openFeatureSelectionDialog, resumeOutsideClick]);\r\n\r\n const handleModalUrlDialogCancel = React.useCallback(() => {\r\n // close popup and refresh UI\r\n setLoading(false);\r\n UiFramework.dialogs.modal.close();\r\n resumeOutsideClick();\r\n }, [setLoading, resumeOutsideClick]);\r\n\r\n React.useEffect(() => {\r\n async function attemptToAddLayer() {\r\n if (layerNameToAdd && activeViewport) {\r\n // if the layer is not in the style add it now.\r\n const foundSource = sources?.find((source) => source.name === layerNameToAdd);\r\n if (foundSource === undefined) {\r\n return;\r\n }\r\n\r\n try {\r\n if (isMounted.current) {\r\n setLoading(true);\r\n }\r\n\r\n const sourceValidation = await foundSource.validateSource();\r\n if (sourceValidation.status === MapLayerSourceStatus.Valid || sourceValidation.status === MapLayerSourceStatus.RequireAuth) {\r\n if (sourceValidation.status === MapLayerSourceStatus.Valid) {\r\n if (sourceValidation.subLayers && needsFeatureSelection(foundSource, sourceValidation)) {\r\n openFeatureSelectionDialog(sourceValidation.subLayers, foundSource);\r\n if (onHandleOutsideClick) {\r\n onHandleOutsideClick(false);\r\n }\r\n } else {\r\n attachLayer(foundSource, sourceValidation.subLayers, false);\r\n }\r\n } else if (sourceValidation.status === MapLayerSourceStatus.RequireAuth && isMounted.current) {\r\n const layer = foundSource.toLayerSettings();\r\n if (layer) {\r\n UiFramework.dialogs.modal.open(\r\n <MapUrlDialog\r\n activeViewport={activeViewport}\r\n isOverlay={isOverlay}\r\n signInModeArgs={{layer, validation: sourceValidation, source: foundSource}}\r\n onOkResult={(sourceState?: SourceState) => handleModalUrlDialogOk(LayerAction.New, sourceState)}\r\n onCancelResult={handleModalUrlDialogCancel}\r\n {...mapLayerOptions} />\r\n );\r\n }\r\n\r\n if (onHandleOutsideClick) {\r\n onHandleOutsideClick(false);\r\n }\r\n }\r\n\r\n } else {\r\n const msg = IModelApp.localization.getLocalizedString(\"mapLayers:Messages.MapLayerValidationFailed\", { sourceUrl: foundSource.url });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, msg));\r\n if (isMounted.current) {\r\n setLoading(false);\r\n }\r\n }\r\n } catch (err) {\r\n if (isMounted.current) {\r\n setLoading(false);\r\n }\r\n const msg = IModelApp.localization.getLocalizedString(\"mapLayers:Messages.MapLayerAttachError\", { error: err, sourceName: foundSource.name });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, msg));\r\n }\r\n }\r\n return;\r\n }\r\n\r\n attemptToAddLayer(); // eslint-disable-line @typescript-eslint/no-floating-promises\r\n\r\n if (isMounted.current) {\r\n setLayerNameToAdd(undefined);\r\n }\r\n }, [attachLayer, needsFeatureSelection, setLayerNameToAdd, layerNameToAdd, activeViewport, sources, backgroundLayers, isOverlay, overlayLayers, onLayerAttached, handleModalUrlDialogOk, handleSelectFeaturesCancel, handleSelectFeaturesOk, handleModalUrlDialogCancel, onHandleOutsideClick, openFeatureSelectionDialog, mapLayerOptions]);\r\n\r\n const options = React.useMemo(() => sources, [sources]);\r\n\r\n const filteredOptions = React.useMemo(() => {\r\n if (undefined === sourceFilterString || 0 === sourceFilterString.length) {\r\n return options;\r\n } else {\r\n return options?.filter((option) => option.name.toLowerCase().includes(sourceFilterString?.toLowerCase()));\r\n }\r\n }, [options, sourceFilterString]);\r\n\r\n const handleAddNewMapSource = React.useCallback(() => {\r\n UiFramework.dialogs.modal.open(<MapUrlDialog\r\n activeViewport={activeViewport}\r\n isOverlay={isOverlay}\r\n onOkResult={(result?: SourceState) => handleModalUrlDialogOk(LayerAction.New, result)}\r\n onCancelResult={handleModalUrlDialogCancel}\r\n {...mapLayerOptions} />);\r\n if (onHandleOutsideClick) {\r\n onHandleOutsideClick(false);\r\n }\r\n return;\r\n }, [activeViewport, handleModalUrlDialogCancel, handleModalUrlDialogOk, isOverlay, mapLayerOptions, onHandleOutsideClick]);\r\n\r\n const handleAttach = React.useCallback((mapName: string) => {\r\n setLayerNameToAdd(mapName);\r\n }, []);\r\n\r\n const handleKeypressOnSourceList = React.useCallback((event: React.KeyboardEvent<HTMLUListElement>) => {\r\n const key = event.key;\r\n if (key === \"Enter\") {\r\n event.preventDefault();\r\n const mapName = event.currentTarget?.dataset?.value;\r\n if (mapName && mapName.length) {\r\n handleAttach(mapName);\r\n }\r\n }\r\n }, [handleAttach]);\r\n\r\n const onListboxValueChange = React.useCallback((mapName: string) => {\r\n setLayerNameToAdd(mapName);\r\n }, []);\r\n\r\n const handleNoConfirmation = React.useCallback((_layerName: string) => {\r\n UiFramework.dialogs.modal.close();\r\n resumeOutsideClick();\r\n }, [resumeOutsideClick]);\r\n\r\n const handleYesConfirmation = React.useCallback(async (source: MapLayerSource) => {\r\n const layerName = source.name;\r\n if (!!iTwinId) {\r\n try {\r\n await MapLayerPreferences.deleteByName(source, iTwinId, iModelId);\r\n const msg = MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.RemoveLayerDefSuccess\", { layerName });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Info, msg));\r\n } catch (err: any) {\r\n const msg = MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.RemoveLayerDefError\", { layerName });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, msg));\r\n }\r\n }\r\n\r\n UiFramework.dialogs.modal.close();\r\n resumeOutsideClick();\r\n }, [iTwinId, iModelId, resumeOutsideClick]);\r\n\r\n /*\r\n Handle Remove layer button clicked\r\n */\r\n const onItemRemoveButtonClicked = React.useCallback((source, event) => {\r\n event.stopPropagation(); // We don't want the owning ListBox to react on mouse click.\r\n\r\n const layerName = source.name;\r\n\r\n const msg = MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.RemoveLayerDefDialogMessage\", { layerName });\r\n UiFramework.dialogs.modal.open(\r\n <ConfirmMessageDialog\r\n className=\"map-sources-delete-confirmation\"\r\n title={removeLayerDefDialogTitle}\r\n message={msg}\r\n maxWidth={400}\r\n onClose={() => handleNoConfirmation(layerName)}\r\n onEscape={() => handleNoConfirmation(layerName)}\r\n onYesResult={async () => handleYesConfirmation(source)}\r\n onNoResult={() => handleNoConfirmation(layerName)}\r\n />\r\n );\r\n if (onHandleOutsideClick) {\r\n onHandleOutsideClick(false);\r\n }\r\n }, [handleNoConfirmation, handleYesConfirmation, onHandleOutsideClick, removeLayerDefDialogTitle]);\r\n\r\n /*\r\n Handle Edit layer button clicked\r\n */\r\n const onItemEditButtonClicked = React.useCallback((event) => {\r\n event.stopPropagation(); // We don't want the owning ListBox to react on mouse click.\r\n\r\n const targetLayerName = event?.currentTarget?.parentNode?.dataset?.value;\r\n const matchingSource = sources.find((layerSource) => layerSource.name === targetLayerName);\r\n\r\n // we expect a single layer source matching this name\r\n if (matchingSource === undefined) {\r\n return;\r\n }\r\n UiFramework.dialogs.modal.open(<MapUrlDialog\r\n activeViewport={activeViewport}\r\n isOverlay={isOverlay}\r\n mapLayerSourceToEdit={matchingSource}\r\n onOkResult={(result?: SourceState) => handleModalUrlDialogOk(LayerAction.Edit, result)}\r\n onCancelResult={handleModalUrlDialogCancel}\r\n {...mapLayerOptions} />);\r\n\r\n if (onHandleOutsideClick) {\r\n onHandleOutsideClick(false);\r\n }\r\n }, [activeViewport, handleModalUrlDialogCancel, handleModalUrlDialogOk, isOverlay, mapLayerOptions, onHandleOutsideClick, sources]);\r\n\r\n return (\r\n <div className=\"map-manager-header\">\r\n {(loading || loadingSources) && <UiCore.LoadingSpinner message={loadingMapSources} />}\r\n <div className=\"map-manager-source-listbox-header\">\r\n <Input type=\"text\" className=\"map-manager-source-list-filter\"\r\n placeholder={placeholderLabel}\r\n value={sourceFilterString}\r\n onChange={handleFilterTextChanged}\r\n size=\"small\" />\r\n <Button className=\"map-manager-add-source-button\" title={addCustomLayerToolTip} onClick={handleAddNewMapSource}>\r\n {addCustomLayerLabel}</Button>\r\n </div>\r\n <div className=\"map-manager-sources\">\r\n <UiCore.Listbox\r\n id=\"map-sources\"\r\n selectedValue={layerNameToAdd}\r\n className=\"map-manager-source-list\"\r\n onKeyPress={handleKeypressOnSourceList}\r\n onListboxValueChange={onListboxValueChange} >\r\n {\r\n filteredOptions?.map((source) =>\r\n <UiCore.ListboxItem\r\n key={source.name}\r\n className=\"map-source-list-entry\"\r\n value={source.name}\r\n onMouseEnter={() => setLayerNameUnderCursor(source.name)}\r\n onMouseLeave={() => setLayerNameUnderCursor(undefined)}>\r\n <span className=\"map-source-list-entry-name\" title={source.name}>{source.name}</span>\r\n\r\n { // Display the delete icon only when the mouse over a specific item\r\n // otherwise list feels cluttered.\r\n (!!iTwinId && layerNameUnderCursor && layerNameUnderCursor === source.name) &&\r\n <>\r\n <Button\r\n size=\"small\"\r\n styleType=\"borderless\"\r\n className=\"map-source-list-entry-button\"\r\n title={editLayerDefButtonTitle}\r\n onClick={onItemEditButtonClicked}>\r\n <UiCore.Icon iconSpec=\"icon-edit\" />\r\n </Button>\r\n <Button\r\n size=\"small\"\r\n styleType=\"borderless\"\r\n className=\"map-source-list-entry-button\"\r\n title={removeLayerDefButtonTitle}\r\n onClick={(event: React.MouseEvent) => { onItemRemoveButtonClicked(source, event); }}>\r\n <UiCore.Icon iconSpec=\"icon-delete\" />\r\n </Button>\r\n </>}\r\n\r\n </UiCore.ListboxItem>\r\n )\r\n }\r\n </UiCore.Listbox>\r\n </div>\r\n </div>\r\n\r\n );\r\n}\r\n\r\n/** @internal */\r\nexport enum AttachLayerButtonType {\r\n Primary,\r\n Blue,\r\n Icon\r\n}\r\nexport interface AttachLayerPopupButtonProps {\r\n isOverlay: boolean;\r\n buttonType?: AttachLayerButtonType;\r\n disabled?: boolean;\r\n}\r\n\r\n/** @internal */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport function AttachLayerPopupButton(props: AttachLayerPopupButtonProps) {\r\n const { showAttachLayerLabel, hideAttachLayerLabel, addCustomLayerButtonLabel } = React.useMemo(() => {\r\n return {\r\n showAttachLayerLabel: MapLayersUI.localization.getLocalizedString(\"mapLayers:AttachLayerPopup.Attach\"),\r\n hideAttachLayerLabel: MapLayersUI.localization.getLocalizedString(\"mapLayers:AttachLayerPopup.Close\"),\r\n addCustomLayerButtonLabel: MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.AddCustomLayerButtonLabel\"),\r\n };\r\n }, []);\r\n\r\n const [handleOutsideClick, setHandleOutsideClick] = React.useState(true);\r\n const [popupOpen, setPopupOpen] = React.useState(false);\r\n const buttonRef = React.useRef<HTMLButtonElement>(null);\r\n const panelRef = React.useRef<HTMLDivElement>(null);\r\n\r\n // 'isMounted' is used to prevent any async operation once the hook has been\r\n // unloaded. Otherwise we get a 'Can't perform a React state update on an unmounted component.' warning in the console.\r\n const isMounted = React.useRef(false);\r\n React.useEffect(() => {\r\n isMounted.current = true;\r\n return () => {\r\n isMounted.current = false;\r\n };\r\n }, []);\r\n\r\n const togglePopup = React.useCallback(() => {\r\n setPopupOpen(!popupOpen);\r\n }, [popupOpen]);\r\n\r\n const handleClosePopup = React.useCallback(() => {\r\n setPopupOpen(false);\r\n }, []);\r\n\r\n const onHandleOutsideClick = React.useCallback((event: MouseEvent) => {\r\n if (!handleOutsideClick) {\r\n return;\r\n }\r\n\r\n // If clicking on button that open panel - don't trigger outside click processing\r\n if (buttonRef?.current && buttonRef?.current.contains(event.target as Node)) {\r\n return;\r\n }\r\n\r\n // If clicking the panel, this is not an outside clicked\r\n if (panelRef.current && panelRef?.current.contains(event.target as Node)) {\r\n return;\r\n }\r\n\r\n // If we reach this point, we got an outside clicked, no close the popup\r\n setPopupOpen(false);\r\n\r\n }, [handleOutsideClick]);\r\n\r\n const { refreshFromStyle } = useSourceMapContext();\r\n\r\n const handleLayerAttached = React.useCallback(() => {\r\n if (!isMounted.current) {\r\n return;\r\n }\r\n setPopupOpen(false);\r\n refreshFromStyle();\r\n }, [refreshFromStyle]);\r\n\r\n function renderButton(): React.ReactNode {\r\n let button: React.ReactNode;\r\n\r\n if (props.buttonType === undefined || props.buttonType === AttachLayerButtonType.Icon) {\r\n button = (\r\n <IconButton disabled={props.disabled} size=\"small\" styleType=\"borderless\" ref={buttonRef} className=\"map-manager-attach-layer-button\" title={popupOpen ? hideAttachLayerLabel : showAttachLayerLabel}\r\n onClick={togglePopup}>\r\n <SvgAdd/>\r\n </IconButton>\r\n );\r\n } else {\r\n const determineStyleType = () => {\r\n switch (props.buttonType) {\r\n case AttachLayerButtonType.Blue:\r\n return \"high-visibility\";\r\n case AttachLayerButtonType.Primary:\r\n default:\r\n return \"cta\";\r\n }\r\n };\r\n const styleType = determineStyleType();\r\n button = (\r\n <Button disabled={props.disabled} ref={buttonRef} styleType={styleType} title={popupOpen ? hideAttachLayerLabel : showAttachLayerLabel}\r\n onClick={togglePopup}>{addCustomLayerButtonLabel}</Button>\r\n );\r\n }\r\n\r\n return button;\r\n }\r\n\r\n return (\r\n <>\r\n {renderButton()}\r\n <UiCore.Popup\r\n isOpen={popupOpen}\r\n position={RelativePosition.BottomRight}\r\n onClose={handleClosePopup}\r\n onOutsideClick={onHandleOutsideClick}\r\n closeOnWheel={false}\r\n target={buttonRef.current}\r\n closeOnEnter={false}\r\n closeOnContextMenu={false}\r\n >\r\n <div ref={panelRef} className=\"map-sources-popup-panel\" >\r\n <AttachLayerPanel\r\n isOverlay={props.isOverlay}\r\n onLayerAttached={handleLayerAttached}\r\n onHandleOutsideClick={setHandleOutsideClick} />\r\n </div>\r\n </UiCore.Popup >\r\n </>\r\n );\r\n}\r\n"]}
@@ -0,0 +1,11 @@
1
+ /// <reference types="react" />
2
+ import "./CustomParamEditDialog.scss";
3
+ import { CustomParamItem } from "../Interfaces";
4
+ interface CustomParamEditDialogProps {
5
+ item?: CustomParamItem;
6
+ onOkResult?: (newItem: CustomParamItem, oldIem?: CustomParamItem) => void;
7
+ onCancelResult?: () => void;
8
+ }
9
+ export declare function CustomParamEditDialog(props: CustomParamEditDialogProps): JSX.Element;
10
+ export {};
11
+ //# sourceMappingURL=CustomParamEditDialog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CustomParamEditDialog.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/CustomParamEditDialog.tsx"],"names":[],"mappings":";AAKA,OAAO,8BAA8B,CAAC;AAOtC,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD,UAAU,0BAA0B;IAClC,IAAI,CAAC,EAAE,eAAe,CAAC;IACvB,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,eAAe,EAAE,MAAM,CAAC,EAAE,eAAe,KAAK,IAAI,CAAC;IAC1E,cAAc,CAAC,EAAE,MAAM,IAAI,CAC1B;CACF;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,0BAA0B,eA8EtE"}
@@ -0,0 +1,53 @@
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ import "./CustomParamEditDialog.scss";
6
+ import * as React from "react";
7
+ import { UiFramework } from "@itwin/appui-react";
8
+ import { Dialog } from "@itwin/core-react";
9
+ import { Button, LabeledInput, ToggleSwitch } from "@itwin/itwinui-react";
10
+ import { CustomParamsStorage } from "../../CustomParamsStorage";
11
+ import { MapLayersUI } from "../../mapLayers";
12
+ // eslint-disable-next-line @typescript-eslint/naming-convention
13
+ export function CustomParamEditDialog(props) {
14
+ const [originalItemName] = React.useState(() => props.item ? props.item.name : undefined);
15
+ const [item, setItem] = React.useState(() => props.item ?? { name: "", key: "", value: "", secret: true });
16
+ const [cpStorage] = React.useState(() => new CustomParamsStorage());
17
+ const handleCancel = React.useCallback(() => {
18
+ if (props.onCancelResult) {
19
+ props.onCancelResult();
20
+ return;
21
+ }
22
+ UiFramework.dialogs.modal.close();
23
+ }, [props]);
24
+ const handleOk = React.useCallback(() => {
25
+ if (props.onOkResult) {
26
+ props.onOkResult(item, props.item);
27
+ return;
28
+ }
29
+ UiFramework.dialogs.modal.close();
30
+ }, [item, props]);
31
+ const nameAlreadyExists = React.useMemo(() => {
32
+ const itemExistInStorage = () => item.name ? !!cpStorage.get(item.name) : false;
33
+ return originalItemName ? originalItemName !== item.name && itemExistInStorage() : itemExistInStorage();
34
+ }, [cpStorage, item.name, originalItemName]);
35
+ const readyToSave = React.useCallback(() => {
36
+ return ((item.name.trim().length > 0) && (item.key.trim().length > 0) && (item.value.trim().length > 0) && !nameAlreadyExists);
37
+ }, [item.key, item.name, item.value, nameAlreadyExists]);
38
+ function renderFooter() {
39
+ return (React.createElement("div", { className: "custom-param-edit-dialog-footer" },
40
+ React.createElement("div", { className: "custom-param-edit-dialog-footer-buttons" },
41
+ React.createElement(Button, { className: "custom-param-edit-dialog-footer-button", styleType: 'high-visibility', onClick: handleOk, disabled: !readyToSave() }, props.item ? MapLayersUI.translate("Dialog.Edit") : MapLayersUI.translate("Dialog.Add")),
42
+ React.createElement(Button, { className: "custom-param-edit-dialog-footer-button", styleType: 'default', onClick: handleCancel }, MapLayersUI.translate("Dialog.Cancel")))));
43
+ }
44
+ return (React.createElement(Dialog, { title: MapLayersUI.translate(props.item ? "CustomParamEditDialog.DialogTitleEdit" : "CustomParamEditDialog.DialogTitleAdd"), opened: true, resizable: true, movable: true, modal: true, onClose: handleCancel, onEscape: handleCancel, minHeight: 120, maxWidth: 120, trapFocus: false },
45
+ React.createElement(React.Fragment, null,
46
+ React.createElement(LabeledInput, { className: "custom-param-edit-dialog-input", label: MapLayersUI.translate("CustomParamEditDialog.ParamNameLabel"), value: item.name, onChange: (event) => setItem({ ...item, name: event.target.value }), status: nameAlreadyExists ? "warning" : undefined, message: nameAlreadyExists ? MapLayersUI.translate("CustomParamEditDialog.NameExists") : undefined }),
47
+ React.createElement(LabeledInput, { className: "custom-param-edit-dialog-input", label: MapLayersUI.translate("CustomParamEditDialog.ParamKeyLabel"), value: item.key, onChange: (event) => setItem({ ...item, key: event.target.value }) }),
48
+ React.createElement(LabeledInput, { className: "custom-param-edit-dialog-input", label: MapLayersUI.translate("CustomParamEditDialog.ParamValueLabel"), type: item.secret ? "password" : "", value: item.value, onChange: (event) => setItem({ ...item, value: event.target.value }), message: !item.secret ? MapLayersUI.translate("CustomParamEditDialog.ParamValueNonPrivateMessage") : undefined }),
49
+ React.createElement("div", { className: "custom-param-edit-dialog-secret custom-param-edit-dialog-input", title: MapLayersUI.translate("CustomParamEditDialog.PrivateToggleTooltip") },
50
+ React.createElement(ToggleSwitch, { checked: item.secret, label: MapLayersUI.translate("CustomParamEditDialog.PrivateToggleLabel"), onChange: (event) => setItem({ ...item, secret: event.target.checked }) })),
51
+ renderFooter())));
52
+ }
53
+ //# sourceMappingUR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C,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAC,EAAE,CAAA,OAAO,CAAC,EAAC,GAAG,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,OAAO,EAAC,CAAC,GAAI,CACjL;YACL,YAAY,EAAE,CACd,CACI,CACV,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\nimport \"./CustomParamEditDialog.scss\";\nimport * as React from \"react\";\nimport { UiFramework } from \"@itwin/appui-react\";\nimport { Dialog } from \"@itwin/core-react\";\nimport { Button, LabeledInput, ToggleSwitch } from \"@itwin/itwinui-react\";\nimport { CustomParamsStorage } from \"../../CustomParamsStorage\";\nimport { MapLayersUI } from \"../../mapLayers\";\nimport { CustomParamItem } from \"../Interfaces\";\n\ninterface CustomParamEditDialogProps {\n item?: CustomParamItem;\n onOkResult?: (newItem: CustomParamItem, oldIem?: CustomParamItem) => void;\n onCancelResult?: () => void\n ;\n}\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function CustomParamEditDialog(props: CustomParamEditDialogProps) {\n const [originalItemName] = React.useState<string|undefined>(() => props.item ? props.item.name : undefined);\n const [item, setItem] = React.useState<CustomParamItem>(() => props.item ?? {name: \"\", key: \"\", value: \"\", secret: true});\n const [cpStorage] = React.useState(() => new CustomParamsStorage());\n\n const handleCancel = React.useCallback(() => {\n if (props.onCancelResult) {\n props.onCancelResult();\n return;\n }\n UiFramework.dialogs.modal.close();\n }, [props]);\n\n const handleOk = React.useCallback(() => {\n if (props.onOkResult) {\n props.onOkResult(item, props.item);\n return;\n }\n UiFramework.dialogs.modal.close();\n }, [item, props]);\n\n const nameAlreadyExists = React.useMemo<boolean>(() => {\n const itemExistInStorage = () => item.name ? !!cpStorage.get(item.name) : false;\n return originalItemName ? originalItemName !== item.name && itemExistInStorage() : itemExistInStorage();\n }, [cpStorage, item.name, originalItemName]);\n\n const readyToSave = React.useCallback(() => {\n return ((item.name.trim().length > 0) && (item.key.trim().length > 0) && (item.value.trim().length > 0) && !nameAlreadyExists );\n }, [item.key, item.name, item.value, nameAlreadyExists]);\n\n function renderFooter() {\n\n return (\n <div className=\"custom-param-edit-dialog-footer\">\n <div className=\"custom-param-edit-dialog-footer-buttons\">\n <Button\n className=\"custom-param-edit-dialog-footer-button\"\n styleType='high-visibility'\n onClick={handleOk}\n disabled={!readyToSave()}\n >\n {props.item ? MapLayersUI.translate(\"Dialog.Edit\") : MapLayersUI.translate(\"Dialog.Add\")}\n </Button>\n <Button\n className=\"custom-param-edit-dialog-footer-button\"\n styleType='default'\n onClick={handleCancel}\n >\n {MapLayersUI.translate(\"Dialog.Cancel\")}\n </Button>\n </div>\n </div>\n );\n }\n return (\n <Dialog\n title={MapLayersUI.translate(props.item ? \"CustomParamEditDialog.DialogTitleEdit\": \"CustomParamEditDialog.DialogTitleAdd\")}\n opened={true}\n resizable={true}\n movable={true}\n modal={true}\n onClose={handleCancel}\n onEscape={handleCancel}\n minHeight={120}\n maxWidth={120}\n trapFocus={false}\n >\n <>\n <LabeledInput className=\"custom-param-edit-dialog-input\" label={MapLayersUI.translate(\"CustomParamEditDialog.ParamNameLabel\")} value={item.name} onChange={(event)=>setItem({...item, name: event.target.value})} status={nameAlreadyExists ? \"warning\" : undefined} message={nameAlreadyExists ? MapLayersUI.translate(\"CustomParamEditDialog.NameExists\"): undefined}/>\n <LabeledInput className=\"custom-param-edit-dialog-input\" label={MapLayersUI.translate(\"CustomParamEditDialog.ParamKeyLabel\")} value={item.key} onChange={(event)=>setItem({...item, key: event.target.value})} />\n <LabeledInput className=\"custom-param-edit-dialog-input\"label={MapLayersUI.translate(\"CustomParamEditDialog.ParamValueLabel\")} type={item.secret ? \"password\" : \"\"} value={item.value} onChange={(event)=>setItem({...item, value: event.target.value}) } message={!item.secret ? MapLayersUI.translate(\"CustomParamEditDialog.ParamValueNonPrivateMessage\"): undefined}/>\n <div className=\"custom-param-edit-dialog-secret custom-param-edit-dialog-input\" title={MapLayersUI.translate(\"CustomParamEditDialog.PrivateToggleTooltip\")}>\n <ToggleSwitch checked={item.secret} label={MapLayersUI.translate(\"CustomParamEditDialog.PrivateToggleLabel\")} onChange={(event)=>setItem({...item, secret: event.target.checked})} />\n </div>\n {renderFooter()}\n </>\n </Dialog>\n );\n}\n"]}
@@ -0,0 +1,26 @@
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+
6
+
7
+ .custom-param-edit-dialog-secret {
8
+ margin-top: 10px;
9
+ }
10
+
11
+ .custom-param-edit-dialog-footer {
12
+ display: flex;
13
+ margin-top: 15px;
14
+ }
15
+
16
+ .custom-param-edit-dialog-footer-buttons {
17
+ margin-left: auto;
18
+ }
19
+
20
+ .custom-param-edit-dialog-footer-button {
21
+ margin-left: 5px;
22
+ }
23
+
24
+ .custom-param-edit-dialog-input {
25
+ margin-bottom: 5px;
26
+ }
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import "./CustomParamsSettings.scss";
3
+ export declare function CustomParamsSettingsPanel(): JSX.Element;
4
+ //# sourceMappingURL=CustomParamsSettings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CustomParamsSettings.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/CustomParamsSettings.tsx"],"names":[],"mappings":";AAKA,OAAO,6BAA6B,CAAC;AAiBrC,wBAAgB,yBAAyB,gBAuJxC"}
@@ -0,0 +1,112 @@
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ import "./CustomParamsSettings.scss";
6
+ import * as React from "react";
7
+ import { UiFramework } from "@itwin/appui-react";
8
+ import { Listbox, ListboxItem } from "@itwin/core-react";
9
+ import { SvgTechnicalPreviewMini } from "@itwin/itwinui-icons-color-react";
10
+ import { SvgAdd, SvgDelete, SvgEdit } from "@itwin/itwinui-icons-react";
11
+ import { Icon, IconButton } from "@itwin/itwinui-react";
12
+ import { CustomParamsMappingStorage } from "../../CustomParamsMappingStorage";
13
+ import { CustomParamsStorage } from "../../CustomParamsStorage";
14
+ import { MapLayersUI } from "../../mapLayers";
15
+ import { CustomParamEditDialog } from "./CustomParamEditDialog";
16
+ // eslint-disable-next-line @typescript-eslint/naming-convention
17
+ export function CustomParamsSettingsPanel() {
18
+ const [storage] = React.useState(() => new CustomParamsStorage());
19
+ const [mappingStorage] = React.useState(() => new CustomParamsMappingStorage());
20
+ const [params, setParams] = React.useState(() => {
21
+ const paramsMap = {};
22
+ const paramsList = storage.get(undefined);
23
+ if (paramsList) {
24
+ for (const param of paramsList)
25
+ paramsMap[param.name] = param;
26
+ }
27
+ return paramsMap;
28
+ });
29
+ const [listItemUnderCursor, setListItemUnderCursor] = React.useState();
30
+ const [selectedValue, setSelectedValue] = React.useState();
31
+ const deleteMapping = React.useCallback((name) => {
32
+ const tmpParams = { ...params };
33
+ delete tmpParams[name];
34
+ setParams(tmpParams);
35
+ storage.delete(name);
36
+ // Cascade delete to api key mapping
37
+ const mappingContent = mappingStorage.getContent();
38
+ if (mappingContent) {
39
+ for (const itemKey of Object.keys(mappingContent)) {
40
+ if (mappingContent[itemKey].customParamNames.includes(name)) {
41
+ const newParamNames = mappingContent[itemKey].customParamNames.filter((value) => value !== name);
42
+ newParamNames.length > 0 ? mappingStorage.save(itemKey, { customParamNames: newParamNames }) : mappingStorage.delete(itemKey);
43
+ }
44
+ }
45
+ }
46
+ }, [mappingStorage, params, storage]);
47
+ /*
48
+ Handle Remove layer button clicked
49
+ */
50
+ const onItemRemoveButtonClicked = React.useCallback((name, event) => {
51
+ event.stopPropagation(); // We don't want the owning ListBox to react on mouse click.
52
+ deleteMapping(name);
53
+ }, [deleteMapping]);
54
+ const onCancelEdit = React.useCallback(() => {
55
+ UiFramework.dialogs.modal.close();
56
+ setSelectedValue(undefined); // clear listbox focus
57
+ }, []);
58
+ const onOkEdit = React.useCallback((newItem, oldItem) => {
59
+ UiFramework.dialogs.modal.close();
60
+ // If the edited item has a new name, delete the entry first.
61
+ const tmpParams = { ...params };
62
+ if (oldItem && oldItem.name !== newItem.name) {
63
+ delete tmpParams[oldItem.name];
64
+ setParams(tmpParams);
65
+ storage.delete(oldItem.name);
66
+ const mappingContent = mappingStorage.getContent();
67
+ if (mappingContent) {
68
+ for (const itemKey of Object.keys(mappingContent)) {
69
+ if (mappingContent[itemKey].customParamNames.includes(oldItem.name)) {
70
+ const newParamNames = mappingContent[itemKey].customParamNames.filter((value) => value !== oldItem.name);
71
+ newParamNames.push(newItem.name);
72
+ mappingStorage.save(itemKey, { customParamNames: newParamNames });
73
+ }
74
+ }
75
+ }
76
+ }
77
+ storage.save(newItem.name, newItem);
78
+ tmpParams[newItem.name] = newItem;
79
+ setParams(tmpParams);
80
+ setSelectedValue(undefined); // clear listbox focus
81
+ }, [mappingStorage, params, storage]);
82
+ const handleAddClick = React.useCallback(() => {
83
+ UiFramework.dialogs.modal.open(React.createElement(CustomParamEditDialog, { onOkResult: onOkEdit, onCancelResult: onCancelEdit }));
84
+ return;
85
+ }, [onCancelEdit, onOkEdit]);
86
+ const onListboxValueChange = React.useCallback((newValue, _isControlOrCommandPressed) => {
87
+ const item = params[newValue];
88
+ if (item)
89
+ UiFramework.dialogs.modal.open(React.createElement(CustomParamEditDialog, { item: item, onOkResult: onOkEdit, onCancelResult: onCancelEdit }));
90
+ setSelectedValue(newValue);
91
+ return;
92
+ }, [params, onCancelEdit, onOkEdit]);
93
+ return (React.createElement("div", { className: "customParamsSettings-container" },
94
+ React.createElement("div", { className: "customParamsSettings-header" },
95
+ React.createElement("span", { className: "customParamsSettings-header-label" },
96
+ MapLayersUI.translate("CustomParamSettings.SectionLabel"),
97
+ React.createElement("div", { title: MapLayersUI.translate("Labels.TechPreviewBadgeTooltip"), className: "customParamsSettings-previewBadge" },
98
+ React.createElement(Icon, { size: "small" },
99
+ React.createElement(SvgTechnicalPreviewMini, null)))),
100
+ React.createElement(IconButton, { size: "small", styleType: "borderless", className: "customParamsSettings-header-add-button", onClick: handleAddClick },
101
+ React.createElement(SvgAdd, null))),
102
+ React.createElement("div", { className: "customParamsSettings-content" },
103
+ React.createElement(Listbox, { selectedValue: selectedValue, onListboxValueChange: onListboxValueChange, className: "customParamsSettings-content-listbox" }, Object.keys(params).map((keyName) => React.createElement(ListboxItem, { key: keyName, className: "customParamsSettings-content-entry", value: keyName, onMouseEnter: () => setListItemUnderCursor(keyName), onMouseLeave: () => setListItemUnderCursor(undefined) },
104
+ React.createElement("span", { className: "customParamsSettings-content-entry-name", title: keyName }, keyName),
105
+ (listItemUnderCursor && listItemUnderCursor === keyName) &&
106
+ React.createElement(React.Fragment, null,
107
+ React.createElement(IconButton, { size: "small", styleType: "borderless", className: "map-source-list-entry-button", title: MapLayersUI.translate("CustomParamSettings.EditButtonTitle") },
108
+ React.createElement(SvgEdit, null)),
109
+ React.createElement(IconButton, { size: "small", styleType: "borderless", className: "customParamsSettings-content-entry-button", title: MapLayersUI.translate("CustomParamSettings.DeleteButtonTitle"), onClick: (event) => { onItemRemoveButtonClicked(keyName, event); } },
110
+ React.createElement(SvgDelete, null)))))))));
111
+ }
112
+ //# sourceMappingURL=CustomParamsSettings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CustomParamsSettings.js","sourceRoot":"","sources":["../../../../src/ui/widget/CustomParamsSettings.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,OAAO,6BAA6B,CAAC;AACrC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,WAAW,EAAgB,MAAM,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,oBAAC,SAAS,OAAE,CACD,CACZ,CACO,CACf,CAEK,CACN,CACF,CACP,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\nimport \"./CustomParamsSettings.scss\";\nimport * as React from \"react\";\nimport { UiFramework } from \"@itwin/appui-react\";\nimport { Listbox, ListboxItem, ListboxValue } from \"@itwin/core-react\";\nimport { SvgTechnicalPreviewMini } from \"@itwin/itwinui-icons-color-react\";\nimport { SvgAdd, SvgDelete, SvgEdit } from \"@itwin/itwinui-icons-react\";\nimport { Icon, IconButton } from \"@itwin/itwinui-react\";\nimport { CustomParamsMappingStorage } from \"../../CustomParamsMappingStorage\";\nimport { CustomParamsStorage } from \"../../CustomParamsStorage\";\nimport { MapLayersUI } from \"../../mapLayers\";\nimport { CustomParamItem } from \"../Interfaces\";\nimport { CustomParamEditDialog } from \"./CustomParamEditDialog\";\n\ninterface CustomParamsMap {\n [paramName: string]: CustomParamItem;\n}\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function CustomParamsSettingsPanel() {\n\n const [storage] = React.useState(() => new CustomParamsStorage());\n const [mappingStorage] = React.useState(() => new CustomParamsMappingStorage());\n\n const [params, setParams] = React.useState<CustomParamsMap>(() => {\n const paramsMap: CustomParamsMap ={};\n const paramsList = storage.get(undefined);\n if (paramsList) {\n for (const param of paramsList)\n paramsMap[param.name] = param;\n }\n return paramsMap;\n });\n\n const [listItemUnderCursor, setListItemUnderCursor] = React.useState<string | undefined>();\n const [selectedValue, setSelectedValue] = React.useState<string | undefined>();\n\n const deleteMapping = React.useCallback((name: string) => {\n const tmpParams = {...params};\n delete tmpParams[name];\n setParams(tmpParams);\n storage.delete(name);\n\n // Cascade delete to api key mapping\n const mappingContent = mappingStorage.getContent();\n if (mappingContent) {\n for (const itemKey of Object.keys(mappingContent)) {\n if (mappingContent[itemKey].customParamNames.includes(name)) {\n const newParamNames = mappingContent[itemKey].customParamNames.filter((value) => value !== name);\n newParamNames.length > 0 ? mappingStorage.save(itemKey, {customParamNames: newParamNames}) : mappingStorage.delete(itemKey);\n }\n }\n }\n }, [mappingStorage, params, storage]);\n\n /*\n Handle Remove layer button clicked\n */\n const onItemRemoveButtonClicked = React.useCallback((name: string, event) => {\n event.stopPropagation(); // We don't want the owning ListBox to react on mouse click.\n deleteMapping(name);\n }, [deleteMapping]);\n\n const onCancelEdit = React.useCallback(() => {\n UiFramework.dialogs.modal.close();\n setSelectedValue(undefined); // clear listbox focus\n }, []);\n\n const onOkEdit = React.useCallback((newItem: CustomParamItem, oldItem?: CustomParamItem) => {\n\n UiFramework.dialogs.modal.close();\n\n // If the edited item has a new name, delete the entry first.\n const tmpParams = {...params};\n if (oldItem && oldItem.name !== newItem.name) {\n delete tmpParams[oldItem.name];\n setParams(tmpParams);\n storage.delete(oldItem.name);\n\n const mappingContent = mappingStorage.getContent();\n if (mappingContent) {\n for (const itemKey of Object.keys(mappingContent)) {\n if (mappingContent[itemKey].customParamNames.includes(oldItem.name )) {\n const newParamNames = mappingContent[itemKey].customParamNames.filter((value) => value !== oldItem.name);\n newParamNames.push(newItem.name);\n mappingStorage.save(itemKey, {customParamNames: newParamNames});\n }\n }\n }\n }\n storage.save(newItem.name, newItem);\n\n tmpParams[newItem.name] = newItem;\n setParams(tmpParams);\n setSelectedValue(undefined); // clear listbox focus\n }, [mappingStorage, params, storage]);\n\n const handleAddClick = React.useCallback(() => {\n UiFramework.dialogs.modal.open(\n <CustomParamEditDialog\n onOkResult={onOkEdit}\n onCancelResult={onCancelEdit}\n />);\n return;\n }, [onCancelEdit, onOkEdit]);\n\n const onListboxValueChange = React.useCallback((newValue: ListboxValue, _isControlOrCommandPressed?: boolean)=> {\n const item = params[newValue];\n if (item)\n UiFramework.dialogs.modal.open(<CustomParamEditDialog item={item} onOkResult={onOkEdit} onCancelResult={onCancelEdit}/>);\n\n setSelectedValue(newValue);\n return;\n }, [params, onCancelEdit, onOkEdit]);\n\n return (\n <div className=\"customParamsSettings-container\">\n <div className=\"customParamsSettings-header\">\n <span className=\"customParamsSettings-header-label\">\n {MapLayersUI.translate(\"CustomParamSettings.SectionLabel\")}\n <div title={MapLayersUI.translate(\"Labels.TechPreviewBadgeTooltip\")} className=\"customParamsSettings-previewBadge\">\n <Icon size=\"small\"><SvgTechnicalPreviewMini /></Icon>\n </div>\n </span>\n\n <IconButton size=\"small\" styleType=\"borderless\" className=\"customParamsSettings-header-add-button\" onClick={handleAddClick}>\n <SvgAdd/>\n </IconButton>\n </div>\n <div className=\"customParamsSettings-content\">\n <Listbox\n selectedValue={selectedValue}\n onListboxValueChange={onListboxValueChange}\n className=\"customParamsSettings-content-listbox\" >\n {\n Object.keys(params).map((keyName) =>\n <ListboxItem\n key={keyName}\n className=\"customParamsSettings-content-entry\"\n value={keyName}\n onMouseEnter={() => setListItemUnderCursor(keyName)}\n onMouseLeave={() => setListItemUnderCursor(undefined)}\n >\n <span className=\"customParamsSettings-content-entry-name\" title={keyName}>{keyName}</span>\n { // Display the delete icon only when the mouse over a specific item otherwise list feels cluttered.\n (listItemUnderCursor && listItemUnderCursor === keyName) &&\n <>\n <IconButton\n size=\"small\"\n styleType=\"borderless\"\n className=\"map-source-list-entry-button\"\n title={MapLayersUI.translate(\"CustomParamSettings.EditButtonTitle\")}>\n <SvgEdit/>\n </IconButton>\n <IconButton\n size=\"small\"\n styleType=\"borderless\"\n className=\"customParamsSettings-content-entry-button\"\n title={MapLayersUI.translate(\"CustomParamSettings.DeleteButtonTitle\")}\n onClick={(event) => {onItemRemoveButtonClicked(keyName, event);}}>\n <SvgDelete/>\n </IconButton>\n </>}\n </ListboxItem>\n )\n }\n </Listbox>\n </div>\n </div>\n );\n}\n"]}
@@ -0,0 +1,67 @@
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+
6
+
7
+ .customParamsSettings-previewBadge {
8
+ margin-left: 4px;
9
+ display:inline;
10
+ vertical-align: middle;
11
+ }
12
+
13
+
14
+ button.customParamsSettings-button {
15
+ font-size: 12px;
16
+ }
17
+
18
+ .customParamsSettings-header {
19
+ display: flex;
20
+ align-content: center;
21
+ margin-top: 8px;
22
+ margin-bottom: 8px;
23
+ }
24
+
25
+ .customParamsSettings-container {
26
+ margin-top: 1rem;
27
+ border: 1px solid #ccc;
28
+ margin-bottom: 15px;
29
+
30
+ .customParamsSettings-header-label {
31
+ width: auto;
32
+ white-space: nowrap;
33
+ flex: 1 1 auto;
34
+ padding-left: 10px;
35
+ }
36
+
37
+ button.customParamsSettings-header-add-button {
38
+ margin-right: 2px;
39
+ }
40
+
41
+ .customParamsSettings-content {
42
+ height: 100px;
43
+ min-height: 60px;
44
+ border-top: 1px solid #ccc;
45
+
46
+ .customParamsSettings-content-listbox {
47
+ margin-top: 0;
48
+ border: none;
49
+ }
50
+
51
+ .customParamsSettings-content-entry {
52
+ margin-left: 4px;
53
+
54
+ button.customParamsSettings-content-entry-button {
55
+ height: auto;
56
+ padding: 0 4px 0 4px;
57
+ }
58
+ .customParamsSettings-content-entry-name {
59
+ flex: 1 1 auto;
60
+ text-overflow: ellipsis;
61
+ white-space: nowrap;
62
+ overflow: hidden;
63
+ margin-right: 4px;
64
+ }
65
+ }
66
+ }
67
+ }
@@ -1,12 +1,12 @@
1
1
  /// <reference types="react" />
2
- import { ScreenViewport } from "@itwin/core-frontend";
3
- import { MapTypesOptions, StyleMapLayerSettings } from "../Interfaces";
4
2
  import "./MapLayerManager.scss";
3
+ import { ScreenViewport } from "@itwin/core-frontend";
4
+ import { MapLayerOptions, StyleMapLayerSettings } from "../Interfaces";
5
5
  /** @internal */
6
6
  interface MapLayerDroppableProps {
7
7
  isOverlay: boolean;
8
8
  layersList?: StyleMapLayerSettings[];
9
- mapTypesOptions?: MapTypesOptions;
9
+ mapLayerOptions?: MapLayerOptions;
10
10
  getContainerForClone: () => HTMLElement;
11
11
  activeViewport: ScreenViewport;
12
12
  onMenuItemSelected: (action: string, mapLayerSettings: StyleMapLayerSettings) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"MapLayerDroppable.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/MapLayerDroppable.tsx"],"names":[],"mappings":";AAWA,OAAO,EAAyI,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAO7L,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAGvE,OAAO,wBAAwB,CAAC;AAIhC,gBAAgB;AAChB,UAAU,sBAAsB;IAC9B,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,qBAAqB,EAAE,CAAC;IACrC,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,oBAAoB,EAAE,MAAM,WAAW,CAAC;IACxC,cAAc,EAAE,cAAc,CAAC;IAC/B,kBAAkB,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,qBAAqB,KAAK,IAAI,CAAC;IACtF,6BAA6B,EAAE,CAAC,gBAAgB,EAAE,qBAAqB,KAAK,IAAI,CAAC;IACjF,cAAc,EAAE,CAAC,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5D,YAAY,EAAE,MAAO,IAAI,CAAC;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAOD,gBAAgB;AAEhB,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,eAmL9D"}
1
+ {"version":3,"file":"MapLayerDroppable.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/MapLayerDroppable.tsx"],"names":[],"mappings":";AASA,OAAO,wBAAwB,CAAC;AAMhC,OAAO,EAEL,cAAc,EACf,MAAM,sBAAsB,CAAC;AAI9B,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,M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