Skip to content

Commit

Permalink
SK-1225 jquery bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
appasuamithsai committed Nov 9, 2023
1 parent 71ea514 commit 78f7172
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/core/internal/iframe-form/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ export class IFrameFormElement extends EventEmitter {
}

// todo: send error message of the field
setValue = (value: any = '', valid: boolean = true) => {
setValue = (value: any = '', valid: boolean = true, isReset: boolean = false) => {
if (this.fieldType === ELEMENTS.checkbox.name) {
// toggle for checkbox
if (this.state.value === value) {
Expand Down Expand Up @@ -329,7 +329,9 @@ export class IFrameFormElement extends EventEmitter {
}
}
}
this.sendChangeStatus(true);
if (!isReset) {
this.sendChangeStatus(true);
}
};

getValue = () => {
Expand Down
15 changes: 13 additions & 2 deletions src/core/internal/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,17 @@ export class FrameElement {
this.focusChange(true);
} else {
const target = event.target as HTMLInputElement;
this.iFrameFormElement.setValue(target.value, target.checkValidity());
const { mask } = this.iFrameFormElement;
if (mask) {
const translation = {};
Object.keys(mask[2]).forEach((key) => {
translation[key] = { pattern: mask[2][key] };
});
const output = getMaskedOutput(target.value, mask[0], translation);
this.iFrameFormElement.setValue(output, target.checkValidity());
} else {
this.iFrameFormElement.setValue(target.value, target.checkValidity());
}
}
};

Expand Down Expand Up @@ -815,7 +825,8 @@ export class FrameElement {
if (!this.domInput.getAttribute('maxlength')) { this.domInput.setAttribute('maxlength', mask[0].length); }
}
if (output !== this.iFrameFormElement.getValue()) {
this.iFrameFormElement.setValue(output);
this.copyText = output;
this.iFrameFormElement.setValue(output, undefined, true);
}
} catch (err) {
printLog(parameterizedString(logs.warnLogs.INVALID_INPUT_TRANSLATION,
Expand Down

0 comments on commit 78f7172

Please sign in to comment.