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.
@@ -1993,10 +1993,6 @@ var DataTable = function DataTable(props) {
1993
1993
  a = Number(a);
1994
1994
  b = Number(b);
1995
1995
  }
1996
- if (a === b) {
1997
- // If the values are the same, do not switch positions.
1998
- return 0;
1999
- }
2000
1996
 
2001
1997
  // If b > a, multiply by -1 to get the reverse direction.
2002
1998
  return a > b ? direction : -1 * direction;
@@ -2360,6 +2356,18 @@ var DataTableCell = function DataTableCell(_ref6) {
2360
2356
  return /*#__PURE__*/React.createElement("img", {
2361
2357
  src: cell
2362
2358
  });
2359
+ case "DATETIME":
2360
+ var locale = window.navigator.userLanguage || window.navigator.language;
2361
+ var date = new Date(cell);
2362
+ date.setMinutes(date.getMinutes() + date.getTimezoneOffset() + 1);
2363
+ return /*#__PURE__*/React.createElement("span", null, date.toLocaleString(locale, {
2364
+ year: 'numeric',
2365
+ month: 'numeric',
2366
+ day: 'numeric',
2367
+ hour: 'numeric',
2368
+ minute: 'numeric',
2369
+ second: 'numeric'
2370
+ }));
2363
2371
  default:
2364
2372
  return cell;
2365
2373
  }
@@ -7664,6 +7672,11 @@ var CollectionEditor$2 = function CollectionEditor(_ref11) {
7664
7672
  onChange(id, next);
7665
7673
  }
7666
7674
  }
7675
+ function changeItem(index, fieldID, newValue) {
7676
+ var next = value.slice();
7677
+ next[index][fieldID] = newValue;
7678
+ onChange(id, next);
7679
+ }
7667
7680
  function reload() {
7668
7681
  if (onReload) onReload();
7669
7682
  }
@@ -7684,7 +7697,8 @@ var CollectionEditor$2 = function CollectionEditor(_ref11) {
7684
7697
  schema: item,
7685
7698
  groupBy: groupBy,
7686
7699
  canDelete: true,
7687
- remove: remove
7700
+ remove: remove,
7701
+ onChange: changeItem
7688
7702
  }), /*#__PURE__*/React.createElement("footer", null, Feeder ? /*#__PURE__*/React.createElement(Feeder, {
7689
7703
  onAdd: add,
7690
7704
  onReload: reload
@@ -7779,10 +7793,14 @@ var TableEditor$3 = function TableEditor(props) {
7779
7793
  remove = props.remove,
7780
7794
  filter = props.filter,
7781
7795
  actions = props.actions,
7782
- className = props.className;
7796
+ className = props.className,
7797
+ onChange = props.onChange;
7783
7798
  var _useState5 = useState(props.groupBy),
7784
7799
  groupBy = _useState5[0],
7785
7800
  setGroupBy = _useState5[1];
7801
+ function change(rowID, fieldID, value) {
7802
+ if (onChange) onChange(rowID, fieldID, value);
7803
+ }
7786
7804
  function changeGroup(id, value) {
7787
7805
  setGroupBy(value);
7788
7806
  }
@@ -7838,7 +7856,9 @@ var TableEditor$3 = function TableEditor(props) {
7838
7856
  };
7839
7857
  }),
7840
7858
  rows: groups[groupName].map(function (item, index) {
7841
- item.actions = actions ? actions.map(function (_action) {
7859
+ var row = Object.assign({}, item);
7860
+ if (!row.id) row.id = index;
7861
+ row.actions = actions ? actions.map(function (_action) {
7842
7862
  return _action.filter ? _action.filter(item) ? /*#__PURE__*/React.createElement(Icon, {
7843
7863
  icon: _action.icon,
7844
7864
  clickable: true,
@@ -7855,7 +7875,7 @@ var TableEditor$3 = function TableEditor(props) {
7855
7875
  }
7856
7876
  });
7857
7877
  }) : [];
7858
- if (canDelete) item.actions.push(/*#__PURE__*/React.createElement(Icon, {
7878
+ if (canDelete) row.actions.push(/*#__PURE__*/React.createElement(Icon, {
7859
7879
  icon: "delete",
7860
7880
  size: "small",
7861
7881
  clickable: true,
@@ -7863,7 +7883,7 @@ var TableEditor$3 = function TableEditor(props) {
7863
7883
  return remove(index);
7864
7884
  }
7865
7885
  }));
7866
- return item;
7886
+ return row;
7867
7887
  })
7868
7888
  };
7869
7889
  table.columns.push({