diff --git a/client/dist/js/bundle.js b/client/dist/js/bundle.js index 2040577d0..ee159c0f1 100644 --- a/client/dist/js/bundle.js +++ b/client/dist/js/bundle.js @@ -9,31 +9,37 @@ n(this,e),this.actions={}}return r(e,[{key:"addAction",value:function e(t,n){thi window.ss=window.ss||{},window.ss.tinymceactions=window.ss.tinymceactions||new o,t.default=window.ss.tinymceactions},,,function(e,t){e.exports=i18n},,function(e,t){e.exports=ReactApollo},,,,function(e,t){ e.exports=FormBuilderModal},function(e,t){e.exports=SchemaActions},function(e,t){"use strict" function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0}) -var r=function(){function e(e,t){for(var n=0;n1?n-1:0),o=1;o1?n-1:0),o=1;o-1,i=this.props.failed.indexOf(r.id||0)>-1,a=this.getBreadcrumbs() -return h.default.createElement(S.default,{loading:o,failed:i,tree:r,breadcrumbs:a,renderMenuOptions:t,onBack:this.handleBack})}},{key:"renderOption",value:function e(t){var n=this,r=null +return h.default.createElement(k.default,{loading:o,failed:i,tree:r,breadcrumbs:a,renderMenuOptions:t,onBack:this.handleBack})}},{key:"renderOption",value:function e(t){var n=this,r=null if(t.count){var o=function e(r){return n.handleNavigate(r,t.id)} r=h.default.createElement("button",{className:"treedropdownfield__option-button",onClick:o,onMouseDown:o,onTouchEnd:o},h.default.createElement("span",{className:"treedropdownfield__option-count"},t.count),h.default.createElement("span",{ className:"icon font-icon-list"}))}return h.default.createElement("div",{className:"treedropdownfield__option flexbox-area-grow fill-width"},h.default.createElement("span",{className:"treedropdownfield__option__title flexbox-area-grow" @@ -926,7 +932,7 @@ for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r] return n}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e){var t=typeof e return"string"===t?e:"object"===t?JSON.stringify(e):"number"===t||"boolean"===t?String(e):""}Object.defineProperty(t,"__esModule",{value:!0}) var s=Object.assign||function(e){for(var t=1;t127?"x":A[M] -if(!I.match(b)){var L=D.slice(0,k),B=D.slice(k+1),U=A.match(w) +if(!I.match(b)){var L=D.slice(0,S),B=D.slice(S+1),U=A.match(w) U&&(L.push(U[1]),B.unshift(U[2])),B.length&&(s="/"+B.join(".")+s),this.hostname=L.join(".") break}}}this.hostname.length>g?this.hostname="":this.hostname=this.hostname.toLowerCase(),F||(this.hostname=u.toASCII(this.hostname)) var V=this.port?":"+this.port:"",H=this.hostname||"" -this.host=H+V,this.href+=this.host,F&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==s[0]&&(s="/"+s))}if(!_[h])for(var k=0,R=m.length;k0)&&n.host.split("@") P&&(n.auth=P.shift(),n.host=n.hostname=P.shift())}return n.search=e.search,n.query=e.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(!_.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n -for(var O=_.slice(-1)[0],k=(n.host||e.host||_.length>1)&&("."===O||".."===O)||""===O,S=0,j=_.length;j>=0;j--)O=_[j],"."===O?_.splice(j,1):".."===O?(_.splice(j,1),S++):S&&(_.splice(j,1),S--) -if(!b&&!w)for(;S--;S)_.unshift("..") -!b||""===_[0]||_[0]&&"/"===_[0].charAt(0)||_.unshift(""),k&&"/"!==_.join("/").substr(-1)&&_.push("") +for(var O=_.slice(-1)[0],S=(n.host||e.host||_.length>1)&&("."===O||".."===O)||""===O,k=0,j=_.length;j>=0;j--)O=_[j],"."===O?_.splice(j,1):".."===O?(_.splice(j,1),k++):k&&(_.splice(j,1),k--) +if(!b&&!w)for(;k--;k)_.unshift("..") +!b||""===_[0]||_[0]&&"/"===_[0].charAt(0)||_.unshift(""),S&&"/"!==_.join("/").substr(-1)&&_.push("") var x=""===_[0]||_[0]&&"/"===_[0].charAt(0) if(C){n.hostname=n.host=x?"":_.length?_.shift():"" var P=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@") @@ -1374,19 +1380,19 @@ return r+i}function l(e){for(var t=[],n=0,r=e.length,o,i;n65535&&(e-=65536,t+=N(e>>>10&1023|55296),e=56320|1023&e),t+=N(e)}).join("")}function d(e){return e-48<10?e-22:e-65<26?e-65:e-97<26?e-97:T}function p(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function f(e,t,n){ var r=0 -for(e=n?M(e/k):e>>1,e+=M(e/t);e>I*P>>1;r+=T)e=M(e/I) -return M(r+(I+1)*e/(e+O))}function h(e){var t=[],n=e.length,r,o=0,i=j,s=S,u,l,p,h,m,y,v,g,b +for(e=n?M(e/S):e>>1,e+=M(e/t);e>I*P>>1;r+=T)e=M(e/I) +return M(r+(I+1)*e/(e+O))}function h(e){var t=[],n=e.length,r,o=0,i=j,s=k,u,l,p,h,m,y,v,g,b for(u=e.lastIndexOf(x),u<0&&(u=0),l=0;l=128&&a("not-basic"),t.push(e.charCodeAt(l)) for(p=u>0?u+1:0;p=n&&a("invalid-input"),v=d(e.charCodeAt(p++)),(v>=T||v>M((E-o)/m))&&a("overflow"),o+=v*m,g=y<=s?C:y>=s+P?P:y-s,!(vM(E/b)&&a("overflow"),m*=b r=t.length+1,s=f(o-h,r,0==h),M(o/r)>E-i&&a("overflow"),i+=M(o/r),o%=r,t.splice(o++,0,i)}return c(t)}function m(e){var t,n,r,o,i,s,u,c,d,h,m,y=[],v,g,b,w -for(e=l(e),v=e.length,t=j,n=0,i=S,s=0;s=t&&mM((E-n)/g)&&a("overflow"),n+=(u-t)*g,t=u,s=0;sE&&a("overflow"),m==t){for(c=n,d=T;h=d<=i?C:d>=i+P?P:d-i,!(c= 0x80 (not a basic code point)", +var _,E=2147483647,T=36,C=1,P=26,O=38,S=700,k=72,j=128,x="-",F=/^xn--/,D=/[^\x20-\x7E]/,R=/[\x2E\u3002\uFF0E\uFF61]/g,A={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)", "invalid-input":"Invalid input"},I=T-C,M=Math.floor,N=String.fromCharCode,L _={version:"1.3.2",ucs2:{decode:l,encode:c},decode:h,encode:m,toASCII:v,toUnicode:y},r=function(){return _}.call(t,n,t,e),!(void 0!==r&&(e.exports=r))}(this)}).call(t,n(25)(e),function(){return this}()) @@ -2411,7 +2417,7 @@ return t.default=e,t}function o(e){return e&&e.__esModule?e:{default:e}}function }}),n=new R.default({shouldBatch:!0,addTypename:!0,dataIdFromObject:function e(t){return t.id>=0&&t.__typename?t.__typename+":"+t.id:null},networkInterface:t}) t.use([{applyMiddleware:function e(t,n){var r=(0,A.printRequest)(t.request) t.options.headers=a({},t.options.headers,{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"}),t.options.body=M.default.stringify(a({},r,{variables:JSON.stringify(r.variables)})),n()}}]), -v.default.add("config",_.default),v.default.add("form",p.reducer),v.default.add("schemas",T.default),v.default.add("records",P.default),v.default.add("breadcrumbs",k.default),v.default.add("routing",f.routerReducer), +v.default.add("config",_.default),v.default.add("form",p.reducer),v.default.add("schemas",T.default),v.default.add("records",P.default),v.default.add("breadcrumbs",S.default),v.default.add("routing",f.routerReducer), v.default.add("apollo",n.reducer()),v.default.add("treeDropdownField",F.default),j.default.start() var r={},o=(0,l.combineReducers)(v.default.getAll()),i=[d.default,n.middleware()],s=m.default.get("environment"),c=m.default.get("debugging"),h=l.applyMiddleware.apply(void 0,i),y=window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__,g=window.__REDUX_DEVTOOLS_EXTENSION__||window.devToolsExtension @@ -2421,7 +2427,7 @@ var w=h(l.createStore),E=w(o,r) E.dispatch(b.setConfig(m.default.getAll())),window.ss=window.ss||{},window.ss.store=E,window.ss=window.ss||{},window.ss.apolloClient=n var C=new u.default(E,n) C.start(window.location.pathname),window.jQuery&&window.jQuery("body").addClass("js-react-boot")}var a=Object.assign||function(e){for(var t=1;t tags. - * If no match is found, returns this.defaultLocale. - * - * @todo get by - needs modification of SSViewer - * - * @return string - Locale in mixed lowercase/uppercase format suitable - * for usage in i18n.lang arrays (e.g. 'en_US'). - */ - detectLocale() { - var rawLocale; - var detectedLocale; - - // Get by container tag - rawLocale = document.body.getAttribute('lang'); - - // Get by meta - if (!rawLocale) { - var metas = document.getElementsByTagName('meta'); - - for (var i=0; i { + // skip %%s + if (subMatch1 === '%') { + return match; + } + return subMatch1 + params[i++]; + }); + } + + /** + * Substitutes variables with a list of injections. + * + * @param {string} s - The string to perform the substitutions on. + * @param {Object} map - An object with the substitions map e.g. {var: value}. + * @return {string} - The new string with substitutions made. + */ + inject(s, map) { + const regx = new RegExp('{([A-Za-z0-9_]*)}', 'g'); + + return s.replace(regx, (match, key) => ( + (map[key]) ? map[key] : match + )); + } + + /** + * Detect document language settings by looking at tags. + * If no match is found, returns this.defaultLocale. + * + * @todo get by - needs modification of SSViewer + * + * @return string - Locale in mixed lowercase/uppercase format suitable + * for usage in i18n.lang arrays (e.g. 'en_US'). + */ + detectLocale() { + // Get from container + let rawLocale = document.documentElement.getAttribute('lang'); + + // Get from + if (!rawLocale) { + rawLocale = document.body.getAttribute('lang'); + } + + // Get by meta + if (!rawLocale) { + const metas = document.getElementsByTagName('meta'); + + for (let i = 0; i < metas.length; i++) { + if ( + metas[i].attributes['http-equiv'] && + metas[i].attributes['http-equiv'].nodeValue.toLowerCase() === 'content-language' + ) { + rawLocale = metas[i].attributes.content.nodeValue; + } + } + } + + // Fallback to default locale + if (!rawLocale) { + rawLocale = this.defaultLocale; + } + + const rawLocaleParts = rawLocale.match(/([^-|_]*)[-|_](.*)/); + // Get locale (e.g. 'en_US') from common name (e.g. 'en') + // by looking at i18n.lang tables + if (rawLocale.length === 2) { + for (const compareLocale of this.lang) { + if (compareLocale.substr(0, 2).toLowerCase() === rawLocale.toLowerCase()) { + return compareLocale; + } + } + return null; + } + + if (rawLocaleParts) { + const lang = rawLocaleParts[1].toLowerCase(); + const region = rawLocaleParts[2].toUpperCase(); + return `${lang}_${region}`; + } + + return null; + } + + /** + * Attach an event listener to the given object. + * Modeled after behaviour.js, but externalized + * to keep the i18n library standalone for now. + * + * @param {Element} obj + * @param {string} evType + * @param {function} fn + * @param {boolean} useCapture + * @returns {boolean} + */ + addEvent(obj, evType, fn, useCapture) { + if (obj.addEventListener) { + obj.addEventListener(evType, fn, useCapture); + return true; + } + if (obj.attachEvent) { + return obj.attachEvent(`on${evType}`, fn); + } + throw new Error('Handler could not be attached'); + } } let _i18n = new i18n();