ywana-core8 0.0.809 → 0.0.811

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.809",
3
+ "version": "0.0.811",
4
4
  "description": "ywana-core8",
5
5
  "homepage": "https://ywana.github.io/workspace",
6
6
  "author": "Ernesto Roldan Garcia",
@@ -428,7 +428,7 @@ export const CollectionEditor = ({ field, value = [], onChange, onReload }) => {
428
428
  {
429
429
  Renderer ?
430
430
  <Renderer field={field} value={value} onRemove={remove} onChange={onChange} onReload={reload} />
431
- : <TableEditor icon={"info"} title={label} data={value} schema={item} groupBy={groupBy} canDelete={true} remove={remove} editable={editable} />
431
+ : <TableEditor field={field} icon={"info"} title={label} data={value} schema={item} groupBy={groupBy} canDelete={true} remove={remove} editable={editable} onChange={onChange} />
432
432
  }
433
433
  <footer>
434
434
  {Feeder ? <Feeder onAdd={add} onReload={reload} /> : null}
@@ -483,9 +483,20 @@ const CollectionAdder = ({ item, onAdd }) => {
483
483
  */
484
484
  const TableEditor = (props) => {
485
485
 
486
- const { data = [], icon, title, schema, editable, canDelete, remove, filter, actions, className } = props
486
+ const { field, data = [], icon, title, schema, editable, canDelete, remove, filter, actions, className, onChange } = props
487
487
  const [groupBy, setGroupBy] = useState(props.groupBy)
488
488
 
489
+ function change(id, value) {
490
+ const nextData = data.filter(row => row.id === "actions").map(row => {
491
+ if (row.id === id) {
492
+ return Object.assign({}, row, { [id]: value })
493
+ } else {
494
+ return row
495
+ }
496
+ })
497
+ if (onChange) onChange(field.id, nextData)
498
+ }
499
+
489
500
  function changeGroup(id, value) {
490
501
  setGroupBy(value)
491
502
  }