@open-pioneer/selection 1.3.0-dev.20260207195315 → 1.3.0-dev.20260211111005
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -2
- package/Selection.js.map +1 -1
- package/package.json +10 -10
- package/selection.css +0 -4
- package/selection.css.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
# @open-pioneer/selection
|
|
2
2
|
|
|
3
|
-
## 1.3.0-dev.
|
|
3
|
+
## 1.3.0-dev.20260211111005
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 9b5d5f3: Support for new common container props (role, aria-_, data-_ and css)
|
|
8
|
+
- d54ccfd: Update to Chakra UI 3.32.0
|
|
4
9
|
|
|
5
10
|
### Patch Changes
|
|
6
11
|
|
|
12
|
+
- Updated dependencies [9b5d5f3]
|
|
7
13
|
- Updated dependencies [2ceb1ca]
|
|
14
|
+
- Updated dependencies [d54ccfd]
|
|
8
15
|
- Updated dependencies [4bcc8ce]
|
|
9
16
|
- Updated dependencies [2ceb1ca]
|
|
10
|
-
- @open-pioneer/map@1.3.0-dev.
|
|
17
|
+
- @open-pioneer/map@1.3.0-dev.20260211111005
|
|
11
18
|
|
|
12
19
|
## 1.2.0
|
|
13
20
|
|
package/Selection.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Selection.js","sources":["Selection.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport {\n Box,\n chakra,\n createListCollection,\n Flex,\n Icon,\n Portal,\n Select,\n VStack\n} from \"@chakra-ui/react\";\nimport { Tooltip } from \"@open-pioneer/chakra-snippets/tooltip\";\nimport { MapModel, MapModelProps, useMapModelValue } from \"@open-pioneer/map\";\nimport { NotificationService } from \"@open-pioneer/notifier\";\nimport { CommonComponentProps, useCommonComponentProps, useEvent } from \"@open-pioneer/react-utils\";\nimport { useReactiveSnapshot } from \"@open-pioneer/reactivity\";\nimport { PackageIntl } from \"@open-pioneer/runtime\";\nimport { Geometry } from \"ol/geom\";\nimport { useIntl, useService } from \"open-pioneer:react-hooks\";\nimport { FC, useCallback, useEffect, useRef, useState } from \"react\";\nimport { LuTriangleAlert } from \"react-icons/lu\";\nimport { DragController } from \"./DragController\";\nimport { SelectionController } from \"./SelectionController\";\nimport { SelectionResult, SelectionSource, SelectionSourceStatusObject } from \"./api\";\n\n/**\n * Properties supported by the {@link Selection} component.\n */\nexport interface SelectionProps extends CommonComponentProps, MapModelProps {\n /**\n * Array of selection sources available for spatial selection.\n */\n sources: SelectionSource[];\n\n /**\n * This handler is called whenever the user has successfully selected\n * some items.\n */\n onSelectionComplete?(event: SelectionCompleteEvent): void;\n\n /**\n * This handler is called whenever the user has changed the selected source\n */\n onSelectionSourceChanged?(event: SelectionSourceChangedEvent): void;\n}\n\nexport interface SelectionCompleteEvent {\n /** The source that returned the {@link results}. */\n source: SelectionSource;\n\n /** Results selected by the user. */\n results: SelectionResult[];\n}\n\nexport interface SelectionSourceChangedEvent {\n /** The new selected source */\n source: SelectionSource | undefined;\n}\n\n/**\n * A component that allows the user to perform a spatial selection on a given set of {@link SelectionSource}.\n */\nexport const Selection: FC<SelectionProps> = (props) => {\n const intl = useIntl();\n const { sources, onSelectionComplete, onSelectionSourceChanged } = props;\n const { containerProps } = useCommonComponentProps(\"selection\", props);\n\n const [currentSource, setCurrentSource] = useCurrentSelectionSource(\n sources,\n onSelectionSourceChanged\n );\n\n const currentSourceStatus = useSourceStatus(currentSource);\n\n const map = useMapModelValue(props);\n const { onExtentSelected } = useSelectionController(\n map,\n sources,\n currentSource,\n onSelectionComplete\n );\n\n const isActive = currentSourceStatus.kind === \"available\";\n const hasSelectedSource = !!currentSource;\n\n const dragController = useDragSelection(\n map,\n intl,\n onExtentSelected,\n isActive,\n hasSelectedSource\n );\n const dragTooltip = useReactiveSnapshot(() => dragController?.tooltipText, [dragController]);\n\n const getId = useSelectionSourceId();\n\n const sourceOptionsCollection = createListCollection({\n items: sources,\n isItemDisabled: () => {\n return false;\n },\n itemToString: (item) => item.label,\n itemToValue: (item) => getId(item)\n });\n\n let triggerItem;\n if (currentSource) {\n triggerItem = <SelectionSourceItem source={currentSource} />;\n } else {\n triggerItem = null;\n }\n\n return (\n <VStack {...containerProps} gap={2}>\n <Select.Root\n className=\"selection-source\"\n collection={sourceOptionsCollection}\n value={currentSource ? [getId(currentSource)] : undefined}\n onValueChange={(option) => option && setCurrentSource(option.items[0])}\n lazyMount={true}\n unmountOnExit={true}\n >\n <Select.Label>{intl.formatMessage({ id: \"selectSource\" })}</Select.Label>\n\n <Select.Control>\n <Select.Trigger aria-description={dragTooltip}>\n <Select.ValueText\n placeholder={intl.formatMessage({ id: \"selectionPlaceholder\" })}\n >\n {triggerItem}\n </Select.ValueText>\n </Select.Trigger>\n <Select.IndicatorGroup>\n <Select.Indicator />\n </Select.IndicatorGroup>\n </Select.Control>\n\n <Portal>\n <Select.Positioner>\n <Select.Content className=\"selection-source-options\">\n {sourceOptionsCollection.items.map((item) => (\n <SelectionSourceItemContent item={item} key={getId(item)} />\n ))}\n </Select.Content>\n </Select.Positioner>\n </Portal>\n </Select.Root>\n </VStack>\n );\n};\n\ntype GetSelectionSourceId = (selectionSource: SelectionSource) => string;\n\n/**\n * Assigns unique IDs to selection sources.\n */\nfunction useSelectionSourceId(): GetSelectionSourceId {\n const sourceIds = useRef<WeakMap<SelectionSource, string>>(undefined);\n const counter = useRef(0);\n if (!sourceIds.current) {\n sourceIds.current = new WeakMap();\n }\n\n return useCallback((selectionSource: SelectionSource) => {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const ids = sourceIds.current!;\n if (!ids.has(selectionSource)) {\n ids.set(selectionSource, `source-${counter.current++}`);\n }\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return ids.get(selectionSource)!;\n }, []);\n}\n\nfunction SelectionSourceItemContent(props: { item: SelectionSource }) {\n const { item } = props;\n\n const isDisabled = useSourceStatus(item).kind === \"unavailable\";\n\n return (\n <Select.Item\n className=\"selection-source-option\"\n item={item}\n justifyContent=\"flex-start\"\n // Override pointer-events: none rule for disabled items; we want to show the tooltip on hover\n pointerEvents=\"auto\"\n aria-disabled={isDisabled ? \"true\" : undefined}\n >\n <SelectionSourceItem source={item} />\n </Select.Item>\n );\n}\n\nfunction useCurrentSelectionSource(\n sources: SelectionSource[],\n onSourceChanged: ((event: SelectionSourceChangedEvent) => void) | undefined\n): [SelectionSource | undefined, (source: SelectionSource | undefined) => void] {\n const [currentSource, setCurrentSource] = useState<SelectionSource | undefined>(\n () => sources[0]\n );\n\n // Reset to undefined if the current source is not in the list of sources\n useEffect(() => {\n if (currentSource && !sources.includes(currentSource)) {\n setCurrentSource(undefined);\n }\n }, [sources, currentSource]);\n\n // Track the current source and notify the parent component if it changes\n const prevSelectedSource = useRef<SelectionSource | undefined>(undefined);\n useEffect(() => {\n if (currentSource !== prevSelectedSource.current) {\n prevSelectedSource.current = currentSource;\n onSourceChanged?.({ source: currentSource });\n }\n }, [currentSource, onSourceChanged]);\n return [currentSource, setCurrentSource];\n}\n\n/**\n * Hook to manage source option in selection-source react-select\n */\nfunction SelectionSourceItem(props: { source: SelectionSource | undefined }) {\n const source = props.source;\n const label: string | undefined = source?.label;\n const status = useSourceStatus(source);\n const isAvailable = status.kind === \"available\";\n const clazz = isAvailable\n ? \"selection-source-value\"\n : \"selection-source-value selection-source-value--disabled\";\n\n return (\n <Flex className={clazz} direction=\"row\" alignItems=\"center\" grow={1}>\n {label}\n {status.kind === \"unavailable\" && (\n <Box ml={2}>\n <Tooltip\n content={status.reason}\n positioning={{ placement: \"right\" }}\n openDelay={500}\n >\n <chakra.span>\n <Icon\n color=\"red\"\n className=\"warning-icon\"\n aria-label={status.reason}\n aria-hidden={undefined} // Overwrite icon default so the label gets read\n >\n <LuTriangleAlert />\n </Icon>\n </chakra.span>\n </Tooltip>\n </Box>\n )}\n </Flex>\n );\n}\n\n/**\n * Hook to manage selection controller\n */\nfunction useSelectionController(\n mapModel: MapModel,\n sources: SelectionSource[],\n currentSource: SelectionSource | undefined,\n onSelectionComplete: ((event: SelectionCompleteEvent) => void) | undefined\n) {\n const notifier = useService<NotificationService>(\"notifier.NotificationService\");\n const intl = useIntl();\n const [controller, setController] = useState<SelectionController | undefined>(undefined);\n useEffect(() => {\n const controller = new SelectionController({\n mapModel,\n onError() {\n notifier.notify({\n level: \"error\",\n message: intl.formatMessage({ id: \"selectionFailed\" })\n });\n }\n });\n setController(controller);\n return () => {\n controller.destroy();\n };\n }, [mapModel, notifier, sources, intl]);\n\n const onExtentSelected = useEvent(async (geometry: Geometry) => {\n if (!controller || !currentSource) {\n return;\n }\n\n const selectionResult = await controller.select(currentSource, geometry.getExtent());\n if (!selectionResult) {\n return;\n }\n\n onSelectionComplete?.(selectionResult);\n });\n return {\n controller,\n onExtentSelected\n };\n}\n\ntype SimpleStatus =\n | {\n kind: \"available\";\n }\n | {\n kind: \"unavailable\";\n reason: string;\n };\n\nfunction getSourceStatus(source: SelectionSource, sourceNotAvailableReason: string): SimpleStatus {\n const rawCurrent = source.status ?? \"available\";\n const current: SelectionSourceStatusObject =\n typeof rawCurrent === \"string\" ? { kind: rawCurrent } : rawCurrent;\n if (current.kind === \"available\") {\n return current;\n }\n\n return {\n kind: \"unavailable\",\n reason: current.reason ?? sourceNotAvailableReason\n };\n}\n\n/**\n * Hook to manage source status\n */\nfunction useSourceStatus(source: SelectionSource | undefined): SimpleStatus {\n const intl = useIntl();\n const defaultNotAvailableMessage = intl.formatMessage({ id: \"sourceNotAvailable\" });\n const sourceStatus = useReactiveSnapshot((): SimpleStatus => {\n if (!source) {\n return { kind: \"unavailable\", reason: defaultNotAvailableMessage };\n }\n return getSourceStatus(source, defaultNotAvailableMessage);\n }, [source, defaultNotAvailableMessage]);\n return sourceStatus;\n}\n\n/**\n * Hook to manage map controls and tooltip\n */\nfunction useDragSelection(\n map: MapModel,\n intl: PackageIntl,\n onExtentSelected: (geometry: Geometry) => void,\n isActive: boolean,\n hasSelectedSource: boolean\n): DragController | undefined {\n const [controller, setController] = useState<DragController | undefined>();\n useEffect(() => {\n const disabledMessage = hasSelectedSource\n ? intl.formatMessage({ id: \"disabledTooltip\" })\n : intl.formatMessage({ id: \"noSourceTooltip\" });\n\n const dragController = new DragController(\n map.olMap,\n intl.formatMessage({ id: \"tooltip\" }),\n disabledMessage,\n onExtentSelected\n );\n\n dragController.setActive(isActive);\n setController(dragController);\n return () => {\n setController(undefined);\n dragController.destroy();\n };\n }, [map, intl, onExtentSelected, isActive, hasSelectedSource]);\n return controller;\n}\n"],"names":["controller"],"mappings":";;;;;;;;;;;;AA+DO,MAAM,SAAA,GAAgC,CAAC,KAAA,KAAU;AACpD,EAAA,MAAM,OAAO,OAAA,EAAQ;AACrB,EAAA,MAAM,EAAE,OAAA,EAAS,mBAAA,EAAqB,wBAAA,EAAyB,GAAI,KAAA;AACnE,EAAA,MAAM,EAAE,cAAA,EAAe,GAAI,uBAAA,CAAwB,aAAa,KAAK,CAAA;AAErE,EAAA,MAAM,CAAC,aAAA,EAAe,gBAAgB,CAAA,GAAI,yBAAA;AAAA,IACtC,OAAA;AAAA,IACA;AAAA,GACJ;AAEA,EAAA,MAAM,mBAAA,GAAsB,gBAAgB,aAAa,CAAA;AAEzD,EAAA,MAAM,GAAA,GAAM,iBAAiB,KAAK,CAAA;AAClC,EAAA,MAAM,EAAE,kBAAiB,GAAI,sBAAA;AAAA,IACzB,GAAA;AAAA,IACA,OAAA;AAAA,IACA,aAAA;AAAA,IACA;AAAA,GACJ;AAEA,EAAA,MAAM,QAAA,GAAW,oBAAoB,IAAA,KAAS,WAAA;AAC9C,EAAA,MAAM,iBAAA,GAAoB,CAAC,CAAC,aAAA;AAE5B,EAAA,MAAM,cAAA,GAAiB,gBAAA;AAAA,IACnB,GAAA;AAAA,IACA,IAA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AAA,CAAI,KAAA;AAAA,MACJ,IAAA,CAAK,aAAA,CAAc,EAAE,EAAA,EAAI,WAAW,CAAA;AAAA,MACpC,eAAA;AAAA,MACA;AAAA,KACJ;AAEA,IAAA,cAAA,CAAe,UAAU,QAAQ,CAAA;AACjC,IAAA,aAAA,CAAc,cAAc,CAAA;AAC5B,IAAA,OAAO,MAAM;AACT,MAAA,aAAA,CAAc,MAAS,CAAA;AACvB,MAAA,cAAA,CAAe,OAAA,EAAQ;AAAA,IAC3B,CAAA;AAAA,EACJ,GAAG,CAAC,GAAA,EAAK,MAAM,gBAAA,EAAkB,QAAA,EAAU,iBAAiB,CAAC,CAAA;AAC7D,EAAA,OAAO,UAAA;AACX;;;;"}
|
|
1
|
+
{"version":3,"file":"Selection.js","sources":["Selection.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport {\n Box,\n chakra,\n createListCollection,\n Flex,\n Icon,\n Portal,\n Select,\n VStack\n} from \"@chakra-ui/react\";\nimport { Tooltip } from \"@open-pioneer/chakra-snippets/tooltip\";\nimport { MapModel, MapModelProps, useMapModelValue } from \"@open-pioneer/map\";\nimport { NotificationService } from \"@open-pioneer/notifier\";\nimport { CommonComponentProps, useCommonComponentProps, useEvent } from \"@open-pioneer/react-utils\";\nimport { useReactiveSnapshot } from \"@open-pioneer/reactivity\";\nimport { PackageIntl } from \"@open-pioneer/runtime\";\nimport { Geometry } from \"ol/geom\";\nimport { useIntl, useService } from \"open-pioneer:react-hooks\";\nimport { FC, useCallback, useEffect, useRef, useState } from \"react\";\nimport { LuTriangleAlert } from \"react-icons/lu\";\nimport { DragController } from \"./DragController\";\nimport { SelectionController } from \"./SelectionController\";\nimport { SelectionResult, SelectionSource, SelectionSourceStatusObject } from \"./api\";\n\n/**\n * Properties supported by the {@link Selection} component.\n */\nexport interface SelectionProps extends CommonComponentProps, MapModelProps {\n /**\n * Array of selection sources available for spatial selection.\n */\n sources: SelectionSource[];\n\n /**\n * This handler is called whenever the user has successfully selected\n * some items.\n */\n onSelectionComplete?(event: SelectionCompleteEvent): void;\n\n /**\n * This handler is called whenever the user has changed the selected source\n */\n onSelectionSourceChanged?(event: SelectionSourceChangedEvent): void;\n}\n\nexport interface SelectionCompleteEvent {\n /** The source that returned the {@link results}. */\n source: SelectionSource;\n\n /** Results selected by the user. */\n results: SelectionResult[];\n}\n\nexport interface SelectionSourceChangedEvent {\n /** The new selected source */\n source: SelectionSource | undefined;\n}\n\n/**\n * A component that allows the user to perform a spatial selection on a given set of {@link SelectionSource}.\n */\nexport const Selection: FC<SelectionProps> = (props) => {\n const intl = useIntl();\n const { sources, onSelectionComplete, onSelectionSourceChanged } = props;\n const { containerProps } = useCommonComponentProps(\"selection\", props);\n\n const [currentSource, setCurrentSource] = useCurrentSelectionSource(\n sources,\n onSelectionSourceChanged\n );\n\n const currentSourceStatus = useSourceStatus(currentSource);\n\n const map = useMapModelValue(props);\n const { onExtentSelected } = useSelectionController(\n map,\n sources,\n currentSource,\n onSelectionComplete\n );\n\n const isActive = currentSourceStatus.kind === \"available\";\n const hasSelectedSource = !!currentSource;\n\n const dragController = useDragSelection(\n map,\n intl,\n onExtentSelected,\n isActive,\n hasSelectedSource\n );\n const dragTooltip = useReactiveSnapshot(() => dragController?.tooltipText, [dragController]);\n\n const getId = useSelectionSourceId();\n\n const sourceOptionsCollection = createListCollection({\n items: sources,\n isItemDisabled: () => {\n return false;\n },\n itemToString: (item) => item.label,\n itemToValue: (item) => getId(item)\n });\n\n let triggerItem;\n if (currentSource) {\n triggerItem = <SelectionSourceItem source={currentSource} />;\n } else {\n triggerItem = null;\n }\n\n return (\n <VStack {...containerProps} gap={2}>\n <Select.Root\n className=\"selection-source\"\n collection={sourceOptionsCollection}\n value={currentSource ? [getId(currentSource)] : undefined}\n onValueChange={(option) => option && setCurrentSource(option.items[0])}\n lazyMount={true}\n unmountOnExit={true}\n >\n <Select.Label>{intl.formatMessage({ id: \"selectSource\" })}</Select.Label>\n\n <Select.Control>\n <Select.Trigger aria-description={dragTooltip}>\n <Select.ValueText\n placeholder={intl.formatMessage({ id: \"selectionPlaceholder\" })}\n >\n {triggerItem}\n </Select.ValueText>\n </Select.Trigger>\n <Select.IndicatorGroup>\n <Select.Indicator />\n </Select.IndicatorGroup>\n </Select.Control>\n\n <Portal>\n <Select.Positioner>\n <Select.Content className=\"selection-source-options\">\n {sourceOptionsCollection.items.map((item) => (\n <SelectionSourceItemContent item={item} key={getId(item)} />\n ))}\n </Select.Content>\n </Select.Positioner>\n </Portal>\n </Select.Root>\n </VStack>\n );\n};\n\ntype GetSelectionSourceId = (selectionSource: SelectionSource) => string;\n\n/**\n * Assigns unique IDs to selection sources.\n */\nfunction useSelectionSourceId(): GetSelectionSourceId {\n const sourceIds = useRef<WeakMap<SelectionSource, string>>(undefined);\n const counter = useRef(0);\n if (!sourceIds.current) {\n sourceIds.current = new WeakMap();\n }\n\n return useCallback((selectionSource: SelectionSource) => {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const ids = sourceIds.current!;\n if (!ids.has(selectionSource)) {\n ids.set(selectionSource, `source-${counter.current++}`);\n }\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return ids.get(selectionSource)!;\n }, []);\n}\n\nfunction SelectionSourceItemContent(props: { item: SelectionSource }) {\n const { item } = props;\n\n const isDisabled = useSourceStatus(item).kind === \"unavailable\";\n\n return (\n <Select.Item\n className=\"selection-source-option\"\n item={item}\n justifyContent=\"flex-start\"\n // Override pointer-events: none rule for disabled items; we want to show the tooltip on hover\n pointerEvents=\"auto\"\n aria-disabled={isDisabled ? \"true\" : undefined}\n >\n <SelectionSourceItem source={item} />\n </Select.Item>\n );\n}\n\nfunction useCurrentSelectionSource(\n sources: SelectionSource[],\n onSourceChanged: ((event: SelectionSourceChangedEvent) => void) | undefined\n): [SelectionSource | undefined, (source: SelectionSource | undefined) => void] {\n const [currentSource, setCurrentSource] = useState<SelectionSource | undefined>(\n () => sources[0]\n );\n\n // Reset to undefined if the current source is not in the list of sources\n useEffect(() => {\n if (currentSource && !sources.includes(currentSource)) {\n setCurrentSource(undefined);\n }\n }, [sources, currentSource]);\n\n // Track the current source and notify the parent component if it changes\n const prevSelectedSource = useRef<SelectionSource | undefined>(undefined);\n useEffect(() => {\n if (currentSource !== prevSelectedSource.current) {\n prevSelectedSource.current = currentSource;\n onSourceChanged?.({ source: currentSource });\n }\n }, [currentSource, onSourceChanged]);\n return [currentSource, setCurrentSource];\n}\n\nfunction SelectionSourceItem(props: { source: SelectionSource | undefined }) {\n const source = props.source;\n const label: string | undefined = source?.label;\n const status = useSourceStatus(source);\n const isAvailable = status.kind === \"available\";\n const clazz = isAvailable\n ? \"selection-source-value\"\n : \"selection-source-value selection-source-value--disabled\";\n\n return (\n <Flex className={clazz} direction=\"row\" alignItems=\"center\" grow={1}>\n {label}\n {status.kind === \"unavailable\" && (\n <Box ml={2}>\n <Tooltip\n content={status.reason}\n positioning={{ placement: \"right\" }}\n openDelay={500}\n >\n <chakra.span>\n <Icon\n color=\"red\"\n className=\"warning-icon\"\n aria-label={status.reason}\n aria-hidden={undefined} // Overwrite icon default so the label gets read\n >\n <LuTriangleAlert />\n </Icon>\n </chakra.span>\n </Tooltip>\n </Box>\n )}\n </Flex>\n );\n}\n\n/**\n * Hook to manage selection controller\n */\nfunction useSelectionController(\n mapModel: MapModel,\n sources: SelectionSource[],\n currentSource: SelectionSource | undefined,\n onSelectionComplete: ((event: SelectionCompleteEvent) => void) | undefined\n) {\n const notifier = useService<NotificationService>(\"notifier.NotificationService\");\n const intl = useIntl();\n const [controller, setController] = useState<SelectionController | undefined>(undefined);\n useEffect(() => {\n const controller = new SelectionController({\n mapModel,\n onError() {\n notifier.notify({\n level: \"error\",\n message: intl.formatMessage({ id: \"selectionFailed\" })\n });\n }\n });\n setController(controller);\n return () => {\n controller.destroy();\n };\n }, [mapModel, notifier, sources, intl]);\n\n const onExtentSelected = useEvent(async (geometry: Geometry) => {\n if (!controller || !currentSource) {\n return;\n }\n\n const selectionResult = await controller.select(currentSource, geometry.getExtent());\n if (!selectionResult) {\n return;\n }\n\n onSelectionComplete?.(selectionResult);\n });\n return {\n controller,\n onExtentSelected\n };\n}\n\ntype SimpleStatus =\n | {\n kind: \"available\";\n }\n | {\n kind: \"unavailable\";\n reason: string;\n };\n\nfunction getSourceStatus(source: SelectionSource, sourceNotAvailableReason: string): SimpleStatus {\n const rawCurrent = source.status ?? \"available\";\n const current: SelectionSourceStatusObject =\n typeof rawCurrent === \"string\" ? { kind: rawCurrent } : rawCurrent;\n if (current.kind === \"available\") {\n return current;\n }\n\n return {\n kind: \"unavailable\",\n reason: current.reason ?? sourceNotAvailableReason\n };\n}\n\n/**\n * Hook to manage source status\n */\nfunction useSourceStatus(source: SelectionSource | undefined): SimpleStatus {\n const intl = useIntl();\n const defaultNotAvailableMessage = intl.formatMessage({ id: \"sourceNotAvailable\" });\n const sourceStatus = useReactiveSnapshot((): SimpleStatus => {\n if (!source) {\n return { kind: \"unavailable\", reason: defaultNotAvailableMessage };\n }\n return getSourceStatus(source, defaultNotAvailableMessage);\n }, [source, defaultNotAvailableMessage]);\n return sourceStatus;\n}\n\n/**\n * Hook to manage map controls and tooltip\n */\nfunction useDragSelection(\n map: MapModel,\n intl: PackageIntl,\n onExtentSelected: (geometry: Geometry) => void,\n isActive: boolean,\n hasSelectedSource: boolean\n): DragController | undefined {\n const [controller, setController] = useState<DragController | undefined>();\n useEffect(() => {\n const disabledMessage = hasSelectedSource\n ? intl.formatMessage({ id: \"disabledTooltip\" })\n : intl.formatMessage({ id: \"noSourceTooltip\" });\n\n const dragController = new DragController(\n map.olMap,\n intl.formatMessage({ id: \"tooltip\" }),\n disabledMessage,\n onExtentSelected\n );\n\n dragController.setActive(isActive);\n setController(dragController);\n return () => {\n setController(undefined);\n dragController.destroy();\n };\n }, [map, intl, onExtentSelected, isActive, hasSelectedSource]);\n return controller;\n}\n"],"names":["controller"],"m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1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "@open-pioneer/selection",
|
|
4
|
-
"version": "1.3.0-dev.
|
|
4
|
+
"version": "1.3.0-dev.20260211111005",
|
|
5
5
|
"description": "This package provides a UI component to perform a selection on given selection sources from the map.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"open-pioneer-trails"
|
|
@@ -14,20 +14,20 @@
|
|
|
14
14
|
"directory": "src/packages/selection"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@chakra-ui/react": "^3.
|
|
18
|
-
"@open-pioneer/core": "
|
|
19
|
-
"@open-pioneer/notifier": "
|
|
20
|
-
"@open-pioneer/react-utils": "
|
|
21
|
-
"@open-pioneer/runtime": "
|
|
17
|
+
"@chakra-ui/react": "^3.32.0",
|
|
18
|
+
"@open-pioneer/core": "4.5.0-dev.20260211105402",
|
|
19
|
+
"@open-pioneer/notifier": "4.5.0-dev.20260211105402",
|
|
20
|
+
"@open-pioneer/react-utils": "4.5.0-dev.20260211105402",
|
|
21
|
+
"@open-pioneer/runtime": "4.5.0-dev.20260211105402",
|
|
22
22
|
"classnames": "^2.5.1",
|
|
23
23
|
"ol": "^10.7.0",
|
|
24
|
-
"react": "^19.2.
|
|
24
|
+
"react": "^19.2.4",
|
|
25
25
|
"react-icons": "^5.5.0",
|
|
26
26
|
"uuid": "^13.0.0",
|
|
27
27
|
"@conterra/reactivity-core": "^0.8.1",
|
|
28
|
-
"@open-pioneer/reactivity": "
|
|
29
|
-
"@open-pioneer/chakra-snippets": "
|
|
30
|
-
"@open-pioneer/map": "1.3.0-dev.
|
|
28
|
+
"@open-pioneer/reactivity": "4.5.0-dev.20260211105402",
|
|
29
|
+
"@open-pioneer/chakra-snippets": "4.5.0-dev.20260211105402",
|
|
30
|
+
"@open-pioneer/map": "1.3.0-dev.20260211111005"
|
|
31
31
|
},
|
|
32
32
|
"exports": {
|
|
33
33
|
"./package.json": "./package.json",
|
package/selection.css
CHANGED
package/selection.css.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["selection.css"],"names":[],"mappings":"AAAA;IACI,qDAAqD;IACrD,8DAA8D;AAClE;;AAEA;IACI,kBAAkB;IAClB,oCAAoC;IACpC,kBAAkB;IAClB,YAAY;IACZ,gBAAgB;IAChB,UAAU;IACV,mBAAmB;IACnB,eAAe;IACf,eAAe;IACf,iBAAiB;IACjB,iBAAiB;AACrB;;AAEA;IACI,
|
|
1
|
+
{"version":3,"sources":["selection.css"],"names":[],"mappings":"AAAA;IACI,qDAAqD;IACrD,8DAA8D;AAClE;;AAEA;IACI,kBAAkB;IAClB,oCAAoC;IACpC,kBAAkB;IAClB,YAAY;IACZ,gBAAgB;IAChB,UAAU;IACV,mBAAmB;IACnB,eAAe;IACf,eAAe;IACf,iBAAiB;IACjB,iBAAiB;AACrB;;AAEA;IACI,iBAAiB;AACrB;;AAEA;IACI,eAAe;AACnB;;AAEA;IACI,YAAY;AAChB;;AAEA;IACI,uBAAuB;AAC3B","file":"selection.css","sourcesContent":[".selection-drag-box {\n background-color: rgba(255, 255, 255, 0.3) !important;\n border: 3px solid var(--chakra-colors-trails-solid) !important;\n}\n\n.selection-tooltip {\n position: relative;\n background: rgba(255, 255, 255, 0.8);\n border-radius: 4px;\n color: black;\n padding: 4px 8px;\n opacity: 1;\n white-space: nowrap;\n font-size: 12px;\n cursor: default;\n user-select: none;\n font-weight: bold;\n}\n\n.map-container .selection-active {\n cursor: crosshair;\n}\n\n.map-container .selection-inactive {\n cursor: no-drop;\n}\n\n.selection-source-value.selection-source-value--disabled {\n opacity: 0.4;\n}\n\n.selection-source-value.selection-source-value--disabled span {\n margin: 0px 6px 0px 0px;\n}\n"]}
|