@bagelink/vue 1.1.31 → 1.1.35-beta.2

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 (85) hide show
  1. package/dist/components/DataPreview.vue.d.ts +3 -1
  2. package/dist/components/DataPreview.vue.d.ts.map +1 -1
  3. package/dist/components/Spreadsheet/Index.vue.d.ts +5 -61
  4. package/dist/components/Spreadsheet/Index.vue.d.ts.map +1 -1
  5. package/dist/components/Spreadsheet/SpreadsheetTable.vue.d.ts +3 -1
  6. package/dist/components/Spreadsheet/SpreadsheetTable.vue.d.ts.map +1 -1
  7. package/dist/components/dataTable/DataTable.vue.d.ts +3 -1
  8. package/dist/components/dataTable/DataTable.vue.d.ts.map +1 -1
  9. package/dist/components/dataTable/tableTypes.d.ts +5 -1
  10. package/dist/components/dataTable/tableTypes.d.ts.map +1 -1
  11. package/dist/components/dataTable/useTableData.d.ts +7 -3
  12. package/dist/components/dataTable/useTableData.d.ts.map +1 -1
  13. package/dist/components/dataTable/useTableSelection.d.ts +3 -1
  14. package/dist/components/dataTable/useTableSelection.d.ts.map +1 -1
  15. package/dist/components/form/BagelForm.vue.d.ts +1 -1
  16. package/dist/components/form/BagelForm.vue.d.ts.map +1 -1
  17. package/dist/components/form/inputs/DatePick.vue.d.ts.map +1 -1
  18. package/dist/components/form/inputs/PhoneInput.vue.d.ts +2 -60
  19. package/dist/components/form/inputs/PhoneInput.vue.d.ts.map +1 -1
  20. package/dist/components/form/inputs/RadioGroup.vue.d.ts +3 -1
  21. package/dist/components/form/inputs/RadioGroup.vue.d.ts.map +1 -1
  22. package/dist/components/form/inputs/RichText/utils/debug.d.ts +3 -1
  23. package/dist/components/form/inputs/RichText/utils/debug.d.ts.map +1 -1
  24. package/dist/components/form/inputs/RichText/utils/media.d.ts +10 -4
  25. package/dist/components/form/inputs/RichText/utils/media.d.ts.map +1 -1
  26. package/dist/components/form/inputs/SelectInput.vue.d.ts +4 -120
  27. package/dist/components/form/inputs/SelectInput.vue.d.ts.map +1 -1
  28. package/dist/components/form/inputs/TextInput.vue.d.ts +5 -5
  29. package/dist/components/form/inputs/TextInput.vue.d.ts.map +1 -1
  30. package/dist/components/form/useBagelFormState.d.ts +1 -1
  31. package/dist/components/form/useBagelFormState.d.ts.map +1 -1
  32. package/dist/composables/index.d.ts +1 -0
  33. package/dist/composables/index.d.ts.map +1 -1
  34. package/dist/composables/useFormField.d.ts +1 -1
  35. package/dist/composables/useFormField.d.ts.map +1 -1
  36. package/dist/composables/useSchemaField.d.ts +1 -1
  37. package/dist/composables/useSchemaField.d.ts.map +1 -1
  38. package/dist/composables/useValidateFieldValue.d.ts +4 -0
  39. package/dist/composables/useValidateFieldValue.d.ts.map +1 -0
  40. package/dist/index.cjs +78 -19
  41. package/dist/index.mjs +78 -19
  42. package/dist/plugins/modal.d.ts +4 -2
  43. package/dist/plugins/modal.d.ts.map +1 -1
  44. package/dist/plugins/modalTypes.d.ts +6 -4
  45. package/dist/plugins/modalTypes.d.ts.map +1 -1
  46. package/dist/style.css +165 -150
  47. package/dist/types/BagelForm.d.ts +22 -10
  48. package/dist/types/BagelForm.d.ts.map +1 -1
  49. package/dist/types/TableSchema.d.ts +5 -1
  50. package/dist/types/TableSchema.d.ts.map +1 -1
  51. package/dist/utils/BagelFormUtils.d.ts +21 -50
  52. package/dist/utils/BagelFormUtils.d.ts.map +1 -1
  53. package/dist/utils/index.d.ts +1 -1
  54. package/dist/utils/index.d.ts.map +1 -1
  55. package/package.json +1 -1
  56. package/src/components/Btn.vue +1 -1
  57. package/src/components/DataPreview.vue +2 -2
  58. package/src/components/ListItem.vue +1 -1
  59. package/src/components/Spreadsheet/Index.vue +10 -10
  60. package/src/components/Spreadsheet/SpreadsheetTable.vue +1 -1
  61. package/src/components/calendar/language/index.ts +1 -1
  62. package/src/components/dataTable/DataTable.vue +2 -2
  63. package/src/components/dataTable/tableTypes.ts +1 -1
  64. package/src/components/dataTable/useTableData.ts +4 -4
  65. package/src/components/dataTable/useTableSelection.ts +1 -1
  66. package/src/components/form/BagelForm.vue +4 -4
  67. package/src/components/form/inputs/DatePick.vue +0 -1
  68. package/src/components/form/inputs/RadioGroup.vue +1 -1
  69. package/src/components/form/inputs/RichText/utils/debug.ts +1 -1
  70. package/src/components/form/inputs/RichText/utils/media.ts +19 -10
  71. package/src/components/form/inputs/TextInput.vue +39 -33
  72. package/src/components/form/useBagelFormState.ts +1 -1
  73. package/src/composables/index.ts +1 -0
  74. package/src/composables/useFormField.ts +1 -1
  75. package/src/composables/useSchemaField.ts +11 -6
  76. package/src/composables/useValidateFieldValue.ts +26 -0
  77. package/src/plugins/modal.ts +6 -5
  78. package/src/plugins/modalTypes.ts +4 -4
  79. package/src/styles/appearance.css +16 -0
  80. package/src/styles/buttons.css +2 -2
  81. package/src/styles/layout.css +5 -0
  82. package/src/types/BagelForm.ts +33 -11
  83. package/src/types/TableSchema.ts +1 -1
  84. package/src/utils/BagelFormUtils.ts +23 -22
  85. package/src/utils/index.ts +1 -1
