@policystudio/policy-studio-ui-vue 1.2.0-access.64 → 1.2.0-access.66
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
|
@@ -17,6 +17,11 @@
|
|
|
17
17
|
class="psui-el-draggable-wrapper-title"
|
|
18
18
|
:class="{ 'psui-opacity-50 psui-pointer-events-none': columnGroup.disabled }"
|
|
19
19
|
draggable="true"
|
|
20
|
+
tabindex="0"
|
|
21
|
+
role="button"
|
|
22
|
+
:aria-label="`Group: ${columnGroup.title}. Use Up/Down arrows to reorder this group.`"
|
|
23
|
+
@keydown.up.prevent="moveGroup(indexColumnGroup, -1)"
|
|
24
|
+
@keydown.down.prevent="moveGroup(indexColumnGroup, 1)"
|
|
20
25
|
@dragstart="emit('drag-start-group', indexColumnGroup)"
|
|
21
26
|
@dragend="emit('drag-end-group', indexColumnGroup)"
|
|
22
27
|
@dragover="emit('drag-over-group', indexColumnGroup)"
|
|
@@ -45,6 +50,11 @@
|
|
|
45
50
|
:id="`edit-columns-column-${indexColumnGroup}-${indexColumn}`"
|
|
46
51
|
class="psui-el-draggable-item"
|
|
47
52
|
draggable="true"
|
|
53
|
+
tabindex="0"
|
|
54
|
+
role="listitem"
|
|
55
|
+
:aria-label="`Column: ${column.title}. Use Up/Down arrows to reorder within the group.`"
|
|
56
|
+
@keydown.up.prevent="moveItem(indexColumnGroup, indexColumn, -1)"
|
|
57
|
+
@keydown.down.prevent="moveItem(indexColumnGroup, indexColumn, 1)"
|
|
48
58
|
@dragstart="emit('drag-start-item', { indexColumnGroup, indexColumn }, $event)"
|
|
49
59
|
@dragover="emit('drag-over-item', { indexColumnGroup, indexColumn }, $event)"
|
|
50
60
|
@dragend="emit('drag-end-item', $event)"
|
|
@@ -87,6 +97,7 @@
|
|
|
87
97
|
</template>
|
|
88
98
|
|
|
89
99
|
<script setup>
|
|
100
|
+
import { nextTick } from 'vue'
|
|
90
101
|
|
|
91
102
|
const emit = defineEmits([
|
|
92
103
|
'drag-start-group',
|
|
@@ -98,9 +109,11 @@ const emit = defineEmits([
|
|
|
98
109
|
'column-helper',
|
|
99
110
|
'on-select-item',
|
|
100
111
|
'column-group-helper',
|
|
112
|
+
'reorder-group',
|
|
113
|
+
'reorder-item',
|
|
101
114
|
])
|
|
102
115
|
|
|
103
|
-
defineProps({
|
|
116
|
+
const props = defineProps({
|
|
104
117
|
/**
|
|
105
118
|
* It sets the data that will be used.
|
|
106
119
|
*/
|
|
@@ -124,4 +137,32 @@ defineProps({
|
|
|
124
137
|
default: false,
|
|
125
138
|
},
|
|
126
139
|
})
|
|
140
|
+
|
|
141
|
+
const moveGroup = (index, direction) => {
|
|
142
|
+
const targetIndex = index + direction
|
|
143
|
+
const groups = props.getColumns.columnGroups
|
|
144
|
+
|
|
145
|
+
if (targetIndex >= 0 && targetIndex < groups.length) {
|
|
146
|
+
emit('reorder-group', { from: index, to: targetIndex })
|
|
147
|
+
|
|
148
|
+
nextTick(() => {
|
|
149
|
+
const el = document.querySelector(`#edit-group-${targetIndex} .psui-el-draggable-wrapper-title`)
|
|
150
|
+
el?.focus()
|
|
151
|
+
})
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
const moveItem = (groupIndex, itemIndex, direction) => {
|
|
156
|
+
const columns = props.getColumns.columnGroups[groupIndex].columns
|
|
157
|
+
const targetIndex = itemIndex + direction
|
|
158
|
+
|
|
159
|
+
if (targetIndex >= 0 && targetIndex < columns.length) {
|
|
160
|
+
emit('reorder-item', { groupIndex, from: itemIndex, to: targetIndex })
|
|
161
|
+
|
|
162
|
+
nextTick(() => {
|
|
163
|
+
const el = document.getElementById(`edit-columns-column-${groupIndex}-${targetIndex}`)
|
|
164
|
+
el?.focus()
|
|
165
|
+
})
|
|
166
|
+
}
|
|
167
|
+
}
|
|
127
168
|
</script>
|
|
@@ -101,7 +101,7 @@ const getComponentClass = computed(() => {
|
|
|
101
101
|
})
|
|
102
102
|
|
|
103
103
|
const selectedId = computed(() => {
|
|
104
|
-
return
|
|
104
|
+
return props.label ? props.label.toLowerCase().replace(/\s+/g, '-') : `select-${Math.random().toString(36).substr(2, 9)}`
|
|
105
105
|
})
|
|
106
106
|
|
|
107
107
|
const childValue = computed({
|