@ngbase/adk 0.1.8 → 0.1.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/a11y/autofocus.d.ts +7 -1
  2. package/collections/SelectionModel.d.ts +8 -3
  3. package/fesm2022/ngbase-adk-a11y.mjs +43 -20
  4. package/fesm2022/ngbase-adk-a11y.mjs.map +1 -1
  5. package/fesm2022/ngbase-adk-chip.mjs +2 -2
  6. package/fesm2022/ngbase-adk-chip.mjs.map +1 -1
  7. package/fesm2022/ngbase-adk-collections.mjs +8 -1
  8. package/fesm2022/ngbase-adk-collections.mjs.map +1 -1
  9. package/fesm2022/ngbase-adk-popover.mjs +5 -5
  10. package/fesm2022/ngbase-adk-popover.mjs.map +1 -1
  11. package/fesm2022/ngbase-adk-slider.mjs +10 -3
  12. package/fesm2022/ngbase-adk-slider.mjs.map +1 -1
  13. package/fesm2022/ngbase-adk-table.mjs +195 -81
  14. package/fesm2022/ngbase-adk-table.mjs.map +1 -1
  15. package/package.json +11 -11
  16. package/schematics/components/files/avatar/avatar-llm.md.template +2 -0
  17. package/schematics/components/files/button/button-llm.md.template +5 -0
  18. package/schematics/components/files/chip/chip-llm.md.template +1 -1
  19. package/schematics/components/files/form-field/form-field-llm.md.template +5 -3
  20. package/schematics/components/files/form-field/input-style.directive.ts.template +5 -2
  21. package/schematics/components/files/icon/icon-llm.md.template +10 -2
  22. package/schematics/components/files/list/list.ts.template +1 -1
  23. package/schematics/components/files/select/select.ts.template +13 -4
  24. package/schematics/components/files/sidenav/sidenav-llm.md.template +23 -10
  25. package/schematics/components/files/table/table.ts.template +69 -11
  26. package/schematics/components/files/theme/theme-button.ts.template +1 -1
  27. package/slider/slider.d.ts +4 -2
  28. package/table/body-row.d.ts +7 -3
  29. package/table/head-row.d.ts +10 -7
  30. package/table/public-api.d.ts +5 -5
  31. package/table/sort.d.ts +40 -0
  32. package/table/table.d.ts +9 -3
