ywana-core8 0.1.72 → 0.1.74

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
@@ -2002,10 +2002,6 @@ var DataTable = function DataTable(props) {
2002
2002
  a = Number(a);
2003
2003
  b = Number(b);
2004
2004
  }
2005
- if (a === b) {
2006
- // If the values are the same, do not switch positions.
2007
- return 0;
2008
- }
2009
2005
 
2010
2006
  // If b > a, multiply by -1 to get the reverse direction.
2011
2007
  return a > b ? direction : -1 * direction;
@@ -2369,6 +2365,18 @@ var DataTableCell = function DataTableCell(_ref6) {
2369
2365
  return /*#__PURE__*/React__default["default"].createElement("img", {
2370
2366
  src: cell
2371
2367
  });
2368
+ case "DATETIME":
2369
+ var locale = window.navigator.userLanguage || window.navigator.language;
2370
+ var date = new Date(cell);
2371
+ date.setMinutes(date.getMinutes() + date.getTimezoneOffset() + 1);
2372
+ return /*#__PURE__*/React__default["default"].createElement("span", null, date.toLocaleString(locale, {
2373
+ year: 'numeric',
2374
+ month: 'numeric',
2375
+ day: 'numeric',
2376
+ hour: 'numeric',
2377
+ minute: 'numeric',
2378
+ second: 'numeric'
2379
+ }));
2372
2380
  default:
2373
2381
  return cell;
2374
2382
  }
@@ -7673,6 +7681,11 @@ var CollectionEditor$2 = function CollectionEditor(_ref11) {
7673
7681
  onChange(id, next);
7674
7682
  }
7675
7683
  }
7684
+ function changeItem(index, fieldID, newValue) {
7685
+ var next = value.slice();
7686
+ next[index][fieldID] = newValue;
7687
+ onChange(id, next);
7688
+ }
7676
7689
  function reload() {
7677
7690
  if (onReload) onReload();
7678
7691
  }
@@ -7693,7 +7706,8 @@ var CollectionEditor$2 = function CollectionEditor(_ref11) {
7693
7706
  schema: item,
7694
7707
  groupBy: groupBy,
7695
7708
  canDelete: true,
7696
- remove: remove
7709
+ remove: remove,
7710
+ onChange: changeItem
7697
7711
  }), /*#__PURE__*/React__default["default"].createElement("footer", null, Feeder ? /*#__PURE__*/React__default["default"].createElement(Feeder, {
7698
7712
  onAdd: add,
7699
7713
  onReload: reload
@@ -7788,10 +7802,14 @@ var TableEditor$3 = function TableEditor(props) {
7788
7802
  remove = props.remove,
7789
7803
  filter = props.filter,
7790
7804
  actions = props.actions,
7791
- className = props.className;
7805
+ className = props.className,
7806
+ onChange = props.onChange;
7792
7807
  var _useState5 = React.useState(props.groupBy),
7793
7808
  groupBy = _useState5[0],
7794
7809
  setGroupBy = _useState5[1];
7810
+ function change(rowID, fieldID, value) {
7811
+ if (onChange) onChange(rowID, fieldID, value);
7812
+ }
7795
7813
  function changeGroup(id, value) {
7796
7814
  setGroupBy(value);
7797
7815
  }
@@ -7847,7 +7865,9 @@ var TableEditor$3 = function TableEditor(props) {
7847
7865
  };
7848
7866
  }),
7849
7867
  rows: groups[groupName].map(function (item, index) {
7850
- item.actions = actions ? actions.map(function (_action) {
7868
+ var row = Object.assign({}, item);
7869
+ if (!row.id) row.id = index;
7870
+ row.actions = actions ? actions.map(function (_action) {
7851
7871
  return _action.filter ? _action.filter(item) ? /*#__PURE__*/React__default["default"].createElement(Icon, {
7852
7872
  icon: _action.icon,
7853
7873
  clickable: true,
@@ -7864,7 +7884,7 @@ var TableEditor$3 = function TableEditor(props) {
7864
7884
  }
7865
7885
  });
7866
7886
  }) : [];
7867
- if (canDelete) item.actions.push(/*#__PURE__*/React__default["default"].createElement(Icon, {
7887
+ if (canDelete) row.actions.push(/*#__PURE__*/React__default["default"].createElement(Icon, {
7868
7888
  icon: "delete",
7869
7889
  size: "small",
7870
7890
  clickable: true,
@@ -7872,7 +7892,7 @@ var TableEditor$3 = function TableEditor(props) {
7872
7892
  return remove(index);
7873
7893
  }
7874
7894
  }));
7875
- return item;
7895
+ return row;
7876
7896
  })
7877
7897
  };
7878
7898
  table.columns.push({