@bagelink/vue 0.0.439 → 0.0.447

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 (55) hide show
  1. package/dist/components/AccordionItem.vue.d.ts.map +1 -1
  2. package/dist/components/DataPreview.vue.d.ts +6 -0
  3. package/dist/components/DataPreview.vue.d.ts.map +1 -1
  4. package/dist/components/Flag.vue.d.ts +16 -0
  5. package/dist/components/Flag.vue.d.ts.map +1 -0
  6. package/dist/components/Modal.vue.d.ts.map +1 -1
  7. package/dist/components/TableSchema.vue.d.ts +6 -5
  8. package/dist/components/TableSchema.vue.d.ts.map +1 -1
  9. package/dist/components/form/inputs/FileUpload.vue.d.ts +166 -2
  10. package/dist/components/form/inputs/FileUpload.vue.d.ts.map +1 -1
  11. package/dist/components/form/inputs/TelInput.vue.d.ts +165 -0
  12. package/dist/components/form/inputs/TelInput.vue.d.ts.map +1 -0
  13. package/dist/components/form/inputs/TextInput.vue.d.ts +2 -5
  14. package/dist/components/form/inputs/TextInput.vue.d.ts.map +1 -1
  15. package/dist/components/form/inputs/index.d.ts +1 -0
  16. package/dist/components/form/inputs/index.d.ts.map +1 -1
  17. package/dist/components/index.d.ts +1 -0
  18. package/dist/components/index.d.ts.map +1 -1
  19. package/dist/components/layout/Tabs.vue.d.ts.map +1 -1
  20. package/dist/index.cjs +6513 -1544
  21. package/dist/index.d.ts +1 -0
  22. package/dist/index.d.ts.map +1 -1
  23. package/dist/index.mjs +6513 -1544
  24. package/dist/style.css +1877 -93
  25. package/dist/utils/BagelFormUtils.d.ts.map +1 -1
  26. package/dist/utils/allCountries.d.ts +11 -0
  27. package/dist/utils/allCountries.d.ts.map +1 -0
  28. package/package.json +3 -4
  29. package/src/components/AccordionItem.vue +8 -5
  30. package/src/components/DataPreview.vue +14 -4
  31. package/src/components/Flag.vue +1349 -0
  32. package/src/components/Modal.vue +26 -9
  33. package/src/components/ModalForm.vue +1 -1
  34. package/src/components/PageTitle.vue +8 -1
  35. package/src/components/TableSchema.vue +34 -2
  36. package/src/components/form/inputs/FileUpload.vue +74 -61
  37. package/src/components/form/inputs/SelectInput.vue +6 -0
  38. package/src/components/form/inputs/TelInput.vue +401 -0
  39. package/src/components/form/inputs/TextInput.vue +16 -53
  40. package/src/components/form/inputs/index.ts +1 -0
  41. package/src/components/index.ts +1 -0
  42. package/src/components/layout/Tabs.vue +1 -0
  43. package/src/index.ts +1 -0
  44. package/src/styles/appearance.css +610 -0
  45. package/src/styles/buttons.css +8 -0
  46. package/src/styles/layout.css +46 -1
  47. package/src/styles/mobilLayout.css +37 -0
  48. package/src/styles/modal.css +5 -2
  49. package/src/styles/text.css +39 -0
  50. package/src/utils/BagelFormUtils.ts +11 -1
  51. package/src/utils/allCountries.ts +337 -0
  52. package/src/components/whatsapp/form/MsgTemplate.vue +0 -224
  53. package/src/components/whatsapp/form/TextVariableExamples.vue +0 -79
  54. package/src/components/whatsapp/index.ts +0 -2
  55. package/src/components/whatsapp/interfaces.ts +0 -58
@@ -3,17 +3,30 @@
3
3
  class="bg-dark"
4
4
  :class="{ 'is-side': side, 'is-active': isVisible, 'bg-lignt': false }"
5
5
  @click="() => (dismissable ? closeModal() : '')"
6
- @keydown.esc="closeModal">
6
+ @keydown.esc="closeModal"
7
+ >
7
8
  <Card class="modal" @click.stop :style="{ ...maxWidth }">
8
- <header class="tool-bar">
9
+ <header v-if="slots['toolbar'] || title" class="tool-bar">
9
10
  <slot name="toolbar" />
10
11
  <Btn
11
12
  :style="{ float: side ? 'left' : 'right' }"
12
13
  flat
13
14
  icon="close"
14
- @click="closeModal" />
15
+ @click="closeModal"
16
+ />
15
17
  <Title class="modal-title" tag="h3" v-if="title" :label="title" />
16
18
  </header>
