@fileverse-dev/fortune-core 1.2.85 → 1.2.86-maitra-xl
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/es/api/sheet.d.ts +2 -1
- package/es/api/sheet.js +39 -4
- package/lib/api/sheet.d.ts +2 -1
- package/lib/api/sheet.js +39 -3
- package/package.json +1 -1
package/es/api/sheet.d.ts
CHANGED
|
@@ -7,4 +7,5 @@ export declare function initSheetData(draftCtx: Context, index: number, newData:
|
|
|
7
7
|
export declare function hideSheet(ctx: Context, sheetId: string): void;
|
|
8
8
|
export declare function showSheet(ctx: Context, sheetId: string): void;
|
|
9
9
|
export declare function copySheet(ctx: Context, sheetId: string): void;
|
|
10
|
-
export declare function calculateSheetFromula(ctx: Context, id: string
|
|
10
|
+
export declare function calculateSheetFromula(ctx: Context, id: string): void;
|
|
11
|
+
export declare function calculateReferencedCellSheetFromula(ctx: Context, id: string, refCell?: string[]): void;
|
package/es/api/sheet.js
CHANGED
|
@@ -2,7 +2,7 @@ import _ from "lodash";
|
|
|
2
2
|
import { v4 as uuidv4 } from "uuid";
|
|
3
3
|
import { dataToCelldata, getSheet } from "./common";
|
|
4
4
|
import { getSheetIndex } from "../utils";
|
|
5
|
-
import { api, locale } from "..";
|
|
5
|
+
import { api, execfunction, getFlowdata, insertUpdateFunctionGroup, locale, spillSortResult } from "..";
|
|
6
6
|
function isCellReferenced(formulaString, cell) {
|
|
7
7
|
function colToNumber(col) {
|
|
8
8
|
var num = 0;
|
|
@@ -148,7 +148,31 @@ export function copySheet(ctx, sheetId) {
|
|
|
148
148
|
sheetOrderList[ctx.luckysheetfile[ctx.luckysheetfile.length - 1].id] = order;
|
|
149
149
|
api.setSheetOrder(ctx, sheetOrderList);
|
|
150
150
|
}
|
|
151
|
-
export function calculateSheetFromula(ctx, id
|
|
151
|
+
export function calculateSheetFromula(ctx, id) {
|
|
152
|
+
var _a, _b, _c;
|
|
153
|
+
var index = getSheetIndex(ctx, id);
|
|
154
|
+
if (!ctx.luckysheetfile[index].data) return;
|
|
155
|
+
for (var r = 0; r < ctx.luckysheetfile[index].data.length; r += 1) {
|
|
156
|
+
for (var c = 0; c < ctx.luckysheetfile[index].data[r].length; c += 1) {
|
|
157
|
+
if (!((_a = ctx.luckysheetfile[index].data[r][c]) === null || _a === void 0 ? void 0 : _a.f) || ((_b = ctx.luckysheetfile[index].data[r][c]) === null || _b === void 0 ? void 0 : _b.isDataBlockFormula)) {
|
|
158
|
+
continue;
|
|
159
|
+
}
|
|
160
|
+
var result = execfunction(ctx, (_c = ctx.luckysheetfile[index].data[r][c]) === null || _c === void 0 ? void 0 : _c.f, r, c, id);
|
|
161
|
+
var isValueArray = Array.isArray(result[1]);
|
|
162
|
+
if (isValueArray) {
|
|
163
|
+
var value = {
|
|
164
|
+
f: result[2],
|
|
165
|
+
v: result[1]
|
|
166
|
+
};
|
|
167
|
+
spillSortResult(ctx, r, c, value, getFlowdata(ctx));
|
|
168
|
+
} else {
|
|
169
|
+
api.setCellValue(ctx, r, c, result[1], null);
|
|
170
|
+
}
|
|
171
|
+
insertUpdateFunctionGroup(ctx, r, c, id);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
export function calculateReferencedCellSheetFromula(ctx, id, refCell) {
|
|
152
176
|
var _a, _b, _c, _d, _e, _f;
|
|
153
177
|
var index = getSheetIndex(ctx, id);
|
|
154
178
|
if (!ctx.luckysheetfile[index].data) return;
|
|
@@ -162,10 +186,21 @@ export function calculateSheetFromula(ctx, id, refCell) {
|
|
|
162
186
|
return isCellReferenced((_a = ctx.luckysheetfile[index].data[r][c]) === null || _a === void 0 ? void 0 : _a.f, cell);
|
|
163
187
|
});
|
|
164
188
|
}
|
|
165
|
-
|
|
166
|
-
if (isRef && !((_e = ctx.luckysheetfile[index].data[r][c]) === null || _e === void 0 ? void 0 : _e.f) || ((_f = ctx.luckysheetfile[index].data[r][c]) === null || _f === void 0 ? void 0 : _f.isDataBlockFormula)) {
|
|
189
|
+
if (isRef && !((_d = ctx.luckysheetfile[index].data[r][c]) === null || _d === void 0 ? void 0 : _d.f) || ((_e = ctx.luckysheetfile[index].data[r][c]) === null || _e === void 0 ? void 0 : _e.isDataBlockFormula)) {
|
|
167
190
|
return "continue";
|
|
168
191
|
}
|
|
192
|
+
var result = execfunction(ctx, (_f = ctx.luckysheetfile[index].data[r][c]) === null || _f === void 0 ? void 0 : _f.f, r, c, id);
|
|
193
|
+
var isValueArray = Array.isArray(result[1]);
|
|
194
|
+
if (isValueArray) {
|
|
195
|
+
var value = {
|
|
196
|
+
f: result[2],
|
|
197
|
+
v: result[1]
|
|
198
|
+
};
|
|
199
|
+
spillSortResult(ctx, r, c, value, getFlowdata(ctx));
|
|
200
|
+
} else {
|
|
201
|
+
api.setCellValue(ctx, r, c, result[1], null);
|
|
202
|
+
}
|
|
203
|
+
insertUpdateFunctionGroup(ctx, r, c, id);
|
|
169
204
|
};
|
|
170
205
|
for (var c = 0; c < ctx.luckysheetfile[index].data[r].length; c += 1) {
|
|
171
206
|
_loop_2(c);
|
package/lib/api/sheet.d.ts
CHANGED
|
@@ -7,4 +7,5 @@ export declare function initSheetData(draftCtx: Context, index: number, newData:
|
|
|
7
7
|
export declare function hideSheet(ctx: Context, sheetId: string): void;
|
|
8
8
|
export declare function showSheet(ctx: Context, sheetId: string): void;
|
|
9
9
|
export declare function copySheet(ctx: Context, sheetId: string): void;
|
|
10
|
-
export declare function calculateSheetFromula(ctx: Context, id: string
|
|
10
|
+
export declare function calculateSheetFromula(ctx: Context, id: string): void;
|
|
11
|
+
export declare function calculateReferencedCellSheetFromula(ctx: Context, id: string, refCell?: string[]): void;
|
package/lib/api/sheet.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.calculateReferencedCellSheetFromula = calculateReferencedCellSheetFromula;
|
|
6
7
|
exports.calculateSheetFromula = calculateSheetFromula;
|
|
7
8
|
exports.copySheet = copySheet;
|
|
8
9
|
exports.getAllSheets = getAllSheets;
|
|
@@ -165,7 +166,31 @@ function copySheet(ctx, sheetId) {
|
|
|
165
166
|
sheetOrderList[ctx.luckysheetfile[ctx.luckysheetfile.length - 1].id] = order;
|
|
166
167
|
_2.api.setSheetOrder(ctx, sheetOrderList);
|
|
167
168
|
}
|
|
168
|
-
function calculateSheetFromula(ctx, id
|
|
169
|
+
function calculateSheetFromula(ctx, id) {
|
|
170
|
+
var _a, _b, _c;
|
|
171
|
+
var index = (0, _utils.getSheetIndex)(ctx, id);
|
|
172
|
+
if (!ctx.luckysheetfile[index].data) return;
|
|
173
|
+
for (var r = 0; r < ctx.luckysheetfile[index].data.length; r += 1) {
|
|
174
|
+
for (var c = 0; c < ctx.luckysheetfile[index].data[r].length; c += 1) {
|
|
175
|
+
if (!((_a = ctx.luckysheetfile[index].data[r][c]) === null || _a === void 0 ? void 0 : _a.f) || ((_b = ctx.luckysheetfile[index].data[r][c]) === null || _b === void 0 ? void 0 : _b.isDataBlockFormula)) {
|
|
176
|
+
continue;
|
|
177
|
+
}
|
|
178
|
+
var result = (0, _2.execfunction)(ctx, (_c = ctx.luckysheetfile[index].data[r][c]) === null || _c === void 0 ? void 0 : _c.f, r, c, id);
|
|
179
|
+
var isValueArray = Array.isArray(result[1]);
|
|
180
|
+
if (isValueArray) {
|
|
181
|
+
var value = {
|
|
182
|
+
f: result[2],
|
|
183
|
+
v: result[1]
|
|
184
|
+
};
|
|
185
|
+
(0, _2.spillSortResult)(ctx, r, c, value, (0, _2.getFlowdata)(ctx));
|
|
186
|
+
} else {
|
|
187
|
+
_2.api.setCellValue(ctx, r, c, result[1], null);
|
|
188
|
+
}
|
|
189
|
+
(0, _2.insertUpdateFunctionGroup)(ctx, r, c, id);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
function calculateReferencedCellSheetFromula(ctx, id, refCell) {
|
|
169
194
|
var _a, _b, _c, _d, _e, _f;
|
|
170
195
|
var index = (0, _utils.getSheetIndex)(ctx, id);
|
|
171
196
|
if (!ctx.luckysheetfile[index].data) return;
|
|
@@ -179,10 +204,21 @@ function calculateSheetFromula(ctx, id, refCell) {
|
|
|
179
204
|
return isCellReferenced((_a = ctx.luckysheetfile[index].data[r][c]) === null || _a === void 0 ? void 0 : _a.f, cell);
|
|
180
205
|
});
|
|
181
206
|
}
|
|
182
|
-
|
|
183
|
-
if (isRef && !((_e = ctx.luckysheetfile[index].data[r][c]) === null || _e === void 0 ? void 0 : _e.f) || ((_f = ctx.luckysheetfile[index].data[r][c]) === null || _f === void 0 ? void 0 : _f.isDataBlockFormula)) {
|
|
207
|
+
if (isRef && !((_d = ctx.luckysheetfile[index].data[r][c]) === null || _d === void 0 ? void 0 : _d.f) || ((_e = ctx.luckysheetfile[index].data[r][c]) === null || _e === void 0 ? void 0 : _e.isDataBlockFormula)) {
|
|
184
208
|
return "continue";
|
|
185
209
|
}
|
|
210
|
+
var result = (0, _2.execfunction)(ctx, (_f = ctx.luckysheetfile[index].data[r][c]) === null || _f === void 0 ? void 0 : _f.f, r, c, id);
|
|
211
|
+
var isValueArray = Array.isArray(result[1]);
|
|
212
|
+
if (isValueArray) {
|
|
213
|
+
var value = {
|
|
214
|
+
f: result[2],
|
|
215
|
+
v: result[1]
|
|
216
|
+
};
|
|
217
|
+
(0, _2.spillSortResult)(ctx, r, c, value, (0, _2.getFlowdata)(ctx));
|
|
218
|
+
} else {
|
|
219
|
+
_2.api.setCellValue(ctx, r, c, result[1], null);
|
|
220
|
+
}
|
|
221
|
+
(0, _2.insertUpdateFunctionGroup)(ctx, r, c, id);
|
|
186
222
|
};
|
|
187
223
|
for (var c = 0; c < ctx.luckysheetfile[index].data[r].length; c += 1) {
|
|
188
224
|
_loop_2(c);
|