@redseed/redseed-ui-vue3 8.22.1 → 8.23.0
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
|
@@ -38,6 +38,11 @@ const props = defineProps({
|
|
|
38
38
|
type: String,
|
|
39
39
|
default: 'center',
|
|
40
40
|
validator: (value) => ['top', 'center', 'bottom'].includes(value)
|
|
41
|
+
},
|
|
42
|
+
handleSide: {
|
|
43
|
+
type: String,
|
|
44
|
+
default: 'left',
|
|
45
|
+
validator: (value) => ['left', 'right'].includes(value)
|
|
41
46
|
}
|
|
42
47
|
})
|
|
43
48
|
|
|
@@ -52,6 +57,8 @@ const cardGroupClasses = computed(() => [
|
|
|
52
57
|
'rsui-card-group--compact': props.variant === 'compact',
|
|
53
58
|
'rsui-card-group--list': props.variant === 'list',
|
|
54
59
|
'rsui-card-group--reorderable': props.reorderable,
|
|
60
|
+
'rsui-card-group--handle-left': props.reorderable && props.handleSide === 'left',
|
|
61
|
+
'rsui-card-group--handle-right': props.reorderable && props.handleSide === 'right',
|
|
55
62
|
'rsui-card-group--2xs': responsiveWidth.value['2xs'],
|
|
56
63
|
'rsui-card-group--xs': responsiveWidth.value['xs'],
|
|
57
64
|
'rsui-card-group--sm': responsiveWidth.value['sm'],
|
|
@@ -120,6 +127,7 @@ function onHandleMouseDown(e) {
|
|
|
120
127
|
const child = getCardChild(e.target)
|
|
121
128
|
if (child) {
|
|
122
129
|
child.setAttribute('draggable', 'true')
|
|
130
|
+
child.classList.add('rsui-card-group__card--grabbed')
|
|
123
131
|
}
|
|
124
132
|
}
|
|
125
133
|
|
|
@@ -127,6 +135,7 @@ function onHandleMouseUp(e) {
|
|
|
127
135
|
const child = getCardChild(e.target)
|
|
128
136
|
if (child) {
|
|
129
137
|
child.removeAttribute('draggable')
|
|
138
|
+
child.classList.remove('rsui-card-group__card--grabbed')
|
|
130
139
|
}
|
|
131
140
|
}
|
|
132
141
|
|
|
@@ -180,7 +189,7 @@ function cleanupDragState() {
|
|
|
180
189
|
const container = cardsContainerElement.value
|
|
181
190
|
if (container) {
|
|
182
191
|
Array.from(container.children).forEach(child => {
|
|
183
|
-
child.classList.remove('rsui-card-group__card--drag-over', 'rsui-card-group__card--dragging')
|
|
192
|
+
child.classList.remove('rsui-card-group__card--drag-over', 'rsui-card-group__card--dragging', 'rsui-card-group__card--grabbed')
|
|
184
193
|
child.removeAttribute('draggable')
|
|
185
194
|
})
|
|
186
195
|
}
|
|
@@ -232,7 +241,7 @@ function syncHandles() {
|
|
|
232
241
|
const hasHandle = child.querySelector('.rsui-card-group__drag-handle')
|
|
233
242
|
if (props.reorderable && !hasHandle) {
|
|
234
243
|
const handle = document.createElement('div')
|
|
235
|
-
handle.className = `rsui-card-group__drag-handle rsui-card-group__drag-handle--${props.handleAlignment}`
|
|
244
|
+
handle.className = `rsui-card-group__drag-handle rsui-card-group__drag-handle--${props.handleAlignment} rsui-card-group__drag-handle--${props.handleSide}`
|
|
236
245
|
handle.setAttribute('role', 'button')
|
|
237
246
|
handle.setAttribute('tabindex', '0')
|
|
238
247
|
handle.setAttribute('aria-label', 'Reorder')
|
|
@@ -241,7 +250,7 @@ function syncHandles() {
|
|
|
241
250
|
handle.addEventListener('keydown', onHandleKeyDown)
|
|
242
251
|
handle.appendChild(createHandleSvg())
|
|
243
252
|
child.style.position = 'relative'
|
|
244
|
-
child.
|
|
253
|
+
child.prepend(handle)
|
|
245
254
|
} else if (!props.reorderable && hasHandle) {
|
|
246
255
|
hasHandle.removeEventListener('mousedown', onHandleMouseDown)
|
|
247
256
|
hasHandle.removeEventListener('mouseup', onHandleMouseUp)
|