@usssa/component-library 1.0.0-alpha.13 → 1.0.0-alpha.131

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/README.md +6 -3
  2. package/package.json +23 -5
  3. package/src/assets/files.png +0 -0
  4. package/src/assets/logo.svg +19 -0
  5. package/src/assets/no-result.png +0 -0
  6. package/src/assets/quasar-logo-vertical.svg +15 -0
  7. package/src/components/core/UAvatar.vue +56 -24
  8. package/src/components/core/UAvatarGroup.vue +62 -52
  9. package/src/components/core/UBadgeStd.vue +6 -1
  10. package/src/components/core/UBannerStd.vue +100 -33
  11. package/src/components/core/UBreadCrumbs.vue +93 -0
  12. package/src/components/core/UBtnIcon.vue +60 -48
  13. package/src/components/core/UBtnStd.vue +54 -42
  14. package/src/components/core/UBtnToggle.vue +11 -6
  15. package/src/components/core/UCheckboxStd.vue +26 -20
  16. package/src/components/core/UChip.vue +56 -27
  17. package/src/components/core/UDate.vue +574 -0
  18. package/src/components/core/UDialogStd.vue +87 -40
  19. package/src/components/core/UDrawer.vue +240 -0
  20. package/src/components/core/UInnerLoader.vue +67 -0
  21. package/src/components/core/UInputAddressLookup.vue +471 -0
  22. package/src/components/core/UInputPhoneStd.vue +73 -68
  23. package/src/components/core/UInputTextStd.vue +132 -108
  24. package/src/components/core/UInputTypeaheadAdvanceSearch.vue +64 -0
  25. package/src/components/core/UMenuButtonStd.vue +280 -0
  26. package/src/components/core/UMenuDropdown.vue +80 -0
  27. package/src/components/core/UMenuDropdownAdvancedSearch.vue +288 -0
  28. package/src/components/core/UMenuItem.vue +150 -0
  29. package/src/components/core/UMenuSearch.vue +831 -0
  30. package/src/components/core/UMultiSelectStd.vue +73 -57
  31. package/src/components/core/UPagination.vue +46 -24
  32. package/src/components/core/URadioBtn.vue +32 -22
  33. package/src/components/core/URadioStd.vue +19 -12
  34. package/src/components/core/USelectStd.vue +125 -80
  35. package/src/components/core/USheet.vue +338 -0
  36. package/src/components/core/UTabBtnStd.vue +87 -59
  37. package/src/components/core/UTable/UTable.vue +75 -41
  38. package/src/components/core/UTableStd.vue +701 -281
  39. package/src/components/core/UTabsStd.vue +33 -16
  40. package/src/components/core/UToggleStd.vue +43 -29
  41. package/src/components/core/UToolbar/UCustomMenuIcon.vue +60 -0
  42. package/src/components/core/UToolbar/UToolbar.vue +206 -0
  43. package/src/components/core/UTooltip.vue +31 -10
  44. package/src/components/core/UUploader.vue +508 -0
  45. package/src/components/index.js +59 -21
  46. package/src/composables/useNotify.js +16 -16
  47. package/src/composables/useOverlayLoader.js +23 -0
  48. package/src/composables/useScreenType.js +30 -0
  49. package/src/css/app.sass +168 -0
  50. package/src/css/colors.sass +101 -0
  51. package/src/css/media.sass +1 -0
  52. package/src/css/quasar.variables.sass +121 -0
  53. package/src/css/typography.sass +0 -0
  54. package/src/css/vars/colors.variables.sass +127 -0
  55. package/src/utils/data.ts +146 -0
