@kerebron/extension-tables 0.4.27 → 0.4.29
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/esm/ExtensionTables.d.ts +10 -0
- package/esm/ExtensionTables.d.ts.map +1 -0
- package/esm/ExtensionTables.js +15 -0
- package/esm/ExtensionTables.js.map +1 -0
- package/esm/NodeTable.d.ts +19 -0
- package/esm/NodeTable.d.ts.map +1 -0
- package/esm/NodeTable.js +84 -0
- package/esm/NodeTable.js.map +1 -0
- package/esm/NodeTableCell.d.ts +11 -0
- package/esm/NodeTableCell.d.ts.map +1 -0
- package/esm/NodeTableCell.js +54 -0
- package/esm/NodeTableCell.js.map +1 -0
- package/esm/NodeTableHeader.d.ts +8 -0
- package/esm/NodeTableHeader.d.ts.map +1 -0
- package/esm/NodeTableHeader.js +44 -0
- package/esm/NodeTableHeader.js.map +1 -0
- package/esm/NodeTableRow.d.ts +11 -0
- package/esm/NodeTableRow.d.ts.map +1 -0
- package/esm/NodeTableRow.js +24 -0
- package/esm/NodeTableRow.js.map +1 -0
- package/esm/_dnt.shims.d.ts +2 -0
- package/esm/_dnt.shims.d.ts.map +1 -0
- package/esm/_dnt.shims.js +58 -0
- package/esm/_dnt.shims.js.map +1 -0
- package/esm/package.json +3 -0
- package/esm/utilities/CellSelection.d.ts +53 -0
- package/esm/utilities/CellSelection.d.ts.map +1 -0
- package/esm/utilities/CellSelection.js +365 -0
- package/esm/utilities/CellSelection.js.map +1 -0
- package/esm/utilities/TableMap.d.ts +92 -0
- package/esm/utilities/TableMap.d.ts.map +1 -0
- package/esm/utilities/TableMap.js +320 -0
- package/esm/utilities/TableMap.js.map +1 -0
- package/esm/utilities/TableView.d.ts +21 -0
- package/esm/utilities/TableView.d.ts.map +1 -0
- package/esm/utilities/TableView.js +81 -0
- package/esm/utilities/TableView.js.map +1 -0
- package/esm/utilities/columnResizing.d.ts +50 -0
- package/esm/utilities/columnResizing.d.ts.map +1 -0
- package/esm/utilities/columnResizing.js +300 -0
- package/esm/utilities/columnResizing.js.map +1 -0
- package/esm/utilities/commands.d.ts +164 -0
- package/esm/utilities/commands.d.ts.map +1 -0
- package/esm/utilities/commands.js +703 -0
- package/esm/utilities/commands.js.map +1 -0
- package/esm/utilities/copypaste.d.ts +35 -0
- package/esm/utilities/copypaste.d.ts.map +1 -0
- package/esm/utilities/copypaste.js +284 -0
- package/esm/utilities/copypaste.js.map +1 -0
- package/esm/utilities/createCell.d.ts +3 -0
- package/esm/utilities/createCell.d.ts.map +1 -0
- package/esm/utilities/createCell.js +7 -0
- package/esm/utilities/createCell.js.map +1 -0
- package/esm/utilities/createTable.d.ts +3 -0
- package/esm/utilities/createTable.d.ts.map +1 -0
- package/esm/utilities/createTable.js +32 -0
- package/esm/utilities/createTable.js.map +1 -0
- package/esm/utilities/fixTables.d.ts +20 -0
- package/esm/utilities/fixTables.d.ts.map +1 -0
- package/esm/utilities/fixTables.js +147 -0
- package/esm/utilities/fixTables.js.map +1 -0
- package/esm/utilities/getTableNodeTypes.d.ts +5 -0
- package/esm/utilities/getTableNodeTypes.d.ts.map +1 -0
- package/esm/utilities/getTableNodeTypes.js +15 -0
- package/esm/utilities/getTableNodeTypes.js.map +1 -0
- package/esm/utilities/input.d.ts +21 -0
- package/esm/utilities/input.d.ts.map +1 -0
- package/esm/utilities/input.js +242 -0
- package/esm/utilities/input.js.map +1 -0
- package/esm/utilities/tableEditing.d.ts +23 -0
- package/esm/utilities/tableEditing.d.ts.map +1 -0
- package/esm/utilities/tableEditing.js +64 -0
- package/esm/utilities/tableEditing.js.map +1 -0
- package/esm/utilities/tableNodeTypes.d.ts +14 -0
- package/esm/utilities/tableNodeTypes.d.ts.map +1 -0
- package/esm/utilities/tableNodeTypes.js +17 -0
- package/esm/utilities/tableNodeTypes.js.map +1 -0
- package/esm/utilities/util.d.ts +73 -0
- package/esm/utilities/util.d.ts.map +1 -0
- package/esm/utilities/util.js +156 -0
- package/esm/utilities/util.js.map +1 -0
- package/package.json +6 -3
- package/src/ExtensionTables.ts +16 -0
- package/src/NodeTable.ts +139 -0
- package/src/NodeTableCell.ts +70 -0
- package/src/NodeTableHeader.ts +49 -0
- package/src/NodeTableRow.ts +41 -0
- package/src/_dnt.shims.ts +60 -0
- package/src/utilities/CellSelection.ts +477 -0
- package/src/utilities/TableMap.ts +392 -0
- package/src/utilities/TableView.ts +102 -0
- package/src/utilities/columnResizing.ts +437 -0
- package/src/utilities/commands.ts +896 -0
- package/src/utilities/copypaste.ts +394 -0
- package/src/utilities/createCell.ts +12 -0
- package/src/utilities/createTable.ts +53 -0
- package/src/utilities/fixTables.ts +156 -0
- package/src/utilities/getTableNodeTypes.ts +21 -0
- package/src/utilities/input.ts +299 -0
- package/src/utilities/tableEditing.ts +90 -0
- package/src/utilities/tableNodeTypes.ts +32 -0
- package/src/utilities/util.ts +204 -0
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
let readFromCache;
|
|
2
|
+
let addToCache;
|
|
3
|
+
// Prefer using a weak map to cache table maps. Fall back on a
|
|
4
|
+
// fixed-size cache if that's not supported.
|
|
5
|
+
if (typeof WeakMap != 'undefined') {
|
|
6
|
+
// eslint-disable-next-line
|
|
7
|
+
const cache = new WeakMap();
|
|
8
|
+
readFromCache = (key) => cache.get(key);
|
|
9
|
+
addToCache = (key, value) => {
|
|
10
|
+
cache.set(key, value);
|
|
11
|
+
return value;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
const cache = [];
|
|
16
|
+
const cacheSize = 10;
|
|
17
|
+
let cachePos = 0;
|
|
18
|
+
readFromCache = (key) => {
|
|
19
|
+
for (let i = 0; i < cache.length; i += 2) {
|
|
20
|
+
if (cache[i] == key)
|
|
21
|
+
return cache[i + 1];
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
addToCache = (key, value) => {
|
|
25
|
+
if (cachePos == cacheSize)
|
|
26
|
+
cachePos = 0;
|
|
27
|
+
cache[cachePos++] = key;
|
|
28
|
+
return (cache[cachePos++] = value);
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* A table map describes the structure of a given table. To avoid
|
|
33
|
+
* recomputing them all the time, they are cached per table node. To
|
|
34
|
+
* be able to do that, positions saved in the map are relative to the
|
|
35
|
+
* start of the table, rather than the start of the document.
|
|
36
|
+
*
|
|
37
|
+
* @public
|
|
38
|
+
*/
|
|
39
|
+
export class TableMap {
|
|
40
|
+
width;
|
|
41
|
+
height;
|
|
42
|
+
map;
|
|
43
|
+
problems;
|
|
44
|
+
constructor(
|
|
45
|
+
/**
|
|
46
|
+
* The number of columns
|
|
47
|
+
*/
|
|
48
|
+
width,
|
|
49
|
+
/**
|
|
50
|
+
* The number of rows
|
|
51
|
+
*/
|
|
52
|
+
height,
|
|
53
|
+
/**
|
|
54
|
+
* A width * height array with the start position of
|
|
55
|
+
* the cell covering that part of the table in each slot
|
|
56
|
+
*/
|
|
57
|
+
map,
|
|
58
|
+
/**
|
|
59
|
+
* An optional array of problems (cell overlap or non-rectangular
|
|
60
|
+
* shape) for the table, used by the table normalizer.
|
|
61
|
+
*/
|
|
62
|
+
problems) {
|
|
63
|
+
this.width = width;
|
|
64
|
+
this.height = height;
|
|
65
|
+
this.map = map;
|
|
66
|
+
this.problems = problems;
|
|
67
|
+
}
|
|
68
|
+
// Find the dimensions of the cell at the given position.
|
|
69
|
+
findCell(pos) {
|
|
70
|
+
for (let i = 0; i < this.map.length; i++) {
|
|
71
|
+
const curPos = this.map[i];
|
|
72
|
+
if (curPos != pos)
|
|
73
|
+
continue;
|
|
74
|
+
const left = i % this.width;
|
|
75
|
+
const top = (i / this.width) | 0;
|
|
76
|
+
let right = left + 1;
|
|
77
|
+
let bottom = top + 1;
|
|
78
|
+
for (let j = 1; right < this.width && this.map[i + j] == curPos; j++) {
|
|
79
|
+
right++;
|
|
80
|
+
}
|
|
81
|
+
for (let j = 1; bottom < this.height && this.map[i + this.width * j] == curPos; j++) {
|
|
82
|
+
bottom++;
|
|
83
|
+
}
|
|
84
|
+
return { left, top, right, bottom };
|
|
85
|
+
}
|
|
86
|
+
throw new RangeError(`No cell with offset ${pos} found`);
|
|
87
|
+
}
|
|
88
|
+
// Find the left side of the cell at the given position.
|
|
89
|
+
colCount(pos) {
|
|
90
|
+
for (let i = 0; i < this.map.length; i++) {
|
|
91
|
+
if (this.map[i] == pos) {
|
|
92
|
+
return i % this.width;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
throw new RangeError(`No cell with offset ${pos} found`);
|
|
96
|
+
}
|
|
97
|
+
// Find the next cell in the given direction, starting from the cell
|
|
98
|
+
// at `pos`, if any.
|
|
99
|
+
nextCell(pos, axis, dir) {
|
|
100
|
+
const { left, right, top, bottom } = this.findCell(pos);
|
|
101
|
+
if (axis == 'horiz') {
|
|
102
|
+
if (dir < 0 ? left == 0 : right == this.width)
|
|
103
|
+
return null;
|
|
104
|
+
return this.map[top * this.width + (dir < 0 ? left - 1 : right)];
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
if (dir < 0 ? top == 0 : bottom == this.height)
|
|
108
|
+
return null;
|
|
109
|
+
return this.map[left + this.width * (dir < 0 ? top - 1 : bottom)];
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
// Get the rectangle spanning the two given cells.
|
|
113
|
+
rectBetween(a, b) {
|
|
114
|
+
const { left: leftA, right: rightA, top: topA, bottom: bottomA, } = this.findCell(a);
|
|
115
|
+
const { left: leftB, right: rightB, top: topB, bottom: bottomB, } = this.findCell(b);
|
|
116
|
+
return {
|
|
117
|
+
left: Math.min(leftA, leftB),
|
|
118
|
+
top: Math.min(topA, topB),
|
|
119
|
+
right: Math.max(rightA, rightB),
|
|
120
|
+
bottom: Math.max(bottomA, bottomB),
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
// Return the position of all cells that have the top left corner in
|
|
124
|
+
// the given rectangle.
|
|
125
|
+
cellsInRect(rect) {
|
|
126
|
+
const result = [];
|
|
127
|
+
const seen = {};
|
|
128
|
+
for (let row = rect.top; row < rect.bottom; row++) {
|
|
129
|
+
for (let col = rect.left; col < rect.right; col++) {
|
|
130
|
+
const index = row * this.width + col;
|
|
131
|
+
const pos = this.map[index];
|
|
132
|
+
if (seen[pos])
|
|
133
|
+
continue;
|
|
134
|
+
seen[pos] = true;
|
|
135
|
+
if ((col == rect.left && col && this.map[index - 1] == pos) ||
|
|
136
|
+
(row == rect.top && row && this.map[index - this.width] == pos)) {
|
|
137
|
+
continue;
|
|
138
|
+
}
|
|
139
|
+
result.push(pos);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
return result;
|
|
143
|
+
}
|
|
144
|
+
// Return the position at which the cell at the given row and column
|
|
145
|
+
// starts, or would start, if a cell started there.
|
|
146
|
+
positionAt(row, col, table) {
|
|
147
|
+
for (let i = 0, rowStart = 0;; i++) {
|
|
148
|
+
const rowEnd = rowStart + table.child(i).nodeSize;
|
|
149
|
+
if (i == row) {
|
|
150
|
+
let index = col + row * this.width;
|
|
151
|
+
const rowEndIndex = (row + 1) * this.width;
|
|
152
|
+
// Skip past cells from previous rows (via rowspan)
|
|
153
|
+
while (index < rowEndIndex && this.map[index] < rowStart)
|
|
154
|
+
index++;
|
|
155
|
+
return index == rowEndIndex ? rowEnd - 1 : this.map[index];
|
|
156
|
+
}
|
|
157
|
+
rowStart = rowEnd;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
// Find the table map for the given table node.
|
|
161
|
+
static get(table) {
|
|
162
|
+
return readFromCache(table) || addToCache(table, computeMap(table));
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
// Compute a table map.
|
|
166
|
+
function computeMap(table) {
|
|
167
|
+
if (table.type.spec.tableRole != 'table') {
|
|
168
|
+
throw new RangeError('Not a table node: ' + table.type.name);
|
|
169
|
+
}
|
|
170
|
+
const width = findWidth(table), height = table.childCount;
|
|
171
|
+
const map = [];
|
|
172
|
+
let mapPos = 0;
|
|
173
|
+
let problems = null;
|
|
174
|
+
const colWidths = [];
|
|
175
|
+
for (let i = 0, e = width * height; i < e; i++)
|
|
176
|
+
map[i] = 0;
|
|
177
|
+
for (let row = 0, pos = 0; row < height; row++) {
|
|
178
|
+
const rowNode = table.child(row);
|
|
179
|
+
pos++;
|
|
180
|
+
for (let i = 0;; i++) {
|
|
181
|
+
while (mapPos < map.length && map[mapPos] != 0)
|
|
182
|
+
mapPos++;
|
|
183
|
+
if (i == rowNode.childCount)
|
|
184
|
+
break;
|
|
185
|
+
const cellNode = rowNode.child(i);
|
|
186
|
+
const { colspan, rowspan, colwidth } = cellNode.attrs;
|
|
187
|
+
for (let h = 0; h < rowspan; h++) {
|
|
188
|
+
if (h + row >= height) {
|
|
189
|
+
(problems || (problems = [])).push({
|
|
190
|
+
type: 'overlong_rowspan',
|
|
191
|
+
pos,
|
|
192
|
+
n: rowspan - h,
|
|
193
|
+
});
|
|
194
|
+
break;
|
|
195
|
+
}
|
|
196
|
+
const start = mapPos + h * width;
|
|
197
|
+
for (let w = 0; w < colspan; w++) {
|
|
198
|
+
if (map[start + w] == 0)
|
|
199
|
+
map[start + w] = pos;
|
|
200
|
+
else {
|
|
201
|
+
(problems || (problems = [])).push({
|
|
202
|
+
type: 'collision',
|
|
203
|
+
row,
|
|
204
|
+
pos,
|
|
205
|
+
n: colspan - w,
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
const colW = colwidth && colwidth[w];
|
|
209
|
+
if (colW) {
|
|
210
|
+
const widthIndex = ((start + w) % width) * 2, prev = colWidths[widthIndex];
|
|
211
|
+
if (prev == null ||
|
|
212
|
+
(prev != colW && colWidths[widthIndex + 1] == 1)) {
|
|
213
|
+
colWidths[widthIndex] = colW;
|
|
214
|
+
colWidths[widthIndex + 1] = 1;
|
|
215
|
+
}
|
|
216
|
+
else if (prev == colW) {
|
|
217
|
+
colWidths[widthIndex + 1]++;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
mapPos += colspan;
|
|
223
|
+
pos += cellNode.nodeSize;
|
|
224
|
+
}
|
|
225
|
+
const expectedPos = (row + 1) * width;
|
|
226
|
+
let missing = 0;
|
|
227
|
+
while (mapPos < expectedPos)
|
|
228
|
+
if (map[mapPos++] == 0)
|
|
229
|
+
missing++;
|
|
230
|
+
if (missing) {
|
|
231
|
+
(problems || (problems = [])).push({ type: 'missing', row, n: missing });
|
|
232
|
+
}
|
|
233
|
+
pos++;
|
|
234
|
+
}
|
|
235
|
+
if (width === 0 || height === 0) {
|
|
236
|
+
(problems || (problems = [])).push({ type: 'zero_sized' });
|
|
237
|
+
}
|
|
238
|
+
const tableMap = new TableMap(width, height, map, problems);
|
|
239
|
+
let badWidths = false;
|
|
240
|
+
// For columns that have defined widths, but whose widths disagree
|
|
241
|
+
// between rows, fix up the cells whose width doesn't match the
|
|
242
|
+
// computed one.
|
|
243
|
+
for (let i = 0; !badWidths && i < colWidths.length; i += 2) {
|
|
244
|
+
if (colWidths[i] != null && colWidths[i + 1] < height)
|
|
245
|
+
badWidths = true;
|
|
246
|
+
}
|
|
247
|
+
if (badWidths)
|
|
248
|
+
findBadColWidths(tableMap, colWidths, table);
|
|
249
|
+
return tableMap;
|
|
250
|
+
}
|
|
251
|
+
function findWidth(table) {
|
|
252
|
+
let width = -1;
|
|
253
|
+
let hasRowSpan = false;
|
|
254
|
+
for (let row = 0; row < table.childCount; row++) {
|
|
255
|
+
const rowNode = table.child(row);
|
|
256
|
+
let rowWidth = 0;
|
|
257
|
+
if (hasRowSpan) {
|
|
258
|
+
for (let j = 0; j < row; j++) {
|
|
259
|
+
const prevRow = table.child(j);
|
|
260
|
+
for (let i = 0; i < prevRow.childCount; i++) {
|
|
261
|
+
const cell = prevRow.child(i);
|
|
262
|
+
if (j + cell.attrs.rowspan > row)
|
|
263
|
+
rowWidth += cell.attrs.colspan;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
for (let i = 0; i < rowNode.childCount; i++) {
|
|
268
|
+
const cell = rowNode.child(i);
|
|
269
|
+
rowWidth += cell.attrs.colspan;
|
|
270
|
+
if (cell.attrs.rowspan > 1)
|
|
271
|
+
hasRowSpan = true;
|
|
272
|
+
}
|
|
273
|
+
if (width == -1)
|
|
274
|
+
width = rowWidth;
|
|
275
|
+
else if (width != rowWidth)
|
|
276
|
+
width = Math.max(width, rowWidth);
|
|
277
|
+
}
|
|
278
|
+
return width;
|
|
279
|
+
}
|
|
280
|
+
function findBadColWidths(map, colWidths, table) {
|
|
281
|
+
if (!map.problems)
|
|
282
|
+
map.problems = [];
|
|
283
|
+
const seen = {};
|
|
284
|
+
for (let i = 0; i < map.map.length; i++) {
|
|
285
|
+
const pos = map.map[i];
|
|
286
|
+
if (seen[pos])
|
|
287
|
+
continue;
|
|
288
|
+
seen[pos] = true;
|
|
289
|
+
const node = table.nodeAt(pos);
|
|
290
|
+
if (!node) {
|
|
291
|
+
throw new RangeError(`No cell with offset ${pos} found`);
|
|
292
|
+
}
|
|
293
|
+
let updated = null;
|
|
294
|
+
const attrs = node.attrs;
|
|
295
|
+
for (let j = 0; j < attrs.colspan; j++) {
|
|
296
|
+
const col = (i + j) % map.width;
|
|
297
|
+
const colWidth = colWidths[col * 2];
|
|
298
|
+
if (colWidth != null &&
|
|
299
|
+
(!attrs.colwidth || attrs.colwidth[j] != colWidth)) {
|
|
300
|
+
(updated || (updated = freshColWidth(attrs)))[j] = colWidth;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
if (updated) {
|
|
304
|
+
map.problems.unshift({
|
|
305
|
+
type: 'colwidth mismatch',
|
|
306
|
+
pos,
|
|
307
|
+
colwidth: updated,
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
function freshColWidth(attrs) {
|
|
313
|
+
if (attrs.colwidth)
|
|
314
|
+
return attrs.colwidth.slice();
|
|
315
|
+
const result = [];
|
|
316
|
+
for (let i = 0; i < attrs.colspan; i++)
|
|
317
|
+
result.push(0);
|
|
318
|
+
return result;
|
|
319
|
+
}
|
|
320
|
+
//# sourceMappingURL=TableMap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TableMap.js","sourceRoot":"","sources":["../../src/utilities/TableMap.ts"],"names":[],"mappings":"AA+CA,IAAI,aAAkD,CAAC;AACvD,IAAI,UAAoD,CAAC;AAEzD,8DAA8D;AAC9D,4CAA4C;AAC5C,IAAI,OAAO,OAAO,IAAI,WAAW,EAAE,CAAC;IAClC,2BAA2B;IAC3B,MAAM,KAAK,GAAG,IAAI,OAAO,EAAkB,CAAC;IAC5C,aAAa,GAAG,CAAC,GAAG,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACxC,UAAU,GAAG,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE;QAC1B,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QACtB,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;AACJ,CAAC;KAAM,CAAC;IACN,MAAM,KAAK,GAAwB,EAAE,CAAC;IACtC,MAAM,SAAS,GAAG,EAAE,CAAC;IACrB,IAAI,QAAQ,GAAG,CAAC,CAAC;IACjB,aAAa,GAAG,CAAC,GAAG,EAAE,EAAE;QACtB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;YACzC,IAAI,KAAK,CAAC,CAAC,CAAC,IAAI,GAAG;gBAAE,OAAO,KAAK,CAAC,CAAC,GAAG,CAAC,CAAa,CAAC;QACvD,CAAC;IACH,CAAC,CAAC;IACF,UAAU,GAAG,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE;QAC1B,IAAI,QAAQ,IAAI,SAAS;YAAE,QAAQ,GAAG,CAAC,CAAC;QACxC,KAAK,CAAC,QAAQ,EAAE,CAAC,GAAG,GA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AQ;QAAE,OAAO,KAAK,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;IAClD,MAAM,MAAM,GAAc,EAAE,CAAC;IAC7B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,OAAO,EAAE,CAAC,EAAE;QAAE,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACvD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Node } from 'prosemirror-model';
|
|
2
|
+
import { NodeView, ViewMutationRecord } from 'prosemirror-view';
|
|
3
|
+
/**
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
6
|
+
export declare class TableView implements NodeView {
|
|
7
|
+
node: Node;
|
|
8
|
+
defaultCellMinWidth: number;
|
|
9
|
+
dom: HTMLDivElement;
|
|
10
|
+
table: HTMLTableElement;
|
|
11
|
+
colgroup: HTMLTableColElement;
|
|
12
|
+
contentDOM: HTMLTableSectionElement;
|
|
13
|
+
constructor(node: Node, defaultCellMinWidth: number);
|
|
14
|
+
update(node: Node): boolean;
|
|
15
|
+
ignoreMutation(record: ViewMutationRecord): boolean;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* @public
|
|
19
|
+
*/
|
|
20
|
+
export declare function updateColumnsOnResize(node: Node, colgroup: HTMLTableColElement, table: HTMLTableElement, defaultCellMinWidth: number, overrideCol?: number, overrideValue?: number): void;
|
|
21
|
+
//# sourceMappingURL=TableView.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TableView.d.ts","sourceRoot":"","sources":["../../src/utilities/TableView.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAGhE;;GAEG;AACH,qBAAa,SAAU,YAAW,QAAQ;IAO/B,IAAI,EAAE,IAAI;IACV,mBAAmB,EAAE,MAAM;IAP7B,GAAG,EAAE,cAAc,CAAC;IACpB,KAAK,EAAE,gBAAgB,CAAC;IACxB,QAAQ,EAAE,mBAAmB,CAAC;IAC9B,UAAU,EAAE,uBAAuB,CAAC;gBAGlC,IAAI,EAAE,IAAI,EACV,mBAAmB,EAAE,MAAM;IAcpC,MAAM,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO;IAY3B,cAAc,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO;CAMpD;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,mBAAmB,EAC7B,KAAK,EAAE,gBAAgB,EACvB,mBAAmB,EAAE,MAAM,EAC3B,WAAW,CAAC,EAAE,MAAM,EACpB,aAAa,CAAC,EAAE,MAAM,GACrB,IAAI,CA0CN"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @public
|
|
3
|
+
*/
|
|
4
|
+
export class TableView {
|
|
5
|
+
node;
|
|
6
|
+
defaultCellMinWidth;
|
|
7
|
+
dom;
|
|
8
|
+
table;
|
|
9
|
+
colgroup;
|
|
10
|
+
contentDOM;
|
|
11
|
+
constructor(node, defaultCellMinWidth) {
|
|
12
|
+
this.node = node;
|
|
13
|
+
this.defaultCellMinWidth = defaultCellMinWidth;
|
|
14
|
+
this.dom = document.createElement('div');
|
|
15
|
+
this.dom.className = 'tableWrapper';
|
|
16
|
+
this.table = this.dom.appendChild(document.createElement('table'));
|
|
17
|
+
this.table.style.setProperty('--default-cell-min-width', `${defaultCellMinWidth}px`);
|
|
18
|
+
this.colgroup = this.table.appendChild(document.createElement('colgroup'));
|
|
19
|
+
updateColumnsOnResize(node, this.colgroup, this.table, defaultCellMinWidth);
|
|
20
|
+
this.contentDOM = this.table.appendChild(document.createElement('tbody'));
|
|
21
|
+
}
|
|
22
|
+
update(node) {
|
|
23
|
+
if (node.type != this.node.type)
|
|
24
|
+
return false;
|
|
25
|
+
this.node = node;
|
|
26
|
+
updateColumnsOnResize(node, this.colgroup, this.table, this.defaultCellMinWidth);
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
ignoreMutation(record) {
|
|
30
|
+
return (record.type == 'attributes' &&
|
|
31
|
+
(record.target == this.table || this.colgroup.contains(record.target)));
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* @public
|
|
36
|
+
*/
|
|
37
|
+
export function updateColumnsOnResize(node, colgroup, table, defaultCellMinWidth, overrideCol, overrideValue) {
|
|
38
|
+
let totalWidth = 0;
|
|
39
|
+
let fixedWidth = true;
|
|
40
|
+
let nextDOM = colgroup.firstChild;
|
|
41
|
+
const row = node.firstChild;
|
|
42
|
+
if (!row)
|
|
43
|
+
return;
|
|
44
|
+
for (let i = 0, col = 0; i < row.childCount; i++) {
|
|
45
|
+
const { colspan, colwidth } = row.child(i).attrs;
|
|
46
|
+
for (let j = 0; j < colspan; j++, col++) {
|
|
47
|
+
const hasWidth = overrideCol == col
|
|
48
|
+
? overrideValue
|
|
49
|
+
: colwidth && colwidth[j];
|
|
50
|
+
const cssWidth = hasWidth ? hasWidth + 'px' : '';
|
|
51
|
+
totalWidth += hasWidth || defaultCellMinWidth;
|
|
52
|
+
if (!hasWidth)
|
|
53
|
+
fixedWidth = false;
|
|
54
|
+
if (!nextDOM) {
|
|
55
|
+
const col = document.createElement('col');
|
|
56
|
+
col.style.width = cssWidth;
|
|
57
|
+
colgroup.appendChild(col);
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
if (nextDOM.style.width != cssWidth) {
|
|
61
|
+
nextDOM.style.width = cssWidth;
|
|
62
|
+
}
|
|
63
|
+
nextDOM = nextDOM.nextSibling;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
while (nextDOM) {
|
|
68
|
+
const after = nextDOM.nextSibling;
|
|
69
|
+
nextDOM.parentNode?.removeChild(nextDOM);
|
|
70
|
+
nextDOM = after;
|
|
71
|
+
}
|
|
72
|
+
if (fixedWidth) {
|
|
73
|
+
table.style.width = totalWidth + 'px';
|
|
74
|
+
table.style.minWidth = '';
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
table.style.width = '';
|
|
78
|
+
table.style.minWidth = totalWidth + 'px';
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=TableView.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TableView.js","sourceRoot":"","sources":["../../src/utilities/TableView.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,MAAM,OAAO,SAAS;IAOX;IACA;IAPF,GAAG,CAAiB;IACpB,KAAK,CAAmB;IACxB,QAAQ,CAAsB;IAC9B,UAAU,CAA0B;IAE3C,YACS,IAAU,EACV,mBAA2B;QAD3B,SAAI,GAAJ,IAAI,CAAM;QACV,wBAAmB,GAAnB,mBAAmB,CAAQ;QAElC,IAAI,CAAC,GAAG,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QACzC,IAAI,CAAC,GAAG,CAAC,SAAS,GAAG,cAAc,CAAC;QACpC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC;QACnE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,WAAW,CAC1B,0BAA0B,EAC1B,GAAG,mBAAmB,IAAI,CAC3B,CAAC;QACF,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,QAAQ,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC,CAAC;QAC3E,qBAAqB,CAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,KAAK,EAAE,mBAAmB,CAAC,CAAC;QAC5E,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,WA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AAC;QACvB,KAAK,CAAC,KAAK,CAAC,QAAQ,GAAG,UAAU,GAAG,IAAI,CAAC;IAC3C,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Node as ProsemirrorNode } from 'prosemirror-model';
|
|
2
|
+
import { EditorState, Plugin, PluginKey, Transaction } from 'prosemirror-state';
|
|
3
|
+
import { DecorationSet, EditorView, NodeView } from 'prosemirror-view';
|
|
4
|
+
/**
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export declare const columnResizingPluginKey: PluginKey<ResizeState>;
|
|
8
|
+
/**
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
11
|
+
export type ColumnResizingOptions = {
|
|
12
|
+
handleWidth?: number;
|
|
13
|
+
/**
|
|
14
|
+
* Minimum width of a cell /column. The column cannot be resized smaller than this.
|
|
15
|
+
*/
|
|
16
|
+
cellMinWidth?: number;
|
|
17
|
+
/**
|
|
18
|
+
* The default minWidth of a cell / column when it doesn't have an explicit width (i.e.: it has not been resized manually)
|
|
19
|
+
*/
|
|
20
|
+
defaultCellMinWidth?: number;
|
|
21
|
+
lastColumnResizable?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* A custom node view for the rendering table nodes. By default, the plugin
|
|
24
|
+
* uses the {@link TableView} class. You can explicitly set this to `null` to
|
|
25
|
+
* not use a custom node view.
|
|
26
|
+
*/
|
|
27
|
+
View?: (new (node: ProsemirrorNode, cellMinWidth: number, view: EditorView) => NodeView) | null;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* @public
|
|
31
|
+
*/
|
|
32
|
+
export type Dragging = {
|
|
33
|
+
startX: number;
|
|
34
|
+
startWidth: number;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* @public
|
|
38
|
+
*/
|
|
39
|
+
export declare function columnResizing({ handleWidth, cellMinWidth, defaultCellMinWidth, View, lastColumnResizable, }?: ColumnResizingOptions): Plugin;
|
|
40
|
+
/**
|
|
41
|
+
* @public
|
|
42
|
+
*/
|
|
43
|
+
export declare class ResizeState {
|
|
44
|
+
activeHandle: number;
|
|
45
|
+
dragging: Dragging | false;
|
|
46
|
+
constructor(activeHandle: number, dragging: Dragging | false);
|
|
47
|
+
apply(tr: Transaction): ResizeState;
|
|
48
|
+
}
|
|
49
|
+
export declare function handleDecorations(state: EditorState, cell: number): DecorationSet;
|
|
50
|
+
//# sourceMappingURL=columnResizing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"columnResizing.d.ts","sourceRoot":"","sources":["../../src/utilities/columnResizing.ts"],"names":[],"mappings":"AACA,OAAO,EAAS,IAAI,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChF,OAAO,EAEL,aAAa,EACb,UAAU,EACV,QAAQ,EACT,MAAM,kBAAkB,CAAC;AAM1B;;GAEG;AACH,eAAO,MAAM,uBAAuB,wBAEnC,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;;;OAIG;IACH,IAAI,CAAC,EACD,CAAC,KACD,IAAI,EAAE,eAAe,EACrB,YAAY,EAAE,MAAM,EACpB,IAAI,EAAE,UAAU,KACb,QAAQ,CAAC,GACZ,IAAI,CAAC;CACV,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAAC;AAE9D;;GAEG;AACH,wBAAgB,cAAc,CAAC,EAC7B,WAAe,EACf,YAAiB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