diff --git a/packages/nc-gui/components/extensions/Extension.vue b/packages/nc-gui/components/extensions/Extension.vue index d3ef120816..43cfd630eb 100644 --- a/packages/nc-gui/components/extensions/Extension.vue +++ b/packages/nc-gui/components/extensions/Extension.vue @@ -6,15 +6,7 @@ interface Prop { const { extensionId, error } = defineProps() -const { - extensionList, - extensionsLoaded, - availableExtensions, - eventBus, - getExtensionAssetsUrl, - duplicateExtension, - showExtensionDetails, -} = useExtensions() +const { extensionList, extensionsLoaded, availableExtensions, eventBus } = useExtensions() const isLoadedExtension = ref(false) @@ -40,28 +32,8 @@ const extensionManifest = computed(() => { const { fullscreen, collapsed } = useProvideExtensionHelper(extension, extensionManifest, activeError) -const titleInput = ref(null) - -const titleEditMode = ref(false) - -const tempTitle = ref(extension.value.title) - const { height } = useElementSize(extensionRef) -const enableEditMode = () => { - titleEditMode.value = true - tempTitle.value = extension.value.title - nextTick(() => { - titleInput.value?.focus() - titleInput.value?.select() - }) -} - -const updateExtensionTitle = async () => { - await extension.value.setTitle(tempTitle.value) - titleEditMode.value = false -} - const component = ref(null) const extensionHeight = computed(() => { @@ -85,12 +57,6 @@ const fullscreenModalMaxWidth = computed(() => { : modalMaxWidth.lg }) -const expandExtension = () => { - if (!collapsed.value) return - - collapsed.value = false -} - // close fullscreen on clicking extensionModalRef directly const closeFullscreen = (e: MouseEvent) => { if (e.target === extensionModalRef.value) { @@ -98,15 +64,6 @@ const closeFullscreen = (e: MouseEvent) => { } } -const handleDuplicateExtension = async (id: string, open: boolean = false) => { - const duplicatedExt = await duplicateExtension(id) - - if (duplicatedExt?.id && open) { - fullscreen.value = false - eventBus.emit(ExtensionsEvents.DUPLICATE, duplicatedExt.id) - } -} - onMounted(() => { until(extensionsLoaded) .toMatch((v) => v) @@ -225,7 +182,7 @@ eventBus.on((event, payload) => {
diff --git a/packages/nc-gui/components/extensions/Extension/Header.vue b/packages/nc-gui/components/extensions/Extension/Header.vue index 05d1c5f66c..22e34d0cb8 100644 --- a/packages/nc-gui/components/extensions/Extension/Header.vue +++ b/packages/nc-gui/components/extensions/Extension/Header.vue @@ -16,7 +16,7 @@ withDefaults(defineProps(), { const { eventBus, getExtensionAssetsUrl, duplicateExtension, showExtensionDetails } = useExtensions() -const { fullscreen, collapsed, extension, extensionManifest, activeError } = useExtensionHelperOrThrow() +const { fullscreen, collapsed, extension, extensionManifest, activeError, showExpandBtn } = useExtensionHelperOrThrow() const titleInput = ref(null) @@ -24,6 +24,10 @@ const titleEditMode = ref(false) const tempTitle = ref(extension.value.title) +const showExpandButton = computed(() => { + return showExpandBtn.value && !activeError.value +}) + const enableEditMode = () => { titleEditMode.value = true tempTitle.value = extension.value.title @@ -82,13 +86,22 @@ const handleDuplicateExtension = async (id: string, open: boolean = false) => { :src="getExtensionAssetsUrl(extensionManifest.iconUrl)" alt="icon" class="h-8 w-8 object-contain flex-none" + :class="{ + 'mx-1': !isFullscreen, + }" /> -
+
{ @clear-data="extension.clear()" @delete="extension.delete()" /> + - + + +
diff --git a/packages/nc-gui/components/extensions/Extension/Wrapper.vue b/packages/nc-gui/components/extensions/Extension/Wrapper.vue index d859a8430a..0d40b5e691 100644 --- a/packages/nc-gui/components/extensions/Extension/Wrapper.vue +++ b/packages/nc-gui/components/extensions/Extension/Wrapper.vue @@ -7,8 +7,8 @@ const { height } = useElementSize(headerRef)