@bagelink/vue 1.6.9 → 1.6.21
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/Swiper.vue.d.ts +1 -1
- package/dist/components/Swiper.vue.d.ts.map +1 -1
- package/dist/components/form/FieldArray.vue.d.ts.map +1 -1
- package/dist/index.cjs +25 -21
- package/dist/index.mjs +4225 -4146
- package/dist/style.css +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/ListItem.vue +2 -2
- package/src/components/Swiper.vue +10 -8
- package/src/components/form/FieldArray.vue +56 -50
- package/src/components/form/inputs/CodeEditor/Index.vue +1 -1
- package/src/composables/useExcel.ts +6 -6
- package/src/styles/colors.css +176 -0
- package/src/styles/layout.css +231 -0
- package/src/styles/mobilLayout.css +232 -0
- package/src/styles/mobileColors.css +176 -0
- package/src/utils/index.ts +46 -25
package/dist/utils/index.d.ts
CHANGED
|
@@ -29,5 +29,6 @@ export { formatString } from './strings';
|
|
|
29
29
|
export { useDebounceFn } from '@vueuse/core';
|
|
30
30
|
export declare function pathKeyToURL(pathKey?: string): string | undefined;
|
|
31
31
|
export declare function getNestedValue(obj: any, path?: string, defaultValue?: any): any;
|
|
32
|
+
export declare function tryRun<T>(func: () => T, callback?: (error: Error) => void): T | undefined;
|
|
32
33
|
export declare function downloadFile(source: string | Blob, fileName?: string): void;
|
|
33
34
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAA;AAI1E,wBAAgB,QAAQ,CAAC,EAAE,EAAE,MAAM,IAAI,EAAE,IAAI,GAAE,MAAY,QAO1D;AAED,wBAAgB,OAAO,CAAC,GAAG,EA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AC,CAatD;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,UAIvC;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,EAAE,aAAa,SAAO,GAAG,MAAM,GAAG,SAAS,CAG/G;AAED,OAAO,KAAK,cAAc,MAAM,kBAAkB,CAAA;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAE1C,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AAEhC,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAM5C,wBAAgB,YAAY,CAAC,OAAO,CAAC,EAAE,MAAM,sBAkB5C;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,YAAY,GAAE,GAAe,GAAG,GAAG,CAa1F;AAID,wBAAgB,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,EAAE,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,GAAG,CAAC,GAAG,SAAS,CAQzF;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,EAAE,QAAQ,CAAC,EAAE,MAAM,QA6BpE"}
|
package/package.json
CHANGED
|
@@ -80,7 +80,7 @@ const bind = $computed(() => {
|
|
|
80
80
|
{{ title }}
|
|
81
81
|
<slot />
|
|
82
82
|
</p>
|
|
83
|
-
<p v-if="subtitle" class="txt12 m-0
|
|
83
|
+
<p v-if="subtitle" class="txt12 m-0 m-0 py-0 ps-0 pe-1-5 opacity-7 me-2" :class="{ 'ellipsis-1': ellipsis }">
|
|
84
84
|
{{ subtitle }}
|
|
85
85
|
<slot name="subtitle" />
|
|
86
86
|
</p>
|
|
@@ -89,7 +89,7 @@ const bind = $computed(() => {
|
|
|
89
89
|
</component>
|
|
90
90
|
<slot name="end">
|
|
91
91
|
<Icon v-if="iconEnd" :icon="iconEnd" class="transition-400" />
|
|
92
|
-
<p v-if="end" class="txt12 m-0
|
|
92
|
+
<p v-if="end" class="txt12 m-0 py-0 ps-0 pe-1-5 opacity-7 " :class="{ 'ellipsis-1': ellipsis }" v-text="end" />
|
|
93
93
|
</slot>
|
|
94
94
|
</div>
|
|
95
95
|
</template>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import type { Swiper as SwiperType } from 'swiper'
|
|
3
3
|
import type { AutoplayOptions, CoverflowEffectOptions, PaginationOptions, SwiperOptions } from 'swiper/types'
|
|
4
4
|
import { Icon } from '@bagelink/vue'
|
|
5
|
-
import { Autoplay, EffectCoverflow, EffectCube, EffectFade, EffectFlip, Navigation, Pagination } from 'swiper/modules'
|
|
5
|
+
import { Autoplay, EffectCoverflow, EffectCube, EffectFade, EffectFlip, Navigation, Pagination, EffectCards } from 'swiper/modules'
|
|
6
6
|
import { Swiper, SwiperSlide } from 'swiper/vue'
|
|
7
7
|
import { computed, ref, watch } from 'vue'
|
|
8
8
|
import 'swiper/css'
|
|
@@ -12,8 +12,9 @@ import 'swiper/css/effect-fade'
|
|
|
12
12
|
import 'swiper/css/effect-coverflow'
|
|
13
13
|
import 'swiper/css/effect-cube'
|
|
14
14
|
import 'swiper/css/effect-flip'
|
|
15
|
+
import 'swiper/css/effect-cards'
|
|
15
16
|
|
|
16
|
-
type SwiperEffect = 'slide' | 'fade' | 'cube' | 'coverflow' | 'flip'
|
|
17
|
+
type SwiperEffect = 'slide' | 'fade' | 'cube' | 'coverflow' | 'flip' | 'cards'
|
|
17
18
|
type SwiperDirection = 'horizontal' | 'vertical'
|
|
18
19
|
type SwiperVariant = 'default' | 'testimonial' | 'gallery' | 'cards' | 'coverflow' | 'hero'
|
|
19
20
|
|
|
@@ -232,7 +233,7 @@ const swiperParams = computed((): SwiperOptions => {
|
|
|
232
233
|
}
|
|
233
234
|
|
|
234
235
|
const params: SwiperOptions = {
|
|
235
|
-
modules: [Navigation, Pagination, Autoplay, EffectFade, EffectCoverflow, EffectCube, EffectFlip],
|
|
236
|
+
modules: [Navigation, Pagination, Autoplay, EffectFade, EffectCoverflow, EffectCube, EffectFlip, EffectCards],
|
|
236
237
|
effect: getValue(props.effect, 'effect', 'slide'),
|
|
237
238
|
direction: props.direction ?? 'horizontal',
|
|
238
239
|
speed: getValue(props.speed, 'speed', 300),
|
|
@@ -248,8 +249,9 @@ const swiperParams = computed((): SwiperOptions => {
|
|
|
248
249
|
}
|
|
249
250
|
|
|
250
251
|
// Navigation (priority: prop > variant > default)
|
|
251
|
-
const navigationEnabled = getValue(props.navigation, 'navigation', false)
|
|
252
|
-
|
|
252
|
+
// const navigationEnabled = getValue(props.navigation, 'navigation', false)
|
|
253
|
+
// // Note: We use custom navigation controls, not Swiper's built-in navigation
|
|
254
|
+
// // params.navigation = !!navigationEnabled
|
|
253
255
|
|
|
254
256
|
// Pagination (priority: prop > variant > default)
|
|
255
257
|
const paginationConfig = getValue(props.pagination, 'pagination', false)
|
|
@@ -297,7 +299,7 @@ const swiperParams = computed((): SwiperOptions => {
|
|
|
297
299
|
// Format params for Swiper Vue component with proper types
|
|
298
300
|
const swiperVueProps = computed(() => ({
|
|
299
301
|
modules: swiperParams.value.modules,
|
|
300
|
-
effect: swiperParams.value.effect as 'slide' | 'fade' | 'cube' | 'coverflow' | 'flip',
|
|
302
|
+
effect: swiperParams.value.effect as 'slide' | 'fade' | 'cube' | 'coverflow' | 'flip' | 'cards',
|
|
301
303
|
direction: swiperParams.value.direction,
|
|
302
304
|
speed: swiperParams.value.speed,
|
|
303
305
|
loop: swiperParams.value.loop,
|
|
@@ -433,12 +435,12 @@ defineExpose({
|
|
|
433
435
|
<div v-if="navigation" class="swi-ctrl">
|
|
434
436
|
<div class="swi-prev hover" @click="handleSlideNav('prev')">
|
|
435
437
|
<slot name="prev-button">
|
|
436
|
-
<Icon name="chevron_left" />
|
|
438
|
+
<Icon name="chevron_left" class="user-select-none hover z-99 color-primary" :size="2" />
|
|
437
439
|
</slot>
|
|
438
440
|
</div>
|
|
439
441
|
<div class="swi-next hover" @click="handleSlideNav('next')">
|
|
440
442
|
<slot name="next-button">
|
|
441
|
-
<Icon name="chevron_right" />
|
|
443
|
+
<Icon name="chevron_right" class="user-select-none hover z-99 color-primary" :size="2" />
|
|
442
444
|
</slot>
|
|
443
445
|
</div>
|
|
444
446
|
</div>
|
|
@@ -62,9 +62,9 @@ let lastEmittedValue = '' // Event handlers state
|
|
|
62
62
|
|
|
63
63
|
// Generate schema for primitive types
|
|
64
64
|
const primitiveSchema = computed<PrimitiveArrFieldT[]>(() => {
|
|
65
|
-
if ('text'
|
|
65
|
+
if (props.type === 'text') {
|
|
66
66
|
return [{ id: 'value', type: 'text', label: '', $el: 'text' }]
|
|
67
|
-
}if (props.type === 'number') {
|
|
67
|
+
} if (props.type === 'number') {
|
|
68
68
|
return [{ id: 'value', type: 'number', label: '', $el: 'number' }]
|
|
69
69
|
}
|
|
70
70
|
return []
|
|
@@ -72,20 +72,20 @@ const primitiveSchema = computed<PrimitiveArrFieldT[]>(() => {
|
|
|
72
72
|
|
|
73
73
|
const resolvedSchemaData = computed(() => {
|
|
74
74
|
// Handle 'array' type as equivalent to 'object' type
|
|
75
|
-
const isObjectType = 'object'
|
|
75
|
+
const isObjectType = props.type === 'object' || props.type === 'array'
|
|
76
76
|
|
|
77
|
-
if (!isObjectType) {return primitiveSchema.value as BglFormSchemaT<T>}
|
|
77
|
+
if (!isObjectType) { return primitiveSchema.value as BglFormSchemaT<T> }
|
|
78
78
|
|
|
79
79
|
// Use children prop first, then schema prop, then attrs.schema
|
|
80
80
|
const attrsSchema = props.attrs?.schema !== undefined ? toValue(props.attrs.schema) : null
|
|
81
81
|
const schemaToUse = props.children || toValue(props.schema) || attrsSchema
|
|
82
82
|
|
|
83
|
-
// If no schema but we have defaultValue, try to infer schema from first item
|
|
84
|
-
const noSchema = null === schemaToUse || schemaToUse === undefined
|
|
85
|
-
|
|
86
|
-
const hasDefaultValue = props.defaultValue !== undefined
|
|
87
|
-
|
|
88
|
-
|
|
83
|
+
// // If no schema but we have defaultValue, try to infer schema from first item
|
|
84
|
+
// const noSchema = null === schemaToUse || schemaToUse === undefined
|
|
85
|
+
// || (Array.isArray(schemaToUse) && 0 === schemaToUse.length)
|
|
86
|
+
// const hasDefaultValue = props.defaultValue !== undefined
|
|
87
|
+
// && null !== props.defaultValue
|
|
88
|
+
// && 0 < props.defaultValue.length
|
|
89
89
|
|
|
90
90
|
// Don't infer schema from defaultValue - this causes unwanted restoration
|
|
91
91
|
// Let the component work with empty arrays
|
|
@@ -120,8 +120,8 @@ watch(() => internalData.value.length, (newLength) => {
|
|
|
120
120
|
// Initialize with existing data or defaultValue on mount - only once!
|
|
121
121
|
onMounted(() => {
|
|
122
122
|
// If no modelValue provided, use defaultValue as initial data (one time only)
|
|
123
|
-
if (!props.modelValue ||
|
|
124
|
-
if (props.defaultValue &&
|
|
123
|
+
if (!props.modelValue || props.modelValue.length === 0) {
|
|
124
|
+
if (props.defaultValue && props.defaultValue.length > 0) {
|
|
125
125
|
internalData.value = [...props.defaultValue]
|
|
126
126
|
emitValue() // This will set the initial value and then it becomes "regular" data
|
|
127
127
|
}
|
|
@@ -137,7 +137,7 @@ onMounted(() => {
|
|
|
137
137
|
|
|
138
138
|
// Function to load default values (explicit user action)
|
|
139
139
|
function loadDefaults() {
|
|
140
|
-
if (props.defaultValue &&
|
|
140
|
+
if (props.defaultValue && props.defaultValue.length > 0) {
|
|
141
141
|
internalData.value = [...props.defaultValue]
|
|
142
142
|
emitValue()
|
|
143
143
|
} else {
|
|
@@ -234,8 +234,8 @@ function toggleMinimized(index: number) {
|
|
|
234
234
|
|
|
235
235
|
function updateItem(index: number, value: any) {
|
|
236
236
|
// Handle primitive types by extracting the value property
|
|
237
|
-
if ('text'
|
|
238
|
-
internalData.value[index] = 'number'
|
|
237
|
+
if (props.type === 'text' || props.type === 'number') {
|
|
238
|
+
internalData.value[index] = props.type === 'number' ? Number(value.value) : value.value
|
|
239
239
|
} else {
|
|
240
240
|
internalData.value[index] = value
|
|
241
241
|
}
|
|
@@ -243,24 +243,24 @@ function updateItem(index: number, value: any) {
|
|
|
243
243
|
}
|
|
244
244
|
|
|
245
245
|
// Computed properties for rendering
|
|
246
|
-
const isPrimitiveType = computed(() => 'text'
|
|
246
|
+
const isPrimitiveType = computed(() => props.type === 'text' || props.type === 'number')
|
|
247
247
|
const canRenderItems = computed(() => {
|
|
248
248
|
const schemaData = resolvedSchemaData.value
|
|
249
|
-
const hasValidSchema = (Array.isArray(schemaData) &&
|
|
250
|
-
|| (props.children &&
|
|
251
|
-
const hasDefaultValue = props.defaultValue &&
|
|
249
|
+
const hasValidSchema = (Array.isArray(schemaData) && schemaData.length > 0)
|
|
250
|
+
|| (props.children && props.children.length > 0)
|
|
251
|
+
const hasDefaultValue = props.defaultValue && props.defaultValue.length > 0
|
|
252
252
|
|
|
253
253
|
// For primitive types or when we have schema or defaultValue
|
|
254
|
-
const isObjectType = 'object'
|
|
254
|
+
const isObjectType = props.type === 'object' || props.type === 'array'
|
|
255
255
|
const shouldRender = isPrimitiveType.value
|
|
256
|
-
|| (isObjectType && (
|
|
256
|
+
|| (isObjectType && (hasValidSchema === true || hasDefaultValue === true))
|
|
257
257
|
return shouldRender
|
|
258
258
|
})
|
|
259
259
|
const showMinimizeButton = computed(() => {
|
|
260
260
|
const schemaData = resolvedSchemaData.value
|
|
261
|
-
const hasLongSchema = Array.isArray(schemaData) &&
|
|
261
|
+
const hasLongSchema = Array.isArray(schemaData) && schemaData.length > 2
|
|
262
262
|
const hasRichText = Array.isArray(schemaData)
|
|
263
|
-
&& schemaData.some((schema: any) => 'richtext'
|
|
263
|
+
&& schemaData.some((schema: any) => schema.$el === 'richtext')
|
|
264
264
|
return hasLongSchema || hasRichText
|
|
265
265
|
})
|
|
266
266
|
</script>
|
|
@@ -293,20 +293,19 @@ const showMinimizeButton = computed(() => {
|
|
|
293
293
|
No {{ label?.toLowerCase() || 'items' }} added yet
|
|
294
294
|
</p>
|
|
295
295
|
<!-- Load defaults button if defaultValue exists -->
|
|
296
|
-
<Btn
|
|
296
|
+
<Btn
|
|
297
|
+
v-if="props.defaultValue && props.defaultValue.length > 0" thin color="primary"
|
|
298
|
+
class="txt12 mb-05" @click="loadDefaults"
|
|
299
|
+
>
|
|
297
300
|
Load Default {{ label || 'Items' }}
|
|
298
301
|
</Btn>
|
|
299
302
|
</Card>
|
|
300
303
|
|
|
301
304
|
<!-- Array Items -->
|
|
302
305
|
<div
|
|
303
|
-
v-for="(item, i) in internalData"
|
|
304
|
-
:key="i"
|
|
305
|
-
outline
|
|
306
|
-
thin
|
|
306
|
+
v-for="(item, i) in internalData" :key="i" outline thin
|
|
307
307
|
class="mb-05 itemBox transition radius-05 overflow-hidden txt12 border"
|
|
308
|
-
style="--input-font-size: 12px"
|
|
309
|
-
:class="{ minimized: minimizedItems[i] }"
|
|
308
|
+
style="--input-font-size: 12px" :class="{ minimized: minimizedItems[i] }"
|
|
310
309
|
>
|
|
311
310
|
<div>
|
|
312
311
|
<!-- Minimized View -->
|
|
@@ -314,15 +313,22 @@ const showMinimizeButton = computed(() => {
|
|
|
314
313
|
<p class="minimizedText txt12 p-05 opacity-7 flex-grow-2" @click="toggleMinimized(i)">
|
|
315
314
|
{{ label }} {{ i + 1 }}
|
|
316
315
|
</p>
|
|
317
|
-
<Btn
|
|
316
|
+
<Btn
|
|
317
|
+
v-if="showMinimizeButton" class="rotate-180 txt10 opacity-7 p-025" flat thin
|
|
318
|
+
icon="keyboard_arrow_down" @click="toggleMinimized(i)"
|
|
319
|
+
/>
|
|
318
320
|
</div>
|
|
319
321
|
|
|
320
322
|
<!-- Form View -->
|
|
321
323
|
<BagelFormFA
|
|
322
|
-
v-if="!minimizedItems[i]" :model-value="isPrimitiveType ? { value: item } : item"
|
|
324
|
+
v-if="!minimizedItems[i]" :model-value="isPrimitiveType ? { value: item } : item"
|
|
325
|
+
:schema="resolvedSchemaData" class="bginputbg p-05 grid gap-05"
|
|
323
326
|
@update:model-value="val => updateItem(i, val)"
|
|
324
327
|
/>
|
|
325
|
-
<Btn
|
|
328
|
+
<Btn
|
|
329
|
+
v-if="props.delete" icon="delete" class="txt10 opacity-7" thin flat
|
|
330
|
+
@click="deleteItem(i)"
|
|
331
|
+
/>
|
|
326
332
|
</div>
|
|
327
333
|
</div>
|
|
328
334
|
|
|
@@ -388,27 +394,27 @@ const showMinimizeButton = computed(() => {
|
|
|
388
394
|
|
|
389
395
|
.itemBox .richtext-editor-content {
|
|
390
396
|
--richtext-font-size: 12px !important;
|
|
391
|
-
|
|
392
|
-
|
|
397
|
+
font-size: 12px !important;
|
|
398
|
+
}
|
|
393
399
|
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
400
|
+
.itemBox iframe.editableContent {
|
|
401
|
+
--richtext-font-size: 12px !important;
|
|
402
|
+
}
|
|
397
403
|
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
404
|
+
.itemBox .bagel-input.richtext-input {
|
|
405
|
+
--richtext-font-size: 12px !important;
|
|
406
|
+
}
|
|
401
407
|
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
408
|
+
/* More specific selectors to override richtext font size */
|
|
409
|
+
.itemBox .richtext-input iframe {
|
|
410
|
+
font-size: 12px !important;
|
|
411
|
+
}
|
|
406
412
|
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
413
|
+
.itemBox .richtext-input .editableContent body {
|
|
414
|
+
font-size: 12px !important;
|
|
415
|
+
}
|
|
410
416
|
|
|
411
|
-
|
|
412
|
-
|
|
417
|
+
.itemBox .richtext-input {
|
|
418
|
+
font-size: 12px !important;
|
|
413
419
|
}
|
|
414
420
|
</style>
|
|
@@ -65,7 +65,7 @@ export function useExcel() {
|
|
|
65
65
|
const XLSX = await ensureXLSXLoaded()
|
|
66
66
|
|
|
67
67
|
const formattedData = formatData(data, schema)
|
|
68
|
-
const headers =
|
|
68
|
+
const headers = schema.length > 0
|
|
69
69
|
? schema.map((sf) => {
|
|
70
70
|
const { id, label } = sf as unknown as Field<T>
|
|
71
71
|
return { v: (label as any) || (id as any), t: 's' }
|
|
@@ -73,7 +73,7 @@ export function useExcel() {
|
|
|
73
73
|
: []
|
|
74
74
|
const ws = XLSX.utils.json_to_sheet(formattedData)
|
|
75
75
|
|
|
76
|
-
if (
|
|
76
|
+
if (headers.length > 0) {
|
|
77
77
|
XLSX.utils.sheet_add_aoa(ws, [headers.map(h => h.v)], { origin: 'A1' })
|
|
78
78
|
}
|
|
79
79
|
|
|
@@ -124,7 +124,7 @@ export function useExcel() {
|
|
|
124
124
|
// Read the raw sheet data as arrays
|
|
125
125
|
const rawSheetData = XLSX.utils.sheet_to_json(worksheet, { header: 1 }) as any[][]
|
|
126
126
|
|
|
127
|
-
if (
|
|
127
|
+
if (rawSheetData.length === 0) {
|
|
128
128
|
return { headers: [], data: [] }
|
|
129
129
|
}
|
|
130
130
|
|
|
@@ -196,10 +196,10 @@ export function useExcel() {
|
|
|
196
196
|
// Helper function for date detection and conversion
|
|
197
197
|
function isExcelSerialDate(value: any): boolean {
|
|
198
198
|
return (
|
|
199
|
-
|
|
199
|
+
typeof value === 'number'
|
|
200
200
|
&& Number.isInteger(value)
|
|
201
|
-
&&
|
|
202
|
-
&&
|
|
201
|
+
&& value >= 20000
|
|
202
|
+
&& value <= 50000
|
|
203
203
|
)
|
|
204
204
|
}
|
|
205
205
|
|