@bagelink/vue 0.0.241 → 0.0.245

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 (47) hide show
  1. package/dist/components/Avatar.vue.d.ts +19 -3
  2. package/dist/components/Avatar.vue.d.ts.map +1 -1
  3. package/dist/components/ListItem.vue.d.ts +4 -0
  4. package/dist/components/ListItem.vue.d.ts.map +1 -1
  5. package/dist/components/ListView.vue.d.ts +1 -1
  6. package/dist/components/Modal.vue.d.ts.map +1 -1
  7. package/dist/components/ModalForm.vue.d.ts +6 -0
  8. package/dist/components/ModalForm.vue.d.ts.map +1 -1
  9. package/dist/components/form/BglField.vue.d.ts.map +1 -1
  10. package/dist/components/form/BglForm.vue.d.ts.map +1 -1
  11. package/dist/components/form/ItemRef.vue.d.ts +0 -1
  12. package/dist/components/form/ItemRef.vue.d.ts.map +1 -1
  13. package/dist/components/form/inputs/SelectField.vue.d.ts +4 -1
  14. package/dist/components/form/inputs/SelectField.vue.d.ts.map +1 -1
  15. package/dist/components/form/inputs/TextInput.vue.d.ts +2 -0
  16. package/dist/components/form/inputs/TextInput.vue.d.ts.map +1 -1
  17. package/dist/components/form/inputs/ToggleInput.vue.d.ts +7 -20
  18. package/dist/components/form/inputs/ToggleInput.vue.d.ts.map +1 -1
  19. package/dist/index.cjs +1876 -1868
  20. package/dist/index.mjs +1876 -1868
  21. package/dist/plugins/modal.d.ts +8 -6
  22. package/dist/plugins/modal.d.ts.map +1 -1
  23. package/dist/style.css +214 -74
  24. package/dist/types/BagelForm.d.ts +16 -12
  25. package/dist/types/BagelForm.d.ts.map +1 -1
  26. package/package.json +1 -1
  27. package/src/components/Avatar.vue +14 -17
  28. package/src/components/ListItem.vue +16 -9
  29. package/src/components/Modal.vue +2 -4
  30. package/src/components/ModalForm.vue +11 -34
  31. package/src/components/form/BglField.vue +18 -23
  32. package/src/components/form/BglForm.vue +21 -41
  33. package/src/components/form/inputs/TextInput.vue +27 -60
  34. package/src/components/form/inputs/ToggleInput.vue +29 -40
  35. package/src/plugins/modal.ts +12 -28
  36. package/src/styles/layout.css +197 -30
  37. package/src/styles/modal.css +15 -2
  38. package/src/styles/text.css +12 -0
  39. package/src/styles/theme.css +0 -10
  40. package/src/types/BagelForm.ts +16 -6
  41. package/src/utils/index.ts +2 -2
  42. package/dist/components/Drop.vue.d.ts +0 -34
  43. package/dist/components/Drop.vue.d.ts.map +0 -1
  44. package/dist/components/FileUploader.vue.d.ts +0 -60
  45. package/dist/components/FileUploader.vue.d.ts.map +0 -1
  46. package/src/types/BagelField.ts +0 -52
  47. package/src/utils/objects.ts +0 -81
@@ -85,6 +85,7 @@
85
85
  width: 100%;
86
86
  }
87
87
 
88
+
88
89
  .col-gap-1 {
89
90
  column-gap: 1rem;
90
91
  }
@@ -271,94 +272,260 @@
271
272
  flex: 1 1 33.33333%;
272
273
  }
273
274
 
274
- .mb-0 {
275
- margin-bottom: 0;
276
- }
277
-
278
275
  .mb-1 {
279
- margin-bottom: 0.25rem;
276
+ margin-bottom: 1rem !important;
280
277
  }
281
278
 
282
279
  .mb-2 {
283
- margin-bottom: 0.5rem;
280
+ margin-bottom: 2rem !important;
284
281
  }
285
282
 
286
283
  .mb-3 {
287
- margin-bottom: 1rem;
288
- }
289
-
290
- .mt-0 {
291
- margin-top: 0;
284
+ margin-bottom: 3rem !important;
292
285
  }
293
286
 
294
287
  .mt-1 {
295
- margin-top: 0.25rem;
288
+ margin-top: 1rem !important;
296
289
  }
297
290
 
298
-
299
291
  .mt-2 {
300
- margin-top: 0.5rem;
292
+ margin-top: 2rem !important;
301
293
  }
