feat(fe smart blocks): added support to smat block table in sources panel
This commit is contained in:
parent
711476e4f7
commit
ba33381d46
1 changed files with 24 additions and 2 deletions
|
@ -2,9 +2,20 @@
|
|||
import Table from "@/components/content/partials/Table.vue";
|
||||
import PlaylistEditor from "@/components/content/partials/PlaylistEditor.vue";
|
||||
import ConfirmDelete from "@/components/content/partials/dialogs/ConfirmDelete.vue";
|
||||
import {reactive, ref, watch} from "vue";
|
||||
import {onBeforeMount, reactive, ref, watch} from "vue";
|
||||
import {blocks_page} from "@/composables/content/blocks_page.ts";
|
||||
|
||||
const props = defineProps({
|
||||
hideColumns: {
|
||||
type: Array,
|
||||
required: false
|
||||
},
|
||||
isDraggable: {
|
||||
type: Boolean,
|
||||
required: false
|
||||
}
|
||||
});
|
||||
|
||||
const { items, listData, headers, selected, loading, search, getItems, editItem, deleteItem } = blocks_page()
|
||||
|
||||
const itemEdited = ref({
|
||||
|
@ -18,6 +29,8 @@ const dialog = reactive({
|
|||
text: ''
|
||||
})
|
||||
|
||||
const visibleHeaders = ref(headers)
|
||||
|
||||
const openDialog = (type, title = '', text = '', bulk = false) => {
|
||||
dialog.open = true
|
||||
dialog.type = type
|
||||
|
@ -67,6 +80,14 @@ const updateSearch = (text) => {
|
|||
search.value = text
|
||||
}
|
||||
|
||||
onBeforeMount(() => {
|
||||
if(props.hideColumns != undefined) {
|
||||
visibleHeaders.value = headers.filter(el => {
|
||||
return !props.hideColumns.includes(el.value)
|
||||
});
|
||||
}
|
||||
})
|
||||
|
||||
const resetItemEdited = () => {
|
||||
itemEdited.value = {
|
||||
id: null,
|
||||
|
@ -87,7 +108,7 @@ watch(search, (newValue, oldValue) => {
|
|||
/>
|
||||
<Table
|
||||
v-else
|
||||
:headers="headers"
|
||||
:headers="visibleHeaders"
|
||||
v-model:selected="selected"
|
||||
v-model:search="search"
|
||||
:list-data="listData"
|
||||
|
@ -96,6 +117,7 @@ watch(search, (newValue, oldValue) => {
|
|||
:get-items="getItems"
|
||||
:actions="true"
|
||||
:show-select="true"
|
||||
:is-draggable="isDraggable"
|
||||
@update-table="getItems"
|
||||
@update-search="updateSearch"
|
||||
@delete-item="cancel"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue