@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/api/cell.js
DELETED
|
@@ -1,204 +0,0 @@
|
|
|
1
|
-
var __assign = this && this.__assign || function () {
|
|
2
|
-
__assign = Object.assign || function (t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
6
|
-
}
|
|
7
|
-
return t;
|
|
8
|
-
};
|
|
9
|
-
return __assign.apply(this, arguments);
|
|
10
|
-
};
|
|
11
|
-
import _ from "lodash";
|
|
12
|
-
import { delFunctionGroup, dropCellCache, functionHTMLGenerate, getTypeItemHide, setCellValue as setCellValueInternal, updateCell, updateDropCell, updateFormatCell } from "../modules";
|
|
13
|
-
import { getSheet } from "./common";
|
|
14
|
-
import { SHEET_NOT_FOUND } from "./errors";
|
|
15
|
-
import SSF from "../modules/ssf";
|
|
16
|
-
export function getCellValue(ctx, row, column, options) {
|
|
17
|
-
var _a;
|
|
18
|
-
if (options === void 0) {
|
|
19
|
-
options = {};
|
|
20
|
-
}
|
|
21
|
-
if (!_.isNumber(row) || !_.isNumber(column)) {
|
|
22
|
-
throw new Error("row or column cannot be null or undefined");
|
|
23
|
-
}
|
|
24
|
-
var sheet = getSheet(ctx, options);
|
|
25
|
-
var _b = options.type,
|
|
26
|
-
type = _b === void 0 ? "v" : _b;
|
|
27
|
-
var targetSheetData = sheet.data;
|
|
28
|
-
if (!targetSheetData) {
|
|
29
|
-
throw SHEET_NOT_FOUND;
|
|
30
|
-
}
|
|
31
|
-
var cellData = targetSheetData[row][column];
|
|
32
|
-
var ret;
|
|
33
|
-
if (cellData && _.isPlainObject(cellData)) {
|
|
34
|
-
ret = cellData[type];
|
|
35
|
-
if (type === "f" && ret != null) {
|
|
36
|
-
ret = functionHTMLGenerate(ret);
|
|
37
|
-
} else if (type === "f") {
|
|
38
|
-
ret = cellData.v;
|
|
39
|
-
} else if (cellData && cellData.ct && cellData.ct.fa === "yyyy-MM-dd") {
|
|
40
|
-
ret = cellData.m;
|
|
41
|
-
} else if (((_a = cellData.ct) === null || _a === void 0 ? void 0 : _a.t) === "inlineStr") {
|
|
42
|
-
ret = cellData.ct.s.reduce(function (prev, cur) {
|
|
43
|
-
var _a;
|
|
44
|
-
return prev + ((_a = cur.v) !== null && _a !== void 0 ? _a : "");
|
|
45
|
-
}, "");
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
if (ret === undefined) {
|
|
49
|
-
ret = null;
|
|
50
|
-
}
|
|
51
|
-
return ret;
|
|
52
|
-
}
|
|
53
|
-
export function setCellValue(ctx, row, column, value, cellInput, options) {
|
|
54
|
-
var _a;
|
|
55
|
-
if (options === void 0) {
|
|
56
|
-
options = {};
|
|
57
|
-
}
|
|
58
|
-
if (!_.isNumber(row) || !_.isNumber(column)) {
|
|
59
|
-
throw new Error("row or column cannot be null or undefined");
|
|
60
|
-
}
|
|
61
|
-
var sheet = getSheet(ctx, options);
|
|
62
|
-
var data = sheet.data;
|
|
63
|
-
if (!data) return;
|
|
64
|
-
var formatList = {
|
|
65
|
-
bg: 1,
|
|
66
|
-
ff: 1,
|
|
67
|
-
fc: 1,
|
|
68
|
-
bl: 1,
|
|
69
|
-
it: 1,
|
|
70
|
-
fs: 1,
|
|
71
|
-
cl: 1,
|
|
72
|
-
un: 1,
|
|
73
|
-
vt: 1,
|
|
74
|
-
ht: 1,
|
|
75
|
-
mc: 1,
|
|
76
|
-
tr: 1,
|
|
77
|
-
tb: 1,
|
|
78
|
-
rt: 1,
|
|
79
|
-
qp: 1
|
|
80
|
-
};
|
|
81
|
-
if (value == null || value.toString().length === 0) {
|
|
82
|
-
delFunctionGroup(ctx, row, column);
|
|
83
|
-
setCellValueInternal(ctx, row, column, data, value);
|
|
84
|
-
} else if (value instanceof Object) {
|
|
85
|
-
var curv = {};
|
|
86
|
-
if (((_a = data === null || data === void 0 ? void 0 : data[row]) === null || _a === void 0 ? void 0 : _a[column]) == null) {
|
|
87
|
-
data[row][column] = {};
|
|
88
|
-
}
|
|
89
|
-
var cell_1 = data[row][column];
|
|
90
|
-
if (value.f != null && value.v == null) {
|
|
91
|
-
curv.f = value.f;
|
|
92
|
-
if (value.ct != null) {
|
|
93
|
-
curv.ct = value.ct;
|
|
94
|
-
}
|
|
95
|
-
updateCell(ctx, row, column, cellInput, curv);
|
|
96
|
-
} else {
|
|
97
|
-
if (value.ct != null) {
|
|
98
|
-
curv.ct = value.ct;
|
|
99
|
-
}
|
|
100
|
-
if (value.f != null) {
|
|
101
|
-
curv.f = value.f;
|
|
102
|
-
}
|
|
103
|
-
if (value.v != null) {
|
|
104
|
-
curv.v = value.v;
|
|
105
|
-
} else {
|
|
106
|
-
curv.v = cell_1.v;
|
|
107
|
-
}
|
|
108
|
-
if (value.m != null) {
|
|
109
|
-
curv.m = value.m;
|
|
110
|
-
}
|
|
111
|
-
delFunctionGroup(ctx, row, column);
|
|
112
|
-
setCellValueInternal(ctx, row, column, data, curv);
|
|
113
|
-
}
|
|
114
|
-
_.forEach(value, function (v, attr) {
|
|
115
|
-
if (attr in formatList) {
|
|
116
|
-
updateFormatCell(ctx, data, attr, v, row, row, column, column);
|
|
117
|
-
} else {
|
|
118
|
-
cell_1[attr] = v;
|
|
119
|
-
}
|
|
120
|
-
});
|
|
121
|
-
data[row][column] = cell_1;
|
|
122
|
-
} else {
|
|
123
|
-
if (value.toString().substr(0, 1) === "=" || value.toString().substr(0, 5) === "<span") {
|
|
124
|
-
updateCell(ctx, row, column, cellInput, value);
|
|
125
|
-
} else {
|
|
126
|
-
delFunctionGroup(ctx, row, column);
|
|
127
|
-
setCellValueInternal(ctx, row, column, data, value);
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
export function clearCell(ctx, row, column, options) {
|
|
132
|
-
var _a, _b;
|
|
133
|
-
if (options === void 0) {
|
|
134
|
-
options = {};
|
|
135
|
-
}
|
|
136
|
-
if (!_.isNumber(row) || !_.isNumber(column)) {
|
|
137
|
-
throw new Error("row or column cannot be null or undefined");
|
|
138
|
-
}
|
|
139
|
-
var sheet = getSheet(ctx, options);
|
|
140
|
-
var cell = (_b = (_a = sheet.data) === null || _a === void 0 ? void 0 : _a[row]) === null || _b === void 0 ? void 0 : _b[column];
|
|
141
|
-
if (cell && _.isPlainObject(cell)) {
|
|
142
|
-
delete cell.m;
|
|
143
|
-
delete cell.v;
|
|
144
|
-
if (cell.f != null) {
|
|
145
|
-
delete cell.f;
|
|
146
|
-
delFunctionGroup(ctx, row, column, sheet.id);
|
|
147
|
-
delete cell.spl;
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
export function setCellFormat(ctx, row, column, attr, value, options) {
|
|
152
|
-
var _a;
|
|
153
|
-
if (options === void 0) {
|
|
154
|
-
options = {};
|
|
155
|
-
}
|
|
156
|
-
if (!_.isNumber(row) || !_.isNumber(column)) {
|
|
157
|
-
throw new Error("row or column cannot be null or undefined");
|
|
158
|
-
}
|
|
159
|
-
if (!attr) {
|
|
160
|
-
throw new Error("attr cannot be null or undefined");
|
|
161
|
-
}
|
|
162
|
-
var sheet = getSheet(ctx, options);
|
|
163
|
-
var targetSheetData = sheet.data;
|
|
164
|
-
var cellData = ((_a = targetSheetData === null || targetSheetData === void 0 ? void 0 : targetSheetData[row]) === null || _a === void 0 ? void 0 : _a[column]) || {};
|
|
165
|
-
var cfg = sheet.config || {};
|
|
166
|
-
if (attr === "ct" && (!value || value.fa == null || value.t == null)) {
|
|
167
|
-
throw new Error("'fa' and 't' should be present in value when attr is 'ct'");
|
|
168
|
-
} else if (attr === "ct" && !_.isNil(cellData.v)) {
|
|
169
|
-
cellData.m = SSF.format(value.fa, cellData.v);
|
|
170
|
-
}
|
|
171
|
-
if (attr === "bd") {
|
|
172
|
-
if (cfg.borderInfo == null) {
|
|
173
|
-
cfg.borderInfo = [];
|
|
174
|
-
}
|
|
175
|
-
var borderInfo = __assign({
|
|
176
|
-
rangeType: "range",
|
|
177
|
-
borderType: "border-all",
|
|
178
|
-
color: "#000",
|
|
179
|
-
style: "1",
|
|
180
|
-
range: [{
|
|
181
|
-
column: [column, column],
|
|
182
|
-
row: [row, row]
|
|
183
|
-
}]
|
|
184
|
-
}, value);
|
|
185
|
-
cfg.borderInfo.push(borderInfo);
|
|
186
|
-
} else {
|
|
187
|
-
cellData[attr] = value;
|
|
188
|
-
}
|
|
189
|
-
targetSheetData[row][column] = cellData;
|
|
190
|
-
sheet.config = cfg;
|
|
191
|
-
ctx.config = cfg;
|
|
192
|
-
}
|
|
193
|
-
export function autoFillCell(ctx, copyRange, applyRange, direction) {
|
|
194
|
-
dropCellCache.copyRange = copyRange;
|
|
195
|
-
dropCellCache.applyRange = applyRange;
|
|
196
|
-
dropCellCache.direction = direction;
|
|
197
|
-
var typeItemHide = getTypeItemHide(ctx);
|
|
198
|
-
if (!typeItemHide[0] && !typeItemHide[1] && !typeItemHide[2] && !typeItemHide[3] && !typeItemHide[4] && !typeItemHide[5] && !typeItemHide[6]) {
|
|
199
|
-
dropCellCache.applyType = "0";
|
|
200
|
-
} else {
|
|
201
|
-
dropCellCache.applyType = "1";
|
|
202
|
-
}
|
|
203
|
-
updateDropCell(ctx);
|
|
204
|
-
}
|
package/es/api/common.d.ts
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { Context } from "../context";
|
|
2
|
-
import { CellMatrix, CellWithRowAndCol, Sheet } from "../types";
|
|
3
|
-
export type CommonOptions = {
|
|
4
|
-
index?: number;
|
|
5
|
-
id?: string;
|
|
6
|
-
};
|
|
7
|
-
export declare const dataToCelldata: (data: CellMatrix | undefined) => CellWithRowAndCol[];
|
|
8
|
-
export declare const celldataToData: (celldata: CellWithRowAndCol[], rowCount?: number, colCount?: number) => CellMatrix | null;
|
|
9
|
-
export declare function getSheet(ctx: Context, options?: CommonOptions): Sheet;
|
|
10
|
-
export declare function getSheetWithLatestCelldata(ctx: Context, options?: CommonOptions): {
|
|
11
|
-
celldata: CellWithRowAndCol[];
|
|
12
|
-
name: string;
|
|
13
|
-
config?: import("../types").SheetConfig | undefined;
|
|
14
|
-
order?: number | undefined;
|
|
15
|
-
color?: string | undefined;
|
|
16
|
-
data?: CellMatrix | undefined;
|
|
17
|
-
id?: string | undefined;
|
|
18
|
-
images?: import("../types").Image[] | undefined;
|
|
19
|
-
iframes?: {
|
|
20
|
-
id: string;
|
|
21
|
-
src: string;
|
|
22
|
-
left: number;
|
|
23
|
-
top: number;
|
|
24
|
-
width: number;
|
|
25
|
-
height: number;
|
|
26
|
-
}[] | undefined;
|
|
27
|
-
zoomRatio?: number | undefined;
|
|
28
|
-
column?: number | undefined;
|
|
29
|
-
row?: number | undefined;
|
|
30
|
-
addRows?: number | undefined;
|
|
31
|
-
status?: number | undefined;
|
|
32
|
-
hide?: number | undefined;
|
|
33
|
-
luckysheet_select_save?: import("../types").Selection[] | undefined;
|
|
34
|
-
luckysheet_selection_range?: {
|
|
35
|
-
row: number[];
|
|
36
|
-
column: number[];
|
|
37
|
-
}[] | undefined;
|
|
38
|
-
calcChain?: any[] | undefined;
|
|
39
|
-
dataBlockCalcFunction?: {
|
|
40
|
-
[key: string]: {
|
|
41
|
-
[key: string]: any;
|
|
42
|
-
};
|
|
43
|
-
} | undefined;
|
|
44
|
-
defaultRowHeight?: number | undefined;
|
|
45
|
-
defaultColWidth?: number | undefined;
|
|
46
|
-
showGridLines?: number | boolean | undefined;
|
|
47
|
-
pivotTable?: any;
|
|
48
|
-
isPivotTable?: boolean | undefined;
|
|
49
|
-
filter?: Record<string, any> | undefined;
|
|
50
|
-
filter_select?: {
|
|
51
|
-
row: number[];
|
|
52
|
-
column: number[];
|
|
53
|
-
} | undefined;
|
|
54
|
-
luckysheet_conditionformat_save?: any[] | undefined;
|
|
55
|
-
luckysheet_alternateformat_save?: any[] | undefined;
|
|
56
|
-
dataVerification?: any;
|
|
57
|
-
conditionRules?: import("../types").ConditionRulesProps | undefined;
|
|
58
|
-
hyperlink?: Record<string, {
|
|
59
|
-
linkType: string;
|
|
60
|
-
linkAddress: string;
|
|
61
|
-
}> | undefined;
|
|
62
|
-
dynamicArray_compute?: any;
|
|
63
|
-
dynamicArray?: any[] | undefined;
|
|
64
|
-
frozen?: {
|
|
65
|
-
type: "row" | "column" | "both" | "rangeRow" | "rangeColumn" | "rangeBoth";
|
|
66
|
-
range?: {
|
|
67
|
-
row_focus: number;
|
|
68
|
-
column_focus: number;
|
|
69
|
-
} | undefined;
|
|
70
|
-
} | undefined;
|
|
71
|
-
};
|
package/es/api/common.js
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
var __assign = this && this.__assign || function () {
|
|
2
|
-
__assign = Object.assign || function (t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
6
|
-
}
|
|
7
|
-
return t;
|
|
8
|
-
};
|
|
9
|
-
return __assign.apply(this, arguments);
|
|
10
|
-
};
|
|
11
|
-
import _ from "lodash";
|
|
12
|
-
import { getSheetIndex } from "../utils";
|
|
13
|
-
import { SHEET_NOT_FOUND } from "./errors";
|
|
14
|
-
export var dataToCelldata = function dataToCelldata(data) {
|
|
15
|
-
var celldata = [];
|
|
16
|
-
if (data == null) {
|
|
17
|
-
return celldata;
|
|
18
|
-
}
|
|
19
|
-
for (var r = 0; r < data.length; r += 1) {
|
|
20
|
-
for (var c = 0; c < data[r].length; c += 1) {
|
|
21
|
-
var v = data[r][c];
|
|
22
|
-
if (v != null) {
|
|
23
|
-
celldata.push({
|
|
24
|
-
r: r,
|
|
25
|
-
c: c,
|
|
26
|
-
v: v
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
return celldata;
|
|
32
|
-
};
|
|
33
|
-
export var celldataToData = function celldataToData(celldata, rowCount, colCount) {
|
|
34
|
-
var _a, _b;
|
|
35
|
-
var lastRow = _.maxBy(celldata, "r");
|
|
36
|
-
var lastCol = _.maxBy(celldata, "c");
|
|
37
|
-
var lastRowNum = ((_a = lastRow === null || lastRow === void 0 ? void 0 : lastRow.r) !== null && _a !== void 0 ? _a : 0) + 1;
|
|
38
|
-
var lastColNum = ((_b = lastCol === null || lastCol === void 0 ? void 0 : lastCol.c) !== null && _b !== void 0 ? _b : 0) + 1;
|
|
39
|
-
if (rowCount != null && colCount != null && rowCount > 0 && colCount > 0) {
|
|
40
|
-
lastRowNum = Math.max(lastRowNum, rowCount);
|
|
41
|
-
lastColNum = Math.max(lastColNum, colCount);
|
|
42
|
-
}
|
|
43
|
-
if (lastRowNum && lastColNum) {
|
|
44
|
-
var expandedData_1 = _.times(lastRowNum, function () {
|
|
45
|
-
return _.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
|
-
return expandedData_1;
|
|
53
|
-
}
|
|
54
|
-
return null;
|
|
55
|
-
};
|
|
56
|
-
export function getSheet(ctx, options) {
|
|
57
|
-
if (options === void 0) {
|
|
58
|
-
options = {};
|
|
59
|
-
}
|
|
60
|
-
var _a = options.index,
|
|
61
|
-
index = _a === void 0 ? getSheetIndex(ctx, options.id || ctx.currentSheetId) : _a;
|
|
62
|
-
if (index == null) {
|
|
63
|
-
throw SHEET_NOT_FOUND;
|
|
64
|
-
}
|
|
65
|
-
var sheet = ctx.luckysheetfile[index];
|
|
66
|
-
if (sheet == null) {
|
|
67
|
-
throw SHEET_NOT_FOUND;
|
|
68
|
-
}
|
|
69
|
-
return sheet;
|
|
70
|
-
}
|
|
71
|
-
export function getSheetWithLatestCelldata(ctx, options) {
|
|
72
|
-
if (options === void 0) {
|
|
73
|
-
options = {};
|
|
74
|
-
}
|
|
75
|
-
var sheet = getSheet(ctx, options);
|
|
76
|
-
return __assign(__assign({}, sheet), {
|
|
77
|
-
celldata: dataToCelldata(sheet.data)
|
|
78
|
-
});
|
|
79
|
-
}
|
package/es/api/errors.js
DELETED
package/es/api/index.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { getSheetWithLatestCelldata, dataToCelldata, celldataToData } from "./common";
|
|
2
|
-
export { getSheetWithLatestCelldata, dataToCelldata, celldataToData };
|
|
3
|
-
export * from "./cell";
|
|
4
|
-
export * from "./rowcol";
|
|
5
|
-
export * from "./range";
|
|
6
|
-
export * from "./merge";
|
|
7
|
-
export * from "./sheet";
|
|
8
|
-
export * from "./workbook";
|
package/es/api/merge.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { getSheet } from "./common";
|
|
2
|
-
import { mergeCells as mergeCellsInternal } from "../modules";
|
|
3
|
-
export function mergeCells(ctx, ranges, type, options) {
|
|
4
|
-
if (options === void 0) {
|
|
5
|
-
options = {};
|
|
6
|
-
}
|
|
7
|
-
var sheet = getSheet(ctx, options);
|
|
8
|
-
mergeCellsInternal(ctx, sheet.id, ranges, type);
|
|
9
|
-
}
|
|
10
|
-
export function cancelMerge(ctx, ranges, options) {
|
|
11
|
-
if (options === void 0) {
|
|
12
|
-
options = {};
|
|
13
|
-
}
|
|
14
|
-
mergeCells(ctx, ranges, "merge-cancel", options);
|
|
15
|
-
}
|
package/es/api/range.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { Selection } from "..";
|
|
2
|
-
import { Context } from "../context";
|
|
3
|
-
import { Cell, Range, SingleRange } from "../types";
|
|
4
|
-
import { CommonOptions } from "./common";
|
|
5
|
-
export declare function getSelection(ctx: Context): {
|
|
6
|
-
row: number[];
|
|
7
|
-
column: number[];
|
|
8
|
-
}[] | undefined;
|
|
9
|
-
export declare function getFlattenRange(ctx: Context, range?: Range): {
|
|
10
|
-
r: number;
|
|
11
|
-
c: number;
|
|
12
|
-
}[];
|
|
13
|
-
export declare function getCellsByFlattenRange(ctx: Context, range?: {
|
|
14
|
-
r: number;
|
|
15
|
-
c: number;
|
|
16
|
-
}[]): (Cell | null)[];
|
|
17
|
-
export declare function getSelectionCoordinates(ctx: Context): string[];
|
|
18
|
-
export declare function getCellsByRange(ctx: Context, range: Selection, options?: CommonOptions): (Cell | null)[][];
|
|
19
|
-
export declare function getHtmlByRange(ctx: Context, range: Range, options?: CommonOptions): string | null;
|
|
20
|
-
export declare function setSelection(ctx: Context, range: Range, options: CommonOptions): void;
|
|
21
|
-
export declare function setCellValuesByRange(ctx: Context, data: any[][], range: SingleRange, cellInput: HTMLDivElement | null, options?: CommonOptions): void;
|
|
22
|
-
export declare function setCellFormatByRange(ctx: Context, attr: keyof Cell, value: any, range: Range | SingleRange, options?: CommonOptions): void;
|
package/es/api/range.js
DELETED
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
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); }
|
|
2
|
-
import _ from "lodash";
|
|
3
|
-
import { getdatabyselection, getFlowdata, getRangetxt } from "..";
|
|
4
|
-
import { normalizeSelection, rangeValueToHtml } from "../modules";
|
|
5
|
-
import { setCellFormat, setCellValue } from "./cell";
|
|
6
|
-
import { getSheet } from "./common";
|
|
7
|
-
import { INVALID_PARAMS } from "./errors";
|
|
8
|
-
export function getSelection(ctx) {
|
|
9
|
-
var _a;
|
|
10
|
-
return (_a = ctx.luckysheet_select_save) === null || _a === void 0 ? void 0 : _a.map(function (selection) {
|
|
11
|
-
return {
|
|
12
|
-
row: selection.row,
|
|
13
|
-
column: selection.column
|
|
14
|
-
};
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
export function getFlattenRange(ctx, range) {
|
|
18
|
-
range = range || getSelection(ctx);
|
|
19
|
-
var result = [];
|
|
20
|
-
range === null || range === void 0 ? void 0 : range.forEach(function (ele) {
|
|
21
|
-
var rs = ele.row;
|
|
22
|
-
var cs = ele.column;
|
|
23
|
-
for (var r = rs[0]; r <= rs[1]; r += 1) {
|
|
24
|
-
for (var c = cs[0]; c <= cs[1]; c += 1) {
|
|
25
|
-
result.push({
|
|
26
|
-
r: r,
|
|
27
|
-
c: c
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
return result;
|
|
33
|
-
}
|
|
34
|
-
export function getCellsByFlattenRange(ctx, range) {
|
|
35
|
-
range = range || getFlattenRange(ctx);
|
|
36
|
-
var flowdata = getFlowdata(ctx);
|
|
37
|
-
if (!flowdata) return [];
|
|
38
|
-
return range.map(function (item) {
|
|
39
|
-
var _a;
|
|
40
|
-
return (_a = flowdata[item.r]) === null || _a === void 0 ? void 0 : _a[item.c];
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
export function getSelectionCoordinates(ctx) {
|
|
44
|
-
var result = [];
|
|
45
|
-
var rangeArr = _.cloneDeep(ctx.luckysheet_select_save);
|
|
46
|
-
var sheetId = ctx.currentSheetId;
|
|
47
|
-
rangeArr === null || rangeArr === void 0 ? void 0 : rangeArr.forEach(function (ele) {
|
|
48
|
-
var rangeText = getRangetxt(ctx, sheetId, {
|
|
49
|
-
column: ele.column,
|
|
50
|
-
row: ele.row
|
|
51
|
-
});
|
|
52
|
-
result.push(rangeText);
|
|
53
|
-
});
|
|
54
|
-
return result;
|
|
55
|
-
}
|
|
56
|
-
export function getCellsByRange(ctx, range, options) {
|
|
57
|
-
if (options === void 0) {
|
|
58
|
-
options = {};
|
|
59
|
-
}
|
|
60
|
-
var sheet = getSheet(ctx, options);
|
|
61
|
-
if (!range || _typeof(range) === "object") {
|
|
62
|
-
return getdatabyselection(ctx, range, sheet.id);
|
|
63
|
-
}
|
|
64
|
-
throw INVALID_PARAMS;
|
|
65
|
-
}
|
|
66
|
-
export function getHtmlByRange(ctx, range, options) {
|
|
67
|
-
if (options === void 0) {
|
|
68
|
-
options = {};
|
|
69
|
-
}
|
|
70
|
-
var sheet = getSheet(ctx, options);
|
|
71
|
-
return rangeValueToHtml(ctx, sheet.id, range);
|
|
72
|
-
}
|
|
73
|
-
export function setSelection(ctx, range, options) {
|
|
74
|
-
var sheet = getSheet(ctx, options);
|
|
75
|
-
sheet.luckysheet_select_save = normalizeSelection(ctx, range);
|
|
76
|
-
if (ctx.currentSheetId === sheet.id) {
|
|
77
|
-
ctx.luckysheet_select_save = sheet.luckysheet_select_save;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
export function setCellValuesByRange(ctx, data, range, cellInput, options) {
|
|
81
|
-
if (options === void 0) {
|
|
82
|
-
options = {};
|
|
83
|
-
}
|
|
84
|
-
if (data == null) {
|
|
85
|
-
throw INVALID_PARAMS;
|
|
86
|
-
}
|
|
87
|
-
if (range instanceof Array) {
|
|
88
|
-
throw new Error("setCellValuesByRange does not support multiple ranges");
|
|
89
|
-
}
|
|
90
|
-
if (!_.isPlainObject(range)) {
|
|
91
|
-
throw INVALID_PARAMS;
|
|
92
|
-
}
|
|
93
|
-
var rowCount = range.row[1] - range.row[0] + 1;
|
|
94
|
-
var columnCount = range.column[1] - range.column[0] + 1;
|
|
95
|
-
if (data.length !== rowCount || data[0].length !== columnCount) {
|
|
96
|
-
throw new Error("data size does not match range");
|
|
97
|
-
}
|
|
98
|
-
for (var i = 0; i < rowCount; i += 1) {
|
|
99
|
-
for (var j = 0; j < columnCount; j += 1) {
|
|
100
|
-
var row = range.row[0] + i;
|
|
101
|
-
var column = range.column[0] + j;
|
|
102
|
-
setCellValue(ctx, row, column, data[i][j], cellInput, options);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
export function setCellFormatByRange(ctx, attr, value, range, options) {
|
|
107
|
-
if (options === void 0) {
|
|
108
|
-
options = {};
|
|
109
|
-
}
|
|
110
|
-
if (_.isPlainObject(range)) {
|
|
111
|
-
range = [range];
|
|
112
|
-
}
|
|
113
|
-
if (!_.isArray(range)) {
|
|
114
|
-
throw INVALID_PARAMS;
|
|
115
|
-
}
|
|
116
|
-
range.forEach(function (singleRange) {
|
|
117
|
-
for (var r = singleRange.row[0]; r <= singleRange.row[1]; r += 1) {
|
|
118
|
-
for (var c = singleRange.column[0]; c <= singleRange.column[1]; c += 1) {
|
|
119
|
-
setCellFormat(ctx, r, c, attr, value, options);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
});
|
|
123
|
-
}
|
package/es/api/rowcol.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Context } from "../context";
|
|
2
|
-
import { CommonOptions } from "./common";
|
|
3
|
-
export declare function freeze(ctx: Context, type: "row" | "column" | "both", range: {
|
|
4
|
-
row: number;
|
|
5
|
-
column: number;
|
|
6
|
-
}, options?: CommonOptions): void;
|
|
7
|
-
export declare function insertRowOrColumn(ctx: Context, type: "row" | "column", index: number, count: number, direction: "lefttop" | "rightbottom", options?: CommonOptions): void;
|
|
8
|
-
export declare function deleteRowOrColumn(ctx: Context, type: "row" | "column", start: number, end: number, options?: CommonOptions): void;
|
|
9
|
-
export declare function hideRowOrColumn(ctx: Context, rowColInfo: string[], type: "row" | "column"): void;
|
|
10
|
-
export declare function showRowOrColumn(ctx: Context, rowColInfo: string[], type: "row" | "column"): void;
|
|
11
|
-
export declare function setRowHeight(ctx: Context, rowInfo: Record<string, number>, options?: CommonOptions, custom?: boolean): void;
|
|
12
|
-
export declare function setColumnWidth(ctx: Context, columnInfo: Record<string, number>, options?: CommonOptions, custom?: boolean): void;
|
|
13
|
-
export declare function getRowHeight(ctx: Context, rows: number[], options?: CommonOptions): Record<number, number>;
|
|
14
|
-
export declare function getColumnWidth(ctx: Context, columns: number[], options?: CommonOptions): Record<number, number>;
|