@bagelink/vue 1.5.17 → 1.5.22

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.
Files changed (133) hide show
  1. package/bin/experimentalGenTypedRoutes.ts +15 -15
  2. package/bin/generateFormSchema.ts +12 -12
  3. package/bin/utils.ts +4 -4
  4. package/dist/components/Dropdown.vue.d.ts.map +1 -1
  5. package/dist/components/calendar/CalendarPopover.vue.d.ts.map +1 -1
  6. package/dist/components/form/BagelForm.vue.d.ts.map +1 -1
  7. package/dist/components/form/FieldArray.vue.d.ts +5 -4
  8. package/dist/components/form/FieldArray.vue.d.ts.map +1 -1
  9. package/dist/components/form/inputs/CheckInput.vue.d.ts.map +1 -1
  10. package/dist/components/form/inputs/RichText/index.vue.d.ts +1 -0
  11. package/dist/components/form/inputs/RichText/index.vue.d.ts.map +1 -1
  12. package/dist/components/form/inputs/SelectInput.vue.d.ts.map +1 -1
  13. package/dist/components/form/inputs/ToggleInput.vue.d.ts.map +1 -1
  14. package/dist/components/form/inputs/Upload/UploadInput.vue.d.ts.map +1 -1
  15. package/dist/composables/useFormField.d.ts.map +1 -1
  16. package/dist/composables/useSchemaField.d.ts.map +1 -1
  17. package/dist/index.cjs +17 -14
  18. package/dist/index.mjs +511 -422
  19. package/dist/style.css +1 -1
  20. package/package.json +1 -1
  21. package/src/components/AccordionItem.vue +2 -2
  22. package/src/components/AddToCalendar.vue +1 -1
  23. package/src/components/BglVideo.vue +8 -8
  24. package/src/components/Btn.vue +9 -9
  25. package/src/components/Card.vue +4 -4
  26. package/src/components/Carousel.vue +44 -44
  27. package/src/components/DataPreview.vue +1 -1
  28. package/src/components/DragOver.vue +6 -6
  29. package/src/components/Dropdown.vue +14 -14
  30. package/src/components/Flag.vue +3 -3
  31. package/src/components/Icon/Icon.vue +13 -13
  32. package/src/components/Image.vue +4 -4
  33. package/src/components/ImportData.vue +79 -79
  34. package/src/components/ListItem.vue +7 -7
  35. package/src/components/MapEmbed/Index.vue +6 -6
  36. package/src/components/Modal.vue +10 -10
  37. package/src/components/ModalForm.vue +4 -4
  38. package/src/components/NavBar.vue +2 -2
  39. package/src/components/Pagination.vue +9 -9
  40. package/src/components/Pill.vue +1 -1
  41. package/src/components/Rating.vue +2 -2
  42. package/src/components/Slider.vue +77 -77
  43. package/src/components/Spreadsheet/Index.vue +34 -34
  44. package/src/components/Spreadsheet/SpreadsheetTable.vue +3 -3
  45. package/src/components/Zoomer.vue +28 -28
  46. package/src/components/analytics/BarChart.vue +6 -6
  47. package/src/components/analytics/KpiCard.vue +2 -2
  48. package/src/components/analytics/LineChart.vue +14 -14
  49. package/src/components/analytics/PieChart.vue +11 -11
  50. package/src/components/calendar/CalendarPopover.vue +1 -1
  51. package/src/components/calendar/Index.vue +1 -1
  52. package/src/components/calendar/views/AgendaView.vue +2 -2
  53. package/src/components/calendar/views/DayView.vue +6 -6
  54. package/src/components/calendar/views/MonthView.vue +2 -2
  55. package/src/components/calendar/views/WeekView.vue +18 -18
  56. package/src/components/dataTable/DataTable.vue +3 -3
  57. package/src/components/dataTable/useSorting.ts +1 -1
  58. package/src/components/dataTable/useTableData.ts +15 -15
  59. package/src/components/dataTable/useTableSelection.ts +8 -8
  60. package/src/components/dataTable/useTableVirtualization.ts +1 -1
  61. package/src/components/draggable/useDraggable.ts +42 -42
  62. package/src/components/form/BagelForm.vue +66 -23
  63. package/src/components/form/BglMultiStepForm.vue +18 -18
  64. package/src/components/form/FieldArray.vue +177 -67
  65. package/src/components/form/inputs/CheckInput.vue +2 -1
  66. package/src/components/form/inputs/CodeEditor/Index.vue +1 -1
  67. package/src/components/form/inputs/CodeEditor/format.ts +7 -7
  68. package/src/components/form/inputs/CodeEditor/useHighlight.ts +6 -6
  69. package/src/components/form/inputs/DateInput.vue +6 -6
  70. package/src/components/form/inputs/DatePicker.vue +19 -19
  71. package/src/components/form/inputs/EmailInput.vue +14 -14
  72. package/src/components/form/inputs/NumberInput.vue +6 -6
  73. package/src/components/form/inputs/OTP.vue +3 -3
  74. package/src/components/form/inputs/RadioGroup.vue +1 -1
  75. package/src/components/form/inputs/RadioPillsInput.vue +8 -8
  76. package/src/components/form/inputs/RichText/components/EditorToolbar.vue +10 -10
  77. package/src/components/form/inputs/RichText/components/TableGridSelector.vue +1 -1
  78. package/src/components/form/inputs/RichText/composables/useCommands.ts +1 -1
  79. package/src/components/form/inputs/RichText/composables/useEditor.ts +12 -12
  80. package/src/components/form/inputs/RichText/composables/useEditorKeyboard.ts +1 -1
  81. package/src/components/form/inputs/RichText/index.vue +143 -134
  82. package/src/components/form/inputs/RichText/utils/commands.ts +69 -69
  83. package/src/components/form/inputs/RichText/utils/debug.ts +1 -1
  84. package/src/components/form/inputs/RichText/utils/formatting.ts +39 -39
  85. package/src/components/form/inputs/RichText/utils/media.ts +6 -6
  86. package/src/components/form/inputs/RichText/utils/selection.ts +28 -28
  87. package/src/components/form/inputs/RichText/utils/table.ts +19 -19
  88. package/src/components/form/inputs/SelectBtn.vue +1 -1
  89. package/src/components/form/inputs/SelectInput.vue +50 -26
  90. package/src/components/form/inputs/SignaturePad.vue +15 -15
  91. package/src/components/form/inputs/TableField.vue +1 -1
  92. package/src/components/form/inputs/TelInput.vue +6 -6
  93. package/src/components/form/inputs/TextInput.vue +5 -5
  94. package/src/components/form/inputs/ToggleInput.vue +2 -1
  95. package/src/components/form/inputs/Upload/UploadInput.vue +155 -102
  96. package/src/components/form/inputs/Upload/upload.ts +1 -1
  97. package/src/components/form/inputs/Upload/useFileUpload.ts +6 -6
  98. package/src/components/form/useBagelFormState.ts +5 -5
  99. package/src/components/layout/AppContent.vue +1 -1
  100. package/src/components/layout/AppLayout.vue +1 -1
  101. package/src/components/layout/Layout.vue +4 -4
  102. package/src/components/layout/TabbedLayout.vue +1 -1
  103. package/src/components/layout/Tabs.vue +2 -2
  104. package/src/components/layout/TabsNav.vue +7 -7
  105. package/src/components/lightbox/Lightbox.vue +8 -8
  106. package/src/components/lightbox/index.ts +8 -8
  107. package/src/composables/index.ts +2 -2
  108. package/src/composables/useAddToCalendar.ts +13 -13
  109. package/src/composables/useDevice.ts +2 -2
  110. package/src/composables/useExcel.ts +6 -6
  111. package/src/composables/useFormField.ts +5 -9
  112. package/src/composables/usePolling.ts +8 -8
  113. package/src/composables/useSchemaField.ts +53 -38
  114. package/src/composables/useTheme.ts +9 -9
  115. package/src/composables/useValidateFieldValue.ts +2 -2
  116. package/src/directives/pattern.ts +25 -25
  117. package/src/directives/ripple.ts +4 -4
  118. package/src/directives/vResize.ts +6 -6
  119. package/src/plugins/bagel.ts +4 -4
  120. package/src/plugins/useModal.ts +3 -3
  121. package/src/styles/layout.css +7 -1
  122. package/src/utils/BagelFormUtils.ts +7 -7
  123. package/src/utils/calendar/Helpers.ts +8 -8
  124. package/src/utils/calendar/dateUtils.ts +22 -22
  125. package/src/utils/calendar/time.ts +25 -25
  126. package/src/utils/calendar/week.ts +25 -25
  127. package/src/utils/elementUtils.ts +27 -27
  128. package/src/utils/index.ts +22 -22
  129. package/src/utils/sizeParsing.ts +2 -2
  130. package/src/utils/strings.ts +5 -5
  131. package/src/utils/tapDetector.ts +11 -11
  132. package/src/utils/useSearch.ts +29 -29
  133. package/vite.config.ts +1 -1
