Skip to content

Commit

Permalink
Merge pull request #1975 from VisActor/fix/editorManager-judgement
Browse files Browse the repository at this point in the history
fix: add editorManager judgement
  • Loading branch information
Rui-Sun committed Jun 24, 2024
2 parents 9150f34 + 5978c2b commit 2e3d200
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@visactor/vtable",
"comment": "fix: fix editingEditor missing problem",
"type": "none"
}
],
"packageName": "@visactor/vtable"
}
7 changes: 7 additions & 0 deletions common/config/rush/command-line.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,13 @@
"summary": "Start the document development server",
"description": "Run this command to start document development server",
"shellCommand": "rush run -p @visactor/table -s build:es && rush run -p @internal/docs -s start"
},
{
"commandKind": "global",
"name": "sync-bnpm",
"summary": "Sync bnpm",
"description": "Sync bnpm",
"shellCommand": "bnpm sync @visactor/vtable && bnpm sync @visactor/vtable-editors && bnpm sync @visactor/react-vtable && bnpm sync @visactor/openinula-vtable && bnpm sync @visactor/vtable-export && bnpm sync @visactor/vtable-search"
}
],
"parameters": [
Expand Down
8 changes: 4 additions & 4 deletions packages/vtable/src/event/listener/container-dom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export function bindContainerDomListener(eventManager: EventManager) {
) {
if (
!(table.options.keyboardOptions?.moveEditCellOnArrowKeys ?? false) &&
(table as ListTableAPI).editorManager.editingEditor
(table as ListTableAPI).editorManager?.editingEditor
) {
// 编辑单元格状态下 如果没有开启方向键切换cell 则退出 。方向键可以在编辑input内移动光标
return;
Expand Down Expand Up @@ -107,7 +107,7 @@ export function bindContainerDomListener(eventManager: EventManager) {
table.selectCell(targetCol, targetRow, e.shiftKey);
if (
(table.options.keyboardOptions?.moveEditCellOnArrowKeys ?? false) &&
(table as ListTableAPI).editorManager.editingEditor
(table as ListTableAPI).editorManager?.editingEditor
) {
// 开启了方向键切换编辑单元格 并且当前已经在编辑状态下 切换到下一个需先退出再进入下个单元格的编辑
(table as ListTableAPI).editorManager.completeEdit();
Expand All @@ -120,7 +120,7 @@ export function bindContainerDomListener(eventManager: EventManager) {
(table as ListTableAPI).editorManager.cancelEdit();
} else if (e.key === 'Enter') {
// 如果按enter键 可以结束当前的编辑 或开启编辑选中的单元格(仅限单选)
if ((table as ListTableAPI).editorManager.editingEditor) {
if ((table as ListTableAPI).editorManager?.editingEditor) {
(table as ListTableAPI).editorManager.completeEdit();
table.getElement().focus();
} else {
Expand Down Expand Up @@ -157,7 +157,7 @@ export function bindContainerDomListener(eventManager: EventManager) {
targetCol = stateManager.select.cellPos.col + 1;
}
table.selectCell(targetCol, targetRow);
if ((table as ListTableAPI).editorManager.editingEditor) {
if ((table as ListTableAPI).editorManager?.editingEditor) {
(table as ListTableAPI).editorManager.completeEdit();
table.getElement().focus();
if ((table as ListTableAPI).getEditor(targetCol, targetRow)) {
Expand Down
4 changes: 2 additions & 2 deletions packages/vtable/src/event/listener/table-group.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export function bindTableGroupListener(eventManager: EventManager) {
// }
if (
stateManager.interactionState === InteractionState.grabing &&
!(table as ListTableAPI).editorManager.editingEditor
!(table as ListTableAPI).editorManager?.editingEditor
) {
if (Math.abs(lastX - e.x) + Math.abs(lastY - e.y) >= 1) {
if (stateManager.isResizeCol()) {
Expand All @@ -59,7 +59,7 @@ export function bindTableGroupListener(eventManager: EventManager) {
} else if (
table.eventManager.isDraging &&
stateManager.isSelecting() &&
!(table as ListTableAPI).editorManager.editingEditor
!(table as ListTableAPI).editorManager?.editingEditor
) {
eventManager.dealTableSelect(eventArgsSet, true);
}
Expand Down

0 comments on commit 2e3d200

Please sign in to comment.