@@ -2,7 +2,7 @@ import { createElement, createRef, Fragment, ReactElement, RefObject, useEffect,
2
2
// eslint-disable-next-line import/no-extraneous-dependencies
3
3
import { followCursor } from 'tippy.js'
4
4
5
- import { ReactComponent as ICClose } from '@Icons/ic-close .svg'
5
+ import { ReactComponent as ICCross } from '@Icons/ic-cross .svg'
6
6
import { DEFAULT_SECRET_PLACEHOLDER } from '@Shared/constants'
7
7
import { Tooltip } from '@Common/Tooltip'
8
8
@@ -38,7 +38,6 @@ export const DynamicDataTableRow = <K extends string, CustomStateType = Record<s
38
38
headers,
39
39
maskValue,
40
40
readOnly,
41
- isAdditionNotAllowed,
42
41
isDeletionNotAllowed,
43
42
validationSchema = ( ) => ( { isValid : true , errorMessages : [ ] } ) ,
44
43
showError,
@@ -52,7 +51,7 @@ export const DynamicDataTableRow = <K extends string, CustomStateType = Record<s
52
51
// CONSTANTS
53
52
const isFirstRowEmpty = headers . every ( ( { key } ) => ! rows [ 0 ] ?. data [ key ] . value )
54
53
/** Boolean determining if table has rows. */
55
- const hasRows = ( ! readOnly && ! isAdditionNotAllowed ) || ! ! rows . length
54
+ const hasRows = ! ! rows . length
56
55
const disableDeleteRow = rows . length === 1 && isFirstRowEmpty
57
56
/** style: grid-template-columns */
58
57
const rowGridTemplateColumn = getRowGridTemplateColumn (
@@ -227,7 +226,7 @@ export const DynamicDataTableRow = <K extends string, CustomStateType = Record<s
227
226
228
227
const renderErrorMessage = ( errorMessage : string ) => (
229
228
< div key = { errorMessage } className = "flexbox align-items-center dc__gap-4" >
230
- < ICClose className = "icon-dim-16 fcr-5 dc__align-self-start dc__no-shrink" />
229
+ < ICCross className = "icon-dim-16 fcr-5 dc__align-self-start dc__no-shrink" />
231
230
< p className = "fs-12 lh-16 cn-7 m-0" > { errorMessage } </ p >
232
231
</ div >
233
232
)
@@ -300,35 +299,30 @@ export const DynamicDataTableRow = <K extends string, CustomStateType = Record<s
300
299
301
300
return hasRows ? (
302
301
< div className = "bcn-2 px-1 pb-1 dc__bottom-radius-4" >
303
- { ! ! rows . length && (
304
- < div
305
- className = { `dynamic-data-table w-100 bcn-1 dc__bottom-radius-4 ${ ! readOnly ? 'three-columns' : 'two-columns' } ` }
306
- style = { {
307
- gridTemplateColumns : rowGridTemplateColumn ,
308
- } }
309
- >
310
- { rows . map ( ( row ) => (
311
- < div key = { row . id } className = "dynamic-data-table__row" >
312
- { headers . map ( ( { key } , index ) => (
313
- < Fragment key = { key } > { renderCell ( row , key , index ) } </ Fragment >
314
- ) ) }
315
- { ! isDeletionNotAllowed && ! readOnly && (
316
- < button
317
- type = "button"
318
- className = { `dynamic-data-table__row-delete-btn dc__unset-button-styles dc__align-self-stretch dc__no-shrink flex py-10 px-8 bcn-0 ${ disableDeleteRow || row . disableDelete ? 'dc__disabled' : 'dc__hover-n50 dc__tab-focus' } ` }
319
- onClick = { onDelete ( row ) }
320
- disabled = { disableDeleteRow || row . disableDelete }
321
- >
322
- < ICClose
323
- aria-label = "delete-row"
324
- className = "icon-dim-16 fcn-4 dc__align-self-start"
325
- />
326
- </ button >
327
- ) }
328
- </ div >
329
- ) ) }
330
- </ div >
331
- ) }
302
+ < div
303
+ className = { `dynamic-data-table w-100 bcn-1 dc__bottom-radius-4 ${ ! readOnly ? 'three-columns' : 'two-columns' } ` }
304
+ style = { {
305
+ gridTemplateColumns : rowGridTemplateColumn ,
306
+ } }
307
+ >
308
+ { rows . map ( ( row ) => (
309
+ < div key = { row . id } className = "dynamic-data-table__row" >
310
+ { headers . map ( ( { key } , index ) => (
311
+ < Fragment key = { key } > { renderCell ( row , key , index ) } </ Fragment >
312
+ ) ) }
313
+ { ! isDeletionNotAllowed && ! readOnly && (
314
+ < button
315
+ type = "button"
316
+ className = { `dynamic-data-table__row-delete-btn dc__unset-button-styles dc__align-self-stretch dc__no-shrink flex py-10 px-8 bcn-0 ${ disableDeleteRow || row . disableDelete ? 'dc__disabled' : 'dc__hover-n50 dc__tab-focus' } ` }
317
+ onClick = { onDelete ( row ) }
318
+ disabled = { disableDeleteRow || row . disableDelete }
319
+ >
320
+ < ICCross aria-label = "delete-row" className = "icon-dim-16 fcn-4 dc__align-self-start" />
321
+ </ button >
322
+ ) }
323
+ </ div >
324
+ ) ) }
325
+ </ div >
332
326
</ div >
333
327
) : null
334
328
}
0 commit comments