File tree Expand file tree Collapse file tree 3 files changed +12
-6
lines changed
packages/drip-table-generator/src/layouts
table-workstation/editable-table/components/cell Expand file tree Collapse file tree 3 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -38,9 +38,12 @@ export const updateColumnItemByPath = (
38
38
39
39
export const getColumnItemByPath = ( column : DTGTableConfig [ 'columns' ] [ number ] , path : ( number | 'popover' | 'content' ) [ ] ) => {
40
40
const [ key , ...rest ] = path ;
41
- if ( ! column || path . length <= 0 ) {
41
+ if ( ! column ) {
42
42
return null ;
43
43
}
44
+ if ( column && path . length <= 0 ) {
45
+ return column ;
46
+ }
44
47
const newColumn = cloneDeep ( column && 'schema' in column ? column . schema : column ) as DTGTableConfig [ 'columns' ] [ number ] ;
45
48
if ( newColumn . component === 'group' ) {
46
49
const items = newColumn . options . items as DTGTableConfig [ 'columns' ] || [ ] ;
Original file line number Diff line number Diff line change @@ -116,7 +116,7 @@ function GroupCell<
116
116
onClick = { ( e ) => {
117
117
e . stopPropagation ( ) ;
118
118
setState ( {
119
- currentComponentPath : colChecked ? [ ] : [ componentIndex ] ,
119
+ currentComponentPath : colChecked ? [ ] : [ ... props . path , componentIndex ] ,
120
120
currentComponentID : colChecked ? void 0 : itemColumnSchema ?. key ,
121
121
currentColumnID : rootColumn . key ,
122
122
currentTableID : props . tableConfig . tableId ,
@@ -137,10 +137,11 @@ function GroupCell<
137
137
drawerType : 'column-item' ,
138
138
} ) ;
139
139
props . onClick ?.( 'column-item' , {
140
- currentComponentPath : colChecked ? [ ] : [ componentIndex ] ,
141
- currentComponentID : colChecked ? void 0 : itemColumnSchema ?. key ,
140
+ currentComponentPath : [ componentIndex ] ,
141
+ currentComponentID : itemColumnSchema ?. key ,
142
142
currentColumnID : rootColumn . key ,
143
143
currentTableID : props . tableConfig . tableId ,
144
+ tableConfig : props . tableConfig ,
144
145
} ) ;
145
146
} }
146
147
/>
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ import React from 'react';
16
16
17
17
import { GeneratorContext } from '@/context' ;
18
18
import { DTGTableConfig , TableConfigsContext } from '@/context/table-configs' ;
19
- import { updateColumnItemByPath } from '@/layouts/attributes-layout/utils' ;
19
+ import { getColumnItemByPath , updateColumnItemByPath } from '@/layouts/attributes-layout/utils' ;
20
20
import { getSchemaValue } from '@/layouts/utils' ;
21
21
import { DataSourceTypeAbbr , DripTableGeneratorProps } from '@/typing' ;
22
22
@@ -111,7 +111,9 @@ ExtraOptions extends Partial<DripTableExtraOptions> = never,
111
111
onAddColumnItem = { onAddColumnItem }
112
112
onRemoveColumnItem = { onRemoveColumnItem }
113
113
onClick = { ( type , payload ) => {
114
- if ( type !== 'column-item' ) {
114
+ const colPath = payload . currentComponentPath as ( number | 'popover' | 'content' ) [ ] ?? [ ] ;
115
+ const containerComponent = getColumnItemByPath ( props . column , colPath ) ;
116
+ if ( ! ( type === 'column-item' && containerComponent . component === 'group' ) ) {
115
117
setState ( {
116
118
...payload ,
117
119
currentColumnID : props . column . key ,
You can’t perform that action at this time.
0 commit comments