@motor-cms/ui-admin 3.0.0 → 3.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.
|
@@ -12,6 +12,19 @@ const props = defineProps<{
|
|
|
12
12
|
logoSlugOptions: { label: string, value: string }[]
|
|
13
13
|
}>()
|
|
14
14
|
|
|
15
|
+
const appSettings = useAppSettingsStore()
|
|
16
|
+
const isCompact = computed(() => appSettings.formLayout === 'compact')
|
|
17
|
+
|
|
18
|
+
const formFieldUi = computed(() => isCompact.value
|
|
19
|
+
? { container: 'w-full' }
|
|
20
|
+
: { container: 'w-full max-w-2xl' }
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
const cardUi = computed(() => isCompact.value
|
|
24
|
+
? { root: 'relative flex rounded-lg items-start', container: 'relative flex flex-col p-4 sm:p-6 gap-x-8 gap-y-4', wrapper: 'flex flex-col items-start', body: '' }
|
|
25
|
+
: undefined
|
|
26
|
+
)
|
|
27
|
+
|
|
15
28
|
// ============================================
|
|
16
29
|
// Dot-path helpers
|
|
17
30
|
// ============================================
|
|
@@ -59,57 +72,62 @@ function optionsForField(fieldKey: string): { label: string, value: string }[] {
|
|
|
59
72
|
</script>
|
|
60
73
|
|
|
61
74
|
<template>
|
|
62
|
-
<
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
75
|
+
<div :class="isCompact ? 'grid grid-cols-2 gap-4' : 'flex flex-col gap-4'">
|
|
76
|
+
<UPageCard
|
|
77
|
+
v-for="(group, groupIdx) in groups"
|
|
78
|
+
:key="group.key"
|
|
79
|
+
:class="isCompact && groups.length % 2 === 1 && groupIdx === groups.length - 1 ? 'col-span-2' : ''"
|
|
80
|
+
:title="group.label"
|
|
81
|
+
:ui="cardUi"
|
|
82
|
+
>
|
|
83
|
+
<div :class="isCompact ? 'grid grid-cols-12 gap-x-4 gap-y-3' : 'space-y-4'">
|
|
68
84
|
<template
|
|
69
85
|
v-for="field in fieldsForGroup(group.key)"
|
|
70
86
|
:key="field.key"
|
|
71
87
|
>
|
|
72
|
-
<
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
88
|
+
<div :class="isCompact ? 'col-span-12' : ''">
|
|
89
|
+
<UFormField
|
|
90
|
+
:label="field.label"
|
|
91
|
+
:name="field.key"
|
|
92
|
+
:required="field.required"
|
|
93
|
+
:error="errors[field.key]"
|
|
94
|
+
:orientation="isCompact ? 'vertical' : 'horizontal'"
|
|
95
|
+
:ui="formFieldUi"
|
|
96
|
+
>
|
|
97
|
+
<!-- Toggle -->
|
|
98
|
+
<USwitch
|
|
99
|
+
v-if="field.input === 'toggle'"
|
|
100
|
+
:model-value="(getNestedValue(state, field.key) as boolean) ?? false"
|
|
101
|
+
:disabled="disabled"
|
|
102
|
+
@update:model-value="setNestedValue(state, field.key, $event)"
|
|
103
|
+
/>
|
|
87
104
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
105
|
+
<!-- Select -->
|
|
106
|
+
<USelectMenu
|
|
107
|
+
v-else-if="field.input === 'select'"
|
|
108
|
+
:model-value="(getNestedValue(state, field.key) as string | undefined)"
|
|
109
|
+
:items="optionsForField(field.key)"
|
|
110
|
+
value-key="value"
|
|
111
|
+
label-key="label"
|
|
112
|
+
:placeholder="field.label"
|
|
113
|
+
:disabled="disabled"
|
|
114
|
+
class="w-full"
|
|
115
|
+
@update:model-value="setNestedValue(state, field.key, $event)"
|
|
116
|
+
/>
|
|
100
117
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
118
|
+
<!-- Text / Email / URL -->
|
|
119
|
+
<UInput
|
|
120
|
+
v-else
|
|
121
|
+
:model-value="(getNestedValue(state, field.key) as string) ?? ''"
|
|
122
|
+
:type="field.input === 'email' ? 'email' : field.input === 'url' ? 'url' : 'text'"
|
|
123
|
+
:disabled="disabled"
|
|
124
|
+
class="w-full"
|
|
125
|
+
@update:model-value="setNestedValue(state, field.key, $event)"
|
|
126
|
+
/>
|
|
127
|
+
</UFormField>
|
|
128
|
+
</div>
|
|
111
129
|
</template>
|
|
112
130
|
</div>
|
|
113
131
|
</UPageCard>
|
|
114
|
-
</
|
|
132
|
+
</div>
|
|
115
133
|
</template>
|
|
@@ -17,13 +17,24 @@ const emit = defineEmits<{
|
|
|
17
17
|
'footer-unlinked': [languageId: number]
|
|
18
18
|
}>()
|
|
19
19
|
|
|
20
|
+
const appSettings = useAppSettingsStore()
|
|
21
|
+
const isCompact = computed(() => appSettings.formLayout === 'compact')
|
|
22
|
+
|
|
23
|
+
const cardUi = computed(() => isCompact.value
|
|
24
|
+
? { root: 'relative flex rounded-lg items-start', container: 'relative flex flex-col p-4 sm:p-6 gap-x-8 gap-y-4', wrapper: 'flex flex-col items-start', body: '' }
|
|
25
|
+
: undefined
|
|
26
|
+
)
|
|
27
|
+
|
|
20
28
|
function getFooterUuid(languageId: number): string | null {
|
|
21
29
|
return props.footerMap?.[String(languageId)] ?? null
|
|
22
30
|
}
|
|
23
31
|
</script>
|
|
24
32
|
|
|
25
33
|
<template>
|
|
26
|
-
<UPageCard
|
|
34
|
+
<UPageCard
|
|
35
|
+
:title="t('motor-admin.clients.global_components.title')"
|
|
36
|
+
:ui="cardUi"
|
|
37
|
+
>
|
|
27
38
|
<div v-if="languagesLoading" class="flex items-center gap-2 text-muted py-4">
|
|
28
39
|
<UIcon name="i-lucide-loader-2" class="size-4 animate-spin" />
|
|
29
40
|
<span class="text-sm">{{ t('motor-core.global.loading') }}</span>
|
|
@@ -31,20 +42,24 @@ function getFooterUuid(languageId: number): string | null {
|
|
|
31
42
|
<div v-else-if="languages.length === 0" class="text-sm text-muted py-4">
|
|
32
43
|
{{ t('motor-admin.clients.global_components.no_languages') }}
|
|
33
44
|
</div>
|
|
34
|
-
<
|
|
35
|
-
<
|
|
45
|
+
<div v-else :class="isCompact ? 'grid grid-cols-12 gap-x-4 gap-y-3' : 'space-y-4'">
|
|
46
|
+
<div
|
|
36
47
|
v-for="lang in languages"
|
|
37
48
|
:key="lang.id"
|
|
38
|
-
:
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
+
:class="isCompact ? 'col-span-12' : ''"
|
|
50
|
+
>
|
|
51
|
+
<ClientFooterSlotCard
|
|
52
|
+
:client-id="clientId"
|
|
53
|
+
:client-name="clientName"
|
|
54
|
+
:language-id="lang.id"
|
|
55
|
+
:language-name="lang.name"
|
|
56
|
+
:show-language-label="isMultiLanguage"
|
|
57
|
+
:builder-page-uuid="getFooterUuid(lang.id)"
|
|
58
|
+
:disabled="disabled"
|
|
59
|
+
@linked="(uuid: string, pageId: number) => emit('footer-linked', lang.id, uuid, pageId)"
|
|
60
|
+
@unlinked="emit('footer-unlinked', lang.id)"
|
|
61
|
+
/>
|
|
62
|
+
</div>
|
|
63
|
+
</div>
|
|
49
64
|
</UPageCard>
|
|
50
65
|
</template>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@motor-cms/ui-admin",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./nuxt.config.ts",
|
|
6
6
|
"files": [
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"zod": "^4.0.0"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
23
|
-
"@motor-cms/ui-core": ">=3.0.
|
|
23
|
+
"@motor-cms/ui-core": ">=3.0.2",
|
|
24
24
|
"nuxt": "^4.0.0",
|
|
25
25
|
"vue": "^3.5.0"
|
|
26
26
|
}
|