@fileverse-dev/fortune-react 1.0.2-mod-55-safe-patch-1 → 1.0.2-mod-57

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.esm.js CHANGED
@@ -1,8 +1,8 @@
1
- import { defaultContext, defaultSettings, getSheetIndex, colLocationByIndex, fixPositionOnFrozenCells, colLocation, getFlowdata, isAllowEdit, handleColumnHeaderMouseDown, handleColSizeHandleMouseDown, handleColFreezeHandleMouseDown, handleContextMenu, selectTitlesMap, selectTitlesRange, fixColumnStyleOverflowInFreeze, rowLocationByIndex, rowLocation, handleRowHeaderMouseDown, handleRowSizeHandleMouseDown, handleRowFreezeHandleMouseDown, fixRowStyleOverflowInFreeze, locale, getStyleByCell, getCellValue, createRangeHightlight, isInlineStringCell, getInlineStringHTML, valueShowEs, escapeHTMLTag, escapeScriptTag, moveToEnd, isShowHidenCR, getrangeseleciton, cancelNormalSelected, moveHighlightCell, israngeseleciton, handleFormulaInput, onSearchDialogMoveStart, replaceAll, replace, searchAll, searchNext, normalizeSelection, scrollToHighlightCell, isLinkValid, goToLink, replaceHtml, removeHyperlink, saveHyperlink, createFilterOptions, onImageMoveStart, onImageResizeStart, showComments, setEditingComment, onCommentBoxMoveStart, confirmMessage, getRangeByTxt, getDropdownList, setCellValue, getRangetxt, setConditionRules, mergeBorder, setDropdownValue, onIframeMoveStart, onIframeResizeStart, onIframeMove, onIframeMoveEnd, onIframeResize, onIframeResizeEnd, handleCellAreaMouseDown, handleCellAreaDoubleClick, selectAll, showLinkCard, getCellRowColumn, getCellHyperlink, handleOverlayMouseMove, handleOverlayMouseUp, handleKeydownForZoom, handleOverlayTouchStart, handleOverlayTouchMove, handleOverlayTouchEnd, insertRowCol, drawArrow, onCellsMoveStart, createDropCellRange, updateContextWithSheetData, updateContextWithCanvas, initFreeze, Canvas, handleGlobalWheel, getDataArr, updateMoreCell, getRegStr, getOptionValue, getSelectRange, applyLocation, updateItem, update, sanitizeDuneUrl, normalizedCellAttr, updateFormat, handleTextSize, handleHorizontalAlign, handleVerticalAlign, handleScreenShot, showImgChooser, insertImage, editComment, deleteComment, showHideComment, showHideAllComments, newComment, handleSum, autoSelectionFormula, handleMerge, handleBorder, handleFreeze, handleSort, createFilter, clearFilter, toolbarItemSelectedFunc, toolbarItemClickHandler, insertDuneChart, handleTextColor, handleTextBackground, getInlineStringNoStyle, rangeHightlightselected, updateCell, editSheetName, cancelActiveImgItem, MAX_ZOOM_RATIO, MIN_ZOOM_RATIO, addSheet, getFreezeState, toggleFreeze, jfrefreshgrid, handleCopy, removeActiveImage, deleteSelectedCellText, deleteRowCol, hideSelected, showSelected, api, sortSelection, handleLink, handlePasteByClick, deleteSheet, opToPatch, setCaretPosition, orderbydatafiler, getFilterColumnValues, getFilterColumnColors, saveFilter, calcSelectionInfo, patchToOp, filterPatch, inverseRowColOptions, ensureSheetIndex, initSheetIndex, handleGlobalKeyDown, handlePaste, groupValuesRefresh } from '@fileverse-dev/fortune-core';
1
+ import { defaultContext, defaultSettings, getSheetIndex, colLocationByIndex, fixPositionOnFrozenCells, colLocation, getFlowdata, isAllowEdit, handleColumnHeaderMouseDown, handleColSizeHandleMouseDown, handleColFreezeHandleMouseDown, handleContextMenu, selectTitlesMap, selectTitlesRange, fixColumnStyleOverflowInFreeze, rowLocationByIndex, rowLocation, handleRowHeaderMouseDown, handleRowSizeHandleMouseDown, handleRowFreezeHandleMouseDown, fixRowStyleOverflowInFreeze, locale, getStyleByCell, getCellValue, createRangeHightlight, isInlineStringCell, getInlineStringHTML, valueShowEs, escapeHTMLTag, escapeScriptTag, moveToEnd, isShowHidenCR, getrangeseleciton, cancelNormalSelected, moveHighlightCell, israngeseleciton, handleFormulaInput, onSearchDialogMoveStart, replaceAll, replace, searchAll, searchNext, normalizeSelection, scrollToHighlightCell, isLinkValid, goToLink, replaceHtml, removeHyperlink, saveHyperlink, createFilterOptions, onImageMoveStart, onImageResizeStart, showComments, setEditingComment, onCommentBoxMoveStart, confirmMessage, getRangeByTxt, getDropdownList, setCellValue, getRangetxt, setConditionRules, mergeBorder, setDropdownValue, onIframeMoveStart, onIframeResizeStart, onIframeMove, onIframeMoveEnd, onIframeResize, onIframeResizeEnd, handleCellAreaMouseDown, handleCellAreaDoubleClick, selectAll, showLinkCard, getCellRowColumn, getCellHyperlink, handleOverlayMouseMove, handleOverlayMouseUp, handleKeydownForZoom, handleOverlayTouchStart, handleOverlayTouchMove, handleOverlayTouchEnd, insertRowCol, drawArrow, onCellsMoveStart, createDropCellRange, updateContextWithSheetData, updateContextWithCanvas, initFreeze, Canvas, handleGlobalWheel, getDataArr, updateMoreCell, getRegStr, getOptionValue, getSelectRange, applyLocation, updateItem, update, sanitizeDuneUrl, normalizedCellAttr, updateFormat, handleTextSize, handleHorizontalAlign, handleVerticalAlign, handleScreenShot, showImgChooser, insertImage, editComment, deleteComment, showHideComment, showHideAllComments, newComment, handleSum, autoSelectionFormula, handleMerge, handleBorder, handleFreeze, handleSort, createFilter, clearFilter, toolbarItemSelectedFunc, toolbarItemClickHandler, insertDuneChart, handleTextColor, handleTextBackground, getInlineStringNoStyle, rangeHightlightselected, updateCell, editSheetName, cancelActiveImgItem, MAX_ZOOM_RATIO, MIN_ZOOM_RATIO, addSheet, api, getFreezeState, toggleFreeze, jfrefreshgrid, handleCopy, removeActiveImage, deleteSelectedCellText, deleteRowCol, hideSelected, showSelected, sortSelection, handleLink, handlePasteByClick, deleteSheet, opToPatch, setCaretPosition, orderbydatafiler, getFilterColumnValues, getFilterColumnColors, saveFilter, calcSelectionInfo, patchToOp, filterPatch, inverseRowColOptions, ensureSheetIndex, initSheetIndex, handleGlobalKeyDown, handlePaste, groupValuesRefresh } from '@fileverse-dev/fortune-core';
2
2
  import React, { useContext, useRef, useState, useMemo, useCallback, useEffect, useLayoutEffect, useImperativeHandle } from 'react';
