@fileverse-dev/fortune-core 1.0.4 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{dist/packages/core/src → es}/api/cell.d.ts +10 -10
- package/es/api/cell.js +204 -0
- package/{dist/packages/core/src → es}/api/common.d.ts +66 -66
- package/es/api/common.js +79 -0
- package/{dist/packages/core/src → es}/api/errors.d.ts +2 -2
- package/es/api/errors.js +2 -0
- package/{dist/packages/core/src → es}/api/index.d.ts +9 -9
- package/es/api/index.js +8 -0
- package/{dist/packages/core/src → es}/api/merge.d.ts +5 -5
- package/es/api/merge.js +15 -0
- package/{dist/packages/core/src → es}/api/range.d.ts +22 -22
- package/es/api/range.js +123 -0
- package/{dist/packages/core/src → es}/api/rowcol.d.ts +14 -14
- package/es/api/rowcol.js +207 -0
- package/{dist/packages/core/src → es}/api/sheet.d.ts +10 -10
- package/es/api/sheet.js +128 -0
- package/{dist/packages/core/src → es}/api/workbook.d.ts +15 -15
- package/es/api/workbook.js +85 -0
- package/{dist/packages/core/src → es}/canvas.d.ts +46 -46
- package/es/canvas.js +1350 -0
- package/{dist/packages/core/src → es}/context.d.ts +197 -197
- package/es/context.js +380 -0
- package/{dist/packages/core/src → es}/events/copy.d.ts +2 -2
- package/es/events/copy.js +78 -0
- package/{dist/packages/core/src → es}/events/index.d.ts +4 -4
- package/es/events/index.js +4 -0
- package/{dist/packages/core/src → es}/events/keyboard.d.ts +6 -6
- package/es/events/keyboard.js +332 -0
- package/{dist/packages/core/src → es}/events/mouse.d.ts +22 -22
- package/es/events/mouse.js +1725 -0
- package/{dist/packages/core/src → es}/events/paste.d.ts +3 -3
- package/es/events/paste.js +1358 -0
- package/{dist/packages/core/src → es}/index.d.ts +10 -10
- package/es/index.js +10 -0
- package/{dist/packages/core/src → es}/locale/en.d.ts +992 -992
- package/es/locale/en.js +10564 -0
- package/{dist/packages/core/src → es}/locale/es.d.ts +1134 -1134
- package/es/locale/es.js +10010 -0
- package/{dist/packages/core/src → es}/locale/hi.d.ts +1030 -1030
- package/es/locale/hi.js +10550 -0
- package/{dist/packages/core/src → es}/locale/index.d.ts +1049 -1049
- package/es/locale/index.js +23 -0
- package/{dist/packages/core/src → es}/locale/zh.d.ts +1048 -1048
- package/es/locale/zh.js +10568 -0
- package/{dist/packages/core/src → es}/locale/zh_tw.d.ts +1187 -1187
- package/es/locale/zh_tw.js +10072 -0
- package/{dist/packages/core/src → es}/modules/ConditionFormat.d.ts +17 -17
- package/es/modules/ConditionFormat.js +1258 -0
- package/{dist/packages/core/src → es}/modules/border.d.ts +3 -3
- package/es/modules/border.js +1240 -0
- package/{dist/packages/core/src → es}/modules/cell.d.ts +32 -32
- package/es/modules/cell.js +1055 -0
- package/{dist/packages/core/src → es}/modules/clipboard.d.ts +3 -3
- package/es/modules/clipboard.js +36 -0
- package/{dist/packages/core/src → es}/modules/color.d.ts +1 -1
- package/es/modules/color.js +1 -0
- package/{dist/packages/core/src → es}/modules/comment.d.ts +97 -97
- package/es/modules/comment.js +597 -0
- package/{dist/packages/core/src → es}/modules/conditionalFormat.d.ts +2 -2
- package/es/modules/conditionalFormat.js +441 -0
- package/{dist/packages/core/src → es}/modules/cursor.d.ts +3 -3
- package/es/modules/cursor.js +62 -0
- package/{dist/packages/core/src → es}/modules/dataVerification.d.ts +11 -11
- package/es/modules/dataVerification.js +700 -0
- package/{dist/packages/core/src → es}/modules/dropCell.d.ts +10 -10
- package/es/modules/dropCell.js +2266 -0
- package/{dist/packages/core/src → es}/modules/filter.d.ts +45 -45
- package/es/modules/filter.js +434 -0
- package/{dist/packages/core/src → es}/modules/format.d.ts +6 -6
- package/es/modules/format.js +323 -0
- package/{dist/packages/core/src → es}/modules/formula.d.ts +54 -54
- package/es/modules/formula.js +2301 -0
- package/{dist/packages/core/src → es}/modules/freeze.d.ts +5 -5
- package/es/modules/freeze.js +148 -0
- package/{dist/packages/core/src → es}/modules/hyperlink.d.ts +21 -21
- package/es/modules/hyperlink.js +216 -0
- package/{dist/packages/core/src → es}/modules/iframe.d.ts +12 -12
- package/es/modules/iframe.js +220 -0
- package/{dist/packages/core/src → es}/modules/image.d.ts +31 -31
- package/es/modules/image.js +253 -0
- package/{dist/packages/core/src → es}/modules/index.d.ts +36 -36
- package/es/modules/index.js +36 -0
- package/{dist/packages/core/src → es}/modules/inline-string.d.ts +36 -36
- package/es/modules/inline-string.js +437 -0
- package/{dist/packages/core/src → es}/modules/location.d.ts +6 -6
- package/es/modules/location.js +46 -0
- package/{dist/packages/core/src → es}/modules/locationCondition.d.ts +21 -21
- package/es/modules/locationCondition.js +218 -0
- package/{dist/packages/core/src → es}/modules/merge.d.ts +3 -3
- package/es/modules/merge.js +216 -0
- package/{dist/packages/core/src → es}/modules/mobile.d.ts +5 -5
- package/es/modules/mobile.js +33 -0
- package/{dist/packages/core/src → es}/modules/moveCells.d.ts +5 -5
- package/es/modules/moveCells.js +348 -0
- package/{dist/packages/core/src → es}/modules/protection.d.ts +5 -5
- package/es/modules/protection.js +96 -0
- package/{dist/packages/core/src → es}/modules/refresh.d.ts +3 -3
- package/es/modules/refresh.js +34 -0
- package/{dist/packages/core/src → es}/modules/rowcol.d.ts +19 -19
- package/es/modules/rowcol.js +1922 -0
- package/{dist/packages/core/src → es}/modules/screenshot.d.ts +2 -2
- package/es/modules/screenshot.js +90 -0
- package/{dist/packages/core/src → es}/modules/searchReplace.d.ts +36 -36
- package/es/modules/searchReplace.js +388 -0
- package/{dist/packages/core/src → es}/modules/selection.d.ts +46 -46
- package/es/modules/selection.js +1674 -0
- package/{dist/packages/core/src → es}/modules/sheet.d.ts +10 -10
- package/es/modules/sheet.js +237 -0
- package/{dist/packages/core/src → es}/modules/sort.d.ts +7 -7
- package/es/modules/sort.js +150 -0
- package/{dist/packages/core/src → es}/modules/splitColumn.d.ts +5 -5
- package/es/modules/splitColumn.js +126 -0
- package/es/modules/ssf.js +1533 -0
- package/{dist/packages/core/src → es}/modules/text.d.ts +10 -10
- package/es/modules/text.js +1207 -0
- package/{dist/packages/core/src → es}/modules/toolbar.d.ts +32 -32
- package/es/modules/toolbar.js +970 -0
- package/{dist/packages/core/src → es}/modules/validation.d.ts +19 -19
- package/es/modules/validation.js +190 -0
- package/{dist/packages/core/src → es}/modules/zoom.d.ts +3 -3
- package/es/modules/zoom.js +29 -0
- package/{dist/packages/core/src → es}/settings.d.ts +100 -100
- package/es/settings.js +36 -0
- package/{dist/packages/core/src → es}/types.d.ts +371 -371
- package/es/types.js +1 -0
- package/{dist/packages/core/src → es}/utils/freeze.d.ts +7 -7
- package/es/utils/freeze.js +86 -0
- package/{dist/packages/core/src → es}/utils/index.d.ts +18 -18
- package/es/utils/index.js +173 -0
- package/{dist/packages/core/src → es}/utils/patch.d.ts +37 -37
- package/es/utils/patch.js +381 -0
- package/lib/api/cell.d.ts +10 -0
- package/lib/api/cell.js +215 -0
- package/lib/api/common.d.ts +66 -0
- package/lib/api/common.js +88 -0
- package/lib/api/errors.d.ts +2 -0
- package/lib/api/errors.js +8 -0
- package/lib/api/index.d.ts +9 -0
- package/lib/api/index.js +101 -0
- package/lib/api/merge.d.ts +5 -0
- package/lib/api/merge.js +22 -0
- package/lib/api/range.d.ts +22 -0
- package/lib/api/range.js +138 -0
- package/lib/api/rowcol.d.ts +14 -0
- package/lib/api/rowcol.js +222 -0
- package/lib/api/sheet.d.ts +10 -0
- package/lib/api/sheet.js +145 -0
- package/lib/api/workbook.d.ts +15 -0
- package/lib/api/workbook.js +98 -0
- package/lib/canvas.d.ts +46 -0
- package/lib/canvas.js +1356 -0
- package/lib/context.d.ts +197 -0
- package/lib/context.js +392 -0
- package/lib/events/copy.d.ts +2 -0
- package/lib/events/copy.js +85 -0
- package/lib/events/index.d.ts +4 -0
- package/lib/events/index.js +49 -0
- package/lib/events/keyboard.d.ts +6 -0
- package/lib/events/keyboard.js +342 -0
- package/lib/events/mouse.d.ts +22 -0
- package/lib/events/mouse.js +1744 -0
- package/lib/events/paste.d.ts +3 -0
- package/lib/events/paste.js +1366 -0
- package/lib/index.d.ts +10 -0
- package/lib/index.js +109 -0
- package/lib/locale/en.d.ts +992 -0
- package/lib/locale/en.js +10570 -0
- package/lib/locale/es.d.ts +1134 -0
- package/lib/locale/es.js +10016 -0
- package/lib/locale/hi.d.ts +1030 -0
- package/lib/locale/hi.js +10556 -0
- package/lib/locale/index.d.ts +1049 -0
- package/lib/locale/index.js +29 -0
- package/lib/locale/zh.d.ts +1048 -0
- package/lib/locale/zh.js +10574 -0
- package/lib/locale/zh_tw.d.ts +1187 -0
- package/lib/locale/zh_tw.js +10078 -0
- package/lib/modules/ConditionFormat.d.ts +17 -0
- package/lib/modules/ConditionFormat.js +1273 -0
- package/lib/modules/border.d.ts +3 -0
- package/lib/modules/border.js +1248 -0
- package/lib/modules/cell.d.ts +32 -0
- package/lib/modules/cell.js +1085 -0
- package/lib/modules/clipboard.d.ts +3 -0
- package/lib/modules/clipboard.js +42 -0
- package/lib/modules/color.d.ts +1 -0
- package/lib/modules/color.js +7 -0
- package/lib/modules/comment.d.ts +97 -0
- package/lib/modules/comment.js +625 -0
- package/lib/modules/conditionalFormat.d.ts +2 -0
- package/lib/modules/conditionalFormat.js +447 -0
- package/lib/modules/cursor.d.ts +3 -0
- package/lib/modules/cursor.js +70 -0
- package/lib/modules/dataVerification.d.ts +11 -0
- package/lib/modules/dataVerification.js +715 -0
- package/lib/modules/dropCell.d.ts +10 -0
- package/lib/modules/dropCell.js +2282 -0
- package/lib/modules/filter.d.ts +45 -0
- package/lib/modules/filter.js +448 -0
- package/lib/modules/format.d.ts +6 -0
- package/lib/modules/format.js +334 -0
- package/lib/modules/formula.d.ts +54 -0
- package/lib/modules/formula.js +2330 -0
- package/lib/modules/freeze.d.ts +5 -0
- package/lib/modules/freeze.js +158 -0
- package/lib/modules/hyperlink.d.ts +21 -0
- package/lib/modules/hyperlink.js +232 -0
- package/lib/modules/iframe.d.ts +12 -0
- package/lib/modules/iframe.js +236 -0
- package/lib/modules/image.d.ts +31 -0
- package/lib/modules/image.js +272 -0
- package/lib/modules/index.d.ts +36 -0
- package/lib/modules/index.js +401 -0
- package/lib/modules/inline-string.d.ts +36 -0
- package/lib/modules/inline-string.js +452 -0
- package/lib/modules/location.d.ts +6 -0
- package/lib/modules/location.js +57 -0
- package/lib/modules/locationCondition.d.ts +21 -0
- package/lib/modules/locationCondition.js +229 -0
- package/lib/modules/merge.d.ts +3 -0
- package/lib/modules/merge.js +223 -0
- package/lib/modules/mobile.d.ts +5 -0
- package/lib/modules/mobile.js +41 -0
- package/lib/modules/moveCells.d.ts +5 -0
- package/lib/modules/moveCells.js +357 -0
- package/lib/modules/protection.d.ts +5 -0
- package/lib/modules/protection.js +106 -0
- package/lib/modules/refresh.d.ts +3 -0
- package/lib/modules/refresh.js +40 -0
- package/lib/modules/rowcol.d.ts +19 -0
- package/lib/modules/rowcol.js +1935 -0
- package/lib/modules/screenshot.d.ts +2 -0
- package/lib/modules/screenshot.js +96 -0
- package/lib/modules/searchReplace.d.ts +36 -0
- package/lib/modules/searchReplace.js +402 -0
- package/lib/modules/selection.d.ts +46 -0
- package/lib/modules/selection.js +1703 -0
- package/lib/modules/sheet.d.ts +10 -0
- package/lib/modules/sheet.js +250 -0
- package/lib/modules/sort.d.ts +7 -0
- package/lib/modules/sort.js +159 -0
- package/lib/modules/splitColumn.d.ts +5 -0
- package/lib/modules/splitColumn.js +136 -0
- package/lib/modules/ssf.js +1539 -0
- package/lib/modules/text.d.ts +10 -0
- package/lib/modules/text.js +1221 -0
- package/lib/modules/toolbar.d.ts +32 -0
- package/lib/modules/toolbar.js +1003 -0
- package/lib/modules/validation.d.ts +19 -0
- package/lib/modules/validation.js +205 -0
- package/lib/modules/zoom.d.ts +3 -0
- package/lib/modules/zoom.js +36 -0
- package/lib/settings.d.ts +100 -0
- package/lib/settings.js +42 -0
- package/lib/types.d.ts +371 -0
- package/lib/types.js +5 -0
- package/lib/utils/freeze.d.ts +7 -0
- package/lib/utils/freeze.js +92 -0
- package/lib/utils/index.d.ts +18 -0
- package/lib/utils/index.js +231 -0
- package/lib/utils/patch.d.ts +37 -0
- package/lib/utils/patch.js +392 -0
- package/package.json +7 -6
- package/dist/index.esm.js +0 -80255
- package/dist/index.js +0 -80601
- package/dist/packages/react/src/components/ChangeColor/index.d.ts +0 -7
- package/dist/packages/react/src/components/ConditionFormat/ConditionRules.d.ts +0 -6
- package/dist/packages/react/src/components/ConditionFormat/index.d.ts +0 -7
- package/dist/packages/react/src/components/ContextMenu/Divider.d.ts +0 -3
- package/dist/packages/react/src/components/ContextMenu/FilterMenu.d.ts +0 -3
- package/dist/packages/react/src/components/ContextMenu/Menu.d.ts +0 -8
- package/dist/packages/react/src/components/ContextMenu/SheetTab.d.ts +0 -4
- package/dist/packages/react/src/components/ContextMenu/index.d.ts +0 -5
- package/dist/packages/react/src/components/CustomSort/index.d.ts +0 -4
- package/dist/packages/react/src/components/DataVerification/DropdownList.d.ts +0 -4
- package/dist/packages/react/src/components/DataVerification/RangeDialog.d.ts +0 -4
- package/dist/packages/react/src/components/DataVerification/getDisplayedRangeTxt.d.ts +0 -2
- package/dist/packages/react/src/components/DataVerification/index.d.ts +0 -4
- package/dist/packages/react/src/components/Dialog/index.d.ts +0 -15
- package/dist/packages/react/src/components/DuneChartsInputModal/DuneChartsInputModal.d.ts +0 -11
- package/dist/packages/react/src/components/DunePreview/DunePreview.d.ts +0 -13
- package/dist/packages/react/src/components/FilterOption/index.d.ts +0 -5
- package/dist/packages/react/src/components/FormatSearch/index.d.ts +0 -6
- package/dist/packages/react/src/components/FormulaSearch/index.d.ts +0 -5
- package/dist/packages/react/src/components/FxEditor/NameBox.d.ts +0 -3
- package/dist/packages/react/src/components/FxEditor/index.d.ts +0 -4
- package/dist/packages/react/src/components/IFrameBoxs/iFrameBoxs.d.ts +0 -4
- package/dist/packages/react/src/components/ImgBoxs/index.d.ts +0 -3
- package/dist/packages/react/src/components/LinkEidtCard/index.d.ts +0 -5
- package/dist/packages/react/src/components/LocationCondition/index.d.ts +0 -3
- package/dist/packages/react/src/components/MessageBox/index.d.ts +0 -9
- package/dist/packages/react/src/components/NotationBoxes/index.d.ts +0 -3
- package/dist/packages/react/src/components/ResetColumnWidth/index.d.ts +0 -2
- package/dist/packages/react/src/components/SVGDefines.d.ts +0 -5
- package/dist/packages/react/src/components/SVGIcon.d.ts +0 -9
- package/dist/packages/react/src/components/SearchReplace/index.d.ts +0 -6
- package/dist/packages/react/src/components/Sheet/index.d.ts +0 -8
- package/dist/packages/react/src/components/SheetList/SheetHiddenButton.d.ts +0 -8
- package/dist/packages/react/src/components/SheetList/SheetListItem.d.ts +0 -9
- package/dist/packages/react/src/components/SheetList/index.d.ts +0 -4
- package/dist/packages/react/src/components/SheetOverlay/ColumnHeader.d.ts +0 -3
- package/dist/packages/react/src/components/SheetOverlay/ContentEditable.d.ts +0 -11
- package/dist/packages/react/src/components/SheetOverlay/FormulaHint/index.d.ts +0 -4
- package/dist/packages/react/src/components/SheetOverlay/FormulaSearch/constant.d.ts +0 -63
- package/dist/packages/react/src/components/SheetOverlay/FormulaSearch/index.d.ts +0 -4
- package/dist/packages/react/src/components/SheetOverlay/InputBox.d.ts +0 -3
- package/dist/packages/react/src/components/SheetOverlay/RowHeader.d.ts +0 -3
- package/dist/packages/react/src/components/SheetOverlay/ScrollBar/index.d.ts +0 -7
- package/dist/packages/react/src/components/SheetOverlay/index.d.ts +0 -4
- package/dist/packages/react/src/components/SheetTab/SheetItem.d.ts +0 -8
- package/dist/packages/react/src/components/SheetTab/index.d.ts +0 -4
- package/dist/packages/react/src/components/SplitColumn/index.d.ts +0 -3
- package/dist/packages/react/src/components/Toolbar/Button.d.ts +0 -12
- package/dist/packages/react/src/components/Toolbar/ColorPicker.d.ts +0 -6
- package/dist/packages/react/src/components/Toolbar/Combo.d.ts +0 -12
- package/dist/packages/react/src/components/Toolbar/CustomBorder.d.ts +0 -7
- package/dist/packages/react/src/components/Toolbar/CustomButton.d.ts +0 -11
- package/dist/packages/react/src/components/Toolbar/CustomColor.d.ts +0 -8
- package/dist/packages/react/src/components/Toolbar/CustomIcon.d.ts +0 -9
- package/dist/packages/react/src/components/Toolbar/Divider.d.ts +0 -4
- package/dist/packages/react/src/components/Toolbar/MoreItemsContainer.d.ts +0 -6
- package/dist/packages/react/src/components/Toolbar/Select.d.ts +0 -14
- package/dist/packages/react/src/components/Toolbar/index.d.ts +0 -10
- package/dist/packages/react/src/components/Workbook/api.d.ts +0 -1177
- package/dist/packages/react/src/components/Workbook/index.d.ts +0 -1185
- package/dist/packages/react/src/components/ZoomControl/index.d.ts +0 -4
- package/dist/packages/react/src/components/index.d.ts +0 -4
- package/dist/packages/react/src/constants.d.ts +0 -1
- package/dist/packages/react/src/context/index.d.ts +0 -25
- package/dist/packages/react/src/context/modal.d.ts +0 -10
- package/dist/packages/react/src/hooks/useAlert.d.ts +0 -4
- package/dist/packages/react/src/hooks/useDialog.d.ts +0 -5
- package/dist/packages/react/src/hooks/useOutsideClick.d.ts +0 -2
- package/dist/packages/react/src/hooks/usePrevious.d.ts +0 -2
- package/dist/packages/react/src/index.d.ts +0 -1
- package/dist/packages/react/src/utils/datepickerStyles.d.ts +0 -2
- package/dist/stories/API.stories.d.ts +0 -1210
- package/dist/stories/Collabration.stories.d.ts +0 -2359
- package/dist/stories/Features.stories.d.ts +0 -9430
- package/dist/stories/data/cell.d.ts +0 -983
- package/dist/stories/data/dataVerification.d.ts +0 -131
- package/dist/stories/data/empty.d.ts +0 -10
- package/dist/stories/data/formula.d.ts +0 -362
- package/dist/stories/data/freeze.d.ts +0 -34
- package/dist/stories/data/protected.d.ts +0 -40
- package/dist/stories/utils.d.ts +0 -1
package/lib/types.d.ts
ADDED
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
import { Patch as ImmerPatch } from "immer";
|
|
2
|
+
import { PatchOptions } from "./utils";
|
|
3
|
+
export type Op = {
|
|
4
|
+
op: "replace" | "remove" | "add" | "insertRowCol" | "deleteRowCol" | "addSheet" | "deleteSheet";
|
|
5
|
+
id?: string;
|
|
6
|
+
path: (string | number)[];
|
|
7
|
+
value?: any;
|
|
8
|
+
};
|
|
9
|
+
export type Rect = {
|
|
10
|
+
top: number;
|
|
11
|
+
left: number;
|
|
12
|
+
width: number;
|
|
13
|
+
height: number;
|
|
14
|
+
};
|
|
15
|
+
export type CellStyle = {
|
|
16
|
+
bl?: number;
|
|
17
|
+
it?: number;
|
|
18
|
+
ff?: number | string;
|
|
19
|
+
fs?: number;
|
|
20
|
+
fc?: string;
|
|
21
|
+
ht?: number;
|
|
22
|
+
vt?: number;
|
|
23
|
+
tb?: string;
|
|
24
|
+
cl?: number;
|
|
25
|
+
un?: number;
|
|
26
|
+
tr?: string;
|
|
27
|
+
};
|
|
28
|
+
export type Cell = {
|
|
29
|
+
v?: string | number | boolean;
|
|
30
|
+
m?: string | number;
|
|
31
|
+
mc?: {
|
|
32
|
+
r: number;
|
|
33
|
+
c: number;
|
|
34
|
+
rs?: number;
|
|
35
|
+
cs?: number;
|
|
36
|
+
};
|
|
37
|
+
f?: string;
|
|
38
|
+
ct?: {
|
|
39
|
+
fa?: string;
|
|
40
|
+
t?: string;
|
|
41
|
+
s?: any;
|
|
42
|
+
};
|
|
43
|
+
qp?: number;
|
|
44
|
+
spl?: any;
|
|
45
|
+
bg?: string;
|
|
46
|
+
lo?: number;
|
|
47
|
+
rt?: number;
|
|
48
|
+
ps?: {
|
|
49
|
+
left: number | null;
|
|
50
|
+
top: number | null;
|
|
51
|
+
width: number | null;
|
|
52
|
+
height: number | null;
|
|
53
|
+
value: string;
|
|
54
|
+
isShow: boolean;
|
|
55
|
+
};
|
|
56
|
+
hl?: {
|
|
57
|
+
r: number;
|
|
58
|
+
c: number;
|
|
59
|
+
id: string;
|
|
60
|
+
};
|
|
61
|
+
} & CellStyle;
|
|
62
|
+
export type CellWithRowAndCol = {
|
|
63
|
+
r: number;
|
|
64
|
+
c: number;
|
|
65
|
+
v: Cell | null;
|
|
66
|
+
};
|
|
67
|
+
export type CellMatrix = (Cell | null)[][];
|
|
68
|
+
export type Selection = {
|
|
69
|
+
left?: number;
|
|
70
|
+
width?: number;
|
|
71
|
+
top?: number;
|
|
72
|
+
height?: number;
|
|
73
|
+
left_move?: number;
|
|
74
|
+
width_move?: number;
|
|
75
|
+
top_move?: number;
|
|
76
|
+
height_move?: number;
|
|
77
|
+
row: number[];
|
|
78
|
+
column: number[];
|
|
79
|
+
row_focus?: number;
|
|
80
|
+
column_focus?: number;
|
|
81
|
+
moveXY?: {
|
|
82
|
+
x: number;
|
|
83
|
+
y: number;
|
|
84
|
+
};
|
|
85
|
+
row_select?: boolean;
|
|
86
|
+
column_select?: boolean;
|
|
87
|
+
};
|
|
88
|
+
export type Presence = {
|
|
89
|
+
sheetId: string;
|
|
90
|
+
username: string;
|
|
91
|
+
userId?: string;
|
|
92
|
+
color: string;
|
|
93
|
+
selection: {
|
|
94
|
+
r: number;
|
|
95
|
+
c: number;
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
export type SheetConfig = {
|
|
99
|
+
merge?: Record<string, {
|
|
100
|
+
r: number;
|
|
101
|
+
c: number;
|
|
102
|
+
rs: number;
|
|
103
|
+
cs: number;
|
|
104
|
+
}>;
|
|
105
|
+
rowlen?: Record<string, number>;
|
|
106
|
+
columnlen?: Record<string, number>;
|
|
107
|
+
rowhidden?: Record<string, number>;
|
|
108
|
+
colhidden?: Record<string, number>;
|
|
109
|
+
customHeight?: Record<string, number>;
|
|
110
|
+
customWidth?: Record<string, number>;
|
|
111
|
+
borderInfo?: any[];
|
|
112
|
+
authority?: any;
|
|
113
|
+
rowReadOnly?: Record<number, number>;
|
|
114
|
+
colReadOnly?: Record<number, number>;
|
|
115
|
+
};
|
|
116
|
+
export type Image = {
|
|
117
|
+
id: string;
|
|
118
|
+
width: number;
|
|
119
|
+
height: number;
|
|
120
|
+
left: number;
|
|
121
|
+
top: number;
|
|
122
|
+
src: string;
|
|
123
|
+
};
|
|
124
|
+
export type ConditionRulesProps = {
|
|
125
|
+
rulesType: string;
|
|
126
|
+
rulesValue: string;
|
|
127
|
+
textColor: {
|
|
128
|
+
check: boolean;
|
|
129
|
+
color: string;
|
|
130
|
+
};
|
|
131
|
+
cellColor: {
|
|
132
|
+
check: boolean;
|
|
133
|
+
color: string;
|
|
134
|
+
};
|
|
135
|
+
betweenValue: {
|
|
136
|
+
value1: string;
|
|
137
|
+
value2: string;
|
|
138
|
+
};
|
|
139
|
+
dateValue: string;
|
|
140
|
+
repeatValue: string;
|
|
141
|
+
projectValue: string;
|
|
142
|
+
};
|
|
143
|
+
export type Sheet = {
|
|
144
|
+
name: string;
|
|
145
|
+
config?: SheetConfig;
|
|
146
|
+
order?: number;
|
|
147
|
+
color?: string;
|
|
148
|
+
data?: CellMatrix;
|
|
149
|
+
celldata?: CellWithRowAndCol[];
|
|
150
|
+
id?: string;
|
|
151
|
+
images?: Image[];
|
|
152
|
+
iframes?: {
|
|
153
|
+
id: string;
|
|
154
|
+
src: string;
|
|
155
|
+
left: number;
|
|
156
|
+
top: number;
|
|
157
|
+
width: number;
|
|
158
|
+
height: number;
|
|
159
|
+
}[];
|
|
160
|
+
zoomRatio?: number;
|
|
161
|
+
column?: number;
|
|
162
|
+
row?: number;
|
|
163
|
+
addRows?: number;
|
|
164
|
+
status?: number;
|
|
165
|
+
hide?: number;
|
|
166
|
+
luckysheet_select_save?: Selection[];
|
|
167
|
+
luckysheet_selection_range?: {
|
|
168
|
+
row: number[];
|
|
169
|
+
column: number[];
|
|
170
|
+
}[];
|
|
171
|
+
calcChain?: any[];
|
|
172
|
+
defaultRowHeight?: number;
|
|
173
|
+
defaultColWidth?: number;
|
|
174
|
+
showGridLines?: boolean | number;
|
|
175
|
+
pivotTable?: any;
|
|
176
|
+
isPivotTable?: boolean;
|
|
177
|
+
filter?: Record<string, any>;
|
|
178
|
+
filter_select?: {
|
|
179
|
+
row: number[];
|
|
180
|
+
column: number[];
|
|
181
|
+
};
|
|
182
|
+
luckysheet_conditionformat_save?: any[];
|
|
183
|
+
luckysheet_alternateformat_save?: any[];
|
|
184
|
+
dataVerification?: any;
|
|
185
|
+
conditionRules?: ConditionRulesProps;
|
|
186
|
+
hyperlink?: Record<string, {
|
|
187
|
+
linkType: string;
|
|
188
|
+
linkAddress: string;
|
|
189
|
+
}>;
|
|
190
|
+
dynamicArray_compute?: any;
|
|
191
|
+
dynamicArray?: any[];
|
|
192
|
+
frozen?: {
|
|
193
|
+
type: "row" | "column" | "both" | "rangeRow" | "rangeColumn" | "rangeBoth";
|
|
194
|
+
range?: {
|
|
195
|
+
row_focus: number;
|
|
196
|
+
column_focus: number;
|
|
197
|
+
};
|
|
198
|
+
};
|
|
199
|
+
};
|
|
200
|
+
export type CommentBox = {
|
|
201
|
+
r: number;
|
|
202
|
+
c: number;
|
|
203
|
+
rc: string;
|
|
204
|
+
autoFocus: boolean;
|
|
205
|
+
value: string;
|
|
206
|
+
size: {
|
|
207
|
+
fromX: number;
|
|
208
|
+
fromY: number;
|
|
209
|
+
toX: number;
|
|
210
|
+
toY: number;
|
|
211
|
+
} & Rect;
|
|
212
|
+
} & Rect;
|
|
213
|
+
export type SearchResult = {
|
|
214
|
+
r: number;
|
|
215
|
+
c: number;
|
|
216
|
+
sheetName: string;
|
|
217
|
+
sheetId: string;
|
|
218
|
+
cellPosition: string;
|
|
219
|
+
value: string;
|
|
220
|
+
};
|
|
221
|
+
export type LinkCardProps = {
|
|
222
|
+
sheetId: string;
|
|
223
|
+
r: number;
|
|
224
|
+
c: number;
|
|
225
|
+
rc: string;
|
|
226
|
+
originText: string;
|
|
227
|
+
originType: string;
|
|
228
|
+
originAddress: string;
|
|
229
|
+
position: {
|
|
230
|
+
cellLeft: number;
|
|
231
|
+
cellBottom: number;
|
|
232
|
+
};
|
|
233
|
+
isEditing: boolean;
|
|
234
|
+
selectingCellRange?: boolean;
|
|
235
|
+
};
|
|
236
|
+
export type RangeDialogProps = {
|
|
237
|
+
show: boolean;
|
|
238
|
+
rangeTxt: string;
|
|
239
|
+
type: string;
|
|
240
|
+
singleSelect: boolean;
|
|
241
|
+
};
|
|
242
|
+
export type DataRegulationProps = {
|
|
243
|
+
type: string;
|
|
244
|
+
type2: string;
|
|
245
|
+
rangeTxt: string;
|
|
246
|
+
value1: string;
|
|
247
|
+
value2: string;
|
|
248
|
+
validity: string;
|
|
249
|
+
remote: boolean;
|
|
250
|
+
prohibitInput: boolean;
|
|
251
|
+
hintShow: boolean;
|
|
252
|
+
hintValue: string;
|
|
253
|
+
};
|
|
254
|
+
export type FilterOptions = {
|
|
255
|
+
startRow: number;
|
|
256
|
+
endRow: number;
|
|
257
|
+
startCol: number;
|
|
258
|
+
endCol: number;
|
|
259
|
+
left: number;
|
|
260
|
+
top: number;
|
|
261
|
+
width: number;
|
|
262
|
+
height: number;
|
|
263
|
+
items: {
|
|
264
|
+
col: number;
|
|
265
|
+
left: number;
|
|
266
|
+
top: number;
|
|
267
|
+
}[];
|
|
268
|
+
};
|
|
269
|
+
export type History = {
|
|
270
|
+
patches: ImmerPatch[];
|
|
271
|
+
inversePatches: ImmerPatch[];
|
|
272
|
+
options?: PatchOptions;
|
|
273
|
+
};
|
|
274
|
+
export type Freezen = {
|
|
275
|
+
horizontal?: {
|
|
276
|
+
freezenhorizontaldata: any[];
|
|
277
|
+
top: number;
|
|
278
|
+
};
|
|
279
|
+
vertical?: {
|
|
280
|
+
freezenverticaldata: any[];
|
|
281
|
+
left: number;
|
|
282
|
+
};
|
|
283
|
+
};
|
|
284
|
+
export type GlobalCache = {
|
|
285
|
+
verticalScrollLock?: boolean;
|
|
286
|
+
horizontalScrollLock?: boolean;
|
|
287
|
+
overwriteCell?: boolean;
|
|
288
|
+
ignoreWriteCell?: boolean;
|
|
289
|
+
doNotFocus?: boolean;
|
|
290
|
+
doNotUpdateCell?: boolean;
|
|
291
|
+
recentTextColor?: string;
|
|
292
|
+
recentBackgroundColor?: string;
|
|
293
|
+
visibleColumnsUnique?: number[];
|
|
294
|
+
visibleRowsUnique?: number[];
|
|
295
|
+
undoList: History[];
|
|
296
|
+
redoList: History[];
|
|
297
|
+
editingCommentBoxEle?: HTMLDivElement;
|
|
298
|
+
freezen?: Record<string, Freezen>;
|
|
299
|
+
image?: {
|
|
300
|
+
imgInitialPosition: Rect | undefined;
|
|
301
|
+
cursorMoveStartPosition: {
|
|
302
|
+
x: number;
|
|
303
|
+
y: number;
|
|
304
|
+
} | undefined;
|
|
305
|
+
resizingSide: string | undefined;
|
|
306
|
+
};
|
|
307
|
+
iframe?: {
|
|
308
|
+
iframeInitialPosition: Rect | undefined;
|
|
309
|
+
cursorMoveStartPosition: {
|
|
310
|
+
x: number;
|
|
311
|
+
y: number;
|
|
312
|
+
} | undefined;
|
|
313
|
+
resizingSide: string | undefined;
|
|
314
|
+
};
|
|
315
|
+
commentBox?: {
|
|
316
|
+
movingId: string | undefined;
|
|
317
|
+
resizingId: string | undefined;
|
|
318
|
+
resizingSide: string | undefined;
|
|
319
|
+
commentRC: {
|
|
320
|
+
r: number;
|
|
321
|
+
c: number;
|
|
322
|
+
rc: string;
|
|
323
|
+
};
|
|
324
|
+
boxInitialPosition: Rect | undefined;
|
|
325
|
+
cursorMoveStartPosition: {
|
|
326
|
+
x: number;
|
|
327
|
+
y: number;
|
|
328
|
+
} | undefined;
|
|
329
|
+
};
|
|
330
|
+
searchDialog?: {
|
|
331
|
+
mouseEnter?: boolean;
|
|
332
|
+
moveProps?: {
|
|
333
|
+
initialPosition: Rect | undefined;
|
|
334
|
+
cursorMoveStartPosition: {
|
|
335
|
+
x: number;
|
|
336
|
+
y: number;
|
|
337
|
+
} | undefined;
|
|
338
|
+
};
|
|
339
|
+
};
|
|
340
|
+
linkCard?: {
|
|
341
|
+
mouseEnter?: boolean;
|
|
342
|
+
rangeSelectionModal?: {
|
|
343
|
+
initialPosition: Rect | undefined;
|
|
344
|
+
cursorMoveStartPosition: {
|
|
345
|
+
x: number;
|
|
346
|
+
y: number;
|
|
347
|
+
} | undefined;
|
|
348
|
+
};
|
|
349
|
+
};
|
|
350
|
+
dragCellStartPos?: {
|
|
351
|
+
x: number;
|
|
352
|
+
y: number;
|
|
353
|
+
};
|
|
354
|
+
touchMoveStatus?: boolean;
|
|
355
|
+
touchHandleStatus?: boolean;
|
|
356
|
+
touchMoveStartPos?: {
|
|
357
|
+
x: number;
|
|
358
|
+
y: number;
|
|
359
|
+
vy: number;
|
|
360
|
+
moveType: string;
|
|
361
|
+
vy_x?: number;
|
|
362
|
+
vy_y?: number;
|
|
363
|
+
scrollTop?: number;
|
|
364
|
+
scrollLeft?: number;
|
|
365
|
+
};
|
|
366
|
+
};
|
|
367
|
+
export type SingleRange = {
|
|
368
|
+
row: number[];
|
|
369
|
+
column: number[];
|
|
370
|
+
};
|
|
371
|
+
export type Range = SingleRange[];
|
package/lib/types.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Context } from "../context";
|
|
2
|
+
export declare const getFreezeState: (ctx: Context) => {
|
|
3
|
+
isRowFrozen: boolean;
|
|
4
|
+
isColFrozen: boolean;
|
|
5
|
+
};
|
|
6
|
+
export type FreezeType = "row" | "column" | "both" | "unfreeze-row" | "unfreeze-column" | "unfreeze-all";
|
|
7
|
+
export declare const toggleFreeze: (ctx: Context, type: FreezeType) => void;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.toggleFreeze = exports.getFreezeState = void 0;
|
|
7
|
+
var _ = require(".");
|
|
8
|
+
var getFreezeState = exports.getFreezeState = function getFreezeState(ctx) {
|
|
9
|
+
var _a, _b, _c, _d;
|
|
10
|
+
var sheetIndex = (0, _.getSheetIndex)(ctx, ctx.currentSheetId);
|
|
11
|
+
if (sheetIndex == null) return {
|
|
12
|
+
isRowFrozen: false,
|
|
13
|
+
isColFrozen: false
|
|
14
|
+
};
|
|
15
|
+
var frozen = (_a = ctx.luckysheetfile[sheetIndex]) === null || _a === void 0 ? void 0 : _a.frozen;
|
|
16
|
+
var selection = (_b = ctx.luckysheet_select_save) === null || _b === void 0 ? void 0 : _b[0];
|
|
17
|
+
if (!selection) return {
|
|
18
|
+
isRowFrozen: false,
|
|
19
|
+
isColFrozen: false
|
|
20
|
+
};
|
|
21
|
+
var frozenRow = (_c = frozen === null || frozen === void 0 ? void 0 : frozen.range) === null || _c === void 0 ? void 0 : _c.row_focus;
|
|
22
|
+
var frozenCol = (_d = frozen === null || frozen === void 0 ? void 0 : frozen.range) === null || _d === void 0 ? void 0 : _d.column_focus;
|
|
23
|
+
var isRowFrozen = typeof frozenRow === "number" && frozenRow === selection.row_focus;
|
|
24
|
+
var isColFrozen = typeof frozenCol === "number" && frozenCol === selection.column_focus;
|
|
25
|
+
return {
|
|
26
|
+
isRowFrozen: isRowFrozen,
|
|
27
|
+
isColFrozen: isColFrozen
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
var toggleFreeze = exports.toggleFreeze = function toggleFreeze(ctx, type) {
|
|
31
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
32
|
+
var selection = (_a = ctx.luckysheet_select_save) === null || _a === void 0 ? void 0 : _a[0];
|
|
33
|
+
if (!selection) return;
|
|
34
|
+
var sheetIndex = (0, _.getSheetIndex)(ctx, ctx.currentSheetId);
|
|
35
|
+
var sheet = ctx.luckysheetfile[sheetIndex];
|
|
36
|
+
var frozen = (_b = sheet.frozen) !== null && _b !== void 0 ? _b : {
|
|
37
|
+
range: {
|
|
38
|
+
row_focus: -1,
|
|
39
|
+
column_focus: -1
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
var _h = (_c = frozen.range) !== null && _c !== void 0 ? _c : {
|
|
43
|
+
row_focus: -1,
|
|
44
|
+
column_focus: -1
|
|
45
|
+
},
|
|
46
|
+
row_focus = _h.row_focus,
|
|
47
|
+
column_focus = _h.column_focus;
|
|
48
|
+
switch (type) {
|
|
49
|
+
case "row":
|
|
50
|
+
row_focus = (_d = selection.row_focus) !== null && _d !== void 0 ? _d : -1;
|
|
51
|
+
break;
|
|
52
|
+
case "column":
|
|
53
|
+
column_focus = (_e = selection.column_focus) !== null && _e !== void 0 ? _e : -1;
|
|
54
|
+
break;
|
|
55
|
+
case "both":
|
|
56
|
+
row_focus = (_f = selection.row_focus) !== null && _f !== void 0 ? _f : -1;
|
|
57
|
+
column_focus = (_g = selection.column_focus) !== null && _g !== void 0 ? _g : -1;
|
|
58
|
+
break;
|
|
59
|
+
case "unfreeze-row":
|
|
60
|
+
row_focus = -1;
|
|
61
|
+
break;
|
|
62
|
+
case "unfreeze-column":
|
|
63
|
+
column_focus = -1;
|
|
64
|
+
break;
|
|
65
|
+
case "unfreeze-all":
|
|
66
|
+
delete sheet.frozen;
|
|
67
|
+
return;
|
|
68
|
+
default:
|
|
69
|
+
break;
|
|
70
|
+
}
|
|
71
|
+
var hasRow = row_focus >= 0;
|
|
72
|
+
var hasCol = column_focus >= 0;
|
|
73
|
+
if (!hasRow && !hasCol) {
|
|
74
|
+
delete sheet.frozen;
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
var newType;
|
|
78
|
+
if (hasRow && hasCol) {
|
|
79
|
+
newType = "both";
|
|
80
|
+
} else if (hasRow) {
|
|
81
|
+
newType = "row";
|
|
82
|
+
} else {
|
|
83
|
+
newType = "column";
|
|
84
|
+
}
|
|
85
|
+
sheet.frozen = {
|
|
86
|
+
type: newType,
|
|
87
|
+
range: {
|
|
88
|
+
row_focus: row_focus,
|
|
89
|
+
column_focus: column_focus
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Context } from "../context";
|
|
2
|
+
import { Sheet } from "../types";
|
|
3
|
+
export * from "./patch";
|
|
4
|
+
export * from "./freeze";
|
|
5
|
+
export declare function generateRandomSheetName(file: Sheet[], isPivotTable: boolean, ctx: Context): string;
|
|
6
|
+
export declare function rgbToHex(color: string): string;
|
|
7
|
+
export declare function indexToColumnChar(n: number): string;
|
|
8
|
+
export declare function columnCharToIndex(a: string): number;
|
|
9
|
+
export declare function escapeScriptTag(str: string): string;
|
|
10
|
+
export declare function escapeHTMLTag(str: string): string;
|
|
11
|
+
export declare function getSheetIndex(ctx: Context, id: string): number | null;
|
|
12
|
+
export declare function getSheetIdByName(ctx: Context, name: string): string | null | undefined;
|
|
13
|
+
export declare function getSheetByIndex(ctx: Context, id: string): Sheet | null;
|
|
14
|
+
export declare function getNowDateTime(format: number): string;
|
|
15
|
+
export declare function replaceHtml(temp: string, dataarry: any): string;
|
|
16
|
+
export declare function getRegExpStr(str: string): string;
|
|
17
|
+
export declare function chatatABC(n: number): string;
|
|
18
|
+
export declare function isAllowEdit(ctx: Context, range?: Sheet["luckysheet_select_save"]): boolean;
|