CSR-584: fix indentation

This commit is contained in:
Adam Caouette 2022-05-18 15:34:00 -04:00
parent aac13a76bf
commit 6f01f890ab

View file

@ -17,8 +17,8 @@
autocomplete="do-not-autofill" autocomplete="do-not-autofill"
:class="[hasIcon ? 'has-icon' : '', iconRight ? 'icon-right' : '']" :class="[hasIcon ? 'has-icon' : '', iconRight ? 'icon-right' : '']"
:validationRules="validationRules" :validationRules="validationRules"
@change="handleChange" @change="handleChange"
@blur="handleChange" @blur="handleChange"
/> />
<div v-show="errorMessage" class="row my-2 form-test-error"> <div v-show="errorMessage" class="row my-2 form-test-error">
<span class="d-inline-flex mt-0" role="alert">{{ errorMessage }}</span> <span class="d-inline-flex mt-0" role="alert">{{ errorMessage }}</span>
@ -30,36 +30,36 @@
import { useField, validate } from "vee-validate"; import { useField, validate } from "vee-validate";
export default { export default {
name: "textbox-question", name: "textbox-question",
props: { props: {
type: { type: {
type: String, type: String,
default: "text", default: "text",
}, },
placeholderText: { placeholderText: {
type: String, type: String,
default: "", default: "",
}, },
modelValue: String, modelValue: String,
inputId: String, inputId: String,
isDisabled: Boolean, isDisabled: Boolean,
isRequired: Boolean, isRequired: Boolean,
disableAutoFill: Boolean, disableAutoFill: Boolean,
hasIcon: Boolean, // If input has an icon hasIcon: Boolean, // If input has an icon
iconRight: Boolean, // Place icon on right side of text input, otherwise default is left if hasIcon prop is used iconRight: Boolean, // Place icon on right side of text input, otherwise default is left if hasIcon prop is used
hasError: Boolean, hasError: Boolean,
mask: { mask: {
type: String, type: String,
default: "", default: "",
}, },
validationRules: String, validationRules: String,
semiAggressiveValidation: Boolean, semiAggressiveValidation: Boolean,
cmsWidgetName: String, cmsWidgetName: String,
}, },
setup(props) { setup(props) {
const propsClone = Object.assign({}, props); const propsClone = Object.assign({}, props);
const modelValue = propsClone.modelValue; const modelValue = propsClone.modelValue;
let initialValue; let initialValue;
switch (typeof modelValue) { switch (typeof modelValue) {
case "number": case "number":
@ -76,65 +76,65 @@ export default {
initialValue: initialValue, initialValue: initialValue,
}; };
const { errorMessage, handleBlur, handleChange, meta, validate, errors } = const { errorMessage, handleBlur, handleChange, meta, validate, errors } =
useField(props.inputId, props.validationRules, fieldOptions); useField(props.inputId, props.validationRules, fieldOptions);
return { return {
errorMessage, errorMessage,
handleBlur, handleBlur,
handleChange, handleChange,
validate, validate,
meta, meta,
errors, errors,
}; };
}, },
computed: { computed: {
questionText() { questionText() {
return this.getCmsContent(this.cmsWidgetName, "QuestionText"); return this.getCmsContent(this.cmsWidgetName, "QuestionText");
}, },
value: { value: {
get: function () { get: function () {
return this.modelValue; return this.modelValue;
}, },
set: function (newValue) { set: function (newValue) {
this.$emit("update:modelValue", newValue); this.$emit("update:modelValue", newValue);
}, },
}, },
labelText: { labelText: {
get: function () { get: function () {
const noBreakChar = "&NoBreak;"; const noBreakChar = "&NoBreak;";
var questionText = ""; var questionText = "";
if (this.disableAutoFill) { if (this.disableAutoFill) {
var words = this.questionText.toString().split(/[ ]+/); var words = this.questionText.toString().split(/[ ]+/);
words.forEach(function (word) { words.forEach(function (word) {
const position = 1; const position = 1;
word = [ word = [
word.toString().slice(0, position), word.toString().slice(0, position),
noBreakChar, noBreakChar,
word.toString().slice(position), word.toString().slice(position),
].join(""); ].join("");
questionText += `${word} `; questionText += `${word} `;
}); });
questionText = questionText.trimEnd(); questionText = questionText.trimEnd();
} else { } else {
questionText = this.questionText.toString(); questionText = this.questionText.toString();
} }
return questionText; return questionText;
}, },
}, },
}, },
watch: { watch: {
async value(newValue) { async value(newValue) {
if (this.semiAggressiveValidation) { if (this.semiAggressiveValidation) {
const result = await validate(newValue, this.validationRules); // do a test validation check, without triggering full validation const result = await validate(newValue, this.validationRules); // do a test validation check, without triggering full validation
if (result.valid) { if (result.valid) {
this.handleChange(newValue); // trigger full validation on this field only this.handleChange(newValue); // trigger full validation on this field only
} }
} }
}, },
}, },
}; };
</script> </script>