@itwin/map-layers 3.5.0-dev.4 → 3.5.0-dev.41

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 (29) hide show
  1. package/CHANGELOG.md +40 -1
  2. package/lib/cjs/public/locales/en/mapLayers.json +1 -0
  3. package/lib/cjs/ui/widget/MapLayerDroppable.js +1 -1
  4. package/lib/cjs/ui/widget/MapLayerDroppable.js.map +1 -1
  5. package/lib/cjs/ui/widget/MapLayerManager.scss +22 -1
  6. package/lib/cjs/ui/widget/MapUrlDialog.d.ts +1 -0
  7. package/lib/cjs/ui/widget/MapUrlDialog.d.ts.map +1 -1
  8. package/lib/cjs/ui/widget/MapUrlDialog.js +4 -12
  9. package/lib/cjs/ui/widget/MapUrlDialog.js.map +1 -1
  10. package/lib/cjs/ui/widget/MapUrlDialog.scss +15 -2
  11. package/lib/cjs/ui/widget/SelectMapFormat.d.ts +19 -0
  12. package/lib/cjs/ui/widget/SelectMapFormat.d.ts.map +1 -0
  13. package/lib/cjs/ui/widget/SelectMapFormat.js +60 -0
  14. package/lib/cjs/ui/widget/SelectMapFormat.js.map +1 -0
  15. package/lib/esm/public/locales/en/mapLayers.json +1 -0
  16. package/lib/esm/ui/widget/MapLayerDroppable.js +1 -1
  17. package/lib/esm/ui/widget/MapLayerDroppable.js.map +1 -1
  18. package/lib/esm/ui/widget/MapLayerManager.scss +22 -1
  19. package/lib/esm/ui/widget/MapUrlDialog.d.ts +1 -0
  20. package/lib/esm/ui/widget/MapUrlDialog.d.ts.map +1 -1
  21. package/lib/esm/ui/widget/MapUrlDialog.js +5 -13
  22. package/lib/esm/ui/widget/MapUrlDialog.js.map +1 -1
  23. package/lib/esm/ui/widget/MapUrlDialog.scss +15 -2
  24. package/lib/esm/ui/widget/SelectMapFormat.d.ts +19 -0
  25. package/lib/esm/ui/widget/SelectMapFormat.d.ts.map +1 -0
  26. package/lib/esm/ui/widget/SelectMapFormat.js +56 -0
  27. package/lib/esm/ui/widget/SelectMapFormat.js.map +1 -0
  28. package/lib/public/locales/en/mapLayers.json +1 -0
  29. package/package.json +27 -26
