Skip to content

Commit

Permalink
build
Browse files Browse the repository at this point in the history
  • Loading branch information
williamorim committed Jul 25, 2024
1 parent 4c9cb65 commit 8019534
Show file tree
Hide file tree
Showing 67 changed files with 10,184 additions and 3,187 deletions.
598 changes: 464 additions & 134 deletions docs/add-interatividade.html

Large diffs are not rendered by default.

578 changes: 455 additions & 123 deletions docs/debug.html

Large diffs are not rendered by default.

602 changes: 467 additions & 135 deletions docs/deploy.html

Large diffs are not rendered by default.

612 changes: 472 additions & 140 deletions docs/golem.html

Large diffs are not rendered by default.

814 changes: 573 additions & 241 deletions docs/html-css-js.html

Large diffs are not rendered by default.

695 changes: 510 additions & 185 deletions docs/htmlwidgets.html

Large diffs are not rendered by default.

528 changes: 446 additions & 82 deletions docs/index.html

Large diffs are not rendered by default.

705 changes: 517 additions & 188 deletions docs/layouts.html

Large diffs are not rendered by default.

582 changes: 457 additions & 125 deletions docs/modulos.html

Large diffs are not rendered by default.

596 changes: 464 additions & 132 deletions docs/primeiro-app.html

Large diffs are not rendered by default.

604 changes: 468 additions & 136 deletions docs/reatividade-conceitos.html

Large diffs are not rendered by default.

588 changes: 460 additions & 128 deletions docs/reatividade-mais-pecas.html

Large diffs are not rendered by default.

531 changes: 446 additions & 85 deletions docs/reatividade-problemas-complexos.html

Large diffs are not rendered by default.

526 changes: 445 additions & 81 deletions docs/referencias.html

Large diffs are not rendered by default.

663 changes: 574 additions & 89 deletions docs/search.json

Large diffs are not rendered by default.

591 changes: 463 additions & 128 deletions docs/shiny-na-pratica-1.html

Large diffs are not rendered by default.

598 changes: 473 additions & 125 deletions docs/shiny-na-pratica-2.html

Large diffs are not rendered by default.

12 changes: 7 additions & 5 deletions docs/site_libs/bootstrap/bootstrap-dark.min.css

Large diffs are not rendered by default.

406 changes: 390 additions & 16 deletions docs/site_libs/bootstrap/bootstrap-icons.css

Large diffs are not rendered by default.

