@leankylin-sheet/core 5.1.15 → 5.1.16
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/events/keyboard.d.ts +2 -2
- package/dist/index.esm.js +463 -406
- package/dist/index.js +463 -405
- package/dist/modules/sheet.d.ts +1 -0
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -46706,6 +46706,260 @@ function calculateSheetByCells(ctx, cells) {
|
|
|
46706
46706
|
console.timeEnd("calculateSheetByCellsTime");
|
|
46707
46707
|
}
|
|
46708
46708
|
|
|
46709
|
+
var imageProps = {
|
|
46710
|
+
defaultWidth: 144,
|
|
46711
|
+
defaultHeight: 84,
|
|
46712
|
+
currentObj: null,
|
|
46713
|
+
currentWinW: null,
|
|
46714
|
+
currentWinH: null,
|
|
46715
|
+
resize: null,
|
|
46716
|
+
resizeXY: null,
|
|
46717
|
+
move: false,
|
|
46718
|
+
moveXY: null,
|
|
46719
|
+
cursorStartPosition: null
|
|
46720
|
+
};
|
|
46721
|
+
function generateRandomId(prefix) {
|
|
46722
|
+
if (prefix == null) {
|
|
46723
|
+
prefix = "img";
|
|
46724
|
+
}
|
|
46725
|
+
var userAgent = window.navigator.userAgent.replace(/[^a-zA-Z0-9]/g, "").split("");
|
|
46726
|
+
var mid = "";
|
|
46727
|
+
for (var i = 0; i < 12; i += 1) {
|
|
46728
|
+
mid += userAgent[Math.round(Math.random() * (userAgent.length - 1))];
|
|
46729
|
+
}
|
|
46730
|
+
var time = new Date().getTime();
|
|
46731
|
+
return "".concat(prefix, "_").concat(mid, "_").concat(time);
|
|
46732
|
+
}
|
|
46733
|
+
function showImgChooser() {
|
|
46734
|
+
var chooser = document.getElementById("leankylin-img-upload");
|
|
46735
|
+
if (chooser) chooser.click();
|
|
46736
|
+
}
|
|
46737
|
+
function saveImage(ctx) {
|
|
46738
|
+
var index = getSheetIndex(ctx, ctx.currentSheetId);
|
|
46739
|
+
if (index == null) return;
|
|
46740
|
+
var file = ctx.luckysheetfile[index];
|
|
46741
|
+
file.images = ctx.insertedImgs;
|
|
46742
|
+
}
|
|
46743
|
+
function removeActiveImage(ctx) {
|
|
46744
|
+
ctx.insertedImgs = ___default['default'].filter(ctx.insertedImgs, function (image) {
|
|
46745
|
+
return image.id !== ctx.activeImg;
|
|
46746
|
+
});
|
|
46747
|
+
ctx.activeImg = undefined;
|
|
46748
|
+
saveImage(ctx);
|
|
46749
|
+
}
|
|
46750
|
+
function insertImage(ctx, image) {
|
|
46751
|
+
try {
|
|
46752
|
+
var _ctx$luckysheet_selec;
|
|
46753
|
+
var last = (_ctx$luckysheet_selec = ctx.luckysheet_select_save) === null || _ctx$luckysheet_selec === void 0 ? void 0 : _ctx$luckysheet_selec[ctx.luckysheet_select_save.length - 1];
|
|
46754
|
+
var rowIndex = last === null || last === void 0 ? void 0 : last.row_focus;
|
|
46755
|
+
var colIndex = last === null || last === void 0 ? void 0 : last.column_focus;
|
|
46756
|
+
if (!last) {
|
|
46757
|
+
rowIndex = 0;
|
|
46758
|
+
colIndex = 0;
|
|
46759
|
+
} else {
|
|
46760
|
+
if (rowIndex == null) {
|
|
46761
|
+
var _last$row = _slicedToArray(last.row, 1);
|
|
46762
|
+
rowIndex = _last$row[0];
|
|
46763
|
+
}
|
|
46764
|
+
if (colIndex == null) {
|
|
46765
|
+
var _last$column = _slicedToArray(last.column, 1);
|
|
46766
|
+
colIndex = _last$column[0];
|
|
46767
|
+
}
|
|
46768
|
+
}
|
|
46769
|
+
var flowdata = getFlowdata(ctx);
|
|
46770
|
+
var left = colIndex === 0 ? 0 : ctx.visibledatacolumn[colIndex - 1];
|
|
46771
|
+
var top = rowIndex === 0 ? 0 : ctx.visibledatarow[rowIndex - 1];
|
|
46772
|
+
if (flowdata) {
|
|
46773
|
+
var margeset = mergeBorder(ctx, flowdata, rowIndex, colIndex);
|
|
46774
|
+
if (margeset) {
|
|
46775
|
+
var _margeset$row = _slicedToArray(margeset.row, 1);
|
|
46776
|
+
top = _margeset$row[0];
|
|
46777
|
+
var _margeset$column = _slicedToArray(margeset.column, 1);
|
|
46778
|
+
left = _margeset$column[0];
|
|
46779
|
+
}
|
|
46780
|
+
}
|
|
46781
|
+
var width = image.width;
|
|
46782
|
+
var height = image.height;
|
|
46783
|
+
var img = {
|
|
46784
|
+
id: generateRandomId("img"),
|
|
46785
|
+
src: image.src,
|
|
46786
|
+
left: left,
|
|
46787
|
+
top: top,
|
|
46788
|
+
width: width * 0.5,
|
|
46789
|
+
height: height * 0.5,
|
|
46790
|
+
originWidth: width,
|
|
46791
|
+
originHeight: height
|
|
46792
|
+
};
|
|
46793
|
+
ctx.insertedImgs = (ctx.insertedImgs || []).concat(img);
|
|
46794
|
+
saveImage(ctx);
|
|
46795
|
+
} catch (err) {
|
|
46796
|
+
console.info(err);
|
|
46797
|
+
}
|
|
46798
|
+
}
|
|
46799
|
+
function getImagePosition() {
|
|
46800
|
+
var box = document.getElementById("luckysheet-modal-dialog-activeImage");
|
|
46801
|
+
if (!box) return undefined;
|
|
46802
|
+
var _box$getBoundingClien = box.getBoundingClientRect(),
|
|
46803
|
+
width = _box$getBoundingClien.width,
|
|
46804
|
+
height = _box$getBoundingClien.height;
|
|
46805
|
+
var left = box.offsetLeft;
|
|
46806
|
+
var top = box.offsetTop;
|
|
46807
|
+
return {
|
|
46808
|
+
left: left,
|
|
46809
|
+
top: top,
|
|
46810
|
+
width: width,
|
|
46811
|
+
height: height
|
|
46812
|
+
};
|
|
46813
|
+
}
|
|
46814
|
+
function cancelActiveImgItem(ctx, globalCache) {
|
|
46815
|
+
ctx.activeImg = undefined;
|
|
46816
|
+
globalCache.image = undefined;
|
|
46817
|
+
}
|
|
46818
|
+
function onImageMoveStart(ctx, globalCache, e) {
|
|
46819
|
+
var position = getImagePosition();
|
|
46820
|
+
if (position) {
|
|
46821
|
+
var top = position.top,
|
|
46822
|
+
left = position.left;
|
|
46823
|
+
___default['default'].set(globalCache, "image", {
|
|
46824
|
+
cursorMoveStartPosition: {
|
|
46825
|
+
x: e.pageX,
|
|
46826
|
+
y: e.pageY
|
|
46827
|
+
},
|
|
46828
|
+
imgInitialPosition: {
|
|
46829
|
+
left: left,
|
|
46830
|
+
top: top
|
|
46831
|
+
}
|
|
46832
|
+
});
|
|
46833
|
+
}
|
|
46834
|
+
}
|
|
46835
|
+
function onImageMove(ctx, globalCache, e) {
|
|
46836
|
+
if (ctx.allowEdit === false) return false;
|
|
46837
|
+
var image = globalCache === null || globalCache === void 0 ? void 0 : globalCache.image;
|
|
46838
|
+
var img = document.getElementById("luckysheet-modal-dialog-activeImage");
|
|
46839
|
+
if (img && image && !image.resizingSide) {
|
|
46840
|
+
var _image$cursorMoveStar = image.cursorMoveStartPosition,
|
|
46841
|
+
startX = _image$cursorMoveStar.x,
|
|
46842
|
+
startY = _image$cursorMoveStar.y;
|
|
46843
|
+
var _image$imgInitialPosi = image.imgInitialPosition,
|
|
46844
|
+
top = _image$imgInitialPosi.top,
|
|
46845
|
+
left = _image$imgInitialPosi.left;
|
|
46846
|
+
left += e.pageX - startX;
|
|
46847
|
+
top += e.pageY - startY;
|
|
46848
|
+
if (top < 0) top = 0;
|
|
46849
|
+
img.style.left = "".concat(left, "px");
|
|
46850
|
+
img.style.top = "".concat(top, "px");
|
|
46851
|
+
return true;
|
|
46852
|
+
}
|
|
46853
|
+
return false;
|
|
46854
|
+
}
|
|
46855
|
+
function onImageMoveEnd(ctx, globalCache) {
|
|
46856
|
+
var _globalCache$image;
|
|
46857
|
+
var position = getImagePosition();
|
|
46858
|
+
if (!((_globalCache$image = globalCache.image) === null || _globalCache$image === void 0 ? void 0 : _globalCache$image.resizingSide)) {
|
|
46859
|
+
globalCache.image = undefined;
|
|
46860
|
+
if (position) {
|
|
46861
|
+
var img = ___default['default'].find(ctx.insertedImgs, function (v) {
|
|
46862
|
+
return v.id === ctx.activeImg;
|
|
46863
|
+
});
|
|
46864
|
+
if (img) {
|
|
46865
|
+
img.left = position.left / ctx.zoomRatio;
|
|
46866
|
+
img.top = position.top / ctx.zoomRatio;
|
|
46867
|
+
saveImage(ctx);
|
|
46868
|
+
}
|
|
46869
|
+
}
|
|
46870
|
+
}
|
|
46871
|
+
}
|
|
46872
|
+
function onImageResizeStart(globalCache, e, resizingSide) {
|
|
46873
|
+
var position = getImagePosition();
|
|
46874
|
+
if (position) {
|
|
46875
|
+
___default['default'].set(globalCache, "image", {
|
|
46876
|
+
cursorMoveStartPosition: {
|
|
46877
|
+
x: e.pageX,
|
|
46878
|
+
y: e.pageY
|
|
46879
|
+
},
|
|
46880
|
+
resizingSide: resizingSide,
|
|
46881
|
+
imgInitialPosition: position
|
|
46882
|
+
});
|
|
46883
|
+
}
|
|
46884
|
+
}
|
|
46885
|
+
function onImageResize(ctx, globalCache, e) {
|
|
46886
|
+
if (ctx.allowEdit === false) return false;
|
|
46887
|
+
var image = globalCache === null || globalCache === void 0 ? void 0 : globalCache.image;
|
|
46888
|
+
if (image === null || image === void 0 ? void 0 : image.resizingSide) {
|
|
46889
|
+
var imgContainer = document.getElementById("luckysheet-modal-dialog-activeImage");
|
|
46890
|
+
var img = imgContainer === null || imgContainer === void 0 ? void 0 : imgContainer.querySelector(".luckysheet-modal-dialog-content");
|
|
46891
|
+
if (img == null) return false;
|
|
46892
|
+
var _image$cursorMoveStar2 = image.cursorMoveStartPosition,
|
|
46893
|
+
startX = _image$cursorMoveStar2.x,
|
|
46894
|
+
startY = _image$cursorMoveStar2.y;
|
|
46895
|
+
var _image$imgInitialPosi2 = image.imgInitialPosition,
|
|
46896
|
+
top = _image$imgInitialPosi2.top,
|
|
46897
|
+
left = _image$imgInitialPosi2.left,
|
|
46898
|
+
width = _image$imgInitialPosi2.width,
|
|
46899
|
+
height = _image$imgInitialPosi2.height;
|
|
46900
|
+
var dx = e.pageX - startX;
|
|
46901
|
+
var dy = e.pageY - startY;
|
|
46902
|
+
var minHeight = 60 * ctx.zoomRatio;
|
|
46903
|
+
var minWidth = 1.5 * 60 * ctx.zoomRatio;
|
|
46904
|
+
if (["lm", "lt", "lb"].includes(image.resizingSide)) {
|
|
46905
|
+
if (width - dx < minWidth) {
|
|
46906
|
+
left += width - minWidth;
|
|
46907
|
+
width = minWidth;
|
|
46908
|
+
} else {
|
|
46909
|
+
left += dx;
|
|
46910
|
+
width -= dx;
|
|
46911
|
+
}
|
|
46912
|
+
if (left < 0) left = 0;
|
|
46913
|
+
img.style.left = "".concat(left, "px");
|
|
46914
|
+
imgContainer.style.left = "".concat(left, "px");
|
|
46915
|
+
}
|
|
46916
|
+
if (["rm", "rt", "rb"].includes(image.resizingSide)) {
|
|
46917
|
+
width = width + dx < minWidth ? minWidth : width + dx;
|
|
46918
|
+
}
|
|
46919
|
+
if (["mt", "lt", "rt"].includes(image.resizingSide)) {
|
|
46920
|
+
if (height - dy < minHeight) {
|
|
46921
|
+
top += height - minHeight;
|
|
46922
|
+
height = minHeight;
|
|
46923
|
+
} else {
|
|
46924
|
+
top += dy;
|
|
46925
|
+
height -= dy;
|
|
46926
|
+
}
|
|
46927
|
+
if (top < 0) top = 0;
|
|
46928
|
+
img.style.top = "".concat(top, "px");
|
|
46929
|
+
imgContainer.style.top = "".concat(top, "px");
|
|
46930
|
+
}
|
|
46931
|
+
if (["mb", "lb", "rb"].includes(image.resizingSide)) {
|
|
46932
|
+
height = height + dy < minHeight ? minHeight : height + dy;
|
|
46933
|
+
}
|
|
46934
|
+
img.style.width = "".concat(width, "px");
|
|
46935
|
+
imgContainer.style.width = "".concat(width, "px");
|
|
46936
|
+
img.style.height = "".concat(height, "px");
|
|
46937
|
+
imgContainer.style.height = "".concat(height, "px");
|
|
46938
|
+
img.style.backgroundSize = "".concat(width, "px ").concat(height, "px");
|
|
46939
|
+
return true;
|
|
46940
|
+
}
|
|
46941
|
+
return false;
|
|
46942
|
+
}
|
|
46943
|
+
function onImageResizeEnd(ctx, globalCache) {
|
|
46944
|
+
var _globalCache$image2;
|
|
46945
|
+
if ((_globalCache$image2 = globalCache.image) === null || _globalCache$image2 === void 0 ? void 0 : _globalCache$image2.resizingSide) {
|
|
46946
|
+
globalCache.image = undefined;
|
|
46947
|
+
var position = getImagePosition();
|
|
46948
|
+
if (position) {
|
|
46949
|
+
var img = ___default['default'].find(ctx.insertedImgs, function (v) {
|
|
46950
|
+
return v.id === ctx.activeImg;
|
|
46951
|
+
});
|
|
46952
|
+
if (img) {
|
|
46953
|
+
img.left = position.left / ctx.zoomRatio;
|
|
46954
|
+
img.top = position.top / ctx.zoomRatio;
|
|
46955
|
+
img.width = position.width / ctx.zoomRatio;
|
|
46956
|
+
img.height = position.height / ctx.zoomRatio;
|
|
46957
|
+
saveImage(ctx);
|
|
46958
|
+
}
|
|
46959
|
+
}
|
|
46960
|
+
}
|
|
46961
|
+
}
|
|
46962
|
+
|
|
46709
46963
|
function storeSheetParam(ctx) {
|
|
46710
46964
|
var index = getSheetIndex(ctx, ctx.currentSheetId);
|
|
46711
46965
|
if (index == null) return;
|
|
@@ -46949,8 +47203,56 @@ function expandRowsAndColumns(data, rowsToAdd, columnsToAdd) {
|
|
|
46949
47203
|
}
|
|
46950
47204
|
return data;
|
|
46951
47205
|
}
|
|
46952
|
-
|
|
46953
|
-
|
|
47206
|
+
function setNextSheet(draftCtx, nextSheetId, refs) {
|
|
47207
|
+
var _draftCtx$luckysheetf, _luckysheetCellUpdate;
|
|
47208
|
+
var sheet = draftCtx.luckysheetfile.find(function (_sheet) {
|
|
47209
|
+
return _sheet.id === nextSheetId;
|
|
47210
|
+
}) || ((_draftCtx$luckysheetf = draftCtx.luckysheetfile) === null || _draftCtx$luckysheetf === void 0 ? void 0 : _draftCtx$luckysheetf[0]);
|
|
47211
|
+
draftCtx.sheetScrollRecord[draftCtx.currentSheetId] = {
|
|
47212
|
+
scrollLeft: draftCtx.scrollLeft,
|
|
47213
|
+
scrollTop: draftCtx.scrollTop,
|
|
47214
|
+
luckysheet_select_status: draftCtx.luckysheet_select_status,
|
|
47215
|
+
luckysheet_select_save: draftCtx.luckysheet_select_save,
|
|
47216
|
+
luckysheet_selection_range: draftCtx.luckysheet_selection_range
|
|
47217
|
+
};
|
|
47218
|
+
var isBack = false;
|
|
47219
|
+
var luckysheetCellUpdate = [];
|
|
47220
|
+
if ((israngeseleciton(draftCtx) || draftCtx.formulaCache.rangestart) && !draftCtx.active_f) {
|
|
47221
|
+
var _refs$fxInput$current, _draftCtx$sheetScroll;
|
|
47222
|
+
draftCtx.active_f = {
|
|
47223
|
+
r: draftCtx.luckysheet_select_save[0].row_focus,
|
|
47224
|
+
c: draftCtx.luckysheet_select_save[0].column_focus,
|
|
47225
|
+
sheetId: draftCtx.currentSheetId,
|
|
47226
|
+
text: (_refs$fxInput$current = refs.fxInput.current) === null || _refs$fxInput$current === void 0 ? void 0 : _refs$fxInput$current.innerText
|
|
47227
|
+
};
|
|
47228
|
+
if ((_draftCtx$sheetScroll = draftCtx.sheetScrollRecord[nextSheetId]) === null || _draftCtx$sheetScroll === void 0 ? void 0 : _draftCtx$sheetScroll.luckysheet_select_save) {
|
|
47229
|
+
draftCtx.sheetScrollRecord[nextSheetId].luckysheet_select_save = undefined;
|
|
47230
|
+
}
|
|
47231
|
+
moveToEnd(refs.fxInput.current);
|
|
47232
|
+
} else if (draftCtx.active_f && draftCtx.active_f.sheetId === nextSheetId) {
|
|
47233
|
+
var _refs$fxInput$current2;
|
|
47234
|
+
luckysheetCellUpdate = [draftCtx.active_f.r, draftCtx.active_f.c];
|
|
47235
|
+
isBack = true;
|
|
47236
|
+
if ((_refs$fxInput$current2 = refs.fxInput.current) === null || _refs$fxInput$current2 === void 0 ? void 0 : _refs$fxInput$current2.innerHTML) {
|
|
47237
|
+
var _refs$fxInput$current3;
|
|
47238
|
+
refs.cellInput.current.innerHTML = ((_refs$fxInput$current3 = refs.fxInput.current) === null || _refs$fxInput$current3 === void 0 ? void 0 : _refs$fxInput$current3.innerHTML) || "";
|
|
47239
|
+
}
|
|
47240
|
+
moveToEnd(refs.cellInput.current);
|
|
47241
|
+
}
|
|
47242
|
+
var _update = ((_luckysheetCellUpdate = luckysheetCellUpdate) === null || _luckysheetCellUpdate === void 0 ? void 0 : _luckysheetCellUpdate.length) > 0 ? luckysheetCellUpdate : draftCtx.luckysheetCellUpdate;
|
|
47243
|
+
draftCtx.currentSheetId = nextSheetId;
|
|
47244
|
+
if ((_update === null || _update === void 0 ? void 0 : _update.length) > 0) ;
|
|
47245
|
+
draftCtx.dataVerificationDropDownList = false;
|
|
47246
|
+
draftCtx.zoomRatio = sheet.zoomRatio || 1;
|
|
47247
|
+
cancelActiveImgItem(draftCtx, refs.globalCache);
|
|
47248
|
+
cancelNormalSelected(draftCtx);
|
|
47249
|
+
if (isBack) {
|
|
47250
|
+
draftCtx.luckysheetCellUpdate = luckysheetCellUpdate;
|
|
47251
|
+
draftCtx.active_f = undefined;
|
|
47252
|
+
}
|
|
47253
|
+
}
|
|
47254
|
+
|
|
47255
|
+
function mergeCells(ctx, sheetId, ranges, type) {
|
|
46954
47256
|
var idx = getSheetIndex(ctx, sheetId);
|
|
46955
47257
|
if (idx == null) return;
|
|
46956
47258
|
var sheet = ctx.luckysheetfile[idx];
|
|
@@ -49345,296 +49647,15 @@ function overShowComment(ctx, e, scrollX, scrollY, container) {
|
|
|
49345
49647
|
rc: rc,
|
|
49346
49648
|
left: left,
|
|
49347
49649
|
top: top,
|
|
49348
|
-
width: width,
|
|
49349
|
-
height: height,
|
|
49350
|
-
size: size,
|
|
49351
|
-
value: value,
|
|
49352
|
-
autoFocus: false
|
|
49353
|
-
};
|
|
49354
|
-
}
|
|
49355
|
-
function getCommentBoxPosition(commentId) {
|
|
49356
|
-
var box = document.getElementById(commentId);
|
|
49357
|
-
if (!box) return undefined;
|
|
49358
|
-
var _box$getBoundingClien = box.getBoundingClientRect(),
|
|
49359
|
-
width = _box$getBoundingClien.width,
|
|
49360
|
-
height = _box$getBoundingClien.height;
|
|
49361
|
-
var left = box.offsetLeft;
|
|
49362
|
-
var top = box.offsetTop;
|
|
49363
|
-
return {
|
|
49364
|
-
left: left,
|
|
49365
|
-
top: top,
|
|
49366
|
-
width: width,
|
|
49367
|
-
height: height
|
|
49368
|
-
};
|
|
49369
|
-
}
|
|
49370
|
-
function onCommentBoxResizeStart(ctx, globalCache, e, _ref3, resizingId, resizingSide) {
|
|
49371
|
-
var r = _ref3.r,
|
|
49372
|
-
c = _ref3.c,
|
|
49373
|
-
rc = _ref3.rc;
|
|
49374
|
-
var position = getCommentBoxPosition(resizingId);
|
|
49375
|
-
if (position) {
|
|
49376
|
-
___default['default'].set(globalCache, "commentBox", {
|
|
49377
|
-
cursorMoveStartPosition: {
|
|
49378
|
-
x: e.pageX,
|
|
49379
|
-
y: e.pageY
|
|
49380
|
-
},
|
|
49381
|
-
resizingId: resizingId,
|
|
49382
|
-
resizingSide: resizingSide,
|
|
49383
|
-
commentRC: {
|
|
49384
|
-
r: r,
|
|
49385
|
-
c: c,
|
|
49386
|
-
rc: rc
|
|
49387
|
-
},
|
|
49388
|
-
boxInitialPosition: position
|
|
49389
|
-
});
|
|
49390
|
-
}
|
|
49391
|
-
}
|
|
49392
|
-
function onCommentBoxResize(ctx, globalCache, e) {
|
|
49393
|
-
if (ctx.allowEdit === false) return false;
|
|
49394
|
-
var commentBox = globalCache === null || globalCache === void 0 ? void 0 : globalCache.commentBox;
|
|
49395
|
-
if ((commentBox === null || commentBox === void 0 ? void 0 : commentBox.resizingId) && commentBox.resizingSide) {
|
|
49396
|
-
var box = document.getElementById(commentBox.resizingId);
|
|
49397
|
-
var _commentBox$cursorMov = commentBox.cursorMoveStartPosition,
|
|
49398
|
-
startX = _commentBox$cursorMov.x,
|
|
49399
|
-
startY = _commentBox$cursorMov.y;
|
|
49400
|
-
var _commentBox$boxInitia = commentBox.boxInitialPosition,
|
|
49401
|
-
top = _commentBox$boxInitia.top,
|
|
49402
|
-
left = _commentBox$boxInitia.left,
|
|
49403
|
-
width = _commentBox$boxInitia.width,
|
|
49404
|
-
height = _commentBox$boxInitia.height;
|
|
49405
|
-
var dx = e.pageX - startX;
|
|
49406
|
-
var dy = e.pageY - startY;
|
|
49407
|
-
var minHeight = 60 * ctx.zoomRatio;
|
|
49408
|
-
var minWidth = 1.5 * 60 * ctx.zoomRatio;
|
|
49409
|
-
if (["lm", "lt", "lb"].includes(commentBox.resizingSide)) {
|
|
49410
|
-
if (width - dx < minWidth) {
|
|
49411
|
-
left += width - minWidth;
|
|
49412
|
-
width = minWidth;
|
|
49413
|
-
} else {
|
|
49414
|
-
left += dx;
|
|
49415
|
-
width -= dx;
|
|
49416
|
-
}
|
|
49417
|
-
if (left < 0) left = 0;
|
|
49418
|
-
box.style.left = "".concat(left, "px");
|
|
49419
|
-
}
|
|
49420
|
-
if (["rm", "rt", "rb"].includes(commentBox.resizingSide)) {
|
|
49421
|
-
width = width + dx < minWidth ? minWidth : width + dx;
|
|
49422
|
-
}
|
|
49423
|
-
if (["mt", "lt", "rt"].includes(commentBox.resizingSide)) {
|
|
49424
|
-
if (height - dy < minHeight) {
|
|
49425
|
-
top += height - minHeight;
|
|
49426
|
-
height = minHeight;
|
|
49427
|
-
} else {
|
|
49428
|
-
top += dy;
|
|
49429
|
-
height -= dy;
|
|
49430
|
-
}
|
|
49431
|
-
if (top < 0) top = 0;
|
|
49432
|
-
box.style.top = "".concat(top, "px");
|
|
49433
|
-
}
|
|
49434
|
-
if (["mb", "lb", "rb"].includes(commentBox.resizingSide)) {
|
|
49435
|
-
height = height + dy < minHeight ? minHeight : height + dy;
|
|
49436
|
-
}
|
|
49437
|
-
box.style.width = "".concat(width, "px");
|
|
49438
|
-
box.style.height = "".concat(height, "px");
|
|
49439
|
-
return true;
|
|
49440
|
-
}
|
|
49441
|
-
return false;
|
|
49442
|
-
}
|
|
49443
|
-
function onCommentBoxResizeEnd(ctx, globalCache) {
|
|
49444
|
-
var _globalCache$commentB;
|
|
49445
|
-
if ((_globalCache$commentB = globalCache.commentBox) === null || _globalCache$commentB === void 0 ? void 0 : _globalCache$commentB.resizingId) {
|
|
49446
|
-
var _globalCache$commentB2 = globalCache.commentBox,
|
|
49447
|
-
resizingId = _globalCache$commentB2.resizingId,
|
|
49448
|
-
_globalCache$commentB3 = _globalCache$commentB2.commentRC,
|
|
49449
|
-
r = _globalCache$commentB3.r,
|
|
49450
|
-
c = _globalCache$commentB3.c;
|
|
49451
|
-
globalCache.commentBox.resizingId = undefined;
|
|
49452
|
-
var position = getCommentBoxPosition(resizingId);
|
|
49453
|
-
if (position) {
|
|
49454
|
-
var top = position.top,
|
|
49455
|
-
left = position.left,
|
|
49456
|
-
width = position.width,
|
|
49457
|
-
height = position.height;
|
|
49458
|
-
var flowdata = getFlowdata(ctx);
|
|
49459
|
-
var cell = flowdata === null || flowdata === void 0 ? void 0 : flowdata[r][c];
|
|
49460
|
-
if (!flowdata || !(cell === null || cell === void 0 ? void 0 : cell.ps)) return;
|
|
49461
|
-
cell.ps.left = left / ctx.zoomRatio;
|
|
49462
|
-
cell.ps.top = top / ctx.zoomRatio;
|
|
49463
|
-
cell.ps.width = width / ctx.zoomRatio;
|
|
49464
|
-
cell.ps.height = height / ctx.zoomRatio;
|
|
49465
|
-
setEditingComment(ctx, flowdata, r, c);
|
|
49466
|
-
if (ctx.hooks.afterUpdateComment) {
|
|
49467
|
-
var _ctx$hooks$afterUpdat5, _ctx$hooks10;
|
|
49468
|
-
(_ctx$hooks$afterUpdat5 = (_ctx$hooks10 = ctx.hooks).afterUpdateComment) === null || _ctx$hooks$afterUpdat5 === void 0 ? void 0 : _ctx$hooks$afterUpdat5.call(_ctx$hooks10, r, c, _objectSpread2({}, cell.ps), true);
|
|
49469
|
-
}
|
|
49470
|
-
}
|
|
49471
|
-
}
|
|
49472
|
-
}
|
|
49473
|
-
function onCommentBoxMoveStart(ctx, globalCache, e, _ref4, movingId) {
|
|
49474
|
-
var r = _ref4.r,
|
|
49475
|
-
c = _ref4.c,
|
|
49476
|
-
rc = _ref4.rc;
|
|
49477
|
-
var position = getCommentBoxPosition(movingId);
|
|
49478
|
-
if (position) {
|
|
49479
|
-
var top = position.top,
|
|
49480
|
-
left = position.left;
|
|
49481
|
-
___default['default'].set(globalCache, "commentBox", {
|
|
49482
|
-
cursorMoveStartPosition: {
|
|
49483
|
-
x: e.pageX,
|
|
49484
|
-
y: e.pageY
|
|
49485
|
-
},
|
|
49486
|
-
movingId: movingId,
|
|
49487
|
-
commentRC: {
|
|
49488
|
-
r: r,
|
|
49489
|
-
c: c,
|
|
49490
|
-
rc: rc
|
|
49491
|
-
},
|
|
49492
|
-
boxInitialPosition: {
|
|
49493
|
-
left: left,
|
|
49494
|
-
top: top
|
|
49495
|
-
}
|
|
49496
|
-
});
|
|
49497
|
-
}
|
|
49498
|
-
}
|
|
49499
|
-
function onCommentBoxMove(ctx, globalCache, e) {
|
|
49500
|
-
var commentBox = globalCache === null || globalCache === void 0 ? void 0 : globalCache.commentBox;
|
|
49501
|
-
if (commentBox === null || commentBox === void 0 ? void 0 : commentBox.movingId) {
|
|
49502
|
-
var box = document.getElementById(commentBox.movingId);
|
|
49503
|
-
var _commentBox$cursorMov2 = commentBox.cursorMoveStartPosition,
|
|
49504
|
-
startX = _commentBox$cursorMov2.x,
|
|
49505
|
-
startY = _commentBox$cursorMov2.y;
|
|
49506
|
-
var _commentBox$boxInitia2 = commentBox.boxInitialPosition,
|
|
49507
|
-
top = _commentBox$boxInitia2.top,
|
|
49508
|
-
left = _commentBox$boxInitia2.left;
|
|
49509
|
-
left += e.pageX - startX;
|
|
49510
|
-
top += e.pageY - startY;
|
|
49511
|
-
if (top < 0) top = 0;
|
|
49512
|
-
if (left < 0) left = 0;
|
|
49513
|
-
box.style.left = "".concat(left, "px");
|
|
49514
|
-
box.style.top = "".concat(top, "px");
|
|
49515
|
-
return true;
|
|
49516
|
-
}
|
|
49517
|
-
return false;
|
|
49518
|
-
}
|
|
49519
|
-
function onCommentBoxMoveEnd(ctx, globalCache) {
|
|
49520
|
-
var _globalCache$commentB4;
|
|
49521
|
-
if ((_globalCache$commentB4 = globalCache.commentBox) === null || _globalCache$commentB4 === void 0 ? void 0 : _globalCache$commentB4.movingId) {
|
|
49522
|
-
var _globalCache$commentB5 = globalCache.commentBox,
|
|
49523
|
-
movingId = _globalCache$commentB5.movingId,
|
|
49524
|
-
_globalCache$commentB6 = _globalCache$commentB5.commentRC,
|
|
49525
|
-
r = _globalCache$commentB6.r,
|
|
49526
|
-
c = _globalCache$commentB6.c;
|
|
49527
|
-
globalCache.commentBox.movingId = undefined;
|
|
49528
|
-
var position = getCommentBoxPosition(movingId);
|
|
49529
|
-
if (position) {
|
|
49530
|
-
var top = position.top,
|
|
49531
|
-
left = position.left;
|
|
49532
|
-
var flowdata = getFlowdata(ctx);
|
|
49533
|
-
var cell = flowdata === null || flowdata === void 0 ? void 0 : flowdata[r][c];
|
|
49534
|
-
if (!flowdata || !(cell === null || cell === void 0 ? void 0 : cell.ps)) return;
|
|
49535
|
-
cell.ps.left = left / ctx.zoomRatio;
|
|
49536
|
-
cell.ps.top = top / ctx.zoomRatio;
|
|
49537
|
-
setEditingComment(ctx, flowdata, r, c);
|
|
49538
|
-
if (ctx.hooks.afterUpdateComment) {
|
|
49539
|
-
var _ctx$hooks$afterUpdat6, _ctx$hooks11;
|
|
49540
|
-
(_ctx$hooks$afterUpdat6 = (_ctx$hooks11 = ctx.hooks).afterUpdateComment) === null || _ctx$hooks$afterUpdat6 === void 0 ? void 0 : _ctx$hooks$afterUpdat6.call(_ctx$hooks11, r, c, _objectSpread2({}, cell.ps), true);
|
|
49541
|
-
}
|
|
49542
|
-
}
|
|
49543
|
-
}
|
|
49544
|
-
}
|
|
49545
|
-
|
|
49546
|
-
var imageProps = {
|
|
49547
|
-
defaultWidth: 144,
|
|
49548
|
-
defaultHeight: 84,
|
|
49549
|
-
currentObj: null,
|
|
49550
|
-
currentWinW: null,
|
|
49551
|
-
currentWinH: null,
|
|
49552
|
-
resize: null,
|
|
49553
|
-
resizeXY: null,
|
|
49554
|
-
move: false,
|
|
49555
|
-
moveXY: null,
|
|
49556
|
-
cursorStartPosition: null
|
|
49557
|
-
};
|
|
49558
|
-
function generateRandomId(prefix) {
|
|
49559
|
-
if (prefix == null) {
|
|
49560
|
-
prefix = "img";
|
|
49561
|
-
}
|
|
49562
|
-
var userAgent = window.navigator.userAgent.replace(/[^a-zA-Z0-9]/g, "").split("");
|
|
49563
|
-
var mid = "";
|
|
49564
|
-
for (var i = 0; i < 12; i += 1) {
|
|
49565
|
-
mid += userAgent[Math.round(Math.random() * (userAgent.length - 1))];
|
|
49566
|
-
}
|
|
49567
|
-
var time = new Date().getTime();
|
|
49568
|
-
return "".concat(prefix, "_").concat(mid, "_").concat(time);
|
|
49569
|
-
}
|
|
49570
|
-
function showImgChooser() {
|
|
49571
|
-
var chooser = document.getElementById("leankylin-img-upload");
|
|
49572
|
-
if (chooser) chooser.click();
|
|
49573
|
-
}
|
|
49574
|
-
function saveImage(ctx) {
|
|
49575
|
-
var index = getSheetIndex(ctx, ctx.currentSheetId);
|
|
49576
|
-
if (index == null) return;
|
|
49577
|
-
var file = ctx.luckysheetfile[index];
|
|
49578
|
-
file.images = ctx.insertedImgs;
|
|
49579
|
-
}
|
|
49580
|
-
function removeActiveImage(ctx) {
|
|
49581
|
-
ctx.insertedImgs = ___default['default'].filter(ctx.insertedImgs, function (image) {
|
|
49582
|
-
return image.id !== ctx.activeImg;
|
|
49583
|
-
});
|
|
49584
|
-
ctx.activeImg = undefined;
|
|
49585
|
-
saveImage(ctx);
|
|
49586
|
-
}
|
|
49587
|
-
function insertImage(ctx, image) {
|
|
49588
|
-
try {
|
|
49589
|
-
var _ctx$luckysheet_selec;
|
|
49590
|
-
var last = (_ctx$luckysheet_selec = ctx.luckysheet_select_save) === null || _ctx$luckysheet_selec === void 0 ? void 0 : _ctx$luckysheet_selec[ctx.luckysheet_select_save.length - 1];
|
|
49591
|
-
var rowIndex = last === null || last === void 0 ? void 0 : last.row_focus;
|
|
49592
|
-
var colIndex = last === null || last === void 0 ? void 0 : last.column_focus;
|
|
49593
|
-
if (!last) {
|
|
49594
|
-
rowIndex = 0;
|
|
49595
|
-
colIndex = 0;
|
|
49596
|
-
} else {
|
|
49597
|
-
if (rowIndex == null) {
|
|
49598
|
-
var _last$row = _slicedToArray(last.row, 1);
|
|
49599
|
-
rowIndex = _last$row[0];
|
|
49600
|
-
}
|
|
49601
|
-
if (colIndex == null) {
|
|
49602
|
-
var _last$column = _slicedToArray(last.column, 1);
|
|
49603
|
-
colIndex = _last$column[0];
|
|
49604
|
-
}
|
|
49605
|
-
}
|
|
49606
|
-
var flowdata = getFlowdata(ctx);
|
|
49607
|
-
var left = colIndex === 0 ? 0 : ctx.visibledatacolumn[colIndex - 1];
|
|
49608
|
-
var top = rowIndex === 0 ? 0 : ctx.visibledatarow[rowIndex - 1];
|
|
49609
|
-
if (flowdata) {
|
|
49610
|
-
var margeset = mergeBorder(ctx, flowdata, rowIndex, colIndex);
|
|
49611
|
-
if (margeset) {
|
|
49612
|
-
var _margeset$row = _slicedToArray(margeset.row, 1);
|
|
49613
|
-
top = _margeset$row[0];
|
|
49614
|
-
var _margeset$column = _slicedToArray(margeset.column, 1);
|
|
49615
|
-
left = _margeset$column[0];
|
|
49616
|
-
}
|
|
49617
|
-
}
|
|
49618
|
-
var width = image.width;
|
|
49619
|
-
var height = image.height;
|
|
49620
|
-
var img = {
|
|
49621
|
-
id: generateRandomId("img"),
|
|
49622
|
-
src: image.src,
|
|
49623
|
-
left: left,
|
|
49624
|
-
top: top,
|
|
49625
|
-
width: width * 0.5,
|
|
49626
|
-
height: height * 0.5,
|
|
49627
|
-
originWidth: width,
|
|
49628
|
-
originHeight: height
|
|
49629
|
-
};
|
|
49630
|
-
ctx.insertedImgs = (ctx.insertedImgs || []).concat(img);
|
|
49631
|
-
saveImage(ctx);
|
|
49632
|
-
} catch (err) {
|
|
49633
|
-
console.info(err);
|
|
49634
|
-
}
|
|
49650
|
+
width: width,
|
|
49651
|
+
height: height,
|
|
49652
|
+
size: size,
|
|
49653
|
+
value: value,
|
|
49654
|
+
autoFocus: false
|
|
49655
|
+
};
|
|
49635
49656
|
}
|
|
49636
|
-
function
|
|
49637
|
-
var box = document.getElementById(
|
|
49657
|
+
function getCommentBoxPosition(commentId) {
|
|
49658
|
+
var box = document.getElementById(commentId);
|
|
49638
49659
|
if (!box) return undefined;
|
|
49639
49660
|
var _box$getBoundingClien = box.getBoundingClientRect(),
|
|
49640
49661
|
width = _box$getBoundingClien.width,
|
|
@@ -49648,97 +49669,46 @@ function getImagePosition() {
|
|
|
49648
49669
|
height: height
|
|
49649
49670
|
};
|
|
49650
49671
|
}
|
|
49651
|
-
function
|
|
49652
|
-
|
|
49653
|
-
|
|
49654
|
-
|
|
49655
|
-
|
|
49656
|
-
var position = getImagePosition();
|
|
49657
|
-
if (position) {
|
|
49658
|
-
var top = position.top,
|
|
49659
|
-
left = position.left;
|
|
49660
|
-
___default['default'].set(globalCache, "image", {
|
|
49661
|
-
cursorMoveStartPosition: {
|
|
49662
|
-
x: e.pageX,
|
|
49663
|
-
y: e.pageY
|
|
49664
|
-
},
|
|
49665
|
-
imgInitialPosition: {
|
|
49666
|
-
left: left,
|
|
49667
|
-
top: top
|
|
49668
|
-
}
|
|
49669
|
-
});
|
|
49670
|
-
}
|
|
49671
|
-
}
|
|
49672
|
-
function onImageMove(ctx, globalCache, e) {
|
|
49673
|
-
if (ctx.allowEdit === false) return false;
|
|
49674
|
-
var image = globalCache === null || globalCache === void 0 ? void 0 : globalCache.image;
|
|
49675
|
-
var img = document.getElementById("luckysheet-modal-dialog-activeImage");
|
|
49676
|
-
if (img && image && !image.resizingSide) {
|
|
49677
|
-
var _image$cursorMoveStar = image.cursorMoveStartPosition,
|
|
49678
|
-
startX = _image$cursorMoveStar.x,
|
|
49679
|
-
startY = _image$cursorMoveStar.y;
|
|
49680
|
-
var _image$imgInitialPosi = image.imgInitialPosition,
|
|
49681
|
-
top = _image$imgInitialPosi.top,
|
|
49682
|
-
left = _image$imgInitialPosi.left;
|
|
49683
|
-
left += e.pageX - startX;
|
|
49684
|
-
top += e.pageY - startY;
|
|
49685
|
-
if (top < 0) top = 0;
|
|
49686
|
-
img.style.left = "".concat(left, "px");
|
|
49687
|
-
img.style.top = "".concat(top, "px");
|
|
49688
|
-
return true;
|
|
49689
|
-
}
|
|
49690
|
-
return false;
|
|
49691
|
-
}
|
|
49692
|
-
function onImageMoveEnd(ctx, globalCache) {
|
|
49693
|
-
var _globalCache$image;
|
|
49694
|
-
var position = getImagePosition();
|
|
49695
|
-
if (!((_globalCache$image = globalCache.image) === null || _globalCache$image === void 0 ? void 0 : _globalCache$image.resizingSide)) {
|
|
49696
|
-
globalCache.image = undefined;
|
|
49697
|
-
if (position) {
|
|
49698
|
-
var img = ___default['default'].find(ctx.insertedImgs, function (v) {
|
|
49699
|
-
return v.id === ctx.activeImg;
|
|
49700
|
-
});
|
|
49701
|
-
if (img) {
|
|
49702
|
-
img.left = position.left / ctx.zoomRatio;
|
|
49703
|
-
img.top = position.top / ctx.zoomRatio;
|
|
49704
|
-
saveImage(ctx);
|
|
49705
|
-
}
|
|
49706
|
-
}
|
|
49707
|
-
}
|
|
49708
|
-
}
|
|
49709
|
-
function onImageResizeStart(globalCache, e, resizingSide) {
|
|
49710
|
-
var position = getImagePosition();
|
|
49672
|
+
function onCommentBoxResizeStart(ctx, globalCache, e, _ref3, resizingId, resizingSide) {
|
|
49673
|
+
var r = _ref3.r,
|
|
49674
|
+
c = _ref3.c,
|
|
49675
|
+
rc = _ref3.rc;
|
|
49676
|
+
var position = getCommentBoxPosition(resizingId);
|
|
49711
49677
|
if (position) {
|
|
49712
|
-
___default['default'].set(globalCache, "
|
|
49678
|
+
___default['default'].set(globalCache, "commentBox", {
|
|
49713
49679
|
cursorMoveStartPosition: {
|
|
49714
49680
|
x: e.pageX,
|
|
49715
49681
|
y: e.pageY
|
|
49716
49682
|
},
|
|
49683
|
+
resizingId: resizingId,
|
|
49717
49684
|
resizingSide: resizingSide,
|
|
49718
|
-
|
|
49685
|
+
commentRC: {
|
|
49686
|
+
r: r,
|
|
49687
|
+
c: c,
|
|
49688
|
+
rc: rc
|
|
49689
|
+
},
|
|
49690
|
+
boxInitialPosition: position
|
|
49719
49691
|
});
|
|
49720
49692
|
}
|
|
49721
49693
|
}
|
|
49722
|
-
function
|
|
49694
|
+
function onCommentBoxResize(ctx, globalCache, e) {
|
|
49723
49695
|
if (ctx.allowEdit === false) return false;
|
|
49724
|
-
var
|
|
49725
|
-
if (
|
|
49726
|
-
var
|
|
49727
|
-
var
|
|
49728
|
-
|
|
49729
|
-
|
|
49730
|
-
|
|
49731
|
-
|
|
49732
|
-
|
|
49733
|
-
|
|
49734
|
-
|
|
49735
|
-
width = _image$imgInitialPosi2.width,
|
|
49736
|
-
height = _image$imgInitialPosi2.height;
|
|
49696
|
+
var commentBox = globalCache === null || globalCache === void 0 ? void 0 : globalCache.commentBox;
|
|
49697
|
+
if ((commentBox === null || commentBox === void 0 ? void 0 : commentBox.resizingId) && commentBox.resizingSide) {
|
|
49698
|
+
var box = document.getElementById(commentBox.resizingId);
|
|
49699
|
+
var _commentBox$cursorMov = commentBox.cursorMoveStartPosition,
|
|
49700
|
+
startX = _commentBox$cursorMov.x,
|
|
49701
|
+
startY = _commentBox$cursorMov.y;
|
|
49702
|
+
var _commentBox$boxInitia = commentBox.boxInitialPosition,
|
|
49703
|
+
top = _commentBox$boxInitia.top,
|
|
49704
|
+
left = _commentBox$boxInitia.left,
|
|
49705
|
+
width = _commentBox$boxInitia.width,
|
|
49706
|
+
height = _commentBox$boxInitia.height;
|
|
49737
49707
|
var dx = e.pageX - startX;
|
|
49738
49708
|
var dy = e.pageY - startY;
|
|
49739
49709
|
var minHeight = 60 * ctx.zoomRatio;
|
|
49740
49710
|
var minWidth = 1.5 * 60 * ctx.zoomRatio;
|
|
49741
|
-
if (["lm", "lt", "lb"].includes(
|
|
49711
|
+
if (["lm", "lt", "lb"].includes(commentBox.resizingSide)) {
|
|
49742
49712
|
if (width - dx < minWidth) {
|
|
49743
49713
|
left += width - minWidth;
|
|
49744
49714
|
width = minWidth;
|
|
@@ -49747,13 +49717,12 @@ function onImageResize(ctx, globalCache, e) {
|
|
|
49747
49717
|
width -= dx;
|
|
49748
49718
|
}
|
|
49749
49719
|
if (left < 0) left = 0;
|
|
49750
|
-
|
|
49751
|
-
imgContainer.style.left = "".concat(left, "px");
|
|
49720
|
+
box.style.left = "".concat(left, "px");
|
|
49752
49721
|
}
|
|
49753
|
-
if (["rm", "rt", "rb"].includes(
|
|
49722
|
+
if (["rm", "rt", "rb"].includes(commentBox.resizingSide)) {
|
|
49754
49723
|
width = width + dx < minWidth ? minWidth : width + dx;
|
|
49755
49724
|
}
|
|
49756
|
-
if (["mt", "lt", "rt"].includes(
|
|
49725
|
+
if (["mt", "lt", "rt"].includes(commentBox.resizingSide)) {
|
|
49757
49726
|
if (height - dy < minHeight) {
|
|
49758
49727
|
top += height - minHeight;
|
|
49759
49728
|
height = minHeight;
|
|
@@ -49762,36 +49731,115 @@ function onImageResize(ctx, globalCache, e) {
|
|
|
49762
49731
|
height -= dy;
|
|
49763
49732
|
}
|
|
49764
49733
|
if (top < 0) top = 0;
|
|
49765
|
-
|
|
49766
|
-
imgContainer.style.top = "".concat(top, "px");
|
|
49734
|
+
box.style.top = "".concat(top, "px");
|
|
49767
49735
|
}
|
|
49768
|
-
if (["mb", "lb", "rb"].includes(
|
|
49736
|
+
if (["mb", "lb", "rb"].includes(commentBox.resizingSide)) {
|
|
49769
49737
|
height = height + dy < minHeight ? minHeight : height + dy;
|
|
49770
49738
|
}
|
|
49771
|
-
|
|
49772
|
-
|
|
49773
|
-
img.style.height = "".concat(height, "px");
|
|
49774
|
-
imgContainer.style.height = "".concat(height, "px");
|
|
49775
|
-
img.style.backgroundSize = "".concat(width, "px ").concat(height, "px");
|
|
49739
|
+
box.style.width = "".concat(width, "px");
|
|
49740
|
+
box.style.height = "".concat(height, "px");
|
|
49776
49741
|
return true;
|
|
49777
49742
|
}
|
|
49778
49743
|
return false;
|
|
49779
49744
|
}
|
|
49780
|
-
function
|
|
49781
|
-
var _globalCache$
|
|
49782
|
-
if ((_globalCache$
|
|
49783
|
-
|
|
49784
|
-
|
|
49745
|
+
function onCommentBoxResizeEnd(ctx, globalCache) {
|
|
49746
|
+
var _globalCache$commentB;
|
|
49747
|
+
if ((_globalCache$commentB = globalCache.commentBox) === null || _globalCache$commentB === void 0 ? void 0 : _globalCache$commentB.resizingId) {
|
|
49748
|
+
var _globalCache$commentB2 = globalCache.commentBox,
|
|
49749
|
+
resizingId = _globalCache$commentB2.resizingId,
|
|
49750
|
+
_globalCache$commentB3 = _globalCache$commentB2.commentRC,
|
|
49751
|
+
r = _globalCache$commentB3.r,
|
|
49752
|
+
c = _globalCache$commentB3.c;
|
|
49753
|
+
globalCache.commentBox.resizingId = undefined;
|
|
49754
|
+
var position = getCommentBoxPosition(resizingId);
|
|
49785
49755
|
if (position) {
|
|
49786
|
-
var
|
|
49787
|
-
|
|
49788
|
-
|
|
49789
|
-
|
|
49790
|
-
|
|
49791
|
-
|
|
49792
|
-
|
|
49793
|
-
|
|
49794
|
-
|
|
49756
|
+
var top = position.top,
|
|
49757
|
+
left = position.left,
|
|
49758
|
+
width = position.width,
|
|
49759
|
+
height = position.height;
|
|
49760
|
+
var flowdata = getFlowdata(ctx);
|
|
49761
|
+
var cell = flowdata === null || flowdata === void 0 ? void 0 : flowdata[r][c];
|
|
49762
|
+
if (!flowdata || !(cell === null || cell === void 0 ? void 0 : cell.ps)) return;
|
|
49763
|
+
cell.ps.left = left / ctx.zoomRatio;
|
|
49764
|
+
cell.ps.top = top / ctx.zoomRatio;
|
|
49765
|
+
cell.ps.width = width / ctx.zoomRatio;
|
|
49766
|
+
cell.ps.height = height / ctx.zoomRatio;
|
|
49767
|
+
setEditingComment(ctx, flowdata, r, c);
|
|
49768
|
+
if (ctx.hooks.afterUpdateComment) {
|
|
49769
|
+
var _ctx$hooks$afterUpdat5, _ctx$hooks10;
|
|
49770
|
+
(_ctx$hooks$afterUpdat5 = (_ctx$hooks10 = ctx.hooks).afterUpdateComment) === null || _ctx$hooks$afterUpdat5 === void 0 ? void 0 : _ctx$hooks$afterUpdat5.call(_ctx$hooks10, r, c, _objectSpread2({}, cell.ps), true);
|
|
49771
|
+
}
|
|
49772
|
+
}
|
|
49773
|
+
}
|
|
49774
|
+
}
|
|
49775
|
+
function onCommentBoxMoveStart(ctx, globalCache, e, _ref4, movingId) {
|
|
49776
|
+
var r = _ref4.r,
|
|
49777
|
+
c = _ref4.c,
|
|
49778
|
+
rc = _ref4.rc;
|
|
49779
|
+
var position = getCommentBoxPosition(movingId);
|
|
49780
|
+
if (position) {
|
|
49781
|
+
var top = position.top,
|
|
49782
|
+
left = position.left;
|
|
49783
|
+
___default['default'].set(globalCache, "commentBox", {
|
|
49784
|
+
cursorMoveStartPosition: {
|
|
49785
|
+
x: e.pageX,
|
|
49786
|
+
y: e.pageY
|
|
49787
|
+
},
|
|
49788
|
+
movingId: movingId,
|
|
49789
|
+
commentRC: {
|
|
49790
|
+
r: r,
|
|
49791
|
+
c: c,
|
|
49792
|
+
rc: rc
|
|
49793
|
+
},
|
|
49794
|
+
boxInitialPosition: {
|
|
49795
|
+
left: left,
|
|
49796
|
+
top: top
|
|
49797
|
+
}
|
|
49798
|
+
});
|
|
49799
|
+
}
|
|
49800
|
+
}
|
|
49801
|
+
function onCommentBoxMove(ctx, globalCache, e) {
|
|
49802
|
+
var commentBox = globalCache === null || globalCache === void 0 ? void 0 : globalCache.commentBox;
|
|
49803
|
+
if (commentBox === null || commentBox === void 0 ? void 0 : commentBox.movingId) {
|
|
49804
|
+
var box = document.getElementById(commentBox.movingId);
|
|
49805
|
+
var _commentBox$cursorMov2 = commentBox.cursorMoveStartPosition,
|
|
49806
|
+
startX = _commentBox$cursorMov2.x,
|
|
49807
|
+
startY = _commentBox$cursorMov2.y;
|
|
49808
|
+
var _commentBox$boxInitia2 = commentBox.boxInitialPosition,
|
|
49809
|
+
top = _commentBox$boxInitia2.top,
|
|
49810
|
+
left = _commentBox$boxInitia2.left;
|
|
49811
|
+
left += e.pageX - startX;
|
|
49812
|
+
top += e.pageY - startY;
|
|
49813
|
+
if (top < 0) top = 0;
|
|
49814
|
+
if (left < 0) left = 0;
|
|
49815
|
+
box.style.left = "".concat(left, "px");
|
|
49816
|
+
box.style.top = "".concat(top, "px");
|
|
49817
|
+
return true;
|
|
49818
|
+
}
|
|
49819
|
+
return false;
|
|
49820
|
+
}
|
|
49821
|
+
function onCommentBoxMoveEnd(ctx, globalCache) {
|
|
49822
|
+
var _globalCache$commentB4;
|
|
49823
|
+
if ((_globalCache$commentB4 = globalCache.commentBox) === null || _globalCache$commentB4 === void 0 ? void 0 : _globalCache$commentB4.movingId) {
|
|
49824
|
+
var _globalCache$commentB5 = globalCache.commentBox,
|
|
49825
|
+
movingId = _globalCache$commentB5.movingId,
|
|
49826
|
+
_globalCache$commentB6 = _globalCache$commentB5.commentRC,
|
|
49827
|
+
r = _globalCache$commentB6.r,
|
|
49828
|
+
c = _globalCache$commentB6.c;
|
|
49829
|
+
globalCache.commentBox.movingId = undefined;
|
|
49830
|
+
var position = getCommentBoxPosition(movingId);
|
|
49831
|
+
if (position) {
|
|
49832
|
+
var top = position.top,
|
|
49833
|
+
left = position.left;
|
|
49834
|
+
var flowdata = getFlowdata(ctx);
|
|
49835
|
+
var cell = flowdata === null || flowdata === void 0 ? void 0 : flowdata[r][c];
|
|
49836
|
+
if (!flowdata || !(cell === null || cell === void 0 ? void 0 : cell.ps)) return;
|
|
49837
|
+
cell.ps.left = left / ctx.zoomRatio;
|
|
49838
|
+
cell.ps.top = top / ctx.zoomRatio;
|
|
49839
|
+
setEditingComment(ctx, flowdata, r, c);
|
|
49840
|
+
if (ctx.hooks.afterUpdateComment) {
|
|
49841
|
+
var _ctx$hooks$afterUpdat6, _ctx$hooks11;
|
|
49842
|
+
(_ctx$hooks$afterUpdat6 = (_ctx$hooks11 = ctx.hooks).afterUpdateComment) === null || _ctx$hooks$afterUpdat6 === void 0 ? void 0 : _ctx$hooks$afterUpdat6.call(_ctx$hooks11, r, c, _objectSpread2({}, cell.ps), true);
|
|
49795
49843
|
}
|
|
49796
49844
|
}
|
|
49797
49845
|
}
|
|
@@ -56506,13 +56554,9 @@ function handleCopy(ctx) {
|
|
|
56506
56554
|
ctx.luckysheet_paste_iscut = false;
|
|
56507
56555
|
}
|
|
56508
56556
|
|
|
56509
|
-
function handleGlobalEnter(ctx, cellInput, e, canvas) {
|
|
56510
|
-
|
|
56511
|
-
|
|
56512
|
-
var last = (_ctx$luckysheet_selec = ctx.luckysheet_select_save) === null || _ctx$luckysheet_selec === void 0 ? void 0 : _ctx$luckysheet_selec[ctx.luckysheet_select_save.length - 1];
|
|
56513
|
-
if (last && !___default['default'].isNil(last.row_focus) && !___default['default'].isNil(last.column_focus)) ;
|
|
56514
|
-
e.preventDefault();
|
|
56515
|
-
} else if (ctx.luckysheetCellUpdate.length > 0) {
|
|
56557
|
+
function handleGlobalEnter(ctx, cellInput, e, canvas, refs) {
|
|
56558
|
+
var _ctx$active_f;
|
|
56559
|
+
function setValue() {
|
|
56516
56560
|
var lastCellUpdate = ___default['default'].clone(ctx.luckysheetCellUpdate);
|
|
56517
56561
|
updateCell(ctx, ctx.luckysheetCellUpdate[0], ctx.luckysheetCellUpdate[1], cellInput, undefined, canvas);
|
|
56518
56562
|
ctx.luckysheet_select_save = [{
|
|
@@ -56523,6 +56567,18 @@ function handleGlobalEnter(ctx, cellInput, e, canvas) {
|
|
|
56523
56567
|
}];
|
|
56524
56568
|
moveHighlightCell(ctx, "down", 1, "rangeOfSelect");
|
|
56525
56569
|
e.preventDefault();
|
|
56570
|
+
}
|
|
56571
|
+
if ((e.altKey || e.metaKey) && ctx.luckysheetCellUpdate.length > 0) {
|
|
56572
|
+
var _ctx$luckysheet_selec;
|
|
56573
|
+
var last = (_ctx$luckysheet_selec = ctx.luckysheet_select_save) === null || _ctx$luckysheet_selec === void 0 ? void 0 : _ctx$luckysheet_selec[ctx.luckysheet_select_save.length - 1];
|
|
56574
|
+
if (last && !___default['default'].isNil(last.row_focus) && !___default['default'].isNil(last.column_focus)) ;
|
|
56575
|
+
e.preventDefault();
|
|
56576
|
+
} else if (ctx.luckysheetCellUpdate.length > 0) {
|
|
56577
|
+
setValue();
|
|
56578
|
+
} else if ((_ctx$active_f = ctx.active_f) === null || _ctx$active_f === void 0 ? void 0 : _ctx$active_f.sheetId) {
|
|
56579
|
+
var _ctx$active_f2;
|
|
56580
|
+
setNextSheet(ctx, (_ctx$active_f2 = ctx.active_f) === null || _ctx$active_f2 === void 0 ? void 0 : _ctx$active_f2.sheetId, refs);
|
|
56581
|
+
setValue();
|
|
56526
56582
|
} else {
|
|
56527
56583
|
var _ctx$luckysheet_selec2, _ctx$luckysheet_selec3;
|
|
56528
56584
|
if (((_ctx$luckysheet_selec2 = (_ctx$luckysheet_selec3 = ctx.luckysheet_select_save) === null || _ctx$luckysheet_selec3 === void 0 ? void 0 : _ctx$luckysheet_selec3.length) !== null && _ctx$luckysheet_selec2 !== void 0 ? _ctx$luckysheet_selec2 : 0) > 0) {
|
|
@@ -56668,7 +56724,7 @@ function handleArrowKey(ctx, e) {
|
|
|
56668
56724
|
break;
|
|
56669
56725
|
}
|
|
56670
56726
|
}
|
|
56671
|
-
function handleGlobalKeyDown(ctx, cellInput, fxInput, e, cache, handleUndo, handleRedo, canvas) {
|
|
56727
|
+
function handleGlobalKeyDown(ctx, cellInput, fxInput, e, cache, handleUndo, handleRedo, canvas, refs) {
|
|
56672
56728
|
ctx.luckysheet_select_status = false;
|
|
56673
56729
|
var kcode = e.keyCode;
|
|
56674
56730
|
var kstr = e.key;
|
|
@@ -56684,7 +56740,7 @@ function handleGlobalKeyDown(ctx, cellInput, fxInput, e, cache, handleUndo, hand
|
|
|
56684
56740
|
}
|
|
56685
56741
|
if (kstr === "Enter") {
|
|
56686
56742
|
if (!allowEdit) return;
|
|
56687
|
-
handleGlobalEnter(ctx, cellInput, e, canvas);
|
|
56743
|
+
handleGlobalEnter(ctx, cellInput, e, canvas, refs);
|
|
56688
56744
|
} else if (kstr === "Tab") {
|
|
56689
56745
|
if (ctx.luckysheetCellUpdate.length > 0) {
|
|
56690
56746
|
return;
|
|
@@ -57573,7 +57629,7 @@ function handleContextMenu(ctx, settings, e, workbookContainer, container, area)
|
|
|
57573
57629
|
}
|
|
57574
57630
|
}
|
|
57575
57631
|
function mouseRender(ctx, globalCache, e, cellInput, scrollX, scrollY, container, fxInput) {
|
|
57576
|
-
var _ctx$rangeDialog;
|
|
57632
|
+
var _ctx$rangeDialog, _ctx$rangeDialog2;
|
|
57577
57633
|
var rect = container.getBoundingClientRect();
|
|
57578
57634
|
if (ctx.luckysheet_scroll_status && !ctx.luckysheet_cols_change_size && !ctx.luckysheet_rows_change_size) {
|
|
57579
57635
|
var left = ctx.scrollLeft;
|
|
@@ -57601,7 +57657,8 @@ function mouseRender(ctx, globalCache, e, cellInput, scrollX, scrollY, container
|
|
|
57601
57657
|
scrollX.scrollLeft = sleft;
|
|
57602
57658
|
}
|
|
57603
57659
|
}
|
|
57604
|
-
|
|
57660
|
+
console.log('ctx.rangeDialog?.singleSelect', (_ctx$rangeDialog = ctx.rangeDialog) === null || _ctx$rangeDialog === void 0 ? void 0 : _ctx$rangeDialog.singleSelect);
|
|
57661
|
+
if ((_ctx$rangeDialog2 = ctx.rangeDialog) === null || _ctx$rangeDialog2 === void 0 ? void 0 : _ctx$rangeDialog2.singleSelect) {
|
|
57605
57662
|
return;
|
|
57606
57663
|
}
|
|
57607
57664
|
if (ctx.luckysheet_select_status) {
|
|
@@ -60592,6 +60649,7 @@ exports.setCellValue = setCellValue;
|
|
|
60592
60649
|
exports.setConditionRules = setConditionRules;
|
|
60593
60650
|
exports.setDropcownValue = setDropcownValue;
|
|
60594
60651
|
exports.setEditingComment = setEditingComment;
|
|
60652
|
+
exports.setNextSheet = setNextSheet;
|
|
60595
60653
|
exports.showComments = showComments;
|
|
60596
60654
|
exports.showDropCellSelection = showDropCellSelection;
|
|
60597
60655
|
exports.showHideAllComments = showHideAllComments;
|