ywana-core8 0.0.508 → 0.0.509

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