@@ -0,0 +1,508 @@
1
+ <script setup>
2
+ import { ref } from 'vue'
3
+ import { fixStringLength, formatDate, getFileCategory } from '../../utils/data'
4
+ import UBtnIcon from './UBtnIcon.vue'
5
+ import UBtnStd from './UBtnStd.vue'
6
+ import UInputTextStd from './UInputTextStd.vue'
7
+ import UTooltip from './UTooltip.vue'
8
+
9
+ const emit = defineEmits(['onUploadFactory', 'onViewFile', 'getFilesOnAdded'])
10
+
11
+ const props = defineProps({
12
+ autoUpload: {
13
+ type: Boolean,
14
+ default: true,
15
+ },
16
+ batch: {
17
+ type: Boolean,
18
+ default: false,
19
+ },
20
+ dataTestId: {
21
+ type: String,
22
+ default: 'uploader',
23
+ },
24
+ description: {
25
+ type: String,
26
+ default: 'Drag and drop your file or select choose file.',
27
+ },
28
+ editIconLabel: {
29
+ type: String,
30
+ default: 'Edit File Name',
31
+ },
32
+ fileIconColor: {
33
+ type: String,
34
+ default: 'primary',
35
+ },
36
+ fileNameLimit: {
37
+ type: Number,
38
+ default: 25,
39
+ },
40
+ fileUploadUrl: {
41
+ type: String,
42
+ },
43
+ listExternal: {
44
+ type: Boolean,
45
+ default: false,
46
+ },
47
+ multiple: {
48
+ type: Boolean,
49
+ default: false,
50
+ },
51
+ noThumbnails: {
52
+ type: Boolean,
53
+ default: true,
54
+ },
55
+ removeIconLabel: {
56
+ type: String,
57
+ default: 'Remove File',
58
+ },
59
+ selectFileBtnLabel: {
60
+ type: String,
61
+ default: 'Choose File',
62
+ },
63
+ showUploadBtn: {
64
+ type: Boolean,
65
+ default: true,
66
+ },
67
+ size: {
68
+ type: String,
69
+ default: 'sm',
70
+ },
71
+ viewIconLabel: {
72
+ type: String,
73
+ default: 'view File Name',
74
+ },
75
+ })
76
+
77
+ const fileDisplayName = ref([])
78
+ const isEditing = ref([])
79
+ const uploaderRef = ref(null)
80
+
81
+ const cancelEdit = (payload) => {
82
+ const { index, file } = payload
83
+ fileDisplayName.value[file['__key']] = file.displayName
84
+ isEditing.value[index] = false
85
+ }
86
+
87
+ const editFileName = (index) => {
88
+ isEditing.value[index] = true
89
+ }
90
+
91
+ const handleViewClick = (file) => {
92
+ return emit('onViewFile', file)
93
+ }
94
+
95
+ const OnFileAdded = (files) => {
96
+ files.forEach((file, index) => {
97
+ files[index]['displayName'] = files[index]['name']
98
+ fileDisplayName.value[file['__key']] = files[index]['displayName']
99
+ })
100
+
101
+ return emit('getFilesOnAdded', uploaderRef.value.files)
102
+ }
103
+
104
+ const OnFileUploaded = ({ files, xhr }) => {
105
+ files.forEach((file, index) => {
106
+ files[index]['uploaded_date'] = new Date()
107
+ })
108
+ }
109
+
110
+ const removeFile = (payload) => {
111
+ const { scope, file } = payload
112
+ fileDisplayName.value.splice(file['__key'], 1)
113
+ scope.removeFile(file)
114
+ }
115
+
116
+ const updateFileName = (payload) => {
117
+ const { index, scope, file } = payload
118
+ scope.files[index].displayName = fileDisplayName.value[file['__key']]
119
+ isEditing.value[index] = false
120
+ }
121
+
122
+ const upload = () => {
123
+ uploaderRef.value.upload()
124
+ }
125
+
126
+ defineExpose({ upload })
127
+ </script>
128
+ <template>
129
+ <div class="u-uploader-container">
130
+ <q-uploader
131
+ v-bind="$attrs"
132
+ class="u-uploader"
133
+ :auto-upload="autoUpload"
134
+ :batch="batch"
135
+ :dataTestId="dataTestId"
136
+ label="Drag and drop your file or select choose file."
137
+ :multiple="multiple"
138
+ :no-thumbnails="noThumbnails"
139
+ ref="uploaderRef"
140
+ :url="fileUploadUrl"
141
+ @added="OnFileAdded"
142
+ @uploaded="OnFileUploaded"
143
+ >
144
+ <template v-slot:header="scope">
145
+ <div v-if="scope.canAddFiles" class="q-py-md q-px-xl bg-neutral-2">
146
+ <div class="text-center">
147
+ <img alt="Upload Files" src="../../assets/files.png" />
148
+ <div class="text-body-md" dataTestId="description">
149
+ {{ description }}
150
+ </div>
151
+ </div>
152
+ <div class="list-items row">
153
+ <UBtnStd
154
+ class="q-mt-md q-mb-md"
155
+ color="primary"
156
+ dataTestId="select-file-btn"
157
+ :full-width="true"
158
+ :label="selectFileBtnLabel"
159
+ size="lg"
160
+ @click="scope.pickFiles"
161
+ >
162
+ {{ selectFileBtnLabel }}
163
+ <q-uploader-add-trigger
164
+ :aria-label="selectFileBtnLabel"
165
+ ></q-uploader-add-trigger>
166
+ </UBtnStd>
167
+ <UBtnStd
168
+ v-if="scope.canUpload && showUploadBtn"
169
+ class="q-mt-md q-mb-md"
170
+ color="primary"
171
+ dataTestId="upload-btn"
172
+ flat
173
+ icon="cloud_upload"
174
+ size="sm"
175
+ @click="scope.upload"
176
+ >
177
+ <UTooltip description="Upload Files" />
178
+ </UBtnStd>
179
+ </div>
180
+ </div>
181
+ </template>
182
+ <template v-slot:list="scope">
183
+ <div
184
+ v-if="!listExternal && scope.files"
185
+ class="list-container q-my-xxs"
186
+ dataTestId="file-list"
187
+ >
188
+ <q-card
189
+ v-for="(file, index) in scope.files"
190
+ :class="`uploader-list list-size-${size} ${
191
+ file.__status == 'uploading'
192
+ ? 'q-py-xs q-px-sm'
193
+ : 'uploaded-container'
194
+ }`"
195
+ :key="file.__key"
196
+ >
197
+ <!-- When File added but not uploaded on server -->
198
+ <q-card-section v-if="file.__status == 'idle'" class="card-section">
199
+ <div class="list-items row items-center">
200
+ <q-icon
201
+ v-if="!file.__img && getFileCategory(file.type) != 'Unknown'"
202
+ :class="`fa-duotone fa-solid fa-file-${getFileCategory(
203
+ file.type
204
+ )}`"
205
+ :color="fileIconColor"
206
+ size="md"
207
+ tabindex="0"
208
+ />
209
+ <q-icon
210
+ v-if="getFileCategory(file.type) == 'Unknown'"
211
+ class="fa-duotone fa-solid fa-file-doc"
212
+ :color="fileIconColor"
213
+ size="md"
214
+ tabindex="0"
215
+ />
216
+ <q-icon
217
+ v-if="file.__img"
218
+ class="fa-duotone fa-solid fa-file-image"
219
+ :color="fileIconColor"
220
+ size="md"
221
+ tabindex="0"
222
+ />
223
+ <div class="col">
224
+ <span class="text-caption-md title flex">
225
+ {{ file.name }}
226
+ </span>
227
+ <span class="text-body-xs info">
228
+ {{ file.__sizeLabel }}
229
+ </span>
230
+ </div>
231
+
232
+ <q-icon
233
+ class="icon-close fa-kit-duotone fa-circle-xmark"
234
+ :aria-label="removeIconLabel"
235
+ size="sm"
236
+ tabindex="0"
237
+ @click="removeFile({ scope, file, index })"
238
+ />
239
+ </div>
240
+ </q-card-section>
241
+
242
+ <!-- When File start uploading on server -->
243
+ <q-card-section
244
+ v-if="file.__status == 'uploading'"
245
+ class="card-section"
246
+ >
247
+ <div class="list-items row items-center">
248
+ <q-icon
249
+ v-if="!file.__img && getFileCategory(file.type) != 'Unknown'"
250
+ :class="`fa-duotone fa-solid fa-file-${getFileCategory(
251
+ file.type
252
+ )}`"
253
+ :color="fileIconColor"
254
+ size="md"
255
+ tabindex="0"
256
+ />
257
+ <q-icon
258
+ v-if="getFileCategory(file.type) == 'Unknown'"
259
+ class="fa-duotone fa-solid fa-file-doc"
260
+ :color="fileIconColor"
261
+ size="md"
262
+ tabindex="0"
263
+ />
264
+ <q-icon
265
+ v-if="file.__img"
266
+ class="fa-duotone fa-solid fa-file-image"
267
+ :color="fileIconColor"
268
+ size="md"
269
+ tabindex="0"
270
+ />
271
+ <div class="col">
272
+ <span class="text-caption-md title flex">
273
+ {{
274
+ fixStringLength(
275
+ file.displayName || file.name,
276
+ fileNameLimit
277
+ )
278
+ }}
279
+ </span>
280
+ <span class="text-body-xs info">
281
+ {{ file.__sizeLabel }}
282
+ </span>
283
+ </div>
284
+
285
+ <q-icon
286
+ class="icon-close fa-kit-duotone fa-circle-xmark"
287
+ :aria-label="removeIconLabel"
288
+ size="sm"
289
+ tabindex="0"
290
+ @click="removeFile({ scope, file, index })"
291
+ />
292
+ </div>
293
+ <div class="progress-bar-container flex items-center q-mt-xxs">
294
+ <q-linear-progress
295
+ v-if="file.__progressLabel !== undefined"
296
+ class="progress-bar"
297
+ color="primary"
298
+ track-color="neutral-4"
299
+ :value="file.__progress"
300
+ />
301
+ <span class="text-body-xxs info">
302
+ {{ file.__progressLabel }}
303
+ </span>
304
+ </div>
305
+ </q-card-section>
306
+ <!--End--- When File Uploading on server --End -->
307
+
308
+ <!-- When File Uploaded on server -->
309
+ <q-card-section
310
+ v-if="file.__status == 'uploaded'"
311
+ class="card-section"
312
+ >
313
+ <div class="list-items row items-center">
314
+ <q-icon
315
+ v-if="!file.__img && getFileCategory(file.type) != 'Unknown'"
316
+ :class="`fa-duotone fa-solid fa-file-${getFileCategory(
317
+ file.type
318
+ )}`"
319
+ :color="fileIconColor"
320
+ size="md"
321
+ tabindex="0"
322
+ />
323
+ <q-icon
324
+ v-if="getFileCategory(file.type) == 'Unknown'"
325
+ class="fa-duotone fa-solid fa-file-doc"
326
+ :color="fileIconColor"
327
+ size="md"
328
+ tabindex="0"
329
+ />
330
+ <q-icon
331
+ v-if="file.__img"
332
+ class="fa-duotone fa-solid fa-file-image"
333
+ :color="fileIconColor"
334
+ size="md"
335
+ tabindex="0"
336
+ />
337
+
338
+ <div class="col">
339
+ <span class="text-caption-md title flex">
340
+ <UTooltip
341
+ anchor="center end"
342
+ :description="file.displayName || file.name"
343
+ :offset="[4, 4]"
344
+ self="center end"
345
+ />
346
+
347
+ {{
348
+ fixStringLength(
349
+ file.displayName || file.name,
350
+ fileNameLimit
351
+ )
352
+ }}
353
+ </span>
354
+ <span class="text-body-xs info">
355
+ Uploaded: {{ formatDate(file.uploaded_date) }}
356
+ </span>
357
+ </div>
358
+
359
+ <UBtnIcon
360
+ v-if="!isEditing[index] && size == 'md'"
361
+ iconClass="fa-kit-duotone fa-pen-to-square"
362
+ :aria-label="editIconLabel"
363
+ color="primary"
364
+ size="md"
365
+ tabindex="0"
366
+ @click="editFileName(index)"
367
+ />
368
+
369
+ <UBtnIcon
370
+ iconClass="fa-kit-duotone fa-trash-can"
371
+ :aria-label="removeIconLabel"
372
+ color="accent"
373
+ size="md"
374
+ tabindex="0"
375
+ @click="removeFile({ scope, file, index })"
376
+ />
377
+
378
+ <UBtnStd
379
+ v-if="size == 'md'"
380
+ :aria-label="viewIconLabel"
381
+ color="primary"
382
+ label="View"
383
+ outline
384
+ size="sm"
385
+ @onClick="handleViewClick(file)"
386
+ />
387
+ </div>
388
+ <div v-if="isEditing[index]" class="q-my-ba">
389
+ <UInputTextStd
390
+ v-model="fileDisplayName[file.__key]"
391
+ label="Edit file name"
392
+ size="md"
393
+ />
394
+ </div>
395
+ <div
396
+ v-if="!isEditing[index] && size == 'sm'"
397
+ class="list-items edit-button row q-mt-ba"
398
+ >
399
+ <UBtnStd
400
+ :aria-label="editIconLabel"
401
+ color="primary"
402
+ flat
403
+ :full-width="true"
404
+ label="Edit"
405
+ size="md"
406
+ @click="editFileName(index)"
407
+ />
408
+ <UBtnStd
409
+ :aria-label="viewIconLabel"
410
+ color="primary"
411
+ :full-width="true"
412
+ label="View File"
413
+ :outline="true"
414
+ size="md"
415
+ @onClick="handleViewClick(file)"
416
+ />
417
+ </div>
418
+ <div v-if="isEditing[index]" class="list-items update-button row">
419
+ <UBtnStd
420
+ color="primary"
421
+ flat
422
+ :full-width="true"
423
+ label="Cancel"
424
+ size="md"
425
+ @click="cancelEdit({ index, file })"
426
+ />
427
+
428
+ <UBtnStd
429
+ color="primary"
430
+ :full-width="true"
431
+ label="Update file name"
432
+ size="md"
433
+ @click="updateFileName({ scope, file, index })"
434
+ />
435
+ </div>
436
+ </q-card-section>
437
+ <q-card-section
438
+ v-if="file.__img && noThumbnails"
439
+ class="flex items-center"
440
+ thumbnail
441
+ >
442
+ <img :src="file.__img.src" />
443
+ </q-card-section>
444
+ <!--End--- When File Uploaded on server --End -->
445
+ </q-card>
446
+ </div>
447
+ </template>
448
+ </q-uploader>
449
+ </div>
450
+ </template>
451
+
452
+ <style lang="sass">
453
+ .u-uploader-container
454
+ .list-container
455
+ display: grid
456
+ place-items: center
457
+ gap: $xxs
458
+ .q-uploader
459
+ width: auto !important
460
+ max-height: unset !important
461
+ .uploader-list
462
+ background: $neutral-2
463
+ border-radius: $xs
464
+ box-shadow: 0px 0px 2px 0px rgba(16, 17, 20, 0.04)
465
+ .uploaded-container
466
+ padding: $sm
467
+ .list-items
468
+ justify-content: space-between
469
+ flex-wrap: nowrap
470
+ gap:$xs
471
+ .edit-button
472
+ gap:$ba
473
+ .update-button
474
+ gap:$sm
475
+ .list-size-sm
476
+ width: 21.75rem
477
+ .list-size-md
478
+ width: 100%
479
+ .title
480
+ color: $dark
481
+ .info
482
+ color: $neutral-9
483
+ .file-icon
484
+ font-size:$md
485
+ .q-uploader__header
486
+ padding: 0 !important
487
+ background-color: $neutral-2
488
+ .text-body-md
489
+ color: $dark !important
490
+ .q-uploader__list
491
+ min-height: auto !important
492
+ padding:0
493
+ .q-uploader__overlay
494
+ display: none !important
495
+ .progress-bar
496
+ width: 84% !important
497
+ .progress-bar-container
498
+ gap: $xs
499
+ .card-section
500
+ padding:0px
501
+ .q-uploader__dnd
502
+ background: $blue-1 !important
503
+ opacity: .8
504
+ border: 2px solid $blue-6
505
+ border-radius:$sm
506
+ .u-uploader
507
+ display: flex
508
+ </style>
@@ -1,45 +1,83 @@
1
1
  // import BtnStd from "./BtnStd.vue";
2
- import UCheckboxStd from './core/UCheckboxStd.vue'
3
- import UBtnStd from './core/UBtnStd.vue'
4
- import UBtnToggle from './core/UBtnToggle.vue'
5
- import URadioStd from './core/URadioStd.vue'
6
- import UTabsStd from './core/UTabsStd.vue'
7
- import UTabBtnStd from './core/UTabBtnStd.vue'
8
- import UMultiSelectStd from './core/UMultiSelectStd.vue'
9
- import UTooltip from './core/UTooltip.vue'
10
- import UBannerStd from './core/UBannerStd.vue'
11
- import UToggleStd from './core/UToggleStd.vue'
12
- import USelectStd from './core/USelectStd.vue'
13
- import UTableStd from './core/UTableStd.vue'
14
2
  import UAvatar from './core/UAvatar.vue'
15
3
  import UAvatarGroup from './core/UAvatarGroup.vue'
16
4
  import UBadgeStd from './core/UBadgeStd.vue'
5
+ import UBannerStd from './core/UBannerStd.vue'
6
+ import UBreadCrumbs from './core/UBreadCrumbs.vue'
17
7
  import UBtnIcon from './core/UBtnIcon.vue'
8
+ import UBtnStd from './core/UBtnStd.vue'
9
+ import UBtnToggle from './core/UBtnToggle.vue'
10
+ import UCheckboxStd from './core/UCheckboxStd.vue'
18
11
  import UChip from './core/UChip.vue'
12
+ import UDate from './core/UDate.vue'
13
+ import UDialogStd from './core/UDialogStd.vue'
14
+ import UDrawer from './core/UDrawer.vue'
15
+ import UInnerLoader from './core/UInnerLoader.vue'
16
+ import UInputAddressLookup from './core/UInputAddressLookup.vue'
17
+ import UInputPhoneStd from './core/UInputPhoneStd.vue'
19
18
  import UInputTextStd from './core/UInputTextStd.vue'
19
+ import UInputTypeaheadAdvanceSearch from './core/UInputTypeaheadAdvanceSearch.vue'
20
+ import UMenuButtonStd from './core/UMenuButtonStd.vue'
21
+ import UMenuDropdown from './core/UMenuDropdown.vue'
22
+ import UMenuDropdownAdvancedSearch from './core/UMenuDropdownAdvancedSearch.vue'
23
+ import UMenuItem from './core/UMenuItem.vue'
24
+ import UMenuSearch from './core/UMenuSearch.vue'
25
+ import UMultiSelectStd from './core/UMultiSelectStd.vue'
26
+ import UPagination from './core/UPagination.vue'
20
27
  import URadioBtn from './core/URadioBtn.vue'
28
+ import URadioStd from './core/URadioStd.vue'
29
+ import USelectStd from './core/USelectStd.vue'
30
+ import USheet from './core/USheet.vue'
31
+ import UTabBtnStd from './core/UTabBtnStd.vue'
32
+ import UTableStd from './core/UTableStd.vue'
33
+ import UTabsStd from './core/UTabsStd.vue'
34
+ import UToggleStd from './core/UToggleStd.vue'
35
+ import UToolbar from './core/UToolbar/UToolbar.vue'
36
+ import UTooltip from './core/UTooltip.vue'
37
+ import UUploader from './core/UUploader.vue'
21
38
 
22
39
  import { useNotify } from '../composables/useNotify.js'
40
+ import { useOverlayLoader } from '../composables/useOverlayLoader.js'
41
+ import { useScreenType } from '../composables/useScreenType.js'
23
42
 
24
43
  export {
25
44
  UAvatar,
26
45
  UAvatarGroup,
27
46
  UBadgeStd,
47
+ UBannerStd,
48
+ UBreadCrumbs,
28
49
  UBtnIcon,
29
- UChip,
30
- UInputTextStd,
31
50
  UBtnStd,
32
51
  UBtnToggle,
33
52
  UCheckboxStd,
34
- URadioStd,
35
- UTooltip,
36
- UToggleStd,
53
+ UChip,
54
+ UDate,
55
+ UDialogStd,
56
+ UDrawer,
57
+ UInnerLoader,
58
+ UInputAddressLookup,
59
+ UInputPhoneStd,
60
+ UInputTextStd,
61
+ UInputTypeaheadAdvanceSearch,
62
+ UMenuButtonStd,
63
+ UMenuDropdown,
64
+ UMenuDropdownAdvancedSearch,
65
+ UMenuItem,
66
+ UMenuSearch,
37
67
  UMultiSelectStd,
38
- UTabsStd,
39
- UTabBtnStd,
40
- UBannerStd,
41
- USelectStd,
68
+ UPagination,
42
69
  URadioBtn,
70
+ URadioStd,
71
+ USelectStd,
72
+ USheet,
73
+ UTabBtnStd,
43
74
  UTableStd,
75
+ UTabsStd,
76
+ UToggleStd,
77
+ UToolbar,
78
+ UTooltip,
79
+ UUploader,
44
80
  useNotify,
81
+ useOverlayLoader,
82
+ useScreenType,
45
83
  }
@@ -32,16 +32,20 @@ export const useNotify = () => {
32
32
  * it is chaing the custom icon with font awesome custom class
33
33
  * @param {*} icon
34
34
  */
35
- const handleGetCustomIcon = (icon) => {
35
+
36
+ // Adding class to Notification element to make it customizable
37
+ const handleGetCustomIcon = (icon, randomId) => {
36
38
  setTimeout(() => {
37
- const notifyContent = document.getElementsByClassName(
38
- 'q-notification__content'
39
+ let getNotificationElement = document.querySelector(
40
+ `.q-notification-elem-${randomId}`
39
41
  )
40
- const notifyCustomIcon = document.getElementById('notify-custom-icon')
41
- if (!notifyCustomIcon) {
42
- const iconEleHTML = `<i class='${icon}' aria-label='Custom Icon' id='notify-custom-icon' style='height:24px; width:24px; font-size: 24px; margin-right: 8px' alt='Custom Icon Alt'></i>`
43
- if (notifyContent.length) {
44
- notifyContent[0].insertAdjacentHTML('afterbegin', iconEleHTML)
42
+ if (getNotificationElement) {
43
+ let childElement = getNotificationElement.querySelector(
44
+ `.q-notification__wrapper .q-notification__content`
45
+ )
46
+ if (childElement.childNodes.length == 1) {
47
+ const iconEleHTML = `<i class='${icon}' aria-label='Custom Icon' style='height:24px; width:24px; font-size: 24px; margin-right: 8px' alt='Custom Icon Alt'></i>`
48
+ childElement.insertAdjacentHTML('afterbegin', iconEleHTML)
45
49
  }
46
50
  }
47
51
  }, 100)
@@ -49,24 +53,20 @@ export const useNotify = () => {
49
53
 
50
54
  const notify = (props) => {
51
55
  if (props.label && props.type) {
56
+ let randomId = Math.floor(100000 + Math.random() * 900000)
52
57
  let notifyProps = {
53
58
  type: props.type === 'accent' ? 'negative' : props.type,
54
59
  message: props.label,
55
60
  caption: props.message,
56
61
  color: props.type,
57
62
  timeout: props.timeout,
58
- classes: `u-notify u-type-${props.type}`,
63
+ classes: `u-notify u-type-${props.type} q-notification-elem-${randomId}`,
59
64
  position: props.position,
60
65
  progress: props.progress,
61
- icon: null,
66
+ icon: props.icon ? handleGetCustomIcon(props.icon, randomId) : null,
62
67
  actions: handleGetActions(props),
63
68
  }
64
- if (props.icon) {
65
- notifyProps = {
66
- ...notifyProps,
67
- icon: handleGetCustomIcon(props.icon),
68
- }
69
- }
69
+
70
70
  $q.notify(notifyProps)
71
71
  } else {
72
72
  console.error(
@@ -0,0 +1,23 @@
1
+ import { Loading, QSpinnerGears } from 'quasar'
2
+
3
+ export const useOverlayLoader = () => {
4
+
5
+ const showLoader = (props = {}) => {
6
+
7
+ Loading.show({
8
+ backgroundColor: props?.backgroundColor,
9
+ customClass: props.customClass ? props.customClass : '',
10
+ message: props?.message,
11
+ messageColor: props.messageColor ? props.messageColor: 'dark',
12
+ spinner: props.spinner ? props.spinner : QSpinnerGears,
13
+ spinnerSize: props.spinnerSize ? props.spinnerSize : '6rem',
14
+ spinnerColor: props?.spinnerColor
15
+ })
16
+ }
17
+
18
+ const hideLoader = () =>{
19
+ Loading.hide()
20
+ }
21
+
22
+ return { showLoader, hideLoader }
23
+ }