@fileverse-dev/fortune-react 1.0.2-mod-62 → 1.0.2-mod-63

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -5338,6 +5338,7 @@ var CustomColor = function CustomColor(_ref) {
5338
5338
  };
5339
5339
 
5340
5340
  var FormatSearch = function FormatSearch(_ref) {
5341
+ var _toolbarFormat$select, _toolbarFormat$select2;
5341
5342
  var type = _ref.type,
5342
5343
  _onCancel = _ref.onCancel;
5343
5344
  var _useContext = React.useContext(WorkbookContext),
@@ -5369,7 +5370,6 @@ var FormatSearch = function FormatSearch(_ref) {
5369
5370
  var toolbarFormat = React.useMemo(function () {
5370
5371
  return toolbarFormatAll[type];
5371
5372
  }, [toolbarFormatAll, type]);
5372
- var tips = ___default['default'].get(format, type);
5373
5373
  var onConfirm = React.useCallback(function () {
5374
5374
  if (decimalPlace < 0 || decimalPlace > 9) {
5375
5375
  _onCancel();
@@ -5405,60 +5405,62 @@ var FormatSearch = function FormatSearch(_ref) {
5405
5405
  _onCancel();
5406
5406
  }, [_onCancel, cellInput, setContext]);
5407
5407
  return /*#__PURE__*/React__default['default'].createElement("div", {
5408
- id: "luckysheet-search-format"
5409
- }, /*#__PURE__*/React__default['default'].createElement("div", {
5410
- className: "listbox",
5411
- style: {
5412
- height: 200
5413
- }
5408
+ className: "format-search"
5414
5409
  }, /*#__PURE__*/React__default['default'].createElement("div", {
5410
+ className: "flex flex-col gap-4"
5411
+ }, type === "currency" && (/*#__PURE__*/React__default['default'].createElement("div", {
5412
+ className: "flex items-center gap-2"
5413
+ }, /*#__PURE__*/React__default['default'].createElement("span", {
5414
+ className: "text-body-sm",
5415
5415
  style: {
5416
- marginBottom: 16
5416
+ width: "180px"
5417
5417
  }
5418
- }, tips, format.format, "\uFF1A"), /*#__PURE__*/React__default['default'].createElement("div", {
5419
- className: "inpbox",
5420
- style: type === "currency" ? {
5421
- display: "block"
5422
- } : {
5423
- display: "none"
5424
- }
5425
- }, format.decimalPlaces, "\uFF1A", /*#__PURE__*/React__default['default'].createElement("input", {
5426
- className: "decimal-places-input",
5427
- id: "decimal-places-input",
5418
+ }, format.decimalPlaces, "\uFF1A"), /*#__PURE__*/React__default['default'].createElement(ui.TextField, {
5419
+ className: "w-full",
5420
+ type: "number",
5428
5421
  min: 0,
5429
5422
  max: 9,
5430
5423
  defaultValue: 2,
5431
- type: "number",
5432
5424
  onChange: function onChange(e) {
5433
5425
  setDecimalPlace(parseInt(e.target.value, 10));
5434
5426
  }
5435
- })), /*#__PURE__*/React__default['default'].createElement("div", {
5436
- className: "format-list"
5437
- }, toolbarFormat.map(function (v, index) {
5438
- return /*#__PURE__*/React__default['default'].createElement("div", {
5439
- className: "listBox".concat(index === selectedFormatIndex ? " on" : ""),
5440
- key: v.name,
5441
- onClick: function onClick() {
5442
- setSelectedFormatIndex(index);
5443
- },
5444
- tabIndex: 0
5445
- }, /*#__PURE__*/React__default['default'].createElement("div", null, v.name), /*#__PURE__*/React__default['default'].createElement("div", null, v.value));
5446
5427
  }))), /*#__PURE__*/React__default['default'].createElement("div", {
5447
- className: "fortune-dialog-box-button-container",
5448
- style: type === "currency" ? {
5449
- marginTop: 40
5450
- } : {
5451
- marginTop: 30
5428
+ className: "flex flex-col gap-2"
5429
+ }, /*#__PURE__*/React__default['default'].createElement(ui.Select, {
5430
+ value: String(selectedFormatIndex),
5431
+ onValueChange: function onValueChange(value) {
5432
+ setSelectedFormatIndex(Number(value));
5452
5433
  }
5453
- }, /*#__PURE__*/React__default['default'].createElement("div", {
5454
- className: "fortune-message-box-button button-primary",
5455
- onClick: onConfirm,
5456
- tabIndex: 0
5457
- }, button.confirm), /*#__PURE__*/React__default['default'].createElement("div", {
5458
- className: "fortune-message-box-button button-default",
5434
+ }, /*#__PURE__*/React__default['default'].createElement(ui.SelectTrigger, {
5435
+ className: "w-full"
5436
+ }, /*#__PURE__*/React__default['default'].createElement(ui.SelectValue, null, (_toolbarFormat$select = toolbarFormat[selectedFormatIndex]) === null || _toolbarFormat$select === void 0 ? void 0 : _toolbarFormat$select.name, " ", (_toolbarFormat$select2 = toolbarFormat[selectedFormatIndex]) === null || _toolbarFormat$select2 === void 0 ? void 0 : _toolbarFormat$select2.value)), /*#__PURE__*/React__default['default'].createElement(ui.SelectContent, null, toolbarFormat.map(function (v, index) {
5437
+ return /*#__PURE__*/React__default['default'].createElement(ui.SelectItem, {
5438
+ key: v.name,
5439
+ value: String(index)
5440
+ }, /*#__PURE__*/React__default['default'].createElement("div", {
5441
+ className: "flex justify-between w-full"
5442
+ }, /*#__PURE__*/React__default['default'].createElement("span", null, v.name), /*#__PURE__*/React__default['default'].createElement("span", {
5443
+ className: "text-body-sm text-icon-secondary"
5444
+ }, v.value)));
5445
+ }))))), /*#__PURE__*/React__default['default'].createElement(ui.Divider, {
5446
+ className: "w-full border-t-[1px] my-4"
5447
+ }), /*#__PURE__*/React__default['default'].createElement("div", {
5448
+ className: "flex gap-2 justify-end"
5449
+ }, /*#__PURE__*/React__default['default'].createElement(ui.Button, {
5450
+ variant: "secondary",
5451
+ style: {
5452
+ minWidth: "80px"
5453
+ },
5459
5454
  onClick: onCancel,
5460
5455
  tabIndex: 0
5461
- }, button.cancel)));
5456
+ }, button.cancel), /*#__PURE__*/React__default['default'].createElement(ui.Button, {
5457
+ variant: "default",
5458
+ style: {
5459
+ minWidth: "80px"
5460
+ },
5461
+ onClick: onConfirm,
5462
+ tabIndex: 0
5463
+ }, button.confirm)));
5462
5464
  };
5463
5465
 
5464
5466
  var DuneChartsInputModal = function DuneChartsInputModal(_ref) {
@@ -5606,9 +5608,9 @@ var getLucideIcon = function getLucideIcon(title) {
5606
5608
  case "merge-all":
5607
5609
  return "MergeHorizontal";
5608
5610
  case "format":
5609
- return "JapaneseYen";
5611
+ return "DollarSign";
5610
5612
  case "currency-format":
5611
- return "JapaneseYen";
5613
+ return "DollarSign";
5612
5614
  case "percentage-format":
5613
5615
  return "Percent";
5614
5616
  case "number-decrease":
@@ -5666,6 +5668,10 @@ var Toolbar = function Toolbar(_ref) {
5666
5668
  _useState6 = _slicedToArray(_useState5, 2),
5667
5669
  showDuneModal = _useState6[0],
5668
5670
  setShowDuneModal = _useState6[1];
5671
+ var _useState7 = React.useState(window.innerWidth >= 1280),
5672
+ _useState8 = _slicedToArray(_useState7, 2),
5673
+ isDesktop = _useState8[0],
5674
+ setIsDesktop = _useState8[1];
5669
5675
  var _useDialog = useDialog(),
5670
5676
  showDialog = _useDialog.showDialog,
5671
5677
  hideDialog = _useDialog.hideDialog;
@@ -5696,12 +5702,12 @@ var Toolbar = function Toolbar(_ref) {
5696
5702
  var sheetWidth = context.luckysheetTableContentHW[0];
5697
5703
  var currency = settings.currency;
5698
5704
  var defaultFormat = defaultFmt(currency);
5699
- var _useState7 = React.useState("#000000"),
5700
- _useState8 = _slicedToArray(_useState7, 1),
5701
- customColor = _useState8[0];
5702
- var _useState9 = React.useState("1"),
5705
+ var _useState9 = React.useState("#000000"),
5703
5706
  _useState0 = _slicedToArray(_useState9, 1),
5704
- customStyle = _useState0[0];
5707
+ customColor = _useState0[0];
5708
+ var _useState1 = React.useState("1"),
5709
+ _useState10 = _slicedToArray(_useState1, 1),
5710
+ customStyle = _useState10[0];
5705
5711
  var showSubMenu = React.useCallback(function (e, className) {
5706
5712
  var target = e.target;
5707
5713
  var menuItem = target.className === "fortune-toolbar-menu-line" ? target.parentElement : target;
@@ -5729,6 +5735,15 @@ var Toolbar = function Toolbar(_ref) {
5729
5735
  if (___default['default'].isNil(subMenu)) return;
5730
5736
  subMenu.style.display = "none";
5731
5737
  }, []);
5738
+ React.useEffect(function () {
5739
+ var handleResize = function handleResize() {
5740
+ setIsDesktop(window.innerWidth >= 1280);
5741
+ };
5742
+ window.addEventListener("resize", handleResize);
5743
+ return function () {
5744
+ return window.removeEventListener("resize", handleResize);
5745
+ };
5746
+ }, []);
5732
5747
  React.useEffect(function () {
5733
5748
  setToolbarWrapIndex(-1);
5734
5749
  }, [settings.toolbarItems, settings.customToolbarItems]);
@@ -5749,6 +5764,11 @@ var Toolbar = function Toolbar(_ref) {
5749
5764
  }
5750
5765
  }, [toolbarWrapIndex, sheetWidth]);
5751
5766
  React.useEffect(function () {
5767
+ if (isDesktop) {
5768
+ setToolbarWrapIndex(-1);
5769
+ setMoreItems(null);
5770
+ return;
5771
+ }
5752
5772
  if (itemLocations.length === 0) return;
5753
5773
  var container = containerRef.current;
5754
5774
  if (!container) return;
@@ -5765,7 +5785,7 @@ var Toolbar = function Toolbar(_ref) {
5765
5785
  break;
5766
5786
  }
5767
5787
  }
5768
- }, [itemLocations, setMoreItems, settings.toolbarItems.length, sheetWidth]);
5788
+ }, [itemLocations, setMoreItems, settings.toolbarItems.length, sheetWidth, isDesktop]);
5769
5789
  var getToolbarItem = React.useCallback(function (name, i) {
5770
5790
  var _toolbarItemSelectedF;
5771
5791
  var tooltip = toolbar[name];
@@ -5877,7 +5897,7 @@ var Toolbar = function Toolbar(_ref) {
5877
5897
  showDialog(/*#__PURE__*/React__default['default'].createElement(FormatSearch, {
5878
5898
  onCancel: hideDialog,
5879
5899
  type: "currency"
5880
- }));
5900
+ }), undefined, "Currency Format");
5881
5901
  setOpen(false);
5882
5902
  }
5883
5903
  }].map(function (v) {
@@ -6848,9 +6868,9 @@ var Toolbar = function Toolbar(_ref) {
6848
6868
  }, n.children);
6849
6869
  }), ((_settings$customToolb = settings.customToolbarItems) === null || _settings$customToolb === void 0 ? void 0 : _settings$customToolb.length) > 0 ? (/*#__PURE__*/React__default['default'].createElement(Divider, {
6850
6870
  key: "customDivider"
6851
- })) : null, (toolbarWrapIndex === -1 ? settings.toolbarItems : settings.toolbarItems.slice(0, toolbarWrapIndex + 1)).map(function (name, i) {
6871
+ })) : null, (toolbarWrapIndex === -1 || isDesktop ? settings.toolbarItems : settings.toolbarItems.slice(0, toolbarWrapIndex + 1)).map(function (name, i) {
6852
6872
  return getToolbarItem(name, i);
6853
- }), toolbarWrapIndex !== -1 && toolbarWrapIndex < settings.toolbarItems.length - 1 ? (/*#__PURE__*/React__default['default'].createElement(Button, {
6873
+ }), !isDesktop && toolbarWrapIndex !== -1 && toolbarWrapIndex < settings.toolbarItems.length - 1 ? (/*#__PURE__*/React__default['default'].createElement(Button, {
6854
6874
  iconId: "Ellipsis",
6855
6875
  tooltip: toolbar.toolMore,
6856
6876
  onClick: function onClick() {
@@ -10713,21 +10733,10 @@ var ChangeColor = function ChangeColor(_ref) {
10713
10733
  var _useContext = React.useContext(WorkbookContext),
10714
10734
  context = _useContext.context,
10715
10735
  setContext = _useContext.setContext;
10716
- var _locale = fortuneCore.locale(context),
10717
- toolbar = _locale.toolbar,
10718
- sheetconfig = _locale.sheetconfig,
10719
- button = _locale.button;
10720
- var _useState = React.useState("#000000"),
10736
+ var _useState = React.useState(context.luckysheetfile[fortuneCore.getSheetIndex(context, context.currentSheetId)].color),
10721
10737
  _useState2 = _slicedToArray(_useState, 2),
10722
- inputColor = _useState2[0],
10723
- setInputColor = _useState2[1];
10724
- var _useState3 = React.useState(context.luckysheetfile[fortuneCore.getSheetIndex(context, context.currentSheetId)].color),
10725
- _useState4 = _slicedToArray(_useState3, 2),
10726
- selectColor = _useState4[0],
10727
- setSelectColor = _useState4[1];
10728
- var certainBtn = React.useCallback(function () {
10729
- setSelectColor(inputColor);
10730
- }, [inputColor]);
10738
+ selectColor = _useState2[0],
10739
+ setSelectColor = _useState2[1];
10731
10740
  React.useEffect(function () {
10732
10741
  setContext(function (ctx) {
10733
10742
  if (ctx.allowEdit === false) return;
@@ -10743,30 +10752,15 @@ var ChangeColor = function ChangeColor(_ref) {
10743
10752
  return setSelectColor(undefined);
10744
10753
  },
10745
10754
  tabIndex: 0
10746
- }, sheetconfig.resetColor), /*#__PURE__*/React__default['default'].createElement("div", {
10747
- className: "custom-color"
10748
- }, /*#__PURE__*/React__default['default'].createElement("div", null, toolbar.customColor, ":"), /*#__PURE__*/React__default['default'].createElement("input", {
10749
- type: "color",
10750
- value: inputColor,
10751
- onChange: function onChange(e) {
10752
- return setInputColor(e.target.value);
10753
- },
10754
- onFocus: function onFocus() {
10755
- triggerParentUpdate(true);
10756
- },
10757
- onBlur: function onBlur() {
10758
- triggerParentUpdate(false);
10759
- }
10760
- }), /*#__PURE__*/React__default['default'].createElement("div", {
10761
- className: "button-basic button-primary",
10762
- onClick: function onClick() {
10763
- certainBtn();
10764
- },
10765
- tabIndex: 0
10766
- }, button.confirm)), /*#__PURE__*/React__default['default'].createElement(ColorPicker, {
10755
+ }, /*#__PURE__*/React__default['default'].createElement(SVGIcon, {
10756
+ name: "reset-color",
10757
+ width: 16,
10758
+ height: 16
10759
+ }), "Reset"), /*#__PURE__*/React__default['default'].createElement(ColorPicker, {
10767
10760
  onPick: function onPick(color) {
10768
- setInputColor(color);
10761
+ triggerParentUpdate(true);
10769
10762
  setSelectColor(color);
10763
+ triggerParentUpdate(false);
10770
10764
  }
10771
10765
  }));
10772
10766
  };
@@ -10959,14 +10953,14 @@ var SheetTabContextMenu = function SheetTabContextMenu() {
10959
10953
  setIsShowChangeColor(false);
10960
10954
  }
10961
10955
  }
10962
- }, sheetconfig.changeColor, /*#__PURE__*/React__default['default'].createElement("span", {
10963
- className: "change-color-triangle"
10964
- }, /*#__PURE__*/React__default['default'].createElement(SVGIcon, {
10965
- name: "rightArrow",
10966
- width: 18
10967
- })), isShowChangeColor && context.allowEdit && (/*#__PURE__*/React__default['default'].createElement(ChangeColor, {
10956
+ }, /*#__PURE__*/React__default['default'].createElement("div", {
10957
+ className: "flex items-center justify-between w-full"
10958
+ }, sheetconfig.changeColor, /*#__PURE__*/React__default['default'].createElement(ui.LucideIcon, {
10959
+ name: "ChevronRight",
10960
+ size: "sm"
10961
+ }), isShowChangeColor && context.allowEdit && (/*#__PURE__*/React__default['default'].createElement(ChangeColor, {
10968
10962
  triggerParentUpdate: updateShowInputColor
10969
- })));
10963
+ }))));
10970
10964
  }