19
+
20
+ <div v-else class="sticky h-10 bg-white z-index-999 -mt-1 -me-075 h-40px pt-025 round">
21
+ <Btn
22
+ class="color-black"
23
+ :style="{ float: side ? 'left' : 'right' }"
24
+ icon="close"
25
+ thin
26
+ color="white"
27
+ @click="closeModal"
28
+ />
29
+ </div>
17
30
  <slot />
18
31
  <footer v-if="slots['footer'] || actions?.length" class="modal-footer mt-3">
19
32
  <Btn
@@ -21,7 +34,8 @@
21
34
  :key="i"
22
35
  @click="closeModal"
23
36
  color="gray"
24
- v-bind="action" />
37
+ v-bind="action"
38
+ />
25
39
  <slot name="footer" />
26
40
  </footer>
27
41
  </Card>
@@ -29,8 +43,12 @@
29
43
  </template>
30
44
 
31
45
  <script lang="ts" setup>
32
- import { onMounted, onUnmounted, watch, useSlots } from 'vue';
33
- import { type BtnOptions, Btn, useEscape, Title, Card } from '@bagelink/vue';
46
+ import {
47
+ onMounted, onUnmounted, watch, useSlots,
48
+ } from 'vue';
49
+ import {
50
+ type BtnOptions, Btn, useEscape, Title, Card,
51
+ } from '@bagelink/vue';
34
52
  import '../styles/modal.css';
35
53
 
36
54
  const props = defineProps<{
@@ -53,7 +71,7 @@ watch(
53
71
  if (val) openModal();
54
72
  else closeModal();
55
73
  },
56
- { immediate: true }
74
+ { immediate: true },
57
75
  );
58
76
 