@@ -1,7 +1,7 @@
1
- import type { BglFormSchemaT, Field, InputBagelField, Option, PropertyPath, SelectBagelField } from '@bagelink/vue'
1
+ import type { BglFormSchemaT, Field, InputBagelField, Option, PropertyPath, SelectBagelField, VIfType } from '@bagelink/vue'
2
2
  import type { UploadInputProps } from '../components/form/inputs/Upload/upload.types'
3
3
 
4
- interface InputOptions {
4
+ interface InputOptions<T, K> {
5
5
  required?: boolean
6
6
  placeholder?: string
7
7
  class?: string
@@ -9,30 +9,30 @@ interface InputOptions {
9
9
  disabled?: boolean
10
10
  helptext?: string
11
11
  autocomplete?: string
12
- vIf?: boolean | ((item: any, row: any) => boolean)
12
+ vIf?: VIfType<T, K>
13
13
  }
14
14
 
15
- interface DateOptions extends InputOptions {
15
+ interface DateOptions<T, K> extends InputOptions<T, K> {
16
16
  enableTime?: boolean
17
17
  mode?: 'day' | 'month' | 'year'
18
18
  locale?: string
19
19
  timezone?: string
20
20
  }
21
21
 
22
- interface TextInputOptions extends InputOptions {
22
+ interface TextInputOptions<T, K> extends InputOptions<T, K> {
23
23
  type?: 'text' | 'tel' | 'email'
24
24
  pattern?: string
25
25
  multiline?: boolean
26
26
  }
27
27
 
28
- interface SlctInputOptions extends InputOptions {
28
+ interface SlctInputOptions<T, K> extends InputOptions<T, K> {
29
29
  searchable?: boolean
30
30
  multiselect?: boolean
31
31
  clearable?: boolean
32
32
  onSearch?: (search: string) => any
33
33
  }
34
34
 
35
- interface NumFieldOptions extends InputOptions {
35
+ interface NumFieldOptions<T, K> extends InputOptions<T, K> {
36
36
  max?: number
37
37
  min?: number
38
38
  step?: number
@@ -42,7 +42,7 @@ interface NumFieldOptions extends InputOptions {
42
42
  useGrouping?: boolean
43
43
  }
44
44
 
45
- type RichTextOptions = InputOptions
45
+ type RichTextOptions<T, K> = InputOptions<T, K>
46
46
 
47
47
  export function getBaseField<T extends { [key: string]: any }>(
48
48
  id?: PropertyPath<T>,
@@ -56,7 +56,7 @@ export function getBaseField<T extends { [key: string]: any }>(
56
56
  export function richText<T extends { [key: string]: any }>(
57
57
  id: PropertyPath<T>,
58
58
  label?: string,
59
- options?: RichTextOptions,
59
+ options?: RichTextOptions<T, PropertyPath<T>>,
60
60
  ): Field<T> {
61
61
  return {
62
62
  $el: 'richtext',
@@ -75,7 +75,7 @@ export function richText<T extends { [key: string]: any }>(
75
75
  export function txtField<T extends { [key: string]: any }>(
76
76
  id: PropertyPath<T>,
77
77
  label?: string,
78
- options?: TextInputOptions,
78
+ options?: TextInputOptions<T, PropertyPath<T>> & Partial<Field<T>>,
79
79
  ): InputBagelField<T> {
80
80
  return {
81
81
  $el: 'text',
@@ -87,6 +87,7 @@ export function txtField<T extends { [key: string]: any }>(
87
87
  disabled: options?.disabled,
88
88
  placeholder: options?.placeholder,
89
89
  defaultValue: options?.defaultValue,
90
+ validate: options?.validate,
90
91
  attrs: {
91
92
  type: options?.type,
92
93
  pattern: options?.pattern,
@@ -100,7 +101,7 @@ export function selectField<T extends { [key: string]: any }>(
100
101
  id: PropertyPath<T>,
101
102
  label?: string,
102
103
  options?: Option[] | (() => Option[]),
103
- config?: SlctInputOptions,
104
+ config?: SlctInputOptions<T, PropertyPath<T>>,
104
105
  ): SelectBagelField<T> {
105
106
  return {
106
107
  $el: 'select',
@@ -128,7 +129,7 @@ export const slctField = selectField
128
129
  export function checkField<T extends { [key: string]: any }>(
129
130
  id: PropertyPath<T>,
130
131
  label?: string,
131
- options?: InputOptions,
132
+ options?: InputOptions<T, PropertyPath<T>>,
132
133
  ): Field<T> {
133
134
  return {
134
135
  $el: 'check',
@@ -142,7 +143,7 @@ export function checkField<T extends { [key: string]: any }>(
142
143
  export function dateField<T extends { [key: string]: any }>(
143
144
  id: PropertyPath<T>,
144
145
  label?: string,
145
- options?: DateOptions,
146
+ options?: DateOptions<T, PropertyPath<T>>,
146
147
  ): Field<T> {
147
148
  return {
148
149
  $el: 'date',
@@ -167,7 +168,7 @@ export function dateField<T extends { [key: string]: any }>(
167
168
  export function numField<T extends { [key: string]: any }>(
168
169
  id: PropertyPath<T>,
169
170
  label?: string,
170
- options?: NumFieldOptions,
171
+ options?: NumFieldOptions<T, PropertyPath<T>>,
171
172
  ): Field<T> {
172
173
  return {
173
174
  $el: 'number',
@@ -193,7 +194,7 @@ export function numField<T extends { [key: string]: any }>(
193
194
  }
194
195
  }
195
196
 
196
- export function frmRow<T>(...children: Field[]): Field<T> {
197
+ export function frmRow<T>(...children: Field<T>[]): Field<T> {
197
198
  return {
198
199
  $el: 'div',
199
200
  class: 'flex gap-1 m_block align-items-end',
@@ -201,9 +202,9 @@ export function frmRow<T>(...children: Field[]): Field<T> {
201
202
  }
202
203
  }
203
204
 
204
- export type UploadOptions = InputOptions & UploadInputProps
205
+ export type UploadOptions<T, K> = InputOptions<T, K> & UploadInputProps
205
206
 
206
- export function uploadField(id: string, label?: string, options?: UploadOptions) {
207
+ export function uploadField(id: string, label?: string, options?: UploadOptions<any, any>): Field<any> {
207
208
  return {
208
209
  $el: 'upload',
209
210
  id,
@@ -215,7 +216,7 @@ export function uploadField(id: string, label?: string, options?: UploadOptions)
215
216
  }
216
217
  }
217
218
 
218
- interface RangeOptions extends InputOptions {
219
+ interface RangeOptions<T, K> extends InputOptions<T, K> {
219
220
  min?: number
220
221
  max?: number
221
222
  step?: number
@@ -227,7 +228,7 @@ interface RangeOptions extends InputOptions {
227
228
  export function rangeField<T extends { [key: string]: any }>(
228
229
  id: PropertyPath<T>,
229
230
  label?: string,
230
- options?: RangeOptions,
231
+ options?: RangeOptions <T, PropertyPath<T>>
231
232
  ): Field<T> {
232
233
  return {
233
234
  $el: 'range',
@@ -306,7 +307,7 @@ export function findBglFieldById(id: string, _schema: BglFormSchemaT): Field | u
306
307
  return undefined
307
308
  }
308
309
 
309
- interface ArrayFieldOptions extends InputOptions {
310
+ interface ArrayFieldOptions<T, K> extends InputOptions<T, K> {
310
311
  delete?: boolean
311
312
  add?: boolean
312
313
  }
@@ -317,9 +318,9 @@ export function arrField<T extends { [key: string]: any }>(
317
318
  id: PropertyPath<T>,
318
319
  label: string,
319
320
  schemaOrType: BglFormSchemaT | ArrayType,
320
- options?: ArrayFieldOptions
321
+ options?: ArrayFieldOptions<T, PropertyPath<T>>
321
322
  ): Field<T> {
322
- const attrs: Record<string, any> = { delete: true, add: true, ...options }
323
+ const attrs: { [key: string]: any } = { delete: true, add: true, ...options }
323
324
  if (typeof schemaOrType === 'string') attrs.type = schemaOrType
324
325
  else attrs.schema = schemaOrType
325
326
  return {
@@ -55,7 +55,7 @@ export function classify(fieldVal?: any, row?: any, ...classes: any[]) {
55
55
  }
56
56
 
57
57
  export function bindAttrs<T = { [key: string]: any }>(
58
- attrs?: Attributes,
58
+ attrs?: Attributes<T>,
59
59
  fieldVal?: any,
60
60
  row?: T
61
61
  ) {