@star-ng/ui 0.0.0-stage → 0.2.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/LICENSE +21 -0
- package/README.md +162 -2
- package/fesm2022/star-ng-ui-accordion.mjs +376 -0
- package/fesm2022/star-ng-ui-accordion.mjs.map +1 -0
- package/fesm2022/star-ng-ui-autocomplete.mjs +786 -0
- package/fesm2022/star-ng-ui-autocomplete.mjs.map +1 -0
- package/fesm2022/star-ng-ui-avatar.mjs +154 -0
- package/fesm2022/star-ng-ui-avatar.mjs.map +1 -0
- package/fesm2022/star-ng-ui-badge.mjs +153 -0
- package/fesm2022/star-ng-ui-badge.mjs.map +1 -0
- package/fesm2022/star-ng-ui-breadcrumb.mjs +199 -0
- package/fesm2022/star-ng-ui-breadcrumb.mjs.map +1 -0
- package/fesm2022/star-ng-ui-button.mjs +282 -0
- package/fesm2022/star-ng-ui-button.mjs.map +1 -0
- package/fesm2022/star-ng-ui-card.mjs +112 -0
- package/fesm2022/star-ng-ui-card.mjs.map +1 -0
- package/fesm2022/star-ng-ui-chart.mjs +1904 -0
- package/fesm2022/star-ng-ui-chart.mjs.map +1 -0
- package/fesm2022/star-ng-ui-checkbox.mjs +345 -0
- package/fesm2022/star-ng-ui-checkbox.mjs.map +1 -0
- package/fesm2022/star-ng-ui-core.mjs +484 -0
- package/fesm2022/star-ng-ui-core.mjs.map +1 -0
- package/fesm2022/star-ng-ui-data-display.mjs +1870 -0
- package/fesm2022/star-ng-ui-data-display.mjs.map +1 -0
- package/fesm2022/star-ng-ui-date-picker.mjs +2786 -0
- package/fesm2022/star-ng-ui-date-picker.mjs.map +1 -0
- package/fesm2022/star-ng-ui-dialog.mjs +948 -0
- package/fesm2022/star-ng-ui-dialog.mjs.map +1 -0
- package/fesm2022/star-ng-ui-drawer.mjs +158 -0
- package/fesm2022/star-ng-ui-drawer.mjs.map +1 -0
- package/fesm2022/star-ng-ui-editor.mjs +416 -0
- package/fesm2022/star-ng-ui-editor.mjs.map +1 -0
- package/fesm2022/star-ng-ui-field.mjs +378 -0
- package/fesm2022/star-ng-ui-field.mjs.map +1 -0
- package/fesm2022/star-ng-ui-file-upload.mjs +762 -0
- package/fesm2022/star-ng-ui-file-upload.mjs.map +1 -0
- package/fesm2022/star-ng-ui-i18n-de.mjs +179 -0
- package/fesm2022/star-ng-ui-i18n-de.mjs.map +1 -0
- package/fesm2022/star-ng-ui-i18n-es.mjs +179 -0
- package/fesm2022/star-ng-ui-i18n-es.mjs.map +1 -0
- package/fesm2022/star-ng-ui-input-group.mjs +188 -0
- package/fesm2022/star-ng-ui-input-group.mjs.map +1 -0
- package/fesm2022/star-ng-ui-input-mask.mjs +434 -0
- package/fesm2022/star-ng-ui-input-mask.mjs.map +1 -0
- package/fesm2022/star-ng-ui-input-number.mjs +691 -0
- package/fesm2022/star-ng-ui-input-number.mjs.map +1 -0
- package/fesm2022/star-ng-ui-input-otp.mjs +343 -0
- package/fesm2022/star-ng-ui-input-otp.mjs.map +1 -0
- package/fesm2022/star-ng-ui-input-tags.mjs +616 -0
- package/fesm2022/star-ng-ui-input-tags.mjs.map +1 -0
- package/fesm2022/star-ng-ui-knob.mjs +514 -0
- package/fesm2022/star-ng-ui-knob.mjs.map +1 -0
- package/fesm2022/star-ng-ui-layout.mjs +608 -0
- package/fesm2022/star-ng-ui-layout.mjs.map +1 -0
- package/fesm2022/star-ng-ui-listbox.mjs +886 -0
- package/fesm2022/star-ng-ui-listbox.mjs.map +1 -0
- package/fesm2022/star-ng-ui-media.mjs +833 -0
- package/fesm2022/star-ng-ui-media.mjs.map +1 -0
- package/fesm2022/star-ng-ui-menu.mjs +1840 -0
- package/fesm2022/star-ng-ui-menu.mjs.map +1 -0
- package/fesm2022/star-ng-ui-message.mjs +191 -0
- package/fesm2022/star-ng-ui-message.mjs.map +1 -0
- package/fesm2022/star-ng-ui-paginator.mjs +387 -0
- package/fesm2022/star-ng-ui-paginator.mjs.map +1 -0
- package/fesm2022/star-ng-ui-panel.mjs +324 -0
- package/fesm2022/star-ng-ui-panel.mjs.map +1 -0
- package/fesm2022/star-ng-ui-password.mjs +517 -0
- package/fesm2022/star-ng-ui-password.mjs.map +1 -0
- package/fesm2022/star-ng-ui-popover.mjs +241 -0
- package/fesm2022/star-ng-ui-popover.mjs.map +1 -0
- package/fesm2022/star-ng-ui-progress-bar.mjs +183 -0
- package/fesm2022/star-ng-ui-progress-bar.mjs.map +1 -0
- package/fesm2022/star-ng-ui-radio.mjs +411 -0
- package/fesm2022/star-ng-ui-radio.mjs.map +1 -0
- package/fesm2022/star-ng-ui-rating.mjs +211 -0
- package/fesm2022/star-ng-ui-rating.mjs.map +1 -0
- package/fesm2022/star-ng-ui-select-button.mjs +613 -0
- package/fesm2022/star-ng-ui-select-button.mjs.map +1 -0
- package/fesm2022/star-ng-ui-select.mjs +2547 -0
- package/fesm2022/star-ng-ui-select.mjs.map +1 -0
- package/fesm2022/star-ng-ui-skeleton.mjs +160 -0
- package/fesm2022/star-ng-ui-skeleton.mjs.map +1 -0
- package/fesm2022/star-ng-ui-slider.mjs +552 -0
- package/fesm2022/star-ng-ui-slider.mjs.map +1 -0
- package/fesm2022/star-ng-ui-spinner.mjs +148 -0
- package/fesm2022/star-ng-ui-spinner.mjs.map +1 -0
- package/fesm2022/star-ng-ui-stepper.mjs +360 -0
- package/fesm2022/star-ng-ui-stepper.mjs.map +1 -0
- package/fesm2022/star-ng-ui-table.mjs +3531 -0
- package/fesm2022/star-ng-ui-table.mjs.map +1 -0
- package/fesm2022/star-ng-ui-tabs.mjs +464 -0
- package/fesm2022/star-ng-ui-tabs.mjs.map +1 -0
- package/fesm2022/star-ng-ui-tag.mjs +129 -0
- package/fesm2022/star-ng-ui-tag.mjs.map +1 -0
- package/fesm2022/star-ng-ui-theme-switch.mjs +105 -0
- package/fesm2022/star-ng-ui-theme-switch.mjs.map +1 -0
- package/fesm2022/star-ng-ui-theme.mjs +98 -0
- package/fesm2022/star-ng-ui-theme.mjs.map +1 -0
- package/fesm2022/star-ng-ui-toast.mjs +298 -0
- package/fesm2022/star-ng-ui-toast.mjs.map +1 -0
- package/fesm2022/star-ng-ui-toggle-switch.mjs +316 -0
- package/fesm2022/star-ng-ui-toggle-switch.mjs.map +1 -0
- package/fesm2022/star-ng-ui-tooltip.mjs +297 -0
- package/fesm2022/star-ng-ui-tooltip.mjs.map +1 -0
- package/fesm2022/star-ng-ui-transloco.mjs +40 -0
- package/fesm2022/star-ng-ui-transloco.mjs.map +1 -0
- package/fesm2022/star-ng-ui-tree.mjs +1446 -0
- package/fesm2022/star-ng-ui-tree.mjs.map +1 -0
- package/fesm2022/star-ng-ui-utility.mjs +2134 -0
- package/fesm2022/star-ng-ui-utility.mjs.map +1 -0
- package/fesm2022/star-ng-ui.mjs +51 -0
- package/package.json +285 -3
- package/styles/_base.scss +70 -0
- package/styles/_shared.scss +2 -0
- package/styles/_tokens.scss +190 -0
- package/styles/controls/_accordion.scss +75 -0
- package/styles/controls/_autocomplete.scss +44 -0
- package/styles/controls/_avatar.scss +39 -0
- package/styles/controls/_breadcrumb.scss +45 -0
- package/styles/controls/_button.scss +137 -0
- package/styles/controls/_card.scss +38 -0
- package/styles/controls/_chart.scss +214 -0
- package/styles/controls/_chip.scss +51 -0
- package/styles/controls/_choice.scss +153 -0
- package/styles/controls/_data-display.scss +124 -0
- package/styles/controls/_date-picker.scss +300 -0
- package/styles/controls/_dialog.scss +123 -0
- package/styles/controls/_drawer.scss +118 -0
- package/styles/controls/_editor.scss +74 -0
- package/styles/controls/_field.scss +92 -0
- package/styles/controls/_file-upload.scss +136 -0
- package/styles/controls/_input-group.scss +104 -0
- package/styles/controls/_input-mask.scss +46 -0
- package/styles/controls/_input-number.scss +125 -0
- package/styles/controls/_knob.scss +76 -0
- package/styles/controls/_layout.scss +182 -0
- package/styles/controls/_listbox.scss +38 -0
- package/styles/controls/_media.scss +222 -0
- package/styles/controls/_menu.scss +254 -0
- package/styles/controls/_message.scss +48 -0
- package/styles/controls/_org-chart.scss +128 -0
- package/styles/controls/_paginator.scss +59 -0
- package/styles/controls/_panel.scss +83 -0
- package/styles/controls/_popover.scss +40 -0
- package/styles/controls/_progress-bar.scss +74 -0
- package/styles/controls/_select-button.scss +61 -0
- package/styles/controls/_select.scss +216 -0
- package/styles/controls/_skeleton.scss +43 -0
- package/styles/controls/_slider.scss +163 -0
- package/styles/controls/_spinner.scss +34 -0
- package/styles/controls/_stepper.scss +109 -0
- package/styles/controls/_table.scss +523 -0
- package/styles/controls/_tabs.scss +93 -0
- package/styles/controls/_tag.scss +84 -0
- package/styles/controls/_toast.scss +141 -0
- package/styles/controls/_tooltip.scss +14 -0
- package/styles/controls/_tree.scss +113 -0
- package/styles/controls/_utility.scss +654 -0
- package/styles/star-ng.css +5807 -0
- package/styles/star-ng.min.css +1 -0
- package/styles/star-ng.scss +50 -0
- package/theme/star-theme-first-paint.js +1 -0
- package/types/star-ng-ui-accordion.d.ts +82 -0
- package/types/star-ng-ui-autocomplete.d.ts +171 -0
- package/types/star-ng-ui-avatar.d.ts +43 -0
- package/types/star-ng-ui-badge.d.ts +46 -0
- package/types/star-ng-ui-breadcrumb.d.ts +39 -0
- package/types/star-ng-ui-button.d.ts +79 -0
- package/types/star-ng-ui-card.d.ts +29 -0
- package/types/star-ng-ui-chart.d.ts +337 -0
- package/types/star-ng-ui-checkbox.d.ts +92 -0
- package/types/star-ng-ui-core.d.ts +373 -0
- package/types/star-ng-ui-data-display.d.ts +438 -0
- package/types/star-ng-ui-date-picker.d.ts +701 -0
- package/types/star-ng-ui-dialog.d.ts +254 -0
- package/types/star-ng-ui-drawer.d.ts +29 -0
- package/types/star-ng-ui-editor.d.ts +96 -0
- package/types/star-ng-ui-field.d.ts +146 -0
- package/types/star-ng-ui-file-upload.d.ts +192 -0
- package/types/star-ng-ui-i18n-de.d.ts +7 -0
- package/types/star-ng-ui-i18n-es.d.ts +7 -0
- package/types/star-ng-ui-input-group.d.ts +58 -0
- package/types/star-ng-ui-input-mask.d.ts +126 -0
- package/types/star-ng-ui-input-number.d.ts +193 -0
- package/types/star-ng-ui-input-otp.d.ts +86 -0
- package/types/star-ng-ui-input-tags.d.ts +159 -0
- package/types/star-ng-ui-knob.d.ts +121 -0
- package/types/star-ng-ui-layout.d.ts +154 -0
- package/types/star-ng-ui-listbox.d.ts +170 -0
- package/types/star-ng-ui-media.d.ts +161 -0
- package/types/star-ng-ui-menu.d.ts +332 -0
- package/types/star-ng-ui-message.d.ts +52 -0
- package/types/star-ng-ui-paginator.d.ts +85 -0
- package/types/star-ng-ui-panel.d.ts +65 -0
- package/types/star-ng-ui-password.d.ts +129 -0
- package/types/star-ng-ui-popover.d.ts +57 -0
- package/types/star-ng-ui-progress-bar.d.ts +49 -0
- package/types/star-ng-ui-radio.d.ts +116 -0
- package/types/star-ng-ui-rating.d.ts +52 -0
- package/types/star-ng-ui-select-button.d.ts +169 -0
- package/types/star-ng-ui-select.d.ts +563 -0
- package/types/star-ng-ui-skeleton.d.ts +47 -0
- package/types/star-ng-ui-slider.d.ts +145 -0
- package/types/star-ng-ui-spinner.d.ts +29 -0
- package/types/star-ng-ui-stepper.d.ts +89 -0
- package/types/star-ng-ui-table.d.ts +885 -0
- package/types/star-ng-ui-tabs.d.ts +109 -0
- package/types/star-ng-ui-tag.d.ts +35 -0
- package/types/star-ng-ui-theme-switch.d.ts +36 -0
- package/types/star-ng-ui-theme.d.ts +95 -0
- package/types/star-ng-ui-toast.d.ts +84 -0
- package/types/star-ng-ui-toggle-switch.d.ts +81 -0
- package/types/star-ng-ui-tooltip.d.ts +66 -0
- package/types/star-ng-ui-transloco.d.ts +14 -0
- package/types/star-ng-ui-tree.d.ts +343 -0
- package/types/star-ng-ui-utility.d.ts +533 -0
- package/types/star-ng-ui.d.ts +51 -0
|
@@ -0,0 +1,885 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { TemplateRef } from "@angular/core";
|
|
3
|
+
import { StarOptionKey } from "@star-ng/ui/core";
|
|
4
|
+
export interface StarColumn<T> {
|
|
5
|
+
/** Unique column id; also the property read when `value` is not set. */
|
|
6
|
+
readonly field: string;
|
|
7
|
+
readonly header: string;
|
|
8
|
+
/** Cell value accessor (default: `row[field]`). Used for display, sort and filter. */
|
|
9
|
+
readonly value?: (row: T) => unknown;
|
|
10
|
+
/** Display text (default: `String(value)`). */
|
|
11
|
+
readonly format?: (row: T) => string;
|
|
12
|
+
readonly sortable?: boolean;
|
|
13
|
+
readonly width?: string;
|
|
14
|
+
readonly align?: 'start' | 'center' | 'end';
|
|
15
|
+
/**
|
|
16
|
+
* Column filter, shown in a second header row.
|
|
17
|
+
* - `'text'`: the display text contains the query (case- and accent-insensitive).
|
|
18
|
+
* - `'select'`: the display text equals the choice.
|
|
19
|
+
* - `'multiselect'`: the display text is one of the choices (value: text list).
|
|
20
|
+
* - `'number'`: the cell value is in a range (value: `{ min, max }` numbers).
|
|
21
|
+
* - `'date'`: the cell day is in a range (value: `{ min, max }` as `yyyy-mm-dd`).
|
|
22
|
+
*/
|
|
23
|
+
readonly filter?: 'text' | 'select' | 'multiselect' | 'number' | 'date';
|
|
24
|
+
/** Choices of a `'select'` or `'multiselect'` filter (default: the distinct display texts in `value`, sorted). */
|
|
25
|
+
readonly filterOptions?: readonly string[];
|
|
26
|
+
/** `false` leaves the column out of every export (CSV, Excel, print). */
|
|
27
|
+
readonly exportable?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Cell value in an export. Use it for a column with a custom cell template, where the
|
|
30
|
+
* display text is not what the user sees. A number stays a number in Excel.
|
|
31
|
+
*/
|
|
32
|
+
readonly exportValue?: (row: T) => string | number | null | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* Keeps the column in view when the table scrolls sideways. Frozen columns come first.
|
|
35
|
+
* The table measures the frozen columns to position the next one, so `width` is optional.
|
|
36
|
+
*/
|
|
37
|
+
readonly frozen?: boolean;
|
|
38
|
+
/** `false`: the user cannot hide the column in the Columns panel. */
|
|
39
|
+
readonly hideable?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* The user can change the cell in place. The table does not change `value`: it emits
|
|
42
|
+
* `cellEdit`, and the owner stores the new value.
|
|
43
|
+
*/
|
|
44
|
+
readonly editable?: boolean | ((row: T) => boolean);
|
|
45
|
+
/** Editor of an editable cell (default `'text'`). `'number'` emits a number or `null`. */
|
|
46
|
+
readonly editor?: 'text' | 'number' | 'select';
|
|
47
|
+
/** Choices of a `'select'` editor. */
|
|
48
|
+
readonly editOptions?: readonly string[];
|
|
49
|
+
/**
|
|
50
|
+
* Footer cell: fixed text, or a function of the filtered rows (all pages), for a total or
|
|
51
|
+
* an average. The table has a footer row when one column has a footer.
|
|
52
|
+
*/
|
|
53
|
+
readonly footer?: string | ((rows: readonly T[]) => string);
|
|
54
|
+
}
|
|
55
|
+
export interface StarCellEditEvent<T> {
|
|
56
|
+
readonly row: T;
|
|
57
|
+
readonly field: string;
|
|
58
|
+
/** New value: text, or a number / `null` for the `'number'` editor. */
|
|
59
|
+
readonly value: string | number | null;
|
|
60
|
+
readonly previous: unknown;
|
|
61
|
+
}
|
|
62
|
+
/** Range of a `'number'` filter (numbers) or a `'date'` filter (`yyyy-mm-dd` text). */
|
|
63
|
+
export interface StarRangeFilter {
|
|
64
|
+
readonly min?: number | string | null;
|
|
65
|
+
readonly max?: number | string | null;
|
|
66
|
+
}
|
|
67
|
+
/** Text (`'text'`, `'select'`), text list (`'multiselect'`) or range (`'number'`, `'date'`). */
|
|
68
|
+
export type StarFilterValue = string | readonly string[] | StarRangeFilter;
|
|
69
|
+
/** Column filter values by column `field`. An empty or missing value means "no filter". */
|
|
70
|
+
export type StarColumnFilters = Readonly<Record<string, StarFilterValue>>;
|
|
71
|
+
export interface StarExportOptions<T = unknown> {
|
|
72
|
+
/** File name without extension (default `export`). */
|
|
73
|
+
readonly fileName?: string;
|
|
74
|
+
/** Export the selected rows only (default: all filtered rows, in the current sort order). */
|
|
75
|
+
readonly selectionOnly?: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Rows to export instead of the table rows. Use it in lazy mode, where the table holds one
|
|
78
|
+
* page: load all rows from the server and pass them here.
|
|
79
|
+
*/
|
|
80
|
+
readonly rows?: readonly T[];
|
|
81
|
+
/** Sheet name (Excel) or heading (print). Default: the table `ariaLabel`. */
|
|
82
|
+
readonly title?: string;
|
|
83
|
+
}
|
|
84
|
+
export interface StarCsvOptions<T = unknown> extends StarExportOptions<T> {
|
|
85
|
+
/** Field separator (default `,`). */
|
|
86
|
+
readonly separator?: string;
|
|
87
|
+
}
|
|
88
|
+
/** One line of the table body: a spacer, a group heading, or a row with its detail row. */
|
|
89
|
+
type BodyEntry<T> = {
|
|
90
|
+
readonly kind: 'spacer';
|
|
91
|
+
readonly key: string;
|
|
92
|
+
readonly height: number;
|
|
93
|
+
} | {
|
|
94
|
+
readonly kind: 'group';
|
|
95
|
+
readonly key: string;
|
|
96
|
+
readonly label: string;
|
|
97
|
+
readonly count: number;
|
|
98
|
+
/** `aria-rowindex`, or null without virtual scroll. */
|
|
99
|
+
readonly aria: number | null;
|
|
100
|
+
/** Index in the virtual list (`data-vi`), or null without virtual scroll. */
|
|
101
|
+
readonly item: number | null;
|
|
102
|
+
} | {
|
|
103
|
+
readonly kind: 'row';
|
|
104
|
+
readonly key: unknown;
|
|
105
|
+
readonly row: T;
|
|
106
|
+
readonly index: number;
|
|
107
|
+
readonly aria: number | null;
|
|
108
|
+
readonly item: number | null;
|
|
109
|
+
};
|
|
110
|
+
export type StarSortOrder = 1 | -1;
|
|
111
|
+
export interface StarSortState {
|
|
112
|
+
readonly field: string | null;
|
|
113
|
+
readonly order: StarSortOrder;
|
|
114
|
+
}
|
|
115
|
+
export interface StarLazyLoadEvent extends StarSortState {
|
|
116
|
+
readonly first: number;
|
|
117
|
+
readonly rows: number;
|
|
118
|
+
readonly filter: string;
|
|
119
|
+
readonly filters: StarColumnFilters;
|
|
120
|
+
/** All sort columns in priority order (one entry without `multiSort`). */
|
|
121
|
+
readonly sorts: readonly StarSortState[];
|
|
122
|
+
}
|
|
123
|
+
/** The user asked to move a row. The table does not change `value`: the owner moves the row. */
|
|
124
|
+
export interface StarRowReorderEvent<T> {
|
|
125
|
+
readonly row: T;
|
|
126
|
+
/** Index of the row in `value` now, and the index it must get. */
|
|
127
|
+
readonly from: number;
|
|
128
|
+
readonly to: number;
|
|
129
|
+
}
|
|
130
|
+
export interface StarCellContext<T> {
|
|
131
|
+
readonly $implicit: T;
|
|
132
|
+
readonly value: unknown;
|
|
133
|
+
readonly index: number;
|
|
134
|
+
}
|
|
135
|
+
/** Custom cell: `<ng-template starCell="status" let-row let-value="value">…</ng-template>`. */
|
|
136
|
+
export declare class StarCellTemplate<T = unknown> {
|
|
137
|
+
readonly starCell: import("@angular/core").InputSignal<string>;
|
|
138
|
+
/** Optional: pass the table rows to type `let-row` in strict templates. */
|
|
139
|
+
readonly starCellOf: import("@angular/core").InputSignal<readonly T[] | null>;
|
|
140
|
+
readonly template: TemplateRef<StarCellContext<T>>;
|
|
141
|
+
static ngTemplateContextGuard<T>(_dir: StarCellTemplate<T>, _ctx: unknown): _ctx is StarCellContext<T>;
|
|
142
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<StarCellTemplate<any>, never>;
|
|
143
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<StarCellTemplate<any>, "ng-template[starCell]", never, {
|
|
144
|
+
"starCell": {
|
|
145
|
+
"alias": "starCell";
|
|
146
|
+
"required": true;
|
|
147
|
+
"isSignal": true;
|
|
148
|
+
};
|
|
149
|
+
"starCellOf": {
|
|
150
|
+
"alias": "starCellOf";
|
|
151
|
+
"required": false;
|
|
152
|
+
"isSignal": true;
|
|
153
|
+
};
|
|
154
|
+
}, {}, never, never, true, never>;
|
|
155
|
+
}
|
|
156
|
+
export interface StarRowContext<T> {
|
|
157
|
+
readonly $implicit: T;
|
|
158
|
+
readonly index: number;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Detail content of an expanded row. When the table has this template, each row gets an
|
|
162
|
+
* expand button: `<ng-template starRowExpansion let-row>…</ng-template>`.
|
|
163
|
+
*/
|
|
164
|
+
export declare class StarRowExpansionTemplate<T = unknown> {
|
|
165
|
+
/** Optional: pass the table rows to type `let-row` in strict templates. */
|
|
166
|
+
readonly starRowExpansionOf: import("@angular/core").InputSignal<readonly T[] | null>;
|
|
167
|
+
readonly template: TemplateRef<StarRowContext<T>>;
|
|
168
|
+
static ngTemplateContextGuard<T>(_dir: StarRowExpansionTemplate<T>, _ctx: unknown): _ctx is StarRowContext<T>;
|
|
169
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<StarRowExpansionTemplate<any>, never>;
|
|
170
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<StarRowExpansionTemplate<any>, "ng-template[starRowExpansion]", never, {
|
|
171
|
+
"starRowExpansionOf": {
|
|
172
|
+
"alias": "starRowExpansionOf";
|
|
173
|
+
"required": false;
|
|
174
|
+
"isSignal": true;
|
|
175
|
+
};
|
|
176
|
+
}, {}, never, never, true, never>;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Data table (PrimeNG `p-table` essentials): typed columns, custom cell templates, sorting,
|
|
180
|
+
* global filter, column filters, CSV / Excel / print export, client or lazy (server) pagination, single / multiple row selection with
|
|
181
|
+
* checkboxes, row expansion, inline cell edit, column resize / reorder / hide / freeze, virtual scroll, row groups, multi-column sort,
|
|
182
|
+
* footer row, row reorder, saved state, loading skeleton, empty state, sticky header and row click.
|
|
183
|
+
*
|
|
184
|
+
* ```html
|
|
185
|
+
* <star-table [value]="rows()" [columns]="columns" dataKey="id" selectionMode="multiple"
|
|
186
|
+
* [(selection)]="selected" paginator [rows]="10" [globalFilter]="query()">
|
|
187
|
+
* <ng-template starCell="status" let-row><star-tag [value]="row.status" /></ng-template>
|
|
188
|
+
* </star-table>
|
|
189
|
+
* ```
|
|
190
|
+
*/
|
|
191
|
+
export declare class StarTable<T> {
|
|
192
|
+
protected readonly text: import("@star-ng/ui/core").StarUiText;
|
|
193
|
+
private readonly document;
|
|
194
|
+
private readonly host;
|
|
195
|
+
private readonly injector;
|
|
196
|
+
private readonly appRef;
|
|
197
|
+
readonly value: import("@angular/core").InputSignal<readonly T[]>;
|
|
198
|
+
readonly columns: import("@angular/core").InputSignal<readonly StarColumn<T>[]>;
|
|
199
|
+
/** Row identity for tracking and selection (default: the row object). */
|
|
200
|
+
readonly dataKey: import("@angular/core").InputSignal<StarOptionKey<T> | null>;
|
|
201
|
+
readonly loading: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
202
|
+
readonly emptyMessage: import("@angular/core").InputSignal<string | null>;
|
|
203
|
+
readonly striped: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
204
|
+
readonly size: import("@angular/core").InputSignal<"sm" | "md">;
|
|
205
|
+
readonly stickyHeader: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
206
|
+
readonly scrollHeight: import("@angular/core").InputSignal<string | null>;
|
|
207
|
+
/**
|
|
208
|
+
* Layout when the table is narrower than 40rem (a phone). `'scroll'`: the table scrolls
|
|
209
|
+
* sideways. `'stack'`: each row is a block with one line per column, "label: value"; the
|
|
210
|
+
* sortable headers stay as a row of buttons. With `virtualScroll`, `'stack'` turns on rows of
|
|
211
|
+
* different heights.
|
|
212
|
+
*/
|
|
213
|
+
readonly responsiveLayout: import("@angular/core").InputSignal<"scroll" | "stack">;
|
|
214
|
+
/**
|
|
215
|
+
* Renders only the rows in view (plus 5 above and below), for long lists. Needs
|
|
216
|
+
* `scrollHeight`. Rows have one fixed height (`virtualRowHeight`, text on one line) unless
|
|
217
|
+
* `virtualRowHeights` turns on rows of different heights.
|
|
218
|
+
*/
|
|
219
|
+
readonly virtualScroll: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
220
|
+
/**
|
|
221
|
+
* Row height in pixels with `virtualScroll`. With rows of different heights it is the
|
|
222
|
+
* estimated height of a row that was not measured yet.
|
|
223
|
+
*/
|
|
224
|
+
readonly virtualRowHeight: import("@angular/core").InputSignal<number>;
|
|
225
|
+
/**
|
|
226
|
+
* Row heights with `virtualScroll`. `'auto'`: one fixed height, unless the table has row
|
|
227
|
+
* expansion, `groupBy` or the stacked layout, which need rows of different heights.
|
|
228
|
+
* `'variable'`: rows of different heights always, for cell text on more than one line. The
|
|
229
|
+
* table measures each rendered row and keeps the heights.
|
|
230
|
+
*/
|
|
231
|
+
readonly virtualRowHeights: import("@angular/core").InputSignal<"auto" | "variable">;
|
|
232
|
+
readonly ariaLabel: import("@angular/core").InputSignal<string | null>;
|
|
233
|
+
readonly paginator: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
234
|
+
readonly first: import("@angular/core").ModelSignal<number>;
|
|
235
|
+
readonly rows: import("@angular/core").ModelSignal<number>;
|
|
236
|
+
readonly rowsPerPageOptions: import("@angular/core").InputSignal<readonly number[]>;
|
|
237
|
+
readonly sortField: import("@angular/core").ModelSignal<string | null>;
|
|
238
|
+
readonly sortOrder: import("@angular/core").ModelSignal<StarSortOrder>;
|
|
239
|
+
/** Case- and accent-insensitive text search over all columns. */
|
|
240
|
+
readonly globalFilter: import("@angular/core").InputSignal<string>;
|
|
241
|
+
/** Column filter values by column `field` (columns with `filter` set). Two-way. */
|
|
242
|
+
readonly filters: import("@angular/core").ModelSignal<Readonly<Record<string, StarFilterValue>>>;
|
|
243
|
+
/** Server mode: the table only renders `value`; it emits `lazyLoad` for every change. */
|
|
244
|
+
readonly lazy: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
245
|
+
/** Total rows on the server (lazy mode). */
|
|
246
|
+
readonly totalRecords: import("@angular/core").InputSignal<number>;
|
|
247
|
+
readonly selectionMode: import("@angular/core").InputSignal<"single" | "multiple" | null>;
|
|
248
|
+
readonly selection: import("@angular/core").ModelSignal<readonly T[]>;
|
|
249
|
+
/**
|
|
250
|
+
* Keys (`dataKey`) of the expanded rows. Two-way. Rows expand only when the table has an
|
|
251
|
+
* `starRowExpansion` template.
|
|
252
|
+
*/
|
|
253
|
+
readonly expandedKeys: import("@angular/core").ModelSignal<readonly unknown[]>;
|
|
254
|
+
/** `'single'`: opening a row closes the other rows. */
|
|
255
|
+
readonly rowExpandMode: import("@angular/core").InputSignal<"single" | "multiple">;
|
|
256
|
+
/** Shows a Columns button: the user can hide columns (and move them, with `reorderableColumns`). */
|
|
257
|
+
readonly columnToggle: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
258
|
+
/** The user can move a column: drag its header, or use the Columns panel. */
|
|
259
|
+
readonly reorderableColumns: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
260
|
+
/** The user can change a column width: drag the header edge, or use the arrow keys on it. */
|
|
261
|
+
readonly resizableColumns: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
262
|
+
/** Column `field`s in display order. Columns not in the list keep their place after it. Two-way. */
|
|
263
|
+
readonly columnOrder: import("@angular/core").ModelSignal<readonly string[]>;
|
|
264
|
+
/** `field`s of the hidden columns. Two-way. */
|
|
265
|
+
readonly hiddenColumns: import("@angular/core").ModelSignal<readonly string[]>;
|
|
266
|
+
/** Column widths in pixels by `field`, set by the user. Two-way. */
|
|
267
|
+
readonly columnWidths: import("@angular/core").ModelSignal<Readonly<Record<string, number>>>;
|
|
268
|
+
/**
|
|
269
|
+
* Sort by more than one column: Shift + click (or Shift + Enter) on a header adds it as the
|
|
270
|
+
* next sort column. A plain click sorts by that column only.
|
|
271
|
+
*/
|
|
272
|
+
readonly multiSort: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
273
|
+
/** Sort columns in priority order with `multiSort`. Two-way. */
|
|
274
|
+
readonly sortMeta: import("@angular/core").ModelSignal<readonly StarSortState[]>;
|
|
275
|
+
/**
|
|
276
|
+
* Group heading of a row (property name or function). Rows with the same heading show
|
|
277
|
+
* together under it, in the order in which the headings first appear after sorting.
|
|
278
|
+
* With `virtualScroll`, the rows of a closed group take no space.
|
|
279
|
+
*/
|
|
280
|
+
readonly groupBy: import("@angular/core").InputSignal<StarOptionKey<T> | null>;
|
|
281
|
+
/** Headings of the closed groups. Two-way. */
|
|
282
|
+
readonly collapsedGroups: import("@angular/core").ModelSignal<readonly string[]>;
|
|
283
|
+
/**
|
|
284
|
+
* Adds "Move up" / "Move down" buttons to each row. The buttons work while the table shows
|
|
285
|
+
* `value` in its own order (no sort, no filter, no groups).
|
|
286
|
+
*/
|
|
287
|
+
readonly reorderableRows: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
288
|
+
/**
|
|
289
|
+
* Remembers sort, filters, column order, hidden columns, column widths, page size and
|
|
290
|
+
* closed groups in the browser under this key, and restores them on the next visit.
|
|
291
|
+
*/
|
|
292
|
+
readonly stateKey: import("@angular/core").InputSignal<string | null>;
|
|
293
|
+
readonly stateStorage: import("@angular/core").InputSignal<"local" | "session">;
|
|
294
|
+
readonly rowClick: import("@angular/core").OutputEmitterRef<T>;
|
|
295
|
+
readonly rowReorder: import("@angular/core").OutputEmitterRef<StarRowReorderEvent<T>>;
|
|
296
|
+
/** The user changed an editable cell (see `StarColumn.editable`). */
|
|
297
|
+
readonly cellEdit: import("@angular/core").OutputEmitterRef<StarCellEditEvent<T>>;
|
|
298
|
+
readonly lazyLoad: import("@angular/core").OutputEmitterRef<StarLazyLoadEvent>;
|
|
299
|
+
/** The cell in edit mode: `<row key>|<field>` text, or `null`. */
|
|
300
|
+
private readonly editing;
|
|
301
|
+
private readonly cellTemplates;
|
|
302
|
+
private readonly expansion;
|
|
303
|
+
protected readonly expansionTemplate: import("@angular/core").Signal<TemplateRef<StarRowContext<T>> | null>;
|
|
304
|
+
protected readonly expandable: import("@angular/core").Signal<boolean>;
|
|
305
|
+
protected readonly radioName: string;
|
|
306
|
+
protected readonly clickable: import("@angular/core").Signal<boolean>;
|
|
307
|
+
/** All columns in display order: frozen columns first, then `columnOrder`. */
|
|
308
|
+
protected readonly orderedColumns: import("@angular/core").Signal<StarColumn<T>[]>;
|
|
309
|
+
protected readonly visibleColumns: import("@angular/core").Signal<StarColumn<T>[]>;
|
|
310
|
+
protected readonly dragField: import("@angular/core").WritableSignal<string | null>;
|
|
311
|
+
protected readonly dropField: import("@angular/core").WritableSignal<string | null>;
|
|
312
|
+
private resizing;
|
|
313
|
+
protected readonly hasColumnFilters: import("@angular/core").Signal<boolean>;
|
|
314
|
+
/** Columns that have a filter value now, with that value. */
|
|
315
|
+
private readonly activeFilters;
|
|
316
|
+
private readonly filtered;
|
|
317
|
+
/** Sort columns in priority order. */
|
|
318
|
+
private readonly sorts;
|
|
319
|
+
private readonly sorted;
|
|
320
|
+
/** First row index of each group on the page, with the heading and the row count. */
|
|
321
|
+
private readonly groupStarts;
|
|
322
|
+
protected readonly hasFooter: import("@angular/core").Signal<boolean>;
|
|
323
|
+
/** Rows can move while the table shows `value` in its own order. */
|
|
324
|
+
private readonly rowOrderIsOwn;
|
|
325
|
+
private restoredKey;
|
|
326
|
+
protected readonly total: import("@angular/core").Signal<number>;
|
|
327
|
+
protected readonly pageRows: import("@angular/core").Signal<readonly T[]>;
|
|
328
|
+
private readonly scrollTop;
|
|
329
|
+
private readonly viewportHeight;
|
|
330
|
+
private readonly scroller;
|
|
331
|
+
private readonly body;
|
|
332
|
+
/**
|
|
333
|
+
* Rows of different heights: on with `virtualRowHeights="variable"`, and with the features that
|
|
334
|
+
* cannot have one fixed height (row expansion, groups, stacked layout).
|
|
335
|
+
*/
|
|
336
|
+
protected readonly variableHeights: import("@angular/core").Signal<boolean>;
|
|
337
|
+
/** Header rows: the column headings, and the filter row when there is one. */
|
|
338
|
+
private readonly headerRows;
|
|
339
|
+
/** `aria-rowcount` with virtual scroll: header, body (headings, rows, detail rows) and footer. */
|
|
340
|
+
protected readonly ariaRowCount: import("@angular/core").Signal<number | null>;
|
|
341
|
+
/** Expanded row keys, for a fast look-up per row. */
|
|
342
|
+
private readonly expandedSet;
|
|
343
|
+
/**
|
|
344
|
+
* Measured heights by row key (`dataKey` value, else the row object). A row with its detail
|
|
345
|
+
* row open has its own entry, so closing it again needs no new measure. Group headings use
|
|
346
|
+
* their item key. The maps are not signals: `measured` counts their changes.
|
|
347
|
+
*/
|
|
348
|
+
private readonly rowHeights;
|
|
349
|
+
private readonly expandedHeights;
|
|
350
|
+
/** Counts up when a measured height changes the height tree. */
|
|
351
|
+
private readonly measured;
|
|
352
|
+
/** Counts up when the measured heights are no longer valid (the table width changed). */
|
|
353
|
+
private readonly heightEpoch;
|
|
354
|
+
/** Top of the table body in the scroll area (below the sticky header), in pixels. */
|
|
355
|
+
private readonly bodyOffset;
|
|
356
|
+
/** Items (group headings and rows) and their heights, with rows of different heights. */
|
|
357
|
+
private readonly layout;
|
|
358
|
+
/** Measured height of an item, else the estimate (a row with its detail: two rows). */
|
|
359
|
+
private estimateOf;
|
|
360
|
+
/** Last layout and scroll offset of `variableWindow`, to keep the view on a layout change. */
|
|
361
|
+
private anchorMemo;
|
|
362
|
+
/** Scroll offset that the next render must apply (see `variableWindow`). */
|
|
363
|
+
private pendingScroll;
|
|
364
|
+
/** Rendered items with rows of different heights. */
|
|
365
|
+
private readonly variableWindow;
|
|
366
|
+
/** Key of the row (or heading) that has the focus, kept rendered outside the window. */
|
|
367
|
+
private readonly focusedKey;
|
|
368
|
+
/** Index of the focused item in the virtual list, or -1. */
|
|
369
|
+
private readonly focusedIndex;
|
|
370
|
+
/** The lines of the body: spacers, group headings and rows, in display order. */
|
|
371
|
+
protected readonly bodyEntries: import("@angular/core").Signal<readonly BodyEntry<T>[]>;
|
|
372
|
+
/**
|
|
373
|
+
* Entries of the window `[start, end)` and of the focused item outside it, with a spacer for
|
|
374
|
+
* each gap, so the body keeps the full height.
|
|
375
|
+
*/
|
|
376
|
+
private windowEntries;
|
|
377
|
+
/** First rendered row and the heights of the rows left out before and after the window. */
|
|
378
|
+
protected readonly virtualWindow: import("@angular/core").Signal<{
|
|
379
|
+
start: number;
|
|
380
|
+
end: number;
|
|
381
|
+
before: number;
|
|
382
|
+
after: number;
|
|
383
|
+
}>;
|
|
384
|
+
protected onScroll(event: Event): void;
|
|
385
|
+
/** Rendered rows that the ResizeObserver watches (rows of different heights only). */
|
|
386
|
+
private readonly observedRows;
|
|
387
|
+
private rowObserver;
|
|
388
|
+
/**
|
|
389
|
+
* Measures the rendered items, stores their heights, and moves the scroll offset by the change
|
|
390
|
+
* of the items above the first item in view, so the rows in view do not move (scroll
|
|
391
|
+
* anchoring). Runs after a render and when the ResizeObserver reports a row size change.
|
|
392
|
+
*/
|
|
393
|
+
private measureRendered;
|
|
394
|
+
/** Watches the rendered rows and the body for size changes (content, fonts, images). */
|
|
395
|
+
private observeRows;
|
|
396
|
+
/** Index in the virtual list of the item that holds an element, or -1. */
|
|
397
|
+
private itemOf;
|
|
398
|
+
/** Key of an item of the virtual list. */
|
|
399
|
+
private keyOfItem;
|
|
400
|
+
protected onBodyFocusIn(event: FocusEvent): void;
|
|
401
|
+
protected onBodyFocusOut(event: FocusEvent): void;
|
|
402
|
+
/**
|
|
403
|
+
* Tab and Shift + Tab from a row to a row that is not rendered (the focused row is kept
|
|
404
|
+
* outside the window): scroll that row in, then focus its first (or last) control.
|
|
405
|
+
*/
|
|
406
|
+
protected onBodyKeydown(event: KeyboardEvent): void;
|
|
407
|
+
private focusablesOf;
|
|
408
|
+
/** Scrolls an item of the virtual list to the middle of the view. */
|
|
409
|
+
private revealItem;
|
|
410
|
+
protected readonly skeletonRows: import("@angular/core").Signal<number[]>;
|
|
411
|
+
protected readonly colspan: import("@angular/core").Signal<number>;
|
|
412
|
+
/** Selection state of the rows on the current page, for the header checkbox. */
|
|
413
|
+
protected readonly pageState: import("@angular/core").Signal<boolean | "mixed">;
|
|
414
|
+
constructor();
|
|
415
|
+
private storage;
|
|
416
|
+
private restoreState;
|
|
417
|
+
/** Removes the saved state of this table (`stateKey`). The current view does not change. */
|
|
418
|
+
clearState(): void;
|
|
419
|
+
protected groupOf(row: T): string;
|
|
420
|
+
protected isGroupCollapsed(label: string): boolean;
|
|
421
|
+
protected isRowCollapsed(row: T): boolean;
|
|
422
|
+
protected toggleGroup(label: string): void;
|
|
423
|
+
protected footerText(column: StarColumn<T>): string;
|
|
424
|
+
protected canMoveRow(row: T, step: 1 | -1): boolean;
|
|
425
|
+
protected moveRow(row: T, step: 1 | -1): void;
|
|
426
|
+
protected trackKey(row: T): unknown;
|
|
427
|
+
protected cellTemplate(field: string): TemplateRef<StarCellContext<T>> | null;
|
|
428
|
+
protected cellValue(row: T, column: StarColumn<T>): unknown;
|
|
429
|
+
protected cellText(row: T, column: StarColumn<T>): string;
|
|
430
|
+
protected isHidden(column: StarColumn<T>): boolean;
|
|
431
|
+
/** A column can hide unless it is locked or it is the last visible column. */
|
|
432
|
+
protected canHide(column: StarColumn<T>): boolean;
|
|
433
|
+
protected setColumnVisible(column: StarColumn<T>, visible: boolean): void;
|
|
434
|
+
/** Moves a column to the place of another column. */
|
|
435
|
+
moveColumn(field: string, targetField: string): void;
|
|
436
|
+
protected moveColumnBy(column: StarColumn<T>, delta: 1 | -1): void;
|
|
437
|
+
/** Identifies a move button of the Columns panel, for `focusMoveButton`. */
|
|
438
|
+
protected moveKey(column: StarColumn<T>, delta: 1 | -1): string;
|
|
439
|
+
private focusMoveButton;
|
|
440
|
+
protected onDragStart(column: StarColumn<T>, event: DragEvent): void;
|
|
441
|
+
protected onDragOver(column: StarColumn<T>, event: DragEvent): void;
|
|
442
|
+
protected onDrop(column: StarColumn<T>, event: DragEvent): void;
|
|
443
|
+
protected endDrag(): void;
|
|
444
|
+
protected widthOf(column: StarColumn<T>): string | null;
|
|
445
|
+
protected resizedWidth(column: StarColumn<T>): string | null;
|
|
446
|
+
/** Rendered width in pixels of each frozen header cell, by column `field`. */
|
|
447
|
+
private readonly frozenWidths;
|
|
448
|
+
/** Rendered width in pixels of each header cell, by column `field` (resizable tables only). */
|
|
449
|
+
private readonly headerWidths;
|
|
450
|
+
/** The scroll area has content outside its box, so it must take the focus to scroll by key. */
|
|
451
|
+
protected readonly scrollable: import("@angular/core").WritableSignal<boolean>;
|
|
452
|
+
protected readonly minColumnWidth = 48;
|
|
453
|
+
/** `aria-valuenow` of a resize handle: the width of the column in pixels. */
|
|
454
|
+
protected resizeNow(column: StarColumn<T>): number | null;
|
|
455
|
+
protected resizeMax(column: StarColumn<T>): number;
|
|
456
|
+
/** Counts up when the table element changes size, so the frozen columns are measured again. */
|
|
457
|
+
private readonly resized;
|
|
458
|
+
/** Measures the frozen header cells after a render that can change their width. */
|
|
459
|
+
private measureFrozen;
|
|
460
|
+
/**
|
|
461
|
+
* Offset of a frozen column: the widths of the frozen columns before it. Uses the measured
|
|
462
|
+
* widths; before the first measure (and where layout is not available) the declared widths.
|
|
463
|
+
*/
|
|
464
|
+
protected frozenOffset(column: StarColumn<T>): string | null;
|
|
465
|
+
private setWidth;
|
|
466
|
+
protected startResize(column: StarColumn<T>, event: PointerEvent): void;
|
|
467
|
+
protected onResizeKey(column: StarColumn<T>, event: KeyboardEvent): void;
|
|
468
|
+
protected editKey(row: T, column: StarColumn<T>): string;
|
|
469
|
+
protected isEditable(row: T, column: StarColumn<T>): boolean;
|
|
470
|
+
protected isEditing(row: T, column: StarColumn<T>): boolean;
|
|
471
|
+
/** Text in the editor: the raw value, so a formatted cell (date, currency) edits its data. */
|
|
472
|
+
protected editText(row: T, column: StarColumn<T>): string;
|
|
473
|
+
protected startEdit(row: T, column: StarColumn<T>): void;
|
|
474
|
+
protected commitEdit(row: T, column: StarColumn<T>, text: string): void;
|
|
475
|
+
protected cancelEdit(event: Event): void;
|
|
476
|
+
private closeEditor;
|
|
477
|
+
private focusAfterRender;
|
|
478
|
+
protected isExpanded(row: T): boolean;
|
|
479
|
+
protected detailId(index: number): string;
|
|
480
|
+
/** Opens or closes the detail of one row. */
|
|
481
|
+
toggleExpansion(row: T): void;
|
|
482
|
+
/** Opens the detail of every row on the current page. */
|
|
483
|
+
expandAll(): void;
|
|
484
|
+
/** Closes every row detail. */
|
|
485
|
+
collapseAll(): void;
|
|
486
|
+
private matchesColumnFilter;
|
|
487
|
+
protected filterValue(field: string): string;
|
|
488
|
+
protected filterList(field: string): readonly string[];
|
|
489
|
+
protected filterBound(field: string, bound: 'min' | 'max'): string;
|
|
490
|
+
protected setBound(column: StarColumn<T>, bound: 'min' | 'max', text: string): void;
|
|
491
|
+
protected filterChoices(column: StarColumn<T>): readonly string[];
|
|
492
|
+
protected setFilter(field: string, value: StarFilterValue): void;
|
|
493
|
+
/** Removes every column filter. */
|
|
494
|
+
clearFilters(): void;
|
|
495
|
+
/** Columns and rows of an export: visible columns in display order, without `exportable: false`. */
|
|
496
|
+
private exportData;
|
|
497
|
+
/** Export text of a cell: `exportValue`, else the display text (`format` / `value`). */
|
|
498
|
+
private exportText;
|
|
499
|
+
/** A number cell stays a number in a spreadsheet when the column has no text format. */
|
|
500
|
+
private exportCell;
|
|
501
|
+
/**
|
|
502
|
+
* CSV text of the table: a header row, then the filtered rows in the current sort order
|
|
503
|
+
* (all pages), or the selected rows, with the visible columns in display order. Cells use
|
|
504
|
+
* the column `exportValue`, else the display text (`format` / `value`); custom cell
|
|
505
|
+
* templates are not exported. In lazy mode only the loaded rows are available: pass all
|
|
506
|
+
* rows with `options.rows`.
|
|
507
|
+
*
|
|
508
|
+
* Text that a spreadsheet would read as a formula (it starts with `=`, `+`, `-` or `@`)
|
|
509
|
+
* gets a leading apostrophe, so exported user data cannot run as a formula.
|
|
510
|
+
*/
|
|
511
|
+
toCsv(options?: StarCsvOptions<T>): string;
|
|
512
|
+
/** Downloads `toCsv()` as `<fileName>.csv` (UTF-8 with a byte order mark, for Excel). */
|
|
513
|
+
exportCsv(options?: StarCsvOptions<T>): void;
|
|
514
|
+
/**
|
|
515
|
+
* Excel workbook (`.xlsx`) bytes of the table: same columns and rows as `toCsv()`. Number
|
|
516
|
+
* cells stay numbers; text cells are plain text, never formulas.
|
|
517
|
+
*/
|
|
518
|
+
toXlsx(options?: StarExportOptions<T>): Uint8Array;
|
|
519
|
+
/** Downloads `toXlsx()` as `<fileName>.xlsx`. */
|
|
520
|
+
exportExcel(options?: StarExportOptions<T>): void;
|
|
521
|
+
/**
|
|
522
|
+
* Opens the browser print dialog with a plain table of the same columns and rows. The user
|
|
523
|
+
* can print it or choose "Save as PDF". The table always fits the paper the user chooses: a
|
|
524
|
+
* table that is too wide wraps its text, then gets smaller text (down to 6 pt), and last breaks
|
|
525
|
+
* long words inside a cell. No column is cut off.
|
|
526
|
+
*/
|
|
527
|
+
print(options?: StarExportOptions<T>): void;
|
|
528
|
+
private download;
|
|
529
|
+
/** Sorts by a column. With `multiSort`, `event.shiftKey` adds the column to the sort. */
|
|
530
|
+
sortBy(column: StarColumn<T>, event?: MouseEvent | KeyboardEvent): void;
|
|
531
|
+
private sortOf;
|
|
532
|
+
/** `aria-sort` goes on one column only: the first sort column. */
|
|
533
|
+
protected ariaSort(column: StarColumn<T>): string | null;
|
|
534
|
+
protected sortIcon(column: StarColumn<T>): string;
|
|
535
|
+
/** Position of a column in a sort by two or more columns, else `null`. */
|
|
536
|
+
protected sortRank(column: StarColumn<T>): number | null;
|
|
537
|
+
/** Keys of the selected rows: a look-up per row stays fast with 50,000 selected rows. */
|
|
538
|
+
private readonly selectedKeys;
|
|
539
|
+
protected isSelected(row: T): boolean;
|
|
540
|
+
protected toggleRow(row: T): void;
|
|
541
|
+
protected selectOnly(row: T): void;
|
|
542
|
+
protected togglePage(checked: boolean): void;
|
|
543
|
+
protected onRowClick(row: T, event: MouseEvent): void;
|
|
544
|
+
protected emitLazy(): void;
|
|
545
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<StarTable<any>, never>;
|
|
546
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<StarTable<any>, "star-table", never, {
|
|
547
|
+
"value": {
|
|
548
|
+
"alias": "value";
|
|
549
|
+
"required": true;
|
|
550
|
+
"isSignal": true;
|
|
551
|
+
};
|
|
552
|
+
"columns": {
|
|
553
|
+
"alias": "columns";
|
|
554
|
+
"required": true;
|
|
555
|
+
"isSignal": true;
|
|
556
|
+
};
|
|
557
|
+
"dataKey": {
|
|
558
|
+
"alias": "dataKey";
|
|
559
|
+
"required": false;
|
|
560
|
+
"isSignal": true;
|
|
561
|
+
};
|
|
562
|
+
"loading": {
|
|
563
|
+
"alias": "loading";
|
|
564
|
+
"required": false;
|
|
565
|
+
"isSignal": true;
|
|
566
|
+
};
|
|
567
|
+
"emptyMessage": {
|
|
568
|
+
"alias": "emptyMessage";
|
|
569
|
+
"required": false;
|
|
570
|
+
"isSignal": true;
|
|
571
|
+
};
|
|
572
|
+
"striped": {
|
|
573
|
+
"alias": "striped";
|
|
574
|
+
"required": false;
|
|
575
|
+
"isSignal": true;
|
|
576
|
+
};
|
|
577
|
+
"size": {
|
|
578
|
+
"alias": "size";
|
|
579
|
+
"required": false;
|
|
580
|
+
"isSignal": true;
|
|
581
|
+
};
|
|
582
|
+
"stickyHeader": {
|
|
583
|
+
"alias": "stickyHeader";
|
|
584
|
+
"required": false;
|
|
585
|
+
"isSignal": true;
|
|
586
|
+
};
|
|
587
|
+
"scrollHeight": {
|
|
588
|
+
"alias": "scrollHeight";
|
|
589
|
+
"required": false;
|
|
590
|
+
"isSignal": true;
|
|
591
|
+
};
|
|
592
|
+
"responsiveLayout": {
|
|
593
|
+
"alias": "responsiveLayout";
|
|
594
|
+
"required": false;
|
|
595
|
+
"isSignal": true;
|
|
596
|
+
};
|
|
597
|
+
"virtualScroll": {
|
|
598
|
+
"alias": "virtualScroll";
|
|
599
|
+
"required": false;
|
|
600
|
+
"isSignal": true;
|
|
601
|
+
};
|
|
602
|
+
"virtualRowHeight": {
|
|
603
|
+
"alias": "virtualRowHeight";
|
|
604
|
+
"required": false;
|
|
605
|
+
"isSignal": true;
|
|
606
|
+
};
|
|
607
|
+
"virtualRowHeights": {
|
|
608
|
+
"alias": "virtualRowHeights";
|
|
609
|
+
"required": false;
|
|
610
|
+
"isSignal": true;
|
|
611
|
+
};
|
|
612
|
+
"ariaLabel": {
|
|
613
|
+
"alias": "ariaLabel";
|
|
614
|
+
"required": false;
|
|
615
|
+
"isSignal": true;
|
|
616
|
+
};
|
|
617
|
+
"paginator": {
|
|
618
|
+
"alias": "paginator";
|
|
619
|
+
"required": false;
|
|
620
|
+
"isSignal": true;
|
|
621
|
+
};
|
|
622
|
+
"first": {
|
|
623
|
+
"alias": "first";
|
|
624
|
+
"required": false;
|
|
625
|
+
"isSignal": true;
|
|
626
|
+
};
|
|
627
|
+
"rows": {
|
|
628
|
+
"alias": "rows";
|
|
629
|
+
"required": false;
|
|
630
|
+
"isSignal": true;
|
|
631
|
+
};
|
|
632
|
+
"rowsPerPageOptions": {
|
|
633
|
+
"alias": "rowsPerPageOptions";
|
|
634
|
+
"required": false;
|
|
635
|
+
"isSignal": true;
|
|
636
|
+
};
|
|
637
|
+
"sortField": {
|
|
638
|
+
"alias": "sortField";
|
|
639
|
+
"required": false;
|
|
640
|
+
"isSignal": true;
|
|
641
|
+
};
|
|
642
|
+
"sortOrder": {
|
|
643
|
+
"alias": "sortOrder";
|
|
644
|
+
"required": false;
|
|
645
|
+
"isSignal": true;
|
|
646
|
+
};
|
|
647
|
+
"globalFilter": {
|
|
648
|
+
"alias": "globalFilter";
|
|
649
|
+
"required": false;
|
|
650
|
+
"isSignal": true;
|
|
651
|
+
};
|
|
652
|
+
"filters": {
|
|
653
|
+
"alias": "filters";
|
|
654
|
+
"required": false;
|
|
655
|
+
"isSignal": true;
|
|
656
|
+
};
|
|
657
|
+
"lazy": {
|
|
658
|
+
"alias": "lazy";
|
|
659
|
+
"required": false;
|
|
660
|
+
"isSignal": true;
|
|
661
|
+
};
|
|
662
|
+
"totalRecords": {
|
|
663
|
+
"alias": "totalRecords";
|
|
664
|
+
"required": false;
|
|
665
|
+
"isSignal": true;
|
|
666
|
+
};
|
|
667
|
+
"selectionMode": {
|
|
668
|
+
"alias": "selectionMode";
|
|
669
|
+
"required": false;
|
|
670
|
+
"isSignal": true;
|
|
671
|
+
};
|
|
672
|
+
"selection": {
|
|
673
|
+
"alias": "selection";
|
|
674
|
+
"required": false;
|
|
675
|
+
"isSignal": true;
|
|
676
|
+
};
|
|
677
|
+
"expandedKeys": {
|
|
678
|
+
"alias": "expandedKeys";
|
|
679
|
+
"required": false;
|
|
680
|
+
"isSignal": true;
|
|
681
|
+
};
|
|
682
|
+
"rowExpandMode": {
|
|
683
|
+
"alias": "rowExpandMode";
|
|
684
|
+
"required": false;
|
|
685
|
+
"isSignal": true;
|
|
686
|
+
};
|
|
687
|
+
"columnToggle": {
|
|
688
|
+
"alias": "columnToggle";
|
|
689
|
+
"required": false;
|
|
690
|
+
"isSignal": true;
|
|
691
|
+
};
|
|
692
|
+
"reorderableColumns": {
|
|
693
|
+
"alias": "reorderableColumns";
|
|
694
|
+
"required": false;
|
|
695
|
+
"isSignal": true;
|
|
696
|
+
};
|
|
697
|
+
"resizableColumns": {
|
|
698
|
+
"alias": "resizableColumns";
|
|
699
|
+
"required": false;
|
|
700
|
+
"isSignal": true;
|
|
701
|
+
};
|
|
702
|
+
"columnOrder": {
|
|
703
|
+
"alias": "columnOrder";
|
|
704
|
+
"required": false;
|
|
705
|
+
"isSignal": true;
|
|
706
|
+
};
|
|
707
|
+
"hiddenColumns": {
|
|
708
|
+
"alias": "hiddenColumns";
|
|
709
|
+
"required": false;
|
|
710
|
+
"isSignal": true;
|
|
711
|
+
};
|
|
712
|
+
"columnWidths": {
|
|
713
|
+
"alias": "columnWidths";
|
|
714
|
+
"required": false;
|
|
715
|
+
"isSignal": true;
|
|
716
|
+
};
|
|
717
|
+
"multiSort": {
|
|
718
|
+
"alias": "multiSort";
|
|
719
|
+
"required": false;
|
|
720
|
+
"isSignal": true;
|
|
721
|
+
};
|
|
722
|
+
"sortMeta": {
|
|
723
|
+
"alias": "sortMeta";
|
|
724
|
+
"required": false;
|
|
725
|
+
"isSignal": true;
|
|
726
|
+
};
|
|
727
|
+
"groupBy": {
|
|
728
|
+
"alias": "groupBy";
|
|
729
|
+
"required": false;
|
|
730
|
+
"isSignal": true;
|
|
731
|
+
};
|
|
732
|
+
"collapsedGroups": {
|
|
733
|
+
"alias": "collapsedGroups";
|
|
734
|
+
"required": false;
|
|
735
|
+
"isSignal": true;
|
|
736
|
+
};
|
|
737
|
+
"reorderableRows": {
|
|
738
|
+
"alias": "reorderableRows";
|
|
739
|
+
"required": false;
|
|
740
|
+
"isSignal": true;
|
|
741
|
+
};
|
|
742
|
+
"stateKey": {
|
|
743
|
+
"alias": "stateKey";
|
|
744
|
+
"required": false;
|
|
745
|
+
"isSignal": true;
|
|
746
|
+
};
|
|
747
|
+
"stateStorage": {
|
|
748
|
+
"alias": "stateStorage";
|
|
749
|
+
"required": false;
|
|
750
|
+
"isSignal": true;
|
|
751
|
+
};
|
|
752
|
+
}, {
|
|
753
|
+
"first": "firstChange";
|
|
754
|
+
"rows": "rowsChange";
|
|
755
|
+
"sortField": "sortFieldChange";
|
|
756
|
+
"sortOrder": "sortOrderChange";
|
|
757
|
+
"filters": "filtersChange";
|
|
758
|
+
"selection": "selectionChange";
|
|
759
|
+
"expandedKeys": "expandedKeysChange";
|
|
760
|
+
"columnOrder": "columnOrderChange";
|
|
761
|
+
"hiddenColumns": "hiddenColumnsChange";
|
|
762
|
+
"columnWidths": "columnWidthsChange";
|
|
763
|
+
"sortMeta": "sortMetaChange";
|
|
764
|
+
"collapsedGroups": "collapsedGroupsChange";
|
|
765
|
+
"rowClick": "rowClick";
|
|
766
|
+
"rowReorder": "rowReorder";
|
|
767
|
+
"cellEdit": "cellEdit";
|
|
768
|
+
"lazyLoad": "lazyLoad";
|
|
769
|
+
}, ["cellTemplates", "expansion"], ["[starTableCaption]"], true, never>;
|
|
770
|
+
}
|
|
771
|
+
/**
|
|
772
|
+
* File builders for `star-table` export. No third-party library: an `.xlsx` file is a ZIP of
|
|
773
|
+
* small XML parts, written here without compression.
|
|
774
|
+
*/
|
|
775
|
+
/** One exported cell: text, or a number that a spreadsheet can sum. */
|
|
776
|
+
export type StarExportCell = string | number;
|
|
777
|
+
/**
|
|
778
|
+
* Excel workbook (`.xlsx`) with one sheet: a bold header row, then the rows. Text cells are
|
|
779
|
+
* inline strings, which a spreadsheet never reads as a formula; numbers stay numbers.
|
|
780
|
+
*/
|
|
781
|
+
export declare function buildXlsx(headers: readonly string[], rows: readonly (readonly StarExportCell[])[], sheetName?: string): Uint8Array;
|
|
782
|
+
/** One step of the fit ladder: how a print table gives way when it is wider than the paper. */
|
|
783
|
+
export interface StarPrintFitStep {
|
|
784
|
+
/** Text size in CSS pixels. The normal size is 12 px (9 pt). */
|
|
785
|
+
readonly size: number;
|
|
786
|
+
/** A cell of one short word may wrap too (at a hyphen). */
|
|
787
|
+
readonly wrap: boolean;
|
|
788
|
+
/** A word may break at any character. Last resort: it sets no minimum width on a column. */
|
|
789
|
+
readonly anywhere: boolean;
|
|
790
|
+
}
|
|
791
|
+
/**
|
|
792
|
+
* What a table gives way to, in this order, until its minimum width fits the paper: first the
|
|
793
|
+
* cells of one short word may wrap (the text keeps its size), then the text gets smaller
|
|
794
|
+
* (11, 10, 9 and 8 px; 8 px is 6 pt, the floor), and last a word may break at any character.
|
|
795
|
+
* Step 0 is the table as it is built: no rule changes, short words never wrap.
|
|
796
|
+
*/
|
|
797
|
+
export declare const PRINT_FIT_STEPS: readonly StarPrintFitStep[];
|
|
798
|
+
/**
|
|
799
|
+
* Style sheet that makes the print table fit any paper. `widths[i]` is the minimum width in
|
|
800
|
+
* pixels of the table at step `i` of `PRINT_FIT_STEPS`; `columns` are the minimum widths of its
|
|
801
|
+
* columns at the last step that keeps words whole. Step `i` applies when the content width of
|
|
802
|
+
* the page is less than the minimum width of every step before it. The query is a container
|
|
803
|
+
* query on the wrapper of the table, so it is answered with the real width of the page, which
|
|
804
|
+
* the print dialog (paper, margins, scale) decides after the document is built. A step that is
|
|
805
|
+
* not narrower than a step before it is left out.
|
|
806
|
+
*/
|
|
807
|
+
export declare function printFitStyle(widths: readonly number[], columns?: readonly number[]): string;
|
|
808
|
+
/** Widths measured by `fitPrintDocument`. */
|
|
809
|
+
export interface StarPrintFitMeasure {
|
|
810
|
+
/** Minimum width of the table at each step of `PRINT_FIT_STEPS`. */
|
|
811
|
+
readonly widths: readonly number[];
|
|
812
|
+
/** Minimum width of each column at the last step that keeps words whole. */
|
|
813
|
+
readonly columns: readonly number[];
|
|
814
|
+
}
|
|
815
|
+
/** A style sheet of the print document that can be changed and removed again. */
|
|
816
|
+
export interface StarPrintStyle {
|
|
817
|
+
/** Replaces the rules of the sheet. */
|
|
818
|
+
set(css: string): void;
|
|
819
|
+
/** Takes the sheet out of the document. */
|
|
820
|
+
remove(): void;
|
|
821
|
+
}
|
|
822
|
+
/**
|
|
823
|
+
* Adds a style sheet to `doc`. The sheet is a constructed style sheet (`new CSSStyleSheet()`,
|
|
824
|
+
* created in the realm of the document, then `adoptedStyleSheets`). A policy whose `style-src`
|
|
825
|
+
* has no `'unsafe-inline'` blocks an inline `style` element, but it does not block a constructed
|
|
826
|
+
* sheet. An environment without constructed style sheets (or one where they fail) gets a
|
|
827
|
+
* `style` element instead: that is the only fallback, and a strict policy blocks it.
|
|
828
|
+
*/
|
|
829
|
+
export declare function addPrintStyle(doc: Document, css?: string): StarPrintStyle;
|
|
830
|
+
/**
|
|
831
|
+
* Adds the base style of the print document (see `buildPrintDocument`) to `doc`. The document
|
|
832
|
+
* has no `style` element and no `style` attribute, so a Content-Security-Policy without
|
|
833
|
+
* `'unsafe-inline'` in `style-src` does not unstyle it. Call it when the frame has loaded,
|
|
834
|
+
* before `fitPrintDocument` measures the table.
|
|
835
|
+
*/
|
|
836
|
+
export declare function stylePrintDocument(doc: Document): void;
|
|
837
|
+
/**
|
|
838
|
+
* Measures the minimum width of the print table at each fit step, in the layout of `doc`, and
|
|
839
|
+
* adds the style sheet of `printFitStyle` to it (a constructed style sheet, see
|
|
840
|
+
* `addPrintStyle`). Call it when the frame has loaded and has its base style
|
|
841
|
+
* (`stylePrintDocument`), before the print dialog opens. The widths are read in the real fonts
|
|
842
|
+
* of the document, so the text of any font, wide or narrow, gets the steps it needs.
|
|
843
|
+
*/
|
|
844
|
+
export declare function fitPrintDocument(doc: Document): StarPrintFitMeasure;
|
|
845
|
+
/** Alignment of a print column. `start` and `end` follow the direction of the document. */
|
|
846
|
+
export type StarPrintAlign = 'start' | 'center' | 'end';
|
|
847
|
+
/**
|
|
848
|
+
* Alignment of a print column. The column definition decides: an explicit `align` wins. Without
|
|
849
|
+
* it a column in which every value is a number (and there is at least one) is `end`, and any
|
|
850
|
+
* other column is `start`. The type of the printed text does not matter: a number that a
|
|
851
|
+
* `format` function turned into a string still sits in a number column. `values` are the cell
|
|
852
|
+
* values before formatting.
|
|
853
|
+
*/
|
|
854
|
+
export declare function printColumnAlign(align: StarPrintAlign | undefined, values: readonly unknown[]): StarPrintAlign;
|
|
855
|
+
/** Language and direction of the print document. */
|
|
856
|
+
export interface StarPrintContext {
|
|
857
|
+
readonly lang?: string;
|
|
858
|
+
readonly dir?: 'ltr' | 'rtl';
|
|
859
|
+
}
|
|
860
|
+
/**
|
|
861
|
+
* `lang` and `dir` for the print document: the nearest ancestor of `host` (the element itself
|
|
862
|
+
* first) that has the attribute with a usable value, else the `<html>` element of `doc`. An
|
|
863
|
+
* empty `lang` and a `dir` other than `ltr` or `rtl` (such as `auto`) are skipped.
|
|
864
|
+
*/
|
|
865
|
+
export declare function printContext(host: Element | null, doc: Document): StarPrintContext;
|
|
866
|
+
/** Options of `buildPrintDocument`. */
|
|
867
|
+
export interface StarPrintOptions extends StarPrintContext {
|
|
868
|
+
/** Alignment of each column, in column order (see `printColumnAlign`). */
|
|
869
|
+
readonly align?: readonly StarPrintAlign[];
|
|
870
|
+
}
|
|
871
|
+
/** Base style of the print document. It is added with `stylePrintDocument`, not inline. */
|
|
872
|
+
export declare const PRINT_STYLE = "body{font:12px/1.4 system-ui,sans-serif;color:#000;margin:16px}\nh1{font-size:16px;margin:0 0 12px;overflow-wrap:anywhere}\n.fit{container-type:inline-size}\ntable{width:100%;border-collapse:collapse}\nth,td{padding:4px 8px;border:1px solid #999;text-align:start;vertical-align:top;overflow-wrap:break-word}\nth{background:#eee}\nth.c,td.c{text-align:center}\nth.e,td.e{text-align:end}\ntd.s{white-space:nowrap}\nthead{display:table-header-group}\ntr{break-inside:avoid}";
|
|
873
|
+
/**
|
|
874
|
+
* HTML document with one table, for the browser print dialog ("Save as PDF"). The markup has
|
|
875
|
+
* no `style` element and no `style` attribute: the style is added to the loaded document by
|
|
876
|
+
* `stylePrintDocument`, as a constructed style sheet, so that it works under a policy without
|
|
877
|
+
* `'unsafe-inline'` in `style-src`. The table is built to print at the normal size. When the
|
|
878
|
+
* paper is too narrow for it, call `fitPrintDocument` on the loaded document: the table then
|
|
879
|
+
* wraps, shrinks or breaks words (see `PRINT_FIT_STEPS`) so that no column is cut off.
|
|
880
|
+
*
|
|
881
|
+
* `options.align` sets the alignment of each column (cells and header). `options.lang` and
|
|
882
|
+
* `options.dir` go on the `html` element.
|
|
883
|
+
*/
|
|
884
|
+
export declare function buildPrintDocument(title: string, headers: readonly string[], rows: readonly (readonly StarExportCell[])[], options?: StarPrintOptions): string;
|
|
885
|
+
export {};
|