rapid-spreadjs 1.0.54 → 1.0.56
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 +43 -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 +43 -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/dist/utils/sheet.d.ts +3 -2
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -520,9 +520,10 @@ const SheetUtils = {
|
|
|
520
520
|
* 设置当前活动工作表的水印和数据绑定是否显示
|
|
521
521
|
* @param spread 工作簿实例
|
|
522
522
|
* @param cells 数据绑定单元格配置集合([{ row: number; col: number; title: string; pathPrev: string; pathField: string }])
|
|
523
|
-
* @param isShow
|
|
523
|
+
* @param isShow 是否显示水印
|
|
524
|
+
* @param isShowBindPath 是否显示数据绑定路径,默认为:true
|
|
524
525
|
*/
|
|
525
|
-
setActiveSheetWatermark: (spread, cells,
|
|
526
|
+
setActiveSheetWatermark: (spread, cells, isShowWatermark, isShowBindPath = true) => {
|
|
526
527
|
if (cells == null || cells == undefined) {
|
|
527
528
|
return;
|
|
528
529
|
}
|
|
@@ -531,9 +532,9 @@ const SheetUtils = {
|
|
|
531
532
|
sheet.suspendPaint();
|
|
532
533
|
cells.forEach((cell) => {
|
|
533
534
|
// 设置或移除水印标签
|
|
534
|
-
sheet.getCell(cell.row, cell.col).watermark(
|
|
535
|
+
sheet.getCell(cell.row, cell.col).watermark(isShowWatermark ? `{${cell.title}}` : undefined);
|
|
535
536
|
// 设置或移除绑定路径
|
|
536
|
-
sheet.setBindingPath(cell.row, cell.col,
|
|
537
|
+
sheet.setBindingPath(cell.row, cell.col, isShowBindPath ? `${cell.pathPrev}.${cell.pathField}` : undefined);
|
|
537
538
|
});
|
|
538
539
|
// 恢复绘制
|
|
539
540
|
sheet.resumePaint();
|
|
@@ -19116,6 +19117,44 @@ const FormulaUtils = {
|
|
|
19116
19117
|
return bzc;
|
|
19117
19118
|
},
|
|
19118
19119
|
},
|
|
19120
|
+
{
|
|
19121
|
+
funName: 'YJFRAC',
|
|
19122
|
+
funDesc: '根据小数返回分数(1/x)形式的文本(如:1/300、1/478)',
|
|
19123
|
+
funDefaultVal: null,
|
|
19124
|
+
isAcceptArea: true,
|
|
19125
|
+
funParams: [
|
|
19126
|
+
{
|
|
19127
|
+
name: '被除数',
|
|
19128
|
+
repeatable: false,
|
|
19129
|
+
optional: false,
|
|
19130
|
+
},
|
|
19131
|
+
{
|
|
19132
|
+
name: '除数',
|
|
19133
|
+
repeatable: false,
|
|
19134
|
+
optional: false,
|
|
19135
|
+
},
|
|
19136
|
+
],
|
|
19137
|
+
funCallback: (spread, sheet, retData) => {
|
|
19138
|
+
//如果传递的参数小于2个,则返回空字符串
|
|
19139
|
+
if (retData.allCellVals.length < 2) {
|
|
19140
|
+
return '';
|
|
19141
|
+
}
|
|
19142
|
+
const a = retData.allCellVals[0], b = retData.allCellVals[0];
|
|
19143
|
+
// 计算商 d = a / b
|
|
19144
|
+
const d = preciseCalc(a, b, 'div');
|
|
19145
|
+
// 计算绝对值的倒数 |b/a|,并四舍五入取整
|
|
19146
|
+
const absX0 = Math.abs(preciseCalc(b, a, 'div'));
|
|
19147
|
+
let x = Math.round(absX0);
|
|
19148
|
+
// 确保分母至少为1
|
|
19149
|
+
if (x < 1) {
|
|
19150
|
+
x = 1;
|
|
19151
|
+
}
|
|
19152
|
+
// 根据商的符号返回分数字符串
|
|
19153
|
+
const sign = d < 0 ? '-' : '';
|
|
19154
|
+
sheet.getCell(retData.cellObj.row, retData.cellObj.col).formatter(`${sign}1/${x}`);
|
|
19155
|
+
return d;
|
|
19156
|
+
},
|
|
19157
|
+
},
|
|
19119
19158
|
{
|
|
19120
19159
|
funName: 'YJTREND',
|
|
19121
19160
|
funDesc: '返回线性回归拟合线的一组纵坐标值(y值)',
|