yukit 1.3.4 → 1.4.0

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/types/yukit.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { EventEmitter, AfterViewInit } from '@angular/core';
2
+ import { OnChanges, EventEmitter, SimpleChanges, AfterViewInit, InjectionToken } from '@angular/core';
3
3
  import * as i17 from '@ionic/angular';
4
4
  import { IonInput, IonSearchbar } from '@ionic/angular';
5
5
  import * as i15 from '@angular/common';
@@ -55,18 +55,24 @@ type YuInputTypeDto = 'date' | 'datetime-local' | 'email' | 'month' | 'number' |
55
55
 
56
56
  type YuInputModeDto = 'decimal' | 'email' | 'none' | 'numeric' | 'search' | 'tel' | 'text' | 'url' | 'password' | undefined;
57
57
 
58
- declare class InputComponent {
58
+ type YuInputAppearanceDto = 'outline' | 'inline';
59
+
60
+ declare class InputComponent implements OnChanges {
59
61
  input: IonInput;
60
62
  label?: string;
61
63
  placeholder?: string;
64
+ appearance: YuInputAppearanceDto;
62
65
  disabled: boolean;
63
- type: YuInputTypeDto;
66
+ readonly: boolean;
67
+ type: YuInputTypeDto | 'decimal';
64
68
  inputmode: YuInputModeDto;
65
69
  autocapitalize: string;
66
70
  min?: number | string;
67
71
  max?: number | string;
68
72
  minlength: number | string | null;
69
73
  maxlength: number | string | null;
74
+ decimals: number;
75
+ allowNegative: boolean;
70
76
  helperText?: string;
71
77
  isIncorrectValue: boolean;
72
78
  passwordToggle: boolean;
@@ -74,9 +80,37 @@ declare class InputComponent {
74
80
  valueChange: EventEmitter<any>;
75
81
  yuBlur: EventEmitter<any>;
76
82
  yuFocus: EventEmitter<any>;
83
+ decimalText: string;
84
+ private decimalEdited;
85
+ private minValue;
86
+ private maxValue;
87
+ get isInline(): boolean;
88
+ get isDecimal(): boolean;
89
+ get nativeType(): YuInputTypeDto;
90
+ get nativeInputmode(): YuInputModeDto;
91
+ private readonly decimalSeparator;
92
+ ngOnChanges(changes: SimpleChanges): void;
77
93
  setFocus(): void;
94
+ onModelChange(text: string | null): void;
95
+ onBlur(): void;
96
+ /** Rewrites the text only when it no longer represents the value received, so typing is never overwritten. */
97
+ private syncDecimalText;
98
+ /** Re-applies decimals/allowNegative to the current text when they change at runtime. */
99
+ private applyDecimalRules;
100
+ /** Completes the typed text on blur ("12," → "12", "-" → "", "12.5" → "12,5") and applies min/max. */
101
+ private completeDecimalText;
102
+ private sanitizeDecimal;
103
+ /**
104
+ * A value beyond a bound that typing more digits can only move further away from
105
+ * (above a non-negative max or below a non-positive min) is corrected while typing.
106
+ * Other bounds are applied on blur, since "5" may still become "50" with min 10.
107
+ */
108
+ private isOutOfRangeForGood;
109
+ private clamp;
110
+ /** Emits only when the number changes: typing "12," or "12,0" after "12" emits nothing. */
111
+ private emitDecimal;
78
112
  static ɵfac: i0.ɵɵFactoryDeclaration<InputComponent, never>;
79
- static ɵcmp: i0.ɵɵComponentDeclaration<InputComponent, "yu-input", never, { "label": { "alias": "label"; "required": false; }; "placeholder": { "alias": "placeholder"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "type": { "alias": "type"; "required": false; }; "inputmode": { "alias": "inputmode"; "required": false; }; "autocapitalize": { "alias": "autocapitalize"; "required": false; }; "min": { "alias": "min"; "required": false; }; "max": { "alias": "max"; "required": false; }; "minlength": { "alias": "minlength"; "required": false; }; "maxlength": { "alias": "maxlength"; "required": false; }; "helperText": { "alias": "helperText"; "required": false; }; "isIncorrectValue": { "alias": "isIncorrectValue"; "required": false; }; "passwordToggle": { "alias": "passwordToggle"; "required": false; }; "value": { "alias": "value"; "required": false; }; }, { "valueChange": "valueChange"; "yuBlur": "yuBlur"; "yuFocus": "yuFocus"; }, never, ["*"], false, never>;
113
+ static ɵcmp: i0.ɵɵComponentDeclaration<InputComponent, "yu-input", never, { "label": { "alias": "label"; "required": false; }; "placeholder": { "alias": "placeholder"; "required": false; }; "appearance": { "alias": "appearance"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "readonly": { "alias": "readonly"; "required": false; }; "type": { "alias": "type"; "required": false; }; "inputmode": { "alias": "inputmode"; "required": false; }; "autocapitalize": { "alias": "autocapitalize"; "required": false; }; "min": { "alias": "min"; "required": false; }; "max": { "alias": "max"; "required": false; }; "minlength": { "alias": "minlength"; "required": false; }; "maxlength": { "alias": "maxlength"; "required": false; }; "decimals": { "alias": "decimals"; "required": false; }; "allowNegative": { "alias": "allowNegative"; "required": false; }; "helperText": { "alias": "helperText"; "required": false; }; "isIncorrectValue": { "alias": "isIncorrectValue"; "required": false; }; "passwordToggle": { "alias": "passwordToggle"; "required": false; }; "value": { "alias": "value"; "required": false; }; }, { "valueChange": "valueChange"; "yuBlur": "yuBlur"; "yuFocus": "yuFocus"; }, never, ["*"], false, never>;
80
114
  }
81
115
 
82
116
  declare class ButtonComponent {
@@ -178,7 +212,7 @@ declare class NoticeComponent {
178
212
  icon: string;
179
213
  color: YuColorDto;
180
214
  static ɵfac: i0.ɵɵFactoryDeclaration<NoticeComponent, never>;
181
- static ɵcmp: i0.ɵɵComponentDeclaration<NoticeComponent, "yu-notice", never, { "title": { "alias": "title"; "required": false; }; "message": { "alias": "message"; "required": false; }; "icon": { "alias": "icon"; "required": false; }; "color": { "alias": "color"; "required": false; }; }, {}, never, ["yuAction"], false, never>;
215
+ static ɵcmp: i0.ɵɵComponentDeclaration<NoticeComponent, "yu-notice", never, { "title": { "alias": "title"; "required": false; }; "message": { "alias": "message"; "required": false; }; "icon": { "alias": "icon"; "required": false; }; "color": { "alias": "color"; "required": false; }; }, {}, never, ["[yuAction]"], false, never>;
182
216
  }
183
217
 
184
218
  declare class YukitModule {
@@ -187,5 +221,40 @@ declare class YukitModule {
187
221
  static ɵinj: i0.ɵɵInjectorDeclaration<YukitModule>;
188
222
  }
189
223
 
190
- export { AvatarComponent, BadgeComponent, ButtonComponent, CheckboxComponent, ChipComponent, HelperComponent, IconComponent, InputComponent, ListActionComponent, NoticeComponent, SearchbarComponent, TagComponent, TextareaComponent, ToggleComponent, YukitModule };
191
- export type { YuColorDto, YuInputModeDto, YuInputTypeDto, YuSizeDto };
224
+ type YuDecimalSeparatorDto = ',' | '.';
225
+ interface YuSanitizeDecimalOptions {
226
+ decimals: number;
227
+ allowNegative: boolean;
228
+ }
229
+ declare class YuNumberUtils {
230
+ private static readonly DOT_GROUPED;
231
+ private static readonly COMMA_GROUPED;
232
+ /**
233
+ * Parses a number typed with a comma or a dot as decimal separator.
234
+ * Returns null when the value is empty, incomplete ("-", ",") or not a number.
235
+ */
236
+ static parse(value: number | string | null | undefined): number | null;
237
+ /**
238
+ * Formats a number for display with the given decimal separator,
239
+ * rounded to at most `decimals` fraction digits and without trailing zeros.
240
+ */
241
+ static format(value: number | null | undefined, separator?: YuDecimalSeparatorDto, decimals?: number): string;
242
+ /**
243
+ * Keeps only what a decimal field accepts while typing: digits, a single separator
244
+ * at most `decimals` fraction digits and a leading minus when negatives are allowed.
245
+ * With `decimals` 0 the separator is kept and everything typed after it is ignored ("12,5" → "12,").
246
+ * Pasted values with thousands separators keep their full value ("1.234,56" → "1234,56").
247
+ */
248
+ static sanitize(value: string | null | undefined, options: YuSanitizeDecimalOptions): string;
249
+ /**
250
+ * Removes thousands separators when the text is clearly grouped in thousands:
251
+ * "1.234,56", "1,234.56", "1.234.567" or "1,234,567". A single group without a decimal part
252
+ * ("1.500", "12,345") is ambiguous and is left as a decimal number, except in integer fields.
253
+ */
254
+ private static stripThousands;
255
+ }
256
+
257
+ declare const YU_DECIMAL_SEPARATOR: InjectionToken<YuDecimalSeparatorDto>;
258
+
259
+ export { AvatarComponent, BadgeComponent, ButtonComponent, CheckboxComponent, ChipComponent, HelperComponent, IconComponent, InputComponent, ListActionComponent, NoticeComponent, SearchbarComponent, TagComponent, TextareaComponent, ToggleComponent, YU_DECIMAL_SEPARATOR, YuNumberUtils, YukitModule };
260
+ export type { YuColorDto, YuDecimalSeparatorDto, YuInputAppearanceDto, YuInputModeDto, YuInputTypeDto, YuSanitizeDecimalOptions, YuSizeDto };