302
294
 
303
295
  .mt-3 {
304
- margin-top: 1rem;
296
+ margin-top: 3rem !important;
305
297
  }
306
298
 
307
299
  .ms-1 {
308
- margin-inline-start: 0.25rem;
300
+ margin-inline-start: 1rem !important;
309
301
  }
310
302
 
311
303
  .ms-2 {
312
- margin-inline-start: 0.5rem;
304
+ margin-inline-start: 2rem !important;
313
305
  }
314
306
 
315
307
  .ms-3 {
316
- margin-inline-start: 1rem;
308
+ margin-inline-start: 3rem !important;
317
309
  }
318
310
 
319
311
  .me-1 {
320
- margin-inline-end: 0.25rem;
312
+ margin-inline-end: 1rem !important;
321
313
  }
322
314
 
323
-
324
315
  .me-2 {
325
- margin-inline-end: 0.5rem;
316
+ margin-inline-end: 2rem !important;
326
317
  }
327
318
 
328
319
  .me-3 {
329
- margin-inline-end: 1rem;
320
+ margin-inline-end: 3rem !important;
321
+ }
322
+
323
+ .mb-0 {
324
+ margin-bottom: 0rem !important;
325
+ }
326
+
327
+ .mb-4 {
328
+ margin-bottom: 4rem !important;
329
+ }
330
+
331
+ .mb-075 {
332
+ margin-bottom: 0.75rem !important;
333
+ }
334
+
335
+ .mb-05 {
336
+ margin-bottom: 0.5rem !important;
337
+ }
338
+
339
+ .mb-025 {
340
+ margin-bottom: 0.25rem !important;
341
+ }
342
+
343
+ .mt-0 {
344
+ margin-top: 0rem !important;
345
+ }
346
+
347
+ .mt-4 {
348
+ margin-top: 4rem !important;
349
+ }
350
+
351
+ .mt-075 {
352
+ margin-top: 0.75rem !important;
353
+ }
354
+
355
+ .mt-05 {
356
+ margin-top: 0.5rem !important;
357
+ }
358
+
359
+ .mt-025 {
360
+ margin-top: 0.25rem !important;
361
+ }
362
+
363
+ .ms-0 {
364
+ margin-inline-start: 0rem !important;
365
+ }
366
+
367
+ .ms-4 {
368
+ margin-inline-start: 4rem !important;
369
+ }
370
+
371
+ .ms-075 {
372
+ margin-inline-start: 0.75rem !important;
373
+ }
374
+
375
+ .ms-05 {
376
+ margin-inline-start: 0.5rem !important;
377
+ }
378
+
379
+ .ms-025 {
380
+ margin-inline-start: 0.25rem !important;
381
+ }
382
+
383
+ .me-0 {
384
+ margin-inline-end: 0rem !important;
385
+ }
386
+
387
+ .me-4 {
388
+ margin-inline-end: 4rem !important;
389
+ }
390
+
391
+ .me-075 {
392
+ margin-inline-end: 0.75rem !important;
393
+ }
394
+
395
+ .me-05 {
396
+ margin-inline-end: 0.5rem !important;
397
+ }
398
+
399
+ .me-025 {
400
+ margin-inline-end: 0.25rem !important;
401
+ }
402
+
403
+ .pb-0 {
404
+ padding-bottom: 0rem !important;
330
405
  }
331
406
 
332
407
  .pb-1 {
333
- padding-bottom: 1rem;
408
+ padding-bottom: 1rem !important;
334
409
  }
335
410
 
336
411
  .pb-2 {
337
- padding-bottom: 2rem;
412
+ padding-bottom: 2rem !important;
338
413
  }
339
414
 
340
415
  .pb-3 {
341
- padding-bottom: 3rem;
416
+ padding-bottom: 3rem !important;
417
+ }
418
+
419
+ .pb-4 {
420
+ padding-bottom: 4rem !important;
421
+ }
422
+
423
+ .pb-075 {
424
+ padding-bottom: 0.75rem !important;
425
+ }
426
+
427
+ .pb-05 {
428
+ padding-bottom: 0.5rem !important;
342
429
  }
343
430
 
344
431
  .pb-025 {
345
- padding-bottom: 0.25rem;
432
+ padding-bottom: 0.25rem !important;
433
+ }
434
+
435
+ .pt-0 {
436
+ padding-top: 0rem !important;
346
437
  }
347
438
 
