ywana-core8 0.0.201 → 0.0.202
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 +1 -1
- package/src/html/table.js +13 -5
- package/src/test.js +41 -5
package/package.json
CHANGED
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 ? : 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>
|
90
|
+
{
|
91
|
+
columns
|
92
|
+
.filter(({ type }) => type === TYPES.ENITY)
|
93
|
+
.map(({ label }) => <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 ? (
|
@@ -165,10 +173,10 @@ const DataTableCell = ({ row, column, cell, editable }) => {
|
|
165
173
|
|
166
174
|
const EntityCellViewer = ({ id, value }) => {
|
167
175
|
console.log(id, value)
|
168
|
-
const subcells = value ? Object.values(value) : [1,2,3]
|
176
|
+
const subcells = value ? Object.values(value) : [1, 2, 3]
|
169
177
|
return (
|
170
178
|
<div className='entity-cell-viewer'>
|
171
|
-
{subcells.map(v => <div>{v}</div>)}
|
179
|
+
{subcells.filter(v => !v).map(v => <div>{v}</div>)}
|
172
180
|
</div>
|
173
181
|
)
|
174
182
|
}
|
package/src/test.js
CHANGED
@@ -1,5 +1,41 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
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
|
+
}
|