@bagelink/vue 0.0.25 → 0.0.32

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 +32 -9
  2. package/src/components/Btn.vue +221 -0
  3. package/src/components/Comments.vue +265 -0
  4. package/src/components/ContactArray.vue +127 -0
  5. package/src/components/ContactSubmissions.vue +42 -0
  6. package/src/components/DataPreview.vue +72 -0
  7. package/src/components/DropDown.vue +122 -0
  8. package/src/components/FileUploader.vue +344 -0
  9. package/src/components/FormKitTable.vue +250 -0
  10. package/src/components/FormSchema.vue +65 -0
  11. package/src/components/LangText.vue +30 -0
  12. package/src/components/ListItem.vue +16 -0
  13. package/src/components/ListView.vue +39 -0
  14. package/src/components/MaterialIcon.vue +16 -0
  15. package/src/components/Modal.vue +50 -0
  16. package/src/components/ModalForm.vue +94 -0
  17. package/src/components/NavBar.vue +343 -0
  18. package/src/components/PageTitle.vue +17 -0
  19. package/src/components/PersonPreview.vue +205 -0
  20. package/src/components/PersonPreviewFormkit.vue +205 -0
  21. package/src/components/RTXEditor.vue +147 -0
  22. package/src/components/RouterWrapper.vue +9 -0
  23. package/src/components/TabbedLayout.vue +80 -0
  24. package/src/components/TableSchema.vue +213 -0
  25. package/src/components/TopBar.vue +5 -0
  26. package/src/components/charts/BarChart.vue +290 -0
  27. package/src/components/dashboard/Lineart.vue +165 -0
  28. package/src/components/form/ItemRef.vue +38 -0
  29. package/src/components/form/MaterialIcon.vue +19 -0
  30. package/src/components/form/PlainInputField.vue +80 -0
  31. package/src/components/form/inputs/CheckInput.vue +143 -0
  32. package/src/components/form/inputs/Checkbox.vue +69 -0
  33. package/src/components/form/inputs/ColorPicker.vue +37 -0
  34. package/src/components/form/inputs/CurrencyInput.vue +133 -0
  35. package/src/components/form/inputs/DateInput.vue +49 -0
  36. package/src/components/form/inputs/DatetimeInput.vue +46 -0
  37. package/src/components/form/inputs/DurationInput.vue +51 -0
  38. package/src/components/form/inputs/DynamicLinkField.vue +140 -0
  39. package/src/components/form/inputs/EmailInput.vue +53 -0
  40. package/src/components/form/inputs/FloatInput.vue +48 -0
  41. package/src/components/form/inputs/IntInput.vue +49 -0
  42. package/src/components/form/inputs/JSONInput.vue +51 -0
  43. package/src/components/form/inputs/LinkField.vue +293 -0
  44. package/src/components/form/inputs/Password.vue +89 -0
  45. package/src/components/form/inputs/PasswordInput.vue +89 -0
  46. package/src/components/form/inputs/PlainText.vue +52 -0
  47. package/src/components/form/inputs/ReadOnlyInput.vue +24 -0
  48. package/src/components/form/inputs/RichTextEditor.vue +54 -0
  49. package/src/components/form/inputs/SelectField.vue +253 -0
  50. package/src/components/form/inputs/TableField.vue +321 -0
  51. package/src/components/form/inputs/TextArea.vue +70 -0
  52. package/src/components/form/inputs/TextInput.vue +53 -0
  53. package/src/components/form/inputs/index.ts +17 -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 +151 -0
  57. package/src/components/formkit/FileUploader.vue +391 -0
  58. package/src/components/formkit/MiscFields.vue +69 -0
  59. package/src/components/formkit/Toggle.vue +160 -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 +220 -0
  63. package/src/components/whatsapp/form/TextVariableExamples.vue +74 -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 +57 -0
  75. package/src/utils/modal.ts +95 -0
  76. package/src/utils/objects.ts +81 -0
  77. package/src/utils/strings.ts +29 -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,70 @@