10971
10965
  if (name === "focus") {
10972
10966
  return /*#__PURE__*/React__default['default'].createElement(Menu, {
@@ -2332,7 +2332,7 @@ input[type="number"].condition-rules-project-input {
2332
2332
 
2333
2333
  .fortune-toolbar-button:active,
2334
2334
  .fortune-toolbar-combo:active {
2335
- background-color: rgba(0, 0, 0, 0.12);
2335
+ /* background-color: rgba(0, 0, 0, 0.12); */
2336
2336
  cursor: pointer;
2337
2337
  }
2338
2338
 
@@ -2458,13 +2458,16 @@ input[type="number"].condition-rules-project-input {
2458
2458
  flex-direction: row;
2459
2459
  align-items: center;
2460
2460
  align-self: flex-end;
2461
- top: 40px;
2461
+ top: 32px;
2462
2462
  right: 0px;
2463
2463
  max-width: 348px;
2464
2464
  box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.2);
2465
2465
  background: white;
2466
2466
  flex-wrap: wrap;
2467
2467
  z-index: 1002;
2468
+ padding: 8px;
2469
+ border-radius: 8px;
2470
+ border: 1px solid hsl(var(--color-border-default));
2468
2471
  }
2469
2472
 
2470
2473
  .fortune-toolbar-subtext {
@@ -2505,9 +2508,9 @@ input[type="number"].condition-rules-project-input {
2505
2508
 
2506
2509
  #fortune-custom-color {
2507
2510
  min-width: 164px;
2508
- background: #fff;
2509
- border-radius: 4px;
2510
- border: 1px solid rgba(0, 0, 0, 0.2);
2511
+ background: hsl(var(--color-bg-default));
2512
+ border-radius: 8px;
2513
+ border: 1px solid hsl(var(--color-border-default));
2511
2514
  font-size: 12px;
2512
2515
  padding: 8px;
2513
2516
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
@@ -2532,7 +2535,7 @@ input[type="number"].condition-rules-project-input {
2532
2535
  background: white;
2533
2536
  padding: 4px 8px;
2534
2537
  height: 30px;
2535
- border-radius: 4px 4px 0px 0px;
2538
+ border-radius: 4px;
2536
2539
  display: flex;
2537
2540
  align-items: center;
2538
2541
  gap: 10px;
@@ -2542,7 +2545,8 @@ input[type="number"].condition-rules-project-input {
2542
2545
  }
2543
2546
 
2544
2547
  #fortune-custom-color .color-reset:hover {
2545
- background: rgb(230, 230, 230);
2548
+ background: hsl(var(--color-bg-default-hover));
2549
+ transition: all 0.2s ease-in-out;
2546
2550
  }
2547
2551
 
2548
2552
  #fortune-custom-color .custom-color {
@@ -3711,35 +3715,45 @@ label {
3711
3715
  .tippy-box[data-animation=fade][data-state=hidden]{opacity:0}[data-tippy-root]{max-width:calc(100vw - 10px)}.tippy-box{position:relative;background-color:#333;color:#fff;border-radius:4px;font-size:14px;line-height:1.4;white-space:normal;outline:0;transition-property:transform,visibility,opacity}.tippy-box[data-placement^=top]>.tippy-arrow{bottom:0}.tippy-box[data-placement^=top]>.tippy-arrow:before{bottom:-7px;left:0;border-width:8px 8px 0;border-top-color:initial;transform-origin:center top}.tippy-box[data-placement^=bottom]>.tippy-arrow{top:0}.tippy-box[data-placement^=bottom]>.tippy-arrow:before{top:-7px;left:0;border-width:0 8px 8px;border-bottom-color:initial;transform-origin:center bottom}.tippy-box[data-placement^=left]>.tippy-arrow{right:0}.tippy-box[data-placement^=left]>.tippy-arrow:before{border-width:8px 0 8px 8px;border-left-color:initial;right:-7px;transform-origin:center left}.tippy-box[data-placement^=right]>.tippy-arrow{left:0}.tippy-box[data-placement^=right]>.tippy-arrow:before{left:-7px;border-width:8px 8px 8px 0;border-right-color:initial;transform-origin:center right}.tippy-box[data-inertia][data-state=visible]{transition-timing-function:cubic-bezier(.54,1.5,.38,1.11)}.tippy-arrow{width:16px;height:16px;color:#333}.tippy-arrow:before{content:"";position:absolute;border-color:transparent;border-style:solid}.tippy-content{position:relative;padding:5px 9px;z-index:1}
3712
3716
  #fortune-change-color {
3713
3717
  min-width: 164px;
3714
- height: 252px;
3715
- background: rgb(240, 240, 240);
3718
+ background: hsl(var(--color-bg-default));
3716
3719
  position: absolute;
3717
- bottom: 10px;
3718
- left: 100px;
3720
+ top: -100px;
3721
+ left: 232px;
3719
3722
  border-radius: 6px;
3720
- box-shadow: 0 2px 4px rgb(0 0 0 / 20%);
3721
- border: 1px solid rgba(0, 0, 0, 0.2);
3723
+ padding: 8px;
3724
+ box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.2);
3725
+ border: 1px solid hsl(var(--color-border-default));
3726
+ display: flex;
3727
+ flex-direction: column;
3728
+ gap: 8px;
3722
3729
  }
3723
3730
 
3724
3731
  #fortune-change-color .color-reset {
3725
3732
  position: relative;
3726
- color: #333;
3733
+ color: hsl(var(--color-text-default));
3727
3734
  cursor: pointer;
3728
3735
  list-style: none;
3729
- padding: 10px;
3736
+ padding: 4px 8px;
3730
3737
  white-space: nowrap;
3731
- padding-left: 8px;
3732
3738
  vertical-align: middle;
3733
3739
  padding-right: 24px;
3734
3740
  -webkit-user-select: none;
3735
3741
  -moz-user-select: none;
3736
3742
  user-select: none;
3737
- border-radius: 6px;
3738
- background: white;
3743
+ border-radius: 4px;
3744
+ background: hsl(var(--color-bg-default));
3745
+ height: 30px;
3746
+ display: flex;
3747
+ align-items: center;
3748
+ gap: 10px;
3749
+ font-size: 14px;
3750
+ font-weight: 500;
3751
+ line-height: 20px;
3739
3752
  }
3740
3753
 
3741
3754
  #fortune-change-color .color-reset:hover {
3742
- background: rgb(230, 230, 230);
3755
+ background: hsl(var(--color-bg-default-hover));
3756
+ transition: all 0.2s ease-in-out;
3743
3757
  }
3744
3758
 
3745
3759
  #fortune-change-color .custom-color {