From 2562ebbc74ff74125ca647cf8122a6c086373be5 Mon Sep 17 00:00:00 2001 From: Afiq Date: Fri, 8 Aug 2025 11:33:58 +0800 Subject: [PATCH] Enhance Icon Selection and External URL Handling in Form Builder Components - Updated FormBuilderFieldSettingsModal.vue and sideMenuNested.vue to replace text input for icon selection with an IconBrowser component, improving user experience for selecting Material Design icons. - Enhanced CustomActionButton.vue to differentiate between internal and external URLs when navigating, ensuring proper handling of external links. - Modified settings.local.json to include additional WebFetch commands for improved documentation access during development. --- .claude/settings.local.json | 5 +- components/CustomActionButton.vue | 13 +- components/FormBuilderFieldSettingsModal.vue | 61 ++- components/IconBrowser.vue | 459 +++++++++++++++++++ components/draggable/sideMenuNested.vue | 19 +- 5 files changed, 519 insertions(+), 38 deletions(-) create mode 100644 components/IconBrowser.vue diff --git a/.claude/settings.local.json b/.claude/settings.local.json index f734005..b53fbcf 100644 --- a/.claude/settings.local.json +++ b/.claude/settings.local.json @@ -5,7 +5,10 @@ "Bash(yarn dev:*)", "Bash(yarn lint:*)", "Bash(yarn build:*)", - "Bash(npx eslint:*)" + "Bash(npx eslint:*)", + "WebFetch(domain:docs.iconify.design)", + "WebFetch(domain:iconify.design)", + "WebFetch(domain:api.iconify.design)" ], "deny": [] } diff --git a/components/CustomActionButton.vue b/components/CustomActionButton.vue index 2ca5b34..697632e 100644 --- a/components/CustomActionButton.vue +++ b/components/CustomActionButton.vue @@ -140,12 +140,23 @@ const handleClick = async (event) => { // Handle navigation based on target type const openInNewTab = props.action.target === '_blank' || props.action.openInNewTab; + // Check if URL is external (has protocol or starts with //) + const isExternalUrl = (url) => { + return /^https?:\/\//.test(url) || /^\/\//.test(url) || !url.startsWith('/'); + }; + if (openInNewTab) { window.open(finalUrl, '_blank', 'noopener,noreferrer'); } else { // Use navigateTo for SPA navigation if available, otherwise use window.location if (typeof navigateTo === 'function') { - await navigateTo(finalUrl); + if (isExternalUrl(finalUrl)) { + // For external URLs, use navigateTo with external: true option + await navigateTo(finalUrl, { external: true }); + } else { + // For internal URLs, use regular navigateTo + await navigateTo(finalUrl); + } } else { window.location.href = finalUrl; } diff --git a/components/FormBuilderFieldSettingsModal.vue b/components/FormBuilderFieldSettingsModal.vue index ecfe8f0..f3d5210 100644 --- a/components/FormBuilderFieldSettingsModal.vue +++ b/components/FormBuilderFieldSettingsModal.vue @@ -598,15 +598,18 @@ :classes="{ outer: 'field-wrapper' }" /> - +
+ + +
+ Icon displayed on the button +
+
@@ -1328,14 +1331,20 @@ if (name && email) { :classes="{ outer: 'field-wrapper' }" /> - +
+ + +
+ Leave empty for automatic icon based on button style +
+
- +
+ + +
@@ -3076,6 +3086,7 @@ if (this.element.querySelector('.file-upload')) { + + \ No newline at end of file diff --git a/components/draggable/sideMenuNested.vue b/components/draggable/sideMenuNested.vue index 0596c5b..0137da9 100644 --- a/components/draggable/sideMenuNested.vue +++ b/components/draggable/sideMenuNested.vue @@ -1,5 +1,6 @@