2020-07-10 20:13:11 -05:00
|
|
|
<template>
|
2022-07-16 15:33:21 -05:00
|
|
|
<XColumn :menu="menu" :naked="true" :column="column" :is-stacked="isStacked" @parent-focus="$event => emit('parent-focus', $event)">
|
2022-12-20 17:39:28 -06:00
|
|
|
<template #header><i class="ti ti-apps" style="margin-right: 8px;"></i>{{ column.name }}</template>
|
2020-07-10 20:13:11 -05:00
|
|
|
|
|
|
|
<div class="wtdtxvec">
|
2022-07-04 07:28:59 -05:00
|
|
|
<div v-if="!(column.widgets && column.widgets.length > 0) && !edit" class="intro">{{ i18n.ts._deck.widgetsIntroduction }}</div>
|
2022-12-26 23:55:11 -06:00
|
|
|
<XWidgets :edit="edit" :widgets="column.widgets ?? []" @add-widget="addWidget" @remove-widget="removeWidget" @update-widget="updateWidget" @update-widgets="updateWidgets" @exit="edit = false"/>
|
2020-07-10 20:13:11 -05:00
|
|
|
</div>
|
2020-10-17 06:12:00 -05:00
|
|
|
</XColumn>
|
2020-07-10 20:13:11 -05:00
|
|
|
</template>
|
|
|
|
|
2022-03-20 13:11:14 -05:00
|
|
|
<script lang="ts" setup>
|
|
|
|
import { } from 'vue';
|
2020-07-10 20:13:11 -05:00
|
|
|
import XColumn from './column.vue';
|
2022-03-20 13:11:14 -05:00
|
|
|
import { addColumnWidget, Column, removeColumnWidget, setColumnWidgets, updateColumnWidget } from './deck-store';
|
2022-08-30 10:24:33 -05:00
|
|
|
import XWidgets from '@/components/MkWidgets.vue';
|
2022-07-04 07:28:59 -05:00
|
|
|
import { i18n } from '@/i18n';
|
2020-07-10 20:13:11 -05:00
|
|
|
|
2022-03-20 13:11:14 -05:00
|
|
|
const props = defineProps<{
|
|
|
|
column: Column;
|
|
|
|
isStacked: boolean;
|
|
|
|
}>();
|
2020-07-10 20:13:11 -05:00
|
|
|
|
2022-03-20 13:11:14 -05:00
|
|
|
const emit = defineEmits<{
|
2022-05-19 03:35:43 -05:00
|
|
|
(ev: 'parent-focus', direction: 'up' | 'down' | 'left' | 'right'): void;
|
2022-03-20 13:11:14 -05:00
|
|
|
}>();
|
2020-07-10 20:13:11 -05:00
|
|
|
|
2022-03-20 13:11:14 -05:00
|
|
|
let edit = $ref(false);
|
2020-07-10 20:13:11 -05:00
|
|
|
|
2022-03-20 13:11:14 -05:00
|
|
|
function addWidget(widget) {
|
|
|
|
addColumnWidget(props.column.id, widget);
|
|
|
|
}
|
2020-07-10 20:13:11 -05:00
|
|
|
|
2022-03-20 13:11:14 -05:00
|
|
|
function removeWidget(widget) {
|
|
|
|
removeColumnWidget(props.column.id, widget);
|
|
|
|
}
|
2020-12-18 19:55:52 -06:00
|
|
|
|
2022-03-20 13:11:14 -05:00
|
|
|
function updateWidget({ id, data }) {
|
|
|
|
updateColumnWidget(props.column.id, id, data);
|
|
|
|
}
|
2020-12-27 20:56:42 -06:00
|
|
|
|
2022-03-20 13:11:14 -05:00
|
|
|
function updateWidgets(widgets) {
|
|
|
|
setColumnWidgets(props.column.id, widgets);
|
|
|
|
}
|
2021-02-16 07:17:13 -06:00
|
|
|
|
2022-03-20 13:11:14 -05:00
|
|
|
function func() {
|
|
|
|
edit = !edit;
|
|
|
|
}
|
2022-07-16 15:33:21 -05:00
|
|
|
|
|
|
|
const menu = [{
|
2022-12-19 04:01:30 -06:00
|
|
|
icon: 'ti ti-pencil',
|
2022-07-16 15:33:21 -05:00
|
|
|
text: i18n.ts.editWidgets,
|
|
|
|
action: func,
|
|
|
|
}];
|
2020-07-10 20:13:11 -05:00
|
|
|
</script>
|
|
|
|
|
2022-12-27 03:01:06 -06:00
|
|
|
<style lang="scss">
|
2020-07-10 20:13:11 -05:00
|
|
|
.wtdtxvec {
|
2021-02-16 07:17:13 -06:00
|
|
|
--margin: 8px;
|
2021-07-27 07:37:32 -05:00
|
|
|
--panelBorder: none;
|
2020-07-10 20:13:11 -05:00
|
|
|
|
2021-02-16 07:17:13 -06:00
|
|
|
padding: 0 var(--margin);
|
2022-07-04 07:28:59 -05:00
|
|
|
|
|
|
|
> .intro {
|
|
|
|
padding: 16px;
|
|
|
|
text-align: center;
|
|
|
|
}
|
2020-07-10 20:13:11 -05:00
|
|
|
}
|
|
|
|
</style>
|