@vcmap/module-selector 2.0.3 → 2.0.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vcmap/module-selector",
3
- "version": "2.0.3",
3
+ "version": "2.0.5",
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.5",
49
- "@vcmap/ui": "^6.0.7",
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
  },
@@ -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-icon v-if="basisModule.icon" size="50">{{
12
- basisModule.icon
13
- }}</v-icon>
14
- <v-card-title class="text-center">{{
15
- $st(basisModule.title)
16
- }}</v-card-title>
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-icon v-if="module.icon" size="50">{{ module.icon }}</v-icon>
35
- <v-card-title class="text-center">{{
36
- $st(module.title)
37
- }}</v-card-title>
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)
@@ -73,7 +144,7 @@
73
144
  </v-col>
74
145
  </template>
75
146
  </v-row>
76
- <v-row justify="end">
147
+ <v-row class="fixed-bottom" justify="end">
77
148
  <VcsFormButton
78
149
  variant="filled"
79
150
  class="ma-5"
@@ -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,37 @@
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
+ }
328
+ .fixed-bottom {
329
+ position: sticky;
330
+ bottom: 0;
331
+ background-color: rgb(var(--v-theme-surface));
332
+ z-index: 10;
333
+ }
228
334
  </style>
@@ -1,43 +1,50 @@
1
1
  <template>
2
2
  <v-card>
3
3
  <div>
4
- <VcsDataTable
4
+ <VcsFormSection
5
5
  v-if="isItemIdEmpty"
6
- base-component="VDataTableServer"
7
- :loading="loading"
8
- :items="items"
9
- :server-items-length="totalItems"
10
- :server-pages-length="totalPages"
11
- :searchbar-placeholder="
12
- $t('moduleSelector.configEditor.moduleCloudPicker.searchName')
13
- "
14
- :headers="headers"
15
- select-strategy="single"
16
- return-object
17
- show-select
18
- item-value="_id"
19
- v-model="selected"
20
- @update:items="getItems"
6
+ heading="moduleSelector.configEditor.moduleSettings"
7
+ >
8
+ <VcsDataTable
9
+ base-component="VDataTableServer"
10
+ :loading="loading"
11
+ :items="items"
12
+ :server-items-length="totalItems"
13
+ :server-pages-length="totalPages"
14
+ :searchbar-placeholder="
15
+ $t('moduleSelector.configEditor.moduleCloudPicker.searchName')
16
+ "
17
+ :headers="headers"
18
+ select-strategy="single"
19
+ return-object
20
+ show-select
21
+ item-value="_id"
22
+ v-model="selected"
23
+ @update:items="getItems"
24
+ >
25
+ <!-- eslint-disable-next-line -->
26
+ <template v-slot:item.type="{ item }">
27
+ <v-icon v-bind="{ ...$attrs }">
28
+ {{ typeIcon(item.type) }}
29
+ </v-icon>
30
+ <v-tooltip activator="parent" location="right">
31
+ {{ $t(`appConfigurator.dialogs.vcsModuleTable.${item.type}`) }}
32
+ </v-tooltip>
33
+ </template>
34
+ <!-- eslint-disable-next-line -->
35
+ <template v-slot:item.createdAt="{ item }">
36
+ {{ formatDate(item.createdAt, $i18n.locale) }}
37
+ </template>
38
+ <!-- eslint-disable-next-line -->
39
+ <template v-slot:item.updatedAt="{ item }">
40
+ {{ formatDate(item.updatedAt, $i18n.locale) }}
41
+ </template>
42
+ </VcsDataTable>
43
+ </VcsFormSection>
44
+ <VcsFormSection
45
+ v-else
46
+ heading="moduleSelector.configEditor.moduleSettings"
21
47
  >
22
- <!-- eslint-disable-next-line -->
23
- <template v-slot:item.type="{ item }">
24
- <v-icon v-bind="{ ...$attrs }">
25
- {{ typeIcon(item.type) }}
26
- </v-icon>
27
- <v-tooltip activator="parent" location="right">
28
- {{ $t(`appConfigurator.dialogs.vcsModuleTable.${item.type}`) }}
29
- </v-tooltip>
30
- </template>
31
- <!-- eslint-disable-next-line -->
32
- <template v-slot:item.createdAt="{ item }">
33
- {{ formatDate(item.createdAt, $i18n.locale) }}
34
- </template>
35
- <!-- eslint-disable-next-line -->
36
- <template v-slot:item.updatedAt="{ item }">
37
- {{ formatDate(item.updatedAt, $i18n.locale) }}
38
- </template>
39
- </VcsDataTable>
40
- <VcsFormSection v-else>
41
48
  <v-form v-model="isFValid" ref="form">
