@fileverse-dev/fortune-react 1.0.2-mod-36 → 1.0.2-mod-37

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,4 +1,4 @@
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, 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, normalizedCellAttr, updateFormat, handleTextSize, handleHorizontalAlign, handleVerticalAlign, handleScreenShot, showImgChooser, insertImage, editComment, deleteComment, showHideComment, showHideAllComments, newComment, handleSum, autoSelectionFormula, handleMerge, handleBorder, handleFreeze, handleSort, createFilter, clearFilter, toolbarItemSelectedFunc, toolbarItemClickHandler, handleTextColor, handleTextBackground, getInlineStringNoStyle, rangeHightlightselected, updateCell, editSheetName, cancelActiveImgItem, MAX_ZOOM_RATIO, MIN_ZOOM_RATIO, addSheet, getFreezeState, toggleFreeze, jfrefreshgrid, handleCopy, deleteRowCol, hideSelected, showSelected, api, removeActiveImage, deleteSelectedCellText, 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, 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, deleteRowCol, hideSelected, showSelected, api, removeActiveImage, deleteSelectedCellText, 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';
@@ -3511,6 +3511,118 @@ var DropDownList = function DropDownList() {
3511
3511
  }));
3512
3512
  };
3513
3513
 
3514
+ var IframeBoxs = function IframeBoxs() {
3515
+ var _context$insertedIfra;
3516
+ var _useContext = useContext(WorkbookContext),
3517
+ context = _useContext.context,
3518
+ setContext = _useContext.setContext,
3519
+ refs = _useContext.refs;
3520
+ var containerRef = useRef(null);
3521
+ useEffect(function () {
3522
+ var handleClickOutside = function handleClickOutside(e) {
3523
+ if (!containerRef.current) return;
3524
+ var iframeBoxes = containerRef.current.querySelectorAll(".luckysheet-modal-dialog-iframe");
3525
+ var clickedInsideSomeIframe = Array.from(iframeBoxes).some(function (el) {
3526
+ return el.contains(e.target);
3527
+ });
3528
+ if (!clickedInsideSomeIframe && context.activeIframe !== undefined) {
3529
+ setContext(function (ctx) {
3530
+ ctx.activeIframe = undefined;
3531
+ });
3532
+ }
3533
+ };
3534
+ document.addEventListener("mousedown", handleClickOutside);
3535
+ return function () {
3536
+ document.removeEventListener("mousedown", handleClickOutside);
3537
+ };
3538
+ }, [context.activeIframe, setContext]);
3539
+ return /*#__PURE__*/React.createElement("div", {
3540
+ id: "fortune-iframe-boxes",
3541
+ ref: containerRef
3542
+ }, (_context$insertedIfra = context.insertedIframes) === null || _context$insertedIfra === void 0 ? void 0 : _context$insertedIfra.map(function (frame) {
3543
+ var isActive = frame.id === context.activeIframe;
3544
+ var style = {
3545
+ width: frame.width * context.zoomRatio,
3546
+ height: frame.height * context.zoomRatio,
3547
+ left: frame.left * context.zoomRatio,
3548
+ top: frame.top * context.zoomRatio,
3549
+ position: "absolute",
3550
+ padding: 0,
3551
+ zIndex: isActive ? 300 : 200
3552
+ };
3553
+ return /*#__PURE__*/React.createElement("div", {
3554
+ key: frame.id,
3555
+ id: isActive ? "fortune-modal-dialog-activeIframe" : frame.id,
3556
+ className: "luckysheet-modal-dialog luckysheet-modal-dialog-iframe",
3557
+ style: style,
3558
+ onClick: function onClick(e) {
3559
+ if (!isActive) {
3560
+ setContext(function (ctx) {
3561
+ ctx.activeIframe = frame.id;
3562
+ });
3563
+ }
3564
+ e.stopPropagation();
3565
+ },
3566
+ onMouseDown: function onMouseDown(e) {
3567
+ if (isActive) {
3568
+ onIframeMoveStart(context, refs.globalCache, e.nativeEvent);
3569
+ }
3570
+ e.stopPropagation();
3571
+ }
3572
+ }, /*#__PURE__*/React.createElement("div", {
3573
+ className: "luckysheet-modal-dialog-content",
3574
+ style: {
3575
+ width: "100%",
3576
+ height: "100%",
3577
+ overflow: "hidden"
3578
+ }
3579
+ }, /*#__PURE__*/React.createElement("iframe", {
3580
+ title: "iframe-".concat(frame.id),
3581
+ src: frame.src,
3582
+ style: {
3583
+ width: "100%",
3584
+ height: "100%",
3585
+ border: "none",
3586
+ pointerEvents: "none"
3587
+ }
3588
+ })), /*#__PURE__*/React.createElement("div", {
3589
+ className: "luckysheet-modal-dialog-border"
3590
+ }), isActive && (/*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
3591
+ className: "luckysheet-modal-dialog-resize"
3592
+ }, ["lt", "mt", "lm", "rm", "rt", "lb", "mb", "rb"].map(function (dir) {
3593
+ return /*#__PURE__*/React.createElement("div", {
3594
+ key: dir,
3595
+ className: "luckysheet-modal-dialog-resize-item luckysheet-modal-dialog-resize-item-".concat(dir),
3596
+ "data-type": dir,
3597
+ style: {
3598
+ zIndex: 300,
3599
+ position: "absolute"
3600
+ },
3601
+ onMouseDown: function onMouseDown(e) {
3602
+ onIframeResizeStart(context, refs.globalCache, e.nativeEvent, dir);
3603
+ e.stopPropagation();
3604
+ }
3605
+ });
3606
+ })), /*#__PURE__*/React.createElement("div", {
3607
+ className: "luckysheet-modal-dialog-controll"
3608
+ }, /*#__PURE__*/React.createElement("span", {
3609
+ className: "luckysheet-modal-controll-btn luckysheet-modal-controll-del",
3610
+ role: "button",
3611
+ tabIndex: 0,
3612
+ title: "Delete",
3613
+ onClick: function onClick() {
3614
+ setContext(function (ctx) {
3615
+ var _ctx$insertedIframes;
3616
+ ctx.insertedIframes = ctx === null || ctx === void 0 ? void 0 : (_ctx$insertedIframes = ctx.insertedIframes) === null || _ctx$insertedIframes === void 0 ? void 0 : _ctx$insertedIframes.filter(function (f) {
3617
+ return f.id !== frame.id;
3618
+ });
3619
+ ctx.activeIframe = undefined;
3620
+ });
3621
+ }
3622
+ }, "DELETE")))));
3623
+ }));
3624
+ };
3625
+
3514
3626
  var SheetOverlay = function SheetOverlay() {
3515
3627
  var _refs$cellArea$curren, _refs$cellArea$curren2, _context$luckysheet_s, _context$luckysheet_s2, _context$luckysheet_s3, _context$luckysheet_s4, _context$luckysheet_s5, _context$luckysheet_s6, _context$presences$le, _context$presences, _context$linkCard, _context$rangeDialog;
3516
3628
  var _useContext = useContext(WorkbookContext),
@@ -3953,7 +4065,7 @@ var SheetOverlay = function SheetOverlay() {
3953
4065
  id: "luckysheet-multipleRange-show"
3954
4066
  }), /*#__PURE__*/React.createElement("div", {
3955
4067
  id: "luckysheet-dynamicArray-hightShow"
3956
- }), /*#__PURE__*/React.createElement(ImgBoxs, null), /*#__PURE__*/React.createElement("div", {
4068
+ }), /*#__PURE__*/React.createElement(ImgBoxs, null), /*#__PURE__*/React.createElement(IframeBoxs, null), /*#__PURE__*/React.createElement("div", {
3957
4069
  id: "luckysheet-dataVerification-dropdown-btn",
3958
4070
  onClick: function onClick() {
3959
4071
  setContext(function (ctx) {
@@ -5247,6 +5359,97 @@ var FormatSearch = function FormatSearch(_ref) {
5247
5359
  }, button.cancel)));
5248
5360
  };
5249
5361
 
5362
+ var DuneChartsInputModal = function DuneChartsInputModal(_ref) {
5363
+ var isOpen = _ref.isOpen,
5364
+ onClose = _ref.onClose,
5365
+ onSubmit = _ref.onSubmit,
5366
+ icon = _ref.icon,
5367
+ _ref$submitText = _ref.submitText,
5368
+ submitText = _ref$submitText === void 0 ? "Submit" : _ref$submitText,
5369
+ _ref$placeholder = _ref.placeholder,
5370
+ placeholder = _ref$placeholder === void 0 ? "Enter a value..." : _ref$placeholder;
5371
+ var _useState = useState(""),
5372
+ _useState2 = _slicedToArray(_useState, 2),
5373
+ url = _useState2[0],
5374
+ setUrl = _useState2[1];
5375
+ var _useState3 = useState(false),
5376
+ _useState4 = _slicedToArray(_useState3, 2),
5377
+ showError = _useState4[0],
5378
+ setShowError = _useState4[1];
5379
+ var inputRef = useRef(null);
5380
+ useEffect(function () {
5381
+ if (isOpen && inputRef.current) {
5382
+ var timer = setTimeout(function () {
5383
+ var _inputRef$current;
5384
+ (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.focus();
5385
+ }, 100);
5386
+ return function () {
5387
+ return clearTimeout(timer);
5388
+ };
5389
+ }
5390
+ return undefined;
5391
+ }, [isOpen]);
5392
+ if (!isOpen) return null;
5393
+ var handleSubmit = function handleSubmit() {
5394
+ var trimmed = url.trim();
5395
+ if (trimmed && sanitizeDuneUrl(trimmed)) {
5396
+ onSubmit(trimmed);
5397
+ setUrl("");
5398
+ setShowError(false);
5399
+ onClose();
5400
+ } else {
5401
+ setShowError(true);
5402
+ }
5403
+ };
5404
+ var handleKeyDown = function handleKeyDown(e) {
5405
+ e.stopPropagation();
5406
+ if (e.key === "Enter") {
5407
+ handleSubmit();
5408
+ }
5409
+ };
5410
+ return /*#__PURE__*/React.createElement("div", {
5411
+ className: "custom-overlay",
5412
+ onClick: onClose
5413
+ }, /*#__PURE__*/React.createElement("div", {
5414
+ className: "input-modal",
5415
+ style: {
5416
+ transformOrigin: "top center"
5417
+ },
5418
+ onClick: function onClick(e) {
5419
+ return e.stopPropagation();
5420
+ },
5421
+ onKeyDown: handleKeyDown
5422
+ }, /*#__PURE__*/React.createElement("div", {
5423
+ className: "modal-header"
5424
+ }, /*#__PURE__*/React.createElement(SVGIcon, {
5425
+ name: icon
5426
+ }), /*#__PURE__*/React.createElement("input", {
5427
+ ref: inputRef,
5428
+ className: "modal-input",
5429
+ type: "text",
5430
+ placeholder: placeholder,
5431
+ value: url,
5432
+ onChange: function onChange(e) {
5433
+ setUrl(e.target.value);
5434
+ setShowError(false);
5435
+ },
5436
+ onKeyDown: handleKeyDown
5437
+ })), showError && (/*#__PURE__*/React.createElement("div", {
5438
+ className: "modal-error-message"
5439
+ }, /*#__PURE__*/React.createElement(SVGIcon, {
5440
+ style: {
5441
+ width: "14px",
5442
+ height: "14px"
5443
+ },
5444
+ name: "circle-alert"
5445
+ }), /*#__PURE__*/React.createElement("span", null, "Please make sure the URL is a valid Dune chart link"))), url.length > 0 && !showError && (/*#__PURE__*/React.createElement("div", {
5446
+ className: "modal-footer"
5447
+ }, /*#__PURE__*/React.createElement(Button$1, {
5448
+ onClick: handleSubmit,
5449
+ className: "modal-button"
5450
+ }, submitText)))));
5451
+ };
5452
+
5250
5453
  var getIcon = function getIcon(title) {
5251
5454
  switch (title) {
5252
5455
  case "align-left":
@@ -5292,6 +5495,10 @@ var Toolbar = function Toolbar(_ref) {
5292
5495
  _useState4 = _slicedToArray(_useState3, 2),
5293
5496
  itemLocations = _useState4[0],
5294
5497
  setItemLocations = _useState4[1];
5498
+ var _useState5 = useState(false),
5499
+ _useState6 = _slicedToArray(_useState5, 2),
5500
+ showDuneModal = _useState6[0],
5501
+ setShowDuneModal = _useState6[1];
5295
5502
  var _useDialog = useDialog(),
5296
5503
  showDialog = _useDialog.showDialog,
5297
5504
  hideDialog = _useDialog.hideDialog;
@@ -5322,12 +5529,12 @@ var Toolbar = function Toolbar(_ref) {
5322
5529
  var sheetWidth = context.luckysheetTableContentHW[0];
5323
5530
  var currency = settings.currency;
5324
5531
  var defaultFormat = defaultFmt(currency);
5325
- var _useState5 = useState("#000000"),
5326
- _useState6 = _slicedToArray(_useState5, 1),
5327
- customColor = _useState6[0];
5328
- var _useState7 = useState("1"),
5532
+ var _useState7 = useState("#000000"),
5329
5533
  _useState8 = _slicedToArray(_useState7, 1),
5330
- customStyle = _useState8[0];
5534
+ customColor = _useState8[0];
5535
+ var _useState9 = useState("1"),
5536
+ _useState0 = _slicedToArray(_useState9, 1),
5537
+ customStyle = _useState0[0];
5331
5538
  var showSubMenu = useCallback(function (e, className) {
5332
5539
  var target = e.target;
5333
5540
  var menuItem = target.className === "fortune-toolbar-menu-line" ? target.parentElement : target;
@@ -6412,7 +6619,7 @@ var Toolbar = function Toolbar(_ref) {
6412
6619
  });
6413
6620
  }
6414
6621
  });
6415
- }, [toolbar, cell, setContext, refs.cellInput, refs.fxInput, refs.globalCache, defaultFormat, align, handleUndo, handleRedo, flowdata, formula, showDialog, hideDialog, 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]);
6622
+ }, [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]);
6416
6623
  return /*#__PURE__*/React.createElement("div", {
6417
6624
  ref: containerRef,
6418
6625
  className: "fortune-toolbar",
@@ -6467,7 +6674,29 @@ var Toolbar = function Toolbar(_ref) {
6467
6674
  icon: n.icon,
6468
6675
  iconName: n.iconName
6469
6676
  }, n.children);
6470
- }));
6677
+ }), /*#__PURE__*/React.createElement(Button, {
6678
+ iconId: "dune-logo",
6679
+ tooltip: "Insert Dune Chart",
6680
+ key: "dune-charts",
6681
+ onClick: function onClick() {
6682
+ if (context.allowEdit === false) return;
6683
+ setShowDuneModal(true);
6684
+ }
6685
+ }), showDuneModal && (/*#__PURE__*/React.createElement(DuneChartsInputModal, {
6686
+ isOpen: showDuneModal,
6687
+ onSubmit: function onSubmit(url) {
6688
+ setContext(function (draftCtx) {
6689
+ insertDuneChart(draftCtx, url);
6690
+ });
6691
+ setShowDuneModal(false);
6692
+ },
6693
+ onClose: function onClose() {
6694
+ return setShowDuneModal(false);
6695
+ },
6696
+ icon: "dune-logo",
6697
+ placeholder: "Add Dune chart link to embed",
6698
+ submitText: "Embed Dune chart"
6699
+ })));
6471
6700
  };
