@fileverse-dev/fortune-core 1.3.6 → 1.3.7-dateImport-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.
package/es/canvas.js CHANGED
@@ -855,7 +855,7 @@ var Canvas = function () {
855
855
  }, renderCtx);
856
856
  };
857
857
  Canvas.prototype.cellRender = function (r, c, startY, startX, endY, endX, value, renderCtx, afCompute, cfCompute, offsetLeft, offsetTop, dynamicArrayCompute, cellOverflowMap, colStart, colEnd, scrollHeight, scrollWidth, bodrder05, isMerge) {
858
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
858
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
859
859
  if (isMerge === void 0) {
860
860
  isMerge = false;
861
861
  }
@@ -945,7 +945,7 @@ var Canvas = function () {
945
945
  renderCtx.fill();
946
946
  }
947
947
  var text = optionValue_1[i];
948
- var fontSize = (cell === null || cell === void 0 ? void 0 : cell.fs) * this_1.sheetCtx.zoomRatio;
948
+ var fontSize = ((_f = cell === null || cell === void 0 ? void 0 : cell.fs) !== null && _f !== void 0 ? _f : 13) * this_1.sheetCtx.zoomRatio;
949
949
  renderCtx.font = "".concat(fontSize, "px sans-serif");
950
950
  renderCtx.fillStyle = "rgba(0, 0, 0, 0.8)";
951
951
  renderCtx.textBaseline = "middle";
@@ -1003,7 +1003,7 @@ var Canvas = function () {
1003
1003
  } else {
1004
1004
  cellOverflow_bd_r_render = false;
1005
1005
  }
1006
- } else if (((_f = dataVerification === null || dataVerification === void 0 ? void 0 : dataVerification["".concat(r, "_").concat(c)]) === null || _f === void 0 ? void 0 : _f.type) === "checkbox") {
1006
+ } else if (((_g = dataVerification === null || dataVerification === void 0 ? void 0 : dataVerification["".concat(r, "_").concat(c)]) === null || _g === void 0 ? void 0 : _g.type) === "checkbox") {
1007
1007
  var pos_x = startX + offsetLeft;
1008
1008
  var pos_y = startY + offsetTop + 1;
1009
1009
  renderCtx.save();
@@ -1064,7 +1064,7 @@ var Canvas = function () {
1064
1064
  renderCtx.fillText(_.isNil(value) ? "" : value, horizonAlignPos + 18, verticalAlignPos_text);
1065
1065
  renderCtx.restore();
1066
1066
  } else {
1067
- if (((_g = checksCF === null || checksCF === void 0 ? void 0 : checksCF.dataBar) === null || _g === void 0 ? void 0 : _g.valueLen) && ((_j = (_h = checksCF === null || checksCF === void 0 ? void 0 : checksCF.dataBar) === null || _h === void 0 ? void 0 : _h.valueLen) === null || _j === void 0 ? void 0 : _j.toString()) !== "NaN") {
1067
+ if (((_h = checksCF === null || checksCF === void 0 ? void 0 : checksCF.dataBar) === null || _h === void 0 ? void 0 : _h.valueLen) && ((_k = (_j = checksCF === null || checksCF === void 0 ? void 0 : checksCF.dataBar) === null || _j === void 0 ? void 0 : _j.valueLen) === null || _k === void 0 ? void 0 : _k.toString()) !== "NaN") {
1068
1068
  var x = startX + offsetLeft + space_width;
1069
1069
  var y = startY + offsetTop + space_height;
1070
1070
  var w = cellWidth - space_width * 2;
@@ -1196,7 +1196,7 @@ var Canvas = function () {
1196
1196
  if (checksCF === null || checksCF === void 0 ? void 0 : checksCF.textColor) {
1197
1197
  renderCtx.fillStyle = checksCF.textColor;
1198
1198
  }
1199
- if (((_m = (_l = (_k = cell === null || cell === void 0 ? void 0 : cell.ct) === null || _k === void 0 ? void 0 : _k.fa) === null || _l === void 0 ? void 0 : _l.indexOf("[Red]")) !== null && _m !== void 0 ? _m : -1) > -1 && ((_o = cell === null || cell === void 0 ? void 0 : cell.ct) === null || _o === void 0 ? void 0 : _o.t) === "n" && (cell === null || cell === void 0 ? void 0 : cell.v) < 0) {
1199
+ if (((_o = (_m = (_l = cell === null || cell === void 0 ? void 0 : cell.ct) === null || _l === void 0 ? void 0 : _l.fa) === null || _m === void 0 ? void 0 : _m.indexOf("[Red]")) !== null && _o !== void 0 ? _o : -1) > -1 && ((_p = cell === null || cell === void 0 ? void 0 : cell.ct) === null || _p === void 0 ? void 0 : _p.t) === "n" && (cell === null || cell === void 0 ? void 0 : cell.v) < 0) {
1200
1200
  renderCtx.fillStyle = "#ff0000";
1201
1201
  }
1202
1202
  var sheetId = this.sheetCtx.currentSheetId;
@@ -1239,7 +1239,7 @@ var Canvas = function () {
1239
1239
  renderCtx.stroke();
1240
1240
  renderCtx.closePath();
1241
1241
  }
1242
- (_q = (_p = this.sheetCtx.hooks).afterRenderCell) === null || _q === void 0 ? void 0 : _q.call(_p, (_r = flowdata[r]) === null || _r === void 0 ? void 0 : _r[c], {
1242
+ (_r = (_q = this.sheetCtx.hooks).afterRenderCell) === null || _r === void 0 ? void 0 : _r.call(_q, (_s = flowdata[r]) === null || _s === void 0 ? void 0 : _s[c], {
1243
1243
  row: r,
1244
1244
  column: c,
1245
1245
  startX: cellsize[0],
@@ -34,10 +34,10 @@ import { handlePastedTable } from "../paste-table-helpers";
34
34
  import { getFlowdata } from "../context";
35
35
  import { execfunction } from "../modules/formula";
36
36
  import { getdatabyselection } from "../modules/cell";
37
- import { update, datenum_local } from "../modules/format";
37
+ import { update, genarate } from "../modules/format";
38
38
  import { normalizeSelection, selectionCache } from "../modules/selection";
39
39
  import { getSheetIndex, isAllowEdit } from "../utils";
40
- import { hasPartMC, isRealNum, detectDateFormat } from "../modules/validation";
40
+ import { hasPartMC, isRealNum } from "../modules/validation";
41
41
  import { getBorderInfoCompute } from "../modules/border";
42
42
  import { expandRowsAndColumns, storeSheetParamALL } from "../modules/sheet";
43
43
  import { jfrefreshgrid } from "../modules/refresh";
@@ -207,7 +207,7 @@ var handleFormulaOnPaste = function handleFormulaOnPaste(ctx, d) {
207
207
  }
208
208
  };
209
209
  function pasteHandler(ctx, data, borderInfo) {
210
- var _a, _b, _c, _d, _e, _f;
210
+ var _a, _b, _c, _d, _e, _f, _g;
211
211
  if (ctx.luckysheet_selection_range) {
212
212
  ctx.luckysheet_selection_range = [];
213
213
  }
@@ -373,25 +373,39 @@ function pasteHandler(ctx, data, borderInfo) {
373
373
  }
374
374
  }
375
375
  if (originCell) {
376
- if (originCell.ct && originCell.ct.t === "d" && !isUrl) {
377
- var df = detectDateFormat(originalValueStr);
378
- if (df) {
379
- var dateObj = new Date(df.year, df.month - 1, df.day, df.hours, df.minutes, df.seconds);
380
- originCell.v = datenum_local(dateObj);
381
- } else {
382
- originCell.v = originalValueStr;
383
- }
384
- } else {
385
- originCell.v = isUrl ? originalValueStr : value;
386
- }
387
- if (originCell.ct != null && originCell.ct.fa != null) {
388
- if (originCell.ct.t === "d" && typeof originCell.v !== "number") {
389
- originCell.m = String(originCell.v);
376
+ if (!isUrl) {
377
+ var generated = genarate(originalValueStr);
378
+ if (generated) {
379
+ var genM = generated[0],
380
+ genCt = generated[1],
381
+ genV = generated[2];
382
+ if ((genCt === null || genCt === void 0 ? void 0 : genCt.t) === "d") {
383
+ originCell.v = genV;
384
+ originCell.m = genM !== null && genM !== void 0 ? genM : originalValueStr;
385
+ originCell.ct = genCt;
386
+ } else {
387
+ originCell.v = value;
388
+ if (originCell.ct != null && originCell.ct.fa != null) {
389
+ if (originCell.ct.t === "d" && typeof originCell.v !== "number") {
390
+ originCell.m = String(originCell.v);
391
+ } else {
392
+ originCell.m = update(originCell.ct.fa, originCell.v);
393
+ }
394
+ } else {
395
+ originCell.m = typeof originCell.v === "boolean" ? String(originCell.v) : originCell.v;
396
+ }
397
+ }
390
398
  } else {
391
- originCell.m = update(originCell.ct.fa, originCell.v);
399
+ originCell.v = value;
400
+ if (originCell.ct != null && originCell.ct.fa != null) {
401
+ originCell.m = update(originCell.ct.fa, originCell.v);
402
+ } else {
403
+ originCell.m = typeof originCell.v === "boolean" ? String(originCell.v) : originCell.v;
404
+ }
392
405
  }
393
406
  } else {
394
- originCell.m = typeof originCell.v === "boolean" ? String(originCell.v) : originCell.v;
407
+ originCell.v = originalValueStr;
408
+ originCell.m = originalValueStr;
395
409
  }
396
410
  if (originCell.f != null && originCell.f.length > 0) {
397
411
  originCell.f = "";
@@ -418,19 +432,24 @@ function pasteHandler(ctx, data, borderInfo) {
418
432
  t: "s"
419
433
  };
420
434
  } else {
421
- cell.v = originalValueStr;
422
- cell.m = originalValueStr;
423
- cell.ct = {
424
- fa: "General",
425
- t: "g"
426
- };
427
435
  if (/^0x?[a-fA-F0-9]+$/.test(value)) {
436
+ cell.v = value;
428
437
  cell.m = value;
429
438
  cell.ct = {
430
439
  fa: "@",
431
440
  t: "s"
432
441
  };
433
- cell.v = value;
442
+ } else {
443
+ var _h = (_g = genarate(originalValueStr)) !== null && _g !== void 0 ? _g : [],
444
+ m = _h[0],
445
+ ct = _h[1],
446
+ v = _h[2];
447
+ cell.v = v !== null && v !== void 0 ? v : originalValueStr;
448
+ cell.m = m != null ? String(m) : originalValueStr;
449
+ cell.ct = ct !== null && ct !== void 0 ? ct : {
450
+ fa: "General",
451
+ t: "g"
452
+ };
434
453
  }
435
454
  }
436
455
  if (isUrl && url) {
@@ -135,6 +135,9 @@ export function setCellValue(ctx, r, c, d, v) {
135
135
  if (!_.isNil(v.ct)) {
136
136
  cell.ct = v.ct;
137
137
  }
138
+ if (!_.isNil(v.ht)) {
139
+ cell.ht = v.ht;
140
+ }
138
141
  }
139
142
  if (_.isPlainObject(v.v)) {
140
143
  vupdate = v.v.v;
@@ -286,15 +289,16 @@ export function setCellValue(ctx, r, c, d, v) {
286
289
  t: "n"
287
290
  });
288
291
  }
289
- if (_.isNil(cell.ht)) {
290
- cell.ht = 2;
291
- }
292
+ cell.ht = 2;
292
293
  }
293
294
  var mask = update(fa, vupdate);
294
295
  if (mask === vupdate) {
295
296
  mask = genarate(vupdate);
296
297
  cell.m = mask[0].toString();
297
298
  cell.ct = mask[1], cell.v = mask[2];
299
+ if (isRealNum(vupdate)) {
300
+ cell.ht = 2;
301
+ }
298
302
  } else {
299
303
  if (v.m) {
300
304
  cell.m = v.m;
@@ -317,9 +321,7 @@ export function setCellValue(ctx, r, c, d, v) {
317
321
  var strValue = String(vupdate);
318
322
  var format = getNumberFormat(strValue, commaPresent);
319
323
  cell.m = v.m ? v.m : update(format, cell.v);
320
- if (_.isNil(cell.ht)) {
321
- cell.ht = 2;
322
- }
324
+ cell.ht = 2;
323
325
  cell.ct = {
324
326
  fa: format,
325
327
  t: "n"
@@ -240,30 +240,34 @@ export function genarate(value) {
240
240
  v = datenum_local(dateObj);
241
241
  ct.t = "d";
242
242
  var map = {
243
- "yyyy-MM-dd": "dd/MM/yyyy",
244
- "yyyy-MM-dd HH:mm": "dd/MM/yyyy",
245
- "yyyy-MM-ddTHH:mm": "dd/MM/yyyy",
246
- "yyyy/MM/dd": "dd/MM/yyyy",
247
- "yyyy/MM/dd HH:mm": "dd/MM/yyyy",
243
+ "yyyy-MM-dd": "yyyy-MM-dd",
244
+ "yyyy-MM-dd HH:mm": "yyyy-MM-dd HH:mm",
245
+ "yyyy-MM-ddTHH:mm": "yyyy-MM-dd HH:mm",
246
+ "yyyy/MM/dd": "yyyy/MM/dd",
247
+ "yyyy/MM/dd HH:mm": "yyyy/MM/dd HH:mm",
248
248
  "yyyy.MM.dd": "yyyy.MM.dd",
249
249
  "MM/dd/yyyy h:mm AM/PM": "MM/dd/yyyy h:mm AM/PM",
250
250
  "MM/dd/yyyy": "MM/dd/yyyy",
251
251
  "M/d/yyyy": "M/d/yyyy",
252
252
  "MM/dd/yy": "MM/dd/yy",
253
253
  "dd/MM/yyyy": "dd/MM/yyyy",
254
- "dd-MM-yyyy": "dd/MM/yyyy",
254
+ "dd-MM-yyyy": "dd-MM-yyyy",
255
255
  "dd.MM.yyyy": "dd.MM.yyyy",
256
- named: "dd/MM/yyyy"
256
+ "named-mdy-full": "mmmm d, yyyy",
257
+ "named-mdy-abbr": "mmm d, yyyy",
258
+ "named-dmy-full": "d mmmm yyyy",
259
+ "named-dmy-abbr": "d mmm yyyy",
260
+ "named-abbr-dashes": "mmm-d-yyyy"
257
261
  };
258
262
  ct.fa = map[df.formatType] || "dd/MM/yyyy";
259
263
  m = SSF.format(ct.fa, v);
260
264
  } else {
261
- m = value.toString();
265
+ m = String(value);
262
266
  ct.fa = "General";
263
267
  ct.t = "g";
264
268
  }
265
269
  } else {
266
- m = value.toString();
270
+ m = String(value);
267
271
  ct.fa = "General";
268
272
  ct.t = "g";
269
273
  }
@@ -273,6 +277,7 @@ export function update(fmt, v) {
273
277
  return SSF.format(fmt, v);
274
278
  }
275
279
  export function is_date(fmt, v) {
280
+ console.log(SSF.is_date(fmt, v), "is_date");
276
281
  return SSF.is_date(fmt, v);
277
282
  }
278
283
  function fuzzynum(s) {
@@ -1541,6 +1541,8 @@ export function deleteSelectedCellText(ctx) {
1541
1541
  var cell = d[r][c];
1542
1542
  delete cell.m;
1543
1543
  delete cell.v;
1544
+ delete cell.fc;
1545
+ delete cell.un;
1544
1546
  if (cell.f != null) {
1545
1547
  delete cell.f;
1546
1548
  delFunctionGroup(ctx, r, c, ctx.currentSheetId);
@@ -1613,7 +1615,8 @@ export function deleteSelectedCellFormat(ctx) {
1613
1615
  return "success";
1614
1616
  }
1615
1617
  export function fillRightData(ctx) {
1616
- var _a, _b;
1618
+ var _a, _b, _c, _d;
1619
+ var _e, _f, _g;
1617
1620
  var allowEdit = isAllowEdit(ctx);
1618
1621
  if (allowEdit === false) {
1619
1622
  return "allowEdit";
@@ -1641,18 +1644,109 @@ export function fillRightData(ctx) {
1641
1644
  var r2 = selection[s].row[1];
1642
1645
  var c1 = selection[s].column[0];
1643
1646
  var c2 = selection[s].column[1];
1647
+ var sheetIndex = getSheetIndex(ctx, ctx.currentSheetId);
1648
+ var file = sheetIndex != null ? ctx.luckysheetfile[sheetIndex] : null;
1649
+ var dataVerification = file === null || file === void 0 ? void 0 : file.dataVerification;
1650
+ var hyperlink = file === null || file === void 0 ? void 0 : file.hyperlink;
1651
+ var cdformat = file === null || file === void 0 ? void 0 : file.luckysheet_conditionformat_save;
1644
1652
  var isSingleCell = r1 === r2 && c1 === c2;
1645
1653
  if (isSingleCell) {
1646
1654
  if (c1 - 1 >= 0 && d[r1]) {
1655
+ var srcRow = r1;
1656
+ var srcCol = c1 - 1;
1647
1657
  var prev = d[r1][c1 - 1];
1648
1658
  d[r1][c1] = prev != null ? __assign({}, prev) : {};
1659
+ if (file != null) {
1660
+ var srcKey = "".concat(srcRow, "_").concat(srcCol);
1661
+ var tgtKey = "".concat(r1, "_").concat(c1);
1662
+ if (dataVerification != null) {
1663
+ var dv = dataVerification[srcKey];
1664
+ if (dv != null) {
1665
+ console.log("[fillRightData] dataVerification copy from", {
1666
+ row: srcRow,
1667
+ col: srcCol
1668
+ }, "→", {
1669
+ row: r1,
1670
+ col: c1
1671
+ }, dv);
1672
+ file.dataVerification = __assign(__assign({}, file.dataVerification || {}), (_a = {}, _a[tgtKey] = _.cloneDeep(dv), _a));
1673
+ }
1674
+ }
1675
+ if (hyperlink != null && hyperlink[srcKey] != null) {
1676
+ file.hyperlink = __assign(__assign({}, file.hyperlink || {}), (_b = {}, _b[tgtKey] = _.cloneDeep(hyperlink[srcKey]), _b));
1677
+ var tgtCell = d[r1][c1];
1678
+ if (tgtCell != null) tgtCell.hl = {
1679
+ r: r1,
1680
+ c: c1,
1681
+ id: ctx.currentSheetId
1682
+ };
1683
+ }
1684
+ if (cdformat != null && cdformat.length > 0) {
1685
+ for (var i = 0; i < cdformat.length; i += 1) {
1686
+ var ranges = cdformat[i].cellrange;
1687
+ if (!ranges) continue;
1688
+ for (var j = 0; j < ranges.length; j += 1) {
1689
+ var cr = ranges[j];
1690
+ if (srcRow >= cr.row[0] && srcRow <= cr.row[1] && srcCol >= cr.column[0] && srcCol <= cr.column[1]) {
1691
+ ranges.push({
1692
+ row: [r1, r1],
1693
+ column: [c1, c1]
1694
+ });
1695
+ break;
1696
+ }
1697
+ }
1698
+ }
1699
+ }
1700
+ }
1649
1701
  }
1650
1702
  } else {
1651
1703
  for (var r = r1; r <= r2; r += 1) {
1652
- var sourceCell = (_a = d[r]) === null || _a === void 0 ? void 0 : _a[c1];
1704
+ var sourceCell = (_e = d[r]) === null || _e === void 0 ? void 0 : _e[c1];
1653
1705
  for (var c = c1 + 1; c <= c2; c += 1) {
1654
1706
  if (d[r]) {
1655
- d[r][c] = sourceCell != null ? __assign({}, sourceCell) : (_b = d[r][c]) !== null && _b !== void 0 ? _b : {};
1707
+ d[r][c] = sourceCell != null ? __assign({}, sourceCell) : (_f = d[r][c]) !== null && _f !== void 0 ? _f : {};
1708
+ }
1709
+ if (file != null) {
1710
+ var srcKey = "".concat(r, "_").concat(c1);
1711
+ var tgtKey = "".concat(r, "_").concat(c);
1712
+ if (dataVerification != null) {
1713
+ var dv = dataVerification[srcKey];
1714
+ if (dv != null) {
1715
+ console.log("[fillRightData] dataVerification copy from", {
1716
+ row: r,
1717
+ col: c1
1718
+ }, "→", {
1719
+ row: r,
1720
+ col: c
1721
+ }, dv);
1722
+ file.dataVerification = __assign(__assign({}, file.dataVerification || {}), (_c = {}, _c[tgtKey] = _.cloneDeep(dv), _c));
1723
+ }
1724
+ }
1725
+ if (hyperlink != null && hyperlink[srcKey] != null) {
1726
+ file.hyperlink = __assign(__assign({}, file.hyperlink || {}), (_d = {}, _d[tgtKey] = _.cloneDeep(hyperlink[srcKey]), _d));
1727
+ var tgtCell = (_g = d[r]) === null || _g === void 0 ? void 0 : _g[c];
1728
+ if (tgtCell != null) tgtCell.hl = {
1729
+ r: r,
1730
+ c: c,
1731
+ id: ctx.currentSheetId
1732
+ };
1733
+ }
1734
+ if (cdformat != null && cdformat.length > 0) {
1735
+ for (var i = 0; i < cdformat.length; i += 1) {
1736
+ var ranges = cdformat[i].cellrange;
1737
+ if (!ranges) continue;
1738
+ for (var j = 0; j < ranges.length; j += 1) {
1739
+ var cr = ranges[j];
1740
+ if (r >= cr.row[0] && r <= cr.row[1] && c1 >= cr.column[0] && c1 <= cr.column[1]) {
1741
+ ranges.push({
1742
+ row: [r, r],
1743
+ column: [c, c]
1744
+ });
1745
+ break;
1746
+ }
1747
+ }
1748
+ }
1749
+ }
1656
1750
  }
1657
1751
  }
1658
1752
  }
@@ -1662,7 +1756,8 @@ export function fillRightData(ctx) {
1662
1756
  return "success";
1663
1757
  }
1664
1758
  export function fillDownData(ctx) {
1665
- var _a, _b;
1759
+ var _a, _b, _c, _d;
1760
+ var _e, _f, _g;
1666
1761
  var allowEdit = isAllowEdit(ctx);
1667
1762
  if (allowEdit === false) {
1668
1763
  return "allowEdit";
@@ -1690,19 +1785,110 @@ export function fillDownData(ctx) {
1690
1785
  var r2 = selection[s].row[1];
1691
1786
  var c1 = selection[s].column[0];
1692
1787
  var c2 = selection[s].column[1];
1788
+ var sheetIndex = getSheetIndex(ctx, ctx.currentSheetId);
1789
+ var file = sheetIndex != null ? ctx.luckysheetfile[sheetIndex] : null;
1790
+ var dataVerification = file === null || file === void 0 ? void 0 : file.dataVerification;
1791
+ var hyperlink = file === null || file === void 0 ? void 0 : file.hyperlink;
1792
+ var cdformat = file === null || file === void 0 ? void 0 : file.luckysheet_conditionformat_save;
1693
1793
  var isSingleCell = r1 === r2 && c1 === c2;
1694
1794
  if (isSingleCell) {
1695
1795
  if (r1 - 1 >= 0 && d[r1 - 1]) {
1796
+ var srcRow = r1 - 1;
1797
+ var srcCol = c1;
1696
1798
  var prev = d[r1 - 1][c1];
1697
1799
  if (!d[r1]) d[r1] = [];
1698
1800
  d[r1][c1] = prev != null ? __assign({}, prev) : {};
1801
+ if (file != null) {
1802
+ var srcKey = "".concat(srcRow, "_").concat(srcCol);
1803
+ var tgtKey = "".concat(r1, "_").concat(c1);
1804
+ if (dataVerification != null) {
1805
+ var dv = dataVerification[srcKey];
1806
+ if (dv != null) {
1807
+ console.log("[fillDownData] dataVerification copy from", {
1808
+ row: srcRow,
1809
+ col: srcCol
1810
+ }, "→", {
1811
+ row: r1,
1812
+ col: c1
1813
+ }, dv);
1814
+ file.dataVerification = __assign(__assign({}, file.dataVerification || {}), (_a = {}, _a[tgtKey] = _.cloneDeep(dv), _a));
1815
+ }
1816
+ }
1817
+ if (hyperlink != null && hyperlink[srcKey] != null) {
1818
+ file.hyperlink = __assign(__assign({}, file.hyperlink || {}), (_b = {}, _b[tgtKey] = _.cloneDeep(hyperlink[srcKey]), _b));
1819
+ var tgtCell = d[r1][c1];
1820
+ if (tgtCell != null) tgtCell.hl = {
1821
+ r: r1,
1822
+ c: c1,
1823
+ id: ctx.currentSheetId
1824
+ };
1825
+ }
1826
+ if (cdformat != null && cdformat.length > 0) {
1827
+ for (var i = 0; i < cdformat.length; i += 1) {
1828
+ var ranges = cdformat[i].cellrange;
1829
+ if (!ranges) continue;
1830
+ for (var j = 0; j < ranges.length; j += 1) {
1831
+ var cr = ranges[j];
1832
+ if (srcRow >= cr.row[0] && srcRow <= cr.row[1] && srcCol >= cr.column[0] && srcCol <= cr.column[1]) {
1833
+ ranges.push({
1834
+ row: [r1, r1],
1835
+ column: [c1, c1]
1836
+ });
1837
+ break;
1838
+ }
1839
+ }
1840
+ }
1841
+ }
1842
+ }
1699
1843
  }
1700
1844
  } else {
1701
1845
  for (var c = c1; c <= c2; c += 1) {
1702
- var sourceCell = (_a = d[r1]) === null || _a === void 0 ? void 0 : _a[c];
1846
+ var sourceCell = (_e = d[r1]) === null || _e === void 0 ? void 0 : _e[c];
1703
1847
  for (var r = r1 + 1; r <= r2; r += 1) {
1704
1848
  if (!d[r]) d[r] = [];
1705
- d[r][c] = sourceCell != null ? __assign({}, sourceCell) : (_b = d[r][c]) !== null && _b !== void 0 ? _b : {};
1849
+ d[r][c] = sourceCell != null ? __assign({}, sourceCell) : (_f = d[r][c]) !== null && _f !== void 0 ? _f : {};
1850
+ if (file != null) {
1851
+ var srcKey = "".concat(r1, "_").concat(c);
1852
+ var tgtKey = "".concat(r, "_").concat(c);
1853
+ if (dataVerification != null) {
1854
+ var dv = dataVerification[srcKey];
1855
+ if (dv != null) {
1856
+ console.log("[fillDownData] dataVerification copy from", {
1857
+ row: r1,
1858
+ col: c
1859
+ }, "→", {
1860
+ row: r,
1861
+ col: c
1862
+ }, dv);
1863
+ file.dataVerification = __assign(__assign({}, file.dataVerification || {}), (_c = {}, _c[tgtKey] = _.cloneDeep(dv), _c));
1864
+ }
1865
+ }
1866
+ if (hyperlink != null && hyperlink[srcKey] != null) {
1867
+ file.hyperlink = __assign(__assign({}, file.hyperlink || {}), (_d = {}, _d[tgtKey] = _.cloneDeep(hyperlink[srcKey]), _d));
1868
+ var tgtCell = (_g = d[r]) === null || _g === void 0 ? void 0 : _g[c];
1869
+ if (tgtCell != null) tgtCell.hl = {
1870
+ r: r,
1871
+ c: c,
1872
+ id: ctx.currentSheetId
1873
+ };
1874
+ }
1875
+ if (cdformat != null && cdformat.length > 0) {
1876
+ for (var i = 0; i < cdformat.length; i += 1) {
1877
+ var ranges = cdformat[i].cellrange;
1878
+ if (!ranges) continue;
1879
+ for (var j = 0; j < ranges.length; j += 1) {
1880
+ var cr = ranges[j];
1881
+ if (r1 >= cr.row[0] && r1 <= cr.row[1] && c >= cr.column[0] && c <= cr.column[1]) {
1882
+ ranges.push({
1883
+ row: [r, r],
1884
+ column: [c, c]
1885
+ });
1886
+ break;
1887
+ }
1888
+ }
1889
+ }
1890
+ }
1891
+ }
1706
1892
  }
1707
1893
  }
1708
1894
  }
@@ -66,6 +66,7 @@ var MONTH_NAME_MAP = {
66
66
  };
67
67
  var MONTH_NAMES_RE = "january|february|march|april|may|june|july|august|september|october|november|december|jan|feb|mar|apr|jun|jul|aug|sep|oct|nov|dec";
68
68
  var MONTH_ABBR_RE = "jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec";
69
+ var MONTH_ABBR_SET = new Set(MONTH_ABBR_RE.split("|"));
69
70
  function isValidDateParts(year, month, day) {
70
71
  if (year < 1900) return false;
71
72
  if (month < 1 || month > 12) return false;
@@ -280,6 +281,7 @@ export function detectDateFormat(str) {
280
281
  var d = +m[2];
281
282
  var y = +m[3];
282
283
  if (mo && isValidDateParts(y, mo, d)) {
284
+ var isAbbr = MONTH_ABBR_SET.has(m[1].toLowerCase());
283
285
  return {
284
286
  year: y,
285
287
  month: mo,
@@ -287,7 +289,7 @@ export function detectDateFormat(str) {
287
289
  hours: 0,
288
290
  minutes: 0,
289
291
  seconds: 0,
290
- formatType: "named"
292
+ formatType: isAbbr ? "named-mdy-abbr" : "named-mdy-full"
291
293
  };
292
294
  }
293
295
  }
@@ -297,6 +299,7 @@ export function detectDateFormat(str) {
297
299
  var mo = MONTH_NAME_MAP[m[2].toLowerCase()];
298
300
  var y = +m[3];
299
301
  if (mo && isValidDateParts(y, mo, d)) {
302
+ var isAbbr = MONTH_ABBR_SET.has(m[2].toLowerCase());
300
303
  return {
301
304
  year: y,
302
305
  month: mo,
@@ -304,7 +307,7 @@ export function detectDateFormat(str) {
304
307
  hours: 0,
305
308
  minutes: 0,
306
309
  seconds: 0,
307
- formatType: "named"
310
+ formatType: isAbbr ? "named-dmy-abbr" : "named-dmy-full"
308
311
  };
309
312
  }
310
313
  }
@@ -321,7 +324,7 @@ export function detectDateFormat(str) {
321
324
  hours: 0,
322
325
  minutes: 0,
323
326
  seconds: 0,
324
- formatType: "named"
327
+ formatType: "named-abbr-dashes"
325
328
  };
326
329
  }
327
330
  }
package/lib/canvas.js CHANGED
@@ -862,7 +862,7 @@ var Canvas = exports.Canvas = function () {
862
862
  }, renderCtx);
863
863
  };
864
864
  Canvas.prototype.cellRender = function (r, c, startY, startX, endY, endX, value, renderCtx, afCompute, cfCompute, offsetLeft, offsetTop, dynamicArrayCompute, cellOverflowMap, colStart, colEnd, scrollHeight, scrollWidth, bodrder05, isMerge) {
865
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
865
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
866
866
  if (isMerge === void 0) {
867
867
  isMerge = false;
868
868
  }
@@ -952,7 +952,7 @@ var Canvas = exports.Canvas = function () {
952
952
  renderCtx.fill();
953
953
  }
954
954
  var text = optionValue_1[i];
955
- var fontSize = (cell === null || cell === void 0 ? void 0 : cell.fs) * this_1.sheetCtx.zoomRatio;
955
+ var fontSize = ((_f = cell === null || cell === void 0 ? void 0 : cell.fs) !== null && _f !== void 0 ? _f : 13) * this_1.sheetCtx.zoomRatio;
956
956
  renderCtx.font = "".concat(fontSize, "px sans-serif");
957
957
  renderCtx.fillStyle = "rgba(0, 0, 0, 0.8)";
958
958
  renderCtx.textBaseline = "middle";
@@ -1010,7 +1010,7 @@ var Canvas = exports.Canvas = function () {
1010
1010
  } else {
1011
1011
  cellOverflow_bd_r_render = false;
1012
1012
  }
1013
- } else if (((_f = dataVerification === null || dataVerification === void 0 ? void 0 : dataVerification["".concat(r, "_").concat(c)]) === null || _f === void 0 ? void 0 : _f.type) === "checkbox") {
1013
+ } else if (((_g = dataVerification === null || dataVerification === void 0 ? void 0 : dataVerification["".concat(r, "_").concat(c)]) === null || _g === void 0 ? void 0 : _g.type) === "checkbox") {
1014
1014
  var pos_x = startX + offsetLeft;
1015
1015
  var pos_y = startY + offsetTop + 1;
1016
1016
  renderCtx.save();
@@ -1071,7 +1071,7 @@ var Canvas = exports.Canvas = function () {
1071
1071
  renderCtx.fillText(_lodash.default.isNil(value) ? "" : value, horizonAlignPos + 18, verticalAlignPos_text);
1072
1072
  renderCtx.restore();
1073
1073
  } else {
1074
- if (((_g = checksCF === null || checksCF === void 0 ? void 0 : checksCF.dataBar) === null || _g === void 0 ? void 0 : _g.valueLen) && ((_j = (_h = checksCF === null || checksCF === void 0 ? void 0 : checksCF.dataBar) === null || _h === void 0 ? void 0 : _h.valueLen) === null || _j === void 0 ? void 0 : _j.toString()) !== "NaN") {
1074
+ if (((_h = checksCF === null || checksCF === void 0 ? void 0 : checksCF.dataBar) === null || _h === void 0 ? void 0 : _h.valueLen) && ((_k = (_j = checksCF === null || checksCF === void 0 ? void 0 : checksCF.dataBar) === null || _j === void 0 ? void 0 : _j.valueLen) === null || _k === void 0 ? void 0 : _k.toString()) !== "NaN") {
1075
1075
  var x = startX + offsetLeft + space_width;
1076
1076
  var y = startY + offsetTop + space_height;
1077
1077
  var w = cellWidth - space_width * 2;
@@ -1203,7 +1203,7 @@ var Canvas = exports.Canvas = function () {
1203
1203
  if (checksCF === null || checksCF === void 0 ? void 0 : checksCF.textColor) {
1204
1204
  renderCtx.fillStyle = checksCF.textColor;
1205
1205
  }
1206
- if (((_m = (_l = (_k = cell === null || cell === void 0 ? void 0 : cell.ct) === null || _k === void 0 ? void 0 : _k.fa) === null || _l === void 0 ? void 0 : _l.indexOf("[Red]")) !== null && _m !== void 0 ? _m : -1) > -1 && ((_o = cell === null || cell === void 0 ? void 0 : cell.ct) === null || _o === void 0 ? void 0 : _o.t) === "n" && (cell === null || cell === void 0 ? void 0 : cell.v) < 0) {
1206
+ if (((_o = (_m = (_l = cell === null || cell === void 0 ? void 0 : cell.ct) === null || _l === void 0 ? void 0 : _l.fa) === null || _m === void 0 ? void 0 : _m.indexOf("[Red]")) !== null && _o !== void 0 ? _o : -1) > -1 && ((_p = cell === null || cell === void 0 ? void 0 : cell.ct) === null || _p === void 0 ? void 0 : _p.t) === "n" && (cell === null || cell === void 0 ? void 0 : cell.v) < 0) {
1207
1207
  renderCtx.fillStyle = "#ff0000";
1208
1208
  }
1209
1209
  var sheetId = this.sheetCtx.currentSheetId;
@@ -1246,7 +1246,7 @@ var Canvas = exports.Canvas = function () {
1246
1246
  renderCtx.stroke();
1247
1247
  renderCtx.closePath();
1248
1248
  }
1249
- (_q = (_p = this.sheetCtx.hooks).afterRenderCell) === null || _q === void 0 ? void 0 : _q.call(_p, (_r = flowdata[r]) === null || _r === void 0 ? void 0 : _r[c], {
1249
+ (_r = (_q = this.sheetCtx.hooks).afterRenderCell) === null || _r === void 0 ? void 0 : _r.call(_q, (_s = flowdata[r]) === null || _s === void 0 ? void 0 : _s[c], {
1250
1250
  row: r,
1251
1251
  column: c,
1252
1252
  startX: cellsize[0],
@@ -220,7 +220,7 @@ var handleFormulaOnPaste = function handleFormulaOnPaste(ctx, d) {
220
220
  }
221
221
  };
222
222
  function pasteHandler(ctx, data, borderInfo) {
223
- var _a, _b, _c, _d, _e, _f;
223
+ var _a, _b, _c, _d, _e, _f, _g;
224
224
  if (ctx.luckysheet_selection_range) {
225
225
  ctx.luckysheet_selection_range = [];
226
226
  }
@@ -386,25 +386,39 @@ function pasteHandler(ctx, data, borderInfo) {
386
386
  }
387
387
  }
388
388
  if (originCell) {
389
- if (originCell.ct && originCell.ct.t === "d" && !isUrl) {
390
- var df = (0, _validation.detectDateFormat)(originalValueStr);
391
- if (df) {
392
- var dateObj = new Date(df.year, df.month - 1, df.day, df.hours, df.minutes, df.seconds);
393
- originCell.v = (0, _format.datenum_local)(dateObj);
394
- } else {
395
- originCell.v = originalValueStr;
396
- }
397
- } else {
398
- originCell.v = isUrl ? originalValueStr : value;
399
- }
400
- if (originCell.ct != null && originCell.ct.fa != null) {
401
- if (originCell.ct.t === "d" && typeof originCell.v !== "number") {
402
- originCell.m = String(originCell.v);
389
+ if (!isUrl) {
390
+ var generated = (0, _format.genarate)(originalValueStr);
391
+ if (generated) {
392
+ var genM = generated[0],
393
+ genCt = generated[1],
394
+ genV = generated[2];
395
+ if ((genCt === null || genCt === void 0 ? void 0 : genCt.t) === "d") {
396
+ originCell.v = genV;
397
+ originCell.m = genM !== null && genM !== void 0 ? genM : originalValueStr;
398
+ originCell.ct = genCt;
399
+ } else {
400
+ originCell.v = value;
401
+ if (originCell.ct != null && originCell.ct.fa != null) {
402
+ if (originCell.ct.t === "d" && typeof originCell.v !== "number") {
403
+ originCell.m = String(originCell.v);
404
+ } else {
405
+ originCell.m = (0, _format.update)(originCell.ct.fa, originCell.v);
406
+ }
407
+ } else {
408
+ originCell.m = typeof originCell.v === "boolean" ? String(originCell.v) : originCell.v;
409
+ }
410
+ }
403
411
  } else {
404
- originCell.m = (0, _format.update)(originCell.ct.fa, originCell.v);
412
+ originCell.v = value;
413
+ if (originCell.ct != null && originCell.ct.fa != null) {
414
+ originCell.m = (0, _format.update)(originCell.ct.fa, originCell.v);
415
+ } else {
416
+ originCell.m = typeof originCell.v === "boolean" ? String(originCell.v) : originCell.v;
417
+ }
405
418
  }
406
419
  } else {
407
- originCell.m = typeof originCell.v === "boolean" ? String(originCell.v) : originCell.v;
420
+ originCell.v = originalValueStr;
421
+ originCell.m = originalValueStr;
408
422
  }
409
423
  if (originCell.f != null && originCell.f.length > 0) {
410
424
  originCell.f = "";
@@ -431,19 +445,24 @@ function pasteHandler(ctx, data, borderInfo) {
431
445
  t: "s"
432
446
  };
433
447
  } else {
434
- cell.v = originalValueStr;
435
- cell.m = originalValueStr;
436
- cell.ct = {
437
- fa: "General",
438
- t: "g"
439
- };
440
448
  if (/^0x?[a-fA-F0-9]+$/.test(value)) {
449
+ cell.v = value;
441
450
  cell.m = value;
442
451
  cell.ct = {
443
452
  fa: "@",
444
453
  t: "s"
445
454
  };
446
- cell.v = value;
455
+ } else {
456
+ var _h = (_g = (0, _format.genarate)(originalValueStr)) !== null && _g !== void 0 ? _g : [],
457
+ m = _h[0],
458
+ ct = _h[1],
459
+ v = _h[2];
460
+ cell.v = v !== null && v !== void 0 ? v : originalValueStr;
461
+ cell.m = m != null ? String(m) : originalValueStr;
462
+ cell.ct = ct !== null && ct !== void 0 ? ct : {
463
+ fa: "General",
464
+ t: "g"
465
+ };
447
466
  }
448
467
  }
449
468
  if (isUrl && url) {
@@ -168,6 +168,9 @@ function setCellValue(ctx, r, c, d, v) {
168
168
  if (!_lodash.default.isNil(v.ct)) {
169
169
  cell.ct = v.ct;
170
170
  }
171
+ if (!_lodash.default.isNil(v.ht)) {
172
+ cell.ht = v.ht;
173
+ }
171
174
  }
172
175
  if (_lodash.default.isPlainObject(v.v)) {
173
176
  vupdate = v.v.v;
@@ -319,15 +322,16 @@ function setCellValue(ctx, r, c, d, v) {
319
322
  t: "n"
320
323
  });
321
324
  }
322
- if (_lodash.default.isNil(cell.ht)) {
323
- cell.ht = 2;
324
- }
325
+ cell.ht = 2;
325
326
  }
326
327
  var mask = (0, _format.update)(fa, vupdate);
327
328
  if (mask === vupdate) {
328
329
  mask = (0, _format.genarate)(vupdate);
329
330
  cell.m = mask[0].toString();
330
331
  cell.ct = mask[1], cell.v = mask[2];
332
+ if ((0, _validation.isRealNum)(vupdate)) {
333
+ cell.ht = 2;
334
+ }
331
335
  } else {
332
336
  if (v.m) {
333
337
  cell.m = v.m;
@@ -350,9 +354,7 @@ function setCellValue(ctx, r, c, d, v) {
350
354
  var strValue = String(vupdate);
351
355
  var format = (0, _utils.getNumberFormat)(strValue, commaPresent);
352
356
  cell.m = v.m ? v.m : (0, _format.update)(format, cell.v);
353
- if (_lodash.default.isNil(cell.ht)) {
354
- cell.ht = 2;
355
- }
357
+ cell.ht = 2;
356
358
  cell.ct = {
357
359
  fa: format,
358
360
  t: "n"
@@ -251,30 +251,34 @@ function genarate(value) {
251
251
  v = datenum_local(dateObj);
252
252
  ct.t = "d";
253
253
  var map = {
254
- "yyyy-MM-dd": "dd/MM/yyyy",
255
- "yyyy-MM-dd HH:mm": "dd/MM/yyyy",
256
- "yyyy-MM-ddTHH:mm": "dd/MM/yyyy",
257
- "yyyy/MM/dd": "dd/MM/yyyy",
258
- "yyyy/MM/dd HH:mm": "dd/MM/yyyy",
254
+ "yyyy-MM-dd": "yyyy-MM-dd",
255
+ "yyyy-MM-dd HH:mm": "yyyy-MM-dd HH:mm",
256
+ "yyyy-MM-ddTHH:mm": "yyyy-MM-dd HH:mm",
257
+ "yyyy/MM/dd": "yyyy/MM/dd",
258
+ "yyyy/MM/dd HH:mm": "yyyy/MM/dd HH:mm",
259
259
  "yyyy.MM.dd": "yyyy.MM.dd",
260
260
  "MM/dd/yyyy h:mm AM/PM": "MM/dd/yyyy h:mm AM/PM",
261
261
  "MM/dd/yyyy": "MM/dd/yyyy",
262
262
  "M/d/yyyy": "M/d/yyyy",
263
263
  "MM/dd/yy": "MM/dd/yy",
264
264
  "dd/MM/yyyy": "dd/MM/yyyy",
265
- "dd-MM-yyyy": "dd/MM/yyyy",
265
+ "dd-MM-yyyy": "dd-MM-yyyy",
266
266
  "dd.MM.yyyy": "dd.MM.yyyy",
267
- named: "dd/MM/yyyy"
267
+ "named-mdy-full": "mmmm d, yyyy",
268
+ "named-mdy-abbr": "mmm d, yyyy",
269
+ "named-dmy-full": "d mmmm yyyy",
270
+ "named-dmy-abbr": "d mmm yyyy",
271
+ "named-abbr-dashes": "mmm-d-yyyy"
268
272
  };
269
273
  ct.fa = map[df.formatType] || "dd/MM/yyyy";
270
274
  m = _ssf.default.format(ct.fa, v);
271
275
  } else {
272
- m = value.toString();
276
+ m = String(value);
273
277
  ct.fa = "General";
274
278
  ct.t = "g";
275
279
  }
276
280
  } else {
277
- m = value.toString();
281
+ m = String(value);
278
282
  ct.fa = "General";
279
283
  ct.t = "g";
280
284
  }
@@ -284,6 +288,7 @@ function update(fmt, v) {
284
288
  return _ssf.default.format(fmt, v);
285
289
  }
286
290
  function is_date(fmt, v) {
291
+ console.log(_ssf.default.is_date(fmt, v), "is_date");
287
292
  return _ssf.default.is_date(fmt, v);
288
293
  }
289
294
  function fuzzynum(s) {
@@ -1576,6 +1576,8 @@ function deleteSelectedCellText(ctx) {
1576
1576
  var cell = d[r][c];
1577
1577
  delete cell.m;
1578
1578
  delete cell.v;
1579
+ delete cell.fc;
1580
+ delete cell.un;
1579
1581
  if (cell.f != null) {
1580
1582
  delete cell.f;
1581
1583
  (0, _formula.delFunctionGroup)(ctx, r, c, ctx.currentSheetId);
@@ -1648,7 +1650,8 @@ function deleteSelectedCellFormat(ctx) {
1648
1650
  return "success";
1649
1651
  }
1650
1652
  function fillRightData(ctx) {
1651
- var _a, _b;
1653
+ var _a, _b, _c, _d;
1654
+ var _e, _f, _g;
1652
1655
  var allowEdit = (0, _utils.isAllowEdit)(ctx);
1653
1656
  if (allowEdit === false) {
1654
1657
  return "allowEdit";
@@ -1676,18 +1679,109 @@ function fillRightData(ctx) {
1676
1679
  var r2 = selection[s].row[1];
1677
1680
  var c1 = selection[s].column[0];
1678
1681
  var c2 = selection[s].column[1];
1682
+ var sheetIndex = (0, _utils.getSheetIndex)(ctx, ctx.currentSheetId);
1683
+ var file = sheetIndex != null ? ctx.luckysheetfile[sheetIndex] : null;
1684
+ var dataVerification = file === null || file === void 0 ? void 0 : file.dataVerification;
1685
+ var hyperlink = file === null || file === void 0 ? void 0 : file.hyperlink;
1686
+ var cdformat = file === null || file === void 0 ? void 0 : file.luckysheet_conditionformat_save;
1679
1687
  var isSingleCell = r1 === r2 && c1 === c2;
1680
1688
  if (isSingleCell) {
1681
1689
  if (c1 - 1 >= 0 && d[r1]) {
1690
+ var srcRow = r1;
1691
+ var srcCol = c1 - 1;
1682
1692
  var prev = d[r1][c1 - 1];
1683
1693
  d[r1][c1] = prev != null ? __assign({}, prev) : {};
1694
+ if (file != null) {
1695
+ var srcKey = "".concat(srcRow, "_").concat(srcCol);
1696
+ var tgtKey = "".concat(r1, "_").concat(c1);
1697
+ if (dataVerification != null) {
1698
+ var dv = dataVerification[srcKey];
1699
+ if (dv != null) {
1700
+ console.log("[fillRightData] dataVerification copy from", {
1701
+ row: srcRow,
1702
+ col: srcCol
1703
+ }, "→", {
1704
+ row: r1,
1705
+ col: c1
1706
+ }, dv);
1707
+ file.dataVerification = __assign(__assign({}, file.dataVerification || {}), (_a = {}, _a[tgtKey] = _lodash.default.cloneDeep(dv), _a));
1708
+ }
1709
+ }
1710
+ if (hyperlink != null && hyperlink[srcKey] != null) {
1711
+ file.hyperlink = __assign(__assign({}, file.hyperlink || {}), (_b = {}, _b[tgtKey] = _lodash.default.cloneDeep(hyperlink[srcKey]), _b));
1712
+ var tgtCell = d[r1][c1];
1713
+ if (tgtCell != null) tgtCell.hl = {
1714
+ r: r1,
1715
+ c: c1,
1716
+ id: ctx.currentSheetId
1717
+ };
1718
+ }
1719
+ if (cdformat != null && cdformat.length > 0) {
1720
+ for (var i = 0; i < cdformat.length; i += 1) {
1721
+ var ranges = cdformat[i].cellrange;
1722
+ if (!ranges) continue;
1723
+ for (var j = 0; j < ranges.length; j += 1) {
1724
+ var cr = ranges[j];
1725
+ if (srcRow >= cr.row[0] && srcRow <= cr.row[1] && srcCol >= cr.column[0] && srcCol <= cr.column[1]) {
1726
+ ranges.push({
1727
+ row: [r1, r1],
1728
+ column: [c1, c1]
1729
+ });
1730
+ break;
1731
+ }
1732
+ }
1733
+ }
1734
+ }
1735
+ }
1684
1736
  }
1685
1737
  } else {
1686
1738
  for (var r = r1; r <= r2; r += 1) {
1687
- var sourceCell = (_a = d[r]) === null || _a === void 0 ? void 0 : _a[c1];
1739
+ var sourceCell = (_e = d[r]) === null || _e === void 0 ? void 0 : _e[c1];
1688
1740
  for (var c = c1 + 1; c <= c2; c += 1) {
1689
1741
  if (d[r]) {
1690
- d[r][c] = sourceCell != null ? __assign({}, sourceCell) : (_b = d[r][c]) !== null && _b !== void 0 ? _b : {};
1742
+ d[r][c] = sourceCell != null ? __assign({}, sourceCell) : (_f = d[r][c]) !== null && _f !== void 0 ? _f : {};
1743
+ }
1744
+ if (file != null) {
1745
+ var srcKey = "".concat(r, "_").concat(c1);
1746
+ var tgtKey = "".concat(r, "_").concat(c);
1747
+ if (dataVerification != null) {
1748
+ var dv = dataVerification[srcKey];
1749
+ if (dv != null) {
1750
+ console.log("[fillRightData] dataVerification copy from", {
1751
+ row: r,
1752
+ col: c1
1753
+ }, "→", {
1754
+ row: r,
1755
+ col: c
1756
+ }, dv);
1757
+ file.dataVerification = __assign(__assign({}, file.dataVerification || {}), (_c = {}, _c[tgtKey] = _lodash.default.cloneDeep(dv), _c));
1758
+ }
1759
+ }
1760
+ if (hyperlink != null && hyperlink[srcKey] != null) {
1761
+ file.hyperlink = __assign(__assign({}, file.hyperlink || {}), (_d = {}, _d[tgtKey] = _lodash.default.cloneDeep(hyperlink[srcKey]), _d));
1762
+ var tgtCell = (_g = d[r]) === null || _g === void 0 ? void 0 : _g[c];
1763
+ if (tgtCell != null) tgtCell.hl = {
1764
+ r: r,
1765
+ c: c,
1766
+ id: ctx.currentSheetId
1767
+ };
1768
+ }
1769
+ if (cdformat != null && cdformat.length > 0) {
1770
+ for (var i = 0; i < cdformat.length; i += 1) {
1771
+ var ranges = cdformat[i].cellrange;
1772
+ if (!ranges) continue;
1773
+ for (var j = 0; j < ranges.length; j += 1) {
1774
+ var cr = ranges[j];
1775
+ if (r >= cr.row[0] && r <= cr.row[1] && c1 >= cr.column[0] && c1 <= cr.column[1]) {
1776
+ ranges.push({
1777
+ row: [r, r],
1778
+ column: [c, c]
1779
+ });
1780
+ break;
1781
+ }
1782
+ }
1783
+ }
1784
+ }
1691
1785
  }
1692
1786
  }
1693
1787
  }
@@ -1697,7 +1791,8 @@ function fillRightData(ctx) {
1697
1791
  return "success";
1698
1792
  }
1699
1793
  function fillDownData(ctx) {
1700
- var _a, _b;
1794
+ var _a, _b, _c, _d;
1795
+ var _e, _f, _g;
1701
1796
  var allowEdit = (0, _utils.isAllowEdit)(ctx);
1702
1797
  if (allowEdit === false) {
1703
1798
  return "allowEdit";
@@ -1725,19 +1820,110 @@ function fillDownData(ctx) {
1725
1820
  var r2 = selection[s].row[1];
1726
1821
  var c1 = selection[s].column[0];
1727
1822
  var c2 = selection[s].column[1];
1823
+ var sheetIndex = (0, _utils.getSheetIndex)(ctx, ctx.currentSheetId);
1824
+ var file = sheetIndex != null ? ctx.luckysheetfile[sheetIndex] : null;
1825
+ var dataVerification = file === null || file === void 0 ? void 0 : file.dataVerification;
1826
+ var hyperlink = file === null || file === void 0 ? void 0 : file.hyperlink;
1827
+ var cdformat = file === null || file === void 0 ? void 0 : file.luckysheet_conditionformat_save;
1728
1828
  var isSingleCell = r1 === r2 && c1 === c2;
1729
1829
  if (isSingleCell) {
1730
1830
  if (r1 - 1 >= 0 && d[r1 - 1]) {
1831
+ var srcRow = r1 - 1;
1832
+ var srcCol = c1;
1731
1833
  var prev = d[r1 - 1][c1];
1732
1834
  if (!d[r1]) d[r1] = [];
1733
1835
  d[r1][c1] = prev != null ? __assign({}, prev) : {};
1836
+ if (file != null) {
1837
+ var srcKey = "".concat(srcRow, "_").concat(srcCol);
1838
+ var tgtKey = "".concat(r1, "_").concat(c1);
1839
+ if (dataVerification != null) {
1840
+ var dv = dataVerification[srcKey];
1841
+ if (dv != null) {
1842
+ console.log("[fillDownData] dataVerification copy from", {
1843
+ row: srcRow,
1844
+ col: srcCol
1845
+ }, "→", {
1846
+ row: r1,
1847
+ col: c1
1848
+ }, dv);
1849
+ file.dataVerification = __assign(__assign({}, file.dataVerification || {}), (_a = {}, _a[tgtKey] = _lodash.default.cloneDeep(dv), _a));
1850
+ }
1851
+ }
1852
+ if (hyperlink != null && hyperlink[srcKey] != null) {
1853
+ file.hyperlink = __assign(__assign({}, file.hyperlink || {}), (_b = {}, _b[tgtKey] = _lodash.default.cloneDeep(hyperlink[srcKey]), _b));
1854
+ var tgtCell = d[r1][c1];
1855
+ if (tgtCell != null) tgtCell.hl = {
1856
+ r: r1,
1857
+ c: c1,
1858
+ id: ctx.currentSheetId
1859
+ };
1860
+ }
1861
+ if (cdformat != null && cdformat.length > 0) {
1862
+ for (var i = 0; i < cdformat.length; i += 1) {
1863
+ var ranges = cdformat[i].cellrange;
1864
+ if (!ranges) continue;
1865
+ for (var j = 0; j < ranges.length; j += 1) {
1866
+ var cr = ranges[j];
1867
+ if (srcRow >= cr.row[0] && srcRow <= cr.row[1] && srcCol >= cr.column[0] && srcCol <= cr.column[1]) {
1868
+ ranges.push({
1869
+ row: [r1, r1],
1870
+ column: [c1, c1]
1871
+ });
1872
+ break;
1873
+ }
1874
+ }
1875
+ }
1876
+ }
1877
+ }
1734
1878
  }
1735
1879
  } else {
1736
1880
  for (var c = c1; c <= c2; c += 1) {
1737
- var sourceCell = (_a = d[r1]) === null || _a === void 0 ? void 0 : _a[c];
1881
+ var sourceCell = (_e = d[r1]) === null || _e === void 0 ? void 0 : _e[c];
1738
1882
  for (var r = r1 + 1; r <= r2; r += 1) {
1739
1883
  if (!d[r]) d[r] = [];
1740
- d[r][c] = sourceCell != null ? __assign({}, sourceCell) : (_b = d[r][c]) !== null && _b !== void 0 ? _b : {};
1884
+ d[r][c] = sourceCell != null ? __assign({}, sourceCell) : (_f = d[r][c]) !== null && _f !== void 0 ? _f : {};
1885
+ if (file != null) {
1886
+ var srcKey = "".concat(r1, "_").concat(c);
1887
+ var tgtKey = "".concat(r, "_").concat(c);
1888
+ if (dataVerification != null) {
1889
+ var dv = dataVerification[srcKey];
1890
+ if (dv != null) {
1891
+ console.log("[fillDownData] dataVerification copy from", {
1892
+ row: r1,
1893
+ col: c
1894
+ }, "→", {
1895
+ row: r,
1896
+ col: c
1897
+ }, dv);
1898
+ file.dataVerification = __assign(__assign({}, file.dataVerification || {}), (_c = {}, _c[tgtKey] = _lodash.default.cloneDeep(dv), _c));
1899
+ }
1900
+ }
1901
+ if (hyperlink != null && hyperlink[srcKey] != null) {
1902
+ file.hyperlink = __assign(__assign({}, file.hyperlink || {}), (_d = {}, _d[tgtKey] = _lodash.default.cloneDeep(hyperlink[srcKey]), _d));
1903
+ var tgtCell = (_g = d[r]) === null || _g === void 0 ? void 0 : _g[c];
1904
+ if (tgtCell != null) tgtCell.hl = {
1905
+ r: r,
1906
+ c: c,
1907
+ id: ctx.currentSheetId
1908
+ };
1909
+ }
1910
+ if (cdformat != null && cdformat.length > 0) {
1911
+ for (var i = 0; i < cdformat.length; i += 1) {
1912
+ var ranges = cdformat[i].cellrange;
1913
+ if (!ranges) continue;
1914
+ for (var j = 0; j < ranges.length; j += 1) {
1915
+ var cr = ranges[j];
1916
+ if (r1 >= cr.row[0] && r1 <= cr.row[1] && c >= cr.column[0] && c <= cr.column[1]) {
1917
+ ranges.push({
1918
+ row: [r, r],
1919
+ column: [c, c]
1920
+ });
1921
+ break;
1922
+ }
1923
+ }
1924
+ }
1925
+ }
1926
+ }
1741
1927
  }
1742
1928
  }
1743
1929
  }
@@ -84,6 +84,7 @@ var MONTH_NAME_MAP = {
84
84
  };
85
85
  var MONTH_NAMES_RE = "january|february|march|april|may|june|july|august|september|october|november|december|jan|feb|mar|apr|jun|jul|aug|sep|oct|nov|dec";
86
86
  var MONTH_ABBR_RE = "jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec";
87
+ var MONTH_ABBR_SET = new Set(MONTH_ABBR_RE.split("|"));
87
88
  function isValidDateParts(year, month, day) {
88
89
  if (year < 1900) return false;
89
90
  if (month < 1 || month > 12) return false;
@@ -298,6 +299,7 @@ function detectDateFormat(str) {
298
299
  var d = +m[2];
299
300
  var y = +m[3];
300
301
  if (mo && isValidDateParts(y, mo, d)) {
302
+ var isAbbr = MONTH_ABBR_SET.has(m[1].toLowerCase());
301
303
  return {
302
304
  year: y,
303
305
  month: mo,
@@ -305,7 +307,7 @@ function detectDateFormat(str) {
305
307
  hours: 0,
306
308
  minutes: 0,
307
309
  seconds: 0,
308
- formatType: "named"
310
+ formatType: isAbbr ? "named-mdy-abbr" : "named-mdy-full"
309
311
  };
310
312
  }
311
313
  }
@@ -315,6 +317,7 @@ function detectDateFormat(str) {
315
317
  var mo = MONTH_NAME_MAP[m[2].toLowerCase()];
316
318
  var y = +m[3];
317
319
  if (mo && isValidDateParts(y, mo, d)) {
320
+ var isAbbr = MONTH_ABBR_SET.has(m[2].toLowerCase());
318
321
  return {
319
322
  year: y,
320
323
  month: mo,
@@ -322,7 +325,7 @@ function detectDateFormat(str) {
322
325
  hours: 0,
323
326
  minutes: 0,
324
327
  seconds: 0,
325
- formatType: "named"
328
+ formatType: isAbbr ? "named-dmy-abbr" : "named-dmy-full"
326
329
  };
327
330
  }
328
331
  }
@@ -339,7 +342,7 @@ function detectDateFormat(str) {
339
342
  hours: 0,
340
343
  minutes: 0,
341
344
  seconds: 0,
342
- formatType: "named"
345
+ formatType: "named-abbr-dashes"
343
346
  };
344
347
  }
345
348
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fileverse-dev/fortune-core",
3
- "version": "1.3.6",
3
+ "version": "1.3.7-dateImport-2",
4
4
  "main": "lib/index.js",
5
5
  "module": "es/index.js",
6
6
  "typings": "lib/index.d.ts",
@@ -15,7 +15,7 @@
15
15
  "dev": "father-build --watch"
16
16
  },
17
17
  "dependencies": {
18
- "@fileverse-dev/formula-parser": "0.2.95",
18
+ "@fileverse-dev/formula-parser": "0.2.96",
19
19
  "dayjs": "^1.11.0",
20
20
  "immer": "^9.0.12",
21
21
  "lodash": "^4.17.21",