tabulator-tables 5.1.2 → 5.1.3
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/bower.json +1 -1
- package/dist/js/tabulator.js +133 -73
- package/dist/js/tabulator.js.map +1 -1
- package/dist/js/tabulator.min.js +2 -2
- package/dist/js/tabulator.min.js.map +1 -1
- package/dist/js/tabulator_esm.js +386 -337
- package/dist/js/tabulator_esm.js.map +1 -1
- package/dist/js/tabulator_esm.min.js +2 -2
- package/dist/js/tabulator_esm.min.js.map +1 -1
- package/package.json +5 -2
- package/src/js/core/FooterManager.js +1 -3
- package/src/js/core/Tabulator.js +4 -4
- package/src/js/modules/ColumnCalcs/ColumnCalcs.js +9 -4
- package/src/js/modules/Format/defaults/formatters/rowSelection.js +18 -1
- package/src/js/modules/FrozenColumns/FrozenColumns.js +17 -3
- package/src/js/modules/GroupRows/Group.js +144 -142
- package/src/js/modules/Layout/Layout.js +1 -0
- package/src/js/modules/Persistence/defaults/readers.js +3 -3
- package/src/js/modules/ResizeColumns/ResizeColumns.js +61 -51
- package/src/js/modules/SelectRow/SelectRow.js +129 -127
package/bower.json
CHANGED
package/dist/js/tabulator.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* Tabulator v5.1.
|
|
1
|
+
/* Tabulator v5.1.3 (c) Oliver Folkerd 2022 */
|
|
2
2
|
(function (global, factory) {
|
|
3
3
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
4
4
|
typeof define === 'function' && define.amd ? define(factory) :
|
|
@@ -6066,9 +6066,6 @@
|
|
|
6066
6066
|
|
|
6067
6067
|
_this.external = false;
|
|
6068
6068
|
_this.links = [];
|
|
6069
|
-
|
|
6070
|
-
_this.initializeElement();
|
|
6071
|
-
|
|
6072
6069
|
return _this;
|
|
6073
6070
|
}
|
|
6074
6071
|
|
|
@@ -6099,7 +6096,7 @@
|
|
|
6099
6096
|
switch (_typeof(this.table.options.footerElement)) {
|
|
6100
6097
|
case "string":
|
|
6101
6098
|
if (this.table.options.footerElement[0] === "<") {
|
|
6102
|
-
this.
|
|
6099
|
+
this.containerElement.innerHTML = this.table.options.footerElement;
|
|
6103
6100
|
} else {
|
|
6104
6101
|
this.external = true;
|
|
6105
6102
|
this.element = document.querySelector(this.table.options.footerElement);
|
|
@@ -7537,6 +7534,7 @@
|
|
|
7537
7534
|
}, {
|
|
7538
7535
|
key: "layout",
|
|
7539
7536
|
value: function layout() {
|
|
7537
|
+
this.dispatch("layout-refreshing");
|
|
7540
7538
|
Layout.modes[this.mode].call(this, this.table.columnManager.columnsByIndex);
|
|
7541
7539
|
this.dispatch("layout-refreshed");
|
|
7542
7540
|
}
|
|
@@ -8018,7 +8016,7 @@
|
|
|
8018
8016
|
this.initialized = false;
|
|
8019
8017
|
|
|
8020
8018
|
if (this.initializeElement(element)) {
|
|
8021
|
-
this.
|
|
8019
|
+
this.initializeCoreSystems(options); //delay table creation to allow event bindings immediately after the constructor
|
|
8022
8020
|
|
|
8023
8021
|
setTimeout(function () {
|
|
8024
8022
|
_this._create();
|
|
@@ -8049,8 +8047,8 @@
|
|
|
8049
8047
|
}
|
|
8050
8048
|
}
|
|
8051
8049
|
}, {
|
|
8052
|
-
key: "
|
|
8053
|
-
value: function
|
|
8050
|
+
key: "initializeCoreSystems",
|
|
8051
|
+
value: function initializeCoreSystems(options) {
|
|
8054
8052
|
this.columnManager = new ColumnManager(this);
|
|
8055
8053
|
this.rowManager = new RowManager(this);
|
|
8056
8054
|
this.footerManager = new FooterManager(this);
|
|
@@ -8277,7 +8275,7 @@
|
|
|
8277
8275
|
this.browserSlow = false;
|
|
8278
8276
|
}
|
|
8279
8277
|
|
|
8280
|
-
this.browserMobile = /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(ua) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(ua.
|
|
8278
|
+
this.browserMobile = /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(ua) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(ua.slice(0, 4));
|
|
8281
8279
|
} ////////////////// Data Handling //////////////////
|
|
8282
8280
|
//block table redrawing
|
|
8283
8281
|
|
|
@@ -9898,7 +9896,7 @@
|
|
|
9898
9896
|
this.subscribe("row-added", this.rowsUpdated.bind(this));
|
|
9899
9897
|
this.subscribe("column-moved", this.recalcActiveRows.bind(this));
|
|
9900
9898
|
this.subscribe("column-add", this.recalcActiveRows.bind(this));
|
|
9901
|
-
this.subscribe("data-refreshed", this.
|
|
9899
|
+
this.subscribe("data-refreshed", this.recalcActiveRowsRefresh.bind(this));
|
|
9902
9900
|
this.subscribe("table-redraw", this.tableRedraw.bind(this));
|
|
9903
9901
|
this.subscribe("rows-visible", this.visibleRows.bind(this));
|
|
9904
9902
|
this.registerTableFunction("getCalcResults", this.getResults.bind(this));
|
|
@@ -9946,6 +9944,15 @@
|
|
|
9946
9944
|
this.recalcActiveRows();
|
|
9947
9945
|
}
|
|
9948
9946
|
}
|
|
9947
|
+
}, {
|
|
9948
|
+
key: "recalcActiveRowsRefresh",
|
|
9949
|
+
value: function recalcActiveRowsRefresh() {
|
|
9950
|
+
if (this.table.options.groupBy && this.table.options.dataTreeStartExpanded && this.table.options.dataTree) {
|
|
9951
|
+
this.recalcAll();
|
|
9952
|
+
} else {
|
|
9953
|
+
this.recalcActiveRows();
|
|
9954
|
+
}
|
|
9955
|
+
}
|
|
9949
9956
|
}, {
|
|
9950
9957
|
key: "recalcActiveRows",
|
|
9951
9958
|
value: function recalcActiveRows() {
|
|
@@ -16272,6 +16279,7 @@
|
|
|
16272
16279
|
var _this = this;
|
|
16273
16280
|
|
|
16274
16281
|
var checkbox = document.createElement("input");
|
|
16282
|
+
var blocked = false;
|
|
16275
16283
|
checkbox.type = 'checkbox';
|
|
16276
16284
|
|
|
16277
16285
|
if (this.table.modExists("selectRow", true)) {
|
|
@@ -16284,8 +16292,25 @@
|
|
|
16284
16292
|
|
|
16285
16293
|
if (row instanceof RowComponent$1) {
|
|
16286
16294
|
checkbox.addEventListener("change", function (e) {
|
|
16287
|
-
|
|
16295
|
+
if (_this.table.options.selectableRangeMode === "click") {
|
|
16296
|
+
if (!blocked) {
|
|
16297
|
+
row.toggleSelect();
|
|
16298
|
+
} else {
|
|
16299
|
+
blocked = false;
|
|
16300
|
+
}
|
|
16301
|
+
} else {
|
|
16302
|
+
row.toggleSelect();
|
|
16303
|
+
}
|
|
16288
16304
|
});
|
|
16305
|
+
|
|
16306
|
+
if (this.table.options.selectableRangeMode === "click") {
|
|
16307
|
+
checkbox.addEventListener("click", function (e) {
|
|
16308
|
+
blocked = true;
|
|
16309
|
+
|
|
16310
|
+
_this.table.modules.selectRow.handleComplexRowClick(row._row, e);
|
|
16311
|
+
});
|
|
16312
|
+
}
|
|
16313
|
+
|
|
16289
16314
|
checkbox.checked = row.isSelected && row.isSelected();
|
|
16290
16315
|
this.table.modules.selectRow.registerRowSelectCheckbox(row, checkbox);
|
|
16291
16316
|
} else {
|
|
@@ -16578,6 +16603,7 @@
|
|
|
16578
16603
|
_this.initializationMode = "left";
|
|
16579
16604
|
_this.active = false;
|
|
16580
16605
|
_this.scrollEndTimer = false;
|
|
16606
|
+
_this.blocked = true;
|
|
16581
16607
|
|
|
16582
16608
|
_this.registerColumnOption("frozen");
|
|
16583
16609
|
|
|
@@ -16609,6 +16635,18 @@
|
|
|
16609
16635
|
this.subscribe("scroll-horizontal", this.scrollHorizontal.bind(this));
|
|
16610
16636
|
this.subscribe("columns-loading", this.reset.bind(this));
|
|
16611
16637
|
this.subscribe("table-redraw", this.layout.bind(this));
|
|
16638
|
+
this.subscribe("layout-refreshing", this.blockLayout.bind(this));
|
|
16639
|
+
this.subscribe("layout-refreshed", this.unblockLayout.bind(this));
|
|
16640
|
+
}
|
|
16641
|
+
}, {
|
|
16642
|
+
key: "blockLayout",
|
|
16643
|
+
value: function blockLayout() {
|
|
16644
|
+
this.blocked = true;
|
|
16645
|
+
}
|
|
16646
|
+
}, {
|
|
16647
|
+
key: "unblockLayout",
|
|
16648
|
+
value: function unblockLayout() {
|
|
16649
|
+
this.blocked = false;
|
|
16612
16650
|
}
|
|
16613
16651
|
}, {
|
|
16614
16652
|
key: "layoutCell",
|
|
@@ -16793,14 +16831,14 @@
|
|
|
16793
16831
|
key: "getColGroupParentElement",
|
|
16794
16832
|
value: function getColGroupParentElement(column) {
|
|
16795
16833
|
return column.parent.isGroup ? this.getColGroupParentElement(column.parent) : column.getElement();
|
|
16796
|
-
} //layout columns
|
|
16834
|
+
} //layout columns appropriately
|
|
16797
16835
|
|
|
16798
16836
|
}, {
|
|
16799
16837
|
key: "layout",
|
|
16800
16838
|
value: function layout() {
|
|
16801
16839
|
var _this5 = this;
|
|
16802
16840
|
|
|
16803
|
-
if (this.active) {
|
|
16841
|
+
if (this.active && !this.blocked) {
|
|
16804
16842
|
//calculate row padding
|
|
16805
16843
|
this.calcMargins();
|
|
16806
16844
|
this.table.rowManager.getDisplayRows().forEach(function (row) {
|
|
@@ -16821,6 +16859,11 @@
|
|
|
16821
16859
|
|
|
16822
16860
|
var rowEl = row.getElement();
|
|
16823
16861
|
rowEl.style.paddingLeft = this.leftMargin;
|
|
16862
|
+
|
|
16863
|
+
if (this.table.options.layout === "fitDataFill" && this.rightColumns.length) {
|
|
16864
|
+
this.table.rowManager.getTableElement().style.minWidth = "calc(100% - " + this.rightMargin + ")";
|
|
16865
|
+
}
|
|
16866
|
+
|
|
16824
16867
|
this.leftColumns.forEach(function (column) {
|
|
16825
16868
|
var cell = row.getCell(column);
|
|
16826
16869
|
|
|
@@ -17254,10 +17297,12 @@
|
|
|
17254
17297
|
}, {
|
|
17255
17298
|
key: "scrollHeader",
|
|
17256
17299
|
value: function scrollHeader(left) {
|
|
17257
|
-
this.arrowElement
|
|
17258
|
-
|
|
17259
|
-
|
|
17260
|
-
|
|
17300
|
+
if (this.arrowElement) {
|
|
17301
|
+
this.arrowElement.style.marginLeft = left;
|
|
17302
|
+
this.groupList.forEach(function (child) {
|
|
17303
|
+
child.scrollHeader(left);
|
|
17304
|
+
});
|
|
17305
|
+
}
|
|
17261
17306
|
}
|
|
17262
17307
|
}, {
|
|
17263
17308
|
key: "getRowIndex",
|
|
@@ -22167,11 +22212,11 @@
|
|
|
22167
22212
|
data; //if cookie exists, decode and load column data into tabulator
|
|
22168
22213
|
|
|
22169
22214
|
if (cookiePos > -1) {
|
|
22170
|
-
cookie = cookie.
|
|
22215
|
+
cookie = cookie.slice(cookiePos);
|
|
22171
22216
|
end = cookie.indexOf(";");
|
|
22172
22217
|
|
|
22173
22218
|
if (end > -1) {
|
|
22174
|
-
cookie = cookie.
|
|
22219
|
+
cookie = cookie.slice(0, end);
|
|
22175
22220
|
}
|
|
22176
22221
|
|
|
22177
22222
|
data = cookie.replace(key + "=", "");
|
|
@@ -23216,11 +23261,18 @@
|
|
|
23216
23261
|
}); //reszie column on double click
|
|
23217
23262
|
|
|
23218
23263
|
handle.addEventListener("dblclick", function (e) {
|
|
23219
|
-
var col = column.getLastColumn()
|
|
23264
|
+
var col = column.getLastColumn(),
|
|
23265
|
+
oldWidth;
|
|
23220
23266
|
|
|
23221
23267
|
if (col && self._checkResizability(col)) {
|
|
23268
|
+
oldWidth = col.getWidth();
|
|
23222
23269
|
e.stopPropagation();
|
|
23223
23270
|
col.reinitializeWidth(true);
|
|
23271
|
+
|
|
23272
|
+
if (oldWidth !== col.getWidth()) {
|
|
23273
|
+
self.dispatch("column-resized", col);
|
|
23274
|
+
self.table.externalEvents.dispatch("columnResized", col.getComponent());
|
|
23275
|
+
}
|
|
23224
23276
|
}
|
|
23225
23277
|
});
|
|
23226
23278
|
prevHandle.addEventListener("click", function (e) {
|
|
@@ -23307,8 +23359,11 @@
|
|
|
23307
23359
|
handle.removeEventListener("touchmove", mouseMove);
|
|
23308
23360
|
handle.removeEventListener("touchend", mouseUp);
|
|
23309
23361
|
self.table.element.classList.remove("tabulator-block-select");
|
|
23310
|
-
|
|
23311
|
-
self.
|
|
23362
|
+
|
|
23363
|
+
if (self.startWidth !== column.getWidth()) {
|
|
23364
|
+
self.dispatch("column-resized", column);
|
|
23365
|
+
self.table.externalEvents.dispatch("columnResized", column.getComponent());
|
|
23366
|
+
}
|
|
23312
23367
|
}
|
|
23313
23368
|
|
|
23314
23369
|
e.stopPropagation(); //prevent resize from interfereing with movable columns
|
|
@@ -24074,53 +24129,7 @@
|
|
|
24074
24129
|
|
|
24075
24130
|
if (self.table.options.selectable && self.table.options.selectable != "highlight") {
|
|
24076
24131
|
if (self.table.options.selectableRangeMode === "click") {
|
|
24077
|
-
element.addEventListener("click",
|
|
24078
|
-
if (e.shiftKey) {
|
|
24079
|
-
self.table._clearSelection();
|
|
24080
|
-
|
|
24081
|
-
self.lastClickedRow = self.lastClickedRow || row;
|
|
24082
|
-
var lastClickedRowIdx = self.table.rowManager.getDisplayRowIndex(self.lastClickedRow);
|
|
24083
|
-
var rowIdx = self.table.rowManager.getDisplayRowIndex(row);
|
|
24084
|
-
var fromRowIdx = lastClickedRowIdx <= rowIdx ? lastClickedRowIdx : rowIdx;
|
|
24085
|
-
var toRowIdx = lastClickedRowIdx >= rowIdx ? lastClickedRowIdx : rowIdx;
|
|
24086
|
-
var rows = self.table.rowManager.getDisplayRows().slice(0);
|
|
24087
|
-
var toggledRows = rows.splice(fromRowIdx, toRowIdx - fromRowIdx + 1);
|
|
24088
|
-
|
|
24089
|
-
if (e.ctrlKey || e.metaKey) {
|
|
24090
|
-
toggledRows.forEach(function (toggledRow) {
|
|
24091
|
-
if (toggledRow !== self.lastClickedRow) {
|
|
24092
|
-
if (self.table.options.selectable !== true && !self.isRowSelected(row)) {
|
|
24093
|
-
if (self.selectedRows.length < self.table.options.selectable) {
|
|
24094
|
-
self.toggleRow(toggledRow);
|
|
24095
|
-
}
|
|
24096
|
-
} else {
|
|
24097
|
-
self.toggleRow(toggledRow);
|
|
24098
|
-
}
|
|
24099
|
-
}
|
|
24100
|
-
});
|
|
24101
|
-
self.lastClickedRow = row;
|
|
24102
|
-
} else {
|
|
24103
|
-
self.deselectRows(undefined, true);
|
|
24104
|
-
|
|
24105
|
-
if (self.table.options.selectable !== true) {
|
|
24106
|
-
if (toggledRows.length > self.table.options.selectable) {
|
|
24107
|
-
toggledRows = toggledRows.slice(0, self.table.options.selectable);
|
|
24108
|
-
}
|
|
24109
|
-
}
|
|
24110
|
-
|
|
24111
|
-
self.selectRows(toggledRows);
|
|
24112
|
-
}
|
|
24113
|
-
|
|
24114
|
-
self.table._clearSelection();
|
|
24115
|
-
} else if (e.ctrlKey || e.metaKey) {
|
|
24116
|
-
self.toggleRow(row);
|
|
24117
|
-
self.lastClickedRow = row;
|
|
24118
|
-
} else {
|
|
24119
|
-
self.deselectRows(undefined, true);
|
|
24120
|
-
self.selectRows(row);
|
|
24121
|
-
self.lastClickedRow = row;
|
|
24122
|
-
}
|
|
24123
|
-
});
|
|
24132
|
+
element.addEventListener("click", this.handleComplexRowClick.bind(this, row));
|
|
24124
24133
|
} else {
|
|
24125
24134
|
element.addEventListener("click", function (e) {
|
|
24126
24135
|
if (!self.table.modExists("edit") || !self.table.modules.edit.getCurrentCell()) {
|
|
@@ -24167,6 +24176,57 @@
|
|
|
24167
24176
|
element.classList.add("tabulator-unselectable");
|
|
24168
24177
|
element.classList.remove("tabulator-selectable");
|
|
24169
24178
|
}
|
|
24179
|
+
}
|
|
24180
|
+
}, {
|
|
24181
|
+
key: "handleComplexRowClick",
|
|
24182
|
+
value: function handleComplexRowClick(row, e) {
|
|
24183
|
+
var _this2 = this;
|
|
24184
|
+
|
|
24185
|
+
if (e.shiftKey) {
|
|
24186
|
+
this.table._clearSelection();
|
|
24187
|
+
|
|
24188
|
+
this.lastClickedRow = this.lastClickedRow || row;
|
|
24189
|
+
var lastClickedRowIdx = this.table.rowManager.getDisplayRowIndex(this.lastClickedRow);
|
|
24190
|
+
var rowIdx = this.table.rowManager.getDisplayRowIndex(row);
|
|
24191
|
+
var fromRowIdx = lastClickedRowIdx <= rowIdx ? lastClickedRowIdx : rowIdx;
|
|
24192
|
+
var toRowIdx = lastClickedRowIdx >= rowIdx ? lastClickedRowIdx : rowIdx;
|
|
24193
|
+
var rows = this.table.rowManager.getDisplayRows().slice(0);
|
|
24194
|
+
var toggledRows = rows.splice(fromRowIdx, toRowIdx - fromRowIdx + 1);
|
|
24195
|
+
|
|
24196
|
+
if (e.ctrlKey || e.metaKey) {
|
|
24197
|
+
toggledRows.forEach(function (toggledRow) {
|
|
24198
|
+
if (toggledRow !== _this2.lastClickedRow) {
|
|
24199
|
+
if (_this2.table.options.selectable !== true && !_this2.isRowSelected(row)) {
|
|
24200
|
+
if (_this2.selectedRows.length < _this2.table.options.selectable) {
|
|
24201
|
+
_this2.toggleRow(toggledRow);
|
|
24202
|
+
}
|
|
24203
|
+
} else {
|
|
24204
|
+
_this2.toggleRow(toggledRow);
|
|
24205
|
+
}
|
|
24206
|
+
}
|
|
24207
|
+
});
|
|
24208
|
+
this.lastClickedRow = row;
|
|
24209
|
+
} else {
|
|
24210
|
+
this.deselectRows(undefined, true);
|
|
24211
|
+
|
|
24212
|
+
if (this.table.options.selectable !== true) {
|
|
24213
|
+
if (toggledRows.length > this.table.options.selectable) {
|
|
24214
|
+
toggledRows = toggledRows.slice(0, this.table.options.selectable);
|
|
24215
|
+
}
|
|
24216
|
+
}
|
|
24217
|
+
|
|
24218
|
+
this.selectRows(toggledRows);
|
|
24219
|
+
}
|
|
24220
|
+
|
|
24221
|
+
this.table._clearSelection();
|
|
24222
|
+
} else if (e.ctrlKey || e.metaKey) {
|
|
24223
|
+
this.toggleRow(row);
|
|
24224
|
+
this.lastClickedRow = row;
|
|
24225
|
+
} else {
|
|
24226
|
+
this.deselectRows(undefined, true);
|
|
24227
|
+
this.selectRows(row);
|
|
24228
|
+
this.lastClickedRow = row;
|
|
24229
|
+
}
|
|
24170
24230
|
} //toggle row selection
|
|
24171
24231
|
|
|
24172
24232
|
}, {
|
|
@@ -24184,14 +24244,14 @@
|
|
|
24184
24244
|
}, {
|
|
24185
24245
|
key: "selectRows",
|
|
24186
24246
|
value: function selectRows(rows) {
|
|
24187
|
-
var
|
|
24247
|
+
var _this3 = this;
|
|
24188
24248
|
|
|
24189
24249
|
var rowMatch;
|
|
24190
24250
|
|
|
24191
24251
|
switch (_typeof(rows)) {
|
|
24192
24252
|
case "undefined":
|
|
24193
24253
|
this.table.rowManager.rows.forEach(function (row) {
|
|
24194
|
-
|
|
24254
|
+
_this3._selectRow(row, true, true);
|
|
24195
24255
|
});
|
|
24196
24256
|
|
|
24197
24257
|
this._rowSelectionChanged();
|
|
@@ -24205,7 +24265,7 @@
|
|
|
24205
24265
|
this._selectRow(rowMatch, true, true);
|
|
24206
24266
|
} else {
|
|
24207
24267
|
this.table.rowManager.getRows(rows).forEach(function (row) {
|
|
24208
|
-
|
|
24268
|
+
_this3._selectRow(row, true, true);
|
|
24209
24269
|
});
|
|
24210
24270
|
}
|
|
24211
24271
|
|
|
@@ -24216,7 +24276,7 @@
|
|
|
24216
24276
|
default:
|
|
24217
24277
|
if (Array.isArray(rows)) {
|
|
24218
24278
|
rows.forEach(function (row) {
|
|
24219
|
-
|
|
24279
|
+
_this3._selectRow(row, true, true);
|
|
24220
24280
|
});
|
|
24221
24281
|
|
|
24222
24282
|
this._rowSelectionChanged();
|