@mintplayer/ng-bootstrap 22.19.0 → 22.21.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/_bootstrap.scss +10 -0
- package/fesm2022/mintplayer-ng-bootstrap-accordion.mjs +3 -0
- package/fesm2022/mintplayer-ng-bootstrap-accordion.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-alert.mjs +6 -3
- package/fesm2022/mintplayer-ng-bootstrap-alert.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-button-type.mjs +9 -11
- package/fesm2022/mintplayer-ng-bootstrap-button-type.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-calendar.mjs +2 -4
- package/fesm2022/mintplayer-ng-bootstrap-calendar.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-carousel.mjs +3 -1
- package/fesm2022/mintplayer-ng-bootstrap-carousel.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-charts-hierarchy.mjs +36 -56
- package/fesm2022/mintplayer-ng-bootstrap-charts-hierarchy.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-charts-sparkline.mjs +10 -18
- package/fesm2022/mintplayer-ng-bootstrap-charts-sparkline.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-charts-trend.mjs +13 -24
- package/fesm2022/mintplayer-ng-bootstrap-charts-trend.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-checkbox.mjs +6 -15
- package/fesm2022/mintplayer-ng-bootstrap-checkbox.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-code-snippet.mjs +5 -7
- package/fesm2022/mintplayer-ng-bootstrap-code-snippet.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-color-picker.mjs +17 -6
- package/fesm2022/mintplayer-ng-bootstrap-color-picker.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-context-menu.mjs +47 -50
- package/fesm2022/mintplayer-ng-bootstrap-context-menu.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-copy.mjs +8 -5
- package/fesm2022/mintplayer-ng-bootstrap-copy.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-datatable.mjs +160 -83
- package/fesm2022/mintplayer-ng-bootstrap-datatable.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-datepicker.mjs +2 -4
- package/fesm2022/mintplayer-ng-bootstrap-datepicker.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-datetime-picker.mjs +2 -4
- package/fesm2022/mintplayer-ng-bootstrap-datetime-picker.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-dropdown-menu.mjs +4 -2
- package/fesm2022/mintplayer-ng-bootstrap-dropdown-menu.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-dropdown.mjs +21 -7
- package/fesm2022/mintplayer-ng-bootstrap-dropdown.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-enhanced-paste.mjs +19 -14
- package/fesm2022/mintplayer-ng-bootstrap-enhanced-paste.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-enum.mjs +15 -12
- package/fesm2022/mintplayer-ng-bootstrap-enum.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-file-manager.mjs +3 -3
- package/fesm2022/mintplayer-ng-bootstrap-file-manager.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-file-upload.mjs +16 -6
- package/fesm2022/mintplayer-ng-bootstrap-file-upload.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-modal.mjs +21 -4
- package/fesm2022/mintplayer-ng-bootstrap-modal.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-offcanvas.mjs +26 -10
- package/fesm2022/mintplayer-ng-bootstrap-offcanvas.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-otp-input.mjs +4 -1
- package/fesm2022/mintplayer-ng-bootstrap-otp-input.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-pagination.mjs +2 -4
- package/fesm2022/mintplayer-ng-bootstrap-pagination.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-phone-input.mjs +8 -11
- package/fesm2022/mintplayer-ng-bootstrap-phone-input.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-priority-nav.mjs +73 -67
- package/fesm2022/mintplayer-ng-bootstrap-priority-nav.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-query-builder.mjs +4 -16
- package/fesm2022/mintplayer-ng-bootstrap-query-builder.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-radio.mjs +11 -22
- package/fesm2022/mintplayer-ng-bootstrap-radio.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-range.mjs +2 -4
- package/fesm2022/mintplayer-ng-bootstrap-range.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-resizable.mjs +188 -249
- package/fesm2022/mintplayer-ng-bootstrap-resizable.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-scheduler.mjs +64 -146
- package/fesm2022/mintplayer-ng-bootstrap-scheduler.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-scrollspy.mjs +37 -30
- package/fesm2022/mintplayer-ng-bootstrap-scrollspy.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-select.mjs +9 -25
- package/fesm2022/mintplayer-ng-bootstrap-select.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-signature-pad.mjs +2 -4
- package/fesm2022/mintplayer-ng-bootstrap-signature-pad.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-splitter.mjs +3 -0
- package/fesm2022/mintplayer-ng-bootstrap-splitter.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-tab-control.mjs +6 -6
- package/fesm2022/mintplayer-ng-bootstrap-tab-control.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-theming.mjs +150 -83
- package/fesm2022/mintplayer-ng-bootstrap-theming.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-tile-manager.mjs +3 -0
- package/fesm2022/mintplayer-ng-bootstrap-tile-manager.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-timeline.mjs +46 -44
- package/fesm2022/mintplayer-ng-bootstrap-timeline.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-timepicker.mjs +2 -4
- package/fesm2022/mintplayer-ng-bootstrap-timepicker.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-tooltip.mjs +63 -89
- package/fesm2022/mintplayer-ng-bootstrap-tooltip.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-tree-select.mjs +6 -14
- package/fesm2022/mintplayer-ng-bootstrap-tree-select.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-treeview.mjs +25 -56
- package/fesm2022/mintplayer-ng-bootstrap-treeview.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-typeahead.mjs +1 -0
- package/fesm2022/mintplayer-ng-bootstrap-typeahead.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-user-agent.mjs +47 -58
- package/fesm2022/mintplayer-ng-bootstrap-user-agent.mjs.map +1 -1
- package/package.json +2 -2
- package/types/mintplayer-ng-bootstrap-alert.d.ts +3 -1
- package/types/mintplayer-ng-bootstrap-button-type.d.ts +6 -6
- package/types/mintplayer-ng-bootstrap-calendar.d.ts +1 -1
- package/types/mintplayer-ng-bootstrap-carousel.d.ts +0 -1
- package/types/mintplayer-ng-bootstrap-charts-hierarchy.d.ts +1 -1
- package/types/mintplayer-ng-bootstrap-charts-sparkline.d.ts +1 -1
- package/types/mintplayer-ng-bootstrap-charts-trend.d.ts +1 -1
- package/types/mintplayer-ng-bootstrap-color-picker.d.ts +9 -3
- package/types/mintplayer-ng-bootstrap-context-menu.d.ts +8 -10
- package/types/mintplayer-ng-bootstrap-copy.d.ts +3 -1
- package/types/mintplayer-ng-bootstrap-datatable.d.ts +56 -11
- package/types/mintplayer-ng-bootstrap-datepicker.d.ts +1 -1
- package/types/mintplayer-ng-bootstrap-datetime-picker.d.ts +1 -1
- package/types/mintplayer-ng-bootstrap-dropdown-menu.d.ts +3 -1
- package/types/mintplayer-ng-bootstrap-dropdown.d.ts +3 -0
- package/types/mintplayer-ng-bootstrap-enhanced-paste.d.ts +6 -1
- package/types/mintplayer-ng-bootstrap-enum.d.ts +17 -4
- package/types/mintplayer-ng-bootstrap-file-manager.d.ts +2 -3
- package/types/mintplayer-ng-bootstrap-file-upload.d.ts +7 -1
- package/types/mintplayer-ng-bootstrap-modal.d.ts +9 -1
- package/types/mintplayer-ng-bootstrap-offcanvas.d.ts +10 -1
- package/types/mintplayer-ng-bootstrap-otp-input.d.ts +1 -1
- package/types/mintplayer-ng-bootstrap-pagination.d.ts +1 -1
- package/types/mintplayer-ng-bootstrap-priority-nav.d.ts +1 -1
- package/types/mintplayer-ng-bootstrap-query-builder.d.ts +2 -3
- package/types/mintplayer-ng-bootstrap-resizable.d.ts +65 -31
- package/types/mintplayer-ng-bootstrap-scheduler.d.ts +27 -21
- package/types/mintplayer-ng-bootstrap-scrollspy.d.ts +18 -2
- package/types/mintplayer-ng-bootstrap-select.d.ts +1 -1
- package/types/mintplayer-ng-bootstrap-tab-control.d.ts +2 -2
- package/types/mintplayer-ng-bootstrap-theming.d.ts +86 -54
- package/types/mintplayer-ng-bootstrap-timeline.d.ts +27 -5
- package/types/mintplayer-ng-bootstrap-timepicker.d.ts +1 -1
- package/types/mintplayer-ng-bootstrap-tooltip.d.ts +18 -17
- package/types/mintplayer-ng-bootstrap-tree-select.d.ts +3 -4
- package/types/mintplayer-ng-bootstrap-treeview.d.ts +4 -4
- package/types/mintplayer-ng-bootstrap-user-agent.d.ts +13 -4
|
@@ -219,21 +219,55 @@ class BsDatatableComponent {
|
|
|
219
219
|
/** Two-way bound pagination / sort settings. */
|
|
220
220
|
this.settings = model(new DatatableSettings(), /* @ts-ignore */
|
|
221
221
|
...(ngDevMode ? [{ debugName: "settings" }] : /* istanbul ignore next */ []));
|
|
222
|
-
/**
|
|
222
|
+
/**
|
|
223
|
+
* - `'none'` (default): no selection, no checkbox column.
|
|
224
|
+
* - `'single'`: a row click selects that one row.
|
|
225
|
+
* - `'multiple'`: a row click selects (Ctrl/Shift extend it), plus a checkbox column.
|
|
226
|
+
* - `'checkbox'`: multi-select through the checkbox column only; a row click
|
|
227
|
+
* just opens the row (`rowClick`), it never changes the selection.
|
|
228
|
+
*/
|
|
223
229
|
this.selectionMode = input('none', /* @ts-ignore */
|
|
224
230
|
...(ngDevMode ? [{ debugName: "selectionMode" }] : /* istanbul ignore next */ []));
|
|
225
231
|
/** @deprecated Use `selectionMode`. Kept for source-level compatibility. */
|
|
226
232
|
this.selectable = input(undefined, /* @ts-ignore */
|
|
227
233
|
...(ngDevMode ? [{ debugName: "selectable" }] : /* istanbul ignore next */ []));
|
|
228
|
-
/**
|
|
234
|
+
/**
|
|
235
|
+
* Two-way bound array of selected rows. Identity is `rowKey`: two row
|
|
236
|
+
* objects with the same key are the same selection entry.
|
|
237
|
+
*
|
|
238
|
+
* The selection survives paging, sorting and re-fetching: a selected row
|
|
239
|
+
* that leaves the loaded data stays in the model (the element remembers it).
|
|
240
|
+
* Rows written here are handed to the element, so a host may select rows
|
|
241
|
+
* that are not loaded at all. After a selection change the model holds the
|
|
242
|
+
* freshest row object the element knows for each key.
|
|
243
|
+
*/
|
|
229
244
|
this.selection = model([], /* @ts-ignore */
|
|
230
245
|
...(ngDevMode ? [{ debugName: "selection" }] : /* istanbul ignore next */ []));
|
|
231
|
-
/**
|
|
246
|
+
/**
|
|
247
|
+
* The row's identity, used for selection and for keeping views across
|
|
248
|
+
* re-renders. Default: `String(row.id)`.
|
|
249
|
+
*
|
|
250
|
+
* **With `[fetch]` (or any selection that must survive paging) the key must
|
|
251
|
+
* be stable** — derived from the row itself, never from its position. The
|
|
252
|
+
* fallback for a row without an `id`, `row-${index}`, is positional and
|
|
253
|
+
* therefore unstable: the same row gets another key on another page or sort.
|
|
254
|
+
* Worse, a selected row that is not loaded has no index and is keyed
|
|
255
|
+
* `rowKey(row, -1)`, so every id-less off-page row collapses onto the one
|
|
256
|
+
* key `row--1` — in this wrapper's model and in the element alike — and the
|
|
257
|
+
* selection can no longer tell them apart. Supply a stable `rowKey`.
|
|
258
|
+
*/
|
|
232
259
|
this.rowKey = input((row, index) => {
|
|
233
260
|
const r = row;
|
|
234
261
|
return r && r.id != null ? String(r.id) : `row-${index}`;
|
|
235
262
|
}, /* @ts-ignore */
|
|
236
263
|
...(ngDevMode ? [{ debugName: "rowKey" }] : /* istanbul ignore next */ []));
|
|
264
|
+
/**
|
|
265
|
+
* Names a row for its selection checkbox ("Select {label}"). When unset, or
|
|
266
|
+
* when it returns an empty string, the trimmed text of the row's first cell
|
|
267
|
+
* is used, and failing that the row number.
|
|
268
|
+
*/
|
|
269
|
+
this.rowLabel = input(null, /* @ts-ignore */
|
|
270
|
+
...(ngDevMode ? [{ debugName: "rowLabel" }] : /* istanbul ignore next */ []));
|
|
237
271
|
/** Drag-resize column widths. Default `true`. */
|
|
238
272
|
this.resizableColumns = input(true, /* @ts-ignore */
|
|
239
273
|
...(ngDevMode ? [{ debugName: "resizableColumns" }] : /* istanbul ignore next */ []));
|
|
@@ -252,9 +286,6 @@ class BsDatatableComponent {
|
|
|
252
286
|
/** Forwarded to the inner table (legacy responsive flag, currently a CSS hook). */
|
|
253
287
|
this.isResponsive = input(false, /* @ts-ignore */
|
|
254
288
|
...(ngDevMode ? [{ debugName: "isResponsive" }] : /* istanbul ignore next */ []));
|
|
255
|
-
/** Optional row equality predicate (selection identity across re-fetches). */
|
|
256
|
-
this.compareWith = input(undefined, /* @ts-ignore */
|
|
257
|
-
...(ngDevMode ? [{ debugName: "compareWith" }] : /* istanbul ignore next */ []));
|
|
258
289
|
/** Emitted on row single-click. */
|
|
259
290
|
this.rowClick = output();
|
|
260
291
|
/** Emitted on row double-click. */
|
|
@@ -306,7 +337,7 @@ class BsDatatableComponent {
|
|
|
306
337
|
* because only they know whether the filter is client-side or a new query.
|
|
307
338
|
*/
|
|
308
339
|
this.filterChange = output();
|
|
309
|
-
this.datatableRef = viewChild('datatable', /* @ts-ignore */
|
|
340
|
+
this.datatableRef = viewChild.required('datatable', /* @ts-ignore */
|
|
310
341
|
...(ngDevMode ? [{ debugName: "datatableRef" }] : /* istanbul ignore next */ []));
|
|
311
342
|
/** Column directives (header template + sortable). Wrapper-level discovery. */
|
|
312
343
|
this.columnDirectives = contentChildren(BsDatatableColumnDirective, /* @ts-ignore */
|
|
@@ -412,6 +443,8 @@ class BsDatatableComponent {
|
|
|
412
443
|
this.staleViews = [];
|
|
413
444
|
/** EmbeddedViews for row templates, keyed by rowKey for reuse. */
|
|
414
445
|
this.rowViews = new Map();
|
|
446
|
+
/** The selection model the wrapper last built from a WC event (echo guard). */
|
|
447
|
+
this.lastEmittedSelection = null;
|
|
415
448
|
this.destroyRef.onDestroy(() => {
|
|
416
449
|
// Deliberately does NOT destroy the views. Every one of them is attached
|
|
417
450
|
// to this component's ViewContainerRef, so Angular tears them down with
|
|
@@ -429,33 +462,16 @@ class BsDatatableComponent {
|
|
|
429
462
|
this.staleViews = [];
|
|
430
463
|
this.rowViews.clear();
|
|
431
464
|
});
|
|
432
|
-
// Forward the `[fetch]` callback to the WC, which owns the entire
|
|
433
|
-
// server-paged loop (initial page, on-demand windows, tree children,
|
|
434
|
-
// pagination, sort/perPage reloads) and derives `totalRecords` from the
|
|
435
|
-
// response. The wrapper no longer runs any fetch loop. Skipped on the
|
|
436
|
-
// server so SSR doesn't kick off a client fetch.
|
|
437
|
-
effect(() => {
|
|
438
|
-
const el = this.datatableRef()?.nativeElement;
|
|
439
|
-
if (!el)
|
|
440
|
-
return;
|
|
441
|
-
if (isPlatformServer(this.platformId))
|
|
442
|
-
return;
|
|
443
|
-
el.fetch = this.fetch() ?? null;
|
|
444
|
-
});
|
|
445
465
|
// Same server guard as `fetch`: the source is a network call in every real
|
|
446
466
|
// consumer, and a panel cannot be opened during SSR anyway.
|
|
447
467
|
effect(() => {
|
|
448
|
-
const el = this.datatableRef()
|
|
449
|
-
if (!el)
|
|
450
|
-
return;
|
|
468
|
+
const el = this.datatableRef().nativeElement;
|
|
451
469
|
if (isPlatformServer(this.platformId))
|
|
452
470
|
return;
|
|
453
471
|
el.distincts = this.distincts();
|
|
454
472
|
});
|
|
455
473
|
effect(() => {
|
|
456
|
-
const el = this.datatableRef()
|
|
457
|
-
if (!el)
|
|
458
|
-
return;
|
|
474
|
+
const el = this.datatableRef().nativeElement;
|
|
459
475
|
el.labels = this.labels() ?? undefined;
|
|
460
476
|
});
|
|
461
477
|
// Forward columns to the WC, and dispose the generation the recompute
|
|
@@ -464,70 +480,82 @@ class BsDatatableComponent {
|
|
|
464
480
|
effect(() => {
|
|
465
481
|
const columns = this.effectiveColumns();
|
|
466
482
|
this.disposeStaleViews();
|
|
467
|
-
const el = this.datatableRef()
|
|
468
|
-
if (!el)
|
|
469
|
-
return;
|
|
483
|
+
const el = this.datatableRef().nativeElement;
|
|
470
484
|
el.columns = columns;
|
|
471
485
|
});
|
|
472
486
|
// Static `[data]` only. When `[fetch]` is set the WC owns the rows, so the
|
|
473
487
|
// wrapper must not also push `el.data` (it would clobber fetched pages).
|
|
474
488
|
effect(() => {
|
|
475
|
-
const el = this.datatableRef()
|
|
476
|
-
if (!el)
|
|
477
|
-
return;
|
|
489
|
+
const el = this.datatableRef().nativeElement;
|
|
478
490
|
if (this.fetch())
|
|
479
491
|
return;
|
|
480
492
|
const d = this.data();
|
|
481
493
|
el.data = (d ?? []);
|
|
482
494
|
});
|
|
495
|
+
// Forward `[fetch]` and the paging/sort settings as ONE change (#407). The
|
|
496
|
+
// WC owns the entire server-paged loop (initial page, on-demand windows,
|
|
497
|
+
// tree children, pagination, sort/perPage reloads) and derives
|
|
498
|
+
// `totalRecords` from the response; the wrapper runs no fetch loop.
|
|
499
|
+
// Assigning fetch, sort, page and perPage through separate setters (they
|
|
500
|
+
// used to live in two effects) could split across ticks and cost two
|
|
501
|
+
// requests; `applyFetchState` schedules exactly one.
|
|
502
|
+
//
|
|
503
|
+
// This effect must never read `selection`: a selection change would then
|
|
504
|
+
// re-run it, and with an inline `[fetch]` closure that is a request.
|
|
483
505
|
effect(() => {
|
|
484
|
-
const el = this.datatableRef()
|
|
485
|
-
if (!el)
|
|
486
|
-
return;
|
|
506
|
+
const el = this.datatableRef().nativeElement;
|
|
487
507
|
const settings = this.settings();
|
|
488
|
-
const
|
|
508
|
+
const fetch = this.fetch();
|
|
489
509
|
const virtual = this.virtualScroll();
|
|
490
|
-
|
|
491
|
-
|
|
510
|
+
const sortColumns = settings.sortColumns.map((c) => ({ property: c.property, direction: c.direction }));
|
|
511
|
+
if (isPlatformServer(this.platformId)) {
|
|
512
|
+
// No fetch on the server (SSR must not kick off a client request), and
|
|
513
|
+
// the element may not be upgraded there, so no method calls either.
|
|
514
|
+
el.sortColumns = sortColumns;
|
|
515
|
+
el.page = settings.page.selected;
|
|
516
|
+
el.perPage = settings.perPage.selected;
|
|
517
|
+
}
|
|
518
|
+
else {
|
|
519
|
+
el.applyFetchState({
|
|
520
|
+
fetch: fetch ?? null,
|
|
521
|
+
sortColumns,
|
|
522
|
+
perPage: settings.perPage.selected,
|
|
523
|
+
page: settings.page.selected,
|
|
524
|
+
});
|
|
525
|
+
}
|
|
526
|
+
el.autoSort = !fetch;
|
|
492
527
|
// Pagination renders in non-virtual mode; in fetch mode the wrapper
|
|
493
528
|
// owns page state and the WC just reports the change via event.
|
|
494
529
|
el.pagination = this.pagination() && !virtual;
|
|
495
|
-
el.page = settings.page.selected;
|
|
496
|
-
el.perPage = settings.perPage.selected;
|
|
497
530
|
el.perPageOptions = settings.perPage.values;
|
|
498
531
|
});
|
|
499
532
|
effect(() => {
|
|
500
|
-
const el = this.datatableRef()
|
|
501
|
-
if (!el)
|
|
502
|
-
return;
|
|
533
|
+
const el = this.datatableRef().nativeElement;
|
|
503
534
|
const mode = this.selectable() ?? this.selectionMode();
|
|
504
535
|
el.selectionMode = mode;
|
|
505
536
|
});
|
|
506
537
|
effect(() => {
|
|
507
|
-
const el = this.datatableRef()
|
|
508
|
-
if (!el)
|
|
509
|
-
return;
|
|
538
|
+
const el = this.datatableRef().nativeElement;
|
|
510
539
|
el.rowKey = (row, index) => this.rowKey()(row, index);
|
|
511
540
|
});
|
|
512
541
|
effect(() => {
|
|
513
|
-
const el = this.datatableRef()
|
|
514
|
-
|
|
515
|
-
|
|
542
|
+
const el = this.datatableRef().nativeElement;
|
|
543
|
+
const label = this.rowLabel();
|
|
544
|
+
el.rowLabel = label ? (row) => label(row) : null;
|
|
545
|
+
});
|
|
546
|
+
effect(() => {
|
|
547
|
+
const el = this.datatableRef().nativeElement;
|
|
516
548
|
el.resizableColumns = this.resizableColumns();
|
|
517
549
|
});
|
|
518
550
|
effect(() => {
|
|
519
|
-
const el = this.datatableRef()
|
|
520
|
-
if (!el)
|
|
521
|
-
return;
|
|
551
|
+
const el = this.datatableRef().nativeElement;
|
|
522
552
|
el.virtualScroll = this.virtualScroll();
|
|
523
553
|
el.itemSize = this.itemSize();
|
|
524
554
|
el.virtualBuffer = this.virtualBuffer();
|
|
525
555
|
});
|
|
526
556
|
// Tree-mode prop sync to the WC.
|
|
527
557
|
effect(() => {
|
|
528
|
-
const el = this.datatableRef()
|
|
529
|
-
if (!el)
|
|
530
|
-
return;
|
|
558
|
+
const el = this.datatableRef().nativeElement;
|
|
531
559
|
el.tree = this.tree();
|
|
532
560
|
el.idKey = this.idKey();
|
|
533
561
|
el.childCountKey = this.childCountKey();
|
|
@@ -538,9 +566,7 @@ class BsDatatableComponent {
|
|
|
538
566
|
// — the WC's getter returns a fresh Set on every read.
|
|
539
567
|
effect(() => {
|
|
540
568
|
const desired = this.expandedIds();
|
|
541
|
-
const el = this.datatableRef()
|
|
542
|
-
if (!el)
|
|
543
|
-
return;
|
|
569
|
+
const el = this.datatableRef().nativeElement;
|
|
544
570
|
const current = el.expandedIds;
|
|
545
571
|
if (setsEqual(current, desired))
|
|
546
572
|
return;
|
|
@@ -548,32 +574,74 @@ class BsDatatableComponent {
|
|
|
548
574
|
});
|
|
549
575
|
// Wire the row renderer when *bsRowTemplate is provided.
|
|
550
576
|
effect(() => {
|
|
551
|
-
const el = this.datatableRef()
|
|
552
|
-
if (!el)
|
|
553
|
-
return;
|
|
577
|
+
const el = this.datatableRef().nativeElement;
|
|
554
578
|
const tpl = this.rowTemplate();
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
v.destroy();
|
|
560
|
-
this.rowViews.clear();
|
|
561
|
-
return;
|
|
562
|
-
}
|
|
563
|
-
el.rowRenderer = this.buildRowRenderer(tpl);
|
|
579
|
+
// Row views cached for a previous template would keep rendering ITS cells: drop them.
|
|
580
|
+
[...this.rowViews.values()].map((v) => v.destroy());
|
|
581
|
+
this.rowViews.clear();
|
|
582
|
+
el.rowRenderer = tpl ? this.buildRowRenderer(tpl) : undefined;
|
|
564
583
|
});
|
|
565
|
-
// Selection
|
|
584
|
+
// Selection model → WC. Rows are pushed, not keys, so the element
|
|
585
|
+
// remembers host-supplied rows that are not loaded (and derives the keys
|
|
586
|
+
// itself, from the row's position in its data — not from the row's index
|
|
587
|
+
// in this array, which was K3).
|
|
588
|
+
//
|
|
589
|
+
// Echo guard (spike S2). The `selectedRows` setter REPLACES the selection.
|
|
590
|
+
// A model built from an event can legitimately lack a key the element
|
|
591
|
+
// still holds (a key that has never had a row, D3), so pushing that model
|
|
592
|
+
// back would silently DROP the key. Two checks keep that from happening:
|
|
593
|
+
// 1. The model the wrapper itself just built from an event is not pushed
|
|
594
|
+
// back — compared by reference. The guard covers that IMMEDIATE echo
|
|
595
|
+
// only: the first other value clears it, so a host that clears the
|
|
596
|
+
// selection and later restores the earlier array (cancel, error) is
|
|
597
|
+
// pushed like any other write.
|
|
598
|
+
// 2. Anything else with the element's key set is pushed only when some
|
|
599
|
+
// row differs (`!==`) from the row the element holds for its key: a
|
|
600
|
+
// host's fresher object (a new etag) must reach the element, or its
|
|
601
|
+
// next event would report the stale one. Equal key sets mean no
|
|
602
|
+
// row-less key can be lost by that push; an identical model is skipped.
|
|
603
|
+
// The setter emits no event and this effect writes no signal, so there is
|
|
604
|
+
// no loop either way.
|
|
566
605
|
effect(() => {
|
|
567
|
-
const el = this.datatableRef()
|
|
568
|
-
if (!el)
|
|
569
|
-
return;
|
|
606
|
+
const el = this.datatableRef().nativeElement;
|
|
570
607
|
const rows = this.selection();
|
|
571
608
|
const keyFn = this.rowKey();
|
|
572
|
-
|
|
609
|
+
if (rows === this.lastEmittedSelection)
|
|
610
|
+
return;
|
|
611
|
+
this.lastEmittedSelection = null;
|
|
612
|
+
const current = el.selectedIds ?? [];
|
|
613
|
+
const currentRows = el.selectedRows ?? [];
|
|
614
|
+
const keyOf = this.selectionKeyLookup(keyFn, current, currentRows);
|
|
615
|
+
const keys = rows.map(keyOf);
|
|
616
|
+
const next = new Set(keys);
|
|
617
|
+
const sameKeys = next.size === current.length && current.every((k) => next.has(k));
|
|
618
|
+
if (sameKeys) {
|
|
619
|
+
const elementRow = new Map(current.map((k, i) => [k, currentRows[i]]));
|
|
620
|
+
if (rows.every((row, i) => elementRow.get(keys[i]) === row))
|
|
621
|
+
return;
|
|
622
|
+
}
|
|
623
|
+
el.selectedRows = rows;
|
|
573
624
|
});
|
|
574
625
|
}
|
|
575
|
-
|
|
576
|
-
|
|
626
|
+
/**
|
|
627
|
+
* Keys a selection-model row the way the element would: a row the element
|
|
628
|
+
* currently reports keeps the key it reports it under; any other row gets
|
|
629
|
+
* `rowKey(row, -1)`, which is what the element uses for a row that is not
|
|
630
|
+
* in its loaded data.
|
|
631
|
+
*/
|
|
632
|
+
selectionKeyLookup(keyFn, ids, rows) {
|
|
633
|
+
const known = new Map(rows.flatMap((row, i) => (row === undefined ? [] : [[row, ids[i]]])));
|
|
634
|
+
return (row) => known.get(row) ?? keyFn(row, -1);
|
|
635
|
+
}
|
|
636
|
+
/**
|
|
637
|
+
* Re-queries `[fetch]` for the current sort, page and page size, e.g. after
|
|
638
|
+
* the server data changed. The selection is kept. `resetPage: true` also
|
|
639
|
+
* returns to page 1. A no-op on the server and without `[fetch]`.
|
|
640
|
+
*/
|
|
641
|
+
reload(options) {
|
|
642
|
+
if (isPlatformServer(this.platformId))
|
|
643
|
+
return;
|
|
644
|
+
this.datatableRef().nativeElement.reload(options);
|
|
577
645
|
}
|
|
578
646
|
buildRowRenderer(tpl) {
|
|
579
647
|
return (row, rowIndex, ctx) => {
|
|
@@ -620,10 +688,19 @@ class BsDatatableComponent {
|
|
|
620
688
|
}
|
|
621
689
|
onSelectionChange(event) {
|
|
622
690
|
const detail = event.detail;
|
|
623
|
-
//
|
|
624
|
-
//
|
|
625
|
-
//
|
|
626
|
-
|
|
691
|
+
// `selectedIds` is authoritative; `selectedRows` is index-aligned with it,
|
|
692
|
+
// with `undefined` for a key whose row the element has never seen (D3/D5).
|
|
693
|
+
// Such a key falls back to the row the model already held for it, and is
|
|
694
|
+
// otherwise left out of the model — it stays selected in the element,
|
|
695
|
+
// which is why the selection effect's echo guard never pushes it back.
|
|
696
|
+
const keyFn = this.rowKey();
|
|
697
|
+
const previous = new Map(this.selection().map((row) => [keyFn(row, -1), row]));
|
|
698
|
+
const next = detail.selectedIds.flatMap((id, i) => {
|
|
699
|
+
const row = detail.selectedRows[i] ?? previous.get(id);
|
|
700
|
+
return row === undefined ? [] : [row];
|
|
701
|
+
});
|
|
702
|
+
this.lastEmittedSelection = next;
|
|
703
|
+
this.selection.set(next);
|
|
627
704
|
}
|
|
628
705
|
onPageChange(event) {
|
|
629
706
|
const detail = event.detail;
|
|
@@ -680,12 +757,12 @@ class BsDatatableComponent {
|
|
|
680
757
|
};
|
|
681
758
|
}
|
|
682
759
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: BsDatatableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
683
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.0.8", type: BsDatatableComponent, isStandalone: true, selector: "bs-datatable", inputs: { columnsInput: { classPropertyName: "columnsInput", publicName: "columns", isSignal: true, isRequired: false, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, fetch: { classPropertyName: "fetch", publicName: "fetch", isSignal: true, isRequired: false, transformFunction: null }, distincts: { classPropertyName: "distincts", publicName: "distincts", isSignal: true, isRequired: false, transformFunction: null }, labels: { classPropertyName: "labels", publicName: "labels", isSignal: true, isRequired: false, transformFunction: null }, settings: { classPropertyName: "settings", publicName: "settings", isSignal: true, isRequired: false, transformFunction: null }, selectionMode: { classPropertyName: "selectionMode", publicName: "selectionMode", isSignal: true, isRequired: false, transformFunction: null }, selectable: { classPropertyName: "selectable", publicName: "selectable", isSignal: true, isRequired: false, transformFunction: null }, selection: { classPropertyName: "selection", publicName: "selection", isSignal: true, isRequired: false, transformFunction: null }, rowKey: { classPropertyName: "rowKey", publicName: "rowKey", isSignal: true, isRequired: false, transformFunction: null },
|
|
760
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.0.8", type: BsDatatableComponent, isStandalone: true, selector: "bs-datatable", inputs: { columnsInput: { classPropertyName: "columnsInput", publicName: "columns", isSignal: true, isRequired: false, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, fetch: { classPropertyName: "fetch", publicName: "fetch", isSignal: true, isRequired: false, transformFunction: null }, distincts: { classPropertyName: "distincts", publicName: "distincts", isSignal: true, isRequired: false, transformFunction: null }, labels: { classPropertyName: "labels", publicName: "labels", isSignal: true, isRequired: false, transformFunction: null }, settings: { classPropertyName: "settings", publicName: "settings", isSignal: true, isRequired: false, transformFunction: null }, selectionMode: { classPropertyName: "selectionMode", publicName: "selectionMode", isSignal: true, isRequired: false, transformFunction: null }, selectable: { classPropertyName: "selectable", publicName: "selectable", isSignal: true, isRequired: false, transformFunction: null }, selection: { classPropertyName: "selection", publicName: "selection", isSignal: true, isRequired: false, transformFunction: null }, rowKey: { classPropertyName: "rowKey", publicName: "rowKey", isSignal: true, isRequired: false, transformFunction: null }, rowLabel: { classPropertyName: "rowLabel", publicName: "rowLabel", isSignal: true, isRequired: false, transformFunction: null }, resizableColumns: { classPropertyName: "resizableColumns", publicName: "resizableColumns", isSignal: true, isRequired: false, transformFunction: null }, pagination: { classPropertyName: "pagination", publicName: "pagination", isSignal: true, isRequired: false, transformFunction: null }, virtualScroll: { classPropertyName: "virtualScroll", publicName: "virtualScroll", isSignal: true, isRequired: false, transformFunction: null }, itemSize: { classPropertyName: "itemSize", publicName: "itemSize", isSignal: true, isRequired: false, transformFunction: null }, virtualBuffer: { classPropertyName: "virtualBuffer", publicName: "virtualBuffer", isSignal: true, isRequired: false, transformFunction: null }, isResponsive: { classPropertyName: "isResponsive", publicName: "isResponsive", isSignal: true, isRequired: false, transformFunction: null }, tree: { classPropertyName: "tree", publicName: "tree", isSignal: true, isRequired: false, transformFunction: null }, idKey: { classPropertyName: "idKey", publicName: "idKey", isSignal: true, isRequired: false, transformFunction: null }, childCountKey: { classPropertyName: "childCountKey", publicName: "childCountKey", isSignal: true, isRequired: false, transformFunction: null }, treeIndent: { classPropertyName: "treeIndent", publicName: "treeIndent", isSignal: true, isRequired: false, transformFunction: null }, expandedIds: { classPropertyName: "expandedIds", publicName: "expandedIds", isSignal: true, isRequired: false, transformFunction: null }, selectionStrategy: { classPropertyName: "selectionStrategy", publicName: "selectionStrategy", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { settings: "settingsChange", selection: "selectionChange", rowClick: "rowClick", rowDblClick: "rowDblClick", rowContextMenu: "rowContextMenu", expandedIds: "expandedIdsChange", rowExpand: "rowExpand", rowCollapse: "rowCollapse", filterChange: "filterChange" }, queries: [{ propertyName: "columnDirectives", predicate: BsDatatableColumnDirective, isSignal: true }, { propertyName: "rowTemplate", first: true, predicate: (BsRowTemplateDirective), descendants: true, isSignal: true }], viewQueries: [{ propertyName: "datatableRef", first: true, predicate: ["datatable"], descendants: true, isSignal: true }], ngImport: i0, template: "<mp-datatable bsForwardAria\n #datatable\n class=\"bs-datatable\"\n (mp-datatable-sort-change)=\"onSortChange($event)\"\n (mp-datatable-selection-change)=\"onSelectionChange($event)\"\n (mp-datatable-page-change)=\"onPageChange($event)\"\n (mp-datatable-per-page-change)=\"onPerPageChange($event)\"\n (mp-datatable-row-click)=\"onRowClick($event)\"\n (mp-datatable-row-dblclick)=\"onRowDblClick($event)\"\n (mp-datatable-row-contextmenu)=\"onRowContextMenu($event)\"\n (mp-datatable-row-expand)=\"onRowExpand($event)\"\n (mp-datatable-row-collapse)=\"onRowCollapse($event)\"\n (mp-datatable-expanded-ids-change)=\"onExpandedIdsChange($event)\"\n (mp-datatable-filter-change)=\"onFilterChange($event)\"\n></mp-datatable>\n", styles: [":host{display:block;width:100%}.bs-datatable{display:block;width:100%}\n"], dependencies: [{ kind: "directive", type: BsForwardAriaDirective, selector: "[bsForwardAria]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
684
761
|
}
|
|
685
762
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: BsDatatableComponent, decorators: [{
|
|
686
763
|
type: Component,
|
|
687
764
|
args: [{ selector: 'bs-datatable', imports: [BsForwardAriaDirective], schemas: [CUSTOM_ELEMENTS_SCHEMA], changeDetection: ChangeDetectionStrategy.OnPush, template: "<mp-datatable bsForwardAria\n #datatable\n class=\"bs-datatable\"\n (mp-datatable-sort-change)=\"onSortChange($event)\"\n (mp-datatable-selection-change)=\"onSelectionChange($event)\"\n (mp-datatable-page-change)=\"onPageChange($event)\"\n (mp-datatable-per-page-change)=\"onPerPageChange($event)\"\n (mp-datatable-row-click)=\"onRowClick($event)\"\n (mp-datatable-row-dblclick)=\"onRowDblClick($event)\"\n (mp-datatable-row-contextmenu)=\"onRowContextMenu($event)\"\n (mp-datatable-row-expand)=\"onRowExpand($event)\"\n (mp-datatable-row-collapse)=\"onRowCollapse($event)\"\n (mp-datatable-expanded-ids-change)=\"onExpandedIdsChange($event)\"\n (mp-datatable-filter-change)=\"onFilterChange($event)\"\n></mp-datatable>\n", styles: [":host{display:block;width:100%}.bs-datatable{display:block;width:100%}\n"] }]
|
|
688
|
-
}], ctorParameters: () => [], propDecorators: { columnsInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "columns", required: false }] }], data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: false }] }], fetch: [{ type: i0.Input, args: [{ isSignal: true, alias: "fetch", required: false }] }], distincts: [{ type: i0.Input, args: [{ isSignal: true, alias: "distincts", required: false }] }], labels: [{ type: i0.Input, args: [{ isSignal: true, alias: "labels", required: false }] }], settings: [{ type: i0.Input, args: [{ isSignal: true, alias: "settings", required: false }] }, { type: i0.Output, args: ["settingsChange"] }], selectionMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectionMode", required: false }] }], selectable: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectable", required: false }] }], selection: [{ type: i0.Input, args: [{ isSignal: true, alias: "selection", required: false }] }, { type: i0.Output, args: ["selectionChange"] }], rowKey: [{ type: i0.Input, args: [{ isSignal: true, alias: "rowKey", required: false }] }],
|
|
765
|
+
}], ctorParameters: () => [], propDecorators: { columnsInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "columns", required: false }] }], data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: false }] }], fetch: [{ type: i0.Input, args: [{ isSignal: true, alias: "fetch", required: false }] }], distincts: [{ type: i0.Input, args: [{ isSignal: true, alias: "distincts", required: false }] }], labels: [{ type: i0.Input, args: [{ isSignal: true, alias: "labels", required: false }] }], settings: [{ type: i0.Input, args: [{ isSignal: true, alias: "settings", required: false }] }, { type: i0.Output, args: ["settingsChange"] }], selectionMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectionMode", required: false }] }], selectable: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectable", required: false }] }], selection: [{ type: i0.Input, args: [{ isSignal: true, alias: "selection", required: false }] }, { type: i0.Output, args: ["selectionChange"] }], rowKey: [{ type: i0.Input, args: [{ isSignal: true, alias: "rowKey", required: false }] }], rowLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "rowLabel", required: false }] }], resizableColumns: [{ type: i0.Input, args: [{ isSignal: true, alias: "resizableColumns", required: false }] }], pagination: [{ type: i0.Input, args: [{ isSignal: true, alias: "pagination", required: false }] }], virtualScroll: [{ type: i0.Input, args: [{ isSignal: true, alias: "virtualScroll", required: false }] }], itemSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "itemSize", required: false }] }], virtualBuffer: [{ type: i0.Input, args: [{ isSignal: true, alias: "virtualBuffer", required: false }] }], isResponsive: [{ type: i0.Input, args: [{ isSignal: true, alias: "isResponsive", required: false }] }], rowClick: [{ type: i0.Output, args: ["rowClick"] }], rowDblClick: [{ type: i0.Output, args: ["rowDblClick"] }], rowContextMenu: [{ type: i0.Output, args: ["rowContextMenu"] }], tree: [{ type: i0.Input, args: [{ isSignal: true, alias: "tree", required: false }] }], idKey: [{ type: i0.Input, args: [{ isSignal: true, alias: "idKey", required: false }] }], childCountKey: [{ type: i0.Input, args: [{ isSignal: true, alias: "childCountKey", required: false }] }], treeIndent: [{ type: i0.Input, args: [{ isSignal: true, alias: "treeIndent", required: false }] }], expandedIds: [{ type: i0.Input, args: [{ isSignal: true, alias: "expandedIds", required: false }] }, { type: i0.Output, args: ["expandedIdsChange"] }], selectionStrategy: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectionStrategy", required: false }] }], rowExpand: [{ type: i0.Output, args: ["rowExpand"] }], rowCollapse: [{ type: i0.Output, args: ["rowCollapse"] }], filterChange: [{ type: i0.Output, args: ["filterChange"] }], datatableRef: [{ type: i0.ViewChild, args: ['datatable', { isSignal: true }] }], columnDirectives: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => BsDatatableColumnDirective), { isSignal: true }] }], rowTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => BsRowTemplateDirective), { isSignal: true }] }] } });
|
|
689
766
|
function setsEqual(a, b) {
|
|
690
767
|
// In SSR the WC isn't upgraded yet, so reading `el.expandedIds` returns
|
|
691
768
|
// `undefined` instead of the getter's `new Set()`. Treat both-missing as
|