42
49
  <v-container class="px-2 pt-0 pb-2">
43
50
  <v-row no-gutters class="px-2">
@@ -70,44 +77,61 @@
70
77
  />
71
78
  </v-col>
72
79
  </v-row>
80
+ <v-row no-gutters class="px-2">
81
+ <v-col cols="2">
82
+ <VcsLabel html-for="moduleDescription">
83
+ {{ $st('moduleSelector.configEditor.moduleDescription') }}
84
+ </VcsLabel>
85
+ </v-col>
86
+ <v-col cols="4">
87
+ <VcsTextArea
88
+ id="moduleDescription"
89
+ v-model="selectedItem.description"
90
+ />
91
+ </v-col>
92
+ </v-row>
73
93
  </v-container>
74
94
  </v-form>
75
95
  </VcsFormSection>
76
- <div class="d-flex px-2">
77
- <VcsFormButton
78
- v-if="isItemIdEmpty"
79
- variant="filled"
80
- :disabled="selected[0] === undefined"
81
- class="ma-2"
82
- @click="addSelected"
83
- tooltip="appConfigurator.dialogs.addTooltip"
84
- tooltip-position="bottom"
85
- >
86
- {{ $t('moduleSelector.configEditor.moduleCloudPicker.continue') }}
87
- </VcsFormButton>
88
- <VcsFormButton
89
- v-if="!isItemIdEmpty"
90
- :disabled="!isFValid"
91
- variant="filled"
92
- class="ma-2"
93
- @click="
94
- () => {
95
- $emit('submit', selectedItem);
96
- }
97
- "
98
- >
99
- {{ $t('components.apply') }}
100
- </VcsFormButton>
101
- <VcsFormButton
96
+ <div class="d-flex gc-2 px-2 pt-2 pb-2">
97
+ <div v-if="isItemIdEmpty" class="d-flex gc-2 justify-end w-100">
98
+ <VcsFormButton
99
+ variant="filled"
100
+ :disabled="selected[0] === undefined"
101
+ @click="addSelected"
102
+ tooltip="appConfigurator.dialogs.addTooltip"
103
+ tooltip-position="bottom"
104
+ >
105
+ {{ $t('moduleSelector.configEditor.moduleCloudPicker.continue') }}
106
+ </VcsFormButton>
107
+ <VcsFormButton @click="close">
108
+ {{ $t('components.cancel') }}
109
+ </VcsFormButton>
110
+ </div>
111
+ <div
102
112
  v-if="!isItemIdEmpty"
103
- @click="removeSelected"
104
- class="ma-2"
113
+ class="d-flex gc-2 justify-space-between w-100"
105
114
  >
106
- {{ $t('moduleSelector.configEditor.moduleCloudPicker.back') }}
107
- </VcsFormButton>
108
- <VcsFormButton class="ma-2" @click="close">
109
- {{ $t('components.cancel') }}
110
- </VcsFormButton>
115
+ <VcsFormButton @click="removeSelected">
116
+ {{ $t('moduleSelector.configEditor.moduleCloudPicker.back') }}
117
+ </VcsFormButton>
118
+ <div class="d-flex gc-2">
119
+ <VcsFormButton
120
+ :disabled="!isFValid"
121
+ variant="filled"
122
+ @click="
123
+ () => {
124
+ $emit('submit', selectedItem);
125
+ }
126
+ "
127
+ >
128
+ {{ $t('components.apply') }}
129
+ </VcsFormButton>
130
+ <VcsFormButton @click="close">
131
+ {{ $t('components.cancel') }}
132
+ </VcsFormButton>
133
+ </div>
134
+ </div>
111
135
  </div>
112
136
  </div>
113
137
  </v-card>
@@ -123,6 +147,7 @@
123
147
  VcsTextField,
124
148
  VcsFormSection,
125
149
  VcsPlugin,
150
+ VcsTextArea,
126
151
  } from '@vcmap/ui';
127
152
  import { computed, defineComponent, inject, PropType, ref } from 'vue';
128
153
  import {
@@ -179,6 +204,7 @@
179
204
  {
180
205
  title: 'moduleSelector.configEditor.moduleCloudPicker.headers.name',
181
206
  value: 'name',
207
+ sortable: true,
182
208
  },
183
209
  {
184
210
  title: 'moduleSelector.configEditor.moduleCloudPicker.headers.type',
@@ -189,6 +215,7 @@
189
215
  title:
190
216
  'moduleSelector.configEditor.moduleCloudPicker.headers.description',
191
217
  value: 'description',
218
+ sortable: true,
192
219
  },
193
220
  {
194
221
  title:
@@ -208,11 +235,13 @@
208
235
  title:
209
236
  'moduleSelector.configEditor.moduleCloudPicker.headers.createdBy',
210
237
  value: 'createdBy',
238
+ sortable: true,
211
239
  },
212
240
  {
213
241
  title:
214
242
  'moduleSelector.configEditor.moduleCloudPicker.headers.updatedBy',
215
243
  value: 'updatedBy',
244
+ sortable: true,
216
245
  },
217
246
  ];
