Skip to content

Commit 6cb89f6

Browse files
authored
fix(input): fractional value not displayed after initialization (#DS-2633) (#337)
1 parent 0c1fa93 commit 6cb89f6

File tree

5 files changed

+14
-24
lines changed

5 files changed

+14
-24
lines changed

packages/components/input/input-number.spec.ts

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@ function createComponent<T>(component: Type<T>, imports: any[] = [], providers:
4444
<kbq-form-field>
4545
<input
4646
[(ngModel)]="value"
47-
kbqInput
48-
type="number"
47+
kbqNumberInput
4948
/>
5049
<kbq-stepper />
5150
</kbq-form-field>
@@ -60,8 +59,7 @@ class KbqNumberInputTestComponent {
6059
<kbq-form-field>
6160
<input
6261
[formControl]="formControl"
63-
kbqInput
64-
type="number"
62+
kbqNumberInput
6563
/>
6664
<kbq-stepper />
6765
</kbq-form-field>
@@ -79,9 +77,8 @@ class KbqNumberInputWithFormControl {
7977
>
8078
<kbq-form-field>
8179
<input
82-
kbqInput
80+
kbqNumberInput
8381
formControlName="reactiveInputValue"
84-
type="number"
8582
/>
8683
<kbq-stepper />
8784
</kbq-form-field>
@@ -103,8 +100,7 @@ class KbqNumberInputWithFormControlName {
103100
<kbq-form-field>
104101
<input
105102
[(ngModel)]="value"
106-
kbqInput
107-
type="number"
103+
kbqNumberInput
108104
max="10"
109105
min="3"
110106
step="0.5"
@@ -127,8 +123,7 @@ class KbqNumberInputMaxMinStep {
127123
[min]="min"
128124
[step]="step"
129125
[bigStep]="bigStep"
130-
kbqInput
131-
type="number"
126+
kbqNumberInput
132127
/>
133128
<kbq-stepper />
134129
</kbq-form-field>
@@ -147,8 +142,7 @@ class KbqNumberInputMaxMinStepInput {
147142
<kbq-form-field>
148143
<input
149144
[(ngModel)]="value"
150-
kbqInput
151-
type="number"
145+
kbqNumberInput
152146
/>
153147
<kbq-cleaner />
154148
</kbq-form-field>
@@ -168,8 +162,7 @@ class KbqNumberInputWithCleaner {
168162
[step]="step"
169163
[bigStep]="bigStep"
170164
[withThousandSeparator]="withMask"
171-
kbqInput
172-
type="number"
165+
kbqNumberInput
173166
/>
174167
<kbq-stepper />
175168
</kbq-form-field>

packages/components/input/input-number.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ interface NumberLocaleConfig {
8585
}
8686

8787
@Directive({
88-
selector: `input[kbqInput][type="number"]`,
88+
selector: `input[kbqNumberInput]`,
8989
exportAs: 'kbqNumericalInput',
9090
providers: [KBQ_NUMBER_INPUT_VALUE_ACCESSOR],
9191
host: {

packages/components/input/input.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export class KbqInputBase {
6060
export const KbqInputMixinBase: CanUpdateErrorStateCtor & typeof KbqInputBase = mixinErrorState(KbqInputBase);
6161

6262
@Directive({
63-
selector: `input[kbqInput]`,
63+
selector: `input[kbqInput],input[kbqNumberInput]`,
6464
exportAs: 'kbqInput',
6565
host: {
6666
class: 'kbq-input',

packages/docs-examples/components/input/input-number-overview/input-number-overview-example.html

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@
44
<label class="kbq-form__label flex-40">With min value, max value and localized thousand separator</label>
55
<kbq-form-field class="kbq-form__control flex-60">
66
<input
7-
kbqInput
7+
kbqNumberInput
88
placeholder="Allowed number from -7 to 7"
9-
type="number"
109
[bigStep]="1.5"
1110
[max]="7"
1211
[min]="-7"
@@ -21,8 +20,7 @@
2120
<label class="kbq-form__label flex-40">With localized thousand separator</label>
2221
<kbq-form-field class="kbq-form__control flex-60">
2322
<input
24-
kbqInput
25-
type="number"
23+
kbqNumberInput
2624
[(ngModel)]="value"
2725
/>
2826
<kbq-stepper />
@@ -33,8 +31,7 @@
3331
<label class="kbq-form__label flex-40">Without localized thousand separator</label>
3432
<kbq-form-field class="kbq-form__control flex-60">
3533
<input
36-
kbqInput
37-
type="number"
34+
kbqNumberInput
3835
[withThousandSeparator]="false"
3936
[(ngModel)]="value"
4037
/>

tools/public_api_guard/components/input.api.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ export class KbqInput extends KbqInputMixinBase implements KbqFormFieldControl<a
104104
get value(): string;
105105
set value(value: string);
106106
// (undocumented)
107-
static ɵdir: i0.ɵɵDirectiveDeclaration<KbqInput, "input[kbqInput]", ["kbqInput"], { "errorStateMatcher": { "alias": "errorStateMatcher"; "required": false; }; "placeholder": { "alias": "placeholder"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "id": { "alias": "id"; "required": false; }; "required": { "alias": "required"; "required": false; }; "type": { "alias": "type"; "required": false; }; "value": { "alias": "value"; "required": false; }; }, {}, never, never, false, never>;
107+
static ɵdir: i0.ɵɵDirectiveDeclaration<KbqInput, "input[kbqInput],input[kbqNumberInput]", ["kbqInput"], { "errorStateMatcher": { "alias": "errorStateMatcher"; "required": false; }; "placeholder": { "alias": "placeholder"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "id": { "alias": "id"; "required": false; }; "required": { "alias": "required"; "required": false; }; "type": { "alias": "type"; "required": false; }; "value": { "alias": "value"; "required": false; }; }, {}, never, never, false, never>;
108108
// (undocumented)
109109
static ɵfac: i0.ɵɵFactoryDeclaration<KbqInput, [null, { optional: true; self: true; }, { optional: true; self: true; }, { optional: true; }, { optional: true; }, null, { optional: true; self: true; }]>;
110110
}
@@ -276,7 +276,7 @@ export class KbqNumberInput implements KbqFormFieldControl<any>, ControlValueAcc
276276
// (undocumented)
277277
writeValue(value: number | null): void;
278278
// (undocumented)
279-
static ɵdir: i0.ɵɵDirectiveDeclaration<KbqNumberInput, "input[kbqInput][type=\"number\"]", ["kbqNumericalInput"], { "bigStep": { "alias": "bigStep"; "required": false; }; "step": { "alias": "step"; "required": false; }; "min": { "alias": "min"; "required": false; }; "max": { "alias": "max"; "required": false; }; "withThousandSeparator": { "alias": "withThousandSeparator"; "required": false; }; "startFormattingFrom": { "alias": "startFormattingFrom"; "required": false; }; "value": { "alias": "value"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; }, {}, never, never, false, never>;
279+
static ɵdir: i0.ɵɵDirectiveDeclaration<KbqNumberInput, "input[kbqNumberInput]", ["kbqNumericalInput"], { "bigStep": { "alias": "bigStep"; "required": false; }; "step": { "alias": "step"; "required": false; }; "min": { "alias": "min"; "required": false; }; "max": { "alias": "max"; "required": false; }; "withThousandSeparator": { "alias": "withThousandSeparator"; "required": false; }; "startFormattingFrom": { "alias": "startFormattingFrom"; "required": false; }; "value": { "alias": "value"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; }, {}, never, never, false, never>;
280280
// (undocumented)
281281
static ɵfac: i0.ɵɵFactoryDeclaration<KbqNumberInput, [null, null, { attribute: "step"; }, { attribute: "big-step"; }, { attribute: "min"; }, { attribute: "max"; }, { optional: true; }]>;
282282
}

0 commit comments

Comments
 (0)