rapid-spreadjs 1.0.90 → 1.0.91
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +21 -4
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.cjs.min.js +1 -1
- package/dist/index.cjs.min.js.map +1 -1
- package/dist/index.esm.js +21 -4
- package/dist/index.esm.js.map +1 -1
- package/dist/index.esm.min.js +1 -1
- package/dist/index.esm.min.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -20055,6 +20055,11 @@ const FormulaUtils = {
|
|
|
20055
20055
|
repeatable: false,
|
|
20056
20056
|
optional: false,
|
|
20057
20057
|
},
|
|
20058
|
+
{
|
|
20059
|
+
name: '是否返回符合或不符合结果的数量(传数字的1或0,0:不返回数量、1:返回数量),默认为:0',
|
|
20060
|
+
repeatable: false,
|
|
20061
|
+
optional: false,
|
|
20062
|
+
},
|
|
20058
20063
|
],
|
|
20059
20064
|
funCallback: (spread, sheet, retData) => {
|
|
20060
20065
|
// 如果传递的参数小于5个,则返回空字符串
|
|
@@ -20062,7 +20067,9 @@ const FormulaUtils = {
|
|
|
20062
20067
|
if (retData.allCellValsEw.length < 5) {
|
|
20063
20068
|
return '/';
|
|
20064
20069
|
}
|
|
20065
|
-
let array1 = retData.allCellValsEw[0], array2 = retData.allCellValsEw[1], operator = retData.allCellValsEw[2], value = retData.allCellValsEw[3], delimiter = retData.allCellValsEw[4], isOpposite = retData.allCellValsEw.length < 6 ? 0 : retData.allCellValsEw[5]
|
|
20070
|
+
let array1 = retData.allCellValsEw[0], array2 = retData.allCellValsEw[1], operator = retData.allCellValsEw[2], value = retData.allCellValsEw[3], delimiter = retData.allCellValsEw[4], isOpposite = retData.allCellValsEw.length < 6 ? 0 : retData.allCellValsEw[5],
|
|
20071
|
+
// 是否返回符合或不符合结果的数量(如最终符合或不符合的结果为“5,6,7”,并且isReturnCount=1,则返回数字3,否则返回“5,6,7”),默认为:0
|
|
20072
|
+
isReturnCount = retData.allCellValsEw.length < 7 ? 0 : retData.allCellValsEw[6];
|
|
20066
20073
|
try {
|
|
20067
20074
|
// 处理array1和array2的默认值
|
|
20068
20075
|
if (array1 == null || array1 == undefined || (typeof array1 == 'string' && array1.trim().length == 0)) {
|
|
@@ -20077,7 +20084,7 @@ const FormulaUtils = {
|
|
|
20077
20084
|
if (typeof array2 == 'string' && array2.trim().length > 0) {
|
|
20078
20085
|
array2 = [array2];
|
|
20079
20086
|
}
|
|
20080
|
-
// 如果operator、value、delimiter、isOpposite为数组,则设置其取第一个值
|
|
20087
|
+
// 如果operator、value、delimiter、isOpposite、isReturnCount为数组,则设置其取第一个值
|
|
20081
20088
|
if (Array.isArray(operator) && operator.length > 0) {
|
|
20082
20089
|
operator = operator[0];
|
|
20083
20090
|
}
|
|
@@ -20090,6 +20097,9 @@ const FormulaUtils = {
|
|
|
20090
20097
|
if (Array.isArray(isOpposite) && isOpposite.length > 0) {
|
|
20091
20098
|
isOpposite = isOpposite[0];
|
|
20092
20099
|
}
|
|
20100
|
+
if (Array.isArray(isReturnCount) && isReturnCount.length > 0) {
|
|
20101
|
+
isReturnCount = isReturnCount[0];
|
|
20102
|
+
}
|
|
20093
20103
|
// 设置isOpposite的默认值
|
|
20094
20104
|
if (isOpposite == '1' || isOpposite == '0') {
|
|
20095
20105
|
isOpposite = parseInt(isOpposite);
|
|
@@ -20097,6 +20107,13 @@ const FormulaUtils = {
|
|
|
20097
20107
|
if (isOpposite != 0 && isOpposite != 1) {
|
|
20098
20108
|
isOpposite = 0;
|
|
20099
20109
|
}
|
|
20110
|
+
// 设置isReturnCount的默认值
|
|
20111
|
+
if (isReturnCount == '1' || isReturnCount == '0') {
|
|
20112
|
+
isReturnCount = parseInt(isReturnCount);
|
|
20113
|
+
}
|
|
20114
|
+
if (isReturnCount != 0 && isReturnCount != 1) {
|
|
20115
|
+
isReturnCount = 0;
|
|
20116
|
+
}
|
|
20100
20117
|
// TODO:暂定此情况
|
|
20101
20118
|
// 第一个参数是否为单值(array1为一个值的时候,此时array2的所有元素可能需要参与计算,满足要求的就返回array2中的值)
|
|
20102
20119
|
const isSingleValue1 = array2.length > array1.length && array1.length == 1;
|
|
@@ -20201,8 +20218,8 @@ const FormulaUtils = {
|
|
|
20201
20218
|
return '';
|
|
20202
20219
|
})
|
|
20203
20220
|
.filter((val) => val !== '' && val != '/' && val != 'null' && val != null && val != undefined); // 过滤空值
|
|
20204
|
-
// 使用指定的分隔符连接结果[2,3,5]
|
|
20205
|
-
return resultValues.join(delimiter);
|
|
20221
|
+
// 使用指定的分隔符连接结果[2,3,5]
|
|
20222
|
+
return isReturnCount == 1 ? resultValues.length : resultValues.join(delimiter);
|
|
20206
20223
|
}
|
|
20207
20224
|
catch (error) {
|
|
20208
20225
|
// 任何错误都返回"/"
|