@bagelink/vue 1.2.124 → 1.2.128

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 (33) hide show
  1. package/dist/components/DragOver.vue.d.ts +1 -0
  2. package/dist/components/DragOver.vue.d.ts.map +1 -1
  3. package/dist/components/ImportData.vue.d.ts.map +1 -1
  4. package/dist/components/Loading.vue.d.ts +1 -0
  5. package/dist/components/Loading.vue.d.ts.map +1 -1
  6. package/dist/components/Modal.vue.d.ts +10 -5
  7. package/dist/components/Modal.vue.d.ts.map +1 -1
  8. package/dist/components/dataTable/DataTable.vue.d.ts.map +1 -1
  9. package/dist/components/dataTable/useTableData.d.ts +10 -10
  10. package/dist/components/dataTable/useTableData.d.ts.map +1 -1
  11. package/dist/components/form/inputs/DatePicker.vue.d.ts +2 -1
  12. package/dist/components/form/inputs/DatePicker.vue.d.ts.map +1 -1
  13. package/dist/components/form/inputs/SelectInput.vue.d.ts.map +1 -1
  14. package/dist/index.cjs +324 -262
  15. package/dist/index.mjs +324 -262
  16. package/dist/style.css +136 -137
  17. package/dist/types/BagelForm.d.ts.map +1 -1
  18. package/dist/types/TableSchema.d.ts +1 -1
  19. package/dist/types/TableSchema.d.ts.map +1 -1
  20. package/dist/utils/BagelFormUtils.d.ts +2 -2
  21. package/dist/utils/BagelFormUtils.d.ts.map +1 -1
  22. package/package.json +1 -1
  23. package/src/components/DragOver.vue +21 -0
  24. package/src/components/ImportData.vue +34 -33
  25. package/src/components/Loading.vue +58 -50
  26. package/src/components/Modal.vue +10 -4
  27. package/src/components/dataTable/DataTable.vue +5 -11
  28. package/src/components/dataTable/useTableData.ts +11 -10
  29. package/src/components/form/inputs/DatePicker.vue +9 -6
  30. package/src/components/form/inputs/SelectInput.vue +1 -1
  31. package/src/types/BagelForm.ts +2 -0
  32. package/src/types/TableSchema.ts +1 -1
  33. package/src/utils/BagelFormUtils.ts +2 -2
@@ -1,7 +1,8 @@
1
1
  <script setup lang="ts">
2
+ import type { MaybeRefOrGetter } from 'vue'
2
3
  import type { ModeType } from '../../../utils/calendar/typings'
3
4
  import { Btn, NumberInput } from '@bagelink/vue'
4
- import { computed, ref } from 'vue'
5
+ import { computed, ref, toValue } from 'vue'
5
6
  import Time, { WEEK_START_DAY } from '../../../utils/calendar/time'
6
7
 
7
8
  const props = withDefaults(
@@ -13,7 +14,7 @@ const props = withDefaults(
13
14
  firstDayOfWeek?: WEEK_START_DAY
14
15
  locale?: string
15
16
  enableTime?: boolean
16
- highlightedDates?: (string | Date)[]
17
+ highlightedDates?: MaybeRefOrGetter<(string | Date)[]>
17
18
  }>(),
18
19
  {
19
20
  mode: () => ({ mode: 'day' }),
@@ -25,6 +26,8 @@ const props = withDefaults(
25
26
 
26
27
  const emit = defineEmits(['update:modelValue'])
27
28
 
29
+ const computedHighlightedDates = $computed(() => toValue(props.highlightedDates))
30
+
28
31
  // State
29
32
  const currentMonth = ref(new Date())
30
33
  const currentView = ref('days')
@@ -161,12 +164,12 @@ function useCalendarView() {
161
164
  * @param date The date to check
162
165
  * @returns True if the date should be highlighted
163
166
  */
164
- const isHighlighted = (date?: Date): boolean => {
165
- if (!date || !Array.isArray(props.highlightedDates) || !props.highlightedDates.length) {
167
+ const isHighlighted = computed(() => (date?: Date): boolean => {
168
+ if (!date || !Array.isArray(computedHighlightedDates) || !computedHighlightedDates.length) {
166
169
  return false
167
170
  }
168
171
 
169
- return props.highlightedDates.some((highlightedDate) => {
172
+ return computedHighlightedDates.some((highlightedDate) => {
170
173
  const parsedDate = parseDate(highlightedDate)
171
174
  if (!parsedDate) return false
172
175
 
@@ -175,7 +178,7 @@ function useCalendarView() {
175
178
  && date.getMonth() === parsedDate.getMonth()
176
179
  && date.getDate() === parsedDate.getDate()
177
180
  })
178
- }
181
+ })
179
182
 
180
183
  return {
181
184
  currentMonthDays,
@@ -205,7 +205,7 @@ onMounted(() => {
205
205
  >
206
206
  <template #trigger>
207
207
  <label>
208
- {{ label }} <span v-if="required">*</span>
208
+ {{ label }} <span v-if="required && label">*</span>
209
209
  <div class="flex gap-05">
210
210
  <TextInput
211
211
  v-if="searchable && open"
@@ -31,6 +31,7 @@ export type BagelFieldOptions<T> = (
31
31
  )[]
32
32
  | ((val: any, rowData?: T) => void)
33
33
  )
34
+ // TODO: ^^ replace any with a more specific type (perhaps FieldVal<T, P>)
34
35
 
35
36
  export type VIfType<T, P extends Path<T>> = (
36
37
  string |
@@ -53,6 +54,7 @@ export type _Path<T> = (
53
54
  >
54
55
  >
55
56
  )
57
+
56
58
  export type Path<T> = (
57
59
  FieldVal<T, _Path<T>> extends Array<any> ?
58
60
  LiteralStringUnion<_Path<T>> :
@@ -8,7 +8,7 @@ export interface TableSchemaProps<T extends { [key: string]: any } = { [key: str
8
8
  data: T[]
9
9
  schema?: MaybeRefOrGetter<BglFormSchemaT<T>>
10
10
  columns?: MaybeRefOrGetter<string[]>
11
- useServerSort?: MaybeRefOrGetter<boolean>
11
+ useServerSort?: boolean
12
12
  selectable?: boolean
13
13
  onLastItemVisible?: () => void
14
14
  }
@@ -74,7 +74,7 @@ export function txtField<T, P extends Path<T>>(
74
74
  id: P,
75
75
  label?: string,
76
76
  options?: TextInputOptions<T, P>,
77
- ): BaseBagelField<T, P> | InputBagelField<T, P> {
77
+ ): InputBagelField<T, P> {
78
78
  return {
79
79
  $el: 'text',
80
80
  id,
@@ -106,7 +106,7 @@ export function selectField<T, P extends Path<T>>(
106
106
  label?: string,
107
107
  options?: Option[] | (() => Option[]),
108
108
  config?: SlctInputOptions<T, P>,
109
- ): BaseBagelField<T, P> | SelectBagelField<T, P> {
109
+ ): SelectBagelField<T, P> {
110
110
  return {
111
111
  $el: 'select',
112
112
  id,