Browse Source

feat(nc-gui): use tree to display supported mime types

pull/4931/head
Wing-Kam Wong 2 years ago
parent
commit
d266ee3606
  1. 38
      packages/nc-gui/components/smartsheet/column/AttachmentOptions.vue

38
packages/nc-gui/components/smartsheet/column/AttachmentOptions.vue

@ -32,17 +32,16 @@ vModel.value.meta = {
maxNumberOfAttachments: Math.max(1, +appInfo.value.ncMaxAttachmentsAllowed || 50) || 50, maxNumberOfAttachments: Math.max(1, +appInfo.value.ncMaxAttachmentsAllowed || 50) || 50,
// Maximum File Size per file // Maximum File Size per file
maxAttachmentSize: Math.max(1, +appInfo.value.ncMaxAttachmentsAllowed || 20) || 20, maxAttachmentSize: Math.max(1, +appInfo.value.ncMaxAttachmentsAllowed || 20) || 20,
unsupportedAttachmentMimeTypes: [], supportedAttachmentMimeTypes: ['application', 'audio', 'image', 'video', 'misc'],
}), }),
...vModel.value.meta, ...vModel.value.meta,
} }
// the selected keys in the a-transfer
const selectedKeys = ref<string[]>([])
const filterOption = (val: string, option: Option) => { const filterOption = (val: string, option: Option) => {
return option.title.includes(val) return option.title.includes(val)
} }
const expandedKeys = ref<string[]>([])
</script> </script>
<template> <template>
@ -59,23 +58,20 @@ const filterOption = (val: string, option: Option) => {
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="24"> <a-col class="mt-4" :span="24">
<a-form-item v-bind="validateInfos['meta.unsupportedAttachmentMimeTypes']" label="Mime Types"> <a-form-item v-bind="validateInfos['meta.supportedAttachmentMimeTypes']" label="Allowed Mime Types">
<a-transfer <a-tree
v-model:target-keys="vModel.meta.unsupportedAttachmentMimeTypes" v-model:expandedKeys="expandedKeys"
v-model:selected-keys="selectedKeys" v-model:checkedKeys="vModel.meta.supportedAttachmentMimeTypes"
class="nc-attachment-transfer" checkable
show-search :height="250"
:list-style="{ :tree-data="fileMimeTypes"
width: '220px', class="!bg-gray-50 !py-[10px] !my-[10px] border-2"
height: '300px', >
}" <template #title="{ title, key }">
:filter-option="filterOption" {{ title }}
:data-source="fileMimeTypes.map((o) => ({ key: o, title: o }))" </template>
:render="(item) => item.title" </a-tree>
:titles="['allowed', 'not allowed']"
:locale="{ itemUnit: 'type ', itemsUnit: 'types ' }"
/>
</a-form-item> </a-form-item>
</a-col> </a-col>
</a-row> </a-row>

Loading…
Cancel
Save