@enableai-base/table 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/table.cjs.js +4465 -0
- package/dist/table.cjs.prod.js +4465 -0
- package/dist/table.css +73 -0
- package/dist/table.d.ts +1275 -0
- package/dist/table.esm-bundler.mjs +4292 -0
- package/index.js +7 -0
- package/index.node.js +1 -0
- package/package.json +58 -0
package/dist/table.d.ts
ADDED
|
@@ -0,0 +1,1275 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import * as react from 'react';
|
|
3
|
+
import react__default from 'react';
|
|
4
|
+
import { CommandManager, Command } from '@enableai-sdk-common/command';
|
|
5
|
+
import * as _visactor_vtable_es_ts_types from '@visactor/vtable/es/ts-types';
|
|
6
|
+
import { CellRange, ITableThemeDefine, ThemeStyle, CustomRenderFunctionArg, BaseTableAPI as BaseTableAPI$1 } from '@visactor/vtable/es/ts-types';
|
|
7
|
+
import { TableToolType, DateFormatType, NumberFormatType, CustomCellStyleKey, MenuInfo, TableColumnInnerType } from '@enableai-base/core';
|
|
8
|
+
import * as _visactor_vtable from '@visactor/vtable';
|
|
9
|
+
import { ListTable, ColumnDefine, ListTableConstructorOptions, BaseTableAPI } from '@visactor/vtable';
|
|
10
|
+
import { SelectEditorOption as SelectEditorOption$1 } from '@enableai-base/ui';
|
|
11
|
+
import { ItemType } from 'antd/es/menu/interface';
|
|
12
|
+
import { Rect } from '@visactor/vtable/es/tools/Rect';
|
|
13
|
+
import { DestroyClass } from '@enableai-sdk-common/core';
|
|
14
|
+
import * as jotai from 'jotai';
|
|
15
|
+
import { IEditor, EditContext, ValidateEnum } from '@visactor/vtable-editors';
|
|
16
|
+
import dayjs from 'dayjs';
|
|
17
|
+
import * as _visactor_vtable_es_vrender from '@visactor/vtable/es/vrender';
|
|
18
|
+
import { IGroup, Cursor } from '@visactor/vtable/es/vrender';
|
|
19
|
+
import { RegistryKey } from '@enableai-fonts/font-icon-enableai-base';
|
|
20
|
+
|
|
21
|
+
export type EditorCommonData = {
|
|
22
|
+
cell: {
|
|
23
|
+
row: number;
|
|
24
|
+
col: number;
|
|
25
|
+
position: {
|
|
26
|
+
x: number;
|
|
27
|
+
y: number;
|
|
28
|
+
};
|
|
29
|
+
width: number;
|
|
30
|
+
height: number;
|
|
31
|
+
};
|
|
32
|
+
table: ListTable;
|
|
33
|
+
endEdit: () => void;
|
|
34
|
+
initialValue: any;
|
|
35
|
+
};
|
|
36
|
+
export type SelectEditorValue = SelectEditorOption[] | undefined;
|
|
37
|
+
export type SelectEditorOption = {
|
|
38
|
+
label: string;
|
|
39
|
+
value: string;
|
|
40
|
+
color: string;
|
|
41
|
+
};
|
|
42
|
+
export type SelectEditorData = EditorCommonData & {
|
|
43
|
+
initialValue: SelectEditorValue;
|
|
44
|
+
options: SelectEditorOption[];
|
|
45
|
+
isMultiple: boolean;
|
|
46
|
+
};
|
|
47
|
+
export type EditorData<T extends Record<string, any>> = EditorCommonData & T;
|
|
48
|
+
export type TextEditorData = EditorCommonData & {
|
|
49
|
+
initialValue: string;
|
|
50
|
+
};
|
|
51
|
+
export type NumEditorData = EditorCommonData & {
|
|
52
|
+
initialValue?: number;
|
|
53
|
+
};
|
|
54
|
+
export type UserShowData = {
|
|
55
|
+
cell: {
|
|
56
|
+
row: number;
|
|
57
|
+
col: number;
|
|
58
|
+
position: {
|
|
59
|
+
x: number;
|
|
60
|
+
y: number;
|
|
61
|
+
};
|
|
62
|
+
width: number;
|
|
63
|
+
height: number;
|
|
64
|
+
};
|
|
65
|
+
table: ListTable;
|
|
66
|
+
endEdit: () => void;
|
|
67
|
+
id: string | number;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export type ForMat = {
|
|
71
|
+
value: string;
|
|
72
|
+
};
|
|
73
|
+
export type DateEditorData = EditorData<{
|
|
74
|
+
initialValue: DateEditorValue;
|
|
75
|
+
format?: ForMat;
|
|
76
|
+
}>;
|
|
77
|
+
export type DateEditorValue = string | undefined;
|
|
78
|
+
|
|
79
|
+
export type LinkEditorData = EditorData<{
|
|
80
|
+
initialValue?: LinkEditorValue;
|
|
81
|
+
}>;
|
|
82
|
+
export type LinkEditorValue = {
|
|
83
|
+
url?: string;
|
|
84
|
+
title?: string;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
export declare const INNER_TABLE_COLUMN_KEY_PLUS = "INNER_TABLE_COLUMN_KEY_PLUS";
|
|
88
|
+
export declare const INNER_TABLE_COLUMN_KEY_CHECKBOX = "INNER_TABLE_COLUMN_KEY_CHECKBOX";
|
|
89
|
+
export declare const INNER_TABLE_COLUMN_KEY_LIST: string[];
|
|
90
|
+
export declare const INNER_TABLE_RECORD_ID_KEY = "INNER_PRESET_RECORD_ID";
|
|
91
|
+
|
|
92
|
+
export type BaseTableColumnDate = BaseTableColumnCustomCommon & {
|
|
93
|
+
tool: TableToolType.DATE;
|
|
94
|
+
fmt: DateFormatType;
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
export type BaseTableColumnNumber = BaseTableColumnCustomCommon & {
|
|
98
|
+
tool: TableToolType.NUMBER;
|
|
99
|
+
fmt?: NumberFormatType;
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
export type BaseTableColumnSelect = BaseTableColumnCustomCommon & {
|
|
103
|
+
tool: TableToolType.SIMPLE_SELECT | TableToolType.MULTI_SELECT;
|
|
104
|
+
options: SelectEditorOption$1[];
|
|
105
|
+
request?: (option: SelectEditorOption$1) => Promise<SelectEditorOption$1>;
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
export interface PersonInfo {
|
|
109
|
+
id: string | number;
|
|
110
|
+
name?: string;
|
|
111
|
+
avatar?: string;
|
|
112
|
+
role?: string;
|
|
113
|
+
mobile?: string;
|
|
114
|
+
status?: string;
|
|
115
|
+
}
|
|
116
|
+
export type BaseTableColumnUser = BaseTableColumnCustomCommon & {
|
|
117
|
+
tool: TableToolType.USER;
|
|
118
|
+
request?: (id: string) => Promise<PersonInfo>;
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* 表格列配置定义
|
|
123
|
+
*/
|
|
124
|
+
|
|
125
|
+
export type InnerColumnControl = {
|
|
126
|
+
checkbox: boolean;
|
|
127
|
+
main: boolean;
|
|
128
|
+
plus: boolean;
|
|
129
|
+
};
|
|
130
|
+
export type BaseTableColumnCustomCommon = ColumnDefine & {
|
|
131
|
+
tool?: TableToolType;
|
|
132
|
+
/**
|
|
133
|
+
* 当前列是否被锁定
|
|
134
|
+
*/
|
|
135
|
+
lock?: boolean;
|
|
136
|
+
defaultValue?: any;
|
|
137
|
+
/**
|
|
138
|
+
* 列反馈信息
|
|
139
|
+
*/
|
|
140
|
+
feedbacks?: Array<{
|
|
141
|
+
type: string;
|
|
142
|
+
message: string;
|
|
143
|
+
}>;
|
|
144
|
+
};
|
|
145
|
+
export type NormalColumnConfig = BaseTableColumnCustomCommon & {
|
|
146
|
+
tool?: Exclude<TableToolType, TableToolType.DATE | TableToolType.NUMBER | TableToolType.SIMPLE_SELECT>;
|
|
147
|
+
fmt?: string;
|
|
148
|
+
};
|
|
149
|
+
export type BaseTableColumnCustom = BaseTableColumnDate | BaseTableColumnNumber | BaseTableColumnSelect | BaseTableColumnUser | NormalColumnConfig;
|
|
150
|
+
export type BaseTableColumnDefine = BaseTableColumnCustom;
|
|
151
|
+
export type BaseTableColumnsDefine = BaseTableColumnDefine[];
|
|
152
|
+
|
|
153
|
+
export type AttachmentEditorValue = {
|
|
154
|
+
name: string;
|
|
155
|
+
path: string;
|
|
156
|
+
}[];
|
|
157
|
+
|
|
158
|
+
export declare enum VTableEditorType {
|
|
159
|
+
TEXT_AREA = "textAreaEditor",
|
|
160
|
+
INPUT = "inputEditor",
|
|
161
|
+
DATE = "dateInputEditor",
|
|
162
|
+
MULTI_SELECT = "multiSelectEditor",
|
|
163
|
+
SINGLE_SELECT = "singleSelectEditor",
|
|
164
|
+
LINK = "linkEditor",
|
|
165
|
+
NUMBER = "numberEditor",
|
|
166
|
+
TEXT = "textEditor",
|
|
167
|
+
JSON = "jsonEditor"
|
|
168
|
+
}
|
|
169
|
+
export interface OriginalColumnStructure {
|
|
170
|
+
type: TableToolType;
|
|
171
|
+
ordinal: number;
|
|
172
|
+
id: string;
|
|
173
|
+
label: string;
|
|
174
|
+
options?: SelectEditorOption[];
|
|
175
|
+
lock?: boolean;
|
|
176
|
+
width?: number;
|
|
177
|
+
default?: {
|
|
178
|
+
value?: {
|
|
179
|
+
type: string;
|
|
180
|
+
data: OriginTableEditorValue;
|
|
181
|
+
};
|
|
182
|
+
format?: string;
|
|
183
|
+
};
|
|
184
|
+
feedbacks?: Array<FeedbackInfo>;
|
|
185
|
+
request?: (props: any) => Promise<any>;
|
|
186
|
+
}
|
|
187
|
+
export type FeedbackInfo = {
|
|
188
|
+
type: string;
|
|
189
|
+
message: string;
|
|
190
|
+
};
|
|
191
|
+
export interface OriginalRecordStructure {
|
|
192
|
+
/** 行 ID 对应题目id */
|
|
193
|
+
id: string;
|
|
194
|
+
/** 行反馈信息 */
|
|
195
|
+
feedbacks?: FeedbackInfo[];
|
|
196
|
+
/** string: 当前列id */
|
|
197
|
+
cells: Record<string, OriginalRecordCellStructure>;
|
|
198
|
+
}
|
|
199
|
+
export interface OriginalRecordCellStructure<T = OriginTableEditorValue> {
|
|
200
|
+
/** 单元格对应的annotate_id 或者 前端 simple_id 表格在通知外部数据发生变动时用到 */
|
|
201
|
+
id?: string;
|
|
202
|
+
/** 标识当前单元格数据的类型,用于转换,暂时无用 */
|
|
203
|
+
type?: TableToolType;
|
|
204
|
+
/** 单元格的值 */
|
|
205
|
+
value?: T;
|
|
206
|
+
/** 单元格是否处于loading状态 */
|
|
207
|
+
loading?: boolean;
|
|
208
|
+
/** 单元格反馈信息 */
|
|
209
|
+
feedbacks?: FeedbackInfo[];
|
|
210
|
+
}
|
|
211
|
+
export type TableFeedBackInfo = {
|
|
212
|
+
/** 根据type确定获取标记范围
|
|
213
|
+
* 如果设置了range,优先以range为目标
|
|
214
|
+
* 如果type为cell,且未设置range,则根据col和row确定目标单元格
|
|
215
|
+
* type === row, 忽略col
|
|
216
|
+
* type === column, 忽略row
|
|
217
|
+
*/
|
|
218
|
+
type: 'cell' | 'row' | 'column';
|
|
219
|
+
range?: CellRange;
|
|
220
|
+
col?: number;
|
|
221
|
+
row?: number;
|
|
222
|
+
info: FeedbackInfo[];
|
|
223
|
+
};
|
|
224
|
+
export type AdaptedFeedbackHighlight = Record<CustomCellStyleKey, TableFeedBackInfo[]>;
|
|
225
|
+
export type AdaptedRecord = {
|
|
226
|
+
records: Record<string, BaseTableEditorValue>[];
|
|
227
|
+
feedbacksHighlight: AdaptedFeedbackHighlight;
|
|
228
|
+
};
|
|
229
|
+
export type AdaptedColumn = {
|
|
230
|
+
columns: BaseTableColumnDefine[];
|
|
231
|
+
feedbacksHighlight: AdaptedFeedbackHighlight;
|
|
232
|
+
};
|
|
233
|
+
/**
|
|
234
|
+
* 每个单元格的值有3种形式:
|
|
235
|
+
* undefined —— 用于当前单元格为空的形式
|
|
236
|
+
* { loading : true , value: any} 表示当前单元格处于loading状态
|
|
237
|
+
* { value: any} loading 为false 或者 undefined 此时单元格需要参照value值进行渲染
|
|
238
|
+
*/
|
|
239
|
+
export type BasicBaseTableEditorValue<T> = OriginalRecordCellStructure<T> | undefined;
|
|
240
|
+
export type BaseTableEditorSelectValue = BasicBaseTableEditorValue<SelectEditorValue>;
|
|
241
|
+
export type BaseTableEditorLinkValue = BasicBaseTableEditorValue<LinkEditorValue>;
|
|
242
|
+
export type BaseTableEditorDateValue = BasicBaseTableEditorValue<DateEditorValue>;
|
|
243
|
+
export type BaseTableEditorAttachmentValue = BasicBaseTableEditorValue<AttachmentEditorValue>;
|
|
244
|
+
export type BaseTableEditorPersonInfoValue = BasicBaseTableEditorValue<PersonInfo[]>;
|
|
245
|
+
export type BaseTableEditorTextValue = BasicBaseTableEditorValue<string>;
|
|
246
|
+
export type BaseTableEditorJSONValue = BasicBaseTableEditorValue<string>;
|
|
247
|
+
export type BaseTableEditorNumberValue = BasicBaseTableEditorValue<number>;
|
|
248
|
+
/**
|
|
249
|
+
* 表格编辑器所有值类型的联合类型
|
|
250
|
+
* TODO 有两个 UserValue PersonInfo
|
|
251
|
+
*/
|
|
252
|
+
export type BaseTableEditorValue = BaseTableEditorSelectValue | BaseTableEditorLinkValue | BaseTableEditorDateValue | BaseTableEditorAttachmentValue | BaseTableEditorPersonInfoValue | BaseTableEditorTextValue | BaseTableEditorJSONValue | BaseTableEditorNumberValue;
|
|
253
|
+
export type OriginTableEditorValue = SelectEditorValue | LinkEditorValue | DateEditorValue | AttachmentEditorValue | PersonInfo[] | string | number;
|
|
254
|
+
export type BaseTableRecordData = {
|
|
255
|
+
[INNER_TABLE_RECORD_ID_KEY]: string;
|
|
256
|
+
} & {
|
|
257
|
+
[K in Exclude<string, typeof INNER_TABLE_RECORD_ID_KEY>]: BaseTableEditorValue;
|
|
258
|
+
};
|
|
259
|
+
|
|
260
|
+
export type UploadFileFn = <File extends {
|
|
261
|
+
file: any;
|
|
262
|
+
type: string;
|
|
263
|
+
}>(file: File, path: string) => Promise<any>;
|
|
264
|
+
|
|
265
|
+
export type MenuItemsConfig = (ItemType & {
|
|
266
|
+
onCellClick?: (info: {
|
|
267
|
+
menuInfo: MenuInfo;
|
|
268
|
+
tableEditor: TableEditor;
|
|
269
|
+
cell: {
|
|
270
|
+
col: number;
|
|
271
|
+
row: number;
|
|
272
|
+
recordId: string | undefined;
|
|
273
|
+
columnId: string;
|
|
274
|
+
rect: Rect;
|
|
275
|
+
};
|
|
276
|
+
}) => void;
|
|
277
|
+
hiddenInFreeze?: boolean;
|
|
278
|
+
})[];
|
|
279
|
+
|
|
280
|
+
export interface BaseInteractiveCell {
|
|
281
|
+
recordId: string;
|
|
282
|
+
columnId: string;
|
|
283
|
+
}
|
|
284
|
+
export interface BaseInteractiveRecordStructure {
|
|
285
|
+
/** 行 ID 对应题目id */
|
|
286
|
+
id: string;
|
|
287
|
+
/** 行反馈信息 */
|
|
288
|
+
feedbacks?: FeedbackInfo[];
|
|
289
|
+
/** 当前行单元格数据 */
|
|
290
|
+
cells: Record<string, OriginalRecordCellStructure | undefined>;
|
|
291
|
+
}
|
|
292
|
+
export interface BaseInteractiveCellOutput {
|
|
293
|
+
cell: BaseInteractiveCell;
|
|
294
|
+
data: OriginalRecordCellStructure | undefined;
|
|
295
|
+
}
|
|
296
|
+
export interface BaseTableInterface {
|
|
297
|
+
/**
|
|
298
|
+
* 选中状态获取,返回被选中的行 id
|
|
299
|
+
*/
|
|
300
|
+
get selectedRecords(): string[];
|
|
301
|
+
/**
|
|
302
|
+
* 获取当前选中的单元格,不包含头部单元格
|
|
303
|
+
*/
|
|
304
|
+
get selectedCells(): BaseInteractiveCellOutput[];
|
|
305
|
+
/** ========== 列操作 ========== */
|
|
306
|
+
/**
|
|
307
|
+
* cover: false 更新传入的列的配置,未传入的列配置不会动
|
|
308
|
+
* cover: true 全量更新列的配置,用于新增,删除列
|
|
309
|
+
* 由 Table 组件中的 columns 参数更新
|
|
310
|
+
*/
|
|
311
|
+
/** ========== 行操作 ========== */
|
|
312
|
+
/**
|
|
313
|
+
* 更新行数据
|
|
314
|
+
* 根据id,更新对应行的数据
|
|
315
|
+
* 判断表格中的filters字段是否为空
|
|
316
|
+
* 如果为空,直接更新records
|
|
317
|
+
* 如果不为空,不会主动更新视图,而是等待filters字段发生更新之后,再更新视图
|
|
318
|
+
* @param records {id, cells, feedbacks?: []}
|
|
319
|
+
*/
|
|
320
|
+
updateRecords(records: BaseInteractiveRecordStructure[]): void;
|
|
321
|
+
/**
|
|
322
|
+
* 添加数据行
|
|
323
|
+
* 数据行的顺序由 Table组件 filters 参数确定
|
|
324
|
+
* @param records
|
|
325
|
+
*/
|
|
326
|
+
addRecords(records: OriginalRecordStructure[]): void;
|
|
327
|
+
/**
|
|
328
|
+
* 根据数据行id删除数据
|
|
329
|
+
*/
|
|
330
|
+
removeRecords(recordIds: string[]): void;
|
|
331
|
+
/** ========== 单元格操作 ========== */
|
|
332
|
+
/**
|
|
333
|
+
* 聚焦到指定单元格,将指定单元格放到可视区域内
|
|
334
|
+
* @param recordId 数据行ID
|
|
335
|
+
* @param columnId 数据列ID
|
|
336
|
+
*/
|
|
337
|
+
focus(cell: BaseInteractiveCell): void;
|
|
338
|
+
/**
|
|
339
|
+
* 高亮指定单元格
|
|
340
|
+
* @param cells 单元格数组
|
|
341
|
+
* @param key 自定义单元格样式键值,参考 CustomCellStyleKey 类型
|
|
342
|
+
*/
|
|
343
|
+
highlight(cells: BaseInteractiveCell[], key?: CustomCellStyleKey): void;
|
|
344
|
+
/**
|
|
345
|
+
* 清除高亮样式,key为空,会清除表格所有高亮样式
|
|
346
|
+
* key 不为空,只会清除key对应的高亮样式
|
|
347
|
+
* @param key 自定义单元格样式键值,参考 CustomCellStyleKey 类型
|
|
348
|
+
*/
|
|
349
|
+
clearHighlight(key?: CustomCellStyleKey): void;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
export declare class BaseTableInteractive implements BaseTableInterface {
|
|
353
|
+
editor: TableEditor;
|
|
354
|
+
constructor(editor: TableEditor);
|
|
355
|
+
get selectedRecords(): any[];
|
|
356
|
+
get selectedCells(): {
|
|
357
|
+
cell: {
|
|
358
|
+
columnId: string;
|
|
359
|
+
recordId: string;
|
|
360
|
+
};
|
|
361
|
+
data: any;
|
|
362
|
+
}[];
|
|
363
|
+
getRecordsManagerStore(): Map<string, BaseTableRecordData>;
|
|
364
|
+
filters(recordIds: string[]): void;
|
|
365
|
+
selectCell(cell: BaseInteractiveCell): void;
|
|
366
|
+
selectColumnByIndex(columnIndex: number): void;
|
|
367
|
+
selectRowByIndex(recordIndex: number): void;
|
|
368
|
+
selectCellByIndex(cell: [recordIndex: number, colIndex: number]): void;
|
|
369
|
+
clearSelect(): void;
|
|
370
|
+
setRecordsSelectState(records: string[] | 'all', state?: boolean): void;
|
|
371
|
+
getRecord(recordId: string): OriginalRecordStructure | undefined;
|
|
372
|
+
getRecords(recordIds: string[]): (OriginalRecordStructure | undefined)[];
|
|
373
|
+
updateRecords(records: BaseInteractiveRecordStructure[]): void;
|
|
374
|
+
addRecords(_records: OriginalRecordStructure[]): void;
|
|
375
|
+
removeRecords(_recordIds: string[]): void;
|
|
376
|
+
focus(cell: BaseInteractiveCell): void;
|
|
377
|
+
focusByIndex(cell: [recordIndex: number, colIndex: number]): void;
|
|
378
|
+
highlight(cells: BaseInteractiveCell[], _key?: CustomCellStyleKey): void;
|
|
379
|
+
highlightByIndex(cells: Array<[recordIndex: number, colIndex: number]>, _key?: CustomCellStyleKey): void;
|
|
380
|
+
clearHighlight(key?: CustomCellStyleKey): void;
|
|
381
|
+
setFreezeCount(count: number): void;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
export declare class RecordsManager extends DestroyClass {
|
|
385
|
+
editor: TableEditor;
|
|
386
|
+
private recordsMap;
|
|
387
|
+
private _filters;
|
|
388
|
+
/**
|
|
389
|
+
* 当前表格records数量
|
|
390
|
+
*
|
|
391
|
+
* 如果filters不存在,直接返回 recordsMap 数量,
|
|
392
|
+
*
|
|
393
|
+
* 如果filters存在,则返回 filters 中存在的 records 数量
|
|
394
|
+
*/
|
|
395
|
+
size: jotai.Atom<number>;
|
|
396
|
+
constructor(editor: TableEditor);
|
|
397
|
+
get filters(): string[] | undefined;
|
|
398
|
+
set filters(value: string[] | undefined);
|
|
399
|
+
initRecords(records: BaseTableRecordData[]): void;
|
|
400
|
+
renderRecords(): void;
|
|
401
|
+
updateRecords(records: BaseInteractiveRecordStructure[]): void;
|
|
402
|
+
addRecords(records: OriginalRecordStructure[]): void;
|
|
403
|
+
removeRecords(recordIds: string[]): void;
|
|
404
|
+
get store(): Map<string, BaseTableRecordData>;
|
|
405
|
+
get(recordId: string): BaseTableRecordData | undefined;
|
|
406
|
+
set(recordId: string, record: BaseTableRecordData): void;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
export type CellInfo = {
|
|
410
|
+
col: number;
|
|
411
|
+
row: number;
|
|
412
|
+
recordId: string | undefined;
|
|
413
|
+
columnId: string;
|
|
414
|
+
rect: Rect;
|
|
415
|
+
};
|
|
416
|
+
export type MenuConfig = {
|
|
417
|
+
open: boolean;
|
|
418
|
+
position: {
|
|
419
|
+
x: number;
|
|
420
|
+
y: number;
|
|
421
|
+
};
|
|
422
|
+
cell: CellInfo;
|
|
423
|
+
type: 'cell' | 'header' | 'more';
|
|
424
|
+
};
|
|
425
|
+
export type TableEditorOptions = Pick<ListTableConstructorOptions, 'columns' | 'records' | 'theme'>;
|
|
426
|
+
export type BaseTableEditorCreatorConfig = ListTableConstructorOptions & {
|
|
427
|
+
id: string;
|
|
428
|
+
innerColumnControl: InnerColumnControl;
|
|
429
|
+
uploadFileFn: UploadFileFn;
|
|
430
|
+
commandManager: CommandManager;
|
|
431
|
+
container: HTMLElement;
|
|
432
|
+
onChange?: BaseTableOnChangeFn;
|
|
433
|
+
};
|
|
434
|
+
export declare enum TableChangeEvent {
|
|
435
|
+
CELLS_UPDATE = "cells::update",
|
|
436
|
+
CELL_CLICK = "cell::click",
|
|
437
|
+
CELL_ATTACHMENT_PREVIEW = "cell::attachment::preview",
|
|
438
|
+
SELECT_OPTIONS_UPDATE = "select::options::update",
|
|
439
|
+
RECORD_OPEN_DETAIL_DRAWER = "record::open::detail::drawer",
|
|
440
|
+
RECORD_CHECKBOX_STATE_CHANGE = "record::checkbox::state::change",
|
|
441
|
+
COLUMN_WIDTH_UPDATE = "column::width::update",
|
|
442
|
+
COLUMN_DRAG_MOVE_END = "column::drag::move::end",
|
|
443
|
+
COLUMN_ADD_FROM_INNER_PLUS = "column::add::from::inner::plus"
|
|
444
|
+
}
|
|
445
|
+
type TableChangeEventPayloadBase = {
|
|
446
|
+
editor: TableEditor;
|
|
447
|
+
};
|
|
448
|
+
type TableChangeEventPayLoadSelectOptionUpdate = TableChangeEventPayloadBase & {
|
|
449
|
+
options: SelectEditorOption[];
|
|
450
|
+
columnId: string;
|
|
451
|
+
};
|
|
452
|
+
type TableChangeEventPayLoadCellsUpdate = TableChangeEventPayloadBase & {
|
|
453
|
+
data: Array<BaseInteractiveCell & {
|
|
454
|
+
previous: OriginalRecordCellStructure | undefined;
|
|
455
|
+
current: OriginalRecordCellStructure | undefined;
|
|
456
|
+
}>;
|
|
457
|
+
};
|
|
458
|
+
type TableChangeEventPayLoadRecordCheckboxStateChange = TableChangeEventPayloadBase & {
|
|
459
|
+
selectedRecordIds: string[];
|
|
460
|
+
};
|
|
461
|
+
type TableChangeEventPayLoadCellClick = TableChangeEventPayloadBase & {
|
|
462
|
+
columnDefine: BaseTableColumnCustom | undefined;
|
|
463
|
+
record: OriginalRecordCellStructure | undefined;
|
|
464
|
+
cellValue: BaseTableEditorValue;
|
|
465
|
+
};
|
|
466
|
+
type TableChangeEventPayLoadCellAttachmentPreview = TableChangeEventPayloadBase & {
|
|
467
|
+
cellValue: BaseTableEditorAttachmentValue;
|
|
468
|
+
};
|
|
469
|
+
type EventToPayloadMap = {
|
|
470
|
+
[TableChangeEvent.CELLS_UPDATE]: TableChangeEventPayLoadCellsUpdate;
|
|
471
|
+
[TableChangeEvent.CELL_CLICK]: TableChangeEventPayLoadCellClick;
|
|
472
|
+
[TableChangeEvent.SELECT_OPTIONS_UPDATE]: TableChangeEventPayLoadSelectOptionUpdate;
|
|
473
|
+
[TableChangeEvent.RECORD_OPEN_DETAIL_DRAWER]: TableChangeEventPayloadBase & {
|
|
474
|
+
recordId: string;
|
|
475
|
+
};
|
|
476
|
+
[TableChangeEvent.RECORD_CHECKBOX_STATE_CHANGE]: TableChangeEventPayLoadRecordCheckboxStateChange;
|
|
477
|
+
[TableChangeEvent.COLUMN_WIDTH_UPDATE]: TableChangeEventPayloadBase & {
|
|
478
|
+
columnId: string;
|
|
479
|
+
width: number;
|
|
480
|
+
};
|
|
481
|
+
[TableChangeEvent.COLUMN_DRAG_MOVE_END]: TableChangeEventPayloadBase & {
|
|
482
|
+
columnIds: string[];
|
|
483
|
+
};
|
|
484
|
+
[TableChangeEvent.COLUMN_ADD_FROM_INNER_PLUS]: TableChangeEventPayloadBase;
|
|
485
|
+
[TableChangeEvent.CELL_ATTACHMENT_PREVIEW]: TableChangeEventPayLoadCellAttachmentPreview;
|
|
486
|
+
};
|
|
487
|
+
export type BaseTableOnChangeFn = <E extends TableChangeEvent>(event: E, payload: EventToPayloadMap[E]) => void;
|
|
488
|
+
|
|
489
|
+
export declare class TableEditor extends DestroyClass {
|
|
490
|
+
id: string;
|
|
491
|
+
container: HTMLElement;
|
|
492
|
+
commandManager: CommandManager;
|
|
493
|
+
uploadFile: UploadFileFn;
|
|
494
|
+
innerColumnControl: InnerColumnControl;
|
|
495
|
+
private event;
|
|
496
|
+
instance: ListTable;
|
|
497
|
+
private readonly _lock;
|
|
498
|
+
private readonly customCellStyleArrangement;
|
|
499
|
+
readonly recordsManager: RecordsManager;
|
|
500
|
+
/**
|
|
501
|
+
* 当前是否处于debug状态,一般开发的时候为true,会打印一些需要调试的日志
|
|
502
|
+
*/
|
|
503
|
+
debug: boolean;
|
|
504
|
+
get lock(): boolean;
|
|
505
|
+
set lock(value: boolean);
|
|
506
|
+
get colCount(): number;
|
|
507
|
+
get rowCount(): number;
|
|
508
|
+
/**
|
|
509
|
+
* 用于限定列的操作范围
|
|
510
|
+
* 前两列 0 1 是关键主列,不进行任何操作,并且顺序永远在最前面
|
|
511
|
+
* 最后两列 colCount - 1:Plus列, colCount - 2:more列 同样是固定列
|
|
512
|
+
*/
|
|
513
|
+
get colActionLimit(): {
|
|
514
|
+
min: number;
|
|
515
|
+
max: number;
|
|
516
|
+
};
|
|
517
|
+
dispatch: BaseTableOnChangeFn;
|
|
518
|
+
/**
|
|
519
|
+
* 供外部调用的接口
|
|
520
|
+
*/
|
|
521
|
+
interactive: BaseTableInteractive;
|
|
522
|
+
constructor(id: string, container: HTMLElement, onChange: BaseTableOnChangeFn, config: ListTableConstructorOptions, commandManager: CommandManager, uploadFile: UploadFileFn, innerColumnControl: InnerColumnControl);
|
|
523
|
+
get columnIds(): string[];
|
|
524
|
+
get columns(): _visactor_vtable.ColumnsDefine;
|
|
525
|
+
updateCellData(col: number, row: number, value: any): void;
|
|
526
|
+
getRecordByCell(col: number, row: number): BaseTableRecordData;
|
|
527
|
+
getInteractiveCell(col: number, row: number): BaseInteractiveCell;
|
|
528
|
+
getInteractiveRecordIndex(recordId: string): number;
|
|
529
|
+
getInteractiveCellPosition(cell: BaseInteractiveCell): {
|
|
530
|
+
col: number;
|
|
531
|
+
row: number;
|
|
532
|
+
};
|
|
533
|
+
updateColumns(columns: BaseTableColumnDefine[]): void;
|
|
534
|
+
getSelectedRecord(): any[];
|
|
535
|
+
setCheckboxState(col: number, row: number, state: boolean): void;
|
|
536
|
+
getColumnDefine(col: number): _visactor_vtable.ColumnDefine | _visactor_vtable_es_ts_types.IRowSeriesNumber | _visactor_vtable_es_ts_types.ColumnSeriesNumber;
|
|
537
|
+
getSelectedCell(): _visactor_vtable_es_ts_types.CellInfo[][] | null;
|
|
538
|
+
focusCell(col: number, row: number): void;
|
|
539
|
+
highlightCells(customCellStyleKey: CustomCellStyleKey, cells: {
|
|
540
|
+
col?: number;
|
|
541
|
+
row?: number;
|
|
542
|
+
range?: CellRange;
|
|
543
|
+
}[]): void;
|
|
544
|
+
clearHighlight(customCellStyleKey?: CustomCellStyleKey): void;
|
|
545
|
+
updateColumn(col: number, options: Record<string, any>): void;
|
|
546
|
+
setRecords(_records: BaseTableRecordData[]): void;
|
|
547
|
+
addRecords(_records: BaseTableRecordData[]): void;
|
|
548
|
+
selectCell(col: number, row: number): void;
|
|
549
|
+
/**
|
|
550
|
+
* 删除选中单元格
|
|
551
|
+
* 1. 过滤表头行
|
|
552
|
+
* 2. 只修改没有被锁定的列内容
|
|
553
|
+
*/
|
|
554
|
+
removeSelectedCell(): {
|
|
555
|
+
records: [BaseTableRecordData, number][];
|
|
556
|
+
recordsForRestore: [BaseTableRecordData, number][];
|
|
557
|
+
};
|
|
558
|
+
/**
|
|
559
|
+
* 添加数据 支持多条数据
|
|
560
|
+
* @param records 多条数据
|
|
561
|
+
* @param recordIndex 向数据源中要插入的位置,从0开始。不设置recordIndex的话 默认追加到最后。
|
|
562
|
+
* 如果设置了排序规则recordIndex无效,会自动适应排序逻辑确定插入顺序。
|
|
563
|
+
* recordIndex 可以通过接口getRecordShowIndexByCell获取
|
|
564
|
+
*/
|
|
565
|
+
createRows(count: number, recordBodyIndex?: number): {
|
|
566
|
+
newRecords: any[];
|
|
567
|
+
newRecordIndexes: number[];
|
|
568
|
+
};
|
|
569
|
+
deleteRecords(recordIndexes: number[]): void;
|
|
570
|
+
/**
|
|
571
|
+
* 删除行
|
|
572
|
+
*/
|
|
573
|
+
removeRow(count: number, recordBodyIndex: number): {
|
|
574
|
+
oldRecords: any[];
|
|
575
|
+
oldRecordIndexes: number[];
|
|
576
|
+
};
|
|
577
|
+
/**
|
|
578
|
+
* 新增默认列
|
|
579
|
+
* @param count 新增列数
|
|
580
|
+
* @param insertIndex 新增列索引,默认在最后一列前新增
|
|
581
|
+
*/
|
|
582
|
+
createColumn(count: number, insertIndex: number): {
|
|
583
|
+
oldColumns: _visactor_vtable.ColumnDefine[];
|
|
584
|
+
newColumns: _visactor_vtable.ColumnDefine[];
|
|
585
|
+
};
|
|
586
|
+
/**
|
|
587
|
+
* 删除列
|
|
588
|
+
*/
|
|
589
|
+
removeColumn(count: number, startIndex: number): {
|
|
590
|
+
oldColumns: _visactor_vtable.ColumnDefine[];
|
|
591
|
+
newColumns: _visactor_vtable.ColumnDefine[];
|
|
592
|
+
} | undefined;
|
|
593
|
+
/**
|
|
594
|
+
* 复制列
|
|
595
|
+
* @param sourceIndex 要复制的列索引
|
|
596
|
+
* @param insertIndex 插入位置,默认在源列之后
|
|
597
|
+
*/
|
|
598
|
+
copyColumn(sourceIndex: number, insertIndex?: number): {
|
|
599
|
+
oldColumns: _visactor_vtable.ColumnDefine[];
|
|
600
|
+
newColumns: _visactor_vtable.ColumnDefine[];
|
|
601
|
+
};
|
|
602
|
+
/**
|
|
603
|
+
* 冻结列
|
|
604
|
+
* @param count 要冻结的列数
|
|
605
|
+
* 注意:count >= 2,否则会将关键主列于checkbox拆分
|
|
606
|
+
*/
|
|
607
|
+
setFreezeCount(count: number): {
|
|
608
|
+
oldValue: number;
|
|
609
|
+
newValue: number;
|
|
610
|
+
};
|
|
611
|
+
getCellOriginValue(col: number, row: number): any;
|
|
612
|
+
private updateCell;
|
|
613
|
+
updateRecordsData(records: [BaseTableRecordData, number][]): void;
|
|
614
|
+
getCellStyle(col: number, row: number): _visactor_vtable_es_ts_types.CellStyle;
|
|
615
|
+
load(): void;
|
|
616
|
+
private unload;
|
|
617
|
+
destroy(): void;
|
|
618
|
+
}
|
|
619
|
+
export declare const createBaseTableEditor: (config: BaseTableEditorCreatorConfig) => TableEditor;
|
|
620
|
+
|
|
621
|
+
export type BaseTableComponentAPI = {
|
|
622
|
+
getEditor: () => TableEditor | null;
|
|
623
|
+
};
|
|
624
|
+
export type VTableProviderProps = {
|
|
625
|
+
id: string;
|
|
626
|
+
theme?: ITableThemeDefine;
|
|
627
|
+
onChange?: BaseTableOnChangeFn;
|
|
628
|
+
disabled?: boolean;
|
|
629
|
+
maxHeight?: React.CSSProperties['maxHeight'];
|
|
630
|
+
initialValues: OriginalRecordStructure[];
|
|
631
|
+
/**
|
|
632
|
+
* 此处更新后内部会自动更新所有的columns,并重新渲染
|
|
633
|
+
*/
|
|
634
|
+
columns: OriginalColumnStructure[];
|
|
635
|
+
ref?: React.Ref<BaseTableComponentAPI>;
|
|
636
|
+
cellMenus?: MenuItemsConfig;
|
|
637
|
+
headerMenus?: MenuItemsConfig;
|
|
638
|
+
moreMenus?: MenuItemsConfig;
|
|
639
|
+
commandManager: CommandManager;
|
|
640
|
+
uploadFileFn: UploadFileFn;
|
|
641
|
+
innerColumnControl: InnerColumnControl;
|
|
642
|
+
debug?: boolean;
|
|
643
|
+
};
|
|
644
|
+
export declare const useComponentVTable: () => {
|
|
645
|
+
maxHeight?: React.CSSProperties['maxHeight'];
|
|
646
|
+
id: string;
|
|
647
|
+
editorRef: react.RefObject<TableEditor | null>;
|
|
648
|
+
theme: ITableThemeDefine;
|
|
649
|
+
columns: OriginalColumnStructure[];
|
|
650
|
+
records: OriginalRecordStructure[];
|
|
651
|
+
containerRef: react.RefObject<HTMLDivElement | null>;
|
|
652
|
+
disabled: boolean;
|
|
653
|
+
cellMenus: MenuItemsConfig | undefined;
|
|
654
|
+
headerMenus: MenuItemsConfig | undefined;
|
|
655
|
+
moreMenus: MenuItemsConfig | undefined;
|
|
656
|
+
onChange: BaseTableOnChangeFn | undefined;
|
|
657
|
+
commandManager: CommandManager;
|
|
658
|
+
uploadFileFn: UploadFileFn;
|
|
659
|
+
innerColumnControl: InnerColumnControl;
|
|
660
|
+
debug: boolean;
|
|
661
|
+
};
|
|
662
|
+
|
|
663
|
+
type TableViewProps = {};
|
|
664
|
+
export declare const TableView: ({}: TableViewProps) => react__default.JSX.Element;
|
|
665
|
+
export type TableLayoutProps = {};
|
|
666
|
+
export declare const TableLayout: () => react__default.JSX.Element;
|
|
667
|
+
export type TableProps = Omit<ListTableConstructorOptions, 'columns' | 'records'> & VTableProviderProps & TableLayoutProps;
|
|
668
|
+
export declare const Table: (props: TableProps) => react__default.JSX.Element;
|
|
669
|
+
|
|
670
|
+
export type CellContextMenuProps = {};
|
|
671
|
+
export declare const CellContextMenu: ({}: CellContextMenuProps) => react.JSX.Element | null;
|
|
672
|
+
|
|
673
|
+
export type HeaderContextMenuProps = {};
|
|
674
|
+
export declare const HeaderContextMenu: ({}: HeaderContextMenuProps) => react.JSX.Element | null;
|
|
675
|
+
|
|
676
|
+
type MenuItemInputLabelProps = {
|
|
677
|
+
icon: React.ReactNode;
|
|
678
|
+
direction: 'left' | 'right' | 'up' | 'down';
|
|
679
|
+
type: 'row' | 'column';
|
|
680
|
+
onCellClick?: (info: {
|
|
681
|
+
cell: CellInfo;
|
|
682
|
+
tableEditor: TableEditor;
|
|
683
|
+
e: React.MouseEvent;
|
|
684
|
+
}, length: number) => void;
|
|
685
|
+
disabled?: boolean;
|
|
686
|
+
};
|
|
687
|
+
export declare const MenuItemInputLabel: FC<MenuItemInputLabelProps>;
|
|
688
|
+
|
|
689
|
+
type MoreContextMenuProps = {};
|
|
690
|
+
export declare const MoreContextMenu: FC<MoreContextMenuProps>;
|
|
691
|
+
|
|
692
|
+
export declare const setMenu: (args_0: MenuConfig | ((prev: MenuConfig | null) => MenuConfig | null) | null) => void;
|
|
693
|
+
export declare const getMenu: () => MenuConfig | null;
|
|
694
|
+
export declare const useMenu: () => MenuConfig | null;
|
|
695
|
+
|
|
696
|
+
export type JsonEditorData = EditorData<{
|
|
697
|
+
initialValue?: string;
|
|
698
|
+
}>;
|
|
699
|
+
|
|
700
|
+
export declare function initEditorTool(type: TableToolType.MULTI_SELECT | TableToolType.SIMPLE_SELECT, value: SelectEditorData): void;
|
|
701
|
+
export declare function initEditorTool(type: TableToolType.NUMBER, value: NumEditorData): void;
|
|
702
|
+
export declare function initEditorTool(type: TableToolType.LINK, value: LinkEditorData): void;
|
|
703
|
+
export declare function initEditorTool(type: TableToolType.DATE, value: DateEditorData): void;
|
|
704
|
+
export declare function initEditorTool(type: TableToolType.TEXT, value: TextEditorData): void;
|
|
705
|
+
export declare function initEditorTool(type: TableToolType.JSON, value: JsonEditorData): void;
|
|
706
|
+
export declare function initEditorTool(type: TableToolType.USER, value: UserShowData): void;
|
|
707
|
+
export declare const clearEditorTool: () => void;
|
|
708
|
+
|
|
709
|
+
export declare const editorRegistry: () => void;
|
|
710
|
+
|
|
711
|
+
export declare class DateSelectEditorTool implements IEditor<BaseTableEditorDateValue> {
|
|
712
|
+
oldValue?: BaseTableEditorDateValue;
|
|
713
|
+
newValue?: BaseTableEditorDateValue;
|
|
714
|
+
table?: ListTable;
|
|
715
|
+
private row?;
|
|
716
|
+
private col?;
|
|
717
|
+
onStart(props: EditContext<BaseTableEditorDateValue, ListTable>): void;
|
|
718
|
+
validateValue(newValue: BaseTableEditorDateValue, oldValue: BaseTableEditorDateValue): ValidateEnum;
|
|
719
|
+
setValue(): void;
|
|
720
|
+
getValue(): {
|
|
721
|
+
value: DateEditorValue;
|
|
722
|
+
id?: string | undefined;
|
|
723
|
+
type?: TableToolType | undefined;
|
|
724
|
+
loading?: boolean | undefined;
|
|
725
|
+
feedbacks?: FeedbackInfo[] | undefined;
|
|
726
|
+
};
|
|
727
|
+
onEnd(): void;
|
|
728
|
+
isEditorElement(target: HTMLElement): boolean;
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
export declare const setDateEditorData: (args_0: DateEditorData | ((prev: DateEditorData | undefined) => DateEditorData | undefined) | undefined) => void;
|
|
732
|
+
export declare const getDateEditorData: () => DateEditorData | undefined;
|
|
733
|
+
export declare const useDateEditorData: () => DateEditorData | undefined;
|
|
734
|
+
export declare const setDateEditorValue: (args_0: DateEditorValue | ((prev: DateEditorValue) => DateEditorValue)) => void;
|
|
735
|
+
export declare const getDateEditorValue: () => DateEditorValue;
|
|
736
|
+
export declare const useDateEditorValue: () => DateEditorValue;
|
|
737
|
+
export declare const initDateEditorTool: (value: DateEditorData) => void;
|
|
738
|
+
export declare const clearDateEditorTool: () => void;
|
|
739
|
+
|
|
740
|
+
export declare class JsonEditorTool implements IEditor<BaseTableEditorJSONValue> {
|
|
741
|
+
oldValue?: BaseTableEditorJSONValue;
|
|
742
|
+
newValue?: BaseTableEditorJSONValue;
|
|
743
|
+
table?: ListTable;
|
|
744
|
+
private row?;
|
|
745
|
+
private col?;
|
|
746
|
+
onStart(props: EditContext<BaseTableEditorJSONValue, ListTable>): void;
|
|
747
|
+
validateValue(newValue: BaseTableEditorJSONValue, oldValue: BaseTableEditorJSONValue): ValidateEnum;
|
|
748
|
+
setValue(): void;
|
|
749
|
+
getValue(): {
|
|
750
|
+
value: string | undefined;
|
|
751
|
+
id?: string | undefined;
|
|
752
|
+
type?: TableToolType | undefined;
|
|
753
|
+
loading?: boolean | undefined;
|
|
754
|
+
feedbacks?: FeedbackInfo[] | undefined;
|
|
755
|
+
};
|
|
756
|
+
onEnd(): void;
|
|
757
|
+
/**
|
|
758
|
+
* 如果提供了此函数,VTable 将会在用户点击其他地方时调用此函数。
|
|
759
|
+
* 如果此函数返回了一个假值,VTable 将会调用 `onEnd` 并退出编辑状态。
|
|
760
|
+
* 如果未定义此函数或此函数返回了一个真值, VTable 将不会做任何事。
|
|
761
|
+
* 这意味着,你需要手动调用 `onStart` 中提供的 `endEdit` 来结束编辑模式。
|
|
762
|
+
*/
|
|
763
|
+
isEditorElement(target: HTMLElement): boolean;
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
export declare const setJsonEditorData: (args_0: JsonEditorData | ((prev: JsonEditorData | undefined) => JsonEditorData | undefined) | undefined) => void;
|
|
767
|
+
export declare const getJsonEditorData: () => JsonEditorData | undefined;
|
|
768
|
+
export declare const useJsonEditorData: () => JsonEditorData | undefined;
|
|
769
|
+
export declare const setJsonEditorValue: (args_0: string | ((prev: string | undefined) => string | undefined) | undefined) => void;
|
|
770
|
+
export declare const getJsonEditorValue: () => string | undefined;
|
|
771
|
+
export declare const useJsonEditorValue: () => string | undefined;
|
|
772
|
+
export declare const initJsonEditorTool: (value: JsonEditorData) => void;
|
|
773
|
+
export declare const clearJsonEditorTool: () => void;
|
|
774
|
+
|
|
775
|
+
export declare class LinkEditorTool implements IEditor<BaseTableEditorLinkValue> {
|
|
776
|
+
oldValue?: BaseTableEditorLinkValue;
|
|
777
|
+
newValue?: BaseTableEditorLinkValue;
|
|
778
|
+
table?: ListTable;
|
|
779
|
+
private row?;
|
|
780
|
+
private col?;
|
|
781
|
+
onStart(props: EditContext<BaseTableEditorLinkValue, ListTable>): void;
|
|
782
|
+
validateValue(newValue: BaseTableEditorLinkValue, oldValue: BaseTableEditorLinkValue): ValidateEnum;
|
|
783
|
+
setValue(): void;
|
|
784
|
+
getValue(): {
|
|
785
|
+
value: LinkEditorValue | undefined;
|
|
786
|
+
id?: string | undefined;
|
|
787
|
+
type?: TableToolType | undefined;
|
|
788
|
+
loading?: boolean | undefined;
|
|
789
|
+
feedbacks?: FeedbackInfo[] | undefined;
|
|
790
|
+
};
|
|
791
|
+
onEnd(): void;
|
|
792
|
+
/**
|
|
793
|
+
* 如果提供了此函数,VTable 将会在用户点击其他地方时调用此函数。
|
|
794
|
+
* 如果此函数返回了一个假值,VTable 将会调用 `onEnd` 并退出编辑状态。
|
|
795
|
+
* 如果未定义此函数或此函数返回了一个真值, VTable 将不会做任何事。
|
|
796
|
+
* 这意味着,你需要手动调用 `onStart` 中提供的 `endEdit` 来结束编辑模式。
|
|
797
|
+
*/
|
|
798
|
+
isEditorElement(target: HTMLElement): boolean;
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
export declare const setLinkEditorData: (args_0: LinkEditorData | ((prev: LinkEditorData | undefined) => LinkEditorData | undefined) | undefined) => void;
|
|
802
|
+
export declare const getLinkEditorData: () => LinkEditorData | undefined;
|
|
803
|
+
export declare const useLinkEditorData: () => LinkEditorData | undefined;
|
|
804
|
+
export declare const setLinkEditorValue: (args_0: LinkEditorValue | ((prev: LinkEditorValue | undefined) => LinkEditorValue | undefined) | undefined) => void;
|
|
805
|
+
export declare const getLinkEditorValue: () => LinkEditorValue | undefined;
|
|
806
|
+
export declare const useLinkEditorValue: () => LinkEditorValue | undefined;
|
|
807
|
+
export declare const initLinkEditorTool: (value: LinkEditorData) => void;
|
|
808
|
+
export declare const clearLinkEditorTool: () => void;
|
|
809
|
+
|
|
810
|
+
export declare class NumEditorTool implements IEditor<BaseTableEditorNumberValue> {
|
|
811
|
+
oldValue?: BaseTableEditorNumberValue;
|
|
812
|
+
newValue?: BaseTableEditorNumberValue;
|
|
813
|
+
private row?;
|
|
814
|
+
private col?;
|
|
815
|
+
onStart(props: EditContext<BaseTableEditorNumberValue, ListTable>): void;
|
|
816
|
+
validateValue(newValue: BaseTableEditorNumberValue, oldValue: BaseTableEditorNumberValue): ValidateEnum;
|
|
817
|
+
setValue(): void;
|
|
818
|
+
getValue(): {
|
|
819
|
+
value: number | undefined;
|
|
820
|
+
id?: string | undefined;
|
|
821
|
+
type?: TableToolType | undefined;
|
|
822
|
+
loading?: boolean | undefined;
|
|
823
|
+
feedbacks?: FeedbackInfo[] | undefined;
|
|
824
|
+
};
|
|
825
|
+
onEnd(): void;
|
|
826
|
+
isEditorElement(target: HTMLElement): boolean;
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
export declare const setNumEditorValue: (args_0: number | ((prev: number | undefined) => number | undefined) | undefined) => void;
|
|
830
|
+
export declare const getNumEditorValue: () => number | undefined;
|
|
831
|
+
export declare const useNumEditorValue: () => number | undefined;
|
|
832
|
+
export declare const setNumEditorData: (args_0: NumEditorData | ((prev: NumEditorData | undefined) => NumEditorData | undefined) | undefined) => void;
|
|
833
|
+
export declare const getNumEditorData: () => NumEditorData | undefined;
|
|
834
|
+
export declare const useNumEditorData: () => NumEditorData | undefined;
|
|
835
|
+
export declare const initNumEditorTool: (data: NumEditorData) => void;
|
|
836
|
+
export declare const clearNumEditorTool: () => void;
|
|
837
|
+
|
|
838
|
+
export declare class MultiSelectEditorTool implements IEditor<BaseTableEditorSelectValue> {
|
|
839
|
+
oldValue?: BaseTableEditorSelectValue;
|
|
840
|
+
newValue?: BaseTableEditorSelectValue;
|
|
841
|
+
table?: ListTable;
|
|
842
|
+
col?: number;
|
|
843
|
+
row?: number;
|
|
844
|
+
onStart(props: EditContext<BaseTableEditorSelectValue, ListTable>): void;
|
|
845
|
+
validateValue(newValue: BaseTableEditorSelectValue, oldValue: BaseTableEditorSelectValue): ValidateEnum;
|
|
846
|
+
setValue(): void;
|
|
847
|
+
getValue(): {
|
|
848
|
+
value: SelectEditorValue;
|
|
849
|
+
id?: string | undefined;
|
|
850
|
+
type?: TableToolType | undefined;
|
|
851
|
+
loading?: boolean | undefined;
|
|
852
|
+
feedbacks?: FeedbackInfo[] | undefined;
|
|
853
|
+
};
|
|
854
|
+
onEnd(): void;
|
|
855
|
+
/**
|
|
856
|
+
* 如果提供了此函数,VTable 将会在用户点击其他地方时调用此函数。
|
|
857
|
+
* 如果此函数返回了一个假值,VTable 将会调用 `onEnd` 并退出编辑状态。
|
|
858
|
+
* 如果未定义此函数或此函数返回了一个真值, VTable 将不会做任何事。
|
|
859
|
+
* 这意味着,你需要手动调用 `onStart` 中提供的 `endEdit` 来结束编辑模式。
|
|
860
|
+
*/
|
|
861
|
+
isEditorElement(target: HTMLElement): boolean;
|
|
862
|
+
}
|
|
863
|
+
|
|
864
|
+
export declare const setSelectEditorData: (args_0: SelectEditorData | ((prev: SelectEditorData | null) => SelectEditorData | null) | null) => void;
|
|
865
|
+
export declare const getSelectEditorData: () => SelectEditorData | null;
|
|
866
|
+
export declare const useSelectEditorData: () => SelectEditorData | null;
|
|
867
|
+
export declare const setSelectEditorValue: (args_0: SelectEditorValue | ((prev: SelectEditorValue) => SelectEditorValue)) => void;
|
|
868
|
+
export declare const getSelectEditorValue: () => SelectEditorValue;
|
|
869
|
+
export declare const useSelectEditorValue: () => SelectEditorValue;
|
|
870
|
+
export declare const initSelectEditorTool: (value: SelectEditorData) => void;
|
|
871
|
+
export declare const clearSelectEditorTool: () => void;
|
|
872
|
+
|
|
873
|
+
export declare class SingleSelectEditorTool implements IEditor<BaseTableEditorSelectValue> {
|
|
874
|
+
oldValue?: BaseTableEditorSelectValue;
|
|
875
|
+
newValue?: BaseTableEditorSelectValue;
|
|
876
|
+
table?: ListTable;
|
|
877
|
+
col?: number;
|
|
878
|
+
row?: number;
|
|
879
|
+
onStart(props: EditContext<BaseTableEditorSelectValue, ListTable>): void;
|
|
880
|
+
validateValue(newValue: BaseTableEditorSelectValue, oldValue: BaseTableEditorSelectValue): ValidateEnum;
|
|
881
|
+
setValue(): void;
|
|
882
|
+
getValue(): {
|
|
883
|
+
value: SelectEditorValue;
|
|
884
|
+
id?: string | undefined;
|
|
885
|
+
type?: TableToolType | undefined;
|
|
886
|
+
loading?: boolean | undefined;
|
|
887
|
+
feedbacks?: FeedbackInfo[] | undefined;
|
|
888
|
+
};
|
|
889
|
+
onEnd(): void;
|
|
890
|
+
/**
|
|
891
|
+
* 如果提供了此函数,VTable 将会在用户点击其他地方时调用此函数。
|
|
892
|
+
* 如果此函数返回了一个假值,VTable 将会调用 `onEnd` 并退出编辑状态。
|
|
893
|
+
* 如果未定义此函数或此函数返回了一个真值, VTable 将不会做任何事。
|
|
894
|
+
* 这意味着,你需要手动调用 `onStart` 中提供的 `endEdit` 来结束编辑模式。
|
|
895
|
+
*/
|
|
896
|
+
isEditorElement(target: HTMLElement): boolean;
|
|
897
|
+
}
|
|
898
|
+
|
|
899
|
+
export declare class TableEditorEvent extends DestroyClass {
|
|
900
|
+
private editor;
|
|
901
|
+
private instance;
|
|
902
|
+
private container;
|
|
903
|
+
constructor(editor: TableEditor, instance: ListTable, container: HTMLElement);
|
|
904
|
+
private initEvent;
|
|
905
|
+
destroy(): void;
|
|
906
|
+
}
|
|
907
|
+
|
|
908
|
+
export declare const getActiveEditorTable: () => TableEditor | undefined;
|
|
909
|
+
export declare const setActiveEditorTable: () => never;
|
|
910
|
+
export declare const useActiveEditorTable: () => TableEditor | undefined;
|
|
911
|
+
export declare const setActiveTableId: (args_0: string | ((prev: string | undefined) => string | undefined) | undefined) => void;
|
|
912
|
+
export declare const getActiveTableId: () => string | undefined;
|
|
913
|
+
export declare const useActiveTableId: () => string | undefined;
|
|
914
|
+
export declare const activeTableIdAtom: jotai.WritableAtom<string | undefined, [string | ((prev: string | undefined) => string | undefined) | undefined], void>;
|
|
915
|
+
export declare const setEditorTableStore: (args_0: Map<string, TableEditor> | ((prev: Map<string, TableEditor>) => Map<string, TableEditor>)) => void;
|
|
916
|
+
export declare const getEditorTableStore: () => Map<string, TableEditor>;
|
|
917
|
+
export declare const useEditorTableStore: () => Map<string, TableEditor>;
|
|
918
|
+
export declare const editorTableStoreAtom: jotai.WritableAtom<Map<string, TableEditor>, [Map<string, TableEditor> | ((prev: Map<string, TableEditor>) => Map<string, TableEditor>)], void>;
|
|
919
|
+
|
|
920
|
+
export declare const isColumnEditable: (table: ListTable, col: number) => boolean;
|
|
921
|
+
export declare const createDefaultColumnConfig: () => ColumnDefine;
|
|
922
|
+
|
|
923
|
+
export declare class TextEditorTool implements IEditor<BaseTableEditorTextValue> {
|
|
924
|
+
oldValue?: BaseTableEditorTextValue;
|
|
925
|
+
newValue?: BaseTableEditorTextValue;
|
|
926
|
+
private row?;
|
|
927
|
+
private col?;
|
|
928
|
+
onStart(props: EditContext<BaseTableEditorTextValue, ListTable>): void;
|
|
929
|
+
validateValue(newValue: BaseTableEditorTextValue, oldValue: BaseTableEditorTextValue): ValidateEnum;
|
|
930
|
+
setValue(): void;
|
|
931
|
+
getValue(): {
|
|
932
|
+
value: string | undefined;
|
|
933
|
+
id?: string | undefined;
|
|
934
|
+
type?: TableToolType | undefined;
|
|
935
|
+
loading?: boolean | undefined;
|
|
936
|
+
feedbacks?: FeedbackInfo[] | undefined;
|
|
937
|
+
};
|
|
938
|
+
onEnd(): void;
|
|
939
|
+
isEditorElement(target: HTMLElement): boolean;
|
|
940
|
+
}
|
|
941
|
+
|
|
942
|
+
export declare const setTextEditorValue: (args_0: string | ((prev: string | undefined) => string | undefined) | undefined) => void;
|
|
943
|
+
export declare const getTextEditorValue: () => string | undefined;
|
|
944
|
+
export declare const useTextEditorValue: () => string | undefined;
|
|
945
|
+
export declare const setTextEditorData: (args_0: TextEditorData | ((prev: TextEditorData | undefined) => TextEditorData | undefined) | undefined) => void;
|
|
946
|
+
export declare const getTextEditorData: () => TextEditorData | undefined;
|
|
947
|
+
export declare const useTextEditorData: () => TextEditorData | undefined;
|
|
948
|
+
export declare const initTextEditorTool: (data: TextEditorData) => void;
|
|
949
|
+
export declare const clearTextEditorTool: () => void;
|
|
950
|
+
|
|
951
|
+
export declare const setUserShowId: (args_0: string | ((prev: string | null) => string | null) | null) => void;
|
|
952
|
+
export declare const getUserShowId: () => string | null;
|
|
953
|
+
export declare const useUserShowId: () => string | null;
|
|
954
|
+
export declare const setUserShowData: (args_0: UserShowData | ((prev: UserShowData | null) => UserShowData | null) | null) => void;
|
|
955
|
+
export declare const getUserShowData: () => UserShowData | null;
|
|
956
|
+
export declare const useUserShowData: () => UserShowData | null;
|
|
957
|
+
export declare const initUserShowTool: (data: UserShowData) => void;
|
|
958
|
+
export declare const clearUserShowTool: () => void;
|
|
959
|
+
|
|
960
|
+
export declare const theme: ITableThemeDefine;
|
|
961
|
+
|
|
962
|
+
export type CustomTheme = {
|
|
963
|
+
custom: {
|
|
964
|
+
icon: {
|
|
965
|
+
color: string;
|
|
966
|
+
};
|
|
967
|
+
};
|
|
968
|
+
};
|
|
969
|
+
|
|
970
|
+
export declare function getIconSizeFromFont(fontSize: number): number;
|
|
971
|
+
export declare function getFunctionalProp(name: keyof ThemeStyle, cellStyle: ThemeStyle, col: number, row: number, _table: BaseTableAPI): string | number | boolean | (number | null)[] | (string | null)[] | (number[] | null)[] | _visactor_vtable_es_ts_types.MarkCellStyle | CanvasGradient | CanvasPattern | undefined;
|
|
972
|
+
export declare function getProp(name: keyof ThemeStyle, cellStyle: ThemeStyle, col: number, row: number, _table: BaseTableAPI): string | number | boolean | (number | null)[] | (string | null)[] | (number[] | null)[] | _visactor_vtable_es_ts_types.MarkCellStyle | CanvasGradient | CanvasPattern | {
|
|
973
|
+
inlineRowBgColor?: _visactor_vtable_es_ts_types.ColorPropertyDefine | undefined;
|
|
974
|
+
inlineColumnBgColor?: _visactor_vtable_es_ts_types.ColorPropertyDefine | undefined;
|
|
975
|
+
cellBgColor?: _visactor_vtable_es_ts_types.ColorPropertyDefine | undefined;
|
|
976
|
+
} | _visactor_vtable_es_ts_types.FrameStyle;
|
|
977
|
+
|
|
978
|
+
export type LinkEditorProps = {};
|
|
979
|
+
export declare const LinkEditor: FCC<LinkEditorProps>;
|
|
980
|
+
|
|
981
|
+
export type DateSelectProps = {};
|
|
982
|
+
export declare const DateSelect: FCC<DateSelectProps>;
|
|
983
|
+
|
|
984
|
+
export declare const dateProcess: (data: DateEditorData, dateFormat: string) => dayjs.Dayjs;
|
|
985
|
+
|
|
986
|
+
export type TableJsonEditorProps = {};
|
|
987
|
+
export declare const TableJsonEditor: FC<TableJsonEditorProps>;
|
|
988
|
+
|
|
989
|
+
export declare const NumEditor: () => react.JSX.Element | null;
|
|
990
|
+
|
|
991
|
+
export type SelectEditorProps = {
|
|
992
|
+
width?: number;
|
|
993
|
+
listHeight?: number;
|
|
994
|
+
itemHeight?: number;
|
|
995
|
+
multiple?: boolean;
|
|
996
|
+
emptyText?: string;
|
|
997
|
+
};
|
|
998
|
+
export declare const SelectEditor: FCC<SelectEditorProps>;
|
|
999
|
+
|
|
1000
|
+
export type MultiSelectInterface = {};
|
|
1001
|
+
export type SelectOptionID = string;
|
|
1002
|
+
export declare const TableSelectEditor: () => react.JSX.Element | null;
|
|
1003
|
+
|
|
1004
|
+
export declare const updateSelectEditorCell: (col: number, row: number, value: SelectEditorValue, oldValue: SelectEditorValue) => void;
|
|
1005
|
+
|
|
1006
|
+
export declare const TextEditor: () => react.JSX.Element | null;
|
|
1007
|
+
|
|
1008
|
+
export declare const UserShow: () => react__default.JSX.Element | null;
|
|
1009
|
+
|
|
1010
|
+
export declare const highlightMerge: (obj1: AdaptedFeedbackHighlight, obj2: AdaptedFeedbackHighlight) => AdaptedFeedbackHighlight;
|
|
1011
|
+
export declare const getColFromColIndex: (colIndex: number, innerColumnControl: InnerColumnControl) => number;
|
|
1012
|
+
export declare const adaptedCellPosition: (col: number, row: number, innerColumnControl: InnerColumnControl) => {
|
|
1013
|
+
col: number;
|
|
1014
|
+
row: number;
|
|
1015
|
+
};
|
|
1016
|
+
export declare const getRowFromRowIndex: (rowIndex: number) => number;
|
|
1017
|
+
|
|
1018
|
+
/**
|
|
1019
|
+
* 根据原始结构适配为目标列结构
|
|
1020
|
+
* @param originalColumns 原始列结构数组
|
|
1021
|
+
* @returns 适配后的列结构数组
|
|
1022
|
+
*/
|
|
1023
|
+
export declare const adaptColumnStructure: (originalColumns: OriginalColumnStructure[], innerColumnControl: InnerColumnControl) => AdaptedColumn;
|
|
1024
|
+
|
|
1025
|
+
export declare const multiSelectColumnCreator: (data: OriginalColumnStructure, innerColumnControl: InnerColumnControl) => BaseTableColumnSelect;
|
|
1026
|
+
export declare const numberColumnCreator: (data: OriginalColumnStructure, innerColumnControl: InnerColumnControl) => BaseTableColumnNumber;
|
|
1027
|
+
export declare const attachmentColumnCreator: (data: OriginalColumnStructure, innerColumnControl: InnerColumnControl) => BaseTableColumnCustom;
|
|
1028
|
+
export declare const linkColumnCreator: (data: OriginalColumnStructure, innerColumnControl: InnerColumnControl) => BaseTableColumnCustom;
|
|
1029
|
+
export declare const dateColumnCreator: (data: OriginalColumnStructure, innerColumnControl: InnerColumnControl) => BaseTableColumnDate;
|
|
1030
|
+
export declare const timeLenColumnCreator: (data: OriginalColumnStructure, innerColumnControl: InnerColumnControl) => BaseTableColumnCustom;
|
|
1031
|
+
export declare const userColumnCreator: (data: OriginalColumnStructure, innerColumnControl: InnerColumnControl) => BaseTableColumnUser;
|
|
1032
|
+
export declare const tagColumnCreator: (data: OriginalColumnStructure, innerColumnControl: InnerColumnControl) => BaseTableColumnCustom;
|
|
1033
|
+
export declare const jsonColumnCreator: (data: OriginalColumnStructure, innerColumnControl: InnerColumnControl) => BaseTableColumnCustom;
|
|
1034
|
+
export declare const dropdownColumnCreator: (data: OriginalColumnStructure, innerColumnControl: InnerColumnControl) => BaseTableColumnCustom;
|
|
1035
|
+
export declare const checkboxColumnCreator: (data: OriginalColumnStructure, innerColumnControl: InnerColumnControl) => BaseTableColumnCustom;
|
|
1036
|
+
export declare const plusColumnCreator: (data: OriginalColumnStructure, innerColumnControl: InnerColumnControl) => BaseTableColumnCustom;
|
|
1037
|
+
export declare const moreColumnCreator: (data: OriginalColumnStructure, innerColumnControl: InnerColumnControl) => BaseTableColumnCustom;
|
|
1038
|
+
export type ColumnCreatorProps = OriginalColumnStructure & {
|
|
1039
|
+
type: TableToolType | TableColumnInnerType;
|
|
1040
|
+
};
|
|
1041
|
+
export declare const createColumns: (data: ColumnCreatorProps, innerColumnControl: InnerColumnControl) => BaseTableColumnCustom[];
|
|
1042
|
+
|
|
1043
|
+
/**
|
|
1044
|
+
* 根据tool类型获取对应的编辑器类型
|
|
1045
|
+
* @param toolType 工具类型
|
|
1046
|
+
* @returns 对应的编辑器类型
|
|
1047
|
+
*/
|
|
1048
|
+
export declare const getEditorByToolType: (toolType: TableToolType) => VTableEditorType | undefined;
|
|
1049
|
+
|
|
1050
|
+
export declare const adaptRecordStructure: (record: BaseInteractiveRecordStructure) => BaseTableRecordData;
|
|
1051
|
+
export declare const revertRecordStructure: (tableRecord: BaseTableRecordData) => OriginalRecordStructure;
|
|
1052
|
+
export declare const adaptRecordsStructure: (records: OriginalRecordStructure[], adapterColumns: BaseTableColumnDefine[], innerColumnControl: InnerColumnControl) => AdaptedRecord;
|
|
1053
|
+
|
|
1054
|
+
export type CommandFn = (props?: any) => {
|
|
1055
|
+
restore: () => void;
|
|
1056
|
+
};
|
|
1057
|
+
|
|
1058
|
+
export declare class EditTableCellDataCommand extends Command {
|
|
1059
|
+
private editor;
|
|
1060
|
+
private col;
|
|
1061
|
+
private row;
|
|
1062
|
+
private value;
|
|
1063
|
+
private oldValue;
|
|
1064
|
+
id: symbol;
|
|
1065
|
+
label: string;
|
|
1066
|
+
get readonly(): boolean;
|
|
1067
|
+
constructor(editor: TableEditor, col: number, row: number, value: BaseTableEditorValue, oldValue: BaseTableEditorValue);
|
|
1068
|
+
execute(_props: any): void;
|
|
1069
|
+
undo(_props: any): void;
|
|
1070
|
+
}
|
|
1071
|
+
export declare class EditTableCellDataFunctionalCommand extends Command {
|
|
1072
|
+
private table;
|
|
1073
|
+
private fn;
|
|
1074
|
+
id: symbol;
|
|
1075
|
+
label: string;
|
|
1076
|
+
private _restore?;
|
|
1077
|
+
get readonly(): boolean;
|
|
1078
|
+
constructor(table: TableEditor, fn: CommandFn);
|
|
1079
|
+
execute(_props: any): void;
|
|
1080
|
+
undo(_props: any): void;
|
|
1081
|
+
}
|
|
1082
|
+
|
|
1083
|
+
export declare const createGraphicsWithLoading: (graphics: IGroup | {
|
|
1084
|
+
props: {
|
|
1085
|
+
attribute: {
|
|
1086
|
+
width: number;
|
|
1087
|
+
height: number;
|
|
1088
|
+
};
|
|
1089
|
+
};
|
|
1090
|
+
}, loading: boolean) => IGroup | {
|
|
1091
|
+
props: {
|
|
1092
|
+
attribute: {
|
|
1093
|
+
width: number;
|
|
1094
|
+
height: number;
|
|
1095
|
+
};
|
|
1096
|
+
};
|
|
1097
|
+
};
|
|
1098
|
+
|
|
1099
|
+
export type IconGraphicsProps = {
|
|
1100
|
+
x?: number;
|
|
1101
|
+
y?: number;
|
|
1102
|
+
size?: number;
|
|
1103
|
+
color?: string;
|
|
1104
|
+
cursor?: Cursor;
|
|
1105
|
+
disabled?: boolean;
|
|
1106
|
+
hoverBg?: boolean;
|
|
1107
|
+
onClick?: () => void;
|
|
1108
|
+
};
|
|
1109
|
+
export declare const createIconGraphics: (name: RegistryKey, props?: IconGraphicsProps) => _visactor_vtable_es_vrender.IGroup;
|
|
1110
|
+
|
|
1111
|
+
export type HeaderGraphicsProps = CustomRenderFunctionArg<BaseTableAPI$1>;
|
|
1112
|
+
export declare const createHeaderGraphics: (type: TableToolType, props: HeaderGraphicsProps) => _visactor_vtable_es_vrender.IGroup;
|
|
1113
|
+
|
|
1114
|
+
export type PlusHeaderGraphicsProps = CustomRenderFunctionArg<BaseTableAPI$1>;
|
|
1115
|
+
export declare const createPlusHeaderGraphics: (props: PlusHeaderGraphicsProps) => _visactor_vtable_es_vrender.IGroup;
|
|
1116
|
+
|
|
1117
|
+
export type DateGraphicProps = CustomRenderFunctionArg<BaseTableAPI> & {
|
|
1118
|
+
value: BasicBaseTableEditorValue<DateEditorValue>;
|
|
1119
|
+
};
|
|
1120
|
+
export declare const createDateGraphics: (props: DateGraphicProps) => _visactor_vtable_es_vrender.IGroup | {
|
|
1121
|
+
props: {
|
|
1122
|
+
attribute: {
|
|
1123
|
+
width: number;
|
|
1124
|
+
height: number;
|
|
1125
|
+
};
|
|
1126
|
+
};
|
|
1127
|
+
};
|
|
1128
|
+
|
|
1129
|
+
export type JsonGraphicProps = CustomRenderFunctionArg<BaseTableAPI$1>;
|
|
1130
|
+
export declare const createJsonGraphics: (props: JsonGraphicProps) => _visactor_vtable_es_vrender.IGroup;
|
|
1131
|
+
|
|
1132
|
+
export type LinkGraphicProps = CustomRenderFunctionArg<BaseTableAPI$1> & {
|
|
1133
|
+
value: BasicBaseTableEditorValue<LinkEditorValue>;
|
|
1134
|
+
};
|
|
1135
|
+
export declare const createLinkGraphics: (props: LinkGraphicProps) => IGroup | {
|
|
1136
|
+
props: {
|
|
1137
|
+
attribute: {
|
|
1138
|
+
width: number;
|
|
1139
|
+
height: number;
|
|
1140
|
+
};
|
|
1141
|
+
};
|
|
1142
|
+
};
|
|
1143
|
+
|
|
1144
|
+
export type MainColumnCellGraphicProps = CustomRenderFunctionArg<BaseTableAPI>;
|
|
1145
|
+
export declare const createMainColumnCellGraphics: (props: MainColumnCellGraphicProps) => _visactor_vtable_es_vrender.IGroup | {
|
|
1146
|
+
props: {
|
|
1147
|
+
attribute: {
|
|
1148
|
+
width: number;
|
|
1149
|
+
height: number;
|
|
1150
|
+
};
|
|
1151
|
+
};
|
|
1152
|
+
};
|
|
1153
|
+
|
|
1154
|
+
export type MoreGraphicProps = CustomRenderFunctionArg<BaseTableAPI$1> & {
|
|
1155
|
+
onClick?: (info: {
|
|
1156
|
+
row: number;
|
|
1157
|
+
col: number;
|
|
1158
|
+
record: any;
|
|
1159
|
+
x: number;
|
|
1160
|
+
y: number;
|
|
1161
|
+
}) => void;
|
|
1162
|
+
onCancel?: () => void;
|
|
1163
|
+
record?: any;
|
|
1164
|
+
};
|
|
1165
|
+
export declare const createMoreGraphics: (props: MoreGraphicProps) => _visactor_vtable_es_vrender.IGroup | {
|
|
1166
|
+
props: {
|
|
1167
|
+
attribute: {
|
|
1168
|
+
width: number;
|
|
1169
|
+
height: number;
|
|
1170
|
+
};
|
|
1171
|
+
};
|
|
1172
|
+
};
|
|
1173
|
+
|
|
1174
|
+
type MultiSelectGraphicProps = CustomRenderFunctionArg<BaseTableAPI> & {
|
|
1175
|
+
height: number;
|
|
1176
|
+
width: number;
|
|
1177
|
+
value: SelectEditorOption[] | undefined;
|
|
1178
|
+
};
|
|
1179
|
+
export declare const createMultiSelectGraphic: (props: MultiSelectGraphicProps) => _visactor_vtable_es_vrender.IGroup | {
|
|
1180
|
+
props: {
|
|
1181
|
+
attribute: {
|
|
1182
|
+
width: number;
|
|
1183
|
+
height: number;
|
|
1184
|
+
};
|
|
1185
|
+
};
|
|
1186
|
+
};
|
|
1187
|
+
|
|
1188
|
+
export type NumberGraphicProps = CustomRenderFunctionArg<BaseTableAPI$1> & {
|
|
1189
|
+
value: BasicBaseTableEditorValue<number>;
|
|
1190
|
+
textAlign?: 'left' | 'center' | 'right';
|
|
1191
|
+
};
|
|
1192
|
+
export declare const createNumberGraphics: (props: NumberGraphicProps) => _visactor_vtable_es_vrender.IGroup | {
|
|
1193
|
+
props: {
|
|
1194
|
+
attribute: {
|
|
1195
|
+
width: number;
|
|
1196
|
+
height: number;
|
|
1197
|
+
};
|
|
1198
|
+
};
|
|
1199
|
+
};
|
|
1200
|
+
|
|
1201
|
+
export type PeopleGraphicProps = CustomRenderFunctionArg<BaseTableAPI$1> & {
|
|
1202
|
+
value: BasicBaseTableEditorValue<PersonInfo[]>;
|
|
1203
|
+
};
|
|
1204
|
+
export declare const createPeopleGraphics: (props: PeopleGraphicProps) => _visactor_vtable_es_vrender.IGroup | {
|
|
1205
|
+
props: {
|
|
1206
|
+
attribute: {
|
|
1207
|
+
width: number;
|
|
1208
|
+
height: number;
|
|
1209
|
+
};
|
|
1210
|
+
};
|
|
1211
|
+
};
|
|
1212
|
+
|
|
1213
|
+
export type SingleSelectGraphicProps = CustomRenderFunctionArg<BaseTableAPI> & {
|
|
1214
|
+
value: SelectEditorOption$1[] | undefined;
|
|
1215
|
+
};
|
|
1216
|
+
export declare const createSingleSelectGraphic: (props: SingleSelectGraphicProps) => _visactor_vtable_es_vrender.IGroup | {
|
|
1217
|
+
props: {
|
|
1218
|
+
attribute: {
|
|
1219
|
+
width: number;
|
|
1220
|
+
height: number;
|
|
1221
|
+
};
|
|
1222
|
+
};
|
|
1223
|
+
} | null;
|
|
1224
|
+
|
|
1225
|
+
export declare const createTagGraphic: (props: CustomRenderFunctionArg<BaseTableAPI>) => _visactor_vtable_es_vrender.IGroup | {
|
|
1226
|
+
props: {
|
|
1227
|
+
attribute: {
|
|
1228
|
+
width: number;
|
|
1229
|
+
height: number;
|
|
1230
|
+
};
|
|
1231
|
+
};
|
|
1232
|
+
};
|
|
1233
|
+
|
|
1234
|
+
export type TextGraphicProps = CustomRenderFunctionArg<BaseTableAPI$1> & {
|
|
1235
|
+
color?: string;
|
|
1236
|
+
};
|
|
1237
|
+
export declare const createTextGraphics: (props: TextGraphicProps) => IGroup;
|
|
1238
|
+
|
|
1239
|
+
export type TimeLenGraphicsValue = number;
|
|
1240
|
+
export type TimeLenGraphicProps = CustomRenderFunctionArg<BaseTableAPI> & {
|
|
1241
|
+
value: BasicBaseTableEditorValue<number>;
|
|
1242
|
+
};
|
|
1243
|
+
export declare const createTimeLenGraphics: (props: TimeLenGraphicProps) => _visactor_vtable_es_vrender.IGroup | {
|
|
1244
|
+
props: {
|
|
1245
|
+
attribute: {
|
|
1246
|
+
width: number;
|
|
1247
|
+
height: number;
|
|
1248
|
+
};
|
|
1249
|
+
};
|
|
1250
|
+
};
|
|
1251
|
+
|
|
1252
|
+
export type UploadDocumentProps = {
|
|
1253
|
+
args: any;
|
|
1254
|
+
height: number;
|
|
1255
|
+
width: number;
|
|
1256
|
+
value: BasicBaseTableEditorValue<AttachmentEditorValue>;
|
|
1257
|
+
};
|
|
1258
|
+
export declare const createUploadDocumentGraphics: (props: CustomRenderFunctionArg<BaseTableAPI$1>) => _visactor_vtable_es_vrender.IGroup | {
|
|
1259
|
+
props: {
|
|
1260
|
+
attribute: {
|
|
1261
|
+
width: number;
|
|
1262
|
+
height: number;
|
|
1263
|
+
};
|
|
1264
|
+
};
|
|
1265
|
+
};
|
|
1266
|
+
|
|
1267
|
+
/**
|
|
1268
|
+
* 获取文本宽度
|
|
1269
|
+
* @param text 要测量的文本内容
|
|
1270
|
+
* @param fontSize 字体大小
|
|
1271
|
+
* @returns 文本的实际宽度
|
|
1272
|
+
*/
|
|
1273
|
+
export declare const getTextWidth: (text: string, fontSize: number) => number;
|
|
1274
|
+
|
|
1275
|
+
|