@fileverse-dev/fortune-core 1.1.53-patch-1 → 1.1.54-patch-2

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.
@@ -7,8 +7,8 @@ exports.handlePaste = handlePaste;
7
7
  exports.handlePasteByClick = handlePasteByClick;
8
8
  exports.parseAsLinkIfUrl = parseAsLinkIfUrl;
9
9
  var _lodash = _interopRequireDefault(require("lodash"));
10
- var _pasteTableHelpers = require("../paste-table-helpers");
11
10
  var _context = require("../context");
11
+ var _locale = require("../locale");
12
12
  var _formula = require("../modules/formula");
13
13
  var _cell = require("../modules/cell");
14
14
  var _format = require("../modules/format");
@@ -18,6 +18,7 @@ var _validation = require("../modules/validation");
18
18
  var _border = require("../modules/border");
19
19
  var _sheet = require("../modules/sheet");
20
20
  var _refresh = require("../modules/refresh");
21
+ var _api = require("../api");
21
22
  var _modules = require("../modules");
22
23
  var _clipboard = _interopRequireDefault(require("../modules/clipboard"));
23
24
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
@@ -1018,75 +1019,9 @@ function parseAsLinkIfUrl(txtdata, ctx) {
1018
1019
  }
1019
1020
  }
1020
1021
  }
1021
- function autoFitUsingGetCellTextInfo(ctx, sheetId, r1, r2, c1, c2, maxColWidth) {
1022
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
1023
- var _k, _l;
1024
- if (maxColWidth === void 0) {
1025
- maxColWidth = 1200;
1026
- }
1027
- var sheetIdx = (0, _utils.getSheetIndex)(ctx, sheetId);
1028
- if (sheetIdx == null) return;
1029
- var file = ctx.luckysheetfile[sheetIdx];
1030
- file.config || (file.config = {});
1031
- var rowlen = (_k = file.config).rowlen || (_k.rowlen = {});
1032
- var columnlen = (_l = file.config).columnlen || (_l.columnlen = {});
1033
- var defaultRowH = (_a = file.defaultRowHeight) !== null && _a !== void 0 ? _a : 19;
1034
- var defaultColW = (_b = ctx.defaultcollen) !== null && _b !== void 0 ? _b : 73;
1035
- var d = (0, _context.getFlowdata)(ctx) || file.data;
1036
- var measureCtx = ctx.__offscreenMeasureCtx || document.createElement("canvas").getContext("2d");
1037
- ctx.__offscreenMeasureCtx = measureCtx;
1038
- var H_PAD = 8;
1039
- for (var c = c1; c <= c2; c++) {
1040
- var curW = (_c = columnlen[c]) !== null && _c !== void 0 ? _c : defaultColW;
1041
- var wantW = curW;
1042
- for (var r = r1; r <= r2; r++) {
1043
- var cell = (_d = d === null || d === void 0 ? void 0 : d[r]) === null || _d === void 0 ? void 0 : _d[c];
1044
- if ((cell === null || cell === void 0 ? void 0 : cell.mc) && cell.mc.rs == null) continue;
1045
- var tb = cell === null || cell === void 0 ? void 0 : cell.tb;
1046
- if (tb === 2 || tb === "2") continue;
1047
- var info = (0, _modules.getCellTextInfo)(cell, measureCtx, ctx, {
1048
- r: r,
1049
- c: c
1050
- }, ctx);
1051
- var w = (_e = info === null || info === void 0 ? void 0 : info.textWidthAll) !== null && _e !== void 0 ? _e : 0;
1052
- if (w + H_PAD > wantW) wantW = w + H_PAD;
1053
- }
1054
- if (wantW > curW) {
1055
- columnlen[c] = Math.min(Math.ceil(wantW), maxColWidth);
1056
- }
1057
- }
1058
- var V_PAD = 4;
1059
- for (var r = r1; r <= r2; r++) {
1060
- var curH = (_f = rowlen[r]) !== null && _f !== void 0 ? _f : defaultRowH;
1061
- var needH = curH;
1062
- for (var c = c1; c <= c2; c++) {
1063
- var cell = (_g = d === null || d === void 0 ? void 0 : d[r]) === null || _g === void 0 ? void 0 : _g[c];
1064
- if ((cell === null || cell === void 0 ? void 0 : cell.mc) && cell.mc.rs == null) continue;
1065
- var widthForCell = (_h = columnlen[c]) !== null && _h !== void 0 ? _h : defaultColW;
1066
- var info = (0, _modules.getCellTextInfo)(cell, measureCtx, ctx, {
1067
- r: r,
1068
- c: c,
1069
- cellWidth: widthForCell,
1070
- cellHeight: curH
1071
- }, ctx);
1072
- var h = (_j = info === null || info === void 0 ? void 0 : info.textHeightAll) !== null && _j !== void 0 ? _j : 0;
1073
- if (h + V_PAD > needH) needH = Math.ceil(h + V_PAD);
1074
- }
1075
- if (needH > curH) {
1076
- rowlen[r] = needH;
1077
- }
1078
- }
1079
- if (typeof window.jfrefreshgrid === "function") {
1080
- window.jfrefreshgrid(ctx, null, [{
1081
- row: [r1, r2],
1082
- column: [c1, c2]
1083
- }], true, undefined, "resize");
1084
- }
1085
- }
1086
1022
  function handlePaste(ctx, e) {
1087
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
1023
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
1088
1024
  var allowEdit = (0, _utils.isAllowEdit)(ctx);
1089
- console.log("handlePaste -> allowEdit", "jjjj");
1090
1025
  if (!allowEdit) return;
1091
1026
  if (_selection.selectionCache.isPasteAction) {
1092
1027
  ctx.luckysheetCellUpdate = [];
@@ -1170,6 +1105,7 @@ function handlePaste(ctx, e) {
1170
1105
  }
1171
1106
  }
1172
1107
  }
