@bagelink/vue 1.9.142 → 1.9.148
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/dist/components/form/inputs/ArrayInput.vue.d.ts.map +1 -1
- package/dist/components/layout/SidebarMenu.vue.d.ts.map +1 -1
- package/dist/form-flow/FormFlow.vue.d.ts.map +1 -1
- package/dist/i18n/index.d.ts +18 -0
- package/dist/i18n/index.d.ts.map +1 -1
- package/dist/index.cjs +34 -34
- package/dist/index.mjs +1757 -1725
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/components/form/inputs/ArrayInput.vue +44 -19
- package/src/components/layout/SidebarMenu.vue +0 -8
- package/src/form-flow/FormFlow.vue +2 -0
- package/src/i18n/locales/en.json +3 -0
- package/src/i18n/locales/es.json +3 -0
- package/src/i18n/locales/fr.json +3 -0
- package/src/i18n/locales/he.json +3 -0
- package/src/i18n/locales/it.json +3 -0
- package/src/i18n/locales/ru.json +3 -0
- package/src/styles/appearance.css +12 -0
- package/src/styles/base-colors.css +1 -0
- package/src/styles/theme.css +421 -412
package/package.json
CHANGED
|
@@ -22,7 +22,7 @@ defineSlots<{
|
|
|
22
22
|
default: (props: { item: WritableComputedRef<T>, index: number }) => unknown
|
|
23
23
|
}>()
|
|
24
24
|
|
|
25
|
-
const {
|
|
25
|
+
const { $t } = useI18n()
|
|
26
26
|
|
|
27
27
|
const items = ref(Array.isArray(props.modelValue) ? [...props.modelValue] : []) as Ref<T[]>
|
|
28
28
|
const minimizedItems = ref(Array.from({ length: items.value.length }, () => true))
|
|
@@ -31,17 +31,12 @@ const dragOverIndex = ref<number | null>(null)
|
|
|
31
31
|
const keySeed = ref(0)
|
|
32
32
|
const itemKeys = ref(Array.from({ length: items.value.length }, () => nextItemKey()))
|
|
33
33
|
|
|
34
|
-
const isHebrewUi = computed(() => {
|
|
35
|
-
const localeValue = locale.value.toLowerCase()
|
|
36
|
-
return localeValue.startsWith('he')
|
|
37
|
-
})
|
|
38
|
-
|
|
39
34
|
const itemLabelPrefix = computed(() => {
|
|
40
35
|
const resolvedCustomLabel = resolveI18n(props.itemLabel)
|
|
41
36
|
if (typeof resolvedCustomLabel === 'string' && resolvedCustomLabel.length > 0) {
|
|
42
37
|
return resolvedCustomLabel
|
|
43
38
|
}
|
|
44
|
-
return
|
|
39
|
+
return $t('arrayInput.item')
|
|
45
40
|
})
|
|
46
41
|
|
|
47
42
|
function nextItemKey() {
|
|
@@ -49,8 +44,28 @@ function nextItemKey() {
|
|
|
49
44
|
return `array-item-${keySeed.value}`
|
|
50
45
|
}
|
|
51
46
|
|
|
47
|
+
const IDENTIFIER_FIELDS = ['title', 'name', 'label', 'displayName', 'display_name', 'heading', 'caption', 'text']
|
|
48
|
+
|
|
49
|
+
function getItemIdentifier(item: T): string | null {
|
|
50
|
+
if (typeof item === 'string' && item.trim().length > 0) {
|
|
51
|
+
return item.trim()
|
|
52
|
+
}
|
|
53
|
+
if (item !== null && item !== undefined && typeof item === 'object') {
|
|
54
|
+
for (const field of IDENTIFIER_FIELDS) {
|
|
55
|
+
const val = (item as Record<string, unknown>)[field]
|
|
56
|
+
if (typeof val === 'string' && val.trim().length > 0) {
|
|
57
|
+
return val.trim()
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return null
|
|
62
|
+
}
|
|
63
|
+
|
|
52
64
|
function getItemLabel(index: number) {
|
|
53
|
-
|
|
65
|
+
const identifier = getItemIdentifier(items.value[index])
|
|
66
|
+
return identifier != null
|
|
67
|
+
? `${index + 1}. ${identifier}`
|
|
68
|
+
: `${itemLabelPrefix.value} ${index + 1}`
|
|
54
69
|
}
|
|
55
70
|
|
|
56
71
|
watch(
|
|
@@ -167,23 +182,32 @@ function getItemRef(i: number) {
|
|
|
167
182
|
<template v-if="!collapsible">
|
|
168
183
|
<div v-for="(_, i) in items" :key="i" class="array-input-row grid gap-05 align-items-center">
|
|
169
184
|
<slot :item="getItemRef(i)" :index="i" />
|
|
170
|
-
<Btn
|
|
185
|
+
<Btn
|
|
186
|
+
v-if="allowDelete" v-tooltip="resolveI18n(deleteTooltip || 'Delete')" flat icon="delete"
|
|
187
|
+
@click="deleteItem(i)"
|
|
188
|
+
/>
|
|
171
189
|
</div>
|
|
172
190
|
</template>
|
|
173
191
|
<TransitionGroup v-if="collapsible" name="array-list" tag="div" class="grid gap-05 mb-05">
|
|
174
192
|
<div
|
|
175
|
-
v-for="(_, i) in items"
|
|
176
|
-
:key="itemKeys[i]"
|
|
177
|
-
class="border radius-1 p-05"
|
|
193
|
+
v-for="(_, i) in items" :key="itemKeys[i]" class="border radius-1"
|
|
178
194
|
:class="{ 'array-item-drag-over1 bg-gray-light border border-primary ': allowReorder && dragOverIndex === i && draggingIndex !== null && draggingIndex !== i }"
|
|
179
|
-
@dragover.prevent
|
|
180
|
-
@dragenter.prevent="onDragEnter(i)"
|
|
181
|
-
@drop.prevent="onDrop(i)"
|
|
195
|
+
@dragover.prevent @dragenter.prevent="onDragEnter(i)" @drop.prevent="onDrop(i)"
|
|
182
196
|
>
|
|
183
197
|
<div class="flex space-between gap-05">
|
|
184
|
-
<Btn
|
|
185
|
-
|
|
186
|
-
|
|
198
|
+
<Btn
|
|
199
|
+
v-if="allowReorder" v-tooltip="resolveI18n('Drag to reorder')" flat thin icon="drag_indicator"
|
|
200
|
+
class="grab" draggable="true" @dragstart="onDragStart($event, i)" @dragend="onDragEnd"
|
|
201
|
+
/>
|
|
202
|
+
<Btn
|
|
203
|
+
full-width align-txt="start" class="px-05" flat
|
|
204
|
+
:icon="minimizedItems[i] ? 'expand_more' : 'expand_less'" :value="getItemLabel(i)"
|
|
205
|
+
@click="toggleItem(i)"
|
|
206
|
+
/>
|
|
207
|
+
<Btn
|
|
208
|
+
v-if="allowDelete" v-tooltip="resolveI18n(deleteTooltip || 'Delete')" flat icon="delete"
|
|
209
|
+
:confirm="resolveI18n('Are you sure you want to delete this item?')" @click="deleteItem(i)"
|
|
210
|
+
/>
|
|
187
211
|
</div>
|
|
188
212
|
<Transition name="array-collapse">
|
|
189
213
|
<div v-if="!minimizedItems[i]" class="array-input-row grid gap-05 align-items-center">
|
|
@@ -192,7 +216,7 @@ function getItemRef(i: number) {
|
|
|
192
216
|
</Transition>
|
|
193
217
|
</div>
|
|
194
218
|
</TransitionGroup>
|
|
195
|
-
<Btn v-if="allowAdd" icon="add" :value="resolveI18n(addText || 'Add')" @click="addItem" />
|
|
219
|
+
<Btn v-if="allowAdd" thin icon="add" :value="resolveI18n(addText || 'Add')" @click="addItem" />
|
|
196
220
|
</div>
|
|
197
221
|
</template>
|
|
198
222
|
|
|
@@ -200,6 +224,7 @@ function getItemRef(i: number) {
|
|
|
200
224
|
.array-input-row {
|
|
201
225
|
grid-template-columns: 1fr auto;
|
|
202
226
|
}
|
|
227
|
+
|
|
203
228
|
.array-collapse-enter-active,
|
|
204
229
|
.array-collapse-leave-active {
|
|
205
230
|
overflow: hidden;
|
|
@@ -67,14 +67,6 @@ const toggleMenu = useDebounceFn(() => {
|
|
|
67
67
|
</template>
|
|
68
68
|
|
|
69
69
|
<style>
|
|
70
|
-
.v-popper--theme-tooltip .v-popper__inner {
|
|
71
|
-
background: rgb(255, 255, 255) !important;
|
|
72
|
-
color: var(--bgl-primary) !important;
|
|
73
|
-
font-size: 15px;
|
|
74
|
-
padding: 0.5rem 1rem;
|
|
75
|
-
box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.1);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
70
|
.nav-button.router-link-active {
|
|
79
71
|
background: var(--bgl-popup-bg) !important;
|
|
80
72
|
color: var(--bgl-primary);
|
|
@@ -216,6 +216,7 @@ function validateField(key: string, field: FieldBuilder): boolean {
|
|
|
216
216
|
|
|
217
217
|
if (field._config.required === true) {
|
|
218
218
|
const isEmpty = value == null || value === '' || (Array.isArray(value) && value.length === 0)
|
|
219
|
+
|| (field._type === 'tel' && typeof value === 'string' && /^\+\d+$/.test(value))
|
|
219
220
|
if (isEmpty) {
|
|
220
221
|
validationErrors.value = { ...validationErrors.value, [key]: field._config.requiredMessage || $t('form.required') }
|
|
221
222
|
return false
|
|
@@ -358,6 +359,7 @@ function validateAll(): boolean {
|
|
|
358
359
|
// Check required fields first
|
|
359
360
|
if (field._config.required === true) {
|
|
360
361
|
const isEmpty = value == null || value === '' || (Array.isArray(value) && value.length === 0)
|
|
362
|
+
|| (field._type === 'tel' && typeof value === 'string' && /^\+\d+$/.test(value))
|
|
361
363
|
if (isEmpty) {
|
|
362
364
|
newErrors[key] = field._config.requiredMessage || $t('form.required')
|
|
363
365
|
isValid = false
|
package/src/i18n/locales/en.json
CHANGED
package/src/i18n/locales/es.json
CHANGED
package/src/i18n/locales/fr.json
CHANGED
package/src/i18n/locales/he.json
CHANGED
package/src/i18n/locales/it.json
CHANGED
package/src/i18n/locales/ru.json
CHANGED
|
@@ -321,6 +321,18 @@
|
|
|
321
321
|
mix-blend-mode: normal;
|
|
322
322
|
}
|
|
323
323
|
|
|
324
|
+
.v-popper--theme-tooltip .v-popper__inner {
|
|
325
|
+
background: var(--bgl-tooltip-bg) !important;
|
|
326
|
+
color: var(--bgl-tooltip-color) !important;
|
|
327
|
+
font-size: var(--bgl-tooltip-font-size);
|
|
328
|
+
padding: var(--bgl-tooltip-padding);
|
|
329
|
+
box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.1);
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
.v-popper--theme-tooltip .v-popper__arrow-outer {
|
|
333
|
+
border-color: var(--bgl-tooltip-arrow-color) !important;
|
|
334
|
+
}
|
|
335
|
+
|
|
324
336
|
@media screen and (max-width: 910px) {
|
|
325
337
|
.m_scrollbar-gutter {
|
|
326
338
|
scrollbar-gutter: stable;
|