@bagelink/vue 0.0.200 → 0.0.206

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 (67) hide show
  1. package/dist/components/Btn.vue.d.ts +3 -0
  2. package/dist/components/Btn.vue.d.ts.map +1 -1
  3. package/dist/components/TabbedLayout.vue.d.ts +5 -3
  4. package/dist/components/TabbedLayout.vue.d.ts.map +1 -1
  5. package/dist/components/form/BglField.vue.d.ts +23 -0
  6. package/dist/components/form/BglField.vue.d.ts.map +1 -0
  7. package/dist/components/form/BglForm.vue.d.ts +36 -0
  8. package/dist/components/form/BglForm.vue.d.ts.map +1 -0
  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/index.d.ts +2 -0
  12. package/dist/components/form/index.d.ts.map +1 -1
  13. package/dist/components/form/inputs/CheckInput.vue.d.ts +0 -1
  14. package/dist/components/form/inputs/CheckInput.vue.d.ts.map +1 -1
  15. package/dist/components/form/inputs/ColorPicker.vue.d.ts +0 -1
  16. package/dist/components/form/inputs/ColorPicker.vue.d.ts.map +1 -1
  17. package/dist/components/form/inputs/CurrencyInput.vue.d.ts +0 -1
  18. package/dist/components/form/inputs/CurrencyInput.vue.d.ts.map +1 -1
  19. package/dist/components/form/inputs/DateInput.vue.d.ts +0 -1
  20. package/dist/components/form/inputs/DateInput.vue.d.ts.map +1 -1
  21. package/dist/components/form/inputs/FileUpload.vue.d.ts +18 -0
  22. package/dist/components/form/inputs/FileUpload.vue.d.ts.map +1 -0
  23. package/dist/components/form/inputs/Password.vue.d.ts +0 -1
  24. package/dist/components/form/inputs/Password.vue.d.ts.map +1 -1
  25. package/dist/components/form/inputs/PlainText.vue.d.ts +0 -1
  26. package/dist/components/form/inputs/PlainText.vue.d.ts.map +1 -1
  27. package/dist/components/form/inputs/RadioPillsInput.vue.d.ts +5 -3
  28. package/dist/components/form/inputs/RadioPillsInput.vue.d.ts.map +1 -1
  29. package/dist/components/form/inputs/ReadOnlyInput.vue.d.ts +0 -1
  30. package/dist/components/form/inputs/ReadOnlyInput.vue.d.ts.map +1 -1
  31. package/dist/components/form/inputs/SelectField.vue.d.ts +4 -1
  32. package/dist/components/form/inputs/SelectField.vue.d.ts.map +1 -1
  33. package/dist/components/form/inputs/TextInput.vue.d.ts +13 -0
  34. package/dist/components/form/inputs/TextInput.vue.d.ts.map +1 -1
  35. package/dist/components/form/inputs/index.d.ts +1 -0
  36. package/dist/components/form/inputs/index.d.ts.map +1 -1
  37. package/dist/index.cjs +849 -605
  38. package/dist/index.mjs +849 -605
  39. package/dist/style.css +146 -74
  40. package/dist/types/BagelField.d.ts +1 -8
  41. package/dist/types/BagelField.d.ts.map +1 -1
  42. package/dist/types/BagelForm.d.ts +23 -0
  43. package/dist/types/BagelForm.d.ts.map +1 -0
  44. package/dist/types/index.d.ts +2 -2
  45. package/dist/types/index.d.ts.map +1 -1
  46. package/dist/types/materialIcons.d.ts +1 -1
  47. package/dist/types/materialIcons.d.ts.map +1 -1
  48. package/dist/utils/index.d.ts +2 -2
  49. package/dist/utils/index.d.ts.map +1 -1
  50. package/package.json +1 -1
  51. package/src/components/Btn.vue +8 -7
  52. package/src/components/TabbedLayout.vue +58 -45
  53. package/src/components/form/BglField.vue +30 -0
  54. package/src/components/form/BglForm.vue +75 -0
  55. package/src/components/form/index.ts +2 -0
  56. package/src/components/form/inputs/FileUpload.vue +130 -0
  57. package/src/components/form/inputs/RadioPillsInput.vue +20 -14
  58. package/src/components/form/inputs/SelectField.vue +2 -0
  59. package/src/components/form/inputs/TextInput.vue +44 -8
  60. package/src/components/form/inputs/index.ts +1 -0
  61. package/src/types/BagelField.ts +1 -6
  62. package/src/types/BagelForm.ts +24 -0
  63. package/src/types/index.ts +11 -2
  64. package/src/types/materialIcons.ts +1 -0
  65. package/src/utils/index.ts +10 -23
  66. package/dist/components/FileUploader.vue.d.ts +0 -60
  67. package/dist/components/FileUploader.vue.d.ts.map +0 -1
@@ -1,6 +1,5 @@
1
1
  import { inject } from 'vue';
2
-
3
- import type { BagelField } from '@bagelink/vue';
2
+ import { Attributes } from '../types';
4
3
 
5
4
  let timeout: any;
6
5
  export const debounce = (fn: () => void, delay = 500) => {
@@ -13,27 +12,6 @@ export const keyToLabel = (key: string) => key
13
12
  .map((k) => k.charAt(0).toUpperCase() + k.slice(1))
14
13
  .join(' ');
15
14
 
16
- export function computeFields(modelValue: Record<string, any>): BagelField[] {
17
- const fields = [];
18
- for (const key of Object.keys(modelValue)) {
19
- const field: BagelField = {
20
- label: keyToLabel(key),
21
- id: key,
22
- inputType: 'PlainText',
23
- };
24
- if (typeof modelValue[key] === 'string') field.inputType = 'PlainText';
25
- if (typeof modelValue[key] === 'number') field.inputType = 'NumberInput';
26
- if (modelValue[key] === true || modelValue[key] === false) field.inputType = 'CheckInput';
27
- if (
28
- modelValue[key] instanceof Date ||
29
- !Number.isNaN(Date.parse(modelValue[key]))
30
- ) field.inputType = 'DateInput';
31
-
32
- fields.push(field);
33
- }
34
- return fields;
35
- }
36
-
37
15
  export const copyText = async (
38
16
  text: string,
39
17
  // eslint-disable-next-line no-unused-vars
@@ -56,4 +34,13 @@ export function useEscape(event: KeyboardEvent, closeModel: () => void) {
56
34
  }
57
35
  }
58
36
 
37
+ export function bindAttrs<T = Record<string, any>>(attrs: Attributes, fieldVal: any, row: T) {
38
+ const arr = Object.entries(attrs).map(([key, value]) => [
39
+ key,
40
+ typeof value === 'function' ? value(fieldVal, row) : value,
41
+ ]);
42
+ const resolvedAttrs = Object.fromEntries(arr);
43
+ return resolvedAttrs;
44
+ }
45
+
59
46
  export { formatString } from './strings';
@@ -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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