mirror of
https://github.com/nocodb/nocodb.git
synced 2026-05-02 18:07:51 +00:00
* fix(nc-gui): update kanban view stack ui * feat(nc-gui): add collapse all stack option * fix(nc-gui): add empty stack placeholder * fix(nc-gui): add loading state support for ncSwitch * fix(nc-gui): swap edit card and stacked by toolbar menu * fix(nc-gui): update stacked by toolbar menu * fix(nc-gui): update kanban view height * fix(nc-gui): add stack bg color * feat(nc-gui): add support to hide empty stack * fix(nc-gui): stack loader issue * fix(nc-gui): checkbox alignment in kanban view * fix(nc-gui): update stack drag handler and hide it if user does not have permission * fix(nc-gui): stack title overflow issue * fix(nc-gui): allow inline rename stack * fix(nc-gui): advance color picker tab warnings * fix(nc-gui): rename stack option issues * fix(nc-gui): small changes * fix(nc-gui): review changes * feat(nc-gui): add new stack support * fix(nc-gui): small changes * fix(nc-gui): add loading state for rename & add new stack * fix(nc-gui): reduce width of stack * fix(nc-gui): make ncSwitch placement prop optional * fix(nc-gui): some review changes * fix(nc-gui): remove only from test * fix(nc-gui): add error handling part in kanban stack update * fix(nc-gui): update localstate while updating kanban stack meta * fix(nc-gui): some review changes * fix(nc-gui): add expand all stack option * fix(nc-gui): add condition to append new stack obj * fix(nc-gui): update card field label style * fix(nc-gui): remove top & bottom padding from stack * fix(nc-gui): drag stack test update * fix(nc-gui): console warning issues * text(nc-gui): update kanban view test * fix(nc-gui): remove last added empty row from stack if it is not saved * fix(nc-gui): duplicate column insert issue on rename stack * fix(nc-gui): update field menu * fix(nc-gui): add new stack duplicate issue * feat(nc-gui): add expand record option in context menu of gallery * fix(nc-gui): delete record fail issue #3111 * fix(nc-gui): hide grouping field by default in kanban view * chore(nc-gui): lint * fix(nc-gui): ui review changes * fix(nc-gui): select option focus issue in edit state * fix(nc-gui): add bottom border for stack * fix(nc-gui): ui review changes * fix(nc-gui): update color picker btn text from select option * fix(nc-gui): delete default value stack #8212 * fix(nc-gui): stack data offset an drag card issue * chore(nc-gui): lint
97 lines
1.9 KiB
Vue
97 lines
1.9 KiB
Vue
<script lang="ts" setup>
|
|
const props = withDefaults(
|
|
defineProps<{
|
|
checked: boolean
|
|
disabled?: boolean
|
|
size?: 'default' | 'small' | 'xsmall'
|
|
placement?: 'left' | 'right'
|
|
loading?: boolean
|
|
}>(),
|
|
{
|
|
size: 'small',
|
|
placement: 'left',
|
|
loading: false,
|
|
},
|
|
)
|
|
|
|
const emit = defineEmits(['change', 'update:checked'])
|
|
|
|
const checked = useVModel(props, 'checked', emit)
|
|
|
|
const { loading } = toRefs(props)
|
|
|
|
const switchSize = computed(() => (['default', 'small'].includes(props.size) ? props.size : undefined))
|
|
|
|
const onChange = (e: boolean, updateValue = false) => {
|
|
if (loading.value) return
|
|
|
|
if (updateValue) {
|
|
checked.value = e
|
|
}
|
|
|
|
emit('change', e)
|
|
}
|
|
</script>
|
|
|
|
<template>
|
|
<span
|
|
v-if="placement === 'right' && $slots.default"
|
|
class="pr-2"
|
|
:class="{
|
|
'cursor-not-allowed': disabled,
|
|
'cursor-pointer': !disabled,
|
|
}"
|
|
@click="onChange(!checked, true)"
|
|
>
|
|
<slot />
|
|
</span>
|
|
<a-switch
|
|
v-model:checked="checked"
|
|
:disabled="disabled"
|
|
class="nc-switch"
|
|
:class="{
|
|
'size-xsmall': size === 'xsmall',
|
|
}"
|
|
:loading="loading"
|
|
v-bind="$attrs"
|
|
:size="switchSize"
|
|
@change="onChange"
|
|
>
|
|
</a-switch>
|
|
<span
|
|
v-if="placement === 'left' && $slots.default"
|
|
class="pl-2"
|
|
:class="{
|
|
'cursor-not-allowed': disabled,
|
|
'cursor-pointer': !disabled,
|
|
}"
|
|
@click="onChange(!checked, true)"
|
|
>
|
|
<slot />
|
|
</span>
|
|
</template>
|
|
|
|
<style lang="scss" scoped>
|
|
.size-xsmall {
|
|
@apply h-3.5 min-w-[26px] leading-[14px];
|
|
|
|
:deep(.ant-switch-handle) {
|
|
@apply h-[10px] w-[10px] top-[2px] left-[calc(100%_-_24px)];
|
|
}
|
|
|
|
:deep(.ant-switch-inner) {
|
|
@apply !mr-[5px] !ml-[18px] !my-0;
|
|
}
|
|
|
|
&.ant-switch-checked {
|
|
:deep(.ant-switch-handle) {
|
|
@apply left-[calc(100%_-_12px)];
|
|
}
|
|
|
|
:deep(.ant-switch-inner) {
|
|
@apply !mr-[18px] !ml-[5px];
|
|
}
|
|
}
|
|
}
|
|
</style>
|