update plugin files

This commit is contained in:
REJack 2021-02-10 08:13:13 +01:00
parent c8fdba0831
commit 966a9b0178
16 changed files with 17016 additions and 2963 deletions

View file

@ -1,16 +1,16 @@
/*! FixedHeader 3.1.7 /*! FixedHeader 3.1.8
* ©2009-2020 SpryMedia Ltd - datatables.net/license * ©2009-2021 SpryMedia Ltd - datatables.net/license
*/ */
/** /**
* @summary FixedHeader * @summary FixedHeader
* @description Fix a table's header or footer, so it is always visible while * @description Fix a table's header or footer, so it is always visible while
* scrolling * scrolling
* @version 3.1.7 * @version 3.1.8
* @file dataTables.fixedHeader.js * @file dataTables.fixedHeader.js
* @author SpryMedia Ltd (www.sprymedia.co.uk) * @author SpryMedia Ltd (www.sprymedia.co.uk)
* @contact www.sprymedia.co.uk/contact * @contact www.sprymedia.co.uk/contact
* @copyright Copyright 2009-2020 SpryMedia Ltd. * @copyright Copyright 2009-2021 SpryMedia Ltd.
* *
* This source file is free software, available under the following license: * This source file is free software, available under the following license:
* MIT license - http://datatables.net/license/mit * MIT license - http://datatables.net/license/mit
@ -340,7 +340,7 @@ $.extend( FixedHeader.prototype, {
var get = function ( name ) { var get = function ( name ) {
return $(name, from) return $(name, from)
.map( function () { .map( function () {
return $(this).width(); return $(this).css('width').replace(/[^\d\.]/g, '') * 1;
} ).toArray(); } ).toArray();
}; };
@ -622,7 +622,7 @@ $.extend( FixedHeader.prototype, {
* @type {String} * @type {String}
* @static * @static
*/ */
FixedHeader.version = "3.1.7"; FixedHeader.version = "3.1.8";
/** /**
* Defaults * Defaults
@ -691,7 +691,7 @@ DataTable.Api.register( 'fixedHeader.enable()', function ( flag ) {
DataTable.Api.register( 'fixedHeader.enabled()', function () { DataTable.Api.register( 'fixedHeader.enabled()', function () {
if ( this.context.length ) { if ( this.context.length ) {
var fh = this.content[0]._fixedHeader; var fh = this.context[0]._fixedHeader;
if ( fh ) { if ( fh ) {
return fh.enabled(); return fh.enabled();

View file

@ -1,6 +1,6 @@
/*! /*!
FixedHeader 3.1.7 FixedHeader 3.1.8
©2009-2020 SpryMedia Ltd - datatables.net/license ©2009-2021 SpryMedia Ltd - datatables.net/license
*/ */
(function(d){"function"===typeof define&&define.amd?define(["jquery","datatables.net"],function(g){return d(g,window,document)}):"object"===typeof exports?module.exports=function(g,j){g||(g=window);if(!j||!j.fn.dataTable)j=require("datatables.net")(g,j).$;return d(j,g,g.document)}:d(jQuery,window,document)})(function(d,g,j,k){var i=d.fn.dataTable,l=0,h=function(a,b){if(!(this instanceof h))throw"FixedHeader must be initialised with the 'new' keyword.";!0===b&&(b={});a=new i.Api(a);this.c=d.extend(!0, (function(d){"function"===typeof define&&define.amd?define(["jquery","datatables.net"],function(g){return d(g,window,document)}):"object"===typeof exports?module.exports=function(g,j){g||(g=window);if(!j||!j.fn.dataTable)j=require("datatables.net")(g,j).$;return d(j,g,g.document)}:d(jQuery,window,document)})(function(d,g,j,k){var i=d.fn.dataTable,l=0,h=function(a,b){if(!(this instanceof h))throw"FixedHeader must be initialised with the 'new' keyword.";!0===b&&(b={});a=new i.Api(a);this.c=d.extend(!0,
{},h.defaults,b);this.s={dt:a,position:{theadTop:0,tbodyTop:0,tfootTop:0,tfootBottom:0,width:0,left:0,tfootHeight:0,theadHeight:0,windowHeight:d(g).height(),visible:!0},headerMode:null,footerMode:null,autoWidth:a.settings()[0].oFeatures.bAutoWidth,namespace:".dtfc"+l++,scrollLeft:{header:-1,footer:-1},enable:!0};this.dom={floatingHeader:null,thead:d(a.table().header()),tbody:d(a.table().body()),tfoot:d(a.table().footer()),header:{host:null,floating:null,placeholder:null},footer:{host:null,floating:null, {},h.defaults,b);this.s={dt:a,position:{theadTop:0,tbodyTop:0,tfootTop:0,tfootBottom:0,width:0,left:0,tfootHeight:0,theadHeight:0,windowHeight:d(g).height(),visible:!0},headerMode:null,footerMode:null,autoWidth:a.settings()[0].oFeatures.bAutoWidth,namespace:".dtfc"+l++,scrollLeft:{header:-1,footer:-1},enable:!0};this.dom={floatingHeader:null,thead:d(a.table().header()),tbody:d(a.table().body()),tfoot:d(a.table().footer()),header:{host:null,floating:null,placeholder:null},footer:{host:null,floating:null,
@ -8,12 +8,12 @@ placeholder:null}};this.dom.header.host=this.dom.thead.parent();this.dom.footer.
a;if(b||b===k)this._positions(),this._scroll(!0)},enabled:function(){return this.s.enable},headerOffset:function(a){a!==k&&(this.c.headerOffset=a,this.update());return this.c.headerOffset},footerOffset:function(a){a!==k&&(this.c.footerOffset=a,this.update());return this.c.footerOffset},update:function(){var a=this.s.dt.table().node();d(a).is(":visible")?this.enable(!0,!1):this.enable(!1,!1);this._positions();this._scroll(!0)},_constructor:function(){var a=this,b=this.s.dt;d(g).on("scroll"+this.s.namespace, a;if(b||b===k)this._positions(),this._scroll(!0)},enabled:function(){return this.s.enable},headerOffset:function(a){a!==k&&(this.c.headerOffset=a,this.update());return this.c.headerOffset},footerOffset:function(a){a!==k&&(this.c.footerOffset=a,this.update());return this.c.footerOffset},update:function(){var a=this.s.dt.table().node();d(a).is(":visible")?this.enable(!0,!1):this.enable(!1,!1);this._positions();this._scroll(!0)},_constructor:function(){var a=this,b=this.s.dt;d(g).on("scroll"+this.s.namespace,
function(){a._scroll()}).on("resize"+this.s.namespace,i.util.throttle(function(){a.s.position.windowHeight=d(g).height();a.update()},50));var e=d(".fh-fixedHeader");!this.c.headerOffset&&e.length&&(this.c.headerOffset=e.outerHeight());e=d(".fh-fixedFooter");!this.c.footerOffset&&e.length&&(this.c.footerOffset=e.outerHeight());b.on("column-reorder.dt.dtfc column-visibility.dt.dtfc draw.dt.dtfc column-sizing.dt.dtfc responsive-display.dt.dtfc",function(){a.update()});b.on("destroy.dtfc",function(){a.destroy()}); function(){a._scroll()}).on("resize"+this.s.namespace,i.util.throttle(function(){a.s.position.windowHeight=d(g).height();a.update()},50));var e=d(".fh-fixedHeader");!this.c.headerOffset&&e.length&&(this.c.headerOffset=e.outerHeight());e=d(".fh-fixedFooter");!this.c.footerOffset&&e.length&&(this.c.footerOffset=e.outerHeight());b.on("column-reorder.dt.dtfc column-visibility.dt.dtfc draw.dt.dtfc column-sizing.dt.dtfc responsive-display.dt.dtfc",function(){a.update()});b.on("destroy.dtfc",function(){a.destroy()});
this._positions();this._scroll()},_clone:function(a,b){var e=this.s.dt,c=this.dom[a],f="header"===a?this.dom.thead:this.dom.tfoot;!b&&c.floating?c.floating.removeClass("fixedHeader-floating fixedHeader-locked"):(c.floating&&(c.placeholder.remove(),this._unsize(a),c.floating.children().detach(),c.floating.remove()),c.floating=d(e.table().node().cloneNode(!1)).css("table-layout","fixed").attr("aria-hidden","true").removeAttr("id").append(f).appendTo("body"),c.placeholder=f.clone(!1),c.placeholder.find("*[id]").removeAttr("id"), this._positions();this._scroll()},_clone:function(a,b){var e=this.s.dt,c=this.dom[a],f="header"===a?this.dom.thead:this.dom.tfoot;!b&&c.floating?c.floating.removeClass("fixedHeader-floating fixedHeader-locked"):(c.floating&&(c.placeholder.remove(),this._unsize(a),c.floating.children().detach(),c.floating.remove()),c.floating=d(e.table().node().cloneNode(!1)).css("table-layout","fixed").attr("aria-hidden","true").removeAttr("id").append(f).appendTo("body"),c.placeholder=f.clone(!1),c.placeholder.find("*[id]").removeAttr("id"),
c.host.prepend(c.placeholder),this._matchWidths(c.placeholder,c.floating))},_matchWidths:function(a,b){var e=function(b){return d(b,a).map(function(){return d(this).width()}).toArray()},c=function(a,c){d(a,b).each(function(a){d(this).css({width:c[a],minWidth:c[a]})})},f=e("th"),e=e("td");c("th",f);c("td",e)},_unsize:function(a){var b=this.dom[a].floating;b&&("footer"===a||"header"===a&&!this.s.autoWidth)?d("th, td",b).css({width:"",minWidth:""}):b&&"header"===a&&d("th, td",b).css("min-width","")}, c.host.prepend(c.placeholder),this._matchWidths(c.placeholder,c.floating))},_matchWidths:function(a,b){var e=function(b){return d(b,a).map(function(){return 1*d(this).css("width").replace(/[^\d\.]/g,"")}).toArray()},c=function(a,c){d(a,b).each(function(a){d(this).css({width:c[a],minWidth:c[a]})})},f=e("th"),e=e("td");c("th",f);c("td",e)},_unsize:function(a){var b=this.dom[a].floating;b&&("footer"===a||"header"===a&&!this.s.autoWidth)?d("th, td",b).css({width:"",minWidth:""}):b&&"header"===a&&d("th, td",
_horizontal:function(a,b){var e=this.dom[a],c=this.s.position,d=this.s.scrollLeft;e.floating&&d[a]!==b&&(e.floating.css("left",c.left-b),d[a]=b)},_modeChange:function(a,b,e){var c=this.dom[b],f=this.s.position,g=function(a){c.floating.attr("style",function(b,c){return(c||"")+"width: "+a+"px !important;"})},i=this.dom["footer"===b?"tfoot":"thead"],h=d.contains(i[0],j.activeElement)?j.activeElement:null;h&&h.blur();if("in-place"===a){if(c.placeholder&&(c.placeholder.remove(),c.placeholder=null),this._unsize(b), b).css("min-width","")},_horizontal:function(a,b){var e=this.dom[a],c=this.s.position,d=this.s.scrollLeft;e.floating&&d[a]!==b&&(e.floating.css("left",c.left-b),d[a]=b)},_modeChange:function(a,b,e){var c=this.dom[b],f=this.s.position,g=function(a){c.floating.attr("style",function(b,c){return(c||"")+"width: "+a+"px !important;"})},i=this.dom["footer"===b?"tfoot":"thead"],h=d.contains(i[0],j.activeElement)?j.activeElement:null;h&&h.blur();if("in-place"===a){if(c.placeholder&&(c.placeholder.remove(),
"header"===b?c.host.prepend(i):c.host.append(i),c.floating)c.floating.remove(),c.floating=null}else"in"===a?(this._clone(b,e),c.floating.addClass("fixedHeader-floating").css("header"===b?"top":"bottom",this.c[b+"Offset"]).css("left",f.left+"px"),g(f.width),"footer"===b&&c.floating.css("top","")):"below"===a?(this._clone(b,e),c.floating.addClass("fixedHeader-locked").css("top",f.tfootTop-f.theadHeight).css("left",f.left+"px"),g(f.width)):"above"===a&&(this._clone(b,e),c.floating.addClass("fixedHeader-locked").css("top", c.placeholder=null),this._unsize(b),"header"===b?c.host.prepend(i):c.host.append(i),c.floating)c.floating.remove(),c.floating=null}else"in"===a?(this._clone(b,e),c.floating.addClass("fixedHeader-floating").css("header"===b?"top":"bottom",this.c[b+"Offset"]).css("left",f.left+"px"),g(f.width),"footer"===b&&c.floating.css("top","")):"below"===a?(this._clone(b,e),c.floating.addClass("fixedHeader-locked").css("top",f.tfootTop-f.theadHeight).css("left",f.left+"px"),g(f.width)):"above"===a&&(this._clone(b,
f.tbodyTop).css("left",f.left+"px"),g(f.width));h&&h!==j.activeElement&&setTimeout(function(){h.focus()},10);this.s.scrollLeft.header=-1;this.s.scrollLeft.footer=-1;this.s[b+"Mode"]=a},_positions:function(){var a=this.s.dt.table(),b=this.s.position,e=this.dom,a=d(a.node()),c=a.children("thead"),f=a.children("tfoot"),e=e.tbody;b.visible=a.is(":visible");b.width=a.outerWidth();b.left=a.offset().left;b.theadTop=c.offset().top;b.tbodyTop=e.offset().top;b.tbodyHeight=e.outerHeight();b.theadHeight=b.tbodyTop- e),c.floating.addClass("fixedHeader-locked").css("top",f.tbodyTop).css("left",f.left+"px"),g(f.width));h&&h!==j.activeElement&&setTimeout(function(){h.focus()},10);this.s.scrollLeft.header=-1;this.s.scrollLeft.footer=-1;this.s[b+"Mode"]=a},_positions:function(){var a=this.s.dt.table(),b=this.s.position,e=this.dom,a=d(a.node()),c=a.children("thead"),f=a.children("tfoot"),e=e.tbody;b.visible=a.is(":visible");b.width=a.outerWidth();b.left=a.offset().left;b.theadTop=c.offset().top;b.tbodyTop=e.offset().top;
b.theadTop;f.length?(b.tfootTop=f.offset().top,b.tfootBottom=b.tfootTop+f.outerHeight(),b.tfootHeight=b.tfootBottom-b.tfootTop):(b.tfootTop=b.tbodyTop+e.outerHeight(),b.tfootBottom=b.tfootTop,b.tfootHeight=b.tfootTop)},_scroll:function(a){var b=d(j).scrollTop(),e=d(j).scrollLeft(),c=this.s.position,f;this.c.header&&(f=this.s.enable?!c.visible||b<=c.theadTop-this.c.headerOffset?"in-place":b<=c.tfootTop-c.theadHeight-this.c.headerOffset?"in":"below":"in-place",(a||f!==this.s.headerMode)&&this._modeChange(f, b.tbodyHeight=e.outerHeight();b.theadHeight=b.tbodyTop-b.theadTop;f.length?(b.tfootTop=f.offset().top,b.tfootBottom=b.tfootTop+f.outerHeight(),b.tfootHeight=b.tfootBottom-b.tfootTop):(b.tfootTop=b.tbodyTop+e.outerHeight(),b.tfootBottom=b.tfootTop,b.tfootHeight=b.tfootTop)},_scroll:function(a){var b=d(j).scrollTop(),e=d(j).scrollLeft(),c=this.s.position,f;this.c.header&&(f=this.s.enable?!c.visible||b<=c.theadTop-this.c.headerOffset?"in-place":b<=c.tfootTop-c.theadHeight-this.c.headerOffset?"in":"below":
"header",a),this._horizontal("header",e));this.c.footer&&this.dom.tfoot.length&&(b=this.s.enable?!c.visible||b+c.windowHeight>=c.tfootBottom+this.c.footerOffset?"in-place":c.windowHeight+b>c.tbodyTop+c.tfootHeight+this.c.footerOffset?"in":"above":"in-place",(a||b!==this.s.footerMode)&&this._modeChange(b,"footer",a),this._horizontal("footer",e))}});h.version="3.1.7";h.defaults={header:!0,footer:!1,headerOffset:0,footerOffset:0};d.fn.dataTable.FixedHeader=h;d.fn.DataTable.FixedHeader=h;d(j).on("init.dt.dtfh", "in-place",(a||f!==this.s.headerMode)&&this._modeChange(f,"header",a),this._horizontal("header",e));this.c.footer&&this.dom.tfoot.length&&(b=this.s.enable?!c.visible||b+c.windowHeight>=c.tfootBottom+this.c.footerOffset?"in-place":c.windowHeight+b>c.tbodyTop+c.tfootHeight+this.c.footerOffset?"in":"above":"in-place",(a||b!==this.s.footerMode)&&this._modeChange(b,"footer",a),this._horizontal("footer",e))}});h.version="3.1.8";h.defaults={header:!0,footer:!1,headerOffset:0,footerOffset:0};d.fn.dataTable.FixedHeader=
function(a,b){if("dt"===a.namespace){var e=b.oInit.fixedHeader,c=i.defaults.fixedHeader;if((e||c)&&!b._fixedHeader)c=d.extend({},c,e),!1!==e&&new h(b,c)}});i.Api.register("fixedHeader()",function(){});i.Api.register("fixedHeader.adjust()",function(){return this.iterator("table",function(a){(a=a._fixedHeader)&&a.update()})});i.Api.register("fixedHeader.enable()",function(a){return this.iterator("table",function(b){b=b._fixedHeader;a=a!==k?a:!0;b&&a!==b.enabled()&&b.enable(a)})});i.Api.register("fixedHeader.enabled()", h;d.fn.DataTable.FixedHeader=h;d(j).on("init.dt.dtfh",function(a,b){if("dt"===a.namespace){var e=b.oInit.fixedHeader,c=i.defaults.fixedHeader;if((e||c)&&!b._fixedHeader)c=d.extend({},c,e),!1!==e&&new h(b,c)}});i.Api.register("fixedHeader()",function(){});i.Api.register("fixedHeader.adjust()",function(){return this.iterator("table",function(a){(a=a._fixedHeader)&&a.update()})});i.Api.register("fixedHeader.enable()",function(a){return this.iterator("table",function(b){b=b._fixedHeader;a=a!==k?a:!0;
function(){if(this.context.length){var a=this.content[0]._fixedHeader;if(a)return a.enabled()}return!1});i.Api.register("fixedHeader.disable()",function(){return this.iterator("table",function(a){(a=a._fixedHeader)&&a.enabled()&&a.enable(!1)})});d.each(["header","footer"],function(a,b){i.Api.register("fixedHeader."+b+"Offset()",function(a){var c=this.context;return a===k?c.length&&c[0]._fixedHeader?c[0]._fixedHeader[b+"Offset"]():k:this.iterator("table",function(c){if(c=c._fixedHeader)c[b+"Offset"](a)})})}); b&&a!==b.enabled()&&b.enable(a)})});i.Api.register("fixedHeader.enabled()",function(){if(this.context.length){var a=this.context[0]._fixedHeader;if(a)return a.enabled()}return!1});i.Api.register("fixedHeader.disable()",function(){return this.iterator("table",function(a){(a=a._fixedHeader)&&a.enabled()&&a.enable(!1)})});d.each(["header","footer"],function(a,b){i.Api.register("fixedHeader."+b+"Offset()",function(a){var c=this.context;return a===k?c.length&&c[0]._fixedHeader?c[0]._fixedHeader[b+"Offset"]():
return h}); k:this.iterator("table",function(c){if(c=c._fixedHeader)c[b+"Offset"](a)})})});return h});

