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