@fileverse-dev/fortune-react 1.0.2-mod-74 → 1.0.2-mod-75

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, selectTitlesMap, selectTitlesRange, fixColumnStyleOverflowInFreeze, rowLocationByIndex, rowLocation, handleRowHeaderMouseDown, handleRowSizeHandleMouseDown, handleRowFreezeHandleMouseDown, handleContextMenu, 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';
1
+ import { defaultContext, defaultSettings, getSheetIndex, colLocationByIndex, fixPositionOnFrozenCells, colLocation, getFlowdata, isAllowEdit, handleColumnHeaderMouseDown, handleColSizeHandleMouseDown, handleColFreezeHandleMouseDown, selectTitlesMap, selectTitlesRange, fixColumnStyleOverflowInFreeze, rowLocationByIndex, rowLocation, handleRowHeaderMouseDown, handleRowSizeHandleMouseDown, handleRowFreezeHandleMouseDown, handleContextMenu, 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, saveIframe, 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';
@@ -2432,13 +2432,33 @@ var ImgBoxs = function ImgBoxs() {
2432
2432
  context = _useContext.context,
2433
2433
  setContext = _useContext.setContext,
2434
2434
  refs = _useContext.refs;
2435
+ var containerRef = useRef(null);
2435
2436
  var activeImg = useMemo(function () {
2436
2437
  return _.find(context.insertedImgs, {
2437
2438
  id: context.activeImg
2438
2439
  });
2439
2440
  }, [context.activeImg, context.insertedImgs]);
2441
+ useEffect(function () {
2442
+ var handleClickOutside = function handleClickOutside(e) {
2443
+ if (!containerRef.current) return;
2444
+ var imageBoxes = containerRef.current.querySelectorAll(".luckysheet-modal-dialog-image");
2445
+ var clickedInsideSomeImage = Array.from(imageBoxes).some(function (el) {
2446
+ return el.contains(e.target);
2447
+ });
2448
+ if (!clickedInsideSomeImage && context.activeImg !== undefined) {
2449
+ setContext(function (ctx) {
2450
+ ctx.activeImg = undefined;
2451
+ });
2452
+ }
2453
+ };
2454
+ document.addEventListener("mousedown", handleClickOutside);
2455
+ return function () {
2456
+ document.removeEventListener("mousedown", handleClickOutside);
2457
+ };
2458
+ }, [context.activeImg, setContext]);
2440
2459
  return /*#__PURE__*/React.createElement("div", {
2441
- id: "luckysheet-image-showBoxs"
2460
+ id: "luckysheet-image-showBoxs",
2461
+ ref: containerRef
2442
2462
  }, activeImg && (/*#__PURE__*/React.createElement("div", {
2443
2463
  id: "luckysheet-modal-dialog-activeImage",
2444
2464
  className: "luckysheet-modal-dialog",
@@ -2503,16 +2523,41 @@ var ImgBoxs = function ImgBoxs() {
2503
2523
  }, /*#__PURE__*/React.createElement("i", {
2504
2524
  className: "fa fa-window-maximize",
2505
2525
  "aria-hidden": "true"
2506
- })), /*#__PURE__*/React.createElement("span", {
2507
- className: "luckysheet-modal-controll-btn luckysheet-modal-controll-del",
2508
- role: "button",
2509
- tabIndex: 0,
2510
- "aria-label": "\u5220\u9664",
2511
- title: "\u5220\u9664"
2512
- }, /*#__PURE__*/React.createElement("i", {
2513
- className: "fa fa-trash",
2514
- "aria-hidden": "true"
2515
- }))))), /*#__PURE__*/React.createElement("div", {
2526
+ })), /*#__PURE__*/React.createElement(IconButton, {
2527
+ icon: "Trash2",
2528
+ onMouseDown: function onMouseDown(e) {
2529
+ e.stopPropagation();
2530
+ setContext(function (ctx) {
2531
+ var currentSheet = ctx.luckysheetfile.find(function (sheet) {
2532
+ return sheet.id === ctx.currentSheetId;
2533
+ });
2534
+ if (currentSheet) {
2535
+ var _currentSheet$images;
2536
+ currentSheet.images = (_currentSheet$images = currentSheet.images) === null || _currentSheet$images === void 0 ? void 0 : _currentSheet$images.filter(function (f) {
2537
+ return f.id !== activeImg.id;
2538
+ });
2539
+ }
2540
+ ctx.activeImg = undefined;
2541
+ });
2542
+ },
2543
+ onTouchEnd: function onTouchEnd(e) {
2544
+ e.stopPropagation();
2545
+ setContext(function (ctx) {
2546
+ var currentSheet = ctx.luckysheetfile.find(function (sheet) {
2547
+ return sheet.id === ctx.currentSheetId;
2548
+ });
2549
+ if (currentSheet) {
2550
+ var _currentSheet$images2;
2551
+ currentSheet.images = (_currentSheet$images2 = currentSheet.images) === null || _currentSheet$images2 === void 0 ? void 0 : _currentSheet$images2.filter(function (f) {
2552
+ return f.id !== activeImg.id;
2553
+ });
2554
+ }
2555
+ ctx.activeImg = undefined;
2556
+ });
2557
+ },
2558
+ variant: "ghost",
2559
+ className: "fortune-iframe-boxes-delete-button"
2560
+ })))), /*#__PURE__*/React.createElement("div", {
2516
2561
  className: "img-list"
2517
2562
  }, (_context$insertedImgs = context.insertedImgs) === null || _context$insertedImgs === void 0 ? void 0 : _context$insertedImgs.map(function (v) {
2518
2563
  var id = v.id,
@@ -3843,6 +3888,8 @@ var IframeBoxs = function IframeBoxs() {
3843
3888
  currentSheet.iframes = (_currentSheet$iframes = currentSheet.iframes) === null || _currentSheet$iframes === void 0 ? void 0 : _currentSheet$iframes.filter(function (f) {
3844
3889
  return f.id !== frame.id;
3845
3890
  });
3891
+ ctx.insertedIframes = currentSheet.iframes;
3892
+ saveIframe(ctx);
3846
3893
  }
3847
3894
  ctx.activeIframe = undefined;
3848
3895
  });
package/dist/index.js CHANGED
@@ -2443,13 +2443,33 @@ var ImgBoxs = function ImgBoxs() {
2443
2443
  context = _useContext.context,
2444
2444
  setContext = _useContext.setContext,
2445
2445
  refs = _useContext.refs;
2446
+ var containerRef = React.useRef(null);
2446
2447
  var activeImg = React.useMemo(function () {
2447
2448
  return ___default['default'].find(context.insertedImgs, {
2448
2449
  id: context.activeImg
2449
2450
  });
2450
2451
  }, [context.activeImg, context.insertedImgs]);
2452
+ React.useEffect(function () {
2453
+ var handleClickOutside = function handleClickOutside(e) {
2454
+ if (!containerRef.current) return;
2455
+ var imageBoxes = containerRef.current.querySelectorAll(".luckysheet-modal-dialog-image");
2456
+ var clickedInsideSomeImage = Array.from(imageBoxes).some(function (el) {
2457
+ return el.contains(e.target);
2458
+ });
2459
+ if (!clickedInsideSomeImage && context.activeImg !== undefined) {
2460
+ setContext(function (ctx) {
2461
+ ctx.activeImg = undefined;
2462
+ });
2463
+ }
2464
+ };
2465
+ document.addEventListener("mousedown", handleClickOutside);
2466
+ return function () {
2467
+ document.removeEventListener("mousedown", handleClickOutside);
2468
+ };
2469
+ }, [context.activeImg, setContext]);
2451
2470
  return /*#__PURE__*/React__default['default'].createElement("div", {
2452
- id: "luckysheet-image-showBoxs"
2471
+ id: "luckysheet-image-showBoxs",
2472
+ ref: containerRef
2453
2473
  }, activeImg && (/*#__PURE__*/React__default['default'].createElement("div", {
2454
2474
  id: "luckysheet-modal-dialog-activeImage",
2455
2475
  className: "luckysheet-modal-dialog",
@@ -2514,16 +2534,41 @@ var ImgBoxs = function ImgBoxs() {
2514
2534
  }, /*#__PURE__*/React__default['default'].createElement("i", {
2515
2535
  className: "fa fa-window-maximize",
2516
2536
  "aria-hidden": "true"
2517
- })), /*#__PURE__*/React__default['default'].createElement("span", {
2518
- className: "luckysheet-modal-controll-btn luckysheet-modal-controll-del",
2519
- role: "button",
2520
- tabIndex: 0,
2521
- "aria-label": "\u5220\u9664",
2522
- title: "\u5220\u9664"
2523
- }, /*#__PURE__*/React__default['default'].createElement("i", {
2524
- className: "fa fa-trash",
2525
- "aria-hidden": "true"
2526
- }))))), /*#__PURE__*/React__default['default'].createElement("div", {
2537
+ })), /*#__PURE__*/React__default['default'].createElement(ui.IconButton, {
2538
+ icon: "Trash2",
2539
+ onMouseDown: function onMouseDown(e) {
2540
+ e.stopPropagation();
2541
+ setContext(function (ctx) {
2542
+ var currentSheet = ctx.luckysheetfile.find(function (sheet) {
2543
+ return sheet.id === ctx.currentSheetId;
2544
+ });
2545
+ if (currentSheet) {
2546
+ var _currentSheet$images;
2547
+ currentSheet.images = (_currentSheet$images = currentSheet.images) === null || _currentSheet$images === void 0 ? void 0 : _currentSheet$images.filter(function (f) {
2548
+ return f.id !== activeImg.id;
2549
+ });
2550
+ }
2551
+ ctx.activeImg = undefined;
2552
+ });
2553
+ },
2554
+ onTouchEnd: function onTouchEnd(e) {
2555
+ e.stopPropagation();
2556
+ setContext(function (ctx) {
2557
+ var currentSheet = ctx.luckysheetfile.find(function (sheet) {
2558
+ return sheet.id === ctx.currentSheetId;
2559
+ });
2560
+ if (currentSheet) {
2561
+ var _currentSheet$images2;
2562
+ currentSheet.images = (_currentSheet$images2 = currentSheet.images) === null || _currentSheet$images2 === void 0 ? void 0 : _currentSheet$images2.filter(function (f) {
2563
+ return f.id !== activeImg.id;
2564
+ });
2565
+ }
2566
+ ctx.activeImg = undefined;
2567
+ });
2568
+ },
2569
+ variant: "ghost",
2570
+ className: "fortune-iframe-boxes-delete-button"
2571
+ })))), /*#__PURE__*/React__default['default'].createElement("div", {
2527
2572
  className: "img-list"
2528
2573
  }, (_context$insertedImgs = context.insertedImgs) === null || _context$insertedImgs === void 0 ? void 0 : _context$insertedImgs.map(function (v) {
2529
2574
  var id = v.id,
@@ -3854,6 +3899,8 @@ var IframeBoxs = function IframeBoxs() {
3854
3899
  currentSheet.iframes = (_currentSheet$iframes = currentSheet.iframes) === null || _currentSheet$iframes === void 0 ? void 0 : _currentSheet$iframes.filter(function (f) {
3855
3900
  return f.id !== frame.id;
3856
3901
  });
3902
+ ctx.insertedIframes = currentSheet.iframes;
3903
+ fortuneCore.saveIframe(ctx);
3857
3904
  }
3858
3905
  ctx.activeIframe = undefined;
3859
3906
  });
package/dist/index.umd.js CHANGED
@@ -106814,13 +106814,33 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
106814
106814
  context = _useContext.context,
106815
106815
  setContext = _useContext.setContext,
106816
106816
  refs = _useContext.refs;
106817
+ var containerRef = React.useRef(null);
106817
106818
  var activeImg = React.useMemo(function () {
106818
106819
  return lodash.find(context.insertedImgs, {
106819
106820
  id: context.activeImg
106820
106821
  });
106821
106822
  }, [context.activeImg, context.insertedImgs]);
106823
+ React.useEffect(function () {
106824
+ var handleClickOutside = function handleClickOutside(e) {
106825
+ if (!containerRef.current) return;
106826
+ var imageBoxes = containerRef.current.querySelectorAll(".luckysheet-modal-dialog-image");
106827
+ var clickedInsideSomeImage = Array.from(imageBoxes).some(function (el) {
106828
+ return el.contains(e.target);
106829
+ });
106830
+ if (!clickedInsideSomeImage && context.activeImg !== undefined) {
106831
+ setContext(function (ctx) {
106832
+ ctx.activeImg = undefined;
106833
+ });
106834
+ }
106835
+ };
106836
+ document.addEventListener("mousedown", handleClickOutside);
106837
+ return function () {
106838
+ document.removeEventListener("mousedown", handleClickOutside);
106839
+ };
106840
+ }, [context.activeImg, setContext]);
106822
106841
  return /*#__PURE__*/React__default['default'].createElement("div", {
106823
- id: "luckysheet-image-showBoxs"
106842
+ id: "luckysheet-image-showBoxs",
106843
+ ref: containerRef
106824
106844
  }, activeImg && (/*#__PURE__*/React__default['default'].createElement("div", {
106825
106845
  id: "luckysheet-modal-dialog-activeImage",
106826
106846
  className: "luckysheet-modal-dialog",
@@ -106885,16 +106905,41 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
106885
106905
  }, /*#__PURE__*/React__default['default'].createElement("i", {
106886
106906
  className: "fa fa-window-maximize",
106887
106907
  "aria-hidden": "true"
106888
- })), /*#__PURE__*/React__default['default'].createElement("span", {
106889
- className: "luckysheet-modal-controll-btn luckysheet-modal-controll-del",
106890
- role: "button",
106891
- tabIndex: 0,
106892
- "aria-label": "\u5220\u9664",
106893
- title: "\u5220\u9664"
106894
- }, /*#__PURE__*/React__default['default'].createElement("i", {
106895
- className: "fa fa-trash",
106896
- "aria-hidden": "true"
106897
- }))))), /*#__PURE__*/React__default['default'].createElement("div", {
106908
+ })), /*#__PURE__*/React__default['default'].createElement(Er, {
106909
+ icon: "Trash2",
106910
+ onMouseDown: function onMouseDown(e) {
106911
+ e.stopPropagation();
106912
+ setContext(function (ctx) {
106913
+ var currentSheet = ctx.luckysheetfile.find(function (sheet) {
106914
+ return sheet.id === ctx.currentSheetId;
106915
+ });
106916
+ if (currentSheet) {
106917
+ var _currentSheet$images;
106918
+ currentSheet.images = (_currentSheet$images = currentSheet.images) === null || _currentSheet$images === void 0 ? void 0 : _currentSheet$images.filter(function (f) {
106919
+ return f.id !== activeImg.id;
106920
+ });
106921
+ }
106922
+ ctx.activeImg = undefined;
106923
+ });
106924
+ },
106925
+ onTouchEnd: function onTouchEnd(e) {
106926
+ e.stopPropagation();
106927
+ setContext(function (ctx) {
106928
+ var currentSheet = ctx.luckysheetfile.find(function (sheet) {
106929
+ return sheet.id === ctx.currentSheetId;
106930
+ });
106931
+ if (currentSheet) {
106932
+ var _currentSheet$images2;
106933
+ currentSheet.images = (_currentSheet$images2 = currentSheet.images) === null || _currentSheet$images2 === void 0 ? void 0 : _currentSheet$images2.filter(function (f) {
106934
+ return f.id !== activeImg.id;
106935
+ });
106936
+ }
106937
+ ctx.activeImg = undefined;
106938
+ });
106939
+ },
106940
+ variant: "ghost",
106941
+ className: "fortune-iframe-boxes-delete-button"
106942
+ })))), /*#__PURE__*/React__default['default'].createElement("div", {
106898
106943
  className: "img-list"
106899
106944
  }, (_context$insertedImgs = context.insertedImgs) === null || _context$insertedImgs === void 0 ? void 0 : _context$insertedImgs.map(function (v) {
106900
106945
  var id = v.id,
@@ -108225,6 +108270,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
108225
108270
  currentSheet.iframes = (_currentSheet$iframes = currentSheet.iframes) === null || _currentSheet$iframes === void 0 ? void 0 : _currentSheet$iframes.filter(function (f) {
108226
108271
  return f.id !== frame.id;
108227
108272
  });
108273
+ ctx.insertedIframes = currentSheet.iframes;
108274
+ saveIframe(ctx);
108228
108275
  }
108229
108276
  ctx.activeIframe = undefined;
108230
108277
  });