ywana-core8 0.0.132 → 0.0.136

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.132",
3
+ "version": "0.0.136",
4
4
  "description": "ywana-core8",
5
5
  "author": "Ernesto Roldan Garcia",
6
6
  "license": "MIT",
@@ -19,7 +19,7 @@ export const TablePage = (props) => {
19
19
  const { id = "table",
20
20
  icon, title, name,
21
21
  schema, url, field,
22
- actions, dev = false, tableActions,
22
+ actions, dev = false, tableActions, selectionActions = [],
23
23
  editable, canFilter = false, canQuery = false, canAdd = true, canDelete = true,
24
24
  autosave = true, delay = 1000,
25
25
  groupBy, validator, scenario,
@@ -96,7 +96,7 @@ export const TablePage = (props) => {
96
96
  return (
97
97
  <aside className="table-page">
98
98
  { rowSelected ? <TableRowEditor content={new Content(schema, form)} filter={editorFilter} onChange={change} onClose={closeAside} /> : null }
99
- { rowChecked ? <TableSelector schema={schema} onClose={closeAside} /> : null }
99
+ { rowChecked ? <TableSelector schema={schema} actions={selectionActions} /> : null }
100
100
  </aside>
101
101
  )
102
102
  }
@@ -153,14 +153,16 @@ const TableSelector = (props) => {
153
153
  const { all, checked} = pageContext
154
154
 
155
155
  const count = `${checked.size}/${all.length}`
156
- const rows = [...checked].map(id => all.find(item => item.id === id))
157
- console.log(count, rows)
156
+ const rows = all.filter(item => checked.has(item.id))
158
157
  const table = {
159
158
  columns: [
160
159
  { id:"idMatricula", label: "ID Matricula" }
161
160
  ],
162
- rows: []
161
+ rows: rows || []
163
162
  }
163
+ const buttons = actions.map(({label, action }) => {
164
+ return <Button label={label} raised action={() => action(rows)} />
165
+ })
164
166
 
165
167
  return (
166
168
  <div className="table-selector">
@@ -171,7 +173,7 @@ const TableSelector = (props) => {
171
173
  <DataTable {...table} />
172
174
  </main>
173
175
  <footer>
174
- { actions }
176
+ { buttons }
175
177
  </footer>
176
178
  </div>
177
179
  )