From 378ab508dd4d94854f14aa42bd6553e761fe34da Mon Sep 17 00:00:00 2001 From: lijinke666 Date: Fri, 17 Nov 2023 11:29:01 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E4=BF=AE=E5=A4=8D=20s2-vue=20?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/s2-vue/playground/App.vue | 80 ++++++++++--------- .../tooltip/components/operator/index.vue | 22 +++-- .../tooltip/components/operator/menu.vue | 14 ++-- .../tooltip/components/operator/title.vue | 6 +- .../s2-vue/src/components/tooltip/index.vue | 6 +- 5 files changed, 71 insertions(+), 57 deletions(-) diff --git a/packages/s2-vue/playground/App.vue b/packages/s2-vue/playground/App.vue index 0c072a9c11..25f913d111 100644 --- a/packages/s2-vue/playground/App.vue +++ b/packages/s2-vue/playground/App.vue @@ -520,6 +520,7 @@ const fieldMap = { channel: ['物美', '华联'], sex: ['男', '女'], }; + const partDrillDown: PartDrillDown = { drillConfig: { dataSet: [ @@ -545,11 +546,12 @@ const partDrillDown: PartDrillDown = { const field = drillFields[0]; const rowData = ( dataSet.getCellMultiData({ - query: meta?.query, + query: meta?.query!, drillDownFields: [preDrillDownfield], }) as Data[] ).filter( - (item) => item!.sub_type && item!.type && item![preDrillDownfield], + (item) => + item!['sub_type'] && item!['type'] && item![preDrillDownfield], ); console.log(rowData); @@ -609,47 +611,49 @@ export default defineComponent({ operation: { hiddenColumns: true, sort: true, - onClick: (...args: any[]) => { - console.log('menuClick', ...args); - }, - menus: [ - { - key: 'trend', - text: '趋势', - icon: 'Trend', - enable: (cell) => cell.cellType === CellType.DATA_CELL, - onClick(cell) { - // eslint-disable-next-line no-console - console.log('趋势图 icon 点击: ', cell); - }, + menu: { + onClick: (info, cell) => { + console.log('menuClick', info, cell); }, - { - key: '1', - icon: 'Trend', - text: '菜单1', - onClick(cell: any) { - console.log('cell-1: ', cell); + items: [ + { + key: 'trend', + icon: 'Trend', + label: '趋势', + visible: (cell) => cell.cellType === CellType.DATA_CELL, + onClick(info, cell) { + // eslint-disable-next-line no-console + console.log('趋势图 icon 点击: ', info, cell); + }, }, - children: [ - { - key: '1-1', - icon: 'Trend', - text: '菜单1-1', - onClick(cell: any) { - console.log('cell-1-1: ', cell); + { + key: '1', + icon: 'Trend', + label: '菜单1', + onClick(info, cell) { + console.log('cell-1: ', cell); + }, + children: [ + { + key: '1-1', + icon: 'Trend', + label: '菜单1-1', + onClick(info, cell) { + console.log('cell-1-1: ', cell); + }, }, + ], + }, + { + key: '2', + icon: 'Trend', + label: '菜单2', + onClick(info, cell) { + console.log('cell-2: ', cell); }, - ], - }, - { - key: '2', - icon: 'Trend', - text: '菜单2', - onClick(cell: any) { - console.log('cell-2: ', cell); }, - }, - ], + ], + }, }, }, }) as unknown as S2Options; diff --git a/packages/s2-vue/src/components/tooltip/components/operator/index.vue b/packages/s2-vue/src/components/tooltip/components/operator/index.vue index 1b6734b657..c5266d9153 100644 --- a/packages/s2-vue/src/components/tooltip/components/operator/index.vue +++ b/packages/s2-vue/src/components/tooltip/components/operator/index.vue @@ -1,5 +1,9 @@