@colijnit/corecomponents_v12 256.1.10 → 256.1.11

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.
@@ -1893,7 +1893,8 @@ class BaseInputComponent {
1893
1893
  this.excludeUserModelChange = false;
1894
1894
  this.noFormGroupControl = false;
1895
1895
  this.keepFocus = false;
1896
- this.validationError = "";
1896
+ this.canceled = false;
1897
+ this.validationError = '';
1897
1898
  this._markedAsUserTouched = false;
1898
1899
  this._destroyed = false;
1899
1900
  this._hasOnPushCdStrategy = false;
@@ -2186,6 +2187,8 @@ class BaseInputComponent {
2186
2187
  this.input = undefined;
2187
2188
  }
2188
2189
  cancelClick(event) {
2190
+ this.canceled = true;
2191
+ this.conditionResolver(this.canceled);
2189
2192
  this.keepFocus = true;
2190
2193
  if (this._initialModelSet) {
2191
2194
  this.model = this._initialModel;
@@ -2238,8 +2241,19 @@ class BaseInputComponent {
2238
2241
  }
2239
2242
  this.focus.next();
2240
2243
  }
2244
+ waitForCancelCondition() {
2245
+ return new Promise((resolve) => {
2246
+ this.conditionResolver = resolve; // Save the resolver to be called later
2247
+ });
2248
+ }
2241
2249
  doBlur(event, handleCommit = true) {
2242
2250
  return __awaiter(this, void 0, void 0, function* () {
2251
+ const cancelTimeout = new Promise(resolve => setTimeout(resolve, 300));
2252
+ const result = yield Promise.race([this.waitForCancelCondition(), cancelTimeout]);
2253
+ // If canceled
2254
+ if (result) {
2255
+ return;
2256
+ }
2243
2257
  if (this.showSaveCancel && handleCommit && this._modelDirtyForCommit) {
2244
2258
  yield this._handleCommit(event, false);
2245
2259
  }
@@ -2530,12 +2544,12 @@ class BaseInputComponent {
2530
2544
  });
2531
2545
  }
2532
2546
  _createNewFocusEvent(element) {
2533
- let eventType = "onfocusin" in element ? "focusin" : "focus", bubbles = "onfocusin" in element, focusEvent;
2534
- if ("createEvent" in document) {
2535
- focusEvent = document.createEvent("Event");
2547
+ let eventType = 'onfocusin' in element ? 'focusin' : 'focus', bubbles = 'onfocusin' in element, focusEvent;
2548
+ if ('createEvent' in document) {
2549
+ focusEvent = document.createEvent('Event');
2536
2550
  focusEvent.initEvent(eventType, bubbles, true);
2537
2551
  }
2538
- else if ("Event" in window) {
2552
+ else if ('Event' in window) {
2539
2553
  focusEvent = new Event(eventType, { bubbles: bubbles, cancelable: true });
2540
2554
  }
2541
2555
  return focusEvent;
@@ -2559,7 +2573,7 @@ class BaseInputComponent {
2559
2573
  }
2560
2574
  }
2561
2575
  BaseInputComponent.BaseFormInputComponentIndex = 0;
2562
- BaseInputComponent.HiddenClass = "hidden";
2576
+ BaseInputComponent.HiddenClass = 'hidden';
2563
2577
  BaseInputComponent.decorators = [
2564
2578
  { type: Directive },
2565
2579
  { type: Injectable }
@@ -2573,7 +2587,7 @@ BaseInputComponent.ctorParameters = () => [
2573
2587
  { type: ElementRef, decorators: [{ type: Optional }] }
2574
2588
  ];
2575
2589
  BaseInputComponent.propDecorators = {
2576
- validationErrorContainer: [{ type: ViewChild, args: ["validationError", { read: ViewContainerRef },] }],
2590
+ validationErrorContainer: [{ type: ViewChild, args: ['validationError', { read: ViewContainerRef },] }],
2577
2591
  _ngModel: [{ type: ViewChild, args: [NgModel, { static: true },] }],
2578
2592
  showSaveCancel: [{ type: Input }],
2579
2593
  model: [{ type: Input }],
@@ -2591,11 +2605,11 @@ BaseInputComponent.propDecorators = {
2591
2605
  forceRequired: [{ type: Input }],
2592
2606
  validators: [{ type: Input }],
2593
2607
  asyncValidators: [{ type: Input }],
2594
- hidden: [{ type: Input }, { type: HostBinding, args: ["class." + BaseInputComponent.HiddenClass,] }],
2608
+ hidden: [{ type: Input }, { type: HostBinding, args: ['class.' + BaseInputComponent.HiddenClass,] }],
2595
2609
  decimals: [{ type: Input }],
2596
2610
  icon: [{ type: Input }],
2597
2611
  customCssClass: [{ type: Input }],
2598
- redErrorBackground: [{ type: Input }, { type: HostBinding, args: ["class.cc-red-error-background",] }],
2612
+ redErrorBackground: [{ type: Input }, { type: HostBinding, args: ['class.cc-red-error-background',] }],
2599
2613
  myFormInputInstance: [{ type: Input }],
2600
2614
  commitOnBlur: [{ type: Input }],
2601
2615
  nativeBlur: [{ type: Output }],
@@ -2607,29 +2621,29 @@ BaseInputComponent.propDecorators = {
2607
2621
  modelChange: [{ type: Output }],
2608
2622
  userModelChange: [{ type: Output }],
2609
2623
  hiddenChange: [{ type: Output }],
2610
- focused: [{ type: HostBinding, args: ["class.cc-input-focused",] }],
2611
- formInput: [{ type: HostBinding, args: ["class.form-input",] }],
2612
- customWidth: [{ type: Input }, { type: HostBinding, args: ["class.custom-width",] }],
2624
+ focused: [{ type: HostBinding, args: ['class.cc-input-focused',] }],
2625
+ formInput: [{ type: HostBinding, args: ['class.form-input',] }],
2626
+ customWidth: [{ type: Input }, { type: HostBinding, args: ['class.custom-width',] }],
2613
2627
  customHeight: [{ type: Input }, { type: HostBinding, args: ['class.custom-height',] }],
2614
2628
  noTriangleGraphic: [{ type: Input }],
2615
2629
  keepFocussed: [{ type: Input }],
2616
- halfWidth: [{ type: Input }, { type: HostBinding, args: ["class.half-width",] }],
2617
- fullWidth: [{ type: Input }, { type: HostBinding, args: ["class.full-width-important",] }],
2630
+ halfWidth: [{ type: Input }, { type: HostBinding, args: ['class.half-width',] }],
2631
+ fullWidth: [{ type: Input }, { type: HostBinding, args: ['class.full-width-important',] }],
2618
2632
  excludeUserModelChange: [{ type: Input }],
2619
2633
  noFormGroupControl: [{ type: Input }],
2620
- formSubmitted: [{ type: HostBinding, args: ["class.form-submitted",] }],
2621
- hasNoLabel: [{ type: HostBinding, args: ["class.hasnolabel",] }],
2622
- hasValue: [{ type: HostBinding, args: ["class.hasvalue",] }],
2623
- invalid: [{ type: HostBinding, args: ["class.invalid",] }],
2624
- isDisabled: [{ type: HostBinding, args: ["class.disabled",] }],
2625
- isReadonly: [{ type: HostBinding, args: ["class.read-only",] }],
2626
- isRequired: [{ type: HostBinding, args: ["class.required",] }],
2627
- touchedInvalid: [{ type: HostBinding, args: ["class.cc-touched-invalid",] }],
2628
- valid: [{ type: HostBinding, args: ["class.valid",] }],
2629
- validationDisabled: [{ type: HostBinding, args: ["class.no-validation",] }],
2630
- onClick: [{ type: HostListener, args: ["click", ["$event"],] }],
2631
- onFocusIn: [{ type: HostListener, args: ["focusin",] }],
2632
- handleKeyDown: [{ type: HostListener, args: ["keydown", ["$event"],] }]
2634
+ formSubmitted: [{ type: HostBinding, args: ['class.form-submitted',] }],
2635
+ hasNoLabel: [{ type: HostBinding, args: ['class.hasnolabel',] }],
2636
+ hasValue: [{ type: HostBinding, args: ['class.hasvalue',] }],
2637
+ invalid: [{ type: HostBinding, args: ['class.invalid',] }],
2638
+ isDisabled: [{ type: HostBinding, args: ['class.disabled',] }],
2639
+ isReadonly: [{ type: HostBinding, args: ['class.read-only',] }],
2640
+ isRequired: [{ type: HostBinding, args: ['class.required',] }],
2641
+ touchedInvalid: [{ type: HostBinding, args: ['class.cc-touched-invalid',] }],
2642
+ valid: [{ type: HostBinding, args: ['class.valid',] }],
2643
+ validationDisabled: [{ type: HostBinding, args: ['class.no-validation',] }],
2644
+ onClick: [{ type: HostListener, args: ['click', ['$event'],] }],
2645
+ onFocusIn: [{ type: HostListener, args: ['focusin',] }],
2646
+ handleKeyDown: [{ type: HostListener, args: ['keydown', ['$event'],] }]
2633
2647
  };
2634
2648
  __decorate([
2635
2649
  InputBoolean()