@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.
@@ -260,11 +260,7 @@ function setConditionRules(ctx, protection, generalDialog, conditionformat, rule
260
260
  cellrange: (_a = ctx.luckysheet_select_save) !== null && _a !== void 0 ? _a : [],
261
261
  format: {
262
262
  textColor: textColor,
263
- cellColor: cellColor,
264
- bold: rules.font.bold,
265
- italic: rules.font.italic,
266
- underline: rules.font.underline,
267
- strikethrough: rules.font.strikethrough
263
+ cellColor: cellColor
268
264
  },
269
265
  conditionName: conditionName,
270
266
  conditionRange: conditionRange,
@@ -565,11 +561,7 @@ function compute(ctx, ruleArr, d) {
565
561
  var conditionValue0 = ruleArr[i].conditionValue[0];
566
562
  var conditionValue1 = ruleArr[i].conditionValue[1];
567
563
  var textColor_1 = format.textColor,
568
- cellColor_1 = format.cellColor,
569
- bold_1 = format.bold,
570
- italic_1 = format.italic,
571
- underline_1 = format.underline,
572
- strikethrough_1 = format.strikethrough;
564
+ cellColor_1 = format.cellColor;
573
565
  for (var s = 0; s < cellrange.length; s += 1) {
574
566
  if (conditionName === "greaterThan" || conditionName === "greaterThanOrEqual" || conditionName === "lessThan" || conditionName === "lessThanOrEqual" || conditionName === "equal" || conditionName === "textContains") {
575
567
  for (var r = cellrange[s].row[0]; r <= cellrange[s].row[1]; r += 1) {
@@ -585,105 +577,60 @@ function compute(ctx, ruleArr, d) {
585
577
  if ("".concat(r, "_").concat(c) in computeMap) {
586
578
  computeMap["".concat(r, "_").concat(c)].textColor = textColor_1;
587
579
  computeMap["".concat(r, "_").concat(c)].cellColor = cellColor_1;
588
- computeMap["".concat(r, "_").concat(c)].bold = bold_1;
589
- computeMap["".concat(r, "_").concat(c)].italic = italic_1;
590
- computeMap["".concat(r, "_").concat(c)].underline = underline_1;
591
- computeMap["".concat(r, "_").concat(c)].strikethrough = strikethrough_1;
592
580
  } else {
593
581
  computeMap["".concat(r, "_").concat(c)] = {
594
582
  textColor: textColor_1,
595
- cellColor: cellColor_1,
596
- bold: bold_1,
597
- italic: italic_1,
598
- underline: underline_1,
599
- strikethrough: strikethrough_1
583
+ cellColor: cellColor_1
600
584
  };
601
585
  }
602
586
  } else if (conditionName === "greaterThanOrEqual" && compareGreaterThan(cell.v, conditionValue0, ">=")) {
603
587
  if ("".concat(r, "_").concat(c) in computeMap) {
604
588
  computeMap["".concat(r, "_").concat(c)].textColor = textColor_1;
605
589
  computeMap["".concat(r, "_").concat(c)].cellColor = cellColor_1;
606
- computeMap["".concat(r, "_").concat(c)].bold = bold_1;
607
- computeMap["".concat(r, "_").concat(c)].italic = italic_1;
608
- computeMap["".concat(r, "_").concat(c)].underline = underline_1;
609
- computeMap["".concat(r, "_").concat(c)].strikethrough = strikethrough_1;
610
590
  } else {
611
591
  computeMap["".concat(r, "_").concat(c)] = {
612
592
  textColor: textColor_1,
613
- cellColor: cellColor_1,
614
- bold: bold_1
593
+ cellColor: cellColor_1
615
594
  };
616
595
  }
617
596
  } else if (conditionName === "lessThan" && compareLessThan(cell.v, conditionValue0, "<")) {
618
597
  if ("".concat(r, "_").concat(c) in computeMap) {
619
598
  computeMap["".concat(r, "_").concat(c)].textColor = textColor_1;
620
599
  computeMap["".concat(r, "_").concat(c)].cellColor = cellColor_1;
621
- computeMap["".concat(r, "_").concat(c)].bold = bold_1;
622
- computeMap["".concat(r, "_").concat(c)].italic = italic_1;
623
- computeMap["".concat(r, "_").concat(c)].underline = underline_1;
624
- computeMap["".concat(r, "_").concat(c)].strikethrough = strikethrough_1;
625
600
  } else {
626
601
  computeMap["".concat(r, "_").concat(c)] = {
627
602
  textColor: textColor_1,
628
- cellColor: cellColor_1,
629
- bold: bold_1,
630
- italic: italic_1,
631
- underline: underline_1,
632
- strikethrough: strikethrough_1
603
+ cellColor: cellColor_1
633
604
  };
634
605
  }
635
606
  } else if (conditionName === "lessThanOrEqual" && compareLessThan(cell.v, conditionValue0, "<=")) {
636
607
  if ("".concat(r, "_").concat(c) in computeMap) {
637
608
  computeMap["".concat(r, "_").concat(c)].textColor = textColor_1;
638
609
  computeMap["".concat(r, "_").concat(c)].cellColor = cellColor_1;
639
- computeMap["".concat(r, "_").concat(c)].bold = bold_1;
640
- computeMap["".concat(r, "_").concat(c)].italic = italic_1;
641
- computeMap["".concat(r, "_").concat(c)].underline = underline_1;
642
- computeMap["".concat(r, "_").concat(c)].strikethrough = strikethrough_1;
643
610
  } else {
644
611
  computeMap["".concat(r, "_").concat(c)] = {
645
612
  textColor: textColor_1,
646
- cellColor: cellColor_1,
647
- bold: bold_1,
648
- italic: italic_1,
649
- underline: underline_1,
650
- strikethrough: strikethrough_1
613
+ cellColor: cellColor_1
651
614
  };
652
615
  }
653
616
  } else if (conditionName === "equal" && cell.v.toString() === conditionValue0) {
654
617
  if ("".concat(r, "_").concat(c) in computeMap) {
655
618
  computeMap["".concat(r, "_").concat(c)].textColor = textColor_1;
656
619
  computeMap["".concat(r, "_").concat(c)].cellColor = cellColor_1;
657
- computeMap["".concat(r, "_").concat(c)].bold = bold_1;
658
- computeMap["".concat(r, "_").concat(c)].italic = italic_1;
659
- computeMap["".concat(r, "_").concat(c)].underline = underline_1;
660
- computeMap["".concat(r, "_").concat(c)].strikethrough = strikethrough_1;
661
620
  } else {
662
621
  computeMap["".concat(r, "_").concat(c)] = {
663
622
  textColor: textColor_1,
664
- cellColor: cellColor_1,
665
- bold: bold_1,
666
- italic: italic_1,
667
- underline: underline_1,
668
- strikethrough: strikethrough_1
623
+ cellColor: cellColor_1
669
624
  };
670
625
  }
671
626
  } else if (conditionName === "textContains" && cell.v.toString().indexOf(conditionValue0) !== -1) {
672
627
  if ("".concat(r, "_").concat(c) in computeMap) {
673
628
  computeMap["".concat(r, "_").concat(c)].textColor = textColor_1;
674
629
  computeMap["".concat(r, "_").concat(c)].cellColor = cellColor_1;
675
- computeMap["".concat(r, "_").concat(c)].bold = bold_1;
676
- computeMap["".concat(r, "_").concat(c)].italic = italic_1;
677
- computeMap["".concat(r, "_").concat(c)].underline = underline_1;
678
- computeMap["".concat(r, "_").concat(c)].strikethrough = strikethrough_1;
679
630
  } else {
680
631
  computeMap["".concat(r, "_").concat(c)] = {
681
632
  textColor: textColor_1,
682
- cellColor: cellColor_1,
683
- bold: bold_1,
684
- italic: italic_1,
685
- underline: underline_1,
686
- strikethrough: strikethrough_1
633
+ cellColor: cellColor_1
687
634
  };
688
635
  }
689
636
  }
@@ -703,18 +650,10 @@ function compute(ctx, ruleArr, d) {
703
650
  if ("".concat(r, "_").concat(c) in computeMap) {
704
651
  computeMap["".concat(r, "_").concat(c)].textColor = textColor_1;
705
652
  computeMap["".concat(r, "_").concat(c)].cellColor = cellColor_1;
706
- computeMap["".concat(r, "_").concat(c)].bold = bold_1;
707
- computeMap["".concat(r, "_").concat(c)].italic = italic_1;
708
- computeMap["".concat(r, "_").concat(c)].underline = underline_1;
709
- computeMap["".concat(r, "_").concat(c)].strikethrough = strikethrough_1;
710
653
  } else {
711
654
  computeMap["".concat(r, "_").concat(c)] = {
712
655
  textColor: textColor_1,
713
- cellColor: cellColor_1,
714
- bold: bold_1,
715
- italic: italic_1,
716
- underline: underline_1,
717
- strikethrough: strikethrough_1
656
+ cellColor: cellColor_1
718
657
  };
719
658
  }
720
659
  }
@@ -742,18 +681,10 @@ function compute(ctx, ruleArr, d) {
742
681
  if ("".concat(r, "_").concat(c) in computeMap) {
743
682
  computeMap["".concat(r, "_").concat(c)].textColor = textColor_1;
744
683
  computeMap["".concat(r, "_").concat(c)].cellColor = cellColor_1;
745
- computeMap["".concat(r, "_").concat(c)].bold = bold_1;
746
- computeMap["".concat(r, "_").concat(c)].italic = italic_1;
747
- computeMap["".concat(r, "_").concat(c)].underline = underline_1;
748
- computeMap["".concat(r, "_").concat(c)].strikethrough = strikethrough_1;
749
684
  } else {
750
685
  computeMap["".concat(r, "_").concat(c)] = {
751
686
  textColor: textColor_1,
752
- cellColor: cellColor_1,
753
- bold: bold_1,
754
- italic: italic_1,
755
- underline: underline_1,
756
- strikethrough: strikethrough_1
687
+ cellColor: cellColor_1
757
688
  };
758
689
  }
759
690
  }
@@ -772,9 +703,6 @@ function compute(ctx, ruleArr, d) {
772
703
  r: r,
773
704
  c: c
774
705
  });
775
- computeMap["".concat(r, "_").concat(c)] = __assign(__assign({}, computeMap["".concat(r, "_").concat(c)]), {
776
- bold: bold_1
777
- });
778
706
  }
779
707
  }
780
708
  if (conditionValue0 === "0") {
@@ -784,18 +712,10 @@ function compute(ctx, ruleArr, d) {
784
712
  if ("".concat(x[j].r, "_").concat(x[j].c) in computeMap) {
785
713
  computeMap["".concat(x[j].r, "_").concat(x[j].c)].textColor = textColor_1;
786
714
  computeMap["".concat(x[j].r, "_").concat(x[j].c)].cellColor = cellColor_1;
787
- computeMap["".concat(x[j].r, "_").concat(x[j].c)].bold = bold_1;
788
- computeMap["".concat(x[j].r, "_").concat(x[j].c)].italic = italic_1;
789
- computeMap["".concat(x[j].r, "_").concat(x[j].c)].underline = underline_1;
790
- computeMap["".concat(x[j].r, "_").concat(x[j].c)].strikethrough = strikethrough_1;
791
715
  } else {
792
716
  computeMap["".concat(x[j].r, "_").concat(x[j].c)] = {
793
717
  textColor: textColor_1,
794
- cellColor: cellColor_1,
795
- bold: bold_1,
796
- italic: italic_1,
797
- underline: underline_1,
798
- strikethrough: strikethrough_1
718
+ cellColor: cellColor_1
799
719
  };
800
720
  }
801
721
  }
@@ -807,18 +727,10 @@ function compute(ctx, ruleArr, d) {
807
727
  if ("".concat(x[0].r, "_").concat(x[0].c) in computeMap) {
808
728
  computeMap["".concat(x[0].r, "_").concat(x[0].c)].textColor = textColor_1;
809
729
  computeMap["".concat(x[0].r, "_").concat(x[0].c)].cellColor = cellColor_1;
810
- computeMap["".concat(x[0].r, "_").concat(x[0].c)].bold = bold_1;
811
- computeMap["".concat(x[0].r, "_").concat(x[0].c)].italic = italic_1;
812
- computeMap["".concat(x[0].r, "_").concat(x[0].c)].underline = underline_1;
813
- computeMap["".concat(x[0].r, "_").concat(x[0].c)].strikethrough = strikethrough_1;
814
730
  } else {
815
731
  computeMap["".concat(x[0].r, "_").concat(x[0].c)] = {
816
732
  textColor: textColor_1,
817
- cellColor: cellColor_1,
818
- bold: bold_1,
819
- italic: italic_1,
820
- underline: underline_1,
821
- strikethrough: strikethrough_1
733
+ cellColor: cellColor_1
822
734
  };
823
735
  }
824
736
  }
@@ -866,18 +778,10 @@ function compute(ctx, ruleArr, d) {
866
778
  if ("".concat(r, "_").concat(c) in computeMap) {
867
779
  computeMap["".concat(r, "_").concat(c)].textColor = textColor_1;
868
780
  computeMap["".concat(r, "_").concat(c)].cellColor = cellColor_1;
869
- computeMap["".concat(r, "_").concat(c)].bold = bold_1;
870
- computeMap["".concat(r, "_").concat(c)].italic = italic_1;
871
- computeMap["".concat(r, "_").concat(c)].underline = underline_1;
872
- computeMap["".concat(r, "_").concat(c)].strikethrough = strikethrough_1;
873
781
  } else {
874
782
  computeMap["".concat(r, "_").concat(c)] = {
875
783
  textColor: textColor_1,
876
- cellColor: cellColor_1,
877
- bold: bold_1,
878
- italic: italic_1,
879
- underline: underline_1,
880
- strikethrough: strikethrough_1
784
+ cellColor: cellColor_1
881
785
  };
882
786
  }
883
787
  }
@@ -900,18 +804,10 @@ function compute(ctx, ruleArr, d) {
900
804
  if ("".concat(r, "_").concat(c) in computeMap) {
901
805
  computeMap["".concat(r, "_").concat(c)].textColor = textColor_1;
902
806
  computeMap["".concat(r, "_").concat(c)].cellColor = cellColor_1;
903
- computeMap["".concat(r, "_").concat(c)].bold = bold_1;
904
- computeMap["".concat(r, "_").concat(c)].italic = italic_1;
905
- computeMap["".concat(r, "_").concat(c)].underline = underline_1;
906
- computeMap["".concat(r, "_").concat(c)].strikethrough = strikethrough_1;
907
807
  } else {
908
808
  computeMap["".concat(r, "_").concat(c)] = {
909
809
  textColor: textColor_1,
910
- cellColor: cellColor_1,
911
- bold: bold_1,
912
- italic: italic_1,
913
- underline: underline_1,
914
- strikethrough: strikethrough_1
810
+ cellColor: cellColor_1
915
811
  };
916
812
  }
917
813
  }
@@ -928,18 +824,10 @@ function compute(ctx, ruleArr, d) {
928
824
  if ("".concat(r, "_").concat(c) in computeMap) {
929
825
  computeMap["".concat(r, "_").concat(c)].textColor = textColor_1;
930
826
  computeMap["".concat(r, "_").concat(c)].cellColor = cellColor_1;
931
- computeMap["".concat(r, "_").concat(c)].bold = bold_1;
932
- computeMap["".concat(r, "_").concat(c)].italic = italic_1;
933
- computeMap["".concat(r, "_").concat(c)].underline = underline_1;
934
- computeMap["".concat(r, "_").concat(c)].strikethrough = strikethrough_1;
935
827
  } else {
936
828
  computeMap["".concat(r, "_").concat(c)] = {
937
829
  textColor: textColor_1,
938
- cellColor: cellColor_1,
939
- bold: bold_1,
940
- italic: italic_1,
941
- underline: underline_1,
942
- strikethrough: strikethrough_1
830
+ cellColor: cellColor_1
943
831
  };
944
832
  }
945
833
  }
@@ -978,18 +866,10 @@ function compute(ctx, ruleArr, d) {
978
866
  if ("".concat(r, "_").concat(c) in computeMap) {
979
867
  computeMap["".concat(r, "_").concat(c)].textColor = textColor_1;
980
868
  computeMap["".concat(r, "_").concat(c)].cellColor = cellColor_1;
981
- computeMap["".concat(r, "_").concat(c)].bold = bold_1;
982
- computeMap["".concat(r, "_").concat(c)].italic = italic_1;
983
- computeMap["".concat(r, "_").concat(c)].underline = underline_1;
984
- computeMap["".concat(r, "_").concat(c)].strikethrough = strikethrough_1;
985
869
  } else {
986
870
  computeMap["".concat(r, "_").concat(c)] = {
987
871
  textColor: textColor_1,
988
- cellColor: cellColor_1,
989
- bold: bold_1,
990
- italic: italic_1,
991
- underline: underline_1,
992
- strikethrough: strikethrough_1
872
+ cellColor: cellColor_1
993
873
  };
994
874
  }
995
875
  }
@@ -571,7 +571,7 @@ function cancelNormalSelected(ctx) {
571
571
  ctx.formulaCache.rangedrag_row_start = false;
572
572
  }
573
573
  function updateCell(ctx, r, c, $input, value, canvas) {
574
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
574
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
575
575
  if (ctx.allowEdit === false || ctx.isFlvReadOnly) return;
576
576
  var inputText = $input === null || $input === void 0 ? void 0 : $input.innerText;
577
577
  var inputHtml = $input === null || $input === void 0 ? void 0 : $input.innerHTML;
@@ -579,6 +579,13 @@ function updateCell(ctx, r, c, $input, value, canvas) {
579
579
  if (!flowdata) return;
580
580
  var index = (0, _utils.getSheetIndex)(ctx, ctx.currentSheetId);
581
581
  var dataVerification = ctx.luckysheetfile[index].dataVerification;
582
+ var sheetFile = ctx.luckysheetfile[index];
583
+ var getUrlFromText = function getUrlFromText(text) {
584
+ var t = (text !== null && text !== void 0 ? text : "").trim();
585
+ if (!t || /[\s\r\n]/.test(t)) return null;
586
+ if (!/^(https?:\/\/|www\.)\S+$/i.test(t)) return null;
587
+ return t.startsWith("http") ? t : "https://".concat(t);
588
+ };
582
589
  if (!_lodash.default.isNil(dataVerification)) {
583
590
  var dvItem = dataVerification["".concat(r, "_").concat(c)];
584
591
  if (!_lodash.default.isNil(dvItem) && dvItem.prohibitInput && !(0, _dataVerification.validateCellData)(ctx, dvItem, inputText)) {
@@ -836,13 +843,30 @@ function updateCell(ctx, r, c, $input, value, canvas) {
836
843
  } catch (e) {
837
844
  console.log("[updateCell] spill failed; falling back", e);
838
845
  }
846
+ var url = getUrlFromText($input === null || $input === void 0 ? void 0 : $input.innerText);
847
+ if (url && _typeof(value) === "object" && value) {
848
+ value.hl = 1;
849
+ if (!sheetFile.hyperlink) sheetFile.hyperlink = {};
850
+ sheetFile.hyperlink["".concat(r, "_").concat(c)] = {
851
+ linkType: "webpage",
852
+ linkAddress: url
853
+ };
854
+ if (typeof value.v !== "string") {
855
+ value.v = (_r = $input === null || $input === void 0 ? void 0 : $input.innerText) !== null && _r !== void 0 ? _r : url;
856
+ }
857
+ if (value.m == null) {
858
+ value.m = value.v;
859
+ }
860
+ if (value.fc == null) value.fc = "rgb(0, 0, 255)";
861
+ if (value.un == null) value.un = 1;
862
+ }
839
863
  setCellValue(ctx, r, c, d, value);
840
864
  cancelNormalSelected(ctx);
841
865
  if ((curv === null || curv === void 0 ? void 0 : curv.tb) === "2" && curv.v || (0, _inlineString.isInlineStringCell)(d[r][c])) {
842
866
  var defaultrowlen = ctx.defaultrowlen;
843
867
  var cfg = ctx.luckysheetfile[(0, _utils.getSheetIndex)(ctx, ctx.currentSheetId)].config || {};
844
- if (!(((_r = cfg.columnlen) === null || _r === void 0 ? void 0 : _r[c]) && ((_s = cfg.rowlen) === null || _s === void 0 ? void 0 : _s[r]))) {
845
- var cellWidth = ((_t = cfg.columnlen) === null || _t === void 0 ? void 0 : _t[c]) || ctx.defaultcollen;
868
+ if (!(((_s = cfg.columnlen) === null || _s === void 0 ? void 0 : _s[c]) && ((_t = cfg.rowlen) === null || _t === void 0 ? void 0 : _t[r]))) {
869
+ var cellWidth = ((_u = cfg.columnlen) === null || _u === void 0 ? void 0 : _u[c]) || ctx.defaultcollen;
846
870
  var textInfo = canvas ? (0, _text.getCellTextInfo)(d[r][c], canvas, ctx, {
847
871
  r: r,
848
872
  c: c,
@@ -853,7 +877,7 @@ function updateCell(ctx, r, c, $input, value, canvas) {
853
877
  currentRowLen = textInfo.textHeightAll + 2;
854
878
  }
855
879
  var previousRowHeight = (0, _api.getRowHeight)(ctx, [r])[r];
856
- if (currentRowLen > defaultrowlen && !((_u = cfg.customHeight) === null || _u === void 0 ? void 0 : _u[r]) && previousRowHeight < currentRowLen) {
880
+ if (currentRowLen > defaultrowlen && !((_v = cfg.customHeight) === null || _v === void 0 ? void 0 : _v[r]) && previousRowHeight < currentRowLen) {
857
881
  if (_lodash.default.isNil(cfg.rowlen)) cfg.rowlen = {};
858
882
  cfg.rowlen[r] = currentRowLen;
859
883
  }
@@ -357,7 +357,6 @@ function getCellTextInfo(cell, renderCtx, sheetCtx, option, ctx) {
357
357
  fontset = getFontSet(cell, sheetCtx.defaultFontSize, ctx);
358
358
  renderCtx.font = fontset;
359
359
  cancelLine = (0, _cell.normalizedCellAttr)(cell, "cl");
360
- console.log("cancelLine yoooo", cancelLine);
361
360
  underLine = (0, _cell.normalizedCellAttr)(cell, "un");
362
361
  fontSize = (0, _cell.normalizedCellAttr)(cell, "fs");
363
362
  if (cell instanceof Object) {
package/lib/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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fileverse-dev/fortune-core",
3
- "version": "1.2.64-patch-12",
3
+ "version": "1.2.65",
4
4
  "main": "lib/index.js",
5
5
  "module": "es/index.js",
6
6
  "typings": "lib/index.d.ts",