@colijnit/corecomponents_v12 12.2.5 → 12.2.6
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/bundles/colijnit-corecomponents_v12.umd.js +73 -53
- package/bundles/colijnit-corecomponents_v12.umd.js.map +1 -1
- package/colijnit-corecomponents_v12.metadata.json +1 -1
- package/esm2015/lib/components/base/base-input.component.js +52 -43
- package/fesm2015/colijnit-corecomponents_v12.js +51 -42
- package/fesm2015/colijnit-corecomponents_v12.js.map +1 -1
- package/lib/components/base/base-input.component.d.ts +5 -3
- package/package.json +1 -1
|
@@ -2246,6 +2246,7 @@
|
|
|
2246
2246
|
this.forceRequired = false; // a force outside of [cfgName]'s influence
|
|
2247
2247
|
// Goal: ability to emulate the red background of input fields (form-submitted invalid state)
|
|
2248
2248
|
this.redErrorBackground = false;
|
|
2249
|
+
this.commitOnBlur = true;
|
|
2249
2250
|
// @Output()
|
|
2250
2251
|
// public commit: EventEmitter<any> = new EventEmitter<any>();
|
|
2251
2252
|
this.nativeBlur = new i0.EventEmitter();
|
|
@@ -2273,6 +2274,7 @@
|
|
|
2273
2274
|
this._markedAsUserTouched = false;
|
|
2274
2275
|
this._destroyed = false;
|
|
2275
2276
|
this._hasOnPushCdStrategy = false;
|
|
2277
|
+
this._modelDirtyForCommit = false;
|
|
2276
2278
|
this._initialModelSet = false;
|
|
2277
2279
|
this._forceReadonly = undefined;
|
|
2278
2280
|
this._validators = [];
|
|
@@ -2315,6 +2317,7 @@
|
|
|
2315
2317
|
}
|
|
2316
2318
|
this._model = value;
|
|
2317
2319
|
this.canSaveOrCancel = this._model !== this._initialModel;
|
|
2320
|
+
this._modelDirtyForCommit = this._model !== this._initialModel;
|
|
2318
2321
|
this._clearErrorComponent();
|
|
2319
2322
|
this.modelSet();
|
|
2320
2323
|
},
|
|
@@ -2607,7 +2610,7 @@
|
|
|
2607
2610
|
committing: false,
|
|
2608
2611
|
commitFinished: false
|
|
2609
2612
|
}, {
|
|
2610
|
-
commitClick: function (event) { return _this.
|
|
2613
|
+
commitClick: function (event) { return _this._handleCommit(event); },
|
|
2611
2614
|
cancelClick: function (event) { return _this.cancelClick(event); }
|
|
2612
2615
|
});
|
|
2613
2616
|
}
|
|
@@ -2673,32 +2676,6 @@
|
|
|
2673
2676
|
this.changeDetector = undefined;
|
|
2674
2677
|
this.input = undefined;
|
|
2675
2678
|
};
|
|
2676
|
-
BaseInputComponent.prototype.commitClick = function (event) {
|
|
2677
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
2678
|
-
var success;
|
|
2679
|
-
return __generator(this, function (_a) {
|
|
2680
|
-
switch (_a.label) {
|
|
2681
|
-
case 0:
|
|
2682
|
-
this.keepFocus = true;
|
|
2683
|
-
if (this._commitButtonsComponentRef) {
|
|
2684
|
-
this._commitButtonsComponentRef.instance.commitFinished = false;
|
|
2685
|
-
this._commitButtonsComponentRef.instance.committing = true;
|
|
2686
|
-
}
|
|
2687
|
-
return [4 /*yield*/, this.commit(this.model)];
|
|
2688
|
-
case 1:
|
|
2689
|
-
success = _a.sent();
|
|
2690
|
-
this.keepFocus = false;
|
|
2691
|
-
return [4 /*yield*/, this._commitFinished()];
|
|
2692
|
-
case 2:
|
|
2693
|
-
_a.sent();
|
|
2694
|
-
if (success) {
|
|
2695
|
-
this.doBlur(event);
|
|
2696
|
-
}
|
|
2697
|
-
return [2 /*return*/, success];
|
|
2698
|
-
}
|
|
2699
|
-
});
|
|
2700
|
-
});
|
|
2701
|
-
};
|
|
2702
2679
|
BaseInputComponent.prototype.cancelClick = function (event) {
|
|
2703
2680
|
this.keepFocus = true;
|
|
2704
2681
|
if (this._initialModelSet) {
|
|
@@ -2752,24 +2729,39 @@
|
|
|
2752
2729
|
}
|
|
2753
2730
|
this.focus.next();
|
|
2754
2731
|
};
|
|
2755
|
-
BaseInputComponent.prototype.doBlur = function (event) {
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2732
|
+
BaseInputComponent.prototype.doBlur = function (event, handleCommit) {
|
|
2733
|
+
if (handleCommit === void 0) { handleCommit = true; }
|
|
2734
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
2735
|
+
var _this = this;
|
|
2736
|
+
return __generator(this, function (_a) {
|
|
2737
|
+
switch (_a.label) {
|
|
2738
|
+
case 0:
|
|
2739
|
+
if (!(this.showSaveCancel && handleCommit)) return [3 /*break*/, 2];
|
|
2740
|
+
return [4 /*yield*/, this._handleCommit(event, false)];
|
|
2741
|
+
case 1:
|
|
2742
|
+
_a.sent();
|
|
2743
|
+
_a.label = 2;
|
|
2744
|
+
case 2:
|
|
2745
|
+
setTimeout(function () {
|
|
2746
|
+
if (_this.keepFocus || _this.keepFocussed) {
|
|
2747
|
+
if (event) {
|
|
2748
|
+
event.preventDefault;
|
|
2749
|
+
}
|
|
2750
|
+
return false;
|
|
2751
|
+
}
|
|
2752
|
+
_this.focused = false;
|
|
2753
|
+
if (_this._hasOnPushCdStrategy) {
|
|
2754
|
+
_this.markForCheck();
|
|
2755
|
+
}
|
|
2756
|
+
if (_this.input) {
|
|
2757
|
+
_this.input.blur();
|
|
2758
|
+
}
|
|
2759
|
+
_this.blur.next();
|
|
2760
|
+
}, 200);
|
|
2761
|
+
return [2 /*return*/];
|
|
2761
2762
|
}
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
_this.focused = false;
|
|
2765
|
-
if (_this._hasOnPushCdStrategy) {
|
|
2766
|
-
_this.markForCheck();
|
|
2767
|
-
}
|
|
2768
|
-
if (_this.input) {
|
|
2769
|
-
_this.input.blur();
|
|
2770
|
-
}
|
|
2771
|
-
_this.blur.next();
|
|
2772
|
-
}, 200);
|
|
2763
|
+
});
|
|
2764
|
+
});
|
|
2773
2765
|
};
|
|
2774
2766
|
BaseInputComponent.prototype.detectChanges = function () {
|
|
2775
2767
|
if (!this._destroyed) {
|
|
@@ -2882,6 +2874,37 @@
|
|
|
2882
2874
|
this.control.updateValueAndValidity();
|
|
2883
2875
|
}
|
|
2884
2876
|
};
|
|
2877
|
+
BaseInputComponent.prototype._handleCommit = function (event, doBlur) {
|
|
2878
|
+
if (doBlur === void 0) { doBlur = true; }
|
|
2879
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
2880
|
+
var success;
|
|
2881
|
+
return __generator(this, function (_a) {
|
|
2882
|
+
switch (_a.label) {
|
|
2883
|
+
case 0:
|
|
2884
|
+
if (!this.showSaveCancel || (!this._modelDirtyForCommit)) {
|
|
2885
|
+
return [2 /*return*/, true];
|
|
2886
|
+
}
|
|
2887
|
+
this.keepFocus = true;
|
|
2888
|
+
if (this._commitButtonsComponentRef) {
|
|
2889
|
+
this._commitButtonsComponentRef.instance.commitFinished = false;
|
|
2890
|
+
this._commitButtonsComponentRef.instance.committing = true;
|
|
2891
|
+
}
|
|
2892
|
+
return [4 /*yield*/, this.commit(this.model)];
|
|
2893
|
+
case 1:
|
|
2894
|
+
success = _a.sent();
|
|
2895
|
+
this.keepFocus = false;
|
|
2896
|
+
return [4 /*yield*/, this._commitFinished()];
|
|
2897
|
+
case 2:
|
|
2898
|
+
_a.sent();
|
|
2899
|
+
this._modelDirtyForCommit = false;
|
|
2900
|
+
if (success && doBlur) {
|
|
2901
|
+
this.doBlur(event, false);
|
|
2902
|
+
}
|
|
2903
|
+
return [2 /*return*/, success];
|
|
2904
|
+
}
|
|
2905
|
+
});
|
|
2906
|
+
});
|
|
2907
|
+
};
|
|
2885
2908
|
BaseInputComponent.prototype._commitFinished = function () {
|
|
2886
2909
|
var _this = this;
|
|
2887
2910
|
return new Promise(function (resolve) {
|
|
@@ -2894,17 +2917,13 @@
|
|
|
2894
2917
|
resolve();
|
|
2895
2918
|
}, 800);
|
|
2896
2919
|
}
|
|
2920
|
+
else {
|
|
2921
|
+
resolve();
|
|
2922
|
+
}
|
|
2897
2923
|
});
|
|
2898
2924
|
};
|
|
2899
2925
|
BaseInputComponent.prototype._clearErrorComponent = function () {
|
|
2900
2926
|
this.overlayService.removeComponent(this._validationComponentRef);
|
|
2901
|
-
// if (this.validationErrorContainer) {
|
|
2902
|
-
// this.validationErrorContainer.clear();
|
|
2903
|
-
// if (this._errorValidationComponent) {
|
|
2904
|
-
// this._errorValidationComponent.destroy();
|
|
2905
|
-
// this._errorValidationComponent = undefined;
|
|
2906
|
-
// }
|
|
2907
|
-
// }
|
|
2908
2927
|
};
|
|
2909
2928
|
// whether this.ngModel.control has safe access
|
|
2910
2929
|
BaseInputComponent.prototype._controlExists = function () {
|
|
@@ -3012,7 +3031,7 @@
|
|
|
3012
3031
|
case 1:
|
|
3013
3032
|
if (!!event.shiftKey) return [3 /*break*/, 3];
|
|
3014
3033
|
event.preventDefault();
|
|
3015
|
-
return [4 /*yield*/, this.
|
|
3034
|
+
return [4 /*yield*/, this._handleCommit()];
|
|
3016
3035
|
case 2:
|
|
3017
3036
|
_b.sent();
|
|
3018
3037
|
return [2 /*return*/, false];
|
|
@@ -3020,7 +3039,7 @@
|
|
|
3020
3039
|
case 4:
|
|
3021
3040
|
nextSiblingToFocus = event.shiftKey ? event.currentTarget.previousSibling : event.currentTarget.nextSibling;
|
|
3022
3041
|
event.preventDefault();
|
|
3023
|
-
return [4 /*yield*/, this.
|
|
3042
|
+
return [4 /*yield*/, this._handleCommit()];
|
|
3024
3043
|
case 5:
|
|
3025
3044
|
success = _b.sent();
|
|
3026
3045
|
if (success) {
|
|
@@ -3111,6 +3130,7 @@
|
|
|
3111
3130
|
customCssClass: [{ type: i0.Input }],
|
|
3112
3131
|
redErrorBackground: [{ type: i0.Input }, { type: i0.HostBinding, args: ["class.cc-red-error-background",] }],
|
|
3113
3132
|
myFormInputInstance: [{ type: i0.Input }],
|
|
3133
|
+
commitOnBlur: [{ type: i0.Input }],
|
|
3114
3134
|
nativeBlur: [{ type: i0.Output }],
|
|
3115
3135
|
blur: [{ type: i0.Output }],
|
|
3116
3136
|
enter: [{ type: i0.Output }],
|