@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/lib/api/errors.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.SHEET_NOT_FOUND = exports.INVALID_PARAMS = void 0;
|
|
7
|
-
var INVALID_PARAMS = exports.INVALID_PARAMS = new Error("invalid params");
|
|
8
|
-
var SHEET_NOT_FOUND = exports.SHEET_NOT_FOUND = new Error("sheet not found");
|
package/lib/api/index.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { getSheetWithLatestCelldata, CommonOptions, dataToCelldata, celldataToData } from "./common";
|
|
2
|
-
export type { CommonOptions };
|
|
3
|
-
export { getSheetWithLatestCelldata, dataToCelldata, celldataToData };
|
|
4
|
-
export * from "./cell";
|
|
5
|
-
export * from "./rowcol";
|
|
6
|
-
export * from "./range";
|
|
7
|
-
export * from "./merge";
|
|
8
|
-
export * from "./sheet";
|
|
9
|
-
export * from "./workbook";
|
package/lib/api/index.js
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
var _exportNames = {
|
|
7
|
-
getSheetWithLatestCelldata: true,
|
|
8
|
-
dataToCelldata: true,
|
|
9
|
-
celldataToData: true
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "celldataToData", {
|
|
12
|
-
enumerable: true,
|
|
13
|
-
get: function get() {
|
|
14
|
-
return _common.celldataToData;
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
Object.defineProperty(exports, "dataToCelldata", {
|
|
18
|
-
enumerable: true,
|
|
19
|
-
get: function get() {
|
|
20
|
-
return _common.dataToCelldata;
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
Object.defineProperty(exports, "getSheetWithLatestCelldata", {
|
|
24
|
-
enumerable: true,
|
|
25
|
-
get: function get() {
|
|
26
|
-
return _common.getSheetWithLatestCelldata;
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
var _common = require("./common");
|
|
30
|
-
var _cell = require("./cell");
|
|
31
|
-
Object.keys(_cell).forEach(function (key) {
|
|
32
|
-
if (key === "default" || key === "__esModule") return;
|
|
33
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
34
|
-
if (key in exports && exports[key] === _cell[key]) return;
|
|
35
|
-
Object.defineProperty(exports, key, {
|
|
36
|
-
enumerable: true,
|
|
37
|
-
get: function get() {
|
|
38
|
-
return _cell[key];
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
var _rowcol = require("./rowcol");
|
|
43
|
-
Object.keys(_rowcol).forEach(function (key) {
|
|
44
|
-
if (key === "default" || key === "__esModule") return;
|
|
45
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
46
|
-
if (key in exports && exports[key] === _rowcol[key]) return;
|
|
47
|
-
Object.defineProperty(exports, key, {
|
|
48
|
-
enumerable: true,
|
|
49
|
-
get: function get() {
|
|
50
|
-
return _rowcol[key];
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
var _range = require("./range");
|
|
55
|
-
Object.keys(_range).forEach(function (key) {
|
|
56
|
-
if (key === "default" || key === "__esModule") return;
|
|
57
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
58
|
-
if (key in exports && exports[key] === _range[key]) return;
|
|
59
|
-
Object.defineProperty(exports, key, {
|
|
60
|
-
enumerable: true,
|
|
61
|
-
get: function get() {
|
|
62
|
-
return _range[key];
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
var _merge = require("./merge");
|
|
67
|
-
Object.keys(_merge).forEach(function (key) {
|
|
68
|
-
if (key === "default" || key === "__esModule") return;
|
|
69
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
70
|
-
if (key in exports && exports[key] === _merge[key]) return;
|
|
71
|
-
Object.defineProperty(exports, key, {
|
|
72
|
-
enumerable: true,
|
|
73
|
-
get: function get() {
|
|
74
|
-
return _merge[key];
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
});
|
|
78
|
-
var _sheet = require("./sheet");
|
|
79
|
-
Object.keys(_sheet).forEach(function (key) {
|
|
80
|
-
if (key === "default" || key === "__esModule") return;
|
|
81
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
82
|
-
if (key in exports && exports[key] === _sheet[key]) return;
|
|
83
|
-
Object.defineProperty(exports, key, {
|
|
84
|
-
enumerable: true,
|
|
85
|
-
get: function get() {
|
|
86
|
-
return _sheet[key];
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
});
|
|
90
|
-
var _workbook = require("./workbook");
|
|
91
|
-
Object.keys(_workbook).forEach(function (key) {
|
|
92
|
-
if (key === "default" || key === "__esModule") return;
|
|
93
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
94
|
-
if (key in exports && exports[key] === _workbook[key]) return;
|
|
95
|
-
Object.defineProperty(exports, key, {
|
|
96
|
-
enumerable: true,
|
|
97
|
-
get: function get() {
|
|
98
|
-
return _workbook[key];
|
|
99
|
-
}
|
|
100
|
-
});
|
|
101
|
-
});
|
package/lib/api/merge.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { Context } from "..";
|
|
2
|
-
import { Range } from "../types";
|
|
3
|
-
import { CommonOptions } from "./common";
|
|
4
|
-
export declare function mergeCells(ctx: Context, ranges: Range, type: string, options?: CommonOptions): void;
|
|
5
|
-
export declare function cancelMerge(ctx: Context, ranges: Range, options?: CommonOptions): void;
|
package/lib/api/merge.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.cancelMerge = cancelMerge;
|
|
7
|
-
exports.mergeCells = mergeCells;
|
|
8
|
-
var _common = require("./common");
|
|
9
|
-
var _modules = require("../modules");
|
|
10
|
-
function mergeCells(ctx, ranges, type, options) {
|
|
11
|
-
if (options === void 0) {
|
|
12
|
-
options = {};
|
|
13
|
-
}
|
|
14
|
-
var sheet = (0, _common.getSheet)(ctx, options);
|
|
15
|
-
(0, _modules.mergeCells)(ctx, sheet.id, ranges, type);
|
|
16
|
-
}
|
|
17
|
-
function cancelMerge(ctx, ranges, options) {
|
|
18
|
-
if (options === void 0) {
|
|
19
|
-
options = {};
|
|
20
|
-
}
|
|
21
|
-
mergeCells(ctx, ranges, "merge-cancel", options);
|
|
22
|
-
}
|
package/lib/api/range.js
DELETED
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getCellsByFlattenRange = getCellsByFlattenRange;
|
|
7
|
-
exports.getCellsByRange = getCellsByRange;
|
|
8
|
-
exports.getFlattenRange = getFlattenRange;
|
|
9
|
-
exports.getHtmlByRange = getHtmlByRange;
|
|
10
|
-
exports.getSelection = getSelection;
|
|
11
|
-
exports.getSelectionCoordinates = getSelectionCoordinates;
|
|
12
|
-
exports.setCellFormatByRange = setCellFormatByRange;
|
|
13
|
-
exports.setCellValuesByRange = setCellValuesByRange;
|
|
14
|
-
exports.setSelection = setSelection;
|
|
15
|
-
var _lodash = _interopRequireDefault(require("lodash"));
|
|
16
|
-
var _2 = require("..");
|
|
17
|
-
var _modules = require("../modules");
|
|
18
|
-
var _cell = require("./cell");
|
|
19
|
-
var _common = require("./common");
|
|
20
|
-
var _errors = require("./errors");
|
|
21
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
22
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
23
|
-
function getSelection(ctx) {
|
|
24
|
-
var _a;
|
|
25
|
-
return (_a = ctx.luckysheet_select_save) === null || _a === void 0 ? void 0 : _a.map(function (selection) {
|
|
26
|
-
return {
|
|
27
|
-
row: selection.row,
|
|
28
|
-
column: selection.column
|
|
29
|
-
};
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
function getFlattenRange(ctx, range) {
|
|
33
|
-
range = range || getSelection(ctx);
|
|
34
|
-
var result = [];
|
|
35
|
-
range === null || range === void 0 ? void 0 : range.forEach(function (ele) {
|
|
36
|
-
var rs = ele.row;
|
|
37
|
-
var cs = ele.column;
|
|
38
|
-
for (var r = rs[0]; r <= rs[1]; r += 1) {
|
|
39
|
-
for (var c = cs[0]; c <= cs[1]; c += 1) {
|
|
40
|
-
result.push({
|
|
41
|
-
r: r,
|
|
42
|
-
c: c
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
return result;
|
|
48
|
-
}
|
|
49
|
-
function getCellsByFlattenRange(ctx, range) {
|
|
50
|
-
range = range || getFlattenRange(ctx);
|
|
51
|
-
var flowdata = (0, _2.getFlowdata)(ctx);
|
|
52
|
-
if (!flowdata) return [];
|
|
53
|
-
return range.map(function (item) {
|
|
54
|
-
var _a;
|
|
55
|
-
return (_a = flowdata[item.r]) === null || _a === void 0 ? void 0 : _a[item.c];
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
function getSelectionCoordinates(ctx) {
|
|
59
|
-
var result = [];
|
|
60
|
-
var rangeArr = _lodash.default.cloneDeep(ctx.luckysheet_select_save);
|
|
61
|
-
var sheetId = ctx.currentSheetId;
|
|
62
|
-
rangeArr === null || rangeArr === void 0 ? void 0 : rangeArr.forEach(function (ele) {
|
|
63
|
-
var rangeText = (0, _2.getRangetxt)(ctx, sheetId, {
|
|
64
|
-
column: ele.column,
|
|
65
|
-
row: ele.row
|
|
66
|
-
});
|
|
67
|
-
result.push(rangeText);
|
|
68
|
-
});
|
|
69
|
-
return result;
|
|
70
|
-
}
|
|
71
|
-
function getCellsByRange(ctx, range, options) {
|
|
72
|
-
if (options === void 0) {
|
|
73
|
-
options = {};
|
|
74
|
-
}
|
|
75
|
-
var sheet = (0, _common.getSheet)(ctx, options);
|
|
76
|
-
if (!range || _typeof(range) === "object") {
|
|
77
|
-
return (0, _2.getdatabyselection)(ctx, range, sheet.id);
|
|
78
|
-
}
|
|
79
|
-
throw _errors.INVALID_PARAMS;
|
|
80
|
-
}
|
|
81
|
-
function getHtmlByRange(ctx, range, options) {
|
|
82
|
-
if (options === void 0) {
|
|
83
|
-
options = {};
|
|
84
|
-
}
|
|
85
|
-
var sheet = (0, _common.getSheet)(ctx, options);
|
|
86
|
-
return (0, _modules.rangeValueToHtml)(ctx, sheet.id, range);
|
|
87
|
-
}
|
|
88
|
-
function setSelection(ctx, range, options) {
|
|
89
|
-
var sheet = (0, _common.getSheet)(ctx, options);
|
|
90
|
-
sheet.luckysheet_select_save = (0, _modules.normalizeSelection)(ctx, range);
|
|
91
|
-
if (ctx.currentSheetId === sheet.id) {
|
|
92
|
-
ctx.luckysheet_select_save = sheet.luckysheet_select_save;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
function setCellValuesByRange(ctx, data, range, cellInput, options) {
|
|
96
|
-
if (options === void 0) {
|
|
97
|
-
options = {};
|
|
98
|
-
}
|
|
99
|
-
if (data == null) {
|
|
100
|
-
throw _errors.INVALID_PARAMS;
|
|
101
|
-
}
|
|
102
|
-
if (range instanceof Array) {
|
|
103
|
-
throw new Error("setCellValuesByRange does not support multiple ranges");
|
|
104
|
-
}
|
|
105
|
-
if (!_lodash.default.isPlainObject(range)) {
|
|
106
|
-
throw _errors.INVALID_PARAMS;
|
|
107
|
-
}
|
|
108
|
-
var rowCount = range.row[1] - range.row[0] + 1;
|
|
109
|
-
var columnCount = range.column[1] - range.column[0] + 1;
|
|
110
|
-
if (data.length !== rowCount || data[0].length !== columnCount) {
|
|
111
|
-
throw new Error("data size does not match range");
|
|
112
|
-
}
|
|
113
|
-
for (var i = 0; i < rowCount; i += 1) {
|
|
114
|
-
for (var j = 0; j < columnCount; j += 1) {
|
|
115
|
-
var row = range.row[0] + i;
|
|
116
|
-
var column = range.column[0] + j;
|
|
117
|
-
(0, _cell.setCellValue)(ctx, row, column, data[i][j], cellInput, options);
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
function setCellFormatByRange(ctx, attr, value, range, options) {
|
|
122
|
-
if (options === void 0) {
|
|
123
|
-
options = {};
|
|
124
|
-
}
|
|
125
|
-
if (_lodash.default.isPlainObject(range)) {
|
|
126
|
-
range = [range];
|
|
127
|
-
}
|
|
128
|
-
if (!_lodash.default.isArray(range)) {
|
|
129
|
-
throw _errors.INVALID_PARAMS;
|
|
130
|
-
}
|
|
131
|
-
range.forEach(function (singleRange) {
|
|
132
|
-
for (var r = singleRange.row[0]; r <= singleRange.row[1]; r += 1) {
|
|
133
|
-
for (var c = singleRange.column[0]; c <= singleRange.column[1]; c += 1) {
|
|
134
|
-
(0, _cell.setCellFormat)(ctx, r, c, attr, value, options);
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
});
|
|
138
|
-
}
|
package/lib/api/rowcol.js
DELETED
|
@@ -1,222 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.deleteRowOrColumn = deleteRowOrColumn;
|
|
7
|
-
exports.freeze = freeze;
|
|
8
|
-
exports.getColumnWidth = getColumnWidth;
|
|
9
|
-
exports.getRowHeight = getRowHeight;
|
|
10
|
-
exports.hideRowOrColumn = hideRowOrColumn;
|
|
11
|
-
exports.insertRowOrColumn = insertRowOrColumn;
|
|
12
|
-
exports.setColumnWidth = setColumnWidth;
|
|
13
|
-
exports.setRowHeight = setRowHeight;
|
|
14
|
-
exports.showRowOrColumn = showRowOrColumn;
|
|
15
|
-
var _lodash = _interopRequireDefault(require("lodash"));
|
|
16
|
-
var _modules = require("../modules");
|
|
17
|
-
var _common = require("./common");
|
|
18
|
-
var _errors = require("./errors");
|
|
19
|
-
var _utils = require("../utils");
|
|
20
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
21
|
-
function freeze(ctx, type, range, options) {
|
|
22
|
-
if (options === void 0) {
|
|
23
|
-
options = {};
|
|
24
|
-
}
|
|
25
|
-
var sheet = (0, _common.getSheet)(ctx, options);
|
|
26
|
-
var typeMap = {
|
|
27
|
-
row: "rangeRow",
|
|
28
|
-
column: "rangeColumn",
|
|
29
|
-
both: "rangeBoth"
|
|
30
|
-
};
|
|
31
|
-
var innerType = typeMap[type];
|
|
32
|
-
sheet.frozen = {
|
|
33
|
-
type: innerType,
|
|
34
|
-
range: {
|
|
35
|
-
column_focus: range.column,
|
|
36
|
-
row_focus: range.row
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
function insertRowOrColumn(ctx, type, index, count, direction, options) {
|
|
41
|
-
if (options === void 0) {
|
|
42
|
-
options = {};
|
|
43
|
-
}
|
|
44
|
-
if (!["row", "column"].includes(type) || !_lodash.default.isNumber(index) || !_lodash.default.isNumber(count) || !["lefttop", "rightbottom"].includes(direction)) {
|
|
45
|
-
throw _errors.INVALID_PARAMS;
|
|
46
|
-
}
|
|
47
|
-
var sheet = (0, _common.getSheet)(ctx, options);
|
|
48
|
-
try {
|
|
49
|
-
(0, _modules.insertRowCol)(ctx, {
|
|
50
|
-
type: type,
|
|
51
|
-
index: index,
|
|
52
|
-
count: count,
|
|
53
|
-
direction: direction,
|
|
54
|
-
id: sheet.id
|
|
55
|
-
});
|
|
56
|
-
} catch (e) {
|
|
57
|
-
console.error(e);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
function deleteRowOrColumn(ctx, type, start, end, options) {
|
|
61
|
-
if (options === void 0) {
|
|
62
|
-
options = {};
|
|
63
|
-
}
|
|
64
|
-
if (!["row", "column"].includes(type) || !_lodash.default.isNumber(start) || !_lodash.default.isNumber(end)) {
|
|
65
|
-
throw _errors.INVALID_PARAMS;
|
|
66
|
-
}
|
|
67
|
-
var sheet = (0, _common.getSheet)(ctx, options);
|
|
68
|
-
(0, _modules.deleteRowCol)(ctx, {
|
|
69
|
-
type: type,
|
|
70
|
-
start: start,
|
|
71
|
-
end: end,
|
|
72
|
-
id: sheet.id
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
function hideRowOrColumn(ctx, rowColInfo, type) {
|
|
76
|
-
var _a, _b;
|
|
77
|
-
if (!["row", "column"].includes(type)) {
|
|
78
|
-
throw _errors.INVALID_PARAMS;
|
|
79
|
-
}
|
|
80
|
-
if (!ctx || !ctx.config) return;
|
|
81
|
-
var index = (0, _utils.getSheetIndex)(ctx, ctx.currentSheetId);
|
|
82
|
-
if (type === "row") {
|
|
83
|
-
var rowhidden_1 = (_a = ctx.config.rowhidden) !== null && _a !== void 0 ? _a : {};
|
|
84
|
-
rowColInfo.forEach(function (r) {
|
|
85
|
-
rowhidden_1[r] = 0;
|
|
86
|
-
});
|
|
87
|
-
ctx.config.rowhidden = rowhidden_1;
|
|
88
|
-
} else if (type === "column") {
|
|
89
|
-
var colhidden_1 = (_b = ctx.config.colhidden) !== null && _b !== void 0 ? _b : {};
|
|
90
|
-
rowColInfo.forEach(function (r) {
|
|
91
|
-
colhidden_1[r] = 0;
|
|
92
|
-
});
|
|
93
|
-
ctx.config.colhidden = colhidden_1;
|
|
94
|
-
}
|
|
95
|
-
ctx.luckysheetfile[index].config = ctx.config;
|
|
96
|
-
}
|
|
97
|
-
function showRowOrColumn(ctx, rowColInfo, type) {
|
|
98
|
-
var _a, _b;
|
|
99
|
-
if (!["row", "column"].includes(type)) {
|
|
100
|
-
throw _errors.INVALID_PARAMS;
|
|
101
|
-
}
|
|
102
|
-
if (!ctx || !ctx.config) return;
|
|
103
|
-
var index = (0, _utils.getSheetIndex)(ctx, ctx.currentSheetId);
|
|
104
|
-
if (type === "row") {
|
|
105
|
-
var rowhidden_2 = (_a = ctx.config.rowhidden) !== null && _a !== void 0 ? _a : {};
|
|
106
|
-
rowColInfo.forEach(function (r) {
|
|
107
|
-
delete rowhidden_2[r];
|
|
108
|
-
});
|
|
109
|
-
ctx.config.rowhidden = rowhidden_2;
|
|
110
|
-
} else if (type === "column") {
|
|
111
|
-
var colhidden_2 = (_b = ctx.config.colhidden) !== null && _b !== void 0 ? _b : {};
|
|
112
|
-
rowColInfo.forEach(function (r) {
|
|
113
|
-
delete colhidden_2[r];
|
|
114
|
-
});
|
|
115
|
-
ctx.config.colhidden = colhidden_2;
|
|
116
|
-
}
|
|
117
|
-
ctx.luckysheetfile[index].config = ctx.config;
|
|
118
|
-
}
|
|
119
|
-
function setRowHeight(ctx, rowInfo, options, custom) {
|
|
120
|
-
if (options === void 0) {
|
|
121
|
-
options = {};
|
|
122
|
-
}
|
|
123
|
-
if (custom === void 0) {
|
|
124
|
-
custom = false;
|
|
125
|
-
}
|
|
126
|
-
if (!_lodash.default.isPlainObject(rowInfo)) {
|
|
127
|
-
throw _errors.INVALID_PARAMS;
|
|
128
|
-
}
|
|
129
|
-
var sheet = (0, _common.getSheet)(ctx, options);
|
|
130
|
-
var cfg = sheet.config || {};
|
|
131
|
-
if (cfg.rowlen == null) {
|
|
132
|
-
cfg.rowlen = {};
|
|
133
|
-
}
|
|
134
|
-
_lodash.default.forEach(rowInfo, function (len, r) {
|
|
135
|
-
var _a;
|
|
136
|
-
if (Number(r) >= 0) {
|
|
137
|
-
if (Number(len) >= 0) {
|
|
138
|
-
cfg.rowlen[Number(r)] = Number(len);
|
|
139
|
-
if (custom && _lodash.default.isUndefined(cfg.customHeight)) {
|
|
140
|
-
cfg.customHeight = (_a = {}, _a[r] = 1, _a);
|
|
141
|
-
} else if (custom) {
|
|
142
|
-
cfg.customHeight[r] = 1;
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
});
|
|
147
|
-
sheet.config = cfg;
|
|
148
|
-
if (ctx.currentSheetId === sheet.id) {
|
|
149
|
-
ctx.config = cfg;
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
function setColumnWidth(ctx, columnInfo, options, custom) {
|
|
153
|
-
if (options === void 0) {
|
|
154
|
-
options = {};
|
|
155
|
-
}
|
|
156
|
-
if (custom === void 0) {
|
|
157
|
-
custom = false;
|
|
158
|
-
}
|
|
159
|
-
if (!_lodash.default.isPlainObject(columnInfo)) {
|
|
160
|
-
throw _errors.INVALID_PARAMS;
|
|
161
|
-
}
|
|
162
|
-
var sheet = (0, _common.getSheet)(ctx, options);
|
|
163
|
-
var cfg = sheet.config || {};
|
|
164
|
-
if (cfg.columnlen == null) {
|
|
165
|
-
cfg.columnlen = {};
|
|
166
|
-
}
|
|
167
|
-
_lodash.default.forEach(columnInfo, function (len, c) {
|
|
168
|
-
var _a;
|
|
169
|
-
if (Number(c) >= 0) {
|
|
170
|
-
if (Number(len) >= 0) {
|
|
171
|
-
cfg.columnlen[Number(c)] = Number(len);
|
|
172
|
-
if (custom && _lodash.default.isUndefined(cfg.customWidth)) {
|
|
173
|
-
cfg.customWidth = (_a = {}, _a[c] = 1, _a);
|
|
174
|
-
} else if (custom) {
|
|
175
|
-
cfg.customWidth[c] = 1;
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
});
|
|
180
|
-
sheet.config = cfg;
|
|
181
|
-
if (ctx.currentSheetId === sheet.id) {
|
|
182
|
-
ctx.config = cfg;
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
function getRowHeight(ctx, rows, options) {
|
|
186
|
-
if (options === void 0) {
|
|
187
|
-
options = {};
|
|
188
|
-
}
|
|
189
|
-
if (!_lodash.default.isArray(rows) || rows.length === 0) {
|
|
190
|
-
throw _errors.INVALID_PARAMS;
|
|
191
|
-
}
|
|
192
|
-
var sheet = (0, _common.getSheet)(ctx, options);
|
|
193
|
-
var cfg = sheet.config || {};
|
|
194
|
-
var rowlen = cfg.rowlen || {};
|
|
195
|
-
var rowlenObj = {};
|
|
196
|
-
rows.forEach(function (item) {
|
|
197
|
-
if (Number(item) >= 0) {
|
|
198
|
-
var size = rowlen[Number(item)] || ctx.defaultrowlen;
|
|
199
|
-
rowlenObj[Number(item)] = size;
|
|
200
|
-
}
|
|
201
|
-
});
|
|
202
|
-
return rowlenObj;
|
|
203
|
-
}
|
|
204
|
-
function getColumnWidth(ctx, columns, options) {
|
|
205
|
-
if (options === void 0) {
|
|
206
|
-
options = {};
|
|
207
|
-
}
|
|
208
|
-
if (!_lodash.default.isArray(columns) || columns.length === 0) {
|
|
209
|
-
throw _errors.INVALID_PARAMS;
|
|
210
|
-
}
|
|
211
|
-
var sheet = (0, _common.getSheet)(ctx, options);
|
|
212
|
-
var cfg = sheet.config || {};
|
|
213
|
-
var columnlen = cfg.columnlen || {};
|
|
214
|
-
var columnlenObj = {};
|
|
215
|
-
columns.forEach(function (item) {
|
|
216
|
-
if (Number(item) >= 0) {
|
|
217
|
-
var size = columnlen[Number(item)] || ctx.defaultcollen;
|
|
218
|
-
columnlenObj[Number(item)] = size;
|
|
219
|
-
}
|
|
220
|
-
});
|
|
221
|
-
return columnlenObj;
|
|
222
|
-
}
|
package/lib/api/sheet.js
DELETED
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.calculateSheetFromula = calculateSheetFromula;
|
|
7
|
-
exports.copySheet = copySheet;
|
|
8
|
-
exports.getAllSheets = getAllSheets;
|
|
9
|
-
Object.defineProperty(exports, "getSheet", {
|
|
10
|
-
enumerable: true,
|
|
11
|
-
get: function get() {
|
|
12
|
-
return _common.getSheet;
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
exports.hideSheet = hideSheet;
|
|
16
|
-
exports.initSheetData = initSheetData;
|
|
17
|
-
exports.showSheet = showSheet;
|
|
18
|
-
var _lodash = _interopRequireDefault(require("lodash"));
|
|
19
|
-
var _uuid = require("uuid");
|
|
20
|
-
var _common = require("./common");
|
|
21
|
-
var _utils = require("../utils");
|
|
22
|
-
var _2 = require("..");
|
|
23
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
24
|
-
function getAllSheets(ctx) {
|
|
25
|
-
return ctx.luckysheetfile;
|
|
26
|
-
}
|
|
27
|
-
function initSheetData(draftCtx, index, newData) {
|
|
28
|
-
var _a, _b;
|
|
29
|
-
var celldata = newData.celldata,
|
|
30
|
-
row = newData.row,
|
|
31
|
-
column = newData.column;
|
|
32
|
-
var lastRow = _lodash.default.maxBy(celldata, "r");
|
|
33
|
-
var lastCol = _lodash.default.maxBy(celldata, "c");
|
|
34
|
-
var lastRowNum = ((_a = lastRow === null || lastRow === void 0 ? void 0 : lastRow.r) !== null && _a !== void 0 ? _a : 0) + 1;
|
|
35
|
-
var lastColNum = ((_b = lastCol === null || lastCol === void 0 ? void 0 : lastCol.c) !== null && _b !== void 0 ? _b : 0) + 1;
|
|
36
|
-
if (row != null && column != null && row > 0 && column > 0) {
|
|
37
|
-
lastRowNum = Math.max(lastRowNum, row);
|
|
38
|
-
lastColNum = Math.max(lastColNum, column);
|
|
39
|
-
} else {
|
|
40
|
-
lastRowNum = Math.max(lastRowNum, draftCtx.defaultrowNum);
|
|
41
|
-
lastColNum = Math.max(lastColNum, draftCtx.defaultcolumnNum);
|
|
42
|
-
}
|
|
43
|
-
if (lastRowNum && lastColNum) {
|
|
44
|
-
var expandedData_1 = _lodash.default.times(lastRowNum, function () {
|
|
45
|
-
return _lodash.default.times(lastColNum, function () {
|
|
46
|
-
return null;
|
|
47
|
-
});
|
|
48
|
-
});
|
|
49
|
-
celldata === null || celldata === void 0 ? void 0 : celldata.forEach(function (d) {
|
|
50
|
-
expandedData_1[d.r][d.c] = d.v;
|
|
51
|
-
});
|
|
52
|
-
if (draftCtx.luckysheetfile[index] == null) {
|
|
53
|
-
newData.data = expandedData_1;
|
|
54
|
-
delete newData.celldata;
|
|
55
|
-
draftCtx.luckysheetfile.push(newData);
|
|
56
|
-
} else {
|
|
57
|
-
draftCtx.luckysheetfile[index].data = expandedData_1;
|
|
58
|
-
delete draftCtx.luckysheetfile[index].celldata;
|
|
59
|
-
}
|
|
60
|
-
return expandedData_1;
|
|
61
|
-
}
|
|
62
|
-
return null;
|
|
63
|
-
}
|
|
64
|
-
function hideSheet(ctx, sheetId) {
|
|
65
|
-
var index = (0, _utils.getSheetIndex)(ctx, sheetId);
|
|
66
|
-
ctx.luckysheetfile[index].hide = 1;
|
|
67
|
-
ctx.luckysheetfile[index].status = 0;
|
|
68
|
-
var shownSheets = ctx.luckysheetfile.filter(function (sheet) {
|
|
69
|
-
return _lodash.default.isUndefined(sheet.hide) || (sheet === null || sheet === void 0 ? void 0 : sheet.hide) !== 1;
|
|
70
|
-
});
|
|
71
|
-
ctx.currentSheetId = shownSheets[0].id;
|
|
72
|
-
}
|
|
73
|
-
function showSheet(ctx, sheetId) {
|
|
74
|
-
var index = (0, _utils.getSheetIndex)(ctx, sheetId);
|
|
75
|
-
ctx.luckysheetfile[index].hide = undefined;
|
|
76
|
-
}
|
|
77
|
-
function generateCopySheetName(ctx, sheetId) {
|
|
78
|
-
var info = (0, _2.locale)(ctx).info;
|
|
79
|
-
var copyWord = "(".concat(info.copy);
|
|
80
|
-
var SheetIndex = (0, _utils.getSheetIndex)(ctx, sheetId);
|
|
81
|
-
var sheetName = ctx.luckysheetfile[SheetIndex].name;
|
|
82
|
-
var copy_i = sheetName.indexOf(copyWord);
|
|
83
|
-
var index = 0;
|
|
84
|
-
if (copy_i !== -1) {
|
|
85
|
-
sheetName = sheetName.toString().substring(0, copy_i);
|
|
86
|
-
}
|
|
87
|
-
var nameCopy = sheetName + copyWord;
|
|
88
|
-
var sheetNames = [];
|
|
89
|
-
for (var i = 0; i < ctx.luckysheetfile.length; i += 1) {
|
|
90
|
-
var fileName = ctx.luckysheetfile[i].name;
|
|
91
|
-
sheetNames.push(fileName);
|
|
92
|
-
var st_i = fileName.indexOf(nameCopy);
|
|
93
|
-
if (st_i === 0) {
|
|
94
|
-
index = index || 2;
|
|
95
|
-
var ed_i = fileName.indexOf(")", st_i + nameCopy.length);
|
|
96
|
-
var num = fileName.substring(st_i + nameCopy.length, ed_i);
|
|
97
|
-
if (_lodash.default.isNumber(num)) {
|
|
98
|
-
if (Number.parseInt(num, 10) >= index) {
|
|
99
|
-
index = Number.parseInt(num, 10) + 1;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
var sheetCopyName;
|
|
105
|
-
do {
|
|
106
|
-
var postfix = "".concat(copyWord + (index || ""), ")");
|
|
107
|
-
var lengthLimit = 31 - postfix.length;
|
|
108
|
-
sheetCopyName = sheetName;
|
|
109
|
-
if (sheetCopyName.length > lengthLimit) {
|
|
110
|
-
sheetCopyName = "".concat(sheetCopyName.slice(0, lengthLimit - 1), "\u2026");
|
|
111
|
-
}
|
|
112
|
-
sheetCopyName += postfix;
|
|
113
|
-
index = (index || 1) + 1;
|
|
114
|
-
} while (sheetNames.indexOf(sheetCopyName) !== -1);
|
|
115
|
-
return sheetCopyName;
|
|
116
|
-
}
|
|
117
|
-
function copySheet(ctx, sheetId) {
|
|
118
|
-
var index = (0, _utils.getSheetIndex)(ctx, sheetId);
|
|
119
|
-
var order = ctx.luckysheetfile[index].order + 1;
|
|
120
|
-
var sheetName = generateCopySheetName(ctx, sheetId);
|
|
121
|
-
var sheetData = _lodash.default.cloneDeep(ctx.luckysheetfile[index]);
|
|
122
|
-
delete sheetData.id;
|
|
123
|
-
delete sheetData.status;
|
|
124
|
-
sheetData.celldata = (0, _common.dataToCelldata)(sheetData.data);
|
|
125
|
-
delete sheetData.data;
|
|
126
|
-
_2.api.addSheet(ctx, undefined, (0, _uuid.v4)(), ctx.luckysheetfile[index].isPivotTable, sheetName, sheetData);
|
|
127
|
-
var sheetOrderList = {};
|
|
128
|
-
sheetOrderList[ctx.luckysheetfile[ctx.luckysheetfile.length - 1].id] = order;
|
|
129
|
-
_2.api.setSheetOrder(ctx, sheetOrderList);
|
|
130
|
-
}
|
|
131
|
-
function calculateSheetFromula(ctx, id) {
|
|
132
|
-
var _a, _b;
|
|
133
|
-
var index = (0, _utils.getSheetIndex)(ctx, id);
|
|
134
|
-
if (!ctx.luckysheetfile[index].data) return;
|
|
135
|
-
for (var r = 0; r < ctx.luckysheetfile[index].data.length; r += 1) {
|
|
136
|
-
for (var c = 0; c < ctx.luckysheetfile[index].data[r].length; c += 1) {
|
|
137
|
-
if (!((_a = ctx.luckysheetfile[index].data[r][c]) === null || _a === void 0 ? void 0 : _a.f)) {
|
|
138
|
-
continue;
|
|
139
|
-
}
|
|
140
|
-
var result = (0, _2.execfunction)(ctx, (_b = ctx.luckysheetfile[index].data[r][c]) === null || _b === void 0 ? void 0 : _b.f, r, c, id);
|
|
141
|
-
_2.api.setCellValue(ctx, r, c, result[1], null);
|
|
142
|
-
(0, _2.insertUpdateFunctionGroup)(ctx, r, c, id);
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
}
|