@vcmap/module-selector 2.0.6 → 4.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/CHANGELOG.md +10 -0
- package/dist/index.js +658 -705
- package/package.json +15 -17
- package/src/ModuleSelector.vue +26 -18
- package/src/ModuleSelectorEdit.vue +7 -12
- package/src/config/CloudModuleSelector.vue +17 -15
- package/src/config/ModuleEditor.vue +9 -12
- package/src/config/ModuleSelectorConfigEditor.vue +32 -56
- package/src/config/WindowPositionSettings.vue +11 -22
- package/src/config/setupPublisherSDK.ts +1 -2
- package/src/defaultOptions.ts +1 -1
- package/src/index.ts +43 -21
- package/src/moduleHelper.ts +13 -38
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vcmap/module-selector",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -38,35 +38,33 @@
|
|
|
38
38
|
".": "dist/index.js",
|
|
39
39
|
"./dist": "./dist/index.js"
|
|
40
40
|
},
|
|
41
|
-
"eslintIgnore": [
|
|
42
|
-
"node_modules",
|
|
43
|
-
"dist",
|
|
44
|
-
"plugin-assets"
|
|
45
|
-
],
|
|
46
41
|
"prettier": "@vcsuite/eslint-config/prettier.js",
|
|
47
42
|
"peerDependencies": {
|
|
48
|
-
"@vcmap/core": "^6.
|
|
49
|
-
"@vcmap/ui": "^6.
|
|
43
|
+
"@vcmap/core": "^6.1.11",
|
|
44
|
+
"@vcmap/ui": "^6.1.14",
|
|
50
45
|
"vue": "~3.4.38",
|
|
51
|
-
"vuetify": "
|
|
46
|
+
"vuetify": "~3.7.14"
|
|
47
|
+
},
|
|
48
|
+
"overrides": {
|
|
49
|
+
"esbuild": "^0.25.0"
|
|
52
50
|
},
|
|
53
51
|
"devDependencies": {
|
|
54
|
-
"@vcmap/plugin-cli": "^4.
|
|
55
|
-
"@vcsuite/eslint-config": "^
|
|
56
|
-
"@vitest/coverage-v8": "^2.1.
|
|
52
|
+
"@vcmap/plugin-cli": "^4.1.2",
|
|
53
|
+
"@vcsuite/eslint-config": "^4.0.0",
|
|
54
|
+
"@vitest/coverage-v8": "^2.1.9",
|
|
57
55
|
"jest-canvas-mock": "^2.5.2",
|
|
58
56
|
"jsdom": "^24.1.1",
|
|
59
57
|
"resize-observer-polyfill": "^1.5.1",
|
|
60
|
-
"typescript": "^5.
|
|
61
|
-
"vitest": "^2.1.
|
|
62
|
-
"vue-tsc": "^2.
|
|
58
|
+
"typescript": "^5.9.2",
|
|
59
|
+
"vitest": "^2.1.9",
|
|
60
|
+
"vue-tsc": "^2.2.12"
|
|
63
61
|
},
|
|
64
|
-
"mapVersion": "^6.0",
|
|
65
62
|
"dependencies": {
|
|
66
63
|
"@vcsuite/logger": "^1.0.1",
|
|
67
64
|
"@vcsuite/parsers": "^2.0.0",
|
|
68
65
|
"@vcsuite/publisher-sdk": "^5.2.12",
|
|
69
66
|
"fast-deep-equal": "^3.1.3",
|
|
70
67
|
"node-fetch": "^2.7.0"
|
|
71
|
-
}
|
|
68
|
+
},
|
|
69
|
+
"mapVersion": "^6.1"
|
|
72
70
|
}
|
package/src/ModuleSelector.vue
CHANGED
|
@@ -3,16 +3,16 @@
|
|
|
3
3
|
<v-container>
|
|
4
4
|
<v-row class="justify-center align-center" no-gutters>
|
|
5
5
|
<v-col
|
|
6
|
+
v-if="basisModule && !nestedCards.length"
|
|
6
7
|
cols="auto"
|
|
7
8
|
class="pa-2"
|
|
8
|
-
v-if="basisModule && !nestedCards.length"
|
|
9
9
|
>
|
|
10
10
|
<v-card class="pa-3 fixed-card selected-card" variant="outlined">
|
|
11
11
|
<v-tooltip :max-width="300">
|
|
12
12
|
<template #activator="{ props }">
|
|
13
13
|
<v-icon
|
|
14
14
|
v-if="basisModule.description"
|
|
15
|
-
class="top-
|
|
15
|
+
class="top-left-icon"
|
|
16
16
|
v-bind="props"
|
|
17
17
|
>{{ '$vcsInfo' }}
|
|
18
18
|
</v-icon>
|
|
@@ -30,10 +30,10 @@
|
|
|
30
30
|
</v-col>
|
|
31
31
|
<template v-if="!nestedCards.length">
|
|
32
32
|
<v-col
|
|
33
|
+
v-for="(module, index) in modules"
|
|
34
|
+
:key="index"
|
|
33
35
|
cols="auto"
|
|
34
36
|
class="pa-2"
|
|
35
|
-
:key="index"
|
|
36
|
-
v-for="(module, index) in modules"
|
|
37
37
|
>
|
|
38
38
|
<v-card
|
|
39
39
|
class="fixed-card hover-card"
|
|
@@ -48,7 +48,10 @@
|
|
|
48
48
|
<template #activator="{ props }">
|
|
49
49
|
<v-icon
|
|
50
50
|
v-if="module.description"
|
|
51
|
-
class="top-
|
|
51
|
+
class="top-left-icon"
|
|
52
|
+
:class="{
|
|
53
|
+
selected: plugin.selectedMainModuleIndex.value === index,
|
|
54
|
+
}"
|
|
52
55
|
v-bind="props"
|
|
53
56
|
>{{ '$vcsInfo' }}
|
|
54
57
|
</v-icon>
|
|
@@ -128,7 +131,7 @@
|
|
|
128
131
|
<template #activator="{ props }">
|
|
129
132
|
<v-icon
|
|
130
133
|
v-if="card.description"
|
|
131
|
-
class="top-
|
|
134
|
+
class="top-left-icon"
|
|
132
135
|
v-bind="props"
|
|
133
136
|
>{{ '$vcsInfo' }}
|
|
134
137
|
</v-icon>
|
|
@@ -148,16 +151,13 @@
|
|
|
148
151
|
<VcsFormButton
|
|
149
152
|
variant="filled"
|
|
150
153
|
class="ma-5"
|
|
154
|
+
:disabled="isButtonDisabled"
|
|
151
155
|
@click="
|
|
152
|
-
startApplication(
|
|
156
|
+
plugin.startApplication(
|
|
153
157
|
plugin.selectedMainModuleIndex.value,
|
|
154
158
|
plugin.selectedNestedModuleIndex.value,
|
|
155
|
-
app,
|
|
156
|
-
modules,
|
|
157
|
-
basisModule,
|
|
158
159
|
)
|
|
159
160
|
"
|
|
160
|
-
:disabled="isButtonDisabled"
|
|
161
161
|
>
|
|
162
162
|
{{ $st('moduleSelector.startButton') }}
|
|
163
163
|
</VcsFormButton>
|
|
@@ -177,16 +177,20 @@
|
|
|
177
177
|
VCardTitle,
|
|
178
178
|
VTooltip,
|
|
179
179
|
} from 'vuetify/components';
|
|
180
|
-
import {
|
|
181
|
-
import {
|
|
180
|
+
import type { VcsUiApp } from '@vcmap/ui';
|
|
181
|
+
import { VcsFormButton } from '@vcmap/ui';
|
|
182
|
+
import type { PropType } from 'vue';
|
|
183
|
+
import { computed, defineComponent, inject } from 'vue';
|
|
182
184
|
import { name } from '../package.json';
|
|
183
|
-
import {
|
|
184
|
-
|
|
185
|
-
|
|
185
|
+
import type {
|
|
186
|
+
BasisModule,
|
|
187
|
+
ModuleSelectorPlugin,
|
|
188
|
+
ModuleType,
|
|
189
|
+
Module,
|
|
190
|
+
} from './index.js';
|
|
186
191
|
|
|
187
192
|
export default defineComponent({
|
|
188
193
|
name: 'ModuleSelector',
|
|
189
|
-
methods: { startApplication },
|
|
190
194
|
components: {
|
|
191
195
|
VSheet,
|
|
192
196
|
VContainer,
|
|
@@ -299,7 +303,7 @@
|
|
|
299
303
|
color: rgb(var(--v-theme-on-primary));
|
|
300
304
|
}
|
|
301
305
|
|
|
302
|
-
.top-
|
|
306
|
+
.top-left-icon {
|
|
303
307
|
position: absolute;
|
|
304
308
|
top: 8px;
|
|
305
309
|
left: 8px;
|
|
@@ -307,6 +311,10 @@
|
|
|
307
311
|
cursor: pointer;
|
|
308
312
|
color: rgb(var(--v-theme-on-surface));
|
|
309
313
|
}
|
|
314
|
+
.top-left-icon.selected {
|
|
315
|
+
color: rgb(var(--v-theme-on-primary));
|
|
316
|
+
}
|
|
317
|
+
|
|
310
318
|
.groupCard {
|
|
311
319
|
width: 146px;
|
|
312
320
|
background-color: rgb(var(--v-theme-surface));
|
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
<v-col cols="6">
|
|
13
13
|
<VcsSelect
|
|
14
14
|
id="layerName"
|
|
15
|
+
v-model="localModuleOptions.moduleName"
|
|
15
16
|
:items="moduleLocal"
|
|
16
17
|
placeholder="layer"
|
|
17
|
-
v-model="localModuleOptions.moduleName"
|
|
18
18
|
/>
|
|
19
19
|
</v-col>
|
|
20
20
|
</v-row>
|
|
@@ -28,13 +28,13 @@
|
|
|
28
28
|
<VcsFormButton
|
|
29
29
|
class="justify-end relativePosition"
|
|
30
30
|
:disabled="!isFormValid"
|
|
31
|
+
variant="filled"
|
|
31
32
|
@click="
|
|
32
33
|
() => {
|
|
33
34
|
$emit('update:modelValue', localModuleOptions);
|
|
34
35
|
$emit('close');
|
|
35
36
|
}
|
|
36
37
|
"
|
|
37
|
-
variant="filled"
|
|
38
38
|
>
|
|
39
39
|
{{ $st('components.apply') }}
|
|
40
40
|
</VcsFormButton>
|
|
@@ -58,7 +58,8 @@
|
|
|
58
58
|
VCol,
|
|
59
59
|
VRow,
|
|
60
60
|
} from 'vuetify/components';
|
|
61
|
-
import {
|
|
61
|
+
import type { PropType } from 'vue';
|
|
62
|
+
import { defineComponent, ref } from 'vue';
|
|
62
63
|
|
|
63
64
|
interface ModuleOptions {
|
|
64
65
|
moduleName: string | undefined;
|
|
@@ -80,22 +81,16 @@
|
|
|
80
81
|
VcsFormSection,
|
|
81
82
|
},
|
|
82
83
|
props: {
|
|
83
|
-
modelValue: {
|
|
84
|
-
type: Object as PropType<ModuleOptions>,
|
|
85
|
-
required: true,
|
|
86
|
-
},
|
|
84
|
+
modelValue: { type: Object as PropType<ModuleOptions>, required: true },
|
|
87
85
|
},
|
|
86
|
+
emits: ['update:modelValue', 'close'],
|
|
88
87
|
setup(props) {
|
|
89
88
|
const localModuleOptions = ref(structuredClone(props.modelValue));
|
|
90
89
|
const isFormValid = ref(false);
|
|
91
90
|
|
|
92
91
|
const moduleLocal = ref();
|
|
93
92
|
|
|
94
|
-
return {
|
|
95
|
-
localModuleOptions,
|
|
96
|
-
moduleLocal,
|
|
97
|
-
isFormValid,
|
|
98
|
-
};
|
|
93
|
+
return { localModuleOptions, moduleLocal, isFormValid };
|
|
99
94
|
},
|
|
100
95
|
});
|
|
101
96
|
</script>
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
heading="moduleSelector.configEditor.moduleSettings"
|
|
7
7
|
>
|
|
8
8
|
<VcsDataTable
|
|
9
|
+
v-model="selected"
|
|
9
10
|
base-component="VDataTableServer"
|
|
10
11
|
:loading="loading"
|
|
11
12
|
:items="items"
|
|
@@ -19,7 +20,6 @@
|
|
|
19
20
|
return-object
|
|
20
21
|
show-select
|
|
21
22
|
item-value="_id"
|
|
22
|
-
v-model="selected"
|
|
23
23
|
@update:items="getItems"
|
|
24
24
|
>
|
|
25
25
|
<!-- eslint-disable-next-line -->
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
v-else
|
|
46
46
|
heading="moduleSelector.configEditor.moduleSettings"
|
|
47
47
|
>
|
|
48
|
-
<v-form v-model="isFValid"
|
|
48
|
+
<v-form ref="form" v-model="isFValid">
|
|
49
49
|
<v-container class="px-2 pt-0 pb-2">
|
|
50
50
|
<v-row no-gutters class="px-2">
|
|
51
51
|
<v-col cols="2">
|
|
@@ -56,8 +56,8 @@
|
|
|
56
56
|
<v-col cols="4">
|
|
57
57
|
<VcsTextField
|
|
58
58
|
id="moduleName"
|
|
59
|
-
placeholder="Module Name"
|
|
60
59
|
v-model="selectedItem.title"
|
|
60
|
+
placeholder="Module Name"
|
|
61
61
|
:rules="[requiredRule]"
|
|
62
62
|
/>
|
|
63
63
|
</v-col>
|
|
@@ -71,8 +71,8 @@
|
|
|
71
71
|
<v-col cols="4">
|
|
72
72
|
<VcsTextField
|
|
73
73
|
id="moduleIcon"
|
|
74
|
-
placeholder="Icon Name"
|
|
75
74
|
v-model="selectedItem.icon"
|
|
75
|
+
placeholder="Icon Name"
|
|
76
76
|
:rules="[requiredRule]"
|
|
77
77
|
/>
|
|
78
78
|
</v-col>
|
|
@@ -98,9 +98,9 @@
|
|
|
98
98
|
<VcsFormButton
|
|
99
99
|
variant="filled"
|
|
100
100
|
:disabled="selected[0] === undefined"
|
|
101
|
-
@click="addSelected"
|
|
102
101
|
tooltip="appConfigurator.dialogs.addTooltip"
|
|
103
102
|
tooltip-position="bottom"
|
|
103
|
+
@click="addSelected"
|
|
104
104
|
>
|
|
105
105
|
{{ $t('moduleSelector.configEditor.moduleCloudPicker.continue') }}
|
|
106
106
|
</VcsFormButton>
|
|
@@ -138,18 +138,17 @@
|
|
|
138
138
|
</template>
|
|
139
139
|
|
|
140
140
|
<script lang="ts">
|
|
141
|
+
import type { UpdateItemsEvent, VcsUiApp, VcsPlugin } from '@vcmap/ui';
|
|
141
142
|
import {
|
|
142
|
-
UpdateItemsEvent,
|
|
143
143
|
VcsDataTable,
|
|
144
144
|
VcsFormButton,
|
|
145
|
-
VcsUiApp,
|
|
146
145
|
VcsLabel,
|
|
147
146
|
VcsTextField,
|
|
148
147
|
VcsFormSection,
|
|
149
|
-
VcsPlugin,
|
|
150
148
|
VcsTextArea,
|
|
151
149
|
} from '@vcmap/ui';
|
|
152
|
-
import {
|
|
150
|
+
import type { PropType } from 'vue';
|
|
151
|
+
import { computed, defineComponent, inject, ref } from 'vue';
|
|
153
152
|
import {
|
|
154
153
|
VIcon,
|
|
155
154
|
VTooltip,
|
|
@@ -163,7 +162,8 @@
|
|
|
163
162
|
getProjectModules,
|
|
164
163
|
type GetProjectModulesResponse,
|
|
165
164
|
} from '@vcsuite/publisher-sdk';
|
|
166
|
-
import {
|
|
165
|
+
import type { VcsModuleConfig } from '@vcmap/core';
|
|
166
|
+
import { VcsModule } from '@vcmap/core';
|
|
167
167
|
import { getLogger } from '@vcsuite/logger';
|
|
168
168
|
import { name as pluginName } from '../../package.json';
|
|
169
169
|
import { type ModuleSelectorPlugin } from '../index.js';
|
|
@@ -276,6 +276,7 @@
|
|
|
276
276
|
required: true,
|
|
277
277
|
},
|
|
278
278
|
},
|
|
279
|
+
emits: ['submit', 'close'],
|
|
279
280
|
setup(props, { emit }) {
|
|
280
281
|
const app = inject<VcsUiApp>('vcsApp')!;
|
|
281
282
|
const plugin = app.plugins.getByKey(pluginName)! as ModuleSelectorPlugin;
|
|
@@ -331,7 +332,7 @@
|
|
|
331
332
|
!!selectedItem.value?.title && !!selectedItem.value?.icon;
|
|
332
333
|
};
|
|
333
334
|
|
|
334
|
-
const
|
|
335
|
+
const typeIcons = {
|
|
335
336
|
standalone: '$vcsGlobeNature',
|
|
336
337
|
extension: '$vcsShapes',
|
|
337
338
|
};
|
|
@@ -350,6 +351,7 @@
|
|
|
350
351
|
})
|
|
351
352
|
.then((data) => {
|
|
352
353
|
items.value = data.items.map((i) => {
|
|
354
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
353
355
|
const dataTableEntry = {
|
|
354
356
|
name: i.name,
|
|
355
357
|
description: i.description,
|
|
@@ -375,10 +377,10 @@
|
|
|
375
377
|
totalItems.value = data.totalCount;
|
|
376
378
|
totalPages.value = data.totalPages;
|
|
377
379
|
})
|
|
378
|
-
.catch((
|
|
380
|
+
.catch((e: unknown) => {
|
|
379
381
|
getLogger('CloudModuleSelector.vue').error(
|
|
380
382
|
'Failed to load project modules.',
|
|
381
|
-
|
|
383
|
+
String(e),
|
|
382
384
|
);
|
|
383
385
|
})
|
|
384
386
|
.finally(() => {
|
|
@@ -423,8 +425,8 @@
|
|
|
423
425
|
totalPages,
|
|
424
426
|
headers,
|
|
425
427
|
selected,
|
|
426
|
-
typeIcon(type: keyof typeof
|
|
427
|
-
return
|
|
428
|
+
typeIcon(type: keyof typeof typeIcons): string {
|
|
429
|
+
return typeIcons[type];
|
|
428
430
|
},
|
|
429
431
|
formatDate,
|
|
430
432
|
getItems,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<v-card>
|
|
3
3
|
<VcsFormSection heading="moduleSelector.configEditor.moduleSettings">
|
|
4
|
-
<v-form v-model="isFormValid"
|
|
4
|
+
<v-form ref="form" v-model="isFormValid">
|
|
5
5
|
<v-container class="px-2 pt-0 pb-2">
|
|
6
6
|
<v-row no-gutters>
|
|
7
7
|
<v-col cols="6">
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
<v-col cols="6">
|
|
13
13
|
<VcsTextField
|
|
14
14
|
id="moduleName"
|
|
15
|
-
placeholder="Module Name"
|
|
16
15
|
v-model="localModuleOptions.title"
|
|
16
|
+
placeholder="Module Name"
|
|
17
17
|
:rules="[requiredRule]"
|
|
18
18
|
/>
|
|
19
19
|
</v-col>
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
<v-col cols="6">
|
|
28
28
|
<VcsTextField
|
|
29
29
|
id="moduleIcon"
|
|
30
|
-
placeholder="Icon Name"
|
|
31
30
|
v-model="localModuleOptions.icon"
|
|
31
|
+
placeholder="Icon Name"
|
|
32
32
|
:rules="[requiredRule]"
|
|
33
33
|
/>
|
|
34
34
|
</v-col>
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
<v-col cols="6">
|
|
43
43
|
<VcsTextField
|
|
44
44
|
id="moduleUrl"
|
|
45
|
-
placeholder="URL"
|
|
46
45
|
v-model="localModuleOptions.moduleUrl"
|
|
46
|
+
placeholder="URL"
|
|
47
47
|
:rules="[requiredRule]"
|
|
48
48
|
/>
|
|
49
49
|
</v-col>
|
|
@@ -67,12 +67,12 @@
|
|
|
67
67
|
<div class="d-flex gc-2 w-100 justify-end pa-2">
|
|
68
68
|
<VcsFormButton
|
|
69
69
|
:disabled="!isFormValid"
|
|
70
|
+
variant="filled"
|
|
70
71
|
@click="
|
|
71
72
|
() => {
|
|
72
73
|
$emit('submit', localModuleOptions);
|
|
73
74
|
}
|
|
74
75
|
"
|
|
75
|
-
variant="filled"
|
|
76
76
|
>
|
|
77
77
|
{{ $st('components.apply') }}
|
|
78
78
|
</VcsFormButton>
|
|
@@ -99,7 +99,8 @@
|
|
|
99
99
|
VCol,
|
|
100
100
|
VRow,
|
|
101
101
|
} from 'vuetify/components';
|
|
102
|
-
import {
|
|
102
|
+
import type { PropType } from 'vue';
|
|
103
|
+
import { defineComponent, ref } from 'vue';
|
|
103
104
|
|
|
104
105
|
export default defineComponent({
|
|
105
106
|
name: 'ModuleEditor',
|
|
@@ -128,6 +129,7 @@
|
|
|
128
129
|
required: true,
|
|
129
130
|
},
|
|
130
131
|
},
|
|
132
|
+
emits: ['submit', 'close'],
|
|
131
133
|
setup(props) {
|
|
132
134
|
const localModuleOptions = ref(props.modelValue); // structuredClone
|
|
133
135
|
const isFormValid = ref(false);
|
|
@@ -139,12 +141,7 @@
|
|
|
139
141
|
const requiredRule = (value: string): string | boolean =>
|
|
140
142
|
!!value || 'moduleSelector.configEditor.editorError';
|
|
141
143
|
|
|
142
|
-
return {
|
|
143
|
-
localModuleOptions,
|
|
144
|
-
isFormValid,
|
|
145
|
-
validateForm,
|
|
146
|
-
requiredRule,
|
|
147
|
-
};
|
|
144
|
+
return { localModuleOptions, isFormValid, validateForm, requiredRule };
|
|
148
145
|
},
|
|
149
146
|
});
|
|
150
147
|
</script>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<AbstractConfigEditor
|
|
3
|
-
@submit="apply"
|
|
4
3
|
v-if="localConfig"
|
|
5
4
|
v-bind="{ ...$attrs, ...$props }"
|
|
5
|
+
@submit="apply"
|
|
6
6
|
>
|
|
7
7
|
<v-container class="py-0 px-0">
|
|
8
8
|
<VcsFormSection heading="moduleSelector.configEditor.general">
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
<v-col>
|
|
17
17
|
<VcsTextField
|
|
18
18
|
id="moduleselector-window-title"
|
|
19
|
-
:placeholder="$st('moduleSelector.title')"
|
|
20
19
|
v-model="localConfig.windowTitle"
|
|
20
|
+
:placeholder="$st('moduleSelector.title')"
|
|
21
21
|
/>
|
|
22
22
|
</v-col>
|
|
23
23
|
</v-row>
|
|
@@ -60,6 +60,7 @@
|
|
|
60
60
|
<v-col>
|
|
61
61
|
<VcsTextField
|
|
62
62
|
id="basisModuleName"
|
|
63
|
+
v-model="basisModule.title"
|
|
63
64
|
placeholder="Base Module"
|
|
64
65
|
:rules="[
|
|
65
66
|
basisModuleExists &&
|
|
@@ -67,7 +68,6 @@
|
|
|
67
68
|
? () => 'moduleSelector.configEditor.error'
|
|
68
69
|
: () => true,
|
|
69
70
|
]"
|
|
70
|
-
v-model="basisModule.title"
|
|
71
71
|
/>
|
|
72
72
|
</v-col>
|
|
73
73
|
</v-row>
|
|
@@ -80,6 +80,7 @@
|
|
|
80
80
|
<v-col>
|
|
81
81
|
<VcsTextField
|
|
82
82
|
id="basisModuleIcon"
|
|
83
|
+
v-model="basisModule.icon"
|
|
83
84
|
placeholder="mdi-home-city"
|
|
84
85
|
:rules="[
|
|
85
86
|
basisModuleExists &&
|
|
@@ -87,7 +88,6 @@
|
|
|
87
88
|
? () => 'moduleSelector.configEditor.error'
|
|
88
89
|
: () => true,
|
|
89
90
|
]"
|
|
90
|
-
v-model="basisModule.icon"
|
|
91
91
|
/>
|
|
92
92
|
</v-col>
|
|
93
93
|
</v-row>
|
|
@@ -124,8 +124,8 @@
|
|
|
124
124
|
<v-col>
|
|
125
125
|
<VcsTextField
|
|
126
126
|
id="groupModuleName"
|
|
127
|
-
placeholder="Module Name"
|
|
128
127
|
v-model="currentGroup.title"
|
|
128
|
+
placeholder="Module Name"
|
|
129
129
|
:rules="[isRequired]"
|
|
130
130
|
/>
|
|
131
131
|
</v-col>
|
|
@@ -139,8 +139,8 @@
|
|
|
139
139
|
<v-col>
|
|
140
140
|
<VcsTextField
|
|
141
141
|
id="groupModuleIcon"
|
|
142
|
-
placeholder="Module Icon"
|
|
143
142
|
v-model="currentGroup.icon"
|
|
143
|
+
placeholder="Module Icon"
|
|
144
144
|
:rules="[isRequired]"
|
|
145
145
|
/>
|
|
146
146
|
</v-col>
|
|
@@ -154,8 +154,8 @@
|
|
|
154
154
|
<v-col>
|
|
155
155
|
<VcsTextArea
|
|
156
156
|
id="groupModuleDescription"
|
|
157
|
-
placeholder=""
|
|
158
157
|
v-model="currentGroup.description"
|
|
158
|
+
placeholder=""
|
|
159
159
|
/>
|
|
160
160
|
</v-col>
|
|
161
161
|
</v-row>
|
|
@@ -247,28 +247,19 @@
|
|
|
247
247
|
</template>
|
|
248
248
|
|
|
249
249
|
<script lang="ts">
|
|
250
|
+
import type { VcsAction, VcsListItem } from '@vcmap/ui';
|
|
250
251
|
import {
|
|
251
252
|
AbstractConfigEditor,
|
|
252
|
-
VcsAction,
|
|
253
253
|
VcsCheckbox,
|
|
254
254
|
VcsFormSection,
|
|
255
255
|
VcsLabel,
|
|
256
256
|
VcsList,
|
|
257
|
-
VcsListItem,
|
|
258
257
|
VcsTextField,
|
|
259
258
|
VcsTextArea,
|
|
260
259
|
VcsFormButton,
|
|
261
260
|
} from '@vcmap/ui';
|
|
262
|
-
import {
|
|
263
|
-
|
|
264
|
-
defineComponent,
|
|
265
|
-
PropType,
|
|
266
|
-
reactive,
|
|
267
|
-
Ref,
|
|
268
|
-
ref,
|
|
269
|
-
toRaw,
|
|
270
|
-
watch,
|
|
271
|
-
} from 'vue';
|
|
261
|
+
import type { PropType } from 'vue';
|
|
262
|
+
import { computed, defineComponent, reactive, ref, toRaw, watch } from 'vue';
|
|
272
263
|
import {
|
|
273
264
|
VCol,
|
|
274
265
|
VContainer,
|
|
@@ -278,7 +269,7 @@
|
|
|
278
269
|
VForm,
|
|
279
270
|
} from 'vuetify/components';
|
|
280
271
|
import ModuleEditor from './ModuleEditor.vue';
|
|
281
|
-
import { Module, ModuleSelectorConfig, ModuleType } from '../index';
|
|
272
|
+
import type { Module, ModuleSelectorConfig, ModuleType } from '../index';
|
|
282
273
|
import getDefaultOptions from '../defaultOptions.js';
|
|
283
274
|
import WindowPositionSettings from './WindowPositionSettings.vue';
|
|
284
275
|
import CloudModuleSelector from './CloudModuleSelector.vue';
|
|
@@ -334,18 +325,20 @@
|
|
|
334
325
|
},
|
|
335
326
|
setup(props) {
|
|
336
327
|
const level = ref<number>(0);
|
|
337
|
-
const localConfig = ref<ModuleSelectorConfig
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
const
|
|
328
|
+
const localConfig = ref<ModuleSelectorConfig>({
|
|
329
|
+
...getDefaultOptions(),
|
|
330
|
+
...props.getConfig(),
|
|
331
|
+
});
|
|
332
|
+
const listItemArray = ref<VcsListItemWithLabel[]>([]);
|
|
333
|
+
const currentGroup = ref<VcsListItemWithLabel>();
|
|
334
|
+
const editingItem = ref<ModuleItem>({
|
|
342
335
|
id: '',
|
|
343
336
|
title: '',
|
|
344
337
|
icon: '',
|
|
345
338
|
moduleUrl: '',
|
|
346
339
|
description: '',
|
|
347
340
|
});
|
|
348
|
-
const selectCloudItem
|
|
341
|
+
const selectCloudItem = ref<ModuleItem>({
|
|
349
342
|
id: '',
|
|
350
343
|
title: '',
|
|
351
344
|
icon: '',
|
|
@@ -361,15 +354,10 @@
|
|
|
361
354
|
cards: [],
|
|
362
355
|
};
|
|
363
356
|
|
|
364
|
-
const selectCloudItemDialogVisible
|
|
365
|
-
const editingItemDialogVisible
|
|
366
|
-
const groupItemDialogVisible
|
|
367
|
-
const listItems
|
|
368
|
-
|
|
369
|
-
localConfig.value = {
|
|
370
|
-
...getDefaultOptions(),
|
|
371
|
-
...props.getConfig(),
|
|
372
|
-
} as ModuleSelectorConfig;
|
|
357
|
+
const selectCloudItemDialogVisible = ref<boolean>(false);
|
|
358
|
+
const editingItemDialogVisible = ref<boolean>(false);
|
|
359
|
+
const groupItemDialogVisible = ref<boolean>(false);
|
|
360
|
+
const listItems = ref<VcsListItemWithLabel[] | undefined>(undefined);
|
|
373
361
|
|
|
374
362
|
const basisModule = ref();
|
|
375
363
|
|
|
@@ -396,6 +384,7 @@
|
|
|
396
384
|
): Module<ModuleType> {
|
|
397
385
|
if (item.type === 'url') {
|
|
398
386
|
const { actions, id, name, ...configItem } = item;
|
|
387
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
399
388
|
return {
|
|
400
389
|
...configItem,
|
|
401
390
|
moduleUrl: item.moduleUrl || '',
|
|
@@ -404,11 +393,11 @@
|
|
|
404
393
|
const updatedCards =
|
|
405
394
|
item.cards?.map((card) => {
|
|
406
395
|
const { actions, id, name, ...configItem } = card;
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
} as Module<'url'>;
|
|
396
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
397
|
+
return { ...configItem } as Module<'url'>;
|
|
410
398
|
}) || [];
|
|
411
399
|
const { actions, id, name, ...configItem } = item;
|
|
400
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
412
401
|
return {
|
|
413
402
|
...configItem,
|
|
414
403
|
...(updatedCards.length ? { cards: updatedCards } : {}),
|
|
@@ -639,17 +628,12 @@
|
|
|
639
628
|
(i) => i.id === editingItem.value?.id,
|
|
640
629
|
);
|
|
641
630
|
if (item) {
|
|
642
|
-
Object.assign(item, {
|
|
643
|
-
...editingItem.value,
|
|
644
|
-
});
|
|
631
|
+
Object.assign(item, { ...editingItem.value });
|
|
645
632
|
}
|
|
646
633
|
} else {
|
|
647
634
|
listItemArray.value.push(
|
|
648
635
|
createListItem(
|
|
649
|
-
{
|
|
650
|
-
...editingItem.value,
|
|
651
|
-
type: 'url',
|
|
652
|
-
},
|
|
636
|
+
{ ...editingItem.value, type: 'url' },
|
|
653
637
|
listItemArray.value.length,
|
|
654
638
|
),
|
|
655
639
|
);
|
|
@@ -660,9 +644,7 @@
|
|
|
660
644
|
(i) => i.id === editingItem.value.id,
|
|
661
645
|
);
|
|
662
646
|
if (item) {
|
|
663
|
-
Object.assign(item, {
|
|
664
|
-
...editingItem.value,
|
|
665
|
-
});
|
|
647
|
+
Object.assign(item, { ...editingItem.value });
|
|
666
648
|
}
|
|
667
649
|
|
|
668
650
|
let groupId;
|
|
@@ -677,10 +659,7 @@
|
|
|
677
659
|
} else {
|
|
678
660
|
currentGroup.value.cards!.push(
|
|
679
661
|
createListItem(
|
|
680
|
-
{
|
|
681
|
-
...editingItem.value,
|
|
682
|
-
type: 'url',
|
|
683
|
-
},
|
|
662
|
+
{ ...editingItem.value, type: 'url' },
|
|
684
663
|
currentGroup.value.cards!.length,
|
|
685
664
|
),
|
|
686
665
|
);
|
|
@@ -725,10 +704,7 @@
|
|
|
725
704
|
} else {
|
|
726
705
|
currentGroup.value.cards!.push(
|
|
727
706
|
createListItem(
|
|
728
|
-
{
|
|
729
|
-
...selectCloudItem.value,
|
|
730
|
-
type: 'url',
|
|
731
|
-
},
|
|
707
|
+
{ ...selectCloudItem.value, type: 'url' },
|
|
732
708
|
currentGroup.value.cards!.length,
|
|
733
709
|
),
|
|
734
710
|
);
|