@@ -26,20 +26,25 @@ registerLicense(
26
26
"ORg4AjUWIQA/Gnt2UFhhQlJBfV5AQmBIYVp/TGpJfl96cVxMZVVBJAtUQF1hTX5Vd0ViX3pfdXRRR2VY"
27
27
) ;
28
28
29
- const Wrapper = styled . div < { } > `
29
+ const Wrapper = styled . div < {
30
+ $bgColor ?: string ;
31
+ } > `
30
32
position: relative;
31
33
height: 100%;
32
34
width: 100%;
35
+ overflow: hidden;
36
+ ${ ( props ) => props . $bgColor && `background: ${ props . $bgColor } ;` }
33
37
` ;
34
38
35
39
const LayoutContainer = styled . div < {
36
40
$bgColor ?: string ;
37
41
$autoHeight ?: boolean ;
38
42
$overflow ?: string ;
39
43
$radius ?: string ;
44
+ $padding ?: string ;
40
45
} > `
41
46
height: ${ ( props : any ) => ( props . $autoHeight ? "auto" : "100%" ) } ;
42
- width:" 100%" ;
47
+ width: 100%;
43
48
44
49
overflow: auto;
45
50
${ ( props : any ) =>
@@ -52,43 +57,67 @@ const LayoutContainer = styled.div<{
52
57
padding-top: 24px !important;
53
58
}
54
59
55
- .e-card {
56
- overflow: visible;
57
- }
58
- ` ;
59
-
60
- const StyledEditIcon = styled ( TextEditIcon ) `
61
- g g {
62
- fill: #ffffff;
63
- }
64
- ` ;
65
-
66
- const StyledDragIcon = styled ( DragIcon ) `
67
- g g {
68
- fill: #ffffff;
69
- }
60
+ ${ ( props ) => props . $padding && `
61
+ .e-kanban .e-kanban-content .e-content-row .e-content-cells .e-card-wrapper .e-card {
62
+ .card-template {
63
+ .e-card-header {
64
+ padding-left: 0;
65
+ padding-right: 0;
66
+ }
67
+ .e-card-content {
68
+ padding-left: 0;
69
+ padding-right: 0;
70
+ }
71
+ .e-card-custom-footer {
72
+ padding-left: 0;
73
+ padding-right: 0;
74
+ }
75
+ }
76
+ }
77
+ ` }
70
78
` ;
71
79
72
80
const CardActions = styled . div `
73
81
display: flex;
82
+ justify-content: space-between;
74
83
position: absolute;
75
- top: -20px ;
84
+ top: 0 ;
76
85
right: 0;
86
+ width: 100%;
77
87
line-height: 16px;
78
- font-size: 12px;
79
- background: #3377ff;
80
- color: white;
81
- border-top-left-radius: 3px;
82
- border-top-right-radius: 3px;
88
+ font-size: 14px;
89
+ padding: 12px 0px;
90
+ box-shadow: 0 2px 6px 2px rgba(0, 0, 0, 0.15), 0 1px 2px 0 rgba(0, 0, 0, 0.3);
91
+ background: #f5f5f7;
92
+ align-items: center;
93
+ z-index: 999;
83
94
84
95
.editAction {
85
- padding: 2px 6px;
86
- border-right: 1px solid white;
96
+ padding: 2px 8px;
87
97
cursor: pointer;
98
+ color: #3377ff;
99
+ font-weight: 500;
88
100
}
89
101
90
102
.dragAction {
103
+ font-weight: bold;
91
104
padding: 2px 6px;
105
+ display: flex;
106
+ align-items: center;
107
+ flex: 1;
108
+ min-width: 0;
109
+
110
+ svg {
111
+ min-width: 20px;
112
+ height: 20px;
113
+ }
114
+
115
+ span {
116
+ width: 100%;
117
+ white-space: nowrap;
118
+ text-overflow: ellipsis;
119
+ overflow: hidden;
120
+ }
92
121
}
93
122
` ;
94
123
@@ -158,43 +187,64 @@ const CardTemplate = React.memo((props: {
158
187
159
188
if ( props . isEditorStateAvailable && props . cardViewOption === 'custom' ) {
160
189
return (
161
- < Wrapper >
190
+ < Wrapper
191
+ $bgColor = { props . cardContentStyles . backgroundColor }
192
+ onMouseEnter = { ( ) => setHover ( true ) }
193
+ onMouseLeave = { ( ) => setHover ( false ) }
194
+ >
195
+ { hover && (
196
+ < CardActions >
197
+ < div className = "dragAction" >
198
+ < DragIcon />
199
+ < span > { props . data . label } </ span >
200
+ </ div >
201
+ < div
202
+ className = "editAction"
203
+ onClick = { props . onEdit }
204
+ >
205
+ < span > Edit</ span >
206
+ </ div >
207
+ </ CardActions >
208
+ ) }
162
209
< div
163
210
className = { 'card-template' }
164
211
onClick = { ( ) => {
165
212
props . onClick ( ) ;
166
213
} }
167
214
style = { {
168
- backgroundColor : props . cardContentStyles . backgroundColor ,
169
215
borderRadius : props . cardContentStyles . radius ,
170
216
borderWidth : props . cardContentStyles . borderWidth ,
171
217
border : props . cardContentStyles . border ,
218
+ padding : props . cardContentStyles . padding ,
219
+ margin : props . cardContentStyles . margin ,
220
+ fontSize : props . cardContentStyles . textSize ,
221
+ overflow : 'hidden' ,
172
222
} }
173
223
>
174
- { template }
224
+ { template }
175
225
</ div >
176
226
</ Wrapper >
177
227
) ;
178
228
}
179
229
180
230
return (
181
231
< Wrapper
232
+ $bgColor = { props . cardContentStyles . backgroundColor }
182
233
onMouseEnter = { ( ) => setHover ( true ) }
183
234
onMouseLeave = { ( ) => setHover ( false ) }
184
235
>
185
236
{ hover && (
186
237
< CardActions >
238
+ < div className = "dragAction" >
239
+ < DragIcon />
240
+ < span > { props . data . label } </ span >
241
+ </ div >
187
242
< div
188
243
className = "editAction"
189
244
onClick = { props . onEdit }
190
245
>
191
- < StyledEditIcon />
192
246
< span > Edit</ span >
193
247
</ div >
194
- < div className = "dragAction" >
195
- < StyledDragIcon />
196
- < span > Drag</ span >
197
- </ div >
198
248
</ CardActions >
199
249
) }
200
250
< div
@@ -203,10 +253,13 @@ const CardTemplate = React.memo((props: {
203
253
props . onClick ( ) ;
204
254
} }
205
255
style = { {
206
- backgroundColor : props . cardContentStyles . backgroundColor ,
207
256
borderRadius : props . cardContentStyles . radius ,
208
257
borderWidth : props . cardContentStyles . borderWidth ,
209
258
border : props . cardContentStyles . border ,
259
+ padding : props . cardContentStyles . padding ,
260
+ margin : props . cardContentStyles . margin ,
261
+ fontSize : props . cardContentStyles . textSize ,
262
+ overflow : 'hidden' ,
210
263
} }
211
264
>
212
265
< div className = "e-card-header" >
@@ -227,10 +280,6 @@ const CardTemplate = React.memo((props: {
227
280
className = "e-text"
228
281
style = { {
229
282
fontSize : props . cardContentStyles . textSize ,
230
- color : props . cardContentStyles . text ,
231
- padding : props . cardContentStyles . padding ,
232
- margin : props . cardContentStyles . margin ,
233
- borderWidth : props . cardContentStyles . borderWidth ,
234
283
} }
235
284
>
236
285
{ props . data . summary }
@@ -279,6 +328,8 @@ export const KanbanCompView = React.memo((props: Props) => {
279
328
const isEditorStateAvailable = useMemo ( ( ) => Boolean ( editorState ) , [ editorState ] ) ;
280
329
const cardView = useMemo ( ( ) => comp . children . cardView . children . cardView . toJsonValue ( ) , [ comp . children . cardView ] ) ;
281
330
const cardModal = useMemo ( ( ) => childrenProps . cardView . cardModalView , [ childrenProps . cardView . cardModalView ] )
331
+ const onEventVal = useMemo ( ( ) => comp ?. toJsonValue ( ) ?. onEvent , [ comp ] ) ;
332
+
282
333
const updateDataMap = useCallback ( ( ) => {
283
334
const mapData : Record < string , number > = { } ;
284
335
childrenProps . data ?. forEach ( ( item : any , index : number ) => {
@@ -445,6 +496,10 @@ export const KanbanCompView = React.memo((props: Props) => {
445
496
childrenProps . onEvent ( "cardClick" ) ;
446
497
} }
447
498
onEdit = { ( ) => {
499
+ if ( onEventVal && onEventVal . some ( ( e : any ) => e . name === 'onEdit' ) ) {
500
+ childrenProps . onEvent ( 'onEdit' ) ;
501
+ return ;
502
+ }
448
503
handleOnEdit ( childrenProps . data [ cardIndex ] ) ;
449
504
} }
450
505
/>
@@ -458,6 +513,7 @@ export const KanbanCompView = React.memo((props: Props) => {
458
513
JSON . stringify ( childrenProps . cardHeaderStyles ) ,
459
514
JSON . stringify ( childrenProps . cardContentStyles ) ,
460
515
JSON . stringify ( childrenProps . tagStyles ) ,
516
+ onEventVal ,
461
517
] ) ;
462
518
463
519
const renderKanbanComp = useMemo ( ( ) => {
@@ -471,7 +527,9 @@ export const KanbanCompView = React.memo((props: Props) => {
471
527
overflow = "scroll"
472
528
hideScrollbar = { ! childrenProps . scrollbars }
473
529
>
474
- < LayoutContainer >
530
+ < LayoutContainer
531
+ $padding = { childrenProps . cardContentStyles . padding }
532
+ >
475
533
{ Boolean ( Object . keys ( dataMap ) . length ) && (
476
534
< KanbanComponent
477
535
id = "kanban"
@@ -489,6 +547,7 @@ export const KanbanCompView = React.memo((props: Props) => {
489
547
cardSettings = { {
490
548
headerField : 'label' ,
491
549
template : cardTemplate ,
550
+ selectionType : 'Single' ,
492
551
} }
493
552
cardRendered = { ( args : CardRenderedEventArgs ) => {
494
553
return cardRendered ( {
0 commit comments