@indigina/kendo 1.1.8 → 1.1.9
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/esm2020/lib/angular/forms/widgets/field/field-input/number-input.component.mjs +13 -6
- package/fesm2015/indigina-kendo.mjs +12 -5
- package/fesm2015/indigina-kendo.mjs.map +1 -1
- package/fesm2020/indigina-kendo.mjs +12 -5
- package/fesm2020/indigina-kendo.mjs.map +1 -1
- package/lib/angular/forms/widgets/field/field-input/number-input.component.d.ts +1 -0
- package/package.json +1 -1
|
@@ -5,28 +5,35 @@ import * as i0 from "@angular/core";
|
|
|
5
5
|
import * as i1 from "@angular/forms";
|
|
6
6
|
import * as i2 from "@ngx-translate/core";
|
|
7
7
|
import * as i3 from "@angular/common";
|
|
8
|
-
const
|
|
8
|
+
const defaultValue = null;
|
|
9
9
|
export class NumberInputComponent extends FieldInputComponent {
|
|
10
10
|
constructor(parent, eref) {
|
|
11
11
|
super(parent, eref);
|
|
12
12
|
this.parent = parent;
|
|
13
13
|
this.eref = eref;
|
|
14
14
|
this.isPositive = false;
|
|
15
|
-
this.type = '
|
|
15
|
+
this.type = 'text';
|
|
16
16
|
}
|
|
17
17
|
ngAfterContentInit() {
|
|
18
18
|
const control = this.parent.form.get(this.fieldName);
|
|
19
|
+
control.setValue(this.presetDefaultValue(control.value));
|
|
19
20
|
control.valueChanges.subscribe((value) => {
|
|
20
|
-
|
|
21
|
+
value = this.presetDefaultValue(value);
|
|
22
|
+
if (value !== this.cachedValue &&
|
|
23
|
+
value !== defaultValue &&
|
|
24
|
+
!value.endsWith('.')) {
|
|
21
25
|
this.cachedValue =
|
|
22
26
|
(!this.isPositive && (value || value === 0)) ||
|
|
23
|
-
(this.isPositive && value >= 0
|
|
27
|
+
(this.isPositive && value >= 0)
|
|
24
28
|
? +value
|
|
25
|
-
:
|
|
29
|
+
: defaultValue;
|
|
26
30
|
control.setValue(this.cachedValue);
|
|
27
31
|
}
|
|
28
32
|
});
|
|
29
33
|
}
|
|
34
|
+
presetDefaultValue(value) {
|
|
35
|
+
return value == '' ? defaultValue : value;
|
|
36
|
+
}
|
|
30
37
|
}
|
|
31
38
|
NumberInputComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.1", ngImport: i0, type: NumberInputComponent, deps: [{ token: i1.FormGroupDirective }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
32
39
|
NumberInputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.1", type: NumberInputComponent, selector: "number-input", inputs: { isPositive: "isPositive" }, usesInheritance: true, ngImport: i0, template: "<div class=\"form-group\">\n <label\n for=\"{{ id }}\"\n class=\"col-md-3 control-label\"\n translate=\"{{ labelKey }}\"\n ></label>\n <div class=\"col-md-9\">\n <input\n [formControlName]=\"fieldName\"\n id=\"{{ id }}\"\n [type]=\"type\"\n class=\"k-input\"\n autocomplete=\"new-{{ fieldName }}\"\n placeholder=\"{{ labelKey | translate }}\"\n [attr.disabled]=\"disabled ? disabledKey : null\"\n />\n <ng-content></ng-content>\n <div\n class=\"bg-danger\"\n *ngIf=\"\n parent.form.get(fieldName) &&\n parent.form.get(fieldName).invalid &&\n parent.form.get(fieldName).touched\n \"\n >\n <span *ngIf=\"parent.form.get(fieldName).errors['required']\">{{\n 'Required' | translate: { param0: labelKey | translate }\n }}</span>\n <span *ngIf=\"parent.form.get(fieldName).errors['email']\">{{\n 'ValidEmail' | translate\n }}</span>\n <span *ngIf=\"parent.form.get(fieldName).errors['serverErrorMsg']\">{{\n parent.form.get(fieldName).errors['serverErrorMsg']\n }}</span>\n </div>\n </div>\n</div>\n", directives: [{ type: i2.TranslateDirective, selector: "[translate],[ngx-translate]", inputs: ["translate", "translateParams"] }, { type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "translate": i2.TranslatePipe }, viewProviders: [
|
|
@@ -40,4 +47,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.1", ngImpor
|
|
|
40
47
|
}], ctorParameters: function () { return [{ type: i1.FormGroupDirective }, { type: i0.ElementRef }]; }, propDecorators: { isPositive: [{
|
|
41
48
|
type: Input
|
|
42
49
|
}] } });
|
|
43
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
50
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnVtYmVyLWlucHV0LmNvbXBvbmVudC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uLy4uLy4uL3Byb2plY3RzL2tlbmRvL3NyYy9saWIvYW5ndWxhci9mb3Jtcy93aWRnZXRzL2ZpZWxkL2ZpZWxkLWlucHV0L251bWJlci1pbnB1dC5jb21wb25lbnQudHMiLCIuLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi9wcm9qZWN0cy9rZW5kby9zcmMvbGliL2FuZ3VsYXIvZm9ybXMvd2lkZ2V0cy9maWVsZC9maWVsZC1pbnB1dC9maWVsZC1pbnB1dC5jb21wb25lbnQuaHRtbCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsU0FBUyxFQUFjLEtBQUssRUFBRSxNQUFNLGVBQWUsQ0FBQztBQUM3RCxPQUFPLEVBQUUsZ0JBQWdCLEVBQUUsa0JBQWtCLEVBQUUsTUFBTSxnQkFBZ0IsQ0FBQztBQUN0RSxPQUFPLEVBQUUsbU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lZF09XCJkaXNhYmxlZCA/IGRpc2FibGVkS2V5IDogbnVsbFwiXG4gICAgLz5cbiAgICA8bmctY29udGVudD48L25nLWNvbnRlbnQ+XG4gICAgPGRpdlxuICAgICAgY2xhc3M9XCJiZy1kYW5nZXJcIlxuICAgICAgKm5nSWY9XCJcbiAgICAgICAgcGFyZW50LmZvcm0uZ2V0KGZpZWxkTmFtZSkgJiZcbiAgICAgICAgcGFyZW50LmZvcm0uZ2V0KGZpZWxkTmFtZSkuaW52YWxpZCAmJlxuICAgICAgICBwYXJlbnQuZm9ybS5nZXQoZmllbGROYW1lKS50b3VjaGVkXG4gICAgICBcIlxuICAgID5cbiAgICAgIDxzcGFuICpuZ0lmPVwicGFyZW50LmZvcm0uZ2V0KGZpZWxkTmFtZSkuZXJyb3JzWydyZXF1aXJlZCddXCI+e3tcbiAgICAgICAgJ1JlcXVpcmVkJyB8IHRyYW5zbGF0ZTogeyBwYXJhbTA6IGxhYmVsS2V5IHwgdHJhbnNsYXRlIH1cbiAgICAgIH19PC9zcGFuPlxuICAgICAgPHNwYW4gKm5nSWY9XCJwYXJlbnQuZm9ybS5nZXQoZmllbGROYW1lKS5lcnJvcnNbJ2VtYWlsJ11cIj57e1xuICAgICAgICAnVmFsaWRFbWFpbCcgfCB0cmFuc2xhdGVcbiAgICAgIH19PC9zcGFuPlxuICAgICAgPHNwYW4gKm5nSWY9XCJwYXJlbnQuZm9ybS5nZXQoZmllbGROYW1lKS5lcnJvcnNbJ3NlcnZlckVycm9yTXNnJ11cIj57e1xuICAgICAgICBwYXJlbnQuZm9ybS5nZXQoZmllbGROYW1lKS5lcnJvcnNbJ3NlcnZlckVycm9yTXNnJ11cbiAgICAgIH19PC9zcGFuPlxuICAgIDwvZGl2PlxuICA8L2Rpdj5cbjwvZGl2PlxuIl19
|
|
@@ -174,28 +174,35 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.1", ngImpor
|
|
|
174
174
|
type: Input
|
|
175
175
|
}] } });
|
|
176
176
|
|
|
177
|
-
const
|
|
177
|
+
const defaultValue = null;
|
|
178
178
|
class NumberInputComponent extends FieldInputComponent {
|
|
179
179
|
constructor(parent, eref) {
|
|
180
180
|
super(parent, eref);
|
|
181
181
|
this.parent = parent;
|
|
182
182
|
this.eref = eref;
|
|
183
183
|
this.isPositive = false;
|
|
184
|
-
this.type = '
|
|
184
|
+
this.type = 'text';
|
|
185
185
|
}
|
|
186
186
|
ngAfterContentInit() {
|
|
187
187
|
const control = this.parent.form.get(this.fieldName);
|
|
188
|
+
control.setValue(this.presetDefaultValue(control.value));
|
|
188
189
|
control.valueChanges.subscribe((value) => {
|
|
189
|
-
|
|
190
|
+
value = this.presetDefaultValue(value);
|
|
191
|
+
if (value !== this.cachedValue &&
|
|
192
|
+
value !== defaultValue &&
|
|
193
|
+
!value.endsWith('.')) {
|
|
190
194
|
this.cachedValue =
|
|
191
195
|
(!this.isPositive && (value || value === 0)) ||
|
|
192
|
-
(this.isPositive && value >= 0
|
|
196
|
+
(this.isPositive && value >= 0)
|
|
193
197
|
? +value
|
|
194
|
-
:
|
|
198
|
+
: defaultValue;
|
|
195
199
|
control.setValue(this.cachedValue);
|
|
196
200
|
}
|
|
197
201
|
});
|
|
198
202
|
}
|
|
203
|
+
presetDefaultValue(value) {
|
|
204
|
+
return value == '' ? defaultValue : value;
|
|
205
|
+
}
|
|
199
206
|
}
|
|
200
207
|
NumberInputComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.1", ngImport: i0, type: NumberInputComponent, deps: [{ token: i1$3.FormGroupDirective }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
201
208
|
NumberInputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.1", type: NumberInputComponent, selector: "number-input", inputs: { isPositive: "isPositive" }, usesInheritance: true, ngImport: i0, template: "<div class=\"form-group\">\n <label\n for=\"{{ id }}\"\n class=\"col-md-3 control-label\"\n translate=\"{{ labelKey }}\"\n ></label>\n <div class=\"col-md-9\">\n <input\n [formControlName]=\"fieldName\"\n id=\"{{ id }}\"\n [type]=\"type\"\n class=\"k-input\"\n autocomplete=\"new-{{ fieldName }}\"\n placeholder=\"{{ labelKey | translate }}\"\n [attr.disabled]=\"disabled ? disabledKey : null\"\n />\n <ng-content></ng-content>\n <div\n class=\"bg-danger\"\n *ngIf=\"\n parent.form.get(fieldName) &&\n parent.form.get(fieldName).invalid &&\n parent.form.get(fieldName).touched\n \"\n >\n <span *ngIf=\"parent.form.get(fieldName).errors['required']\">{{\n 'Required' | translate: { param0: labelKey | translate }\n }}</span>\n <span *ngIf=\"parent.form.get(fieldName).errors['email']\">{{\n 'ValidEmail' | translate\n }}</span>\n <span *ngIf=\"parent.form.get(fieldName).errors['serverErrorMsg']\">{{\n parent.form.get(fieldName).errors['serverErrorMsg']\n }}</span>\n </div>\n </div>\n</div>\n", directives: [{ type: i1.TranslateDirective, selector: "[translate],[ngx-translate]", inputs: ["translate", "translateParams"] }, { type: i1$3.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i1$3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i1$3.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { type: i3$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "translate": i1.TranslatePipe }, viewProviders: [
|