react-bootstrap-table2-editor
Advanced tools
Comparing version 0.1.1 to 0.1.2
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):"object"==typeof exports?exports.ReactBootstrapTable=t(require("react")):e.ReactBootstrapTable=t(e.React)}(this,function(e){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=41)}({0:function(t,n){t.exports=e},1:function(e,t,n){e.exports=n(4)()},13:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.TIME_TO_CLOSE_MESSAGE=3e3,t.DELAY_FOR_DBCLICK=200,t.CLICK_TO_CELL_EDIT="click",t.DBCLICK_TO_CELL_EDIT="dbclick"},4:function(e,t,n){"use strict";var r=n(5),o=n(6),i=n(7);e.exports=function(){function e(e,t,n,r,a,l){l!==i&&o(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types")}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t};return n.checkPropTypes=r,n.PropTypes=n,n}},41:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(42),i=r(o),a=n(43),l=r(a),u=n(13);t.default=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{wrapperFactory:i.default,editingCellFactory:l.default,CLICK_TO_CELL_EDIT:u.CLICK_TO_CELL_EDIT,DBCLICK_TO_CELL_EDIT:u.DBCLICK_TO_CELL_EDIT,DELAY_FOR_DBCLICK:u.DELAY_FOR_DBCLICK,options:e}}},42:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function l(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),c=n(0),f=r(c),d=n(1),p=r(d),h=n(13);t.default=function(e,t){var n,r,d=t._,y=t.remoteResolver,v=void 0;return r=n=function(t){function n(e){i(this,n);var t=a(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e));return v=e.cellEdit.editingCellFactory(d),t.startEditing=t.startEditing.bind(t),t.escapeEditing=t.escapeEditing.bind(t),t.completeEditing=t.completeEditing.bind(t),t.handleCellUpdate=t.handleCellUpdate.bind(t),t.state={ridx:null,cidx:null,message:null,isDataChanged:!1},t}return l(n,t),s(n,[{key:"componentWillReceiveProps",value:function(e){e.cellEdit&&this.isRemoteCellEdit()?e.cellEdit.options.errorMessage?this.setState(function(){return{isDataChanged:!1,message:e.cellEdit.options.errorMessage}}):(this.setState(function(){return{isDataChanged:!0}}),this.escapeEditing()):this.setState(function(){return{isDataChanged:!1}})}},{key:"handleCellUpdate",value:function(e,t,n){var r=this.props,o=r.keyField,i=r.cellEdit,a=r.store,l=i.options,u=l.beforeSaveCell,s=l.afterSaveCell,c=d.get(e,t.dataField),f=d.get(e,o);d.isFunction(u)&&u(c,n,e,t),this.isRemoteCellEdit()?this.handleCellChange(f,t.dataField,n):(a.edit(f,t.dataField,n),d.isFunction(s)&&s(c,n,e,t),this.completeEditing())}},{key:"completeEditing",value:function(){this.setState(function(){return{ridx:null,cidx:null,message:null,isDataChanged:!0}})}},{key:"startEditing",value:function(e,t){var n=this,r=this.props.selectRow;r&&!r.clickToEdit&&r.clickToSelect||function(){n.setState(function(){return{ridx:e,cidx:t,isDataChanged:!1}})}()}},{key:"escapeEditing",value:function(){this.setState(function(){return{ridx:null,cidx:null}})}},{key:"render",value:function(){var t=this.state,n=t.isDataChanged,r=o(t,["isDataChanged"]),i=this.props.cellEdit,a=i.options,l=a.nonEditableRows,s=(a.errorMessage,o(a,["nonEditableRows","errorMessage"])),c=(i.editingCellFactory,o(i,["options","editingCellFactory"])),p=u({},s,c,r,{EditingCell:v,nonEditableRows:d.isDefined(l)?l():[],onStart:this.startEditing,onEscape:this.escapeEditing,onUpdate:this.handleCellUpdate});return f.default.createElement(e,u({},this.props,{data:this.props.store.data,isDataChanged:n,cellEdit:p}))}}]),n}(y(c.Component)),n.propTypes={options:p.default.shape({mode:p.default.oneOf([h.CLICK_TO_CELL_EDIT,h.DBCLICK_TO_CELL_EDIT]).isRequired,onErrorMessageDisappear:p.default.func,blurToSave:p.default.bool,beforeSaveCell:p.default.func,afterSaveCell:p.default.func,nonEditableRows:p.default.func,timeToCloseMessage:p.default.number,errorMessage:p.default.string})},r}},43:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=n(0),c=r(s),f=n(8),d=r(f),p=n(1),h=r(p),y=n(44),v=r(y),b=n(45),m=r(b),g=n(13);t.default=function(e){var t,n;return n=t=function(t){function n(e){o(this,n);var t=i(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e));return t.indicatorTimer=null,t.clearTimer=t.clearTimer.bind(t),t.handleBlur=t.handleBlur.bind(t),t.handleClick=t.handleClick.bind(t),t.handleKeyDown=t.handleKeyDown.bind(t),t.beforeComplete=t.beforeComplete.bind(t),t.state={invalidMessage:null},t}return a(n,t),u(n,[{key:"componentWillReceiveProps",value:function(t){var n=t.message;e.isDefined(n)&&(this.createTimer(),this.setState(function(){return{invalidMessage:n}}))}},{key:"componentWillUnmount",value:function(){this.clearTimer()}},{key:"clearTimer",value:function(){this.indicatorTimer&&clearTimeout(this.indicatorTimer)}},{key:"createTimer",value:function(){var t=this;this.clearTimer();var n=this.props,r=n.timeToCloseMessage,o=n.onErrorMessageDisappear;this.indicatorTimer=e.sleep(function(){t.setState(function(){return{invalidMessage:null}}),e.isFunction(o)&&o()},r)}},{key:"beforeComplete",value:function(t,n,r){var o=this.props.onUpdate;if(e.isFunction(n.validator)){var i=n.validator(r,t,n);if(e.isObject(i)&&!i.valid)return this.setState(function(){return{invalidMessage:i.message}}),void this.createTimer()}o(t,n,r)}},{key:"handleBlur",value:function(){var t=this.props,n=t.onEscape,r=t.blurToSave,o=t.row,i=t.column;if(r){var a=this.editor.text.value;e.isDefined(a),this.beforeComplete(o,i,a)}else n()}},{key:"handleKeyDown",value:function(t){var n=this.props,r=n.onEscape,o=n.row,i=n.column;if(27===t.keyCode)r();else if(13===t.keyCode){var a=t.currentTarget.value;e.isDefined(a),this.beforeComplete(o,i,a)}}},{key:"handleClick",value:function(e){"TD"!==e.target.tagName&&e.stopPropagation()}},{key:"render",value:function(){var t=this,n=this.state.invalidMessage,r=this.props,o=r.row,i=r.column,a=r.className,u=r.style,s=i.dataField,f=e.get(o,s),p={onKeyDown:this.handleKeyDown,onBlur:this.handleBlur},h=e.isDefined(n),y=h?(0,d.default)("animated","shake"):null;return c.default.createElement("td",{className:(0,d.default)("react-bootstrap-table-editing-cell",a),style:u,onClick:this.handleClick},c.default.createElement(v.default,l({ref:function(e){return t.editor=e},defaultValue:f,className:y},p)),h?c.default.createElement(m.default,{invalidMessage:n}):null)}}]),n}(s.Component),t.propTypes={row:h.default.object.isRequired,column:h.default.object.isRequired,onUpdate:h.default.func.isRequired,onEscape:h.default.func.isRequired,timeToCloseMessage:h.default.number,className:h.default.string,style:h.default.object},t.defaultProps={timeToCloseMessage:g.TIME_TO_CLOSE_MESSAGE,className:null,style:{}},n}},44:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function l(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),c=n(0),f=r(c),d=n(8),p=r(d),h=n(1),y=r(h),v=function(e){function t(){return i(this,t),a(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return l(t,e),s(t,[{key:"componentDidMount",value:function(){var e=this.props.defaultValue;this.text.value=e,this.text.focus()}},{key:"render",value:function(){var e=this,t=this.props,n=(t.defaultValue,t.className),r=o(t,["defaultValue","className"]),i=(0,p.default)("form-control editor edit-text",n);return f.default.createElement("input",u({ref:function(t){return e.text=t},type:"text",className:i},r))}}]),t}(c.Component);v.propTypes={className:y.default.oneOfType([y.default.string,y.default.object]),defaultValue:y.default.oneOfType([y.default.string,y.default.number]).isRequired},v.defaultProps={className:null},t.default=v},45:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(0),i=r(o),a=n(1),l=r(a),u=function(e){var t=e.invalidMessage;return i.default.createElement("div",{className:"alert alert-danger fade in"},i.default.createElement("strong",null,t))};u.propTypes={invalidMessage:l.default.string},u.defaultProps={invalidMessage:null},t.default=u},5:function(e,t,n){"use strict";function r(e){return function(){return e}}var o=function(){};o.thatReturns=r,o.thatReturnsFalse=r(!1),o.thatReturnsTrue=r(!0),o.thatReturnsNull=r(null),o.thatReturnsThis=function(){return this},o.thatReturnsArgument=function(e){return e},e.exports=o},6:function(e,t,n){"use strict";function r(e,t,n,r,i,a,l,u){if(o(t),!e){var s;if(void 0===t)s=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[n,r,i,a,l,u],f=0;s=new Error(t.replace(/%s/g,function(){return c[f++]})),s.name="Invariant Violation"}throw s.framesToPop=1,s}}var o=function(e){};e.exports=r},7:function(e,t,n){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},8:function(e,t,n){var r,o;/*! | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):"object"==typeof exports?exports.ReactBootstrapTable=t(require("react")):e.ReactBootstrapTable=t(e.React)}(this,function(e){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=42)}({0:function(t,n){t.exports=e},1:function(e,t,n){e.exports=n(4)()},14:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.TIME_TO_CLOSE_MESSAGE=3e3,t.DELAY_FOR_DBCLICK=200,t.CLICK_TO_CELL_EDIT="click",t.DBCLICK_TO_CELL_EDIT="dbclick"},4:function(e,t,n){"use strict";var r=n(5),o=n(6),i=n(7);e.exports=function(){function e(e,t,n,r,a,l){l!==i&&o(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types")}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t};return n.checkPropTypes=r,n.PropTypes=n,n}},42:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(43),i=r(o),a=n(44),l=r(a),u=n(14);t.default=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{wrapperFactory:i.default,editingCellFactory:l.default,CLICK_TO_CELL_EDIT:u.CLICK_TO_CELL_EDIT,DBCLICK_TO_CELL_EDIT:u.DBCLICK_TO_CELL_EDIT,DELAY_FOR_DBCLICK:u.DELAY_FOR_DBCLICK,options:e}}},43:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function l(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),c=n(0),f=r(c),d=n(1),p=r(d),h=n(14);t.default=function(e,t){var n,r,d=t._,y=t.remoteResolver,v=void 0;return r=n=function(t){function n(e){i(this,n);var t=a(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e));return v=e.cellEdit.editingCellFactory(d),t.startEditing=t.startEditing.bind(t),t.escapeEditing=t.escapeEditing.bind(t),t.completeEditing=t.completeEditing.bind(t),t.handleCellUpdate=t.handleCellUpdate.bind(t),t.state={ridx:null,cidx:null,message:null,isDataChanged:!1},t}return l(n,t),s(n,[{key:"componentWillReceiveProps",value:function(e){e.cellEdit&&this.isRemoteCellEdit()?e.cellEdit.options.errorMessage?this.setState(function(){return{isDataChanged:!1,message:e.cellEdit.options.errorMessage}}):(this.setState(function(){return{isDataChanged:!0}}),this.escapeEditing()):this.setState(function(){return{isDataChanged:!1}})}},{key:"handleCellUpdate",value:function(e,t,n){var r=this.props,o=r.keyField,i=r.cellEdit,a=r.store,l=i.options,u=l.beforeSaveCell,s=l.afterSaveCell,c=d.get(e,t.dataField),f=d.get(e,o);d.isFunction(u)&&u(c,n,e,t),this.isRemoteCellEdit()?this.handleCellChange(f,t.dataField,n):(a.edit(f,t.dataField,n),d.isFunction(s)&&s(c,n,e,t),this.completeEditing())}},{key:"completeEditing",value:function(){this.setState(function(){return{ridx:null,cidx:null,message:null,isDataChanged:!0}})}},{key:"startEditing",value:function(e,t){var n=this,r=this.props.selectRow;r&&!r.clickToEdit&&r.clickToSelect||function(){n.setState(function(){return{ridx:e,cidx:t,isDataChanged:!1}})}()}},{key:"escapeEditing",value:function(){this.setState(function(){return{ridx:null,cidx:null}})}},{key:"render",value:function(){var t=this.state,n=t.isDataChanged,r=o(t,["isDataChanged"]),i=this.props.cellEdit,a=i.options,l=a.nonEditableRows,s=(a.errorMessage,o(a,["nonEditableRows","errorMessage"])),c=(i.editingCellFactory,o(i,["options","editingCellFactory"])),p=u({},s,c,r,{EditingCell:v,nonEditableRows:d.isDefined(l)?l():[],onStart:this.startEditing,onEscape:this.escapeEditing,onUpdate:this.handleCellUpdate});return f.default.createElement(e,u({},this.props,{data:this.props.store.data,isDataChanged:n,cellEdit:p}))}}]),n}(y(c.Component)),n.propTypes={options:p.default.shape({mode:p.default.oneOf([h.CLICK_TO_CELL_EDIT,h.DBCLICK_TO_CELL_EDIT]).isRequired,onErrorMessageDisappear:p.default.func,blurToSave:p.default.bool,beforeSaveCell:p.default.func,afterSaveCell:p.default.func,nonEditableRows:p.default.func,timeToCloseMessage:p.default.number,errorMessage:p.default.string})},r}},44:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=n(0),c=r(s),f=n(8),d=r(f),p=n(1),h=r(p),y=n(45),v=r(y),b=n(46),m=r(b),g=n(14);t.default=function(e){var t,n;return n=t=function(t){function n(e){o(this,n);var t=i(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e));return t.indicatorTimer=null,t.clearTimer=t.clearTimer.bind(t),t.handleBlur=t.handleBlur.bind(t),t.handleClick=t.handleClick.bind(t),t.handleKeyDown=t.handleKeyDown.bind(t),t.beforeComplete=t.beforeComplete.bind(t),t.state={invalidMessage:null},t}return a(n,t),u(n,[{key:"componentWillReceiveProps",value:function(t){var n=t.message;e.isDefined(n)&&(this.createTimer(),this.setState(function(){return{invalidMessage:n}}))}},{key:"componentWillUnmount",value:function(){this.clearTimer()}},{key:"clearTimer",value:function(){this.indicatorTimer&&clearTimeout(this.indicatorTimer)}},{key:"createTimer",value:function(){var t=this;this.clearTimer();var n=this.props,r=n.timeToCloseMessage,o=n.onErrorMessageDisappear;this.indicatorTimer=e.sleep(function(){t.setState(function(){return{invalidMessage:null}}),e.isFunction(o)&&o()},r)}},{key:"beforeComplete",value:function(t,n,r){var o=this.props.onUpdate;if(e.isFunction(n.validator)){var i=n.validator(r,t,n);if(e.isObject(i)&&!i.valid)return this.setState(function(){return{invalidMessage:i.message}}),void this.createTimer()}o(t,n,r)}},{key:"handleBlur",value:function(){var t=this.props,n=t.onEscape,r=t.blurToSave,o=t.row,i=t.column;if(r){var a=this.editor.text.value;e.isDefined(a),this.beforeComplete(o,i,a)}else n()}},{key:"handleKeyDown",value:function(t){var n=this.props,r=n.onEscape,o=n.row,i=n.column;if(27===t.keyCode)r();else if(13===t.keyCode){var a=t.currentTarget.value;e.isDefined(a),this.beforeComplete(o,i,a)}}},{key:"handleClick",value:function(e){"TD"!==e.target.tagName&&e.stopPropagation()}},{key:"render",value:function(){var t=this,n=this.state.invalidMessage,r=this.props,o=r.row,i=r.column,a=r.className,u=r.style,s=i.dataField,f=e.get(o,s),p={onKeyDown:this.handleKeyDown,onBlur:this.handleBlur},h=e.isDefined(n),y=h?(0,d.default)("animated","shake"):null;return c.default.createElement("td",{className:(0,d.default)("react-bootstrap-table-editing-cell",a),style:u,onClick:this.handleClick},c.default.createElement(v.default,l({ref:function(e){return t.editor=e},defaultValue:f,className:y},p)),h?c.default.createElement(m.default,{invalidMessage:n}):null)}}]),n}(s.Component),t.propTypes={row:h.default.object.isRequired,column:h.default.object.isRequired,onUpdate:h.default.func.isRequired,onEscape:h.default.func.isRequired,timeToCloseMessage:h.default.number,className:h.default.string,style:h.default.object},t.defaultProps={timeToCloseMessage:g.TIME_TO_CLOSE_MESSAGE,className:null,style:{}},n}},45:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function l(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),c=n(0),f=r(c),d=n(8),p=r(d),h=n(1),y=r(h),v=function(e){function t(){return i(this,t),a(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return l(t,e),s(t,[{key:"componentDidMount",value:function(){var e=this.props.defaultValue;this.text.value=e,this.text.focus()}},{key:"render",value:function(){var e=this,t=this.props,n=(t.defaultValue,t.className),r=o(t,["defaultValue","className"]),i=(0,p.default)("form-control editor edit-text",n);return f.default.createElement("input",u({ref:function(t){return e.text=t},type:"text",className:i},r))}}]),t}(c.Component);v.propTypes={className:y.default.oneOfType([y.default.string,y.default.object]),defaultValue:y.default.oneOfType([y.default.string,y.default.number])},v.defaultProps={className:null,defaultValue:""},t.default=v},46:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(0),i=r(o),a=n(1),l=r(a),u=function(e){var t=e.invalidMessage;return i.default.createElement("div",{className:"alert alert-danger fade in"},i.default.createElement("strong",null,t))};u.propTypes={invalidMessage:l.default.string},u.defaultProps={invalidMessage:null},t.default=u},5:function(e,t,n){"use strict";function r(e){return function(){return e}}var o=function(){};o.thatReturns=r,o.thatReturnsFalse=r(!1),o.thatReturnsTrue=r(!0),o.thatReturnsNull=r(null),o.thatReturnsThis=function(){return this},o.thatReturnsArgument=function(e){return e},e.exports=o},6:function(e,t,n){"use strict";function r(e,t,n,r,i,a,l,u){if(o(t),!e){var s;if(void 0===t)s=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[n,r,i,a,l,u],f=0;s=new Error(t.replace(/%s/g,function(){return c[f++]})),s.name="Invariant Violation"}throw s.framesToPop=1,s}}var o=function(e){};e.exports=r},7:function(e,t,n){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},8:function(e,t,n){var r,o;/*! | ||
Copyright (c) 2016 Jed Watson. | ||
@@ -3,0 +3,0 @@ Licensed under the MIT License (MIT), see |
@@ -77,7 +77,8 @@ 'use strict'; | ||
className: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.object]), | ||
defaultValue: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.number]).isRequired | ||
defaultValue: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.number]) | ||
}; | ||
TextEditor.defaultProps = { | ||
className: null | ||
className: null, | ||
defaultValue: '' | ||
}; | ||
exports.default = TextEditor; |
{ | ||
"name": "react-bootstrap-table2-editor", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "it's the editor addon for react-bootstrap-table2", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
Sorry, the diff of this file is too big to display
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
118831
1530