@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
|
@@ -0,0 +1,381 @@
|
|
|
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
|
+
var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
|
|
12
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
13
|
+
if (ar || !(i in from)) {
|
|
14
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
15
|
+
ar[i] = from[i];
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
19
|
+
};
|
|
20
|
+
import _ from "lodash";
|
|
21
|
+
import { getSheetIndex } from ".";
|
|
22
|
+
import { getFlowdata } from "../context";
|
|
23
|
+
var addtionalMergeOps = function addtionalMergeOps(ops, id) {
|
|
24
|
+
var merge_new = {};
|
|
25
|
+
ops.some(function (op) {
|
|
26
|
+
if (op.op === "replace" && op.path[0] === "config" && op.path[1] === "merge") {
|
|
27
|
+
merge_new = op.value;
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
return false;
|
|
31
|
+
});
|
|
32
|
+
var new_ops = [];
|
|
33
|
+
Object.entries(merge_new).forEach(function (_a) {
|
|
34
|
+
var v = _a[1];
|
|
35
|
+
var _b = v,
|
|
36
|
+
r = _b.r,
|
|
37
|
+
c = _b.c,
|
|
38
|
+
rs = _b.rs,
|
|
39
|
+
cs = _b.cs;
|
|
40
|
+
var headerOp = {
|
|
41
|
+
op: "replace",
|
|
42
|
+
path: ["data", r, c, "mc"],
|
|
43
|
+
id: id,
|
|
44
|
+
value: v
|
|
45
|
+
};
|
|
46
|
+
for (var i = r; i < r + rs; i += 1) {
|
|
47
|
+
for (var j = c; j < c + cs; j += 1) {
|
|
48
|
+
new_ops.push({
|
|
49
|
+
op: "replace",
|
|
50
|
+
path: ["data", i, j, "mc"],
|
|
51
|
+
id: id,
|
|
52
|
+
value: {
|
|
53
|
+
r: r,
|
|
54
|
+
c: c
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
new_ops.push(headerOp);
|
|
60
|
+
});
|
|
61
|
+
return new_ops;
|
|
62
|
+
};
|
|
63
|
+
function additionalCellOps(ctx, insertRowColOp) {
|
|
64
|
+
var id = insertRowColOp.id,
|
|
65
|
+
index = insertRowColOp.index,
|
|
66
|
+
direction = insertRowColOp.direction,
|
|
67
|
+
count = insertRowColOp.count,
|
|
68
|
+
type = insertRowColOp.type;
|
|
69
|
+
var d = getFlowdata(ctx, id);
|
|
70
|
+
var startIndex = index + (direction === "rightbottom" ? 1 : 0);
|
|
71
|
+
if (d == null) {
|
|
72
|
+
return [];
|
|
73
|
+
}
|
|
74
|
+
var cellOps = [];
|
|
75
|
+
if (type === "row") {
|
|
76
|
+
for (var i = 0; i < d[startIndex].length; i += 1) {
|
|
77
|
+
var cell = d[startIndex][i];
|
|
78
|
+
if (cell != null) {
|
|
79
|
+
for (var j = 0; j < count; j += 1) {
|
|
80
|
+
cellOps.push({
|
|
81
|
+
op: "replace",
|
|
82
|
+
id: id,
|
|
83
|
+
path: ["data", startIndex + j, i],
|
|
84
|
+
value: cell
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
} else {
|
|
90
|
+
for (var i = 0; i < d.length; i += 1) {
|
|
91
|
+
var cell = d[i][startIndex];
|
|
92
|
+
if (cell != null) {
|
|
93
|
+
for (var j = 0; j < count; j += 1) {
|
|
94
|
+
cellOps.push({
|
|
95
|
+
op: "replace",
|
|
96
|
+
id: id,
|
|
97
|
+
path: ["data", i, startIndex + j],
|
|
98
|
+
value: cell
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return cellOps;
|
|
105
|
+
}
|
|
106
|
+
export function filterPatch(patches) {
|
|
107
|
+
return _.filter(patches, function (p) {
|
|
108
|
+
return p.path[0] === "luckysheetfile" && p.path[2] !== "luckysheet_select_save";
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
export function extractFormulaCellOps(ops) {
|
|
112
|
+
var formulaOps = [];
|
|
113
|
+
ops.forEach(function (op) {
|
|
114
|
+
var _a, _b;
|
|
115
|
+
if (op.op === "remove") return;
|
|
116
|
+
if (op.path.length === 2 && Array.isArray(op.value)) {
|
|
117
|
+
for (var i = 0; i < op.value.length; i += 1) {
|
|
118
|
+
if ((_a = op.value[i]) === null || _a === void 0 ? void 0 : _a.f) {
|
|
119
|
+
formulaOps.push({
|
|
120
|
+
op: "replace",
|
|
121
|
+
id: op.id,
|
|
122
|
+
path: __spreadArray(__spreadArray([], op.path, true), [i], false),
|
|
123
|
+
value: op.value[i]
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
} else if (op.path.length === 3 && ((_b = op.value) === null || _b === void 0 ? void 0 : _b.f)) {
|
|
128
|
+
formulaOps.push(op);
|
|
129
|
+
} else if (op.path.length === 4 && op.path[3] === "f") {
|
|
130
|
+
formulaOps.push(op);
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
return formulaOps;
|
|
134
|
+
}
|
|
135
|
+
export function patchToOp(ctx, patches, options, undo) {
|
|
136
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
137
|
+
if (undo === void 0) {
|
|
138
|
+
undo = false;
|
|
139
|
+
}
|
|
140
|
+
var ops = patches.map(function (p) {
|
|
141
|
+
var op = {
|
|
142
|
+
op: p.op,
|
|
143
|
+
value: p.value,
|
|
144
|
+
path: p.path
|
|
145
|
+
};
|
|
146
|
+
if (p.path[0] === "luckysheetfile" && _.isNumber(p.path[1])) {
|
|
147
|
+
var id = ctx.luckysheetfile[p.path[1]].id;
|
|
148
|
+
op.id = id;
|
|
149
|
+
op.path = p.path.slice(2);
|
|
150
|
+
if (_.isEqual(op.path, ["calcChain", "length"])) {
|
|
151
|
+
op.path = ["calcChain"];
|
|
152
|
+
op.value = ctx.luckysheetfile[p.path[1]].calcChain;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
return op;
|
|
156
|
+
});
|
|
157
|
+
_.every(ops, function (p) {
|
|
158
|
+
var _a;
|
|
159
|
+
if (p.op === "replace" && !_.isNil((_a = p.value) === null || _a === void 0 ? void 0 : _a.hl) && p.path.length === 3 && p.path[0] === "data") {
|
|
160
|
+
var index = getSheetIndex(ctx, p.id);
|
|
161
|
+
ops.push({
|
|
162
|
+
id: p.id,
|
|
163
|
+
op: "replace",
|
|
164
|
+
path: ["hyperlink", "".concat(p.path[1], "_").concat(p.path[2])],
|
|
165
|
+
value: ctx.luckysheetfile[index].hyperlink["".concat(p.value.hl.r, "_").concat(p.value.hl.c)]
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
if (options === null || options === void 0 ? void 0 : options.insertRowColOp) {
|
|
170
|
+
var _p = _.partition(ops, function (p) {
|
|
171
|
+
return p.path[0] !== "data";
|
|
172
|
+
}),
|
|
173
|
+
nonDataOps = _p[0],
|
|
174
|
+
dataOps = _p[1];
|
|
175
|
+
var formulaOps = extractFormulaCellOps(dataOps);
|
|
176
|
+
ops = nonDataOps;
|
|
177
|
+
ops.push({
|
|
178
|
+
op: "insertRowCol",
|
|
179
|
+
id: options.insertRowColOp.id,
|
|
180
|
+
path: [],
|
|
181
|
+
value: options.insertRowColOp
|
|
182
|
+
});
|
|
183
|
+
ops = __spreadArray(__spreadArray([], ops, true), formulaOps, true);
|
|
184
|
+
var mergeOps = addtionalMergeOps(ops, ctx.currentSheetId);
|
|
185
|
+
ops = __spreadArray(__spreadArray([], ops, true), mergeOps, true);
|
|
186
|
+
if (options === null || options === void 0 ? void 0 : options.restoreDeletedCells) {
|
|
187
|
+
var restoreCellsOps = [];
|
|
188
|
+
var flowdata = getFlowdata(ctx);
|
|
189
|
+
if (flowdata) {
|
|
190
|
+
var rowlen = flowdata.length;
|
|
191
|
+
var collen = flowdata[0].length;
|
|
192
|
+
for (var i = 0; i < rowlen; i += 1) {
|
|
193
|
+
for (var j = 0; j < collen; j += 1) {
|
|
194
|
+
var cell = flowdata[i][j];
|
|
195
|
+
if (!cell) continue;
|
|
196
|
+
if (options.insertRowColOp.type === "row" && i >= options.insertRowColOp.index && i < options.insertRowColOp.index + options.insertRowColOp.count || options.insertRowColOp.type === "column" && j >= options.insertRowColOp.index && j < options.insertRowColOp.index + options.insertRowColOp.count) {
|
|
197
|
+
restoreCellsOps.push({
|
|
198
|
+
op: "replace",
|
|
199
|
+
path: ["data", i, j],
|
|
200
|
+
id: ctx.currentSheetId,
|
|
201
|
+
value: cell
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
ops = __spreadArray(__spreadArray([], ops, true), restoreCellsOps, true);
|
|
208
|
+
} else {
|
|
209
|
+
var cellOps = additionalCellOps(ctx, options.insertRowColOp);
|
|
210
|
+
ops = __spreadArray(__spreadArray([], ops, true), cellOps, true);
|
|
211
|
+
}
|
|
212
|
+
} else if (options === null || options === void 0 ? void 0 : options.deleteRowColOp) {
|
|
213
|
+
var _q = _.partition(ops, function (p) {
|
|
214
|
+
return p.path[0] !== "data";
|
|
215
|
+
}),
|
|
216
|
+
nonDataOps = _q[0],
|
|
217
|
+
dataOps = _q[1];
|
|
218
|
+
var formulaOps = extractFormulaCellOps(dataOps);
|
|
219
|
+
ops = nonDataOps;
|
|
220
|
+
ops.push({
|
|
221
|
+
op: "deleteRowCol",
|
|
222
|
+
id: options.deleteRowColOp.id,
|
|
223
|
+
path: [],
|
|
224
|
+
value: options.deleteRowColOp
|
|
225
|
+
});
|
|
226
|
+
ops = __spreadArray(__spreadArray([], ops, true), formulaOps, true);
|
|
227
|
+
var mergeOps = addtionalMergeOps(ops, ctx.currentSheetId);
|
|
228
|
+
ops = __spreadArray(__spreadArray([], ops, true), mergeOps, true);
|
|
229
|
+
} else if (options === null || options === void 0 ? void 0 : options.addSheetOp) {
|
|
230
|
+
var _r = _.partition(ops, function (op) {
|
|
231
|
+
return op.path.length === 0 && op.op === "add";
|
|
232
|
+
}),
|
|
233
|
+
addSheetOps = _r[0],
|
|
234
|
+
otherOps = _r[1];
|
|
235
|
+
options.id = options.addSheet.id;
|
|
236
|
+
if (undo) {
|
|
237
|
+
var index = getSheetIndex(ctx, options.addSheet.id);
|
|
238
|
+
var order_1 = (_b = (_a = options.addSheet) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.order;
|
|
239
|
+
ops = otherOps;
|
|
240
|
+
ops.push({
|
|
241
|
+
op: "deleteSheet",
|
|
242
|
+
id: (_c = options.addSheet) === null || _c === void 0 ? void 0 : _c.id,
|
|
243
|
+
path: [],
|
|
244
|
+
value: options.addSheet
|
|
245
|
+
});
|
|
246
|
+
if (index !== ctx.luckysheetfile.length) {
|
|
247
|
+
var sheetsRight = ctx.luckysheetfile.filter(function (sheet) {
|
|
248
|
+
return (sheet === null || sheet === void 0 ? void 0 : sheet.order) >= order_1;
|
|
249
|
+
});
|
|
250
|
+
_.forEach(sheetsRight, function (sheet) {
|
|
251
|
+
ops.push({
|
|
252
|
+
id: sheet.id,
|
|
253
|
+
op: "replace",
|
|
254
|
+
path: ["order"],
|
|
255
|
+
value: (sheet === null || sheet === void 0 ? void 0 : sheet.order) - 1
|
|
256
|
+
});
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
} else {
|
|
260
|
+
ops = otherOps;
|
|
261
|
+
ops.push({
|
|
262
|
+
op: "addSheet",
|
|
263
|
+
id: (_d = options.addSheet) === null || _d === void 0 ? void 0 : _d.id,
|
|
264
|
+
path: [],
|
|
265
|
+
value: (_e = addSheetOps[0]) === null || _e === void 0 ? void 0 : _e.value
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
} else if (options === null || options === void 0 ? void 0 : options.deleteSheetOp) {
|
|
269
|
+
options.id = options.deleteSheetOp.id;
|
|
270
|
+
if (undo) {
|
|
271
|
+
ops = [{
|
|
272
|
+
op: "addSheet",
|
|
273
|
+
id: options.deleteSheetOp.id,
|
|
274
|
+
path: [],
|
|
275
|
+
value: (_f = options.deletedSheet) === null || _f === void 0 ? void 0 : _f.value
|
|
276
|
+
}, {
|
|
277
|
+
id: options.deleteSheetOp.id,
|
|
278
|
+
op: "replace",
|
|
279
|
+
path: ["name"],
|
|
280
|
+
value: (_h = (_g = options.deletedSheet) === null || _g === void 0 ? void 0 : _g.value) === null || _h === void 0 ? void 0 : _h.name
|
|
281
|
+
}];
|
|
282
|
+
var order_2 = (_k = (_j = options.deletedSheet) === null || _j === void 0 ? void 0 : _j.value) === null || _k === void 0 ? void 0 : _k.order;
|
|
283
|
+
var sheetsRight = ctx.luckysheetfile.filter(function (sheet) {
|
|
284
|
+
var _a;
|
|
285
|
+
return (sheet === null || sheet === void 0 ? void 0 : sheet.order) >= order_2 && sheet.id !== ((_a = options.deleteSheetOp) === null || _a === void 0 ? void 0 : _a.id);
|
|
286
|
+
});
|
|
287
|
+
_.forEach(sheetsRight, function (sheet) {
|
|
288
|
+
ops.push({
|
|
289
|
+
id: sheet.id,
|
|
290
|
+
op: "replace",
|
|
291
|
+
path: ["order"],
|
|
292
|
+
value: sheet === null || sheet === void 0 ? void 0 : sheet.order
|
|
293
|
+
});
|
|
294
|
+
});
|
|
295
|
+
} else {
|
|
296
|
+
ops = [{
|
|
297
|
+
op: "deleteSheet",
|
|
298
|
+
id: options.deleteSheetOp.id,
|
|
299
|
+
path: [],
|
|
300
|
+
value: options.deletedSheet
|
|
301
|
+
}];
|
|
302
|
+
var order_3 = (_m = (_l = options.deletedSheet) === null || _l === void 0 ? void 0 : _l.value) === null || _m === void 0 ? void 0 : _m.order;
|
|
303
|
+
if (((_o = options.deletedSheet) === null || _o === void 0 ? void 0 : _o.order) !== ctx.luckysheetfile.length) {
|
|
304
|
+
var sheetsRight = ctx.luckysheetfile.filter(function (sheet) {
|
|
305
|
+
return (sheet === null || sheet === void 0 ? void 0 : sheet.order) >= order_3;
|
|
306
|
+
});
|
|
307
|
+
_.forEach(sheetsRight, function (sheet) {
|
|
308
|
+
ops.push({
|
|
309
|
+
id: sheet.id,
|
|
310
|
+
op: "replace",
|
|
311
|
+
path: ["order"],
|
|
312
|
+
value: sheet === null || sheet === void 0 ? void 0 : sheet.order
|
|
313
|
+
});
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
return ops;
|
|
319
|
+
}
|
|
320
|
+
export function opToPatch(ctx, ops) {
|
|
321
|
+
var _a = _.partition(ops, function (op) {
|
|
322
|
+
return op.op === "add" || op.op === "remove" || op.op === "replace";
|
|
323
|
+
}),
|
|
324
|
+
normalOps = _a[0],
|
|
325
|
+
specialOps = _a[1];
|
|
326
|
+
var additionalPatches = [];
|
|
327
|
+
var patches = normalOps.map(function (op) {
|
|
328
|
+
var patch = {
|
|
329
|
+
op: op.op,
|
|
330
|
+
value: op.value,
|
|
331
|
+
path: op.path
|
|
332
|
+
};
|
|
333
|
+
if (op.id) {
|
|
334
|
+
var i = getSheetIndex(ctx, op.id);
|
|
335
|
+
if (i != null) {
|
|
336
|
+
patch.path = __spreadArray(["luckysheetfile", i], op.path, true);
|
|
337
|
+
} else {}
|
|
338
|
+
if (op.path[0] === "images" && op.id === ctx.currentSheetId) {
|
|
339
|
+
additionalPatches.push(__assign(__assign({}, patch), {
|
|
340
|
+
path: ["insertedImgs"]
|
|
341
|
+
}));
|
|
342
|
+
}
|
|
343
|
+
if (op.path[0] === "iframes" && op.id === ctx.currentSheetId) {
|
|
344
|
+
additionalPatches.push(__assign(__assign({}, patch), {
|
|
345
|
+
path: ["insertedIframes"]
|
|
346
|
+
}));
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
return patch;
|
|
350
|
+
});
|
|
351
|
+
return [patches.concat(additionalPatches), specialOps];
|
|
352
|
+
}
|
|
353
|
+
export function inverseRowColOptions(options) {
|
|
354
|
+
if (!options) return options;
|
|
355
|
+
if (options.insertRowColOp) {
|
|
356
|
+
var index = options.insertRowColOp.index;
|
|
357
|
+
if (options.insertRowColOp.direction === "rightbottom") {
|
|
358
|
+
index += 1;
|
|
359
|
+
}
|
|
360
|
+
return {
|
|
361
|
+
deleteRowColOp: {
|
|
362
|
+
type: options.insertRowColOp.type,
|
|
363
|
+
id: options.insertRowColOp.id,
|
|
364
|
+
start: index,
|
|
365
|
+
end: index + options.insertRowColOp.count - 1
|
|
366
|
+
}
|
|
367
|
+
};
|
|
368
|
+
}
|
|
369
|
+
if (options.deleteRowColOp) {
|
|
370
|
+
return {
|
|
371
|
+
insertRowColOp: {
|
|
372
|
+
type: options.deleteRowColOp.type,
|
|
373
|
+
id: options.deleteRowColOp.id,
|
|
374
|
+
index: options.deleteRowColOp.start,
|
|
375
|
+
count: options.deleteRowColOp.end - options.deleteRowColOp.start + 1,
|
|
376
|
+
direction: "lefttop"
|
|
377
|
+
}
|
|
378
|
+
};
|
|
379
|
+
}
|
|
380
|
+
return options;
|
|
381
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Context } from "../context";
|
|
2
|
+
import { Cell, SingleRange } from "../types";
|
|
3
|
+
import { CommonOptions } from "./common";
|
|
4
|
+
export declare function getCellValue(ctx: Context, row: number, column: number, options?: CommonOptions & {
|
|
5
|
+
type?: keyof Cell;
|
|
6
|
+
}): any;
|
|
7
|
+
export declare function setCellValue(ctx: Context, row: number, column: number, value: any, cellInput: HTMLDivElement | null, options?: CommonOptions): void;
|
|
8
|
+
export declare function clearCell(ctx: Context, row: number, column: number, options?: CommonOptions): void;
|
|
9
|
+
export declare function setCellFormat(ctx: Context, row: number, column: number, attr: keyof Cell, value: any, options?: CommonOptions): void;
|
|
10
|
+
export declare function autoFillCell(ctx: Context, copyRange: SingleRange, applyRange: SingleRange, direction: "up" | "down" | "left" | "right"): void;
|
package/lib/api/cell.js
ADDED
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.autoFillCell = autoFillCell;
|
|
7
|
+
exports.clearCell = clearCell;
|
|
8
|
+
exports.getCellValue = getCellValue;
|
|
9
|
+
exports.setCellFormat = setCellFormat;
|
|
10
|
+
exports.setCellValue = setCellValue;
|
|
11
|
+
var _lodash = _interopRequireDefault(require("lodash"));
|
|
12
|
+
var _modules = require("../modules");
|
|
13
|
+
var _common = require("./common");
|
|
14
|
+
var _errors = require("./errors");
|
|
15
|
+
var _ssf = _interopRequireDefault(require("../modules/ssf"));
|
|
16
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
|
+
var __assign = void 0 && (void 0).__assign || function () {
|
|
18
|
+
__assign = Object.assign || function (t) {
|
|
19
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
20
|
+
s = arguments[i];
|
|
21
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
22
|
+
}
|
|
23
|
+
return t;
|
|
24
|
+
};
|
|
25
|
+
return __assign.apply(this, arguments);
|
|
26
|
+
};
|
|
27
|
+
function getCellValue(ctx, row, column, options) {
|
|
28
|
+
var _a;
|
|
29
|
+
if (options === void 0) {
|
|
30
|
+
options = {};
|
|
31
|
+
}
|
|
32
|
+
if (!_lodash.default.isNumber(row) || !_lodash.default.isNumber(column)) {
|
|
33
|
+
throw new Error("row or column cannot be null or undefined");
|
|
34
|
+
}
|
|
35
|
+
var sheet = (0, _common.getSheet)(ctx, options);
|
|
36
|
+
var _b = options.type,
|
|
37
|
+
type = _b === void 0 ? "v" : _b;
|
|
38
|
+
var targetSheetData = sheet.data;
|
|
39
|
+
if (!targetSheetData) {
|
|
40
|
+
throw _errors.SHEET_NOT_FOUND;
|
|
41
|
+
}
|
|
42
|
+
var cellData = targetSheetData[row][column];
|
|
43
|
+
var ret;
|
|
44
|
+
if (cellData && _lodash.default.isPlainObject(cellData)) {
|
|
45
|
+
ret = cellData[type];
|
|
46
|
+
if (type === "f" && ret != null) {
|
|
47
|
+
ret = (0, _modules.functionHTMLGenerate)(ret);
|
|
48
|
+
} else if (type === "f") {
|
|
49
|
+
ret = cellData.v;
|
|
50
|
+
} else if (cellData && cellData.ct && cellData.ct.fa === "yyyy-MM-dd") {
|
|
51
|
+
ret = cellData.m;
|
|
52
|
+
} else if (((_a = cellData.ct) === null || _a === void 0 ? void 0 : _a.t) === "inlineStr") {
|
|
53
|
+
ret = cellData.ct.s.reduce(function (prev, cur) {
|
|
54
|
+
var _a;
|
|
55
|
+
return prev + ((_a = cur.v) !== null && _a !== void 0 ? _a : "");
|
|
56
|
+
}, "");
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
if (ret === undefined) {
|
|
60
|
+
ret = null;
|
|
61
|
+
}
|
|
62
|
+
return ret;
|
|
63
|
+
}
|
|
64
|
+
function setCellValue(ctx, row, column, value, cellInput, options) {
|
|
65
|
+
var _a;
|
|
66
|
+
if (options === void 0) {
|
|
67
|
+
options = {};
|
|
68
|
+
}
|
|
69
|
+
if (!_lodash.default.isNumber(row) || !_lodash.default.isNumber(column)) {
|
|
70
|
+
throw new Error("row or column cannot be null or undefined");
|
|
71
|
+
}
|
|
72
|
+
var sheet = (0, _common.getSheet)(ctx, options);
|
|
73
|
+
var data = sheet.data;
|
|
74
|
+
if (!data) return;
|
|
75
|
+
var formatList = {
|
|
76
|
+
bg: 1,
|
|
77
|
+
ff: 1,
|
|
78
|
+
fc: 1,
|
|
79
|
+
bl: 1,
|
|
80
|
+
it: 1,
|
|
81
|
+
fs: 1,
|
|
82
|
+
cl: 1,
|
|
83
|
+
un: 1,
|
|
84
|
+
vt: 1,
|
|
85
|
+
ht: 1,
|
|
86
|
+
mc: 1,
|
|
87
|
+
tr: 1,
|
|
88
|
+
tb: 1,
|
|
89
|
+
rt: 1,
|
|
90
|
+
qp: 1
|
|
91
|
+
};
|
|
92
|
+
if (value == null || value.toString().length === 0) {
|
|
93
|
+
(0, _modules.delFunctionGroup)(ctx, row, column);
|
|
94
|
+
(0, _modules.setCellValue)(ctx, row, column, data, value);
|
|
95
|
+
} else if (value instanceof Object) {
|
|
96
|
+
var curv = {};
|
|
97
|
+
if (((_a = data === null || data === void 0 ? void 0 : data[row]) === null || _a === void 0 ? void 0 : _a[column]) == null) {
|
|
98
|
+
data[row][column] = {};
|
|
99
|
+
}
|
|
100
|
+
var cell_1 = data[row][column];
|
|
101
|
+
if (value.f != null && value.v == null) {
|
|
102
|
+
curv.f = value.f;
|
|
103
|
+
if (value.ct != null) {
|
|
104
|
+
curv.ct = value.ct;
|
|
105
|
+
}
|
|
106
|
+
(0, _modules.updateCell)(ctx, row, column, cellInput, curv);
|
|
107
|
+
} else {
|
|
108
|
+
if (value.ct != null) {
|
|
109
|
+
curv.ct = value.ct;
|
|
110
|
+
}
|
|
111
|
+
if (value.f != null) {
|
|
112
|
+
curv.f = value.f;
|
|
113
|
+
}
|
|
114
|
+
if (value.v != null) {
|
|
115
|
+
curv.v = value.v;
|
|
116
|
+
} else {
|
|
117
|
+
curv.v = cell_1.v;
|
|
118
|
+
}
|
|
119
|
+
if (value.m != null) {
|
|
120
|
+
curv.m = value.m;
|
|
121
|
+
}
|
|
122
|
+
(0, _modules.delFunctionGroup)(ctx, row, column);
|
|
123
|
+
(0, _modules.setCellValue)(ctx, row, column, data, curv);
|
|
124
|
+
}
|
|
125
|
+
_lodash.default.forEach(value, function (v, attr) {
|
|
126
|
+
if (attr in formatList) {
|
|
127
|
+
(0, _modules.updateFormatCell)(ctx, data, attr, v, row, row, column, column);
|
|
128
|
+
} else {
|
|
129
|
+
cell_1[attr] = v;
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
data[row][column] = cell_1;
|
|
133
|
+
} else {
|
|
134
|
+
if (value.toString().substr(0, 1) === "=" || value.toString().substr(0, 5) === "<span") {
|
|
135
|
+
(0, _modules.updateCell)(ctx, row, column, cellInput, value);
|
|
136
|
+
} else {
|
|
137
|
+
(0, _modules.delFunctionGroup)(ctx, row, column);
|
|
138
|
+
(0, _modules.setCellValue)(ctx, row, column, data, value);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
function clearCell(ctx, row, column, options) {
|
|
143
|
+
var _a, _b;
|
|
144
|
+
if (options === void 0) {
|
|
145
|
+
options = {};
|
|
146
|
+
}
|
|
147
|
+
if (!_lodash.default.isNumber(row) || !_lodash.default.isNumber(column)) {
|
|
148
|
+
throw new Error("row or column cannot be null or undefined");
|
|
149
|
+
}
|
|
150
|
+
var sheet = (0, _common.getSheet)(ctx, options);
|
|
151
|
+
var cell = (_b = (_a = sheet.data) === null || _a === void 0 ? void 0 : _a[row]) === null || _b === void 0 ? void 0 : _b[column];
|
|
152
|
+
if (cell && _lodash.default.isPlainObject(cell)) {
|
|
153
|
+
delete cell.m;
|
|
154
|
+
delete cell.v;
|
|
155
|
+
if (cell.f != null) {
|
|
156
|
+
delete cell.f;
|
|
157
|
+
(0, _modules.delFunctionGroup)(ctx, row, column, sheet.id);
|
|
158
|
+
delete cell.spl;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
function setCellFormat(ctx, row, column, attr, value, options) {
|
|
163
|
+
var _a;
|
|
164
|
+
if (options === void 0) {
|
|
165
|
+
options = {};
|
|
166
|
+
}
|
|
167
|
+
if (!_lodash.default.isNumber(row) || !_lodash.default.isNumber(column)) {
|
|
168
|
+
throw new Error("row or column cannot be null or undefined");
|
|
169
|
+
}
|
|
170
|
+
if (!attr) {
|
|
171
|
+
throw new Error("attr cannot be null or undefined");
|
|
172
|
+
}
|
|
173
|
+
var sheet = (0, _common.getSheet)(ctx, options);
|
|
174
|
+
var targetSheetData = sheet.data;
|
|
175
|
+
var cellData = ((_a = targetSheetData === null || targetSheetData === void 0 ? void 0 : targetSheetData[row]) === null || _a === void 0 ? void 0 : _a[column]) || {};
|
|
176
|
+
var cfg = sheet.config || {};
|
|
177
|
+
if (attr === "ct" && (!value || value.fa == null || value.t == null)) {
|
|
178
|
+
throw new Error("'fa' and 't' should be present in value when attr is 'ct'");
|
|
179
|
+
} else if (attr === "ct" && !_lodash.default.isNil(cellData.v)) {
|
|
180
|
+
cellData.m = _ssf.default.format(value.fa, cellData.v);
|
|
181
|
+
}
|
|
182
|
+
if (attr === "bd") {
|
|
183
|
+
if (cfg.borderInfo == null) {
|
|
184
|
+
cfg.borderInfo = [];
|
|
185
|
+
}
|
|
186
|
+
var borderInfo = __assign({
|
|
187
|
+
rangeType: "range",
|
|
188
|
+
borderType: "border-all",
|
|
189
|
+
color: "#000",
|
|
190
|
+
style: "1",
|
|
191
|
+
range: [{
|
|
192
|
+
column: [column, column],
|
|
193
|
+
row: [row, row]
|
|
194
|
+
}]
|
|
195
|
+
}, value);
|
|
196
|
+
cfg.borderInfo.push(borderInfo);
|
|
197
|
+
} else {
|
|
198
|
+
cellData[attr] = value;
|
|
199
|
+
}
|
|
200
|
+
targetSheetData[row][column] = cellData;
|
|
201
|
+
sheet.config = cfg;
|
|
202
|
+
ctx.config = cfg;
|
|
203
|
+
}
|
|
204
|
+
function autoFillCell(ctx, copyRange, applyRange, direction) {
|
|
205
|
+
_modules.dropCellCache.copyRange = copyRange;
|
|
206
|
+
_modules.dropCellCache.applyRange = applyRange;
|
|
207
|
+
_modules.dropCellCache.direction = direction;
|
|
208
|
+
var typeItemHide = (0, _modules.getTypeItemHide)(ctx);
|
|
209
|
+
if (!typeItemHide[0] && !typeItemHide[1] && !typeItemHide[2] && !typeItemHide[3] && !typeItemHide[4] && !typeItemHide[5] && !typeItemHide[6]) {
|
|
210
|
+
_modules.dropCellCache.applyType = "0";
|
|
211
|
+
} else {
|
|
212
|
+
_modules.dropCellCache.applyType = "1";
|
|
213
|
+
}
|
|
214
|
+
(0, _modules.updateDropCell)(ctx);
|
|
215
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
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
|
+
defaultRowHeight?: number | undefined;
|
|
40
|
+
defaultColWidth?: number | undefined;
|
|
41
|
+
showGridLines?: number | boolean | undefined;
|
|
42
|
+
pivotTable?: any;
|
|
43
|
+
isPivotTable?: boolean | undefined;
|
|
44
|
+
filter?: Record<string, any> | undefined;
|
|
45
|
+
filter_select?: {
|
|
46
|
+
row: number[];
|
|
47
|
+
column: number[];
|
|
48
|
+
} | undefined;
|
|
49
|
+
luckysheet_conditionformat_save?: any[] | undefined;
|
|
50
|
+
luckysheet_alternateformat_save?: any[] | undefined;
|
|
51
|
+
dataVerification?: any;
|
|
52
|
+
conditionRules?: import("../types").ConditionRulesProps | undefined;
|
|
53
|
+
hyperlink?: Record<string, {
|
|
54
|
+
linkType: string;
|
|
55
|
+
linkAddress: string;
|
|
56
|
+
}> | undefined;
|
|
57
|
+
dynamicArray_compute?: any;
|
|
58
|
+
dynamicArray?: any[] | undefined;
|
|
59
|
+
frozen?: {
|
|
60
|
+
type: "row" | "column" | "both" | "rangeRow" | "rangeColumn" | "rangeBoth";
|
|
61
|
+
range?: {
|
|
62
|
+
row_focus: number;
|
|
63
|
+
column_focus: number;
|
|
64
|
+
} | undefined;
|
|
65
|
+
} | undefined;
|
|
66
|
+
};
|