@dou-ui/sheet 0.0.0-stage → 0.1.0-alpha.1
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/LICENSE +21 -0
- package/README.md +10 -2
- package/dist/cell-types.js +20 -0
- package/dist/cell-types.js.map +1 -0
- package/dist/code/code-formula-bar.js +6 -0
- package/dist/code/code-formula-bar.js.map +1 -0
- package/dist/code/code-formula-bar.vue_vue_type_script_setup_true_lang.js +192 -0
- package/dist/code/code-formula-bar.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/code/index.js +12 -0
- package/dist/code/index.js.map +1 -0
- package/dist/code/language.js +51 -0
- package/dist/code/language.js.map +1 -0
- package/dist/code/style.d.ts +1 -0
- package/dist/code/style.js +2 -0
- package/dist/collaboration/anchor.js +143 -0
- package/dist/collaboration/anchor.js.map +1 -0
- package/dist/collaboration/index.js +770 -0
- package/dist/collaboration/index.js.map +1 -0
- package/dist/collaboration/peers.js +87 -0
- package/dist/collaboration/peers.js.map +1 -0
- package/dist/collaboration/shared.js +450 -0
- package/dist/collaboration/shared.js.map +1 -0
- package/dist/components/cell-panel.js +6 -0
- package/dist/components/cell-panel.js.map +1 -0
- package/dist/components/cell-panel.vue_vue_type_script_setup_true_lang.js +70 -0
- package/dist/components/cell-panel.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/cell-renders.js +40 -0
- package/dist/components/cell-renders.js.map +1 -0
- package/dist/components/date-panel.js +6 -0
- package/dist/components/date-panel.js.map +1 -0
- package/dist/components/date-panel.vue_vue_type_script_setup_true_lang.js +48 -0
- package/dist/components/date-panel.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/filter-panel.js +6 -0
- package/dist/components/filter-panel.js.map +1 -0
- package/dist/components/filter-panel.vue_vue_type_script_setup_true_lang.js +259 -0
- package/dist/components/filter-panel.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/format-dialog.js +6 -0
- package/dist/components/format-dialog.js.map +1 -0
- package/dist/components/format-dialog.vue_vue_type_script_setup_true_lang.js +432 -0
- package/dist/components/format-dialog.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/format-list.js +6 -0
- package/dist/components/format-list.js.map +1 -0
- package/dist/components/format-list.vue_vue_type_script_setup_true_lang.js +187 -0
- package/dist/components/format-list.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/format-presets.js +97 -0
- package/dist/components/format-presets.js.map +1 -0
- package/dist/components/option-panel.js +6 -0
- package/dist/components/option-panel.js.map +1 -0
- package/dist/components/option-panel.vue_vue_type_script_setup_true_lang.js +117 -0
- package/dist/components/option-panel.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/sheet-comment.js +6 -0
- package/dist/components/sheet-comment.js.map +1 -0
- package/dist/components/sheet-comment.vue_vue_type_script_setup_true_lang.js +104 -0
- package/dist/components/sheet-comment.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/sheet-formula-bar.js +6 -0
- package/dist/components/sheet-formula-bar.js.map +1 -0
- package/dist/components/sheet-formula-bar.vue_vue_type_script_setup_true_lang.js +124 -0
- package/dist/components/sheet-formula-bar.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/sheet-link.js +6 -0
- package/dist/components/sheet-link.js.map +1 -0
- package/dist/components/sheet-link.vue_vue_type_script_setup_true_lang.js +249 -0
- package/dist/components/sheet-link.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/sheet-menu.js +6 -0
- package/dist/components/sheet-menu.js.map +1 -0
- package/dist/components/sheet-menu.vue_vue_type_script_setup_true_lang.js +115 -0
- package/dist/components/sheet-menu.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/sheet-name-box.js +6 -0
- package/dist/components/sheet-name-box.js.map +1 -0
- package/dist/components/sheet-name-box.vue_vue_type_script_setup_true_lang.js +91 -0
- package/dist/components/sheet-name-box.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/sheet-note.js +6 -0
- package/dist/components/sheet-note.js.map +1 -0
- package/dist/components/sheet-note.vue_vue_type_script_setup_true_lang.js +146 -0
- package/dist/components/sheet-note.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/sheet-outline.js +6 -0
- package/dist/components/sheet-outline.js.map +1 -0
- package/dist/components/sheet-outline.vue_vue_type_script_setup_true_lang.js +237 -0
- package/dist/components/sheet-outline.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/sheet-tabs.js +6 -0
- package/dist/components/sheet-tabs.js.map +1 -0
- package/dist/components/sheet-tabs.vue_vue_type_script_setup_true_lang.js +487 -0
- package/dist/components/sheet-tabs.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/sheet-toolbar.js +6 -0
- package/dist/components/sheet-toolbar.js.map +1 -0
- package/dist/components/sheet-toolbar.vue_vue_type_script_setup_true_lang.js +1562 -0
- package/dist/components/sheet-toolbar.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/validation-dialog.js +6 -0
- package/dist/components/validation-dialog.js.map +1 -0
- package/dist/components/validation-dialog.vue_vue_type_script_setup_true_lang.js +370 -0
- package/dist/components/validation-dialog.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/context.js +12 -0
- package/dist/context.js.map +1 -0
- package/dist/core/address.js +256 -0
- package/dist/core/address.js.map +1 -0
- package/dist/core/axis.js +72 -0
- package/dist/core/axis.js.map +1 -0
- package/dist/core/cell-type.js +30 -0
- package/dist/core/cell-type.js.map +1 -0
- package/dist/core/clipboard.js +141 -0
- package/dist/core/clipboard.js.map +1 -0
- package/dist/core/commands.js +63 -0
- package/dist/core/commands.js.map +1 -0
- package/dist/core/comments.js +74 -0
- package/dist/core/comments.js.map +1 -0
- package/dist/core/conditional.js +362 -0
- package/dist/core/conditional.js.map +1 -0
- package/dist/core/csv.js +191 -0
- package/dist/core/csv.js.map +1 -0
- package/dist/core/data.js +118 -0
- package/dist/core/data.js.map +1 -0
- package/dist/core/document.js +187 -0
- package/dist/core/document.js.map +1 -0
- package/dist/core/extension.js +60 -0
- package/dist/core/extension.js.map +1 -0
- package/dist/core/file.js +336 -0
- package/dist/core/file.js.map +1 -0
- package/dist/core/fill.js +153 -0
- package/dist/core/fill.js.map +1 -0
- package/dist/core/find.js +42 -0
- package/dist/core/find.js.map +1 -0
- package/dist/core/format.js +404 -0
- package/dist/core/format.js.map +1 -0
- package/dist/core/group.js +134 -0
- package/dist/core/group.js.map +1 -0
- package/dist/core/history.js +68 -0
- package/dist/core/history.js.map +1 -0
- package/dist/core/index.js +17 -0
- package/dist/core/link.js +34 -0
- package/dist/core/link.js.map +1 -0
- package/dist/core/merge.js +105 -0
- package/dist/core/merge.js.map +1 -0
- package/dist/core/model.js +48 -0
- package/dist/core/model.js.map +1 -0
- package/dist/core/nav.js +44 -0
- package/dist/core/nav.js.map +1 -0
- package/dist/core/paint.js +106 -0
- package/dist/core/paint.js.map +1 -0
- package/dist/core/plain-cell-types.js +54 -0
- package/dist/core/plain-cell-types.js.map +1 -0
- package/dist/core/protect.js +246 -0
- package/dist/core/protect.js.map +1 -0
- package/dist/core/selection.js +37 -0
- package/dist/core/selection.js.map +1 -0
- package/dist/core/transaction.js +1582 -0
- package/dist/core/transaction.js.map +1 -0
- package/dist/core/validation.js +135 -0
- package/dist/core/validation.js.map +1 -0
- package/dist/core/versions.js +161 -0
- package/dist/core/versions.js.map +1 -0
- package/dist/export/color.js +36 -0
- package/dist/export/color.js.map +1 -0
- package/dist/export/draw.js +316 -0
- package/dist/export/draw.js.map +1 -0
- package/dist/export/index.js +390 -0
- package/dist/export/index.js.map +1 -0
- package/dist/formula/edit.js +210 -0
- package/dist/formula/edit.js.map +1 -0
- package/dist/formula/engine.js +526 -0
- package/dist/formula/engine.js.map +1 -0
- package/dist/formula/error.js +39 -0
- package/dist/formula/error.js.map +1 -0
- package/dist/formula/functions.js +1493 -0
- package/dist/formula/functions.js.map +1 -0
- package/dist/formula/help.js +408 -0
- package/dist/formula/help.js.map +1 -0
- package/dist/formula/index.js +7 -0
- package/dist/formula/parse.js +369 -0
- package/dist/formula/parse.js.map +1 -0
- package/dist/formula/values.js +123 -0
- package/dist/formula/values.js.map +1 -0
- package/dist/formulas.js +30 -0
- package/dist/formulas.js.map +1 -0
- package/dist/index.js +39 -0
- package/dist/index.js.map +1 -0
- package/dist/locale.js +1312 -0
- package/dist/locale.js.map +1 -0
- package/dist/sheet.js +6 -0
- package/dist/sheet.js.map +1 -0
- package/dist/sheet.vue_vue_type_script_setup_true_lang.js +7166 -0
- package/dist/sheet.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/style.css +1 -0
- package/dist/style.d.ts +1 -0
- package/dist/style.js +17 -0
- package/dist/types/cell-types.d.ts +2 -0
- package/dist/types/code/code-formula-bar.vue.d.ts +3 -0
- package/dist/types/code/index.d.ts +12 -0
- package/dist/types/code/language.d.ts +13 -0
- package/dist/types/collaboration/anchor.d.ts +65 -0
- package/dist/types/collaboration/index.d.ts +59 -0
- package/dist/types/collaboration/peers.d.ts +21 -0
- package/dist/types/collaboration/shared.d.ts +75 -0
- package/dist/types/components/cell-panel.vue.d.ts +20 -0
- package/dist/types/components/cell-renders.d.ts +9 -0
- package/dist/types/components/date-panel.vue.d.ts +9 -0
- package/dist/types/components/filter-panel.vue.d.ts +21 -0
- package/dist/types/components/format-dialog.vue.d.ts +24 -0
- package/dist/types/components/format-list.vue.d.ts +25 -0
- package/dist/types/components/format-presets.d.ts +30 -0
- package/dist/types/components/option-panel.vue.d.ts +13 -0
- package/dist/types/components/sheet-comment.vue.d.ts +29 -0
- package/dist/types/components/sheet-formula-bar.vue.d.ts +3 -0
- package/dist/types/components/sheet-link.vue.d.ts +32 -0
- package/dist/types/components/sheet-menu.vue.d.ts +20 -0
- package/dist/types/components/sheet-name-box.vue.d.ts +3 -0
- package/dist/types/components/sheet-note.vue.d.ts +22 -0
- package/dist/types/components/sheet-outline.vue.d.ts +36 -0
- package/dist/types/components/sheet-tabs.vue.d.ts +9 -0
- package/dist/types/components/sheet-toolbar.vue.d.ts +11 -0
- package/dist/types/components/validation-dialog.vue.d.ts +25 -0
- package/dist/types/context.d.ts +189 -0
- package/dist/types/core/address.d.ts +109 -0
- package/dist/types/core/axis.d.ts +23 -0
- package/dist/types/core/cell-type.d.ts +157 -0
- package/dist/types/core/clipboard.d.ts +48 -0
- package/dist/types/core/commands.d.ts +76 -0
- package/dist/types/core/comments.d.ts +22 -0
- package/dist/types/core/conditional.d.ts +114 -0
- package/dist/types/core/csv.d.ts +93 -0
- package/dist/types/core/data.d.ts +26 -0
- package/dist/types/core/document.d.ts +49 -0
- package/dist/types/core/extension.d.ts +177 -0
- package/dist/types/core/file.d.ts +301 -0
- package/dist/types/core/fill.d.ts +23 -0
- package/dist/types/core/find.d.ts +39 -0
- package/dist/types/core/format.d.ts +47 -0
- package/dist/types/core/group.d.ts +76 -0
- package/dist/types/core/history.d.ts +27 -0
- package/dist/types/core/index.d.ts +33 -0
- package/dist/types/core/link.d.ts +14 -0
- package/dist/types/core/merge.d.ts +26 -0
- package/dist/types/core/model.d.ts +363 -0
- package/dist/types/core/nav.d.ts +15 -0
- package/dist/types/core/paint.d.ts +19 -0
- package/dist/types/core/plain-cell-types.d.ts +6 -0
- package/dist/types/core/protect.d.ts +34 -0
- package/dist/types/core/selection.d.ts +25 -0
- package/dist/types/core/transaction.d.ts +470 -0
- package/dist/types/core/validation.d.ts +55 -0
- package/dist/types/core/versions.d.ts +38 -0
- package/dist/types/export/color.d.ts +7 -0
- package/dist/types/export/draw.d.ts +98 -0
- package/dist/types/export/index.d.ts +47 -0
- package/dist/types/formula/edit.d.ts +62 -0
- package/dist/types/formula/engine.d.ts +99 -0
- package/dist/types/formula/error.d.ts +30 -0
- package/dist/types/formula/functions.d.ts +62 -0
- package/dist/types/formula/help.d.ts +12 -0
- package/dist/types/formula/index.d.ts +13 -0
- package/dist/types/formula/parse.d.ts +92 -0
- package/dist/types/formula/values.d.ts +65 -0
- package/dist/types/formulas.d.ts +32 -0
- package/dist/types/index.d.ts +225 -0
- package/dist/types/locale.d.ts +531 -0
- package/dist/types/sheet.vue.d.ts +60 -0
- package/dist/types/types.d.ts +498 -0
- package/dist/types/use-comments.d.ts +47 -0
- package/dist/types/use-messages.d.ts +7 -0
- package/dist/use-comments.js +130 -0
- package/dist/use-comments.js.map +1 -0
- package/dist/use-messages.js +29 -0
- package/dist/use-messages.js.map +1 -0
- package/package.json +93 -4
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { SheetMenuItem } from '../types';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
items: SheetMenuItem[];
|
|
4
|
+
};
|
|
5
|
+
type __VLS_ModelProps = {
|
|
6
|
+
'open'?: boolean;
|
|
7
|
+
};
|
|
8
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
9
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
10
|
+
open: (x: number, y: number) => void | undefined;
|
|
11
|
+
close: () => void | undefined;
|
|
12
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
13
|
+
select: (key: unknown) => any;
|
|
14
|
+
"update:open": (value: boolean) => any;
|
|
15
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
16
|
+
onSelect?: ((key: unknown) => any) | undefined;
|
|
17
|
+
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
18
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
19
|
+
declare const _default: typeof __VLS_export;
|
|
20
|
+
export default _default;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
3
|
+
export default _default;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type VirtualElement } from 'dou-ui';
|
|
2
|
+
import type { SheetNoteMessages } from '../locale';
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
/** The cell the note belongs to. */
|
|
5
|
+
anchor: VirtualElement;
|
|
6
|
+
note: string;
|
|
7
|
+
editing: boolean;
|
|
8
|
+
messages: SheetNoteMessages;
|
|
9
|
+
};
|
|
10
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
|
|
11
|
+
focus: () => void | undefined;
|
|
12
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
13
|
+
cancel: (leaving: boolean) => any;
|
|
14
|
+
save: (note: string, leaving: boolean) => any;
|
|
15
|
+
hover: (inside: boolean) => any;
|
|
16
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
17
|
+
onCancel?: ((leaving: boolean) => any) | undefined;
|
|
18
|
+
onSave?: ((note: string, leaving: boolean) => any) | undefined;
|
|
19
|
+
onHover?: ((inside: boolean) => any) | undefined;
|
|
20
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
21
|
+
declare const _default: typeof __VLS_export;
|
|
22
|
+
export default _default;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { SheetAxis } from '../core/axis';
|
|
2
|
+
import { type SheetGroupAxis, type SheetGroupLines, type SheetGroupSummary } from '../core/group';
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
axis: 'row' | 'col';
|
|
5
|
+
groups: SheetGroupAxis;
|
|
6
|
+
/** Which side of a group its button is on. */
|
|
7
|
+
summary: SheetGroupSummary;
|
|
8
|
+
lines: SheetAxis;
|
|
9
|
+
/** Frozen lines, which don't scroll. */
|
|
10
|
+
frozen: number;
|
|
11
|
+
/** The header before the first line: the column letters for rows. */
|
|
12
|
+
head: number;
|
|
13
|
+
scroll: number;
|
|
14
|
+
/** The grid's size along the axis. */
|
|
15
|
+
view: number;
|
|
16
|
+
/** Whether to show the level buttons by the headers. */
|
|
17
|
+
levels: boolean;
|
|
18
|
+
/** The room before the outline along the axis, the other outline's corner, which a finger may reach into. */
|
|
19
|
+
before: number;
|
|
20
|
+
/** Labels of the buttons. */
|
|
21
|
+
label: (group: SheetGroupLines) => string;
|
|
22
|
+
levelLabel: (level: number) => string;
|
|
23
|
+
};
|
|
24
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
|
|
25
|
+
size: import("vue").ComputedRef<number>;
|
|
26
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
27
|
+
toggle: (group: SheetGroupLines) => any;
|
|
28
|
+
wheel: (event: WheelEvent) => any;
|
|
29
|
+
level: (level: number) => any;
|
|
30
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
31
|
+
onToggle?: ((group: SheetGroupLines) => any) | undefined;
|
|
32
|
+
onWheel?: ((event: WheelEvent) => any) | undefined;
|
|
33
|
+
onLevel?: ((level: number) => any) | undefined;
|
|
34
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
35
|
+
declare const _default: typeof __VLS_export;
|
|
36
|
+
export default _default;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
/** Whether to show the button that adds a sheet; `true` by default. */
|
|
3
|
+
addable?: boolean;
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
6
|
+
addable: boolean;
|
|
7
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
8
|
+
declare const _default: typeof __VLS_export;
|
|
9
|
+
export default _default;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { SheetToolbarProps, SheetToolbarSlots } from '../types';
|
|
2
|
+
type __VLS_Slots = SheetToolbarSlots;
|
|
3
|
+
declare const __VLS_base: import("vue").DefineComponent<SheetToolbarProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<SheetToolbarProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
4
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
5
|
+
declare const _default: typeof __VLS_export;
|
|
6
|
+
export default _default;
|
|
7
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
8
|
+
new (): {
|
|
9
|
+
$slots: S;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { SheetValidation } from '../core/model';
|
|
2
|
+
import type { SheetMessages } from '../locale';
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
rule: SheetValidation;
|
|
5
|
+
/** Whether the rule is one the sheet has, which can be removed. */
|
|
6
|
+
editing: boolean;
|
|
7
|
+
messages: SheetMessages;
|
|
8
|
+
};
|
|
9
|
+
type __VLS_ModelProps = {
|
|
10
|
+
'open': boolean;
|
|
11
|
+
};
|
|
12
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
13
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
14
|
+
remove: () => any;
|
|
15
|
+
apply: (rule: SheetValidation) => any;
|
|
16
|
+
"update:open": (value: boolean) => any;
|
|
17
|
+
closed: () => any;
|
|
18
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
19
|
+
onRemove?: (() => any) | undefined;
|
|
20
|
+
onApply?: ((rule: SheetValidation) => any) | undefined;
|
|
21
|
+
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
22
|
+
onClosed?: (() => any) | undefined;
|
|
23
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
24
|
+
declare const _default: typeof __VLS_export;
|
|
25
|
+
export default _default;
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import type { SheetFunction } from './formula/functions';
|
|
2
|
+
import { type ComputedRef, type InjectionKey, type Ref } from 'vue';
|
|
3
|
+
import type { SheetBounds, SheetPoint } from './core/address';
|
|
4
|
+
import type { SheetResolvedType } from './core/cell-type';
|
|
5
|
+
import type { SheetData, SheetSortOrder, SheetStyle, SheetValue, SheetWorkbook } from './core/model';
|
|
6
|
+
import type { SheetResult } from './formula/values';
|
|
7
|
+
import type { SheetExporterInfo, SheetImporterInfo } from './core/file';
|
|
8
|
+
import type { SheetSelection } from './core/selection';
|
|
9
|
+
import type { SheetStylePatch } from './core/transaction';
|
|
10
|
+
import type { SheetMessages } from './locale';
|
|
11
|
+
import type { SheetExpose, SheetToolbarItem } from './types';
|
|
12
|
+
/** A box in the grid, in px from its top left corner, as drawn now (after scrolling). */
|
|
13
|
+
export interface SheetRect {
|
|
14
|
+
x: number;
|
|
15
|
+
y: number;
|
|
16
|
+
width: number;
|
|
17
|
+
height: number;
|
|
18
|
+
}
|
|
19
|
+
/** Where a range shows: its part in view, with the edges the view cuts off. */
|
|
20
|
+
export interface SheetRangeRect extends SheetRect {
|
|
21
|
+
cut: {
|
|
22
|
+
top: boolean;
|
|
23
|
+
right: boolean;
|
|
24
|
+
bottom: boolean;
|
|
25
|
+
left: boolean;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
/** The surrounding sheet, as `useSheet()` and extensions see it. */
|
|
29
|
+
export interface SheetContext {
|
|
30
|
+
/** The workbook, as of the last change. */
|
|
31
|
+
doc: Readonly<Ref<SheetWorkbook>>;
|
|
32
|
+
/** The index of the sheet shown. */
|
|
33
|
+
sheetIndex: ComputedRef<number>;
|
|
34
|
+
/** The sheet shown. */
|
|
35
|
+
sheet: ComputedRef<SheetData>;
|
|
36
|
+
selection: Readonly<Ref<SheetSelection>>;
|
|
37
|
+
/** The cell the keyboard is on. */
|
|
38
|
+
active: ComputedRef<SheetPoint>;
|
|
39
|
+
readonly: ComputedRef<boolean>;
|
|
40
|
+
/** Whether the grid or its cell editor has the keyboard focus. */
|
|
41
|
+
focused: Readonly<Ref<boolean>>;
|
|
42
|
+
messages: ComputedRef<SheetMessages>;
|
|
43
|
+
/**
|
|
44
|
+
* Calls `callback` for each selected cell of the sheet shown, once each,
|
|
45
|
+
* row by row; a merged cell counts once, at its top left cell.
|
|
46
|
+
*/
|
|
47
|
+
forEachSelected: (callback: (point: SheetPoint) => void) => void;
|
|
48
|
+
/** The value in a cell of the sheet shown; for a formula, the formula. */
|
|
49
|
+
value: (point: SheetPoint) => SheetValue;
|
|
50
|
+
/** What a cell of the sheet shown comes to: its formula's result, or its value. */
|
|
51
|
+
result: (point: SheetPoint) => SheetResult;
|
|
52
|
+
/** A cell's type and its settings, or `undefined` for a plain cell. */
|
|
53
|
+
cellType: (point: SheetPoint) => SheetResolvedType | undefined;
|
|
54
|
+
/** Where a cell (or the merged cell it is in) is drawn now; `null` while it is out of view. */
|
|
55
|
+
cellRect: (point: SheetPoint) => SheetRect | null;
|
|
56
|
+
/**
|
|
57
|
+
* Where the part of a range of the sheet shown that is in view is drawn
|
|
58
|
+
* now, past the frozen rows and columns too; `null` while none of it is.
|
|
59
|
+
*/
|
|
60
|
+
rangeRect: (bounds: SheetBounds) => SheetRangeRect | null;
|
|
61
|
+
/**
|
|
62
|
+
* Makes a change as the person using the grid, like the toolbar does.
|
|
63
|
+
* Unlike the component's `transact`, a `readonly` grid refuses it:
|
|
64
|
+
* the transaction comes back with `tr.cancelled` set (and no
|
|
65
|
+
* `transactionCancel`), unless `meta.history` is `false`. Otherwise as
|
|
66
|
+
* the component's: returns the transaction, `tr.changed` says whether
|
|
67
|
+
* it changed anything, and protected cells refuse it unless
|
|
68
|
+
* `meta.protection` or `meta.history` is `false`.
|
|
69
|
+
*/
|
|
70
|
+
transact: SheetExpose['transact'];
|
|
71
|
+
/** Undoes as the person using the grid: does nothing on a `readonly` grid. */
|
|
72
|
+
undo: SheetExpose['undo'];
|
|
73
|
+
/** Redoes as the person using the grid: does nothing on a `readonly` grid. */
|
|
74
|
+
redo: SheetExpose['redo'];
|
|
75
|
+
canUndo: Readonly<Ref<boolean>>;
|
|
76
|
+
canRedo: Readonly<Ref<boolean>>;
|
|
77
|
+
select: SheetExpose['select'];
|
|
78
|
+
scrollTo: SheetExpose['scrollTo'];
|
|
79
|
+
edit: SheetExpose['edit'];
|
|
80
|
+
focus: SheetExpose['focus'];
|
|
81
|
+
showSheet: SheetExpose['showSheet'];
|
|
82
|
+
toCSV: SheetExpose['toCSV'];
|
|
83
|
+
exportSVG: SheetExpose['exportSVG'];
|
|
84
|
+
exportPNG: SheetExpose['exportPNG'];
|
|
85
|
+
print: SheetExpose['print'];
|
|
86
|
+
/** How a cell of the sheet shown looks: its style, or `{}`. A merged cell has its top left cell's. */
|
|
87
|
+
styleAt: (point: SheetPoint) => SheetStyle;
|
|
88
|
+
/** A cell's number or date format. */
|
|
89
|
+
formatAt: (point: SheetPoint) => string | undefined;
|
|
90
|
+
/**
|
|
91
|
+
* Changes how the selected cells look, as `tr.styleCells` does; `null`
|
|
92
|
+
* takes their styles off. Returns whether anything changed.
|
|
93
|
+
*/
|
|
94
|
+
styleSelection: (patch: SheetStylePatch | null) => boolean;
|
|
95
|
+
/** Sets the format of the selected cells, or changes each with a function, as `tr.formatCells` does. */
|
|
96
|
+
formatSelection: (format: string | undefined | ((format: string | undefined, value: SheetValue) => string | undefined)) => boolean;
|
|
97
|
+
/** Takes the styles and formats off the selected cells. */
|
|
98
|
+
clearFormatting: () => boolean;
|
|
99
|
+
/** Whether the selection touches merged cells. */
|
|
100
|
+
merged: ComputedRef<boolean>;
|
|
101
|
+
/** Whether the selection can be merged: one range of more than one cell, not one merge already. */
|
|
102
|
+
canMerge: ComputedRef<boolean>;
|
|
103
|
+
/** Merges the selection into one cell, telling how many values that cleared. */
|
|
104
|
+
merge: () => void;
|
|
105
|
+
/** Splits the merged cells the selection touches. */
|
|
106
|
+
unmerge: () => void;
|
|
107
|
+
/**
|
|
108
|
+
* Sorts by the active cell's column: the selected rows, or the filter's
|
|
109
|
+
* rows, or the block of cells around it. Returns whether it sorted.
|
|
110
|
+
*/
|
|
111
|
+
sort: (order: SheetSortOrder) => boolean;
|
|
112
|
+
/** Whether the sheet shown has a filter. */
|
|
113
|
+
filtered: ComputedRef<boolean>;
|
|
114
|
+
/** Puts a filter on the selection (or the block around the active cell), or takes it off. */
|
|
115
|
+
toggleFilter: () => void;
|
|
116
|
+
/** Says `text` to screen readers. */
|
|
117
|
+
announce: (text: string) => void;
|
|
118
|
+
/** What the sheet can do by name, built in and added by extensions: run them, or read their state. */
|
|
119
|
+
commands: SheetExpose['commands'];
|
|
120
|
+
exportFile: SheetExpose['exportFile'];
|
|
121
|
+
saveFile: SheetExpose['saveFile'];
|
|
122
|
+
importFile: SheetExpose['importFile'];
|
|
123
|
+
/** The exporters, labels in the sheet's language: the built-in ones (CSV, PNG, SVG), then the extensions'. */
|
|
124
|
+
exporters: ComputedRef<SheetExporterInfo[]>;
|
|
125
|
+
/** The importers, in the order they are asked: the extensions', then the built-in CSV one. */
|
|
126
|
+
importers: ComputedRef<SheetImporterInfo[]>;
|
|
127
|
+
/** What a file picker for the importers accepts, such as `.csv,text/csv`. */
|
|
128
|
+
importAccept: ComputedRef<string>;
|
|
129
|
+
/** The items extensions add to the toolbar, in priority order. */
|
|
130
|
+
toolbarItems: ComputedRef<SheetToolbarItem[]>;
|
|
131
|
+
/** The cell being edited, for inputs outside the grid such as the formula bar. */
|
|
132
|
+
editor: SheetEditorContext;
|
|
133
|
+
}
|
|
134
|
+
/** How an input outside the grid edits the cell, for `editor.attach`. */
|
|
135
|
+
export interface SheetEditInputOptions {
|
|
136
|
+
/**
|
|
137
|
+
* The input shows the text and caret itself, following `editor.text`
|
|
138
|
+
* and `editor.caret`, and reports its own with `input` and `moveCaret`;
|
|
139
|
+
* the sheet doesn't write its value. For an input whose element isn't
|
|
140
|
+
* what holds the text, such as a code editor's.
|
|
141
|
+
*/
|
|
142
|
+
managed?: boolean;
|
|
143
|
+
/** What the function list and argument hints go under; the input by default. */
|
|
144
|
+
anchor?: HTMLElement;
|
|
145
|
+
}
|
|
146
|
+
/** Editing the active cell from outside the grid, as the formula bar does. */
|
|
147
|
+
export interface SheetEditorContext {
|
|
148
|
+
/** The cell being edited and how: `'enter'` began by typing, so the arrows move on (or point, in a formula). */
|
|
149
|
+
cell: ComputedRef<{
|
|
150
|
+
sheet: number;
|
|
151
|
+
row: number;
|
|
152
|
+
col: number;
|
|
153
|
+
mode: 'enter' | 'edit';
|
|
154
|
+
} | null>;
|
|
155
|
+
/** The text being edited. */
|
|
156
|
+
text: Readonly<Ref<string>>;
|
|
157
|
+
/** Where the caret is in `text`. */
|
|
158
|
+
caret: Readonly<Ref<number>>;
|
|
159
|
+
/** The text a cell edits as: its formula, or its value as typed. */
|
|
160
|
+
textAt: (point: SheetPoint) => string;
|
|
161
|
+
/** Sets the text being edited, starting an edit of the active cell when none is open. */
|
|
162
|
+
input: (text: string, caret?: number) => boolean;
|
|
163
|
+
/** Tells where the input's caret is, after keys or a click moved it. */
|
|
164
|
+
moveCaret: (caret: number) => void;
|
|
165
|
+
/** Handles a key the way the cell's editor does (completion, pointing, Enter, Tab, Escape); `true` when it did. */
|
|
166
|
+
key: (event: KeyboardEvent) => boolean;
|
|
167
|
+
/** Saves the edit, then moves the way Enter (`'down'`) or Tab (`'right'`) do. */
|
|
168
|
+
commit: (move?: 'up' | 'down' | 'left' | 'right') => void;
|
|
169
|
+
/** Drops the edit. */
|
|
170
|
+
cancel: () => void;
|
|
171
|
+
/** Lets an input edit the cell: focus moving to it keeps the edit open. Returns a function that undoes it. */
|
|
172
|
+
attach: (el: HTMLInputElement | HTMLTextAreaElement, options?: SheetEditInputOptions) => () => void;
|
|
173
|
+
/** The id of the list of functions and argument hints, for `aria-controls`. */
|
|
174
|
+
helpId: string;
|
|
175
|
+
/** The functions formulas can call, built in and added, by name. */
|
|
176
|
+
functions: ComputedRef<readonly SheetFunction[]>;
|
|
177
|
+
}
|
|
178
|
+
export declare const sheetContextKey: InjectionKey<SheetContext>;
|
|
179
|
+
/** Where a range shows: its part in view, with the edges the view cuts off. */
|
|
180
|
+
export interface SheetRangeRect extends SheetRect {
|
|
181
|
+
cut: {
|
|
182
|
+
top: boolean;
|
|
183
|
+
right: boolean;
|
|
184
|
+
bottom: boolean;
|
|
185
|
+
left: boolean;
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
/** The surrounding sheet; for overlays, cell types' components and the grid's slots. */
|
|
189
|
+
export declare function useSheet(): SheetContext;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/** A cell, by zero-based row and column. */
|
|
2
|
+
export interface SheetPoint {
|
|
3
|
+
row: number;
|
|
4
|
+
col: number;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* A rectangle of cells between two corners. `start` is where the range was
|
|
8
|
+
* started (the anchor), so it may be below or right of `end`.
|
|
9
|
+
*/
|
|
10
|
+
export interface SheetRange {
|
|
11
|
+
start: SheetPoint;
|
|
12
|
+
end: SheetPoint;
|
|
13
|
+
}
|
|
14
|
+
/** A range with its edges in order: `top <= bottom`, `left <= right`. */
|
|
15
|
+
export interface SheetBounds {
|
|
16
|
+
top: number;
|
|
17
|
+
left: number;
|
|
18
|
+
bottom: number;
|
|
19
|
+
right: number;
|
|
20
|
+
}
|
|
21
|
+
/** A column's letters: 0 is `A`, 25 is `Z`, 26 is `AA`. */
|
|
22
|
+
export declare function columnName(col: number): string;
|
|
23
|
+
/** A column's number from its letters, any case; `-1` when they aren't letters. */
|
|
24
|
+
export declare function columnIndex(name: string): number;
|
|
25
|
+
/** `'B3'` as `{ row: 2, col: 1 }`; `$` marks are allowed. `null` when it isn't a cell name. */
|
|
26
|
+
export declare function parseCell(name: string): SheetPoint | null;
|
|
27
|
+
/** A cell's name, such as `B3`. */
|
|
28
|
+
export declare const formatCell: (point: SheetPoint) => string;
|
|
29
|
+
/** A cell, as a name such as `'B3'` or as a point. */
|
|
30
|
+
export type SheetCellTarget = string | SheetPoint;
|
|
31
|
+
/**
|
|
32
|
+
* `'A1:C4'` or `'B2'` as a range; also whole columns (`'B:D'`) and whole
|
|
33
|
+
* rows (`'2:3'`), which run to `Infinity` until kept inside a sheet.
|
|
34
|
+
* `null` when it isn't one.
|
|
35
|
+
*/
|
|
36
|
+
export declare function parseRange(text: string): SheetRange | null;
|
|
37
|
+
/**
|
|
38
|
+
* A range's name with its corners in order, such as `A1:C4`; one cell is
|
|
39
|
+
* just its name. Given the sheet's size, whole columns read `B:D` and
|
|
40
|
+
* whole rows `2:3`.
|
|
41
|
+
*/
|
|
42
|
+
export declare function formatRange(range: SheetRange, size?: {
|
|
43
|
+
rows: number;
|
|
44
|
+
cols: number;
|
|
45
|
+
}): string;
|
|
46
|
+
/**
|
|
47
|
+
* Splits a reference into the sheet it names and the rest: `'表 2'!A5`
|
|
48
|
+
* and `表2!A5` both give `表 2` / `表2` and `A5`. Without a `!`, no sheet.
|
|
49
|
+
*/
|
|
50
|
+
export declare function splitSheet(text: string): {
|
|
51
|
+
sheet?: string;
|
|
52
|
+
ref: string;
|
|
53
|
+
};
|
|
54
|
+
export declare function boundsOf(range: SheetRange): SheetBounds;
|
|
55
|
+
export declare const inBounds: (b: SheetBounds, row: number, col: number) => boolean;
|
|
56
|
+
/** A range of one cell. */
|
|
57
|
+
export declare const pointRange: (point: SheetPoint) => SheetRange;
|
|
58
|
+
/** One end of a reference: a column, a row or both, each maybe fixed with `$`. */
|
|
59
|
+
export interface RefEnd {
|
|
60
|
+
col?: number;
|
|
61
|
+
row?: number;
|
|
62
|
+
colMark: boolean;
|
|
63
|
+
rowMark: boolean;
|
|
64
|
+
}
|
|
65
|
+
/** A sheet's name as a reference writes it: quoted unless it is a plain word. */
|
|
66
|
+
export declare function quoteSheet(name: string): string;
|
|
67
|
+
/**
|
|
68
|
+
* Calls `map` for every reference in a formula, with its sheet (as
|
|
69
|
+
* written, unquoted) and its two ends, and puts back the text it returns.
|
|
70
|
+
*/
|
|
71
|
+
export declare function eachRef(formula: string, map: (sheet: string | undefined, a: RefEnd, b: RefEnd, text: string) => string): string;
|
|
72
|
+
export declare function writeRef(sheet: string | undefined, a: RefEnd, b: RefEnd, single: boolean, written?: string): string;
|
|
73
|
+
/**
|
|
74
|
+
* A formula moved by `rows` and `cols`, as copying or filling it does:
|
|
75
|
+
* references without `$` move along, `$A$1` stays. A reference pushed past
|
|
76
|
+
* the first row or column becomes `#REF!`.
|
|
77
|
+
*/
|
|
78
|
+
export declare function shiftFormula(formula: string, rows: number, cols: number): string;
|
|
79
|
+
/**
|
|
80
|
+
* Where the cells of a range are after a change to a sheet: the same
|
|
81
|
+
* bounds, new bounds, bounds on another sheet, or `null` when they are
|
|
82
|
+
* gone. Whole columns run from row 0 to `Infinity`, whole rows likewise.
|
|
83
|
+
*/
|
|
84
|
+
export type SheetRefMap = (bounds: SheetBounds) => SheetBounds | {
|
|
85
|
+
sheet: string;
|
|
86
|
+
bounds: SheetBounds;
|
|
87
|
+
} | null;
|
|
88
|
+
/**
|
|
89
|
+
* Rewrites the references in a formula on sheet `here` that point at cells
|
|
90
|
+
* on sheet `sheet`, by `map`: references to cells that moved follow them,
|
|
91
|
+
* references to cells that are gone become `#REF!`. Unlike copying, fixed
|
|
92
|
+
* references (`$A$1`) move too.
|
|
93
|
+
*/
|
|
94
|
+
export declare function moveReferences(formula: string, here: string, sheet: string, map: SheetRefMap): string;
|
|
95
|
+
/**
|
|
96
|
+
* A formula with its references to sheet `from` naming sheet `to`
|
|
97
|
+
* instead, as renaming a sheet does. References without a sheet stay as
|
|
98
|
+
* they are, also in a formula on the renamed sheet itself.
|
|
99
|
+
*/
|
|
100
|
+
export declare function renameReferences(formula: string, from: string, to: string): string;
|
|
101
|
+
/**
|
|
102
|
+
* A formula with references to several sheets renamed at once, by old
|
|
103
|
+
* name: `{ 预算: '预算 (2)' }`. Names that swap or chain are each renamed
|
|
104
|
+
* once. A name mapped to itself has its references written again, quoted
|
|
105
|
+
* as `quoteSheet` quotes it.
|
|
106
|
+
*/
|
|
107
|
+
export declare function renameReferencesAll(formula: string, names: ReadonlyMap<string, string>): string;
|
|
108
|
+
/** A formula with its references to sheet `sheet`, which is gone, reading `#REF!`. */
|
|
109
|
+
export declare function dropReferences(formula: string, sheet: string): string;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where each row (or column) starts, for a list of rows that share one
|
|
3
|
+
* size except for a few. Offsets are summed once, so finding a row's place
|
|
4
|
+
* and the row at a place are a lookup and a binary search.
|
|
5
|
+
*/
|
|
6
|
+
export declare class SheetAxis {
|
|
7
|
+
readonly count: number;
|
|
8
|
+
readonly base: number;
|
|
9
|
+
readonly sizes: Readonly<Record<number, number>>;
|
|
10
|
+
/** `offsets[i]` is where item `i` starts; the last entry is the total. */
|
|
11
|
+
private offsets;
|
|
12
|
+
constructor(count: number, base: number, sizes?: Readonly<Record<number, number>>);
|
|
13
|
+
get total(): number;
|
|
14
|
+
/** Where item `index` starts; past the end, the total. */
|
|
15
|
+
offset(index: number): number;
|
|
16
|
+
size(index: number): number;
|
|
17
|
+
/** Whether item `index` is hidden (its size is 0). */
|
|
18
|
+
hidden(index: number): boolean;
|
|
19
|
+
/** The item at `px`, clamped to the first and last; hidden items are skipped. */
|
|
20
|
+
indexAt(px: number): number;
|
|
21
|
+
/** The first item from `index` on (going by `step`) that is not hidden; `index` when all are. */
|
|
22
|
+
visibleFrom(index: number, step: 1 | -1): number;
|
|
23
|
+
}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import type { Component } from 'vue';
|
|
2
|
+
import type { SheetMessages } from '../locale';
|
|
3
|
+
import type { SheetInput } from './format';
|
|
4
|
+
import type { SheetCell, SheetSelectOption, SheetTypeSetup, SheetValue, SheetWorkbook } from './model';
|
|
5
|
+
/** What a type's `render` component gets. */
|
|
6
|
+
export interface SheetCellRenderProps {
|
|
7
|
+
value: SheetValue;
|
|
8
|
+
/** The value as text, formatted as the cell would show it. */
|
|
9
|
+
text: string;
|
|
10
|
+
setup: SheetTypeSetup;
|
|
11
|
+
/** Whether the grid is read-only. */
|
|
12
|
+
readonly: boolean;
|
|
13
|
+
}
|
|
14
|
+
/** What a type's `panel` component gets. */
|
|
15
|
+
export interface SheetCellPanelProps {
|
|
16
|
+
/** The value in the cell when editing began. */
|
|
17
|
+
value: SheetValue;
|
|
18
|
+
/** What is typed in the editor now. */
|
|
19
|
+
text: string;
|
|
20
|
+
/** Whether anything was typed since editing began. */
|
|
21
|
+
typed: boolean;
|
|
22
|
+
setup: SheetTypeSetup;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* What a type's `panel` may expose: keys the editor passes on first, e.g.
|
|
26
|
+
* the arrow keys to move through a list. Return `true` when handled.
|
|
27
|
+
*/
|
|
28
|
+
export interface SheetCellPanelExpose {
|
|
29
|
+
onKey?: (event: KeyboardEvent) => boolean;
|
|
30
|
+
}
|
|
31
|
+
export interface SheetCellType {
|
|
32
|
+
/** The name cells refer to with `type`. */
|
|
33
|
+
name: string;
|
|
34
|
+
/**
|
|
35
|
+
* Reads typed or pasted text. Return `undefined` to read it as any cell
|
|
36
|
+
* does (numbers, dates, `TRUE`…).
|
|
37
|
+
*/
|
|
38
|
+
parse?: (text: string, setup: SheetTypeSetup) => SheetInput | undefined;
|
|
39
|
+
/**
|
|
40
|
+
* The text shown for a value; by default the value with the cell's
|
|
41
|
+
* `format`. Copying and screen readers use it too.
|
|
42
|
+
*/
|
|
43
|
+
format?: (value: SheetValue, setup: SheetTypeSetup) => string | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* The text the editor starts with, which `parse` reads back. By default
|
|
46
|
+
* the text `format` gives, or the value as typed when there is no `format`.
|
|
47
|
+
*/
|
|
48
|
+
edit?: (value: SheetValue, setup: SheetTypeSetup) => string | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* Whether a value fits the type: `true`, or `false` or a short sentence
|
|
51
|
+
* saying why not, e.g. text in a date cell. A cell whose value doesn't fit
|
|
52
|
+
* gets a small mark in its corner; the sentence shows on hover and is read
|
|
53
|
+
* out. Empty cells always fit.
|
|
54
|
+
*/
|
|
55
|
+
valid?: (value: SheetValue, setup: SheetTypeSetup, messages: SheetMessages) => boolean | string;
|
|
56
|
+
/**
|
|
57
|
+
* Drawn in the cell instead of its text; props are `SheetCellRenderProps`.
|
|
58
|
+
* Keep it light: it is drawn for every visible cell of the type. An
|
|
59
|
+
* element in it with `data-sheet-toggle` switches the value on a click.
|
|
60
|
+
*/
|
|
61
|
+
render?: Component;
|
|
62
|
+
/**
|
|
63
|
+
* Shown under the cell while it is edited, such as a calendar. Props are
|
|
64
|
+
* `SheetCellPanelProps`; emit `pick` with a value to write it and finish.
|
|
65
|
+
*/
|
|
66
|
+
panel?: Component;
|
|
67
|
+
/**
|
|
68
|
+
* Switches the value instead of opening the editor: on `Space`, `F2`, a
|
|
69
|
+
* double click or a click on a `data-sheet-toggle` element. `Space`
|
|
70
|
+
* switches every selected cell of the type: all to the same value when
|
|
71
|
+
* they hold the same, otherwise all to what an empty cell switches to.
|
|
72
|
+
*/
|
|
73
|
+
toggle?: (value: SheetValue, setup: SheetTypeSetup) => SheetValue;
|
|
74
|
+
/** Where the content sits when the cell's style doesn't say. */
|
|
75
|
+
align?: 'left' | 'center' | 'right';
|
|
76
|
+
/**
|
|
77
|
+
* The value written into files for other spreadsheet programs, such as a
|
|
78
|
+
* number for a rating; by default the value itself. Exporters read it as
|
|
79
|
+
* `source.plain`.
|
|
80
|
+
*/
|
|
81
|
+
plain?: (value: SheetValue, setup: SheetTypeSetup) => SheetValue;
|
|
82
|
+
/**
|
|
83
|
+
* What the cell shows in pictures of the sheet (`png`, `svg` and printing),
|
|
84
|
+
* as SVG markup in the cell's own coordinates, from its top left corner,
|
|
85
|
+
* kept to the cell. Text put in the markup must go through `draw.escape`.
|
|
86
|
+
* Not asked for empty cells or formula errors, which show as text. By
|
|
87
|
+
* default the cell's text; a type with `render` draws its own content
|
|
88
|
+
* here, as pictures can't hold components.
|
|
89
|
+
*/
|
|
90
|
+
draw?: (value: SheetValue, setup: SheetTypeSetup, draw: SheetDrawContext) => string;
|
|
91
|
+
}
|
|
92
|
+
/** A place in a cell's picture, in the cell's own coordinates. */
|
|
93
|
+
export interface SheetDrawRect {
|
|
94
|
+
x: number;
|
|
95
|
+
y: number;
|
|
96
|
+
width: number;
|
|
97
|
+
height: number;
|
|
98
|
+
}
|
|
99
|
+
/** How `draw.text` writes text; by default as the cell's look says. */
|
|
100
|
+
export interface SheetDrawTextOptions {
|
|
101
|
+
align?: 'left' | 'center' | 'right';
|
|
102
|
+
valign?: 'top' | 'middle' | 'bottom';
|
|
103
|
+
/** A color as SVG takes it, e.g. from `draw.color`. */
|
|
104
|
+
color?: string;
|
|
105
|
+
bold?: boolean;
|
|
106
|
+
italic?: boolean;
|
|
107
|
+
/** In px. */
|
|
108
|
+
size?: number;
|
|
109
|
+
}
|
|
110
|
+
/** What a cell type's `draw` gets: the cell's size and look, and tools to draw with. */
|
|
111
|
+
export interface SheetDrawContext {
|
|
112
|
+
/** The cell's size. */
|
|
113
|
+
width: number;
|
|
114
|
+
height: number;
|
|
115
|
+
/** The text the cell shows, as `format` gives it. */
|
|
116
|
+
formatted: string;
|
|
117
|
+
/** The cell's look, in colors SVG takes. */
|
|
118
|
+
look: {
|
|
119
|
+
color: string;
|
|
120
|
+
/** The fill, `null` for none. */
|
|
121
|
+
background: string | null;
|
|
122
|
+
align: 'left' | 'center' | 'right';
|
|
123
|
+
valign: 'top' | 'middle' | 'bottom';
|
|
124
|
+
bold: boolean;
|
|
125
|
+
italic: boolean;
|
|
126
|
+
fontFamily: string;
|
|
127
|
+
/** In px. */
|
|
128
|
+
fontSize: number;
|
|
129
|
+
};
|
|
130
|
+
/** Text on one line in a box (the whole cell by default), escaped, in the cell's look unless `options` say otherwise. */
|
|
131
|
+
text: (value: string, box?: SheetDrawRect, options?: SheetDrawTextOptions) => string;
|
|
132
|
+
/** An icon component, e.g. from `@dou-ui/icons`, as SVG. */
|
|
133
|
+
icon: (icon: Component, box: SheetDrawRect, color: string) => string;
|
|
134
|
+
/**
|
|
135
|
+
* A CSS color, also one with variables such as `var(--dou-color-primary)`,
|
|
136
|
+
* as a color every SVG reader understands, read in the sheet's theme.
|
|
137
|
+
*/
|
|
138
|
+
color: (value: string) => string;
|
|
139
|
+
/** Escapes text for SVG markup. */
|
|
140
|
+
escape: (text: string) => string;
|
|
141
|
+
}
|
|
142
|
+
/** Declares a cell type; only gives it a type. */
|
|
143
|
+
export declare function defineSheetCellType(type: SheetCellType): SheetCellType;
|
|
144
|
+
/** A cell's type, resolved: its name, what defines it and its settings. */
|
|
145
|
+
export interface SheetResolvedType {
|
|
146
|
+
/** The cell type's name, e.g. `select` for a cell whose `type` is a setup of a list. */
|
|
147
|
+
name: string;
|
|
148
|
+
definition: SheetCellType;
|
|
149
|
+
setup: SheetTypeSetup;
|
|
150
|
+
}
|
|
151
|
+
/** The type of a cell, or `undefined` when it has none or the type isn't known. */
|
|
152
|
+
export declare function resolveCellType(cell: SheetCell | undefined, book: SheetWorkbook, types: ReadonlyMap<string, SheetCellType>): SheetResolvedType | undefined;
|
|
153
|
+
/** A `select` option as a value with an optional tone. */
|
|
154
|
+
export declare function optionOf(option: SheetSelectOption): {
|
|
155
|
+
value: SheetValue;
|
|
156
|
+
tone?: import("dou-ui").Tone;
|
|
157
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { type SheetCellInput, type SheetStyle, type SheetValue } from './model';
|
|
2
|
+
import { type SheetResult } from '../formula/values';
|
|
3
|
+
/** A block of cells on the clipboard. */
|
|
4
|
+
export interface SheetClip {
|
|
5
|
+
/** The cells, row by row. */
|
|
6
|
+
cells: SheetCellInput[][];
|
|
7
|
+
/** The named styles the cells use. */
|
|
8
|
+
styles?: Record<string, SheetStyle>;
|
|
9
|
+
/** Where the block was copied from, so formulas can move along when pasted. */
|
|
10
|
+
from?: {
|
|
11
|
+
row: number;
|
|
12
|
+
col: number;
|
|
13
|
+
};
|
|
14
|
+
/** Set when the block was cut: pasting it moves the cells. */
|
|
15
|
+
cut?: string;
|
|
16
|
+
}
|
|
17
|
+
/** How `formatClip` writes cells as text. */
|
|
18
|
+
export interface SheetClipFormat {
|
|
19
|
+
/** The language dates are shown in. */
|
|
20
|
+
locale?: string;
|
|
21
|
+
/**
|
|
22
|
+
* What a formula comes to, by its row and column in the clip, e.g. from
|
|
23
|
+
* `SheetFormulaEngine.result`; the formula itself by default.
|
|
24
|
+
*/
|
|
25
|
+
result?: (row: number, col: number) => SheetResult;
|
|
26
|
+
/**
|
|
27
|
+
* A cell's text, e.g. as its cell type shows it; `undefined` uses its
|
|
28
|
+
* format. `value` is its value, or its formula's result.
|
|
29
|
+
*/
|
|
30
|
+
text?: (input: SheetCellInput, value: SheetValue) => string | undefined;
|
|
31
|
+
}
|
|
32
|
+
/** The clipboard's text and HTML for a block of cells, with the text as the cells show it. */
|
|
33
|
+
export declare function formatClip(clip: SheetClip, options?: SheetClipFormat): {
|
|
34
|
+
text: string;
|
|
35
|
+
html: string;
|
|
36
|
+
};
|
|
37
|
+
/** Splits tab-separated text into rows of fields, reading quoted fields. */
|
|
38
|
+
export declare function parseTSV(text: string): string[][];
|
|
39
|
+
/**
|
|
40
|
+
* Reads what was pasted. Cells copied from a sheet come back as they were;
|
|
41
|
+
* a table from elsewhere, or tab-separated text, comes back as values read
|
|
42
|
+
* the way typing them would, with formats such as `0%` they imply.
|
|
43
|
+
* `null` when there is nothing to paste.
|
|
44
|
+
*/
|
|
45
|
+
export declare function parseClip(data: {
|
|
46
|
+
html?: string;
|
|
47
|
+
text?: string;
|
|
48
|
+
}): SheetClip | null;
|