ywana-core8 0.0.210 → 0.0.214

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,6 +1,6 @@
1
1
  {
2
2
  "name": "ywana-core8",
3
- "version": "0.0.210",
3
+ "version": "0.0.214",
4
4
  "description": "ywana-core8",
5
5
  "author": "Ernesto Roldan Garcia",
6
6
  "license": "MIT",
@@ -335,7 +335,7 @@ const TableEditor = (props) => {
335
335
  label: field.label,
336
336
  type: field.type,
337
337
  format: field.format,
338
- subcolumns: field.item ? field.item : [],
338
+ item: field.item ? field.item : [],
339
339
  onChange: field.id === "checked" ? checkOne : field.editable ? change : null, /* checked has it´s own handler */
340
340
  options
341
341
  }
package/src/html/table.js CHANGED
@@ -74,9 +74,9 @@ export const DataTable = (props) => {
74
74
  <table>
75
75
  <thead>
76
76
  <tr>
77
- {columns.map(({ id, label, type, sortable }) => {
77
+ {columns.map(({ id, label, type, item, sortable }) => {
78
78
  const sort = sortDir[id] ? sortDir[id] : null
79
- const [rowspan, colspan] = type === TYPES.ENTITY ? [1, 3] : [2, 1]
79
+ const [rowspan, colspan] = type === TYPES.ENTITY ? [1, Object.keys(item).length] : [2, 1]
80
80
  return (
81
81
  <th rowSpan={rowspan} colSpan={colspan}>
82
82
  {id === "checked" ? <CheckBox onChange={checkAll} /> : <Text key={`th_${id}`}>{label}</Text>}
@@ -90,7 +90,13 @@ export const DataTable = (props) => {
90
90
  {
91
91
  columns
92
92
  .filter(({ type }) => type === TYPES.ENTITY)
93
- .map(({ subcolumns }) => subcolumns.map(subcolumn => <th>{subcolumn.label}</th>))
93
+ .map(column => {
94
+ const { item } = column
95
+ const fields = item ? Object.values(item) : []
96
+ return fields
97
+ .filter(field => field.column === true)
98
+ .map(field => <th>{field.label}</th>)
99
+ })
94
100
  }
95
101
  </tr>
96
102
  </thead>