@poadio/ui-elements 0.5.0 → 0.7.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.
Files changed (52) hide show
  1. package/CHANGELOG.md +58 -0
  2. package/dist/app-shell.d.ts +34 -0
  3. package/dist/app-shell.d.ts.map +1 -0
  4. package/dist/app-shell.js +112 -0
  5. package/dist/app-shell.js.map +1 -0
  6. package/dist/bottom-nav.d.ts +79 -0
  7. package/dist/bottom-nav.d.ts.map +1 -0
  8. package/dist/bottom-nav.js +86 -0
  9. package/dist/bottom-nav.js.map +1 -0
  10. package/dist/breakpoint.d.ts +47 -0
  11. package/dist/breakpoint.d.ts.map +1 -0
  12. package/dist/breakpoint.js +74 -0
  13. package/dist/breakpoint.js.map +1 -0
  14. package/dist/dataview.d.ts +114 -0
  15. package/dist/dataview.d.ts.map +1 -0
  16. package/dist/dataview.js +75 -0
  17. package/dist/dataview.js.map +1 -0
  18. package/dist/floating.d.ts +1 -0
  19. package/dist/floating.d.ts.map +1 -1
  20. package/dist/floating.js +3 -18
  21. package/dist/floating.js.map +1 -1
  22. package/dist/index.d.ts +32 -2
  23. package/dist/index.d.ts.map +1 -1
  24. package/dist/index.js +12 -2
  25. package/dist/index.js.map +1 -1
  26. package/dist/layout.d.ts +262 -0
  27. package/dist/layout.d.ts.map +1 -0
  28. package/dist/layout.js +137 -0
  29. package/dist/layout.js.map +1 -0
  30. package/dist/menubar.d.ts +96 -0
  31. package/dist/menubar.d.ts.map +1 -0
  32. package/dist/menubar.js +326 -0
  33. package/dist/menubar.js.map +1 -0
  34. package/dist/nav-drawer.d.ts +141 -0
  35. package/dist/nav-drawer.d.ts.map +1 -0
  36. package/dist/nav-drawer.js +204 -0
  37. package/dist/nav-drawer.js.map +1 -0
  38. package/dist/table.d.ts +83 -5
  39. package/dist/table.d.ts.map +1 -1
  40. package/dist/table.js +134 -31
  41. package/dist/table.js.map +1 -1
  42. package/package.json +2 -2
  43. package/src/app-shell.ts +101 -0
  44. package/src/bottom-nav.ts +126 -0
  45. package/src/breakpoint.ts +84 -0
  46. package/src/dataview.ts +143 -0
  47. package/src/floating.ts +4 -19
  48. package/src/index.ts +23 -3
  49. package/src/layout.ts +272 -0
  50. package/src/menubar.ts +316 -0
  51. package/src/nav-drawer.ts +256 -0
  52. package/src/table.ts +170 -32
