@universis/ngx-tables 0.6.20 → 0.6.21
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/bundles/universis-ngx-tables.umd.js +47 -14
- package/bundles/universis-ngx-tables.umd.js.map +1 -1
- package/bundles/universis-ngx-tables.umd.min.js +1 -1
- package/bundles/universis-ngx-tables.umd.min.js.map +1 -1
- package/esm2015/lib/components/advanced-table/advanced-table.component.js +51 -18
- package/esm5/lib/components/advanced-table/advanced-table.component.js +49 -16
- package/fesm2015/universis-ngx-tables.js +49 -16
- package/fesm2015/universis-ngx-tables.js.map +1 -1
- package/fesm5/universis-ngx-tables.js +47 -14
- package/fesm5/universis-ngx-tables.js.map +1 -1
- package/lib/components/advanced-table/advanced-table.component.d.ts +8 -0
- package/package.json +1 -1
- package/universis-ngx-tables.metadata.json +1 -1
|
@@ -540,6 +540,9 @@ class AdvancedTableComponent {
|
|
|
540
540
|
this.init = new EventEmitter();
|
|
541
541
|
this.reload = new EventEmitter();
|
|
542
542
|
this.select = new EventEmitter();
|
|
543
|
+
this.draw = new EventEmitter();
|
|
544
|
+
this.page = new EventEmitter();
|
|
545
|
+
this.scroll = new EventEmitter();
|
|
543
546
|
this.selectedItems = new EventEmitter();
|
|
544
547
|
this.scrollable = true;
|
|
545
548
|
this.serverSide = true;
|
|
@@ -1042,6 +1045,20 @@ class AdvancedTableComponent {
|
|
|
1042
1045
|
}, 0);
|
|
1043
1046
|
}
|
|
1044
1047
|
});
|
|
1048
|
+
tableElement.on('draw.dt', (event) => {
|
|
1049
|
+
this.draw.emit();
|
|
1050
|
+
if (this.dataTable) {
|
|
1051
|
+
const info = this.dataTable.page.info();
|
|
1052
|
+
this.page.emit(info);
|
|
1053
|
+
try {
|
|
1054
|
+
this.dataTable.columns.adjust();
|
|
1055
|
+
}
|
|
1056
|
+
catch (err) {
|
|
1057
|
+
console.error('ERROR', 'An error occurred while adjusting table columns');
|
|
1058
|
+
console.error(err);
|
|
1059
|
+
}
|
|
1060
|
+
}
|
|
1061
|
+
});
|
|
1045
1062
|
// allow selection
|
|
1046
1063
|
if (this.selectable) {
|
|
1047
1064
|
// get first column (as row primary key)
|
|
@@ -1066,10 +1083,6 @@ class AdvancedTableComponent {
|
|
|
1066
1083
|
// user interface additions
|
|
1067
1084
|
// handle page change event (a trick for firing draw.dt events)
|
|
1068
1085
|
tableElement
|
|
1069
|
-
// for each page
|
|
1070
|
-
.on('page.dt', ($event) => {
|
|
1071
|
-
const info = this.dataTable.page.info();
|
|
1072
|
-
})
|
|
1073
1086
|
// handle draw events
|
|
1074
1087
|
.on('draw.dt', () => {
|
|
1075
1088
|
if (this.customSelect) {
|
|
@@ -1170,11 +1183,11 @@ class AdvancedTableComponent {
|
|
|
1170
1183
|
// get order expression
|
|
1171
1184
|
const order = aoData[2].value;
|
|
1172
1185
|
// get skip records param
|
|
1173
|
-
|
|
1186
|
+
let skip = aoData[3].value;
|
|
1174
1187
|
// get page size param
|
|
1175
|
-
|
|
1188
|
+
let top = aoData[4].value;
|
|
1176
1189
|
// get search value
|
|
1177
|
-
const
|
|
1190
|
+
const search = aoData[5].value;
|
|
1178
1191
|
// get data queryable
|
|
1179
1192
|
const q = self._query instanceof ClientDataQueryable ? self._query : self._context.model(self.config.model).asQueryable();
|
|
1180
1193
|
// apply paging params
|
|
@@ -1301,15 +1314,22 @@ class AdvancedTableComponent {
|
|
|
1301
1314
|
}
|
|
1302
1315
|
if (this.selectable) ;
|
|
1303
1316
|
// handle init.dt event and emit local event
|
|
1304
|
-
this.dataTable = tableElement.
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1317
|
+
this.dataTable = tableElement.on('init.dt', (event) => {
|
|
1318
|
+
const scroller = jQuery(event.target).parent();
|
|
1319
|
+
// handle scrolling
|
|
1320
|
+
scroller.on('scroll', (scrollEvent) => {
|
|
1321
|
+
const target = jQuery(scrollEvent.target);
|
|
1322
|
+
const top = target.scrollTop();
|
|
1323
|
+
const left = target.scrollLeft();
|
|
1324
|
+
if (this.dataTable) {
|
|
1325
|
+
this.scroll.emit({
|
|
1326
|
+
top,
|
|
1327
|
+
left
|
|
1328
|
+
});
|
|
1329
|
+
}
|
|
1330
|
+
});
|
|
1331
|
+
this.init.emit();
|
|
1332
|
+
}).DataTable(settings);
|
|
1313
1333
|
// show or hide header
|
|
1314
1334
|
if (!this.showHeader) {
|
|
1315
1335
|
this._element.nativeElement
|
|
@@ -1328,6 +1348,16 @@ class AdvancedTableComponent {
|
|
|
1328
1348
|
}
|
|
1329
1349
|
}
|
|
1330
1350
|
}
|
|
1351
|
+
scrollTop(value) {
|
|
1352
|
+
if (this.dataTable) {
|
|
1353
|
+
this.dataTable.parent().scrollTop(value);
|
|
1354
|
+
}
|
|
1355
|
+
}
|
|
1356
|
+
scrollLeft(value) {
|
|
1357
|
+
if (this.dataTable) {
|
|
1358
|
+
this.dataTable.parent().scrollLeft(value);
|
|
1359
|
+
}
|
|
1360
|
+
}
|
|
1331
1361
|
get lastQuery() {
|
|
1332
1362
|
if (this.config == null) {
|
|
1333
1363
|
return null;
|
|
@@ -1566,6 +1596,9 @@ AdvancedTableComponent.propDecorators = {
|
|
|
1566
1596
|
init: [{ type: Output, args: ['init',] }],
|
|
1567
1597
|
reload: [{ type: Input, args: ['reload',] }],
|
|
1568
1598
|
select: [{ type: Output, args: ['select',] }],
|
|
1599
|
+
draw: [{ type: Output, args: ['draw',] }],
|
|
1600
|
+
page: [{ type: Output, args: ['page',] }],
|
|
1601
|
+
scroll: [{ type: Output, args: ['scroll',] }],
|
|
1569
1602
|
selectedItems: [{ type: Output, args: ['selectedItems',] }],
|
|
1570
1603
|
scrollable: [{ type: Input }],
|
|
1571
1604
|
serverSide: [{ type: Input }],
|