6472
6701
 
6473
6702
  var LocationBox = function LocationBox() {
@@ -9599,6 +9828,59 @@ var SVGDefines = function SVGDefines(_ref) {
9599
9828
  d: "M12.75 2.25C13.1642 2.25 13.5 2.58579 13.5 3V15C13.5 15.4142 13.1642 15.75 12.75 15.75C12.3358 15.75 12 15.4142 12 15V3C12 2.58579 12.3358 2.25 12.75 2.25Z",
9600
9829
  fill: "#363B3F"
9601
9830
  })), /*#__PURE__*/React.createElement("symbol", {
9831
+ id: "dune-logo",
9832
+ viewBox: "0 0 18 16",
9833
+ fill: "none"
9834
+ }, /*#__PURE__*/React.createElement("svg", {
9835
+ width: "18",
9836
+ height: "16",
9837
+ viewBox: "0 0 18 16",
9838
+ fill: "none",
9839
+ xmlns: "http://www.w3.org/2000/svg"
9840
+ }, /*#__PURE__*/React.createElement("g", {
9841
+ "clip-path": "url(#clip0_80_246690)"
9842
+ }, /*#__PURE__*/React.createElement("path", {
9843
+ d: "M7.99485 15.9875C12.4102 15.9875 15.9896 12.4085 15.9896 7.99373C15.9896 3.57891 12.4102 0 7.99485 0C3.57941 0 0 3.57891 0 7.99373C0 12.4085 3.57941 15.9875 7.99485 15.9875Z",
9844
+ fill: "#F4603E"
9845
+ }), /*#__PURE__*/React.createElement("path", {
9846
+ d: "M1.39258 12.5028C1.39258 12.5028 6.67562 10.7723 15.9868 7.73633C15.9868 7.73633 16.4968 12.7082 11.3424 15.3015C11.3424 15.3015 8.80068 16.5197 6.01215 15.7383C6.01215 15.7383 3.23545 15.2142 1.39258 12.5028Z",
9847
+ fill: "#1E1870"
9848
+ })), /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("clipPath", {
9849
+ id: "clip0_80_246690"
9850
+ }, /*#__PURE__*/React.createElement("rect", {
9851
+ width: "16",
9852
+ height: "16",
9853
+ fill: "white"
9854
+ }))))), /*#__PURE__*/React.createElement("symbol", {
9855
+ id: "circle-alert",
9856
+ viewBox: "0 0 14 14",
9857
+ fill: "none"
9858
+ }, /*#__PURE__*/React.createElement("svg", {
9859
+ width: "14",
9860
+ height: "14",
9861
+ viewBox: "0 0 14 14",
9862
+ fill: "none",
9863
+ xmlns: "http://www.w3.org/2000/svg"
9864
+ }, /*#__PURE__*/React.createElement("g", {
9865
+ "clip-path": "url(#clip0_138_127604)"
9866
+ }, /*#__PURE__*/React.createElement("path", {
9867
+ d: "M6.99967 4.0835C7.32184 4.0835 7.58301 4.34466 7.58301 4.66683V7.00016C7.58301 7.32233 7.32184 7.5835 6.99967 7.5835C6.67751 7.5835 6.41634 7.32233 6.41634 7.00016V4.66683C6.41634 4.34466 6.67751 4.0835 6.99967 4.0835Z",
9868
+ fill: "#FB3449"
9869
+ }), /*#__PURE__*/React.createElement("path", {
9870
+ d: "M6.99967 8.75016C6.67751 8.75016 6.41634 9.01133 6.41634 9.3335C6.41634 9.65566 6.67751 9.91683 6.99967 9.91683H7.00551C7.32767 9.91683 7.58884 9.65566 7.58884 9.3335C7.58884 9.01133 7.32767 8.75016 7.00551 8.75016H6.99967Z",
9871
+ fill: "#FB3449"
9872
+ }), /*#__PURE__*/React.createElement("path", {
9873
+ "fill-rule": "evenodd",
9874
+ "clip-rule": "evenodd",
9875
+ d: "M0.583008 7.00016C0.583008 3.45634 3.45585 0.583496 6.99967 0.583496C10.5435 0.583496 13.4163 3.45634 13.4163 7.00016C13.4163 10.544 10.5435 13.4168 6.99967 13.4168C3.45585 13.4168 0.583008 10.544 0.583008 7.00016ZM6.99967 1.75016C4.10018 1.75016 1.74967 4.10067 1.74967 7.00016C1.74967 9.89966 4.10018 12.2502 6.99967 12.2502C9.89917 12.2502 12.2497 9.89966 12.2497 7.00016C12.2497 4.10067 9.89917 1.75016 6.99967 1.75016Z",
9876
+ fill: "#FB3449"
9877
+ })), /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("clipPath", {
9878
+ id: "clip0_138_127604"
9879
+ }, /*#__PURE__*/React.createElement("rect", {
9880
+ width: "14",
9881
+ height: "14",
9882
+ fill: "white"
9883
+ }))))), /*#__PURE__*/React.createElement("symbol", {
9602
9884
  id: "caret-down-fill",
9603
9885
  width: "14",
9604
9886
  height: "14",
@@ -10975,6 +11257,48 @@ var SheetList = function SheetList() {
10975
11257
  }));
