@stack-spot/citric-react 0.40.0 → 0.40.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useMemo } from 'react'
|
|
1
|
+
import { createElement, useMemo } from 'react'
|
|
2
2
|
import { withRef } from '../utils/react'
|
|
3
3
|
import { BaseTableProps, SortingDirection, Table, TableProps, Th, Tr } from './Table'
|
|
4
4
|
|
|
@@ -65,6 +65,8 @@ interface ExtraSmartTableProps<T extends Record<string, any>> {
|
|
|
65
65
|
*
|
|
66
66
|
* The extra row is, effectively, an accordion. The content of this accordion is defined by whatever this function returns.
|
|
67
67
|
*
|
|
68
|
+
* Attention: this function is treated as a React Component, i.e. you can use React hooks inside of it.
|
|
69
|
+
*
|
|
68
70
|
* @param item the current item.
|
|
69
71
|
* @returns the React Node to render.
|
|
70
72
|
*/
|
|
@@ -179,7 +181,7 @@ export const SmartTable = withRef(
|
|
|
179
181
|
const rows = useMemo(
|
|
180
182
|
() => data.map((item, index) => {
|
|
181
183
|
const key = keygen ? keygen(item) : index
|
|
182
|
-
const accordionContent = renderAccordion
|
|
184
|
+
const accordionContent = renderAccordion ? createElement(renderAccordion, item) : undefined
|
|
183
185
|
const row = (
|
|
184
186
|
<Tr
|
|
185
187
|
key={key}
|