59
77
  const maxWidth = $computed(() => {
@@ -72,8 +90,7 @@ const closeModal = () => {
72
90
 
73
91
  defineExpose({ closeModal });
74
92
 
75
- const escapeKeyClose = (e: KeyboardEvent) =>
76
- props?.dismissable && useEscape(e, () => closeModal());
93
+ const escapeKeyClose = (e: KeyboardEvent) => props?.dismissable && useEscape(e, () => closeModal());
77
94
 
78
95
  function openModal() {
79
96
  setTimeout(() => (isVisible = true), 1);
@@ -6,7 +6,7 @@
6
6
  :width
7
7
  :visible="visible"
8
8
  :dismissable
9
- :title="title">
9
+ :title >
10
10
  <BagelForm
11
11
  @submit="runSubmit"
12
12
  ref="form"
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <div class="page-top">
3
- <h1 class="top-title">
3
+ <h1 class="top-title m-0">
4
4
  <slot /> {{ value }}
5
5
  </h1>
6
6
  </div>
@@ -19,6 +19,7 @@ defineProps({
19
19
  .top-title {
20
20
  font-weight: 600;
21
21
  font-size: 20px;
22
+ line-height: 1;
22
23
  }
23
24
 
24
25
  .page-top {
@@ -26,4 +27,10 @@ defineProps({
26
27
  align-items: center;
27
28
  gap: 1rem;
28
29
  }
30
+
31
+ @media screen and (max-width: 910px) {
32
+ .top-title {
33
+ font-size: 16px;
34
+ }
35
+ }
29
36
  </style>
@@ -71,11 +71,32 @@ const slots = useSlots();
71
71
  const loading = $ref(true);
72
72
 
73
73
  const props = defineProps<{
74
+ selecteItems?: string[];
74
75
  data: any[];
75
76
  schema?: BglFormSchemaT | (() => BglFormSchemaT);
76
77
  showFields?: string[];
77
78
  }>();
78
79
 
80
+ const emit = defineEmits(['update:selecteItems', 'orderBy', 'select']);
81
+
82
+ let selecteItems = $ref<string[]>(props.selecteItems || []);
83
+ let selected = $computed({
84
+ get: () => selecteItems,
85
+ set: (value: string[]) => {
86
+ selecteItems = value;
87
+ emit('update:selecteItems', value);
88
+ },
89
+ });
90
+
91
+ function selectAll(event: PointerEvent) {
92
+ const value = (event.target as HTMLInputElement).checked;
93
+ if (!value) {
94
+ selected = [];
95
+ return;
96
+ }
97
+ selected.push(...computedData.map((d) => d.id));
98
+ }
99
+
79
100
  const computedSchema = $computed(() => {
80
101
  if (typeof props.schema === 'function') {
81
102
  return props.schema();
@@ -97,8 +118,6 @@ const computedSchema = $computed(() => {
97
118
  : schema;
98
119
  });
99
120
 
100
- const emit = defineEmits(['select', 'orderBy']);
101
-
102
121
  const selectElement = (item: Record<string, any>) => emit('select', item);
103
122
 
104
123
  let sortDirection = $ref('ASC');
@@ -131,6 +150,12 @@ const computedData = $computed(() => {
131
150
  return dta.sort((a, b) => {
132
151
  const aValue = a[sortField];
133
152
  const bValue = b[sortField];
153
+ const numAValue = parseInt(aValue);
154
+ const numBValue = parseInt(bValue);
155
+ if (!isNaN(numAValue) && !isNaN(numBValue)) {
156
+ if (sortDirection === 'ASC') return numAValue - numBValue;
157
+ return numBValue - numAValue;
158
+ }
134
159
  if (typeof aValue === 'string') {
135
160
  if (sortDirection === 'ASC') return aValue.localeCompare(bValue);
136
161
  return bValue.localeCompare(aValue);
@@ -197,6 +222,9 @@ th {
197
222
  height: 50px;
198
223
  vertical-align: bottom;
199
224
  }
225
+ .row.first-row input[type=checkbox]{
226
+ margin-bottom: 0.7rem;
227
+ }
200
228
 
201
229
  .row.first-row::after {
202
230
  content: '';
@@ -267,6 +295,10 @@ th {
267
295
  .row-item:hover {
268
296
  background: var(--bgl-gray-light);
269
297
  }
298
+ .row-item input[type=checkbox]{
299
+ margin-top: 0.45rem !important;
300
+ accent-color: var(--bgl-primary);
301
+ }
270
302
 
271
303
  .infinite-wrapper {
272
304
  overflow-y: auto;
@@ -14,59 +14,69 @@
14
14
  dragover: isDragOver,
15
15
  }"
16
16
  >
17
- <template v-for="file in storageFiles" :key="file.id">
18
- <div class="imagePreviewWrap" v-if="!multiple">
19
- <img class="preview" :src="file.url" alt="" />
20
- </div>
21
- <div class="previewName">
22
- <img v-if="multiple" class="preview" :src="file.url" alt="" />
23
- <p class="no-margin">
17
+ <slot name="files" :files="storageFiles" :fileQueue>
18
+ <template v-for="file in storageFiles" :key="file.id">
19
+ <div class="single-image" v-if="!multiple">
20
+ <img class="single preview" :src="file.url" alt="" >
21
+ <!-- <p class="no-margin">
24
22
  {{ file.name }}
25
- </p>
26
- <Btn
27
- thin
28
- @click.stop="removeFile(file)"
29
- flat
30
- icon="delete"
31
- color="red"
32
- />
33
- </div>
34
- </template>
35
- <template v-for="fileQ in fileQueue" :key="fileQ.file">
36
- <div class="imagePreviewWrap" v-if="!multiple">
37
- <img class="preview" :src="fileToUrl(fileQ.file)" alt="" />
38
- </div>
39
- <div class="previewName">
40
- <img
41
- :width="width || '220'"
42
- v-if="multiple"
43
- class="preview"
44
- :src="fileToUrl(fileQ.file)"
45
- alt=""
46
- />
47
- <p class="no-margin">
48
- {{ fileQ.name }}
49
- </p>
50
- <div
51
- class="pie"
52
- :style="`--p:${fileQ.progress}`"
53
- style="--b: 2px"
54
- :class="{ complete: fileQ.progress === 100 }"
55
- >
56
- <span class="progress" v-if="fileQ.progress < 100">
57
- {{ `${fileQ.progress.toFixed(0)}` }}
58
- </span>
59
- <MaterialIcon class="success" icon="check" />
23
+ </p> -->
60
24
  </div>
61
- </div>
62
- </template>
25
+ <div class="multi-image-item previewName" v-if="multiple">
26
+ <img class="preview" :src="file.url" alt="" >
27
+ <p class="no-margin">
28
+ {{ file.name }}
29
+ </p>
30
+ <Btn
31
+ thin
32
+ @click.stop="removeFile(file)"
33
+ flat
34
+ icon="delete"
35
+ color="red"
36
+ />
37
+ </div>
38
+ </template>
39
+ <template v-for="fileQ in fileQueue" :key="fileQ.file">
40
+ <div class="imagePreviewWrap" v-if="!multiple">
41
+ <img class="preview" :src="fileToUrl(fileQ.file)" alt="" >
42
+ </div>
43
+ <div class="previewName">
44
+ <img
45
+ :width="width || '220'"
46
+ v-if="multiple"
47
+ class="preview"
48
+ :src="fileToUrl(fileQ.file)"
49
+ alt=""
50
+ >
51
+ <p class="no-margin">
52
+ {{ fileQ.name }}
53
+ </p>
54
+ <div
55
+ class="pie"
56
+ :style="`--p:${fileQ.progress}`"
57
+ style="--b: 2px"
58
+ :class="{ complete: fileQ.progress === 100 }"
59
+ >
60
+ <span class="progress" v-if="fileQ.progress < 100">
61
+ {{ `${fileQ.progress.toFixed(0)}` }}
62
+ </span>
63
+ <MaterialIcon class="success" icon="check" />
64
+ </div>
65
+ </div>
66
+ </template>
67
+ </slot>
68
+ <slot v-if="(!storageFiles.length && !fileQueue.length) || multiple" name="placeholder" :browse>
69
+ <p>Drop files here or click to upload</p>
70
+ </slot>
63
71
  </div>
64
72
  </div>
65
73
  </template>
66
74
 
67
75
  <script setup lang="ts">
68
76
  import { onMounted, watch } from 'vue';
69
- import { Btn, type StorageFile, useBagel, MaterialIcon } from '@bagelink/vue';
77
+ import {
78
+ Btn, type StorageFile, useBagel, MaterialIcon,
79
+ } from '@bagelink/vue';
70
80
 
71
81
  const bagel = useBagel();
72
82
 
@@ -96,8 +106,7 @@ const bindKey: StrKey = props.bindkey || 'id';
96
106
  const file_bindkeys = defineModel<FSValue>('modelValue');
97
107
  const storageFiles = $ref<StorageFile[]>([]);
98
108
 
99
- const compareIds = (v1?: FSValue, v2?: FSValue) =>
100
- [v1].flat().join(',') === [v2].flat().join(',');
109
+ const compareIds = (v1?: FSValue, v2?: FSValue) => [v1].flat().join(',') === [v2].flat().join(',');
101
110
 
102
111
  onMounted(() => {
103
112
  if (!props.files && [file_bindkeys.value].flat().length) {
@@ -182,9 +191,7 @@ const browse = () => {
182
191
  input.onchange = (e: Event) => {
183
192
  const target = e?.target as HTMLInputElement;
184
193
  if (target?.files) {
185
- Array.from(target.files).forEach((file: File) =>
186
- fileQueue.push({ name: file.name, file, progress: 0 }),
187
- );
194
+ Array.from(target.files).forEach((file: File) => fileQueue.push({ name: file.name, file, progress: 0 }));
188
195
  }
189
196
  flushQueue();
190
197
  };
@@ -206,9 +213,7 @@ const dragover = (e: DragEvent) => {
206
213
  const drop = (e: DragEvent) => {
207
214
  preventDefault(e);
208
215
  if (e.dataTransfer) {
209
- Array.from(e.dataTransfer.files).forEach((file: File) =>
210
- fileQueue.push({ name: file.name, file, progress: 0 }),
211
- );
216
+ Array.from(e.dataTransfer.files).forEach((file: File) => fileQueue.push({ name: file.name, file, progress: 0 }));
212
217
  }
213
218
  isDragOver = false;
214
219
  flushQueue();
@@ -224,8 +229,7 @@ const drop = (e: DragEvent) => {
224
229
  cursor: pointer;
225
230
  transition: var(--bgl-transition);
226
231
  position: relative;
227
- min-height: 132px;
228
- max-height: 500px;
232
+ height: calc(var(--width) / 1.5);
229
233
  font-size: var(--input-font-size);
230
234
  overflow-y: auto;
231
235
  background: var(--input-bg);
@@ -256,11 +260,24 @@ const drop = (e: DragEvent) => {
256
260
  }
257
261
 
258
262
  img.preview {
259
- width: var(--width);
263
+ /* max-height: calc(var(--width) / 2); */
260
264
  /* max-width: calc(var(--width) * 2); */
265
+ width: 40px;
266
+ height: 40px;
261
267
  border-radius: var(--input-border-radius);
262
268
  object-fit: cover;
263
- background: var(--bgl-white);
269
+ background: var(--bgl-gray-light);
270
+ box-shadow: 0 0 10px #00000012;
271
+
272
+ }
273
+
274
+ img.preview.single{
275
+ max-width: var(--width);
276
+ width: auto;
277
+ object-fit: contain;
278
+ height: auto;
279
+ max-height: calc(var(--width) / 2);
280
+ margin: 1rem;
264
281
  }
265
282
 
266
283
  .fileUploadWrap.dragover,
@@ -276,10 +293,6 @@ img.preview {
276
293
  color: var(--bgl-gray);
277
294
  }
278
295
 
279
- .bagel-input .fileUploadWrap.fileDropZone:after {
280
- content: 'Drop files here or click to upload';
281
- }
282
-
283
296
  .pie {
284
297
  width: 30px;
285
298
  height: 30px;
@@ -283,6 +283,12 @@ watch(
283
283
  width: 100%;
284
284
  font-family: inherit;
285
285
  font-size: var(--input-font-size);
286
+
287
+ }
288
+ .selectinput-btn p{
289
+ white-space: nowrap;
290
+ overflow: hidden;
291
+ text-overflow: ellipsis;
286
292
  }
287
293
 
288
294
  .selectinput-btn:disabled {