@usssa/component-library 1.0.0-alpha.179 → 1.0.0-alpha.180
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.
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@ import { computed, onMounted, onUnmounted, ref, useSlots, watch } from 'vue'
|
|
|
4
4
|
import { useScreenType } from '../../composables/useScreenType'
|
|
5
5
|
import UBtnStd from './UBtnStd.vue'
|
|
6
6
|
|
|
7
|
-
const emit = defineEmits(['onBackIconClick', 'hideDialog'])
|
|
7
|
+
const emit = defineEmits(['onBackIconClick', 'hideDialog', 'handleCloseIconClick'])
|
|
8
8
|
const model = defineModel()
|
|
9
9
|
const props = defineProps({
|
|
10
10
|
closeIcon: String,
|
|
@@ -57,25 +57,25 @@ const headerClass = computed(() => {
|
|
|
57
57
|
|
|
58
58
|
const isDesktop = computed(() => $screen.value.isDesktop)
|
|
59
59
|
const isMobile = computed(() => $screen.value.isMobile)
|
|
60
|
+
const isTablet = computed(() => $screen.value.isTablet)
|
|
60
61
|
const isSmallWidthDevices = computed(() => $q.screen.width < 400)
|
|
61
62
|
const isWidthChanging = computed(() => {
|
|
62
63
|
return {
|
|
63
64
|
width: $q.screen.width,
|
|
64
65
|
}
|
|
65
66
|
})
|
|
66
|
-
const smallDevices = computed(() => {
|
|
67
|
-
return {
|
|
68
|
-
sm: $q.screen.height < 800 && $q.screen.height > 700,
|
|
69
|
-
xs: $q.screen.height < 700,
|
|
70
|
-
}
|
|
71
|
-
})
|
|
72
|
-
const isTablet = computed(() => $screen.value.isTablet)
|
|
73
67
|
const slotsLength = computed(
|
|
74
68
|
() =>
|
|
75
69
|
Object.keys($slots).filter(
|
|
76
70
|
(slot) => !['content', 'secondary_row'].includes(slot)
|
|
77
71
|
).length
|
|
78
72
|
)
|
|
73
|
+
const smallDevices = computed(() => {
|
|
74
|
+
return {
|
|
75
|
+
sm: $q.screen.height < 800 && $q.screen.height > 700,
|
|
76
|
+
xs: $q.screen.height < 700,
|
|
77
|
+
}
|
|
78
|
+
})
|
|
79
79
|
|
|
80
80
|
const getActionsWrapperFlex = () => {
|
|
81
81
|
if (isMobile.value) {
|
|
@@ -133,6 +133,11 @@ const handleBackClick = () => {
|
|
|
133
133
|
return emit('onBackIconClick')
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
+
const handleCloseIconClick = () => {
|
|
137
|
+
dialogRef.value.hide()
|
|
138
|
+
emit('handleCloseIconClick')
|
|
139
|
+
}
|
|
140
|
+
|
|
136
141
|
const hasSlots = () => {
|
|
137
142
|
return (!!$slots['action_secondary_one'] ||
|
|
138
143
|
!!$slots['action_secondary_two']) &&
|
|
@@ -189,6 +194,10 @@ const onTouchStart = (event) => {
|
|
|
189
194
|
window.addEventListener('touchend', onDragEnd)
|
|
190
195
|
}
|
|
191
196
|
|
|
197
|
+
onMounted(() => {
|
|
198
|
+
getDialogHeaderheight()
|
|
199
|
+
})
|
|
200
|
+
|
|
192
201
|
onUnmounted(() => {
|
|
193
202
|
window.removeEventListener('mousemove', onDragMove)
|
|
194
203
|
window.removeEventListener('mouseup', onDragEnd)
|
|
@@ -196,10 +205,6 @@ onUnmounted(() => {
|
|
|
196
205
|
window.removeEventListener('touchend', onDragEnd)
|
|
197
206
|
})
|
|
198
207
|
|
|
199
|
-
onMounted(() => {
|
|
200
|
-
getDialogHeaderheight()
|
|
201
|
-
})
|
|
202
|
-
|
|
203
208
|
watch(
|
|
204
209
|
isWidthChanging,
|
|
205
210
|
() => {
|
|
@@ -296,7 +301,7 @@ watch(
|
|
|
296
301
|
:aria-label="closeIconLabel"
|
|
297
302
|
:flat="true"
|
|
298
303
|
tabindex="0"
|
|
299
|
-
@click="
|
|
304
|
+
@click="handleCloseIconClick()"
|
|
300
305
|
>
|
|
301
306
|
<q-icon
|
|
302
307
|
v-if="closeIcon"
|
|
@@ -26,6 +26,10 @@ const props = defineProps({
|
|
|
26
26
|
type: String,
|
|
27
27
|
default: 'Drag and drop your file or select choose file.',
|
|
28
28
|
},
|
|
29
|
+
disableActions: {
|
|
30
|
+
type: Boolean,
|
|
31
|
+
default: false,
|
|
32
|
+
},
|
|
29
33
|
editIconLabel: {
|
|
30
34
|
type: String,
|
|
31
35
|
default: 'Edit File Name',
|
|
@@ -83,9 +87,9 @@ const $q = useQuasar()
|
|
|
83
87
|
|
|
84
88
|
const fileDisplayName = ref([])
|
|
85
89
|
const isEditing = ref([])
|
|
86
|
-
const
|
|
87
|
-
|
|
90
|
+
const isFileUploaded= ref(false)
|
|
88
91
|
const isSmallWidthDevices = computed(() => $q.screen.width < 350)
|
|
92
|
+
const uploaderRef = ref(null)
|
|
89
93
|
|
|
90
94
|
const cancelEdit = (payload) => {
|
|
91
95
|
const { index, file } = payload
|
|
@@ -114,12 +118,14 @@ const OnFileUploaded = ({ files, xhr }) => {
|
|
|
114
118
|
files.forEach((file, index) => {
|
|
115
119
|
files[index]['uploaded_date'] = new Date()
|
|
116
120
|
})
|
|
121
|
+
isFileUploaded.value = true
|
|
117
122
|
}
|
|
118
123
|
|
|
119
124
|
const removeFile = (payload) => {
|
|
120
125
|
const { scope, file } = payload
|
|
121
126
|
fileDisplayName.value.splice(file['__key'], 1)
|
|
122
127
|
scope.removeFile(file)
|
|
128
|
+
isFileUploaded.value = false
|
|
123
129
|
}
|
|
124
130
|
|
|
125
131
|
const updateFileName = (payload) => {
|
|
@@ -151,7 +157,7 @@ defineExpose({ upload })
|
|
|
151
157
|
@uploaded="OnFileUploaded"
|
|
152
158
|
>
|
|
153
159
|
<template v-slot:header="scope">
|
|
154
|
-
<div v-if="scope.canAddFiles" class="q-py-md q-px-xl bg-neutral-2">
|
|
160
|
+
<div v-if="scope.canAddFiles && (multiple || !isFileUploaded)" class="q-py-md q-px-xl bg-neutral-2 uploader-content">
|
|
155
161
|
<div class="text-center">
|
|
156
162
|
<img
|
|
157
163
|
alt="Upload Files"
|
|
@@ -164,6 +170,7 @@ defineExpose({ upload })
|
|
|
164
170
|
<div class="list-items row">
|
|
165
171
|
<UBtnStd
|
|
166
172
|
class="q-mt-md"
|
|
173
|
+
:aria-label="selectFileBtnLabel"
|
|
167
174
|
color="primary"
|
|
168
175
|
dataTestId="select-file-btn"
|
|
169
176
|
:disable="selectFileBtnDisable"
|
|
@@ -246,6 +253,7 @@ defineExpose({ upload })
|
|
|
246
253
|
<q-icon
|
|
247
254
|
class="icon-close fa-kit-duotone fa-circle-xmark"
|
|
248
255
|
:aria-label="removeIconLabel"
|
|
256
|
+
:disabled="disableActions"
|
|
249
257
|
size="sm"
|
|
250
258
|
tabindex="0"
|
|
251
259
|
@click="removeFile({ scope, file, index })"
|
|
@@ -299,6 +307,7 @@ defineExpose({ upload })
|
|
|
299
307
|
<q-icon
|
|
300
308
|
class="icon-close fa-kit-duotone fa-circle-xmark"
|
|
301
309
|
:aria-label="removeIconLabel"
|
|
310
|
+
:disabled="disableActions"
|
|
302
311
|
size="sm"
|
|
303
312
|
tabindex="0"
|
|
304
313
|
@click="removeFile({ scope, file, index })"
|
|
@@ -375,6 +384,7 @@ defineExpose({ upload })
|
|
|
375
384
|
iconClass="fa-kit-duotone fa-pen-to-square"
|
|
376
385
|
:aria-label="editIconLabel"
|
|
377
386
|
color="primary"
|
|
387
|
+
:disabled="disableActions"
|
|
378
388
|
size="md"
|
|
379
389
|
tabindex="0"
|
|
380
390
|
@click="editFileName(index)"
|
|
@@ -384,6 +394,7 @@ defineExpose({ upload })
|
|
|
384
394
|
iconClass="fa-kit-duotone fa-trash-can"
|
|
385
395
|
:aria-label="removeIconLabel"
|
|
386
396
|
color="accent"
|
|
397
|
+
:disabled="disableActions"
|
|
387
398
|
size="md"
|
|
388
399
|
tabindex="0"
|
|
389
400
|
@click="removeFile({ scope, file, index })"
|
|
@@ -413,6 +424,7 @@ defineExpose({ upload })
|
|
|
413
424
|
<UBtnStd
|
|
414
425
|
:aria-label="editIconLabel"
|
|
415
426
|
color="primary"
|
|
427
|
+
:disable="disableActions"
|
|
416
428
|
flat
|
|
417
429
|
:full-width="true"
|
|
418
430
|
label="Edit"
|
|
@@ -477,6 +489,7 @@ defineExpose({ upload })
|
|
|
477
489
|
.q-uploader
|
|
478
490
|
width: auto !important
|
|
479
491
|
max-height: unset !important
|
|
492
|
+
box-shadow: none
|
|
480
493
|
.q-uploader__list
|
|
481
494
|
background: $neutral-2
|
|
482
495
|
.uploader-list
|
|
@@ -502,11 +515,13 @@ defineExpose({ upload })
|
|
|
502
515
|
font-size:$md
|
|
503
516
|
.q-uploader__header
|
|
504
517
|
padding: 0 !important
|
|
518
|
+
border-radius: $xs
|
|
505
519
|
background-color: $neutral-2
|
|
506
520
|
.text-body-md
|
|
507
521
|
color: $dark !important
|
|
508
522
|
.q-uploader__list
|
|
509
523
|
min-height: auto !important
|
|
524
|
+
border-radius: $xs
|
|
510
525
|
padding:0
|
|
511
526
|
.q-uploader__overlay
|
|
512
527
|
display: none !important
|
|
@@ -532,4 +547,6 @@ defineExpose({ upload })
|
|
|
532
547
|
width: 6.5rem
|
|
533
548
|
overflow: hidden
|
|
534
549
|
text-overflow: ellipsis
|
|
550
|
+
.uploader-content
|
|
551
|
+
border-radius: $xs
|
|
535
552
|
</style>
|