@fileverse-dev/fortune-core 1.2.64-patch-12 → 1.2.65
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/canvas.d.ts +1 -1
- package/es/canvas.js +5 -40
- package/es/context.js +0 -6
- package/es/events/paste.js +118 -27
- package/es/modules/ConditionFormat.js +16 -136
- package/es/modules/cell.js +28 -4
- package/es/modules/text.js +0 -1
- package/es/types.d.ts +0 -6
- package/lib/canvas.d.ts +1 -1
- package/lib/canvas.js +5 -40
- package/lib/context.js +0 -6
- package/lib/events/paste.js +118 -27
- package/lib/modules/ConditionFormat.js +16 -136
- package/lib/modules/cell.js +28 -4
- package/lib/modules/text.js +0 -1
- package/lib/types.d.ts +0 -6
- package/package.json +1 -1
package/es/modules/cell.js
CHANGED
|
@@ -538,7 +538,7 @@ export function cancelNormalSelected(ctx) {
|
|
|
538
538
|
ctx.formulaCache.rangedrag_row_start = false;
|
|
539
539
|
}
|
|
540
540
|
export function updateCell(ctx, r, c, $input, value, canvas) {
|
|
541
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
|
541
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
542
542
|
if (ctx.allowEdit === false || ctx.isFlvReadOnly) return;
|
|
543
543
|
var inputText = $input === null || $input === void 0 ? void 0 : $input.innerText;
|
|
544
544
|
var inputHtml = $input === null || $input === void 0 ? void 0 : $input.innerHTML;
|
|
@@ -546,6 +546,13 @@ export function updateCell(ctx, r, c, $input, value, canvas) {
|
|
|
546
546
|
if (!flowdata) return;
|
|
547
547
|
var index = getSheetIndex(ctx, ctx.currentSheetId);
|
|
548
548
|
var dataVerification = ctx.luckysheetfile[index].dataVerification;
|
|
549
|
+
var sheetFile = ctx.luckysheetfile[index];
|
|
550
|
+
var getUrlFromText = function getUrlFromText(text) {
|
|
551
|
+
var t = (text !== null && text !== void 0 ? text : "").trim();
|
|
552
|
+
if (!t || /[\s\r\n]/.test(t)) return null;
|
|
553
|
+
if (!/^(https?:\/\/|www\.)\S+$/i.test(t)) return null;
|
|
554
|
+
return t.startsWith("http") ? t : "https://".concat(t);
|
|
555
|
+
};
|
|
549
556
|
if (!_.isNil(dataVerification)) {
|
|
550
557
|
var dvItem = dataVerification["".concat(r, "_").concat(c)];
|
|
551
558
|
if (!_.isNil(dvItem) && dvItem.prohibitInput && !validateCellData(ctx, dvItem, inputText)) {
|
|
@@ -803,13 +810,30 @@ export function updateCell(ctx, r, c, $input, value, canvas) {
|
|
|
803
810
|
} catch (e) {
|
|
804
811
|
console.log("[updateCell] spill failed; falling back", e);
|
|
805
812
|
}
|
|
813
|
+
var url = getUrlFromText($input === null || $input === void 0 ? void 0 : $input.innerText);
|
|
814
|
+
if (url && _typeof(value) === "object" && value) {
|
|
815
|
+
value.hl = 1;
|
|
816
|
+
if (!sheetFile.hyperlink) sheetFile.hyperlink = {};
|
|
817
|
+
sheetFile.hyperlink["".concat(r, "_").concat(c)] = {
|
|
818
|
+
linkType: "webpage",
|
|
819
|
+
linkAddress: url
|
|
820
|
+
};
|
|
821
|
+
if (typeof value.v !== "string") {
|
|
822
|
+
value.v = (_r = $input === null || $input === void 0 ? void 0 : $input.innerText) !== null && _r !== void 0 ? _r : url;
|
|
823
|
+
}
|
|
824
|
+
if (value.m == null) {
|
|
825
|
+
value.m = value.v;
|
|
826
|
+
}
|
|
827
|
+
if (value.fc == null) value.fc = "rgb(0, 0, 255)";
|
|
828
|
+
if (value.un == null) value.un = 1;
|
|
829
|
+
}
|
|
806
830
|
setCellValue(ctx, r, c, d, value);
|
|
807
831
|
cancelNormalSelected(ctx);
|
|
808
832
|
if ((curv === null || curv === void 0 ? void 0 : curv.tb) === "2" && curv.v || isInlineStringCell(d[r][c])) {
|
|
809
833
|
var defaultrowlen = ctx.defaultrowlen;
|
|
810
834
|
var cfg = ctx.luckysheetfile[getSheetIndex(ctx, ctx.currentSheetId)].config || {};
|
|
811
|
-
if (!(((
|
|
812
|
-
var cellWidth = ((
|
|
835
|
+
if (!(((_s = cfg.columnlen) === null || _s === void 0 ? void 0 : _s[c]) && ((_t = cfg.rowlen) === null || _t === void 0 ? void 0 : _t[r]))) {
|
|
836
|
+
var cellWidth = ((_u = cfg.columnlen) === null || _u === void 0 ? void 0 : _u[c]) || ctx.defaultcollen;
|
|
813
837
|
var textInfo = canvas ? getCellTextInfo(d[r][c], canvas, ctx, {
|
|
814
838
|
r: r,
|
|
815
839
|
c: c,
|
|
@@ -820,7 +844,7 @@ export function updateCell(ctx, r, c, $input, value, canvas) {
|
|
|
820
844
|
currentRowLen = textInfo.textHeightAll + 2;
|
|
821
845
|
}
|
|
822
846
|
var previousRowHeight = getRowHeight(ctx, [r])[r];
|
|
823
|
-
if (currentRowLen > defaultrowlen && !((
|
|
847
|
+
if (currentRowLen > defaultrowlen && !((_v = cfg.customHeight) === null || _v === void 0 ? void 0 : _v[r]) && previousRowHeight < currentRowLen) {
|
|
824
848
|
if (_.isNil(cfg.rowlen)) cfg.rowlen = {};
|
|
825
849
|
cfg.rowlen[r] = currentRowLen;
|
|
826
850
|
}
|
package/es/modules/text.js
CHANGED
|
@@ -343,7 +343,6 @@ export function getCellTextInfo(cell, renderCtx, sheetCtx, option, ctx) {
|
|
|
343
343
|
fontset = getFontSet(cell, sheetCtx.defaultFontSize, ctx);
|
|
344
344
|
renderCtx.font = fontset;
|
|
345
345
|
cancelLine = normalizedCellAttr(cell, "cl");
|
|
346
|
-
console.log("cancelLine yoooo", cancelLine);
|
|
347
346
|
underLine = normalizedCellAttr(cell, "un");
|
|
348
347
|
fontSize = normalizedCellAttr(cell, "fs");
|
|
349
348
|
if (cell instanceof Object) {
|
package/es/types.d.ts
CHANGED
|
@@ -144,12 +144,6 @@ export type ConditionRulesProps = {
|
|
|
144
144
|
check: boolean;
|
|
145
145
|
color: string;
|
|
146
146
|
};
|
|
147
|
-
font: {
|
|
148
|
-
bold: boolean;
|
|
149
|
-
italic: boolean;
|
|
150
|
-
underline: boolean;
|
|
151
|
-
strikethrough: boolean;
|
|
152
|
-
};
|
|
153
147
|
betweenValue: {
|
|
154
148
|
value1: string;
|
|
155
149
|
value2: string;
|
package/lib/canvas.d.ts
CHANGED
|
@@ -38,7 +38,7 @@ export declare class Canvas {
|
|
|
38
38
|
stc: number | undefined;
|
|
39
39
|
edc: number | undefined;
|
|
40
40
|
};
|
|
41
|
-
cellTextRender(textInfo: any, ctx: CanvasRenderingContext2D, option: any
|
|
41
|
+
cellTextRender(textInfo: any, ctx: CanvasRenderingContext2D, option: any): void;
|
|
42
42
|
drawFreezeLine({ horizontalTop, verticalLeft, }: {
|
|
43
43
|
horizontalTop?: number;
|
|
44
44
|
verticalLeft?: number;
|
package/lib/canvas.js
CHANGED
|
@@ -15,16 +15,6 @@ var _border = require("./modules/border");
|
|
|
15
15
|
var _modules = require("./modules");
|
|
16
16
|
var _animate = require("./animate");
|
|
17
17
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
18
|
-
var __assign = void 0 && (void 0).__assign || function () {
|
|
19
|
-
__assign = Object.assign || function (t) {
|
|
20
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
21
|
-
s = arguments[i];
|
|
22
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
23
|
-
}
|
|
24
|
-
return t;
|
|
25
|
-
};
|
|
26
|
-
return __assign.apply(this, arguments);
|
|
27
|
-
};
|
|
28
18
|
var defaultStyle = exports.defaultStyle = {
|
|
29
19
|
fillStyle: "#000000",
|
|
30
20
|
textBaseline: "middle",
|
|
@@ -900,7 +890,6 @@ var Canvas = exports.Canvas = function () {
|
|
|
900
890
|
}, renderCtx)) === false) {
|
|
901
891
|
return;
|
|
902
892
|
}
|
|
903
|
-
console.log("cellsize", fillStyle);
|
|
904
893
|
renderCtx.fillRect(cellsize[0], cellsize[1], cellsize[2], cellsize[3]);
|
|
905
894
|
var index = (0, _utils.getSheetIndex)(this.sheetCtx, this.sheetCtx.currentSheetId);
|
|
906
895
|
var dataVerification = this.sheetCtx.luckysheetfile[index].dataVerification;
|
|
@@ -1154,27 +1143,6 @@ var Canvas = exports.Canvas = function () {
|
|
|
1154
1143
|
renderCtx.rect(pos_x, pos_y, cellWidth, cellHeight);
|
|
1155
1144
|
renderCtx.clip();
|
|
1156
1145
|
renderCtx.scale(this.sheetCtx.zoomRatio, this.sheetCtx.zoomRatio);
|
|
1157
|
-
console.log("pos_x, pos_y, cellWidth, cellHeight", cell);
|
|
1158
|
-
if (checksCF === null || checksCF === void 0 ? void 0 : checksCF.strikethrough) {
|
|
1159
|
-
cell = __assign(__assign({}, cell), {
|
|
1160
|
-
cl: 1
|
|
1161
|
-
});
|
|
1162
|
-
}
|
|
1163
|
-
if (checksCF === null || checksCF === void 0 ? void 0 : checksCF.italic) {
|
|
1164
|
-
cell = __assign(__assign({}, cell), {
|
|
1165
|
-
it: 1
|
|
1166
|
-
});
|
|
1167
|
-
}
|
|
1168
|
-
if (checksCF === null || checksCF === void 0 ? void 0 : checksCF.underline) {
|
|
1169
|
-
cell = __assign(__assign({}, cell), {
|
|
1170
|
-
un: 1
|
|
1171
|
-
});
|
|
1172
|
-
}
|
|
1173
|
-
if (checksCF === null || checksCF === void 0 ? void 0 : checksCF.bold) {
|
|
1174
|
-
cell = __assign(__assign({}, cell), {
|
|
1175
|
-
bl: 1
|
|
1176
|
-
});
|
|
1177
|
-
}
|
|
1178
1146
|
var textInfo = cell ? (0, _text.getCellTextInfo)(cell, renderCtx, this.sheetCtx, {
|
|
1179
1147
|
cellWidth: cellWidth,
|
|
1180
1148
|
cellHeight: cellHeight,
|
|
@@ -1217,15 +1185,14 @@ var Canvas = exports.Canvas = function () {
|
|
|
1217
1185
|
this.cellTextRender(textInfo, renderCtx, {
|
|
1218
1186
|
pos_x: pos_x,
|
|
1219
1187
|
pos_y: pos_y
|
|
1220
|
-
}
|
|
1188
|
+
});
|
|
1221
1189
|
}
|
|
1222
1190
|
renderCtx.restore();
|
|
1223
1191
|
} else if (!isDataVlidationAvailable) {
|
|
1224
|
-
console.log('checksCF', checksCF);
|
|
1225
1192
|
this.cellTextRender(textInfo, renderCtx, {
|
|
1226
1193
|
pos_x: pos_x,
|
|
1227
1194
|
pos_y: pos_y
|
|
1228
|
-
}
|
|
1195
|
+
});
|
|
1229
1196
|
}
|
|
1230
1197
|
renderCtx.restore();
|
|
1231
1198
|
}
|
|
@@ -1341,13 +1308,13 @@ var Canvas = exports.Canvas = function () {
|
|
|
1341
1308
|
this.cellTextRender(textInfo, renderCtx, {
|
|
1342
1309
|
pos_x: pos_x,
|
|
1343
1310
|
pos_y: pos_y
|
|
1344
|
-
}
|
|
1311
|
+
});
|
|
1345
1312
|
renderCtx.restore();
|
|
1346
1313
|
} else {
|
|
1347
1314
|
this.cellTextRender(textInfo, renderCtx, {
|
|
1348
1315
|
pos_x: pos_x,
|
|
1349
1316
|
pos_y: pos_y
|
|
1350
|
-
}
|
|
1317
|
+
});
|
|
1351
1318
|
}
|
|
1352
1319
|
renderCtx.restore();
|
|
1353
1320
|
};
|
|
@@ -1461,8 +1428,7 @@ var Canvas = exports.Canvas = function () {
|
|
|
1461
1428
|
edc: edc
|
|
1462
1429
|
};
|
|
1463
1430
|
};
|
|
1464
|
-
Canvas.prototype.cellTextRender = function (textInfo, ctx, option
|
|
1465
|
-
console.log("textInfo===hahahahha", textInfo, checkCF);
|
|
1431
|
+
Canvas.prototype.cellTextRender = function (textInfo, ctx, option) {
|
|
1466
1432
|
if (!textInfo) {
|
|
1467
1433
|
return;
|
|
1468
1434
|
}
|
|
@@ -1489,7 +1455,6 @@ var Canvas = exports.Canvas = function () {
|
|
|
1489
1455
|
var txt = _lodash.default.isPlainObject(word.content) ? word.content.m : word.content;
|
|
1490
1456
|
ctx.fillText(txt, (pos_x + word.left) / this.sheetCtx.zoomRatio, (pos_y + word.top) / this.sheetCtx.zoomRatio);
|
|
1491
1457
|
if (word.cancelLine) {
|
|
1492
|
-
console.log("word.cancelLine", word.cancelLine, word);
|
|
1493
1458
|
var c = word.cancelLine;
|
|
1494
1459
|
ctx.beginPath();
|
|
1495
1460
|
ctx.moveTo(Math.floor((pos_x + c.startX) / this.sheetCtx.zoomRatio) + 0.5, Math.floor((pos_y + c.startY) / this.sheetCtx.zoomRatio) + 0.5);
|
package/lib/context.js
CHANGED
package/lib/events/paste.js
CHANGED
|
@@ -367,12 +367,21 @@ function pasteHandler(ctx, data, borderInfo) {
|
|
|
367
367
|
(0, _sheet.expandRowsAndColumns)(d, addr, addc);
|
|
368
368
|
}
|
|
369
369
|
if (!d) return;
|
|
370
|
+
var getUrlFromText = function getUrlFromText(text) {
|
|
371
|
+
var t = String(text).trim();
|
|
372
|
+
if (!t || /[\s\r\n]/.test(t)) return null;
|
|
373
|
+
if (!/^(https?:\/\/|www\.)\S+$/i.test(t)) return null;
|
|
374
|
+
return t.startsWith("http") ? t : "https://".concat(t);
|
|
375
|
+
};
|
|
370
376
|
for (var r = 0; r < rlen; r += 1) {
|
|
371
377
|
var x = d[r + curR];
|
|
372
378
|
for (var c = 0; c < clen; c += 1) {
|
|
373
379
|
var originCell = x[c + curC];
|
|
374
380
|
var value = dataChe[r][c];
|
|
375
|
-
|
|
381
|
+
var originalValueStr = String(value);
|
|
382
|
+
var url = getUrlFromText(originalValueStr);
|
|
383
|
+
var isUrl = url !== null;
|
|
384
|
+
if (!isUrl && (0, _validation.isRealNum)(value)) {
|
|
376
385
|
if (originCell && originCell.ct && originCell.ct.fa === "@") {
|
|
377
386
|
value = String(value);
|
|
378
387
|
} else if (!/^0x?[a-fA-F0-9]+$/.test(value)) {
|
|
@@ -380,26 +389,59 @@ function pasteHandler(ctx, data, borderInfo) {
|
|
|
380
389
|
}
|
|
381
390
|
}
|
|
382
391
|
if (originCell) {
|
|
383
|
-
originCell.v = value;
|
|
392
|
+
originCell.v = isUrl ? originalValueStr : value;
|
|
384
393
|
if (originCell.ct != null && originCell.ct.fa != null) {
|
|
385
|
-
originCell.m = (0, _format.update)(originCell.ct.fa,
|
|
394
|
+
originCell.m = (0, _format.update)(originCell.ct.fa, originCell.v);
|
|
386
395
|
} else {
|
|
387
|
-
originCell.m =
|
|
396
|
+
originCell.m = typeof originCell.v === "boolean" ? String(originCell.v) : originCell.v;
|
|
388
397
|
}
|
|
389
398
|
if (originCell.f != null && originCell.f.length > 0) {
|
|
390
399
|
originCell.f = "";
|
|
391
400
|
}
|
|
401
|
+
if (isUrl && url) {
|
|
402
|
+
var targetRow = r + curR;
|
|
403
|
+
var targetCol = c + curC;
|
|
404
|
+
(0, _modules.saveHyperlink)(ctx, targetRow, targetCol, url, "webpage", originalValueStr);
|
|
405
|
+
originCell.hl = {
|
|
406
|
+
r: targetRow,
|
|
407
|
+
c: targetCol,
|
|
408
|
+
id: ctx.currentSheetId
|
|
409
|
+
};
|
|
410
|
+
originCell.fc = originCell.fc || "rgb(0, 0, 255)";
|
|
411
|
+
originCell.un = originCell.un !== undefined ? originCell.un : 1;
|
|
412
|
+
}
|
|
392
413
|
} else {
|
|
393
414
|
var cell = {};
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
cell.m = value;
|
|
415
|
+
if (isUrl) {
|
|
416
|
+
cell.v = originalValueStr;
|
|
417
|
+
cell.m = originalValueStr;
|
|
398
418
|
cell.ct = {
|
|
399
419
|
fa: "@",
|
|
400
420
|
t: "s"
|
|
401
421
|
};
|
|
402
|
-
|
|
422
|
+
} else {
|
|
423
|
+
var mask = (0, _format.genarate)(value);
|
|
424
|
+
_a = mask, cell.m = _a[0], cell.ct = _a[1], cell.v = _a[2];
|
|
425
|
+
if (/^0x?[a-fA-F0-9]+$/.test(value)) {
|
|
426
|
+
cell.m = value;
|
|
427
|
+
cell.ct = {
|
|
428
|
+
fa: "@",
|
|
429
|
+
t: "s"
|
|
430
|
+
};
|
|
431
|
+
cell.v = value;
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
if (isUrl && url) {
|
|
435
|
+
var targetRow = r + curR;
|
|
436
|
+
var targetCol = c + curC;
|
|
437
|
+
(0, _modules.saveHyperlink)(ctx, targetRow, targetCol, url, "webpage", originalValueStr);
|
|
438
|
+
cell.hl = {
|
|
439
|
+
r: targetRow,
|
|
440
|
+
c: targetCol,
|
|
441
|
+
id: ctx.currentSheetId
|
|
442
|
+
};
|
|
443
|
+
cell.fc = cell.fc || "rgb(0, 0, 255)";
|
|
444
|
+
cell.un = cell.un !== undefined ? cell.un : 1;
|
|
403
445
|
}
|
|
404
446
|
x[c + curC] = cell;
|
|
405
447
|
}
|
|
@@ -799,7 +841,7 @@ function pasteHandlerOfCutPaste(ctx, copyRange) {
|
|
|
799
841
|
}
|
|
800
842
|
}
|
|
801
843
|
function pasteHandlerOfCopyPaste(ctx, copyRange) {
|
|
802
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
844
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
803
845
|
var allowEdit = (0, _utils.isAllowEdit)(ctx);
|
|
804
846
|
if (!allowEdit || ctx.isFlvReadOnly) return;
|
|
805
847
|
if (!copyRange) return;
|
|
@@ -1098,21 +1140,64 @@ function pasteHandlerOfCopyPaste(ctx, copyRange) {
|
|
|
1098
1140
|
file.luckysheet_conditionformat_save = cdformat;
|
|
1099
1141
|
file.dataVerification = __assign(__assign({}, file.dataVerification), dataVerification);
|
|
1100
1142
|
if (((_l = ctx.luckysheet_select_save) === null || _l === void 0 ? void 0 : _l.length) === 1 && ((_m = ctx.luckysheet_copy_save) === null || _m === void 0 ? void 0 : _m.copyRange.length) === 1) {
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1143
|
+
var srcIndex = (0, _utils.getSheetIndex)(ctx, (_o = ctx.luckysheet_copy_save) === null || _o === void 0 ? void 0 : _o.dataSheetId);
|
|
1144
|
+
var targetSheetIndex = (0, _utils.getSheetIndex)(ctx, ctx.currentSheetId);
|
|
1145
|
+
var srcHyperlinks = ctx.luckysheetfile[srcIndex].hyperlink;
|
|
1146
|
+
var srcData = ctx.luckysheetfile[srcIndex].data;
|
|
1147
|
+
if (!ctx.luckysheetfile[targetSheetIndex].hyperlink) {
|
|
1148
|
+
ctx.luckysheetfile[targetSheetIndex].hyperlink = {};
|
|
1149
|
+
}
|
|
1150
|
+
var targetHyperlinks = ctx.luckysheetfile[targetSheetIndex].hyperlink;
|
|
1151
|
+
var isSingleCell = copyh === 1 && copyc === 1;
|
|
1152
|
+
var cachedSrcLinkKey = isSingleCell ? "".concat(c_r1, "_").concat(c_c1) : null;
|
|
1153
|
+
var cachedSrcLink = isSingleCell && srcHyperlinks ? srcHyperlinks[cachedSrcLinkKey] : null;
|
|
1154
|
+
var cachedSrcCell = isSingleCell && srcData ? (_p = srcData[c_r1]) === null || _p === void 0 ? void 0 : _p[c_c1] : null;
|
|
1155
|
+
for (var th = 1; th <= timesH; th += 1) {
|
|
1156
|
+
for (var tc = 1; tc <= timesC; tc += 1) {
|
|
1157
|
+
var linkMth = minh + (th - 1) * copyh;
|
|
1158
|
+
var linkMtc = minc + (tc - 1) * copyc;
|
|
1159
|
+
var linkMaxRow = minh + th * copyh;
|
|
1160
|
+
var linkMaxCol = minc + tc * copyc;
|
|
1161
|
+
for (var h = linkMth; h < linkMaxRow; h += 1) {
|
|
1162
|
+
for (var c = linkMtc; c < linkMaxCol; c += 1) {
|
|
1163
|
+
var srcLink = void 0;
|
|
1164
|
+
if (isSingleCell && cachedSrcLink) {
|
|
1165
|
+
srcLink = cachedSrcLink;
|
|
1166
|
+
} else {
|
|
1167
|
+
var srcRow = c_r1 + (h - linkMth);
|
|
1168
|
+
var srcCol = c_c1 + (c - linkMtc);
|
|
1169
|
+
srcLink = srcHyperlinks === null || srcHyperlinks === void 0 ? void 0 : srcHyperlinks["".concat(srcRow, "_").concat(srcCol)];
|
|
1170
|
+
}
|
|
1171
|
+
if (!srcLink) continue;
|
|
1172
|
+
var targetKey = "".concat(h, "_").concat(c);
|
|
1173
|
+
targetHyperlinks[targetKey] = srcLink;
|
|
1174
|
+
var cell = (_q = d[h]) === null || _q === void 0 ? void 0 : _q[c];
|
|
1175
|
+
if (cell) {
|
|
1176
|
+
var srcCell = void 0;
|
|
1177
|
+
if (isSingleCell && cachedSrcCell) {
|
|
1178
|
+
srcCell = cachedSrcCell;
|
|
1179
|
+
} else {
|
|
1180
|
+
var srcRow = c_r1 + (h - linkMth);
|
|
1181
|
+
var srcCol = c_c1 + (c - linkMtc);
|
|
1182
|
+
srcCell = (_r = srcData === null || srcData === void 0 ? void 0 : srcData[srcRow]) === null || _r === void 0 ? void 0 : _r[srcCol];
|
|
1183
|
+
}
|
|
1184
|
+
cell.hl = {
|
|
1185
|
+
r: h,
|
|
1186
|
+
c: c,
|
|
1187
|
+
id: ctx.currentSheetId
|
|
1188
|
+
};
|
|
1189
|
+
if (srcCell) {
|
|
1190
|
+
if (srcCell.fc) cell.fc = srcCell.fc;
|
|
1191
|
+
if (srcCell.un !== undefined) cell.un = srcCell.un;
|
|
1192
|
+
} else {
|
|
1193
|
+
cell.fc = cell.fc || "rgb(0, 0, 255)";
|
|
1194
|
+
cell.un = cell.un !== undefined ? cell.un : 1;
|
|
1195
|
+
}
|
|
1196
|
+
}
|
|
1197
|
+
}
|
|
1113
1198
|
}
|
|
1114
1199
|
}
|
|
1115
|
-
}
|
|
1200
|
+
}
|
|
1116
1201
|
}
|
|
1117
1202
|
if (copyRowlChange || addr > 0 || addc > 0) {
|
|
1118
1203
|
(0, _refresh.jfrefreshgrid)(ctx, d, ctx.luckysheet_select_save);
|
|
@@ -1149,11 +1234,17 @@ function parseAsLinkIfUrl(txtdata, ctx) {
|
|
|
1149
1234
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
1150
1235
|
var urlRegex = /^(https?:\/\/[^\s]+)/;
|
|
1151
1236
|
if (urlRegex.test(txtdata)) {
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
var
|
|
1155
|
-
var colIndex = (_g = (_e = last.column_focus) !== null && _e !== void 0 ? _e : (_f = last.column) === null || _f === void 0 ? void 0 : _f[0]) !== null && _g !== void 0 ? _g : 0;
|
|
1237
|
+
if (ctx.luckysheetCellUpdate.length === 2) {
|
|
1238
|
+
var rowIndex = ctx.luckysheetCellUpdate[0];
|
|
1239
|
+
var colIndex = ctx.luckysheetCellUpdate[1];
|
|
1156
1240
|
(0, _modules.saveHyperlink)(ctx, rowIndex, colIndex, txtdata, "webpage", txtdata);
|
|
1241
|
+
} else {
|
|
1242
|
+
var last = (_a = ctx.luckysheet_select_save) === null || _a === void 0 ? void 0 : _a[ctx.luckysheet_select_save.length - 1];
|
|
1243
|
+
if (last) {
|
|
1244
|
+
var rowIndex = (_d = (_b = last.row_focus) !== null && _b !== void 0 ? _b : (_c = last.row) === null || _c === void 0 ? void 0 : _c[0]) !== null && _d !== void 0 ? _d : 0;
|
|
1245
|
+
var colIndex = (_g = (_e = last.column_focus) !== null && _e !== void 0 ? _e : (_f = last.column) === null || _f === void 0 ? void 0 : _f[0]) !== null && _g !== void 0 ? _g : 0;
|
|
1246
|
+
(0, _modules.saveHyperlink)(ctx, rowIndex, colIndex, txtdata, "webpage", txtdata);
|
|
1247
|
+
}
|
|
1157
1248
|
}
|
|
1158
1249
|
}
|
|
1159
1250
|
}
|