1
+ <template>
2
+ <div class="bagel-input" :title="description" :class="{ small: small }">
3
+ <label v-if="label">
4
+ <LangText :input="label" />
5
+ </label>
6
+ <span class="character-limit" v-if="showCharacterLimit">
7
+ {{ modelValue?.length }}
8
+ {{ nativeInputAttrs?.maxlength ? `/${nativeInputAttrs.maxlength}` : '' }}
9
+ </span>
10
+ <textarea
11
+ :value="modelValue"
12
+ @input="handleInput"
13
+ :class="{ 'no-edit': !editMode }"
14
+ v-bind="nativeInputAttrs"
15
+ />
16
+ </div>
17
+ </template>
18
+
19
+ <script setup lang="ts">
20
+ import LangText from '@/components/LangText.vue';
21
+
22
+ const emits = defineEmits(['update:modelValue']);
23
+
24
+ withDefaults(
25
+ defineProps<{
26
+ description?: string;
27
+ label?: string;
28
+ modelValue: any;
29
+ placeholder?: string;
30
+ editMode?: boolean;
31
+ small?: boolean;
32
+ nativeInputAttrs?: Record<string, any>;
33
+ showCharacterLimit?: boolean;
34
+ }>(),
35
+ {
36
+ description: '',
37
+ editMode: true,
38
+ placeholder: '',
39
+ label: '',
40
+ },
41
+ );
42
+ const handleInput = (e: Event) => {
43
+ const el = e.target as HTMLInputElement;
44
+ emits('update:modelValue', el.value);
45
+ };
46
+ </script>
47
+
48
+ <style scoped>
49
+ .bagel-input {
50
+ height: 100%;
51
+ margin: 0;
52
+ }
53
+
54
+ .bagel-input label {
55
+ margin-bottom: 0;
56
+ }
57
+ .bagel-input textarea {
58
+ height: 100%;
59
+ resize: none;
60
+ background: var(--input-bg);
61
+ margin-bottom: 0.5rem;
62
+ }
63
+ .character-limit {
64
+ font-size: 0.6rem;
65
+ color: var(--input-color);
66
+ position: absolute;
67
+ top: 0.25rem;
68
+ inset-inline-end: 0;
69
+ }
70
+ </style>
@@ -0,0 +1,53 @@
1
+ <template>
2
+ <div class="bagel-input" :class="{ small }" :title="title">
3
+ <label :for="id">
4
+ {{ label }}
5
+ <input
6
+ :id="id" v-model="inputVal" type="text" :placeholder="placeholder || label"
7
+ :class="{ 'no-edit': !editMode }" :required="required" :pattern="pattern" v-bind="nativeInputAttrs"
8
+ >
9
+ </label>
10
+ </div>
11
+ </template>
12
+
13
+ <script setup lang="ts">
14
+ import { watch } from 'vue';
15
+ import { debounce } from '@/utils';
16
+
17
+ const emit = defineEmits(['update:modelValue', 'debounce']);
18
+ const props = withDefaults(
19
+ defineProps<{
20
+ id?: string;
21
+ title?: string;
22
+ placeholder?: string;
23
+ modelValue?: string;
24
+ label?: string;
25
+ editMode?: boolean;
26
+ small?: boolean;
27
+ required?: boolean;
28
+ pattern?: string;
29
+ nativeInputAttrs?: Record<string, any>;
30
+ }>(),
31
+ {
32
+ editMode: true,
33
+ modelValue: '',
34
+ },
35
+ );
36
+ let inputVal = $ref<string>();
37
+
38
+ watch(
39
+ () => inputVal,
40
+ (newVal) => {
41
+ emit('update:modelValue', newVal as string);
42
+ debounce(() => emit('debounce', newVal));
43
+ },
44
+ );
45
+
46
+ watch(
47
+ () => props.modelValue,
48
+ (newVal) => {
49
+ if (newVal !== inputVal) inputVal = newVal;
50
+ },
51
+ { immediate: true },
52
+ );
53
+ </script>
@@ -0,0 +1,17 @@
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 './ImageField.vue';
15
+ export * from './RichTextEditor.vue';
16
+ export * from './TableField.vue';
17
+ 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 { Btn } from '@/components';
91
+ import Checkbox from '../form/inputs/Checkbox.vue';
92
+ import { useBagel } from 'src/plugins/bagel';
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 { Btn } from '@/components';
117
+ import Checkbox from '../form/inputs/Checkbox.vue';
118
+ import { useBagel } from 'src/plugins/bagel';
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>