348
439
  .pt-1 {
349
- padding-top: 1rem;
440
+ padding-top: 1rem !important;
350
441
  }
351
442
 
352
443
  .pt-2 {
353
- padding-top: 2rem;
444
+ padding-top: 2rem !important;
354
445
  }
355
446
 
356
447
  .pt-3 {
357
- padding-top: 3rem;
448
+ padding-top: 3rem !important;
449
+ }
450
+
451
+ .pt-4 {
452
+ padding-top: 4rem !important;
453
+ }
454
+
455
+ .pt-075 {
456
+ padding-top: 0.75rem !important;
457
+ }
458
+
459
+ .pt-05 {
460
+ padding-top: 0.5rem !important;
358
461
  }
359
462
 
360
463
  .pt-025 {
361
- padding-top: 0.25rem;
464
+ padding-top: 0.25rem !important;
465
+ }
466
+
467
+ .ps-0 {
468
+ padding-inline-start: 0rem !important;
469
+ }
470
+
471
+ .ps-1 {
472
+ padding-inline-start: 1rem !important;
473
+ }
474
+
475
+ .ps-2 {
476
+ padding-inline-start: 2rem !important;
477
+ }
478
+
479
+ .ps-3 {
480
+ padding-inline-start: 3rem !important;
481
+ }
482
+
483
+ .ps-4 {
484
+ padding-inline-start: 4rem !important;
485
+ }
486
+
487
+ .ps-075 {
488
+ padding-inline-start: 0.75rem !important;
489
+ }
490
+
491
+ .ps-05 {
492
+ padding-inline-start: 0.5rem !important;
493
+ }
494
+
495
+ .ps-025 {
496
+ padding-inline-start: 0.25rem !important;
497
+ }
498
+
499
+ .pe-0 {
500
+ padding-inline-end: 0rem !important;
501
+ }
502
+
503
+ .pe-1 {
504
+ padding-inline-end: 1rem !important;
505
+ }
506
+
507
+ .pe-2 {
508
+ padding-inline-end: 2rem !important;
509
+ }
510
+
511
+ .pe-3 {
512
+ padding-inline-end: 3rem !important;
513
+ }
514
+
515
+ .pe-4 {
516
+ padding-inline-end: 4rem !important;
517
+ }
518
+
519
+ .pe-075 {
520
+ padding-inline-end: 0.75rem !important;
521
+ }
522
+
523
+ .pe-05 {
524
+ padding-inline-end: 0.5rem !important;
525
+ }
526
+
527
+ .pe-025 {
528
+ padding-inline-end: 0.25rem !important;
362
529
  }
363
530
 
364
531
 
@@ -18,6 +18,9 @@
18
18
  align-items: center;
19
19
  }
20
20
 
21
+ .bg-lignt {
22
+ background-color: var(--bgl-white);
23
+ }
21
24
 
22
25
  .modal {
23
26
  width: 96%;
@@ -65,7 +68,7 @@
65
68
  margin-inline-start: auto;
66
69
  margin-inline-end: 20px;
67
70
  min-height: calc(100vh - 40px);
68
-
71
+ transform: translateX(100%);
69
72
  }
70
73
 
71
74
  .is-active .modal {
@@ -74,8 +77,18 @@
74
77
  box-shadow: 6px 6px 20px 20px #0000001c;
75
78
  }
76
79
 
80
+ .bg-lignt .modal {
81
+ transform: scale(1);
82
+ border: 1px solid var(--border-color);
83
+ }
84
+
85
+ .bg-lignt.is-active .modal {
86
+ box-shadow: none;
87
+ }
88
+
77
89
  .is-active.is-side .modal {
78
90
  inset-inline-end: 20px;
91
+ transform: translateX(0%);
79
92
  }
80
93
 
81
94
  .bg-dark.is-active {
@@ -103,4 +116,4 @@
103
116
  margin-inline-end: 5%;
104
117
  margin-inline-start: 5%;
105
118
  }
106
- }
119
+ }
@@ -69,6 +69,14 @@ h6 {}
69
69
  color: var(--bgl-primary);
70
70
  }
71
71
 
72
+ .txtblack {
73
+ color: var(--bgl-black);
74
+ }
75
+
76
+ .txtred {
77
+ color: var(--bgl-red);
78
+ }
79
+
72
80
  .font-light {
73
81
  font-weight: 100;
74
82
  }
@@ -88,6 +96,10 @@ h6 {}
88
96
  cursor: pointer;
