@magic-xpa/angular 4.1000.0-dev4100.327 → 4.1000.0-dev4100.329
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2020/src/ui/directives/mgformat.magic.directive.mjs +35 -2
- package/fesm2015/magic-xpa-angular.mjs +34 -1
- package/fesm2015/magic-xpa-angular.mjs.map +1 -1
- package/fesm2020/magic-xpa-angular.mjs +34 -1
- package/fesm2020/magic-xpa-angular.mjs.map +1 -1
- package/package.json +3 -3
- package/src/ui/directives/mgformat.magic.directive.d.ts +2 -1
@@ -3236,9 +3236,42 @@ class MgformatMagicDirective {
|
|
3236
3236
|
onFocusEvent($event) {
|
3237
3237
|
this.calculatePattern();
|
3238
3238
|
}
|
3239
|
-
onInputEvent(
|
3239
|
+
onInputEvent(event) {
|
3240
|
+
let control = this._task.getFormControl(this.magicDir.rowId, this.magicDir.id);
|
3241
|
+
if (control != null) {
|
3242
|
+
let attr = this._task.Records.list[0].getControlMetadata(this.magicDir.id).dataType;
|
3243
|
+
if (attr == StorageAttribute.DATE) {
|
3244
|
+
this.dateMasking(event);
|
3245
|
+
}
|
3246
|
+
}
|
3240
3247
|
this.calculatePattern();
|
3241
3248
|
}
|
3249
|
+
dateMasking(event) {
|
3250
|
+
const input = event.target;
|
3251
|
+
const value = input.value.replace(/\D/g, '');
|
3252
|
+
if (this._task.mgInputDateFormat == "dd/MM/yyyy" || this._task.mgInputDateFormat == "MM/dd/yyyy") {
|
3253
|
+
if (value.length <= 2) {
|
3254
|
+
input.value = value;
|
3255
|
+
}
|
3256
|
+
else if (value.length <= 4) {
|
3257
|
+
input.value = `${value.slice(0, 2)}/${value.slice(2)}`;
|
3258
|
+
}
|
3259
|
+
else {
|
3260
|
+
input.value = `${value.slice(0, 2)}/${value.slice(2, 4)}/${value.slice(4, 8)}`;
|
3261
|
+
}
|
3262
|
+
}
|
3263
|
+
else if (this._task.mgInputDateFormat == "yyyy/MM/dd") {
|
3264
|
+
if (value.length <= 4) {
|
3265
|
+
input.value = value;
|
3266
|
+
}
|
3267
|
+
else if (value.length <= 6) {
|
3268
|
+
input.value = `${value.slice(0, 4)}/${value.slice(4)}`;
|
3269
|
+
}
|
3270
|
+
else {
|
3271
|
+
input.value = `${value.slice(0, 4)}/${value.slice(4, 6)}/${value.slice(6, 8)}`;
|
3272
|
+
}
|
3273
|
+
}
|
3274
|
+
}
|
3242
3275
|
onChangeEvent($event) {
|
3243
3276
|
let control = this._task.getFormControl(this.magicDir.rowId, this.magicDir.id);
|
3244
3277
|
let attr = this._task.Records.list[0].getControlMetadata(this.magicDir.id).dataType;
|