@vcmap/module-selector 2.0.0-rc.2 → 2.0.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/dist/index.js +84 -83
- package/package.json +1 -1
- package/src/ModuleSelector.vue +1 -1
- package/src/moduleHelper.ts +4 -0
package/dist/index.js
CHANGED
|
@@ -10,11 +10,11 @@ function loadCss(href) {
|
|
|
10
10
|
elem.onerror = reject;
|
|
11
11
|
document.head.appendChild(elem);
|
|
12
12
|
});
|
|
13
|
-
} await loadCss('data:text/css;base64,
|
|
14
|
-
import { defineComponent as E, inject as F, computed as V, resolveComponent as
|
|
13
|
+
} await loadCss('data:text/css;base64,LnYtY2FyZFtkYXRhLXYtYzMzMDgwZDdde2Rpc3BsYXk6ZmxleDtmbGV4LWRpcmVjdGlvbjpjb2x1bW47anVzdGlmeS1jb250ZW50OmNlbnRlcjthbGlnbi1pdGVtczpjZW50ZXI7aGVpZ2h0OjE1MHB4O3dpZHRoOjE1MHB4O2FzcGVjdC1yYXRpbzoxO3RyYW5zaXRpb246YmFja2dyb3VuZC1jb2xvciAuM3N9LmZpeGVkLWNhcmRbZGF0YS12LWMzMzA4MGQ3XXtoZWlnaHQ6MTUwcHg7d2lkdGg6MTUwcHg7YXNwZWN0LXJhdGlvOjF9LnNlbGVjdGVkLWNhcmRbZGF0YS12LWMzMzA4MGQ3XXtiYWNrZ3JvdW5kLWNvbG9yOnJnYih2YXIoLS12LXRoZW1lLXByaW1hcnkpKTtjb2xvcjpyZ2IodmFyKC0tdi10aGVtZS1vbi1wcmltYXJ5KSl9Cg==');import { VcsFormButton as z, WindowSlot as D, createToggleAction as O, ButtonLocation as j } from "../../../assets/ui.js";
|
|
14
|
+
import { defineComponent as E, inject as F, computed as V, resolveComponent as r, openBlock as u, createBlock as M, withCtx as l, createVNode as a, createTextVNode as c, toDisplayString as m, createCommentVNode as h, createElementBlock as B, Fragment as I, renderList as N, normalizeClass as b, ref as T } from "../../../assets/vue.js";
|
|
15
15
|
import { VSheet as J, VContainer as L, VRow as P, VCol as R, VCard as G, VIcon as H, VCardTitle as K } from "../../../assets/vuetify.js";
|
|
16
16
|
import { VcsModule as U } from "../../../assets/core.js";
|
|
17
|
-
const
|
|
17
|
+
const S = "@vcmap/module-selector", W = "2.0.0", Z = "^6.0";
|
|
18
18
|
async function $(e, o) {
|
|
19
19
|
const t = await fetch(e, {
|
|
20
20
|
method: "GET"
|
|
@@ -29,8 +29,9 @@ async function $(e, o) {
|
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
async function Q(e) {
|
|
32
|
-
|
|
33
|
-
e.
|
|
32
|
+
var f, y;
|
|
33
|
+
const o = "moduleSelector_module_id", t = (f = e.maps.activeMap) == null ? void 0 : f.name;
|
|
34
|
+
e.getModuleById(o) && await e.removeModule(o), e.maps.activeMap || await e.maps.setActiveMap(t || ((y = [...e.maps][0]) == null ? void 0 : y.name));
|
|
34
35
|
}
|
|
35
36
|
const x = "moduleSelector_window_id", X = E({
|
|
36
37
|
name: "ModuleSelector",
|
|
@@ -42,7 +43,7 @@ const x = "moduleSelector_window_id", X = E({
|
|
|
42
43
|
VCard: G,
|
|
43
44
|
VIcon: H,
|
|
44
45
|
VCardTitle: K,
|
|
45
|
-
VcsFormButton:
|
|
46
|
+
VcsFormButton: z
|
|
46
47
|
},
|
|
47
48
|
props: {
|
|
48
49
|
modules: {
|
|
@@ -61,46 +62,46 @@ const x = "moduleSelector_window_id", X = E({
|
|
|
61
62
|
}
|
|
62
63
|
},
|
|
63
64
|
setup(e) {
|
|
64
|
-
const o = F("vcsApp"), t = o.plugins.getByKey(
|
|
65
|
+
const o = F("vcsApp"), t = o.plugins.getByKey(S), { modules: s } = e, f = V(() => {
|
|
65
66
|
const n = e.modules[t.selectedMainModuleIndex.value];
|
|
66
67
|
return (n == null ? void 0 : n.type) === "group" ? n.cards : [];
|
|
67
|
-
}),
|
|
68
|
+
}), y = (n) => {
|
|
68
69
|
t.selectedMainModuleIndex.value === n ? t.selectedMainModuleIndex.value = null : t.selectedMainModuleIndex.value = n;
|
|
69
|
-
},
|
|
70
|
+
}, p = (n) => {
|
|
70
71
|
t.selectedNestedModuleIndex.value === n ? t.selectedNestedModuleIndex.value = null : t.selectedNestedModuleIndex.value = n;
|
|
71
|
-
},
|
|
72
|
+
}, k = () => {
|
|
72
73
|
t.selectedNestedModuleIndex.value = null, t.selectedMainModuleIndex.value = null;
|
|
73
|
-
},
|
|
74
|
+
}, _ = async () => {
|
|
74
75
|
var i;
|
|
75
76
|
await Q(o);
|
|
76
|
-
const n = t.selectedMainModuleIndex.value,
|
|
77
|
-
if (n === null) return;
|
|
78
|
-
const d = s[n],
|
|
79
|
-
|
|
80
|
-
},
|
|
77
|
+
const n = t.selectedMainModuleIndex.value, C = t.selectedNestedModuleIndex.value;
|
|
78
|
+
if (n === null && !e.basisModule) return;
|
|
79
|
+
const d = s[n], g = (d == null ? void 0 : d.type) === "group" ? (i = d.cards) == null ? void 0 : i[C] : null;
|
|
80
|
+
g != null && g.moduleUrl ? await $(g.moduleUrl, o) : (d == null ? void 0 : d.type) === "url" && await $(d.moduleUrl, o), o.windowManager.remove(x);
|
|
81
|
+
}, w = V(() => {
|
|
81
82
|
if (!e.requireModuleSelection) return !1;
|
|
82
|
-
const n = t.selectedMainModuleIndex.value,
|
|
83
|
-
return n == null || (d == null ? void 0 : d.type) === "group" && d.cards &&
|
|
83
|
+
const n = t.selectedMainModuleIndex.value, C = t.selectedNestedModuleIndex.value, d = s[n];
|
|
84
|
+
return n == null || (d == null ? void 0 : d.type) === "group" && d.cards && C == null;
|
|
84
85
|
});
|
|
85
86
|
return {
|
|
86
|
-
nestedCards:
|
|
87
|
+
nestedCards: f,
|
|
87
88
|
plugin: t,
|
|
88
|
-
selectModule:
|
|
89
|
-
selectNestedModule:
|
|
90
|
-
showMainCards:
|
|
91
|
-
startApplication:
|
|
92
|
-
isButtonDisabled:
|
|
89
|
+
selectModule: y,
|
|
90
|
+
selectNestedModule: p,
|
|
91
|
+
showMainCards: k,
|
|
92
|
+
startApplication: _,
|
|
93
|
+
isButtonDisabled: w
|
|
93
94
|
};
|
|
94
95
|
}
|
|
95
96
|
}), Y = (e, o) => {
|
|
96
97
|
const t = e.__vccOpts || e;
|
|
97
|
-
for (const [s,
|
|
98
|
-
t[s] =
|
|
98
|
+
for (const [s, f] of o)
|
|
99
|
+
t[s] = f;
|
|
99
100
|
return t;
|
|
100
101
|
};
|
|
101
|
-
function ee(e, o, t, s,
|
|
102
|
-
const
|
|
103
|
-
return
|
|
102
|
+
function ee(e, o, t, s, f, y) {
|
|
103
|
+
const p = r("v-icon"), k = r("v-card-title"), _ = r("v-card"), w = r("v-col"), n = r("v-row"), C = r("VcsFormButton"), d = r("v-container"), g = r("v-sheet");
|
|
104
|
+
return u(), M(g, {
|
|
104
105
|
class: "module-selector",
|
|
105
106
|
elevation: "1"
|
|
106
107
|
}, {
|
|
@@ -112,23 +113,23 @@ function ee(e, o, t, s, C, I) {
|
|
|
112
113
|
"no-gutters": ""
|
|
113
114
|
}, {
|
|
114
115
|
default: l(() => [
|
|
115
|
-
e.basisModule && !e.nestedCards.length ? (
|
|
116
|
+
e.basisModule && !e.nestedCards.length ? (u(), M(w, {
|
|
116
117
|
key: 0,
|
|
117
118
|
cols: "auto",
|
|
118
119
|
class: "pa-2"
|
|
119
120
|
}, {
|
|
120
121
|
default: l(() => [
|
|
121
|
-
a(
|
|
122
|
+
a(_, {
|
|
122
123
|
class: "pa-3 fixed-card selected-card",
|
|
123
124
|
outlined: ""
|
|
124
125
|
}, {
|
|
125
126
|
default: l(() => [
|
|
126
|
-
e.basisModule.icon ? (
|
|
127
|
+
e.basisModule.icon ? (u(), M(p, {
|
|
127
128
|
key: 0,
|
|
128
129
|
size: "50"
|
|
129
130
|
}, {
|
|
130
131
|
default: l(() => [
|
|
131
|
-
|
|
132
|
+
c(
|
|
132
133
|
m(e.basisModule.icon),
|
|
133
134
|
1
|
|
134
135
|
/* TEXT */
|
|
@@ -136,10 +137,10 @@ function ee(e, o, t, s, C, I) {
|
|
|
136
137
|
]),
|
|
137
138
|
_: 1
|
|
138
139
|
/* STABLE */
|
|
139
|
-
})) :
|
|
140
|
-
a(
|
|
140
|
+
})) : h("v-if", !0),
|
|
141
|
+
a(k, { class: "text-center" }, {
|
|
141
142
|
default: l(() => [
|
|
142
|
-
|
|
143
|
+
c(
|
|
143
144
|
m(e.$st(e.basisModule.title)),
|
|
144
145
|
1
|
|
145
146
|
/* TEXT */
|
|
@@ -155,30 +156,30 @@ function ee(e, o, t, s, C, I) {
|
|
|
155
156
|
]),
|
|
156
157
|
_: 1
|
|
157
158
|
/* STABLE */
|
|
158
|
-
})) :
|
|
159
|
-
e.nestedCards.length ? (
|
|
160
|
-
|
|
159
|
+
})) : h("v-if", !0),
|
|
160
|
+
e.nestedCards.length ? (u(), B(
|
|
161
|
+
I,
|
|
161
162
|
{ key: 2 },
|
|
162
163
|
[
|
|
163
|
-
a(
|
|
164
|
+
a(w, {
|
|
164
165
|
cols: "auto",
|
|
165
166
|
class: "pa-2"
|
|
166
167
|
}, {
|
|
167
168
|
default: l(() => [
|
|
168
|
-
a(
|
|
169
|
+
a(_, {
|
|
169
170
|
class: "fixed-card hover-card",
|
|
170
171
|
outlined: "",
|
|
171
172
|
onClick: o[0] || (o[0] = (i) => e.showMainCards())
|
|
172
173
|
}, {
|
|
173
174
|
default: l(() => [
|
|
174
|
-
a(
|
|
175
|
+
a(p, { size: "50" }, {
|
|
175
176
|
default: l(() => [
|
|
176
|
-
|
|
177
|
+
c("mdi-arrow-left")
|
|
177
178
|
]),
|
|
178
179
|
_: 1
|
|
179
180
|
/* STABLE */
|
|
180
181
|
}),
|
|
181
|
-
|
|
182
|
+
c(
|
|
182
183
|
" " + m(e.$st("moduleSelector.cardBack")),
|
|
183
184
|
1
|
|
184
185
|
/* TEXT */
|
|
@@ -191,35 +192,35 @@ function ee(e, o, t, s, C, I) {
|
|
|
191
192
|
_: 1
|
|
192
193
|
/* STABLE */
|
|
193
194
|
}),
|
|
194
|
-
(
|
|
195
|
-
|
|
195
|
+
(u(!0), B(
|
|
196
|
+
I,
|
|
196
197
|
null,
|
|
197
|
-
N(e.nestedCards, (i,
|
|
198
|
-
|
|
198
|
+
N(e.nestedCards, (i, v) => (u(), M(
|
|
199
|
+
w,
|
|
199
200
|
{
|
|
200
|
-
key:
|
|
201
|
+
key: v,
|
|
201
202
|
cols: "auto",
|
|
202
203
|
class: "pa-2"
|
|
203
204
|
},
|
|
204
205
|
{
|
|
205
206
|
default: l(() => [
|
|
206
|
-
a(
|
|
207
|
-
class:
|
|
208
|
-
"selected-card": e.plugin.selectedNestedModuleIndex.value ===
|
|
207
|
+
a(_, {
|
|
208
|
+
class: b(["fixed-card hover-card", {
|
|
209
|
+
"selected-card": e.plugin.selectedNestedModuleIndex.value === v
|
|
209
210
|
}]),
|
|
210
211
|
outlined: "",
|
|
211
|
-
onClick: (
|
|
212
|
+
onClick: (A) => e.selectNestedModule(v)
|
|
212
213
|
}, {
|
|
213
214
|
default: l(() => [
|
|
214
|
-
i.icon ? (
|
|
215
|
-
|
|
215
|
+
i.icon ? (u(), M(
|
|
216
|
+
p,
|
|
216
217
|
{
|
|
217
218
|
key: 0,
|
|
218
219
|
size: "50"
|
|
219
220
|
},
|
|
220
221
|
{
|
|
221
222
|
default: l(() => [
|
|
222
|
-
|
|
223
|
+
c(
|
|
223
224
|
m(i.icon),
|
|
224
225
|
1
|
|
225
226
|
/* TEXT */
|
|
@@ -230,13 +231,13 @@ function ee(e, o, t, s, C, I) {
|
|
|
230
231
|
},
|
|
231
232
|
1024
|
|
232
233
|
/* DYNAMIC_SLOTS */
|
|
233
|
-
)) :
|
|
234
|
+
)) : h("v-if", !0),
|
|
234
235
|
a(
|
|
235
|
-
|
|
236
|
+
k,
|
|
236
237
|
{ class: "text-center" },
|
|
237
238
|
{
|
|
238
239
|
default: l(() => [
|
|
239
|
-
|
|
240
|
+
c(
|
|
240
241
|
m(e.$st(i.title)),
|
|
241
242
|
1
|
|
242
243
|
/* TEXT */
|
|
@@ -265,35 +266,35 @@ function ee(e, o, t, s, C, I) {
|
|
|
265
266
|
],
|
|
266
267
|
64
|
|
267
268
|
/* STABLE_FRAGMENT */
|
|
268
|
-
)) : (
|
|
269
|
-
|
|
269
|
+
)) : (u(!0), B(
|
|
270
|
+
I,
|
|
270
271
|
{ key: 1 },
|
|
271
|
-
N(e.modules, (i,
|
|
272
|
-
|
|
272
|
+
N(e.modules, (i, v) => (u(), M(
|
|
273
|
+
w,
|
|
273
274
|
{
|
|
274
275
|
cols: "auto",
|
|
275
276
|
class: "pa-2",
|
|
276
|
-
key:
|
|
277
|
+
key: v
|
|
277
278
|
},
|
|
278
279
|
{
|
|
279
280
|
default: l(() => [
|
|
280
|
-
a(
|
|
281
|
-
class:
|
|
282
|
-
"selected-card": e.plugin.selectedMainModuleIndex.value ===
|
|
281
|
+
a(_, {
|
|
282
|
+
class: b(["fixed-card hover-card", {
|
|
283
|
+
"selected-card": e.plugin.selectedMainModuleIndex.value === v
|
|
283
284
|
}]),
|
|
284
285
|
outlined: "",
|
|
285
|
-
onClick: (
|
|
286
|
+
onClick: (A) => e.selectModule(v)
|
|
286
287
|
}, {
|
|
287
288
|
default: l(() => [
|
|
288
|
-
i.icon ? (
|
|
289
|
-
|
|
289
|
+
i.icon ? (u(), M(
|
|
290
|
+
p,
|
|
290
291
|
{
|
|
291
292
|
key: 0,
|
|
292
293
|
size: "50"
|
|
293
294
|
},
|
|
294
295
|
{
|
|
295
296
|
default: l(() => [
|
|
296
|
-
|
|
297
|
+
c(
|
|
297
298
|
m(i.icon),
|
|
298
299
|
1
|
|
299
300
|
/* TEXT */
|
|
@@ -304,13 +305,13 @@ function ee(e, o, t, s, C, I) {
|
|
|
304
305
|
},
|
|
305
306
|
1024
|
|
306
307
|
/* DYNAMIC_SLOTS */
|
|
307
|
-
)) :
|
|
308
|
+
)) : h("v-if", !0),
|
|
308
309
|
a(
|
|
309
|
-
|
|
310
|
+
k,
|
|
310
311
|
{ class: "text-center" },
|
|
311
312
|
{
|
|
312
313
|
default: l(() => [
|
|
313
|
-
|
|
314
|
+
c(
|
|
314
315
|
m(e.$st(i.title)),
|
|
315
316
|
1
|
|
316
317
|
/* TEXT */
|
|
@@ -342,14 +343,14 @@ function ee(e, o, t, s, C, I) {
|
|
|
342
343
|
}),
|
|
343
344
|
a(n, { justify: "end" }, {
|
|
344
345
|
default: l(() => [
|
|
345
|
-
a(
|
|
346
|
+
a(C, {
|
|
346
347
|
variant: "filled",
|
|
347
348
|
class: "ma-5",
|
|
348
349
|
onClick: e.startApplication,
|
|
349
350
|
disabled: e.isButtonDisabled
|
|
350
351
|
}, {
|
|
351
352
|
default: l(() => [
|
|
352
|
-
|
|
353
|
+
c(
|
|
353
354
|
m(e.$st("moduleSelector.startButton")),
|
|
354
355
|
1
|
|
355
356
|
/* TEXT */
|
|
@@ -371,7 +372,7 @@ function ee(e, o, t, s, C, I) {
|
|
|
371
372
|
/* STABLE */
|
|
372
373
|
});
|
|
373
374
|
}
|
|
374
|
-
const te = /* @__PURE__ */ Y(X, [["render", ee], ["__scopeId", "data-v-
|
|
375
|
+
const te = /* @__PURE__ */ Y(X, [["render", ee], ["__scopeId", "data-v-c33080d7"]]), q = () => ({
|
|
375
376
|
windowTitle: "moduleSelector.title",
|
|
376
377
|
position: {
|
|
377
378
|
left: "33%",
|
|
@@ -383,7 +384,7 @@ const te = /* @__PURE__ */ Y(X, [["render", ee], ["__scopeId", "data-v-1dca4c7d"
|
|
|
383
384
|
function se(e) {
|
|
384
385
|
return {
|
|
385
386
|
get name() {
|
|
386
|
-
return
|
|
387
|
+
return S;
|
|
387
388
|
},
|
|
388
389
|
get version() {
|
|
389
390
|
return W;
|
|
@@ -394,8 +395,8 @@ function se(e) {
|
|
|
394
395
|
get config() {
|
|
395
396
|
return { ...q(), ...e };
|
|
396
397
|
},
|
|
397
|
-
selectedMainModuleIndex:
|
|
398
|
-
selectedNestedModuleIndex:
|
|
398
|
+
selectedMainModuleIndex: T(void 0),
|
|
399
|
+
selectedNestedModuleIndex: T(void 0),
|
|
399
400
|
initialize(o) {
|
|
400
401
|
const t = {
|
|
401
402
|
id: x,
|
|
@@ -418,16 +419,16 @@ function se(e) {
|
|
|
418
419
|
},
|
|
419
420
|
t,
|
|
420
421
|
o.windowManager,
|
|
421
|
-
|
|
422
|
+
S
|
|
422
423
|
);
|
|
423
424
|
return o.navbarManager.add(
|
|
424
425
|
{
|
|
425
426
|
id: s.name,
|
|
426
427
|
action: s
|
|
427
428
|
},
|
|
428
|
-
|
|
429
|
+
S,
|
|
429
430
|
j.PROJECT
|
|
430
|
-
), e.isActiveOnStart && o.windowManager.add(t,
|
|
431
|
+
), e.isActiveOnStart && o.windowManager.add(t, S), Promise.resolve();
|
|
431
432
|
},
|
|
432
433
|
getDefaultOptions: q,
|
|
433
434
|
toJSON() {
|
package/package.json
CHANGED
package/src/ModuleSelector.vue
CHANGED
|
@@ -174,7 +174,7 @@
|
|
|
174
174
|
const mainModuleIndex = plugin.selectedMainModuleIndex.value;
|
|
175
175
|
const nestedModuleIndex = plugin.selectedNestedModuleIndex.value;
|
|
176
176
|
|
|
177
|
-
if (mainModuleIndex === null) return;
|
|
177
|
+
if (mainModuleIndex === null && !props.basisModule) return;
|
|
178
178
|
|
|
179
179
|
const mainModule = modules[mainModuleIndex!];
|
|
180
180
|
const nestedModule =
|
package/src/moduleHelper.ts
CHANGED
|
@@ -24,8 +24,12 @@ export async function loadModule(
|
|
|
24
24
|
|
|
25
25
|
export async function unloadModule(app: VcsUiApp): Promise<void> {
|
|
26
26
|
const moduleId = `moduleSelector_module_id`;
|
|
27
|
+
const activeMapName = app.maps.activeMap?.name;
|
|
27
28
|
const module = app.getModuleById(moduleId);
|
|
28
29
|
if (module) {
|
|
29
30
|
await app.removeModule(moduleId);
|
|
30
31
|
}
|
|
32
|
+
if (!app.maps.activeMap) {
|
|
33
|
+
await app.maps.setActiveMap(activeMapName || [...app.maps][0]?.name);
|
|
34
|
+
}
|
|
31
35
|
}
|