diff --git a/packages/nc-gui/components.d.ts b/packages/nc-gui/components.d.ts index 70144a9a06..5ae4fa0235 100644 --- a/packages/nc-gui/components.d.ts +++ b/packages/nc-gui/components.d.ts @@ -49,6 +49,7 @@ declare module '@vue/runtime-core' { AModal: typeof import('ant-design-vue/es')['Modal'] APagination: typeof import('ant-design-vue/es')['Pagination'] APopover: typeof import('ant-design-vue/es')['Popover'] + AProgress: typeof import('ant-design-vue/es')['Progress'] ARadio: typeof import('ant-design-vue/es')['Radio'] ARadioGroup: typeof import('ant-design-vue/es')['RadioGroup'] ARate: typeof import('ant-design-vue/es')['Rate'] diff --git a/packages/nc-gui/components/cell/Percent.vue b/packages/nc-gui/components/cell/Percent.vue index 29c2efe3f9..516ddfe294 100644 --- a/packages/nc-gui/components/cell/Percent.vue +++ b/packages/nc-gui/components/cell/Percent.vue @@ -12,6 +12,8 @@ const emits = defineEmits(['update:modelValue']) const { showNull } = useGlobal() +const column = inject(ColumnInj)! + const editEnabled = inject(EditModeInj) const isEditColumn = inject(EditColumnInj, ref(false)) @@ -32,26 +34,73 @@ const vModel = computed({ const isExpandedFormOpen = inject(IsExpandedFormOpenInj, ref(false))! const focus: VNodeRef = (el) => !isExpandedFormOpen.value && !isEditColumn.value && (el as HTMLInputElement)?.focus() + +const cellFocused = ref(false) + +const expandedEditEnabled = ref(false) + +const percentMeta = computed(() => { + return { + is_progress: false, + ...parseProp(column.value?.meta), + } +}) + +const onBlur = () => { + if (editEnabled) { + editEnabled.value = false + } + cellFocused.value = false + expandedEditEnabled.value = false +} + +const onFocus = () => { + cellFocused.value = true +} + +const onMouseover = () => { + expandedEditEnabled.value = true +} + +const onMouseleave = () => { + if (!cellFocused.value) { + expandedEditEnabled.value = false + } +} diff --git a/packages/nc-gui/components/smartsheet/column/EditOrAdd.vue b/packages/nc-gui/components/smartsheet/column/EditOrAdd.vue index 67cf1abd6c..7f29e09e79 100644 --- a/packages/nc-gui/components/smartsheet/column/EditOrAdd.vue +++ b/packages/nc-gui/components/smartsheet/column/EditOrAdd.vue @@ -312,6 +312,7 @@ if (props.fromTableExplorer) { v-model:value="formState" /> + - diff --git a/packages/nc-gui/components/smartsheet/column/PercentOptionsLegacy.vue b/packages/nc-gui/components/smartsheet/column/PercentOptionsLegacy.vue new file mode 100644 index 0000000000..f296ba5bba --- /dev/null +++ b/packages/nc-gui/components/smartsheet/column/PercentOptionsLegacy.vue @@ -0,0 +1,47 @@ + + + + + diff --git a/packages/nc-gui/lang/ja.json b/packages/nc-gui/lang/ja.json index 75597557f4..0d74ad76f9 100644 --- a/packages/nc-gui/lang/ja.json +++ b/packages/nc-gui/lang/ja.json @@ -1,10 +1,10 @@ { "dashboards": { - "create_new_dashboard_project": "Create New Interface", - "connect_data_sources": "Connect data sources", - "alert": "Alert", - "alert-message": "No databases have been connected. Connect database bases to build interfaces. Skip this step and add databases from the base home page later.", - "select_database_projects_that_you_want_to_link_to_this_dashboard_projects": "Select Database Bases that you want to link to this Interface.", + "create_new_dashboard_project": "インターフェースを作成", + "connect_data_sources": "データソースに接続", + "alert": "アラート", + "alert-message": "データベースが接続されていません。DBベースを接続してインターフェースを構成してください。スキップして後でベースのホームページを追加することもできます。", + "select_database_projects_that_you_want_to_link_to_this_dashboard_projects": "このインターフェースに接続するDBベースを選択します。", "create_interface": "Create interface", "project_name": "Base Name", "connect": "Connect", diff --git a/packages/nocodb/src/controllers/attachments-secure.controller.ts b/packages/nocodb/src/controllers/attachments-secure.controller.ts index e19b300077..5d7145307e 100644 --- a/packages/nocodb/src/controllers/attachments-secure.controller.ts +++ b/packages/nocodb/src/controllers/attachments-secure.controller.ts @@ -75,7 +75,11 @@ export class AttachmentsSecureController { path: path.join('nc', 'uploads', fpath), }); - res.sendFile(file.path); + if (this.attachmentsService.previewAvailable(file.type)) { + res.sendFile(file.path); + } else { + res.download(file.path); + } } catch (e) { res.status(404).send('Not found'); } diff --git a/packages/nocodb/src/controllers/attachments.controller.ts b/packages/nocodb/src/controllers/attachments.controller.ts index 00a471e1e5..353e840eb7 100644 --- a/packages/nocodb/src/controllers/attachments.controller.ts +++ b/packages/nocodb/src/controllers/attachments.controller.ts @@ -68,7 +68,11 @@ export class AttachmentsController { path: path.join('nc', 'uploads', filename), }); - res.sendFile(file.path); + if (this.attachmentsService.previewAvailable(file.type)) { + res.sendFile(file.path); + } else { + res.download(file.path); + } } catch (e) { res.status(404).send('Not found'); } @@ -94,7 +98,11 @@ export class AttachmentsController { ), }); - res.sendFile(file.path); + if (this.attachmentsService.previewAvailable(file.type)) { + res.sendFile(file.path); + } else { + res.download(file.path); + } } catch (e) { res.status(404).send('Not found'); } @@ -109,7 +117,11 @@ export class AttachmentsController { path: path.join('nc', 'uploads', fpath), }); - res.sendFile(file.path); + if (this.attachmentsService.previewAvailable(file.type)) { + res.sendFile(file.path); + } else { + res.download(file.path); + } } catch (e) { res.status(404).send('Not found'); } diff --git a/packages/nocodb/src/services/attachments.service.ts b/packages/nocodb/src/services/attachments.service.ts index ead5f4c4bb..ff6ba485ea 100644 --- a/packages/nocodb/src/services/attachments.service.ts +++ b/packages/nocodb/src/services/attachments.service.ts @@ -161,6 +161,14 @@ export class AttachmentsService { return { path: filePath, type }; } + previewAvailable(mimetype: string) { + const available = ['image', 'pdf', 'text/plain']; + if (available.some((type) => mimetype.includes(type))) { + return true; + } + return false; + } + sanitizeUrlPath(paths) { return paths.map((url) => url.replace(/[/.?#]+/g, '_')); } diff --git a/packages/nocodb/src/strategies/authtoken.strategy/authtoken.strategy.ts b/packages/nocodb/src/strategies/authtoken.strategy/authtoken.strategy.ts index f666ac1b10..83c4fd48cc 100644 --- a/packages/nocodb/src/strategies/authtoken.strategy/authtoken.strategy.ts +++ b/packages/nocodb/src/strategies/authtoken.strategy/authtoken.strategy.ts @@ -31,7 +31,7 @@ export class AuthTokenStrategy extends PassportStrategy(Strategy, 'authtoken') { const dbUser: Record = await User.getWithRoles( apiToken.fk_user_id, { - baseId: req['ncBaseId'], + baseId: req['ncProjectId'], ...(req['ncWorkspaceId'] ? { workspaceId: req['ncWorkspaceId'] } : {}),