@4399ywkf/editor 0.14.2 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{DocView-VTKFMW46.js → DocView-7QBKHBU4.js} +4 -3
- package/dist/DocView-7QBKHBU4.js.map +1 -0
- package/dist/SheetView-WP4DKSDS.js +3 -0
- package/dist/{SheetView-6Z5EPBN4.js.map → SheetView-WP4DKSDS.js.map} +1 -1
- package/dist/base-model.d.ts +131 -0
- package/dist/base-model.js +3 -0
- package/dist/base-model.js.map +1 -0
- package/dist/base.d.ts +978 -0
- package/dist/base.js +14180 -0
- package/dist/base.js.map +1 -0
- package/dist/{chunk-FMTC3EDQ.js → chunk-4SIP4BYI.js} +3 -3
- package/dist/{chunk-FMTC3EDQ.js.map → chunk-4SIP4BYI.js.map} +1 -1
- package/dist/chunk-F4LWFKIA.js +2931 -0
- package/dist/chunk-F4LWFKIA.js.map +1 -0
- package/dist/chunk-S57WFYWY.js +2014 -0
- package/dist/chunk-S57WFYWY.js.map +1 -0
- package/dist/{chunk-ZLEGKX2U.js → chunk-X2JCKZP2.js} +9385 -9998
- package/dist/chunk-X2JCKZP2.js.map +1 -0
- package/dist/{chunk-OBKIMG6G.js → chunk-X4BUO2RH.js} +4 -4
- package/dist/{chunk-OBKIMG6G.js.map → chunk-X4BUO2RH.js.map} +1 -1
- package/dist/csv.js +1 -1
- package/dist/doc-standalone.js +11425 -9116
- package/dist/doc-standalone.js.map +1 -1
- package/dist/doc.d.ts +4 -379
- package/dist/doc.js +3 -2
- package/dist/doc.js.map +1 -1
- package/dist/editor-config-context-DvLRd7Gx.d.ts +382 -0
- package/dist/form-DqUOPVKI.d.ts +475 -0
- package/dist/{import-XL3AH3QH.js → import-TEZ37G5R.js} +5 -5
- package/dist/{import-XL3AH3QH.js.map → import-TEZ37G5R.js.map} +1 -1
- package/dist/index.js +2 -2
- package/dist/sheet.js +1 -1
- package/dist/style.css +2 -2
- package/dist/xlsx.js +4 -4
- package/package.json +10 -2
- package/dist/DocView-VTKFMW46.js.map +0 -1
- package/dist/SheetView-6Z5EPBN4.js +0 -3
- package/dist/chunk-ZLEGKX2U.js.map +0 -1
package/dist/base.d.ts
ADDED
|
@@ -0,0 +1,978 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { CSSProperties, ForwardRefRenderFunction } from 'react';
|
|
3
|
+
import * as Y from 'yjs';
|
|
4
|
+
import { y as FormQuestion } from './form-DqUOPVKI.js';
|
|
5
|
+
import { E as EditorVisualTheme } from './editor-config-context-DvLRd7Gx.js';
|
|
6
|
+
export { a as EditorConfig, b as EditorConfigProvider, c as EditorConfigProviderProps, d as EditorMentionConfig, e as EditorUploadConfig, f as EditorUserConfig, M as MentionUser, u as useEditorConfig } from './editor-config-context-DvLRd7Gx.js';
|
|
7
|
+
|
|
8
|
+
interface Anchor {
|
|
9
|
+
x: number;
|
|
10
|
+
y: number;
|
|
11
|
+
width: number;
|
|
12
|
+
height: number;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
interface BaseFormViewProps {
|
|
16
|
+
doc: Y.Doc;
|
|
17
|
+
tableId: string;
|
|
18
|
+
viewId: string;
|
|
19
|
+
readOnly?: boolean;
|
|
20
|
+
origin: unknown;
|
|
21
|
+
/** 「新增字段」:BaseView 打开字段配置面板 */
|
|
22
|
+
onAddField?: (anchor: Anchor) => void;
|
|
23
|
+
/** 「分享表单」:宿主提供(生成外部填写链接);不给不显示 */
|
|
24
|
+
onShareForm?: (anchor: Anchor) => void;
|
|
25
|
+
onNotice?: (message: string) => void;
|
|
26
|
+
}
|
|
27
|
+
interface BaseFormFillProps {
|
|
28
|
+
title: string;
|
|
29
|
+
description?: string;
|
|
30
|
+
questions: FormQuestion[];
|
|
31
|
+
/** 不能填写(没有添加记录的权限) */
|
|
32
|
+
readOnly?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* 提交。必填没填时抛 FormSubmitError(或任何带 missing 字段 id 数组的错误),逐题提示「该项为必填项」;
|
|
35
|
+
* 其他错误的 message 交给 onNotice。成功后显示「提交成功」和「再填一次」。
|
|
36
|
+
*/
|
|
37
|
+
onSubmit: (values: Record<string, unknown>) => unknown;
|
|
38
|
+
onNotice?: (message: string) => void;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* 填写表单(不依赖 Y.Doc):表单视图里的「填写表单」用它,宿主的外部填写页(分享表单的链接)也用它,
|
|
42
|
+
* 题目由服务端按同一份 formQuestions 算好给过来,提交走宿主的接口。值按字段类型规范化后交给 onSubmit。
|
|
43
|
+
*/
|
|
44
|
+
declare function BaseFormFill({ title, description, questions, readOnly, onSubmit, onNotice, }: BaseFormFillProps): react.JSX.Element;
|
|
45
|
+
/** 表单视图:「编辑表单」配置题目,「填写表单」提交一条记录(同飞书表单视图) */
|
|
46
|
+
declare function BaseFormView({ doc, tableId, viewId, readOnly, origin, onAddField, onShareForm, onNotice, }: BaseFormViewProps): react.JSX.Element | null;
|
|
47
|
+
|
|
48
|
+
interface IGridTheme {
|
|
49
|
+
staticWhite: string;
|
|
50
|
+
staticBlack: string;
|
|
51
|
+
iconBgCommon: string;
|
|
52
|
+
iconFgCommon: string;
|
|
53
|
+
iconFgHighlight: string;
|
|
54
|
+
iconBgHighlight: string;
|
|
55
|
+
iconBgSelected: string;
|
|
56
|
+
iconFgSelected: string;
|
|
57
|
+
iconSizeXS: number;
|
|
58
|
+
iconSizeSM: number;
|
|
59
|
+
iconSizeMD: number;
|
|
60
|
+
iconSizeLG: number;
|
|
61
|
+
fontSizeXXS: number;
|
|
62
|
+
fontSizeXS: number;
|
|
63
|
+
fontSizeSM: number;
|
|
64
|
+
fontSizeMD: number;
|
|
65
|
+
fontSizeLG: number;
|
|
66
|
+
fontFamily: string;
|
|
67
|
+
cellBg: string;
|
|
68
|
+
cellBgHovered: string;
|
|
69
|
+
cellBgSelected: string;
|
|
70
|
+
cellBgLoading: string;
|
|
71
|
+
cellLineColor: string;
|
|
72
|
+
cellLineColorActived: string;
|
|
73
|
+
cellTextColor: string;
|
|
74
|
+
cellTextColorHighlight: string;
|
|
75
|
+
cellOptionBg: string;
|
|
76
|
+
cellOptionBgHighlight: string;
|
|
77
|
+
cellOptionTextColor: string;
|
|
78
|
+
groupHeaderBgPrimary: string;
|
|
79
|
+
groupHeaderBgSecondary: string;
|
|
80
|
+
groupHeaderBgTertiary: string;
|
|
81
|
+
columnHeaderBg: string;
|
|
82
|
+
columnHeaderBgHovered: string;
|
|
83
|
+
columnHeaderBgSelected: string;
|
|
84
|
+
columnHeaderNameColor: string;
|
|
85
|
+
columnResizeHandlerBg: string;
|
|
86
|
+
columnDraggingPlaceholderBg: string;
|
|
87
|
+
columnStatisticBgHoveredPrimary: string;
|
|
88
|
+
columnStatisticBgHoveredSecondary: string;
|
|
89
|
+
columnStatisticBgHoveredTertiary: string;
|
|
90
|
+
rowHeaderTextColor: string;
|
|
91
|
+
appendRowBg: string;
|
|
92
|
+
appendRowBgHovered: string;
|
|
93
|
+
avatarBg: string;
|
|
94
|
+
avatarTextColor: string;
|
|
95
|
+
avatarSizeXS: number;
|
|
96
|
+
avatarSizeSM: number;
|
|
97
|
+
avatarSizeMD: number;
|
|
98
|
+
themeKey: string;
|
|
99
|
+
scrollBarBg: string;
|
|
100
|
+
interactionLineColorCommon: string;
|
|
101
|
+
interactionLineColorHighlight: string;
|
|
102
|
+
searchCursorBg: string;
|
|
103
|
+
searchTargetIndexBg: string;
|
|
104
|
+
searchTargetIndexSelectedBg: string;
|
|
105
|
+
commentCountBg: string;
|
|
106
|
+
commentCountTextColor: string;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* 默认主题:取飞书多维表格的配色与尺寸(UD 令牌的浅色值)。宿主可以按编辑器主题整体或局部覆盖。
|
|
110
|
+
*/
|
|
111
|
+
declare const gridTheme: IGridTheme;
|
|
112
|
+
|
|
113
|
+
interface IButtonFieldCellValue {
|
|
114
|
+
count: number;
|
|
115
|
+
}
|
|
116
|
+
interface IButtonFieldOptions {
|
|
117
|
+
label: string;
|
|
118
|
+
/** 色板名,见 compat/select-color.ts 的 BUTTON_COLORS */
|
|
119
|
+
color: string;
|
|
120
|
+
maxCount?: number | null;
|
|
121
|
+
/** 点击前的确认配置,原样透传给点击回调 */
|
|
122
|
+
confirm?: unknown;
|
|
123
|
+
resetCount?: boolean;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
interface IUrlMatch {
|
|
127
|
+
start: number;
|
|
128
|
+
end: number;
|
|
129
|
+
url: string;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
interface IGlobalImageManager {
|
|
133
|
+
setWindow(newWindow: IRectangle, freezeCols: number): void;
|
|
134
|
+
loadOrGetImage(url: string, col: number, row: number): HTMLImageElement | ImageBitmap | undefined;
|
|
135
|
+
/** Whether loading `url` has failed, as opposed to still being in flight. */
|
|
136
|
+
hasFailed(url: string): boolean;
|
|
137
|
+
setCallback(imageLoaded: (locations: ICellItem[]) => void): void;
|
|
138
|
+
}
|
|
139
|
+
declare class ImageManager implements IGlobalImageManager {
|
|
140
|
+
private imageLoaded;
|
|
141
|
+
private loadedLocations;
|
|
142
|
+
private visibleWindow;
|
|
143
|
+
private freezeColumnCount;
|
|
144
|
+
private readonly isInWindow;
|
|
145
|
+
private cache;
|
|
146
|
+
setCallback(imageLoaded: (locations: ICellItem[]) => void): void;
|
|
147
|
+
private readonly sendLoaded;
|
|
148
|
+
private readonly clearOutOfWindow;
|
|
149
|
+
setWindow(newWindow: IRectangle, freezeColumnCount: number): void;
|
|
150
|
+
private loadImage;
|
|
151
|
+
hasFailed(url: string): boolean;
|
|
152
|
+
loadOrGetImage(url: string, col: number, row: number): HTMLImageElement | ImageBitmap | undefined;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
declare class CombinedSelection {
|
|
156
|
+
type: SelectionRegionType;
|
|
157
|
+
ranges: IRange[];
|
|
158
|
+
constructor(type?: SelectionRegionType, ranges?: IRange[]);
|
|
159
|
+
get isColumnSelection(): boolean;
|
|
160
|
+
get isRowSelection(): boolean;
|
|
161
|
+
get isCellSelection(): boolean;
|
|
162
|
+
get isNoneSelection(): boolean;
|
|
163
|
+
reset(): CombinedSelection;
|
|
164
|
+
set(type: SelectionRegionType, ranges: IRange[]): CombinedSelection;
|
|
165
|
+
setRanges(ranges: IRange[]): CombinedSelection;
|
|
166
|
+
private isOverlap;
|
|
167
|
+
expand(range: IRange): CombinedSelection;
|
|
168
|
+
merge(range: IRange): CombinedSelection;
|
|
169
|
+
flatten(): number[];
|
|
170
|
+
serialize(): IRange[];
|
|
171
|
+
includes(range?: IRange): boolean;
|
|
172
|
+
equals(comparisonRanges: IRange[]): boolean;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
declare const GRID_DEFAULT: {
|
|
176
|
+
rowHeight: number;
|
|
177
|
+
rowHeadWidth: number;
|
|
178
|
+
rowHeadIconPaddingTop: number;
|
|
179
|
+
appendRowHeight: number;
|
|
180
|
+
groupHeaderHeight: number;
|
|
181
|
+
maxRowCount: number;
|
|
182
|
+
columnWidth: number;
|
|
183
|
+
columnHeadHeight: number;
|
|
184
|
+
columnHeadMenuSize: number;
|
|
185
|
+
columnHeadMenuClickableSize: number;
|
|
186
|
+
columnHeadPadding: number;
|
|
187
|
+
columnAppendBtnWidth: number;
|
|
188
|
+
columnResizeHandlerWidth: number;
|
|
189
|
+
columnResizeHandlerPaddingTop: number;
|
|
190
|
+
columnFreezeHandlerWidth: number;
|
|
191
|
+
columnFreezeHandlerHeight: number;
|
|
192
|
+
cellHorizontalPadding: number;
|
|
193
|
+
cellVerticalPaddingXS: number;
|
|
194
|
+
cellVerticalPaddingSM: number;
|
|
195
|
+
cellVerticalPaddingMD: number;
|
|
196
|
+
cellVerticalPaddingLG: number;
|
|
197
|
+
cellTextLineHeight: number;
|
|
198
|
+
fillHandlerSize: number;
|
|
199
|
+
fillHandlerPadding: number;
|
|
200
|
+
columnStatisticHeight: number;
|
|
201
|
+
minColumnStatisticWidth: number;
|
|
202
|
+
scrollBuffer: number;
|
|
203
|
+
cellScrollBuffer: number;
|
|
204
|
+
cellScrollBarWidth: number;
|
|
205
|
+
cellScrollBarMinHeight: number;
|
|
206
|
+
cellScrollBarPaddingX: number;
|
|
207
|
+
cellScrollBarPaddingY: number;
|
|
208
|
+
cellEditorEdgePadding: number;
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
interface ISpriteProps {
|
|
212
|
+
fgColor: string;
|
|
213
|
+
bgColor: string;
|
|
214
|
+
}
|
|
215
|
+
declare enum GridInnerIcon {
|
|
216
|
+
Add = "add",
|
|
217
|
+
Drag = "drag",
|
|
218
|
+
Detail = "detail",
|
|
219
|
+
Description = "description",
|
|
220
|
+
Close = "close",
|
|
221
|
+
Expand = "expand",
|
|
222
|
+
Collapse = "collapse",
|
|
223
|
+
Lock = "lock",
|
|
224
|
+
EyeOff = "eyeOff"
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
type ISprite = (props: ISpriteProps) => string;
|
|
228
|
+
type ISpriteMap = Record<string | GridInnerIcon, ISprite>;
|
|
229
|
+
type ISpriteVariant = "normal" | "selected";
|
|
230
|
+
interface ISpriteDrawerProps {
|
|
231
|
+
x: number;
|
|
232
|
+
y: number;
|
|
233
|
+
sprite: GridInnerIcon | string;
|
|
234
|
+
size: number;
|
|
235
|
+
theme: IGridTheme;
|
|
236
|
+
colors?: [fgColor: string, bgColor: string];
|
|
237
|
+
variant?: ISpriteVariant;
|
|
238
|
+
alpha?: number;
|
|
239
|
+
}
|
|
240
|
+
declare class SpriteManager {
|
|
241
|
+
private readonly onSettled?;
|
|
242
|
+
private readonly spriteMap;
|
|
243
|
+
private readonly icons;
|
|
244
|
+
private inFlight;
|
|
245
|
+
constructor(icons?: ISpriteMap, onSettled?: (() => void) | undefined);
|
|
246
|
+
drawSprite(ctx: CanvasRenderingContext2D, props: ISpriteDrawerProps): void;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
interface IGridExternalProps {
|
|
250
|
+
theme?: Partial<IGridTheme>;
|
|
251
|
+
customIcons?: ISpriteMap;
|
|
252
|
+
rowControls?: IRowControlItem[];
|
|
253
|
+
rowControlPaddingX?: number;
|
|
254
|
+
smoothScrollX?: boolean;
|
|
255
|
+
smoothScrollY?: boolean;
|
|
256
|
+
scrollBufferX?: number;
|
|
257
|
+
scrollBufferY?: number;
|
|
258
|
+
scrollBarVisible?: boolean;
|
|
259
|
+
rowIndexVisible?: boolean;
|
|
260
|
+
collaborators?: ICollaborator;
|
|
261
|
+
searchCursor?: [number, number] | null;
|
|
262
|
+
searchHitIndex?: {
|
|
263
|
+
fieldId: string;
|
|
264
|
+
recordId: string;
|
|
265
|
+
}[];
|
|
266
|
+
highlightedRowIndex?: number | null;
|
|
267
|
+
/**
|
|
268
|
+
* Indicates which areas can be dragged, including rows, columns or no drag
|
|
269
|
+
* - 'all': Allow drag of rows, columns and cells (default)
|
|
270
|
+
* - 'none': Disable drag for all areas
|
|
271
|
+
* - 'row': Allow row drag only
|
|
272
|
+
* - 'column': Allow column drag only
|
|
273
|
+
*/
|
|
274
|
+
draggable?: DraggableType;
|
|
275
|
+
/**
|
|
276
|
+
* Indicates which areas can be selected, including row selection,
|
|
277
|
+
* column selection, cell selection, all areas, or no selection
|
|
278
|
+
* - 'all': Allow selection of rows, columns and cells (default)
|
|
279
|
+
* - 'none': Disable selection for all areas
|
|
280
|
+
* - 'row': Allow row selection only
|
|
281
|
+
* - 'column': Allow column selection only
|
|
282
|
+
* - 'cell': Allow cell selection only
|
|
283
|
+
*/
|
|
284
|
+
selectable?: SelectableType;
|
|
285
|
+
/**
|
|
286
|
+
* Whether to allow multiple selection operations, including rows, columns and cells
|
|
287
|
+
* If true, allow multiple selection of rows/columns/cells (default)
|
|
288
|
+
* If false, disable multiple selection operations
|
|
289
|
+
* @type {boolean}
|
|
290
|
+
*/
|
|
291
|
+
isMultiSelectionEnable?: boolean;
|
|
292
|
+
isRowClickSelectionEnabled?: boolean;
|
|
293
|
+
/**
|
|
294
|
+
* Keep the cursor on the active cell after Enter instead of moving to the next
|
|
295
|
+
* row, so the caller can follow a record that re-positions on edit.
|
|
296
|
+
*/
|
|
297
|
+
disableEnterMoveDown?: boolean;
|
|
298
|
+
groupCollection?: IGroupCollection | null;
|
|
299
|
+
collapsedGroupIds?: Set<string> | null;
|
|
300
|
+
groupPoints?: IGroupPoint[] | null;
|
|
301
|
+
onUndo?: () => void;
|
|
302
|
+
onRedo?: () => void;
|
|
303
|
+
onCopy?: (selection: CombinedSelection, e: React.ClipboardEvent) => void;
|
|
304
|
+
onPaste?: (selection: CombinedSelection, e: React.ClipboardEvent) => void;
|
|
305
|
+
onDelete?: (selection: CombinedSelection) => void;
|
|
306
|
+
onCellEdited?: (cell: ICellItem, newValue: IInnerCell) => void;
|
|
307
|
+
onCellDblClick?: (cell: ICellItem) => void;
|
|
308
|
+
onSelectionChanged?: (selection: CombinedSelection) => void;
|
|
309
|
+
onVisibleRegionChanged?: (rect: IRectangle) => void;
|
|
310
|
+
onCollapsedGroupChanged?: (collapsedGroupIds: Set<string>) => void;
|
|
311
|
+
onColumnFreeze?: (freezeColumnCount: number) => void;
|
|
312
|
+
onColumnFreezeFailed?: () => void;
|
|
313
|
+
onColumnAppend?: () => void;
|
|
314
|
+
onRowExpand?: (rowIndex: number) => void;
|
|
315
|
+
onRowAppend?: (targetIndex?: number) => void;
|
|
316
|
+
onRowOrdered?: (dragRowIndexCollection: number[], dropRowIndex: number) => void;
|
|
317
|
+
onColumnOrdered?: (dragColIndexCollection: number[], dropColIndex: number) => void;
|
|
318
|
+
onColumnResize?: (column: IGridColumn, newSize: number, colIndex: number) => void;
|
|
319
|
+
onColumnHeaderClick?: (colIndex: number, bounds: IRectangle) => void;
|
|
320
|
+
onColumnHeaderDblClick?: (colIndex: number, bounds: IRectangle) => void;
|
|
321
|
+
onColumnHeaderMenuClick?: (colIndex: number, bounds: IRectangle) => void;
|
|
322
|
+
onColumnStatisticClick?: (colIndex: number, bounds: IRectangle) => void;
|
|
323
|
+
onContextMenu?: (selection: CombinedSelection, position: IPosition) => void;
|
|
324
|
+
onGroupHeaderContextMenu?: (groupId: string, position: IPosition) => void;
|
|
325
|
+
onScrollChanged?: (scrollLeft: number, scrollTop: number) => void;
|
|
326
|
+
onDragStart?: (type: DragRegionType, dragIndexs: number[]) => void;
|
|
327
|
+
/**
|
|
328
|
+
* Triggered when the mouse hovers over the every type of region
|
|
329
|
+
*/
|
|
330
|
+
onItemHovered?: (type: RegionType, bounds: IRectangle, cellItem: ICellItem, data?: unknown) => void;
|
|
331
|
+
/**
|
|
332
|
+
* Triggered when the mouse clicks the every type of region
|
|
333
|
+
*/
|
|
334
|
+
onItemClick?: (type: RegionType, bounds: IRectangle, cellItem: ICellItem) => void;
|
|
335
|
+
/**
|
|
336
|
+
* Triggered when user drags the fill handle downward to auto-fill cells
|
|
337
|
+
* Only vertical fill is supported. Provides current selection ranges and the target end real row index
|
|
338
|
+
*/
|
|
339
|
+
onFillSelection?: (selectionRanges: [IRange, IRange], targetEndRealRowIndex: number) => void;
|
|
340
|
+
/**
|
|
341
|
+
* Triggered when user clicks a row control (checkbox, expand, drag)
|
|
342
|
+
* For checkbox: checked indicates the state after click (true = selected, false = deselected)
|
|
343
|
+
*/
|
|
344
|
+
onRowControlClick?: (rowIndex: number, type: RowControlType, checked: boolean) => void;
|
|
345
|
+
/**
|
|
346
|
+
* Triggered when user shift+clicks to select a range of rows
|
|
347
|
+
* Provides the row ranges selected (can be used to fetch recordIds via API)
|
|
348
|
+
*/
|
|
349
|
+
onRowRangeSelected?: (ranges: IRange[]) => void;
|
|
350
|
+
}
|
|
351
|
+
interface IGridProps extends IGridExternalProps {
|
|
352
|
+
columns: IGridColumn[];
|
|
353
|
+
commentCountMap?: Record<string, number>;
|
|
354
|
+
freezeColumnCount?: number;
|
|
355
|
+
rowCount: number;
|
|
356
|
+
rowHeight?: number;
|
|
357
|
+
style?: CSSProperties;
|
|
358
|
+
columnHeaderHeight?: number;
|
|
359
|
+
columnStatistics?: IColumnStatistics;
|
|
360
|
+
getCellContent: (cell: ICellItem) => ICell;
|
|
361
|
+
}
|
|
362
|
+
interface IGridRef {
|
|
363
|
+
resetState: () => void;
|
|
364
|
+
forceUpdate: () => void;
|
|
365
|
+
getActiveCell: () => ICellItem | null;
|
|
366
|
+
getRowOffset: (rowIndex: number) => number;
|
|
367
|
+
setSelection: (selection: CombinedSelection) => void;
|
|
368
|
+
getScrollState: () => IScrollState;
|
|
369
|
+
scrollBy: (deltaX: number, deltaY: number) => void;
|
|
370
|
+
scrollTo: (scrollLeft?: number, scrollTop?: number) => void;
|
|
371
|
+
scrollToItem: (position: [columnIndex: number, rowIndex: number]) => void;
|
|
372
|
+
setActiveCell: (cell: ICellItem | null) => void;
|
|
373
|
+
getCellIndicesAtPosition: (x: number, y: number) => ICellItem | null;
|
|
374
|
+
getContainer: () => HTMLDivElement | null;
|
|
375
|
+
getCellBounds: (cell: ICellItem) => IRectangle | null;
|
|
376
|
+
getFreezeColumnState: () => {
|
|
377
|
+
effectiveFreezeColumnCount: number;
|
|
378
|
+
maxFreezeColumnCount: number;
|
|
379
|
+
};
|
|
380
|
+
setCellLoading: (cells: ICellItem[]) => void;
|
|
381
|
+
setColumnLoadings: (columnLoadings: IColumnLoading[]) => void;
|
|
382
|
+
setCellErrors: (cellErrors: ICellError[]) => void;
|
|
383
|
+
isEditing: () => boolean | undefined;
|
|
384
|
+
}
|
|
385
|
+
declare const Grid: react.ForwardRefExoticComponent<IGridProps & react.RefAttributes<IGridRef>>;
|
|
386
|
+
|
|
387
|
+
interface IEditorRef<T extends IInnerCell = IInnerCell> {
|
|
388
|
+
focus?: () => void;
|
|
389
|
+
setValue?: (data: T["data"]) => void;
|
|
390
|
+
saveValue?: () => void;
|
|
391
|
+
}
|
|
392
|
+
interface IEditorProps<T extends IInnerCell = IInnerCell> {
|
|
393
|
+
cell: T;
|
|
394
|
+
rect: IRectangle & {
|
|
395
|
+
editorId: string;
|
|
396
|
+
};
|
|
397
|
+
theme: IGridTheme;
|
|
398
|
+
style?: CSSProperties;
|
|
399
|
+
isEditing?: boolean;
|
|
400
|
+
isScrolling?: boolean;
|
|
401
|
+
initialSearch?: string;
|
|
402
|
+
setEditing?: React.Dispatch<React.SetStateAction<boolean>>;
|
|
403
|
+
onChange?: (value: unknown) => void;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
/** 按钮单元格的点击回调(原 Teable 的 IButtonClickStatusHook) */
|
|
407
|
+
interface IButtonClickStatusHook {
|
|
408
|
+
checkLoading?: (fieldId: string, recordId: string) => boolean;
|
|
409
|
+
buttonClick: (params: {
|
|
410
|
+
tableId: string;
|
|
411
|
+
recordId: string;
|
|
412
|
+
fieldId: string;
|
|
413
|
+
name: string;
|
|
414
|
+
confirm?: unknown;
|
|
415
|
+
record?: unknown;
|
|
416
|
+
}) => void;
|
|
417
|
+
}
|
|
418
|
+
/** 按钮单元格透传给回调的记录(原 Teable 的 Record 模型) */
|
|
419
|
+
type IRecord = unknown;
|
|
420
|
+
declare enum CellType {
|
|
421
|
+
Text = "Text",
|
|
422
|
+
Link = "Link",
|
|
423
|
+
Number = "Number",
|
|
424
|
+
Select = "Select",
|
|
425
|
+
Image = "Image",
|
|
426
|
+
Chart = "Chart",
|
|
427
|
+
Rating = "Rating",
|
|
428
|
+
User = "User",
|
|
429
|
+
Boolean = "Boolean",
|
|
430
|
+
Loading = "Loading",
|
|
431
|
+
Button = "Button"
|
|
432
|
+
}
|
|
433
|
+
declare enum EditorType {
|
|
434
|
+
Text = "Text",
|
|
435
|
+
Number = "Number",
|
|
436
|
+
Select = "Select",
|
|
437
|
+
Custom = "Custom"
|
|
438
|
+
}
|
|
439
|
+
type ICustomEditor = ForwardRefRenderFunction<IEditorRef, IEditorProps>;
|
|
440
|
+
interface IBaseCell {
|
|
441
|
+
id?: string;
|
|
442
|
+
readonly?: boolean;
|
|
443
|
+
cursor?: CSSProperties["cursor"];
|
|
444
|
+
contentAlign?: "left" | "right" | "center";
|
|
445
|
+
lastUpdated?: string;
|
|
446
|
+
customTheme?: Partial<IGridTheme>;
|
|
447
|
+
locked?: boolean;
|
|
448
|
+
hidden?: boolean;
|
|
449
|
+
}
|
|
450
|
+
interface IEditableCell extends IBaseCell {
|
|
451
|
+
editorWidth?: number;
|
|
452
|
+
customEditor?: ICustomEditor;
|
|
453
|
+
readonlyCustomEditor?: boolean;
|
|
454
|
+
}
|
|
455
|
+
interface ILoadingCell extends IBaseCell {
|
|
456
|
+
type: CellType.Loading;
|
|
457
|
+
}
|
|
458
|
+
interface ITextCell extends IEditableCell {
|
|
459
|
+
type: CellType.Text;
|
|
460
|
+
data: string;
|
|
461
|
+
displayData: string;
|
|
462
|
+
isWrap?: boolean;
|
|
463
|
+
links?: IUrlMatch[];
|
|
464
|
+
onLinkClick?: (url: string) => void;
|
|
465
|
+
}
|
|
466
|
+
interface ILinkCell extends IEditableCell {
|
|
467
|
+
type: CellType.Link;
|
|
468
|
+
data: string[];
|
|
469
|
+
displayData: string;
|
|
470
|
+
onClick?: (value: string) => void;
|
|
471
|
+
}
|
|
472
|
+
declare enum NumberDisplayType {
|
|
473
|
+
Ring = "ring",
|
|
474
|
+
Bar = "bar"
|
|
475
|
+
}
|
|
476
|
+
interface INumberShowAs {
|
|
477
|
+
type: NumberDisplayType;
|
|
478
|
+
color: string;
|
|
479
|
+
maxValue: number;
|
|
480
|
+
showValue: boolean;
|
|
481
|
+
}
|
|
482
|
+
interface INumberCell extends IEditableCell {
|
|
483
|
+
type: CellType.Number;
|
|
484
|
+
data: number | null | undefined;
|
|
485
|
+
displayData: string | string[];
|
|
486
|
+
showAs?: INumberShowAs;
|
|
487
|
+
}
|
|
488
|
+
declare enum ChartType {
|
|
489
|
+
Bar = "bar",
|
|
490
|
+
Line = "line"
|
|
491
|
+
}
|
|
492
|
+
interface IChartCell extends IEditableCell {
|
|
493
|
+
type: CellType.Chart;
|
|
494
|
+
data: number[];
|
|
495
|
+
displayData: string[];
|
|
496
|
+
chartType?: ChartType;
|
|
497
|
+
color?: string;
|
|
498
|
+
}
|
|
499
|
+
interface IBooleanCell extends IEditableCell {
|
|
500
|
+
type: CellType.Boolean;
|
|
501
|
+
data: boolean;
|
|
502
|
+
isMultiple?: boolean;
|
|
503
|
+
}
|
|
504
|
+
interface IRatingCell extends IEditableCell {
|
|
505
|
+
type: CellType.Rating;
|
|
506
|
+
data: number;
|
|
507
|
+
icon: string;
|
|
508
|
+
color: string;
|
|
509
|
+
max: number;
|
|
510
|
+
}
|
|
511
|
+
interface ISelectChoice {
|
|
512
|
+
id: string;
|
|
513
|
+
name: string;
|
|
514
|
+
color?: string;
|
|
515
|
+
backgroundColor?: string;
|
|
516
|
+
}
|
|
517
|
+
interface ISelectChoiceSorted {
|
|
518
|
+
id: string;
|
|
519
|
+
name: string;
|
|
520
|
+
[key: string]: unknown;
|
|
521
|
+
}
|
|
522
|
+
interface ISelectCell extends IEditableCell {
|
|
523
|
+
type: CellType.Select;
|
|
524
|
+
data: (string | {
|
|
525
|
+
title: string;
|
|
526
|
+
id: string;
|
|
527
|
+
})[];
|
|
528
|
+
displayData: string[];
|
|
529
|
+
choiceMap?: Record<string, ISelectChoice>;
|
|
530
|
+
choiceSorted?: ISelectChoiceSorted[];
|
|
531
|
+
isMultiple?: boolean;
|
|
532
|
+
isEditingOnClick?: boolean;
|
|
533
|
+
showAddButton?: boolean;
|
|
534
|
+
onPreview?: (activeId: string) => void;
|
|
535
|
+
}
|
|
536
|
+
interface IImageData {
|
|
537
|
+
id: string;
|
|
538
|
+
url: string;
|
|
539
|
+
/** Drawn in place of `url` once loading it has failed. */
|
|
540
|
+
fallbackUrl?: string;
|
|
541
|
+
width?: number;
|
|
542
|
+
height?: number;
|
|
543
|
+
}
|
|
544
|
+
interface IImageCell extends IEditableCell {
|
|
545
|
+
type: CellType.Image;
|
|
546
|
+
data: IImageData[];
|
|
547
|
+
displayData: string[];
|
|
548
|
+
onPreview?: (activeId: string) => void;
|
|
549
|
+
}
|
|
550
|
+
interface IUserData {
|
|
551
|
+
id: string;
|
|
552
|
+
name: string;
|
|
553
|
+
email?: string;
|
|
554
|
+
avatarUrl?: string;
|
|
555
|
+
isSystem?: boolean;
|
|
556
|
+
}
|
|
557
|
+
interface IUserCell extends IEditableCell {
|
|
558
|
+
type: CellType.User;
|
|
559
|
+
data: IUserData[];
|
|
560
|
+
displayData?: string;
|
|
561
|
+
}
|
|
562
|
+
interface IButtonCell extends IEditableCell {
|
|
563
|
+
type: CellType.Button;
|
|
564
|
+
data: {
|
|
565
|
+
cellValue: IButtonFieldCellValue;
|
|
566
|
+
fieldOptions: IButtonFieldOptions;
|
|
567
|
+
tableId: string;
|
|
568
|
+
statusHook?: IButtonClickStatusHook;
|
|
569
|
+
record?: IRecord;
|
|
570
|
+
};
|
|
571
|
+
}
|
|
572
|
+
type IInnerCell = ITextCell | ILinkCell | INumberCell | ISelectCell | IImageCell | IRatingCell | IBooleanCell | IChartCell | IUserCell | IButtonCell;
|
|
573
|
+
type ICell = IInnerCell | ILoadingCell;
|
|
574
|
+
type ICellRenderProps = {
|
|
575
|
+
ctx: CanvasRenderingContext2D;
|
|
576
|
+
theme: IGridTheme;
|
|
577
|
+
rect: IRectangle;
|
|
578
|
+
rowIndex: number;
|
|
579
|
+
columnIndex: number;
|
|
580
|
+
imageManager: ImageManager;
|
|
581
|
+
spriteManager: SpriteManager;
|
|
582
|
+
hoverCellPosition?: ICellPosition | null;
|
|
583
|
+
isActive?: boolean;
|
|
584
|
+
};
|
|
585
|
+
interface ICellClickProps {
|
|
586
|
+
width: number;
|
|
587
|
+
height: number;
|
|
588
|
+
theme: IGridTheme;
|
|
589
|
+
isActive: boolean;
|
|
590
|
+
activeCellBound: IActiveCellBound | null;
|
|
591
|
+
hoverCellPosition: ICellPosition;
|
|
592
|
+
}
|
|
593
|
+
interface ICellMeasureProps {
|
|
594
|
+
ctx: CanvasRenderingContext2D;
|
|
595
|
+
theme: IGridTheme;
|
|
596
|
+
width: number;
|
|
597
|
+
height: number;
|
|
598
|
+
}
|
|
599
|
+
interface ICellMeasureResult {
|
|
600
|
+
width: number;
|
|
601
|
+
height: number;
|
|
602
|
+
totalHeight: number;
|
|
603
|
+
}
|
|
604
|
+
declare enum CellRegionType {
|
|
605
|
+
Blank = "blank",
|
|
606
|
+
Update = "update",
|
|
607
|
+
Preview = "preview",
|
|
608
|
+
ToggleEditing = "toggleEditing",
|
|
609
|
+
Hover = "hover"
|
|
610
|
+
}
|
|
611
|
+
interface ICellRegionWithBlank {
|
|
612
|
+
type: CellRegionType.Blank;
|
|
613
|
+
}
|
|
614
|
+
interface ICellRegionWithData {
|
|
615
|
+
type: CellRegionType.Update | CellRegionType.ToggleEditing | CellRegionType.Preview | CellRegionType.Blank | CellRegionType.Hover;
|
|
616
|
+
data: unknown;
|
|
617
|
+
}
|
|
618
|
+
type ICellRegion = ICellRegionWithData | ICellRegionWithBlank;
|
|
619
|
+
type ICellClickCallback = (cellRegion: ICellRegionWithData) => void;
|
|
620
|
+
interface IBaseCellRenderer<T extends ICell> {
|
|
621
|
+
type: T["type"];
|
|
622
|
+
draw: (cell: T, props: ICellRenderProps) => void;
|
|
623
|
+
needsHover?: boolean;
|
|
624
|
+
needsHoverPosition?: boolean | ((cell: T) => boolean);
|
|
625
|
+
needsHoverWhenActive?: boolean;
|
|
626
|
+
needsHoverPositionWhenActive?: boolean;
|
|
627
|
+
measure?: (cell: T, props: ICellMeasureProps) => ICellMeasureResult;
|
|
628
|
+
checkRegion?: (cell: T, props: ICellClickProps, shouldCalculate?: boolean) => ICellRegion;
|
|
629
|
+
onClick?: (cell: T, props: ICellClickProps, callback: ICellClickCallback) => void;
|
|
630
|
+
provideEditor?: IProvideEditorCallback<T>;
|
|
631
|
+
}
|
|
632
|
+
type IProvideEditorCallback<T extends ICell> = (cell: T) => void;
|
|
633
|
+
interface IInternalCellRenderer<T extends ICell> extends IBaseCellRenderer<T> {
|
|
634
|
+
getAccessibilityString?: (cell: T) => string;
|
|
635
|
+
onPaste?: (val: string, cell: T) => T | undefined;
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
/** 协作者信息(原 Teable 的 IUser,表格只用到这几项) */
|
|
639
|
+
interface IUser {
|
|
640
|
+
id: string;
|
|
641
|
+
name: string;
|
|
642
|
+
email?: string;
|
|
643
|
+
avatar?: string | null;
|
|
644
|
+
phone?: string;
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
interface IScrollState {
|
|
648
|
+
scrollTop: number;
|
|
649
|
+
scrollLeft: number;
|
|
650
|
+
isScrolling: boolean;
|
|
651
|
+
}
|
|
652
|
+
interface IPosition {
|
|
653
|
+
x: number;
|
|
654
|
+
y: number;
|
|
655
|
+
}
|
|
656
|
+
interface IRegionPosition extends IPosition {
|
|
657
|
+
rowIndex: number;
|
|
658
|
+
columnIndex: number;
|
|
659
|
+
}
|
|
660
|
+
interface IRectangle {
|
|
661
|
+
x: number;
|
|
662
|
+
y: number;
|
|
663
|
+
width: number;
|
|
664
|
+
height: number;
|
|
665
|
+
}
|
|
666
|
+
declare enum SelectionRegionType {
|
|
667
|
+
Rows = "Rows",
|
|
668
|
+
Columns = "Columns",
|
|
669
|
+
Cells = "Cells",
|
|
670
|
+
None = "None"
|
|
671
|
+
}
|
|
672
|
+
declare enum RegionType {
|
|
673
|
+
Cell = "Cell",
|
|
674
|
+
ActiveCell = "ActiveCell",
|
|
675
|
+
CellValue = "CellValue",
|
|
676
|
+
AppendRow = "AppendRow",
|
|
677
|
+
AppendColumn = "AppendColumn",
|
|
678
|
+
ColumnHeader = "ColumnHeader",
|
|
679
|
+
GroupStatistic = "GroupStatistic",
|
|
680
|
+
ColumnStatistic = "ColumnStatistic",
|
|
681
|
+
ColumnHeaderMenu = "ColumnHeaderMenu",
|
|
682
|
+
ColumnPrimaryIcon = "ColumnPrimaryIcon",
|
|
683
|
+
ColumnIcon = "ColumnIcon",
|
|
684
|
+
ColumnDescription = "ColumnDescription",
|
|
685
|
+
ColumnResizeHandler = "ColumnResizeHandler",
|
|
686
|
+
ColumnFreezeHandler = "ColumnFreezeHandler",
|
|
687
|
+
RowHeaderDragHandler = "RowHeaderDragHandler",
|
|
688
|
+
RowHeaderExpandHandler = "RowHeaderExpandHandler",
|
|
689
|
+
RowHeaderCheckbox = "RowHeaderCheckbox",
|
|
690
|
+
RowGroupControl = "RowGroupControl",
|
|
691
|
+
RowGroupHeader = "RowGroupHeader",
|
|
692
|
+
RowCountLabel = "RowCountLabel",
|
|
693
|
+
RowHeader = "RowHeader",
|
|
694
|
+
AllCheckbox = "AllCheckbox",
|
|
695
|
+
FillHandler = "FillHandler",
|
|
696
|
+
Blank = "Blank",
|
|
697
|
+
None = "None"
|
|
698
|
+
}
|
|
699
|
+
type ICellRange = [colIndex: number, rowIndex: number];
|
|
700
|
+
type IColumnRange = [colStartIndex: number, colEndIndex: number];
|
|
701
|
+
type IRowRange = [rowStartIndex: number, rowEndIndex: number];
|
|
702
|
+
type IRange = ICellRange | IColumnRange | IRowRange;
|
|
703
|
+
interface IMouseState extends IRegionPosition {
|
|
704
|
+
type: RegionType;
|
|
705
|
+
isOutOfBounds: boolean;
|
|
706
|
+
}
|
|
707
|
+
interface IColumnStatistics {
|
|
708
|
+
[columnId: string]: IColumnStatistic | null;
|
|
709
|
+
}
|
|
710
|
+
interface IColumnStatistic {
|
|
711
|
+
total: string;
|
|
712
|
+
[key: string]: string;
|
|
713
|
+
}
|
|
714
|
+
interface IGridColumn {
|
|
715
|
+
id?: string;
|
|
716
|
+
name: string;
|
|
717
|
+
icon?: string;
|
|
718
|
+
width?: number;
|
|
719
|
+
hasMenu?: boolean;
|
|
720
|
+
readonly?: boolean;
|
|
721
|
+
isPrimary?: boolean;
|
|
722
|
+
description?: string;
|
|
723
|
+
statisticLabel?: {
|
|
724
|
+
showAlways: boolean;
|
|
725
|
+
label: string;
|
|
726
|
+
};
|
|
727
|
+
customTheme?: Partial<IGridTheme>;
|
|
728
|
+
}
|
|
729
|
+
interface IColumnResizeState {
|
|
730
|
+
columnIndex: number;
|
|
731
|
+
width: number;
|
|
732
|
+
x: number;
|
|
733
|
+
}
|
|
734
|
+
interface IColumnFreezeState {
|
|
735
|
+
sourceIndex: number;
|
|
736
|
+
targetIndex: number;
|
|
737
|
+
isFreezing: boolean;
|
|
738
|
+
}
|
|
739
|
+
interface IDragState {
|
|
740
|
+
type: DragRegionType;
|
|
741
|
+
delta: number;
|
|
742
|
+
ranges: IRange[];
|
|
743
|
+
isDragging: boolean;
|
|
744
|
+
}
|
|
745
|
+
declare enum DragRegionType {
|
|
746
|
+
Rows = "Rows",
|
|
747
|
+
Columns = "Columns",
|
|
748
|
+
None = "None"
|
|
749
|
+
}
|
|
750
|
+
type IScrollDirection = -1 | 0 | 1;
|
|
751
|
+
declare enum MouseButtonType {
|
|
752
|
+
Left = 0,
|
|
753
|
+
Center = 1,
|
|
754
|
+
Right = 2
|
|
755
|
+
}
|
|
756
|
+
declare enum RowControlType {
|
|
757
|
+
Spacer = "Spacer",
|
|
758
|
+
Drag = "Drag",
|
|
759
|
+
Expand = "Expand",
|
|
760
|
+
Checkbox = "Checkbox"
|
|
761
|
+
}
|
|
762
|
+
interface IRowControlItem {
|
|
763
|
+
type: RowControlType;
|
|
764
|
+
icon?: string;
|
|
765
|
+
}
|
|
766
|
+
type ICellItem = [colIndex: number, rowIndex: number];
|
|
767
|
+
type ICollaborator = {
|
|
768
|
+
activeCell?: ICellItem;
|
|
769
|
+
activeCellId: [recordId: string, field: string];
|
|
770
|
+
user: Omit<IUser, "phone">;
|
|
771
|
+
borderColor: string;
|
|
772
|
+
timeStamp: number;
|
|
773
|
+
}[];
|
|
774
|
+
type ICellPosition = [x: number, y: number];
|
|
775
|
+
interface IPositionWithBounds {
|
|
776
|
+
bounds: IRectangle;
|
|
777
|
+
eventPosition: IPosition;
|
|
778
|
+
}
|
|
779
|
+
declare enum DraggableType {
|
|
780
|
+
All = "all",
|
|
781
|
+
None = "none",
|
|
782
|
+
Column = "column",
|
|
783
|
+
Row = "row"
|
|
784
|
+
}
|
|
785
|
+
declare enum GridCustomIcon {
|
|
786
|
+
Description = "description"
|
|
787
|
+
}
|
|
788
|
+
declare enum SelectableType {
|
|
789
|
+
All = "all",
|
|
790
|
+
None = "none",
|
|
791
|
+
Column = "column",
|
|
792
|
+
Row = "row",
|
|
793
|
+
Cell = "cell"
|
|
794
|
+
}
|
|
795
|
+
interface IActiveCellBound {
|
|
796
|
+
rowIndex: number;
|
|
797
|
+
columnIndex: number;
|
|
798
|
+
width: number;
|
|
799
|
+
height: number;
|
|
800
|
+
totalHeight: number;
|
|
801
|
+
scrollTop: number;
|
|
802
|
+
scrollEnable: boolean;
|
|
803
|
+
}
|
|
804
|
+
declare enum LinearRowType {
|
|
805
|
+
Group = 0,
|
|
806
|
+
Row = 1,
|
|
807
|
+
Append = 2
|
|
808
|
+
}
|
|
809
|
+
interface IGroupHeaderPoint {
|
|
810
|
+
id: string;
|
|
811
|
+
type: LinearRowType.Group;
|
|
812
|
+
depth: number;
|
|
813
|
+
value?: unknown;
|
|
814
|
+
isCollapsed?: boolean;
|
|
815
|
+
}
|
|
816
|
+
interface IGroupRowPoint {
|
|
817
|
+
type: LinearRowType.Row;
|
|
818
|
+
count: number;
|
|
819
|
+
}
|
|
820
|
+
interface IGroupAddButtonPoint {
|
|
821
|
+
type: LinearRowType.Append;
|
|
822
|
+
}
|
|
823
|
+
type IGroupPoint = IGroupHeaderPoint | IGroupRowPoint | IGroupAddButtonPoint;
|
|
824
|
+
type ILinearRow = {
|
|
825
|
+
type: LinearRowType.Row;
|
|
826
|
+
displayIndex: number;
|
|
827
|
+
realIndex: number;
|
|
828
|
+
} | {
|
|
829
|
+
id: string;
|
|
830
|
+
type: LinearRowType.Group;
|
|
831
|
+
value: unknown;
|
|
832
|
+
depth: number;
|
|
833
|
+
realIndex: number;
|
|
834
|
+
isCollapsed: boolean;
|
|
835
|
+
} | {
|
|
836
|
+
type: LinearRowType.Append;
|
|
837
|
+
value: unknown;
|
|
838
|
+
realIndex: number;
|
|
839
|
+
};
|
|
840
|
+
interface IGroupCollection {
|
|
841
|
+
groupColumns: IGridColumn[];
|
|
842
|
+
getGroupCell: (cellValue: unknown, depth: number) => ICell;
|
|
843
|
+
}
|
|
844
|
+
interface IColumnLoading {
|
|
845
|
+
index: number;
|
|
846
|
+
progress: number;
|
|
847
|
+
onCancel?: () => void;
|
|
848
|
+
}
|
|
849
|
+
interface ICellError {
|
|
850
|
+
cellItem: ICellItem;
|
|
851
|
+
errorMsg: string;
|
|
852
|
+
onRetry?: () => void;
|
|
853
|
+
onDismiss?: () => void;
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
/** 视口坐标里的矩形(弹出菜单、面板按它定位) */
|
|
857
|
+
interface BaseGridAnchor {
|
|
858
|
+
x: number;
|
|
859
|
+
y: number;
|
|
860
|
+
width: number;
|
|
861
|
+
height: number;
|
|
862
|
+
}
|
|
863
|
+
interface BaseGridViewProps {
|
|
864
|
+
doc: Y.Doc;
|
|
865
|
+
tableId: string;
|
|
866
|
+
viewId: string;
|
|
867
|
+
readOnly?: boolean;
|
|
868
|
+
/** 本端写操作的 origin,撤销只撤它;默认每个组件实例一个 */
|
|
869
|
+
origin?: unknown;
|
|
870
|
+
/** 其他协作者正在看的格子(来自 awareness) */
|
|
871
|
+
collaborators?: ICollaborator;
|
|
872
|
+
onActiveCellChange?: (cell: {
|
|
873
|
+
recordId: string;
|
|
874
|
+
fieldId: string;
|
|
875
|
+
} | null) => void;
|
|
876
|
+
style?: CSSProperties;
|
|
877
|
+
/** 记录详情里打开的那条,表格上高亮这一行 */
|
|
878
|
+
highlightedRecordId?: string | null;
|
|
879
|
+
/** 行首的展开按钮、空格键:打开记录详情 */
|
|
880
|
+
onExpandRecord?: (recordId: string) => void;
|
|
881
|
+
/** 表头的下拉箭头、表头右键:字段菜单。fieldIds 是选中的列,第一个是点的那列 */
|
|
882
|
+
onFieldMenu?: (fieldIds: string[], anchor: BaseGridAnchor) => void;
|
|
883
|
+
/** 表头末尾的「+」:新增字段;不给时直接加一个文本字段 */
|
|
884
|
+
onAddField?: (anchor: BaseGridAnchor) => void;
|
|
885
|
+
/** 统计栏的某一格:选统计方式 */
|
|
886
|
+
onStatClick?: (fieldId: string, anchor: BaseGridAnchor) => void;
|
|
887
|
+
/** 单元格、行号右键:记录菜单 */
|
|
888
|
+
onRecordMenu?: (recordIds: string[], anchor: BaseGridAnchor) => void;
|
|
889
|
+
/** 轻提示:复制了几条记录、粘贴超出上限等 */
|
|
890
|
+
onNotice?: (message: string) => void;
|
|
891
|
+
/** 搜索:关键字与当前定位到第几个结果 */
|
|
892
|
+
search?: {
|
|
893
|
+
query: string;
|
|
894
|
+
index: number;
|
|
895
|
+
} | null;
|
|
896
|
+
/** 搜索结果数变了 */
|
|
897
|
+
onSearchResult?: (count: number) => void;
|
|
898
|
+
}
|
|
899
|
+
interface BaseGridViewHandle {
|
|
900
|
+
/** 滚到某条记录(并选中它的第一格) */
|
|
901
|
+
scrollToRecord: (recordId: string) => void;
|
|
902
|
+
/** 撤销 / 重做(工具栏按钮用) */
|
|
903
|
+
undo: () => void;
|
|
904
|
+
redo: () => void;
|
|
905
|
+
}
|
|
906
|
+
/** 行高四档(飞书:低 / 中等 / 高 / 超高) */
|
|
907
|
+
declare const ROW_HEIGHTS: {
|
|
908
|
+
readonly 1: 32;
|
|
909
|
+
readonly 2: 54;
|
|
910
|
+
readonly 3: 88;
|
|
911
|
+
readonly 4: 124;
|
|
912
|
+
};
|
|
913
|
+
declare const BaseGridView: react.ForwardRefExoticComponent<BaseGridViewProps & react.RefAttributes<BaseGridViewHandle>>;
|
|
914
|
+
|
|
915
|
+
interface BaseKanbanViewHandle {
|
|
916
|
+
undo: () => void;
|
|
917
|
+
redo: () => void;
|
|
918
|
+
/** 工具栏「添加记录」:加在第一列(有分组时带上这一列的值),并打开记录详情 */
|
|
919
|
+
addRecord: () => void;
|
|
920
|
+
}
|
|
921
|
+
interface BaseKanbanViewProps {
|
|
922
|
+
doc: Y.Doc;
|
|
923
|
+
tableId: string;
|
|
924
|
+
viewId: string;
|
|
925
|
+
readOnly?: boolean;
|
|
926
|
+
origin: unknown;
|
|
927
|
+
/** 记录详情里正打开的记录,卡片描边 */
|
|
928
|
+
highlightedRecordId?: string | null;
|
|
929
|
+
onExpandRecord: (recordId: string) => void;
|
|
930
|
+
/** 没有分组依据时,点「选择分组依据」 */
|
|
931
|
+
onPickGroupField: (anchor: Anchor) => void;
|
|
932
|
+
onNotice?: (message: string) => void;
|
|
933
|
+
}
|
|
934
|
+
/** 看板视图(DOM):按单选或人员字段分列,拖动卡片改分组值和顺序;点卡片打开记录详情 */
|
|
935
|
+
declare const BaseKanbanView: react.ForwardRefExoticComponent<BaseKanbanViewProps & react.RefAttributes<BaseKanbanViewHandle>>;
|
|
936
|
+
|
|
937
|
+
interface BaseThemeStyleProps {
|
|
938
|
+
/** 视觉风格,默认飞书 */
|
|
939
|
+
visualTheme?: EditorVisualTheme;
|
|
940
|
+
}
|
|
941
|
+
/**
|
|
942
|
+
* 多维表格只注入主题变量和表格自己的样式,不像 EditorThemeStyle 那样把整套文档编辑器样式带进来。
|
|
943
|
+
* 宿主页面已经有 EditorThemeStyle 时也可以不挂它(表格样式已登记在 COMPONENT_STYLES 里)。
|
|
944
|
+
*/
|
|
945
|
+
declare function BaseThemeStyle({ visualTheme }: BaseThemeStyleProps): react.JSX.Element;
|
|
946
|
+
|
|
947
|
+
interface BaseViewProps {
|
|
948
|
+
doc: Y.Doc;
|
|
949
|
+
readOnly?: boolean;
|
|
950
|
+
/** 其他协作者正在看的格子(来自 awareness) */
|
|
951
|
+
collaborators?: ICollaborator;
|
|
952
|
+
/** 本端选中的格子变了(宿主拿去发 awareness) */
|
|
953
|
+
onActiveCellChange?: (cell: {
|
|
954
|
+
tableId: string;
|
|
955
|
+
recordId: string;
|
|
956
|
+
fieldId: string;
|
|
957
|
+
} | null) => void;
|
|
958
|
+
/** 默认打开的数据表 / 视图;不给时开第一个 */
|
|
959
|
+
initialTableId?: string;
|
|
960
|
+
initialViewId?: string;
|
|
961
|
+
/** 切换数据表 / 视图(宿主可以写进地址栏) */
|
|
962
|
+
onNavigate?: (target: {
|
|
963
|
+
tableId: string;
|
|
964
|
+
viewId: string;
|
|
965
|
+
}) => void;
|
|
966
|
+
/** 本端写操作的 origin,撤销只撤它 */
|
|
967
|
+
origin?: unknown;
|
|
968
|
+
/** 表单视图的「分享表单」(宿主生成外部填写链接);不给不显示 */
|
|
969
|
+
onShareForm?: (target: {
|
|
970
|
+
tableId: string;
|
|
971
|
+
viewId: string;
|
|
972
|
+
}) => void;
|
|
973
|
+
style?: CSSProperties;
|
|
974
|
+
className?: string;
|
|
975
|
+
}
|
|
976
|
+
declare function BaseView({ doc, readOnly, collaborators, onActiveCellChange, initialTableId, initialViewId, onNavigate, origin: originProp, onShareForm, style, className, }: BaseViewProps): react.JSX.Element;
|
|
977
|
+
|
|
978
|
+
export { BaseFormFill, type BaseFormFillProps, BaseFormView, type BaseFormViewProps, Grid as BaseGrid, type BaseGridAnchor, BaseGridView, type BaseGridViewHandle, type BaseGridViewProps, BaseKanbanView, type BaseKanbanViewHandle, type BaseKanbanViewProps, BaseThemeStyle, type BaseThemeStyleProps, BaseView, type BaseViewProps, CellRegionType, CellType, ChartType, DragRegionType, DraggableType, EditorType, GRID_DEFAULT, GridCustomIcon, type IActiveCellBound, type IBaseCell, type IBaseCellRenderer, type IBooleanCell, type IButtonCell, type IButtonClickStatusHook, type ICell, type ICellClickCallback, type ICellClickProps, type ICellError, type ICellItem, type ICellMeasureProps, type ICellMeasureResult, type ICellPosition, type ICellRange, type ICellRegion, type ICellRegionWithBlank, type ICellRegionWithData, type ICellRenderProps, type IChartCell, type ICollaborator, type IColumnFreezeState, type IColumnLoading, type IColumnRange, type IColumnResizeState, type IColumnStatistic, type IColumnStatistics, type ICustomEditor, type IDragState, type IEditableCell, type IGridColumn, type IGridExternalProps, type IGridProps, type IGridRef, type IGridTheme, type IGroupAddButtonPoint, type IGroupCollection, type IGroupHeaderPoint, type IGroupPoint, type IGroupRowPoint, type IImageCell, type IImageData, type IInnerCell, type IInternalCellRenderer, type ILinearRow, type ILinkCell, type ILoadingCell, type IMouseState, type INumberCell, type INumberShowAs, type IPosition, type IPositionWithBounds, type IProvideEditorCallback, type IRange, type IRatingCell, type IRecord, type IRectangle, type IRegionPosition, type IRowControlItem, type IRowRange, type IScrollDirection, type IScrollState, type ISelectCell, type ISelectChoice, type ISelectChoiceSorted, type ITextCell, type IUser, type IUserCell, type IUserData, LinearRowType, MouseButtonType, NumberDisplayType, ROW_HEIGHTS, RegionType, RowControlType, SelectableType, SelectionRegionType, gridTheme };
|