@policystudio/policy-studio-ui-vue 1.2.0-access.63 → 1.2.0-access.65
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)"
|
|
@@ -60,6 +70,7 @@
|
|
|
60
70
|
:disabled="column.isDisabled"
|
|
61
71
|
class="psui-el-draggable-item-checkbox"
|
|
62
72
|
@change="emit('on-select-item', { studyKey: getColumns.key, indexColumnGroup, indexColumn, columnGroupKey: columnGroup.key })"
|
|
73
|
+
@keydown.enter.native="emit('on-select-item', { studyKey: getColumns.key, indexColumnGroup, indexColumn, columnGroupKey: columnGroup.key })"
|
|
63
74
|
/>
|
|
64
75
|
<PsIcon
|
|
65
76
|
class="psui-el-draggable-item-title-icon"
|
|
@@ -86,6 +97,7 @@
|
|
|
86
97
|
</template>
|
|
87
98
|
|
|
88
99
|
<script setup>
|
|
100
|
+
import { nextTick } from 'vue'
|
|
89
101
|
|
|
90
102
|
const emit = defineEmits([
|
|
91
103
|
'drag-start-group',
|
|
@@ -97,9 +109,11 @@ const emit = defineEmits([
|
|
|
97
109
|
'column-helper',
|
|
98
110
|
'on-select-item',
|
|
99
111
|
'column-group-helper',
|
|
112
|
+
'reorder-group',
|
|
113
|
+
'reorder-item',
|
|
100
114
|
])
|
|
101
115
|
|
|
102
|
-
defineProps({
|
|
116
|
+
const props = defineProps({
|
|
103
117
|
/**
|
|
104
118
|
* It sets the data that will be used.
|
|
105
119
|
*/
|
|
@@ -123,4 +137,32 @@ defineProps({
|
|
|
123
137
|
default: false,
|
|
124
138
|
},
|
|
125
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
|
+
}
|
|
126
168
|
</script>
|