ng-inail-common 2.0.30-beta.9 → 2.0.30
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/ng-inail-common.umd.js +56 -27
- package/bundles/ng-inail-common.umd.js.map +1 -1
- package/bundles/ng-inail-common.umd.min.js +2 -2
- package/bundles/ng-inail-common.umd.min.js.map +1 -1
- package/esm2015/lib/components/core/form/checkbox/checkbox.component.js +4 -2
- package/esm2015/lib/components/core/form/form-element.component.js +6 -3
- package/esm2015/lib/components/core/form/input-date/input-date.component.js +15 -11
- package/esm2015/lib/components/core/form/input-file/input-file.component.js +4 -2
- package/esm2015/lib/components/core/form/input-number/input-number.component.js +8 -6
- package/esm2015/lib/components/core/form/input-text/input-text.component.js +4 -2
- package/esm2015/lib/components/core/form/input-time/input-time.component.js +7 -3
- package/esm2015/lib/components/core/form/multi-select/multi-select.component.js +7 -3
- package/esm2015/lib/components/core/form/radio-select/radio-select.component.js +4 -2
- package/esm2015/lib/components/core/form/select/select.component.js +4 -2
- package/esm2015/lib/components/core/form/textarea/textarea.component.js +4 -2
- package/esm2015/lib/ng-inail-common.config.js +1 -1
- package/fesm2015/ng-inail-common.js +56 -27
- package/fesm2015/ng-inail-common.js.map +1 -1
- package/lib/components/core/form/form-element.component.d.ts +1 -0
- package/lib/components/core/form/input-date/input-date.component.d.ts +2 -0
- package/lib/ng-inail-common.config.d.ts +3 -0
- package/ng-inail-common.metadata.json +1 -1
- package/package.json +1 -1
|
@@ -2962,7 +2962,7 @@
|
|
|
2962
2962
|
__extends(FormElementComponent, _super);
|
|
2963
2963
|
function FormElementComponent(formElementCdr, formElementLibConfig) {
|
|
2964
2964
|
var _this = this;
|
|
2965
|
-
var _a, _b, _c, _d;
|
|
2965
|
+
var _a, _b, _c, _d, _e, _f;
|
|
2966
2966
|
_this = _super.call(this, formElementCdr, formElementLibConfig) || this;
|
|
2967
2967
|
_this.formElementCdr = formElementCdr;
|
|
2968
2968
|
_this.formElementLibConfig = formElementLibConfig;
|
|
@@ -2977,6 +2977,7 @@
|
|
|
2977
2977
|
_this.errorChange = new core.EventEmitter();
|
|
2978
2978
|
_this.enterUp = new core.EventEmitter();
|
|
2979
2979
|
_this.popover = false;
|
|
2980
|
+
_this.cleanErrorOnChange = getConfigValue((_f = (_e = _this.formElementLibConfig) === null || _e === void 0 ? void 0 : _e.formElementComponent) === null || _f === void 0 ? void 0 : _f.cleanErrorOnChange, true);
|
|
2980
2981
|
_this.getLabel = function () { return "" + ((_this.required && _this.requiredSimbolPosition === 'left') ? _this.requiredSimbol + " " : '') + _this.label + ((_this.required && _this.requiredSimbolPosition === 'right') ? " " + _this.requiredSimbol : ''); };
|
|
2981
2982
|
_this.isThereError = function () { return _this.hasError || isNotBlankOrNull(_this.error); };
|
|
2982
2983
|
_this.showError = function () { return _this.isThereError() && isNotBlankOrNull(_this.error); };
|
|
@@ -2991,6 +2992,7 @@
|
|
|
2991
2992
|
_super.prototype.overrideConfig.call(this, config);
|
|
2992
2993
|
this.requiredSimbol = getConfigValue(config.requiredSimbol, this.requiredSimbol);
|
|
2993
2994
|
this.requiredSimbolPosition = getConfigValue(config.requiredSimbolPosition, this.requiredSimbolPosition);
|
|
2995
|
+
this.cleanErrorOnChange = getConfigValue(config.cleanErrorOnChange, this.cleanErrorOnChange);
|
|
2994
2996
|
}
|
|
2995
2997
|
};
|
|
2996
2998
|
FormElementComponent.prototype.ngOnChanges = function (changes) {
|
|
@@ -3082,7 +3084,8 @@
|
|
|
3082
3084
|
popoverButtonIcon: [{ type: core.Input }],
|
|
3083
3085
|
popoverButtonTitle: [{ type: core.Input }],
|
|
3084
3086
|
popoverHeader: [{ type: core.Input }],
|
|
3085
|
-
popoverContent: [{ type: core.Input }]
|
|
3087
|
+
popoverContent: [{ type: core.Input }],
|
|
3088
|
+
cleanErrorOnChange: [{ type: core.Input }]
|
|
3086
3089
|
};
|
|
3087
3090
|
|
|
3088
3091
|
/**
|
|
@@ -3237,7 +3240,9 @@
|
|
|
3237
3240
|
this.cdr.detectChanges();
|
|
3238
3241
|
this.emitDebug("this.valueChange.emit(" + value + ")");
|
|
3239
3242
|
this.valueChange.emit(value);
|
|
3240
|
-
this.
|
|
3243
|
+
if (this.cleanErrorOnChange) {
|
|
3244
|
+
this.cleanError();
|
|
3245
|
+
}
|
|
3241
3246
|
if (this.onChange) {
|
|
3242
3247
|
this.onChange(value);
|
|
3243
3248
|
}
|
|
@@ -3354,7 +3359,9 @@
|
|
|
3354
3359
|
_this.emitDebug("this.valueChange.emit(" + _this.selectedValue + ")");
|
|
3355
3360
|
_this.valueChange.emit(_this.selectedValue);
|
|
3356
3361
|
_this.select.emit(_this.options.find(function (opt) { return (opt === null || opt === void 0 ? void 0 : opt.value) === _this.selectedValue; }));
|
|
3357
|
-
_this.
|
|
3362
|
+
if (_this.cleanErrorOnChange) {
|
|
3363
|
+
_this.cleanError();
|
|
3364
|
+
}
|
|
3358
3365
|
if (_this.onChange) {
|
|
3359
3366
|
_this.onChange(_this.selectedValue);
|
|
3360
3367
|
}
|
|
@@ -4070,7 +4077,9 @@
|
|
|
4070
4077
|
this.cdr.detectChanges();
|
|
4071
4078
|
this.emitDebug("this.valueChange.emit(" + value + ")");
|
|
4072
4079
|
this.valueChange.emit(value);
|
|
4073
|
-
this.
|
|
4080
|
+
if (this.cleanErrorOnChange) {
|
|
4081
|
+
this.cleanError();
|
|
4082
|
+
}
|
|
4074
4083
|
if (this.onChange) {
|
|
4075
4084
|
this.onChange(value);
|
|
4076
4085
|
}
|
|
@@ -4126,7 +4135,7 @@
|
|
|
4126
4135
|
__extends(InputDateComponent, _super);
|
|
4127
4136
|
function InputDateComponent(cdr, libConfig) {
|
|
4128
4137
|
var _this = this;
|
|
4129
|
-
var _a, _b;
|
|
4138
|
+
var _a, _b, _c, _d, _e, _f;
|
|
4130
4139
|
_this = _super.call(this, cdr, libConfig) || this;
|
|
4131
4140
|
_this.cdr = cdr;
|
|
4132
4141
|
_this.libConfig = libConfig;
|
|
@@ -4135,10 +4144,12 @@
|
|
|
4135
4144
|
// modelFormat: DateFormat;
|
|
4136
4145
|
// https://bootstrap-datepicker.readthedocs.io/en/latest/options.html
|
|
4137
4146
|
_this.options = getConfigValue((_b = (_a = _this.libConfig) === null || _a === void 0 ? void 0 : _a.inputDateComponent) === null || _b === void 0 ? void 0 : _b.options, undefined);
|
|
4147
|
+
_this.selfValidation = getConfigValue((_d = (_c = _this.libConfig) === null || _c === void 0 ? void 0 : _c.inputDateComponent) === null || _d === void 0 ? void 0 : _d.selfValidation, true);
|
|
4148
|
+
_this.selfValidationError = getConfigValue((_f = (_e = _this.libConfig) === null || _e === void 0 ? void 0 : _e.inputDateComponent) === null || _f === void 0 ? void 0 : _f.selfValidationError, 'La data inserita non è valida');
|
|
4138
4149
|
_this.isValidInputValue = function () { return isBlankOrNull(_this.visibleData) || isInItalianFormat(_this.visibleData); };
|
|
4139
|
-
_this.isThereDataError = function () { return _this.isThereError() || !_this.isValidInputValue(); };
|
|
4150
|
+
_this.isThereDataError = function () { return _this.isThereError() || (!_this.isValidInputValue() && _this.selfValidation); };
|
|
4140
4151
|
_this.showDataError = function () { return _this.isThereDataError() && isNotBlankOrNull(_this.getDescError()); };
|
|
4141
|
-
_this.getDescError = function () { return (isBlankOrNull(_this.error) && !_this.isValidInputValue()) ?
|
|
4152
|
+
_this.getDescError = function () { return (_this.selfValidation && isBlankOrNull(_this.error) && !_this.isValidInputValue()) ? _this.selfValidationError : _this.error; };
|
|
4142
4153
|
_this.isEnabledDate = function (date) {
|
|
4143
4154
|
var dateString = dateToString(date, 'ISO8061');
|
|
4144
4155
|
return _this.isDataAbilitata(dateString) && !_this.isDataDisabilitata(dateString);
|
|
@@ -4156,12 +4167,10 @@
|
|
|
4156
4167
|
}
|
|
4157
4168
|
InputDateComponent.prototype.ngOnChanges = function (changes) {
|
|
4158
4169
|
_super.prototype.ngOnChanges.call(this, changes);
|
|
4159
|
-
if (changes.value && !changes.value.firstChange) {
|
|
4160
|
-
|
|
4161
|
-
|
|
4162
|
-
|
|
4163
|
-
this.errorChange.emit(this.error);
|
|
4164
|
-
}
|
|
4170
|
+
// if (changes.value && !changes.value.firstChange && this.cleanErrorOnChange) {
|
|
4171
|
+
//
|
|
4172
|
+
// this.cleanError();
|
|
4173
|
+
// }
|
|
4165
4174
|
// Se cambiano le options o gli array delle date abilitate/disabilitate
|
|
4166
4175
|
// reinizializzo il componente
|
|
4167
4176
|
if ((changes.options && !changes.options.firstChange)
|
|
@@ -4278,7 +4287,9 @@
|
|
|
4278
4287
|
_this.setDatepickerDate(_this.visibleData);
|
|
4279
4288
|
}
|
|
4280
4289
|
});
|
|
4281
|
-
this.
|
|
4290
|
+
if (this.cleanErrorOnChange) {
|
|
4291
|
+
this.cleanError();
|
|
4292
|
+
}
|
|
4282
4293
|
this.cdr.detectChanges();
|
|
4283
4294
|
if (this.onChange) {
|
|
4284
4295
|
this.onChange(value);
|
|
@@ -4327,6 +4338,8 @@
|
|
|
4327
4338
|
formControlElement: [{ type: core.ViewChild, args: ['formControl', { static: true },] }],
|
|
4328
4339
|
valueChange: [{ type: core.Output }],
|
|
4329
4340
|
options: [{ type: core.Input }],
|
|
4341
|
+
selfValidation: [{ type: core.Input }],
|
|
4342
|
+
selfValidationError: [{ type: core.Input }],
|
|
4330
4343
|
enabledDates: [{ type: core.Input }],
|
|
4331
4344
|
disabledDates: [{ type: core.Input }],
|
|
4332
4345
|
reinit: [{ type: core.Input }],
|
|
@@ -4410,7 +4423,9 @@
|
|
|
4410
4423
|
_this.emitDebug("this.valueChange.emit(" + _this.selectedValue + ")");
|
|
4411
4424
|
_this.valueChange.emit(_this.selectedValue);
|
|
4412
4425
|
_this.select.emit(_this.options.find(function (opt) { return (opt === null || opt === void 0 ? void 0 : opt.value) === _this.selectedValue; }));
|
|
4413
|
-
_this.
|
|
4426
|
+
if (_this.cleanErrorOnChange) {
|
|
4427
|
+
_this.cleanError();
|
|
4428
|
+
}
|
|
4414
4429
|
if (_this.onChange) {
|
|
4415
4430
|
_this.onChange(_this.selectedValue);
|
|
4416
4431
|
}
|
|
@@ -4532,7 +4547,9 @@
|
|
|
4532
4547
|
this.emitDebug("this.checkedChange.emit(" + value + ")");
|
|
4533
4548
|
this.checkedChange.emit(value);
|
|
4534
4549
|
this.emitState();
|
|
4535
|
-
this.
|
|
4550
|
+
if (this.cleanErrorOnChange) {
|
|
4551
|
+
this.cleanError();
|
|
4552
|
+
}
|
|
4536
4553
|
if (this.onChange) {
|
|
4537
4554
|
this.onChange(value);
|
|
4538
4555
|
}
|
|
@@ -5854,7 +5871,9 @@
|
|
|
5854
5871
|
if (!this.addButton) {
|
|
5855
5872
|
this.fileChange.emit(this.fileModel);
|
|
5856
5873
|
}
|
|
5857
|
-
this.
|
|
5874
|
+
if (this.cleanErrorOnChange) {
|
|
5875
|
+
this.cleanError();
|
|
5876
|
+
}
|
|
5858
5877
|
this.cdr.detectChanges();
|
|
5859
5878
|
};
|
|
5860
5879
|
InputFileComponent.prototype.reset = function () {
|
|
@@ -5915,10 +5934,10 @@
|
|
|
5915
5934
|
if (changes.value) {
|
|
5916
5935
|
this.previousValue = changes.value.previousValue;
|
|
5917
5936
|
this.normalizzaValore();
|
|
5918
|
-
if (!changes.value.firstChange) {
|
|
5919
|
-
|
|
5920
|
-
|
|
5921
|
-
}
|
|
5937
|
+
// if (!changes.value.firstChange) {
|
|
5938
|
+
//
|
|
5939
|
+
// this.cleanError()
|
|
5940
|
+
// }
|
|
5922
5941
|
}
|
|
5923
5942
|
this.cdr.detectChanges();
|
|
5924
5943
|
};
|
|
@@ -5962,7 +5981,9 @@
|
|
|
5962
5981
|
this.cdr.detectChanges();
|
|
5963
5982
|
this.emitDebug("this.valueChange.emit(" + value + ")");
|
|
5964
5983
|
this.valueChange.emit(value);
|
|
5965
|
-
this.
|
|
5984
|
+
if (this.cleanErrorOnChange) {
|
|
5985
|
+
this.cleanError();
|
|
5986
|
+
}
|
|
5966
5987
|
if (this.onChange) {
|
|
5967
5988
|
this.onChange(value);
|
|
5968
5989
|
}
|
|
@@ -6546,11 +6567,15 @@
|
|
|
6546
6567
|
if (!cb.firstChange) {
|
|
6547
6568
|
if (cb.checked && !this.isChecked(cb.value)) {
|
|
6548
6569
|
this.pushValue(cb.value);
|
|
6549
|
-
this.
|
|
6570
|
+
if (this.cleanErrorOnChange) {
|
|
6571
|
+
this.cleanError();
|
|
6572
|
+
}
|
|
6550
6573
|
}
|
|
6551
6574
|
else if (!cb.checked && this.isChecked(cb.value)) {
|
|
6552
6575
|
this.values = this.values.filter(function (value) { return value != cb.value; });
|
|
6553
|
-
this.
|
|
6576
|
+
if (this.cleanErrorOnChange) {
|
|
6577
|
+
this.cleanError();
|
|
6578
|
+
}
|
|
6554
6579
|
}
|
|
6555
6580
|
this.valuesChange.emit(this.values);
|
|
6556
6581
|
this.inputTextValue = this.getInputTextValue();
|
|
@@ -6671,12 +6696,16 @@
|
|
|
6671
6696
|
this.setDescError(this.selfValidationError);
|
|
6672
6697
|
}
|
|
6673
6698
|
else {
|
|
6674
|
-
this.
|
|
6699
|
+
if (this.cleanErrorOnChange) {
|
|
6700
|
+
this.cleanError();
|
|
6701
|
+
}
|
|
6675
6702
|
}
|
|
6676
6703
|
}
|
|
6677
6704
|
else {
|
|
6678
6705
|
this.inputValue = value;
|
|
6679
|
-
this.
|
|
6706
|
+
if (this.cleanErrorOnChange) {
|
|
6707
|
+
this.cleanError();
|
|
6708
|
+
}
|
|
6680
6709
|
}
|
|
6681
6710
|
this.cdr.detectChanges();
|
|
6682
6711
|
this.emitDebug("this.valueChange.emit(" + this.inputValue + ")");
|