@leankylin-sheet/core 5.0.0 → 5.1.0
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/README.md +19 -19
- package/dist/api/sheet.d.ts +5 -0
- package/dist/index.esm.js +143 -15
- package/dist/index.js +142 -14
- package/dist/settings.d.ts +2 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
# @leankylin-sheet/core
|
|
2
|
-
|
|
3
|
-
LeankylinSheet is a drop-in javascript spreadsheet library that provides rich features like Excel and Google Sheets
|
|
4
|
-
|
|
5
|
-
See our repo [leankylin-sheet](http://114.55.85.79:19999/leankylin-front/leankylin-sheet) for more information.
|
|
6
|
-
|
|
7
|
-
## Install
|
|
8
|
-
|
|
9
|
-
Using npm:
|
|
10
|
-
|
|
11
|
-
```bash
|
|
12
|
-
$ npm install --save @leankylin-sheet/core
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
or using yarn:
|
|
16
|
-
|
|
17
|
-
```bash
|
|
18
|
-
$ yarn add @leankylin-sheet/core
|
|
19
|
-
```
|
|
1
|
+
# @leankylin-sheet/core
|
|
2
|
+
|
|
3
|
+
LeankylinSheet is a drop-in javascript spreadsheet library that provides rich features like Excel and Google Sheets
|
|
4
|
+
|
|
5
|
+
See our repo [leankylin-sheet](http://114.55.85.79:19999/leankylin-front/leankylin-sheet) for more information.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
Using npm:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
$ npm install --save @leankylin-sheet/core
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
or using yarn:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
$ yarn add @leankylin-sheet/core
|
|
19
|
+
```
|
package/dist/api/sheet.d.ts
CHANGED
|
@@ -9,3 +9,8 @@ export declare function hideSheet(ctx: Context, sheetId: string): void;
|
|
|
9
9
|
export declare function showSheet(ctx: Context, sheetId: string): void;
|
|
10
10
|
export declare function copySheet(ctx: Context, sheetId: string, hooks: Hooks): void;
|
|
11
11
|
export declare function calculateSheetFromula(ctx: Context, id: string): void;
|
|
12
|
+
export declare function calculateSheetByCells(ctx: Context, cells: {
|
|
13
|
+
r: number;
|
|
14
|
+
c: number;
|
|
15
|
+
id: string;
|
|
16
|
+
}[]): void;
|
package/dist/index.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import _, { isPlainObject, pick } from 'lodash';
|
|
1
|
+
import _, { isPlainObject, uniqBy, pick } from 'lodash';
|
|
2
2
|
import numeral from 'numeral';
|
|
3
3
|
import dayjs from 'dayjs';
|
|
4
4
|
import { Parser, ERROR_REF } from '@leankylin-sheet/formula-parser';
|
|
@@ -33798,13 +33798,13 @@ var make_ssf = function make_ssf(SSF) {
|
|
|
33798
33798
|
return general_fmt_num_base;
|
|
33799
33799
|
}();
|
|
33800
33800
|
SSF._general_num = general_fmt_num;
|
|
33801
|
-
/*
|
|
33802
|
-
"General" rules:
|
|
33803
|
-
- text is passed through ("@")
|
|
33804
|
-
- booleans are rendered as TRUE/FALSE
|
|
33805
|
-
- "up to 11 characters" displayed for numbers
|
|
33806
|
-
- Default date format (code 14) used for Dates
|
|
33807
|
-
TODO: technically the display depends on the width of the cell
|
|
33801
|
+
/*
|
|
33802
|
+
"General" rules:
|
|
33803
|
+
- text is passed through ("@")
|
|
33804
|
+
- booleans are rendered as TRUE/FALSE
|
|
33805
|
+
- "up to 11 characters" displayed for numbers
|
|
33806
|
+
- Default date format (code 14) used for Dates
|
|
33807
|
+
TODO: technically the display depends on the width of the cell
|
|
33808
33808
|
*/
|
|
33809
33809
|
function general_fmt(v, opts) {
|
|
33810
33810
|
switch (_typeof(v)) {
|
|
@@ -46539,21 +46539,126 @@ function copySheet(ctx, sheetId, hooks) {
|
|
|
46539
46539
|
(_hooks$onCopySheet = hooks.onCopySheet) === null || _hooks$onCopySheet === void 0 ? void 0 : _hooks$onCopySheet.call(hooks, sheetId, copyId);
|
|
46540
46540
|
}
|
|
46541
46541
|
function calculateSheetFromula(ctx, id) {
|
|
46542
|
+
console.time("calcTime:".concat(id));
|
|
46542
46543
|
var index$1 = getSheetIndex(ctx, id);
|
|
46544
|
+
var luckysheetfile = ctx.luckysheetfile;
|
|
46545
|
+
var file = luckysheetfile[index$1];
|
|
46546
|
+
var calcChain = file.calcChain;
|
|
46547
|
+
if (_.isNil(calcChain)) {
|
|
46548
|
+
calcChain = [];
|
|
46549
|
+
}
|
|
46543
46550
|
if (!ctx.luckysheetfile[index$1].data) return;
|
|
46544
46551
|
for (var r = 0; r < ctx.luckysheetfile[index$1].data.length; r += 1) {
|
|
46545
46552
|
for (var c = 0; c < ctx.luckysheetfile[index$1].data[r].length; c += 1) {
|
|
46546
|
-
var
|
|
46547
|
-
if (!(
|
|
46553
|
+
var cell = ctx.luckysheetfile[index$1].data[r][c];
|
|
46554
|
+
if (!(cell === null || cell === void 0 ? void 0 : cell.f)) {
|
|
46555
|
+
continue;
|
|
46556
|
+
}
|
|
46557
|
+
var cc = {
|
|
46558
|
+
r: r,
|
|
46559
|
+
c: c,
|
|
46560
|
+
id: id
|
|
46561
|
+
};
|
|
46562
|
+
calcChain.push(cc);
|
|
46563
|
+
var result = execfunction(ctx, cell === null || cell === void 0 ? void 0 : cell.f, r, c, id, undefined, true);
|
|
46564
|
+
var newV = result[1];
|
|
46565
|
+
if (newV === cell.v) {
|
|
46548
46566
|
continue;
|
|
46549
46567
|
}
|
|
46550
|
-
var result = execfunction(ctx, (_ctx$luckysheetfile$i2 = ctx.luckysheetfile[index$1].data[r][c]) === null || _ctx$luckysheetfile$i2 === void 0 ? void 0 : _ctx$luckysheetfile$i2.f, r, c, id);
|
|
46551
46568
|
setCellValue$1(ctx, r, c, result[1], null, {
|
|
46552
46569
|
id: id
|
|
46553
46570
|
});
|
|
46554
|
-
insertUpdateFunctionGroup(ctx, r, c, id);
|
|
46555
46571
|
}
|
|
46556
46572
|
}
|
|
46573
|
+
file.calcChain = uniqBy(calcChain, function (item) {
|
|
46574
|
+
return item.r + item.c + item.id;
|
|
46575
|
+
});
|
|
46576
|
+
ctx.luckysheetfile = luckysheetfile;
|
|
46577
|
+
console.timeEnd("calcTime:".concat(id));
|
|
46578
|
+
}
|
|
46579
|
+
function parseCellReferences(expression) {
|
|
46580
|
+
if (typeof expression !== "string" || expression.trim() === "") {
|
|
46581
|
+
return [];
|
|
46582
|
+
}
|
|
46583
|
+
var cellRegex = /([A-Za-z0-9_]+!)?[A-Za-z]+\d+/g;
|
|
46584
|
+
var matches = expression.match(cellRegex) || [];
|
|
46585
|
+
var uniqueCells = matches.map(function (cell) {
|
|
46586
|
+
return cell.trim().toUpperCase();
|
|
46587
|
+
});
|
|
46588
|
+
return uniqueCells;
|
|
46589
|
+
}
|
|
46590
|
+
function calculateSheetByCells(ctx, cells) {
|
|
46591
|
+
console.time("calculateSheetByCellsTime");
|
|
46592
|
+
var fileList = ctx.luckysheetfile;
|
|
46593
|
+
var sheetIdNameMap = {};
|
|
46594
|
+
for (var ffIndex = 0; ffIndex < fileList.length; ffIndex++) {
|
|
46595
|
+
var _f$name;
|
|
46596
|
+
var f = fileList[ffIndex];
|
|
46597
|
+
sheetIdNameMap[f.id] = (_f$name = f.name) === null || _f$name === void 0 ? void 0 : _f$name.toLocaleUpperCase();
|
|
46598
|
+
}
|
|
46599
|
+
var needUpdateCell = [];
|
|
46600
|
+
var updatedMap = {};
|
|
46601
|
+
for (var index$1 = 0; index$1 < cells.length; index$1++) {
|
|
46602
|
+
var _cells$index = cells[index$1],
|
|
46603
|
+
r = _cells$index.r,
|
|
46604
|
+
c = _cells$index.c,
|
|
46605
|
+
id = _cells$index.id;
|
|
46606
|
+
updatedMap["".concat(sheetIdNameMap[id], "!").concat(indexToColumnChar(c) + (r + 1))] = true;
|
|
46607
|
+
}
|
|
46608
|
+
var _loop = function _loop() {
|
|
46609
|
+
var file = fileList[fIndex];
|
|
46610
|
+
var sheetId = file.id;
|
|
46611
|
+
var _file$calcChain = file.calcChain,
|
|
46612
|
+
calcChain = _file$calcChain === void 0 ? [] : _file$calcChain;
|
|
46613
|
+
for (var _index = 0; _index < calcChain.length; _index++) {
|
|
46614
|
+
var _parseCellReferences;
|
|
46615
|
+
var _calcChain$_index = calcChain[_index],
|
|
46616
|
+
_r2 = _calcChain$_index.r,
|
|
46617
|
+
_c2 = _calcChain$_index.c;
|
|
46618
|
+
var cell = file.data[_r2][_c2];
|
|
46619
|
+
if (!(cell === null || cell === void 0 ? void 0 : cell.f)) {
|
|
46620
|
+
continue;
|
|
46621
|
+
}
|
|
46622
|
+
var devCell = (_parseCellReferences = parseCellReferences(cell.f)) === null || _parseCellReferences === void 0 ? void 0 : _parseCellReferences.map(function (item) {
|
|
46623
|
+
return item.includes("!") ? item : "".concat(sheetIdNameMap[sheetId], "!").concat(item);
|
|
46624
|
+
});
|
|
46625
|
+
var n = devCell === null || devCell === void 0 ? void 0 : devCell.some(function (item) {
|
|
46626
|
+
return updatedMap["".concat(item)];
|
|
46627
|
+
});
|
|
46628
|
+
if (n) {
|
|
46629
|
+
needUpdateCell.push({
|
|
46630
|
+
r: _r2,
|
|
46631
|
+
c: _c2,
|
|
46632
|
+
id: sheetId,
|
|
46633
|
+
f: cell.f,
|
|
46634
|
+
v: cell.v
|
|
46635
|
+
});
|
|
46636
|
+
}
|
|
46637
|
+
}
|
|
46638
|
+
};
|
|
46639
|
+
for (var fIndex = 0; fIndex < fileList.length; fIndex++) {
|
|
46640
|
+
_loop();
|
|
46641
|
+
}
|
|
46642
|
+
needUpdateCell = uniqBy(needUpdateCell, function (item) {
|
|
46643
|
+
return "".concat(item.r, "_").concat(item.c, "_").concat(item.id);
|
|
46644
|
+
});
|
|
46645
|
+
for (var nIndex = 0; nIndex < needUpdateCell.length; nIndex++) {
|
|
46646
|
+
var _needUpdateCell$nInde = needUpdateCell[nIndex],
|
|
46647
|
+
_r = _needUpdateCell$nInde.r,
|
|
46648
|
+
_c = _needUpdateCell$nInde.c,
|
|
46649
|
+
_id = _needUpdateCell$nInde.id,
|
|
46650
|
+
_f = _needUpdateCell$nInde.f,
|
|
46651
|
+
v = _needUpdateCell$nInde.v;
|
|
46652
|
+
var result = execfunction(ctx, _f, _r, _c, _id, undefined, true);
|
|
46653
|
+
var newV = result[1];
|
|
46654
|
+
if (newV === v) {
|
|
46655
|
+
continue;
|
|
46656
|
+
}
|
|
46657
|
+
setCellValue$1(ctx, _r, _c, result[1], null, {
|
|
46658
|
+
id: _id
|
|
46659
|
+
});
|
|
46660
|
+
}
|
|
46661
|
+
console.timeEnd("calculateSheetByCellsTime");
|
|
46557
46662
|
}
|
|
46558
46663
|
|
|
46559
46664
|
function storeSheetParam(ctx) {
|
|
@@ -55629,6 +55734,14 @@ function setCellValue$1(ctx, row, column, value, cellInput) {
|
|
|
55629
55734
|
} else if (value instanceof Object) {
|
|
55630
55735
|
var _data$row;
|
|
55631
55736
|
var curv = {};
|
|
55737
|
+
if (!(data === null || data === void 0 ? void 0 : data[row])) {
|
|
55738
|
+
var needAddRow = row - ((data === null || data === void 0 ? void 0 : data.length) || 0) + 1;
|
|
55739
|
+
data === null || data === void 0 ? void 0 : data.push.apply(data, _toConsumableArray(Array.from({
|
|
55740
|
+
length: needAddRow
|
|
55741
|
+
}).map(function () {
|
|
55742
|
+
return [];
|
|
55743
|
+
})));
|
|
55744
|
+
}
|
|
55632
55745
|
if ((data === null || data === void 0 ? void 0 : (_data$row = data[row]) === null || _data$row === void 0 ? void 0 : _data$row[column]) == null) {
|
|
55633
55746
|
data[row][column] = {};
|
|
55634
55747
|
}
|
|
@@ -55640,7 +55753,11 @@ function setCellValue$1(ctx, row, column, value, cellInput) {
|
|
|
55640
55753
|
}
|
|
55641
55754
|
updateCell(ctx, row, column, cellInput, curv);
|
|
55642
55755
|
} else {
|
|
55643
|
-
var
|
|
55756
|
+
var needupdateFdev = false;
|
|
55757
|
+
var needUpdateM = false;
|
|
55758
|
+
var oldF = cell.f;
|
|
55759
|
+
var nf = value.f;
|
|
55760
|
+
var oldV = cell.v;
|
|
55644
55761
|
var nv = value.v;
|
|
55645
55762
|
if (value.ct != null) {
|
|
55646
55763
|
curv.ct = value.ct;
|
|
@@ -55656,9 +55773,17 @@ function setCellValue$1(ctx, row, column, value, cellInput) {
|
|
|
55656
55773
|
if (value.m != null) {
|
|
55657
55774
|
curv.m = value.m;
|
|
55658
55775
|
}
|
|
55659
|
-
|
|
55660
|
-
|
|
55776
|
+
if (nf !== undefined && nf !== oldF) {
|
|
55777
|
+
needupdateFdev = true;
|
|
55778
|
+
needUpdateM = true;
|
|
55779
|
+
}
|
|
55780
|
+
if (nv !== undefined && String(nv) !== String(oldV)) {
|
|
55781
|
+
needUpdateM = true;
|
|
55782
|
+
}
|
|
55783
|
+
if (needupdateFdev) {
|
|
55661
55784
|
delFunctionGroup(ctx, row, column);
|
|
55785
|
+
}
|
|
55786
|
+
if (needUpdateM) {
|
|
55662
55787
|
setCellValue(ctx, row, column, data, curv);
|
|
55663
55788
|
}
|
|
55664
55789
|
}
|
|
@@ -56192,6 +56317,7 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
56192
56317
|
showSheet: showSheet,
|
|
56193
56318
|
copySheet: copySheet,
|
|
56194
56319
|
calculateSheetFromula: calculateSheetFromula,
|
|
56320
|
+
calculateSheetByCells: calculateSheetByCells,
|
|
56195
56321
|
addSheet: addSheet$1,
|
|
56196
56322
|
deleteSheet: deleteSheet$1,
|
|
56197
56323
|
updateSheet: updateSheet$1,
|
|
@@ -56202,6 +56328,8 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
56202
56328
|
});
|
|
56203
56329
|
|
|
56204
56330
|
var defaultSettings = {
|
|
56331
|
+
renderTopToolbar: undefined,
|
|
56332
|
+
renderBottomToolbar: undefined,
|
|
56205
56333
|
headerBgColor: "#fff",
|
|
56206
56334
|
toolbarRightRender: undefined,
|
|
56207
56335
|
onClickContentEditable: undefined,
|
package/dist/index.js
CHANGED
|
@@ -33808,13 +33808,13 @@ var make_ssf = function make_ssf(SSF) {
|
|
|
33808
33808
|
return general_fmt_num_base;
|
|
33809
33809
|
}();
|
|
33810
33810
|
SSF._general_num = general_fmt_num;
|
|
33811
|
-
/*
|
|
33812
|
-
"General" rules:
|
|
33813
|
-
- text is passed through ("@")
|
|
33814
|
-
- booleans are rendered as TRUE/FALSE
|
|
33815
|
-
- "up to 11 characters" displayed for numbers
|
|
33816
|
-
- Default date format (code 14) used for Dates
|
|
33817
|
-
TODO: technically the display depends on the width of the cell
|
|
33811
|
+
/*
|
|
33812
|
+
"General" rules:
|
|
33813
|
+
- text is passed through ("@")
|
|
33814
|
+
- booleans are rendered as TRUE/FALSE
|
|
33815
|
+
- "up to 11 characters" displayed for numbers
|
|
33816
|
+
- Default date format (code 14) used for Dates
|
|
33817
|
+
TODO: technically the display depends on the width of the cell
|
|
33818
33818
|
*/
|
|
33819
33819
|
function general_fmt(v, opts) {
|
|
33820
33820
|
switch (_typeof(v)) {
|
|
@@ -46549,21 +46549,126 @@ function copySheet(ctx, sheetId, hooks) {
|
|
|
46549
46549
|
(_hooks$onCopySheet = hooks.onCopySheet) === null || _hooks$onCopySheet === void 0 ? void 0 : _hooks$onCopySheet.call(hooks, sheetId, copyId);
|
|
46550
46550
|
}
|
|
46551
46551
|
function calculateSheetFromula(ctx, id) {
|
|
46552
|
+
console.time("calcTime:".concat(id));
|
|
46552
46553
|
var index$1 = getSheetIndex(ctx, id);
|
|
46554
|
+
var luckysheetfile = ctx.luckysheetfile;
|
|
46555
|
+
var file = luckysheetfile[index$1];
|
|
46556
|
+
var calcChain = file.calcChain;
|
|
46557
|
+
if (___default['default'].isNil(calcChain)) {
|
|
46558
|
+
calcChain = [];
|
|
46559
|
+
}
|
|
46553
46560
|
if (!ctx.luckysheetfile[index$1].data) return;
|
|
46554
46561
|
for (var r = 0; r < ctx.luckysheetfile[index$1].data.length; r += 1) {
|
|
46555
46562
|
for (var c = 0; c < ctx.luckysheetfile[index$1].data[r].length; c += 1) {
|
|
46556
|
-
var
|
|
46557
|
-
if (!(
|
|
46563
|
+
var cell = ctx.luckysheetfile[index$1].data[r][c];
|
|
46564
|
+
if (!(cell === null || cell === void 0 ? void 0 : cell.f)) {
|
|
46565
|
+
continue;
|
|
46566
|
+
}
|
|
46567
|
+
var cc = {
|
|
46568
|
+
r: r,
|
|
46569
|
+
c: c,
|
|
46570
|
+
id: id
|
|
46571
|
+
};
|
|
46572
|
+
calcChain.push(cc);
|
|
46573
|
+
var result = execfunction(ctx, cell === null || cell === void 0 ? void 0 : cell.f, r, c, id, undefined, true);
|
|
46574
|
+
var newV = result[1];
|
|
46575
|
+
if (newV === cell.v) {
|
|
46558
46576
|
continue;
|
|
46559
46577
|
}
|
|
46560
|
-
var result = execfunction(ctx, (_ctx$luckysheetfile$i2 = ctx.luckysheetfile[index$1].data[r][c]) === null || _ctx$luckysheetfile$i2 === void 0 ? void 0 : _ctx$luckysheetfile$i2.f, r, c, id);
|
|
46561
46578
|
setCellValue$1(ctx, r, c, result[1], null, {
|
|
46562
46579
|
id: id
|
|
46563
46580
|
});
|
|
46564
|
-
insertUpdateFunctionGroup(ctx, r, c, id);
|
|
46565
46581
|
}
|
|
46566
46582
|
}
|
|
46583
|
+
file.calcChain = _.uniqBy(calcChain, function (item) {
|
|
46584
|
+
return item.r + item.c + item.id;
|
|
46585
|
+
});
|
|
46586
|
+
ctx.luckysheetfile = luckysheetfile;
|
|
46587
|
+
console.timeEnd("calcTime:".concat(id));
|
|
46588
|
+
}
|
|
46589
|
+
function parseCellReferences(expression) {
|
|
46590
|
+
if (typeof expression !== "string" || expression.trim() === "") {
|
|
46591
|
+
return [];
|
|
46592
|
+
}
|
|
46593
|
+
var cellRegex = /([A-Za-z0-9_]+!)?[A-Za-z]+\d+/g;
|
|
46594
|
+
var matches = expression.match(cellRegex) || [];
|
|
46595
|
+
var uniqueCells = matches.map(function (cell) {
|
|
46596
|
+
return cell.trim().toUpperCase();
|
|
46597
|
+
});
|
|
46598
|
+
return uniqueCells;
|
|
46599
|
+
}
|
|
46600
|
+
function calculateSheetByCells(ctx, cells) {
|
|
46601
|
+
console.time("calculateSheetByCellsTime");
|
|
46602
|
+
var fileList = ctx.luckysheetfile;
|
|
46603
|
+
var sheetIdNameMap = {};
|
|
46604
|
+
for (var ffIndex = 0; ffIndex < fileList.length; ffIndex++) {
|
|
46605
|
+
var _f$name;
|
|
46606
|
+
var f = fileList[ffIndex];
|
|
46607
|
+
sheetIdNameMap[f.id] = (_f$name = f.name) === null || _f$name === void 0 ? void 0 : _f$name.toLocaleUpperCase();
|
|
46608
|
+
}
|
|
46609
|
+
var needUpdateCell = [];
|
|
46610
|
+
var updatedMap = {};
|
|
46611
|
+
for (var index$1 = 0; index$1 < cells.length; index$1++) {
|
|
46612
|
+
var _cells$index = cells[index$1],
|
|
46613
|
+
r = _cells$index.r,
|
|
46614
|
+
c = _cells$index.c,
|
|
46615
|
+
id = _cells$index.id;
|
|
46616
|
+
updatedMap["".concat(sheetIdNameMap[id], "!").concat(indexToColumnChar(c) + (r + 1))] = true;
|
|
46617
|
+
}
|
|
46618
|
+
var _loop = function _loop() {
|
|
46619
|
+
var file = fileList[fIndex];
|
|
46620
|
+
var sheetId = file.id;
|
|
46621
|
+
var _file$calcChain = file.calcChain,
|
|
46622
|
+
calcChain = _file$calcChain === void 0 ? [] : _file$calcChain;
|
|
46623
|
+
for (var _index = 0; _index < calcChain.length; _index++) {
|
|
46624
|
+
var _parseCellReferences;
|
|
46625
|
+
var _calcChain$_index = calcChain[_index],
|
|
46626
|
+
_r2 = _calcChain$_index.r,
|
|
46627
|
+
_c2 = _calcChain$_index.c;
|
|
46628
|
+
var cell = file.data[_r2][_c2];
|
|
46629
|
+
if (!(cell === null || cell === void 0 ? void 0 : cell.f)) {
|
|
46630
|
+
continue;
|
|
46631
|
+
}
|
|
46632
|
+
var devCell = (_parseCellReferences = parseCellReferences(cell.f)) === null || _parseCellReferences === void 0 ? void 0 : _parseCellReferences.map(function (item) {
|
|
46633
|
+
return item.includes("!") ? item : "".concat(sheetIdNameMap[sheetId], "!").concat(item);
|
|
46634
|
+
});
|
|
46635
|
+
var n = devCell === null || devCell === void 0 ? void 0 : devCell.some(function (item) {
|
|
46636
|
+
return updatedMap["".concat(item)];
|
|
46637
|
+
});
|
|
46638
|
+
if (n) {
|
|
46639
|
+
needUpdateCell.push({
|
|
46640
|
+
r: _r2,
|
|
46641
|
+
c: _c2,
|
|
46642
|
+
id: sheetId,
|
|
46643
|
+
f: cell.f,
|
|
46644
|
+
v: cell.v
|
|
46645
|
+
});
|
|
46646
|
+
}
|
|
46647
|
+
}
|
|
46648
|
+
};
|
|
46649
|
+
for (var fIndex = 0; fIndex < fileList.length; fIndex++) {
|
|
46650
|
+
_loop();
|
|
46651
|
+
}
|
|
46652
|
+
needUpdateCell = _.uniqBy(needUpdateCell, function (item) {
|
|
46653
|
+
return "".concat(item.r, "_").concat(item.c, "_").concat(item.id);
|
|
46654
|
+
});
|
|
46655
|
+
for (var nIndex = 0; nIndex < needUpdateCell.length; nIndex++) {
|
|
46656
|
+
var _needUpdateCell$nInde = needUpdateCell[nIndex],
|
|
46657
|
+
_r = _needUpdateCell$nInde.r,
|
|
46658
|
+
_c = _needUpdateCell$nInde.c,
|
|
46659
|
+
_id = _needUpdateCell$nInde.id,
|
|
46660
|
+
_f = _needUpdateCell$nInde.f,
|
|
46661
|
+
v = _needUpdateCell$nInde.v;
|
|
46662
|
+
var result = execfunction(ctx, _f, _r, _c, _id, undefined, true);
|
|
46663
|
+
var newV = result[1];
|
|
46664
|
+
if (newV === v) {
|
|
46665
|
+
continue;
|
|
46666
|
+
}
|
|
46667
|
+
setCellValue$1(ctx, _r, _c, result[1], null, {
|
|
46668
|
+
id: _id
|
|
46669
|
+
});
|
|
46670
|
+
}
|
|
46671
|
+
console.timeEnd("calculateSheetByCellsTime");
|
|
46567
46672
|
}
|
|
46568
46673
|
|
|
46569
46674
|
function storeSheetParam(ctx) {
|
|
@@ -55639,6 +55744,14 @@ function setCellValue$1(ctx, row, column, value, cellInput) {
|
|
|
55639
55744
|
} else if (value instanceof Object) {
|
|
55640
55745
|
var _data$row;
|
|
55641
55746
|
var curv = {};
|
|
55747
|
+
if (!(data === null || data === void 0 ? void 0 : data[row])) {
|
|
55748
|
+
var needAddRow = row - ((data === null || data === void 0 ? void 0 : data.length) || 0) + 1;
|
|
55749
|
+
data === null || data === void 0 ? void 0 : data.push.apply(data, _toConsumableArray(Array.from({
|
|
55750
|
+
length: needAddRow
|
|
55751
|
+
}).map(function () {
|
|
55752
|
+
return [];
|
|
55753
|
+
})));
|
|
55754
|
+
}
|
|
55642
55755
|
if ((data === null || data === void 0 ? void 0 : (_data$row = data[row]) === null || _data$row === void 0 ? void 0 : _data$row[column]) == null) {
|
|
55643
55756
|
data[row][column] = {};
|
|
55644
55757
|
}
|
|
@@ -55650,7 +55763,11 @@ function setCellValue$1(ctx, row, column, value, cellInput) {
|
|
|
55650
55763
|
}
|
|
55651
55764
|
updateCell(ctx, row, column, cellInput, curv);
|
|
55652
55765
|
} else {
|
|
55653
|
-
var
|
|
55766
|
+
var needupdateFdev = false;
|
|
55767
|
+
var needUpdateM = false;
|
|
55768
|
+
var oldF = cell.f;
|
|
55769
|
+
var nf = value.f;
|
|
55770
|
+
var oldV = cell.v;
|
|
55654
55771
|
var nv = value.v;
|
|
55655
55772
|
if (value.ct != null) {
|
|
55656
55773
|
curv.ct = value.ct;
|
|
@@ -55666,9 +55783,17 @@ function setCellValue$1(ctx, row, column, value, cellInput) {
|
|
|
55666
55783
|
if (value.m != null) {
|
|
55667
55784
|
curv.m = value.m;
|
|
55668
55785
|
}
|
|
55669
|
-
|
|
55670
|
-
|
|
55786
|
+
if (nf !== undefined && nf !== oldF) {
|
|
55787
|
+
needupdateFdev = true;
|
|
55788
|
+
needUpdateM = true;
|
|
55789
|
+
}
|
|
55790
|
+
if (nv !== undefined && String(nv) !== String(oldV)) {
|
|
55791
|
+
needUpdateM = true;
|
|
55792
|
+
}
|
|
55793
|
+
if (needupdateFdev) {
|
|
55671
55794
|
delFunctionGroup(ctx, row, column);
|
|
55795
|
+
}
|
|
55796
|
+
if (needUpdateM) {
|
|
55672
55797
|
setCellValue(ctx, row, column, data, curv);
|
|
55673
55798
|
}
|
|
55674
55799
|
}
|
|
@@ -56202,6 +56327,7 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
56202
56327
|
showSheet: showSheet,
|
|
56203
56328
|
copySheet: copySheet,
|
|
56204
56329
|
calculateSheetFromula: calculateSheetFromula,
|
|
56330
|
+
calculateSheetByCells: calculateSheetByCells,
|
|
56205
56331
|
addSheet: addSheet$1,
|
|
56206
56332
|
deleteSheet: deleteSheet$1,
|
|
56207
56333
|
updateSheet: updateSheet$1,
|
|
@@ -56212,6 +56338,8 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
56212
56338
|
});
|
|
56213
56339
|
|
|
56214
56340
|
var defaultSettings = {
|
|
56341
|
+
renderTopToolbar: undefined,
|
|
56342
|
+
renderBottomToolbar: undefined,
|
|
56215
56343
|
headerBgColor: "#fff",
|
|
56216
56344
|
toolbarRightRender: undefined,
|
|
56217
56345
|
onClickContentEditable: undefined,
|
package/dist/settings.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leankylin-sheet/core",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.1.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/index.esm.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"build": "father-build"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@leankylin-sheet/formula-parser": "
|
|
16
|
+
"@leankylin-sheet/formula-parser": "5.1.0",
|
|
17
17
|
"dayjs": "^1.11.0",
|
|
18
18
|
"immer": "^9.0.12",
|
|
19
19
|
"lodash": "^4.17.21",
|