tabulator-tables 5.1.8 → 5.2.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/dist/css/tabulator.css +59 -51
- 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 +59 -51
- 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 +59 -51
- 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 +1575 -0
- package/dist/css/tabulator_bootstrap5.css.map +1 -0
- package/dist/css/tabulator_bootstrap5.min.css +2 -0
- package/dist/css/tabulator_bootstrap5.min.css.map +1 -0
- package/dist/css/tabulator_bulma.css +59 -51
- 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 +59 -51
- 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 +59 -51
- 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 +59 -51
- 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 +59 -51
- 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 +59 -51
- 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 +59 -51
- 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 +2539 -1658
- 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 +2742 -2066
- 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 +1 -1
- package/src/js/core/FooterManager.js +6 -13
- package/src/js/core/Module.js +44 -2
- package/src/js/core/Tabulator.js +341 -289
- package/src/js/core/cell/Cell.js +9 -38
- package/src/js/core/column/Column.js +8 -44
- package/src/js/core/column/defaults/options.js +0 -2
- package/src/js/core/defaults/options.js +5 -2
- package/src/js/core/modules/optional.js +2 -0
- package/src/js/core/row/Row.js +127 -118
- package/src/js/core/tools/Alert.js +63 -0
- package/src/js/core/tools/DataLoader.js +12 -84
- package/src/js/core/tools/InteractionMonitor.js +1 -1
- package/src/js/core/tools/ModuleBinder.js +30 -23
- package/src/js/core/tools/Popup.js +251 -0
- package/src/js/modules/ColumnCalcs/ColumnCalcs.js +2 -2
- package/src/js/modules/Edit/Edit.js +5 -25
- package/src/js/modules/Edit/List.js +997 -0
- package/src/js/modules/Edit/defaults/editors/autocomplete.js +6 -446
- package/src/js/modules/Edit/defaults/editors/input.js +4 -0
- package/src/js/modules/Edit/defaults/editors/list.js +7 -0
- package/src/js/modules/Edit/defaults/editors/number.js +4 -0
- package/src/js/modules/Edit/defaults/editors/select.js +5 -585
- package/src/js/modules/Edit/defaults/editors/textarea.js +4 -0
- package/src/js/modules/Edit/defaults/editors/tickCross.js +17 -5
- package/src/js/modules/Edit/defaults/editors.js +2 -0
- package/src/js/modules/Filter/Filter.js +7 -4
- package/src/js/modules/Format/defaults/formatters/datetime.js +9 -1
- package/src/js/modules/Format/defaults/formatters/datetimediff.js +10 -3
- package/src/js/modules/Format/defaults/formatters/link.js +12 -1
- package/src/js/modules/Format/defaults/formatters/money.js +5 -3
- package/src/js/modules/Format/defaults/formatters/tickCross.js +2 -1
- package/src/js/modules/FrozenColumns/FrozenColumns.js +30 -8
- package/src/js/modules/HtmlTableImport/HtmlTableImport.js +5 -1
- package/src/js/modules/Menu/Menu.js +58 -158
- package/src/js/modules/Mutator/Mutator.js +20 -0
- package/src/js/modules/Page/Page.js +7 -3
- package/src/js/modules/Persistence/Persistence.js +1 -1
- package/src/js/modules/Popup/Popup.js +194 -0
- package/src/js/modules/ResizeColumns/ResizeColumns.js +138 -81
- package/src/js/modules/Sort/defaults/sorters/datetime.js +15 -2
- package/src/js/modules/Tooltip/Tooltip.js +132 -0
- package/src/js/modules/Validate/Validate.js +107 -71
- package/src/scss/tabulator.scss +349 -349
- package/src/scss/themes/bootstrap/functions5.scss +302 -0
- package/src/scss/themes/bootstrap/tabulator_bootstrap5.scss +546 -0
- package/src/scss/themes/bootstrap/variables5.scss +1641 -0
package/src/js/core/row/Row.js
CHANGED
|
@@ -5,7 +5,7 @@ import Helpers from '../tools/Helpers.js';
|
|
|
5
5
|
export default class Row extends CoreFeature{
|
|
6
6
|
constructor (data, parent, type = "row"){
|
|
7
7
|
super(parent.table);
|
|
8
|
-
|
|
8
|
+
|
|
9
9
|
this.parent = parent;
|
|
10
10
|
this.data = {};
|
|
11
11
|
this.type = type; //type of element
|
|
@@ -15,247 +15,256 @@ export default class Row extends CoreFeature{
|
|
|
15
15
|
this.height = 0; //hold element height
|
|
16
16
|
this.heightStyled = ""; //hold element height prestyled to improve render efficiency
|
|
17
17
|
this.manualHeight = false; //user has manually set row height
|
|
18
|
-
this.outerHeight = 0; //
|
|
18
|
+
this.outerHeight = 0; //hold elements outer height
|
|
19
19
|
this.initialized = false; //element has been rendered
|
|
20
20
|
this.heightInitialized = false; //element has resized cells to fit
|
|
21
|
-
|
|
21
|
+
|
|
22
22
|
this.component = null;
|
|
23
|
-
|
|
23
|
+
|
|
24
24
|
this.created = false;
|
|
25
|
-
|
|
25
|
+
|
|
26
26
|
this.setData(data);
|
|
27
27
|
}
|
|
28
|
-
|
|
28
|
+
|
|
29
29
|
create(){
|
|
30
30
|
if(!this.created){
|
|
31
31
|
this.created = true;
|
|
32
32
|
this.generateElement();
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
-
|
|
35
|
+
|
|
36
36
|
createElement (){
|
|
37
37
|
var el = document.createElement("div");
|
|
38
|
-
|
|
38
|
+
|
|
39
39
|
el.classList.add("tabulator-row");
|
|
40
40
|
el.setAttribute("role", "row");
|
|
41
|
-
|
|
41
|
+
|
|
42
42
|
this.element = el;
|
|
43
43
|
}
|
|
44
|
-
|
|
44
|
+
|
|
45
45
|
getElement(){
|
|
46
46
|
this.create();
|
|
47
47
|
return this.element;
|
|
48
48
|
}
|
|
49
|
-
|
|
49
|
+
|
|
50
50
|
detachElement(){
|
|
51
51
|
if (this.element && this.element.parentNode){
|
|
52
52
|
this.element.parentNode.removeChild(this.element);
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
|
-
|
|
55
|
+
|
|
56
56
|
generateElement(){
|
|
57
57
|
this.createElement();
|
|
58
58
|
this.dispatch("row-init", this);
|
|
59
59
|
}
|
|
60
|
-
|
|
60
|
+
|
|
61
61
|
generateCells(){
|
|
62
62
|
this.cells = this.table.columnManager.generateCells(this);
|
|
63
63
|
}
|
|
64
|
-
|
|
64
|
+
|
|
65
65
|
//functions to setup on first render
|
|
66
66
|
initialize(force){
|
|
67
67
|
this.create();
|
|
68
|
-
|
|
68
|
+
|
|
69
69
|
if(!this.initialized || force){
|
|
70
|
-
|
|
70
|
+
|
|
71
71
|
this.deleteCells();
|
|
72
|
-
|
|
72
|
+
|
|
73
73
|
while(this.element.firstChild) this.element.removeChild(this.element.firstChild);
|
|
74
|
-
|
|
74
|
+
|
|
75
75
|
this.dispatch("row-layout-before", this);
|
|
76
|
-
|
|
76
|
+
|
|
77
77
|
this.generateCells();
|
|
78
|
-
|
|
78
|
+
|
|
79
79
|
this.initialized = true;
|
|
80
|
-
|
|
80
|
+
|
|
81
81
|
this.table.columnManager.renderer.renderRowCells(this);
|
|
82
|
-
|
|
82
|
+
|
|
83
83
|
if(force){
|
|
84
84
|
this.normalizeHeight();
|
|
85
85
|
}
|
|
86
|
-
|
|
86
|
+
|
|
87
87
|
this.dispatch("row-layout", this);
|
|
88
|
-
|
|
88
|
+
|
|
89
89
|
if(this.table.options.rowFormatter){
|
|
90
90
|
this.table.options.rowFormatter(this.getComponent());
|
|
91
91
|
}
|
|
92
|
-
|
|
92
|
+
|
|
93
93
|
this.dispatch("row-layout-after", this);
|
|
94
94
|
}else{
|
|
95
95
|
this.table.columnManager.renderer.rerenderRowCells(this);
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
|
-
|
|
98
|
+
|
|
99
99
|
reinitializeHeight(){
|
|
100
100
|
this.heightInitialized = false;
|
|
101
|
-
|
|
101
|
+
|
|
102
102
|
if(this.element && this.element.offsetParent !== null){
|
|
103
103
|
this.normalizeHeight(true);
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
+
deinitialize(){
|
|
108
|
+
this.initialized = false;
|
|
109
|
+
}
|
|
110
|
+
|
|
107
111
|
deinitializeHeight(){
|
|
108
112
|
this.heightInitialized = false;
|
|
109
113
|
}
|
|
110
|
-
|
|
114
|
+
|
|
111
115
|
reinitialize(children){
|
|
112
116
|
this.initialized = false;
|
|
113
117
|
this.heightInitialized = false;
|
|
114
|
-
|
|
118
|
+
|
|
115
119
|
if(!this.manualHeight){
|
|
116
120
|
this.height = 0;
|
|
117
121
|
this.heightStyled = "";
|
|
118
122
|
}
|
|
119
|
-
|
|
123
|
+
|
|
120
124
|
if(this.element && this.element.offsetParent !== null){
|
|
121
125
|
this.initialize(true);
|
|
122
126
|
}
|
|
123
|
-
|
|
127
|
+
|
|
124
128
|
this.dispatch("row-relayout", this);
|
|
125
129
|
}
|
|
126
|
-
|
|
130
|
+
|
|
127
131
|
//get heights when doing bulk row style calcs in virtual DOM
|
|
128
132
|
calcHeight(force){
|
|
129
|
-
|
|
130
133
|
var maxHeight = 0,
|
|
131
|
-
minHeight
|
|
132
|
-
|
|
133
|
-
this.
|
|
134
|
-
|
|
135
|
-
if(height > maxHeight){
|
|
136
|
-
maxHeight = height;
|
|
137
|
-
}
|
|
138
|
-
});
|
|
139
|
-
|
|
140
|
-
if(force){
|
|
141
|
-
this.height = Math.max(maxHeight, minHeight);
|
|
134
|
+
minHeight;
|
|
135
|
+
|
|
136
|
+
if(this.table.options.rowHeight){
|
|
137
|
+
this.height = this.table.options.rowHeight;
|
|
142
138
|
}else{
|
|
143
|
-
|
|
139
|
+
minHeight = this.table.options.resizableRows ? this.element.clientHeight : 0;
|
|
140
|
+
|
|
141
|
+
this.cells.forEach(function(cell){
|
|
142
|
+
var height = cell.getHeight();
|
|
143
|
+
if(height > maxHeight){
|
|
144
|
+
maxHeight = height;
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
if(force){
|
|
149
|
+
this.height = Math.max(maxHeight, minHeight);
|
|
150
|
+
}else{
|
|
151
|
+
this.height = this.manualHeight ? this.height : Math.max(maxHeight, minHeight);
|
|
152
|
+
}
|
|
144
153
|
}
|
|
145
|
-
|
|
154
|
+
|
|
146
155
|
this.heightStyled = this.height ? this.height + "px" : "";
|
|
147
156
|
this.outerHeight = this.element.offsetHeight;
|
|
148
157
|
}
|
|
149
|
-
|
|
158
|
+
|
|
150
159
|
//set of cells
|
|
151
160
|
setCellHeight(){
|
|
152
161
|
this.cells.forEach(function(cell){
|
|
153
162
|
cell.setHeight();
|
|
154
163
|
});
|
|
155
|
-
|
|
164
|
+
|
|
156
165
|
this.heightInitialized = true;
|
|
157
166
|
}
|
|
158
|
-
|
|
167
|
+
|
|
159
168
|
clearCellHeight(){
|
|
160
169
|
this.cells.forEach(function(cell){
|
|
161
170
|
cell.clearHeight();
|
|
162
171
|
});
|
|
163
172
|
}
|
|
164
|
-
|
|
173
|
+
|
|
165
174
|
//normalize the height of elements in the row
|
|
166
175
|
normalizeHeight(force){
|
|
167
|
-
if(force){
|
|
176
|
+
if(force && !this.table.options.rowHeight){
|
|
168
177
|
this.clearCellHeight();
|
|
169
178
|
}
|
|
170
|
-
|
|
179
|
+
|
|
171
180
|
this.calcHeight(force);
|
|
172
|
-
|
|
181
|
+
|
|
173
182
|
this.setCellHeight();
|
|
174
183
|
}
|
|
175
|
-
|
|
184
|
+
|
|
176
185
|
//set height of rows
|
|
177
186
|
setHeight(height, force){
|
|
178
187
|
if(this.height != height || force){
|
|
179
|
-
|
|
188
|
+
|
|
180
189
|
this.manualHeight = true;
|
|
181
|
-
|
|
190
|
+
|
|
182
191
|
this.height = height;
|
|
183
192
|
this.heightStyled = height ? height + "px" : "";
|
|
184
|
-
|
|
193
|
+
|
|
185
194
|
this.setCellHeight();
|
|
186
|
-
|
|
195
|
+
|
|
187
196
|
// this.outerHeight = this.element.outerHeight();
|
|
188
197
|
this.outerHeight = this.element.offsetHeight;
|
|
189
198
|
}
|
|
190
199
|
}
|
|
191
|
-
|
|
200
|
+
|
|
192
201
|
//return rows outer height
|
|
193
202
|
getHeight(){
|
|
194
203
|
return this.outerHeight;
|
|
195
204
|
}
|
|
196
|
-
|
|
205
|
+
|
|
197
206
|
//return rows outer Width
|
|
198
207
|
getWidth(){
|
|
199
208
|
return this.element.offsetWidth;
|
|
200
209
|
}
|
|
201
|
-
|
|
210
|
+
|
|
202
211
|
//////////////// Cell Management /////////////////
|
|
203
212
|
deleteCell(cell){
|
|
204
213
|
var index = this.cells.indexOf(cell);
|
|
205
|
-
|
|
214
|
+
|
|
206
215
|
if(index > -1){
|
|
207
216
|
this.cells.splice(index, 1);
|
|
208
217
|
}
|
|
209
218
|
}
|
|
210
|
-
|
|
219
|
+
|
|
211
220
|
//////////////// Data Management /////////////////
|
|
212
221
|
setData(data){
|
|
213
222
|
this.data = this.chain("row-data-init-before", [this, data], undefined, data);
|
|
214
|
-
|
|
223
|
+
|
|
215
224
|
this.dispatch("row-data-init-after", this);
|
|
216
225
|
}
|
|
217
|
-
|
|
226
|
+
|
|
218
227
|
//update the rows data
|
|
219
228
|
updateData(updatedData){
|
|
220
229
|
var visible = this.element && Helpers.elVisible(this.element),
|
|
221
230
|
tempData = {},
|
|
222
231
|
newRowData;
|
|
223
|
-
|
|
232
|
+
|
|
224
233
|
return new Promise((resolve, reject) => {
|
|
225
|
-
|
|
234
|
+
|
|
226
235
|
if(typeof updatedData === "string"){
|
|
227
236
|
updatedData = JSON.parse(updatedData);
|
|
228
237
|
}
|
|
229
|
-
|
|
238
|
+
|
|
230
239
|
this.dispatch("row-data-save-before", this);
|
|
231
|
-
|
|
240
|
+
|
|
232
241
|
if(this.subscribed("row-data-changing")){
|
|
233
242
|
tempData = Object.assign(tempData, this.data);
|
|
234
243
|
tempData = Object.assign(tempData, updatedData);
|
|
235
244
|
}
|
|
236
|
-
|
|
245
|
+
|
|
237
246
|
newRowData = this.chain("row-data-changing", [this, tempData, updatedData], null, updatedData);
|
|
238
|
-
|
|
247
|
+
|
|
239
248
|
//set data
|
|
240
249
|
for (var attrname in newRowData) {
|
|
241
250
|
this.data[attrname] = newRowData[attrname];
|
|
242
251
|
}
|
|
243
|
-
|
|
252
|
+
|
|
244
253
|
this.dispatch("row-data-save-after", this);
|
|
245
|
-
|
|
254
|
+
|
|
246
255
|
//update affected cells only
|
|
247
256
|
for (var attrname in updatedData) {
|
|
248
|
-
|
|
257
|
+
|
|
249
258
|
let columns = this.table.columnManager.getColumnsByFieldRoot(attrname);
|
|
250
|
-
|
|
259
|
+
|
|
251
260
|
columns.forEach((column) => {
|
|
252
261
|
let cell = this.getCell(column.getField());
|
|
253
|
-
|
|
262
|
+
|
|
254
263
|
if(cell){
|
|
255
264
|
let value = column.getFieldValue(newRowData);
|
|
256
265
|
if(cell.getValue() != value){
|
|
257
266
|
cell.setValueProcessData(value);
|
|
258
|
-
|
|
267
|
+
|
|
259
268
|
if(visible){
|
|
260
269
|
cell.cellRendered();
|
|
261
270
|
}
|
|
@@ -263,11 +272,11 @@ export default class Row extends CoreFeature{
|
|
|
263
272
|
}
|
|
264
273
|
});
|
|
265
274
|
}
|
|
266
|
-
|
|
275
|
+
|
|
267
276
|
//Partial reinitialization if visible
|
|
268
277
|
if(visible){
|
|
269
278
|
this.normalizeHeight(true);
|
|
270
|
-
|
|
279
|
+
|
|
271
280
|
if(this.table.options.rowFormatter){
|
|
272
281
|
this.table.options.rowFormatter(this.getComponent());
|
|
273
282
|
}
|
|
@@ -276,78 +285,78 @@ export default class Row extends CoreFeature{
|
|
|
276
285
|
this.height = 0;
|
|
277
286
|
this.heightStyled = "";
|
|
278
287
|
}
|
|
279
|
-
|
|
288
|
+
|
|
280
289
|
this.dispatch("row-data-changed", this, visible, updatedData);
|
|
281
|
-
|
|
290
|
+
|
|
282
291
|
//this.reinitialize();
|
|
283
|
-
|
|
292
|
+
|
|
284
293
|
this.dispatchExternal("rowUpdated", this.getComponent());
|
|
285
|
-
|
|
294
|
+
|
|
286
295
|
if(this.subscribedExternal("dataChanged")){
|
|
287
296
|
this.dispatchExternal("dataChanged", this.table.rowManager.getData());
|
|
288
297
|
}
|
|
289
|
-
|
|
298
|
+
|
|
290
299
|
resolve();
|
|
291
300
|
});
|
|
292
301
|
}
|
|
293
|
-
|
|
302
|
+
|
|
294
303
|
getData(transform){
|
|
295
304
|
if(transform){
|
|
296
305
|
return this.chain("row-data-retrieve", [this, transform], null, this.data);
|
|
297
306
|
}
|
|
298
|
-
|
|
307
|
+
|
|
299
308
|
return this.data;
|
|
300
309
|
}
|
|
301
|
-
|
|
310
|
+
|
|
302
311
|
getCell(column){
|
|
303
312
|
var match = false;
|
|
304
|
-
|
|
313
|
+
|
|
305
314
|
column = this.table.columnManager.findColumn(column);
|
|
306
|
-
|
|
315
|
+
|
|
307
316
|
if(!this.initialized){
|
|
308
317
|
this.generateCells();
|
|
309
318
|
}
|
|
310
|
-
|
|
319
|
+
|
|
311
320
|
match = this.cells.find(function(cell){
|
|
312
321
|
return cell.column === column;
|
|
313
322
|
});
|
|
314
|
-
|
|
323
|
+
|
|
315
324
|
return match;
|
|
316
325
|
}
|
|
317
|
-
|
|
326
|
+
|
|
318
327
|
getCellIndex(findCell){
|
|
319
328
|
return this.cells.findIndex(function(cell){
|
|
320
329
|
return cell === findCell;
|
|
321
330
|
});
|
|
322
331
|
}
|
|
323
|
-
|
|
332
|
+
|
|
324
333
|
findCell(subject){
|
|
325
334
|
return this.cells.find((cell) => {
|
|
326
335
|
return cell.element === subject;
|
|
327
336
|
});
|
|
328
337
|
}
|
|
329
|
-
|
|
338
|
+
|
|
330
339
|
getCells(){
|
|
331
340
|
if(!this.initialized){
|
|
332
341
|
this.generateCells();
|
|
333
342
|
}
|
|
334
|
-
|
|
343
|
+
|
|
335
344
|
return this.cells;
|
|
336
345
|
}
|
|
337
|
-
|
|
346
|
+
|
|
338
347
|
nextRow(){
|
|
339
348
|
var row = this.table.rowManager.nextDisplayRow(this, true);
|
|
340
349
|
return row || false;
|
|
341
350
|
}
|
|
342
|
-
|
|
351
|
+
|
|
343
352
|
prevRow(){
|
|
344
353
|
var row = this.table.rowManager.prevDisplayRow(this, true);
|
|
345
354
|
return row || false;
|
|
346
355
|
}
|
|
347
|
-
|
|
356
|
+
|
|
348
357
|
moveToRow(to, before){
|
|
349
358
|
var toRow = this.table.rowManager.findRow(to);
|
|
350
|
-
|
|
359
|
+
|
|
351
360
|
if(toRow){
|
|
352
361
|
this.table.rowManager.moveRowActual(this, toRow, !before);
|
|
353
362
|
this.table.rowManager.refreshActiveData("display", false, true);
|
|
@@ -355,70 +364,70 @@ export default class Row extends CoreFeature{
|
|
|
355
364
|
console.warn("Move Error - No matching row found:", to);
|
|
356
365
|
}
|
|
357
366
|
}
|
|
358
|
-
|
|
367
|
+
|
|
359
368
|
///////////////////// Actions /////////////////////
|
|
360
369
|
delete(){
|
|
361
370
|
this.dispatch("row-delete", this);
|
|
362
|
-
|
|
371
|
+
|
|
363
372
|
this.deleteActual();
|
|
364
|
-
|
|
373
|
+
|
|
365
374
|
return Promise.resolve();
|
|
366
375
|
}
|
|
367
|
-
|
|
376
|
+
|
|
368
377
|
deleteActual(blockRedraw){
|
|
369
378
|
var index = this.table.rowManager.getRowIndex(this);
|
|
370
|
-
|
|
379
|
+
|
|
371
380
|
this.detatchModules();
|
|
372
|
-
|
|
381
|
+
|
|
373
382
|
this.table.rowManager.deleteRow(this, blockRedraw);
|
|
374
|
-
|
|
383
|
+
|
|
375
384
|
this.deleteCells();
|
|
376
|
-
|
|
385
|
+
|
|
377
386
|
this.initialized = false;
|
|
378
387
|
this.heightInitialized = false;
|
|
379
388
|
this.element = false;
|
|
380
|
-
|
|
389
|
+
|
|
381
390
|
this.dispatch("row-deleted", this);
|
|
382
391
|
}
|
|
383
|
-
|
|
392
|
+
|
|
384
393
|
detatchModules(){
|
|
385
394
|
this.dispatch("row-deleting", this);
|
|
386
395
|
}
|
|
387
|
-
|
|
396
|
+
|
|
388
397
|
deleteCells(){
|
|
389
398
|
var cellCount = this.cells.length;
|
|
390
|
-
|
|
399
|
+
|
|
391
400
|
for(let i = 0; i < cellCount; i++){
|
|
392
401
|
this.cells[0].delete();
|
|
393
402
|
}
|
|
394
403
|
}
|
|
395
|
-
|
|
404
|
+
|
|
396
405
|
wipe(){
|
|
397
406
|
this.detatchModules();
|
|
398
407
|
this.deleteCells();
|
|
399
|
-
|
|
408
|
+
|
|
400
409
|
if(this.element){
|
|
401
410
|
while(this.element.firstChild) this.element.removeChild(this.element.firstChild);
|
|
402
|
-
|
|
411
|
+
|
|
403
412
|
if(this.element.parentNode){
|
|
404
413
|
this.element.parentNode.removeChild(this.element);
|
|
405
414
|
}
|
|
406
415
|
}
|
|
407
|
-
|
|
416
|
+
|
|
408
417
|
this.element = false;
|
|
409
418
|
this.modules = {};
|
|
410
419
|
}
|
|
411
|
-
|
|
420
|
+
|
|
412
421
|
getGroup(){
|
|
413
422
|
return this.modules.group || false;
|
|
414
423
|
}
|
|
415
|
-
|
|
424
|
+
|
|
416
425
|
//////////////// Object Generation /////////////////
|
|
417
426
|
getComponent(){
|
|
418
427
|
if(!this.component){
|
|
419
428
|
this.component = new RowComponent(this);
|
|
420
429
|
}
|
|
421
|
-
|
|
430
|
+
|
|
422
431
|
return this.component;
|
|
423
432
|
}
|
|
424
433
|
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import CoreFeature from '../CoreFeature.js';
|
|
2
|
+
import Helpers from './Helpers.js';
|
|
3
|
+
|
|
4
|
+
export default class Alert extends CoreFeature{
|
|
5
|
+
constructor(table){
|
|
6
|
+
super(table);
|
|
7
|
+
|
|
8
|
+
this.element = this._createAlertElement();
|
|
9
|
+
this.msgElement = this._createMsgElement();
|
|
10
|
+
this.type = null;
|
|
11
|
+
|
|
12
|
+
this.element.appendChild(this.msgElement);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
_createAlertElement(){
|
|
16
|
+
var el = document.createElement("div");
|
|
17
|
+
el.classList.add("tabulator-alert");
|
|
18
|
+
return el;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
_createMsgElement(){
|
|
22
|
+
var el = document.createElement("div");
|
|
23
|
+
el.classList.add("tabulator-alert-msg");
|
|
24
|
+
el.setAttribute("role", "alert");
|
|
25
|
+
return el;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
_typeClass(){
|
|
29
|
+
return "tabulator-alert-state-" + this.type;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
alert(content, type = "msg"){
|
|
33
|
+
if(content){
|
|
34
|
+
this.clear();
|
|
35
|
+
|
|
36
|
+
this.type = type;
|
|
37
|
+
|
|
38
|
+
while(this.msgElement.firstChild) this.msgElement.removeChild(this.msgElement.firstChild);
|
|
39
|
+
|
|
40
|
+
this.msgElement.classList.add(this._typeClass());
|
|
41
|
+
|
|
42
|
+
if(typeof content === "function"){
|
|
43
|
+
content = content();
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if(content instanceof HTMLElement){
|
|
47
|
+
this.msgElement.appendChild(content);
|
|
48
|
+
}else{
|
|
49
|
+
this.msgElement.innerHTML = content;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
this.table.element.appendChild(this.element);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
clear(){
|
|
57
|
+
if(this.element.parentNode){
|
|
58
|
+
this.element.parentNode.removeChild(this.element);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
this.msgElement.classList.remove(this._typeClass());
|
|
62
|
+
}
|
|
63
|
+
}
|