react-tabulator
Advanced tools
Comparing version 0.5.6 to 0.5.8
@@ -1,2 +0,2 @@ | ||
## [0.5.6] - 2018-10-14 | ||
## [0.5.8] - 2018-10-14 | ||
@@ -3,0 +3,0 @@ ### Added |
"use strict"; | ||
exports.__esModule = true; | ||
var ReactTabulator_1 = require("./ReactTabulator"); | ||
var React15Tabulator_1 = require("./React15Tabulator"); | ||
var ReactTabulatorExample_1 = require("./ReactTabulatorExample"); | ||
module.exports = { | ||
ReactTabulator: ReactTabulator_1["default"], | ||
React15Tabulator: React15Tabulator_1["default"], | ||
ReactTabulatorExample: ReactTabulatorExample_1["default"] | ||
}; |
@@ -33,2 +33,14 @@ "use strict"; | ||
var Tabulator = require('tabulator-tables'); | ||
function isSameArray(a, b) { | ||
var i = a.length; | ||
if (i !== b.length) { | ||
return false; | ||
} | ||
while (i--) { | ||
if (a[i] !== b[i]) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
} | ||
var default_1 = /** @class */ (function (_super) { | ||
@@ -90,4 +102,7 @@ __extends(default_1, _super); | ||
} | ||
if (state && props.data.length > 0) { | ||
return __assign({}, state, { data: props.data }); // this triggers componentDidUpdate | ||
if (state && props.data) { | ||
// this triggers componentDidUpdate | ||
if (!isSameArray(state.data, props.data)) { | ||
return __assign({}, state, { data: props.data }); | ||
} | ||
} | ||
@@ -105,2 +120,3 @@ return {}; | ||
default_1.prototype.componentDidUpdate = function () { | ||
// console.log('- componentDidUpdate'); | ||
this.table.setData(this.state.data); | ||
@@ -107,0 +123,0 @@ }; |
@@ -68,2 +68,5 @@ "use strict"; | ||
}; | ||
_this.clearData = function () { | ||
_this.setState({ data: [] }); | ||
}; | ||
return _this; | ||
@@ -80,4 +83,6 @@ } | ||
React.createElement("h3", null, | ||
"Asynchronous data loading: (e.g. fetch) - ", | ||
React.createElement("button", { onClick: this.setData }, "Set Data")), | ||
"Asynchronous data: (e.g. fetch) - ", | ||
React.createElement("button", { onClick: this.setData }, "Set Data"), | ||
' ', | ||
React.createElement("button", { onClick: this.clearData }, "Clear")), | ||
React.createElement(ReactTabulator_1["default"], { columns: columns, data: this.state.data }), | ||
@@ -84,0 +89,0 @@ React.createElement("h3", null, "Editable Table"), |
{ | ||
"name": "react-tabulator", | ||
"version": "0.5.6", | ||
"version": "0.5.8", | ||
"description": "React Tabulator component", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
502245
34
6330