@leankylin-sheet/core 5.2.26 → 5.2.28
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.esm.js +100 -96
- package/dist/index.js +100 -96
- package/dist/settings.d.ts +1 -0
- package/package.json +2 -2
package/dist/index.esm.js
CHANGED
|
@@ -46594,7 +46594,8 @@ function copySheet(ctx, sheetId, hooks) {
|
|
|
46594
46594
|
delete sheetData.data;
|
|
46595
46595
|
var copyId = v4();
|
|
46596
46596
|
sheetData.id = copyId;
|
|
46597
|
-
|
|
46597
|
+
var _sheetData = hooks.onCopySheetBefore ? hooks.onCopySheetBefore(sheetId, sheetData) : sheetData;
|
|
46598
|
+
addSheet$1(ctx, undefined, copyId, ctx.luckysheetfile[index$1].isPivotTable, sheetName, _sheetData);
|
|
46598
46599
|
var sheetOrderList = {};
|
|
46599
46600
|
sheetOrderList[ctx.luckysheetfile[ctx.luckysheetfile.length - 1].id] = order;
|
|
46600
46601
|
setSheetOrder(ctx, sheetOrderList);
|
|
@@ -53788,119 +53789,122 @@ function getSearchIndexArr(searchText, range, flowdata) {
|
|
|
53788
53789
|
}
|
|
53789
53790
|
return arr;
|
|
53790
53791
|
}
|
|
53792
|
+
function searchSheet(searchText, checkModes, sheet) {
|
|
53793
|
+
var searchType = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "v";
|
|
53794
|
+
var flowdata = sheet.data;
|
|
53795
|
+
if (!flowdata || flowdata.length === 0 || flowdata[0].length === 0) {
|
|
53796
|
+
return [];
|
|
53797
|
+
}
|
|
53798
|
+
var range = [{
|
|
53799
|
+
row: [0, flowdata.length - 1],
|
|
53800
|
+
column: [0, flowdata[0].length - 1]
|
|
53801
|
+
}];
|
|
53802
|
+
return getSearchIndexArr(searchText, range, flowdata, checkModes, searchType);
|
|
53803
|
+
}
|
|
53791
53804
|
function searchNext(ctx, searchText, checkModes) {
|
|
53792
|
-
var
|
|
53805
|
+
var _getSheetIndex, _currentSelection$0$r, _currentSelection$, _currentSelection$0$c, _currentSelection$2;
|
|
53793
53806
|
var searchType = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "v";
|
|
53794
53807
|
var _locale = locale(ctx),
|
|
53795
53808
|
findAndReplace = _locale.findAndReplace;
|
|
53796
|
-
|
|
53797
|
-
if (searchText === "" || searchText == null || flowdata == null) {
|
|
53809
|
+
if (searchText === "" || searchText == null) {
|
|
53798
53810
|
return findAndReplace.searchInputTip;
|
|
53799
53811
|
}
|
|
53800
|
-
var
|
|
53801
|
-
if (
|
|
53802
|
-
range = [{
|
|
53803
|
-
row: [0, flowdata.length - 1],
|
|
53804
|
-
column: [0, flowdata[0].length - 1],
|
|
53805
|
-
row_focus: 0,
|
|
53806
|
-
column_focus: 0
|
|
53807
|
-
}];
|
|
53808
|
-
} else {
|
|
53809
|
-
range = _.assign([], ctx.luckysheet_select_save);
|
|
53810
|
-
}
|
|
53811
|
-
var searchIndexArr = getSearchIndexArr(searchText, range, flowdata, checkModes, searchType);
|
|
53812
|
-
if (searchIndexArr.length === 0) {
|
|
53812
|
+
var sheets = ctx.luckysheetfile;
|
|
53813
|
+
if (!sheets || sheets.length === 0) {
|
|
53813
53814
|
return findAndReplace.noFindTip;
|
|
53814
53815
|
}
|
|
53815
|
-
var
|
|
53816
|
-
|
|
53817
|
-
|
|
53818
|
-
|
|
53819
|
-
|
|
53820
|
-
|
|
53821
|
-
|
|
53822
|
-
|
|
53823
|
-
|
|
53824
|
-
|
|
53825
|
-
|
|
53826
|
-
|
|
53816
|
+
var currentSheetIndex = (_getSheetIndex = getSheetIndex(ctx, ctx.currentSheetId)) !== null && _getSheetIndex !== void 0 ? _getSheetIndex : 0;
|
|
53817
|
+
var currentSelection = ctx.luckysheet_select_save;
|
|
53818
|
+
var currentR = (_currentSelection$0$r = currentSelection === null || currentSelection === void 0 ? void 0 : (_currentSelection$ = currentSelection[0]) === null || _currentSelection$ === void 0 ? void 0 : _currentSelection$.row_focus) !== null && _currentSelection$0$r !== void 0 ? _currentSelection$0$r : -1;
|
|
53819
|
+
var currentC = (_currentSelection$0$c = currentSelection === null || currentSelection === void 0 ? void 0 : (_currentSelection$2 = currentSelection[0]) === null || _currentSelection$2 === void 0 ? void 0 : _currentSelection$2.column_focus) !== null && _currentSelection$0$c !== void 0 ? _currentSelection$0$c : -1;
|
|
53820
|
+
var totalSheets = sheets.length;
|
|
53821
|
+
for (var offset = 0; offset < totalSheets; offset += 1) {
|
|
53822
|
+
var sheetIdx = (currentSheetIndex + offset) % totalSheets;
|
|
53823
|
+
var sheet = sheets[sheetIdx];
|
|
53824
|
+
var matches = searchSheet(searchText, checkModes, sheet, searchType);
|
|
53825
|
+
if (matches.length === 0) continue;
|
|
53826
|
+
var foundMatch = null;
|
|
53827
|
+
if (offset === 0 && currentR >= 0 && currentC >= 0) {
|
|
53828
|
+
for (var i = 0; i < matches.length; i += 1) {
|
|
53829
|
+
var m = matches[i];
|
|
53830
|
+
if (m.r > currentR || m.r === currentR && m.c > currentC) {
|
|
53831
|
+
foundMatch = m;
|
|
53827
53832
|
break;
|
|
53828
53833
|
}
|
|
53829
53834
|
}
|
|
53830
53835
|
}
|
|
53831
|
-
|
|
53832
|
-
|
|
53833
|
-
|
|
53834
|
-
}
|
|
53835
|
-
|
|
53836
|
-
|
|
53837
|
-
|
|
53838
|
-
|
|
53839
|
-
|
|
53840
|
-
if (_i === searchIndexArr.length - 1) {
|
|
53841
|
-
count = 0;
|
|
53842
|
-
} else {
|
|
53843
|
-
count = _i + 1;
|
|
53844
|
-
}
|
|
53845
|
-
break;
|
|
53836
|
+
if (!foundMatch && offset > 0) {
|
|
53837
|
+
var _matches = _slicedToArray(matches, 1);
|
|
53838
|
+
foundMatch = _matches[0];
|
|
53839
|
+
}
|
|
53840
|
+
if (!foundMatch && offset === 0 && matches.length > 0) {
|
|
53841
|
+
var _matches2 = _slicedToArray(matches, 1);
|
|
53842
|
+
foundMatch = _matches2[0];
|
|
53843
|
+
if (matches.length === 1 && matches[0].r === currentR && matches[0].c === currentC) {
|
|
53844
|
+
foundMatch = null;
|
|
53846
53845
|
}
|
|
53847
53846
|
}
|
|
53848
|
-
|
|
53849
|
-
|
|
53850
|
-
|
|
53851
|
-
var c1 = range[s].column[0];
|
|
53852
|
-
var c2 = range[s].column[1];
|
|
53853
|
-
if (searchIndexArr[count].r >= r1 && searchIndexArr[count].r <= r2 && searchIndexArr[count].c >= c1 && searchIndexArr[count].c <= c2) {
|
|
53854
|
-
var obj = range[s];
|
|
53855
|
-
obj.row_focus = searchIndexArr[count].r;
|
|
53856
|
-
obj.column_focus = searchIndexArr[count].c;
|
|
53857
|
-
range.splice(s, 1);
|
|
53858
|
-
range.push(obj);
|
|
53859
|
-
break;
|
|
53847
|
+
if (foundMatch) {
|
|
53848
|
+
if (sheetIdx !== currentSheetIndex) {
|
|
53849
|
+
changeSheet(ctx, sheet.id);
|
|
53860
53850
|
}
|
|
53851
|
+
ctx.luckysheet_select_save = normalizeSelection(ctx, [{
|
|
53852
|
+
row: [foundMatch.r, foundMatch.r],
|
|
53853
|
+
column: [foundMatch.c, foundMatch.c]
|
|
53854
|
+
}]);
|
|
53855
|
+
scrollToHighlightCell(ctx, foundMatch.r, foundMatch.c);
|
|
53856
|
+
return null;
|
|
53861
53857
|
}
|
|
53862
|
-
ctx.luckysheet_select_save = range;
|
|
53863
53858
|
}
|
|
53864
|
-
|
|
53865
|
-
return null;
|
|
53859
|
+
return findAndReplace.noFindTip;
|
|
53866
53860
|
}
|
|
53867
53861
|
function searchAll(ctx, searchText, checkModes) {
|
|
53868
|
-
var _ctx$luckysheet_selec3;
|
|
53869
53862
|
var searchType = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "v";
|
|
53870
|
-
var flowdata = getFlowdata(ctx);
|
|
53871
53863
|
var searchResult = [];
|
|
53872
|
-
if (searchText === "" || searchText == null
|
|
53864
|
+
if (searchText === "" || searchText == null) {
|
|
53873
53865
|
return searchResult;
|
|
53874
53866
|
}
|
|
53875
|
-
var
|
|
53876
|
-
if (
|
|
53877
|
-
range = [{
|
|
53878
|
-
row: [0, flowdata.length - 1],
|
|
53879
|
-
column: [0, flowdata[0].length - 1]
|
|
53880
|
-
}];
|
|
53881
|
-
} else {
|
|
53882
|
-
range = _.assign([], ctx.luckysheet_select_save);
|
|
53883
|
-
}
|
|
53884
|
-
var searchIndexArr = getSearchIndexArr(searchText, range, flowdata, checkModes, searchType);
|
|
53885
|
-
if (searchIndexArr.length === 0) {
|
|
53867
|
+
var sheets = ctx.luckysheetfile;
|
|
53868
|
+
if (!sheets || sheets.length === 0) {
|
|
53886
53869
|
return searchResult;
|
|
53887
53870
|
}
|
|
53888
|
-
|
|
53889
|
-
|
|
53890
|
-
var
|
|
53891
|
-
|
|
53892
|
-
|
|
53893
|
-
|
|
53894
|
-
|
|
53895
|
-
|
|
53896
|
-
|
|
53897
|
-
|
|
53898
|
-
|
|
53871
|
+
var firstMatch = null;
|
|
53872
|
+
for (var sheetIdx = 0; sheetIdx < sheets.length; sheetIdx += 1) {
|
|
53873
|
+
var sheet = sheets[sheetIdx];
|
|
53874
|
+
var matches = searchSheet(searchText, checkModes, sheet, searchType);
|
|
53875
|
+
if (matches.length === 0) continue;
|
|
53876
|
+
var flowdata = sheet.data;
|
|
53877
|
+
if (!flowdata) continue;
|
|
53878
|
+
for (var i = 0; i < matches.length; i += 1) {
|
|
53879
|
+
var match = matches[i];
|
|
53880
|
+
var value_ShowEs = valueShowEs(match.r, match.c, flowdata).toString();
|
|
53881
|
+
searchResult.push({
|
|
53882
|
+
r: match.r,
|
|
53883
|
+
c: match.c,
|
|
53884
|
+
sheetName: sheet.name,
|
|
53885
|
+
sheetId: sheet.id,
|
|
53886
|
+
cellPosition: "".concat(chatatABC(match.c)).concat(match.r + 1),
|
|
53887
|
+
value: value_ShowEs
|
|
53888
|
+
});
|
|
53889
|
+
if (!firstMatch) {
|
|
53890
|
+
firstMatch = {
|
|
53891
|
+
r: match.r,
|
|
53892
|
+
c: match.c,
|
|
53893
|
+
sheetId: sheet.id
|
|
53894
|
+
};
|
|
53895
|
+
}
|
|
53896
|
+
}
|
|
53897
|
+
}
|
|
53898
|
+
if (firstMatch) {
|
|
53899
|
+
if (firstMatch.sheetId !== ctx.currentSheetId) {
|
|
53900
|
+
changeSheet(ctx, firstMatch.sheetId);
|
|
53901
|
+
}
|
|
53902
|
+
ctx.luckysheet_select_save = normalizeSelection(ctx, [{
|
|
53903
|
+
row: [firstMatch.r, firstMatch.r],
|
|
53904
|
+
column: [firstMatch.c, firstMatch.c]
|
|
53905
|
+
}]);
|
|
53906
|
+
scrollToHighlightCell(ctx, firstMatch.r, firstMatch.c);
|
|
53899
53907
|
}
|
|
53900
|
-
ctx.luckysheet_select_save = normalizeSelection(ctx, [{
|
|
53901
|
-
row: [searchIndexArr[0].r, searchIndexArr[0].r],
|
|
53902
|
-
column: [searchIndexArr[0].c, searchIndexArr[0].c]
|
|
53903
|
-
}]);
|
|
53904
53908
|
return searchResult;
|
|
53905
53909
|
}
|
|
53906
53910
|
function onSearchDialogMoveStart(globalCache, e, container) {
|
|
@@ -53949,7 +53953,7 @@ function onSearchDialogMoveEnd(globalCache) {
|
|
|
53949
53953
|
_.set(globalCache, "searchDialog.moveProps", undefined);
|
|
53950
53954
|
}
|
|
53951
53955
|
function replace(ctx, searchText, replaceText, checkModes) {
|
|
53952
|
-
var _ctx$
|
|
53956
|
+
var _ctx$luckysheet_selec, _ctx$luckysheet_selec2;
|
|
53953
53957
|
var searchType = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : "v";
|
|
53954
53958
|
var _locale2 = locale(ctx),
|
|
53955
53959
|
findAndReplace = _locale2.findAndReplace;
|
|
@@ -53962,7 +53966,7 @@ function replace(ctx, searchText, replaceText, checkModes) {
|
|
|
53962
53966
|
return findAndReplace.searchInputTip;
|
|
53963
53967
|
}
|
|
53964
53968
|
var range;
|
|
53965
|
-
if (_.size(ctx.luckysheet_select_save) === 0 || ((_ctx$
|
|
53969
|
+
if (_.size(ctx.luckysheet_select_save) === 0 || ((_ctx$luckysheet_selec = ctx.luckysheet_select_save) === null || _ctx$luckysheet_selec === void 0 ? void 0 : _ctx$luckysheet_selec.length) === 1 && ctx.luckysheet_select_save[0].row[0] === ctx.luckysheet_select_save[0].row[1] && ctx.luckysheet_select_save[0].column[0] === ctx.luckysheet_select_save[0].column[1]) {
|
|
53966
53970
|
range = [{
|
|
53967
53971
|
row: [0, flowdata.length - 1],
|
|
53968
53972
|
column: [0, flowdata[0].length - 1]
|
|
@@ -53975,7 +53979,7 @@ function replace(ctx, searchText, replaceText, checkModes) {
|
|
|
53975
53979
|
return findAndReplace.noReplceTip;
|
|
53976
53980
|
}
|
|
53977
53981
|
var count = null;
|
|
53978
|
-
var last = (_ctx$
|
|
53982
|
+
var last = (_ctx$luckysheet_selec2 = ctx.luckysheet_select_save) === null || _ctx$luckysheet_selec2 === void 0 ? void 0 : _ctx$luckysheet_selec2[ctx.luckysheet_select_save.length - 1];
|
|
53979
53983
|
var rf = last === null || last === void 0 ? void 0 : last.row_focus;
|
|
53980
53984
|
var cf = last === null || last === void 0 ? void 0 : last.column_focus;
|
|
53981
53985
|
for (var i = 0; i < searchIndexArr.length; i += 1) {
|
|
@@ -54018,7 +54022,7 @@ function replace(ctx, searchText, replaceText, checkModes) {
|
|
|
54018
54022
|
return null;
|
|
54019
54023
|
}
|
|
54020
54024
|
function replaceAll(ctx, searchText, replaceText, checkModes) {
|
|
54021
|
-
var _ctx$
|
|
54025
|
+
var _ctx$luckysheet_selec3;
|
|
54022
54026
|
var searchType = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : "v";
|
|
54023
54027
|
var _locale3 = locale(ctx),
|
|
54024
54028
|
findAndReplace = _locale3.findAndReplace;
|
|
@@ -54031,7 +54035,7 @@ function replaceAll(ctx, searchText, replaceText, checkModes) {
|
|
|
54031
54035
|
return findAndReplace.searchInputTip;
|
|
54032
54036
|
}
|
|
54033
54037
|
var range;
|
|
54034
|
-
if (_.size(ctx.luckysheet_select_save) === 0 || ((_ctx$
|
|
54038
|
+
if (_.size(ctx.luckysheet_select_save) === 0 || ((_ctx$luckysheet_selec3 = ctx.luckysheet_select_save) === null || _ctx$luckysheet_selec3 === void 0 ? void 0 : _ctx$luckysheet_selec3.length) === 1 && ctx.luckysheet_select_save[0].row[0] === ctx.luckysheet_select_save[0].row[1] && ctx.luckysheet_select_save[0].column[0] === ctx.luckysheet_select_save[0].column[1]) {
|
|
54035
54039
|
range = [{
|
|
54036
54040
|
row: [0, flowdata.length - 1],
|
|
54037
54041
|
column: [0, flowdata[0].length - 1]
|
|
@@ -54064,9 +54068,9 @@ function replaceAll(ctx, searchText, replaceText, checkModes) {
|
|
|
54064
54068
|
} else {
|
|
54065
54069
|
reg = new RegExp(getRegExpStr(searchText), "ig");
|
|
54066
54070
|
}
|
|
54067
|
-
for (var
|
|
54068
|
-
var _r = searchIndexArr[
|
|
54069
|
-
var _c = searchIndexArr[
|
|
54071
|
+
for (var _i = 0; _i < searchIndexArr.length; _i += 1) {
|
|
54072
|
+
var _r = searchIndexArr[_i].r;
|
|
54073
|
+
var _c = searchIndexArr[_i].c;
|
|
54070
54074
|
var _v2 = valueShowEs(_r, _c, d).toString().replace(reg, replaceText);
|
|
54071
54075
|
setCellValue(ctx, _r, _c, d, _v2);
|
|
54072
54076
|
range.push({
|
package/dist/index.js
CHANGED
|
@@ -46604,7 +46604,8 @@ function copySheet(ctx, sheetId, hooks) {
|
|
|
46604
46604
|
delete sheetData.data;
|
|
46605
46605
|
var copyId = uuid.v4();
|
|
46606
46606
|
sheetData.id = copyId;
|
|
46607
|
-
|
|
46607
|
+
var _sheetData = hooks.onCopySheetBefore ? hooks.onCopySheetBefore(sheetId, sheetData) : sheetData;
|
|
46608
|
+
addSheet$1(ctx, undefined, copyId, ctx.luckysheetfile[index$1].isPivotTable, sheetName, _sheetData);
|
|
46608
46609
|
var sheetOrderList = {};
|
|
46609
46610
|
sheetOrderList[ctx.luckysheetfile[ctx.luckysheetfile.length - 1].id] = order;
|
|
46610
46611
|
setSheetOrder(ctx, sheetOrderList);
|
|
@@ -53798,119 +53799,122 @@ function getSearchIndexArr(searchText, range, flowdata) {
|
|
|
53798
53799
|
}
|
|
53799
53800
|
return arr;
|
|
53800
53801
|
}
|
|
53802
|
+
function searchSheet(searchText, checkModes, sheet) {
|
|
53803
|
+
var searchType = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "v";
|
|
53804
|
+
var flowdata = sheet.data;
|
|
53805
|
+
if (!flowdata || flowdata.length === 0 || flowdata[0].length === 0) {
|
|
53806
|
+
return [];
|
|
53807
|
+
}
|
|
53808
|
+
var range = [{
|
|
53809
|
+
row: [0, flowdata.length - 1],
|
|
53810
|
+
column: [0, flowdata[0].length - 1]
|
|
53811
|
+
}];
|
|
53812
|
+
return getSearchIndexArr(searchText, range, flowdata, checkModes, searchType);
|
|
53813
|
+
}
|
|
53801
53814
|
function searchNext(ctx, searchText, checkModes) {
|
|
53802
|
-
var
|
|
53815
|
+
var _getSheetIndex, _currentSelection$0$r, _currentSelection$, _currentSelection$0$c, _currentSelection$2;
|
|
53803
53816
|
var searchType = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "v";
|
|
53804
53817
|
var _locale = locale(ctx),
|
|
53805
53818
|
findAndReplace = _locale.findAndReplace;
|
|
53806
|
-
|
|
53807
|
-
if (searchText === "" || searchText == null || flowdata == null) {
|
|
53819
|
+
if (searchText === "" || searchText == null) {
|
|
53808
53820
|
return findAndReplace.searchInputTip;
|
|
53809
53821
|
}
|
|
53810
|
-
var
|
|
53811
|
-
if (
|
|
53812
|
-
range = [{
|
|
53813
|
-
row: [0, flowdata.length - 1],
|
|
53814
|
-
column: [0, flowdata[0].length - 1],
|
|
53815
|
-
row_focus: 0,
|
|
53816
|
-
column_focus: 0
|
|
53817
|
-
}];
|
|
53818
|
-
} else {
|
|
53819
|
-
range = ___default['default'].assign([], ctx.luckysheet_select_save);
|
|
53820
|
-
}
|
|
53821
|
-
var searchIndexArr = getSearchIndexArr(searchText, range, flowdata, checkModes, searchType);
|
|
53822
|
-
if (searchIndexArr.length === 0) {
|
|
53822
|
+
var sheets = ctx.luckysheetfile;
|
|
53823
|
+
if (!sheets || sheets.length === 0) {
|
|
53823
53824
|
return findAndReplace.noFindTip;
|
|
53824
53825
|
}
|
|
53825
|
-
var
|
|
53826
|
-
|
|
53827
|
-
|
|
53828
|
-
|
|
53829
|
-
|
|
53830
|
-
|
|
53831
|
-
|
|
53832
|
-
|
|
53833
|
-
|
|
53834
|
-
|
|
53835
|
-
|
|
53836
|
-
|
|
53826
|
+
var currentSheetIndex = (_getSheetIndex = getSheetIndex(ctx, ctx.currentSheetId)) !== null && _getSheetIndex !== void 0 ? _getSheetIndex : 0;
|
|
53827
|
+
var currentSelection = ctx.luckysheet_select_save;
|
|
53828
|
+
var currentR = (_currentSelection$0$r = currentSelection === null || currentSelection === void 0 ? void 0 : (_currentSelection$ = currentSelection[0]) === null || _currentSelection$ === void 0 ? void 0 : _currentSelection$.row_focus) !== null && _currentSelection$0$r !== void 0 ? _currentSelection$0$r : -1;
|
|
53829
|
+
var currentC = (_currentSelection$0$c = currentSelection === null || currentSelection === void 0 ? void 0 : (_currentSelection$2 = currentSelection[0]) === null || _currentSelection$2 === void 0 ? void 0 : _currentSelection$2.column_focus) !== null && _currentSelection$0$c !== void 0 ? _currentSelection$0$c : -1;
|
|
53830
|
+
var totalSheets = sheets.length;
|
|
53831
|
+
for (var offset = 0; offset < totalSheets; offset += 1) {
|
|
53832
|
+
var sheetIdx = (currentSheetIndex + offset) % totalSheets;
|
|
53833
|
+
var sheet = sheets[sheetIdx];
|
|
53834
|
+
var matches = searchSheet(searchText, checkModes, sheet, searchType);
|
|
53835
|
+
if (matches.length === 0) continue;
|
|
53836
|
+
var foundMatch = null;
|
|
53837
|
+
if (offset === 0 && currentR >= 0 && currentC >= 0) {
|
|
53838
|
+
for (var i = 0; i < matches.length; i += 1) {
|
|
53839
|
+
var m = matches[i];
|
|
53840
|
+
if (m.r > currentR || m.r === currentR && m.c > currentC) {
|
|
53841
|
+
foundMatch = m;
|
|
53837
53842
|
break;
|
|
53838
53843
|
}
|
|
53839
53844
|
}
|
|
53840
53845
|
}
|
|
53841
|
-
|
|
53842
|
-
|
|
53843
|
-
|
|
53844
|
-
}
|
|
53845
|
-
|
|
53846
|
-
|
|
53847
|
-
|
|
53848
|
-
|
|
53849
|
-
|
|
53850
|
-
if (_i === searchIndexArr.length - 1) {
|
|
53851
|
-
count = 0;
|
|
53852
|
-
} else {
|
|
53853
|
-
count = _i + 1;
|
|
53854
|
-
}
|
|
53855
|
-
break;
|
|
53846
|
+
if (!foundMatch && offset > 0) {
|
|
53847
|
+
var _matches = _slicedToArray(matches, 1);
|
|
53848
|
+
foundMatch = _matches[0];
|
|
53849
|
+
}
|
|
53850
|
+
if (!foundMatch && offset === 0 && matches.length > 0) {
|
|
53851
|
+
var _matches2 = _slicedToArray(matches, 1);
|
|
53852
|
+
foundMatch = _matches2[0];
|
|
53853
|
+
if (matches.length === 1 && matches[0].r === currentR && matches[0].c === currentC) {
|
|
53854
|
+
foundMatch = null;
|
|
53856
53855
|
}
|
|
53857
53856
|
}
|
|
53858
|
-
|
|
53859
|
-
|
|
53860
|
-
|
|
53861
|
-
var c1 = range[s].column[0];
|
|
53862
|
-
var c2 = range[s].column[1];
|
|
53863
|
-
if (searchIndexArr[count].r >= r1 && searchIndexArr[count].r <= r2 && searchIndexArr[count].c >= c1 && searchIndexArr[count].c <= c2) {
|
|
53864
|
-
var obj = range[s];
|
|
53865
|
-
obj.row_focus = searchIndexArr[count].r;
|
|
53866
|
-
obj.column_focus = searchIndexArr[count].c;
|
|
53867
|
-
range.splice(s, 1);
|
|
53868
|
-
range.push(obj);
|
|
53869
|
-
break;
|
|
53857
|
+
if (foundMatch) {
|
|
53858
|
+
if (sheetIdx !== currentSheetIndex) {
|
|
53859
|
+
changeSheet(ctx, sheet.id);
|
|
53870
53860
|
}
|
|
53861
|
+
ctx.luckysheet_select_save = normalizeSelection(ctx, [{
|
|
53862
|
+
row: [foundMatch.r, foundMatch.r],
|
|
53863
|
+
column: [foundMatch.c, foundMatch.c]
|
|
53864
|
+
}]);
|
|
53865
|
+
scrollToHighlightCell(ctx, foundMatch.r, foundMatch.c);
|
|
53866
|
+
return null;
|
|
53871
53867
|
}
|
|
53872
|
-
ctx.luckysheet_select_save = range;
|
|
53873
53868
|
}
|
|
53874
|
-
|
|
53875
|
-
return null;
|
|
53869
|
+
return findAndReplace.noFindTip;
|
|
53876
53870
|
}
|
|
53877
53871
|
function searchAll(ctx, searchText, checkModes) {
|
|
53878
|
-
var _ctx$luckysheet_selec3;
|
|
53879
53872
|
var searchType = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "v";
|
|
53880
|
-
var flowdata = getFlowdata(ctx);
|
|
53881
53873
|
var searchResult = [];
|
|
53882
|
-
if (searchText === "" || searchText == null
|
|
53874
|
+
if (searchText === "" || searchText == null) {
|
|
53883
53875
|
return searchResult;
|
|
53884
53876
|
}
|
|
53885
|
-
var
|
|
53886
|
-
if (
|
|
53887
|
-
range = [{
|
|
53888
|
-
row: [0, flowdata.length - 1],
|
|
53889
|
-
column: [0, flowdata[0].length - 1]
|
|
53890
|
-
}];
|
|
53891
|
-
} else {
|
|
53892
|
-
range = ___default['default'].assign([], ctx.luckysheet_select_save);
|
|
53893
|
-
}
|
|
53894
|
-
var searchIndexArr = getSearchIndexArr(searchText, range, flowdata, checkModes, searchType);
|
|
53895
|
-
if (searchIndexArr.length === 0) {
|
|
53877
|
+
var sheets = ctx.luckysheetfile;
|
|
53878
|
+
if (!sheets || sheets.length === 0) {
|
|
53896
53879
|
return searchResult;
|
|
53897
53880
|
}
|
|
53898
|
-
|
|
53899
|
-
|
|
53900
|
-
var
|
|
53901
|
-
|
|
53902
|
-
|
|
53903
|
-
|
|
53904
|
-
|
|
53905
|
-
|
|
53906
|
-
|
|
53907
|
-
|
|
53908
|
-
|
|
53881
|
+
var firstMatch = null;
|
|
53882
|
+
for (var sheetIdx = 0; sheetIdx < sheets.length; sheetIdx += 1) {
|
|
53883
|
+
var sheet = sheets[sheetIdx];
|
|
53884
|
+
var matches = searchSheet(searchText, checkModes, sheet, searchType);
|
|
53885
|
+
if (matches.length === 0) continue;
|
|
53886
|
+
var flowdata = sheet.data;
|
|
53887
|
+
if (!flowdata) continue;
|
|
53888
|
+
for (var i = 0; i < matches.length; i += 1) {
|
|
53889
|
+
var match = matches[i];
|
|
53890
|
+
var value_ShowEs = valueShowEs(match.r, match.c, flowdata).toString();
|
|
53891
|
+
searchResult.push({
|
|
53892
|
+
r: match.r,
|
|
53893
|
+
c: match.c,
|
|
53894
|
+
sheetName: sheet.name,
|
|
53895
|
+
sheetId: sheet.id,
|
|
53896
|
+
cellPosition: "".concat(chatatABC(match.c)).concat(match.r + 1),
|
|
53897
|
+
value: value_ShowEs
|
|
53898
|
+
});
|
|
53899
|
+
if (!firstMatch) {
|
|
53900
|
+
firstMatch = {
|
|
53901
|
+
r: match.r,
|
|
53902
|
+
c: match.c,
|
|
53903
|
+
sheetId: sheet.id
|
|
53904
|
+
};
|
|
53905
|
+
}
|
|
53906
|
+
}
|
|
53907
|
+
}
|
|
53908
|
+
if (firstMatch) {
|
|
53909
|
+
if (firstMatch.sheetId !== ctx.currentSheetId) {
|
|
53910
|
+
changeSheet(ctx, firstMatch.sheetId);
|
|
53911
|
+
}
|
|
53912
|
+
ctx.luckysheet_select_save = normalizeSelection(ctx, [{
|
|
53913
|
+
row: [firstMatch.r, firstMatch.r],
|
|
53914
|
+
column: [firstMatch.c, firstMatch.c]
|
|
53915
|
+
}]);
|
|
53916
|
+
scrollToHighlightCell(ctx, firstMatch.r, firstMatch.c);
|
|
53909
53917
|
}
|
|
53910
|
-
ctx.luckysheet_select_save = normalizeSelection(ctx, [{
|
|
53911
|
-
row: [searchIndexArr[0].r, searchIndexArr[0].r],
|
|
53912
|
-
column: [searchIndexArr[0].c, searchIndexArr[0].c]
|
|
53913
|
-
}]);
|
|
53914
53918
|
return searchResult;
|
|
53915
53919
|
}
|
|
53916
53920
|
function onSearchDialogMoveStart(globalCache, e, container) {
|
|
@@ -53959,7 +53963,7 @@ function onSearchDialogMoveEnd(globalCache) {
|
|
|
53959
53963
|
___default['default'].set(globalCache, "searchDialog.moveProps", undefined);
|
|
53960
53964
|
}
|
|
53961
53965
|
function replace(ctx, searchText, replaceText, checkModes) {
|
|
53962
|
-
var _ctx$
|
|
53966
|
+
var _ctx$luckysheet_selec, _ctx$luckysheet_selec2;
|
|
53963
53967
|
var searchType = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : "v";
|
|
53964
53968
|
var _locale2 = locale(ctx),
|
|
53965
53969
|
findAndReplace = _locale2.findAndReplace;
|
|
@@ -53972,7 +53976,7 @@ function replace(ctx, searchText, replaceText, checkModes) {
|
|
|
53972
53976
|
return findAndReplace.searchInputTip;
|
|
53973
53977
|
}
|
|
53974
53978
|
var range;
|
|
53975
|
-
if (___default['default'].size(ctx.luckysheet_select_save) === 0 || ((_ctx$
|
|
53979
|
+
if (___default['default'].size(ctx.luckysheet_select_save) === 0 || ((_ctx$luckysheet_selec = ctx.luckysheet_select_save) === null || _ctx$luckysheet_selec === void 0 ? void 0 : _ctx$luckysheet_selec.length) === 1 && ctx.luckysheet_select_save[0].row[0] === ctx.luckysheet_select_save[0].row[1] && ctx.luckysheet_select_save[0].column[0] === ctx.luckysheet_select_save[0].column[1]) {
|
|
53976
53980
|
range = [{
|
|
53977
53981
|
row: [0, flowdata.length - 1],
|
|
53978
53982
|
column: [0, flowdata[0].length - 1]
|
|
@@ -53985,7 +53989,7 @@ function replace(ctx, searchText, replaceText, checkModes) {
|
|
|
53985
53989
|
return findAndReplace.noReplceTip;
|
|
53986
53990
|
}
|
|
53987
53991
|
var count = null;
|
|
53988
|
-
var last = (_ctx$
|
|
53992
|
+
var last = (_ctx$luckysheet_selec2 = ctx.luckysheet_select_save) === null || _ctx$luckysheet_selec2 === void 0 ? void 0 : _ctx$luckysheet_selec2[ctx.luckysheet_select_save.length - 1];
|
|
53989
53993
|
var rf = last === null || last === void 0 ? void 0 : last.row_focus;
|
|
53990
53994
|
var cf = last === null || last === void 0 ? void 0 : last.column_focus;
|
|
53991
53995
|
for (var i = 0; i < searchIndexArr.length; i += 1) {
|
|
@@ -54028,7 +54032,7 @@ function replace(ctx, searchText, replaceText, checkModes) {
|
|
|
54028
54032
|
return null;
|
|
54029
54033
|
}
|
|
54030
54034
|
function replaceAll(ctx, searchText, replaceText, checkModes) {
|
|
54031
|
-
var _ctx$
|
|
54035
|
+
var _ctx$luckysheet_selec3;
|
|
54032
54036
|
var searchType = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : "v";
|
|
54033
54037
|
var _locale3 = locale(ctx),
|
|
54034
54038
|
findAndReplace = _locale3.findAndReplace;
|
|
@@ -54041,7 +54045,7 @@ function replaceAll(ctx, searchText, replaceText, checkModes) {
|
|
|
54041
54045
|
return findAndReplace.searchInputTip;
|
|
54042
54046
|
}
|
|
54043
54047
|
var range;
|
|
54044
|
-
if (___default['default'].size(ctx.luckysheet_select_save) === 0 || ((_ctx$
|
|
54048
|
+
if (___default['default'].size(ctx.luckysheet_select_save) === 0 || ((_ctx$luckysheet_selec3 = ctx.luckysheet_select_save) === null || _ctx$luckysheet_selec3 === void 0 ? void 0 : _ctx$luckysheet_selec3.length) === 1 && ctx.luckysheet_select_save[0].row[0] === ctx.luckysheet_select_save[0].row[1] && ctx.luckysheet_select_save[0].column[0] === ctx.luckysheet_select_save[0].column[1]) {
|
|
54045
54049
|
range = [{
|
|
54046
54050
|
row: [0, flowdata.length - 1],
|
|
54047
54051
|
column: [0, flowdata[0].length - 1]
|
|
@@ -54074,9 +54078,9 @@ function replaceAll(ctx, searchText, replaceText, checkModes) {
|
|
|
54074
54078
|
} else {
|
|
54075
54079
|
reg = new RegExp(getRegExpStr(searchText), "ig");
|
|
54076
54080
|
}
|
|
54077
|
-
for (var
|
|
54078
|
-
var _r = searchIndexArr[
|
|
54079
|
-
var _c = searchIndexArr[
|
|
54081
|
+
for (var _i = 0; _i < searchIndexArr.length; _i += 1) {
|
|
54082
|
+
var _r = searchIndexArr[_i].r;
|
|
54083
|
+
var _c = searchIndexArr[_i].c;
|
|
54080
54084
|
var _v2 = valueShowEs(_r, _c, d).toString().replace(reg, replaceText);
|
|
54081
54085
|
setCellValue(ctx, _r, _c, d, _v2);
|
|
54082
54086
|
range.push({
|
package/dist/settings.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export type Hooks = {
|
|
|
10
10
|
id: string;
|
|
11
11
|
}) => void;
|
|
12
12
|
onCopySheet?: (oldSheetId: string, newSheetId: string) => void;
|
|
13
|
+
onCopySheetBefore?: (oldSheetId: any, sheetData: any) => any;
|
|
13
14
|
commentsPreRender?: (r: number, c: number) => any;
|
|
14
15
|
showCommentsMenu?: (item: {
|
|
15
16
|
text: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leankylin-sheet/core",
|
|
3
|
-
"version": "5.2.
|
|
3
|
+
"version": "5.2.28",
|
|
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": "5.2.
|
|
16
|
+
"@leankylin-sheet/formula-parser": "5.2.28",
|
|
17
17
|
"dayjs": "^1.11.0",
|
|
18
18
|
"immer": "^9.0.12",
|
|
19
19
|
"lodash": "^4.17.21",
|