ywana-core8 0.0.219 → 0.0.220

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.219",
3
+ "version": "0.0.220",
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
 
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>}