From 707d8fe3b08a3785442bc5265f0420b4771a2fcd Mon Sep 17 00:00:00 2001 From: Afiq Date: Mon, 4 Aug 2025 15:37:07 +0800 Subject: [PATCH] Enhance Component Preview and Form Builder Functionality - Updated ComponentPreview.vue to improve handling of readonly states for select, checkbox, and radio components, ensuring proper styling and interaction. - Modified button component in ComponentPreview.vue to conditionally display button text and icon based on new props for better customization. - Enhanced FormBuilderComponents.vue by adding new properties for button configuration, including showLabel, showButtonText, buttonText, and icon. - Introduced new form field settings in FormBuilderFieldSettingsModal.vue to allow users to customize button size, icon, and visibility options for labels and text. - Improved overall user experience by refining placeholder visibility in builder mode and enhancing the button action script template functionality. --- components/ComponentPreview.vue | 67 +++++-- components/FormBuilderComponents.vue | 5 + components/FormBuilderFieldSettingsModal.vue | 201 ++++++++++++++++++- 3 files changed, 244 insertions(+), 29 deletions(-) diff --git a/components/ComponentPreview.vue b/components/ComponentPreview.vue index bcbed82..a138c07 100644 --- a/components/ComponentPreview.vue +++ b/components/ComponentPreview.vue @@ -27,14 +27,20 @@ :label="component.props.label" :help="component.props.help" :placeholder="component.props.placeholder" :validation="component.props.validation" :validation-visibility="isPreview ? 'live' : 'blur'" :readonly="component.props.readonly || isPreview" - :disabled="isPreview" :options="component.props.options || undefined" :value="component.props.value || undefined" + :disabled="isPreview || (component.props.readonly && ['select', 'checkbox', 'radio'].includes(component.type))" + :options="component.props.options || undefined" :value="component.props.value || undefined" :accept="component.props.accept || undefined" :max="component.props.max || undefined" :mask="component.props.mask || undefined" :digits="component.props.digits || undefined" :multiple="component.props.multiple || undefined" :maxSize="component.props.maxSize || undefined" :maxFiles="component.props.maxFiles || undefined" :classes="component.type === 'checkbox' ? { wrapper: 'mb-1', options: 'space-y-0.5' - } : {}" :class="{ 'canvas-component': isPreview }" /> + } : {}" :class="{ + 'canvas-component': isPreview, + 'readonly-select': component.props.readonly && component.type === 'select', + 'readonly-checkbox': component.props.readonly && component.type === 'checkbox', + 'readonly-radio': component.props.readonly && component.type === 'radio' + }" />
@@ -325,14 +331,15 @@
-