Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

UI updates: various restructuring (changed components to use index.ts rather than component name)

Rich Turnerda48cf1fb941
diff --git a/ui/component/or-map/src/@types/mapbox.js/index.d.ts b/ui/component/or-map/@types/mapbox.js.d.ts
similarity index 91%
rename from ui/component/or-map/src/@types/mapbox.js/index.d.ts
rename to ui/component/or-map/@types/mapbox.js.d.ts
index 25664035c..f2842e489 100644
--- a/ui/component/or-map/src/@types/mapbox.js/index.d.ts
+++ b/ui/component/or-map/@types/mapbox.js.d.ts
@@ -1,6 +1,8 @@
-declare module 'mapbox.js' {
+declare module "mapbox.js" {
import {LngLatBoundsLike, LngLatLike} from "mapbox-gl";
+ export default L;
+
export namespace L {
export namespace mapbox {
export class map {
diff --git a/ui/component/or-map/src/index.ts b/ui/component/or-map/src/index.ts
index 9f48a6190..dce8d86d5 100644
--- a/ui/component/or-map/src/index.ts
+++ b/ui/component/or-map/src/index.ts
@@ -5,7 +5,7 @@ import {customElement, property} from '@polymer/decorators';
import rest from "@openremote/rest";
import {OrMapMarker} from "@openremote/or-map-marker";
import {Map, MapboxOptions, Style as MapboxStyle} from "mapbox-gl";
-import {L} from "mapbox.js";
+import L from "mapbox.js";
export enum Type {
VECTOR = "VECTOR",
@@ -20,7 +20,7 @@ export enum Type {
@customElement('or-map')
export class OrMap extends PolymerElement {
protected _initCallback?: EventCallback;
- protected _map?: Map;
+ protected _map?: any;
protected static _mapboxGlStyle?: any;
protected static _mapboxJsStyle?: any;
protected _loaded: boolean = false;
@@ -54,24 +54,28 @@ export class OrMap extends PolymerElement {
super();
}
- _processNewMarkers(nodes) {
- nodes.forEach(function (node) {
+ _processNewMarkers(nodes : Element[]) {
+ nodes.forEach((node) => {
// node tagName should include marker to pass this check
if(node instanceof OrMapMarker) {
const marker = <OrMapMarker>node;
- let leafletMarket = L.divIcon({className: 'map-marker', html: marker.html.innerHTML});
- L.marker([marker.latitude, marker.longitude], {icon:leafletMarket}).addTo(this._map);
+ if (marker.html) {
+ // @ts-ignore
+ let leafletMarket = L.divIcon({className: 'map-marker', html: marker.html.innerHTML});
+ // @ts-ignore
+ L.marker([marker.latitude, marker.longitude], {icon: leafletMarket}).addTo(this._map);
+ }
}
- }.bind(this));
+ });
}
- _processRemovedMarkers(nodes) {
+ _processRemovedMarkers(nodes : Element[]) {
}
disconnectedCallback() {
super.disconnectedCallback();
- this._observer.disconnect();
+ this._observer!.disconnect();
}
ready() {
@@ -167,7 +171,7 @@ export class OrMap extends PolymerElement {
// Get markers from slot
let slotElement = this.shadowRoot.getElementById('markers-slot');
- this._observer = new FlattenedNodesObserver(slotElement, (info) => {
+ this._observer = new FlattenedNodesObserver(slotElement!, (info) => {
this._processNewMarkers(info.addedNodes);
this._processRemovedMarkers(info.removedNodes);
});
diff --git a/ui/demo/demo-core/webpack.config.js b/ui/demo/demo-core/webpack.config.js
index 57b6a2e91..b3a44ccb7 100644
--- a/ui/demo/demo-core/webpack.config.js
+++ b/ui/demo/demo-core/webpack.config.js
@@ -60,8 +60,11 @@ module.exports = {
rules: [
{
test: /\.tsx?$/,
- use: 'awesome-typescript-loader',
- exclude: /node_modules/
+ use: [
+ {
+ loader: "awesome-typescript-loader",
+ }
+ ]
},
{
test: /\.js$/,
diff --git a/ui/demo/demo-or-map/tsconfig.json b/ui/demo/demo-or-map/tsconfig.json
index 9a2a007ff..6f139ca97 100644
--- a/ui/demo/demo-or-map/tsconfig.json
+++ b/ui/demo/demo-or-map/tsconfig.json
@@ -2,5 +2,9 @@
"extends": "../../tsconfig",
"compilerOptions": {
"outDir": "./dist/"
- }
+ },
+ "include": [
+ "./src",
+ "../../component/or-map/@types"
+ ]
}
\ No newline at end of file
diff --git a/ui/yarn.lock b/ui/yarn.lock
index 8b77de5e6..1cb0acfe2 100644
--- a/ui/yarn.lock
+++ b/ui/yarn.lock
@@ -694,6 +694,13 @@
version "3.0.0-pre.21"
resolved "https://registry.yarnpkg.com/@polymer/test-fixture/-/test-fixture-3.0.0-pre.21.tgz#85152207cb0bf57caebc191c80bb0fdb6952614e"
+"@types/es6-promise@^3.3.0":
+ version "3.3.0"
+ resolved "https://registry.yarnpkg.com/@types/es6-promise/-/es6-promise-3.3.0.tgz#61b55e554fd807b563f158a7986ee53d3a5a5a9d"
+ integrity sha512-ixCIAEkLUKv9movnHKCzx2rzAJgEnSALDXPrOSSwOjWwXFs0ssSZKan+O2e3FExPPCbX+DfA9NcKsbvLuyUlNA==
+ dependencies:
+ es6-promise "*"
+
"@types/geojson@*":
version "7946.0.4"
resolved "https://registry.yarnpkg.com/@types/geojson/-/geojson-7946.0.4.tgz#4e049756383c3f055dd8f3d24e63fb543e98eb07"
@@ -2180,6 +2187,11 @@ es6-object-assign@^1.0.3:
resolved "https://registry.yarnpkg.com/es6-object-assign/-/es6-object-assign-1.1.0.tgz#c2c3582656247c39ea107cb1e6652b6f9f24523c"
integrity sha1-wsNYJlYkfDnqEHyx5mUrb58kUjw=
+es6-promise@*:
+ version "4.2.5"
+ resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-4.2.5.tgz#da6d0d5692efb461e082c14817fe2427d8f5d054"
+ integrity sha512-n6wvpdE43VFtJq+lUDYDBFUwV8TZbuGXLV4D6wKafg13ldznKsyEvatubnmUe31zcvelSzOHF+XbaT+Bl9ObDg==
+
es6-symbol@^3.1.1, es6-symbol@~3.1.1:
version "3.1.1"
resolved "https://registry.yarnpkg.com/es6-symbol/-/es6-symbol-3.1.1.tgz#bf00ef4fdab6ba1b46ecb7b629b4c7ed5715cc77"