primeng 7.1.3 → 8.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.editorconfig +1 -1
- package/CHANGELOG.md +119 -0
- package/README.md +1 -1
- package/browserslist +12 -0
- package/components/accordion/accordion.d.ts +4 -2
- package/components/accordion/accordion.js +24 -7
- package/components/accordion/accordion.js.map +1 -1
- package/components/accordion/accordion.metadata.json +1 -1
- package/components/autocomplete/autocomplete.d.ts +2 -0
- package/components/autocomplete/autocomplete.js +13 -5
- package/components/autocomplete/autocomplete.js.map +1 -1
- package/components/autocomplete/autocomplete.metadata.json +1 -1
- package/components/blockui/blockui.js +2 -2
- package/components/blockui/blockui.js.map +1 -1
- package/components/blockui/blockui.metadata.json +1 -1
- package/components/button/button.d.ts +1 -1
- package/components/button/button.js.map +1 -1
- package/components/calendar/calendar.d.ts +5 -2
- package/components/calendar/calendar.js +47 -23
- package/components/calendar/calendar.js.map +1 -1
- package/components/calendar/calendar.metadata.json +1 -1
- package/components/card/card.js +2 -2
- package/components/card/card.js.map +1 -1
- package/components/card/card.metadata.json +1 -1
- package/components/carousel/carousel.js +4 -4
- package/components/carousel/carousel.js.map +1 -1
- package/components/carousel/carousel.metadata.json +1 -1
- package/components/chart/chart.js +1 -0
- package/components/chart/chart.js.map +1 -1
- package/components/chart/chart.metadata.json +1 -1
- package/components/chips/chips.js +1 -1
- package/components/chips/chips.js.map +1 -1
- package/components/chips/chips.metadata.json +1 -1
- package/components/colorpicker/colorpicker.js +5 -5
- package/components/colorpicker/colorpicker.js.map +1 -1
- package/components/colorpicker/colorpicker.metadata.json +1 -1
- package/components/common/confirmationservice.d.ts +2 -2
- package/components/common/messageservice.d.ts +2 -2
- package/components/common/shared.js +1 -1
- package/components/common/shared.js.map +1 -1
- package/components/common/shared.metadata.json +1 -1
- package/components/common/treedragdropservice.d.ts +2 -2
- package/components/confirmdialog/confirmdialog.js +4 -4
- package/components/confirmdialog/confirmdialog.js.map +1 -1
- package/components/confirmdialog/confirmdialog.metadata.json +1 -1
- package/components/contextmenu/contextmenu.d.ts +5 -3
- package/components/contextmenu/contextmenu.js +14 -2
- package/components/contextmenu/contextmenu.js.map +1 -1
- package/components/contextmenu/contextmenu.metadata.json +1 -1
- package/components/datagrid/datagrid.d.ts +1 -1
- package/components/datagrid/datagrid.js +2 -2
- package/components/datagrid/datagrid.js.map +1 -1
- package/components/datagrid/datagrid.metadata.json +1 -1
- package/components/datalist/datalist.d.ts +1 -1
- package/components/datalist/datalist.js +2 -2
- package/components/datalist/datalist.js.map +1 -1
- package/components/datalist/datalist.metadata.json +1 -1
- package/components/datascroller/datascroller.js +3 -3
- package/components/datascroller/datascroller.js.map +1 -1
- package/components/datascroller/datascroller.metadata.json +1 -1
- package/components/dataview/dataview.d.ts +2 -1
- package/components/dataview/dataview.js +8 -3
- package/components/dataview/dataview.js.map +1 -1
- package/components/dataview/dataview.metadata.json +1 -1
- package/components/defer/defer.js +1 -1
- package/components/defer/defer.js.map +1 -1
- package/components/defer/defer.metadata.json +1 -1
- package/components/dialog/dialog.d.ts +0 -1
- package/components/dialog/dialog.js +4 -14
- package/components/dialog/dialog.js.map +1 -1
- package/components/dialog/dialog.metadata.json +1 -1
- package/components/dom/domhandler.d.ts +1 -0
- package/components/dom/domhandler.js +11 -1
- package/components/dom/domhandler.js.map +1 -1
- package/components/dropdown/dropdown.d.ts +6 -1
- package/components/dropdown/dropdown.js +41 -10
- package/components/dropdown/dropdown.js.map +1 -1
- package/components/dropdown/dropdown.metadata.json +1 -1
- package/components/dynamicdialog/dynamicdialog.js +2 -2
- package/components/dynamicdialog/dynamicdialog.js.map +1 -1
- package/components/dynamicdialog/dynamicdialog.metadata.json +1 -1
- package/components/editor/editor.js +2 -1
- package/components/editor/editor.js.map +1 -1
- package/components/editor/editor.metadata.json +1 -1
- package/components/fieldset/fieldset.js +8 -3
- package/components/fieldset/fieldset.js.map +1 -1
- package/components/fieldset/fieldset.metadata.json +1 -1
- package/components/fileupload/fileupload.d.ts +11 -2
- package/components/fileupload/fileupload.js +83 -15
- package/components/fileupload/fileupload.js.map +1 -1
- package/components/fileupload/fileupload.metadata.json +1 -1
- package/components/focustrap/focustrap.d.ts +8 -0
- package/components/focustrap/focustrap.js +73 -0
- package/components/focustrap/focustrap.js.map +1 -0
- package/components/focustrap/focustrap.metadata.json +1 -0
- package/components/growl/growl.js +1 -1
- package/components/growl/growl.js.map +1 -1
- package/components/growl/growl.metadata.json +1 -1
- package/components/inputmask/inputmask.d.ts +1 -0
- package/components/inputmask/inputmask.js +7 -3
- package/components/inputmask/inputmask.js.map +1 -1
- package/components/inputmask/inputmask.metadata.json +1 -1
- package/components/keyfilter/keyfilter.d.ts +8 -1
- package/components/keyfilter/keyfilter.js +59 -3
- package/components/keyfilter/keyfilter.js.map +1 -1
- package/components/keyfilter/keyfilter.metadata.json +1 -1
- package/components/lightbox/lightbox.d.ts +4 -0
- package/components/lightbox/lightbox.js +39 -20
- package/components/lightbox/lightbox.js.map +1 -1
- package/components/lightbox/lightbox.metadata.json +1 -1
- package/components/listbox/listbox.js +3 -3
- package/components/listbox/listbox.js.map +1 -1
- package/components/listbox/listbox.metadata.json +1 -1
- package/components/menu/menu.d.ts +2 -2
- package/components/menu/menu.js +2 -2
- package/components/menu/menu.js.map +1 -1
- package/components/menu/menu.metadata.json +1 -1
- package/components/multiselect/multiselect.d.ts +4 -0
- package/components/multiselect/multiselect.js +51 -12
- package/components/multiselect/multiselect.js.map +1 -1
- package/components/multiselect/multiselect.metadata.json +1 -1
- package/components/orderlist/orderlist.js +2 -1
- package/components/orderlist/orderlist.js.map +1 -1
- package/components/orderlist/orderlist.metadata.json +1 -1
- package/components/organizationchart/organizationchart.d.ts +4 -2
- package/components/organizationchart/organizationchart.js +15 -1
- package/components/organizationchart/organizationchart.js.map +1 -1
- package/components/organizationchart/organizationchart.metadata.json +1 -1
- package/components/overlaypanel/overlaypanel.d.ts +2 -0
- package/components/overlaypanel/overlaypanel.js +8 -3
- package/components/overlaypanel/overlaypanel.js.map +1 -1
- package/components/overlaypanel/overlaypanel.metadata.json +1 -1
- package/components/paginator/paginator.d.ts +4 -2
- package/components/paginator/paginator.js +25 -9
- package/components/paginator/paginator.js.map +1 -1
- package/components/paginator/paginator.metadata.json +1 -1
- package/components/panel/panel.js +9 -3
- package/components/panel/panel.js.map +1 -1
- package/components/panel/panel.metadata.json +1 -1
- package/components/panelmenu/panelmenu.js +15 -5
- package/components/panelmenu/panelmenu.js.map +1 -1
- package/components/panelmenu/panelmenu.metadata.json +1 -1
- package/components/picklist/picklist.js +4 -4
- package/components/picklist/picklist.js.map +1 -1
- package/components/picklist/picklist.metadata.json +1 -1
- package/components/radiobutton/radiobutton.js +2 -2
- package/components/radiobutton/radiobutton.js.map +1 -1
- package/components/radiobutton/radiobutton.metadata.json +1 -1
- package/components/scrollpanel/scrollpanel.js +4 -4
- package/components/scrollpanel/scrollpanel.js.map +1 -1
- package/components/scrollpanel/scrollpanel.metadata.json +1 -1
- package/components/selectbutton/selectbutton.js +1 -1
- package/components/selectbutton/selectbutton.js.map +1 -1
- package/components/selectbutton/selectbutton.metadata.json +1 -1
- package/components/sidebar/sidebar.d.ts +6 -0
- package/components/sidebar/sidebar.js +40 -3
- package/components/sidebar/sidebar.js.map +1 -1
- package/components/sidebar/sidebar.metadata.json +1 -1
- package/components/slidemenu/slidemenu.d.ts +2 -2
- package/components/slidemenu/slidemenu.js +6 -6
- package/components/slidemenu/slidemenu.js.map +1 -1
- package/components/slidemenu/slidemenu.metadata.json +1 -1
- package/components/spinner/spinner.d.ts +11 -5
- package/components/spinner/spinner.js +54 -40
- package/components/spinner/spinner.js.map +1 -1
- package/components/spinner/spinner.metadata.json +1 -1
- package/components/splitbutton/splitbutton.js +2 -2
- package/components/splitbutton/splitbutton.js.map +1 -1
- package/components/splitbutton/splitbutton.metadata.json +1 -1
- package/components/table/table.d.ts +13 -14
- package/components/table/table.js +59 -59
- package/components/table/table.js.map +1 -1
- package/components/table/table.metadata.json +1 -1
- package/components/terminal/terminalservice.d.ts +2 -2
- package/components/tieredmenu/tieredmenu.d.ts +2 -2
- package/components/tieredmenu/tieredmenu.js +2 -2
- package/components/tieredmenu/tieredmenu.js.map +1 -1
- package/components/tieredmenu/tieredmenu.metadata.json +1 -1
- package/components/toast/toast.js +2 -2
- package/components/toast/toast.js.map +1 -1
- package/components/toast/toast.metadata.json +1 -1
- package/components/togglebutton/togglebutton.js +7 -3
- package/components/togglebutton/togglebutton.js.map +1 -1
- package/components/togglebutton/togglebutton.metadata.json +1 -1
- package/components/tree/tree.d.ts +2 -2
- package/components/tree/tree.js +1 -1
- package/components/tree/tree.js.map +1 -1
- package/components/tree/tree.metadata.json +1 -1
- package/components/treetable/treetable.d.ts +6 -6
- package/components/treetable/treetable.js +22 -16
- package/components/treetable/treetable.js.map +1 -1
- package/components/treetable/treetable.metadata.json +1 -1
- package/components/utils/objectutils.js +3 -5
- package/components/utils/objectutils.js.map +1 -1
- package/components/virtualscroller/virtualscroller.js +3 -3
- package/components/virtualscroller/virtualscroller.js.map +1 -1
- package/components/virtualscroller/virtualscroller.metadata.json +1 -1
- package/focustrap.d.ts +1 -0
- package/{datatable.js → focustrap.js} +1 -1
- package/package.json +35 -39
- package/primeng.d.ts +0 -1
- package/primeng.js +0 -1
- package/resources/components/dropdown/dropdown.css +15 -0
- package/resources/components/inputtextarea/inputtextarea.css +12 -7
- package/resources/components/lightbox/lightbox.css +3 -0
- package/resources/components/multiselect/multiselect.css +4 -0
- package/resources/primeng.css +780 -1123
- package/resources/primeng.min.css +1 -1
- package/tsconfig.app.json +15 -0
- package/tsconfig.spec.json +19 -0
- package/components/datatable/datatable.d.ts +0 -353
- package/components/datatable/datatable.js +0 -2402
- package/components/datatable/datatable.js.map +0 -1
- package/components/datatable/datatable.metadata.json +0 -1
- package/datatable.d.ts +0 -1
- package/resources/components/datatable/datatable.css +0 -370
- package/resources/themes/_theme.scss +0 -857
- package/resources/themes/bootstrap/theme.css +0 -2248
- package/resources/themes/cruze/theme.css +0 -881
- package/resources/themes/cruze/theme.scss +0 -61
- package/resources/themes/cupertino/theme.css +0 -881
- package/resources/themes/cupertino/theme.scss +0 -61
- package/resources/themes/darkness/theme.css +0 -881
- package/resources/themes/darkness/theme.scss +0 -61
- package/resources/themes/flick/theme.css +0 -881
- package/resources/themes/flick/theme.scss +0 -61
- package/resources/themes/home/theme.css +0 -881
- package/resources/themes/home/theme.scss +0 -61
- package/resources/themes/kasper/theme.css +0 -881
- package/resources/themes/kasper/theme.scss +0 -61
- package/resources/themes/lightness/theme.css +0 -881
- package/resources/themes/lightness/theme.scss +0 -61
- package/resources/themes/ludvig/theme.css +0 -881
- package/resources/themes/ludvig/theme.scss +0 -61
- package/resources/themes/omega/fonts/roboto-v15-latin-regular.eot +0 -0
- package/resources/themes/omega/fonts/roboto-v15-latin-regular.svg +0 -308
- package/resources/themes/omega/fonts/roboto-v15-latin-regular.ttf +0 -0
- package/resources/themes/omega/fonts/roboto-v15-latin-regular.woff +0 -0
- package/resources/themes/omega/fonts/roboto-v15-latin-regular.woff2 +0 -0
- package/resources/themes/omega/images/icons_16.png +0 -0
- package/resources/themes/omega/images/slider_handles.png +0 -0
- package/resources/themes/omega/images/slider_handles@2x.png +0 -0
- package/resources/themes/omega/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- package/resources/themes/omega/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- package/resources/themes/omega/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- package/resources/themes/omega/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- package/resources/themes/omega/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- package/resources/themes/omega/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- package/resources/themes/omega/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- package/resources/themes/omega/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- package/resources/themes/omega/images/ui-icons_222222_256x240.png +0 -0
- package/resources/themes/omega/images/ui-icons_2e83ff_256x240.png +0 -0
- package/resources/themes/omega/images/ui-icons_454545_256x240.png +0 -0
- package/resources/themes/omega/images/ui-icons_cd0a0a_256x240.png +0 -0
- package/resources/themes/omega/images/ui-icons_ffffff_256x240.png +0 -0
- package/resources/themes/omega/theme.css +0 -1457
- package/resources/themes/omega/theme.scss +0 -641
- package/resources/themes/pepper-grinder/theme.css +0 -881
- package/resources/themes/pepper-grinder/theme.scss +0 -61
- package/resources/themes/redmond/theme.css +0 -881
- package/resources/themes/redmond/theme.scss +0 -61
- package/resources/themes/rocket/theme.css +0 -881
- package/resources/themes/rocket/theme.scss +0 -61
- package/resources/themes/south-street/theme.css +0 -887
- package/resources/themes/south-street/theme.scss +0 -67
- package/resources/themes/start/theme.css +0 -881
- package/resources/themes/start/theme.scss +0 -61
- package/resources/themes/trontastic/theme.css +0 -881
- package/resources/themes/trontastic/theme.scss +0 -61
- package/resources/themes/voclain/theme.css +0 -881
- package/resources/themes/voclain/theme.scss +0 -61
@@ -1,2402 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
7
|
-
};
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
10
|
-
};
|
11
|
-
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
12
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
13
|
-
};
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
15
|
-
var core_1 = require("@angular/core");
|
16
|
-
var common_1 = require("@angular/common");
|
17
|
-
var forms_1 = require("@angular/forms");
|
18
|
-
var shared_1 = require("../common/shared");
|
19
|
-
var paginator_1 = require("../paginator/paginator");
|
20
|
-
var shared_2 = require("../common/shared");
|
21
|
-
var domhandler_1 = require("../dom/domhandler");
|
22
|
-
var objectutils_1 = require("../utils/objectutils");
|
23
|
-
var DTRadioButton = /** @class */ (function () {
|
24
|
-
function DTRadioButton() {
|
25
|
-
this.onClick = new core_1.EventEmitter();
|
26
|
-
}
|
27
|
-
DTRadioButton.prototype.handleClick = function (event) {
|
28
|
-
this.onClick.emit(event);
|
29
|
-
};
|
30
|
-
__decorate([
|
31
|
-
core_1.Input(),
|
32
|
-
__metadata("design:type", Boolean)
|
33
|
-
], DTRadioButton.prototype, "checked", void 0);
|
34
|
-
__decorate([
|
35
|
-
core_1.Output(),
|
36
|
-
__metadata("design:type", core_1.EventEmitter)
|
37
|
-
], DTRadioButton.prototype, "onClick", void 0);
|
38
|
-
DTRadioButton = __decorate([
|
39
|
-
core_1.Component({
|
40
|
-
selector: 'p-dtRadioButton',
|
41
|
-
template: "\n <div class=\"ui-radiobutton ui-widget\">\n <div class=\"ui-helper-hidden-accessible\">\n <input type=\"radio\" [checked]=\"checked\">\n </div>\n <div class=\"ui-radiobutton-box ui-widget ui-radiobutton-relative ui-state-default\" (click)=\"handleClick($event)\"\n [ngClass]=\"{'ui-state-active':checked}\">\n <span class=\"ui-radiobutton-icon ui-clickable\" [ngClass]=\"{'fa fa-circle':checked}\"></span>\n </div>\n </div>\n "
|
42
|
-
})
|
43
|
-
], DTRadioButton);
|
44
|
-
return DTRadioButton;
|
45
|
-
}());
|
46
|
-
exports.DTRadioButton = DTRadioButton;
|
47
|
-
var DTCheckbox = /** @class */ (function () {
|
48
|
-
function DTCheckbox() {
|
49
|
-
this.onChange = new core_1.EventEmitter();
|
50
|
-
}
|
51
|
-
DTCheckbox.prototype.handleClick = function (event) {
|
52
|
-
if (!this.disabled) {
|
53
|
-
this.onChange.emit({ originalEvent: event, checked: !this.checked });
|
54
|
-
}
|
55
|
-
};
|
56
|
-
__decorate([
|
57
|
-
core_1.Input(),
|
58
|
-
__metadata("design:type", Boolean)
|
59
|
-
], DTCheckbox.prototype, "checked", void 0);
|
60
|
-
__decorate([
|
61
|
-
core_1.Input(),
|
62
|
-
__metadata("design:type", Boolean)
|
63
|
-
], DTCheckbox.prototype, "disabled", void 0);
|
64
|
-
__decorate([
|
65
|
-
core_1.Output(),
|
66
|
-
__metadata("design:type", core_1.EventEmitter)
|
67
|
-
], DTCheckbox.prototype, "onChange", void 0);
|
68
|
-
DTCheckbox = __decorate([
|
69
|
-
core_1.Component({
|
70
|
-
selector: 'p-dtCheckbox',
|
71
|
-
template: "\n <div class=\"ui-chkbox ui-widget\">\n <div class=\"ui-helper-hidden-accessible\">\n <input type=\"checkbox\" [checked]=\"checked\">\n </div>\n <div class=\"ui-chkbox-box ui-widget ui-corner-all ui-state-default\" (click)=\"handleClick($event)\"\n [ngClass]=\"{'ui-state-active':checked&&!disabled,'ui-state-disabled':disabled}\">\n <span class=\"ui-chkbox-icon ui-clickable\" [ngClass]=\"{'fa fa-check':checked}\"></span>\n </div>\n </div>\n "
|
72
|
-
})
|
73
|
-
], DTCheckbox);
|
74
|
-
return DTCheckbox;
|
75
|
-
}());
|
76
|
-
exports.DTCheckbox = DTCheckbox;
|
77
|
-
var ColumnHeaders = /** @class */ (function () {
|
78
|
-
function ColumnHeaders(dt) {
|
79
|
-
this.dt = dt;
|
80
|
-
}
|
81
|
-
__decorate([
|
82
|
-
core_1.Input("pColumnHeaders"),
|
83
|
-
__metadata("design:type", Array)
|
84
|
-
], ColumnHeaders.prototype, "columns", void 0);
|
85
|
-
ColumnHeaders = __decorate([
|
86
|
-
core_1.Component({
|
87
|
-
selector: '[pColumnHeaders]',
|
88
|
-
template: "\n <ng-template ngFor let-col [ngForOf]=\"columns\" let-lastCol=\"last\">\n <th #headerCell [attr.id]=\"col.colId\" [ngStyle]=\"col.headerStyle||col.style\" [class]=\"col.headerStyleClass||col.styleClass\" (click)=\"dt.sort($event,col)\" [attr.colspan]=\"col.colspan\" [attr.rowspan]=\"col.rowspan\"\n [ngClass]=\"{'ui-state-default ui-unselectable-text':true, 'ui-sortable-column': col.sortable, 'ui-state-active': dt.isSorted(col), 'ui-resizable-column': dt.resizableColumns, 'ui-selection-column':col.selectionMode,\n 'ui-helper-hidden': col.hidden}\"\n (dragstart)=\"dt.onColumnDragStart($event)\" (dragleave)=\"dt.onColumnDragleave($event)\" (drop)=\"dt.onColumnDrop($event)\" (mousedown)=\"dt.onHeaderMousedown($event,headerCell)\"\n [attr.tabindex]=\"col.sortable ? dt.tabindex : null\" (keydown)=\"dt.onHeaderKeydown($event,col)\"\n [attr.scope]=\"col.scope||(col.colspan ? 'colgroup' : 'col')\">\n <span class=\"ui-column-resizer ui-clickable\" *ngIf=\"dt.resizableColumns && col.resizable && ((dt.columnResizeMode == 'fit' && !lastCol) || dt.columnResizeMode == 'expand')\" (mousedown)=\"dt.initColumnResize($event)\"></span>\n <span class=\"ui-column-title\" *ngIf=\"!col.selectionMode&&!col.headerTemplate\">{{col.header}}</span>\n <span class=\"ui-column-title\" *ngIf=\"col.headerTemplate\">\n <ng-container *ngTemplateOutlet=\"col.headerTemplate; context: {$implicit: col}\"></ng-container>\n </span>\n <span class=\"ui-sortable-column-icon fa fa-fw fa-sort\" *ngIf=\"col.sortable\"\n [ngClass]=\"{'fa-sort-desc': (dt.getSortOrder(col) == -1),'fa-sort-asc': (dt.getSortOrder(col) == 1)}\"></span>\n <input [attr.type]=\"col.filterType\" class=\"ui-column-filter ui-inputtext ui-widget ui-state-default ui-corner-all\" [attr.maxlength]=\"col.filterMaxlength\" [attr.placeholder]=\"col.filterPlaceholder\" *ngIf=\"col.filter&&!col.filterTemplate\" [value]=\"dt.filters[col.filterField||col.field] ? dt.filters[col.filterField||col.field].value : ''\"\n (click)=\"dt.onFilterInputClick($event)\" (input)=\"dt.onFilterKeyup($event.target.value, col.filterField||col.field, col.filterMatchMode)\"/>\n <ng-container *ngIf=\"col.filter && col.filterTemplate\">\n <ng-container *ngTemplateOutlet=\"col.filterTemplate; context: {$implicit: col}\"></ng-container>\n </ng-container>\n <p-dtCheckbox *ngIf=\"col.selectionMode=='multiple' && dt.showHeaderCheckbox === true\" (onChange)=\"dt.toggleRowsWithCheckbox($event)\" [checked]=\"dt.allSelected\" [disabled]=\"dt.isEmpty()\"></p-dtCheckbox>\n </th>\n </ng-template>\n "
|
89
|
-
}),
|
90
|
-
__param(0, core_1.Inject(core_1.forwardRef(function () { return DataTable; }))),
|
91
|
-
__metadata("design:paramtypes", [DataTable])
|
92
|
-
], ColumnHeaders);
|
93
|
-
return ColumnHeaders;
|
94
|
-
}());
|
95
|
-
exports.ColumnHeaders = ColumnHeaders;
|
96
|
-
var ColumnFooters = /** @class */ (function () {
|
97
|
-
function ColumnFooters(dt) {
|
98
|
-
this.dt = dt;
|
99
|
-
}
|
100
|
-
__decorate([
|
101
|
-
core_1.Input("pColumnFooters"),
|
102
|
-
__metadata("design:type", Array)
|
103
|
-
], ColumnFooters.prototype, "columns", void 0);
|
104
|
-
ColumnFooters = __decorate([
|
105
|
-
core_1.Component({
|
106
|
-
selector: '[pColumnFooters]',
|
107
|
-
template: "\n <td *ngFor=\"let col of columns\" [ngStyle]=\"col.footerStyle||col.style\" [class]=\"col.footerStyleClass||col.styleClass\"\n [attr.colspan]=\"col.colspan\" [attr.rowspan]=\"col.rowspan\"\n [ngClass]=\"{'ui-state-default':true, 'ui-helper-hidden': col.hidden}\">\n <span class=\"ui-column-footer\" *ngIf=\"!col.footerTemplate\">{{col.footer}}</span>\n <span class=\"ui-column-footer\" *ngIf=\"col.footerTemplate\">\n <ng-container *ngTemplateOutlet=\"col.footerTemplate; context: {$implicit: col}\"></ng-container>\n </span>\n </td>\n "
|
108
|
-
}),
|
109
|
-
__param(0, core_1.Inject(core_1.forwardRef(function () { return DataTable; }))),
|
110
|
-
__metadata("design:paramtypes", [DataTable])
|
111
|
-
], ColumnFooters);
|
112
|
-
return ColumnFooters;
|
113
|
-
}());
|
114
|
-
exports.ColumnFooters = ColumnFooters;
|
115
|
-
var TableBody = /** @class */ (function () {
|
116
|
-
function TableBody(dt) {
|
117
|
-
this.dt = dt;
|
118
|
-
}
|
119
|
-
TableBody.prototype.visibleColumns = function () {
|
120
|
-
return this.columns ? this.columns.filter(function (c) { return !c.hidden; }) : [];
|
121
|
-
};
|
122
|
-
__decorate([
|
123
|
-
core_1.Input("pTableBody"),
|
124
|
-
__metadata("design:type", Array)
|
125
|
-
], TableBody.prototype, "columns", void 0);
|
126
|
-
__decorate([
|
127
|
-
core_1.Input(),
|
128
|
-
__metadata("design:type", Array)
|
129
|
-
], TableBody.prototype, "data", void 0);
|
130
|
-
TableBody = __decorate([
|
131
|
-
core_1.Component({
|
132
|
-
selector: '[pTableBody]',
|
133
|
-
template: "\n <ng-template ngFor let-rowData [ngForOf]=\"data\" let-even=\"even\" let-odd=\"odd\" let-rowIndex=\"index\" [ngForTrackBy]=\"dt.rowTrackBy\">\n <tr #rowGroupElement class=\"ui-widget-header ui-rowgroup-header\"\n *ngIf=\"dt.rowGroupMode=='subheader' && (rowIndex === 0||(dt.resolveFieldData(rowData,dt.groupField) !== dt.resolveFieldData(dt.dataToRender[rowIndex - 1], dt.groupField)))\"\n (click)=\"dt.onRowGroupClick($event)\" [ngStyle]=\"{'cursor': dt.sortableRowGroup ? 'pointer' : 'auto'}\">\n <td [attr.colspan]=\"dt.visibleColumns().length\">\n <a href=\"#\" *ngIf=\"dt.expandableRowGroups\" (click)=\"dt.toggleRowGroup($event,rowData)\">\n <span class=\"fa fa-fw\" [ngClass]=\"dt.isRowGroupExpanded(rowData) ? dt.expandedIcon : dt.collapsedIcon\"></span>\n </a>\n <span class=\"ui-rowgroup-header-name\">\n <ng-container *ngTemplateOutlet=\"dt.rowGroupHeaderTemplate; context: {$implicit: rowData}\"></ng-container>\n </span>\n </td>\n </tr>\n <tr #rowElement *ngIf=\"!dt.expandableRowGroups||dt.isRowGroupExpanded(rowData)\"\n (click)=\"dt.handleRowClick($event, rowData, rowIndex)\" (dblclick)=\"dt.rowDblclick($event,rowData)\" (contextmenu)=\"dt.onRowRightClick($event,rowData)\" (touchend)=\"dt.handleRowTouchEnd($event)\"\n [ngClass]=\"[even&&dt.rowGroupMode!='rowspan'? 'ui-datatable-even':'',\n odd&&dt.rowGroupMode!='rowspan'?'ui-datatable-odd':'',\n dt.isSelected(rowData)? 'ui-state-highlight': '',\n dt.isRowExpanded(rowData) ? 'ui-expanded-row': '',\n dt.getRowStyleClass(rowData,rowIndex)]\">\n <ng-template ngFor let-col [ngForOf]=\"columns\" let-colIndex=\"index\">\n <td #cell *ngIf=\"!dt.rowGroupMode || (dt.rowGroupMode == 'subheader') ||\n (dt.rowGroupMode=='rowspan' && ((dt.sortField==col.field && dt.rowGroupMetadata[dt.resolveFieldData(rowData,dt.sortField)].index == rowIndex) || (dt.sortField!=col.field)))\"\n [ngStyle]=\"col.bodyStyle||col.style\" [class]=\"col.bodyStyleClass||col.styleClass\" (click)=\"dt.switchCellToEditMode(cell,col,rowData)\"\n [ngClass]=\"{'ui-editable-column':col.editable,'ui-selection-column':col.selectionMode, 'ui-helper-hidden': col.hidden}\"\n [attr.rowspan]=\"(dt.rowGroupMode=='rowspan' && dt.sortField == col.field && dt.rowGroupMetadata[dt.resolveFieldData(rowData,dt.sortField)].index == rowIndex) ? dt.rowGroupMetadata[dt.resolveFieldData(rowData,dt.sortField)].size : null\">\n <span class=\"ui-column-title\" *ngIf=\"dt.responsive\">{{col.header}}</span>\n <span class=\"ui-cell-data\" *ngIf=\"!col.bodyTemplate && !col.expander && !col.selectionMode\">{{dt.resolveFieldData(rowData,col.field)}}</span>\n <span class=\"ui-cell-data\" *ngIf=\"col.bodyTemplate\">\n <ng-container *ngTemplateOutlet=\"col.bodyTemplate; context: {$implicit: col, rowData: rowData, rowIndex: (rowIndex + dt.first)}\"></ng-container>\n </span>\n <div class=\"ui-cell-editor\" *ngIf=\"col.editable\">\n <input *ngIf=\"!col.editorTemplate\" type=\"text\" [(ngModel)]=\"rowData[col.field]\"\n (keydown)=\"dt.onCellEditorKeydown($event, col, rowData, rowIndex)\" (blur)=\"dt.onCellEditorBlur($event, col, rowData, rowIndex)\"\n (input)=\"dt.onCellEditorInput($event, col, rowData, rowIndex)\" (change)=\"dt.onCellEditorChange($event, col, rowData, rowIndex)\"\n class=\"ui-inputtext ui-widget ui-state-default ui-corner-all\"/>\n <a *ngIf=\"col.editorTemplate\" class=\"ui-cell-editor-proxy-focus\" href=\"#\" (focus)=\"dt.onCustomEditorFocusPrev($event)\"></a>\n <ng-container *ngTemplateOutlet=\"col.editorTemplate; context: {$implicit: col, rowData: rowData, rowIndex: rowIndex}\"></ng-container>\n <a *ngIf=\"col.editorTemplate\" class=\"ui-cell-editor-proxy-focus\" href=\"#\" (focus)=\"dt.onCustomEditorFocusNext($event)\"></a>\n </div>\n <a href=\"#\" *ngIf=\"col.expander\" (click)=\"dt.toggleRow(rowData,$event)\">\n <span class=\"ui-row-toggler fa fa-fw ui-clickable\" [ngClass]=\"dt.isRowExpanded(rowData) ? dt.expandedIcon : dt.collapsedIcon\"></span>\n </a>\n <p-dtRadioButton *ngIf=\"col.selectionMode=='single'\" (onClick)=\"dt.selectRowWithRadio($event, rowData)\" [checked]=\"dt.isSelected(rowData)\"></p-dtRadioButton>\n <p-dtCheckbox *ngIf=\"col.selectionMode=='multiple'\" (onChange)=\"dt.toggleRowWithCheckbox($event,rowData)\" [checked]=\"dt.isSelected(rowData)\"></p-dtCheckbox>\n </td>\n </ng-template>\n </tr>\n <tr *ngIf=\"dt.expandableRows && dt.isRowExpanded(rowData)\" class=\"ui-expanded-row-content\">\n <td [attr.colspan]=\"dt.visibleColumns().length\">\n <ng-container *ngTemplateOutlet=\"dt.rowExpansionTemplate; context: {$implicit: rowData, rowIndex: rowIndex}\"></ng-container>\n </td>\n </tr>\n <tr class=\"ui-widget-header ui-rowgroup-footer\" *ngIf=\"dt.rowGroupFooterTemplate && dt.rowGroupMode=='subheader' && ((rowIndex === dt.dataToRender.length - 1)||(dt.resolveFieldData(rowData,dt.groupField) !== dt.resolveFieldData(dt.dataToRender[rowIndex + 1],dt.groupField))) && (!dt.expandableRowGroups || dt.isRowGroupExpanded(rowData))\">\n <ng-container *ngTemplateOutlet=\"dt.rowGroupFooterTemplate; context: {$implicit: rowData}\"></ng-container>\n </tr>\n </ng-template>\n\n <tr *ngIf=\"dt.isEmpty()\" class=\"ui-widget-content ui-datatable-emptymessage-row\" [style.visibility]=\"dt.loading ? 'hidden' : 'visible'\">\n <td [attr.colspan]=\"dt.visibleColumns().length\" class=\"ui-datatable-emptymessage\">\n <span *ngIf=\"!dt.emptyMessageTemplate\">{{dt.emptyMessage}}</span>\n <ng-container *ngIf=\"dt.emptyMessageTemplate\">\n <ng-container *ngTemplateOutlet=\"dt.emptyMessageTemplate\"></ng-container>\n </ng-container>\n </td>\n </tr>\n "
|
134
|
-
}),
|
135
|
-
__param(0, core_1.Inject(core_1.forwardRef(function () { return DataTable; }))),
|
136
|
-
__metadata("design:paramtypes", [DataTable])
|
137
|
-
], TableBody);
|
138
|
-
return TableBody;
|
139
|
-
}());
|
140
|
-
exports.TableBody = TableBody;
|
141
|
-
var ScrollableView = /** @class */ (function () {
|
142
|
-
function ScrollableView(dt, el, renderer, zone) {
|
143
|
-
this.dt = dt;
|
144
|
-
this.el = el;
|
145
|
-
this.renderer = renderer;
|
146
|
-
this.zone = zone;
|
147
|
-
this.onVirtualScroll = new core_1.EventEmitter();
|
148
|
-
}
|
149
|
-
ScrollableView.prototype.ngAfterViewInit = function () {
|
150
|
-
this.initScrolling();
|
151
|
-
};
|
152
|
-
ScrollableView.prototype.ngAfterViewChecked = function () {
|
153
|
-
var _this = this;
|
154
|
-
if (this.virtualScroll && !this.rowHeight) {
|
155
|
-
var row = domhandler_1.DomHandler.findSingle(this.scrollTable, 'tr.ui-widget-content:not(.ui-datatable-emptymessage-row)');
|
156
|
-
if (row) {
|
157
|
-
this.rowHeight = domhandler_1.DomHandler.getOuterHeight(row);
|
158
|
-
}
|
159
|
-
}
|
160
|
-
if (!this.frozen) {
|
161
|
-
this.zone.runOutsideAngular(function () {
|
162
|
-
setTimeout(function () {
|
163
|
-
_this.alignScrollBar();
|
164
|
-
}, 1);
|
165
|
-
});
|
166
|
-
}
|
167
|
-
};
|
168
|
-
ScrollableView.prototype.initScrolling = function () {
|
169
|
-
var _this = this;
|
170
|
-
this.scrollHeader = this.scrollHeaderViewChild.nativeElement;
|
171
|
-
this.scrollHeaderBox = this.scrollHeaderBoxViewChild.nativeElement;
|
172
|
-
this.scrollBody = this.scrollBodyViewChild.nativeElement;
|
173
|
-
this.scrollTable = this.scrollTableViewChild.nativeElement;
|
174
|
-
this.scrollTableWrapper = this.scrollTableWrapperViewChild.nativeElement;
|
175
|
-
this.scrollFooter = this.scrollFooterViewChild ? this.scrollFooterViewChild.nativeElement : null;
|
176
|
-
this.scrollFooterBox = this.scrollFooterBoxViewChild ? this.scrollFooterBoxViewChild.nativeElement : null;
|
177
|
-
this.setScrollHeight();
|
178
|
-
if (!this.frozen) {
|
179
|
-
this.zone.runOutsideAngular(function () {
|
180
|
-
_this.scrollHeader.addEventListener('scroll', _this.onHeaderScroll.bind(_this));
|
181
|
-
_this.scrollBody.addEventListener('scroll', _this.onBodyScroll.bind(_this));
|
182
|
-
});
|
183
|
-
}
|
184
|
-
if (!this.frozen) {
|
185
|
-
this.alignScrollBar();
|
186
|
-
}
|
187
|
-
else {
|
188
|
-
this.scrollBody.style.paddingBottom = domhandler_1.DomHandler.calculateScrollbarWidth() + 'px';
|
189
|
-
}
|
190
|
-
};
|
191
|
-
ScrollableView.prototype.onBodyScroll = function (event) {
|
192
|
-
var _this = this;
|
193
|
-
var frozenView = this.el.nativeElement.previousElementSibling;
|
194
|
-
if (frozenView) {
|
195
|
-
var frozenScrollBody = domhandler_1.DomHandler.findSingle(frozenView, '.ui-datatable-scrollable-body');
|
196
|
-
}
|
197
|
-
this.scrollHeaderBox.style.marginLeft = -1 * this.scrollBody.scrollLeft + 'px';
|
198
|
-
if (this.scrollFooterBox) {
|
199
|
-
this.scrollFooterBox.style.marginLeft = -1 * this.scrollBody.scrollLeft + 'px';
|
200
|
-
}
|
201
|
-
if (frozenScrollBody) {
|
202
|
-
frozenScrollBody.scrollTop = this.scrollBody.scrollTop;
|
203
|
-
}
|
204
|
-
if (this.virtualScroll) {
|
205
|
-
var viewport = domhandler_1.DomHandler.getOuterHeight(this.scrollBody);
|
206
|
-
var tableHeight = domhandler_1.DomHandler.getOuterHeight(this.scrollTable);
|
207
|
-
var pageHeight_1 = this.rowHeight * this.dt.rows;
|
208
|
-
var virtualTableHeight = domhandler_1.DomHandler.getOuterHeight(this.scrollTableWrapper);
|
209
|
-
var pageCount = (virtualTableHeight / pageHeight_1) || 1;
|
210
|
-
if (this.scrollBody.scrollTop + viewport > parseFloat(this.scrollTable.style.top) + tableHeight || this.scrollBody.scrollTop < parseFloat(this.scrollTable.style.top)) {
|
211
|
-
var page_1 = Math.floor((this.scrollBody.scrollTop * pageCount) / (this.scrollBody.scrollHeight)) + 1;
|
212
|
-
this.onVirtualScroll.emit({
|
213
|
-
page: page_1,
|
214
|
-
callback: function () {
|
215
|
-
_this.scrollTable.style.top = ((page_1 - 1) * pageHeight_1) + 'px';
|
216
|
-
}
|
217
|
-
});
|
218
|
-
}
|
219
|
-
}
|
220
|
-
};
|
221
|
-
ScrollableView.prototype.setScrollHeight = function () {
|
222
|
-
if (this.dt.scrollHeight) {
|
223
|
-
if (this.dt.scrollHeight.indexOf('%') !== -1) {
|
224
|
-
this.scrollBody.style.visibility = 'hidden';
|
225
|
-
this.scrollBody.style.height = '100px'; //temporary height to calculate static height
|
226
|
-
var containerHeight = domhandler_1.DomHandler.getOuterHeight(this.dt.el.nativeElement.children[0]);
|
227
|
-
var relativeHeight = domhandler_1.DomHandler.getOuterHeight(this.dt.el.nativeElement.parentElement) * parseInt(this.dt.scrollHeight) / 100;
|
228
|
-
var staticHeight = containerHeight - 100; //total height of headers, footers, paginators
|
229
|
-
var scrollBodyHeight = (relativeHeight - staticHeight);
|
230
|
-
this.scrollBody.style.height = 'auto';
|
231
|
-
this.scrollBody.style.maxHeight = scrollBodyHeight + 'px';
|
232
|
-
this.scrollBody.style.visibility = 'visible';
|
233
|
-
}
|
234
|
-
else {
|
235
|
-
this.scrollBody.style.maxHeight = this.dt.scrollHeight;
|
236
|
-
}
|
237
|
-
}
|
238
|
-
};
|
239
|
-
ScrollableView.prototype.onHeaderScroll = function (event) {
|
240
|
-
this.scrollHeader.scrollLeft = 0;
|
241
|
-
};
|
242
|
-
ScrollableView.prototype.hasVerticalOverflow = function () {
|
243
|
-
return domhandler_1.DomHandler.getOuterHeight(this.scrollTable) > domhandler_1.DomHandler.getOuterHeight(this.scrollBody);
|
244
|
-
};
|
245
|
-
ScrollableView.prototype.alignScrollBar = function () {
|
246
|
-
var scrollBarWidth = this.hasVerticalOverflow() ? domhandler_1.DomHandler.calculateScrollbarWidth() : 0;
|
247
|
-
this.scrollHeaderBox.style.marginRight = scrollBarWidth + 'px';
|
248
|
-
if (this.scrollFooterBox) {
|
249
|
-
this.scrollFooterBox.style.marginRight = scrollBarWidth + 'px';
|
250
|
-
}
|
251
|
-
};
|
252
|
-
ScrollableView.prototype.ngOnDestroy = function () {
|
253
|
-
this.scrollHeader.removeEventListener('scroll', this.onHeaderScroll);
|
254
|
-
this.scrollBody.removeEventListener('scroll', this.onBodyScroll);
|
255
|
-
};
|
256
|
-
__decorate([
|
257
|
-
core_1.Input("pScrollableView"),
|
258
|
-
__metadata("design:type", Array)
|
259
|
-
], ScrollableView.prototype, "columns", void 0);
|
260
|
-
__decorate([
|
261
|
-
core_1.Input(),
|
262
|
-
__metadata("design:type", shared_2.HeaderColumnGroup)
|
263
|
-
], ScrollableView.prototype, "headerColumnGroup", void 0);
|
264
|
-
__decorate([
|
265
|
-
core_1.Input(),
|
266
|
-
__metadata("design:type", shared_2.HeaderColumnGroup)
|
267
|
-
], ScrollableView.prototype, "footerColumnGroup", void 0);
|
268
|
-
__decorate([
|
269
|
-
core_1.ViewChild('scrollHeader'),
|
270
|
-
__metadata("design:type", core_1.ElementRef)
|
271
|
-
], ScrollableView.prototype, "scrollHeaderViewChild", void 0);
|
272
|
-
__decorate([
|
273
|
-
core_1.ViewChild('scrollHeaderBox'),
|
274
|
-
__metadata("design:type", core_1.ElementRef)
|
275
|
-
], ScrollableView.prototype, "scrollHeaderBoxViewChild", void 0);
|
276
|
-
__decorate([
|
277
|
-
core_1.ViewChild('scrollBody'),
|
278
|
-
__metadata("design:type", core_1.ElementRef)
|
279
|
-
], ScrollableView.prototype, "scrollBodyViewChild", void 0);
|
280
|
-
__decorate([
|
281
|
-
core_1.ViewChild('scrollTable'),
|
282
|
-
__metadata("design:type", core_1.ElementRef)
|
283
|
-
], ScrollableView.prototype, "scrollTableViewChild", void 0);
|
284
|
-
__decorate([
|
285
|
-
core_1.ViewChild('scrollTableWrapper'),
|
286
|
-
__metadata("design:type", core_1.ElementRef)
|
287
|
-
], ScrollableView.prototype, "scrollTableWrapperViewChild", void 0);
|
288
|
-
__decorate([
|
289
|
-
core_1.ViewChild('scrollFooter'),
|
290
|
-
__metadata("design:type", core_1.ElementRef)
|
291
|
-
], ScrollableView.prototype, "scrollFooterViewChild", void 0);
|
292
|
-
__decorate([
|
293
|
-
core_1.ViewChild('scrollFooterBox'),
|
294
|
-
__metadata("design:type", core_1.ElementRef)
|
295
|
-
], ScrollableView.prototype, "scrollFooterBoxViewChild", void 0);
|
296
|
-
__decorate([
|
297
|
-
core_1.Input(),
|
298
|
-
__metadata("design:type", Boolean)
|
299
|
-
], ScrollableView.prototype, "frozen", void 0);
|
300
|
-
__decorate([
|
301
|
-
core_1.Input(),
|
302
|
-
__metadata("design:type", String)
|
303
|
-
], ScrollableView.prototype, "width", void 0);
|
304
|
-
__decorate([
|
305
|
-
core_1.Input(),
|
306
|
-
__metadata("design:type", Boolean)
|
307
|
-
], ScrollableView.prototype, "virtualScroll", void 0);
|
308
|
-
__decorate([
|
309
|
-
core_1.Output(),
|
310
|
-
__metadata("design:type", core_1.EventEmitter)
|
311
|
-
], ScrollableView.prototype, "onVirtualScroll", void 0);
|
312
|
-
ScrollableView = __decorate([
|
313
|
-
core_1.Component({
|
314
|
-
selector: '[pScrollableView]',
|
315
|
-
template: "\n <div #scrollHeader class=\"ui-widget-header ui-datatable-scrollable-header\" [ngStyle]=\"{'width': width}\">\n <div #scrollHeaderBox class=\"ui-datatable-scrollable-header-box\">\n <table [ngClass]=\"dt.tableStyleClass\" [ngStyle]=\"dt.tableStyle\">\n <thead class=\"ui-datatable-thead\">\n <tr *ngIf=\"!headerColumnGroup\" class=\"ui-state-default\" [pColumnHeaders]=\"columns\"></tr>\n <ng-template [ngIf]=\"headerColumnGroup\">\n <tr *ngFor=\"let headerRow of headerColumnGroup.rows\" class=\"ui-state-default\" [pColumnHeaders]=\"headerRow.columns\"></tr>\n </ng-template>\n </thead>\n <tbody *ngIf=\"dt.frozenValue\" [ngClass]=\"{'ui-datatable-data ui-widget-content': true, 'ui-datatable-hoverable-rows': (dt.rowHover||dt.selectionMode)}\" [pTableBody]=\"columns\" [data]=\"dt.frozenValue\"></tbody>\n </table>\n </div>\n </div>\n <div #scrollBody class=\"ui-datatable-scrollable-body\" [ngStyle]=\"{'width': width}\">\n <div #scrollTableWrapper class=\"ui-datatable-scrollable-table-wrapper\" style=\"position:relative\">\n <table #scrollTable [class]=\"dt.tableStyleClass\" [ngStyle]=\"dt.tableStyle\" [ngClass]=\"{'ui-datatable-virtual-table':virtualScroll}\" style=\"top:0px\">\n <colgroup class=\"ui-datatable-scrollable-colgroup\">\n <col *ngFor=\"let col of columns\" [ngStyle]=\"col.headerStyle||col.style\" [ngClass]=\"{'ui-helper-hidden': col.hidden}\"/>\n </colgroup>\n <tbody [ngClass]=\"{'ui-datatable-data ui-widget-content': true, 'ui-datatable-hoverable-rows': (dt.rowHover||dt.selectionMode)}\" [pTableBody]=\"columns\" [data]=\"dt.dataToRender\"></tbody>\n </table>\n </div>\n </div>\n <div #scrollFooter class=\"ui-widget-header ui-datatable-scrollable-footer\" [ngStyle]=\"{'width': width}\" *ngIf=\"dt.hasFooter()\">\n <div #scrollFooterBox class=\"ui-datatable-scrollable-footer-box\">\n <table [ngClass]=\"dt.tableStyleClass\" [ngStyle]=\"dt.tableStyle\">\n <tfoot class=\"ui-datatable-tfoot\">\n <tr *ngIf=\"!footerColumnGroup\" [pColumnFooters]=\"columns\" class=\"ui-state-default\"></tr>\n <ng-template [ngIf]=\"footerColumnGroup\">\n <tr *ngFor=\"let footerRow of footerColumnGroup.rows\" class=\"ui-state-default\" [pColumnFooters]=\"footerRow.columns\"></tr>\n </ng-template>\n </tfoot>\n </table>\n </div>\n </div>\n "
|
316
|
-
}),
|
317
|
-
__param(0, core_1.Inject(core_1.forwardRef(function () { return DataTable; }))),
|
318
|
-
__metadata("design:paramtypes", [DataTable, core_1.ElementRef, core_1.Renderer2, core_1.NgZone])
|
319
|
-
], ScrollableView);
|
320
|
-
return ScrollableView;
|
321
|
-
}());
|
322
|
-
exports.ScrollableView = ScrollableView;
|
323
|
-
var DataTable = /** @class */ (function () {
|
324
|
-
function DataTable(el, differs, renderer, changeDetector, zone) {
|
325
|
-
this.el = el;
|
326
|
-
this.differs = differs;
|
327
|
-
this.renderer = renderer;
|
328
|
-
this.changeDetector = changeDetector;
|
329
|
-
this.zone = zone;
|
330
|
-
this.pageLinks = 5;
|
331
|
-
this.selectionChange = new core_1.EventEmitter();
|
332
|
-
this.showHeaderCheckbox = true;
|
333
|
-
this.onRowClick = new core_1.EventEmitter();
|
334
|
-
this.onRowSelect = new core_1.EventEmitter();
|
335
|
-
this.onRowUnselect = new core_1.EventEmitter();
|
336
|
-
this.onRowDblclick = new core_1.EventEmitter();
|
337
|
-
this.onHeaderCheckboxToggle = new core_1.EventEmitter();
|
338
|
-
this.onContextMenuSelect = new core_1.EventEmitter();
|
339
|
-
this.filterDelay = 300;
|
340
|
-
this.onLazyLoad = new core_1.EventEmitter();
|
341
|
-
this.columnResizeMode = 'fit';
|
342
|
-
this.onColResize = new core_1.EventEmitter();
|
343
|
-
this.onColReorder = new core_1.EventEmitter();
|
344
|
-
this.sortMode = 'single';
|
345
|
-
this.defaultSortOrder = 1;
|
346
|
-
this.csvSeparator = ',';
|
347
|
-
this.exportFilename = 'download';
|
348
|
-
this.emptyMessage = 'No records found';
|
349
|
-
this.paginatorPosition = 'bottom';
|
350
|
-
this.alwaysShowPaginator = true;
|
351
|
-
this.metaKeySelection = true;
|
352
|
-
this.rowTrackBy = function (index, item) { return item; };
|
353
|
-
this.immutable = true;
|
354
|
-
this.compareSelectionBy = 'deepEquals';
|
355
|
-
this.onEditInit = new core_1.EventEmitter();
|
356
|
-
this.onEditComplete = new core_1.EventEmitter();
|
357
|
-
this.onEdit = new core_1.EventEmitter();
|
358
|
-
this.onEditCancel = new core_1.EventEmitter();
|
359
|
-
this.onPage = new core_1.EventEmitter();
|
360
|
-
this.onSort = new core_1.EventEmitter();
|
361
|
-
this.onFilter = new core_1.EventEmitter();
|
362
|
-
this.rowExpandMode = 'multiple';
|
363
|
-
this.expandedIcon = 'fa-chevron-circle-down';
|
364
|
-
this.collapsedIcon = 'fa-chevron-circle-right';
|
365
|
-
this.tabindex = 1;
|
366
|
-
this.sortableRowGroup = true;
|
367
|
-
this.filters = {};
|
368
|
-
this.loadingIcon = 'fa-circle-o-notch';
|
369
|
-
this.virtualScrollDelay = 500;
|
370
|
-
this.rowGroupExpandMode = 'multiple';
|
371
|
-
this.valueChange = new core_1.EventEmitter();
|
372
|
-
this.firstChange = new core_1.EventEmitter();
|
373
|
-
this.onRowExpand = new core_1.EventEmitter();
|
374
|
-
this.onRowCollapse = new core_1.EventEmitter();
|
375
|
-
this.onRowGroupExpand = new core_1.EventEmitter();
|
376
|
-
this.onRowGroupCollapse = new core_1.EventEmitter();
|
377
|
-
this.page = 0;
|
378
|
-
this.columnsChanged = false;
|
379
|
-
this._first = 0;
|
380
|
-
this._sortOrder = 1;
|
381
|
-
this.filterConstraints = {
|
382
|
-
startsWith: function (value, filter) {
|
383
|
-
if (filter === undefined || filter === null || filter.trim() === '') {
|
384
|
-
return true;
|
385
|
-
}
|
386
|
-
if (value === undefined || value === null) {
|
387
|
-
return false;
|
388
|
-
}
|
389
|
-
var filterValue = filter.toLowerCase();
|
390
|
-
return value.toString().toLowerCase().slice(0, filterValue.length) === filterValue;
|
391
|
-
},
|
392
|
-
contains: function (value, filter) {
|
393
|
-
if (filter === undefined || filter === null || (typeof filter === 'string' && filter.trim() === '')) {
|
394
|
-
return true;
|
395
|
-
}
|
396
|
-
if (value === undefined || value === null) {
|
397
|
-
return false;
|
398
|
-
}
|
399
|
-
return value.toString().toLowerCase().indexOf(filter.toLowerCase()) !== -1;
|
400
|
-
},
|
401
|
-
endsWith: function (value, filter) {
|
402
|
-
if (filter === undefined || filter === null || filter.trim() === '') {
|
403
|
-
return true;
|
404
|
-
}
|
405
|
-
if (value === undefined || value === null) {
|
406
|
-
return false;
|
407
|
-
}
|
408
|
-
var filterValue = filter.toString().toLowerCase();
|
409
|
-
return value.toString().toLowerCase().indexOf(filterValue, value.toString().length - filterValue.length) !== -1;
|
410
|
-
},
|
411
|
-
equals: function (value, filter) {
|
412
|
-
if (filter === undefined || filter === null || (typeof filter === 'string' && filter.trim() === '')) {
|
413
|
-
return true;
|
414
|
-
}
|
415
|
-
if (value === undefined || value === null) {
|
416
|
-
return false;
|
417
|
-
}
|
418
|
-
return value.toString().toLowerCase() == filter.toString().toLowerCase();
|
419
|
-
},
|
420
|
-
notEquals: function (value, filter) {
|
421
|
-
if (filter === undefined || filter === null || (typeof filter === 'string' && filter.trim() === '')) {
|
422
|
-
return false;
|
423
|
-
}
|
424
|
-
if (value === undefined || value === null) {
|
425
|
-
return true;
|
426
|
-
}
|
427
|
-
return value.toString().toLowerCase() != filter.toString().toLowerCase();
|
428
|
-
},
|
429
|
-
in: function (value, filter) {
|
430
|
-
if (filter === undefined || filter === null || filter.length === 0) {
|
431
|
-
return true;
|
432
|
-
}
|
433
|
-
if (value === undefined || value === null) {
|
434
|
-
return false;
|
435
|
-
}
|
436
|
-
for (var i = 0; i < filter.length; i++) {
|
437
|
-
if (filter[i] === value)
|
438
|
-
return true;
|
439
|
-
}
|
440
|
-
return false;
|
441
|
-
}
|
442
|
-
};
|
443
|
-
this.differ = differs.find([]).create(null);
|
444
|
-
}
|
445
|
-
DataTable.prototype.ngOnInit = function () {
|
446
|
-
if (this.lazy) {
|
447
|
-
this.onLazyLoad.emit(this.createLazyLoadMetadata());
|
448
|
-
}
|
449
|
-
};
|
450
|
-
DataTable.prototype.ngAfterContentInit = function () {
|
451
|
-
var _this = this;
|
452
|
-
this.initColumns();
|
453
|
-
this.initColumnGroups();
|
454
|
-
this.columnsSubscription = this.cols.changes.subscribe(function (_) {
|
455
|
-
_this.initColumns();
|
456
|
-
_this.changeDetector.markForCheck();
|
457
|
-
});
|
458
|
-
this.templates.forEach(function (item) {
|
459
|
-
switch (item.getType()) {
|
460
|
-
case 'rowexpansion':
|
461
|
-
_this.rowExpansionTemplate = item.template;
|
462
|
-
break;
|
463
|
-
case 'rowgroupheader':
|
464
|
-
_this.rowGroupHeaderTemplate = item.template;
|
465
|
-
break;
|
466
|
-
case 'rowgroupfooter':
|
467
|
-
_this.rowGroupFooterTemplate = item.template;
|
468
|
-
break;
|
469
|
-
case 'emptymessage':
|
470
|
-
_this.emptyMessageTemplate = item.template;
|
471
|
-
break;
|
472
|
-
case 'paginatorLeft':
|
473
|
-
_this.paginatorLeftTemplate = item.template;
|
474
|
-
break;
|
475
|
-
case 'paginatorRight':
|
476
|
-
_this.paginatorRightTemplate = item.template;
|
477
|
-
break;
|
478
|
-
}
|
479
|
-
});
|
480
|
-
};
|
481
|
-
DataTable.prototype.ngAfterViewChecked = function () {
|
482
|
-
if (this.columnsChanged && this.el.nativeElement.offsetParent) {
|
483
|
-
if (this.resizableColumns) {
|
484
|
-
this.initResizableColumns();
|
485
|
-
}
|
486
|
-
if (this.reorderableColumns) {
|
487
|
-
this.initColumnReordering();
|
488
|
-
}
|
489
|
-
this.columnsChanged = false;
|
490
|
-
}
|
491
|
-
if (this.totalRecordsChanged && this.virtualScroll && this.virtualScrollableTableWrapper && this.virtualScrollableTableWrapper.offsetParent) {
|
492
|
-
var row = domhandler_1.DomHandler.findSingle(this.virtualScrollableTableWrapper, 'tr.ui-widget-content');
|
493
|
-
var rowHeight = domhandler_1.DomHandler.getOuterHeight(row);
|
494
|
-
this.virtualTableHeight = this._totalRecords * rowHeight;
|
495
|
-
this.virtualScrollableTableWrapper.style.height = this.virtualTableHeight + 'px';
|
496
|
-
this.totalRecordsChanged = false;
|
497
|
-
}
|
498
|
-
};
|
499
|
-
DataTable.prototype.ngAfterViewInit = function () {
|
500
|
-
var _this = this;
|
501
|
-
if (this.globalFilter) {
|
502
|
-
this.globalFilterFunction = this.renderer.listen(this.globalFilter, 'keyup', function () {
|
503
|
-
if (_this.filterTimeout) {
|
504
|
-
clearTimeout(_this.filterTimeout);
|
505
|
-
}
|
506
|
-
_this.filterTimeout = setTimeout(function () {
|
507
|
-
_this._filter();
|
508
|
-
_this.filterTimeout = null;
|
509
|
-
}, _this.filterDelay);
|
510
|
-
});
|
511
|
-
}
|
512
|
-
this.virtualScrollableTableWrapper = domhandler_1.DomHandler.findSingle(this.el.nativeElement, 'div.ui-datatable-scrollable-table-wrapper');
|
513
|
-
this.initialized = true;
|
514
|
-
};
|
515
|
-
Object.defineProperty(DataTable.prototype, "multiSortMeta", {
|
516
|
-
get: function () {
|
517
|
-
return this._multiSortMeta;
|
518
|
-
},
|
519
|
-
set: function (val) {
|
520
|
-
this._multiSortMeta = val;
|
521
|
-
if (this.sortMode === 'multiple') {
|
522
|
-
this.sortMultiple();
|
523
|
-
}
|
524
|
-
},
|
525
|
-
enumerable: true,
|
526
|
-
configurable: true
|
527
|
-
});
|
528
|
-
Object.defineProperty(DataTable.prototype, "sortField", {
|
529
|
-
get: function () {
|
530
|
-
return this._sortField;
|
531
|
-
},
|
532
|
-
set: function (val) {
|
533
|
-
this._sortField = val;
|
534
|
-
if (this.sortMode === 'single') {
|
535
|
-
this.sortSingle();
|
536
|
-
}
|
537
|
-
},
|
538
|
-
enumerable: true,
|
539
|
-
configurable: true
|
540
|
-
});
|
541
|
-
Object.defineProperty(DataTable.prototype, "sortOrder", {
|
542
|
-
get: function () {
|
543
|
-
return this._sortOrder;
|
544
|
-
},
|
545
|
-
set: function (val) {
|
546
|
-
this._sortOrder = val;
|
547
|
-
if (this.sortMode === 'single') {
|
548
|
-
this.sortSingle();
|
549
|
-
}
|
550
|
-
},
|
551
|
-
enumerable: true,
|
552
|
-
configurable: true
|
553
|
-
});
|
554
|
-
Object.defineProperty(DataTable.prototype, "value", {
|
555
|
-
get: function () {
|
556
|
-
return this._value;
|
557
|
-
},
|
558
|
-
set: function (val) {
|
559
|
-
if (this.immutable) {
|
560
|
-
this._value = val ? val.slice() : null;
|
561
|
-
this.handleDataChange();
|
562
|
-
}
|
563
|
-
else {
|
564
|
-
this._value = val;
|
565
|
-
}
|
566
|
-
this.valueChange.emit(this.value);
|
567
|
-
},
|
568
|
-
enumerable: true,
|
569
|
-
configurable: true
|
570
|
-
});
|
571
|
-
Object.defineProperty(DataTable.prototype, "first", {
|
572
|
-
get: function () {
|
573
|
-
return this._first;
|
574
|
-
},
|
575
|
-
set: function (val) {
|
576
|
-
var shouldPaginate = this.initialized && this._first !== val;
|
577
|
-
this._first = val;
|
578
|
-
if (shouldPaginate) {
|
579
|
-
this.paginate();
|
580
|
-
}
|
581
|
-
},
|
582
|
-
enumerable: true,
|
583
|
-
configurable: true
|
584
|
-
});
|
585
|
-
Object.defineProperty(DataTable.prototype, "totalRecords", {
|
586
|
-
get: function () {
|
587
|
-
return this._totalRecords;
|
588
|
-
},
|
589
|
-
set: function (val) {
|
590
|
-
this._totalRecords = val;
|
591
|
-
this.totalRecordsChanged = true;
|
592
|
-
},
|
593
|
-
enumerable: true,
|
594
|
-
configurable: true
|
595
|
-
});
|
596
|
-
Object.defineProperty(DataTable.prototype, "selection", {
|
597
|
-
get: function () {
|
598
|
-
return this._selection;
|
599
|
-
},
|
600
|
-
set: function (val) {
|
601
|
-
this._selection = val;
|
602
|
-
if (this.dataKey && !this.preventSelectionKeysPropagation) {
|
603
|
-
this.selectionKeys = {};
|
604
|
-
if (this._selection) {
|
605
|
-
if (Array.isArray(this._selection)) {
|
606
|
-
for (var _i = 0, _a = this._selection; _i < _a.length; _i++) {
|
607
|
-
var data = _a[_i];
|
608
|
-
this.selectionKeys[String(objectutils_1.ObjectUtils.resolveFieldData(data, this.dataKey))] = 1;
|
609
|
-
}
|
610
|
-
}
|
611
|
-
else {
|
612
|
-
this.selectionKeys[String(objectutils_1.ObjectUtils.resolveFieldData(this._selection, this.dataKey))] = 1;
|
613
|
-
}
|
614
|
-
}
|
615
|
-
}
|
616
|
-
this.preventSelectionKeysPropagation = false;
|
617
|
-
},
|
618
|
-
enumerable: true,
|
619
|
-
configurable: true
|
620
|
-
});
|
621
|
-
DataTable.prototype.ngDoCheck = function () {
|
622
|
-
if (!this.immutable) {
|
623
|
-
var changes = this.differ.diff(this.value);
|
624
|
-
if (changes) {
|
625
|
-
this.handleDataChange();
|
626
|
-
}
|
627
|
-
}
|
628
|
-
};
|
629
|
-
DataTable.prototype.handleDataChange = function () {
|
630
|
-
var _this = this;
|
631
|
-
if (this.paginator) {
|
632
|
-
this.updatePaginator();
|
633
|
-
}
|
634
|
-
if (this.virtualScroll && this.virtualScrollCallback) {
|
635
|
-
this.virtualScrollCallback();
|
636
|
-
}
|
637
|
-
if (!this.lazy) {
|
638
|
-
if (this.hasFilter()) {
|
639
|
-
this._filter();
|
640
|
-
}
|
641
|
-
if (this.preventSortPropagation) {
|
642
|
-
this.preventSortPropagation = false;
|
643
|
-
}
|
644
|
-
else if (this.sortField || this.multiSortMeta) {
|
645
|
-
if (!this.sortColumn && this.columns) {
|
646
|
-
this.sortColumn = this.columns.find(function (col) { return col.field === _this.sortField && col.sortable === 'custom'; });
|
647
|
-
}
|
648
|
-
if (this.sortMode == 'single')
|
649
|
-
this.sortSingle();
|
650
|
-
else if (this.sortMode == 'multiple')
|
651
|
-
this.sortMultiple();
|
652
|
-
}
|
653
|
-
}
|
654
|
-
this.updateDataToRender(this.filteredValue || this.value);
|
655
|
-
};
|
656
|
-
DataTable.prototype.initColumns = function () {
|
657
|
-
this.columns = this.cols.toArray();
|
658
|
-
this.initScrollableColumns();
|
659
|
-
this.columnsChanged = true;
|
660
|
-
};
|
661
|
-
DataTable.prototype.initScrollableColumns = function () {
|
662
|
-
this.scrollableColumns = [];
|
663
|
-
this.frozenColumns = [];
|
664
|
-
for (var _i = 0, _a = this.columns; _i < _a.length; _i++) {
|
665
|
-
var col = _a[_i];
|
666
|
-
if (col.frozen)
|
667
|
-
this.frozenColumns.push(col);
|
668
|
-
else
|
669
|
-
this.scrollableColumns.push(col);
|
670
|
-
}
|
671
|
-
};
|
672
|
-
DataTable.prototype.initColumnGroups = function () {
|
673
|
-
var headerColumnsGroups = this.headerColumnGroups.toArray();
|
674
|
-
var footerColumnsGroups = this.footerColumnGroups.toArray();
|
675
|
-
for (var _i = 0, headerColumnsGroups_1 = headerColumnsGroups; _i < headerColumnsGroups_1.length; _i++) {
|
676
|
-
var columnGroup = headerColumnsGroups_1[_i];
|
677
|
-
if (columnGroup.frozen)
|
678
|
-
this.frozenHeaderColumnGroup = columnGroup;
|
679
|
-
else
|
680
|
-
this.scrollableHeaderColumnGroup = columnGroup;
|
681
|
-
}
|
682
|
-
for (var _a = 0, footerColumnsGroups_1 = footerColumnsGroups; _a < footerColumnsGroups_1.length; _a++) {
|
683
|
-
var columnGroup = footerColumnsGroups_1[_a];
|
684
|
-
if (columnGroup.frozen)
|
685
|
-
this.frozenFooterColumnGroup = columnGroup;
|
686
|
-
else
|
687
|
-
this.scrollableFooterColumnGroup = columnGroup;
|
688
|
-
}
|
689
|
-
};
|
690
|
-
DataTable.prototype.resolveFieldData = function (data, field) {
|
691
|
-
return objectutils_1.ObjectUtils.resolveFieldData(data, field);
|
692
|
-
};
|
693
|
-
DataTable.prototype.updateRowGroupMetadata = function () {
|
694
|
-
this.rowGroupMetadata = {};
|
695
|
-
if (this.dataToRender) {
|
696
|
-
for (var i = 0; i < this.dataToRender.length; i++) {
|
697
|
-
var rowData = this.dataToRender[i];
|
698
|
-
var group = this.resolveFieldData(rowData, this.sortField);
|
699
|
-
if (i == 0) {
|
700
|
-
this.rowGroupMetadata[group] = { index: 0, size: 1 };
|
701
|
-
}
|
702
|
-
else {
|
703
|
-
var previousRowData = this.dataToRender[i - 1];
|
704
|
-
var previousRowGroup = this.resolveFieldData(previousRowData, this.sortField);
|
705
|
-
if (group === previousRowGroup) {
|
706
|
-
this.rowGroupMetadata[group].size++;
|
707
|
-
}
|
708
|
-
else {
|
709
|
-
this.rowGroupMetadata[group] = { index: i, size: 1 };
|
710
|
-
}
|
711
|
-
}
|
712
|
-
}
|
713
|
-
}
|
714
|
-
};
|
715
|
-
DataTable.prototype.updatePaginator = function () {
|
716
|
-
//total records
|
717
|
-
this.updateTotalRecords();
|
718
|
-
//first
|
719
|
-
if (this.totalRecords && this.first >= this.totalRecords) {
|
720
|
-
var numberOfPages = Math.ceil(this.totalRecords / this.rows);
|
721
|
-
this._first = Math.max((numberOfPages - 1) * this.rows, 0);
|
722
|
-
}
|
723
|
-
};
|
724
|
-
DataTable.prototype.updateTotalRecords = function () {
|
725
|
-
this.totalRecords = this.lazy ? this.totalRecords : (this.value ? this.value.length : 0);
|
726
|
-
};
|
727
|
-
DataTable.prototype.onPageChange = function (event) {
|
728
|
-
this._first = event.first;
|
729
|
-
this.firstChange.emit(this.first);
|
730
|
-
this.rows = event.rows;
|
731
|
-
this.paginate();
|
732
|
-
};
|
733
|
-
DataTable.prototype.paginate = function () {
|
734
|
-
if (this.lazy)
|
735
|
-
this.onLazyLoad.emit(this.createLazyLoadMetadata());
|
736
|
-
else
|
737
|
-
this.updateDataToRender(this.filteredValue || this.value);
|
738
|
-
this.onPage.emit({
|
739
|
-
first: this.first,
|
740
|
-
rows: this.rows
|
741
|
-
});
|
742
|
-
};
|
743
|
-
DataTable.prototype.updateDataToRender = function (datasource) {
|
744
|
-
if ((this.paginator || this.virtualScroll) && datasource) {
|
745
|
-
this.dataToRender = [];
|
746
|
-
var startIndex = this.lazy ? 0 : this.first;
|
747
|
-
var endIndex = this.virtualScroll ? this.first + this.rows * 2 : startIndex + this.rows;
|
748
|
-
for (var i = startIndex; i < endIndex; i++) {
|
749
|
-
if (i >= datasource.length) {
|
750
|
-
break;
|
751
|
-
}
|
752
|
-
this.dataToRender.push(datasource[i]);
|
753
|
-
}
|
754
|
-
}
|
755
|
-
else {
|
756
|
-
this.dataToRender = datasource;
|
757
|
-
}
|
758
|
-
if (this.rowGroupMode) {
|
759
|
-
this.updateRowGroupMetadata();
|
760
|
-
}
|
761
|
-
this.changeDetector.markForCheck();
|
762
|
-
};
|
763
|
-
DataTable.prototype.onVirtualScroll = function (event) {
|
764
|
-
var _this = this;
|
765
|
-
this._first = (event.page - 1) * this.rows;
|
766
|
-
this.virtualScrollCallback = event.callback;
|
767
|
-
this.zone.run(function () {
|
768
|
-
if (_this.virtualScrollTimer) {
|
769
|
-
clearTimeout(_this.virtualScrollTimer);
|
770
|
-
}
|
771
|
-
_this.virtualScrollTimer = setTimeout(function () {
|
772
|
-
if (_this.lazy)
|
773
|
-
_this.onLazyLoad.emit(_this.createLazyLoadMetadata());
|
774
|
-
else
|
775
|
-
_this.updateDataToRender(_this.filteredValue || _this.value);
|
776
|
-
}, _this.virtualScrollDelay);
|
777
|
-
});
|
778
|
-
};
|
779
|
-
DataTable.prototype.onHeaderKeydown = function (event, column) {
|
780
|
-
if (event.keyCode == 13) {
|
781
|
-
this.sort(event, column);
|
782
|
-
event.preventDefault();
|
783
|
-
}
|
784
|
-
};
|
785
|
-
DataTable.prototype.onHeaderMousedown = function (event, header) {
|
786
|
-
if (this.reorderableColumns) {
|
787
|
-
if (event.target.nodeName !== 'INPUT') {
|
788
|
-
header.draggable = true;
|
789
|
-
}
|
790
|
-
else if (event.target.nodeName === 'INPUT') {
|
791
|
-
header.draggable = false;
|
792
|
-
}
|
793
|
-
}
|
794
|
-
};
|
795
|
-
DataTable.prototype.sort = function (event, column) {
|
796
|
-
if (!column.sortable) {
|
797
|
-
return;
|
798
|
-
}
|
799
|
-
var targetNode = event.target;
|
800
|
-
if (domhandler_1.DomHandler.hasClass(targetNode, 'ui-sortable-column') || domhandler_1.DomHandler.hasClass(targetNode, 'ui-column-title') || domhandler_1.DomHandler.hasClass(targetNode, 'ui-sortable-column-icon')) {
|
801
|
-
if (!this.immutable) {
|
802
|
-
this.preventSortPropagation = true;
|
803
|
-
}
|
804
|
-
var columnSortField = column.sortField || column.field;
|
805
|
-
this._sortOrder = (this.sortField === columnSortField) ? this.sortOrder * -1 : this.defaultSortOrder;
|
806
|
-
this._sortField = columnSortField;
|
807
|
-
this.sortColumn = column;
|
808
|
-
var metaKey = event.metaKey || event.ctrlKey;
|
809
|
-
if (this.sortMode == 'multiple') {
|
810
|
-
if (!this.multiSortMeta || !metaKey) {
|
811
|
-
this._multiSortMeta = [];
|
812
|
-
}
|
813
|
-
this.addSortMeta({ field: this.sortField, order: this.sortOrder });
|
814
|
-
}
|
815
|
-
if (this.lazy) {
|
816
|
-
this._first = 0;
|
817
|
-
this.onLazyLoad.emit(this.createLazyLoadMetadata());
|
818
|
-
}
|
819
|
-
else {
|
820
|
-
if (this.sortMode == 'multiple')
|
821
|
-
this.sortMultiple();
|
822
|
-
else
|
823
|
-
this.sortSingle();
|
824
|
-
}
|
825
|
-
this.onSort.emit({
|
826
|
-
field: this.sortField,
|
827
|
-
order: this.sortOrder,
|
828
|
-
multisortmeta: this.multiSortMeta
|
829
|
-
});
|
830
|
-
}
|
831
|
-
this.updateDataToRender(this.filteredValue || this.value);
|
832
|
-
};
|
833
|
-
DataTable.prototype.sortSingle = function () {
|
834
|
-
var _this = this;
|
835
|
-
if (this.value) {
|
836
|
-
if (this.sortColumn && this.sortColumn.sortable === 'custom') {
|
837
|
-
this.preventSortPropagation = true;
|
838
|
-
this.sortColumn.sortFunction.emit({
|
839
|
-
field: this.sortField,
|
840
|
-
order: this.sortOrder
|
841
|
-
});
|
842
|
-
}
|
843
|
-
else {
|
844
|
-
this.value.sort(function (data1, data2) {
|
845
|
-
var value1 = _this.resolveFieldData(data1, _this.sortField);
|
846
|
-
var value2 = _this.resolveFieldData(data2, _this.sortField);
|
847
|
-
var result = null;
|
848
|
-
if (value1 == null && value2 != null)
|
849
|
-
result = -1;
|
850
|
-
else if (value1 != null && value2 == null)
|
851
|
-
result = 1;
|
852
|
-
else if (value1 == null && value2 == null)
|
853
|
-
result = 0;
|
854
|
-
else if (typeof value1 === 'string' && typeof value2 === 'string')
|
855
|
-
result = value1.localeCompare(value2);
|
856
|
-
else
|
857
|
-
result = (value1 < value2) ? -1 : (value1 > value2) ? 1 : 0;
|
858
|
-
return (_this.sortOrder * result);
|
859
|
-
});
|
860
|
-
}
|
861
|
-
this._first = 0;
|
862
|
-
if (this.hasFilter()) {
|
863
|
-
this._filter();
|
864
|
-
}
|
865
|
-
}
|
866
|
-
};
|
867
|
-
DataTable.prototype.sortMultiple = function () {
|
868
|
-
var _this = this;
|
869
|
-
if (this.value) {
|
870
|
-
this.value.sort(function (data1, data2) {
|
871
|
-
return _this.multisortField(data1, data2, _this.multiSortMeta, 0);
|
872
|
-
});
|
873
|
-
if (this.hasFilter()) {
|
874
|
-
this._filter();
|
875
|
-
}
|
876
|
-
}
|
877
|
-
};
|
878
|
-
DataTable.prototype.multisortField = function (data1, data2, multiSortMeta, index) {
|
879
|
-
var value1 = this.resolveFieldData(data1, multiSortMeta[index].field);
|
880
|
-
var value2 = this.resolveFieldData(data2, multiSortMeta[index].field);
|
881
|
-
var result = null;
|
882
|
-
if (typeof value1 == 'string' || value1 instanceof String) {
|
883
|
-
if (value1.localeCompare && (value1 != value2)) {
|
884
|
-
return (multiSortMeta[index].order * value1.localeCompare(value2));
|
885
|
-
}
|
886
|
-
}
|
887
|
-
else {
|
888
|
-
result = (value1 < value2) ? -1 : 1;
|
889
|
-
}
|
890
|
-
if (value1 == value2) {
|
891
|
-
return (multiSortMeta.length - 1) > (index) ? (this.multisortField(data1, data2, multiSortMeta, index + 1)) : 0;
|
892
|
-
}
|
893
|
-
return (multiSortMeta[index].order * result);
|
894
|
-
};
|
895
|
-
DataTable.prototype.addSortMeta = function (meta) {
|
896
|
-
var index = -1;
|
897
|
-
for (var i = 0; i < this.multiSortMeta.length; i++) {
|
898
|
-
if (this.multiSortMeta[i].field === meta.field) {
|
899
|
-
index = i;
|
900
|
-
break;
|
901
|
-
}
|
902
|
-
}
|
903
|
-
if (index >= 0)
|
904
|
-
this.multiSortMeta[index] = meta;
|
905
|
-
else
|
906
|
-
this.multiSortMeta.push(meta);
|
907
|
-
};
|
908
|
-
DataTable.prototype.isSorted = function (column) {
|
909
|
-
if (!column.sortable) {
|
910
|
-
return false;
|
911
|
-
}
|
912
|
-
var columnSortField = column.sortField || column.field;
|
913
|
-
if (this.sortMode === 'single') {
|
914
|
-
return (this.sortField && columnSortField === this.sortField);
|
915
|
-
}
|
916
|
-
else if (this.sortMode === 'multiple') {
|
917
|
-
var sorted = false;
|
918
|
-
if (this.multiSortMeta) {
|
919
|
-
for (var i = 0; i < this.multiSortMeta.length; i++) {
|
920
|
-
if (this.multiSortMeta[i].field == columnSortField) {
|
921
|
-
sorted = true;
|
922
|
-
break;
|
923
|
-
}
|
924
|
-
}
|
925
|
-
}
|
926
|
-
return sorted;
|
927
|
-
}
|
928
|
-
};
|
929
|
-
DataTable.prototype.getSortOrder = function (column) {
|
930
|
-
var order = 0;
|
931
|
-
var columnSortField = column.sortField || column.field;
|
932
|
-
if (this.sortMode === 'single') {
|
933
|
-
if (this.sortField && columnSortField === this.sortField) {
|
934
|
-
order = this.sortOrder;
|
935
|
-
}
|
936
|
-
}
|
937
|
-
else if (this.sortMode === 'multiple') {
|
938
|
-
if (this.multiSortMeta) {
|
939
|
-
for (var i = 0; i < this.multiSortMeta.length; i++) {
|
940
|
-
if (this.multiSortMeta[i].field == columnSortField) {
|
941
|
-
order = this.multiSortMeta[i].order;
|
942
|
-
break;
|
943
|
-
}
|
944
|
-
}
|
945
|
-
}
|
946
|
-
}
|
947
|
-
return order;
|
948
|
-
};
|
949
|
-
DataTable.prototype.onRowGroupClick = function (event) {
|
950
|
-
if (this.rowGroupToggleClick) {
|
951
|
-
this.rowGroupToggleClick = false;
|
952
|
-
return;
|
953
|
-
}
|
954
|
-
if (this.sortableRowGroup) {
|
955
|
-
var targetNode = event.target.nodeName;
|
956
|
-
if ((targetNode == 'TD' || (targetNode == 'SPAN' && !domhandler_1.DomHandler.hasClass(event.target, 'ui-clickable')))) {
|
957
|
-
if (this.sortField != this.groupField) {
|
958
|
-
this._sortField = this.groupField;
|
959
|
-
this.sortSingle();
|
960
|
-
}
|
961
|
-
else {
|
962
|
-
this._sortOrder = -1 * this.sortOrder;
|
963
|
-
this.sortSingle();
|
964
|
-
}
|
965
|
-
}
|
966
|
-
}
|
967
|
-
};
|
968
|
-
DataTable.prototype.clearSelectionRange = function (event) {
|
969
|
-
var rangeStart, rangeEnd;
|
970
|
-
if (this.rangeRowIndex > this.anchorRowIndex) {
|
971
|
-
rangeStart = this.anchorRowIndex;
|
972
|
-
rangeEnd = this.rangeRowIndex;
|
973
|
-
}
|
974
|
-
else if (this.rangeRowIndex < this.anchorRowIndex) {
|
975
|
-
rangeStart = this.rangeRowIndex;
|
976
|
-
rangeEnd = this.anchorRowIndex;
|
977
|
-
}
|
978
|
-
else {
|
979
|
-
rangeStart = this.rangeRowIndex;
|
980
|
-
rangeEnd = this.rangeRowIndex;
|
981
|
-
}
|
982
|
-
var _loop_1 = function (i) {
|
983
|
-
var rangeRowData = this_1.dataToRender[i];
|
984
|
-
var selectionIndex = this_1.findIndexInSelection(rangeRowData);
|
985
|
-
this_1._selection = this_1.selection.filter(function (val, i) { return i != selectionIndex; });
|
986
|
-
var dataKeyValue = this_1.dataKey ? String(this_1.resolveFieldData(rangeRowData, this_1.dataKey)) : null;
|
987
|
-
if (dataKeyValue) {
|
988
|
-
delete this_1.selectionKeys[dataKeyValue];
|
989
|
-
}
|
990
|
-
this_1.onRowUnselect.emit({ originalEvent: event, data: rangeRowData, type: 'row' });
|
991
|
-
};
|
992
|
-
var this_1 = this;
|
993
|
-
for (var i = rangeStart; i <= rangeEnd; i++) {
|
994
|
-
_loop_1(i);
|
995
|
-
}
|
996
|
-
};
|
997
|
-
DataTable.prototype.selectRange = function (event, rowIndex) {
|
998
|
-
var rangeStart, rangeEnd;
|
999
|
-
if (this.anchorRowIndex > rowIndex) {
|
1000
|
-
rangeStart = rowIndex;
|
1001
|
-
rangeEnd = this.anchorRowIndex;
|
1002
|
-
}
|
1003
|
-
else if (this.anchorRowIndex < rowIndex) {
|
1004
|
-
rangeStart = this.anchorRowIndex;
|
1005
|
-
rangeEnd = rowIndex;
|
1006
|
-
}
|
1007
|
-
else {
|
1008
|
-
rangeStart = rowIndex;
|
1009
|
-
rangeEnd = rowIndex;
|
1010
|
-
}
|
1011
|
-
for (var i = rangeStart; i <= rangeEnd; i++) {
|
1012
|
-
var rangeRowData = this.dataToRender[i];
|
1013
|
-
this._selection = this.selection.concat([rangeRowData]);
|
1014
|
-
this.selectionChange.emit(this.selection);
|
1015
|
-
var dataKeyValue = this.dataKey ? String(this.resolveFieldData(rangeRowData, this.dataKey)) : null;
|
1016
|
-
if (dataKeyValue) {
|
1017
|
-
this.selectionKeys[dataKeyValue] = 1;
|
1018
|
-
}
|
1019
|
-
this.onRowSelect.emit({ originalEvent: event, data: rangeRowData, type: 'row' });
|
1020
|
-
}
|
1021
|
-
};
|
1022
|
-
DataTable.prototype.handleRowClick = function (event, rowData, index) {
|
1023
|
-
if (this.preventRowClickPropagation) {
|
1024
|
-
this.preventRowClickPropagation = false;
|
1025
|
-
return;
|
1026
|
-
}
|
1027
|
-
var targetNode = event.target.nodeName;
|
1028
|
-
if (targetNode == 'INPUT' || targetNode == 'BUTTON' || targetNode == 'A' || (domhandler_1.DomHandler.hasClass(event.target, 'ui-clickable'))) {
|
1029
|
-
return;
|
1030
|
-
}
|
1031
|
-
this.onRowClick.next({ originalEvent: event, data: rowData });
|
1032
|
-
if (this.selectionMode) {
|
1033
|
-
if (this.isMultipleSelectionMode() && event.shiftKey && this.anchorRowIndex != null) {
|
1034
|
-
domhandler_1.DomHandler.clearSelection();
|
1035
|
-
if (this.rangeRowIndex != null) {
|
1036
|
-
this.clearSelectionRange(event);
|
1037
|
-
}
|
1038
|
-
this.rangeRowIndex = index;
|
1039
|
-
this.selectRange(event, index);
|
1040
|
-
}
|
1041
|
-
else {
|
1042
|
-
var selected = this.isSelected(rowData);
|
1043
|
-
var metaSelection = this.rowTouched ? false : this.metaKeySelection;
|
1044
|
-
var dataKeyValue = this.dataKey ? String(this.resolveFieldData(rowData, this.dataKey)) : null;
|
1045
|
-
this.anchorRowIndex = index;
|
1046
|
-
this.rangeRowIndex = index;
|
1047
|
-
if (metaSelection) {
|
1048
|
-
var metaKey = event.metaKey || event.ctrlKey;
|
1049
|
-
if (selected && metaKey) {
|
1050
|
-
if (this.isSingleSelectionMode()) {
|
1051
|
-
this._selection = null;
|
1052
|
-
this.selectionKeys = {};
|
1053
|
-
this.selectionChange.emit(null);
|
1054
|
-
}
|
1055
|
-
else {
|
1056
|
-
var selectionIndex_1 = this.findIndexInSelection(rowData);
|
1057
|
-
this._selection = this.selection.filter(function (val, i) { return i != selectionIndex_1; });
|
1058
|
-
this.selectionChange.emit(this.selection);
|
1059
|
-
if (dataKeyValue) {
|
1060
|
-
delete this.selectionKeys[dataKeyValue];
|
1061
|
-
}
|
1062
|
-
}
|
1063
|
-
this.onRowUnselect.emit({ originalEvent: event, data: rowData, type: 'row' });
|
1064
|
-
}
|
1065
|
-
else {
|
1066
|
-
if (this.isSingleSelectionMode()) {
|
1067
|
-
this._selection = rowData;
|
1068
|
-
this.selectionChange.emit(rowData);
|
1069
|
-
if (dataKeyValue) {
|
1070
|
-
this.selectionKeys = {};
|
1071
|
-
this.selectionKeys[dataKeyValue] = 1;
|
1072
|
-
}
|
1073
|
-
}
|
1074
|
-
else if (this.isMultipleSelectionMode()) {
|
1075
|
-
if (metaKey) {
|
1076
|
-
this._selection = this.selection || [];
|
1077
|
-
}
|
1078
|
-
else {
|
1079
|
-
this._selection = [];
|
1080
|
-
this.selectionKeys = {};
|
1081
|
-
}
|
1082
|
-
this._selection = this.selection.concat([rowData]);
|
1083
|
-
this.selectionChange.emit(this.selection);
|
1084
|
-
if (dataKeyValue) {
|
1085
|
-
this.selectionKeys[dataKeyValue] = 1;
|
1086
|
-
}
|
1087
|
-
}
|
1088
|
-
this.onRowSelect.emit({ originalEvent: event, data: rowData, type: 'row' });
|
1089
|
-
}
|
1090
|
-
}
|
1091
|
-
else {
|
1092
|
-
if (this.isSingleSelectionMode()) {
|
1093
|
-
if (selected) {
|
1094
|
-
this._selection = null;
|
1095
|
-
this.selectionKeys = {};
|
1096
|
-
this.selectionChange.emit(this.selection);
|
1097
|
-
this.onRowUnselect.emit({ originalEvent: event, data: rowData, type: 'row' });
|
1098
|
-
}
|
1099
|
-
else {
|
1100
|
-
this._selection = rowData;
|
1101
|
-
this.selectionChange.emit(this.selection);
|
1102
|
-
this.onRowSelect.emit({ originalEvent: event, data: rowData, type: 'row' });
|
1103
|
-
if (dataKeyValue) {
|
1104
|
-
this.selectionKeys = {};
|
1105
|
-
this.selectionKeys[dataKeyValue] = 1;
|
1106
|
-
}
|
1107
|
-
}
|
1108
|
-
}
|
1109
|
-
else {
|
1110
|
-
if (selected) {
|
1111
|
-
var selectionIndex_2 = this.findIndexInSelection(rowData);
|
1112
|
-
this._selection = this.selection.filter(function (val, i) { return i != selectionIndex_2; });
|
1113
|
-
this.selectionChange.emit(this.selection);
|
1114
|
-
this.onRowUnselect.emit({ originalEvent: event, data: rowData, type: 'row' });
|
1115
|
-
if (dataKeyValue) {
|
1116
|
-
delete this.selectionKeys[dataKeyValue];
|
1117
|
-
}
|
1118
|
-
}
|
1119
|
-
else {
|
1120
|
-
this._selection = (this.selection || []).concat([rowData]);
|
1121
|
-
this.selectionChange.emit(this.selection);
|
1122
|
-
this.onRowSelect.emit({ originalEvent: event, data: rowData, type: 'row' });
|
1123
|
-
if (dataKeyValue) {
|
1124
|
-
this.selectionKeys[dataKeyValue] = 1;
|
1125
|
-
}
|
1126
|
-
}
|
1127
|
-
}
|
1128
|
-
}
|
1129
|
-
}
|
1130
|
-
this.preventSelectionKeysPropagation = true;
|
1131
|
-
}
|
1132
|
-
this.rowTouched = false;
|
1133
|
-
};
|
1134
|
-
DataTable.prototype.handleRowTouchEnd = function (event) {
|
1135
|
-
this.rowTouched = true;
|
1136
|
-
};
|
1137
|
-
DataTable.prototype.selectRowWithRadio = function (event, rowData) {
|
1138
|
-
if (this.selection != rowData) {
|
1139
|
-
this._selection = rowData;
|
1140
|
-
this.selectionChange.emit(this.selection);
|
1141
|
-
this.onRowSelect.emit({ originalEvent: event, data: rowData, type: 'radiobutton' });
|
1142
|
-
if (this.dataKey) {
|
1143
|
-
this.selectionKeys = {};
|
1144
|
-
this.selectionKeys[String(this.resolveFieldData(rowData, this.dataKey))] = 1;
|
1145
|
-
}
|
1146
|
-
}
|
1147
|
-
else {
|
1148
|
-
this._selection = null;
|
1149
|
-
this.selectionChange.emit(this.selection);
|
1150
|
-
this.onRowUnselect.emit({ originalEvent: event, data: rowData, type: 'radiobutton' });
|
1151
|
-
}
|
1152
|
-
this.preventSelectionKeysPropagation = true;
|
1153
|
-
this.preventRowClickPropagation = true;
|
1154
|
-
};
|
1155
|
-
DataTable.prototype.toggleRowWithCheckbox = function (event, rowData) {
|
1156
|
-
var selectionIndex = this.findIndexInSelection(rowData);
|
1157
|
-
this.selection = this.selection || [];
|
1158
|
-
var dataKeyValue = this.dataKey ? String(this.resolveFieldData(rowData, this.dataKey)) : null;
|
1159
|
-
if (selectionIndex != -1) {
|
1160
|
-
this._selection = this.selection.filter(function (val, i) { return i != selectionIndex; });
|
1161
|
-
this.selectionChange.emit(this.selection);
|
1162
|
-
this.onRowUnselect.emit({ originalEvent: event, data: rowData, type: 'checkbox' });
|
1163
|
-
if (dataKeyValue) {
|
1164
|
-
delete this.selectionKeys[dataKeyValue];
|
1165
|
-
}
|
1166
|
-
}
|
1167
|
-
else {
|
1168
|
-
this._selection = this.selection.concat([rowData]);
|
1169
|
-
this.selectionChange.emit(this.selection);
|
1170
|
-
this.onRowSelect.emit({ originalEvent: event, data: rowData, type: 'checkbox' });
|
1171
|
-
if (dataKeyValue) {
|
1172
|
-
this.selectionKeys[dataKeyValue] = 1;
|
1173
|
-
}
|
1174
|
-
}
|
1175
|
-
this.preventSelectionKeysPropagation = true;
|
1176
|
-
this.preventRowClickPropagation = true;
|
1177
|
-
};
|
1178
|
-
DataTable.prototype.toggleRowsWithCheckbox = function (event) {
|
1179
|
-
if (event.checked)
|
1180
|
-
this.selection = this.headerCheckboxToggleAllPages ? this.value.slice() : this.dataToRender.slice();
|
1181
|
-
else
|
1182
|
-
this.selection = [];
|
1183
|
-
this.selectionChange.emit(this.selection);
|
1184
|
-
this.onHeaderCheckboxToggle.emit({ originalEvent: event, checked: event.checked });
|
1185
|
-
};
|
1186
|
-
DataTable.prototype.onRowRightClick = function (event, rowData) {
|
1187
|
-
if (this.contextMenu) {
|
1188
|
-
var selectionIndex = this.findIndexInSelection(rowData);
|
1189
|
-
var selected = selectionIndex != -1;
|
1190
|
-
var dataKeyValue = this.dataKey ? String(this.resolveFieldData(rowData, this.dataKey)) : null;
|
1191
|
-
if (!selected) {
|
1192
|
-
if (this.isSingleSelectionMode()) {
|
1193
|
-
this.selection = rowData;
|
1194
|
-
this.selectionChange.emit(rowData);
|
1195
|
-
}
|
1196
|
-
else if (this.isMultipleSelectionMode()) {
|
1197
|
-
this.selection = [rowData];
|
1198
|
-
this.selectionChange.emit(this.selection);
|
1199
|
-
}
|
1200
|
-
if (this.dataKey) {
|
1201
|
-
this.selectionKeys[String(this.resolveFieldData(rowData, this.dataKey))] = 1;
|
1202
|
-
this.preventSelectionKeysPropagation = true;
|
1203
|
-
}
|
1204
|
-
}
|
1205
|
-
this.contextMenu.show(event);
|
1206
|
-
this.onContextMenuSelect.emit({ originalEvent: event, data: rowData });
|
1207
|
-
}
|
1208
|
-
};
|
1209
|
-
DataTable.prototype.rowDblclick = function (event, rowData) {
|
1210
|
-
this.onRowDblclick.emit({ originalEvent: event, data: rowData });
|
1211
|
-
};
|
1212
|
-
DataTable.prototype.isSingleSelectionMode = function () {
|
1213
|
-
return this.selectionMode === 'single';
|
1214
|
-
};
|
1215
|
-
DataTable.prototype.isMultipleSelectionMode = function () {
|
1216
|
-
return this.selectionMode === 'multiple';
|
1217
|
-
};
|
1218
|
-
DataTable.prototype.findIndexInSelection = function (rowData) {
|
1219
|
-
var index = -1;
|
1220
|
-
if (this.selection) {
|
1221
|
-
for (var i = 0; i < this.selection.length; i++) {
|
1222
|
-
if (this.equals(rowData, this.selection[i])) {
|
1223
|
-
index = i;
|
1224
|
-
break;
|
1225
|
-
}
|
1226
|
-
}
|
1227
|
-
}
|
1228
|
-
return index;
|
1229
|
-
};
|
1230
|
-
DataTable.prototype.isSelected = function (rowData) {
|
1231
|
-
if (rowData && this.selection) {
|
1232
|
-
if (this.dataKey) {
|
1233
|
-
return this.selectionKeys[objectutils_1.ObjectUtils.resolveFieldData(rowData, this.dataKey)] !== undefined;
|
1234
|
-
}
|
1235
|
-
else {
|
1236
|
-
if (this.selection instanceof Array)
|
1237
|
-
return this.findIndexInSelection(rowData) > -1;
|
1238
|
-
else
|
1239
|
-
return this.equals(rowData, this.selection);
|
1240
|
-
}
|
1241
|
-
}
|
1242
|
-
return false;
|
1243
|
-
};
|
1244
|
-
DataTable.prototype.equals = function (data1, data2) {
|
1245
|
-
return this.compareSelectionBy === 'equals' ? (data1 === data2) : objectutils_1.ObjectUtils.equals(data1, data2, this.dataKey);
|
1246
|
-
};
|
1247
|
-
Object.defineProperty(DataTable.prototype, "allSelected", {
|
1248
|
-
get: function () {
|
1249
|
-
if (this.headerCheckboxToggleAllPages) {
|
1250
|
-
return this.selection && this.value && this.selection.length === this.value.length;
|
1251
|
-
}
|
1252
|
-
else {
|
1253
|
-
var val = true;
|
1254
|
-
if (this.dataToRender && this.selection && (this.dataToRender.length <= this.selection.length)) {
|
1255
|
-
for (var _i = 0, _a = this.dataToRender; _i < _a.length; _i++) {
|
1256
|
-
var data = _a[_i];
|
1257
|
-
if (!this.isSelected(data)) {
|
1258
|
-
val = false;
|
1259
|
-
break;
|
1260
|
-
}
|
1261
|
-
}
|
1262
|
-
}
|
1263
|
-
else {
|
1264
|
-
val = false;
|
1265
|
-
}
|
1266
|
-
return val;
|
1267
|
-
}
|
1268
|
-
},
|
1269
|
-
enumerable: true,
|
1270
|
-
configurable: true
|
1271
|
-
});
|
1272
|
-
DataTable.prototype.onFilterKeyup = function (value, field, matchMode) {
|
1273
|
-
var _this = this;
|
1274
|
-
if (this.filterTimeout) {
|
1275
|
-
clearTimeout(this.filterTimeout);
|
1276
|
-
}
|
1277
|
-
this.filterTimeout = setTimeout(function () {
|
1278
|
-
_this.filter(value, field, matchMode);
|
1279
|
-
_this.filterTimeout = null;
|
1280
|
-
}, this.filterDelay);
|
1281
|
-
};
|
1282
|
-
DataTable.prototype.filter = function (value, field, matchMode) {
|
1283
|
-
if (!this.isFilterBlank(value))
|
1284
|
-
this.filters[field] = { value: value, matchMode: matchMode };
|
1285
|
-
else if (this.filters[field])
|
1286
|
-
delete this.filters[field];
|
1287
|
-
this._filter();
|
1288
|
-
};
|
1289
|
-
DataTable.prototype.isFilterBlank = function (filter) {
|
1290
|
-
if (filter !== null && filter !== undefined) {
|
1291
|
-
if ((typeof filter === 'string' && filter.trim().length == 0) || (filter instanceof Array && filter.length == 0))
|
1292
|
-
return true;
|
1293
|
-
else
|
1294
|
-
return false;
|
1295
|
-
}
|
1296
|
-
return true;
|
1297
|
-
};
|
1298
|
-
DataTable.prototype._filter = function () {
|
1299
|
-
this._first = 0;
|
1300
|
-
if (this.lazy) {
|
1301
|
-
this.onLazyLoad.emit(this.createLazyLoadMetadata());
|
1302
|
-
}
|
1303
|
-
else {
|
1304
|
-
if (!this.value || !this.columns) {
|
1305
|
-
return;
|
1306
|
-
}
|
1307
|
-
this.filteredValue = [];
|
1308
|
-
for (var i = 0; i < this.value.length; i++) {
|
1309
|
-
var localMatch = true;
|
1310
|
-
var globalMatch = false;
|
1311
|
-
for (var j = 0; j < this.columns.length; j++) {
|
1312
|
-
var col = this.columns[j], filterMeta = this.filters[col.filterField || col.field];
|
1313
|
-
//local
|
1314
|
-
if (filterMeta) {
|
1315
|
-
var filterValue = filterMeta.value, filterField = col.filterField || col.field, filterMatchMode = filterMeta.matchMode || 'startsWith', dataFieldValue = this.resolveFieldData(this.value[i], filterField);
|
1316
|
-
var filterConstraint = this.filterConstraints[filterMatchMode];
|
1317
|
-
if (!filterConstraint(dataFieldValue, filterValue)) {
|
1318
|
-
localMatch = false;
|
1319
|
-
}
|
1320
|
-
if (!localMatch) {
|
1321
|
-
break;
|
1322
|
-
}
|
1323
|
-
}
|
1324
|
-
//global
|
1325
|
-
if (!col.excludeGlobalFilter && this.globalFilter && !globalMatch) {
|
1326
|
-
globalMatch = this.filterConstraints['contains'](this.resolveFieldData(this.value[i], col.filterField || col.field), this.globalFilter.value);
|
1327
|
-
}
|
1328
|
-
}
|
1329
|
-
var matches = localMatch;
|
1330
|
-
if (this.globalFilter) {
|
1331
|
-
matches = localMatch && globalMatch;
|
1332
|
-
}
|
1333
|
-
if (matches) {
|
1334
|
-
this.filteredValue.push(this.value[i]);
|
1335
|
-
}
|
1336
|
-
}
|
1337
|
-
if (this.filteredValue.length === this.value.length) {
|
1338
|
-
this.filteredValue = null;
|
1339
|
-
}
|
1340
|
-
if (this.paginator) {
|
1341
|
-
this.totalRecords = this.filteredValue ? this.filteredValue.length : this.value ? this.value.length : 0;
|
1342
|
-
}
|
1343
|
-
this.updateDataToRender(this.filteredValue || this.value);
|
1344
|
-
}
|
1345
|
-
this.onFilter.emit({
|
1346
|
-
filters: this.filters,
|
1347
|
-
filteredValue: this.filteredValue || this.value
|
1348
|
-
});
|
1349
|
-
};
|
1350
|
-
DataTable.prototype.hasFilter = function () {
|
1351
|
-
var empty = true;
|
1352
|
-
for (var prop in this.filters) {
|
1353
|
-
if (this.filters.hasOwnProperty(prop)) {
|
1354
|
-
empty = false;
|
1355
|
-
break;
|
1356
|
-
}
|
1357
|
-
}
|
1358
|
-
return !empty || (this.globalFilter && this.globalFilter.value && this.globalFilter.value.trim().length);
|
1359
|
-
};
|
1360
|
-
DataTable.prototype.onFilterInputClick = function (event) {
|
1361
|
-
event.stopPropagation();
|
1362
|
-
};
|
1363
|
-
DataTable.prototype.switchCellToEditMode = function (cell, column, rowData) {
|
1364
|
-
if (!this.selectionMode && this.editable && column.editable) {
|
1365
|
-
this.editorClick = true;
|
1366
|
-
this.bindDocumentEditListener();
|
1367
|
-
if (cell != this.editingCell) {
|
1368
|
-
if (this.editingCell && domhandler_1.DomHandler.find(this.editingCell, '.ng-invalid.ng-dirty').length == 0) {
|
1369
|
-
domhandler_1.DomHandler.removeClass(this.editingCell, 'ui-cell-editing');
|
1370
|
-
}
|
1371
|
-
this.editingCell = cell;
|
1372
|
-
this.onEditInit.emit({ column: column, data: rowData });
|
1373
|
-
domhandler_1.DomHandler.addClass(cell, 'ui-cell-editing');
|
1374
|
-
var focusable_1 = domhandler_1.DomHandler.findSingle(cell, '.ui-cell-editor input, .ui-cell-editor textarea');
|
1375
|
-
if (focusable_1) {
|
1376
|
-
setTimeout(function () { return domhandler_1.DomHandler.invokeElementMethod(focusable_1, 'focus'); }, 50);
|
1377
|
-
}
|
1378
|
-
}
|
1379
|
-
}
|
1380
|
-
};
|
1381
|
-
DataTable.prototype.switchCellToViewMode = function (element) {
|
1382
|
-
this.editingCell = null;
|
1383
|
-
var cell = this.findCell(element);
|
1384
|
-
domhandler_1.DomHandler.removeClass(cell, 'ui-cell-editing');
|
1385
|
-
this.unbindDocumentEditListener();
|
1386
|
-
};
|
1387
|
-
DataTable.prototype.closeCell = function () {
|
1388
|
-
if (this.editingCell) {
|
1389
|
-
domhandler_1.DomHandler.removeClass(this.editingCell, 'ui-cell-editing');
|
1390
|
-
this.editingCell = null;
|
1391
|
-
this.unbindDocumentEditListener();
|
1392
|
-
}
|
1393
|
-
};
|
1394
|
-
DataTable.prototype.bindDocumentEditListener = function () {
|
1395
|
-
var _this = this;
|
1396
|
-
if (!this.documentEditListener) {
|
1397
|
-
this.documentEditListener = this.renderer.listen('document', 'click', function (event) {
|
1398
|
-
if (!_this.editorClick && event.button !== 2) {
|
1399
|
-
_this.closeCell();
|
1400
|
-
}
|
1401
|
-
_this.editorClick = false;
|
1402
|
-
});
|
1403
|
-
}
|
1404
|
-
};
|
1405
|
-
DataTable.prototype.unbindDocumentEditListener = function () {
|
1406
|
-
if (this.documentEditListener) {
|
1407
|
-
this.documentEditListener();
|
1408
|
-
this.documentEditListener = null;
|
1409
|
-
}
|
1410
|
-
};
|
1411
|
-
DataTable.prototype.onCellEditorKeydown = function (event, column, rowData, rowIndex) {
|
1412
|
-
if (this.editable) {
|
1413
|
-
//enter
|
1414
|
-
if (event.keyCode == 13) {
|
1415
|
-
if (domhandler_1.DomHandler.find(this.editingCell, '.ng-invalid.ng-dirty').length == 0) {
|
1416
|
-
this.switchCellToViewMode(event.target);
|
1417
|
-
event.preventDefault();
|
1418
|
-
}
|
1419
|
-
}
|
1420
|
-
//escape
|
1421
|
-
else if (event.keyCode == 27) {
|
1422
|
-
this.switchCellToViewMode(event.target);
|
1423
|
-
event.preventDefault();
|
1424
|
-
}
|
1425
|
-
//tab
|
1426
|
-
else if (event.keyCode == 9) {
|
1427
|
-
if (event.shiftKey)
|
1428
|
-
this.moveToPreviousCell(event);
|
1429
|
-
else
|
1430
|
-
this.moveToNextCell(event);
|
1431
|
-
}
|
1432
|
-
}
|
1433
|
-
};
|
1434
|
-
DataTable.prototype.onCellEditorInput = function (event, column, rowData, rowIndex) {
|
1435
|
-
if (this.editable) {
|
1436
|
-
this.onEdit.emit({ originalEvent: event, column: column, data: rowData, index: rowIndex });
|
1437
|
-
}
|
1438
|
-
};
|
1439
|
-
DataTable.prototype.onCellEditorChange = function (event, column, rowData, rowIndex) {
|
1440
|
-
if (this.editable) {
|
1441
|
-
this.editChanged = true;
|
1442
|
-
this.onEditComplete.emit({ column: column, data: rowData, index: rowIndex });
|
1443
|
-
}
|
1444
|
-
};
|
1445
|
-
DataTable.prototype.onCellEditorBlur = function (event, column, rowData, rowIndex) {
|
1446
|
-
if (this.editable) {
|
1447
|
-
if (this.editChanged)
|
1448
|
-
this.editChanged = false;
|
1449
|
-
else
|
1450
|
-
this.onEditCancel.emit({ column: column, data: rowData, index: rowIndex });
|
1451
|
-
}
|
1452
|
-
};
|
1453
|
-
DataTable.prototype.moveToPreviousCell = function (event) {
|
1454
|
-
var currentCell = this.findCell(event.target);
|
1455
|
-
var row = currentCell.parentElement;
|
1456
|
-
var targetCell = this.findPreviousEditableColumn(currentCell);
|
1457
|
-
if (targetCell) {
|
1458
|
-
domhandler_1.DomHandler.invokeElementMethod(targetCell, 'click');
|
1459
|
-
event.preventDefault();
|
1460
|
-
}
|
1461
|
-
};
|
1462
|
-
DataTable.prototype.moveToNextCell = function (event) {
|
1463
|
-
var currentCell = this.findCell(event.target);
|
1464
|
-
var row = currentCell.parentElement;
|
1465
|
-
var targetCell = this.findNextEditableColumn(currentCell);
|
1466
|
-
if (targetCell) {
|
1467
|
-
domhandler_1.DomHandler.invokeElementMethod(targetCell, 'click');
|
1468
|
-
event.preventDefault();
|
1469
|
-
}
|
1470
|
-
};
|
1471
|
-
DataTable.prototype.findPreviousEditableColumn = function (cell) {
|
1472
|
-
var prevCell = cell.previousElementSibling;
|
1473
|
-
if (!prevCell) {
|
1474
|
-
var previousRow = cell.parentElement.previousElementSibling;
|
1475
|
-
if (previousRow) {
|
1476
|
-
prevCell = previousRow.lastElementChild;
|
1477
|
-
}
|
1478
|
-
}
|
1479
|
-
if (prevCell) {
|
1480
|
-
if (domhandler_1.DomHandler.hasClass(prevCell, 'ui-editable-column'))
|
1481
|
-
return prevCell;
|
1482
|
-
else
|
1483
|
-
return this.findPreviousEditableColumn(prevCell);
|
1484
|
-
}
|
1485
|
-
else {
|
1486
|
-
return null;
|
1487
|
-
}
|
1488
|
-
};
|
1489
|
-
DataTable.prototype.findNextEditableColumn = function (cell) {
|
1490
|
-
var nextCell = cell.nextElementSibling;
|
1491
|
-
if (!nextCell) {
|
1492
|
-
var nextRow = cell.parentElement.nextElementSibling;
|
1493
|
-
if (nextRow) {
|
1494
|
-
nextCell = nextRow.firstElementChild;
|
1495
|
-
}
|
1496
|
-
}
|
1497
|
-
if (nextCell) {
|
1498
|
-
if (domhandler_1.DomHandler.hasClass(nextCell, 'ui-editable-column'))
|
1499
|
-
return nextCell;
|
1500
|
-
else
|
1501
|
-
return this.findNextEditableColumn(nextCell);
|
1502
|
-
}
|
1503
|
-
else {
|
1504
|
-
return null;
|
1505
|
-
}
|
1506
|
-
};
|
1507
|
-
DataTable.prototype.onCustomEditorFocusPrev = function (event) {
|
1508
|
-
this.moveToPreviousCell(event);
|
1509
|
-
};
|
1510
|
-
DataTable.prototype.onCustomEditorFocusNext = function (event) {
|
1511
|
-
this.moveToNextCell(event);
|
1512
|
-
};
|
1513
|
-
DataTable.prototype.findCell = function (element) {
|
1514
|
-
if (element) {
|
1515
|
-
var cell = element;
|
1516
|
-
while (cell && cell.tagName != 'TD') {
|
1517
|
-
cell = cell.parentElement;
|
1518
|
-
}
|
1519
|
-
return cell;
|
1520
|
-
}
|
1521
|
-
else {
|
1522
|
-
return null;
|
1523
|
-
}
|
1524
|
-
};
|
1525
|
-
DataTable.prototype.initResizableColumns = function () {
|
1526
|
-
this.tbody = domhandler_1.DomHandler.findSingle(this.el.nativeElement, 'tbody.ui-datatable-data');
|
1527
|
-
this.resizerHelper = domhandler_1.DomHandler.findSingle(this.el.nativeElement, 'div.ui-column-resizer-helper');
|
1528
|
-
this.fixColumnWidths();
|
1529
|
-
};
|
1530
|
-
DataTable.prototype.onDocumentMouseMove = function (event) {
|
1531
|
-
if (this.columnResizing) {
|
1532
|
-
this.onColumnResize(event);
|
1533
|
-
}
|
1534
|
-
};
|
1535
|
-
DataTable.prototype.onDocumentMouseUp = function (event) {
|
1536
|
-
if (this.columnResizing) {
|
1537
|
-
this.columnResizing = false;
|
1538
|
-
this.onColumnResizeEnd(event);
|
1539
|
-
}
|
1540
|
-
};
|
1541
|
-
DataTable.prototype.bindColumnResizeEvents = function () {
|
1542
|
-
var _this = this;
|
1543
|
-
this.zone.runOutsideAngular(function () {
|
1544
|
-
window.document.addEventListener('mousemove', _this.onDocumentMouseMove.bind(_this));
|
1545
|
-
});
|
1546
|
-
this.documentColumnResizeEndListener = this.renderer.listen('document', 'mouseup', function (event) {
|
1547
|
-
if (_this.columnResizing) {
|
1548
|
-
_this.columnResizing = false;
|
1549
|
-
_this.onColumnResizeEnd(event);
|
1550
|
-
}
|
1551
|
-
});
|
1552
|
-
};
|
1553
|
-
DataTable.prototype.unbindColumnResizeEvents = function () {
|
1554
|
-
window.document.removeEventListener('mousemove', this.onDocumentMouseMove);
|
1555
|
-
if (this.documentColumnResizeEndListener) {
|
1556
|
-
this.documentColumnResizeEndListener();
|
1557
|
-
this.documentColumnResizeEndListener = null;
|
1558
|
-
}
|
1559
|
-
};
|
1560
|
-
DataTable.prototype.initColumnResize = function (event) {
|
1561
|
-
this.bindColumnResizeEvents();
|
1562
|
-
var container = this.el.nativeElement.children[0];
|
1563
|
-
var containerLeft = domhandler_1.DomHandler.getOffset(container).left;
|
1564
|
-
this.resizeColumn = event.target.parentElement;
|
1565
|
-
this.columnResizing = true;
|
1566
|
-
this.lastResizerHelperX = (event.pageX - containerLeft + container.scrollLeft);
|
1567
|
-
};
|
1568
|
-
DataTable.prototype.onColumnResize = function (event) {
|
1569
|
-
var container = this.el.nativeElement.children[0];
|
1570
|
-
var containerLeft = domhandler_1.DomHandler.getOffset(container).left;
|
1571
|
-
domhandler_1.DomHandler.addClass(container, 'ui-unselectable-text');
|
1572
|
-
this.resizerHelper.style.height = container.offsetHeight + 'px';
|
1573
|
-
this.resizerHelper.style.top = 0 + 'px';
|
1574
|
-
this.resizerHelper.style.left = (event.pageX - containerLeft + container.scrollLeft) + 'px';
|
1575
|
-
this.resizerHelper.style.display = 'block';
|
1576
|
-
};
|
1577
|
-
DataTable.prototype.onColumnResizeEnd = function (event) {
|
1578
|
-
var delta = this.resizerHelper.offsetLeft - this.lastResizerHelperX;
|
1579
|
-
var columnWidth = this.resizeColumn.offsetWidth;
|
1580
|
-
var newColumnWidth = columnWidth + delta;
|
1581
|
-
var minWidth = this.resizeColumn.style.minWidth || 15;
|
1582
|
-
if (columnWidth + delta > parseInt(minWidth)) {
|
1583
|
-
if (this.columnResizeMode === 'fit') {
|
1584
|
-
var nextColumn = this.resizeColumn.nextElementSibling;
|
1585
|
-
while (domhandler_1.DomHandler.hasClass(nextColumn, 'ui-helper-hidden')) {
|
1586
|
-
nextColumn = nextColumn.nextElementSibling;
|
1587
|
-
}
|
1588
|
-
if (nextColumn) {
|
1589
|
-
var nextColumnWidth = nextColumn.offsetWidth - delta;
|
1590
|
-
var nextColumnMinWidth = nextColumn.style.minWidth || 15;
|
1591
|
-
if (newColumnWidth > 15 && nextColumnWidth > parseInt(nextColumnMinWidth)) {
|
1592
|
-
this.resizeColumn.style.width = newColumnWidth + 'px';
|
1593
|
-
if (nextColumn) {
|
1594
|
-
nextColumn.style.width = nextColumnWidth + 'px';
|
1595
|
-
}
|
1596
|
-
if (this.scrollable) {
|
1597
|
-
var colGroup = domhandler_1.DomHandler.findSingle(this.el.nativeElement, 'colgroup.ui-datatable-scrollable-colgroup');
|
1598
|
-
var resizeColumnIndex = domhandler_1.DomHandler.index(this.resizeColumn);
|
1599
|
-
colGroup.children[resizeColumnIndex].style.width = newColumnWidth + 'px';
|
1600
|
-
if (nextColumn) {
|
1601
|
-
colGroup.children[resizeColumnIndex + 1].style.width = nextColumnWidth + 'px';
|
1602
|
-
}
|
1603
|
-
}
|
1604
|
-
}
|
1605
|
-
}
|
1606
|
-
}
|
1607
|
-
else if (this.columnResizeMode === 'expand') {
|
1608
|
-
this.tbody.parentElement.style.width = this.tbody.parentElement.offsetWidth + delta + 'px';
|
1609
|
-
this.resizeColumn.style.width = newColumnWidth + 'px';
|
1610
|
-
var containerWidth = this.tbody.parentElement.style.width;
|
1611
|
-
if (this.scrollable) {
|
1612
|
-
domhandler_1.DomHandler.findSingle(this.el.nativeElement, '.ui-datatable-scrollable-header-box').children[0].style.width = containerWidth;
|
1613
|
-
var colGroup = domhandler_1.DomHandler.findSingle(this.el.nativeElement, 'colgroup.ui-datatable-scrollable-colgroup');
|
1614
|
-
var resizeColumnIndex = domhandler_1.DomHandler.index(this.resizeColumn);
|
1615
|
-
colGroup.children[resizeColumnIndex].style.width = newColumnWidth + 'px';
|
1616
|
-
}
|
1617
|
-
else {
|
1618
|
-
this.el.nativeElement.children[0].style.width = containerWidth;
|
1619
|
-
}
|
1620
|
-
}
|
1621
|
-
this.onColResize.emit({
|
1622
|
-
element: this.resizeColumn,
|
1623
|
-
delta: delta
|
1624
|
-
});
|
1625
|
-
}
|
1626
|
-
this.resizerHelper.style.display = 'none';
|
1627
|
-
this.resizeColumn = null;
|
1628
|
-
domhandler_1.DomHandler.removeClass(this.el.nativeElement.children[0], 'ui-unselectable-text');
|
1629
|
-
this.unbindColumnResizeEvents();
|
1630
|
-
};
|
1631
|
-
DataTable.prototype.fixColumnWidths = function () {
|
1632
|
-
var columns = domhandler_1.DomHandler.find(this.el.nativeElement, 'th.ui-resizable-column');
|
1633
|
-
var bodyCols;
|
1634
|
-
for (var i = 0; i < columns.length; i++) {
|
1635
|
-
columns[i].style.width = columns[i].offsetWidth + 'px';
|
1636
|
-
}
|
1637
|
-
if (this.scrollable) {
|
1638
|
-
var colGroup = domhandler_1.DomHandler.findSingle(this.el.nativeElement, 'colgroup.ui-datatable-scrollable-colgroup');
|
1639
|
-
bodyCols = colGroup.children;
|
1640
|
-
if (bodyCols) {
|
1641
|
-
for (var i = 0; i < bodyCols.length; i++) {
|
1642
|
-
bodyCols[i].style.width = columns[i].offsetWidth + 'px';
|
1643
|
-
}
|
1644
|
-
}
|
1645
|
-
}
|
1646
|
-
};
|
1647
|
-
DataTable.prototype.onColumnDragStart = function (event) {
|
1648
|
-
var _this = this;
|
1649
|
-
if (this.columnResizing) {
|
1650
|
-
event.preventDefault();
|
1651
|
-
return;
|
1652
|
-
}
|
1653
|
-
this.draggedColumn = this.findParentHeader(event.target);
|
1654
|
-
event.dataTransfer.setData('text', 'b'); // Firefox requires this to make dragging possible
|
1655
|
-
this.zone.runOutsideAngular(function () {
|
1656
|
-
window.document.addEventListener('dragover', _this.onColumnDragover.bind(_this));
|
1657
|
-
});
|
1658
|
-
};
|
1659
|
-
DataTable.prototype.onColumnDragover = function (event) {
|
1660
|
-
var dropHeader = this.findParentHeader(event.target);
|
1661
|
-
if (this.reorderableColumns && this.draggedColumn && dropHeader) {
|
1662
|
-
event.preventDefault();
|
1663
|
-
var container = this.el.nativeElement.children[0];
|
1664
|
-
var containerOffset = domhandler_1.DomHandler.getOffset(container);
|
1665
|
-
var dropHeaderOffset = domhandler_1.DomHandler.getOffset(dropHeader);
|
1666
|
-
if (this.draggedColumn != dropHeader) {
|
1667
|
-
var targetLeft = dropHeaderOffset.left - containerOffset.left;
|
1668
|
-
var targetTop = containerOffset.top - dropHeaderOffset.top;
|
1669
|
-
var columnCenter = dropHeaderOffset.left + dropHeader.offsetWidth / 2;
|
1670
|
-
this.reorderIndicatorUp.style.top = dropHeaderOffset.top - containerOffset.top - (this.iconHeight - 1) + 'px';
|
1671
|
-
this.reorderIndicatorDown.style.top = dropHeaderOffset.top - containerOffset.top + dropHeader.offsetHeight + 'px';
|
1672
|
-
if (event.pageX > columnCenter) {
|
1673
|
-
this.reorderIndicatorUp.style.left = (targetLeft + dropHeader.offsetWidth - Math.ceil(this.iconWidth / 2)) + 'px';
|
1674
|
-
this.reorderIndicatorDown.style.left = (targetLeft + dropHeader.offsetWidth - Math.ceil(this.iconWidth / 2)) + 'px';
|
1675
|
-
this.dropPosition = 1;
|
1676
|
-
}
|
1677
|
-
else {
|
1678
|
-
this.reorderIndicatorUp.style.left = (targetLeft - Math.ceil(this.iconWidth / 2)) + 'px';
|
1679
|
-
this.reorderIndicatorDown.style.left = (targetLeft - Math.ceil(this.iconWidth / 2)) + 'px';
|
1680
|
-
this.dropPosition = -1;
|
1681
|
-
}
|
1682
|
-
this.reorderIndicatorUp.style.display = 'block';
|
1683
|
-
this.reorderIndicatorDown.style.display = 'block';
|
1684
|
-
}
|
1685
|
-
else {
|
1686
|
-
event.dataTransfer.dropEffect = 'none';
|
1687
|
-
}
|
1688
|
-
}
|
1689
|
-
};
|
1690
|
-
DataTable.prototype.onColumnDragleave = function (event) {
|
1691
|
-
if (this.reorderableColumns && this.draggedColumn) {
|
1692
|
-
event.preventDefault();
|
1693
|
-
this.reorderIndicatorUp.style.display = 'none';
|
1694
|
-
this.reorderIndicatorDown.style.display = 'none';
|
1695
|
-
window.document.removeEventListener('dragover', this.onColumnDragover);
|
1696
|
-
}
|
1697
|
-
};
|
1698
|
-
DataTable.prototype.onColumnDrop = function (event) {
|
1699
|
-
event.preventDefault();
|
1700
|
-
if (this.draggedColumn) {
|
1701
|
-
var dragIndex = domhandler_1.DomHandler.index(this.draggedColumn);
|
1702
|
-
var dropIndex = domhandler_1.DomHandler.index(this.findParentHeader(event.target));
|
1703
|
-
var allowDrop = (dragIndex != dropIndex);
|
1704
|
-
if (allowDrop && ((dropIndex - dragIndex == 1 && this.dropPosition === -1) || (dragIndex - dropIndex == 1 && this.dropPosition === 1))) {
|
1705
|
-
allowDrop = false;
|
1706
|
-
}
|
1707
|
-
if (allowDrop) {
|
1708
|
-
objectutils_1.ObjectUtils.reorderArray(this.columns, dragIndex, dropIndex);
|
1709
|
-
if (this.scrollable) {
|
1710
|
-
this.initScrollableColumns();
|
1711
|
-
}
|
1712
|
-
this.onColReorder.emit({
|
1713
|
-
dragIndex: dragIndex,
|
1714
|
-
dropIndex: dropIndex,
|
1715
|
-
columns: this.columns
|
1716
|
-
});
|
1717
|
-
}
|
1718
|
-
this.reorderIndicatorUp.style.display = 'none';
|
1719
|
-
this.reorderIndicatorDown.style.display = 'none';
|
1720
|
-
this.draggedColumn.draggable = false;
|
1721
|
-
this.draggedColumn = null;
|
1722
|
-
this.dropPosition = null;
|
1723
|
-
}
|
1724
|
-
};
|
1725
|
-
DataTable.prototype.initColumnReordering = function () {
|
1726
|
-
this.reorderIndicatorUp = domhandler_1.DomHandler.findSingle(this.el.nativeElement.children[0], 'span.ui-datatable-reorder-indicator-up');
|
1727
|
-
this.reorderIndicatorDown = domhandler_1.DomHandler.findSingle(this.el.nativeElement.children[0], 'span.ui-datatable-reorder-indicator-down');
|
1728
|
-
this.iconWidth = domhandler_1.DomHandler.getHiddenElementOuterWidth(this.reorderIndicatorUp);
|
1729
|
-
this.iconHeight = domhandler_1.DomHandler.getHiddenElementOuterHeight(this.reorderIndicatorUp);
|
1730
|
-
};
|
1731
|
-
DataTable.prototype.findParentHeader = function (element) {
|
1732
|
-
if (element.nodeName == 'TH') {
|
1733
|
-
return element;
|
1734
|
-
}
|
1735
|
-
else {
|
1736
|
-
var parent_1 = element.parentElement;
|
1737
|
-
while (parent_1.nodeName != 'TH') {
|
1738
|
-
parent_1 = parent_1.parentElement;
|
1739
|
-
if (!parent_1)
|
1740
|
-
break;
|
1741
|
-
}
|
1742
|
-
return parent_1;
|
1743
|
-
}
|
1744
|
-
};
|
1745
|
-
DataTable.prototype.hasFooter = function () {
|
1746
|
-
if (this.footerColumnGroups && this.footerColumnGroups.first) {
|
1747
|
-
return true;
|
1748
|
-
}
|
1749
|
-
else {
|
1750
|
-
if (this.columns) {
|
1751
|
-
for (var i = 0; i < this.columns.length; i++) {
|
1752
|
-
if (this.columns[i].footer || this.columns[i].footerTemplate) {
|
1753
|
-
return true;
|
1754
|
-
}
|
1755
|
-
}
|
1756
|
-
}
|
1757
|
-
}
|
1758
|
-
return false;
|
1759
|
-
};
|
1760
|
-
DataTable.prototype.isEmpty = function () {
|
1761
|
-
return !this.dataToRender || (this.dataToRender.length == 0);
|
1762
|
-
};
|
1763
|
-
DataTable.prototype.createLazyLoadMetadata = function () {
|
1764
|
-
return {
|
1765
|
-
first: this.first,
|
1766
|
-
rows: this.virtualScroll ? this.rows * 2 : this.rows,
|
1767
|
-
sortField: this.sortField,
|
1768
|
-
sortOrder: this.sortOrder,
|
1769
|
-
filters: this.filters,
|
1770
|
-
globalFilter: this.globalFilter ? this.globalFilter.value : null,
|
1771
|
-
multiSortMeta: this.multiSortMeta
|
1772
|
-
};
|
1773
|
-
};
|
1774
|
-
DataTable.prototype.toggleRow = function (row, event) {
|
1775
|
-
if (!this.expandedRows) {
|
1776
|
-
this.expandedRows = [];
|
1777
|
-
}
|
1778
|
-
var expandedRowIndex = this.findExpandedRowIndex(row);
|
1779
|
-
if (expandedRowIndex != -1) {
|
1780
|
-
this.expandedRows.splice(expandedRowIndex, 1);
|
1781
|
-
this.onRowCollapse.emit({
|
1782
|
-
originalEvent: event,
|
1783
|
-
data: row
|
1784
|
-
});
|
1785
|
-
}
|
1786
|
-
else {
|
1787
|
-
if (this.rowExpandMode === 'single') {
|
1788
|
-
this.expandedRows = [];
|
1789
|
-
}
|
1790
|
-
this.expandedRows.push(row);
|
1791
|
-
this.onRowExpand.emit({
|
1792
|
-
originalEvent: event,
|
1793
|
-
data: row
|
1794
|
-
});
|
1795
|
-
}
|
1796
|
-
if (event) {
|
1797
|
-
event.preventDefault();
|
1798
|
-
}
|
1799
|
-
};
|
1800
|
-
DataTable.prototype.findExpandedRowIndex = function (row) {
|
1801
|
-
var index = -1;
|
1802
|
-
if (this.expandedRows) {
|
1803
|
-
for (var i = 0; i < this.expandedRows.length; i++) {
|
1804
|
-
if (this.expandedRows[i] == row) {
|
1805
|
-
index = i;
|
1806
|
-
break;
|
1807
|
-
}
|
1808
|
-
}
|
1809
|
-
}
|
1810
|
-
return index;
|
1811
|
-
};
|
1812
|
-
DataTable.prototype.isRowExpanded = function (row) {
|
1813
|
-
return this.findExpandedRowIndex(row) != -1;
|
1814
|
-
};
|
1815
|
-
DataTable.prototype.findExpandedRowGroupIndex = function (row) {
|
1816
|
-
var index = -1;
|
1817
|
-
if (this.expandedRowsGroups && this.expandedRowsGroups.length) {
|
1818
|
-
for (var i = 0; i < this.expandedRowsGroups.length; i++) {
|
1819
|
-
var group = this.expandedRowsGroups[i];
|
1820
|
-
var rowGroupField = this.resolveFieldData(row, this.groupField);
|
1821
|
-
if (rowGroupField === group) {
|
1822
|
-
index = i;
|
1823
|
-
break;
|
1824
|
-
}
|
1825
|
-
}
|
1826
|
-
}
|
1827
|
-
return index;
|
1828
|
-
};
|
1829
|
-
DataTable.prototype.isRowGroupExpanded = function (row) {
|
1830
|
-
return this.findExpandedRowGroupIndex(row) != -1;
|
1831
|
-
};
|
1832
|
-
DataTable.prototype.toggleRowGroup = function (event, row) {
|
1833
|
-
if (!this.expandedRowsGroups) {
|
1834
|
-
this.expandedRowsGroups = [];
|
1835
|
-
}
|
1836
|
-
this.rowGroupToggleClick = true;
|
1837
|
-
var index = this.findExpandedRowGroupIndex(row);
|
1838
|
-
var rowGroupField = this.resolveFieldData(row, this.groupField);
|
1839
|
-
if (index >= 0) {
|
1840
|
-
this.expandedRowsGroups.splice(index, 1);
|
1841
|
-
this.onRowGroupCollapse.emit({
|
1842
|
-
originalEvent: event,
|
1843
|
-
group: rowGroupField
|
1844
|
-
});
|
1845
|
-
}
|
1846
|
-
else {
|
1847
|
-
if (this.rowGroupExpandMode === 'single') {
|
1848
|
-
this.expandedRowsGroups = [];
|
1849
|
-
}
|
1850
|
-
this.expandedRowsGroups.push(rowGroupField);
|
1851
|
-
this.onRowGroupExpand.emit({
|
1852
|
-
originalEvent: event,
|
1853
|
-
group: rowGroupField
|
1854
|
-
});
|
1855
|
-
}
|
1856
|
-
event.preventDefault();
|
1857
|
-
};
|
1858
|
-
DataTable.prototype.reset = function () {
|
1859
|
-
this._sortField = null;
|
1860
|
-
this._sortOrder = 1;
|
1861
|
-
this.filteredValue = null;
|
1862
|
-
this.filters = {};
|
1863
|
-
this._first = 0;
|
1864
|
-
this.firstChange.emit(this._first);
|
1865
|
-
this.updateTotalRecords();
|
1866
|
-
if (this.lazy)
|
1867
|
-
this.onLazyLoad.emit(this.createLazyLoadMetadata());
|
1868
|
-
else
|
1869
|
-
this.updateDataToRender(this.value);
|
1870
|
-
};
|
1871
|
-
DataTable.prototype.exportCSV = function (options) {
|
1872
|
-
var _this = this;
|
1873
|
-
var data = this.filteredValue || this.value;
|
1874
|
-
var csv = '\ufeff';
|
1875
|
-
if (options && options.selectionOnly) {
|
1876
|
-
data = this.selection || [];
|
1877
|
-
}
|
1878
|
-
//headers
|
1879
|
-
for (var i = 0; i < this.columns.length; i++) {
|
1880
|
-
var column = this.columns[i];
|
1881
|
-
if (column.exportable && column.field) {
|
1882
|
-
csv += '"' + (column.header || column.field) + '"';
|
1883
|
-
if (i < (this.columns.length - 1)) {
|
1884
|
-
csv += this.csvSeparator;
|
1885
|
-
}
|
1886
|
-
}
|
1887
|
-
}
|
1888
|
-
//body
|
1889
|
-
data.forEach(function (record, i) {
|
1890
|
-
csv += '\n';
|
1891
|
-
for (var i_1 = 0; i_1 < _this.columns.length; i_1++) {
|
1892
|
-
var column = _this.columns[i_1];
|
1893
|
-
if (column.exportable && column.field) {
|
1894
|
-
var cellData = _this.resolveFieldData(record, column.field);
|
1895
|
-
if (cellData != null)
|
1896
|
-
cellData = String(cellData).replace(/"/g, '""');
|
1897
|
-
else
|
1898
|
-
cellData = '';
|
1899
|
-
csv += '"' + cellData + '"';
|
1900
|
-
if (i_1 < (_this.columns.length - 1)) {
|
1901
|
-
csv += _this.csvSeparator;
|
1902
|
-
}
|
1903
|
-
}
|
1904
|
-
}
|
1905
|
-
});
|
1906
|
-
var blob = new Blob([csv], {
|
1907
|
-
type: 'text/csv;charset=utf-8;'
|
1908
|
-
});
|
1909
|
-
if (window.navigator.msSaveOrOpenBlob) {
|
1910
|
-
navigator.msSaveOrOpenBlob(blob, this.exportFilename + '.csv');
|
1911
|
-
}
|
1912
|
-
else {
|
1913
|
-
var link = document.createElement("a");
|
1914
|
-
link.style.display = 'none';
|
1915
|
-
document.body.appendChild(link);
|
1916
|
-
if (link.download !== undefined) {
|
1917
|
-
link.setAttribute('href', URL.createObjectURL(blob));
|
1918
|
-
link.setAttribute('download', this.exportFilename + '.csv');
|
1919
|
-
link.click();
|
1920
|
-
}
|
1921
|
-
else {
|
1922
|
-
csv = 'data:text/csv;charset=utf-8,' + csv;
|
1923
|
-
window.open(encodeURI(csv));
|
1924
|
-
}
|
1925
|
-
document.body.removeChild(link);
|
1926
|
-
}
|
1927
|
-
};
|
1928
|
-
DataTable.prototype.getBlockableElement = function () {
|
1929
|
-
return this.el.nativeElement.children[0];
|
1930
|
-
};
|
1931
|
-
DataTable.prototype.getRowStyleClass = function (rowData, rowIndex) {
|
1932
|
-
var styleClass = 'ui-widget-content';
|
1933
|
-
if (this.rowStyleClass) {
|
1934
|
-
var rowClass = this.rowStyleClass.call(this, rowData, rowIndex);
|
1935
|
-
if (rowClass) {
|
1936
|
-
styleClass += ' ' + rowClass;
|
1937
|
-
}
|
1938
|
-
}
|
1939
|
-
else if (this.rowStyleMap && this.dataKey) {
|
1940
|
-
var rowClass = this.rowStyleMap[rowData[this.dataKey]];
|
1941
|
-
if (rowClass) {
|
1942
|
-
styleClass += ' ' + rowClass;
|
1943
|
-
}
|
1944
|
-
}
|
1945
|
-
return styleClass;
|
1946
|
-
};
|
1947
|
-
DataTable.prototype.visibleColumns = function () {
|
1948
|
-
return this.columns ? this.columns.filter(function (c) { return !c.hidden; }) : [];
|
1949
|
-
};
|
1950
|
-
Object.defineProperty(DataTable.prototype, "containerWidth", {
|
1951
|
-
get: function () {
|
1952
|
-
if (this.scrollable) {
|
1953
|
-
if (this.scrollWidth) {
|
1954
|
-
return this.scrollWidth;
|
1955
|
-
}
|
1956
|
-
else if (this.frozenWidth && this.unfrozenWidth) {
|
1957
|
-
return parseFloat(this.frozenWidth) + parseFloat(this.unfrozenWidth) + 'px';
|
1958
|
-
}
|
1959
|
-
}
|
1960
|
-
else {
|
1961
|
-
return this.style ? this.style.width : null;
|
1962
|
-
}
|
1963
|
-
},
|
1964
|
-
enumerable: true,
|
1965
|
-
configurable: true
|
1966
|
-
});
|
1967
|
-
DataTable.prototype.hasFrozenColumns = function () {
|
1968
|
-
return this.frozenColumns && this.frozenColumns.length > 0;
|
1969
|
-
};
|
1970
|
-
DataTable.prototype.ngOnDestroy = function () {
|
1971
|
-
//remove event listener
|
1972
|
-
if (this.globalFilterFunction) {
|
1973
|
-
this.globalFilterFunction();
|
1974
|
-
}
|
1975
|
-
if (this.resizableColumns) {
|
1976
|
-
this.unbindColumnResizeEvents();
|
1977
|
-
}
|
1978
|
-
this.unbindDocumentEditListener();
|
1979
|
-
if (this.columnsSubscription) {
|
1980
|
-
this.columnsSubscription.unsubscribe();
|
1981
|
-
}
|
1982
|
-
if (this.virtualScrollCallback) {
|
1983
|
-
this.virtualScrollCallback = null;
|
1984
|
-
}
|
1985
|
-
};
|
1986
|
-
__decorate([
|
1987
|
-
core_1.Input(),
|
1988
|
-
__metadata("design:type", Boolean)
|
1989
|
-
], DataTable.prototype, "paginator", void 0);
|
1990
|
-
__decorate([
|
1991
|
-
core_1.Input(),
|
1992
|
-
__metadata("design:type", Number)
|
1993
|
-
], DataTable.prototype, "rows", void 0);
|
1994
|
-
__decorate([
|
1995
|
-
core_1.Input(),
|
1996
|
-
__metadata("design:type", Number)
|
1997
|
-
], DataTable.prototype, "pageLinks", void 0);
|
1998
|
-
__decorate([
|
1999
|
-
core_1.Input(),
|
2000
|
-
__metadata("design:type", Array)
|
2001
|
-
], DataTable.prototype, "rowsPerPageOptions", void 0);
|
2002
|
-
__decorate([
|
2003
|
-
core_1.Input(),
|
2004
|
-
__metadata("design:type", Boolean)
|
2005
|
-
], DataTable.prototype, "responsive", void 0);
|
2006
|
-
__decorate([
|
2007
|
-
core_1.Input(),
|
2008
|
-
__metadata("design:type", Boolean)
|
2009
|
-
], DataTable.prototype, "stacked", void 0);
|
2010
|
-
__decorate([
|
2011
|
-
core_1.Input(),
|
2012
|
-
__metadata("design:type", String)
|
2013
|
-
], DataTable.prototype, "selectionMode", void 0);
|
2014
|
-
__decorate([
|
2015
|
-
core_1.Output(),
|
2016
|
-
__metadata("design:type", core_1.EventEmitter)
|
2017
|
-
], DataTable.prototype, "selectionChange", void 0);
|
2018
|
-
__decorate([
|
2019
|
-
core_1.Input(),
|
2020
|
-
__metadata("design:type", Boolean)
|
2021
|
-
], DataTable.prototype, "editable", void 0);
|
2022
|
-
__decorate([
|
2023
|
-
core_1.Input(),
|
2024
|
-
__metadata("design:type", Boolean)
|
2025
|
-
], DataTable.prototype, "showHeaderCheckbox", void 0);
|
2026
|
-
__decorate([
|
2027
|
-
core_1.Output(),
|
2028
|
-
__metadata("design:type", core_1.EventEmitter)
|
2029
|
-
], DataTable.prototype, "onRowClick", void 0);
|
2030
|
-
__decorate([
|
2031
|
-
core_1.Output(),
|
2032
|
-
__metadata("design:type", core_1.EventEmitter)
|
2033
|
-
], DataTable.prototype, "onRowSelect", void 0);
|
2034
|
-
__decorate([
|
2035
|
-
core_1.Output(),
|
2036
|
-
__metadata("design:type", core_1.EventEmitter)
|
2037
|
-
], DataTable.prototype, "onRowUnselect", void 0);
|
2038
|
-
__decorate([
|
2039
|
-
core_1.Output(),
|
2040
|
-
__metadata("design:type", core_1.EventEmitter)
|
2041
|
-
], DataTable.prototype, "onRowDblclick", void 0);
|
2042
|
-
__decorate([
|
2043
|
-
core_1.Output(),
|
2044
|
-
__metadata("design:type", core_1.EventEmitter)
|
2045
|
-
], DataTable.prototype, "onHeaderCheckboxToggle", void 0);
|
2046
|
-
__decorate([
|
2047
|
-
core_1.Input(),
|
2048
|
-
__metadata("design:type", Boolean)
|
2049
|
-
], DataTable.prototype, "headerCheckboxToggleAllPages", void 0);
|
2050
|
-
__decorate([
|
2051
|
-
core_1.Output(),
|
2052
|
-
__metadata("design:type", core_1.EventEmitter)
|
2053
|
-
], DataTable.prototype, "onContextMenuSelect", void 0);
|
2054
|
-
__decorate([
|
2055
|
-
core_1.Input(),
|
2056
|
-
__metadata("design:type", Number)
|
2057
|
-
], DataTable.prototype, "filterDelay", void 0);
|
2058
|
-
__decorate([
|
2059
|
-
core_1.Input(),
|
2060
|
-
__metadata("design:type", Boolean)
|
2061
|
-
], DataTable.prototype, "lazy", void 0);
|
2062
|
-
__decorate([
|
2063
|
-
core_1.Output(),
|
2064
|
-
__metadata("design:type", core_1.EventEmitter)
|
2065
|
-
], DataTable.prototype, "onLazyLoad", void 0);
|
2066
|
-
__decorate([
|
2067
|
-
core_1.Input(),
|
2068
|
-
__metadata("design:type", Boolean)
|
2069
|
-
], DataTable.prototype, "resizableColumns", void 0);
|
2070
|
-
__decorate([
|
2071
|
-
core_1.Input(),
|
2072
|
-
__metadata("design:type", String)
|
2073
|
-
], DataTable.prototype, "columnResizeMode", void 0);
|
2074
|
-
__decorate([
|
2075
|
-
core_1.Output(),
|
2076
|
-
__metadata("design:type", core_1.EventEmitter)
|
2077
|
-
], DataTable.prototype, "onColResize", void 0);
|
2078
|
-
__decorate([
|
2079
|
-
core_1.Input(),
|
2080
|
-
__metadata("design:type", Boolean)
|
2081
|
-
], DataTable.prototype, "reorderableColumns", void 0);
|
2082
|
-
__decorate([
|
2083
|
-
core_1.Output(),
|
2084
|
-
__metadata("design:type", core_1.EventEmitter)
|
2085
|
-
], DataTable.prototype, "onColReorder", void 0);
|
2086
|
-
__decorate([
|
2087
|
-
core_1.Input(),
|
2088
|
-
__metadata("design:type", Boolean)
|
2089
|
-
], DataTable.prototype, "scrollable", void 0);
|
2090
|
-
__decorate([
|
2091
|
-
core_1.Input(),
|
2092
|
-
__metadata("design:type", Boolean)
|
2093
|
-
], DataTable.prototype, "virtualScroll", void 0);
|
2094
|
-
__decorate([
|
2095
|
-
core_1.Input(),
|
2096
|
-
__metadata("design:type", Object)
|
2097
|
-
], DataTable.prototype, "scrollHeight", void 0);
|
2098
|
-
__decorate([
|
2099
|
-
core_1.Input(),
|
2100
|
-
__metadata("design:type", Object)
|
2101
|
-
], DataTable.prototype, "scrollWidth", void 0);
|
2102
|
-
__decorate([
|
2103
|
-
core_1.Input(),
|
2104
|
-
__metadata("design:type", Object)
|
2105
|
-
], DataTable.prototype, "frozenWidth", void 0);
|
2106
|
-
__decorate([
|
2107
|
-
core_1.Input(),
|
2108
|
-
__metadata("design:type", Object)
|
2109
|
-
], DataTable.prototype, "unfrozenWidth", void 0);
|
2110
|
-
__decorate([
|
2111
|
-
core_1.Input(),
|
2112
|
-
__metadata("design:type", Object)
|
2113
|
-
], DataTable.prototype, "style", void 0);
|
2114
|
-
__decorate([
|
2115
|
-
core_1.Input(),
|
2116
|
-
__metadata("design:type", String)
|
2117
|
-
], DataTable.prototype, "styleClass", void 0);
|
2118
|
-
__decorate([
|
2119
|
-
core_1.Input(),
|
2120
|
-
__metadata("design:type", Object)
|
2121
|
-
], DataTable.prototype, "tableStyle", void 0);
|
2122
|
-
__decorate([
|
2123
|
-
core_1.Input(),
|
2124
|
-
__metadata("design:type", String)
|
2125
|
-
], DataTable.prototype, "tableStyleClass", void 0);
|
2126
|
-
__decorate([
|
2127
|
-
core_1.Input(),
|
2128
|
-
__metadata("design:type", Object)
|
2129
|
-
], DataTable.prototype, "globalFilter", void 0);
|
2130
|
-
__decorate([
|
2131
|
-
core_1.Input(),
|
2132
|
-
__metadata("design:type", String)
|
2133
|
-
], DataTable.prototype, "sortMode", void 0);
|
2134
|
-
__decorate([
|
2135
|
-
core_1.Input(),
|
2136
|
-
__metadata("design:type", Number)
|
2137
|
-
], DataTable.prototype, "defaultSortOrder", void 0);
|
2138
|
-
__decorate([
|
2139
|
-
core_1.Input(),
|
2140
|
-
__metadata("design:type", String)
|
2141
|
-
], DataTable.prototype, "groupField", void 0);
|
2142
|
-
__decorate([
|
2143
|
-
core_1.Input(),
|
2144
|
-
__metadata("design:type", Object)
|
2145
|
-
], DataTable.prototype, "contextMenu", void 0);
|
2146
|
-
__decorate([
|
2147
|
-
core_1.Input(),
|
2148
|
-
__metadata("design:type", String)
|
2149
|
-
], DataTable.prototype, "csvSeparator", void 0);
|
2150
|
-
__decorate([
|
2151
|
-
core_1.Input(),
|
2152
|
-
__metadata("design:type", String)
|
2153
|
-
], DataTable.prototype, "exportFilename", void 0);
|
2154
|
-
__decorate([
|
2155
|
-
core_1.Input(),
|
2156
|
-
__metadata("design:type", String)
|
2157
|
-
], DataTable.prototype, "emptyMessage", void 0);
|
2158
|
-
__decorate([
|
2159
|
-
core_1.Input(),
|
2160
|
-
__metadata("design:type", String)
|
2161
|
-
], DataTable.prototype, "paginatorPosition", void 0);
|
2162
|
-
__decorate([
|
2163
|
-
core_1.Input(),
|
2164
|
-
__metadata("design:type", Boolean)
|
2165
|
-
], DataTable.prototype, "alwaysShowPaginator", void 0);
|
2166
|
-
__decorate([
|
2167
|
-
core_1.Input(),
|
2168
|
-
__metadata("design:type", Boolean)
|
2169
|
-
], DataTable.prototype, "metaKeySelection", void 0);
|
2170
|
-
__decorate([
|
2171
|
-
core_1.Input(),
|
2172
|
-
__metadata("design:type", Function)
|
2173
|
-
], DataTable.prototype, "rowTrackBy", void 0);
|
2174
|
-
__decorate([
|
2175
|
-
core_1.Input(),
|
2176
|
-
__metadata("design:type", Boolean)
|
2177
|
-
], DataTable.prototype, "immutable", void 0);
|
2178
|
-
__decorate([
|
2179
|
-
core_1.Input(),
|
2180
|
-
__metadata("design:type", Array)
|
2181
|
-
], DataTable.prototype, "frozenValue", void 0);
|
2182
|
-
__decorate([
|
2183
|
-
core_1.Input(),
|
2184
|
-
__metadata("design:type", String)
|
2185
|
-
], DataTable.prototype, "compareSelectionBy", void 0);
|
2186
|
-
__decorate([
|
2187
|
-
core_1.Output(),
|
2188
|
-
__metadata("design:type", core_1.EventEmitter)
|
2189
|
-
], DataTable.prototype, "onEditInit", void 0);
|
2190
|
-
__decorate([
|
2191
|
-
core_1.Output(),
|
2192
|
-
__metadata("design:type", core_1.EventEmitter)
|
2193
|
-
], DataTable.prototype, "onEditComplete", void 0);
|
2194
|
-
__decorate([
|
2195
|
-
core_1.Output(),
|
2196
|
-
__metadata("design:type", core_1.EventEmitter)
|
2197
|
-
], DataTable.prototype, "onEdit", void 0);
|
2198
|
-
__decorate([
|
2199
|
-
core_1.Output(),
|
2200
|
-
__metadata("design:type", core_1.EventEmitter)
|
2201
|
-
], DataTable.prototype, "onEditCancel", void 0);
|
2202
|
-
__decorate([
|
2203
|
-
core_1.Output(),
|
2204
|
-
__metadata("design:type", core_1.EventEmitter)
|
2205
|
-
], DataTable.prototype, "onPage", void 0);
|
2206
|
-
__decorate([
|
2207
|
-
core_1.Output(),
|
2208
|
-
__metadata("design:type", core_1.EventEmitter)
|
2209
|
-
], DataTable.prototype, "onSort", void 0);
|
2210
|
-
__decorate([
|
2211
|
-
core_1.Output(),
|
2212
|
-
__metadata("design:type", core_1.EventEmitter)
|
2213
|
-
], DataTable.prototype, "onFilter", void 0);
|
2214
|
-
__decorate([
|
2215
|
-
core_1.ContentChild(shared_2.Header),
|
2216
|
-
__metadata("design:type", Object)
|
2217
|
-
], DataTable.prototype, "header", void 0);
|
2218
|
-
__decorate([
|
2219
|
-
core_1.ContentChild(shared_2.Footer),
|
2220
|
-
__metadata("design:type", Object)
|
2221
|
-
], DataTable.prototype, "footer", void 0);
|
2222
|
-
__decorate([
|
2223
|
-
core_1.Input(),
|
2224
|
-
__metadata("design:type", Boolean)
|
2225
|
-
], DataTable.prototype, "expandableRows", void 0);
|
2226
|
-
__decorate([
|
2227
|
-
core_1.Input(),
|
2228
|
-
__metadata("design:type", Array)
|
2229
|
-
], DataTable.prototype, "expandedRows", void 0);
|
2230
|
-
__decorate([
|
2231
|
-
core_1.Input(),
|
2232
|
-
__metadata("design:type", Boolean)
|
2233
|
-
], DataTable.prototype, "expandableRowGroups", void 0);
|
2234
|
-
__decorate([
|
2235
|
-
core_1.Input(),
|
2236
|
-
__metadata("design:type", String)
|
2237
|
-
], DataTable.prototype, "rowExpandMode", void 0);
|
2238
|
-
__decorate([
|
2239
|
-
core_1.Input(),
|
2240
|
-
__metadata("design:type", Array)
|
2241
|
-
], DataTable.prototype, "expandedRowsGroups", void 0);
|
2242
|
-
__decorate([
|
2243
|
-
core_1.Input(),
|
2244
|
-
__metadata("design:type", String)
|
2245
|
-
], DataTable.prototype, "expandedIcon", void 0);
|
2246
|
-
__decorate([
|
2247
|
-
core_1.Input(),
|
2248
|
-
__metadata("design:type", String)
|
2249
|
-
], DataTable.prototype, "collapsedIcon", void 0);
|
2250
|
-
__decorate([
|
2251
|
-
core_1.Input(),
|
2252
|
-
__metadata("design:type", Number)
|
2253
|
-
], DataTable.prototype, "tabindex", void 0);
|
2254
|
-
__decorate([
|
2255
|
-
core_1.Input(),
|
2256
|
-
__metadata("design:type", Function)
|
2257
|
-
], DataTable.prototype, "rowStyleClass", void 0);
|
2258
|
-
__decorate([
|
2259
|
-
core_1.Input(),
|
2260
|
-
__metadata("design:type", Object)
|
2261
|
-
], DataTable.prototype, "rowStyleMap", void 0);
|
2262
|
-
__decorate([
|
2263
|
-
core_1.Input(),
|
2264
|
-
__metadata("design:type", String)
|
2265
|
-
], DataTable.prototype, "rowGroupMode", void 0);
|
2266
|
-
__decorate([
|
2267
|
-
core_1.Input(),
|
2268
|
-
__metadata("design:type", Boolean)
|
2269
|
-
], DataTable.prototype, "sortableRowGroup", void 0);
|
2270
|
-
__decorate([
|
2271
|
-
core_1.Input(),
|
2272
|
-
__metadata("design:type", String)
|
2273
|
-
], DataTable.prototype, "sortFile", void 0);
|
2274
|
-
__decorate([
|
2275
|
-
core_1.Input(),
|
2276
|
-
__metadata("design:type", Boolean)
|
2277
|
-
], DataTable.prototype, "rowHover", void 0);
|
2278
|
-
__decorate([
|
2279
|
-
core_1.Input(),
|
2280
|
-
__metadata("design:type", Object)
|
2281
|
-
], DataTable.prototype, "filters", void 0);
|
2282
|
-
__decorate([
|
2283
|
-
core_1.Input(),
|
2284
|
-
__metadata("design:type", String)
|
2285
|
-
], DataTable.prototype, "dataKey", void 0);
|
2286
|
-
__decorate([
|
2287
|
-
core_1.Input(),
|
2288
|
-
__metadata("design:type", Boolean)
|
2289
|
-
], DataTable.prototype, "loading", void 0);
|
2290
|
-
__decorate([
|
2291
|
-
core_1.Input(),
|
2292
|
-
__metadata("design:type", String)
|
2293
|
-
], DataTable.prototype, "loadingIcon", void 0);
|
2294
|
-
__decorate([
|
2295
|
-
core_1.Input(),
|
2296
|
-
__metadata("design:type", Number)
|
2297
|
-
], DataTable.prototype, "virtualScrollDelay", void 0);
|
2298
|
-
__decorate([
|
2299
|
-
core_1.Input(),
|
2300
|
-
__metadata("design:type", String)
|
2301
|
-
], DataTable.prototype, "rowGroupExpandMode", void 0);
|
2302
|
-
__decorate([
|
2303
|
-
core_1.Output(),
|
2304
|
-
__metadata("design:type", core_1.EventEmitter)
|
2305
|
-
], DataTable.prototype, "valueChange", void 0);
|
2306
|
-
__decorate([
|
2307
|
-
core_1.Output(),
|
2308
|
-
__metadata("design:type", core_1.EventEmitter)
|
2309
|
-
], DataTable.prototype, "firstChange", void 0);
|
2310
|
-
__decorate([
|
2311
|
-
core_1.Output(),
|
2312
|
-
__metadata("design:type", core_1.EventEmitter)
|
2313
|
-
], DataTable.prototype, "onRowExpand", void 0);
|
2314
|
-
__decorate([
|
2315
|
-
core_1.Output(),
|
2316
|
-
__metadata("design:type", core_1.EventEmitter)
|
2317
|
-
], DataTable.prototype, "onRowCollapse", void 0);
|
2318
|
-
__decorate([
|
2319
|
-
core_1.Output(),
|
2320
|
-
__metadata("design:type", core_1.EventEmitter)
|
2321
|
-
], DataTable.prototype, "onRowGroupExpand", void 0);
|
2322
|
-
__decorate([
|
2323
|
-
core_1.Output(),
|
2324
|
-
__metadata("design:type", core_1.EventEmitter)
|
2325
|
-
], DataTable.prototype, "onRowGroupCollapse", void 0);
|
2326
|
-
__decorate([
|
2327
|
-
core_1.ContentChildren(shared_2.PrimeTemplate),
|
2328
|
-
__metadata("design:type", core_1.QueryList)
|
2329
|
-
], DataTable.prototype, "templates", void 0);
|
2330
|
-
__decorate([
|
2331
|
-
core_1.ContentChildren(shared_2.Column),
|
2332
|
-
__metadata("design:type", core_1.QueryList)
|
2333
|
-
], DataTable.prototype, "cols", void 0);
|
2334
|
-
__decorate([
|
2335
|
-
core_1.ContentChildren(shared_2.HeaderColumnGroup),
|
2336
|
-
__metadata("design:type", core_1.QueryList)
|
2337
|
-
], DataTable.prototype, "headerColumnGroups", void 0);
|
2338
|
-
__decorate([
|
2339
|
-
core_1.ContentChildren(shared_2.FooterColumnGroup),
|
2340
|
-
__metadata("design:type", core_1.QueryList)
|
2341
|
-
], DataTable.prototype, "footerColumnGroups", void 0);
|
2342
|
-
__decorate([
|
2343
|
-
core_1.Input(),
|
2344
|
-
__metadata("design:type", Array),
|
2345
|
-
__metadata("design:paramtypes", [Array])
|
2346
|
-
], DataTable.prototype, "multiSortMeta", null);
|
2347
|
-
__decorate([
|
2348
|
-
core_1.Input(),
|
2349
|
-
__metadata("design:type", String),
|
2350
|
-
__metadata("design:paramtypes", [String])
|
2351
|
-
], DataTable.prototype, "sortField", null);
|
2352
|
-
__decorate([
|
2353
|
-
core_1.Input(),
|
2354
|
-
__metadata("design:type", Number),
|
2355
|
-
__metadata("design:paramtypes", [Number])
|
2356
|
-
], DataTable.prototype, "sortOrder", null);
|
2357
|
-
__decorate([
|
2358
|
-
core_1.Input(),
|
2359
|
-
__metadata("design:type", Array),
|
2360
|
-
__metadata("design:paramtypes", [Array])
|
2361
|
-
], DataTable.prototype, "value", null);
|
2362
|
-
__decorate([
|
2363
|
-
core_1.Input(),
|
2364
|
-
__metadata("design:type", Number),
|
2365
|
-
__metadata("design:paramtypes", [Number])
|
2366
|
-
], DataTable.prototype, "first", null);
|
2367
|
-
__decorate([
|
2368
|
-
core_1.Input(),
|
2369
|
-
__metadata("design:type", Number),
|
2370
|
-
__metadata("design:paramtypes", [Number])
|
2371
|
-
], DataTable.prototype, "totalRecords", null);
|
2372
|
-
__decorate([
|
2373
|
-
core_1.Input(),
|
2374
|
-
__metadata("design:type", Object),
|
2375
|
-
__metadata("design:paramtypes", [Object])
|
2376
|
-
], DataTable.prototype, "selection", null);
|
2377
|
-
DataTable = __decorate([
|
2378
|
-
core_1.Component({
|
2379
|
-
selector: 'p-dataTable',
|
2380
|
-
template: "\n <div [ngStyle]=\"style\" [class]=\"styleClass\" [style.width]=\"containerWidth\"\n [ngClass]=\"{'ui-datatable ui-widget':true,'ui-datatable-reflow':responsive,'ui-datatable-stacked':stacked,'ui-datatable-resizable':resizableColumns,'ui-datatable-scrollable':scrollable}\">\n <div class=\"ui-datatable-loading ui-widget-overlay\" *ngIf=\"loading\"></div>\n <div class=\"ui-datatable-loading-content\" *ngIf=\"loading\">\n <i [class]=\"'fa fa-spin fa-2x ' + loadingIcon\"></i>\n </div>\n <div class=\"ui-datatable-header ui-widget-header\" *ngIf=\"header\">\n <ng-content select=\"p-header\"></ng-content>\n </div>\n <p-paginator [rows]=\"rows\" [first]=\"first\" [totalRecords]=\"totalRecords\" [pageLinkSize]=\"pageLinks\" styleClass=\"ui-paginator-top\" [alwaysShow]=\"alwaysShowPaginator\"\n (onPageChange)=\"onPageChange($event)\" [rowsPerPageOptions]=\"rowsPerPageOptions\" *ngIf=\"paginator && (paginatorPosition === 'top' || paginatorPosition =='both')\"\n [templateLeft]=\"paginatorLeftTemplate\" [templateRight]=\"paginatorRightTemplate\"></p-paginator>\n <div class=\"ui-datatable-tablewrapper\" *ngIf=\"!scrollable\">\n <table [ngClass]=\"tableStyleClass\" [ngStyle]=\"tableStyle\">\n <thead class=\"ui-datatable-thead\">\n <tr *ngIf=\"!headerColumnGroups || !headerColumnGroups.first\" class=\"ui-state-default\" [pColumnHeaders]=\"columns\"></tr>\n <ng-template [ngIf]=\"headerColumnGroups && headerColumnGroups.first\">\n <tr *ngFor=\"let headerRow of headerColumnGroups.first.rows\" class=\"ui-state-default\" [pColumnHeaders]=\"headerRow.columns\"></tr>\n </ng-template>\n </thead>\n <tfoot *ngIf=\"hasFooter()\" class=\"ui-datatable-tfoot\">\n <tr *ngIf=\"!footerColumnGroups.first\" class=\"ui-state-default\" [pColumnFooters]=\"columns\"></tr>\n <ng-template [ngIf]=\"footerColumnGroups.first\">\n <tr *ngFor=\"let footerRow of footerColumnGroups.first.rows\" class=\"ui-state-default\" [pColumnFooters]=\"footerRow.columns\"></tr>\n </ng-template>\n </tfoot>\n <tbody [ngClass]=\"{'ui-datatable-data ui-widget-content': true, 'ui-datatable-hoverable-rows': (rowHover||selectionMode)}\" [pTableBody]=\"columns\" [data]=\"dataToRender\"></tbody>\n </table>\n </div>\n \n <ng-template [ngIf]=\"scrollable\">\n <div class=\"ui-datatable-scrollable-wrapper ui-helper-clearfix\">\n <div *ngIf=\"hasFrozenColumns()\" [pScrollableView]=\"frozenColumns\" frozen=\"true\"\n [headerColumnGroup]=\"frozenHeaderColumnGroup\" [footerColumnGroup]=\"frozenFooterColumnGroup\"\n [ngStyle]=\"{'width':this.frozenWidth}\" class=\"ui-datatable-scrollable-view ui-datatable-frozen-view\"></div>\n <div [pScrollableView]=\"scrollableColumns\" [ngStyle]=\"{'width':this.unfrozenWidth, 'left': this.frozenWidth}\"\n [headerColumnGroup]=\"scrollableHeaderColumnGroup\" [footerColumnGroup]=\"scrollableFooterColumnGroup\"\n class=\"ui-datatable-scrollable-view\" [virtualScroll]=\"virtualScroll\" (onVirtualScroll)=\"onVirtualScroll($event)\"\n [ngClass]=\"{'ui-datatable-unfrozen-view': hasFrozenColumns()}\"></div>\n </div>\n </ng-template>\n \n <p-paginator [rows]=\"rows\" [first]=\"first\" [totalRecords]=\"totalRecords\" [pageLinkSize]=\"pageLinks\" styleClass=\"ui-paginator-bottom\" [alwaysShow]=\"alwaysShowPaginator\"\n (onPageChange)=\"onPageChange($event)\" [rowsPerPageOptions]=\"rowsPerPageOptions\" *ngIf=\"paginator && (paginatorPosition === 'bottom' || paginatorPosition =='both')\"\n [templateLeft]=\"paginatorLeftTemplate\" [templateRight]=\"paginatorRightTemplate\"></p-paginator>\n <div class=\"ui-datatable-footer ui-widget-header\" *ngIf=\"footer\">\n <ng-content select=\"p-footer\"></ng-content>\n </div>\n \n <div class=\"ui-column-resizer-helper ui-state-highlight\" style=\"display:none\"></div>\n <span class=\"fa fa-arrow-down ui-datatable-reorder-indicator-up\" style=\"position: absolute; display: none;\"></span>\n <span class=\"fa fa-arrow-up ui-datatable-reorder-indicator-down\" style=\"position: absolute; display: none;\"></span>\n </div>\n "
|
2381
|
-
}),
|
2382
|
-
__metadata("design:paramtypes", [core_1.ElementRef, core_1.IterableDiffers,
|
2383
|
-
core_1.Renderer2, core_1.ChangeDetectorRef,
|
2384
|
-
core_1.NgZone])
|
2385
|
-
], DataTable);
|
2386
|
-
return DataTable;
|
2387
|
-
}());
|
2388
|
-
exports.DataTable = DataTable;
|
2389
|
-
var DataTableModule = /** @class */ (function () {
|
2390
|
-
function DataTableModule() {
|
2391
|
-
}
|
2392
|
-
DataTableModule = __decorate([
|
2393
|
-
core_1.NgModule({
|
2394
|
-
imports: [common_1.CommonModule, shared_1.SharedModule, paginator_1.PaginatorModule, forms_1.FormsModule],
|
2395
|
-
exports: [DataTable, shared_1.SharedModule],
|
2396
|
-
declarations: [DataTable, DTRadioButton, DTCheckbox, ColumnHeaders, ColumnFooters, TableBody, ScrollableView]
|
2397
|
-
})
|
2398
|
-
], DataTableModule);
|
2399
|
-
return DataTableModule;
|
2400
|
-
}());
|
2401
|
-
exports.DataTableModule = DataTableModule;
|
2402
|
-
//# sourceMappingURL=datatable.js.map
|