@@ -0,0 +1,256 @@
1
+ /**
2
+ * <poad-nav-drawer value="home" items='[{"value":"home","label":"Home","icon":"home"},…]'>
3
+ * <strong slot="header">Acme</strong> <div slot="footer">…</div>
4
+ * </poad-nav-drawer>
5
+ *
6
+ * Tiroir de navigation : le menu principal de l'application, un composant pour trois états. En `auto` (défaut), le point
7
+ * de rupture de la fenêtre décide : colonne permanente au-dessus de `breakpoint`, tiroir par-dessus le contenu en
8
+ * dessous (ouvert par l'application : `open`, `show()`, `toggle()`), rail d'icônes sous `rail-below` s'il est donné.
9
+ * Intertitres (`section`), intertitres repliables (`collapsible`, clé `value`), destination courante (`value`, ou `url`
10
+ * égale à `current`). Tiroir ouvert : boîte de dialogue modale (voile, focus sur la destination courante et piégé, Échap,
11
+ * focus rendu). Clavier dans la liste : ↓ ↑ Début Fin, → ← sur un intertitre repliable.
12
+ *
13
+ * Décisions : module `nav-drawer` de @poadio/ui-core — même DOM, mêmes classes, même ARIA que `poad-nav-drawer`
14
+ * d'ui-angular. Les entrées à adresse sont des `<a href>` ; `itemclick` est annulable (routeur de l'application).
15
+ * Styles : `nav-drawer.css`, `icon.css`.
16
+ */
17
+ import {
18
+ BREAKPOINT_SERVER_WIDTH, breakpointOf, elementIsRtl, navDrawerBadge, navDrawerClasses, navDrawerFocusable, navDrawerIsActive, navDrawerItemProps, navDrawerKeydown,
19
+ navDrawerModal, navDrawerMode, navDrawerPanelProps, navDrawerPick, navDrawerRows, navDrawerSectionCount, navDrawerShouldClose, navDrawerToggle,
20
+ type Breakpoint, type NavDrawerEffectiveMode, type NavDrawerMode, type NavDrawerPosition,
21
+ } from '@poadio/ui-core';
22
+ import { slotted } from './card.js';
23
+ import { h, type Child } from './dom.js';
24
+ import { PoadElement } from './element.js';
25
+ import { FocusTrap, lockScroll } from './floating.js';
26
+ import { icon } from './icon.js';
27
+
28
+ /** Entrée du tiroir. `section: true` en fait un intertitre, pas un lien. */
29
+ export interface PoadNavDrawerItem {
30
+ /** Identifiant stable, comparé à `value` (destination courante) ; clé d'un intertitre repliable. */
31
+ readonly value?: string;
32
+ /** Libellé (en rail : `title` et nom accessible). */
33
+ readonly label: string;
34
+ /** Icône (nom du jeu d'icônes). */
35
+ readonly icon?: string;
36
+ /** Adresse : l'entrée devient un lien `<a href>`. */
37
+ readonly url?: string;
38
+ /** Cible du lien (`_blank`…). */
39
+ readonly target?: string;
40
+ /** Compte affiché à droite (un point en rail). */
41
+ readonly badge?: string | number;
42
+ /** Entrée désactivée (bouton inactif, sautée au clavier). */
43
+ readonly disabled?: boolean;
44
+ /** Intertitre de regroupement : rendu comme un libellé, non cliquable. */
45
+ readonly section?: boolean;
46
+ /** Intertitre repliable : un bouton qui masque les entrées qui le suivent, jusqu'au prochain intertitre. Donnez-lui un `value`. */
47
+ readonly collapsible?: boolean;
48
+ /** Libellé lu par un lecteur d'écran s'il doit différer du libellé visible. */
49
+ readonly ariaLabel?: string;
50
+ }
51
+
52
+ /**
53
+ * Tiroir de navigation.
54
+ * @slot header Contenu de l'en-tête (logo…) ; sans lui : `icon` et `title`.
55
+ * @slot footer Pied du tiroir (compte, déconnexion…).
56
+ * @fires itemclick Une entrée est choisie (pas une entrée désactivée), même déjà courante ; `detail` : `{ item, originalEvent }`. Annulable : `preventDefault()` empêche la navigation du lien, le changement de valeur et la fermeture.
57
+ * @fires change La destination courante change ; `detail` : sa valeur.
58
+ * @fires openchange Le tiroir s'ouvre ou se ferme de lui-même (Échap, voile, choix d'une entrée) ; `detail` : l'ouverture.
59
+ * @fires collapsedchange Un intertitre est plié ou déplié ; `detail` : les clés repliées.
60
+ */
61
+ export class PoadNavDrawerElement extends PoadElement {
62
+ static override props = {
63
+ items: 'json', value: 'string', current: 'string', open: 'boolean', collapsed: 'json', mode: 'string', breakpoint: 'string', railBelow: 'string', position: 'string',
64
+ heading: 'string', icon: 'string', ariaLabel: 'string', closeOnNavigate: 'boolean', closeOnEscape: 'boolean', dismissableScrim: 'boolean',
65
+ } as const;
66
+ /** Les entrées : liens, boutons, intertitres (`section`), intertitres repliables (`collapsible`). */
67
+ declare items?: readonly PoadNavDrawerItem[];
68
+ /** Destination courante, comparée à `item.value`. */
69
+ declare value?: string | null;
70
+ /** Adresse de la page courante : l'entrée dont `url` est égale est marquée (`aria-current="page"`). */
71
+ declare current?: string | null;
72
+ /** Ouverture du tiroir. Sans effet en colonne, où le panneau est toujours là. */
73
+ declare open?: boolean;
74
+ /** Clés des intertitres repliés : `item.value`, à défaut `item.label`. */
75
+ declare collapsed?: readonly string[];
76
+ /**
77
+ * `auto` (au point de rupture de la fenêtre), `permanent`, `temporary` (tiroir modal), `rail` (icônes).
78
+ * @default 'auto'
79
+ */
80
+ declare mode?: NavDrawerMode;
81
+ /**
82
+ * Seuil de bascule colonne → tiroir, en mode `auto`.
83
+ * @default 'md'
84
+ */
85
+ declare breakpoint?: Breakpoint;
86
+ /** En mode `auto`, sous ce seuil (et au-dessus de `breakpoint`) le tiroir devient un rail. */
87
+ declare railBelow?: Breakpoint | '';
88
+ /**
89
+ * Côté de l'écran.
90
+ * @default 'left'
91
+ */
92
+ declare position?: NavDrawerPosition;
93
+ /** Titre de l'en-tête par défaut (`title` dans les autres rendus : ici `heading`, l'attribut `title` de l'hôte ferait une info-bulle sur tout le tiroir). */
94
+ declare heading?: string;
95
+ /** Icône de l'en-tête par défaut. */
96
+ declare icon?: string;
97
+ /** Nom accessible (attribut `aria-label`) ; par défaut le message `nav.mainMenu` du catalogue. */
98
+ declare ariaLabel: string | null;
99
+ /**
100
+ * Referme le tiroir après un clic sur une entrée.
101
+ * @default true
102
+ */
103
+ declare closeOnNavigate?: boolean;
104
+ /**
105
+ * Échap referme le tiroir.
106
+ * @default true
107
+ */
108
+ declare closeOnEscape?: boolean;
109
+ /**
110
+ * Clic sur le voile : referme le tiroir.
111
+ * @default true
112
+ */
113
+ declare dismissableScrim?: boolean;
114
+ private stopResize: (() => void) | null = null;
115
+ private lastMode: NavDrawerEffectiveMode | null = null;
116
+ private readonly trap = new FocusTrap();
117
+ private unlock: (() => void) | null = null;
118
+ private readonly onEscape = (e: KeyboardEvent) => {
119
+ if (e.key === 'Escape' && navDrawerShouldClose('escape', this.effective(), !!this.open, { closeOnEscape: this.closeOnEscape })) this.setOpen(false);
120
+ };
121
+
122
+ override connectedCallback(): void {
123
+ super.connectedCallback();
124
+ const win = this.ownerDocument.defaultView;
125
+ if (this.stopResize || !this.content || !win) return;
126
+ const onResize = () => { if (this.effective() !== this.lastMode) this.update(); };
127
+ win.addEventListener('resize', onResize, { passive: true });
128
+ this.ownerDocument.addEventListener('keydown', this.onEscape);
129
+ this.stopResize = () => { win.removeEventListener('resize', onResize); this.ownerDocument.removeEventListener('keydown', this.onEscape); };
130
+ }
131
+ override disconnectedCallback(): void {
132
+ super.disconnectedCallback();
133
+ this.stopResize?.();
134
+ this.stopResize = null;
135
+ this.trap.sync(null, false);
136
+ this.unlock?.();
137
+ this.unlock = null;
138
+ }
139
+
140
+ /** Mode effectif : `auto` se résout au point de rupture de la fenêtre. */
141
+ effective(): NavDrawerEffectiveMode {
142
+ const bp = breakpointOf(this.ownerDocument.defaultView?.innerWidth ?? BREAKPOINT_SERVER_WIDTH);
143
+ return navDrawerMode(this.mode, bp, this.breakpoint || 'md', this.railBelow ?? '');
144
+ }
145
+ /** Ouvre le tiroir. */
146
+ show(): void { this.open = true; }
147
+ /** Ferme le tiroir. */
148
+ hide(): void { this.open = false; }
149
+ /** Bascule l'ouverture du tiroir. */
150
+ toggle(): void { this.open = !this.open; }
151
+
152
+ private setOpen(next: boolean): void {
153
+ if (next === !!this.open) return;
154
+ this.open = next;
155
+ this.emit('openchange', next);
156
+ }
157
+ private setCollapsed(next: string[]): void {
158
+ this.collapsed = next;
159
+ this.emit('collapsedchange', next);
160
+ }
161
+ private pick(it: PoadNavDrawerItem, e: MouseEvent): void {
162
+ const { action, close } = navDrawerPick(this.value ?? null, it, this.effective(), this.closeOnNavigate !== false);
163
+ if (action === 'none') { e.preventDefault(); return; }
164
+ const go = this.dispatchEvent(new CustomEvent('itemclick', { detail: { item: it, originalEvent: e }, bubbles: true, composed: true, cancelable: true }));
165
+ if (!go) { e.preventDefault(); return; }
166
+ if (action === 'change') { this.value = it.value!; this.emit('change', it.value); }
167
+ if (close) this.setOpen(false);
168
+ }
169
+ private rows(mode: NavDrawerEffectiveMode) {
170
+ return navDrawerRows(Array.isArray(this.items) ? this.items : [], Array.isArray(this.collapsed) ? this.collapsed : [], mode === 'rail');
171
+ }
172
+ private onListKey(e: KeyboardEvent): void {
173
+ const from = Number((e.target as HTMLElement).closest('[data-row]')?.getAttribute('data-row') ?? NaN);
174
+ if (Number.isNaN(from)) return;
175
+ const rows = this.rows(this.effective());
176
+ const step = navDrawerKeydown(rows, from, e.key, elementIsRtl(this));
177
+ if (!step) return;
178
+ e.preventDefault();
179
+ if ('toggle' in step) { this.setCollapsed(navDrawerToggle(this.collapsed, step.toggle)); return; }
180
+ if (navDrawerFocusable(rows[step.focus]!)) this.querySelector<HTMLElement>(`.poad-nav-drawer__list [data-row="${step.focus}"]`)?.focus();
181
+ }
182
+
183
+ protected override updated(): void {
184
+ super.updated();
185
+ const mode = this.lastMode!;
186
+ // Repasser en colonne laisse un tiroir « ouvert » qui n'a plus de sens : on le solde.
187
+ if (mode !== 'temporary' && this.open) { this.setOpen(false); return; }
188
+ const modal = navDrawerModal(mode, !!this.open);
189
+ this.trap.sync(modal ? this.querySelector<HTMLElement>('.poad-nav-drawer__panel') : null, true);
190
+ // Tiroir ouvert : la page derrière le voile ne défile plus.
191
+ if (modal && !this.unlock) this.unlock = lockScroll();
192
+ else if (!modal && this.unlock) { this.unlock(); this.unlock = null; }
193
+ }
194
+
195
+ protected render(): Child {
196
+ const mode = this.effective();
197
+ this.lastMode = mode;
198
+ const open = !!this.open;
199
+ const rail = mode === 'rail';
200
+ const modal = navDrawerModal(mode, open);
201
+ const icons = this.icons();
202
+ const p = navDrawerPanelProps(mode, open);
203
+ const header = slotted(this.content, 'header'), footer = slotted(this.content, 'footer');
204
+ const rows = this.rows(mode).map((r, i): Child => {
205
+ const it = r.item;
206
+ if (it.section) {
207
+ if (rail) return h('li', { class: 'poad-nav-drawer__rule', role: 'separator' });
208
+ if (r.collapsible) {
209
+ return h('li', {}, h('button', {
210
+ type: 'button', class: ['poad-nav-drawer__section', { 'is-collapsible': true, 'is-collapsed': r.collapsed }], 'aria-expanded': r.collapsed ? 'false' : 'true', 'data-row': String(i),
211
+ onclick: () => this.setCollapsed(navDrawerToggle(this.collapsed, r.key)),
212
+ }, [
213
+ icon(icons, 'chevron-down', { size: 12, class: 'poad-nav-drawer__chev' }),
214
+ h('span', { class: 'poad-nav-drawer__label' }, it.label),
215
+ h('span', { class: 'poad-nav-drawer__badge' }, navDrawerSectionCount(r)),
216
+ ]));
217
+ }
218
+ return h('li', { class: 'poad-nav-drawer__section' }, it.label);
219
+ }
220
+ const active = navDrawerIsActive(it, this.value ?? null, this.current ?? null);
221
+ const a = navDrawerItemProps(it, active, rail);
222
+ const b = navDrawerBadge(it, rail);
223
+ const body: Child[] = [
224
+ it.icon ? icon(icons, it.icon, { size: 17 }) : null,
225
+ !rail ? h('span', { class: 'poad-nav-drawer__label' }, it.label) : null,
226
+ b.show && !b.dot ? h('span', { class: 'poad-nav-drawer__badge' }, b.text) : null,
227
+ b.dot ? h('span', { class: 'poad-nav-drawer__dot', title: b.text }) : null,
228
+ ];
229
+ const common = {
230
+ 'aria-current': a['aria-current'] ?? undefined, 'aria-label': a['aria-label'] ?? undefined, title: a.title ?? undefined, 'data-row': String(i),
231
+ 'data-poad-autofocus': active ? '' : undefined, onclick: (e: MouseEvent) => this.pick(it, e),
232
+ };
233
+ const el = it.url && !it.disabled
234
+ ? h('a', { href: it.url, target: it.target, class: ['poad-nav-drawer__item', { 'is-active': active }], ...common }, body)
235
+ : h('button', { type: 'button', class: ['poad-nav-drawer__item', a.classes], disabled: !!it.disabled, ...common }, body);
236
+ return h('li', {}, el);
237
+ });
238
+ return h('div', { class: ['poad-nav-drawer', navDrawerClasses(mode, open, this.position || 'left')] }, [
239
+ modal ? h('div', {
240
+ class: 'poad-nav-drawer__scrim', 'aria-hidden': 'true',
241
+ onclick: () => { if (navDrawerShouldClose('scrim', this.effective(), !!this.open, { dismissableScrim: this.dismissableScrim })) this.setOpen(false); },
242
+ }) : null,
243
+ h('nav', {
244
+ class: 'poad-nav-drawer__panel', tabindex: '-1', 'aria-label': this.ariaLabel || this.i18n().t('nav.mainMenu'),
245
+ 'aria-hidden': p['aria-hidden'] ?? undefined, inert: p.inert ?? undefined, role: p.role ?? undefined, 'aria-modal': p['aria-modal'] ?? undefined,
246
+ }, [
247
+ h('div', { class: 'poad-nav-drawer__head' }, header.length ? header : [
248
+ this.icon ? icon(icons, this.icon, { size: 18 }) : null,
249
+ !rail && this.heading ? h('b', {}, this.heading) : null,
250
+ ]),
251
+ h('ul', { class: 'poad-nav-drawer__list', role: 'list', onkeydown: (e: KeyboardEvent) => this.onListKey(e) }, rows),
252
+ h('div', { class: ['poad-nav-drawer__foot', { 'is-empty': !footer.length }] }, footer),
253
+ ]),
254
+ ]);
255
+ }
256
+ }
package/src/table.ts CHANGED
@@ -50,6 +50,14 @@ import {
50
50
  tableTreeNodeState, tableTreeRootVars, tableTreeRowClasses, tableTreeToggle, tableTreeToggleProps, tableTreeToggleRow, type TableSelectionPropagation,
51
51
  type PaginatorEvent, type TableColumnDef, type TableFilters, type TableSelectionChange, type TableSelectionMode, type TableSortMeta, type TableSortMode, type TableSortOrder,
52
52
  } from '@poadio/ui-core';
