@fileverse-dev/fortune-core 1.0.26 → 2.0.0
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 +80254 -0
- package/dist/index.js +80600 -0
- package/{es → dist/packages/core/src}/api/cell.d.ts +10 -10
- package/{lib → dist/packages/core/src}/api/common.d.ts +66 -71
- package/{es → dist/packages/core/src}/api/errors.d.ts +2 -2
- package/{es → dist/packages/core/src}/api/index.d.ts +9 -9
- package/{es → dist/packages/core/src}/api/merge.d.ts +5 -5
- package/{lib → dist/packages/core/src}/api/range.d.ts +22 -22
- package/{lib → dist/packages/core/src}/api/rowcol.d.ts +14 -14
- package/{lib → dist/packages/core/src}/api/sheet.d.ts +10 -10
- package/{lib → dist/packages/core/src}/api/workbook.d.ts +15 -15
- package/{lib → dist/packages/core/src}/canvas.d.ts +46 -46
- package/{es → dist/packages/core/src}/context.d.ts +197 -198
- package/{es → dist/packages/core/src}/events/copy.d.ts +2 -2
- package/{lib → dist/packages/core/src}/events/index.d.ts +4 -4
- package/{lib → dist/packages/core/src}/events/keyboard.d.ts +6 -6
- package/{es → dist/packages/core/src}/events/mouse.d.ts +22 -22
- package/{es → dist/packages/core/src}/events/paste.d.ts +3 -3
- package/{lib → dist/packages/core/src}/index.d.ts +10 -10
- package/{lib → dist/packages/core/src}/locale/en.d.ts +992 -992
- package/{lib → dist/packages/core/src}/locale/es.d.ts +1134 -1134
- package/{lib → dist/packages/core/src}/locale/hi.d.ts +1030 -1030
- package/{lib → dist/packages/core/src}/locale/index.d.ts +1049 -1049
- package/{es → dist/packages/core/src}/locale/zh.d.ts +1048 -1048
- package/{lib → dist/packages/core/src}/locale/zh_tw.d.ts +1187 -1187
- package/{lib → dist/packages/core/src}/modules/ConditionFormat.d.ts +17 -17
- package/{lib → dist/packages/core/src}/modules/border.d.ts +3 -3
- package/{lib → dist/packages/core/src}/modules/cell.d.ts +32 -32
- package/{es → dist/packages/core/src}/modules/clipboard.d.ts +3 -3
- package/{es → dist/packages/core/src}/modules/color.d.ts +1 -1
- package/{lib → dist/packages/core/src}/modules/comment.d.ts +97 -97
- package/{es → dist/packages/core/src}/modules/conditionalFormat.d.ts +2 -2
- package/{es → dist/packages/core/src}/modules/cursor.d.ts +3 -3
- package/{es → dist/packages/core/src}/modules/dataVerification.d.ts +11 -11
- package/{es → dist/packages/core/src}/modules/dropCell.d.ts +10 -10
- package/{lib → dist/packages/core/src}/modules/filter.d.ts +45 -45
- package/{es → dist/packages/core/src}/modules/format.d.ts +6 -6
- package/{lib → dist/packages/core/src}/modules/formula.d.ts +54 -54
- package/{es → dist/packages/core/src}/modules/freeze.d.ts +5 -5
- package/{es → dist/packages/core/src}/modules/hyperlink.d.ts +21 -21
- package/{lib → dist/packages/core/src}/modules/iframe.d.ts +12 -12
- package/{es → dist/packages/core/src}/modules/image.d.ts +31 -31
- package/{es → dist/packages/core/src}/modules/index.d.ts +36 -36
- package/{lib → dist/packages/core/src}/modules/inline-string.d.ts +36 -36
- package/{es → dist/packages/core/src}/modules/location.d.ts +6 -6
- package/{es → dist/packages/core/src}/modules/locationCondition.d.ts +21 -21
- package/{es → dist/packages/core/src}/modules/merge.d.ts +3 -3
- package/{es → dist/packages/core/src}/modules/mobile.d.ts +5 -5
- package/{lib → dist/packages/core/src}/modules/moveCells.d.ts +5 -5
- package/{lib → dist/packages/core/src}/modules/protection.d.ts +5 -5
- package/{lib → dist/packages/core/src}/modules/refresh.d.ts +3 -3
- package/{es → dist/packages/core/src}/modules/rowcol.d.ts +19 -19
- package/{lib → dist/packages/core/src}/modules/screenshot.d.ts +2 -2
- package/{es → dist/packages/core/src}/modules/searchReplace.d.ts +36 -36
- package/{lib → dist/packages/core/src}/modules/selection.d.ts +46 -46
- package/{es → dist/packages/core/src}/modules/sheet.d.ts +10 -10
- package/{es → dist/packages/core/src}/modules/sort.d.ts +7 -7
- package/{es → dist/packages/core/src}/modules/splitColumn.d.ts +5 -5
- package/{es → dist/packages/core/src}/modules/text.d.ts +10 -10
- package/{lib → dist/packages/core/src}/modules/toolbar.d.ts +32 -32
- package/{es → dist/packages/core/src}/modules/validation.d.ts +19 -19
- package/{es → dist/packages/core/src}/modules/zoom.d.ts +3 -3
- package/{es → dist/packages/core/src}/settings.d.ts +100 -100
- package/{es → dist/packages/core/src}/types.d.ts +371 -376
- package/{es → dist/packages/core/src}/utils/freeze.d.ts +7 -7
- package/{es → dist/packages/core/src}/utils/index.d.ts +18 -19
- package/{lib → dist/packages/core/src}/utils/patch.d.ts +37 -37
- package/dist/packages/react/src/components/ChangeColor/index.d.ts +7 -0
- package/dist/packages/react/src/components/ConditionFormat/ConditionRules.d.ts +6 -0
- package/dist/packages/react/src/components/ConditionFormat/index.d.ts +7 -0
- package/dist/packages/react/src/components/ContextMenu/Divider.d.ts +3 -0
- package/dist/packages/react/src/components/ContextMenu/FilterMenu.d.ts +3 -0
- package/dist/packages/react/src/components/ContextMenu/Menu.d.ts +8 -0
- package/dist/packages/react/src/components/ContextMenu/SheetTab.d.ts +4 -0
- package/dist/packages/react/src/components/ContextMenu/index.d.ts +5 -0
- package/dist/packages/react/src/components/CustomSort/index.d.ts +4 -0
- package/dist/packages/react/src/components/DataVerification/DropdownList.d.ts +4 -0
- package/dist/packages/react/src/components/DataVerification/RangeDialog.d.ts +4 -0
- package/dist/packages/react/src/components/DataVerification/getDisplayedRangeTxt.d.ts +2 -0
- package/dist/packages/react/src/components/DataVerification/index.d.ts +4 -0
- package/dist/packages/react/src/components/Dialog/index.d.ts +15 -0
- package/dist/packages/react/src/components/DuneChartsInputModal/DuneChartsInputModal.d.ts +11 -0
- package/dist/packages/react/src/components/DunePreview/DunePreview.d.ts +13 -0
- package/dist/packages/react/src/components/FilterOption/index.d.ts +5 -0
- package/dist/packages/react/src/components/FormatSearch/index.d.ts +6 -0
- package/dist/packages/react/src/components/FormulaSearch/index.d.ts +5 -0
- package/dist/packages/react/src/components/FxEditor/NameBox.d.ts +3 -0
- package/dist/packages/react/src/components/FxEditor/index.d.ts +4 -0
- package/dist/packages/react/src/components/IFrameBoxs/iFrameBoxs.d.ts +4 -0
- package/dist/packages/react/src/components/ImgBoxs/index.d.ts +3 -0
- package/dist/packages/react/src/components/LinkEidtCard/index.d.ts +5 -0
- package/dist/packages/react/src/components/LocationCondition/index.d.ts +3 -0
- package/dist/packages/react/src/components/MessageBox/index.d.ts +9 -0
- package/dist/packages/react/src/components/NotationBoxes/index.d.ts +3 -0
- package/dist/packages/react/src/components/ResetColumnWidth/index.d.ts +2 -0
- package/dist/packages/react/src/components/SVGDefines.d.ts +5 -0
- package/dist/packages/react/src/components/SVGIcon.d.ts +9 -0
- package/dist/packages/react/src/components/SearchReplace/index.d.ts +6 -0
- package/dist/packages/react/src/components/Sheet/index.d.ts +8 -0
- package/dist/packages/react/src/components/SheetList/SheetHiddenButton.d.ts +8 -0
- package/dist/packages/react/src/components/SheetList/SheetListItem.d.ts +9 -0
- package/dist/packages/react/src/components/SheetList/index.d.ts +4 -0
- package/dist/packages/react/src/components/SheetOverlay/ColumnHeader.d.ts +3 -0
- package/dist/packages/react/src/components/SheetOverlay/ContentEditable.d.ts +11 -0
- package/dist/packages/react/src/components/SheetOverlay/FormulaHint/index.d.ts +4 -0
- package/dist/packages/react/src/components/SheetOverlay/FormulaSearch/constant.d.ts +63 -0
- package/dist/packages/react/src/components/SheetOverlay/FormulaSearch/index.d.ts +4 -0
- package/dist/packages/react/src/components/SheetOverlay/InputBox.d.ts +3 -0
- package/dist/packages/react/src/components/SheetOverlay/RowHeader.d.ts +3 -0
- package/dist/packages/react/src/components/SheetOverlay/ScrollBar/index.d.ts +7 -0
- package/dist/packages/react/src/components/SheetOverlay/index.d.ts +4 -0
- package/dist/packages/react/src/components/SheetTab/SheetItem.d.ts +8 -0
- package/dist/packages/react/src/components/SheetTab/index.d.ts +4 -0
- package/dist/packages/react/src/components/SplitColumn/index.d.ts +3 -0
- package/dist/packages/react/src/components/Toolbar/Button.d.ts +12 -0
- package/dist/packages/react/src/components/Toolbar/ColorPicker.d.ts +6 -0
- package/dist/packages/react/src/components/Toolbar/Combo.d.ts +12 -0
- package/dist/packages/react/src/components/Toolbar/CustomBorder.d.ts +7 -0
- package/dist/packages/react/src/components/Toolbar/CustomButton.d.ts +11 -0
- package/dist/packages/react/src/components/Toolbar/CustomColor.d.ts +8 -0
- package/dist/packages/react/src/components/Toolbar/CustomIcon.d.ts +9 -0
- package/dist/packages/react/src/components/Toolbar/Divider.d.ts +4 -0
- package/dist/packages/react/src/components/Toolbar/MoreItemsContainer.d.ts +6 -0
- package/dist/packages/react/src/components/Toolbar/Select.d.ts +14 -0
- package/dist/packages/react/src/components/Toolbar/index.d.ts +10 -0
- package/dist/packages/react/src/components/Workbook/api.d.ts +1177 -0
- package/dist/packages/react/src/components/Workbook/index.d.ts +1185 -0
- package/dist/packages/react/src/components/ZoomControl/index.d.ts +4 -0
- package/dist/packages/react/src/components/index.d.ts +4 -0
- package/dist/packages/react/src/constants.d.ts +1 -0
- package/dist/packages/react/src/context/index.d.ts +25 -0
- package/dist/packages/react/src/context/modal.d.ts +10 -0
- package/dist/packages/react/src/hooks/useAlert.d.ts +4 -0
- package/dist/packages/react/src/hooks/useDialog.d.ts +5 -0
- package/dist/packages/react/src/hooks/useOutsideClick.d.ts +2 -0
- package/dist/packages/react/src/hooks/usePrevious.d.ts +2 -0
- package/dist/packages/react/src/index.d.ts +1 -0
- package/dist/packages/react/src/utils/datepickerStyles.d.ts +2 -0
- package/dist/stories/API.stories.d.ts +1210 -0
- package/dist/stories/Collabration.stories.d.ts +2359 -0
- package/dist/stories/Features.stories.d.ts +9430 -0
- package/dist/stories/data/cell.d.ts +983 -0
- package/dist/stories/data/dataVerification.d.ts +131 -0
- package/dist/stories/data/empty.d.ts +10 -0
- package/dist/stories/data/formula.d.ts +362 -0
- package/dist/stories/data/freeze.d.ts +34 -0
- package/dist/stories/data/protected.d.ts +40 -0
- package/dist/stories/utils.d.ts +1 -0
- package/package.json +6 -7
- package/es/api/cell.js +0 -204
- package/es/api/common.d.ts +0 -71
- package/es/api/common.js +0 -79
- package/es/api/errors.js +0 -2
- package/es/api/index.js +0 -8
- package/es/api/merge.js +0 -15
- package/es/api/range.d.ts +0 -22
- package/es/api/range.js +0 -123
- package/es/api/rowcol.d.ts +0 -14
- package/es/api/rowcol.js +0 -207
- package/es/api/sheet.d.ts +0 -10
- package/es/api/sheet.js +0 -128
- package/es/api/workbook.d.ts +0 -15
- package/es/api/workbook.js +0 -85
- package/es/canvas.d.ts +0 -46
- package/es/canvas.js +0 -1350
- package/es/context.js +0 -381
- package/es/events/copy.js +0 -78
- package/es/events/index.d.ts +0 -4
- package/es/events/index.js +0 -4
- package/es/events/keyboard.d.ts +0 -6
- package/es/events/keyboard.js +0 -332
- package/es/events/mouse.js +0 -1725
- package/es/events/paste.js +0 -1378
- package/es/index.d.ts +0 -10
- package/es/index.js +0 -10
- package/es/locale/en.d.ts +0 -992
- package/es/locale/en.js +0 -10564
- package/es/locale/es.d.ts +0 -1134
- package/es/locale/es.js +0 -10010
- package/es/locale/hi.d.ts +0 -1030
- package/es/locale/hi.js +0 -10550
- package/es/locale/index.d.ts +0 -1049
- package/es/locale/index.js +0 -23
- package/es/locale/zh.js +0 -10568
- package/es/locale/zh_tw.d.ts +0 -1187
- package/es/locale/zh_tw.js +0 -10072
- package/es/modules/ConditionFormat.d.ts +0 -17
- package/es/modules/ConditionFormat.js +0 -1258
- package/es/modules/border.d.ts +0 -3
- package/es/modules/border.js +0 -1240
- package/es/modules/cell.d.ts +0 -32
- package/es/modules/cell.js +0 -1055
- package/es/modules/clipboard.js +0 -36
- package/es/modules/color.js +0 -1
- package/es/modules/comment.d.ts +0 -97
- package/es/modules/comment.js +0 -597
- package/es/modules/conditionalFormat.js +0 -441
- package/es/modules/cursor.js +0 -62
- package/es/modules/dataVerification.js +0 -701
- package/es/modules/dropCell.js +0 -2267
- package/es/modules/filter.d.ts +0 -45
- package/es/modules/filter.js +0 -434
- package/es/modules/format.js +0 -323
- package/es/modules/formula.d.ts +0 -54
- package/es/modules/formula.js +0 -2301
- package/es/modules/freeze.js +0 -148
- package/es/modules/hyperlink.js +0 -216
- package/es/modules/iframe.d.ts +0 -12
- package/es/modules/iframe.js +0 -220
- package/es/modules/image.js +0 -253
- package/es/modules/index.js +0 -36
- package/es/modules/inline-string.d.ts +0 -36
- package/es/modules/inline-string.js +0 -437
- package/es/modules/location.js +0 -46
- package/es/modules/locationCondition.js +0 -218
- package/es/modules/merge.js +0 -216
- package/es/modules/mobile.js +0 -33
- package/es/modules/moveCells.d.ts +0 -5
- package/es/modules/moveCells.js +0 -348
- package/es/modules/protection.d.ts +0 -5
- package/es/modules/protection.js +0 -96
- package/es/modules/refresh.d.ts +0 -3
- package/es/modules/refresh.js +0 -34
- package/es/modules/rowcol.js +0 -1922
- package/es/modules/screenshot.d.ts +0 -2
- package/es/modules/screenshot.js +0 -90
- package/es/modules/searchReplace.js +0 -388
- package/es/modules/selection.d.ts +0 -46
- package/es/modules/selection.js +0 -1674
- package/es/modules/sheet.js +0 -237
- package/es/modules/sort.js +0 -134
- package/es/modules/splitColumn.js +0 -126
- package/es/modules/ssf.js +0 -1533
- package/es/modules/text.js +0 -1207
- package/es/modules/toolbar.d.ts +0 -32
- package/es/modules/toolbar.js +0 -970
- package/es/modules/validation.js +0 -190
- package/es/modules/zoom.js +0 -29
- package/es/settings.js +0 -36
- package/es/types.js +0 -1
- package/es/utils/freeze.js +0 -86
- package/es/utils/index.js +0 -198
- package/es/utils/patch.d.ts +0 -37
- package/es/utils/patch.js +0 -381
- package/lib/api/cell.d.ts +0 -10
- package/lib/api/cell.js +0 -215
- package/lib/api/common.js +0 -88
- package/lib/api/errors.d.ts +0 -2
- package/lib/api/errors.js +0 -8
- package/lib/api/index.d.ts +0 -9
- package/lib/api/index.js +0 -101
- package/lib/api/merge.d.ts +0 -5
- package/lib/api/merge.js +0 -22
- package/lib/api/range.js +0 -138
- package/lib/api/rowcol.js +0 -222
- package/lib/api/sheet.js +0 -145
- package/lib/api/workbook.js +0 -98
- package/lib/canvas.js +0 -1356
- package/lib/context.d.ts +0 -198
- package/lib/context.js +0 -393
- package/lib/events/copy.d.ts +0 -2
- package/lib/events/copy.js +0 -85
- package/lib/events/index.js +0 -49
- package/lib/events/keyboard.js +0 -342
- package/lib/events/mouse.d.ts +0 -22
- package/lib/events/mouse.js +0 -1744
- package/lib/events/paste.d.ts +0 -3
- package/lib/events/paste.js +0 -1386
- package/lib/index.js +0 -109
- package/lib/locale/en.js +0 -10570
- package/lib/locale/es.js +0 -10016
- package/lib/locale/hi.js +0 -10556
- package/lib/locale/index.js +0 -29
- package/lib/locale/zh.d.ts +0 -1048
- package/lib/locale/zh.js +0 -10574
- package/lib/locale/zh_tw.js +0 -10078
- package/lib/modules/ConditionFormat.js +0 -1273
- package/lib/modules/border.js +0 -1248
- package/lib/modules/cell.js +0 -1085
- package/lib/modules/clipboard.d.ts +0 -3
- package/lib/modules/clipboard.js +0 -42
- package/lib/modules/color.d.ts +0 -1
- package/lib/modules/color.js +0 -7
- package/lib/modules/comment.js +0 -625
- package/lib/modules/conditionalFormat.d.ts +0 -2
- package/lib/modules/conditionalFormat.js +0 -447
- package/lib/modules/cursor.d.ts +0 -3
- package/lib/modules/cursor.js +0 -70
- package/lib/modules/dataVerification.d.ts +0 -11
- package/lib/modules/dataVerification.js +0 -716
- package/lib/modules/dropCell.d.ts +0 -10
- package/lib/modules/dropCell.js +0 -2283
- package/lib/modules/filter.js +0 -448
- package/lib/modules/format.d.ts +0 -6
- package/lib/modules/format.js +0 -334
- package/lib/modules/formula.js +0 -2330
- package/lib/modules/freeze.d.ts +0 -5
- package/lib/modules/freeze.js +0 -158
- package/lib/modules/hyperlink.d.ts +0 -21
- package/lib/modules/hyperlink.js +0 -232
- package/lib/modules/iframe.js +0 -236
- package/lib/modules/image.d.ts +0 -31
- package/lib/modules/image.js +0 -272
- package/lib/modules/index.d.ts +0 -36
- package/lib/modules/index.js +0 -401
- package/lib/modules/inline-string.js +0 -452
- package/lib/modules/location.d.ts +0 -6
- package/lib/modules/location.js +0 -57
- package/lib/modules/locationCondition.d.ts +0 -21
- package/lib/modules/locationCondition.js +0 -229
- package/lib/modules/merge.d.ts +0 -3
- package/lib/modules/merge.js +0 -223
- package/lib/modules/mobile.d.ts +0 -5
- package/lib/modules/mobile.js +0 -41
- package/lib/modules/moveCells.js +0 -357
- package/lib/modules/protection.js +0 -106
- package/lib/modules/refresh.js +0 -40
- package/lib/modules/rowcol.d.ts +0 -19
- package/lib/modules/rowcol.js +0 -1935
- package/lib/modules/screenshot.js +0 -96
- package/lib/modules/searchReplace.d.ts +0 -36
- package/lib/modules/searchReplace.js +0 -402
- package/lib/modules/selection.js +0 -1703
- package/lib/modules/sheet.d.ts +0 -10
- package/lib/modules/sheet.js +0 -250
- package/lib/modules/sort.d.ts +0 -7
- package/lib/modules/sort.js +0 -143
- package/lib/modules/splitColumn.d.ts +0 -5
- package/lib/modules/splitColumn.js +0 -136
- package/lib/modules/ssf.js +0 -1539
- package/lib/modules/text.d.ts +0 -10
- package/lib/modules/text.js +0 -1221
- package/lib/modules/toolbar.js +0 -1003
- package/lib/modules/validation.d.ts +0 -19
- package/lib/modules/validation.js +0 -205
- package/lib/modules/zoom.d.ts +0 -3
- package/lib/modules/zoom.js +0 -36
- package/lib/settings.d.ts +0 -100
- package/lib/settings.js +0 -42
- package/lib/types.d.ts +0 -376
- package/lib/types.js +0 -5
- package/lib/utils/freeze.d.ts +0 -7
- package/lib/utils/freeze.js +0 -92
- package/lib/utils/index.d.ts +0 -19
- package/lib/utils/index.js +0 -258
- package/lib/utils/patch.js +0 -392
package/es/modules/cell.js
DELETED
|
@@ -1,1055 +0,0 @@
|
|
|
1
|
-
import _ from "lodash";
|
|
2
|
-
import { getFlowdata } from "../context";
|
|
3
|
-
import { getSheetIndex, indexToColumnChar, rgbToHex } from "../utils";
|
|
4
|
-
import { checkCF, getComputeMap } from "./ConditionFormat";
|
|
5
|
-
import { getFailureText, validateCellData } from "./dataVerification";
|
|
6
|
-
import { genarate, update } from "./format";
|
|
7
|
-
import { getRowHeight } from "../api";
|
|
8
|
-
import { delFunctionGroup, execfunction, execFunctionGroup, functionHTMLGenerate, getcellrange, iscelldata } from "./formula";
|
|
9
|
-
import { attrToCssName, convertSpanToShareString, isInlineStringCell, isInlineStringCT } from "./inline-string";
|
|
10
|
-
import { isRealNull, isRealNum, valueIsError } from "./validation";
|
|
11
|
-
import { getCellTextInfo } from "./text";
|
|
12
|
-
export function normalizedCellAttr(cell, attr, defaultFontSize) {
|
|
13
|
-
if (defaultFontSize === void 0) {
|
|
14
|
-
defaultFontSize = 10;
|
|
15
|
-
}
|
|
16
|
-
var tf = {
|
|
17
|
-
bl: 1,
|
|
18
|
-
it: 1,
|
|
19
|
-
ff: 1,
|
|
20
|
-
cl: 1,
|
|
21
|
-
un: 1
|
|
22
|
-
};
|
|
23
|
-
var value = cell === null || cell === void 0 ? void 0 : cell[attr];
|
|
24
|
-
if (attr in tf || attr === "fs" && isInlineStringCell(cell)) {
|
|
25
|
-
value || (value = "0");
|
|
26
|
-
} else if (["fc", "bg", "bc"].includes(attr)) {
|
|
27
|
-
if (["fc", "bc"].includes(attr)) {
|
|
28
|
-
value || (value = "#000000");
|
|
29
|
-
}
|
|
30
|
-
if ((value === null || value === void 0 ? void 0 : value.indexOf("rgba")) > -1) {
|
|
31
|
-
value = rgbToHex(value);
|
|
32
|
-
}
|
|
33
|
-
} else if (attr.substring(0, 2) === "bs") {
|
|
34
|
-
value || (value = "none");
|
|
35
|
-
} else if (attr === "ht" || attr === "vt") {
|
|
36
|
-
var defaultValue = attr === "ht" ? "1" : "0";
|
|
37
|
-
value = !_.isNil(value) ? value.toString() : defaultValue;
|
|
38
|
-
if (["0", "1", "2"].indexOf(value.toString()) === -1) {
|
|
39
|
-
value = defaultValue;
|
|
40
|
-
}
|
|
41
|
-
} else if (attr === "fs") {
|
|
42
|
-
value || (value = defaultFontSize.toString());
|
|
43
|
-
} else if (attr === "tb" || attr === "tr") {
|
|
44
|
-
value || (value = "0");
|
|
45
|
-
}
|
|
46
|
-
return value;
|
|
47
|
-
}
|
|
48
|
-
export function normalizedAttr(data, r, c, attr) {
|
|
49
|
-
if (!data || !data[r]) {
|
|
50
|
-
console.warn("cell (%d, %d) is null", r, c);
|
|
51
|
-
return null;
|
|
52
|
-
}
|
|
53
|
-
var cell = data[r][c];
|
|
54
|
-
if (!cell) return undefined;
|
|
55
|
-
return normalizedCellAttr(cell, attr);
|
|
56
|
-
}
|
|
57
|
-
export function getCellValue(r, c, data, attr) {
|
|
58
|
-
if (!attr) {
|
|
59
|
-
attr = "v";
|
|
60
|
-
}
|
|
61
|
-
var d_value;
|
|
62
|
-
if (!_.isNil(r) && !_.isNil(c)) {
|
|
63
|
-
d_value = data[r][c];
|
|
64
|
-
} else if (!_.isNil(r)) {
|
|
65
|
-
d_value = data[r];
|
|
66
|
-
} else if (!_.isNil(c)) {
|
|
67
|
-
var newData = data[0].map(function (col, i) {
|
|
68
|
-
return data.map(function (row) {
|
|
69
|
-
return row[i];
|
|
70
|
-
});
|
|
71
|
-
});
|
|
72
|
-
d_value = newData[c];
|
|
73
|
-
} else {
|
|
74
|
-
return data;
|
|
75
|
-
}
|
|
76
|
-
var retv = d_value;
|
|
77
|
-
if (_.isPlainObject(d_value)) {
|
|
78
|
-
var d = d_value;
|
|
79
|
-
retv = d[attr];
|
|
80
|
-
if (attr === "f" && !_.isNil(retv)) {
|
|
81
|
-
retv = functionHTMLGenerate(retv);
|
|
82
|
-
} else if (attr === "f") {
|
|
83
|
-
retv = d.v;
|
|
84
|
-
} else if (d && d.ct && d.ct.t === "d") {
|
|
85
|
-
retv = d.m;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
if (retv === undefined) {
|
|
89
|
-
retv = null;
|
|
90
|
-
}
|
|
91
|
-
return retv;
|
|
92
|
-
}
|
|
93
|
-
export function setCellValue(ctx, r, c, d, v) {
|
|
94
|
-
var _a, _b, _c, _d, _e, _f;
|
|
95
|
-
if (_.isNil(d)) {
|
|
96
|
-
d = getFlowdata(ctx);
|
|
97
|
-
}
|
|
98
|
-
if (!d) return;
|
|
99
|
-
var cell = d[r][c];
|
|
100
|
-
var vupdate;
|
|
101
|
-
if (_.isPlainObject(v)) {
|
|
102
|
-
if (_.isNil(cell)) {
|
|
103
|
-
cell = v;
|
|
104
|
-
} else {
|
|
105
|
-
if (!_.isNil(v.f)) {
|
|
106
|
-
cell.f = v.f;
|
|
107
|
-
} else if ("f" in cell) {
|
|
108
|
-
delete cell.f;
|
|
109
|
-
}
|
|
110
|
-
if (!_.isNil(v.ct)) {
|
|
111
|
-
cell.ct = v.ct;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
if (_.isPlainObject(v.v)) {
|
|
115
|
-
vupdate = v.v.v;
|
|
116
|
-
} else {
|
|
117
|
-
vupdate = v.v;
|
|
118
|
-
}
|
|
119
|
-
} else {
|
|
120
|
-
vupdate = v;
|
|
121
|
-
}
|
|
122
|
-
if (isRealNull(vupdate)) {
|
|
123
|
-
if (_.isPlainObject(cell)) {
|
|
124
|
-
delete cell.m;
|
|
125
|
-
delete cell.v;
|
|
126
|
-
} else {
|
|
127
|
-
cell = null;
|
|
128
|
-
}
|
|
129
|
-
d[r][c] = cell;
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
132
|
-
if (isRealNull(cell) || (_.isString(cell) || _.isNumber(cell)) && cell === v) {
|
|
133
|
-
cell = {};
|
|
134
|
-
}
|
|
135
|
-
if (!cell) return;
|
|
136
|
-
var vupdateStr = vupdate.toString();
|
|
137
|
-
if (vupdateStr.substr(0, 1) === "'") {
|
|
138
|
-
cell.m = vupdateStr.substr(1);
|
|
139
|
-
cell.ct = {
|
|
140
|
-
fa: "@",
|
|
141
|
-
t: "s"
|
|
142
|
-
};
|
|
143
|
-
cell.v = vupdateStr.substr(1);
|
|
144
|
-
cell.qp = 1;
|
|
145
|
-
} else if (cell.qp === 1) {
|
|
146
|
-
cell.m = vupdateStr;
|
|
147
|
-
cell.ct = {
|
|
148
|
-
fa: "@",
|
|
149
|
-
t: "s"
|
|
150
|
-
};
|
|
151
|
-
cell.v = vupdateStr;
|
|
152
|
-
} else if (vupdateStr.toUpperCase() === "TRUE" && (_.isNil((_a = cell.ct) === null || _a === void 0 ? void 0 : _a.fa) || ((_b = cell.ct) === null || _b === void 0 ? void 0 : _b.fa) !== "@")) {
|
|
153
|
-
cell.m = "TRUE";
|
|
154
|
-
cell.ct = {
|
|
155
|
-
fa: "General",
|
|
156
|
-
t: "b"
|
|
157
|
-
};
|
|
158
|
-
cell.v = true;
|
|
159
|
-
} else if (vupdateStr.toUpperCase() === "FALSE" && (_.isNil((_c = cell.ct) === null || _c === void 0 ? void 0 : _c.fa) || ((_d = cell.ct) === null || _d === void 0 ? void 0 : _d.fa) !== "@")) {
|
|
160
|
-
cell.m = "FALSE";
|
|
161
|
-
cell.ct = {
|
|
162
|
-
fa: "General",
|
|
163
|
-
t: "b"
|
|
164
|
-
};
|
|
165
|
-
cell.v = false;
|
|
166
|
-
} else if (vupdateStr.substr(-1) === "%" && isRealNum(vupdateStr.substring(0, vupdateStr.length - 1)) && (_.isNil((_e = cell.ct) === null || _e === void 0 ? void 0 : _e.fa) || ((_f = cell.ct) === null || _f === void 0 ? void 0 : _f.fa) !== "@")) {
|
|
167
|
-
cell.ct = {
|
|
168
|
-
fa: "0%",
|
|
169
|
-
t: "n"
|
|
170
|
-
};
|
|
171
|
-
cell.v = vupdateStr.substring(0, vupdateStr.length - 1) / 100;
|
|
172
|
-
cell.m = vupdate;
|
|
173
|
-
} else if (valueIsError(vupdate)) {
|
|
174
|
-
cell.m = vupdateStr;
|
|
175
|
-
if (!_.isNil(cell.ct)) {
|
|
176
|
-
cell.ct.t = "e";
|
|
177
|
-
} else {
|
|
178
|
-
cell.ct = {
|
|
179
|
-
fa: "General",
|
|
180
|
-
t: "e"
|
|
181
|
-
};
|
|
182
|
-
}
|
|
183
|
-
cell.v = vupdate;
|
|
184
|
-
} else {
|
|
185
|
-
if (!_.isNil(cell.f) && isRealNum(vupdate) && !/^\d{6}(18|19|20)?\d{2}(0[1-9]|1[12])(0[1-9]|[12]\d|3[01])\d{3}(\d|X)$/i.test(vupdate)) {
|
|
186
|
-
cell.v = parseFloat(vupdate);
|
|
187
|
-
if (_.isNil(cell.ct)) {
|
|
188
|
-
cell.ct = {
|
|
189
|
-
fa: "General",
|
|
190
|
-
t: "n"
|
|
191
|
-
};
|
|
192
|
-
}
|
|
193
|
-
if (cell.v === Infinity || cell.v === -Infinity) {
|
|
194
|
-
cell.m = cell.v.toString();
|
|
195
|
-
} else {
|
|
196
|
-
if (cell.v.toString().indexOf("e") > -1) {
|
|
197
|
-
var len = void 0;
|
|
198
|
-
if (cell.v.toString().split(".").length === 1) {
|
|
199
|
-
len = 0;
|
|
200
|
-
} else {
|
|
201
|
-
len = cell.v.toString().split(".")[1].split("e")[0].length;
|
|
202
|
-
}
|
|
203
|
-
if (len > 5) {
|
|
204
|
-
len = 5;
|
|
205
|
-
}
|
|
206
|
-
cell.m = cell.v.toExponential(len).toString();
|
|
207
|
-
} else {
|
|
208
|
-
var v_p = Math.round(cell.v * 1000000000) / 1000000000;
|
|
209
|
-
if (_.isNil(cell.ct)) {
|
|
210
|
-
var mask = genarate(v_p);
|
|
211
|
-
if (mask != null) {
|
|
212
|
-
cell.m = mask[0].toString();
|
|
213
|
-
}
|
|
214
|
-
} else {
|
|
215
|
-
var mask = update(cell.ct.fa, v_p);
|
|
216
|
-
cell.m = mask.toString();
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
} else if (!_.isNil(cell.ct) && cell.ct.fa === "@") {
|
|
221
|
-
cell.m = vupdateStr;
|
|
222
|
-
cell.v = vupdate;
|
|
223
|
-
} else if (cell.ct != null && cell.ct.t === "d" && _.isString(vupdate)) {
|
|
224
|
-
var mask = genarate(vupdate);
|
|
225
|
-
if (mask[1].t !== "d" || mask[1].fa === cell.ct.fa) {
|
|
226
|
-
cell.m = mask[0], cell.ct = mask[1], cell.v = mask[2];
|
|
227
|
-
} else {
|
|
228
|
-
cell.v = mask[2];
|
|
229
|
-
cell.m = update(cell.ct.fa, cell.v);
|
|
230
|
-
}
|
|
231
|
-
} else if (!_.isNil(cell.ct) && !_.isNil(cell.ct.fa) && cell.ct.fa !== "General") {
|
|
232
|
-
if (isRealNum(vupdate)) {
|
|
233
|
-
vupdate = parseFloat(vupdate);
|
|
234
|
-
}
|
|
235
|
-
var mask = update(cell.ct.fa, vupdate);
|
|
236
|
-
if (mask === vupdate) {
|
|
237
|
-
mask = genarate(vupdate);
|
|
238
|
-
cell.m = mask[0].toString();
|
|
239
|
-
cell.ct = mask[1], cell.v = mask[2];
|
|
240
|
-
} else {
|
|
241
|
-
cell.m = mask.toString();
|
|
242
|
-
cell.v = vupdate;
|
|
243
|
-
}
|
|
244
|
-
} else {
|
|
245
|
-
if (isRealNum(vupdate) && !/^\d{6}(18|19|20)?\d{2}(0[1-9]|1[12])(0[1-9]|[12]\d|3[01])\d{3}(\d|X)$/i.test(vupdate)) {
|
|
246
|
-
if (typeof vupdate === "string") {
|
|
247
|
-
var flag = vupdate.split("").every(function (ele) {
|
|
248
|
-
return ele === "0" || ele === ".";
|
|
249
|
-
});
|
|
250
|
-
if (flag) {
|
|
251
|
-
vupdate = parseFloat(vupdate);
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
cell.v = vupdate;
|
|
255
|
-
cell.ct = {
|
|
256
|
-
fa: "General",
|
|
257
|
-
t: "n"
|
|
258
|
-
};
|
|
259
|
-
if (cell.v === Infinity || cell.v === -Infinity) {
|
|
260
|
-
cell.m = cell.v.toString();
|
|
261
|
-
} else if (cell.v != null) {
|
|
262
|
-
var mask = genarate(cell.v);
|
|
263
|
-
if (mask) {
|
|
264
|
-
cell.m = mask[0].toString();
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
} else {
|
|
268
|
-
var mask = genarate(vupdate);
|
|
269
|
-
if (mask) {
|
|
270
|
-
cell.m = mask[0].toString();
|
|
271
|
-
cell.ct = mask[1], cell.v = mask[2];
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
d[r][c] = cell;
|
|
277
|
-
}
|
|
278
|
-
export function getRealCellValue(r, c, data, attr) {
|
|
279
|
-
var value = getCellValue(r, c, data, "m");
|
|
280
|
-
if (_.isNil(value)) {
|
|
281
|
-
value = getCellValue(r, c, data, attr);
|
|
282
|
-
if (_.isNil(value)) {
|
|
283
|
-
var ct = getCellValue(r, c, data, "ct");
|
|
284
|
-
if (isInlineStringCT(ct)) {
|
|
285
|
-
value = ct.s;
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
return value;
|
|
290
|
-
}
|
|
291
|
-
export function mergeBorder(ctx, d, row_index, col_index) {
|
|
292
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
293
|
-
if (!d || !d[row_index]) {
|
|
294
|
-
console.warn("Merge info is null", row_index, col_index);
|
|
295
|
-
return null;
|
|
296
|
-
}
|
|
297
|
-
var value = d[row_index][col_index];
|
|
298
|
-
if (!value) return null;
|
|
299
|
-
if (value === null || value === void 0 ? void 0 : value.mc) {
|
|
300
|
-
var margeMaindata = value.mc;
|
|
301
|
-
if (!margeMaindata) {
|
|
302
|
-
console.warn("Merge info is null", row_index, col_index);
|
|
303
|
-
return null;
|
|
304
|
-
}
|
|
305
|
-
col_index = margeMaindata.c;
|
|
306
|
-
row_index = margeMaindata.r;
|
|
307
|
-
if (_.isNil((_a = d === null || d === void 0 ? void 0 : d[row_index]) === null || _a === void 0 ? void 0 : _a[col_index])) {
|
|
308
|
-
console.warn("Main merge Cell info is null", row_index, col_index);
|
|
309
|
-
return null;
|
|
310
|
-
}
|
|
311
|
-
var col_rs = (_d = (_c = (_b = d[row_index]) === null || _b === void 0 ? void 0 : _b[col_index]) === null || _c === void 0 ? void 0 : _c.mc) === null || _d === void 0 ? void 0 : _d.cs;
|
|
312
|
-
var row_rs = (_g = (_f = (_e = d[row_index]) === null || _e === void 0 ? void 0 : _e[col_index]) === null || _f === void 0 ? void 0 : _f.mc) === null || _g === void 0 ? void 0 : _g.rs;
|
|
313
|
-
var mergeMain = (_j = (_h = d[row_index]) === null || _h === void 0 ? void 0 : _h[col_index]) === null || _j === void 0 ? void 0 : _j.mc;
|
|
314
|
-
if (!mergeMain || _.isNil(mergeMain === null || mergeMain === void 0 ? void 0 : mergeMain.rs) || _.isNil(mergeMain === null || mergeMain === void 0 ? void 0 : mergeMain.cs) || _.isNil(col_rs) || _.isNil(row_rs)) {
|
|
315
|
-
console.warn("Main merge info is null", mergeMain);
|
|
316
|
-
return null;
|
|
317
|
-
}
|
|
318
|
-
var start_r = void 0;
|
|
319
|
-
var end_r = void 0;
|
|
320
|
-
var row = void 0;
|
|
321
|
-
var row_pre = void 0;
|
|
322
|
-
for (var r = row_index; r < mergeMain.rs + row_index; r += 1) {
|
|
323
|
-
if (r === 0) {
|
|
324
|
-
start_r = -1;
|
|
325
|
-
} else {
|
|
326
|
-
start_r = ctx.visibledatarow[r - 1] - 1;
|
|
327
|
-
}
|
|
328
|
-
end_r = ctx.visibledatarow[r];
|
|
329
|
-
if (row_pre === undefined) {
|
|
330
|
-
row_pre = start_r;
|
|
331
|
-
row = end_r;
|
|
332
|
-
} else if (row !== undefined) {
|
|
333
|
-
row += end_r - start_r - 1;
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
var start_c = void 0;
|
|
337
|
-
var end_c = void 0;
|
|
338
|
-
var col = void 0;
|
|
339
|
-
var col_pre = void 0;
|
|
340
|
-
for (var c = col_index; c < mergeMain.cs + col_index; c += 1) {
|
|
341
|
-
if (c === 0) {
|
|
342
|
-
start_c = 0;
|
|
343
|
-
} else {
|
|
344
|
-
start_c = ctx.visibledatacolumn[c - 1];
|
|
345
|
-
}
|
|
346
|
-
end_c = ctx.visibledatacolumn[c];
|
|
347
|
-
if (col_pre === undefined) {
|
|
348
|
-
col_pre = start_c;
|
|
349
|
-
col = end_c;
|
|
350
|
-
} else if (col !== undefined) {
|
|
351
|
-
col += end_c - start_c;
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
if (_.isNil(row_pre) || _.isNil(col_pre) || _.isNil(row) || _.isNil(col)) {
|
|
355
|
-
console.warn("Main merge info row_pre or col_pre or row or col is null", mergeMain);
|
|
356
|
-
return null;
|
|
357
|
-
}
|
|
358
|
-
return {
|
|
359
|
-
row: [row_pre, row, row_index, row_index + row_rs - 1],
|
|
360
|
-
column: [col_pre, col, col_index, col_index + col_rs - 1]
|
|
361
|
-
};
|
|
362
|
-
}
|
|
363
|
-
return null;
|
|
364
|
-
}
|
|
365
|
-
function mergeMove(ctx, mc, columnseleted, rowseleted, s, top, height, left, width) {
|
|
366
|
-
var row_st = mc.r;
|
|
367
|
-
var row_ed = mc.r + mc.rs - 1;
|
|
368
|
-
var col_st = mc.c;
|
|
369
|
-
var col_ed = mc.c + mc.cs - 1;
|
|
370
|
-
var ismatch = false;
|
|
371
|
-
columnseleted[0] = Math.min(columnseleted[0], columnseleted[1]);
|
|
372
|
-
rowseleted[0] = Math.min(rowseleted[0], rowseleted[1]);
|
|
373
|
-
if (columnseleted[0] <= col_st && columnseleted[1] >= col_ed && rowseleted[0] <= row_st && rowseleted[1] >= row_ed || !(columnseleted[1] < col_st || columnseleted[0] > col_ed) && !(rowseleted[1] < row_st || rowseleted[0] > row_ed)) {
|
|
374
|
-
var flowdata = getFlowdata(ctx);
|
|
375
|
-
if (!flowdata) return null;
|
|
376
|
-
var margeset = mergeBorder(ctx, flowdata, mc.r, mc.c);
|
|
377
|
-
if (margeset) {
|
|
378
|
-
var row = margeset.row[1];
|
|
379
|
-
var row_pre = margeset.row[0];
|
|
380
|
-
var col = margeset.column[1];
|
|
381
|
-
var col_pre = margeset.column[0];
|
|
382
|
-
if (!(columnseleted[1] < col_st || columnseleted[0] > col_ed)) {
|
|
383
|
-
if (rowseleted[0] <= row_ed && rowseleted[0] >= row_st) {
|
|
384
|
-
height += top - row_pre;
|
|
385
|
-
top = row_pre;
|
|
386
|
-
rowseleted[0] = row_st;
|
|
387
|
-
}
|
|
388
|
-
if (rowseleted[1] >= row_st && rowseleted[1] <= row_ed) {
|
|
389
|
-
if (s.row_focus >= row_st && s.row_focus <= row_ed) {
|
|
390
|
-
height = row - top;
|
|
391
|
-
} else {
|
|
392
|
-
height = row - top;
|
|
393
|
-
}
|
|
394
|
-
rowseleted[1] = row_ed;
|
|
395
|
-
}
|
|
396
|
-
}
|
|
397
|
-
if (!(rowseleted[1] < row_st || rowseleted[0] > row_ed)) {
|
|
398
|
-
if (columnseleted[0] <= col_ed && columnseleted[0] >= col_st) {
|
|
399
|
-
width += left - col_pre;
|
|
400
|
-
left = col_pre;
|
|
401
|
-
columnseleted[0] = col_st;
|
|
402
|
-
}
|
|
403
|
-
if (columnseleted[1] >= col_st && columnseleted[1] <= col_ed) {
|
|
404
|
-
if (s.column_focus >= col_st && s.column_focus <= col_ed) {
|
|
405
|
-
width = col - left;
|
|
406
|
-
} else {
|
|
407
|
-
width = col - left;
|
|
408
|
-
}
|
|
409
|
-
columnseleted[1] = col_ed;
|
|
410
|
-
}
|
|
411
|
-
}
|
|
412
|
-
ismatch = true;
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
if (ismatch) {
|
|
416
|
-
return [columnseleted, rowseleted, top, height, left, width];
|
|
417
|
-
}
|
|
418
|
-
return null;
|
|
419
|
-
}
|
|
420
|
-
export function mergeMoveMain(ctx, columnseleted, rowseleted, s, top, height, left, width) {
|
|
421
|
-
var mergesetting = ctx.config.merge;
|
|
422
|
-
if (!mergesetting) {
|
|
423
|
-
return null;
|
|
424
|
-
}
|
|
425
|
-
var mcset = Object.keys(mergesetting);
|
|
426
|
-
rowseleted[1] = Math.max(rowseleted[0], rowseleted[1]);
|
|
427
|
-
columnseleted[1] = Math.max(columnseleted[0], columnseleted[1]);
|
|
428
|
-
var offloop = true;
|
|
429
|
-
var mergeMoveData = {};
|
|
430
|
-
while (offloop) {
|
|
431
|
-
offloop = false;
|
|
432
|
-
for (var i = 0; i < mcset.length; i += 1) {
|
|
433
|
-
var key = mcset[i];
|
|
434
|
-
var mc = mergesetting[key];
|
|
435
|
-
if (key in mergeMoveData) {
|
|
436
|
-
continue;
|
|
437
|
-
}
|
|
438
|
-
var changeparam = mergeMove(ctx, mc, columnseleted, rowseleted, s, top, height, left, width);
|
|
439
|
-
if (changeparam != null) {
|
|
440
|
-
mergeMoveData[key] = mc;
|
|
441
|
-
columnseleted = changeparam[0], rowseleted = changeparam[1], top = changeparam[2], height = changeparam[3], left = changeparam[4], width = changeparam[5];
|
|
442
|
-
offloop = true;
|
|
443
|
-
} else {
|
|
444
|
-
delete mergeMoveData[key];
|
|
445
|
-
}
|
|
446
|
-
}
|
|
447
|
-
}
|
|
448
|
-
return [columnseleted, rowseleted, top, height, left, width];
|
|
449
|
-
}
|
|
450
|
-
export function cancelFunctionrangeSelected(ctx) {
|
|
451
|
-
if (ctx.formulaCache.selectingRangeIndex === -1) {
|
|
452
|
-
ctx.formulaRangeSelect = undefined;
|
|
453
|
-
}
|
|
454
|
-
}
|
|
455
|
-
export function cancelNormalSelected(ctx) {
|
|
456
|
-
cancelFunctionrangeSelected(ctx);
|
|
457
|
-
ctx.luckysheetCellUpdate = [];
|
|
458
|
-
ctx.formulaRangeHighlight = [];
|
|
459
|
-
ctx.functionHint = null;
|
|
460
|
-
ctx.formulaCache.rangestart = false;
|
|
461
|
-
ctx.formulaCache.rangedrag_column_start = false;
|
|
462
|
-
ctx.formulaCache.rangedrag_row_start = false;
|
|
463
|
-
}
|
|
464
|
-
export function updateCell(ctx, r, c, $input, value, canvas) {
|
|
465
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
466
|
-
var inputText = $input === null || $input === void 0 ? void 0 : $input.innerText;
|
|
467
|
-
var inputHtml = $input === null || $input === void 0 ? void 0 : $input.innerHTML;
|
|
468
|
-
var flowdata = getFlowdata(ctx);
|
|
469
|
-
if (!flowdata) return;
|
|
470
|
-
var index = getSheetIndex(ctx, ctx.currentSheetId);
|
|
471
|
-
var dataVerification = ctx.luckysheetfile[index].dataVerification;
|
|
472
|
-
if (!_.isNil(dataVerification)) {
|
|
473
|
-
var dvItem = dataVerification["".concat(r, "_").concat(c)];
|
|
474
|
-
if (!_.isNil(dvItem) && dvItem.prohibitInput && !validateCellData(ctx, dvItem, inputText)) {
|
|
475
|
-
var failureText = getFailureText(ctx, dvItem);
|
|
476
|
-
cancelNormalSelected(ctx);
|
|
477
|
-
ctx.warnDialog = failureText;
|
|
478
|
-
return;
|
|
479
|
-
}
|
|
480
|
-
}
|
|
481
|
-
var curv = flowdata[r][c];
|
|
482
|
-
var oldValue = _.cloneDeep(curv);
|
|
483
|
-
var isPrevInline = isInlineStringCell(curv);
|
|
484
|
-
var isCurInline = (inputText === null || inputText === void 0 ? void 0 : inputText.slice(0, 1)) !== "=" && (inputHtml === null || inputHtml === void 0 ? void 0 : inputHtml.substring(0, 5)) === "<span";
|
|
485
|
-
var isCopyVal = false;
|
|
486
|
-
if (!isCurInline && inputText && inputText.length > 0) {
|
|
487
|
-
var splitArr = inputText.replace(/\r\n/g, "_x000D_").replace(/ /g, "_x000D_").replace(/\r/g, "_x000D_").replace(/\n/g, "_x000D_").split("_x000D_");
|
|
488
|
-
if (splitArr.length > 1 && inputHtml !== "<br>") {
|
|
489
|
-
isCopyVal = true;
|
|
490
|
-
isCurInline = true;
|
|
491
|
-
inputText = splitArr.join("\r\n");
|
|
492
|
-
}
|
|
493
|
-
}
|
|
494
|
-
if ((curv === null || curv === void 0 ? void 0 : curv.ct) && !value && !isCurInline && isPrevInline) {
|
|
495
|
-
delete curv.ct.s;
|
|
496
|
-
curv.ct.t = "g";
|
|
497
|
-
curv.ct.fa = "General";
|
|
498
|
-
curv.tb = "1";
|
|
499
|
-
value = "";
|
|
500
|
-
} else if (isCurInline) {
|
|
501
|
-
if (!_.isPlainObject(curv)) {
|
|
502
|
-
curv = {};
|
|
503
|
-
}
|
|
504
|
-
curv || (curv = {});
|
|
505
|
-
var fontSize = curv.fs || 10;
|
|
506
|
-
if (!curv.ct) {
|
|
507
|
-
curv.ct = {};
|
|
508
|
-
curv.ct.fa = "General";
|
|
509
|
-
curv.tb = "1";
|
|
510
|
-
}
|
|
511
|
-
curv.ct.t = "inlineStr";
|
|
512
|
-
curv.ct.s = convertSpanToShareString($input.querySelectorAll("span"), curv);
|
|
513
|
-
delete curv.fs;
|
|
514
|
-
delete curv.f;
|
|
515
|
-
delete curv.v;
|
|
516
|
-
delete curv.m;
|
|
517
|
-
curv.fs = fontSize;
|
|
518
|
-
if (isCopyVal) {
|
|
519
|
-
curv.ct.s = [{
|
|
520
|
-
v: inputText,
|
|
521
|
-
fs: fontSize
|
|
522
|
-
}];
|
|
523
|
-
}
|
|
524
|
-
}
|
|
525
|
-
value = value || ($input === null || $input === void 0 ? void 0 : $input.innerText);
|
|
526
|
-
if (((_b = (_a = ctx.hooks).beforeUpdateCell) === null || _b === void 0 ? void 0 : _b.call(_a, r, c, value)) === false) {
|
|
527
|
-
cancelNormalSelected(ctx);
|
|
528
|
-
return;
|
|
529
|
-
}
|
|
530
|
-
if (!isCurInline) {
|
|
531
|
-
if (isRealNull(value) && !isPrevInline) {
|
|
532
|
-
if (!curv || isRealNull(curv.v) && !curv.spl && !curv.f) {
|
|
533
|
-
cancelNormalSelected(ctx);
|
|
534
|
-
return;
|
|
535
|
-
}
|
|
536
|
-
} else if (curv && curv.qp !== 1) {
|
|
537
|
-
if (_.isPlainObject(curv) && (value === curv.f || value === curv.v || value === curv.m)) {
|
|
538
|
-
cancelNormalSelected(ctx);
|
|
539
|
-
return;
|
|
540
|
-
}
|
|
541
|
-
if (value === curv) {
|
|
542
|
-
cancelNormalSelected(ctx);
|
|
543
|
-
return;
|
|
544
|
-
}
|
|
545
|
-
}
|
|
546
|
-
if (_.isString(value) && value.slice(0, 1) === "=" && value.length > 1) {} else if (_.isPlainObject(curv) && curv && curv.ct && curv.ct.fa && curv.ct.fa !== "@" && !isRealNull(value)) {
|
|
547
|
-
delete curv.m;
|
|
548
|
-
if (curv.f) {
|
|
549
|
-
delete curv.f;
|
|
550
|
-
delete curv.spl;
|
|
551
|
-
}
|
|
552
|
-
}
|
|
553
|
-
}
|
|
554
|
-
var isRunExecFunction = true;
|
|
555
|
-
var d = flowdata;
|
|
556
|
-
var dynamicArrayItem = null;
|
|
557
|
-
if (_.isPlainObject(curv)) {
|
|
558
|
-
if (!isCurInline) {
|
|
559
|
-
if (_.isString(value) && value.slice(0, 1) === "=" && value.length > 1) {
|
|
560
|
-
var v = execfunction(ctx, value, r, c, undefined, undefined, true);
|
|
561
|
-
isRunExecFunction = false;
|
|
562
|
-
curv = _.cloneDeep(((_c = d === null || d === void 0 ? void 0 : d[r]) === null || _c === void 0 ? void 0 : _c[c]) || {});
|
|
563
|
-
curv.v = v[1], curv.f = v[2];
|
|
564
|
-
if (v.length === 4 && v[3].type === "sparklines") {
|
|
565
|
-
delete curv.m;
|
|
566
|
-
delete curv.v;
|
|
567
|
-
var curCalv = v[3].data;
|
|
568
|
-
if (_.isArray(curCalv) && !_.isPlainObject(curCalv[0])) {
|
|
569
|
-
curv.v = curCalv[0];
|
|
570
|
-
} else {
|
|
571
|
-
curv.spl = v[3].data;
|
|
572
|
-
}
|
|
573
|
-
} else if (v.length === 4 && v[3].type === "dynamicArrayItem") {
|
|
574
|
-
dynamicArrayItem = v[3].data;
|
|
575
|
-
}
|
|
576
|
-
} else if (_.isPlainObject(value)) {
|
|
577
|
-
var valueFunction = value.f;
|
|
578
|
-
if (_.isString(valueFunction) && valueFunction.slice(0, 1) === "=" && valueFunction.length > 1) {
|
|
579
|
-
var v = execfunction(ctx, valueFunction, r, c, undefined, undefined, true);
|
|
580
|
-
isRunExecFunction = false;
|
|
581
|
-
curv = _.cloneDeep(((_d = d === null || d === void 0 ? void 0 : d[r]) === null || _d === void 0 ? void 0 : _d[c]) || {});
|
|
582
|
-
curv.v = v[1], curv.f = v[2];
|
|
583
|
-
if (v.length === 4 && v[3].type === "sparklines") {
|
|
584
|
-
delete curv.m;
|
|
585
|
-
delete curv.v;
|
|
586
|
-
var curCalv = v[3].data;
|
|
587
|
-
if (_.isArray(curCalv) && !_.isPlainObject(curCalv[0])) {
|
|
588
|
-
curv.v = curCalv[0];
|
|
589
|
-
} else {
|
|
590
|
-
curv.spl = v[3].data;
|
|
591
|
-
}
|
|
592
|
-
} else if (v.length === 4 && v[3].type === "dynamicArrayItem") {
|
|
593
|
-
dynamicArrayItem = v[3].data;
|
|
594
|
-
}
|
|
595
|
-
} else {
|
|
596
|
-
Object.keys(value).forEach(function (attr) {
|
|
597
|
-
curv[attr] = value[attr];
|
|
598
|
-
});
|
|
599
|
-
}
|
|
600
|
-
} else {
|
|
601
|
-
delFunctionGroup(ctx, r, c);
|
|
602
|
-
execFunctionGroup(ctx, r, c, value);
|
|
603
|
-
isRunExecFunction = false;
|
|
604
|
-
curv = _.cloneDeep(((_e = d === null || d === void 0 ? void 0 : d[r]) === null || _e === void 0 ? void 0 : _e[c]) || {});
|
|
605
|
-
curv.v = value;
|
|
606
|
-
delete curv.f;
|
|
607
|
-
delete curv.spl;
|
|
608
|
-
if (curv.qp === 1 && "".concat(value).substring(0, 1) !== "'") {
|
|
609
|
-
curv.qp = 0;
|
|
610
|
-
if (curv.ct) {
|
|
611
|
-
curv.ct.fa = "General";
|
|
612
|
-
curv.ct.t = "n";
|
|
613
|
-
}
|
|
614
|
-
}
|
|
615
|
-
}
|
|
616
|
-
}
|
|
617
|
-
value = curv;
|
|
618
|
-
} else {
|
|
619
|
-
if (_.isString(value) && value.slice(0, 1) === "=" && value.length > 1) {
|
|
620
|
-
var v = execfunction(ctx, value, r, c, undefined, undefined, true);
|
|
621
|
-
isRunExecFunction = false;
|
|
622
|
-
value = {
|
|
623
|
-
v: v[1],
|
|
624
|
-
f: v[2]
|
|
625
|
-
};
|
|
626
|
-
if (v.length === 4 && v[3].type === "sparklines") {
|
|
627
|
-
var curCalv = v[3].data;
|
|
628
|
-
if (_.isArray(curCalv) && !_.isPlainObject(curCalv[0])) {
|
|
629
|
-
value.v = curCalv[0];
|
|
630
|
-
} else {
|
|
631
|
-
value.spl = v[3].data;
|
|
632
|
-
}
|
|
633
|
-
} else if (v.length === 4 && v[3].type === "dynamicArrayItem") {
|
|
634
|
-
dynamicArrayItem = v[3].data;
|
|
635
|
-
}
|
|
636
|
-
} else if (_.isPlainObject(value)) {
|
|
637
|
-
var valueFunction = value.f;
|
|
638
|
-
if (_.isString(valueFunction) && valueFunction.slice(0, 1) === "=" && valueFunction.length > 1) {
|
|
639
|
-
var v = execfunction(ctx, valueFunction, r, c, undefined, undefined, true);
|
|
640
|
-
isRunExecFunction = false;
|
|
641
|
-
value.v = v[1], value.f = v[2];
|
|
642
|
-
if (v.length === 4 && v[3].type === "sparklines") {
|
|
643
|
-
var curCalv = v[3].data;
|
|
644
|
-
if (_.isArray(curCalv) && !_.isPlainObject(curCalv[0])) {
|
|
645
|
-
value.v = curCalv[0];
|
|
646
|
-
} else {
|
|
647
|
-
value.spl = v[3].data;
|
|
648
|
-
}
|
|
649
|
-
} else if (v.length === 4 && v[3].type === "dynamicArrayItem") {
|
|
650
|
-
dynamicArrayItem = v[3].data;
|
|
651
|
-
}
|
|
652
|
-
} else {
|
|
653
|
-
var v = curv;
|
|
654
|
-
if (_.isNil(value.v)) {
|
|
655
|
-
value.v = v;
|
|
656
|
-
}
|
|
657
|
-
}
|
|
658
|
-
} else {
|
|
659
|
-
delFunctionGroup(ctx, r, c);
|
|
660
|
-
execFunctionGroup(ctx, r, c, value);
|
|
661
|
-
isRunExecFunction = false;
|
|
662
|
-
}
|
|
663
|
-
}
|
|
664
|
-
setCellValue(ctx, r, c, d, value);
|
|
665
|
-
cancelNormalSelected(ctx);
|
|
666
|
-
if ((curv === null || curv === void 0 ? void 0 : curv.tb) === "2" && curv.v || isInlineStringCell(d[r][c])) {
|
|
667
|
-
var defaultrowlen = ctx.defaultrowlen;
|
|
668
|
-
var cfg = ctx.luckysheetfile[getSheetIndex(ctx, ctx.currentSheetId)].config || {};
|
|
669
|
-
if (!(((_f = cfg.columnlen) === null || _f === void 0 ? void 0 : _f[c]) && ((_g = cfg.rowlen) === null || _g === void 0 ? void 0 : _g[r]))) {
|
|
670
|
-
var cellWidth = ((_h = cfg.columnlen) === null || _h === void 0 ? void 0 : _h[c]) || ctx.defaultcollen;
|
|
671
|
-
var textInfo = canvas ? getCellTextInfo(d[r][c], canvas, ctx, {
|
|
672
|
-
r: r,
|
|
673
|
-
c: c,
|
|
674
|
-
cellWidth: cellWidth
|
|
675
|
-
}) : null;
|
|
676
|
-
var currentRowLen = defaultrowlen;
|
|
677
|
-
if (textInfo) {
|
|
678
|
-
currentRowLen = textInfo.textHeightAll + 2;
|
|
679
|
-
}
|
|
680
|
-
var previousRowHeight = getRowHeight(ctx, [r])[r];
|
|
681
|
-
if (currentRowLen > defaultrowlen && !((_j = cfg.customHeight) === null || _j === void 0 ? void 0 : _j[r]) && previousRowHeight < currentRowLen) {
|
|
682
|
-
if (_.isNil(cfg.rowlen)) cfg.rowlen = {};
|
|
683
|
-
cfg.rowlen[r] = currentRowLen;
|
|
684
|
-
}
|
|
685
|
-
}
|
|
686
|
-
}
|
|
687
|
-
if (ctx.hooks.afterUpdateCell) {
|
|
688
|
-
var newValue_1 = _.cloneDeep(flowdata[r][c]);
|
|
689
|
-
var afterUpdateCell_1 = ctx.hooks.afterUpdateCell;
|
|
690
|
-
setTimeout(function () {
|
|
691
|
-
afterUpdateCell_1 === null || afterUpdateCell_1 === void 0 ? void 0 : afterUpdateCell_1(r, c, oldValue, newValue_1);
|
|
692
|
-
});
|
|
693
|
-
}
|
|
694
|
-
ctx.formulaCache.execFunctionGlobalData = null;
|
|
695
|
-
}
|
|
696
|
-
export function getOrigincell(ctx, r, c, i) {
|
|
697
|
-
var data = getFlowdata(ctx, i);
|
|
698
|
-
if (_.isNil(r) || _.isNil(c)) {
|
|
699
|
-
return null;
|
|
700
|
-
}
|
|
701
|
-
if (!data || !data[r] || !data[r][c]) {
|
|
702
|
-
return null;
|
|
703
|
-
}
|
|
704
|
-
return data[r][c];
|
|
705
|
-
}
|
|
706
|
-
export function getcellFormula(ctx, r, c, i, data) {
|
|
707
|
-
var cell;
|
|
708
|
-
if (_.isNil(data)) {
|
|
709
|
-
cell = getOrigincell(ctx, r, c, i);
|
|
710
|
-
} else {
|
|
711
|
-
cell = data[r][c];
|
|
712
|
-
}
|
|
713
|
-
if (_.isNil(cell)) {
|
|
714
|
-
return null;
|
|
715
|
-
}
|
|
716
|
-
return cell.f;
|
|
717
|
-
}
|
|
718
|
-
export function getRange(ctx) {
|
|
719
|
-
var rangeArr = _.cloneDeep(ctx.luckysheet_select_save);
|
|
720
|
-
var result = [];
|
|
721
|
-
if (!rangeArr) return result;
|
|
722
|
-
for (var i = 0; i < rangeArr.length; i += 1) {
|
|
723
|
-
var rangeItem = rangeArr[i];
|
|
724
|
-
var temp = {
|
|
725
|
-
row: rangeItem.row,
|
|
726
|
-
column: rangeItem.column
|
|
727
|
-
};
|
|
728
|
-
result.push(temp);
|
|
729
|
-
}
|
|
730
|
-
return result;
|
|
731
|
-
}
|
|
732
|
-
export function getFlattenedRange(ctx, range) {
|
|
733
|
-
range = range || getRange(ctx);
|
|
734
|
-
var result = [];
|
|
735
|
-
range.forEach(function (ele) {
|
|
736
|
-
var rs = ele.row;
|
|
737
|
-
var cs = ele.column;
|
|
738
|
-
for (var r = rs[0]; r <= rs[1]; r += 1) {
|
|
739
|
-
for (var c = cs[0]; c <= cs[1]; c += 1) {
|
|
740
|
-
result.push({
|
|
741
|
-
r: r,
|
|
742
|
-
c: c
|
|
743
|
-
});
|
|
744
|
-
}
|
|
745
|
-
}
|
|
746
|
-
});
|
|
747
|
-
return result;
|
|
748
|
-
}
|
|
749
|
-
export function getRangetxt(ctx, sheetId, range, currentId) {
|
|
750
|
-
var sheettxt = "";
|
|
751
|
-
if (currentId == null) {
|
|
752
|
-
currentId = ctx.currentSheetId;
|
|
753
|
-
}
|
|
754
|
-
if (sheetId !== currentId) {
|
|
755
|
-
var index = getSheetIndex(ctx, sheetId);
|
|
756
|
-
if (index == null) return "";
|
|
757
|
-
sheettxt = ctx.luckysheetfile[index].name.replace(/'/g, "''");
|
|
758
|
-
if (/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/.test(sheettxt)) {
|
|
759
|
-
sheettxt += "!";
|
|
760
|
-
} else {
|
|
761
|
-
sheettxt = "'".concat(sheettxt, "'!");
|
|
762
|
-
}
|
|
763
|
-
}
|
|
764
|
-
var row0 = range.row[0];
|
|
765
|
-
var row1 = range.row[1];
|
|
766
|
-
var column0 = range.column[0];
|
|
767
|
-
var column1 = range.column[1];
|
|
768
|
-
if (row0 == null && row1 == null) {
|
|
769
|
-
return "".concat(sheettxt + indexToColumnChar(column0), ":").concat(indexToColumnChar(column1));
|
|
770
|
-
}
|
|
771
|
-
if (column0 == null && column1 == null) {
|
|
772
|
-
return "".concat(sheettxt + (row0 + 1), ":").concat(row1 + 1);
|
|
773
|
-
}
|
|
774
|
-
if (column0 === column1 && row0 === row1) {
|
|
775
|
-
return sheettxt + indexToColumnChar(column0) + (row0 + 1);
|
|
776
|
-
}
|
|
777
|
-
return "".concat(sheettxt + indexToColumnChar(column0) + (row0 + 1), ":").concat(indexToColumnChar(column1)).concat(row1 + 1);
|
|
778
|
-
}
|
|
779
|
-
export function getRangeByTxt(ctx, txt) {
|
|
780
|
-
var range = [];
|
|
781
|
-
if (txt.indexOf(",") !== -1) {
|
|
782
|
-
var arr = txt.split(",");
|
|
783
|
-
for (var i = 0; i < arr.length; i += 1) {
|
|
784
|
-
if (iscelldata(arr[i])) {
|
|
785
|
-
range.push(getcellrange(ctx, arr[i]));
|
|
786
|
-
} else {
|
|
787
|
-
range = [];
|
|
788
|
-
break;
|
|
789
|
-
}
|
|
790
|
-
}
|
|
791
|
-
} else {
|
|
792
|
-
if (iscelldata(txt)) {
|
|
793
|
-
range.push(getcellrange(ctx, txt));
|
|
794
|
-
}
|
|
795
|
-
}
|
|
796
|
-
return range;
|
|
797
|
-
}
|
|
798
|
-
export function isAllSelectedCellsInStatus(ctx, attr, status) {
|
|
799
|
-
var _a, _b, _c, _d;
|
|
800
|
-
if (!_.isEmpty(ctx.luckysheetCellUpdate)) {
|
|
801
|
-
var w = window.getSelection();
|
|
802
|
-
if (!w) return false;
|
|
803
|
-
if (w.rangeCount === 0) return false;
|
|
804
|
-
var range = w.getRangeAt(0);
|
|
805
|
-
if (range.collapsed === true) {
|
|
806
|
-
return false;
|
|
807
|
-
}
|
|
808
|
-
var endContainer = range.endContainer;
|
|
809
|
-
var startContainer = range.startContainer;
|
|
810
|
-
var cssField_1 = _.camelCase(attrToCssName[attr]);
|
|
811
|
-
if (startContainer === endContainer) {
|
|
812
|
-
return !_.isEmpty((_a = startContainer.parentElement) === null || _a === void 0 ? void 0 : _a.style[cssField_1]);
|
|
813
|
-
}
|
|
814
|
-
if (((_b = startContainer.parentElement) === null || _b === void 0 ? void 0 : _b.tagName) === "SPAN" && ((_c = endContainer.parentElement) === null || _c === void 0 ? void 0 : _c.tagName) === "SPAN") {
|
|
815
|
-
var startSpan = startContainer.parentNode;
|
|
816
|
-
var endSpan = endContainer.parentNode;
|
|
817
|
-
var allSpans = (_d = startSpan === null || startSpan === void 0 ? void 0 : startSpan.parentNode) === null || _d === void 0 ? void 0 : _d.querySelectorAll("span");
|
|
818
|
-
if (allSpans) {
|
|
819
|
-
var startSpanIndex = _.indexOf(allSpans, startSpan);
|
|
820
|
-
var endSpanIndex = _.indexOf(allSpans, endSpan);
|
|
821
|
-
var rangeSpans = [];
|
|
822
|
-
for (var i = startSpanIndex; i <= endSpanIndex; i += 1) {
|
|
823
|
-
rangeSpans.push(allSpans[i]);
|
|
824
|
-
}
|
|
825
|
-
return _.every(rangeSpans, function (s) {
|
|
826
|
-
return !_.isEmpty(s.style[cssField_1]);
|
|
827
|
-
});
|
|
828
|
-
}
|
|
829
|
-
}
|
|
830
|
-
}
|
|
831
|
-
var cells = getFlattenedRange(ctx);
|
|
832
|
-
var flowdata = getFlowdata(ctx);
|
|
833
|
-
return cells.every(function (_a) {
|
|
834
|
-
var _b;
|
|
835
|
-
var r = _a.r,
|
|
836
|
-
c = _a.c;
|
|
837
|
-
var cell = (_b = flowdata === null || flowdata === void 0 ? void 0 : flowdata[r]) === null || _b === void 0 ? void 0 : _b[c];
|
|
838
|
-
if (_.isNil(cell)) {
|
|
839
|
-
return false;
|
|
840
|
-
}
|
|
841
|
-
return cell[attr] === status;
|
|
842
|
-
});
|
|
843
|
-
}
|
|
844
|
-
export function getFontStyleByCell(cell, checksAF, checksCF, isCheck) {
|
|
845
|
-
if (isCheck === void 0) {
|
|
846
|
-
isCheck = true;
|
|
847
|
-
}
|
|
848
|
-
var style = {};
|
|
849
|
-
if (!cell) {
|
|
850
|
-
return style;
|
|
851
|
-
}
|
|
852
|
-
_.forEach(cell, function (v, key) {
|
|
853
|
-
var _a, _b, _c, _d;
|
|
854
|
-
var value = cell[key];
|
|
855
|
-
if (isCheck) {
|
|
856
|
-
value = normalizedCellAttr(cell, key);
|
|
857
|
-
}
|
|
858
|
-
var valueNum = Number(value);
|
|
859
|
-
if (key === "bl" && valueNum !== 0) {
|
|
860
|
-
style.fontWeight = "bold";
|
|
861
|
-
}
|
|
862
|
-
if (key === "it" && valueNum !== 0) {
|
|
863
|
-
style.fontStyle = "italic";
|
|
864
|
-
}
|
|
865
|
-
if (key === "fs" && valueNum !== 10) {
|
|
866
|
-
style.fontSize = "".concat(valueNum, "pt");
|
|
867
|
-
}
|
|
868
|
-
if (key === "fc" && value !== "#000000" || ((_a = checksAF === null || checksAF === void 0 ? void 0 : checksAF.length) !== null && _a !== void 0 ? _a : 0) > 0 || (checksCF === null || checksCF === void 0 ? void 0 : checksCF.textColor)) {
|
|
869
|
-
if (checksCF === null || checksCF === void 0 ? void 0 : checksCF.textColor) {
|
|
870
|
-
style.color = checksCF.textColor;
|
|
871
|
-
} else if (((_b = checksAF === null || checksAF === void 0 ? void 0 : checksAF.length) !== null && _b !== void 0 ? _b : 0) > 0) {
|
|
872
|
-
style.color = checksAF[0];
|
|
873
|
-
} else {
|
|
874
|
-
style.color = value;
|
|
875
|
-
}
|
|
876
|
-
}
|
|
877
|
-
if (key === "cl" && valueNum !== 0) {
|
|
878
|
-
style.textDecoration = "line-through";
|
|
879
|
-
}
|
|
880
|
-
if (key === "un" && (valueNum === 1 || valueNum === 3)) {
|
|
881
|
-
var color = (_c = cell._color) !== null && _c !== void 0 ? _c : cell.fc;
|
|
882
|
-
var fs = (_d = cell._fontSize) !== null && _d !== void 0 ? _d : cell.fs;
|
|
883
|
-
style.borderBottom = "".concat(Math.floor(fs / 9), "px solid ").concat(color);
|
|
884
|
-
}
|
|
885
|
-
});
|
|
886
|
-
return style;
|
|
887
|
-
}
|
|
888
|
-
export function getStyleByCell(ctx, d, r, c) {
|
|
889
|
-
var _a;
|
|
890
|
-
var style = {};
|
|
891
|
-
var checksAF = [];
|
|
892
|
-
var cf_compute = getComputeMap(ctx);
|
|
893
|
-
var checksCF = checkCF(r, c, cf_compute);
|
|
894
|
-
var cell = (_a = d === null || d === void 0 ? void 0 : d[r]) === null || _a === void 0 ? void 0 : _a[c];
|
|
895
|
-
if (!cell) return {};
|
|
896
|
-
var isInline = isInlineStringCell(cell);
|
|
897
|
-
if ("bg" in cell) {
|
|
898
|
-
var value = normalizedCellAttr(cell, "bg");
|
|
899
|
-
if (checksCF === null || checksCF === void 0 ? void 0 : checksCF.cellColor) {
|
|
900
|
-
if (checksCF === null || checksCF === void 0 ? void 0 : checksCF.cellColor) {
|
|
901
|
-
style.background = "".concat(checksCF.cellColor);
|
|
902
|
-
} else if (checksAF.length > 1) {
|
|
903
|
-
style.background = "".concat(checksAF[1]);
|
|
904
|
-
} else {
|
|
905
|
-
style.background = "".concat(value);
|
|
906
|
-
}
|
|
907
|
-
}
|
|
908
|
-
}
|
|
909
|
-
if ("ht" in cell) {
|
|
910
|
-
var value = normalizedCellAttr(cell, "ht");
|
|
911
|
-
if (Number(value) === 0) {
|
|
912
|
-
style.textAlign = "center";
|
|
913
|
-
} else if (Number(value) === 2) {
|
|
914
|
-
style.textAlign = "right";
|
|
915
|
-
}
|
|
916
|
-
}
|
|
917
|
-
if ("vt" in cell) {
|
|
918
|
-
var value = normalizedCellAttr(cell, "vt");
|
|
919
|
-
if (Number(value) === 0) {
|
|
920
|
-
style.alignItems = "center";
|
|
921
|
-
} else if (Number(value) === 2) {
|
|
922
|
-
style.alignItems = "flex-end";
|
|
923
|
-
}
|
|
924
|
-
}
|
|
925
|
-
if (!isInline) {
|
|
926
|
-
style = _.assign(style, getFontStyleByCell(cell, checksAF, checksCF));
|
|
927
|
-
}
|
|
928
|
-
return style;
|
|
929
|
-
}
|
|
930
|
-
export function getInlineStringHTML(r, c, data) {
|
|
931
|
-
var ct = getCellValue(r, c, data, "ct");
|
|
932
|
-
if (isInlineStringCT(ct)) {
|
|
933
|
-
var strings = ct.s;
|
|
934
|
-
var value = "";
|
|
935
|
-
for (var i = 0; i < strings.length; i += 1) {
|
|
936
|
-
var strObj = strings[i];
|
|
937
|
-
if (strObj.v) {
|
|
938
|
-
var style = getFontStyleByCell(strObj);
|
|
939
|
-
var styleStr = _.map(style, function (v, key) {
|
|
940
|
-
return "".concat(_.kebabCase(key), ":").concat(_.isNumber(v) ? "".concat(v, "px") : v, ";");
|
|
941
|
-
}).join("");
|
|
942
|
-
value += "<span class=\"luckysheet-input-span\" index='".concat(i, "' style='").concat(styleStr, "'>").concat(strObj.v, "</span>");
|
|
943
|
-
}
|
|
944
|
-
}
|
|
945
|
-
return value;
|
|
946
|
-
}
|
|
947
|
-
return "";
|
|
948
|
-
}
|
|
949
|
-
export function getQKBorder(width, type, color) {
|
|
950
|
-
var bordertype = "";
|
|
951
|
-
if (width.toString().indexOf("pt") > -1) {
|
|
952
|
-
var nWidth = parseFloat(width);
|
|
953
|
-
if (nWidth < 1) {} else if (nWidth < 1.5) {
|
|
954
|
-
bordertype = "Medium";
|
|
955
|
-
} else {
|
|
956
|
-
bordertype = "Thick";
|
|
957
|
-
}
|
|
958
|
-
} else {
|
|
959
|
-
var nWidth = parseFloat(width);
|
|
960
|
-
if (nWidth < 2) {} else if (nWidth < 3) {
|
|
961
|
-
bordertype = "Medium";
|
|
962
|
-
} else {
|
|
963
|
-
bordertype = "Thick";
|
|
964
|
-
}
|
|
965
|
-
}
|
|
966
|
-
var style = 0;
|
|
967
|
-
type = type.toLowerCase();
|
|
968
|
-
if (type === "double") {
|
|
969
|
-
style = 2;
|
|
970
|
-
} else if (type === "dotted") {
|
|
971
|
-
if (bordertype === "Medium" || bordertype === "Thick") {
|
|
972
|
-
style = 3;
|
|
973
|
-
} else {
|
|
974
|
-
style = 10;
|
|
975
|
-
}
|
|
976
|
-
} else if (type === "dashed") {
|
|
977
|
-
if (bordertype === "Medium" || bordertype === "Thick") {
|
|
978
|
-
style = 4;
|
|
979
|
-
} else {
|
|
980
|
-
style = 9;
|
|
981
|
-
}
|
|
982
|
-
} else if (type === "solid") {
|
|
983
|
-
if (bordertype === "Medium") {
|
|
984
|
-
style = 8;
|
|
985
|
-
} else if (bordertype === "Thick") {
|
|
986
|
-
style = 13;
|
|
987
|
-
} else {
|
|
988
|
-
style = 1;
|
|
989
|
-
}
|
|
990
|
-
}
|
|
991
|
-
return [style, color];
|
|
992
|
-
}
|
|
993
|
-
export function getdatabyselection(ctx, range, sheetId) {
|
|
994
|
-
if (range == null && ctx.luckysheet_select_save) {
|
|
995
|
-
range = ctx.luckysheet_select_save[0];
|
|
996
|
-
}
|
|
997
|
-
if (!range) return [];
|
|
998
|
-
if (range.row == null || range.row.length === 0) {
|
|
999
|
-
return [];
|
|
1000
|
-
}
|
|
1001
|
-
var d;
|
|
1002
|
-
var cfg;
|
|
1003
|
-
if (sheetId != null && sheetId !== ctx.currentSheetId) {
|
|
1004
|
-
d = ctx.luckysheetfile[getSheetIndex(ctx, sheetId)].data;
|
|
1005
|
-
cfg = ctx.luckysheetfile[getSheetIndex(ctx, sheetId)].config;
|
|
1006
|
-
} else {
|
|
1007
|
-
d = getFlowdata(ctx);
|
|
1008
|
-
cfg = ctx.config;
|
|
1009
|
-
}
|
|
1010
|
-
var data = [];
|
|
1011
|
-
for (var r = range.row[0]; r <= range.row[1]; r += 1) {
|
|
1012
|
-
if ((d === null || d === void 0 ? void 0 : d[r]) == null) {
|
|
1013
|
-
continue;
|
|
1014
|
-
}
|
|
1015
|
-
if ((cfg === null || cfg === void 0 ? void 0 : cfg.rowhidden) != null && cfg.rowhidden[r] != null) {
|
|
1016
|
-
continue;
|
|
1017
|
-
}
|
|
1018
|
-
var row = [];
|
|
1019
|
-
for (var c = range.column[0]; c <= range.column[1]; c += 1) {
|
|
1020
|
-
if ((cfg === null || cfg === void 0 ? void 0 : cfg.colhidden) != null && cfg.colhidden[c] != null) {
|
|
1021
|
-
continue;
|
|
1022
|
-
}
|
|
1023
|
-
row.push(d[r][c]);
|
|
1024
|
-
}
|
|
1025
|
-
data.push(row);
|
|
1026
|
-
}
|
|
1027
|
-
return data;
|
|
1028
|
-
}
|
|
1029
|
-
export function luckysheetUpdateCell(ctx, row_index, col_index) {
|
|
1030
|
-
ctx.luckysheetCellUpdate = [row_index, col_index];
|
|
1031
|
-
}
|
|
1032
|
-
export function getDataBySelectionNoCopy(ctx, range) {
|
|
1033
|
-
if (!range || !range.row || range.row.length === 0) return [];
|
|
1034
|
-
var data = [];
|
|
1035
|
-
var flowData = getFlowdata(ctx);
|
|
1036
|
-
if (!flowData) return [];
|
|
1037
|
-
for (var r = range.row[0]; r <= range.row[1]; r += 1) {
|
|
1038
|
-
var row = [];
|
|
1039
|
-
if (ctx.config.rowhidden != null && ctx.config.rowhidden[r] != null) {
|
|
1040
|
-
continue;
|
|
1041
|
-
}
|
|
1042
|
-
for (var c = range.column[0]; c <= range.column[1]; c += 1) {
|
|
1043
|
-
var value = null;
|
|
1044
|
-
if (ctx.config.colhidden != null && ctx.config.colhidden[c] != null) {
|
|
1045
|
-
continue;
|
|
1046
|
-
}
|
|
1047
|
-
if (flowData[r] != null && flowData[r][c] != null) {
|
|
1048
|
-
value = flowData[r][c];
|
|
1049
|
-
}
|
|
1050
|
-
row.push(value);
|
|
1051
|
-
}
|
|
1052
|
-
data.push(row);
|
|
1053
|
-
}
|
|
1054
|
-
return data;
|
|
1055
|
-
}
|