@bagelink/vue 0.0.25 → 0.0.35

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 (82) hide show
  1. package/package.json +34 -9
  2. package/src/components/Btn.vue +221 -0
  3. package/src/components/Comments.vue +284 -0
  4. package/src/components/ContactArray.vue +142 -0
  5. package/src/components/ContactSubmissions.vue +45 -0
  6. package/src/components/DataPreview.vue +85 -0
  7. package/src/components/DropDown.vue +122 -0
  8. package/src/components/FileUploader.vue +353 -0
  9. package/src/components/FormKitTable.vue +299 -0
  10. package/src/components/FormSchema.vue +79 -0
  11. package/src/components/LangText.vue +32 -0
  12. package/src/components/ListItem.vue +20 -0
  13. package/src/components/ListView.vue +54 -0
  14. package/src/components/MaterialIcon.vue +19 -0
  15. package/src/components/Modal.vue +62 -0
  16. package/src/components/ModalForm.vue +109 -0
  17. package/src/components/NavBar.vue +353 -0
  18. package/src/components/PageTitle.vue +17 -0
  19. package/src/components/PersonPreview.vue +203 -0
  20. package/src/components/PersonPreviewFormkit.vue +205 -0
  21. package/src/components/RTXEditor.vue +151 -0
  22. package/src/components/RouterWrapper.vue +17 -0
  23. package/src/components/TabbedLayout.vue +83 -0
  24. package/src/components/TableSchema.vue +248 -0
  25. package/src/components/TopBar.vue +5 -0
  26. package/src/components/charts/BarChart.vue +316 -0
  27. package/src/components/dashboard/Lineart.vue +197 -0
  28. package/src/components/form/ItemRef.vue +45 -0
  29. package/src/components/form/MaterialIcon.vue +19 -0
  30. package/src/components/form/PlainInputField.vue +79 -0
  31. package/src/components/form/inputs/CheckInput.vue +143 -0
  32. package/src/components/form/inputs/Checkbox.vue +77 -0
  33. package/src/components/form/inputs/ColorPicker.vue +47 -0
  34. package/src/components/form/inputs/CurrencyInput.vue +137 -0
  35. package/src/components/form/inputs/DateInput.vue +55 -0
  36. package/src/components/form/inputs/DatetimeInput.vue +50 -0
  37. package/src/components/form/inputs/DurationInput.vue +55 -0
  38. package/src/components/form/inputs/DynamicLinkField.vue +142 -0
  39. package/src/components/form/inputs/EmailInput.vue +57 -0
  40. package/src/components/form/inputs/FloatInput.vue +52 -0
  41. package/src/components/form/inputs/IntInput.vue +53 -0
  42. package/src/components/form/inputs/JSONInput.vue +55 -0
  43. package/src/components/form/inputs/LinkField.vue +300 -0
  44. package/src/components/form/inputs/Password.vue +91 -0
  45. package/src/components/form/inputs/PasswordInput.vue +92 -0
  46. package/src/components/form/inputs/PlainText.vue +63 -0
  47. package/src/components/form/inputs/ReadOnlyInput.vue +28 -0
  48. package/src/components/form/inputs/RichTextEditor.vue +56 -0
  49. package/src/components/form/inputs/SelectField.vue +258 -0
  50. package/src/components/form/inputs/TableField.vue +319 -0
  51. package/src/components/form/inputs/TextArea.vue +79 -0
  52. package/src/components/form/inputs/TextInput.vue +63 -0
  53. package/src/components/form/inputs/index.ts +16 -0
  54. package/src/components/formkit/AddressArray.vue +240 -0
  55. package/src/components/formkit/BankDetailsArray.vue +265 -0
  56. package/src/components/formkit/ContactArrayFormKit.vue +192 -0
  57. package/src/components/formkit/FileUploader.vue +391 -0
  58. package/src/components/formkit/MiscFields.vue +74 -0
  59. package/src/components/formkit/Toggle.vue +164 -0
  60. package/src/components/formkit/index.ts +29 -0
  61. package/src/components/index.ts +20 -0
  62. package/src/components/whatsapp/form/MsgTemplate.vue +227 -0
  63. package/src/components/whatsapp/form/TextVariableExamples.vue +79 -0
  64. package/src/components/whatsapp/interfaces.ts +58 -0
  65. package/src/index.ts +1 -26
  66. package/src/plugins/bagel.ts +26 -0
  67. package/src/styles/modal.css +90 -0
  68. package/src/types/BagelField.ts +57 -0
  69. package/src/types/BtnOptions.ts +14 -0
  70. package/src/types/Person.ts +51 -0
  71. package/src/types/file.ts +12 -0
  72. package/src/types/index.ts +4 -0
  73. package/src/types/materialIcons.d.ts +3005 -0
  74. package/src/utils/index.ts +62 -0
  75. package/src/utils/modal.ts +101 -0
  76. package/src/utils/objects.ts +81 -0
  77. package/src/utils/strings.ts +36 -0
  78. package/dist/index.cjs +0 -23
  79. package/dist/index.d.cts +0 -12
  80. package/dist/index.d.mts +0 -12
  81. package/dist/index.d.ts +0 -12
  82. package/dist/index.mjs +0 -19
