From 77281c206126a49b0409113084dc03595caf44af Mon Sep 17 00:00:00 2001 From: Rui-Sun Date: Thu, 5 Dec 2024 11:55:04 +0800 Subject: [PATCH 1/3] fix: outsideClickDeselect event in menu element --- .../vtable/fix-menu-clear-select_2024-12-05-03-54.json | 10 ++++++++++ packages/vtable/src/components/menu/dom/BaseMenu.ts | 3 +++ packages/vtable/src/components/menu/dom/MenuHandler.ts | 10 ++++++++++ packages/vtable/src/event/listener/table-group.ts | 2 +- 4 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 common/changes/@visactor/vtable/fix-menu-clear-select_2024-12-05-03-54.json diff --git a/common/changes/@visactor/vtable/fix-menu-clear-select_2024-12-05-03-54.json b/common/changes/@visactor/vtable/fix-menu-clear-select_2024-12-05-03-54.json new file mode 100644 index 000000000..d60bac72e --- /dev/null +++ b/common/changes/@visactor/vtable/fix-menu-clear-select_2024-12-05-03-54.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@visactor/vtable", + "comment": "fix: outsideClickDeselect event in menu element", + "type": "none" + } + ], + "packageName": "@visactor/vtable" +} \ No newline at end of file diff --git a/packages/vtable/src/components/menu/dom/BaseMenu.ts b/packages/vtable/src/components/menu/dom/BaseMenu.ts index 306ed26f7..e2da9bc6a 100644 --- a/packages/vtable/src/components/menu/dom/BaseMenu.ts +++ b/packages/vtable/src/components/menu/dom/BaseMenu.ts @@ -40,4 +40,7 @@ export abstract class BaseMenu { const menuElement = this._getMenuElement(); return menuElement.pointInMenuElement(x, y); } + getRootElement(): HTMLElement { + return this._getMenuElement().rootElement; + } } diff --git a/packages/vtable/src/components/menu/dom/MenuHandler.ts b/packages/vtable/src/components/menu/dom/MenuHandler.ts index a6f04d50f..43b3db74f 100644 --- a/packages/vtable/src/components/menu/dom/MenuHandler.ts +++ b/packages/vtable/src/components/menu/dom/MenuHandler.ts @@ -252,4 +252,14 @@ export class MenuHandler { info }; } + + containElement(el: HTMLElement): boolean { + for (const k in this._menuInstances) { + const contain = this._menuInstances[k].getRootElement()?.contains(el); + if (contain) { + return true; + } + } + return false; + } } diff --git a/packages/vtable/src/event/listener/table-group.ts b/packages/vtable/src/event/listener/table-group.ts index b1364fbad..3008b4c90 100644 --- a/packages/vtable/src/event/listener/table-group.ts +++ b/packages/vtable/src/event/listener/table-group.ts @@ -398,7 +398,7 @@ export function bindTableGroupListener(eventManager: EventManager) { }; const globalPointerdownCallback = (e: MouseEvent) => { const target = e.target as HTMLElement; - if (!table.getElement().contains(target)) { + if (!table.getElement().contains(target) && !table.internalProps.menuHandler.containElement(target)) { // 如果点击到表格外部的dom const isCompleteEdit = (table as ListTableAPI).editorManager?.completeEdit(e); getPromiseValue(isCompleteEdit, isCompleteEdit => { From c0140deba2c82b6ac91f4a7152881f235a16ead3 Mon Sep 17 00:00:00 2001 From: Rui-Sun Date: Thu, 5 Dec 2024 19:43:53 +0800 Subject: [PATCH 2/3] fix: remove loading icon temporarily --- packages/vtable/src/icons.ts | 40 ++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/packages/vtable/src/icons.ts b/packages/vtable/src/icons.ts index 008f442a4..1d04012e8 100644 --- a/packages/vtable/src/icons.ts +++ b/packages/vtable/src/icons.ts @@ -332,27 +332,27 @@ const builtins = { cursor: 'pointer' }; }, - //loading状态按钮 - get loading(): ImageIcon { - return { - type: 'image', - src: 'https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/media/loading-circle.gif', - width: collapse_size, - height: collapse_size, - name: 'loading', - positionType: IconPosition.contentLeft, - marginLeft: 0, - marginRight: 4, - hover: { - width: collapse_size_2, - height: collapse_size_2, - bgColor: 'rgba(101, 117, 168, 0.1)' - }, - // cursor: 'pointer', + // //loading状态按钮 + // get loading(): ImageIcon { + // return { + // type: 'image', + // src: 'https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/media/loading-circle.gif', + // width: collapse_size, + // height: collapse_size, + // name: 'loading', + // positionType: IconPosition.contentLeft, + // marginLeft: 0, + // marginRight: 4, + // hover: { + // width: collapse_size_2, + // height: collapse_size_2, + // bgColor: 'rgba(101, 117, 168, 0.1)' + // }, + // // cursor: 'pointer', - isGif: true - }; - }, + // isGif: true + // }; + // }, // drill按钮 get drillDown(): SvgIcon { From 4d71d61d15d14119315f0a1c10a91ad1e9fdfcf6 Mon Sep 17 00:00:00 2001 From: Rui-Sun Date: Fri, 6 Dec 2024 17:30:20 +0800 Subject: [PATCH 3/3] fix: fix style update in forceFastUpdate --- .../vtable/src/scenegraph/group-creater/cell-helper.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/vtable/src/scenegraph/group-creater/cell-helper.ts b/packages/vtable/src/scenegraph/group-creater/cell-helper.ts index 824eb379b..cdc2ec73e 100644 --- a/packages/vtable/src/scenegraph/group-creater/cell-helper.ts +++ b/packages/vtable/src/scenegraph/group-creater/cell-helper.ts @@ -556,7 +556,12 @@ export function updateCell( // update text const textMark = oldCellGroup.getChildByName('text'); - if (textMark) { + if (forceFastUpdate && textMark) { + const attribute = { + textBaseline: 'top' + }; + textMark.setAttributes(cellTheme.text ? (Object.assign({}, cellTheme.text, attribute) as any) : attribute); + } else if (textMark) { const text = table.getCellValue(col, row); const { text: textArr, moreThanMaxCharacters } = breakString(text, table);