@virusis/angular-ui 0.1.2 → 0.1.3

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.
@@ -3472,6 +3472,23 @@ class VpDataTableComponent {
3472
3472
  this.sortOrder = 'asc';
3473
3473
  this.skeletonRows = [0, 1, 2, 3, 4];
3474
3474
  }
3475
+ /**
3476
+ * 🔴 Detay şablonu verilmişse genişletme AÇIKTIR.
3477
+ *
3478
+ * Ölçüldü (2026-08-29, Customer Console): ekran `rowDetail` veriyor,
3479
+ * `expandable` vermiyordu. Üç şablon kapısı da `expandable`'a bakıyordu, yani
3480
+ * detay satırına ulaşmanın yolu hiç çizilmedi — tarama listesinden hiçbir
3481
+ * taramanın detayına gidilemiyordu. Ne derleme ne test düşüyordu; belirti
3482
+ * yalnız ekrandaydı.
3483
+ *
3484
+ * ⚠️ İki girdiyi birbirine bağlamak bir kolaylık değil, **tutarlılık**:
3485
+ * detay şablonu verip genişletmeyi kapalı bırakmak anlamlı bir durum değil.
3486
+ * Tersi anlamlı ve korunuyor — `expandable` tek başına, şablonsuz da çalışır
3487
+ * (bileşen bilgilendirici bir metin basar).
3488
+ */
3489
+ get canExpand() {
3490
+ return this.expandable || this.rowDetail !== null;
3491
+ }
3475
3492
  ngOnInit() {
3476
3493
  this.loadPrefs();
3477
3494
  if (this.savedViewsKey) {
@@ -3605,7 +3622,7 @@ class VpDataTableComponent {
3605
3622
  get columnSpan() {
3606
3623
  return (this.visibleCols.length +
3607
3624
  (this.selectable ? 1 : 0) +
3608
- (this.expandable ? 1 : 0) +
3625
+ (this.canExpand ? 1 : 0) +
3609
3626
  // Aksiyon sutunu da sayilmali; sayilmazsa genisletilmis satir tabloyu bir
3610
3627
  // hucre eksik doldurur ve yerlesim kayar.
3611
3628
  (this.rowActions ? 1 : 0));
@@ -3746,566 +3763,566 @@ class VpDataTableComponent {
3746
3763
  return row[field];
3747
3764
  }
3748
3765
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.27", ngImport: i0, type: VpDataTableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
3749
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.27", type: VpDataTableComponent, isStandalone: true, selector: "vp-data-table", inputs: { columns: "columns", rows: "rows", total: "total", serverSide: "serverSide", pageSize: "pageSize", loading: "loading", error: "error", hasActiveFilter: "hasActiveFilter", caption: "caption", totalLabel: "totalLabel", loadingLabel: "loadingLabel", emptyLabel: "emptyLabel", emptyFilteredLabel: "emptyFilteredLabel", clearFiltersLabel: "clearFiltersLabel", retryLabel: "retryLabel", pagerLabel: "pagerLabel", prevLabel: "prevLabel", nextLabel: "nextLabel", storageKey: "storageKey", selectable: "selectable", rowKey: "rowKey", bulkActions: "bulkActions", bulkResult: "bulkResult", bulkLabel: "bulkLabel", selectedLabel: "selectedLabel", clearSelectionLabel: "clearSelectionLabel", selectPageLabel: "selectPageLabel", selectRowLabel: "selectRowLabel", confirmPrefix: "confirmPrefix", confirmLabel: "confirmLabel", cancelLabel: "cancelLabel", succeededLabel: "succeededLabel", failedLabel: "failedLabel", expandable: "expandable", rowDetail: "rowDetail", expandLabel: "expandLabel", collapseLabel: "collapseLabel", expandColumnLabel: "expandColumnLabel", noDetailLabel: "noDetailLabel", rowActions: "rowActions", rowActionsHeader: "rowActionsHeader", exportScopes: "exportScopes", exportPageLabel: "exportPageLabel", exportAllLabel: "exportAllLabel", savedViewsKey: "savedViewsKey", viewsLabel: "viewsLabel", viewsPlaceholder: "viewsPlaceholder", saveViewLabel: "saveViewLabel", deleteViewLabel: "deleteViewLabel", askViewName: "askViewName", columnPicker: "columnPicker", columnsLabel: "columnsLabel", moveUpLabel: "moveUpLabel", moveDownLabel: "moveDownLabel" }, outputs: { bulkAction: "bulkAction", exportRequest: "exportRequest", viewApplied: "viewApplied", load: "load", clearFilters: "clearFilters" }, usesOnChanges: true, ngImport: i0, template: `
3750
- <div class="vp-table">
3751
- <div class="vp-table__meta">
3752
- <span class="vp-table__total" data-vp-total>
3753
- {{ total }} {{ totalLabel }}
3754
- </span>
3755
- @if (pageCount > 1) {
3756
- <span class="vp-table__pageinfo">{{ page }} / {{ pageCount }}</span>
3757
- }
3758
-
3759
- @if (savedViewsKey) {
3760
- <span class="vp-table__views" data-vp-views>
3761
- <select
3762
- class="vp-table__cols-btn"
3763
- data-vp-view-select
3764
- [attr.aria-label]="viewsLabel"
3765
- [value]="activeView"
3766
- (change)="applyView(asSelectValue($event))">
3767
- <option value="">{{ viewsPlaceholder }}</option>
3768
- @for (view of savedViews; track view.name) {
3769
- <option [value]="view.name">{{ view.name }}</option>
3770
- }
3771
- </select>
3772
-
3773
- <button type="button" class="vp-table__cols-btn" data-vp-view-save
3774
- (click)="saveViewPrompt()">{{ saveViewLabel }}</button>
3775
-
3776
- @if (activeView) {
3777
- <button type="button" class="vp-table__cols-btn" data-vp-view-delete
3778
- (click)="deleteActiveView()">{{ deleteViewLabel }}</button>
3779
- }
3780
- </span>
3781
- }
3782
-
3783
- @if (exportScopes.length > 0) {
3784
- @for (scope of exportScopes; track scope) {
3785
- <button
3786
- type="button"
3787
- class="vp-table__cols-btn"
3788
- [attr.data-vp-export]="scope"
3789
- (click)="requestExport(scope)">{{ exportLabel(scope) }}</button>
3790
- }
3791
- }
3792
-
3793
- @if (columnPicker) {
3794
- <button
3795
- type="button"
3796
- class="vp-table__cols-btn"
3797
- data-vp-cols-toggle
3798
- [attr.aria-expanded]="pickerOpen"
3799
- (click)="pickerOpen = !pickerOpen">{{ columnsLabel }}</button>
3800
- }
3801
- </div>
3802
-
3803
- @if (selectable && selectedKeys.size > 0) {
3804
- <div class="vp-table__bulk" data-vp-bulk role="group" [attr.aria-label]="bulkLabel">
3805
- <span data-vp-bulk-count>{{ selectedKeys.size }} {{ selectedLabel }}</span>
3806
-
3807
- <div class="vp-table__bulk-actions">
3808
- @for (action of bulkActions; track action.code) {
3809
- <button
3810
- type="button"
3811
- [attr.data-vp-bulk-action]="action.code"
3812
- [class.vp-table__bulk-btn--danger]="action.danger"
3813
- class="vp-table__bulk-btn"
3814
- (click)="requestBulkAction(action)">{{ action.label }}</button>
3815
- }
3816
- <button type="button" class="vp-table__bulk-btn" data-vp-bulk-clear
3817
- (click)="clearSelection()">{{ clearSelectionLabel }}</button>
3818
- </div>
3819
- </div>
3820
-
3821
- @if (pendingAction) {
3822
- <div class="vp-table__bulk-confirm" data-vp-bulk-confirm role="alertdialog"
3823
- [attr.aria-label]="pendingAction.label">
3824
- <span>{{ confirmPrefix }} {{ selectedKeys.size }} {{ selectedLabel }} — {{ pendingAction.label }}?</span>
3825
- <span class="vp-table__bulk-actions">
3826
- <button type="button" class="vp-table__bulk-btn" data-vp-bulk-cancel
3827
- (click)="pendingAction = null">{{ cancelLabel }}</button>
3828
- <button type="button" class="vp-table__bulk-btn vp-table__bulk-btn--danger"
3829
- data-vp-bulk-confirm-ok (click)="confirmBulkAction()">{{ confirmLabel }}</button>
3830
- </span>
3831
- </div>
3832
- }
3833
- }
3834
-
3835
- @if (bulkResult) {
3836
- <div class="vp-table__bulk-report" data-vp-bulk-report role="status" aria-live="polite">
3837
- @if (bulkResult.succeeded.length > 0) {
3838
- <p data-vp-bulk-ok>{{ bulkResult.succeeded.length }} {{ succeededLabel }}</p>
3839
- }
3840
- @if (bulkResult.failed.length > 0) {
3841
- <p data-vp-bulk-failed>{{ bulkResult.failed.length }} {{ failedLabel }}</p>
3842
- <ul class="vp-table__bulk-failures">
3843
- @for (failure of bulkResult.failed; track failure.key) {
3844
- <li [attr.data-vp-bulk-failure]="failure.key">
3845
- <code>{{ failure.key }}</code> — {{ failure.reason }}
3846
- </li>
3847
- }
3848
- </ul>
3849
- }
3850
- </div>
3851
- }
3852
-
3853
- @if (columnPicker && pickerOpen) {
3854
- <div class="vp-table__cols" data-vp-cols role="group" [attr.aria-label]="columnsLabel">
3855
- @for (col of orderedColumns; track col.field; let i = $index) {
3856
- <div class="vp-table__cols-row" [attr.data-vp-cols-row]="col.field">
3857
- <label class="vp-table__cols-label">
3858
- <input
3859
- type="checkbox"
3860
- [attr.data-vp-col-toggle]="col.field"
3861
- [checked]="isVisible(col.field)"
3862
- [disabled]="isVisible(col.field) && visibleCount === 1"
3863
- (change)="setColumnVisible(col.field, !isVisible(col.field))" />
3864
- {{ col.header }}
3865
- </label>
3866
- <span class="vp-table__cols-move">
3867
- <button
3868
- type="button"
3869
- [attr.data-vp-col-up]="col.field"
3870
- [attr.aria-label]="moveUpLabel + ': ' + col.header"
3871
- [disabled]="i === 0"
3872
- (click)="moveColumn(col.field, -1)">↑</button>
3873
- <button
3874
- type="button"
3875
- [attr.data-vp-col-down]="col.field"
3876
- [attr.aria-label]="moveDownLabel + ': ' + col.header"
3877
- [disabled]="i === orderedColumns.length - 1"
3878
- (click)="moveColumn(col.field, 1)">↓</button>
3879
- </span>
3880
- </div>
3881
- }
3882
- </div>
3883
- }
3884
-
3885
- @if (error) {
3886
- <div class="vp-table__error" data-vp-table-error role="alert">
3887
- <svg class="vp-table__state-icon" aria-hidden="true" viewBox="0 0 24 24" focusable="false">
3888
- <use href="#vp-icon-error"></use>
3889
- </svg>
3890
- <p class="vp-table__state-text">{{ error }}</p>
3891
- <button type="button" class="vp-table__retry" (click)="emitLoad()">{{ retryLabel }}</button>
3892
- </div>
3893
- } @else if (loading) {
3894
- <div class="vp-table__skeleton" data-vp-table-skeleton aria-hidden="true">
3895
- @for (i of skeletonRows; track i) {
3896
- <span class="vp-table__skeleton-row"></span>
3897
- }
3898
- </div>
3899
- <span class="vp-visually-hidden" role="status">{{ loadingLabel }}</span>
3900
- } @else if (rows.length === 0) {
3901
- @if (hasActiveFilter) {
3902
- <div class="vp-table__empty" data-vp-table-empty-filtered role="status">
3903
- <svg class="vp-table__state-icon" aria-hidden="true" viewBox="0 0 24 24" focusable="false">
3904
- <use href="#vp-icon-filter"></use>
3905
- </svg>
3906
- <p class="vp-table__state-text">{{ emptyFilteredLabel }}</p>
3907
- <button type="button" class="vp-table__retry" (click)="clearFilters.emit()">
3908
- {{ clearFiltersLabel }}
3909
- </button>
3910
- </div>
3911
- } @else {
3912
- <div class="vp-table__empty" data-vp-table-empty role="status">
3913
- <svg class="vp-table__state-icon" aria-hidden="true" viewBox="0 0 24 24" focusable="false">
3914
- <use href="#vp-icon-empty"></use>
3915
- </svg>
3916
- <p class="vp-table__state-text">{{ emptyLabel }}</p>
3917
- </div>
3918
- }
3919
- } @else {
3920
- <div class="vp-table__scroll">
3921
- <table class="vp-table__table" [attr.aria-label]="caption">
3922
- <thead>
3923
- <tr>
3924
- @if (expandable) {
3925
- <th scope="col" class="vp-table__select-cell">
3926
- <span class="vp-visually-hidden">{{ expandColumnLabel }}</span>
3927
- </th>
3928
- }
3929
- @if (selectable) {
3930
- <th scope="col" class="vp-table__select-cell">
3931
- <input
3932
- type="checkbox"
3933
- data-vp-select-page
3934
- [attr.aria-label]="selectPageLabel"
3935
- [checked]="allOnPageSelected"
3936
- [indeterminate]="someOnPageSelected"
3937
- (change)="togglePageSelection()" />
3938
- </th>
3939
- }
3940
- @for (col of visibleCols; track col.field) {
3941
- <th
3942
- scope="col"
3943
- [attr.data-vp-col]="col.field"
3944
- [attr.aria-sort]="ariaSort(col)"
3945
- [style.width]="col.width || null">
3946
- @if (col.sortable) {
3947
- <button type="button" class="vp-table__sort" (click)="toggleSort(col.field)">
3948
- {{ col.header }}
3949
- <span class="vp-table__sort-icon" aria-hidden="true">{{ sortGlyph(col.field) }}</span>
3950
- </button>
3951
- } @else {
3952
- {{ col.header }}
3953
- }
3954
- </th>
3955
- }
3956
- @if (rowActions) {
3957
- <th scope="col" class="vp-table__actions-header">{{ rowActionsHeader }}</th>
3958
- }
3959
- </tr>
3960
- </thead>
3961
- <tbody>
3962
- @for (row of rows; track $index) {
3963
- <tr data-vp-row>
3964
- @if (expandable) {
3965
- <td class="vp-table__select-cell">
3966
- <button
3967
- type="button"
3968
- class="vp-table__expand"
3969
- [attr.data-vp-expand]="keyOf(row)"
3970
- [attr.aria-expanded]="isExpanded(row)"
3971
- [attr.aria-label]="isExpanded(row) ? collapseLabel : expandLabel"
3972
- (click)="toggleExpanded(row)">{{ isExpanded(row) ? '▾' : '▸' }}</button>
3973
- </td>
3974
- }
3975
- @if (selectable) {
3976
- <td class="vp-table__select-cell">
3977
- <input
3978
- type="checkbox"
3979
- [attr.data-vp-select-row]="keyOf(row)"
3980
- [attr.aria-label]="selectRowLabel"
3981
- [checked]="isSelected(row)"
3982
- (change)="toggleRow(row)" />
3983
- </td>
3984
- }
3985
- @for (col of visibleCols; track col.field) {
3986
- <td>{{ cell(row, col.field) }}</td>
3987
- }
3988
- @if (rowActions) {
3989
- <td data-vp-row-actions>
3990
- <ng-container *ngTemplateOutlet="rowActions; context: { $implicit: row }" />
3991
- </td>
3992
- }
3993
- </tr>
3994
-
3995
- @if (expandable && isExpanded(row)) {
3996
- <tr class="vp-table__detail-row" [attr.data-vp-detail]="keyOf(row)">
3997
- <td [attr.colspan]="columnSpan">
3998
- @if (rowDetail) {
3999
- <ng-container *ngTemplateOutlet="rowDetail; context: { $implicit: row }" />
4000
- } @else {
4001
- <span class="vp-table__detail-empty">{{ noDetailLabel }}</span>
4002
- }
4003
- </td>
4004
- </tr>
4005
- }
4006
- }
4007
- </tbody>
4008
- </table>
4009
- </div>
4010
-
4011
- @if (pageCount > 1) {
4012
- <nav class="vp-table__pager" [attr.aria-label]="pagerLabel">
4013
- <button
4014
- type="button"
4015
- class="vp-table__page-btn"
4016
- [disabled]="page <= 1"
4017
- (click)="goToPage(page - 1)">{{ prevLabel }}</button>
4018
- <button
4019
- type="button"
4020
- class="vp-table__page-btn"
4021
- [disabled]="page >= pageCount"
4022
- (click)="goToPage(page + 1)">{{ nextLabel }}</button>
4023
- </nav>
4024
- }
4025
- }
4026
- </div>
3766
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.27", type: VpDataTableComponent, isStandalone: true, selector: "vp-data-table", inputs: { columns: "columns", rows: "rows", total: "total", serverSide: "serverSide", pageSize: "pageSize", loading: "loading", error: "error", hasActiveFilter: "hasActiveFilter", caption: "caption", totalLabel: "totalLabel", loadingLabel: "loadingLabel", emptyLabel: "emptyLabel", emptyFilteredLabel: "emptyFilteredLabel", clearFiltersLabel: "clearFiltersLabel", retryLabel: "retryLabel", pagerLabel: "pagerLabel", prevLabel: "prevLabel", nextLabel: "nextLabel", storageKey: "storageKey", selectable: "selectable", rowKey: "rowKey", bulkActions: "bulkActions", bulkResult: "bulkResult", bulkLabel: "bulkLabel", selectedLabel: "selectedLabel", clearSelectionLabel: "clearSelectionLabel", selectPageLabel: "selectPageLabel", selectRowLabel: "selectRowLabel", confirmPrefix: "confirmPrefix", confirmLabel: "confirmLabel", cancelLabel: "cancelLabel", succeededLabel: "succeededLabel", failedLabel: "failedLabel", expandable: "expandable", rowDetail: "rowDetail", expandLabel: "expandLabel", collapseLabel: "collapseLabel", expandColumnLabel: "expandColumnLabel", noDetailLabel: "noDetailLabel", rowActions: "rowActions", rowActionsHeader: "rowActionsHeader", exportScopes: "exportScopes", exportPageLabel: "exportPageLabel", exportAllLabel: "exportAllLabel", savedViewsKey: "savedViewsKey", viewsLabel: "viewsLabel", viewsPlaceholder: "viewsPlaceholder", saveViewLabel: "saveViewLabel", deleteViewLabel: "deleteViewLabel", askViewName: "askViewName", columnPicker: "columnPicker", columnsLabel: "columnsLabel", moveUpLabel: "moveUpLabel", moveDownLabel: "moveDownLabel" }, outputs: { bulkAction: "bulkAction", exportRequest: "exportRequest", viewApplied: "viewApplied", load: "load", clearFilters: "clearFilters" }, usesOnChanges: true, ngImport: i0, template: `
3767
+ <div class="vp-table">
3768
+ <div class="vp-table__meta">
3769
+ <span class="vp-table__total" data-vp-total>
3770
+ {{ total }} {{ totalLabel }}
3771
+ </span>
3772
+ @if (pageCount > 1) {
3773
+ <span class="vp-table__pageinfo">{{ page }} / {{ pageCount }}</span>
3774
+ }
3775
+
3776
+ @if (savedViewsKey) {
3777
+ <span class="vp-table__views" data-vp-views>
3778
+ <select
3779
+ class="vp-table__cols-btn"
3780
+ data-vp-view-select
3781
+ [attr.aria-label]="viewsLabel"
3782
+ [value]="activeView"
3783
+ (change)="applyView(asSelectValue($event))">
3784
+ <option value="">{{ viewsPlaceholder }}</option>
3785
+ @for (view of savedViews; track view.name) {
3786
+ <option [value]="view.name">{{ view.name }}</option>
3787
+ }
3788
+ </select>
3789
+
3790
+ <button type="button" class="vp-table__cols-btn" data-vp-view-save
3791
+ (click)="saveViewPrompt()">{{ saveViewLabel }}</button>
3792
+
3793
+ @if (activeView) {
3794
+ <button type="button" class="vp-table__cols-btn" data-vp-view-delete
3795
+ (click)="deleteActiveView()">{{ deleteViewLabel }}</button>
3796
+ }
3797
+ </span>
3798
+ }
3799
+
3800
+ @if (exportScopes.length > 0) {
3801
+ @for (scope of exportScopes; track scope) {
3802
+ <button
3803
+ type="button"
3804
+ class="vp-table__cols-btn"
3805
+ [attr.data-vp-export]="scope"
3806
+ (click)="requestExport(scope)">{{ exportLabel(scope) }}</button>
3807
+ }
3808
+ }
3809
+
3810
+ @if (columnPicker) {
3811
+ <button
3812
+ type="button"
3813
+ class="vp-table__cols-btn"
3814
+ data-vp-cols-toggle
3815
+ [attr.aria-expanded]="pickerOpen"
3816
+ (click)="pickerOpen = !pickerOpen">{{ columnsLabel }}</button>
3817
+ }
3818
+ </div>
3819
+
3820
+ @if (selectable && selectedKeys.size > 0) {
3821
+ <div class="vp-table__bulk" data-vp-bulk role="group" [attr.aria-label]="bulkLabel">
3822
+ <span data-vp-bulk-count>{{ selectedKeys.size }} {{ selectedLabel }}</span>
3823
+
3824
+ <div class="vp-table__bulk-actions">
3825
+ @for (action of bulkActions; track action.code) {
3826
+ <button
3827
+ type="button"
3828
+ [attr.data-vp-bulk-action]="action.code"
3829
+ [class.vp-table__bulk-btn--danger]="action.danger"
3830
+ class="vp-table__bulk-btn"
3831
+ (click)="requestBulkAction(action)">{{ action.label }}</button>
3832
+ }
3833
+ <button type="button" class="vp-table__bulk-btn" data-vp-bulk-clear
3834
+ (click)="clearSelection()">{{ clearSelectionLabel }}</button>
3835
+ </div>
3836
+ </div>
3837
+
3838
+ @if (pendingAction) {
3839
+ <div class="vp-table__bulk-confirm" data-vp-bulk-confirm role="alertdialog"
3840
+ [attr.aria-label]="pendingAction.label">
3841
+ <span>{{ confirmPrefix }} {{ selectedKeys.size }} {{ selectedLabel }} — {{ pendingAction.label }}?</span>
3842
+ <span class="vp-table__bulk-actions">
3843
+ <button type="button" class="vp-table__bulk-btn" data-vp-bulk-cancel
3844
+ (click)="pendingAction = null">{{ cancelLabel }}</button>
3845
+ <button type="button" class="vp-table__bulk-btn vp-table__bulk-btn--danger"
3846
+ data-vp-bulk-confirm-ok (click)="confirmBulkAction()">{{ confirmLabel }}</button>
3847
+ </span>
3848
+ </div>
3849
+ }
3850
+ }
3851
+
3852
+ @if (bulkResult) {
3853
+ <div class="vp-table__bulk-report" data-vp-bulk-report role="status" aria-live="polite">
3854
+ @if (bulkResult.succeeded.length > 0) {
3855
+ <p data-vp-bulk-ok>{{ bulkResult.succeeded.length }} {{ succeededLabel }}</p>
3856
+ }
3857
+ @if (bulkResult.failed.length > 0) {
3858
+ <p data-vp-bulk-failed>{{ bulkResult.failed.length }} {{ failedLabel }}</p>
3859
+ <ul class="vp-table__bulk-failures">
3860
+ @for (failure of bulkResult.failed; track failure.key) {
3861
+ <li [attr.data-vp-bulk-failure]="failure.key">
3862
+ <code>{{ failure.key }}</code> — {{ failure.reason }}
3863
+ </li>
3864
+ }
3865
+ </ul>
3866
+ }
3867
+ </div>
3868
+ }
3869
+
3870
+ @if (columnPicker && pickerOpen) {
3871
+ <div class="vp-table__cols" data-vp-cols role="group" [attr.aria-label]="columnsLabel">
3872
+ @for (col of orderedColumns; track col.field; let i = $index) {
3873
+ <div class="vp-table__cols-row" [attr.data-vp-cols-row]="col.field">
3874
+ <label class="vp-table__cols-label">
3875
+ <input
3876
+ type="checkbox"
3877
+ [attr.data-vp-col-toggle]="col.field"
3878
+ [checked]="isVisible(col.field)"
3879
+ [disabled]="isVisible(col.field) && visibleCount === 1"
3880
+ (change)="setColumnVisible(col.field, !isVisible(col.field))" />
3881
+ {{ col.header }}
3882
+ </label>
3883
+ <span class="vp-table__cols-move">
3884
+ <button
3885
+ type="button"
3886
+ [attr.data-vp-col-up]="col.field"
3887
+ [attr.aria-label]="moveUpLabel + ': ' + col.header"
3888
+ [disabled]="i === 0"
3889
+ (click)="moveColumn(col.field, -1)">↑</button>
3890
+ <button
3891
+ type="button"
3892
+ [attr.data-vp-col-down]="col.field"
3893
+ [attr.aria-label]="moveDownLabel + ': ' + col.header"
3894
+ [disabled]="i === orderedColumns.length - 1"
3895
+ (click)="moveColumn(col.field, 1)">↓</button>
3896
+ </span>
3897
+ </div>
3898
+ }
3899
+ </div>
3900
+ }
3901
+
3902
+ @if (error) {
3903
+ <div class="vp-table__error" data-vp-table-error role="alert">
3904
+ <svg class="vp-table__state-icon" aria-hidden="true" viewBox="0 0 24 24" focusable="false">
3905
+ <use href="#vp-icon-error"></use>
3906
+ </svg>
3907
+ <p class="vp-table__state-text">{{ error }}</p>
3908
+ <button type="button" class="vp-table__retry" (click)="emitLoad()">{{ retryLabel }}</button>
3909
+ </div>
3910
+ } @else if (loading) {
3911
+ <div class="vp-table__skeleton" data-vp-table-skeleton aria-hidden="true">
3912
+ @for (i of skeletonRows; track i) {
3913
+ <span class="vp-table__skeleton-row"></span>
3914
+ }
3915
+ </div>
3916
+ <span class="vp-visually-hidden" role="status">{{ loadingLabel }}</span>
3917
+ } @else if (rows.length === 0) {
3918
+ @if (hasActiveFilter) {
3919
+ <div class="vp-table__empty" data-vp-table-empty-filtered role="status">
3920
+ <svg class="vp-table__state-icon" aria-hidden="true" viewBox="0 0 24 24" focusable="false">
3921
+ <use href="#vp-icon-filter"></use>
3922
+ </svg>
3923
+ <p class="vp-table__state-text">{{ emptyFilteredLabel }}</p>
3924
+ <button type="button" class="vp-table__retry" (click)="clearFilters.emit()">
3925
+ {{ clearFiltersLabel }}
3926
+ </button>
3927
+ </div>
3928
+ } @else {
3929
+ <div class="vp-table__empty" data-vp-table-empty role="status">
3930
+ <svg class="vp-table__state-icon" aria-hidden="true" viewBox="0 0 24 24" focusable="false">
3931
+ <use href="#vp-icon-empty"></use>
3932
+ </svg>
3933
+ <p class="vp-table__state-text">{{ emptyLabel }}</p>
3934
+ </div>
3935
+ }
3936
+ } @else {
3937
+ <div class="vp-table__scroll">
3938
+ <table class="vp-table__table" [attr.aria-label]="caption">
3939
+ <thead>
3940
+ <tr>
3941
+ @if (canExpand) {
3942
+ <th scope="col" class="vp-table__select-cell">
3943
+ <span class="vp-visually-hidden">{{ expandColumnLabel }}</span>
3944
+ </th>
3945
+ }
3946
+ @if (selectable) {
3947
+ <th scope="col" class="vp-table__select-cell">
3948
+ <input
3949
+ type="checkbox"
3950
+ data-vp-select-page
3951
+ [attr.aria-label]="selectPageLabel"
3952
+ [checked]="allOnPageSelected"
3953
+ [indeterminate]="someOnPageSelected"
3954
+ (change)="togglePageSelection()" />
3955
+ </th>
3956
+ }
3957
+ @for (col of visibleCols; track col.field) {
3958
+ <th
3959
+ scope="col"
3960
+ [attr.data-vp-col]="col.field"
3961
+ [attr.aria-sort]="ariaSort(col)"
3962
+ [style.width]="col.width || null">
3963
+ @if (col.sortable) {
3964
+ <button type="button" class="vp-table__sort" (click)="toggleSort(col.field)">
3965
+ {{ col.header }}
3966
+ <span class="vp-table__sort-icon" aria-hidden="true">{{ sortGlyph(col.field) }}</span>
3967
+ </button>
3968
+ } @else {
3969
+ {{ col.header }}
3970
+ }
3971
+ </th>
3972
+ }
3973
+ @if (rowActions) {
3974
+ <th scope="col" class="vp-table__actions-header">{{ rowActionsHeader }}</th>
3975
+ }
3976
+ </tr>
3977
+ </thead>
3978
+ <tbody>
3979
+ @for (row of rows; track $index) {
3980
+ <tr data-vp-row>
3981
+ @if (canExpand) {
3982
+ <td class="vp-table__select-cell">
3983
+ <button
3984
+ type="button"
3985
+ class="vp-table__expand"
3986
+ [attr.data-vp-expand]="keyOf(row)"
3987
+ [attr.aria-expanded]="isExpanded(row)"
3988
+ [attr.aria-label]="isExpanded(row) ? collapseLabel : expandLabel"
3989
+ (click)="toggleExpanded(row)">{{ isExpanded(row) ? '▾' : '▸' }}</button>
3990
+ </td>
3991
+ }
3992
+ @if (selectable) {
3993
+ <td class="vp-table__select-cell">
3994
+ <input
3995
+ type="checkbox"
3996
+ [attr.data-vp-select-row]="keyOf(row)"
3997
+ [attr.aria-label]="selectRowLabel"
3998
+ [checked]="isSelected(row)"
3999
+ (change)="toggleRow(row)" />
4000
+ </td>
4001
+ }
4002
+ @for (col of visibleCols; track col.field) {
4003
+ <td>{{ cell(row, col.field) }}</td>
4004
+ }
4005
+ @if (rowActions) {
4006
+ <td data-vp-row-actions>
4007
+ <ng-container *ngTemplateOutlet="rowActions; context: { $implicit: row }" />
4008
+ </td>
4009
+ }
4010
+ </tr>
4011
+
4012
+ @if (canExpand && isExpanded(row)) {
4013
+ <tr class="vp-table__detail-row" [attr.data-vp-detail]="keyOf(row)">
4014
+ <td [attr.colspan]="columnSpan">
4015
+ @if (rowDetail) {
4016
+ <ng-container *ngTemplateOutlet="rowDetail; context: { $implicit: row }" />
4017
+ } @else {
4018
+ <span class="vp-table__detail-empty">{{ noDetailLabel }}</span>
4019
+ }
4020
+ </td>
4021
+ </tr>
4022
+ }
4023
+ }
4024
+ </tbody>
4025
+ </table>
4026
+ </div>
4027
+
4028
+ @if (pageCount > 1) {
4029
+ <nav class="vp-table__pager" [attr.aria-label]="pagerLabel">
4030
+ <button
4031
+ type="button"
4032
+ class="vp-table__page-btn"
4033
+ [disabled]="page <= 1"
4034
+ (click)="goToPage(page - 1)">{{ prevLabel }}</button>
4035
+ <button
4036
+ type="button"
4037
+ class="vp-table__page-btn"
4038
+ [disabled]="page >= pageCount"
4039
+ (click)="goToPage(page + 1)">{{ nextLabel }}</button>
4040
+ </nav>
4041
+ }
4042
+ }
4043
+ </div>
4027
4044
  `, isInline: true, styles: [":host{display:block}.vp-table{border:1px solid var(--vp-border-subtle);border-radius:var(--vp-radius-lg);background:var(--vp-surface-raised);overflow:hidden}.vp-table__meta{display:flex;align-items:center;justify-content:space-between;gap:var(--vp-space-3);padding:var(--vp-space-3) var(--vp-space-4);border-bottom:1px solid var(--vp-border-subtle);color:var(--vp-text-muted);font-size:var(--vp-text-sm);font-variant-numeric:tabular-nums}.vp-table__scroll{overflow-x:auto}.vp-table__table{width:100%;border-collapse:collapse;font-size:var(--vp-text-base)}.vp-table__table th{position:sticky;top:0;z-index:1;height:var(--vp-header-height);padding:0 var(--vp-space-3);text-align:left;white-space:nowrap;background:var(--vp-surface-raised);border-bottom:1px solid var(--vp-border-default);color:var(--vp-text-secondary);font-size:var(--vp-text-sm);font-weight:var(--vp-weight-semibold)}.vp-table__table td{height:var(--vp-row-height);padding:0 var(--vp-space-3);border-bottom:1px solid var(--vp-border-subtle);color:var(--vp-text-primary);font-variant-numeric:tabular-nums}.vp-table__table tbody tr:hover td{background:var(--vp-surface-sunken)}.vp-table__table tbody tr:last-child td{border-bottom:0}.vp-table__sort{display:inline-flex;align-items:center;gap:var(--vp-space-1);min-height:var(--vp-min-target);padding:0;border:0;background:transparent;color:inherit;font:inherit;cursor:pointer}.vp-table__sort:focus-visible{outline:var(--vp-focus-width) solid var(--vp-focus-ring);outline-offset:var(--vp-focus-offset)}.vp-table__sort-icon{color:var(--vp-text-muted)}.vp-table__empty,.vp-table__error{display:flex;flex-direction:column;align-items:center;gap:var(--vp-space-3);padding:var(--vp-space-12) var(--vp-space-6);text-align:center;color:var(--vp-text-secondary)}.vp-table__state-icon{width:40px;height:40px;color:var(--vp-text-muted)}.vp-table__error .vp-table__state-icon{color:var(--vp-sev-critical)}.vp-table__state-text{margin:0}.vp-table__retry{min-height:var(--vp-control-height);padding:0 var(--vp-space-4);border:1px solid var(--vp-border-default);border-radius:var(--vp-radius-md);background:var(--vp-surface-raised);color:var(--vp-text-primary);font:inherit;cursor:pointer}.vp-table__retry:focus-visible{outline:var(--vp-focus-width) solid var(--vp-focus-ring);outline-offset:var(--vp-focus-offset)}.vp-table__skeleton{display:flex;flex-direction:column;gap:1px;padding:var(--vp-space-2)}.vp-table__skeleton-row{display:block;height:var(--vp-row-height);border-radius:var(--vp-radius-sm);background:var(--vp-surface-sunken);animation:vp-table-pulse 1.4s var(--vp-ease-standard) infinite}@keyframes vp-table-pulse{0%,to{opacity:1}50%{opacity:.55}}.vp-table__pager{display:flex;justify-content:flex-end;gap:var(--vp-space-2);padding:var(--vp-space-3) var(--vp-space-4);border-top:1px solid var(--vp-border-subtle)}.vp-table__page-btn{min-height:var(--vp-control-height);min-width:var(--vp-min-target);padding:0 var(--vp-space-3);border:1px solid var(--vp-border-default);border-radius:var(--vp-radius-md);background:var(--vp-surface-raised);color:var(--vp-text-primary);font:inherit;cursor:pointer}.vp-table__page-btn:disabled{opacity:.5;cursor:not-allowed}.vp-table__page-btn:focus-visible{outline:var(--vp-focus-width) solid var(--vp-focus-ring);outline-offset:var(--vp-focus-offset)}@media(prefers-reduced-motion:reduce){.vp-table__skeleton-row{animation:none}}.vp-table__cols-btn{margin-left:auto;min-height:var(--vp-control-height);min-width:var(--vp-min-target);padding:0 var(--vp-space-3);border:1px solid var(--vp-border-default);border-radius:var(--vp-radius-md);background:var(--vp-surface-raised);color:var(--vp-text-primary);font:inherit;cursor:pointer}.vp-table__cols-btn:focus-visible{outline:var(--vp-focus-width) solid var(--vp-focus-ring);outline-offset:var(--vp-focus-offset)}.vp-table__cols{display:flex;flex-direction:column;gap:var(--vp-space-1);margin-bottom:var(--vp-space-3);padding:var(--vp-space-3);border:1px solid var(--vp-border-default);border-radius:var(--vp-radius-lg);background:var(--vp-surface-raised)}.vp-table__cols-row{display:flex;align-items:center;justify-content:space-between;gap:var(--vp-space-3)}.vp-table__cols-label{display:flex;align-items:center;gap:var(--vp-space-2);cursor:pointer}.vp-table__cols-move button{min-width:var(--vp-min-target);min-height:var(--vp-min-target);border:1px solid var(--vp-border-default);border-radius:var(--vp-radius-md);background:var(--vp-surface-default);color:var(--vp-text-primary);cursor:pointer}.vp-table__cols-move button:disabled{opacity:.4;cursor:not-allowed}.vp-table__cols-move button:focus-visible{outline:var(--vp-focus-width) solid var(--vp-focus-ring);outline-offset:var(--vp-focus-offset)}.vp-table__select-cell{width:var(--vp-min-target);text-align:center}.vp-table__bulk,.vp-table__bulk-confirm,.vp-table__bulk-report{display:flex;align-items:center;justify-content:space-between;gap:var(--vp-space-3);margin-bottom:var(--vp-space-3);padding:var(--vp-space-3);border:1px solid var(--vp-border-default);border-radius:var(--vp-radius-lg);background:var(--vp-surface-raised);font-size:var(--vp-text-sm)}.vp-table__bulk-report{display:block}.vp-table__bulk-confirm{border-color:var(--vp-danger)}.vp-table__bulk-actions{display:flex;gap:var(--vp-space-2)}.vp-table__bulk-btn{min-height:var(--vp-control-height);min-width:var(--vp-min-target);padding:0 var(--vp-space-3);border:1px solid var(--vp-border-default);border-radius:var(--vp-radius-md);background:var(--vp-surface-default);color:var(--vp-text-primary);font:inherit;cursor:pointer}.vp-table__bulk-btn:focus-visible{outline:var(--vp-focus-width) solid var(--vp-focus-ring);outline-offset:var(--vp-focus-offset)}.vp-table__bulk-btn--danger{border-color:var(--vp-danger);color:var(--vp-danger)}.vp-table__bulk-failures{margin:var(--vp-space-2) 0 0;padding-left:var(--vp-space-5)}.vp-table__expand{min-width:var(--vp-min-target);min-height:var(--vp-min-target);border:1px solid transparent;border-radius:var(--vp-radius-md);background:transparent;color:var(--vp-text-primary);cursor:pointer}.vp-table__expand:focus-visible{outline:var(--vp-focus-width) solid var(--vp-focus-ring);outline-offset:var(--vp-focus-offset)}.vp-table__detail-row>td{background:var(--vp-surface-raised);padding:var(--vp-space-4)}.vp-table__detail-empty{color:var(--vp-text-muted)}.vp-visually-hidden{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
4028
4045
  }
4029
4046
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.27", ngImport: i0, type: VpDataTableComponent, decorators: [{
4030
4047
  type: Component,
4031
- args: [{ selector: 'vp-data-table', standalone: true, imports: [NgTemplateOutlet], changeDetection: ChangeDetectionStrategy.OnPush, template: `
4032
- <div class="vp-table">
4033
- <div class="vp-table__meta">
4034
- <span class="vp-table__total" data-vp-total>
4035
- {{ total }} {{ totalLabel }}
4036
- </span>
4037
- @if (pageCount > 1) {
4038
- <span class="vp-table__pageinfo">{{ page }} / {{ pageCount }}</span>
4039
- }
4040
-
4041
- @if (savedViewsKey) {
4042
- <span class="vp-table__views" data-vp-views>
4043
- <select
4044
- class="vp-table__cols-btn"
4045
- data-vp-view-select
4046
- [attr.aria-label]="viewsLabel"
4047
- [value]="activeView"
4048
- (change)="applyView(asSelectValue($event))">
4049
- <option value="">{{ viewsPlaceholder }}</option>
4050
- @for (view of savedViews; track view.name) {
4051
- <option [value]="view.name">{{ view.name }}</option>
4052
- }
4053
- </select>
4054
-
4055
- <button type="button" class="vp-table__cols-btn" data-vp-view-save
4056
- (click)="saveViewPrompt()">{{ saveViewLabel }}</button>
4057
-
4058
- @if (activeView) {
4059
- <button type="button" class="vp-table__cols-btn" data-vp-view-delete
4060
- (click)="deleteActiveView()">{{ deleteViewLabel }}</button>
4061
- }
4062
- </span>
4063
- }
4064
-
4065
- @if (exportScopes.length > 0) {
4066
- @for (scope of exportScopes; track scope) {
4067
- <button
4068
- type="button"
4069
- class="vp-table__cols-btn"
4070
- [attr.data-vp-export]="scope"
4071
- (click)="requestExport(scope)">{{ exportLabel(scope) }}</button>
4072
- }
4073
- }
4074
-
4075
- @if (columnPicker) {
4076
- <button
4077
- type="button"
4078
- class="vp-table__cols-btn"
4079
- data-vp-cols-toggle
4080
- [attr.aria-expanded]="pickerOpen"
4081
- (click)="pickerOpen = !pickerOpen">{{ columnsLabel }}</button>
4082
- }
4083
- </div>
4084
-
4085
- @if (selectable && selectedKeys.size > 0) {
4086
- <div class="vp-table__bulk" data-vp-bulk role="group" [attr.aria-label]="bulkLabel">
4087
- <span data-vp-bulk-count>{{ selectedKeys.size }} {{ selectedLabel }}</span>
4088
-
4089
- <div class="vp-table__bulk-actions">
4090
- @for (action of bulkActions; track action.code) {
4091
- <button
4092
- type="button"
4093
- [attr.data-vp-bulk-action]="action.code"
4094
- [class.vp-table__bulk-btn--danger]="action.danger"
4095
- class="vp-table__bulk-btn"
4096
- (click)="requestBulkAction(action)">{{ action.label }}</button>
4097
- }
4098
- <button type="button" class="vp-table__bulk-btn" data-vp-bulk-clear
4099
- (click)="clearSelection()">{{ clearSelectionLabel }}</button>
4100
- </div>
4101
- </div>
4102
-
4103
- @if (pendingAction) {
4104
- <div class="vp-table__bulk-confirm" data-vp-bulk-confirm role="alertdialog"
4105
- [attr.aria-label]="pendingAction.label">
4106
- <span>{{ confirmPrefix }} {{ selectedKeys.size }} {{ selectedLabel }} — {{ pendingAction.label }}?</span>
4107
- <span class="vp-table__bulk-actions">
4108
- <button type="button" class="vp-table__bulk-btn" data-vp-bulk-cancel
4109
- (click)="pendingAction = null">{{ cancelLabel }}</button>
4110
- <button type="button" class="vp-table__bulk-btn vp-table__bulk-btn--danger"
4111
- data-vp-bulk-confirm-ok (click)="confirmBulkAction()">{{ confirmLabel }}</button>
4112
- </span>
4113
- </div>
4114
- }
4115
- }
4116
-
4117
- @if (bulkResult) {
4118
- <div class="vp-table__bulk-report" data-vp-bulk-report role="status" aria-live="polite">
4119
- @if (bulkResult.succeeded.length > 0) {
4120
- <p data-vp-bulk-ok>{{ bulkResult.succeeded.length }} {{ succeededLabel }}</p>
4121
- }
4122
- @if (bulkResult.failed.length > 0) {
4123
- <p data-vp-bulk-failed>{{ bulkResult.failed.length }} {{ failedLabel }}</p>
4124
- <ul class="vp-table__bulk-failures">
4125
- @for (failure of bulkResult.failed; track failure.key) {
4126
- <li [attr.data-vp-bulk-failure]="failure.key">
4127
- <code>{{ failure.key }}</code> — {{ failure.reason }}
4128
- </li>
4129
- }
4130
- </ul>
4131
- }
4132
- </div>
4133
- }
4134
-
4135
- @if (columnPicker && pickerOpen) {
4136
- <div class="vp-table__cols" data-vp-cols role="group" [attr.aria-label]="columnsLabel">
4137
- @for (col of orderedColumns; track col.field; let i = $index) {
4138
- <div class="vp-table__cols-row" [attr.data-vp-cols-row]="col.field">
4139
- <label class="vp-table__cols-label">
4140
- <input
4141
- type="checkbox"
4142
- [attr.data-vp-col-toggle]="col.field"
4143
- [checked]="isVisible(col.field)"
4144
- [disabled]="isVisible(col.field) && visibleCount === 1"
4145
- (change)="setColumnVisible(col.field, !isVisible(col.field))" />
4146
- {{ col.header }}
4147
- </label>
4148
- <span class="vp-table__cols-move">
4149
- <button
4150
- type="button"
4151
- [attr.data-vp-col-up]="col.field"
4152
- [attr.aria-label]="moveUpLabel + ': ' + col.header"
4153
- [disabled]="i === 0"
4154
- (click)="moveColumn(col.field, -1)">↑</button>
4155
- <button
4156
- type="button"
4157
- [attr.data-vp-col-down]="col.field"
4158
- [attr.aria-label]="moveDownLabel + ': ' + col.header"
4159
- [disabled]="i === orderedColumns.length - 1"
4160
- (click)="moveColumn(col.field, 1)">↓</button>
4161
- </span>
4162
- </div>
4163
- }
4164
- </div>
4165
- }
4166
-
4167
- @if (error) {
4168
- <div class="vp-table__error" data-vp-table-error role="alert">
4169
- <svg class="vp-table__state-icon" aria-hidden="true" viewBox="0 0 24 24" focusable="false">
4170
- <use href="#vp-icon-error"></use>
4171
- </svg>
4172
- <p class="vp-table__state-text">{{ error }}</p>
4173
- <button type="button" class="vp-table__retry" (click)="emitLoad()">{{ retryLabel }}</button>
4174
- </div>
4175
- } @else if (loading) {
4176
- <div class="vp-table__skeleton" data-vp-table-skeleton aria-hidden="true">
4177
- @for (i of skeletonRows; track i) {
4178
- <span class="vp-table__skeleton-row"></span>
4179
- }
4180
- </div>
4181
- <span class="vp-visually-hidden" role="status">{{ loadingLabel }}</span>
4182
- } @else if (rows.length === 0) {
4183
- @if (hasActiveFilter) {
4184
- <div class="vp-table__empty" data-vp-table-empty-filtered role="status">
4185
- <svg class="vp-table__state-icon" aria-hidden="true" viewBox="0 0 24 24" focusable="false">
4186
- <use href="#vp-icon-filter"></use>
4187
- </svg>
4188
- <p class="vp-table__state-text">{{ emptyFilteredLabel }}</p>
4189
- <button type="button" class="vp-table__retry" (click)="clearFilters.emit()">
4190
- {{ clearFiltersLabel }}
4191
- </button>
4192
- </div>
4193
- } @else {
4194
- <div class="vp-table__empty" data-vp-table-empty role="status">
4195
- <svg class="vp-table__state-icon" aria-hidden="true" viewBox="0 0 24 24" focusable="false">
4196
- <use href="#vp-icon-empty"></use>
4197
- </svg>
4198
- <p class="vp-table__state-text">{{ emptyLabel }}</p>
4199
- </div>
4200
- }
4201
- } @else {
4202
- <div class="vp-table__scroll">
4203
- <table class="vp-table__table" [attr.aria-label]="caption">
4204
- <thead>
4205
- <tr>
4206
- @if (expandable) {
4207
- <th scope="col" class="vp-table__select-cell">
4208
- <span class="vp-visually-hidden">{{ expandColumnLabel }}</span>
4209
- </th>
4210
- }
4211
- @if (selectable) {
4212
- <th scope="col" class="vp-table__select-cell">
4213
- <input
4214
- type="checkbox"
4215
- data-vp-select-page
4216
- [attr.aria-label]="selectPageLabel"
4217
- [checked]="allOnPageSelected"
4218
- [indeterminate]="someOnPageSelected"
4219
- (change)="togglePageSelection()" />
4220
- </th>
4221
- }
4222
- @for (col of visibleCols; track col.field) {
4223
- <th
4224
- scope="col"
4225
- [attr.data-vp-col]="col.field"
4226
- [attr.aria-sort]="ariaSort(col)"
4227
- [style.width]="col.width || null">
4228
- @if (col.sortable) {
4229
- <button type="button" class="vp-table__sort" (click)="toggleSort(col.field)">
4230
- {{ col.header }}
4231
- <span class="vp-table__sort-icon" aria-hidden="true">{{ sortGlyph(col.field) }}</span>
4232
- </button>
4233
- } @else {
4234
- {{ col.header }}
4235
- }
4236
- </th>
4237
- }
4238
- @if (rowActions) {
4239
- <th scope="col" class="vp-table__actions-header">{{ rowActionsHeader }}</th>
4240
- }
4241
- </tr>
4242
- </thead>
4243
- <tbody>
4244
- @for (row of rows; track $index) {
4245
- <tr data-vp-row>
4246
- @if (expandable) {
4247
- <td class="vp-table__select-cell">
4248
- <button
4249
- type="button"
4250
- class="vp-table__expand"
4251
- [attr.data-vp-expand]="keyOf(row)"
4252
- [attr.aria-expanded]="isExpanded(row)"
4253
- [attr.aria-label]="isExpanded(row) ? collapseLabel : expandLabel"
4254
- (click)="toggleExpanded(row)">{{ isExpanded(row) ? '▾' : '▸' }}</button>
4255
- </td>
4256
- }
4257
- @if (selectable) {
4258
- <td class="vp-table__select-cell">
4259
- <input
4260
- type="checkbox"
4261
- [attr.data-vp-select-row]="keyOf(row)"
4262
- [attr.aria-label]="selectRowLabel"
4263
- [checked]="isSelected(row)"
4264
- (change)="toggleRow(row)" />
4265
- </td>
4266
- }
4267
- @for (col of visibleCols; track col.field) {
4268
- <td>{{ cell(row, col.field) }}</td>
4269
- }
4270
- @if (rowActions) {
4271
- <td data-vp-row-actions>
4272
- <ng-container *ngTemplateOutlet="rowActions; context: { $implicit: row }" />
4273
- </td>
4274
- }
4275
- </tr>
4276
-
4277
- @if (expandable && isExpanded(row)) {
4278
- <tr class="vp-table__detail-row" [attr.data-vp-detail]="keyOf(row)">
4279
- <td [attr.colspan]="columnSpan">
4280
- @if (rowDetail) {
4281
- <ng-container *ngTemplateOutlet="rowDetail; context: { $implicit: row }" />
4282
- } @else {
4283
- <span class="vp-table__detail-empty">{{ noDetailLabel }}</span>
4284
- }
4285
- </td>
4286
- </tr>
4287
- }
4288
- }
4289
- </tbody>
4290
- </table>
4291
- </div>
4292
-
4293
- @if (pageCount > 1) {
4294
- <nav class="vp-table__pager" [attr.aria-label]="pagerLabel">
4295
- <button
4296
- type="button"
4297
- class="vp-table__page-btn"
4298
- [disabled]="page <= 1"
4299
- (click)="goToPage(page - 1)">{{ prevLabel }}</button>
4300
- <button
4301
- type="button"
4302
- class="vp-table__page-btn"
4303
- [disabled]="page >= pageCount"
4304
- (click)="goToPage(page + 1)">{{ nextLabel }}</button>
4305
- </nav>
4306
- }
4307
- }
4308
- </div>
4048
+ args: [{ selector: 'vp-data-table', standalone: true, imports: [NgTemplateOutlet], changeDetection: ChangeDetectionStrategy.OnPush, template: `
4049
+ <div class="vp-table">
4050
+ <div class="vp-table__meta">
4051
+ <span class="vp-table__total" data-vp-total>
4052
+ {{ total }} {{ totalLabel }}
4053
+ </span>
4054
+ @if (pageCount > 1) {
4055
+ <span class="vp-table__pageinfo">{{ page }} / {{ pageCount }}</span>
4056
+ }
4057
+
4058
+ @if (savedViewsKey) {
4059
+ <span class="vp-table__views" data-vp-views>
4060
+ <select
4061
+ class="vp-table__cols-btn"
4062
+ data-vp-view-select
4063
+ [attr.aria-label]="viewsLabel"
4064
+ [value]="activeView"
4065
+ (change)="applyView(asSelectValue($event))">
4066
+ <option value="">{{ viewsPlaceholder }}</option>
4067
+ @for (view of savedViews; track view.name) {
4068
+ <option [value]="view.name">{{ view.name }}</option>
4069
+ }
4070
+ </select>
4071
+
4072
+ <button type="button" class="vp-table__cols-btn" data-vp-view-save
4073
+ (click)="saveViewPrompt()">{{ saveViewLabel }}</button>
4074
+
4075
+ @if (activeView) {
4076
+ <button type="button" class="vp-table__cols-btn" data-vp-view-delete
4077
+ (click)="deleteActiveView()">{{ deleteViewLabel }}</button>
4078
+ }
4079
+ </span>
4080
+ }
4081
+
4082
+ @if (exportScopes.length > 0) {
4083
+ @for (scope of exportScopes; track scope) {
4084
+ <button
4085
+ type="button"
4086
+ class="vp-table__cols-btn"
4087
+ [attr.data-vp-export]="scope"
4088
+ (click)="requestExport(scope)">{{ exportLabel(scope) }}</button>
4089
+ }
4090
+ }
4091
+
4092
+ @if (columnPicker) {
4093
+ <button
4094
+ type="button"
4095
+ class="vp-table__cols-btn"
4096
+ data-vp-cols-toggle
4097
+ [attr.aria-expanded]="pickerOpen"
4098
+ (click)="pickerOpen = !pickerOpen">{{ columnsLabel }}</button>
4099
+ }
4100
+ </div>
4101
+
4102
+ @if (selectable && selectedKeys.size > 0) {
4103
+ <div class="vp-table__bulk" data-vp-bulk role="group" [attr.aria-label]="bulkLabel">
4104
+ <span data-vp-bulk-count>{{ selectedKeys.size }} {{ selectedLabel }}</span>
4105
+
4106
+ <div class="vp-table__bulk-actions">
4107
+ @for (action of bulkActions; track action.code) {
4108
+ <button
4109
+ type="button"
4110
+ [attr.data-vp-bulk-action]="action.code"
4111
+ [class.vp-table__bulk-btn--danger]="action.danger"
4112
+ class="vp-table__bulk-btn"
4113
+ (click)="requestBulkAction(action)">{{ action.label }}</button>
4114
+ }
4115
+ <button type="button" class="vp-table__bulk-btn" data-vp-bulk-clear
4116
+ (click)="clearSelection()">{{ clearSelectionLabel }}</button>
4117
+ </div>
4118
+ </div>
4119
+
4120
+ @if (pendingAction) {
4121
+ <div class="vp-table__bulk-confirm" data-vp-bulk-confirm role="alertdialog"
4122
+ [attr.aria-label]="pendingAction.label">
4123
+ <span>{{ confirmPrefix }} {{ selectedKeys.size }} {{ selectedLabel }} — {{ pendingAction.label }}?</span>
4124
+ <span class="vp-table__bulk-actions">
4125
+ <button type="button" class="vp-table__bulk-btn" data-vp-bulk-cancel
4126
+ (click)="pendingAction = null">{{ cancelLabel }}</button>
4127
+ <button type="button" class="vp-table__bulk-btn vp-table__bulk-btn--danger"
4128
+ data-vp-bulk-confirm-ok (click)="confirmBulkAction()">{{ confirmLabel }}</button>
4129
+ </span>
4130
+ </div>
4131
+ }
4132
+ }
4133
+
4134
+ @if (bulkResult) {
4135
+ <div class="vp-table__bulk-report" data-vp-bulk-report role="status" aria-live="polite">
4136
+ @if (bulkResult.succeeded.length > 0) {
4137
+ <p data-vp-bulk-ok>{{ bulkResult.succeeded.length }} {{ succeededLabel }}</p>
4138
+ }
4139
+ @if (bulkResult.failed.length > 0) {
4140
+ <p data-vp-bulk-failed>{{ bulkResult.failed.length }} {{ failedLabel }}</p>
4141
+ <ul class="vp-table__bulk-failures">
4142
+ @for (failure of bulkResult.failed; track failure.key) {
4143
+ <li [attr.data-vp-bulk-failure]="failure.key">
4144
+ <code>{{ failure.key }}</code> — {{ failure.reason }}
4145
+ </li>
4146
+ }
4147
+ </ul>
4148
+ }
4149
+ </div>
4150
+ }
4151
+
4152
+ @if (columnPicker && pickerOpen) {
4153
+ <div class="vp-table__cols" data-vp-cols role="group" [attr.aria-label]="columnsLabel">
4154
+ @for (col of orderedColumns; track col.field; let i = $index) {
4155
+ <div class="vp-table__cols-row" [attr.data-vp-cols-row]="col.field">
4156
+ <label class="vp-table__cols-label">
4157
+ <input
4158
+ type="checkbox"
4159
+ [attr.data-vp-col-toggle]="col.field"
4160
+ [checked]="isVisible(col.field)"
4161
+ [disabled]="isVisible(col.field) && visibleCount === 1"
4162
+ (change)="setColumnVisible(col.field, !isVisible(col.field))" />
4163
+ {{ col.header }}
4164
+ </label>
4165
+ <span class="vp-table__cols-move">
4166
+ <button
4167
+ type="button"
4168
+ [attr.data-vp-col-up]="col.field"
4169
+ [attr.aria-label]="moveUpLabel + ': ' + col.header"
4170
+ [disabled]="i === 0"
4171
+ (click)="moveColumn(col.field, -1)">↑</button>
4172
+ <button
4173
+ type="button"
4174
+ [attr.data-vp-col-down]="col.field"
4175
+ [attr.aria-label]="moveDownLabel + ': ' + col.header"
4176
+ [disabled]="i === orderedColumns.length - 1"
4177
+ (click)="moveColumn(col.field, 1)">↓</button>
4178
+ </span>
4179
+ </div>
4180
+ }
4181
+ </div>
4182
+ }
4183
+
4184
+ @if (error) {
4185
+ <div class="vp-table__error" data-vp-table-error role="alert">
4186
+ <svg class="vp-table__state-icon" aria-hidden="true" viewBox="0 0 24 24" focusable="false">
4187
+ <use href="#vp-icon-error"></use>
4188
+ </svg>
4189
+ <p class="vp-table__state-text">{{ error }}</p>
4190
+ <button type="button" class="vp-table__retry" (click)="emitLoad()">{{ retryLabel }}</button>
4191
+ </div>
4192
+ } @else if (loading) {
4193
+ <div class="vp-table__skeleton" data-vp-table-skeleton aria-hidden="true">
4194
+ @for (i of skeletonRows; track i) {
4195
+ <span class="vp-table__skeleton-row"></span>
4196
+ }
4197
+ </div>
4198
+ <span class="vp-visually-hidden" role="status">{{ loadingLabel }}</span>
4199
+ } @else if (rows.length === 0) {
4200
+ @if (hasActiveFilter) {
4201
+ <div class="vp-table__empty" data-vp-table-empty-filtered role="status">
4202
+ <svg class="vp-table__state-icon" aria-hidden="true" viewBox="0 0 24 24" focusable="false">
4203
+ <use href="#vp-icon-filter"></use>
4204
+ </svg>
4205
+ <p class="vp-table__state-text">{{ emptyFilteredLabel }}</p>
4206
+ <button type="button" class="vp-table__retry" (click)="clearFilters.emit()">
4207
+ {{ clearFiltersLabel }}
4208
+ </button>
4209
+ </div>
4210
+ } @else {
4211
+ <div class="vp-table__empty" data-vp-table-empty role="status">
4212
+ <svg class="vp-table__state-icon" aria-hidden="true" viewBox="0 0 24 24" focusable="false">
4213
+ <use href="#vp-icon-empty"></use>
4214
+ </svg>
4215
+ <p class="vp-table__state-text">{{ emptyLabel }}</p>
4216
+ </div>
4217
+ }
4218
+ } @else {
4219
+ <div class="vp-table__scroll">
4220
+ <table class="vp-table__table" [attr.aria-label]="caption">
4221
+ <thead>
4222
+ <tr>
4223
+ @if (canExpand) {
4224
+ <th scope="col" class="vp-table__select-cell">
4225
+ <span class="vp-visually-hidden">{{ expandColumnLabel }}</span>
4226
+ </th>
4227
+ }
4228
+ @if (selectable) {
4229
+ <th scope="col" class="vp-table__select-cell">
4230
+ <input
4231
+ type="checkbox"
4232
+ data-vp-select-page
4233
+ [attr.aria-label]="selectPageLabel"
4234
+ [checked]="allOnPageSelected"
4235
+ [indeterminate]="someOnPageSelected"
4236
+ (change)="togglePageSelection()" />
4237
+ </th>
4238
+ }
4239
+ @for (col of visibleCols; track col.field) {
4240
+ <th
4241
+ scope="col"
4242
+ [attr.data-vp-col]="col.field"
4243
+ [attr.aria-sort]="ariaSort(col)"
4244
+ [style.width]="col.width || null">
4245
+ @if (col.sortable) {
4246
+ <button type="button" class="vp-table__sort" (click)="toggleSort(col.field)">
4247
+ {{ col.header }}
4248
+ <span class="vp-table__sort-icon" aria-hidden="true">{{ sortGlyph(col.field) }}</span>
4249
+ </button>
4250
+ } @else {
4251
+ {{ col.header }}
4252
+ }
4253
+ </th>
4254
+ }
4255
+ @if (rowActions) {
4256
+ <th scope="col" class="vp-table__actions-header">{{ rowActionsHeader }}</th>
4257
+ }
4258
+ </tr>
4259
+ </thead>
4260
+ <tbody>
4261
+ @for (row of rows; track $index) {
4262
+ <tr data-vp-row>
4263
+ @if (canExpand) {
4264
+ <td class="vp-table__select-cell">
4265
+ <button
4266
+ type="button"
4267
+ class="vp-table__expand"
4268
+ [attr.data-vp-expand]="keyOf(row)"
4269
+ [attr.aria-expanded]="isExpanded(row)"
4270
+ [attr.aria-label]="isExpanded(row) ? collapseLabel : expandLabel"
4271
+ (click)="toggleExpanded(row)">{{ isExpanded(row) ? '▾' : '▸' }}</button>
4272
+ </td>
4273
+ }
4274
+ @if (selectable) {
4275
+ <td class="vp-table__select-cell">
4276
+ <input
4277
+ type="checkbox"
4278
+ [attr.data-vp-select-row]="keyOf(row)"
4279
+ [attr.aria-label]="selectRowLabel"
4280
+ [checked]="isSelected(row)"
4281
+ (change)="toggleRow(row)" />
4282
+ </td>
4283
+ }
4284
+ @for (col of visibleCols; track col.field) {
4285
+ <td>{{ cell(row, col.field) }}</td>
4286
+ }
4287
+ @if (rowActions) {
4288
+ <td data-vp-row-actions>
4289
+ <ng-container *ngTemplateOutlet="rowActions; context: { $implicit: row }" />
4290
+ </td>
4291
+ }
4292
+ </tr>
4293
+
4294
+ @if (canExpand && isExpanded(row)) {
4295
+ <tr class="vp-table__detail-row" [attr.data-vp-detail]="keyOf(row)">
4296
+ <td [attr.colspan]="columnSpan">
4297
+ @if (rowDetail) {
4298
+ <ng-container *ngTemplateOutlet="rowDetail; context: { $implicit: row }" />
4299
+ } @else {
4300
+ <span class="vp-table__detail-empty">{{ noDetailLabel }}</span>
4301
+ }
4302
+ </td>
4303
+ </tr>
4304
+ }
4305
+ }
4306
+ </tbody>
4307
+ </table>
4308
+ </div>
4309
+
4310
+ @if (pageCount > 1) {
4311
+ <nav class="vp-table__pager" [attr.aria-label]="pagerLabel">
4312
+ <button
4313
+ type="button"
4314
+ class="vp-table__page-btn"
4315
+ [disabled]="page <= 1"
4316
+ (click)="goToPage(page - 1)">{{ prevLabel }}</button>
4317
+ <button
4318
+ type="button"
4319
+ class="vp-table__page-btn"
4320
+ [disabled]="page >= pageCount"
4321
+ (click)="goToPage(page + 1)">{{ nextLabel }}</button>
4322
+ </nav>
4323
+ }
4324
+ }
4325
+ </div>
4309
4326
  `, styles: [":host{display:block}.vp-table{border:1px solid var(--vp-border-subtle);border-radius:var(--vp-radius-lg);background:var(--vp-surface-raised);overflow:hidden}.vp-table__meta{display:flex;align-items:center;justify-content:space-between;gap:var(--vp-space-3);padding:var(--vp-space-3) var(--vp-space-4);border-bottom:1px solid var(--vp-border-subtle);color:var(--vp-text-muted);font-size:var(--vp-text-sm);font-variant-numeric:tabular-nums}.vp-table__scroll{overflow-x:auto}.vp-table__table{width:100%;border-collapse:collapse;font-size:var(--vp-text-base)}.vp-table__table th{position:sticky;top:0;z-index:1;height:var(--vp-header-height);padding:0 var(--vp-space-3);text-align:left;white-space:nowrap;background:var(--vp-surface-raised);border-bottom:1px solid var(--vp-border-default);color:var(--vp-text-secondary);font-size:var(--vp-text-sm);font-weight:var(--vp-weight-semibold)}.vp-table__table td{height:var(--vp-row-height);padding:0 var(--vp-space-3);border-bottom:1px solid var(--vp-border-subtle);color:var(--vp-text-primary);font-variant-numeric:tabular-nums}.vp-table__table tbody tr:hover td{background:var(--vp-surface-sunken)}.vp-table__table tbody tr:last-child td{border-bottom:0}.vp-table__sort{display:inline-flex;align-items:center;gap:var(--vp-space-1);min-height:var(--vp-min-target);padding:0;border:0;background:transparent;color:inherit;font:inherit;cursor:pointer}.vp-table__sort:focus-visible{outline:var(--vp-focus-width) solid var(--vp-focus-ring);outline-offset:var(--vp-focus-offset)}.vp-table__sort-icon{color:var(--vp-text-muted)}.vp-table__empty,.vp-table__error{display:flex;flex-direction:column;align-items:center;gap:var(--vp-space-3);padding:var(--vp-space-12) var(--vp-space-6);text-align:center;color:var(--vp-text-secondary)}.vp-table__state-icon{width:40px;height:40px;color:var(--vp-text-muted)}.vp-table__error .vp-table__state-icon{color:var(--vp-sev-critical)}.vp-table__state-text{margin:0}.vp-table__retry{min-height:var(--vp-control-height);padding:0 var(--vp-space-4);border:1px solid var(--vp-border-default);border-radius:var(--vp-radius-md);background:var(--vp-surface-raised);color:var(--vp-text-primary);font:inherit;cursor:pointer}.vp-table__retry:focus-visible{outline:var(--vp-focus-width) solid var(--vp-focus-ring);outline-offset:var(--vp-focus-offset)}.vp-table__skeleton{display:flex;flex-direction:column;gap:1px;padding:var(--vp-space-2)}.vp-table__skeleton-row{display:block;height:var(--vp-row-height);border-radius:var(--vp-radius-sm);background:var(--vp-surface-sunken);animation:vp-table-pulse 1.4s var(--vp-ease-standard) infinite}@keyframes vp-table-pulse{0%,to{opacity:1}50%{opacity:.55}}.vp-table__pager{display:flex;justify-content:flex-end;gap:var(--vp-space-2);padding:var(--vp-space-3) var(--vp-space-4);border-top:1px solid var(--vp-border-subtle)}.vp-table__page-btn{min-height:var(--vp-control-height);min-width:var(--vp-min-target);padding:0 var(--vp-space-3);border:1px solid var(--vp-border-default);border-radius:var(--vp-radius-md);background:var(--vp-surface-raised);color:var(--vp-text-primary);font:inherit;cursor:pointer}.vp-table__page-btn:disabled{opacity:.5;cursor:not-allowed}.vp-table__page-btn:focus-visible{outline:var(--vp-focus-width) solid var(--vp-focus-ring);outline-offset:var(--vp-focus-offset)}@media(prefers-reduced-motion:reduce){.vp-table__skeleton-row{animation:none}}.vp-table__cols-btn{margin-left:auto;min-height:var(--vp-control-height);min-width:var(--vp-min-target);padding:0 var(--vp-space-3);border:1px solid var(--vp-border-default);border-radius:var(--vp-radius-md);background:var(--vp-surface-raised);color:var(--vp-text-primary);font:inherit;cursor:pointer}.vp-table__cols-btn:focus-visible{outline:var(--vp-focus-width) solid var(--vp-focus-ring);outline-offset:var(--vp-focus-offset)}.vp-table__cols{display:flex;flex-direction:column;gap:var(--vp-space-1);margin-bottom:var(--vp-space-3);padding:var(--vp-space-3);border:1px solid var(--vp-border-default);border-radius:var(--vp-radius-lg);background:var(--vp-surface-raised)}.vp-table__cols-row{display:flex;align-items:center;justify-content:space-between;gap:var(--vp-space-3)}.vp-table__cols-label{display:flex;align-items:center;gap:var(--vp-space-2);cursor:pointer}.vp-table__cols-move button{min-width:var(--vp-min-target);min-height:var(--vp-min-target);border:1px solid var(--vp-border-default);border-radius:var(--vp-radius-md);background:var(--vp-surface-default);color:var(--vp-text-primary);cursor:pointer}.vp-table__cols-move button:disabled{opacity:.4;cursor:not-allowed}.vp-table__cols-move button:focus-visible{outline:var(--vp-focus-width) solid var(--vp-focus-ring);outline-offset:var(--vp-focus-offset)}.vp-table__select-cell{width:var(--vp-min-target);text-align:center}.vp-table__bulk,.vp-table__bulk-confirm,.vp-table__bulk-report{display:flex;align-items:center;justify-content:space-between;gap:var(--vp-space-3);margin-bottom:var(--vp-space-3);padding:var(--vp-space-3);border:1px solid var(--vp-border-default);border-radius:var(--vp-radius-lg);background:var(--vp-surface-raised);font-size:var(--vp-text-sm)}.vp-table__bulk-report{display:block}.vp-table__bulk-confirm{border-color:var(--vp-danger)}.vp-table__bulk-actions{display:flex;gap:var(--vp-space-2)}.vp-table__bulk-btn{min-height:var(--vp-control-height);min-width:var(--vp-min-target);padding:0 var(--vp-space-3);border:1px solid var(--vp-border-default);border-radius:var(--vp-radius-md);background:var(--vp-surface-default);color:var(--vp-text-primary);font:inherit;cursor:pointer}.vp-table__bulk-btn:focus-visible{outline:var(--vp-focus-width) solid var(--vp-focus-ring);outline-offset:var(--vp-focus-offset)}.vp-table__bulk-btn--danger{border-color:var(--vp-danger);color:var(--vp-danger)}.vp-table__bulk-failures{margin:var(--vp-space-2) 0 0;padding-left:var(--vp-space-5)}.vp-table__expand{min-width:var(--vp-min-target);min-height:var(--vp-min-target);border:1px solid transparent;border-radius:var(--vp-radius-md);background:transparent;color:var(--vp-text-primary);cursor:pointer}.vp-table__expand:focus-visible{outline:var(--vp-focus-width) solid var(--vp-focus-ring);outline-offset:var(--vp-focus-offset)}.vp-table__detail-row>td{background:var(--vp-surface-raised);padding:var(--vp-space-4)}.vp-table__detail-empty{color:var(--vp-text-muted)}.vp-visually-hidden{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}\n"] }]
4310
4327
  }], propDecorators: { columns: [{
4311
4328
  type: Input,