@colijnit/corecomponents_v12 256.1.9 → 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.
@@ -2278,7 +2278,8 @@
2278
2278
  this.excludeUserModelChange = false;
2279
2279
  this.noFormGroupControl = false;
2280
2280
  this.keepFocus = false;
2281
- this.validationError = "";
2281
+ this.canceled = false;
2282
+ this.validationError = '';
2282
2283
  this._markedAsUserTouched = false;
2283
2284
  this._destroyed = false;
2284
2285
  this._hasOnPushCdStrategy = false;
@@ -2685,6 +2686,8 @@
2685
2686
  this.input = undefined;
2686
2687
  };
2687
2688
  BaseInputComponent.prototype.cancelClick = function (event) {
2689
+ this.canceled = true;
2690
+ this.conditionResolver(this.canceled);
2688
2691
  this.keepFocus = true;
2689
2692
  if (this._initialModelSet) {
2690
2693
  this.model = this._initialModel;
@@ -2737,19 +2740,34 @@
2737
2740
  }
2738
2741
  this.focus.next();
2739
2742
  };
2743
+ BaseInputComponent.prototype.waitForCancelCondition = function () {
2744
+ var _this = this;
2745
+ return new Promise(function (resolve) {
2746
+ _this.conditionResolver = resolve; // Save the resolver to be called later
2747
+ });
2748
+ };
2740
2749
  BaseInputComponent.prototype.doBlur = function (event, handleCommit) {
2741
2750
  if (handleCommit === void 0) { handleCommit = true; }
2742
2751
  return __awaiter(this, void 0, void 0, function () {
2752
+ var cancelTimeout, result;
2743
2753
  var _this = this;
2744
2754
  return __generator(this, function (_a) {
2745
2755
  switch (_a.label) {
2746
2756
  case 0:
2747
- if (!(this.showSaveCancel && handleCommit && this._modelDirtyForCommit)) return [3 /*break*/, 2];
2748
- return [4 /*yield*/, this._handleCommit(event, false)];
2757
+ cancelTimeout = new Promise(function (resolve) { return setTimeout(resolve, 300); });
2758
+ return [4 /*yield*/, Promise.race([this.waitForCancelCondition(), cancelTimeout])];
2749
2759
  case 1:
2750
- _a.sent();
2751
- _a.label = 2;
2760
+ result = _a.sent();
2761
+ // If canceled
2762
+ if (result) {
2763
+ return [2 /*return*/];
2764
+ }
2765
+ if (!(this.showSaveCancel && handleCommit && this._modelDirtyForCommit)) return [3 /*break*/, 3];
2766
+ return [4 /*yield*/, this._handleCommit(event, false)];
2752
2767
  case 2:
2768
+ _a.sent();
2769
+ _a.label = 3;
2770
+ case 3:
2753
2771
  setTimeout(function () {
2754
2772
  if (_this.keepFocus || _this.keepFocussed) {
2755
2773
  if (event) {
@@ -3070,12 +3088,12 @@
3070
3088
  });
3071
3089
  };
3072
3090
  BaseInputComponent.prototype._createNewFocusEvent = function (element) {
3073
- var eventType = "onfocusin" in element ? "focusin" : "focus", bubbles = "onfocusin" in element, focusEvent;
3074
- if ("createEvent" in document) {
3075
- focusEvent = document.createEvent("Event");
3091
+ var eventType = 'onfocusin' in element ? 'focusin' : 'focus', bubbles = 'onfocusin' in element, focusEvent;
3092
+ if ('createEvent' in document) {
3093
+ focusEvent = document.createEvent('Event');
3076
3094
  focusEvent.initEvent(eventType, bubbles, true);
3077
3095
  }
3078
- else if ("Event" in window) {
3096
+ else if ('Event' in window) {
3079
3097
  focusEvent = new Event(eventType, { bubbles: bubbles, cancelable: true });
3080
3098
  }
3081
3099
  return focusEvent;
@@ -3100,7 +3118,7 @@
3100
3118
  return BaseInputComponent;
3101
3119
  }());
3102
3120
  BaseInputComponent.BaseFormInputComponentIndex = 0;
3103
- BaseInputComponent.HiddenClass = "hidden";
3121
+ BaseInputComponent.HiddenClass = 'hidden';
3104
3122
  BaseInputComponent.decorators = [
3105
3123
  { type: i0.Directive },
3106
3124
  { type: i0.Injectable }
@@ -3114,7 +3132,7 @@
3114
3132
  { type: i0.ElementRef, decorators: [{ type: i0.Optional }] }
3115
3133
  ]; };
3116
3134
  BaseInputComponent.propDecorators = {
3117
- validationErrorContainer: [{ type: i0.ViewChild, args: ["validationError", { read: i0.ViewContainerRef },] }],
3135
+ validationErrorContainer: [{ type: i0.ViewChild, args: ['validationError', { read: i0.ViewContainerRef },] }],
3118
3136
  _ngModel: [{ type: i0.ViewChild, args: [forms.NgModel, { static: true },] }],
3119
3137
  showSaveCancel: [{ type: i0.Input }],
3120
3138
  model: [{ type: i0.Input }],
@@ -3132,11 +3150,11 @@
3132
3150
  forceRequired: [{ type: i0.Input }],
3133
3151
  validators: [{ type: i0.Input }],
3134
3152
  asyncValidators: [{ type: i0.Input }],
3135
- hidden: [{ type: i0.Input }, { type: i0.HostBinding, args: ["class." + BaseInputComponent.HiddenClass,] }],
3153
+ hidden: [{ type: i0.Input }, { type: i0.HostBinding, args: ['class.' + BaseInputComponent.HiddenClass,] }],
3136
3154
  decimals: [{ type: i0.Input }],
3137
3155
  icon: [{ type: i0.Input }],
3138
3156
  customCssClass: [{ type: i0.Input }],
3139
- redErrorBackground: [{ type: i0.Input }, { type: i0.HostBinding, args: ["class.cc-red-error-background",] }],
3157
+ redErrorBackground: [{ type: i0.Input }, { type: i0.HostBinding, args: ['class.cc-red-error-background',] }],
3140
3158
  myFormInputInstance: [{ type: i0.Input }],
3141
3159
  commitOnBlur: [{ type: i0.Input }],
3142
3160
  nativeBlur: [{ type: i0.Output }],
@@ -3148,29 +3166,29 @@
3148
3166
  modelChange: [{ type: i0.Output }],
3149
3167
  userModelChange: [{ type: i0.Output }],
3150
3168
  hiddenChange: [{ type: i0.Output }],
3151
- focused: [{ type: i0.HostBinding, args: ["class.cc-input-focused",] }],
3152
- formInput: [{ type: i0.HostBinding, args: ["class.form-input",] }],
3153
- customWidth: [{ type: i0.Input }, { type: i0.HostBinding, args: ["class.custom-width",] }],
3169
+ focused: [{ type: i0.HostBinding, args: ['class.cc-input-focused',] }],
3170
+ formInput: [{ type: i0.HostBinding, args: ['class.form-input',] }],
3171
+ customWidth: [{ type: i0.Input }, { type: i0.HostBinding, args: ['class.custom-width',] }],
3154
3172
  customHeight: [{ type: i0.Input }, { type: i0.HostBinding, args: ['class.custom-height',] }],
3155
3173
  noTriangleGraphic: [{ type: i0.Input }],
3156
3174
  keepFocussed: [{ type: i0.Input }],
3157
- halfWidth: [{ type: i0.Input }, { type: i0.HostBinding, args: ["class.half-width",] }],
3158
- fullWidth: [{ type: i0.Input }, { type: i0.HostBinding, args: ["class.full-width-important",] }],
3175
+ halfWidth: [{ type: i0.Input }, { type: i0.HostBinding, args: ['class.half-width',] }],
3176
+ fullWidth: [{ type: i0.Input }, { type: i0.HostBinding, args: ['class.full-width-important',] }],
3159
3177
  excludeUserModelChange: [{ type: i0.Input }],
3160
3178
  noFormGroupControl: [{ type: i0.Input }],
3161
- formSubmitted: [{ type: i0.HostBinding, args: ["class.form-submitted",] }],
3162
- hasNoLabel: [{ type: i0.HostBinding, args: ["class.hasnolabel",] }],
3163
- hasValue: [{ type: i0.HostBinding, args: ["class.hasvalue",] }],
3164
- invalid: [{ type: i0.HostBinding, args: ["class.invalid",] }],
3165
- isDisabled: [{ type: i0.HostBinding, args: ["class.disabled",] }],
3166
- isReadonly: [{ type: i0.HostBinding, args: ["class.read-only",] }],
3167
- isRequired: [{ type: i0.HostBinding, args: ["class.required",] }],
3168
- touchedInvalid: [{ type: i0.HostBinding, args: ["class.cc-touched-invalid",] }],
3169
- valid: [{ type: i0.HostBinding, args: ["class.valid",] }],
3170
- validationDisabled: [{ type: i0.HostBinding, args: ["class.no-validation",] }],
3171
- onClick: [{ type: i0.HostListener, args: ["click", ["$event"],] }],
3172
- onFocusIn: [{ type: i0.HostListener, args: ["focusin",] }],
3173
- handleKeyDown: [{ type: i0.HostListener, args: ["keydown", ["$event"],] }]
3179
+ formSubmitted: [{ type: i0.HostBinding, args: ['class.form-submitted',] }],
3180
+ hasNoLabel: [{ type: i0.HostBinding, args: ['class.hasnolabel',] }],
3181
+ hasValue: [{ type: i0.HostBinding, args: ['class.hasvalue',] }],
3182
+ invalid: [{ type: i0.HostBinding, args: ['class.invalid',] }],
3183
+ isDisabled: [{ type: i0.HostBinding, args: ['class.disabled',] }],
3184
+ isReadonly: [{ type: i0.HostBinding, args: ['class.read-only',] }],
3185
+ isRequired: [{ type: i0.HostBinding, args: ['class.required',] }],
3186
+ touchedInvalid: [{ type: i0.HostBinding, args: ['class.cc-touched-invalid',] }],
3187
+ valid: [{ type: i0.HostBinding, args: ['class.valid',] }],
3188
+ validationDisabled: [{ type: i0.HostBinding, args: ['class.no-validation',] }],
3189
+ onClick: [{ type: i0.HostListener, args: ['click', ['$event'],] }],
3190
+ onFocusIn: [{ type: i0.HostListener, args: ['focusin',] }],
3191
+ handleKeyDown: [{ type: i0.HostListener, args: ['keydown', ['$event'],] }]
3174
3192
  };
3175
3193
  __decorate([
3176
3194
  InputBoolean()