10976
11258
  };
10977
11259
 
11260
+ var DunePreview = function DunePreview(_ref) {
11261
+ var url = _ref.url,
11262
+ position = _ref.position,
11263
+ onKeepAsLink = _ref.onKeepAsLink,
11264
+ onEmbed = _ref.onEmbed;
11265
+ var embedUrl = sanitizeDuneUrl(url);
11266
+ if (!embedUrl) return null;
11267
+ return /*#__PURE__*/React.createElement("div", {
11268
+ className: "fortune-dune-preview",
11269
+ style: {
11270
+ left: position.left,
11271
+ top: position.top
11272
+ },
11273
+ onClick: function onClick(e) {
11274
+ return e.stopPropagation();
11275
+ }
11276
+ }, /*#__PURE__*/React.createElement("div", {
11277
+ className: "fortune-dune-preview-header"
11278
+ }, /*#__PURE__*/React.createElement("span", {
11279
+ className: "fortune-dune-preview-title"
11280
+ }, "Detected Dune chart link")), /*#__PURE__*/React.createElement("div", {
11281
+ className: "fortune-dune-preview-content"
11282
+ }, /*#__PURE__*/React.createElement("iframe", {
11283
+ src: embedUrl,
11284
+ title: "Dune Chart Preview",
11285
+ style: {
11286
+ width: "100%",
11287
+ height: "100%",
11288
+ border: "none"
11289
+ }
11290
+ })), /*#__PURE__*/React.createElement("p", null, "Do you want to insert Dune chart?"), /*#__PURE__*/React.createElement("div", {
11291
+ className: "fortune-dune-preview-footer"
11292
+ }, /*#__PURE__*/React.createElement(Button$1, {
11293
+ variant: "ghost",
11294
+ onClick: onKeepAsLink,
11295
+ className: "!w-fit px-0"
11296
+ }, "Keep as Link"), /*#__PURE__*/React.createElement(Button$1, {
11297
+ onClick: onEmbed,
11298
+ className: "!w-fit px-0"
11299
+ }, "Embed")));
11300
+ };
11301
+
10978
11302
  var _excluded = ["onChange", "onOp", "data"];
