@tsi-developpement/tsi-shared-ui 1.9.2 → 1.9.3

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.
@@ -3,4 +3,4 @@ import { FormStateService } from "../services/form/form-state.service";
3
3
  import { PresentationDesignerBaseService } from "../services/presentation-setting/presentation-designer-base.service";
4
4
  import { GenericValidationStateService } from "../services/validation/generic-validation-state.service";
5
5
  import { InputRegistryService } from "../services/validation/input-registry.service";
6
- export declare const appProviders: (typeof GenericValidationStateService | typeof PresentationDesignerBaseService | typeof InputRegistryService | typeof FormStateService | typeof DynamicFormService)[];
6
+ export declare const appProviders: (typeof PresentationDesignerBaseService | typeof GenericValidationStateService | typeof InputRegistryService | typeof DynamicFormService | typeof FormStateService)[];
@@ -1,16 +1,37 @@
1
- import { EventEmitter, OnInit } from '@angular/core';
1
+ import { EventEmitter } from '@angular/core';
2
2
  import { TsiInputBase } from '../../../tsi-base/tsi-input-base/tsi-input-base.component';
3
3
  import * as i0 from "@angular/core";
4
- export declare class TsiRateInputComponent extends TsiInputBase<number | undefined> implements OnInit {
4
+ export declare class TsiRateInputComponent extends TsiInputBase<number | undefined> {
5
5
  required?: boolean;
6
+ /**
7
+ * Governs how the percentage the user sees/edits relates to the value stored in the model.
8
+ * The user always reads and types a percentage; this flag only changes what is persisted.
9
+ *
10
+ * - false (default): "2 %" on screen is stored as the whole percent `2`.
11
+ * - true : "2 %" on screen is stored as the fraction `0.02`.
12
+ *
13
+ * Must match the `isFraction` given to the mirror `Tsi-Rate-Display` so the pair
14
+ * interprets a stored value identically.
15
+ */
6
16
  isFraction?: boolean;
7
17
  numOfDecimal?: number;
8
18
  newItemEvent: EventEmitter<number>;
9
19
  inputFieldChange: EventEmitter<number>;
10
20
  private isValueChanged;
11
- ngOnInit(): void;
21
+ /**
22
+ * The percentage shown in / typed into the p-inputNumber. It is a view-only
23
+ * projection of the stored model value (`inputField`), converted according to
24
+ * `isFraction`. The model remains the single source of truth.
25
+ */
26
+ get displayValue(): number | undefined;
12
27
  valueChanged(event: any): void;
13
28
  onChangeofOptions(): void;
29
+ /** stored model value -> on-screen percentage */
30
+ private toDisplay;
31
+ /** on-screen percentage -> stored model value */
32
+ private toModel;
33
+ /** Rounds to a fixed number of decimals, guarding against binary-float drift introduced by the x100 conversion. */
34
+ private round;
14
35
  static ɵfac: i0.ɵɵFactoryDeclaration<TsiRateInputComponent, never>;
15
36
  static ɵcmp: i0.ɵɵComponentDeclaration<TsiRateInputComponent, "Tsi-Rate-Input", never, { "required": { "alias": "required"; "required": false; }; "isFraction": { "alias": "isFraction"; "required": false; }; "numOfDecimal": { "alias": "numOfDecimal"; "required": false; }; }, { "newItemEvent": "newItemEvent"; "inputFieldChange": "inputFieldChange"; }, never, never, false, never>;
16
37
  }
@@ -3,11 +3,17 @@ import * as i0 from "@angular/core";
3
3
  export declare class TsiRateDisplayComponent {
4
4
  private _localizationService;
5
5
  protected locale: LocaleCode;
6
+ /**
7
+ * How to interpret `inputData` as a percentage. Must match the `isFraction`
8
+ * of the mirror `Tsi-Rate-Input`.
9
+ * - false (default): `inputData` is a whole percent (`2` shows as "2 %").
10
+ * - true : `inputData` is a fraction (`0.02` shows as "2 %").
11
+ */
6
12
  isFraction: boolean;
7
13
  inputData?: number;
8
14
  numOfDecimal?: number;
9
15
  constructor();
10
- getToFraction(): number;
16
+ getToFraction(): number | null;
11
17
  getFormat(): string;
12
18
  static ɵfac: i0.ɵɵFactoryDeclaration<TsiRateDisplayComponent, never>;
13
19
  static ɵcmp: i0.ɵɵComponentDeclaration<TsiRateDisplayComponent, "Tsi-Rate-Display", never, { "isFraction": { "alias": "isFraction"; "required": false; }; "inputData": { "alias": "inputData"; "required": false; }; "numOfDecimal": { "alias": "numOfDecimal"; "required": false; }; }, {}, never, never, false, never>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsi-developpement/tsi-shared-ui",
3
- "version": "1.9.2",
3
+ "version": "1.9.3",
4
4
  "author": "TSI",
5
5
  "license": "MIT",
6
6
  "peerDependencies": {