From 5b53c48894934a6b07be0ae1fde835d2a4029994 Mon Sep 17 00:00:00 2001 From: braks <78412429+bcakmakoglu@users.noreply.github.com> Date: Fri, 23 Sep 2022 00:29:41 +0200 Subject: [PATCH] refactor(nc-gui): use lazy load --- packages/nc-gui/components/erd/Flow.vue | 8 ++++---- .../nc-gui/components/erd/RelationEdge.vue | 2 ++ packages/nc-gui/components/erd/TableNode.vue | 12 ++++++++---- packages/nc-gui/components/erd/View.vue | 8 ++++++-- .../nc-gui/components/smartsheet/Gallery.vue | 18 ++++++++++++------ packages/nc-gui/components/smartsheet/Grid.vue | 4 ++-- .../smartsheet/toolbar/ColumnFilterMenu.vue | 1 + .../components/smartsheet/toolbar/Erd.vue | 3 ++- .../smartsheet/toolbar/ExportSubActions.vue | 1 + .../smartsheet/toolbar/MoreActions.vue | 7 ++++--- .../smartsheet/toolbar/ShareView.vue | 8 ++++++-- .../smartsheet/toolbar/ViewActions.vue | 14 +++++++------- .../components/tabs/auth/UserManagement.vue | 1 + packages/nc-gui/components/template/Editor.vue | 1 + 14 files changed, 57 insertions(+), 31 deletions(-) diff --git a/packages/nc-gui/components/erd/Flow.vue b/packages/nc-gui/components/erd/Flow.vue index 3568a486ae..0359047f0f 100644 --- a/packages/nc-gui/components/erd/Flow.vue +++ b/packages/nc-gui/components/erd/Flow.vue @@ -4,8 +4,7 @@ import { Background, Controls, VueFlow, useVueFlow } from '@braks/vue-flow' import type { ColumnType, FormulaType, LinkToAnotherRecordType, LookupType, RollupType } from 'nocodb-sdk' import { UITypes } from 'nocodb-sdk' import dagre from 'dagre' -import TableNode from './TableNode.vue' -import RelationEdge from './RelationEdge.vue' +import { onScopeDispose, watch } from '#imports' interface Props { tables: any[] @@ -200,11 +199,11 @@ watch([() => tables, () => config], init, { deep: true, flush: 'pre' }) @@ -218,6 +217,7 @@ watch([() => tables, () => config], init, { deep: true, flush: 'pre' })
{{ $t('objects.table') }}
+
{{ $t('objects.sqlVIew') }}
diff --git a/packages/nc-gui/components/erd/RelationEdge.vue b/packages/nc-gui/components/erd/RelationEdge.vue index fec3122b9d..29a050002a 100644 --- a/packages/nc-gui/components/erd/RelationEdge.vue +++ b/packages/nc-gui/components/erd/RelationEdge.vue @@ -101,6 +101,7 @@ export default { :d="edgePath" :marker-end="markerEnd" /> + + ) =>
+
) => class="w-full border-b-1 py-2 border-gray-100 keys" :class="`nc-erd-table-node-${data.table_name}-column-${col.column_name}`" > - +
@@ -93,16 +95,18 @@ const relatedColumnId = (col: Record) => type="target" :position="Position.Left" /> - + +
- - import type { LinkToAnotherRecordType, TableType } from 'nocodb-sdk' import { UITypes } from 'nocodb-sdk' +import { ref, useGlobal, useMetas, useProject, watch } from '#imports' const { table } = defineProps<{ table?: TableType }>() const { includeM2M } = useGlobal() const { tables: projectTables } = useProject() -const tables = ref([]) + const { metas, getMeta } = useMetas() +const tables = ref([]) + let isLoading = $ref(true) const showAdvancedOptions = ref(false) @@ -105,8 +108,9 @@ watch( +
- +
-import { onMounted } from '@vue/runtime-core' import { isVirtualCol } from 'nocodb-sdk' import { ActiveViewInj, @@ -14,16 +13,16 @@ import { ReadonlyInj, ReloadRowDataHookInj, ReloadViewMetaHookInj, - extractPkFromRow, computed, createEventHook, + extractPkFromRow, inject, nextTick, + onMounted, provide, ref, useUIPermission, useViewData, - watch, } from '#imports' import type { Row as RowType } from '~/lib' @@ -94,7 +93,7 @@ const attachments = (record: any): Attachment[] => { const expandForm = (row: RowType, state?: Record) => { if (!isUIAllowed('xcDatatableEditable')) return - const rowId = extractPkFromRow(row.row, meta.value.columns) + const rowId = extractPkFromRow(row.row, meta.value!.columns!) if (rowId) { router.push({ @@ -105,7 +104,7 @@ const expandForm = (row: RowType, state?: Record) => { }) } else { expandedFormRow.value = row - expandedFormRowState.value = state + expandedFormRowState.value = _state expandedFormDlg.value = true } } @@ -181,12 +180,15 @@ provide(ReloadRowDataHookInj, reloadViewDataHook)
+ + + + @@ -207,12 +210,14 @@ provide(ReloadRowDataHookInj, reloadViewDataHook)
+
+ diff --git a/packages/nc-gui/components/smartsheet/toolbar/ExportSubActions.vue b/packages/nc-gui/components/smartsheet/toolbar/ExportSubActions.vue index f73d86bcf6..00cc8554e8 100644 --- a/packages/nc-gui/components/smartsheet/toolbar/ExportSubActions.vue +++ b/packages/nc-gui/components/smartsheet/toolbar/ExportSubActions.vue @@ -100,6 +100,7 @@ const exportFile = async (exportType: ExportTypes) => { {{ $t('activity.downloadCSV') }}
+
diff --git a/packages/nc-gui/components/smartsheet/toolbar/MoreActions.vue b/packages/nc-gui/components/smartsheet/toolbar/MoreActions.vue index 1dfed6fccc..6ef6335d71 100644 --- a/packages/nc-gui/components/smartsheet/toolbar/MoreActions.vue +++ b/packages/nc-gui/components/smartsheet/toolbar/MoreActions.vue @@ -14,6 +14,7 @@ import { useI18n, useNuxtApp, useProject, + useSmartsheetStoreOrThrow, useUIPermission, } from '#imports' @@ -165,9 +166,9 @@ const exportFile = async (exportType: ExportTypes) => { - + - + { :footer="null" wrap-class-name="nc-modal-shared-view-list" > - +
diff --git a/packages/nc-gui/components/smartsheet/toolbar/ShareView.vue b/packages/nc-gui/components/smartsheet/toolbar/ShareView.vue index 84cfd8dfd2..3e76ccd682 100644 --- a/packages/nc-gui/components/smartsheet/toolbar/ShareView.vue +++ b/packages/nc-gui/components/smartsheet/toolbar/ShareView.vue @@ -144,9 +144,11 @@ watch(passwordProtected, (value) => { > @@ -154,6 +156,7 @@ watch(passwordProtected, (value) => {
{{ $t('msg.info.beforeEnablePwd') }} +
{ type="password" :placeholder="$t('placeholder.password.enter')" /> - {{ $t('placeholder.password.save') }} + + + {{ $t('placeholder.password.save') }}
diff --git a/packages/nc-gui/components/smartsheet/toolbar/ViewActions.vue b/packages/nc-gui/components/smartsheet/toolbar/ViewActions.vue index 4afba7d565..c926a5c3d7 100644 --- a/packages/nc-gui/components/smartsheet/toolbar/ViewActions.vue +++ b/packages/nc-gui/components/smartsheet/toolbar/ViewActions.vue @@ -18,7 +18,6 @@ import { LockType } from '~/lib' import MdiLockOutlineIcon from '~icons/mdi/lock-outline' import MdiAccountIcon from '~icons/mdi/account' import MdiAccountGroupIcon from '~icons/mdi/account-group' -import AcountTreeRoundedIcon from '~icons/material-symbols/account-tree-rounded' const { t } = useI18n() @@ -113,7 +112,7 @@ const { isSqlView } = useSmartsheetStoreOrThrow() > - + - + - + @@ -217,9 +216,10 @@ const { isSqlView } = useSmartsheetStoreOrThrow() {{ $t('activity.getApiSnippet') }}
+
- + {{ $t('title.erdView') }}
@@ -232,7 +232,7 @@ const { isSqlView } = useSmartsheetStoreOrThrow() - + +