react-bootstrap-table2-editor
Advanced tools
Comparing version 1.3.1 to 1.3.2
@@ -6,2 +6,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.ReactBootstrapTable2Editor=t(require("react")):e.ReactBootstrapTable2Editor=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=5)}([function(t,n){t.exports=e},function(e,t,n){e.exports=n(6)()},function(e,t,n){var r,o;/*! | ||
*/ | ||
!function(){"use strict";function n(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var o=typeof r;if("string"===o||"number"===o)e.push(r);else if(Array.isArray(r))e.push(n.apply(null,r));else if("object"===o)for(var i in r)a.call(r,i)&&r[i]&&e.push(i)}}return e.join(" ")}var a={}.hasOwnProperty;void 0!==e&&e.exports?e.exports=n:(r=[],void 0!==(o=function(){return n}.apply(t,r))&&(e.exports=o))}()},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",t.EDITTYPE={TEXT:"text",SELECT:"select",TEXTAREA:"textarea",CHECKBOX:"checkbox",DATE:"date"}},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 a(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 u(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}),t.Consumer=void 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},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),y=n(3),h=f.default.createContext();t.default=function(e,t,n,r){var c=function(c){function d(e){a(this,d);var t=i(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,e));return t.doUpdate=t.doUpdate.bind(t),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},t}return u(d,c),s(d,[{key:"componentWillReceiveProps",value:function(e){e.cellEdit&&n()&&(e.cellEdit.options.errorMessage?this.setState(function(){return{message:e.cellEdit.options.errorMessage}}):this.escapeEditing())}},{key:"handleCellUpdate",value:function(n,r,o){var a=this,i=t.typeConvert(r.type,o),u=this.props.cellEdit,l=u.options.beforeSaveCell,s=e.get(n,r.dataField),c=function(){arguments.length>0&&void 0!==arguments[0]&&!arguments[0]?a.escapeEditing():a.doUpdate(n,r,i)};if(e.isFunction(l)){var f=l(s,i,n,r,c);if(e.isObject(f)&&f.async)return}this.doUpdate(n,r,i)}},{key:"doUpdate",value:function(o,a,i){var u=this.props,l=u.keyField,s=u.cellEdit,c=u.data,f=s.options.afterSaveCell,d=e.get(o,l),p=e.get(o,a.dataField);n()?r(d,a.dataField,i):(t.editCell(c,l,d,a.dataField,i),e.isFunction(f)&&f(p,i,o,a),this.completeEditing())}},{key:"completeEditing",value:function(){this.setState(function(){return{ridx:null,cidx:null,message:null}})}},{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}})}()}},{key:"escapeEditing",value:function(){this.setState(function(){return{ridx:null,cidx:null}})}},{key:"render",value:function(){var t=this.props.cellEdit,n=t.options,r=n.nonEditableRows,a=(n.errorMessage,o(n,["nonEditableRows","errorMessage"])),i=o(t,["options"]),u=l({},a,i,this.state,{nonEditableRows:e.isDefined(r)?r():[],onStart:this.startEditing,onEscape:this.escapeEditing,onUpdate:this.handleCellUpdate});return f.default.createElement(h.Provider,{value:l({},u)},this.props.children)}}]),d}(f.default.Component);return c.propTypes={data:p.default.array.isRequired,selectRow:p.default.object,options:p.default.shape({mode:p.default.oneOf([y.CLICK_TO_CELL_EDIT,y.DBCLICK_TO_CELL_EDIT]).isRequired,onErrorMessageDisappear:p.default.func,blurToSave:p.default.bool,beforeSaveCell:p.default.func,afterSaveCell:p.default.func,onStartEdit:p.default.func,nonEditableRows:p.default.func,timeToCloseMessage:p.default.number,errorMessage:p.default.any})},{Provider:c}};t.Consumer=h.Consumer},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.Type=void 0;var o=n(4),a=r(o),i=n(10),u=r(i),l=n(11),s=r(l),c=n(3);t.default=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{createContext:a.default,createEditingCell:s.default,withRowLevelCellEdit:u.default,DBCLICK_TO_CELL_EDIT:c.DBCLICK_TO_CELL_EDIT,DELAY_FOR_DBCLICK:c.DELAY_FOR_DBCLICK,options:e}};t.Type=c.EDITTYPE},function(e,t,n){"use strict";var r=n(7),o=n(8),a=n(9);e.exports=function(){function e(e,t,n,r,i,u){u!==a&&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}},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},function(e,t,n){"use strict";function r(e,t,n,r,a,i,u,l){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,a,i,u,l],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},function(e,t,n){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=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},o=n(0),a=function(e){return e&&e.__esModule?e:{default:e}}(o),i=n(3),u=n(4);t.default=function(e,t){function n(e){return a.default.createElement(u.Consumer,null,function(t){return o(e,t)})}var o=function(n,o){var u=n.value,l=!(o.nonEditableRows.length>0&&o.nonEditableRows.indexOf(u)>-1),s={};return t&&o.mode===i.DBCLICK_TO_CELL_EDIT&&(s.DELAY_FOR_DBCLICK=i.DELAY_FOR_DBCLICK),a.default.createElement(e,r({},n,s,{editingRowIdx:o.ridx,editingColIdx:o.cidx,editable:l,onStart:o.onStart,clickToEdit:o.mode===i.CLICK_TO_CELL_EDIT,dbclickToEdit:o.mode===i.DBCLICK_TO_CELL_EDIT}))};return n.displayName="WithCellEditingRowConsumer",n}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=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},a=n(0),i=r(a),u=n(4),l=n(12),s=r(l);t.default=function(e,t){var n=(0,s.default)(e,t),r=function(t,r){var a=e.get(t.row,t.column.dataField),u=t.column.editCellStyle||{},l=t.column.editCellClasses;return e.isFunction(t.column.editCellStyle)&&(u=t.column.editCellStyle(a,t.row,t.rowIndex,t.columnIndex)),e.isFunction(t.column.editCellClasses)&&(l=t.column.editCellClasses(a,t.row,t.rowIndex,t.columnIndex)),i.default.createElement(n,o({},t,{className:l,style:u},r))};return function(e){return i.default.createElement(u.Consumer,null,function(t){return r(e,t)})}}},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 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 i(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},l=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(2),d=r(f),p=n(1),y=r(p),h=n(13),v=r(h),b=n(14),m=r(b),O=n(15),g=r(O),_=n(16),E=r(_),T=n(17),C=r(T),w=n(18),j=r(w),x=n(3);t.default=function(e,t){var n,r;return r=n=function(n){function r(e){o(this,r);var t=a(this,(r.__proto__||Object.getPrototypeOf(r)).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.asyncbeforeCompete=t.asyncbeforeCompete.bind(t),t.displayErrorMessage=t.displayErrorMessage.bind(t),t.state={invalidMessage:null},t}return i(r,n),l(r,[{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:"displayErrorMessage",value:function(e){this.setState(function(){return{invalidMessage:e}}),this.createTimer()}},{key:"asyncbeforeCompete",value:function(e){var t=this;return function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{valid:!0},r=n.valid,o=n.message,a=t.props,i=a.onUpdate,u=a.row,l=a.column;if(!r)return void t.displayErrorMessage(o);i(u,l,e)}}},{key:"beforeComplete",value:function(t){var n=this.props,r=n.onUpdate,o=n.row,a=n.column;if(e.isFunction(a.validator)){var i=a.validator(t,o,a,this.asyncbeforeCompete(t));if(e.isObject(i)){if(i.async)return;if(!i.valid)return void this.displayErrorMessage(i.message)}}r(o,a,t)}},{key:"handleBlur",value:function(){var e=this.props,t=e.onEscape;e.blurToSave?this.beforeComplete(this.editor.getValue()):t()}},{key:"handleKeyDown",value:function(e){var t=this.props.onEscape;27===e.keyCode?t():13===e.keyCode&&this.beforeComplete(this.editor.getValue())}},{key:"handleClick",value:function(e){"TD"!==e.target.tagName&&e.stopPropagation()}},{key:"render",value:function(){var n=this,r=void 0,o=this.props,a=o.row,i=o.column,l=o.className,s=o.style,f=o.rowIndex,p=o.columnIndex,y=o.autoSelectText,h=i.dataField,b=e.get(a,h),O=e.isDefined(this.state.invalidMessage),_=i.editorClasses||"";e.isFunction(i.editorClasses)&&(_=i.editorClasses(b,a,f,p));var T=i.editorStyle||{};e.isFunction(i.editorStyle)&&(T=i.editorStyle(b,a,f,p));var w=(0,d.default)({animated:O,shake:O},_),M={ref:function(e){return n.editor=e},defaultValue:b,style:T,className:w,onKeyDown:this.handleKeyDown,onBlur:this.handleBlur};t&&(M.didMount=function(){return t(a,i,f,p)});var P=e.isObject(i.editor);return P?M=u({},M,i.editor):e.isFunction(i.editorRenderer)&&(M=u({},M,{onUpdate:this.beforeComplete})),r=e.isFunction(i.editorRenderer)?i.editorRenderer(M,b,a,i,f,p):P&&i.editor.type===x.EDITTYPE.SELECT?c.default.createElement(v.default,M):P&&i.editor.type===x.EDITTYPE.TEXTAREA?c.default.createElement(m.default,u({},M,{autoSelectText:y})):P&&i.editor.type===x.EDITTYPE.CHECKBOX?c.default.createElement(g.default,M):P&&i.editor.type===x.EDITTYPE.DATE?c.default.createElement(E.default,M):c.default.createElement(C.default,u({},M,{autoSelectText:y})),c.default.createElement("td",{className:(0,d.default)("react-bootstrap-table-editing-cell",l),style:s,onClick:this.handleClick},r,O?c.default.createElement(j.default,{invalidMessage:this.state.invalidMessage}):null)}}]),r}(s.Component),n.propTypes={row:y.default.object.isRequired,rowIndex:y.default.number.isRequired,column:y.default.object.isRequired,columnIndex:y.default.number.isRequired,onUpdate:y.default.func.isRequired,onEscape:y.default.func.isRequired,timeToCloseMessage:y.default.number,autoSelectText:y.default.bool,className:y.default.string,style:y.default.object},n.defaultProps={timeToCloseMessage:x.TIME_TO_CLOSE_MESSAGE,className:null,autoSelectText:!1,style:{}},r}},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 a(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 u(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},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(2),p=r(d),y=n(1),h=r(y),v=function(e){function t(e){a(this,t);var n=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e)),r=e.options;return e.getOptions&&(r=e.getOptions(n.setOptions.bind(n))||[]),n.state={options:r},n}return u(t,e),s(t,[{key:"componentDidMount",value:function(){var e=this.props,t=e.defaultValue,n=e.didMount;this.select.value=t,this.select.focus(),n&&n()}},{key:"setOptions",value:function(e){this.setState({options:e})}},{key:"getValue",value:function(){return this.select.value}},{key:"render",value:function(){var e=this,t=this.props,n=t.defaultValue,r=(t.didMount,t.getOptions,t.className),a=o(t,["defaultValue","didMount","getOptions","className"]),i=(0,p.default)("form-control editor edit-select",r),u=l({},a,{className:i});return f.default.createElement("select",l({},u,{ref:function(t){return e.select=t},defaultValue:n}),this.state.options.map(function(e){var t=e.label,n=e.value;return f.default.createElement("option",{key:n,value:n},t)}))}}]),t}(c.Component);v.propTypes={defaultValue:h.default.oneOfType([h.default.string,h.default.number]),className:h.default.string,style:h.default.object,options:h.default.oneOfType([h.default.arrayOf(h.default.shape({label:h.default.string,value:h.default.any}))]),didMount:h.default.func,getOptions:h.default.func},v.defaultProps={className:"",defaultValue:"",style:{},options:[],didMount:void 0,getOptions:void 0},t.default=v},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 a(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 u(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},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(2),p=r(d),y=n(1),h=r(y),v=function(e){function t(e){a(this,t);var n=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.handleKeyDown=n.handleKeyDown.bind(n),n}return u(t,e),s(t,[{key:"componentDidMount",value:function(){var e=this.props,t=e.defaultValue,n=e.didMount,r=e.autoSelectText;this.text.value=t,this.text.focus(),r&&this.text.select(),n&&n()}},{key:"getValue",value:function(){return this.text.value}},{key:"handleKeyDown",value:function(e){(13!==e.keyCode||e.shiftKey)&&this.props.onKeyDown&&this.props.onKeyDown(e)}},{key:"render",value:function(){var e=this,t=this.props,n=(t.defaultValue,t.didMount,t.className),r=(t.autoSelectText,o(t,["defaultValue","didMount","className","autoSelectText"])),a=(0,p.default)("form-control editor edit-textarea",n);return f.default.createElement("textarea",l({ref:function(t){return e.text=t},type:"textarea",className:a},r,{onKeyDown:this.handleKeyDown}))}}]),t}(c.Component);v.propTypes={className:h.default.oneOfType([h.default.string,h.default.object]),defaultValue:h.default.oneOfType([h.default.string,h.default.number]),onKeyDown:h.default.func,autoSelectText:h.default.bool,didMount:h.default.func},v.defaultProps={className:"",defaultValue:"",autoSelectText:!1,onKeyDown:void 0,didMount:void 0},t.default=v},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 a(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 u(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},s=function(){function e(e,t){var n=[],r=!0,o=!1,a=void 0;try{for(var i,u=e[Symbol.iterator]();!(r=(i=u.next()).done)&&(n.push(i.value),!t||n.length!==t);r=!0);}catch(e){o=!0,a=e}finally{try{!r&&u.return&&u.return()}finally{if(o)throw a}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),c=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}}(),f=n(0),d=r(f),p=n(2),y=r(p),h=n(1),v=r(h),b=function(e){function t(e){a(this,t);var n=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.state={checked:e.defaultValue.toString()===e.value.split(":")[0]},n.handleChange=n.handleChange.bind(n),n}return u(t,e),c(t,[{key:"componentDidMount",value:function(){var e=this.props.didMount;this.checkbox.focus(),e&&e()}},{key:"getValue",value:function(){var e=this.props.value.split(":"),t=s(e,2),n=t[0],r=t[1];return this.checkbox.checked?n:r}},{key:"handleChange",value:function(e){this.props.onChange&&this.props.onChange(e);var t=e.target;this.setState(function(){return{checked:t.checked}})}},{key:"render",value:function(){var e=this,t=this.props,n=(t.defaultValue,t.didMount,t.className),r=o(t,["defaultValue","didMount","className"]),a=(0,y.default)("editor edit-chseckbox checkbox",n);return d.default.createElement("input",l({ref:function(t){return e.checkbox=t},type:"checkbox",className:a},r,{checked:this.state.checked,onChange:this.handleChange}))}}]),t}(f.Component);b.propTypes={className:v.default.oneOfType([v.default.string,v.default.object]),value:v.default.string,defaultValue:v.default.any,onChange:v.default.func,didMount:v.default.func},b.defaultProps={className:"",value:"on:off",defaultValue:!1,onChange:void 0,didMount:void 0},t.default=b},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 a(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 u(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},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(2),p=r(d),y=n(1),h=r(y),v=function(e){function t(){return a(this,t),i(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return u(t,e),s(t,[{key:"componentDidMount",value:function(){var e=this.props,t=e.defaultValue,n=e.didMount;this.date.valueAsDate=new Date(t),this.date.focus(),n&&n()}},{key:"getValue",value:function(){return this.date.value}},{key:"render",value:function(){var e=this,t=this.props,n=(t.defaultValue,t.didMount,t.className),r=o(t,["defaultValue","didMount","className"]),a=(0,p.default)("form-control editor edit-date",n);return f.default.createElement("input",l({ref:function(t){return e.date=t},type:"date",className:a},r))}}]),t}(c.Component);v.propTypes={className:h.default.oneOfType([h.default.string,h.default.object]),defaultValue:h.default.string,didMount:h.default.func},v.defaultProps={className:"",defaultValue:"",didMount:void 0},t.default=v},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 a(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 u(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},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(2),p=r(d),y=n(1),h=r(y),v=function(e){function t(){return a(this,t),i(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return u(t,e),s(t,[{key:"componentDidMount",value:function(){var e=this.props,t=e.defaultValue,n=e.didMount,r=e.autoSelectText;this.text.value=t,this.text.focus(),r&&this.text.select(),n&&n()}},{key:"getValue",value:function(){return this.text.value}},{key:"render",value:function(){var e=this,t=this.props,n=(t.defaultValue,t.didMount,t.className),r=(t.autoSelectText,o(t,["defaultValue","didMount","className","autoSelectText"])),a=(0,p.default)("form-control editor edit-text",n);return f.default.createElement("input",l({ref:function(t){return e.text=t},type:"text",className:a},r))}}]),t}(c.Component);v.propTypes={className:h.default.oneOfType([h.default.string,h.default.object]),defaultValue:h.default.oneOfType([h.default.string,h.default.number]),autoSelectText:h.default.bool,didMount:h.default.func},v.defaultProps={className:null,defaultValue:"",autoSelectText:!1,didMount:void 0},t.default=v},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),a=r(o),i=n(1),u=r(i),l=function(e){var t=e.invalidMessage;return a.default.createElement("div",{className:"alert alert-danger in",role:"alert"},a.default.createElement("strong",null,t))};l.propTypes={invalidMessage:u.default.string},l.defaultProps={invalidMessage:null},t.default=l}])}); | ||
!function(){"use strict";function n(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var o=typeof r;if("string"===o||"number"===o)e.push(r);else if(Array.isArray(r))e.push(n.apply(null,r));else if("object"===o)for(var u in r)a.call(r,u)&&r[u]&&e.push(u)}}return e.join(" ")}var a={}.hasOwnProperty;void 0!==e&&e.exports?e.exports=n:(r=[],void 0!==(o=function(){return n}.apply(t,r))&&(e.exports=o))}()},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",t.EDITTYPE={TEXT:"text",SELECT:"select",TEXTAREA:"textarea",CHECKBOX:"checkbox",DATE:"date"}},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 a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(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 i(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}),t.Consumer=void 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},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),y=n(3),h=f.default.createContext();t.default=function(e,t,n,r){var c=function(c){function d(e){a(this,d);var t=u(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,e));return t.doUpdate=t.doUpdate.bind(t),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},t}return i(d,c),s(d,[{key:"componentWillReceiveProps",value:function(e){e.cellEdit&&n()&&(e.cellEdit.options.errorMessage?this.setState(function(){return{message:e.cellEdit.options.errorMessage}}):this.escapeEditing())}},{key:"handleCellUpdate",value:function(n,r,o){var a=this,u=t.typeConvert(r.type,o),i=this.props.cellEdit,l=i.options.beforeSaveCell,s=e.get(n,r.dataField),c=function(){arguments.length>0&&void 0!==arguments[0]&&!arguments[0]?a.escapeEditing():a.doUpdate(n,r,u)};if(e.isFunction(l)){var f=l(s,u,n,r,c);if(e.isObject(f)&&f.async)return}this.doUpdate(n,r,u)}},{key:"doUpdate",value:function(o,a,u){var i=this.props,l=i.keyField,s=i.cellEdit,c=i.data,f=s.options.afterSaveCell,d=e.get(o,l),p=e.get(o,a.dataField);n()?r(d,a.dataField,u):(t.editCell(c,l,d,a.dataField,u),e.isFunction(f)&&f(p,u,o,a),this.completeEditing())}},{key:"completeEditing",value:function(){this.setState(function(){return{ridx:null,cidx:null,message:null}})}},{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}})}()}},{key:"escapeEditing",value:function(){this.setState(function(){return{ridx:null,cidx:null}})}},{key:"render",value:function(){var t=this.props.cellEdit,n=t.options,r=n.nonEditableRows,a=(n.errorMessage,o(n,["nonEditableRows","errorMessage"])),u=o(t,["options"]),i=l({},a,u,this.state,{nonEditableRows:e.isDefined(r)?r():[],onStart:this.startEditing,onEscape:this.escapeEditing,onUpdate:this.handleCellUpdate});return f.default.createElement(h.Provider,{value:l({},i)},this.props.children)}}]),d}(f.default.Component);return c.propTypes={data:p.default.array.isRequired,selectRow:p.default.object,options:p.default.shape({mode:p.default.oneOf([y.CLICK_TO_CELL_EDIT,y.DBCLICK_TO_CELL_EDIT]).isRequired,onErrorMessageDisappear:p.default.func,blurToSave:p.default.bool,beforeSaveCell:p.default.func,afterSaveCell:p.default.func,onStartEdit:p.default.func,nonEditableRows:p.default.func,timeToCloseMessage:p.default.number,errorMessage:p.default.any})},{Provider:c}};t.Consumer=h.Consumer},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.Type=void 0;var o=n(4),a=r(o),u=n(10),i=r(u),l=n(11),s=r(l),c=n(3);t.default=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{createContext:a.default,createEditingCell:s.default,withRowLevelCellEdit:i.default,DBCLICK_TO_CELL_EDIT:c.DBCLICK_TO_CELL_EDIT,DELAY_FOR_DBCLICK:c.DELAY_FOR_DBCLICK,options:e}};t.Type=c.EDITTYPE},function(e,t,n){"use strict";var r=n(7),o=n(8),a=n(9);e.exports=function(){function e(e,t,n,r,u,i){i!==a&&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}},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},function(e,t,n){"use strict";function r(e,t,n,r,a,u,i,l){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,a,u,i,l],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},function(e,t,n){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=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},o=n(0),a=function(e){return e&&e.__esModule?e:{default:e}}(o),u=n(3),i=n(4);t.default=function(e,t){function n(e){return a.default.createElement(i.Consumer,null,function(t){return o(e,t)})}var o=function(n,o){var i=n.value,l=!(o.nonEditableRows.length>0&&o.nonEditableRows.indexOf(i)>-1),s={};return t&&o.mode===u.DBCLICK_TO_CELL_EDIT&&(s.DELAY_FOR_DBCLICK=u.DELAY_FOR_DBCLICK),a.default.createElement(e,r({},n,s,{editingRowIdx:o.ridx,editingColIdx:o.cidx,editable:l,onStart:o.onStart,clickToEdit:o.mode===u.CLICK_TO_CELL_EDIT,dbclickToEdit:o.mode===u.DBCLICK_TO_CELL_EDIT}))};return n.displayName="WithCellEditingRowConsumer",n}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=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},a=n(0),u=r(a),i=n(4),l=n(12),s=r(l);t.default=function(e,t){var n=(0,s.default)(e,t),r=function(t,r){var a=e.get(t.row,t.column.dataField),i=t.column.editCellStyle||{},l=t.column.editCellClasses;return e.isFunction(t.column.editCellStyle)&&(i=t.column.editCellStyle(a,t.row,t.rowIndex,t.columnIndex)),e.isFunction(t.column.editCellClasses)&&(l=t.column.editCellClasses(a,t.row,t.rowIndex,t.columnIndex)),u.default.createElement(n,o({},t,{className:l,style:i},r))};return function(e){return u.default.createElement(i.Consumer,null,function(t){return r(e,t)})}}},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 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 u(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 i=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},l=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(2),d=r(f),p=n(1),y=r(p),h=n(13),v=r(h),b=n(14),m=r(b),O=n(15),g=r(O),_=n(16),E=r(_),T=n(17),C=r(T),w=n(18),j=r(w),x=n(3);t.default=function(e,t){var n,r;return r=n=function(n){function r(e){o(this,r);var t=a(this,(r.__proto__||Object.getPrototypeOf(r)).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.asyncbeforeCompete=t.asyncbeforeCompete.bind(t),t.displayErrorMessage=t.displayErrorMessage.bind(t),t.state={invalidMessage:null},t}return u(r,n),l(r,[{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:"displayErrorMessage",value:function(e){this.setState(function(){return{invalidMessage:e}}),this.createTimer()}},{key:"asyncbeforeCompete",value:function(e){var t=this;return function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{valid:!0},r=n.valid,o=n.message,a=t.props,u=a.onUpdate,i=a.row,l=a.column;if(!r)return void t.displayErrorMessage(o);u(i,l,e)}}},{key:"beforeComplete",value:function(t){var n=this.props,r=n.onUpdate,o=n.row,a=n.column;if(e.isFunction(a.validator)){var u=a.validator(t,o,a,this.asyncbeforeCompete(t));if(e.isObject(u)){if(u.async)return;if(!u.valid)return void this.displayErrorMessage(u.message)}}r(o,a,t)}},{key:"handleBlur",value:function(){var e=this.props,t=e.onEscape;e.blurToSave?this.beforeComplete(this.editor.getValue()):t()}},{key:"handleKeyDown",value:function(e){var t=this.props.onEscape;27===e.keyCode?t():13===e.keyCode&&this.beforeComplete(this.editor.getValue())}},{key:"handleClick",value:function(e){"TD"!==e.target.tagName&&e.stopPropagation()}},{key:"render",value:function(){var n=this,r=void 0,o=this.props,a=o.row,u=o.column,l=o.className,s=o.style,f=o.rowIndex,p=o.columnIndex,y=o.autoSelectText,h=u.dataField,b=e.get(a,h),O=e.isDefined(this.state.invalidMessage),_=u.editorClasses||"";e.isFunction(u.editorClasses)&&(_=u.editorClasses(b,a,f,p));var T=u.editorStyle||{};e.isFunction(u.editorStyle)&&(T=u.editorStyle(b,a,f,p));var w=(0,d.default)({animated:O,shake:O},_),M={ref:function(e){return n.editor=e},defaultValue:b,style:T,className:w,onKeyDown:this.handleKeyDown,onBlur:this.handleBlur};t&&(M.didMount=function(){return t(a,u,f,p)});var P=e.isObject(u.editor);return P?M=i({},M,u.editor):e.isFunction(u.editorRenderer)&&(M=i({},M,{onUpdate:this.beforeComplete})),r=e.isFunction(u.editorRenderer)?u.editorRenderer(M,b,a,u,f,p):P&&u.editor.type===x.EDITTYPE.SELECT?c.default.createElement(v.default,i({},M,{row:a,column:u})):P&&u.editor.type===x.EDITTYPE.TEXTAREA?c.default.createElement(m.default,i({},M,{autoSelectText:y})):P&&u.editor.type===x.EDITTYPE.CHECKBOX?c.default.createElement(g.default,M):P&&u.editor.type===x.EDITTYPE.DATE?c.default.createElement(E.default,M):c.default.createElement(C.default,i({},M,{autoSelectText:y})),c.default.createElement("td",{className:(0,d.default)("react-bootstrap-table-editing-cell",l),style:s,onClick:this.handleClick},r,O?c.default.createElement(j.default,{invalidMessage:this.state.invalidMessage}):null)}}]),r}(s.Component),n.propTypes={row:y.default.object.isRequired,rowIndex:y.default.number.isRequired,column:y.default.object.isRequired,columnIndex:y.default.number.isRequired,onUpdate:y.default.func.isRequired,onEscape:y.default.func.isRequired,timeToCloseMessage:y.default.number,autoSelectText:y.default.bool,className:y.default.string,style:y.default.object},n.defaultProps={timeToCloseMessage:x.TIME_TO_CLOSE_MESSAGE,className:null,autoSelectText:!1,style:{}},r}},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 a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(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 i(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},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(2),p=r(d),y=n(1),h=r(y),v=function(e){function t(e){a(this,t);var n=u(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e)),r=e.options;return e.getOptions&&(r=e.getOptions(n.setOptions.bind(n),{row:e.row,column:e.column})||[]),n.state={options:r},n}return i(t,e),s(t,[{key:"componentDidMount",value:function(){var e=this.props,t=e.defaultValue,n=e.didMount;this.select.value=t,this.select.focus(),n&&n()}},{key:"setOptions",value:function(e){this.setState({options:e})}},{key:"getValue",value:function(){return this.select.value}},{key:"render",value:function(){var e=this,t=this.props,n=t.defaultValue,r=(t.didMount,t.getOptions,t.className),a=o(t,["defaultValue","didMount","getOptions","className"]),u=(0,p.default)("form-control editor edit-select",r),i=l({},a,{className:u});return f.default.createElement("select",l({},i,{ref:function(t){return e.select=t},defaultValue:n}),this.state.options.map(function(e){var t=e.label,n=e.value;return f.default.createElement("option",{key:n,value:n},t)}))}}]),t}(c.Component);v.propTypes={row:h.default.object.isRequired,column:h.default.object.isRequired,defaultValue:h.default.oneOfType([h.default.string,h.default.number]),className:h.default.string,style:h.default.object,options:h.default.oneOfType([h.default.arrayOf(h.default.shape({label:h.default.string,value:h.default.any}))]),didMount:h.default.func,getOptions:h.default.func},v.defaultProps={className:"",defaultValue:"",style:{},options:[],didMount:void 0,getOptions:void 0},t.default=v},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 a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(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 i(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},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(2),p=r(d),y=n(1),h=r(y),v=function(e){function t(e){a(this,t);var n=u(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.handleKeyDown=n.handleKeyDown.bind(n),n}return i(t,e),s(t,[{key:"componentDidMount",value:function(){var e=this.props,t=e.defaultValue,n=e.didMount,r=e.autoSelectText;this.text.value=t,this.text.focus(),r&&this.text.select(),n&&n()}},{key:"getValue",value:function(){return this.text.value}},{key:"handleKeyDown",value:function(e){(13!==e.keyCode||e.shiftKey)&&this.props.onKeyDown&&this.props.onKeyDown(e)}},{key:"render",value:function(){var e=this,t=this.props,n=(t.defaultValue,t.didMount,t.className),r=(t.autoSelectText,o(t,["defaultValue","didMount","className","autoSelectText"])),a=(0,p.default)("form-control editor edit-textarea",n);return f.default.createElement("textarea",l({ref:function(t){return e.text=t},type:"textarea",className:a},r,{onKeyDown:this.handleKeyDown}))}}]),t}(c.Component);v.propTypes={className:h.default.oneOfType([h.default.string,h.default.object]),defaultValue:h.default.oneOfType([h.default.string,h.default.number]),onKeyDown:h.default.func,autoSelectText:h.default.bool,didMount:h.default.func},v.defaultProps={className:"",defaultValue:"",autoSelectText:!1,onKeyDown:void 0,didMount:void 0},t.default=v},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 a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(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 i(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},s=function(){function e(e,t){var n=[],r=!0,o=!1,a=void 0;try{for(var u,i=e[Symbol.iterator]();!(r=(u=i.next()).done)&&(n.push(u.value),!t||n.length!==t);r=!0);}catch(e){o=!0,a=e}finally{try{!r&&i.return&&i.return()}finally{if(o)throw a}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),c=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}}(),f=n(0),d=r(f),p=n(2),y=r(p),h=n(1),v=r(h),b=function(e){function t(e){a(this,t);var n=u(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.state={checked:e.defaultValue.toString()===e.value.split(":")[0]},n.handleChange=n.handleChange.bind(n),n}return i(t,e),c(t,[{key:"componentDidMount",value:function(){var e=this.props.didMount;this.checkbox.focus(),e&&e()}},{key:"getValue",value:function(){var e=this.props.value.split(":"),t=s(e,2),n=t[0],r=t[1];return this.checkbox.checked?n:r}},{key:"handleChange",value:function(e){this.props.onChange&&this.props.onChange(e);var t=e.target;this.setState(function(){return{checked:t.checked}})}},{key:"render",value:function(){var e=this,t=this.props,n=(t.defaultValue,t.didMount,t.className),r=o(t,["defaultValue","didMount","className"]),a=(0,y.default)("editor edit-chseckbox checkbox",n);return d.default.createElement("input",l({ref:function(t){return e.checkbox=t},type:"checkbox",className:a},r,{checked:this.state.checked,onChange:this.handleChange}))}}]),t}(f.Component);b.propTypes={className:v.default.oneOfType([v.default.string,v.default.object]),value:v.default.string,defaultValue:v.default.any,onChange:v.default.func,didMount:v.default.func},b.defaultProps={className:"",value:"on:off",defaultValue:!1,onChange:void 0,didMount:void 0},t.default=b},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 a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(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 i(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},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(2),p=r(d),y=n(1),h=r(y),v=function(e){function t(){return a(this,t),u(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return i(t,e),s(t,[{key:"componentDidMount",value:function(){var e=this.props,t=e.defaultValue,n=e.didMount;this.date.valueAsDate=new Date(t),this.date.focus(),n&&n()}},{key:"getValue",value:function(){return this.date.value}},{key:"render",value:function(){var e=this,t=this.props,n=(t.defaultValue,t.didMount,t.className),r=o(t,["defaultValue","didMount","className"]),a=(0,p.default)("form-control editor edit-date",n);return f.default.createElement("input",l({ref:function(t){return e.date=t},type:"date",className:a},r))}}]),t}(c.Component);v.propTypes={className:h.default.oneOfType([h.default.string,h.default.object]),defaultValue:h.default.string,didMount:h.default.func},v.defaultProps={className:"",defaultValue:"",didMount:void 0},t.default=v},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 a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(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 i(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},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(2),p=r(d),y=n(1),h=r(y),v=function(e){function t(){return a(this,t),u(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return i(t,e),s(t,[{key:"componentDidMount",value:function(){var e=this.props,t=e.defaultValue,n=e.didMount,r=e.autoSelectText;this.text.value=t,this.text.focus(),r&&this.text.select(),n&&n()}},{key:"getValue",value:function(){return this.text.value}},{key:"render",value:function(){var e=this,t=this.props,n=(t.defaultValue,t.didMount,t.className),r=(t.autoSelectText,o(t,["defaultValue","didMount","className","autoSelectText"])),a=(0,p.default)("form-control editor edit-text",n);return f.default.createElement("input",l({ref:function(t){return e.text=t},type:"text",className:a},r))}}]),t}(c.Component);v.propTypes={className:h.default.oneOfType([h.default.string,h.default.object]),defaultValue:h.default.oneOfType([h.default.string,h.default.number]),autoSelectText:h.default.bool,didMount:h.default.func},v.defaultProps={className:null,defaultValue:"",autoSelectText:!1,didMount:void 0},t.default=v},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),a=r(o),u=n(1),i=r(u),l=function(e){var t=e.invalidMessage;return a.default.createElement("div",{className:"alert alert-danger in",role:"alert"},a.default.createElement("strong",null,t))};l.propTypes={invalidMessage:i.default.string},l.defaultProps={invalidMessage:null},t.default=l}])}); |
@@ -44,3 +44,6 @@ 'use strict'; | ||
if (props.getOptions) { | ||
options = props.getOptions(_this.setOptions.bind(_this)) || []; | ||
options = props.getOptions(_this.setOptions.bind(_this), { | ||
row: props.row, | ||
column: props.column | ||
}) || []; | ||
} | ||
@@ -115,2 +118,4 @@ _this.state = { options: options }; | ||
DropDownEditor.propTypes = { | ||
row: _propTypes2.default.object.isRequired, | ||
column: _propTypes2.default.object.isRequired, | ||
defaultValue: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.number]), | ||
@@ -117,0 +122,0 @@ className: _propTypes2.default.string, |
@@ -284,3 +284,3 @@ 'use strict'; | ||
} else if (isDefaultEditorDefined && column.editor.type === _const.EDITTYPE.SELECT) { | ||
editor = _react2.default.createElement(_dropdownEditor2.default, editorProps); | ||
editor = _react2.default.createElement(_dropdownEditor2.default, _extends({}, editorProps, { row: row, column: column })); | ||
} else if (isDefaultEditorDefined && column.editor.type === _const.EDITTYPE.TEXTAREA) { | ||
@@ -287,0 +287,0 @@ editor = _react2.default.createElement(_textareaEditor2.default, _extends({}, editorProps, { autoSelectText: autoSelectText })); |
{ | ||
"name": "react-bootstrap-table2-editor", | ||
"version": "1.3.1", | ||
"version": "1.3.2", | ||
"description": "it's the editor addon for react-bootstrap-table2", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
@@ -143,3 +143,3 @@ # react-bootstrap-table2-editor | ||
type: Type.SELECT, | ||
getOptions: () => [.....] | ||
getOptions: (setOptions, { row, column }) => [.....] | ||
} | ||
@@ -156,3 +156,3 @@ }]; | ||
type: Type.SELECT, | ||
getOptions: (setOptions) => { | ||
getOptions: (setOptions, { row, column }) => { | ||
setTimeout(() => setOptions([...]), 1500); | ||
@@ -159,0 +159,0 @@ } |
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
229403
2745