1108
+ var locale_fontjson_1 = (0, _locale.locale)(ctx).fontjson;
1173
1109
  if (((_o = (_m = ctx.hooks).beforePaste) === null || _o === void 0 ? void 0 : _o.call(_m, ctx.luckysheet_select_save, txtdata)) === false) {
1174
1110
  return;
1175
1111
  }
@@ -1181,35 +1117,256 @@ function handlePaste(ctx, e) {
1181
1117
  } else {
1182
1118
  pasteHandlerOfCopyPaste(ctx, ctx.luckysheet_copy_save);
1183
1119
  }
1184
- var last = (_q = ctx.luckysheet_select_save) === null || _q === void 0 ? void 0 : _q[ctx.luckysheet_select_save.length - 1];
1185
- if (last) {
1186
- autoFitUsingGetCellTextInfo(ctx, ctx.currentSheetId, last.row[0], last.row[1], last.column[0], last.column[1]);
1187
- }
1188
1120
  } else if (txtdata.indexOf("fortune-copy-action-image") > -1) {} else {
1189
1121
  if (txtdata.indexOf("table") > -1) {
1190
- (0, _pasteTableHelpers.pasteHtmlTableAndAutoFit)(ctx, txtdata, pasteHandler);
1122
+ var ele = document.createElement("div");
1123
+ ele.innerHTML = txtdata;
1124
+ var trList = ele.querySelectorAll("table tr");
1125
+ if (trList.length === 0) {
1126
+ ele.remove();
1127
+ return;
1128
+ }
1129
+ var data_1 = new Array(trList.length);
1130
+ var colLen_1 = 0;
1131
+ _lodash.default.forEach(trList[0].querySelectorAll("td, th"), function (td) {
1132
+ var colspan = td.colSpan;
1133
+ if (Number.isNaN(colspan)) {
1134
+ colspan = 1;
1135
+ }
1136
+ colLen_1 += colspan;
1137
+ });
1138
+ for (var i = 0; i < data_1.length; i += 1) {
1139
+ data_1[i] = new Array(colLen_1);
1140
+ }
1141
+ var r_1 = 0;
1142
+ var borderInfo_1 = {};
1143
+ var styleInner = ((_q = ele.querySelectorAll("style")[0]) === null || _q === void 0 ? void 0 : _q.innerHTML) || "";
1144
+ var patternReg = /{([^}]*)}/g;
1145
+ var patternStyle = styleInner.match(patternReg);
1146
+ var nameReg = /^[^\t].*/gm;
1147
+ var patternName = _lodash.default.initial(styleInner.match(nameReg));
1148
+ var allStyleList_1 = patternName.length === (patternStyle === null || patternStyle === void 0 ? void 0 : patternStyle.length) && _typeof(patternName) === _typeof(patternStyle) ? _lodash.default.fromPairs(_lodash.default.zip(patternName, patternStyle)) : {};
1149
+ var index_1 = (0, _utils.getSheetIndex)(ctx, ctx.currentSheetId);
1150
+ if (!_lodash.default.isNil(index_1)) {
1151
+ if (_lodash.default.isNil(ctx.luckysheetfile[index_1].config)) {
1152
+ ctx.luckysheetfile[index_1].config = {};
1153
+ }
1154
+ if (_lodash.default.isNil(ctx.luckysheetfile[index_1].config.rowlen)) {
1155
+ ctx.luckysheetfile[index_1].config.rowlen = {};
1156
+ }
1157
+ var rowHeightList_1 = ctx.luckysheetfile[index_1].config.rowlen;
1158
+ _lodash.default.forEach(trList, function (tr) {
1159
+ var c = 0;
1160
+ var targetR = ctx.luckysheet_select_save[0].row[0] + r_1;
1161
+ var targetRowHeight = !_lodash.default.isNil(tr.getAttribute("height")) ? parseInt(tr.getAttribute("height"), 10) : null;
1162
+ if (_lodash.default.has(ctx.luckysheetfile[index_1].config.rowlen, targetR) && ctx.luckysheetfile[index_1].config.rowlen[targetR] !== targetRowHeight || !_lodash.default.has(ctx.luckysheetfile[index_1].config.rowlen, targetR) && ctx.luckysheetfile[index_1].defaultRowHeight !== targetRowHeight) {
1163
+ rowHeightList_1[targetR] = targetRowHeight;
1164
+ }
1165
+ _lodash.default.forEach(tr.querySelectorAll("td, th"), function (element) {
1166
+ var td = element;
1167
+ var className = td.className;
1168
+ var cell = {};
1169
+ var txt = td.innerText || td.innerHTML;
1170
+ if (_lodash.default.trim(txt).length === 0) {
1171
+ cell.v = undefined;
1172
+ cell.m = "";
1173
+ } else {
1174
+ var mask = (0, _format.genarate)(txt);
1175
+ cell.m = mask[0], cell.ct = mask[1], cell.v = mask[2];
1176
+ if (/^0x?[a-fA-F0-9]+$/.test(txt)) {
1177
+ cell.ct = {
1178
+ fa: "@",
1179
+ t: "s"
1180
+ };
1181
+ cell.m = txt;
1182
+ cell.v = txt;
1183
+ }
1184
+ }
1185
+ var styleString = typeof allStyleList_1[".".concat(className)] === "string" ? allStyleList_1[".".concat(className)].substring(1, allStyleList_1[".".concat(className)].length - 1).split("\n\t") : [];
1186
+ var styles = {};
1187
+ _lodash.default.forEach(styleString, function (s) {
1188
+ var styleList = s.split(":");
1189
+ styles[styleList[0]] = styleList === null || styleList === void 0 ? void 0 : styleList[1].replace(";", "");
1190
+ });
1191
+ if (!_lodash.default.isNil(styles.border)) td.style.border = styles.border;
1192
+ var bg = td.style.backgroundColor || styles.background;
1193
+ if (bg === "rgba(0, 0, 0, 0)" || _lodash.default.isEmpty(bg)) {
1194
+ bg = undefined;
1195
+ }
1196
+ cell.bg = bg;
1197
+ var fontWight = td.style.fontWeight;
1198
+ cell.bl = (fontWight.toString() === "400" || fontWight === "normal" || _lodash.default.isEmpty(fontWight)) && !_lodash.default.includes(styles["font-style"], "bold") && (!styles["font-weight"] || styles["font-weight"] === "400") ? 0 : 1;
1199
+ cell.it = (td.style.fontStyle === "normal" || _lodash.default.isEmpty(td.style.fontStyle)) && !_lodash.default.includes(styles["font-style"], "italic") ? 0 : 1;
1200
+ cell.un = !_lodash.default.includes(styles["text-decoration"], "underline") ? undefined : 1;
1201
+ cell.cl = !_lodash.default.includes(td.innerHTML, "<s>") ? undefined : 1;
1202
+ var ff = td.style.fontFamily || styles["font-family"] || "";
1203
+ var ffs = ff.split(",");
1204
+ for (var i = 0; i < ffs.length; i += 1) {
1205
+ var fa = _lodash.default.trim(ffs[i].toLowerCase());
1206
+ fa = locale_fontjson_1[fa];
1207
+ if (_lodash.default.isNil(fa)) {
1208
+ cell.ff = 0;
1209
+ } else {
1210
+ cell.ff = fa;
1211
+ break;
1212
+ }
1213
+ }
1214
+ var fs = Math.round(styles["font-size"] ? parseInt(styles["font-size"].replace("pt", ""), 10) : parseInt(td.style.fontSize || "13", 10) * 72 / 96);
1215
+ cell.fs = fs;
1216
+ cell.fc = td.style.color || styles.color;
1217
+ var ht = td.style.textAlign || styles["text-align"] || "left";
1218
+ if (ht === "center") {
1219
+ cell.ht = 0;
1220
+ } else if (ht === "right") {
1221
+ cell.ht = 2;
1222
+ } else {
1223
+ cell.ht = 1;
1224
+ }
1225
+ var regex = /vertical-align:\s*(.*?);/;
1226
+ var vt = td.style.verticalAlign || styles["vertical-align"] || !_lodash.default.isNil(allStyleList_1.td) && allStyleList_1.td.match(regex).length > 0 && allStyleList_1.td.match(regex)[1] || "top";
1227
+ if (vt === "middle") {
1228
+ cell.vt = 0;
1229
+ } else if (vt === "top" || vt === "text-top") {
1230
+ cell.vt = 1;
1231
+ } else {
1232
+ cell.vt = 2;
1233
+ }
1234
+ if ("mso-rotate" in styles) {
1235
+ var rt = styles["mso-rotate"];
1236
+ cell.rt = parseFloat(rt);
1237
+ }
1238
+ while (c < colLen_1 && !_lodash.default.isNil(data_1[r_1][c])) {
1239
+ c += 1;
1240
+ }
1241
+ if (c === colLen_1) {
1242
+ return true;
1243
+ }
1244
+ if (_lodash.default.isNil(data_1[r_1][c])) {
1245
+ data_1[r_1][c] = cell;
1246
+ var rowspan = parseInt(td.getAttribute("rowspan"), 10);
1247
+ var colspan = parseInt(td.getAttribute("colspan"), 10);
1248
+ if (Number.isNaN(rowspan)) {
1249
+ rowspan = 1;
1250
+ }
1251
+ if (Number.isNaN(colspan)) {
1252
+ colspan = 1;
1253
+ }
1254
+ var r_ab = ctx.luckysheet_select_save[0].row[0] + r_1;
1255
+ var c_ab = ctx.luckysheet_select_save[0].column[0] + c;
1256
+ for (var rp = 0; rp < rowspan; rp += 1) {
1257
+ for (var cp = 0; cp < colspan; cp += 1) {
1258
+ if (rp === 0) {
1259
+ var bt = td.style.borderTop;
1260
+ if (!_lodash.default.isEmpty(bt) && bt.substring(0, 3).toLowerCase() !== "0px") {
1261
+ var width = td.style.borderTopWidth;
1262
+ var type = td.style.borderTopStyle;
1263
+ var color = td.style.borderTopColor;
1264
+ var borderconfig = (0, _cell.getQKBorder)(width, type, color);
1265
+ if (!borderInfo_1["".concat(r_1 + rp, "_").concat(c + cp)]) {
1266
+ borderInfo_1["".concat(r_1 + rp, "_").concat(c + cp)] = {};
1267
+ }
1268
+ borderInfo_1["".concat(r_1 + rp, "_").concat(c + cp)].t = {
1269
+ style: borderconfig[0],
1270
+ color: borderconfig[1]
1271
+ };
1272
+ }
1273
+ }
1274
+ if (rp === rowspan - 1) {
1275
+ var bb = td.style.borderBottom;
1276
+ if (!_lodash.default.isEmpty(bb) && bb.substring(0, 3).toLowerCase() !== "0px") {
1277
+ var width = td.style.borderBottomWidth;
1278
+ var type = td.style.borderBottomStyle;
1279
+ var color = td.style.borderBottomColor;
1280
+ var borderconfig = (0, _cell.getQKBorder)(width, type, color);
1281
+ if (!borderInfo_1["".concat(r_1 + rp, "_").concat(c + cp)]) {
1282
+ borderInfo_1["".concat(r_1 + rp, "_").concat(c + cp)] = {};
1283
+ }
1284
+ borderInfo_1["".concat(r_1 + rp, "_").concat(c + cp)].b = {
1285
+ style: borderconfig[0],
1286
+ color: borderconfig[1]
1287
+ };
1288
+ }
1289
+ }
1290
+ if (cp === 0) {
1291
+ var bl = td.style.borderLeft;
1292
+ if (!_lodash.default.isEmpty(bl) && bl.substring(0, 3).toLowerCase() !== "0px") {
1293
+ var width = td.style.borderLeftWidth;
1294
+ var type = td.style.borderLeftStyle;
1295
+ var color = td.style.borderLeftColor;
1296
+ var borderconfig = (0, _cell.getQKBorder)(width, type, color);
1297
+ if (!borderInfo_1["".concat(r_1 + rp, "_").concat(c + cp)]) {
1298
+ borderInfo_1["".concat(r_1 + rp, "_").concat(c + cp)] = {};
1299
+ }
1300
+ borderInfo_1["".concat(r_1 + rp, "_").concat(c + cp)].l = {
1301
+ style: borderconfig[0],
1302
+ color: borderconfig[1]
1303
+ };
1304
+ }
1305
+ }
1306
+ if (cp === colspan - 1) {
1307
+ var br = td.style.borderLeft;
1308
+ if (!_lodash.default.isEmpty(br) && br.substring(0, 3).toLowerCase() !== "0px") {
1309
+ var width = td.style.borderRightWidth;
1310
+ var type = td.style.borderRightStyle;
1311
+ var color = td.style.borderRightColor;
1312
+ var borderconfig = (0, _cell.getQKBorder)(width, type, color);
1313
+ if (!borderInfo_1["".concat(r_1 + rp, "_").concat(c + cp)]) {
1314
+ borderInfo_1["".concat(r_1 + rp, "_").concat(c + cp)] = {};
1315
+ }
1316
+ borderInfo_1["".concat(r_1 + rp, "_").concat(c + cp)].r = {
1317
+ style: borderconfig[0],
1318
+ color: borderconfig[1]
1319
+ };
1320
+ }
1321
+ }
1322
+ if (rp === 0 && cp === 0) {
1323
+ continue;
1324
+ }
1325
+ data_1[r_1 + rp][c + cp] = {
1326
+ mc: {
1327
+ r: r_ab,
1328
+ c: c_ab
1329
+ }
1330
+ };
1331
+ }
1332
+ }
1333
+ if (rowspan > 1 || colspan > 1) {
1334
+ var first = {
1335
+ rs: rowspan,
1336
+ cs: colspan,
1337
+ r: r_ab,
1338
+ c: c_ab
1339
+ };
1340
+ data_1[r_1][c].mc = first;
1341
+ }
1342
+ }
1343
+ c += 1;
1344
+ if (c === colLen_1) {
1345
+ return true;
1346
+ }
1347
+ return true;
1348
+ });
1349
+ r_1 += 1;
1350
+ });
1351
+ (0, _api.setRowHeight)(ctx, rowHeightList_1);
1352
+ }
1353
+ ctx.luckysheet_selection_range = [];
1354
+ pasteHandler(ctx, data_1, borderInfo_1);
1355
+ ele.remove();
1191
1356
  } else if (clipboardData.files.length === 1 && clipboardData.files[0].type.indexOf("image") > -1) {} else {
1192
1357
  txtdata = clipboardData.getData("text/plain");
1193
1358
  var isExcelFormula = txtdata.startsWith("=");
1194
1359
  if (isExcelFormula) {
1195
1360
  handleFormulaStringPaste(ctx, txtdata);
1196
- var last = (_r = ctx.luckysheet_select_save) === null || _r === void 0 ? void 0 : _r[ctx.luckysheet_select_save.length - 1];
1197
- if (last) {
1198
- autoFitUsingGetCellTextInfo(ctx, ctx.currentSheetId, last.row[0], last.row[1], last.column[0], last.column[1]);
1199
- }
1200
1361
  } else {
1201
1362
  pasteHandler(ctx, txtdata);
1202
- var last = (_s = ctx.luckysheet_select_save) === null || _s === void 0 ? void 0 : _s[ctx.luckysheet_select_save.length - 1];
1203
- if (last) {
1204
- autoFitUsingGetCellTextInfo(ctx, ctx.currentSheetId, last.row[0], last.row[1], last.column[0], last.column[1]);
1205
- }
1206
1363
  var _txtdata = clipboardData.getData("text/html") || clipboardData.getData("text/plain");
1207
1364
  var embedUrl = (0, _modules.sanitizeDuneUrl)(_txtdata);
1208
1365
  if (embedUrl) {
1209
- var _last = (_t = ctx.luckysheet_select_save) === null || _t === void 0 ? void 0 : _t[ctx.luckysheet_select_save.length - 1];
1210
- if (_last) {
1211
- var rowIndex = (_w = (_u = _last.row_focus) !== null && _u !== void 0 ? _u : (_v = _last.row) === null || _v === void 0 ? void 0 : _v[0]) !== null && _w !== void 0 ? _w : 0;
1212
- var colIndex = (_z = (_x = _last.column_focus) !== null && _x !== void 0 ? _x : (_y = _last.column) === null || _y === void 0 ? void 0 : _y[0]) !== null && _z !== void 0 ? _z : 0;
1366
+ var last = (_r = ctx.luckysheet_select_save) === null || _r === void 0 ? void 0 : _r[ctx.luckysheet_select_save.length - 1];
1367
+ if (last) {
1368
+ var rowIndex = (_u = (_s = last.row_focus) !== null && _s !== void 0 ? _s : (_t = last.row) === null || _t === void 0 ? void 0 : _t[0]) !== null && _u !== void 0 ? _u : 0;
1369
+ var colIndex = (_x = (_v = last.column_focus) !== null && _v !== void 0 ? _v : (_w = last.column) === null || _w === void 0 ? void 0 : _w[0]) !== null && _x !== void 0 ? _x : 0;
1213
1370
  var left = colIndex === 0 ? 0 : ctx.visibledatacolumn[colIndex - 1];
1214
1371
  var top_1 = rowIndex === 0 ? 0 : ctx.visibledatarow[rowIndex + 5];
1215
1372
  ctx.showDunePreview = {
@@ -48,8 +48,8 @@ var _conditionalFormat = require("./conditionalFormat");
48
48
  var _text = require("./text");
49
49
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
50
50
  function updateFormatCell(ctx, d, attr, foucsStatus, row_st, row_ed, col_st, col_ed, canvas) {
51
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
52
- var _y;
51
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
52
+ var _z;
53
53
  if (_lodash.default.isNil(d) || _lodash.default.isNil(attr)) {
54
54
  return;
55
55
  }
@@ -62,10 +62,13 @@ function updateFormatCell(ctx, d, attr, foucsStatus, row_st, row_ed, col_st, col
62
62
  var cell = d[r][c];
63
63
  var value = void 0;
64
64
  if (_lodash.default.isPlainObject(cell)) {
65
- value = (cell === null || cell === void 0 ? void 0 : cell.v) || ((_b = (_a = cell === null || cell === void 0 ? void 0 : cell.ct) === null || _a === void 0 ? void 0 : _a.s[0]) === null || _b === void 0 ? void 0 : _b.v);
65
+ value = (cell === null || cell === void 0 ? void 0 : cell.v) || ((_c = (_b = (_a = cell === null || cell === void 0 ? void 0 : cell.ct) === null || _a === void 0 ? void 0 : _a.s) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.v);
66
66
  } else {
67
67
  value = cell;
68
68
  }
69
+ if (_lodash.default.isNil(value)) {
70
+ continue;
71
+ }
69
72
  if (foucsStatus !== "@" && (0, _validation.isRealNum)(value)) {
70
73
  value = Number(value);
71
74
  }
@@ -86,12 +89,12 @@ function updateFormatCell(ctx, d, attr, foucsStatus, row_st, row_ed, col_st, col
86
89
  cell.ct.fa = foucsStatus;
87
90
  cell.ct.t = type;
88
91
  cell.v = String(value);
89
- cell.fc = cell.fc || ((_e = (_d = (_c = cell.ct) === null || _c === void 0 ? void 0 : _c.s) === null || _d === void 0 ? void 0 : _d[0]) === null || _e === void 0 ? void 0 : _e.fc);
90
- cell.bl = cell.bl || ((_h = (_g = (_f = cell.ct) === null || _f === void 0 ? void 0 : _f.s) === null || _g === void 0 ? void 0 : _g[0]) === null || _h === void 0 ? void 0 : _h.bl);
91
- cell.it = cell.it || ((_l = (_k = (_j = cell.ct) === null || _j === void 0 ? void 0 : _j.s) === null || _k === void 0 ? void 0 : _k[0]) === null || _l === void 0 ? void 0 : _l.it);
92
- cell.un = cell.un || ((_p = (_o = (_m = cell.ct) === null || _m === void 0 ? void 0 : _m.s) === null || _o === void 0 ? void 0 : _o[0]) === null || _p === void 0 ? void 0 : _p.un);
93
- cell.fs = cell.fs || ((_s = (_r = (_q = cell.ct) === null || _q === void 0 ? void 0 : _q.s) === null || _r === void 0 ? void 0 : _r[0]) === null || _s === void 0 ? void 0 : _s.fs);
94
- cell.cl = cell.cl || ((_v = (_u = (_t = cell.ct) === null || _t === void 0 ? void 0 : _t.s) === null || _u === void 0 ? void 0 : _u[0]) === null || _v === void 0 ? void 0 : _v.cl);
92
+ cell.fc = cell.fc || ((_f = (_e = (_d = cell.ct) === null || _d === void 0 ? void 0 : _d.s) === null || _e === void 0 ? void 0 : _e[0]) === null || _f === void 0 ? void 0 : _f.fc);
93
+ cell.bl = cell.bl || ((_j = (_h = (_g = cell.ct) === null || _g === void 0 ? void 0 : _g.s) === null || _h === void 0 ? void 0 : _h[0]) === null || _j === void 0 ? void 0 : _j.bl);
94
+ cell.it = cell.it || ((_m = (_l = (_k = cell.ct) === null || _k === void 0 ? void 0 : _k.s) === null || _l === void 0 ? void 0 : _l[0]) === null || _m === void 0 ? void 0 : _m.it);
95
+ cell.un = cell.un || ((_q = (_p = (_o = cell.ct) === null || _o === void 0 ? void 0 : _o.s) === null || _p === void 0 ? void 0 : _p[0]) === null || _q === void 0 ? void 0 : _q.un);
96
+ cell.fs = cell.fs || ((_t = (_s = (_r = cell.ct) === null || _r === void 0 ? void 0 : _r.s) === null || _s === void 0 ? void 0 : _s[0]) === null || _t === void 0 ? void 0 : _t.fs);
97
+ cell.cl = cell.cl || ((_w = (_v = (_u = cell.ct) === null || _u === void 0 ? void 0 : _u.s) === null || _v === void 0 ? void 0 : _v[0]) === null || _w === void 0 ? void 0 : _w.cl);
95
98
  } else {
96
99
  d[r][c] = {
97
100
  ct: {
@@ -157,9 +160,9 @@ function updateFormatCell(ctx, d, attr, foucsStatus, row_st, row_ed, col_st, col
157
160
  if (value && _lodash.default.isPlainObject(value)) {
158
161
  (0, _inlineString.updateInlineStringFormatOutside)(value, attr, foucsStatus);
159
162
  value[attr] = foucsStatus;
160
- (_y = ctx.luckysheetfile[sheetIndex]).config || (_y.config = {});
163
+ (_z = ctx.luckysheetfile[sheetIndex]).config || (_z.config = {});
161
164
  var cfg = ctx.luckysheetfile[sheetIndex].config;
162
- var cellWidth = ((_w = cfg.columnlen) === null || _w === void 0 ? void 0 : _w[c]) || ctx.luckysheetfile[sheetIndex].defaultColWidth;
165
+ var cellWidth = ((_x = cfg.columnlen) === null || _x === void 0 ? void 0 : _x[c]) || ctx.luckysheetfile[sheetIndex].defaultColWidth;
163
166
  if (attr === "fs" && canvas) {
164
167
  var textInfo = (0, _text.getCellTextInfo)(d[r][c], canvas, ctx, {
165
168
  r: r,
@@ -168,7 +171,7 @@ function updateFormatCell(ctx, d, attr, foucsStatus, row_st, row_ed, col_st, col
168
171
  });
169
172
  if (!textInfo) continue;
170
173
  var rowHeight = _lodash.default.round(textInfo.textHeightAll);
171
- var currentRowHeight = ((_x = cfg.rowlen) === null || _x === void 0 ? void 0 : _x[r]) || ctx.luckysheetfile[sheetIndex].defaultRowHeight || 19;
174
+ var currentRowHeight = ((_y = cfg.rowlen) === null || _y === void 0 ? void 0 : _y[r]) || ctx.luckysheetfile[sheetIndex].defaultRowHeight || 19;
172
175
  if (!_lodash.default.isUndefined(rowHeight) && rowHeight > currentRowHeight && (!cfg.customHeight || cfg.customHeight[r] !== 1)) {
173
176
  if (_lodash.default.isUndefined(cfg.rowlen)) cfg.rowlen = {};
174
177
  _lodash.default.set(cfg, "rowlen.".concat(r), rowHeight);
@@ -38,7 +38,7 @@ function isHexValue(str) {
38
38
  return /^0x?[a-fA-F0-9]+$/.test(str);
39
39
  }
40
40
  function isRealNum(val) {
41
- if (isHexValue(val.toString())) {
41
+ if (isHexValue(val === null || val === void 0 ? void 0 : val.toString())) {
42
42
  return false;
43
43
  }
44
44
  if (_lodash.default.isNil(val) || val.toString().replace(/\s/g, "") === "") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fileverse-dev/fortune-core",
3
- "version": "1.1.53-patch-1",
3
+ "version": "1.1.54-patch-2",
4
4
  "main": "lib/index.js",
5
5
  "module": "es/index.js",
6
6
  "typings": "lib/index.d.ts",
@@ -1,2 +0,0 @@
1
- import { Context } from "./context";
2
- export declare function pasteHtmlTableAndAutoFit(ctx: Context, html: string, pasteHandler: (context: Context, data: any, borderInfo?: any) => void): void;