@@ -42,15 +42,17 @@ import {
42
42
  ```html
43
43
  <<%= name %>-form-field>
44
44
  <label <%= name %>Label>Label</label>
45
- <input <%= name %>Input [(value)]="value" />
46
45
  <p <%= name %>Description>Description</p>
47
- <p <%= name %>Error="required">Error</p>
48
- <p <%= name %>Error="!required && minlength">Error</p>
49
46
  <<%= name %>-icon <%= name %>Prefix name="info" />
47
+ <input <%= name %>Input [(value)]="value" />
50
48
  <<%= name %>-icon <%= name %>Suffix name="info" />
49
+ <p <%= name %>Error="required">Error</p>
50
+ <p <%= name %>Error="!required && minlength">Error</p>
51
51
  </<%= name %>-form-field>
52
52
 
53
53
  <<%= name %>-form-field>
54
54
  <input <%= name %>Input [(ngModel)]="value" />
55
55
  </<%= name %>-form-field>
56
56
  ```
57
+
58
+ Note: Use `<%= name %>-form-field` to wrap the `<%= name %>Input`, `<%= name %>-select` or `<%= name %>-autocomplete` and label. Never use any input, select or autocomplete directly.
@@ -4,7 +4,10 @@ import { ɵFocusStyles as focusStyles } from '<%= basepath %>/checkbox';
4
4
  @Directive({
5
5
  selector: '[<%= name %>InputStyle]',
6
6
  host: {
7
- class: `mis inline-block rounded-lg bg-transparent px-2.5 py-2 border font-normal min-h-10 ${focusStyles.focus} ${focusStyles.within}`,
7
+ '[class]':
8
+ "'mis inline-block rounded-lg bg-transparent px-2.5 py-2 border font-normal min-h-10 ' + focusStyles.focus + ' ' + focusStyles.within",
8
9
  },
9
10
  })
10
- export class InputStyle {}
11
+ export class InputStyle {
12
+ readonly focusStyles = focusStyles;
13
+ }
@@ -2,6 +2,8 @@
2
2
 
3
3
  ```typescript
4
4
  import { Icon } from '@/ui/icon';
5
+ import { provideIcons } from '@ng-icons/core';
6
+ import { lucideHouse } from '@ng-icons/lucide';
5
7
  ```
6
8
 
7
9
  ## Components
@@ -14,6 +16,12 @@ import { Icon } from '@/ui/icon';
14
16
 
15
17
  ## Usage
16
18
 
17
- ```html
18
- <<%= name %>-icon name="info" />
19
+ ```typescript
20
+ @Component({
21
+ standalone: true,
22
+ viewProviders: [provideIcons({ lucideHouse })],
23
+ imports: [Icon],
24
+ template: `<<%= name %>-icon name="lucideHouse" />`,
25
+ })
26
+ export class AppComponent {}
19
27
  ```
@@ -1,6 +1,6 @@
1
1
  import { Directive } from '@angular/core';
2
2
  import { NgbList, NgbListActionGroup, provideList } from '@ngbase/adk/list';
3
- import { FocusStyle } from '../checkbox/focus-style.directive';
3
+ import { ɵFocusStyle as FocusStyle } from '<%= basepath %>/checkbox';
4
4
 
5
5
  @Directive({
6
6
  selector: '[<%= name %>ListStyle]',
@@ -1,5 +1,11 @@
1
1
  import { NgTemplateOutlet } from '@angular/common';
2
- import { ChangeDetectionStrategy, Component, Directive } from '@angular/core';
2
+ import {
3
+ booleanAttribute,
4
+ ChangeDetectionStrategy,
5
+ Component,
6
+ Directive,
7
+ input,
8
+ } from '@angular/core';
3
9
  import { FormsModule } from '@angular/forms';
4
10
  import { Icon } from '<%= basepath %>/icon';
5
11
  import { provideIcons } from '@ng-icons/core';
@@ -13,6 +19,7 @@ import {
13
19
  } from '@ngbase/adk/select';
14
20
  import { Option } from './option';
15
21
  import { SelectInput } from './select-input';
22
+ import { PopoverOptions } from '@ngbase/adk/popover';
16
23
 
17
24
  @Directive({
18
25
  selector: '[<%= name %>SelectOption]',
@@ -48,7 +55,9 @@ export class SelectOption<T> {}
48
55
  {{ cValue() || placeholder() }}
49
56
  </ng-content>
50
57
  </span>
51
- <<%= name %>-icon name="lucideChevronsUpDown" class="ml-0.5 text-muted-foreground" />
58
+ @if (!noIcon()) {
59
+ <<%= name %>-icon name="lucideChevronsUpDown" class="ml-0.5 text-muted-foreground" />
60
+ }
52
61
  </button>
53
62
 
54
63
  <!-- Options template -->
@@ -92,8 +101,8 @@ export class SelectOption<T> {}
92
101
  },
93
102
  })
94
103
  export class Select<T> extends NgbSelect<T> {
95
- override defaultOptions = {
104
+ readonly noIcon = input(false, { transform: booleanAttribute });
105
+ override defaultOptions: Partial<PopoverOptions> = {
96
106
  sideOffset: 16,
97
- offset1: 0,
98
107
  };
99
108
  }
@@ -24,14 +24,27 @@ import { Sidenav, SidenavHeader } from '@/ui/sidenav';
24
24
 
25
25
  ## Usage
26
26
 
27
- ```html
28
- <<%= name %>-sidenav [show]="show()" [mode]="mode()">
29
- <<%= name %>-sidenav-header width="100px" minWidth="50px">
30
- <div class="p-2">Collapsible content like side menu</div>
31
- </<%= name %>-sidenav-header>
32
- <div class="p-2">
33
- <p>Main content</p>
34
- <button (click)="toggle()">Toggle</button>
35
- </div>
36
- </<%= name %>-sidenav>
27
+ ```typescript
28
+ @Component({
29
+ standalone: true,
30
+ imports: [Sidenav, SidenavHeader],
31
+ template: ` <<%= name %>-sidenav [show]="show()" [mode]="mode()">
32
+ <<%= name %>-sidenav-header width="100px" minWidth="50px">
33
+ <div class="p-2">Collapsible content like side menu</div>
34
+ </<%= name %>-sidenav-header>
35
+ <div class="p-2">
36
+ <button <%= name %>Button="icon" (click)="toggle()">
37
+ <<%= name %>-icon name="lucideMenu" />
38
+ </button>
39
+ <p>Main content</p>
40
+ </div>
41
+ </<%= name %>-sidenav>`,
42
+ })
43
+ export class AppComponent {
44
+ readonly show = signal(false);
45
+ readonly mode = signal<'side' | 'over'>('side');
46
+ toggle() {
47
+ this.show.update(show => !show);
48
+ }
49
+ }
37
50
  ```
@@ -1,5 +1,10 @@
1
- import { ChangeDetectionStrategy, Component, Directive } from '@angular/core';
1
+ import { ChangeDetectionStrategy, Component, computed, Directive, input } from '@angular/core';
2
2
  import {
3
+ aliasBodyRow,
4
+ aliasHeadRow,
5
+ aliasSort,
6
+ aliasSortHeader,
7
+ aliasTable,
3
8
  NgbBodyRow,
4
9
  NgbBodyRowDef,
5
10
  NgbCell,
@@ -9,13 +14,22 @@ import {
9
14
  NgbHeadDef,
10
15
  NgbHeadRow,
11
16
  NgbHeadRowDef,
17
+ NgbSort,
18
+ NgbSortHeader,
12
19
  NgbTable,
13
20
  } from '@ngbase/adk/table';
21
+ import { Select, Option, SelectTrigger } from '<%= basepath %>/select';
22
+ import { FormField, InputSuffix } from '<%= basepath %>/form-field';
23
+ import { Icon } from '<%= basepath %>/icon';
24
+ import { provideIcons } from '@ng-icons/core';
25
+ import { lucideArrowDown, lucideArrowUp, lucideChevronsUpDown } from '@ng-icons/lucide';
26
+ import { Button } from '<%= basepath %>/button';
27
+ import { NgTemplateOutlet } from '@angular/common';
14
28
 
15
29
  @Component({
16
30
  selector: 'table[<%= name %>Table]',
17
31
  changeDetection: ChangeDetectionStrategy.OnPush,
18
- providers: [{ provide: NgbTable, useExisting: Table }],
32
+ providers: [aliasTable(Table)],
19
33
  template: `
20
34
  <thead>
21
35
  <ng-container #thead />
@@ -25,7 +39,7 @@ import {
25
39
  </tbody>
26
40
  `,
27
41
  host: {
28
- class: 'w-full text-sm',
42
+ class: 'w-full text-sm border-separate border-spacing-0',
29
43
  },
30
44
  })
31
45
  export class Table<T> extends NgbTable<T> {}
@@ -61,10 +75,10 @@ export class BodyRowDef {}
61
75
  @Component({
62
76
  selector: '[<%= name %>BodyRow]',
63
77
  changeDetection: ChangeDetectionStrategy.OnPush,
64
- providers: [{ provide: NgbBodyRow, useExisting: BodyRow }],
78
+ providers: [aliasBodyRow(BodyRow)],
65
79
  template: `<ng-container #container />`,
66
80
  host: {
67
- class: '[&:not(:last-child)]:border-b hover:bg-muted h-12',
81
+ class: '[&:not(:last-child)>td]:border-b hover:bg-muted h-12',
68
82
  },
69
83
  })
70
84
  export class BodyRow extends NgbBodyRow {}
@@ -79,14 +93,12 @@ export class Column {}
79
93
 
80
94
  // Head Cell
81
95
 
82
- @Component({
96
+ @Directive({
83
97
  selector: '[<%= name %>Head]',
84
- changeDetection: ChangeDetectionStrategy.OnPush,
85
98
  hostDirectives: [NgbHead],
86
- template: `<ng-content />`,
87
99
  host: {
88
100
  class:
89
- 'px-4 py-2 text-left align-middle font-medium text-muted-foreground border-b bg-background',
101
+ 'px-4 py-2 text-left align-middle font-medium text-muted-foreground border-b bg-background [&[data-sticky]]:sticky [&[data-sticky]]:!z-20 [&[data-sticky="start"]]:left-0 [&[data-sticky="end"]]:right-0 [&[data-sticky="start"]]:border-r [&[data-sticky="end"]]:border-l',
90
102
  },
91
103
  })
92
104
  export class Head {}
@@ -102,10 +114,10 @@ export class HeadDef {}
102
114
  @Component({
103
115
  selector: '[<%= name %>HeadRow]',
104
116
  changeDetection: ChangeDetectionStrategy.OnPush,
105
- providers: [{ provide: NgbHeadRow, useExisting: HeadRow }],
117
+ providers: [aliasHeadRow(HeadRow)],
106
118
  template: `<ng-container #container />`,
107
119
  host: {
108
- class: `h-10 [&[data-sticky=true]]:sticky [&[data-sticky=true]]:top-0 [&[data-sticky=true]]:bg-background`,
120
+ class: `h-10 [&[data-sticky]>th]:sticky [&[data-sticky]>th]:top-0 [&[data-sticky]>th]:bg-background [&[data-sticky]>th]:z-10`,
109
121
  },
110
122
  })
111
123
  export class HeadRow extends NgbHeadRow {}
@@ -120,3 +132,49 @@ export class HeadRow extends NgbHeadRow {}
120
132
  ],
121
133
  })
122
134
  export class HeadRowDef {}
135
+
136
+ @Directive({
137
+ selector: '[<%= name %>Sort]',
138
+ providers: [aliasSort(Sort)],
139
+ })
140
+ export class Sort extends NgbSort<any> {
141
+ readonly mode = input<'selection' | 'toggle'>('toggle');
142
+ }
143
+
144
+ @Component({
145
+ selector: '[<%= name %>SortHeader]',
146
+ changeDetection: ChangeDetectionStrategy.OnPush,
147
+ viewProviders: [provideIcons({ lucideChevronsUpDown, lucideArrowDown, lucideArrowUp })],
148
+ providers: [aliasSortHeader(SortHeader)],
149
+ imports: [Select, Option, SelectTrigger, FormField, InputSuffix, Icon, Button, NgTemplateOutlet],
150
+ template: `
151
+ <ng-template #temp><ng-content /></ng-template>
152
+ @if (sort.mode() === 'selection') {
153
+ <<%= name %>-form-field class="[&>.mis]:h-8 [&>.mis]:min-h-8 [&>.mis]:border-none">
154
+ <<%= name %>-select noIcon>
155
+ <div <%= name %>SelectTrigger class="text-xs"><ng-container *ngTemplateOutlet="temp" /></div>
156
+ <<%= name %>-option value="asc" (click)="setDirections('asc')">Asc</<%= name %>-option>
157
+ <<%= name %>-option value="desc" (click)="setDirections('desc')">Desc</<%= name %>-option>
158
+ </<%= name %>-select>
159
+ <<%= name %>-icon <%= name %>Suffix [name]="directionIcon()" class="!ml-0.5 text-muted-foreground" />
160
+ </<%= name %>-form-field>
161
+ } @else {
162
+ <button <%= name %>Button="ghost" class="h-8 gap-0.5 !px-2" (click)="toggle()">
163
+ <ng-container *ngTemplateOutlet="temp" />
164
+ <<%= name %>-icon [name]="directionIcon()" />
165
+ </button>
166
+ }
167
+ `,
168
+ host: {
169
+ class: '!py-1 !px-2',
170
+ },
171
+ })
172
+ export class SortHeader extends NgbSortHeader<Sort> {
173
+ readonly directionIcon = computed(() => {
174
+ return this.sortDirection() === 'asc'
175
+ ? 'lucideArrowDown'
176
+ : this.sortDirection() === 'desc'
177
+ ? 'lucideArrowUp'
178
+ : 'lucideChevronsUpDown';
179
+ });
180
+ }
@@ -12,7 +12,7 @@ import { injectTheme } from './theme.service';
12
12
  changeDetection: ChangeDetectionStrategy.OnPush,
13
13
  viewProviders: [provideIcons({ lucideMoon, lucideSun })],
14
14
  template: `
15
- <button <%= name %>Button="icon" class="tour-mode h-9 w-9" (click)="themeService.toggle()">
15
+ <button <%= name %>Button="icon" class="tour-mode" (click)="themeService.toggle()">
16
16
  <<%= name %>-icon [name]="themeService.mode() === 'dark' ? 'lucideSun' : 'lucideMoon'" />
17
17
  <span class="sr-only">Toggle theme</span>
18
18
  </button>
@@ -25,6 +25,7 @@ export declare class SliderThumb {
25
25
  export declare class NgbSlider implements ControlValueAccessor {
26
26
  private readonly el;
27
27
  private readonly dir;
28
+ private cdr;
28
29
  private readonly drag;
29
30
  private readonly track;
30
31
  readonly thumbs: import("@angular/core").Signal<readonly ElementRef<HTMLElement>[]>;
@@ -35,6 +36,7 @@ export declare class NgbSlider implements ControlValueAccessor {
35
36
  readonly range: import("@angular/core").InputSignalWithTransform<number, unknown>;
36
37
  readonly disabled: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
37
38
  readonly orientation: import("@angular/core").InputSignal<"horizontal" | "vertical">;
39
+ readonly afterChange: import("@angular/core").OutputEmitterRef<number | number[]>;
38
40
  private onChange?;
39
41
  private onTouched?;
40
42
  readonly noOfThumbs: import("@angular/core").Signal<number[]>;
@@ -43,7 +45,7 @@ export declare class NgbSlider implements ControlValueAccessor {
43
45
  private activeIndex;
44
46
  private totalWidth;
45
47
  private totalSliderWidth;
46
- private cdr;
48
+ private isChanged;
47
49
  constructor();
48
50
  private handleValueUpdate;
49
51
  private updateElement;
@@ -62,7 +64,7 @@ export declare class NgbSlider implements ControlValueAccessor {
62
64
  private updateValue;
63
65
  private notifyChange;
64
66
  static ɵfac: i0.ɵɵFactoryDeclaration<NgbSlider, never>;
65
- static ɵdir: i0.ɵɵDirectiveDeclaration<NgbSlider, "[ngbSlider]", ["ngbSlider"], { "value": { "alias": "value"; "required": false; "isSignal": true; }; "step": { "alias": "step"; "required": false; "isSignal": true; }; "min": { "alias": "min"; "required": false; "isSignal": true; }; "max": { "alias": "max"; "required": false; "isSignal": true; }; "range": { "alias": "range"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "orientation": { "alias": "orientation"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; }, never, never, true, never>;
67
+ static ɵdir: i0.ɵɵDirectiveDeclaration<NgbSlider, "[ngbSlider]", ["ngbSlider"], { "value": { "alias": "value"; "required": false; "isSignal": true; }; "step": { "alias": "step"; "required": false; "isSignal": true; }; "min": { "alias": "min"; "required": false; "isSignal": true; }; "max": { "alias": "max"; "required": false; "isSignal": true; }; "range": { "alias": "range"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "orientation": { "alias": "orientation"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; "afterChange": "afterChange"; }, never, never, true, never>;
66
68
  }
67
69
  export declare const aliasSlider: (slider: typeof NgbSlider) => ({
68
70
  provide: import("@angular/core").InjectionToken<readonly import("@angular/forms").ControlValueAccessor[]>;
@@ -6,16 +6,20 @@ export declare class NgbBodyRowDef {
6
6
  readonly ngbBodyRowDefColumns: import("@angular/core").InputSignal<string[]>;
7
7
  context: any;
8
8
  static ɵfac: i0.ɵɵFactoryDeclaration<NgbBodyRowDef, never>;
9
- static ɵdir: i0.ɵɵDirectiveDeclaration<NgbBodyRowDef, "[ngbBodyRowDef]", never, { "ngbBodyRowDefColumns": { "alias": "ngbBodyRowDefColumns"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
9
+ static ɵdir: i0.ɵɵDirectiveDeclaration<NgbBodyRowDef, "[ngbBodyRowDef]", never, { "ngbBodyRowDefColumns": { "alias": "ngbBodyRowDefColumns"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
10
10
  }
11
11
  export declare class NgbBodyRow implements OnDestroy {
12
- readonly def: any;
12
+ readonly rowData: import("@angular/core").WritableSignal<any>;
13
13
  readonly table: NgbTable<any>;
14
14
  readonly rowDef: NgbBodyRowDef;
15
- readonly container: import("@angular/core").Signal<ViewContainerRef | undefined>;
15
+ readonly container: import("@angular/core").Signal<ViewContainerRef>;
16
16
  readonly ref: Map<NgbColumn, EmbeddedViewRef<any>>;
17
17
  constructor();
18
18
  ngOnDestroy(): void;
19
19
  static ɵfac: i0.ɵɵFactoryDeclaration<NgbBodyRow, never>;
20
20
  static ɵdir: i0.ɵɵDirectiveDeclaration<NgbBodyRow, "[ngbBodyRow]", never, {}, {}, never, never, true, never>;
21
21
  }
22
+ export declare function aliasBodyRow(row: typeof NgbBodyRow): {
23
+ provide: typeof NgbBodyRow;
24
+ useExisting: typeof NgbBodyRow;
25
+ };
@@ -3,19 +3,22 @@ import { NgbColumn } from './column';
3
3
  import { NgbTable } from './table';
4
4
  import * as i0 from "@angular/core";
5
5
  export declare class NgbHeadRowDef {
6
- readonly ngbHeadRowDef: import("@angular/core").InputSignal<string[] | undefined>;
6
+ readonly ngbHeadRowDef: import("@angular/core").InputSignal<string[]>;
7
7
  readonly ngbHeadRowDefSticky: import("@angular/core").InputSignal<unknown>;
8
8
  static ɵfac: i0.ɵɵFactoryDeclaration<NgbHeadRowDef, never>;
9
- static ɵdir: i0.ɵɵDirectiveDeclaration<NgbHeadRowDef, "[ngbHeadRowDef]", never, { "ngbHeadRowDef": { "alias": "ngbHeadRowDef"; "required": false; "isSignal": true; }; "ngbHeadRowDefSticky": { "alias": "ngbHeadRowDefSticky"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
9
+ static ɵdir: i0.ɵɵDirectiveDeclaration<NgbHeadRowDef, "[ngbHeadRowDef]", never, { "ngbHeadRowDef": { "alias": "ngbHeadRowDef"; "required": true; "isSignal": true; }; "ngbHeadRowDefSticky": { "alias": "ngbHeadRowDefSticky"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
10
10
  }
11
11
  export declare class NgbHeadRow implements OnDestroy {
12
- def: any;
13
- table: NgbTable<any>;
14
- container: import("@angular/core").Signal<ViewContainerRef | undefined>;
15
- ref: Map<NgbColumn, EmbeddedViewRef<any>>;
16
- headDef: NgbHeadRowDef;
12
+ readonly headDef: NgbHeadRowDef;
13
+ readonly table: NgbTable<any>;
14
+ readonly container: import("@angular/core").Signal<ViewContainerRef>;
15
+ readonly ref: Map<NgbColumn, EmbeddedViewRef<any>>;
17
16
  constructor();
18
17
  ngOnDestroy(): void;
19
18
  static ɵfac: i0.ɵɵFactoryDeclaration<NgbHeadRow, never>;
20
19
  static ɵdir: i0.ɵɵDirectiveDeclaration<NgbHeadRow, "[ngbHeadRow]", never, {}, {}, never, never, true, never>;
21
20
  }
21
+ export declare function aliasHeadRow(headRow: typeof NgbHeadRow): {
22
+ provide: typeof NgbHeadRow;
23
+ useExisting: typeof NgbHeadRow;
24
+ };
@@ -1,8 +1,8 @@
1
1
  import { NgbCell, NgbCellDef } from './body-cell';
2
- import { NgbBodyRow, NgbBodyRowDef } from './body-row';
2
+ import { NgbBodyRow, NgbBodyRowDef, aliasBodyRow } from './body-row';
3
3
  import { NgbColumn } from './column';
4
4
  import { NgbHead, NgbHeadDef } from './head-cell';
5
- import { NgbHeadRow, NgbHeadRowDef } from './head-row';
6
- import { NgbTable } from './table';
7
- declare const TableComponents: (typeof NgbHeadDef)[];
8
- export { NgbBodyRow, NgbBodyRowDef, NgbCell, NgbCellDef, NgbHead, NgbHeadDef, NgbHeadRow, NgbHeadRowDef, NgbColumn, NgbTable, TableComponents, };
5
+ import { NgbHeadRow, NgbHeadRowDef, aliasHeadRow } from './head-row';
6
+ import { aliasSort, aliasSortHeader, NgbSort, NgbSortHeader } from './sort';
7
+ import { NgbTable, aliasTable } from './table';
8
+ export { NgbBodyRow, NgbBodyRowDef, NgbCell, NgbCellDef, NgbColumn, NgbHead, NgbHeadDef, NgbHeadRow, NgbHeadRowDef, NgbSort, NgbSortHeader, NgbTable, aliasBodyRow, aliasHeadRow, aliasSort, aliasSortHeader, aliasTable, };
@@ -0,0 +1,40 @@
1
+ import { NgbColumn } from './column';
2
+ import * as i0 from "@angular/core";
3
+ export type SortDirection = 'asc' | 'desc' | '';
4
+ export interface Sort {
5
+ active: string;
6
+ direction: SortDirection;
7
+ }
8
+ export type SortFn<T> = (data: T[], column: string, direction: SortDirection) => T[];
9
+ export declare class NgbSort<T> {
10
+ private readonly table;
11
+ readonly sortFn: import("@angular/core").InputSignal<SortFn<T> | undefined>;
12
+ readonly disableClear: import("@angular/core").InputSignal<boolean>;
13
+ readonly sortColumn: import("@angular/core").ModelSignal<string>;
14
+ readonly sortDirection: import("@angular/core").ModelSignal<SortDirection>;
15
+ readonly sortMode: import("@angular/core").InputSignal<"client" | "server">;
16
+ readonly sortChange: import("@angular/core").OutputEmitterRef<Sort>;
17
+ constructor();
18
+ private defaultSortFn;
19
+ sort(column: string, direction?: SortDirection): void;
20
+ static ɵfac: i0.ɵɵFactoryDeclaration<NgbSort<any>, never>;
21
+ static ɵdir: i0.ɵɵDirectiveDeclaration<NgbSort<any>, "[ngbSort]", ["ngbSort"], { "sortFn": { "alias": "sortFn"; "required": false; "isSignal": true; }; "disableClear": { "alias": "disableClear"; "required": false; "isSignal": true; }; "sortColumn": { "alias": "sortColumn"; "required": false; "isSignal": true; }; "sortDirection": { "alias": "sortDirection"; "required": false; "isSignal": true; }; "sortMode": { "alias": "sortMode"; "required": false; "isSignal": true; }; }, { "sortColumn": "sortColumnChange"; "sortDirection": "sortDirectionChange"; "sortChange": "sortChange"; }, never, never, true, never>;
22
+ }
23
+ export declare class NgbSortHeader<T extends NgbSort<U>, U = any> {
24
+ readonly sort: T;
25
+ readonly column: NgbColumn;
26
+ readonly disableClear: import("@angular/core").InputSignal<boolean>;
27
+ readonly sortDirection: import("@angular/core").Signal<SortDirection | undefined>;
28
+ setDirections(direction: SortDirection): void;
29
+ toggle(): void;
30
+ static ɵfac: i0.ɵɵFactoryDeclaration<NgbSortHeader<any, any>, never>;
31
+ static ɵdir: i0.ɵɵDirectiveDeclaration<NgbSortHeader<any, any>, "[ngbSortHeader]", never, { "disableClear": { "alias": "disableClear"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
32
+ }
33
+ export declare function aliasSort(directive: typeof NgbSort): {
34
+ provide: typeof NgbSort;
35
+ useExisting: typeof NgbSort;
36
+ };
37
+ export declare function aliasSortHeader(directive: typeof NgbSortHeader<any, any>): {
38
+ provide: typeof NgbSortHeader;
39
+ useExisting: typeof NgbSortHeader<any, any>;
40
+ };
package/table/table.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { InjectionToken } from '@angular/core';
1
+ import { InjectionToken, WritableSignal } from '@angular/core';
2
2
  import { NgbColumn } from './column';
3
3
  import * as i0 from "@angular/core";
4
- export declare const ROW_TOKEN: InjectionToken<any>;
4
+ export declare const TABLE_ROW_DATA: InjectionToken<WritableSignal<any>>;
5
5
  export declare class NgbTable<T> {
6
6
  private readonly injector;
7
7
  private readonly differs;
@@ -10,17 +10,23 @@ export declare class NgbTable<T> {
10
10
  private readonly bodyRowDef;
11
11
  private readonly headRowDef;
12
12
  readonly columns: import("@angular/core").Signal<readonly NgbColumn[]>;
13
+ readonly plugins: WritableSignal<Set<(data: T[]) => T[]>>;
13
14
  readonly data: import("@angular/core").InputSignal<T[]>;
14
15
  readonly trackBy: import("@angular/core").InputSignal<(index: number, item: T) => any>;
16
+ private readonly pluggedData;
15
17
  private _dataDiffers?;
16
18
  private readonly _values;
17
- private readonly valuesTracker;
18
19
  constructor();
19
20
  private _updateItemIndexContext;
20
21
  static ɵfac: i0.ɵɵFactoryDeclaration<NgbTable<any>, never>;
21
22
  static ɵdir: i0.ɵɵDirectiveDeclaration<NgbTable<any>, "table[ngbTable]", never, { "data": { "alias": "data"; "required": true; "isSignal": true; }; "trackBy": { "alias": "trackBy"; "required": false; "isSignal": true; }; }, {}, ["bodyRowDef", "headRowDef", "columns"], never, true, never>;
22
23
  }
24
+ export declare function aliasTable(table: typeof NgbTable): {
25
+ provide: typeof NgbTable;
26
+ useExisting: typeof NgbTable;
27
+ };
23
28
  export declare class TableOutletContext<T> {
29
+ _data: WritableSignal<T>;
24
30
  $implicit: T;
25
31
  index?: number;
26
32
  count?: number;