ywana-core8 0.0.217 → 0.0.221

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.217",
3
+ "version": "0.0.221",
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,29 @@ 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
+ }
@@ -165,7 +165,8 @@ const TableSelector = (props) => {
165
165
  const rows = all.filter(item => checked.has(item.id))
166
166
  const table = {
167
167
  columns: [
168
- { id: "idMatricula", label: "ID Matricula" }
168
+ { id: "id", label: "ID" },
169
+ { id: "idMatricula", label: "ID Matricula" },
169
170
  ],
170
171
  rows: rows || []
171
172
  }
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