@area8975/ui 0.1.1-dev.19 → 0.1.1-dev.22

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@area8975/ui",
3
- "version": "0.1.1-dev.19",
3
+ "version": "0.1.1-dev.22",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^22.0.0",
6
6
  "@angular/core": "^22.0.0",
@@ -76,6 +76,7 @@ export type ChartValueFormatter = (value: number) => string;
76
76
  /** Inputs every chart with categories along one axis and values up the other shares. */
77
77
  declare abstract class UiAxisChartBase implements ChartLegendSource {
78
78
  protected readonly uiFormat: import("@area8975/ui").UiFormat;
79
+ private readonly privacy;
79
80
  protected readonly dark: import("@angular/core").WritableSignal<boolean>;
80
81
  protected readonly ink: import("@angular/core").Signal<import("@area8975/ui").ChartInk>;
81
82
  readonly series: import("@angular/core").InputSignal<ChartSeries[]>;
@@ -85,6 +86,8 @@ declare abstract class UiAxisChartBase implements ChartLegendSource {
85
86
  readonly height: import("@angular/core").InputSignal<ChartHeight>;
86
87
  /** Used on the value axis, the tooltip and the table, e.g. to show money. */
87
88
  readonly valueFormatter: import("@angular/core").InputSignal<ChartValueFormatter>;
89
+ /** Masks the values in privacy mode. Defaults to whether `valueFormatter` came from `injectMoneyFormatter`. */
90
+ readonly sensitive: import("@angular/core").InputSignalWithTransform<boolean | undefined, unknown>;
88
91
  /** Heading for the category column in the data table. */
89
92
  readonly categoryLabel: import("@angular/core").InputSignal<string>;
90
93
  readonly loading: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
@@ -107,6 +110,11 @@ declare abstract class UiAxisChartBase implements ChartLegendSource {
107
110
  readonly emphasis: import("@angular/core").WritableSignal<string | null>;
108
111
  /** Charts that draw lines can tell series apart by dashes too, bars can't. */
109
112
  protected readonly supportsDashes: boolean;
113
+ private readonly money;
114
+ protected readonly privacyMode: import("@angular/core").Signal<"visible" | "discreet" | "hidden">;
115
+ protected readonly masked: import("@angular/core").Signal<boolean>;
116
+ protected readonly concealed: import("@angular/core").Signal<boolean>;
117
+ protected readonly displayFormatter: import("@angular/core").Signal<ChartValueFormatter>;
110
118
  protected readonly apexHeight: import("@angular/core").Signal<number | "100%">;
111
119
  protected readonly isEmpty: import("@angular/core").Signal<boolean>;
112
120
  protected readonly isMuted: import("@angular/core").Signal<boolean[]>;
@@ -145,6 +153,11 @@ declare abstract class UiAxisChartBase implements ChartLegendSource {
145
153
  "required": false;
146
154
  "isSignal": true;
147
155
  };
156
+ "sensitive": {
157
+ "alias": "sensitive";
158
+ "required": false;
159
+ "isSignal": true;
160
+ };
148
161
  "categoryLabel": {
149
162
  "alias": "categoryLabel";
150
163
  "required": false;
@@ -280,6 +293,7 @@ export declare class UiChartFrameComponent {
280
293
  readonly loading: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
281
294
  readonly empty: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
282
295
  readonly showTable: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
296
+ readonly masked: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
283
297
  readonly showLegend: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
284
298
  /** The series the legend is pointing at, the others fade while it's set. */
285
299
  readonly emphasis: import("@angular/core").ModelSignal<string | null>;
@@ -357,6 +371,11 @@ export declare class UiChartFrameComponent {
357
371
  "required": false;
358
372
  "isSignal": true;
359
373
  };
374
+ "masked": {
375
+ "alias": "masked";
376
+ "required": false;
377
+ "isSignal": true;
378
+ };
360
379
  "showLegend": {
361
380
  "alias": "showLegend";
362
381
  "required": false;
@@ -383,6 +402,9 @@ export declare class UiChartTableComponent {
383
402
  readonly valueFormatter: import("@angular/core").InputSignal<ChartValueFormatter>;
384
403
  readonly categoryLabel: import("@angular/core").InputSignal<string>;
385
404
  readonly visible: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
405
+ /** Values are masks, screen readers hear "amount hidden" instead. */
406
+ readonly masked: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
407
+ protected isValue(value: number | null | undefined): value is number;
386
408
  protected format(value: number | null | undefined): string;
387
409
  static ɵfac: i0.ɵɵFactoryDeclaration<UiChartTableComponent, never>;
388
410
  static ɵcmp: i0.ɵɵComponentDeclaration<UiChartTableComponent, "ui-chart-table", never, {
@@ -416,6 +438,11 @@ export declare class UiChartTableComponent {
416
438
  "required": false;
417
439
  "isSignal": true;
418
440
  };
441
+ "masked": {
442
+ "alias": "masked";
443
+ "required": false;
444
+ "isSignal": true;
445
+ };
419
446
  }, {}, never, never, true, never>;
420
447
  }
421
448
  /**
@@ -577,8 +604,21 @@ export interface UiFormat {
577
604
  export declare const UI_FORMAT_DEFAULTS: UiFormat;
578
605
  export declare const UI_FORMAT: InjectionToken<UiFormat>;
579
606
  export declare function provideUiFormat(format: Partial<UiFormat>): Provider;
580
- /** Needs an injection context, e.g. a component field. */
607
+ export interface MoneyFormatterParts {
608
+ format: (value: number) => string;
609
+ mask: string;
610
+ }
611
+ /** The unmasked formatter and mask behind a formatter from `injectMoneyFormatter`, null for any other function. */
612
+ export declare function moneyFormatterParts(formatter: (value: number) => string): MoneyFormatterParts | null;
613
+ /** Needs an injection context. Reads `UI_PRIVACY` on every call, so a template or computed calling it follows the mode. */
581
614
  export declare function injectMoneyFormatter(options?: Intl.NumberFormatOptions): (value: number) => string;
615
+ export declare const UiPrivacies: readonly ["visible", "discreet", "hidden"];
616
+ /** Discreet hides amounts but keeps their shape, hidden hides everything about them. */
617
+ export type UiPrivacy = typeof UiPrivacies[number];
618
+ export declare const UI_PRIVACY: InjectionToken<Signal<"visible" | "discreet" | "hidden">>;
619
+ /** The factory runs in an injection context, so it can return a signal from an app service. */
620
+ export declare function provideUiPrivacy(privacy: () => Signal<UiPrivacy>): Provider;
621
+ export declare function maskMoney(currency: string, locale: string): string;
582
622
  /** Native type values ui-input supports. File/checkbox/radio/range need their own components. */
583
623
  export declare const InputTypes: readonly ["text", "email", "tel", "url", "search", "password", "number", "date", "time", "datetime-local", "month", "week", "color"];
584
624
  /** @see {@link InputTypes} */
@@ -1841,7 +1881,7 @@ export declare class UiCardHeaderComponent {
1841
1881
  readonly heading: import("@angular/core").InputSignal<string>;
1842
1882
  readonly subtitle: import("@angular/core").InputSignal<string>;
1843
1883
  /** Pick the level that fits the page's outline, it doesn't change the look. */
1844
- readonly headingLevel: import("@angular/core").InputSignal<2 | 3 | 4>;
1884
+ readonly headingLevel: import("@angular/core").InputSignal<3 | 2 | 4>;
1845
1885
  static ɵfac: i0.ɵɵFactoryDeclaration<UiCardHeaderComponent, never>;
1846
1886
  static ɵcmp: i0.ɵɵComponentDeclaration<UiCardHeaderComponent, "ui-card-header", never, {
1847
1887
  "heading": {
@@ -2042,6 +2082,7 @@ export declare class UiModalComponent {
2042
2082
  */
2043
2083
  export declare class UiMoneyComponent {
2044
2084
  private readonly defaults;
2085
+ private readonly privacy;
2045
2086
  readonly value: import("@angular/core").InputSignal<number | null>;
2046
2087
  /** Defaults to the currency from `provideUiFormat`. */
2047
2088
  readonly currency: import("@angular/core").InputSignal<string>;
@@ -2057,6 +2098,8 @@ export declare class UiMoneyComponent {
2057
2098
  /** Shown when there's no value. */
2058
2099
  readonly placeholder: import("@angular/core").InputSignal<string>;
2059
2100
  private readonly amount;
2101
+ protected readonly masked: import("@angular/core").Signal<boolean>;
2102
+ protected readonly mask: import("@angular/core").Signal<string>;
2060
2103
  protected readonly formatted: import("@angular/core").Signal<string>;
2061
2104
  protected readonly title: import("@angular/core").Signal<string | null>;
2062
2105
  readonly generatedClasses: import("@angular/core").Signal<string>;
@@ -2409,7 +2452,7 @@ export interface TableColumn<Row> {
2409
2452
  accessor: (row: Row) => unknown;
2410
2453
  /** how the cell value is formatted for display, defaults to plain text */
2411
2454
  displayType?: TableColumnDisplayType;
2412
- /** ISO currency code, used when displayType is 'currency' */
2455
+ /** ISO currency code, used when displayType is 'currency'. Defaults to the currency from `provideUiFormat`. */
2413
2456
  currency?: string;
2414
2457
  sortable?: boolean;
2415
2458
  filterable?: boolean;
@@ -2530,6 +2573,7 @@ export declare class UiTableComponent<Row = unknown> implements OnInit, OnDestro
2530
2573
  private readonly destroyRef;
2531
2574
  private readonly cdr;
2532
2575
  private readonly registry;
2576
+ protected readonly uiFormat: import("@area8975/ui").UiFormat;
2533
2577
  private loadedQuery;
2534
2578
  private loadedFilters;
2535
2579
  private resizeState;
@@ -2541,6 +2585,7 @@ export declare class UiTableComponent<Row = unknown> implements OnInit, OnDestro
2541
2585
  reload(): void;
2542
2586
  protected cellValue(column: TableColumn<Row>, row: Row): unknown;
2543
2587
  protected cellIconValue(column: TableColumn<Row>, row: Row): string;
2588
+ protected moneyCellValue(column: TableColumn<Row>, row: Row): number | null;
2544
2589
  protected formattedCellValue(column: TableColumn<Row>, row: Row): string;
2545
2590
  protected onQueryChange(value: string): void;
2546
2591
  protected filterValue(columnId: string): string;