10979
11303
  enablePatches();
10980
11304
  var triggerGroupValuesRefresh = function triggerGroupValuesRefresh(ctx) {
@@ -11507,7 +11831,25 @@ var Workbook = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
11507
11831
  style: {
11508
11832
  width: "60px"
11509
11833
  }
11510
- }, formula.count, ": ", calInfo.count)), !!calInfo.numberC && !!calInfo.sum && (/*#__PURE__*/React.createElement("div", null, formula.sum, ": ", calInfo.sum)), !!calInfo.numberC && !!calInfo.average && (/*#__PURE__*/React.createElement("div", null, formula.average, ": ", calInfo.average)), !!calInfo.numberC && !!calInfo.max && (/*#__PURE__*/React.createElement("div", null, formula.max, ": ", calInfo.max)), !!calInfo.numberC && !!calInfo.min && (/*#__PURE__*/React.createElement("div", null, formula.min, ": ", calInfo.min)))))));
11834
+ }, formula.count, ": ", calInfo.count)), !!calInfo.numberC && !!calInfo.sum && (/*#__PURE__*/React.createElement("div", null, formula.sum, ": ", calInfo.sum)), !!calInfo.numberC && !!calInfo.average && (/*#__PURE__*/React.createElement("div", null, formula.average, ": ", calInfo.average)), !!calInfo.numberC && !!calInfo.max && (/*#__PURE__*/React.createElement("div", null, formula.max, ": ", calInfo.max)), !!calInfo.numberC && !!calInfo.min && (/*#__PURE__*/React.createElement("div", null, formula.min, ": ", calInfo.min)))), context.showDunePreview && (/*#__PURE__*/React.createElement(DunePreview, {
11835
+ url: context.showDunePreview.url,
11836
+ position: context.showDunePreview.position,
11837
+ onKeepAsLink: function onKeepAsLink() {
11838
+ setContextWithProduce(function (draftCtx) {
11839
+ draftCtx.showDunePreview = undefined;
11840
+ }, {
11841
+ noHistory: true
11842
+ });
11843
+ },
11844
+ onEmbed: function onEmbed() {
11845
+ setContextWithProduce(function (draftCtx) {
11846
+ insertDuneChart(draftCtx, context.showDunePreview.url);
11847
+ draftCtx.showDunePreview = undefined;
11848
+ }, {
11849
+ noHistory: true
11850
+ });
11851
+ }
11852
+ })))));
11511
11853
  });
11512
11854
 
11513
11855
  export { Workbook };