@leankylin-sheet/react 7.0.12 → 7.0.13
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.css +36 -0
- package/dist/index.esm.css +36 -0
- package/dist/index.esm.js +38 -10
- package/dist/index.js +37 -9
- package/dist/index.umd.css +36 -0
- package/dist/index.umd.js +37 -9
- package/dist/index.umd.min.css +1 -1
- package/dist/index.umd.min.js +1 -1
- package/package.json +3 -3
package/dist/index.css
CHANGED
|
@@ -3246,6 +3246,42 @@ label {
|
|
|
3246
3246
|
background: #e3edfd;
|
|
3247
3247
|
}
|
|
3248
3248
|
|
|
3249
|
+
.custom-format-preview {
|
|
3250
|
+
display: flex;
|
|
3251
|
+
align-items: center;
|
|
3252
|
+
margin-top: 10px;
|
|
3253
|
+
padding: 6px 10px;
|
|
3254
|
+
background: #f5f6f7;
|
|
3255
|
+
border-radius: 2px;
|
|
3256
|
+
font-size: 12px;
|
|
3257
|
+
}
|
|
3258
|
+
|
|
3259
|
+
.custom-format-preview-title {
|
|
3260
|
+
color: #666;
|
|
3261
|
+
flex-shrink: 0;
|
|
3262
|
+
}
|
|
3263
|
+
|
|
3264
|
+
.custom-format-preview-origin {
|
|
3265
|
+
margin-left: 4px;
|
|
3266
|
+
color: #333;
|
|
3267
|
+
}
|
|
3268
|
+
|
|
3269
|
+
.custom-format-preview-arrow {
|
|
3270
|
+
margin: 0 8px;
|
|
3271
|
+
color: #999;
|
|
3272
|
+
}
|
|
3273
|
+
|
|
3274
|
+
.custom-format-preview-result {
|
|
3275
|
+
color: #1a73e8;
|
|
3276
|
+
font-weight: 600;
|
|
3277
|
+
word-break: break-all;
|
|
3278
|
+
}
|
|
3279
|
+
|
|
3280
|
+
.custom-format-preview-result.invalid {
|
|
3281
|
+
color: #d93025;
|
|
3282
|
+
font-weight: 400;
|
|
3283
|
+
}
|
|
3284
|
+
|
|
3249
3285
|
.leankylin-fx-editor {
|
|
3250
3286
|
display: flex;
|
|
3251
3287
|
flex-direction: row;
|
package/dist/index.esm.css
CHANGED
|
@@ -3246,6 +3246,42 @@ label {
|
|
|
3246
3246
|
background: #e3edfd;
|
|
3247
3247
|
}
|
|
3248
3248
|
|
|
3249
|
+
.custom-format-preview {
|
|
3250
|
+
display: flex;
|
|
3251
|
+
align-items: center;
|
|
3252
|
+
margin-top: 10px;
|
|
3253
|
+
padding: 6px 10px;
|
|
3254
|
+
background: #f5f6f7;
|
|
3255
|
+
border-radius: 2px;
|
|
3256
|
+
font-size: 12px;
|
|
3257
|
+
}
|
|
3258
|
+
|
|
3259
|
+
.custom-format-preview-title {
|
|
3260
|
+
color: #666;
|
|
3261
|
+
flex-shrink: 0;
|
|
3262
|
+
}
|
|
3263
|
+
|
|
3264
|
+
.custom-format-preview-origin {
|
|
3265
|
+
margin-left: 4px;
|
|
3266
|
+
color: #333;
|
|
3267
|
+
}
|
|
3268
|
+
|
|
3269
|
+
.custom-format-preview-arrow {
|
|
3270
|
+
margin: 0 8px;
|
|
3271
|
+
color: #999;
|
|
3272
|
+
}
|
|
3273
|
+
|
|
3274
|
+
.custom-format-preview-result {
|
|
3275
|
+
color: #1a73e8;
|
|
3276
|
+
font-weight: 600;
|
|
3277
|
+
word-break: break-all;
|
|
3278
|
+
}
|
|
3279
|
+
|
|
3280
|
+
.custom-format-preview-result.invalid {
|
|
3281
|
+
color: #d93025;
|
|
3282
|
+
font-weight: 400;
|
|
3283
|
+
}
|
|
3284
|
+
|
|
3249
3285
|
.leankylin-fx-editor {
|
|
3250
3286
|
display: flex;
|
|
3251
3287
|
flex-direction: row;
|
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, functionHTMLGenerate, locale, getCellValue, createRangeHightlight, isInlineStringCell, getInlineStringHTML, valueShowEs, escapeHTMLTag, escapeScriptTag, isShowHidenCR, cancelNormalSelected, moveHighlightCell, updateCell, israngeseleciton, handleFormulaInput, onSearchDialogMoveStart, replaceAll, replace, searchAll, searchNext, changeSheet, normalizeSelection, scrollToHighlightCell, chatatABC, getCellHyperlink, isLinkValid, getRangetxt, goToLink, replaceHtml, removeHyperlink, onRangeSelectionModalMoveStart, saveHyperlink, createFilterOptions, onImageMoveStart, onImageResizeStart, showComments, setEditingComment, onCommentBoxMoveStart, onCommentBoxResizeStart, confirmMessage, getRangeByTxt, getDropdownList, setCellValue, setConditionRules, mergeBorder, setDropcownValue, handleCellAreaMouseDown, handleCellAreaMouseMove, handleCellAreaDragOver, handleCellDrop, handleCellAreaDoubleClick, selectAll, showLinkCard, getCellRowColumn, handleOverlayMouseMove, handleOverlayMouseUp, handleKeydownForZoom, handleOverlayTouchStart, handleOverlayTouchMove, handleOverlayTouchEnd, PAINT_MODEL_CURSOR, onCellsMoveStart, createDropCellRange, handleDropCellDoubleClick, updateContextWithSheetData, updateContextWithCanvas, initFreeze, Canvas, handleGlobalWheel, setCaretPosition, getDataArr, updateMoreCell, getRegStr, getOptionValue, getSelectRange, applyLocation, updateItem, 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, getDataBySelectionNoCopy, getInlineStringNoStyle, rangeHightlightselected, editSheetName, setNextSheet, MAX_ZOOM_RATIO, MIN_ZOOM_RATIO, addSheet, indexToColumnChar, sortSelection, handleCopy, insertRowCol, deleteRowCol, hideSelected, showSelected, api, removeActiveImage, deleteSelectedCellText, jfrefreshgrid, handleLink, deleteSheet, opToPatch, orderbydatafiler, getFilterColumnValues, getFilterColumnColors, saveFilter, cancelActiveImgItem, patchToOp, filterPatch, inverseRowColOptions, ensureSheetIndex, initSheetIndex, handleGlobalKeyDown, handlePasteByLeanklin, groupValuesRefresh } from '@leankylin-sheet/core';
|
|
1
|
+
import { defaultContext, defaultSettings, getSheetIndex, colLocationByIndex, fixPositionOnFrozenCells, colLocation, getFlowdata, isAllowEdit, handleColumnHeaderMouseDown, handleColSizeHandleMouseDown, handleColFreezeHandleMouseDown, handleContextMenu, selectTitlesMap, selectTitlesRange, fixColumnStyleOverflowInFreeze, rowLocationByIndex, rowLocation, handleRowHeaderMouseDown, handleRowSizeHandleMouseDown, handleRowFreezeHandleMouseDown, fixRowStyleOverflowInFreeze, functionHTMLGenerate, locale, getCellValue, createRangeHightlight, isInlineStringCell, getInlineStringHTML, valueShowEs, escapeHTMLTag, escapeScriptTag, isShowHidenCR, cancelNormalSelected, moveHighlightCell, updateCell, israngeseleciton, handleFormulaInput, onSearchDialogMoveStart, replaceAll, replace, searchAll, searchNext, changeSheet, normalizeSelection, scrollToHighlightCell, chatatABC, getCellHyperlink, isLinkValid, getRangetxt, goToLink, replaceHtml, removeHyperlink, onRangeSelectionModalMoveStart, saveHyperlink, createFilterOptions, onImageMoveStart, onImageResizeStart, showComments, setEditingComment, onCommentBoxMoveStart, onCommentBoxResizeStart, confirmMessage, getRangeByTxt, getDropdownList, setCellValue, setConditionRules, mergeBorder, setDropcownValue, handleCellAreaMouseDown, handleCellAreaMouseMove, handleCellAreaDragOver, handleCellDrop, handleCellAreaDoubleClick, selectAll, showLinkCard, getCellRowColumn, handleOverlayMouseMove, handleOverlayMouseUp, handleKeydownForZoom, handleOverlayTouchStart, handleOverlayTouchMove, handleOverlayTouchEnd, PAINT_MODEL_CURSOR, onCellsMoveStart, createDropCellRange, handleDropCellDoubleClick, updateContextWithSheetData, updateContextWithCanvas, initFreeze, Canvas, handleGlobalWheel, setCaretPosition, getDataArr, updateMoreCell, getRegStr, getOptionValue, getSelectRange, applyLocation, updateItem, normalizedCellAttr, update, updateFormat, handleTextSize, handleHorizontalAlign, handleVerticalAlign, handleScreenShot, showImgChooser, insertImage, editComment, deleteComment, showHideComment, showHideAllComments, newComment, handleSum, autoSelectionFormula, handleMerge, handleBorder, handleFreeze, handleSort, createFilter, clearFilter, toolbarItemSelectedFunc, toolbarItemClickHandler, handleTextColor, handleTextBackground, getDataBySelectionNoCopy, getInlineStringNoStyle, rangeHightlightselected, editSheetName, setNextSheet, MAX_ZOOM_RATIO, MIN_ZOOM_RATIO, addSheet, indexToColumnChar, sortSelection, handleCopy, insertRowCol, deleteRowCol, hideSelected, showSelected, api, removeActiveImage, deleteSelectedCellText, jfrefreshgrid, handleLink, deleteSheet, opToPatch, orderbydatafiler, getFilterColumnValues, getFilterColumnColors, saveFilter, cancelActiveImgItem, patchToOp, filterPatch, inverseRowColOptions, ensureSheetIndex, initSheetIndex, handleGlobalKeyDown, handlePasteByLeanklin, groupValuesRefresh } from '@leankylin-sheet/core';
|
|
2
2
|
import { useInViewport, useMemoizedFn, useThrottleFn } from 'ahooks';
|
|
3
3
|
import React, { useContext, useRef, useState, useMemo, useCallback, useEffect, useLayoutEffect, useImperativeHandle } from 'react';
|
|
4
4
|
import produce, { applyPatches, enablePatches, produceWithPatches } from 'immer';
|
|
@@ -6507,26 +6507,44 @@ var CustomFormat = function CustomFormat(_ref) {
|
|
|
6507
6507
|
var col = firstSelection === null || firstSelection === void 0 ? void 0 : firstSelection.column_focus;
|
|
6508
6508
|
var cell = flowdata != null && row != null && col != null ? (_flowdata$row = flowdata[row]) === null || _flowdata$row === void 0 ? void 0 : _flowdata$row[col] : undefined;
|
|
6509
6509
|
var ct = cell == null ? undefined : normalizedCellAttr(cell, "ct");
|
|
6510
|
-
return
|
|
6510
|
+
return {
|
|
6511
|
+
fa: (ct === null || ct === void 0 ? void 0 : ct.fa) != null && ct.fa !== "fmtOtherSelf" ? ct.fa : "#0.00",
|
|
6512
|
+
v: cell === null || cell === void 0 ? void 0 : cell.v
|
|
6513
|
+
};
|
|
6511
6514
|
}),
|
|
6512
|
-
_useState2 = _slicedToArray(_useState,
|
|
6513
|
-
|
|
6514
|
-
|
|
6515
|
+
_useState2 = _slicedToArray(_useState, 1),
|
|
6516
|
+
initialState = _useState2[0];
|
|
6517
|
+
var _useState3 = useState(initialState.fa),
|
|
6518
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
6519
|
+
formatStr = _useState4[0],
|
|
6520
|
+
setFormatStr = _useState4[1];
|
|
6515
6521
|
var _locale = locale(context),
|
|
6516
6522
|
button = _locale.button,
|
|
6517
6523
|
format = _locale.format,
|
|
6518
6524
|
defaultFmt = _locale.defaultFmt;
|
|
6519
6525
|
var _useDialog = useDialog(),
|
|
6520
6526
|
showDialog = _useDialog.showDialog;
|
|
6521
|
-
var
|
|
6522
|
-
|
|
6523
|
-
errorMsg =
|
|
6524
|
-
setErrorMsg =
|
|
6527
|
+
var _useState5 = useState(""),
|
|
6528
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
6529
|
+
errorMsg = _useState6[0],
|
|
6530
|
+
setErrorMsg = _useState6[1];
|
|
6525
6531
|
var presetFmtList = useMemo(function () {
|
|
6526
6532
|
return defaultFmt.filter(function (v) {
|
|
6527
6533
|
return v.value !== "split" && v.value !== "fmtOtherSelf";
|
|
6528
6534
|
});
|
|
6529
6535
|
}, [defaultFmt]);
|
|
6536
|
+
var previewValue = useMemo(function () {
|
|
6537
|
+
var fmt = formatStr.trim();
|
|
6538
|
+
var v = initialState.v;
|
|
6539
|
+
if (fmt === "" || fmt === "fmtOtherSelf" || v == null || v === "") {
|
|
6540
|
+
return "";
|
|
6541
|
+
}
|
|
6542
|
+
try {
|
|
6543
|
+
return update(fmt, v);
|
|
6544
|
+
} catch (error) {
|
|
6545
|
+
return "";
|
|
6546
|
+
}
|
|
6547
|
+
}, [formatStr, initialState]);
|
|
6530
6548
|
var onConfirm = useCallback(function () {
|
|
6531
6549
|
var fmt = formatStr.trim();
|
|
6532
6550
|
if (fmt === "" || fmt === "fmtOtherSelf") {
|
|
@@ -6578,7 +6596,17 @@ var CustomFormat = function CustomFormat(_ref) {
|
|
|
6578
6596
|
onKeyDown: onKeyDown
|
|
6579
6597
|
})), errorMsg !== "" && ( /*#__PURE__*/React.createElement("div", {
|
|
6580
6598
|
className: "custom-format-error"
|
|
6581
|
-
}, errorMsg)), /*#__PURE__*/React.createElement("div", {
|
|
6599
|
+
}, errorMsg)), initialState.v != null && initialState.v !== "" && ( /*#__PURE__*/React.createElement("div", {
|
|
6600
|
+
className: "custom-format-preview"
|
|
6601
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
6602
|
+
className: "custom-format-preview-title"
|
|
6603
|
+
}, format.customFormatPreview, "\uFF1A"), /*#__PURE__*/React.createElement("span", {
|
|
6604
|
+
className: "custom-format-preview-origin"
|
|
6605
|
+
}, String(initialState.v)), /*#__PURE__*/React.createElement("span", {
|
|
6606
|
+
className: "custom-format-preview-arrow"
|
|
6607
|
+
}, "\u2192"), /*#__PURE__*/React.createElement("span", {
|
|
6608
|
+
className: "custom-format-preview-result".concat(previewValue === "" ? " invalid" : "")
|
|
6609
|
+
}, previewValue === "" ? format.tipUnsupportedFormat : previewValue))), /*#__PURE__*/React.createElement("div", {
|
|
6582
6610
|
className: "custom-format-list"
|
|
6583
6611
|
}, /*#__PURE__*/React.createElement("div", {
|
|
6584
6612
|
className: "custom-format-list-row custom-format-list-header"
|
package/dist/index.js
CHANGED
|
@@ -6517,26 +6517,44 @@ var CustomFormat = function CustomFormat(_ref) {
|
|
|
6517
6517
|
var col = firstSelection === null || firstSelection === void 0 ? void 0 : firstSelection.column_focus;
|
|
6518
6518
|
var cell = flowdata != null && row != null && col != null ? (_flowdata$row = flowdata[row]) === null || _flowdata$row === void 0 ? void 0 : _flowdata$row[col] : undefined;
|
|
6519
6519
|
var ct = cell == null ? undefined : core.normalizedCellAttr(cell, "ct");
|
|
6520
|
-
return
|
|
6520
|
+
return {
|
|
6521
|
+
fa: (ct === null || ct === void 0 ? void 0 : ct.fa) != null && ct.fa !== "fmtOtherSelf" ? ct.fa : "#0.00",
|
|
6522
|
+
v: cell === null || cell === void 0 ? void 0 : cell.v
|
|
6523
|
+
};
|
|
6521
6524
|
}),
|
|
6522
|
-
_useState2 = _slicedToArray(_useState,
|
|
6523
|
-
|
|
6524
|
-
|
|
6525
|
+
_useState2 = _slicedToArray(_useState, 1),
|
|
6526
|
+
initialState = _useState2[0];
|
|
6527
|
+
var _useState3 = React.useState(initialState.fa),
|
|
6528
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
6529
|
+
formatStr = _useState4[0],
|
|
6530
|
+
setFormatStr = _useState4[1];
|
|
6525
6531
|
var _locale = core.locale(context),
|
|
6526
6532
|
button = _locale.button,
|
|
6527
6533
|
format = _locale.format,
|
|
6528
6534
|
defaultFmt = _locale.defaultFmt;
|
|
6529
6535
|
var _useDialog = useDialog(),
|
|
6530
6536
|
showDialog = _useDialog.showDialog;
|
|
6531
|
-
var
|
|
6532
|
-
|
|
6533
|
-
errorMsg =
|
|
6534
|
-
setErrorMsg =
|
|
6537
|
+
var _useState5 = React.useState(""),
|
|
6538
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
6539
|
+
errorMsg = _useState6[0],
|
|
6540
|
+
setErrorMsg = _useState6[1];
|
|
6535
6541
|
var presetFmtList = React.useMemo(function () {
|
|
6536
6542
|
return defaultFmt.filter(function (v) {
|
|
6537
6543
|
return v.value !== "split" && v.value !== "fmtOtherSelf";
|
|
6538
6544
|
});
|
|
6539
6545
|
}, [defaultFmt]);
|
|
6546
|
+
var previewValue = React.useMemo(function () {
|
|
6547
|
+
var fmt = formatStr.trim();
|
|
6548
|
+
var v = initialState.v;
|
|
6549
|
+
if (fmt === "" || fmt === "fmtOtherSelf" || v == null || v === "") {
|
|
6550
|
+
return "";
|
|
6551
|
+
}
|
|
6552
|
+
try {
|
|
6553
|
+
return core.update(fmt, v);
|
|
6554
|
+
} catch (error) {
|
|
6555
|
+
return "";
|
|
6556
|
+
}
|
|
6557
|
+
}, [formatStr, initialState]);
|
|
6540
6558
|
var onConfirm = React.useCallback(function () {
|
|
6541
6559
|
var fmt = formatStr.trim();
|
|
6542
6560
|
if (fmt === "" || fmt === "fmtOtherSelf") {
|
|
@@ -6588,7 +6606,17 @@ var CustomFormat = function CustomFormat(_ref) {
|
|
|
6588
6606
|
onKeyDown: onKeyDown
|
|
6589
6607
|
})), errorMsg !== "" && ( /*#__PURE__*/React__default['default'].createElement("div", {
|
|
6590
6608
|
className: "custom-format-error"
|
|
6591
|
-
}, errorMsg)), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
6609
|
+
}, errorMsg)), initialState.v != null && initialState.v !== "" && ( /*#__PURE__*/React__default['default'].createElement("div", {
|
|
6610
|
+
className: "custom-format-preview"
|
|
6611
|
+
}, /*#__PURE__*/React__default['default'].createElement("span", {
|
|
6612
|
+
className: "custom-format-preview-title"
|
|
6613
|
+
}, format.customFormatPreview, "\uFF1A"), /*#__PURE__*/React__default['default'].createElement("span", {
|
|
6614
|
+
className: "custom-format-preview-origin"
|
|
6615
|
+
}, String(initialState.v)), /*#__PURE__*/React__default['default'].createElement("span", {
|
|
6616
|
+
className: "custom-format-preview-arrow"
|
|
6617
|
+
}, "\u2192"), /*#__PURE__*/React__default['default'].createElement("span", {
|
|
6618
|
+
className: "custom-format-preview-result".concat(previewValue === "" ? " invalid" : "")
|
|
6619
|
+
}, previewValue === "" ? format.tipUnsupportedFormat : previewValue))), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
6592
6620
|
className: "custom-format-list"
|
|
6593
6621
|
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
6594
6622
|
className: "custom-format-list-row custom-format-list-header"
|
package/dist/index.umd.css
CHANGED
|
@@ -3246,6 +3246,42 @@ label {
|
|
|
3246
3246
|
background: #e3edfd;
|
|
3247
3247
|
}
|
|
3248
3248
|
|
|
3249
|
+
.custom-format-preview {
|
|
3250
|
+
display: flex;
|
|
3251
|
+
align-items: center;
|
|
3252
|
+
margin-top: 10px;
|
|
3253
|
+
padding: 6px 10px;
|
|
3254
|
+
background: #f5f6f7;
|
|
3255
|
+
border-radius: 2px;
|
|
3256
|
+
font-size: 12px;
|
|
3257
|
+
}
|
|
3258
|
+
|
|
3259
|
+
.custom-format-preview-title {
|
|
3260
|
+
color: #666;
|
|
3261
|
+
flex-shrink: 0;
|
|
3262
|
+
}
|
|
3263
|
+
|
|
3264
|
+
.custom-format-preview-origin {
|
|
3265
|
+
margin-left: 4px;
|
|
3266
|
+
color: #333;
|
|
3267
|
+
}
|
|
3268
|
+
|
|
3269
|
+
.custom-format-preview-arrow {
|
|
3270
|
+
margin: 0 8px;
|
|
3271
|
+
color: #999;
|
|
3272
|
+
}
|
|
3273
|
+
|
|
3274
|
+
.custom-format-preview-result {
|
|
3275
|
+
color: #1a73e8;
|
|
3276
|
+
font-weight: 600;
|
|
3277
|
+
word-break: break-all;
|
|
3278
|
+
}
|
|
3279
|
+
|
|
3280
|
+
.custom-format-preview-result.invalid {
|
|
3281
|
+
color: #d93025;
|
|
3282
|
+
font-weight: 400;
|
|
3283
|
+
}
|
|
3284
|
+
|
|
3249
3285
|
.leankylin-fx-editor {
|
|
3250
3286
|
display: flex;
|
|
3251
3287
|
flex-direction: row;
|
package/dist/index.umd.js
CHANGED
|
@@ -25591,26 +25591,44 @@
|
|
|
25591
25591
|
var col = firstSelection === null || firstSelection === void 0 ? void 0 : firstSelection.column_focus;
|
|
25592
25592
|
var cell = flowdata != null && row != null && col != null ? (_flowdata$row = flowdata[row]) === null || _flowdata$row === void 0 ? void 0 : _flowdata$row[col] : undefined;
|
|
25593
25593
|
var ct = cell == null ? undefined : core.normalizedCellAttr(cell, "ct");
|
|
25594
|
-
return
|
|
25594
|
+
return {
|
|
25595
|
+
fa: (ct === null || ct === void 0 ? void 0 : ct.fa) != null && ct.fa !== "fmtOtherSelf" ? ct.fa : "#0.00",
|
|
25596
|
+
v: cell === null || cell === void 0 ? void 0 : cell.v
|
|
25597
|
+
};
|
|
25595
25598
|
}),
|
|
25596
|
-
_useState2 = _slicedToArray(_useState,
|
|
25597
|
-
|
|
25598
|
-
|
|
25599
|
+
_useState2 = _slicedToArray(_useState, 1),
|
|
25600
|
+
initialState = _useState2[0];
|
|
25601
|
+
var _useState3 = React.useState(initialState.fa),
|
|
25602
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
25603
|
+
formatStr = _useState4[0],
|
|
25604
|
+
setFormatStr = _useState4[1];
|
|
25599
25605
|
var _locale = core.locale(context),
|
|
25600
25606
|
button = _locale.button,
|
|
25601
25607
|
format = _locale.format,
|
|
25602
25608
|
defaultFmt = _locale.defaultFmt;
|
|
25603
25609
|
var _useDialog = useDialog(),
|
|
25604
25610
|
showDialog = _useDialog.showDialog;
|
|
25605
|
-
var
|
|
25606
|
-
|
|
25607
|
-
errorMsg =
|
|
25608
|
-
setErrorMsg =
|
|
25611
|
+
var _useState5 = React.useState(""),
|
|
25612
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
25613
|
+
errorMsg = _useState6[0],
|
|
25614
|
+
setErrorMsg = _useState6[1];
|
|
25609
25615
|
var presetFmtList = React.useMemo(function () {
|
|
25610
25616
|
return defaultFmt.filter(function (v) {
|
|
25611
25617
|
return v.value !== "split" && v.value !== "fmtOtherSelf";
|
|
25612
25618
|
});
|
|
25613
25619
|
}, [defaultFmt]);
|
|
25620
|
+
var previewValue = React.useMemo(function () {
|
|
25621
|
+
var fmt = formatStr.trim();
|
|
25622
|
+
var v = initialState.v;
|
|
25623
|
+
if (fmt === "" || fmt === "fmtOtherSelf" || v == null || v === "") {
|
|
25624
|
+
return "";
|
|
25625
|
+
}
|
|
25626
|
+
try {
|
|
25627
|
+
return core.update(fmt, v);
|
|
25628
|
+
} catch (error) {
|
|
25629
|
+
return "";
|
|
25630
|
+
}
|
|
25631
|
+
}, [formatStr, initialState]);
|
|
25614
25632
|
var onConfirm = React.useCallback(function () {
|
|
25615
25633
|
var fmt = formatStr.trim();
|
|
25616
25634
|
if (fmt === "" || fmt === "fmtOtherSelf") {
|
|
@@ -25662,7 +25680,17 @@
|
|
|
25662
25680
|
onKeyDown: onKeyDown
|
|
25663
25681
|
})), errorMsg !== "" && ( /*#__PURE__*/React__default['default'].createElement("div", {
|
|
25664
25682
|
className: "custom-format-error"
|
|
25665
|
-
}, errorMsg)), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
25683
|
+
}, errorMsg)), initialState.v != null && initialState.v !== "" && ( /*#__PURE__*/React__default['default'].createElement("div", {
|
|
25684
|
+
className: "custom-format-preview"
|
|
25685
|
+
}, /*#__PURE__*/React__default['default'].createElement("span", {
|
|
25686
|
+
className: "custom-format-preview-title"
|
|
25687
|
+
}, format.customFormatPreview, "\uFF1A"), /*#__PURE__*/React__default['default'].createElement("span", {
|
|
25688
|
+
className: "custom-format-preview-origin"
|
|
25689
|
+
}, String(initialState.v)), /*#__PURE__*/React__default['default'].createElement("span", {
|
|
25690
|
+
className: "custom-format-preview-arrow"
|
|
25691
|
+
}, "\u2192"), /*#__PURE__*/React__default['default'].createElement("span", {
|
|
25692
|
+
className: "custom-format-preview-result".concat(previewValue === "" ? " invalid" : "")
|
|
25693
|
+
}, previewValue === "" ? format.tipUnsupportedFormat : previewValue))), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
25666
25694
|
className: "custom-format-list"
|
|
25667
25695
|
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
25668
25696
|
className: "custom-format-list-row custom-format-list-header"
|