From f6691c110e2ed3a31f2b3500c994b8b196caa382 Mon Sep 17 00:00:00 2001 From: Pete Matsyburka Date: Sun, 17 Mar 2024 17:04:39 +0200 Subject: [PATCH] adjust field settings --- app/javascript/submission_form/area.vue | 8 +++----- app/javascript/template_builder/area.vue | 10 ++++------ app/javascript/template_builder/field.vue | 6 +++--- 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/app/javascript/submission_form/area.vue b/app/javascript/submission_form/area.vue index 479dc33a..4b860b7f 100644 --- a/app/javascript/submission_form/area.vue +++ b/app/javascript/submission_form/area.vue @@ -339,8 +339,8 @@ export default { watch: { modelValue () { this.$nextTick(() => { - if (['date', 'text', 'number'].includes(this.field.type) && this.$refs.textContainer && (this.textOverflowChars === 0 || (this.textOverflowChars - 4) > this.modelValue.length)) { - this.textOverflowChars = this.$refs.textContainer.scrollHeight > this.$refs.textContainer.clientHeight ? this.modelValue.length : 0 + if (['date', 'text', 'number'].includes(this.field.type) && this.$refs.textContainer && (this.textOverflowChars === 0 || (this.textOverflowChars - 4) > `${this.modelValue}`.length)) { + this.textOverflowChars = this.$refs.textContainer.scrollHeight > this.$refs.textContainer.clientHeight ? `${this.modelValue}`.length : 0 } }) } @@ -348,9 +348,7 @@ export default { mounted () { this.$nextTick(() => { if (['date', 'text', 'number'].includes(this.field.type) && this.$refs.textContainer) { - this.$nextTick(() => { - this.textOverflowChars = this.$refs.textContainer.scrollHeight > this.$refs.textContainer.clientHeight ? this.modelValue.length : 0 - }) + this.textOverflowChars = this.$refs.textContainer.scrollHeight > this.$refs.textContainer.clientHeight ? `${this.modelValue}`.length : 0 } }) }, diff --git a/app/javascript/template_builder/area.vue b/app/javascript/template_builder/area.vue index c071e499..c1ae274a 100644 --- a/app/javascript/template_builder/area.vue +++ b/app/javascript/template_builder/area.vue @@ -302,18 +302,16 @@ export default { watch: { 'field.default_value' () { this.$nextTick(() => { - if (['date', 'text', 'number'].includes(this.field.type) && this.field.default_value && this.$refs.textContainer && (this.textOverflowChars === 0 || (this.textOverflowChars - 4) > this.field.default_value.length)) { - this.textOverflowChars = this.$el.clientHeight < this.$refs.textContainer.clientHeight ? this.field.default_value.length : 0 + if (['date', 'text', 'number'].includes(this.field.type) && this.field.default_value && this.$refs.textContainer && (this.textOverflowChars === 0 || (this.textOverflowChars - 4) > `${this.field.default_value}`.length)) { + this.textOverflowChars = this.$el.clientHeight < this.$refs.textContainer.clientHeight ? `${this.field.default_value}`.length : 0 } }) } }, mounted () { this.$nextTick(() => { - if (['date', 'text', 'number'].includes(this.field.type) && this.field.default_value && this.$refs.textContainer && (this.textOverflowChars === 0 || (this.textOverflowChars - 4) > this.field.default_value)) { - this.$nextTick(() => { - this.textOverflowChars = this.$el.clientHeight < this.$refs.textContainer.clientHeight ? this.field.default_value.length : 0 - }) + if (['date', 'text', 'number'].includes(this.field.type) && this.field.default_value && this.$refs.textContainer && (this.textOverflowChars === 0 || (this.textOverflowChars - 4) > `${this.field.default_value}`.length)) { + this.textOverflowChars = this.$el.clientHeight < this.$refs.textContainer.clientHeight ? `${this.field.default_value}`.length : 0 } }) }, diff --git a/app/javascript/template_builder/field.vue b/app/javascript/template_builder/field.vue index 2097072a..fe3acca3 100644 --- a/app/javascript/template_builder/field.vue +++ b/app/javascript/template_builder/field.vue @@ -116,15 +116,15 @@ @click="closeDropdown" >
@@ -258,7 +258,7 @@