Browse Source

contentformat

es6
guy 6 years ago
parent
commit
40011a47ba
  1. 2
      dist/_fineui.min.js
  2. 73476
      dist/base.js
  3. 229153
      dist/bundle.js
  4. 2
      dist/bundle.min.js
  5. 29
      dist/core.js
  6. 229651
      dist/fineui.js
  7. 2
      dist/fineui.min.js
  8. 29
      dist/utils.js
  9. 2
      dist/utils.min.js
  10. 51104
      dist/widget.js
  11. 29
      src/core/alias.js

2
dist/_fineui.min.js vendored

File diff suppressed because one or more lines are too long

73476
dist/base.js vendored

File diff suppressed because it is too large Load Diff

229153
dist/bundle.js vendored

File diff suppressed because one or more lines are too long

2
dist/bundle.min.js vendored

File diff suppressed because one or more lines are too long

29
dist/core.js vendored

@ -25694,10 +25694,11 @@ BI.ShowAction = BI.inherit(BI.Action, {
* 使用数值计算的方式来获取任意数值的科学技术表示值
* 科学计数格式
*/
function _eFormat(text, fmt) {
function _eFormat (text, fmt) {
text = +text;
return eFormat(text, fmt);
/**
* 科学计数格式具体计算过程
* @param num
@ -25708,7 +25709,7 @@ BI.ShowAction = BI.inherit(BI.Action, {
* 数量级没有规定因为没见过实数里有用科学计数法表示之后E的后面会小于一位的情况0无所谓
* @returns {*}
*/
function eFormat(num, format) {
function eFormat (num, format) {
var neg = num < 0 ? (num *= -1, "-") : "",
magnitudeNeg = "";
@ -25717,7 +25718,7 @@ BI.ShowAction = BI.inherit(BI.Action, {
var magnitude = Math[funcName](Math.log(num) / Math.log(10));
if (!isFinite(magnitude)) {
return format.replace(/#/ig, "").replace(/\.e/ig, 'E');
return format.replace(/#/ig, "").replace(/\.e/ig, "E");
}
num = num / Math.pow(10, magnitude);
@ -25742,7 +25743,7 @@ BI.ShowAction = BI.inherit(BI.Action, {
num *= Math.pow(10, precision);
num = Math.round(num);
// 如果出现进位的情况,将num除以10
isValueCarry && (num /= 10, magnitude += magnitudeNeg === '-' ? -1 : 1);
isValueCarry && (num /= 10, magnitude += magnitudeNeg === "-" ? -1 : 1);
num /= Math.pow(10, precision);
// 小数部分保留precision位
@ -25754,7 +25755,7 @@ BI.ShowAction = BI.inherit(BI.Action, {
}
// 获取format格式规定的数量级的形式
function formatExponential(format, num, magnitudeNeg) {
function formatExponential (format, num, magnitudeNeg) {
num += "";
if (!/e/ig.test(format)) {
return num;
@ -25779,7 +25780,7 @@ BI.ShowAction = BI.inherit(BI.Action, {
}
// 获取format规定的科学计数法精确到的位数
function getPrecision(format) {
function getPrecision (format) {
if (!/e/ig.test(format)) {
return 0;
}
@ -25790,7 +25791,7 @@ BI.ShowAction = BI.inherit(BI.Action, {
// 获取数值科学计数法表示之后整数的位数
// 这边我们还需要考虑#和0的问题
function getInteger(magnitude, format) {
function getInteger (magnitude, format) {
if (!/e/ig.test(format)) {
return 0;
}
@ -25799,10 +25800,10 @@ BI.ShowAction = BI.inherit(BI.Action, {
var formatLeft = format.split(/e/ig)[0].split(".")[0], i, f, len = formatLeft.length;
var valueLeftLen = 0;
for(i = 0; i < len; i++) {
for (i = 0; i < len; i++) {
f = formatLeft.charAt(i);
// "#"所在的位置到末尾长度小于等于值的整数部分长度,那么这个#才可以占位
if(f == 0 || (f == "#" && (len - i <= magnitude + 1))) {
if (f == 0 || (f == "#" && (len - i <= magnitude + 1))) {
valueLeftLen++;
}
}
@ -25811,10 +25812,10 @@ BI.ShowAction = BI.inherit(BI.Action, {
}
// 判断num通过round函数之后是否有进位
function isValueCarried(num) {
function isValueCarried (num) {
var roundNum = Math.round(num);
num = (num + "").split(".")[0];
roundNum =(roundNum + "").split(".")[0];
roundNum = (roundNum + "").split(".")[0];
return num.length !== roundNum.length;
}
}
@ -26269,11 +26270,11 @@ BI.ShowAction = BI.inherit(BI.Action, {
// 毫秒数类型
cv = new Date(cv);
} else {
// 字符串类型,如yyyyMMdd、MMddyyyy等这样无分隔符的结构
cv = BI.parseDateTime(cv + "", "Y-m-d H:i:s");
//字符串类型转化为date类型
cv = new Date(Date.parse(("" + cv).replace(/-|\./g, "/")));
}
}
if (!BI.isNull(cv)) {
if (!isInvalidDate(cv) && !BI.isNull(cv)) {
var needTrim = fmt.match(/^DT/);
text = BI.date2Str(cv, fmt.substring(needTrim ? 2 : 1));
}

229651
dist/fineui.js vendored

File diff suppressed because one or more lines are too long

2
dist/fineui.min.js vendored

File diff suppressed because one or more lines are too long

29
dist/utils.js vendored

@ -12491,10 +12491,11 @@ _.extend(BI.OB.prototype, {
* 使用数值计算的方式来获取任意数值的科学技术表示值
* 科学计数格式
*/
function _eFormat(text, fmt) {
function _eFormat (text, fmt) {
text = +text;
return eFormat(text, fmt);
/**
* 科学计数格式具体计算过程
* @param num
@ -12505,7 +12506,7 @@ _.extend(BI.OB.prototype, {
* 数量级没有规定因为没见过实数里有用科学计数法表示之后E的后面会小于一位的情况0无所谓
* @returns {*}
*/
function eFormat(num, format) {
function eFormat (num, format) {
var neg = num < 0 ? (num *= -1, "-") : "",
magnitudeNeg = "";
@ -12514,7 +12515,7 @@ _.extend(BI.OB.prototype, {
var magnitude = Math[funcName](Math.log(num) / Math.log(10));
if (!isFinite(magnitude)) {
return format.replace(/#/ig, "").replace(/\.e/ig, 'E');
return format.replace(/#/ig, "").replace(/\.e/ig, "E");
}
num = num / Math.pow(10, magnitude);
@ -12539,7 +12540,7 @@ _.extend(BI.OB.prototype, {
num *= Math.pow(10, precision);
num = Math.round(num);
// 如果出现进位的情况,将num除以10
isValueCarry && (num /= 10, magnitude += magnitudeNeg === '-' ? -1 : 1);
isValueCarry && (num /= 10, magnitude += magnitudeNeg === "-" ? -1 : 1);
num /= Math.pow(10, precision);
// 小数部分保留precision位
@ -12551,7 +12552,7 @@ _.extend(BI.OB.prototype, {
}
// 获取format格式规定的数量级的形式
function formatExponential(format, num, magnitudeNeg) {
function formatExponential (format, num, magnitudeNeg) {
num += "";
if (!/e/ig.test(format)) {
return num;
@ -12576,7 +12577,7 @@ _.extend(BI.OB.prototype, {
}
// 获取format规定的科学计数法精确到的位数
function getPrecision(format) {
function getPrecision (format) {
if (!/e/ig.test(format)) {
return 0;
}
@ -12587,7 +12588,7 @@ _.extend(BI.OB.prototype, {
// 获取数值科学计数法表示之后整数的位数
// 这边我们还需要考虑#和0的问题
function getInteger(magnitude, format) {
function getInteger (magnitude, format) {
if (!/e/ig.test(format)) {
return 0;
}
@ -12596,10 +12597,10 @@ _.extend(BI.OB.prototype, {
var formatLeft = format.split(/e/ig)[0].split(".")[0], i, f, len = formatLeft.length;
var valueLeftLen = 0;
for(i = 0; i < len; i++) {
for (i = 0; i < len; i++) {
f = formatLeft.charAt(i);
// "#"所在的位置到末尾长度小于等于值的整数部分长度,那么这个#才可以占位
if(f == 0 || (f == "#" && (len - i <= magnitude + 1))) {
if (f == 0 || (f == "#" && (len - i <= magnitude + 1))) {
valueLeftLen++;
}
}
@ -12608,10 +12609,10 @@ _.extend(BI.OB.prototype, {
}
// 判断num通过round函数之后是否有进位
function isValueCarried(num) {
function isValueCarried (num) {
var roundNum = Math.round(num);
num = (num + "").split(".")[0];
roundNum =(roundNum + "").split(".")[0];
roundNum = (roundNum + "").split(".")[0];
return num.length !== roundNum.length;
}
}
@ -13066,11 +13067,11 @@ _.extend(BI.OB.prototype, {
// 毫秒数类型
cv = new Date(cv);
} else {
// 字符串类型,如yyyyMMdd、MMddyyyy等这样无分隔符的结构
cv = BI.parseDateTime(cv + "", "Y-m-d H:i:s");
//字符串类型转化为date类型
cv = new Date(Date.parse(("" + cv).replace(/-|\./g, "/")));
}
}
if (!BI.isNull(cv)) {
if (!isInvalidDate(cv) && !BI.isNull(cv)) {
var needTrim = fmt.match(/^DT/);
text = BI.date2Str(cv, fmt.substring(needTrim ? 2 : 1));
}

2
dist/utils.min.js vendored

File diff suppressed because one or more lines are too long

51104
dist/widget.js vendored

File diff suppressed because it is too large Load Diff

29
src/core/alias.js

@ -19,10 +19,11 @@
* 使用数值计算的方式来获取任意数值的科学技术表示值
* 科学计数格式
*/
function _eFormat(text, fmt) {
function _eFormat (text, fmt) {
text = +text;
return eFormat(text, fmt);
/**
* 科学计数格式具体计算过程
* @param num
@ -33,7 +34,7 @@
* 数量级没有规定因为没见过实数里有用科学计数法表示之后E的后面会小于一位的情况0无所谓
* @returns {*}
*/
function eFormat(num, format) {
function eFormat (num, format) {
var neg = num < 0 ? (num *= -1, "-") : "",
magnitudeNeg = "";
@ -42,7 +43,7 @@
var magnitude = Math[funcName](Math.log(num) / Math.log(10));
if (!isFinite(magnitude)) {
return format.replace(/#/ig, "").replace(/\.e/ig, 'E');
return format.replace(/#/ig, "").replace(/\.e/ig, "E");
}
num = num / Math.pow(10, magnitude);
@ -67,7 +68,7 @@
num *= Math.pow(10, precision);
num = Math.round(num);
// 如果出现进位的情况,将num除以10
isValueCarry && (num /= 10, magnitude += magnitudeNeg === '-' ? -1 : 1);
isValueCarry && (num /= 10, magnitude += magnitudeNeg === "-" ? -1 : 1);
num /= Math.pow(10, precision);
// 小数部分保留precision位
@ -79,7 +80,7 @@
}
// 获取format格式规定的数量级的形式
function formatExponential(format, num, magnitudeNeg) {
function formatExponential (format, num, magnitudeNeg) {
num += "";
if (!/e/ig.test(format)) {
return num;
@ -104,7 +105,7 @@
}
// 获取format规定的科学计数法精确到的位数
function getPrecision(format) {
function getPrecision (format) {
if (!/e/ig.test(format)) {
return 0;
}
@ -115,7 +116,7 @@
// 获取数值科学计数法表示之后整数的位数
// 这边我们还需要考虑#和0的问题
function getInteger(magnitude, format) {
function getInteger (magnitude, format) {
if (!/e/ig.test(format)) {
return 0;
}
@ -124,10 +125,10 @@
var formatLeft = format.split(/e/ig)[0].split(".")[0], i, f, len = formatLeft.length;
var valueLeftLen = 0;
for(i = 0; i < len; i++) {
for (i = 0; i < len; i++) {
f = formatLeft.charAt(i);
// "#"所在的位置到末尾长度小于等于值的整数部分长度,那么这个#才可以占位
if(f == 0 || (f == "#" && (len - i <= magnitude + 1))) {
if (f == 0 || (f == "#" && (len - i <= magnitude + 1))) {
valueLeftLen++;
}
}
@ -136,10 +137,10 @@
}
// 判断num通过round函数之后是否有进位
function isValueCarried(num) {
function isValueCarried (num) {
var roundNum = Math.round(num);
num = (num + "").split(".")[0];
roundNum =(roundNum + "").split(".")[0];
roundNum = (roundNum + "").split(".")[0];
return num.length !== roundNum.length;
}
}
@ -594,11 +595,11 @@
// 毫秒数类型
cv = new Date(cv);
} else {
// 字符串类型,如yyyyMMdd、MMddyyyy等这样无分隔符的结构
cv = BI.parseDateTime(cv + "", "Y-m-d H:i:s");
//字符串类型转化为date类型
cv = new Date(Date.parse(("" + cv).replace(/-|\./g, "/")));
}
}
if (!BI.isNull(cv)) {
if (!isInvalidDate(cv) && !BI.isNull(cv)) {
var needTrim = fmt.match(/^DT/);
text = BI.date2Str(cv, fmt.substring(needTrim ? 2 : 1));
}

Loading…
Cancel
Save