@redseed/redseed-ui-vue3 8.23.0 → 8.24.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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { ref, computed, onMounted,
|
|
2
|
+
import { ref, computed, onMounted, onBeforeUnmount, watch } from 'vue'
|
|
3
3
|
import Empty from '../Empty/Empty.vue'
|
|
4
4
|
import Pagination from '../Pagination/Pagination.vue'
|
|
5
5
|
import { useResponsiveWidth } from '../../helpers'
|
|
@@ -82,6 +82,8 @@ const emit = defineEmits([
|
|
|
82
82
|
|
|
83
83
|
// Drag and drop
|
|
84
84
|
const dragFromIndex = ref(null)
|
|
85
|
+
let dragOverChild = null
|
|
86
|
+
let childObserver = null
|
|
85
87
|
|
|
86
88
|
function createHandleSvg() {
|
|
87
89
|
const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg')
|
|
@@ -153,14 +155,15 @@ function onDragOver(e) {
|
|
|
153
155
|
if (!props.reorderable || dragFromIndex.value === null) return
|
|
154
156
|
e.preventDefault()
|
|
155
157
|
e.dataTransfer.dropEffect = 'move'
|
|
156
|
-
const
|
|
158
|
+
const child = getCardChild(e.target)
|
|
159
|
+
const index = child ? Array.from(cardsContainerElement.value.children).indexOf(child) : -1
|
|
157
160
|
if (index === -1 || index === dragFromIndex.value) return
|
|
158
161
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
162
|
+
if (dragOverChild && dragOverChild !== child) {
|
|
163
|
+
dragOverChild.classList.remove('rsui-card-group__card--drag-over')
|
|
164
|
+
}
|
|
165
|
+
child.classList.add('rsui-card-group__card--drag-over')
|
|
166
|
+
dragOverChild = child
|
|
164
167
|
}
|
|
165
168
|
|
|
166
169
|
function onDragLeave(e) {
|
|
@@ -194,6 +197,7 @@ function cleanupDragState() {
|
|
|
194
197
|
})
|
|
195
198
|
}
|
|
196
199
|
dragFromIndex.value = null
|
|
200
|
+
dragOverChild = null
|
|
197
201
|
}
|
|
198
202
|
|
|
199
203
|
function onHandleKeyDown(e) {
|
|
@@ -275,9 +279,41 @@ function cleanupHandles() {
|
|
|
275
279
|
})
|
|
276
280
|
}
|
|
277
281
|
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
282
|
+
function startObserver() {
|
|
283
|
+
const container = cardsContainerElement.value
|
|
284
|
+
if (!container || childObserver) return
|
|
285
|
+
childObserver = new MutationObserver(syncHandles)
|
|
286
|
+
childObserver.observe(container, { childList: true })
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
function stopObserver() {
|
|
290
|
+
if (childObserver) {
|
|
291
|
+
childObserver.disconnect()
|
|
292
|
+
childObserver = null
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
onMounted(() => {
|
|
297
|
+
if (props.reorderable) {
|
|
298
|
+
syncHandles()
|
|
299
|
+
startObserver()
|
|
300
|
+
}
|
|
301
|
+
})
|
|
302
|
+
|
|
303
|
+
watch(() => props.reorderable, (val) => {
|
|
304
|
+
if (val) {
|
|
305
|
+
syncHandles()
|
|
306
|
+
startObserver()
|
|
307
|
+
} else {
|
|
308
|
+
cleanupHandles()
|
|
309
|
+
stopObserver()
|
|
310
|
+
}
|
|
311
|
+
})
|
|
312
|
+
|
|
313
|
+
onBeforeUnmount(() => {
|
|
314
|
+
cleanupHandles()
|
|
315
|
+
stopObserver()
|
|
316
|
+
})
|
|
281
317
|
|
|
282
318
|
const pageUpdated = (event) => {
|
|
283
319
|
emit('pageUpdated', event)
|
|
@@ -1,12 +1,27 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
+
import { computed } from 'vue'
|
|
2
3
|
import Image from './Image.vue'
|
|
3
4
|
|
|
4
5
|
defineOptions({
|
|
5
6
|
inheritAttrs: false,
|
|
6
7
|
})
|
|
8
|
+
|
|
9
|
+
const props = defineProps({
|
|
10
|
+
lg: {
|
|
11
|
+
type: Boolean,
|
|
12
|
+
default: false,
|
|
13
|
+
},
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
const imageCircleClass = computed(() => [
|
|
17
|
+
'rsui-image-circle',
|
|
18
|
+
{
|
|
19
|
+
'rsui-image-circle--lg': props.lg,
|
|
20
|
+
},
|
|
21
|
+
])
|
|
7
22
|
</script>
|
|
8
23
|
<template>
|
|
9
|
-
<div class="
|
|
24
|
+
<div :class="imageCircleClass">
|
|
10
25
|
<Image v-bind="$attrs">
|
|
11
26
|
<template v-for="(_, name) in $slots"
|
|
12
27
|
v-slot:[name]="slotProps"
|
|
@@ -1,12 +1,26 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { ref } from 'vue'
|
|
2
|
+
import { ref, computed } from 'vue'
|
|
3
3
|
import Modal from '../Modal/Modal.vue'
|
|
4
4
|
import ButtonTertiary from '../Button/ButtonTertiary.vue'
|
|
5
5
|
|
|
6
|
+
const props = defineProps({
|
|
7
|
+
profile: {
|
|
8
|
+
type: Boolean,
|
|
9
|
+
default: false,
|
|
10
|
+
},
|
|
11
|
+
})
|
|
12
|
+
|
|
6
13
|
const showMetaModal = ref(false)
|
|
14
|
+
|
|
15
|
+
const pageHeaderClass = computed(() => [
|
|
16
|
+
'rsui-page-header',
|
|
17
|
+
{
|
|
18
|
+
'rsui-page-header--profile': props.profile,
|
|
19
|
+
},
|
|
20
|
+
])
|
|
7
21
|
</script>
|
|
8
22
|
<template>
|
|
9
|
-
<div class="
|
|
23
|
+
<div :class="pageHeaderClass">
|
|
10
24
|
<div class="rsui-page-header__top">
|
|
11
25
|
<div v-if="$slots.title" class="rsui-page-header__title">
|
|
12
26
|
<div v-if="$slots.avatar" class="rsui-page-header__avatar">
|