primeng 15.4.17-lts → 15.4.18-lts
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/api/treenode.d.ts +1 -0
- package/esm2020/api/treenode.mjs +1 -1
- package/esm2020/dropdown/dropdown.mjs +5 -5
- package/esm2020/table/table.mjs +4 -2
- package/esm2020/tag/tag.mjs +13 -3
- package/esm2020/treetable/treetable.mjs +197 -55
- package/fesm2015/primeng-dropdown.mjs +4 -4
- package/fesm2015/primeng-dropdown.mjs.map +1 -1
- package/fesm2015/primeng-table.mjs +3 -1
- package/fesm2015/primeng-table.mjs.map +1 -1
- package/fesm2015/primeng-tag.mjs +12 -2
- package/fesm2015/primeng-tag.mjs.map +1 -1
- package/fesm2015/primeng-treetable.mjs +198 -54
- package/fesm2015/primeng-treetable.mjs.map +1 -1
- package/fesm2020/primeng-dropdown.mjs +4 -4
- package/fesm2020/primeng-dropdown.mjs.map +1 -1
- package/fesm2020/primeng-table.mjs +3 -1
- package/fesm2020/primeng-table.mjs.map +1 -1
- package/fesm2020/primeng-tag.mjs +12 -2
- package/fesm2020/primeng-tag.mjs.map +1 -1
- package/fesm2020/primeng-treetable.mjs +196 -54
- package/fesm2020/primeng-treetable.mjs.map +1 -1
- package/package.json +1 -1
- package/tag/tag.d.ts +12 -2
- package/treetable/treetable.d.ts +21 -5
package/fesm2015/primeng-tag.mjs
CHANGED
@@ -5,6 +5,16 @@ import { Component, ChangeDetectionStrategy, ViewEncapsulation, Input, ContentCh
|
|
5
5
|
import { LicenseManager, PrimeTemplate, SharedModule } from 'primeng/api';
|
6
6
|
|
7
7
|
class Tag {
|
8
|
+
constructor(cd) {
|
9
|
+
this.cd = cd;
|
10
|
+
}
|
11
|
+
get style() {
|
12
|
+
return this._style;
|
13
|
+
}
|
14
|
+
set style(value) {
|
15
|
+
this._style = value;
|
16
|
+
this.cd.markForCheck();
|
17
|
+
}
|
8
18
|
ngAfterContentInit() {
|
9
19
|
this.templates.forEach((item) => {
|
10
20
|
switch (item.getType()) {
|
@@ -28,7 +38,7 @@ class Tag {
|
|
28
38
|
};
|
29
39
|
}
|
30
40
|
}
|
31
|
-
Tag.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: Tag, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
41
|
+
Tag.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: Tag, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
32
42
|
Tag.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: Tag, selector: "p-tag", inputs: { styleClass: "styleClass", style: "style", severity: "severity", value: "value", icon: "icon", rounded: "rounded" }, host: { classAttribute: "p-element" }, queries: [{ propertyName: "templates", predicate: PrimeTemplate }], ngImport: i0, template: `
|
33
43
|
<span [ngClass]="containerClass()" [class]="styleClass" [ngStyle]="style">
|
34
44
|
<ng-content></ng-content>
|
@@ -57,7 +67,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
57
67
|
`, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
|
58
68
|
class: 'p-element'
|
59
69
|
}, styles: [".p-tag{display:inline-flex;align-items:center;justify-content:center}.p-tag-icon,.p-tag-value,.p-tag-icon.pi{line-height:1.5}.p-tag.p-tag-rounded{border-radius:10rem}\n"] }]
|
60
|
-
}], propDecorators: { styleClass: [{
|
70
|
+
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { styleClass: [{
|
61
71
|
type: Input
|
62
72
|
}], style: [{
|
63
73
|
type: Input
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"primeng-tag.mjs","sources":["../../src/app/components/tag/tag.ts","../../src/app/components/tag/primeng-tag.ts"],"sourcesContent":["import { CommonModule } from '@angular/common';\nimport { AfterViewInit, ChangeDetectionStrategy, Component, ContentChildren, Input, NgModule, QueryList, TemplateRef, ViewEncapsulation } from '@angular/core';\nimport { LicenseManager, PrimeTemplate, SharedModule } from 'primeng/api';\n\n@Component({\n selector: 'p-tag',\n template: `\n <span [ngClass]=\"containerClass()\" [class]=\"styleClass\" [ngStyle]=\"style\">\n <ng-content></ng-content>\n <ng-container *ngIf=\"!iconTemplate\">\n <span class=\"p-tag-icon\" [ngClass]=\"icon\" *ngIf=\"icon\"></span>\n </ng-container>\n <span class=\"p-tag-icon\" *ngIf=\"iconTemplate\">\n <ng-template *ngTemplateOutlet=\"iconTemplate\"></ng-template>\n </span>\n <span class=\"p-tag-value\">{{ value }}</span>\n </span>\n `,\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n styleUrls: ['./tag.css'],\n host: {\n class: 'p-element'\n }\n})\nexport class Tag implements AfterViewInit {\n @Input() styleClass: string;\n\n @Input() style: any;\n\n @Input() severity: string;\n\n @Input() value: string;\n\n @Input() icon: string;\n\n @Input() rounded: boolean;\n\n @ContentChildren(PrimeTemplate) templates: QueryList<any>;\n\n iconTemplate: TemplateRef<any>;\n\n ngAfterContentInit() {\n this.templates.forEach((item) => {\n switch (item.getType()) {\n case 'icon':\n this.iconTemplate = item.template;\n break;\n }\n });\n }\n\n ngAfterViewInit() {\n LicenseManager.check();\n }\n\n containerClass() {\n return {\n 'p-tag p-component': true,\n 'p-tag-info': this.severity === 'info',\n 'p-tag-success': this.severity === 'success',\n 'p-tag-warning': this.severity === 'warning',\n 'p-tag-danger': this.severity === 'danger',\n 'p-tag-rounded': this.rounded\n };\n }\n}\n\n@NgModule({\n imports: [CommonModule, SharedModule],\n exports: [Tag, SharedModule],\n declarations: [Tag]\n})\nexport class TagModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;MAyBa,GAAG,CAAA;
|
1
|
+
{"version":3,"file":"primeng-tag.mjs","sources":["../../src/app/components/tag/tag.ts","../../src/app/components/tag/primeng-tag.ts"],"sourcesContent":["import { CommonModule } from '@angular/common';\nimport { AfterViewInit, ChangeDetectionStrategy, ChangeDetectorRef, Component, ContentChildren, Input, NgModule, QueryList, TemplateRef, ViewEncapsulation } from '@angular/core';\nimport { LicenseManager, PrimeTemplate, SharedModule } from 'primeng/api';\n\n@Component({\n selector: 'p-tag',\n template: `\n <span [ngClass]=\"containerClass()\" [class]=\"styleClass\" [ngStyle]=\"style\">\n <ng-content></ng-content>\n <ng-container *ngIf=\"!iconTemplate\">\n <span class=\"p-tag-icon\" [ngClass]=\"icon\" *ngIf=\"icon\"></span>\n </ng-container>\n <span class=\"p-tag-icon\" *ngIf=\"iconTemplate\">\n <ng-template *ngTemplateOutlet=\"iconTemplate\"></ng-template>\n </span>\n <span class=\"p-tag-value\">{{ value }}</span>\n </span>\n `,\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n styleUrls: ['./tag.css'],\n host: {\n class: 'p-element'\n }\n})\nexport class Tag implements AfterViewInit {\n @Input() styleClass: string;\n\n @Input() get style(): { [klass: string]: any } | null | undefined {\n return this._style;\n }\n set style(value: { [klass: string]: any } | null | undefined) {\n this._style = value;\n this.cd.markForCheck();\n }\n\n @Input() severity: string;\n\n @Input() value: string;\n\n @Input() icon: string;\n\n @Input() rounded: boolean;\n\n @ContentChildren(PrimeTemplate) templates: QueryList<any>;\n\n iconTemplate: TemplateRef<any>;\n\n _style: { [klass: string]: any } | null | undefined;\n\n ngAfterContentInit() {\n this.templates.forEach((item) => {\n switch (item.getType()) {\n case 'icon':\n this.iconTemplate = item.template;\n break;\n }\n });\n }\n\n constructor(private cd: ChangeDetectorRef) {}\n\n ngAfterViewInit() {\n LicenseManager.check();\n }\n\n containerClass() {\n return {\n 'p-tag p-component': true,\n 'p-tag-info': this.severity === 'info',\n 'p-tag-success': this.severity === 'success',\n 'p-tag-warning': this.severity === 'warning',\n 'p-tag-danger': this.severity === 'danger',\n 'p-tag-rounded': this.rounded\n };\n }\n}\n\n@NgModule({\n imports: [CommonModule, SharedModule],\n exports: [Tag, SharedModule],\n declarations: [Tag]\n})\nexport class TagModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":"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"}
|
@@ -106,12 +106,23 @@ class TreeTable {
|
|
106
106
|
this.onEditInit = new EventEmitter();
|
107
107
|
this.onEditComplete = new EventEmitter();
|
108
108
|
this.onEditCancel = new EventEmitter();
|
109
|
-
|
110
|
-
this._virtualRowHeight = 28;
|
109
|
+
this.selectionKeysChange = new EventEmitter();
|
111
110
|
this._value = [];
|
111
|
+
this._virtualRowHeight = 28;
|
112
112
|
this._totalRecords = 0;
|
113
113
|
this._sortOrder = 1;
|
114
|
-
this.
|
114
|
+
this.selectedKeys = {};
|
115
|
+
}
|
116
|
+
/**
|
117
|
+
* A map of keys to control the selection state.
|
118
|
+
* @group Props
|
119
|
+
*/
|
120
|
+
get selectionKeys() {
|
121
|
+
return this._selectionKeys;
|
122
|
+
}
|
123
|
+
set selectionKeys(value) {
|
124
|
+
this._selectionKeys = value;
|
125
|
+
this.selectionKeysChange.emit(this._selectionKeys);
|
115
126
|
}
|
116
127
|
get virtualRowHeight() {
|
117
128
|
return this._virtualRowHeight;
|
@@ -256,7 +267,7 @@ class TreeTable {
|
|
256
267
|
if (simpleChange.selection) {
|
257
268
|
this._selection = simpleChange.selection.currentValue;
|
258
269
|
if (!this.preventSelectionSetterPropagation) {
|
259
|
-
this.
|
270
|
+
this.updateselectedKeys();
|
260
271
|
this.tableService.onSelectionChange();
|
261
272
|
}
|
262
273
|
this.preventSelectionSetterPropagation = false;
|
@@ -342,16 +353,16 @@ class TreeTable {
|
|
342
353
|
set selection(val) {
|
343
354
|
this._selection = val;
|
344
355
|
}
|
345
|
-
|
356
|
+
updateselectedKeys() {
|
346
357
|
if (this.dataKey && this._selection) {
|
347
|
-
this.
|
358
|
+
this.selectedKeys = {};
|
348
359
|
if (Array.isArray(this._selection)) {
|
349
360
|
for (let node of this._selection) {
|
350
|
-
this.
|
361
|
+
this.selectedKeys[String(ObjectUtils.resolveFieldData(node.data, this.dataKey))] = 1;
|
351
362
|
}
|
352
363
|
}
|
353
364
|
else {
|
354
|
-
this.
|
365
|
+
this.selectedKeys[String(ObjectUtils.resolveFieldData(this._selection.data, this.dataKey))] = 1;
|
355
366
|
}
|
356
367
|
}
|
357
368
|
}
|
@@ -805,7 +816,7 @@ class TreeTable {
|
|
805
816
|
if (selected && metaKey) {
|
806
817
|
if (this.isSingleSelectionMode()) {
|
807
818
|
this._selection = null;
|
808
|
-
this.
|
819
|
+
this.selectedKeys = {};
|
809
820
|
this.selectionChange.emit(null);
|
810
821
|
}
|
811
822
|
else {
|
@@ -813,7 +824,7 @@ class TreeTable {
|
|
813
824
|
this._selection = this.selection.filter((val, i) => i != selectionIndex);
|
814
825
|
this.selectionChange.emit(this.selection);
|
815
826
|
if (dataKeyValue) {
|
816
|
-
delete this.
|
827
|
+
delete this.selectedKeys[dataKeyValue];
|
817
828
|
}
|
818
829
|
}
|
819
830
|
this.onNodeUnselect.emit({ originalEvent: event.originalEvent, node: rowNode.node, type: 'row' });
|
@@ -823,8 +834,8 @@ class TreeTable {
|
|
823
834
|
this._selection = rowNode.node;
|
824
835
|
this.selectionChange.emit(rowNode.node);
|
825
836
|
if (dataKeyValue) {
|
826
|
-
this.
|
827
|
-
this.
|
837
|
+
this.selectedKeys = {};
|
838
|
+
this.selectedKeys[dataKeyValue] = 1;
|
828
839
|
}
|
829
840
|
}
|
830
841
|
else if (this.isMultipleSelectionMode()) {
|
@@ -833,12 +844,12 @@ class TreeTable {
|
|
833
844
|
}
|
834
845
|
else {
|
835
846
|
this._selection = [];
|
836
|
-
this.
|
847
|
+
this.selectedKeys = {};
|
837
848
|
}
|
838
849
|
this._selection = [...this.selection, rowNode.node];
|
839
850
|
this.selectionChange.emit(this.selection);
|
840
851
|
if (dataKeyValue) {
|
841
|
-
this.
|
852
|
+
this.selectedKeys[dataKeyValue] = 1;
|
842
853
|
}
|
843
854
|
}
|
844
855
|
this.onNodeSelect.emit({ originalEvent: event.originalEvent, node: rowNode.node, type: 'row', index: event.rowIndex });
|
@@ -848,7 +859,7 @@ class TreeTable {
|
|
848
859
|
if (this.selectionMode === 'single') {
|
849
860
|
if (selected) {
|
850
861
|
this._selection = null;
|
851
|
-
this.
|
862
|
+
this.selectedKeys = {};
|
852
863
|
this.selectionChange.emit(this.selection);
|
853
864
|
this.onNodeUnselect.emit({ originalEvent: event.originalEvent, node: rowNode.node, type: 'row' });
|
854
865
|
}
|
@@ -857,8 +868,8 @@ class TreeTable {
|
|
857
868
|
this.selectionChange.emit(this.selection);
|
858
869
|
this.onNodeSelect.emit({ originalEvent: event.originalEvent, node: rowNode.node, type: 'row', index: event.rowIndex });
|
859
870
|
if (dataKeyValue) {
|
860
|
-
this.
|
861
|
-
this.
|
871
|
+
this.selectedKeys = {};
|
872
|
+
this.selectedKeys[dataKeyValue] = 1;
|
862
873
|
}
|
863
874
|
}
|
864
875
|
}
|
@@ -869,7 +880,7 @@ class TreeTable {
|
|
869
880
|
this.selectionChange.emit(this.selection);
|
870
881
|
this.onNodeUnselect.emit({ originalEvent: event.originalEvent, node: rowNode.node, type: 'row' });
|
871
882
|
if (dataKeyValue) {
|
872
|
-
delete this.
|
883
|
+
delete this.selectedKeys[dataKeyValue];
|
873
884
|
}
|
874
885
|
}
|
875
886
|
else {
|
@@ -877,7 +888,7 @@ class TreeTable {
|
|
877
888
|
this.selectionChange.emit(this.selection);
|
878
889
|
this.onNodeSelect.emit({ originalEvent: event.originalEvent, node: rowNode.node, type: 'row', index: event.rowIndex });
|
879
890
|
if (dataKeyValue) {
|
880
|
-
this.
|
891
|
+
this.selectedKeys[dataKeyValue] = 1;
|
881
892
|
}
|
882
893
|
}
|
883
894
|
}
|
@@ -913,7 +924,7 @@ class TreeTable {
|
|
913
924
|
this.selectionChange.emit(this.selection);
|
914
925
|
}
|
915
926
|
if (dataKeyValue) {
|
916
|
-
this.
|
927
|
+
this.selectedKeys[dataKeyValue] = 1;
|
917
928
|
}
|
918
929
|
}
|
919
930
|
this.contextMenu.show(event.originalEvent);
|
@@ -922,6 +933,7 @@ class TreeTable {
|
|
922
933
|
}
|
923
934
|
}
|
924
935
|
toggleNodeWithCheckbox(event) {
|
936
|
+
// legacy selection support, will be removed in v18
|
925
937
|
this.selection = this.selection || [];
|
926
938
|
this.preventSelectionSetterPropagation = true;
|
927
939
|
let node = event.rowNode.node;
|
@@ -945,25 +957,40 @@ class TreeTable {
|
|
945
957
|
this.tableService.onSelectionChange();
|
946
958
|
}
|
947
959
|
toggleNodesWithCheckbox(event, check) {
|
960
|
+
// legacy selection support, will be removed in v18
|
948
961
|
let data = this.filteredNodes || this.value;
|
949
962
|
this._selection = check && data ? data.slice() : [];
|
950
|
-
|
963
|
+
this.toggleAll(check);
|
964
|
+
if (!check) {
|
965
|
+
this._selection = [];
|
966
|
+
this.selectedKeys = {};
|
967
|
+
}
|
968
|
+
this.preventSelectionSetterPropagation = true;
|
969
|
+
this.selectionChange.emit(this._selection);
|
970
|
+
this.tableService.onSelectionChange();
|
971
|
+
this.onHeaderCheckboxToggle.emit({ originalEvent: event, checked: check });
|
972
|
+
}
|
973
|
+
toggleAll(checked) {
|
974
|
+
let data = this.filteredNodes || this.value;
|
975
|
+
if (!this.selectionKeys) {
|
951
976
|
if (data && data.length) {
|
952
977
|
for (let node of data) {
|
953
|
-
this.propagateSelectionDown(node,
|
978
|
+
this.propagateSelectionDown(node, checked);
|
954
979
|
}
|
955
980
|
}
|
956
981
|
}
|
957
982
|
else {
|
958
|
-
|
959
|
-
|
983
|
+
// legacy selection support, will be removed in v18
|
984
|
+
if (data && data.length) {
|
985
|
+
for (let node of data) {
|
986
|
+
this.propagateDown(node, checked);
|
987
|
+
}
|
988
|
+
this.selectionKeysChange.emit(this.selectionKeys);
|
989
|
+
}
|
960
990
|
}
|
961
|
-
this.preventSelectionSetterPropagation = true;
|
962
|
-
this.selectionChange.emit(this._selection);
|
963
|
-
this.tableService.onSelectionChange();
|
964
|
-
this.onHeaderCheckboxToggle.emit({ originalEvent: event, checked: check });
|
965
991
|
}
|
966
992
|
propagateSelectionUp(node, select) {
|
993
|
+
// legacy selection support, will be removed in v18
|
967
994
|
if (node.children && node.children.length) {
|
968
995
|
let selectedChildCount = 0;
|
969
996
|
let childPartialSelected = false;
|
@@ -978,7 +1005,7 @@ class TreeTable {
|
|
978
1005
|
this._selection = [...(this.selection || []), node];
|
979
1006
|
node.partialSelected = false;
|
980
1007
|
if (dataKeyValue) {
|
981
|
-
this.
|
1008
|
+
this.selectedKeys[dataKeyValue] = 1;
|
982
1009
|
}
|
983
1010
|
}
|
984
1011
|
else {
|
@@ -987,7 +1014,7 @@ class TreeTable {
|
|
987
1014
|
if (index >= 0) {
|
988
1015
|
this._selection = this.selection.filter((val, i) => i != index);
|
989
1016
|
if (dataKeyValue) {
|
990
|
-
delete this.
|
1017
|
+
delete this.selectedKeys[dataKeyValue];
|
991
1018
|
}
|
992
1019
|
}
|
993
1020
|
}
|
@@ -998,26 +1025,29 @@ class TreeTable {
|
|
998
1025
|
}
|
999
1026
|
}
|
1000
1027
|
let parent = node.parent;
|
1028
|
+
node.checked = select;
|
1001
1029
|
if (parent) {
|
1002
1030
|
this.propagateSelectionUp(parent, select);
|
1003
1031
|
}
|
1004
1032
|
}
|
1005
1033
|
propagateSelectionDown(node, select) {
|
1034
|
+
// legacy selection support, will be removed in v18
|
1006
1035
|
let index = this.findIndexInSelection(node);
|
1007
1036
|
let dataKeyValue = this.dataKey ? String(ObjectUtils.resolveFieldData(node.data, this.dataKey)) : null;
|
1008
1037
|
if (select && index == -1) {
|
1009
1038
|
this._selection = [...(this.selection || []), node];
|
1010
1039
|
if (dataKeyValue) {
|
1011
|
-
this.
|
1040
|
+
this.selectedKeys[dataKeyValue] = 1;
|
1012
1041
|
}
|
1013
1042
|
}
|
1014
1043
|
else if (!select && index > -1) {
|
1015
1044
|
this._selection = this.selection.filter((val, i) => i != index);
|
1016
1045
|
if (dataKeyValue) {
|
1017
|
-
delete this.
|
1046
|
+
delete this.selectedKeys[dataKeyValue];
|
1018
1047
|
}
|
1019
1048
|
}
|
1020
1049
|
node.partialSelected = false;
|
1050
|
+
node.checked = select;
|
1021
1051
|
if (node.children && node.children.length) {
|
1022
1052
|
for (let child of node.children) {
|
1023
1053
|
this.propagateSelectionDown(child, select);
|
@@ -1025,9 +1055,15 @@ class TreeTable {
|
|
1025
1055
|
}
|
1026
1056
|
}
|
1027
1057
|
isSelected(node) {
|
1058
|
+
// legacy selection support, will be removed in v18
|
1028
1059
|
if (node && this.selection) {
|
1029
1060
|
if (this.dataKey) {
|
1030
|
-
|
1061
|
+
if (node.hasOwnProperty('checked')) {
|
1062
|
+
return node['checked'];
|
1063
|
+
}
|
1064
|
+
else {
|
1065
|
+
return this.selectedKeys[ObjectUtils.resolveFieldData(node.data, this.dataKey)] !== undefined;
|
1066
|
+
}
|
1031
1067
|
}
|
1032
1068
|
else {
|
1033
1069
|
if (Array.isArray(this.selection))
|
@@ -1038,6 +1074,71 @@ class TreeTable {
|
|
1038
1074
|
}
|
1039
1075
|
return false;
|
1040
1076
|
}
|
1077
|
+
isNodeSelected(node) {
|
1078
|
+
var _a;
|
1079
|
+
return this.selectionMode && this.selectionKeys ? ((_a = this.selectionKeys[this.nodeKey(node)]) === null || _a === void 0 ? void 0 : _a.checked) === true : false;
|
1080
|
+
}
|
1081
|
+
isNodePartialSelected(node) {
|
1082
|
+
var _a;
|
1083
|
+
return this.selectionMode && this.selectionKeys ? ((_a = this.selectionKeys[this.nodeKey(node)]) === null || _a === void 0 ? void 0 : _a.partialChecked) === true : false;
|
1084
|
+
}
|
1085
|
+
nodeKey(node) {
|
1086
|
+
return ObjectUtils.resolveFieldData(node, this.dataKey) || ObjectUtils.resolveFieldData(node === null || node === void 0 ? void 0 : node.data, this.dataKey);
|
1087
|
+
}
|
1088
|
+
toggleCheckbox(event) {
|
1089
|
+
let { rowNode, check, originalEvent } = event;
|
1090
|
+
let node = rowNode.node;
|
1091
|
+
if (this.selectionKeys) {
|
1092
|
+
this.propagateDown(node, check);
|
1093
|
+
if (node.parent) {
|
1094
|
+
this.propagateUp(node.parent, check);
|
1095
|
+
}
|
1096
|
+
this.selectionKeysChange.emit(this.selectionKeys);
|
1097
|
+
}
|
1098
|
+
else {
|
1099
|
+
this.toggleNodeWithCheckbox({ originalEvent, rowNode });
|
1100
|
+
}
|
1101
|
+
this.tableService.onSelectionChange();
|
1102
|
+
}
|
1103
|
+
propagateDown(node, check) {
|
1104
|
+
if (check) {
|
1105
|
+
this.selectionKeys[this.nodeKey(node)] = { checked: true, partialChecked: false };
|
1106
|
+
}
|
1107
|
+
else {
|
1108
|
+
delete this.selectionKeys[this.nodeKey(node)];
|
1109
|
+
}
|
1110
|
+
if (node.children && node.children.length) {
|
1111
|
+
for (let child of node.children) {
|
1112
|
+
this.propagateDown(child, check);
|
1113
|
+
}
|
1114
|
+
}
|
1115
|
+
}
|
1116
|
+
propagateUp(node, check) {
|
1117
|
+
let checkedChildCount = 0;
|
1118
|
+
let childPartialSelected = false;
|
1119
|
+
for (let child of node.children) {
|
1120
|
+
if (this.selectionKeys[this.nodeKey(child)] && this.selectionKeys[this.nodeKey(child)].checked)
|
1121
|
+
checkedChildCount++;
|
1122
|
+
else if (this.selectionKeys[this.nodeKey(child)] && this.selectionKeys[this.nodeKey(child)].partialChecked)
|
1123
|
+
childPartialSelected = true;
|
1124
|
+
}
|
1125
|
+
if (check && checkedChildCount === node.children.length) {
|
1126
|
+
this.selectionKeys[this.nodeKey(node)] = { checked: true, partialChecked: false };
|
1127
|
+
}
|
1128
|
+
else {
|
1129
|
+
if (!check) {
|
1130
|
+
delete this.selectionKeys[this.nodeKey(node)];
|
1131
|
+
}
|
1132
|
+
if (childPartialSelected || (checkedChildCount > 0 && checkedChildCount !== node.children.length))
|
1133
|
+
this.selectionKeys[this.nodeKey(node)] = { checked: false, partialChecked: true };
|
1134
|
+
else
|
1135
|
+
this.selectionKeys[this.nodeKey(node)] = { checked: false, partialChecked: false };
|
1136
|
+
}
|
1137
|
+
let parent = node.parent;
|
1138
|
+
if (parent) {
|
1139
|
+
this.propagateUp(parent, check);
|
1140
|
+
}
|
1141
|
+
}
|
1041
1142
|
findIndexInSelection(node) {
|
1042
1143
|
let index = -1;
|
1043
1144
|
if (this.selection && this.selection.length) {
|
@@ -1057,7 +1158,7 @@ class TreeTable {
|
|
1057
1158
|
return this.selectionMode === 'multiple';
|
1058
1159
|
}
|
1059
1160
|
equals(node1, node2) {
|
1060
|
-
return this.compareSelectionBy === 'equals' ? node1
|
1161
|
+
return this.compareSelectionBy === 'equals' ? ObjectUtils.equals(node1, node2) : ObjectUtils.equals(node1.data, node2.data, this.dataKey);
|
1061
1162
|
}
|
1062
1163
|
filter(value, field, matchMode) {
|
1063
1164
|
if (this.filterTimeout) {
|
@@ -1273,7 +1374,7 @@ class TreeTable {
|
|
1273
1374
|
}
|
1274
1375
|
}
|
1275
1376
|
TreeTable.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: TreeTable, deps: [{ token: DOCUMENT }, { token: i0.Renderer2 }, { token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i0.NgZone }, { token: TreeTableService }, { token: i1.FilterService }], target: i0.ɵɵFactoryTarget.Component });
|
1276
|
-
TreeTable.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: TreeTable, selector: "p-treeTable", inputs: { columns: "columns", style: "style", styleClass: "styleClass", tableStyle: "tableStyle", tableStyleClass: "tableStyleClass", autoLayout: "autoLayout", lazy: "lazy", lazyLoadOnInit: "lazyLoadOnInit", paginator: "paginator", rows: "rows", first: "first", pageLinks: "pageLinks", rowsPerPageOptions: "rowsPerPageOptions", alwaysShowPaginator: "alwaysShowPaginator", paginatorPosition: "paginatorPosition", paginatorDropdownAppendTo: "paginatorDropdownAppendTo", currentPageReportTemplate: "currentPageReportTemplate", showCurrentPageReport: "showCurrentPageReport", showJumpToPageDropdown: "showJumpToPageDropdown", showFirstLastIcon: "showFirstLastIcon", showPageLinks: "showPageLinks", defaultSortOrder: "defaultSortOrder", sortMode: "sortMode", resetPageOnSort: "resetPageOnSort", customSort: "customSort", selectionMode: "selectionMode", contextMenuSelection: "contextMenuSelection", contextMenuSelectionMode: "contextMenuSelectionMode", dataKey: "dataKey", metaKeySelection: "metaKeySelection", compareSelectionBy: "compareSelectionBy", rowHover: "rowHover", loading: "loading", loadingIcon: "loadingIcon", showLoader: "showLoader", scrollable: "scrollable", scrollHeight: "scrollHeight", virtualScroll: "virtualScroll", virtualScrollItemSize: "virtualScrollItemSize", virtualScrollOptions: "virtualScrollOptions", virtualScrollDelay: "virtualScrollDelay", frozenWidth: "frozenWidth", frozenColumns: "frozenColumns", resizableColumns: "resizableColumns", columnResizeMode: "columnResizeMode", reorderableColumns: "reorderableColumns", contextMenu: "contextMenu", rowTrackBy: "rowTrackBy", filters: "filters", globalFilterFields: "globalFilterFields", filterDelay: "filterDelay", filterMode: "filterMode", filterLocale: "filterLocale", virtualRowHeight: "virtualRowHeight", value: "value", totalRecords: "totalRecords", sortField: "sortField", sortOrder: "sortOrder", multiSortMeta: "multiSortMeta", selection: "selection" }, outputs: { selectionChange: "selectionChange", contextMenuSelectionChange: "contextMenuSelectionChange", onFilter: "onFilter", onNodeExpand: "onNodeExpand", onNodeCollapse: "onNodeCollapse", onPage: "onPage", onSort: "onSort", onLazyLoad: "onLazyLoad", sortFunction: "sortFunction", onColResize: "onColResize", onColReorder: "onColReorder", onNodeSelect: "onNodeSelect", onNodeUnselect: "onNodeUnselect", onContextMenuSelect: "onContextMenuSelect", onHeaderCheckboxToggle: "onHeaderCheckboxToggle", onEditInit: "onEditInit", onEditComplete: "onEditComplete", onEditCancel: "onEditCancel" }, host: { classAttribute: "p-element" }, providers: [TreeTableService], queries: [{ propertyName: "templates", predicate: PrimeTemplate }], viewQueries: [{ propertyName: "containerViewChild", first: true, predicate: ["container"], descendants: true }, { propertyName: "resizeHelperViewChild", first: true, predicate: ["resizeHelper"], descendants: true }, { propertyName: "reorderIndicatorUpViewChild", first: true, predicate: ["reorderIndicatorUp"], descendants: true }, { propertyName: "reorderIndicatorDownViewChild", first: true, predicate: ["reorderIndicatorDown"], descendants: true }, { propertyName: "tableViewChild", first: true, predicate: ["table"], descendants: true }, { propertyName: "scrollableViewChild", first: true, predicate: ["scrollableView"], descendants: true }, { propertyName: "scrollableFrozenViewChild", first: true, predicate: ["scrollableFrozenView"], descendants: true }], usesOnChanges: true, ngImport: i0, template: `
|
1377
|
+
TreeTable.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: TreeTable, selector: "p-treeTable", inputs: { columns: "columns", style: "style", styleClass: "styleClass", tableStyle: "tableStyle", tableStyleClass: "tableStyleClass", autoLayout: "autoLayout", lazy: "lazy", lazyLoadOnInit: "lazyLoadOnInit", paginator: "paginator", rows: "rows", first: "first", pageLinks: "pageLinks", rowsPerPageOptions: "rowsPerPageOptions", alwaysShowPaginator: "alwaysShowPaginator", paginatorPosition: "paginatorPosition", paginatorDropdownAppendTo: "paginatorDropdownAppendTo", currentPageReportTemplate: "currentPageReportTemplate", showCurrentPageReport: "showCurrentPageReport", showJumpToPageDropdown: "showJumpToPageDropdown", showFirstLastIcon: "showFirstLastIcon", showPageLinks: "showPageLinks", defaultSortOrder: "defaultSortOrder", sortMode: "sortMode", resetPageOnSort: "resetPageOnSort", customSort: "customSort", selectionMode: "selectionMode", contextMenuSelection: "contextMenuSelection", contextMenuSelectionMode: "contextMenuSelectionMode", dataKey: "dataKey", metaKeySelection: "metaKeySelection", compareSelectionBy: "compareSelectionBy", rowHover: "rowHover", loading: "loading", loadingIcon: "loadingIcon", showLoader: "showLoader", scrollable: "scrollable", scrollHeight: "scrollHeight", virtualScroll: "virtualScroll", virtualScrollItemSize: "virtualScrollItemSize", virtualScrollOptions: "virtualScrollOptions", virtualScrollDelay: "virtualScrollDelay", frozenWidth: "frozenWidth", frozenColumns: "frozenColumns", resizableColumns: "resizableColumns", columnResizeMode: "columnResizeMode", reorderableColumns: "reorderableColumns", contextMenu: "contextMenu", rowTrackBy: "rowTrackBy", filters: "filters", globalFilterFields: "globalFilterFields", filterDelay: "filterDelay", filterMode: "filterMode", filterLocale: "filterLocale", selectionKeys: "selectionKeys", virtualRowHeight: "virtualRowHeight", value: "value", totalRecords: "totalRecords", sortField: "sortField", sortOrder: "sortOrder", multiSortMeta: "multiSortMeta", selection: "selection" }, outputs: { selectionChange: "selectionChange", contextMenuSelectionChange: "contextMenuSelectionChange", onFilter: "onFilter", onNodeExpand: "onNodeExpand", onNodeCollapse: "onNodeCollapse", onPage: "onPage", onSort: "onSort", onLazyLoad: "onLazyLoad", sortFunction: "sortFunction", onColResize: "onColResize", onColReorder: "onColReorder", onNodeSelect: "onNodeSelect", onNodeUnselect: "onNodeUnselect", onContextMenuSelect: "onContextMenuSelect", onHeaderCheckboxToggle: "onHeaderCheckboxToggle", onEditInit: "onEditInit", onEditComplete: "onEditComplete", onEditCancel: "onEditCancel", selectionKeysChange: "selectionKeysChange" }, host: { classAttribute: "p-element" }, providers: [TreeTableService], queries: [{ propertyName: "templates", predicate: PrimeTemplate }], viewQueries: [{ propertyName: "containerViewChild", first: true, predicate: ["container"], descendants: true }, { propertyName: "resizeHelperViewChild", first: true, predicate: ["resizeHelper"], descendants: true }, { propertyName: "reorderIndicatorUpViewChild", first: true, predicate: ["reorderIndicatorUp"], descendants: true }, { propertyName: "reorderIndicatorDownViewChild", first: true, predicate: ["reorderIndicatorDown"], descendants: true }, { propertyName: "tableViewChild", first: true, predicate: ["table"], descendants: true }, { propertyName: "scrollableViewChild", first: true, predicate: ["scrollableView"], descendants: true }, { propertyName: "scrollableFrozenViewChild", first: true, predicate: ["scrollableFrozenView"], descendants: true }], usesOnChanges: true, ngImport: i0, template: `
|
1277
1378
|
<div
|
1278
1379
|
#container
|
1279
1380
|
[ngStyle]="style"
|
@@ -1710,6 +1811,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
1710
1811
|
type: Output
|
1711
1812
|
}], onEditCancel: [{
|
1712
1813
|
type: Output
|
1814
|
+
}], selectionKeysChange: [{
|
1815
|
+
type: Output
|
1713
1816
|
}], containerViewChild: [{
|
1714
1817
|
type: ViewChild,
|
1715
1818
|
args: ['container']
|
@@ -1734,6 +1837,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
1734
1837
|
}], templates: [{
|
1735
1838
|
type: ContentChildren,
|
1736
1839
|
args: [PrimeTemplate]
|
1840
|
+
}], selectionKeys: [{
|
1841
|
+
type: Input
|
1737
1842
|
}], virtualRowHeight: [{
|
1738
1843
|
type: Input
|
1739
1844
|
}], value: [{
|
@@ -2621,19 +2726,44 @@ class TTCheckbox {
|
|
2621
2726
|
this.tableService = tableService;
|
2622
2727
|
this.cd = cd;
|
2623
2728
|
this.subscription = this.tt.tableService.selectionSource$.subscribe(() => {
|
2624
|
-
|
2729
|
+
if (this.tt.selectionKeys) {
|
2730
|
+
this.checked = this.tt.isNodeSelected(this.rowNode.node);
|
2731
|
+
this.partialChecked = this.tt.isNodePartialSelected(this.rowNode.node);
|
2732
|
+
}
|
2733
|
+
else {
|
2734
|
+
this.checked = this.tt.isSelected(this.rowNode.node);
|
2735
|
+
this.partialChecked = this.rowNode.node.partialSelected;
|
2736
|
+
}
|
2625
2737
|
this.cd.markForCheck();
|
2626
2738
|
});
|
2627
2739
|
}
|
2628
2740
|
ngOnInit() {
|
2629
|
-
|
2741
|
+
if (this.tt.selectionKeys) {
|
2742
|
+
this.checked = this.tt.isNodeSelected(this.rowNode.node);
|
2743
|
+
this.partialChecked = this.tt.isNodePartialSelected(this.rowNode.node);
|
2744
|
+
}
|
2745
|
+
else {
|
2746
|
+
// for backward compatibility
|
2747
|
+
this.checked = this.tt.isSelected(this.rowNode.node);
|
2748
|
+
this.partialChecked = this.rowNode.node.partialSelected;
|
2749
|
+
}
|
2630
2750
|
}
|
2631
2751
|
onClick(event) {
|
2632
2752
|
if (!this.disabled) {
|
2633
|
-
this.tt.
|
2634
|
-
|
2635
|
-
|
2636
|
-
|
2753
|
+
if (this.tt.selectionKeys) {
|
2754
|
+
const _check = !this.checked;
|
2755
|
+
this.tt.toggleCheckbox({
|
2756
|
+
originalEvent: event,
|
2757
|
+
check: _check,
|
2758
|
+
rowNode: this.rowNode
|
2759
|
+
});
|
2760
|
+
}
|
2761
|
+
else {
|
2762
|
+
this.tt.toggleNodeWithCheckbox({
|
2763
|
+
originalEvent: event,
|
2764
|
+
rowNode: this.rowNode
|
2765
|
+
});
|
2766
|
+
}
|
2637
2767
|
}
|
2638
2768
|
DomHandler.clearSelection();
|
2639
2769
|
}
|
@@ -2655,13 +2785,13 @@ TTCheckbox.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "1
|
|
2655
2785
|
<div class="p-hidden-accessible">
|
2656
2786
|
<input type="checkbox" [checked]="checked" (focus)="onFocus()" (blur)="onBlur()" />
|
2657
2787
|
</div>
|
2658
|
-
<div #box [ngClass]="{ 'p-checkbox-box': true, 'p-highlight': checked, 'p-focus': focused, 'p-indeterminate':
|
2788
|
+
<div #box [ngClass]="{ 'p-checkbox-box': true, 'p-highlight': checked, 'p-focus': focused, 'p-indeterminate': partialChecked, 'p-disabled': disabled }" role="checkbox" [attr.aria-checked]="checked">
|
2659
2789
|
<ng-container *ngIf="!tt.checkboxIconTemplate">
|
2660
2790
|
<CheckIcon [styleClass]="'p-checkbox-icon'" *ngIf="checked" />
|
2661
|
-
<MinusIcon [styleClass]="'p-checkbox-icon'" *ngIf="
|
2791
|
+
<MinusIcon [styleClass]="'p-checkbox-icon'" *ngIf="partialChecked" />
|
2662
2792
|
</ng-container>
|
2663
2793
|
<span *ngIf="tt.checkboxIconTemplate">
|
2664
|
-
<ng-template *ngTemplateOutlet="tt.checkboxIconTemplate; context: { $implicit: checked, partialSelected:
|
2794
|
+
<ng-template *ngTemplateOutlet="tt.checkboxIconTemplate; context: { $implicit: checked, partialSelected: partialChecked }"></ng-template>
|
2665
2795
|
</span>
|
2666
2796
|
</div>
|
2667
2797
|
</div>
|
@@ -2675,13 +2805,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
2675
2805
|
<div class="p-hidden-accessible">
|
2676
2806
|
<input type="checkbox" [checked]="checked" (focus)="onFocus()" (blur)="onBlur()" />
|
2677
2807
|
</div>
|
2678
|
-
<div #box [ngClass]="{ 'p-checkbox-box': true, 'p-highlight': checked, 'p-focus': focused, 'p-indeterminate':
|
2808
|
+
<div #box [ngClass]="{ 'p-checkbox-box': true, 'p-highlight': checked, 'p-focus': focused, 'p-indeterminate': partialChecked, 'p-disabled': disabled }" role="checkbox" [attr.aria-checked]="checked">
|
2679
2809
|
<ng-container *ngIf="!tt.checkboxIconTemplate">
|
2680
2810
|
<CheckIcon [styleClass]="'p-checkbox-icon'" *ngIf="checked" />
|
2681
|
-
<MinusIcon [styleClass]="'p-checkbox-icon'" *ngIf="
|
2811
|
+
<MinusIcon [styleClass]="'p-checkbox-icon'" *ngIf="partialChecked" />
|
2682
2812
|
</ng-container>
|
2683
2813
|
<span *ngIf="tt.checkboxIconTemplate">
|
2684
|
-
<ng-template *ngTemplateOutlet="tt.checkboxIconTemplate; context: { $implicit: checked, partialSelected:
|
2814
|
+
<ng-template *ngTemplateOutlet="tt.checkboxIconTemplate; context: { $implicit: checked, partialSelected: partialChecked }"></ng-template>
|
2685
2815
|
</span>
|
2686
2816
|
</div>
|
2687
2817
|
</div>
|
@@ -2714,7 +2844,7 @@ class TTHeaderCheckbox {
|
|
2714
2844
|
this.checked = this.updateCheckedState();
|
2715
2845
|
}
|
2716
2846
|
onClick(event, checked) {
|
2717
|
-
if (this.tt.value && this.tt.value.length > 0) {
|
2847
|
+
if ((this.tt.value || this.tt.filteredNodes) && (this.tt.value.length > 0 || this.tt.filteredNodes.length > 0)) {
|
2718
2848
|
this.tt.toggleNodesWithCheckbox(event, !checked);
|
2719
2849
|
}
|
2720
2850
|
DomHandler.clearSelection();
|
@@ -2738,13 +2868,27 @@ class TTHeaderCheckbox {
|
|
2738
2868
|
let checked;
|
2739
2869
|
const data = this.tt.filteredNodes || this.tt.value;
|
2740
2870
|
if (data) {
|
2741
|
-
|
2742
|
-
|
2743
|
-
|
2871
|
+
if (this.tt.selectionKeys) {
|
2872
|
+
for (let node of data) {
|
2873
|
+
if (this.tt.isNodeSelected(node)) {
|
2874
|
+
checked = true;
|
2875
|
+
}
|
2876
|
+
else {
|
2877
|
+
checked = false;
|
2878
|
+
break;
|
2879
|
+
}
|
2744
2880
|
}
|
2745
|
-
|
2746
|
-
|
2747
|
-
|
2881
|
+
}
|
2882
|
+
if (!this.tt.selectionKeys) {
|
2883
|
+
// legacy selection support, will be removed in v18
|
2884
|
+
for (let node of data) {
|
2885
|
+
if (this.tt.isSelected(node)) {
|
2886
|
+
checked = true;
|
2887
|
+
}
|
2888
|
+
else {
|
2889
|
+
checked = false;
|
2890
|
+
break;
|
2891
|
+
}
|
2748
2892
|
}
|
2749
2893
|
}
|
2750
2894
|
}
|