Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ktreelist): fix multiple emits #2334

Merged
merged 5 commits into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/components/radio.md
Original file line number Diff line number Diff line change
Expand Up @@ -241,11 +241,11 @@ KRadio emits two events with same payload.

### change

Fired on change, returns radio [selectedVale](#selectedvalue).
Fired on change, returns radio [selectedValue](#selectedvalue).

### update:modelValue

Fired on change, returns radio [selectedVale](#selectedvalue).
Fired on change, returns radio [selectedValue](#selectedvalue).

<script setup lang="ts">
import { ref } from 'vue'
Expand Down
5 changes: 5 additions & 0 deletions src/components/KSlideout/KSlideout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ onUnmounted(() => {
padding-right: var(--kui-space-70, $kui-space-70);

.slideout-title {
align-items: center;
display: flex;
flex: 1;
font-family: var(--kui-font-family-text, $kui-font-family-text);
Expand Down Expand Up @@ -224,6 +225,10 @@ onUnmounted(() => {
:deep(> *:last-child) {
padding-bottom: var(--kui-space-70, $kui-space-70); // add padding to the last child to add some spacing before bottom of the page
}

:deep(> p) {
margin: var(--kui-space-0, $kui-space-0);
}
}
}

Expand Down
1 change: 1 addition & 0 deletions src/components/KTreeList/KTreeDraggable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<VueDraggableNext
v-bind="draggableAttrs"
class="tree-draggable"
direction="vertical"
:disabled="disableDrag"
:group="{ name: 'k-tree-list', put: !maxLevelReached }"
:level="level"
Expand Down
6 changes: 5 additions & 1 deletion src/components/KTreeList/KTreeItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
'selected': item.selected
}"
:data-testid="`tree-item-${item.id}`"
:draggable="!disabled"
draggable="false"
type="button"
@click.prevent="handleClick"
>
Expand Down Expand Up @@ -42,6 +42,10 @@ export const itemsHaveRequiredProps = (items: TreeListItem[]): boolean => {
</script>

<script lang="ts" setup>
/**
* button.tree-item has draggable="false" attribute to prevent native drag events in order to let vue-draggable-next handle dragging
*/

const props = defineProps({
item: {
type: Object as PropType<TreeListItem>,
Expand Down
3 changes: 2 additions & 1 deletion src/components/KTreeList/KTreeList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ const handleSelection = (itemToSelect: TreeListItem, list?: TreeListItem[]): voi
editList.forEach((item: TreeListItem) => {
if (item.id === itemToSelect.id) {
item.selected = true
emit('selected', itemToSelect)
} else {
item.selected = false
}
Expand All @@ -145,7 +146,6 @@ const handleSelection = (itemToSelect: TreeListItem, list?: TreeListItem[]): voi
handleSelection(itemToSelect, item.children)
}
})
emit('selected', itemToSelect)
}

const handleChangeEvent = (data: ChangeEvent): void => {
Expand Down Expand Up @@ -207,6 +207,7 @@ onMounted(() => {
// needs to stay unscoped as it's targeting specific deeply nested elements
.k-tree-list {
font-family: var(--kui-font-family-text, $kui-font-family-text);
width: 100%;

& > .tree-draggable > .tree-item-container {
&:before {
Expand Down