aio-table 6.1.1 → 6.1.2
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/index.js +27 -21
- package/package.json +1 -1
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 &&
|
|
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 (
|
|
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
|
|
1765
|
-
type =
|
|
1766
|
-
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
|
-
|
|
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
|
|
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 (!
|
|
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(
|
|
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
|
|
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
|
-
}),
|
|
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
|
-
|
|
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 (
|
|
2002
|
+
if (_this18.inlineEdit) {
|
|
1997
2003
|
if (focused !== cellId) {
|
|
1998
2004
|
SetState({
|
|
1999
2005
|
focused: cellId
|