218
247
  }
@@ -233,6 +262,7 @@
233
262
  VCol,
234
263
  VForm,
235
264
  VContainer,
265
+ VcsTextArea,
236
266
  },
237
267
  props: {
238
268
  modelValue: {
@@ -241,6 +271,7 @@
241
271
  title: string;
242
272
  icon: string;
243
273
  moduleUrl: string;
274
+ description?: string;
244
275
  }>,
245
276
  required: true,
246
277
  },
@@ -252,10 +283,19 @@
252
283
  '@vcmap/app-configurator',
253
284
  ) as VcsPlugin<object, object> & {
254
285
  getUserName(userId: string): string;
255
- config: object & { projectId: string };
286
+ config: object & {
287
+ projectId: string;
288
+ serverUrl: string;
289
+ appId: string;
290
+ token: string;
291
+ };
256
292
  };
257
293
 
258
- setupPublisherSDK(appConfigurator.config || plugin.config);
294
+ const { serverUrl, projectId, appId, token } =
295
+ appConfigurator?.config || plugin.config;
296
+ const publisherOptions = { serverUrl, projectId, appId, token };
297
+
298
+ setupPublisherSDK(publisherOptions);
259
299
 
260
300
  const loading = ref(true);
261
301
  const items = ref<ModuleTableItem[]>([]);
@@ -263,7 +303,13 @@
263
303
  const totalPages = ref(0);
264
304
  const selected = ref<
265
305
  [
266
- | { _id: string; name: string; icon: string; moduleUrl: string }
306
+ | {
307
+ _id: string;
308
+ name: string;
309
+ icon: string;
310
+ moduleUrl: string;
311
+ description?: string;
312
+ }
267
313
  | undefined,
268
314
  ]
269
315
  >([undefined]);
@@ -274,6 +320,7 @@
274
320
  title: string;
275
321
  icon: string;
276
322
  moduleUrl: string;
323
+ description?: string;
277
324
  }>(props.modelValue);
278
325
  const isItemIdEmpty = computed(() => selectedItem.value.id === '');
279
326
 
@@ -290,16 +337,16 @@
290
337
  };
291
338
 
292
339
  function getItems(options: UpdateItemsEvent): void {
293
- const { itemsPerPage, page, search, sortBy, sortDesc } = options;
340
+ const { itemsPerPage, page, search, sortBy } = options;
294
341
  loading.value = true;
295
- if (appConfigurator?.config?.projectId) {
342
+ if (publisherOptions.projectId) {
296
343
  getProjectModules({
297
- projectId: appConfigurator.config.projectId,
344
+ projectId: publisherOptions.projectId,
298
345
  limit: itemsPerPage,
299
346
  page: page - 1,
300
347
  name: search,
301
- orderBy: sortBy,
302
- sort: sortDesc?.[0] ? 'desc' : 'asc',
348
+ orderBy: sortBy?.map(({ key }) => key),
349
+ sort: sortBy?.[0]?.order as 'asc' | 'desc',
303
350
  })
304
351
  .then((data) => {
305
352
  items.value = data.items.map((i) => {
@@ -337,6 +384,9 @@
337
384
  .finally(() => {
338
385
  loading.value = false;
339
386
  });
387
+ } else {
388
+ items.value = [];
389
+ loading.value = false;
340
390
  }
341
391
  }
342
392
 
@@ -350,12 +400,14 @@
350
400
  selectedItem.value.title = selected.value[0]!.name;
351
401
  selectedItem.value.icon = '';
352
402
  selectedItem.value.moduleUrl = `configs/${selected.value[0]!._id}.json`;
403
+ selectedItem.value.description = selected.value[0]!.description;
353
404
  }
354
405
  };
355
406
  const removeSelected = (): void => {
356
407
  selectedItem.value.id = '';
357
408
  selectedItem.value.title = '';
358
409
  selectedItem.value.icon = '';
410
+ selectedItem.value.description = '';
359
411
  selectedItem.value.moduleUrl = '';
360
412
  };
361
413
 
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <v-card>
3
- <VcsFormSection>
3
+ <VcsFormSection heading="moduleSelector.configEditor.moduleSettings">
4
4
  <v-form v-model="isFormValid" ref="form">
5
5
  <v-container class="px-2 pt-0 pb-2">
6
6
  <v-row no-gutters>
@@ -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
  },