tabulator-tables 5.3.3 → 5.4.0
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/build/Bundler.js +64 -38
- package/dist/css/tabulator.css +69 -19
- package/dist/css/tabulator.css.map +1 -1
- package/dist/css/tabulator.min.css +1 -1
- package/dist/css/tabulator.min.css.map +1 -1
- package/dist/css/tabulator_bootstrap3.css +69 -19
- package/dist/css/tabulator_bootstrap3.css.map +1 -1
- package/dist/css/tabulator_bootstrap3.min.css +1 -1
- package/dist/css/tabulator_bootstrap3.min.css.map +1 -1
- package/dist/css/tabulator_bootstrap4.css +69 -19
- package/dist/css/tabulator_bootstrap4.css.map +1 -1
- package/dist/css/tabulator_bootstrap4.min.css +1 -1
- package/dist/css/tabulator_bootstrap4.min.css.map +1 -1
- package/dist/css/tabulator_bootstrap5.css +69 -19
- package/dist/css/tabulator_bootstrap5.css.map +1 -1
- package/dist/css/tabulator_bootstrap5.min.css +1 -1
- package/dist/css/tabulator_bootstrap5.min.css.map +1 -1
- package/dist/css/tabulator_bulma.css +69 -19
- package/dist/css/tabulator_bulma.css.map +1 -1
- package/dist/css/tabulator_bulma.min.css +1 -1
- package/dist/css/tabulator_bulma.min.css.map +1 -1
- package/dist/css/tabulator_materialize.css +69 -19
- package/dist/css/tabulator_materialize.css.map +1 -1
- package/dist/css/tabulator_materialize.min.css +1 -1
- package/dist/css/tabulator_materialize.min.css.map +1 -1
- package/dist/css/tabulator_midnight.css +69 -19
- package/dist/css/tabulator_midnight.css.map +1 -1
- package/dist/css/tabulator_midnight.min.css +1 -1
- package/dist/css/tabulator_midnight.min.css.map +1 -1
- package/dist/css/tabulator_modern.css +69 -19
- package/dist/css/tabulator_modern.css.map +1 -1
- package/dist/css/tabulator_modern.min.css +1 -1
- package/dist/css/tabulator_modern.min.css.map +1 -1
- package/dist/css/tabulator_semanticui.css +69 -19
- package/dist/css/tabulator_semanticui.css.map +1 -1
- package/dist/css/tabulator_semanticui.min.css +1 -1
- package/dist/css/tabulator_semanticui.min.css.map +1 -1
- package/dist/css/tabulator_simple.css +69 -19
- package/dist/css/tabulator_simple.css.map +1 -1
- package/dist/css/tabulator_simple.min.css +1 -1
- package/dist/css/tabulator_simple.min.css.map +1 -1
- package/dist/css/tabulator_site.css +69 -19
- package/dist/css/tabulator_site.css.map +1 -1
- package/dist/css/tabulator_site.min.css +1 -1
- package/dist/css/tabulator_site.min.css.map +1 -1
- package/dist/js/tabulator.js +25819 -27493
- 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 +706 -508
- 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 +3 -6
- package/src/js/core/ColumnManager.js +32 -17
- package/src/js/core/RowManager.js +30 -4
- package/src/js/core/column/Column.js +4 -0
- package/src/js/core/column/defaults/options.js +1 -0
- package/src/js/core/rendering/renderers/VirtualDomHorizontal.js +76 -77
- package/src/js/core/row/Row.js +1 -1
- package/src/js/core/tools/InteractionMonitor.js +2 -0
- package/src/js/core/tools/Popup.js +98 -76
- package/src/js/modules/ColumnCalcs/ColumnCalcs.js +185 -146
- package/src/js/modules/Download/defaults/downloaders/xlsx.js +2 -1
- package/src/js/modules/Edit/Edit.js +13 -2
- package/src/js/modules/Format/Format.js +46 -40
- package/src/js/modules/Format/defaults/formatters/responsiveCollapse.js +9 -1
- package/src/js/modules/FrozenColumns/FrozenColumns.js +24 -57
- package/src/js/modules/FrozenRows/FrozenRows.js +4 -3
- package/src/js/modules/GroupRows/Group.js +20 -28
- package/src/js/modules/GroupRows/GroupComponent.js +1 -1
- package/src/js/modules/GroupRows/GroupRows.js +1 -2
- package/src/js/modules/Interaction/Interaction.js +12 -0
- package/src/js/modules/Menu/Menu.js +31 -7
- package/src/js/modules/MoveColumns/MoveColumns.js +3 -3
- package/src/js/modules/Persistence/Persistence.js +1 -0
- package/src/js/modules/Popup/Popup.js +42 -4
- package/src/js/modules/ResizeColumns/ResizeColumns.js +25 -6
- package/src/js/modules/ResizeTable/ResizeTable.js +7 -8
- package/src/js/modules/ResponsiveLayout/ResponsiveLayout.js +21 -21
- package/src/js/modules/Sort/Sort.js +14 -2
- package/src/scss/tabulator.scss +92 -31
|
@@ -4,60 +4,61 @@ import Helpers from './Helpers.js';
|
|
|
4
4
|
export default class Popup extends CoreFeature{
|
|
5
5
|
constructor(table, element, parent){
|
|
6
6
|
super(table);
|
|
7
|
-
|
|
7
|
+
|
|
8
8
|
this.element = element;
|
|
9
9
|
this.container = this._lookupContainer();
|
|
10
|
-
|
|
10
|
+
|
|
11
11
|
this.parent = parent;
|
|
12
|
-
|
|
12
|
+
|
|
13
13
|
this.reversedX = false;
|
|
14
14
|
this.childPopup = null;
|
|
15
15
|
this.blurable = false;
|
|
16
16
|
this.blurCallback = null;
|
|
17
|
+
this.blurEventsBound = false;
|
|
17
18
|
this.renderedCallback = null;
|
|
18
|
-
|
|
19
|
+
|
|
19
20
|
this.visible = false;
|
|
20
21
|
this.hideable = true;
|
|
21
|
-
|
|
22
|
+
|
|
22
23
|
this.element.classList.add("tabulator-popup-container");
|
|
23
|
-
|
|
24
|
+
|
|
24
25
|
this.blurEvent = this.hide.bind(this, false);
|
|
25
26
|
this.escEvent = this._escapeCheck.bind(this);
|
|
26
|
-
|
|
27
|
+
|
|
27
28
|
this.destroyBinding = this.tableDestroyed;
|
|
28
29
|
this.destroyed = false;
|
|
29
30
|
}
|
|
30
|
-
|
|
31
|
+
|
|
31
32
|
tableDestroyed(){
|
|
32
33
|
this.destroyed = true;
|
|
33
34
|
this.hide(true);
|
|
34
35
|
}
|
|
35
|
-
|
|
36
|
+
|
|
36
37
|
_lookupContainer(){
|
|
37
38
|
var container = this.table.options.popupContainer;
|
|
38
|
-
|
|
39
|
+
|
|
39
40
|
if(typeof container === "string"){
|
|
40
41
|
container = document.querySelector(container);
|
|
41
|
-
|
|
42
|
+
|
|
42
43
|
if(!container){
|
|
43
44
|
console.warn("Menu Error - no container element found matching selector:", this.table.options.popupContainer , "(defaulting to document body)");
|
|
44
45
|
}
|
|
45
46
|
}else if (container === true){
|
|
46
47
|
container = this.table.element;
|
|
47
48
|
}
|
|
48
|
-
|
|
49
|
+
|
|
49
50
|
if(container && !this._checkContainerIsParent(container)){
|
|
50
51
|
container = false;
|
|
51
52
|
console.warn("Menu Error - container element does not contain this table:", this.table.options.popupContainer , "(defaulting to document body)");
|
|
52
53
|
}
|
|
53
|
-
|
|
54
|
+
|
|
54
55
|
if(!container){
|
|
55
56
|
container = document.body;
|
|
56
57
|
}
|
|
57
|
-
|
|
58
|
+
|
|
58
59
|
return container;
|
|
59
60
|
}
|
|
60
|
-
|
|
61
|
+
|
|
61
62
|
_checkContainerIsParent(container, element = this.table.element){
|
|
62
63
|
if(container === element){
|
|
63
64
|
return true;
|
|
@@ -65,119 +66,135 @@ export default class Popup extends CoreFeature{
|
|
|
65
66
|
return element.parentNode ? this._checkContainerIsParent(container, element.parentNode) : false;
|
|
66
67
|
}
|
|
67
68
|
}
|
|
68
|
-
|
|
69
|
+
|
|
69
70
|
renderCallback(callback){
|
|
70
71
|
this.renderedCallback = callback;
|
|
71
72
|
}
|
|
72
|
-
|
|
73
|
+
|
|
73
74
|
containerEventCoords(e){
|
|
74
75
|
var touch = !(e instanceof MouseEvent);
|
|
75
|
-
|
|
76
|
+
|
|
76
77
|
var x = touch ? e.touches[0].pageX : e.pageX;
|
|
77
78
|
var y = touch ? e.touches[0].pageY : e.pageY;
|
|
78
|
-
|
|
79
|
+
|
|
79
80
|
if(this.container !== document.body){
|
|
80
81
|
let parentOffset = Helpers.elOffset(this.container);
|
|
81
|
-
|
|
82
|
+
|
|
82
83
|
x -= parentOffset.left;
|
|
83
84
|
y -= parentOffset.top;
|
|
84
85
|
}
|
|
85
|
-
|
|
86
|
+
|
|
86
87
|
return {x, y};
|
|
87
88
|
}
|
|
88
|
-
|
|
89
|
+
|
|
89
90
|
elementPositionCoords(element, position = "right"){
|
|
90
91
|
var offset = Helpers.elOffset(element),
|
|
91
92
|
containerOffset, x, y;
|
|
92
|
-
|
|
93
|
+
|
|
93
94
|
if(this.container !== document.body){
|
|
94
95
|
containerOffset = Helpers.elOffset(this.container);
|
|
95
|
-
|
|
96
|
+
|
|
96
97
|
offset.left -= containerOffset.left;
|
|
97
98
|
offset.top -= containerOffset.top;
|
|
98
99
|
}
|
|
99
|
-
|
|
100
|
+
|
|
100
101
|
switch(position){
|
|
101
102
|
case "right":
|
|
102
103
|
x = offset.left + element.offsetWidth;
|
|
103
104
|
y = offset.top - 1;
|
|
104
105
|
break;
|
|
105
|
-
|
|
106
|
+
|
|
106
107
|
case "bottom":
|
|
107
108
|
x = offset.left;
|
|
108
109
|
y = offset.top + element.offsetHeight;
|
|
109
110
|
break;
|
|
111
|
+
|
|
112
|
+
case "left":
|
|
113
|
+
x = offset.left;
|
|
114
|
+
y = offset.top - 1;
|
|
115
|
+
break;
|
|
116
|
+
|
|
117
|
+
case "top":
|
|
118
|
+
x = offset.left;
|
|
119
|
+
y = offset.top;
|
|
120
|
+
break;
|
|
121
|
+
|
|
122
|
+
case "center":
|
|
123
|
+
x = offset.left + (element.offsetWidth / 2);
|
|
124
|
+
y = offset.top + (element.offsetHeight / 2);
|
|
125
|
+
break;
|
|
126
|
+
|
|
110
127
|
}
|
|
111
|
-
|
|
128
|
+
|
|
112
129
|
return {x, y, offset};
|
|
113
130
|
}
|
|
114
|
-
|
|
131
|
+
|
|
115
132
|
show(origin, position){
|
|
116
133
|
var x, y, parentEl, parentOffset, coords;
|
|
117
|
-
|
|
134
|
+
|
|
118
135
|
if(this.destroyed || this.table.destroyed){
|
|
119
136
|
return this;
|
|
120
137
|
}
|
|
121
|
-
|
|
138
|
+
|
|
122
139
|
if(origin instanceof HTMLElement){
|
|
123
140
|
parentEl = origin;
|
|
124
141
|
coords = this.elementPositionCoords(origin, position);
|
|
125
|
-
|
|
142
|
+
|
|
126
143
|
parentOffset = coords.offset;
|
|
127
144
|
x = coords.x;
|
|
128
145
|
y = coords.y;
|
|
129
|
-
|
|
146
|
+
|
|
130
147
|
}else if(typeof origin === "number"){
|
|
131
148
|
parentOffset = {top:0, left:0};
|
|
132
149
|
x = origin;
|
|
133
150
|
y = position;
|
|
134
151
|
}else{
|
|
135
152
|
coords = this.containerEventCoords(origin);
|
|
136
|
-
|
|
153
|
+
|
|
137
154
|
x = coords.x;
|
|
138
155
|
y = coords.y;
|
|
139
|
-
|
|
156
|
+
|
|
140
157
|
this.reversedX = false;
|
|
141
158
|
}
|
|
142
|
-
|
|
159
|
+
|
|
143
160
|
this.element.style.top = y + "px";
|
|
144
161
|
this.element.style.left = x + "px";
|
|
145
|
-
|
|
162
|
+
|
|
146
163
|
this.container.appendChild(this.element);
|
|
147
|
-
|
|
164
|
+
|
|
148
165
|
if(typeof this.renderedCallback === "function"){
|
|
149
166
|
this.renderedCallback();
|
|
150
167
|
}
|
|
151
|
-
|
|
168
|
+
|
|
152
169
|
this._fitToScreen(x, y, parentEl, parentOffset, position);
|
|
153
|
-
|
|
170
|
+
|
|
154
171
|
this.visible = true;
|
|
155
|
-
|
|
172
|
+
|
|
156
173
|
this.subscribe("table-destroy", this.destroyBinding);
|
|
157
|
-
|
|
174
|
+
|
|
158
175
|
this.element.addEventListener("mousedown", (e) => {
|
|
159
176
|
e.stopPropagation();
|
|
160
177
|
});
|
|
161
|
-
|
|
178
|
+
|
|
162
179
|
return this;
|
|
163
180
|
}
|
|
164
|
-
|
|
181
|
+
|
|
165
182
|
_fitToScreen(x, y, parentEl, parentOffset, position){
|
|
166
183
|
var scrollTop = this.container === document.body ? document.documentElement.scrollTop : this.container.scrollTop;
|
|
167
|
-
|
|
184
|
+
|
|
168
185
|
//move menu to start on right edge if it is too close to the edge of the screen
|
|
169
186
|
if((x + this.element.offsetWidth) >= this.container.offsetWidth || this.reversedX){
|
|
170
187
|
this.element.style.left = "";
|
|
171
|
-
|
|
188
|
+
|
|
172
189
|
if(parentEl){
|
|
173
190
|
this.element.style.right = (this.container.offsetWidth - parentOffset.left) + "px";
|
|
174
191
|
}else{
|
|
175
192
|
this.element.style.right = (this.container.offsetWidth - x) + "px";
|
|
176
193
|
}
|
|
177
|
-
|
|
194
|
+
|
|
178
195
|
this.reversedX = true;
|
|
179
196
|
}
|
|
180
|
-
|
|
197
|
+
|
|
181
198
|
//move menu to start on bottom edge if it is too close to the edge of the screen
|
|
182
199
|
if((y + this.element.offsetHeight) > Math.max(this.container.offsetHeight, scrollTop ? this.container.scrollHeight : 0)) {
|
|
183
200
|
if(parentEl){
|
|
@@ -185,59 +202,62 @@ export default class Popup extends CoreFeature{
|
|
|
185
202
|
case "bottom":
|
|
186
203
|
this.element.style.top = (parseInt(this.element.style.top) - this.element.offsetHeight - parentEl.offsetHeight - 1) + "px";
|
|
187
204
|
break;
|
|
188
|
-
|
|
205
|
+
|
|
189
206
|
default:
|
|
190
207
|
this.element.style.top = (parseInt(this.element.style.top) - this.element.offsetHeight + parentEl.offsetHeight + 1) + "px";
|
|
191
208
|
}
|
|
192
|
-
|
|
209
|
+
|
|
193
210
|
}else{
|
|
194
211
|
this.element.style.top = (parseInt(this.element.style.top) - this.element.offsetHeight) + "px";
|
|
195
212
|
}
|
|
196
213
|
}
|
|
197
214
|
}
|
|
198
|
-
|
|
215
|
+
|
|
199
216
|
isVisible(){
|
|
200
217
|
return this.visible;
|
|
201
218
|
}
|
|
202
|
-
|
|
219
|
+
|
|
203
220
|
hideOnBlur(callback){
|
|
204
221
|
this.blurable = true;
|
|
205
|
-
|
|
222
|
+
|
|
206
223
|
if(this.visible){
|
|
207
224
|
setTimeout(() => {
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
225
|
+
if(this.visible){
|
|
226
|
+
this.table.rowManager.element.addEventListener("scroll", this.blurEvent);
|
|
227
|
+
this.subscribe("cell-editing", this.blurEvent);
|
|
228
|
+
document.body.addEventListener("click", this.blurEvent);
|
|
229
|
+
document.body.addEventListener("contextmenu", this.blurEvent);
|
|
230
|
+
document.body.addEventListener("mousedown", this.blurEvent);
|
|
231
|
+
window.addEventListener("resize", this.blurEvent);
|
|
232
|
+
document.body.addEventListener("keydown", this.escEvent);
|
|
215
233
|
|
|
234
|
+
this.blurEventsBound = true;
|
|
235
|
+
}
|
|
216
236
|
}, 100);
|
|
217
|
-
|
|
237
|
+
|
|
218
238
|
this.blurCallback = callback;
|
|
219
239
|
}
|
|
220
|
-
|
|
240
|
+
|
|
221
241
|
return this;
|
|
222
242
|
}
|
|
223
|
-
|
|
243
|
+
|
|
224
244
|
_escapeCheck(e){
|
|
225
245
|
if(e.keyCode == 27){
|
|
226
246
|
this.hide();
|
|
227
247
|
}
|
|
228
248
|
}
|
|
229
|
-
|
|
249
|
+
|
|
230
250
|
blockHide(){
|
|
231
251
|
this.hideable = false;
|
|
232
252
|
}
|
|
233
|
-
|
|
253
|
+
|
|
234
254
|
restoreHide(){
|
|
235
255
|
this.hideable = true;
|
|
236
256
|
}
|
|
237
|
-
|
|
257
|
+
|
|
238
258
|
hide(silent = false){
|
|
239
259
|
if(this.visible && this.hideable){
|
|
240
|
-
if(this.blurable){
|
|
260
|
+
if(this.blurable && this.blurEventsBound){
|
|
241
261
|
document.body.removeEventListener("keydown", this.escEvent);
|
|
242
262
|
document.body.removeEventListener("click", this.blurEvent);
|
|
243
263
|
document.body.removeEventListener("contextmenu", this.blurEvent);
|
|
@@ -245,39 +265,41 @@ export default class Popup extends CoreFeature{
|
|
|
245
265
|
window.removeEventListener("resize", this.blurEvent);
|
|
246
266
|
this.table.rowManager.element.removeEventListener("scroll", this.blurEvent);
|
|
247
267
|
this.unsubscribe("cell-editing", this.blurEvent);
|
|
268
|
+
|
|
269
|
+
this.blurEventsBound = false;
|
|
248
270
|
}
|
|
249
|
-
|
|
271
|
+
|
|
250
272
|
if(this.childPopup){
|
|
251
273
|
this.childPopup.hide();
|
|
252
274
|
}
|
|
253
|
-
|
|
275
|
+
|
|
254
276
|
if(this.parent){
|
|
255
277
|
this.parent.childPopup = null;
|
|
256
278
|
}
|
|
257
|
-
|
|
279
|
+
|
|
258
280
|
if(this.element.parentNode){
|
|
259
281
|
this.element.parentNode.removeChild(this.element);
|
|
260
282
|
}
|
|
261
|
-
|
|
283
|
+
|
|
262
284
|
this.visible = false;
|
|
263
|
-
|
|
285
|
+
|
|
264
286
|
if(this.blurCallback && !silent){
|
|
265
287
|
this.blurCallback();
|
|
266
288
|
}
|
|
267
|
-
|
|
289
|
+
|
|
268
290
|
this.unsubscribe("table-destroy", this.destroyBinding);
|
|
269
291
|
}
|
|
270
|
-
|
|
292
|
+
|
|
271
293
|
return this;
|
|
272
294
|
}
|
|
273
|
-
|
|
295
|
+
|
|
274
296
|
child(element){
|
|
275
297
|
if(this.childPopup){
|
|
276
298
|
this.childPopup.hide();
|
|
277
299
|
}
|
|
278
|
-
|
|
300
|
+
|
|
279
301
|
this.childPopup = new Popup(this.table, element, this);
|
|
280
|
-
|
|
302
|
+
|
|
281
303
|
return this.childPopup;
|
|
282
304
|
}
|
|
283
305
|
}
|