@fileverse-dev/fortune-react 1.0.2-mod-56 → 1.0.2-mod-55-safe-patch-1
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 +36 -145
- package/dist/index.js +34 -143
- package/dist/index.umd.js +384 -200
- package/dist/index.umd.min.js +9 -9
- package/package.json +2 -2
- package/dist/components/ResetColumnWidth/index.d.ts +0 -2
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,
|
|
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';
|
|
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
|
|
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';
|
|
6
6
|
import regeneratorRuntime from 'regenerator-runtime';
|
|
7
7
|
import Tippy from '@tippyjs/react';
|
|
8
8
|
|
|
@@ -269,15 +269,6 @@ 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
|
-
}
|
|
281
272
|
function _unsupportedIterableToArray(r, a) {
|
|
282
273
|
if (r) {
|
|
283
274
|
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
@@ -4728,8 +4719,7 @@ var SplitColumn = function SplitColumn() {
|
|
|
4728
4719
|
tabIndex: 0
|
|
4729
4720
|
}), /*#__PURE__*/React.createElement("label", {
|
|
4730
4721
|
htmlFor: "other"
|
|
4731
|
-
}, "Custom"), /*#__PURE__*/React.createElement(
|
|
4732
|
-
placeholder: "Custom separator",
|
|
4722
|
+
}, "Custom"), /*#__PURE__*/React.createElement("input", {
|
|
4733
4723
|
id: "otherValue",
|
|
4734
4724
|
name: "otherValue",
|
|
4735
4725
|
type: "text",
|
|
@@ -7495,135 +7485,6 @@ var SheetTab = function SheetTab() {
|
|
|
7495
7485
|
}, /*#__PURE__*/React.createElement(ZoomControl, null)));
|
|
7496
7486
|
};
|
|
7497
7487
|
|
|
7498
|
-
var ResetColumnWidth = function ResetColumnWidth() {
|
|
7499
|
-
var _useContext = useContext(WorkbookContext),
|
|
7500
|
-
context = _useContext.context,
|
|
7501
|
-
setContext = _useContext.setContext;
|
|
7502
|
-
var _useAlert = useAlert(),
|
|
7503
|
-
showAlert = _useAlert.showAlert;
|
|
7504
|
-
var _locale = locale(context),
|
|
7505
|
-
button = _locale.button;
|
|
7506
|
-
var _useDialog = useDialog(),
|
|
7507
|
-
hideDialog = _useDialog.hideDialog;
|
|
7508
|
-
var _useState = useState("number"),
|
|
7509
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
7510
|
-
radioValue = _useState2[0],
|
|
7511
|
-
setRadioValue = _useState2[1];
|
|
7512
|
-
var _useState3 = useState(100),
|
|
7513
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
7514
|
-
numberValue = _useState4[0],
|
|
7515
|
-
setNumberValue = _useState4[1];
|
|
7516
|
-
var getMaxCellWidth = function getMaxCellWidth(col) {
|
|
7517
|
-
var data = getFlowdata(context);
|
|
7518
|
-
var maxWidth = 100;
|
|
7519
|
-
if (data) {
|
|
7520
|
-
for (var i = 0; i < data.length; i += 1) {
|
|
7521
|
-
var cellD = data[i][col];
|
|
7522
|
-
if (typeof cellD === 'string') {
|
|
7523
|
-
if (cellD.length * 7 > maxWidth) {
|
|
7524
|
-
maxWidth = cellD.length * 7;
|
|
7525
|
-
}
|
|
7526
|
-
} else if (_typeof(cellD) === 'object' && cellD !== null) {
|
|
7527
|
-
console.log(cellD, "cellD");
|
|
7528
|
-
var cellText = cellD.v || cellD.m;
|
|
7529
|
-
if (cellText.length * 7 > maxWidth) {
|
|
7530
|
-
maxWidth = cellText.length * 7;
|
|
7531
|
-
}
|
|
7532
|
-
}
|
|
7533
|
-
}
|
|
7534
|
-
}
|
|
7535
|
-
return maxWidth;
|
|
7536
|
-
};
|
|
7537
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
7538
|
-
id: "fortune-split-column"
|
|
7539
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
7540
|
-
className: ""
|
|
7541
|
-
}, /*#__PURE__*/React.createElement(RadioGroup, {
|
|
7542
|
-
defaultValue: radioValue,
|
|
7543
|
-
onValueChange: function onValueChange(value) {
|
|
7544
|
-
setRadioValue(value);
|
|
7545
|
-
}
|
|
7546
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
7547
|
-
className: "flex-col gap-4"
|
|
7548
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
7549
|
-
className: "flex items-center space-x-1"
|
|
7550
|
-
}, /*#__PURE__*/React.createElement(RadioGroupItem, {
|
|
7551
|
-
id: "r1",
|
|
7552
|
-
size: "lg",
|
|
7553
|
-
value: "number"
|
|
7554
|
-
}), /*#__PURE__*/React.createElement(Label, {
|
|
7555
|
-
className: "text-heading-xsm",
|
|
7556
|
-
htmlFor: "r1"
|
|
7557
|
-
}, "Enter new column width in pixels. (Default: 80)")), /*#__PURE__*/React.createElement(TextField, {
|
|
7558
|
-
className: "w-1/3 my-4",
|
|
7559
|
-
defaultValue: numberValue,
|
|
7560
|
-
isValid: true,
|
|
7561
|
-
onChange: function onChange(e) {
|
|
7562
|
-
setNumberValue(e.target.value);
|
|
7563
|
-
},
|
|
7564
|
-
placeholder: "Number"
|
|
7565
|
-
})), /*#__PURE__*/React.createElement("div", {
|
|
7566
|
-
className: "flex items-center space-x-1 mb-4"
|
|
7567
|
-
}, /*#__PURE__*/React.createElement(RadioGroupItem, {
|
|
7568
|
-
id: "r2",
|
|
7569
|
-
size: "lg",
|
|
7570
|
-
value: "fit"
|
|
7571
|
-
}), /*#__PURE__*/React.createElement(Label, {
|
|
7572
|
-
className: "text-heading-xsm",
|
|
7573
|
-
htmlFor: "r2"
|
|
7574
|
-
}, "Fit to data")))), /*#__PURE__*/React.createElement("div", {
|
|
7575
|
-
className: "flex justify-end gap-2"
|
|
7576
|
-
}, /*#__PURE__*/React.createElement(Button$1, {
|
|
7577
|
-
variant: "secondary",
|
|
7578
|
-
onClick: function onClick() {
|
|
7579
|
-
hideDialog();
|
|
7580
|
-
},
|
|
7581
|
-
tabIndex: 0
|
|
7582
|
-
}, button.cancel), /*#__PURE__*/React.createElement(Button$1, {
|
|
7583
|
-
onClick: function onClick() {
|
|
7584
|
-
if (radioValue === "number") {
|
|
7585
|
-
var targetColWidth = numberValue;
|
|
7586
|
-
setContext(function (draftCtx) {
|
|
7587
|
-
if (_.isUndefined(targetColWidth) || targetColWidth === null || targetColWidth <= 0 || targetColWidth > 2038) {
|
|
7588
|
-
showAlert("The column width must be between 0 ~ 2038", "ok");
|
|
7589
|
-
draftCtx.contextMenu = {};
|
|
7590
|
-
return;
|
|
7591
|
-
}
|
|
7592
|
-
var numColWidth = targetColWidth;
|
|
7593
|
-
var colWidthList = {};
|
|
7594
|
-
_.forEach(draftCtx.luckysheet_select_save, function (section) {
|
|
7595
|
-
for (var colNum = section.column[0]; colNum <= section.column[1]; colNum += 1) {
|
|
7596
|
-
getMaxCellWidth(colNum);
|
|
7597
|
-
colWidthList[colNum] = numColWidth;
|
|
7598
|
-
}
|
|
7599
|
-
});
|
|
7600
|
-
api.setColumnWidth(draftCtx, colWidthList, {}, true);
|
|
7601
|
-
draftCtx.contextMenu = {};
|
|
7602
|
-
});
|
|
7603
|
-
} else {
|
|
7604
|
-
var _targetColWidth = numberValue;
|
|
7605
|
-
setContext(function (draftCtx) {
|
|
7606
|
-
if (_.isUndefined(_targetColWidth) || _targetColWidth === null || _targetColWidth <= 0 || _targetColWidth > 2038) {
|
|
7607
|
-
showAlert("The column width must be between 0 ~ 2038", "ok");
|
|
7608
|
-
draftCtx.contextMenu = {};
|
|
7609
|
-
return;
|
|
7610
|
-
}
|
|
7611
|
-
var colWidthList = {};
|
|
7612
|
-
_.forEach(draftCtx.luckysheet_select_save, function (section) {
|
|
7613
|
-
for (var colNum = section.column[0]; colNum <= section.column[1]; colNum += 1) {
|
|
7614
|
-
colWidthList[colNum] = getMaxCellWidth(colNum);
|
|
7615
|
-
}
|
|
7616
|
-
});
|
|
7617
|
-
api.setColumnWidth(draftCtx, colWidthList, {}, true);
|
|
7618
|
-
draftCtx.contextMenu = {};
|
|
7619
|
-
});
|
|
7620
|
-
}
|
|
7621
|
-
hideDialog();
|
|
7622
|
-
},
|
|
7623
|
-
tabIndex: 0
|
|
7624
|
-
}, "Ok")));
|
|
7625
|
-
};
|
|
7626
|
-
|
|
7627
7488
|
var Divider$1 = function Divider() {
|
|
7628
7489
|
return /*#__PURE__*/React.createElement("div", {
|
|
7629
7490
|
className: "fortune-context-menu-divider"
|
|
@@ -8343,11 +8204,24 @@ var ContextMenu = function ContextMenu() {
|
|
|
8343
8204
|
})) ? (/*#__PURE__*/React.createElement(Menu, {
|
|
8344
8205
|
key: "set-column-width",
|
|
8345
8206
|
onClick: function onClick(e, container) {
|
|
8346
|
-
|
|
8207
|
+
var _container$querySelec2;
|
|
8208
|
+
var targetColWidth = (_container$querySelec2 = container.querySelector("input")) === null || _container$querySelec2 === void 0 ? void 0 : _container$querySelec2.value;
|
|
8347
8209
|
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);
|
|
8348
8223
|
draftCtx.contextMenu = {};
|
|
8349
8224
|
});
|
|
8350
|
-
return;
|
|
8351
8225
|
}
|
|
8352
8226
|
}, /*#__PURE__*/React.createElement("div", {
|
|
8353
8227
|
className: "context-item"
|
|
@@ -8358,7 +8232,24 @@ var ContextMenu = function ContextMenu() {
|
|
|
8358
8232
|
style: {
|
|
8359
8233
|
marginRight: "8px"
|
|
8360
8234
|
}
|
|
8361
|
-
}), /*#__PURE__*/React.createElement("div", null, "Resize column
|
|
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;
|
|
8362
8253
|
}
|
|
8363
8254
|
if (name === "clear") {
|
|
8364
8255
|
return /*#__PURE__*/React.createElement(Menu, {
|
package/dist/index.js
CHANGED
|
@@ -281,15 +281,6 @@ function _toPropertyKey(t) {
|
|
|
281
281
|
var i = _toPrimitive(t, "string");
|
|
282
282
|
return "symbol" == typeof i ? i : i + "";
|
|
283
283
|
}
|
|
284
|
-
function _typeof(o) {
|
|
285
|
-
"@babel/helpers - typeof";
|
|
286
|
-
|
|
287
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
288
|
-
return typeof o;
|
|
289
|
-
} : function (o) {
|
|
290
|
-
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
291
|
-
}, _typeof(o);
|
|
292
|
-
}
|
|
293
284
|
function _unsupportedIterableToArray(r, a) {
|
|
294
285
|
if (r) {
|
|
295
286
|
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
@@ -4740,8 +4731,7 @@ var SplitColumn = function SplitColumn() {
|
|
|
4740
4731
|
tabIndex: 0
|
|
4741
4732
|
}), /*#__PURE__*/React__default['default'].createElement("label", {
|
|
4742
4733
|
htmlFor: "other"
|
|
4743
|
-
}, "Custom"), /*#__PURE__*/React__default['default'].createElement(
|
|
4744
|
-
placeholder: "Custom separator",
|
|
4734
|
+
}, "Custom"), /*#__PURE__*/React__default['default'].createElement("input", {
|
|
4745
4735
|
id: "otherValue",
|
|
4746
4736
|
name: "otherValue",
|
|
4747
4737
|
type: "text",
|
|
@@ -7507,135 +7497,6 @@ var SheetTab = function SheetTab() {
|
|
|
7507
7497
|
}, /*#__PURE__*/React__default['default'].createElement(ZoomControl, null)));
|
|
7508
7498
|
};
|
|
7509
7499
|
|
|
7510
|
-
var ResetColumnWidth = function ResetColumnWidth() {
|
|
7511
|
-
var _useContext = React.useContext(WorkbookContext),
|
|
7512
|
-
context = _useContext.context,
|
|
7513
|
-
setContext = _useContext.setContext;
|
|
7514
|
-
var _useAlert = useAlert(),
|
|
7515
|
-
showAlert = _useAlert.showAlert;
|
|
7516
|
-
var _locale = fortuneCore.locale(context),
|
|
7517
|
-
button = _locale.button;
|
|
7518
|
-
var _useDialog = useDialog(),
|
|
7519
|
-
hideDialog = _useDialog.hideDialog;
|
|
7520
|
-
var _useState = React.useState("number"),
|
|
7521
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
7522
|
-
radioValue = _useState2[0],
|
|
7523
|
-
setRadioValue = _useState2[1];
|
|
7524
|
-
var _useState3 = React.useState(100),
|
|
7525
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
7526
|
-
numberValue = _useState4[0],
|
|
7527
|
-
setNumberValue = _useState4[1];
|
|
7528
|
-
var getMaxCellWidth = function getMaxCellWidth(col) {
|
|
7529
|
-
var data = fortuneCore.getFlowdata(context);
|
|
7530
|
-
var maxWidth = 100;
|
|
7531
|
-
if (data) {
|
|
7532
|
-
for (var i = 0; i < data.length; i += 1) {
|
|
7533
|
-
var cellD = data[i][col];
|
|
7534
|
-
if (typeof cellD === 'string') {
|
|
7535
|
-
if (cellD.length * 7 > maxWidth) {
|
|
7536
|
-
maxWidth = cellD.length * 7;
|
|
7537
|
-
}
|
|
7538
|
-
} else if (_typeof(cellD) === 'object' && cellD !== null) {
|
|
7539
|
-
console.log(cellD, "cellD");
|
|
7540
|
-
var cellText = cellD.v || cellD.m;
|
|
7541
|
-
if (cellText.length * 7 > maxWidth) {
|
|
7542
|
-
maxWidth = cellText.length * 7;
|
|
7543
|
-
}
|
|
7544
|
-
}
|
|
7545
|
-
}
|
|
7546
|
-
}
|
|
7547
|
-
return maxWidth;
|
|
7548
|
-
};
|
|
7549
|
-
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
7550
|
-
id: "fortune-split-column"
|
|
7551
|
-
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
7552
|
-
className: ""
|
|
7553
|
-
}, /*#__PURE__*/React__default['default'].createElement(ui.RadioGroup, {
|
|
7554
|
-
defaultValue: radioValue,
|
|
7555
|
-
onValueChange: function onValueChange(value) {
|
|
7556
|
-
setRadioValue(value);
|
|
7557
|
-
}
|
|
7558
|
-
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
7559
|
-
className: "flex-col gap-4"
|
|
7560
|
-
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
7561
|
-
className: "flex items-center space-x-1"
|
|
7562
|
-
}, /*#__PURE__*/React__default['default'].createElement(ui.RadioGroupItem, {
|
|
7563
|
-
id: "r1",
|
|
7564
|
-
size: "lg",
|
|
7565
|
-
value: "number"
|
|
7566
|
-
}), /*#__PURE__*/React__default['default'].createElement(ui.Label, {
|
|
7567
|
-
className: "text-heading-xsm",
|
|
7568
|
-
htmlFor: "r1"
|
|
7569
|
-
}, "Enter new column width in pixels. (Default: 80)")), /*#__PURE__*/React__default['default'].createElement(ui.TextField, {
|
|
7570
|
-
className: "w-1/3 my-4",
|
|
7571
|
-
defaultValue: numberValue,
|
|
7572
|
-
isValid: true,
|
|
7573
|
-
onChange: function onChange(e) {
|
|
7574
|
-
setNumberValue(e.target.value);
|
|
7575
|
-
},
|
|
7576
|
-
placeholder: "Number"
|
|
7577
|
-
})), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
7578
|
-
className: "flex items-center space-x-1 mb-4"
|
|
7579
|
-
}, /*#__PURE__*/React__default['default'].createElement(ui.RadioGroupItem, {
|
|
7580
|
-
id: "r2",
|
|
7581
|
-
size: "lg",
|
|
7582
|
-
value: "fit"
|
|
7583
|
-
}), /*#__PURE__*/React__default['default'].createElement(ui.Label, {
|
|
7584
|
-
className: "text-heading-xsm",
|
|
7585
|
-
htmlFor: "r2"
|
|
7586
|
-
}, "Fit to data")))), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
7587
|
-
className: "flex justify-end gap-2"
|
|
7588
|
-
}, /*#__PURE__*/React__default['default'].createElement(ui.Button, {
|
|
7589
|
-
variant: "secondary",
|
|
7590
|
-
onClick: function onClick() {
|
|
7591
|
-
hideDialog();
|
|
7592
|
-
},
|
|
7593
|
-
tabIndex: 0
|
|
7594
|
-
}, button.cancel), /*#__PURE__*/React__default['default'].createElement(ui.Button, {
|
|
7595
|
-
onClick: function onClick() {
|
|
7596
|
-
if (radioValue === "number") {
|
|
7597
|
-
var targetColWidth = numberValue;
|
|
7598
|
-
setContext(function (draftCtx) {
|
|
7599
|
-
if (___default['default'].isUndefined(targetColWidth) || targetColWidth === null || targetColWidth <= 0 || targetColWidth > 2038) {
|
|
7600
|
-
showAlert("The column width must be between 0 ~ 2038", "ok");
|
|
7601
|
-
draftCtx.contextMenu = {};
|
|
7602
|
-
return;
|
|
7603
|
-
}
|
|
7604
|
-
var numColWidth = targetColWidth;
|
|
7605
|
-
var colWidthList = {};
|
|
7606
|
-
___default['default'].forEach(draftCtx.luckysheet_select_save, function (section) {
|
|
7607
|
-
for (var colNum = section.column[0]; colNum <= section.column[1]; colNum += 1) {
|
|
7608
|
-
getMaxCellWidth(colNum);
|
|
7609
|
-
colWidthList[colNum] = numColWidth;
|
|
7610
|
-
}
|
|
7611
|
-
});
|
|
7612
|
-
fortuneCore.api.setColumnWidth(draftCtx, colWidthList, {}, true);
|
|
7613
|
-
draftCtx.contextMenu = {};
|
|
7614
|
-
});
|
|
7615
|
-
} else {
|
|
7616
|
-
var _targetColWidth = numberValue;
|
|
7617
|
-
setContext(function (draftCtx) {
|
|
7618
|
-
if (___default['default'].isUndefined(_targetColWidth) || _targetColWidth === null || _targetColWidth <= 0 || _targetColWidth > 2038) {
|
|
7619
|
-
showAlert("The column width must be between 0 ~ 2038", "ok");
|
|
7620
|
-
draftCtx.contextMenu = {};
|
|
7621
|
-
return;
|
|
7622
|
-
}
|
|
7623
|
-
var colWidthList = {};
|
|
7624
|
-
___default['default'].forEach(draftCtx.luckysheet_select_save, function (section) {
|
|
7625
|
-
for (var colNum = section.column[0]; colNum <= section.column[1]; colNum += 1) {
|
|
7626
|
-
colWidthList[colNum] = getMaxCellWidth(colNum);
|
|
7627
|
-
}
|
|
7628
|
-
});
|
|
7629
|
-
fortuneCore.api.setColumnWidth(draftCtx, colWidthList, {}, true);
|
|
7630
|
-
draftCtx.contextMenu = {};
|
|
7631
|
-
});
|
|
7632
|
-
}
|
|
7633
|
-
hideDialog();
|
|
7634
|
-
},
|
|
7635
|
-
tabIndex: 0
|
|
7636
|
-
}, "Ok")));
|
|
7637
|
-
};
|
|
7638
|
-
|
|
7639
7500
|
var Divider$1 = function Divider() {
|
|
7640
7501
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
7641
7502
|
className: "fortune-context-menu-divider"
|
|
@@ -8355,11 +8216,24 @@ var ContextMenu = function ContextMenu() {
|
|
|
8355
8216
|
})) ? (/*#__PURE__*/React__default['default'].createElement(Menu, {
|
|
8356
8217
|
key: "set-column-width",
|
|
8357
8218
|
onClick: function onClick(e, container) {
|
|
8358
|
-
|
|
8219
|
+
var _container$querySelec2;
|
|
8220
|
+
var targetColWidth = (_container$querySelec2 = container.querySelector("input")) === null || _container$querySelec2 === void 0 ? void 0 : _container$querySelec2.value;
|
|
8359
8221
|
setContext(function (draftCtx) {
|
|
8222
|
+
if (___default['default'].isUndefined(targetColWidth) || targetColWidth === "" || parseInt(targetColWidth, 10) <= 0 || parseInt(targetColWidth, 10) > 2038) {
|
|
8223
|
+
showAlert(info.tipColumnWidthLimit, "ok");
|
|
8224
|
+
draftCtx.contextMenu = {};
|
|
8225
|
+
return;
|
|
8226
|
+
}
|
|
8227
|
+
var numColWidth = parseInt(targetColWidth, 10);
|
|
8228
|
+
var colWidthList = {};
|
|
8229
|
+
___default['default'].forEach(draftCtx.luckysheet_select_save, function (section) {
|
|
8230
|
+
for (var colNum = section.column[0]; colNum <= section.column[1]; colNum += 1) {
|
|
8231
|
+
colWidthList[colNum] = numColWidth;
|
|
8232
|
+
}
|
|
8233
|
+
});
|
|
8234
|
+
fortuneCore.api.setColumnWidth(draftCtx, colWidthList, {}, true);
|
|
8360
8235
|
draftCtx.contextMenu = {};
|
|
8361
8236
|
});
|
|
8362
|
-
return;
|
|
8363
8237
|
}
|
|
8364
8238
|
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
8365
8239
|
className: "context-item"
|
|
@@ -8370,7 +8244,24 @@ var ContextMenu = function ContextMenu() {
|
|
|
8370
8244
|
style: {
|
|
8371
8245
|
marginRight: "8px"
|
|
8372
8246
|
}
|
|
8373
|
-
}), /*#__PURE__*/React__default['default'].createElement("div", null, "Resize column
|
|
8247
|
+
}), /*#__PURE__*/React__default['default'].createElement("div", null, "Resize column height", /*#__PURE__*/React__default['default'].createElement("input", {
|
|
8248
|
+
onClick: function onClick(e) {
|
|
8249
|
+
return e.stopPropagation();
|
|
8250
|
+
},
|
|
8251
|
+
onKeyDown: function onKeyDown(e) {
|
|
8252
|
+
return e.stopPropagation();
|
|
8253
|
+
},
|
|
8254
|
+
tabIndex: 0,
|
|
8255
|
+
type: "number",
|
|
8256
|
+
min: 1,
|
|
8257
|
+
max: 545,
|
|
8258
|
+
className: "luckysheet-mousedown-cancel",
|
|
8259
|
+
placeholder: rightclick.number,
|
|
8260
|
+
defaultValue: shownColWidth,
|
|
8261
|
+
style: {
|
|
8262
|
+
width: "40px"
|
|
8263
|
+
}
|
|
8264
|
+
}), "px")))) : null;
|
|
8374
8265
|
}
|
|
8375
8266
|
if (name === "clear") {
|
|
8376
8267
|
return /*#__PURE__*/React__default['default'].createElement(Menu, {
|