FIX Adding a debounce to fetching lazy loaded tags with tag field

This commit is contained in:
Guy Marriott 2018-12-04 15:50:25 +13:00
parent ada0ec2d13
commit 836f5ff978
No known key found for this signature in database
GPG Key ID: A80F9ACCB86D3DA7
5 changed files with 19 additions and 5 deletions

1
.gitignore vendored
View File

@ -4,3 +4,4 @@ framework
node_modules/
/**/*.js.map
/**/*.css.map
yarn-error.log

View File

@ -1 +1 @@
!function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,e),o.l=!0,o.exports}var n={};e.m=t,e.c=n,e.i=function(t){return t},e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:r})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s="./client/src/bundles/bundle.js")}({"./client/src/boot/index.js":function(t,e,n){"use strict";var r=n("./client/src/boot/registerComponents.js"),o=function(t){return t&&t.__esModule?t:{default:t}}(r);window.document.addEventListener("DOMContentLoaded",function(){(0,o.default)()})},"./client/src/boot/registerComponents.js":function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),s=r(o),a=n("./client/src/components/TagField.js"),i=r(a);e.default=function(){s.default.component.registerMany({TagField:i.default})}},"./client/src/bundles/bundle.js":function(t,e,n){"use strict";n("./client/src/legacy/entwine/TagField.js"),n("./client/src/boot/index.js")},"./client/src/components/TagField.js":function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){var n={};for(var r in t)e.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n}function s(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function h(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var u=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},l=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),c=n(1),p=r(c),f=n(4),d=r(f),m=n(2),y=r(m),v=n("./node_modules/url/url.js"),b=r(v),g=function(t){function e(t){a(this,e);var n=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return n.state={value:t.value},n.onChange=n.onChange.bind(n),n.getOptions=n.getOptions.bind(n),n}return h(e,t),l(e,[{key:"onChange",value:function(t){this.setState({value:t}),"function"==typeof this.props.onChange&&this.props.onChange(t)}},{key:"getOptions",value:function(t){var e=this.props,n=e.lazyLoad,r=e.options,o=e.optionUrl,a=e.labelKey,i=e.valueKey;if(!n)return Promise.resolve({options:r});if(!t)return Promise.resolve({options:[]});var h=b.default.parse(o,!0);return h.query.term=t,(0,y.default)(b.default.format(h),{credentials:"same-origin"}).then(function(t){return t.json()}).then(function(t){return{options:t.items.map(function(t){var e;return e={},s(e,a,t.id),s(e,i,t.text),e})}})}},{key:"render",value:function(){var t=this.props,e=t.lazyLoad,n=t.options,r=t.creatable,s=o(t,["lazyLoad","options","creatable"]),a=e?{loadOptions:this.getOptions}:{options:n},i=d.default;return e&&r?i=d.default.AsyncCreatable:e?i=d.default.Async:r&&(i=d.default.Creatable),s.value=this.state.value,p.default.createElement(i,u({},s,{onChange:this.onChange,inputProps:{className:"no-change-track"}},a))}}]),e}(c.Component);g.propTypes={name:c.PropTypes.string.isRequired,labelKey:c.PropTypes.string.isRequired,valueKey:c.PropTypes.string.isRequired,lazyLoad:c.PropTypes.bool.isRequired,creatable:c.PropTypes.bool.isRequired,multi:c.PropTypes.bool.isRequired,disabled:c.PropTypes.bool,options:c.PropTypes.arrayOf(c.PropTypes.object),optionUrl:c.PropTypes.string,value:c.PropTypes.any,onChange:c.PropTypes.func,onBlur:c.PropTypes.func},g.defaultProps={labelKey:"Title",valueKey:"Value",disabled:!1},e.default=g},"./client/src/legacy/entwine/TagField.js":function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}var o=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},s=n(1),a=r(s),i=n(3),h=r(i),u=n(0);window.jQuery.entwine("ss",function(t){t(".js-injector-boot .ss-tag-field").entwine({onmatch:function(){var t=this,e=this.closest(".cms-content").attr("id"),n=e?{context:e}:{},r=(0,u.loadComponent)("TagField",n),s=o({},this.data("schema"),{onBlur:function(){t.parents(".cms-edit-form:first").trigger("change")}});h.default.render(a.default.createElement(r,s),this[0])},onunmatch:function(){h.default.unmountComponentAtNode(this[0])}})})},"./node_modules/punycode/punycode.js":function(t,e,n){(function(t,r){var o;!function(r){function s(t){throw new RangeError(I[t])}function a(t,e){for(var n=t.length,r=[];n--;)r[n]=e(t[n]);return r}function i(t,e){var n=t.split("@"),r="";return n.length>1&&(r=n[0]+"@",t=n[1]),t=t.replace(T,"."),r+a(t.split("."),e).join(".")}function h(t){for(var e,n,r=[],o=0,s=t.length;o<s;)e=t.charCodeAt(o++),e>=55296&&e<=56319&&o<s?(n=t.charCodeAt(o++),56320==(64512&n)?r.push(((1023&e)<<10)+(1023&n)+65536):(r.push(e),o--)):r.push(e);return r}function u(t){return a(t,function(t){var e="";return t>65535&&(t-=65536,e+=U(t>>>10&1023|55296),t=56320|1023&t),e+=U(t)}).join("")}function l(t){return t-48<10?t-22:t-65<26?t-65:t-97<26?t-97:g}function c(t,e){return t+22+75*(t<26)-((0!=e)<<5)}function p(t,e,n){var r=0;for(t=n?k(t/x):t>>1,t+=k(t/e);t>R*O>>1;r+=g)t=k(t/R);return k(r+(R+1)*t/(t+w))}function f(t){var e,n,r,o,a,i,h,c,f,d,m=[],y=t.length,v=0,w=_,x=C;for(n=t.lastIndexOf(P),n<0&&(n=0),r=0;r<n;++r)t.charCodeAt(r)>=128&&s("not-basic"),m.push(t.charCodeAt(r));for(o=n>0?n+1:0;o<y;){for(a=v,i=1,h=g;o>=y&&s("invalid-input"),c=l(t.charCodeAt(o++)),(c>=g||c>k((b-v)/i))&&s("overflow"),v+=c*i,f=h<=x?j:h>=x+O?O:h-x,!(c<f);h+=g)d=g-f,i>k(b/d)&&s("overflow"),i*=d;e=m.length+1,x=p(v-a,e,0==a),k(v/e)>b-w&&s("overflow"),w+=k(v/e),v%=e,m.splice(v++,0,w)}return u(m)}function d(t){var e,n,r,o,a,i,u,l,f,d,m,y,v,w,x,q=[];for(t=h(t),y=t.length,e=_,n=0,a=C,i=0;i<y;++i)(m=t[i])<128&&q.push(U(m));for(r=o=q.length,o&&q.push(P);r<y;){for(u=b,i=0;i<y;++i)(m=t[i])>=e&&m<u&&(u=m);for(v=r+1,u-e>k((b-n)/v)&&s("overflow"),n+=(u-e)*v,e=u,i=0;i<y;++i)if(m=t[i],m<e&&++n>b&&s("overflow"),m==e){for(l=n,f=g;d=f<=a?j:f>=a+O?O:f-a,!(l<d);f+=g)x=l-d,w=g-d,q.push(U(c(d+x%w,0))),l=k(x/w);q.push(U(c(l,0))),a=p(n,v,r==o),n=0,++r}++n,++e}return q.join("")}function m(t){return i(t,function(t){return q.test(t)?f(t.slice(4).toLowerCase()):t})}function y(t){return i(t,function(t){return A.test(t)?"xn--"+d(t):t})}var v,b=("object"==typeof e&&e&&e.nodeType,"object"==typeof t&&t&&t.nodeType,2147483647),g=36,j=1,O=26,w=38,x=700,C=72,_=128,P="-",q=/^xn--/,A=/[^\x20-\x7E]/,T=/[\x2E\u3002\uFF0E\uFF61]/g,I={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},R=g-j,k=Math.floor,U=String.fromCharCode;v={version:"1.4.1",ucs2:{decode:h,encode:u},decode:f,encode:d,toASCII:y,toUnicode:m},void 0!==(o=function(){return v}.call(e,n,e,t))&&(t.exports=o)}()}).call(e,n("./node_modules/webpack/buildin/module.js")(t),n("./node_modules/webpack/buildin/global.js"))},"./node_modules/querystring-es3/decode.js":function(t,e,n){"use strict";function r(t,e){return Object.prototype.hasOwnProperty.call(t,e)}t.exports=function(t,e,n,s){e=e||"&",n=n||"=";var a={};if("string"!=typeof t||0===t.length)return a;var i=/\+/g;t=t.split(e);var h=1e3;s&&"number"==typeof s.maxKeys&&(h=s.maxKeys);var u=t.length;h>0&&u>h&&(u=h);for(var l=0;l<u;++l){var c,p,f,d,m=t[l].replace(i,"%20"),y=m.indexOf(n);y>=0?(c=m.substr(0,y),p=m.substr(y+1)):(c=m,p=""),f=decodeURIComponent(c),d=decodeURIComponent(p),r(a,f)?o(a[f])?a[f].push(d):a[f]=[a[f],d]:a[f]=d}return a};var o=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)}},"./node_modules/querystring-es3/encode.js":function(t,e,n){"use strict";function r(t,e){if(t.map)return t.map(e);for(var n=[],r=0;r<t.length;r++)n.push(e(t[r],r));return n}var o=function(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}};t.exports=function(t,e,n,i){return e=e||"&",n=n||"=",null===t&&(t=void 0),"object"==typeof t?r(a(t),function(a){var i=encodeURIComponent(o(a))+n;return s(t[a])?r(t[a],function(t){return i+encodeURIComponent(o(t))}).join(e):i+encodeURIComponent(o(t[a]))}).join(e):i?encodeURIComponent(o(i))+n+encodeURIComponent(o(t)):""};var s=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},a=Object.keys||function(t){var e=[];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.push(n);return e}},"./node_modules/querystring-es3/index.js":function(t,e,n){"use strict";e.decode=e.parse=n("./node_modules/querystring-es3/decode.js"),e.encode=e.stringify=n("./node_modules/querystring-es3/encode.js")},"./node_modules/url/url.js":function(t,e,n){"use strict";function r(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}function o(t,e,n){if(t&&u.isObject(t)&&t instanceof r)return t;var o=new r;return o.parse(t,e,n),o}function s(t){return u.isString(t)&&(t=o(t)),t instanceof r?t.format():r.prototype.format.call(t)}function a(t,e){return o(t,!1,!0).resolve(e)}function i(t,e){return t?o(t,!1,!0).resolveObject(e):e}var h=n("./node_modules/punycode/punycode.js"),u=n("./node_modules/url/util.js");e.parse=o,e.resolve=a,e.resolveObject=i,e.format=s,e.Url=r;var l=/^([a-z0-9.+-]+:)/i,c=/:[0-9]*$/,p=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,f=["<",">",'"',"`"," ","\r","\n","\t"],d=["{","}","|","\\","^","`"].concat(f),m=["'"].concat(d),y=["%","/","?",";","#"].concat(m),v=["/","?","#"],b=/^[+a-z0-9A-Z_-]{0,63}$/,g=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,j={javascript:!0,"javascript:":!0},O={javascript:!0,"javascript:":!0},w={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},x=n("./node_modules/querystring-es3/index.js");r.prototype.parse=function(t,e,n){if(!u.isString(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var r=t.indexOf("?"),o=-1!==r&&r<t.indexOf("#")?"?":"#",s=t.split(o),a=/\\/g;s[0]=s[0].replace(a,"/"),t=s.join(o);var i=t;if(i=i.trim(),!n&&1===t.split("#").length){var c=p.exec(i);if(c)return this.path=i,this.href=i,this.pathname=c[1],c[2]?(this.search=c[2],this.query=e?x.parse(this.search.substr(1)):this.search.substr(1)):e&&(this.search="",this.query={}),this}var f=l.exec(i);if(f){f=f[0];var d=f.toLowerCase();this.protocol=d,i=i.substr(f.length)}if(n||f||i.match(/^\/\/[^@\/]+@[^@\/]+/)){var C="//"===i.substr(0,2);!C||f&&O[f]||(i=i.substr(2),this.slashes=!0)}if(!O[f]&&(C||f&&!w[f])){for(var _=-1,P=0;P<v.length;P++){var q=i.indexOf(v[P]);-1!==q&&(-1===_||q<_)&&(_=q)}var A,T;T=-1===_?i.lastIndexOf("@"):i.lastIndexOf("@",_),-1!==T&&(A=i.slice(0,T),i=i.slice(T+1),this.auth=decodeURIComponent(A)),_=-1;for(var P=0;P<y.length;P++){var q=i.indexOf(y[P]);-1!==q&&(-1===_||q<_)&&(_=q)}-1===_&&(_=i.length),this.host=i.slice(0,_),i=i.slice(_),this.parseHost(),this.hostname=this.hostname||"";var I="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!I)for(var R=this.hostname.split(/\./),P=0,k=R.length;P<k;P++){var U=R[P];if(U&&!U.match(b)){for(var F="",S=0,E=U.length;S<E;S++)U.charCodeAt(S)>127?F+="x":F+=U[S];if(!F.match(b)){var M=R.slice(0,P),L=R.slice(P+1),N=U.match(g);N&&(M.push(N[1]),L.unshift(N[2])),L.length&&(i="/"+L.join(".")+i),this.hostname=M.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),I||(this.hostname=h.toASCII(this.hostname));var K=this.port?":"+this.port:"",z=this.hostname||"";this.host=z+K,this.href+=this.host,I&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==i[0]&&(i="/"+i))}if(!j[d])for(var P=0,k=m.length;P<k;P++){var $=m[P];if(-1!==i.indexOf($)){var B=encodeURIComponent($);B===$&&(B=escape($)),i=i.split($).join(B)}}var D=i.indexOf("#");-1!==D&&(this.hash=i.substr(D),i=i.slice(0,D));var H=i.indexOf("?");if(-1!==H?(this.search=i.substr(H),this.query=i.substr(H+1),e&&(this.query=x.parse(this.query)),i=i.slice(0,H)):e&&(this.search="",this.query={}),i&&(this.pathname=i),w[d]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var K=this.pathname||"",Z=this.search||"";this.path=K+Z}return this.href=this.format(),this},r.prototype.format=function(){var t=this.auth||"";t&&(t=encodeURIComponent(t),t=t.replace(/%3A/i,":"),t+="@");var e=this.protocol||"",n=this.pathname||"",r=this.hash||"",o=!1,s="";this.host?o=t+this.host:this.hostname&&(o=t+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(o+=":"+this.port)),this.query&&u.isObject(this.query)&&Object.keys(this.query).length&&(s=x.stringify(this.query));var a=this.search||s&&"?"+s||"";return e&&":"!==e.substr(-1)&&(e+=":"),this.slashes||(!e||w[e])&&!1!==o?(o="//"+(o||""),n&&"/"!==n.charAt(0)&&(n="/"+n)):o||(o=""),r&&"#"!==r.charAt(0)&&(r="#"+r),a&&"?"!==a.charAt(0)&&(a="?"+a),n=n.replace(/[?#]/g,function(t){return encodeURIComponent(t)}),a=a.replace("#","%23"),e+o+n+a+r},r.prototype.resolve=function(t){return this.resolveObject(o(t,!1,!0)).format()},r.prototype.resolveObject=function(t){if(u.isString(t)){var e=new r;e.parse(t,!1,!0),t=e}for(var n=new r,o=Object.keys(this),s=0;s<o.length;s++){var a=o[s];n[a]=this[a]}if(n.hash=t.hash,""===t.href)return n.href=n.format(),n;if(t.slashes&&!t.protocol){for(var i=Object.keys(t),h=0;h<i.length;h++){var l=i[h];"protocol"!==l&&(n[l]=t[l])}return w[n.protocol]&&n.hostname&&!n.pathname&&(n.path=n.pathname="/"),n.href=n.format(),n}if(t.protocol&&t.protocol!==n.protocol){if(!w[t.protocol]){for(var c=Object.keys(t),p=0;p<c.length;p++){var f=c[p];n[f]=t[f]}return n.href=n.format(),n}if(n.protocol=t.protocol,t.host||O[t.protocol])n.pathname=t.pathname;else{for(var d=(t.pathname||"").split("/");d.length&&!(t.host=d.shift()););t.host||(t.host=""),t.hostname||(t.hostname=""),""!==d[0]&&d.unshift(""),d.length<2&&d.unshift(""),n.pathname=d.join("/")}if(n.search=t.search,n.query=t.query,n.host=t.host||"",n.auth=t.auth,n.hostname=t.hostname||t.host,n.port=t.port,n.pathname||n.search){var m=n.pathname||"",y=n.search||"";n.path=m+y}return n.slashes=n.slashes||t.slashes,n.href=n.format(),n}var v=n.pathname&&"/"===n.pathname.charAt(0),b=t.host||t.pathname&&"/"===t.pathname.charAt(0),g=b||v||n.host&&t.pathname,j=g,x=n.pathname&&n.pathname.split("/")||[],d=t.pathname&&t.pathname.split("/")||[],C=n.protocol&&!w[n.protocol];if(C&&(n.hostname="",n.port=null,n.host&&(""===x[0]?x[0]=n.host:x.unshift(n.host)),n.host="",t.protocol&&(t.hostname=null,t.port=null,t.host&&(""===d[0]?d[0]=t.host:d.unshift(t.host)),t.host=null),g=g&&(""===d[0]||""===x[0])),b)n.host=t.host||""===t.host?t.host:n.host,n.hostname=t.hostname||""===t.hostname?t.hostname:n.hostname,n.search=t.search,n.query=t.query,x=d;else if(d.length)x||(x=[]),x.pop(),x=x.concat(d),n.search=t.search,n.query=t.query;else if(!u.isNullOrUndefined(t.search)){if(C){n.hostname=n.host=x.shift();var _=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@");_&&(n.auth=_.shift(),n.host=n.hostname=_.shift())}return n.search=t.search,n.query=t.query,u.isNull(n.pathname)&&u.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n}if(!x.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n;for(var P=x.slice(-1)[0],q=(n.host||t.host||x.length>1)&&("."===P||".."===P)||""===P,A=0,T=x.length;T>=0;T--)P=x[T],"."===P?x.splice(T,1):".."===P?(x.splice(T,1),A++):A&&(x.splice(T,1),A--);if(!g&&!j)for(;A--;A)x.unshift("..");!g||""===x[0]||x[0]&&"/"===x[0].charAt(0)||x.unshift(""),q&&"/"!==x.join("/").substr(-1)&&x.push("");var I=""===x[0]||x[0]&&"/"===x[0].charAt(0);if(C){n.hostname=n.host=I?"":x.length?x.shift():"";var _=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@");_&&(n.auth=_.shift(),n.host=n.hostname=_.shift())}return g=g||n.host&&x.length,g&&!I&&x.unshift(""),x.length?n.pathname=x.join("/"):(n.pathname=null,n.path=null),u.isNull(n.pathname)&&u.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.auth=t.auth||n.auth,n.slashes=n.slashes||t.slashes,n.href=n.format(),n},r.prototype.parseHost=function(){var t=this.host,e=c.exec(t);e&&(e=e[0],":"!==e&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)}},"./node_modules/url/util.js":function(t,e,n){"use strict";t.exports={isString:function(t){return"string"==typeof t},isObject:function(t){return"object"==typeof t&&null!==t},isNull:function(t){return null===t},isNullOrUndefined:function(t){return null==t}}},"./node_modules/webpack/buildin/global.js":function(t,e){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(n=window)}t.exports=n},"./node_modules/webpack/buildin/module.js":function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},0:function(t,e){t.exports=Injector},1:function(t,e){t.exports=React},2:function(t,e){t.exports=IsomorphicFetch},3:function(t,e){t.exports=ReactDom},4:function(t,e){t.exports=ReactSelect}});
!function(t){function e(o){if(n[o])return n[o].exports;var r=n[o]={i:o,l:!1,exports:{}};return t[o].call(r.exports,r,r.exports,e),r.l=!0,r.exports}var n={};e.m=t,e.c=n,e.i=function(t){return t},e.d=function(t,n,o){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:o})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s="./client/src/bundles/bundle.js")}({"./client/src/boot/index.js":function(t,e,n){"use strict";var o=n("./client/src/boot/registerComponents.js"),r=function(t){return t&&t.__esModule?t:{default:t}}(o);window.document.addEventListener("DOMContentLoaded",function(){(0,r.default)()})},"./client/src/boot/registerComponents.js":function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),s=o(r),i=n("./client/src/components/TagField.js"),a=o(i);e.default=function(){s.default.component.registerMany({TagField:a.default})}},"./client/src/bundles/bundle.js":function(t,e,n){"use strict";n("./client/src/legacy/entwine/TagField.js"),n("./client/src/boot/index.js")},"./client/src/components/TagField.js":function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{default:t}}function r(t,e){var n={};for(var o in t)e.indexOf(o)>=0||Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=t[o]);return n}function s(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function u(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var l=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},h=function(){function t(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,n,o){return n&&t(e.prototype,n),o&&t(e,o),e}}(),c=n(1),f=o(c),p=n(4),d=o(p),m=n(2),v=o(m),b=n("./node_modules/url/url.js"),y=o(b),j=n("./node_modules/lodash/debounce.js"),g=o(j),O=function(t){function e(t){i(this,e);var n=a(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return n.state={value:t.value},n.onChange=n.onChange.bind(n),n.getOptions=n.getOptions.bind(n),n.fetchOptions=(0,g.default)(n.fetchOptions,500),n}return u(e,t),h(e,[{key:"onChange",value:function(t){this.setState({value:t}),"function"==typeof this.props.onChange&&this.props.onChange(t)}},{key:"getOptions",value:function(t){var e=this.props,n=e.lazyLoad,o=e.options;return n?t?this.fetchOptions(t):Promise.resolve({options:[]}):Promise.resolve({options:o})}},{key:"fetchOptions",value:function(t){var e=this.props,n=e.optionUrl,o=e.labelKey,r=e.valueKey,i=y.default.parse(n,!0);return i.query.term=t,(0,v.default)(y.default.format(i),{credentials:"same-origin"}).then(function(t){return t.json()}).then(function(t){return{options:t.items.map(function(t){var e;return e={},s(e,o,t.id),s(e,r,t.text),e})}})}},{key:"render",value:function(){var t=this.props,e=t.lazyLoad,n=t.options,o=t.creatable,s=r(t,["lazyLoad","options","creatable"]),i=e?{loadOptions:this.getOptions}:{options:n},a=d.default;return e&&o?a=d.default.AsyncCreatable:e?a=d.default.Async:o&&(a=d.default.Creatable),s.value=this.state.value,f.default.createElement(a,l({},s,{onChange:this.onChange,inputProps:{className:"no-change-track"}},i))}}]),e}(c.Component);O.propTypes={name:c.PropTypes.string.isRequired,labelKey:c.PropTypes.string.isRequired,valueKey:c.PropTypes.string.isRequired,lazyLoad:c.PropTypes.bool.isRequired,creatable:c.PropTypes.bool.isRequired,multi:c.PropTypes.bool.isRequired,disabled:c.PropTypes.bool,options:c.PropTypes.arrayOf(c.PropTypes.object),optionUrl:c.PropTypes.string,value:c.PropTypes.any,onChange:c.PropTypes.func,onBlur:c.PropTypes.func},O.defaultProps={labelKey:"Title",valueKey:"Value",disabled:!1},e.default=O},"./client/src/legacy/entwine/TagField.js":function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{default:t}}var r=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},s=n(1),i=o(s),a=n(3),u=o(a),l=n(0);window.jQuery.entwine("ss",function(t){t(".js-injector-boot .ss-tag-field").entwine({onmatch:function(){var t=this,e=this.closest(".cms-content").attr("id"),n=e?{context:e}:{},o=(0,l.loadComponent)("TagField",n),s=r({},this.data("schema"),{onBlur:function(){t.parents(".cms-edit-form:first").trigger("change")}});u.default.render(i.default.createElement(o,s),this[0])},onunmatch:function(){u.default.unmountComponentAtNode(this[0])}})})},"./node_modules/lodash/_Symbol.js":function(t,e,n){var o=n("./node_modules/lodash/_root.js"),r=o.Symbol;t.exports=r},"./node_modules/lodash/_baseGetTag.js":function(t,e,n){function o(t){return null==t?void 0===t?u:a:l&&l in Object(t)?s(t):i(t)}var r=n("./node_modules/lodash/_Symbol.js"),s=n("./node_modules/lodash/_getRawTag.js"),i=n("./node_modules/lodash/_objectToString.js"),a="[object Null]",u="[object Undefined]",l=r?r.toStringTag:void 0;t.exports=o},"./node_modules/lodash/_freeGlobal.js":function(t,e,n){(function(e){var n="object"==typeof e&&e&&e.Object===Object&&e;t.exports=n}).call(e,n("./node_modules/webpack/buildin/global.js"))},"./node_modules/lodash/_getRawTag.js":function(t,e,n){function o(t){var e=i.call(t,u),n=t[u];try{t[u]=void 0;var o=!0}catch(t){}var r=a.call(t);return o&&(e?t[u]=n:delete t[u]),r}var r=n("./node_modules/lodash/_Symbol.js"),s=Object.prototype,i=s.hasOwnProperty,a=s.toString,u=r?r.toStringTag:void 0;t.exports=o},"./node_modules/lodash/_objectToString.js":function(t,e){function n(t){return r.call(t)}var o=Object.prototype,r=o.toString;t.exports=n},"./node_modules/lodash/_root.js":function(t,e,n){var o=n("./node_modules/lodash/_freeGlobal.js"),r="object"==typeof self&&self&&self.Object===Object&&self,s=o||r||Function("return this")();t.exports=s},"./node_modules/lodash/debounce.js":function(t,e,n){function o(t,e,n){function o(e){var n=y,o=j;return y=j=void 0,w=e,O=t.apply(o,n)}function h(t){return w=t,_=setTimeout(p,e),C?o(t):O}function c(t){var n=t-x,o=t-w,r=e-n;return T?l(r,g-o):r}function f(t){var n=t-x,o=t-w;return void 0===x||n>=e||n<0||T&&o>=g}function p(){var t=s();if(f(t))return d(t);_=setTimeout(p,c(t))}function d(t){return _=void 0,P&&y?o(t):(y=j=void 0,O)}function m(){void 0!==_&&clearTimeout(_),w=0,y=x=j=_=void 0}function v(){return void 0===_?O:d(s())}function b(){var t=s(),n=f(t);if(y=arguments,j=this,x=t,n){if(void 0===_)return h(x);if(T)return _=setTimeout(p,e),o(x)}return void 0===_&&(_=setTimeout(p,e)),O}var y,j,g,O,_,x,w=0,C=!1,T=!1,P=!0;if("function"!=typeof t)throw new TypeError(a);return e=i(e)||0,r(n)&&(C=!!n.leading,T="maxWait"in n,g=T?u(i(n.maxWait)||0,e):g,P="trailing"in n?!!n.trailing:P),b.cancel=m,b.flush=v,b}var r=n("./node_modules/lodash/isObject.js"),s=n("./node_modules/lodash/now.js"),i=n("./node_modules/lodash/toNumber.js"),a="Expected a function",u=Math.max,l=Math.min;t.exports=o},"./node_modules/lodash/isObject.js":function(t,e){function n(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}t.exports=n},"./node_modules/lodash/isObjectLike.js":function(t,e){function n(t){return null!=t&&"object"==typeof t}t.exports=n},"./node_modules/lodash/isSymbol.js":function(t,e,n){function o(t){return"symbol"==typeof t||s(t)&&r(t)==i}var r=n("./node_modules/lodash/_baseGetTag.js"),s=n("./node_modules/lodash/isObjectLike.js"),i="[object Symbol]";t.exports=o},"./node_modules/lodash/now.js":function(t,e,n){var o=n("./node_modules/lodash/_root.js"),r=function(){return o.Date.now()};t.exports=r},"./node_modules/lodash/toNumber.js":function(t,e,n){function o(t){if("number"==typeof t)return t;if(s(t))return i;if(r(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=r(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(a,"");var n=l.test(t);return n||h.test(t)?c(t.slice(2),n?2:8):u.test(t)?i:+t}var r=n("./node_modules/lodash/isObject.js"),s=n("./node_modules/lodash/isSymbol.js"),i=NaN,a=/^\s+|\s+$/g,u=/^[-+]0x[0-9a-f]+$/i,l=/^0b[01]+$/i,h=/^0o[0-7]+$/i,c=parseInt;t.exports=o},"./node_modules/punycode/punycode.js":function(t,e,n){(function(t,o){var r;!function(o){function s(t){throw new RangeError(S[t])}function i(t,e){for(var n=t.length,o=[];n--;)o[n]=e(t[n]);return o}function a(t,e){var n=t.split("@"),o="";return n.length>1&&(o=n[0]+"@",t=n[1]),t=t.replace(A,"."),o+i(t.split("."),e).join(".")}function u(t){for(var e,n,o=[],r=0,s=t.length;r<s;)e=t.charCodeAt(r++),e>=55296&&e<=56319&&r<s?(n=t.charCodeAt(r++),56320==(64512&n)?o.push(((1023&e)<<10)+(1023&n)+65536):(o.push(e),r--)):o.push(e);return o}function l(t){return i(t,function(t){var e="";return t>65535&&(t-=65536,e+=k(t>>>10&1023|55296),t=56320|1023&t),e+=k(t)}).join("")}function h(t){return t-48<10?t-22:t-65<26?t-65:t-97<26?t-97:j}function c(t,e){return t+22+75*(t<26)-((0!=e)<<5)}function f(t,e,n){var o=0;for(t=n?I(t/x):t>>1,t+=I(t/e);t>R*O>>1;o+=j)t=I(t/R);return I(o+(R+1)*t/(t+_))}function p(t){var e,n,o,r,i,a,u,c,p,d,m=[],v=t.length,b=0,_=C,x=w;for(n=t.lastIndexOf(T),n<0&&(n=0),o=0;o<n;++o)t.charCodeAt(o)>=128&&s("not-basic"),m.push(t.charCodeAt(o));for(r=n>0?n+1:0;r<v;){for(i=b,a=1,u=j;r>=v&&s("invalid-input"),c=h(t.charCodeAt(r++)),(c>=j||c>I((y-b)/a))&&s("overflow"),b+=c*a,p=u<=x?g:u>=x+O?O:u-x,!(c<p);u+=j)d=j-p,a>I(y/d)&&s("overflow"),a*=d;e=m.length+1,x=f(b-i,e,0==i),I(b/e)>y-_&&s("overflow"),_+=I(b/e),b%=e,m.splice(b++,0,_)}return l(m)}function d(t){var e,n,o,r,i,a,l,h,p,d,m,v,b,_,x,P=[];for(t=u(t),v=t.length,e=C,n=0,i=w,a=0;a<v;++a)(m=t[a])<128&&P.push(k(m));for(o=r=P.length,r&&P.push(T);o<v;){for(l=y,a=0;a<v;++a)(m=t[a])>=e&&m<l&&(l=m);for(b=o+1,l-e>I((y-n)/b)&&s("overflow"),n+=(l-e)*b,e=l,a=0;a<v;++a)if(m=t[a],m<e&&++n>y&&s("overflow"),m==e){for(h=n,p=j;d=p<=i?g:p>=i+O?O:p-i,!(h<d);p+=j)x=h-d,_=j-d,P.push(k(c(d+x%_,0))),h=I(x/_);P.push(k(c(h,0))),i=f(n,b,o==r),n=0,++o}++n,++e}return P.join("")}function m(t){return a(t,function(t){return P.test(t)?p(t.slice(4).toLowerCase()):t})}function v(t){return a(t,function(t){return q.test(t)?"xn--"+d(t):t})}var b,y=("object"==typeof e&&e&&e.nodeType,"object"==typeof t&&t&&t.nodeType,2147483647),j=36,g=1,O=26,_=38,x=700,w=72,C=128,T="-",P=/^xn--/,q=/[^\x20-\x7E]/,A=/[\x2E\u3002\uFF0E\uFF61]/g,S={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},R=j-g,I=Math.floor,k=String.fromCharCode;b={version:"1.4.1",ucs2:{decode:u,encode:l},decode:p,encode:d,toASCII:v,toUnicode:m},void 0!==(r=function(){return b}.call(e,n,e,t))&&(t.exports=r)}()}).call(e,n("./node_modules/webpack/buildin/module.js")(t),n("./node_modules/webpack/buildin/global.js"))},"./node_modules/querystring-es3/decode.js":function(t,e,n){"use strict";function o(t,e){return Object.prototype.hasOwnProperty.call(t,e)}t.exports=function(t,e,n,s){e=e||"&",n=n||"=";var i={};if("string"!=typeof t||0===t.length)return i;var a=/\+/g;t=t.split(e);var u=1e3;s&&"number"==typeof s.maxKeys&&(u=s.maxKeys);var l=t.length;u>0&&l>u&&(l=u);for(var h=0;h<l;++h){var c,f,p,d,m=t[h].replace(a,"%20"),v=m.indexOf(n);v>=0?(c=m.substr(0,v),f=m.substr(v+1)):(c=m,f=""),p=decodeURIComponent(c),d=decodeURIComponent(f),o(i,p)?r(i[p])?i[p].push(d):i[p]=[i[p],d]:i[p]=d}return i};var r=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)}},"./node_modules/querystring-es3/encode.js":function(t,e,n){"use strict";function o(t,e){if(t.map)return t.map(e);for(var n=[],o=0;o<t.length;o++)n.push(e(t[o],o));return n}var r=function(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}};t.exports=function(t,e,n,a){return e=e||"&",n=n||"=",null===t&&(t=void 0),"object"==typeof t?o(i(t),function(i){var a=encodeURIComponent(r(i))+n;return s(t[i])?o(t[i],function(t){return a+encodeURIComponent(r(t))}).join(e):a+encodeURIComponent(r(t[i]))}).join(e):a?encodeURIComponent(r(a))+n+encodeURIComponent(r(t)):""};var s=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},i=Object.keys||function(t){var e=[];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.push(n);return e}},"./node_modules/querystring-es3/index.js":function(t,e,n){"use strict";e.decode=e.parse=n("./node_modules/querystring-es3/decode.js"),e.encode=e.stringify=n("./node_modules/querystring-es3/encode.js")},"./node_modules/url/url.js":function(t,e,n){"use strict";function o(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}function r(t,e,n){if(t&&l.isObject(t)&&t instanceof o)return t;var r=new o;return r.parse(t,e,n),r}function s(t){return l.isString(t)&&(t=r(t)),t instanceof o?t.format():o.prototype.format.call(t)}function i(t,e){return r(t,!1,!0).resolve(e)}function a(t,e){return t?r(t,!1,!0).resolveObject(e):e}var u=n("./node_modules/punycode/punycode.js"),l=n("./node_modules/url/util.js");e.parse=r,e.resolve=i,e.resolveObject=a,e.format=s,e.Url=o;var h=/^([a-z0-9.+-]+:)/i,c=/:[0-9]*$/,f=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,p=["<",">",'"',"`"," ","\r","\n","\t"],d=["{","}","|","\\","^","`"].concat(p),m=["'"].concat(d),v=["%","/","?",";","#"].concat(m),b=["/","?","#"],y=/^[+a-z0-9A-Z_-]{0,63}$/,j=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,g={javascript:!0,"javascript:":!0},O={javascript:!0,"javascript:":!0},_={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},x=n("./node_modules/querystring-es3/index.js");o.prototype.parse=function(t,e,n){if(!l.isString(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var o=t.indexOf("?"),r=-1!==o&&o<t.indexOf("#")?"?":"#",s=t.split(r),i=/\\/g;s[0]=s[0].replace(i,"/"),t=s.join(r);var a=t;if(a=a.trim(),!n&&1===t.split("#").length){var c=f.exec(a);if(c)return this.path=a,this.href=a,this.pathname=c[1],c[2]?(this.search=c[2],this.query=e?x.parse(this.search.substr(1)):this.search.substr(1)):e&&(this.search="",this.query={}),this}var p=h.exec(a);if(p){p=p[0];var d=p.toLowerCase();this.protocol=d,a=a.substr(p.length)}if(n||p||a.match(/^\/\/[^@\/]+@[^@\/]+/)){var w="//"===a.substr(0,2);!w||p&&O[p]||(a=a.substr(2),this.slashes=!0)}if(!O[p]&&(w||p&&!_[p])){for(var C=-1,T=0;T<b.length;T++){var P=a.indexOf(b[T]);-1!==P&&(-1===C||P<C)&&(C=P)}var q,A;A=-1===C?a.lastIndexOf("@"):a.lastIndexOf("@",C),-1!==A&&(q=a.slice(0,A),a=a.slice(A+1),this.auth=decodeURIComponent(q)),C=-1;for(var T=0;T<v.length;T++){var P=a.indexOf(v[T]);-1!==P&&(-1===C||P<C)&&(C=P)}-1===C&&(C=a.length),this.host=a.slice(0,C),a=a.slice(C),this.parseHost(),this.hostname=this.hostname||"";var S="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!S)for(var R=this.hostname.split(/\./),T=0,I=R.length;T<I;T++){var k=R[T];if(k&&!k.match(y)){for(var U="",F=0,N=k.length;F<N;F++)k.charCodeAt(F)>127?U+="x":U+=k[F];if(!U.match(y)){var E=R.slice(0,T),M=R.slice(T+1),L=k.match(j);L&&(E.push(L[1]),M.unshift(L[2])),M.length&&(a="/"+M.join(".")+a),this.hostname=E.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),S||(this.hostname=u.toASCII(this.hostname));var K=this.port?":"+this.port:"",$=this.hostname||"";this.host=$+K,this.href+=this.host,S&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==a[0]&&(a="/"+a))}if(!g[d])for(var T=0,I=m.length;T<I;T++){var z=m[T];if(-1!==a.indexOf(z)){var G=encodeURIComponent(z);G===z&&(G=escape(z)),a=a.split(z).join(G)}}var D=a.indexOf("#");-1!==D&&(this.hash=a.substr(D),a=a.slice(0,D));var B=a.indexOf("?");if(-1!==B?(this.search=a.substr(B),this.query=a.substr(B+1),e&&(this.query=x.parse(this.query)),a=a.slice(0,B)):e&&(this.search="",this.query={}),a&&(this.pathname=a),_[d]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var K=this.pathname||"",H=this.search||"";this.path=K+H}return this.href=this.format(),this},o.prototype.format=function(){var t=this.auth||"";t&&(t=encodeURIComponent(t),t=t.replace(/%3A/i,":"),t+="@");var e=this.protocol||"",n=this.pathname||"",o=this.hash||"",r=!1,s="";this.host?r=t+this.host:this.hostname&&(r=t+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(r+=":"+this.port)),this.query&&l.isObject(this.query)&&Object.keys(this.query).length&&(s=x.stringify(this.query));var i=this.search||s&&"?"+s||"";return e&&":"!==e.substr(-1)&&(e+=":"),this.slashes||(!e||_[e])&&!1!==r?(r="//"+(r||""),n&&"/"!==n.charAt(0)&&(n="/"+n)):r||(r=""),o&&"#"!==o.charAt(0)&&(o="#"+o),i&&"?"!==i.charAt(0)&&(i="?"+i),n=n.replace(/[?#]/g,function(t){return encodeURIComponent(t)}),i=i.replace("#","%23"),e+r+n+i+o},o.prototype.resolve=function(t){return this.resolveObject(r(t,!1,!0)).format()},o.prototype.resolveObject=function(t){if(l.isString(t)){var e=new o;e.parse(t,!1,!0),t=e}for(var n=new o,r=Object.keys(this),s=0;s<r.length;s++){var i=r[s];n[i]=this[i]}if(n.hash=t.hash,""===t.href)return n.href=n.format(),n;if(t.slashes&&!t.protocol){for(var a=Object.keys(t),u=0;u<a.length;u++){var h=a[u];"protocol"!==h&&(n[h]=t[h])}return _[n.protocol]&&n.hostname&&!n.pathname&&(n.path=n.pathname="/"),n.href=n.format(),n}if(t.protocol&&t.protocol!==n.protocol){if(!_[t.protocol]){for(var c=Object.keys(t),f=0;f<c.length;f++){var p=c[f];n[p]=t[p]}return n.href=n.format(),n}if(n.protocol=t.protocol,t.host||O[t.protocol])n.pathname=t.pathname;else{for(var d=(t.pathname||"").split("/");d.length&&!(t.host=d.shift()););t.host||(t.host=""),t.hostname||(t.hostname=""),""!==d[0]&&d.unshift(""),d.length<2&&d.unshift(""),n.pathname=d.join("/")}if(n.search=t.search,n.query=t.query,n.host=t.host||"",n.auth=t.auth,n.hostname=t.hostname||t.host,n.port=t.port,n.pathname||n.search){var m=n.pathname||"",v=n.search||"";n.path=m+v}return n.slashes=n.slashes||t.slashes,n.href=n.format(),n}var b=n.pathname&&"/"===n.pathname.charAt(0),y=t.host||t.pathname&&"/"===t.pathname.charAt(0),j=y||b||n.host&&t.pathname,g=j,x=n.pathname&&n.pathname.split("/")||[],d=t.pathname&&t.pathname.split("/")||[],w=n.protocol&&!_[n.protocol];if(w&&(n.hostname="",n.port=null,n.host&&(""===x[0]?x[0]=n.host:x.unshift(n.host)),n.host="",t.protocol&&(t.hostname=null,t.port=null,t.host&&(""===d[0]?d[0]=t.host:d.unshift(t.host)),t.host=null),j=j&&(""===d[0]||""===x[0])),y)n.host=t.host||""===t.host?t.host:n.host,n.hostname=t.hostname||""===t.hostname?t.hostname:n.hostname,n.search=t.search,n.query=t.query,x=d;else if(d.length)x||(x=[]),x.pop(),x=x.concat(d),n.search=t.search,n.query=t.query;else if(!l.isNullOrUndefined(t.search)){if(w){n.hostname=n.host=x.shift();var C=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@");C&&(n.auth=C.shift(),n.host=n.hostname=C.shift())}return n.search=t.search,n.query=t.query,l.isNull(n.pathname)&&l.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n}if(!x.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n;for(var T=x.slice(-1)[0],P=(n.host||t.host||x.length>1)&&("."===T||".."===T)||""===T,q=0,A=x.length;A>=0;A--)T=x[A],"."===T?x.splice(A,1):".."===T?(x.splice(A,1),q++):q&&(x.splice(A,1),q--);if(!j&&!g)for(;q--;q)x.unshift("..");!j||""===x[0]||x[0]&&"/"===x[0].charAt(0)||x.unshift(""),P&&"/"!==x.join("/").substr(-1)&&x.push("");var S=""===x[0]||x[0]&&"/"===x[0].charAt(0);if(w){n.hostname=n.host=S?"":x.length?x.shift():"";var C=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@");C&&(n.auth=C.shift(),n.host=n.hostname=C.shift())}return j=j||n.host&&x.length,j&&!S&&x.unshift(""),x.length?n.pathname=x.join("/"):(n.pathname=null,n.path=null),l.isNull(n.pathname)&&l.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.auth=t.auth||n.auth,n.slashes=n.slashes||t.slashes,n.href=n.format(),n},o.prototype.parseHost=function(){var t=this.host,e=c.exec(t);e&&(e=e[0],":"!==e&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)}},"./node_modules/url/util.js":function(t,e,n){"use strict";t.exports={isString:function(t){return"string"==typeof t},isObject:function(t){return"object"==typeof t&&null!==t},isNull:function(t){return null===t},isNullOrUndefined:function(t){return null==t}}},"./node_modules/webpack/buildin/global.js":function(t,e){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(n=window)}t.exports=n},"./node_modules/webpack/buildin/module.js":function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},0:function(t,e){t.exports=Injector},1:function(t,e){t.exports=React},2:function(t,e){t.exports=IsomorphicFetch},3:function(t,e){t.exports=ReactDom},4:function(t,e){t.exports=ReactSelect}});

View File

@ -2,6 +2,8 @@ import React, { Component, PropTypes } from 'react';
import Select from 'react-select';
import fetch from 'isomorphic-fetch';
import url from 'url';
// eslint-disable-next-line import/no-extraneous-dependencies
import debounce from 'lodash/debounce';
class TagField extends Component {
constructor(props) {
@ -13,6 +15,7 @@ class TagField extends Component {
this.onChange = this.onChange.bind(this);
this.getOptions = this.getOptions.bind(this);
this.fetchOptions = debounce(this.fetchOptions, 500);
}
onChange(value) {
@ -26,7 +29,7 @@ class TagField extends Component {
}
getOptions(input) {
const { lazyLoad, options, optionUrl, labelKey, valueKey } = this.props;
const { lazyLoad, options } = this.props;
if (!lazyLoad) {
return Promise.resolve({ options });
@ -36,6 +39,11 @@ class TagField extends Component {
return Promise.resolve({ options: [] });
}
return this.fetchOptions(input);
}
fetchOptions(input) {
const { optionUrl, labelKey, valueKey } = this.props;
const fetchURL = url.parse(optionUrl, true);
fetchURL.query.term = input;

View File

@ -73,9 +73,13 @@ describe('TagField', () => {
}));
});
it('should fetch the URL for results', () => {
it('should fetch the URL for results', done => {
wrapper.instance().getOptions('a');
expect(fetch).toBeCalledWith('localhost/some-fetch-url?term=a', expect.anything());
setTimeout(() => {
expect(fetch).toBeCalledWith('localhost/some-fetch-url?term=a', expect.anything());
done();
}, 500);
});
});
});

View File

@ -17,7 +17,7 @@
"node": ">=6.x"
},
"scripts": {
"build": "yarn && yarn lint && NODE_ENV=production webpack -p --bail --progress",
"build": "yarn && yarn lint && yarn test && NODE_ENV=production webpack -p --bail --progress",
"dev": "NODE_ENV=development webpack --progress",
"watch": "NODE_ENV=development webpack --watch --progress",
"css": "WEBPACK_CHILD=css npm run build",
@ -72,6 +72,7 @@
"classnames": "^2.2.5",
"isomorphic-fetch": "https://registry.npmjs.org/isomorphic-fetch/-/isomorphic-fetch-2.2.1.tgz",
"jquery": "^3.1.1",
"lodash.debounce": "^4.0.8",
"react": "15.3.1",
"react-dom": "15.3.1",
"react-select": "^1.0.0-rc.5",