@fileverse-dev/fortune-core 1.0.5 → 1.0.7
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 +6 -5
- package/dist/index.esm.js +0 -80253
- package/dist/index.js +0 -80599
- 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
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Context } from "../context";
|
|
2
|
-
export declare function handleScreenShot(ctx: Context): string | undefined;
|
|
1
|
+
import { Context } from "../context";
|
|
2
|
+
export declare function handleScreenShot(ctx: Context): string | undefined;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { Canvas, defaultStyle } from "../canvas";
|
|
2
|
+
import { hasPartMC } from "./validation";
|
|
3
|
+
export function handleScreenShot(ctx) {
|
|
4
|
+
if (ctx.luckysheet_select_save == null) return undefined;
|
|
5
|
+
if (ctx.luckysheet_select_save.length === 0) {
|
|
6
|
+
return undefined;
|
|
7
|
+
}
|
|
8
|
+
if (ctx.luckysheet_select_save.length > 1) {
|
|
9
|
+
return undefined;
|
|
10
|
+
}
|
|
11
|
+
if (ctx.config.merge != null) {
|
|
12
|
+
var has_PartMC = false;
|
|
13
|
+
for (var s = 0; s < ctx.luckysheet_select_save.length; s += 1) {
|
|
14
|
+
var r1 = ctx.luckysheet_select_save[s].row[0];
|
|
15
|
+
var r2 = ctx.luckysheet_select_save[s].row[1];
|
|
16
|
+
var c1 = ctx.luckysheet_select_save[s].column[0];
|
|
17
|
+
var c2 = ctx.luckysheet_select_save[s].column[1];
|
|
18
|
+
has_PartMC = hasPartMC(ctx, ctx.config, r1, r2, c1, c2);
|
|
19
|
+
if (has_PartMC) {
|
|
20
|
+
break;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
if (has_PartMC) {
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
var st_r = ctx.luckysheet_select_save[0].row[0];
|
|
28
|
+
var ed_r = ctx.luckysheet_select_save[0].row[1];
|
|
29
|
+
var st_c = ctx.luckysheet_select_save[0].column[0];
|
|
30
|
+
var ed_c = ctx.luckysheet_select_save[0].column[1];
|
|
31
|
+
var scrollHeight;
|
|
32
|
+
var rh_height;
|
|
33
|
+
if (st_r - 1 < 0) {
|
|
34
|
+
scrollHeight = 0;
|
|
35
|
+
rh_height = ctx.visibledatarow[ed_r];
|
|
36
|
+
} else {
|
|
37
|
+
scrollHeight = ctx.visibledatarow[st_r - 1];
|
|
38
|
+
rh_height = ctx.visibledatarow[ed_r] - ctx.visibledatarow[st_r - 1];
|
|
39
|
+
}
|
|
40
|
+
var scrollWidth;
|
|
41
|
+
var ch_width;
|
|
42
|
+
if (st_c - 1 < 0) {
|
|
43
|
+
scrollWidth = 0;
|
|
44
|
+
ch_width = ctx.visibledatacolumn[ed_c];
|
|
45
|
+
} else {
|
|
46
|
+
scrollWidth = ctx.visibledatacolumn[st_c - 1];
|
|
47
|
+
ch_width = ctx.visibledatacolumn[ed_c] - ctx.visibledatacolumn[st_c - 1];
|
|
48
|
+
}
|
|
49
|
+
var newCanvasElement = document.createElement("canvas");
|
|
50
|
+
newCanvasElement.width = Math.ceil(ch_width * devicePixelRatio);
|
|
51
|
+
newCanvasElement.height = Math.ceil(rh_height * devicePixelRatio);
|
|
52
|
+
newCanvasElement.style.width = "".concat(ch_width, "px");
|
|
53
|
+
newCanvasElement.style.height = "".concat(rh_height, "px");
|
|
54
|
+
var newCanvas = new Canvas(newCanvasElement, ctx);
|
|
55
|
+
newCanvas.drawMain({
|
|
56
|
+
scrollWidth: scrollWidth,
|
|
57
|
+
scrollHeight: scrollHeight,
|
|
58
|
+
drawWidth: ch_width,
|
|
59
|
+
drawHeight: rh_height,
|
|
60
|
+
offsetLeft: 1,
|
|
61
|
+
offsetTop: 1,
|
|
62
|
+
clear: true
|
|
63
|
+
});
|
|
64
|
+
var ctx_newCanvas = newCanvasElement.getContext("2d");
|
|
65
|
+
if (ctx_newCanvas == null) return undefined;
|
|
66
|
+
ctx_newCanvas.beginPath();
|
|
67
|
+
ctx_newCanvas.moveTo(0, 0);
|
|
68
|
+
ctx_newCanvas.lineTo(0, ctx.devicePixelRatio * rh_height);
|
|
69
|
+
ctx_newCanvas.lineWidth = ctx.devicePixelRatio * 2;
|
|
70
|
+
ctx_newCanvas.strokeStyle = defaultStyle.strokeStyle;
|
|
71
|
+
ctx_newCanvas.stroke();
|
|
72
|
+
ctx_newCanvas.closePath();
|
|
73
|
+
ctx_newCanvas.beginPath();
|
|
74
|
+
ctx_newCanvas.moveTo(0, 0);
|
|
75
|
+
ctx_newCanvas.lineTo(ctx.devicePixelRatio * ch_width, 0);
|
|
76
|
+
ctx_newCanvas.lineWidth = ctx.devicePixelRatio * 2;
|
|
77
|
+
ctx_newCanvas.strokeStyle = defaultStyle.strokeStyle;
|
|
78
|
+
ctx_newCanvas.stroke();
|
|
79
|
+
ctx_newCanvas.closePath();
|
|
80
|
+
var image = new Image();
|
|
81
|
+
var url = newCanvasElement.toDataURL("image/png");
|
|
82
|
+
image.src = url;
|
|
83
|
+
if (ch_width > rh_height) {
|
|
84
|
+
image.style.width = "100%";
|
|
85
|
+
} else {
|
|
86
|
+
image.style.height = "100%";
|
|
87
|
+
}
|
|
88
|
+
newCanvasElement.remove();
|
|
89
|
+
return image.src;
|
|
90
|
+
}
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
import { Context } from "../context";
|
|
2
|
-
import { CellMatrix, SearchResult, GlobalCache } from "../types";
|
|
3
|
-
export declare function getSearchIndexArr(searchText: string, range: {
|
|
4
|
-
row: number[];
|
|
5
|
-
column: number[];
|
|
6
|
-
}[], flowdata: CellMatrix, { regCheck, wordCheck, caseCheck }?: {
|
|
7
|
-
regCheck: boolean;
|
|
8
|
-
wordCheck: boolean;
|
|
9
|
-
caseCheck: boolean;
|
|
10
|
-
}): {
|
|
11
|
-
r: number;
|
|
12
|
-
c: number;
|
|
13
|
-
}[];
|
|
14
|
-
export declare function searchNext(ctx: Context, searchText: string, checkModes: {
|
|
15
|
-
regCheck: boolean;
|
|
16
|
-
wordCheck: boolean;
|
|
17
|
-
caseCheck: boolean;
|
|
18
|
-
}): string | null;
|
|
19
|
-
export declare function searchAll(ctx: Context, searchText: string, checkModes: {
|
|
20
|
-
regCheck: boolean;
|
|
21
|
-
wordCheck: boolean;
|
|
22
|
-
caseCheck: boolean;
|
|
23
|
-
}): SearchResult[];
|
|
24
|
-
export declare function onSearchDialogMoveStart(globalCache: GlobalCache, e: MouseEvent, container: HTMLDivElement): void;
|
|
25
|
-
export declare function onSearchDialogMove(globalCache: GlobalCache, e: MouseEvent): void;
|
|
26
|
-
export declare function onSearchDialogMoveEnd(globalCache: GlobalCache): void;
|
|
27
|
-
export declare function replace(ctx: Context, searchText: string, replaceText: string, checkModes: {
|
|
28
|
-
regCheck: boolean;
|
|
29
|
-
wordCheck: boolean;
|
|
30
|
-
caseCheck: boolean;
|
|
31
|
-
}): string | null;
|
|
32
|
-
export declare function replaceAll(ctx: Context, searchText: string, replaceText: string, checkModes: {
|
|
33
|
-
regCheck: boolean;
|
|
34
|
-
wordCheck: boolean;
|
|
35
|
-
caseCheck: boolean;
|
|
36
|
-
}): string;
|
|
1
|
+
import { Context } from "../context";
|
|
2
|
+
import { CellMatrix, SearchResult, GlobalCache } from "../types";
|
|
3
|
+
export declare function getSearchIndexArr(searchText: string, range: {
|
|
4
|
+
row: number[];
|
|
5
|
+
column: number[];
|
|
6
|
+
}[], flowdata: CellMatrix, { regCheck, wordCheck, caseCheck }?: {
|
|
7
|
+
regCheck: boolean;
|
|
8
|
+
wordCheck: boolean;
|
|
9
|
+
caseCheck: boolean;
|
|
10
|
+
}): {
|
|
11
|
+
r: number;
|
|
12
|
+
c: number;
|
|
13
|
+
}[];
|
|
14
|
+
export declare function searchNext(ctx: Context, searchText: string, checkModes: {
|
|
15
|
+
regCheck: boolean;
|
|
16
|
+
wordCheck: boolean;
|
|
17
|
+
caseCheck: boolean;
|
|
18
|
+
}): string | null;
|
|
19
|
+
export declare function searchAll(ctx: Context, searchText: string, checkModes: {
|
|
20
|
+
regCheck: boolean;
|
|
21
|
+
wordCheck: boolean;
|
|
22
|
+
caseCheck: boolean;
|
|
23
|
+
}): SearchResult[];
|
|
24
|
+
export declare function onSearchDialogMoveStart(globalCache: GlobalCache, e: MouseEvent, container: HTMLDivElement): void;
|
|
25
|
+
export declare function onSearchDialogMove(globalCache: GlobalCache, e: MouseEvent): void;
|
|
26
|
+
export declare function onSearchDialogMoveEnd(globalCache: GlobalCache): void;
|
|
27
|
+
export declare function replace(ctx: Context, searchText: string, replaceText: string, checkModes: {
|
|
28
|
+
regCheck: boolean;
|
|
29
|
+
wordCheck: boolean;
|
|
30
|
+
caseCheck: boolean;
|
|
31
|
+
}): string | null;
|
|
32
|
+
export declare function replaceAll(ctx: Context, searchText: string, replaceText: string, checkModes: {
|
|
33
|
+
regCheck: boolean;
|
|
34
|
+
wordCheck: boolean;
|
|
35
|
+
caseCheck: boolean;
|
|
36
|
+
}): string;
|
|
@@ -0,0 +1,388 @@
|
|
|
1
|
+
import _ from "lodash";
|
|
2
|
+
import { getFlowdata } from "../context";
|
|
3
|
+
import { locale } from "../locale";
|
|
4
|
+
import { chatatABC, getRegExpStr, getSheetIndex, isAllowEdit, replaceHtml } from "../utils";
|
|
5
|
+
import { setCellValue } from "./cell";
|
|
6
|
+
import { valueShowEs } from "./format";
|
|
7
|
+
import { normalizeSelection, scrollToHighlightCell } from "./selection";
|
|
8
|
+
export function getSearchIndexArr(searchText, range, flowdata, _a) {
|
|
9
|
+
var _b = _a === void 0 ? {
|
|
10
|
+
regCheck: false,
|
|
11
|
+
wordCheck: false,
|
|
12
|
+
caseCheck: false
|
|
13
|
+
} : _a,
|
|
14
|
+
regCheck = _b.regCheck,
|
|
15
|
+
wordCheck = _b.wordCheck,
|
|
16
|
+
caseCheck = _b.caseCheck;
|
|
17
|
+
var arr = [];
|
|
18
|
+
var obj = {};
|
|
19
|
+
for (var s = 0; s < range.length; s += 1) {
|
|
20
|
+
var r1 = range[s].row[0];
|
|
21
|
+
var r2 = range[s].row[1];
|
|
22
|
+
var c1 = range[s].column[0];
|
|
23
|
+
var c2 = range[s].column[1];
|
|
24
|
+
for (var r = r1; r <= r2; r += 1) {
|
|
25
|
+
for (var c = c1; c <= c2; c += 1) {
|
|
26
|
+
var cell = flowdata[r][c];
|
|
27
|
+
if (cell != null) {
|
|
28
|
+
var value = valueShowEs(r, c, flowdata);
|
|
29
|
+
if (value === 0) {
|
|
30
|
+
value = value.toString();
|
|
31
|
+
}
|
|
32
|
+
if (value != null && value !== "") {
|
|
33
|
+
value = value.toString();
|
|
34
|
+
if (wordCheck) {
|
|
35
|
+
if (caseCheck) {
|
|
36
|
+
if (searchText === value) {
|
|
37
|
+
if (!("".concat(r, "_").concat(c) in obj)) {
|
|
38
|
+
_.set(obj, "".concat(r, "_").concat(c), 0);
|
|
39
|
+
arr.push({
|
|
40
|
+
r: r,
|
|
41
|
+
c: c
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
} else {
|
|
46
|
+
var txt = searchText.toLowerCase();
|
|
47
|
+
if (txt === value.toLowerCase()) {
|
|
48
|
+
if (!("".concat(r, "_").concat(c) in obj)) {
|
|
49
|
+
_.set(obj, "".concat(r, "_").concat(c), 0);
|
|
50
|
+
arr.push({
|
|
51
|
+
r: r,
|
|
52
|
+
c: c
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
} else if (regCheck) {
|
|
58
|
+
var reg = void 0;
|
|
59
|
+
if (caseCheck) {
|
|
60
|
+
reg = new RegExp(getRegExpStr(searchText), "g");
|
|
61
|
+
} else {
|
|
62
|
+
reg = new RegExp(getRegExpStr(searchText), "ig");
|
|
63
|
+
}
|
|
64
|
+
if (reg.test(value)) {
|
|
65
|
+
if (!("".concat(r, "_").concat(c) in obj)) {
|
|
66
|
+
_.set(obj, "".concat(r, "_").concat(c), 0);
|
|
67
|
+
arr.push({
|
|
68
|
+
r: r,
|
|
69
|
+
c: c
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
} else {
|
|
74
|
+
if (caseCheck) {
|
|
75
|
+
if (~value.indexOf(searchText)) {
|
|
76
|
+
if (!("".concat(r, "_").concat(c) in obj)) {
|
|
77
|
+
_.set(obj, "".concat(r, "_").concat(c), 0);
|
|
78
|
+
arr.push({
|
|
79
|
+
r: r,
|
|
80
|
+
c: c
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
} else {
|
|
85
|
+
if (~value.toLowerCase().indexOf(searchText.toLowerCase())) {
|
|
86
|
+
if (!("".concat(r, "_").concat(c) in obj)) {
|
|
87
|
+
_.set(obj, "".concat(r, "_").concat(c), 0);
|
|
88
|
+
arr.push({
|
|
89
|
+
r: r,
|
|
90
|
+
c: c
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return arr;
|
|
102
|
+
}
|
|
103
|
+
export function searchNext(ctx, searchText, checkModes) {
|
|
104
|
+
var _a, _b;
|
|
105
|
+
var findAndReplace = locale(ctx).findAndReplace;
|
|
106
|
+
var flowdata = getFlowdata(ctx);
|
|
107
|
+
if (searchText === "" || searchText == null || flowdata == null) {
|
|
108
|
+
return findAndReplace.searchInputTip;
|
|
109
|
+
}
|
|
110
|
+
var range;
|
|
111
|
+
if (_.size(ctx.luckysheet_select_save) === 0 || ((_a = ctx.luckysheet_select_save) === null || _a === void 0 ? void 0 : _a.length) === 1 && ctx.luckysheet_select_save[0].row[0] === ctx.luckysheet_select_save[0].row[1] && ctx.luckysheet_select_save[0].column[0] === ctx.luckysheet_select_save[0].column[1]) {
|
|
112
|
+
range = [{
|
|
113
|
+
row: [0, flowdata.length - 1],
|
|
114
|
+
column: [0, flowdata[0].length - 1],
|
|
115
|
+
row_focus: 0,
|
|
116
|
+
column_focus: 0
|
|
117
|
+
}];
|
|
118
|
+
} else {
|
|
119
|
+
range = _.assign([], ctx.luckysheet_select_save);
|
|
120
|
+
}
|
|
121
|
+
var searchIndexArr = getSearchIndexArr(searchText, range, flowdata, checkModes);
|
|
122
|
+
if (searchIndexArr.length === 0) {
|
|
123
|
+
return findAndReplace.noFindTip;
|
|
124
|
+
}
|
|
125
|
+
var count = 0;
|
|
126
|
+
if (_.size(ctx.luckysheet_select_save) === 0 || ((_b = ctx.luckysheet_select_save) === null || _b === void 0 ? void 0 : _b.length) === 1 && ctx.luckysheet_select_save[0].row[0] === ctx.luckysheet_select_save[0].row[1] && ctx.luckysheet_select_save[0].column[0] === ctx.luckysheet_select_save[0].column[1]) {
|
|
127
|
+
if (_.size(ctx.luckysheet_select_save) === 0) {
|
|
128
|
+
count = 0;
|
|
129
|
+
} else {
|
|
130
|
+
for (var i = 0; i < searchIndexArr.length; i += 1) {
|
|
131
|
+
if (searchIndexArr[i].r === ctx.luckysheet_select_save[0].row[0] && searchIndexArr[i].c === ctx.luckysheet_select_save[0].column[0]) {
|
|
132
|
+
if (i === searchIndexArr.length - 1) {
|
|
133
|
+
count = 0;
|
|
134
|
+
} else {
|
|
135
|
+
count = i + 1;
|
|
136
|
+
}
|
|
137
|
+
break;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
ctx.luckysheet_select_save = normalizeSelection(ctx, [{
|
|
142
|
+
row: [searchIndexArr[count].r, searchIndexArr[count].r],
|
|
143
|
+
column: [searchIndexArr[count].c, searchIndexArr[count].c]
|
|
144
|
+
}]);
|
|
145
|
+
} else {
|
|
146
|
+
var rf = range[range.length - 1].row_focus;
|
|
147
|
+
var cf = range[range.length - 1].column_focus;
|
|
148
|
+
for (var i = 0; i < searchIndexArr.length; i += 1) {
|
|
149
|
+
if (searchIndexArr[i].r === rf && searchIndexArr[i].c === cf) {
|
|
150
|
+
if (i === searchIndexArr.length - 1) {
|
|
151
|
+
count = 0;
|
|
152
|
+
} else {
|
|
153
|
+
count = i + 1;
|
|
154
|
+
}
|
|
155
|
+
break;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
for (var s = 0; s < range.length; s += 1) {
|
|
159
|
+
var r1 = range[s].row[0];
|
|
160
|
+
var r2 = range[s].row[1];
|
|
161
|
+
var c1 = range[s].column[0];
|
|
162
|
+
var c2 = range[s].column[1];
|
|
163
|
+
if (searchIndexArr[count].r >= r1 && searchIndexArr[count].r <= r2 && searchIndexArr[count].c >= c1 && searchIndexArr[count].c <= c2) {
|
|
164
|
+
var obj = range[s];
|
|
165
|
+
obj.row_focus = searchIndexArr[count].r;
|
|
166
|
+
obj.column_focus = searchIndexArr[count].c;
|
|
167
|
+
range.splice(s, 1);
|
|
168
|
+
range.push(obj);
|
|
169
|
+
break;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
ctx.luckysheet_select_save = range;
|
|
173
|
+
}
|
|
174
|
+
scrollToHighlightCell(ctx, searchIndexArr[count].r, searchIndexArr[count].c);
|
|
175
|
+
return null;
|
|
176
|
+
}
|
|
177
|
+
export function searchAll(ctx, searchText, checkModes) {
|
|
178
|
+
var _a, _b;
|
|
179
|
+
var flowdata = getFlowdata(ctx);
|
|
180
|
+
var searchResult = [];
|
|
181
|
+
if (searchText === "" || searchText == null || flowdata == null) {
|
|
182
|
+
return searchResult;
|
|
183
|
+
}
|
|
184
|
+
var range;
|
|
185
|
+
if (_.size(ctx.luckysheet_select_save) === 0 || ((_a = ctx.luckysheet_select_save) === null || _a === void 0 ? void 0 : _a.length) === 1 && ctx.luckysheet_select_save[0].row[0] === ctx.luckysheet_select_save[0].row[1] && ctx.luckysheet_select_save[0].column[0] === ctx.luckysheet_select_save[0].column[1]) {
|
|
186
|
+
range = [{
|
|
187
|
+
row: [0, flowdata.length - 1],
|
|
188
|
+
column: [0, flowdata[0].length - 1]
|
|
189
|
+
}];
|
|
190
|
+
} else {
|
|
191
|
+
range = _.assign([], ctx.luckysheet_select_save);
|
|
192
|
+
}
|
|
193
|
+
var searchIndexArr = getSearchIndexArr(searchText, range, flowdata, checkModes);
|
|
194
|
+
if (searchIndexArr.length === 0) {
|
|
195
|
+
return searchResult;
|
|
196
|
+
}
|
|
197
|
+
for (var i = 0; i < searchIndexArr.length; i += 1) {
|
|
198
|
+
var value_ShowEs = valueShowEs(searchIndexArr[i].r, searchIndexArr[i].c, flowdata).toString();
|
|
199
|
+
searchResult.push({
|
|
200
|
+
r: searchIndexArr[i].r,
|
|
201
|
+
c: searchIndexArr[i].c,
|
|
202
|
+
sheetName: (_b = ctx.luckysheetfile[getSheetIndex(ctx, ctx.currentSheetId) || 0]) === null || _b === void 0 ? void 0 : _b.name,
|
|
203
|
+
sheetId: ctx.currentSheetId,
|
|
204
|
+
cellPosition: "".concat(chatatABC(searchIndexArr[i].c)).concat(searchIndexArr[i].r + 1),
|
|
205
|
+
value: value_ShowEs
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
ctx.luckysheet_select_save = normalizeSelection(ctx, [{
|
|
209
|
+
row: [searchIndexArr[0].r, searchIndexArr[0].r],
|
|
210
|
+
column: [searchIndexArr[0].c, searchIndexArr[0].c]
|
|
211
|
+
}]);
|
|
212
|
+
return searchResult;
|
|
213
|
+
}
|
|
214
|
+
export function onSearchDialogMoveStart(globalCache, e, container) {
|
|
215
|
+
var box = document.getElementById("fortune-search-replace");
|
|
216
|
+
if (!box) return;
|
|
217
|
+
var _a = box.getBoundingClientRect(),
|
|
218
|
+
top = _a.top,
|
|
219
|
+
left = _a.left,
|
|
220
|
+
width = _a.width,
|
|
221
|
+
height = _a.height;
|
|
222
|
+
var rect = container.getBoundingClientRect();
|
|
223
|
+
left -= rect.left;
|
|
224
|
+
top -= rect.top;
|
|
225
|
+
var initialPosition = {
|
|
226
|
+
left: left,
|
|
227
|
+
top: top,
|
|
228
|
+
width: width,
|
|
229
|
+
height: height
|
|
230
|
+
};
|
|
231
|
+
_.set(globalCache, "searchDialog.moveProps", {
|
|
232
|
+
cursorMoveStartPosition: {
|
|
233
|
+
x: e.pageX,
|
|
234
|
+
y: e.pageY
|
|
235
|
+
},
|
|
236
|
+
initialPosition: initialPosition
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
export function onSearchDialogMove(globalCache, e) {
|
|
240
|
+
var searchDialog = globalCache === null || globalCache === void 0 ? void 0 : globalCache.searchDialog;
|
|
241
|
+
var moveProps = searchDialog === null || searchDialog === void 0 ? void 0 : searchDialog.moveProps;
|
|
242
|
+
if (moveProps == null) return;
|
|
243
|
+
var dialog = document.getElementById("fortune-search-replace");
|
|
244
|
+
var _a = moveProps.cursorMoveStartPosition,
|
|
245
|
+
startX = _a.x,
|
|
246
|
+
startY = _a.y;
|
|
247
|
+
var _b = moveProps.initialPosition,
|
|
248
|
+
top = _b.top,
|
|
249
|
+
left = _b.left;
|
|
250
|
+
left += e.pageX - startX;
|
|
251
|
+
top += e.pageY - startY;
|
|
252
|
+
if (top < 0) top = 0;
|
|
253
|
+
dialog.style.left = "".concat(left, "px");
|
|
254
|
+
dialog.style.top = "".concat(top, "px");
|
|
255
|
+
}
|
|
256
|
+
export function onSearchDialogMoveEnd(globalCache) {
|
|
257
|
+
_.set(globalCache, "searchDialog.moveProps", undefined);
|
|
258
|
+
}
|
|
259
|
+
export function replace(ctx, searchText, replaceText, checkModes) {
|
|
260
|
+
var _a, _b;
|
|
261
|
+
var findAndReplace = locale(ctx).findAndReplace;
|
|
262
|
+
var allowEdit = isAllowEdit(ctx);
|
|
263
|
+
if (!allowEdit) {
|
|
264
|
+
return findAndReplace.modeTip;
|
|
265
|
+
}
|
|
266
|
+
var flowdata = getFlowdata(ctx);
|
|
267
|
+
if (searchText === "" || searchText == null || flowdata == null) {
|
|
268
|
+
return findAndReplace.searchInputTip;
|
|
269
|
+
}
|
|
270
|
+
var range;
|
|
271
|
+
if (_.size(ctx.luckysheet_select_save) === 0 || ((_a = ctx.luckysheet_select_save) === null || _a === void 0 ? void 0 : _a.length) === 1 && ctx.luckysheet_select_save[0].row[0] === ctx.luckysheet_select_save[0].row[1] && ctx.luckysheet_select_save[0].column[0] === ctx.luckysheet_select_save[0].column[1]) {
|
|
272
|
+
range = [{
|
|
273
|
+
row: [0, flowdata.length - 1],
|
|
274
|
+
column: [0, flowdata[0].length - 1]
|
|
275
|
+
}];
|
|
276
|
+
} else {
|
|
277
|
+
range = _.assign([], ctx.luckysheet_select_save);
|
|
278
|
+
}
|
|
279
|
+
var searchIndexArr = getSearchIndexArr(searchText, range, flowdata, checkModes);
|
|
280
|
+
if (searchIndexArr.length === 0) {
|
|
281
|
+
return findAndReplace.noReplceTip;
|
|
282
|
+
}
|
|
283
|
+
var count = null;
|
|
284
|
+
var last = (_b = ctx.luckysheet_select_save) === null || _b === void 0 ? void 0 : _b[ctx.luckysheet_select_save.length - 1];
|
|
285
|
+
var rf = last === null || last === void 0 ? void 0 : last.row_focus;
|
|
286
|
+
var cf = last === null || last === void 0 ? void 0 : last.column_focus;
|
|
287
|
+
for (var i = 0; i < searchIndexArr.length; i += 1) {
|
|
288
|
+
if (searchIndexArr[i].r === rf && searchIndexArr[i].c === cf) {
|
|
289
|
+
count = i;
|
|
290
|
+
break;
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
if (count == null) {
|
|
294
|
+
if (searchIndexArr.length === 0) {
|
|
295
|
+
return findAndReplace.noMatchTip;
|
|
296
|
+
}
|
|
297
|
+
count = 0;
|
|
298
|
+
}
|
|
299
|
+
var d = flowdata;
|
|
300
|
+
var r;
|
|
301
|
+
var c;
|
|
302
|
+
if (checkModes.wordCheck) {
|
|
303
|
+
r = searchIndexArr[count].r;
|
|
304
|
+
c = searchIndexArr[count].c;
|
|
305
|
+
var v = replaceText;
|
|
306
|
+
setCellValue(ctx, r, c, d, v);
|
|
307
|
+
} else {
|
|
308
|
+
var reg = void 0;
|
|
309
|
+
if (checkModes.caseCheck) {
|
|
310
|
+
reg = new RegExp(getRegExpStr(searchText), "g");
|
|
311
|
+
} else {
|
|
312
|
+
reg = new RegExp(getRegExpStr(searchText), "ig");
|
|
313
|
+
}
|
|
314
|
+
r = searchIndexArr[count].r;
|
|
315
|
+
c = searchIndexArr[count].c;
|
|
316
|
+
var v = valueShowEs(r, c, d).toString().replace(reg, replaceText);
|
|
317
|
+
setCellValue(ctx, r, c, d, v);
|
|
318
|
+
}
|
|
319
|
+
ctx.luckysheet_select_save = normalizeSelection(ctx, [{
|
|
320
|
+
row: [r, r],
|
|
321
|
+
column: [c, c]
|
|
322
|
+
}]);
|
|
323
|
+
scrollToHighlightCell(ctx, r, c);
|
|
324
|
+
return null;
|
|
325
|
+
}
|
|
326
|
+
export function replaceAll(ctx, searchText, replaceText, checkModes) {
|
|
327
|
+
var _a;
|
|
328
|
+
var findAndReplace = locale(ctx).findAndReplace;
|
|
329
|
+
var allowEdit = isAllowEdit(ctx);
|
|
330
|
+
if (!allowEdit) {
|
|
331
|
+
return findAndReplace.modeTip;
|
|
332
|
+
}
|
|
333
|
+
var flowdata = getFlowdata(ctx);
|
|
334
|
+
if (searchText === "" || searchText == null || flowdata == null) {
|
|
335
|
+
return findAndReplace.searchInputTip;
|
|
336
|
+
}
|
|
337
|
+
var range;
|
|
338
|
+
if (_.size(ctx.luckysheet_select_save) === 0 || ((_a = ctx.luckysheet_select_save) === null || _a === void 0 ? void 0 : _a.length) === 1 && ctx.luckysheet_select_save[0].row[0] === ctx.luckysheet_select_save[0].row[1] && ctx.luckysheet_select_save[0].column[0] === ctx.luckysheet_select_save[0].column[1]) {
|
|
339
|
+
range = [{
|
|
340
|
+
row: [0, flowdata.length - 1],
|
|
341
|
+
column: [0, flowdata[0].length - 1]
|
|
342
|
+
}];
|
|
343
|
+
} else {
|
|
344
|
+
range = _.assign([], ctx.luckysheet_select_save);
|
|
345
|
+
}
|
|
346
|
+
var searchIndexArr = getSearchIndexArr(searchText, range, flowdata, checkModes);
|
|
347
|
+
if (searchIndexArr.length === 0) {
|
|
348
|
+
return findAndReplace.noReplceTip;
|
|
349
|
+
}
|
|
350
|
+
var d = flowdata;
|
|
351
|
+
var replaceCount = 0;
|
|
352
|
+
if (checkModes.wordCheck) {
|
|
353
|
+
for (var i = 0; i < searchIndexArr.length; i += 1) {
|
|
354
|
+
var r = searchIndexArr[i].r;
|
|
355
|
+
var c = searchIndexArr[i].c;
|
|
356
|
+
var v = replaceText;
|
|
357
|
+
setCellValue(ctx, r, c, d, v);
|
|
358
|
+
range.push({
|
|
359
|
+
row: [r, r],
|
|
360
|
+
column: [c, c]
|
|
361
|
+
});
|
|
362
|
+
replaceCount += 1;
|
|
363
|
+
}
|
|
364
|
+
} else {
|
|
365
|
+
var reg = void 0;
|
|
366
|
+
if (checkModes.caseCheck) {
|
|
367
|
+
reg = new RegExp(getRegExpStr(searchText), "g");
|
|
368
|
+
} else {
|
|
369
|
+
reg = new RegExp(getRegExpStr(searchText), "ig");
|
|
370
|
+
}
|
|
371
|
+
for (var i = 0; i < searchIndexArr.length; i += 1) {
|
|
372
|
+
var r = searchIndexArr[i].r;
|
|
373
|
+
var c = searchIndexArr[i].c;
|
|
374
|
+
var v = valueShowEs(r, c, d).toString().replace(reg, replaceText);
|
|
375
|
+
setCellValue(ctx, r, c, d, v);
|
|
376
|
+
range.push({
|
|
377
|
+
row: [r, r],
|
|
378
|
+
column: [c, c]
|
|
379
|
+
});
|
|
380
|
+
replaceCount += 1;
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
ctx.luckysheet_select_save = normalizeSelection(ctx, range);
|
|
384
|
+
var succeedInfo = replaceHtml(findAndReplace.successTip, {
|
|
385
|
+
xlength: replaceCount
|
|
386
|
+
});
|
|
387
|
+
return succeedInfo;
|
|
388
|
+
}
|
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
import type { Sheet as SheetType, Freezen, Range } from "../types";
|
|
2
|
-
import { Context } from "../context";
|
|
3
|
-
export declare const selectionCache: {
|
|
4
|
-
isPasteAction: boolean;
|
|
5
|
-
};
|
|
6
|
-
export declare function scrollToHighlightCell(ctx: Context, r: number, c: number): void;
|
|
7
|
-
export declare function seletedHighlistByindex(ctx: Context, r1: number, r2: number, c1: number, c2: number): {
|
|
8
|
-
left: number;
|
|
9
|
-
width: number;
|
|
10
|
-
top: number;
|
|
11
|
-
height: number;
|
|
12
|
-
} | null;
|
|
13
|
-
export declare function normalizeSelection(ctx: Context, selection: SheetType["luckysheet_select_save"]): import("../types").Selection[] | undefined;
|
|
14
|
-
export declare function selectTitlesMap(rangeMap: Record<string, number>, range1: number, range2: number): Record<string, number>;
|
|
15
|
-
export declare function selectTitlesRange(map: Record<string, number>): number[][];
|
|
16
|
-
export declare function pasteHandlerOfPaintModel(ctx: Context, copyRange: Context["luckysheet_copy_save"]): void;
|
|
17
|
-
export declare function selectionCopyShow(range: any, ctx: Context): void;
|
|
18
|
-
export declare function rowHasMerged(ctx: Context, r: number, c1: number, c2: number): boolean;
|
|
19
|
-
export declare function colHasMerged(ctx: Context, c: number, r1: number, r2: number): boolean;
|
|
20
|
-
export declare function getRowMerge(ctx: Context, rIndex: number, c1: number, c2: number): (number | null)[];
|
|
21
|
-
export declare function getColMerge(ctx: Context, cIndex: number, r1: number, r2: number): (number | null)[];
|
|
22
|
-
export declare function moveHighlightCell(ctx: Context, postion: "down" | "right", index: number, type: "rangeOfSelect" | "rangeOfFormula"): void;
|
|
23
|
-
export declare function moveHighlightRange(ctx: Context, postion: "down" | "right", index: number, type: "rangeOfSelect" | "rangeOfFormula"): void;
|
|
24
|
-
export declare function rangeValueToHtml(ctx: Context, sheetId: string, ranges?: Range): string | null;
|
|
25
|
-
export declare function copy(ctx: Context): void;
|
|
26
|
-
export declare function deleteSelectedCellText(ctx: Context): string;
|
|
27
|
-
export declare function selectIsOverlap(ctx: Context, range?: any): boolean;
|
|
28
|
-
export declare function selectAll(ctx: Context): void;
|
|
29
|
-
export declare function fixRowStyleOverflowInFreeze(ctx: Context, r1: number, r2: number, freeze: Freezen | undefined): {
|
|
30
|
-
top?: number;
|
|
31
|
-
height?: number;
|
|
32
|
-
display?: string;
|
|
33
|
-
};
|
|
34
|
-
export declare function fixColumnStyleOverflowInFreeze(ctx: Context, c1: number, c2: number, freeze: Freezen | undefined): {
|
|
35
|
-
left?: number;
|
|
36
|
-
width?: number;
|
|
37
|
-
display?: string;
|
|
38
|
-
};
|
|
39
|
-
export declare function calcSelectionInfo(ctx: Context, lang?: string | null): {
|
|
40
|
-
numberC: number;
|
|
41
|
-
count: number;
|
|
42
|
-
sum: number;
|
|
43
|
-
max: number;
|
|
44
|
-
min: number;
|
|
45
|
-
average: string;
|
|
46
|
-
};
|
|
1
|
+
import type { Sheet as SheetType, Freezen, Range } from "../types";
|
|
2
|
+
import { Context } from "../context";
|
|
3
|
+
export declare const selectionCache: {
|
|
4
|
+
isPasteAction: boolean;
|
|
5
|
+
};
|
|
6
|
+
export declare function scrollToHighlightCell(ctx: Context, r: number, c: number): void;
|
|
7
|
+
export declare function seletedHighlistByindex(ctx: Context, r1: number, r2: number, c1: number, c2: number): {
|
|
8
|
+
left: number;
|
|
9
|
+
width: number;
|
|
10
|
+
top: number;
|
|
11
|
+
height: number;
|
|
12
|
+
} | null;
|
|
13
|
+
export declare function normalizeSelection(ctx: Context, selection: SheetType["luckysheet_select_save"]): import("../types").Selection[] | undefined;
|
|
14
|
+
export declare function selectTitlesMap(rangeMap: Record<string, number>, range1: number, range2: number): Record<string, number>;
|
|
15
|
+
export declare function selectTitlesRange(map: Record<string, number>): number[][];
|
|
16
|
+
export declare function pasteHandlerOfPaintModel(ctx: Context, copyRange: Context["luckysheet_copy_save"]): void;
|
|
17
|
+
export declare function selectionCopyShow(range: any, ctx: Context): void;
|
|
18
|
+
export declare function rowHasMerged(ctx: Context, r: number, c1: number, c2: number): boolean;
|
|
19
|
+
export declare function colHasMerged(ctx: Context, c: number, r1: number, r2: number): boolean;
|
|
20
|
+
export declare function getRowMerge(ctx: Context, rIndex: number, c1: number, c2: number): (number | null)[];
|
|
21
|
+
export declare function getColMerge(ctx: Context, cIndex: number, r1: number, r2: number): (number | null)[];
|
|
22
|
+
export declare function moveHighlightCell(ctx: Context, postion: "down" | "right", index: number, type: "rangeOfSelect" | "rangeOfFormula"): void;
|
|
23
|
+
export declare function moveHighlightRange(ctx: Context, postion: "down" | "right", index: number, type: "rangeOfSelect" | "rangeOfFormula"): void;
|
|
24
|
+
export declare function rangeValueToHtml(ctx: Context, sheetId: string, ranges?: Range): string | null;
|
|
25
|
+
export declare function copy(ctx: Context): void;
|
|
26
|
+
export declare function deleteSelectedCellText(ctx: Context): string;
|
|
27
|
+
export declare function selectIsOverlap(ctx: Context, range?: any): boolean;
|
|
28
|
+
export declare function selectAll(ctx: Context): void;
|
|
29
|
+
export declare function fixRowStyleOverflowInFreeze(ctx: Context, r1: number, r2: number, freeze: Freezen | undefined): {
|
|
30
|
+
top?: number;
|
|
31
|
+
height?: number;
|
|
32
|
+
display?: string;
|
|
33
|
+
};
|
|
34
|
+
export declare function fixColumnStyleOverflowInFreeze(ctx: Context, c1: number, c2: number, freeze: Freezen | undefined): {
|
|
35
|
+
left?: number;
|
|
36
|
+
width?: number;
|
|
37
|
+
display?: string;
|
|
38
|
+
};
|
|
39
|
+
export declare function calcSelectionInfo(ctx: Context, lang?: string | null): {
|
|
40
|
+
numberC: number;
|
|
41
|
+
count: number;
|
|
42
|
+
sum: number;
|
|
43
|
+
max: number;
|
|
44
|
+
min: number;
|
|
45
|
+
average: string;
|
|
46
|
+
};
|