@worktile/theia 14.3.17 → 14.3.18
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/esm2020/plugins/table/components/toolbar/table-toolbar.component.mjs +12 -13
- package/esm2020/plugins/table/transforms/insert-column.mjs +10 -4
- package/fesm2015/worktile-theia.mjs +20 -15
- package/fesm2015/worktile-theia.mjs.map +1 -1
- package/fesm2020/worktile-theia.mjs +20 -15
- package/fesm2020/worktile-theia.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -4195,12 +4195,18 @@ getCell) {
|
|
|
4195
4195
|
});
|
|
4196
4196
|
});
|
|
4197
4197
|
}
|
|
4198
|
+
const theTableWrapper = AngularEditor.toDOMNode(editor, table).querySelector('.the-table-wrapper');
|
|
4199
|
+
const scrollWidth = theTableWrapper.scrollWidth;
|
|
4200
|
+
const clientWidth = theTableWrapper.clientWidth;
|
|
4201
|
+
const columnLength = table?.children[0].children.length;
|
|
4202
|
+
const columnWidth = clientWidth / (columnLength + 1);
|
|
4198
4203
|
if (table?.columns) {
|
|
4199
|
-
const theTableWrapper = AngularEditor.toDOMNode(editor, table).querySelector('.the-table-wrapper');
|
|
4200
|
-
const scrollWidth = theTableWrapper.scrollWidth;
|
|
4201
|
-
const clientWidth = theTableWrapper.clientWidth;
|
|
4202
4204
|
Transforms.setNodes(editor, { columns: addColumns(table, table.columns.length + 1, insertColumnIndex, scrollWidth > clientWidth) }, { at: tableEntry[1] });
|
|
4203
4205
|
}
|
|
4206
|
+
else if (columnWidth < opts.minWidthPx) {
|
|
4207
|
+
const columns = Array(columnLength + 1).fill({ width: opts.minWidthPx });
|
|
4208
|
+
Transforms.setNodes(editor, { columns }, { at: tableEntry[1] });
|
|
4209
|
+
}
|
|
4204
4210
|
});
|
|
4205
4211
|
}
|
|
4206
4212
|
/**
|
|
@@ -12179,18 +12185,6 @@ class TheTableToolbarComponent {
|
|
|
12179
12185
|
setDeleteIcon() {
|
|
12180
12186
|
const { selectedCells, selectedRowsIndex, selectedColumnsIndex, createTablePosition } = this.tableStore;
|
|
12181
12187
|
const pos = createTablePosition();
|
|
12182
|
-
// 满足已选中整行或者整列
|
|
12183
|
-
const isSelectedWholeRowOrColumnCell = selectedRowsIndex.length * pos.getWidth() === selectedCells.length ||
|
|
12184
|
-
selectedColumnsIndex.length * pos.getHeight() === selectedCells.length;
|
|
12185
|
-
if (!isSelectedWholeRowOrColumnCell) {
|
|
12186
|
-
this.deleteIcon = null;
|
|
12187
|
-
this.iconName = null;
|
|
12188
|
-
return;
|
|
12189
|
-
}
|
|
12190
|
-
if (this.tableStore.isSelectedTable) {
|
|
12191
|
-
this.deleteIcon = DeleteIcon.trash;
|
|
12192
|
-
this.iconName = '删除表格';
|
|
12193
|
-
}
|
|
12194
12188
|
if (this.tableStore.selectedRowsIndex.length > 0) {
|
|
12195
12189
|
this.deleteIcon = DeleteIcon['table-delete-rows'];
|
|
12196
12190
|
this.iconName = '删除整行';
|
|
@@ -12199,6 +12193,17 @@ class TheTableToolbarComponent {
|
|
|
12199
12193
|
this.deleteIcon = DeleteIcon['table-delete-columns'];
|
|
12200
12194
|
this.iconName = '删除整列';
|
|
12201
12195
|
}
|
|
12196
|
+
if (this.tableStore.isSelectedTable) {
|
|
12197
|
+
this.deleteIcon = DeleteIcon.trash;
|
|
12198
|
+
this.iconName = '删除表格';
|
|
12199
|
+
}
|
|
12200
|
+
// 满足已选中整行或者整列
|
|
12201
|
+
const isSelectedWholeRowOrColumnCell = selectedRowsIndex.length * pos.getWidth() === selectedCells.length ||
|
|
12202
|
+
selectedColumnsIndex.length * pos.getHeight() === selectedCells.length;
|
|
12203
|
+
if (!isSelectedWholeRowOrColumnCell) {
|
|
12204
|
+
this.deleteIcon = null;
|
|
12205
|
+
this.iconName = null;
|
|
12206
|
+
}
|
|
12202
12207
|
}
|
|
12203
12208
|
onDelete(event) {
|
|
12204
12209
|
event.preventDefault();
|