@@ -30,9 +30,9 @@ const props = withDefaults(
30
30
  )
31
31
 
32
32
  const isComponent = $computed(() => {
33
- if (props.to) return 'router-link'
34
- if (props.href) return 'a'
35
- if (props.onClick) return 'button'
33
+ if (props.to) {return 'router-link'}
34
+ if (props.href) {return 'a'}
35
+ if (props.onClick) {return 'button'}
36
36
  return 'div'
37
37
  })
38
38
 
@@ -42,15 +42,15 @@ const isClickable = $computed(() => {
42
42
 
43
43
  const bind = $computed(() => {
44
44
  const obj: { [key: string]: any } = {}
45
- if (props.to) obj.to = props.to
46
- else if (props.href) obj.href = props.href
47
- if (props.target && (props.to || props.href)) obj.target = props.target
45
+ if (props.to) {obj.to = props.to}
46
+ else if (props.href) {obj.href = props.href}
47
+ if (props.target && (props.to || props.href)) {obj.target = props.target}
48
48
 
49
49
  obj.class = {
50
50
  'notClickable': !(props.to || props.onClick),
51
51
  'no-border-list': props.flat,
52
52
  }
53
- if (props.disabled) obj.disabled = true
53
+ if (props.disabled) {obj.disabled = true}
54
54
  return obj
55
55
  })
56
56
  </script>
@@ -41,7 +41,7 @@ const defaultMarkerSVG = '<svg width="28" height="38" viewBox="0 0 28 38" fill="
41
41
  const leafletScriptUrl = 'https://unpkg.com/leaflet@1.9.4/dist/leaflet.js'
42
42
 
43
43
  async function loadGlobalL() {
44
- while (!window.L) await sleep(100)
44
+ while (!window.L) {await sleep(100)}
45
45
  return window.L
46
46
  }
47
47
 
@@ -69,14 +69,14 @@ async function addMarker(marker: MapMarker) {
69
69
  const title = Array.isArray(marker) ? marker[2] : marker.title ?? marker.tooltip
70
70
  const tooltip = Array.isArray(marker) ? marker[2] : marker.tooltip
71
71
  const m = L?.marker(latlng, { title, icon, interactive: true }).addTo(map as Map) as Marker
72
- if (tooltip) m.bindTooltip(tooltip, { direction: 'top' }) // Use `bindPopup` if you want a click-to-show label
72
+ if (tooltip) {m.bindTooltip(tooltip, { direction: 'top' })} // Use `bindPopup` if you want a click-to-show label
73
73
  m.on('click', () => { emit('select', marker) })
74
74
 
75
75
  _markers.push(m)
76
76
  }
77
77
 
78
78
  function fitMarkers(L: any) {
79
- if (_markers.length > 0) {
79
+ if (0 < _markers.length) {
80
80
  const latLngs = _markers.map(marker => marker.getLatLng())
81
81
  const bounds = L.latLngBounds(latLngs)
82
82
  const center = bounds.getCenter()
@@ -96,12 +96,12 @@ function latLangFromMarker(marker: MapMarker): LatLngExpression {
96
96
  }
97
97
 
98
98
  async function watchMarkers(markers?: MapMarker[]) {
99
- if (!L) L = await loadGlobalL()
99
+ if (!L) {L = await loadGlobalL()}
100
100
  _markers.forEach(marker => marker.remove())
101
- if (!markers) return
101
+ if (!markers) {return}
102
102
 
103
103
  for (const marker of markers) {
104
- if (!map) await initializeMap()
104
+ if (!map) {await initializeMap()}
105
105
  addMarker(marker)
106
106
  }
107
107
  fitMarkers(L)
@@ -43,27 +43,27 @@ let isVisible = $ref<boolean>(false)
43
43
  watch(
44
44
  () => props.visible,
45
45
  (val) => {
46
- if (val === isVisible || val === undefined) return
47
- if (val) openModal()
48
- else closeModal()
46
+ if (val === isVisible || val === undefined) {return}
47
+ if (val) {openModal()}
48
+ else {closeModal()}
49
49
  },
50
50
  { immediate: true },
51
51
  )
52
52
 
53
53
  const maxWidth = $computed(() => {
54
54
  const { width } = props
55
- if (width?.match(/px|em|rem|vw|vh|%/)) return { 'max-width': width }
56
- if (width?.match(/\d+/)) return { 'max-width': `${width}px` }
55
+ if (width?.match(/px|em|rem|vw|vh|%/)) {return { 'max-width': width }}
56
+ if (width?.match(/\d+/)) {return { 'max-width': `${width}px` }}
57
57
  return { 'max-width': '720px' }
58
58
  })
59
59
 
60
60
  // Computed properties for close button placement
61
- const isOverlay = $computed(() => props.closePlacement === 'overlay' || props.closePlacement === 'overlay-end')
62
- const isHeader = $computed(() => props.closePlacement === 'header' || props.closePlacement === 'header-end')
63
- const isFooter = $computed(() => props.closePlacement === 'footer')
61
+ const isOverlay = $computed(() => 'overlay' === props.closePlacement || 'overlay-end' === props.closePlacement)
62
+ const isHeader = $computed(() => 'header' === props.closePlacement || 'header-end' === props.closePlacement)
63
+ const isFooter = $computed(() => 'footer' === props.closePlacement)
64
64
 
65
65
  const overlayCloseClass = $computed(() => {
66
- if (props.closePlacement === 'overlay-end') return 'top-1 end-1'
66
+ if ('overlay-end' === props.closePlacement) {return 'top-1 end-1'}
67
67
  return 'top-1 start-1'
68
68
  })
69
69
 
@@ -75,7 +75,7 @@ function closeModal() {
75
75
  defineExpose({ closeModal })
76
76
 
77
77
  function escapeKeyClose(e: KeyboardEvent) {
78
- if (props.dismissable && e.key === 'Escape') {
78
+ if (props.dismissable && 'Escape' === e.key) {
79
79
  closeModal()
80
80
  }
81
81
  }
@@ -28,16 +28,16 @@ const closeModal = () => modal?.closeModal()
28
28
  let submitting = $ref(false)
29
29
 
30
30
  async function runSubmit() {
31
- if (submitting) return
32
- if (form?.validateForm() === false) return
31
+ if (submitting) {return}
32
+ if (false === form?.validateForm()) {return}
33
33
  submitting = true
34
34
  try {
35
35
  await props.onSubmit?.(formData.value)
36
36
  closeModal()
37
37
  } catch (err: any) {
38
38
  submitting = false
39
- if (props.onError) props.onError(err)
40
- else bagel.onError?.(err)
39
+ if (props.onError) {props.onError(err)}
40
+ else {bagel.onError?.(err)}
41
41
  }
42
42
  }
43
43
 
@@ -23,10 +23,10 @@ withDefaults(
23
23
  let isOpen = $ref(true)
24
24
 
25
25
  function calcIsOpen() {
26
- isOpen = window.innerWidth < 1100
26
+ isOpen = 1100 > window.innerWidth
27
27
 
28
28
  const storedNavOpenVal = localStorage.getItem('navOpen')
29
- if (storedNavOpenVal === 'true' || storedNavOpenVal === null) isOpen = true
29
+ if ('true' === storedNavOpenVal || null === storedNavOpenVal) {isOpen = true}
30
30
  }
31
31
 
32
32
  function toggleMenu() {
@@ -34,7 +34,7 @@ let indicatorWidth = $ref(0)
34
34
 
35
35
  // Calculate totalPages from totalItems and perPage if not provided directly
36
36
  const computedTotalPages = $computed(() => {
37
- if (props.totalPages !== undefined) return props.totalPages
37
+ if (props.totalPages !== undefined) {return props.totalPages}
38
38
  const { perPage } = props
39
39
  return Math.max(1, Math.ceil(props.totalItems / perPage))
40
40
  })
@@ -74,8 +74,8 @@ const visiblePages = $computed(() => {
74
74
  mustInclude.add(page.value)
75
75
 
76
76
  // Ensure adjacent pages are included for navigation
77
- if (page.value > 1) mustInclude.add(page.value - 1)
78
- if (page.value < computedTotalPages) mustInclude.add(page.value + 1)
77
+ if (1 < page.value) {mustInclude.add(page.value - 1)}
78
+ if (page.value < computedTotalPages) {mustInclude.add(page.value + 1)}
79
79
 
80
80
  // Always include first and last pages
81
81
  mustInclude.add(1)
@@ -91,7 +91,7 @@ const visiblePages = $computed(() => {
91
91
  const current = pageArray[i]
92
92
  const next = pageArray[i + 1]
93
93
 
94
- if (next - current > 1) {
94
+ if (1 < next - current) {
95
95
  // There's a gap - fill in additional pages
96
96
  const pagesToAdd = Math.min(next - current - 1, maxVisiblePages + 2 - pageArray.length)
97
97
 
@@ -110,10 +110,10 @@ const visiblePages = $computed(() => {
110
110
  })
111
111
 
112
112
  function updateIndicatorPosition() {
113
- if (!paginationContainer) return
113
+ if (!paginationContainer) {return}
114
114
 
115
115
  const selectedButton = paginationContainer.querySelector('.selected')
116
- if (!selectedButton) return
116
+ if (!selectedButton) {return}
117
117
 
118
118
  const containerRect = paginationContainer.getBoundingClientRect()
119
119
  const buttonRect = selectedButton.getBoundingClientRect()
@@ -133,7 +133,7 @@ function updateIndicatorPosition() {
133
133
  }
134
134
 
135
135
  function handleClick(p: number) {
136
- if (p < 1 || p > computedTotalPages) return
136
+ if (1 > p || p > computedTotalPages) {return}
137
137
  page.value = p
138
138
  }
139
139
 
@@ -164,9 +164,9 @@ const renderPageButtons = $computed(() => {
164
164
  const pageNum = visiblePages[i]
165
165
 
166
166
  // Insert ellipsis before this page if needed
167
- if (i > 0) {
167
+ if (0 < i) {
168
168
  const prevPage = visiblePages[i - 1]
169
- if (pageNum - prevPage > 1) {
169
+ if (1 < pageNum - prevPage) {
170
170
  items.push({
171
171
  type: 'ellipsis',
172
172
  key: `ellipsis-${i}`
@@ -33,7 +33,7 @@ const slots: SetupContext['slots'] = useSlots()
33
33
 
34
34
  const computedTheme = $computed(
35
35
  () => {
36
- if (props.disabled) return 'gray-light'
36
+ if (props.disabled) {return 'gray-light'}
37
37
  return (props.color || props.theme) as ThemeType
38
38
  },
39
39
  )
@@ -12,10 +12,10 @@ const { rating, totalStars = 5, iconType = 'star', fillColor = '#fabf05', emptyC
12
12
  }>()
13
13
 
14
14
  function getFillWidth(n: number): string {
15
- const ratingNumber = typeof rating === 'string' ? Number.parseFloat(rating.replace(',', '.')) : rating
15
+ const ratingNumber = 'string' === typeof rating ? Number.parseFloat(rating.replace(',', '.')) : rating
16
16
  if (n <= Math.floor(ratingNumber)) {
17
17
  return '100%'
18
- } else if (n > Math.ceil(ratingNumber)) {
18
+ }if (n > Math.ceil(ratingNumber)) {
19
19
  return '0%'
20
20
  } else {
21
21
  return `${(ratingNumber % 1) * 100}%`