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 Table from "@/components/content/partials/Table.vue";
|
||||||
import PlaylistEditor from "@/components/content/partials/PlaylistEditor.vue";
|
import PlaylistEditor from "@/components/content/partials/PlaylistEditor.vue";
|
||||||
import ConfirmDelete from "@/components/content/partials/dialogs/ConfirmDelete.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";
|
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 { items, listData, headers, selected, loading, search, getItems, editItem, deleteItem } = blocks_page()
|
||||||
|
|
||||||
const itemEdited = ref({
|
const itemEdited = ref({
|
||||||
|
@ -18,6 +29,8 @@ const dialog = reactive({
|
||||||
text: ''
|
text: ''
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const visibleHeaders = ref(headers)
|
||||||
|
|
||||||
const openDialog = (type, title = '', text = '', bulk = false) => {
|
const openDialog = (type, title = '', text = '', bulk = false) => {
|
||||||
dialog.open = true
|
dialog.open = true
|
||||||
dialog.type = type
|
dialog.type = type
|
||||||
|
@ -67,6 +80,14 @@ const updateSearch = (text) => {
|
||||||
search.value = text
|
search.value = text
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onBeforeMount(() => {
|
||||||
|
if(props.hideColumns != undefined) {
|
||||||
|
visibleHeaders.value = headers.filter(el => {
|
||||||
|
return !props.hideColumns.includes(el.value)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
const resetItemEdited = () => {
|
const resetItemEdited = () => {
|
||||||
itemEdited.value = {
|
itemEdited.value = {
|
||||||
id: null,
|
id: null,
|
||||||
|
@ -87,7 +108,7 @@ watch(search, (newValue, oldValue) => {
|
||||||
/>
|
/>
|
||||||
<Table
|
<Table
|
||||||
v-else
|
v-else
|
||||||
:headers="headers"
|
:headers="visibleHeaders"
|
||||||
v-model:selected="selected"
|
v-model:selected="selected"
|
||||||
v-model:search="search"
|
v-model:search="search"
|
||||||
:list-data="listData"
|
:list-data="listData"
|
||||||
|
@ -96,6 +117,7 @@ watch(search, (newValue, oldValue) => {
|
||||||
:get-items="getItems"
|
:get-items="getItems"
|
||||||
:actions="true"
|
:actions="true"
|
||||||
:show-select="true"
|
:show-select="true"
|
||||||
|
:is-draggable="isDraggable"
|
||||||
@update-table="getItems"
|
@update-table="getItems"
|
||||||
@update-search="updateSearch"
|
@update-search="updateSearch"
|
||||||
@delete-item="cancel"
|
@delete-item="cancel"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue