@holoviz/panel 0.14.0-a.2 → 0.14.0-a.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/dist/bundled/css/{npm/bootstrap@4.6.1 → bootstrap@4.6.1}/dist/css/bootstrap.min.css +0 -0
- package/dist/bundled/css/{npm/golden-layout@1.5.9 → golden-layout@1.5.9}/src/css/goldenlayout-base.css +0 -0
- package/dist/bundled/datatabulator/@holoviz/panel/dist/bundled/tabulator-tables@5.3.2/dist/css/fast/tabulator_fast.min.css +1 -0
- package/dist/bundled/datatabulator/luxon/build/global/luxon.min.js +1 -0
- package/dist/bundled/datatabulator/luxon/build/global/luxon.min.js.map +1 -0
- package/dist/bundled/datatabulator/{tabulator-tables@4.9.3 → tabulator-tables@5.3.2}/dist/css/fast/tabulator_fast.min.css +0 -0
- package/dist/bundled/datatabulator/tabulator-tables@5.3.2/dist/css/tabulator.min.css +2 -0
- package/dist/bundled/datatabulator/tabulator-tables@5.3.2/dist/css/tabulator_bootstrap3.min.css +2 -0
- package/dist/bundled/datatabulator/tabulator-tables@5.3.2/dist/css/tabulator_bootstrap4.min.css +2 -0
- package/dist/bundled/datatabulator/tabulator-tables@5.3.2/dist/css/tabulator_bulma.min.css +2 -0
- package/dist/bundled/datatabulator/tabulator-tables@5.3.2/dist/css/tabulator_materialize.min.css +2 -0
- package/dist/bundled/datatabulator/tabulator-tables@5.3.2/dist/css/tabulator_midnight.min.css +2 -0
- package/dist/bundled/datatabulator/tabulator-tables@5.3.2/dist/css/tabulator_modern.min.css +2 -0
- package/dist/bundled/datatabulator/tabulator-tables@5.3.2/dist/css/tabulator_semanticui.min.css +2 -0
- package/dist/bundled/datatabulator/tabulator-tables@5.3.2/dist/css/tabulator_simple.min.css +2 -0
- package/dist/bundled/datatabulator/tabulator-tables@5.3.2/dist/css/tabulator_site.min.css +2 -0
- package/dist/bundled/datatabulator/tabulator-tables@5.3.2/dist/js/tabulator.js +27481 -0
- package/dist/bundled/datatabulator/tabulator-tables@5.3.2/dist/js/tabulator.js.map +1 -0
- package/dist/bundled/deckglplot/{npm/@deck.gl → @deck.gl}/json@8.6.7/dist.min.js +0 -0
- package/dist/bundled/deckglplot/{npm/@loaders.gl → @loaders.gl}/3d-tiles@3.1.7/dist/dist.min.js +0 -0
- package/dist/bundled/deckglplot/{npm/@loaders.gl → @loaders.gl}/csv@3.1.7/dist/dist.min.js +0 -0
- package/dist/bundled/deckglplot/{npm/@loaders.gl → @loaders.gl}/json@3.1.7/dist/dist.min.js +0 -0
- package/dist/bundled/deckglplot/{npm/deck.gl@8.6.7 → deck.gl@8.6.7}/dist.min.js +0 -0
- package/dist/bundled/echarts/{npm/echarts-gl@2.0.2 → echarts-gl@2.0.2}/dist/echarts-gl.min.js +0 -0
- package/dist/bundled/echarts/{npm/echarts@5.0.2 → echarts@5.0.2}/dist/echarts.min.js +0 -0
- package/dist/bundled/fastbasetemplate/fast_panel.css +1 -0
- package/dist/bundled/gridstack/{npm/gridstack@4.2.5 → gridstack@4.2.5}/dist/gridstack-extra.min.css +0 -0
- package/dist/bundled/gridstack/{npm/gridstack@4.2.5 → gridstack@4.2.5}/dist/gridstack-h5.js +0 -0
- package/dist/bundled/gridstack/{npm/gridstack@4.2.5 → gridstack@4.2.5}/dist/gridstack-h5.js.map +0 -0
- package/dist/bundled/gridstack/{npm/gridstack@4.2.5 → gridstack@4.2.5}/dist/gridstack.min.css +0 -0
- package/dist/bundled/js/{npm/bootstrap@4.6.1 → bootstrap@4.6.1}/dist/js/bootstrap.bundle.min.js +0 -0
- package/dist/bundled/js/{npm/bootstrap@4.6.1 → bootstrap@4.6.1}/dist/js/bootstrap.bundle.min.js.map +0 -0
- package/dist/bundled/js/{npm/golden-layout@1.5.9 → golden-layout@1.5.9}/dist/goldenlayout.min.js +0 -0
- package/dist/bundled/js/{npm/jquery@3.5.1 → jquery@3.5.1}/dist/jquery.slim.min.js +0 -0
- package/dist/bundled/jsoneditor/jsoneditor@9.5.6/dist/jsoneditor.min.css +6 -0
- package/dist/bundled/jsoneditor/jsoneditor@9.5.6/dist/jsoneditor.min.js +45 -0
- package/dist/bundled/notificationarea/{npm/notyf@3 → notyf@3}/notyf.min.css +0 -0
- package/dist/bundled/notificationarea/{npm/notyf@3 → notyf@3}/notyf.min.js +0 -0
- package/dist/bundled/plotlyplot/{npm/jquery@3.5.1 → jquery@3.5.1}/dist/jquery.slim.min.js +0 -0
- package/dist/css/markdown.css +7 -0
- package/dist/lib/models/comm_manager.d.ts +1 -0
- package/dist/lib/models/comm_manager.js +21 -1
- package/dist/lib/models/comm_manager.js.map +1 -1
- package/dist/lib/models/datetime_picker.js +4 -2
- package/dist/lib/models/datetime_picker.js.map +1 -1
- package/dist/lib/models/event-to-object.js +4 -0
- package/dist/lib/models/event-to-object.js.map +1 -1
- package/dist/lib/models/player.d.ts +2 -1
- package/dist/lib/models/player.js +11 -4
- package/dist/lib/models/player.js.map +1 -1
- package/dist/lib/models/reactive_html.js +11 -1
- package/dist/lib/models/reactive_html.js.map +1 -1
- package/dist/lib/models/tabulator.d.ts +5 -2
- package/dist/lib/models/tabulator.js +181 -162
- package/dist/lib/models/tabulator.js.map +1 -1
- package/dist/lib/styles/markdown.css.js +7 -0
- package/dist/panel.js +246 -175
- package/dist/panel.js.map +1 -1
- package/dist/panel.json +1 -1
- package/dist/panel.min.js +11 -11
- package/dist/wheels/bokeh-2.4.3-py3-none-any.whl +0 -0
- package/dist/wheels/panel-0.14.0a21-py3-none-any.whl +0 -0
- package/package.json +2 -2
- package/dist/bundled/datatabulator/npm/@holoviz/panel/dist/bundled/tabulator-tables@4.9.3/dist/css/fast/tabulator_fast.min.css +0 -1
- package/dist/bundled/datatabulator/npm/luxon/build/global/luxon.min.js +0 -1
- package/dist/bundled/datatabulator/npm/luxon/build/global/luxon.min.js.map +0 -1
- package/dist/bundled/datatabulator/tabulator-tables@4.9.3/dist/css/bootstrap/tabulator_bootstrap.min.css +0 -3
- package/dist/bundled/datatabulator/tabulator-tables@4.9.3/dist/css/bootstrap/tabulator_bootstrap4.min.css +0 -3
- package/dist/bundled/datatabulator/tabulator-tables@4.9.3/dist/css/bulma/tabulator_bulma.min.css +0 -3
- package/dist/bundled/datatabulator/tabulator-tables@4.9.3/dist/css/materialize/tabulator_materialize.min.css +0 -3
- package/dist/bundled/datatabulator/tabulator-tables@4.9.3/dist/css/semantic-ui/tabulator_semantic-ui.min.css +0 -3
- package/dist/bundled/datatabulator/tabulator-tables@4.9.3/dist/css/tabulator.min.css +0 -3
- package/dist/bundled/datatabulator/tabulator-tables@4.9.3/dist/css/tabulator_midnight.min.css +0 -3
- package/dist/bundled/datatabulator/tabulator-tables@4.9.3/dist/css/tabulator_modern.min.css +0 -3
- package/dist/bundled/datatabulator/tabulator-tables@4.9.3/dist/css/tabulator_simple.min.css +0 -3
- package/dist/bundled/datatabulator/tabulator-tables@4.9.3/dist/css/tabulator_site.min.css +0 -3
- package/dist/bundled/datatabulator/tabulator-tables@4.9.3/dist/js/tabulator.js +0 -26546
- package/dist/bundled/jsoneditor/npm/jsoneditor@9.1.9/dist/jsoneditor.min.css +0 -6
- package/dist/bundled/jsoneditor/npm/jsoneditor@9.1.9/dist/jsoneditor.min.js +0 -46
|
@@ -112,6 +112,45 @@ function group_data(records, columns, indexes, aggregators) {
|
|
|
112
112
|
summarize(grouped, columns, aggs);
|
|
113
113
|
return grouped;
|
|
114
114
|
}
|
|
115
|
+
const timestampSorter = function (a, b, _aRow, _bRow, _column, _dir, _params) {
|
|
116
|
+
// Bokeh serializes datetime objects as UNIX timestamps.
|
|
117
|
+
//a, b - the two values being compared
|
|
118
|
+
//aRow, bRow - the row components for the values being compared (useful if you need to access additional fields in the row data for the sort)
|
|
119
|
+
//column - the column component for the column being sorted
|
|
120
|
+
//dir - the direction of the sort ("asc" or "desc")
|
|
121
|
+
//sorterParams - sorterParams object from column definition array
|
|
122
|
+
// Added an _ in front of some parameters as they're unused and the Typescript compiler was complaining about it.
|
|
123
|
+
// const alignEmptyValues = params.alignEmptyValues
|
|
124
|
+
let emptyAlign;
|
|
125
|
+
emptyAlign = 0;
|
|
126
|
+
const opts = { zone: new window.luxon.IANAZone('UTC') };
|
|
127
|
+
// NaN values are serialized to -9223372036854776 by Bokeh
|
|
128
|
+
if (String(a) == '-9223372036854776') {
|
|
129
|
+
a = window.luxon.DateTime.fromISO('invalid');
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
a = window.luxon.DateTime.fromMillis(a, opts);
|
|
133
|
+
}
|
|
134
|
+
if (String(b) == '-9223372036854776') {
|
|
135
|
+
b = window.luxon.DateTime.fromISO('invalid');
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
b = window.luxon.DateTime.fromMillis(b, opts);
|
|
139
|
+
}
|
|
140
|
+
if (!a.isValid) {
|
|
141
|
+
emptyAlign = !b.isValid ? 0 : -1;
|
|
142
|
+
}
|
|
143
|
+
else if (!b.isValid) {
|
|
144
|
+
emptyAlign = 1;
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
//compare valid values
|
|
148
|
+
return a - b;
|
|
149
|
+
}
|
|
150
|
+
// Invalid (e.g. NaN) always at the bottom
|
|
151
|
+
emptyAlign *= -1;
|
|
152
|
+
return emptyAlign;
|
|
153
|
+
};
|
|
115
154
|
const dateEditor = function (cell, onRendered, success, cancel) {
|
|
116
155
|
//cell - the cell component for the editable cell
|
|
117
156
|
//onRendered - function to call when the editor has been rendered
|
|
@@ -204,6 +243,7 @@ export class DataTabulatorView extends PanelHTMLBoxView {
|
|
|
204
243
|
this._selection_updating = false;
|
|
205
244
|
this._lastVerticalScrollbarTopPosition = 0;
|
|
206
245
|
this._applied_styles = false;
|
|
246
|
+
this._building = false;
|
|
207
247
|
}
|
|
208
248
|
connect_signals() {
|
|
209
249
|
super.connect_signals();
|
|
@@ -217,10 +257,20 @@ export class DataTabulatorView extends PanelHTMLBoxView {
|
|
|
217
257
|
});
|
|
218
258
|
this.connect(p.children.change, () => this.renderChildren());
|
|
219
259
|
this.connect(p.expanded.change, () => {
|
|
260
|
+
// The first cell is the cell of the frozen _index column.
|
|
220
261
|
for (const row of this.tabulator.rowManager.getRows()) {
|
|
221
262
|
if (row.cells.length > 0)
|
|
222
263
|
row.cells[0].layoutElement();
|
|
223
264
|
}
|
|
265
|
+
// Make sure the expand icon is changed when expanded is
|
|
266
|
+
// changed from Python.
|
|
267
|
+
for (const row of this.tabulator.rowManager.getRows()) {
|
|
268
|
+
if (row.cells.length > 0) {
|
|
269
|
+
const index = row.data._index;
|
|
270
|
+
const icon = this.model.expanded.indexOf(index) < 0 ? "►" : "▼";
|
|
271
|
+
row.cells[1].element.innerText = icon;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
224
274
|
});
|
|
225
275
|
this.connect(p.styles.change, () => {
|
|
226
276
|
if (this._applied_styles)
|
|
@@ -265,20 +315,16 @@ export class DataTabulatorView extends PanelHTMLBoxView {
|
|
|
265
315
|
this.render();
|
|
266
316
|
this.relayout();
|
|
267
317
|
}
|
|
268
|
-
renderComplete() {
|
|
269
|
-
// Only have to set up styles after initial render subsequent
|
|
270
|
-
// styling is handled by change event on styles property
|
|
271
|
-
if (this._initializing) {
|
|
272
|
-
this.setSelection();
|
|
273
|
-
this.relayout();
|
|
274
|
-
this._initializing = false;
|
|
275
|
-
if (this._lastVerticalScrollbarTopPosition)
|
|
276
|
-
this.tabulator.rowManager.element.scrollTop = this._lastVerticalScrollbarTopPosition;
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
318
|
redraw() {
|
|
280
|
-
this.
|
|
281
|
-
|
|
319
|
+
if (!this._building) {
|
|
320
|
+
if (this.tabulator.columnManager.element != null) {
|
|
321
|
+
this.tabulator.columnManager.redraw(true);
|
|
322
|
+
}
|
|
323
|
+
if (this.tabulator.rowManager.renderer != null) {
|
|
324
|
+
this.tabulator.rowManager.redraw(true);
|
|
325
|
+
this.setStyles();
|
|
326
|
+
}
|
|
327
|
+
}
|
|
282
328
|
}
|
|
283
329
|
after_layout() {
|
|
284
330
|
super.after_layout();
|
|
@@ -295,113 +341,96 @@ export class DataTabulatorView extends PanelHTMLBoxView {
|
|
|
295
341
|
set_size(container, this.model);
|
|
296
342
|
let configuration = this.getConfiguration();
|
|
297
343
|
this.tabulator = new Tabulator(container, configuration);
|
|
344
|
+
this.init_callbacks();
|
|
298
345
|
this.renderChildren(true);
|
|
299
|
-
// Swap pagination mode
|
|
300
|
-
if (this.model.pagination === 'remote') {
|
|
301
|
-
this.tabulator.options.pagination = this.model.pagination;
|
|
302
|
-
this.tabulator.modules.page.mode = 'remote';
|
|
303
|
-
}
|
|
304
|
-
this.setGroupBy();
|
|
305
346
|
this.setHidden();
|
|
306
|
-
// Set up page
|
|
307
|
-
if (this.model.pagination) {
|
|
308
|
-
this.setMaxPage();
|
|
309
|
-
this.tabulator.setPage(this.model.page);
|
|
310
|
-
this.setData();
|
|
311
|
-
}
|
|
312
|
-
else
|
|
313
|
-
this.setFrozen();
|
|
314
347
|
this.el.appendChild(container);
|
|
315
348
|
}
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
// Initialization
|
|
319
|
-
this.tabulator.on("tableBuilding", () => this.tableInit())
|
|
320
|
-
this.tabulator.on("tableBuilt", () => this.tableBuilt())
|
|
321
|
-
|
|
322
|
-
// For disabled pagination initialize on renderComplete
|
|
323
|
-
if (this.model.pagination !== 'remote') {
|
|
324
|
-
this.tabulator.on("renderComplete", () => {
|
|
325
|
-
this.tabulator.off("renderComplete")
|
|
326
|
-
// Apply styles after first render then unsubscribe
|
|
327
|
-
this.setFrozen()
|
|
328
|
-
this.setStyles()
|
|
329
|
-
this.renderChildren()
|
|
330
|
-
this.tabulator.modules.frozenColumns.active = true
|
|
331
|
-
this.tabulator.modules.frozenColumns.layout()
|
|
332
|
-
this.relayout()
|
|
333
|
-
this._initializing = false
|
|
334
|
-
})
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
// Disable frozenColumns during rendering (see https://github.com/olifolkerd/tabulator/issues/3530)
|
|
338
|
-
this.tabulator.on("dataLoading", () => {
|
|
339
|
-
this.tabulator.modules.frozenColumns.active = false
|
|
340
|
-
})
|
|
341
|
-
|
|
342
|
-
// Rendering callbacks
|
|
343
|
-
this.tabulator.on("selectableCheck", (row: any) => {
|
|
344
|
-
const selectable = this.model.selectable_rows
|
|
345
|
-
return (selectable == null) || (selectable.indexOf(row._row.data._index) >= 0)
|
|
346
|
-
})
|
|
347
|
-
this.tabulator.on("tooltips", (cell: any) => {
|
|
348
|
-
return cell.getColumn().getField() + ": " + cell.getValue();
|
|
349
|
-
})
|
|
350
|
-
this.tabulator.on("scrollVertical", debounce(() => {
|
|
351
|
-
this.setStyles()
|
|
352
|
-
}, 50, false))
|
|
353
|
-
this.tabulator.on("rowFormatter", (row: any) => this._render_row(row))
|
|
354
|
-
|
|
355
|
-
// Sync state with model
|
|
356
|
-
this.tabulator.on("rowSelectionChanged", (data: any, rows: any) => this.rowSelectionChanged(data, rows))
|
|
357
|
-
this.tabulator.on("rowClick", (e: any, row: any) => this.rowClicked(e, row))
|
|
358
|
-
this.tabulator.on("cellEdited", (cell: any) => this.cellEdited(cell))
|
|
359
|
-
this.tabulator.on("dataFiltering", () => {
|
|
360
|
-
this.model.filters = this.tabulator.getHeaderFilters()
|
|
361
|
-
})
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
tableInit(): void {
|
|
365
|
-
// Patch the ajax request and page data parsing methods
|
|
366
|
-
const ajax = this.tabulator.modules.ajax
|
|
367
|
-
ajax.sendRequest = () => {
|
|
368
|
-
return this.requestPage(ajax.params.page, ajax.params.sort)
|
|
369
|
-
}
|
|
370
|
-
this.tabulator.modules.page._parseRemoteData = (): boolean => {
|
|
371
|
-
return false
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
tableBuilt(): void {
|
|
377
|
-
this.setHidden()
|
|
378
|
-
this.setSelection()
|
|
379
|
-
|
|
380
|
-
// For remote pagination initialize on tableBuilt
|
|
381
|
-
if (this.model.pagination) {
|
|
382
|
-
this.setMaxPage()
|
|
383
|
-
this.tabulator.setPage(this.model.page)
|
|
384
|
-
this.setStyles()
|
|
385
|
-
this.renderChildren()
|
|
386
|
-
this.tabulator.modules.frozenColumns.active = true
|
|
387
|
-
this.tabulator.modules.frozenColumns.layout()
|
|
388
|
-
setTimeout(() => this.relayout(), 10)
|
|
389
|
-
this._initializing = false
|
|
390
|
-
}
|
|
391
|
-
}*/
|
|
392
|
-
tableInit(view, tabulator) {
|
|
349
|
+
tableInit() {
|
|
350
|
+
this._building = true;
|
|
393
351
|
// Patch the ajax request and page data parsing methods
|
|
394
|
-
const ajax = tabulator.modules.ajax;
|
|
395
|
-
ajax.sendRequest = () => {
|
|
396
|
-
return
|
|
352
|
+
const ajax = this.tabulator.modules.ajax;
|
|
353
|
+
ajax.sendRequest = (_url, params, _config) => {
|
|
354
|
+
return this.requestPage(params.page, params.sort);
|
|
355
|
+
};
|
|
356
|
+
this.tabulator.modules.page._parseRemoteData = () => {
|
|
357
|
+
return false;
|
|
397
358
|
};
|
|
398
|
-
|
|
359
|
+
}
|
|
360
|
+
init_callbacks() {
|
|
361
|
+
// Initialization
|
|
362
|
+
this.tabulator.on("tableBuilding", () => this.tableInit());
|
|
363
|
+
this.tabulator.on("tableBuilt", () => this.tableBuilt());
|
|
364
|
+
// Disable frozenColumns during rendering (see https://github.com/olifolkerd/tabulator/issues/3530)
|
|
365
|
+
this.tabulator.on("dataLoading", () => {
|
|
366
|
+
this.tabulator.modules.frozenColumns.active = false;
|
|
367
|
+
});
|
|
368
|
+
// Rendering callbacks
|
|
369
|
+
this.tabulator.on("selectableCheck", (row) => {
|
|
370
|
+
const selectable = this.model.selectable_rows;
|
|
371
|
+
return (selectable == null) || (selectable.indexOf(row._row.data._index) >= 0);
|
|
372
|
+
});
|
|
373
|
+
this.tabulator.on("tooltips", (cell) => {
|
|
374
|
+
return cell.getColumn().getField() + ": " + cell.getValue();
|
|
375
|
+
});
|
|
376
|
+
this.tabulator.on("scrollVertical", debounce(() => {
|
|
377
|
+
this.setStyles();
|
|
378
|
+
}, 50, false));
|
|
379
|
+
this.tabulator.on("rowFormatter", (row) => this._render_row(row));
|
|
380
|
+
// Sync state with model
|
|
381
|
+
this.tabulator.on("rowSelectionChanged", (data, rows) => this.rowSelectionChanged(data, rows));
|
|
382
|
+
this.tabulator.on("rowClick", (e, row) => this.rowClicked(e, row));
|
|
383
|
+
this.tabulator.on("cellEdited", (cell) => this.cellEdited(cell));
|
|
384
|
+
this.tabulator.on("dataFiltering", (filters) => {
|
|
385
|
+
this.model.filters = filters;
|
|
386
|
+
});
|
|
387
|
+
this.tabulator.on("dataFiltered", (_, rows) => {
|
|
388
|
+
if (this._initializing)
|
|
389
|
+
return;
|
|
390
|
+
// Ensure that after filtering empty scroll renders
|
|
391
|
+
if (rows.length === 0)
|
|
392
|
+
this.tabulator.rowManager.renderEmptyScroll();
|
|
393
|
+
// Ensure that after filtering the page is updated
|
|
394
|
+
this.updatePage(this.tabulator.getPage());
|
|
395
|
+
});
|
|
396
|
+
this.tabulator.on("pageLoaded", (pageno) => {
|
|
397
|
+
this.updatePage(pageno);
|
|
398
|
+
});
|
|
399
|
+
this.tabulator.on("dataSorting", (sorters) => {
|
|
400
|
+
const sorts = [];
|
|
401
|
+
for (const s of sorters) {
|
|
402
|
+
if (s.field !== '_index')
|
|
403
|
+
sorts.push({ field: s.field, dir: s.dir });
|
|
404
|
+
}
|
|
405
|
+
if (this.model.pagination !== 'remote') {
|
|
406
|
+
this._updating_sort = true;
|
|
407
|
+
this.model.sorters = sorts;
|
|
408
|
+
this._updating_sort = false;
|
|
409
|
+
}
|
|
410
|
+
});
|
|
411
|
+
}
|
|
412
|
+
tableBuilt() {
|
|
413
|
+
this._building = false;
|
|
414
|
+
this.setHidden();
|
|
415
|
+
this.setSelection();
|
|
416
|
+
// For remote pagination initialize on tableBuilt
|
|
417
|
+
this.setMaxPage();
|
|
418
|
+
this.tabulator.setPage(this.model.page);
|
|
419
|
+
this.setStyles();
|
|
420
|
+
this.renderChildren();
|
|
421
|
+
this.setGroupBy();
|
|
422
|
+
this.setFrozen();
|
|
423
|
+
this.tabulator.modules.frozenColumns.active = true;
|
|
424
|
+
this.tabulator.modules.frozenColumns.layout();
|
|
425
|
+
this._initializing = false;
|
|
399
426
|
}
|
|
400
427
|
relayout() {
|
|
401
428
|
if (this._relayouting)
|
|
402
429
|
return;
|
|
403
430
|
this._relayouting = true;
|
|
404
|
-
this.tabulator.rowManager.
|
|
431
|
+
if (this.tabulator.rowManager.renderer) {
|
|
432
|
+
this.tabulator.rowManager.adjustTableSize();
|
|
433
|
+
}
|
|
405
434
|
this.update_layout();
|
|
406
435
|
this.compute_layout();
|
|
407
436
|
if (this.root !== this) {
|
|
@@ -463,7 +492,6 @@ export class DataTabulatorView extends PanelHTMLBoxView {
|
|
|
463
492
|
getConfiguration() {
|
|
464
493
|
// Only use selectable mode if explicitly requested otherwise manually handle selections
|
|
465
494
|
let selectable = this.model.select_mode === 'toggle' ? true : NaN;
|
|
466
|
-
const that = this;
|
|
467
495
|
let configuration = {
|
|
468
496
|
...this.model.configuration,
|
|
469
497
|
index: "_index",
|
|
@@ -471,48 +499,16 @@ export class DataTabulatorView extends PanelHTMLBoxView {
|
|
|
471
499
|
movableColumns: false,
|
|
472
500
|
selectable: selectable,
|
|
473
501
|
columns: this.getColumns(),
|
|
474
|
-
dataSorting: (sorters) => {
|
|
475
|
-
const sorts = [];
|
|
476
|
-
for (const s of sorters) {
|
|
477
|
-
if (s.field !== '_index')
|
|
478
|
-
sorts.push({ field: s.field, dir: s.dir });
|
|
479
|
-
}
|
|
480
|
-
if (this.model.pagination !== 'remote') {
|
|
481
|
-
this._updating_sort = true;
|
|
482
|
-
this.model.sorters = sorts;
|
|
483
|
-
this._updating_sort = false;
|
|
484
|
-
}
|
|
485
|
-
},
|
|
486
502
|
initialSort: this.sorters,
|
|
487
503
|
layout: this.getLayout(),
|
|
488
|
-
pagination: this.model.pagination,
|
|
504
|
+
pagination: this.model.pagination != null,
|
|
505
|
+
paginationMode: this.model.pagination,
|
|
489
506
|
paginationSize: this.model.page_size,
|
|
490
|
-
paginationInitialPage: 1
|
|
491
|
-
tableBuilding: function () { that.tableInit(that, this); },
|
|
492
|
-
renderComplete: () => this.renderComplete(),
|
|
493
|
-
rowSelectionChanged: (data, rows) => this.rowSelectionChanged(data, rows),
|
|
494
|
-
rowClick: (e, row) => this.rowClicked(e, row),
|
|
495
|
-
cellEdited: (cell) => this.cellEdited(cell),
|
|
496
|
-
selectableCheck: (row) => {
|
|
497
|
-
const selectable = this.model.selectable_rows;
|
|
498
|
-
return (selectable == null) || (selectable.indexOf(row._row.data._index) >= 0);
|
|
499
|
-
},
|
|
500
|
-
tooltips: (cell) => {
|
|
501
|
-
return cell.getColumn().getField() + ": " + cell.getValue();
|
|
502
|
-
},
|
|
503
|
-
scrollVertical: debounce(() => {
|
|
504
|
-
this._lastVerticalScrollbarTopPosition = this.tabulator.rowManager.element.scrollTop;
|
|
505
|
-
this.setStyles();
|
|
506
|
-
}, 50, false),
|
|
507
|
-
rowFormatter: (row) => this._render_row(row),
|
|
508
|
-
dataFiltering: () => {
|
|
509
|
-
if (this.tabulator != null)
|
|
510
|
-
this.model.filters = this.tabulator.getHeaderFilters();
|
|
511
|
-
}
|
|
507
|
+
paginationInitialPage: 1
|
|
512
508
|
};
|
|
513
509
|
if (this.model.pagination === "remote") {
|
|
514
510
|
configuration['ajaxURL'] = "http://panel.pyviz.org";
|
|
515
|
-
configuration['
|
|
511
|
+
configuration['sortMode'] = "remote";
|
|
516
512
|
}
|
|
517
513
|
const cds = this.model.source;
|
|
518
514
|
let data;
|
|
@@ -574,7 +570,7 @@ export class DataTabulatorView extends PanelHTMLBoxView {
|
|
|
574
570
|
}
|
|
575
571
|
_expand_render(cell) {
|
|
576
572
|
const index = cell._cell.row.data._index;
|
|
577
|
-
const icon = this.model.expanded.indexOf(index) < 0 ? "
|
|
573
|
+
const icon = this.model.expanded.indexOf(index) < 0 ? "►" : "▼";
|
|
578
574
|
return "<i>" + icon + "</i>";
|
|
579
575
|
}
|
|
580
576
|
_update_expand(cell) {
|
|
@@ -593,8 +589,6 @@ export class DataTabulatorView extends PanelHTMLBoxView {
|
|
|
593
589
|
}
|
|
594
590
|
}
|
|
595
591
|
this.model.expanded = expanded;
|
|
596
|
-
const icon = expanded.indexOf(index) < 0 ? "\u25ba" : "\u25bc";
|
|
597
|
-
cell._cell.element.innerText = icon;
|
|
598
592
|
if (expanded.indexOf(index) < 0)
|
|
599
593
|
return;
|
|
600
594
|
let ready = true;
|
|
@@ -690,6 +684,9 @@ export class DataTabulatorView extends PanelHTMLBoxView {
|
|
|
690
684
|
};
|
|
691
685
|
}
|
|
692
686
|
}
|
|
687
|
+
if (tab_column.sorter == 'timestamp') {
|
|
688
|
+
tab_column.sorter = timestampSorter;
|
|
689
|
+
}
|
|
693
690
|
const editor = column.editor;
|
|
694
691
|
const ctype = editor.type;
|
|
695
692
|
if (tab_column.editor != null) {
|
|
@@ -702,8 +699,8 @@ export class DataTabulatorView extends PanelHTMLBoxView {
|
|
|
702
699
|
}
|
|
703
700
|
else if (ctype === "StringEditor") {
|
|
704
701
|
if (editor.completions.length > 0) {
|
|
705
|
-
tab_column.editor = "
|
|
706
|
-
tab_column.editorParams = { values: editor.completions };
|
|
702
|
+
tab_column.editor = "list";
|
|
703
|
+
tab_column.editorParams = { values: editor.completions, autocomplete: true, listOnEmpty: true };
|
|
707
704
|
}
|
|
708
705
|
else
|
|
709
706
|
tab_column.editor = "input";
|
|
@@ -721,7 +718,7 @@ export class DataTabulatorView extends PanelHTMLBoxView {
|
|
|
721
718
|
tab_column.editor = dateEditor;
|
|
722
719
|
}
|
|
723
720
|
else if (ctype === "SelectEditor") {
|
|
724
|
-
tab_column.editor = "
|
|
721
|
+
tab_column.editor = "list";
|
|
725
722
|
tab_column.editorParams = { values: editor.options };
|
|
726
723
|
}
|
|
727
724
|
else if (editor != null && editor.default_view != null) {
|
|
@@ -742,7 +739,7 @@ export class DataTabulatorView extends PanelHTMLBoxView {
|
|
|
742
739
|
tab_column.headerSortStartingDir = sort.dir;
|
|
743
740
|
}
|
|
744
741
|
tab_column.cellClick = (_, cell) => {
|
|
745
|
-
const index = cell.
|
|
742
|
+
const index = cell.getData()._index;
|
|
746
743
|
this.model.trigger_event(new CellClickEvent(column.field, index));
|
|
747
744
|
};
|
|
748
745
|
if (config_columns == null)
|
|
@@ -756,7 +753,7 @@ export class DataTabulatorView extends PanelHTMLBoxView {
|
|
|
756
753
|
formatter: button_formatter,
|
|
757
754
|
hozAlign: "center",
|
|
758
755
|
cellClick: (_, cell) => {
|
|
759
|
-
const index = cell.
|
|
756
|
+
const index = cell.getData()._index;
|
|
760
757
|
this.model.trigger_event(new CellClickEvent(col, index));
|
|
761
758
|
}
|
|
762
759
|
};
|
|
@@ -823,6 +820,13 @@ export class DataTabulatorView extends PanelHTMLBoxView {
|
|
|
823
820
|
for (const row of this.model.frozen_rows)
|
|
824
821
|
this.tabulator.getRow(row).freeze();
|
|
825
822
|
}
|
|
823
|
+
updatePage(pageno) {
|
|
824
|
+
if (this.model.pagination === 'local' && this.model.page !== pageno) {
|
|
825
|
+
this._updating_page = true;
|
|
826
|
+
this.model.page = pageno;
|
|
827
|
+
this._updating_page = false;
|
|
828
|
+
}
|
|
829
|
+
}
|
|
826
830
|
setGroupBy() {
|
|
827
831
|
if (this.model.groupby.length == 0) {
|
|
828
832
|
this.tabulator.setGroupBy(false);
|
|
@@ -836,6 +840,8 @@ export class DataTabulatorView extends PanelHTMLBoxView {
|
|
|
836
840
|
}
|
|
837
841
|
return groups.join(', ');
|
|
838
842
|
};
|
|
843
|
+
// Need to call it twice, see https://github.com/olifolkerd/tabulator/issues/3666
|
|
844
|
+
this.tabulator.setGroupBy(groupby);
|
|
839
845
|
this.tabulator.setGroupBy(groupby);
|
|
840
846
|
}
|
|
841
847
|
setSorters() {
|
|
@@ -845,10 +851,22 @@ export class DataTabulatorView extends PanelHTMLBoxView {
|
|
|
845
851
|
}
|
|
846
852
|
setCSS() {
|
|
847
853
|
let theme;
|
|
848
|
-
|
|
854
|
+
let theme_;
|
|
855
|
+
if (this.model.theme == "default") {
|
|
849
856
|
theme = "tabulator";
|
|
850
|
-
|
|
851
|
-
|
|
857
|
+
}
|
|
858
|
+
else {
|
|
859
|
+
if (this.model.theme == "bootstrap") {
|
|
860
|
+
theme_ = "bootstrap3";
|
|
861
|
+
}
|
|
862
|
+
else if (this.model.theme == "semantic-ui") {
|
|
863
|
+
theme_ = "semanticui";
|
|
864
|
+
}
|
|
865
|
+
else {
|
|
866
|
+
theme_ = this.model.theme;
|
|
867
|
+
}
|
|
868
|
+
theme = "tabulator_" + theme_;
|
|
869
|
+
}
|
|
852
870
|
const css = this.model.theme_url + theme + ".min.css";
|
|
853
871
|
let old_node = null;
|
|
854
872
|
const links = document.getElementsByTagName("link");
|
|
@@ -876,8 +894,10 @@ export class DataTabulatorView extends PanelHTMLBoxView {
|
|
|
876
894
|
css_node.media = 'screen';
|
|
877
895
|
css_node.href = css;
|
|
878
896
|
css_node.onload = () => {
|
|
879
|
-
this.
|
|
880
|
-
|
|
897
|
+
if (!this._building) {
|
|
898
|
+
this.render();
|
|
899
|
+
this.relayout();
|
|
900
|
+
}
|
|
881
901
|
};
|
|
882
902
|
parent_node.appendChild(css_node);
|
|
883
903
|
return true;
|
|
@@ -1017,7 +1037,7 @@ export class DataTabulatorView extends PanelHTMLBoxView {
|
|
|
1017
1037
|
}
|
|
1018
1038
|
cellEdited(cell) {
|
|
1019
1039
|
const field = cell._cell.column.field;
|
|
1020
|
-
const index = cell.
|
|
1040
|
+
const index = cell.getData()._index;
|
|
1021
1041
|
const value = cell._cell.value;
|
|
1022
1042
|
this._tabulator_cell_updating = true;
|
|
1023
1043
|
comm_settings.debounce = false;
|
|
@@ -1029,7 +1049,6 @@ export class DataTabulatorView extends PanelHTMLBoxView {
|
|
|
1029
1049
|
this._tabulator_cell_updating = false;
|
|
1030
1050
|
}
|
|
1031
1051
|
this.model.trigger_event(new TableEditEvent(field, index));
|
|
1032
|
-
this.setSorters();
|
|
1033
1052
|
this.tabulator.scrollToRow(index, "top", false);
|
|
1034
1053
|
}
|
|
1035
1054
|
}
|
|
@@ -1069,7 +1088,7 @@ export class DataTabulator extends HTMLBox {
|
|
|
1069
1088
|
sorters: [Array(Any), []],
|
|
1070
1089
|
styles: [Any, {}],
|
|
1071
1090
|
theme: [String, "simple"],
|
|
1072
|
-
theme_url: [String, "https://unpkg.com/tabulator-tables@
|
|
1091
|
+
theme_url: [String, "https://unpkg.com/tabulator-tables@5.3.2/dist/css/"]
|
|
1073
1092
|
}));
|
|
1074
1093
|
}
|
|
1075
1094
|
}
|