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/npm/react-restful-table@0.0.2/lib/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/react-restful-table@0.0.2/lib/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","'use strict';\n\nvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nfunction _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar ReactBSTable = require('react-bootstrap-table');\nvar BootstrapTable = ReactBSTable.BootstrapTable;\nvar TableHeaderColumn = ReactBSTable.TableHeaderColumn;\n// var Promise=require('bluebird');\nvar agent = require('superagent-promise')(require('superagent'), Promise);\n\nvar RestfulTable = function (_React$Component) {\n    _inherits(RestfulTable, _React$Component);\n\n    function RestfulTable(props) {\n        _classCallCheck(this, RestfulTable);\n\n        var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(RestfulTable).call(this, props));\n\n        _this.state = {\n            data: []\n        };\n        return _this;\n    }\n\n    _createClass(RestfulTable, [{\n        key: 'render',\n        value: function render() {\n            var me = this;\n            var optionsProp = {\n                afterTableComplete: me.onAfterTableComplete.bind(me), // A hook for after table render complete.\n                afterDeleteRow: me.onAfterDeleteRow.bind(me), // A hook for after droping rows.\n                afterInsertRow: me.onAfterInsertRow.bind(me) // A hook for after insert rows\n            };\n            var cellEditProp = {\n                mode: \"click\",\n                blurToSave: true,\n                afterSaveCell: me.onAfterSaveCell.bind(me)\n            };\n\n            var _props = this.props;\n            var data = _props.data;\n            var keyField = _props.keyField;\n            var cellEdit = _props.cellEdit;\n            var options = _props.options;\n\n            var others = _objectWithoutProperties(_props, ['data', 'keyField', 'cellEdit', 'options']);\n\n            cellEditProp = Object.assign({}, cellEdit, cellEditProp);\n            optionsProp = Object.assign({}, options, optionsProp);\n            return React.createElement(\n                BootstrapTable,\n                _extends({\n                    data: this.state.data, keyField: keyField, remote: true, cellEdit: cellEditProp, options: optionsProp }, others),\n                this.props.children\n            );\n        }\n    }, {\n        key: 'onAfterTableComplete',\n        value: function onAfterTableComplete() {}\n    }, {\n        key: 'onAfterDeleteRow',\n        value: function onAfterDeleteRow(rowKeys) {\n            var _this2 = this;\n\n            var me = this;\n            console.log('delete', rowKeys);\n            var key = rowKeys[0]; //目前只删除第一行\n            var url = this.props.url;\n\n            agent.del(url + '/' + key).then(function (resp) {\n                console.log(resp.body);\n                var data = me.state.data;\n\n                data = data.filter(function (product) {\n                    return product._id !== key;\n                });\n\n                _this2.setState({\n                    data: data\n                });\n            });\n        }\n    }, {\n        key: 'onAfterInsertRow',\n        value: function onAfterInsertRow(row) {\n            var _this3 = this;\n\n            var _props2 = this.props;\n            var url = _props2.url;\n            var keyField = _props2.keyField;\n\n            // delete row[keyField];\n            // console.log('insert',row);\n            agent.post(url, row).then(function (resp) {\n                console.log(resp.body);\n                var data = _this3.state.data;\n\n                data.push(resp.body);\n                _this3.setState({ data: data });\n            });\n        }\n    }, {\n        key: 'onAfterSaveCell',\n        value: function onAfterSaveCell(row, cellName, cellValue) {\n            var _props3 = this.props;\n            var url = _props3.url;\n            var keyField = _props3.keyField;\n            // console.log('save',row, cellName, cellValue);\n\n            agent.put(url + '/' + row[keyField], row).then(function (resp) {\n                // console.log(resp.body)\n            });\n        }\n    }, {\n        key: 'componentWillMount',\n        value: function componentWillMount() {}\n    }, {\n        key: 'componentDidMount',\n        value: function componentDidMount() {\n            var _this4 = this;\n\n            var url = this.props.url;\n\n            agent.get(url).then(function (resp) {\n                var data = resp.body;\n                _this4.setState({ data: data });\n            });\n        }\n    }, {\n        key: 'componentWillReceiveProps',\n        value: function componentWillReceiveProps(nextProps) {}\n    }, {\n        key: 'shouldComponentUpdate',\n        value: function shouldComponentUpdate(nextProps, nextState) {\n            return true;\n        }\n    }, {\n        key: 'componentWillUpdate',\n        value: function componentWillUpdate(nextProps, nextState) {}\n    }, {\n        key: 'componentDidUpdate',\n        value: function componentDidUpdate(prevProps, prevState) {}\n    }, {\n        key: 'componentWillUnmount',\n        value: function componentWillUnmount() {}\n    }]);\n\n    return RestfulTable;\n}(React.Component);\n\nRestfulTable.propTypes = {\n    url: React.PropTypes.string.isRequired,\n    keyField: React.PropTypes.string.isRequired\n};\n\n\nmodule.exports = RestfulTable;\n"]}