@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/validation.js
DELETED
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
import dayjs from "dayjs";
|
|
2
|
-
import _ from "lodash";
|
|
3
|
-
import { hasChinaword } from "./text";
|
|
4
|
-
export var error = {
|
|
5
|
-
v: "#VALUE!",
|
|
6
|
-
n: "#NAME?",
|
|
7
|
-
na: "#N/A",
|
|
8
|
-
r: "#REF!",
|
|
9
|
-
d: "#DIV/0!",
|
|
10
|
-
nm: "#NUM!",
|
|
11
|
-
nl: "#NULL!",
|
|
12
|
-
sp: "#SPILL!"
|
|
13
|
-
};
|
|
14
|
-
var errorValues = Object.values(error);
|
|
15
|
-
export function valueIsError(value) {
|
|
16
|
-
return errorValues.includes(value);
|
|
17
|
-
}
|
|
18
|
-
export function isRealNull(val) {
|
|
19
|
-
return _.isNil(val) || val.toString().replace(/\s/g, "") === "";
|
|
20
|
-
}
|
|
21
|
-
export function isRealNum(val) {
|
|
22
|
-
if (_.isNil(val) || val.toString().replace(/\s/g, "") === "") {
|
|
23
|
-
return false;
|
|
24
|
-
}
|
|
25
|
-
if (typeof val === "boolean") {
|
|
26
|
-
return false;
|
|
27
|
-
}
|
|
28
|
-
return !Number.isNaN(Number(val));
|
|
29
|
-
}
|
|
30
|
-
function checkDateTime(str) {
|
|
31
|
-
var reg1 = /^(\d{4})-(\d{1,2})-(\d{1,2})(\s(\d{1,2}):(\d{1,2})(:(\d{1,2}))?)?$/;
|
|
32
|
-
var reg2 = /^(\d{4})\/(\d{1,2})\/(\d{1,2})(\s(\d{1,2}):(\d{1,2})(:(\d{1,2}))?)?$/;
|
|
33
|
-
if (!reg1.test(str) && !reg2.test(str)) {
|
|
34
|
-
return false;
|
|
35
|
-
}
|
|
36
|
-
var year = Number(RegExp.$1);
|
|
37
|
-
var month = Number(RegExp.$2);
|
|
38
|
-
var day = Number(RegExp.$3);
|
|
39
|
-
if (year < 1900) {
|
|
40
|
-
return false;
|
|
41
|
-
}
|
|
42
|
-
if (month > 12) {
|
|
43
|
-
return false;
|
|
44
|
-
}
|
|
45
|
-
if (day > 31) {
|
|
46
|
-
return false;
|
|
47
|
-
}
|
|
48
|
-
if (month === 2) {
|
|
49
|
-
if (new Date(year, 1, 29).getDate() === 29 && day > 29) {
|
|
50
|
-
return false;
|
|
51
|
-
}
|
|
52
|
-
if (new Date(year, 1, 29).getDate() !== 29 && day > 28) {
|
|
53
|
-
return false;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
return true;
|
|
57
|
-
}
|
|
58
|
-
export function isdatetime(s) {
|
|
59
|
-
if (s === null || s.toString().length < 5) {
|
|
60
|
-
return false;
|
|
61
|
-
}
|
|
62
|
-
if (checkDateTime(s)) {
|
|
63
|
-
return true;
|
|
64
|
-
}
|
|
65
|
-
return false;
|
|
66
|
-
}
|
|
67
|
-
export function diff(now, then) {
|
|
68
|
-
return dayjs(now).diff(dayjs(then));
|
|
69
|
-
}
|
|
70
|
-
export function isdatatypemulti(s) {
|
|
71
|
-
var type = {};
|
|
72
|
-
if (isdatetime(s)) {
|
|
73
|
-
type.date = true;
|
|
74
|
-
}
|
|
75
|
-
if (!Number.isNaN(parseFloat(s)) && !hasChinaword(s)) {
|
|
76
|
-
type.num = true;
|
|
77
|
-
}
|
|
78
|
-
return type;
|
|
79
|
-
}
|
|
80
|
-
export function isdatatype(s) {
|
|
81
|
-
var type = "string";
|
|
82
|
-
if (isdatetime(s)) {
|
|
83
|
-
type = "date";
|
|
84
|
-
} else if (!Number.isNaN(parseFloat(s)) && !hasChinaword(s)) {
|
|
85
|
-
type = "num";
|
|
86
|
-
}
|
|
87
|
-
return type;
|
|
88
|
-
}
|
|
89
|
-
export function hasPartMC(ctx, cfg, r1, r2, c1, c2) {
|
|
90
|
-
var ret = false;
|
|
91
|
-
_.forEach(ctx.config.merge, function (mc) {
|
|
92
|
-
if (r1 < mc.r) {
|
|
93
|
-
if (r2 >= mc.r && r2 < mc.r + mc.rs - 1) {
|
|
94
|
-
if (c1 >= mc.c && c1 <= mc.c + mc.cs - 1) {
|
|
95
|
-
ret = true;
|
|
96
|
-
return false;
|
|
97
|
-
}
|
|
98
|
-
if (c2 >= mc.c && c2 <= mc.c + mc.cs - 1) {
|
|
99
|
-
ret = true;
|
|
100
|
-
return false;
|
|
101
|
-
}
|
|
102
|
-
if (c1 < mc.c && c2 > mc.c + mc.cs - 1) {
|
|
103
|
-
ret = true;
|
|
104
|
-
return false;
|
|
105
|
-
}
|
|
106
|
-
} else if (r2 >= mc.r && r2 === mc.r + mc.rs - 1) {
|
|
107
|
-
if (c1 > mc.c && c1 < mc.c + mc.cs - 1) {
|
|
108
|
-
ret = true;
|
|
109
|
-
return false;
|
|
110
|
-
}
|
|
111
|
-
if (c2 > mc.c && c2 < mc.c + mc.cs - 1) {
|
|
112
|
-
ret = true;
|
|
113
|
-
return false;
|
|
114
|
-
}
|
|
115
|
-
if (c1 === mc.c && c2 < mc.c + mc.cs - 1) {
|
|
116
|
-
ret = true;
|
|
117
|
-
return false;
|
|
118
|
-
}
|
|
119
|
-
if (c1 > mc.c && c2 === mc.c + mc.cs - 1) {
|
|
120
|
-
ret = true;
|
|
121
|
-
return false;
|
|
122
|
-
}
|
|
123
|
-
} else if (r2 > mc.r + mc.rs - 1) {
|
|
124
|
-
if (c1 > mc.c && c1 <= mc.c + mc.cs - 1) {
|
|
125
|
-
ret = true;
|
|
126
|
-
return false;
|
|
127
|
-
}
|
|
128
|
-
if (c2 >= mc.c && c2 < mc.c + mc.cs - 1) {
|
|
129
|
-
ret = true;
|
|
130
|
-
return false;
|
|
131
|
-
}
|
|
132
|
-
if (c1 === mc.c && c2 < mc.c + mc.cs - 1) {
|
|
133
|
-
ret = true;
|
|
134
|
-
return false;
|
|
135
|
-
}
|
|
136
|
-
if (c1 > mc.c && c2 === mc.c + mc.cs - 1) {
|
|
137
|
-
ret = true;
|
|
138
|
-
return false;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
} else if (r1 === mc.r) {
|
|
142
|
-
if (r2 < mc.r + mc.rs - 1) {
|
|
143
|
-
if (c1 >= mc.c && c1 <= mc.c + mc.cs - 1) {
|
|
144
|
-
ret = true;
|
|
145
|
-
return false;
|
|
146
|
-
}
|
|
147
|
-
if (c2 >= mc.c && c2 <= mc.c + mc.cs - 1) {
|
|
148
|
-
ret = true;
|
|
149
|
-
return false;
|
|
150
|
-
}
|
|
151
|
-
if (c1 < mc.c && c2 > mc.c + mc.cs - 1) {
|
|
152
|
-
ret = true;
|
|
153
|
-
return false;
|
|
154
|
-
}
|
|
155
|
-
} else if (r2 >= mc.r + mc.rs - 1) {
|
|
156
|
-
if (c1 > mc.c && c1 <= mc.c + mc.cs - 1) {
|
|
157
|
-
ret = true;
|
|
158
|
-
return false;
|
|
159
|
-
}
|
|
160
|
-
if (c2 >= mc.c && c2 < mc.c + mc.cs - 1) {
|
|
161
|
-
ret = true;
|
|
162
|
-
return false;
|
|
163
|
-
}
|
|
164
|
-
if (c1 === mc.c && c2 < mc.c + mc.cs - 1) {
|
|
165
|
-
ret = true;
|
|
166
|
-
return false;
|
|
167
|
-
}
|
|
168
|
-
if (c1 > mc.c && c2 === mc.c + mc.cs - 1) {
|
|
169
|
-
ret = true;
|
|
170
|
-
return false;
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
} else if (r1 <= mc.r + mc.rs - 1) {
|
|
174
|
-
if (c1 >= mc.c && c1 <= mc.c + mc.cs - 1) {
|
|
175
|
-
ret = true;
|
|
176
|
-
return false;
|
|
177
|
-
}
|
|
178
|
-
if (c2 >= mc.c && c2 <= mc.c + mc.cs - 1) {
|
|
179
|
-
ret = true;
|
|
180
|
-
return false;
|
|
181
|
-
}
|
|
182
|
-
if (c1 < mc.c && c2 > mc.c + mc.cs - 1) {
|
|
183
|
-
ret = true;
|
|
184
|
-
return false;
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
return true;
|
|
188
|
-
});
|
|
189
|
-
return ret;
|
|
190
|
-
}
|
package/es/modules/zoom.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
var ZOOM_STEP = 0.1;
|
|
2
|
-
export var MAX_ZOOM_RATIO = 4;
|
|
3
|
-
export var MIN_ZOOM_RATIO = 0.1;
|
|
4
|
-
export function handleKeydownForZoom(ev, currentZoom) {
|
|
5
|
-
if (!ev.ctrlKey) {
|
|
6
|
-
return currentZoom;
|
|
7
|
-
}
|
|
8
|
-
var handled = false;
|
|
9
|
-
var zoom = currentZoom || 1;
|
|
10
|
-
if (ev.key === "-" || ev.which === 189) {
|
|
11
|
-
zoom -= ZOOM_STEP;
|
|
12
|
-
handled = true;
|
|
13
|
-
} else if (ev.key === "+" || ev.which === 187) {
|
|
14
|
-
zoom += ZOOM_STEP;
|
|
15
|
-
handled = true;
|
|
16
|
-
} else if (ev.key === "0" || ev.which === 48) {
|
|
17
|
-
zoom = 1;
|
|
18
|
-
handled = true;
|
|
19
|
-
}
|
|
20
|
-
if (handled) {
|
|
21
|
-
ev.preventDefault();
|
|
22
|
-
if (zoom >= MAX_ZOOM_RATIO) {
|
|
23
|
-
zoom = MAX_ZOOM_RATIO;
|
|
24
|
-
} else if (zoom < MIN_ZOOM_RATIO) {
|
|
25
|
-
zoom = MIN_ZOOM_RATIO;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
return parseFloat(zoom.toFixed(1));
|
|
29
|
-
}
|
package/es/settings.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { v4 as uuidv4 } from "uuid";
|
|
2
|
-
export var defaultSettings = {
|
|
3
|
-
column: 60,
|
|
4
|
-
row: 84,
|
|
5
|
-
addRows: 50,
|
|
6
|
-
showToolbar: true,
|
|
7
|
-
showFormulaBar: true,
|
|
8
|
-
showSheetTabs: true,
|
|
9
|
-
data: [],
|
|
10
|
-
config: {},
|
|
11
|
-
devicePixelRatio: 0,
|
|
12
|
-
allowEdit: true,
|
|
13
|
-
lang: null,
|
|
14
|
-
forceCalculation: false,
|
|
15
|
-
rowHeaderWidth: 46,
|
|
16
|
-
columnHeaderHeight: 20,
|
|
17
|
-
defaultColWidth: 73,
|
|
18
|
-
defaultRowHeight: 19,
|
|
19
|
-
defaultFontSize: 10,
|
|
20
|
-
toolbarItems: ["undo", "redo", "format-painter", "clear-format", "|", "currency-format", "percentage-format", "number-decrease", "number-increase", "format", "|", "font", "|", "font-size", "|", "bold", "italic", "strike-through", "underline", "|", "font-color", "background", "border", "merge-cell", "|", "horizontal-align", "vertical-align", "text-wrap", "text-rotation", "|", "freeze", "conditionFormat", "filter", "link", "image", "comment", "quick-formula", "dataVerification", "splitColumn", "locationCondition", "screenshot", "search"],
|
|
21
|
-
cellContextMenu: ["split-text", "cut", "copy", "paste", "clear", "|", "insert-row", "insert-column", "cell-delete-row", "cell-delete-column", "delete-cell", "hide-row", "hide-column", "set-row-height", "set-column-width", "|", "conditionFormat", "sort", "ascSort", "desSort", "orderAZ", "orderZA", "filter", "searchReplace", "dataVerification", "|", "chart", "link", "data", "cell-format", "comment"],
|
|
22
|
-
headerContextMenu: ["copy", "paste", "|", "insert-row", "insert-column", "delete-row", "delete-column", "delete-cell", "hide-row", "hide-column", "set-row-height", "set-column-width", "|", "split-text", "clear", "sort", "orderAZ", "orderZA"],
|
|
23
|
-
sheetTabContextMenu: ["delete", "copy", "rename", "color", "hide", "|", "move"],
|
|
24
|
-
filterContextMenu: ["sort-by-asc", "sort-by-desc", "filter-by-value"],
|
|
25
|
-
generateSheetId: function generateSheetId() {
|
|
26
|
-
return uuidv4();
|
|
27
|
-
},
|
|
28
|
-
hooks: {},
|
|
29
|
-
customToolbarItems: [],
|
|
30
|
-
currency: "$",
|
|
31
|
-
getCommentCellUI: null,
|
|
32
|
-
onDuneChartEmbed: function onDuneChartEmbed() {},
|
|
33
|
-
onSheetCountChange: function onSheetCountChange() {},
|
|
34
|
-
isAuthorized: false,
|
|
35
|
-
isFlvReadOnly: false
|
|
36
|
-
};
|
package/es/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/es/utils/freeze.js
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { getSheetIndex } from ".";
|
|
2
|
-
export var getFreezeState = function getFreezeState(ctx) {
|
|
3
|
-
var _a, _b, _c, _d;
|
|
4
|
-
var sheetIndex = getSheetIndex(ctx, ctx.currentSheetId);
|
|
5
|
-
if (sheetIndex == null) return {
|
|
6
|
-
isRowFrozen: false,
|
|
7
|
-
isColFrozen: false
|
|
8
|
-
};
|
|
9
|
-
var frozen = (_a = ctx.luckysheetfile[sheetIndex]) === null || _a === void 0 ? void 0 : _a.frozen;
|
|
10
|
-
var selection = (_b = ctx.luckysheet_select_save) === null || _b === void 0 ? void 0 : _b[0];
|
|
11
|
-
if (!selection) return {
|
|
12
|
-
isRowFrozen: false,
|
|
13
|
-
isColFrozen: false
|
|
14
|
-
};
|
|
15
|
-
var frozenRow = (_c = frozen === null || frozen === void 0 ? void 0 : frozen.range) === null || _c === void 0 ? void 0 : _c.row_focus;
|
|
16
|
-
var frozenCol = (_d = frozen === null || frozen === void 0 ? void 0 : frozen.range) === null || _d === void 0 ? void 0 : _d.column_focus;
|
|
17
|
-
var isRowFrozen = typeof frozenRow === "number" && frozenRow === selection.row_focus;
|
|
18
|
-
var isColFrozen = typeof frozenCol === "number" && frozenCol === selection.column_focus;
|
|
19
|
-
return {
|
|
20
|
-
isRowFrozen: isRowFrozen,
|
|
21
|
-
isColFrozen: isColFrozen
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
export var toggleFreeze = function toggleFreeze(ctx, type) {
|
|
25
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
26
|
-
var selection = (_a = ctx.luckysheet_select_save) === null || _a === void 0 ? void 0 : _a[0];
|
|
27
|
-
if (!selection) return;
|
|
28
|
-
var sheetIndex = getSheetIndex(ctx, ctx.currentSheetId);
|
|
29
|
-
var sheet = ctx.luckysheetfile[sheetIndex];
|
|
30
|
-
var frozen = (_b = sheet.frozen) !== null && _b !== void 0 ? _b : {
|
|
31
|
-
range: {
|
|
32
|
-
row_focus: -1,
|
|
33
|
-
column_focus: -1
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
var _h = (_c = frozen.range) !== null && _c !== void 0 ? _c : {
|
|
37
|
-
row_focus: -1,
|
|
38
|
-
column_focus: -1
|
|
39
|
-
},
|
|
40
|
-
row_focus = _h.row_focus,
|
|
41
|
-
column_focus = _h.column_focus;
|
|
42
|
-
switch (type) {
|
|
43
|
-
case "row":
|
|
44
|
-
row_focus = (_d = selection.row_focus) !== null && _d !== void 0 ? _d : -1;
|
|
45
|
-
break;
|
|
46
|
-
case "column":
|
|
47
|
-
column_focus = (_e = selection.column_focus) !== null && _e !== void 0 ? _e : -1;
|
|
48
|
-
break;
|
|
49
|
-
case "both":
|
|
50
|
-
row_focus = (_f = selection.row_focus) !== null && _f !== void 0 ? _f : -1;
|
|
51
|
-
column_focus = (_g = selection.column_focus) !== null && _g !== void 0 ? _g : -1;
|
|
52
|
-
break;
|
|
53
|
-
case "unfreeze-row":
|
|
54
|
-
row_focus = -1;
|
|
55
|
-
break;
|
|
56
|
-
case "unfreeze-column":
|
|
57
|
-
column_focus = -1;
|
|
58
|
-
break;
|
|
59
|
-
case "unfreeze-all":
|
|
60
|
-
delete sheet.frozen;
|
|
61
|
-
return;
|
|
62
|
-
default:
|
|
63
|
-
break;
|
|
64
|
-
}
|
|
65
|
-
var hasRow = row_focus >= 0;
|
|
66
|
-
var hasCol = column_focus >= 0;
|
|
67
|
-
if (!hasRow && !hasCol) {
|
|
68
|
-
delete sheet.frozen;
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
var newType;
|
|
72
|
-
if (hasRow && hasCol) {
|
|
73
|
-
newType = "both";
|
|
74
|
-
} else if (hasRow) {
|
|
75
|
-
newType = "row";
|
|
76
|
-
} else {
|
|
77
|
-
newType = "column";
|
|
78
|
-
}
|
|
79
|
-
sheet.frozen = {
|
|
80
|
-
type: newType,
|
|
81
|
-
range: {
|
|
82
|
-
row_focus: row_focus,
|
|
83
|
-
column_focus: column_focus
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
};
|
package/es/utils/index.js
DELETED
|
@@ -1,198 +0,0 @@
|
|
|
1
|
-
import _ from "lodash";
|
|
2
|
-
import { locale } from "../locale";
|
|
3
|
-
import { checkCellIsLocked } from "../modules";
|
|
4
|
-
export * from "./patch";
|
|
5
|
-
export * from "./freeze";
|
|
6
|
-
export function generateRandomSheetName(file, isPivotTable, ctx) {
|
|
7
|
-
var index = file.length;
|
|
8
|
-
var locale_pivotTable = locale(ctx).pivotTable;
|
|
9
|
-
var title = locale_pivotTable.title;
|
|
10
|
-
for (var i = 0; i < file.length; i += 1) {
|
|
11
|
-
if (file[i].name.indexOf("Sheet") > -1 || file[i].name.indexOf(title) > -1) {
|
|
12
|
-
var suffix = parseFloat(file[i].name.replace("Sheet", "").replace(title, ""));
|
|
13
|
-
if (!Number.isNaN(suffix) && Math.ceil(suffix) > index) {
|
|
14
|
-
index = Math.ceil(suffix);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
if (isPivotTable) {
|
|
19
|
-
return title + (index + 1);
|
|
20
|
-
}
|
|
21
|
-
return "Sheet".concat(index + 1);
|
|
22
|
-
}
|
|
23
|
-
export function rgbToHex(color) {
|
|
24
|
-
var rgb;
|
|
25
|
-
if (color.indexOf("rgba") > -1) {
|
|
26
|
-
rgb = color.replace("rgba(", "").replace(")", "").split(",");
|
|
27
|
-
} else {
|
|
28
|
-
rgb = color.replace("rgb(", "").replace(")", "").split(",");
|
|
29
|
-
}
|
|
30
|
-
var r = Number(rgb[0]);
|
|
31
|
-
var g = Number(rgb[1]);
|
|
32
|
-
var b = Number(rgb[2]);
|
|
33
|
-
return "#".concat(((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1));
|
|
34
|
-
}
|
|
35
|
-
export function indexToColumnChar(n) {
|
|
36
|
-
var orda = "a".charCodeAt(0);
|
|
37
|
-
var ordz = "z".charCodeAt(0);
|
|
38
|
-
var len = ordz - orda + 1;
|
|
39
|
-
var s = "";
|
|
40
|
-
while (n >= 0) {
|
|
41
|
-
s = String.fromCharCode(n % len + orda) + s;
|
|
42
|
-
n = Math.floor(n / len) - 1;
|
|
43
|
-
}
|
|
44
|
-
return s.toUpperCase();
|
|
45
|
-
}
|
|
46
|
-
export function columnCharToIndex(a) {
|
|
47
|
-
if (a == null || a.length === 0) {
|
|
48
|
-
return NaN;
|
|
49
|
-
}
|
|
50
|
-
var str = a.toLowerCase().split("");
|
|
51
|
-
var al = str.length;
|
|
52
|
-
var getCharNumber = function getCharNumber(charx) {
|
|
53
|
-
return charx.charCodeAt(0) - 96;
|
|
54
|
-
};
|
|
55
|
-
var numout = 0;
|
|
56
|
-
var charnum = 0;
|
|
57
|
-
for (var i = 0; i < al; i += 1) {
|
|
58
|
-
charnum = getCharNumber(str[i]);
|
|
59
|
-
numout += charnum * Math.pow(26, al - i - 1);
|
|
60
|
-
}
|
|
61
|
-
if (numout === 0) {
|
|
62
|
-
return NaN;
|
|
63
|
-
}
|
|
64
|
-
return numout - 1;
|
|
65
|
-
}
|
|
66
|
-
export function escapeScriptTag(str) {
|
|
67
|
-
if (typeof str !== "string") return str;
|
|
68
|
-
return str.replace(/<script>/g, "<script>").replace(/<\/script>/, "</script>");
|
|
69
|
-
}
|
|
70
|
-
export function escapeHTMLTag(str) {
|
|
71
|
-
if (typeof str !== "string") return str;
|
|
72
|
-
if (str.substr(0, 5) === "<span" || _.startsWith(str, "=")) {
|
|
73
|
-
return str;
|
|
74
|
-
}
|
|
75
|
-
return str.replace(/</g, "<").replace(/>/g, ">");
|
|
76
|
-
}
|
|
77
|
-
export function getSheetIndex(ctx, id) {
|
|
78
|
-
var _a;
|
|
79
|
-
for (var i = 0; i < ctx.luckysheetfile.length; i += 1) {
|
|
80
|
-
if (((_a = ctx.luckysheetfile[i]) === null || _a === void 0 ? void 0 : _a.id) === id) {
|
|
81
|
-
return i;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
return null;
|
|
85
|
-
}
|
|
86
|
-
export function getSheetIdByName(ctx, name) {
|
|
87
|
-
for (var i = 0; i < ctx.luckysheetfile.length; i += 1) {
|
|
88
|
-
if (ctx.luckysheetfile[i].name === name) {
|
|
89
|
-
return ctx.luckysheetfile[i].id;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
return null;
|
|
93
|
-
}
|
|
94
|
-
export function getSheetByIndex(ctx, id) {
|
|
95
|
-
if (_.isNil(id)) {
|
|
96
|
-
id = ctx.currentSheetId;
|
|
97
|
-
}
|
|
98
|
-
var i = getSheetIndex(ctx, id);
|
|
99
|
-
if (_.isNil(i)) {
|
|
100
|
-
return null;
|
|
101
|
-
}
|
|
102
|
-
return ctx.luckysheetfile[i];
|
|
103
|
-
}
|
|
104
|
-
export function getNowDateTime(format) {
|
|
105
|
-
var now = new Date();
|
|
106
|
-
var year = now.getFullYear();
|
|
107
|
-
var month = now.getMonth();
|
|
108
|
-
var date = now.getDate();
|
|
109
|
-
var hour = now.getHours();
|
|
110
|
-
var minu = now.getMinutes();
|
|
111
|
-
var sec = now.getSeconds();
|
|
112
|
-
month += 1;
|
|
113
|
-
if (month < 10) month = "0".concat(month);
|
|
114
|
-
if (date < 10) date = "0".concat(date);
|
|
115
|
-
if (hour < 10) hour = "0".concat(hour);
|
|
116
|
-
if (minu < 10) minu = "0".concat(minu);
|
|
117
|
-
if (sec < 10) sec = "0".concat(sec);
|
|
118
|
-
var time = "";
|
|
119
|
-
if (format === 1) {
|
|
120
|
-
time = "".concat(year, "-").concat(month, "-").concat(date);
|
|
121
|
-
} else if (format === 2) {
|
|
122
|
-
time = "".concat(year, "-").concat(month, "-").concat(date, " ").concat(hour, ":").concat(minu, ":").concat(sec);
|
|
123
|
-
}
|
|
124
|
-
return time;
|
|
125
|
-
}
|
|
126
|
-
export function replaceHtml(temp, dataarry) {
|
|
127
|
-
return temp.replace(/\$\{([\w]+)\}/g, function (s1, s2) {
|
|
128
|
-
var s = dataarry[s2];
|
|
129
|
-
if (typeof s !== "undefined") {
|
|
130
|
-
return s;
|
|
131
|
-
}
|
|
132
|
-
return s1;
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
export function getRegExpStr(str) {
|
|
136
|
-
return str.replace("~*", "\\*").replace("~?", "\\?").replace(".", "\\.").replace("*", ".*").replace("?", ".");
|
|
137
|
-
}
|
|
138
|
-
export function chatatABC(n) {
|
|
139
|
-
var orda = "a".charCodeAt(0);
|
|
140
|
-
var ordz = "z".charCodeAt(0);
|
|
141
|
-
var len = ordz - orda + 1;
|
|
142
|
-
var s = "";
|
|
143
|
-
while (n >= 0) {
|
|
144
|
-
s = String.fromCharCode(n % len + orda) + s;
|
|
145
|
-
n = Math.floor(n / len) - 1;
|
|
146
|
-
}
|
|
147
|
-
return s.toUpperCase();
|
|
148
|
-
}
|
|
149
|
-
export function isAllowEdit(ctx, range) {
|
|
150
|
-
var cfg = ctx.config;
|
|
151
|
-
var judgeRange = _.isUndefined(range) ? ctx.luckysheet_select_save : range;
|
|
152
|
-
return _.every(judgeRange, function (selection) {
|
|
153
|
-
var _a, _b;
|
|
154
|
-
for (var r = selection.row[0]; r <= selection.row[1]; r += 1) {
|
|
155
|
-
if ((_a = cfg.rowReadOnly) === null || _a === void 0 ? void 0 : _a[r]) {
|
|
156
|
-
return false;
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
for (var c = selection.column[0]; c <= selection.column[1]; c += 1) {
|
|
160
|
-
if ((_b = cfg.colReadOnly) === null || _b === void 0 ? void 0 : _b[c]) {
|
|
161
|
-
return false;
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
for (var r = selection.row[0]; r <= selection.row[1]; r += 1) {
|
|
165
|
-
for (var c = selection.column[0]; c <= selection.column[1]; c += 1) {
|
|
166
|
-
if (checkCellIsLocked(ctx, r, c, ctx.currentSheetId)) {
|
|
167
|
-
return false;
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
return true;
|
|
172
|
-
}) && (_.isUndefined(ctx.allowEdit) ? true : ctx.allowEdit);
|
|
173
|
-
}
|
|
174
|
-
export function isAllowEditReadOnly(ctx, range) {
|
|
175
|
-
var cfg = ctx.config;
|
|
176
|
-
var judgeRange = _.isUndefined(range) ? ctx.luckysheet_select_save : range;
|
|
177
|
-
return _.every(judgeRange, function (selection) {
|
|
178
|
-
var _a, _b;
|
|
179
|
-
for (var r = selection.row[0]; r <= selection.row[1]; r += 1) {
|
|
180
|
-
if ((_a = cfg.rowReadOnly) === null || _a === void 0 ? void 0 : _a[r]) {
|
|
181
|
-
return false;
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
for (var c = selection.column[0]; c <= selection.column[1]; c += 1) {
|
|
185
|
-
if ((_b = cfg.colReadOnly) === null || _b === void 0 ? void 0 : _b[c]) {
|
|
186
|
-
return false;
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
for (var r = selection.row[0]; r <= selection.row[1]; r += 1) {
|
|
190
|
-
for (var c = selection.column[0]; c <= selection.column[1]; c += 1) {
|
|
191
|
-
if (checkCellIsLocked(ctx, r, c, ctx.currentSheetId)) {
|
|
192
|
-
return false;
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
return true;
|
|
197
|
-
}) && (_.isUndefined(ctx.isFlvReadOnly) ? true : ctx.isFlvReadOnly);
|
|
198
|
-
}
|
package/es/utils/patch.d.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { Patch } from "immer";
|
|
2
|
-
import { Context } from "../context";
|
|
3
|
-
import { Op, Sheet } from "../types";
|
|
4
|
-
export type ChangedSheet = {
|
|
5
|
-
index?: number;
|
|
6
|
-
id?: string;
|
|
7
|
-
value?: Sheet;
|
|
8
|
-
order?: number;
|
|
9
|
-
};
|
|
10
|
-
export type PatchOptions = {
|
|
11
|
-
insertRowColOp?: {
|
|
12
|
-
type: "row" | "column";
|
|
13
|
-
index: number;
|
|
14
|
-
count: number;
|
|
15
|
-
direction: "lefttop" | "rightbottom";
|
|
16
|
-
id: string;
|
|
17
|
-
};
|
|
18
|
-
deleteRowColOp?: {
|
|
19
|
-
type: "row" | "column";
|
|
20
|
-
start: number;
|
|
21
|
-
end: number;
|
|
22
|
-
id: string;
|
|
23
|
-
};
|
|
24
|
-
restoreDeletedCells?: boolean;
|
|
25
|
-
addSheetOp?: boolean;
|
|
26
|
-
deleteSheetOp?: {
|
|
27
|
-
id: string;
|
|
28
|
-
};
|
|
29
|
-
addSheet?: ChangedSheet;
|
|
30
|
-
deletedSheet?: ChangedSheet;
|
|
31
|
-
id?: string;
|
|
32
|
-
};
|
|
33
|
-
export declare function filterPatch(patches: Patch[]): Patch[];
|
|
34
|
-
export declare function extractFormulaCellOps(ops: Op[]): Op[];
|
|
35
|
-
export declare function patchToOp(ctx: Context, patches: Patch[], options?: PatchOptions, undo?: boolean): Op[];
|
|
36
|
-
export declare function opToPatch(ctx: Context, ops: Op[]): [Patch[], Op[]];
|
|
37
|
-
export declare function inverseRowColOptions(options?: PatchOptions): PatchOptions | undefined;
|