@vcmap/module-selector 2.0.0 → 2.0.2

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.
@@ -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>