aio-table 6.1.1 → 6.1.4

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.
Files changed (3) hide show
  1. package/index.css +1 -1
  2. package/index.js +27 -21
  3. package/package.json +32 -32
package/index.css CHANGED
@@ -141,7 +141,7 @@
141
141
  position:relative;
142
142
  color:inherit;
143
143
  font-size:inherit;
144
-
144
+ font-family:inherit;
145
145
  }
146
146
  select.aio-table-input{
147
147
  background: rgba(0,0,0,0.02);
package/index.js CHANGED
@@ -1722,7 +1722,7 @@ var AIOTableCell = /*#__PURE__*/function (_Component7) {
1722
1722
  content = fn.getOptionsCell(template);
1723
1723
  } else if (template === 'gantt') {
1724
1724
  content = fn.getGanttCell(row, column);
1725
- } else if (template && column.inlineEdit) {
1725
+ } else if (template && this.inlineEdit) {
1726
1726
  if (!focused) {
1727
1727
  content = template;
1728
1728
  } else {
@@ -1730,7 +1730,7 @@ var AIOTableCell = /*#__PURE__*/function (_Component7) {
1730
1730
  }
1731
1731
  } else if (template) {
1732
1732
  content = template;
1733
- } else if (column.inlineEdit) {
1733
+ } else if (this.inlineEdit) {
1734
1734
  content = this.getInput(row, column);
1735
1735
  } else if (column.getValue) {
1736
1736
  content = value;
@@ -1761,26 +1761,33 @@ var AIOTableCell = /*#__PURE__*/function (_Component7) {
1761
1761
  value: function getInput(row, column) {
1762
1762
  var _this17 = this;
1763
1763
 
1764
- var _column$inlineEdit = column.inlineEdit,
1765
- type = _column$inlineEdit.type,
1766
- getValue = _column$inlineEdit.getValue;
1764
+ var _this$inlineEdit = this.inlineEdit,
1765
+ type = _this$inlineEdit.type,
1766
+ getValue = _this$inlineEdit.getValue,
1767
+ _this$inlineEdit$disa = _this$inlineEdit.disabled,
1768
+ disabled = _this$inlineEdit$disa === void 0 ? function () {
1769
+ return false;
1770
+ } : _this$inlineEdit$disa;
1767
1771
  var renderIndex = this.props.renderIndex;
1768
1772
  var value = this.state.value;
1769
- var _column$inlineEdit$di = column.inlineEdit.disabled,
1770
- disabled = _column$inlineEdit$di === void 0 ? function () {
1771
- return false;
1772
- } : _column$inlineEdit$di;
1773
1773
 
1774
1774
  if (getValue) {
1775
1775
  value = getValue(row);
1776
1776
  }
1777
1777
 
1778
- var props = { ...column.inlineEdit,
1778
+ if (disabled(row)) {
1779
+ if (typeof value === 'boolean') {
1780
+ return JSON.stringify(value);
1781
+ }
1782
+
1783
+ return value;
1784
+ }
1785
+
1786
+ var props = { ...this.inlineEdit,
1779
1787
  className: 'aio-table-input',
1780
1788
  rowindex: renderIndex,
1781
1789
  colindex: column._renderIndex,
1782
- value: value === null || value === undefined ? '' : value,
1783
- disabled: disabled(row)
1790
+ value: value === null || value === undefined ? '' : value
1784
1791
  };
1785
1792
 
1786
1793
  if (type === 'text' || type === 'number') {
@@ -1804,7 +1811,7 @@ var AIOTableCell = /*#__PURE__*/function (_Component7) {
1804
1811
  loading: true
1805
1812
  });
1806
1813
 
1807
- var res = await column.inlineEdit.onChange(row, type === 'number' ? parseFloat(value) : value);
1814
+ var res = await _this17.inlineEdit.onChange(row, type === 'number' ? parseFloat(value) : value);
1808
1815
 
1809
1816
  _this17.setState({
1810
1817
  loading: false
@@ -1826,12 +1833,12 @@ var AIOTableCell = /*#__PURE__*/function (_Component7) {
1826
1833
  }
1827
1834
 
1828
1835
  if (type === 'select') {
1829
- if (!column.inlineEdit.options) {
1836
+ if (!this.inlineEdit.options) {
1830
1837
  console.error('aio table => missing options property of column inlineEdit with type="select"');
1831
1838
  return '';
1832
1839
  }
1833
1840
 
1834
- if (!Array.isArray(column.inlineEdit.options)) {
1841
+ if (!Array.isArray(this.inlineEdit.options)) {
1835
1842
  console.error('aio table => options property of column inlineEdit with type="select" must be an array of objects . each object must have text and value property!!!');
1836
1843
  return '';
1837
1844
  }
@@ -1861,7 +1868,7 @@ var AIOTableCell = /*#__PURE__*/function (_Component7) {
1861
1868
  value: value
1862
1869
  });
1863
1870
 
1864
- var res = await column.inlineEdit.onChange(row, value);
1871
+ var res = await _this17.inlineEdit.onChange(row, value);
1865
1872
 
1866
1873
  _this17.setState({
1867
1874
  loading: false
@@ -1877,7 +1884,7 @@ var AIOTableCell = /*#__PURE__*/function (_Component7) {
1877
1884
  });
1878
1885
  }
1879
1886
  }
1880
- }), column.inlineEdit.options.map(function (o, i) {
1887
+ }), this.inlineEdit.options.map(function (o, i) {
1881
1888
  return /*#__PURE__*/_react.default.createElement("option", {
1882
1889
  key: i,
1883
1890
  value: o.value
@@ -1893,9 +1900,7 @@ var AIOTableCell = /*#__PURE__*/function (_Component7) {
1893
1900
  }, {
1894
1901
  key: "componentDidUpdate",
1895
1902
  value: function componentDidUpdate() {
1896
- var column = this.props.column;
1897
-
1898
- if (column.inlineEdit && column.inlineEdit.type === 'select' && this.focus) {
1903
+ if (this.inlineEdit && this.inlineEdit.type === 'select' && this.focus) {
1899
1904
  (0, _jquery.default)(this.dom.current).find('.aio-table-input').focus();
1900
1905
  }
1901
1906
  }
@@ -1918,6 +1923,7 @@ var AIOTableCell = /*#__PURE__*/function (_Component7) {
1918
1923
  value = _this$props15.value,
1919
1924
  cellId = _this$props15.cellId,
1920
1925
  renderIndex = _this$props15.renderIndex;
1926
+ this.inlineEdit = typeof column.inlineEdit === 'function' ? column.inlineEdit(row, column) : column.inlineEdit;
1921
1927
 
1922
1928
  if (this.state.prevValue !== value) {
1923
1929
  setTimeout(function () {
@@ -1993,7 +1999,7 @@ var AIOTableCell = /*#__PURE__*/function (_Component7) {
1993
1999
  return _onDrop2(row);
1994
2000
  },
1995
2001
  onClick: function onClick(e) {
1996
- if (column.inlineEdit) {
2002
+ if (_this18.inlineEdit) {
1997
2003
  if (focused !== cellId) {
1998
2004
  SetState({
1999
2005
  focused: cellId
package/package.json CHANGED
@@ -1,32 +1,32 @@
1
- {
2
- "name": "aio-table",
3
- "version": "6.1.1",
4
- "description": "all in one table. tree mode , simple mode , tree mode, gantt mode , groupby mode, freeze mode.",
5
- "main": "index.js",
6
- "scripts": {
7
- "test": "echo \"Error: no test specified\" && exit 1"
8
- },
9
- "repository": {
10
- "type": "git",
11
- "url": "git+https://github.com/mohammadFeiz/aio-table.git"
12
- },
13
- "author": "",
14
- "license": "ISC",
15
- "bugs": {
16
- "url": "https://github.com/mohammadFeiz/aio-table/issues"
17
- },
18
- "homepage": "https://github.com/mohammadFeiz/aio-table#readme",
19
- "dependencies": {
20
- "@mdi/js": "5.9.55",
21
- "@mdi/react": "1.5.0",
22
- "jquery": "3.6.0",
23
- "prop-types": "^15.7.2",
24
- "aio-button": "^3.0.1",
25
- "r-range-slider": "^4.0.0",
26
- "react": "17.0.0",
27
- "react-dom": "17.0.0"
28
- },
29
- "devDependencies": {
30
- "react-scripts": "latest"
31
- }
32
- }
1
+ {
2
+ "name": "aio-table",
3
+ "version": "6.1.4",
4
+ "description": "all in one table. tree mode , simple mode , tree mode, gantt mode , groupby mode, freeze mode.",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1"
8
+ },
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/mohammadFeiz/aio-table.git"
12
+ },
13
+ "author": "",
14
+ "license": "ISC",
15
+ "bugs": {
16
+ "url": "https://github.com/mohammadFeiz/aio-table/issues"
17
+ },
18
+ "homepage": "https://github.com/mohammadFeiz/aio-table#readme",
19
+ "dependencies": {
20
+ "@mdi/js": "5.9.55",
21
+ "@mdi/react": "1.5.0",
22
+ "jquery": "3.6.0",
23
+ "prop-types": "^15.7.2",
24
+ "aio-button": "^4.3.1",
25
+ "r-range-slider": "^4.0.0",
26
+ "react": "17.0.0",
27
+ "react-dom": "17.0.0"
28
+ },
29
+ "devDependencies": {
30
+ "react-scripts": "latest"
31
+ }
32
+ }