gfs-react-redux-twoway-binding
Version:
1 lines • 1.92 kB
JavaScript
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var n=e();for(var i in n)("object"==typeof exports?exports:t)[i]=n[i]}}(this,function(){return function(t){function e(i){if(n[i])return n[i].exports;var r=n[i]={exports:{},id:i,loaded:!1};return t[i].call(r.exports,r,r.exports,e),r.loaded=!0,r.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){t.exports=n(2)},,function(t,e,n){"use strict";var i=n(3);e.bindingMixin=i.default;var r=n(4);e.createReducer=r.default},function(t,e){"use strict";function n(t){t.prototype.binding=function(t,e){var n=this.bindingOrigin.reducerPath,i=window.dispatch||this.state.dispatch||this.props.dispatch,r=n.split("."),o=r[r.length-1],s=this.props[o],a=r.shift(),p=t.split("."),u=r.concat(p),c=s.getIn(p);e&&(c=e(c));var f={value:c,requestChange:function(t){i({type:a+"_BINDING_UPDATE",path:u,value:t})}};return f},t.prototype.setBinding=function(t){this.bindingOrigin={reducerPath:t}},t.prototype.manualChange=function(t,e){var n,i,r=this.bindingOrigin.reducerPath,o=r.split("."),s=window.dispatch||this.state.dispatch||this.props.dispatch;"function"==typeof e&&(n=o[o.length-1],i=this.props[n]);var a=o.shift(),p=o.concat(t.split("."));if("function"==typeof e){var u=i.getIn(p),c=e(u);return void s({type:a+"_BINDING_UPDATE",path:p,value:c})}s({type:a+"_BINDING_UPDATE",path:p,value:e})}}e.__esModule=!0,e.default=n},function(t,e){"use strict";function n(t,e,n){return arguments.length<=2&&(n=i({},e),e=t),n[t+"_BINDING_UPDATE"]=function(t,e){return t.setIn(e.path,e.value)},function(t,i){return void 0===t&&(t=e),n[i.type]?n[i.type](t,i):t}}var i=this&&this.__assign||Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++){e=arguments[n];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t};e.__esModule=!0,e.default=n}])});