@konce-pt/angular 0.7.10 → 0.7.12
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/CHANGELOG.md +44 -0
- package/charts/src/lib/llms.txt +30 -30
- package/fesm2022/konce-pt-angular.mjs +1403 -368
- package/fesm2022/konce-pt-angular.mjs.map +1 -1
- package/grid/src/lib/llms.txt +48 -48
- package/map/src/lib/llms.txt +446 -446
- package/package.json +1 -1
- package/roadmap/src/lib/llms.txt +74 -74
- package/src/lib/accordion/llms.txt +9 -9
- package/src/lib/alert/llms.txt +10 -10
- package/src/lib/app-shell/llms.txt +59 -59
- package/src/lib/auth/llms.txt +104 -0
- package/src/lib/autocomplete/llms.txt +8 -8
- package/src/lib/avatar/llms.txt +9 -9
- package/src/lib/avatar-group/llms.txt +8 -8
- package/src/lib/badge/llms.txt +9 -9
- package/src/lib/bottom-sheet/llms.txt +14 -14
- package/src/lib/breadcrumb/llms.txt +7 -7
- package/src/lib/breakpoint/llms.txt +21 -21
- package/src/lib/button/llms.txt +34 -34
- package/src/lib/button-group/llms.txt +5 -5
- package/src/lib/card/llms.txt +27 -27
- package/src/lib/carousel/llms.txt +11 -11
- package/src/lib/checkbox/llms.txt +7 -7
- package/src/lib/chip/llms.txt +6 -6
- package/src/lib/chips-input/llms.txt +9 -9
- package/src/lib/color-picker/llms.txt +7 -7
- package/src/lib/confirm/llms.txt +11 -11
- package/src/lib/context-menu/llms.txt +10 -10
- package/src/lib/data-table/llms.txt +170 -170
- package/src/lib/data-view/llms.txt +8 -8
- package/src/lib/date-range/llms.txt +25 -25
- package/src/lib/datepicker/llms.txt +48 -48
- package/src/lib/dialog/llms.txt +62 -62
- package/src/lib/divider/llms.txt +9 -9
- package/src/lib/drawer/llms.txt +18 -18
- package/src/lib/empty/llms.txt +9 -9
- package/src/lib/fab/llms.txt +12 -12
- package/src/lib/fieldset/llms.txt +9 -9
- package/src/lib/file-upload/llms.txt +10 -10
- package/src/lib/form-field/llms.txt +45 -45
- package/src/lib/galleria/llms.txt +7 -7
- package/src/lib/i18n/llms.txt +21 -21
- package/src/lib/icon/llms.txt +20 -20
- package/src/lib/icon-button/llms.txt +8 -8
- package/src/lib/image/llms.txt +9 -9
- package/src/lib/input/llms.txt +27 -25
- package/src/lib/input-mask/llms.txt +10 -10
- package/src/lib/input-number/llms.txt +34 -34
- package/src/lib/input-otp/llms.txt +11 -11
- package/src/lib/knob/llms.txt +14 -14
- package/src/lib/listbox/llms.txt +8 -8
- package/src/lib/megamenu/llms.txt +13 -13
- package/src/lib/menu/llms.txt +26 -26
- package/src/lib/menubar/llms.txt +10 -10
- package/src/lib/meter-group/llms.txt +8 -8
- package/src/lib/order-list/llms.txt +8 -8
- package/src/lib/paginator/llms.txt +12 -12
- package/src/lib/panel/llms.txt +12 -12
- package/src/lib/password/llms.txt +12 -9
- package/src/lib/pick-list/llms.txt +8 -8
- package/src/lib/popover/llms.txt +8 -8
- package/src/lib/progress/llms.txt +6 -6
- package/src/lib/radio-group/llms.txt +5 -5
- package/src/lib/rating/llms.txt +6 -6
- package/src/lib/rich-text/llms.txt +51 -32
- package/src/lib/scroll-top/llms.txt +7 -7
- package/src/lib/select/llms.txt +26 -26
- package/src/lib/sidenav/llms.txt +24 -24
- package/src/lib/skeleton/llms.txt +6 -6
- package/src/lib/slider/llms.txt +17 -17
- package/src/lib/speed-dial/llms.txt +7 -7
- package/src/lib/spinner/llms.txt +5 -5
- package/src/lib/split-button/llms.txt +15 -15
- package/src/lib/splitter/llms.txt +11 -11
- package/src/lib/stepper/llms.txt +10 -10
- package/src/lib/switch/llms.txt +10 -10
- package/src/lib/switch-group/llms.txt +16 -16
- package/src/lib/tabs/llms.txt +10 -10
- package/src/lib/textarea/llms.txt +5 -5
- package/src/lib/timeline/llms.txt +10 -10
- package/src/lib/toast/llms.txt +10 -10
- package/src/lib/toolbar/llms.txt +31 -31
- package/src/lib/tooltip/llms.txt +21 -21
- package/src/lib/tree/llms.txt +6 -6
- package/types/konce-pt-angular.d.ts +316 -7
- package/types/konce-pt-angular.d.ts.map +1 -1
|
@@ -1,91 +1,91 @@
|
|
|
1
1
|
# KptDataTable (kpt-data-table)
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
The flagship data table: columns from configuration, sorting, a global filter,
|
|
4
|
+
pagination, row selection and custom cell templates. Signal-based, OnPush.
|
|
5
5
|
Import: `import { KptDataTable, KptColumn, KptCellDef, KptCellEditDef, KptRowDetailDef } from '@konce-pt/angular';`
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## Selector
|
|
8
8
|
`kpt-data-table`
|
|
9
9
|
|
|
10
|
-
##
|
|
10
|
+
## The column model (KptColumn)
|
|
11
11
|
`{ field: string; header: string; sortable?: boolean; align?: 'start'|'center'|'end'; width?: string; frozen?: boolean; filter?: KptColumnFilter; edit?: KptColumnEdit; summary?: KptColumnSummary }`
|
|
12
|
-
|
|
12
|
+
`frozen` columns (leading, adjacent) stick during horizontal scrolling — they require `width`.
|
|
13
13
|
|
|
14
|
-
###
|
|
14
|
+
### The column filter (KptColumnFilter)
|
|
15
15
|
`{ type: 'text'|'number'|'select'|'dateRange'|'numberRange'|'slider'; options?: KptOption[]; multiple?: boolean; placeholder?: string; min?: number; max?: number; step?: number }`
|
|
16
|
-
|
|
17
|
-
- `text` — input
|
|
18
|
-
- `select` —
|
|
19
|
-
- `numberRange` —
|
|
20
|
-
- `slider` —
|
|
21
|
-
- `dateRange` —
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
###
|
|
16
|
+
As soon as any column has a `filter`, a filter row is rendered in the header:
|
|
17
|
+
- `text` — a text input ("contains" matching), `number` — a digits-only input (matching on digits),
|
|
18
|
+
- `select` — a selection list (with `multiple` = many; OR matching). When the field's value is an **array** (a list of tags or members, say), it matches when the array contains any of the selected values,
|
|
19
|
+
- `numberRange` — two fields (min–max); it matches when the field's numeric value falls inside the range (an empty bound = open),
|
|
20
|
+
- `slider` — a range slider (two handles; `min`/`max`/`step`); the filter value is `[lo, hi]`, matching a number inside `[lo, hi]`,
|
|
21
|
+
- `dateRange` — a date range (an ISO/Date field within `[start,end]`).
|
|
22
|
+
Column filters combine with AND, both with each other and with the global filter; a change resets the page.
|
|
23
|
+
Filters work on the **raw field value** (`row[field]`), regardless of any custom `kptCell` template — so columns with a custom cell (a status badge, for instance) can be filtered too.
|
|
24
|
+
The `select`/`dateRange` filters require `import '@angular/cdk/overlay-prebuilt.css';`.
|
|
25
|
+
|
|
26
|
+
### Column editing (KptColumnEdit)
|
|
27
27
|
`{ type: 'text'|'number'|'date'|'select'|'multiselect'; options?: KptOption[]; placeholder?: string; min?: number; max?: number; step?: number }`
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
`select` → `kpt-select`, `multiselect` → `kpt-select multiple filter`.
|
|
28
|
+
When a column has `edit`, its cells become clickable — a click (or Enter on a focused cell) swaps
|
|
29
|
+
the value for a control: `text` → `kpt-input`, `number` → `kpt-input-number`, `date` → `kpt-datepicker`,
|
|
30
|
+
`select` → `kpt-select`, `multiselect` → `kpt-select multiple filter`. See the "Inline editing" section below.
|
|
31
31
|
|
|
32
|
-
###
|
|
32
|
+
### The column summary (KptColumnSummary)
|
|
33
33
|
`{ fn: 'sum'|'avg'|'min'|'max'|'count' | ((rows) => unknown); format?: (value) => string }`
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
##
|
|
37
|
-
- `columns`: KptColumn[] (
|
|
38
|
-
- `data`: T[] (
|
|
39
|
-
- `filterable`: boolean —
|
|
40
|
-
- `filterRowPosition`: 'top' | 'bottom' (
|
|
41
|
-
- `pageSize`: number — 0
|
|
42
|
-
- `pageSizeOptions`: number[] (
|
|
34
|
+
A column with `summary` is aggregated in the summary row — see the "Summary row" section below.
|
|
35
|
+
|
|
36
|
+
## Inputs
|
|
37
|
+
- `columns`: KptColumn[] (required)
|
|
38
|
+
- `data`: T[] (default [])
|
|
39
|
+
- `filterable`: boolean — the global filter field
|
|
40
|
+
- `filterRowPosition`: 'top' | 'bottom' (default 'bottom') — the column filter row above/below the labels
|
|
41
|
+
- `pageSize`: number — 0 disables pagination
|
|
42
|
+
- `pageSizeOptions`: number[] (default [5,10,20,50])
|
|
43
43
|
- `selectable`: 'none' | 'single' | 'multiple'
|
|
44
|
-
- `loading`: boolean —
|
|
45
|
-
- `emptyMessage`: string —
|
|
46
|
-
- `rowKey`: string | null —
|
|
47
|
-
- `reorderable`: boolean —
|
|
48
|
-
- `exportable`: boolean —
|
|
49
|
-
- `exportFilename`: string (
|
|
50
|
-
- `lazy`: boolean —
|
|
51
|
-
- `totalRecords`: number | null —
|
|
52
|
-
- `scrollHeight`: string | null —
|
|
53
|
-
- `virtualScroll`: boolean —
|
|
54
|
-
- `rowHeight`: number —
|
|
55
|
-
- `expandable`: boolean —
|
|
56
|
-
- `multiExpand`: boolean (
|
|
57
|
-
- `summaryLabel`: string —
|
|
58
|
-
- `summaryValues`: Record<string, unknown> | null —
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
## Model /
|
|
62
|
-
- `selection`: model<T[]> —
|
|
63
|
-
- `expandedRows`: model<T[]> —
|
|
64
|
-
- `hiddenFields`: model<readonly string[]> —
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
(`apps/playground/src/pg-column-toggle.component.ts`) —
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
44
|
+
- `loading`: boolean — a "Loading…" row
|
|
45
|
+
- `emptyMessage`: string — with no value it uses i18n (`dataTable.empty`); the input takes priority
|
|
46
|
+
- `rowKey`: string | null — the field identifying a row (for selection); without it rows are compared by reference
|
|
47
|
+
- `reorderable`: boolean — drag-and-drop column reordering (native HTML5 DnD); `frozen` columns are excluded from moving (they stay leading) and no other column can be dropped in front of them
|
|
48
|
+
- `exportable`: boolean — an "Export CSV" button in the toolbar
|
|
49
|
+
- `exportFilename`: string (default 'export.csv')
|
|
50
|
+
- `lazy`: boolean — server-side mode (no client-side filtering/sorting/pagination)
|
|
51
|
+
- `totalRecords`: number | null — the total record count (required with lazy)
|
|
52
|
+
- `scrollHeight`: string | null — the height of the scrollable area (e.g. '400px'); the sticky header stays
|
|
53
|
+
- `virtualScroll`: boolean — row virtualization (only visible rows are rendered); requires `scrollHeight`
|
|
54
|
+
- `rowHeight`: number — a fixed row height in px (default 41), needed with virtualScroll
|
|
55
|
+
- `expandable`: boolean — a column with a toggle that expands the row (rendering the `kptRowDetail` template)
|
|
56
|
+
- `multiExpand`: boolean (default true) — allows several rows open at once; false = only one
|
|
57
|
+
- `summaryLabel`: string — the summary row's label; with no value it uses i18n (`dataTable.total`)
|
|
58
|
+
- `summaryValues`: Record<string, unknown> | null — ready-made summary values (field → value);
|
|
59
|
+
they override the computed ones, and with `lazy` they are the only source
|
|
60
|
+
|
|
61
|
+
## Model / events
|
|
62
|
+
- `selection`: model<T[]> — two-way `[(selection)]`
|
|
63
|
+
- `expandedRows`: model<T[]> — two-way `[(expandedRows)]` (the expanded rows)
|
|
64
|
+
- `hiddenFields`: model<readonly string[]> — two-way `[(hiddenFields)]`; the set of `KptColumn.field`
|
|
65
|
+
values currently hidden. The component provides no UI for managing that state itself (no button,
|
|
66
|
+
no dialog, no persistence) — it is a deliberately minimal hook for wiring up an external column
|
|
67
|
+
switcher. An example of a finished UI (a button + a dialog with checkboxes + localStorage persistence), built
|
|
68
|
+
from `kpt-dialog`/`kpt-checkbox`/`kpt-button`, lives in the playground as `pg-column-toggle`
|
|
69
|
+
(`apps/playground/src/pg-column-toggle.component.ts`) — it is not exported from the library.
|
|
70
|
+
Hiding a column does not take it out of the global search or the per-column filters — only
|
|
71
|
+
out of the view (and out of the CSV export, see below). The order remembered by `reorderable` survives
|
|
72
|
+
hiding and showing a column. To place a compact (icon) version of such a button
|
|
73
|
+
next to the paginator there is the `[kptPaginatorActions]` projection slot — see the "The paginator
|
|
74
|
+
row" section below.
|
|
75
75
|
- `rowClick`: output<T>
|
|
76
|
-
- `lazyLoad`: output<KptTableLazyState> — { pageIndex, pageSize, sortField, sortDir, filter, columnFilters };
|
|
77
|
-
- `cellEdit`: output<KptCellEditEvent<T>> — `{ row, field, value, updatedRow }`;
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
76
|
+
- `lazyLoad`: output<KptTableLazyState> — { pageIndex, pageSize, sortField, sortDir, filter, columnFilters }; emitted in lazy mode on every state change
|
|
77
|
+
- `cellEdit`: output<KptCellEditEvent<T>> — `{ row, field, value, updatedRow }`; emitted once a cell
|
|
78
|
+
edit is committed (see "Inline editing" below), and only when the value actually
|
|
79
|
+
changed. The table saves nothing itself (no HTTP, no loading/error state) — `updatedRow`
|
|
80
|
+
is a ready request body, and the rest (saving, an optimistic update, a rollback on error) is handled
|
|
81
|
+
by the consumer, exactly as with `lazyLoad`.
|
|
82
82
|
|
|
83
|
-
##
|
|
84
|
-
- `exportCsv()`:
|
|
85
|
-
|
|
83
|
+
## Export / methods
|
|
84
|
+
- `exportCsv()`: a public method — exports the current (filtered+sorted) data to CSV (the `;` separator, a BOM for
|
|
85
|
+
Excel). It exports only the currently **visible** columns (those in `hiddenFields` are left out).
|
|
86
86
|
|
|
87
|
-
##
|
|
88
|
-
|
|
87
|
+
## Custom cell templates (the kptCell directive)
|
|
88
|
+
Context: `$implicit` = the row, `value` = the field's value.
|
|
89
89
|
|
|
90
90
|
<kpt-data-table [columns]="cols" [data]="rows" filterable [pageSize]="10"
|
|
91
91
|
selectable="multiple" rowKey="id" [(selection)]="picked">
|
|
@@ -94,48 +94,48 @@ Kontekst: `$implicit` = wiersz, `value` = wartość pola.
|
|
|
94
94
|
</ng-template>
|
|
95
95
|
</kpt-data-table>
|
|
96
96
|
|
|
97
|
-
##
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
97
|
+
## Expandable rows (the kptRowDetail directive)
|
|
98
|
+
Turn on `expandable` and supply a `kptRowDetail` template (context: `$implicit` = the row).
|
|
99
|
+
It adds a leading column with a toggle; an expanded row renders the template at full width below the row.
|
|
100
|
+
The state goes through `[(expandedRows)]`; `multiExpand=false` limits it to one open at a time.
|
|
101
|
+
Independent of `selectable` (it can be combined with selection). Not available with `virtualScroll`.
|
|
102
102
|
|
|
103
103
|
<kpt-data-table [columns]="cols" [data]="rows" expandable rowKey="id" [(expandedRows)]="open">
|
|
104
104
|
<ng-template kptRowDetail let-row>
|
|
105
|
-
<div class="
|
|
105
|
+
<div class="details">{{ row.description }}</div>
|
|
106
106
|
</ng-template>
|
|
107
107
|
</kpt-data-table>
|
|
108
108
|
|
|
109
|
-
##
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
- `text`/`number` (`kpt-input`, `kpt-input-number`) —
|
|
114
|
-
**
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
- `date`/`select`/`multiselect` (`kpt-datepicker`, `kpt-select`) — panel
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
**
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
`$implicit` =
|
|
109
|
+
## Inline editing (column.edit / kptCellEdit)
|
|
110
|
+
Clicking a cell in an editable column (or pressing Enter while the cell has focus — it carries `tabindex="0"` then)
|
|
111
|
+
swaps its value for a control from `column.edit.type`. How it commits depends on the kind of control:
|
|
112
|
+
|
|
113
|
+
- `text`/`number` (`kpt-input`, `kpt-input-number`) — there is no overlay, so it commits when focus leaves
|
|
114
|
+
**the whole editor** (`focusout` with a `relatedTarget` check) or on Enter; Escape discards the change.
|
|
115
|
+
Deliberately not on the control's own `touch`/blur: `kpt-input-number` has focusable `+`/`-` arrows
|
|
116
|
+
next to the field (and it also emits `touch` in `step_()`), so every arrow click would close
|
|
117
|
+
the edit before it had a chance to change the value.
|
|
118
|
+
- `date`/`select`/`multiselect` (`kpt-datepicker`, `kpt-select`) — the panel opens **immediately** after
|
|
119
|
+
the cell is clicked, and the commit happens when it **closes**: picking a value (single),
|
|
120
|
+
a click outside the panel or Escape. In `multiselect`, ticking further options commits nothing along
|
|
121
|
+
the way — the panel stays open until the user clicks outside it, and then a single event fires with the full list.
|
|
122
|
+
|
|
123
|
+
The table **never commits on `touch`** — and that must not be reinstated. `touch` in these
|
|
124
|
+
controls does not mean "the user is done": it fires on the trigger's blur (and the panel lives in a CDK Overlay
|
|
125
|
+
container next to `<body>`, so pressing the mouse on an option/day blurs the trigger) and, on top of that, from `step_()`
|
|
126
|
+
in `kpt-input-number`. Committing on `touch` destroyed the editor together with the panel before the click
|
|
127
|
+
had a chance to pick a value. Instead: overlay editors bind to `open` (`[open]`/`(openChange)`),
|
|
128
|
+
and the rest to `focusout` on the whole editor (focus moved within the editor does not commit).
|
|
129
|
+
|
|
130
|
+
**A limitation**: for overlay editors Escape **commits** (it closes the panel) rather than discarding —
|
|
131
|
+
the panel's keyboard handling lives inside `kpt-select`/`kpt-datepicker`, and a keydown from the overlay does not
|
|
132
|
+
reach the cell. Escape discards a change only in `text`/`number`.
|
|
133
|
+
|
|
134
|
+
Values are compared before emitting: `cellEdit` does not fire when the user opened and closed a panel without
|
|
135
|
+
a change, nor when a `multiselect` returns to the same set (arrays are compared by content).
|
|
136
|
+
|
|
137
|
+
When the 5 built-in types are not enough, the `kptCellEdit` directive gives you a full custom editor. Context:
|
|
138
|
+
`$implicit` = the current value, `row` = the row, `commit(value)` = commit and close, `cancel()` = discard.
|
|
139
139
|
|
|
140
140
|
<kpt-data-table [columns]="cols" [data]="rows" rowKey="id" (cellEdit)="onCellEdit($event)">
|
|
141
141
|
<ng-template kptCellEdit="team" let-value let-commit="commit">
|
|
@@ -143,84 +143,84 @@ Gdy 5 wbudowanych typów nie wystarcza, dyrektywa `kptCellEdit` daje pełny, wł
|
|
|
143
143
|
</ng-template>
|
|
144
144
|
</kpt-data-table>
|
|
145
145
|
|
|
146
|
-
##
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
- **
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
- **
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
- **
|
|
159
|
-
|
|
160
|
-
- **
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
- **
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
(`avg`, `min`, `max`)
|
|
168
|
-
- **
|
|
169
|
-
|
|
170
|
-
-
|
|
171
|
-
(
|
|
172
|
-
|
|
173
|
-
-
|
|
174
|
-
-
|
|
146
|
+
## The summary row (column.summary)
|
|
147
|
+
Columns with a `summary` render a `<tfoot>` — the table's last row, **above the paginator**, stuck
|
|
148
|
+
to the bottom of the scrolling area (`position: sticky; bottom: 0`, like the sticky header).
|
|
149
|
+
|
|
150
|
+
- **The label** (`summaryLabel`, i18n `dataTable.total` by default → "Total"/"Razem") is rendered
|
|
151
|
+
in one merged cell (`colspan`) reaching from the start of the row to the first aggregated column,
|
|
152
|
+
right-aligned. The colspan also covers the system columns (expand, select).
|
|
153
|
+
For example: a `summary` on the 3rd column → columns 1–2 merged. When the **first** visible
|
|
154
|
+
column is the aggregated one (and there are no system columns), the label has nowhere to fit and is not rendered.
|
|
155
|
+
- **The scope**: the aggregation covers **every row after filtering** — the whole of page 1 and every following one,
|
|
156
|
+
not just what is visible. The global filter and the column filters narrow the set (in step with the paginator's counter),
|
|
157
|
+
while sorting and the current page do not change the result.
|
|
158
|
+
- **Live under inline editing**: `data` is an ordinary input, so once the consumer swaps the array in a signal
|
|
159
|
+
after `cellEdit`, the summary recomputes itself (a plain `computed`).
|
|
160
|
+
- **Aggregations**: `sum`, `avg`, `min`, `max`, `count`. `count` counts rows; the rest skip
|
|
161
|
+
non-numeric values (a string holding a number is parsed). On an empty set: `sum` = 0, the rest — an empty
|
|
162
|
+
cell. `sum`/`avg` trim floating-point tails (without that `0.1+0.2` = `0.30000000000000004`).
|
|
163
|
+
A custom `fn: (rows) => unknown` receives the same set (a weighted sum, for instance).
|
|
164
|
+
- **Formatting**: `format: (value) => string` (`Intl.NumberFormat`, say); without it the value goes out
|
|
165
|
+
raw. Summary cells are right-aligned by default — an explicit column `align` takes priority.
|
|
166
|
+
The row label ("Total") is one for the whole row, so name a column aggregated by anything other than a sum
|
|
167
|
+
(`avg`, `min`, `max`) inside `format` (e.g. `ø 662.57 USD`) — otherwise it reads as a sum.
|
|
168
|
+
- **Hidden columns** (`hiddenFields`) drop out of the summary too; the order after `reorderable`
|
|
169
|
+
is respected (the label merges up to whatever is now the first aggregated column).
|
|
170
|
+
- **`lazy` mode**: the table only holds the current page, so it computes nothing itself — supply `summaryValues`
|
|
171
|
+
(field → a ready value from the server). `summaryValues` also works outside `lazy`, overriding the computed values.
|
|
172
|
+
A column listed only in `summaryValues` (with no `summary`) shows a value too.
|
|
173
|
+
- The row is not rendered while `loading`, nor when the table is empty (we do not duplicate the state message).
|
|
174
|
+
- The CSV export **does not include** the summary row — `exportCsv()` exports the data alone.
|
|
175
175
|
|
|
176
176
|
cols = [
|
|
177
|
-
{ field: 'product', header: '
|
|
178
|
-
{ field: 'qty', header: '
|
|
179
|
-
{ field: 'net', header: '
|
|
177
|
+
{ field: 'product', header: 'Product' },
|
|
178
|
+
{ field: 'qty', header: 'Quantity', align: 'end', summary: { fn: 'sum' } },
|
|
179
|
+
{ field: 'net', header: 'Net', align: 'end', summary: { fn: 'sum', format: usd } },
|
|
180
180
|
];
|
|
181
181
|
|
|
182
182
|
<kpt-data-table [columns]="cols" [data]="rows()" [pageSize]="5" rowKey="id"
|
|
183
|
-
summaryLabel="
|
|
183
|
+
summaryLabel="Total" (cellEdit)="onCellEdit($event)" />
|
|
184
184
|
|
|
185
|
-
##
|
|
186
|
-
-
|
|
187
|
-
-
|
|
188
|
-
-
|
|
189
|
-
-
|
|
185
|
+
## Behavior
|
|
186
|
+
- Sorting: clicking a sortable column's header cycles asc → desc → none.
|
|
187
|
+
- Filtering: text matching across every column field; the page resets to 0.
|
|
188
|
+
- 'multiple' selection: the header checkbox selects/deselects the current page.
|
|
189
|
+
- A sticky header, empty/loading states, per-column alignment and widths.
|
|
190
190
|
|
|
191
191
|
## i18n
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
##
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
192
|
+
The toolbar/state/aria labels (Search, Export CSV, Loading, No data, selection, the column filters:
|
|
193
|
+
Filter/Filter min/Filter max with `{column}`, All, min, max, Date range) come from i18n (the `dataTable` namespace).
|
|
194
|
+
English by default; configured through `provideKptI18n` — see `i18n/llms.txt`.
|
|
195
|
+
|
|
196
|
+
## The paginator row (the [kptPaginatorActions] slot)
|
|
197
|
+
The row holding `kpt-paginator` (rendered when `pageSize > 0` and there is no `virtualScroll`) is a flex
|
|
198
|
+
container with an optional projection slot on the left: a `<div kptPaginatorActions>…</div>` placed
|
|
199
|
+
as content of `kpt-data-table` renders before the paginator, in the same row (`kpt-paginator`
|
|
200
|
+
has `flex: 1 1 auto` and its own `justify-content: flex-end` — with no projection it behaves exactly
|
|
201
|
+
as it did before, fully to the right). This is the place for a compact (icon) column-customization button —
|
|
202
|
+
see `hiddenFields` above and the `pg-column-toggle` example in the playground.
|
|
203
203
|
|
|
204
204
|
<kpt-data-table [columns]="cols" [data]="rows" [pageSize]="10" [(hiddenFields)]="hidden">
|
|
205
|
-
<kpt-icon-button kptPaginatorActions ariaLabel="
|
|
205
|
+
<kpt-icon-button kptPaginatorActions ariaLabel="Columns" (click)="open.set(true)">
|
|
206
206
|
<kpt-icon name="adjustments-horizontal" />
|
|
207
207
|
</kpt-icon-button>
|
|
208
208
|
</kpt-data-table>
|
|
209
209
|
|
|
210
|
-
##
|
|
210
|
+
## Tokens
|
|
211
211
|
`--kpt-table-{bg,fg,border,radius,header-bg,header-fg,row-hover,row-selected,cell-padding}`.
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
212
|
+
The expanded row: `--kpt-table-detail-bg` (fallback: surface-variant → row-hover).
|
|
213
|
+
The summary row: `--kpt-table-summary-bg` (fallback: header-bg).
|
|
214
|
+
Pagination: the `kpt-paginator` component.
|
|
215
215
|
|
|
216
|
-
##
|
|
217
|
-
|
|
216
|
+
## To do (roadmap)
|
|
217
|
+
Grouped columns.
|
|
218
218
|
|
|
219
|
-
|
|
220
|
-
|
|
219
|
+
Column show/hide: done (the `hiddenFields` hook; the customization UI — see the "Model / events" section
|
|
220
|
+
and the `pg-column-toggle` example in the playground).
|
|
221
221
|
|
|
222
|
-
|
|
223
|
-
|
|
222
|
+
Inline cell editing: done (`column.edit` + `cellEdit` + `kptCellEdit`; saving to an API —
|
|
223
|
+
see the playground example, `pg-fake-users-api.ts`).
|
|
224
224
|
|
|
225
|
-
|
|
226
|
-
|
|
225
|
+
The summary row: done (`column.summary` + `summaryLabel` + `summaryValues` — see the
|
|
226
|
+
"The summary row" section and the "Inline editing + summary row" example in the playground).
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
# KptDataView (kpt-data-view)
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
Presents a list of items in a list or grid layout, with optional pagination (reusing `kpt-paginator`).
|
|
4
|
+
The item template comes through projection: `<ng-template let-item>`.
|
|
5
5
|
Import: `import { KptDataView } from '@konce-pt/angular';`
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## Inputs / model
|
|
8
8
|
- `items`: T[]
|
|
9
|
-
- `layout`: model<'list' | 'grid'> (
|
|
10
|
-
- `pageSize`: number (0 =
|
|
9
|
+
- `layout`: model<'list' | 'grid'> (the toggle in the bar)
|
|
10
|
+
- `pageSize`: number (0 = no pagination); `paginated`: boolean
|
|
11
11
|
|
|
12
|
-
##
|
|
12
|
+
## Example
|
|
13
13
|
<kpt-data-view [items]="products" [pageSize]="6">
|
|
14
14
|
<ng-template let-p><div>{{ p.name }}</div></ng-template>
|
|
15
15
|
</kpt-data-view>
|
|
16
16
|
|
|
17
|
-
##
|
|
18
|
-
|
|
17
|
+
## Tokens
|
|
18
|
+
Item cards `--kpt-color-surface-raised`; the toggle `--kpt-color-primary`.
|
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
# KptDateRange (kpt-date-range)
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
`mode`: 'date' (
|
|
5
|
-
|
|
3
|
+
Picking a date/time range with a calendar (CDK Overlay) on Signal Forms.
|
|
4
|
+
`mode`: 'date' (default), 'datetime' (date+time, the `kpt-clock` dial), 'time' (time only).
|
|
5
|
+
The value is `{ start, end }` (KptDateRangeValue): dates 'YYYY-MM-DD', datetime 'YYYY-MM-DDTHH:mm', times 'HH:mm'.
|
|
6
6
|
Import: `import { KptDateRange, KptDateRangeValue } from '@konce-pt/angular';`
|
|
7
|
-
|
|
7
|
+
Requires `import '@angular/cdk/overlay-prebuilt.css';`
|
|
8
8
|
|
|
9
|
-
##
|
|
10
|
-
- `value`: model<KptDateRangeValue> (
|
|
11
|
-
- `mode`: 'date' | 'datetime' | 'time' (
|
|
12
|
-
- `visibleMonths`: number (
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
- `hourFormat`: 12 | 24 (
|
|
17
|
-
- `minuteStep`: number (
|
|
18
|
-
- `placeholder`: string —
|
|
19
|
-
- `displayFormat`: 'pl' | 'iso' (
|
|
9
|
+
## Inputs / model
|
|
10
|
+
- `value`: model<KptDateRangeValue> (or `formField`)
|
|
11
|
+
- `mode`: 'date' | 'datetime' | 'time' (default 'date')
|
|
12
|
+
- `visibleMonths`: number (default 1, clamped to 1–3) — how many months sit side by side.
|
|
13
|
+
The ‹ › arrows stand on the outermost panels and move the whole set by one month.
|
|
14
|
+
Ignored in 'time' mode. With more than one, days from adjacent months are hidden (empty slots) —
|
|
15
|
+
otherwise the same date would be clickable in two panels at once.
|
|
16
|
+
- `hourFormat`: 12 | 24 (default 24) — an AM/PM or a 24h dial; the value is always 24h
|
|
17
|
+
- `minuteStep`: number (default 1) — minute snapping on the dial
|
|
18
|
+
- `placeholder`: string — with no value it uses i18n (`dateRange.placeholder`); the input takes priority
|
|
19
|
+
- `displayFormat`: 'pl' | 'iso' (default 'pl') — the display format for start/end
|
|
20
20
|
- `disabled`/`invalid`/`touched`: boolean; `touch`: output
|
|
21
21
|
|
|
22
|
-
##
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
## Behavior
|
|
23
|
+
The first click sets `start`, the second `end` (the order is normalized). The "×" clears it.
|
|
24
|
+
The range highlights one continuous band running across every panel: the end days carry the selection
|
|
25
|
+
blob, and the band leaves their center, rounding off at the ends of a grid row.
|
|
26
|
+
The datetime/time modes: a "From / To" toggle + the clock dial, confirmed with the "Done" button.
|
|
27
27
|
|
|
28
|
-
##
|
|
28
|
+
## Example
|
|
29
29
|
<kpt-date-range [formField]="f.period" />
|
|
30
30
|
<kpt-date-range [(value)]="period" />
|
|
31
31
|
<kpt-date-range [visibleMonths]="2" [(value)]="period" />
|
|
@@ -33,8 +33,8 @@ Tryby datetime/time: przełącznik „Od / Koniec" + tarcza zegara, zatwierdzeni
|
|
|
33
33
|
period = signal<KptDateRangeValue>({ start: '', end: '' });
|
|
34
34
|
|
|
35
35
|
## i18n
|
|
36
|
-
|
|
37
|
-
(
|
|
36
|
+
Day and month names come from `Intl` per locale; the labels ("From/To", navigation, "Done", the placeholder) come from i18n
|
|
37
|
+
(the `dateRange` namespace + `datepicker`/`common`). English by default — see `i18n/llms.txt`.
|
|
38
38
|
|
|
39
|
-
##
|
|
40
|
-
|
|
39
|
+
## Tokens
|
|
40
|
+
The field `--kpt-form-field-*`; the calendar `--kpt-color-surface-raised`, the range `--kpt-color-primary`.
|