@vcmap/module-selector 2.0.3 → 2.0.4
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 +7 -0
- package/README.md +1 -1
- package/dist/index.js +1408 -988
- package/package.json +3 -3
- package/src/ModuleSelector.vue +115 -15
- package/src/config/CloudModuleSelector.vue +50 -9
- package/src/config/ModuleEditor.vue +16 -0
- package/src/config/ModuleSelectorConfigEditor.vue +240 -156
- package/src/defaultOptions.ts +1 -0
- package/src/index.ts +15 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vcmap/module-selector",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.4",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -45,8 +45,8 @@
|
|
|
45
45
|
],
|
|
46
46
|
"prettier": "@vcsuite/eslint-config/prettier.js",
|
|
47
47
|
"peerDependencies": {
|
|
48
|
-
"@vcmap/core": "^6.0.
|
|
49
|
-
"@vcmap/ui": "^6.0.
|
|
48
|
+
"@vcmap/core": "^6.0.6",
|
|
49
|
+
"@vcmap/ui": "^6.0.10",
|
|
50
50
|
"vue": "~3.4.38",
|
|
51
51
|
"vuetify": "^3.7.3"
|
|
52
52
|
},
|
package/src/ModuleSelector.vue
CHANGED
|
@@ -7,13 +7,25 @@
|
|
|
7
7
|
class="pa-2"
|
|
8
8
|
v-if="basisModule && !nestedCards.length"
|
|
9
9
|
>
|
|
10
|
-
<v-card class="pa-3 fixed-card selected-card" outlined>
|
|
11
|
-
<v-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
<v-card class="pa-3 fixed-card selected-card" variant="outlined">
|
|
11
|
+
<v-tooltip :max-width="300">
|
|
12
|
+
<template #activator="{ props }">
|
|
13
|
+
<v-icon
|
|
14
|
+
v-if="basisModule.description"
|
|
15
|
+
class="top-right-icon"
|
|
16
|
+
v-bind="props"
|
|
17
|
+
>{{ '$vcsInfo' }}
|
|
18
|
+
</v-icon>
|
|
19
|
+
</template>
|
|
20
|
+
<span>{{ $st(basisModule.description) }}</span>
|
|
21
|
+
</v-tooltip>
|
|
22
|
+
<v-icon v-if="basisModule.icon" size="50">
|
|
23
|
+
{{ basisModule.icon }}
|
|
24
|
+
</v-icon>
|
|
25
|
+
|
|
26
|
+
<v-card-title class="text-center">
|
|
27
|
+
{{ $st(basisModule.title) }}
|
|
28
|
+
</v-card-title>
|
|
17
29
|
</v-card>
|
|
18
30
|
</v-col>
|
|
19
31
|
<template v-if="!nestedCards.length">
|
|
@@ -25,16 +37,63 @@
|
|
|
25
37
|
>
|
|
26
38
|
<v-card
|
|
27
39
|
class="fixed-card hover-card"
|
|
28
|
-
outlined
|
|
40
|
+
variant="outlined"
|
|
29
41
|
:class="{
|
|
30
42
|
'selected-card': plugin.selectedMainModuleIndex.value === index,
|
|
43
|
+
'pr-3': module.type === 'group',
|
|
31
44
|
}"
|
|
32
45
|
@click="selectModule(index)"
|
|
33
46
|
>
|
|
34
|
-
<v-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
47
|
+
<v-tooltip :max-width="300">
|
|
48
|
+
<template #activator="{ props }">
|
|
49
|
+
<v-icon
|
|
50
|
+
v-if="module.description"
|
|
51
|
+
class="top-right-icon"
|
|
52
|
+
v-bind="props"
|
|
53
|
+
>{{ '$vcsInfo' }}
|
|
54
|
+
</v-icon>
|
|
55
|
+
</template>
|
|
56
|
+
<span>{{ $st(module.description) }}</span>
|
|
57
|
+
</v-tooltip>
|
|
58
|
+
<v-card
|
|
59
|
+
v-if="module.type === 'group' && module.cards"
|
|
60
|
+
class="intermediate-card"
|
|
61
|
+
variant="outlined"
|
|
62
|
+
:class="{
|
|
63
|
+
'selected-card':
|
|
64
|
+
plugin.selectedMainModuleIndex.value === index,
|
|
65
|
+
'pr-3': module.type === 'group',
|
|
66
|
+
}"
|
|
67
|
+
>
|
|
68
|
+
<v-card
|
|
69
|
+
:variant="
|
|
70
|
+
module.type === 'group' && module.cards
|
|
71
|
+
? 'outlined'
|
|
72
|
+
: undefined
|
|
73
|
+
"
|
|
74
|
+
:class="{
|
|
75
|
+
'selected-card':
|
|
76
|
+
plugin.selectedMainModuleIndex.value === index,
|
|
77
|
+
groupCard: module.type === 'group',
|
|
78
|
+
innerCard: module.type === 'group',
|
|
79
|
+
}"
|
|
80
|
+
>
|
|
81
|
+
<v-icon v-if="module.icon" size="50" class="groupIcon">
|
|
82
|
+
{{ module.icon }}
|
|
83
|
+
</v-icon>
|
|
84
|
+
<v-card-title class="text-center groupTitle">
|
|
85
|
+
{{ $st(module.title) }}
|
|
86
|
+
</v-card-title>
|
|
87
|
+
</v-card></v-card
|
|
88
|
+
>
|
|
89
|
+
<template v-else>
|
|
90
|
+
<v-icon v-if="module.icon" size="50">
|
|
91
|
+
{{ module.icon }}
|
|
92
|
+
</v-icon>
|
|
93
|
+
<v-card-title class="text-center">
|
|
94
|
+
{{ $st(module.title) }}
|
|
95
|
+
</v-card-title>
|
|
96
|
+
</template>
|
|
38
97
|
</v-card>
|
|
39
98
|
</v-col>
|
|
40
99
|
</template>
|
|
@@ -43,7 +102,7 @@
|
|
|
43
102
|
<v-col cols="auto" class="pa-2">
|
|
44
103
|
<v-card
|
|
45
104
|
class="fixed-card hover-card"
|
|
46
|
-
outlined
|
|
105
|
+
variant="outlined"
|
|
47
106
|
@click="showMainCards()"
|
|
48
107
|
>
|
|
49
108
|
<v-icon size="50">mdi-arrow-left</v-icon>
|
|
@@ -58,13 +117,25 @@
|
|
|
58
117
|
>
|
|
59
118
|
<v-card
|
|
60
119
|
class="fixed-card hover-card"
|
|
61
|
-
outlined
|
|
120
|
+
variant="outlined"
|
|
62
121
|
:class="{
|
|
63
122
|
'selected-card':
|
|
64
123
|
plugin.selectedNestedModuleIndex.value === index,
|
|
65
124
|
}"
|
|
66
125
|
@click="selectNestedModule(index)"
|
|
67
126
|
>
|
|
127
|
+
<v-tooltip :max-width="300">
|
|
128
|
+
<template #activator="{ props }">
|
|
129
|
+
<v-icon
|
|
130
|
+
v-if="card.description"
|
|
131
|
+
class="top-right-icon"
|
|
132
|
+
v-bind="props"
|
|
133
|
+
>{{ '$vcsInfo' }}
|
|
134
|
+
</v-icon>
|
|
135
|
+
</template>
|
|
136
|
+
<span>{{ $st(card.description) }}</span>
|
|
137
|
+
</v-tooltip>
|
|
138
|
+
|
|
68
139
|
<v-icon v-if="card.icon" size="50">{{ card.icon }}</v-icon>
|
|
69
140
|
<v-card-title class="text-center">{{
|
|
70
141
|
$st(card.title)
|
|
@@ -104,6 +175,7 @@
|
|
|
104
175
|
VCard,
|
|
105
176
|
VIcon,
|
|
106
177
|
VCardTitle,
|
|
178
|
+
VTooltip,
|
|
107
179
|
} from 'vuetify/components';
|
|
108
180
|
import { VcsFormButton, VcsUiApp } from '@vcmap/ui';
|
|
109
181
|
import { computed, defineComponent, inject, PropType } from 'vue';
|
|
@@ -124,6 +196,7 @@
|
|
|
124
196
|
VIcon,
|
|
125
197
|
VCardTitle,
|
|
126
198
|
VcsFormButton,
|
|
199
|
+
VTooltip,
|
|
127
200
|
},
|
|
128
201
|
props: {
|
|
129
202
|
modules: {
|
|
@@ -204,7 +277,7 @@
|
|
|
204
277
|
});
|
|
205
278
|
</script>
|
|
206
279
|
|
|
207
|
-
<style scoped>
|
|
280
|
+
<style lang="scss" scoped>
|
|
208
281
|
.v-card {
|
|
209
282
|
display: flex;
|
|
210
283
|
flex-direction: column;
|
|
@@ -225,4 +298,31 @@
|
|
|
225
298
|
background-color: rgb(var(--v-theme-primary));
|
|
226
299
|
color: rgb(var(--v-theme-on-primary));
|
|
227
300
|
}
|
|
301
|
+
|
|
302
|
+
.top-right-icon {
|
|
303
|
+
position: absolute;
|
|
304
|
+
top: 8px;
|
|
305
|
+
left: 8px;
|
|
306
|
+
z-index: 10;
|
|
307
|
+
cursor: pointer;
|
|
308
|
+
color: rgb(var(--v-theme-on-surface));
|
|
309
|
+
}
|
|
310
|
+
.groupCard {
|
|
311
|
+
width: 146px;
|
|
312
|
+
background-color: rgb(var(--v-theme-surface));
|
|
313
|
+
border: none !important; /* Removes all borders */
|
|
314
|
+
border-right: 1px solid !important; /* Adds a border to the right */
|
|
315
|
+
}
|
|
316
|
+
.intermediate-card {
|
|
317
|
+
width: 148px;
|
|
318
|
+
background-color: rgb(var(--v-theme-surface));
|
|
319
|
+
border: none !important; /* Removes all borders */
|
|
320
|
+
border-right: 1px solid !important; /* Adds a border to the right */
|
|
321
|
+
}
|
|
322
|
+
.groupTitle {
|
|
323
|
+
margin-left: 20px !important;
|
|
324
|
+
}
|
|
325
|
+
.groupIcon {
|
|
326
|
+
margin-left: 20px !important;
|
|
327
|
+
}
|
|
228
328
|
</style>
|
|
@@ -70,10 +70,23 @@
|
|
|
70
70
|
/>
|
|
71
71
|
</v-col>
|
|
72
72
|
</v-row>
|
|
73
|
+
<v-row no-gutters class="px-2">
|
|
74
|
+
<v-col cols="2">
|
|
75
|
+
<VcsLabel html-for="moduleDescription">
|
|
76
|
+
{{ $st('moduleSelector.configEditor.moduleDescription') }}
|
|
77
|
+
</VcsLabel>
|
|
78
|
+
</v-col>
|
|
79
|
+
<v-col cols="4">
|
|
80
|
+
<VcsTextArea
|
|
81
|
+
id="moduleDescription"
|
|
82
|
+
v-model="selectedItem.description"
|
|
83
|
+
/>
|
|
84
|
+
</v-col>
|
|
85
|
+
</v-row>
|
|
73
86
|
</v-container>
|
|
74
87
|
</v-form>
|
|
75
88
|
</VcsFormSection>
|
|
76
|
-
<div class="d-flex px-2">
|
|
89
|
+
<div class="d-flex px-2 justify-end w-100">
|
|
77
90
|
<VcsFormButton
|
|
78
91
|
v-if="isItemIdEmpty"
|
|
79
92
|
variant="filled"
|
|
@@ -123,6 +136,7 @@
|
|
|
123
136
|
VcsTextField,
|
|
124
137
|
VcsFormSection,
|
|
125
138
|
VcsPlugin,
|
|
139
|
+
VcsTextArea,
|
|
126
140
|
} from '@vcmap/ui';
|
|
127
141
|
import { computed, defineComponent, inject, PropType, ref } from 'vue';
|
|
128
142
|
import {
|
|
@@ -179,6 +193,7 @@
|
|
|
179
193
|
{
|
|
180
194
|
title: 'moduleSelector.configEditor.moduleCloudPicker.headers.name',
|
|
181
195
|
value: 'name',
|
|
196
|
+
sortable: true,
|
|
182
197
|
},
|
|
183
198
|
{
|
|
184
199
|
title: 'moduleSelector.configEditor.moduleCloudPicker.headers.type',
|
|
@@ -189,6 +204,7 @@
|
|
|
189
204
|
title:
|
|
190
205
|
'moduleSelector.configEditor.moduleCloudPicker.headers.description',
|
|
191
206
|
value: 'description',
|
|
207
|
+
sortable: true,
|
|
192
208
|
},
|
|
193
209
|
{
|
|
194
210
|
title:
|
|
@@ -208,11 +224,13 @@
|
|
|
208
224
|
title:
|
|
209
225
|
'moduleSelector.configEditor.moduleCloudPicker.headers.createdBy',
|
|
210
226
|
value: 'createdBy',
|
|
227
|
+
sortable: true,
|
|
211
228
|
},
|
|
212
229
|
{
|
|
213
230
|
title:
|
|
214
231
|
'moduleSelector.configEditor.moduleCloudPicker.headers.updatedBy',
|
|
215
232
|
value: 'updatedBy',
|
|
233
|
+
sortable: true,
|
|
216
234
|
},
|
|
217
235
|
];
|
|
218
236
|
}
|
|
@@ -233,6 +251,7 @@
|
|
|
233
251
|
VCol,
|
|
234
252
|
VForm,
|
|
235
253
|
VContainer,
|
|
254
|
+
VcsTextArea,
|
|
236
255
|
},
|
|
237
256
|
props: {
|
|
238
257
|
modelValue: {
|
|
@@ -241,6 +260,7 @@
|
|
|
241
260
|
title: string;
|
|
242
261
|
icon: string;
|
|
243
262
|
moduleUrl: string;
|
|
263
|
+
description?: string;
|
|
244
264
|
}>,
|
|
245
265
|
required: true,
|
|
246
266
|
},
|
|
@@ -252,10 +272,19 @@
|
|
|
252
272
|
'@vcmap/app-configurator',
|
|
253
273
|
) as VcsPlugin<object, object> & {
|
|
254
274
|
getUserName(userId: string): string;
|
|
255
|
-
config: object & {
|
|
275
|
+
config: object & {
|
|
276
|
+
projectId: string;
|
|
277
|
+
serverUrl: string;
|
|
278
|
+
appId: string;
|
|
279
|
+
token: string;
|
|
280
|
+
};
|
|
256
281
|
};
|
|
257
282
|
|
|
258
|
-
|
|
283
|
+
const { serverUrl, projectId, appId, token } =
|
|
284
|
+
appConfigurator?.config || plugin.config;
|
|
285
|
+
const publisherOptions = { serverUrl, projectId, appId, token };
|
|
286
|
+
|
|
287
|
+
setupPublisherSDK(publisherOptions);
|
|
259
288
|
|
|
260
289
|
const loading = ref(true);
|
|
261
290
|
const items = ref<ModuleTableItem[]>([]);
|
|
@@ -263,7 +292,13 @@
|
|
|
263
292
|
const totalPages = ref(0);
|
|
264
293
|
const selected = ref<
|
|
265
294
|
[
|
|
266
|
-
| {
|
|
295
|
+
| {
|
|
296
|
+
_id: string;
|
|
297
|
+
name: string;
|
|
298
|
+
icon: string;
|
|
299
|
+
moduleUrl: string;
|
|
300
|
+
description?: string;
|
|
301
|
+
}
|
|
267
302
|
| undefined,
|
|
268
303
|
]
|
|
269
304
|
>([undefined]);
|
|
@@ -274,6 +309,7 @@
|
|
|
274
309
|
title: string;
|
|
275
310
|
icon: string;
|
|
276
311
|
moduleUrl: string;
|
|
312
|
+
description?: string;
|
|
277
313
|
}>(props.modelValue);
|
|
278
314
|
const isItemIdEmpty = computed(() => selectedItem.value.id === '');
|
|
279
315
|
|
|
@@ -290,16 +326,16 @@
|
|
|
290
326
|
};
|
|
291
327
|
|
|
292
328
|
function getItems(options: UpdateItemsEvent): void {
|
|
293
|
-
const { itemsPerPage, page, search, sortBy
|
|
329
|
+
const { itemsPerPage, page, search, sortBy } = options;
|
|
294
330
|
loading.value = true;
|
|
295
|
-
if (
|
|
331
|
+
if (publisherOptions.projectId) {
|
|
296
332
|
getProjectModules({
|
|
297
|
-
projectId:
|
|
333
|
+
projectId: publisherOptions.projectId,
|
|
298
334
|
limit: itemsPerPage,
|
|
299
335
|
page: page - 1,
|
|
300
336
|
name: search,
|
|
301
|
-
orderBy: sortBy,
|
|
302
|
-
sort:
|
|
337
|
+
orderBy: sortBy?.map(({ key }) => key),
|
|
338
|
+
sort: sortBy?.[0]?.order as 'asc' | 'desc',
|
|
303
339
|
})
|
|
304
340
|
.then((data) => {
|
|
305
341
|
items.value = data.items.map((i) => {
|
|
@@ -337,6 +373,9 @@
|
|
|
337
373
|
.finally(() => {
|
|
338
374
|
loading.value = false;
|
|
339
375
|
});
|
|
376
|
+
} else {
|
|
377
|
+
items.value = [];
|
|
378
|
+
loading.value = false;
|
|
340
379
|
}
|
|
341
380
|
}
|
|
342
381
|
|
|
@@ -350,12 +389,14 @@
|
|
|
350
389
|
selectedItem.value.title = selected.value[0]!.name;
|
|
351
390
|
selectedItem.value.icon = '';
|
|
352
391
|
selectedItem.value.moduleUrl = `configs/${selected.value[0]!._id}.json`;
|
|
392
|
+
selectedItem.value.description = selected.value[0]!.description;
|
|
353
393
|
}
|
|
354
394
|
};
|
|
355
395
|
const removeSelected = (): void => {
|
|
356
396
|
selectedItem.value.id = '';
|
|
357
397
|
selectedItem.value.title = '';
|
|
358
398
|
selectedItem.value.icon = '';
|
|
399
|
+
selectedItem.value.description = '';
|
|
359
400
|
selectedItem.value.moduleUrl = '';
|
|
360
401
|
};
|
|
361
402
|
|
|
@@ -48,6 +48,19 @@
|
|
|
48
48
|
/>
|
|
49
49
|
</v-col>
|
|
50
50
|
</v-row>
|
|
51
|
+
<v-row no-gutters>
|
|
52
|
+
<v-col cols="6">
|
|
53
|
+
<VcsLabel html-for="moduleDescription">
|
|
54
|
+
{{ $st('moduleSelector.configEditor.moduleDescription') }}
|
|
55
|
+
</VcsLabel>
|
|
56
|
+
</v-col>
|
|
57
|
+
<v-col cols="6">
|
|
58
|
+
<VcsTextArea
|
|
59
|
+
id="moduleDescription"
|
|
60
|
+
v-model="localModuleOptions.description"
|
|
61
|
+
/>
|
|
62
|
+
</v-col>
|
|
63
|
+
</v-row>
|
|
51
64
|
</v-container>
|
|
52
65
|
</v-form>
|
|
53
66
|
<v-divider />
|
|
@@ -76,6 +89,7 @@
|
|
|
76
89
|
VcsFormSection,
|
|
77
90
|
VcsLabel,
|
|
78
91
|
VcsTextField,
|
|
92
|
+
VcsTextArea,
|
|
79
93
|
} from '@vcmap/ui';
|
|
80
94
|
import {
|
|
81
95
|
VCard,
|
|
@@ -100,6 +114,7 @@
|
|
|
100
114
|
VDivider,
|
|
101
115
|
VCard,
|
|
102
116
|
VcsFormSection,
|
|
117
|
+
VcsTextArea,
|
|
103
118
|
},
|
|
104
119
|
props: {
|
|
105
120
|
modelValue: {
|
|
@@ -108,6 +123,7 @@
|
|
|
108
123
|
title: string;
|
|
109
124
|
icon: string;
|
|
110
125
|
moduleUrl: string;
|
|
126
|
+
description?: string;
|
|
111
127
|
}>,
|
|
112
128
|
required: true,
|
|
113
129
|
},
|