osl-base-extended 14.5.1 → 14.7.1

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.
@@ -1409,9 +1409,29 @@ class Oslinput {
1409
1409
  }
1410
1410
  return;
1411
1411
  }
1412
- if (this.mask && !this.isKeyAllowedByMask(event.key)) {
1413
- event.preventDefault();
1412
+ if (this.mask) {
1413
+ if (!this.isKeyAllowedByMask(event.key)) {
1414
+ event.preventDefault();
1415
+ return;
1416
+ }
1417
+ const input = event.target;
1418
+ const selStart = input.selectionStart ?? input.value.length;
1419
+ const selEnd = input.selectionEnd ?? selStart;
1420
+ if (selStart === selEnd && this.strippedLength(input.value) >= this.maskSlotCount()) {
1421
+ event.preventDefault();
1422
+ }
1423
+ }
1424
+ }
1425
+ strippedLength(value) {
1426
+ return value.replace(/[^a-zA-Z0-9]/g, '').length;
1427
+ }
1428
+ maskSlotCount() {
1429
+ let count = 0;
1430
+ for (const c of this.mask) {
1431
+ if (c === '0' || c === 'A' || c === '*')
1432
+ count++;
1414
1433
  }
1434
+ return count;
1415
1435
  }
1416
1436
  allowNegativeAt(input) {
1417
1437
  if (!this.allowNegative)
@@ -4301,10 +4321,10 @@ class OslSetup {
4301
4321
  } });
4302
4322
  }
4303
4323
  // ── Dialog actions ────────────────────────────────────────────
4304
- openAddDialog() {
4324
+ async openAddDialog() {
4305
4325
  this.dialogMode = 'add';
4306
4326
  if (this.beforeDisplay) {
4307
- this.dialogModel = this.beforeDisplay(this.dialogModel);
4327
+ this.dialogModel = await this.beforeDisplay(this.dialogModel);
4308
4328
  }
4309
4329
  else {
4310
4330
  this.dialogModel = {};