@@ -0,0 +1,79 @@
1
+ <template>
2
+ <div
3
+ class="bagel-input"
4
+ :title="description"
5
+ :class="{ small: small }"
6
+ >
7
+ <label v-if="label">
8
+ <LangText :input="label" />
9
+ </label>
10
+ <span
11
+ class="character-limit"
12
+ v-if="showCharacterLimit"
13
+ >
14
+ {{ modelValue?.length }}
15
+ {{ nativeInputAttrs?.maxlength ? `/${nativeInputAttrs.maxlength}` : '' }}
16
+ </span>
17
+ <textarea
18
+ :value="modelValue"
19
+ @input="handleInput"
20
+ :class="{ 'no-edit': !editMode }"
21
+ v-bind="nativeInputAttrs"
22
+ />
23
+ </div>
24
+ </template>
25
+
26
+ <script setup lang="ts">
27
+ import LangText from '@/components/LangText.vue';
28
+
29
+ const emits = defineEmits(['update:modelValue']);
30
+
31
+ withDefaults(
32
+ defineProps<{
33
+ description?: string;
34
+ label?: string;
35
+ modelValue: any;
36
+ placeholder?: string;
37
+ editMode?: boolean;
38
+ small?: boolean;
39
+ nativeInputAttrs?: Record<string, any>;
40
+ showCharacterLimit?: boolean;
41
+ }>(),
42
+ {
43
+ description: '',
44
+ editMode: true,
45
+ placeholder: '',
46
+ label: '',
47
+ },
48
+ );
49
+ const handleInput = (e: Event) => {
50
+ const el = e.target as HTMLInputElement;
51
+ emits('update:modelValue', el.value);
52
+ };
53
+ </script>
54
+
55
+ <style scoped>
56
+ .bagel-input {
57
+ height: 100%;
58
+ margin: 0;
59
+ }
60
+
61
+ .bagel-input label {
62
+ margin-bottom: 0;
63
+ }
64
+
65
+ .bagel-input textarea {
66
+ height: 100%;
67
+ resize: none;
68
+ background: var(--input-bg);
69
+ margin-bottom: 0.5rem;
70
+ }
71
+
72
+ .character-limit {
73
+ font-size: 0.6rem;
74
+ color: var(--input-color);
75
+ position: absolute;
76
+ top: 0.25rem;
77
+ inset-inline-end: 0;
78
+ }
79
+ </style>
@@ -0,0 +1,63 @@
1
+ <template>
2
+ <div
3
+ class="bagel-input"
4
+ :class="{ small }"
5
+ :title="title"
6
+ >
7
+ <label :for="id">
8
+ {{ label }}
9
+ <input
10
+ :id="id"
11
+ v-model="inputVal"
12
+ type="text"
13
+ :placeholder="placeholder || label"
14
+ :class="{ 'no-edit': !editMode }"
15
+ :required="required"
16
+ :pattern="pattern"
17
+ v-bind="nativeInputAttrs"
18
+ >
19
+ </label>
20
+ </div>
21
+ </template>
22
+
23
+ <script setup lang="ts">
24
+ import { watch } from 'vue';
25
+ import { debounce } from '@/utils';
26
+
27
+ const emit = defineEmits(['update:modelValue', 'debounce']);
28
+ const props = withDefaults(
29
+ defineProps<{
30
+ id?: string;
31
+ title?: string;
32
+ placeholder?: string;
33
+ modelValue?: string;
34
+ label?: string;
35
+ editMode?: boolean;
36
+ small?: boolean;
37
+ required?: boolean;
38
+ pattern?: string;
39
+ nativeInputAttrs?: Record<string, any>;
40
+ }>(),
41
+ {
42
+ editMode: true,
43
+ modelValue: '',
44
+ },
45
+ );
46
+ let inputVal = $ref<string>();
47
+
48
+ watch(
49
+ () => inputVal,
50
+ (newVal) => {
51
+ emit('update:modelValue', newVal as string);
52
+ debounce(() => emit('debounce', newVal));
53
+ },
54
+ );
55
+
56
+ watch(
57
+ () => props.modelValue,
58
+ (newVal) => {
59
+ if (newVal !== inputVal) inputVal = newVal;
60
+ },
61
+ { immediate: true },
62
+ );
63
+ </script>
@@ -0,0 +1,16 @@
1
+ export * from './CheckInput.vue';
2
+ export * from './CurrencyInput.vue';
3
+ export * from './DateInput.vue';
4
+ export * from './DatetimeInput.vue';
5
+ export * from './EmailInput.vue';
6
+ export * from './FloatInput.vue';
7
+ export * from './IntInput.vue';
8
+ export * from './JSONInput.vue';
9
+ export * from './LinkField.vue';
10
+ export * from './PasswordInput.vue';
11
+ export * from './ReadOnlyInput.vue';
12
+ export * from './SelectField.vue';
13
+ export * from './TextInput.vue';
14
+ export * from './RichTextEditor.vue';
15
+ export * from './TableField.vue';
16
+ export * from './DurationInput.vue';
@@ -0,0 +1,240 @@
1
+ <template>
2
+ <div class="bagel-input">
3
+ <div class="mt-1">
4
+ <div
5
+ class="bglform-contact mb-3"
6
+ v-for="(address, i) in val"
7
+ :key="i"
8
+ >
9
+ <div
10
+ class="bglform-contact-confirm"
11
+ v-if="deleteCandidate === i"
12
+ >
13
+ <p class="txt14">
14
+ {{ form.sure }}
15
+ </p>
16
+ <Btn
17
+ thin
18
+ color="red"
19
+ @click="deleteContact(address.id)"
20
+ >
21
+ {{ form.delete }}
22
+ </Btn>
23
+ <Btn
24
+ thin
25
+ @click="deleteCandidate = -1"
26
+ >
27
+ {{ form.cancel }}
28
+ </Btn>
29
+ </div>
30
+ <Checkbox
31
+ v-model="address.primary"
32
+ @update:model-value="($event) => primaryHandler(i, $event)"
33
+ />
34
+ <input
35
+ class="bglform-contact-label"
36
+ v-model="address.label"
37
+ type="text"
38
+ :placeholder="form.label"
39
+ >
40
+ <div class="bglform-contact-address">
41
+ <input
42
+ v-model="address.street"
43
+ :placeholder="form.street"
44
+ type="text"
45
+ >
46
+ <div class="bglform-contact-address-flex">
47
+ <input
48
+ v-model="address.city"
49
+ :placeholder="form.city"
50
+ type="text"
51
+ >
52
+ <input
53
+ v-model="address.postal_code"
54
+ :placeholder="form.zip"
55
+ type="text"
56
+ >
57
+ </div>
58
+ <input
59
+ v-model="address.country"
60
+ :placeholder="form.country"
61
+ type="text"
62
+ >
63
+ </div>
64
+ <div class="bglform-address-del">
65
+ <Btn
66
+ thin
67
+ @click="deleteCandidate = i"
68
+ icon="delete"
69
+ color="gray"
70
+ />
71
+ </div>
72
+ </div>
73
+ <Btn
74
+ class="add-btn"
75
+ color="blue"
76
+ flat
77
+ thin
78
+ @click="addNew"
79
+ >
80
+ {{ form.add }}
81
+ {{ context?.label }}
82
+ </Btn>
83
+ </div>
84
+ </div>
85
+ </template>
86
+
87
+ <script setup lang="ts">
88
+ import { watch } from 'vue';
89
+ // import type { BagelField } from '@/types/BagelField';
90
+ import { useBagel } from 'src/plugins/bagel';
91
+ import { Btn } from '@/components';
92
+ import Checkbox from '../form/inputs/Checkbox.vue';
93
+
94
+ const bagel = useBagel();
95
+ const props = defineProps<{
96
+ context: Record<string, any>;
97
+ form: {
98
+ add: string;
99
+ cancel: string;
100
+ city: string;
101
+ country: string;
102
+ delete: string;
103
+ label: string;
104
+ sure: string;
105
+ zip: string;
106
+ street: string;
107
+ };
108
+ }>();
109
+
110
+ let val = $ref<any[]>([]);
111
+ const addNew = () => {
112
+ if (!val) val = [{}];
113
+ else val.push({});
114
+ };
115
+
116
+ let deleteCandidate = $ref<number>(-1);
117
+
118
+ const del = (i: number) => {
119
+ val.splice(i, 1);
120
+ };
121
+
122
+ const deleteContact = async (id: string) => {
123
+ await bagel.delete(`/person/contact/${id}`);
124
+ const index = val.findIndex((v) => v.id === id);
125
+ deleteCandidate = -1;
126
+ del(index);
127
+ };
128
+
129
+ const primaryHandler = (i: number, isPrimary: boolean) => {
130
+ if (!isPrimary) return;
131
+ val?.forEach((contact, index) => {
132
+ if (index !== i) contact.primary = false;
133
+ });
134
+ };
135
+
136
+ watch(
137
+ () => props.context?.value,
138
+ () => {
139
+ val = props.context?.value;
140
+ },
141
+ { immediate: true },
142
+ );
143
+
144
+ watch(
145
+ () => val,
146
+ () => {
147
+ props.context?.node.input(val);
148
+ },
149
+ );
150
+ </script>
151
+
152
+ <style>
153
+ .bglform-contact-confirm {
154
+ position: absolute;
155
+ background: rgba(255, 255, 255, 0.5);
156
+ height: 100%;
157
+ width: 100%;
158
+ display: flex;
159
+ align-items: center;
160
+ justify-content: center;
161
+ gap: 0.5rem;
162
+ backdrop-filter: blur(1px);
163
+ }
164
+ </style>
165
+ <style scoped>
166
+ .bglform-contact {
167
+ display: flex;
168
+ gap: 0.5rem;
169
+ max-width: 700px;
170
+ position: relative;
171
+ }
172
+
173
+ .bglform-contact-label {
174
+ flex-basis: 140px;
175
+ }
176
+
177
+ .bglform-contact-address {
178
+ display: flex;
179
+ flex-direction: column;
180
+ gap: 0.5rem;
181
+ }
182
+
183
+ .bglform-contact input[type='checkbox'] {
184
+ width: 30px;
185
+ min-width: 0;
186
+ }
187
+
188
+ .light.thin.btn-txt.btn {
189
+ padding-left: calc(var(--btn-padding) / 4);
190
+ padding-right: calc(var(--btn-padding) / 4);
191
+ }
192
+
193
+ .bglform-address-del {
194
+ margin-top: 6px;
195
+ }
196
+
197
+ .bglform-contact-address-flex {
198
+ display: flex;
199
+ gap: 0.5rem;
200
+ }
201
+
202
+ .add-btn {
203
+ display: flex;
204
+ gap: 0.5rem;
205
+ align-items: center;
206
+ margin-inline-start: 1rem;
207
+ }
208
+
209
+ .add-btn:active {
210
+ background: none !important;
211
+ }
212
+
213
+ .add-btn::before {
214
+ content: '+';
215
+ font-size: 10px;
216
+ background: var(--bgl-blue-light);
217
+ border-radius: 100%;
218
+ height: 14px;
219
+ width: 14px;
220
+ display: flex;
221
+ align-items: center;
222
+ justify-content: center;
223
+ color: var(--bgl-blue);
224
+ }
225
+
226
+ .add-btn:hover::before {
227
+ background: var(--bgl-blue);
228
+ color: var(--bgl-white);
229
+ }
230
+
231
+ @media screen and (max-width: 910px) {
232
+ .bglform-contact-address-flex {
233
+ flex-wrap: wrap;
234
+ }
235
+
236
+ .bglform-contact-label {
237
+ min-width: 0;
238
+ }
239
+ }
240
+ </style>
@@ -0,0 +1,265 @@
1
+ <template>
2
+ <div class="bagel-input">
3
+ <div class="mt-1">
4
+ <div
5
+ class="bglform-contact mb-3"
6
+ v-for="(bank_account, i) in val"
7
+ :key="i"
8
+ >
9
+ <div
10
+ class="bglform-contact-confirm"
11
+ v-if="deleteCandidate === i"
12
+ >
13
+ <p class="txt14">
14
+ {{ form.sure }}
15
+ </p>
16
+ <Btn
17
+ thin
18
+ color="red"
19
+ @click="deleteContact(bank_account.id)"
20
+ >
21
+ {{ form.delete }}
22
+ </Btn>
23
+ <Btn
24
+ thin
25
+ @click="deleteCandidate = -1"
26
+ >
27
+ {{ form.cancel }}
28
+ </Btn>
29
+ </div>
30
+ <Checkbox
31
+ v-model="bank_account.primary"
32
+ @update:model-value="($event) => primaryHandler(i, $event)"
33
+ />
34
+ <input
35
+ class="bglform-contact-label"
36
+ v-model="bank_account.label"
37
+ type="text"
38
+ :placeholder="form.label"
39
+ >
40
+ <div class="bglform-contact-address">
41
+ <input
42
+ v-model="bank_account.bank_name"
43
+ :placeholder="form.bankName"
44
+ type="text"
45
+ required
46
+ >
47
+ <div class="bglform-contact-address-flex">
48
+ <input
49
+ v-model="bank_account.branch"
50
+ :placeholder="form.bankBranch"
51
+ type="text"
52
+ required
53
+ >
54
+ <input
55
+ v-model="bank_account.account_number"
56
+ :placeholder="form.bankAccount"
57
+ type="text"
58
+ required
59
+ >
60
+ </div>
61
+ <div class="grid gap-2">
62
+ <input
63
+ v-model="bank_account.bank_account_holder"
64
+ :placeholder="form.bankAccountHolder"
65
+ type="text"
66
+ required
67
+ >
68
+ <input
69
+ v-model="bank_account.bank_account_holder_id"
70
+ :placeholder="form.bankAccountHolderID"
71
+ type="text"
72
+ >
73
+ <input
74
+ v-model="bank_account.iban"
75
+ placeholder="IBAN"
76
+ type="text"
77
+ >
78
+ <input
79
+ v-model="bank_account.swift"
80
+ placeholder="SWIFT"
81
+ type="text"
82
+ >
83
+ <input
84
+ v-model="bank_account.bank_address"
85
+ :placeholder="form.bankAddress"
86
+ type="text"
87
+ >
88
+ </div>
89
+ </div>
90
+ <div class="bglform-address-del">
91
+ <Btn
92
+ thin
93
+ @click="deleteCandidate = i"
94
+ icon="delete"
95
+ color="gray"
96
+ />
97
+ </div>
98
+ </div>
99
+ <Btn
100
+ class="add-btn"
101
+ color="blue"
102
+ flat
103
+ thin
104
+ @click="val.push({})"
105
+ >
106
+ {{ form.add }} {{ context?.label }}
107
+ </Btn>
108
+ </div>
109
+ </div>
110
+ </template>
111
+
112
+ <script setup lang="ts">
113
+ import { watch } from 'vue';
114
+ // import type { BagelField } from '@/types/BagelField';
115
+
116
+ import { useBagel } from 'src/plugins/bagel';
117
+ import { Btn } from '@/components';
118
+ import Checkbox from '../form/inputs/Checkbox.vue';
119
+
120
+ const bagel = useBagel();
121
+
122
+ const props = defineProps<{
123
+ context: Record<string, any>;
124
+ form: {
125
+ sure: string
126
+ delete: string
127
+ cancel: string
128
+ label: string
129
+ bankName: string
130
+ bankBranch: string
131
+ bankAccount: string
132
+ bankAccountHolder: string
133
+ bankAccountHolderID: string
134
+ bankAddress: string
135
+ add: string
136
+ }
137
+ }>();
138
+
139
+ let val = $ref<any[]>([]);
140
+
141
+ let deleteCandidate = $ref<number>(-1);
142
+
143
+ const del = (i: number) => {
144
+ val.splice(i, 1);
145
+ };
146
+
147
+ const deleteContact = async (id: string) => {
148
+ await bagel.delete(`/person/contact/${id}`);
149
+ const index = val.findIndex((v) => v.id === id);
150
+ deleteCandidate = -1;
151
+ del(index);
152
+ };
153
+
154
+ const primaryHandler = (i: number, isPrimary: boolean) => {
155
+ if (!isPrimary) return;
156
+ val?.forEach((contact, index) => {
157
+ if (index !== i) contact.primary = false;
158
+ });
159
+ };
160
+
161
+ watch(
162
+ () => props.context?.value,
163
+ () => {
164
+ val = props.context?.value;
165
+ },
166
+ { immediate: true },
167
+ );
168
+
169
+ watch(
170
+ () => val,
171
+ () => {
172
+ props.context?.node.input(val);
173
+ },
174
+ );
175
+ </script>
176
+
177
+ <style>
178
+ .bglform-contact-confirm {
179
+ position: absolute;
180
+ background: rgba(255, 255, 255, 0.5);
181
+ height: 100%;
182
+ width: 100%;
183
+ display: flex;
184
+ align-items: center;
185
+ justify-content: center;
186
+ gap: 0.5rem;
187
+ backdrop-filter: blur(1px);
188
+ }
189
+ </style>
190
+ <style scoped>
191
+ .bglform-contact {
192
+ display: flex;
193
+ gap: 0.5rem;
194
+ max-width: 700px;
195
+ position: relative;
196
+ }
197
+
198
+ .bglform-contact-label {
199
+ flex-basis: 140px;
200
+ }
201
+
202
+ .bglform-contact-address {
203
+ display: flex;
204
+ flex-direction: column;
205
+ gap: 0.5rem;
206
+ }
207
+
208
+ .bglform-contact input[type='checkbox'] {
209
+ width: 30px;
210
+ min-width: 0;
211
+ }
212
+
213
+ .light.thin.btn-txt.btn {
214
+ padding-left: calc(var(--btn-padding) / 4);
215
+ padding-right: calc(var(--btn-padding) / 4);
216
+ }
217
+
218
+ .bglform-address-del {
219
+ margin-top: 6px;
220
+ }
221
+
222
+ .bglform-contact-address-flex {
223
+ display: flex;
224
+ gap: 0.5rem;
225
+ }
226
+
227
+ .add-btn {
228
+ display: flex;
229
+ gap: 0.5rem;
230
+ align-items: center;
231
+ margin-inline-start: 1rem;
232
+ }
233
+
234
+ .add-btn:active {
235
+ background: none !important;
236
+ }
237
+
238
+ .add-btn::before {
239
+ content: '+';
240
+ font-size: 10px;
241
+ background: var(--bgl-blue-light);
242
+ border-radius: 100%;
243
+ height: 14px;
244
+ width: 14px;
245
+ display: flex;
246
+ align-items: center;
247
+ justify-content: center;
248
+ color: var(--bgl-blue);
249
+ }
250
+
251
+ .add-btn:hover::before {
252
+ background: var(--bgl-blue);
253
+ color: var(--bgl-white);
254
+ }
255
+
256
+ @media screen and (max-width: 910px) {
257
+ .bglform-contact-address-flex {
258
+ flex-wrap: wrap;
259
+ }
260
+
261
+ .bglform-contact-label {
262
+ min-width: 0;
263
+ }
264
+ }
265
+ </style>