@egose/shadcn-theme-ng-tw 0.6.0 → 0.6.2
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/README.md +119 -1
- package/autocomplete/fesm2022/autocomplete.mjs +14 -4
- package/autocomplete/types/autocomplete.d.ts +4 -1
- package/checkbox/README.md +6 -2
- package/checkbox/fesm2022/checkbox.mjs +15 -9
- package/checkbox/types/checkbox.d.ts +6 -4
- package/combobox/fesm2022/combobox.mjs +22 -6
- package/combobox/types/combobox.d.ts +8 -2
- package/data-table/README.md +11 -1
- package/data-table/fesm2022/data-table.mjs +76 -26
- package/data-table/types/data-table.d.ts +25 -6
- package/date-picker/README.md +41 -9
- package/date-picker/fesm2022/date-picker.mjs +265 -59
- package/date-picker/types/date-picker.d.ts +58 -27
- package/form-autocomplete/README.md +4 -2
- package/form-autocomplete/fesm2022/form-autocomplete.mjs +33 -8
- package/form-autocomplete/types/form-autocomplete.d.ts +9 -3
- package/form-combobox/README.md +4 -2
- package/form-combobox/fesm2022/form-combobox.mjs +65 -14
- package/form-combobox/types/form-combobox.d.ts +10 -3
- package/form-input-otp/README.md +7 -5
- package/form-input-otp/fesm2022/form-input-otp.mjs +28 -14
- package/form-input-otp/types/form-input-otp.d.ts +9 -3
- package/form-searchable-multiselect/README.md +15 -1
- package/form-searchable-multiselect/fesm2022/form-searchable-multiselect.mjs +23 -3
- package/form-searchable-multiselect/types/form-searchable-multiselect.d.ts +9 -1
- package/form-slider/README.md +3 -1
- package/form-slider/fesm2022/form-slider.mjs +21 -6
- package/form-slider/types/form-slider.d.ts +9 -3
- package/form-toggle/README.md +22 -18
- package/form-toggle/fesm2022/form-toggle.mjs +25 -8
- package/form-toggle/types/form-toggle.d.ts +6 -2
- package/input-otp/README.md +33 -9
- package/input-otp/fesm2022/input-otp.mjs +127 -11
- package/input-otp/types/input-otp.d.ts +24 -4
- package/package.json +1 -1
- package/pagination/README.md +21 -12
- package/pagination/fesm2022/pagination.mjs +83 -75
- package/pagination/types/pagination.d.ts +21 -8
- package/phone-input/README.md +16 -0
- package/phone-input/fesm2022/phone-input.mjs +41 -3
- package/phone-input/types/phone-input.d.ts +5 -2
- package/searchable-multiselect/README.md +62 -40
- package/searchable-multiselect/fesm2022/searchable-multiselect.mjs +97 -36
- package/searchable-multiselect/types/searchable-multiselect.d.ts +23 -6
- package/slider/fesm2022/slider.mjs +15 -5
- package/slider/types/slider.d.ts +6 -2
- package/stepper/README.md +39 -19
- package/stepper/fesm2022/stepper.mjs +71 -17
- package/stepper/types/stepper.d.ts +12 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { input, computed, ChangeDetectionStrategy, Component, model, output, signal, linkedSignal, effect, NgModule } from '@angular/core';
|
|
2
|
+
import { input, computed, ChangeDetectionStrategy, Component, model, output, signal, linkedSignal, effect, untracked, NgModule } from '@angular/core';
|
|
3
3
|
import { NgTemplateOutlet } from '@angular/common';
|
|
4
4
|
import { HlmButton } from '@egose/shadcn-theme-ng-tw/button';
|
|
5
5
|
import { HlmCard, HlmCardContent } from '@egose/shadcn-theme-ng-tw/card';
|
|
@@ -368,7 +368,7 @@ class EgDataTableViewOptions {
|
|
|
368
368
|
type="button"
|
|
369
369
|
[hlmDropdownMenuTrigger]="_menu"
|
|
370
370
|
>
|
|
371
|
-
<ng-icon hlm name="lucideSettings2" />
|
|
371
|
+
<ng-icon hlm size="sm" name="lucideSettings2" />
|
|
372
372
|
View
|
|
373
373
|
</button>
|
|
374
374
|
<ng-template #_menu>
|
|
@@ -406,7 +406,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
|
|
|
406
406
|
type="button"
|
|
407
407
|
[hlmDropdownMenuTrigger]="_menu"
|
|
408
408
|
>
|
|
409
|
-
<ng-icon hlm name="lucideSettings2" />
|
|
409
|
+
<ng-icon hlm size="sm" name="lucideSettings2" />
|
|
410
410
|
View
|
|
411
411
|
</button>
|
|
412
412
|
<ng-template #_menu>
|
|
@@ -518,6 +518,16 @@ class EgDataTable {
|
|
|
518
518
|
/** Client rows, or a server page slice when `manualPagination` is set (`null` while loading). */
|
|
519
519
|
data = input([], /* @ts-ignore */
|
|
520
520
|
...(ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []));
|
|
521
|
+
/**
|
|
522
|
+
* Pure stable identity callback, e.g. `(record) => record.id`. Return a unique
|
|
523
|
+
* string per entity, independent of position, and keep the callback reference stable.
|
|
524
|
+
* Selection survives refreshes only for IDs still in the supplied rows (after
|
|
525
|
+
* `filterRows`); server selection is limited to the loaded slice. Without this
|
|
526
|
+
* callback, IDs are positional and replacing the rows clears selection.
|
|
527
|
+
* Changing the callback clears selection. Update data immutably.
|
|
528
|
+
*/
|
|
529
|
+
getRowId = input(/* @ts-ignore */
|
|
530
|
+
...(ngDevMode ? [undefined, { debugName: "getRowId" }] : /* istanbul ignore next */ []));
|
|
521
531
|
/** When true, `data` is a server page slice and the table uses TanStack `manualPagination`. Sorting and filtering are then display-only: the slice is shown as-is while `sortingChange` / `filterChange` (`columnFiltersChange`) notify the caller to refetch. */
|
|
522
532
|
manualPagination = input(false, /* @ts-ignore */
|
|
523
533
|
...(ngDevMode ? [{ debugName: "manualPagination" }] : /* istanbul ignore next */ []));
|
|
@@ -550,7 +560,7 @@ class EgDataTable {
|
|
|
550
560
|
...(ngDevMode ? [{ debugName: "filterColumnId" }] : /* istanbul ignore next */ []));
|
|
551
561
|
filterPlaceholder = input('Filter...', /* @ts-ignore */
|
|
552
562
|
...(ngDevMode ? [{ debugName: "filterPlaceholder" }] : /* istanbul ignore next */ []));
|
|
553
|
-
/** Show the column-visibility dropdown inside the toolbar. Off by default; opt in per table. */
|
|
563
|
+
/** Show the column-visibility dropdown inside the toolbar (requires `showToolbar`). Off by default; opt in per table. Also enables hiding — the `Hide` item in `EgDataTableColumnHeader` only renders when this is true, so hidden columns always have a way back. Per-column `enableHiding: false` further disables individual columns. */
|
|
554
564
|
showColumnToggle = input(false, /* @ts-ignore */
|
|
555
565
|
...(ngDevMode ? [{ debugName: "showColumnToggle" }] : /* istanbul ignore next */ []));
|
|
556
566
|
/** Custom right-side toolbar content (e.g. action buttons) as a template. Renders the toolbar row even when `showToolbar` is false; built-ins stay on the left. */
|
|
@@ -571,7 +581,7 @@ class EgDataTable {
|
|
|
571
581
|
/** Seeds the column-visibility state once at creation. Later changes are ignored. */
|
|
572
582
|
initialColumnVisibility = input({}, /* @ts-ignore */
|
|
573
583
|
...(ngDevMode ? [{ debugName: "initialColumnVisibility" }] : /* istanbul ignore next */ []));
|
|
574
|
-
/** Seeds
|
|
584
|
+
/** Seeds selection once for current rows: keys come from `getRowId`, or positional indices without it. Missing IDs are discarded. Later changes are ignored. */
|
|
575
585
|
initialRowSelection = input({}, /* @ts-ignore */
|
|
576
586
|
...(ngDevMode ? [{ debugName: "initialRowSelection" }] : /* istanbul ignore next */ []));
|
|
577
587
|
/** Show the rows-per-page selector in the footer pager. */
|
|
@@ -584,7 +594,7 @@ class EgDataTable {
|
|
|
584
594
|
navMode = input('icons', /* @ts-ignore */
|
|
585
595
|
...(ngDevMode ? [{ debugName: "navMode" }] : /* istanbul ignore next */ []));
|
|
586
596
|
userClass = input('', { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: 'class' });
|
|
587
|
-
/** Emits
|
|
597
|
+
/** Emits on init and when selected row identities/order or object references change. Includes rows hidden by built-in filters/client pagination, but never rows absent from `data`/`filterRows`. */
|
|
588
598
|
selectionChange = output();
|
|
589
599
|
/** Emits the target page index on pager navigation (primary hook for server fetching). */
|
|
590
600
|
pageChange = output();
|
|
@@ -607,8 +617,6 @@ class EgDataTable {
|
|
|
607
617
|
...(ngDevMode ? [{ debugName: "_columnFilters" }] : /* istanbul ignore next */ []));
|
|
608
618
|
_columnVisibility = signal({}, /* @ts-ignore */
|
|
609
619
|
...(ngDevMode ? [{ debugName: "_columnVisibility" }] : /* istanbul ignore next */ []));
|
|
610
|
-
_rowSelection = signal({}, /* @ts-ignore */
|
|
611
|
-
...(ngDevMode ? [{ debugName: "_rowSelection" }] : /* istanbul ignore next */ []));
|
|
612
620
|
_clientPageIndex = signal(0, /* @ts-ignore */
|
|
613
621
|
...(ngDevMode ? [{ debugName: "_clientPageIndex" }] : /* istanbul ignore next */ []));
|
|
614
622
|
// Linked so the bound `defaultPageSize` applies once inputs are set, while
|
|
@@ -640,6 +648,32 @@ class EgDataTable {
|
|
|
640
648
|
return filter ? filter(rows) : rows;
|
|
641
649
|
}, /* @ts-ignore */
|
|
642
650
|
...(ngDevMode ? [{ debugName: "_items" }] : /* istanbul ignore next */ []));
|
|
651
|
+
// TanStack uses data-reference changes to reset pagination. State/layout
|
|
652
|
+
// updates must not look like a new data set (including selecting page rows).
|
|
653
|
+
_tableItems = computed(() => {
|
|
654
|
+
// A different identity function must also rebuild TanStack's cached rows.
|
|
655
|
+
this.getRowId();
|
|
656
|
+
return [...this._items()];
|
|
657
|
+
}, /* @ts-ignore */
|
|
658
|
+
...(ngDevMode ? [{ debugName: "_tableItems" }] : /* istanbul ignore next */ []));
|
|
659
|
+
// Reconcile synchronously with the data source, before either TanStack or the
|
|
660
|
+
// output can observe old positional keys against new records. An effect-based
|
|
661
|
+
// reset would permit a transient wrong-entity selection.
|
|
662
|
+
_rowSelection = linkedSignal({ ...(ngDevMode ? { debugName: "_rowSelection" } : /* istanbul ignore next */ {}), source: () => ({ items: this._items(), getRowId: this.getRowId() }),
|
|
663
|
+
computation: (source, previous) => {
|
|
664
|
+
if (!previous || source.getRowId !== previous.source.getRowId)
|
|
665
|
+
return {};
|
|
666
|
+
if (!source.getRowId && source.items !== previous.source.items)
|
|
667
|
+
return {};
|
|
668
|
+
return this._keepCurrentSelection(previous.value);
|
|
669
|
+
} });
|
|
670
|
+
_keepCurrentSelection(selection) {
|
|
671
|
+
const getRowId = this.getRowId();
|
|
672
|
+
return Object.fromEntries(this._items()
|
|
673
|
+
.map((row, index) => (getRowId ? getRowId(row) : String(index)))
|
|
674
|
+
.filter((id) => Object.hasOwn(selection, id) && selection[id])
|
|
675
|
+
.map((id) => [id, true]));
|
|
676
|
+
}
|
|
643
677
|
_serverPageCount = computed(() => {
|
|
644
678
|
const paginated = this._page();
|
|
645
679
|
if (!paginated || paginated.limit <= 0)
|
|
@@ -686,7 +720,12 @@ class EgDataTable {
|
|
|
686
720
|
return {
|
|
687
721
|
features: this.features(),
|
|
688
722
|
columns: this._finalColumns(),
|
|
689
|
-
data:
|
|
723
|
+
data: this._tableItems(),
|
|
724
|
+
getRowId: this.getRowId(),
|
|
725
|
+
// Hiding is only allowed when the View menu can bring columns back.
|
|
726
|
+
// This drives `column.getCanHide()` for both `EgDataTableColumnHeader`
|
|
727
|
+
// (Hide item) and `EgDataTableViewOptions` (toggle list).
|
|
728
|
+
enableHiding: this.showColumnToggle(),
|
|
690
729
|
manualPagination: server,
|
|
691
730
|
manualSorting: server,
|
|
692
731
|
manualFiltering: server,
|
|
@@ -736,10 +775,11 @@ class EgDataTable {
|
|
|
736
775
|
},
|
|
737
776
|
};
|
|
738
777
|
});
|
|
778
|
+
_selectedRows = computed(() => this._table.getSelectedRowModel().rows.map((row) => row.original), { ...(ngDevMode ? { debugName: "_selectedRows" } : /* istanbul ignore next */ {}), equal: (a, b) => a.length === b.length && a.every((row, index) => row === b[index]) });
|
|
739
779
|
_emitSelection = effect(() => {
|
|
740
|
-
this.
|
|
741
|
-
|
|
742
|
-
this.selectionChange.emit(selected);
|
|
780
|
+
const selected = this._selectedRows();
|
|
781
|
+
// Consumer handlers may read signals; those reads must not retrigger us.
|
|
782
|
+
untracked(() => this.selectionChange.emit(selected));
|
|
743
783
|
}, /* @ts-ignore */
|
|
744
784
|
...(ngDevMode ? [{ debugName: "_emitSelection" }] : /* istanbul ignore next */ []));
|
|
745
785
|
/**
|
|
@@ -752,7 +792,7 @@ class EgDataTable {
|
|
|
752
792
|
this._sorting.set([...this.initialSorting()]);
|
|
753
793
|
this._columnFilters.set([...this.initialColumnFilters()]);
|
|
754
794
|
this._columnVisibility.set({ ...this.initialColumnVisibility() });
|
|
755
|
-
this._rowSelection.set(
|
|
795
|
+
this._rowSelection.set(this._keepCurrentSelection(this.initialRowSelection()));
|
|
756
796
|
}
|
|
757
797
|
_hasGrid = computed(() => this.gridColumns() !== undefined, /* @ts-ignore */
|
|
758
798
|
...(ngDevMode ? [{ debugName: "_hasGrid" }] : /* istanbul ignore next */ []));
|
|
@@ -832,7 +872,7 @@ class EgDataTable {
|
|
|
832
872
|
return cell.column.id.replace(/_/g, ' ');
|
|
833
873
|
}
|
|
834
874
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: EgDataTable, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
835
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.3", type: EgDataTable, isStandalone: true, selector: "eg-data-table", inputs: { columns: { classPropertyName: "columns", publicName: "columns", isSignal: true, isRequired: true, transformFunction: null }, gridColumns: { classPropertyName: "gridColumns", publicName: "gridColumns", isSignal: true, isRequired: false, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, manualPagination: { classPropertyName: "manualPagination", publicName: "manualPagination", isSignal: true, isRequired: false, transformFunction: null }, features: { classPropertyName: "features", publicName: "features", isSignal: true, isRequired: false, transformFunction: null }, isLoading: { classPropertyName: "isLoading", publicName: "isLoading", isSignal: true, isRequired: false, transformFunction: null }, emptyMessage: { classPropertyName: "emptyMessage", publicName: "emptyMessage", isSignal: true, isRequired: false, transformFunction: null }, enableSelection: { classPropertyName: "enableSelection", publicName: "enableSelection", isSignal: true, isRequired: false, transformFunction: null }, hideFooter: { classPropertyName: "hideFooter", publicName: "hideFooter", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, layout: { classPropertyName: "layout", publicName: "layout", isSignal: true, isRequired: false, transformFunction: null }, showLayoutToggle: { classPropertyName: "showLayoutToggle", publicName: "showLayoutToggle", isSignal: true, isRequired: false, transformFunction: null }, showToolbar: { classPropertyName: "showToolbar", publicName: "showToolbar", isSignal: true, isRequired: false, transformFunction: null }, filterColumnId: { classPropertyName: "filterColumnId", publicName: "filterColumnId", isSignal: true, isRequired: false, transformFunction: null }, filterPlaceholder: { classPropertyName: "filterPlaceholder", publicName: "filterPlaceholder", isSignal: true, isRequired: false, transformFunction: null }, showColumnToggle: { classPropertyName: "showColumnToggle", publicName: "showColumnToggle", isSignal: true, isRequired: false, transformFunction: null }, toolbarActions: { classPropertyName: "toolbarActions", publicName: "toolbarActions", isSignal: true, isRequired: false, transformFunction: null }, defaultPageSize: { classPropertyName: "defaultPageSize", publicName: "defaultPageSize", isSignal: true, isRequired: false, transformFunction: null }, filterRows: { classPropertyName: "filterRows", publicName: "filterRows", isSignal: true, isRequired: false, transformFunction: null }, initialSorting: { classPropertyName: "initialSorting", publicName: "initialSorting", isSignal: true, isRequired: false, transformFunction: null }, initialColumnFilters: { classPropertyName: "initialColumnFilters", publicName: "initialColumnFilters", isSignal: true, isRequired: false, transformFunction: null }, initialColumnVisibility: { classPropertyName: "initialColumnVisibility", publicName: "initialColumnVisibility", isSignal: true, isRequired: false, transformFunction: null }, initialRowSelection: { classPropertyName: "initialRowSelection", publicName: "initialRowSelection", isSignal: true, isRequired: false, transformFunction: null }, showPageSize: { classPropertyName: "showPageSize", publicName: "showPageSize", isSignal: true, isRequired: false, transformFunction: null }, pageSizes: { classPropertyName: "pageSizes", publicName: "pageSizes", isSignal: true, isRequired: false, transformFunction: null }, navMode: { classPropertyName: "navMode", publicName: "navMode", isSignal: true, isRequired: false, transformFunction: null }, userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { layout: "layoutChange", selectionChange: "selectionChange", pageChange: "pageChange", pageSizeChange: "pageSizeChange", rowClick: "rowClick", sortingChange: "sortingChange", columnFiltersChange: "columnFiltersChange", filterChange: "filterChange", columnVisibilityChange: "columnVisibilityChange" }, providers: [
|
|
875
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.3", type: EgDataTable, isStandalone: true, selector: "eg-data-table", inputs: { columns: { classPropertyName: "columns", publicName: "columns", isSignal: true, isRequired: true, transformFunction: null }, gridColumns: { classPropertyName: "gridColumns", publicName: "gridColumns", isSignal: true, isRequired: false, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, getRowId: { classPropertyName: "getRowId", publicName: "getRowId", isSignal: true, isRequired: false, transformFunction: null }, manualPagination: { classPropertyName: "manualPagination", publicName: "manualPagination", isSignal: true, isRequired: false, transformFunction: null }, features: { classPropertyName: "features", publicName: "features", isSignal: true, isRequired: false, transformFunction: null }, isLoading: { classPropertyName: "isLoading", publicName: "isLoading", isSignal: true, isRequired: false, transformFunction: null }, emptyMessage: { classPropertyName: "emptyMessage", publicName: "emptyMessage", isSignal: true, isRequired: false, transformFunction: null }, enableSelection: { classPropertyName: "enableSelection", publicName: "enableSelection", isSignal: true, isRequired: false, transformFunction: null }, hideFooter: { classPropertyName: "hideFooter", publicName: "hideFooter", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, layout: { classPropertyName: "layout", publicName: "layout", isSignal: true, isRequired: false, transformFunction: null }, showLayoutToggle: { classPropertyName: "showLayoutToggle", publicName: "showLayoutToggle", isSignal: true, isRequired: false, transformFunction: null }, showToolbar: { classPropertyName: "showToolbar", publicName: "showToolbar", isSignal: true, isRequired: false, transformFunction: null }, filterColumnId: { classPropertyName: "filterColumnId", publicName: "filterColumnId", isSignal: true, isRequired: false, transformFunction: null }, filterPlaceholder: { classPropertyName: "filterPlaceholder", publicName: "filterPlaceholder", isSignal: true, isRequired: false, transformFunction: null }, showColumnToggle: { classPropertyName: "showColumnToggle", publicName: "showColumnToggle", isSignal: true, isRequired: false, transformFunction: null }, toolbarActions: { classPropertyName: "toolbarActions", publicName: "toolbarActions", isSignal: true, isRequired: false, transformFunction: null }, defaultPageSize: { classPropertyName: "defaultPageSize", publicName: "defaultPageSize", isSignal: true, isRequired: false, transformFunction: null }, filterRows: { classPropertyName: "filterRows", publicName: "filterRows", isSignal: true, isRequired: false, transformFunction: null }, initialSorting: { classPropertyName: "initialSorting", publicName: "initialSorting", isSignal: true, isRequired: false, transformFunction: null }, initialColumnFilters: { classPropertyName: "initialColumnFilters", publicName: "initialColumnFilters", isSignal: true, isRequired: false, transformFunction: null }, initialColumnVisibility: { classPropertyName: "initialColumnVisibility", publicName: "initialColumnVisibility", isSignal: true, isRequired: false, transformFunction: null }, initialRowSelection: { classPropertyName: "initialRowSelection", publicName: "initialRowSelection", isSignal: true, isRequired: false, transformFunction: null }, showPageSize: { classPropertyName: "showPageSize", publicName: "showPageSize", isSignal: true, isRequired: false, transformFunction: null }, pageSizes: { classPropertyName: "pageSizes", publicName: "pageSizes", isSignal: true, isRequired: false, transformFunction: null }, navMode: { classPropertyName: "navMode", publicName: "navMode", isSignal: true, isRequired: false, transformFunction: null }, userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { layout: "layoutChange", selectionChange: "selectionChange", pageChange: "pageChange", pageSizeChange: "pageSizeChange", rowClick: "rowClick", sortingChange: "sortingChange", columnFiltersChange: "columnFiltersChange", filterChange: "filterChange", columnVisibilityChange: "columnVisibilityChange" }, providers: [
|
|
836
876
|
provideIcons({ lucideArrowDown, lucideArrowUp, lucideChevronsUpDown, lucideLayoutGrid, lucideLayoutList }),
|
|
837
877
|
], ngImport: i0, template: `
|
|
838
878
|
<div [class]="_containerClass()">
|
|
@@ -1281,14 +1321,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
|
|
|
1281
1321
|
`,
|
|
1282
1322
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1283
1323
|
}]
|
|
1284
|
-
}], propDecorators: { columns: [{ type: i0.Input, args: [{ isSignal: true, alias: "columns", required: true }] }], gridColumns: [{ type: i0.Input, args: [{ isSignal: true, alias: "gridColumns", required: false }] }], data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: false }] }], manualPagination: [{ type: i0.Input, args: [{ isSignal: true, alias: "manualPagination", required: false }] }], features: [{ type: i0.Input, args: [{ isSignal: true, alias: "features", required: false }] }], isLoading: [{ type: i0.Input, args: [{ isSignal: true, alias: "isLoading", required: false }] }], emptyMessage: [{ type: i0.Input, args: [{ isSignal: true, alias: "emptyMessage", required: false }] }], enableSelection: [{ type: i0.Input, args: [{ isSignal: true, alias: "enableSelection", required: false }] }], hideFooter: [{ type: i0.Input, args: [{ isSignal: true, alias: "hideFooter", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], layout: [{ type: i0.Input, args: [{ isSignal: true, alias: "layout", required: false }] }, { type: i0.Output, args: ["layoutChange"] }], showLayoutToggle: [{ type: i0.Input, args: [{ isSignal: true, alias: "showLayoutToggle", required: false }] }], showToolbar: [{ type: i0.Input, args: [{ isSignal: true, alias: "showToolbar", required: false }] }], filterColumnId: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterColumnId", required: false }] }], filterPlaceholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterPlaceholder", required: false }] }], showColumnToggle: [{ type: i0.Input, args: [{ isSignal: true, alias: "showColumnToggle", required: false }] }], toolbarActions: [{ type: i0.Input, args: [{ isSignal: true, alias: "toolbarActions", required: false }] }], defaultPageSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "defaultPageSize", required: false }] }], filterRows: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterRows", required: false }] }], initialSorting: [{ type: i0.Input, args: [{ isSignal: true, alias: "initialSorting", required: false }] }], initialColumnFilters: [{ type: i0.Input, args: [{ isSignal: true, alias: "initialColumnFilters", required: false }] }], initialColumnVisibility: [{ type: i0.Input, args: [{ isSignal: true, alias: "initialColumnVisibility", required: false }] }], initialRowSelection: [{ type: i0.Input, args: [{ isSignal: true, alias: "initialRowSelection", required: false }] }], showPageSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "showPageSize", required: false }] }], pageSizes: [{ type: i0.Input, args: [{ isSignal: true, alias: "pageSizes", required: false }] }], navMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "navMode", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], selectionChange: [{ type: i0.Output, args: ["selectionChange"] }], pageChange: [{ type: i0.Output, args: ["pageChange"] }], pageSizeChange: [{ type: i0.Output, args: ["pageSizeChange"] }], rowClick: [{ type: i0.Output, args: ["rowClick"] }], sortingChange: [{ type: i0.Output, args: ["sortingChange"] }], columnFiltersChange: [{ type: i0.Output, args: ["columnFiltersChange"] }], filterChange: [{ type: i0.Output, args: ["filterChange"] }], columnVisibilityChange: [{ type: i0.Output, args: ["columnVisibilityChange"] }] } });
|
|
1324
|
+
}], propDecorators: { columns: [{ type: i0.Input, args: [{ isSignal: true, alias: "columns", required: true }] }], gridColumns: [{ type: i0.Input, args: [{ isSignal: true, alias: "gridColumns", required: false }] }], data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: false }] }], getRowId: [{ type: i0.Input, args: [{ isSignal: true, alias: "getRowId", required: false }] }], manualPagination: [{ type: i0.Input, args: [{ isSignal: true, alias: "manualPagination", required: false }] }], features: [{ type: i0.Input, args: [{ isSignal: true, alias: "features", required: false }] }], isLoading: [{ type: i0.Input, args: [{ isSignal: true, alias: "isLoading", required: false }] }], emptyMessage: [{ type: i0.Input, args: [{ isSignal: true, alias: "emptyMessage", required: false }] }], enableSelection: [{ type: i0.Input, args: [{ isSignal: true, alias: "enableSelection", required: false }] }], hideFooter: [{ type: i0.Input, args: [{ isSignal: true, alias: "hideFooter", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], layout: [{ type: i0.Input, args: [{ isSignal: true, alias: "layout", required: false }] }, { type: i0.Output, args: ["layoutChange"] }], showLayoutToggle: [{ type: i0.Input, args: [{ isSignal: true, alias: "showLayoutToggle", required: false }] }], showToolbar: [{ type: i0.Input, args: [{ isSignal: true, alias: "showToolbar", required: false }] }], filterColumnId: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterColumnId", required: false }] }], filterPlaceholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterPlaceholder", required: false }] }], showColumnToggle: [{ type: i0.Input, args: [{ isSignal: true, alias: "showColumnToggle", required: false }] }], toolbarActions: [{ type: i0.Input, args: [{ isSignal: true, alias: "toolbarActions", required: false }] }], defaultPageSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "defaultPageSize", required: false }] }], filterRows: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterRows", required: false }] }], initialSorting: [{ type: i0.Input, args: [{ isSignal: true, alias: "initialSorting", required: false }] }], initialColumnFilters: [{ type: i0.Input, args: [{ isSignal: true, alias: "initialColumnFilters", required: false }] }], initialColumnVisibility: [{ type: i0.Input, args: [{ isSignal: true, alias: "initialColumnVisibility", required: false }] }], initialRowSelection: [{ type: i0.Input, args: [{ isSignal: true, alias: "initialRowSelection", required: false }] }], showPageSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "showPageSize", required: false }] }], pageSizes: [{ type: i0.Input, args: [{ isSignal: true, alias: "pageSizes", required: false }] }], navMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "navMode", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], selectionChange: [{ type: i0.Output, args: ["selectionChange"] }], pageChange: [{ type: i0.Output, args: ["pageChange"] }], pageSizeChange: [{ type: i0.Output, args: ["pageSizeChange"] }], rowClick: [{ type: i0.Output, args: ["rowClick"] }], sortingChange: [{ type: i0.Output, args: ["sortingChange"] }], columnFiltersChange: [{ type: i0.Output, args: ["columnFiltersChange"] }], filterChange: [{ type: i0.Output, args: ["filterChange"] }], columnVisibilityChange: [{ type: i0.Output, args: ["columnVisibilityChange"] }] } });
|
|
1285
1325
|
|
|
1286
1326
|
/**
|
|
1287
1327
|
* Sortable + hideable column header.
|
|
1288
1328
|
*
|
|
1289
1329
|
* Render via `flexRenderComponent(EgDataTableColumnHeader, { inputs: { column, title } })`
|
|
1290
1330
|
* so the extra `title` input flows alongside the flex-render `column` context.
|
|
1291
|
-
* Non-sortable columns render a plain label.
|
|
1331
|
+
* Non-sortable columns render a plain label. The `Hide` menu item only renders
|
|
1332
|
+
* when `column.getCanHide()` is true — `EgDataTable` ties table-level
|
|
1333
|
+
* `enableHiding` to its `showColumnToggle` input so there is always a way back
|
|
1334
|
+
* via the View menu, and per-column `enableHiding: false` further disables it.
|
|
1292
1335
|
*/
|
|
1293
1336
|
class EgDataTableColumnHeader {
|
|
1294
1337
|
column = input.required(/* @ts-ignore */
|
|
@@ -1300,6 +1343,9 @@ class EgDataTableColumnHeader {
|
|
|
1300
1343
|
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
1301
1344
|
_sorted = computed(() => this.column().getIsSorted(), /* @ts-ignore */
|
|
1302
1345
|
...(ngDevMode ? [{ debugName: "_sorted" }] : /* istanbul ignore next */ []));
|
|
1346
|
+
/** Hideable only when TanStack allows it (table + column `enableHiding`). Absent `getCanHide` (legacy mocks) means hideable. */
|
|
1347
|
+
_canHide = computed(() => this.column().getCanHide?.() ?? true, /* @ts-ignore */
|
|
1348
|
+
...(ngDevMode ? [{ debugName: "_canHide" }] : /* istanbul ignore next */ []));
|
|
1303
1349
|
/** Height per density. Merged by `hlmButton`. */
|
|
1304
1350
|
_buttonClass = computed(() => hlm('tw:-ml-3', this.size() === 'sm' ? 'tw:h-7' : this.size() === 'lg' ? 'tw:h-9' : 'tw:h-8'), /* @ts-ignore */
|
|
1305
1351
|
...(ngDevMode ? [{ debugName: "_buttonClass" }] : /* istanbul ignore next */ []));
|
|
@@ -1338,11 +1384,13 @@ class EgDataTableColumnHeader {
|
|
|
1338
1384
|
<ng-icon hlm size="sm" name="lucideArrowDown" />
|
|
1339
1385
|
Desc
|
|
1340
1386
|
</button>
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
<
|
|
1344
|
-
|
|
1345
|
-
|
|
1387
|
+
@if (_canHide()) {
|
|
1388
|
+
<div hlmDropdownMenuSeparator></div>
|
|
1389
|
+
<button hlmDropdownMenuItem type="button" (click)="column().toggleVisibility(false)">
|
|
1390
|
+
<ng-icon hlm size="sm" name="lucideEyeOff" />
|
|
1391
|
+
Hide
|
|
1392
|
+
</button>
|
|
1393
|
+
}
|
|
1346
1394
|
</div>
|
|
1347
1395
|
</ng-template>
|
|
1348
1396
|
</div>
|
|
@@ -1391,11 +1439,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
|
|
|
1391
1439
|
<ng-icon hlm size="sm" name="lucideArrowDown" />
|
|
1392
1440
|
Desc
|
|
1393
1441
|
</button>
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
<
|
|
1397
|
-
|
|
1398
|
-
|
|
1442
|
+
@if (_canHide()) {
|
|
1443
|
+
<div hlmDropdownMenuSeparator></div>
|
|
1444
|
+
<button hlmDropdownMenuItem type="button" (click)="column().toggleVisibility(false)">
|
|
1445
|
+
<ng-icon hlm size="sm" name="lucideEyeOff" />
|
|
1446
|
+
Hide
|
|
1447
|
+
</button>
|
|
1448
|
+
}
|
|
1399
1449
|
</div>
|
|
1400
1450
|
</ng-template>
|
|
1401
1451
|
</div>
|
|
@@ -188,6 +188,15 @@ declare class EgDataTable<TData extends RowData> implements OnInit {
|
|
|
188
188
|
}, TData>[] | undefined>;
|
|
189
189
|
/** Client rows, or a server page slice when `manualPagination` is set (`null` while loading). */
|
|
190
190
|
readonly data: _angular_core.InputSignal<EgPaginatedResponse<TData> | readonly TData[] | null>;
|
|
191
|
+
/**
|
|
192
|
+
* Pure stable identity callback, e.g. `(record) => record.id`. Return a unique
|
|
193
|
+
* string per entity, independent of position, and keep the callback reference stable.
|
|
194
|
+
* Selection survives refreshes only for IDs still in the supplied rows (after
|
|
195
|
+
* `filterRows`); server selection is limited to the loaded slice. Without this
|
|
196
|
+
* callback, IDs are positional and replacing the rows clears selection.
|
|
197
|
+
* Changing the callback clears selection. Update data immutably.
|
|
198
|
+
*/
|
|
199
|
+
readonly getRowId: _angular_core.InputSignal<((row: TData) => string) | undefined>;
|
|
191
200
|
/** When true, `data` is a server page slice and the table uses TanStack `manualPagination`. Sorting and filtering are then display-only: the slice is shown as-is while `sortingChange` / `filterChange` (`columnFiltersChange`) notify the caller to refetch. */
|
|
192
201
|
readonly manualPagination: _angular_core.InputSignal<boolean>;
|
|
193
202
|
/** TanStack feature registry. Defaults to filtering + visibility + pagination + selection + sorting. */
|
|
@@ -228,7 +237,7 @@ declare class EgDataTable<TData extends RowData> implements OnInit {
|
|
|
228
237
|
/** Column id the toolbar filter input writes to (e.g. `'email'`). Empty means client-side filtering is skipped and keystrokes only emit `filterChange` (server-side pattern). */
|
|
229
238
|
readonly filterColumnId: _angular_core.InputSignal<string>;
|
|
230
239
|
readonly filterPlaceholder: _angular_core.InputSignal<string>;
|
|
231
|
-
/** Show the column-visibility dropdown inside the toolbar. Off by default; opt in per table. */
|
|
240
|
+
/** Show the column-visibility dropdown inside the toolbar (requires `showToolbar`). Off by default; opt in per table. Also enables hiding — the `Hide` item in `EgDataTableColumnHeader` only renders when this is true, so hidden columns always have a way back. Per-column `enableHiding: false` further disables individual columns. */
|
|
232
241
|
readonly showColumnToggle: _angular_core.InputSignal<boolean>;
|
|
233
242
|
/** Custom right-side toolbar content (e.g. action buttons) as a template. Renders the toolbar row even when `showToolbar` is false; built-ins stay on the left. */
|
|
234
243
|
readonly toolbarActions: _angular_core.InputSignal<TemplateRef<unknown> | undefined>;
|
|
@@ -242,7 +251,7 @@ declare class EgDataTable<TData extends RowData> implements OnInit {
|
|
|
242
251
|
readonly initialColumnFilters: _angular_core.InputSignal<ColumnFiltersState>;
|
|
243
252
|
/** Seeds the column-visibility state once at creation. Later changes are ignored. */
|
|
244
253
|
readonly initialColumnVisibility: _angular_core.InputSignal<ColumnVisibilityState>;
|
|
245
|
-
/** Seeds
|
|
254
|
+
/** Seeds selection once for current rows: keys come from `getRowId`, or positional indices without it. Missing IDs are discarded. Later changes are ignored. */
|
|
246
255
|
readonly initialRowSelection: _angular_core.InputSignal<RowSelectionState>;
|
|
247
256
|
/** Show the rows-per-page selector in the footer pager. */
|
|
248
257
|
readonly showPageSize: _angular_core.InputSignal<boolean>;
|
|
@@ -251,7 +260,7 @@ declare class EgDataTable<TData extends RowData> implements OnInit {
|
|
|
251
260
|
/** Footer navigation-button content: icons only, text labels only, or both. */
|
|
252
261
|
readonly navMode: _angular_core.InputSignal<EgPaginationNavMode>;
|
|
253
262
|
readonly userClass: _angular_core.InputSignal<string>;
|
|
254
|
-
/** Emits
|
|
263
|
+
/** Emits on init and when selected row identities/order or object references change. Includes rows hidden by built-in filters/client pagination, but never rows absent from `data`/`filterRows`. */
|
|
255
264
|
readonly selectionChange: _angular_core.OutputEmitterRef<readonly TData[]>;
|
|
256
265
|
/** Emits the target page index on pager navigation (primary hook for server fetching). */
|
|
257
266
|
readonly pageChange: _angular_core.OutputEmitterRef<number>;
|
|
@@ -269,13 +278,15 @@ declare class EgDataTable<TData extends RowData> implements OnInit {
|
|
|
269
278
|
private readonly _sorting;
|
|
270
279
|
private readonly _columnFilters;
|
|
271
280
|
private readonly _columnVisibility;
|
|
272
|
-
private readonly _rowSelection;
|
|
273
281
|
private readonly _clientPageIndex;
|
|
274
282
|
private readonly _clientPageSize;
|
|
275
283
|
private readonly _isServer;
|
|
276
284
|
/** The server page slice when in server mode; `null` for client data, misuse shapes, or `null` while loading. */
|
|
277
285
|
private readonly _page;
|
|
278
286
|
private readonly _items;
|
|
287
|
+
private readonly _tableItems;
|
|
288
|
+
private readonly _rowSelection;
|
|
289
|
+
private _keepCurrentSelection;
|
|
279
290
|
private readonly _serverPageCount;
|
|
280
291
|
private readonly _serverPageIndex;
|
|
281
292
|
private readonly _paginationState;
|
|
@@ -323,6 +334,7 @@ declare class EgDataTable<TData extends RowData> implements OnInit {
|
|
|
323
334
|
readonly thumbnail?: boolean;
|
|
324
335
|
};
|
|
325
336
|
}, TData>;
|
|
337
|
+
private readonly _selectedRows;
|
|
326
338
|
private readonly _emitSelection;
|
|
327
339
|
/**
|
|
328
340
|
* Seeds internal state from the `initial*` inputs. Runs in `ngOnInit` (after
|
|
@@ -352,7 +364,7 @@ declare class EgDataTable<TData extends RowData> implements OnInit {
|
|
|
352
364
|
protected _contentCells(row: Row<EgDataTableFeatures, TData>): Cell<EgDataTableFeatures, TData, CellData>[];
|
|
353
365
|
protected _cellLabel(cell: Cell<EgDataTableFeatures, TData, CellData>): string;
|
|
354
366
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<EgDataTable<any>, never>;
|
|
355
|
-
static ɵcmp: _angular_core.ɵɵComponentDeclaration<EgDataTable<any>, "eg-data-table", never, { "columns": { "alias": "columns"; "required": true; "isSignal": true; }; "gridColumns": { "alias": "gridColumns"; "required": false; "isSignal": true; }; "data": { "alias": "data"; "required": false; "isSignal": true; }; "manualPagination": { "alias": "manualPagination"; "required": false; "isSignal": true; }; "features": { "alias": "features"; "required": false; "isSignal": true; }; "isLoading": { "alias": "isLoading"; "required": false; "isSignal": true; }; "emptyMessage": { "alias": "emptyMessage"; "required": false; "isSignal": true; }; "enableSelection": { "alias": "enableSelection"; "required": false; "isSignal": true; }; "hideFooter": { "alias": "hideFooter"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "layout": { "alias": "layout"; "required": false; "isSignal": true; }; "showLayoutToggle": { "alias": "showLayoutToggle"; "required": false; "isSignal": true; }; "showToolbar": { "alias": "showToolbar"; "required": false; "isSignal": true; }; "filterColumnId": { "alias": "filterColumnId"; "required": false; "isSignal": true; }; "filterPlaceholder": { "alias": "filterPlaceholder"; "required": false; "isSignal": true; }; "showColumnToggle": { "alias": "showColumnToggle"; "required": false; "isSignal": true; }; "toolbarActions": { "alias": "toolbarActions"; "required": false; "isSignal": true; }; "defaultPageSize": { "alias": "defaultPageSize"; "required": false; "isSignal": true; }; "filterRows": { "alias": "filterRows"; "required": false; "isSignal": true; }; "initialSorting": { "alias": "initialSorting"; "required": false; "isSignal": true; }; "initialColumnFilters": { "alias": "initialColumnFilters"; "required": false; "isSignal": true; }; "initialColumnVisibility": { "alias": "initialColumnVisibility"; "required": false; "isSignal": true; }; "initialRowSelection": { "alias": "initialRowSelection"; "required": false; "isSignal": true; }; "showPageSize": { "alias": "showPageSize"; "required": false; "isSignal": true; }; "pageSizes": { "alias": "pageSizes"; "required": false; "isSignal": true; }; "navMode": { "alias": "navMode"; "required": false; "isSignal": true; }; "userClass": { "alias": "class"; "required": false; "isSignal": true; }; }, { "layout": "layoutChange"; "selectionChange": "selectionChange"; "pageChange": "pageChange"; "pageSizeChange": "pageSizeChange"; "rowClick": "rowClick"; "sortingChange": "sortingChange"; "columnFiltersChange": "columnFiltersChange"; "filterChange": "filterChange"; "columnVisibilityChange": "columnVisibilityChange"; }, never, never, true, never>;
|
|
367
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<EgDataTable<any>, "eg-data-table", never, { "columns": { "alias": "columns"; "required": true; "isSignal": true; }; "gridColumns": { "alias": "gridColumns"; "required": false; "isSignal": true; }; "data": { "alias": "data"; "required": false; "isSignal": true; }; "getRowId": { "alias": "getRowId"; "required": false; "isSignal": true; }; "manualPagination": { "alias": "manualPagination"; "required": false; "isSignal": true; }; "features": { "alias": "features"; "required": false; "isSignal": true; }; "isLoading": { "alias": "isLoading"; "required": false; "isSignal": true; }; "emptyMessage": { "alias": "emptyMessage"; "required": false; "isSignal": true; }; "enableSelection": { "alias": "enableSelection"; "required": false; "isSignal": true; }; "hideFooter": { "alias": "hideFooter"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "layout": { "alias": "layout"; "required": false; "isSignal": true; }; "showLayoutToggle": { "alias": "showLayoutToggle"; "required": false; "isSignal": true; }; "showToolbar": { "alias": "showToolbar"; "required": false; "isSignal": true; }; "filterColumnId": { "alias": "filterColumnId"; "required": false; "isSignal": true; }; "filterPlaceholder": { "alias": "filterPlaceholder"; "required": false; "isSignal": true; }; "showColumnToggle": { "alias": "showColumnToggle"; "required": false; "isSignal": true; }; "toolbarActions": { "alias": "toolbarActions"; "required": false; "isSignal": true; }; "defaultPageSize": { "alias": "defaultPageSize"; "required": false; "isSignal": true; }; "filterRows": { "alias": "filterRows"; "required": false; "isSignal": true; }; "initialSorting": { "alias": "initialSorting"; "required": false; "isSignal": true; }; "initialColumnFilters": { "alias": "initialColumnFilters"; "required": false; "isSignal": true; }; "initialColumnVisibility": { "alias": "initialColumnVisibility"; "required": false; "isSignal": true; }; "initialRowSelection": { "alias": "initialRowSelection"; "required": false; "isSignal": true; }; "showPageSize": { "alias": "showPageSize"; "required": false; "isSignal": true; }; "pageSizes": { "alias": "pageSizes"; "required": false; "isSignal": true; }; "navMode": { "alias": "navMode"; "required": false; "isSignal": true; }; "userClass": { "alias": "class"; "required": false; "isSignal": true; }; }, { "layout": "layoutChange"; "selectionChange": "selectionChange"; "pageChange": "pageChange"; "pageSizeChange": "pageSizeChange"; "rowClick": "rowClick"; "sortingChange": "sortingChange"; "columnFiltersChange": "columnFiltersChange"; "filterChange": "filterChange"; "columnVisibilityChange": "columnVisibilityChange"; }, never, never, true, never>;
|
|
356
368
|
}
|
|
357
369
|
|
|
358
370
|
/**
|
|
@@ -369,13 +381,18 @@ interface EgSortableColumn {
|
|
|
369
381
|
getIsSorted(): false | SortDirection;
|
|
370
382
|
toggleSorting(desc?: boolean): void;
|
|
371
383
|
toggleVisibility(value?: boolean): void;
|
|
384
|
+
/** Whether the column can be hidden (`columnDef.enableHiding` and table `enableHiding`). Optional for back-compat mocks — absent means hideable. */
|
|
385
|
+
getCanHide?(): boolean;
|
|
372
386
|
}
|
|
373
387
|
/**
|
|
374
388
|
* Sortable + hideable column header.
|
|
375
389
|
*
|
|
376
390
|
* Render via `flexRenderComponent(EgDataTableColumnHeader, { inputs: { column, title } })`
|
|
377
391
|
* so the extra `title` input flows alongside the flex-render `column` context.
|
|
378
|
-
* Non-sortable columns render a plain label.
|
|
392
|
+
* Non-sortable columns render a plain label. The `Hide` menu item only renders
|
|
393
|
+
* when `column.getCanHide()` is true — `EgDataTable` ties table-level
|
|
394
|
+
* `enableHiding` to its `showColumnToggle` input so there is always a way back
|
|
395
|
+
* via the View menu, and per-column `enableHiding: false` further disables it.
|
|
379
396
|
*/
|
|
380
397
|
declare class EgDataTableColumnHeader {
|
|
381
398
|
readonly column: _angular_core.InputSignal<EgSortableColumn>;
|
|
@@ -383,6 +400,8 @@ declare class EgDataTableColumnHeader {
|
|
|
383
400
|
/** Density of the trigger button. */
|
|
384
401
|
readonly size: _angular_core.InputSignal<HlmTableSize>;
|
|
385
402
|
protected readonly _sorted: _angular_core.Signal<false | SortDirection>;
|
|
403
|
+
/** Hideable only when TanStack allows it (table + column `enableHiding`). Absent `getCanHide` (legacy mocks) means hideable. */
|
|
404
|
+
protected readonly _canHide: _angular_core.Signal<boolean>;
|
|
386
405
|
/** Height per density. Merged by `hlmButton`. */
|
|
387
406
|
protected readonly _buttonClass: _angular_core.Signal<string>;
|
|
388
407
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<EgDataTableColumnHeader, never>;
|
package/date-picker/README.md
CHANGED
|
@@ -135,6 +135,38 @@ Real selectors (from source):
|
|
|
135
135
|
|
|
136
136
|
## API reference
|
|
137
137
|
|
|
138
|
+
### User commits, invalid drafts, and programmatic writes
|
|
139
|
+
|
|
140
|
+
The single, range and multi text inputs commit on **blur or Enter**. Both parsed and transformed values
|
|
141
|
+
must have a finite `getTime` through the configured Spartan date adapter and satisfy inclusive whole-day
|
|
142
|
+
`min`/`max` bounds (`startOfDay(min)` through `endOfDay(max)`). Provide matching parsing, formatting and
|
|
143
|
+
pure transformation callbacks when using a custom adapter/date type. A transformed range must be ordered;
|
|
144
|
+
custom transforms may sort endpoints. The default range parser still treats one date as a same-day range,
|
|
145
|
+
but an explicitly unparseable second endpoint is rejected.
|
|
146
|
+
|
|
147
|
+
For multi selection, `maxSelection` caps the raw and transformed array counts. `minSelection` is the
|
|
148
|
+
calendar's **deselection floor**: reductions below it are rejected, while growth from empty is allowed.
|
|
149
|
+
Supply unique dates. When the calendar proposes resetting a full selection to one new date, that reset
|
|
150
|
+
must also satisfy the floor. Rejected calendar commits restore the previous selection without user emissions.
|
|
151
|
+
|
|
152
|
+
On rejection the committed value stays unchanged, no `dateChange`/CVA `onChange` fires, and the input
|
|
153
|
+
preserves editable text across blur, Enter and refocus. `inputInvalid()` exposes local rejection state;
|
|
154
|
+
the native input receives `aria-invalid="true"` and invalid styling, combined with `forceInvalid`.
|
|
155
|
+
The interaction touches the form control but does not install an Angular validator or overwrite its
|
|
156
|
+
errors: form validators continue to see the last committed value. If unresolved drafts should block
|
|
157
|
+
submission, include `inputInvalid()` in that decision. Use `ariaDescribedby` to associate explanatory text.
|
|
158
|
+
|
|
159
|
+
A successful text/calendar commit, explicit clear, or external value write clears the local rejection.
|
|
160
|
+
Empty text and the clear button bypass transforms and the selection floor, emitting `null` (single/range)
|
|
161
|
+
or `[]` (multi); whitespace is passed to the parser. Enter keeps edit formatting for a subsequent blur;
|
|
162
|
+
blur restores display formatting. Disabled/readonly text inputs do not commit or clear.
|
|
163
|
+
|
|
164
|
+
`updateDate(value)` returns a boolean indicating whether a user commit was accepted. Programmatic CVA
|
|
165
|
+
`writeValue` applies configured transforms without enforcing user constraints or emitting; it replaces
|
|
166
|
+
rejected drafts, including repeated same-value/null writes. `[date]` remains a direct, untransformed
|
|
167
|
+
standalone input. `reset()` is an explicit programmatic clear and emits. Month/year retains its existing
|
|
168
|
+
brain-input lifecycle; this constraint/draft contract applies to single, range and multi pickers.
|
|
169
|
+
|
|
138
170
|
### `HlmDatePicker` — `hlm-date-picker`
|
|
139
171
|
|
|
140
172
|
Single-date picker. Generic `<T>` (usually `Date`). Implements `BrnDatePickerBase<T>` + `ControlValueAccessor`, hosts `BrnFieldControl`.
|
|
@@ -230,15 +262,15 @@ Outputs/methods mirror `HlmDatePicker` (`dateChange: T | null`, `updateDate`, `o
|
|
|
230
262
|
|
|
231
263
|
`HlmDatePickerInput<T>`, `HlmDateMultiInput<T>`, `HlmDateRangeInput<T>`, `HlmMonthYearInput<T>` extend `BrnDateInput` (inheriting `placeholder`, `inputId`, disabled/invalid wiring, clear-button and calendar-button behavior) and add:
|
|
232
264
|
|
|
233
|
-
| Input | Type | Default | Notes
|
|
234
|
-
| -------------------------------------- | ------------------------------------------------------------------------------- | --------------------------------- |
|
|
235
|
-
| `parseDate` | `(value: string) => T \| null` (or `T[] \| null` / `[T,T] \| null` per variant) | from matching `provideHlm*Config` | Return `null` for invalid text;
|
|
236
|
-
| `formatInputDate` / `formatInputDates` | `(date) => string` | from config | Edit format shown while focused.
|
|
237
|
-
| `ariaLabel` / `ariaDescribedby` | `string` | — | Accessible labelling for the inner `<input>`.
|
|
238
|
-
| `name` | `string \| undefined` | — | Native `name` forwarded to the inner `<input>`.
|
|
239
|
-
| `readonly` | `boolean` | `false` | Native `readonly` forwarded to the inner `<input>`.
|
|
240
|
-
| `class` | `ClassValue` | `''` | Extra classes on the host group container.
|
|
241
|
-
| `inputClass` | `ClassValue` | `''` | Extra classes on the inner `<input>` (e.g. text size).
|
|
265
|
+
| Input | Type | Default | Notes |
|
|
266
|
+
| -------------------------------------- | ------------------------------------------------------------------------------- | --------------------------------- | -------------------------------------------------------------------------------------------------- |
|
|
267
|
+
| `parseDate` | `(value: string) => T \| null` (or `T[] \| null` / `[T,T] \| null` per variant) | from matching `provideHlm*Config` | Return `null` for invalid text; single/range/multi preserve the committed value and rejected text. |
|
|
268
|
+
| `formatInputDate` / `formatInputDates` | `(date) => string` | from config | Edit format shown while focused. |
|
|
269
|
+
| `ariaLabel` / `ariaDescribedby` | `string` | — | Accessible labelling for the inner `<input>`. |
|
|
270
|
+
| `name` | `string \| undefined` | — | Native `name` forwarded to the inner `<input>`. |
|
|
271
|
+
| `readonly` | `boolean` | `false` | Native `readonly` forwarded to the inner `<input>`. |
|
|
272
|
+
| `class` | `ClassValue` | `''` | Extra classes on the host group container. |
|
|
273
|
+
| `inputClass` | `ClassValue` | `''` | Extra classes on the inner `<input>` (e.g. text size). |
|
|
242
274
|
|
|
243
275
|
### `HlmDatePickerTrigger` — `hlm-date-picker-trigger`
|
|
244
276
|
|