3
3
  import produce, { applyPatches, enablePatches, produceWithPatches } from 'immer';
4
4
  import _ from 'lodash';
5
- import { LucideIcon, TextField, Button as Button$1, cn, IconButton, Checkbox, Divider as Divider$2, Table, TableHeader, TableRow, TableHead, TableBody, TableCell, Select as Select$1, SelectTrigger, SelectValue, SelectContent, SelectItem as SelectItem$1 } from '@fileverse/ui';
5
+ import { LucideIcon, TextField, Button as Button$1, cn, IconButton, Checkbox, Divider as Divider$2, Table, TableHeader, TableRow, TableHead, TableBody, TableCell, Select as Select$1, SelectTrigger, SelectValue, SelectContent, SelectItem as SelectItem$1, Tooltip, RadioGroup, RadioGroupItem, Label } from '@fileverse/ui';
6
6
  import regeneratorRuntime from 'regenerator-runtime';
7
7
  import Tippy from '@tippyjs/react';
8
8
 
@@ -269,6 +269,15 @@ function _toPropertyKey(t) {
269
269
  var i = _toPrimitive(t, "string");
270
270
  return "symbol" == typeof i ? i : i + "";
271
271
  }
272
+ function _typeof(o) {
273
+ "@babel/helpers - typeof";
274
+
275
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
276
+ return typeof o;
277
+ } : function (o) {
278
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
279
+ }, _typeof(o);
280
+ }
272
281
  function _unsupportedIterableToArray(r, a) {
273
282
  if (r) {
274
283
  if ("string" == typeof r) return _arrayLikeToArray(r, a);
@@ -4434,26 +4443,25 @@ var Button = function Button(_ref) {
4434
4443
  selected = _ref.selected,
4435
4444
  children = _ref.children,
4436
4445
  style = _ref.style;
4437
- return /*#__PURE__*/React.createElement("div", {
4446
+ return /*#__PURE__*/React.createElement(Tooltip, {
4447
+ text: tooltip,
4448
+ placement: "bottom"
4449
+ }, /*#__PURE__*/React.createElement("div", {
4438
4450
  className: "fortune-toolbar-button fortune-toolbar-item",
4439
4451
  onClick: onClick,
4440
4452
  tabIndex: 0,
4441
- "data-tips": tooltip,
4442
4453
  role: "button",
4443
- "aria-label": tooltip,
4444
4454
  style: selected ? {
4445
4455
  backgroundColor: "#E7E5EB"
4446
4456
  } : style
4447
- }, /*#__PURE__*/React.createElement(SVGIcon, {
4448
- name: iconId,
4457
+ }, /*#__PURE__*/React.createElement(LucideIcon, {
4458
+ name: getLucideIcon(iconId),
4449
4459
  width: 16,
4450
4460
  height: 16,
4451
4461
  style: disabled ? {
4452
4462
  opacity: 0.3
4453
4463
  } : {}
4454
- }), tooltip && /*#__PURE__*/React.createElement("div", {
4455
- className: "fortune-tooltip"
4456
- }, tooltip), children);
4464
+ }), children));
4457
4465
  };
4458
4466
 
4459
4467
  var Divider = function Divider() {
@@ -4491,7 +4499,7 @@ var Combo = function Combo(_ref) {
4491
4499
  var popupRef = useRef(null);
4492
4500
  var buttonRef = useRef(null);
4493
4501
  var isLucideIcon = useMemo(function () {
4494
- return (iconId === null || iconId === void 0 ? void 0 : iconId.startsWith("align-")) || ["text-overflow", "text-wrap", "text-clip"].includes(iconId);
4502
+ return (iconId === null || iconId === void 0 ? void 0 : iconId.startsWith("align-")) || ["text-overflow", "text-wrap", "text-clip", "font-color", "background", "border-all", "merge-all", "format", "conditionFormat", "filter", "comment", "image", "formula-sum", "dune", "template"].includes(iconId);
4495
4503
  }, [iconId]);
4496
4504
  useOutsideClick(popupRef, function () {
4497
4505
  setOpen(false);
@@ -4520,7 +4528,10 @@ var Combo = function Combo(_ref) {
4520
4528
  }, /*#__PURE__*/React.createElement("div", {
4521
4529
  ref: buttonRef,
4522
4530
  className: "fortune-toolbar-combo"
4523
- }, !isLucideIcon ? (/*#__PURE__*/React.createElement("div", {
4531
+ }, !isLucideIcon ? (/*#__PURE__*/React.createElement(Tooltip, {
4532
+ text: tooltip,
4533
+ placement: "bottom"
4534
+ }, /*#__PURE__*/React.createElement("div", {
4524
4535
  className: "fortune-toolbar-combo-button",
4525
4536
  onClick: function onClick(e) {
4526
4537
  if (_onClick) {
@@ -4531,9 +4542,7 @@ var Combo = function Combo(_ref) {
4531
4542
  }
4532
4543
  },
4533
4544
  tabIndex: 0,
4534
- "data-tips": tooltip,
4535
4545
  role: "button",
4536
- "aria-label": "".concat(tooltip, ": ").concat(text !== undefined ? text : ""),
4537
4546
  style: style
4538
4547
  }, iconId ? (/*#__PURE__*/React.createElement(SVGIcon, {
4539
4548
  name: iconId,
@@ -4541,29 +4550,29 @@ var Combo = function Combo(_ref) {
4541
4550
  height: 16
4542
4551
  })) : (/*#__PURE__*/React.createElement("span", {
4543
4552
  className: "fortune-toolbar-combo-text"
4544
- }, text !== undefined ? text : "")))) : (/*#__PURE__*/React.createElement(IconButton, {
4545
- icon: getIcon(iconId),
4553
+ }, text !== undefined ? text : ""))))) : (/*#__PURE__*/React.createElement(Tooltip, {
4554
+ text: tooltip,
4555
+ placement: "bottom"
4556
+ }, /*#__PURE__*/React.createElement(IconButton, {
4557
+ icon: getLucideIcon(iconId),
4546
4558
  variant: "ghost",
4547
4559
  onClick: function onClick() {
4548
4560
  return setOpen(!open);
4549
- }
4550
- })), showArrow && (/*#__PURE__*/React.createElement("div", {
4561
+ },
4562
+ className: showArrow ? "fortune-toolbar-combo-button show-arrow" : ""
4563
+ }))), showArrow && (/*#__PURE__*/React.createElement("div", {
4551
4564
  className: "fortune-toolbar-combo-arrow",
4552
4565
  onClick: function onClick() {
4553
4566
  return setOpen(!open);
4554
4567
  },
4555
4568
  tabIndex: 0,
4556
- "data-tips": tooltip,
4557
4569
  role: "button",
4558
- "aria-label": tooltip,
4559
4570
  style: style
4560
4571
  }, /*#__PURE__*/React.createElement(LucideIcon, {
4561
4572
  name: "ChevronDown",
4562
4573
  width: 14,
4563
4574
  height: 14
4564
- }))), tooltip && /*#__PURE__*/React.createElement("div", {
4565
- className: "fortune-tooltip"
4566
- }, tooltip)), open && (/*#__PURE__*/React.createElement("div", {
4575
+ })))), open && (/*#__PURE__*/React.createElement("div", {
4567
4576
  ref: popupRef,
4568
4577
  className: "fortune-toolbar-combo-popup",
4569
4578
  style: popupPosition
@@ -4719,7 +4728,8 @@ var SplitColumn = function SplitColumn() {
4719
4728
  tabIndex: 0
4720
4729
  }), /*#__PURE__*/React.createElement("label", {
4721
4730
  htmlFor: "other"
4722
- }, "Custom"), /*#__PURE__*/React.createElement("input", {
4731
+ }, "Custom"), /*#__PURE__*/React.createElement(TextField, {
4732
+ placeholder: "Custom separator",
4723
4733
  id: "otherValue",
4724
4734
  name: "otherValue",
4725
4735
  type: "text",
@@ -5246,11 +5256,13 @@ var CustomButton = function CustomButton(_ref) {
5246
5256
  children = _ref.children,
5247
5257
  iconName = _ref.iconName,
5248
5258
  icon = _ref.icon;
5249
- return /*#__PURE__*/React.createElement("div", {
5259
+ return /*#__PURE__*/React.createElement(Tooltip, {
5260
+ text: tooltip,
5261
+ placement: "bottom"
5262
+ }, /*#__PURE__*/React.createElement("div", {
5250
5263
  className: "fortune-toolbar-button fortune-toolbar-item",
5251
5264
  onClick: onClick,
5252
5265
  tabIndex: 0,
5253
- "data-tips": tooltip,
5254
5266
  role: "button",
5255
5267
  style: selected ? {
5256
5268
  backgroundColor: "#E7E5EB"
@@ -5260,9 +5272,7 @@ var CustomButton = function CustomButton(_ref) {
5260
5272
  height: 16,
5261
5273
  iconName: iconName,
5262
5274
  content: icon
5263
- }), tooltip && /*#__PURE__*/React.createElement("div", {
5264
- className: "fortune-tooltip"
5265
- }, tooltip), children);
5275
+ }), children));
5266
5276
  };
5267
5277
 
5268
5278
  var palette = [["#000000", "#444444", "#666666", "#999999", "#B7B7B7", "#cccccc", "#D9D9D9", "#EFEFEF", "#f3f3f3", "#ffffff"], ["#970007", "#FE0012", "#FE9728", "#FFFD40", "#27FD3C", "#21FFFF", "#4A89E4", "#0027F9", "#9726FA", "#FD23FA"], ["#E6B8B0", "#f4cccc", "#FCE5CF", "#FFF1CF", "#DAEAD4", "#D0E0E3", "#C9DBF7", "#CFE3F2", "#D9D3E8", "#EAD1DC"], ["#DC7D6D", "#E9999A", "#F9CAA0", "#FFE49F", "#B7D6AB", "#A3C4C9", "#A4C3F2", "#A0C6E6", "#B4A8D4", "#D5A7BC"], ["#CB402B", "#DF6668", "#F6B171", "#FFD871", "#95C382", "#77A6AF", "#6DA0E8", "#70AADA", "#8E7EC0", "#C17C9F"], ["#A51A0A", "#CB000C", "#E59043", "#F1C046", "#6CA756", "#46828D", "#3C7BD4", "#3E87C3", "#6651A4", "#A54E78"], ["#841F11", "#980007", "#B35E19", "#BF8F22", "#3A7527", "#15505B", "#0E5AC8", "#0B5592", "#0B5592", "#731C46"], ["#5B0E03", "#660003", "#783E0E", "#7F5F13", "#284E19", "#0D343D", "#1C4785", "#073961", "#1F154B", "#4C112F"]];
@@ -5528,8 +5538,33 @@ var DuneChartsInputModal = function DuneChartsInputModal(_ref) {
5528
5538
  }, submitText)))));
5529
5539
  };
5530
5540
 
5531
- var getIcon = function getIcon(title) {
5541
+ var MoreItemsContaier = function MoreItemsContaier(_ref) {
5542
+ var onClose = _ref.onClose,
5543
+ children = _ref.children;
5544
+ var containerRef = useRef(null);
5545
+ useOutsideClick(containerRef, function () {
5546
+ onClose === null || onClose === void 0 ? void 0 : onClose();
5547
+ }, [containerRef, onClose]);
5548
+ return /*#__PURE__*/React.createElement("div", {
5549
+ ref: containerRef,
5550
+ className: "fortune-toolbar-more-container"
5551
+ }, children);
5552
+ };
5553
+
5554
+ var getLucideIcon = function getLucideIcon(title) {
5532
5555
  switch (title) {
5556
+ case "undo":
5557
+ return "Undo";
5558
+ case "redo":
5559
+ return "Redo";
5560
+ case "bold":
5561
+ return "Bold";
5562
+ case "italic":
5563
+ return "Italic";
5564
+ case "strike-through":
5565
+ return "Strikethrough";
5566
+ case "underline":
5567
+ return "Underline";
5533
5568
  case "align-left":
5534
5569
  return "AlignLeft";
5535
5570
  case "align-center":
@@ -5548,6 +5583,44 @@ var getIcon = function getIcon(title) {
5548
5583
  return "WrapText";
5549
5584
  case "text-clip":
5550
5585
  return "TextClip";
5586
+ case "font-color":
5587
+ return "Baseline";
5588
+ case "background":
5589
+ return "PaintBucket";
5590
+ case "border-all":
5591
+ return "Border";
5592
+ case "merge-all":
5593
+ return "MergeHorizontal";
5594
+ case "format":
5595
+ return "JapaneseYen";
5596
+ case "currency-format":
5597
+ return "JapaneseYen";
5598
+ case "percentage-format":
5599
+ return "Percent";
5600
+ case "number-decrease":
5601
+ return "DecimalsArrowLeft";
5602
+ case "number-increase":
5603
+ return "DecimalsArrowRight";
5604
+ case "conditionFormat":
5605
+ return "PaintbrushVertical";
5606
+ case "filter":
5607
+ return "Filter";
5608
+ case "link":
5609
+ return "Link";
5610
+ case "comment":
5611
+ return "MessageSquarePlus";
5612
+ case "image":
5613
+ return "Image";
5614
+ case "formula-sum":
5615
+ return "Sigma";
5616
+ case "dataVerification":
5617
+ return "ShieldCheck";
5618
+ case "search":
5619
+ return "Search";
5620
+ case "dune":
5621
+ return "DuneChart";
5622
+ case "Ellipsis":
5623
+ return "Ellipsis";
5551
5624
  default:
5552
5625
  return "";
5553
5626
  }
@@ -5555,7 +5628,9 @@ var getIcon = function getIcon(title) {
5555
5628
  var Toolbar = function Toolbar(_ref) {
5556
5629
  var _context$luckysheet_s, _flowdata$row, _settings$customToolb;
5557
5630
  var setMoreItems = _ref.setMoreItems,
5558
- moreItemsOpen = _ref.moreItemsOpen;
5631
+ moreItemsOpen = _ref.moreItemsOpen,
5632
+ onMoreToolbarItemsClose = _ref.onMoreToolbarItemsClose,
5633
+ moreToolbarItems = _ref.moreToolbarItems;
5559
5634
  var _useContext = useContext(WorkbookContext),
5560
5635
  context = _useContext.context,
5561
5636
  setContext = _useContext.setContext,
@@ -5928,7 +6003,7 @@ var Toolbar = function Toolbar(_ref) {
5928
6003
  isActive: ((_$find2 = _.find(items, function (item) {
5929
6004
  return "".concat(item.value) === "".concat(cell === null || cell === void 0 ? void 0 : cell.ht);
5930
6005
  })) === null || _$find2 === void 0 ? void 0 : _$find2.title) === title,
5931
- icon: getIcon(title),
6006
+ icon: getLucideIcon(title),
5932
6007
  variant: "ghost",
5933
6008
  onClick: function onClick() {
5934
6009
  setContext(function (ctx) {
@@ -5981,7 +6056,7 @@ var Toolbar = function Toolbar(_ref) {
5981
6056
  isActive: ((_$find4 = _.find(_items, function (item) {
5982
6057
  return "".concat(item.value) === "".concat(cell === null || cell === void 0 ? void 0 : cell.vt);
5983
6058
  })) === null || _$find4 === void 0 ? void 0 : _$find4.title) === title,
5984
- icon: getIcon(title),
6059
+ icon: getLucideIcon(title),
5985
6060
  variant: "ghost",
5986
6061
  onClick: function onClick() {
5987
6062
  setContext(function (ctx) {
@@ -6573,7 +6648,7 @@ var Toolbar = function Toolbar(_ref) {
6573
6648
  return /*#__PURE__*/React.createElement(IconButton, {
6574
6649
  key: value,
6575
6650
  isActive: _curr.value === value,
6576
- icon: getIcon(iconId),
6651
+ icon: getLucideIcon(iconId),
6577
6652
  variant: "ghost",
6578
6653
  onClick: function onClick() {
6579
6654
  setContext(function (ctx) {
@@ -6725,7 +6800,10 @@ var Toolbar = function Toolbar(_ref) {
6725
6800
  }));
6726
6801
  });
6727
6802
  }
6728
- return /*#__PURE__*/React.createElement(Button, {
6803
+ return /*#__PURE__*/React.createElement(Tooltip, {
6804
+ text: tooltip,
6805
+ placement: "bottom"
6806
+ }, /*#__PURE__*/React.createElement(Button, {
6729
6807
  iconId: name,
6730
6808
  tooltip: tooltip,
6731
6809
  key: name,
@@ -6736,7 +6814,7 @@ var Toolbar = function Toolbar(_ref) {
6736
6814
  (_toolbarItemClickHand = toolbarItemClickHandler(name)) === null || _toolbarItemClickHand === void 0 ? void 0 : _toolbarItemClickHand(draftCtx, refs.cellInput.current, refs.globalCache);
6737
6815
  });
6738
6816
  }
6739
- });
6817
+ }));
6740
6818
  }, [toolbar, cell, setContext, refs.cellInput, refs.fxInput, refs.globalCache, defaultFormat, align, handleUndo, handleRedo, flowdata, formula, showDuneModal, merge, border, freezen, screenshot, sort, textWrap, rotation, filter, splitText, findAndReplace, context.luckysheet_select_save, context.defaultFontSize, context.allowEdit, comment, fontarray, hideSubMenu, showSubMenu, refs.canvas, customColor, customStyle, toolbarFormat.moreCurrency]);
6741
6819
  return /*#__PURE__*/React.createElement("div", {
6742
6820
  ref: containerRef,
@@ -6759,7 +6837,7 @@ var Toolbar = function Toolbar(_ref) {
6759
6837
  })) : null, (toolbarWrapIndex === -1 ? settings.toolbarItems : settings.toolbarItems.slice(0, toolbarWrapIndex + 1)).map(function (name, i) {
6760
6838
  return getToolbarItem(name, i);
6761
6839
  }), toolbarWrapIndex !== -1 && toolbarWrapIndex < settings.toolbarItems.length - 1 ? (/*#__PURE__*/React.createElement(Button, {
6762
- iconId: "more",
6840
+ iconId: "Ellipsis",
6763
6841
  tooltip: toolbar.toolMore,
6764
6842
  onClick: function onClick() {
6765
6843
  if (moreItemsOpen) {
@@ -6770,7 +6848,9 @@ var Toolbar = function Toolbar(_ref) {
6770
6848
  }));
6771
6849
  }
6772
6850
  }
6773
- })) : null), /*#__PURE__*/React.createElement("div", {
6851
+ })) : null, moreToolbarItems && (/*#__PURE__*/React.createElement(MoreItemsContaier, {
6852
+ onClose: onMoreToolbarItemsClose
6853
+ }, moreToolbarItems))), /*#__PURE__*/React.createElement("div", {
6774
6854
  className: "fortune-toolbar-right"
6775
6855
  }, settings.customToolbarItems.filter(function (n) {
6776
6856
  return n.key === "templates";
@@ -6793,7 +6873,7 @@ var Toolbar = function Toolbar(_ref) {
6793
6873
  iconName: n.iconName
6794
6874
  }, n.children);
6795
6875
  }), /*#__PURE__*/React.createElement(Button, {
6796
- iconId: "dune-logo",
6876
+ iconId: "dune",
6797
6877
  tooltip: "Insert Dune Chart",
6798
6878
  key: "dune-charts",
6799
6879
  onClick: function onClick() {
@@ -7485,6 +7565,135 @@ var SheetTab = function SheetTab() {
7485
7565
  }, /*#__PURE__*/React.createElement(ZoomControl, null)));
7486
7566
  };
7487
7567
 
7568
+ var ResetColumnWidth = function ResetColumnWidth() {
7569
+ var _useContext = useContext(WorkbookContext),
7570
+ context = _useContext.context,
7571
+ setContext = _useContext.setContext;
7572
+ var _useAlert = useAlert(),
7573
+ showAlert = _useAlert.showAlert;
7574
+ var _locale = locale(context),
7575
+ button = _locale.button;
7576
+ var _useDialog = useDialog(),
7577
+ hideDialog = _useDialog.hideDialog;
7578
+ var _useState = useState("number"),
7579
+ _useState2 = _slicedToArray(_useState, 2),
7580
+ radioValue = _useState2[0],
7581
+ setRadioValue = _useState2[1];
7582
+ var _useState3 = useState(100),
7583
+ _useState4 = _slicedToArray(_useState3, 2),
7584
+ numberValue = _useState4[0],
7585
+ setNumberValue = _useState4[1];
7586
+ var getMaxCellWidth = function getMaxCellWidth(col) {
7587
+ var data = getFlowdata(context);
7588
+ var maxWidth = 100;
7589
+ if (data) {
7590
+ for (var i = 0; i < data.length; i += 1) {
7591
+ var cellD = data[i][col];
7592
+ if (typeof cellD === "string") {
7593
+ if (cellD.length * 7 > maxWidth) {
7594
+ maxWidth = cellD.length * 7;
7595
+ }
7596
+ } else if (_typeof(cellD) === "object" && cellD !== null) {
7597
+ console.log(cellD, "cellD");
7598
+ var cellText = cellD.v || cellD.m;
7599
+ if (cellText.length * 7 > maxWidth) {
7600
+ maxWidth = cellText.length * 7;
7601
+ }
7602
+ }
7603
+ }
7604
+ }
7605
+ return maxWidth;
7606
+ };
7607
+ return /*#__PURE__*/React.createElement("div", {
7608
+ id: "fortune-split-column"
7609
+ }, /*#__PURE__*/React.createElement("div", {
7610
+ className: ""
7611
+ }, /*#__PURE__*/React.createElement(RadioGroup, {
7612
+ defaultValue: radioValue,
7613
+ onValueChange: function onValueChange(value) {
7614
+ setRadioValue(value);
7615
+ }
7616
+ }, /*#__PURE__*/React.createElement("div", {
7617
+ className: "flex-col gap-4"
7618
+ }, /*#__PURE__*/React.createElement("div", {
7619
+ className: "flex items-center space-x-1"
7620
+ }, /*#__PURE__*/React.createElement(RadioGroupItem, {
7621
+ id: "r1",
7622
+ size: "lg",
7623
+ value: "number"
7624
+ }), /*#__PURE__*/React.createElement(Label, {
7625
+ className: "text-heading-xsm",
7626
+ htmlFor: "r1"
7627
+ }, "Enter new column width in pixels. (Default: 80)")), /*#__PURE__*/React.createElement(TextField, {
7628
+ className: "w-1/3 my-4",
7629
+ defaultValue: numberValue,
7630
+ isValid: true,
7631
+ onChange: function onChange(e) {
7632
+ setNumberValue(e.target.value);
7633
+ },
7634
+ placeholder: "Number"
7635
+ })), /*#__PURE__*/React.createElement("div", {
7636
+ className: "flex items-center space-x-1 mb-4"
7637
+ }, /*#__PURE__*/React.createElement(RadioGroupItem, {
7638
+ id: "r2",
7639
+ size: "lg",
7640
+ value: "fit"
7641
+ }), /*#__PURE__*/React.createElement(Label, {
7642
+ className: "text-heading-xsm",
7643
+ htmlFor: "r2"
7644
+ }, "Fit to data")))), /*#__PURE__*/React.createElement("div", {
7645
+ className: "flex justify-end gap-2"
7646
+ }, /*#__PURE__*/React.createElement(Button$1, {
7647
+ variant: "secondary",
7648
+ onClick: function onClick() {
7649
+ hideDialog();
7650
+ },
7651
+ tabIndex: 0
7652
+ }, button.cancel), /*#__PURE__*/React.createElement(Button$1, {
7653
+ onClick: function onClick() {
7654
+ if (radioValue === "number") {
7655
+ var targetColWidth = numberValue;
7656
+ setContext(function (draftCtx) {
7657
+ if (_.isUndefined(targetColWidth) || targetColWidth === null || targetColWidth <= 0 || targetColWidth > 2038) {
7658
+ showAlert("The column width must be between 0 ~ 2038", "ok");
7659
+ draftCtx.contextMenu = {};
7660
+ return;
7661
+ }
7662
+ var numColWidth = targetColWidth;
7663
+ var colWidthList = {};
7664
+ _.forEach(draftCtx.luckysheet_select_save, function (section) {
7665
+ for (var colNum = section.column[0]; colNum <= section.column[1]; colNum += 1) {
7666
+ getMaxCellWidth(colNum);
7667
+ colWidthList[colNum] = numColWidth;
7668
+ }
7669
+ });
7670
+ api.setColumnWidth(draftCtx, colWidthList, {}, true);
7671
+ draftCtx.contextMenu = {};
7672
+ });
7673
+ } else {
7674
+ var _targetColWidth = numberValue;
7675
+ setContext(function (draftCtx) {
7676
+ if (_.isUndefined(_targetColWidth) || _targetColWidth === null || _targetColWidth <= 0 || _targetColWidth > 2038) {
7677
+ showAlert("The column width must be between 0 ~ 2038", "ok");
7678
+ draftCtx.contextMenu = {};
7679
+ return;
7680
+ }
7681
+ var colWidthList = {};
7682
+ _.forEach(draftCtx.luckysheet_select_save, function (section) {
7683
+ for (var colNum = section.column[0]; colNum <= section.column[1]; colNum += 1) {
7684
+ colWidthList[colNum] = getMaxCellWidth(colNum);
7685
+ }
7686
+ });
7687
+ api.setColumnWidth(draftCtx, colWidthList, {}, true);
7688
+ draftCtx.contextMenu = {};
7689
+ });
7690
+ }
7691
+ hideDialog();
7692
+ },
7693
+ tabIndex: 0
7694
+ }, "Ok")));
7695
+ };
7696
+
7488
7697
  var Divider$1 = function Divider() {
7489
7698
  return /*#__PURE__*/React.createElement("div", {
7490
7699
  className: "fortune-context-menu-divider"
@@ -8194,32 +8403,14 @@ var ContextMenu = function ContextMenu() {
8194
8403
  }), "px")))) : null;
8195
8404
  }
8196
8405
  if (name === "set-column-width") {
8197
- var _context$luckysheet_s0, _context$luckysheet_s1;
8198
- var colWidth = (selection === null || selection === void 0 ? void 0 : selection.width) || context.defaultcollen;
8199
- var shownColWidth = ((_context$luckysheet_s0 = context.luckysheet_select_save) === null || _context$luckysheet_s0 === void 0 ? void 0 : _context$luckysheet_s0.some(function (section) {
8200
- return section.width_move !== (colWidth + 1) * (section.column[1] - section.column[0] + 1) - 1;
8201
- })) ? "" : colWidth;
8202
- return ((_context$luckysheet_s1 = context.luckysheet_select_save) === null || _context$luckysheet_s1 === void 0 ? void 0 : _context$luckysheet_s1.some(function (section) {
8406
+ var _context$luckysheet_s0;
8407
+ return ((_context$luckysheet_s0 = context.luckysheet_select_save) === null || _context$luckysheet_s0 === void 0 ? void 0 : _context$luckysheet_s0.some(function (section) {
8203
8408
  return section.column_select;
8204
8409
  })) ? (/*#__PURE__*/React.createElement(Menu, {
8205
8410
  key: "set-column-width",
8206
- onClick: function onClick(e, container) {
8207
- var _container$querySelec2;
8208
- var targetColWidth = (_container$querySelec2 = container.querySelector("input")) === null || _container$querySelec2 === void 0 ? void 0 : _container$querySelec2.value;
8411
+ onClick: function onClick() {
8412
+ showDialog(/*#__PURE__*/React.createElement(ResetColumnWidth, null), undefined, "Resize column");
8209
8413
  setContext(function (draftCtx) {
8210
- if (_.isUndefined(targetColWidth) || targetColWidth === "" || parseInt(targetColWidth, 10) <= 0 || parseInt(targetColWidth, 10) > 2038) {
8211
- showAlert(info.tipColumnWidthLimit, "ok");
8212
- draftCtx.contextMenu = {};
8213
- return;
8214
- }
8215
- var numColWidth = parseInt(targetColWidth, 10);
8216
- var colWidthList = {};
8217
- _.forEach(draftCtx.luckysheet_select_save, function (section) {
8218
- for (var colNum = section.column[0]; colNum <= section.column[1]; colNum += 1) {
8219
- colWidthList[colNum] = numColWidth;
8220
- }
8221
- });
8222
- api.setColumnWidth(draftCtx, colWidthList, {}, true);
8223
8414
  draftCtx.contextMenu = {};
8224
8415
  });
8225
8416
  }
@@ -8232,24 +8423,7 @@ var ContextMenu = function ContextMenu() {
8232
8423
  style: {
8233
8424
  marginRight: "8px"
8234
8425
  }
8235
- }), /*#__PURE__*/React.createElement("div", null, "Resize column height", /*#__PURE__*/React.createElement("input", {
8236
- onClick: function onClick(e) {
8237
- return e.stopPropagation();
8238
- },
8239
- onKeyDown: function onKeyDown(e) {
8240
- return e.stopPropagation();
8241
- },
8242
- tabIndex: 0,
8243
- type: "number",
8244
- min: 1,
8245
- max: 545,
8246
- className: "luckysheet-mousedown-cancel",
8247
- placeholder: rightclick.number,
8248
- defaultValue: shownColWidth,
8249
- style: {
8250
- width: "40px"
8251
- }
8252
- }), "px")))) : null;
8426
+ }), /*#__PURE__*/React.createElement("div", null, "Resize column width")))) : null;
8253
8427
  }
8254
8428
  if (name === "clear") {
8255
8429
  return /*#__PURE__*/React.createElement(Menu, {
@@ -10785,19 +10959,6 @@ var SheetTabContextMenu = function SheetTabContextMenu() {
10785
10959
  }));
10786
10960
  };
10787
10961
 
10788
- var MoreItemsContaier = function MoreItemsContaier(_ref) {
10789
- var onClose = _ref.onClose,
10790
- children = _ref.children;
10791
- var containerRef = useRef(null);
10792
- useOutsideClick(containerRef, function () {
10793
- onClose === null || onClose === void 0 ? void 0 : onClose();
10794
- }, [containerRef, onClose]);
10795
- return /*#__PURE__*/React.createElement("div", {
10796
- ref: containerRef,
10797
- className: "fortune-toolbar-more-container"
10798
- }, children);
10799
- };
10800
-
10801
10962
  function generateAPIs(context, setContext, handleUndo, handleRedo, settings, cellInput, scrollbarX, scrollbarY, globalCache) {
10802
10963
  return {
10803
10964
  applyOp: function applyOp(ops) {
@@ -12412,12 +12573,12 @@ var Workbook = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
12412
12573
  className: "fortune-workarea"
12413
12574
  }, mergedSettings.showToolbar && (/*#__PURE__*/React.createElement(Toolbar, {
12414
12575
  moreItemsOpen: moreToolbarItems !== null,
12415
- setMoreItems: setMoreToolbarItems
12576
+ setMoreItems: setMoreToolbarItems,
12577
+ onMoreToolbarItemsClose: onMoreToolbarItemsClose,
12578
+ moreToolbarItems: moreToolbarItems
12416
12579
  })), mergedSettings.showFormulaBar && /*#__PURE__*/React.createElement(FxEditor, null)), /*#__PURE__*/React.createElement(Sheet, {
12417
12580
  sheet: sheet
12418
- }), mergedSettings.showSheetTabs && /*#__PURE__*/React.createElement(SheetTab, null), /*#__PURE__*/React.createElement(ContextMenu, null), /*#__PURE__*/React.createElement(FilterMenu, null), /*#__PURE__*/React.createElement(SheetTabContextMenu, null), context.showSheetList && /*#__PURE__*/React.createElement(SheetList, null), moreToolbarItems && (/*#__PURE__*/React.createElement(MoreItemsContaier, {
12419
- onClose: onMoreToolbarItemsClose
12420
- }, moreToolbarItems)), !_.isEmpty(context.contextMenu) && (/*#__PURE__*/React.createElement("div", {
12581
+ }), mergedSettings.showSheetTabs && /*#__PURE__*/React.createElement(SheetTab, null), /*#__PURE__*/React.createElement(ContextMenu, null), /*#__PURE__*/React.createElement(FilterMenu, null), /*#__PURE__*/React.createElement(SheetTabContextMenu, null), context.showSheetList && /*#__PURE__*/React.createElement(SheetList, null), !_.isEmpty(context.contextMenu) && (/*#__PURE__*/React.createElement("div", {
12421
12582
  onMouseDown: function onMouseDown() {
12422
12583
  setContextWithProduce(function (draftCtx) {
12423
12584
  draftCtx.contextMenu = {};