@univerjs/sheets-ui 0.5.4-nightly.202501171606 → 0.5.4-nightly.202501181605

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.
@@ -48,17 +48,6 @@ export declare function getSetCellValueMutations(pasteTo: ISheetDiscreteRangeLoc
48
48
  undos: IMutationInfo<object>[];
49
49
  redos: IMutationInfo<object>[];
50
50
  };
51
- /**
52
- *
53
- * @param pasteTo
54
- * @param pasteFrom
55
- * @param matrix
56
- * @param accessor
57
- */
58
- export declare function getSetCellCustomMutations(pasteTo: ISheetDiscreteRangeLocation, pasteFrom: Nullable<ISheetDiscreteRangeLocation>, matrix: ObjectMatrix<ICellDataWithSpanInfo>, accessor: IAccessor): {
59
- undos: IMutationInfo<object>[];
60
- redos: IMutationInfo<object>[];
61
- };
62
51
  /**
63
52
  *
64
53
  * @param pasteTo
@@ -106,3 +106,8 @@ export declare function getAutoFillRepeatRange(sourceRange: IRange, targetRange:
106
106
  * @returns
107
107
  */
108
108
  export declare function needsUpdateCellValue(cell: ICellData): boolean;
109
+ /**
110
+ * Remove cell.custom
111
+ * @param cell
112
+ */
113
+ export declare function removeCellCustom(cell: Nullable<ICellData>): void;
@@ -56,20 +56,36 @@ export interface ISpecialPasteInfo {
56
56
  /**
57
57
  * `ClipboardHook` could:
58
58
  * 1. Before copy/cut/paste, decide whether to execute the command and prepare caches if necessary.
59
- * 1. When copying, decide what content could be written into clipboard.
60
- * 1. When pasting, get access to the clipboard content and append mutations to the paste command.
59
+ * 2. When copying, decide what content could be written into clipboard.
60
+ * 3. When pasting, get access to the clipboard content and append mutations to the paste command.
61
61
  */
62
62
  export interface ISheetClipboardHook {
63
+ /**
64
+ * The unique id of the hook.
65
+ */
63
66
  id: string;
67
+ /**
68
+ * Whether this hook is the default hook.
69
+ */
64
70
  isDefaultHook?: boolean;
71
+ /**
72
+ * Only special paste info should be provided, which will replace the default hook.
73
+ */
65
74
  specialPasteInfo?: ISpecialPasteInfo;
75
+ /**
76
+ * The priority of the hook. The higher the priority, the earlier the hook would be called.
77
+ */
66
78
  priority?: number;
67
79
  /**
68
80
  * The callback would be called after the clipboard service has decided what region need to be copied.
69
81
  * Features could use this hook to build copying cache or any other pre-copy jobs.
82
+ * @param unitId
83
+ * @param subUnitId
84
+ * @param range
70
85
  */
71
86
  onBeforeCopy?(unitId: string, subUnitId: string, range: IRange): void;
72
87
  /**
88
+ * Properties that would be appended to the td element.
73
89
  *
74
90
  * @param row
75
91
  * @param col
@@ -82,16 +98,21 @@ export interface ISheetClipboardHook {
82
98
  * @deprecated should be merged with `onCopyCellContent` to `onCopyCell`
83
99
  * @param row row of the the copied cell
84
100
  * @param col col of the the copied cell
101
+ * @param rowSpan row span of the the copied cell
102
+ * @param colSpan col span of the the copied cell
103
+ * @return content
85
104
  */
86
105
  onCopyCellStyle?(row: number, col: number, rowSpan?: number, colSpan?: number): IClipboardPropertyItem | null;
87
106
  /**
88
107
  * Properties that would be appended to the tr element.
89
108
  * @param row each row of the the copied range
109
+ * @return content
90
110
  */
91
111
  onCopyRow?(row: number): IClipboardPropertyItem | null;
92
112
  /**
93
113
  * Properties that would be appended to the col element.
94
114
  * @param col each col of the copied range
115
+ * @return content
95
116
  */
96
117
  onCopyColumn?(col: number): IClipboardPropertyItem | null;
97
118
  /**
@@ -103,30 +124,65 @@ export interface ISheetClipboardHook {
103
124
  * The callback would be called after the clipboard service has decided what region need to be pasted.
104
125
  * Features could use this hook to build copying cache or any other pre-copy jobs.
105
126
  *
127
+ * @param pasteTo
106
128
  * @returns if it block copying it should return false
107
129
  */
108
130
  onBeforePaste?(pasteTo: ISheetDiscreteRangeLocation): boolean;
109
131
  /**
132
+ * Handles pasting cells, it needs to return Undo Mutations & Redo Mutations that handle the cell contents
110
133
  *
111
- * @param row
112
- * @param col
134
+ * @param pasteFrom
135
+ * @param pasteTo
136
+ * @param data
137
+ * @param payload
138
+ * @returns undo and redo mutations
113
139
  */
114
140
  onPasteCells?(pasteFrom: ISheetDiscreteRangeLocation | null, pasteTo: ISheetDiscreteRangeLocation, data: ObjectMatrix<ICellDataWithSpanInfo>, payload: ICopyPastePayload): {
115
141
  undos: IMutationInfo[];
116
142
  redos: IMutationInfo[];
117
143
  };
144
+ /**
145
+ * Handle the pasted row properties, it needs to return the Undo Mutations & Redo Mutations that handle the row properties
146
+ *
147
+ * @param pasteTo
148
+ * @param rowProperties
149
+ * @param payload
150
+ * @returns undo and redo mutations
151
+ */
118
152
  onPasteRows?(pasteTo: ISheetDiscreteRangeLocation, rowProperties: IClipboardPropertyItem[], payload: ICopyPastePayload): {
119
153
  undos: IMutationInfo[];
120
154
  redos: IMutationInfo[];
121
155
  };
156
+ /**
157
+ * Handle the pasted column properties, it needs to return the Undo Mutations & Redo Mutations that handle the column properties
158
+ *
159
+ * @param pasteTo
160
+ * @param colProperties
161
+ * @param payload
162
+ * @returns undo and redo mutations
163
+ */
122
164
  onPasteColumns?(pasteTo: ISheetDiscreteRangeLocation, colProperties: IClipboardPropertyItem[], payload: ICopyPastePayload): {
123
165
  undos: IMutationInfo[];
124
166
  redos: IMutationInfo[];
125
167
  };
168
+ /**
169
+ * Hanle the pasted plain text, it needs to return the Undo Mutations & Redo Mutations that handle the plain text
170
+ *
171
+ * @param pasteTo
172
+ * @param text
173
+ * @param payload
174
+ * @returns undo and redo mutations
175
+ */
126
176
  onPastePlainText?(pasteTo: ISheetDiscreteRangeLocation, text: string, payload: ICopyPastePayload): {
127
177
  undos: IMutationInfo[];
128
178
  redos: IMutationInfo[];
129
179
  };
180
+ /**
181
+ * Would be called after paste content has been written into Univer.
182
+ * Features could do some cleaning up jobs here.
183
+ *
184
+ * @param success whether the paste operation is successful
185
+ */
130
186
  onAfterPaste?(success: boolean): void;
131
187
  /**
132
188
  * The callback would be called before the clipboard service decides what region need to be copied from or pasted to.