@bagelink/vue 1.9.136 → 1.9.140

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.9.136",
4
+ "version": "1.9.140",
5
5
  "description": "Bagel core sdk packages",
6
6
  "author": {
7
7
  "name": "Bagel Studio",
@@ -1,10 +1,13 @@
1
1
  <script setup lang="ts">
2
- import { initials } from '@bagelink/vue'
2
+ import type { IconType } from '@bagelink/vue'
3
+ import { initials, Icon } from '@bagelink/vue'
4
+ import Image from './Image.vue'
3
5
 
4
6
  withDefaults(defineProps<{
5
7
  fallback?: string
6
8
  src?: string
7
9
  name?: string
10
+ icon?: IconType
8
11
  alt?: string
9
12
  size?: number
10
13
  }>(), { size: 50 })
@@ -15,7 +18,8 @@ withDefaults(defineProps<{
15
18
  class="round overflow-hidden txt-center p-0 avatar flex justify-content-center"
16
19
  :style="{ width: `${size}px`, height: `${size}px` }"
17
20
  >
18
- <img v-if="src" :src="src" :alt="alt || name">
21
+ <Image v-if="src" :src="src" :alt="alt || name" />
22
+ <Icon v-else-if="icon" :icon="icon" :size="size / 40" />
19
23
  <p v-else :style="{ 'line-height': `${size}px`, 'font-size': `calc(1.5rem * ${size} / 50)` }">
20
24
  {{ (fallback || initials(name || '')).toUpperCase() }}
21
25
  </p>
@@ -24,21 +28,21 @@ withDefaults(defineProps<{
24
28
 
25
29
  <style scoped>
26
30
  .avatar {
27
- background-color: var(--bgl-gray-tint);
28
- border: 0.5px solid var(--border-color);
29
- flex-shrink: 0;
31
+ background-color: var(--bgl-gray-tint);
32
+ border: 0.5px solid var(--border-color);
33
+ flex-shrink: 0;
30
34
  }
31
35
 
32
36
  .avatar p {
33
- font-size: 1.5rem;
34
- line-height: 50px;
35
- margin: 0;
36
- font-weight: 200;
37
+ font-size: 1.5rem;
38
+ line-height: 50px;
39
+ margin: 0;
40
+ font-weight: 200;
37
41
  }
38
42
 
39
43
  .avatar img {
40
- width: 100%;
41
- height: 100%;
42
- object-fit: cover;
44
+ width: 100%;
45
+ height: 100%;
46
+ object-fit: cover;
43
47
  }
44
48
  </style>
@@ -1,7 +1,7 @@
1
1
  <script setup lang="ts" generic="T = unknown">
2
2
  import type { Ref, WritableComputedRef } from 'vue'
3
3
 
4
- import { Btn, resolveI18n } from '@bagelink/vue'
4
+ import { Btn, resolveI18n, useI18n } from '@bagelink/vue'
5
5
  import { computed, ref, watch } from 'vue'
6
6
 
7
7
  const props = defineProps<{
@@ -13,15 +13,17 @@ const props = defineProps<{
13
13
  allowReorder?: boolean
14
14
  addText?: string
15
15
  deleteTooltip?: string
16
+ itemLabel?: string
16
17
  collapsible?: boolean
17
18
  }>()
18
19
 
19
20
  const emit = defineEmits(['update:modelValue'])
20
-
21
21
  defineSlots<{
22
22
  default: (props: { item: WritableComputedRef<T>, index: number }) => unknown
23
23
  }>()
24
24
 
25
+ const { locale } = useI18n()
26
+
25
27
  const items = ref(Array.isArray(props.modelValue) ? [...props.modelValue] : []) as Ref<T[]>
26
28
  const minimizedItems = ref(Array.from({ length: items.value.length }, () => true))
27
29
  const draggingIndex = ref<number | null>(null)
@@ -29,11 +31,28 @@ const dragOverIndex = ref<number | null>(null)
29
31
  const keySeed = ref(0)
30
32
  const itemKeys = ref(Array.from({ length: items.value.length }, () => nextItemKey()))
31
33
 
34
+ const isHebrewUi = computed(() => {
35
+ const localeValue = locale.value.toLowerCase()
36
+ return localeValue.startsWith('he')
37
+ })
38
+
39
+ const itemLabelPrefix = computed(() => {
40
+ const resolvedCustomLabel = resolveI18n(props.itemLabel)
41
+ if (typeof resolvedCustomLabel === 'string' && resolvedCustomLabel.length > 0) {
42
+ return resolvedCustomLabel
43
+ }
44
+ return isHebrewUi.value ? 'פריט' : 'Item'
45
+ })
46
+
32
47
  function nextItemKey() {
33
48
  keySeed.value += 1
34
49
  return `array-item-${keySeed.value}`
35
50
  }
36
51
 
52
+ function getItemLabel(index: number) {
53
+ return `${itemLabelPrefix.value} ${index + 1}`
54
+ }
55
+
37
56
  watch(
38
57
  () => props.modelValue,
39
58
  (newVal) => {
@@ -163,7 +182,7 @@ function getItemRef(i: number) {
163
182
  >
164
183
  <div class="flex space-between gap-05">
165
184
  <Btn v-if="allowReorder" v-tooltip="resolveI18n('Drag to reorder')" flat thin icon="drag_indicator" class="grab" draggable="true" @dragstart="onDragStart($event, i)" @dragend="onDragEnd" />
166
- <Btn full-width align-txt="start" class="px-05" flat :icon="minimizedItems[i] ? 'expand_more' : 'expand_less'" :value="resolveI18n(`Item ${i + 1}`)" @click="toggleItem(i)" />
185
+ <Btn full-width align-txt="start" class="px-05" flat :icon="minimizedItems[i] ? 'expand_more' : 'expand_less'" :value="getItemLabel(i)" @click="toggleItem(i)" />
167
186
  <Btn v-if="allowDelete" v-tooltip="resolveI18n(deleteTooltip || 'Delete')" flat icon="delete" :confirm="resolveI18n('Are you sure you want to delete this item?')" @click="deleteItem(i)" />
168
187
  </div>
169
188
  <Transition name="array-collapse">
@@ -3804,6 +3804,11 @@ const imgTransform = computed({
3804
3804
  min-width: 32px;
3805
3805
  height: 32px;
3806
3806
  padding: 0;
3807
+ transform: rotate(0) !important;
3808
+ }
3809
+
3810
+ [dir="rtl"] .inline-toolbar-content .bgl_btn-icon {
3811
+ transform: rotate(0) !important;
3807
3812
  }
3808
3813
 
3809
3814
  .inline-toolbar-content .btn.active {
@@ -279,8 +279,8 @@ export const $ = {
279
279
  },
280
280
 
281
281
  richtext(
282
- labelOrConfig?: string | (BaseFieldConfig & { autoheight?: boolean }),
283
- config?: BaseFieldConfig & { autoheight?: boolean }
282
+ labelOrConfig?: string | (BaseFieldConfig & { autoheight?: boolean, basic?: boolean }),
283
+ config?: BaseFieldConfig & { autoheight?: boolean, basic?: boolean }
284
284
  ): FieldBuilder<string> {
285
285
  return new Field('richtext', parseArgs(labelOrConfig, config))
286
286
  },
@@ -367,6 +367,7 @@ export const $ = {
367
367
  placeholder?: string
368
368
  noFilePlaceholder?: string
369
369
  btnPlaceholder?: string
370
+ style?: string
370
371
  }),
371
372
  config?: BaseFieldConfig & {
372
373
  multiple?: boolean
@@ -382,6 +383,7 @@ export const $ = {
382
383
  placeholder?: string
383
384
  noFilePlaceholder?: string
384
385
  btnPlaceholder?: string
386
+ style?: string
385
387
  }
386
388
  ): FieldBuilder<string | string[]> {
387
389
  return new Field('upload', parseArgs(labelOrConfig, config))