ywana-core8 0.0.508 → 0.0.511

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.
@@ -1806,7 +1806,8 @@ var DataTableCell = function DataTableCell(_ref4) {
1806
1806
  return column.type === TYPES.ENTITY ? /*#__PURE__*/React.createElement(EntityCellViewer, {
1807
1807
  id: column.id,
1808
1808
  item: column.item,
1809
- value: cell
1809
+ value: cell,
1810
+ format: column.format
1810
1811
  }) : /*#__PURE__*/React.createElement("td", {
1811
1812
  key: column.id,
1812
1813
  className: column.id
@@ -1821,15 +1822,62 @@ var DataTableCell = function DataTableCell(_ref4) {
1821
1822
 
1822
1823
  var EntityCellViewer = function EntityCellViewer(_ref5) {
1823
1824
  var item = _ref5.item,
1824
- value = _ref5.value;
1825
+ value = _ref5.value,
1826
+ _ref5$format = _ref5.format,
1827
+ format = _ref5$format === void 0 ? "" : _ref5$format;
1825
1828
  var fields = Object.values(item).filter(function (field) {
1826
1829
  return field.column === true;
1827
1830
  });
1828
1831
  return fields.map(function (field) {
1832
+ var text = value[field.id];
1833
+
1834
+ if (format) {
1835
+ switch (format) {
1836
+ case FORMATS.COLOR:
1837
+ text = /*#__PURE__*/React.createElement("input", {
1838
+ type: "color",
1839
+ value: text,
1840
+ disabled: true
1841
+ });
1842
+
1843
+ case FORMATS.URL:
1844
+ text = /*#__PURE__*/React.createElement("a", {
1845
+ href: text,
1846
+ target: "download",
1847
+ download: true
1848
+ }, text);
1849
+ break;
1850
+
1851
+ case FORMATS.IMG:
1852
+ text = /*#__PURE__*/React.createElement("img", {
1853
+ src: text
1854
+ });
1855
+ break;
1856
+
1857
+ case FORMATS.DATE:
1858
+ var fecha = new Date(text);
1859
+ fecha.setMinutes(fecha.getMinutes() + fecha.getTimezoneOffset() + 1);
1860
+ text = fecha.toLocaleString(locale, {
1861
+ day: 'numeric',
1862
+ month: 'numeric',
1863
+ year: 'numeric'
1864
+ });
1865
+ break;
1866
+
1867
+ case FORMATS.TIME:
1868
+ text = new Date(text).toLocaleString(locale, {
1869
+ year: 'hour',
1870
+ month: 'minute',
1871
+ day: 'second'
1872
+ });
1873
+ break;
1874
+ }
1875
+ }
1876
+
1829
1877
  return /*#__PURE__*/React.createElement("td", {
1830
1878
  key: field.id,
1831
1879
  className: "entity-cell " + field.id
1832
- }, value[field.id]);
1880
+ }, text);
1833
1881
  });
1834
1882
  };
1835
1883
  /**