ywana-core8 0.0.7 → 0.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.modern.js +1 -1
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +4 -3
- package/src/domain/CollectionPage.js +1 -1
- package/src/domain/TablePage.js +1 -1
- package/src/html/chip.js +1 -0
- package/src/html/list.js +1 -1
- package/src/html/progress.js +1 -0
- package/src/html/property.js +1 -0
- package/src/html/table.js +1 -1
- package/src/html/text.js +1 -1
- package/src/site/dialog.js +1 -1
- package/src/site/siteContext.js +2 -0
package/dist/index.cjs
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
require("material-design-icons-iconfont/dist/material-design-icons.css");var e=require("react"),n=require("deep-equal"),t=require("resumablejs");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=/*#__PURE__*/o(e),r=/*#__PURE__*/o(n),a=/*#__PURE__*/o(t),l=function(e,n,t,o){void 0===t&&(t=null);try{console.log("FETCH",e,n);var i={method:e,mode:"cors",headers:{Accept:"application/json","Content-Type":"application/json","x-access-token":o},body:t};return Promise.resolve(function(e,t){try{var o=Promise.resolve(fetch(n,i)).then(function(e){var n;function t(t){if(n)return t;throw e}var o=function(){if(e.ok)return Promise.resolve(e.json()).then(function(e){return n=1,e})}();return o&&o.then?o.then(t):t(o)})}catch(e){return t(e)}return o&&o.then?o.then(void 0,t):o}(0,function(e){if(e instanceof Error)throw{error:e};return Promise.resolve(e.json()).then(function(e){throw{success:!1,message:e.message}})}))}catch(e){return Promise.reject(e)}},u=function(e,n){return{GET:function(t){var o=n?n.token():null;return l("GET",e+t,void 0,o)},POST:function(t,o){var i=n?n.token():null;return l("POST",e+t,o,i)},PUT:function(t,o){var i=n?n.token():null;return l("PUT",e+t,o,i)},PATCH:function(t,o){var i=n?n.token():null;return l("PATCH",e+t,o,i)},DELETE:function(t){var o=n?n.token():null;return l("DELETE",e+t,void 0,o)}}},c=process.env.REACT_APP_SESSION||window&&window.SESSION?window.SESSION:"YWANA-CORE6-SESSION",s={token:function(){return(sessionStorage.getItem(c)?JSON.parse(sessionStorage.getItem(c)):{}).token},me:function(){return(sessionStorage.getItem(c)?JSON.parse(sessionStorage.getItem(c)):{}).me},init:function(e,n){sessionStorage.setItem(c,JSON.stringify({token:e,me:n}))},refresh:function(e){var n=this.me();sessionStorage.setItem(c,JSON.stringify({token:e,me:n}))},isLoggedIn:function(){return!!sessionStorage.DSSession},logout:function(){sessionStorage.removeItem(c)}},d=function(e){var n=e.size,t=e.clickable,o=e.action;return h("i",{className:"icon "+(void 0===n?"normal":n)+" "+(void 0!==t&&t?"clickable":"")+" material-icons",onClick:function(e){e.stopPropagation(),e.preventDefault(),o&&o()}},e.icon)},f=function(e){var n=e.label,t=e.icon,o=e.action,i=e.disabled,r=void 0!==i&&i,a=e.raised?"raised":e.outlined?"outlined":"normal";return r&&(a+=" disabled"),h("button",{className:"btn "+a,onClick:function(e){r||(e.stopPropagation(),e.preventDefault(),o&&o())}},t?h(d,{icon:t,size:"small"}):null,h("span",null,n))},v=React.createContext({}),m=function(n){var t=n.children,o=e.useContext(v);if(o){var i=o.dictionary,r=(void 0===i?{}:i)[t],a=r?r[o.lang]:t;return a?h("span",null,a):""}return t?h("span",null,t):""},p=function(e){var n=e.id,t=e.label,o=e.placeholder,i=e.value,r=e.onChange;function a(e){r&&r(n,e.target.checked)}var l=h(m,null,t);return console.log(t,i),!0===i?h("div",{className:"checkbox",key:n+"1"},h("input",{id:n,type:"checkbox",placeholder:o,checked:!0,value:i,onChange:a}),h("span",{class:"checkmark"}),h("label",{htmlFor:n},l)):h("div",{className:"checkbox",key:n+"0"},h("input",{id:n,type:"checkbox",placeholder:o,value:i,onChange:a}),h("span",{class:"checkmark"}),h("label",{htmlFor:n},l))},g=function(n){var t=n.title,o=n.columns,r=void 0===o?1:o,a=n.children,l=n.outlined,u=n.onChange,c=e.useState([]),s=c[0],d=c[1],f=function(e){return null==e||""===e};e.useEffect(function(){var e=i.default.Children.toArray(a).filter(function(e){return null!==e&&""!==e}).map(function(e){var n=e.props,t=n.id,o=n.value,i=n.required,r=void 0!==i&&i,a=n.validation,l=!r||(a?a(o):!f(o));return{id:t,value:o,required:r,validation:a,valid:l}}).filter(function(e){return void 0!==e.id});d(e)},[]),e.useEffect(function(){if(u){var e=s.every(function(e){return!0===e.valid}),n=s.reduce(function(e,n){var t=n.value;return(t||!1===t)&&(e[n.id]=t),e},{});u(n,e)}},[s]);var v=function(e,n){var t=s.find(function(n){return n.id===e});if(t){var o=!t.required||(t.validation?t.validation(n):!f(n));Object.assign(t,{value:n,valid:o}),d(s.slice())}},p=i.default.Children.toArray(a).filter(function(e){return null!==e&&""!==e}).map(function(e){var n=e.props.span,t=void 0===n?1:n,o=i.default.cloneElement(e,{onChange:v,outlined:!!l});return h(b,{style:{gridColumn:"span "+t}},o)}),g={gridTemplateColumns:"repeat("+r+", 1fr)"};return h(e.Fragment,null,t?h("header",{className:"form-header"},h(m,{use:"headline6"},t)):"",h("form",{className:"form-grid",style:g},p))},b=function(e){return h("div",{className:"field-wrapper",style:e.style},e.children)},C=function(e){var n=e.caption?"caption":"",t=e.prominent?"prominent":"",o=e.dense?"dense":"",i=e.primary?"primary":"";i=e.secondary?"secondary":i;var r=e.icon?h(d,{icon:e.icon,clickable:e.clickable,action:e.action}):"";r=e.iconSrc?h("img",{className:"header-icon",src:e.iconSrc}):r;var a=e.img?{backgroundImage:"url("+e.img+")"}:{},l=h(m,null,e.title);return h("header",{className:"header "+n+" "+t+" "+o+" "+i+" "+e.className,style:a},r,e.title?h("label",null,l):null,h("span",{className:"actions"},e.children))};function y(){return y=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},y.apply(this,arguments)}var N=function(e){var n=e.items,t=void 0===n?[]:n,o=e.children,i=e.onSelect;function r(e){i&&i(e)}return e.groupBy?h(S,y({},e,{onSelect:r})):h("div",{className:"list"},h("ul",null,t.map(function(e){return h(x,{key:e.id,item:e,onSelect:r})})),o)},S=function(n){var t=n.items,o=n.children,i=n.onSelect,r=n.groupBy,a=(void 0===t?[]:t).reduce(function(e,n){var t=e.find(function(e){return e.name===n.content[r]});return t||e.push(t={name:n.content[r],items:[]}),t.items.push(n),e},[]);return h("div",{className:"list"},a.map(function(n){return h(e.Fragment,{key:n.name},h("header",{key:n.name+"-header"},h(m,null,n.name)),h("ul",{key:n.name+"-ul"},n.items.map(function(e){return h(x,{key:e.id,item:e,onSelect:i})})))}),o)},x=function(e){var n=e.item,t=e.onSelect,o=n.id,i=n.icon,r=n.line1,a=n.line2,l=n.meta;return h("li",{id:o,onClick:function(){t&&t(o)}},i?h(d,{icon:i,size:"small"}):null,h("main",null,h("div",{className:"primary-line"},h(m,null,r)),a?h("div",{className:"secondary-line"},h(m,null,a)):null),l?h("div",{className:"meta"},l):null)},k=i.default.createContext({}),E=function(e){return h("ul",null,e.children)},P=function(n){var t=n.icon,o=void 0===t?"more_vert":t,i=n.children,r=n.align,a=e.useState(!1),l=a[0],u=a[1];function c(){u(!l)}return h(k.Provider,{value:[l,u]},h("div",{className:"menu-icon"},h(d,{icon:o,clickable:!0,action:c}),l?h("menu",{className:""+r},i):null,l?h("div",{className:"overlay",onClick:c}):null))},O=function(n){var t=n.icon,o=n.label,i=n.meta,r=n.onSelect,a=e.useContext(k)[1];return h("li",{className:"menu-item",onClick:function(){r&&r(),a(!1)}},t?h(d,{icon:t}):null,h("label",null,o),i?h("div",{className:"meta"},i):null)},w=function(e){return h("div",{className:"circular-progress"},h(d,{icon:"refresh",size:"small"}))},T=function(e){var n=e.progress,t=e.max;return h("div",{className:"linear-progress"},h("progress",{value:void 0===n?0:n,max:void 0===t?100:t}))},j=function(e){var n=e.selected,t=e.onChange,o=i.default.Children.map(e.children,function(e,o){return i.default.cloneElement(e,{selected:o===n,onSelect:function(){t&&t(o)}})});return h("div",{class:"tabs"},o,h("div",{class:"tab-filler"}))},A=function(e){var n=e.onSelect;return h("div",{className:"tab "+(e.selected?"selected":""),onClick:function(){n&&n()}},e.label,e.actions||null)},D=function(n){var t=n.selected,o=void 0===t?0:t,r=i.default.Children.toArray(n.children).filter(function(e,n){return n===o})[0];return h(e.Fragment,null,r)},R=function(n){var t=e.useContext(v),o=n.id,i=n.type,r=void 0===i?"text":i,a=n.label,l=n.placeholder,u=n.value,c=n.readOnly,s=void 0!==c&&c,d=n.onChange,f=n.onEnter,p=n.onClick,g=(a?"":"no-label")+" "+(n.outlined?"textfield-outlined":"textfield"),b=h(m,null,a);return h("div",{className:""+g,onClick:p},h("input",{id:o,type:r,placeholder:l,value:u,required:!0,onChange:function(e){e.stopPropagation(),e.preventDefault(),d&&d(o,e.target.value)},onKeyDown:function(e){13==(e.charCode?e.charCode:e.keyCode?e.keyCode:0)&&f()},onFocus:function(){t&&t.changeFocus({lose:function(){}})},readOnly:s}),h("span",{className:"bar"}),a?h("label",null,b):null)},I=function(n){var t=e.useContext(v),o=n.id,i=n.options,r=void 0===i?[]:i,a=n.value,l=n.onChange,u=e.useState(!1),c=u[0],s=u[1],f=e.useState(),m=f[0],p=f[1];function g(){t&&t.changeFocus({lose:function(){s(!1)}}),s(!c)}return e.useEffect(function(){if(Array.isArray(r)){var e=r.find(function(e){return e.value===a});e&&p(e.label)}},[a]),h("div",{className:"dropdown"},h(R,y({},n,{onClick:g,value:m})),h(d,{icon:"expand_more",clickable:!0,size:"small",action:g}),1==c?h("menu",null,h("ul",{onClick:function(e){var n=e.target.getAttribute("value"),t=r.find(function(e){return e.value===n});l&&l(o,n),p(t.label),s(!1)}},Array.isArray(r)?r.map(function(e){return h("li",{key:e.value,value:e.value},e.label)}):null)):null)},_=function(n){var t=n.columns,o=void 0===t?[]:t,i=n.rows,r=void 0===i?[]:i,a=n.onRowSelection,l=n.onSort,u=n.editable,c=n.outlined,s=e.useState({})[0];function f(e,n){a&&a(e,n)}function v(e,n){l&&l(e,n)}return h("div",{className:"datatable8 "+(c?"outlined":"")},h("table",null,h("thead",null,h("tr",null,o.map(function(e){var n=e.sortable;return h("th",null,h(m,null,e.label),n?h(d,{icon:"arrow_up",size:"small",clickable:!0}):null)}))),h("tbody",null,function(e,n){void 0===n&&(n={});var t=Object.keys(n);if(!t.length)return e;var o=function(e,n,t){return t=null!==t?t:1,e===n?0:e>n?t:-1*t};return e.sort(function(e,i){for(var r=0,a=0;0===r&&a<t.length;){var l=t[a];l&&(r=o(e[l],i[l],n[l]),a++)}return r})}(r,s).map(function(e){return h(F,{key:e.id,row:e,columns:o,onSelect:f,onDrop:v,editable:u})}))))},F=function(n){var t,o=n.row,i=n.columns,r=void 0===i?[]:i,a=n.onSelect,l=n.editable,u=e.useState(!1),c=u[0],s=u[1],f=c?"expand_more":"expand_less";return h(e.Fragment,null,h("tr",{onClick:function(e){return a(o,e)}},r.map(function(e){return h(L,{row:o,column:e,cell:o[e.id],editable:l})}),o.info?h(d,{icon:f,clickable:!0,action:function(){return s(!c)}}):null),o.info&&c?h("tr",{className:"table-row-info"},(t=o.info)&&("[object Function]"===Object.prototype.toString.call(t)||"function"==typeof t||t instanceof Function)?o.info():o.info):null)},L=function(e){var n=e.row,t=e.column,o=e.cell,i=e.editable;return h("td",{className:t.id},function(e){var r=t.id,a=t.disabled,l=void 0!==a&&a,u=t.min,c=t.max,s=t.onChange,f=t.options;if(i&&s)switch(e){case"ICON":return h(d,{icon:o});case"BOOLEAN":case"Boolean":return h(p,{id:r,value:o,onChange:function(e,t){return s(n.id,e,t)},disabled:l});case"SELECTION":return h(I,{id:r,value:o,placeholder:"--Select--",options:f,onChange:function(e,t){return s(n.id,e,t)}});case"CHECK":return h(p,{id:r,value:o,onChange:function(e,t){return s(n.id,e,t)},disabled:n.disabled});case"CHECKABLE":return o&&o.value?h(p,{id:r,value:o.checked||!1,label:o.value,onChange:function(e,t){return s(n.id,e,o.value,t,o)}}):"";case"TEXTFIELD":return h(R,{id:r,value:o,onChange:function(e,t){return s(n.id,e,t)}});case"String":return h(U,{id:r,value:o,options:f,onChange:function(e,t){return s(n.id,e,t)}});case"Number":return h(R,{id:r,type:"number",value:o,min:u,max:c,onChange:function(e,t){return s(n.id,e,t)}});default:return o}else switch(e){case"ICON":return h(d,{icon:o});case"Boolean":return h(B,{id:r,value:o});case"String":return h(K,{id:r,value:o,options:f});default:return o}}(t.type))},B=function(e){var n=e.value;return h(d,{icon:!0===(void 0!==n&&n)?"check_box":"check_box_outline_blank"})},K=function(e){var n=e.value,t=e.options,o=t?t.find(function(e){return e.value===n}):null;return h("div",{className:"field-editor string-editor"},o?o.label:n)},U=function(e){var n=e.id,t=e.value,o=void 0===t?"":t,i=e.options,r=e.onChange;function a(e,n){r&&r(e,n)}return h("div",{className:"field-editor string-editor"},i?h(I,{outlined:!0,id:n,value:o,onChange:a,options:i}):h(R,{outlined:!0,id:n,value:o,onChange:a}))},z=function(n){var t=n.id,o=n.label,i=n.init,r=n.onChange,a=e.useRef(!1),l=e.useState(),u=l[0],c=l[1],s=e.useState(i),d=s[0],f=s[1];return e.useEffect(function(){a.current?r&&d&&r(t,d):a.current=!0},[d]),h("div",{className:"tokenField"},h("label",null,o),d.map(function(e,n){return h(q,{text:e,onDelete:function(){return function(e){var n=d.slice();n.splice(e,1),f(n)}(n)}})}),h("input",{type:"text",value:u,onChange:function(e){c(e.target.value)},onKeyDown:function(e){if("Enter"===e.key){e.preventDefault(),e.stopPropagation();var n=d.concat(e.target.value);f(n),c("")}if(""===u&&d.length>0&&"Backspace"===e.key){var t=d.slice(0,-1);f(t)}}}))},q=function(e){var n=e.onDelete;return h("div",{className:"token"},h(m,{use:"caption",tag:"div"},e.text),h(d,{icon:"close",clickable:!0,action:n,size:"small"}))},M=function(e){var n=e.nodes;return h("div",{className:"tree"},void 0===n?[]:n,e.children)},Y=function(e){var n=e.icon,t=void 0===n?"folder":n,o=e.label,i=e.open,r=e.children,a=e.actions;return h("details",{className:"tree-node",open:void 0!==i&&i},h("summary",{className:"tree-item"},t?h(d,{icon:t,size:"small",small:!0}):null,h("div",{className:"label"},o),h("div",{className:"actions"},a)),r)},G=function(e){var n=e.id,t=e.icon,o=e.label,i=e.actions,r=e.onSelect;return h("div",{className:"tree-item final",onClick:function(){r&&r(n)}},h(d,{icon:void 0===t?"description":t,size:"small",small:!0}),h("div",{className:"label"},o),h("div",{className:"actions"},i))},H=i.default.createContext({}),J=function(n){var t=n.context,o=n.children,i=e.useState(void 0===t?{}:t);return h(H.Provider,{value:[i[0],i[1]]},o)},V=function(e){var n=e.layout,t=e.context;return h(J,{context:void 0===t?{}:t},h("article",{className:"page6 "+(void 0===n?"simple":n)},e.children))},W=function(n){var t=n.children,o=n.siteDictionary,i=e.useState(n.siteLang),r=i[0],a=i[1],l=e.useState(o),u=l[0],c=l[1],s=e.useState("max"),d=s[0],f=s[1],m=e.useState(!1),p=m[0],g=m[1],b=e.useState(null),C=b[0],y=b[1],N=e.useState(!1),S=N[0],x=N[1],k=e.useState(),E=k[0],P=k[1],O=e.useState(),w=O[0],T=O[1],j=e.useState(),A=j[0],D=j[1],R=e.useState(),I=R[0],_=R[1],F=e.useState(),L=F[0],B=F[1],K={lang:r,setLang:a,dictionary:u,setDictionary:c,focused:L,changeFocus:function(e){L&&L.lose(),B(e)},sideNav:d,setSideNav:f,showNav:p,setShowNav:g,info:C,openInfo:function(e){y(e)},closeInfo:function(){y(null)},console:S,toggleConsole:function(){x(!S)},breadcrumb:I,setBreadcrumb:_,page:E,goto:function(e){P(e)},dialog:w,openDialog:function(e){T(e)},closeDialog:function(){T(null)},preview:A,openPreview:function(e){D(e)},closePreview:function(){D(null)}};return h(v.Provider,{value:K},t)},X=function(e){var n=e.icon;return h(C,{icon:void 0===n?"equalizer":n,title:e.title})},Q=function(n){var t=n.children;return e.useContext(v),h("nav",null,t)},Z=function(){var n=e.useContext(v);return n.info?h("aside",null,n.info):""},$=function(n){var t=n.children,o=n.min,i=e.useContext(v),r=i.showNav;e.useEffect(function(){o&&i.setSideNav("min")},[]);var a=t?e.Children.toArray(t).reduce(function(e,n){var t=n.props?n.props.section:"...";e[t]||(e[t]=[]);var o=n.props,i=o.title;return i&&e[t].push({id:o.id,icon:o.icon,title:i}),e},{}):{};return h("menu",{className:"min "+(r?"show":"")},h("main",null,Object.keys(a).map(function(n){return h(e.Fragment,{key:n},a[n].map(function(e){var n=e.id,t=e.icon;return h(d,{key:n,icon:void 0===t?"info":t,clickable:!0,checked:n===i.page,action:function(){return function(e){i.setShowNav(!1),i.goto(e)}(n)}})}),h("div",{className:"section-divider"}))})))},ee=function(n){var t=n.children,o=n.init,r=e.useContext(v),a=r.page;return e.useEffect(function(){r.goto(o||"EMPTY")},[]),h("main",null,i.default.Children.toArray(t).filter(function(e){return!!e.props&&e.props.id===a}))},ne=function(){var n=e.useContext(v);return n.dialog?n.dialog:""},te=function(){var n=e.useContext(v);return n.preview?h("div",{className:"site-preview"},n.preview):""},oe=function(){return e.useContext(v).console?h("footer",{className:"site-console"},h(C,null,h(j,null,h(A,{label:"Console"}))),h("main",null)):""},ie=function(n){var t=e.useContext(v),o=n.icon,i=n.title,r=void 0===i?"Dialog":i,a=n.children,l=n.actions;return h(e.Fragment,null,h("div",{className:"overlay"}),h("div",{className:"dialog",onClick:function(){t.closeDialog()}},h("div",{className:"dialog-panel",onClick:function(e){e.preventDefault(),e.stopPropagation()}},h("header",null,o?h(P,{icon:o}):null,h(m,null,r)),h("main",null,a),h("footer",null,l))))},re={STRING:"String",NUMBER:"Number",DATE:"Date",BOOLEAN:"Boolean",ARRAY:"Array",ENTITY:"Object",FUNCTION:"Function",EMAIL:"String"},ae=Object.values(re).reduce(function(e,n){return e["is"+n]=function(e){return toString.call(e)=="[object "+n+"]"},e},{}),le=/*#__PURE__*/function(){function e(e){this._schema=e}var n=e.prototype;return n.checkType=function(n,t){var o=n.type,i=n.item,r=!0,a=!0;if(i){var l=new e(i);switch(o){case re.ARRAY:r=ae["is"+o](t),a=t.every(function(e){return l.validate(e)});break;case re.ENTITY:r=ae["is"+o](t),a=l.validate(t);break;case re.NUMBER:r=ae["is"+o](t.value),a=!0;break;default:r=!0,a=!0}}return r&&a},n.validate=function(e){var n=this;return Object.entries(this._schema).filter(function(e){return!0===e[1].required}).every(function(t){var o=t[0];return void 0!==e[o]&&n.checkType(t[1],e[o])})},n.form=function(e){return Object.entries(this._schema).reduce(function(n,t){var o=t[0];return n[o]=Object.assign({},t[1],{value:e[o]}),n},{})},n.sections=function(e){var n=this.form(e),t=Object.values(n).reduce(function(e,n){var t=n.section||"";return e.hasOwnProperty(t)||(e[t]={title:t,fields:[]}),e[t].fields.push(n),e},{});return Object.values(t)},n.value=function(n){return Object.entries(this._schema).reduce(function(t,o){var i=o[0],r=o[1],a=r.item,l=n?n[i]:null;switch(r.type){case re.STRING:case re.NUMBER:case re.BOOLEAN:t[i]=l||r.default;break;case re.ENTITY:var u=new e(a);t[i]=u.value(l);break;case re.ARRAY:if(a===re.STRING)t[i]=l||[];else{var c=new e(a);t[i]=l?l.map(function(e){return c.value(e)}):[]}break;default:t[i]=r}return t},{})},e}(),ue=/*#__PURE__*/function(){function e(e,n){this.type=e,this._type=new le(e),this._value=n}var n=e.prototype;return n.isValid=function(){return this._type.validate(this._value)},n.value=function(){return this._type.value(this._value)},n.form=function(){return this._type.form(this._value)},n.sections=function(){return this._type.sections(this._value)},n.update=function(e){this._value=e},e}(),ce=function(e){var n=e.columns,t=void 0===n?1:n,o=e.filter,i=e.onChange,r=e.content.form();console.log(r);var a=Object.keys(r).map(function(e){return r[e]}).filter(function(e){return!o||o(e)});return console.log(a),h(g,{className:"content-form",columns:t,outlined:!0,onChange:i},a.map(function(e){return h(se,y({key:e.id},e))}))},se=function(e){switch(e.type){case re.BOOLEAN:return h(p,y({key:e.id},e));case re.NUMBER:return h(he,y({key:e.id},e));default:return h(de,y({key:e.id},e))}},de=function(e){var n,t=e.id,o=e.type,i=e.label,r=e.options,a=e.textarea,l=e.required,u=void 0!==l&&l,c=e.value,s=e.onChange,d=e.outlined,f=((n={})[re.NUMBER]="number",n[re.DATE]="date",n)[o]||"text";return r?h(I,{key:t,id:t,label:i,value:c,onChange:s,options:"function"==typeof r?r():r,outlined:d}):h(R,{key:t,id:t,type:f,label:i,value:c,onChange:s,required:u,outlined:d,textarea:a})},he=function(e){var n=e.id,t=e.label,o=e.options,i=e.required,r=void 0!==i&&i,a=e.value,l=e.onChange,u=e.outlined;function c(e,n){l&&l(e,+n?+n:n)}return o?h(I,{key:n,id:n,label:t,value:a,onChange:c,options:o,outlined:u}):h(R,{key:n,id:n,type:"number",label:t,value:a,onChange:c,required:r,outlined:u})},fe=function(e){var n=e.content,t=e.filter,o=e.onChange;function i(e,t){var i,r=Object.assign({},n.value(),((i={})[e]=t,i));o&&o(r)}var r=n.sections();return h("div",{className:"content-editor"},r.map(function(e){var o=e.title,r=e.fields;return h("section",{key:o},h("header",null,o),h("main",null,r.filter(function(e){return"id"!==e.id}).filter(function(e){return!t||t(e,n)}).map(function(e){return h(pe,{key:e.id,field:e,onChange:i})})))}))},ve=function(n){var t=n.content,o=n.filter,i=n.grouped,r=void 0!==i&&i,a=n.onChange,l=e.useState(0),u=l[0],c=l[1];function s(e,n){var o,i=Object.assign({},t.value(),((o={})[e]=n,o));a&&a(i)}var d=t.sections();return h("div",{className:"content-editor tabbed"},h(j,{selected:u,onChange:function(e){c(e)}},d.map(function(e){return h(A,{label:e.title})})),h(D,{selected:u},d.map(function(n){var i=n.fields;return h("section",{key:n.title},h("nav",null," "),h("main",null,r?function(e){var n=e.fields,t=(void 0===n?[]:n).reduce(function(e,n){var t=n.group||"",o=e[t]||{name:t,fields:[]};return o.fields.push(n),e[t]=o,e},{});return Object.values(t)}(n).map(function(n){return h(e.Fragment,null,n.name.length>0?h("div",{className:"group-caption"},n.name):null,n.fields.filter(function(e){return"id"!==e.id}).filter(function(e){return!o||o(e)}).map(function(e){return h(pe,{key:e.id,field:e,onChange:s,content:t})}))}):i.filter(function(e){return"id"!==e.id}).filter(function(e){return!o||o(e)}).map(function(e){return h(pe,{key:e.id,field:e,onChange:s,content:t})})))})))},me=function(n){var t=n.content,o=n.onChange,i=t.value(),r=Object.values(t.type).filter(function(e){return e.type===re.ARRAY}),a=e.useState(),l=a[0],u=a[1];function c(){}return h("div",{className:"content-editor treeded-editor"},h("menu",null,h("header",null,h(m,{use:"caption"},"Tree Editor")),h(M,null,r.map(function(e,n){return h(Y,{icon:"folder",label:e.label,actions:[h(d,{small:!0,icon:"add",clickable:!0,action:c})]},i[e.id]?i[e.id].map(function(n,t){return h(G,{icon:n.icon||"description",label:n.name||n.label,onSelect:function(){return function(e,n,t){var o=new ue(t.item,n);u({index:e,item:o,node:t,value:i[t.id]})}(t,n,e)}})}):null)}))),h("div",null,l?h(ve,{content:l.item,onChange:function(e){var n,t=l.value.slice();t[l.index]=e;var r=Object.assign({},i,((n={})[l.node.id]=t,n));o&&o(r)}}):"select"))},pe=function(e){var n=e.field,t=e.onChange,o=e.content,i=e.outlined,r=void 0!==i&&i,a=n.id,l=n.type,u=n.item,c=n.label,s=n.editable,d=n.options;function f(e,n){t&&t(e,n)}return function(){var e=n.value?n.value:n.default;switch(l){case re.ENTITY:return h(ge,{field:n,value:e,onChange:f});case re.STRING:return h(be,{outlined:r,field:n,value:e,onChange:f,content:o});case re.BOOLEAN:return h(p,{outlined:!0,id:a,label:c,value:e,onChange:f});case re.DATE:return h(R,{outlined:r,id:a,type:"date",label:c,value:e,onChange:f,disabled:s});case re.NUMBER:return h(Ce,{outlined:r,field:n,value:e,onChange:f});case re.ARRAY:return u===re.STRING?d?h(Ne,{content:o,field:n,value:e,onChange:f}):h(ye,{field:n,value:e,onChange:f}):h(Se,{field:n,value:e,onChange:f});default:return h("div",null,c)}}()},ge=function(e){var n=e.field,t=e.value,o=e.onChange,i=n.id,r=n.label,a=new ue(n.item,void 0===t?{}:t);function l(e,n){var t,r=Object.assign({},a.value(),((t={})[e]=n,t));o&&o(i,r)}var u=a.form(),c=Object.keys(u).map(function(e){return u[e]});return h("div",{className:"entity-editor"},h("header",null,h(m,{use:"caption"},r)),h("main",null,c.map(function(e){return h(pe,{key:e.id,field:e,onChange:l})})))},be=function(e){var n=e.field,t=e.value,o=void 0===t?"":t,i=e.onChange,r=e.outlined,a=n.id,l=n.label,u=n.options,c=n.editable;function s(e,n){i&&i(e,n)}return h("div",{className:"field-editor string-editor"},void 0===c||c?u?h(I,{outlined:r,id:a,label:l,value:o,onChange:s,options:"function"==typeof u?u(n,e.content):u}):h(R,{outlined:r,id:a,label:l,value:o,onChange:s}):h(R,{outlined:r,id:a,label:l,value:o,onChange:s,readOnly:!0}))},Ce=function(e){var n=e.field,t=e.onChange,o=n.editable;return h("div",{className:"field-editor number-editor"},h(R,{outlined:!0,id:n.id,label:n.label,type:"NUMBER",value:e.value||n.default,max:n.max,min:n.min,onChange:function(e,n){t&&t(e,n)},disabled:!(void 0===o||o)}))},ye=function(e){var n=e.field,t=e.value,o=e.onChange;return h("div",{className:"list-editor"},h(z,{id:n.id,label:n.label,init:void 0===t?[]:t,onChange:function(e,n){o&&o(e,n)}}))},Ne=function(e){var n=e.field,t=e.value,o=void 0===t?[]:t,i=e.content,r=e.onChange,a=n.id,l=n.options;return h("div",{className:"multiselection-editor"},h("label",null,n.label),("function"==typeof l?l(n,i):l).map(function(e){var n=o.includes(e.value);return h(p,{value:n,label:e.label,onChange:function(){return(t=o.indexOf(n=e.value))>=0?o.splice(t,1):o.push(n),void(r&&r(a,o));var n,t}})}))},Se=function(e){var n=e.field,t=e.value,o=void 0===t?[]:t,i=e.onChange,r=n.id,a=n.item,l=n.label,u=n.Feeder,c=n.Renderer,s=n.Adder,f=void 0===s||s,v=n.editable,p=void 0===v||v;function g(e){if(i){var n=o.concat(e);i(r,n)}}function b(e){if(i){var n=o.filter(function(n,t){return t!==e});i(r,n)}}function C(e,n,t){if(i){var a=o.slice();a[e][n]=t,i(r,a)}}var N=Object.values(a).map(function(e){return y({},e,{onChange:C})});N.push({id:"actions",label:"Actions"});var S=o.map(function(e,n){return y({},e,{id:n,actions:[h(d,{icon:"delete",clickable:!0,action:function(){return b(n)},small:!0})]})}),x={columns:N,rows:S};return h("div",{className:"collection-editor"},h("header",null,h(m,{use:"caption"},l),h("div",{className:"actions"},u?h(u,{onAdd:g}):null)),c?h(c,{field:n,value:o,onRemove:b,onChange:i}):h(_,y({},x,{editable:p})),h("footer",null,f?h(xe,{item:a,onAdd:g}):null))},xe=function(n){var t=n.item,o=n.onAdd,i=e.useState(!1),r=i[0],a=i[1],l=e.useState({}),u=l[0],c=l[1];function s(){a(!r)}function v(e,n,t){if(o){var i,r=Object.assign({},u,((i={})[n]=t,i));c(r)}}var m=Object.values(t).map(function(e){return y({},e,{type:"String",onChange:v})});m.push({id:"actions",label:""});var p=[{actions:[h(d,{icon:"done",clickable:!0,action:function(){o&&o([u]),s()}}),h(d,{icon:"close",clickable:!0,action:s})]}];return p[0]=Object.assign({},u,p[0]),h("div",{className:"collection-adder"},r?h(_,y({},{columns:m,rows:p},{editable:!0})):h(f,{icon:"add",label:"Add",action:s}))},ke=function(n){var t=n.label,o=n.type,i=n.value,r=void 0===i?{}:i,a=n.filter,l=n.validator,u=n.onOK,c=e.useContext(v),s=e.useState(r),d=s[0],p=s[1],g=e.useState(!1),b=g[0],C=g[1],y=e.useState([]),N=y[0],S=y[1];function x(e){"OK"===e&&u&&u(Object.assign({},r,d)),c.closeDialog()}var k=h(e.Fragment,null,h(f,{label:"CLOSE",action:function(){return x("CLOSE")}}),h("div",{className:"expand"}),h(f,{label:"OK",action:function(){return x("OK")},disabled:!b,raised:!0})),E=h(m,{use:"headline6"},t),P=new ue(o,d);return h(ie,{title:E,open:!0,onAction:x,actions:k},h(fe,{content:P,onChange:function(e){if(p(e),l){var n=l(e),t=n.errors,o=void 0===t?[]:t;C(n.validation),S(o)}else C(!0)},filter:a}),N.map(function(e){return h(m,{use:"overline",tag:"div",className:"error"},e)}))};function Ee(e,n){try{var t=e()}catch(e){return n(e)}return t&&t.then?t.then(void 0,n):t}var Pe=u(window.API||process.env.REACT_APP_API,s),Oe=function(n){var t=n.groupBy,o=e.useContext(H),i=o[0],r=o[1],a=i.all,l=void 0===a?[]:a,u=l?l.map(function(e){return{id:e.id,line1:e.name,line2:e.description,content:e}}):[];return h(N,{items:u,onSelect:function(e){try{return i.clear(),r(Object.assign({},i)),Promise.resolve(i.select(e)).then(function(){r(Object.assign({},i))})}catch(e){return Promise.reject(e)}},groupBy:t})},we=function(n){var t=function(e){try{return r.clear(),a(Object.assign({},r)),Promise.resolve(r.select(e)).then(function(){a(Object.assign({},r))})}catch(e){return Promise.reject(e)}},o=n.levels,i=e.useContext(H),r=i[0],a=i[1],l=r.all,u=function e(n,t){var o=function(e,n){return e.reduce(function(e,t){var o=e.find(function(e){return e.name===t[n]});return o||e.push(o={name:t[n],items:[],field:n}),o.items.push(t),e},[])}(t,n[0]);return n.length>1&&o.forEach(function(t){return t.nodes=e(n.slice(1),t.items)}),o}(o,void 0===l?[]:l);return h("main",null,h(M,null,function e(n){return n.map(function(n){return h(Y,{key:n.name,icon:null,label:"boolean"==typeof n.name?n.field+" = "+n.name:n.name,open:!0},n.nodes?e(n.nodes):n.items.map(function(e){return h(G,{key:e.id,id:e.id,label:e.name,onSelect:t},"item")}))})}(u)))},Te=function(n){var t=function(){try{return console.log("saving....."),Promise.resolve(i.update(x)).then(function(){a(Object.assign({},i))})}catch(e){return Promise.reject(e)}},o=e.useContext(H),i=o[0],a=o[1],l=i.selected,u=n.icon,c=n.schema,s=n.layout,v=n.autosave,p=void 0!==v&&v,g=n.delay,b=void 0===g?1e3:g,N=e.useRef(null),S=e.useState(l),x=S[0],k=S[1];function w(e){k(e)}function T(){return!r.default(x,l)}return e.useEffect(function(){k(l)},[l]),e.useEffect(function(){p&&(clearTimeout(N.current),N.current=setTimeout(function(){T()&&t()},b))},[x]),l&&x?h(e.Fragment,null,h(C,{icon:u,title:h(m,null,l.name)},h(d,{icon:"close",clickable:!0,action:function(){i.clear(),a(Object.assign({},i))}}),h(P,{align:"alignRight"},h(E,null,h(O,{label:"Eliminar",onSelect:function(){try{return Promise.resolve(i.remove(l.id)).then(function(){i.clear(),a(Object.assign({},i))})}catch(e){return Promise.reject(e)}}}))),!0===p?null:h(f,{icon:"save",label:"Guardar Cambios",raised:!0,disabled:!T(),action:t})),function(){var e=new ue(c,x);switch(s){case"TABBED":return h(ve,y({},n,{content:e,onChange:w}));case"TREEDED":return h(me,y({},n,{content:e,onChange:w}));default:return h(fe,y({},n,{content:e,onChange:w}))}}()):null},je=function(e,n){var t=Ae(e);return{all:[],selected:null,load:function(){try{var e=this,o=Ee(function(){return Promise.resolve(t.all()).then(function(t){e.all=n?t[n]:t})},function(e){console.log(e)});return Promise.resolve(o&&o.then?o.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},select:function(e){var n=this.all.find(function(n){return n.id===e});this.selected=n},clear:function(){this.selected=null},create:function(e){try{var n=this,o=Ee(function(){return Promise.resolve(t.create(e)).then(function(){return Promise.resolve(n.load()).then(function(){})})},function(e){console.log("CREATE ERROR",e)});return Promise.resolve(o&&o.then?o.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},update:function(e){try{var n=this,o=Ee(function(){return Promise.resolve(t.update(e)).then(function(){return Promise.resolve(n.load()).then(function(){})})},function(e){console.log(e)});return Promise.resolve(o&&o.then?o.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},patch:function(e,n){try{var o=this,i=Ee(function(){return Promise.resolve(t.patch(e,n)).then(function(){return Promise.resolve(o.load()).then(function(){})})},function(e){console.log(e)});return Promise.resolve(i&&i.then?i.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},updateProperty:function(e,n,o){try{var i=this,r=Ee(function(){return Promise.resolve(t.updateProperty(e,n,o)).then(function(){return Promise.resolve(i.load()).then(function(){})})},function(e){console.log(e)});return Promise.resolve(r&&r.then?r.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},remove:function(e){try{var n=this,o=Ee(function(){return Promise.resolve(t.remove(e)).then(function(){return Promise.resolve(n.load()).then(function(){})})},function(e){console.log(e)});return Promise.resolve(o&&o.then?o.then(function(){}):void 0)}catch(e){return Promise.reject(e)}}}},Ae=function(e){return{all:function(){return Pe.GET(e)},find:function(n){return Pe.GET(e+"/"+n)},create:function(n){var t=JSON.stringify(n);return Pe.POST(e,t)},update:function(n){var t=JSON.stringify(n);return Pe.PUT(e+"/"+n.id,t)},patch:function(n,t){var o=JSON.stringify(t);return Pe.PATCH(e+"/"+n,o)},updateProperty:function(n,t,o){var i=JSON.stringify(o);return Pe.PUT(e+"/"+n+"/"+t,i)},remove:function(n){return Pe.DELETE(e+"/"+n)}}},De=function(n){var t=e.useRef(),o=e.useState(!1),i=o[0],r=o[1];e.useEffect(function(){var e=n.resumable;e&&t&&e.assignDrop(t.current)},[]);var a=n.state,l=void 0===a?0:a,u=n.label,c=void 0===u?"Add file or drop file here...":u,s=n.error;return h("div",{className:"upload-area6 "+(!0===i?"drag-over":""),onDragOver:function(){r(!0)},onDragLeave:function(){r(!1)},ref:t},0===l?h(Re,{resumable:n.resumable}):"",0===l?h("label",null,c):"",1===l?h(w,{size:"xlarge"}):"",2===l?h(d,{icon:"done_all"}):"",3===l?h(m,{use:"body1"},s):"",n.children)},Re=function(n){var t=n.resumable,o=e.useRef();return e.useEffect(function(){t&&o&&t.assignBrowse(o.current)},[]),h("div",{className:"upload-icon",ref:o},h(d,{icon:"folder_open",clickable:!0}))},Ie=function(n){var t=n.label,o=n.target,i=n.accept,r=n.className,l=n.onSuccess,u=n.onError,c=n.onComplete,s=e.useMemo(function(){var e=new a.default({target:o,chunkSize:1048576,simultaneousUploads:1,testChunks:!1,throttleProgressCallbacks:1,fileType:i});return e.on("fileAdded",S),e.on("fileProgress",x),e.on("fileSuccess",k),e.on("fileError",E),e.on("complete",P),e},[]),d=e.useState(0)[1],f=e.useState(0),v=f[0],m=f[1],p=e.useState(),g=p[0],b=p[1],C=e.useState([]),y=C[0],N=C[1];function S(e){y.push(e),N(y),s.upload()}function x(e){var n=e.progress();d(n)}function k(e,n){m(2),l&&l(e,n)}function E(e,n){b(n),m(3),u&&u(e,n)}function P(){m(0),c&&c(y)}return h("div",{className:"uploader "+r},h(De,{resumable:s,state:v,label:t,error:g}))},_e=function(n){var t=n.file,o=n.state,i=n.progress,r=n.error,a=r?h(d,{icon:"image",className:"error"}):h(d,{icon:"image"});return 0!==o?h(e.Fragment,null,h("div",{className:"upload-file"},a,h(m,{use:"body1",tag:"label"},t.fileName),1===o?h(T,{progress:i}):"",1===o?h(d,{icon:"close",clickable:!0}):"",2===o?h(d,{icon:"done"}):"",3===o?h(d,{icon:"error"}):""),r?h("div",{className:"error"},h(m,{use:"overline"},r)):""):""};exports.Button=f,exports.CheckBox=p,exports.Chip=function(e){var n=e.id,t=e.icon,o=e.label,i=e.action,r=e.onSelect,a=e.outlined?"outlined":"normal";return e.selected&&(a+=" selected"),h("div",{className:"chip "+a,onClick:function(e){e.stopPropagation(),e.preventDefault(),r&&r(n)}},t?h(d,{icon:t,size:"small"}):null,h("main",null,h(m,null,o)),i?h("span",{className:"meta"},i):null)},exports.Chips=function(e){return h("div",{className:"chips"},e.children)},exports.CircularProgress=w,exports.CollectionContext=je,exports.CollectionEditor=Se,exports.CollectionPage=function(n){var t=e.useContext(v),o=n.id,i=void 0===o?"collection":o,r=n.icon,a=n.title,l=n.name,u=void 0===l?"Collection 1":l,c=n.schema,s=n.url,d=n.groupBy,p=n.editor,g=n.field,b=n.autosave,y=void 0!==b&&b,N=n.delay,S=void 0===N?1e3:N,x=n.actions,k=n.levels,E=e.useContext(H),P=E[0],O=E[1],w=je(s,g);return e.useEffect(function(){try{return Promise.resolve(w.load()).then(function(){O(w)})}catch(e){return Promise.reject(e)}},[]),h(e.Fragment,null,h(C,{className:"collection-page",title:h(m,null,a)},h(f,{icon:"add",label:"Add",action:function(){t.openDialog(h(ke,{label:"Crear "+u,type:c,onOK:function(e){try{return Promise.resolve(P.create(e)).then(function(){O(Object.assign({},P))})}catch(e){return Promise.reject(e)}}}))}}),h(f,{icon:"refresh",label:"Reload",action:function(){try{return Promise.resolve(P.load()).then(function(){O(Object.assign({},P))})}catch(e){return Promise.reject(e)}}}),x),h("menu",{className:"collection-page"},h(C,{title:h(m,null,"Lista de ",u)}),k?h(we,{levels:k}):h(Oe,{groupBy:d})),h("main",{key:i,className:"collection-page"},h(Te,{icon:r,schema:c,layout:p,autosave:y,delay:S})))},exports.Content=ue,exports.ContentEditor=fe,exports.ContentForm=ce,exports.CreateContentDialog=function(n){var t=n.label,o=n.type,i=n.validator,r=n.onOK,a=n.onActionClose,l=void 0===a||a,u=e.useContext(v),c=e.useState({}),s=c[0],d=c[1],p=e.useState(!1),g=p[0],b=p[1],C=e.useState([]),y=C[0],N=C[1];function S(e){"OK"===e&&r&&r(s),"CLOSE"!==e&&!0!==l||u.closeDialog()}var x=h(e.Fragment,null,h(f,{label:"CLOSE",action:function(){return S("CLOSE")}}),h(f,{label:"OK",action:function(){return S("OK")},disabled:!g,raised:!0})),k=h(m,{use:"headline6"},t),E=new ue(o,s);return h(ie,{title:k,open:!0,onAction:S,actions:x},h(ce,{content:E,filter:function(e){return function(e){var n=e.required;return void 0!==n&&n}(e)||function(e){var n=e.creation;return void 0!==n&&n}(e)},onChange:function(e,n){if(d(e),i){var t=i(e),o=t.errors,r=void 0===o?[]:o;b(n&&t.validation),N(r)}else b(n)}}),y.map(function(e){return h(m,{use:"overline",tag:"div",className:"error"},e)}))},exports.DataTable=_,exports.Dialog=ie,exports.DropDown=I,exports.EditContentDialog=ke,exports.FieldEditor=pe,exports.Form=g,exports.HTTPClient=u,exports.Header=C,exports.Icon=d,exports.Kanban=function(e){return h("div",{className:"kanban"},e.children)},exports.KanbanCard=function(e){return h("div",{className:"kanban-card "+e.color},e.children)},exports.KanbanColumn=function(n){var t=n.id,o=n.icon,i=n.title,r=n.subtitle,a=n.badge,l=n.children,u=n.minified,c=n.disabled,s=void 0!==c&&c,f=e.useState(void 0!==u&&u),v=f[0],p=f[1];function g(){p(!v)}return v?h("div",{className:"kanban-column "+t+" min"},h("main",null,i),h("footer",null,h(d,{icon:"toggle_off",onIcon:"toggle_on",clickable:!0,action:g}))):h("div",{className:"kanban-column "+t+" "+(s?"disabled":"")},h("header",null,h(d,{icon:o}),h("div",{className:"title"},h(m,{use:"headline6"},i),h(m,{className:"secondary-text",use:"body2"},r)),h("div",{className:"badge"},a)),h("main",null,l),h("footer",null,h(d,{icon:"toggle_off",onIcon:"toggle_on",clickable:!0,action:g})))},exports.LinearProgress=T,exports.List=N,exports.ListEditor=ye,exports.LoginBox=function(n){var t=n.logo,o=n.title,i=n.userLabel,r=void 0===i?"User":i,a=n.passwordLabel,l=void 0===a?"Password":a,u=n.loginLabel,c=void 0===u?"Log In":u,s=n.onOK,v=n.forgotLabel,p=void 0===v?"Forgot Password ?":v,g=n.onForgot,b=n.message,C=n.loading,y=e.useState(""),N=y[0],S=y[1],x=e.useState(""),k=x[0],E=x[1];function P(){return N&&N.length>0&&k&&k.length>0}function O(e){s&&P()&&s(N,e||k)}function w(e){return h(m,null,e)}return h("div",{className:"login-box"},h("header",null,t?h("img",{src:t}):"",h("div",{className:"title"},h(m,null,o))),h("main",null,h(R,{label:w(r),value:N,onChange:function(e,n){S(n)},onEnter:O,outlined:!0}),h(R,{label:w(l),value:k,onChange:function(e,n){E(n)},onEnter:O,type:"password",outlined:!0})),h("footer",null,g?h(f,{label:w(p),action:function(){g&&g(N)},disabled:!(N&&N.length>0)}):null,C?h("div",{className:"load-box"},h(d,{icon:"refresh"})):h(f,{label:w(c),action:O,disabled:!P(),raised:!0}),b?h("div",{className:"message"},h(m,null,b)):null))},exports.Menu=E,exports.MenuIcon=P,exports.MenuItem=O,exports.MenuSeparator=function(e){return h("li",null,"menuSeparator")},exports.Page=V,exports.PageContext=H,exports.PageProvider=J,exports.Property=function(e){var n=e.value;return h("div",{className:"property"},h("div",{className:"property-name"},e.name),h("div",{className:"property-value"},n))},exports.RadioButton=function(e){var n=e.id,t=e.name,o=e.placeholder,i=e.value,r=e.onChange,a=h(m,null,e.label);return h("div",{className:"radio"},h("input",{id:n,name:t,type:"radio",placeholder:o,value:i,onClick:function(e){r&&r(n,e.target.value)}}),h("span",{class:"checkmark"}),h("label",{htmlFor:n},a))},exports.ResetPasswordBox=function(n){var t=n.logo,o=n.title,i=n.children,r=n.onOK,a=n.onClose,l=e.useState({}),u=l[0],c=l[1],s=e.useState(),d=s[0],v=s[1];function p(){return u.password1&&u.password2}function g(e,n){var t,o=Object.assign({},u,((t={})[e]=n,t));c(o)}function b(){r&&p()&&(u.password1===u.password2?(v(null),r(u)):v("New Password and Confirm New Password do not match"))}return h("div",{className:"reset-password-box"},h("header",null,t?h("img",{src:t}):null,o?h("div",{className:"title"},h(m,null,o)):null,i),h("main",null,h(m,{use:"headline6"},"Change Password"),h(R,{id:"password1",outlined:!0,icon:"lock",type:"password",label:"New Password",lapse:100,onChange:g,onEnter:b}),h(R,{id:"password2",outlined:!0,icon:"lock",type:"password",label:"Confirm New Password",lapse:100,onChange:g,onEnter:b}),d?h("div",{className:"error"},d):null),h("footer",null,h(f,{label:"Close",action:function(){a&&a()}}),h(f,{label:"OK",raised:!0,disabled:!p(),action:b})))},exports.Section=function(n){var t=n.icon,o=n.title,i=void 0===o?"":o,r=n.canCollapse,a=void 0===r||r,l=n.open,u=void 0!==l&&l,c=n.actions,s=n.children,f=n.className,v=e.useState(u),m=v[0],p=v[1];return e.useEffect(function(){p(u)},[u]),h("section",{className:"section2 "+f},h(C,{icon:{icon:t},title:i},c,a?h(d,{icon:"expand_more",onIcon:"expand_less",clickable:!0,action:function(){p(!u)}}):""),m?h("main",null,s):"")},exports.Session=s,exports.Site=function(e){var n=e.logo,t=e.title,o=e.toolbar,i=e.children,r=e.init,a=e.min;return h(W,{siteLang:e.lang,siteDictionary:e.dictionary},h("div",{className:"site6"},h(X,{icon:e.icon}),h(Q,null,o),h($,{logo:n,title:t,min:a},i),h(ee,{init:r},i,h(V,{id:"EMPTY"},"EMPTY")),h(Z,null),h(oe,null),h(ne,null),h(te,null)))},exports.SiteContext=v,exports.SiteProvider=W,exports.Stack=D,exports.TYPES=re,exports.Tab=A,exports.TabbedContentEditor=ve,exports.Tabs=j,exports.Text=m,exports.TextField=R,exports.TokenField=z,exports.Tree=M,exports.TreeItem=G,exports.TreeNode=Y,exports.TreededContentEditor=me,exports.UploadArea=De,exports.UploadDialog=function(n){var t=n.label,o=n.target,i=n.accept,r=n.onSuccess,a=n.onClose,l=n.onActionClose,u=void 0===l||l,c=e.useContext(v),s=e.useState(),d=s[0],p=s[1],g=e.useState([])[0];function b(e){"CLOSE"!==e&&!0!==u||(c.closeDialog(),a())}var C=h(e.Fragment,null,h(f,{label:"CLOSE",action:function(){return b("CLOSE")}})),y=h(m,{use:"headline6"},t);return h(ie,{title:y,open:!0,onAction:b,actions:C},d?h(_e,{file:d}):h(Ie,{label:t,accept:i,target:o,onComplete:function(e){p(e[0]),r&&r(e[0])}}),g.map(function(e){return h(m,{use:"overline",tag:"div",className:"error"},e)}))},exports.UploadFile=_e,exports.Uploader=Ie,exports.Viewer=function(n){var t=n.title,o=n.src,i=n.info,r=n.actions,a=void 0===r?[]:r,l=n.tools,u=void 0!==l&&l,c=n.onClose,s=e.useState(!1),f=s[0],v=s[1];function p(){v(!f)}var g=h(m,{use:"headline6"},t);return h("div",{className:"viewer"},h(C,{icon:{icon:"close",clickable:!0,action:c},title:g},f?"":h(d,{icon:"info",clickable:!0,action:p}),a),h("main",null,h("div",{className:"resizer"},h("picture",null,h("img",{src:o})))),h("aside",{className:f?"open":""},h(C,{title:"Detalles"},h(d,{icon:"close",clickable:!0,action:p})),h("main",null,i)),u?h("footer",null,h(d,{clickable:!0,icon:"zoom_out"}),h(d,{clickable:!0,icon:"zoom_out_map"}),h(d,{clickable:!0,icon:"zoom_in"})):null)},exports.isFunction=function(e){return e&&("[object Function]"===Object.prototype.toString.call(e)||"function"==typeof e||e instanceof Function)};
|
1
|
+
require("material-design-icons-iconfont/dist/material-design-icons.css");var e=require("react"),n=require("deep-equal"),t=require("resumablejs");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=/*#__PURE__*/o(e),r=/*#__PURE__*/o(n),a=/*#__PURE__*/o(t),l=function(e,n,t,o){void 0===t&&(t=null);try{console.log("FETCH",e,n);var i={method:e,mode:"cors",headers:{Accept:"application/json","Content-Type":"application/json","x-access-token":o},body:t};return Promise.resolve(function(e,t){try{var o=Promise.resolve(fetch(n,i)).then(function(e){var n;function t(t){if(n)return t;throw e}var o=function(){if(e.ok)return Promise.resolve(e.json()).then(function(e){return n=1,e})}();return o&&o.then?o.then(t):t(o)})}catch(e){return t(e)}return o&&o.then?o.then(void 0,t):o}(0,function(e){if(e instanceof Error)throw{error:e};return Promise.resolve(e.json()).then(function(e){throw{success:!1,message:e.message}})}))}catch(e){return Promise.reject(e)}},u=function(e,n){return{GET:function(t){var o=n?n.token():null;return l("GET",e+t,void 0,o)},POST:function(t,o){var i=n?n.token():null;return l("POST",e+t,o,i)},PUT:function(t,o){var i=n?n.token():null;return l("PUT",e+t,o,i)},PATCH:function(t,o){var i=n?n.token():null;return l("PATCH",e+t,o,i)},DELETE:function(t){var o=n?n.token():null;return l("DELETE",e+t,void 0,o)}}},c=process.env.REACT_APP_SESSION||window&&window.SESSION?window.SESSION:"YWANA-CORE6-SESSION",s={token:function(){return(sessionStorage.getItem(c)?JSON.parse(sessionStorage.getItem(c)):{}).token},me:function(){return(sessionStorage.getItem(c)?JSON.parse(sessionStorage.getItem(c)):{}).me},init:function(e,n){sessionStorage.setItem(c,JSON.stringify({token:e,me:n}))},refresh:function(e){var n=this.me();sessionStorage.setItem(c,JSON.stringify({token:e,me:n}))},isLoggedIn:function(){return!!sessionStorage.DSSession},logout:function(){sessionStorage.removeItem(c)}},d=function(e){var n=e.size,t=e.clickable,o=e.action;return h("i",{className:"icon "+(void 0===n?"normal":n)+" "+(void 0!==t&&t?"clickable":"")+" material-icons",onClick:function(e){e.stopPropagation(),e.preventDefault(),o&&o()}},e.icon)},f=function(e){var n=e.label,t=e.icon,o=e.action,i=e.disabled,r=void 0!==i&&i,a=e.raised?"raised":e.outlined?"outlined":"normal";return r&&(a+=" disabled"),h("button",{className:"btn "+a,onClick:function(e){r||(e.stopPropagation(),e.preventDefault(),o&&o())}},t?h(d,{icon:t,size:"small"}):null,h("span",null,n))},v=i.default.createContext({}),m=function(n){var t=n.children,o=e.useContext(v);if(o){var i=o.dictionary,r=(void 0===i?{}:i)[t],a=r?r[o.lang]:t;return a?h("span",null,a):""}return t?h("span",null,t):""},p=function(e){var n=e.id,t=e.label,o=e.placeholder,i=e.value,r=e.onChange;function a(e){r&&r(n,e.target.checked)}var l=h(m,null,t);return console.log(t,i),!0===i?h("div",{className:"checkbox",key:n+"1"},h("input",{id:n,type:"checkbox",placeholder:o,checked:!0,value:i,onChange:a}),h("span",{class:"checkmark"}),h("label",{htmlFor:n},l)):h("div",{className:"checkbox",key:n+"0"},h("input",{id:n,type:"checkbox",placeholder:o,value:i,onChange:a}),h("span",{class:"checkmark"}),h("label",{htmlFor:n},l))},g=function(n){var t=n.title,o=n.columns,r=void 0===o?1:o,a=n.children,l=n.outlined,u=n.onChange,c=e.useState([]),s=c[0],d=c[1],f=function(e){return null==e||""===e};e.useEffect(function(){var e=i.default.Children.toArray(a).filter(function(e){return null!==e&&""!==e}).map(function(e){var n=e.props,t=n.id,o=n.value,i=n.required,r=void 0!==i&&i,a=n.validation,l=!r||(a?a(o):!f(o));return{id:t,value:o,required:r,validation:a,valid:l}}).filter(function(e){return void 0!==e.id});d(e)},[]),e.useEffect(function(){if(u){var e=s.every(function(e){return!0===e.valid}),n=s.reduce(function(e,n){var t=n.value;return(t||!1===t)&&(e[n.id]=t),e},{});u(n,e)}},[s]);var v=function(e,n){var t=s.find(function(n){return n.id===e});if(t){var o=!t.required||(t.validation?t.validation(n):!f(n));Object.assign(t,{value:n,valid:o}),d(s.slice())}},p=i.default.Children.toArray(a).filter(function(e){return null!==e&&""!==e}).map(function(e){var n=e.props.span,t=void 0===n?1:n,o=i.default.cloneElement(e,{onChange:v,outlined:!!l});return h(b,{style:{gridColumn:"span "+t}},o)}),g={gridTemplateColumns:"repeat("+r+", 1fr)"};return h(e.Fragment,null,t?h("header",{className:"form-header"},h(m,{use:"headline6"},t)):"",h("form",{className:"form-grid",style:g},p))},b=function(e){return h("div",{className:"field-wrapper",style:e.style},e.children)},C=function(e){var n=e.caption?"caption":"",t=e.prominent?"prominent":"",o=e.dense?"dense":"",i=e.primary?"primary":"";i=e.secondary?"secondary":i;var r=e.icon?h(d,{icon:e.icon,clickable:e.clickable,action:e.action}):"";r=e.iconSrc?h("img",{className:"header-icon",src:e.iconSrc}):r;var a=e.img?{backgroundImage:"url("+e.img+")"}:{},l=h(m,null,e.title);return h("header",{className:"header "+n+" "+t+" "+o+" "+i+" "+e.className,style:a},r,e.title?h("label",null,l):null,h("span",{className:"actions"},e.children))};function y(){return y=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},y.apply(this,arguments)}var N=function(e){var n=e.items,t=void 0===n?[]:n,o=e.children,i=e.onSelect;function r(e){i&&i(e)}return e.groupBy?h(S,y({},e,{onSelect:r})):h("div",{className:"list"},h("ul",null,t.map(function(e){return h(x,{key:e.id,item:e,onSelect:r})})),o)},S=function(n){var t=n.items,o=n.children,i=n.onSelect,r=n.groupBy,a=(void 0===t?[]:t).reduce(function(e,n){var t=e.find(function(e){return e.name===n.content[r]});return t||e.push(t={name:n.content[r],items:[]}),t.items.push(n),e},[]);return h("div",{className:"list"},a.map(function(n){return h(e.Fragment,{key:n.name},h("header",{key:n.name+"-header"},h(m,null,n.name)),h("ul",{key:n.name+"-ul"},n.items.map(function(e){return h(x,{key:e.id,item:e,onSelect:i})})))}),o)},x=function(e){var n=e.item,t=e.onSelect,o=n.id,i=n.icon,r=n.line1,a=n.line2,l=n.meta;return h("li",{id:o,onClick:function(){t&&t(o)}},i?h(d,{icon:i,size:"small"}):null,h("main",null,h("div",{className:"primary-line"},h(m,null,r)),a?h("div",{className:"secondary-line"},h(m,null,a)):null),l?h("div",{className:"meta"},l):null)},k=i.default.createContext({}),E=function(e){return h("ul",null,e.children)},P=function(n){var t=n.icon,o=void 0===t?"more_vert":t,i=n.children,r=n.align,a=e.useState(!1),l=a[0],u=a[1];function c(){u(!l)}return h(k.Provider,{value:[l,u]},h("div",{className:"menu-icon"},h(d,{icon:o,clickable:!0,action:c}),l?h("menu",{className:""+r},i):null,l?h("div",{className:"overlay",onClick:c}):null))},O=function(n){var t=n.icon,o=n.label,i=n.meta,r=n.onSelect,a=e.useContext(k)[1];return h("li",{className:"menu-item",onClick:function(){r&&r(),a(!1)}},t?h(d,{icon:t}):null,h("label",null,o),i?h("div",{className:"meta"},i):null)},w=function(e){return h("div",{className:"circular-progress"},h(d,{icon:"refresh",size:"small"}))},T=function(e){var n=e.progress,t=e.max;return h("div",{className:"linear-progress"},h("progress",{value:void 0===n?0:n,max:void 0===t?100:t}))},j=function(e){var n=e.selected,t=e.onChange,o=i.default.Children.map(e.children,function(e,o){return i.default.cloneElement(e,{selected:o===n,onSelect:function(){t&&t(o)}})});return h("div",{class:"tabs"},o,h("div",{class:"tab-filler"}))},A=function(e){var n=e.onSelect;return h("div",{className:"tab "+(e.selected?"selected":""),onClick:function(){n&&n()}},e.label,e.actions||null)},D=function(n){var t=n.selected,o=void 0===t?0:t,r=i.default.Children.toArray(n.children).filter(function(e,n){return n===o})[0];return h(e.Fragment,null,r)},R=function(n){var t=e.useContext(v),o=n.id,i=n.type,r=void 0===i?"text":i,a=n.label,l=n.placeholder,u=n.value,c=n.readOnly,s=void 0!==c&&c,d=n.onChange,f=n.onEnter,p=n.onClick,g=(a?"":"no-label")+" "+(n.outlined?"textfield-outlined":"textfield"),b=h(m,null,a);return h("div",{className:""+g,onClick:p},h("input",{id:o,type:r,placeholder:l,value:u,required:!0,onChange:function(e){e.stopPropagation(),e.preventDefault(),d&&d(o,e.target.value)},onKeyDown:function(e){13==(e.charCode?e.charCode:e.keyCode?e.keyCode:0)&&f()},onFocus:function(){t&&t.changeFocus({lose:function(){}})},readOnly:s}),h("span",{className:"bar"}),a?h("label",null,b):null)},I=function(n){var t=e.useContext(v),o=n.id,i=n.options,r=void 0===i?[]:i,a=n.value,l=n.onChange,u=e.useState(!1),c=u[0],s=u[1],f=e.useState(),m=f[0],p=f[1];function g(){t&&t.changeFocus({lose:function(){s(!1)}}),s(!c)}return e.useEffect(function(){if(Array.isArray(r)){var e=r.find(function(e){return e.value===a});e&&p(e.label)}},[a]),h("div",{className:"dropdown"},h(R,y({},n,{onClick:g,value:m})),h(d,{icon:"expand_more",clickable:!0,size:"small",action:g}),1==c?h("menu",null,h("ul",{onClick:function(e){var n=e.target.getAttribute("value"),t=r.find(function(e){return e.value===n});l&&l(o,n),p(t.label),s(!1)}},Array.isArray(r)?r.map(function(e){return h("li",{key:e.value,value:e.value},e.label)}):null)):null)},_=function(n){var t=n.columns,o=void 0===t?[]:t,i=n.rows,r=void 0===i?[]:i,a=n.onRowSelection,l=n.onSort,u=n.editable,c=n.outlined,s=e.useState({})[0];function f(e,n){a&&a(e,n)}function v(e,n){l&&l(e,n)}return h("div",{className:"datatable8 "+(c?"outlined":"")},h("table",null,h("thead",null,h("tr",null,o.map(function(e){var n=e.sortable;return h("th",null,h(m,null,e.label),n?h(d,{icon:"arrow_up",size:"small",clickable:!0}):null)}))),h("tbody",null,function(e,n){void 0===n&&(n={});var t=Object.keys(n);if(!t.length)return e;var o=function(e,n,t){return t=null!==t?t:1,e===n?0:e>n?t:-1*t};return e.sort(function(e,i){for(var r=0,a=0;0===r&&a<t.length;){var l=t[a];l&&(r=o(e[l],i[l],n[l]),a++)}return r})}(r,s).map(function(e){return h(F,{key:e.id,row:e,columns:o,onSelect:f,onDrop:v,editable:u})}))))},F=function(n){var t,o=n.row,i=n.columns,r=void 0===i?[]:i,a=n.onSelect,l=n.editable,u=e.useState(!1),c=u[0],s=u[1],f=c?"expand_more":"expand_less";return h(e.Fragment,null,h("tr",{onClick:function(e){return a(o,e)}},r.map(function(e){return h(L,{row:o,column:e,cell:o[e.id],editable:l})}),o.info?h(d,{icon:f,clickable:!0,action:function(){return s(!c)}}):null),o.info&&c?h("tr",{className:"table-row-info"},(t=o.info)&&("[object Function]"===Object.prototype.toString.call(t)||"function"==typeof t||t instanceof Function)?o.info():o.info):null)},L=function(e){var n=e.row,t=e.column,o=e.cell,i=e.editable;return h("td",{className:t.id},function(e){var r=t.id,a=t.disabled,l=void 0!==a&&a,u=t.min,c=t.max,s=t.onChange,f=t.options;if(i&&s)switch(e){case"ICON":return h(d,{icon:o});case"BOOLEAN":case"Boolean":return h(p,{id:r,value:o,onChange:function(e,t){return s(n.id,e,t)},disabled:l});case"SELECTION":return h(I,{id:r,value:o,placeholder:"--Select--",options:f,onChange:function(e,t){return s(n.id,e,t)}});case"CHECK":return h(p,{id:r,value:o,onChange:function(e,t){return s(n.id,e,t)},disabled:n.disabled});case"CHECKABLE":return o&&o.value?h(p,{id:r,value:o.checked||!1,label:o.value,onChange:function(e,t){return s(n.id,e,o.value,t,o)}}):"";case"TEXTFIELD":return h(R,{id:r,value:o,onChange:function(e,t){return s(n.id,e,t)}});case"String":return h(U,{id:r,value:o,options:f,onChange:function(e,t){return s(n.id,e,t)}});case"Number":return h(R,{id:r,type:"number",value:o,min:u,max:c,onChange:function(e,t){return s(n.id,e,t)}});default:return o}else switch(e){case"ICON":return h(d,{icon:o});case"Boolean":return h(B,{id:r,value:o});case"String":return h(K,{id:r,value:o,options:f});default:return o}}(t.type))},B=function(e){var n=e.value;return h(d,{icon:!0===(void 0!==n&&n)?"check_box":"check_box_outline_blank"})},K=function(e){var n=e.value,t=e.options,o=t?t.find(function(e){return e.value===n}):null;return h("div",{className:"field-editor string-editor"},o?o.label:n)},U=function(e){var n=e.id,t=e.value,o=void 0===t?"":t,i=e.options,r=e.onChange;function a(e,n){r&&r(e,n)}return h("div",{className:"field-editor string-editor"},i?h(I,{outlined:!0,id:n,value:o,onChange:a,options:i}):h(R,{outlined:!0,id:n,value:o,onChange:a}))},z=function(n){var t=n.id,o=n.label,i=n.init,r=n.onChange,a=e.useRef(!1),l=e.useState(),u=l[0],c=l[1],s=e.useState(i),d=s[0],f=s[1];return e.useEffect(function(){a.current?r&&d&&r(t,d):a.current=!0},[d]),h("div",{className:"tokenField"},h("label",null,o),d.map(function(e,n){return h(q,{text:e,onDelete:function(){return function(e){var n=d.slice();n.splice(e,1),f(n)}(n)}})}),h("input",{type:"text",value:u,onChange:function(e){c(e.target.value)},onKeyDown:function(e){if("Enter"===e.key){e.preventDefault(),e.stopPropagation();var n=d.concat(e.target.value);f(n),c("")}if(""===u&&d.length>0&&"Backspace"===e.key){var t=d.slice(0,-1);f(t)}}}))},q=function(e){var n=e.onDelete;return h("div",{className:"token"},h(m,{use:"caption",tag:"div"},e.text),h(d,{icon:"close",clickable:!0,action:n,size:"small"}))},M=function(e){var n=e.nodes;return h("div",{className:"tree"},void 0===n?[]:n,e.children)},Y=function(e){var n=e.icon,t=void 0===n?"folder":n,o=e.label,i=e.open,r=e.children,a=e.actions;return h("details",{className:"tree-node",open:void 0!==i&&i},h("summary",{className:"tree-item"},t?h(d,{icon:t,size:"small",small:!0}):null,h("div",{className:"label"},o),h("div",{className:"actions"},a)),r)},G=function(e){var n=e.id,t=e.icon,o=e.label,i=e.actions,r=e.onSelect;return h("div",{className:"tree-item final",onClick:function(){r&&r(n)}},h(d,{icon:void 0===t?"description":t,size:"small",small:!0}),h("div",{className:"label"},o),h("div",{className:"actions"},i))},H=i.default.createContext({}),J=function(n){var t=n.context,o=n.children,i=e.useState(void 0===t?{}:t);return h(H.Provider,{value:[i[0],i[1]]},o)},V=function(e){var n=e.layout,t=e.context;return h(J,{context:void 0===t?{}:t},h("article",{className:"page6 "+(void 0===n?"simple":n)},e.children))},W=function(n){var t=n.children,o=n.siteDictionary,i=e.useState(n.siteLang),r=i[0],a=i[1],l=e.useState(o),u=l[0],c=l[1],s=e.useState("max"),d=s[0],f=s[1],m=e.useState(!1),p=m[0],g=m[1],b=e.useState(null),C=b[0],y=b[1],N=e.useState(!1),S=N[0],x=N[1],k=e.useState(),E=k[0],P=k[1],O=e.useState(),w=O[0],T=O[1],j=e.useState(),A=j[0],D=j[1],R=e.useState(),I=R[0],_=R[1],F=e.useState(),L=F[0],B=F[1],K={lang:r,setLang:a,dictionary:u,setDictionary:c,focused:L,changeFocus:function(e){L&&L.lose(),B(e)},sideNav:d,setSideNav:f,showNav:p,setShowNav:g,info:C,openInfo:function(e){y(e)},closeInfo:function(){y(null)},console:S,toggleConsole:function(){x(!S)},breadcrumb:I,setBreadcrumb:_,page:E,goto:function(e){P(e)},dialog:w,openDialog:function(e){T(e)},closeDialog:function(){T(null)},preview:A,openPreview:function(e){D(e)},closePreview:function(){D(null)}};return h(v.Provider,{value:K},t)},X=function(e){var n=e.icon;return h(C,{icon:void 0===n?"equalizer":n,title:e.title})},Q=function(n){var t=n.children;return e.useContext(v),h("nav",null,t)},Z=function(){var n=e.useContext(v);return n.info?h("aside",null,n.info):""},$=function(n){var t=n.children,o=n.min,i=e.useContext(v),r=i.showNav;e.useEffect(function(){o&&i.setSideNav("min")},[]);var a=t?e.Children.toArray(t).reduce(function(e,n){var t=n.props?n.props.section:"...";e[t]||(e[t]=[]);var o=n.props,i=o.title;return i&&e[t].push({id:o.id,icon:o.icon,title:i}),e},{}):{};return h("menu",{className:"min "+(r?"show":"")},h("main",null,Object.keys(a).map(function(n){return h(e.Fragment,{key:n},a[n].map(function(e){var n=e.id,t=e.icon;return h(d,{key:n,icon:void 0===t?"info":t,clickable:!0,checked:n===i.page,action:function(){return function(e){i.setShowNav(!1),i.goto(e)}(n)}})}),h("div",{className:"section-divider"}))})))},ee=function(n){var t=n.children,o=n.init,r=e.useContext(v),a=r.page;return e.useEffect(function(){r.goto(o||"EMPTY")},[]),h("main",null,i.default.Children.toArray(t).filter(function(e){return!!e.props&&e.props.id===a}))},ne=function(){var n=e.useContext(v);return n.dialog?n.dialog:""},te=function(){var n=e.useContext(v);return n.preview?h("div",{className:"site-preview"},n.preview):""},oe=function(){return e.useContext(v).console?h("footer",{className:"site-console"},h(C,null,h(j,null,h(A,{label:"Console"}))),h("main",null)):""},ie=function(n){var t=e.useContext(v),o=n.icon,i=n.title,r=void 0===i?"Dialog":i,a=n.children,l=n.actions;return h(e.Fragment,null,h("div",{className:"overlay"}),h("div",{className:"dialog",onClick:function(){t.closeDialog()}},h("div",{className:"dialog-panel",onClick:function(e){e.preventDefault(),e.stopPropagation()}},h("header",null,o?h(P,{icon:o}):null,h(m,null,r)),h("main",null,a),h("footer",null,l))))},re={STRING:"String",NUMBER:"Number",DATE:"Date",BOOLEAN:"Boolean",ARRAY:"Array",ENTITY:"Object",FUNCTION:"Function",EMAIL:"String"},ae=Object.values(re).reduce(function(e,n){return e["is"+n]=function(e){return toString.call(e)=="[object "+n+"]"},e},{}),le=/*#__PURE__*/function(){function e(e){this._schema=e}var n=e.prototype;return n.checkType=function(n,t){var o=n.type,i=n.item,r=!0,a=!0;if(i){var l=new e(i);switch(o){case re.ARRAY:r=ae["is"+o](t),a=t.every(function(e){return l.validate(e)});break;case re.ENTITY:r=ae["is"+o](t),a=l.validate(t);break;case re.NUMBER:r=ae["is"+o](t.value),a=!0;break;default:r=!0,a=!0}}return r&&a},n.validate=function(e){var n=this;return Object.entries(this._schema).filter(function(e){return!0===e[1].required}).every(function(t){var o=t[0];return void 0!==e[o]&&n.checkType(t[1],e[o])})},n.form=function(e){return Object.entries(this._schema).reduce(function(n,t){var o=t[0];return n[o]=Object.assign({},t[1],{value:e[o]}),n},{})},n.sections=function(e){var n=this.form(e),t=Object.values(n).reduce(function(e,n){var t=n.section||"";return e.hasOwnProperty(t)||(e[t]={title:t,fields:[]}),e[t].fields.push(n),e},{});return Object.values(t)},n.value=function(n){return Object.entries(this._schema).reduce(function(t,o){var i=o[0],r=o[1],a=r.item,l=n?n[i]:null;switch(r.type){case re.STRING:case re.NUMBER:case re.BOOLEAN:t[i]=l||r.default;break;case re.ENTITY:var u=new e(a);t[i]=u.value(l);break;case re.ARRAY:if(a===re.STRING)t[i]=l||[];else{var c=new e(a);t[i]=l?l.map(function(e){return c.value(e)}):[]}break;default:t[i]=r}return t},{})},e}(),ue=/*#__PURE__*/function(){function e(e,n){this.type=e,this._type=new le(e),this._value=n}var n=e.prototype;return n.isValid=function(){return this._type.validate(this._value)},n.value=function(){return this._type.value(this._value)},n.form=function(){return this._type.form(this._value)},n.sections=function(){return this._type.sections(this._value)},n.update=function(e){this._value=e},e}(),ce=function(e){var n=e.columns,t=void 0===n?1:n,o=e.filter,i=e.onChange,r=e.content.form();console.log(r);var a=Object.keys(r).map(function(e){return r[e]}).filter(function(e){return!o||o(e)});return console.log(a),h(g,{className:"content-form",columns:t,outlined:!0,onChange:i},a.map(function(e){return h(se,y({key:e.id},e))}))},se=function(e){switch(e.type){case re.BOOLEAN:return h(p,y({key:e.id},e));case re.NUMBER:return h(he,y({key:e.id},e));default:return h(de,y({key:e.id},e))}},de=function(e){var n,t=e.id,o=e.type,i=e.label,r=e.options,a=e.textarea,l=e.required,u=void 0!==l&&l,c=e.value,s=e.onChange,d=e.outlined,f=((n={})[re.NUMBER]="number",n[re.DATE]="date",n)[o]||"text";return r?h(I,{key:t,id:t,label:i,value:c,onChange:s,options:"function"==typeof r?r():r,outlined:d}):h(R,{key:t,id:t,type:f,label:i,value:c,onChange:s,required:u,outlined:d,textarea:a})},he=function(e){var n=e.id,t=e.label,o=e.options,i=e.required,r=void 0!==i&&i,a=e.value,l=e.onChange,u=e.outlined;function c(e,n){l&&l(e,+n?+n:n)}return o?h(I,{key:n,id:n,label:t,value:a,onChange:c,options:o,outlined:u}):h(R,{key:n,id:n,type:"number",label:t,value:a,onChange:c,required:r,outlined:u})},fe=function(e){var n=e.content,t=e.filter,o=e.onChange;function i(e,t){var i,r=Object.assign({},n.value(),((i={})[e]=t,i));o&&o(r)}var r=n.sections();return h("div",{className:"content-editor"},r.map(function(e){var o=e.title,r=e.fields;return h("section",{key:o},h("header",null,o),h("main",null,r.filter(function(e){return"id"!==e.id}).filter(function(e){return!t||t(e,n)}).map(function(e){return h(pe,{key:e.id,field:e,onChange:i})})))}))},ve=function(n){var t=n.content,o=n.filter,i=n.grouped,r=void 0!==i&&i,a=n.onChange,l=e.useState(0),u=l[0],c=l[1];function s(e,n){var o,i=Object.assign({},t.value(),((o={})[e]=n,o));a&&a(i)}var d=t.sections();return h("div",{className:"content-editor tabbed"},h(j,{selected:u,onChange:function(e){c(e)}},d.map(function(e){return h(A,{label:e.title})})),h(D,{selected:u},d.map(function(n){var i=n.fields;return h("section",{key:n.title},h("nav",null," "),h("main",null,r?function(e){var n=e.fields,t=(void 0===n?[]:n).reduce(function(e,n){var t=n.group||"",o=e[t]||{name:t,fields:[]};return o.fields.push(n),e[t]=o,e},{});return Object.values(t)}(n).map(function(n){return h(e.Fragment,null,n.name.length>0?h("div",{className:"group-caption"},n.name):null,n.fields.filter(function(e){return"id"!==e.id}).filter(function(e){return!o||o(e)}).map(function(e){return h(pe,{key:e.id,field:e,onChange:s,content:t})}))}):i.filter(function(e){return"id"!==e.id}).filter(function(e){return!o||o(e)}).map(function(e){return h(pe,{key:e.id,field:e,onChange:s,content:t})})))})))},me=function(n){var t=n.content,o=n.onChange,i=t.value(),r=Object.values(t.type).filter(function(e){return e.type===re.ARRAY}),a=e.useState(),l=a[0],u=a[1];function c(){}return h("div",{className:"content-editor treeded-editor"},h("menu",null,h("header",null,h(m,{use:"caption"},"Tree Editor")),h(M,null,r.map(function(e,n){return h(Y,{icon:"folder",label:e.label,actions:[h(d,{small:!0,icon:"add",clickable:!0,action:c})]},i[e.id]?i[e.id].map(function(n,t){return h(G,{icon:n.icon||"description",label:n.name||n.label,onSelect:function(){return function(e,n,t){var o=new ue(t.item,n);u({index:e,item:o,node:t,value:i[t.id]})}(t,n,e)}})}):null)}))),h("div",null,l?h(ve,{content:l.item,onChange:function(e){var n,t=l.value.slice();t[l.index]=e;var r=Object.assign({},i,((n={})[l.node.id]=t,n));o&&o(r)}}):"select"))},pe=function(e){var n=e.field,t=e.onChange,o=e.content,i=e.outlined,r=void 0!==i&&i,a=n.id,l=n.type,u=n.item,c=n.label,s=n.editable,d=n.options;function f(e,n){t&&t(e,n)}return function(){var e=n.value?n.value:n.default;switch(l){case re.ENTITY:return h(ge,{field:n,value:e,onChange:f});case re.STRING:return h(be,{outlined:r,field:n,value:e,onChange:f,content:o});case re.BOOLEAN:return h(p,{outlined:!0,id:a,label:c,value:e,onChange:f});case re.DATE:return h(R,{outlined:r,id:a,type:"date",label:c,value:e,onChange:f,disabled:s});case re.NUMBER:return h(Ce,{outlined:r,field:n,value:e,onChange:f});case re.ARRAY:return u===re.STRING?d?h(Ne,{content:o,field:n,value:e,onChange:f}):h(ye,{field:n,value:e,onChange:f}):h(Se,{field:n,value:e,onChange:f});default:return h("div",null,c)}}()},ge=function(e){var n=e.field,t=e.value,o=e.onChange,i=n.id,r=n.label,a=new ue(n.item,void 0===t?{}:t);function l(e,n){var t,r=Object.assign({},a.value(),((t={})[e]=n,t));o&&o(i,r)}var u=a.form(),c=Object.keys(u).map(function(e){return u[e]});return h("div",{className:"entity-editor"},h("header",null,h(m,{use:"caption"},r)),h("main",null,c.map(function(e){return h(pe,{key:e.id,field:e,onChange:l})})))},be=function(e){var n=e.field,t=e.value,o=void 0===t?"":t,i=e.onChange,r=e.outlined,a=n.id,l=n.label,u=n.options,c=n.editable;function s(e,n){i&&i(e,n)}return h("div",{className:"field-editor string-editor"},void 0===c||c?u?h(I,{outlined:r,id:a,label:l,value:o,onChange:s,options:"function"==typeof u?u(n,e.content):u}):h(R,{outlined:r,id:a,label:l,value:o,onChange:s}):h(R,{outlined:r,id:a,label:l,value:o,onChange:s,readOnly:!0}))},Ce=function(e){var n=e.field,t=e.onChange,o=n.editable;return h("div",{className:"field-editor number-editor"},h(R,{outlined:!0,id:n.id,label:n.label,type:"NUMBER",value:e.value||n.default,max:n.max,min:n.min,onChange:function(e,n){t&&t(e,n)},disabled:!(void 0===o||o)}))},ye=function(e){var n=e.field,t=e.value,o=e.onChange;return h("div",{className:"list-editor"},h(z,{id:n.id,label:n.label,init:void 0===t?[]:t,onChange:function(e,n){o&&o(e,n)}}))},Ne=function(e){var n=e.field,t=e.value,o=void 0===t?[]:t,i=e.content,r=e.onChange,a=n.id,l=n.options;return h("div",{className:"multiselection-editor"},h("label",null,n.label),("function"==typeof l?l(n,i):l).map(function(e){var n=o.includes(e.value);return h(p,{value:n,label:e.label,onChange:function(){return(t=o.indexOf(n=e.value))>=0?o.splice(t,1):o.push(n),void(r&&r(a,o));var n,t}})}))},Se=function(e){var n=e.field,t=e.value,o=void 0===t?[]:t,i=e.onChange,r=n.id,a=n.item,l=n.label,u=n.Feeder,c=n.Renderer,s=n.Adder,f=void 0===s||s,v=n.editable,p=void 0===v||v;function g(e){if(i){var n=o.concat(e);i(r,n)}}function b(e){if(i){var n=o.filter(function(n,t){return t!==e});i(r,n)}}function C(e,n,t){if(i){var a=o.slice();a[e][n]=t,i(r,a)}}var N=Object.values(a).map(function(e){return y({},e,{onChange:C})});N.push({id:"actions",label:"Actions"});var S=o.map(function(e,n){return y({},e,{id:n,actions:[h(d,{icon:"delete",clickable:!0,action:function(){return b(n)},small:!0})]})}),x={columns:N,rows:S};return h("div",{className:"collection-editor"},h("header",null,h(m,{use:"caption"},l),h("div",{className:"actions"},u?h(u,{onAdd:g}):null)),c?h(c,{field:n,value:o,onRemove:b,onChange:i}):h(_,y({},x,{editable:p})),h("footer",null,f?h(xe,{item:a,onAdd:g}):null))},xe=function(n){var t=n.item,o=n.onAdd,i=e.useState(!1),r=i[0],a=i[1],l=e.useState({}),u=l[0],c=l[1];function s(){a(!r)}function v(e,n,t){if(o){var i,r=Object.assign({},u,((i={})[n]=t,i));c(r)}}var m=Object.values(t).map(function(e){return y({},e,{type:"String",onChange:v})});m.push({id:"actions",label:""});var p=[{actions:[h(d,{icon:"done",clickable:!0,action:function(){o&&o([u]),s()}}),h(d,{icon:"close",clickable:!0,action:s})]}];return p[0]=Object.assign({},u,p[0]),h("div",{className:"collection-adder"},r?h(_,y({},{columns:m,rows:p},{editable:!0})):h(f,{icon:"add",label:"Add",action:s}))},ke=function(n){var t=n.label,o=n.type,i=n.value,r=void 0===i?{}:i,a=n.filter,l=n.validator,u=n.onOK,c=e.useContext(v),s=e.useState(r),d=s[0],p=s[1],g=e.useState(!1),b=g[0],C=g[1],y=e.useState([]),N=y[0],S=y[1];function x(e){"OK"===e&&u&&u(Object.assign({},r,d)),c.closeDialog()}var k=h(e.Fragment,null,h(f,{label:"CLOSE",action:function(){return x("CLOSE")}}),h("div",{className:"expand"}),h(f,{label:"OK",action:function(){return x("OK")},disabled:!b,raised:!0})),E=h(m,{use:"headline6"},t),P=new ue(o,d);return h(ie,{title:E,open:!0,onAction:x,actions:k},h(fe,{content:P,onChange:function(e){if(p(e),l){var n=l(e),t=n.errors,o=void 0===t?[]:t;C(n.validation),S(o)}else C(!0)},filter:a}),N.map(function(e){return h(m,{use:"overline",tag:"div",className:"error"},e)}))};function Ee(e,n){try{var t=e()}catch(e){return n(e)}return t&&t.then?t.then(void 0,n):t}var Pe=u(window.API||process.env.REACT_APP_API,s),Oe=function(n){var t=n.groupBy,o=e.useContext(H),i=o[0],r=o[1],a=i.all,l=void 0===a?[]:a,u=l?l.map(function(e){return{id:e.id,line1:e.name,line2:e.description,content:e}}):[];return h(N,{items:u,onSelect:function(e){try{return i.clear(),r(Object.assign({},i)),Promise.resolve(i.select(e)).then(function(){r(Object.assign({},i))})}catch(e){return Promise.reject(e)}},groupBy:t})},we=function(n){var t=function(e){try{return r.clear(),a(Object.assign({},r)),Promise.resolve(r.select(e)).then(function(){a(Object.assign({},r))})}catch(e){return Promise.reject(e)}},o=n.levels,i=e.useContext(H),r=i[0],a=i[1],l=r.all,u=function e(n,t){var o=function(e,n){return e.reduce(function(e,t){var o=e.find(function(e){return e.name===t[n]});return o||e.push(o={name:t[n],items:[],field:n}),o.items.push(t),e},[])}(t,n[0]);return n.length>1&&o.forEach(function(t){return t.nodes=e(n.slice(1),t.items)}),o}(o,void 0===l?[]:l);return h("main",null,h(M,null,function e(n){return n.map(function(n){return h(Y,{key:n.name,icon:null,label:"boolean"==typeof n.name?n.field+" = "+n.name:n.name,open:!0},n.nodes?e(n.nodes):n.items.map(function(e){return h(G,{key:e.id,id:e.id,label:e.name,onSelect:t},"item")}))})}(u)))},Te=function(n){var t=function(){try{return console.log("saving....."),Promise.resolve(i.update(x)).then(function(){a(Object.assign({},i))})}catch(e){return Promise.reject(e)}},o=e.useContext(H),i=o[0],a=o[1],l=i.selected,u=n.icon,c=n.schema,s=n.layout,v=n.autosave,p=void 0!==v&&v,g=n.delay,b=void 0===g?1e3:g,N=e.useRef(null),S=e.useState(l),x=S[0],k=S[1];function w(e){k(e)}function T(){return!r.default(x,l)}return e.useEffect(function(){k(l)},[l]),e.useEffect(function(){p&&(clearTimeout(N.current),N.current=setTimeout(function(){T()&&t()},b))},[x]),l&&x?h(e.Fragment,null,h(C,{icon:u,title:h(m,null,l.name)},h(d,{icon:"close",clickable:!0,action:function(){i.clear(),a(Object.assign({},i))}}),h(P,{align:"alignRight"},h(E,null,h(O,{label:"Eliminar",onSelect:function(){try{return Promise.resolve(i.remove(l.id)).then(function(){i.clear(),a(Object.assign({},i))})}catch(e){return Promise.reject(e)}}}))),!0===p?null:h(f,{icon:"save",label:"Guardar Cambios",raised:!0,disabled:!T(),action:t})),function(){var e=new ue(c,x);switch(s){case"TABBED":return h(ve,y({},n,{content:e,onChange:w}));case"TREEDED":return h(me,y({},n,{content:e,onChange:w}));default:return h(fe,y({},n,{content:e,onChange:w}))}}()):null},je=function(e,n){var t=Ae(e);return{all:[],selected:null,load:function(){try{var e=this,o=Ee(function(){return Promise.resolve(t.all()).then(function(t){e.all=n?t[n]:t})},function(e){console.log(e)});return Promise.resolve(o&&o.then?o.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},select:function(e){var n=this.all.find(function(n){return n.id===e});this.selected=n},clear:function(){this.selected=null},create:function(e){try{var n=this,o=Ee(function(){return Promise.resolve(t.create(e)).then(function(){return Promise.resolve(n.load()).then(function(){})})},function(e){console.log("CREATE ERROR",e)});return Promise.resolve(o&&o.then?o.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},update:function(e){try{var n=this,o=Ee(function(){return Promise.resolve(t.update(e)).then(function(){return Promise.resolve(n.load()).then(function(){})})},function(e){console.log(e)});return Promise.resolve(o&&o.then?o.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},patch:function(e,n){try{var o=this,i=Ee(function(){return Promise.resolve(t.patch(e,n)).then(function(){return Promise.resolve(o.load()).then(function(){})})},function(e){console.log(e)});return Promise.resolve(i&&i.then?i.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},updateProperty:function(e,n,o){try{var i=this,r=Ee(function(){return Promise.resolve(t.updateProperty(e,n,o)).then(function(){return Promise.resolve(i.load()).then(function(){})})},function(e){console.log(e)});return Promise.resolve(r&&r.then?r.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},remove:function(e){try{var n=this,o=Ee(function(){return Promise.resolve(t.remove(e)).then(function(){return Promise.resolve(n.load()).then(function(){})})},function(e){console.log(e)});return Promise.resolve(o&&o.then?o.then(function(){}):void 0)}catch(e){return Promise.reject(e)}}}},Ae=function(e){return{all:function(){return Pe.GET(e)},find:function(n){return Pe.GET(e+"/"+n)},create:function(n){var t=JSON.stringify(n);return Pe.POST(e,t)},update:function(n){var t=JSON.stringify(n);return Pe.PUT(e+"/"+n.id,t)},patch:function(n,t){var o=JSON.stringify(t);return Pe.PATCH(e+"/"+n,o)},updateProperty:function(n,t,o){var i=JSON.stringify(o);return Pe.PUT(e+"/"+n+"/"+t,i)},remove:function(n){return Pe.DELETE(e+"/"+n)}}},De=function(n){var t=e.useRef(),o=e.useState(!1),i=o[0],r=o[1];e.useEffect(function(){var e=n.resumable;e&&t&&e.assignDrop(t.current)},[]);var a=n.state,l=void 0===a?0:a,u=n.label,c=void 0===u?"Add file or drop file here...":u,s=n.error;return h("div",{className:"upload-area6 "+(!0===i?"drag-over":""),onDragOver:function(){r(!0)},onDragLeave:function(){r(!1)},ref:t},0===l?h(Re,{resumable:n.resumable}):"",0===l?h("label",null,c):"",1===l?h(w,{size:"xlarge"}):"",2===l?h(d,{icon:"done_all"}):"",3===l?h(m,{use:"body1"},s):"",n.children)},Re=function(n){var t=n.resumable,o=e.useRef();return e.useEffect(function(){t&&o&&t.assignBrowse(o.current)},[]),h("div",{className:"upload-icon",ref:o},h(d,{icon:"folder_open",clickable:!0}))},Ie=function(n){var t=n.label,o=n.target,i=n.accept,r=n.className,l=n.onSuccess,u=n.onError,c=n.onComplete,s=e.useMemo(function(){var e=new a.default({target:o,chunkSize:1048576,simultaneousUploads:1,testChunks:!1,throttleProgressCallbacks:1,fileType:i});return e.on("fileAdded",S),e.on("fileProgress",x),e.on("fileSuccess",k),e.on("fileError",E),e.on("complete",P),e},[]),d=e.useState(0)[1],f=e.useState(0),v=f[0],m=f[1],p=e.useState(),g=p[0],b=p[1],C=e.useState([]),y=C[0],N=C[1];function S(e){y.push(e),N(y),s.upload()}function x(e){var n=e.progress();d(n)}function k(e,n){m(2),l&&l(e,n)}function E(e,n){b(n),m(3),u&&u(e,n)}function P(){m(0),c&&c(y)}return h("div",{className:"uploader "+r},h(De,{resumable:s,state:v,label:t,error:g}))},_e=function(n){var t=n.file,o=n.state,i=n.progress,r=n.error,a=r?h(d,{icon:"image",className:"error"}):h(d,{icon:"image"});return 0!==o?h(e.Fragment,null,h("div",{className:"upload-file"},a,h(m,{use:"body1",tag:"label"},t.fileName),1===o?h(T,{progress:i}):"",1===o?h(d,{icon:"close",clickable:!0}):"",2===o?h(d,{icon:"done"}):"",3===o?h(d,{icon:"error"}):""),r?h("div",{className:"error"},h(m,{use:"overline"},r)):""):""};exports.Button=f,exports.CheckBox=p,exports.Chip=function(e){var n=e.id,t=e.icon,o=e.label,i=e.action,r=e.onSelect,a=e.outlined?"outlined":"normal";return e.selected&&(a+=" selected"),h("div",{className:"chip "+a,onClick:function(e){e.stopPropagation(),e.preventDefault(),r&&r(n)}},t?h(d,{icon:t,size:"small"}):null,h("main",null,h(m,null,o)),i?h("span",{className:"meta"},i):null)},exports.Chips=function(e){return h("div",{className:"chips"},e.children)},exports.CircularProgress=w,exports.CollectionContext=je,exports.CollectionEditor=Se,exports.CollectionPage=function(n){var t=e.useContext(v),o=n.id,i=void 0===o?"collection":o,r=n.icon,a=n.title,l=n.name,u=void 0===l?"Collection 1":l,c=n.schema,s=n.url,d=n.groupBy,p=n.editor,g=n.field,b=n.autosave,y=void 0!==b&&b,N=n.delay,S=void 0===N?1e3:N,x=n.actions,k=n.levels,E=e.useContext(H),P=E[0],O=E[1],w=je(s,g);return e.useEffect(function(){try{return Promise.resolve(w.load()).then(function(){O(w)})}catch(e){return Promise.reject(e)}},[]),h(e.Fragment,null,h(C,{className:"collection-page",title:h(m,null,a)},h(f,{icon:"add",label:"Add",action:function(){t.openDialog(h(ke,{label:"Crear "+u,type:c,onOK:function(e){try{return Promise.resolve(P.create(e)).then(function(){O(Object.assign({},P))})}catch(e){return Promise.reject(e)}}}))}}),h(f,{icon:"refresh",label:"Reload",action:function(){try{return Promise.resolve(P.load()).then(function(){O(Object.assign({},P))})}catch(e){return Promise.reject(e)}}}),x),h("menu",{className:"collection-page"},h(C,{title:h(m,null,"Lista de ",u)}),k?h(we,{levels:k}):h(Oe,{groupBy:d})),h("main",{key:i,className:"collection-page"},h(Te,{icon:r,schema:c,layout:p,autosave:y,delay:S})))},exports.Content=ue,exports.ContentEditor=fe,exports.ContentForm=ce,exports.CreateContentDialog=function(n){var t=n.label,o=n.type,i=n.validator,r=n.onOK,a=n.onActionClose,l=void 0===a||a,u=e.useContext(v),c=e.useState({}),s=c[0],d=c[1],p=e.useState(!1),g=p[0],b=p[1],C=e.useState([]),y=C[0],N=C[1];function S(e){"OK"===e&&r&&r(s),"CLOSE"!==e&&!0!==l||u.closeDialog()}var x=h(e.Fragment,null,h(f,{label:"CLOSE",action:function(){return S("CLOSE")}}),h(f,{label:"OK",action:function(){return S("OK")},disabled:!g,raised:!0})),k=h(m,{use:"headline6"},t),E=new ue(o,s);return h(ie,{title:k,open:!0,onAction:S,actions:x},h(ce,{content:E,filter:function(e){return function(e){var n=e.required;return void 0!==n&&n}(e)||function(e){var n=e.creation;return void 0!==n&&n}(e)},onChange:function(e,n){if(d(e),i){var t=i(e),o=t.errors,r=void 0===o?[]:o;b(n&&t.validation),N(r)}else b(n)}}),y.map(function(e){return h(m,{use:"overline",tag:"div",className:"error"},e)}))},exports.DataTable=_,exports.Dialog=ie,exports.DropDown=I,exports.EditContentDialog=ke,exports.FieldEditor=pe,exports.Form=g,exports.HTTPClient=u,exports.Header=C,exports.Icon=d,exports.Kanban=function(e){return h("div",{className:"kanban"},e.children)},exports.KanbanCard=function(e){return h("div",{className:"kanban-card "+e.color},e.children)},exports.KanbanColumn=function(n){var t=n.id,o=n.icon,i=n.title,r=n.subtitle,a=n.badge,l=n.children,u=n.minified,c=n.disabled,s=void 0!==c&&c,f=e.useState(void 0!==u&&u),v=f[0],p=f[1];function g(){p(!v)}return v?h("div",{className:"kanban-column "+t+" min"},h("main",null,i),h("footer",null,h(d,{icon:"toggle_off",onIcon:"toggle_on",clickable:!0,action:g}))):h("div",{className:"kanban-column "+t+" "+(s?"disabled":"")},h("header",null,h(d,{icon:o}),h("div",{className:"title"},h(m,{use:"headline6"},i),h(m,{className:"secondary-text",use:"body2"},r)),h("div",{className:"badge"},a)),h("main",null,l),h("footer",null,h(d,{icon:"toggle_off",onIcon:"toggle_on",clickable:!0,action:g})))},exports.LinearProgress=T,exports.List=N,exports.ListEditor=ye,exports.LoginBox=function(n){var t=n.logo,o=n.title,i=n.userLabel,r=void 0===i?"User":i,a=n.passwordLabel,l=void 0===a?"Password":a,u=n.loginLabel,c=void 0===u?"Log In":u,s=n.onOK,v=n.forgotLabel,p=void 0===v?"Forgot Password ?":v,g=n.onForgot,b=n.message,C=n.loading,y=e.useState(""),N=y[0],S=y[1],x=e.useState(""),k=x[0],E=x[1];function P(){return N&&N.length>0&&k&&k.length>0}function O(e){s&&P()&&s(N,e||k)}function w(e){return h(m,null,e)}return h("div",{className:"login-box"},h("header",null,t?h("img",{src:t}):"",h("div",{className:"title"},h(m,null,o))),h("main",null,h(R,{label:w(r),value:N,onChange:function(e,n){S(n)},onEnter:O,outlined:!0}),h(R,{label:w(l),value:k,onChange:function(e,n){E(n)},onEnter:O,type:"password",outlined:!0})),h("footer",null,g?h(f,{label:w(p),action:function(){g&&g(N)},disabled:!(N&&N.length>0)}):null,C?h("div",{className:"load-box"},h(d,{icon:"refresh"})):h(f,{label:w(c),action:O,disabled:!P(),raised:!0}),b?h("div",{className:"message"},h(m,null,b)):null))},exports.Menu=E,exports.MenuIcon=P,exports.MenuItem=O,exports.MenuSeparator=function(e){return h("li",null,"menuSeparator")},exports.Page=V,exports.PageContext=H,exports.PageProvider=J,exports.Property=function(e){var n=e.value;return h("div",{className:"property"},h("div",{className:"property-name"},e.name),h("div",{className:"property-value"},n))},exports.RadioButton=function(e){var n=e.id,t=e.name,o=e.placeholder,i=e.value,r=e.onChange,a=h(m,null,e.label);return h("div",{className:"radio"},h("input",{id:n,name:t,type:"radio",placeholder:o,value:i,onClick:function(e){r&&r(n,e.target.value)}}),h("span",{class:"checkmark"}),h("label",{htmlFor:n},a))},exports.ResetPasswordBox=function(n){var t=n.logo,o=n.title,i=n.children,r=n.onOK,a=n.onClose,l=e.useState({}),u=l[0],c=l[1],s=e.useState(),d=s[0],v=s[1];function p(){return u.password1&&u.password2}function g(e,n){var t,o=Object.assign({},u,((t={})[e]=n,t));c(o)}function b(){r&&p()&&(u.password1===u.password2?(v(null),r(u)):v("New Password and Confirm New Password do not match"))}return h("div",{className:"reset-password-box"},h("header",null,t?h("img",{src:t}):null,o?h("div",{className:"title"},h(m,null,o)):null,i),h("main",null,h(m,{use:"headline6"},"Change Password"),h(R,{id:"password1",outlined:!0,icon:"lock",type:"password",label:"New Password",lapse:100,onChange:g,onEnter:b}),h(R,{id:"password2",outlined:!0,icon:"lock",type:"password",label:"Confirm New Password",lapse:100,onChange:g,onEnter:b}),d?h("div",{className:"error"},d):null),h("footer",null,h(f,{label:"Close",action:function(){a&&a()}}),h(f,{label:"OK",raised:!0,disabled:!p(),action:b})))},exports.Section=function(n){var t=n.icon,o=n.title,i=void 0===o?"":o,r=n.canCollapse,a=void 0===r||r,l=n.open,u=void 0!==l&&l,c=n.actions,s=n.children,f=n.className,v=e.useState(u),m=v[0],p=v[1];return e.useEffect(function(){p(u)},[u]),h("section",{className:"section2 "+f},h(C,{icon:{icon:t},title:i},c,a?h(d,{icon:"expand_more",onIcon:"expand_less",clickable:!0,action:function(){p(!u)}}):""),m?h("main",null,s):"")},exports.Session=s,exports.Site=function(e){var n=e.logo,t=e.title,o=e.toolbar,i=e.children,r=e.init,a=e.min;return h(W,{siteLang:e.lang,siteDictionary:e.dictionary},h("div",{className:"site6"},h(X,{icon:e.icon}),h(Q,null,o),h($,{logo:n,title:t,min:a},i),h(ee,{init:r},i,h(V,{id:"EMPTY"},"EMPTY")),h(Z,null),h(oe,null),h(ne,null),h(te,null)))},exports.SiteContext=v,exports.SiteProvider=W,exports.Stack=D,exports.TYPES=re,exports.Tab=A,exports.TabbedContentEditor=ve,exports.Tabs=j,exports.Text=m,exports.TextField=R,exports.TokenField=z,exports.Tree=M,exports.TreeItem=G,exports.TreeNode=Y,exports.TreededContentEditor=me,exports.UploadArea=De,exports.UploadDialog=function(n){var t=n.label,o=n.target,i=n.accept,r=n.onSuccess,a=n.onClose,l=n.onActionClose,u=void 0===l||l,c=e.useContext(v),s=e.useState(),d=s[0],p=s[1],g=e.useState([])[0];function b(e){"CLOSE"!==e&&!0!==u||(c.closeDialog(),a())}var C=h(e.Fragment,null,h(f,{label:"CLOSE",action:function(){return b("CLOSE")}})),y=h(m,{use:"headline6"},t);return h(ie,{title:y,open:!0,onAction:b,actions:C},d?h(_e,{file:d}):h(Ie,{label:t,accept:i,target:o,onComplete:function(e){p(e[0]),r&&r(e[0])}}),g.map(function(e){return h(m,{use:"overline",tag:"div",className:"error"},e)}))},exports.UploadFile=_e,exports.Uploader=Ie,exports.Viewer=function(n){var t=n.title,o=n.src,i=n.info,r=n.actions,a=void 0===r?[]:r,l=n.tools,u=void 0!==l&&l,c=n.onClose,s=e.useState(!1),f=s[0],v=s[1];function p(){v(!f)}var g=h(m,{use:"headline6"},t);return h("div",{className:"viewer"},h(C,{icon:{icon:"close",clickable:!0,action:c},title:g},f?"":h(d,{icon:"info",clickable:!0,action:p}),a),h("main",null,h("div",{className:"resizer"},h("picture",null,h("img",{src:o})))),h("aside",{className:f?"open":""},h(C,{title:"Detalles"},h(d,{icon:"close",clickable:!0,action:p})),h("main",null,i)),u?h("footer",null,h(d,{clickable:!0,icon:"zoom_out"}),h(d,{clickable:!0,icon:"zoom_out_map"}),h(d,{clickable:!0,icon:"zoom_in"})):null)},exports.isFunction=function(e){return e&&("[object Function]"===Object.prototype.toString.call(e)||"function"==typeof e||e instanceof Function)};
|
2
2
|
//# sourceMappingURL=index.cjs.map
|