53
+ import {
54
+ TABLE_STACK_AT, tableFilterActiveCount, tableFiltersToggleProps, tableFiltersToggleShown, tableHiddenInExpansion, tableHiddenPriorities, tablePriorityColumns, tableResponsiveClasses, tableResponsivePageLinks,
55
+ tableStacked, type TablePriorityBreakpoints, type TableResponsiveMode,
56
+ } from '@poadio/ui-core';
57
+ import {
58
+ TABLE_ACTIONS_WIDTH, tableHasActionsColumn, tableHasSticky, tableScrollShadow, tableStickyClass, tableStickyKeys, tableStickyOffsets, tableStickyRootClasses, tableStickyStyle,
59
+ tableStickyWidths, tableStickyWidthsEqual, type TablePinnedColumns, type TableStickyKeys, type TableStickySide,
60
+ } from '@poadio/ui-core';
53
61
  import { checkboxNode } from './checkbox.js';
54
62
  import { h, type Child } from './dom.js';
55
63
  import { PoadElement } from './element.js';
@@ -92,7 +100,17 @@ export interface PoadTableColumn extends TableColumnDef {
92
100
  readonly headerCell?: (column: PoadTableColumn) => string | Node;
93
101
  /** Rendu du filtre de la colonne (sinon `renderFilter`, puis le champ selon le type) ; `filter(valeur, mode)` pose le filtre. */
94
102
  readonly filterCell?: (ctx: PoadTableFilterContext) => string | Node | null | undefined;
103
+ /** Colonne figée à gauche ou à droite pendant le défilement horizontal. */
104
+ readonly sticky?: TableStickySide | null;
105
+ /** Priorité en mode `responsive="priority"` : 5 masquée en premier, 1 (ou absente) jamais. */
106
+ readonly priority?: number | null;
95
107
  }
