@fileverse-dev/fortune-core 1.0.4 → 1.0.6
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/packages/core/src → es}/api/cell.d.ts +10 -10
- package/es/api/cell.js +204 -0
- package/{dist/packages/core/src → es}/api/common.d.ts +66 -66
- package/es/api/common.js +79 -0
- package/{dist/packages/core/src → es}/api/errors.d.ts +2 -2
- package/es/api/errors.js +2 -0
- package/{dist/packages/core/src → es}/api/index.d.ts +9 -9
- package/es/api/index.js +8 -0
- package/{dist/packages/core/src → es}/api/merge.d.ts +5 -5
- package/es/api/merge.js +15 -0
- package/{dist/packages/core/src → es}/api/range.d.ts +22 -22
- package/es/api/range.js +123 -0
- package/{dist/packages/core/src → es}/api/rowcol.d.ts +14 -14
- package/es/api/rowcol.js +207 -0
- package/{dist/packages/core/src → es}/api/sheet.d.ts +10 -10
- package/es/api/sheet.js +128 -0
- package/{dist/packages/core/src → es}/api/workbook.d.ts +15 -15
- package/es/api/workbook.js +85 -0
- package/{dist/packages/core/src → es}/canvas.d.ts +46 -46
- package/es/canvas.js +1350 -0
- package/{dist/packages/core/src → es}/context.d.ts +197 -197
- package/es/context.js +380 -0
- package/{dist/packages/core/src → es}/events/copy.d.ts +2 -2
- package/es/events/copy.js +78 -0
- package/{dist/packages/core/src → es}/events/index.d.ts +4 -4
- package/es/events/index.js +4 -0
- package/{dist/packages/core/src → es}/events/keyboard.d.ts +6 -6
- package/es/events/keyboard.js +332 -0
- package/{dist/packages/core/src → es}/events/mouse.d.ts +22 -22
- package/es/events/mouse.js +1725 -0
- package/{dist/packages/core/src → es}/events/paste.d.ts +3 -3
- package/es/events/paste.js +1358 -0
- package/{dist/packages/core/src → es}/index.d.ts +10 -10
- package/es/index.js +10 -0
- package/{dist/packages/core/src → es}/locale/en.d.ts +992 -992
- package/es/locale/en.js +10564 -0
- package/{dist/packages/core/src → es}/locale/es.d.ts +1134 -1134
- package/es/locale/es.js +10010 -0
- package/{dist/packages/core/src → es}/locale/hi.d.ts +1030 -1030
- package/es/locale/hi.js +10550 -0
- package/{dist/packages/core/src → es}/locale/index.d.ts +1049 -1049
- package/es/locale/index.js +23 -0
- package/{dist/packages/core/src → es}/locale/zh.d.ts +1048 -1048
- package/es/locale/zh.js +10568 -0
- package/{dist/packages/core/src → es}/locale/zh_tw.d.ts +1187 -1187
- package/es/locale/zh_tw.js +10072 -0
- package/{dist/packages/core/src → es}/modules/ConditionFormat.d.ts +17 -17
- package/es/modules/ConditionFormat.js +1258 -0
- package/{dist/packages/core/src → es}/modules/border.d.ts +3 -3
- package/es/modules/border.js +1240 -0
- package/{dist/packages/core/src → es}/modules/cell.d.ts +32 -32
- package/es/modules/cell.js +1055 -0
- package/{dist/packages/core/src → es}/modules/clipboard.d.ts +3 -3
- package/es/modules/clipboard.js +36 -0
- package/{dist/packages/core/src → es}/modules/color.d.ts +1 -1
- package/es/modules/color.js +1 -0
- package/{dist/packages/core/src → es}/modules/comment.d.ts +97 -97
- package/es/modules/comment.js +597 -0
- package/{dist/packages/core/src → es}/modules/conditionalFormat.d.ts +2 -2
- package/es/modules/conditionalFormat.js +441 -0
- package/{dist/packages/core/src → es}/modules/cursor.d.ts +3 -3
- package/es/modules/cursor.js +62 -0
- package/{dist/packages/core/src → es}/modules/dataVerification.d.ts +11 -11
- package/es/modules/dataVerification.js +700 -0
- package/{dist/packages/core/src → es}/modules/dropCell.d.ts +10 -10
- package/es/modules/dropCell.js +2266 -0
- package/{dist/packages/core/src → es}/modules/filter.d.ts +45 -45
- package/es/modules/filter.js +434 -0
- package/{dist/packages/core/src → es}/modules/format.d.ts +6 -6
- package/es/modules/format.js +323 -0
- package/{dist/packages/core/src → es}/modules/formula.d.ts +54 -54
- package/es/modules/formula.js +2301 -0
- package/{dist/packages/core/src → es}/modules/freeze.d.ts +5 -5
- package/es/modules/freeze.js +148 -0
- package/{dist/packages/core/src → es}/modules/hyperlink.d.ts +21 -21
- package/es/modules/hyperlink.js +216 -0
- package/{dist/packages/core/src → es}/modules/iframe.d.ts +12 -12
- package/es/modules/iframe.js +220 -0
- package/{dist/packages/core/src → es}/modules/image.d.ts +31 -31
- package/es/modules/image.js +253 -0
- package/{dist/packages/core/src → es}/modules/index.d.ts +36 -36
- package/es/modules/index.js +36 -0
- package/{dist/packages/core/src → es}/modules/inline-string.d.ts +36 -36
- package/es/modules/inline-string.js +437 -0
- package/{dist/packages/core/src → es}/modules/location.d.ts +6 -6
- package/es/modules/location.js +46 -0
- package/{dist/packages/core/src → es}/modules/locationCondition.d.ts +21 -21
- package/es/modules/locationCondition.js +218 -0
- package/{dist/packages/core/src → es}/modules/merge.d.ts +3 -3
- package/es/modules/merge.js +216 -0
- package/{dist/packages/core/src → es}/modules/mobile.d.ts +5 -5
- package/es/modules/mobile.js +33 -0
- package/{dist/packages/core/src → es}/modules/moveCells.d.ts +5 -5
- package/es/modules/moveCells.js +348 -0
- package/{dist/packages/core/src → es}/modules/protection.d.ts +5 -5
- package/es/modules/protection.js +96 -0
- package/{dist/packages/core/src → es}/modules/refresh.d.ts +3 -3
- package/es/modules/refresh.js +34 -0
- package/{dist/packages/core/src → es}/modules/rowcol.d.ts +19 -19
- package/es/modules/rowcol.js +1922 -0
- package/{dist/packages/core/src → es}/modules/screenshot.d.ts +2 -2
- package/es/modules/screenshot.js +90 -0
- package/{dist/packages/core/src → es}/modules/searchReplace.d.ts +36 -36
- package/es/modules/searchReplace.js +388 -0
- package/{dist/packages/core/src → es}/modules/selection.d.ts +46 -46
- package/es/modules/selection.js +1674 -0
- package/{dist/packages/core/src → es}/modules/sheet.d.ts +10 -10
- package/es/modules/sheet.js +237 -0
- package/{dist/packages/core/src → es}/modules/sort.d.ts +7 -7
- package/es/modules/sort.js +150 -0
- package/{dist/packages/core/src → es}/modules/splitColumn.d.ts +5 -5
- package/es/modules/splitColumn.js +126 -0
- package/es/modules/ssf.js +1533 -0
- package/{dist/packages/core/src → es}/modules/text.d.ts +10 -10
- package/es/modules/text.js +1207 -0
- package/{dist/packages/core/src → es}/modules/toolbar.d.ts +32 -32
- package/es/modules/toolbar.js +970 -0
- package/{dist/packages/core/src → es}/modules/validation.d.ts +19 -19
- package/es/modules/validation.js +190 -0
- package/{dist/packages/core/src → es}/modules/zoom.d.ts +3 -3
- package/es/modules/zoom.js +29 -0
- package/{dist/packages/core/src → es}/settings.d.ts +100 -100
- package/es/settings.js +36 -0
- package/{dist/packages/core/src → es}/types.d.ts +371 -371
- package/es/types.js +1 -0
- package/{dist/packages/core/src → es}/utils/freeze.d.ts +7 -7
- package/es/utils/freeze.js +86 -0
- package/{dist/packages/core/src → es}/utils/index.d.ts +18 -18
- package/es/utils/index.js +173 -0
- package/{dist/packages/core/src → es}/utils/patch.d.ts +37 -37
- package/es/utils/patch.js +381 -0
- package/lib/api/cell.d.ts +10 -0
- package/lib/api/cell.js +215 -0
- package/lib/api/common.d.ts +66 -0
- package/lib/api/common.js +88 -0
- package/lib/api/errors.d.ts +2 -0
- package/lib/api/errors.js +8 -0
- package/lib/api/index.d.ts +9 -0
- package/lib/api/index.js +101 -0
- package/lib/api/merge.d.ts +5 -0
- package/lib/api/merge.js +22 -0
- package/lib/api/range.d.ts +22 -0
- package/lib/api/range.js +138 -0
- package/lib/api/rowcol.d.ts +14 -0
- package/lib/api/rowcol.js +222 -0
- package/lib/api/sheet.d.ts +10 -0
- package/lib/api/sheet.js +145 -0
- package/lib/api/workbook.d.ts +15 -0
- package/lib/api/workbook.js +98 -0
- package/lib/canvas.d.ts +46 -0
- package/lib/canvas.js +1356 -0
- package/lib/context.d.ts +197 -0
- package/lib/context.js +392 -0
- package/lib/events/copy.d.ts +2 -0
- package/lib/events/copy.js +85 -0
- package/lib/events/index.d.ts +4 -0
- package/lib/events/index.js +49 -0
- package/lib/events/keyboard.d.ts +6 -0
- package/lib/events/keyboard.js +342 -0
- package/lib/events/mouse.d.ts +22 -0
- package/lib/events/mouse.js +1744 -0
- package/lib/events/paste.d.ts +3 -0
- package/lib/events/paste.js +1366 -0
- package/lib/index.d.ts +10 -0
- package/lib/index.js +109 -0
- package/lib/locale/en.d.ts +992 -0
- package/lib/locale/en.js +10570 -0
- package/lib/locale/es.d.ts +1134 -0
- package/lib/locale/es.js +10016 -0
- package/lib/locale/hi.d.ts +1030 -0
- package/lib/locale/hi.js +10556 -0
- package/lib/locale/index.d.ts +1049 -0
- package/lib/locale/index.js +29 -0
- package/lib/locale/zh.d.ts +1048 -0
- package/lib/locale/zh.js +10574 -0
- package/lib/locale/zh_tw.d.ts +1187 -0
- package/lib/locale/zh_tw.js +10078 -0
- package/lib/modules/ConditionFormat.d.ts +17 -0
- package/lib/modules/ConditionFormat.js +1273 -0
- package/lib/modules/border.d.ts +3 -0
- package/lib/modules/border.js +1248 -0
- package/lib/modules/cell.d.ts +32 -0
- package/lib/modules/cell.js +1085 -0
- package/lib/modules/clipboard.d.ts +3 -0
- package/lib/modules/clipboard.js +42 -0
- package/lib/modules/color.d.ts +1 -0
- package/lib/modules/color.js +7 -0
- package/lib/modules/comment.d.ts +97 -0
- package/lib/modules/comment.js +625 -0
- package/lib/modules/conditionalFormat.d.ts +2 -0
- package/lib/modules/conditionalFormat.js +447 -0
- package/lib/modules/cursor.d.ts +3 -0
- package/lib/modules/cursor.js +70 -0
- package/lib/modules/dataVerification.d.ts +11 -0
- package/lib/modules/dataVerification.js +715 -0
- package/lib/modules/dropCell.d.ts +10 -0
- package/lib/modules/dropCell.js +2282 -0
- package/lib/modules/filter.d.ts +45 -0
- package/lib/modules/filter.js +448 -0
- package/lib/modules/format.d.ts +6 -0
- package/lib/modules/format.js +334 -0
- package/lib/modules/formula.d.ts +54 -0
- package/lib/modules/formula.js +2330 -0
- package/lib/modules/freeze.d.ts +5 -0
- package/lib/modules/freeze.js +158 -0
- package/lib/modules/hyperlink.d.ts +21 -0
- package/lib/modules/hyperlink.js +232 -0
- package/lib/modules/iframe.d.ts +12 -0
- package/lib/modules/iframe.js +236 -0
- package/lib/modules/image.d.ts +31 -0
- package/lib/modules/image.js +272 -0
- package/lib/modules/index.d.ts +36 -0
- package/lib/modules/index.js +401 -0
- package/lib/modules/inline-string.d.ts +36 -0
- package/lib/modules/inline-string.js +452 -0
- package/lib/modules/location.d.ts +6 -0
- package/lib/modules/location.js +57 -0
- package/lib/modules/locationCondition.d.ts +21 -0
- package/lib/modules/locationCondition.js +229 -0
- package/lib/modules/merge.d.ts +3 -0
- package/lib/modules/merge.js +223 -0
- package/lib/modules/mobile.d.ts +5 -0
- package/lib/modules/mobile.js +41 -0
- package/lib/modules/moveCells.d.ts +5 -0
- package/lib/modules/moveCells.js +357 -0
- package/lib/modules/protection.d.ts +5 -0
- package/lib/modules/protection.js +106 -0
- package/lib/modules/refresh.d.ts +3 -0
- package/lib/modules/refresh.js +40 -0
- package/lib/modules/rowcol.d.ts +19 -0
- package/lib/modules/rowcol.js +1935 -0
- package/lib/modules/screenshot.d.ts +2 -0
- package/lib/modules/screenshot.js +96 -0
- package/lib/modules/searchReplace.d.ts +36 -0
- package/lib/modules/searchReplace.js +402 -0
- package/lib/modules/selection.d.ts +46 -0
- package/lib/modules/selection.js +1703 -0
- package/lib/modules/sheet.d.ts +10 -0
- package/lib/modules/sheet.js +250 -0
- package/lib/modules/sort.d.ts +7 -0
- package/lib/modules/sort.js +159 -0
- package/lib/modules/splitColumn.d.ts +5 -0
- package/lib/modules/splitColumn.js +136 -0
- package/lib/modules/ssf.js +1539 -0
- package/lib/modules/text.d.ts +10 -0
- package/lib/modules/text.js +1221 -0
- package/lib/modules/toolbar.d.ts +32 -0
- package/lib/modules/toolbar.js +1003 -0
- package/lib/modules/validation.d.ts +19 -0
- package/lib/modules/validation.js +205 -0
- package/lib/modules/zoom.d.ts +3 -0
- package/lib/modules/zoom.js +36 -0
- package/lib/settings.d.ts +100 -0
- package/lib/settings.js +42 -0
- package/lib/types.d.ts +371 -0
- package/lib/types.js +5 -0
- package/lib/utils/freeze.d.ts +7 -0
- package/lib/utils/freeze.js +92 -0
- package/lib/utils/index.d.ts +18 -0
- package/lib/utils/index.js +231 -0
- package/lib/utils/patch.d.ts +37 -0
- package/lib/utils/patch.js +392 -0
- package/package.json +7 -6
- package/dist/index.esm.js +0 -80255
- package/dist/index.js +0 -80601
- package/dist/packages/react/src/components/ChangeColor/index.d.ts +0 -7
- package/dist/packages/react/src/components/ConditionFormat/ConditionRules.d.ts +0 -6
- package/dist/packages/react/src/components/ConditionFormat/index.d.ts +0 -7
- package/dist/packages/react/src/components/ContextMenu/Divider.d.ts +0 -3
- package/dist/packages/react/src/components/ContextMenu/FilterMenu.d.ts +0 -3
- package/dist/packages/react/src/components/ContextMenu/Menu.d.ts +0 -8
- package/dist/packages/react/src/components/ContextMenu/SheetTab.d.ts +0 -4
- package/dist/packages/react/src/components/ContextMenu/index.d.ts +0 -5
- package/dist/packages/react/src/components/CustomSort/index.d.ts +0 -4
- package/dist/packages/react/src/components/DataVerification/DropdownList.d.ts +0 -4
- package/dist/packages/react/src/components/DataVerification/RangeDialog.d.ts +0 -4
- package/dist/packages/react/src/components/DataVerification/getDisplayedRangeTxt.d.ts +0 -2
- package/dist/packages/react/src/components/DataVerification/index.d.ts +0 -4
- package/dist/packages/react/src/components/Dialog/index.d.ts +0 -15
- package/dist/packages/react/src/components/DuneChartsInputModal/DuneChartsInputModal.d.ts +0 -11
- package/dist/packages/react/src/components/DunePreview/DunePreview.d.ts +0 -13
- package/dist/packages/react/src/components/FilterOption/index.d.ts +0 -5
- package/dist/packages/react/src/components/FormatSearch/index.d.ts +0 -6
- package/dist/packages/react/src/components/FormulaSearch/index.d.ts +0 -5
- package/dist/packages/react/src/components/FxEditor/NameBox.d.ts +0 -3
- package/dist/packages/react/src/components/FxEditor/index.d.ts +0 -4
- package/dist/packages/react/src/components/IFrameBoxs/iFrameBoxs.d.ts +0 -4
- package/dist/packages/react/src/components/ImgBoxs/index.d.ts +0 -3
- package/dist/packages/react/src/components/LinkEidtCard/index.d.ts +0 -5
- package/dist/packages/react/src/components/LocationCondition/index.d.ts +0 -3
- package/dist/packages/react/src/components/MessageBox/index.d.ts +0 -9
- package/dist/packages/react/src/components/NotationBoxes/index.d.ts +0 -3
- package/dist/packages/react/src/components/ResetColumnWidth/index.d.ts +0 -2
- package/dist/packages/react/src/components/SVGDefines.d.ts +0 -5
- package/dist/packages/react/src/components/SVGIcon.d.ts +0 -9
- package/dist/packages/react/src/components/SearchReplace/index.d.ts +0 -6
- package/dist/packages/react/src/components/Sheet/index.d.ts +0 -8
- package/dist/packages/react/src/components/SheetList/SheetHiddenButton.d.ts +0 -8
- package/dist/packages/react/src/components/SheetList/SheetListItem.d.ts +0 -9
- package/dist/packages/react/src/components/SheetList/index.d.ts +0 -4
- package/dist/packages/react/src/components/SheetOverlay/ColumnHeader.d.ts +0 -3
- package/dist/packages/react/src/components/SheetOverlay/ContentEditable.d.ts +0 -11
- package/dist/packages/react/src/components/SheetOverlay/FormulaHint/index.d.ts +0 -4
- package/dist/packages/react/src/components/SheetOverlay/FormulaSearch/constant.d.ts +0 -63
- package/dist/packages/react/src/components/SheetOverlay/FormulaSearch/index.d.ts +0 -4
- package/dist/packages/react/src/components/SheetOverlay/InputBox.d.ts +0 -3
- package/dist/packages/react/src/components/SheetOverlay/RowHeader.d.ts +0 -3
- package/dist/packages/react/src/components/SheetOverlay/ScrollBar/index.d.ts +0 -7
- package/dist/packages/react/src/components/SheetOverlay/index.d.ts +0 -4
- package/dist/packages/react/src/components/SheetTab/SheetItem.d.ts +0 -8
- package/dist/packages/react/src/components/SheetTab/index.d.ts +0 -4
- package/dist/packages/react/src/components/SplitColumn/index.d.ts +0 -3
- package/dist/packages/react/src/components/Toolbar/Button.d.ts +0 -12
- package/dist/packages/react/src/components/Toolbar/ColorPicker.d.ts +0 -6
- package/dist/packages/react/src/components/Toolbar/Combo.d.ts +0 -12
- package/dist/packages/react/src/components/Toolbar/CustomBorder.d.ts +0 -7
- package/dist/packages/react/src/components/Toolbar/CustomButton.d.ts +0 -11
- package/dist/packages/react/src/components/Toolbar/CustomColor.d.ts +0 -8
- package/dist/packages/react/src/components/Toolbar/CustomIcon.d.ts +0 -9
- package/dist/packages/react/src/components/Toolbar/Divider.d.ts +0 -4
- package/dist/packages/react/src/components/Toolbar/MoreItemsContainer.d.ts +0 -6
- package/dist/packages/react/src/components/Toolbar/Select.d.ts +0 -14
- package/dist/packages/react/src/components/Toolbar/index.d.ts +0 -10
- package/dist/packages/react/src/components/Workbook/api.d.ts +0 -1177
- package/dist/packages/react/src/components/Workbook/index.d.ts +0 -1185
- package/dist/packages/react/src/components/ZoomControl/index.d.ts +0 -4
- package/dist/packages/react/src/components/index.d.ts +0 -4
- package/dist/packages/react/src/constants.d.ts +0 -1
- package/dist/packages/react/src/context/index.d.ts +0 -25
- package/dist/packages/react/src/context/modal.d.ts +0 -10
- package/dist/packages/react/src/hooks/useAlert.d.ts +0 -4
- package/dist/packages/react/src/hooks/useDialog.d.ts +0 -5
- package/dist/packages/react/src/hooks/useOutsideClick.d.ts +0 -2
- package/dist/packages/react/src/hooks/usePrevious.d.ts +0 -2
- package/dist/packages/react/src/index.d.ts +0 -1
- package/dist/packages/react/src/utils/datepickerStyles.d.ts +0 -2
- package/dist/stories/API.stories.d.ts +0 -1210
- package/dist/stories/Collabration.stories.d.ts +0 -2359
- package/dist/stories/Features.stories.d.ts +0 -9430
- package/dist/stories/data/cell.d.ts +0 -983
- package/dist/stories/data/dataVerification.d.ts +0 -131
- package/dist/stories/data/empty.d.ts +0 -10
- package/dist/stories/data/formula.d.ts +0 -362
- package/dist/stories/data/freeze.d.ts +0 -34
- package/dist/stories/data/protected.d.ts +0 -40
- package/dist/stories/utils.d.ts +0 -1
|
@@ -0,0 +1,970 @@
|
|
|
1
|
+
import _ from "lodash";
|
|
2
|
+
import { mergeCells } from "./merge";
|
|
3
|
+
import { getFlowdata } from "../context";
|
|
4
|
+
import { getSheetIndex, isAllowEdit } from "../utils";
|
|
5
|
+
import { getRangetxt, isAllSelectedCellsInStatus, normalizedAttr, setCellValue } from "./cell";
|
|
6
|
+
import { colors } from "./color";
|
|
7
|
+
import { genarate, is_date, update } from "./format";
|
|
8
|
+
import { execfunction, execFunctionGroup, israngeseleciton, rangeSetValue, setCaretPosition, createFormulaRangeSelect } from "./formula";
|
|
9
|
+
import { inlineStyleAffectAttribute, updateInlineStringFormat, updateInlineStringFormatOutside } from "./inline-string";
|
|
10
|
+
import { colLocationByIndex, rowLocationByIndex } from "./location";
|
|
11
|
+
import { normalizeSelection, selectionCopyShow, selectIsOverlap } from "./selection";
|
|
12
|
+
import { sortSelection } from "./sort";
|
|
13
|
+
import { hasPartMC, isdatatypemulti, isRealNull, isRealNum } from "./validation";
|
|
14
|
+
import { showLinkCard } from "./hyperlink";
|
|
15
|
+
import { cfSplitRange } from "./conditionalFormat";
|
|
16
|
+
import { getCellTextInfo } from "./text";
|
|
17
|
+
export function updateFormatCell(ctx, d, attr, foucsStatus, row_st, row_ed, col_st, col_ed, canvas) {
|
|
18
|
+
var _a, _b;
|
|
19
|
+
var _c;
|
|
20
|
+
if (_.isNil(d) || _.isNil(attr)) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
if (attr === "ct") {
|
|
24
|
+
for (var r = row_st; r <= row_ed; r += 1) {
|
|
25
|
+
if (!_.isNil(ctx.config.rowhidden) && !_.isNil(ctx.config.rowhidden[r])) {
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
for (var c = col_st; c <= col_ed; c += 1) {
|
|
29
|
+
var cell = d[r][c];
|
|
30
|
+
var value = void 0;
|
|
31
|
+
if (_.isPlainObject(cell)) {
|
|
32
|
+
value = cell === null || cell === void 0 ? void 0 : cell.v;
|
|
33
|
+
} else {
|
|
34
|
+
value = cell;
|
|
35
|
+
}
|
|
36
|
+
if (foucsStatus !== "@" && isRealNum(value)) {
|
|
37
|
+
value = Number(value);
|
|
38
|
+
}
|
|
39
|
+
var mask = update(foucsStatus, value);
|
|
40
|
+
var type = "n";
|
|
41
|
+
if (is_date(foucsStatus) || foucsStatus === 14 || foucsStatus === 15 || foucsStatus === 16 || foucsStatus === 17 || foucsStatus === 18 || foucsStatus === 19 || foucsStatus === 20 || foucsStatus === 21 || foucsStatus === 22 || foucsStatus === 45 || foucsStatus === 46 || foucsStatus === 47) {
|
|
42
|
+
type = "d";
|
|
43
|
+
} else if (foucsStatus === "@" || foucsStatus === 49) {
|
|
44
|
+
type = "s";
|
|
45
|
+
} else if (foucsStatus === "General" || foucsStatus === 0) {
|
|
46
|
+
type = isRealNum(value) ? "n" : "g";
|
|
47
|
+
}
|
|
48
|
+
if (cell && _.isPlainObject(cell)) {
|
|
49
|
+
cell.m = "".concat(mask);
|
|
50
|
+
if (_.isNil(cell.ct)) {
|
|
51
|
+
cell.ct = {};
|
|
52
|
+
}
|
|
53
|
+
cell.ct.fa = foucsStatus;
|
|
54
|
+
cell.ct.t = type;
|
|
55
|
+
} else {
|
|
56
|
+
d[r][c] = {
|
|
57
|
+
ct: {
|
|
58
|
+
fa: foucsStatus,
|
|
59
|
+
t: type
|
|
60
|
+
},
|
|
61
|
+
v: value,
|
|
62
|
+
m: mask
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
} else {
|
|
68
|
+
if (attr === "ht") {
|
|
69
|
+
if (foucsStatus === "left") {
|
|
70
|
+
foucsStatus = "1";
|
|
71
|
+
} else if (foucsStatus === "center") {
|
|
72
|
+
foucsStatus = "0";
|
|
73
|
+
} else if (foucsStatus === "right") {
|
|
74
|
+
foucsStatus = "2";
|
|
75
|
+
}
|
|
76
|
+
} else if (attr === "vt") {
|
|
77
|
+
if (foucsStatus === "top") {
|
|
78
|
+
foucsStatus = "1";
|
|
79
|
+
} else if (foucsStatus === "middle") {
|
|
80
|
+
foucsStatus = "0";
|
|
81
|
+
} else if (foucsStatus === "bottom") {
|
|
82
|
+
foucsStatus = "2";
|
|
83
|
+
}
|
|
84
|
+
} else if (attr === "tb") {
|
|
85
|
+
if (foucsStatus === "overflow") {
|
|
86
|
+
foucsStatus = "1";
|
|
87
|
+
} else if (foucsStatus === "clip") {
|
|
88
|
+
foucsStatus = "0";
|
|
89
|
+
} else if (foucsStatus === "wrap") {
|
|
90
|
+
foucsStatus = "2";
|
|
91
|
+
}
|
|
92
|
+
} else if (attr === "tr") {
|
|
93
|
+
if (foucsStatus === "none") {
|
|
94
|
+
foucsStatus = "0";
|
|
95
|
+
} else if (foucsStatus === "angleup") {
|
|
96
|
+
foucsStatus = "1";
|
|
97
|
+
} else if (foucsStatus === "angledown") {
|
|
98
|
+
foucsStatus = "2";
|
|
99
|
+
} else if (foucsStatus === "vertical") {
|
|
100
|
+
foucsStatus = "3";
|
|
101
|
+
} else if (foucsStatus === "rotation-up") {
|
|
102
|
+
foucsStatus = "4";
|
|
103
|
+
} else if (foucsStatus === "rotation-down") {
|
|
104
|
+
foucsStatus = "5";
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
var sheetIndex = getSheetIndex(ctx, ctx.currentSheetId);
|
|
108
|
+
if (sheetIndex == null) {
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
for (var r = row_st; r <= row_ed; r += 1) {
|
|
112
|
+
if (!_.isNil(ctx.config.rowhidden) && !_.isNil(ctx.config.rowhidden[r])) {
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
115
|
+
for (var c = col_st; c <= col_ed; c += 1) {
|
|
116
|
+
var value = d[r][c];
|
|
117
|
+
if (value && _.isPlainObject(value)) {
|
|
118
|
+
updateInlineStringFormatOutside(value, attr, foucsStatus);
|
|
119
|
+
value[attr] = foucsStatus;
|
|
120
|
+
(_c = ctx.luckysheetfile[sheetIndex]).config || (_c.config = {});
|
|
121
|
+
var cfg = ctx.luckysheetfile[sheetIndex].config;
|
|
122
|
+
var cellWidth = ((_a = cfg.columnlen) === null || _a === void 0 ? void 0 : _a[c]) || ctx.luckysheetfile[sheetIndex].defaultColWidth;
|
|
123
|
+
if (attr === "fs" && canvas) {
|
|
124
|
+
var textInfo = getCellTextInfo(d[r][c], canvas, ctx, {
|
|
125
|
+
r: r,
|
|
126
|
+
c: c,
|
|
127
|
+
cellWidth: cellWidth
|
|
128
|
+
});
|
|
129
|
+
if (!textInfo) continue;
|
|
130
|
+
var rowHeight = _.round(textInfo.textHeightAll);
|
|
131
|
+
var currentRowHeight = ((_b = cfg.rowlen) === null || _b === void 0 ? void 0 : _b[r]) || ctx.luckysheetfile[sheetIndex].defaultRowHeight || 19;
|
|
132
|
+
if (!_.isUndefined(rowHeight) && rowHeight > currentRowHeight && (!cfg.customHeight || cfg.customHeight[r] !== 1)) {
|
|
133
|
+
if (_.isUndefined(cfg.rowlen)) cfg.rowlen = {};
|
|
134
|
+
_.set(cfg, "rowlen.".concat(r), rowHeight);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
} else {
|
|
138
|
+
d[r][c] = {
|
|
139
|
+
v: value
|
|
140
|
+
};
|
|
141
|
+
d[r][c][attr] = foucsStatus;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
export function updateFormat(ctx, $input, d, attr, foucsStatus, canvas) {
|
|
148
|
+
var allowEdit = isAllowEdit(ctx);
|
|
149
|
+
if (!allowEdit) return;
|
|
150
|
+
if (attr in inlineStyleAffectAttribute) {
|
|
151
|
+
if (ctx.luckysheetCellUpdate.length > 0) {
|
|
152
|
+
var value = $input.innerText;
|
|
153
|
+
if (value.substring(0, 1) !== "=") {
|
|
154
|
+
var cell = d[ctx.luckysheetCellUpdate[0]][ctx.luckysheetCellUpdate[1]];
|
|
155
|
+
if (cell) {
|
|
156
|
+
updateInlineStringFormat(ctx, cell, attr, foucsStatus, $input);
|
|
157
|
+
}
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
var cfg = _.cloneDeep(ctx.config);
|
|
163
|
+
if (_.isNil(cfg.rowlen)) {
|
|
164
|
+
cfg.rowlen = {};
|
|
165
|
+
}
|
|
166
|
+
_.forEach(ctx.luckysheet_select_save, function (selection) {
|
|
167
|
+
var _a = selection.row,
|
|
168
|
+
row_st = _a[0],
|
|
169
|
+
row_ed = _a[1];
|
|
170
|
+
var _b = selection.column,
|
|
171
|
+
col_st = _b[0],
|
|
172
|
+
col_ed = _b[1];
|
|
173
|
+
updateFormatCell(ctx, d, attr, foucsStatus, row_st, row_ed, col_st, col_ed, canvas);
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
function toggleAttr(ctx, cellInput, attr) {
|
|
177
|
+
var flowdata = getFlowdata(ctx);
|
|
178
|
+
if (!flowdata) return;
|
|
179
|
+
var flag = isAllSelectedCellsInStatus(ctx, attr, 1);
|
|
180
|
+
var foucsStatus = flag ? 0 : 1;
|
|
181
|
+
updateFormat(ctx, cellInput, flowdata, attr, foucsStatus);
|
|
182
|
+
}
|
|
183
|
+
function setAttr(ctx, cellInput, attr, value, canvas) {
|
|
184
|
+
var flowdata = getFlowdata(ctx);
|
|
185
|
+
if (!flowdata) return;
|
|
186
|
+
updateFormat(ctx, cellInput, flowdata, attr, value, canvas);
|
|
187
|
+
}
|
|
188
|
+
function checkNoNullValue(cell) {
|
|
189
|
+
var v = cell;
|
|
190
|
+
if (_.isPlainObject(v)) {
|
|
191
|
+
v = v.v;
|
|
192
|
+
}
|
|
193
|
+
if (!isRealNull(v) && isdatatypemulti(v).num && (cell.ct == null || cell.ct.t == null || cell.ct.t === "n" || cell.ct.t === "g")) {
|
|
194
|
+
return true;
|
|
195
|
+
}
|
|
196
|
+
return false;
|
|
197
|
+
}
|
|
198
|
+
function checkNoNullValueAll(cell) {
|
|
199
|
+
var v = cell;
|
|
200
|
+
if (_.isPlainObject(v)) {
|
|
201
|
+
v = v.v;
|
|
202
|
+
}
|
|
203
|
+
if (!isRealNull(v)) {
|
|
204
|
+
return true;
|
|
205
|
+
}
|
|
206
|
+
return false;
|
|
207
|
+
}
|
|
208
|
+
function getNoNullValue(d, st_x, ed, type) {
|
|
209
|
+
var hasValueStart = null;
|
|
210
|
+
var nullNum = 0;
|
|
211
|
+
var nullTime = 0;
|
|
212
|
+
for (var r = ed - 1; r >= 0; r -= 1) {
|
|
213
|
+
var cell = void 0;
|
|
214
|
+
if (type === "c") {
|
|
215
|
+
cell = d[st_x][r];
|
|
216
|
+
} else {
|
|
217
|
+
cell = d[r][st_x];
|
|
218
|
+
}
|
|
219
|
+
if (checkNoNullValue(cell)) {
|
|
220
|
+
hasValueStart = r;
|
|
221
|
+
} else if (cell == null || cell.v == null || cell.v === "") {
|
|
222
|
+
nullNum += 1;
|
|
223
|
+
if (nullNum >= 40) {
|
|
224
|
+
if (nullTime <= 0) {
|
|
225
|
+
nullTime = 1;
|
|
226
|
+
} else {
|
|
227
|
+
break;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
} else {
|
|
231
|
+
break;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
return hasValueStart;
|
|
235
|
+
}
|
|
236
|
+
function activeFormulaInput(cellInput, fxInput, ctx, row_index, col_index, rowh, columnh, formula, cache, isnull) {
|
|
237
|
+
if (isnull == null) {
|
|
238
|
+
isnull = false;
|
|
239
|
+
}
|
|
240
|
+
ctx.luckysheetCellUpdate = [row_index, col_index];
|
|
241
|
+
cache.doNotUpdateCell = true;
|
|
242
|
+
if (isnull) {
|
|
243
|
+
var formulaTxt_1 = "<span dir=\"auto\" class=\"luckysheet-formula-text-color\">=</span><span dir=\"auto\" class=\"luckysheet-formula-text-color\">".concat(formula.toUpperCase(), "</span><span dir=\"auto\" class=\"luckysheet-formula-text-color\">(</span><span dir=\"auto\" class=\"luckysheet-formula-text-color\">)</span>");
|
|
244
|
+
cellInput.innerHTML = formulaTxt_1;
|
|
245
|
+
var spanList = cellInput.querySelectorAll("span");
|
|
246
|
+
setCaretPosition(ctx, spanList[spanList.length - 2], 0, 1);
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
var row_pre = rowLocationByIndex(rowh[0], ctx.visibledatarow)[0];
|
|
250
|
+
var row = rowLocationByIndex(rowh[1], ctx.visibledatarow)[1];
|
|
251
|
+
var col_pre = colLocationByIndex(columnh[0], ctx.visibledatacolumn)[0];
|
|
252
|
+
var col = colLocationByIndex(columnh[1], ctx.visibledatacolumn)[1];
|
|
253
|
+
var formulaTxt = "<span dir=\"auto\" class=\"luckysheet-formula-text-color\">=</span><span dir=\"auto\" class=\"luckysheet-formula-text-color\">".concat(formula.toUpperCase(), "</span><span dir=\"auto\" class=\"luckysheet-formula-text-color\">(</span><span class=\"fortune-formula-functionrange-cell\" rangeindex=\"0\" dir=\"auto\" style=\"color:").concat(colors[0], ";\">").concat(getRangetxt(ctx, ctx.currentSheetId, {
|
|
254
|
+
row: rowh,
|
|
255
|
+
column: columnh
|
|
256
|
+
}, ctx.currentSheetId), "</span><span dir=\"auto\" class=\"luckysheet-formula-text-color\">)</span>");
|
|
257
|
+
cellInput.innerHTML = formulaTxt;
|
|
258
|
+
israngeseleciton(ctx);
|
|
259
|
+
ctx.formulaCache.rangestart = true;
|
|
260
|
+
ctx.formulaCache.rangedrag_column_start = false;
|
|
261
|
+
ctx.formulaCache.rangedrag_row_start = false;
|
|
262
|
+
ctx.formulaCache.rangechangeindex = 0;
|
|
263
|
+
rangeSetValue(ctx, cellInput, {
|
|
264
|
+
row: rowh,
|
|
265
|
+
column: columnh
|
|
266
|
+
}, fxInput);
|
|
267
|
+
ctx.formulaCache.func_selectedrange = {
|
|
268
|
+
left: col_pre,
|
|
269
|
+
width: col - col_pre - 1,
|
|
270
|
+
top: row_pre,
|
|
271
|
+
height: row - row_pre - 1,
|
|
272
|
+
left_move: col_pre,
|
|
273
|
+
width_move: col - col_pre - 1,
|
|
274
|
+
top_move: row_pre,
|
|
275
|
+
height_move: row - row_pre - 1,
|
|
276
|
+
row: [row_index, row_index],
|
|
277
|
+
column: [col_index, col_index]
|
|
278
|
+
};
|
|
279
|
+
createFormulaRangeSelect(ctx, {
|
|
280
|
+
rangeIndex: ctx.formulaCache.rangeIndex || 0,
|
|
281
|
+
left: col_pre,
|
|
282
|
+
width: col - col_pre - 1,
|
|
283
|
+
top: row_pre,
|
|
284
|
+
height: row - row_pre - 1
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
function backFormulaInput(d, r, c, rowh, columnh, formula, ctx) {
|
|
288
|
+
var _a;
|
|
289
|
+
var f = "=".concat(formula.toUpperCase(), "(").concat(getRangetxt(ctx, ctx.currentSheetId, {
|
|
290
|
+
row: rowh,
|
|
291
|
+
column: columnh
|
|
292
|
+
}, ctx.currentSheetId), ")");
|
|
293
|
+
var v = execfunction(ctx, f, r, c);
|
|
294
|
+
var value = {
|
|
295
|
+
v: v[1],
|
|
296
|
+
f: v[2]
|
|
297
|
+
};
|
|
298
|
+
setCellValue(ctx, r, c, d, value);
|
|
299
|
+
(_a = ctx.formulaCache).execFunctionExist || (_a.execFunctionExist = []);
|
|
300
|
+
ctx.formulaCache.execFunctionExist.push({
|
|
301
|
+
r: r,
|
|
302
|
+
c: c,
|
|
303
|
+
i: ctx.currentSheetId
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
function singleFormulaInput(cellInput, fxInput, ctx, d, _index, fix, st_m, ed_m, formula, type, cache, noNum, noNull) {
|
|
307
|
+
if (type == null) {
|
|
308
|
+
type = "r";
|
|
309
|
+
}
|
|
310
|
+
if (noNum == null) {
|
|
311
|
+
noNum = true;
|
|
312
|
+
}
|
|
313
|
+
if (noNull == null) {
|
|
314
|
+
noNull = true;
|
|
315
|
+
}
|
|
316
|
+
var isNull = true;
|
|
317
|
+
var isNum = false;
|
|
318
|
+
for (var c = st_m; c <= ed_m; c += 1) {
|
|
319
|
+
var cell = null;
|
|
320
|
+
if (type === "c") {
|
|
321
|
+
cell = d[c][fix];
|
|
322
|
+
} else {
|
|
323
|
+
cell = d[fix][c];
|
|
324
|
+
}
|
|
325
|
+
if (checkNoNullValue(cell)) {
|
|
326
|
+
isNull = false;
|
|
327
|
+
isNum = true;
|
|
328
|
+
} else if (checkNoNullValueAll(cell)) {
|
|
329
|
+
isNull = false;
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
if (isNull && noNull) {
|
|
333
|
+
var st_r_r = getNoNullValue(d, _index, fix, type);
|
|
334
|
+
if (st_r_r == null) {
|
|
335
|
+
if (type === "c") {
|
|
336
|
+
activeFormulaInput(cellInput, fxInput, ctx, _index, fix, null, null, formula, cache, true);
|
|
337
|
+
} else {
|
|
338
|
+
activeFormulaInput(cellInput, fxInput, ctx, fix, _index, null, null, formula, cache, true);
|
|
339
|
+
}
|
|
340
|
+
} else {
|
|
341
|
+
if (_index === st_m) {
|
|
342
|
+
for (var c = st_m; c <= ed_m; c += 1) {
|
|
343
|
+
st_r_r = getNoNullValue(d, c, fix, type);
|
|
344
|
+
if (st_r_r == null) {
|
|
345
|
+
break;
|
|
346
|
+
}
|
|
347
|
+
if (type === "c") {
|
|
348
|
+
backFormulaInput(d, c, fix, [c, c], [st_r_r, fix - 1], formula, ctx);
|
|
349
|
+
} else {
|
|
350
|
+
backFormulaInput(d, fix, c, [st_r_r, fix - 1], [c, c], formula, ctx);
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
} else {
|
|
354
|
+
for (var c = ed_m; c >= st_m; c -= 1) {
|
|
355
|
+
st_r_r = getNoNullValue(d, c, fix, type);
|
|
356
|
+
if (st_r_r == null) {
|
|
357
|
+
break;
|
|
358
|
+
}
|
|
359
|
+
if (type === "c") {
|
|
360
|
+
backFormulaInput(d, c, fix, [c, c], [st_r_r, fix - 1], formula, ctx);
|
|
361
|
+
} else {
|
|
362
|
+
backFormulaInput(d, fix, c, [st_r_r, fix - 1], [c, c], formula, ctx);
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
return false;
|
|
368
|
+
}
|
|
369
|
+
if (isNum && noNum) {
|
|
370
|
+
var cell = null;
|
|
371
|
+
if (type === "c") {
|
|
372
|
+
cell = d[ed_m + 1][fix];
|
|
373
|
+
} else {
|
|
374
|
+
cell = d[fix][ed_m + 1];
|
|
375
|
+
}
|
|
376
|
+
if (cell != null && cell.v != null && cell.v.toString().length > 0) {
|
|
377
|
+
var c = ed_m + 1;
|
|
378
|
+
if (type === "c") {
|
|
379
|
+
cell = d[ed_m + 1][fix];
|
|
380
|
+
} else {
|
|
381
|
+
cell = d[fix][ed_m + 1];
|
|
382
|
+
}
|
|
383
|
+
while (cell != null && cell.v != null && cell.v.toString().length > 0) {
|
|
384
|
+
c += 1;
|
|
385
|
+
var len = null;
|
|
386
|
+
if (type === "c") {
|
|
387
|
+
len = d.length;
|
|
388
|
+
} else {
|
|
389
|
+
len = d[0].length;
|
|
390
|
+
}
|
|
391
|
+
if (c >= len) {
|
|
392
|
+
return false;
|
|
393
|
+
}
|
|
394
|
+
if (type === "c") {
|
|
395
|
+
cell = d[c][fix];
|
|
396
|
+
} else {
|
|
397
|
+
cell = d[fix][c];
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
if (type === "c") {
|
|
401
|
+
backFormulaInput(d, c, fix, [st_m, ed_m], [fix, fix], formula, ctx);
|
|
402
|
+
} else {
|
|
403
|
+
backFormulaInput(d, fix, c, [fix, fix], [st_m, ed_m], formula, ctx);
|
|
404
|
+
}
|
|
405
|
+
} else {
|
|
406
|
+
if (type === "c") {
|
|
407
|
+
backFormulaInput(d, ed_m + 1, fix, [st_m, ed_m], [fix, fix], formula, ctx);
|
|
408
|
+
} else {
|
|
409
|
+
backFormulaInput(d, fix, ed_m + 1, [fix, fix], [st_m, ed_m], formula, ctx);
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
return false;
|
|
413
|
+
}
|
|
414
|
+
return true;
|
|
415
|
+
}
|
|
416
|
+
export function autoSelectionFormula(ctx, cellInput, fxInput, formula, cache) {
|
|
417
|
+
var allowEdit = isAllowEdit(ctx);
|
|
418
|
+
if (!allowEdit) return;
|
|
419
|
+
var flowdata = getFlowdata(ctx);
|
|
420
|
+
if (flowdata == null) return;
|
|
421
|
+
var isfalse = true;
|
|
422
|
+
ctx.formulaCache.execFunctionExist = [];
|
|
423
|
+
function execFormulaInput_c(d, st_r, ed_r, st_c, ed_c, _formula) {
|
|
424
|
+
var st_c_c = getNoNullValue(d, st_r, ed_c, "c");
|
|
425
|
+
if (st_c_c == null) {
|
|
426
|
+
activeFormulaInput(cellInput, fxInput, ctx, st_r, st_c, null, null, _formula, cache, true);
|
|
427
|
+
} else {
|
|
428
|
+
activeFormulaInput(cellInput, fxInput, ctx, st_r, st_c, [st_r, ed_r], [st_c_c, ed_c - 1], _formula, cache);
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
function execFormulaInput(d, st_r, ed_r, st_c, ed_c, _formula) {
|
|
432
|
+
var st_r_c = getNoNullValue(d, st_c, ed_r, "r");
|
|
433
|
+
if (st_r_c == null) {
|
|
434
|
+
execFormulaInput_c(d, st_r, ed_r, st_c, ed_c, _formula);
|
|
435
|
+
} else {
|
|
436
|
+
activeFormulaInput(cellInput, fxInput, ctx, st_r, st_c, [st_r_c, ed_r - 1], [st_c, ed_c], _formula, cache);
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
if (!ctx.luckysheet_select_save) return;
|
|
440
|
+
_.forEach(ctx.luckysheet_select_save, function (selection) {
|
|
441
|
+
var _a = selection.row,
|
|
442
|
+
st_r = _a[0],
|
|
443
|
+
ed_r = _a[1];
|
|
444
|
+
var _b = selection.column,
|
|
445
|
+
st_c = _b[0],
|
|
446
|
+
ed_c = _b[1];
|
|
447
|
+
var row_index = selection.row_focus;
|
|
448
|
+
var col_index = selection.column_focus;
|
|
449
|
+
if (st_r === ed_r && st_c === ed_c) {
|
|
450
|
+
if (ed_r - 1 < 0 && ed_c - 1 < 0) {
|
|
451
|
+
activeFormulaInput(cellInput, fxInput, ctx, st_r, st_c, null, null, formula, cache, true);
|
|
452
|
+
return;
|
|
453
|
+
}
|
|
454
|
+
if (ed_r - 1 >= 0 && checkNoNullValue(flowdata[ed_r - 1][st_c])) {
|
|
455
|
+
execFormulaInput(flowdata, st_r, ed_r, st_c, ed_c, formula);
|
|
456
|
+
} else if (ed_c - 1 >= 0 && checkNoNullValue(flowdata[st_r][ed_c - 1])) {
|
|
457
|
+
execFormulaInput_c(flowdata, st_r, ed_r, st_c, ed_c, formula);
|
|
458
|
+
} else {
|
|
459
|
+
execFormulaInput(flowdata, st_r, ed_r, st_c, ed_c, formula);
|
|
460
|
+
}
|
|
461
|
+
} else if (st_r === ed_r) {
|
|
462
|
+
isfalse = singleFormulaInput(cellInput, fxInput, ctx, flowdata, col_index, st_r, st_c, ed_c, formula, "r", cache);
|
|
463
|
+
} else if (st_c === ed_c) {
|
|
464
|
+
isfalse = singleFormulaInput(cellInput, fxInput, ctx, flowdata, row_index, st_c, st_r, ed_r, formula, "c", cache);
|
|
465
|
+
} else {
|
|
466
|
+
var r_false = true;
|
|
467
|
+
for (var r = st_r; r <= ed_r; r += 1) {
|
|
468
|
+
r_false = singleFormulaInput(cellInput, fxInput, ctx, flowdata, col_index, r, st_c, ed_c, formula, "r", cache, true, false) && r_false;
|
|
469
|
+
}
|
|
470
|
+
var c_false = true;
|
|
471
|
+
for (var c = st_c; c <= ed_c; c += 1) {
|
|
472
|
+
c_false = singleFormulaInput(cellInput, fxInput, ctx, flowdata, row_index, c, st_r, ed_r, formula, "c", cache, true, false) && c_false;
|
|
473
|
+
}
|
|
474
|
+
isfalse = !!r_false && !!c_false;
|
|
475
|
+
}
|
|
476
|
+
isfalse = isfalse && isfalse;
|
|
477
|
+
});
|
|
478
|
+
if (!isfalse) {
|
|
479
|
+
ctx.formulaCache.execFunctionExist.reverse();
|
|
480
|
+
execFunctionGroup(ctx, null, null, null, null, flowdata);
|
|
481
|
+
ctx.formulaCache.execFunctionGlobalData = null;
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
export function cancelPaintModel(ctx) {
|
|
485
|
+
var _a;
|
|
486
|
+
if (ctx.luckysheet_copy_save === null) return;
|
|
487
|
+
if (((_a = ctx.luckysheet_copy_save) === null || _a === void 0 ? void 0 : _a.dataSheetId) === ctx.currentSheetId) {
|
|
488
|
+
ctx.luckysheet_selection_range = [];
|
|
489
|
+
selectionCopyShow(ctx.luckysheet_selection_range, ctx);
|
|
490
|
+
} else {
|
|
491
|
+
if (!ctx.luckysheet_copy_save) return;
|
|
492
|
+
var index = getSheetIndex(ctx, ctx.luckysheet_copy_save.dataSheetId);
|
|
493
|
+
if (!index) return;
|
|
494
|
+
ctx.luckysheetfile[index].luckysheet_selection_range = [];
|
|
495
|
+
}
|
|
496
|
+
ctx.luckysheet_copy_save = {
|
|
497
|
+
dataSheetId: "",
|
|
498
|
+
copyRange: [{
|
|
499
|
+
row: [0],
|
|
500
|
+
column: [0]
|
|
501
|
+
}],
|
|
502
|
+
RowlChange: false,
|
|
503
|
+
HasMC: false
|
|
504
|
+
};
|
|
505
|
+
ctx.luckysheetPaintModelOn = false;
|
|
506
|
+
}
|
|
507
|
+
export function handleCurrencyFormat(ctx, cellInput) {
|
|
508
|
+
var flowdata = getFlowdata(ctx);
|
|
509
|
+
if (!flowdata) return;
|
|
510
|
+
var currency = ctx.currency || "¥";
|
|
511
|
+
updateFormat(ctx, cellInput, flowdata, "ct", "".concat(currency, " #,##0.00"));
|
|
512
|
+
}
|
|
513
|
+
export function handlePercentageFormat(ctx, cellInput) {
|
|
514
|
+
var flowdata = getFlowdata(ctx);
|
|
515
|
+
if (!flowdata) return;
|
|
516
|
+
updateFormat(ctx, cellInput, flowdata, "ct", "0.00%");
|
|
517
|
+
}
|
|
518
|
+
export function handleNumberDecrease(ctx, cellInput) {
|
|
519
|
+
var flowdata = getFlowdata(ctx);
|
|
520
|
+
if (!flowdata || !ctx.luckysheet_select_save) return;
|
|
521
|
+
var row_index = ctx.luckysheet_select_save[0].row_focus;
|
|
522
|
+
var col_index = ctx.luckysheet_select_save[0].column_focus;
|
|
523
|
+
if (row_index === undefined || col_index === undefined) return;
|
|
524
|
+
var foucsStatus = normalizedAttr(flowdata, row_index, col_index, "ct");
|
|
525
|
+
var cell = flowdata[row_index][col_index];
|
|
526
|
+
if (foucsStatus == null || foucsStatus.t !== "n") {
|
|
527
|
+
return;
|
|
528
|
+
}
|
|
529
|
+
if (foucsStatus.fa === "General") {
|
|
530
|
+
if (!cell || !cell.v) return;
|
|
531
|
+
var mask = genarate(cell.v);
|
|
532
|
+
if (!mask || mask.length < 2) return;
|
|
533
|
+
foucsStatus = mask[1];
|
|
534
|
+
}
|
|
535
|
+
var reg = /^(w|W)((0?)|(0\.0+))$/;
|
|
536
|
+
if (reg.test(foucsStatus.fa)) {
|
|
537
|
+
if (foucsStatus.fa.indexOf(".") > -1) {
|
|
538
|
+
if (foucsStatus.fa.substr(-2) === ".0") {
|
|
539
|
+
updateFormat(ctx, cellInput, flowdata, "ct", foucsStatus.fa.split(".")[0]);
|
|
540
|
+
} else {
|
|
541
|
+
updateFormat(ctx, cellInput, flowdata, "ct", foucsStatus.fa.substr(0, foucsStatus.fa.length - 1));
|
|
542
|
+
}
|
|
543
|
+
} else {
|
|
544
|
+
updateFormat(ctx, cellInput, flowdata, "ct", foucsStatus.fa);
|
|
545
|
+
}
|
|
546
|
+
return;
|
|
547
|
+
}
|
|
548
|
+
var prefix = "";
|
|
549
|
+
var main = "";
|
|
550
|
+
var fa = [];
|
|
551
|
+
if (foucsStatus.fa.indexOf(".") > -1) {
|
|
552
|
+
fa = foucsStatus.fa.split(".");
|
|
553
|
+
prefix = fa[0], main = fa[1];
|
|
554
|
+
} else {
|
|
555
|
+
return;
|
|
556
|
+
}
|
|
557
|
+
fa = main.split("");
|
|
558
|
+
var tail = "";
|
|
559
|
+
for (var i = fa.length - 1; i >= 0; i -= 1) {
|
|
560
|
+
var c = fa[i];
|
|
561
|
+
if (c !== "#" && c !== "0" && c !== "," && Number.isNaN(parseInt(c, 10))) {
|
|
562
|
+
tail = c + tail;
|
|
563
|
+
} else {
|
|
564
|
+
break;
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
var fmt = "";
|
|
568
|
+
if (foucsStatus.fa.indexOf(".") > -1) {
|
|
569
|
+
var suffix = main;
|
|
570
|
+
if (tail.length > 0) {
|
|
571
|
+
suffix = main.replace(tail, "");
|
|
572
|
+
}
|
|
573
|
+
var pos = suffix.replace(/#/g, "0");
|
|
574
|
+
pos = pos.substr(0, pos.length - 1);
|
|
575
|
+
if (pos === "") {
|
|
576
|
+
fmt = prefix + tail;
|
|
577
|
+
} else {
|
|
578
|
+
fmt = "".concat(prefix, ".").concat(pos).concat(tail);
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
updateFormat(ctx, cellInput, flowdata, "ct", fmt);
|
|
582
|
+
}
|
|
583
|
+
export function handleNumberIncrease(ctx, cellInput) {
|
|
584
|
+
var flowdata = getFlowdata(ctx);
|
|
585
|
+
if (!flowdata) return;
|
|
586
|
+
if (!ctx.luckysheet_select_save) return;
|
|
587
|
+
var row_index = ctx.luckysheet_select_save[0].row_focus;
|
|
588
|
+
var col_index = ctx.luckysheet_select_save[0].column_focus;
|
|
589
|
+
if (row_index === undefined || col_index === undefined) return;
|
|
590
|
+
var foucsStatus = normalizedAttr(flowdata, row_index, col_index, "ct");
|
|
591
|
+
var cell = flowdata[row_index][col_index];
|
|
592
|
+
if (foucsStatus == null || foucsStatus.t !== "n") {
|
|
593
|
+
return;
|
|
594
|
+
}
|
|
595
|
+
if (foucsStatus.fa === "General") {
|
|
596
|
+
if (!cell || !cell.v) return;
|
|
597
|
+
var mask = genarate(cell.v);
|
|
598
|
+
if (!mask || mask.length < 2) return;
|
|
599
|
+
foucsStatus = mask[1];
|
|
600
|
+
}
|
|
601
|
+
if (foucsStatus.fa === "General") {
|
|
602
|
+
updateFormat(ctx, cellInput, flowdata, "ct", "#.0");
|
|
603
|
+
return;
|
|
604
|
+
}
|
|
605
|
+
var reg = /^(w|W)((0?)|(0\.0+))$/;
|
|
606
|
+
if (reg.test(foucsStatus.fa)) {
|
|
607
|
+
if (foucsStatus.fa.indexOf(".") > -1) {
|
|
608
|
+
updateFormat(ctx, cellInput, flowdata, "ct", "".concat(foucsStatus.fa, "0"));
|
|
609
|
+
} else {
|
|
610
|
+
if (foucsStatus.fa.substr(-1) === "0") {
|
|
611
|
+
updateFormat(ctx, cellInput, flowdata, "ct", "".concat(foucsStatus.fa, ".0"));
|
|
612
|
+
} else {
|
|
613
|
+
updateFormat(ctx, cellInput, flowdata, "ct", "".concat(foucsStatus.fa, "0.0"));
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
return;
|
|
617
|
+
}
|
|
618
|
+
var prefix = "";
|
|
619
|
+
var main = "";
|
|
620
|
+
var fa = [];
|
|
621
|
+
if (foucsStatus.fa.indexOf(".") > -1) {
|
|
622
|
+
fa = foucsStatus.fa.split(".");
|
|
623
|
+
prefix = fa[0], main = fa[1];
|
|
624
|
+
} else {
|
|
625
|
+
main = foucsStatus.fa;
|
|
626
|
+
}
|
|
627
|
+
fa = main.split("");
|
|
628
|
+
var tail = "";
|
|
629
|
+
for (var i = fa.length - 1; i >= 0; i -= 1) {
|
|
630
|
+
var c = fa[i];
|
|
631
|
+
if (c !== "#" && c !== "0" && c !== "," && Number.isNaN(parseInt(c, 10))) {
|
|
632
|
+
tail = c + tail;
|
|
633
|
+
} else {
|
|
634
|
+
break;
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
var fmt = "";
|
|
638
|
+
if (foucsStatus.fa.indexOf(".") > -1) {
|
|
639
|
+
var suffix = main;
|
|
640
|
+
if (tail.length > 0) {
|
|
641
|
+
suffix = main.replace(tail, "");
|
|
642
|
+
}
|
|
643
|
+
var pos = suffix.replace(/#/g, "0");
|
|
644
|
+
pos += "0";
|
|
645
|
+
fmt = "".concat(prefix, ".").concat(pos).concat(tail);
|
|
646
|
+
} else {
|
|
647
|
+
if (tail.length > 0) {
|
|
648
|
+
fmt = "".concat(main.replace(tail, ""), ".0").concat(tail);
|
|
649
|
+
} else {
|
|
650
|
+
fmt = "".concat(main, ".0").concat(tail);
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
updateFormat(ctx, cellInput, flowdata, "ct", fmt);
|
|
654
|
+
}
|
|
655
|
+
export function handleBold(ctx, cellInput) {
|
|
656
|
+
toggleAttr(ctx, cellInput, "bl");
|
|
657
|
+
}
|
|
658
|
+
export function handleItalic(ctx, cellInput) {
|
|
659
|
+
toggleAttr(ctx, cellInput, "it");
|
|
660
|
+
}
|
|
661
|
+
export function handleStrikeThrough(ctx, cellInput) {
|
|
662
|
+
toggleAttr(ctx, cellInput, "cl");
|
|
663
|
+
}
|
|
664
|
+
export function handleUnderline(ctx, cellInput) {
|
|
665
|
+
toggleAttr(ctx, cellInput, "un");
|
|
666
|
+
}
|
|
667
|
+
export function handleHorizontalAlign(ctx, cellInput, value) {
|
|
668
|
+
setAttr(ctx, cellInput, "ht", value);
|
|
669
|
+
}
|
|
670
|
+
export function handleVerticalAlign(ctx, cellInput, value) {
|
|
671
|
+
setAttr(ctx, cellInput, "vt", value);
|
|
672
|
+
}
|
|
673
|
+
export function handleFormatPainter(ctx) {
|
|
674
|
+
var allowEdit = isAllowEdit(ctx);
|
|
675
|
+
if (!allowEdit) return;
|
|
676
|
+
if (ctx.luckysheet_select_save == null || ctx.luckysheet_select_save.length === 0) {
|
|
677
|
+
return;
|
|
678
|
+
}
|
|
679
|
+
if (ctx.luckysheet_select_save.length > 1) {
|
|
680
|
+
return;
|
|
681
|
+
}
|
|
682
|
+
var has_PartMC = false;
|
|
683
|
+
var r1 = ctx.luckysheet_select_save[0].row[0];
|
|
684
|
+
var r2 = ctx.luckysheet_select_save[0].row[1];
|
|
685
|
+
var c1 = ctx.luckysheet_select_save[0].column[0];
|
|
686
|
+
var c2 = ctx.luckysheet_select_save[0].column[1];
|
|
687
|
+
has_PartMC = hasPartMC(ctx, ctx.config, r1, r2, c1, c2);
|
|
688
|
+
if (has_PartMC) {
|
|
689
|
+
return;
|
|
690
|
+
}
|
|
691
|
+
cancelPaintModel(ctx);
|
|
692
|
+
ctx.luckysheet_selection_range = [{
|
|
693
|
+
row: ctx.luckysheet_select_save[0].row,
|
|
694
|
+
column: ctx.luckysheet_select_save[0].column
|
|
695
|
+
}];
|
|
696
|
+
selectionCopyShow(ctx.luckysheet_selection_range, ctx);
|
|
697
|
+
var RowlChange = false;
|
|
698
|
+
var HasMC = false;
|
|
699
|
+
for (var r = ctx.luckysheet_select_save[0].row[0]; r <= ctx.luckysheet_select_save[0].row[1]; r += 1) {
|
|
700
|
+
if (ctx.config.rowhidden != null && ctx.config.rowhidden[r] != null) {
|
|
701
|
+
continue;
|
|
702
|
+
}
|
|
703
|
+
if (ctx.config.rowlen != null && r in ctx.config.rowlen) {
|
|
704
|
+
RowlChange = true;
|
|
705
|
+
}
|
|
706
|
+
for (var c = ctx.luckysheet_select_save[0].column[0]; c <= ctx.luckysheet_select_save[0].column[1]; c += 1) {
|
|
707
|
+
var flowdata = getFlowdata(ctx);
|
|
708
|
+
if (!flowdata) return;
|
|
709
|
+
var cell = flowdata[r][c];
|
|
710
|
+
if (cell != null && cell.mc != null && cell.mc.rs != null) {
|
|
711
|
+
HasMC = true;
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
ctx.luckysheet_copy_save = {
|
|
716
|
+
dataSheetId: ctx.currentSheetId,
|
|
717
|
+
copyRange: [{
|
|
718
|
+
row: ctx.luckysheet_select_save[0].row,
|
|
719
|
+
column: ctx.luckysheet_select_save[0].column
|
|
720
|
+
}],
|
|
721
|
+
RowlChange: RowlChange,
|
|
722
|
+
HasMC: HasMC
|
|
723
|
+
};
|
|
724
|
+
ctx.luckysheetPaintModelOn = true;
|
|
725
|
+
ctx.luckysheetPaintSingle = true;
|
|
726
|
+
}
|
|
727
|
+
export function handleClearFormat(ctx) {
|
|
728
|
+
var _a;
|
|
729
|
+
if (ctx.allowEdit === false) return;
|
|
730
|
+
var flowdata = getFlowdata(ctx);
|
|
731
|
+
if (!flowdata) return;
|
|
732
|
+
(_a = ctx.luckysheet_select_save) === null || _a === void 0 ? void 0 : _a.every(function (selection) {
|
|
733
|
+
var _a = selection.row,
|
|
734
|
+
rowSt = _a[0],
|
|
735
|
+
rowEd = _a[1];
|
|
736
|
+
var _b = selection.column,
|
|
737
|
+
colSt = _b[0],
|
|
738
|
+
colEd = _b[1];
|
|
739
|
+
for (var r = rowSt; r <= rowEd; r += 1) {
|
|
740
|
+
if (!_.isNil(ctx.config.rowhidden) && !_.isNil(ctx.config.rowhidden[r])) {
|
|
741
|
+
continue;
|
|
742
|
+
}
|
|
743
|
+
for (var c = colSt; c <= colEd; c += 1) {
|
|
744
|
+
var cell = flowdata[r][c];
|
|
745
|
+
if (!cell) continue;
|
|
746
|
+
flowdata[r][c] = _.pick(cell, "v", "m", "mc", "f", "ct");
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
var index = getSheetIndex(ctx, ctx.currentSheetId);
|
|
750
|
+
if (index == null) return false;
|
|
751
|
+
if (ctx.config.borderInfo == null) return false;
|
|
752
|
+
var cfg = ctx.config || {};
|
|
753
|
+
if (cfg.borderInfo && cfg.borderInfo.length > 0) {
|
|
754
|
+
var source_borderInfo = [];
|
|
755
|
+
for (var i = 0; i < cfg.borderInfo.length; i += 1) {
|
|
756
|
+
var bd_rangeType = cfg.borderInfo[i].rangeType;
|
|
757
|
+
if (bd_rangeType === "range" && cfg.borderInfo[i].borderType !== "border-slash") {
|
|
758
|
+
var bd_range = cfg.borderInfo[i].range;
|
|
759
|
+
var bd_emptyRange = [];
|
|
760
|
+
for (var j = 0; j < bd_range.length; j += 1) {
|
|
761
|
+
bd_emptyRange = bd_emptyRange.concat(cfSplitRange(bd_range[j], {
|
|
762
|
+
row: [rowSt, rowEd],
|
|
763
|
+
column: [colSt, colEd]
|
|
764
|
+
}, {
|
|
765
|
+
row: [rowSt, rowEd],
|
|
766
|
+
column: [colSt, colEd]
|
|
767
|
+
}, "restPart"));
|
|
768
|
+
}
|
|
769
|
+
cfg.borderInfo[i].range = bd_emptyRange;
|
|
770
|
+
source_borderInfo.push(cfg.borderInfo[i]);
|
|
771
|
+
} else if (bd_rangeType === "cell") {
|
|
772
|
+
var bd_r = cfg.borderInfo[i].value.row_index;
|
|
773
|
+
var bd_c = cfg.borderInfo[i].value.col_index;
|
|
774
|
+
if (!(bd_r >= rowSt && bd_r <= rowEd && bd_c >= colSt && bd_c <= colEd)) {
|
|
775
|
+
source_borderInfo.push(cfg.borderInfo[i]);
|
|
776
|
+
}
|
|
777
|
+
} else if (bd_rangeType === "range" && cfg.borderInfo[i].borderType === "border-slash" && !(cfg.borderInfo[i].range[0].row[0] >= rowSt && cfg.borderInfo[i].range[0].row[0] <= rowEd && cfg.borderInfo[i].range[0].column[0] >= colSt && cfg.borderInfo[i].range[0].column[0] <= colEd)) {
|
|
778
|
+
source_borderInfo.push(cfg.borderInfo[i]);
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
ctx.luckysheetfile[index].config.borderInfo = source_borderInfo;
|
|
782
|
+
}
|
|
783
|
+
return true;
|
|
784
|
+
});
|
|
785
|
+
}
|
|
786
|
+
export function handleTextColor(ctx, cellInput, color) {
|
|
787
|
+
setAttr(ctx, cellInput, "fc", color);
|
|
788
|
+
}
|
|
789
|
+
export function handleTextBackground(ctx, cellInput, color) {
|
|
790
|
+
setAttr(ctx, cellInput, "bg", color);
|
|
791
|
+
}
|
|
792
|
+
export function handleBorder(ctx, type, borderColor, borderStyle) {
|
|
793
|
+
var allowEdit = isAllowEdit(ctx);
|
|
794
|
+
if (!allowEdit) return;
|
|
795
|
+
if (type == null) {
|
|
796
|
+
type = "border-all";
|
|
797
|
+
}
|
|
798
|
+
var color = borderColor;
|
|
799
|
+
var style = borderStyle;
|
|
800
|
+
if (color == null || color === "") {
|
|
801
|
+
color = "#000";
|
|
802
|
+
}
|
|
803
|
+
if (style == null || style === "") {
|
|
804
|
+
style = "1";
|
|
805
|
+
}
|
|
806
|
+
var cfg = ctx.config;
|
|
807
|
+
if (cfg.borderInfo == null) {
|
|
808
|
+
cfg.borderInfo = [];
|
|
809
|
+
}
|
|
810
|
+
if (type !== "border-slash") {
|
|
811
|
+
var borderInfo = {
|
|
812
|
+
rangeType: "range",
|
|
813
|
+
borderType: type,
|
|
814
|
+
color: color,
|
|
815
|
+
style: style,
|
|
816
|
+
range: _.cloneDeep(ctx.luckysheet_select_save) || []
|
|
817
|
+
};
|
|
818
|
+
cfg.borderInfo.push(borderInfo);
|
|
819
|
+
} else {
|
|
820
|
+
var rangeList_1 = [];
|
|
821
|
+
_.forEach(ctx.luckysheet_select_save, function (selection) {
|
|
822
|
+
for (var r = selection.row[0]; r <= selection.row[1]; r += 1) {
|
|
823
|
+
for (var c = selection.column[0]; c <= selection.column[1]; c += 1) {
|
|
824
|
+
var range = "".concat(r, "_").concat(c);
|
|
825
|
+
if (_.includes(rangeList_1, range)) continue;
|
|
826
|
+
var borderInfo = {
|
|
827
|
+
rangeType: "range",
|
|
828
|
+
borderType: type,
|
|
829
|
+
color: color,
|
|
830
|
+
style: style,
|
|
831
|
+
range: normalizeSelection(ctx, [{
|
|
832
|
+
row: [r, r],
|
|
833
|
+
column: [c, c]
|
|
834
|
+
}])
|
|
835
|
+
};
|
|
836
|
+
cfg.borderInfo.push(borderInfo);
|
|
837
|
+
rangeList_1.push(range);
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
});
|
|
841
|
+
}
|
|
842
|
+
var index = getSheetIndex(ctx, ctx.currentSheetId);
|
|
843
|
+
if (index == null) return;
|
|
844
|
+
ctx.luckysheetfile[index].config = ctx.config;
|
|
845
|
+
}
|
|
846
|
+
export function handleMerge(ctx, type) {
|
|
847
|
+
var allowEdit = isAllowEdit(ctx);
|
|
848
|
+
if (!allowEdit) return;
|
|
849
|
+
if (selectIsOverlap(ctx)) {
|
|
850
|
+
return;
|
|
851
|
+
}
|
|
852
|
+
if (ctx.config.merge != null) {
|
|
853
|
+
var has_PartMC = false;
|
|
854
|
+
if (!ctx.luckysheet_select_save) return;
|
|
855
|
+
for (var s = 0; s < ctx.luckysheet_select_save.length; s += 1) {
|
|
856
|
+
var r1 = ctx.luckysheet_select_save[s].row[0];
|
|
857
|
+
var r2 = ctx.luckysheet_select_save[s].row[1];
|
|
858
|
+
var c1 = ctx.luckysheet_select_save[s].column[0];
|
|
859
|
+
var c2 = ctx.luckysheet_select_save[s].column[1];
|
|
860
|
+
has_PartMC = hasPartMC(ctx, ctx.config, r1, r2, c1, c2);
|
|
861
|
+
if (has_PartMC) {
|
|
862
|
+
break;
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
if (has_PartMC) {
|
|
866
|
+
return;
|
|
867
|
+
}
|
|
868
|
+
}
|
|
869
|
+
var flowdata = getFlowdata(ctx);
|
|
870
|
+
if (!flowdata) return;
|
|
871
|
+
if (!ctx.luckysheet_select_save) return;
|
|
872
|
+
mergeCells(ctx, ctx.currentSheetId, ctx.luckysheet_select_save, type);
|
|
873
|
+
}
|
|
874
|
+
export function handleSort(ctx, isAsc) {
|
|
875
|
+
sortSelection(ctx, isAsc);
|
|
876
|
+
}
|
|
877
|
+
export function handleFreeze(ctx, type) {
|
|
878
|
+
var _a, _b;
|
|
879
|
+
var allowEdit = isAllowEdit(ctx);
|
|
880
|
+
if (!allowEdit) return;
|
|
881
|
+
var file = ctx.luckysheetfile[getSheetIndex(ctx, ctx.currentSheetId)];
|
|
882
|
+
if (!file) return;
|
|
883
|
+
if (type === "freeze-cancel") {
|
|
884
|
+
delete file.frozen;
|
|
885
|
+
return;
|
|
886
|
+
}
|
|
887
|
+
var firstSelection = (_a = ctx.luckysheet_select_save) === null || _a === void 0 ? void 0 : _a[0];
|
|
888
|
+
if (!firstSelection) return;
|
|
889
|
+
var row_focus = firstSelection.row_focus,
|
|
890
|
+
column_focus = firstSelection.column_focus;
|
|
891
|
+
if (row_focus == null || column_focus == null) return;
|
|
892
|
+
var m = (_b = ctx.config.merge) === null || _b === void 0 ? void 0 : _b["".concat(row_focus, "_").concat(column_focus)];
|
|
893
|
+
if (m) {
|
|
894
|
+
row_focus = m.r + m.rs - 1;
|
|
895
|
+
column_focus = m.c + m.cs - 1;
|
|
896
|
+
}
|
|
897
|
+
file.frozen = {
|
|
898
|
+
type: "both",
|
|
899
|
+
range: {
|
|
900
|
+
row_focus: row_focus,
|
|
901
|
+
column_focus: column_focus
|
|
902
|
+
}
|
|
903
|
+
};
|
|
904
|
+
if (type === "freeze-row") {
|
|
905
|
+
file.frozen.type = "rangeRow";
|
|
906
|
+
} else if (type === "freeze-col") {
|
|
907
|
+
file.frozen.type = "rangeColumn";
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
export function handleTextSize(ctx, cellInput, size, canvas) {
|
|
911
|
+
setAttr(ctx, cellInput, "fs", size, canvas);
|
|
912
|
+
}
|
|
913
|
+
export function handleSum(ctx, cellInput, fxInput, cache) {
|
|
914
|
+
autoSelectionFormula(ctx, cellInput, fxInput, "SUM", cache);
|
|
915
|
+
}
|
|
916
|
+
export function handleLink(ctx) {
|
|
917
|
+
var _a;
|
|
918
|
+
var allowEdit = isAllowEdit(ctx);
|
|
919
|
+
if (!allowEdit) return;
|
|
920
|
+
var selection = (_a = ctx.luckysheet_select_save) === null || _a === void 0 ? void 0 : _a[0];
|
|
921
|
+
var flowdata = getFlowdata(ctx);
|
|
922
|
+
if (flowdata != null && selection != null) {
|
|
923
|
+
showLinkCard(ctx, selection.row[0], selection.column[0], true);
|
|
924
|
+
}
|
|
925
|
+
}
|
|
926
|
+
var handlerMap = {
|
|
927
|
+
"currency-format": handleCurrencyFormat,
|
|
928
|
+
"percentage-format": handlePercentageFormat,
|
|
929
|
+
"number-decrease": handleNumberDecrease,
|
|
930
|
+
"number-increase": handleNumberIncrease,
|
|
931
|
+
"sort-cell": function sortCell(ctx) {
|
|
932
|
+
return handleSort(ctx, true);
|
|
933
|
+
},
|
|
934
|
+
"merge-all": function mergeAll(ctx) {
|
|
935
|
+
return handleMerge(ctx, "mergeAll");
|
|
936
|
+
},
|
|
937
|
+
"border-all": function borderAll(ctx) {
|
|
938
|
+
return handleBorder(ctx, "border-all");
|
|
939
|
+
},
|
|
940
|
+
bold: handleBold,
|
|
941
|
+
italic: handleItalic,
|
|
942
|
+
"strike-through": handleStrikeThrough,
|
|
943
|
+
underline: handleUnderline,
|
|
944
|
+
"clear-format": handleClearFormat,
|
|
945
|
+
"format-painter": handleFormatPainter,
|
|
946
|
+
search: function search(ctx) {
|
|
947
|
+
ctx.showSearch = true;
|
|
948
|
+
},
|
|
949
|
+
link: handleLink
|
|
950
|
+
};
|
|
951
|
+
var selectedMap = {
|
|
952
|
+
bold: function bold(cell) {
|
|
953
|
+
return (cell === null || cell === void 0 ? void 0 : cell.bl) === 1;
|
|
954
|
+
},
|
|
955
|
+
italic: function italic(cell) {
|
|
956
|
+
return (cell === null || cell === void 0 ? void 0 : cell.it) === 1;
|
|
957
|
+
},
|
|
958
|
+
"strike-through": function strikeThrough(cell) {
|
|
959
|
+
return (cell === null || cell === void 0 ? void 0 : cell.cl) === 1;
|
|
960
|
+
},
|
|
961
|
+
underline: function underline(cell) {
|
|
962
|
+
return (cell === null || cell === void 0 ? void 0 : cell.un) === 1;
|
|
963
|
+
}
|
|
964
|
+
};
|
|
965
|
+
export function toolbarItemClickHandler(name) {
|
|
966
|
+
return handlerMap[name];
|
|
967
|
+
}
|
|
968
|
+
export function toolbarItemSelectedFunc(name) {
|
|
969
|
+
return selectedMap[name];
|
|
970
|
+
}
|