@vcmap/module-selector 2.0.0-rc.2 → 2.0.1

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.0-rc.2",
3
+ "version": "2.0.1",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -45,13 +45,13 @@
45
45
  ],
46
46
  "prettier": "@vcsuite/eslint-config/prettier.js",
47
47
  "peerDependencies": {
48
- "@vcmap/core": "^6.0.0-rc.10",
49
- "@vcmap/ui": "^6.0.0-rc.9",
48
+ "@vcmap/core": "^6.0.0",
49
+ "@vcmap/ui": "^6.0.1",
50
50
  "vue": "~3.4.38",
51
- "vuetify": "^3.7.2"
51
+ "vuetify": "^3.7.3"
52
52
  },
53
53
  "devDependencies": {
54
- "@vcmap/plugin-cli": "^4.0.0-rc.5",
54
+ "@vcmap/plugin-cli": "^4.0.0",
55
55
  "@vcsuite/eslint-config": "^3.0.8",
56
56
  "@vitest/coverage-v8": "^2.1.1",
57
57
  "jest-canvas-mock": "^2.5.2",
@@ -61,5 +61,10 @@
61
61
  "vitest": "^2.1.1",
62
62
  "vue-tsc": "^2.1.6"
63
63
  },
64
- "mapVersion": "^6.0"
64
+ "mapVersion": "^6.0",
65
+ "dependencies": {
66
+ "@vcsuite/logger": "^1.0.1",
67
+ "@vcsuite/parsers": "^2.0.0",
68
+ "fast-deep-equal": "^3.1.3"
69
+ }
65
70
  }
@@ -77,7 +77,15 @@
77
77
  <VcsFormButton
78
78
  variant="filled"
79
79
  class="ma-5"
80
- @click="startApplication"
80
+ @click="
81
+ startApplication(
82
+ plugin.selectedMainModuleIndex.value,
83
+ plugin.selectedNestedModuleIndex.value,
84
+ app,
85
+ modules,
86
+ basisModule,
87
+ )
88
+ "
81
89
  :disabled="isButtonDisabled"
82
90
  >
83
91
  {{ $st('moduleSelector.startButton') }}
@@ -99,14 +107,14 @@
99
107
  } from 'vuetify/components';
100
108
  import { VcsFormButton, VcsUiApp } from '@vcmap/ui';
101
109
  import { computed, defineComponent, inject, PropType } from 'vue';
102
- import { loadModule, unloadModule } from './moduleHelper.js';
103
110
  import { name } from '../package.json';
104
111
  import { BasisModule, ModuleSelectorPlugin, ModuleType } from './index.js';
105
112
  import type { Module } from './index.ts';
113
+ import { startApplication } from './moduleHelper';
106
114
 
107
- export const windowIdModuleSelector = 'moduleSelector_window_id';
108
115
  export default defineComponent({
109
116
  name: 'ModuleSelector',
117
+ methods: { startApplication },
110
118
  components: {
111
119
  VSheet,
112
120
  VContainer,
@@ -168,29 +176,6 @@
168
176
  plugin.selectedMainModuleIndex.value = null;
169
177
  };
170
178
 
171
- const startApplication = async (): Promise<void> => {
172
- await unloadModule(app);
173
-
174
- const mainModuleIndex = plugin.selectedMainModuleIndex.value;
175
- const nestedModuleIndex = plugin.selectedNestedModuleIndex.value;
176
-
177
- if (mainModuleIndex === null) return;
178
-
179
- const mainModule = modules[mainModuleIndex!];
180
- const nestedModule =
181
- mainModule?.type === 'group'
182
- ? mainModule.cards?.[nestedModuleIndex!]
183
- : null;
184
-
185
- if (nestedModule?.moduleUrl) {
186
- await loadModule(nestedModule.moduleUrl, app);
187
- } else if (mainModule?.type === 'url') {
188
- await loadModule(mainModule.moduleUrl, app);
189
- }
190
-
191
- app.windowManager.remove(windowIdModuleSelector);
192
- };
193
-
194
179
  const isButtonDisabled = computed(() => {
195
180
  if (!props.requireModuleSelection) return false;
196
181
 
@@ -212,8 +197,8 @@
212
197
  selectModule,
213
198
  selectNestedModule,
214
199
  showMainCards,
215
- startApplication,
216
200
  isButtonDisabled,
201
+ app,
217
202
  };
218
203
  },
219
204
  });
