-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: for route state prefer events over v-model (#3416)
In #1966 a watcher has been added to sync boolean query search params. This watcher caused some issues in nested routes due to a race condition as described in #3409. The reason for the watcher (from #1966) >Whilst I'd prefer not use two way binding models we have some components that we use that uses these as required values, such as KInputSwitch Turns out that the components `KSelect` and `KCheckBox` now support the `@change` events. When used alongside the `:model-value` we have our getter and setter separated. This means that we can remove the additional watcher. From #3409 > 4. I had to keep the watcher with the booleans only for the case of KInputSwitch. --------- Signed-off-by: schogges <[email protected]>
- Loading branch information
Showing
14 changed files
with
69 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# x-checkbox |
23 changes: 23 additions & 0 deletions
23
packages/kuma-gui/src/app/x/components/x-checkbox/XCheckbox.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<template> | ||
<KCheckbox | ||
:model-value="props.checked" | ||
> | ||
<template | ||
v-for="(_, slotName) in slots" | ||
:key="slotName" | ||
#[slotName]="slotProps" | ||
> | ||
<slot | ||
:name="slotName" | ||
v-bind="(slotProps)" | ||
/> | ||
</template> | ||
</KCheckbox> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { KCheckbox } from '@kong/kongponents' | ||
const props = defineProps<{ checked?: boolean }>() | ||
const slots = defineSlots() | ||
</script> |
1 change: 1 addition & 0 deletions
1
packages/kuma-gui/src/app/x/components/x-input-switch/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# x-input-switch |
23 changes: 23 additions & 0 deletions
23
packages/kuma-gui/src/app/x/components/x-input-switch/XInputSwitch.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<template> | ||
<KInputSwitch | ||
:model-value="props.checked" | ||
> | ||
<template | ||
v-for="(_, slotName) in slots" | ||
:key="slotName" | ||
#[slotName]="slotProps" | ||
> | ||
<slot | ||
:name="slotName" | ||
v-bind="(slotProps)" | ||
/> | ||
</template> | ||
</KInputSwitch> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { KInputSwitch } from '@kong/kongponents' | ||
const props = defineProps<{ checked?: boolean }>() | ||
const slots = defineSlots() | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters