VTable icon indicating copy to clipboard operation
VTable copied to clipboard

[Bug] setDropDownMenuHighlight 设置选中态展示异常

Open fanglixinzj opened this issue 1 year ago • 2 comments

Version

^0.17.10

Link to Minimal Reproduction

https://visactor.io/vtable/guide/components/dropdown

Steps to Reproduce

image

Current Behavior

dropdown_menu_click 监听事件 setDropDownMenuHighlight([cells]) 设置选中态 其他选中态异常

Expected Behavior

其他选中态 取消选中

Environment

- OS:
- Browser:
- Framework:

Any additional comments?

No response

fanglixinzj avatar Feb 05 '24 03:02 fanglixinzj

let tableInstance; fetch('https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/North_American_Superstore_data.json') .then((res) => res.json()) .then((data) => {

const columns =[ { "field": "Order ID", "title": "Order I121D", "width": "auto" }, { "field": "Product Name", "title": "Product Name", "width": "auto", style: { textAlign: 'left', textBaseline: 'middle', textOverflow: 'ellipsis', color: '#F66', fontSize: 14, fontFamily: 'Arial', fontWeight: 'bold', fontVariant: 'small-caps', fontStyle: 'italic' } }, { "field": "Category", "title": "Category", "width": "auto" }, { "field": "Sub-Category", "title": "Sub-Category", "width": "auto" }, { "field": "Region", "title": "Region", "width": "auto" }, { "field": "City", "title": "City", "width": "auto" }, { "field": "Order Date", "title": "Order Date", "width": "auto" }, { "field": "Quantity", "title": "Quantity", "width": "auto" }, { "field": "Sales", "title": "Sales", "width": "auto" }, { "field": "Profit", "title": "Profit", "width": "auto" } ];

const option = { container: document.getElementById(CONTAINER_ID), records:data, columns, widthMode:'standard', theme:VTable.themes.DEFAULT, menu: { renderMode: 'html', defaultHeaderMenuItems: [ { text: '升序排序', icon: { svg: '<svg width="14" height="14" viewBox="0 0 96 96" fill="none" xmlns="http://www.w3.org/2000/svg">' }, selectedIcon: { svg: '<svg width="14" height="14" viewBox="0 0 96 96" fill="none" xmlns="http://www.w3.org/2000/svg">' }, stateIcon: { svg: '<svg width="12" height="11" viewBox="0 0 64 64" fill="#161616" xmlns="http://www.w3.org/2000/svg" class="visactor-table-action-area-icon">' }, children: [ { text: '升序规则1', menuKey:'升序排序1', icon: { svg: '<svg width="14" height="14" viewBox="0 0 96 96" fill="none" xmlns="http://www.w3.org/2000/svg">' }, selectedIcon: { svg: '<svg width="14" height="14" viewBox="0 0 96 96" fill="none" xmlns="http://www.w3.org/2000/svg">' }, stateIcon: { width: 12, height: 11, svg: '<svg width="12" height="11" viewBox="0 0 64 64" fill="#161616" xmlns="http://www.w3.org/2000/svg" class="visactor-table-action-area-icon">' }, menuKey: '升序规则1' }, { text: '升序规则2', icon: { svg: '<svg width="14" height="14" viewBox="0 0 96 96" fill="none" xmlns="http://www.w3.org/2000/svg">' }, selectedIcon: { svg: '<svg width="14" height="14" viewBox="0 0 96 96" fill="none" xmlns="http://www.w3.org/2000/svg">' }, stateIcon: { width: 12, height: 11, svg: '<svg width="12" height="11" viewBox="0 0 64 64" fill="#161616" xmlns="http://www.w3.org/2000/svg" class="visactor-table-action-area-icon">' }, menuKey: '升序规则2' } ] }, { text: '降序排序', icon: { svg: '<svg width="14" height="14" viewBox="0 0 96 96" fill="none" xmlns="http://www.w3.org/2000/svg">' }, selectedIcon: { svg: '<svg width="14" height="14" viewBox="0 0 96 96" fill="none" xmlns="http://www.w3.org/2000/svg">' }, stateIcon: { svg: '<svg width="12" height="11" viewBox="0 0 64 64" fill="#161616" xmlns="http://www.w3.org/2000/svg" class="visactor-table-action-area-icon">' } }, { text: '冻结列', icon: { svg: '<svg width="14" height="14" viewBox="0 0 96 96" fill="none" xmlns="http://www.w3.org/2000/svg">' } } ], contextMenuItems: ['复制', '粘贴'],

}

}; tableInstance = new VTable.ListTable(option); tableInstance.on('dropdown_menu_click', (args) => { const cells = { col:args.col, row:args.row, field: args.field, menuKey: args.menuKey, }; tableInstance.setDropDownMenuHighlight([cells]); }); window['tableInstance'] = tableInstance; })

完整配置项

fanglixinzj avatar Feb 05 '24 03:02 fanglixinzj

另外一列的图标高亮状态没有清除 ,目前用户结合setRecords接口也就一并刷新了场景树, 所以不阻碍

fangsmile avatar Feb 06 '24 06:02 fangsmile