import React from 'react'; import { resolve, findProp } from '@/_helpers/utils'; import Skeleton from 'react-loading-skeleton'; export const Table = function Table({ id, component, onComponentClick, currentState, onEvent }) { const backgroundColor = component.definition.styles.backgroundColor.value; const color = component.definition.styles.textColor.value; const columns = component.definition.properties.columns.value; const actions = component.definition.properties.actions || { value: []}; const loadingStateProperty = component.definition.properties.loadingState; let loadingState = false; if(loadingStateProperty && currentState) { loadingState = resolve(loadingStateProperty.value, currentState); } console.log('currentState', currentState); let data = [] if(currentState) { data = resolve(component.definition.properties.data.value, currentState, []); console.log('resolved param', data); } function findColumnValue(row, column) { if(column.key) { return findProp(row, column.key); } else { return findProp(row, column.name); } } // Quick fix, need to remove later data = data ? data : []; const computedStyles = { backgroundColor, color } return (
| {column.name} | )} {actions.value.length > 0 &&Actions | }
|---|---|
| {findColumnValue(row, column)} | )} {actions.value.length > 0 &&{actions.value.map((action) => ( ))} | }