ywana-core8 0.0.218 → 0.0.222

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.218",
3
+ "version": "0.0.222",
4
4
  "description": "ywana-core8",
5
5
  "author": "Ernesto Roldan Garcia",
6
6
  "license": "MIT",
@@ -315,7 +315,25 @@ export const CollectionContext = (url, field) => {
315
315
  const CollectionAPI = (url) => {
316
316
 
317
317
  return {
318
- all() {
318
+ all(filters) {
319
+ let queryParams = "?"
320
+ if (filters) {
321
+ const filterQuery = Object.keys(filters).reduce((query, key) => {
322
+ const value = filters[key]
323
+ if (typeof (value) === 'boolean') {
324
+ return query.concat(`${key}=${value}&`)
325
+ } else if (Array.isArray(value)) {
326
+ const param = value.length === 0 ? '' : value.reduce((param, item) => {
327
+ param = param.concat(`${key}=${item}&`)
328
+ return param
329
+ }, "")
330
+ return query.concat(param)
331
+ } else {
332
+ return query.concat(`${key}=%${filters[key]}%&`)
333
+ }
334
+ }, "")
335
+ queryParams = queryParams.concat(filterQuery)
336
+ }
319
337
  return http.GET(url)
320
338
  },
321
339
 
@@ -25,3 +25,45 @@ main.table-editor {
25
25
  overflow: auto;
26
26
  }
27
27
 
28
+ .table-selector {
29
+ display: flex;
30
+ flex-direction: column;
31
+ }
32
+
33
+ .table-selector>header {
34
+ border-bottom: solid 1px var(--divider-color);
35
+ background-color: rgba(220,220,220,.5);
36
+ }
37
+
38
+ .table-selector>main {
39
+ flex: 1;
40
+ }
41
+
42
+ .table-selector>main>.datatable8 {
43
+ margin: 0;
44
+ }
45
+
46
+ .table-selector>footer {
47
+ padding: .5rem;
48
+ display: flex;
49
+ }
50
+
51
+ .table-selector>footer>* {
52
+ flex: 1;
53
+ }
54
+
55
+ .table-row-editor>header,
56
+ header.table-queries,
57
+ header.table-filters {
58
+ border-bottom: solid 1px var(--divider-color);
59
+ background-color: rgba(220,220,220,.5);
60
+ }
61
+
62
+ main.table-queries,
63
+ main.table-filters {
64
+ flex: 1;
65
+ }
66
+
67
+ td.entity-cell {
68
+ background-color: rgba(240,240,240,.4);
69
+ }
@@ -241,7 +241,7 @@ const TableFilters = (props) => {
241
241
  return (
242
242
  <Fragment>
243
243
  <Header className="table-filters" title={<Text>Filters</Text>} >
244
- <Button icon="filter_list_off" label="Clean" action={clear} />
244
+ <Icon icon="filter_list_off" size="small" clickable action={clear} />
245
245
  </Header>
246
246
  <main className="table-filters">
247
247
  <ContentEditor content={content} onChange={change} />
package/src/html/table.js CHANGED
@@ -76,7 +76,7 @@ export const DataTable = (props) => {
76
76
  <tr>
77
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, Object.keys(item).length] : [2, 1]
79
+ const [rowspan, colspan] = type === TYPES.ENTITY ? [1, Object.values(item).filter(v=>v.column===true).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>}
@@ -185,7 +185,7 @@ const EntityCellViewer = ({ id, item, value }) => {
185
185
  console.log(id, item, value)
186
186
  const fields = Object.values(item).filter(field => field.column === true)
187
187
  return fields.map( field => {
188
- return (<td key={column.id} className={`entity-cell ${column.id}`} >{value[field.id]}</td>)
188
+ return (<td key={field.id} className={`entity-cell ${field.id}`} >{value[field.id]}</td>)
189
189
  })
190
190
  }
191
191
 
@@ -9,7 +9,7 @@
9
9
  "menu main aside"
10
10
  "menu detail aside"
11
11
  "footer footer footer";
12
- grid-template-columns: auto 1fr auto;
12
+ grid-template-columns: auto 1fr 100%;
13
13
  grid-template-rows: auto auto 1fr auto auto;
14
14
  }
15
15
 
@@ -17,6 +17,14 @@
17
17
  min-height: 3rem;
18
18
  }
19
19
 
20
+ .workspace>main {
21
+ resize: horizontal;
22
+ }
23
+
24
+ .workspace>aside {
25
+ width: 100%;
26
+ }
27
+
20
28
  .overall {
21
29
  position: absolute;
22
30
  top:0;