@open-pioneer/coordinate-search 0.8.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.
- package/CHANGELOG.md +30 -0
- package/CoordinateInput.d.ts +86 -0
- package/CoordinateInput.js +218 -0
- package/CoordinateInput.js.map +1 -0
- package/CoordinateInputField.d.ts +10 -0
- package/CoordinateInputField.js +92 -0
- package/CoordinateInputField.js.map +1 -0
- package/CoordinateSearch.d.ts +26 -0
- package/CoordinateSearch.js +47 -0
- package/CoordinateSearch.js.map +1 -0
- package/LICENSE +202 -0
- package/ProjectionSelect.d.ts +7 -0
- package/ProjectionSelect.js +112 -0
- package/ProjectionSelect.js.map +1 -0
- package/README.md +147 -0
- package/_virtual/_virtual-pioneer-module_react-hooks.js +8 -0
- package/_virtual/_virtual-pioneer-module_react-hooks.js.map +1 -0
- package/coordinates.d.ts +13 -0
- package/coordinates.js +73 -0
- package/coordinates.js.map +1 -0
- package/i18n/de.yaml +14 -0
- package/i18n/en.yaml +14 -0
- package/index.d.ts +2 -0
- package/index.js +3 -0
- package/index.js.map +1 -0
- package/package.json +55 -0
- package/usePlaceholder.d.ts +7 -0
- package/usePlaceholder.js +27 -0
- package/usePlaceholder.js.map +1 -0
package/package.json
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "module",
|
|
3
|
+
"name": "@open-pioneer/coordinate-search",
|
|
4
|
+
"version": "0.8.0",
|
|
5
|
+
"description": "This package provides a UI component to search for entered coordinates in the choosen projection.",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"open-pioneer-trails"
|
|
8
|
+
],
|
|
9
|
+
"homepage": "https://github.com/open-pioneer",
|
|
10
|
+
"license": "Apache-2.0",
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "https://github.com/open-pioneer/trails-openlayers-base-packages",
|
|
14
|
+
"directory": "src/packages/coordinate-search"
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@conterra/reactivity-core": "^0.4.3",
|
|
18
|
+
"@open-pioneer/core": "^2.4.0",
|
|
19
|
+
"@open-pioneer/chakra-integration": "^2.4.0",
|
|
20
|
+
"@open-pioneer/runtime": "^2.4.0",
|
|
21
|
+
"@open-pioneer/react-utils": "^2.4.0",
|
|
22
|
+
"@open-pioneer/reactivity": "^2.4.0",
|
|
23
|
+
"chakra-react-select": "^5.0.2",
|
|
24
|
+
"@chakra-ui/icons": "^2.2.4",
|
|
25
|
+
"ol": "^10.2.1",
|
|
26
|
+
"react": "^18.3.1",
|
|
27
|
+
"@open-pioneer/map": "^0.8.0"
|
|
28
|
+
},
|
|
29
|
+
"exports": {
|
|
30
|
+
"./package.json": "./package.json",
|
|
31
|
+
".": {
|
|
32
|
+
"import": "./index.js",
|
|
33
|
+
"types": "./index.d.ts"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"openPioneerFramework": {
|
|
37
|
+
"services": [],
|
|
38
|
+
"i18n": {
|
|
39
|
+
"languages": [
|
|
40
|
+
"en",
|
|
41
|
+
"de"
|
|
42
|
+
]
|
|
43
|
+
},
|
|
44
|
+
"ui": {
|
|
45
|
+
"references": [
|
|
46
|
+
{
|
|
47
|
+
"type": "unique",
|
|
48
|
+
"interfaceName": "runtime.NumberParserService"
|
|
49
|
+
}
|
|
50
|
+
]
|
|
51
|
+
},
|
|
52
|
+
"properties": [],
|
|
53
|
+
"packageFormatVersion": "1.0.0"
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Coordinate } from "ol/coordinate";
|
|
2
|
+
import { Projection } from "ol/proj";
|
|
3
|
+
import { ProjectionItem } from "./CoordinateInput";
|
|
4
|
+
/**
|
|
5
|
+
* Returns the current placeholder string.
|
|
6
|
+
*/
|
|
7
|
+
export declare function usePlaceholder(placeholderProp: string | Coordinate, mapProjection: Projection | undefined, selectedProjection: ProjectionItem): string;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { transform } from 'ol/proj.js';
|
|
2
|
+
import { useIntl } from './_virtual/_virtual-pioneer-module_react-hooks.js';
|
|
3
|
+
import { useMemo } from 'react';
|
|
4
|
+
import { formatCoordinates } from './coordinates.js';
|
|
5
|
+
|
|
6
|
+
function usePlaceholder(placeholderProp, mapProjection, selectedProjection) {
|
|
7
|
+
const intl = useIntl();
|
|
8
|
+
return useMemo(() => {
|
|
9
|
+
let placeholder;
|
|
10
|
+
if (typeof placeholderProp === "string") {
|
|
11
|
+
placeholder = placeholderProp;
|
|
12
|
+
} else if (!mapProjection) {
|
|
13
|
+
placeholder = "";
|
|
14
|
+
} else {
|
|
15
|
+
const coords = transform(
|
|
16
|
+
placeholderProp,
|
|
17
|
+
mapProjection,
|
|
18
|
+
selectedProjection.value
|
|
19
|
+
);
|
|
20
|
+
placeholder = formatCoordinates(coords, selectedProjection.precision, intl);
|
|
21
|
+
}
|
|
22
|
+
return placeholder;
|
|
23
|
+
}, [placeholderProp, mapProjection, selectedProjection, intl]);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export { usePlaceholder };
|
|
27
|
+
//# sourceMappingURL=usePlaceholder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePlaceholder.js","sources":["usePlaceholder.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { Coordinate } from \"ol/coordinate\";\nimport { Projection, transform } from \"ol/proj\";\nimport { useIntl } from \"open-pioneer:react-hooks\";\nimport { useMemo } from \"react\";\nimport { ProjectionItem } from \"./CoordinateInput\";\nimport { formatCoordinates } from \"./coordinates\";\n\n/**\n * Returns the current placeholder string.\n */\n//In a different file for HMR.\nexport function usePlaceholder(\n placeholderProp: string | Coordinate,\n mapProjection: Projection | undefined,\n selectedProjection: ProjectionItem\n) {\n const intl = useIntl();\n\n return useMemo(() => {\n let placeholder: string;\n if (typeof placeholderProp === \"string\") {\n placeholder = placeholderProp;\n } else if (!mapProjection) {\n placeholder = \"\";\n } else {\n const coords = transform(\n placeholderProp as Coordinate,\n mapProjection,\n selectedProjection.value\n );\n placeholder = formatCoordinates(coords, selectedProjection.precision, intl);\n }\n return placeholder;\n }, [placeholderProp, mapProjection, selectedProjection, intl]);\n}\n"],"names":[],"mappings":";;;;;AAagB,SAAA,cAAA,CACZ,eACA,EAAA,aAAA,EACA,kBACF,EAAA;AACE,EAAA,MAAM,OAAO,OAAQ,EAAA,CAAA;AAErB,EAAA,OAAO,QAAQ,MAAM;AACjB,IAAI,IAAA,WAAA,CAAA;AACJ,IAAI,IAAA,OAAO,oBAAoB,QAAU,EAAA;AACrC,MAAc,WAAA,GAAA,eAAA,CAAA;AAAA,KAClB,MAAA,IAAW,CAAC,aAAe,EAAA;AACvB,MAAc,WAAA,GAAA,EAAA,CAAA;AAAA,KACX,MAAA;AACH,MAAA,MAAM,MAAS,GAAA,SAAA;AAAA,QACX,eAAA;AAAA,QACA,aAAA;AAAA,QACA,kBAAmB,CAAA,KAAA;AAAA,OACvB,CAAA;AACA,MAAA,WAAA,GAAc,iBAAkB,CAAA,MAAA,EAAQ,kBAAmB,CAAA,SAAA,EAAW,IAAI,CAAA,CAAA;AAAA,KAC9E;AACA,IAAO,OAAA,WAAA,CAAA;AAAA,KACR,CAAC,eAAA,EAAiB,aAAe,EAAA,kBAAA,EAAoB,IAAI,CAAC,CAAA,CAAA;AACjE;;;;"}
|