View file

@ -1,15 +1,15 @@
/*! KeyTable 2.5.3 /*! KeyTable 2.6.0
* ©2009-2020 SpryMedia Ltd - datatables.net/license * ©2009-2021 SpryMedia Ltd - datatables.net/license
*/ */
/** /**
* @summary KeyTable * @summary KeyTable
* @description Spreadsheet like keyboard navigation for DataTables * @description Spreadsheet like keyboard navigation for DataTables
* @version 2.5.3 * @version 2.6.0
* @file dataTables.keyTable.js * @file dataTables.keyTable.js
* @author SpryMedia Ltd (www.sprymedia.co.uk) * @author SpryMedia Ltd (www.sprymedia.co.uk)
* @contact www.sprymedia.co.uk/contact * @contact www.sprymedia.co.uk/contact
* @copyright Copyright 2009-2020 SpryMedia Ltd. * @copyright Copyright 2009-2021 SpryMedia Ltd.
* *
* This source file is free software, available under the following license: * This source file is free software, available under the following license:
* MIT license - http://datatables.net/license/mit * MIT license - http://datatables.net/license/mit
@ -131,6 +131,13 @@ $.extend( KeyTable.prototype, {
this.s.enable = state; this.s.enable = state;
}, },
/**
* Get enable status
*/
enabled: function () {
return this.s.enable;
},
/** /**
* Focus on a cell * Focus on a cell
* @param {integer} row Row index * @param {integer} row Row index
@ -224,7 +231,10 @@ $.extend( KeyTable.prototype, {
} }
// Or an Editor date input // Or an Editor date input
if ( $(e.target).parents('div.editor-datetime').length ) { if (
$(e.target).parents('div.editor-datetime').length ||
$(e.target).parents('div.dt-datetime').length
) {
return; return;
} }
@ -513,6 +523,11 @@ $.extend( KeyTable.prototype, {
return; return;
} }
// DataTables draw event
if (orig.type === 'draw') {
return;
}
var that = this; var that = this;
var dt = this.s.dt; var dt = this.s.dt;
var editor = this.c.editor; var editor = this.c.editor;
@ -587,6 +602,10 @@ $.extend( KeyTable.prototype, {
dt.off( 'key-blur.editor' ); dt.off( 'key-blur.editor' );
editor.off( namespace ); editor.off( namespace );
$( dt.table().container() ).removeClass('dtk-focus-alt'); $( dt.table().container() ).removeClass('dtk-focus-alt');
if (that.s.returnSubmit) {
that._emitEvent( 'key-return-submit', [dt, editCell] );
}
} ); } );
} ) } )
.one( 'cancelOpen'+namespace, function () { .one( 'cancelOpen'+namespace, function () {
@ -778,6 +797,10 @@ $.extend( KeyTable.prototype, {
} }
var enable = this.s.enable; var enable = this.s.enable;
this.s.returnSubmit = (enable === 'navigation-only' || enable === 'tab-only') && e.keyCode === 13
? true
: false;
var navEnable = enable === true || enable === 'navigation-only'; var navEnable = enable === true || enable === 'navigation-only';
if ( ! enable ) { if ( ! enable ) {
return; return;
@ -961,13 +984,17 @@ $.extend( KeyTable.prototype, {
*/ */
_shift: function ( e, direction, keyBlurable ) _shift: function ( e, direction, keyBlurable )
{ {
var that = this; var that = this;
var dt = this.s.dt; var dt = this.s.dt;
var pageInfo = dt.page.info(); var pageInfo = dt.page.info();
var rows = pageInfo.recordsDisplay; var rows = pageInfo.recordsDisplay;
var currentCell = this.s.lastFocus.cell; var columns = this._columns();
var columns = this._columns(); var last = this.s.lastFocus;
if ( ! last ) {
return;
}
var currentCell = last.cell;
if ( ! currentCell ) { if ( ! currentCell ) {
return; return;
} }
@ -1180,7 +1207,7 @@ KeyTable.defaults = {
KeyTable.version = "2.5.3"; KeyTable.version = "2.6.0";
$.fn.dataTable.KeyTable = KeyTable; $.fn.dataTable.KeyTable = KeyTable;
@ -1219,6 +1246,18 @@ DataTable.Api.register( 'keys.enable()', function ( opts ) {
} ); } );
} ); } );
DataTable.Api.register( 'keys.enabled()', function ( opts ) {
let ctx = this.context;
if (ctx.length) {
return ctx[0].keytable
? ctx[0].keytable.enabled()
: false;
}
return false;
} );
DataTable.Api.register( 'keys.move()', function ( dir ) { DataTable.Api.register( 'keys.move()', function ( dir ) {
return this.iterator( 'table', function (ctx) { return this.iterator( 'table', function (ctx) {
if ( ctx.keytable ) { if ( ctx.keytable ) {

View file

@ -1,25 +0,0 @@
/*!
KeyTable 2.5.3
©2009-2020 SpryMedia Ltd - datatables.net/license
*/
(function(e){"function"===typeof define&&define.amd?define(["jquery","datatables.net"],function(k){return e(k,window,document)}):"object"===typeof exports?module.exports=function(k,i){k||(k=window);if(!i||!i.fn.dataTable)i=require("datatables.net")(k,i).$;return e(i,k,k.document)}:e(jQuery,window,document)})(function(e,k,i,o){var l=e.fn.dataTable,p=0,q=0,m=function(a,b){if(!l.versionCheck||!l.versionCheck("1.10.8"))throw"KeyTable requires DataTables 1.10.8 or newer";this.c=e.extend(!0,{},l.defaults.keyTable,
m.defaults,b);this.s={dt:new l.Api(a),enable:!0,focusDraw:!1,waitingForDraw:!1,lastFocus:null,namespace:".keyTable-"+p++,tabInput:null};this.dom={};var c=this.s.dt.settings()[0],d=c.keytable;if(d)return d;c.keytable=this;this._constructor()};e.extend(m.prototype,{blur:function(){this._blur()},enable:function(a){this.s.enable=a},focus:function(a,b){this._focus(this.s.dt.cell(a,b))},focused:function(a){if(!this.s.lastFocus)return!1;var b=this.s.lastFocus.cell.index();return a.row===b.row&&a.column===
b.column},_constructor:function(){this._tabInput();var a=this,b=this.s.dt,c=e(b.table().node()),d=this.s.namespace,f=!1;"static"===c.css("position")&&c.css("position","relative");e(b.table().body()).on("click"+d,"th, td",function(d){if(!1!==a.s.enable){var c=b.cell(this);c.any()&&a._focus(c,null,!1,d)}});e(i).on("keydown"+d,function(b){f||a._key(b)});if(this.c.blurable)e(i).on("mousedown"+d,function(d){e(d.target).parents(".dataTables_filter").length&&a._blur();e(d.target).parents().filter(b.table().container()).length||
e(d.target).parents("div.DTE").length||e(d.target).parents("div.editor-datetime").length||e(d.target).parents().filter(".DTFC_Cloned").length||a._blur()});if(this.c.editor){var j=this.c.editor;j.on("open.keyTableMain",function(b,c){"inline"!==c&&a.s.enable&&(a.enable(!1),j.one("close"+d,function(){a.enable(!0)}))});if(this.c.editOnFocus)b.on("key-focus"+d+" key-refocus"+d,function(b,d,c,f){a._editor(null,f,!0)});b.on("key"+d,function(b,d,c,f,e){a._editor(c,e,!1)});e(b.table().body()).on("dblclick"+
d,"th, td",function(d){!1!==a.s.enable&&b.cell(this).any()&&(a.s.lastFocus&&this!==a.s.lastFocus.cell.node()||a._editor(null,d,!0))});j.on("preSubmit",function(){f=!0}).on("preSubmitCancelled",function(){f=!1}).on("submitComplete",function(){f=!1})}if(b.settings()[0].oFeatures.bStateSave)b.on("stateSaveParams"+d,function(b,d,c){c.keyTable=a.s.lastFocus?a.s.lastFocus.cell.index():null});b.on("column-visibility"+d,function(){a._tabInput()});b.on("draw"+d,function(d){a._tabInput();if(!a.s.focusDraw&&
a.s.lastFocus){var c=a.s.lastFocus.relative,f=b.page.info(),e=c.row+f.start;0!==f.recordsDisplay&&(e>=f.recordsDisplay&&(e=f.recordsDisplay-1),a._focus(e,c.column,!0,d))}});this.c.clipboard&&this._clipboard();b.on("destroy"+d,function(){a._blur(!0);b.off(d);e(b.table().body()).off("click"+d,"th, td").off("dblclick"+d,"th, td");e(i).off("mousedown"+d).off("keydown"+d).off("copy"+d).off("paste"+d)});var g=b.state.loaded();if(g&&g.keyTable)b.one("init",function(){var a=b.cell(g.keyTable);a.any()&&a.focus()});
else this.c.focus&&b.cell(this.c.focus).focus()},_blur:function(a){if(this.s.enable&&this.s.lastFocus){var b=this.s.lastFocus.cell;e(b.node()).removeClass(this.c.className);this.s.lastFocus=null;a||(this._updateFixedColumns(b.index().column),this._emitEvent("key-blur",[this.s.dt,b]))}},_clipboard:function(){var a=this.s.dt,b=this,c=this.s.namespace;k.getSelection&&(e(i).on("copy"+c,function(a){var a=a.originalEvent,c=k.getSelection().toString(),e=b.s.lastFocus;!c&&e&&(a.clipboardData.setData("text/plain",
e.cell.render(b.c.clipboardOrthogonal)),a.preventDefault())}),e(i).on("paste"+c,function(d){var d=d.originalEvent,c=b.s.lastFocus,e=i.activeElement,g=b.c.editor,h;if(c&&(!e||"body"===e.nodeName.toLowerCase()))d.preventDefault(),k.clipboardData&&k.clipboardData.getData?h=k.clipboardData.getData("Text"):d.clipboardData&&d.clipboardData.getData&&(h=d.clipboardData.getData("text/plain")),g?g.inline(c.cell.index()).set(g.displayed()[0],h).submit():(c.cell.data(h),a.draw(!1))}))},_columns:function(){var a=
this.s.dt,b=a.columns(this.c.columns).indexes(),c=[];a.columns(":visible").every(function(a){-1!==b.indexOf(a)&&c.push(a)});return c},_editor:function(a,b,c){if(this.s.lastFocus){var d=this,f=this.s.dt,j=this.c.editor,g=this.s.lastFocus.cell,h=this.s.namespace+"e"+q++;if(!e("div.DTE",g.node()).length&&!(null!==a&&(0<=a&&9>=a||11===a||12===a||14<=a&&31>=a||112<=a&&123>=a||127<=a&&159>=a))){b.stopPropagation();13===a&&b.preventDefault();var n=function(){j.one("open"+h,function(){j.off("cancelOpen"+
h);c||e("div.DTE_Field_InputControl input, div.DTE_Field_InputControl textarea").select();f.keys.enable(c?"tab-only":"navigation-only");f.on("key-blur.editor",function(a,b,c){j.displayed()&&c.node()===g.node()&&j.submit()});c&&e(f.table().container()).addClass("dtk-focus-alt");j.on("preSubmitCancelled"+h,function(){setTimeout(function(){d._focus(g,null,!1)},50)});j.on("submitUnsuccessful"+h,function(){d._focus(g,null,!1)});j.one("close"+h,function(){f.keys.enable(!0);f.off("key-blur.editor");j.off(h);
e(f.table().container()).removeClass("dtk-focus-alt")})}).one("cancelOpen"+h,function(){j.off(h)}).inline(g.index())};13===a?(c=!0,e(i).one("keyup",function(){n()})):n()}}},_emitEvent:function(a,b){this.s.dt.iterator("table",function(c){e(c.nTable).triggerHandler(a,b)})},_focus:function(a,b,c,d){var f=this,j=this.s.dt,g=j.page.info(),h=this.s.lastFocus;d||(d=null);if(this.s.enable){if("number"!==typeof a){if(!a.any())return;var n=a.index(),b=n.column,a=j.rows({filter:"applied",order:"applied"}).indexes().indexOf(n.row);
if(0>a)return;g.serverSide&&(a+=g.start)}if(-1!==g.length&&(a<g.start||a>=g.start+g.length))this.s.focusDraw=!0,this.s.waitingForDraw=!0,j.one("draw",function(){f.s.focusDraw=!1;f.s.waitingForDraw=!1;f._focus(a,b,o,d)}).page(Math.floor(a/g.length)).draw(!1);else if(-1!==e.inArray(b,this._columns())){g.serverSide&&(a-=g.start);g=j.cells(null,b,{search:"applied",order:"applied"}).flatten();g=j.cell(g[a]);if(h){if(h.node===g.node()){this._emitEvent("key-refocus",[this.s.dt,g,d||null]);return}this._blur()}this._removeOtherFocus();
h=e(g.node());h.addClass(this.c.className);this._updateFixedColumns(b);if(c===o||!0===c)this._scroll(e(k),e(i.body),h,"offset"),c=j.table().body().parentNode,c!==j.table().header().parentNode&&(c=e(c.parentNode),this._scroll(c,c,h,"position"));this.s.lastFocus={cell:g,node:g.node(),relative:{row:j.rows({page:"current"}).indexes().indexOf(g.index().row),column:g.index().column}};this._emitEvent("key-focus",[this.s.dt,g,d||null]);j.state.save()}}},_key:function(a){if(this.s.waitingForDraw)a.preventDefault();
else{var b=this.s.enable,c=!0===b||"navigation-only"===b;if(b&&(!(0===a.keyCode||a.ctrlKey||a.metaKey||a.altKey)||a.ctrlKey&&a.altKey)){var d=this.s.lastFocus;if(d)if(this.s.dt.cell(d.node).any()){var d=this.s.dt,f=this.s.dt.settings()[0].oScroll.sY?!0:!1;if(!(this.c.keys&&-1===e.inArray(a.keyCode,this.c.keys)))switch(a.keyCode){case 9:this._shift(a,a.shiftKey?"left":"right",!0);break;case 27:this.s.blurable&&!0===b&&this._blur();break;case 33:case 34:c&&!f&&(a.preventDefault(),d.page(33===a.keyCode?
"previous":"next").draw(!1));break;case 35:case 36:c&&(a.preventDefault(),b=d.cells({page:"current"}).indexes(),c=this._columns(),this._focus(d.cell(b[35===a.keyCode?b.length-1:c[0]]),null,!0,a));break;case 37:c&&this._shift(a,"left");break;case 38:c&&this._shift(a,"up");break;case 39:c&&this._shift(a,"right");break;case 40:c&&this._shift(a,"down");break;case 113:if(this.c.editor){this._editor(null,a,!0);break}default:!0===b&&this._emitEvent("key",[d,a.keyCode,this.s.lastFocus.cell,a])}}else this.s.lastFocus=
null}}},_removeOtherFocus:function(){var a=this.s.dt.table().node();e.fn.dataTable.tables({api:!0}).iterator("table",function(){this.table().node()!==a&&this.cell.blur()})},_scroll:function(a,b,c,d){var f=c[d](),e=c.outerHeight(),g=c.outerWidth(),h=b.scrollTop(),n=b.scrollLeft(),i=a.height(),a=a.width();"position"===d&&(f.top+=parseInt(c.closest("table").css("top"),10));f.top<h&&b.scrollTop(f.top);f.left<n&&b.scrollLeft(f.left);f.top+e>h+i&&e<i&&b.scrollTop(f.top+e-i);f.left+g>n+a&&g<a&&b.scrollLeft(f.left+
g-a)},_shift:function(a,b,c){var d=this.s.dt,f=d.page.info(),j=f.recordsDisplay,g=this.s.lastFocus.cell,h=this._columns();if(g){var i=d.rows({filter:"applied",order:"applied"}).indexes().indexOf(g.index().row);f.serverSide&&(i+=f.start);d=d.columns(h).indexes().indexOf(g.index().column);f=h[d];"right"===b?d>=h.length-1?(i++,f=h[0]):f=h[d+1]:"left"===b?0===d?(i--,f=h[h.length-1]):f=h[d-1]:"up"===b?i--:"down"===b&&i++;0<=i&&i<j&&-1!==e.inArray(f,h)?(a&&a.preventDefault(),this._focus(i,f,!0,a)):!c||
!this.c.blurable?a&&a.preventDefault():this._blur()}},_tabInput:function(){var a=this,b=this.s.dt,c=null!==this.c.tabIndex?this.c.tabIndex:b.settings()[0].iTabIndex;-1!=c&&(this.s.tabInput||(c=e('<div><input type="text" tabindex="'+c+'"/></div>').css({position:"absolute",height:1,width:0,overflow:"hidden"}),c.children().on("focus",function(c){var e=b.cell(":eq(0)",a._columns(),{page:"current"});e.any()&&a._focus(e,null,!0,c)}),this.s.tabInput=c),(c=this.s.dt.cell(":eq(0)","0:visible",{page:"current",
order:"current"}).node())&&e(c).prepend(this.s.tabInput))},_updateFixedColumns:function(a){var b=this.s.dt,c=b.settings()[0];if(c._oFixedColumns){var d=c.aoColumns.length-c._oFixedColumns.s.iRightColumns;(a<c._oFixedColumns.s.iLeftColumns||a>=d)&&b.fixedColumns().update()}}});m.defaults={blurable:!0,className:"focus",clipboard:!0,clipboardOrthogonal:"display",columns:"",editor:null,editOnFocus:!1,focus:null,keys:null,tabIndex:null};m.version="2.5.3";e.fn.dataTable.KeyTable=m;e.fn.DataTable.KeyTable=
m;l.Api.register("cell.blur()",function(){return this.iterator("table",function(a){a.keytable&&a.keytable.blur()})});l.Api.register("cell().focus()",function(){return this.iterator("cell",function(a,b,c){a.keytable&&a.keytable.focus(b,c)})});l.Api.register("keys.disable()",function(){return this.iterator("table",function(a){a.keytable&&a.keytable.enable(!1)})});l.Api.register("keys.enable()",function(a){return this.iterator("table",function(b){b.keytable&&b.keytable.enable(a===o?!0:a)})});l.Api.register("keys.move()",
function(a){return this.iterator("table",function(b){b.keytable&&b.keytable._shift(null,a,!1)})});l.ext.selector.cell.push(function(a,b,c){var b=b.focused,a=a.keytable,d=[];if(!a||b===o)return c;for(var e=0,i=c.length;e<i;e++)(!0===b&&a.focused(c[e])||!1===b&&!a.focused(c[e]))&&d.push(c[e]);return d});e(i).on("preInit.dt.dtk",function(a,b){if("dt"===a.namespace){var c=b.oInit.keys,d=l.defaults.keys;if(c||d)d=e.extend({},d,c),!1!==c&&new m(b,d)}});return m});

View file

@ -1,39 +1,44 @@
/*
* The MIT License
* Copyright (c) 2012 Matias Meno <m@tias.me>
*/
.dropzone, .dropzone * { .dropzone, .dropzone * {
box-sizing: border-box; } box-sizing: border-box;
}
.dropzone { .dropzone {
position: relative; } position: relative;
.dropzone .dz-preview { }
position: relative; .dropzone .dz-preview {
display: inline-block; position: relative;
width: 120px; display: inline-block;
margin: 0.5em; } width: 120px;
.dropzone .dz-preview .dz-progress { margin: 0.5em;
display: block; }
height: 15px; .dropzone .dz-preview .dz-progress {
border: 1px solid #aaa; } display: block;
.dropzone .dz-preview .dz-progress .dz-upload { height: 15px;
display: block; border: 1px solid #aaa;
height: 100%; }
width: 0; .dropzone .dz-preview .dz-progress .dz-upload {
background: green; } display: block;
.dropzone .dz-preview .dz-error-message { height: 100%;
color: red; width: 0;
display: none; } background: green;
.dropzone .dz-preview.dz-error .dz-error-message, .dropzone .dz-preview.dz-error .dz-error-mark { }
display: block; } .dropzone .dz-preview .dz-error-message {
.dropzone .dz-preview.dz-success .dz-success-mark { color: red;
display: block; } display: none;
.dropzone .dz-preview .dz-error-mark, .dropzone .dz-preview .dz-success-mark { }
position: absolute; .dropzone .dz-preview.dz-error .dz-error-message, .dropzone .dz-preview.dz-error .dz-error-mark {
display: none; display: block;
left: 30px; }
top: 30px; .dropzone .dz-preview.dz-success .dz-success-mark {
width: 54px; display: block;
height: 58px; }
left: 50%; .dropzone .dz-preview .dz-error-mark, .dropzone .dz-preview .dz-success-mark {
margin-left: -27px; } position: absolute;
display: none;
left: 30px;
top: 30px;
width: 54px;
height: 58px;
left: 50%;
margin-left: -27px;
}

File diff suppressed because it is too large Load diff

View file

@ -1,7 +1,3 @@
/*
* The MIT License
* Copyright (c) 2012 Matias Meno <m@tias.me>
*/
@-webkit-keyframes passing-through { @-webkit-keyframes passing-through {
0% { 0% {
opacity: 0; opacity: 0;
@ -9,21 +5,25 @@
-moz-transform: translateY(40px); -moz-transform: translateY(40px);
-ms-transform: translateY(40px); -ms-transform: translateY(40px);
-o-transform: translateY(40px); -o-transform: translateY(40px);
transform: translateY(40px); } transform: translateY(40px);
}
30%, 70% { 30%, 70% {
opacity: 1; opacity: 1;
-webkit-transform: translateY(0px); -webkit-transform: translateY(0px);
-moz-transform: translateY(0px); -moz-transform: translateY(0px);
-ms-transform: translateY(0px); -ms-transform: translateY(0px);
-o-transform: translateY(0px); -o-transform: translateY(0px);
transform: translateY(0px); } transform: translateY(0px);
}
100% { 100% {
opacity: 0; opacity: 0;
-webkit-transform: translateY(-40px); -webkit-transform: translateY(-40px);
-moz-transform: translateY(-40px); -moz-transform: translateY(-40px);
-ms-transform: translateY(-40px); -ms-transform: translateY(-40px);
-o-transform: translateY(-40px); -o-transform: translateY(-40px);
transform: translateY(-40px); } } transform: translateY(-40px);
}
}
@-moz-keyframes passing-through { @-moz-keyframes passing-through {
0% { 0% {
opacity: 0; opacity: 0;
@ -31,21 +31,25 @@
-moz-transform: translateY(40px); -moz-transform: translateY(40px);
-ms-transform: translateY(40px); -ms-transform: translateY(40px);
-o-transform: translateY(40px); -o-transform: translateY(40px);
transform: translateY(40px); } transform: translateY(40px);
}
30%, 70% { 30%, 70% {
opacity: 1; opacity: 1;
-webkit-transform: translateY(0px); -webkit-transform: translateY(0px);
-moz-transform: translateY(0px); -moz-transform: translateY(0px);
-ms-transform: translateY(0px); -ms-transform: translateY(0px);
-o-transform: translateY(0px); -o-transform: translateY(0px);
transform: translateY(0px); } transform: translateY(0px);
}
100% { 100% {
opacity: 0; opacity: 0;
-webkit-transform: translateY(-40px); -webkit-transform: translateY(-40px);
-moz-transform: translateY(-40px); -moz-transform: translateY(-40px);
-ms-transform: translateY(-40px); -ms-transform: translateY(-40px);
-o-transform: translateY(-40px); -o-transform: translateY(-40px);
transform: translateY(-40px); } } transform: translateY(-40px);
}
}
@keyframes passing-through { @keyframes passing-through {
0% { 0% {
opacity: 0; opacity: 0;
@ -53,21 +57,25 @@
-moz-transform: translateY(40px); -moz-transform: translateY(40px);
-ms-transform: translateY(40px); -ms-transform: translateY(40px);
-o-transform: translateY(40px); -o-transform: translateY(40px);
transform: translateY(40px); } transform: translateY(40px);
}
30%, 70% { 30%, 70% {
opacity: 1; opacity: 1;
-webkit-transform: translateY(0px); -webkit-transform: translateY(0px);
-moz-transform: translateY(0px); -moz-transform: translateY(0px);
-ms-transform: translateY(0px); -ms-transform: translateY(0px);
-o-transform: translateY(0px); -o-transform: translateY(0px);
transform: translateY(0px); } transform: translateY(0px);
}
100% { 100% {
opacity: 0; opacity: 0;
-webkit-transform: translateY(-40px); -webkit-transform: translateY(-40px);
-moz-transform: translateY(-40px); -moz-transform: translateY(-40px);
-ms-transform: translateY(-40px); -ms-transform: translateY(-40px);
-o-transform: translateY(-40px); -o-transform: translateY(-40px);
transform: translateY(-40px); } } transform: translateY(-40px);
}
}
@-webkit-keyframes slide-in { @-webkit-keyframes slide-in {
0% { 0% {
opacity: 0; opacity: 0;
@ -75,14 +83,17 @@
-moz-transform: translateY(40px); -moz-transform: translateY(40px);
-ms-transform: translateY(40px); -ms-transform: translateY(40px);
-o-transform: translateY(40px); -o-transform: translateY(40px);
transform: translateY(40px); } transform: translateY(40px);
}
30% { 30% {
opacity: 1; opacity: 1;
-webkit-transform: translateY(0px); -webkit-transform: translateY(0px);
-moz-transform: translateY(0px); -moz-transform: translateY(0px);
-ms-transform: translateY(0px); -ms-transform: translateY(0px);
-o-transform: translateY(0px); -o-transform: translateY(0px);
transform: translateY(0px); } } transform: translateY(0px);
}
}
@-moz-keyframes slide-in { @-moz-keyframes slide-in {
0% { 0% {
opacity: 0; opacity: 0;
@ -90,14 +101,17 @@
-moz-transform: translateY(40px); -moz-transform: translateY(40px);
-ms-transform: translateY(40px); -ms-transform: translateY(40px);
-o-transform: translateY(40px); -o-transform: translateY(40px);
transform: translateY(40px); } transform: translateY(40px);
}
30% { 30% {
opacity: 1; opacity: 1;
-webkit-transform: translateY(0px); -webkit-transform: translateY(0px);
-moz-transform: translateY(0px); -moz-transform: translateY(0px);
-ms-transform: translateY(0px); -ms-transform: translateY(0px);
-o-transform: translateY(0px); -o-transform: translateY(0px);
transform: translateY(0px); } } transform: translateY(0px);
}
}
@keyframes slide-in { @keyframes slide-in {
0% { 0% {
opacity: 0; opacity: 0;
@ -105,292 +119,350 @@
-moz-transform: translateY(40px); -moz-transform: translateY(40px);
-ms-transform: translateY(40px); -ms-transform: translateY(40px);
-o-transform: translateY(40px); -o-transform: translateY(40px);
transform: translateY(40px); } transform: translateY(40px);
}
30% { 30% {
opacity: 1; opacity: 1;
-webkit-transform: translateY(0px); -webkit-transform: translateY(0px);
-moz-transform: translateY(0px); -moz-transform: translateY(0px);
-ms-transform: translateY(0px); -ms-transform: translateY(0px);
-o-transform: translateY(0px); -o-transform: translateY(0px);
transform: translateY(0px); } } transform: translateY(0px);
}
}
@-webkit-keyframes pulse { @-webkit-keyframes pulse {
0% { 0% {
-webkit-transform: scale(1); -webkit-transform: scale(1);
-moz-transform: scale(1); -moz-transform: scale(1);
-ms-transform: scale(1); -ms-transform: scale(1);
-o-transform: scale(1); -o-transform: scale(1);
transform: scale(1); } transform: scale(1);
}
10% { 10% {
-webkit-transform: scale(1.1); -webkit-transform: scale(1.1);
-moz-transform: scale(1.1); -moz-transform: scale(1.1);
-ms-transform: scale(1.1); -ms-transform: scale(1.1);
-o-transform: scale(1.1); -o-transform: scale(1.1);
transform: scale(1.1); } transform: scale(1.1);
}
20% { 20% {
-webkit-transform: scale(1); -webkit-transform: scale(1);
-moz-transform: scale(1); -moz-transform: scale(1);
-ms-transform: scale(1); -ms-transform: scale(1);
-o-transform: scale(1); -o-transform: scale(1);
transform: scale(1); } } transform: scale(1);
}
}
@-moz-keyframes pulse { @-moz-keyframes pulse {
0% { 0% {
-webkit-transform: scale(1); -webkit-transform: scale(1);
-moz-transform: scale(1); -moz-transform: scale(1);
-ms-transform: scale(1); -ms-transform: scale(1);
-o-transform: scale(1); -o-transform: scale(1);
transform: scale(1); } transform: scale(1);
}
10% { 10% {
-webkit-transform: scale(1.1); -webkit-transform: scale(1.1);
-moz-transform: scale(1.1); -moz-transform: scale(1.1);
-ms-transform: scale(1.1); -ms-transform: scale(1.1);
-o-transform: scale(1.1); -o-transform: scale(1.1);
transform: scale(1.1); } transform: scale(1.1);
}
20% { 20% {
-webkit-transform: scale(1); -webkit-transform: scale(1);
-moz-transform: scale(1); -moz-transform: scale(1);
-ms-transform: scale(1); -ms-transform: scale(1);
-o-transform: scale(1); -o-transform: scale(1);
transform: scale(1); } } transform: scale(1);
}
}
@keyframes pulse { @keyframes pulse {
0% { 0% {
-webkit-transform: scale(1); -webkit-transform: scale(1);
-moz-transform: scale(1); -moz-transform: scale(1);
-ms-transform: scale(1); -ms-transform: scale(1);
-o-transform: scale(1); -o-transform: scale(1);
transform: scale(1); } transform: scale(1);
}
10% { 10% {
-webkit-transform: scale(1.1); -webkit-transform: scale(1.1);
-moz-transform: scale(1.1); -moz-transform: scale(1.1);
-ms-transform: scale(1.1); -ms-transform: scale(1.1);
-o-transform: scale(1.1); -o-transform: scale(1.1);
transform: scale(1.1); } transform: scale(1.1);
}
20% { 20% {
-webkit-transform: scale(1); -webkit-transform: scale(1);
-moz-transform: scale(1); -moz-transform: scale(1);
-ms-transform: scale(1); -ms-transform: scale(1);
-o-transform: scale(1); -o-transform: scale(1);
transform: scale(1); } } transform: scale(1);
}
}
.dropzone, .dropzone * { .dropzone, .dropzone * {
box-sizing: border-box; } box-sizing: border-box;
}
.dropzone { .dropzone {
min-height: 150px; min-height: 150px;
border: 2px solid rgba(0, 0, 0, 0.3); border: 2px solid rgba(0, 0, 0, 0.3);
background: white; background: white;
padding: 20px 20px; } padding: 20px 20px;
.dropzone.dz-clickable { }
cursor: pointer; } .dropzone.dz-clickable {
.dropzone.dz-clickable * { cursor: pointer;
cursor: default; } }
.dropzone.dz-clickable .dz-message, .dropzone.dz-clickable .dz-message * { .dropzone.dz-clickable * {
cursor: pointer; } cursor: default;
.dropzone.dz-started .dz-message { }
display: none; } .dropzone.dz-clickable .dz-message, .dropzone.dz-clickable .dz-message * {
.dropzone.dz-drag-hover { cursor: pointer;
border-style: solid; } }
.dropzone.dz-drag-hover .dz-message { .dropzone.dz-started .dz-message {
opacity: 0.5; } display: none;
.dropzone .dz-message { }
text-align: center; .dropzone.dz-drag-hover {
margin: 2em 0; } border-style: solid;
.dropzone .dz-message .dz-button { }
background: none; .dropzone.dz-drag-hover .dz-message {
color: inherit; opacity: 0.5;
border: none; }
padding: 0; .dropzone .dz-message {
font: inherit; text-align: center;
cursor: pointer; margin: 2em 0;
outline: inherit; } }
.dropzone .dz-preview { .dropzone .dz-message .dz-button {
position: relative; background: none;
display: inline-block; color: inherit;
vertical-align: top; border: none;
margin: 16px; padding: 0;
min-height: 100px; } font: inherit;
.dropzone .dz-preview:hover { cursor: pointer;
z-index: 1000; } outline: inherit;
.dropzone .dz-preview:hover .dz-details { }
opacity: 1; } .dropzone .dz-preview {
.dropzone .dz-preview.dz-file-preview .dz-image { position: relative;
border-radius: 20px; display: inline-block;
background: #999; vertical-align: top;
background: linear-gradient(to bottom, #eee, #ddd); } margin: 16px;
.dropzone .dz-preview.dz-file-preview .dz-details { min-height: 100px;
opacity: 1; } }
.dropzone .dz-preview.dz-image-preview { .dropzone .dz-preview:hover {
background: white; } z-index: 1000;
.dropzone .dz-preview.dz-image-preview .dz-details { }
-webkit-transition: opacity 0.2s linear; .dropzone .dz-preview:hover .dz-details {
-moz-transition: opacity 0.2s linear; opacity: 1;
-ms-transition: opacity 0.2s linear; }
-o-transition: opacity 0.2s linear; .dropzone .dz-preview.dz-file-preview .dz-image {
transition: opacity 0.2s linear; } border-radius: 20px;
.dropzone .dz-preview .dz-remove { background: #999;
font-size: 14px; background: linear-gradient(to bottom, #eee, #ddd);
text-align: center; }
display: block; .dropzone .dz-preview.dz-file-preview .dz-details {
cursor: pointer; opacity: 1;
border: none; } }
.dropzone .dz-preview .dz-remove:hover { .dropzone .dz-preview.dz-image-preview {
text-decoration: underline; } background: white;
.dropzone .dz-preview:hover .dz-details { }
opacity: 1; } .dropzone .dz-preview.dz-image-preview .dz-details {
.dropzone .dz-preview .dz-details { -webkit-transition: opacity 0.2s linear;
z-index: 20; -moz-transition: opacity 0.2s linear;
position: absolute; -ms-transition: opacity 0.2s linear;
top: 0; -o-transition: opacity 0.2s linear;
left: 0; transition: opacity 0.2s linear;
opacity: 0; }
font-size: 13px; .dropzone .dz-preview .dz-remove {
min-width: 100%; font-size: 14px;
max-width: 100%; text-align: center;
padding: 2em 1em; display: block;
text-align: center; cursor: pointer;
color: rgba(0, 0, 0, 0.9); border: none;
line-height: 150%; } }
.dropzone .dz-preview .dz-details .dz-size { .dropzone .dz-preview .dz-remove:hover {
margin-bottom: 1em; text-decoration: underline;
font-size: 16px; } }
.dropzone .dz-preview .dz-details .dz-filename { .dropzone .dz-preview:hover .dz-details {
white-space: nowrap; } opacity: 1;
.dropzone .dz-preview .dz-details .dz-filename:hover span { }
border: 1px solid rgba(200, 200, 200, 0.8); .dropzone .dz-preview .dz-details {
background-color: rgba(255, 255, 255, 0.8); } z-index: 20;
.dropzone .dz-preview .dz-details .dz-filename:not(:hover) { position: absolute;
overflow: hidden; top: 0;
text-overflow: ellipsis; } left: 0;
.dropzone .dz-preview .dz-details .dz-filename:not(:hover) span { opacity: 0;
border: 1px solid transparent; } font-size: 13px;
.dropzone .dz-preview .dz-details .dz-filename span, .dropzone .dz-preview .dz-details .dz-size span { min-width: 100%;
background-color: rgba(255, 255, 255, 0.4); max-width: 100%;
padding: 0 0.4em; padding: 2em 1em;
border-radius: 3px; } text-align: center;
.dropzone .dz-preview:hover .dz-image img { color: rgba(0, 0, 0, 0.9);
-webkit-transform: scale(1.05, 1.05); line-height: 150%;
-moz-transform: scale(1.05, 1.05); }
-ms-transform: scale(1.05, 1.05); .dropzone .dz-preview .dz-details .dz-size {
-o-transform: scale(1.05, 1.05); margin-bottom: 1em;
transform: scale(1.05, 1.05); font-size: 16px;
-webkit-filter: blur(8px); }
filter: blur(8px); } .dropzone .dz-preview .dz-details .dz-filename {
.dropzone .dz-preview .dz-image { white-space: nowrap;
border-radius: 20px; }
overflow: hidden; .dropzone .dz-preview .dz-details .dz-filename:hover span {
width: 120px; border: 1px solid rgba(200, 200, 200, 0.8);
height: 120px; background-color: rgba(255, 255, 255, 0.8);
position: relative; }
display: block; .dropzone .dz-preview .dz-details .dz-filename:not(:hover) {
z-index: 10; } overflow: hidden;
.dropzone .dz-preview .dz-image img { text-overflow: ellipsis;
display: block; } }
.dropzone .dz-preview.dz-success .dz-success-mark { .dropzone .dz-preview .dz-details .dz-filename:not(:hover) span {
-webkit-animation: passing-through 3s cubic-bezier(0.77, 0, 0.175, 1); border: 1px solid transparent;
-moz-animation: passing-through 3s cubic-bezier(0.77, 0, 0.175, 1); }
-ms-animation: passing-through 3s cubic-bezier(0.77, 0, 0.175, 1); .dropzone .dz-preview .dz-details .dz-filename span, .dropzone .dz-preview .dz-details .dz-size span {
-o-animation: passing-through 3s cubic-bezier(0.77, 0, 0.175, 1); background-color: rgba(255, 255, 255, 0.4);
animation: passing-through 3s cubic-bezier(0.77, 0, 0.175, 1); } padding: 0 0.4em;
.dropzone .dz-preview.dz-error .dz-error-mark { border-radius: 3px;
opacity: 1; }
-webkit-animation: slide-in 3s cubic-bezier(0.77, 0, 0.175, 1); .dropzone .dz-preview:hover .dz-image img {
-moz-animation: slide-in 3s cubic-bezier(0.77, 0, 0.175, 1); -webkit-transform: scale(1.05, 1.05);
-ms-animation: slide-in 3s cubic-bezier(0.77, 0, 0.175, 1); -moz-transform: scale(1.05, 1.05);
-o-animation: slide-in 3s cubic-bezier(0.77, 0, 0.175, 1); -ms-transform: scale(1.05, 1.05);
animation: slide-in 3s cubic-bezier(0.77, 0, 0.175, 1); } -o-transform: scale(1.05, 1.05);
.dropzone .dz-preview .dz-success-mark, .dropzone .dz-preview .dz-error-mark { transform: scale(1.05, 1.05);
pointer-events: none; -webkit-filter: blur(8px);
opacity: 0; filter: blur(8px);
z-index: 500; }
position: absolute; .dropzone .dz-preview .dz-image {
display: block; border-radius: 20px;
top: 50%; overflow: hidden;
left: 50%; width: 120px;
margin-left: -27px; height: 120px;
margin-top: -27px; } position: relative;
.dropzone .dz-preview .dz-success-mark svg, .dropzone .dz-preview .dz-error-mark svg { display: block;
display: block; z-index: 10;
width: 54px; }
height: 54px; } .dropzone .dz-preview .dz-image img {
.dropzone .dz-preview.dz-processing .dz-progress { display: block;
opacity: 1; }
-webkit-transition: all 0.2s linear; .dropzone .dz-preview.dz-success .dz-success-mark {
-moz-transition: all 0.2s linear; -webkit-animation: passing-through 3s cubic-bezier(0.77, 0, 0.175, 1);
-ms-transition: all 0.2s linear; -moz-animation: passing-through 3s cubic-bezier(0.77, 0, 0.175, 1);
-o-transition: all 0.2s linear; -ms-animation: passing-through 3s cubic-bezier(0.77, 0, 0.175, 1);
transition: all 0.2s linear; } -o-animation: passing-through 3s cubic-bezier(0.77, 0, 0.175, 1);
.dropzone .dz-preview.dz-complete .dz-progress { animation: passing-through 3s cubic-bezier(0.77, 0, 0.175, 1);
opacity: 0; }
-webkit-transition: opacity 0.4s ease-in; .dropzone .dz-preview.dz-error .dz-error-mark {
-moz-transition: opacity 0.4s ease-in; opacity: 1;
-ms-transition: opacity 0.4s ease-in; -webkit-animation: slide-in 3s cubic-bezier(0.77, 0, 0.175, 1);
-o-transition: opacity 0.4s ease-in; -moz-animation: slide-in 3s cubic-bezier(0.77, 0, 0.175, 1);
transition: opacity 0.4s ease-in; } -ms-animation: slide-in 3s cubic-bezier(0.77, 0, 0.175, 1);
.dropzone .dz-preview:not(.dz-processing) .dz-progress { -o-animation: slide-in 3s cubic-bezier(0.77, 0, 0.175, 1);
-webkit-animation: pulse 6s ease infinite; animation: slide-in 3s cubic-bezier(0.77, 0, 0.175, 1);
-moz-animation: pulse 6s ease infinite; }
-ms-animation: pulse 6s ease infinite; .dropzone .dz-preview .dz-success-mark, .dropzone .dz-preview .dz-error-mark {
-o-animation: pulse 6s ease infinite; pointer-events: none;
animation: pulse 6s ease infinite; } opacity: 0;
.dropzone .dz-preview .dz-progress { z-index: 500;
opacity: 1; position: absolute;
z-index: 1000; display: block;
pointer-events: none; top: 50%;
position: absolute; left: 50%;
height: 16px; margin-left: -27px;
left: 50%; margin-top: -27px;
top: 50%; }
margin-top: -8px; .dropzone .dz-preview .dz-success-mark svg, .dropzone .dz-preview .dz-error-mark svg {
width: 80px; display: block;
margin-left: -40px; width: 54px;
background: rgba(255, 255, 255, 0.9); height: 54px;
-webkit-transform: scale(1); }
border-radius: 8px; .dropzone .dz-preview.dz-processing .dz-progress {
overflow: hidden; } opacity: 1;
.dropzone .dz-preview .dz-progress .dz-upload { -webkit-transition: all 0.2s linear;
background: #333; -moz-transition: all 0.2s linear;
background: linear-gradient(to bottom, #666, #444); -ms-transition: all 0.2s linear;
position: absolute; -o-transition: all 0.2s linear;
top: 0; transition: all 0.2s linear;
left: 0; }
bottom: 0; .dropzone .dz-preview.dz-complete .dz-progress {
width: 0; opacity: 0;
-webkit-transition: width 300ms ease-in-out; -webkit-transition: opacity 0.4s ease-in;
-moz-transition: width 300ms ease-in-out; -moz-transition: opacity 0.4s ease-in;
-ms-transition: width 300ms ease-in-out; -ms-transition: opacity 0.4s ease-in;
-o-transition: width 300ms ease-in-out; -o-transition: opacity 0.4s ease-in;
transition: width 300ms ease-in-out; } transition: opacity 0.4s ease-in;
.dropzone .dz-preview.dz-error .dz-error-message { }
display: block; } .dropzone .dz-preview:not(.dz-processing) .dz-progress {
.dropzone .dz-preview.dz-error:hover .dz-error-message { -webkit-animation: pulse 6s ease infinite;
opacity: 1; -moz-animation: pulse 6s ease infinite;
pointer-events: auto; } -ms-animation: pulse 6s ease infinite;
.dropzone .dz-preview .dz-error-message { -o-animation: pulse 6s ease infinite;
pointer-events: none; animation: pulse 6s ease infinite;
z-index: 1000; }
position: absolute; .dropzone .dz-preview .dz-progress {
display: block; opacity: 1;
display: none; z-index: 1000;
opacity: 0; pointer-events: none;
-webkit-transition: opacity 0.3s ease; position: absolute;
-moz-transition: opacity 0.3s ease; height: 16px;
-ms-transition: opacity 0.3s ease; left: 50%;
-o-transition: opacity 0.3s ease; top: 50%;
transition: opacity 0.3s ease; margin-top: -8px;
border-radius: 8px; width: 80px;
font-size: 13px; margin-left: -40px;
top: 130px; background: rgba(255, 255, 255, 0.9);
left: -10px; -webkit-transform: scale(1);
width: 140px; border-radius: 8px;
background: #be2626; overflow: hidden;
background: linear-gradient(to bottom, #be2626, #a92222); }
padding: 0.5em 1.2em; .dropzone .dz-preview .dz-progress .dz-upload {
color: white; } background: #333;
.dropzone .dz-preview .dz-error-message:after { background: linear-gradient(to bottom, #666, #444);
content: ''; position: absolute;
position: absolute; top: 0;
top: -6px; left: 0;
left: 64px; bottom: 0;
width: 0; width: 0;
height: 0; -webkit-transition: width 300ms ease-in-out;
border-left: 6px solid transparent; -moz-transition: width 300ms ease-in-out;
border-right: 6px solid transparent; -ms-transition: width 300ms ease-in-out;
border-bottom: 6px solid #be2626; } -o-transition: width 300ms ease-in-out;
transition: width 300ms ease-in-out;
}
.dropzone .dz-preview.dz-error .dz-error-message {
display: block;
}
.dropzone .dz-preview.dz-error:hover .dz-error-message {
opacity: 1;
pointer-events: auto;
}
.dropzone .dz-preview .dz-error-message {
pointer-events: none;
z-index: 1000;
position: absolute;
display: block;
display: none;
opacity: 0;
-webkit-transition: opacity 0.3s ease;
-moz-transition: opacity 0.3s ease;
-ms-transition: opacity 0.3s ease;
-o-transition: opacity 0.3s ease;
transition: opacity 0.3s ease;
border-radius: 8px;
font-size: 13px;
top: 130px;
left: -10px;
width: 140px;
background: #be2626;
background: linear-gradient(to bottom, #be2626, #a92222);
padding: 0.5em 1.2em;
color: white;
}
.dropzone .dz-preview .dz-error-message:after {
content: "";
position: absolute;
top: -6px;
left: 64px;
width: 0;
height: 0;
border-left: 6px solid transparent;
border-right: 6px solid transparent;
border-bottom: 6px solid #be2626;
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1 @@
.dropzone,.dropzone *{box-sizing:border-box}.dropzone{position:relative}.dropzone .dz-preview{position:relative;display:inline-block;width:120px;margin:.5em}.dropzone .dz-preview .dz-progress{display:block;height:15px;border:1px solid #aaa}.dropzone .dz-preview .dz-progress .dz-upload{display:block;height:100%;width:0;background:green}.dropzone .dz-preview .dz-error-message{color:red;display:none}.dropzone .dz-preview.dz-error .dz-error-message,.dropzone .dz-preview.dz-error .dz-error-mark{display:block}.dropzone .dz-preview.dz-success .dz-success-mark{display:block}.dropzone .dz-preview .dz-error-mark,.dropzone .dz-preview .dz-success-mark{position:absolute;display:none;left:30px;top:30px;width:54px;height:58px;left:50%;margin-left:-27px}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -4,7 +4,7 @@
* *
* uPlot.js (μPlot) * uPlot.js (μPlot)
* A small, fast chart for time series, lines, areas, ohlc & bars * A small, fast chart for time series, lines, areas, ohlc & bars
* https://github.com/leeoniya/uPlot (v1.6.3) * https://github.com/leeoniya/uPlot (v1.6.4)
*/ */
'use strict'; 'use strict';
@ -336,13 +336,13 @@ function assign(targ) {
} }
// nullModes // nullModes
const NULL_IGNORE = 0; // all nulls are ignored, converted to undefined (e.g. spanGaps: true) const NULL_REMOVE = 0; // nulls are converted to undefined (e.g. for spanGaps: true)
const NULL_GAP = 1; // nulls are retained, alignment artifacts = undefined values (default) const NULL_RETAIN = 1; // nulls are retained, with alignment artifacts set to undefined (default)
const NULL_EXPAND = 2; // nulls are expanded to include adjacent alignment artifacts (undefined values) const NULL_EXPAND = 2; // nulls are expanded to include any adjacent alignment artifacts
// mark all filler nulls as explicit when adjacent to existing explicit nulls (minesweeper) // sets undefined values to nulls when adjacent to existing nulls (minesweeper)
function nullExpand(yVals, nullIdxs, alignedLen) { function nullExpand(yVals, nullIdxs, alignedLen) {
for (let i = 0, xi, lastNullIdx = -inf; i < nullIdxs.length; i++) { for (let i = 0, xi, lastNullIdx = -1; i < nullIdxs.length; i++) {
let nullIdx = nullIdxs[i]; let nullIdx = nullIdxs[i];
if (nullIdx > lastNullIdx) { if (nullIdx > lastNullIdx) {
@ -358,10 +358,8 @@ function nullExpand(yVals, nullIdxs, alignedLen) {
} }
// nullModes is a tables-matched array indicating how to treat nulls in each series // nullModes is a tables-matched array indicating how to treat nulls in each series
// output is sorted ASC on the joined field (table[0]) and duplicate join values are collapsed
function join(tables, nullModes) { function join(tables, nullModes) {
if (tables.length == 1)
return tables[0];
let xVals = new Set(); let xVals = new Set();
for (let ti = 0; ti < tables.length; ti++) { for (let ti = 0; ti < tables.length; ti++) {
@ -391,7 +389,7 @@ function join(tables, nullModes) {
let yVals = Array(alignedLen).fill(undefined); let yVals = Array(alignedLen).fill(undefined);
let nullMode = nullModes ? nullModes[ti][si] : NULL_GAP; let nullMode = nullModes ? nullModes[ti][si] : NULL_RETAIN;
let nullIdxs = []; let nullIdxs = [];
@ -400,7 +398,7 @@ function join(tables, nullModes) {
let alignedIdx = xIdxs.get(xs[i]); let alignedIdx = xIdxs.get(xs[i]);
if (yVal == null) { if (yVal == null) {
if (nullMode != NULL_IGNORE) { if (nullMode != NULL_REMOVE) {
yVals[alignedIdx] = yVal; yVals[alignedIdx] = yVal;
if (nullMode == NULL_EXPAND) if (nullMode == NULL_EXPAND)
@ -874,7 +872,7 @@ const [ timeIncrsMs, _timeAxisStampsMs, timeAxisSplitsMs ] = genTimeStuffs(1);
const [ timeIncrsS, _timeAxisStampsS, timeAxisSplitsS ] = genTimeStuffs(1e-3); const [ timeIncrsS, _timeAxisStampsS, timeAxisSplitsS ] = genTimeStuffs(1e-3);
// base 2 // base 2
const binIncrs = genIncrs(2, -53, 53, [1]); genIncrs(2, -53, 53, [1]);
/* /*
console.log({ console.log({
@ -1468,9 +1466,11 @@ function bezierCurveToH(p, bp1x, bp1y, bp2x, bp2y, p2x, p2y) { p.bezierCurveTo(b
function _drawAcc(lineTo) { function _drawAcc(lineTo) {
return (stroke, accX, minY, maxY, outY) => { return (stroke, accX, minY, maxY, outY) => {
lineTo(stroke, accX, minY); if (minY != maxY) {
lineTo(stroke, accX, maxY); lineTo(stroke, accX, minY);
lineTo(stroke, accX, outY); lineTo(stroke, accX, maxY);
lineTo(stroke, accX, outY);
}
}; };
} }
@ -2089,6 +2089,8 @@ function uPlot(opts, data, then) {
opts = copy(opts); opts = copy(opts);
const pxAlign = ifNull(opts.pxAlign, true);
(opts.plugins || []).forEach(p => { (opts.plugins || []).forEach(p => {
if (p.opts) if (p.opts)
opts = p.opts(self, opts) || opts; opts = p.opts(self, opts) || opts;
@ -2553,10 +2555,11 @@ function uPlot(opts, data, then) {
s.width = s.width == null ? 1 : s.width; s.width = s.width == null ? 1 : s.width;
s.paths = s.paths || linearPath || retNull; s.paths = s.paths || linearPath || retNull;
s.fillTo = fnOrSelf(s.fillTo || seriesFillTo); s.fillTo = fnOrSelf(s.fillTo || seriesFillTo);
s.pxAlign = ifNull(s.pxAlign, true);
s.stroke = fnOrSelf(s.stroke || null); s.stroke = fnOrSelf(s.stroke || null);
s.fill = fnOrSelf(s.fill || null); s.fill = fnOrSelf(s.fill || null);
s._stroke = s._fill = s._paths = null; s._stroke = s._fill = s._paths = s._focus = null;
let _ptDia = ptDia(s.width, 1); let _ptDia = ptDia(s.width, 1);
let points = s.points = assign({}, { let points = s.points = assign({}, {
@ -2916,7 +2919,9 @@ function uPlot(opts, data, then) {
let rad = (p.size - p.width) / 2 * pxRatio; let rad = (p.size - p.width) / 2 * pxRatio;
let dia = roundDec(rad * 2, 3); let dia = roundDec(rad * 2, 3);
ctx.translate(offset, offset); const _pxAlign = pxAlign && s.pxAlign;
_pxAlign && ctx.translate(offset, offset);
ctx.save(); ctx.save();
@ -2978,7 +2983,7 @@ function uPlot(opts, data, then) {
ctx.restore(); ctx.restore();
ctx.translate(-offset, -offset); _pxAlign && ctx.translate(-offset, -offset);
} }
// grabs the nearest indices with y data outside of x-scale limits // grabs the nearest indices with y data outside of x-scale limits
@ -3025,14 +3030,14 @@ function uPlot(opts, data, then) {
const width = roundDec(s.width * pxRatio, 3); const width = roundDec(s.width * pxRatio, 3);
const offset = (width % 2) / 2; const offset = (width % 2) / 2;
const _stroke = s._stroke = s.stroke(self, si); const strokeStyle = s._stroke = s.stroke(self, si);
const _fill = s._fill = s.fill(self, si); const fillStyle = s._fill = s.fill(self, si);
setCtxStyle(_stroke, width, s.dash, s.cap, _fill);
ctx.globalAlpha = s.alpha; ctx.globalAlpha = s.alpha;
ctx.translate(offset, offset); const _pxAlign = pxAlign && s.pxAlign;
_pxAlign && ctx.translate(offset, offset);
ctx.save(); ctx.save();
@ -3057,43 +3062,53 @@ function uPlot(opts, data, then) {
clip && ctx.clip(clip); clip && ctx.clip(clip);
let isUpperEdge = fillBands(si, _fill); fillStroke(si, strokeStyle, width, s.dash, s.cap, fillStyle, stroke, fill);
!isUpperEdge && _fill && fill && ctx.fill(fill);
width && _stroke && stroke && ctx.stroke(stroke);
ctx.restore(); ctx.restore();
ctx.translate(-offset, -offset); _pxAlign && ctx.translate(-offset, -offset);
ctx.globalAlpha = 1; ctx.globalAlpha = 1;
} }
function fillBands(si, seriesFill) { function fillStroke(si, strokeStyle, lineWidth, lineDash, lineCap, fillStyle, strokePath, fillPath) {
let isUpperEdge = false; let didStrokeFill = false;
let s = series[si];
// for all bands where this series is the top edge, create upwards clips using the bottom edges // for all bands where this series is the top edge, create upwards clips using the bottom edges
// and apply clips + fill with band fill or dfltFill // and apply clips + fill with band fill or dfltFill
bands.forEach((b, bi) => { bands.forEach((b, bi) => {
// isUpperEdge?
if (b.series[0] == si) { if (b.series[0] == si) {
isUpperEdge = true;
let lowerEdge = series[b.series[1]]; let lowerEdge = series[b.series[1]];
let clip = (lowerEdge._paths || EMPTY_OBJ).band; let clip = (lowerEdge._paths || EMPTY_OBJ).band;
ctx.save();
let _fillStyle = null;
// hasLowerEdge?
if (lowerEdge.show && clip) { if (lowerEdge.show && clip) {
ctx.save(); _fillStyle = b.fill(self, bi) || fillStyle;
setCtxStyle(null, null, null, null, b.fill(self, bi) || seriesFill);
ctx.clip(clip); ctx.clip(clip);
ctx.fill(s._paths.fill);
ctx.restore();
} }
strokeFill(strokeStyle, lineWidth, lineDash, lineCap, _fillStyle, strokePath, fillPath);
ctx.restore();
didStrokeFill = true;
} }
}); });
return isUpperEdge; if (!didStrokeFill)
strokeFill(strokeStyle, lineWidth, lineDash, lineCap, fillStyle, strokePath, fillPath);
}
function strokeFill(strokeStyle, lineWidth, lineDash, lineCap, fillStyle, strokePath, fillPath) {
setCtxStyle(strokeStyle, lineWidth, lineDash, lineCap, fillStyle);
fillStyle && fillPath && ctx.fill(fillPath);
strokeStyle && strokePath && lineWidth && ctx.stroke(strokePath);
} }
function getIncrSpace(axisIdx, min, max, fullDim) { function getIncrSpace(axisIdx, min, max, fullDim) {
@ -3115,7 +3130,7 @@ function uPlot(opts, data, then) {
function drawOrthoLines(offs, filts, ori, side, pos0, len, width, stroke, dash, cap) { function drawOrthoLines(offs, filts, ori, side, pos0, len, width, stroke, dash, cap) {
let offset = (width % 2) / 2; let offset = (width % 2) / 2;
ctx.translate(offset, offset); pxAlign && ctx.translate(offset, offset);
setCtxStyle(stroke, width, dash, cap); setCtxStyle(stroke, width, dash, cap);
@ -3147,7 +3162,7 @@ function uPlot(opts, data, then) {
ctx.stroke(); ctx.stroke();
ctx.translate(-offset, -offset); pxAlign && ctx.translate(-offset, -offset);
} }
function axesCalc(cycleNum) { function axesCalc(cycleNum) {
@ -3197,7 +3212,7 @@ function uPlot(opts, data, then) {
let splits = scale.distr == 2 ? _splits.map(i => data0[i]) : _splits; let splits = scale.distr == 2 ? _splits.map(i => data0[i]) : _splits;
let incr = scale.distr == 2 ? data0[_splits[1]] - data0[_splits[0]] : _incr; let incr = scale.distr == 2 ? data0[_splits[1]] - data0[_splits[0]] : _incr;
let values = axis._values = axis.values(self, axis.filter(self, splits, i, _space, incr), i, _space, incr); let values = axis._values = axis.values(self, axis.filter(self, splits, i, _space, incr), i, _space, incr);
// rotating of labels only supported on bottom x axis // rotating of labels only supported on bottom x axis
axis._rotate = side == 2 ? axis.rotate(self, values, i, _space) : 0; axis._rotate = side == 2 ? axis.rotate(self, values, i, _space) : 0;
@ -3240,7 +3255,7 @@ function uPlot(opts, data, then) {
let plotDim = ori == 0 ? plotWid : plotHgt; let plotDim = ori == 0 ? plotWid : plotHgt;
let plotOff = ori == 0 ? plotLft : plotTop; let plotOff = ori == 0 ? plotLft : plotTop;
let axisGap = round(axis.gap * pxRatio); let axisGap = round(axis.gap * pxRatio);
let ticks = axis.ticks; let ticks = axis.ticks;
let tickSize = ticks.show ? round(ticks.size * pxRatio) : 0; let tickSize = ticks.show ? round(ticks.size * pxRatio) : 0;
@ -3273,7 +3288,7 @@ function uPlot(opts, data, then) {
ctx.textBaseline = angle || ctx.textBaseline = angle ||
ori == 1 ? "middle" : side == 2 ? TOP : BOTTOM; ori == 1 ? "middle" : side == 2 ? TOP : BOTTOM;
let lineHeight = axis.font[1] * lineMult; let lineHeight = axis.font[1] * lineMult;
let canOffs = _splits.map(val => round(getPos(val, scale, plotDim, plotOff))); let canOffs = _splits.map(val => round(getPos(val, scale, plotDim, plotOff)));
@ -3464,7 +3479,9 @@ function uPlot(opts, data, then) {
queuedCommit = false; queuedCommit = false;
} }
self.redraw = rebuildPaths => { self.redraw = (rebuildPaths, recalcAxes) => {
shouldConvergeSize = recalcAxes || false;
if (rebuildPaths !== false) if (rebuildPaths !== false)
_setScale(xScaleKey, scaleX.min, scaleX.max); _setScale(xScaleKey, scaleX.min, scaleX.max);
else else
@ -3563,10 +3580,10 @@ function uPlot(opts, data, then) {
const select = self.select = assign({ const select = self.select = assign({
show: true, show: true,
over: true, over: true,
left: 0, left: 0,
width: 0, width: 0,
top: 0, top: 0,
height: 0, height: 0,
}, opts.select); }, opts.select);
const selectDiv = select.show ? placeDiv(SELECT, select.over ? over : under) : null; const selectDiv = select.show ? placeDiv(SELECT, select.over ? over : under) : null;
@ -3648,8 +3665,12 @@ function uPlot(opts, data, then) {
if (i != focusedSeries) { if (i != focusedSeries) {
// log("setFocus()", arguments); // log("setFocus()", arguments);
let allFocused = i == null;
series.forEach((s, i2) => { series.forEach((s, i2) => {
_setAlpha(i2, i == null || i2 == 0 || i2 == i ? 1 : focus.alpha); let isFocused = allFocused || i2 == 0 || i2 == i;
s._focus = allFocused ? null : isFocused;
_setAlpha(i2, isFocused ? 1 : focus.alpha);
}); });
focusedSeries = i; focusedSeries = i;

View file

@ -4,7 +4,7 @@
* *
* uPlot.js (μPlot) * uPlot.js (μPlot)
* A small, fast chart for time series, lines, areas, ohlc & bars * A small, fast chart for time series, lines, areas, ohlc & bars
* https://github.com/leeoniya/uPlot (v1.6.3) * https://github.com/leeoniya/uPlot (v1.6.4)
*/ */
const FEAT_TIME = true; const FEAT_TIME = true;
@ -334,13 +334,13 @@ function assign(targ) {
} }
// nullModes // nullModes
const NULL_IGNORE = 0; // all nulls are ignored, converted to undefined (e.g. spanGaps: true) const NULL_REMOVE = 0; // nulls are converted to undefined (e.g. for spanGaps: true)
const NULL_GAP = 1; // nulls are retained, alignment artifacts = undefined values (default) const NULL_RETAIN = 1; // nulls are retained, with alignment artifacts set to undefined (default)
const NULL_EXPAND = 2; // nulls are expanded to include adjacent alignment artifacts (undefined values) const NULL_EXPAND = 2; // nulls are expanded to include any adjacent alignment artifacts
// mark all filler nulls as explicit when adjacent to existing explicit nulls (minesweeper) // sets undefined values to nulls when adjacent to existing nulls (minesweeper)
function nullExpand(yVals, nullIdxs, alignedLen) { function nullExpand(yVals, nullIdxs, alignedLen) {
for (let i = 0, xi, lastNullIdx = -inf; i < nullIdxs.length; i++) { for (let i = 0, xi, lastNullIdx = -1; i < nullIdxs.length; i++) {
let nullIdx = nullIdxs[i]; let nullIdx = nullIdxs[i];
if (nullIdx > lastNullIdx) { if (nullIdx > lastNullIdx) {
@ -356,10 +356,8 @@ function nullExpand(yVals, nullIdxs, alignedLen) {
} }
// nullModes is a tables-matched array indicating how to treat nulls in each series // nullModes is a tables-matched array indicating how to treat nulls in each series
// output is sorted ASC on the joined field (table[0]) and duplicate join values are collapsed
function join(tables, nullModes) { function join(tables, nullModes) {
if (tables.length == 1)
return tables[0];
let xVals = new Set(); let xVals = new Set();
for (let ti = 0; ti < tables.length; ti++) { for (let ti = 0; ti < tables.length; ti++) {
@ -389,7 +387,7 @@ function join(tables, nullModes) {
let yVals = Array(alignedLen).fill(undefined); let yVals = Array(alignedLen).fill(undefined);
let nullMode = nullModes ? nullModes[ti][si] : NULL_GAP; let nullMode = nullModes ? nullModes[ti][si] : NULL_RETAIN;
let nullIdxs = []; let nullIdxs = [];
@ -398,7 +396,7 @@ function join(tables, nullModes) {
let alignedIdx = xIdxs.get(xs[i]); let alignedIdx = xIdxs.get(xs[i]);
if (yVal == null) { if (yVal == null) {
if (nullMode != NULL_IGNORE) { if (nullMode != NULL_REMOVE) {
yVals[alignedIdx] = yVal; yVals[alignedIdx] = yVal;
if (nullMode == NULL_EXPAND) if (nullMode == NULL_EXPAND)
@ -872,7 +870,7 @@ const [ timeIncrsMs, _timeAxisStampsMs, timeAxisSplitsMs ] = genTimeStuffs(1);
const [ timeIncrsS, _timeAxisStampsS, timeAxisSplitsS ] = genTimeStuffs(1e-3); const [ timeIncrsS, _timeAxisStampsS, timeAxisSplitsS ] = genTimeStuffs(1e-3);
// base 2 // base 2
const binIncrs = genIncrs(2, -53, 53, [1]); genIncrs(2, -53, 53, [1]);
/* /*
console.log({ console.log({
@ -1466,9 +1464,11 @@ function bezierCurveToH(p, bp1x, bp1y, bp2x, bp2y, p2x, p2y) { p.bezierCurveTo(b
function _drawAcc(lineTo) { function _drawAcc(lineTo) {
return (stroke, accX, minY, maxY, outY) => { return (stroke, accX, minY, maxY, outY) => {
lineTo(stroke, accX, minY); if (minY != maxY) {
lineTo(stroke, accX, maxY); lineTo(stroke, accX, minY);
lineTo(stroke, accX, outY); lineTo(stroke, accX, maxY);
lineTo(stroke, accX, outY);
}
}; };
} }
@ -2087,6 +2087,8 @@ function uPlot(opts, data, then) {
opts = copy(opts); opts = copy(opts);
const pxAlign = ifNull(opts.pxAlign, true);
(opts.plugins || []).forEach(p => { (opts.plugins || []).forEach(p => {
if (p.opts) if (p.opts)
opts = p.opts(self, opts) || opts; opts = p.opts(self, opts) || opts;
@ -2551,10 +2553,11 @@ function uPlot(opts, data, then) {
s.width = s.width == null ? 1 : s.width; s.width = s.width == null ? 1 : s.width;
s.paths = s.paths || linearPath || retNull; s.paths = s.paths || linearPath || retNull;
s.fillTo = fnOrSelf(s.fillTo || seriesFillTo); s.fillTo = fnOrSelf(s.fillTo || seriesFillTo);
s.pxAlign = ifNull(s.pxAlign, true);
s.stroke = fnOrSelf(s.stroke || null); s.stroke = fnOrSelf(s.stroke || null);
s.fill = fnOrSelf(s.fill || null); s.fill = fnOrSelf(s.fill || null);
s._stroke = s._fill = s._paths = null; s._stroke = s._fill = s._paths = s._focus = null;
let _ptDia = ptDia(s.width, 1); let _ptDia = ptDia(s.width, 1);
let points = s.points = assign({}, { let points = s.points = assign({}, {
@ -2914,7 +2917,9 @@ function uPlot(opts, data, then) {
let rad = (p.size - p.width) / 2 * pxRatio; let rad = (p.size - p.width) / 2 * pxRatio;
let dia = roundDec(rad * 2, 3); let dia = roundDec(rad * 2, 3);
ctx.translate(offset, offset); const _pxAlign = pxAlign && s.pxAlign;
_pxAlign && ctx.translate(offset, offset);
ctx.save(); ctx.save();
@ -2976,7 +2981,7 @@ function uPlot(opts, data, then) {
ctx.restore(); ctx.restore();
ctx.translate(-offset, -offset); _pxAlign && ctx.translate(-offset, -offset);
} }
// grabs the nearest indices with y data outside of x-scale limits // grabs the nearest indices with y data outside of x-scale limits
@ -3023,14 +3028,14 @@ function uPlot(opts, data, then) {
const width = roundDec(s.width * pxRatio, 3); const width = roundDec(s.width * pxRatio, 3);
const offset = (width % 2) / 2; const offset = (width % 2) / 2;
const _stroke = s._stroke = s.stroke(self, si); const strokeStyle = s._stroke = s.stroke(self, si);
const _fill = s._fill = s.fill(self, si); const fillStyle = s._fill = s.fill(self, si);
setCtxStyle(_stroke, width, s.dash, s.cap, _fill);
ctx.globalAlpha = s.alpha; ctx.globalAlpha = s.alpha;
ctx.translate(offset, offset); const _pxAlign = pxAlign && s.pxAlign;
_pxAlign && ctx.translate(offset, offset);
ctx.save(); ctx.save();
@ -3055,43 +3060,53 @@ function uPlot(opts, data, then) {
clip && ctx.clip(clip); clip && ctx.clip(clip);
let isUpperEdge = fillBands(si, _fill); fillStroke(si, strokeStyle, width, s.dash, s.cap, fillStyle, stroke, fill);
!isUpperEdge && _fill && fill && ctx.fill(fill);
width && _stroke && stroke && ctx.stroke(stroke);
ctx.restore(); ctx.restore();
ctx.translate(-offset, -offset); _pxAlign && ctx.translate(-offset, -offset);
ctx.globalAlpha = 1; ctx.globalAlpha = 1;
} }
function fillBands(si, seriesFill) { function fillStroke(si, strokeStyle, lineWidth, lineDash, lineCap, fillStyle, strokePath, fillPath) {
let isUpperEdge = false; let didStrokeFill = false;
let s = series[si];
// for all bands where this series is the top edge, create upwards clips using the bottom edges // for all bands where this series is the top edge, create upwards clips using the bottom edges
// and apply clips + fill with band fill or dfltFill // and apply clips + fill with band fill or dfltFill
bands.forEach((b, bi) => { bands.forEach((b, bi) => {
// isUpperEdge?
if (b.series[0] == si) { if (b.series[0] == si) {
isUpperEdge = true;
let lowerEdge = series[b.series[1]]; let lowerEdge = series[b.series[1]];
let clip = (lowerEdge._paths || EMPTY_OBJ).band; let clip = (lowerEdge._paths || EMPTY_OBJ).band;
ctx.save();
let _fillStyle = null;
// hasLowerEdge?
if (lowerEdge.show && clip) { if (lowerEdge.show && clip) {
ctx.save(); _fillStyle = b.fill(self, bi) || fillStyle;
setCtxStyle(null, null, null, null, b.fill(self, bi) || seriesFill);
ctx.clip(clip); ctx.clip(clip);
ctx.fill(s._paths.fill);
ctx.restore();
} }
strokeFill(strokeStyle, lineWidth, lineDash, lineCap, _fillStyle, strokePath, fillPath);
ctx.restore();
didStrokeFill = true;
} }
}); });
return isUpperEdge; if (!didStrokeFill)
strokeFill(strokeStyle, lineWidth, lineDash, lineCap, fillStyle, strokePath, fillPath);
}
function strokeFill(strokeStyle, lineWidth, lineDash, lineCap, fillStyle, strokePath, fillPath) {
setCtxStyle(strokeStyle, lineWidth, lineDash, lineCap, fillStyle);
fillStyle && fillPath && ctx.fill(fillPath);
strokeStyle && strokePath && lineWidth && ctx.stroke(strokePath);
} }
function getIncrSpace(axisIdx, min, max, fullDim) { function getIncrSpace(axisIdx, min, max, fullDim) {
@ -3113,7 +3128,7 @@ function uPlot(opts, data, then) {
function drawOrthoLines(offs, filts, ori, side, pos0, len, width, stroke, dash, cap) { function drawOrthoLines(offs, filts, ori, side, pos0, len, width, stroke, dash, cap) {
let offset = (width % 2) / 2; let offset = (width % 2) / 2;
ctx.translate(offset, offset); pxAlign && ctx.translate(offset, offset);
setCtxStyle(stroke, width, dash, cap); setCtxStyle(stroke, width, dash, cap);
@ -3145,7 +3160,7 @@ function uPlot(opts, data, then) {
ctx.stroke(); ctx.stroke();
ctx.translate(-offset, -offset); pxAlign && ctx.translate(-offset, -offset);
} }
function axesCalc(cycleNum) { function axesCalc(cycleNum) {
@ -3195,7 +3210,7 @@ function uPlot(opts, data, then) {
let splits = scale.distr == 2 ? _splits.map(i => data0[i]) : _splits; let splits = scale.distr == 2 ? _splits.map(i => data0[i]) : _splits;
let incr = scale.distr == 2 ? data0[_splits[1]] - data0[_splits[0]] : _incr; let incr = scale.distr == 2 ? data0[_splits[1]] - data0[_splits[0]] : _incr;
let values = axis._values = axis.values(self, axis.filter(self, splits, i, _space, incr), i, _space, incr); let values = axis._values = axis.values(self, axis.filter(self, splits, i, _space, incr), i, _space, incr);
// rotating of labels only supported on bottom x axis // rotating of labels only supported on bottom x axis
axis._rotate = side == 2 ? axis.rotate(self, values, i, _space) : 0; axis._rotate = side == 2 ? axis.rotate(self, values, i, _space) : 0;
@ -3238,7 +3253,7 @@ function uPlot(opts, data, then) {
let plotDim = ori == 0 ? plotWid : plotHgt; let plotDim = ori == 0 ? plotWid : plotHgt;
let plotOff = ori == 0 ? plotLft : plotTop; let plotOff = ori == 0 ? plotLft : plotTop;
let axisGap = round(axis.gap * pxRatio); let axisGap = round(axis.gap * pxRatio);
let ticks = axis.ticks; let ticks = axis.ticks;
let tickSize = ticks.show ? round(ticks.size * pxRatio) : 0; let tickSize = ticks.show ? round(ticks.size * pxRatio) : 0;
@ -3271,7 +3286,7 @@ function uPlot(opts, data, then) {
ctx.textBaseline = angle || ctx.textBaseline = angle ||
ori == 1 ? "middle" : side == 2 ? TOP : BOTTOM; ori == 1 ? "middle" : side == 2 ? TOP : BOTTOM;
let lineHeight = axis.font[1] * lineMult; let lineHeight = axis.font[1] * lineMult;
let canOffs = _splits.map(val => round(getPos(val, scale, plotDim, plotOff))); let canOffs = _splits.map(val => round(getPos(val, scale, plotDim, plotOff)));
@ -3462,7 +3477,9 @@ function uPlot(opts, data, then) {
queuedCommit = false; queuedCommit = false;
} }
self.redraw = rebuildPaths => { self.redraw = (rebuildPaths, recalcAxes) => {
shouldConvergeSize = recalcAxes || false;
if (rebuildPaths !== false) if (rebuildPaths !== false)
_setScale(xScaleKey, scaleX.min, scaleX.max); _setScale(xScaleKey, scaleX.min, scaleX.max);
else else
@ -3561,10 +3578,10 @@ function uPlot(opts, data, then) {
const select = self.select = assign({ const select = self.select = assign({
show: true, show: true,
over: true, over: true,
left: 0, left: 0,
width: 0, width: 0,
top: 0, top: 0,
height: 0, height: 0,
}, opts.select); }, opts.select);
const selectDiv = select.show ? placeDiv(SELECT, select.over ? over : under) : null; const selectDiv = select.show ? placeDiv(SELECT, select.over ? over : under) : null;
@ -3646,8 +3663,12 @@ function uPlot(opts, data, then) {
if (i != focusedSeries) { if (i != focusedSeries) {
// log("setFocus()", arguments); // log("setFocus()", arguments);
let allFocused = i == null;
series.forEach((s, i2) => { series.forEach((s, i2) => {
_setAlpha(i2, i == null || i2 == 0 || i2 == i ? 1 : focus.alpha); let isFocused = allFocused || i2 == 0 || i2 == i;
s._focus = allFocused ? null : isFocused;
_setAlpha(i2, isFocused ? 1 : focus.alpha);
}); });
focusedSeries = i; focusedSeries = i;

View file

@ -4,7 +4,7 @@
* *
* uPlot.js (μPlot) * uPlot.js (μPlot)
* A small, fast chart for time series, lines, areas, ohlc & bars * A small, fast chart for time series, lines, areas, ohlc & bars
* https://github.com/leeoniya/uPlot (v1.6.3) * https://github.com/leeoniya/uPlot (v1.6.4)
*/ */
var uPlot = (function () { var uPlot = (function () {
@ -336,13 +336,13 @@ var uPlot = (function () {
} }
// nullModes // nullModes
var NULL_IGNORE = 0; // all nulls are ignored, converted to undefined (e.g. spanGaps: true) var NULL_REMOVE = 0; // nulls are converted to undefined (e.g. for spanGaps: true)
var NULL_GAP = 1; // nulls are retained, alignment artifacts = undefined values (default) var NULL_RETAIN = 1; // nulls are retained, with alignment artifacts set to undefined (default)
var NULL_EXPAND = 2; // nulls are expanded to include adjacent alignment artifacts (undefined values) var NULL_EXPAND = 2; // nulls are expanded to include any adjacent alignment artifacts
// mark all filler nulls as explicit when adjacent to existing explicit nulls (minesweeper) // sets undefined values to nulls when adjacent to existing nulls (minesweeper)
function nullExpand(yVals, nullIdxs, alignedLen) { function nullExpand(yVals, nullIdxs, alignedLen) {
for (var i = 0, xi = (void 0), lastNullIdx = -inf; i < nullIdxs.length; i++) { for (var i = 0, xi = (void 0), lastNullIdx = -1; i < nullIdxs.length; i++) {
var nullIdx = nullIdxs[i]; var nullIdx = nullIdxs[i];
if (nullIdx > lastNullIdx) { if (nullIdx > lastNullIdx) {
@ -358,10 +358,8 @@ var uPlot = (function () {
} }
// nullModes is a tables-matched array indicating how to treat nulls in each series // nullModes is a tables-matched array indicating how to treat nulls in each series
// output is sorted ASC on the joined field (table[0]) and duplicate join values are collapsed
function join(tables, nullModes) { function join(tables, nullModes) {
if (tables.length == 1)
{ return tables[0]; }
var xVals = new Set(); var xVals = new Set();
for (var ti = 0; ti < tables.length; ti++) { for (var ti = 0; ti < tables.length; ti++) {
@ -391,7 +389,7 @@ var uPlot = (function () {
var yVals = Array(alignedLen).fill(undefined); var yVals = Array(alignedLen).fill(undefined);
var nullMode = nullModes ? nullModes[ti$1][si] : NULL_GAP; var nullMode = nullModes ? nullModes[ti$1][si] : NULL_RETAIN;
var nullIdxs = []; var nullIdxs = [];
@ -400,7 +398,7 @@ var uPlot = (function () {
var alignedIdx = xIdxs.get(xs$1[i$2]); var alignedIdx = xIdxs.get(xs$1[i$2]);
if (yVal == null) { if (yVal == null) {
if (nullMode != NULL_IGNORE) { if (nullMode != NULL_REMOVE) {
yVals[alignedIdx] = yVal; yVals[alignedIdx] = yVal;
if (nullMode == NULL_EXPAND) if (nullMode == NULL_EXPAND)
@ -875,7 +873,7 @@ var uPlot = (function () {
var timeAxisSplitsS = ref$1[2]; var timeAxisSplitsS = ref$1[2];
// base 2 // base 2
var binIncrs = genIncrs(2, -53, 53, [1]); genIncrs(2, -53, 53, [1]);
/* /*
console.log({ console.log({
@ -1469,9 +1467,11 @@ var uPlot = (function () {
function _drawAcc(lineTo) { function _drawAcc(lineTo) {
return (stroke, accX, minY, maxY, outY) => { return (stroke, accX, minY, maxY, outY) => {
lineTo(stroke, accX, minY); if (minY != maxY) {
lineTo(stroke, accX, maxY); lineTo(stroke, accX, minY);
lineTo(stroke, accX, outY); lineTo(stroke, accX, maxY);
lineTo(stroke, accX, outY);
}
}; };
} }
@ -2083,6 +2083,8 @@ var uPlot = (function () {
opts = copy(opts); opts = copy(opts);
var pxAlign = ifNull(opts.pxAlign, true);
(opts.plugins || []).forEach(p => { (opts.plugins || []).forEach(p => {
if (p.opts) if (p.opts)
{ opts = p.opts(self, opts) || opts; } { opts = p.opts(self, opts) || opts; }
@ -2551,10 +2553,11 @@ var uPlot = (function () {
s.width = s.width == null ? 1 : s.width; s.width = s.width == null ? 1 : s.width;
s.paths = s.paths || linearPath || retNull; s.paths = s.paths || linearPath || retNull;
s.fillTo = fnOrSelf(s.fillTo || seriesFillTo); s.fillTo = fnOrSelf(s.fillTo || seriesFillTo);
s.pxAlign = ifNull(s.pxAlign, true);
s.stroke = fnOrSelf(s.stroke || null); s.stroke = fnOrSelf(s.stroke || null);
s.fill = fnOrSelf(s.fill || null); s.fill = fnOrSelf(s.fill || null);
s._stroke = s._fill = s._paths = null; s._stroke = s._fill = s._paths = s._focus = null;
var _ptDia = ptDia(s.width, 1); var _ptDia = ptDia(s.width, 1);
var points = s.points = assign({}, { var points = s.points = assign({}, {
@ -2919,7 +2922,9 @@ var uPlot = (function () {
var rad = (p.size - p.width) / 2 * pxRatio; var rad = (p.size - p.width) / 2 * pxRatio;
var dia = roundDec(rad * 2, 3); var dia = roundDec(rad * 2, 3);
ctx.translate(offset, offset); var _pxAlign = pxAlign && s.pxAlign;
_pxAlign && ctx.translate(offset, offset);
ctx.save(); ctx.save();
@ -2981,7 +2986,7 @@ var uPlot = (function () {
ctx.restore(); ctx.restore();
ctx.translate(-offset, -offset); _pxAlign && ctx.translate(-offset, -offset);
} }
// grabs the nearest indices with y data outside of x-scale limits // grabs the nearest indices with y data outside of x-scale limits
@ -3031,14 +3036,14 @@ var uPlot = (function () {
var width = roundDec(s.width * pxRatio, 3); var width = roundDec(s.width * pxRatio, 3);
var offset = (width % 2) / 2; var offset = (width % 2) / 2;
var _stroke = s._stroke = s.stroke(self, si); var strokeStyle = s._stroke = s.stroke(self, si);
var _fill = s._fill = s.fill(self, si); var fillStyle = s._fill = s.fill(self, si);
setCtxStyle(_stroke, width, s.dash, s.cap, _fill);
ctx.globalAlpha = s.alpha; ctx.globalAlpha = s.alpha;
ctx.translate(offset, offset); var _pxAlign = pxAlign && s.pxAlign;
_pxAlign && ctx.translate(offset, offset);
ctx.save(); ctx.save();
@ -3063,43 +3068,53 @@ var uPlot = (function () {
clip && ctx.clip(clip); clip && ctx.clip(clip);
var isUpperEdge = fillBands(si, _fill); fillStroke(si, strokeStyle, width, s.dash, s.cap, fillStyle, stroke, fill);
!isUpperEdge && _fill && fill && ctx.fill(fill);
width && _stroke && stroke && ctx.stroke(stroke);
ctx.restore(); ctx.restore();
ctx.translate(-offset, -offset); _pxAlign && ctx.translate(-offset, -offset);
ctx.globalAlpha = 1; ctx.globalAlpha = 1;
} }
function fillBands(si, seriesFill) { function fillStroke(si, strokeStyle, lineWidth, lineDash, lineCap, fillStyle, strokePath, fillPath) {
var isUpperEdge = false; var didStrokeFill = false;
var s = series[si];
// for all bands where this series is the top edge, create upwards clips using the bottom edges // for all bands where this series is the top edge, create upwards clips using the bottom edges
// and apply clips + fill with band fill or dfltFill // and apply clips + fill with band fill or dfltFill
bands.forEach((b, bi) => { bands.forEach((b, bi) => {
// isUpperEdge?
if (b.series[0] == si) { if (b.series[0] == si) {
isUpperEdge = true;
var lowerEdge = series[b.series[1]]; var lowerEdge = series[b.series[1]];
var clip = (lowerEdge._paths || EMPTY_OBJ).band; var clip = (lowerEdge._paths || EMPTY_OBJ).band;
ctx.save();
var _fillStyle = null;
// hasLowerEdge?
if (lowerEdge.show && clip) { if (lowerEdge.show && clip) {
ctx.save(); _fillStyle = b.fill(self, bi) || fillStyle;
setCtxStyle(null, null, null, null, b.fill(self, bi) || seriesFill);
ctx.clip(clip); ctx.clip(clip);
ctx.fill(s._paths.fill);
ctx.restore();
} }
strokeFill(strokeStyle, lineWidth, lineDash, lineCap, _fillStyle, strokePath, fillPath);
ctx.restore();
didStrokeFill = true;
} }
}); });
return isUpperEdge; if (!didStrokeFill)
{ strokeFill(strokeStyle, lineWidth, lineDash, lineCap, fillStyle, strokePath, fillPath); }
}
function strokeFill(strokeStyle, lineWidth, lineDash, lineCap, fillStyle, strokePath, fillPath) {
setCtxStyle(strokeStyle, lineWidth, lineDash, lineCap, fillStyle);
fillStyle && fillPath && ctx.fill(fillPath);
strokeStyle && strokePath && lineWidth && ctx.stroke(strokePath);
} }
function getIncrSpace(axisIdx, min, max, fullDim) { function getIncrSpace(axisIdx, min, max, fullDim) {
@ -3121,7 +3136,7 @@ var uPlot = (function () {
function drawOrthoLines(offs, filts, ori, side, pos0, len, width, stroke, dash, cap) { function drawOrthoLines(offs, filts, ori, side, pos0, len, width, stroke, dash, cap) {
var offset = (width % 2) / 2; var offset = (width % 2) / 2;
ctx.translate(offset, offset); pxAlign && ctx.translate(offset, offset);
setCtxStyle(stroke, width, dash, cap); setCtxStyle(stroke, width, dash, cap);
@ -3153,7 +3168,7 @@ var uPlot = (function () {
ctx.stroke(); ctx.stroke();
ctx.translate(-offset, -offset); pxAlign && ctx.translate(-offset, -offset);
} }
function axesCalc(cycleNum) { function axesCalc(cycleNum) {
@ -3206,7 +3221,7 @@ var uPlot = (function () {
var splits = scale.distr == 2 ? _splits.map(i => data0[i]) : _splits; var splits = scale.distr == 2 ? _splits.map(i => data0[i]) : _splits;
var incr = scale.distr == 2 ? data0[_splits[1]] - data0[_splits[0]] : _incr; var incr = scale.distr == 2 ? data0[_splits[1]] - data0[_splits[0]] : _incr;
var values = axis._values = axis.values(self, axis.filter(self, splits, i, _space, incr), i, _space, incr); var values = axis._values = axis.values(self, axis.filter(self, splits, i, _space, incr), i, _space, incr);
// rotating of labels only supported on bottom x axis // rotating of labels only supported on bottom x axis
axis._rotate = side == 2 ? axis.rotate(self, values, i, _space) : 0; axis._rotate = side == 2 ? axis.rotate(self, values, i, _space) : 0;
@ -3249,7 +3264,7 @@ var uPlot = (function () {
var plotDim = ori == 0 ? plotWid : plotHgt; var plotDim = ori == 0 ? plotWid : plotHgt;
var plotOff = ori == 0 ? plotLft : plotTop; var plotOff = ori == 0 ? plotLft : plotTop;
var axisGap = round(axis.gap * pxRatio); var axisGap = round(axis.gap * pxRatio);
var ticks = axis.ticks; var ticks = axis.ticks;
var tickSize = ticks.show ? round(ticks.size * pxRatio) : 0; var tickSize = ticks.show ? round(ticks.size * pxRatio) : 0;
@ -3284,7 +3299,7 @@ var uPlot = (function () {
ctx.textBaseline = angle || ctx.textBaseline = angle ||
ori == 1 ? "middle" : side == 2 ? TOP : BOTTOM; ori == 1 ? "middle" : side == 2 ? TOP : BOTTOM;
var lineHeight = axis.font[1] * lineMult; var lineHeight = axis.font[1] * lineMult;
var canOffs = _splits.map(val => round(getPos(val, scale, plotDim, plotOff))); var canOffs = _splits.map(val => round(getPos(val, scale, plotDim, plotOff)));
@ -3475,7 +3490,9 @@ var uPlot = (function () {
queuedCommit = false; queuedCommit = false;
} }
self.redraw = rebuildPaths => { self.redraw = (rebuildPaths, recalcAxes) => {
shouldConvergeSize = recalcAxes || false;
if (rebuildPaths !== false) if (rebuildPaths !== false)
{ _setScale(xScaleKey, scaleX.min, scaleX.max); } { _setScale(xScaleKey, scaleX.min, scaleX.max); }
else else
@ -3574,10 +3591,10 @@ var uPlot = (function () {
var select = self.select = assign({ var select = self.select = assign({
show: true, show: true,
over: true, over: true,
left: 0, left: 0,
width: 0, width: 0,
top: 0, top: 0,
height: 0, height: 0,
}, opts.select); }, opts.select);
var selectDiv = select.show ? placeDiv(SELECT, select.over ? over : under) : null; var selectDiv = select.show ? placeDiv(SELECT, select.over ? over : under) : null;
@ -3659,8 +3676,12 @@ var uPlot = (function () {
if (i != focusedSeries) { if (i != focusedSeries) {
// log("setFocus()", arguments); // log("setFocus()", arguments);
var allFocused = i == null;
series.forEach((s, i2) => { series.forEach((s, i2) => {
_setAlpha(i2, i == null || i2 == 0 || i2 == i ? 1 : focus.alpha); var isFocused = allFocused || i2 == 0 || i2 == i;
s._focus = allFocused ? null : isFocused;
_setAlpha(i2, isFocused ? 1 : focus.alpha);
}); });
focusedSeries = i; focusedSeries = i;

File diff suppressed because one or more lines are too long