Binary file modified docs/site_libs/bootstrap/bootstrap-icons.woff
Binary file not shown.
12 changes: 7 additions & 5 deletions docs/site_libs/bootstrap/bootstrap.min.css

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions docs/site_libs/bootstrap/bootstrap.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/site_libs/clipboard/clipboard.min.js

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// some helper functions: using a global object DTWidget so that it can be used
// in JS() code, e.g. datatable(options = list(foo = JS('code'))); unlike R's
// dynamic scoping, when 'code' is eval()'ed, JavaScript does not know objects
// dynamic scoping, when 'code' is eval'ed, JavaScript does not know objects
// from the "parent frame", e.g. JS('DTWidget') will not work unless it was made
// a global object
var DTWidget = {};
Expand Down Expand Up @@ -348,6 +348,15 @@ HTMLWidgets.widget({
var table = $table.DataTable(options);
$el.data('datatable', table);

if ('rowGroup' in options) {
// Maintain RowGroup dataSrc when columns are reordered (#1109)
table.on('column-reorder', function(e, settings, details) {
var oldDataSrc = table.rowGroup().dataSrc();
var newDataSrc = details.mapping[oldDataSrc];
table.rowGroup().dataSrc(newDataSrc);
});
}

// Unregister previous Crosstalk event subscriptions, if they exist
if (instance.ctfilterSubscription) {
instance.ctfilterHandle.off("change", instance.ctfilterSubscription);
Expand Down Expand Up @@ -432,10 +441,13 @@ HTMLWidgets.widget({
regex = options.search.regex,
ci = options.search.caseInsensitive !== false;
}
// need to transpose the column index when colReorder is enabled
if (table.colReorder) i = table.colReorder.transpose(i);
return table.column(i).search(value, regex, !regex, ci);
};

if (data.filter !== 'none') {
if (!data.hasOwnProperty('filterSettings')) data.filterSettings = {};

filterRow.each(function(i, td) {

Expand Down Expand Up @@ -493,11 +505,13 @@ HTMLWidgets.widget({
$input.parent().hide(); $x.show().trigger('show'); filter[0].selectize.focus();
},
input: function() {
if ($input.val() === '') filter[0].selectize.setValue([]);
var v1 = JSON.stringify(filter[0].selectize.getValue()), v2 = $input.val();
if (v1 === '[]') v1 = '';
if (v1 !== v2) filter[0].selectize.setValue(v2 === '' ? [] : JSON.parse(v2));
}
});
var $input2 = $x.children('select');
filter = $input2.selectize({
filter = $input2.selectize($.extend({
options: $input2.data('options').map(function(v, i) {
return ({text: v, value: v});
}),
Expand All @@ -509,15 +523,14 @@ HTMLWidgets.widget({
if (value.length) $input.trigger('input');
$input.attr('title', $input.val());
if (server) {
table.column(i).search(value.length ? JSON.stringify(value) : '').draw();
searchColumn(i, value.length ? JSON.stringify(value) : '').draw();
return;
}
// turn off filter if nothing selected
$td.data('filter', value.length > 0);
table.draw(); // redraw table, and filters will be applied
}
});
if (searchCol) filter[0].selectize.setValue(JSON.parse(searchCol));
}, data.filterSettings.select));
filter[0].selectize.on('blur', function() {
$x.hide().trigger('hide'); $input.parent().show(); $input.trigger('blur');
});
Expand All @@ -526,10 +539,12 @@ HTMLWidgets.widget({
var fun = function() {
searchColumn(i, $input.val()).draw();
};
if (server) {
fun = $.fn.dataTable.util.throttle(fun, options.searchDelay);
}
$input.on('input', fun);
// throttle searching for server-side processing
var throttledFun = $.fn.dataTable.util.throttle(fun, options.searchDelay);
$input.on('input', function(e, immediate) {
// always bypass throttling when immediate = true (via the updateSearch method)
(immediate || !server) ? fun() : throttledFun();
});
} else if (inArray(type, ['number', 'integer', 'date', 'time'])) {
var $x0 = $x;
$x = $x0.children('div').first();
Expand Down Expand Up @@ -615,13 +630,11 @@ HTMLWidgets.widget({
filter.val(v);
}
});
var formatDate = function(d, isoFmt) {
var formatDate = function(d) {
d = scaleBack(d, scale);
if (type === 'number') return d;
if (type === 'integer') return parseInt(d);
var x = new Date(+d);
var fmt = ('filterDateFmt' in data) ? data.filterDateFmt[i] : undefined;
if (fmt !== undefined && isoFmt === false) return x[fmt.method].apply(x, fmt.params);
if (type === 'date') {
var pad0 = function(x) {
return ('0' + x).substr(-2, 2);
Expand All @@ -642,7 +655,7 @@ HTMLWidgets.widget({
start: [r1, r2],
range: {min: r1, max: r2},
connect: true
}, opts));
}, opts, data.filterSettings.slider));
if (scale > 1) (function() {
var t1 = r1, t2 = r2;
var val = filter.val();
Expand All @@ -657,13 +670,28 @@ HTMLWidgets.widget({
start: [t1, t2],
range: {min: t1, max: t2},
connect: true
}, opts), true);
}, opts, data.filterSettings.slider), true);
val = filter.val();
}
r1 = t1; r2 = t2;
})();
// format with active column renderer, if defined
var colDef = data.options.columnDefs.find(function(def) {
return (def.targets === i || inArray(i, def.targets)) && 'render' in def;
});
var updateSliderText = function(v1, v2) {
$span1.text(formatDate(v1, false)); $span2.text(formatDate(v2, false));
// we only know how to use function renderers
if (colDef && typeof colDef.render === 'function') {
var restore = function(v) {
v = scaleBack(v, scale);
return inArray(type, ['date', 'time']) ? new Date(+v) : v;
}
$span1.text(colDef.render(restore(v1), 'display'));
$span2.text(colDef.render(restore(v2), 'display'));
} else {
$span1.text(formatDate(v1));
$span2.text(formatDate(v2));
}
};
updateSliderText(r1, r2);
var updateSlider = function(e) {
Expand All @@ -680,7 +708,7 @@ HTMLWidgets.widget({
updateSliderText(val[0], val[1]);
if (e.type === 'slide') return; // no searching when sliding only
if (server) {
table.column(i).search($td.data('filter') ? ival : '').draw();
searchColumn(i, $td.data('filter') ? ival : '').draw();
return;
}
table.draw();
Expand All @@ -696,7 +724,7 @@ HTMLWidgets.widget({
// processing
if (server) {
// if a search string has been pre-set, search now
if (searchCol) searchColumn(i, searchCol).draw();
if (searchCol) $input.trigger('input').trigger('change');
return;
}

Expand Down Expand Up @@ -742,15 +770,7 @@ HTMLWidgets.widget({
$.fn.dataTable.ext.search.push(customFilter);

// search for the preset search strings if it is non-empty
if (searchCol) {
if (inArray(type, ['factor', 'logical'])) {
filter[0].selectize.setValue(JSON.parse(searchCol));
} else if (type === 'character') {
$input.trigger('input');
} else if (inArray(type, ['number', 'integer', 'date', 'time'])) {
$input.trigger('change');
}
}
if (searchCol) $input.trigger('input').trigger('change');

});

Expand Down Expand Up @@ -823,6 +843,7 @@ HTMLWidgets.widget({
var disableCols = data.editable.disable ? data.editable.disable.columns : null;
var numericCols = data.editable.numeric;
var areaCols = data.editable.area;
var dateCols = data.editable.date;
for (var i = 0; i < target.length; i++) {
(function(cell, current) {
var $cell = $(cell), html = $cell.html();
Expand All @@ -832,6 +853,8 @@ HTMLWidgets.widget({
$input = $('<input type="number">');
} else if (inArray(index, areaCols)) {
$input = $('<textarea></textarea>');
} else if (inArray(index, dateCols)) {
$input = $('<input type="date">');
} else {
$input = $('<input type="text">');
}
Expand All @@ -849,7 +872,7 @@ HTMLWidgets.widget({

if (immediate) $input.on('blur', function(e) {
var valueNew = $input.val();
if (valueNew != value) {
if (valueNew !== value) {
_cell.data(valueNew);
if (HTMLWidgets.shinyMode) {
changeInput('cell_edit', [cellInfo(cell)], 'DT.cellInfo', null, {priority: 'event'});
Expand Down Expand Up @@ -1009,6 +1032,9 @@ HTMLWidgets.widget({
updateColsSelected();
updateCellsSelected();
})
updateRowsSelected();
updateColsSelected();
updateCellsSelected();
}

var selMode = data.selection.mode, selTarget = data.selection.target;
Expand Down Expand Up @@ -1367,7 +1393,7 @@ HTMLWidgets.widget({
changeInput('cell_clicked', {});

// do not trigger table selection when clicking on links unless they have classes
table.on('click.dt', 'tbody td a', function(e) {
table.on('mousedown.dt', 'tbody td a', function(e) {
if (this.className === '') e.stopPropagation();
});

Expand Down Expand Up @@ -1395,8 +1421,9 @@ HTMLWidgets.widget({
console.log('The search keyword for column ' + i + ' is undefined')
return;
}
$(td).find('input').first().val(v);
searchColumn(i, v);
// Update column search string and values on linked filter widgets.
// 'input' for factor and char filters, 'change' for numeric filters.
$(td).find('input').first().val(v).trigger('input', [true]).trigger('change');
});
table.draw();
}
Expand Down
9 changes: 9 additions & 0 deletions docs/site_libs/datatables-css-0.0.0/datatables-crosstalk.css
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,12 @@ See https://github.com/DataTables/DataTablesSrc/issues/160
table.dataTable {
display: table;
}


/*
When DTOutput(fill = TRUE), it receives a .html-fill-item class (via htmltools::bindFillRole()), which effectively amounts to `flex: 1 1 auto`. That's mostly fine, but the case where `fillContainer=TRUE`+`height:auto`+`flex-basis:auto` and the container (e.g., a bslib::card()) doesn't have a defined height is a bit problematic since the table wants to fit the parent but the parent wants to fit the table, which results pretty small table height (maybe because there is a minimum height somewhere?). It seems better in this case to impose a 400px height default for the table, which we can do by setting `flex-basis` to 400px (the table is still allowed to grow/shrink when the container has an opinionated height).
*/

.html-fill-container > .html-fill-item.datatables {
flex-basis: 400px;
}

This file was deleted.

Loading

0 comments on commit 8019534

Please sign in to comment.