@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/modules/clipboard.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var clipboard = function () {
|
|
8
|
-
function clipboard() {}
|
|
9
|
-
clipboard.writeHtml = function (str) {
|
|
10
|
-
var _a;
|
|
11
|
-
try {
|
|
12
|
-
var ele_1 = document.getElementById("fortune-copy-content");
|
|
13
|
-
if (!ele_1) {
|
|
14
|
-
ele_1 = document.createElement("div");
|
|
15
|
-
ele_1.setAttribute("contentEditable", "true");
|
|
16
|
-
ele_1.id = "fortune-copy-content";
|
|
17
|
-
ele_1.style.position = "fixed";
|
|
18
|
-
ele_1.style.height = "0";
|
|
19
|
-
ele_1.style.width = "0";
|
|
20
|
-
ele_1.style.left = "-10000px";
|
|
21
|
-
(_a = document.querySelector(".fortune-container")) === null || _a === void 0 ? void 0 : _a.append(ele_1);
|
|
22
|
-
}
|
|
23
|
-
var previouslyFocusedElement_1 = document.activeElement;
|
|
24
|
-
ele_1.style.display = "block";
|
|
25
|
-
ele_1.innerHTML = str;
|
|
26
|
-
ele_1.focus({
|
|
27
|
-
preventScroll: true
|
|
28
|
-
});
|
|
29
|
-
document.execCommand("selectAll");
|
|
30
|
-
document.execCommand("copy");
|
|
31
|
-
setTimeout(function () {
|
|
32
|
-
var _a;
|
|
33
|
-
ele_1 === null || ele_1 === void 0 ? void 0 : ele_1.blur();
|
|
34
|
-
(_a = previouslyFocusedElement_1 === null || previouslyFocusedElement_1 === void 0 ? void 0 : previouslyFocusedElement_1.focus) === null || _a === void 0 ? void 0 : _a.call(previouslyFocusedElement_1);
|
|
35
|
-
}, 10);
|
|
36
|
-
} catch (e) {
|
|
37
|
-
console.error(e);
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
return clipboard;
|
|
41
|
-
}();
|
|
42
|
-
var _default = exports.default = clipboard;
|
package/lib/modules/color.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const colors: string[];
|
package/lib/modules/color.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.colors = void 0;
|
|
7
|
-
var colors = exports.colors = ["#c1232b", "#27727b", "#fcce10", "#e87c25", "#b5c334", "#fe8463", "#9bca63", "#fad860", "#f3a43b", "#60c0dd", "#d7504b", "#c6e579", "#f4e001", "#f0805a", "#26c0c0", "#c12e34", "#e6b600", "#0098d9", "#2b821d", "#005eaa", "#339ca8", "#cda819", "#32a487", "#3fb1e3", "#6be6c1", "#626c91", "#a0a7e6", "#c4ebad", "#96dee8"];
|
package/lib/modules/comment.js
DELETED
|
@@ -1,625 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.commentBoxProps = void 0;
|
|
7
|
-
exports.deleteComment = deleteComment;
|
|
8
|
-
exports.drawArrow = drawArrow;
|
|
9
|
-
exports.editComment = editComment;
|
|
10
|
-
exports.getArrowCanvasSize = getArrowCanvasSize;
|
|
11
|
-
exports.getCellTopRightPostion = getCellTopRightPostion;
|
|
12
|
-
exports.getCommentBoxByRC = getCommentBoxByRC;
|
|
13
|
-
exports.getCommentBoxPosition = getCommentBoxPosition;
|
|
14
|
-
exports.newComment = newComment;
|
|
15
|
-
exports.onCommentBoxMove = onCommentBoxMove;
|
|
16
|
-
exports.onCommentBoxMoveEnd = onCommentBoxMoveEnd;
|
|
17
|
-
exports.onCommentBoxMoveStart = onCommentBoxMoveStart;
|
|
18
|
-
exports.onCommentBoxResize = onCommentBoxResize;
|
|
19
|
-
exports.onCommentBoxResizeEnd = onCommentBoxResizeEnd;
|
|
20
|
-
exports.onCommentBoxResizeStart = onCommentBoxResizeStart;
|
|
21
|
-
exports.overShowComment = overShowComment;
|
|
22
|
-
exports.removeEditingComment = removeEditingComment;
|
|
23
|
-
exports.removeOverShowComment = removeOverShowComment;
|
|
24
|
-
exports.setEditingComment = setEditingComment;
|
|
25
|
-
exports.showComments = showComments;
|
|
26
|
-
exports.showHideAllComments = showHideAllComments;
|
|
27
|
-
exports.showHideComment = showHideComment;
|
|
28
|
-
var _lodash = _interopRequireDefault(require("lodash"));
|
|
29
|
-
var _cell = require("./cell");
|
|
30
|
-
var _context = require("../context");
|
|
31
|
-
var _location = require("./location");
|
|
32
|
-
var _utils = require("../utils");
|
|
33
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
34
|
-
var __assign = void 0 && (void 0).__assign || function () {
|
|
35
|
-
__assign = Object.assign || function (t) {
|
|
36
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
37
|
-
s = arguments[i];
|
|
38
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
39
|
-
}
|
|
40
|
-
return t;
|
|
41
|
-
};
|
|
42
|
-
return __assign.apply(this, arguments);
|
|
43
|
-
};
|
|
44
|
-
function getArrowCanvasSize(fromX, fromY, toX, toY) {
|
|
45
|
-
var left = toX - 5;
|
|
46
|
-
if (fromX < toX) {
|
|
47
|
-
left = fromX - 5;
|
|
48
|
-
}
|
|
49
|
-
var top = toY - 5;
|
|
50
|
-
if (fromY < toY) {
|
|
51
|
-
top = fromY - 5;
|
|
52
|
-
}
|
|
53
|
-
var width = Math.abs(fromX - toX) + 10;
|
|
54
|
-
var height = Math.abs(fromY - toY) + 10;
|
|
55
|
-
var x1 = width - 5;
|
|
56
|
-
var x2 = 5;
|
|
57
|
-
if (fromX < toX) {
|
|
58
|
-
x1 = 5;
|
|
59
|
-
x2 = width - 5;
|
|
60
|
-
}
|
|
61
|
-
var y1 = height - 5;
|
|
62
|
-
var y2 = 5;
|
|
63
|
-
if (fromY < toY) {
|
|
64
|
-
y1 = 5;
|
|
65
|
-
y2 = height - 5;
|
|
66
|
-
}
|
|
67
|
-
return {
|
|
68
|
-
left: left,
|
|
69
|
-
top: top,
|
|
70
|
-
width: width,
|
|
71
|
-
height: height,
|
|
72
|
-
fromX: x1,
|
|
73
|
-
fromY: y1,
|
|
74
|
-
toX: x2,
|
|
75
|
-
toY: y2
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
function drawArrow(rc, _a, color, theta, headlen) {
|
|
79
|
-
var left = _a.left,
|
|
80
|
-
top = _a.top,
|
|
81
|
-
width = _a.width,
|
|
82
|
-
height = _a.height,
|
|
83
|
-
fromX = _a.fromX,
|
|
84
|
-
fromY = _a.fromY,
|
|
85
|
-
toX = _a.toX,
|
|
86
|
-
toY = _a.toY;
|
|
87
|
-
if (rc) return;
|
|
88
|
-
var canvas = document.getElementById("arrowCanvas-".concat(rc));
|
|
89
|
-
var ctx = canvas.getContext("2d");
|
|
90
|
-
if (!canvas || !ctx) return;
|
|
91
|
-
canvas.style.width = "".concat(width, "px");
|
|
92
|
-
canvas.style.height = "".concat(height, "px");
|
|
93
|
-
canvas.width = width;
|
|
94
|
-
canvas.height = height;
|
|
95
|
-
canvas.style.left = "".concat(left, "px");
|
|
96
|
-
canvas.style.top = "".concat(top, "px");
|
|
97
|
-
var _b = canvas.getBoundingClientRect(),
|
|
98
|
-
canvasWidth = _b.width,
|
|
99
|
-
canvasHeight = _b.height;
|
|
100
|
-
ctx.clearRect(0, 0, canvasWidth, canvasHeight);
|
|
101
|
-
theta = theta || 30;
|
|
102
|
-
headlen = headlen || 6;
|
|
103
|
-
var arrowWidth = 1;
|
|
104
|
-
color = color || "#000";
|
|
105
|
-
var angle = Math.atan2(fromY - toY, fromX - toX) * 180 / Math.PI;
|
|
106
|
-
var angle1 = (angle + theta) * Math.PI / 180;
|
|
107
|
-
var angle2 = (angle - theta) * Math.PI / 180;
|
|
108
|
-
var topX = headlen * Math.cos(angle1);
|
|
109
|
-
var topY = headlen * Math.sin(angle1);
|
|
110
|
-
var botX = headlen * Math.cos(angle2);
|
|
111
|
-
var botY = headlen * Math.sin(angle2);
|
|
112
|
-
ctx.save();
|
|
113
|
-
ctx.beginPath();
|
|
114
|
-
var arrowX = fromX - topX;
|
|
115
|
-
var arrowY = fromY - topY;
|
|
116
|
-
ctx.moveTo(arrowX, arrowY);
|
|
117
|
-
ctx.moveTo(fromX, fromY);
|
|
118
|
-
ctx.lineTo(toX, toY);
|
|
119
|
-
ctx.lineWidth = arrowWidth;
|
|
120
|
-
ctx.strokeStyle = color;
|
|
121
|
-
ctx.stroke();
|
|
122
|
-
arrowX = toX + topX;
|
|
123
|
-
arrowY = toY + topY;
|
|
124
|
-
ctx.moveTo(arrowX, arrowY);
|
|
125
|
-
ctx.lineTo(toX, toY);
|
|
126
|
-
arrowX = toX + botX;
|
|
127
|
-
arrowY = toY + botY;
|
|
128
|
-
ctx.lineTo(arrowX, arrowY);
|
|
129
|
-
ctx.fillStyle = color;
|
|
130
|
-
ctx.fill();
|
|
131
|
-
ctx.restore();
|
|
132
|
-
}
|
|
133
|
-
var commentBoxProps = exports.commentBoxProps = {
|
|
134
|
-
defaultWidth: 144,
|
|
135
|
-
defaultHeight: 84,
|
|
136
|
-
currentObj: null,
|
|
137
|
-
currentWinW: null,
|
|
138
|
-
currentWinH: null,
|
|
139
|
-
resize: null,
|
|
140
|
-
resizeXY: null,
|
|
141
|
-
move: false,
|
|
142
|
-
moveXY: null,
|
|
143
|
-
cursorStartPosition: null
|
|
144
|
-
};
|
|
145
|
-
function getCellTopRightPostion(ctx, flowdata, r, c) {
|
|
146
|
-
var _a;
|
|
147
|
-
var row_pre = r - 1 === -1 ? 0 : ctx.visibledatarow[r - 1];
|
|
148
|
-
var col = ctx.visibledatacolumn[c];
|
|
149
|
-
var margeset = (0, _cell.mergeBorder)(ctx, flowdata, r, c);
|
|
150
|
-
if (margeset) {
|
|
151
|
-
row_pre = margeset.row[0];
|
|
152
|
-
_a = margeset.column, col = _a[1];
|
|
153
|
-
}
|
|
154
|
-
var toX = col;
|
|
155
|
-
var toY = row_pre;
|
|
156
|
-
return {
|
|
157
|
-
toX: toX,
|
|
158
|
-
toY: toY
|
|
159
|
-
};
|
|
160
|
-
}
|
|
161
|
-
function getCommentBoxByRC(ctx, flowdata, r, c) {
|
|
162
|
-
var _a;
|
|
163
|
-
var comment = (_a = flowdata[r][c]) === null || _a === void 0 ? void 0 : _a.ps;
|
|
164
|
-
var _b = getCellTopRightPostion(ctx, flowdata, r, c),
|
|
165
|
-
toX = _b.toX,
|
|
166
|
-
toY = _b.toY;
|
|
167
|
-
var left = (comment === null || comment === void 0 ? void 0 : comment.left) == null ? toX + 18 * ctx.zoomRatio : comment.left * ctx.zoomRatio;
|
|
168
|
-
var top = (comment === null || comment === void 0 ? void 0 : comment.top) == null ? toY - 18 * ctx.zoomRatio : comment.top * ctx.zoomRatio;
|
|
169
|
-
var width = (comment === null || comment === void 0 ? void 0 : comment.width) == null ? commentBoxProps.defaultWidth * ctx.zoomRatio : comment.width * ctx.zoomRatio;
|
|
170
|
-
var height = (comment === null || comment === void 0 ? void 0 : comment.height) == null ? commentBoxProps.defaultHeight * ctx.zoomRatio : comment.height * ctx.zoomRatio;
|
|
171
|
-
var value = (comment === null || comment === void 0 ? void 0 : comment.value) == null ? "" : comment.value;
|
|
172
|
-
if (top < 0) {
|
|
173
|
-
top = 2;
|
|
174
|
-
}
|
|
175
|
-
var size = getArrowCanvasSize(left, top, toX, toY);
|
|
176
|
-
var rc = "".concat(r, "_").concat(c);
|
|
177
|
-
return {
|
|
178
|
-
r: r,
|
|
179
|
-
c: c,
|
|
180
|
-
rc: rc,
|
|
181
|
-
left: left,
|
|
182
|
-
top: top,
|
|
183
|
-
width: width,
|
|
184
|
-
height: height,
|
|
185
|
-
value: value,
|
|
186
|
-
size: size,
|
|
187
|
-
autoFocus: false
|
|
188
|
-
};
|
|
189
|
-
}
|
|
190
|
-
function setEditingComment(ctx, flowdata, r, c) {
|
|
191
|
-
ctx.editingCommentBox = getCommentBoxByRC(ctx, flowdata, r, c);
|
|
192
|
-
}
|
|
193
|
-
function removeEditingComment(ctx, globalCache) {
|
|
194
|
-
var _a, _b;
|
|
195
|
-
var editingCommentBoxEle = globalCache.editingCommentBoxEle;
|
|
196
|
-
ctx.editingCommentBox = undefined;
|
|
197
|
-
var r = editingCommentBoxEle === null || editingCommentBoxEle === void 0 ? void 0 : editingCommentBoxEle.dataset.r;
|
|
198
|
-
var c = editingCommentBoxEle === null || editingCommentBoxEle === void 0 ? void 0 : editingCommentBoxEle.dataset.c;
|
|
199
|
-
if (!r || !c || !editingCommentBoxEle) return;
|
|
200
|
-
r = parseInt(r, 10);
|
|
201
|
-
c = parseInt(c, 10);
|
|
202
|
-
var value = editingCommentBoxEle.innerHTML || "";
|
|
203
|
-
var flowdata = (0, _context.getFlowdata)(ctx);
|
|
204
|
-
globalCache.editingCommentBoxEle = undefined;
|
|
205
|
-
if (!flowdata) return;
|
|
206
|
-
if (((_b = (_a = ctx.hooks).beforeUpdateComment) === null || _b === void 0 ? void 0 : _b.call(_a, r, c, value)) === false) {
|
|
207
|
-
return;
|
|
208
|
-
}
|
|
209
|
-
var cell = flowdata === null || flowdata === void 0 ? void 0 : flowdata[r][c];
|
|
210
|
-
if (!(cell === null || cell === void 0 ? void 0 : cell.ps)) return;
|
|
211
|
-
var oldValue = cell.ps.value;
|
|
212
|
-
cell.ps.value = value;
|
|
213
|
-
if (!cell.ps.isShow) {
|
|
214
|
-
ctx.commentBoxes = _lodash.default.filter(ctx.commentBoxes, function (v) {
|
|
215
|
-
return v.rc !== "".concat(r, "_").concat(c);
|
|
216
|
-
});
|
|
217
|
-
}
|
|
218
|
-
if (ctx.hooks.afterUpdateComment) {
|
|
219
|
-
setTimeout(function () {
|
|
220
|
-
var _a, _b;
|
|
221
|
-
(_b = (_a = ctx.hooks).afterUpdateComment) === null || _b === void 0 ? void 0 : _b.call(_a, r, c, oldValue, value);
|
|
222
|
-
});
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
function newComment(ctx, globalCache, r, c) {
|
|
226
|
-
var _a, _b;
|
|
227
|
-
var allowEdit = (0, _utils.isAllowEdit)(ctx);
|
|
228
|
-
if (!allowEdit) return;
|
|
229
|
-
if (((_b = (_a = ctx.hooks).beforeInsertComment) === null || _b === void 0 ? void 0 : _b.call(_a, r, c)) === false) {
|
|
230
|
-
return;
|
|
231
|
-
}
|
|
232
|
-
if (globalCache) {
|
|
233
|
-
removeEditingComment(ctx, globalCache);
|
|
234
|
-
}
|
|
235
|
-
var flowdata = (0, _context.getFlowdata)(ctx);
|
|
236
|
-
if (!flowdata) return;
|
|
237
|
-
var cell = flowdata[r][c];
|
|
238
|
-
if (cell == null) {
|
|
239
|
-
cell = {};
|
|
240
|
-
flowdata[r][c] = cell;
|
|
241
|
-
}
|
|
242
|
-
cell.ps = {
|
|
243
|
-
left: null,
|
|
244
|
-
top: null,
|
|
245
|
-
width: null,
|
|
246
|
-
height: null,
|
|
247
|
-
value: "",
|
|
248
|
-
isShow: false
|
|
249
|
-
};
|
|
250
|
-
ctx.editingCommentBox = __assign(__assign({}, getCommentBoxByRC(ctx, flowdata, r, c)), {
|
|
251
|
-
autoFocus: true
|
|
252
|
-
});
|
|
253
|
-
if (ctx.hooks.afterInsertComment) {
|
|
254
|
-
setTimeout(function () {
|
|
255
|
-
var _a, _b;
|
|
256
|
-
(_b = (_a = ctx.hooks).afterInsertComment) === null || _b === void 0 ? void 0 : _b.call(_a, r, c);
|
|
257
|
-
});
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
function editComment(ctx, globalCache, r, c) {
|
|
261
|
-
var _a;
|
|
262
|
-
var allowEdit = (0, _utils.isAllowEdit)(ctx);
|
|
263
|
-
if (!allowEdit) return;
|
|
264
|
-
var flowdata = (0, _context.getFlowdata)(ctx);
|
|
265
|
-
removeEditingComment(ctx, globalCache);
|
|
266
|
-
var comment = (_a = flowdata === null || flowdata === void 0 ? void 0 : flowdata[r][c]) === null || _a === void 0 ? void 0 : _a.ps;
|
|
267
|
-
var commentBoxes = _lodash.default.concat(ctx.commentBoxes, ctx.editingCommentBox);
|
|
268
|
-
if (_lodash.default.findIndex(commentBoxes, function (v) {
|
|
269
|
-
return (v === null || v === void 0 ? void 0 : v.rc) === "".concat(r, "_").concat(c);
|
|
270
|
-
}) !== -1) {
|
|
271
|
-
var editCommentBox = document.getElementById("comment-editor-".concat(r, "_").concat(c));
|
|
272
|
-
editCommentBox === null || editCommentBox === void 0 ? void 0 : editCommentBox.focus();
|
|
273
|
-
}
|
|
274
|
-
if (comment) {
|
|
275
|
-
ctx.editingCommentBox = __assign(__assign({}, getCommentBoxByRC(ctx, flowdata, r, c)), {
|
|
276
|
-
autoFocus: true
|
|
277
|
-
});
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
function deleteComment(ctx, globalCache, r, c) {
|
|
281
|
-
var _a, _b;
|
|
282
|
-
var allowEdit = (0, _utils.isAllowEdit)(ctx);
|
|
283
|
-
if (!allowEdit) return;
|
|
284
|
-
if (((_b = (_a = ctx.hooks).beforeDeleteComment) === null || _b === void 0 ? void 0 : _b.call(_a, r, c)) === false) {
|
|
285
|
-
return;
|
|
286
|
-
}
|
|
287
|
-
var flowdata = (0, _context.getFlowdata)(ctx);
|
|
288
|
-
if (!flowdata) return;
|
|
289
|
-
var cell = flowdata[r][c];
|
|
290
|
-
if (!cell) return;
|
|
291
|
-
cell.ps = undefined;
|
|
292
|
-
if (ctx.hooks.afterDeleteComment) {
|
|
293
|
-
setTimeout(function () {
|
|
294
|
-
var _a, _b;
|
|
295
|
-
(_b = (_a = ctx.hooks).afterDeleteComment) === null || _b === void 0 ? void 0 : _b.call(_a, r, c);
|
|
296
|
-
});
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
function showComments(ctx, commentShowCells) {
|
|
300
|
-
var flowdata = (0, _context.getFlowdata)(ctx);
|
|
301
|
-
if (flowdata) {
|
|
302
|
-
var commentBoxes = commentShowCells.map(function (_a) {
|
|
303
|
-
var r = _a.r,
|
|
304
|
-
c = _a.c;
|
|
305
|
-
return getCommentBoxByRC(ctx, flowdata, r, c);
|
|
306
|
-
});
|
|
307
|
-
ctx.commentBoxes = commentBoxes;
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
function showHideComment(ctx, globalCache, r, c) {
|
|
311
|
-
var _a;
|
|
312
|
-
var flowdata = (0, _context.getFlowdata)(ctx);
|
|
313
|
-
var comment = (_a = flowdata === null || flowdata === void 0 ? void 0 : flowdata[r][c]) === null || _a === void 0 ? void 0 : _a.ps;
|
|
314
|
-
if (!comment) return;
|
|
315
|
-
var isShow = comment.isShow;
|
|
316
|
-
var rc = "".concat(r, "_").concat(c);
|
|
317
|
-
if (isShow) {
|
|
318
|
-
comment.isShow = false;
|
|
319
|
-
ctx.commentBoxes = _lodash.default.filter(ctx.commentBoxes, function (v) {
|
|
320
|
-
return v.rc !== rc;
|
|
321
|
-
});
|
|
322
|
-
} else {
|
|
323
|
-
comment.isShow = true;
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
function showHideAllComments(ctx) {
|
|
327
|
-
var _a, _b;
|
|
328
|
-
var flowdata = (0, _context.getFlowdata)(ctx);
|
|
329
|
-
if (!flowdata) return;
|
|
330
|
-
var isAllShow = true;
|
|
331
|
-
var allComments = [];
|
|
332
|
-
for (var r = 0; r < flowdata.length; r += 1) {
|
|
333
|
-
for (var c = 0; c < flowdata[0].length; c += 1) {
|
|
334
|
-
var cell = flowdata[r][c];
|
|
335
|
-
if (cell === null || cell === void 0 ? void 0 : cell.ps) {
|
|
336
|
-
allComments.push({
|
|
337
|
-
r: r,
|
|
338
|
-
c: c
|
|
339
|
-
});
|
|
340
|
-
if (!cell.ps.isShow) {
|
|
341
|
-
isAllShow = false;
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
var rcs = [];
|
|
347
|
-
if (allComments.length > 0) {
|
|
348
|
-
if (isAllShow) {
|
|
349
|
-
for (var i = 0; i < allComments.length; i += 1) {
|
|
350
|
-
var _c = allComments[i],
|
|
351
|
-
r = _c.r,
|
|
352
|
-
c = _c.c;
|
|
353
|
-
var comment = (_a = flowdata[r][c]) === null || _a === void 0 ? void 0 : _a.ps;
|
|
354
|
-
if (comment === null || comment === void 0 ? void 0 : comment.isShow) {
|
|
355
|
-
comment.isShow = false;
|
|
356
|
-
rcs.push("".concat(r, "_").concat(c));
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
ctx.commentBoxes = [];
|
|
360
|
-
} else {
|
|
361
|
-
for (var i = 0; i < allComments.length; i += 1) {
|
|
362
|
-
var _d = allComments[i],
|
|
363
|
-
r = _d.r,
|
|
364
|
-
c = _d.c;
|
|
365
|
-
var comment = (_b = flowdata[r][c]) === null || _b === void 0 ? void 0 : _b.ps;
|
|
366
|
-
if (comment && !comment.isShow) {
|
|
367
|
-
comment.isShow = true;
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
function removeOverShowComment(ctx) {
|
|
374
|
-
ctx.hoveredCommentBox = undefined;
|
|
375
|
-
}
|
|
376
|
-
function overShowComment(ctx, e, scrollX, scrollY, container) {
|
|
377
|
-
var _a, _b, _c;
|
|
378
|
-
var _d, _e, _f, _g, _h;
|
|
379
|
-
var flowdata = (0, _context.getFlowdata)(ctx);
|
|
380
|
-
if (!flowdata) return;
|
|
381
|
-
var scrollLeft = scrollX.scrollLeft;
|
|
382
|
-
var scrollTop = scrollY.scrollTop;
|
|
383
|
-
var rect = container.getBoundingClientRect();
|
|
384
|
-
var x = e.pageX - rect.left - ctx.rowHeaderWidth;
|
|
385
|
-
var y = e.pageY - rect.top - ctx.columnHeaderHeight;
|
|
386
|
-
var offsetX = 0;
|
|
387
|
-
var offsetY = 0;
|
|
388
|
-
x += scrollLeft;
|
|
389
|
-
y += scrollTop;
|
|
390
|
-
var r = (0, _location.rowLocation)(y, ctx.visibledatarow)[2];
|
|
391
|
-
var c = (0, _location.colLocation)(x, ctx.visibledatacolumn)[2];
|
|
392
|
-
var margeset = (0, _cell.mergeBorder)(ctx, flowdata, r, c);
|
|
393
|
-
if (margeset) {
|
|
394
|
-
_a = margeset.row, r = _a[2];
|
|
395
|
-
_b = margeset.column, c = _b[2];
|
|
396
|
-
}
|
|
397
|
-
var firstSelection = (_d = ctx.luckysheet_select_save) === null || _d === void 0 ? void 0 : _d[0];
|
|
398
|
-
var row_index = firstSelection === null || firstSelection === void 0 ? void 0 : firstSelection.row_focus;
|
|
399
|
-
var col_index = firstSelection === null || firstSelection === void 0 ? void 0 : firstSelection.column_focus;
|
|
400
|
-
if (r === row_index && c === col_index) {
|
|
401
|
-
ctx.hoveredCommentBox = undefined;
|
|
402
|
-
return;
|
|
403
|
-
}
|
|
404
|
-
var rc = "".concat(r, "_").concat(c);
|
|
405
|
-
var comment = (_f = (_e = flowdata[r]) === null || _e === void 0 ? void 0 : _e[c]) === null || _f === void 0 ? void 0 : _f.ps;
|
|
406
|
-
if (comment == null || comment.isShow || _lodash.default.findIndex(ctx.commentBoxes, function (v) {
|
|
407
|
-
return v.rc === rc;
|
|
408
|
-
}) !== -1 || ((_g = ctx.editingCommentBox) === null || _g === void 0 ? void 0 : _g.rc) === rc) {
|
|
409
|
-
ctx.hoveredCommentBox = undefined;
|
|
410
|
-
return;
|
|
411
|
-
}
|
|
412
|
-
if (((_h = ctx.hoveredCommentBox) === null || _h === void 0 ? void 0 : _h.rc) === rc) return;
|
|
413
|
-
var row_pre = r - 1 === -1 ? 0 : ctx.visibledatarow[r - 1];
|
|
414
|
-
var col = ctx.visibledatacolumn[c];
|
|
415
|
-
if (margeset) {
|
|
416
|
-
row_pre = margeset.row[0];
|
|
417
|
-
_c = margeset.column, col = _c[1];
|
|
418
|
-
}
|
|
419
|
-
var toX = col + offsetX;
|
|
420
|
-
var toY = row_pre + offsetY;
|
|
421
|
-
var left = comment.left == null ? toX + 18 * ctx.zoomRatio : comment.left * ctx.zoomRatio;
|
|
422
|
-
var top = comment.top == null ? toY - 18 * ctx.zoomRatio : comment.top * ctx.zoomRatio;
|
|
423
|
-
if (top < 0) {
|
|
424
|
-
top = 2;
|
|
425
|
-
}
|
|
426
|
-
var width = comment.width == null ? commentBoxProps.defaultWidth * ctx.zoomRatio : comment.width * ctx.zoomRatio;
|
|
427
|
-
var height = comment.height == null ? commentBoxProps.defaultHeight * ctx.zoomRatio : comment.height * ctx.zoomRatio;
|
|
428
|
-
var size = getArrowCanvasSize(left, top, toX, toY);
|
|
429
|
-
var value = comment.value == null ? "" : comment.value;
|
|
430
|
-
ctx.hoveredCommentBox = {
|
|
431
|
-
r: r,
|
|
432
|
-
c: c,
|
|
433
|
-
rc: rc,
|
|
434
|
-
left: left,
|
|
435
|
-
top: top,
|
|
436
|
-
width: width,
|
|
437
|
-
height: height,
|
|
438
|
-
size: size,
|
|
439
|
-
value: value,
|
|
440
|
-
autoFocus: false
|
|
441
|
-
};
|
|
442
|
-
}
|
|
443
|
-
function getCommentBoxPosition(commentId) {
|
|
444
|
-
var box = document.getElementById(commentId);
|
|
445
|
-
if (!box) return undefined;
|
|
446
|
-
var _a = box.getBoundingClientRect(),
|
|
447
|
-
width = _a.width,
|
|
448
|
-
height = _a.height;
|
|
449
|
-
var left = box.offsetLeft;
|
|
450
|
-
var top = box.offsetTop;
|
|
451
|
-
return {
|
|
452
|
-
left: left,
|
|
453
|
-
top: top,
|
|
454
|
-
width: width,
|
|
455
|
-
height: height
|
|
456
|
-
};
|
|
457
|
-
}
|
|
458
|
-
function onCommentBoxResizeStart(ctx, globalCache, e, _a, resizingId, resizingSide) {
|
|
459
|
-
var r = _a.r,
|
|
460
|
-
c = _a.c,
|
|
461
|
-
rc = _a.rc;
|
|
462
|
-
var position = getCommentBoxPosition(resizingId);
|
|
463
|
-
if (position) {
|
|
464
|
-
_lodash.default.set(globalCache, "commentBox", {
|
|
465
|
-
cursorMoveStartPosition: {
|
|
466
|
-
x: e.pageX,
|
|
467
|
-
y: e.pageY
|
|
468
|
-
},
|
|
469
|
-
resizingId: resizingId,
|
|
470
|
-
resizingSide: resizingSide,
|
|
471
|
-
commentRC: {
|
|
472
|
-
r: r,
|
|
473
|
-
c: c,
|
|
474
|
-
rc: rc
|
|
475
|
-
},
|
|
476
|
-
boxInitialPosition: position
|
|
477
|
-
});
|
|
478
|
-
}
|
|
479
|
-
}
|
|
480
|
-
function onCommentBoxResize(ctx, globalCache, e) {
|
|
481
|
-
if (ctx.allowEdit === false) return false;
|
|
482
|
-
var commentBox = globalCache === null || globalCache === void 0 ? void 0 : globalCache.commentBox;
|
|
483
|
-
if ((commentBox === null || commentBox === void 0 ? void 0 : commentBox.resizingId) && commentBox.resizingSide) {
|
|
484
|
-
var box = document.getElementById(commentBox.resizingId);
|
|
485
|
-
var _a = commentBox.cursorMoveStartPosition,
|
|
486
|
-
startX = _a.x,
|
|
487
|
-
startY = _a.y;
|
|
488
|
-
var _b = commentBox.boxInitialPosition,
|
|
489
|
-
top_1 = _b.top,
|
|
490
|
-
left = _b.left,
|
|
491
|
-
width = _b.width,
|
|
492
|
-
height = _b.height;
|
|
493
|
-
var dx = e.pageX - startX;
|
|
494
|
-
var dy = e.pageY - startY;
|
|
495
|
-
var minHeight = 60 * ctx.zoomRatio;
|
|
496
|
-
var minWidth = 1.5 * 60 * ctx.zoomRatio;
|
|
497
|
-
if (["lm", "lt", "lb"].includes(commentBox.resizingSide)) {
|
|
498
|
-
if (width - dx < minWidth) {
|
|
499
|
-
left += width - minWidth;
|
|
500
|
-
width = minWidth;
|
|
501
|
-
} else {
|
|
502
|
-
left += dx;
|
|
503
|
-
width -= dx;
|
|
504
|
-
}
|
|
505
|
-
if (left < 0) left = 0;
|
|
506
|
-
box.style.left = "".concat(left, "px");
|
|
507
|
-
}
|
|
508
|
-
if (["rm", "rt", "rb"].includes(commentBox.resizingSide)) {
|
|
509
|
-
width = width + dx < minWidth ? minWidth : width + dx;
|
|
510
|
-
}
|
|
511
|
-
if (["mt", "lt", "rt"].includes(commentBox.resizingSide)) {
|
|
512
|
-
if (height - dy < minHeight) {
|
|
513
|
-
top_1 += height - minHeight;
|
|
514
|
-
height = minHeight;
|
|
515
|
-
} else {
|
|
516
|
-
top_1 += dy;
|
|
517
|
-
height -= dy;
|
|
518
|
-
}
|
|
519
|
-
if (top_1 < 0) top_1 = 0;
|
|
520
|
-
box.style.top = "".concat(top_1, "px");
|
|
521
|
-
}
|
|
522
|
-
if (["mb", "lb", "rb"].includes(commentBox.resizingSide)) {
|
|
523
|
-
height = height + dy < minHeight ? minHeight : height + dy;
|
|
524
|
-
}
|
|
525
|
-
box.style.width = "".concat(width, "px");
|
|
526
|
-
box.style.height = "".concat(height, "px");
|
|
527
|
-
return true;
|
|
528
|
-
}
|
|
529
|
-
return false;
|
|
530
|
-
}
|
|
531
|
-
function onCommentBoxResizeEnd(ctx, globalCache) {
|
|
532
|
-
var _a;
|
|
533
|
-
if ((_a = globalCache.commentBox) === null || _a === void 0 ? void 0 : _a.resizingId) {
|
|
534
|
-
var _b = globalCache.commentBox,
|
|
535
|
-
resizingId = _b.resizingId,
|
|
536
|
-
_c = _b.commentRC,
|
|
537
|
-
r = _c.r,
|
|
538
|
-
c = _c.c;
|
|
539
|
-
globalCache.commentBox.resizingId = undefined;
|
|
540
|
-
var position = getCommentBoxPosition(resizingId);
|
|
541
|
-
if (position) {
|
|
542
|
-
var top_2 = position.top,
|
|
543
|
-
left = position.left,
|
|
544
|
-
width = position.width,
|
|
545
|
-
height = position.height;
|
|
546
|
-
var flowdata = (0, _context.getFlowdata)(ctx);
|
|
547
|
-
var cell = flowdata === null || flowdata === void 0 ? void 0 : flowdata[r][c];
|
|
548
|
-
if (!flowdata || !(cell === null || cell === void 0 ? void 0 : cell.ps)) return;
|
|
549
|
-
cell.ps.left = left / ctx.zoomRatio;
|
|
550
|
-
cell.ps.top = top_2 / ctx.zoomRatio;
|
|
551
|
-
cell.ps.width = width / ctx.zoomRatio;
|
|
552
|
-
cell.ps.height = height / ctx.zoomRatio;
|
|
553
|
-
setEditingComment(ctx, flowdata, r, c);
|
|
554
|
-
}
|
|
555
|
-
}
|
|
556
|
-
}
|
|
557
|
-
function onCommentBoxMoveStart(ctx, globalCache, e, _a, movingId) {
|
|
558
|
-
var r = _a.r,
|
|
559
|
-
c = _a.c,
|
|
560
|
-
rc = _a.rc;
|
|
561
|
-
var position = getCommentBoxPosition(movingId);
|
|
562
|
-
if (position) {
|
|
563
|
-
var top_3 = position.top,
|
|
564
|
-
left = position.left;
|
|
565
|
-
_lodash.default.set(globalCache, "commentBox", {
|
|
566
|
-
cursorMoveStartPosition: {
|
|
567
|
-
x: e.pageX,
|
|
568
|
-
y: e.pageY
|
|
569
|
-
},
|
|
570
|
-
movingId: movingId,
|
|
571
|
-
commentRC: {
|
|
572
|
-
r: r,
|
|
573
|
-
c: c,
|
|
574
|
-
rc: rc
|
|
575
|
-
},
|
|
576
|
-
boxInitialPosition: {
|
|
577
|
-
left: left,
|
|
578
|
-
top: top_3
|
|
579
|
-
}
|
|
580
|
-
});
|
|
581
|
-
}
|
|
582
|
-
}
|
|
583
|
-
function onCommentBoxMove(ctx, globalCache, e) {
|
|
584
|
-
var allowEdit = (0, _utils.isAllowEdit)(ctx);
|
|
585
|
-
if (!allowEdit) return false;
|
|
586
|
-
var commentBox = globalCache === null || globalCache === void 0 ? void 0 : globalCache.commentBox;
|
|
587
|
-
if (commentBox === null || commentBox === void 0 ? void 0 : commentBox.movingId) {
|
|
588
|
-
var box = document.getElementById(commentBox.movingId);
|
|
589
|
-
var _a = commentBox.cursorMoveStartPosition,
|
|
590
|
-
startX = _a.x,
|
|
591
|
-
startY = _a.y;
|
|
592
|
-
var _b = commentBox.boxInitialPosition,
|
|
593
|
-
top_4 = _b.top,
|
|
594
|
-
left = _b.left;
|
|
595
|
-
left += e.pageX - startX;
|
|
596
|
-
top_4 += e.pageY - startY;
|
|
597
|
-
if (top_4 < 0) top_4 = 0;
|
|
598
|
-
box.style.left = "".concat(left, "px");
|
|
599
|
-
box.style.top = "".concat(top_4, "px");
|
|
600
|
-
return true;
|
|
601
|
-
}
|
|
602
|
-
return false;
|
|
603
|
-
}
|
|
604
|
-
function onCommentBoxMoveEnd(ctx, globalCache) {
|
|
605
|
-
var _a;
|
|
606
|
-
if ((_a = globalCache.commentBox) === null || _a === void 0 ? void 0 : _a.movingId) {
|
|
607
|
-
var _b = globalCache.commentBox,
|
|
608
|
-
movingId = _b.movingId,
|
|
609
|
-
_c = _b.commentRC,
|
|
610
|
-
r = _c.r,
|
|
611
|
-
c = _c.c;
|
|
612
|
-
globalCache.commentBox.movingId = undefined;
|
|
613
|
-
var position = getCommentBoxPosition(movingId);
|
|
614
|
-
if (position) {
|
|
615
|
-
var top_5 = position.top,
|
|
616
|
-
left = position.left;
|
|
617
|
-
var flowdata = (0, _context.getFlowdata)(ctx);
|
|
618
|
-
var cell = flowdata === null || flowdata === void 0 ? void 0 : flowdata[r][c];
|
|
619
|
-
if (!flowdata || !(cell === null || cell === void 0 ? void 0 : cell.ps)) return;
|
|
620
|
-
cell.ps.left = left / ctx.zoomRatio;
|
|
621
|
-
cell.ps.top = top_5 / ctx.zoomRatio;
|
|
622
|
-
setEditingComment(ctx, flowdata, r, c);
|
|
623
|
-
}
|
|
624
|
-
}
|
|
625
|
-
}
|