@bagelink/vue 1.2.81 → 1.2.85

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 (68) hide show
  1. package/dist/components/AddressSearch.vue.d.ts.map +1 -1
  2. package/dist/components/Btn.vue.d.ts +1 -1
  3. package/dist/components/Btn.vue.d.ts.map +1 -1
  4. package/dist/components/DataPreview.vue.d.ts +16 -5
  5. package/dist/components/DataPreview.vue.d.ts.map +1 -1
  6. package/dist/components/Dropdown.vue.d.ts.map +1 -1
  7. package/dist/components/Icon/Icon.vue.d.ts +4 -1
  8. package/dist/components/Icon/Icon.vue.d.ts.map +1 -1
  9. package/dist/components/ModalForm.vue.d.ts +2 -1
  10. package/dist/components/ModalForm.vue.d.ts.map +1 -1
  11. package/dist/components/calendar/views/CalendarPopover.vue.d.ts +2 -2
  12. package/dist/components/calendar/views/CalendarPopover.vue.d.ts.map +1 -1
  13. package/dist/components/dataTable/DataTable.vue.d.ts.map +1 -1
  14. package/dist/components/dataTable/useSorting.d.ts +1 -1
  15. package/dist/components/dataTable/useSorting.d.ts.map +1 -1
  16. package/dist/components/dataTable/useTableData.d.ts +7 -6
  17. package/dist/components/dataTable/useTableData.d.ts.map +1 -1
  18. package/dist/components/dataTable/useTableVirtualization.d.ts.map +1 -1
  19. package/dist/components/form/BagelForm.vue.d.ts +4 -10
  20. package/dist/components/form/BagelForm.vue.d.ts.map +1 -1
  21. package/dist/components/form/BglMultiStepForm.vue.d.ts +6 -4
  22. package/dist/components/form/BglMultiStepForm.vue.d.ts.map +1 -1
  23. package/dist/components/form/FieldArray.vue.d.ts +3 -2
  24. package/dist/components/form/FieldArray.vue.d.ts.map +1 -1
  25. package/dist/components/form/inputs/SelectInput.vue.d.ts.map +1 -1
  26. package/dist/composables/index.d.ts +5 -5
  27. package/dist/composables/index.d.ts.map +1 -1
  28. package/dist/composables/useSchemaField.d.ts +5 -12
  29. package/dist/composables/useSchemaField.d.ts.map +1 -1
  30. package/dist/index.cjs +146 -230
  31. package/dist/index.d.ts +1 -1
  32. package/dist/index.d.ts.map +1 -1
  33. package/dist/index.mjs +147 -231
  34. package/dist/plugins/modalTypes.d.ts +3 -2
  35. package/dist/plugins/modalTypes.d.ts.map +1 -1
  36. package/dist/style.css +183 -183
  37. package/dist/types/BagelForm.d.ts +12 -9
  38. package/dist/types/BagelForm.d.ts.map +1 -1
  39. package/dist/types/TableSchema.d.ts +9 -9
  40. package/dist/types/TableSchema.d.ts.map +1 -1
  41. package/dist/types/timeago.d.ts +23 -0
  42. package/dist/types/timeago.d.ts.map +1 -0
  43. package/dist/utils/BagelFormUtils.d.ts +5 -3
  44. package/dist/utils/BagelFormUtils.d.ts.map +1 -1
  45. package/dist/utils/useSearch.d.ts +44 -0
  46. package/dist/utils/useSearch.d.ts.map +1 -0
  47. package/package.json +2 -2
  48. package/src/components/DataPreview.vue +16 -5
  49. package/src/components/Icon/Icon.vue +12 -3
  50. package/src/components/ModalForm.vue +6 -9
  51. package/src/components/dataTable/DataTable.vue +11 -14
  52. package/src/components/dataTable/useSorting.ts +1 -1
  53. package/src/components/dataTable/useTableData.ts +19 -42
  54. package/src/components/dataTable/useTableVirtualization.ts +4 -8
  55. package/src/components/form/BagelForm.vue +32 -97
  56. package/src/components/form/BglMultiStepForm.vue +9 -7
  57. package/src/components/form/FieldArray.vue +54 -45
  58. package/src/components/form/inputs/RichText/index.vue +1 -1
  59. package/src/composables/index.ts +12 -13
  60. package/src/composables/useSchemaField.ts +36 -34
  61. package/src/index.ts +1 -1
  62. package/src/plugins/modalTypes.ts +3 -2
  63. package/src/types/BagelForm.ts +21 -13
  64. package/src/types/TableSchema.ts +9 -9
  65. package/src/utils/BagelFormUtils.ts +6 -4
  66. package/src/utils/{search.ts → useSearch.ts} +1 -2
  67. package/dist/components/Carousel2.vue.d.ts +0 -89
  68. package/dist/components/Carousel2.vue.d.ts.map +0 -1