89
97
  }
90
98
 
99
+ .decoration-none {
100
+ text-decoration: none;
101
+ }
102
+
91
103
  .icon-font {
92
104
  font-family: "Material Symbols Outlined", serif;
93
105
  }
@@ -142,16 +142,6 @@
142
142
  padding: 1rem 1rem;
143
143
  }
144
144
 
145
- .login-card {
146
- padding: 3rem 2rem;
147
- border-radius: calc(var(--card-border-radius) * 2);
148
- position: absolute;
149
- left: 0;
150
- right: 0;
151
- width: 330px;
152
- margin: 15vh auto 0;
153
- }
154
-
155
145
  .login-card h3 {
156
146
  font-size: 1.4rem;
157
147
  }
@@ -1,3 +1,5 @@
1
+ import { SelectInput, TextInput } from '@bagelink/vue';
2
+
1
3
  export type AttributeValue = string | number | boolean | null | undefined | Record<string, any>;
2
4
 
3
5
  export type AttributeFn<T = Record<string, any>> = (field: any, row: T) => AttributeValue;
@@ -6,26 +8,34 @@ export interface Attributes<T = any> {
6
8
  [key: string]: AttributeValue | AttributeFn<T>
7
9
  }
8
10
 
9
- export type Field<T = Record<string, any>> = {
11
+ export type BaseBagelField<T = Record<string, any>> = {
10
12
  $el?: any;
11
13
  id?: string;
12
14
  label?: string;
13
15
  placeholder?: string;
14
16
  children?: Field<T>[];
15
17
  class?: AttributeValue | AttributeFn<T>,
16
- options?: string | ({ label: string; value: string | number } | string | number)[],
17
18
  attrs?: Attributes<T>;
18
19
  required?: boolean;
19
- hint?: string;
20
+ helptext?: string;
21
+ options?: string | ({ label?: string; value: string | number } | string | number | Record<string, any>)[],
20
22
  defaultValue?: any;
21
23
  transform?: (val?: any, rowData?: Record<string, any>) => any;
22
24
  onUpdate?: (val: any, fieldData?: any, rowData?: Record<string, any>) => void;
23
25
  'v-if'?: string | boolean | ((val: any, row: T) => boolean);
24
26
  }
25
27
 
26
- export interface SelectBagelField {
27
- inputType: 'SelectField';
28
- options: string | { label: string; value: string | number }[];
28
+ export interface InputBagelField<T> extends BaseBagelField<T> {
29
+ $el: 'text' | typeof TextInput;
30
+ id: string;
31
+ type?: string;
32
+ }
33
+
34
+ export interface SelectBagelField<T> extends BaseBagelField<T> {
35
+ $el: 'select' | typeof SelectInput;
36
+ id: string;
29
37
  }
30
38
 
39
+ export type Field<T = Record<string, any>> = BaseBagelField<T> | InputBagelField<T> | SelectBagelField<T>;
40
+
31
41
  export type BglFormSchemaT<T = Record<string, any>> = Field<T>[];
@@ -51,8 +51,8 @@ export function bindAttrs<T = Record<string, any>>(attrs?: Attributes, fieldVal?
51
51
  export const iffer = (field: any, itemData: any) => {
52
52
  if (field['v-if'] === undefined) return true;
53
53
  if (typeof field['v-if'] === 'boolean') return field['v-if'];
54
- if (typeof field['v-if'] === 'string') return !!itemData.value[field['v-if']];
55
- if (typeof field['v-if'] === 'function') return field['v-if']!(itemData?.[field.id], itemData);
54
+ if (typeof field['v-if'] === 'string') return true;
55
+ if (typeof field['v-if'] === 'function') return field['v-if']?.(itemData?.[field.id], itemData);
56
56
  return true;
57
57
  };
58
58
 
@@ -1,34 +0,0 @@
1
- type Option = {
2
- label: string;
3
- value: string;
4
- } | string | number;
5
- declare const _default: import("vue").DefineComponent<__VLS_TypePropsToRuntimeProps<{
6
- modelValue: string | number;
7
- options: Option[];
8
- placeholder?: string | undefined;
9
- label?: string | undefined;
10
- id: string;
11
- required: boolean;
12
- }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
13
- "update:modelValue": (...args: any[]) => void;
14
- }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
15
- modelValue: string | number;
16
- options: Option[];
17
- placeholder?: string | undefined;
18
- label?: string | undefined;
19
- id: string;
20
- required: boolean;
21
- }>>> & {
22
- "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
23
- }, {}, {}>;
24
- export default _default;
25
- type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
26
- type __VLS_TypePropsToRuntimeProps<T> = {
27
- [K in keyof T]-?: {} extends Pick<T, K> ? {
28
- type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
29
- } : {
30
- type: import('vue').PropType<T[K]>;
31
- required: true;
32
- };
33
- };
34
- //# sourceMappingURL=Drop.vue.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Drop.vue.d.ts","sourceRoot":"","sources":["../../src/components/Drop.vue"],"names":[],"mappings":"AAcA;AAMA,KAAK,MAAM,GAAG;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf,GAAG,MAAM,GAAG,MAAM,CAAC;;gBA8KN,MAAM,GAAG,MAAM;aAClB,MAAM,EAAE;;;QAGb,MAAM;cACA,OAAO;;;;gBALL,MAAM,GAAG,MAAM;aAClB,MAAM,EAAE;;;QAGb,MAAM;cACA,OAAO;;;;AAXnB,wBAcG;AACH,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AACjE,KAAK,6BAA6B,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE,GAAG;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE;CAAE,CAAC"}
@@ -1,60 +0,0 @@
1
- declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
2
- id?: string | undefined;
3
- private?: 0 | 1 | undefined;
4
- singleFile?: boolean | undefined;
5
- beforeUpload?: (() => Promise<any>) | undefined;
6
- dragDropLabel?: string | undefined;
7
- browseLabel?: string | undefined;
8
- }>, {
9
- private: number;
10
- entity: string;
11
- id: string;
12
- beforeUpload: () => Promise<void>;
13
- dragDropLabel: string;
14
- browseLabel: string;
15
- }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
16
- done: (...args: any[]) => void;
17
- complete: (...args: any[]) => void;
18
- }, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
19
- id?: string | undefined;
20
- private?: 0 | 1 | undefined;
21
- singleFile?: boolean | undefined;
22
- beforeUpload?: (() => Promise<any>) | undefined;
23
- dragDropLabel?: string | undefined;
24
- browseLabel?: string | undefined;
25
- }>, {
26
- private: number;
27
- entity: string;
28
- id: string;
29
- beforeUpload: () => Promise<void>;
30
- dragDropLabel: string;
31
- browseLabel: string;
32
- }>>> & {
33
- onDone?: ((...args: any[]) => any) | undefined;
34
- onComplete?: ((...args: any[]) => any) | undefined;
35
- }, {
36
- id: string;
37
- private: 1 | 0;
38
- beforeUpload: () => Promise<any>;
39
- dragDropLabel: string;
40
- browseLabel: string;
41
- }, {}>;
42
- export default _default;
43
- type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
44
- type __VLS_TypePropsToRuntimeProps<T> = {
45
- [K in keyof T]-?: {} extends Pick<T, K> ? {
46
- type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
47
- } : {
48
- type: import('vue').PropType<T[K]>;
49
- required: true;
50
- };
51
- };
52
- type __VLS_WithDefaults<P, D> = {
53
- [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
54
- default: D[K];
55
- }> : P[K];
56
- };
57
- type __VLS_Prettify<T> = {
58
- [K in keyof T]: T[K];
59
- } & {};
60
- //# sourceMappingURL=FileUploader.vue.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FileUploader.vue.d.ts","sourceRoot":"","sources":["../../src/components/FileUploader.vue"],"names":[],"mappings":"AAiDA;;;;;0BA6YuB,QAAQ,GAAG,CAAC;;;;;;;;;;;;;;;;;0BAAZ,QAAQ,GAAG,CAAC;;;;;;;;;;;;;;QAJ5B,MAAM;aAED,CAAC,GAAG,CAAC;kBAEA,MAAM,QAAQ,GAAG,CAAC;mBACjB,MAAM;iBACR,MAAM;;AARtB,wBAeG;AAGH,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AACjE,KAAK,6BAA6B,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE,GAAG;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE;CAAE,CAAC;AAC9M,KAAK,kBAAkB,CAAC,CAAC,EAAE,CAAC,IAAI;KAE1B,CAAC,IAAI,MAAM,IAAI,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,SAAS,MAAM,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG;QACxE,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;KACb,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CACT,CAAC;AACN,KAAK,cAAc,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG,EAAE,CAAC"}
@@ -1,52 +0,0 @@
1
- export interface BaseBagelField {
2
- id: string;
3
- label?: string;
4
- placeholder?: string;
5
- required?: boolean;
6
- is_array?: boolean;
7
- can_add?: boolean;
8
- can_delete?: boolean | (() => boolean);
9
- allow_array_add?: boolean;
10
- editMode?: boolean;
11
- inputType:
12
- | 'ItemRef'
13
- | 'SelectField'
14
- | 'PlainText'
15
- | 'ImageField'
16
- | 'ReadOnlyInput'
17
- | 'DateInput'
18
- | 'CurrencyInput'
19
- | 'CheckInput'
20
- | 'NumberInput'
21
- | 'LinkField'
22
- | 'TextArea'
23
- | 'Password'
24
- | 'Contact'
25
- | 'ColorPicker'
26
- | 'FormRow'
27
- | 'BagelForm';
28
- description?: string;
29
- helpText?: string;
30
- currency?: string;
31
- refCollection?: string;
32
- refFields?: string[];
33
- file_key?: string;
34
- fields?: any;
35
- pattern?: string;
36
- fieldClass?: string;
37
- link?: string;
38
- }
39
-
40
- export type NestedField = BagelField & {
41
- // modelValuePropPath?: string;
42
- skipIndex?: boolean;
43
- ignoreModelPath?: boolean;
44
- };
45
- export type NestedBagelFormFields = NestedField[] & Record<string, NestedField>;
46
-
47
- export interface NestedBagelForm extends BaseBagelField {
48
- inputType: 'BagelForm';
49
- fields: NestedBagelFormFields;
50
- }
51
-
52
- export type BagelField = BaseBagelField | NestedBagelForm;
@@ -1,81 +0,0 @@
1
- import { BagelField } from '@bagelink/vue';
2
-
3
- function returnTypes(bagelField?: BagelField) {
4
- if (bagelField?.is_array) return [];
5
- if (bagelField?.inputType === 'BagelForm') return {};
6
- if (bagelField?.inputType === 'CheckInput') return false;
7
- return '';
8
- }
9
-
10
- export function getPropByPath(
11
- obj: Record<string, any>,
12
- propPath?: string,
13
- bagelField?: BagelField,
14
- ) {
15
- // Return the object if the path is empty or the object is not an 'object' type
16
- if (!propPath || typeof obj !== 'object') return obj;
17
-
18
- const props = propPath.split(/\.|\[(\d+)\]/).filter(Boolean);
19
- let result = obj;
20
- for (const prop of props) {
21
- if (result !== null && typeof result === 'object' && prop in result) {
22
- result = result[prop];
23
- } else {
24
- return bagelField ? returnTypes(bagelField) : '';
25
- }
26
- }
27
- return result;
28
- }
29
-
30
- export function setPropByPath(
31
- obj: Record<string, any>,
32
- path?: string,
33
- value?: any,
34
- ) {
35
- const keys = path?.split(/\.|\[(\d+)\]/)?.filter(Boolean) || [];
36
- let current = obj;
37
-
38
- for (let i = 0; i < keys.length - 1; i++) {
39
- const key = keys[i];
40
- const nextKey = keys[i + 1];
41
-
42
- const nextIsArrayIndex = !Number.isNaN(parseInt(nextKey, 10));
43
-
44
- if (!current[key]) {
45
- current[key] = nextIsArrayIndex ? [] : {};
46
- } else if (typeof current[key] !== 'object') {
47
- throw new Error(
48
- `Cannot set property '${keys
49
- .slice(i)
50
- .join('.')}', object or array expected`,
51
- );
52
- }
53
- current = current[key];
54
- }
55
- current[keys[keys.length - 1]] = value;
56
- }
57
-
58
- // export function setPropByPath(
59
- // obj: Record<string, any>,
60
- // propPath: string,
61
- // value: any,
62
- // ) {
63
- // // console.log('getPropByPath', obj, { propPath });
64
- // if (!propPath || typeof obj !== 'object') return obj;
65
-
66
- // const props = propPath.split(/\.|\[(\d+)\]/).filter(Boolean);
67
- // let result = obj;
68
- // console.log(props);
69
- // for (let i = 0; i < props.length; i++) {
70
- // const prop = props[i];
71
- // if (i === props.length - 1) {
72
- // result[prop] = value;
73
- // } else if (result && prop in result) {
74
- // result = result[prop];
75
- // } else {
76
- // return undefined;
77
- // }
78
- // }
79
-
80
- // return result;
81
- // }