@@ -0,0 +1,19 @@
1
+ /// <reference types="react" />
2
+ import { MapTypesOptions } from "../Interfaces";
3
+ import "./MapUrlDialog.scss";
4
+ export declare const MAP_TYPES: {
5
+ wms: string;
6
+ arcGis: string;
7
+ wmts: string;
8
+ tileUrl: string;
9
+ arcGisFeature: string;
10
+ };
11
+ interface SelectMapFormatProps {
12
+ value?: string;
13
+ disabled?: boolean;
14
+ mapTypesOptions?: MapTypesOptions;
15
+ onChange?: (mapType: string) => void;
16
+ }
17
+ export declare function SelectMapFormat(props: SelectMapFormatProps): JSX.Element;
18
+ export {};
19
+ //# sourceMappingURL=SelectMapFormat.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SelectMapFormat.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/SelectMapFormat.tsx"],"names":[],"mappings":";AAQA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,qBAAqB,CAAC;AAS7B,eAAO,MAAM,SAAS;;;;;;CAMrB,CAAC;AAEF,UAAU,oBAAoB;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CACtC;AAGD,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,eAkD1D"}
@@ -0,0 +1,56 @@
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
+ // cSpell:ignore Modeless WMTS
6
+ import { IconButton, MenuItem, Select } from "@itwin/itwinui-react";
7
+ import * as React from "react";
8
+ import "./MapUrlDialog.scss";
9
+ import { SvgTechnicalPreviewMini } from "@itwin/itwinui-icons-color-react";
10
+ import { MapLayersUI } from "../../mapLayers";
11
+ import { IModelApp } from "@itwin/core-frontend";
12
+ // TODO:
13
+ // Remove this structure and iterate over the registry's active formats.
14
+ // Still need a proper way to exclude some format, like we currently do with
15
+ // 'TileUrl' without the need to hardcode any format Id.
16
+ export const MAP_TYPES = {
17
+ wms: "WMS",
18
+ arcGis: "ArcGIS",
19
+ wmts: "WMTS",
20
+ tileUrl: "TileURL",
21
+ arcGisFeature: "ArcGISFeature",
22
+ };
23
+ // eslint-disable-next-line @typescript-eslint/naming-convention
24
+ export function SelectMapFormat(props) {
25
+ var _a;
26
+ const [mapFormat, setMapFormat] = React.useState((_a = props.value) !== null && _a !== void 0 ? _a : MAP_TYPES.arcGis);
27
+ const [techPreviewTooltip] = React.useState(MapLayersUI.localization.getLocalizedString("mapLayers:CustomAttach.TechPreviewBadgeTooltip"));
28
+ const [mapFormats] = React.useState(() => {
29
+ var _a;
30
+ const formats = [
31
+ { value: MAP_TYPES.arcGis, label: MAP_TYPES.arcGis },
32
+ { value: MAP_TYPES.wms, label: MAP_TYPES.wms },
33
+ { value: MAP_TYPES.wmts, label: MAP_TYPES.wmts },
34
+ ];
35
+ if ((_a = props.mapTypesOptions) === null || _a === void 0 ? void 0 : _a.supportTileUrl)
36
+ formats.push({ value: MAP_TYPES.tileUrl, label: MAP_TYPES.tileUrl });
37
+ if (IModelApp.mapLayerFormatRegistry.isRegistered(MAP_TYPES.arcGisFeature))
38
+ formats.push({ value: MAP_TYPES.arcGisFeature, label: MAP_TYPES.arcGisFeature, id: "techPreview" });
39
+ return formats;
40
+ });
41
+ const handleOnChange = React.useCallback((value) => {
42
+ setMapFormat(value);
43
+ if (props.onChange) {
44
+ props.onChange(value);
45
+ }
46
+ }, [props]);
47
+ return (React.createElement(Select, { className: "map-layer-source-select", options: mapFormats, value: mapFormat, disabled: props.disabled, onChange: handleOnChange, size: "small", itemRenderer: (option) => {
48
+ var _a;
49
+ return (React.createElement(MenuItem, { badge: ((_a = option.id) === null || _a === void 0 ? void 0 : _a.includes("techPreview")) ?
50
+ React.createElement("div", { title: techPreviewTooltip },
51
+ React.createElement(IconButton, { className: "map-layer-source-select-previewBadge", size: "small" },
52
+ React.createElement(SvgTechnicalPreviewMini, null)))
53
+ : undefined }, option.label));
54
+ } }));
55
+ }
56
+ //# sourceMappingURL=SelectMapFormat.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SelectMapFormat.js","sourceRoot":"","sources":["../../../../src/ui/widget/SelectMapFormat.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,8BAA8B;AAE9B,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAgB,MAAM,sBAAsB,CAAC;AAClF,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,qBAAqB,CAAC;AAC7B,OAAO,EAAC,uBAAuB,EAAC,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,QAAQ;AACR,wEAAwE;AACxE,4EAA4E;AAC5E,wDAAwD;AACxD,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,GAAG,EAAE,KAAK;IACV,MAAM,EAAE,QAAQ;IAChB,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,SAAS;IAClB,aAAa,EAAE,eAAe;CAC/B,CAAC;AASF,gEAAgE;AAChE,MAAM,UAAU,eAAe,CAAC,KAA2B;;IAEzD,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,MAAA,KAAK,CAAC,KAAK,mCAAI,SAAS,CAAC,MAAM,CAAC,CAAC;IAClF,MAAM,CAAC,kBAAkB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC,YAAY,CAAC,kBAAkB,CAAC,gDA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AQ,EAAE,cAAc,EACxB,IAAI,EAAC,OAAO,EACZ,YAAY,EACV,CAAC,MAAM,EAAE,EAAE;;YAAC,OAAA,CACV,oBAAC,QAAQ,IACP,KAAK,EAAE,CAAA,MAAA,MAAM,CAAC,EAAE,0CAAE,QAAQ,CAAC,aAAa,CAAC,EAAC,CAAC;oBACzC,6BAAK,KAAK,EAAE,kBAAkB;wBAC5B,oBAAC,UAAU,IAAC,SAAS,EAAC,sCAAsC,EAAE,IAAI,EAAC,OAAO;4BACxE,oBAAC,uBAAuB,OAAG,CAChB,CACT;oBACN,CAAC,CAAC,SAAS,IACZ,MAAM,CAAC,KAAK,CACJ,CAAC,CAAA;SAAA,GAChB,CACH,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\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\n// cSpell:ignore Modeless WMTS\r\n\r\nimport { IconButton, MenuItem, Select, SelectOption } from \"@itwin/itwinui-react\";\r\nimport * as React from \"react\";\r\nimport { MapTypesOptions } from \"../Interfaces\";\r\nimport \"./MapUrlDialog.scss\";\r\nimport {SvgTechnicalPreviewMini} from \"@itwin/itwinui-icons-color-react\";\r\nimport { MapLayersUI } from \"../../mapLayers\";\r\nimport { IModelApp } from \"@itwin/core-frontend\";\r\n\r\n// TODO:\r\n// Remove this structure and iterate over the registry's active formats.\r\n// Still need a proper way to exclude some format, like we currently do with\r\n// 'TileUrl' without the need to hardcode any format Id.\r\nexport const MAP_TYPES = {\r\n wms: \"WMS\",\r\n arcGis: \"ArcGIS\",\r\n wmts: \"WMTS\",\r\n tileUrl: \"TileURL\",\r\n arcGisFeature: \"ArcGISFeature\",\r\n};\r\n\r\ninterface SelectMapFormatProps {\r\n value?: string;\r\n disabled?: boolean;\r\n mapTypesOptions?: MapTypesOptions;\r\n onChange?: (mapType: string) => void;\r\n}\r\n\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport function SelectMapFormat(props: SelectMapFormatProps) {\r\n\r\n const [mapFormat, setMapFormat] = React.useState(props.value ?? MAP_TYPES.arcGis);\r\n const [techPreviewTooltip] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.TechPreviewBadgeTooltip\"));\r\n\r\n const [mapFormats] = React.useState((): SelectOption<string>[] => {\r\n const formats: SelectOption<string>[] = [\r\n { value: MAP_TYPES.arcGis, label: MAP_TYPES.arcGis },\r\n { value: MAP_TYPES.wms, label: MAP_TYPES.wms },\r\n { value: MAP_TYPES.wmts, label: MAP_TYPES.wmts },\r\n ];\r\n if (props.mapTypesOptions?.supportTileUrl)\r\n formats.push({ value: MAP_TYPES.tileUrl, label: MAP_TYPES.tileUrl });\r\n\r\n if (IModelApp.mapLayerFormatRegistry.isRegistered(MAP_TYPES.arcGisFeature))\r\n formats.push( { value: MAP_TYPES.arcGisFeature, label: MAP_TYPES.arcGisFeature, id:\"techPreview\" });\r\n\r\n return formats;\r\n });\r\n\r\n const handleOnChange = React.useCallback((value: string) => {\r\n setMapFormat(value);\r\n if (props.onChange) {\r\n props.onChange(value);\r\n }\r\n }, [props]);\r\n\r\n return (\r\n\r\n <Select\r\n className=\"map-layer-source-select\"\r\n options={mapFormats}\r\n value={mapFormat}\r\n disabled={props.disabled}\r\n onChange={handleOnChange}\r\n size=\"small\"\r\n itemRenderer={\r\n (option) => (\r\n <MenuItem\r\n badge={option.id?.includes(\"techPreview\") ?\r\n <div title={techPreviewTooltip}>\r\n <IconButton className=\"map-layer-source-select-previewBadge\" size=\"small\">\r\n <SvgTechnicalPreviewMini />\r\n </IconButton>\r\n </div>\r\n : undefined}>\r\n {option.label}\r\n </MenuItem>) }\r\n />\r\n );\r\n}\r\n"]}
@@ -46,6 +46,7 @@
46
46
  "SearchPlaceholder": "Search...",
