@bagelink/vue 1.0.52 → 1.0.57
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/MapEmbed/Index.vue.d.ts +30 -0
- package/dist/components/MapEmbed/Index.vue.d.ts.map +1 -0
- package/dist/components/Modal.vue.d.ts.map +1 -1
- package/dist/components/Spreadsheet/Index.vue.d.ts +2 -0
- package/dist/components/Spreadsheet/Index.vue.d.ts.map +1 -1
- package/dist/components/dashboard/Lineart.vue.d.ts.map +1 -1
- package/dist/components/dashboard/index.d.ts.map +1 -1
- package/dist/components/form/BagelForm.vue.d.ts +3 -1
- package/dist/components/form/BagelForm.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/DateInput.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/NumberInput.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/PasswordInput.vue.d.ts +1 -0
- package/dist/components/form/inputs/PasswordInput.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/PhoneInput.vue.d.ts +2 -0
- package/dist/components/form/inputs/PhoneInput.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/SelectInput.vue.d.ts +4 -0
- package/dist/components/form/inputs/SelectInput.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/TextInput.vue.d.ts +1 -0
- package/dist/components/form/inputs/TextInput.vue.d.ts.map +1 -1
- package/dist/components/index.d.ts +3 -3
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/layout/BottomMenu.vue.d.ts.map +1 -1
- package/dist/components/layout/Layout.vue.d.ts.map +1 -1
- package/dist/components/layout/SidebarMenu.vue.d.ts.map +1 -1
- package/dist/components/layout/Skeleton.vue.d.ts.map +1 -1
- package/dist/components/layout/TabbedLayout.vue.d.ts.map +1 -1
- package/dist/components/layout/Tabs.vue.d.ts.map +1 -1
- package/dist/components/layout/TabsBody.vue.d.ts.map +1 -1
- package/dist/components/layout/TabsNav.vue.d.ts.map +1 -1
- package/dist/components/layout/index.d.ts.map +1 -1
- package/dist/components/layout/tabsManager.d.ts.map +1 -1
- package/dist/components/lightbox/Lightbox.vue.d.ts.map +1 -1
- package/dist/components/lightbox/index.d.ts.map +1 -1
- package/dist/components/lightbox/lightbox.types.d.ts.map +1 -1
- package/dist/composables/useSchemaField.d.ts.map +1 -1
- package/dist/index.cjs +125 -51
- package/dist/index.mjs +125 -51
- package/dist/plugins/bagel.d.ts.map +1 -1
- package/dist/style.css +852 -571
- package/dist/utils/BagelFormUtils.d.ts +6 -1
- package/dist/utils/BagelFormUtils.d.ts.map +1 -1
- package/dist/utils/timeAgo.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/{MapEmbed.vue → MapEmbed/Index.vue} +1 -1
- package/src/components/Modal.vue +1 -0
- package/src/components/form/BagelForm.vue +23 -7
- package/src/components/form/FieldArray.vue +2 -2
- package/src/components/form/inputs/DateInput.vue +47 -7
- package/src/components/form/inputs/NumberInput.vue +2 -2
- package/src/components/form/inputs/PasswordInput.vue +2 -0
- package/src/components/form/inputs/TextInput.vue +4 -1
- package/src/components/index.ts +3 -3
- package/src/composables/useSchemaField.ts +34 -1
- package/src/plugins/bagel.ts +1 -2
- package/src/styles/text.css +911 -560
- package/src/utils/BagelFormUtils.ts +10 -1
- package/src/utils/timeAgo.ts +9 -17
- package/tsconfig.json +2 -1
- package/src/components/DataTable/tableTypes.d.ts +0 -0
- /package/src/components/{dashboard → Dashboard}/Lineart.vue +0 -0
- /package/src/components/{dashboard → Dashboard}/index.ts +0 -0
- /package/src/components/{layout → Layout}/BottomMenu.vue +0 -0
- /package/src/components/{layout → Layout}/Layout.vue +0 -0
- /package/src/components/{layout → Layout}/SidebarMenu.vue +0 -0
- /package/src/components/{layout → Layout}/Skeleton.vue +0 -0
- /package/src/components/{layout → Layout}/TabbedLayout.vue +0 -0
- /package/src/components/{layout → Layout}/Tabs.vue +0 -0
- /package/src/components/{layout → Layout}/TabsBody.vue +0 -0
- /package/src/components/{layout → Layout}/TabsNav.vue +0 -0
- /package/src/components/{layout → Layout}/index.ts +0 -0
- /package/src/components/{layout → Layout}/tabsManager.ts +0 -0
- /package/src/components/{lightbox → Lightbox}/Lightbox.vue +0 -0
- /package/src/components/{lightbox → Lightbox}/index.ts +0 -0
- /package/src/components/{lightbox → Lightbox}/lightbox.types.ts +0 -0
- /package/src/components/{leaflet → MapEmbed}/leaflet.css +0 -0
|
@@ -10,7 +10,12 @@ interface InputOptions {
|
|
|
10
10
|
autocomplete?: string;
|
|
11
11
|
vIf?: boolean | ((item: any, row: any) => boolean);
|
|
12
12
|
}
|
|
13
|
-
|
|
13
|
+
interface DateOptions extends InputOptions {
|
|
14
|
+
enableTime?: boolean;
|
|
15
|
+
mode?: 'day' | 'month' | 'year';
|
|
16
|
+
locale?: string;
|
|
17
|
+
timezone?: string;
|
|
18
|
+
}
|
|
14
19
|
interface TextInputOptions extends InputOptions {
|
|
15
20
|
type?: 'text' | 'tel' | 'email';
|
|
16
21
|
pattern?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BagelFormUtils.d.ts","sourceRoot":"","sources":["../../src/utils/BagelFormUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC/E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+CAA+C,CAAA;AAErF,UAAU,YAAY;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IAC9B,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,GAAG,CAAC,EAAE,OAAO,GAAG,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,GAA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E,MAAM,GAAE,MAAmB,EAAE,MAAM,CAAC,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"timeAgo.d.ts","sourceRoot":"","sources":["../../src/utils/timeAgo.ts"],"names":[],"mappings":"AAWA,KAAK,sBAAsB,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;AAqDvD,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,EAAE,IAAI,GAAE,sBAA6B,UAsD/E;AASD,wBAAgB,UAAU,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,EAAE,MAAM,GAAE,MAAmB,EAAE,MAAM,CAAC,EAAE,MAAM,UAiF5F"}
|
package/package.json
CHANGED
package/src/components/Modal.vue
CHANGED
|
@@ -109,9 +109,14 @@ function updateFormData(fieldId: string, value: any) {
|
|
|
109
109
|
emit('update:modelValue', formData.value)
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
+
// Form validation
|
|
113
|
+
const validateForm = () => form.value?.reportValidity() ?? false
|
|
114
|
+
let formError = ref<Error>()
|
|
112
115
|
// Form submission
|
|
113
116
|
async function handleSubmit() {
|
|
114
117
|
try {
|
|
118
|
+
const valid = validateForm()
|
|
119
|
+
if (!valid) return
|
|
115
120
|
if (formState.value === 'submitting') return
|
|
116
121
|
formState.value = 'submitting'
|
|
117
122
|
await props.onSubmit?.(formData.value)
|
|
@@ -119,14 +124,12 @@ async function handleSubmit() {
|
|
|
119
124
|
formState.value = 'success'
|
|
120
125
|
window.parent.postMessage({ type: 'BAGEL_FORM_SUCCESS', data: JSON.stringify(formData.value) }, '*')
|
|
121
126
|
} catch (error) {
|
|
122
|
-
console.error('Submit error:', error)
|
|
123
127
|
formState.value = 'error'
|
|
128
|
+
formError.value = error as Error
|
|
129
|
+
console.error('Submit error:', formError.value)
|
|
124
130
|
}
|
|
125
131
|
}
|
|
126
132
|
|
|
127
|
-
// Form validation
|
|
128
|
-
const validateForm = () => form.value?.reportValidity() ?? false
|
|
129
|
-
|
|
130
133
|
// Field rendering
|
|
131
134
|
const { renderField } = useSchemaField<T>({
|
|
132
135
|
mode: 'form',
|
|
@@ -144,12 +147,26 @@ const { renderField } = useSchemaField<T>({
|
|
|
144
147
|
|
|
145
148
|
const renderSchemaField = (field: Field<T>): VNode | null => renderField(field)
|
|
146
149
|
|
|
150
|
+
// Add new method to handle slot input changes
|
|
151
|
+
function handleSlotInputChange(event: Event) {
|
|
152
|
+
const input = event.target as HTMLInputElement
|
|
153
|
+
if (input.name) {
|
|
154
|
+
const value = input.type === 'checkbox' ? input.checked : input.value
|
|
155
|
+
updateFormData(input.name, value)
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
147
159
|
defineExpose({ form, isDirty, validateForm, resolveSchema, refreshSchema })
|
|
148
160
|
</script>
|
|
149
161
|
|
|
150
162
|
<template>
|
|
151
163
|
<template v-if="formState !== 'success' || !$slots.success">
|
|
152
|
-
<form
|
|
164
|
+
<form
|
|
165
|
+
v-if="props.tag === 'form'" ref="form"
|
|
166
|
+
:class="props.class"
|
|
167
|
+
@submit.prevent="handleSubmit"
|
|
168
|
+
@input="handleSlotInputChange"
|
|
169
|
+
>
|
|
153
170
|
<!-- Loading state -->
|
|
154
171
|
<slot v-if="schemaState === 'loading'" name="loading">
|
|
155
172
|
<div class="flex-center h-300px">
|
|
@@ -174,7 +191,6 @@ defineExpose({ form, isDirty, validateForm, resolveSchema, refreshSchema })
|
|
|
174
191
|
|
|
175
192
|
<!-- Default slot -->
|
|
176
193
|
<slot v-else />
|
|
177
|
-
|
|
178
194
|
<!-- Submit slot -->
|
|
179
195
|
<slot
|
|
180
196
|
name="submit"
|
|
@@ -210,5 +226,5 @@ defineExpose({ form, isDirty, validateForm, resolveSchema, refreshSchema })
|
|
|
210
226
|
|
|
211
227
|
<!-- Success/error slots -->
|
|
212
228
|
<slot v-if="formState === 'success'" name="success" />
|
|
213
|
-
<slot v-if="formState === 'error'" name="error" />
|
|
229
|
+
<slot v-if="formState === 'error'" name="error" :error="formError" />
|
|
214
230
|
</template>
|
|
@@ -143,7 +143,7 @@ const isPrimitiveType = computed(() => props.type === 'text' || props.type === '
|
|
|
143
143
|
const canRenderItems = computed(() => isPrimitiveType.value || (props.type === 'object' && resolvedSchemaData.value.length > 0)
|
|
144
144
|
)
|
|
145
145
|
const showMinimizeButton = computed(() => {
|
|
146
|
-
return resolvedSchemaData.value.length >
|
|
146
|
+
return resolvedSchemaData.value.length > 2 || resolvedSchemaData.value.some(schema => schema.$el === 'richtext')
|
|
147
147
|
})
|
|
148
148
|
</script>
|
|
149
149
|
|
|
@@ -213,7 +213,7 @@ const showMinimizeButton = computed(() => {
|
|
|
213
213
|
</div>
|
|
214
214
|
|
|
215
215
|
<!-- Add Button -->
|
|
216
|
-
<Btn v-if="add" thin icon="add" color="gray" class="txt12" @click="addItem">
|
|
216
|
+
<Btn v-if="add" thin icon="add" color="gray" class="txt12 arrayAddButton" @click="addItem">
|
|
217
217
|
<p>{{ label }}</p>
|
|
218
218
|
</Btn>
|
|
219
219
|
</template>
|
|
@@ -29,7 +29,13 @@ const props = withDefaults(
|
|
|
29
29
|
enableTime: false,
|
|
30
30
|
editMode: true,
|
|
31
31
|
small: false,
|
|
32
|
-
timezone:
|
|
32
|
+
timezone: () => {
|
|
33
|
+
try {
|
|
34
|
+
return Intl.DateTimeFormat().resolvedOptions().timeZone
|
|
35
|
+
} catch {
|
|
36
|
+
return 'UTC'
|
|
37
|
+
}
|
|
38
|
+
}, // Default to UTC, will be updated in onMounted if not explicitly set
|
|
33
39
|
mode: 'day',
|
|
34
40
|
firstDayOfWeek: WEEK_START_DAY.SUNDAY,
|
|
35
41
|
locale: ''
|
|
@@ -299,6 +305,19 @@ function useInputHandling() {
|
|
|
299
305
|
const date = parseUserInput(input.value)
|
|
300
306
|
if (date) {
|
|
301
307
|
if (props.enableTime) {
|
|
308
|
+
// Apply timezone adjustments
|
|
309
|
+
try {
|
|
310
|
+
// Convert to ISO string in the target timezone
|
|
311
|
+
const targetDate = new Date(date.toLocaleString('en-US', { timeZone: props.timezone }))
|
|
312
|
+
const tzOffset = targetDate.getTime() - date.getTime()
|
|
313
|
+
date.setTime(date.getTime() - tzOffset)
|
|
314
|
+
} catch {
|
|
315
|
+
// Fallback to old behavior for UTC
|
|
316
|
+
if (props.timezone === 'UTC') {
|
|
317
|
+
const tzOffset = new Date().getTimezoneOffset()
|
|
318
|
+
date.setMinutes(date.getMinutes() + tzOffset)
|
|
319
|
+
}
|
|
320
|
+
}
|
|
302
321
|
emit('update:modelValue', date.toISOString())
|
|
303
322
|
} else {
|
|
304
323
|
const utcDate = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()))
|
|
@@ -325,6 +344,19 @@ function useInputHandling() {
|
|
|
325
344
|
const date = parseUserInput(inputValue.value)
|
|
326
345
|
if (date) {
|
|
327
346
|
if (props.enableTime) {
|
|
347
|
+
// Apply timezone adjustments
|
|
348
|
+
try {
|
|
349
|
+
// Convert to ISO string in the target timezone
|
|
350
|
+
const targetDate = new Date(date.toLocaleString('en-US', { timeZone: props.timezone }))
|
|
351
|
+
const tzOffset = targetDate.getTime() - date.getTime()
|
|
352
|
+
date.setTime(date.getTime() - tzOffset)
|
|
353
|
+
} catch {
|
|
354
|
+
// Fallback to old behavior for UTC
|
|
355
|
+
if (props.timezone === 'UTC') {
|
|
356
|
+
const tzOffset = new Date().getTimezoneOffset()
|
|
357
|
+
date.setMinutes(date.getMinutes() + tzOffset)
|
|
358
|
+
}
|
|
359
|
+
}
|
|
328
360
|
emit('update:modelValue', date.toISOString())
|
|
329
361
|
} else {
|
|
330
362
|
const utcDate = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()))
|
|
@@ -370,11 +402,20 @@ function selectDate(date: Date | null) {
|
|
|
370
402
|
newDate.setHours(currentHours)
|
|
371
403
|
newDate.setMinutes(currentMinutes)
|
|
372
404
|
|
|
373
|
-
//
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
405
|
+
// Apply timezone adjustment
|
|
406
|
+
try {
|
|
407
|
+
// Convert to ISO string in the target timezone
|
|
408
|
+
const targetDate = new Date(newDate.toLocaleString('en-US', { timeZone: props.timezone }))
|
|
409
|
+
const tzOffset = targetDate.getTime() - newDate.getTime()
|
|
410
|
+
newDate.setTime(newDate.getTime() - tzOffset)
|
|
411
|
+
} catch {
|
|
412
|
+
// Fallback to old behavior for UTC
|
|
413
|
+
if (props.timezone === 'UTC') {
|
|
414
|
+
const tzOffset = new Date().getTimezoneOffset()
|
|
415
|
+
newDate.setMinutes(newDate.getMinutes() + tzOffset)
|
|
416
|
+
}
|
|
377
417
|
}
|
|
418
|
+
|
|
378
419
|
emit('update:modelValue', newDate.toISOString())
|
|
379
420
|
} else {
|
|
380
421
|
// For date-only selection, ensure we're working with UTC midnight
|
|
@@ -410,7 +451,6 @@ onMounted(() => {
|
|
|
410
451
|
{{ label }}
|
|
411
452
|
<span v-if="required" class="required">*</span>
|
|
412
453
|
</label>
|
|
413
|
-
|
|
414
454
|
<Dropdown
|
|
415
455
|
:shown="isOpen"
|
|
416
456
|
placement="bottom-start"
|
|
@@ -521,7 +561,7 @@ onMounted(() => {
|
|
|
521
561
|
</div>
|
|
522
562
|
</div>
|
|
523
563
|
|
|
524
|
-
<div v-if="enableTime && currentView === 'days'" class="time-picker border-start flex column gap-1 w-120px">
|
|
564
|
+
<div v-if="enableTime && currentView === 'days'" class="time-picker border-start flex column gap-1 w-120px px-025">
|
|
525
565
|
<div class="flex gap-025">
|
|
526
566
|
<NumberInput
|
|
527
567
|
center
|
|
@@ -71,7 +71,7 @@ function subtract(...numbers: (number | undefined)[]) {
|
|
|
71
71
|
return Number.parseFloat(numArr.reduce((acc, curr) => acc - curr, firstNum).toFixed(precision))
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
const canAdd = $computed(() =>
|
|
74
|
+
const canAdd = $computed(() => max === undefined || add(numberValue, step) <= max)
|
|
75
75
|
const canDecrement = $computed(() => min === undefined || subtract(numberValue, step) >= min)
|
|
76
76
|
|
|
77
77
|
// Methods
|
|
@@ -178,7 +178,7 @@ watch(() => modelValue, (newVal) => {
|
|
|
178
178
|
@keydown.up.prevent="increment"
|
|
179
179
|
@keydown.down.prevent="decrement"
|
|
180
180
|
>
|
|
181
|
-
<p v-if="helptext">
|
|
181
|
+
<p v-if="helptext" class="opacity-7 light">
|
|
182
182
|
{{ helptext }}
|
|
183
183
|
</p>
|
|
184
184
|
<Icon
|
|
@@ -14,6 +14,7 @@ export interface TextInputProps {
|
|
|
14
14
|
pattern?: string
|
|
15
15
|
shrink?: boolean
|
|
16
16
|
disabled?: boolean
|
|
17
|
+
name?: string
|
|
17
18
|
nativeInputAttrs?: { [key: string]: any }
|
|
18
19
|
icon?: IconType
|
|
19
20
|
iconStart?: IconType
|
|
@@ -48,6 +49,7 @@ const inputType = $computed(() => (showPwd.value ? 'text' : 'password'))
|
|
|
48
49
|
v-bind="props"
|
|
49
50
|
:type="inputType"
|
|
50
51
|
class="mb-0"
|
|
52
|
+
:name="props.name"
|
|
51
53
|
/>
|
|
52
54
|
<div class="m-password position-bottom-end flex column justify-content-center">
|
|
53
55
|
<Btn
|
|
@@ -12,6 +12,7 @@ const props = withDefaults(
|
|
|
12
12
|
id?: string
|
|
13
13
|
title?: string
|
|
14
14
|
helptext?: string
|
|
15
|
+
name?: string
|
|
15
16
|
placeholder?: string
|
|
16
17
|
modelValue?: string | number
|
|
17
18
|
label?: string
|
|
@@ -99,6 +100,7 @@ onMounted(() => {
|
|
|
99
100
|
:id
|
|
100
101
|
ref="input"
|
|
101
102
|
v-model.trim="inputVal"
|
|
103
|
+
:name
|
|
102
104
|
:title
|
|
103
105
|
:autocomplete
|
|
104
106
|
:type="type"
|
|
@@ -117,6 +119,7 @@ onMounted(() => {
|
|
|
117
119
|
:id
|
|
118
120
|
ref="input"
|
|
119
121
|
v-model="inputVal"
|
|
122
|
+
:name
|
|
120
123
|
:title
|
|
121
124
|
:type
|
|
122
125
|
:rows="inputRows"
|
|
@@ -128,7 +131,7 @@ onMounted(() => {
|
|
|
128
131
|
@input="updateInputVal"
|
|
129
132
|
@focusout="onFocusout"
|
|
130
133
|
/>
|
|
131
|
-
<p v-if="helptext">{{ helptext }}</p>
|
|
134
|
+
<p v-if="helptext" class="opacity-7 light">{{ helptext }}</p>
|
|
132
135
|
<Icon
|
|
133
136
|
v-if="iconStart"
|
|
134
137
|
class="iconStart"
|
package/src/components/index.ts
CHANGED
|
@@ -10,7 +10,7 @@ export { default as Btn } from './Btn.vue'
|
|
|
10
10
|
export { default as Calendar } from './Calendar/Index.vue'
|
|
11
11
|
export { default as Card } from './Card.vue'
|
|
12
12
|
export { default as Carousel } from './Carousel.vue'
|
|
13
|
-
export * from './
|
|
13
|
+
export * from './Dashboard'
|
|
14
14
|
export { default as DataPreview } from './DataPreview.vue'
|
|
15
15
|
export { default as DataTable } from './DataTable/DataTable.vue'
|
|
16
16
|
/** @deprecated Use DataTable instead. TableSchema is an alias that will be removed in a future version. */
|
|
@@ -23,11 +23,11 @@ export * from './form'
|
|
|
23
23
|
export { default as Icon } from './Icon/Icon.vue'
|
|
24
24
|
export { default as IframeVue } from './IframeVue.vue'
|
|
25
25
|
export { default as Image } from './Image.vue'
|
|
26
|
-
export * from './
|
|
26
|
+
export * from './Layout'
|
|
27
27
|
export { default as ListItem } from './ListItem.vue'
|
|
28
28
|
export { default as ListView } from './ListView.vue'
|
|
29
29
|
export { default as Loading } from './Loading.vue'
|
|
30
|
-
export { default as MapEmbed } from './MapEmbed.vue'
|
|
30
|
+
export { default as MapEmbed } from './MapEmbed/Index.vue'
|
|
31
31
|
export { default as Modal } from './Modal.vue'
|
|
32
32
|
export { default as ModalConfirm } from './ModalConfirm.vue'
|
|
33
33
|
export { default as ModalForm } from './ModalForm.vue'
|
|
@@ -42,6 +42,37 @@ type SupportedSlot<T> = BglFormSchemaT<T> | VNode | SlotFunction<T>
|
|
|
42
42
|
export function useSchemaField<T extends { [key: string]: any }>(optns: UseSchemaFieldOptions<T>) {
|
|
43
43
|
const { mode = 'form', getRowData, onUpdate, includeUnset = false } = optns
|
|
44
44
|
|
|
45
|
+
// Helper function to render objects recursively
|
|
46
|
+
function renderObject(obj: any, depth = 0): string {
|
|
47
|
+
if (obj === null || obj === undefined) return ''
|
|
48
|
+
if (typeof obj !== 'object') return String(obj)
|
|
49
|
+
if (Array.isArray(obj)) return obj.map(item => renderObject(item, depth + 1)).join(', ')
|
|
50
|
+
|
|
51
|
+
// For objects, format as key: value pairs
|
|
52
|
+
const indent = depth > 0 ? ' '.repeat(depth) : ''
|
|
53
|
+
const nextIndent = ' '.repeat(depth + 1)
|
|
54
|
+
|
|
55
|
+
const entries = Object.entries(obj)
|
|
56
|
+
if (entries.length === 0) return '{}'
|
|
57
|
+
|
|
58
|
+
// For nested objects, format with newlines and indentation
|
|
59
|
+
if (depth > 0) {
|
|
60
|
+
return `{\n${entries
|
|
61
|
+
.map(([key, value]) => `${nextIndent}${key}: ${renderObject(value, depth + 1)}`)
|
|
62
|
+
.join(',\n')}\n${indent}}`
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// For top-level objects, format as a flat list
|
|
66
|
+
return entries
|
|
67
|
+
.map(([key, value]) => {
|
|
68
|
+
const valueStr = typeof value === 'object' && value !== null
|
|
69
|
+
? renderObject(value, depth + 1)
|
|
70
|
+
: String(value)
|
|
71
|
+
return `${key}: ${valueStr}`
|
|
72
|
+
})
|
|
73
|
+
.join('\n')
|
|
74
|
+
}
|
|
75
|
+
|
|
45
76
|
function getComponent(field: BaseBagelField<T>) {
|
|
46
77
|
const componentMap = {
|
|
47
78
|
text: TextInput,
|
|
@@ -237,7 +268,9 @@ export function useSchemaField<T extends { [key: string]: any }>(optns: UseSchem
|
|
|
237
268
|
h('div', { class: 'field-value' }, [
|
|
238
269
|
slotContent || (typeof field.$el === 'object'
|
|
239
270
|
? h(Component as any, props, componentSlots)
|
|
240
|
-
: transformedValue
|
|
271
|
+
: typeof transformedValue === 'object' && transformedValue !== null
|
|
272
|
+
? h('pre', { style: 'margin: 0; white-space: pre-wrap; font-family: inherit; font-size: inherit;' }, renderObject(transformedValue))
|
|
273
|
+
: transformedValue?.toString() || '')
|
|
241
274
|
])
|
|
242
275
|
])
|
|
243
276
|
}
|
package/src/plugins/bagel.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { InjectionKey, Plugin } from 'vue'
|
|
|
2
2
|
import { Bagel } from '@bagelink/sdk'
|
|
3
3
|
import FloatingVue from 'floating-vue'
|
|
4
4
|
import { inject } from 'vue'
|
|
5
|
-
import Lightbox from '../components/
|
|
5
|
+
import Lightbox from '../components/Lightbox'
|
|
6
6
|
import { ripple, pattern } from '../directives'
|
|
7
7
|
import { useLang } from '../utils'
|
|
8
8
|
import clickOutside from '../utils/clickOutside'
|
|
@@ -13,7 +13,6 @@ export const i18nTInjectionKey = Symbol('bagel') as InjectionKey<(key: string) =
|
|
|
13
13
|
export function useBagel() {
|
|
14
14
|
const bagel = inject(bagelInjectionKey)
|
|
15
15
|
if (!bagel) throw new Error('No bagel provided')
|
|
16
|
-
|
|
17
16
|
return bagel
|
|
18
17
|
}
|
|
19
18
|
|