feat(cojo): add cojo type de champ

This commit is contained in:
Paul Chavard 2023-05-30 14:42:36 +02:00
parent c74351459e
commit d5820277c0
31 changed files with 361 additions and 12 deletions

View file

@ -15,6 +15,12 @@ export class FormatController extends ApplicationController {
const target = event.target as HTMLInputElement;
target.value = this.formatIBAN(target.value);
});
break;
case 'integer':
this.on('input', (event) => {
const target = event.target as HTMLInputElement;
target.value = this.formatInteger(target.value);
});
}
}
@ -28,4 +34,8 @@ export class FormatController extends ApplicationController {
.replace(/(.{4})/g, '$1 ')
.trim();
}
private formatInteger(value: string) {
return value.replace(/[^\d]/g, '');
}
}