@@ -0,0 +1,136 @@
1
+ <template>
2
+ <v-card>
3
+ <VcsFormSection>
4
+ <v-form v-model="isFormValid" ref="form">
5
+ <v-container class="px-2 pt-0 pb-2">
6
+ <v-row no-gutters>
7
+ <v-col cols="6">
8
+ <VcsLabel required html-for="moduleName">
9
+ {{ $st('moduleSelector.configEditor.moduleName') }}
10
+ </VcsLabel>
11
+ </v-col>
12
+ <v-col cols="6">
13
+ <VcsTextField
14
+ id="moduleName"
15
+ placeholder="Module Name"
16
+ v-model="localModuleOptions.title"
17
+ :rules="[requiredRule]"
18
+ />
19
+ </v-col>
20
+ </v-row>
21
+ <v-row no-gutters>
22
+ <v-col cols="6">
23
+ <VcsLabel required html-for="moduleIcon">
24
+ {{ $st('moduleSelector.configEditor.moduleIcon') }}
25
+ </VcsLabel>
26
+ </v-col>
27
+ <v-col cols="6">
28
+ <VcsTextField
29
+ id="moduleIcon"
30
+ placeholder="Icon Name"
31
+ v-model="localModuleOptions.icon"
32
+ :rules="[requiredRule]"
33
+ />
34
+ </v-col>
35
+ </v-row>
36
+ <v-row no-gutters>
37
+ <v-col cols="6">
38
+ <VcsLabel required html-for="moduleUrl">
39
+ {{ $st('moduleSelector.configEditor.moduleUrl') }}
40
+ </VcsLabel>
41
+ </v-col>
42
+ <v-col cols="6">
43
+ <VcsTextField
44
+ id="moduleUrl"
45
+ placeholder="URL"
46
+ v-model="localModuleOptions.moduleUrl"
47
+ :rules="[requiredRule]"
48
+ />
49
+ </v-col>
50
+ </v-row>
51
+ </v-container>
52
+ </v-form>
53
+ <v-divider />
54
+ <div class="d-flex gc-2 w-100 justify-end pa-2">
55
+ <VcsFormButton
56
+ :disabled="!isFormValid"
57
+ @click="
58
+ () => {
59
+ $emit('submit', localModuleOptions);
60
+ }
61
+ "
62
+ variant="filled"
63
+ >
64
+ {{ $st('components.apply') }}
65
+ </VcsFormButton>
66
+ <VcsFormButton @click="$emit('close')">
67
+ {{ $st('components.cancel') }}
68
+ </VcsFormButton>
69
+ </div>
70
+ </VcsFormSection>
71
+ </v-card>
72
+ </template>
73
+ <script lang="ts">
74
+ import {
75
+ VcsFormButton,
76
+ VcsFormSection,
77
+ VcsLabel,
78
+ VcsTextField,
79
+ } from '@vcmap/ui';
80
+ import {
81
+ VCard,
82
+ VDivider,
83
+ VContainer,
84
+ VForm,
85
+ VCol,
86
+ VRow,
87
+ } from 'vuetify/components';
88
+ import { defineComponent, PropType, ref } from 'vue';
89
+
90
+ export default defineComponent({
91
+ name: 'ModuleEditor',
92
+ components: {
93
+ VcsTextField,
94
+ VcsLabel,
95
+ VCol,
96
+ VRow,
97
+ VForm,
98
+ VContainer,
99
+ VcsFormButton,
100
+ VDivider,
101
+ VCard,
102
+ VcsFormSection,
103
+ },
104
+ props: {
105
+ modelValue: {
106
+ type: Object as PropType<{
107
+ id: string;
108
+ title: string;
109
+ icon: string;
110
+ moduleUrl: string;
111
+ }>,
112
+ required: true,
113
+ },
114
+ },
115
+ setup(props) {
116
+ const localModuleOptions = ref(props.modelValue); // structuredClone
117
+ const isFormValid = ref(false);
118
+
119
+ const validateForm = (): void => {
120
+ isFormValid.value = !!localModuleOptions.value.title;
121
+ };
122
+
123
+ const requiredRule = (value: string): string | boolean =>
124
+ !!value || 'moduleSelector.configEditor.editorError';
125
+
126
+ return {
127
+ localModuleOptions,
128
+ isFormValid,
129
+ validateForm,
130
+ requiredRule,
131
+ };
132
+ },
133
+ });
134
+ </script>
135
+
136
+ <style></style>