forked from verdnatura/salix-front
feat(VnTable): add selected funcitionality
This commit is contained in:
parent
22f42ca7f9
commit
6d12c0f00c
|
@ -59,6 +59,10 @@ const $props = defineProps({
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
|
hasSubtoolbar: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const stateStore = useStateStore();
|
const stateStore = useStateStore();
|
||||||
|
@ -177,9 +181,12 @@ function columnName(col) {
|
||||||
function getColAlign(col) {
|
function getColAlign(col) {
|
||||||
return 'text-' + (col.align ?? 'left');
|
return 'text-' + (col.align ?? 'left');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const emit = defineEmits(['onFetch', 'update:selected', 'saveChanges']);
|
||||||
defineExpose({
|
defineExpose({
|
||||||
reload,
|
reload,
|
||||||
redirect: redirectFn,
|
redirect: redirectFn,
|
||||||
|
selected,
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
|
@ -225,11 +232,18 @@ defineExpose({
|
||||||
:search-url="searchUrl"
|
:search-url="searchUrl"
|
||||||
:disable-infinite-scroll="mode == TABLE_MODE"
|
:disable-infinite-scroll="mode == TABLE_MODE"
|
||||||
@save-changes="reload"
|
@save-changes="reload"
|
||||||
:has-subtoolbar="isEditable"
|
:has-subtoolbar="$attrs['hasSubtoolbar'] ?? isEditable"
|
||||||
>
|
>
|
||||||
|
<template
|
||||||
|
v-for="(_, slotName) in $slots"
|
||||||
|
#[slotName]="slotData"
|
||||||
|
:key="slotName"
|
||||||
|
>
|
||||||
|
<slot :name="slotName" v-bind="slotData ?? {}" :key="slotName" />
|
||||||
|
</template>
|
||||||
<template #body="{ rows }">
|
<template #body="{ rows }">
|
||||||
<QTable
|
<QTable
|
||||||
v-bind="$attrs['QTable']"
|
v-bind="$attrs['q-table']"
|
||||||
class="vnTable"
|
class="vnTable"
|
||||||
:columns="splittedColumns.columns"
|
:columns="splittedColumns.columns"
|
||||||
:rows="rows"
|
:rows="rows"
|
||||||
|
@ -246,6 +260,7 @@ defineExpose({
|
||||||
CrudModelRef.vnPaginateRef.paginate()
|
CrudModelRef.vnPaginateRef.paginate()
|
||||||
"
|
"
|
||||||
@row-click="(_, row) => rowClickFunction(row)"
|
@row-click="(_, row) => rowClickFunction(row)"
|
||||||
|
@update:selected="emit('update:selected', $event)"
|
||||||
>
|
>
|
||||||
<template #top-left>
|
<template #top-left>
|
||||||
<slot name="top-left"></slot>
|
<slot name="top-left"></slot>
|
||||||
|
@ -485,6 +500,7 @@ defineExpose({
|
||||||
default="input"
|
default="input"
|
||||||
v-model="data[column.name]"
|
v-model="data[column.name]"
|
||||||
:show-label="true"
|
:show-label="true"
|
||||||
|
component-prop="columnCreate"
|
||||||
/>
|
/>
|
||||||
<slot name="more-create-dialog" :data="data" />
|
<slot name="more-create-dialog" :data="data" />
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue