@bagelink/vue 0.0.239 → 0.0.243

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 (44) 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/ItemRef.vue.d.ts +0 -1
  10. package/dist/components/form/ItemRef.vue.d.ts.map +1 -1
  11. package/dist/components/form/inputs/SelectField.vue.d.ts +4 -1
  12. package/dist/components/form/inputs/SelectField.vue.d.ts.map +1 -1
  13. package/dist/components/form/inputs/TextInput.vue.d.ts +2 -0
  14. package/dist/components/form/inputs/TextInput.vue.d.ts.map +1 -1
  15. package/dist/components/form/inputs/ToggleInput.vue.d.ts +7 -20
  16. package/dist/components/form/inputs/ToggleInput.vue.d.ts.map +1 -1
  17. package/dist/index.cjs +1849 -1860
  18. package/dist/index.mjs +1849 -1860
  19. package/dist/plugins/modal.d.ts +8 -6
  20. package/dist/plugins/modal.d.ts.map +1 -1
  21. package/dist/style.css +246 -87
  22. package/dist/types/BagelForm.d.ts +16 -8
  23. package/dist/types/BagelForm.d.ts.map +1 -1
  24. package/package.json +1 -1
  25. package/src/components/Avatar.vue +14 -17
  26. package/src/components/ListItem.vue +16 -9
  27. package/src/components/Modal.vue +2 -4
  28. package/src/components/ModalForm.vue +7 -3
  29. package/src/components/form/BglField.vue +1 -1
  30. package/src/components/form/BglForm.vue +14 -11
  31. package/src/components/form/inputs/TextInput.vue +27 -60
  32. package/src/components/form/inputs/ToggleInput.vue +29 -40
  33. package/src/plugins/modal.ts +12 -28
  34. package/src/styles/layout.css +197 -30
  35. package/src/styles/modal.css +38 -13
  36. package/src/styles/text.css +12 -0
  37. package/src/styles/theme.css +9 -11
  38. package/src/types/BagelForm.ts +17 -6
  39. package/dist/components/Drop.vue.d.ts +0 -34
  40. package/dist/components/Drop.vue.d.ts.map +0 -1
  41. package/dist/components/FileUploader.vue.d.ts +0 -60
  42. package/dist/components/FileUploader.vue.d.ts.map +0 -1
  43. package/src/types/BagelField.ts +0 -52
  44. package/src/utils/objects.ts +0 -81
@@ -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
- // }