Update src with change from #579

pull/581/head
Allan Jardine 1 year ago
parent 6c36a57cbc
commit 1c6f059eb4

@ -107,7 +107,6 @@ DataTable.render.percentBar = function (pShape, cText, cBorder, cBar, cBack, vRo
bType = bType || 'ridge'; bType = bType || 'ridge';
//Bar templates //Bar templates
var styleRule1 = 'max-width:100px;height:12px;margin:0 auto;'; var styleRule1 = 'max-width:100px;height:12px;margin:0 auto;';
return function (d, type, row) { return function (d, type, row) {
//Remove % if found in the value //Remove % if found in the value
//Round to the given parameter vRound //Round to the given parameter vRound
@ -123,7 +122,6 @@ DataTable.render.percentBar = function (pShape, cText, cBorder, cBar, cBack, vRo
if (typeof d !== 'number' && typeof d !== 'string') { if (typeof d !== 'number' && typeof d !== 'string') {
return d; return d;
} }
var cBackConditional; var cBackConditional;
var cBarConditional; var cBarConditional;
var cTextConditional; var cTextConditional;
@ -133,39 +131,43 @@ DataTable.render.percentBar = function (pShape, cText, cBorder, cBar, cBack, vRo
if (s >= conditionalColors[i].min && s <= conditionalColors[i].max) { if (s >= conditionalColors[i].min && s <= conditionalColors[i].max) {
if (conditionalColors[i].barColor) { if (conditionalColors[i].barColor) {
cBarConditional = conditionalColors[i].barColor; cBarConditional = conditionalColors[i].barColor;
} else { }
else {
cBarConditional = cBar; cBarConditional = cBar;
} }
if (conditionalColors[i].backgroundColor) { if (conditionalColors[i].backgroundColor) {
cBackConditional = conditionalColors[i].backgroundColor; cBackConditional = conditionalColors[i].backgroundColor;
} else { }
else {
cBackConditional = cBack; cBackConditional = cBack;
} }
if (conditionalColors[i].textColor) { if (conditionalColors[i].textColor) {
cTextConditional = conditionalColors[i].textColor; cTextConditional = conditionalColors[i].textColor;
} else { }
else {
cTextConditional = cText; cTextConditional = cText;
} }
break; break;
} }
} }
} else { }
else {
cBackConditional = cBack; cBackConditional = cBack;
cBarConditional = cBar; cBarConditional = cBar;
cTextConditional = cText; cTextConditional = cText;
} }
var styleRule2 = 'border:2px ' + var styleRule2 = 'border:2px ' +
bType + bType +
' ' + ' ' +
cBorder + cBorder +
';line-height:12px;font-size:14px;color:' + ';line-height:12px;font-size:14px;color:' +
cText + cText +
';background:' + ';background:' +
cBackConditional + cBackConditional +
';position:relative;'; ';position:relative;';
//Bar template //Bar template
var styleRule3 = 'height:12px;line-height:12px;text-align:center;background-color:' + var styleRule3 = 'height:12px;line-height:12px;text-align:center;background-color:' +
cBarConditional + ';padding:auto 6px;'; cBarConditional + ';padding:auto 6px;';
//Square is default, make template round if pShape == round //Square is default, make template round if pShape == round
if (pShape == 'round') { if (pShape == 'round') {
styleRule2 += 'border-radius:5px;'; styleRule2 += 'border-radius:5px;';

@ -1,2 +1,2 @@
/*! © Drijkoningen Dirk - datatables.net/license */ /*! © Drijkoningen Dirk - datatables.net/license */
!function(n){var i,o;"function"==typeof define&&define.amd?define(["jquery","datatables.net"],function(e){return n(e,window,document)}):"object"==typeof exports?(i=require("jquery"),o=function(e,t){t.fn.dataTable||require("datatables.net")(e,t)},"undefined"==typeof window?module.exports=function(e,t){return e=e||window,t=t||i(e),o(e,t),n(t,0,e.document)}:(o(window,i),module.exports=n(i,window,window.document))):n(jQuery,window,document)}(function(e,t,n,i){"use strict";e=e.fn.dataTable;return e.render.percentBar=function(e,t,n,i,o,r,d){r=r||0;var u="border:2px "+(d=d||"ridge")+" "+(n=n||"#BCBCBC")+";line-height:12px;font-size:14px;color:"+(t=t||"#000")+";background:"+(o=o||"#E6E6E6")+";position:relative;",a="height:12px;line-height:12px;text-align:center;background-color:"+(i=i||"#5FD868")+";padding:auto 6px;";return"round"==(e=e||"square")&&(u+="border-radius:5px;",a+="border-top-left-radius:4px;border-bottom-left-radius:4px;"),function(e,t,n){var i=parseFloat(e.toString().replace(/\s%|%/g,"")).toFixed(r);return 100<i&&(i=100),"display"!==t?i:"number"!=typeof e&&"string"!=typeof e?e:'<div style="max-width:100px;height:12px;margin:0 auto;"><div style="'+u+'"><div style="'+a+"width:"+i+'%;"></div><div style="width:100%;text-align:center;position:absolute;left:0;top:0;">'+i+"%</div></div></div>"}},e}); !function(r){var n,o;"function"==typeof define&&define.amd?define(["jquery","datatables.net"],function(e){return r(e,window,document)}):"object"==typeof exports?(n=require("jquery"),o=function(e,t){t.fn.dataTable||require("datatables.net")(e,t)},"undefined"==typeof window?module.exports=function(e,t){return e=e||window,t=t||n(e),o(e,t),r(t,0,e.document)}:(o(window,n),module.exports=r(n,window,window.document))):r(jQuery,window,document)}(function(e,t,r,n){"use strict";e=e.fn.dataTable;return e.render.percentBar=function(a,u,l,f,p,s,c,x){a=a||"square",u=u||"#000",l=l||"#BCBCBC",f=f||"#5FD868",p=p||"#E6E6E6",s=s||0,c=c||"ridge";return function(e,t,r){var n,o,i=parseFloat(e.toString().replace(/\s%|%/g,"")).toFixed(s);if(100<i&&(i=100),"display"!==t)return i;if("number"!=typeof e&&"string"!=typeof e)return e;if(x){for(var d=0;d<x.length;d++)if(i>=x[d].min&&i<=x[d].max){o=x[d].barColor||f,n=x[d].backgroundColor||p,x[d].textColor||u;break}}else n=p,o=f,0;t="border:2px "+c+" "+l+";line-height:12px;font-size:14px;color:"+u+";background:"+n+";position:relative;",e="height:12px;line-height:12px;text-align:center;background-color:"+o+";padding:auto 6px;";return"round"==a&&(t+="border-radius:5px;",e+="border-top-left-radius:4px;border-bottom-left-radius:4px;"),'<div style="max-width:100px;height:12px;margin:0 auto;"><div style="'+t+'"><div style="'+e+"width:"+i+'%;"></div><div style="width:100%;text-align:center;position:absolute;left:0;top:0;">'+i+"%</div></div></div>"}},e});

@ -1,2 +1,2 @@
/*! © Drijkoningen Dirk - datatables.net/license */ /*! © Drijkoningen Dirk - datatables.net/license */
import jQuery from"jquery";import DataTable from"datatables.net";let $=jQuery;DataTable.render.percentBar=function(t,e,r,i,a,o,d){o=o||0;var n="border:2px "+(d=d||"ridge")+" "+(r=r||"#BCBCBC")+";line-height:12px;font-size:14px;color:"+(e=e||"#000")+";background:"+(a=a||"#E6E6E6")+";position:relative;",p="height:12px;line-height:12px;text-align:center;background-color:"+(i=i||"#5FD868")+";padding:auto 6px;";return"round"==(t=t||"square")&&(n+="border-radius:5px;",p+="border-top-left-radius:4px;border-bottom-left-radius:4px;"),function(t,e,r){var i=parseFloat(t.toString().replace(/\s%|%/g,"")).toFixed(o);return 100<i&&(i=100),"display"!==e?i:"number"!=typeof t&&"string"!=typeof t?t:'<div style="max-width:100px;height:12px;margin:0 auto;"><div style="'+n+'"><div style="'+p+"width:"+i+'%;"></div><div style="width:100%;text-align:center;position:absolute;left:0;top:0;">'+i+"%</div></div></div>"}};export default DataTable; import jQuery from"jquery";import DataTable from"datatables.net";let $=jQuery;DataTable.render.percentBar=function(d,l,p,u,s,x,b,f){d=d||"square",l=l||"#000",p=p||"#BCBCBC",u=u||"#5FD868",s=s||"#E6E6E6",x=x||0,b=b||"ridge";return function(e,t,r){var i,o,a=parseFloat(e.toString().replace(/\s%|%/g,"")).toFixed(x);if(100<a&&(a=100),"display"!==t)return a;if("number"!=typeof e&&"string"!=typeof e)return e;if(f){for(var n=0;n<f.length;n++)if(a>=f[n].min&&a<=f[n].max){o=f[n].barColor||u,i=f[n].backgroundColor||s,f[n].textColor||l;break}}else i=s,o=u,0;t="border:2px "+b+" "+p+";line-height:12px;font-size:14px;color:"+l+";background:"+i+";position:relative;",e="height:12px;line-height:12px;text-align:center;background-color:"+o+";padding:auto 6px;";return"round"==d&&(t+="border-radius:5px;",e+="border-top-left-radius:4px;border-bottom-left-radius:4px;"),'<div style="max-width:100px;height:12px;margin:0 auto;"><div style="'+t+'"><div style="'+e+"width:"+a+'%;"></div><div style="width:100%;text-align:center;position:absolute;left:0;top:0;">'+a+"%</div></div></div>"}};export default DataTable;

@ -57,7 +57,7 @@ let $ = jQuery;
* } ] * } ]
* } ); * } );
*/ */
DataTable.render.percentBar = function (pShape, cText, cBorder, cBar, cBack, vRound, bType) { DataTable.render.percentBar = function (pShape, cText, cBorder, cBar, cBack, vRound, bType, conditionalColors) {
pShape = pShape || 'square'; pShape = pShape || 'square';
cText = cText || '#000'; cText = cText || '#000';
cBorder = cBorder || '#BCBCBC'; cBorder = cBorder || '#BCBCBC';
@ -67,23 +67,6 @@ DataTable.render.percentBar = function (pShape, cText, cBorder, cBar, cBack, vRo
bType = bType || 'ridge'; bType = bType || 'ridge';
//Bar templates //Bar templates
var styleRule1 = 'max-width:100px;height:12px;margin:0 auto;'; var styleRule1 = 'max-width:100px;height:12px;margin:0 auto;';
var styleRule2 = 'border:2px ' +
bType +
' ' +
cBorder +
';line-height:12px;font-size:14px;color:' +
cText +
';background:' +
cBack +
';position:relative;';
var styleRule3 = 'height:12px;line-height:12px;text-align:center;background-color:' +
cBar +
';padding:auto 6px;';
//Square is default, make template round if pShape == round
if (pShape == 'round') {
styleRule2 += 'border-radius:5px;';
styleRule3 += 'border-top-left-radius:4px;border-bottom-left-radius:4px;';
}
return function (d, type, row) { return function (d, type, row) {
//Remove % if found in the value //Remove % if found in the value
//Round to the given parameter vRound //Round to the given parameter vRound
@ -99,6 +82,57 @@ DataTable.render.percentBar = function (pShape, cText, cBorder, cBar, cBack, vRo
if (typeof d !== 'number' && typeof d !== 'string') { if (typeof d !== 'number' && typeof d !== 'string') {
return d; return d;
} }
var cBackConditional;
var cBarConditional;
var cTextConditional;
// do conditional colors based on user input
if (conditionalColors) {
for (var i = 0; i < conditionalColors.length; i++) {
if (s >= conditionalColors[i].min && s <= conditionalColors[i].max) {
if (conditionalColors[i].barColor) {
cBarConditional = conditionalColors[i].barColor;
}
else {
cBarConditional = cBar;
}
if (conditionalColors[i].backgroundColor) {
cBackConditional = conditionalColors[i].backgroundColor;
}
else {
cBackConditional = cBack;
}
if (conditionalColors[i].textColor) {
cTextConditional = conditionalColors[i].textColor;
}
else {
cTextConditional = cText;
}
break;
}
}
}
else {
cBackConditional = cBack;
cBarConditional = cBar;
cTextConditional = cText;
}
var styleRule2 = 'border:2px ' +
bType +
' ' +
cBorder +
';line-height:12px;font-size:14px;color:' +
cText +
';background:' +
cBackConditional +
';position:relative;';
//Bar template
var styleRule3 = 'height:12px;line-height:12px;text-align:center;background-color:' +
cBarConditional + ';padding:auto 6px;';
//Square is default, make template round if pShape == round
if (pShape == 'round') {
styleRule2 += 'border-radius:5px;';
styleRule3 += 'border-top-left-radius:4px;border-bottom-left-radius:4px;';
}
//Return the code for the bar //Return the code for the bar
return ('<div style="' + return ('<div style="' +
styleRule1 + styleRule1 +

@ -76,7 +76,8 @@ DataTable.render.percentBar = function (
cBar, cBar,
cBack, cBack,
vRound, vRound,
bType bType,
conditionalColors
) { ) {
pShape = pShape || 'square'; pShape = pShape || 'square';
cText = cText || '#000'; cText = cText || '#000';
@ -88,26 +89,6 @@ DataTable.render.percentBar = function (
//Bar templates //Bar templates
var styleRule1 = 'max-width:100px;height:12px;margin:0 auto;'; var styleRule1 = 'max-width:100px;height:12px;margin:0 auto;';
var styleRule2 =
'border:2px ' +
bType +
' ' +
cBorder +
';line-height:12px;font-size:14px;color:' +
cText +
';background:' +
cBack +
';position:relative;';
var styleRule3 =
'height:12px;line-height:12px;text-align:center;background-color:' +
cBar +
';padding:auto 6px;';
//Square is default, make template round if pShape == round
if (pShape == 'round') {
styleRule2 += 'border-radius:5px;';
styleRule3 += 'border-top-left-radius:4px;border-bottom-left-radius:4px;';
}
return function (d, type, row) { return function (d, type, row) {
//Remove % if found in the value //Remove % if found in the value
@ -126,6 +107,59 @@ DataTable.render.percentBar = function (
return d; return d;
} }
var cBackConditional;
var cBarConditional;
var cTextConditional;
// do conditional colors based on user input
if (conditionalColors) {
for (var i = 0; i < conditionalColors.length; i++) {
if (s >= conditionalColors[i].min && s <= conditionalColors[i].max) {
if (conditionalColors[i].barColor) {
cBarConditional = conditionalColors[i].barColor;
} else {
cBarConditional = cBar;
}
if (conditionalColors[i].backgroundColor) {
cBackConditional = conditionalColors[i].backgroundColor;
} else {
cBackConditional = cBack;
}
if (conditionalColors[i].textColor) {
cTextConditional = conditionalColors[i].textColor;
} else {
cTextConditional = cText;
}
break;
}
}
}
else {
cBackConditional = cBack;
cBarConditional = cBar;
cTextConditional = cText;
}
var styleRule2 = 'border:2px ' +
bType +
' ' +
cBorder +
';line-height:12px;font-size:14px;color:' +
cText +
';background:' +
cBackConditional +
';position:relative;';
//Bar template
var styleRule3 = 'height:12px;line-height:12px;text-align:center;background-color:' +
cBarConditional + ';padding:auto 6px;';
//Square is default, make template round if pShape == round
if (pShape == 'round') {
styleRule2 += 'border-radius:5px;';
styleRule3 += 'border-top-left-radius:4px;border-bottom-left-radius:4px;';
}
//Return the code for the bar //Return the code for the bar
return ( return (
'<div style="' + '<div style="' +

@ -101,9 +101,9 @@ PLUGINS="${DT_SRC}/extensions/Plugins"
# ts_plugin $file # ts_plugin $file
# done # done
# for file in $PLUGINS/dataRender/src/*.ts; do for file in $PLUGINS/dataRender/src/*.ts; do
# ts_plugin $file ts_plugin $file
# done done
# for file in $PLUGINS/features/*/src/*.ts; do # for file in $PLUGINS/features/*/src/*.ts; do
# ts_plugin $file # ts_plugin $file
@ -121,8 +121,8 @@ PLUGINS="${DT_SRC}/extensions/Plugins"
# ts_plugin $file # ts_plugin $file
# done # done
echo_section " Languages" # echo_section " Languages"
for file in $PLUGINS/i18n/*.json; do # for file in $PLUGINS/i18n/*.json; do
lang_plugin $file # lang_plugin $file
done # done

Loading…
Cancel
Save