ywana-core8 0.0.200 → 0.0.204

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.200",
3
+ "version": "0.0.204",
4
4
  "description": "ywana-core8",
5
5
  "author": "Ernesto Roldan Garcia",
6
6
  "license": "MIT",
package/src/html/table.js CHANGED
@@ -74,10 +74,11 @@ export const DataTable = (props) => {
74
74
  <table>
75
75
  <thead>
76
76
  <tr>
77
- {columns.map(({ id, label, sortable }) => {
77
+ {columns.map(({ id, label, type, sortable }) => {
78
78
  const sort = sortDir[id] ? sortDir[id] : null
79
+ const colspan = type === TYPES.ENTITY ? 3 : 1
79
80
  return (
80
- <th>
81
+ <th rowSpan={2} colSpan={colspan}>
81
82
  {id === "checked" ? <CheckBox onChange={checkAll} /> : <Text key={`th_${id}`}>{label}</Text>}
82
83
  {sortable ? <Icon icon="arrow_up" size="small" clickable /> : null}
83
84
  </th>
@@ -85,6 +86,13 @@ export const DataTable = (props) => {
85
86
  })}
86
87
  <th></th>
87
88
  </tr>
89
+ <tr>x
90
+ {
91
+ columns
92
+ .filter(({ type }) => type === TYPES.ENTITY)
93
+ .map(({ label }) => [<th>{label}</th>,<th>{label}</th>,<th>{label}</th>])
94
+ }
95
+ </tr>
88
96
  </thead>
89
97
  <tbody>
90
98
  {
@@ -111,7 +119,7 @@ const DataTableRow = (props) => {
111
119
  return (
112
120
  <Fragment>
113
121
  <tr onClick={ev => onSelect(row, ev)}>
114
- {columns.map((column,index) => <DataTableCell key={`${column.id}_${index}`} row={row} column={column} cell={row[column.id]} editable={editable} />)}
122
+ {columns.map((column, index) => <DataTableCell key={`${column.id}_${index}`} row={row} column={column} cell={row[column.id]} editable={editable} />)}
115
123
  {row.info ? <td><Icon icon={infoIcon} clickable action={() => toggleInfo(!isInfoOpen)} /></td> : <td></td>}
116
124
  </tr>
117
125
  {row.info && isInfoOpen ? (
@@ -164,9 +172,11 @@ const DataTableCell = ({ row, column, cell, editable }) => {
164
172
  }
165
173
 
166
174
  const EntityCellViewer = ({ id, value }) => {
175
+ console.log(id, value)
176
+ const subcells = value ? Object.values(value) : [1, 2, 3]
167
177
  return (
168
178
  <div className='entity-cell-viewer'>
169
- {value.map(v => <div>{v}</div>)}
179
+ {subcells.filter(v => !v).map(v => <div>{v}</div>)}
170
180
  </div>
171
181
  )
172
182
  }
package/src/test.js CHANGED
@@ -1,5 +1,41 @@
1
- <template>
2
- <div class="x">
3
- XXX
4
- </div>
5
- </template>
1
+ import React from 'react'
2
+
3
+ const Test = (props) => {
4
+
5
+ return (
6
+
7
+
8
+ <table border="1">
9
+ <thead>
10
+ <tr>
11
+ <th rowSpan={2}>Uno</th>
12
+ <th rowSpan={2}>Dos</th>
13
+ <th rowSpan={2}>Tres</th>
14
+ <th colspan="4">Cuatro</th>
15
+ <th rowSpan={2}>Ocho</th>
16
+ </tr>
17
+ <tr>
18
+ <th>a</th>
19
+ <th>b</th>
20
+ <th>c</th>
21
+ <th>d</th>
22
+ </tr>
23
+ </thead>
24
+ <tbody>
25
+
26
+ <tr>
27
+ <td>1</td>
28
+ <td>2</td>
29
+ <td>3</td>
30
+ <td>4</td>
31
+ <td>5</td>
32
+ <td>6</td>
33
+ <td>7</td>
34
+ <td>8</td>
35
+ </tr>
36
+ </tbody>
37
+ </table>
38
+
39
+
40
+ )
41
+ }