rapid-spreadjs 1.0.90 → 1.0.92
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 +50 -27
- 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 +50 -27
- 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/dist/utils/echarts-all.d.ts +0 -2
- package/dist/utils/sheet.d.ts +3 -3
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -604,11 +604,11 @@ const SheetUtils = {
|
|
|
604
604
|
// return GC.Spread.Sheets.CalcEngine.rangeToFormula(cellRange);
|
|
605
605
|
},
|
|
606
606
|
/**
|
|
607
|
-
*
|
|
607
|
+
* 获取工作表中所有纯值、无值或公式单元格的范围选择字符串
|
|
608
608
|
* @param sheet 工作表对象
|
|
609
|
-
* @param
|
|
609
|
+
* @param getType 获取类型(1:纯值、2:无值、3:公式),默认为:1
|
|
610
610
|
*/
|
|
611
|
-
getCellsRangeStr: (sheet,
|
|
611
|
+
getCellsRangeStr: (sheet, getType = 1) => {
|
|
612
612
|
const range = { row: 0, col: 1, rowCount: sheet.getRowCount(), colCount: 77 };
|
|
613
613
|
// 所有单元格对象集合
|
|
614
614
|
const allCells = SheetUtils.getAllCellObjsByRanges(sheet, [range]);
|
|
@@ -618,8 +618,10 @@ const SheetUtils = {
|
|
|
618
618
|
allCells.forEach((cell) => {
|
|
619
619
|
const value = sheet.getValue(cell.row, cell.col);
|
|
620
620
|
const formula = sheet.getFormula(cell.row, cell.col);
|
|
621
|
-
// 非公式+有值(非空) ||
|
|
622
|
-
if ((
|
|
621
|
+
// 非公式+有值(非空) || 无值 || 公式
|
|
622
|
+
if ((getType == 1 && !formula && value !== null && value !== undefined && value !== '') ||
|
|
623
|
+
(getType == 2 && (value == null || value == undefined || value == '')) ||
|
|
624
|
+
(getType == 3 && formula)) {
|
|
623
625
|
retCells.push(cell);
|
|
624
626
|
}
|
|
625
627
|
});
|
|
@@ -8082,19 +8084,23 @@ const EChartsUtilsAll = {
|
|
|
8082
8084
|
let title = config.chartTitle, xName = config.chartXName, yName = config.chartYName;
|
|
8083
8085
|
let legendData = [], seriesData = [];
|
|
8084
8086
|
lineData.forEach((item, index) => {
|
|
8085
|
-
|
|
8086
|
-
|
|
8087
|
-
|
|
8088
|
-
|
|
8089
|
-
|
|
8090
|
-
|
|
8091
|
-
|
|
8092
|
-
|
|
8093
|
-
|
|
8094
|
-
|
|
8095
|
-
|
|
8096
|
-
|
|
8097
|
-
|
|
8087
|
+
// 排除x轴和y轴所有数据都为0的
|
|
8088
|
+
if (xDataArr[index].some((x) => x != 0 && x != null && x != undefined && x != '/') &&
|
|
8089
|
+
yDataArr[index].some((x) => x != 0 && x != null && x != undefined && x != '/')) {
|
|
8090
|
+
legendData.push(item.legend);
|
|
8091
|
+
seriesData.push({
|
|
8092
|
+
name: item.legend,
|
|
8093
|
+
type: 'line',
|
|
8094
|
+
data: xDataArr[0].filter((x) => x != 0 && x != null && x != undefined && x != '/').map((x, idx) => [x, yDataArr[index][idx]]),
|
|
8095
|
+
symbol: index == 0 ? 'triangle' : index == 1 ? 'circle' : 'rect',
|
|
8096
|
+
lineStyle: {
|
|
8097
|
+
color: item.lineColor,
|
|
8098
|
+
// width: 2,
|
|
8099
|
+
type: index == 2 ? 'solid' : 'dotted', // 虚线或实线
|
|
8100
|
+
},
|
|
8101
|
+
smooth: true, // 平滑曲线
|
|
8102
|
+
});
|
|
8103
|
+
}
|
|
8098
8104
|
});
|
|
8099
8105
|
// 判断y轴数据是否为/、‘’、null、undefined或者没有数据
|
|
8100
8106
|
let yValIsAllNull = false;
|
|
@@ -8158,7 +8164,7 @@ const EChartsUtilsAll = {
|
|
|
8158
8164
|
name: 'X轴',
|
|
8159
8165
|
min: 0, // 从 x=0 开始
|
|
8160
8166
|
//max: xEnd, // 扩展到后推位置
|
|
8161
|
-
interval: 30, // 设置刻度间隔为10
|
|
8167
|
+
//interval: 30, // 设置刻度间隔为10
|
|
8162
8168
|
axisLine: { show: true },
|
|
8163
8169
|
},
|
|
8164
8170
|
yAxis: {
|
|
@@ -8468,9 +8474,9 @@ const EChartsUtilsAll = {
|
|
|
8468
8474
|
if (!yValIsAllNull) {
|
|
8469
8475
|
// 计算多项式回归系数(阶数为2)
|
|
8470
8476
|
const coefficients = polynomialRegression(xData, yData, 2);
|
|
8471
|
-
a = coefficients[2].toFixed(
|
|
8472
|
-
b = coefficients[1].toFixed(
|
|
8473
|
-
c = coefficients[0].toFixed(
|
|
8477
|
+
a = coefficients[2].toFixed(4);
|
|
8478
|
+
b = coefficients[1].toFixed(4);
|
|
8479
|
+
c = coefficients[0].toFixed(4);
|
|
8474
8480
|
const minX = Math.min(...xData);
|
|
8475
8481
|
const step = (maxX - minX) / 100;
|
|
8476
8482
|
for (let x = minX; x <= maxX; x += step) {
|
|
@@ -8531,7 +8537,7 @@ const EChartsUtilsAll = {
|
|
|
8531
8537
|
fontSize: 14,
|
|
8532
8538
|
padding: [10, 0, 0, 0],
|
|
8533
8539
|
},
|
|
8534
|
-
interval: 0.05, // 设置刻度间隔为0.05
|
|
8540
|
+
//interval: 0.05, // 设置刻度间隔为0.05
|
|
8535
8541
|
min: 0,
|
|
8536
8542
|
max: maxX + 0.05,
|
|
8537
8543
|
},
|
|
@@ -20033,6 +20039,11 @@ const FormulaUtils = {
|
|
|
20033
20039
|
repeatable: false,
|
|
20034
20040
|
optional: false,
|
|
20035
20041
|
},
|
|
20042
|
+
{
|
|
20043
|
+
name: '是否返回符合或不符合结果的数量(传数字的1或0,0:不返回数量、1:返回数量),默认为:0',
|
|
20044
|
+
repeatable: false,
|
|
20045
|
+
optional: false,
|
|
20046
|
+
},
|
|
20036
20047
|
],
|
|
20037
20048
|
funCallback: (spread, sheet, retData) => {
|
|
20038
20049
|
// 如果传递的参数小于5个,则返回空字符串
|
|
@@ -20040,7 +20051,9 @@ const FormulaUtils = {
|
|
|
20040
20051
|
if (retData.allCellValsEw.length < 5) {
|
|
20041
20052
|
return '/';
|
|
20042
20053
|
}
|
|
20043
|
-
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]
|
|
20054
|
+
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],
|
|
20055
|
+
// 是否返回符合或不符合结果的数量(如最终符合或不符合的结果为“5,6,7”,并且isReturnCount=1,则返回数字3,否则返回“5,6,7”),默认为:0
|
|
20056
|
+
isReturnCount = retData.allCellValsEw.length < 7 ? 0 : retData.allCellValsEw[6];
|
|
20044
20057
|
try {
|
|
20045
20058
|
// 处理array1和array2的默认值
|
|
20046
20059
|
if (array1 == null || array1 == undefined || (typeof array1 == 'string' && array1.trim().length == 0)) {
|
|
@@ -20055,7 +20068,7 @@ const FormulaUtils = {
|
|
|
20055
20068
|
if (typeof array2 == 'string' && array2.trim().length > 0) {
|
|
20056
20069
|
array2 = [array2];
|
|
20057
20070
|
}
|
|
20058
|
-
// 如果operator、value、delimiter、isOpposite为数组,则设置其取第一个值
|
|
20071
|
+
// 如果operator、value、delimiter、isOpposite、isReturnCount为数组,则设置其取第一个值
|
|
20059
20072
|
if (Array.isArray(operator) && operator.length > 0) {
|
|
20060
20073
|
operator = operator[0];
|
|
20061
20074
|
}
|
|
@@ -20068,6 +20081,9 @@ const FormulaUtils = {
|
|
|
20068
20081
|
if (Array.isArray(isOpposite) && isOpposite.length > 0) {
|
|
20069
20082
|
isOpposite = isOpposite[0];
|
|
20070
20083
|
}
|
|
20084
|
+
if (Array.isArray(isReturnCount) && isReturnCount.length > 0) {
|
|
20085
|
+
isReturnCount = isReturnCount[0];
|
|
20086
|
+
}
|
|
20071
20087
|
// 设置isOpposite的默认值
|
|
20072
20088
|
if (isOpposite == '1' || isOpposite == '0') {
|
|
20073
20089
|
isOpposite = parseInt(isOpposite);
|
|
@@ -20075,6 +20091,13 @@ const FormulaUtils = {
|
|
|
20075
20091
|
if (isOpposite != 0 && isOpposite != 1) {
|
|
20076
20092
|
isOpposite = 0;
|
|
20077
20093
|
}
|
|
20094
|
+
// 设置isReturnCount的默认值
|
|
20095
|
+
if (isReturnCount == '1' || isReturnCount == '0') {
|
|
20096
|
+
isReturnCount = parseInt(isReturnCount);
|
|
20097
|
+
}
|
|
20098
|
+
if (isReturnCount != 0 && isReturnCount != 1) {
|
|
20099
|
+
isReturnCount = 0;
|
|
20100
|
+
}
|
|
20078
20101
|
// TODO:暂定此情况
|
|
20079
20102
|
// 第一个参数是否为单值(array1为一个值的时候,此时array2的所有元素可能需要参与计算,满足要求的就返回array2中的值)
|
|
20080
20103
|
const isSingleValue1 = array2.length > array1.length && array1.length == 1;
|
|
@@ -20179,8 +20202,8 @@ const FormulaUtils = {
|
|
|
20179
20202
|
return '';
|
|
20180
20203
|
})
|
|
20181
20204
|
.filter((val) => val !== '' && val != '/' && val != 'null' && val != null && val != undefined); // 过滤空值
|
|
20182
|
-
// 使用指定的分隔符连接结果[2,3,5]
|
|
20183
|
-
return resultValues.join(delimiter);
|
|
20205
|
+
// 使用指定的分隔符连接结果[2,3,5]
|
|
20206
|
+
return isReturnCount == 1 ? resultValues.length : resultValues.join(delimiter);
|
|
20184
20207
|
}
|
|
20185
20208
|
catch (error) {
|
|
20186
20209
|
// 任何错误都返回"/"
|