diff --git a/resources/js/app.js b/resources/js/app.js index f982e62..6ab82ac 100644 --- a/resources/js/app.js +++ b/resources/js/app.js @@ -22,7 +22,7 @@ registerComponents(app) configureCompat({ // default everything to Vue 2 behavior MODE: 2, - GLOBAL_MOUNT: false, + // GLOBAL_MOUNT: false, COMPONENT_V_MODEL: false, INSTANCE_SET: false, INSTANCE_DELETE: false diff --git a/resources/js/components/forms/CheckboxInput.vue b/resources/js/components/forms/CheckboxInput.vue index b960b03..9059a43 100644 --- a/resources/js/components/forms/CheckboxInput.vue +++ b/resources/js/components/forms/CheckboxInput.vue @@ -1,34 +1,56 @@ diff --git a/resources/js/components/forms/CodeInput.vue b/resources/js/components/forms/CodeInput.vue index 169730e..eeb2ff3 100644 --- a/resources/js/components/forms/CodeInput.vue +++ b/resources/js/components/forms/CodeInput.vue @@ -1,13 +1,18 @@ diff --git a/resources/js/components/forms/ColorInput.vue b/resources/js/components/forms/ColorInput.vue index c263259..5af367b 100644 --- a/resources/js/components/forms/ColorInput.vue +++ b/resources/js/components/forms/ColorInput.vue @@ -1,25 +1,50 @@ diff --git a/resources/js/components/forms/DateInput.vue b/resources/js/components/forms/DateInput.vue index af52223..bfccfdb 100644 --- a/resources/js/components/forms/DateInput.vue +++ b/resources/js/components/forms/DateInput.vue @@ -7,32 +7,35 @@ * - +
-
-

From

- -

To

- +

From

+ +

To

+
- + @@ -53,13 +56,13 @@ export default { }, data: () => ({ - fixedClasses: fixedClasses, + fixedClasses: null, fromDate: null, toDate: null }), computed: { - inputClasses (){ + inputClasses() { let str = 'border border-gray-300 dark:bg-notion-dark-light dark:border-gray-600 dark:placeholder-gray-500 dark:text-gray-300 flex-1 focus:border-transparent focus:outline-none focus:ring-2 focus:ring-opacity-100 placeholder-gray-400 px-4 py-2 rounded-lg shadow-sm text-base text-black text-gray-700' str += this.dateRange ? ' w-50' : ' w-full' str += this.disabled ? ' !cursor-not-allowed !bg-gray-200' : '' @@ -68,13 +71,13 @@ export default { useTime() { return this.withTime && !this.dateRange }, - setMinDate () { + setMinDate() { if (this.disablePastDates) { return new Date().toISOString().split('T')[0] } return false }, - setMaxDate () { + setMaxDate() { if (this.disableFutureDates) { return new Date().toISOString().split('T')[0] } @@ -91,12 +94,12 @@ export default { }, fromDate: { handler(val) { - if(this.dateRange){ - if(!Array.isArray(this.compVal)){ + if (this.dateRange) { + if (!Array.isArray(this.compVal)) { this.compVal = []; } this.compVal[0] = this.dateToUTC(val) - }else{ + } else { this.compVal = this.dateToUTC(val) } }, @@ -104,12 +107,12 @@ export default { }, toDate: { handler(val) { - if(this.dateRange){ - if(!Array.isArray(this.compVal)){ + if (this.dateRange) { + if (!Array.isArray(this.compVal)) { this.compVal = [null]; } this.compVal[1] = this.dateToUTC(val) - }else{ + } else { this.compVal = null } }, @@ -118,16 +121,16 @@ export default { }, mounted() { - if(this.compVal){ - if(Array.isArray(this.compVal)){ + if (this.compVal) { + if (Array.isArray(this.compVal)) { this.fromDate = this.compVal[0] ?? null this.toDate = this.compVal[1] ?? null - }else{ + } else { this.fromDate = this.dateToLocal(this.compVal) } } - fixedClasses.input = this.theme.default.input + this.fixedClasses.input = this.theme.default.input this.setInputColor() }, @@ -147,26 +150,26 @@ export default { dateInput.style.setProperty('--tw-ring-color', this.color) } }, - dateToUTC(val){ - if(!val){ + dateToUTC(val) { + if (!val) { return null } - if(!this.useTime){ + if (!this.useTime) { return val } return new Date(val).toISOString() }, - dateToLocal(val){ - if(!val){ + dateToLocal(val) { + if (!val) { return null } const dateObj = new Date(val) let dateStr = dateObj.getFullYear() + '-' + - String(dateObj.getMonth() + 1).padStart(2, '0') + '-' + - String(dateObj.getDate()).padStart(2, '0') - if(this.useTime){ + String(dateObj.getMonth() + 1).padStart(2, '0') + '-' + + String(dateObj.getDate()).padStart(2, '0') + if (this.useTime) { dateStr += 'T' + String(dateObj.getHours()).padStart(2, '0') + ':' + - String(dateObj.getMinutes()).padStart(2, '0'); + String(dateObj.getMinutes()).padStart(2, '0'); } return dateStr } diff --git a/resources/js/components/forms/TextInput.vue b/resources/js/components/forms/TextInput.vue index 295671f..6c92fe2 100644 --- a/resources/js/components/forms/TextInput.vue +++ b/resources/js/components/forms/TextInput.vue @@ -5,9 +5,6 @@ - - - - - - - - - - - - + - diff --git a/resources/js/components/forms/components/VSwitch.vue b/resources/js/components/forms/components/VSwitch.vue index f35fb05..ce906f3 100644 --- a/resources/js/components/forms/components/VSwitch.vue +++ b/resources/js/components/forms/components/VSwitch.vue @@ -17,7 +17,6 @@ const emit = defineEmits(['update:modelValue']) const onClick = () => { if (disabled) return - console.log('ok emiting', !modelValue) emit('update:modelValue', !modelValue) } diff --git a/resources/js/components/forms/index.js b/resources/js/components/forms/index.js index ac17d1f..6dc03df 100644 --- a/resources/js/components/forms/index.js +++ b/resources/js/components/forms/index.js @@ -34,7 +34,7 @@ export function registerComponents (app) { FlatSelectInput, ToggleSwitchInput ].forEach(Component => { - app.component(Component.name, Component) + Component.name ? app.component(Component.name, Component) : app.component(Component.name, Component) }) // Register async components diff --git a/resources/js/components/forms/useFormInput.js b/resources/js/components/forms/useFormInput.js index 2067314..7640746 100644 --- a/resources/js/components/forms/useFormInput.js +++ b/resources/js/components/forms/useFormInput.js @@ -11,6 +11,7 @@ export const inputProps = { disabled: { type: Boolean, default: false }, placeholder: { type: String, default: null }, uppercaseLabels: { type: Boolean, default: false }, + hideFieldName: { type: Boolean, default: false }, help: { type: String, default: null }, helpPosition: { type: String, default: 'below_input' }, theme: { type: Object, default: () => themes.default }, @@ -32,7 +33,7 @@ export function useFormInput (props, context, formPrefixKey = null) { }) const hasError = computed(() => { - return hasValidation && props.form?.errors.has(name) + return hasValidation && props.form?.errors?.has(name) }) const compVal = computed({ diff --git a/resources/js/components/open/forms/fields/FormBlockOptionsModal.vue b/resources/js/components/open/forms/fields/FormBlockOptionsModal.vue index fc77759..494b3b0 100644 --- a/resources/js/components/open/forms/fields/FormBlockOptionsModal.vue +++ b/resources/js/components/open/forms/fields/FormBlockOptionsModal.vue @@ -36,7 +36,7 @@

Hidden diff --git a/resources/js/components/open/forms/fields/FormFieldOptionsModal.vue b/resources/js/components/open/forms/fields/FormFieldOptionsModal.vue index 25c3f0d..f0226f5 100644 --- a/resources/js/components/open/forms/fields/FormFieldOptionsModal.vue +++ b/resources/js/components/open/forms/fields/FormFieldOptionsModal.vue @@ -47,19 +47,19 @@

Hidden Required Disabled @@ -105,7 +105,7 @@ Number Options Rating @@ -142,7 +142,7 @@ Date Range @@ -151,7 +151,7 @@

Date with time @@ -166,7 +166,7 @@ /> Prefill with 'today' @@ -176,14 +176,14 @@ Disable past dates Disable future dates @@ -203,12 +203,12 @@ @input="onFieldOptionsChange" /> Allow respondent to create new options Always show all select options @@ -241,7 +241,7 @@ Pre-filled value @@ -327,7 +327,7 @@ Generates a unique id on submission @@ -337,7 +337,7 @@ Generates an auto-incremented id on submission diff --git a/resources/js/components/open/forms/fields/components/BlockOptions.vue b/resources/js/components/open/forms/fields/components/BlockOptions.vue index dea1725..da9cb90 100644 --- a/resources/js/components/open/forms/fields/components/BlockOptions.vue +++ b/resources/js/components/open/forms/fields/components/BlockOptions.vue @@ -10,7 +10,7 @@

Hidden diff --git a/resources/js/components/open/forms/fields/components/FieldOptions.vue b/resources/js/components/open/forms/fields/components/FieldOptions.vue index c1c9ac3..aec5617 100644 --- a/resources/js/components/open/forms/fields/components/FieldOptions.vue +++ b/resources/js/components/open/forms/fields/components/FieldOptions.vue @@ -10,19 +10,19 @@

Hidden Required Disabled @@ -68,7 +68,7 @@ Number Options Rating @@ -92,7 +92,7 @@

Multi-lines input @@ -105,7 +105,7 @@ Date Range @@ -114,7 +114,7 @@

Date with time @@ -129,7 +129,7 @@ /> Prefill with 'today' @@ -139,14 +139,14 @@ Disable past dates Disable future dates @@ -166,12 +166,12 @@ @input="onFieldOptionsChange" /> Allow respondent to create new options Always show all select options @@ -243,7 +243,7 @@ Pre-filled value @@ -270,7 +270,6 @@
@@ -314,7 +313,7 @@ />