108
+ /** Contexte de `renderExpansion` : la ligne, sa place, les colonnes masquées par priorité. */
109
+ export interface PoadTableExpansionContext { readonly row: Row; readonly rowIndex: number; readonly hiddenColumns: readonly PoadTableColumn[] }
110
+ /** Contexte de `renderRowActions` : la ligne, sa place, son nœud (arbre, groupes). */
111
+ export interface PoadTableRowActionsContext { readonly row: Row; readonly rowIndex: number; readonly node: TableNode<Row> | null }
112
+ /** Contexte de `renderCard` : la ligne, sa place, son nœud, si elle est choisie. */
113
+ export interface PoadTableCardContext extends PoadTableRowActionsContext { readonly selected: boolean }
96
114
  export interface PoadTableSortDetail { readonly field: string | null; readonly order: TableSortOrder; readonly multiSortMeta: TableSortMeta[] }
97
115
  export interface PoadTableLazyLoadDetail {
98
116
  readonly first: number; readonly rows: number; readonly sortField: string | null; readonly sortOrder: TableSortOrder; readonly multiSortMeta: TableSortMeta[];
@@ -145,8 +163,10 @@ export class PoadTableElement extends PoadElement {
145
163
  groupBy: 'json', aggregates: 'json', showGrandTotal: 'boolean', grandTotalLabel: 'string', groupSort: 'json', hideGroupedColumns: 'boolean', expandedGroups: 'json',
146
164
  treeField: 'string', parentKey: 'string', treeColumn: 'string', indent: 'string', showTreeLines: 'boolean', expandedNodeKeys: 'json', keepAncestors: 'boolean',
147
165
  selectionPropagation: 'string', lazyChildren: 'boolean',
166
+ rowActionsWidth: 'string', rowActionsAlwaysVisible: 'boolean', stickyFirstColumn: 'boolean', stickyActions: 'boolean', pinnedColumns: 'json',
167
+ responsive: 'string', stackAt: 'number', priorityBreakpoints: 'json', showHiddenInExpansion: 'boolean', filtersLabel: 'string',
148
168
  } as const;
149
- static override functions = ['renderCell', 'renderHeader', 'cellFormatter', 'rowSelectable', 'rowClass', 'renderFilter', 'renderRowCount', 'renderExpansion', 'groupLabel', 'renderGroupHeader', 'renderGroupFooter', 'treeIcon', 'hasChildren', 'loadChildren'] as const;
169
+ static override functions = ['renderCell', 'renderHeader', 'cellFormatter', 'rowSelectable', 'rowClass', 'renderFilter', 'renderRowCount', 'renderExpansion', 'groupLabel', 'renderGroupHeader', 'renderGroupFooter', 'treeIcon', 'hasChildren', 'loadChildren', 'renderRowActions', 'renderCard'] as const;
150
170
  /** Lignes de la table. */
151
171
  declare value?: readonly Row[];
152
172
  /** Les colonnes, en données. */
@@ -277,7 +297,46 @@ export class PoadTableElement extends PoadElement {
277
297
  */
278
298
  declare expandMode?: TableExpandMode;
279
299
  /** Contenu de la ligne de détail d'une ligne dépliée : ({ row, rowIndex }) → texte ou nœud ; sa présence ajoute la colonne du bouton de dépliage. */
280
- declare renderExpansion?: (ctx: { readonly row: Row; readonly rowIndex: number }) => string | Node | null | undefined;
300
+ declare renderExpansion?: (ctx: PoadTableExpansionContext) => string | Node | null | undefined;
301
+ /** Actions d'une ligne (boutons, menu), dans la dernière colonne : ({ row, rowIndex, node }) → texte, nœud ou nœuds ; sa présence ajoute la colonne des actions. Un clic n'y choisit pas la ligne. */
302
+ declare renderRowActions?: (ctx: PoadTableRowActionsContext) => string | Node | readonly Node[] | null | undefined;
303
+ /**
304
+ * Largeur de la colonne des actions (valeur CSS).
305
+ * @default '120px'
306
+ */
307
+ declare rowActionsWidth?: string;
308
+ /** Actions toujours visibles ; sinon au survol, au focus dans la ligne et sur la ligne choisie. */
309
+ declare rowActionsAlwaysVisible?: boolean;
310
+ /** Fige la première colonne (et les colonnes de sélection et de détail qui la précèdent). */
311
+ declare stickyFirstColumn?: boolean;
312
+ /**
313
+ * Colonne des actions figée à droite.
314
+ * @default true
315
+ */
316
+ declare stickyActions?: boolean;
317
+ /** Épinglage à l'exécution, prioritaire sur `sticky` des colonnes : `{ [id]: 'left' | 'right' | null }` (`null` : détachée). */
318
+ declare pinnedColumns?: TablePinnedColumns;
319
+ /**
320
+ * Largeur réduite : `scroll` (défilement horizontal), `priority` (colonnes masquées selon leur `priority`) ou `stack` (lignes en cartes).
321
+ * @default 'scroll'
322
+ */
323
+ declare responsive?: TableResponsiveMode;
324
+ /**
325
+ * Largeur du conteneur (px) sous laquelle le mode `stack` passe en cartes.
326
+ * @default 640
327
+ */
328
+ declare stackAt?: number;
329
+ /** Largeurs du conteneur (px) sous lesquelles chaque priorité (2 à 5) est masquée en mode `priority`. */
330
+ declare priorityBreakpoints?: TablePriorityBreakpoints;
331
+ /**
332
+ * Colonnes masquées par priorité : la ligne se déplie sur elles.
333
+ * @default true
334
+ */
335
+ declare showHiddenInExpansion?: boolean;
336
+ /** Contenu d'une carte en mode `stack` : ({ row, rowIndex, node, selected }) → texte ou nœud, à la place des libellés et valeurs. */
337
+ declare renderCard?: (ctx: PoadTableCardContext) => string | Node | null | undefined;
338
+ /** Libellé du bouton « Filtres » de la barre en cartes (défaut : message du catalogue). */
339
+ declare filtersLabel?: string;
281
340
  /** Rendu du pied des comptes : (comptes) → texte ou nœud. */
282
341
  declare renderRowCount?: (counts: { readonly total: number; readonly filtered: number; readonly selected: number }) => string | Node;
283
342
 
@@ -461,6 +520,39 @@ export class PoadTableElement extends PoadElement {
461
520
  const s = tableSortState(metas);
462
521
  return { first, rows, sortField: s.field, sortOrder: s.order, multiSortMeta: s.multiSortMeta, filters: this.filters ?? {}, globalFilter: this.globalFilter ?? '' };
463
522
  }
523
+ // colonnes figées : largeurs mesurées après chaque rendu et au redimensionnement, ombres au défilement
524
+ private stickyKeys: TableStickyKeys = { left: [], right: [] };
525
+ private stickyWidths: Record<string, number> = {};
526
+ private shadow = { scrolledX: false, scrolledXEnd: true };
527
+ private resize: ResizeObserver | null = null;
528
+ private resized: HTMLElement | null = null;
529
+ /** Largeur du conteneur `.dt` (adaptation), `null` tant qu'elle est inconnue. */
530
+ private width: number | null = null;
531
+ private filtersOpen = false;
532
+ /** Mesure les en-têtes figés et le défilement ; redessine si quelque chose change. */
533
+ private measureSticky(): void {
534
+ const el = this.querySelector<HTMLElement>(':scope > .poad-table > .dt > .dt-scroll'); if (!el) return;
535
+ // le conteneur `.dt` est observé (l'hôte, en ligne, ne signale pas ses changements de taille) : sa largeur règle
536
+ // l'adaptation, et son redimensionnement mesure les colonnes figées
537
+ const dt = el.parentElement!;
538
+ if (dt !== this.resized) {
539
+ if (this.width == null) { const w = dt.getBoundingClientRect().width || null; if (w != null) { this.width = w; queueMicrotask(() => this.update()); } }
540
+ if (typeof ResizeObserver === 'function') {
541
+ this.resize ??= new ResizeObserver((entries) => {
542
+ const w = entries[0]?.contentRect.width;
543
+ if (w != null && w !== this.width) { this.width = w; this.update(); } else this.measureSticky();
544
+ });
545
+ if (this.resized) this.resize.unobserve(this.resized);
546
+ this.resize.observe(dt); this.resized = dt;
547
+ }
548
+ }
549
+ const k = this.stickyKeys;
550
+ const next = tableHasSticky(k) ? tableStickyWidths(k, [...el.querySelectorAll<HTMLElement>('thead > tr:first-child > th[data-sk]')].map((th) => [th.dataset['sk']!, th.getBoundingClientRect().width] as const)) : {};
551
+ const sh = tableScrollShadow(el);
552
+ const changed = !tableStickyWidthsEqual(this.stickyWidths, next) || sh.scrolledX !== this.shadow.scrolledX || sh.scrolledXEnd !== this.shadow.scrolledXEnd;
553
+ this.stickyWidths = next; this.shadow = sh;
554
+ if (changed) this.update();
555
+ }
464
556
  private tbody(): HTMLElement | null {
465
557
  return this.querySelector<HTMLElement>(':scope > .poad-table > .dt > .dt-scroll > table > tbody');
466
558
  }
@@ -470,11 +562,14 @@ export class PoadTableElement extends PoadElement {
470
562
  this.timers.forEach(clearTimeout);
471
563
  this.timers.clear();
472
564
  this.filterRowState?.dispose();
565
+ this.resize?.disconnect();
566
+ this.resize = null; this.resized = null;
473
567
  }
474
568
 
475
569
  protected override updated(): void {
476
570
  this.filterRowState?.sync();
477
571
  tableWatchers.get(this)?.forEach((fn) => fn());
572
+ this.measureSticky();
478
573
  if (!this.loadedOnce) {
479
574
  this.loadedOnce = true;
480
575
  if (this.lazy && this.lazyLoadOnInit !== false) this.emit('lazyload', this.lazyDetail(this.first ?? 0, this.rows ?? 25, this.metas));
@@ -508,7 +603,13 @@ export class PoadTableElement extends PoadElement {
508
603
  first: this.paginator && !this.lazy ? first : 0, rows: this.paginator && !this.lazy ? rows : 0,
509
604
  }) : null;
510
605
  const page = shown ? shown.filter((n) => n.kind === 'row').map((n) => n.row) : this.paginator && !this.lazy ? tablePageRows(sorted, first, rows) : sorted;
511
- const columns = tableGroupVisibleColumns(allColumns.filter((c) => !c.hidden), tableGroupFields(this.groupBy as TableGroupBy<unknown> | null), this.hideGroupedColumns ?? true);
606
+ const responsive = this.responsive ?? 'scroll';
607
+ const hiddenPriorities = tableHiddenPriorities({ mode: responsive, width: this.width, breakpoints: this.priorityBreakpoints });
608
+ const stacked = tableStacked({ mode: responsive, width: this.width, stackAt: this.stackAt ?? TABLE_STACK_AT });
609
+ const tools = slotted(this.content, 'toolbar');
610
+ // colonnes : masquées, regroupées (cachées), puis masquées par priorité (elles passent dans le détail)
611
+ const { visible: columns, hidden: hiddenColumns } = tablePriorityColumns(
612
+ tableGroupVisibleColumns(allColumns.filter((c) => !c.hidden), tableGroupFields(this.groupBy as TableGroupBy<unknown> | null), this.hideGroupedColumns ?? true), hiddenPriorities);
512
613
  const keyOf = this.keyOf;
513
614
  const selected = tableSelectionArray<Row>(this.selection as Row | Row[] | null);
514
615
  const selectedKeys = tableSelectionKeys<Row>(this.selection as Row | Row[] | null, keyOf);
@@ -685,14 +786,24 @@ export class PoadTableElement extends PoadElement {
685
786
  const ta = tableRootProps({ mode, hierarchical: !!grouped, busy: this.loading, rowCount: total, headerRows });
686
787
  const counts = tableCounts({ total: this.lazy ? total : value.length, filtered: total, selected: selCount });
687
788
  // ---- ligne de détail ----
688
- const hasExp = tableHasExpandColumn({ hasTemplate: !!this.renderExpansion, rowExpandable: this.rowExpandable });
789
+ const hasExp = tableHasExpandColumn({ hasTemplate: !!this.renderExpansion || tableHiddenInExpansion({ showHiddenInExpansion: this.showHiddenInExpansion, hiddenCount: hiddenColumns.length }), rowExpandable: this.rowExpandable });
689
790
  const expandedSet = tableExpandedSet(this.expandedRowKeys);
690
791
  const toggleExpand = (row: Row, i: number) => {
691
792
  const r = tableExpandToggle(this.expandedRowKeys, keyOf(row), this.expandMode ?? 'multiple');
692
793
  this.expandedRowKeys = r.next;
693
794
  this.emit(r.expanded ? 'rowexpand' : 'rowcollapse', { row, index: i } satisfies PoadTableRowDetail);
694
795
  };
695
- const colspan = tableColspan({ columns: columns.length, selection: hasSel, extra: hasExp ? 1 : 0 });
796
+ // ---- actions de ligne ----
797
+ const hasActs = tableHasActionsColumn({ hasTemplate: !!this.renderRowActions });
798
+ const colspan = tableColspan({ columns: columns.length, selection: hasSel, extra: (hasExp ? 1 : 0) + (hasActs ? 1 : 0) });
799
+ // ---- colonnes figées (calcul du socle) ----
800
+ const stickyKeys = this.stickyKeys = tableStickyKeys({
801
+ columns: columns.map((c) => ({ id: tableColumnId(c), sticky: c.sticky })), pinned: this.pinnedColumns, stickyFirstColumn: this.stickyFirstColumn, selection: hasSel,
802
+ expand: hasExp, actions: hasActs, stickyActions: this.stickyActions, responsive, stacked,
803
+ });
804
+ const offsets = tableStickyOffsets(stickyKeys, this.stickyWidths);
805
+ /** Classe et décalage d'une cellule (`key` : `sel`, `exp`, `acts` ou l'id d'une colonne). */
806
+ const stk = (key: string, base = '') => ({ class: [base, tableStickyClass(stickyKeys, key)].filter(Boolean).join(' ') || undefined, style: tableStickyStyle(offsets, key) ?? undefined });
696
807
  const check = (id: string, checked: boolean, label: string, onToggle: () => void, indeterminate?: boolean) =>
697
808
  checkboxNode(registry, { id: `${this.uid}-${id}`, checked, indeterminate, ariaLabel: label, onToggle });
698
809
  // ---- groupes ----
@@ -706,9 +817,10 @@ export class PoadTableElement extends PoadElement {
706
817
  const grand = !!grouped && tableShowsGrandTotal({ showGrandTotal: this.showGrandTotal, aggregates: this.aggregates, hierarchical: true });
707
818
  /** Cellules d'agrégats (pied de groupe, total général) : libellé dans la première colonne sans agrégat. */
708
819
  const aggregateCells = (values: Record<string, unknown>, label: Child): Child[] => [
709
- hasSel && h('td', { class: 'col-sel' }),
710
- hasExp && h('td', { class: 'col-exp' }),
711
- columns.map((c, ci) => h('td', { class: tableTdClasses(c), 'data-l': c.header }, tableHasAggregate(c.field, this.aggregates) ? format(values[c.field!], c, undefined) : ci === 0 ? label : null)),
820
+ hasSel && h('td', stk('sel', 'col-sel')),
821
+ hasExp && h('td', stk('exp', 'col-exp')),
822
+ columns.map((c, ci) => h('td', { ...stk(tableColumnId(c), tableTdClasses(c)), 'data-l': c.header }, tableHasAggregate(c.field, this.aggregates) ? format(values[c.field!], c, undefined) : ci === 0 ? label : null)),
823
+ hasActs && h('td', stk('acts', 'col-acts')),
712
824
  ];
713
825
  const groupRow = (n: TableNode<Row>, gi: number): Child => {
714
826
  const gp = tableGroupHeaderProps(n);
@@ -732,7 +844,14 @@ export class PoadTableElement extends PoadElement {
732
844
  const idx = sortMode === 'multiple' ? tableSortIndex(metas, field) : 0;
733
845
  const hp = tableHeaderCellProps({ ariaSort: tableAriaSort(metas, field, !!c.sortable) });
734
846
  const custom = c.headerCell?.(c) ?? this.renderHeader?.(c);
735
- return h('th', { scope: hp.scope, class: tableThClasses(c, order !== 0), 'aria-sort': hp['aria-sort'], style: c.width ? { width: c.width } : undefined }, custom != null ? custom : c.sortable
847
+ // classes : alignement, colonne figée, puis les autres (ordre d'ui-angular)
848
+ const id = tableColumnId(c);
849
+ const [al, ...others] = tableThClasses(c, order !== 0).split(' ');
850
+ const sticky = tableStickyStyle(offsets, id);
851
+ return h('th', {
852
+ scope: hp.scope, class: [al, tableStickyClass(stickyKeys, id), ...others].filter(Boolean).join(' '), 'aria-sort': hp['aria-sort'], 'data-sk': id,
853
+ style: c.width || sticky ? { width: c.width, ...sticky } : undefined,
854
+ }, custom != null ? custom : c.sortable
736
855
  ? h('button', { type: 'button', class: 'hd', 'aria-label': t('table.sortBy', { column: c.header ?? '' }), onclick: (e: MouseEvent) => sortBy(c, e) }, [
737
856
  h('span', { class: 'hd-txt' }, c.header ?? ''),
738
857
  icon(registry, tableSortIcon(order), { size: 12 }),
@@ -753,23 +872,26 @@ export class PoadTableElement extends PoadElement {
753
872
  ic && h('span', { class: 'ic' }, icon(registry, ic, { size: 14 })),
754
873
  ]);
755
874
  };
756
- const cell = (row: Row, i: number, c: PoadTableColumn, ci: number, node: TableNode<Row> | null) => {
875
+ /** Contenu d'une cellule : rendu de la colonne, `renderCell`, sinon le texte mis en forme de la valeur. */
876
+ const content = (row: Row, i: number, c: PoadTableColumn, node: TableNode<Row> | null): Child => {
757
877
  const v = c.field ? tableResolve(row, c.field) : undefined;
758
878
  const ctx: PoadTableCellContext = { row, value: v, rowIndex: i, column: c, node };
759
879
  const custom = c.cell?.(ctx) ?? this.renderCell?.(ctx);
880
+ return custom != null ? custom : h('span', { class: 'cell-txt' }, format(v, c, row));
881
+ };
882
+ const cell = (row: Row, i: number, c: PoadTableColumn, ci: number, node: TableNode<Row> | null) => {
760
883
  const tree = !!node && ci === treeCol;
761
- return h('td', { class: tableTdClasses(c) + (tree ? ' dt-tree-cell' : '') + (ci === 0 ? ' dt-first' : ''), 'data-l': c.header }, [
762
- tree
763
- ? h('span', { class: 'dt-tree-wrap' }, [treeToggle(node), custom != null ? custom : h('span', { class: 'cell-txt' }, format(v, c, row))])
764
- : custom != null ? custom : h('span', { class: 'cell-txt' }, format(v, c, row)),
884
+ return h('td', { ...stk(tableColumnId(c), tableTdClasses(c) + (tree ? ' dt-tree-cell' : '') + (ci === 0 ? ' dt-first' : '')), 'data-l': c.header }, [
885
+ tree ? h('span', { class: 'dt-tree-wrap' }, [treeToggle(node), content(row, i, c, node)]) : content(row, i, c, node),
765
886
  ]);
766
887
  };
767
888
  const bodyRows = (): Child => {
768
889
  if (body === 'skeleton') {
769
890
  return Array.from({ length: this.loadingRows ?? 5 }, (_, r) => h('tr', { class: 'dt-row is-skeleton', 'aria-hidden': 'true' }, [
770
- hasSel && h('td', { class: 'col-sel' }),
771
- hasExp && h('td', { class: 'col-exp' }),
772
- columns.map((c, ci) => h('td', { class: tableTdClasses(c) }, h('div', { class: 'skel', style: { width: tableSkeletonWidth(r, ci) + '%', marginLeft: tableColumnAlign(c) === 'right' ? 'auto' : undefined } }))),
891
+ hasSel && h('td', stk('sel', 'col-sel')),
892
+ hasExp && h('td', stk('exp', 'col-exp')),
893
+ columns.map((c, ci) => h('td', stk(tableColumnId(c), tableTdClasses(c)), h('div', { class: 'skel', style: { width: tableSkeletonWidth(r, ci) + '%', marginLeft: tableColumnAlign(c) === 'right' ? 'auto' : undefined } }))),
894
+ hasActs && h('td', stk('acts', 'col-acts')),
773
895
  ]));
774
896
  }
775
897
  if (body === 'empty') {
@@ -793,8 +915,8 @@ export class PoadTableElement extends PoadElement {
793
915
  const eb = tableExpandButtonProps(open);
794
916
  const np = node ? tableNodeRowProps(node) : null;
795
917
  const st = node && grouped && mode === 'multiple' ? tableTreeNodeState(node, grouped, { isSelected: isSel, canSelect, propagation: isTree ? propagation : 'none' }) : sel ? 'on' : 'off';
796
- const tr = h('tr', {
797
- class: tableRowClasses({ selectable: hasSel && canSelect(row), hasSelectionColumn: hasSel, selected: sel, extra: [open ? 'is-expanded' : '', node ? tableTreeRowClasses(node) : '', this.rowClass?.(row, i) ?? ''].filter(Boolean).join(' ') || null }),
918
+ const rowClass = tableRowClasses({ selectable: hasSel && canSelect(row), hasSelectionColumn: hasSel, selected: sel, extra: [open ? 'is-expanded' : '', node ? tableTreeRowClasses(node) : '', this.rowClass?.(row, i) ?? ''].filter(Boolean).join(' ') || null });
919
+ const trProps = {
798
920
  'data-key': this.dataKey ? String(track) : undefined, tabindex: node ? (i === activeAt ? 0 : -1) : rp.tabindex, 'aria-selected': rp['aria-selected'], 'aria-rowindex': node ? undefined : rp['aria-rowindex'],
799
921
  style: node ? { '--_lvl': String(node.level) } : undefined, role: np ? 'row' : undefined, 'aria-level': np?.['aria-level'], 'aria-expanded': np?.['aria-expanded'] ?? undefined, 'aria-posinset': np?.['aria-posinset'], 'aria-setsize': np?.['aria-setsize'],
800
922
  onclick: (e: MouseEvent) => onRowClick(row, i, e), ondblclick: () => this.emit('rowdblclick', { row, index: i } satisfies PoadTableRowDetail),
@@ -806,20 +928,27 @@ export class PoadTableElement extends PoadElement {
806
928
  this.activeKey = track;
807
929
  this.tbody()?.querySelectorAll(':scope > tr.dt-row').forEach((tr) => { if (tr.hasAttribute('tabindex')) tr.setAttribute('tabindex', tr === e.currentTarget ? '0' : '-1'); });
808
930
  },
809
- }, [
810
- hasSel && h('td', { class: 'col-sel' }, canSelect(row) && check(`r${i}`, st === 'on', t('table.selectRow', { index: i + 1 }), () => (mode === 'multiple' ? toggleRow(row, i) : selectSingle(row, i)), st === 'some')),
811
- hasExp && h('td', { class: 'col-exp' }, tableCanExpand(row, this.rowExpandable) && h('button', {
931
+ };
932
+ // carte de l'application (mode `stack`) : toute la ligne
933
+ if (stacked && this.renderCard) return h('tr', { class: rowClass + ' dt-card', ...trProps }, h('td', { colspan }, this.renderCard({ row, rowIndex: i, node, selected: sel }) ?? null));
934
+ const tr = h('tr', { class: rowClass, ...trProps }, [
935
+ hasSel && h('td', stk('sel', 'col-sel'), canSelect(row) && check(`r${i}`, st === 'on', t('table.selectRow', { index: i + 1 }), () => (mode === 'multiple' ? toggleRow(row, i) : selectSingle(row, i)), st === 'some')),
936
+ hasExp && h('td', stk('exp', 'col-exp'), tableCanExpand(row, this.rowExpandable) && h('button', {
812
937
  type: 'button', class: 'exp', 'aria-expanded': eb['aria-expanded'], 'aria-label': t(eb.labelKey), onclick: () => toggleExpand(row, i),
813
938
  }, icon(registry, 'chevron-right', { size: 13 }))),
814
939
  columns.map((c, ci) => cell(row, i, c, ci, node)),
940
+ hasActs && h('td', stk('acts', 'col-acts'), h('span', { class: 'acts', onclick: (e: MouseEvent) => e.stopPropagation() }, (this.renderRowActions!({ row, rowIndex: i, node }) ?? null) as Child)),
815
941
  ]);
816
- return open ? [tr, h('tr', { class: 'dt-detail' }, h('td', { colspan }, this.renderExpansion?.({ row, rowIndex: i }) ?? null))] : tr;
942
+ if (!open) return tr;
943
+ const detail = this.renderExpansion ? this.renderExpansion({ row, rowIndex: i, hiddenColumns }) ?? null
944
+ : h('div', { class: 'kv' }, hiddenColumns.map((c) => h('div', {}, [h('b', {}, c.header || c.field), content(row, i, c, node)])));
945
+ return [tr, h('tr', { class: 'dt-detail', style: node ? { '--_lvl': String(node.level) } : undefined }, h('td', { colspan }, detail))];
817
946
  });
818
947
  };
819
948
 
820
949
  const caption = slotted(this.content, 'caption');
821
950
  return h('div', {
822
- class: ['poad-table', tableRootClasses({ dense: this.dense, striped: this.striped, hoverable: this.hoverable, bordered: this.bordered, borderless: this.borderless, stickyHeader: this.stickyHeader, scrollHeight: this.bodyMaxHeight, loading: this.loading }), { 'is-grouped': !!this.groupBy && !(Array.isArray(this.groupBy) && !this.groupBy.length), 'is-tree': isTree, 'has-tree-lines': !!this.showTreeLines }],
951
+ class: ['poad-table', tableRootClasses({ dense: this.dense, striped: this.striped, hoverable: this.hoverable, bordered: this.bordered, borderless: this.borderless, stickyHeader: this.stickyHeader, scrollHeight: this.bodyMaxHeight, loading: this.loading }), { 'is-grouped': !!this.groupBy && !(Array.isArray(this.groupBy) && !this.groupBy.length), 'is-tree': isTree, 'has-tree-lines': !!this.showTreeLines, ...tableStickyRootClasses({ ...this.shadow, sticky: tableHasSticky(stickyKeys), actionsAlwaysVisible: this.rowActionsAlwaysVisible }), ...tableResponsiveClasses({ stacked, hidden: hiddenPriorities }) }],
823
952
  style: this.bodyMaxHeight || hasExp || (isTree && this.indent) ? {
824
953
  '--_scroll-h': this.bodyMaxHeight, '--_detail-pl': hasExp ? tableDetailPaddingLeft({ selection: hasSel, expand: true }) : undefined, ...(isTree ? tableTreeRootVars(this.indent) : {}),
825
954
  } : undefined,
@@ -833,12 +962,18 @@ export class PoadTableElement extends PoadElement {
833
962
  ]) : (this.showToolbar ?? true) && h('div', { class: 'dt-bar' }, [
834
963
  this.heading && h('span', { class: 'dt-bar__title' }, this.heading),
835
964
  (this.showCount ?? true) && h('span', { class: 'dt-bar__count' }, String(this.count ?? total)),
836
- h('span', { class: 'dt-bar__tools' }, slotted(this.content, 'toolbar')),
965
+ tableFiltersToggleShown({ stacked, hasTools: tools.length > 0 }) && (() => {
966
+ const ft = tableFiltersToggleProps(this.filtersOpen); const active = tableFilterActiveCount(filters);
967
+ return h('button', { type: 'button', class: ft.className, 'aria-expanded': ft['aria-expanded'], onclick: () => { this.filtersOpen = !this.filtersOpen; this.update(); } }, [
968
+ icon(registry, 'filter', { size: 13 }), text(this.filtersLabel, ft.labelKey), active > 0 && h('span', { class: 'dt-bar__count' }, String(active)),
969
+ ]);
970
+ })(),
971
+ h('span', { class: ['dt-bar__tools', { 'is-open': this.filtersOpen }] }, tools),
837
972
  h('span', { class: 'dt-bar__grow' }),
838
973
  this.showSearch && tableSearch(i18n, registry, { text: this.searchText ?? this.globalFilter ?? '', placeholder: this.searchPlaceholder, onSearch }),
839
974
  h('span', { class: 'dt-bar__tools-end' }, slotted(this.content, 'toolbar-end')),
840
975
  ]),
841
- h('div', { class: 'dt-scroll' }, [
976
+ h('div', { class: 'dt-scroll', onscroll: () => this.measureSticky() }, [
842
977
  tableShowsOverlay({ loading: this.loading, hasData: value.length > 0 }) && h('div', { class: 'dt-loading' }, icon(registry, 'loader', { size: 22, spin: true })),
843
978
  h('table', {
844
979
  class: this.tableClass ? 'tbl ' + this.tableClass : 'tbl', role: ta.role, 'aria-rowcount': ta['aria-rowcount'], 'aria-busy': ta['aria-busy'],
@@ -849,17 +984,20 @@ export class PoadTableElement extends PoadElement {
849
984
  hasSel && h('col', { style: { width: '36px' } }),
850
985
  hasExp && h('col', { style: { width: '30px' } }),
851
986
  columns.map((c) => h('col', { style: { width: c.width, minWidth: c.minWidth, maxWidth: c.maxWidth } })),
987
+ hasActs && h('col', { style: { width: this.rowActionsWidth ?? TABLE_ACTIONS_WIDTH } }),
852
988
  ]),
853
989
  h('thead', {}, [
854
990
  h('tr', { 'aria-rowindex': tableHeaderRowProps(0)['aria-rowindex'] }, [
855
- hasSel && h('th', { class: 'col-sel', scope: 'col' }, mode === 'multiple' && (this.selectAll ?? true) && check('all', allState === 'all', t('table.selectAll'), toggleAll, allState === 'some')),
856
- hasExp && h('th', { class: 'col-exp', scope: 'col' }, h('span', { hidden: true }, t('table.detail'))),
991
+ hasSel && h('th', { ...stk('sel', 'col-sel'), scope: 'col', 'data-sk': 'sel' }, mode === 'multiple' && (this.selectAll ?? true) && check('all', allState === 'all', t('table.selectAll'), toggleAll, allState === 'some')),
992
+ hasExp && h('th', { ...stk('exp', 'col-exp'), scope: 'col', 'data-sk': 'exp' }, h('span', { hidden: true }, t('table.detail'))),
857
993
  columns.map(header),
994
+ hasActs && h('th', { ...stk('acts', 'col-acts'), scope: 'col', 'data-sk': 'acts' }, h('span', { hidden: true }, t('table.actions'))),
858
995
  ]),
859
996
  hasFilterRow && h('tr', { class: 'flt', 'aria-rowindex': tableHeaderRowProps(1)['aria-rowindex'] }, [
860
- hasSel && h('th', {}),
861
- hasExp && h('th', {}),
862
- columns.map((c) => h('th', {}, this.filterRow.cell(i18n, registry, filters, c, actions, c.filterCell ?? this.renderFilter))),
997
+ hasSel && h('th', stk('sel')),
998
+ hasExp && h('th', stk('exp')),
999
+ columns.map((c) => h('th', stk(tableColumnId(c)), this.filterRow.cell(i18n, registry, filters, c, actions, c.filterCell ?? this.renderFilter))),
1000
+ hasActs && h('th', stk('acts')),
863
1001
  ]),
864
1002
  ]),
865
1003
  h('tbody', {}, bodyRows()),
@@ -869,7 +1007,7 @@ export class PoadTableElement extends PoadElement {
869
1007
  ((this.paginator && (total > 0 || this.lazy)) || this.showRowCount) && h('div', { class: ['dt-foot', { 'has-count': !!this.showRowCount }] }, [
870
1008
  this.showRowCount && h('span', { class: 'dt-foot__count' }, this.renderRowCount ? this.renderRowCount(counts) : tableRowCountParts(counts, (k, p) => t(k, p), this.rowCountLabel).join(' · ')),
871
1009
  this.paginator && (total > 0 || this.lazy) && paginatorView(i18n, registry, {
872
- first, rows, totalRecords: pageTotal, rowsPerPageOptions: this.rowsPerPageOptions, pageLinks: this.pageLinks, showCurrentPageReport: this.showCurrentPageReport,
1010
+ first, rows, totalRecords: pageTotal, rowsPerPageOptions: this.rowsPerPageOptions, pageLinks: tableResponsivePageLinks(stacked, this.pageLinks ?? 5), showCurrentPageReport: this.showCurrentPageReport,
873
1011
  currentPageReportTemplate: this.currentPageReportTemplate, showFirstLastIcon: this.showFirstLastIcon, alwaysShow: this.alwaysShowPaginator, onPage: changePage,
874
1012
  owner: this, selectTag: this.tag('select'),
875
1013
  }),