@openremote/manager 1.7.0-snapshot.20250604112400 → 1.7.0-snapshot.20250605081830
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/dist/{bundle.ce8742383067917b0337.js → bundle.2516b7f930f5647aea65.js} +266 -199
- package/dist/{bundle.061add68c62f6db2fd2e.js → bundle.a4172cede0a8029f702c.js} +266 -199
- package/dist/index.html +1 -1
- package/lib/components/configuration/or-conf-json.d.ts +4 -3
- package/lib/components/configuration/or-conf-json.js +8 -8
- package/lib/components/configuration/or-conf-json.js.map +1 -1
- package/lib/components/configuration/or-conf-map/or-conf-map-global.d.ts +15 -0
- package/lib/components/configuration/or-conf-map/or-conf-map-global.js +298 -0
- package/lib/components/configuration/or-conf-map/or-conf-map-global.js.map +1 -0
- package/lib/pages/page-configuration.d.ts +1 -6
- package/lib/pages/page-configuration.js +27 -140
- package/lib/pages/page-configuration.js.map +1 -1
- package/package.json +3 -3
- /package/dist/{bundle.061add68c62f6db2fd2e.js.LICENSE.txt → bundle.2516b7f930f5647aea65.js.LICENSE.txt} +0 -0
- /package/dist/{bundle.ce8742383067917b0337.js.LICENSE.txt → bundle.a4172cede0a8029f702c.js.LICENSE.txt} +0 -0
package/dist/index.html
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
document.addEventListener('WebComponentsReady', function componentsReady() {
|
|
13
13
|
document.removeEventListener('WebComponentsReady', componentsReady, false);
|
|
14
14
|
var script = document.createElement('script');
|
|
15
|
-
script.src = './bundle.
|
|
15
|
+
script.src = './bundle.2516b7f930f5647aea65.js';
|
|
16
16
|
var refScript = document.getElementsByTagName('script')[0];
|
|
17
17
|
refScript.parentNode.insertBefore(script, refScript);
|
|
18
18
|
}, false);
|
|
@@ -2,11 +2,12 @@ import { LitElement } from "lit";
|
|
|
2
2
|
import "@openremote/or-components/or-ace-editor";
|
|
3
3
|
import { Ref } from "lit/directives/ref.js";
|
|
4
4
|
import { OrAceEditor } from "@openremote/or-components/or-ace-editor";
|
|
5
|
-
import { ManagerAppConfig } from "@openremote/model";
|
|
5
|
+
import { ManagerAppConfig, MapConfig } from "@openremote/model";
|
|
6
6
|
export declare class OrConfJson extends LitElement {
|
|
7
|
-
|
|
7
|
+
config: ManagerAppConfig | MapConfig;
|
|
8
|
+
heading: string;
|
|
8
9
|
protected _aceEditor: Ref<OrAceEditor>;
|
|
9
10
|
beforeSave(): false | string | undefined;
|
|
10
|
-
protected
|
|
11
|
+
protected _showConfigDialog(): void;
|
|
11
12
|
render(): import("lit-html").TemplateResult<1>;
|
|
12
13
|
}
|
|
@@ -31,7 +31,7 @@ import { createRef, ref } from "lit/directives/ref.js";
|
|
|
31
31
|
let OrConfJson = class OrConfJson extends LitElement {
|
|
32
32
|
constructor() {
|
|
33
33
|
super(...arguments);
|
|
34
|
-
this.
|
|
34
|
+
this.config = {};
|
|
35
35
|
this._aceEditor = createRef();
|
|
36
36
|
}
|
|
37
37
|
beforeSave() {
|
|
@@ -46,13 +46,13 @@ let OrConfJson = class OrConfJson extends LitElement {
|
|
|
46
46
|
return false;
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
|
-
|
|
49
|
+
_showConfigDialog() {
|
|
50
50
|
let dialog;
|
|
51
51
|
const _saveConfig = () => {
|
|
52
52
|
const config = this.beforeSave();
|
|
53
53
|
if (config) {
|
|
54
|
-
this.
|
|
55
|
-
this.dispatchEvent(new CustomEvent('
|
|
54
|
+
this.config = config;
|
|
55
|
+
this.dispatchEvent(new CustomEvent('saveLocalConfig', { detail: { value: this.config } }));
|
|
56
56
|
return true;
|
|
57
57
|
}
|
|
58
58
|
return false;
|
|
@@ -70,11 +70,11 @@ let OrConfJson = class OrConfJson extends LitElement {
|
|
|
70
70
|
];
|
|
71
71
|
dialog = new OrMwcDialog()
|
|
72
72
|
.setActions(dialogActions)
|
|
73
|
-
.setHeading(
|
|
73
|
+
.setHeading(this.heading)
|
|
74
74
|
.setContent(html `
|
|
75
75
|
<or-ace-editor
|
|
76
76
|
${ref(this._aceEditor)}
|
|
77
|
-
.value="${this.
|
|
77
|
+
.value="${this.config}"
|
|
78
78
|
@or-ace-editor-changed="${(ev) => {
|
|
79
79
|
var _a;
|
|
80
80
|
const okButton = (_a = dialog.actions) === null || _a === void 0 ? void 0 : _a.find(action => action.actionName === "ok");
|
|
@@ -108,13 +108,13 @@ let OrConfJson = class OrConfJson extends LitElement {
|
|
|
108
108
|
}
|
|
109
109
|
render() {
|
|
110
110
|
return html `
|
|
111
|
-
<or-mwc-input type="button" label="JSON" outlined icon="pencil" @click="${() => { this.
|
|
111
|
+
<or-mwc-input type="button" label="JSON" outlined icon="pencil" @click="${() => { this._showConfigDialog(); }}"></or-mwc-input>
|
|
112
112
|
`;
|
|
113
113
|
}
|
|
114
114
|
};
|
|
115
115
|
__decorate([
|
|
116
116
|
property({ attribute: false })
|
|
117
|
-
], OrConfJson.prototype, "
|
|
117
|
+
], OrConfJson.prototype, "config", void 0);
|
|
118
118
|
OrConfJson = __decorate([
|
|
119
119
|
customElement("or-conf-json")
|
|
120
120
|
], OrConfJson);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"or-conf-json.js","sourceRoot":"","sources":["../../../src/components/configuration/or-conf-json.ts"],"names":[],"mappings":";;;;;;AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,yCAAyC,CAAC;AAEjD,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,6CAA6C,CAAC;AACtF,OAAO,EAAE,SAAS,EAAO,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAKrD,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,UAAU;IAAnC;;QAGI,
|
|
1
|
+
{"version":3,"file":"or-conf-json.js","sourceRoot":"","sources":["../../../src/components/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|
|
|
1
|
+
import { MapConfig } from "@openremote/model";
|
|
2
|
+
import { OrInputChangedEvent } from "@openremote/or-mwc-components/or-mwc-input";
|
|
3
|
+
import { LitElement } from "lit";
|
|
4
|
+
export declare class OrConfMapGlobal extends LitElement {
|
|
5
|
+
static styles: import("lit").CSSResult;
|
|
6
|
+
config?: MapConfig;
|
|
7
|
+
protected filename: string;
|
|
8
|
+
protected limit: number;
|
|
9
|
+
protected render(): import("lit-html").TemplateResult<1>;
|
|
10
|
+
protected notifyConfigChange(config: MapConfig): void;
|
|
11
|
+
protected notifyMapFileChange(e: OrInputChangedEvent): void;
|
|
12
|
+
protected resetMapSettings(): void;
|
|
13
|
+
protected importMapSettings(): Promise<void>;
|
|
14
|
+
private humanReadableBytes;
|
|
15
|
+
}
|
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
8
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
9
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
10
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
11
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
12
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
13
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
17
|
+
var t = {};
|
|
18
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
19
|
+
t[p] = s[p];
|
|
20
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
21
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
22
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
23
|
+
t[p[i]] = s[p[i]];
|
|
24
|
+
}
|
|
25
|
+
return t;
|
|
26
|
+
};
|
|
27
|
+
import { InputType } from "@openremote/or-mwc-components/or-mwc-input";
|
|
28
|
+
import { css, html, LitElement } from "lit";
|
|
29
|
+
import { customElement, property } from "lit/decorators.js";
|
|
30
|
+
import { when } from "lit/directives/when.js";
|
|
31
|
+
import { showSnackbar } from "@openremote/or-mwc-components/or-mwc-snackbar";
|
|
32
|
+
import { i18next } from "@openremote/or-translate";
|
|
33
|
+
let OrConfMapGlobal = class OrConfMapGlobal extends LitElement {
|
|
34
|
+
constructor() {
|
|
35
|
+
super(...arguments);
|
|
36
|
+
this.config = {};
|
|
37
|
+
this.limit = 30e+6;
|
|
38
|
+
}
|
|
39
|
+
/* -------------- */
|
|
40
|
+
render() {
|
|
41
|
+
var _a, _b, _c, _d, _e;
|
|
42
|
+
const isCustom = (_b = (_a = this.config.sources) === null || _a === void 0 ? void 0 : _a.vector_tiles) === null || _b === void 0 ? void 0 : _b.custom;
|
|
43
|
+
const hasExternalSource = Object.keys(this.config.sources).length > 1;
|
|
44
|
+
return html `
|
|
45
|
+
<div class="map-tile-settings">
|
|
46
|
+
<div class="map-tile-server-group">
|
|
47
|
+
<div class="subheader"><or-translate value="configuration.global.mapTileServer"></or-translate></div>
|
|
48
|
+
<span>
|
|
49
|
+
<or-translate value="configuration.global.mapTileServerDescription"></or-translate><br>
|
|
50
|
+
<or-translate class="note" value="configuration.global.mapTileServerNote"></or-translate>
|
|
51
|
+
</span>
|
|
52
|
+
<or-mwc-input class="input"
|
|
53
|
+
.value="${isCustom ? (_e = (_d = (_c = this.config.sources) === null || _c === void 0 ? void 0 : _c.vector_tiles) === null || _d === void 0 ? void 0 : _d.tiles) === null || _e === void 0 ? void 0 : _e[0] : undefined}"
|
|
54
|
+
.type="${InputType.URL}"
|
|
55
|
+
.label="${i18next.t("configuration.global.mapTileServerPlaceholder")}"
|
|
56
|
+
placeholder="https://api.example.com/tileset/{z}/{x}/{y}"
|
|
57
|
+
@or-mwc-input-changed="${(e) => {
|
|
58
|
+
this.config.sources.vector_tiles.tiles = e.detail.value ? [e.detail.value] : undefined;
|
|
59
|
+
this.config.sources.vector_tiles.custom = !!e.detail.value;
|
|
60
|
+
this.notifyConfigChange(this.config);
|
|
61
|
+
}}"
|
|
62
|
+
></or-mwc-input>
|
|
63
|
+
</div>
|
|
64
|
+
<div class="map-tile-upload-group">
|
|
65
|
+
<div class="subheader"><or-translate value="configuration.global.mapTiles"></or-translate></div>
|
|
66
|
+
<span>
|
|
67
|
+
<or-translate value="configuration.global.uploadMapTiles"></or-translate><br>
|
|
68
|
+
<or-translate class="note" value="configuration.global.uploadMapTilesNote"
|
|
69
|
+
.options=${{ limit: this.humanReadableBytes(this.limit) }}
|
|
70
|
+
></or-translate>
|
|
71
|
+
</span>
|
|
72
|
+
<div class="input d-inline-flex" style="height: 56px">
|
|
73
|
+
<div id="fileupload" style="display: flex; align-items: center">
|
|
74
|
+
<or-mwc-input outlined label="selectFile" style="width: fit-content; padding-right: 12px;" .type="${InputType.BUTTON}" @or-mwc-input-changed="${() => this.shadowRoot.getElementById('fileupload-elem').click()}">
|
|
75
|
+
<input id="fileupload-elem" name="configfile" type="file" accept=".mbtiles" @change="${this.notifyMapFileChange}"/>
|
|
76
|
+
</or-mwc-input>
|
|
77
|
+
<or-mwc-input id="filename-elem" style="width: unset" .value="${this.filename}" .label="${i18next.t("file")}" .type="${InputType.TEXT}" disabled>
|
|
78
|
+
</or-mwc-input>
|
|
79
|
+
${when(this.filename, () => html `<or-mwc-input type="${InputType.BUTTON}" iconColor="black" icon="delete"
|
|
80
|
+
@or-mwc-input-changed="${this.notifyMapFileChange}"
|
|
81
|
+
></or-mwc-input>`)}
|
|
82
|
+
</div>
|
|
83
|
+
</div>
|
|
84
|
+
</div>
|
|
85
|
+
</div>
|
|
86
|
+
<div class="map-style-settings">
|
|
87
|
+
<div class="map-style-server-group">
|
|
88
|
+
<span>
|
|
89
|
+
<div class="subheader"><or-translate value="configuration.global.mapStyleJsonUrl"></or-translate></div>
|
|
90
|
+
<or-translate value="configuration.global.mapStyleJsonUrlDescription"></or-translate><br>
|
|
91
|
+
<or-translate class="note" value="configuration.global.mapStyleJsonUrlNote"></or-translate>
|
|
92
|
+
</span>
|
|
93
|
+
<div style="display: flex; height: 56px; align-items: center">
|
|
94
|
+
<or-mwc-input class="input"
|
|
95
|
+
.value="${this.config.override}"
|
|
96
|
+
.type="${InputType.URL}"
|
|
97
|
+
.label="${i18next.t("configuration.global.mapStyleJsonUrlPlaceholder")}"
|
|
98
|
+
placeholder="https://api.example.com/tileset/style.json"
|
|
99
|
+
@or-mwc-input-changed="${(e) => {
|
|
100
|
+
this.config.override = e.detail.value || undefined;
|
|
101
|
+
this.notifyConfigChange(this.config);
|
|
102
|
+
this.requestUpdate();
|
|
103
|
+
}}"
|
|
104
|
+
></or-mwc-input>
|
|
105
|
+
</div>
|
|
106
|
+
</div>
|
|
107
|
+
<div class="map-style-layers-group">
|
|
108
|
+
<span>
|
|
109
|
+
<div class="subheader"><or-translate value="configuration.global.mapLayers"></or-translate></div>
|
|
110
|
+
<or-translate value="configuration.global.mapImportStyle"></or-translate>
|
|
111
|
+
<or-translate class="note" value="configuration.global.mapImportStyleNote"></or-translate>
|
|
112
|
+
</span>
|
|
113
|
+
<div style="display: flex; gap: 12px; align-items: center">
|
|
114
|
+
<or-mwc-input class="input fit-content" type="button" outlined icon="import"
|
|
115
|
+
.label="${i18next.t("configuration.global.import")}"
|
|
116
|
+
.disabled="${!this.config.override}" @or-mwc-input-changed="${this.importMapSettings}"
|
|
117
|
+
></or-mwc-input>
|
|
118
|
+
<or-conf-json class="input fit-content hide-mobile" .heading="${i18next.t("configuration.global.mapLayers")}"
|
|
119
|
+
.config="${hasExternalSource ? this.config.layers.filter(({ id }) => !id.startsWith("or:")) : this.config.layers}"
|
|
120
|
+
@saveLocalConfig="${(ev) => {
|
|
121
|
+
if (Array.isArray(ev.detail.value)) {
|
|
122
|
+
if (hasExternalSource) {
|
|
123
|
+
// Set default layers
|
|
124
|
+
this.config.layers = this.config.layers.filter(({ id }) => id.startsWith("or:"));
|
|
125
|
+
// Push changed layers
|
|
126
|
+
this.config.layers.push(...ev.detail.value);
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
this.config.layers = ev.detail.value;
|
|
130
|
+
}
|
|
131
|
+
this.notifyConfigChange(this.config);
|
|
132
|
+
this.requestUpdate();
|
|
133
|
+
}
|
|
134
|
+
}}"
|
|
135
|
+
></or-conf-json>
|
|
136
|
+
${when(hasExternalSource, () => html `
|
|
137
|
+
<or-mwc-input class="input fit-content" outlined type="button" icon="undo"
|
|
138
|
+
.label="${i18next.t("configuration.global.reset")}"
|
|
139
|
+
@or-mwc-input-changed="${this.resetMapSettings}"
|
|
140
|
+
></or-mwc-input>
|
|
141
|
+
`)}
|
|
142
|
+
</div>
|
|
143
|
+
</div>
|
|
144
|
+
</div>
|
|
145
|
+
`;
|
|
146
|
+
}
|
|
147
|
+
notifyConfigChange(config) {
|
|
148
|
+
this.dispatchEvent(new CustomEvent("change", { detail: config }));
|
|
149
|
+
}
|
|
150
|
+
notifyMapFileChange(e) {
|
|
151
|
+
var _a, _b;
|
|
152
|
+
const file = (_b = (_a = e.target) === null || _a === void 0 ? void 0 : _a.files) === null || _b === void 0 ? void 0 : _b[0];
|
|
153
|
+
if (file) {
|
|
154
|
+
if (file.size > this.limit) {
|
|
155
|
+
showSnackbar(undefined, "configuration.global.uploadMapTilesError");
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
const filenameEl = this.shadowRoot.getElementById('filename-elem');
|
|
159
|
+
if (filenameEl) {
|
|
160
|
+
filenameEl.value = file.name;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
this.dispatchEvent(new CustomEvent("map-file-changed", { detail: file }));
|
|
164
|
+
}
|
|
165
|
+
resetMapSettings() {
|
|
166
|
+
this.config.glyphs = undefined;
|
|
167
|
+
this.config.sprite = undefined;
|
|
168
|
+
this.config.sources = { vector_tiles: this.config.sources.vector_tiles };
|
|
169
|
+
this.config.layers = this.config.layers
|
|
170
|
+
.filter(({ id }) => id.startsWith("or:"))
|
|
171
|
+
.map((_a) => {
|
|
172
|
+
var { id } = _a, layer = __rest(_a, ["id"]);
|
|
173
|
+
return (Object.assign(Object.assign({}, layer), { id: id.replace("or:", "") }));
|
|
174
|
+
});
|
|
175
|
+
this.notifyConfigChange(this.config);
|
|
176
|
+
this.requestUpdate();
|
|
177
|
+
}
|
|
178
|
+
importMapSettings() {
|
|
179
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
180
|
+
if (this.config.override) {
|
|
181
|
+
const data = yield (yield fetch(this.config.override)).json();
|
|
182
|
+
if (Object.keys(this.config.sources).length > 1) {
|
|
183
|
+
// Set default layers
|
|
184
|
+
this.config.layers = this.config.layers.filter(({ id }) => id.startsWith("or:"));
|
|
185
|
+
// Push new layers
|
|
186
|
+
this.config.layers.push(...data.layers);
|
|
187
|
+
}
|
|
188
|
+
else {
|
|
189
|
+
this.config.layers = this.config.layers.map((_a) => {
|
|
190
|
+
var { id } = _a, layer = __rest(_a, ["id"]);
|
|
191
|
+
return (Object.assign(Object.assign({}, layer), { id: "or:" + id }));
|
|
192
|
+
});
|
|
193
|
+
this.config.layers.push(...data.layers);
|
|
194
|
+
}
|
|
195
|
+
Object.assign(this.config.sources, data.sources);
|
|
196
|
+
this.config.sprite = data.sprite;
|
|
197
|
+
this.config.glyphs = data.glyphs;
|
|
198
|
+
delete this.config.override;
|
|
199
|
+
this.notifyConfigChange(this.config);
|
|
200
|
+
this.requestUpdate();
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
humanReadableBytes(bytes) {
|
|
205
|
+
const unit = ['bytes', 'kB', 'MB', 'GB', 'TB', 'PB'];
|
|
206
|
+
const exponent = Math.floor(Math.log(bytes) / Math.log(1000));
|
|
207
|
+
return (bytes / Math.pow(1000, exponent)).toFixed(2) + " " + unit[exponent];
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
OrConfMapGlobal.styles = css `
|
|
211
|
+
.subheader {
|
|
212
|
+
padding: 10px 0 4px;
|
|
213
|
+
font-weight: bolder;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
.map-tile-settings {
|
|
217
|
+
display: flex;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
.map-tile-server-group {
|
|
221
|
+
flex-direction: column;
|
|
222
|
+
width: 50%;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
.map-tile-upload-group {
|
|
226
|
+
flex-direction: column;
|
|
227
|
+
padding-left: 12px;
|
|
228
|
+
width: 50%;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
.map-style-settings {
|
|
232
|
+
display: flex;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
.map-style-server-group {
|
|
236
|
+
flex-direction: column;
|
|
237
|
+
width: 50%;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
.map-style-layers-group {
|
|
241
|
+
flex-direction: column;
|
|
242
|
+
padding-left: 12px;
|
|
243
|
+
width: 50%;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
@media screen and (max-width: 768px) {
|
|
247
|
+
.map-tile-server-group, .map-tile-upload-group,
|
|
248
|
+
.map-style-server-group, .map-style-layers-group {
|
|
249
|
+
width: 100%;
|
|
250
|
+
padding: unset;
|
|
251
|
+
}
|
|
252
|
+
.map-tile-settings, .map-style-settings {
|
|
253
|
+
display: block;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
.input {
|
|
258
|
+
width: 100%;
|
|
259
|
+
max-width: 800px;
|
|
260
|
+
padding: 10px 0;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
.input or-mwc-input:not([icon]) {
|
|
264
|
+
width: 80%;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
.note {
|
|
268
|
+
font-style: italic;
|
|
269
|
+
color: rgba(0, 0, 0, 0.6);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
or-file-uploader {
|
|
273
|
+
width: 108px;
|
|
274
|
+
height: 108px;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
.d-inline-flex {
|
|
278
|
+
display: inline-flex;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
.fit-content {
|
|
282
|
+
width: fit-content;
|
|
283
|
+
}
|
|
284
|
+
`;
|
|
285
|
+
__decorate([
|
|
286
|
+
property()
|
|
287
|
+
], OrConfMapGlobal.prototype, "config", void 0);
|
|
288
|
+
__decorate([
|
|
289
|
+
property()
|
|
290
|
+
], OrConfMapGlobal.prototype, "filename", void 0);
|
|
291
|
+
__decorate([
|
|
292
|
+
property()
|
|
293
|
+
], OrConfMapGlobal.prototype, "limit", void 0);
|
|
294
|
+
OrConfMapGlobal = __decorate([
|
|
295
|
+
customElement("or-conf-map-global")
|
|
296
|
+
], OrConfMapGlobal);
|
|
297
|
+
export { OrConfMapGlobal };
|
|
298
|
+
//# sourceMappingURL=or-conf-map-global.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"or-conf-map-global.js","sourceRoot":"","sources":["../../../../src/components/configuration/or-conf-map/or-conf-map-global.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,OAAO,E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GAAG,IAAI,CAAC,MAAgB,CAAC;gBAC3C,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;gBACjC,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC;gBAC5B,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;gBACrC,IAAI,CAAC,aAAa,EAAE,CAAC;YACzB,CAAC;QACH,CAAC;KAAA;IAEO,kBAAkB,CAAC,KAAa;QACpC,MAAM,IAAI,GAAG,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QACrD,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;QAC9D,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC;IAChF,CAAC;;AA1PM,sBAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA0ElB,AA1EY,CA0EX;AAGK;IADN,QAAQ,EAAE;+CACoB;AAGrB;IADT,QAAQ,EAAE;iDACgB;AAGjB;IADT,QAAQ,EAAE;8CACa;AArFf,eAAe;IAD3B,aAAa,CAAC,oBAAoB,CAAC;GACvB,eAAe,CA6P3B"}
|
|
@@ -4,13 +4,12 @@ import "@openremote/or-translate";
|
|
|
4
4
|
import { Store } from "@reduxjs/toolkit";
|
|
5
5
|
import { AppStateKeyed, Page, PageProvider } from "@openremote/or-app";
|
|
6
6
|
import "@openremote/or-components/or-collapsible-panel";
|
|
7
|
-
import "@openremote/or-mwc-components/or-mwc-input";
|
|
8
7
|
import "../components/configuration/or-conf-json";
|
|
9
8
|
import "../components/configuration/or-conf-panel";
|
|
9
|
+
import "../components/configuration/or-conf-map/or-conf-map-global";
|
|
10
10
|
import { ManagerAppConfig, MapConfig, Realm } from "@openremote/model";
|
|
11
11
|
import "@openremote/or-components/or-loading-indicator";
|
|
12
12
|
import { OrConfPanel } from "../components/configuration/or-conf-panel";
|
|
13
|
-
import { OrInputChangedEvent } from "@openremote/or-mwc-components/or-mwc-input";
|
|
14
13
|
export declare function pageConfigurationProvider(store: Store<AppStateKeyed>): PageProvider<AppStateKeyed>;
|
|
15
14
|
export declare class PageConfiguration extends Page<AppStateKeyed> {
|
|
16
15
|
static get styles(): import("lit").CSSResult;
|
|
@@ -28,12 +27,8 @@ export declare class PageConfiguration extends Page<AppStateKeyed> {
|
|
|
28
27
|
protected realmConfigPanel?: OrConfPanel;
|
|
29
28
|
stateChanged(state: AppStateKeyed): void;
|
|
30
29
|
firstUpdated(): Promise<void>;
|
|
31
|
-
humanReadableBytes(bytes: number): string;
|
|
32
30
|
willUpdate(changedProps: PropertyValues<this>): void;
|
|
33
31
|
protected render(): TemplateResult | void;
|
|
34
|
-
protected setCustomVectorTilesUrl(e: OrInputChangedEvent): Promise<void>;
|
|
35
|
-
protected uploadCustomMap(e: CustomEvent): Promise<void>;
|
|
36
|
-
protected deleteCustomMap(): Promise<void>;
|
|
37
32
|
protected getManagerConfig(): Promise<ManagerAppConfig | undefined>;
|
|
38
33
|
protected getMapConfig(): Promise<MapConfig>;
|
|
39
34
|
protected getAccessibleRealms(): Promise<Realm[]>;
|