File tree 7 files changed +30
-2
lines changed
client/packages/lowcoder/src
7 files changed +30
-2
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,7 @@ export interface CellProps {
37
37
candidateStatus ?: { text : string ; status : StatusType } [ ] ;
38
38
textOverflow ?: boolean ;
39
39
cellTooltip ?: string ;
40
+ editMode ?: string ;
40
41
onTableEvent ?: ( eventName : any ) => void ;
41
42
}
42
43
@@ -94,13 +95,15 @@ export function EditableCell<T extends JSONValue>(props: EditableCellProps<T>) {
94
95
candidateTags,
95
96
// tagColors
96
97
candidateStatus,
98
+ editMode,
97
99
onTableEvent,
98
100
} = props ;
99
101
const status = _ . isNil ( changeValue ) ? "normal" : "toSave" ;
100
102
const editable = editViewFn ? props . editable : false ;
101
103
const { isEditing, setIsEditing } = useContext ( TableCellContext ) ;
102
104
const value = changeValue ?? baseValue ! ;
103
105
const [ tmpValue , setTmpValue ] = useState < T | null > ( value ) ;
106
+ const singleClickEdit = editMode === 'single' ;
104
107
105
108
useEffect ( ( ) => {
106
109
setTmpValue ( value ) ;
@@ -175,8 +178,8 @@ export function EditableCell<T extends JSONValue>(props: EditableCellProps<T>) {
175
178
width : '100%' ,
176
179
height : '100%' ,
177
180
} }
178
- // onDoubleClick={enterEditFn}
179
- onClick = { enterEditFn }
181
+ onDoubleClick = { ! singleClickEdit ? enterEditFn : undefined }
182
+ onClick = { singleClickEdit ? enterEditFn : undefined }
180
183
>
181
184
</ div >
182
185
</ CellWrapper >
Original file line number Diff line number Diff line change @@ -767,6 +767,7 @@ export function TableCompView(props: {
767
767
const inlineAddNewRow = useMemo ( ( ) => compChildren . inlineAddNewRow . getView ( ) , [ compChildren . inlineAddNewRow ] ) ;
768
768
const pagination = useMemo ( ( ) => compChildren . pagination . getView ( ) , [ compChildren . pagination ] ) ;
769
769
const size = useMemo ( ( ) => compChildren . size . getView ( ) , [ compChildren . size ] ) ;
770
+ const editModeClicks = useMemo ( ( ) => compChildren . editModeClicks . getView ( ) , [ compChildren . editModeClicks ] ) ;
770
771
const onEvent = useMemo ( ( ) => compChildren . onEvent . getView ( ) , [ compChildren . onEvent ] ) ;
771
772
const dynamicColumn = compChildren . dynamicColumn . getView ( ) ;
772
773
const dynamicColumnConfig = useMemo (
@@ -785,6 +786,7 @@ export function TableCompView(props: {
785
786
dynamicColumn ,
786
787
dynamicColumnConfig ,
787
788
columnsAggrData ,
789
+ editModeClicks ,
788
790
onEvent ,
789
791
) ,
790
792
[
@@ -795,6 +797,7 @@ export function TableCompView(props: {
795
797
dynamicColumn ,
796
798
dynamicColumnConfig ,
797
799
columnsAggrData ,
800
+ editModeClicks ,
798
801
]
799
802
) ;
800
803
Original file line number Diff line number Diff line change @@ -45,6 +45,7 @@ const expectColumn = (
45
45
comp . children . dynamicColumn . getView ( ) ,
46
46
dynamicColumnConfig ,
47
47
comp . columnAggrData ,
48
+ comp . children . editModeClicks . getView ( ) ,
48
49
onEvent ,
49
50
) ;
50
51
expect ( columnViews . length ) . toBeGreaterThanOrEqual ( antdColumns . length ) ;
Original file line number Diff line number Diff line change @@ -562,6 +562,10 @@ export function compTablePropertyView<T extends MultiBaseComp<TableChildrenType>
562
562
label : trans ( "table.dynamicColumnConfig" ) ,
563
563
tooltip : trans ( "table.dynamicColumnConfigDesc" ) ,
564
564
} ) }
565
+ { comp . children . editModeClicks . propertyView ( {
566
+ label : trans ( "table.editMode" ) ,
567
+ radioButton : true ,
568
+ } ) }
565
569
{ comp . children . searchText . propertyView ( {
566
570
label : trans ( "table.searchText" ) ,
567
571
tooltip : trans ( "table.searchTextTooltip" ) ,
Original file line number Diff line number Diff line change @@ -37,6 +37,17 @@ import { PaginationControl } from "./paginationControl";
37
37
import { SelectionControl } from "./selectionControl" ;
38
38
import { AutoHeightControl } from "comps/controls/autoHeightControl" ;
39
39
40
+ const editModeClickOptions = [
41
+ {
42
+ label : trans ( "table.singleClick" ) ,
43
+ value : "single" ,
44
+ } ,
45
+ {
46
+ label : trans ( "table.doubleClick" ) ,
47
+ value : "double" ,
48
+ } ,
49
+ ] as const ;
50
+
40
51
const summarRowsOptions = [
41
52
{
42
53
label : "1" ,
@@ -248,6 +259,7 @@ const tableChildrenMap = {
248
259
expansion : ExpansionControl ,
249
260
selectedCell : stateComp < JSONObject > ( { } ) ,
250
261
inlineAddNewRow : BoolControl ,
262
+ editModeClicks : dropdownControl ( editModeClickOptions , "single" ) ,
251
263
} ;
252
264
253
265
export const TableInitComp = ( function ( ) {
Original file line number Diff line number Diff line change @@ -295,6 +295,7 @@ export function columnsToAntdFormat(
295
295
dynamicColumn : boolean ,
296
296
dynamicColumnConfig : Array < string > ,
297
297
columnsAggrData : ColumnsAggrData ,
298
+ editMode : string ,
298
299
onTableEvent : ( eventName : any ) => void ,
299
300
) : Array < CustomColumnType < RecordType > > {
300
301
const customColumns = columns . filter ( col => col . isCustom ) . map ( col => col . dataIndex ) ;
@@ -392,6 +393,7 @@ export function columnsToAntdFormat(
392
393
currentRow : row ,
393
394
currentIndex : index ,
394
395
} ) ,
396
+ editMode,
395
397
onTableEvent,
396
398
} ) ;
397
399
} ,
Original file line number Diff line number Diff line change @@ -2002,6 +2002,9 @@ export const en = {
2002
2002
"showSummary" : "Show Summary Row" ,
2003
2003
"totalSummaryRows" : "Total Rows" ,
2004
2004
"inlineAddNewRow" : "Inline Add New Row" ,
2005
+ "editMode" : "Edit Mode" ,
2006
+ "singleClick" : "Single Click" ,
2007
+ "doubleClick" : "Double Click" ,
2005
2008
} ,
2006
2009
2007
2010
You can’t perform that action at this time.
0 commit comments