2020-07-11 10:13:11 +09:00
|
|
|
<template>
|
2022-07-17 05:33:21 +09:00
|
|
|
<XColumn :menu="menu" :column="column" :is-stacked="isStacked" @parent-focus="$event => emit('parent-focus', $event)">
|
2020-07-11 10:13:11 +09:00
|
|
|
<template #header>
|
2022-12-19 19:01:30 +09:00
|
|
|
<i class="ti ti-list"></i><span style="margin-left: 8px;">{{ column.name }}</span>
|
2020-07-11 10:13:11 +09:00
|
|
|
</template>
|
|
|
|
|
2022-03-21 03:11:14 +09:00
|
|
|
<XTimeline v-if="column.listId" ref="timeline" src="list" :list="column.listId" @after="() => emit('loaded')"/>
|
2020-10-17 20:12:00 +09:00
|
|
|
</XColumn>
|
2020-07-11 10:13:11 +09:00
|
|
|
</template>
|
|
|
|
|
2022-03-21 03:11:14 +09:00
|
|
|
<script lang="ts" setup>
|
2022-07-10 19:47:29 +09:00
|
|
|
import { } from 'vue';
|
2020-07-11 10:13:11 +09:00
|
|
|
import XColumn from './column.vue';
|
2022-07-17 05:33:21 +09:00
|
|
|
import { updateColumn, Column } from './deck-store';
|
2022-08-31 00:24:33 +09:00
|
|
|
import XTimeline from '@/components/MkTimeline.vue';
|
2021-11-12 02:02:25 +09:00
|
|
|
import * as os from '@/os';
|
2022-03-21 03:11:14 +09:00
|
|
|
import { i18n } from '@/i18n';
|
2020-07-11 10:13:11 +09:00
|
|
|
|
2022-03-21 03:11:14 +09:00
|
|
|
const props = defineProps<{
|
|
|
|
column: Column;
|
|
|
|
isStacked: boolean;
|
|
|
|
}>();
|
2020-07-11 10:13:11 +09:00
|
|
|
|
2022-03-21 03:11:14 +09:00
|
|
|
const emit = defineEmits<{
|
2022-05-19 17:35:43 +09:00
|
|
|
(ev: 'loaded'): void;
|
|
|
|
(ev: 'parent-focus', direction: 'up' | 'down' | 'left' | 'right'): void;
|
2022-03-21 03:11:14 +09:00
|
|
|
}>();
|
2020-07-11 10:13:11 +09:00
|
|
|
|
2022-03-21 03:11:14 +09:00
|
|
|
let timeline = $ref<InstanceType<typeof XTimeline>>();
|
2020-07-11 10:13:11 +09:00
|
|
|
|
2022-03-21 03:11:14 +09:00
|
|
|
if (props.column.listId == null) {
|
|
|
|
setList();
|
|
|
|
}
|
2020-07-11 10:13:11 +09:00
|
|
|
|
2022-03-21 03:11:14 +09:00
|
|
|
async function setList() {
|
|
|
|
const lists = await os.api('users/lists/list');
|
|
|
|
const { canceled, result: list } = await os.select({
|
|
|
|
title: i18n.ts.selectList,
|
|
|
|
items: lists.map(x => ({
|
2022-07-17 05:33:21 +09:00
|
|
|
value: x, text: x.name,
|
2022-03-21 03:11:14 +09:00
|
|
|
})),
|
2022-07-17 05:33:21 +09:00
|
|
|
default: props.column.listId,
|
2022-03-21 03:11:14 +09:00
|
|
|
});
|
|
|
|
if (canceled) return;
|
|
|
|
updateColumn(props.column.id, {
|
2022-07-17 05:33:21 +09:00
|
|
|
listId: list.id,
|
2022-03-21 03:11:14 +09:00
|
|
|
});
|
|
|
|
}
|
2020-07-11 10:13:11 +09:00
|
|
|
|
2022-07-17 05:33:21 +09:00
|
|
|
const menu = [{
|
2022-12-19 19:01:30 +09:00
|
|
|
icon: 'ti ti-pencil',
|
2022-07-17 05:33:21 +09:00
|
|
|
text: i18n.ts.selectList,
|
|
|
|
action: setList,
|
|
|
|
}];
|
2020-07-11 10:13:11 +09:00
|
|
|
</script>
|
|
|
|
|
2022-12-27 18:29:39 +09:00
|
|
|
<style lang="scss" scoped>
|
2020-07-11 10:13:11 +09:00
|
|
|
</style>
|