2
0
forked from Wavyzz/dolibarr

Update chart.js to 2.9.4

This commit is contained in:
Laurent Destailleur
2020-12-07 21:57:29 +01:00
parent 796fe5cd8a
commit 85bb3fa909
19 changed files with 180 additions and 2875 deletions

View File

@@ -1,7 +1,7 @@
/*!
* Chart.js v2.9.3
* Chart.js v2.9.4
* https://www.chartjs.org
* (c) 2019 Chart.js Contributors
* (c) 2020 Chart.js Contributors
* Released under the MIT License
*/
(function (global, factory) {
@@ -2103,6 +2103,10 @@ if (typeof window !== 'undefined') {
var chartjsColor = Color;
function isValidKey(key) {
return ['__proto__', 'prototype', 'constructor'].indexOf(key) === -1;
}
/**
* @namespace Chart.helpers
*/
@@ -2278,7 +2282,7 @@ var helpers = {
}
if (helpers.isObject(source)) {
var target = {};
var target = Object.create(source);
var keys = Object.keys(source);
var klen = keys.length;
var k = 0;
@@ -2299,6 +2303,12 @@ var helpers = {
* @private
*/
_merger: function(key, target, source, options) {
if (!isValidKey(key)) {
// We want to ensure we do not copy prototypes over
// as this can pollute global namespaces
return;
}
var tval = target[key];
var sval = source[key];
@@ -2314,6 +2324,12 @@ var helpers = {
* @private
*/
_mergerIf: function(key, target, source) {
if (!isValidKey(key)) {
// We want to ensure we do not copy prototypes over
// as this can pollute global namespaces
return;
}
var tval = target[key];
var sval = source[key];
@@ -3812,7 +3828,7 @@ helpers$1.extend(DatasetController.prototype, {
*/
_configure: function() {
var me = this;
me._config = helpers$1.merge({}, [
me._config = helpers$1.merge(Object.create(null), [
me.chart.options.datasets[me._type],
me.getDataset(),
], {
@@ -7082,7 +7098,8 @@ function updateDims(chartArea, params, layout) {
chartArea.h = newHeight;
// return true if chart area changed in layout's direction
return layout.horizontal ? newWidth !== chartArea.w : newHeight !== chartArea.h;
var sizes = layout.horizontal ? [newWidth, chartArea.w] : [newHeight, chartArea.h];
return sizes[0] !== sizes[1] && (!isNaN(sizes[0]) || !isNaN(sizes[1]));
}
}
@@ -8094,7 +8111,7 @@ var core_scaleService = {
},
getScaleDefaults: function(type) {
// Return the scale defaults merged with the global settings so that we always use the latest ones
return this.defaults.hasOwnProperty(type) ? helpers$1.merge({}, [core_defaults.scale, this.defaults[type]]) : {};
return this.defaults.hasOwnProperty(type) ? helpers$1.merge(Object.create(null), [core_defaults.scale, this.defaults[type]]) : {};
},
updateScaleDefaults: function(type, additions) {
var me = this;
@@ -9169,7 +9186,7 @@ core_defaults._set('global', {
* returns a deep copy of the result, thus doesn't alter inputs.
*/
function mergeScaleConfig(/* config objects ... */) {
return helpers$1.merge({}, [].slice.call(arguments), {
return helpers$1.merge(Object.create(null), [].slice.call(arguments), {
merger: function(key, target, source, options) {
if (key === 'xAxes' || key === 'yAxes') {
var slen = source[key].length;
@@ -9209,9 +9226,9 @@ function mergeScaleConfig(/* config objects ... */) {
* a deep copy of the result, thus doesn't alter inputs.
*/
function mergeConfig(/* config objects ... */) {
return helpers$1.merge({}, [].slice.call(arguments), {
return helpers$1.merge(Object.create(null), [].slice.call(arguments), {
merger: function(key, target, source, options) {
var tval = target[key] || {};
var tval = target[key] || Object.create(null);
var sval = source[key];
if (key === 'scales') {
@@ -9228,7 +9245,7 @@ function mergeConfig(/* config objects ... */) {
}
function initConfig(config) {
config = config || {};
config = config || Object.create(null);
// Do NOT use mergeConfig for the data object because this method merges arrays
// and so would change references to labels and datasets, preventing data updates.
@@ -11209,6 +11226,8 @@ function computeLabelSizes(ctx, tickFonts, ticks, caches) {
var widths = [];
var heights = [];
var offsets = [];
var widestLabelSize = 0;
var highestLabelSize = 0;
var i, j, jlen, label, tickFont, fontString, cache, lineHeight, width, height, nestedLabel, widest, highest;
for (i = 0; i < length; ++i) {
@@ -11236,11 +11255,13 @@ function computeLabelSizes(ctx, tickFonts, ticks, caches) {
widths.push(width);
heights.push(height);
offsets.push(lineHeight / 2);
widestLabelSize = Math.max(width, widestLabelSize);
highestLabelSize = Math.max(height, highestLabelSize);
}
garbageCollect(caches, length);
widest = widths.indexOf(Math.max.apply(null, widths));
highest = heights.indexOf(Math.max.apply(null, heights));
widest = widths.indexOf(widestLabelSize);
highest = heights.indexOf(highestLabelSize);
function valueAt(idx) {
return {