47
47
  "StoreOnModelSettings": "Store on Model Settings",
48
48
  "StoreOnITwinSettings": "Store on iTwin Settings",
49
+ "TechPreviewBadgeTooltip": "Technology preview",
49
50
  "Type": "Type",
50
51
  "URL": "URL",
51
52
  "UrlInputPlaceHolder": "Enter Map Source URL",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itwin/map-layers",
3
- "version": "3.5.0-dev.4",
3
+ "version": "3.5.0-dev.41",
4
4
  "description": "Extension that adds a Map Layers Widget",
5
5
  "main": "lib/cjs/map-layers.js",
6
6
  "module": "lib/esm/map-layers.js",
@@ -21,22 +21,22 @@
21
21
  "url": "http://www.bentley.com"
22
22
  },
23
23
  "devDependencies": {
24
- "@itwin/appui-abstract": "3.5.0-dev.4",
25
- "@itwin/appui-layout-react": "3.5.0-dev.4",
26
- "@itwin/appui-react": "3.5.0-dev.4",
27
- "@itwin/build-tools": "3.5.0-dev.4",
28
- "@itwin/components-react": "3.5.0-dev.4",
29
- "@itwin/core-bentley": "3.5.0-dev.4",
30
- "@itwin/core-common": "3.5.0-dev.4",
31
- "@itwin/core-frontend": "3.5.0-dev.4",
32
- "@itwin/core-geometry": "3.5.0-dev.4",
33
- "@itwin/core-quantity": "3.5.0-dev.4",
34
- "@itwin/core-react": "3.5.0-dev.4",
35
- "@itwin/eslint-plugin": "3.5.0-dev.4",
36
- "@itwin/imodel-components-react": "3.5.0-dev.4",
24
+ "@itwin/appui-abstract": "3.5.0-dev.41",
25
+ "@itwin/appui-layout-react": "3.5.0-dev.41",
26
+ "@itwin/appui-react": "3.5.0-dev.41",
27
+ "@itwin/build-tools": "3.5.0-dev.41",
28
+ "@itwin/components-react": "3.5.0-dev.41",
29
+ "@itwin/core-bentley": "3.5.0-dev.41",
30
+ "@itwin/core-common": "3.5.0-dev.41",
31
+ "@itwin/core-frontend": "3.5.0-dev.41",
32
+ "@itwin/core-geometry": "3.5.0-dev.41",
33
+ "@itwin/core-quantity": "3.5.0-dev.41",
34
+ "@itwin/core-react": "3.5.0-dev.41",
35
+ "@itwin/eslint-plugin": "3.5.0-dev.41",
36
+ "@itwin/imodel-components-react": "3.5.0-dev.41",
37
37
  "@itwin/itwinui-css": "0.x",
38
38
  "@itwin/itwinui-react": "~1.42.0",
39
- "@itwin/presentation-common": "3.5.0-dev.4",
39
+ "@itwin/presentation-common": "3.5.0-dev.41",
40
40
  "@testing-library/react": "^12.0.0",
41
41
  "@testing-library/react-hooks": "^7.0.2",
42
42
  "@types/chai": "4.3.1",
@@ -69,21 +69,22 @@
69
69
  "typescript": "~4.4.0"
70
70
  },
