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/fesm2020/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
|
}
|
@@ -809,7 +820,7 @@ class TreeTable {
|
|
809
820
|
if (selected && metaKey) {
|
810
821
|
if (this.isSingleSelectionMode()) {
|
811
822
|
this._selection = null;
|
812
|
-
this.
|
823
|
+
this.selectedKeys = {};
|
813
824
|
this.selectionChange.emit(null);
|
814
825
|
}
|
815
826
|
else {
|
@@ -817,7 +828,7 @@ class TreeTable {
|
|
817
828
|
this._selection = this.selection.filter((val, i) => i != selectionIndex);
|
818
829
|
this.selectionChange.emit(this.selection);
|
819
830
|
if (dataKeyValue) {
|
820
|
-
delete this.
|
831
|
+
delete this.selectedKeys[dataKeyValue];
|
821
832
|
}
|
822
833
|
}
|
823
834
|
this.onNodeUnselect.emit({ originalEvent: event.originalEvent, node: rowNode.node, type: 'row' });
|
@@ -827,8 +838,8 @@ class TreeTable {
|
|
827
838
|
this._selection = rowNode.node;
|
828
839
|
this.selectionChange.emit(rowNode.node);
|
829
840
|
if (dataKeyValue) {
|
830
|
-
this.
|
831
|
-
this.
|
841
|
+
this.selectedKeys = {};
|
842
|
+
this.selectedKeys[dataKeyValue] = 1;
|
832
843
|
}
|
833
844
|
}
|
834
845
|
else if (this.isMultipleSelectionMode()) {
|
@@ -837,12 +848,12 @@ class TreeTable {
|
|
837
848
|
}
|
838
849
|
else {
|
839
850
|
this._selection = [];
|
840
|
-
this.
|
851
|
+
this.selectedKeys = {};
|
841
852
|
}
|
842
853
|
this._selection = [...this.selection, rowNode.node];
|
843
854
|
this.selectionChange.emit(this.selection);
|
844
855
|
if (dataKeyValue) {
|
845
|
-
this.
|
856
|
+
this.selectedKeys[dataKeyValue] = 1;
|
846
857
|
}
|
847
858
|
}
|
848
859
|
this.onNodeSelect.emit({ originalEvent: event.originalEvent, node: rowNode.node, type: 'row', index: event.rowIndex });
|
@@ -852,7 +863,7 @@ class TreeTable {
|
|
852
863
|
if (this.selectionMode === 'single') {
|
853
864
|
if (selected) {
|
854
865
|
this._selection = null;
|
855
|
-
this.
|
866
|
+
this.selectedKeys = {};
|
856
867
|
this.selectionChange.emit(this.selection);
|
857
868
|
this.onNodeUnselect.emit({ originalEvent: event.originalEvent, node: rowNode.node, type: 'row' });
|
858
869
|
}
|
@@ -861,8 +872,8 @@ class TreeTable {
|
|
861
872
|
this.selectionChange.emit(this.selection);
|
862
873
|
this.onNodeSelect.emit({ originalEvent: event.originalEvent, node: rowNode.node, type: 'row', index: event.rowIndex });
|
863
874
|
if (dataKeyValue) {
|
864
|
-
this.
|
865
|
-
this.
|
875
|
+
this.selectedKeys = {};
|
876
|
+
this.selectedKeys[dataKeyValue] = 1;
|
866
877
|
}
|
867
878
|
}
|
868
879
|
}
|
@@ -873,7 +884,7 @@ class TreeTable {
|
|
873
884
|
this.selectionChange.emit(this.selection);
|
874
885
|
this.onNodeUnselect.emit({ originalEvent: event.originalEvent, node: rowNode.node, type: 'row' });
|
875
886
|
if (dataKeyValue) {
|
876
|
-
delete this.
|
887
|
+
delete this.selectedKeys[dataKeyValue];
|
877
888
|
}
|
878
889
|
}
|
879
890
|
else {
|
@@ -881,7 +892,7 @@ class TreeTable {
|
|
881
892
|
this.selectionChange.emit(this.selection);
|
882
893
|
this.onNodeSelect.emit({ originalEvent: event.originalEvent, node: rowNode.node, type: 'row', index: event.rowIndex });
|
883
894
|
if (dataKeyValue) {
|
884
|
-
this.
|
895
|
+
this.selectedKeys[dataKeyValue] = 1;
|
885
896
|
}
|
886
897
|
}
|
887
898
|
}
|
@@ -917,7 +928,7 @@ class TreeTable {
|
|
917
928
|
this.selectionChange.emit(this.selection);
|
918
929
|
}
|
919
930
|
if (dataKeyValue) {
|
920
|
-
this.
|
931
|
+
this.selectedKeys[dataKeyValue] = 1;
|
921
932
|
}
|
922
933
|
}
|
923
934
|
this.contextMenu.show(event.originalEvent);
|
@@ -926,6 +937,7 @@ class TreeTable {
|
|
926
937
|
}
|
927
938
|
}
|
928
939
|
toggleNodeWithCheckbox(event) {
|
940
|
+
// legacy selection support, will be removed in v18
|
929
941
|
this.selection = this.selection || [];
|
930
942
|
this.preventSelectionSetterPropagation = true;
|
931
943
|
let node = event.rowNode.node;
|
@@ -949,25 +961,40 @@ class TreeTable {
|
|
949
961
|
this.tableService.onSelectionChange();
|
950
962
|
}
|
951
963
|
toggleNodesWithCheckbox(event, check) {
|
964
|
+
// legacy selection support, will be removed in v18
|
952
965
|
let data = this.filteredNodes || this.value;
|
953
966
|
this._selection = check && data ? data.slice() : [];
|
954
|
-
|
967
|
+
this.toggleAll(check);
|
968
|
+
if (!check) {
|
969
|
+
this._selection = [];
|
970
|
+
this.selectedKeys = {};
|
971
|
+
}
|
972
|
+
this.preventSelectionSetterPropagation = true;
|
973
|
+
this.selectionChange.emit(this._selection);
|
974
|
+
this.tableService.onSelectionChange();
|
975
|
+
this.onHeaderCheckboxToggle.emit({ originalEvent: event, checked: check });
|
976
|
+
}
|
977
|
+
toggleAll(checked) {
|
978
|
+
let data = this.filteredNodes || this.value;
|
979
|
+
if (!this.selectionKeys) {
|
955
980
|
if (data && data.length) {
|
956
981
|
for (let node of data) {
|
957
|
-
this.propagateSelectionDown(node,
|
982
|
+
this.propagateSelectionDown(node, checked);
|
958
983
|
}
|
959
984
|
}
|
960
985
|
}
|
961
986
|
else {
|
962
|
-
|
963
|
-
|
987
|
+
// legacy selection support, will be removed in v18
|
988
|
+
if (data && data.length) {
|
989
|
+
for (let node of data) {
|
990
|
+
this.propagateDown(node, checked);
|
991
|
+
}
|
992
|
+
this.selectionKeysChange.emit(this.selectionKeys);
|
993
|
+
}
|
964
994
|
}
|
965
|
-
this.preventSelectionSetterPropagation = true;
|
966
|
-
this.selectionChange.emit(this._selection);
|
967
|
-
this.tableService.onSelectionChange();
|
968
|
-
this.onHeaderCheckboxToggle.emit({ originalEvent: event, checked: check });
|
969
995
|
}
|
970
996
|
propagateSelectionUp(node, select) {
|
997
|
+
// legacy selection support, will be removed in v18
|
971
998
|
if (node.children && node.children.length) {
|
972
999
|
let selectedChildCount = 0;
|
973
1000
|
let childPartialSelected = false;
|
@@ -982,7 +1009,7 @@ class TreeTable {
|
|
982
1009
|
this._selection = [...(this.selection || []), node];
|
983
1010
|
node.partialSelected = false;
|
984
1011
|
if (dataKeyValue) {
|
985
|
-
this.
|
1012
|
+
this.selectedKeys[dataKeyValue] = 1;
|
986
1013
|
}
|
987
1014
|
}
|
988
1015
|
else {
|
@@ -991,7 +1018,7 @@ class TreeTable {
|
|
991
1018
|
if (index >= 0) {
|
992
1019
|
this._selection = this.selection.filter((val, i) => i != index);
|
993
1020
|
if (dataKeyValue) {
|
994
|
-
delete this.
|
1021
|
+
delete this.selectedKeys[dataKeyValue];
|
995
1022
|
}
|
996
1023
|
}
|
997
1024
|
}
|
@@ -1002,26 +1029,29 @@ class TreeTable {
|
|
1002
1029
|
}
|
1003
1030
|
}
|
1004
1031
|
let parent = node.parent;
|
1032
|
+
node.checked = select;
|
1005
1033
|
if (parent) {
|
1006
1034
|
this.propagateSelectionUp(parent, select);
|
1007
1035
|
}
|
1008
1036
|
}
|
1009
1037
|
propagateSelectionDown(node, select) {
|
1038
|
+
// legacy selection support, will be removed in v18
|
1010
1039
|
let index = this.findIndexInSelection(node);
|
1011
1040
|
let dataKeyValue = this.dataKey ? String(ObjectUtils.resolveFieldData(node.data, this.dataKey)) : null;
|
1012
1041
|
if (select && index == -1) {
|
1013
1042
|
this._selection = [...(this.selection || []), node];
|
1014
1043
|
if (dataKeyValue) {
|
1015
|
-
this.
|
1044
|
+
this.selectedKeys[dataKeyValue] = 1;
|
1016
1045
|
}
|
1017
1046
|
}
|
1018
1047
|
else if (!select && index > -1) {
|
1019
1048
|
this._selection = this.selection.filter((val, i) => i != index);
|
1020
1049
|
if (dataKeyValue) {
|
1021
|
-
delete this.
|
1050
|
+
delete this.selectedKeys[dataKeyValue];
|
1022
1051
|
}
|
1023
1052
|
}
|
1024
1053
|
node.partialSelected = false;
|
1054
|
+
node.checked = select;
|
1025
1055
|
if (node.children && node.children.length) {
|
1026
1056
|
for (let child of node.children) {
|
1027
1057
|
this.propagateSelectionDown(child, select);
|
@@ -1029,9 +1059,15 @@ class TreeTable {
|
|
1029
1059
|
}
|
1030
1060
|
}
|
1031
1061
|
isSelected(node) {
|
1062
|
+
// legacy selection support, will be removed in v18
|
1032
1063
|
if (node && this.selection) {
|
1033
1064
|
if (this.dataKey) {
|
1034
|
-
|
1065
|
+
if (node.hasOwnProperty('checked')) {
|
1066
|
+
return node['checked'];
|
1067
|
+
}
|
1068
|
+
else {
|
1069
|
+
return this.selectedKeys[ObjectUtils.resolveFieldData(node.data, this.dataKey)] !== undefined;
|
1070
|
+
}
|
1035
1071
|
}
|
1036
1072
|
else {
|
1037
1073
|
if (Array.isArray(this.selection))
|
@@ -1042,6 +1078,69 @@ class TreeTable {
|
|
1042
1078
|
}
|
1043
1079
|
return false;
|
1044
1080
|
}
|
1081
|
+
isNodeSelected(node) {
|
1082
|
+
return this.selectionMode && this.selectionKeys ? this.selectionKeys[this.nodeKey(node)]?.checked === true : false;
|
1083
|
+
}
|
1084
|
+
isNodePartialSelected(node) {
|
1085
|
+
return this.selectionMode && this.selectionKeys ? this.selectionKeys[this.nodeKey(node)]?.partialChecked === true : false;
|
1086
|
+
}
|
1087
|
+
nodeKey(node) {
|
1088
|
+
return ObjectUtils.resolveFieldData(node, this.dataKey) || ObjectUtils.resolveFieldData(node?.data, this.dataKey);
|
1089
|
+
}
|
1090
|
+
toggleCheckbox(event) {
|
1091
|
+
let { rowNode, check, originalEvent } = event;
|
1092
|
+
let node = rowNode.node;
|
1093
|
+
if (this.selectionKeys) {
|
1094
|
+
this.propagateDown(node, check);
|
1095
|
+
if (node.parent) {
|
1096
|
+
this.propagateUp(node.parent, check);
|
1097
|
+
}
|
1098
|
+
this.selectionKeysChange.emit(this.selectionKeys);
|
1099
|
+
}
|
1100
|
+
else {
|
1101
|
+
this.toggleNodeWithCheckbox({ originalEvent, rowNode });
|
1102
|
+
}
|
1103
|
+
this.tableService.onSelectionChange();
|
1104
|
+
}
|
1105
|
+
propagateDown(node, check) {
|
1106
|
+
if (check) {
|
1107
|
+
this.selectionKeys[this.nodeKey(node)] = { checked: true, partialChecked: false };
|
1108
|
+
}
|
1109
|
+
else {
|
1110
|
+
delete this.selectionKeys[this.nodeKey(node)];
|
1111
|
+
}
|
1112
|
+
if (node.children && node.children.length) {
|
1113
|
+
for (let child of node.children) {
|
1114
|
+
this.propagateDown(child, check);
|
1115
|
+
}
|
1116
|
+
}
|
1117
|
+
}
|
1118
|
+
propagateUp(node, check) {
|
1119
|
+
let checkedChildCount = 0;
|
1120
|
+
let childPartialSelected = false;
|
1121
|
+
for (let child of node.children) {
|
1122
|
+
if (this.selectionKeys[this.nodeKey(child)] && this.selectionKeys[this.nodeKey(child)].checked)
|
1123
|
+
checkedChildCount++;
|
1124
|
+
else if (this.selectionKeys[this.nodeKey(child)] && this.selectionKeys[this.nodeKey(child)].partialChecked)
|
1125
|
+
childPartialSelected = true;
|
1126
|
+
}
|
1127
|
+
if (check && checkedChildCount === node.children.length) {
|
1128
|
+
this.selectionKeys[this.nodeKey(node)] = { checked: true, partialChecked: false };
|
1129
|
+
}
|
1130
|
+
else {
|
1131
|
+
if (!check) {
|
1132
|
+
delete this.selectionKeys[this.nodeKey(node)];
|
1133
|
+
}
|
1134
|
+
if (childPartialSelected || (checkedChildCount > 0 && checkedChildCount !== node.children.length))
|
1135
|
+
this.selectionKeys[this.nodeKey(node)] = { checked: false, partialChecked: true };
|
1136
|
+
else
|
1137
|
+
this.selectionKeys[this.nodeKey(node)] = { checked: false, partialChecked: false };
|
1138
|
+
}
|
1139
|
+
let parent = node.parent;
|
1140
|
+
if (parent) {
|
1141
|
+
this.propagateUp(parent, check);
|
1142
|
+
}
|
1143
|
+
}
|
1045
1144
|
findIndexInSelection(node) {
|
1046
1145
|
let index = -1;
|
1047
1146
|
if (this.selection && this.selection.length) {
|
@@ -1061,7 +1160,7 @@ class TreeTable {
|
|
1061
1160
|
return this.selectionMode === 'multiple';
|
1062
1161
|
}
|
1063
1162
|
equals(node1, node2) {
|
1064
|
-
return this.compareSelectionBy === 'equals' ? node1
|
1163
|
+
return this.compareSelectionBy === 'equals' ? ObjectUtils.equals(node1, node2) : ObjectUtils.equals(node1.data, node2.data, this.dataKey);
|
1065
1164
|
}
|
1066
1165
|
filter(value, field, matchMode) {
|
1067
1166
|
if (this.filterTimeout) {
|
@@ -1277,7 +1376,7 @@ class TreeTable {
|
|
1277
1376
|
}
|
1278
1377
|
}
|
1279
1378
|
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 });
|
1280
|
-
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: `
|
1379
|
+
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: `
|
1281
1380
|
<div
|
1282
1381
|
#container
|
1283
1382
|
[ngStyle]="style"
|
@@ -1712,6 +1811,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
1712
1811
|
type: Output
|
1713
1812
|
}], onEditCancel: [{
|
1714
1813
|
type: Output
|
1814
|
+
}], selectionKeysChange: [{
|
1815
|
+
type: Output
|
1715
1816
|
}], containerViewChild: [{
|
1716
1817
|
type: ViewChild,
|
1717
1818
|
args: ['container']
|
@@ -1736,6 +1837,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
1736
1837
|
}], templates: [{
|
1737
1838
|
type: ContentChildren,
|
1738
1839
|
args: [PrimeTemplate]
|
1840
|
+
}], selectionKeys: [{
|
1841
|
+
type: Input
|
1739
1842
|
}], virtualRowHeight: [{
|
1740
1843
|
type: Input
|
1741
1844
|
}], value: [{
|
@@ -2617,19 +2720,44 @@ class TTCheckbox {
|
|
2617
2720
|
this.tableService = tableService;
|
2618
2721
|
this.cd = cd;
|
2619
2722
|
this.subscription = this.tt.tableService.selectionSource$.subscribe(() => {
|
2620
|
-
|
2723
|
+
if (this.tt.selectionKeys) {
|
2724
|
+
this.checked = this.tt.isNodeSelected(this.rowNode.node);
|
2725
|
+
this.partialChecked = this.tt.isNodePartialSelected(this.rowNode.node);
|
2726
|
+
}
|
2727
|
+
else {
|
2728
|
+
this.checked = this.tt.isSelected(this.rowNode.node);
|
2729
|
+
this.partialChecked = this.rowNode.node.partialSelected;
|
2730
|
+
}
|
2621
2731
|
this.cd.markForCheck();
|
2622
2732
|
});
|
2623
2733
|
}
|
2624
2734
|
ngOnInit() {
|
2625
|
-
|
2735
|
+
if (this.tt.selectionKeys) {
|
2736
|
+
this.checked = this.tt.isNodeSelected(this.rowNode.node);
|
2737
|
+
this.partialChecked = this.tt.isNodePartialSelected(this.rowNode.node);
|
2738
|
+
}
|
2739
|
+
else {
|
2740
|
+
// for backward compatibility
|
2741
|
+
this.checked = this.tt.isSelected(this.rowNode.node);
|
2742
|
+
this.partialChecked = this.rowNode.node.partialSelected;
|
2743
|
+
}
|
2626
2744
|
}
|
2627
2745
|
onClick(event) {
|
2628
2746
|
if (!this.disabled) {
|
2629
|
-
this.tt.
|
2630
|
-
|
2631
|
-
|
2632
|
-
|
2747
|
+
if (this.tt.selectionKeys) {
|
2748
|
+
const _check = !this.checked;
|
2749
|
+
this.tt.toggleCheckbox({
|
2750
|
+
originalEvent: event,
|
2751
|
+
check: _check,
|
2752
|
+
rowNode: this.rowNode
|
2753
|
+
});
|
2754
|
+
}
|
2755
|
+
else {
|
2756
|
+
this.tt.toggleNodeWithCheckbox({
|
2757
|
+
originalEvent: event,
|
2758
|
+
rowNode: this.rowNode
|
2759
|
+
});
|
2760
|
+
}
|
2633
2761
|
}
|
2634
2762
|
DomHandler.clearSelection();
|
2635
2763
|
}
|
@@ -2651,13 +2779,13 @@ TTCheckbox.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "1
|
|
2651
2779
|
<div class="p-hidden-accessible">
|
2652
2780
|
<input type="checkbox" [checked]="checked" (focus)="onFocus()" (blur)="onBlur()" />
|
2653
2781
|
</div>
|
2654
|
-
<div #box [ngClass]="{ 'p-checkbox-box': true, 'p-highlight': checked, 'p-focus': focused, 'p-indeterminate':
|
2782
|
+
<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">
|
2655
2783
|
<ng-container *ngIf="!tt.checkboxIconTemplate">
|
2656
2784
|
<CheckIcon [styleClass]="'p-checkbox-icon'" *ngIf="checked" />
|
2657
|
-
<MinusIcon [styleClass]="'p-checkbox-icon'" *ngIf="
|
2785
|
+
<MinusIcon [styleClass]="'p-checkbox-icon'" *ngIf="partialChecked" />
|
2658
2786
|
</ng-container>
|
2659
2787
|
<span *ngIf="tt.checkboxIconTemplate">
|
2660
|
-
<ng-template *ngTemplateOutlet="tt.checkboxIconTemplate; context: { $implicit: checked, partialSelected:
|
2788
|
+
<ng-template *ngTemplateOutlet="tt.checkboxIconTemplate; context: { $implicit: checked, partialSelected: partialChecked }"></ng-template>
|
2661
2789
|
</span>
|
2662
2790
|
</div>
|
2663
2791
|
</div>
|
@@ -2671,13 +2799,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
2671
2799
|
<div class="p-hidden-accessible">
|
2672
2800
|
<input type="checkbox" [checked]="checked" (focus)="onFocus()" (blur)="onBlur()" />
|
2673
2801
|
</div>
|
2674
|
-
<div #box [ngClass]="{ 'p-checkbox-box': true, 'p-highlight': checked, 'p-focus': focused, 'p-indeterminate':
|
2802
|
+
<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">
|
2675
2803
|
<ng-container *ngIf="!tt.checkboxIconTemplate">
|
2676
2804
|
<CheckIcon [styleClass]="'p-checkbox-icon'" *ngIf="checked" />
|
2677
|
-
<MinusIcon [styleClass]="'p-checkbox-icon'" *ngIf="
|
2805
|
+
<MinusIcon [styleClass]="'p-checkbox-icon'" *ngIf="partialChecked" />
|
2678
2806
|
</ng-container>
|
2679
2807
|
<span *ngIf="tt.checkboxIconTemplate">
|
2680
|
-
<ng-template *ngTemplateOutlet="tt.checkboxIconTemplate; context: { $implicit: checked, partialSelected:
|
2808
|
+
<ng-template *ngTemplateOutlet="tt.checkboxIconTemplate; context: { $implicit: checked, partialSelected: partialChecked }"></ng-template>
|
2681
2809
|
</span>
|
2682
2810
|
</div>
|
2683
2811
|
</div>
|
@@ -2710,7 +2838,7 @@ class TTHeaderCheckbox {
|
|
2710
2838
|
this.checked = this.updateCheckedState();
|
2711
2839
|
}
|
2712
2840
|
onClick(event, checked) {
|
2713
|
-
if (this.tt.value && this.tt.value.length > 0) {
|
2841
|
+
if ((this.tt.value || this.tt.filteredNodes) && (this.tt.value.length > 0 || this.tt.filteredNodes.length > 0)) {
|
2714
2842
|
this.tt.toggleNodesWithCheckbox(event, !checked);
|
2715
2843
|
}
|
2716
2844
|
DomHandler.clearSelection();
|
@@ -2734,13 +2862,27 @@ class TTHeaderCheckbox {
|
|
2734
2862
|
let checked;
|
2735
2863
|
const data = this.tt.filteredNodes || this.tt.value;
|
2736
2864
|
if (data) {
|
2737
|
-
|
2738
|
-
|
2739
|
-
|
2865
|
+
if (this.tt.selectionKeys) {
|
2866
|
+
for (let node of data) {
|
2867
|
+
if (this.tt.isNodeSelected(node)) {
|
2868
|
+
checked = true;
|
2869
|
+
}
|
2870
|
+
else {
|
2871
|
+
checked = false;
|
2872
|
+
break;
|
2873
|
+
}
|
2740
2874
|
}
|
2741
|
-
|
2742
|
-
|
2743
|
-
|
2875
|
+
}
|
2876
|
+
if (!this.tt.selectionKeys) {
|
2877
|
+
// legacy selection support, will be removed in v18
|
2878
|
+
for (let node of data) {
|
2879
|
+
if (this.tt.isSelected(node)) {
|
2880
|
+
checked = true;
|
2881
|
+
}
|
2882
|
+
else {
|
2883
|
+
checked = false;
|
2884
|
+
break;
|
2885
|
+
}
|
2744
2886
|
}
|
2745
2887
|
}
|
2746
2888
|
}
|