@bagelink/vue 1.20.72 → 1.20.76

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bagelink/vue",
3
3
  "type": "module",
4
- "version": "1.20.72",
4
+ "version": "1.20.76",
5
5
  "description": "Bagel core sdk packages",
6
6
  "author": {
7
7
  "name": "Bagel Studio",
@@ -63,7 +63,7 @@
63
63
  "@types/signature_pad": "^4.0.0",
64
64
  "vue": "^3.5.43",
65
65
  "vue-component-type-helpers": "^2.2.12",
66
- "@bagelink/sdk": "1.20.72"
66
+ "@bagelink/sdk": "1.20.76"
67
67
  },
68
68
  "peerDependencies": {
69
69
  "@bagelink/sdk": "*",
@@ -17,6 +17,8 @@ interface Row {
17
17
  type: string
18
18
  asset?: AssetReference
19
19
  thumb?: string
20
+ /** A previously saved URL string, shown until the editor replaces it with an asset. */
21
+ legacy?: boolean
20
22
  progress?: number
21
23
  success: boolean
22
24
  downloadUrl?: string
@@ -324,7 +326,19 @@ const previewQueue = computed<Row[]>(() => {
324
326
  /** Lab-only: hold the success check on every stored row instead of flashing it. */
325
327
  const previewSuccess = computed(() => props.previewState?.state === 'success')
326
328
 
329
+ function savedUrls(value: unknown): string[] {
330
+ return [value].flat().filter((item): item is string => typeof item === 'string' && item.trim() !== '')
331
+ }
332
+
327
333
  const rows = computed<Row[]>(() => [
334
+ ...savedUrls(props.modelValue).map((url): Row => ({
335
+ key: url,
336
+ label: decodeURIComponent(url.split('/').pop()?.split('?')[0] || 'Image'),
337
+ type: 'image',
338
+ thumb: url,
339
+ success: false,
340
+ legacy: true,
341
+ })),
328
342
  ...values.value.map((value, index): Row => ({
329
343
  key: value.asset_id,
330
344
  label: labelFor(value),
@@ -370,6 +384,15 @@ function srcFor(row: Row) {
370
384
  }
371
385
 
372
386
  function removeRow(row: Row) {
387
+ if (row.legacy) {
388
+ if (!props.multiple) {
389
+ emit('update:modelValue', undefined)
390
+ return
391
+ }
392
+ const next = savedUrls(props.modelValue).filter(url => url !== row.thumb)
393
+ emit('update:modelValue', next.length ? next as unknown as AssetReference[] : undefined)
394
+ return
395
+ }
373
396
  if (row.asset) {
374
397
  const index = row.index
375
398
  ?? values.value.findIndex(value => value.asset_id === row.asset?.asset_id)
@@ -464,7 +487,7 @@ const listStyle = computed<CSSProperties | undefined>(() => {
464
487
  v-for="row in rows" :key="row.key" :label="row.label" :type="row.type"
465
488
  :asset="row.asset" :thumb="row.thumb" :progress="row.progress" :success="row.success"
466
489
  :download-url="row.downloadUrl" :readonly="readonly" :disabled="disabled"
467
- :crop="cropAfterUpload" :icon-weight="iconWeight"
490
+ :crop="cropAfterUpload && !!row.asset" :icon-weight="iconWeight"
468
491
  @remove="removeRow(row)" @replace="pick(row.index)" @crop="cropUploaded(row)"
469
492
  />
470
493
  <span v-if="!rows.length" class="txt-gray txt-12">
@@ -531,7 +554,7 @@ const listStyle = computed<CSSProperties | undefined>(() => {
531
554
  :aria-label="$t('upload.replace')" @click.stop="pick(single.index)"
532
555
  />
533
556
  <Btn
534
- v-if="!disabled && cropAfterUpload && single.type === 'image'"
557
+ v-if="!disabled && cropAfterUpload && single.asset && single.type === 'image'"
535
558
  color="white" frame thin icon="crop"
536
559
  :icon-size="actionIconSize" :icon-mobile-size="actionIconMobileSize"
537
560
  :aria-label="$t('upload.cropExisting')" @click.stop="cropUploaded(single)"
@@ -615,7 +638,7 @@ const listStyle = computed<CSSProperties | undefined>(() => {
615
638
  @click.stop="pick(row.index)"
616
639
  />
617
640
  <Btn
618
- v-if="cropAfterUpload && row.type === 'image'" color="white" frame thin
641
+ v-if="cropAfterUpload && row.asset && row.type === 'image'" color="white" frame thin
619
642
  icon="crop" :aria-label="$t('upload.cropExisting')"
620
643
  :icon-size="actionIconSize" :icon-mobile-size="actionIconMobileSize"
621
644
  @click.stop="cropUploaded(row)"
@@ -646,7 +669,7 @@ const listStyle = computed<CSSProperties | undefined>(() => {
646
669
  v-for="row in rows" :key="row.key" :label="row.label" :type="row.type"
647
670
  :asset="row.asset" :thumb="row.thumb" :progress="row.progress" :success="row.success"
648
671
  :readonly="readonly" :disabled="disabled" :download-url="row.downloadUrl"
649
- :crop="cropAfterUpload" :icon-weight="iconWeight"
672
+ :crop="cropAfterUpload && !!row.asset" :icon-weight="iconWeight"
650
673
  @remove="removeRow(row)" @replace="pick(row.index)" @crop="cropUploaded(row)"
651
674
  />
652
675
  <div v-if="!locked" class="bgl-add-more">
@@ -693,7 +716,7 @@ const listStyle = computed<CSSProperties | undefined>(() => {
693
716
  v-for="row in rows" :key="row.key" :label="row.label" :type="row.type"
694
717
  :asset="row.asset" :thumb="row.thumb" :progress="row.progress" :success="row.success"
695
718
  :readonly="readonly" :disabled="disabled" :download-url="row.downloadUrl"
696
- :crop="cropAfterUpload" :icon-weight="iconWeight"
719
+ :crop="cropAfterUpload && !!row.asset" :icon-weight="iconWeight"
697
720
  @remove="removeRow(row)" @replace="pick(row.index)" @crop="cropUploaded(row)"
698
721
  />
699
722
  </div>
@@ -1267,6 +1267,8 @@ function createFieldFromProperty(
1267
1267
  const arrayConfig: Record<string, any> = { ...config }
1268
1268
  if (xUi.allowAdd !== undefined) arrayConfig.allowAdd = xUi.allowAdd
1269
1269
  if (xUi.allowDelete !== undefined) arrayConfig.allowDelete = xUi.allowDelete
1270
+ if (xUi.allowReorder !== undefined) arrayConfig.allowReorder = xUi.allowReorder
1271
+ if (xUi.collapsible !== undefined) arrayConfig.collapsible = xUi.collapsible
1270
1272
  if (xUi.sortOrder !== undefined) arrayConfig.sortOrder = xUi.sortOrder
1271
1273
  const itemSchema = resolvedProp.items?.type === 'object'
1272
1274
  ? fromJSONSchema(resolvedProp.items as JSONSchemaObject, { loadOptionsSource })