@usssa/component-library 1.0.0-alpha.155 → 1.0.0-alpha.157
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/README.md
CHANGED
package/package.json
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
import { computed, ref, watch } from 'vue'
|
|
3
3
|
import UBtnStd from './UBtnStd.vue'
|
|
4
4
|
import UChip from './UChip.vue'
|
|
5
|
-
import UTooltip from './UTooltip.vue'
|
|
6
|
-
import USheet from './USheet.vue'
|
|
7
5
|
import UMenuItem from './UMenuItem.vue'
|
|
6
|
+
import USheet from './USheet.vue'
|
|
7
|
+
import UTooltip from './UTooltip.vue'
|
|
8
8
|
import { useScreenType } from '../../composables/useScreenType'
|
|
9
9
|
|
|
10
|
-
const emit = defineEmits(['update:modelValue'])
|
|
10
|
+
const emit = defineEmits(['update:modelValue', 'onClick'])
|
|
11
11
|
const props = defineProps({
|
|
12
12
|
caption: {
|
|
13
13
|
type: String,
|
|
@@ -54,14 +54,14 @@ const props = defineProps({
|
|
|
54
54
|
type: String,
|
|
55
55
|
required: false,
|
|
56
56
|
},
|
|
57
|
-
options: {
|
|
58
|
-
type: Array,
|
|
59
|
-
required: true,
|
|
60
|
-
},
|
|
61
57
|
optionLabel: {
|
|
62
58
|
type: String,
|
|
63
59
|
default: 'label',
|
|
64
60
|
},
|
|
61
|
+
options: {
|
|
62
|
+
type: Array,
|
|
63
|
+
required: true,
|
|
64
|
+
},
|
|
65
65
|
optionValue: {
|
|
66
66
|
type: String,
|
|
67
67
|
default: 'value',
|
|
@@ -82,6 +82,10 @@ const props = defineProps({
|
|
|
82
82
|
type: Function,
|
|
83
83
|
required: true,
|
|
84
84
|
},
|
|
85
|
+
useCustomComponent: {
|
|
86
|
+
type: Boolean,
|
|
87
|
+
default: false,
|
|
88
|
+
},
|
|
85
89
|
useInput: {
|
|
86
90
|
type: Boolean,
|
|
87
91
|
required: false,
|
|
@@ -113,14 +117,22 @@ const filterSheetOptions = (val, update) => {
|
|
|
113
117
|
)
|
|
114
118
|
})
|
|
115
119
|
}
|
|
120
|
+
|
|
116
121
|
const handleApply = () => {
|
|
117
122
|
dialogs.value[0].open = false
|
|
118
123
|
emit('update:modelValue', selectedItems.value)
|
|
119
124
|
}
|
|
125
|
+
|
|
120
126
|
const handleClick = (event) => {
|
|
121
127
|
const isSelectElement = event.target.closest('.q-field__control')
|
|
122
|
-
|
|
128
|
+
|
|
129
|
+
if(props.useCustomComponent && isSelectElement) {
|
|
130
|
+
// Emit click event for handling in parent component
|
|
131
|
+
emit('onClick')
|
|
132
|
+
}
|
|
133
|
+
if ($screen.value.isMobile && isSelectElement) {
|
|
123
134
|
event.stopPropagation()
|
|
135
|
+
|
|
124
136
|
dialogs.value = [
|
|
125
137
|
{
|
|
126
138
|
open: true,
|
|
@@ -133,12 +145,15 @@ const handleClick = (event) => {
|
|
|
133
145
|
selectedItems.value = props.modelValue
|
|
134
146
|
}
|
|
135
147
|
}
|
|
148
|
+
|
|
136
149
|
const handleClose = () => {
|
|
137
150
|
dialogs.value[0].open = false
|
|
138
151
|
selectedItems.value = props.modelValue.length ? props.modelValue : []
|
|
139
152
|
}
|
|
153
|
+
|
|
140
154
|
const handleSheetItemClick = (val) => {
|
|
141
155
|
const exists = selectedItems.value.find((item) => item.value === val.value)
|
|
156
|
+
|
|
142
157
|
if (!exists) {
|
|
143
158
|
selectedItems.value = [...selectedItems.value, val]
|
|
144
159
|
} else {
|
|
@@ -147,23 +162,28 @@ const handleSheetItemClick = (val) => {
|
|
|
147
162
|
)
|
|
148
163
|
}
|
|
149
164
|
}
|
|
165
|
+
|
|
150
166
|
const handleSheetItemRemove = (item) => {
|
|
151
167
|
selectedItems.value = selectedItems.value.filter(
|
|
152
168
|
(option) => option.value !== item.value
|
|
153
169
|
)
|
|
154
170
|
}
|
|
171
|
+
|
|
155
172
|
const handleSheetSelectionUpdate = (val) => {
|
|
156
173
|
selectedItems.value = val
|
|
157
174
|
}
|
|
175
|
+
|
|
158
176
|
const isSelected = (value) => {
|
|
159
177
|
let getItems = selectedItems.value.filter((e) => e.value === value)
|
|
160
178
|
return getItems.length ? true : false
|
|
161
179
|
}
|
|
180
|
+
|
|
162
181
|
const removeItems = (item) => {
|
|
163
182
|
selectedItems.value = selectedItems.value.filter(
|
|
164
183
|
(option) => option.value !== item.value
|
|
165
184
|
)
|
|
166
185
|
}
|
|
186
|
+
|
|
167
187
|
const updateVal = (val) => {
|
|
168
188
|
props.updateFn(val)
|
|
169
189
|
placeholderText.value = val.length ? '' : props.placeholder
|
|
@@ -269,7 +289,7 @@ watch(
|
|
|
269
289
|
<template v-slot:option="scope">
|
|
270
290
|
<q-item
|
|
271
291
|
v-bind="scope.itemProps"
|
|
272
|
-
v-if="!$screen.isMobile"
|
|
292
|
+
v-if="!$screen.isMobile && !useCustomComponent"
|
|
273
293
|
class="items-center u-custom-options"
|
|
274
294
|
>
|
|
275
295
|
<div v-if="scope.opt.icon" class="q-pr-xs">
|
|
@@ -307,7 +327,7 @@ watch(
|
|
|
307
327
|
</q-select>
|
|
308
328
|
</div>
|
|
309
329
|
<USheet
|
|
310
|
-
v-if="$screen.isMobile"
|
|
330
|
+
v-if="$screen.isMobile && !useCustomComponent"
|
|
311
331
|
v-model:dialogs="dialogs"
|
|
312
332
|
:heading="sheetHeading"
|
|
313
333
|
:heading-caption="caption"
|
|
@@ -435,7 +455,7 @@ watch(
|
|
|
435
455
|
box-shadow : 0 0 0 2px $primary-transparent
|
|
436
456
|
|
|
437
457
|
.q-field__bottom
|
|
438
|
-
padding:
|
|
458
|
+
padding: $xxs 0 0 0
|
|
439
459
|
|
|
440
460
|
.q-chip__content
|
|
441
461
|
color: $neutral-9
|
|
@@ -60,7 +60,7 @@ export const useNotify = () => {
|
|
|
60
60
|
caption: props.message,
|
|
61
61
|
color: props.type,
|
|
62
62
|
timeout: props.timeout,
|
|
63
|
-
classes: `u-notify u-type-${props.type} q-notification-elem-${randomId}`,
|
|
63
|
+
classes: `u-notify u-type-${props.type} q-notification-elem-${randomId} ${props?.altclasses}`,
|
|
64
64
|
position: props.position,
|
|
65
65
|
progress: props.progress,
|
|
66
66
|
icon: props.icon ? handleGetCustomIcon(props.icon, randomId) : null,
|