ywana-core8 0.1.72 → 0.1.73

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/dist/index.cjs CHANGED
@@ -7673,6 +7673,11 @@ var CollectionEditor$2 = function CollectionEditor(_ref11) {
7673
7673
  onChange(id, next);
7674
7674
  }
7675
7675
  }
7676
+ function changeItem(index, fieldID, newValue) {
7677
+ var next = value.slice();
7678
+ next[index][fieldID] = newValue;
7679
+ onChange(id, next);
7680
+ }
7676
7681
  function reload() {
7677
7682
  if (onReload) onReload();
7678
7683
  }
@@ -7693,7 +7698,8 @@ var CollectionEditor$2 = function CollectionEditor(_ref11) {
7693
7698
  schema: item,
7694
7699
  groupBy: groupBy,
7695
7700
  canDelete: true,
7696
- remove: remove
7701
+ remove: remove,
7702
+ onChange: changeItem
7697
7703
  }), /*#__PURE__*/React__default["default"].createElement("footer", null, Feeder ? /*#__PURE__*/React__default["default"].createElement(Feeder, {
7698
7704
  onAdd: add,
7699
7705
  onReload: reload
@@ -7788,10 +7794,14 @@ var TableEditor$3 = function TableEditor(props) {
7788
7794
  remove = props.remove,
7789
7795
  filter = props.filter,
7790
7796
  actions = props.actions,
7791
- className = props.className;
7797
+ className = props.className,
7798
+ onChange = props.onChange;
7792
7799
  var _useState5 = React.useState(props.groupBy),
7793
7800
  groupBy = _useState5[0],
7794
7801
  setGroupBy = _useState5[1];
7802
+ function change(rowID, fieldID, value) {
7803
+ if (onChange) onChange(rowID, fieldID, value);
7804
+ }
7795
7805
  function changeGroup(id, value) {
7796
7806
  setGroupBy(value);
7797
7807
  }
@@ -7847,7 +7857,9 @@ var TableEditor$3 = function TableEditor(props) {
7847
7857
  };
7848
7858
  }),
7849
7859
  rows: groups[groupName].map(function (item, index) {
7850
- item.actions = actions ? actions.map(function (_action) {
7860
+ var row = Object.assign({}, item);
7861
+ if (!row.id) row.id = index;
7862
+ row.actions = actions ? actions.map(function (_action) {
7851
7863
  return _action.filter ? _action.filter(item) ? /*#__PURE__*/React__default["default"].createElement(Icon, {
7852
7864
  icon: _action.icon,
7853
7865
  clickable: true,
@@ -7864,7 +7876,7 @@ var TableEditor$3 = function TableEditor(props) {
7864
7876
  }
7865
7877
  });
7866
7878
  }) : [];
7867
- if (canDelete) item.actions.push(/*#__PURE__*/React__default["default"].createElement(Icon, {
7879
+ if (canDelete) row.actions.push(/*#__PURE__*/React__default["default"].createElement(Icon, {
7868
7880
  icon: "delete",
7869
7881
  size: "small",
7870
7882
  clickable: true,
@@ -7872,7 +7884,7 @@ var TableEditor$3 = function TableEditor(props) {
7872
7884
  return remove(index);
7873
7885
  }
7874
7886
  }));
7875
- return item;
7887
+ return row;
7876
7888
  })
7877
7889
  };
7878
7890
  table.columns.push({