71
71
  "dependencies": {
72
+ "@itwin/itwinui-icons-color-react": "~1.0.3",
72
73
  "classnames": "^2.3.1",
73
74
  "react-beautiful-dnd": "^13.0.0"
74
75
  },
75
76
  "peerDependencies": {
76
- "@itwin/core-bentley": "^3.5.0-dev.4",
77
- "@itwin/core-geometry": "^3.5.0-dev.4",
78
- "@itwin/core-common": "^3.5.0-dev.4",
79
- "@itwin/core-frontend": "^3.5.0-dev.4",
80
- "@itwin/core-quantity": "^3.5.0-dev.4",
81
- "@itwin/appui-abstract": "^3.5.0-dev.4",
82
- "@itwin/components-react": "^3.5.0-dev.4",
83
- "@itwin/core-react": "^3.5.0-dev.4",
84
- "@itwin/appui-react": "^3.5.0-dev.4",
85
- "@itwin/imodel-components-react": "^3.5.0-dev.4",
86
- "@itwin/appui-layout-react": "^3.5.0-dev.4",
77
+ "@itwin/core-bentley": "^3.5.0-dev.41",
78
+ "@itwin/core-geometry": "^3.5.0-dev.41",
79
+ "@itwin/core-common": "^3.5.0-dev.41",
80
+ "@itwin/core-frontend": "^3.5.0-dev.41",
81
+ "@itwin/core-quantity": "^3.5.0-dev.41",
82
+ "@itwin/appui-abstract": "^3.5.0-dev.41",
83
+ "@itwin/components-react": "^3.5.0-dev.41",
84
+ "@itwin/core-react": "^3.5.0-dev.41",
85
+ "@itwin/appui-react": "^3.5.0-dev.41",
86
+ "@itwin/imodel-components-react": "^3.5.0-dev.41",
87
+ "@itwin/appui-layout-react": "^3.5.0-dev.41",
87
88
  "react": "^17.0.0",
88
89
  "react-dom": "^17.0.0"
89
90
  },