@fileverse-dev/fortune-react 1.0.2-mod-44 → 1.0.2-mod-45
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 +42 -15
- package/dist/index.js +41 -14
- package/dist/index.umd.js +42 -15
- package/dist/index.umd.min.js +7 -7
- package/package.json +2 -2
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, 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';
|
|
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, 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';
|
|
@@ -3565,12 +3565,17 @@ var DropDownList = function DropDownList() {
|
|
|
3565
3565
|
};
|
|
3566
3566
|
|
|
3567
3567
|
var IframeBoxs = function IframeBoxs() {
|
|
3568
|
-
var _context$insertedIfra;
|
|
3569
3568
|
var _useContext = useContext(WorkbookContext),
|
|
3570
3569
|
context = _useContext.context,
|
|
3571
3570
|
setContext = _useContext.setContext,
|
|
3572
3571
|
refs = _useContext.refs;
|
|
3573
3572
|
var containerRef = useRef(null);
|
|
3573
|
+
var currentSheetIframes = useMemo(function () {
|
|
3574
|
+
var currentSheet = context.luckysheetfile.find(function (sheet) {
|
|
3575
|
+
return sheet.id === context.currentSheetId;
|
|
3576
|
+
});
|
|
3577
|
+
return (currentSheet === null || currentSheet === void 0 ? void 0 : currentSheet.iframes) || [];
|
|
3578
|
+
}, [context.luckysheetfile, context.currentSheetId]);
|
|
3574
3579
|
useEffect(function () {
|
|
3575
3580
|
var handleClickOutside = function handleClickOutside(e) {
|
|
3576
3581
|
if (!containerRef.current) return;
|
|
@@ -3592,7 +3597,7 @@ var IframeBoxs = function IframeBoxs() {
|
|
|
3592
3597
|
return /*#__PURE__*/React.createElement("div", {
|
|
3593
3598
|
id: "fortune-iframe-boxes",
|
|
3594
3599
|
ref: containerRef
|
|
3595
|
-
},
|
|
3600
|
+
}, currentSheetIframes === null || currentSheetIframes === void 0 ? void 0 : currentSheetIframes.map(function (frame) {
|
|
3596
3601
|
var isActive = frame.id === context.activeIframe;
|
|
3597
3602
|
var style = {
|
|
3598
3603
|
width: frame.width * context.zoomRatio,
|
|
@@ -3619,6 +3624,16 @@ var IframeBoxs = function IframeBoxs() {
|
|
|
3619
3624
|
onMouseDown: function onMouseDown(e) {
|
|
3620
3625
|
if (isActive) {
|
|
3621
3626
|
onIframeMoveStart(context, refs.globalCache, e.nativeEvent);
|
|
3627
|
+
var handleMouseMove = function handleMouseMove(moveEvent) {
|
|
3628
|
+
onIframeMove(context, refs.globalCache, moveEvent);
|
|
3629
|
+
};
|
|
3630
|
+
var _handleMouseUp = function handleMouseUp() {
|
|
3631
|
+
onIframeMoveEnd(context, refs.globalCache);
|
|
3632
|
+
document.removeEventListener("mousemove", handleMouseMove);
|
|
3633
|
+
document.removeEventListener("mouseup", _handleMouseUp);
|
|
3634
|
+
};
|
|
3635
|
+
document.addEventListener("mousemove", handleMouseMove);
|
|
3636
|
+
document.addEventListener("mouseup", _handleMouseUp);
|
|
3622
3637
|
}
|
|
3623
3638
|
e.stopPropagation();
|
|
3624
3639
|
}
|
|
@@ -3642,17 +3657,23 @@ var IframeBoxs = function IframeBoxs() {
|
|
|
3642
3657
|
className: "luckysheet-modal-dialog-border"
|
|
3643
3658
|
}), isActive && (/*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
3644
3659
|
className: "luckysheet-modal-dialog-resize"
|
|
3645
|
-
}, ["lt", "mt", "lm", "rm", "rt", "lb", "mb", "rb"].map(function (
|
|
3660
|
+
}, ["lt", "mt", "lm", "rm", "rt", "lb", "mb", "rb"].map(function (v) {
|
|
3646
3661
|
return /*#__PURE__*/React.createElement("div", {
|
|
3647
|
-
key:
|
|
3648
|
-
className: "luckysheet-modal-dialog-resize-item luckysheet-modal-dialog-resize-item-".concat(
|
|
3649
|
-
"data-type":
|
|
3650
|
-
style: {
|
|
3651
|
-
zIndex: 300,
|
|
3652
|
-
position: "absolute"
|
|
3653
|
-
},
|
|
3662
|
+
key: v,
|
|
3663
|
+
className: "luckysheet-modal-dialog-resize-item luckysheet-modal-dialog-resize-item-".concat(v),
|
|
3664
|
+
"data-type": v,
|
|
3654
3665
|
onMouseDown: function onMouseDown(e) {
|
|
3655
|
-
onIframeResizeStart(context, refs.globalCache, e.nativeEvent,
|
|
3666
|
+
onIframeResizeStart(context, refs.globalCache, e.nativeEvent, v);
|
|
3667
|
+
var handleMouseMove = function handleMouseMove(moveEvent) {
|
|
3668
|
+
onIframeResize(context, refs.globalCache, moveEvent);
|
|
3669
|
+
};
|
|
3670
|
+
var _handleMouseUp2 = function handleMouseUp() {
|
|
3671
|
+
onIframeResizeEnd(context, refs.globalCache);
|
|
3672
|
+
document.removeEventListener("mousemove", handleMouseMove);
|
|
3673
|
+
document.removeEventListener("mouseup", _handleMouseUp2);
|
|
3674
|
+
};
|
|
3675
|
+
document.addEventListener("mousemove", handleMouseMove);
|
|
3676
|
+
document.addEventListener("mouseup", _handleMouseUp2);
|
|
3656
3677
|
e.stopPropagation();
|
|
3657
3678
|
}
|
|
3658
3679
|
});
|
|
@@ -3665,10 +3686,15 @@ var IframeBoxs = function IframeBoxs() {
|
|
|
3665
3686
|
title: "Delete",
|
|
3666
3687
|
onClick: function onClick() {
|
|
3667
3688
|
setContext(function (ctx) {
|
|
3668
|
-
var
|
|
3669
|
-
|
|
3670
|
-
return f.id !== frame.id;
|
|
3689
|
+
var currentSheet = ctx.luckysheetfile.find(function (sheet) {
|
|
3690
|
+
return sheet.id === ctx.currentSheetId;
|
|
3671
3691
|
});
|
|
3692
|
+
if (currentSheet) {
|
|
3693
|
+
var _currentSheet$iframes;
|
|
3694
|
+
currentSheet.iframes = (_currentSheet$iframes = currentSheet.iframes) === null || _currentSheet$iframes === void 0 ? void 0 : _currentSheet$iframes.filter(function (f) {
|
|
3695
|
+
return f.id !== frame.id;
|
|
3696
|
+
});
|
|
3697
|
+
}
|
|
3672
3698
|
ctx.activeIframe = undefined;
|
|
3673
3699
|
});
|
|
3674
3700
|
}
|
|
@@ -11767,6 +11793,7 @@ var Workbook = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
11767
11793
|
}
|
|
11768
11794
|
draftCtx.config = _.isNil(sheet.config) ? {} : sheet.config;
|
|
11769
11795
|
draftCtx.insertedImgs = sheet.images;
|
|
11796
|
+
draftCtx.insertedIframes = sheet.iframes;
|
|
11770
11797
|
draftCtx.currency = mergedSettings.currency || "¥";
|
|
11771
11798
|
draftCtx.zoomRatio = _.isNil(sheet.zoomRatio) ? 1 : sheet.zoomRatio;
|
|
11772
11799
|
draftCtx.rowHeaderWidth = mergedSettings.rowHeaderWidth * draftCtx.zoomRatio;
|
package/dist/index.js
CHANGED
|
@@ -3577,12 +3577,17 @@ var DropDownList = function DropDownList() {
|
|
|
3577
3577
|
};
|
|
3578
3578
|
|
|
3579
3579
|
var IframeBoxs = function IframeBoxs() {
|
|
3580
|
-
var _context$insertedIfra;
|
|
3581
3580
|
var _useContext = React.useContext(WorkbookContext),
|
|
3582
3581
|
context = _useContext.context,
|
|
3583
3582
|
setContext = _useContext.setContext,
|
|
3584
3583
|
refs = _useContext.refs;
|
|
3585
3584
|
var containerRef = React.useRef(null);
|
|
3585
|
+
var currentSheetIframes = React.useMemo(function () {
|
|
3586
|
+
var currentSheet = context.luckysheetfile.find(function (sheet) {
|
|
3587
|
+
return sheet.id === context.currentSheetId;
|
|
3588
|
+
});
|
|
3589
|
+
return (currentSheet === null || currentSheet === void 0 ? void 0 : currentSheet.iframes) || [];
|
|
3590
|
+
}, [context.luckysheetfile, context.currentSheetId]);
|
|
3586
3591
|
React.useEffect(function () {
|
|
3587
3592
|
var handleClickOutside = function handleClickOutside(e) {
|
|
3588
3593
|
if (!containerRef.current) return;
|
|
@@ -3604,7 +3609,7 @@ var IframeBoxs = function IframeBoxs() {
|
|
|
3604
3609
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
3605
3610
|
id: "fortune-iframe-boxes",
|
|
3606
3611
|
ref: containerRef
|
|
3607
|
-
},
|
|
3612
|
+
}, currentSheetIframes === null || currentSheetIframes === void 0 ? void 0 : currentSheetIframes.map(function (frame) {
|
|
3608
3613
|
var isActive = frame.id === context.activeIframe;
|
|
3609
3614
|
var style = {
|
|
3610
3615
|
width: frame.width * context.zoomRatio,
|
|
@@ -3631,6 +3636,16 @@ var IframeBoxs = function IframeBoxs() {
|
|
|
3631
3636
|
onMouseDown: function onMouseDown(e) {
|
|
3632
3637
|
if (isActive) {
|
|
3633
3638
|
fortuneCore.onIframeMoveStart(context, refs.globalCache, e.nativeEvent);
|
|
3639
|
+
var handleMouseMove = function handleMouseMove(moveEvent) {
|
|
3640
|
+
fortuneCore.onIframeMove(context, refs.globalCache, moveEvent);
|
|
3641
|
+
};
|
|
3642
|
+
var _handleMouseUp = function handleMouseUp() {
|
|
3643
|
+
fortuneCore.onIframeMoveEnd(context, refs.globalCache);
|
|
3644
|
+
document.removeEventListener("mousemove", handleMouseMove);
|
|
3645
|
+
document.removeEventListener("mouseup", _handleMouseUp);
|
|
3646
|
+
};
|
|
3647
|
+
document.addEventListener("mousemove", handleMouseMove);
|
|
3648
|
+
document.addEventListener("mouseup", _handleMouseUp);
|
|
3634
3649
|
}
|
|
3635
3650
|
e.stopPropagation();
|
|
3636
3651
|
}
|
|
@@ -3654,17 +3669,23 @@ var IframeBoxs = function IframeBoxs() {
|
|
|
3654
3669
|
className: "luckysheet-modal-dialog-border"
|
|
3655
3670
|
}), isActive && (/*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
3656
3671
|
className: "luckysheet-modal-dialog-resize"
|
|
3657
|
-
}, ["lt", "mt", "lm", "rm", "rt", "lb", "mb", "rb"].map(function (
|
|
3672
|
+
}, ["lt", "mt", "lm", "rm", "rt", "lb", "mb", "rb"].map(function (v) {
|
|
3658
3673
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
3659
|
-
key:
|
|
3660
|
-
className: "luckysheet-modal-dialog-resize-item luckysheet-modal-dialog-resize-item-".concat(
|
|
3661
|
-
"data-type":
|
|
3662
|
-
style: {
|
|
3663
|
-
zIndex: 300,
|
|
3664
|
-
position: "absolute"
|
|
3665
|
-
},
|
|
3674
|
+
key: v,
|
|
3675
|
+
className: "luckysheet-modal-dialog-resize-item luckysheet-modal-dialog-resize-item-".concat(v),
|
|
3676
|
+
"data-type": v,
|
|
3666
3677
|
onMouseDown: function onMouseDown(e) {
|
|
3667
|
-
fortuneCore.onIframeResizeStart(context, refs.globalCache, e.nativeEvent,
|
|
3678
|
+
fortuneCore.onIframeResizeStart(context, refs.globalCache, e.nativeEvent, v);
|
|
3679
|
+
var handleMouseMove = function handleMouseMove(moveEvent) {
|
|
3680
|
+
fortuneCore.onIframeResize(context, refs.globalCache, moveEvent);
|
|
3681
|
+
};
|
|
3682
|
+
var _handleMouseUp2 = function handleMouseUp() {
|
|
3683
|
+
fortuneCore.onIframeResizeEnd(context, refs.globalCache);
|
|
3684
|
+
document.removeEventListener("mousemove", handleMouseMove);
|
|
3685
|
+
document.removeEventListener("mouseup", _handleMouseUp2);
|
|
3686
|
+
};
|
|
3687
|
+
document.addEventListener("mousemove", handleMouseMove);
|
|
3688
|
+
document.addEventListener("mouseup", _handleMouseUp2);
|
|
3668
3689
|
e.stopPropagation();
|
|
3669
3690
|
}
|
|
3670
3691
|
});
|
|
@@ -3677,10 +3698,15 @@ var IframeBoxs = function IframeBoxs() {
|
|
|
3677
3698
|
title: "Delete",
|
|
3678
3699
|
onClick: function onClick() {
|
|
3679
3700
|
setContext(function (ctx) {
|
|
3680
|
-
var
|
|
3681
|
-
|
|
3682
|
-
return f.id !== frame.id;
|
|
3701
|
+
var currentSheet = ctx.luckysheetfile.find(function (sheet) {
|
|
3702
|
+
return sheet.id === ctx.currentSheetId;
|
|
3683
3703
|
});
|
|
3704
|
+
if (currentSheet) {
|
|
3705
|
+
var _currentSheet$iframes;
|
|
3706
|
+
currentSheet.iframes = (_currentSheet$iframes = currentSheet.iframes) === null || _currentSheet$iframes === void 0 ? void 0 : _currentSheet$iframes.filter(function (f) {
|
|
3707
|
+
return f.id !== frame.id;
|
|
3708
|
+
});
|
|
3709
|
+
}
|
|
3684
3710
|
ctx.activeIframe = undefined;
|
|
3685
3711
|
});
|
|
3686
3712
|
}
|
|
@@ -11779,6 +11805,7 @@ var Workbook = /*#__PURE__*/React__default['default'].forwardRef(function (_ref,
|
|
|
11779
11805
|
}
|
|
11780
11806
|
draftCtx.config = ___default['default'].isNil(sheet.config) ? {} : sheet.config;
|
|
11781
11807
|
draftCtx.insertedImgs = sheet.images;
|
|
11808
|
+
draftCtx.insertedIframes = sheet.iframes;
|
|
11782
11809
|
draftCtx.currency = mergedSettings.currency || "¥";
|
|
11783
11810
|
draftCtx.zoomRatio = ___default['default'].isNil(sheet.zoomRatio) ? 1 : sheet.zoomRatio;
|
|
11784
11811
|
draftCtx.rowHeaderWidth = mergedSettings.rowHeaderWidth * draftCtx.zoomRatio;
|