onchain-uikit 3.9.4-alpha4 → 3.9.4-alpha40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +401 -222
- package/dist/index.es.js +35753 -20037
- package/dist/index.umd.js +468 -289
- package/dist/onchain-uikit.css +2 -2
- package/lib/src/app/main/model/context.d.ts +2 -0
- package/lib/src/components/OnChainAdvancedSearch/index.d.ts +22 -3
- package/lib/src/components/OnChainAdvancedSearch/index.stories.d.ts +1 -1
- package/lib/src/components/OnChainExcelTemplate/XlsxSheetManager.d.ts +5 -0
- package/lib/src/components/OnChainExcelTemplate/core.d.ts +14 -0
- package/lib/src/components/OnChainExcelTemplate/index.d.ts +5 -0
- package/lib/src/components/OnChainFormItem/index.d.ts +5 -5
- package/lib/src/components/OnChainGenAntImage/index.d.ts +1 -0
- package/lib/src/components/OnChainGlobalLoading/index.d.ts +3 -3
- package/lib/src/components/OnChainGlobalLoading/index.stories.d.ts +1 -1
- package/lib/src/components/OnChainIcon/index.d.ts +7 -3
- package/lib/src/components/OnChainModal/index.d.ts +1 -0
- package/lib/src/components/OnChainPopoverTransfer/index.d.ts +4 -4
- package/lib/src/components/OnChainPopoverTransfer/select/index.d.ts +5 -5
- package/lib/src/components/OnChainPopupSelect/index.d.ts +4 -1
- package/lib/src/components/OnChainProvider/index.d.ts +2 -1
- package/lib/src/components/OnChainPublicTree/index.d.ts +2 -2
- package/lib/src/components/OnChainPublicTree/index.stories.d.ts +1 -1
- package/lib/src/components/OnChainQueryBuilder/index.d.ts +14 -13
- package/lib/src/components/OnChainResourceTree/index.d.ts +2 -3
- package/lib/src/components/OnChainSearchSelect/index.d.ts +18 -0
- package/lib/src/components/OnChainSelectPopupForm/index.d.ts +2 -2
- package/lib/src/components/OnChainSelectPopupForm/select/index.d.ts +3 -3
- package/lib/src/components/OnChainTable/ContextMenu.d.ts +2 -2
- package/lib/src/components/OnChainTable/OnChainTableFormItem/index.d.ts +4 -3
- package/lib/src/components/OnChainTable/TableFooter.d.ts +2 -2
- package/lib/src/components/OnChainTable/TableUtils.d.ts +4 -4
- package/lib/src/components/OnChainTable/index.d.ts +6 -6
- package/lib/src/components/OnChainTable/index.stories.d.ts +4 -1
- package/lib/src/components/OnChainTable/useClipboard.d.ts +2 -2
- package/lib/src/components/OnChainTable/useColumn.d.ts +2 -2
- package/lib/src/components/OnChainTable/useCopy.d.ts +1 -2
- package/lib/src/components/OnChainTable/useDynamicHeight.d.ts +2 -2
- package/lib/src/components/OnChainTable/useFiltered.d.ts +2 -2
- package/lib/src/components/OnChainTable/usePaste.d.ts +1 -2
- package/lib/src/components/OnChainTableSelection/index.d.ts +8 -5
- package/lib/src/components/OnChainTableSelection/index.stories.d.ts +1 -1
- package/lib/src/components/OnChainUniverExcel/data.d.ts +2 -0
- package/lib/src/components/OnChainUniverExcel/index.d.ts +14 -0
- package/lib/src/components/OnChainUniverExcel/plugin.d.ts +1 -0
- package/lib/src/components/OnChainUniverExcel/plugins/controllers/controller.d.ts +11 -0
- package/lib/src/components/OnChainUniverExcel/plugins/controllers/menu/export.d.ts +13 -0
- package/lib/src/components/OnChainUniverExcel/plugins/controllers/menu/generate.d.ts +12 -0
- package/lib/src/components/OnChainUniverExcel/plugins/controllers/menu/import.d.ts +19 -0
- package/lib/src/components/OnChainUniverExcel/plugins/controllers/menu/save.d.ts +3 -0
- package/lib/src/components/OnChainUniverExcel/plugins/controllers/menu/saveDatabase.d.ts +12 -0
- package/lib/src/components/OnChainUniverExcel/plugins/index.d.ts +42 -0
- package/lib/src/components/OnChainUniverExcel/plugins/locale/en-US.d.ts +15 -0
- package/lib/src/components/OnChainUniverExcel/plugins/locale/zh-CN.d.ts +15 -0
- package/lib/src/components/OnChainVTable/ListTable.d.ts +30 -0
- package/lib/src/components/OnChainVTable/components/index.d.ts +1 -0
- package/lib/src/components/OnChainVTable/components/tooltip.d.ts +9 -0
- package/lib/src/components/OnChainVTable/const.d.ts +47 -0
- package/lib/src/components/OnChainVTable/demo.d.ts +1 -0
- package/lib/src/components/OnChainVTable/feature/customMergeCell.d.ts +33 -0
- package/lib/src/components/OnChainVTable/feature/fill-handle.d.ts +6 -0
- package/lib/src/components/OnChainVTable/feature/history-edit.d.ts +435 -0
- package/lib/src/components/OnChainVTable/feature/index.d.ts +6 -0
- package/lib/src/components/OnChainVTable/feature/right-click-menu.d.ts +24 -0
- package/lib/src/components/OnChainVTable/feature/style.d.ts +17 -0
- package/lib/src/components/OnChainVTable/feature/tooltip.d.ts +9 -0
- package/lib/src/components/OnChainVTable/feature/types.d.ts +34 -0
- package/lib/src/components/OnChainVTable/feature/utils.d.ts +141 -0
- package/lib/src/components/OnChainVTable/index.d.ts +6 -0
- package/lib/src/components/OnChainVTable/index.stories.d.ts +87 -0
- package/lib/src/components/OnChainVTable/type.d.ts +114 -0
- package/lib/src/index.d.ts +50 -2
- package/lib/src/types/gantt.d.ts +1 -1
- package/lib/src/typings.d.ts +3 -3
- package/lib/src/utils/utility.d.ts +3 -1
- package/lib/typings.d.ts +3 -1
- package/package.json +9 -1
|
@@ -0,0 +1,435 @@
|
|
|
1
|
+
import { ListTable } from '../ListTable';
|
|
2
|
+
import { CellAddress, TableEventHandlersEventArgumentMap } from '@visactor/vtable/es/ts-types';
|
|
3
|
+
import { RecordResult, RecordType } from '../const';
|
|
4
|
+
import { HistoryEditOptions, WholeRow } from './types';
|
|
5
|
+
import { CellEditStyle } from './style';
|
|
6
|
+
type TableModifyInfo = ReturnType<HistoryEdit<WholeRow>['getTableModifyInfo']>;
|
|
7
|
+
type ModifyRecord = TableEventHandlersEventArgumentMap['change_cell_value'];
|
|
8
|
+
type ModifyRecordKeys = keyof ModifyRecord;
|
|
9
|
+
type ChangePositionInfo = TableEventHandlersEventArgumentMap['change_header_position'];
|
|
10
|
+
declare enum ChangeMode {
|
|
11
|
+
Set = 0,
|
|
12
|
+
Drag = 1,
|
|
13
|
+
Update = 2
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* @description 单元格数据管理
|
|
17
|
+
* @date 2024-08-09 09:46:55
|
|
18
|
+
* @class BasicsCellModify
|
|
19
|
+
*/
|
|
20
|
+
export declare class BasicsCellModify<Row extends WholeRow> {
|
|
21
|
+
tableInstance: ListTable<Row>;
|
|
22
|
+
/** 这个数据和 history 是同一份数据 */
|
|
23
|
+
private readonly record;
|
|
24
|
+
private readonly original;
|
|
25
|
+
/** 数据状态是否为空 */
|
|
26
|
+
private empty;
|
|
27
|
+
/** 单元格数据是否复原 */
|
|
28
|
+
private initial;
|
|
29
|
+
/** 数据变化类型 */
|
|
30
|
+
changeMode: ChangeMode;
|
|
31
|
+
isModifyMark: boolean;
|
|
32
|
+
constructor(record: ModifyRecord, { tableInstance, changeMode, isModifyMark, }: {
|
|
33
|
+
tableInstance: ListTable<Row>;
|
|
34
|
+
isModifyMark: boolean;
|
|
35
|
+
changeMode?: ChangeMode;
|
|
36
|
+
});
|
|
37
|
+
/** 创建一个新的单元格数据 */
|
|
38
|
+
static createCellModifyRecord(param: Partial<ModifyRecord>): ModifyRecord;
|
|
39
|
+
/** 记录类型 */
|
|
40
|
+
get type(): RecordType;
|
|
41
|
+
/** 单元格修改信息 */
|
|
42
|
+
get modify(): Readonly<ModifyRecord>;
|
|
43
|
+
/** 是否为空记录 */
|
|
44
|
+
get isEmpty(): boolean;
|
|
45
|
+
/** 初始状态 */
|
|
46
|
+
get isInitial(): boolean;
|
|
47
|
+
get isInsertion(): boolean;
|
|
48
|
+
/** 全局使用的修改记录,避免调用重置单元格渲染,导致拿不到全局使用的修改记录 */
|
|
49
|
+
get globallyUnique(): Readonly<{
|
|
50
|
+
col: number;
|
|
51
|
+
row: number;
|
|
52
|
+
rawValue: string | number;
|
|
53
|
+
currentValue: string | number;
|
|
54
|
+
changedValue: string | number;
|
|
55
|
+
}>;
|
|
56
|
+
/** 替换记录 */
|
|
57
|
+
private replace;
|
|
58
|
+
/** 添加记录 */
|
|
59
|
+
set(record: ModifyRecord): void;
|
|
60
|
+
setModifyAttr<T extends ModifyRecordKeys>(key: T, value: ModifyRecord[T]): void;
|
|
61
|
+
getModifyAttr<T extends ModifyRecordKeys>(key: T): {
|
|
62
|
+
col: number;
|
|
63
|
+
row: number;
|
|
64
|
+
rawValue: string | number;
|
|
65
|
+
currentValue: string | number;
|
|
66
|
+
changedValue: string | number;
|
|
67
|
+
}[T];
|
|
68
|
+
/** 移除记录 */
|
|
69
|
+
remove(): void;
|
|
70
|
+
/** 保存修改 */
|
|
71
|
+
saveModify(): void;
|
|
72
|
+
/** 更新单元格渲染 */
|
|
73
|
+
updateCellRender(record: ModifyRecord): void;
|
|
74
|
+
/** 重置单元格渲染 */
|
|
75
|
+
resetCellRender(): void;
|
|
76
|
+
/** 撤回单元格修改*/
|
|
77
|
+
revocation(): void;
|
|
78
|
+
/** 销毁 */
|
|
79
|
+
destroy(): void;
|
|
80
|
+
}
|
|
81
|
+
type ModifyManageStorageType = 'row' | 'col';
|
|
82
|
+
/**
|
|
83
|
+
* @description Table 数据修改管理
|
|
84
|
+
* @date 2024-08-09 09:47:16
|
|
85
|
+
* @class ModifyManage
|
|
86
|
+
*/
|
|
87
|
+
declare class ModifyManage<Row extends WholeRow> {
|
|
88
|
+
readonly tableInstance: ListTable<Row>;
|
|
89
|
+
readonly isModifyMark: boolean;
|
|
90
|
+
/** 单行 存储的 列 数据 */
|
|
91
|
+
readonly row: Map<number, Map<number, BasicsCellModify<Row>>>;
|
|
92
|
+
/** 单列 存储的 行 数据 */
|
|
93
|
+
readonly col: Map<number, Map<number, BasicsCellModify<Row>>>;
|
|
94
|
+
readonly dataBinding: {
|
|
95
|
+
row: Map<string, Map<number, BasicsCellModify<Row>>>;
|
|
96
|
+
col: Map<string, Map<number, BasicsCellModify<Row>>>;
|
|
97
|
+
};
|
|
98
|
+
readonly basicsCellRecords: Set<BasicsCellModify<Row>>;
|
|
99
|
+
constructor(tableInstance: ListTable<Row>, { isModifyMark }: {
|
|
100
|
+
isModifyMark: boolean;
|
|
101
|
+
});
|
|
102
|
+
set(param: ModifyRecord): this;
|
|
103
|
+
get(): [Row | null, BasicsCellModify<Row>[] | null][];
|
|
104
|
+
delete(param: {
|
|
105
|
+
type: ModifyManageStorageType;
|
|
106
|
+
count: number;
|
|
107
|
+
}): BasicsCellModify<Row>[];
|
|
108
|
+
save(): void;
|
|
109
|
+
/** 历史数据发生变化 */
|
|
110
|
+
historyRecordChange({ recover, update }: {
|
|
111
|
+
recover?: Set<ModifyRecord>;
|
|
112
|
+
update?: Set<ModifyRecord>;
|
|
113
|
+
}): void;
|
|
114
|
+
/** 单元格位置发生变化 */
|
|
115
|
+
positionChange(param: ChangePositionInfo): void;
|
|
116
|
+
/** 获取单元格修改 */
|
|
117
|
+
getModifiedRecord(): BasicsCellModify<Row>[];
|
|
118
|
+
/** 清除记录数据 */
|
|
119
|
+
clear(): void;
|
|
120
|
+
/** 重置单元格数据 */
|
|
121
|
+
resetCellRender(): void;
|
|
122
|
+
/** 销毁记录数据 */
|
|
123
|
+
destroy(): void;
|
|
124
|
+
private generateCellModifyRecord;
|
|
125
|
+
getTableSourceData({ type }: {
|
|
126
|
+
type: Parameters<ModifyManage<Row>['generateCellModifyRecord']>[0]['type'];
|
|
127
|
+
}): {
|
|
128
|
+
data: (string | null)[];
|
|
129
|
+
oppositeData: (string | null)[];
|
|
130
|
+
};
|
|
131
|
+
private getCachePath;
|
|
132
|
+
positionChangeSort({ type }: {
|
|
133
|
+
type: 'row' | 'col';
|
|
134
|
+
}): void;
|
|
135
|
+
/**
|
|
136
|
+
* 因为 VTable 样式绑定单元格行号或者列号,所以排序发生变化后,需要更新样式
|
|
137
|
+
* 旧的单元格有更新标记,排序后的新单元格没有更新标记时,需要为新单元格生成一个为 RecordType.Raw 的修改记录
|
|
138
|
+
*/
|
|
139
|
+
private antitheticComplete;
|
|
140
|
+
}
|
|
141
|
+
declare class BasicsSpecialHistoryEdit<Row extends WholeRow> {
|
|
142
|
+
readonly historyEdit: HistoryEdit<Row>;
|
|
143
|
+
get tableInstance(): ListTable<Row>;
|
|
144
|
+
get modifyManage(): ModifyManage<Row>;
|
|
145
|
+
constructor(param: {
|
|
146
|
+
historyEdit: HistoryEdit<Row>;
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
interface InsertInfo {
|
|
150
|
+
row: number;
|
|
151
|
+
dataList: any[];
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* @description 管理动态添加(插入)数据
|
|
155
|
+
* @date 2024-08-09 09:47:40
|
|
156
|
+
* @class InsertRowRecord
|
|
157
|
+
* @implements {InsertInfo}
|
|
158
|
+
*/
|
|
159
|
+
declare class InsertRowRecord<Row extends WholeRow> extends BasicsSpecialHistoryEdit<Row> implements InsertInfo {
|
|
160
|
+
readonly row: number;
|
|
161
|
+
readonly dataList: Row[];
|
|
162
|
+
readonly copyDataMap: Map<Row, Row>;
|
|
163
|
+
/** 当前步骤管理的cell修改 (historyEdit.current) */
|
|
164
|
+
affiliationStack: Set<ModifyRecord> | null;
|
|
165
|
+
protected inserted: boolean;
|
|
166
|
+
/** 全部插入的单元格 */
|
|
167
|
+
readonly cellRecords: Set<{
|
|
168
|
+
col: number;
|
|
169
|
+
row: number;
|
|
170
|
+
rawValue: string | number;
|
|
171
|
+
currentValue: string | number;
|
|
172
|
+
changedValue: string | number;
|
|
173
|
+
}>;
|
|
174
|
+
/** [行数据, Array<单元格>] */
|
|
175
|
+
readonly rowRecordMap: Map<Row, Set<{
|
|
176
|
+
col: number;
|
|
177
|
+
row: number;
|
|
178
|
+
rawValue: string | number;
|
|
179
|
+
currentValue: string | number;
|
|
180
|
+
changedValue: string | number;
|
|
181
|
+
}>>;
|
|
182
|
+
/** 有生成 ChildInsertRowRecord 的单元格 */
|
|
183
|
+
readonly autonomyCells: Set<{
|
|
184
|
+
col: number;
|
|
185
|
+
row: number;
|
|
186
|
+
rawValue: string | number;
|
|
187
|
+
currentValue: string | number;
|
|
188
|
+
changedValue: string | number;
|
|
189
|
+
}>;
|
|
190
|
+
/** 插入数据,第一个的位置 */
|
|
191
|
+
get insertStartRow(): number;
|
|
192
|
+
get IsInserted(): boolean;
|
|
193
|
+
constructor(param: InsertInfo & {
|
|
194
|
+
historyEdit: HistoryEdit<Row>;
|
|
195
|
+
isInitialize?: boolean;
|
|
196
|
+
});
|
|
197
|
+
/** 最新的插入位置(序号会发生变化) */
|
|
198
|
+
getLatestRowNumber(rowData: any): any;
|
|
199
|
+
insert(): void;
|
|
200
|
+
/** 恢复插入行为 */
|
|
201
|
+
recover(): void;
|
|
202
|
+
/** 添加单元格数据 ()*/
|
|
203
|
+
recoverCellData(): void;
|
|
204
|
+
/** 移除插入行为 */
|
|
205
|
+
remove(): void;
|
|
206
|
+
/** 移除单元格数据 返回移除单元格行所在数据的索引 */
|
|
207
|
+
removeCellData(): number[];
|
|
208
|
+
/** 设置插入数据的状态 */
|
|
209
|
+
setInserted(value: boolean): void;
|
|
210
|
+
/** 批量恢复插入行为 */
|
|
211
|
+
static recovers<Row extends WholeRow>({ insertHistory, tableInstance, modifyManage, }: {
|
|
212
|
+
insertHistory: (InsertRowRecord<Row> | ChildInsertRowRecord<Row> | null)[];
|
|
213
|
+
modifyManage: ModifyManage<Row>;
|
|
214
|
+
tableInstance: ListTable<Row>;
|
|
215
|
+
}): void;
|
|
216
|
+
/** 批量移除插入行为 */
|
|
217
|
+
static removes<Row extends WholeRow>({ insertHistory, tableInstance, modifyManage, }: {
|
|
218
|
+
insertHistory: (InsertRowRecord<Row> | ChildInsertRowRecord<Row> | null)[];
|
|
219
|
+
modifyManage: ModifyManage<Row>;
|
|
220
|
+
tableInstance: ListTable<Row>;
|
|
221
|
+
}): void;
|
|
222
|
+
static group<T extends {
|
|
223
|
+
row: number;
|
|
224
|
+
}>(array: T[]): Generator<T[], void, unknown>;
|
|
225
|
+
}
|
|
226
|
+
declare class ChildInsertRowRecord<Row extends WholeRow> extends InsertRowRecord<Row> {
|
|
227
|
+
parent: InsertRowRecord<Row>;
|
|
228
|
+
constructor(param: InsertInfo & {
|
|
229
|
+
historyEdit: HistoryEdit<Row>;
|
|
230
|
+
parent: InsertRowRecord<Row>;
|
|
231
|
+
appointCellRecords?: {
|
|
232
|
+
row: number;
|
|
233
|
+
originalModifyRecord: Set<ModifyRecord>;
|
|
234
|
+
}[];
|
|
235
|
+
});
|
|
236
|
+
insert(): void;
|
|
237
|
+
/** 删除自我管理,表示可以被其他数据接管 */
|
|
238
|
+
deleteAutonomyCells(): void;
|
|
239
|
+
/** 添加自我管理,表示不可被其他数据接管 */
|
|
240
|
+
addAutonomyCells(): void;
|
|
241
|
+
/** 恢复插入行为 */
|
|
242
|
+
recover(): void;
|
|
243
|
+
/** 移除插入行为 */
|
|
244
|
+
remove(): void;
|
|
245
|
+
}
|
|
246
|
+
declare class DeleteRowRecord<Row extends WholeRow> extends BasicsSpecialHistoryEdit<Row> {
|
|
247
|
+
insertMap: Map<InsertRowRecord<Row>, {
|
|
248
|
+
deleteInfos: Record<number, Set<ModifyRecord>>;
|
|
249
|
+
deleteCellSize: number;
|
|
250
|
+
}>;
|
|
251
|
+
/** 实际需要执行删除的 插入对象 */
|
|
252
|
+
needDelete: InsertRowRecord<Row>[];
|
|
253
|
+
/** 额外删除的单元格 */
|
|
254
|
+
needDeleteStyleCells: ModifyRecord[];
|
|
255
|
+
deleted: boolean;
|
|
256
|
+
constructor(param: {
|
|
257
|
+
historyEdit: HistoryEdit<Row>;
|
|
258
|
+
rows: number[];
|
|
259
|
+
needDeleteStyleCells?: ModifyRecord[];
|
|
260
|
+
});
|
|
261
|
+
delete(): void;
|
|
262
|
+
/** 初始化插入实例集合 */
|
|
263
|
+
initializeExpurgated(): void;
|
|
264
|
+
/** 恢复删除行为 */
|
|
265
|
+
recover(): void;
|
|
266
|
+
/** 移除删除行为 */
|
|
267
|
+
remove(): void;
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* @description 直接删除行数
|
|
271
|
+
* @date 2024-08-13 17:04:17
|
|
272
|
+
* @class DeleteDirectRow
|
|
273
|
+
* @extends {DeleteRowRecord}
|
|
274
|
+
*/
|
|
275
|
+
declare class DirectDeleteRowRecord<Row extends WholeRow> extends DeleteRowRecord<Row> {
|
|
276
|
+
dataList: {
|
|
277
|
+
row: number;
|
|
278
|
+
data: Row;
|
|
279
|
+
}[];
|
|
280
|
+
readonly copyDataMap: Map<Row, Row>;
|
|
281
|
+
readonly deletedIndex: Map<Row, number>;
|
|
282
|
+
constructor(param: {
|
|
283
|
+
dataList: {
|
|
284
|
+
row: number;
|
|
285
|
+
data: Row;
|
|
286
|
+
}[];
|
|
287
|
+
historyEdit: HistoryEdit<Row>;
|
|
288
|
+
});
|
|
289
|
+
delete(): void;
|
|
290
|
+
/** 恢复删除行为 */
|
|
291
|
+
recover(): void;
|
|
292
|
+
/** 移除删除行为 */
|
|
293
|
+
remove(): void;
|
|
294
|
+
}
|
|
295
|
+
type SortChangeInfo = TableEventHandlersEventArgumentMap['change_header_position'];
|
|
296
|
+
declare class SortedRowRecord<Row extends WholeRow> extends BasicsSpecialHistoryEdit<Row> implements SortChangeInfo {
|
|
297
|
+
readonly event: Event;
|
|
298
|
+
readonly source: CellAddress;
|
|
299
|
+
readonly target: CellAddress;
|
|
300
|
+
sorted: boolean;
|
|
301
|
+
constructor(param: {
|
|
302
|
+
historyEdit: HistoryEdit<Row>;
|
|
303
|
+
} & SortChangeInfo);
|
|
304
|
+
private updateCellContent;
|
|
305
|
+
/** 恢复排序行为 */
|
|
306
|
+
recover(): void;
|
|
307
|
+
/** 移除排序行为 */
|
|
308
|
+
remove(): void;
|
|
309
|
+
get isSortCol(): boolean;
|
|
310
|
+
get isSortRow(): boolean;
|
|
311
|
+
get isSortNoChange(): boolean;
|
|
312
|
+
}
|
|
313
|
+
interface OtherHistory<Row extends WholeRow> {
|
|
314
|
+
sortHistory: (null | SortedRowRecord<Row>)[];
|
|
315
|
+
insertHistory: (null | InsertRowRecord<Row>)[];
|
|
316
|
+
deleteHistory: (null | DeleteRowRecord<Row> | DirectDeleteRowRecord<Row>)[];
|
|
317
|
+
}
|
|
318
|
+
interface HistoryGather<Row extends WholeRow> extends OtherHistory<Row> {
|
|
319
|
+
history: Set<ModifyRecord>[];
|
|
320
|
+
}
|
|
321
|
+
type GatherStorage<Row extends WholeRow> = {
|
|
322
|
+
[P in keyof HistoryGather<Row>]?: HistoryGather<Row>[P][0];
|
|
323
|
+
};
|
|
324
|
+
/**
|
|
325
|
+
* @description 历史数据栈处理基础类
|
|
326
|
+
* @date 2024-08-09 09:48:52
|
|
327
|
+
* @class BasicsHistoryStack
|
|
328
|
+
*/
|
|
329
|
+
declare class BasicsHistoryStack<Row extends WholeRow> {
|
|
330
|
+
current: Set<ModifyRecord> | null;
|
|
331
|
+
readonly gather: Readonly<HistoryGather<Row>>;
|
|
332
|
+
get history(): Set<{
|
|
333
|
+
col: number;
|
|
334
|
+
row: number;
|
|
335
|
+
rawValue: string | number;
|
|
336
|
+
currentValue: string | number;
|
|
337
|
+
changedValue: string | number;
|
|
338
|
+
}>[];
|
|
339
|
+
getStorage(): GatherStorage<Row>;
|
|
340
|
+
forEach(fn: (key: keyof HistoryGather<Row>) => void): void;
|
|
341
|
+
/** 创建历史记录区块 */
|
|
342
|
+
createHistory(): void;
|
|
343
|
+
/** 创建历史数据失败 */
|
|
344
|
+
createHistoryError(lastHistoryItem: HistoryGather<Row>['history'][0] | null): void;
|
|
345
|
+
historyClear(): void;
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* @description 历史修改
|
|
349
|
+
* @date 2024-08-09 09:50:19
|
|
350
|
+
* @export
|
|
351
|
+
* @class HistoryEdit
|
|
352
|
+
* @extends {BasicsHistoryStack}
|
|
353
|
+
*/
|
|
354
|
+
export declare class HistoryEdit<Row extends WholeRow> extends BasicsHistoryStack<Row> {
|
|
355
|
+
static RecordResult: typeof RecordResult;
|
|
356
|
+
current: Set<ModifyRecord> | null;
|
|
357
|
+
readonly eventIds: number[];
|
|
358
|
+
readonly tableInstance: ListTable<Row>;
|
|
359
|
+
readonly cellEditStyle: CellEditStyle<Row>;
|
|
360
|
+
readonly options?: HistoryEditOptions;
|
|
361
|
+
/** 手动记录中 */
|
|
362
|
+
private manualRecording;
|
|
363
|
+
/** 自动记录 */
|
|
364
|
+
private autoRecording;
|
|
365
|
+
/** 自动记录结束后的结果 */
|
|
366
|
+
private autoRecordEnd;
|
|
367
|
+
/** 初始数据映射 */
|
|
368
|
+
private readonly originalRecords;
|
|
369
|
+
modifyManage: ModifyManage<Row>;
|
|
370
|
+
constructor({ tableInstance, options }: {
|
|
371
|
+
tableInstance: ListTable<Row>;
|
|
372
|
+
options?: HistoryEditOptions;
|
|
373
|
+
});
|
|
374
|
+
get isModifyMark(): boolean;
|
|
375
|
+
setRecords(records: typeof this.tableInstance.records): void;
|
|
376
|
+
/** 记录修改 */
|
|
377
|
+
recording(fn: (param: {
|
|
378
|
+
recordOperation: <T extends keyof OtherHistory<Row>>(key: T, value: OtherHistory<Row>[T][0]) => void;
|
|
379
|
+
}) => RecordResult | void, extra?: {
|
|
380
|
+
isUpdateStyles?: boolean;
|
|
381
|
+
}): void;
|
|
382
|
+
autoRecordChangeValue(args: ModifyRecord): void;
|
|
383
|
+
private switchHistory;
|
|
384
|
+
insertData({ row, dataList }: InsertInfo): void;
|
|
385
|
+
deleteData(param: {
|
|
386
|
+
row: number;
|
|
387
|
+
data: any;
|
|
388
|
+
}[]): void;
|
|
389
|
+
/** 前进 */
|
|
390
|
+
forward(): Set<{
|
|
391
|
+
col: number;
|
|
392
|
+
row: number;
|
|
393
|
+
rawValue: string | number;
|
|
394
|
+
currentValue: string | number;
|
|
395
|
+
changedValue: string | number;
|
|
396
|
+
}> | null;
|
|
397
|
+
/** 后退 */
|
|
398
|
+
backward(): Set<{
|
|
399
|
+
col: number;
|
|
400
|
+
row: number;
|
|
401
|
+
rawValue: string | number;
|
|
402
|
+
currentValue: string | number;
|
|
403
|
+
changedValue: string | number;
|
|
404
|
+
}> | null;
|
|
405
|
+
/** 取消 */
|
|
406
|
+
cancel(): void;
|
|
407
|
+
/** 保存 */
|
|
408
|
+
save(course: (saveData: TableModifyInfo) => Promise<this['tableInstance']['records'] | void>): Promise<void>;
|
|
409
|
+
/** 清除事件 */
|
|
410
|
+
clearEvents(): void;
|
|
411
|
+
/** 清除历史记录 */
|
|
412
|
+
clear(): void;
|
|
413
|
+
/** 获取修改的记录 */
|
|
414
|
+
private getModifiedRecord;
|
|
415
|
+
private modifyMarkAmend;
|
|
416
|
+
getTableModifyInfo(): {
|
|
417
|
+
updateRecords: {
|
|
418
|
+
recordIdx: number;
|
|
419
|
+
id: string;
|
|
420
|
+
data: Partial<Row>;
|
|
421
|
+
}[];
|
|
422
|
+
deleteRecords: string[];
|
|
423
|
+
createRecords: {
|
|
424
|
+
recordIdx: number;
|
|
425
|
+
id: string;
|
|
426
|
+
data: Partial<Row>;
|
|
427
|
+
}[];
|
|
428
|
+
sortedRecords: {
|
|
429
|
+
oldIndex: number;
|
|
430
|
+
index: number;
|
|
431
|
+
}[];
|
|
432
|
+
};
|
|
433
|
+
private updateTableStyle;
|
|
434
|
+
}
|
|
435
|
+
export { RecordType };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { generateFillHandle } from './fill-handle';
|
|
2
|
+
export { rightClickMenu } from './right-click-menu';
|
|
3
|
+
export { VTableFeatureUtils } from './utils';
|
|
4
|
+
export { generateTooltip } from './tooltip';
|
|
5
|
+
export { HistoryEdit } from './history-edit';
|
|
6
|
+
export { customMergeCell, getRowTree, getGroupOptions } from './customMergeCell';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { default as VTable } from '@visactor/vtable';
|
|
2
|
+
import { DropDownMenuEventArgs } from '@visactor/vtable/es/ts-types';
|
|
3
|
+
import { ListTable } from '../ListTable';
|
|
4
|
+
import { WholeRow } from './types';
|
|
5
|
+
interface GenerateDropDownMenuParams<Row extends WholeRow> {
|
|
6
|
+
tableInstance: ListTable<Row>;
|
|
7
|
+
}
|
|
8
|
+
declare function generateDropDownMenu<Row extends WholeRow>({ tableInstance }: {
|
|
9
|
+
tableInstance: ListTable<Row>;
|
|
10
|
+
}): () => void;
|
|
11
|
+
export declare const rightClickMenu: {
|
|
12
|
+
getCellMenu: (params?: VTable.TYPES.MenuListItem[] | ((field: string, row: number, col: number) => VTable.TYPES.MenuListItem[])) => (field: string, row: number, col: number) => VTable.TYPES.MenuListItem[];
|
|
13
|
+
builtEvent: {
|
|
14
|
+
copy?: (<Row extends WholeRow>(event: DropDownMenuEventArgs, { tableInstance }: GenerateDropDownMenuParams<Row>) => void) | undefined;
|
|
15
|
+
shear?: (<Row extends WholeRow>(event: DropDownMenuEventArgs, { tableInstance }: GenerateDropDownMenuParams<Row>) => void) | undefined;
|
|
16
|
+
paste?: (<Row extends WholeRow>(event: DropDownMenuEventArgs, { tableInstance }: GenerateDropDownMenuParams<Row>) => void) | undefined;
|
|
17
|
+
delete?: (<Row extends WholeRow>(event: DropDownMenuEventArgs, { tableInstance }: GenerateDropDownMenuParams<Row>) => void) | undefined;
|
|
18
|
+
insert_down?: (<Row extends WholeRow>(event: DropDownMenuEventArgs, { tableInstance }: GenerateDropDownMenuParams<Row>) => void) | undefined;
|
|
19
|
+
insert_down_empty?: (<Row extends WholeRow>(event: DropDownMenuEventArgs, { tableInstance }: GenerateDropDownMenuParams<Row>) => void) | undefined;
|
|
20
|
+
delete_row?: (<Row extends WholeRow>(event: DropDownMenuEventArgs, { tableInstance }: GenerateDropDownMenuParams<Row>) => void) | undefined;
|
|
21
|
+
};
|
|
22
|
+
generateDropDownMenu: typeof generateDropDownMenu;
|
|
23
|
+
};
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { CustomCellStyle, CustomCellStyleArrangement } from '@visactor/vtable/es/ts-types';
|
|
2
|
+
import { ListTable } from '../ListTable';
|
|
3
|
+
import { HistoryEditOptions, WholeRow } from './types';
|
|
4
|
+
export declare class CellEditStyle<Row extends WholeRow> {
|
|
5
|
+
readonly tableInstance: ListTable<Row>;
|
|
6
|
+
customCellStyle: CustomCellStyle[];
|
|
7
|
+
customCellStyleArrangement: (CustomCellStyleArrangement & {
|
|
8
|
+
defaultStyle?: boolean;
|
|
9
|
+
})[];
|
|
10
|
+
styles: CustomCellStyle[];
|
|
11
|
+
constructor({ tableInstance, options }: {
|
|
12
|
+
tableInstance: ListTable<Row>;
|
|
13
|
+
options?: HistoryEditOptions;
|
|
14
|
+
});
|
|
15
|
+
updateCellStyles(arrangement: CustomCellStyleArrangement[]): void;
|
|
16
|
+
clearAllCellStyles(): void;
|
|
17
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ListTable } from '../ListTable';
|
|
2
|
+
import { OnChainVTableProps } from '../type';
|
|
3
|
+
import { WholeRow } from './types';
|
|
4
|
+
/** 关闭自定义提示弹窗 */
|
|
5
|
+
export declare function closeCustomTooltip(): void;
|
|
6
|
+
/**
|
|
7
|
+
* 生成填充事件
|
|
8
|
+
*/
|
|
9
|
+
export declare function generateTooltip<Row extends WholeRow>(tableInstance: ListTable<Row>, tooltip?: OnChainVTableProps<Row>['tooltip']): () => void;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { default as VTable } from '@visactor/vtable';
|
|
2
|
+
import { TooltipOptions } from '@visactor/vtable/es/ts-types/tooltip';
|
|
3
|
+
import { Placement } from '../const';
|
|
4
|
+
import { ColumnStyleOption } from '@visactor/vtable/es/ts-types';
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
// ** tooltip.ts -------------------------------------------
|
|
8
|
+
export type VTableTooltipOptions = Omit<TooltipOptions, 'content' | 'position' | 'referencePosition' | 'style'> & {
|
|
9
|
+
format?: (cellInfo: Omit<VTable.TYPES.MousePointerCellEvent, 'target'> & { targetText?: string }) => string;
|
|
10
|
+
template?: (cellInfo: Omit<VTable.TYPES.MousePointerCellEvent, 'target'> & { targetText?: string }) => React.ReactNode;
|
|
11
|
+
referencePosition?: {
|
|
12
|
+
placement?: Placement;
|
|
13
|
+
};
|
|
14
|
+
style?: {
|
|
15
|
+
bgColor?: string;
|
|
16
|
+
fontSize?: number;
|
|
17
|
+
fontFamily?: string;
|
|
18
|
+
color?: string;
|
|
19
|
+
padding?: number[];
|
|
20
|
+
maxWidth?: number;
|
|
21
|
+
maxHeight?: number;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
// ** history-edit.ts -------------------------------------------
|
|
26
|
+
export interface HistoryEditOptions {
|
|
27
|
+
modifyMark?: boolean;
|
|
28
|
+
modifyMarkStyle?: {
|
|
29
|
+
delete?: ColumnStyleOption;
|
|
30
|
+
update?: ColumnStyleOption;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export type WholeRow = Record<string, any> & { __type?: 'title' | 'button' | 'empty' };
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { default as VTable } from '@visactor/vtable';
|
|
2
|
+
import { ListTable } from '../ListTable';
|
|
3
|
+
import { BaseTableAPI } from '@visactor/vtable/es/ts-types/base-table';
|
|
4
|
+
import { CellAddress, TableEventHandlersEventArgumentMap } from '@visactor/vtable/es/ts-types';
|
|
5
|
+
import { RecordType, RightClickMenuKey } from '../const';
|
|
6
|
+
import { WholeRow } from './types';
|
|
7
|
+
export declare class VTableFeatureUtils {
|
|
8
|
+
static isValid(value: any): boolean;
|
|
9
|
+
/** 获取选中表格的值 */
|
|
10
|
+
static getSelectedCellValue<Row extends WholeRow>({ tableInstance, selectCells, filter, }: {
|
|
11
|
+
tableInstance: ListTable<Row>;
|
|
12
|
+
filter?: (cellInfo: VTable.TYPES.CellInfo) => boolean;
|
|
13
|
+
selectCells?: VTable.TYPES.CellInfo[][];
|
|
14
|
+
}): any[][];
|
|
15
|
+
/** 将选中单元格的值设置为空 */
|
|
16
|
+
static deleteSelectRange<Row extends WholeRow>({ selectCells, tableInstance, }: {
|
|
17
|
+
tableInstance: ListTable<Row>;
|
|
18
|
+
selectCells?: VTable.TYPES.CellInfo[][];
|
|
19
|
+
}): VTable.TYPES.CellInfo[][];
|
|
20
|
+
/** 判断单元格col,row是否在选中范围中 */
|
|
21
|
+
static cellIsSelectRange<Row extends WholeRow>({ tableInstance, row, col, selectCells, }: {
|
|
22
|
+
selectCells?: VTable.TYPES.CellInfo[][];
|
|
23
|
+
tableInstance: ListTable<Row>;
|
|
24
|
+
col: number;
|
|
25
|
+
row: number;
|
|
26
|
+
}): boolean;
|
|
27
|
+
/** 合并菜单配置项 */
|
|
28
|
+
static mergeMenu(...menusCollection: (VTable.TYPES.MenuListItem[] | undefined)[]): VTable.TYPES.MenuListItem[];
|
|
29
|
+
/** 删除默认菜单 */
|
|
30
|
+
static deleteDefaultMenu(keys?: RightClickMenuKey[]): VTable.TYPES.MenuListItem[];
|
|
31
|
+
/** 获取 padding */
|
|
32
|
+
static getPadding({ tableApi, row, col, defaultPadding, }: {
|
|
33
|
+
tableApi: BaseTableAPI;
|
|
34
|
+
row: number;
|
|
35
|
+
col: number;
|
|
36
|
+
defaultPadding?: number[];
|
|
37
|
+
}): number | number[] | undefined;
|
|
38
|
+
static getAmendModifyMarkValue({ newValue, oldValue, hasModifyMark, }: {
|
|
39
|
+
hasModifyMark?: boolean;
|
|
40
|
+
newValue: any;
|
|
41
|
+
oldValue: any;
|
|
42
|
+
}): any;
|
|
43
|
+
/**
|
|
44
|
+
* @description 无感知更新数据,不会触发 HistoryEdit 捕获
|
|
45
|
+
* @document 示例如下:
|
|
46
|
+
* ```ts
|
|
47
|
+
* modified.map((record) => {
|
|
48
|
+
* insensitiveChangeValue(record)
|
|
49
|
+
* this.tableInstance.scenegraph.updateCellContent(record.col, record.row)
|
|
50
|
+
* })
|
|
51
|
+
* this.tableInstance.scenegraph.renderSceneGraph();
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
static insensitiveChangeValue<Row extends WholeRow>({ tableInstance, col, row, value, renderColl, }: {
|
|
55
|
+
tableInstance: ListTable<Row>;
|
|
56
|
+
col: number;
|
|
57
|
+
row: number;
|
|
58
|
+
value: any;
|
|
59
|
+
renderColl?: boolean;
|
|
60
|
+
}): void;
|
|
61
|
+
/**
|
|
62
|
+
* @description 自动更新单元格宽高
|
|
63
|
+
*/
|
|
64
|
+
static autoUpdateCellWidthHeight<Row extends WholeRow>({ tableInstance, col, row, }: {
|
|
65
|
+
tableInstance: ListTable<Row>;
|
|
66
|
+
col: number;
|
|
67
|
+
row: number;
|
|
68
|
+
}): void;
|
|
69
|
+
/** 获取修改记录类型 */
|
|
70
|
+
static getModifyRecordType(param: TableEventHandlersEventArgumentMap['change_cell_value']): RecordType;
|
|
71
|
+
static getCellModify<Row extends WholeRow>(param: {
|
|
72
|
+
tableInstance: ListTable<Row>;
|
|
73
|
+
} & CellAddress): import('./history-edit').BasicsCellModify<Row> | undefined;
|
|
74
|
+
static isEmptyValue(value: any): any;
|
|
75
|
+
static getRowRecordIdx<Row extends WholeRow>(param: {
|
|
76
|
+
tableInstance: ListTable<Row>;
|
|
77
|
+
row: number;
|
|
78
|
+
}): {
|
|
79
|
+
hasHeader: boolean;
|
|
80
|
+
recordIdx: number;
|
|
81
|
+
};
|
|
82
|
+
static getColumnIdx<Row extends WholeRow>(param: {
|
|
83
|
+
tableInstance: ListTable<Row>;
|
|
84
|
+
col: number;
|
|
85
|
+
}): {
|
|
86
|
+
hasNumberColumn: boolean;
|
|
87
|
+
columnIdx: number;
|
|
88
|
+
};
|
|
89
|
+
static getCellAddressByIndex<Row extends WholeRow>(param: {
|
|
90
|
+
tableInstance: ListTable<Row>;
|
|
91
|
+
colIdx: number;
|
|
92
|
+
rowIdx: number;
|
|
93
|
+
}): {
|
|
94
|
+
hasHeader: boolean;
|
|
95
|
+
hasNumberColumn: boolean;
|
|
96
|
+
col: number;
|
|
97
|
+
row: number;
|
|
98
|
+
};
|
|
99
|
+
/** 获取冻结的 column rowData 及其所占用的空间 */
|
|
100
|
+
static getFrozenLayout<Row extends WholeRow>(param: {
|
|
101
|
+
tableInstance: ListTable<Row>;
|
|
102
|
+
}): {
|
|
103
|
+
leftFixedColumn: (VTable.TYPES.ColumnDefine | null)[];
|
|
104
|
+
rightFixedColumn: VTable.TYPES.ColumnsDefine;
|
|
105
|
+
topFixedRow: (Row | null)[];
|
|
106
|
+
bottomFixedRow: Row[];
|
|
107
|
+
top: any;
|
|
108
|
+
left: any;
|
|
109
|
+
right: any;
|
|
110
|
+
bottom: any;
|
|
111
|
+
};
|
|
112
|
+
/** 获取表格布局(cover: 覆盖边框 | inside:不覆盖边框) */
|
|
113
|
+
static getFixCellLayout<Row extends WholeRow>({ type, tableInstance, col, row, rect, borderWidth, }: {
|
|
114
|
+
tableInstance: ListTable<Row>;
|
|
115
|
+
rect: {
|
|
116
|
+
top: number;
|
|
117
|
+
left: number;
|
|
118
|
+
width: number;
|
|
119
|
+
height: number;
|
|
120
|
+
};
|
|
121
|
+
type: 'cover' | 'inside';
|
|
122
|
+
borderWidth?: number;
|
|
123
|
+
} & CellAddress): {
|
|
124
|
+
top: number;
|
|
125
|
+
left: number;
|
|
126
|
+
width: number;
|
|
127
|
+
height: number;
|
|
128
|
+
};
|
|
129
|
+
static getMergeType<Row extends WholeRow>(record: Row): {
|
|
130
|
+
isEmpty: boolean;
|
|
131
|
+
isButton: boolean;
|
|
132
|
+
isTitle: boolean;
|
|
133
|
+
};
|
|
134
|
+
/** 是否是分组列表的合并行 */
|
|
135
|
+
static isGroupMergeCell<Row extends WholeRow>(param: {
|
|
136
|
+
tableInstance: ListTable<Row>;
|
|
137
|
+
} & CellAddress, callback?: (param: {
|
|
138
|
+
record?: Row;
|
|
139
|
+
isGroupMergeCell: boolean;
|
|
140
|
+
}) => void): boolean;
|
|
141
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { OnChainVTableProps } from './type';
|
|
3
|
+
import { WholeRow } from './feature/types';
|
|
4
|
+
type ParametersOne<T extends (args: any) => any> = T extends (args: infer P) => any ? P : never;
|
|
5
|
+
declare const OnChainVTable: <Row extends WholeRow>(props: ParametersOne<React.FC<OnChainVTableProps<Row>>>) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export default OnChainVTable;
|