Skip to content

Commit 398f2c8

Browse files
committed
feat(desk): column type checkbox
1 parent 90a78f8 commit 398f2c8

File tree

8 files changed

+58
-20
lines changed

8 files changed

+58
-20
lines changed

packages/core/entities/column.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@ export enum ColumnType {
44
text = 'text',
55
number = 'number',
66
select = 'select',
7-
relation = 'relation',
7+
link = 'link',
8+
date = 'date',
9+
checkbox = 'checkbox',
810
script = 'script',
11+
relation = 'relation',
912
entry = 'entry',
1013
createdAt = 'createdAt',
1114
updatedAt = 'updatedAt',
12-
link = 'link',
13-
date = 'date',
1415
}
1516

1617
export default class Column {

packages/desktop/i18n/en-US.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ export default {
9191
pasteEntity: 'Paste {0}',
9292
image: 'Image | Images',
9393
sideBySide: 'Side by side',
94+
checkbox: 'Checkbox',
9495
errors: {
9596
unknown: 'Unknown error',
9697
workspaceNotFound: '@:workspace not found: {0}',

packages/desktop/modules/collection-column/components/CcColumn.vue

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ const icons: Record<Column['type'], any> = {
9191
updatedAt: 'fa-regular fa-calendar',
9292
link: 'link',
9393
date: 'fa-regular fa-calendar',
94+
checkbox: 'fa-regular fa-square-check',
9495
}
9596
9697
// dialog
@@ -146,12 +147,14 @@ const relation = computed(() => {
146147
<v-dialog v-else v-model="dialog">
147148
<template #activator="{ attrs }">
148149
<div
149-
class="cursor-pointer text-t-secondary text-sm flex items-center overflow-hidden"
150+
class="cursor-pointer text-t-secondary flex items-center overflow-hidden"
150151
v-bind="{ ...attrs, ...$attrs }"
151152
>
152-
<fa-icon :icon="icons[column.type] || 'font'" class="mr-2 text-xs" />
153+
<v-icon :name="icons[column.type] || 'font'" class="mr-3" />
153154

154-
{{ column.label }}
155+
<div class="text-sm">
156+
{{ column.label }}
157+
</div>
155158
</div>
156159
</template>
157160

packages/desktop/modules/collection/components/CTable.vue

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ async function create() {
214214

215215
<v-resize-line
216216
:model-value="c.width || 200"
217-
:min-width="100"
217+
:min-width="50"
218218
@update:model-value="(v) => resizeColumn(c.id, v)"
219219
/>
220220
</template>
@@ -283,16 +283,6 @@ async function create() {
283283
color="none"
284284
flat
285285
/>
286-
287-
<v-btn
288-
v-if="cIndex === 1"
289-
size="sm"
290-
color="b-secondary"
291-
class="absolute right-2 top-2 opacity-0 group-hover/item:opacity-100"
292-
:to="`/collections/${collectionId}/items/${data.item.id}`"
293-
>
294-
<v-icon name="eye" />
295-
</v-btn>
296286
</v-td>
297287
</v-tr>
298288
</template>

packages/desktop/modules/item/components/IValue.vue

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@ import { createBindings } from '@/composables/binding'
1212
const IValueText = defineAsyncComponent(() => import('./IValueText.vue'))
1313
const IValueNumber = defineAsyncComponent(() => import('./IValueNumber.vue'))
1414
const IValueSelect = defineAsyncComponent(() => import('./IValueSelect.vue'))
15+
const IValueDate = defineAsyncComponent(() => import('./IValueDate.vue'))
16+
const IValueCheckbox = defineAsyncComponent(() => import('./IValueCheckbox.vue'))
17+
1518
const IValueRelation = defineAsyncComponent(() => import('./IValueRelation.vue'))
1619
const IValueLink = defineAsyncComponent(() => import('./IValueLink.vue'))
17-
const IValueDate = defineAsyncComponent(() => import('./IValueDate.vue'))
1820
const IValueScript = defineAsyncComponent(() => import('./IValueScript.vue'))
1921
const IValueEntry = defineAsyncComponent(() => import('./IValueEntry.vue'))
2022
const IValueTimestamp = defineAsyncComponent(() => import('./IValueTimestamp.vue'))
@@ -117,6 +119,14 @@ const bindings = createBindings(attrs, ['input', 'select'])
117119
v-bind="bindings.multiple(['root', 'input'])"
118120
/>
119121

122+
<i-value-checkbox
123+
v-else-if="type === ColumnType.checkbox"
124+
:collection-id="collectionId"
125+
:item-id="itemId"
126+
:column-id="columnId"
127+
v-bind="bindings.multiple(['root'])"
128+
/>
129+
120130
<i-value-timestamp
121131
v-else-if="type === ColumnType.createdAt || type === ColumnType.updatedAt"
122132
:collection-id="collectionId"
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<script setup lang="ts">
2+
import { createValue } from '@/modules/item/composables/value'
3+
import { ref } from 'vue'
4+
5+
const props = defineProps({
6+
collectionId: {
7+
type: String,
8+
required: true,
9+
},
10+
columnId: {
11+
type: String,
12+
required: true,
13+
},
14+
itemId: {
15+
type: String,
16+
required: true,
17+
},
18+
})
19+
20+
const { payload, save, onLoaded } = createValue({
21+
collectionId: props.collectionId,
22+
columnId: props.columnId,
23+
itemId: props.itemId,
24+
})
25+
26+
await new Promise<void>((resolve) => onLoaded(resolve))
27+
</script>
28+
29+
<template>
30+
<v-checkbox v-model="payload" autofocus @update:model-value="save" />
31+
</template>

packages/desktop/modules/item/pages/IList.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ watch(
3030
)
3131
3232
// set meta
33-
const meta = useMeta({ title: collection.value?.name ?? 'collection' })
33+
const meta = useMeta()
3434
3535
function load() {
3636
meta.value.title = collection.value?.name ?? props.collectionId

packages/desktop/modules/layout/components/LToolbar.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { onKeyStroke } from '@vueuse/core'
99
import { useStore } from '@/modules/menu/store'
1010
import { useToggleDrawer } from '../composables/drawer'
1111
import DirectoryEntry from '@/../core/entities/directory-entry'
12+
import { useMeta } from '@/composables/metas'
1213
1314
const route = useRoute()
1415
const router = useRouter()
@@ -78,12 +79,13 @@ watch(
7879
// add page to menu
7980
8081
const store = useStore()
82+
const meta = useMeta()
8183
8284
const menu = ref({
8385
item: computed(() => store.menu.find((i) => i.to === route.path)),
8486
async create() {
8587
await store.create({
86-
label: document.title,
88+
label: meta.value.title ?? document.title,
8789
to: route.path,
8890
children: [],
8991
id: uuid(),

0 commit comments

Comments
 (0)