@ngbase/adk 0.1.9 → 0.1.11
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/collections/SelectionModel.d.ts +8 -3
- package/datepicker/datepicker-trigger.d.ts +1 -1
- package/datepicker/datepicker.d.ts +2 -2
- package/fesm2022/ngbase-adk-chip.mjs +2 -2
- package/fesm2022/ngbase-adk-chip.mjs.map +1 -1
- package/fesm2022/ngbase-adk-collections.mjs +8 -1
- package/fesm2022/ngbase-adk-collections.mjs.map +1 -1
- package/fesm2022/ngbase-adk-table.mjs +195 -81
- package/fesm2022/ngbase-adk-table.mjs.map +1 -1
- package/package.json +22 -22
- package/schematics/components/files/chip/chip-llm.md.template +1 -1
- package/schematics/components/files/form-field/input-style.directive.ts.template +5 -2
- package/schematics/components/files/list/list.ts.template +1 -1
- package/schematics/components/files/select/select.ts.template +13 -4
- package/schematics/components/files/table/table-llm.md.template +41 -1
- package/schematics/components/files/table/table.ts.template +105 -12
- package/table/body-row.d.ts +7 -3
- package/table/head-row.d.ts +10 -7
- package/table/public-api.d.ts +5 -5
- package/table/sort.d.ts +40 -0
- package/table/table.d.ts +9 -3
|
@@ -1,14 +1,19 @@
|
|
|
1
|
+
import { Signal } from '@angular/core';
|
|
1
2
|
export declare class SelectionModel<T> {
|
|
2
3
|
multiple: boolean;
|
|
4
|
+
items: Signal<T[]>;
|
|
3
5
|
readonly selected: import("@angular/core").WritableSignal<T[]>;
|
|
4
|
-
readonly hasValue:
|
|
5
|
-
readonly isEmpty:
|
|
6
|
-
|
|
6
|
+
readonly hasValue: Signal<boolean>;
|
|
7
|
+
readonly isEmpty: Signal<boolean>;
|
|
8
|
+
readonly isAllSelected: Signal<boolean>;
|
|
9
|
+
readonly isIndeterminate: Signal<boolean>;
|
|
10
|
+
constructor(multiple?: boolean, selected?: T[], items?: Signal<T[]>);
|
|
7
11
|
clear(): void;
|
|
8
12
|
select(item: T): void;
|
|
9
13
|
deselect(item: T): void;
|
|
10
14
|
selectAll(items: T[]): void;
|
|
11
15
|
isSelected(item: T): boolean;
|
|
12
16
|
toggle(item: T): void;
|
|
17
|
+
toggleAll(): void;
|
|
13
18
|
sort(fn: (a: T, b: T) => number): void;
|
|
14
19
|
}
|
|
@@ -30,7 +30,7 @@ export declare class NgbDatepickerTrigger<D> {
|
|
|
30
30
|
readonly format: import("@angular/core").InputSignal<string>;
|
|
31
31
|
readonly fieldFormat: import("@angular/core").InputSignal<string>;
|
|
32
32
|
readonly dateFilter: import("@angular/core").InputSignal<(date: D) => boolean>;
|
|
33
|
-
readonly pickerType: import("@angular/core").InputSignal<"
|
|
33
|
+
readonly pickerType: import("@angular/core").InputSignal<"year" | "month" | "date">;
|
|
34
34
|
readonly pickerTemplate: import("@angular/core").InputSignal<TemplateRef<any> | null>;
|
|
35
35
|
private displayFormat;
|
|
36
36
|
close?: VoidFunction;
|
|
@@ -16,14 +16,14 @@ export declare class NgbDatePicker<D> {
|
|
|
16
16
|
private dialogRef;
|
|
17
17
|
readonly adapter: import("@ngbase/adk/datepicker").NgbAdpterInterface<D>;
|
|
18
18
|
readonly dateFilter: import("@angular/core").InputSignal<(date: D) => boolean>;
|
|
19
|
-
readonly pickerType: import("@angular/core").InputSignal<"
|
|
19
|
+
readonly pickerType: import("@angular/core").InputSignal<"year" | "month" | "date">;
|
|
20
20
|
readonly allyGroup: import("@angular/core").Signal<AccessibleGroup | undefined>;
|
|
21
21
|
readonly noOfCalendar: import("@angular/core").ModelSignal<number>;
|
|
22
22
|
readonly range: import("@angular/core").ModelSignal<boolean>;
|
|
23
23
|
readonly time: import("@angular/core").WritableSignal<boolean>;
|
|
24
24
|
readonly format: import("@angular/core").WritableSignal<string>;
|
|
25
25
|
readonly template: import("@angular/core").WritableSignal<TemplateRef<any> | null>;
|
|
26
|
-
readonly showType: import("@angular/core").WritableSignal<"
|
|
26
|
+
readonly showType: import("@angular/core").WritableSignal<"year" | "month" | "date">;
|
|
27
27
|
readonly selectedDates: import("@angular/core").WritableSignal<[D | null, D | null]>;
|
|
28
28
|
readonly times: import("@angular/core").WritableSignal<[string | null, string | null]>;
|
|
29
29
|
readonly startDate: import("@angular/core").Signal<D>;
|
|
@@ -7,7 +7,7 @@ class NgbChipRemove {
|
|
|
7
7
|
this.chip = inject((NgbChip));
|
|
8
8
|
}
|
|
9
9
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: NgbChipRemove, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
10
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.0", type: NgbChipRemove, isStandalone: true, selector: "[ngbChipRemove]", host: { attributes: { "type": "button" }, listeners: { "click": "chip.close.emit()" }, properties: { "attr.data-dir": "chip.dir.isRtl() ? \"rtl\" : \"ltr\"" } }, ngImport: i0 }); }
|
|
10
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.0", type: NgbChipRemove, isStandalone: true, selector: "[ngbChipRemove]", host: { attributes: { "type": "button" }, listeners: { "click": "chip.close.emit($event)" }, properties: { "attr.data-dir": "chip.dir.isRtl() ? \"rtl\" : \"ltr\"" } }, ngImport: i0 }); }
|
|
11
11
|
}
|
|
12
12
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: NgbChipRemove, decorators: [{
|
|
13
13
|
type: Directive,
|
|
@@ -15,7 +15,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImpor
|
|
|
15
15
|
selector: '[ngbChipRemove]',
|
|
16
16
|
host: {
|
|
17
17
|
type: 'button',
|
|
18
|
-
'(click)': 'chip.close.emit()',
|
|
18
|
+
'(click)': 'chip.close.emit($event)',
|
|
19
19
|
'[attr.data-dir]': 'chip.dir.isRtl() ? "rtl" : "ltr"',
|
|
20
20
|
},
|
|
21
21
|
}]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngbase-adk-chip.mjs","sources":["../../../projects/adk/chip/chip.ts","../../../projects/adk/chip/chip-group.ts","../../../projects/adk/chip/ngbase-adk-chip.ts"],"sourcesContent":["import { booleanAttribute, Directive, inject, input, output } from '@angular/core';\nimport { Directionality } from '@ngbase/adk/bidi';\n\n@Directive({\n selector: '[ngbChipRemove]',\n host: {\n type: 'button',\n '(click)': 'chip.close.emit()',\n '[attr.data-dir]': 'chip.dir.isRtl() ? \"rtl\" : \"ltr\"',\n },\n})\nexport class NgbChipRemove {\n readonly chip = inject(NgbChip<any>);\n}\n\n@Directive({\n selector: '[ngbChip]',\n})\nexport class NgbChip<T = any> {\n readonly dir = inject(Directionality);\n\n readonly removable = input(true, { transform: booleanAttribute });\n readonly value = input<T>();\n readonly close = output();\n}\n\nexport function aliasChip(chip: typeof NgbChip) {\n return { provide: NgbChip, useExisting: chip };\n}\n","import { contentChildren, Directive, effect, untracked } from '@angular/core';\n// import { Autocomplete } from '@ngbase/adk/autocomplete';\nimport { NgbChip } from './chip';\n\n@Directive({\n selector: '[ngbChipGroup]',\n})\nexport class NgbChipGroup<T> {\n readonly chips = contentChildren(NgbChip<T>);\n // readonly autoComplete = inject(Autocomplete);\n\n // constructor() {\n // effect(() => {\n // const chips = this.chips();\n // untracked(() => {\n // chips.forEach(chip => {\n // chip.close.subscribe(() => {\n // this.autoComplete.removeValue(chip.value());\n // });\n // });\n // });\n // });\n // }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;MAWa,aAAa,CAAA;AAR1B,IAAA,WAAA,GAAA;AASW,QAAA,IAAA,CAAA,IAAI,GAAG,MAAM,EAAC,OAAY,EAAC;AACrC;8GAFY,aAAa,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;kGAAb,aAAa,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,UAAA,EAAA,EAAA,MAAA,EAAA,QAAA,EAAA,EAAA,SAAA,EAAA,EAAA,OAAA,EAAA,
|
|
1
|
+
{"version":3,"file":"ngbase-adk-chip.mjs","sources":["../../../projects/adk/chip/chip.ts","../../../projects/adk/chip/chip-group.ts","../../../projects/adk/chip/ngbase-adk-chip.ts"],"sourcesContent":["import { booleanAttribute, Directive, inject, input, output } from '@angular/core';\nimport { Directionality } from '@ngbase/adk/bidi';\n\n@Directive({\n selector: '[ngbChipRemove]',\n host: {\n type: 'button',\n '(click)': 'chip.close.emit($event)',\n '[attr.data-dir]': 'chip.dir.isRtl() ? \"rtl\" : \"ltr\"',\n },\n})\nexport class NgbChipRemove {\n readonly chip = inject(NgbChip<any>);\n}\n\n@Directive({\n selector: '[ngbChip]',\n})\nexport class NgbChip<T = any> {\n readonly dir = inject(Directionality);\n\n readonly removable = input(true, { transform: booleanAttribute });\n readonly value = input<T>();\n readonly close = output();\n}\n\nexport function aliasChip(chip: typeof NgbChip) {\n return { provide: NgbChip, useExisting: chip };\n}\n","import { contentChildren, Directive, effect, untracked } from '@angular/core';\n// import { Autocomplete } from '@ngbase/adk/autocomplete';\nimport { NgbChip } from './chip';\n\n@Directive({\n selector: '[ngbChipGroup]',\n})\nexport class NgbChipGroup<T> {\n readonly chips = contentChildren(NgbChip<T>);\n // readonly autoComplete = inject(Autocomplete);\n\n // constructor() {\n // effect(() => {\n // const chips = this.chips();\n // untracked(() => {\n // chips.forEach(chip => {\n // chip.close.subscribe(() => {\n // this.autoComplete.removeValue(chip.value());\n // });\n // });\n // });\n // });\n // }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;MAWa,aAAa,CAAA;AAR1B,IAAA,WAAA,GAAA;AASW,QAAA,IAAA,CAAA,IAAI,GAAG,MAAM,EAAC,OAAY,EAAC;AACrC;8GAFY,aAAa,EAAA,IAAA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AA,EAAA,EAAA,KAAA,EAAA,EAAA,iBAAA,EAAA,OAAA,EAAA,UAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,OAAA,EAAA,EAAA,KAAA,EAAA,OAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;2FAAP,OAAO,EAAA,UAAA,EAAA,CAAA;kBAHnB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,WAAW;AACtB,iBAAA;;AASK,SAAU,SAAS,CAAC,IAAoB,EAAA;IAC5C,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE;AAChD;;MCrBa,YAAY,CAAA;AAHzB,IAAA,WAAA,GAAA;AAIW,QAAA,IAAA,CAAA,KAAK,GAAG,eAAe,EAAC,OAAU,EAAC;AAe7C;8GAhBY,YAAY,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;kGAAZ,YAAY,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,gBAAA,EAAA,OAAA,EAAA,CAAA,EAAA,YAAA,EAAA,OAAA,EAAA,SAAA,GACU,OAAU,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;2FADhC,YAAY,EAAA,UAAA,EAAA,CAAA;kBAHxB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,gBAAgB;AAC3B,iBAAA;;;ACND;;AAEG;;;;"}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { signal, computed } from '@angular/core';
|
|
2
2
|
|
|
3
3
|
class SelectionModel {
|
|
4
|
-
constructor(multiple = false, selected = []) {
|
|
4
|
+
constructor(multiple = false, selected = [], items = signal([])) {
|
|
5
5
|
this.multiple = multiple;
|
|
6
|
+
this.items = items;
|
|
6
7
|
this.selected = signal([]);
|
|
7
8
|
this.hasValue = computed(() => this.selected().length > 0);
|
|
8
9
|
this.isEmpty = computed(() => this.selected().length === 0);
|
|
10
|
+
this.isAllSelected = computed(() => this.selected().length > 0 && this.selected().length === this.items().length);
|
|
11
|
+
this.isIndeterminate = computed(() => this.selected().length > 0 && !this.isAllSelected());
|
|
9
12
|
this.selected.set(selected);
|
|
10
13
|
}
|
|
11
14
|
clear() {
|
|
@@ -26,6 +29,10 @@ class SelectionModel {
|
|
|
26
29
|
toggle(item) {
|
|
27
30
|
this.selected.update(selected => selected.includes(item) ? selected.filter(i => i !== item) : [...selected, item]);
|
|
28
31
|
}
|
|
32
|
+
toggleAll() {
|
|
33
|
+
const isAll = this.isIndeterminate() || !this.isAllSelected();
|
|
34
|
+
this.selected.update(x => isAll ? (this.multiple ? [...x, ...this.items()] : this.items()) : []);
|
|
35
|
+
}
|
|
29
36
|
sort(fn) {
|
|
30
37
|
this.selected.update(selected => selected.sort(fn));
|
|
31
38
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngbase-adk-collections.mjs","sources":["../../../projects/adk/collections/SelectionModel.ts","../../../projects/adk/collections/ngbase-adk-collections.ts"],"sourcesContent":["import { computed, signal } from '@angular/core';\n\nexport class SelectionModel<T> {\n readonly selected = signal<T[]>([]);\n readonly hasValue = computed(() => this.selected().length > 0);\n readonly isEmpty = computed(() => this.selected().length === 0);\n\n constructor(\n public multiple = false,\n selected: T[] = [],\n ) {\n this.selected.set(selected);\n }\n\n clear() {\n this.selected.set([]);\n }\n\n select(item: T) {\n this.selected.update(selected => (this.multiple ? [...selected, item] : [item]));\n }\n\n deselect(item: T) {\n this.selected.update(selected => (this.multiple ? selected.filter(i => i !== item) : []));\n }\n\n selectAll(items: T[]) {\n this.selected.update(selected => (this.multiple ? [...selected, ...items] : items));\n }\n\n isSelected(item: T) {\n return this.selected().includes(item);\n }\n\n toggle(item: T) {\n this.selected.update(selected =>\n selected.includes(item) ? selected.filter(i => i !== item) : [...selected, item],\n );\n }\n\n sort(fn: (a: T, b: T) => number) {\n this.selected.update(selected => selected.sort(fn));\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;MAEa,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"ngbase-adk-collections.mjs","sources":["../../../projects/adk/collections/SelectionModel.ts","../../../projects/adk/collections/ngbase-adk-collections.ts"],"sourcesContent":["import { computed, signal, Signal } from '@angular/core';\n\nexport class SelectionModel<T> {\n readonly selected = signal<T[]>([]);\n readonly hasValue = computed(() => this.selected().length > 0);\n readonly isEmpty = computed(() => this.selected().length === 0);\n readonly isAllSelected = computed(\n () => this.selected().length > 0 && this.selected().length === this.items().length,\n );\n readonly isIndeterminate = computed(() => this.selected().length > 0 && !this.isAllSelected());\n\n constructor(\n public multiple = false,\n selected: T[] = [],\n public items: Signal<T[]> = signal([]),\n ) {\n this.selected.set(selected);\n }\n\n clear() {\n this.selected.set([]);\n }\n\n select(item: T) {\n this.selected.update(selected => (this.multiple ? [...selected, item] : [item]));\n }\n\n deselect(item: T) {\n this.selected.update(selected => (this.multiple ? selected.filter(i => i !== item) : []));\n }\n\n selectAll(items: T[]) {\n this.selected.update(selected => (this.multiple ? [...selected, ...items] : items));\n }\n\n isSelected(item: T) {\n return this.selected().includes(item);\n }\n\n toggle(item: T) {\n this.selected.update(selected =>\n selected.includes(item) ? selected.filter(i => i !== item) : [...selected, item],\n );\n }\n\n toggleAll() {\n const isAll = this.isIndeterminate() || !this.isAllSelected();\n this.selected.update(x =>\n isAll ? (this.multiple ? [...x, ...this.items()] : this.items()) : [],\n );\n }\n\n sort(fn: (a: T, b: T) => number) {\n this.selected.update(selected => selected.sort(fn));\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;MAE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|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, Directive, input, contentChild, TemplateRef, viewChild, ViewContainerRef, effect, InjectionToken, Injector, IterableDiffers, contentChildren,
|
|
2
|
+
import { inject, Directive, input, contentChild, TemplateRef, viewChild, ViewContainerRef, effect, untracked, InjectionToken, Injector, IterableDiffers, contentChildren, signal, computed, model, output } from '@angular/core';
|
|
3
3
|
|
|
4
4
|
class NgbHead {
|
|
5
5
|
constructor() {
|
|
@@ -7,14 +7,14 @@ class NgbHead {
|
|
|
7
7
|
this.sticky = this.column.sticky;
|
|
8
8
|
}
|
|
9
9
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: NgbHead, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
10
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.0", type: NgbHead, isStandalone: true, selector: "[ngbHead]", host: { properties: { "
|
|
10
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.0", type: NgbHead, isStandalone: true, selector: "[ngbHead]", host: { properties: { "attr.data-sticky": "column.sticky() || undefined" } }, ngImport: i0 }); }
|
|
11
11
|
}
|
|
12
12
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: NgbHead, decorators: [{
|
|
13
13
|
type: Directive,
|
|
14
14
|
args: [{
|
|
15
15
|
selector: '[ngbHead]',
|
|
16
16
|
host: {
|
|
17
|
-
'[
|
|
17
|
+
'[attr.data-sticky]': 'column.sticky() || undefined',
|
|
18
18
|
},
|
|
19
19
|
}]
|
|
20
20
|
}] });
|
|
@@ -75,11 +75,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImpor
|
|
|
75
75
|
|
|
76
76
|
class NgbHeadRowDef {
|
|
77
77
|
constructor() {
|
|
78
|
-
this.ngbHeadRowDef = input();
|
|
78
|
+
this.ngbHeadRowDef = input.required();
|
|
79
79
|
this.ngbHeadRowDefSticky = input();
|
|
80
80
|
}
|
|
81
81
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: NgbHeadRowDef, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
82
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.0.0", type: NgbHeadRowDef, isStandalone: true, selector: "[ngbHeadRowDef]", inputs: { ngbHeadRowDef: { classPropertyName: "ngbHeadRowDef", publicName: "ngbHeadRowDef", isSignal: true, isRequired:
|
|
82
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.0.0", type: NgbHeadRowDef, isStandalone: true, selector: "[ngbHeadRowDef]", inputs: { ngbHeadRowDef: { classPropertyName: "ngbHeadRowDef", publicName: "ngbHeadRowDef", isSignal: true, isRequired: true, transformFunction: null }, ngbHeadRowDefSticky: { classPropertyName: "ngbHeadRowDefSticky", publicName: "ngbHeadRowDefSticky", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 }); }
|
|
83
83
|
}
|
|
84
84
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: NgbHeadRowDef, decorators: [{
|
|
85
85
|
type: Directive,
|
|
@@ -89,25 +89,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImpor
|
|
|
89
89
|
}] });
|
|
90
90
|
class NgbHeadRow {
|
|
91
91
|
constructor() {
|
|
92
|
-
this.
|
|
92
|
+
this.headDef = inject(NgbHeadRowDef);
|
|
93
93
|
this.table = inject(NgbTable);
|
|
94
|
-
this.container = viewChild('container', { read: ViewContainerRef });
|
|
94
|
+
this.container = viewChild.required('container', { read: ViewContainerRef });
|
|
95
95
|
this.ref = new Map();
|
|
96
|
-
this.headDef = inject(NgbHeadRowDef);
|
|
97
96
|
effect(() => {
|
|
98
97
|
const columns = this.table.columns();
|
|
99
|
-
this.
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
});
|
|
106
|
-
const cols = this.headDef.ngbHeadRowDef();
|
|
107
|
-
columns.forEach((column, index) => {
|
|
108
|
-
if (!cols?.includes(column.ngbColumn())) {
|
|
109
|
-
if (this.ref.has(column)) {
|
|
110
|
-
const ref = this.ref.get(column);
|
|
98
|
+
const displayColumns = this.headDef.ngbHeadRowDef();
|
|
99
|
+
columns.forEach(column => {
|
|
100
|
+
const index = displayColumns.indexOf(column.ngbColumn());
|
|
101
|
+
if (index === -1) {
|
|
102
|
+
const ref = this.ref.get(column);
|
|
103
|
+
if (ref) {
|
|
111
104
|
ref.destroy();
|
|
112
105
|
this.ref.delete(column);
|
|
113
106
|
}
|
|
@@ -115,9 +108,13 @@ class NgbHeadRow {
|
|
|
115
108
|
}
|
|
116
109
|
if (!this.ref.has(column)) {
|
|
117
110
|
// maintain the order of the columns
|
|
118
|
-
const ref = this.container().createEmbeddedView(column.heads(), undefined, { index });
|
|
111
|
+
const ref = untracked(() => this.container().createEmbeddedView(column.heads(), undefined, { index }));
|
|
119
112
|
this.ref.set(column, ref);
|
|
120
113
|
}
|
|
114
|
+
else {
|
|
115
|
+
const ref = this.ref.get(column);
|
|
116
|
+
this.container().move(ref, index);
|
|
117
|
+
}
|
|
121
118
|
});
|
|
122
119
|
});
|
|
123
120
|
}
|
|
@@ -125,66 +122,67 @@ class NgbHeadRow {
|
|
|
125
122
|
this.container().clear();
|
|
126
123
|
}
|
|
127
124
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: NgbHeadRow, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
128
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "19.0.0", type: NgbHeadRow, isStandalone: true, selector: "[ngbHeadRow]", host: { properties: { "attr.data-sticky": "headDef.ngbHeadRowDefSticky()" } }, viewQueries: [{ propertyName: "container", first: true, predicate: ["container"], descendants: true, read: ViewContainerRef, isSignal: true }], ngImport: i0 }); }
|
|
125
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "19.0.0", type: NgbHeadRow, isStandalone: true, selector: "[ngbHeadRow]", host: { properties: { "attr.data-sticky": "headDef.ngbHeadRowDefSticky() || undefined" } }, viewQueries: [{ propertyName: "container", first: true, predicate: ["container"], descendants: true, read: ViewContainerRef, isSignal: true }], ngImport: i0 }); }
|
|
129
126
|
}
|
|
130
127
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: NgbHeadRow, decorators: [{
|
|
131
128
|
type: Directive,
|
|
132
129
|
args: [{
|
|
133
130
|
selector: '[ngbHeadRow]',
|
|
134
131
|
host: {
|
|
135
|
-
'[attr.data-sticky]': 'headDef.ngbHeadRowDefSticky()',
|
|
132
|
+
'[attr.data-sticky]': 'headDef.ngbHeadRowDefSticky() || undefined',
|
|
136
133
|
},
|
|
137
134
|
}]
|
|
138
135
|
}], ctorParameters: () => [] });
|
|
136
|
+
function aliasHeadRow(headRow) {
|
|
137
|
+
return { provide: NgbHeadRow, useExisting: headRow };
|
|
138
|
+
}
|
|
139
139
|
|
|
140
|
-
const
|
|
140
|
+
const TABLE_ROW_DATA = new InjectionToken('TABLE_ROW_DATA');
|
|
141
141
|
class NgbTable {
|
|
142
142
|
constructor() {
|
|
143
143
|
this.injector = inject(Injector);
|
|
144
144
|
this.differs = inject(IterableDiffers);
|
|
145
|
-
this.thead = viewChild('thead', { read: ViewContainerRef });
|
|
146
|
-
this.tbody = viewChild('tbody', { read: ViewContainerRef });
|
|
145
|
+
this.thead = viewChild.required('thead', { read: ViewContainerRef });
|
|
146
|
+
this.tbody = viewChild.required('tbody', { read: ViewContainerRef });
|
|
147
147
|
this.bodyRowDef = contentChildren(NgbBodyRowDef, { read: TemplateRef });
|
|
148
|
-
this.headRowDef = contentChild(NgbHeadRowDef, { read: TemplateRef });
|
|
148
|
+
this.headRowDef = contentChild.required(NgbHeadRowDef, { read: TemplateRef });
|
|
149
149
|
this.columns = contentChildren(NgbColumn);
|
|
150
|
+
this.plugins = signal(new Set());
|
|
150
151
|
this.data = input.required();
|
|
151
152
|
this.trackBy = input((_, item) => item);
|
|
153
|
+
this.pluggedData = computed(() => {
|
|
154
|
+
return Array.from(this.plugins()).reduce((acc, plugin) => plugin(acc), this.data());
|
|
155
|
+
});
|
|
152
156
|
this._values = new WeakMap();
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
effect(() => {
|
|
157
|
+
effect(cleanup => {
|
|
158
|
+
const headRowDef = this.headRowDef();
|
|
156
159
|
const thead = this.thead();
|
|
160
|
+
// append head row
|
|
161
|
+
const injector = Injector.create({ providers: [], parent: this.injector });
|
|
162
|
+
thead.createEmbeddedView(headRowDef, {}, { injector });
|
|
163
|
+
cleanup(() => thead.clear());
|
|
164
|
+
});
|
|
165
|
+
effect(() => {
|
|
157
166
|
const tbody = this.tbody();
|
|
158
|
-
const headRowDef = this.headRowDef();
|
|
159
167
|
const bodyRowDefs = this.bodyRowDef();
|
|
160
|
-
const data = this.
|
|
168
|
+
const data = this.pluggedData();
|
|
161
169
|
this._dataDiffers ??= this.differs.find([]).create(this.trackBy());
|
|
162
170
|
const changes = this._dataDiffers?.diff(data);
|
|
163
171
|
if (!changes) {
|
|
164
172
|
return;
|
|
165
173
|
}
|
|
166
|
-
// append head row
|
|
167
|
-
if (!headerRendered) {
|
|
168
|
-
const value = null;
|
|
169
|
-
const injector = Injector.create({
|
|
170
|
-
providers: [{ provide: ROW_TOKEN, useValue: value }],
|
|
171
|
-
parent: this.injector,
|
|
172
|
-
});
|
|
173
|
-
thead.createEmbeddedView(headRowDef, { $implicit: value }, { injector });
|
|
174
|
-
headerRendered = true;
|
|
175
|
-
}
|
|
176
174
|
const len = bodyRowDefs.length;
|
|
177
175
|
changes.forEachOperation((item, adjustedPreviousIndex, currentIndex) => {
|
|
178
176
|
if (item.previousIndex == null) {
|
|
179
177
|
const value = item.item;
|
|
180
|
-
|
|
178
|
+
const data = signal(value);
|
|
181
179
|
const injector = Injector.create({
|
|
182
|
-
providers: [{ provide:
|
|
180
|
+
providers: [{ provide: TABLE_ROW_DATA, useValue: data }],
|
|
183
181
|
parent: this.injector,
|
|
184
182
|
});
|
|
185
183
|
const i = currentIndex * len;
|
|
186
184
|
for (let j = 0; j < len; j++) {
|
|
187
|
-
const ref = tbody.createEmbeddedView(bodyRowDefs[j], { $implicit: value }, { injector, index: i + j });
|
|
185
|
+
const ref = tbody.createEmbeddedView(bodyRowDefs[j], { $implicit: value, _data: data }, { injector, index: i + j });
|
|
188
186
|
this._values.set(ref, item.item);
|
|
189
187
|
}
|
|
190
188
|
}
|
|
@@ -205,9 +203,11 @@ class NgbTable {
|
|
|
205
203
|
});
|
|
206
204
|
// update rows
|
|
207
205
|
changes.forEachIdentityChange(record => {
|
|
208
|
-
const
|
|
209
|
-
|
|
210
|
-
|
|
206
|
+
const ref = tbody.get(record.currentIndex);
|
|
207
|
+
if (ref) {
|
|
208
|
+
const context = ref.context;
|
|
209
|
+
context._data.set(record.item);
|
|
210
|
+
}
|
|
211
211
|
});
|
|
212
212
|
this._updateItemIndexContext();
|
|
213
213
|
});
|
|
@@ -234,18 +234,22 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImpor
|
|
|
234
234
|
selector: 'table[ngbTable]',
|
|
235
235
|
}]
|
|
236
236
|
}], ctorParameters: () => [] });
|
|
237
|
+
function aliasTable(table) {
|
|
238
|
+
return { provide: NgbTable, useExisting: table };
|
|
239
|
+
}
|
|
237
240
|
class TableOutletContext {
|
|
238
241
|
constructor(data) {
|
|
239
242
|
this.$implicit = data;
|
|
243
|
+
this._data = signal(data);
|
|
240
244
|
}
|
|
241
245
|
}
|
|
242
246
|
|
|
243
247
|
class NgbBodyRowDef {
|
|
244
248
|
constructor() {
|
|
245
|
-
this.ngbBodyRowDefColumns = input(
|
|
249
|
+
this.ngbBodyRowDefColumns = input.required();
|
|
246
250
|
}
|
|
247
251
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: NgbBodyRowDef, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
248
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.0.0", type: NgbBodyRowDef, isStandalone: true, selector: "[ngbBodyRowDef]", inputs: { ngbBodyRowDefColumns: { classPropertyName: "ngbBodyRowDefColumns", publicName: "ngbBodyRowDefColumns", isSignal: true, isRequired:
|
|
252
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.0.0", type: NgbBodyRowDef, isStandalone: true, selector: "[ngbBodyRowDef]", inputs: { ngbBodyRowDefColumns: { classPropertyName: "ngbBodyRowDefColumns", publicName: "ngbBodyRowDefColumns", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0 }); }
|
|
249
253
|
}
|
|
250
254
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: NgbBodyRowDef, decorators: [{
|
|
251
255
|
type: Directive,
|
|
@@ -253,38 +257,34 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImpor
|
|
|
253
257
|
}] });
|
|
254
258
|
class NgbBodyRow {
|
|
255
259
|
constructor() {
|
|
256
|
-
this.
|
|
260
|
+
this.rowData = inject(TABLE_ROW_DATA);
|
|
257
261
|
this.table = inject(NgbTable);
|
|
258
262
|
this.rowDef = inject(NgbBodyRowDef);
|
|
259
|
-
this.container = viewChild('container', { read: ViewContainerRef });
|
|
263
|
+
this.container = viewChild.required('container', { read: ViewContainerRef });
|
|
260
264
|
this.ref = new Map();
|
|
261
265
|
effect(() => {
|
|
262
|
-
const data = this.
|
|
263
|
-
const
|
|
264
|
-
// Remove rows that are no longer in the definition
|
|
265
|
-
this.ref.forEach((ref, row) => {
|
|
266
|
-
if (!rows.includes(row)) {
|
|
267
|
-
ref.destroy();
|
|
268
|
-
this.ref.delete(row);
|
|
269
|
-
}
|
|
270
|
-
});
|
|
266
|
+
const data = this.rowData();
|
|
267
|
+
const columns = this.table.columns();
|
|
271
268
|
const cols = this.rowDef.ngbBodyRowDefColumns();
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
269
|
+
columns.forEach(row => {
|
|
270
|
+
const index = cols.indexOf(row.ngbColumn());
|
|
271
|
+
if (index === -1) {
|
|
272
|
+
const ref = this.ref.get(row);
|
|
273
|
+
if (ref) {
|
|
276
274
|
ref.destroy();
|
|
277
275
|
this.ref.delete(row);
|
|
278
276
|
}
|
|
279
277
|
return;
|
|
280
278
|
}
|
|
281
|
-
|
|
282
|
-
|
|
279
|
+
let ref = this.ref.get(row);
|
|
280
|
+
if (ref) {
|
|
281
|
+
// move the row to the new index
|
|
282
|
+
this.container().move(ref, index);
|
|
283
283
|
ref.context.$implicit = data;
|
|
284
284
|
ref.markForCheck();
|
|
285
285
|
return;
|
|
286
286
|
}
|
|
287
|
-
|
|
287
|
+
ref = untracked(() => {
|
|
288
288
|
// maintain the order of the columns
|
|
289
289
|
return this.container().createEmbeddedView(row.cells(), { $implicit: data }, { index });
|
|
290
290
|
});
|
|
@@ -305,23 +305,137 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImpor
|
|
|
305
305
|
selector: '[ngbBodyRow]',
|
|
306
306
|
}]
|
|
307
307
|
}], ctorParameters: () => [] });
|
|
308
|
+
function aliasBodyRow(row) {
|
|
309
|
+
return { provide: NgbBodyRow, useExisting: row };
|
|
310
|
+
}
|
|
308
311
|
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
312
|
+
class NgbSort {
|
|
313
|
+
constructor() {
|
|
314
|
+
this.table = inject(NgbTable);
|
|
315
|
+
this.sortFn = input();
|
|
316
|
+
this.disableClear = input(false);
|
|
317
|
+
this.sortColumn = model('');
|
|
318
|
+
this.sortDirection = model('');
|
|
319
|
+
this.sortMode = input('client');
|
|
320
|
+
this.sortChange = output();
|
|
321
|
+
this.defaultSortFn = (data, column, direction) => {
|
|
322
|
+
let sorted = [...data];
|
|
323
|
+
if (direction && column) {
|
|
324
|
+
sorted = sorted.sort((a, b) => {
|
|
325
|
+
const aValue = a[column];
|
|
326
|
+
const bValue = b[column];
|
|
327
|
+
if (aValue === bValue)
|
|
328
|
+
return 0;
|
|
329
|
+
if (aValue === null || aValue === undefined)
|
|
330
|
+
return 1;
|
|
331
|
+
if (bValue === null || bValue === undefined)
|
|
332
|
+
return -1;
|
|
333
|
+
const comparison = aValue < bValue ? -1 : 1;
|
|
334
|
+
return direction === 'asc' ? comparison : -comparison;
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
return sorted;
|
|
338
|
+
};
|
|
339
|
+
effect(cleanup => {
|
|
340
|
+
if (this.sortMode() === 'client') {
|
|
341
|
+
const sortFn = untracked(() => this.sortFn() || this.defaultSortFn);
|
|
342
|
+
const fn = (data) => sortFn(data, this.sortColumn(), this.sortDirection());
|
|
343
|
+
this.table.plugins.update(plugins => new Set([...plugins, fn]));
|
|
344
|
+
cleanup(() => {
|
|
345
|
+
this.table.plugins.update(plugins => new Set([...plugins].filter(plugin => plugin !== fn)));
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
});
|
|
349
|
+
}
|
|
350
|
+
sort(column, direction) {
|
|
351
|
+
let currentDirection = this.sortDirection();
|
|
352
|
+
const currentColumn = this.sortColumn();
|
|
353
|
+
let newDirection;
|
|
354
|
+
let newColumn;
|
|
355
|
+
if (direction !== undefined) {
|
|
356
|
+
newDirection = direction;
|
|
357
|
+
newColumn = column;
|
|
358
|
+
}
|
|
359
|
+
else if (currentColumn === column) {
|
|
360
|
+
if (currentDirection === 'asc') {
|
|
361
|
+
newDirection = 'desc';
|
|
362
|
+
newColumn = column;
|
|
363
|
+
}
|
|
364
|
+
else if (currentDirection === 'desc') {
|
|
365
|
+
if (this.disableClear()) {
|
|
366
|
+
newDirection = 'asc';
|
|
367
|
+
newColumn = column;
|
|
368
|
+
}
|
|
369
|
+
else {
|
|
370
|
+
newDirection = '';
|
|
371
|
+
newColumn = '';
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
else {
|
|
375
|
+
newDirection = 'asc';
|
|
376
|
+
newColumn = column;
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
else {
|
|
380
|
+
newDirection = 'asc';
|
|
381
|
+
newColumn = column;
|
|
382
|
+
}
|
|
383
|
+
this.sortColumn.set(newColumn);
|
|
384
|
+
this.sortDirection.set(newDirection);
|
|
385
|
+
this.sortChange.emit({
|
|
386
|
+
active: newColumn,
|
|
387
|
+
direction: newDirection,
|
|
388
|
+
});
|
|
389
|
+
}
|
|
390
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: NgbSort, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
391
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.0.0", type: NgbSort, isStandalone: true, selector: "[ngbSort]", inputs: { sortFn: { classPropertyName: "sortFn", publicName: "sortFn", isSignal: true, isRequired: false, transformFunction: null }, disableClear: { classPropertyName: "disableClear", publicName: "disableClear", isSignal: true, isRequired: false, transformFunction: null }, sortColumn: { classPropertyName: "sortColumn", publicName: "sortColumn", isSignal: true, isRequired: false, transformFunction: null }, sortDirection: { classPropertyName: "sortDirection", publicName: "sortDirection", isSignal: true, isRequired: false, transformFunction: null }, sortMode: { classPropertyName: "sortMode", publicName: "sortMode", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { sortColumn: "sortColumnChange", sortDirection: "sortDirectionChange", sortChange: "sortChange" }, exportAs: ["ngbSort"], ngImport: i0 }); }
|
|
392
|
+
}
|
|
393
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: NgbSort, decorators: [{
|
|
394
|
+
type: Directive,
|
|
395
|
+
args: [{
|
|
396
|
+
selector: '[ngbSort]',
|
|
397
|
+
exportAs: 'ngbSort',
|
|
398
|
+
}]
|
|
399
|
+
}], ctorParameters: () => [] });
|
|
400
|
+
class NgbSortHeader {
|
|
401
|
+
constructor() {
|
|
402
|
+
this.sort = inject(NgbSort);
|
|
403
|
+
this.column = inject(NgbColumn);
|
|
404
|
+
this.disableClear = input(false);
|
|
405
|
+
this.sortDirection = computed(() => {
|
|
406
|
+
return this.column.ngbColumn() === this.sort.sortColumn()
|
|
407
|
+
? this.sort.sortDirection()
|
|
408
|
+
: undefined;
|
|
409
|
+
});
|
|
410
|
+
}
|
|
411
|
+
setDirections(direction) {
|
|
412
|
+
this.sort.sort(this.column.ngbColumn(), direction);
|
|
413
|
+
}
|
|
414
|
+
toggle() {
|
|
415
|
+
this.sort.sort(this.column.ngbColumn(), this.sortDirection() === 'asc' ? 'desc' : this.sortDirection() === 'desc' ? '' : 'asc');
|
|
416
|
+
}
|
|
417
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: NgbSortHeader, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
418
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.0.0", type: NgbSortHeader, isStandalone: true, selector: "[ngbSortHeader]", inputs: { disableClear: { classPropertyName: "disableClear", publicName: "disableClear", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.aria-sort": "sortDirection()" } }, ngImport: i0 }); }
|
|
419
|
+
}
|
|
420
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: NgbSortHeader, decorators: [{
|
|
421
|
+
type: Directive,
|
|
422
|
+
args: [{
|
|
423
|
+
selector: '[ngbSortHeader]',
|
|
424
|
+
host: {
|
|
425
|
+
'[attr.aria-sort]': 'sortDirection()',
|
|
426
|
+
},
|
|
427
|
+
}]
|
|
428
|
+
}] });
|
|
429
|
+
function aliasSort(directive) {
|
|
430
|
+
return { provide: NgbSort, useExisting: directive };
|
|
431
|
+
}
|
|
432
|
+
function aliasSortHeader(directive) {
|
|
433
|
+
return { provide: NgbSortHeader, useExisting: directive };
|
|
434
|
+
}
|
|
321
435
|
|
|
322
436
|
/**
|
|
323
437
|
* Generated bundle index. Do not edit.
|
|
324
438
|
*/
|
|
325
439
|
|
|
326
|
-
export { NgbBodyRow, NgbBodyRowDef, NgbCell, NgbCellDef, NgbColumn, NgbHead, NgbHeadDef, NgbHeadRow, NgbHeadRowDef, NgbTable,
|
|
440
|
+
export { NgbBodyRow, NgbBodyRowDef, NgbCell, NgbCellDef, NgbColumn, NgbHead, NgbHeadDef, NgbHeadRow, NgbHeadRowDef, NgbSort, NgbSortHeader, NgbTable, aliasBodyRow, aliasHeadRow, aliasSort, aliasSortHeader, aliasTable };
|
|
327
441
|
//# sourceMappingURL=ngbase-adk-table.mjs.map
|