@@ -65,21 +65,23 @@ export type FieldVal<T, P extends Path<T>> = Get<T, P>
65
65
  /** If path P in T is an array, this gives the array's element type. */
66
66
  export type ArrayFieldVal<T, P extends Path<T>> = IterableElement<Get<T, P>>
67
67
 
68
- export type SchemaChildrenT<T> = (Field<T> | string | VNode)[]
68
+ export type VNodeFn<T, P extends Path<T>> = (props: { row?: T, field: BaseBagelField<T, P> }) => VNode
69
+
70
+ export type SchemaChild<T, P extends Path<T>> = Field<T> | VNode | VNodeFn<T, P> | string
69
71
 
70
72
  export interface BaseBagelField<T, P extends Path<T>> {
71
73
  '$el'?: any
72
74
  'id'?: P
73
75
  'label'?: string
74
76
  'placeholder'?: string
75
- 'children'?: SchemaChildrenT<T>
76
77
  'class'?: AttributeValue | AttributeFn<T, P>
77
78
  'attrs'?: Attributes<T, P>
78
79
  'required'?: boolean
79
80
  'disabled'?: boolean
80
81
  'helptext'?: string
81
82
  'options'?: BagelFieldOptions<T>
82
- 'slots'?: { [key: string]: Field<T>[] }
83
+ 'children'?: SchemaChild<T, P>[]
84
+ 'slots'?: { [key: string]: SchemaChild<T, P>[] }
83
85
  'defaultValue'?: any
84
86
  'vIf'?: VIfType<T, P>
85
87
  'v-if'?: VIfType<T, P>
@@ -92,22 +94,28 @@ export type MappedBaseBagelField<T> = {
92
94
  [P in Path<T>]: BaseBagelField<T, P>
93
95
  }[Path<T>]
94
96
 
95
- export type InputBagelField<T> = MappedBaseBagelField<T> & {
96
- $el: 'text' | ComponentExposed<typeof TextInput>
97
- type?: string
98
- }
99
-
100
- export type SelectBagelField<T> = MappedBaseBagelField<T> & {
101
- $el: 'select' | ComponentExposed<typeof SelectInput>
102
- }
103
-
104
97
  export type Field<T> = MappedBaseBagelField<T>
105
98
 
106
99
  export type BglFieldT<T> = Field<T>
107
100
 
108
101
  export type BglFormSchemaT<T> = Field<T>[]
109
102
 
110
- export type BglFormSchemaFnT<T> = (() => BglFormSchemaT<T>) | BglFormSchemaT<T>
103
+ export type InputBagelField<T> = Field<T> & {
104
+ $el: 'text' | ComponentExposed<typeof TextInput>
105
+ type?: string
106
+ }
107
+ // export interface InputBagelField<T> extends BaseBagelField<T, Path<T>> {
108
+ // $el: 'text' | ComponentExposed<typeof TextInput>
109
+ // type?: string
110
+ // }
111
+
112
+ export type SelectBagelField<T> = Field<T> & {
113
+ $el: 'select' | ComponentExposed<typeof SelectInput>
114
+ }
115
+ // export interface SelectBagelField<T> extends BaseBagelField<T, Path<T>> {
116
+ // $el: 'select' | ComponentExposed<typeof SelectInput>
117
+ // type?: string
118
+ // }
111
119
 
112
120
  export interface ValidateInputBaseT {
113
121
  validate?: ValidationFn<{ [key: string]: unknown }, string>
@@ -1,19 +1,19 @@
1
1
  import type { BglFormSchemaT } from '@bagelink/vue'
2
- import type { Ref, ComputedRef } from 'vue'
2
+ import type { MaybeRefOrGetter, ComputedRef } from 'vue'
3
3
 
4
4
  export type SortDirectionsT = 'ASC' | 'DESC'
5
5
  export type EmitOrderT = `${string} ${SortDirectionsT}`
6
6
 
7
7
  export interface TableSchemaProps<T extends { [key: string]: any } = { [key: string]: any }> {
8
8
  data: T[]
9
- schema?: BglFormSchemaT<T> | (() => BglFormSchemaT<T>)
10
- columns?: string[]
11
- useServerSort?: boolean
9
+ schema?: MaybeRefOrGetter<BglFormSchemaT<T>>
10
+ columns?: MaybeRefOrGetter<string[]>
11
+ useServerSort?: MaybeRefOrGetter<boolean>
12
12
  selectable?: boolean
13
13
  onLastItemVisible?: () => void
14
14
  }
15
15
 
16
- export interface SortingOptions<T> {
16
+ export interface SortingOptions {
17
17
  onSort: (field: string, direction: SortDirectionsT) => void
18
18
  }
19
19
 
@@ -24,15 +24,15 @@ export interface TableSelectionOptions<T> {
24
24
  }
25
25
 
26
26
  export interface TableVirtualizationOptions<T> {
27
- data: Ref<T[]> | ComputedRef<T[]>
27
+ data: ComputedRef<T[]>
28
28
  itemHeight: number
29
29
  onLastItemVisible?: () => void
30
30
  }
31
31
 
32
32
  export interface TableDataOptions<T> {
33
- data: Ref<T[]> | ComputedRef<T[]>
34
- schema?: BglFormSchemaT<T> | (() => BglFormSchemaT<T>) | Promise<BglFormSchemaT<T>> | Promise<() => BglFormSchemaT<T>>
35
- columns?: string[]
33
+ data: MaybeRefOrGetter<T[]>
34
+ schema?: MaybeRefOrGetter<BglFormSchemaT<T>>
35
+ columns?: MaybeRefOrGetter<string[]>
36
36
  sortField: string
37
37
  sortDirection: SortDirectionsT
38
38
  useServerSort?: boolean
@@ -1,4 +1,4 @@
1
- import type { ArrayFieldVal, Attributes, BaseBagelField, BglFormSchemaT, Field, IconType, InputBagelField, Option, Path, SelectBagelField } from '@bagelink/vue'
1
+ import type { ArrayFieldVal, Attributes, BaseBagelField, BglFormSchemaT, Field, IconType, InputBagelField, Option, Path, SchemaChild, SelectBagelField } from '@bagelink/vue'
2
2
  import type { UploadInputProps } from '../components/form/inputs/Upload/upload.types'
3
3
 
4
4
  interface InputOptions<T, P extends Path<T>> extends Partial<BaseBagelField<T, P>> {
@@ -230,8 +230,7 @@ export function numField<T, P extends Path<T>>(
230
230
  }
231
231
  }
232
232
 
233
- // export function frmRow<T, P extends Path<T>>(...children: SchemaChildrenT<T>): BaseBagelField<T, P> {
234
- export function frmRow<T>(...children: Field<T>[]): Field<T> {
233
+ export function frmRow<T>(...children: SchemaChild<T, Path<T>>[]): Field<T> {
235
234
  return {
236
235
  $el: 'div',
237
236
  class: 'flex gap-1 m_block align-items-end',
@@ -239,7 +238,8 @@ export function frmRow<T>(...children: Field<T>[]): Field<T> {
239
238
  }
240
239
  }
241
240
 
242
- export type UploadOptions<T, K extends Path<T>> = InputOptions<T, K> & UploadInputProps
241
+ // export type UploadOptions<T, K extends Path<T>> = InputOptions<T, K> & UploadInputProps
242
+ export interface UploadOptions<T, K extends Path<T>> extends InputOptions<T, K>, UploadInputProps {}
243
243
 
244
244
  export function uploadField<T, P extends Path<T>>(id: P, label?: string, options?: UploadOptions<T, P>): BaseBagelField<T, P> {
245
245
  return {
@@ -411,6 +411,7 @@ export function useForm(): {
411
411
  arrField: typeof arrField
412
412
  richText: typeof richText
413
413
  findBglFieldById: typeof findBglFieldById
414
+ getBaseField: typeof getBaseField
414
415
  } {
415
416
  return {
416
417
  txtField,
@@ -427,5 +428,6 @@ export function useForm(): {
427
428
  arrField,
428
429
  richText,
429
430
  findBglFieldById,
431
+ getBaseField
430
432
  }
431
433
  }
@@ -112,7 +112,7 @@ export interface SearchItemParams<T> {
112
112
  }
113
113
 
114
114
  export interface SearchResult<T> {
115
- results: ComputedRef<readonly T[]>
115
+ results: ComputedRef<T[]>
116
116
  resultCount: ComputedRef<number>
117
117
  hasResults: ComputedRef<boolean>
118
118
  isSearching: ComputedRef<boolean>
@@ -378,7 +378,6 @@ export function useSearch<T>(
378
378
  // Otherwise use client-side filtering
379
379
  return searchItems(params)
380
380
  }
381
-
382
381
  // Create computed references
383
382
  const results = computed(() => getFilteredResults())
384
383
  const resultCount = computed(() => results.value.length)
@@ -1,89 +0,0 @@
1
- type Easing = 'ease-in-out' | 'ease-in' | 'ease-out' | 'linear';
2
- type AutoplayMode = 'disabled' | 'standard' | 'linear';
3
- type AutoplayValue = boolean | AutoplayMode;
4
- interface CarouselOptions {
5
- duration?: number;
6
- easing?: Easing;
7
- perPage?: number | {
8
- [key: number]: number;
9
- };
10
- startIndex?: number;
11
- draggable?: boolean;
12
- multipleDrag?: boolean;
13
- threshold?: number;
14
- loop?: boolean;
15
- rtl?: boolean;
16
- autoplay?: AutoplayValue;
17
- autoplayInterval?: number;
18
- autoplaySpeed?: number;
19
- pauseOnHover?: boolean;
20
- dots?: boolean;
21
- slideWidth?: number;
22
- onInit?: () => void;
23
- onChange?: () => void;
24
- }
25
- declare function prev(howManySlides?: number): void;
26
- declare function next(howManySlides?: number): void;
27
- declare function goTo(index: number): void;
28
- declare function remove(index: number): void;
29
- declare function insert(item: Element, index: number): void;
30
- declare function prepend(item: Element): void;
31
- declare function append(item: Element): void;
32
- declare function destroy(restoreMarkup?: boolean): void;
33
- declare function pauseAutoplay(): void;
34
- declare function resumeAutoplay(): void;
35
- declare function __VLS_template(): {
36
- attrs: Partial<{}>;
37
- slots: {
38
- default?(_: {}): any;
39
- };
40
- refs: {
41
- carouselRef: HTMLDivElement;
42
- };
43
- rootEl: HTMLDivElement;
44
- };
45
- type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
46
- declare const __VLS_component: import('vue').DefineComponent<CarouselOptions, {
47
- prev: typeof prev;
48
- next: typeof next;
49
- goTo: typeof goTo;
50
- remove: typeof remove;
51
- insert: typeof insert;
52
- prepend: typeof prepend;
53
- append: typeof append;
54
- destroy: typeof destroy;
55
- currentSlide: import('vue').Ref<number, number>;
56
- pauseAutoplay: typeof pauseAutoplay;
57
- resumeAutoplay: typeof resumeAutoplay;
58
- }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
59
- change: () => any;
60
- init: () => any;
61
- }, string, import('vue').PublicProps, Readonly<CarouselOptions> & Readonly<{
62
- onChange?: (() => any) | undefined;
63
- onInit?: (() => any) | undefined;
64
- }>, {
65
- autoplay: AutoplayValue;
66
- loop: boolean;
67
- duration: number;
68
- easing: Easing;
69
- startIndex: number;
70
- draggable: boolean;
71
- multipleDrag: boolean;
72
- threshold: number;
73
- rtl: boolean;
74
- autoplayInterval: number;
75
- autoplaySpeed: number;
76
- pauseOnHover: boolean;
77
- dots: boolean;
78
- slideWidth: number;
79
- }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
80
- carouselRef: HTMLDivElement;
81
- }, HTMLDivElement>;
82
- declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
83
- export default _default;
84
- type __VLS_WithTemplateSlots<T, S> = T & {
85
- new (): {
86
- $slots: S;
87
- };
88
- };
89
- //# sourceMappingURL=Carousel2.vue.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Carousel2.vue.d.ts","sourceRoot":"","sources":["../../src/components/Carousel2.vue"],"names":[],"mappings":"AAy/BA,KAAK,MAAM,GAAG,aAAa,GAAG,SAAS,GAA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