@sankhyalabs/ezui 7.1.0-dev.1 → 7.1.0-dev.10
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/cjs/ez-combo-box-list_4.cjs.entry.js +1 -1
- package/dist/cjs/ez-dialog.cjs.entry.js +1 -1
- package/dist/cjs/ez-form.cjs.entry.js +110 -38
- package/dist/cjs/ez-grid.cjs.entry.js +3 -3
- package/dist/cjs/ez-modal-container.cjs.entry.js +2 -11
- package/dist/cjs/ez-popup.cjs.entry.js +9 -6
- package/dist/cjs/ez-tree.cjs.entry.js +154 -7
- package/dist/cjs/ezui.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{purify-47a2f27b.js → purify-453a8028.js} +35 -12
- package/dist/cjs/{search-column-9aa090ec.js → search-column-8bfee733.js} +1 -1
- package/dist/collection/components/ez-dialog/ez-dialog.css +6 -1
- package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +1 -1
- package/dist/collection/components/ez-modal-container/ez-modal-container.css +3 -9
- package/dist/collection/components/ez-modal-container/ez-modal-container.js +1 -10
- package/dist/collection/components/ez-popup/ez-popup.css +3 -2
- package/dist/collection/components/ez-popup/ez-popup.js +9 -6
- package/dist/collection/components/ez-tree/ez-tree.css +4 -0
- package/dist/collection/components/ez-tree/ez-tree.js +185 -6
- package/dist/collection/components/ez-tree/subcomponents/TreeItem.js +4 -1
- package/dist/collection/components/ez-tree/types/Node.js +7 -0
- package/dist/collection/components/ez-tree/types/Tree.js +19 -0
- package/dist/collection/components/ez-tree/types/UpdateItemConfig.js +1 -0
- package/dist/collection/utils/form/DataBinder.js +1 -1
- package/dist/collection/utils/form/FormMetadata.js +109 -37
- package/dist/custom-elements/index.js +313 -77
- package/dist/esm/ez-combo-box-list_4.entry.js +1 -1
- package/dist/esm/ez-dialog.entry.js +1 -1
- package/dist/esm/ez-form.entry.js +110 -38
- package/dist/esm/ez-grid.entry.js +3 -3
- package/dist/esm/ez-modal-container.entry.js +2 -11
- package/dist/esm/ez-popup.entry.js +9 -6
- package/dist/esm/ez-tree.entry.js +154 -7
- package/dist/esm/ezui.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{purify-dc6814bf.js → purify-003c47e2.js} +35 -12
- package/dist/esm/{search-column-83562552.js → search-column-c00119ae.js} +1 -1
- package/dist/ezui/ezui.esm.js +1 -1
- package/dist/ezui/p-294f54fe.entry.js +1 -0
- package/dist/ezui/p-4f0632b4.js +1 -0
- package/dist/ezui/{p-d66bf34e.entry.js → p-8c57ffa4.entry.js} +2 -2
- package/dist/ezui/p-ae5f64cd.entry.js +1 -0
- package/dist/ezui/p-bb409cba.js +3 -0
- package/dist/ezui/p-c82acfc6.entry.js +1 -0
- package/dist/ezui/{p-c943f7c4.entry.js → p-e03b2f19.entry.js} +1 -1
- package/dist/ezui/p-e77610ef.entry.js +1 -0
- package/dist/ezui/p-ff4bde07.entry.js +1 -0
- package/dist/types/components/ez-modal-container/ez-modal-container.d.ts +0 -2
- package/dist/types/components/ez-popup/ez-popup.d.ts +1 -0
- package/dist/types/components/ez-tree/ez-tree.d.ts +20 -1
- package/dist/types/components/ez-tree/types/Node.d.ts +1 -0
- package/dist/types/components/ez-tree/types/Tree.d.ts +1 -0
- package/dist/types/components/ez-tree/types/UpdateItemConfig.d.ts +4 -0
- package/dist/types/components.d.ts +18 -1
- package/dist/types/utils/form/FormMetadata.d.ts +2 -1
- package/dist/types/utils/form/interfaces/IFormSheetMetadata.d.ts +3 -0
- package/dist/types/utils/form/interfaces/ITabConfig.d.ts +3 -0
- package/package.json +1 -1
- package/dist/ezui/p-02f6e3b0.entry.js +0 -1
- package/dist/ezui/p-191cfbc8.entry.js +0 -1
- package/dist/ezui/p-228a4d2f.js +0 -3
- package/dist/ezui/p-2df50161.entry.js +0 -1
- package/dist/ezui/p-4c4f0850.entry.js +0 -1
- package/dist/ezui/p-623161e2.js +0 -1
- package/dist/ezui/p-bd6146c5.entry.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,c as i,h as o,H as e,g as l}from"./p-23a36bb6.js";import{KeyboardManager as s,FloatingManager as n}from"@sankhyalabs/core";import{i as a}from"./p-641ee538.js";const d=class{constructor(o){t(this,o),this.ezClosePopup=i(this,"ezClosePopup",7),this.ezPopupAction=i(this,"ezPopupAction",7),this.size="medium",this.opened=!1,this.useHeader=!0,this.heightMode="full",this.ezTitle=void 0,this.enabledScroll=!0,this.autoClose=!0,this.footerButtons=[]}observeConfig(){this.manageOverflow()}async componentWillLoad(){this.i18n=await a()}componentDidLoad(){this.popUpFocus(),this._keyboardManager=new s({propagate:!1,element:this._element,enableShadowDom:!0}).bind("Enter",this.ezPopupAction.emit.bind("OK")).bind("Escape",(()=>this.closePopup())).bind("Esc",(()=>this.closePopup()))}disconnectedCallback(){var t;null===(t=this._keyboardManager)||void 0===t||t.unbindAllShortcutKeys()}closePopup(){this.opened=!1,this.manageOverflow(),this.ezClosePopup.emit()}manageOverflow(){window.document.body.style.overflow=this.opened?"hidden":""}manageOverlay(){this.opened?this._overlayId=n.subscribeOverlayControl(this._popupRef):n.unsubscribeOverlayControl(this._popupRef||this._overlayId)}popUpFocus(){this.opened&&this._popupRef&&this._popupRef.focus()}getGridSize(){const t={"x-small":"col--sd-3 ez-popup__size-limit--x-small",small:"col--sd-5",medium:"col--sd-6",large:"col--sd-9","x-large":"col--sd-11",default:"ez-popup__size-limit--x-small",auto:""};return this.size&&t.hasOwnProperty(this.size)&&t[this.size]||t.medium}getDialogClass(){let t="popup__container";return"auto"===this.heightMode&&(t+=" popup__container--auto"),t+=` ${this.getGridSize()}`,t}componentDidRender(){this.manageOverlay(),this.popUpFocus()}handleAutoClose(t){if(!this.opened||!this._popupRef||!this.autoClose)return;if(this._popupRef.contains(t.target))return;const i=this._popupRef.querySelector("slot");if(i&&i.assignedElements().length>0){const o=i.assignedElements();for(const i of o)if(i.contains(t.target))return}this._popupRef.shadowRoot&&this._popupRef.shadowRoot.contains(t.target)||this.closePopup()}handleDefaultPropsButtonsByIndex(t){switch(t){case 0:return{label:this.i18n?this.i18n("app.confirm"):"Confirmar",variant:"primary",size:"small",onClick:()=>{this.closePopup(),this.ezPopupAction.emit("OK")}};case 1:return{label:this.i18n?this.i18n("app.cancel"):"Cancelar",variant:"secondary",size:"small",onClick:()=>{this.closePopup()}};case 2:return{label:this.i18n?this.i18n("app.close"):"Fechar",variant:"tertiary",size:"small",onClick:()=>{this.closePopup()}}}}renderFooterButtons(){return this.footerButtons.slice(0,3).map(((t,i)=>o("ez-button",Object.assign({key:i},this.handleDefaultPropsButtonsByIndex(i),t))))}render(){return o(e,null,this.opened&&o("div",{class:"overlay",tabIndex:-1,onClick:this.handleAutoClose.bind(this)},o("dialog",{ref:t=>this._popupRef=t,class:this.getDialogClass()},this.useHeader&&o("header",{class:"popup__header"},!!this.ezTitle&&o("h1",{class:"popup__title"},this.ezTitle),o("ez-button",{class:this.ezTitle?"btn-close":"btn-close btn-close--solo",variant:"tertiary",mode:"icon",iconName:"close",size:"small",onClick:this.closePopup.bind(this)})),o("main",{class:{"popup__expandable-content":!0,"popup__overflow-y--auto":this.enabledScroll}},o("slot",null)),o("footer",{class:"popup__footer"},this.footerButtons.length>0&&this.renderFooterButtons(),o("slot",{name:"footer"})))))}get _element(){return l(this)}static get watchers(){return{opened:["observeConfig"]}}};d.style=':host{display:flex;width:auto;--ez-popup-z-index:var(--elevation--24, 24);--ez-popup__container--color:var(--title--primary, #2b3a54);--ez-popup__container--padding:var(--space--24, 24px);--ez-popup__title--font-family:var(--font--pattern, "Roboto");--ez-popup__title--font-size:var(--font-size--xxlarge, 22px);--ez-popup__title--color:var(--title--primary, #00281D);--ez-popup__title--font-weight:var(--font-weight--regular, 400)}.overlay{position:fixed;display:flex;top:0px;z-index:var(--ez-popup-z-index, 24);left:0px;width:100%;align-items:center;justify-content:center;box-sizing:border-box;height:100vh;backdrop-filter:blur(4px);background:rgba(0, 4, 12, 0.4)}.popup__container{width:100%;max-height:90%;height:100%;display:flex;flex-direction:column;overflow:hidden;outline:none;background:#FFFF;color:var(--ez-popup__container--color);border-radius:12px;box-shadow:0px 0px 16px rgba(0, 38, 111, 0.122);box-sizing:border-box;padding:var(--ez-popup__container--padding);margin:0;border:none;position:unset;gap:var(--space--16, 16px)}.popup__container--auto{height:auto}.popup__overflow-y--auto{overflow-y:auto}.popup__content{box-sizing:border-box;height:100%;width:100%}.popup__expandable-content{flex-grow:1;box-sizing:border-box;width:100%;font-family:var(--font--pattern, "Roboto");font-size:var(--font-size--default, 14px);color:var(--title--primary, #00281D);font-weight:var(--font-weight--regular, 400)}.popup__header{flex-shrink:0;width:100%;display:flex;align-items:center}.popup__title{display:flex;margin:0;width:100%;font-family:var(--ez-popup__title--font-family);font-size:var(--ez-popup__title--font-size);font-weight:var(--ez-popup__title--font-weight);color:var(--ez-popup__title--color);line-height:var(--line-height--32, 32px)}.btn-close{justify-content:flex-end;align-self:flex-start;align-items:flex-start;display:flex;outline:none;border:none;background-color:unset;cursor:pointer}.btn-close--solo{width:100%}.popup__footer{flex-shrink:0;display:flex;width:100%;flex-direction:row-reverse;gap:var(--space--8, 8px)}.row{width:100%;display:flex;flex-wrap:wrap}.col{display:flex;flex-wrap:wrap;align-self:flex-start;box-sizing:border-box}.col--stretch{align-self:stretch}.col--undefined{width:unset}.col--nowrap{flex-wrap:nowrap}.ez-popup__size-limit--x-small{min-width:350px;max-width:560px}@media screen and (min-width: 320px){.col--sd-1{width:8.33333%}.col--sd-2{width:16.66667%}.col--sd-3{width:25%}.col--sd-4{width:33.33333%}.col--sd-5{width:41.66667%}.col--sd-6{width:50%}.col--sd-7{width:58.33333%}.col--sd-8{width:66.66667%}.col--sd-9{width:75%}.col--sd-10{width:83.33333%}.col--sd-11{width:91.66667%}.col--sd-12{width:100%}}@media screen and (min-width: 480px){.col--pn-1{width:8.33333%}.col--pn-2{width:16.66667%}.col--pn-3{width:25%}.col--pn-4{width:33.33333%}.col--pn-5{width:41.66667%}.col--pn-6{width:50%}.col--pn-7{width:58.33333%}.col--pn-8{width:66.66667%}.col--pn-9{width:75%}.col--pn-10{width:83.33333%}.col--pn-11{width:91.66667%}.col--pn-12{width:100%}}@media screen and (min-width: 768px){.col--tb-1{width:8.33333%}.col--tb-2{width:16.66667%}.col--tb-3{width:25%}.col--tb-4{width:33.33333%}.col--tb-5{width:41.66667%}.col--tb-6{width:50%}.col--tb-7{width:58.33333%}.col--tb-8{width:66.66667%}.col--tb-9{width:75%}.col--tb-10{width:83.33333%}.col--tb-11{width:91.66667%}.col--tb-12{width:100%}}@media screen and (min-width: 992px){.col--md-1{width:8.33333%}.col--md-2{width:16.66667%}.col--md-3{width:25%}.col--md-4{width:33.33333%}.col--md-5{width:41.66667%}.col--md-6{width:50%}.col--md-7{width:58.33333%}.col--md-8{width:66.66667%}.col--md-9{width:75%}.col--md-10{width:83.33333%}.col--md-11{width:91.66667%}.col--md-12{width:100%}}@media screen and (min-width: 1200px){.col--ld-1{width:8.33333%}.col--ld-2{width:16.66667%}.col--ld-3{width:25%}.col--ld-4{width:33.33333%}.col--ld-5{width:41.66667%}.col--ld-6{width:50%}.col--ld-7{width:58.33333%}.col--ld-8{width:66.66667%}.col--ld-9{width:75%}.col--ld-10{width:83.33333%}.col--ld-11{width:91.66667%}.col--ld-12{width:100%}}';export{d as ez_popup}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{c as e,a as t}from"./p-112455b1.js";var n=e((function(e){
|
|
2
|
+
/*! @license DOMPurify 3.3.0 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.0/LICENSE */
|
|
3
|
+
e.exports=function(){const{entries:e,setPrototypeOf:t,isFrozen:n,getPrototypeOf:i,getOwnPropertyDescriptor:o}=Object;let{freeze:r,seal:a,create:l}=Object,{apply:s,construct:c}="undefined"!=typeof Reflect&&Reflect;r||(r=function(e){return e}),a||(a=function(e){return e}),s||(s=function(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];return e.apply(t,i)}),c||(c=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return new e(...n)});const u=A(Array.prototype.forEach),f=A(Array.prototype.lastIndexOf),p=A(Array.prototype.pop),m=A(Array.prototype.push),d=A(Array.prototype.splice),g=A(String.prototype.toLowerCase),h=A(String.prototype.toString),y=A(String.prototype.match),b=A(String.prototype.replace),w=A(String.prototype.indexOf),x=A(String.prototype.trim),v=A(Object.prototype.hasOwnProperty),T=A(RegExp.prototype.test),k=(S=TypeError,function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return c(S,t)});var S;function A(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];return s(e,t,i)}}function E(e,i){let o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:g;t&&t(e,null);let r=i.length;for(;r--;){let t=i[r];if("string"==typeof t){const e=o(t);e!==t&&(n(i)||(i[r]=e),t=e)}e[t]=!0}return e}function R(e){for(let t=0;t<e.length;t++)v(e,t)||(e[t]=null);return e}function _(t){const n=l(null);for(const[i,o]of e(t))v(t,i)&&(n[i]=Array.isArray(o)?R(o):o&&"object"==typeof o&&o.constructor===Object?_(o):o);return n}function z(e,t){for(;null!==e;){const n=o(e,t);if(n){if(n.get)return A(n.get);if("function"==typeof n.value)return A(n.value)}e=i(e)}return function(){return null}}const O=r(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),D=r(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),L=r(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),M=r(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),F=r(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),I=r(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),P=r(["#text"]),N=r(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),C=r(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),j=r(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),U=r(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),B=a(/\{\{[\w\W]*|[\w\W]*\}\}/gm),W=a(/<%[\w\W]*|[\w\W]*%>/gm),H=a(/\$\{[\w\W]*/gm),q=a(/^data-[\-\w.\u00B7-\uFFFF]+$/),Y=a(/^aria-[\-\w]+$/),X=a(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),$=a(/^(?:\w+script|data):/i),G=a(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),K=a(/^html$/i),V=a(/^[a-z][.\w]*(-[.\w]+)+$/i);var J=Object.freeze({__proto__:null,ARIA_ATTR:Y,ATTR_WHITESPACE:G,CUSTOM_ELEMENT:V,DATA_ATTR:q,DOCTYPE_NAME:K,ERB_EXPR:W,IS_ALLOWED_URI:X,IS_SCRIPT_OR_DATA:$,MUSTACHE_EXPR:B,TMPLIT_EXPR:H});const Q=1,Z=3,ee=7,te=8,ne=9,ie=function(){return"undefined"==typeof window?null:window},oe=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let n=null;const i="data-tt-policy-suffix";t&&t.hasAttribute(i)&&(n=t.getAttribute(i));const o="dompurify"+(n?"#"+n:"");try{return e.createPolicy(o,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){return console.warn("TrustedTypes policy "+o+" could not be created."),null}};var re=function t(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ie();const i=e=>t(e);if(i.version="3.3.0",i.removed=[],!n||!n.document||n.document.nodeType!==ne||!n.Element)return i.isSupported=!1,i;let{document:o}=n;const a=o,s=a.currentScript,{DocumentFragment:c,HTMLTemplateElement:S,Node:A,Element:R,NodeFilter:B,NamedNodeMap:W=n.NamedNodeMap||n.MozNamedAttrMap,HTMLFormElement:H,DOMParser:q,trustedTypes:Y}=n,$=R.prototype,G=z($,"cloneNode"),V=z($,"remove"),re=z($,"nextSibling"),ae=z($,"childNodes"),le=z($,"parentNode");if("function"==typeof S){const e=o.createElement("template");e.content&&e.content.ownerDocument&&(o=e.content.ownerDocument)}let se,ce="";const{implementation:ue,createNodeIterator:fe,createDocumentFragment:pe,getElementsByTagName:me}=o,{importNode:de}=a;let ge={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};i.isSupported="function"==typeof e&&"function"==typeof le&&ue&&void 0!==ue.createHTMLDocument;const{MUSTACHE_EXPR:he,ERB_EXPR:ye,TMPLIT_EXPR:be,DATA_ATTR:we,ARIA_ATTR:xe,IS_SCRIPT_OR_DATA:ve,ATTR_WHITESPACE:Te,CUSTOM_ELEMENT:ke}=J;let{IS_ALLOWED_URI:Se}=J,Ae=null;const Ee=E({},[...O,...D,...L,...F,...P]);let Re=null;const _e=E({},[...N,...C,...j,...U]);let ze=Object.seal(l(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Oe=null,De=null;const Le=Object.seal(l(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Me=!0,Fe=!0,Ie=!1,Pe=!0,Ne=!1,Ce=!0,je=!1,Ue=!1,Be=!1,We=!1,He=!1,qe=!1,Ye=!0,Xe=!1;const $e="user-content-";let Ge=!0,Ke=!1,Ve={},Je=null;const Qe=E({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Ze=null;const et=E({},["audio","video","img","source","image","track"]);let tt=null;const nt=E({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),it="http://www.w3.org/1998/Math/MathML",ot="http://www.w3.org/2000/svg",rt="http://www.w3.org/1999/xhtml";let at=rt,lt=!1,st=null;const ct=E({},[it,ot,rt],h);let ut=E({},["mi","mo","mn","ms","mtext"]),ft=E({},["annotation-xml"]);const pt=E({},["title","style","font","a","script"]);let mt=null;const dt=["application/xhtml+xml","text/html"],gt="text/html";let ht=null,yt=null;const bt=o.createElement("form"),wt=function(e){return e instanceof RegExp||e instanceof Function},xt=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!yt||yt!==e){if(e&&"object"==typeof e||(e={}),e=_(e),mt=-1===dt.indexOf(e.PARSER_MEDIA_TYPE)?gt:e.PARSER_MEDIA_TYPE,ht="application/xhtml+xml"===mt?h:g,Ae=v(e,"ALLOWED_TAGS")?E({},e.ALLOWED_TAGS,ht):Ee,Re=v(e,"ALLOWED_ATTR")?E({},e.ALLOWED_ATTR,ht):_e,st=v(e,"ALLOWED_NAMESPACES")?E({},e.ALLOWED_NAMESPACES,h):ct,tt=v(e,"ADD_URI_SAFE_ATTR")?E(_(nt),e.ADD_URI_SAFE_ATTR,ht):nt,Ze=v(e,"ADD_DATA_URI_TAGS")?E(_(et),e.ADD_DATA_URI_TAGS,ht):et,Je=v(e,"FORBID_CONTENTS")?E({},e.FORBID_CONTENTS,ht):Qe,Oe=v(e,"FORBID_TAGS")?E({},e.FORBID_TAGS,ht):_({}),De=v(e,"FORBID_ATTR")?E({},e.FORBID_ATTR,ht):_({}),Ve=!!v(e,"USE_PROFILES")&&e.USE_PROFILES,Me=!1!==e.ALLOW_ARIA_ATTR,Fe=!1!==e.ALLOW_DATA_ATTR,Ie=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Pe=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,Ne=e.SAFE_FOR_TEMPLATES||!1,Ce=!1!==e.SAFE_FOR_XML,je=e.WHOLE_DOCUMENT||!1,We=e.RETURN_DOM||!1,He=e.RETURN_DOM_FRAGMENT||!1,qe=e.RETURN_TRUSTED_TYPE||!1,Be=e.FORCE_BODY||!1,Ye=!1!==e.SANITIZE_DOM,Xe=e.SANITIZE_NAMED_PROPS||!1,Ge=!1!==e.KEEP_CONTENT,Ke=e.IN_PLACE||!1,Se=e.ALLOWED_URI_REGEXP||X,at=e.NAMESPACE||rt,ut=e.MATHML_TEXT_INTEGRATION_POINTS||ut,ft=e.HTML_INTEGRATION_POINTS||ft,ze=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&wt(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(ze.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&wt(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(ze.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(ze.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Ne&&(Fe=!1),He&&(We=!0),Ve&&(Ae=E({},P),Re=[],!0===Ve.html&&(E(Ae,O),E(Re,N)),!0===Ve.svg&&(E(Ae,D),E(Re,C),E(Re,U)),!0===Ve.svgFilters&&(E(Ae,L),E(Re,C),E(Re,U)),!0===Ve.mathMl&&(E(Ae,F),E(Re,j),E(Re,U))),e.ADD_TAGS&&("function"==typeof e.ADD_TAGS?Le.tagCheck=e.ADD_TAGS:(Ae===Ee&&(Ae=_(Ae)),E(Ae,e.ADD_TAGS,ht))),e.ADD_ATTR&&("function"==typeof e.ADD_ATTR?Le.attributeCheck=e.ADD_ATTR:(Re===_e&&(Re=_(Re)),E(Re,e.ADD_ATTR,ht))),e.ADD_URI_SAFE_ATTR&&E(tt,e.ADD_URI_SAFE_ATTR,ht),e.FORBID_CONTENTS&&(Je===Qe&&(Je=_(Je)),E(Je,e.FORBID_CONTENTS,ht)),Ge&&(Ae["#text"]=!0),je&&E(Ae,["html","head","body"]),Ae.table&&(E(Ae,["tbody"]),delete Oe.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw k('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw k('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');se=e.TRUSTED_TYPES_POLICY,ce=se.createHTML("")}else void 0===se&&(se=oe(Y,s)),null!==se&&"string"==typeof ce&&(ce=se.createHTML(""));r&&r(e),yt=e}},vt=E({},[...D,...L,...M]),Tt=E({},[...F,...I]),kt=function(e){let t=le(e);t&&t.tagName||(t={namespaceURI:at,tagName:"template"});const n=g(e.tagName),i=g(t.tagName);return!!st[e.namespaceURI]&&(e.namespaceURI===ot?t.namespaceURI===rt?"svg"===n:t.namespaceURI===it?"svg"===n&&("annotation-xml"===i||ut[i]):Boolean(vt[n]):e.namespaceURI===it?t.namespaceURI===rt?"math"===n:t.namespaceURI===ot?"math"===n&&ft[i]:Boolean(Tt[n]):e.namespaceURI===rt?!(t.namespaceURI===ot&&!ft[i])&&!(t.namespaceURI===it&&!ut[i])&&!Tt[n]&&(pt[n]||!vt[n]):!("application/xhtml+xml"!==mt||!st[e.namespaceURI]))},St=function(e){m(i.removed,{element:e});try{le(e).removeChild(e)}catch(t){V(e)}},At=function(e,t){try{m(i.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){m(i.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e)if(We||He)try{St(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},Et=function(e){let t=null,n=null;if(Be)e="<remove></remove>"+e;else{const t=y(e,/^[\r\n\t ]+/);n=t&&t[0]}"application/xhtml+xml"===mt&&at===rt&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const i=se?se.createHTML(e):e;if(at===rt)try{t=(new q).parseFromString(i,mt)}catch(e){}if(!t||!t.documentElement){t=ue.createDocument(at,"template",null);try{t.documentElement.innerHTML=lt?ce:i}catch(e){}}const r=t.body||t.documentElement;return e&&n&&r.insertBefore(o.createTextNode(n),r.childNodes[0]||null),at===rt?me.call(t,je?"html":"body")[0]:je?t.documentElement:r},Rt=function(e){return fe.call(e.ownerDocument||e,e,B.SHOW_ELEMENT|B.SHOW_COMMENT|B.SHOW_TEXT|B.SHOW_PROCESSING_INSTRUCTION|B.SHOW_CDATA_SECTION,null)},_t=function(e){return e instanceof H&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof W)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes)},zt=function(e){return"function"==typeof A&&e instanceof A};function Ot(e,t,n){u(e,(e=>{e.call(i,t,n,yt)}))}const Dt=function(e){let t=null;if(Ot(ge.beforeSanitizeElements,e,null),_t(e))return St(e),!0;const n=ht(e.nodeName);if(Ot(ge.uponSanitizeElement,e,{tagName:n,allowedTags:Ae}),Ce&&e.hasChildNodes()&&!zt(e.firstElementChild)&&T(/<[/\w!]/g,e.innerHTML)&&T(/<[/\w!]/g,e.textContent))return St(e),!0;if(e.nodeType===ee)return St(e),!0;if(Ce&&e.nodeType===te&&T(/<[/\w]/g,e.data))return St(e),!0;if(!(Le.tagCheck instanceof Function&&Le.tagCheck(n))&&(!Ae[n]||Oe[n])){if(!Oe[n]&&Mt(n)){if(ze.tagNameCheck instanceof RegExp&&T(ze.tagNameCheck,n))return!1;if(ze.tagNameCheck instanceof Function&&ze.tagNameCheck(n))return!1}if(Ge&&!Je[n]){const t=le(e)||e.parentNode,n=ae(e)||e.childNodes;if(n&&t)for(let i=n.length-1;i>=0;--i){const o=G(n[i],!0);o.__removalCount=(e.__removalCount||0)+1,t.insertBefore(o,re(e))}}return St(e),!0}return e instanceof R&&!kt(e)?(St(e),!0):"noscript"!==n&&"noembed"!==n&&"noframes"!==n||!T(/<\/no(script|embed|frames)/i,e.innerHTML)?(Ne&&e.nodeType===Z&&(t=e.textContent,u([he,ye,be],(e=>{t=b(t,e," ")})),e.textContent!==t&&(m(i.removed,{element:e.cloneNode()}),e.textContent=t)),Ot(ge.afterSanitizeElements,e,null),!1):(St(e),!0)},Lt=function(e,t,n){if(Ye&&("id"===t||"name"===t)&&(n in o||n in bt))return!1;if(Fe&&!De[t]&&T(we,t));else if(Me&&T(xe,t));else if(Le.attributeCheck instanceof Function&&Le.attributeCheck(t,e));else if(!Re[t]||De[t]){if(!(Mt(e)&&(ze.tagNameCheck instanceof RegExp&&T(ze.tagNameCheck,e)||ze.tagNameCheck instanceof Function&&ze.tagNameCheck(e))&&(ze.attributeNameCheck instanceof RegExp&&T(ze.attributeNameCheck,t)||ze.attributeNameCheck instanceof Function&&ze.attributeNameCheck(t,e))||"is"===t&&ze.allowCustomizedBuiltInElements&&(ze.tagNameCheck instanceof RegExp&&T(ze.tagNameCheck,n)||ze.tagNameCheck instanceof Function&&ze.tagNameCheck(n))))return!1}else if(tt[t]);else if(T(Se,b(n,Te,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==w(n,"data:")||!Ze[e])if(Ie&&!T(ve,b(n,Te,"")));else if(n)return!1;return!0},Mt=function(e){return"annotation-xml"!==e&&y(e,ke)},Ft=function(e){Ot(ge.beforeSanitizeAttributes,e,null);const{attributes:t}=e;if(!t||_t(e))return;const n={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Re,forceKeepAttr:void 0};let o=t.length;for(;o--;){const r=t[o],{name:a,namespaceURI:l,value:s}=r,c=ht(a),f=s;let m="value"===a?f:x(f);if(n.attrName=c,n.attrValue=m,n.keepAttr=!0,n.forceKeepAttr=void 0,Ot(ge.uponSanitizeAttribute,e,n),m=n.attrValue,!Xe||"id"!==c&&"name"!==c||(At(a,e),m=$e+m),Ce&&T(/((--!?|])>)|<\/(style|title|textarea)/i,m)){At(a,e);continue}if("attributename"===c&&y(m,"href")){At(a,e);continue}if(n.forceKeepAttr)continue;if(!n.keepAttr){At(a,e);continue}if(!Pe&&T(/\/>/i,m)){At(a,e);continue}Ne&&u([he,ye,be],(e=>{m=b(m,e," ")}));const d=ht(e.nodeName);if(Lt(d,c,m)){if(se&&"object"==typeof Y&&"function"==typeof Y.getAttributeType)if(l);else switch(Y.getAttributeType(d,c)){case"TrustedHTML":m=se.createHTML(m);break;case"TrustedScriptURL":m=se.createScriptURL(m)}if(m!==f)try{l?e.setAttributeNS(l,a,m):e.setAttribute(a,m),_t(e)?St(e):p(i.removed)}catch(t){At(a,e)}}else At(a,e)}Ot(ge.afterSanitizeAttributes,e,null)},It=function e(t){let n=null;const i=Rt(t);for(Ot(ge.beforeSanitizeShadowDOM,t,null);n=i.nextNode();)Ot(ge.uponSanitizeShadowNode,n,null),Dt(n),Ft(n),n.content instanceof c&&e(n.content);Ot(ge.afterSanitizeShadowDOM,t,null)};return i.sanitize=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=null,o=null,r=null,l=null;if(lt=!e,lt&&(e="\x3c!--\x3e"),"string"!=typeof e&&!zt(e)){if("function"!=typeof e.toString)throw k("toString is not a function");if("string"!=typeof(e=e.toString()))throw k("dirty is not a string, aborting")}if(!i.isSupported)return e;if(Ue||xt(t),i.removed=[],"string"==typeof e&&(Ke=!1),Ke){if(e.nodeName){const t=ht(e.nodeName);if(!Ae[t]||Oe[t])throw k("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof A)n=Et("\x3c!----\x3e"),o=n.ownerDocument.importNode(e,!0),o.nodeType===Q&&"BODY"===o.nodeName||"HTML"===o.nodeName?n=o:n.appendChild(o);else{if(!We&&!Ne&&!je&&-1===e.indexOf("<"))return se&&qe?se.createHTML(e):e;if(n=Et(e),!n)return We?null:qe?ce:""}n&&Be&&St(n.firstChild);const s=Rt(Ke?e:n);for(;r=s.nextNode();)Dt(r),Ft(r),r.content instanceof c&&It(r.content);if(Ke)return e;if(We){if(He)for(l=pe.call(n.ownerDocument);n.firstChild;)l.appendChild(n.firstChild);else l=n;return(Re.shadowroot||Re.shadowrootmode)&&(l=de.call(a,l,!0)),l}let f=je?n.outerHTML:n.innerHTML;return je&&Ae["!doctype"]&&n.ownerDocument&&n.ownerDocument.doctype&&n.ownerDocument.doctype.name&&T(K,n.ownerDocument.doctype.name)&&(f="<!DOCTYPE "+n.ownerDocument.doctype.name+">\n"+f),Ne&&u([he,ye,be],(e=>{f=b(f,e," ")})),se&&qe?se.createHTML(f):f},i.setConfig=function(){xt(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),Ue=!0},i.clearConfig=function(){yt=null,Ue=!1},i.isValidAttribute=function(e,t,n){yt||xt({});const i=ht(e),o=ht(t);return Lt(i,o,n)},i.addHook=function(e,t){"function"==typeof t&&m(ge[e],t)},i.removeHook=function(e,t){if(void 0!==t){const n=f(ge[e],t);return-1===n?void 0:d(ge[e],n,1)[0]}return p(ge[e])},i.removeHooks=function(e){ge[e]=[]},i.removeAllHooks=function(){ge={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},i}();return re}()}));export{n as p}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,c as i,h as e,f as n,H as s,g as r}from"./p-23a36bb6.js";import{DateUtils as o,ApplicationContext as l,Action as a,StringUtils as u,KeyboardManager as h,DataUnit as c,ElementIDUtils as d}from"@sankhyalabs/core";import{b as f,a as v,S as m,f as p,c as b,D as y}from"./p-4f0632b4.js";import{g as w,i as g}from"./p-641ee538.js";import{F as _}from"./p-30ffb9ed.js";import"./p-5a11cf56.js";import"./p-ab574d59.js";import"./p-b853763b.js";const O=/child\[([^\]]+)\]/,C=/\$\{.+\}/;class E{constructor(){this._sheets=new Map,this._requiredFields=[],this._cleanOnCopyFields=[],this._defaultValues={}}static getDetailName(t){const i=O.exec(t);return i?i[1]:void 0}getSheet(t){return this._sheets.get(t)}getAllSheets(){return this._sheets}addSheet(t){this._sheets.set(t.name,t)}addRequiredFields(t){this._requiredFields=this._requiredFields.concat(t)}getRequiredFields(){return this._requiredFields}addCleanOnCopyFields(t){this._cleanOnCopyFields=this._cleanOnCopyFields.concat(t)}getCleanOnCopyFields(){return this._cleanOnCopyFields}addDefaultValues(t){return this._defaultValues=Object.assign(Object.assign({},this._defaultValues),t)}getDefaultValues(){const t={};return Object.entries(this._defaultValues).forEach((([i,e])=>{if("string"==typeof e){const t=C.exec(e);t&&(e=this.getDefaultVar(t[0]))}t[i]=e})),t}getDefaultVar(t){return"${data}"===t?o.getToday():"${datahora}"===t?o.getToday(!0):this._defaultVars?this._defaultVars.get(t):void 0}setDefaultVars(t){this._defaultVars=t}}const j=(t,i)=>{var e;if(i)return null===(e=i.tabs)||void 0===e?void 0:e.find((i=>i.label===t))},F=(t,i,e)=>{if("string"!=typeof t)return t;if(e){const i=j(t,e);if(i)return i}return Array.from(i.keys()).find((i=>i.label===t))||{label:t,visible:!0}};function z(t,i){var e,n;return"__main"===t[0].label&&"__main"!==i[0].label?-1:"__main"!==t[0].label&&"__main"===i[0].label?1:(null!==(e=t[0].order)&&void 0!==e?e:Number.MAX_VALUE)-(null!==(n=i[0].order)&&void 0!==n?n:Number.MAX_VALUE)}const x=t=>`child[${t.name}]`,A=t=>({name:x(t),label:t.label,fields:[]});function N(t){return"Minified Redux error #"+t+"; visit https://redux.js.org/Errors?code="+t+" for the full message or use the non-minified dev environment for full errors. "}var S="function"==typeof Symbol&&Symbol.observable||"@@observable",D=function(){return Math.random().toString(36).substring(7).split("").join(".")},M={INIT:"@@redux/INIT"+D(),REPLACE:"@@redux/REPLACE"+D(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+D()}};function R(t){if("object"!=typeof t||null===t)return!1;for(var i=t;null!==Object.getPrototypeOf(i);)i=Object.getPrototypeOf(i);return Object.getPrototypeOf(t)===i}function T(t,i,e){var n;if("function"==typeof i&&"function"==typeof e||"function"==typeof e&&"function"==typeof arguments[3])throw new Error(N(0));if("function"==typeof i&&void 0===e&&(e=i,i=void 0),void 0!==e){if("function"!=typeof e)throw new Error(N(1));return e(T)(t,i)}if("function"!=typeof t)throw new Error(N(2));var s=t,r=i,o=[],l=o,a=!1;function u(){l===o&&(l=o.slice())}function h(){if(a)throw new Error(N(3));return r}function c(t){if("function"!=typeof t)throw new Error(N(4));if(a)throw new Error(N(5));var i=!0;return u(),l.push(t),function(){if(i){if(a)throw new Error(N(6));i=!1,u();var e=l.indexOf(t);l.splice(e,1),o=null}}}function d(t){if(!R(t))throw new Error(N(7));if(void 0===t.type)throw new Error(N(8));if(a)throw new Error(N(9));try{a=!0,r=s(r,t)}finally{a=!1}for(var i=o=l,e=0;e<i.length;e++)(0,i[e])();return t}function f(t){if("function"!=typeof t)throw new Error(N(10));s=t,d({type:M.REPLACE})}function v(){var t,i=c;return(t={subscribe:function(t){if("object"!=typeof t||null===t)throw new Error(N(11));function e(){t.next&&t.next(h())}return e(),{unsubscribe:i(e)}}})[S]=function(){return this},t}return d({type:M.INIT}),(n={dispatch:d,subscribe:c,getState:h,replaceReducer:f})[S]=v,n}const P={};function I(t=P,i){switch(i.type){case K.METADATA_LOADED:return Object.assign(Object.assign({},t),{formMetadata:i.payload,currentSheet:void 0});case K.CHANGE_TAB:return Object.assign(Object.assign({},t),{currentSheet:i.payload});default:return t}}function L(t){return t.formMetadata}function V(t){const i=function(t){return t.currentSheet}(t);return i?t.formMetadata.getSheet(i):Array.from(t.formMetadata.getAllSheets().values())[0]}var K;!function(t){t.METADATA_LOADED="FORM/METADATA_LOADED",t.CHANGE_TAB="FORM/CHANGE_TAB"}(K||(K={}));const $=class{constructor(e){t(this,e),this.ezFormRequestClearFieldToFocus=i(this,"ezFormRequestClearFieldToFocus",7),this.ezFormSetFields=i(this,"ezFormSetFields",7),this.ezReady=i(this,"ezReady",7),this.formItemsReady=i(this,"formItemsReady",7),this._customEditors=new Map,this._application=l.getContextValue("__SNK__APPLICATION__"),this.onDataUnitAction=t=>{t.type===a.METADATA_LOADED&&this.processMetadata()},this._fieldsProps=new Map,this._singleColumn=!1,this.dataUnit=void 0,this.config=void 0,this.recordsValidator=void 0,this.fieldToFocus=void 0,this.onlyStaticFields=!1,this.useSearchField=!0,this.elementFocusSearchField=void 0}validate(){return this._dataBinder.validate()}async addCustomEditor(t,i,e){if(this._formView)return void this._formView.addCustomEditor(t,i,e);const n=new Map(this._customEditors);n.set(t,{customEditor:i,detailContext:e}),this._customEditors=n}observeConfig(){this.processMetadata()}async setFieldProp(t,i,e){const n=new Map(this._fieldsProps),s=this._fieldsProps.get(t);n.set(t,Object.assign(Object.assign({},s),{[i]:e})),this._fieldsProps=n}getDynamicContent(){var t;const i=L(this._store.getState());if(!i)return null;const n=Array.from(i.getAllSheets().values()),s=V(null===(t=this._store)||void 0===t?void 0:t.getState());let r=[];if(n.length>1){const t=n.map(((t,i)=>({tabKey:t.name,label:t.label,index:i}))),i="selector";r.push(e("ez-tabselector",{tabs:this.buildIdTabSelector(t),onEzChange:t=>this._store.dispatch(function(t){return{type:K.CHANGE_TAB,payload:"string"==typeof t?t:t.tabKey}}(t.detail)),selectedTab:s.name,"data-element-id":i}))}return r=r.concat(this.buildFormContent(s)),r}buildFormContent(t){const i=null==t?void 0:t.fields;if(null==t)return;this.ezFormSetFields.emit(i);const n=`${u.replaceAccentuatedChars(u.toCamelCase(null==t?void 0:t.label),!1)}_selectorContainer`;return e("div",{class:"dynamic-content ez-box--no-outline","data-element-id":n,ref:t=>this._container=t,tabindex:"0"},e("ez-popover",{ref:t=>this._ezPopoverSearchField=t,overlayType:"none"},this.renderFieldColumn()),e("ez-form-view",{ref:t=>this._formView=t,class:"ez-row ez-padding-vertical--small",fields:i,singleColumn:this._singleColumn,selectedRecord:this.dataUnit.getSelectedRecord()}))}renderFieldColumn(){return null!=this._fieldSearch||(this._fieldSearch=v({value:u.generateUUID(),label:this._i18n("ez-form.labelSearchField")},(({argument:t})=>this.fieldsOptionLoader(t)),(t=>this.onSelectField(t)))),this._fieldSearch}getFormFields(){var t;return null===(t=this.config)||void 0===t?void 0:t.fields}fieldsOptionLoader(t){const i=null==t?void 0:t.toLowerCase(),e=this.getFormFields().map((t=>{var i;return null===(i=this.dataUnit)||void 0===i?void 0:i.getField(t.name)})).filter((t=>{var e,n;return(null===(e=t.name)||void 0===e?void 0:e.toLowerCase().includes(i))||(null===(n=t.label)||void 0===n?void 0:n.toLowerCase().includes(i))})).map((t=>({value:t.name,label:t.label})));return Promise.resolve(e)}onSelectField(t){null!=t&&null!=t.value?(this.fieldToFocus=t.value,this._ezPopoverSearchField.hide()):this.fieldToFocus=""}async initKeyboardManager(){var t,i;this._keyboardManager=new h({propagate:!1,element:null!==(t=this.elementFocusSearchField)&&void 0!==t?t:this._element}),this.useSearchField&&this._keyboardManager.bind(m,(async()=>{if(!this._container||!this._ezPopoverSearchField)return;const t=this._container.getBoundingClientRect();await p(this._fieldSearch),this._ezPopoverSearchField.showUnder(this._container,{horizontalGap:t.width-b,verticalGap:-1*t.height})}),{description:this._i18n("ez-form.labelSearchField"),element:null!==(i=this.elementFocusSearchField)&&void 0!==i?i:this._element})}componentDidLoad(){this.initKeyboardManager()}processMetadata(){if(this.bindFields()&&this.dataUnit&&this._store){const t=((t,i,e=!1,n)=>{var s;null!=t&&!0!==(null==t?void 0:t.emptyConfig)||(t=(t=>{const i=t.metadata;let e;return i&&(e=i.fields.filter((t=>!1!==t.visible)).map((t=>({name:t.name,defaultValue:t.defaultValue})))),{emptyConfig:!1,fields:e}})(i));const r=new Map,o=new Map,l=[],a=[],u={};(null!==(s=null==t?void 0:t.tabs)&&void 0!==s?s:[]).forEach((t=>{o.has(t.label)||!1!==t.visible||o.set(t.label,t)})),function(t,i,e,n,s,r,o){var l;null===(l=null==t?void 0:t.fields)||void 0===l||l.forEach((l=>{var a,u,h;if(!1!==l.visible){const c=F(l.tab||"__main",i,t);if(e.has(c.label))return;const d=n.getField(l.name);if(d&&(null==(null==d?void 0:d.visible)||!0===(null==d?void 0:d.visible))&&c.visible){i.has(c)||i.set(c,[]);const t=f(d,l);i.get(c).push(t),t.required&&s.push(l.name),((null==l.cleanOnCopy?null===(a=d.properties)||void 0===a?void 0:a.cleanOnCopy:l.cleanOnCopy)||(null===(u=d.properties)||void 0===u?void 0:u.cleanOnCopy))&&r.push(l.name);let e=null==l.defaultValue?null===(h=d.properties)||void 0===h?void 0:h.defaultValue:l.defaultValue;if(e&&null!=e.value){const{type:t,value:i}=e;if(t)if("V"===t)e=i;else try{const t=JSON.parse(i);e=t&&"value"in t?t:i}catch(t){}o[l.name]=e}}}}))}(t,r,o,i,l,a,u);const h=new E;return h.setDefaultVars(t.defaultVars),e&&function(t,i,e){const n=t.metadata;void 0!==n&&void 0!==n.children&&n.children.forEach((t=>{const n=j(t.label,i);if(n)return void e.set(Object.assign(n,{name:x(t),isDetail:!0}),[]);const{label:s,name:r,fields:o}=A(t);e.set({name:r,label:s,isDetail:!0},o)}))}(i,t,r),n&&function(t,i,e){t.forEach((t=>{const n=j(t.label,i),s={};Object.entries(t).forEach((([t,i])=>{(function(t){return["id","label"].includes(t)})(t)||(s[t]=i)})),e.set(n?Object.assign(n,{name:t.id,isCustom:!0,ctxProps:s}):{label:t.label,name:t.id,isCustom:!0,visible:!0,ctxProps:s},[])}))}(n,t,r),Array.from(r.entries()).sort(z).forEach((([t,i])=>{o.has(t.label)||h.addSheet(function(t,i){const e=w();return{label:"__main"===t.label?e("ez-form.mainTab"):t.label,name:t.name||t.label,isCustom:t.isCustom,isDetail:t.isDetail,ctxProps:t.ctxProps,fields:i}}(t,i))})),h.addRequiredFields(l),h.addCleanOnCopyFields(a),h.addDefaultValues(u),h})(this.config,this.dataUnit);this._store.dispatch({type:K.METADATA_LOADED,payload:t})}}isStatic(){var t;return(null===(t=this._staticFields)||void 0===t?void 0:t.length)>0}bindFields(){return!this.isStatic()||!1===this.onlyStaticFields}async componentWillLoad(){var t;void 0===this.dataUnit&&(this.dataUnit=new c("ez-form")),this.dataUnit.unsubscribe(this.onDataUnitAction),this.dataUnit.subscribe(this.onDataUnitAction),this._dataBinder=new y(this.dataUnit),this._store=T(I),this._store.subscribe((()=>n(this))),this._staticFields=Array.from(this._element.querySelectorAll("[data-field-name]")),this.processMetadata(),d.addIDInfo(this._element,null,{dataUnit:this.dataUnit});const i=await(null===(t=this._application)||void 0===t?void 0:t.getLayoutFormConfig());this.setSingleColumn(i),this.registerNotifyListeners(i),this._i18n=await g()}async setSingleColumn(t){this._singleColumn=(null==t?void 0:t.config)===_.CASCADE}async registerNotifyListeners(t){t&&t.onConfigChange((t=>{this._singleColumn=t===_.CASCADE}))}componentDidRender(){const t=L(this._store.getState());t.addRequiredFields(this._staticFields.filter((t=>t.dataset.required)).map((t=>t.dataset.fieldName))),this._dataBinder.bind(Array.from(this._element.querySelectorAll("[data-field-name]")),this.dataUnit.dataUnitId,t,this.recordsValidator),this.ezReady.emit(),this.handleFieldToFocus(),this.setCustomEditors(),this.setFieldsProps()}setCustomEditors(){if(this._formView)for(const[t,i]of this._customEditors)this._formView.addCustomEditor(t,i.customEditor,i.detailContext),this._customEditors.delete(t)}handleFieldToFocus(){var t;if(null==this.fieldToFocus)return;const i=V(null===(t=this._store)||void 0===t?void 0:t.getState());(null==i?void 0:i.fields).some((t=>t.name===this.fieldToFocus))&&requestAnimationFrame((()=>{this._dataBinder.setFocus(this.fieldToFocus),this.ezFormRequestClearFieldToFocus.emit(),this.fieldToFocus=null}))}setFieldsProps(){if(this._formView)for(const[t,i]of this._fieldsProps){for(const e in i)this._formView.setFieldProp(t,e,i[e]);this._fieldsProps.delete(t)}}disconnectedCallback(){var t;this.dataUnit.unsubscribe(this.onDataUnitAction),this._dataBinder.onDisconnectedCallback(),null===(t=this._keyboardManager)||void 0===t||t.unbindAllShortcutKeys()}buildIdTabSelector(t){return t&&t.forEach((t=>t[d.DATA_ELEMENT_ID_ATTRIBUTE_NAME]=u.toCamelCase(t.label))),t}render(){return e(s,null,this.isStatic()?null:this.getDynamicContent())}get _element(){return r(this)}static get watchers(){return{config:["observeConfig"]}}};$.style=".sc-ez-form-h{display:flex;flex-direction:column;width:100%}.dynamic-content.sc-ez-form ez-collapsible-box.sc-ez-form{--ez-collapsible-box__header--padding-right:var(--space-small, 6px);--ez-collapsible-box__header--padding-left:var(--space-small, 6px)}";export{$ as ez_form}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,h as i,H as e,c as s,g as o}from"./p-23a36bb6.js";import{ElementIDUtils as a,ObjectUtils as r,HTMLBuilder as h,StringUtils as l,KeyboardManager as n}from"@sankhyalabs/core";import{i as c}from"./p-641ee538.js";import{C as d}from"./p-30ffb9ed.js";import{R as b,a as m}from"./p-3e767a74.js";import{p as u}from"./p-228a4d2f.js";import{A as v}from"./p-5a11cf56.js";import"./p-ab574d59.js";import"./p-b853763b.js";import"./p-112455b1.js";const p=class{constructor(i){t(this,i),this.showLoading=void 0,this.visibleOptions=void 0,this.textEmptyList=void 0,this.showOptionValue=void 0,this.preSelection=void 0,this.maxWidth=void 0,this.width=void 0,this.onOptionSelect=void 0,this.onOptionHover=void 0}async nextOption(){var t,i;(null===(t=this.visibleOptions)||void 0===t?void 0:t.length)&&(void 0!==this.preSelection&&this.preSelection>=this.visibleOptions.length-1||(this.preSelection=void 0===this.preSelection?0:this.preSelection+1,this.scrollToOption(this.visibleOptions[this.preSelection]),null===(i=this.onOptionHover)||void 0===i||i.call(this,this.preSelection)))}async previousOption(){var t,i;(null===(t=this.visibleOptions)||void 0===t?void 0:t.length)&&(void 0!==this.preSelection&&this.preSelection<=0||(this.preSelection=void 0===this.preSelection?this.visibleOptions.length-1:this.preSelection-1,this.scrollToOption(this.visibleOptions[this.preSelection]),null===(i=this.onOptionHover)||void 0===i||i.call(this,this.preSelection)))}async selectCurrentOption(){void 0!==this.preSelection&&(this.onOptionSelect(this.visibleOptions[this.preSelection]),this.preSelection=void 0)}observeWidth(t,i){t!==i&&this._listWrapper&&(this._listWrapper.style.width=`${this.width}px`)}observeMaxWidth(t,i){t!==i&&this._listWrapper&&(this._listWrapper.style.maxWidth=this.maxWidth?`${this.maxWidth}px`:"")}handleKeyDown(t){switch(t.key){case"ArrowDown":t.preventDefault(),t.stopPropagation(),this.nextOption();break;case"ArrowUp":t.preventDefault(),t.stopPropagation(),this.previousOption();break;case"Enter":this.selectCurrentOption();break;case"Escape":this.preSelection=void 0}}buildItem(t,e){const s=this.showOptionValue&&this.maxWidth>0?`${this.maxWidth}px`:"";return t.label=t.label||t.value,i("li",{tabIndex:1,class:e===this.preSelection?"item preselected":"item",id:`item_${t.value}_${e}`,key:`item_${t.value}_${e}`,onMouseDown:()=>this.onOptionSelect(t),onMouseOver:()=>this.preSelection=e},this.showOptionValue?i("span",{class:"item__value",title:t.value,style:{width:s,minWidth:s,maxWidth:s}},t.value):void 0,i("span",{class:"item__label "+(this.showOptionValue?"item__label--bold":""),title:t.label},t.label))}scrollToOption(t){if(!(null==t?void 0:t.value)||!this._optionsList)return;const i=this.visibleOptions.indexOf(t);if(-1===i)return;const e=this._optionsList.querySelector(`li#item_${CSS.escape(t.value)}_${CSS.escape(String(i))}`);e&&e.scrollIntoView({behavior:"smooth",block:"nearest"})}async componentWillLoad(){this.i18n=await c()}componentDidLoad(){this._listWrapper.style.width=`${this.width}px`,this._listWrapper.style.maxWidth=this.maxWidth?`${this.maxWidth}px`:""}componentDidRender(){var t;null===(t=this._optionsList)||void 0===t||t.querySelectorAll(".item").forEach((t=>{a.addIDInfoIfNotExists(t,"itemComboBox")}))}render(){return i("section",{class:"list-container"},i("div",{class:"list-wrapper",ref:t=>this._listWrapper=t},i("ul",{class:"list-options",ref:t=>this._optionsList=t},!this.showLoading&&0===this.visibleOptions.length&&i("div",{class:"message"},i("span",{class:"message__no-result"},this.textEmptyList||this.i18n("ez-combo-box.noResults"))),this.showLoading&&i("div",{class:"message"},i("div",{class:"message__loading"})),this.showOptionValue&&i("span",{class:"item__value item__value--hidden"}),!this.showLoading&&this.visibleOptions.length>0&&this.visibleOptions.map(((t,i)=>this.buildItem(t,i))))))}static get watchers(){return{width:["observeWidth"],maxWidth:["observeMaxWidth"]}}};p.style=":host{--ez-combo-box--border-radius:var(--border--radius-medium, 12px);--ez-combo-box--font-size:var(--text--medium, 14px);--ez-combo-box--font-family:var(--font-pattern, Arial);--ez-combo-box--font-weight--large:var(--text-weight--large, 500);--ez-combo-box--font-weight--medium:var(--text-weight--medium, 400);--ez-combo-box--background-color--xlight:var(--background--xlight, #fff);--ez-combo-box--background-medium:var(--background--medium, #f0f3f7);--ez-combo-box--line-height:calc(var(--text--medium, 14px) + 4px);--ez-combo-box__list-title--primary:var(--title--primary, #2B3A54);--ez-combo-box__list-text--primary:var(--text--primary, #626e82);--ez-combo-box__list-height:calc(var(--ez-combo-box--font-size) + var(--ez-combo-box--space--medium) + 4px);--ez-combo-box--space--medium:var(--space--medium, 12px);--ez-combo-box--space--small:var(--space--small, 6px);--ez-combo-box__scrollbar--color-default:var(--scrollbar--default, #626e82);--ez-combo-box__scrollbar--color-background:var(--scrollbar--background, #E5EAF0);--ez-combo-box__scrollbar--color-hover:var(--scrollbar--hover, #2B3A54);--ez-combo-box__scrollbar--color-clicked:var(--scrollbar--clicked, #a2abb9);--ez-combo-box__scrollbar--border-radius:var(--border--radius-small, 6px);--ez-combo-box__scrollbar--width:var(--space--medium, 12px);--ez-combo-box__list-container--padding:var(--space--extra-small, 3px)}.list-container{padding-top:var(--ez-combo-box__list-container--padding)}.list-wrapper{display:flex;flex-direction:column;box-sizing:border-box;width:0;z-index:var(--more-visible, 2);max-height:calc(4*var(--ez-combo-box__list-height) + 2*var(--ez-combo-box--space--small) + 9px);background-color:var(--ez-combo-box--background-color--xlight);border-radius:var(--ez-combo-box--border-radius);box-shadow:var(--shadow--medium, 0 8px 24px 0 rgba(43, 58, 84, 0.10));padding:var(--ez-combo-box--space--small)}.list-options{box-sizing:border-box;width:100%;height:100%;padding:0;margin:0;display:flex;flex-direction:column;scroll-behavior:smooth;overflow:auto;scrollbar-width:thin;gap:3px;scrollbar-color:var(--ez-combo-box__scrollbar--color-clicked) var(--ez-combo-box__scrollbar--color-background)}.list-options::-webkit-scrollbar{background-color:var(--ez-combo-box__scrollbar--color-background);width:var(--ez-combo-box__scrollbar--width);max-width:var(--ez-combo-box__scrollbar--width);min-width:var(--ez-combo-box__scrollbar--width)}.list-options::-webkit-scrollbar-track{background-color:var(--ez-combo-box__scrollbar--color-background);border-radius:var(--ez-combo-box__scrollbar--border-radius)}.list-options::-webkit-scrollbar-thumb{background-color:var(--ez-combo-box__scrollbar--color-default);border-radius:var(--ez-combo-box__scrollbar--border-radius)}.list-options::-webkit-scrollbar-thumb:vertical:hover,.list-options::-webkit-scrollbar-thumb:horizontal:hover{background-color:var(--ez-combo-box__scrollbar--color-hover)}.list-options::-webkit-scrollbar-thumb:vertical:active,.list-options::-webkit-scrollbar-thumb:horizontal:active{background-color:var(--ez-combo-box__scrollbar--color-clicked)}.item{display:flex;align-items:center;width:100%;box-sizing:border-box;list-style-type:none;cursor:pointer;border-radius:var(--ez-combo-box--border-radius-small);padding:var(--ez-combo-box--space--small);min-height:var(--ez-combo-box__list-height);gap:var(--space--small, 6px)}.item__value,.item__label{flex-basis:auto;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--ez-combo-box__list-title--primary);font-family:var(--ez-combo-box--font-family);font-size:var(--ez-combo-box--font-size);line-height:var(--ez-combo-box--line-height)}.item__label{font-weight:var(--ez-combo-box--font-weight--medium)}.item__label--bold{font-weight:var(--ez-combo-box--font-weight--large)}.item__value{text-align:center;color:var(--ez-combo-box__list-text--primary);font-weight:var(--ez-combo-box--font-weight--large)}.item__value--hidden{visibility:hidden;position:absolute;white-space:nowrap;z-index:-1;top:0;left:0}.item__label{text-align:left}.message{text-align:center;display:flex;justify-content:center;align-items:center;list-style-type:none;min-height:var(--ez-combo-box__list-height)}.message__no-result{color:var(--ez-combo-box__list-title--primary);font-family:var(--ez-combo-box--font-family);font-size:var(--ez-combo-box--font-size)}.message__loading{border-radius:50%;width:14px;height:14px;-webkit-animation:spin 1s linear infinite;animation:spin 1s linear infinite;border:3px solid var(--ez-combo-box__list-title--primary);border-top:3px solid transparent}li:hover{background-color:var(--ez-combo-box--background-medium)}.preselected{background-color:var(--background--medium)}@-webkit-keyframes spin{0%{-webkit-transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg)}}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}";const x=class{constructor(i){t(this,i),this.gui=void 0,this.customEditor=void 0,this.formViewField=void 0,this.value=void 0,this.detailContext=void 0,this.builderFallback=void 0,this.selectedRecord=void 0}async setFocus(){var t,i;null===(i=null===(t=this.gui)||void 0===t?void 0:t.setFocus)||void 0===i||i.call(t)}async setBlur(){var t,i;null===(i=null===(t=this.gui)||void 0===t?void 0:t.setBlur)||void 0===i||i.call(t)}async isInvalid(){var t,i;return(null===(i=null===(t=this.gui)||void 0===t?void 0:t.isInvalid)||void 0===i?void 0:i.call(t))||!1}watchValue(){this.handleValue(this.gui)}watchCustomEditor(){this.getContent()}watchFormViewField(t,i){r.equals(t,i)||this.getContent()}watchDetailContext(){this.getContent()}watchBuilderFallback(){this.getContent()}watchSelectedRecord(t,i){(null==t?void 0:t.__record__id__)!==(null==i?void 0:i.__record__id__)&&this.getContent()}getContent(){var t,e,s,o,a;const r=new Map;for(const t in this.formViewField.props)r.set(t,this.formViewField.props[t]);const n={value:this.value,name:this.formViewField.name,currentEditor:this.builderFallback(this.formViewField),setValue:t=>this.setValue(t),getValue:this.getValue,record:this.selectedRecord,editorMetadata:{label:this.formViewField.label,hidden:!1===(null===(t=this.formViewField.props)||void 0===t?void 0:t.visible),userInterface:this.formViewField.userInterface,options:null===(e=this.formViewField.props)||void 0===e?void 0:e.options,props:this.formViewField.props?r:void 0,optionLoader:this.formViewField.optionLoader},source:d.FORM,detailContext:this.detailContext};let c=this.customEditor.getEditorElement(n);if(!c)return c=this.builderFallback(this.formViewField),this.handleValue(c),void(this.gui=c);if(!(c instanceof HTMLElement)&&"string"!=typeof c)return this.handleValue(c),void(this.gui=c);"string"==typeof c&&(c=h.parseElement(c));const b=null!==(a=null!==(o=null===(s=this.value)||void 0===s?void 0:s.value)&&void 0!==o?o:this.value)&&void 0!==a?a:"";c.setAttribute("value",b),this.gui=i("div",{key:l.generateUUID(),ref:t=>t&&t.appendChild(c)})}setValue(t){this.value=t}getValue(){return this.value}handleValue(t){var i;null===(i=t.t)||void 0===i||i.forEach((t=>{t.i.value=this.value}))}componentWillLoad(){this.getContent()}render(){return i(e,null,this.gui)}static get watchers(){return{value:["watchValue"],customEditor:["watchCustomEditor"],formViewField:["watchFormViewField"],detailContext:["watchDetailContext"],builderFallback:["watchBuilderFallback"],selectedRecord:["watchSelectedRecord"]}}},w=class{constructor(i){t(this,i),this.ezChange=s(this,"ezChange",7),this.historyStack=[],this.historyIndex=-1,this.previewMode=!1,this.showPreview=!0,this.value="",this.label=void 0,this.mode="regular",this.enabled=!0,this.rows=6,this.errorMessage=void 0,this.canShowError=!0,this.showConfigs=!0,this.showTextFormat=!0,this.showUndoRedo=!0}observeValue(t,i){r.equals(t,i)||this.ezChange.emit(t)}observeErrorMessage(t){t&&this.previewMode&&(this.previewMode=!1)}async handleExecuteToolbarCommand(t){const{command:i,value:e}=t.detail;await this.executeCommand(i,e)}async setFocus(){this.handleFocus()}async setBlur(){var t;await(null===(t=this.textAreaRef)||void 0===t?void 0:t.setBlur())}async isInvalid(){return"string"==typeof this.errorMessage&&""!==this.errorMessage.trim()}bindPreview(){this._keyboardManager&&this.showPreview&&this._keyboardManager.bind("ctrl + p",(async()=>{await this.togglePreview()}),{description:"Entra em modo de pré visualização.",element:this.element})}bindConfigs(){this._keyboardManager&&this.showConfigs&&this._keyboardManager.bind("ctrl + l",(async()=>{await this.handleFormatSelection(b.LIST)}),{description:this.i18n("ez-rich-text.listShortcut"),element:this.element}).bind("ctrl + k",(async()=>{await this.handleLink()}),{description:this.i18n("ez-rich-text.linkShortcut"),element:this.element}).bind("ctrl + o",(async()=>{await this.handleImage()}),{description:this.i18n("ez-rich-text.imageShortcut"),element:this.element})}bindTextFormat(){this._keyboardManager&&this.showTextFormat&&this._keyboardManager.bind("ctrl + b",(async()=>{await this.handleFormatSelection(b.BOLD)}),{description:this.i18n("ez-rich-text.boldShortcut"),element:this.element}).bind("ctrl + i",(async()=>{await this.handleFormatSelection(b.ITALIC)}),{description:this.i18n("ez-rich-text.italicShortcut"),element:this.element}).bind("ctrl + u",(async()=>{await this.handleFormatSelection(b.UNDERLINE)}),{description:this.i18n("ez-rich-text.underlineShortcut"),element:this.element})}initKeyboardManager(){this._keyboardManager=new n({propagate:!1,element:this.element}),this._keyboardManager.bind("ctrl + Enter",(async()=>{await this.handleFormatSelection(b.BREAK_LINE)}),{description:this.i18n("ez-rich-text.breakLineShortcut"),element:this.element}).bind("ctrl + z",(async()=>{await this.handleUndo()}),{description:this.i18n("ez-rich-text.undoShortcut"),element:this.element}).bind("ctrl + x",(async()=>{await this.handleRedo()}),{description:this.i18n("ez-rich-text.redoShortcut"),element:this.element}),this.bindPreview(),this.bindConfigs(),this.bindTextFormat()}async executeCommand(t,i){switch(t){case m.FOCUS:this.handleFocus();break;case m.PREVIEW:await this.togglePreview();break;case m.FORMAT:await this.handleFormatSelection(i);break;case m.UNDO:await this.handleUndo();break;case m.REDO:await this.handleRedo();break;case m.LINK:await this.handleLink();break;case m.IMAGE:await this.handleImage()}}handleFocus(){this.previewMode=!1,requestAnimationFrame((async()=>{await this.textAreaRef.setFocus()}))}async handleLink(){this.previewMode=!1,requestAnimationFrame((async()=>{await this.linkBuilderRef.show(this.getSelectedText())}))}async handleImage(){this.previewMode=!1,await this.imageUploaderRef.show()}async handleRedo(){this.previewMode=!1,requestAnimationFrame((async()=>{this.redo(),await this.textAreaRef.setFocus()}))}async handleUndo(){this.previewMode=!1,requestAnimationFrame((async()=>{this.undo(),await this.textAreaRef.setFocus()}))}async handleFormatSelection(t){t&&(this.previewMode=!1,requestAnimationFrame((async()=>{await this.formatSelection(t),await this.textAreaRef.setFocus()})))}async togglePreview(){this.previewMode=!this.previewMode,this.previewMode&&await this.textAreaRef.setFocus()}getSelectedText(){const t=this.getTextAreaElement();if(t)return(this.textAreaRef.value||"").substring(t.selectionStart,t.selectionEnd)}getTextAreaElement(){return this.element.querySelector("ez-text-area").shadowRoot.querySelector("textarea")}async formatSelection(t){if(!this.textAreaRef)return;const i=t.replace("$selection",this.getSelectedText()||"");await this.textAreaRef.appendTextToSelection(i),this.value=this.textAreaRef.value,this.addToHistory(this.value)}addToHistory(t){this.historyIndex>=0&&t===this.historyStack[this.historyIndex]||(this.historyStack.length>=50&&this.historyStack.splice(0,this.historyStack.length-49),this.historyStack.push(t),this.historyIndex=this.historyStack.length-1)}undo(){if(!this.canExecuteUndo())return;this.historyIndex--;const t=this.historyStack[this.historyIndex];this.value=t,this.textAreaRef.value=t}canExecuteUndo(){return this.historyIndex>0}redo(){this.canExecuteRedo()&&(this.historyIndex++,this.getValueFromHistory())}canExecuteRedo(){return this.historyIndex<this.historyStack.length-1}getValueFromHistory(){const t=this.historyStack[this.historyIndex];this.value=t,this.textAreaRef.value=t}handleTextAreaChanged(t){this.value=t.detail,this.addToHistory(this.value)}async removeShortcuts(){var t;null===(t=this._keyboardManager)||void 0===t||t.unbindAllShortcutKeys()}async componentWillLoad(){this.i18n=await c()}componentDidLoad(){this.initKeyboardManager(),this.addToHistory(this.value)}async disconnectedCallback(){await this.removeShortcuts()}getSanitizedValue(){return u.sanitize(this.value,{ADD_ATTR:["target","rel"]})}renderContent(){return this.previewMode?i("div",{id:"rich-text-preview-container",class:"preview",innerHTML:this.getSanitizedValue()}):i("ez-text-area",{ref:t=>this.textAreaRef=t,label:this.label,value:this.value,enabled:this.enabled,rows:this.rows,mode:this.mode,canShowError:this.canShowError,errorMessage:this.errorMessage,onEzChange:this.handleTextAreaChanged.bind(this)})}render(){return i(e,null,i("div",{class:"editor-container bordered"},i("ez-rich-toolbar",{isPreviewMode:this.previewMode,showPreview:this.showPreview,showConfigs:this.showConfigs&&this.enabled,showTextFormat:this.showTextFormat&&this.enabled,showUndoRedo:this.showUndoRedo&&this.enabled}),this.renderContent()),i("ez-link-builder",{ref:t=>this.linkBuilderRef=t}),i("ez-simple-image-uploader",{ref:t=>this.imageUploaderRef=t}))}get element(){return o(this)}static get watchers(){return{value:["observeValue"],errorMessage:["observeErrorMessage"]}}};w.style=".sc-ez-rich-text-h{display:block;width:100%;font-family:Roboto;--ez-rich-text--box-shadow:0 0 3px 0 #DCE0E8;--ez-rich-text--shadow--outline:var(--shadow--outline) var(--color--strokes)}.editor-container.sc-ez-rich-text{width:100%;overflow:hidden;border-radius:12px;border:1px solid #DCE0E8}ez-text-area.sc-ez-rich-text{--text-area__input--border:1px solid}.preview.sc-ez-rich-text{min-height:20px;padding:12px;resize:both;overflow:auto;max-width:100%;border-top:1px solid #DCE0E8}";const _=class{constructor(i){t(this,i),this.saveEdition=s(this,"saveEdition",7),this.cancelEdition=s(this,"cancelEdition",7),this._newValue=void 0,this.value=void 0,this.styled=void 0}async applyFocusSelect(){this.calcSizeInput(this.value,!0)}calcSizeInput(t,i=!1){var e,s;const o=null===(s=null===(e=this._inputElement)||void 0===e?void 0:e.shadowRoot)||void 0===s?void 0:s.querySelector("input");if(null!=o){const e=this.getWidthValue(t);o.style.width=e+"px",i&&setTimeout((()=>o.select()),100)}}getWidthValue(t){if(null!=this._valueBasis){const i=this._valueBasis;if(null!=t){const e=2;return i.innerHTML=t,i.clientWidth>0?i.clientWidth+e:e}i.innerHTML=""}return 0}setStyledInput(){var t,i;let e="",s="",o="";null!=this.styled&&(e=this.styled.fontSize,s=this.styled.fontWeight,o=this.styled.fontFamily);const a=null===(i=null===(t=this._inputElement)||void 0===t?void 0:t.shadowRoot)||void 0===i?void 0:i.querySelector("input");null!=a&&(a.style.fontSize=e,a.style.fontWeight=s,a.style.fontFamily=o);const r=this._valueBasis;null!=r&&(r.style.fontSize=e,r.style.fontWeight=s,r.style.fontFamily=o)}handleSaveEdition(){this._newValue?this.saveEdition.emit({value:this.value,newValue:this._newValue}):v.alert(this.i18n("app.warning"),this.i18n("ez-text-edit.emptyFieldWarning")).then((()=>{this.setNewValue(this.value,!0)}))}handleCancelEdition(){this.cancelEdition.emit()}setNewValue(t,i=!1){this._newValue=t,this.calcSizeInput(this._newValue,i)}async componentWillLoad(){this.i18n=await c()}componentDidLoad(){this.applyFocusSelect(),this.setNewValue(this.value)}componentDidRender(){this.setStyledInput()}render(){return a.addIDInfoIfNotExists(this._element,"input"),i(e,null,i("span",{class:"text-edit__hidden-value",ref:t=>this._valueBasis=t}),i("ez-text-input",{"data-element-id":a.getInternalIDInfo("textInput"),onInput:()=>{this.calcSizeInput(this._newValue)},class:"text-edit__form-input",value:this._newValue,ref:t=>this._inputElement=t,mode:"slim",onEzChange:t=>this.setNewValue(null==t?void 0:t.detail),noBorder:!0}),i("ez-button",{class:"text-edit__icon-check",mode:"icon",iconName:"check",size:"small",onClick:()=>{this.handleSaveEdition()}}),i("ez-button",{class:"text-edit__icon-close",mode:"icon",iconName:"close",size:"small",onClick:()=>{this.handleCancelEdition()}}))}get _element(){return o(this)}};_.style=":host{display:flex;align-items:center;gap:5px}.text-edit__form-input{width:auto;--ez-text-input__input--padding:0px}.text-edit__hidden-value{visibility:hidden;position:absolute;white-space:nowrap;z-index:-1;top:0;left:0}";export{p as ez_combo_box_list,x as ez_custom_form_input,w as ez_rich_text,_ as ez_text_edit}
|
|
1
|
+
import{r as t,h as i,H as e,c as s,g as o}from"./p-23a36bb6.js";import{ElementIDUtils as a,ObjectUtils as r,HTMLBuilder as h,StringUtils as l,KeyboardManager as n}from"@sankhyalabs/core";import{i as c}from"./p-641ee538.js";import{C as d}from"./p-30ffb9ed.js";import{R as b,a as m}from"./p-3e767a74.js";import{p as u}from"./p-bb409cba.js";import{A as v}from"./p-5a11cf56.js";import"./p-ab574d59.js";import"./p-b853763b.js";import"./p-112455b1.js";const p=class{constructor(i){t(this,i),this.showLoading=void 0,this.visibleOptions=void 0,this.textEmptyList=void 0,this.showOptionValue=void 0,this.preSelection=void 0,this.maxWidth=void 0,this.width=void 0,this.onOptionSelect=void 0,this.onOptionHover=void 0}async nextOption(){var t,i;(null===(t=this.visibleOptions)||void 0===t?void 0:t.length)&&(void 0!==this.preSelection&&this.preSelection>=this.visibleOptions.length-1||(this.preSelection=void 0===this.preSelection?0:this.preSelection+1,this.scrollToOption(this.visibleOptions[this.preSelection]),null===(i=this.onOptionHover)||void 0===i||i.call(this,this.preSelection)))}async previousOption(){var t,i;(null===(t=this.visibleOptions)||void 0===t?void 0:t.length)&&(void 0!==this.preSelection&&this.preSelection<=0||(this.preSelection=void 0===this.preSelection?this.visibleOptions.length-1:this.preSelection-1,this.scrollToOption(this.visibleOptions[this.preSelection]),null===(i=this.onOptionHover)||void 0===i||i.call(this,this.preSelection)))}async selectCurrentOption(){void 0!==this.preSelection&&(this.onOptionSelect(this.visibleOptions[this.preSelection]),this.preSelection=void 0)}observeWidth(t,i){t!==i&&this._listWrapper&&(this._listWrapper.style.width=`${this.width}px`)}observeMaxWidth(t,i){t!==i&&this._listWrapper&&(this._listWrapper.style.maxWidth=this.maxWidth?`${this.maxWidth}px`:"")}handleKeyDown(t){switch(t.key){case"ArrowDown":t.preventDefault(),t.stopPropagation(),this.nextOption();break;case"ArrowUp":t.preventDefault(),t.stopPropagation(),this.previousOption();break;case"Enter":this.selectCurrentOption();break;case"Escape":this.preSelection=void 0}}buildItem(t,e){const s=this.showOptionValue&&this.maxWidth>0?`${this.maxWidth}px`:"";return t.label=t.label||t.value,i("li",{tabIndex:1,class:e===this.preSelection?"item preselected":"item",id:`item_${t.value}_${e}`,key:`item_${t.value}_${e}`,onMouseDown:()=>this.onOptionSelect(t),onMouseOver:()=>this.preSelection=e},this.showOptionValue?i("span",{class:"item__value",title:t.value,style:{width:s,minWidth:s,maxWidth:s}},t.value):void 0,i("span",{class:"item__label "+(this.showOptionValue?"item__label--bold":""),title:t.label},t.label))}scrollToOption(t){if(!(null==t?void 0:t.value)||!this._optionsList)return;const i=this.visibleOptions.indexOf(t);if(-1===i)return;const e=this._optionsList.querySelector(`li#item_${CSS.escape(t.value)}_${CSS.escape(String(i))}`);e&&e.scrollIntoView({behavior:"smooth",block:"nearest"})}async componentWillLoad(){this.i18n=await c()}componentDidLoad(){this._listWrapper.style.width=`${this.width}px`,this._listWrapper.style.maxWidth=this.maxWidth?`${this.maxWidth}px`:""}componentDidRender(){var t;null===(t=this._optionsList)||void 0===t||t.querySelectorAll(".item").forEach((t=>{a.addIDInfoIfNotExists(t,"itemComboBox")}))}render(){return i("section",{class:"list-container"},i("div",{class:"list-wrapper",ref:t=>this._listWrapper=t},i("ul",{class:"list-options",ref:t=>this._optionsList=t},!this.showLoading&&0===this.visibleOptions.length&&i("div",{class:"message"},i("span",{class:"message__no-result"},this.textEmptyList||this.i18n("ez-combo-box.noResults"))),this.showLoading&&i("div",{class:"message"},i("div",{class:"message__loading"})),this.showOptionValue&&i("span",{class:"item__value item__value--hidden"}),!this.showLoading&&this.visibleOptions.length>0&&this.visibleOptions.map(((t,i)=>this.buildItem(t,i))))))}static get watchers(){return{width:["observeWidth"],maxWidth:["observeMaxWidth"]}}};p.style=":host{--ez-combo-box--border-radius:var(--border--radius-medium, 12px);--ez-combo-box--font-size:var(--text--medium, 14px);--ez-combo-box--font-family:var(--font-pattern, Arial);--ez-combo-box--font-weight--large:var(--text-weight--large, 500);--ez-combo-box--font-weight--medium:var(--text-weight--medium, 400);--ez-combo-box--background-color--xlight:var(--background--xlight, #fff);--ez-combo-box--background-medium:var(--background--medium, #f0f3f7);--ez-combo-box--line-height:calc(var(--text--medium, 14px) + 4px);--ez-combo-box__list-title--primary:var(--title--primary, #2B3A54);--ez-combo-box__list-text--primary:var(--text--primary, #626e82);--ez-combo-box__list-height:calc(var(--ez-combo-box--font-size) + var(--ez-combo-box--space--medium) + 4px);--ez-combo-box--space--medium:var(--space--medium, 12px);--ez-combo-box--space--small:var(--space--small, 6px);--ez-combo-box__scrollbar--color-default:var(--scrollbar--default, #626e82);--ez-combo-box__scrollbar--color-background:var(--scrollbar--background, #E5EAF0);--ez-combo-box__scrollbar--color-hover:var(--scrollbar--hover, #2B3A54);--ez-combo-box__scrollbar--color-clicked:var(--scrollbar--clicked, #a2abb9);--ez-combo-box__scrollbar--border-radius:var(--border--radius-small, 6px);--ez-combo-box__scrollbar--width:var(--space--medium, 12px);--ez-combo-box__list-container--padding:var(--space--extra-small, 3px)}.list-container{padding-top:var(--ez-combo-box__list-container--padding)}.list-wrapper{display:flex;flex-direction:column;box-sizing:border-box;width:0;z-index:var(--more-visible, 2);max-height:calc(4*var(--ez-combo-box__list-height) + 2*var(--ez-combo-box--space--small) + 9px);background-color:var(--ez-combo-box--background-color--xlight);border-radius:var(--ez-combo-box--border-radius);box-shadow:var(--shadow--medium, 0 8px 24px 0 rgba(43, 58, 84, 0.10));padding:var(--ez-combo-box--space--small)}.list-options{box-sizing:border-box;width:100%;height:100%;padding:0;margin:0;display:flex;flex-direction:column;scroll-behavior:smooth;overflow:auto;scrollbar-width:thin;gap:3px;scrollbar-color:var(--ez-combo-box__scrollbar--color-clicked) var(--ez-combo-box__scrollbar--color-background)}.list-options::-webkit-scrollbar{background-color:var(--ez-combo-box__scrollbar--color-background);width:var(--ez-combo-box__scrollbar--width);max-width:var(--ez-combo-box__scrollbar--width);min-width:var(--ez-combo-box__scrollbar--width)}.list-options::-webkit-scrollbar-track{background-color:var(--ez-combo-box__scrollbar--color-background);border-radius:var(--ez-combo-box__scrollbar--border-radius)}.list-options::-webkit-scrollbar-thumb{background-color:var(--ez-combo-box__scrollbar--color-default);border-radius:var(--ez-combo-box__scrollbar--border-radius)}.list-options::-webkit-scrollbar-thumb:vertical:hover,.list-options::-webkit-scrollbar-thumb:horizontal:hover{background-color:var(--ez-combo-box__scrollbar--color-hover)}.list-options::-webkit-scrollbar-thumb:vertical:active,.list-options::-webkit-scrollbar-thumb:horizontal:active{background-color:var(--ez-combo-box__scrollbar--color-clicked)}.item{display:flex;align-items:center;width:100%;box-sizing:border-box;list-style-type:none;cursor:pointer;border-radius:var(--ez-combo-box--border-radius-small);padding:var(--ez-combo-box--space--small);min-height:var(--ez-combo-box__list-height);gap:var(--space--small, 6px)}.item__value,.item__label{flex-basis:auto;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--ez-combo-box__list-title--primary);font-family:var(--ez-combo-box--font-family);font-size:var(--ez-combo-box--font-size);line-height:var(--ez-combo-box--line-height)}.item__label{font-weight:var(--ez-combo-box--font-weight--medium)}.item__label--bold{font-weight:var(--ez-combo-box--font-weight--large)}.item__value{text-align:center;color:var(--ez-combo-box__list-text--primary);font-weight:var(--ez-combo-box--font-weight--large)}.item__value--hidden{visibility:hidden;position:absolute;white-space:nowrap;z-index:-1;top:0;left:0}.item__label{text-align:left}.message{text-align:center;display:flex;justify-content:center;align-items:center;list-style-type:none;min-height:var(--ez-combo-box__list-height)}.message__no-result{color:var(--ez-combo-box__list-title--primary);font-family:var(--ez-combo-box--font-family);font-size:var(--ez-combo-box--font-size)}.message__loading{border-radius:50%;width:14px;height:14px;-webkit-animation:spin 1s linear infinite;animation:spin 1s linear infinite;border:3px solid var(--ez-combo-box__list-title--primary);border-top:3px solid transparent}li:hover{background-color:var(--ez-combo-box--background-medium)}.preselected{background-color:var(--background--medium)}@-webkit-keyframes spin{0%{-webkit-transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg)}}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}";const x=class{constructor(i){t(this,i),this.gui=void 0,this.customEditor=void 0,this.formViewField=void 0,this.value=void 0,this.detailContext=void 0,this.builderFallback=void 0,this.selectedRecord=void 0}async setFocus(){var t,i;null===(i=null===(t=this.gui)||void 0===t?void 0:t.setFocus)||void 0===i||i.call(t)}async setBlur(){var t,i;null===(i=null===(t=this.gui)||void 0===t?void 0:t.setBlur)||void 0===i||i.call(t)}async isInvalid(){var t,i;return(null===(i=null===(t=this.gui)||void 0===t?void 0:t.isInvalid)||void 0===i?void 0:i.call(t))||!1}watchValue(){this.handleValue(this.gui)}watchCustomEditor(){this.getContent()}watchFormViewField(t,i){r.equals(t,i)||this.getContent()}watchDetailContext(){this.getContent()}watchBuilderFallback(){this.getContent()}watchSelectedRecord(t,i){(null==t?void 0:t.__record__id__)!==(null==i?void 0:i.__record__id__)&&this.getContent()}getContent(){var t,e,s,o,a;const r=new Map;for(const t in this.formViewField.props)r.set(t,this.formViewField.props[t]);const n={value:this.value,name:this.formViewField.name,currentEditor:this.builderFallback(this.formViewField),setValue:t=>this.setValue(t),getValue:this.getValue,record:this.selectedRecord,editorMetadata:{label:this.formViewField.label,hidden:!1===(null===(t=this.formViewField.props)||void 0===t?void 0:t.visible),userInterface:this.formViewField.userInterface,options:null===(e=this.formViewField.props)||void 0===e?void 0:e.options,props:this.formViewField.props?r:void 0,optionLoader:this.formViewField.optionLoader},source:d.FORM,detailContext:this.detailContext};let c=this.customEditor.getEditorElement(n);if(!c)return c=this.builderFallback(this.formViewField),this.handleValue(c),void(this.gui=c);if(!(c instanceof HTMLElement)&&"string"!=typeof c)return this.handleValue(c),void(this.gui=c);"string"==typeof c&&(c=h.parseElement(c));const b=null!==(a=null!==(o=null===(s=this.value)||void 0===s?void 0:s.value)&&void 0!==o?o:this.value)&&void 0!==a?a:"";c.setAttribute("value",b),this.gui=i("div",{key:l.generateUUID(),ref:t=>t&&t.appendChild(c)})}setValue(t){this.value=t}getValue(){return this.value}handleValue(t){var i;null===(i=t.t)||void 0===i||i.forEach((t=>{t.i.value=this.value}))}componentWillLoad(){this.getContent()}render(){return i(e,null,this.gui)}static get watchers(){return{value:["watchValue"],customEditor:["watchCustomEditor"],formViewField:["watchFormViewField"],detailContext:["watchDetailContext"],builderFallback:["watchBuilderFallback"],selectedRecord:["watchSelectedRecord"]}}},w=class{constructor(i){t(this,i),this.ezChange=s(this,"ezChange",7),this.historyStack=[],this.historyIndex=-1,this.previewMode=!1,this.showPreview=!0,this.value="",this.label=void 0,this.mode="regular",this.enabled=!0,this.rows=6,this.errorMessage=void 0,this.canShowError=!0,this.showConfigs=!0,this.showTextFormat=!0,this.showUndoRedo=!0}observeValue(t,i){r.equals(t,i)||this.ezChange.emit(t)}observeErrorMessage(t){t&&this.previewMode&&(this.previewMode=!1)}async handleExecuteToolbarCommand(t){const{command:i,value:e}=t.detail;await this.executeCommand(i,e)}async setFocus(){this.handleFocus()}async setBlur(){var t;await(null===(t=this.textAreaRef)||void 0===t?void 0:t.setBlur())}async isInvalid(){return"string"==typeof this.errorMessage&&""!==this.errorMessage.trim()}bindPreview(){this._keyboardManager&&this.showPreview&&this._keyboardManager.bind("ctrl + p",(async()=>{await this.togglePreview()}),{description:"Entra em modo de pré visualização.",element:this.element})}bindConfigs(){this._keyboardManager&&this.showConfigs&&this._keyboardManager.bind("ctrl + l",(async()=>{await this.handleFormatSelection(b.LIST)}),{description:this.i18n("ez-rich-text.listShortcut"),element:this.element}).bind("ctrl + k",(async()=>{await this.handleLink()}),{description:this.i18n("ez-rich-text.linkShortcut"),element:this.element}).bind("ctrl + o",(async()=>{await this.handleImage()}),{description:this.i18n("ez-rich-text.imageShortcut"),element:this.element})}bindTextFormat(){this._keyboardManager&&this.showTextFormat&&this._keyboardManager.bind("ctrl + b",(async()=>{await this.handleFormatSelection(b.BOLD)}),{description:this.i18n("ez-rich-text.boldShortcut"),element:this.element}).bind("ctrl + i",(async()=>{await this.handleFormatSelection(b.ITALIC)}),{description:this.i18n("ez-rich-text.italicShortcut"),element:this.element}).bind("ctrl + u",(async()=>{await this.handleFormatSelection(b.UNDERLINE)}),{description:this.i18n("ez-rich-text.underlineShortcut"),element:this.element})}initKeyboardManager(){this._keyboardManager=new n({propagate:!1,element:this.element}),this._keyboardManager.bind("ctrl + Enter",(async()=>{await this.handleFormatSelection(b.BREAK_LINE)}),{description:this.i18n("ez-rich-text.breakLineShortcut"),element:this.element}).bind("ctrl + z",(async()=>{await this.handleUndo()}),{description:this.i18n("ez-rich-text.undoShortcut"),element:this.element}).bind("ctrl + x",(async()=>{await this.handleRedo()}),{description:this.i18n("ez-rich-text.redoShortcut"),element:this.element}),this.bindPreview(),this.bindConfigs(),this.bindTextFormat()}async executeCommand(t,i){switch(t){case m.FOCUS:this.handleFocus();break;case m.PREVIEW:await this.togglePreview();break;case m.FORMAT:await this.handleFormatSelection(i);break;case m.UNDO:await this.handleUndo();break;case m.REDO:await this.handleRedo();break;case m.LINK:await this.handleLink();break;case m.IMAGE:await this.handleImage()}}handleFocus(){this.previewMode=!1,requestAnimationFrame((async()=>{await this.textAreaRef.setFocus()}))}async handleLink(){this.previewMode=!1,requestAnimationFrame((async()=>{await this.linkBuilderRef.show(this.getSelectedText())}))}async handleImage(){this.previewMode=!1,await this.imageUploaderRef.show()}async handleRedo(){this.previewMode=!1,requestAnimationFrame((async()=>{this.redo(),await this.textAreaRef.setFocus()}))}async handleUndo(){this.previewMode=!1,requestAnimationFrame((async()=>{this.undo(),await this.textAreaRef.setFocus()}))}async handleFormatSelection(t){t&&(this.previewMode=!1,requestAnimationFrame((async()=>{await this.formatSelection(t),await this.textAreaRef.setFocus()})))}async togglePreview(){this.previewMode=!this.previewMode,this.previewMode&&await this.textAreaRef.setFocus()}getSelectedText(){const t=this.getTextAreaElement();if(t)return(this.textAreaRef.value||"").substring(t.selectionStart,t.selectionEnd)}getTextAreaElement(){return this.element.querySelector("ez-text-area").shadowRoot.querySelector("textarea")}async formatSelection(t){if(!this.textAreaRef)return;const i=t.replace("$selection",this.getSelectedText()||"");await this.textAreaRef.appendTextToSelection(i),this.value=this.textAreaRef.value,this.addToHistory(this.value)}addToHistory(t){this.historyIndex>=0&&t===this.historyStack[this.historyIndex]||(this.historyStack.length>=50&&this.historyStack.splice(0,this.historyStack.length-49),this.historyStack.push(t),this.historyIndex=this.historyStack.length-1)}undo(){if(!this.canExecuteUndo())return;this.historyIndex--;const t=this.historyStack[this.historyIndex];this.value=t,this.textAreaRef.value=t}canExecuteUndo(){return this.historyIndex>0}redo(){this.canExecuteRedo()&&(this.historyIndex++,this.getValueFromHistory())}canExecuteRedo(){return this.historyIndex<this.historyStack.length-1}getValueFromHistory(){const t=this.historyStack[this.historyIndex];this.value=t,this.textAreaRef.value=t}handleTextAreaChanged(t){this.value=t.detail,this.addToHistory(this.value)}async removeShortcuts(){var t;null===(t=this._keyboardManager)||void 0===t||t.unbindAllShortcutKeys()}async componentWillLoad(){this.i18n=await c()}componentDidLoad(){this.initKeyboardManager(),this.addToHistory(this.value)}async disconnectedCallback(){await this.removeShortcuts()}getSanitizedValue(){return u.sanitize(this.value,{ADD_ATTR:["target","rel"]})}renderContent(){return this.previewMode?i("div",{id:"rich-text-preview-container",class:"preview",innerHTML:this.getSanitizedValue()}):i("ez-text-area",{ref:t=>this.textAreaRef=t,label:this.label,value:this.value,enabled:this.enabled,rows:this.rows,mode:this.mode,canShowError:this.canShowError,errorMessage:this.errorMessage,onEzChange:this.handleTextAreaChanged.bind(this)})}render(){return i(e,null,i("div",{class:"editor-container bordered"},i("ez-rich-toolbar",{isPreviewMode:this.previewMode,showPreview:this.showPreview,showConfigs:this.showConfigs&&this.enabled,showTextFormat:this.showTextFormat&&this.enabled,showUndoRedo:this.showUndoRedo&&this.enabled}),this.renderContent()),i("ez-link-builder",{ref:t=>this.linkBuilderRef=t}),i("ez-simple-image-uploader",{ref:t=>this.imageUploaderRef=t}))}get element(){return o(this)}static get watchers(){return{value:["observeValue"],errorMessage:["observeErrorMessage"]}}};w.style=".sc-ez-rich-text-h{display:block;width:100%;font-family:Roboto;--ez-rich-text--box-shadow:0 0 3px 0 #DCE0E8;--ez-rich-text--shadow--outline:var(--shadow--outline) var(--color--strokes)}.editor-container.sc-ez-rich-text{width:100%;overflow:hidden;border-radius:12px;border:1px solid #DCE0E8}ez-text-area.sc-ez-rich-text{--text-area__input--border:1px solid}.preview.sc-ez-rich-text{min-height:20px;padding:12px;resize:both;overflow:auto;max-width:100%;border-top:1px solid #DCE0E8}";const _=class{constructor(i){t(this,i),this.saveEdition=s(this,"saveEdition",7),this.cancelEdition=s(this,"cancelEdition",7),this._newValue=void 0,this.value=void 0,this.styled=void 0}async applyFocusSelect(){this.calcSizeInput(this.value,!0)}calcSizeInput(t,i=!1){var e,s;const o=null===(s=null===(e=this._inputElement)||void 0===e?void 0:e.shadowRoot)||void 0===s?void 0:s.querySelector("input");if(null!=o){const e=this.getWidthValue(t);o.style.width=e+"px",i&&setTimeout((()=>o.select()),100)}}getWidthValue(t){if(null!=this._valueBasis){const i=this._valueBasis;if(null!=t){const e=2;return i.innerHTML=t,i.clientWidth>0?i.clientWidth+e:e}i.innerHTML=""}return 0}setStyledInput(){var t,i;let e="",s="",o="";null!=this.styled&&(e=this.styled.fontSize,s=this.styled.fontWeight,o=this.styled.fontFamily);const a=null===(i=null===(t=this._inputElement)||void 0===t?void 0:t.shadowRoot)||void 0===i?void 0:i.querySelector("input");null!=a&&(a.style.fontSize=e,a.style.fontWeight=s,a.style.fontFamily=o);const r=this._valueBasis;null!=r&&(r.style.fontSize=e,r.style.fontWeight=s,r.style.fontFamily=o)}handleSaveEdition(){this._newValue?this.saveEdition.emit({value:this.value,newValue:this._newValue}):v.alert(this.i18n("app.warning"),this.i18n("ez-text-edit.emptyFieldWarning")).then((()=>{this.setNewValue(this.value,!0)}))}handleCancelEdition(){this.cancelEdition.emit()}setNewValue(t,i=!1){this._newValue=t,this.calcSizeInput(this._newValue,i)}async componentWillLoad(){this.i18n=await c()}componentDidLoad(){this.applyFocusSelect(),this.setNewValue(this.value)}componentDidRender(){this.setStyledInput()}render(){return a.addIDInfoIfNotExists(this._element,"input"),i(e,null,i("span",{class:"text-edit__hidden-value",ref:t=>this._valueBasis=t}),i("ez-text-input",{"data-element-id":a.getInternalIDInfo("textInput"),onInput:()=>{this.calcSizeInput(this._newValue)},class:"text-edit__form-input",value:this._newValue,ref:t=>this._inputElement=t,mode:"slim",onEzChange:t=>this.setNewValue(null==t?void 0:t.detail),noBorder:!0}),i("ez-button",{class:"text-edit__icon-check",mode:"icon",iconName:"check",size:"small",onClick:()=>{this.handleSaveEdition()}}),i("ez-button",{class:"text-edit__icon-close",mode:"icon",iconName:"close",size:"small",onClick:()=>{this.handleCancelEdition()}}))}get _element(){return o(this)}};_.style=":host{display:flex;align-items:center;gap:5px}.text-edit__form-input{width:auto;--ez-text-input__input--padding:0px}.text-edit__hidden-value{visibility:hidden;position:absolute;white-space:nowrap;z-index:-1;top:0;left:0}";export{p as ez_combo_box_list,x as ez_custom_form_input,w as ez_rich_text,_ as ez_text_edit}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e,c as t,h as o,H as a,g as i}from"./p-23a36bb6.js";import{KeyboardManager as n}from"@sankhyalabs/core";import{i as l}from"./p-641ee538.js";var s;!function(e){e.CLOSE="CLOSE",e.OK="OK",e.CANCEL="CANCEL",e.LOAD="LOAD"}(s||(s={}));const r=s;var c;!function(e){e.ENABLED="ENABLED",e.DISABLED="DISABLED",e.HIDDEN="HIDDEN"}(c||(c={}));const d=c,m=class{constructor(o){e(this,o),this.ezModalAction=t(this,"ezModalAction",7),this.modalTitle=void 0,this.modalSubTitle=void 0,this.showTitleBar=!0,this.cancelButtonLabel=void 0,this.okButtonLabel=void 0,this.cancelButtonStatus=void 0,this.okButtonStatus=void 0,this.showCloseButton=!0}async handleEzModalAction(e){var t;(null==e?void 0:e.target)&&(null==e?void 0:e.target)===(null===(t=this._element)||void 0===t?void 0:t.parentElement)&&this.closeModal()}cancelIsVisible(){return this.cancelButtonStatus!==d.HIDDEN&&null!=this.cancelButtonLabel}okIsVisible(){return this.okButtonStatus!==d.HIDDEN&&null!=this.okButtonLabel}async componentWillLoad(){this.i18n=await l()}componentDidLoad(){window.requestAnimationFrame((()=>{this.ezModalAction.emit(r.LOAD),this._modalRef.focus()})),this._keyboardManager=new n({propagate:!1,element:this._element}).bind("Enter",this.ezModalAction.emit.bind(r.OK)).bind("Escape",(()=>this.closeModal())).bind("Esc",(()=>this.closeModal()))}disconnectedCallback(){var e;null===(e=this._keyboardManager)||void 0===e||e.unbindAllShortcutKeys()}closeModal(){this.ezModalAction.emit("CLOSE")}render(){return o(a,null,o("header",{ref:e=>this._modalRef=e,tabIndex:-1,class:"ez-modal-container__header-container"},this.showTitleBar&&o("div",{class:"ez-modal-container__header ez-margin-bottom--medium"},o("div",{class:"ez-col ez-align--middle ez-modal-container__title"},o("h2",{class:"ez-text ez-title--large ez-title--primary ez-text--bold ez-margin-vertical--extra-small"},this.modalTitle),this.modalSubTitle&&o("div",{class:"ez-text ez-text--medium ez-text--primary ez-margin-vertical--extra-small"},this.modalSubTitle)),this.showCloseButton&&o("button",{ref:e=>this._closeButton=e,class:"ez-modal-container__close-button",onClick:()=>this.ezModalAction.emit(r.CLOSE),"aria-label":this.i18n("app.close")},o("ez-icon",{class:"ez-modal-container__close-icon",size:"medium",iconName:"close"})))),o("main",{tabIndex:-1,class:"ez-modal-container__content"},o("slot",null)),o("footer",{tabIndex:-1,class:"ez-modal-container__footer"},this.cancelIsVisible()&&o("ez-button",{label:this.cancelButtonLabel||this.i18n("app.cancel"),isDisabled:this.cancelButtonStatus===d.DISABLED,onClick:()=>this.ezModalAction.emit(r.CANCEL)}),this.okIsVisible()&&o("ez-button",{ref:e=>this._okButton=e,class:"ez-button--primary",label:this.okButtonLabel||this.i18n("app.ok"),isDisabled:this.okButtonStatus===d.DISABLED,onClick:()=>this.ezModalAction.emit(r.OK)})))}get _element(){return i(this)}};m.style=".sc-ez-modal-container-h{--ez-modal-container-overflow-y:auto;--ez-modal-container-overflow-x:hidden;display:flex;flex-direction:column;width:100%;height:100%}.ez-modal-container__header-container.sc-ez-modal-container{outline:none}.ez-modal-container__header.sc-ez-modal-container{display:flex;flex-wrap:nowrap;flex-direction:row;justify-content:space-between;align-items:start}.ez-modal-container__content.sc-ez-modal-container{overflow-y:var(--ez-modal-container-overflow-y);overflow-x:var(--ez-modal-container-overflow-x);outline:none}.ez-modal-container__content.sc-ez-modal-container::-webkit-scrollbar{width:var(--space--small);min-width:var(--space--small);max-width:var(--space--small)}.ez-modal-container__footer.sc-ez-modal-container{display:flex;flex-direction:row;justify-content:flex-end;gap:var(--space--8, 8px);width:100%;padding-top:var(--space--small, 6px)}.ez-modal-container__title.sc-ez-modal-container{display:grid}.ez-modal-container__close-button.sc-ez-modal-container{cursor:pointer;background-color:transparent;border:none;outline:none;padding:var(--space--6, 6px) 0px}.ez-modal-container__close-icon.sc-ez-modal-container{--icon--color:var(--title--primary, #2B3A54)}";export{m as ez_modal_container}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,c as i,f as o,h as a,g as e}from"./p-23a36bb6.js";import{D as n}from"./p-ab574d59.js";import{FloatingManager as l,ElementIDUtils as d,KeyboardManager as r}from"@sankhyalabs/core";import{F as c}from"./p-dc628ed3.js";import{i as s}from"./p-641ee538.js";class h{constructor(t,i,o,a,e,n,l,d,r,c){this.title=t,this.message=i,this.dialogType=o,this.confirm=a,this.icon=e,this.labelCancel=n,this.labelConfirm=l,this.btnConfirmDanger=d,this.callBack=r,this.beforeClose=c}}const g=class{constructor(o){t(this,o),this.ezCancel=i(this,"ezCancel",7),this.ezAccept=i(this,"ezAccept",7),this.PRIMARY_BUTTON_ID="EZ_DIALOG_PRIMARY_BUTTON",this.btnConfirmDanger=!1,this._messageQueue=[],this._canFocusOnPrimaryBtn=!1,this.confirm=!1,this.dialogType=void 0,this.message=void 0,this.opened=!1,this.personalizedIconPath=void 0,this.ezTitle=void 0,this.beforeClose=void 0}observeConfig(t,i){this.manageOverflow(),t&&!i&&(this._canFocusOnPrimaryBtn=!0)}manageOverflow(){window.document.body.style.overflow=this.opened?"hidden":""}manageOverlay(){this.opened?this._overlayId=l.subscribeOverlayControl(this._overlayRef):l.unsubscribeOverlayControl(this._overlayRef||this._overlayId)}handleButtonClick(t){this._currentMessage.beforeClose&&!1===this._currentMessage.beforeClose(t)||(this.opened=this._messageQueue.length>0,this._currentMessage.callBack&&this._currentMessage.callBack(t),t?this.ezAccept.emit(t):this.ezCancel.emit(t),this._currentMessage=this._messageQueue.shift(),o(this))}async show(t,i,o,a,e,n,l,d,r){return this.opened=!0,new Promise((c=>{this._messageQueue.push(new h(t,i,o,a,e,n,l,d,c,r))}))}isCritical(t){return t===n.CRITICAL}getIconElement(t){if(t.dialogType===n.DEFAULT)return;const i=this.getIconClass(t.dialogType);return a("div",{class:`changeable__icon__container ${i}`},a("ez-icon",{class:"changeable__icon",size:"small",iconName:this.getIconName(t)}))}getIconClass(t){return this.isCritical(t)?"title-icon--critical":t===n.SUCCESS?"title-icon--success":t===n.WARN?"title-icon--warn":""}getIconName(t){return t.icon?t.icon:this.isCritical(t.dialogType)?"alert-circle-inverted":t.dialogType===n.WARN?"warning-outline":t.dialogType===n.SUCCESS?"check":void 0}getTypeIndicatorElement(t){if(t.dialogType!==n.DEFAULT)return a("div",{class:this.getClassIconIndicator(t.dialogType)})}getClassIconIndicator(t){return this.isCritical(t)?"dialog__critical--indicator":t==n.SUCCESS?"dialog__success--indicator":t==n.WARN?"dialog__warning--indicator":""}getClassContainer(t){return(t.dialogType||n.DEFAULT)===n.DEFAULT?"dialog__container dialog__container--default":"dialog__container"}getClassTitleLabel(t){return null==this.getIconElement(t)?"title title__label title__label--no-icon":"title title__label"}async componentWillLoad(){this.i18n=await s()}componentWillRender(){this._currentMessage||(this._messageQueue.length>0?this._currentMessage=this._messageQueue.pop():this.opened&&(this._currentMessage=new h(this.ezTitle,this.message,this.dialogType,this.confirm,this.personalizedIconPath,this.i18n("app.no"),this.i18n("app.yes"),this.btnConfirmDanger,null,this.beforeClose)))}componentDidLoad(){d.addIDInfo(this._element),this._keyboardManager=new r({propagate:!1,element:this._element}).bind("Enter",(()=>this.handleButtonClick(!0)),{description:this.i18n("ez-dialog.confirmButton"),element:this._element}).bind("Escape",(()=>this.handleButtonClick(!1)),{description:this.i18n("ez-dialog.closeButton"),element:this._element}).bind("Esc",(()=>this.handleButtonClick(!1)),{description:this.i18n("ez-dialog.closeButton"),element:this._element})}componentDidRender(){this.manageOverlay(),this.focusOnDialog(),this.handleFocusOnPrimaryButton()}focusOnDialog(){const t=this._element.shadowRoot.querySelector(".overlay .dialog");t instanceof HTMLDivElement&&(t.style.outline="none",this._lastActiveElement=document.activeElement,t.focus())}handleFocusOnPrimaryButton(){this._canFocusOnPrimaryBtn&&(this.focusOnPrimaryButton(),this._canFocusOnPrimaryBtn=!1)}focusOnPrimaryButton(){const t=this._element.shadowRoot.querySelector(`#${this.PRIMARY_BUTTON_ID}`),i=null==t?void 0:t.shadowRoot.querySelector("button");requestAnimationFrame((()=>{null==i||i.focus()}))}disconnectedCallback(){var t;c.resolveFocus(this._lastActiveElement),this._lastActiveElement=void 0,null===(t=this._keyboardManager)||void 0===t||t.unbindAllShortcutKeys()}render(){return this.opened&&this._currentMessage?a("div",{class:"overlay",ref:t=>this._overlayRef=t},a("div",{tabindex:"-1",class:"dialog"},this.getTypeIndicatorElement(this._currentMessage),a("div",{class:this.getClassContainer(this._currentMessage)},a("div",{class:"title__container"},a("div",{class:"title__box"},this.getIconElement(this._currentMessage),a("div",{class:this.getClassTitleLabel(this._currentMessage),innerHTML:this._currentMessage.title,"data-element-id":d.getInternalIDInfo("title")})),a("button",{class:"btn-close",onClick:()=>this.handleButtonClick(!1),"data-element-id":d.getInternalIDInfo("buttonClose")})),a("div",{class:"message",innerHTML:this._currentMessage.message,"data-element-id":d.getInternalIDInfo("message")}),this._currentMessage.confirm&&a("div",{class:"button-yes-no__container"},a("ez-button",{class:"button__cancel","data-element-id":d.getInternalIDInfo("cancel"),label:this._currentMessage.labelCancel,onClick:()=>this.handleButtonClick(!1)}),a("ez-button",{id:this.PRIMARY_BUTTON_ID,class:this._currentMessage.btnConfirmDanger?"button__confirm--danger":"button__confirm","data-element-id":d.getInternalIDInfo("confirm"),label:this._currentMessage.labelConfirm,onClick:()=>this.handleButtonClick(!0)})),!this._currentMessage.confirm&&a("div",{class:"button__confirm--container"},a("ez-button",{id:this.PRIMARY_BUTTON_ID,label:"Ok","data-element-id":d.getInternalIDInfo("ok"),class:"button__confirm",onClick:()=>this.handleButtonClick(!0)}))))):null}get _element(){return e(this)}static get watchers(){return{opened:["observeConfig"]}}};g.style=':host{--dialog__container-padding:var(--space--md, 20px);--dialog__btn__close--background-color:var(--title--primary, #2b3a54);--dialog__btn__no--padding-right:var(--space--8, 8px);--dialog__btn__close__image:url(\'data:image/svg+xml;utf8,<svg width="12" height="12" viewBox="0 0 12 12" xmlns="http://www.w3.org/2000/svg%22%3E<path d="M 7.0060773,5.995511 11.461972,1.5397722 c 0.132856,-0.1328413 0.207547,-0.3130253 0.207547,-0.5009046 0,-0.18786999 -0.07469,-0.3680541 -0.207547,-0.5009048 -0.132857,-0.13284126 -0.31302,-0.20748126 -0.500927,-0.20748126 -0.187812,0 -0.36807,0.07464 -0.500926,0.20748126 L 6.0042244,4.9937015 1.5482921,0.5379628 C 1.4154357,0.40512154 1.2352533,0.33048154 1.0473657,0.33048154 c -0.18787813,0 -0.36807,0.07464 -0.50092647,0.20748126 -0.13285646,0.1328507 -0.20749026,0.31303481 -0.20749026,0.5009048 0,0.1878793 0.0746338,0.3680633 0.20749026,0.5009046 L 5.0023715,5.995511 0.54643923,10.452213 c -0.0676086,0.06534 -0.12151598,0.14352 -0.15859681,0.229916 -0.0370714,0.08639 -0.0565645,0.1794 -0.0573369,0.27335 -7.724e-4,0.09404 0.0171873,0.187331 0.0528423,0.274293 0.0356455,0.08705 0.0882688,0.166087 0.15479148,0.23256 0.0665321,0.06648 0.14562277,0.11897 0.2326735,0.154567 0.0870507,0.0356 0.18031463,0.05344 0.2743433,0.05259 0.094029,-8.5e-4 0.1869528,-0.02049 0.2733331,-0.0576 0.08639,-0.0372 0.1645078,-0.09121 0.2298029,-0.158817 L 6.0042244,6.9973204 10.460119,11.453078 c 0.132856,0.132851 0.313114,0.207444 0.500926,0.207444 0.187907,0 0.36807,-0.07459 0.500927,-0.207444 0.132856,-0.13285 0.207547,-0.313006 0.207547,-0.500904 0,-0.187898 -0.07469,-0.368054 -0.207547,-0.500905 z"/></svg>\');--dialog__btn__min-width:80px;--dialog__title--font-pattern:var(--font-pattern, "Roboto");--dialog__title--padding-left:var(--space--small, 6px);--dialog__title__container--padding-bottom:var(--space--medium, 12px);--dialog__title--weight--large:var(--text-weight--large, 600);--dialog__body--font-pattern:var(--font-pattern, "Roboto");--dialog__body--text-shadow:var(--text-shadow, "0 0 0 #353535, 0 0 1px transparent");--dialog__body--text-weight--medium:var(--text-weight--medium, 400);--dialog__body--padding-bottom:var(--space--medium, 12px);--dialog__body--font-size:var(--text--medium, 14px);--dialog__body--color:var(--text--primary, #626e82);--dialog__icon--color:var(--text--inverted, #fff);--dialog__critical--background-color:var(--color--alert-error-800, #BD0025);--dialog__warning--background-color:var(--color--alert-warning-500, #EFB103);--dialog__success--background-color:var(--color--alert-success-500, #00523c);--dialog-z-index:var(--elevation--100, 100);--dialog--warning__image:url(\'data: image/svg+xml;utf8,<svg width="15" height="15" viewBox="0 0 15 15" xmlns="http://www.w3.org/2000/svg"><path d="M 7.5,0 0,13 h 15 z m 0,2.73684 5.1341,8.89476 H 2.36591 Z M 6.81818,5.47368 V 8.21053 H 8.18182 V 5.47368 Z m 0,4.10527 V 10.9474 H 8.18182 V 9.57895"/></svg>\');--dialog--critical__image:url(\'data: image/svg+xml;utf8,<svg width="13" height="13" viewBox="0 0 13 13" xmlns="http://www.w3.org/2000/svg"><path d="M 7.6534493,6.4948538 12.762051,1.3864299 C 12.914368,1.2341297 13,1.027552 13,0.81215179 13,0.59676225 12.914369,0.39018443 12.762051,0.23787352 12.609733,0.08557341 12.40318,0 12.187747,0 11.972425,0 11.765762,0.08557341 11.613445,0.23787352 L 6.5048431,5.3462975 1.3961977,0.23787352 C 1.2438802,0.08557341 1.0373043,0 0.82189458,0 0.60649572,0 0.39990901,0.08557341 0.24759147,0.23787352 0.09527396,0.39018443 0.00970766,0.59676225 0.00970766,0.81215179 c 0,0.21540021 0.0855663,0.42197791 0.23788381,0.57427811 L 5.3562369,6.4948538 0.24759147,11.604381 c -0.0775121,0.07492 -0.13931586,0.164543 -0.18182835,0.263595 -0.04250169,0.09905 -0.064850182,0.205678 -0.0657357237,0.313391 -8.8554258e-4,0.107813 0.0197049337,0.214771 0.0605827337,0.314472 0.04086693,0.0998 0.10119858,0.190415 0.17746563,0.266625 0.0762779,0.07622 0.16695386,0.136398 0.26675594,0.177208 0.099802,0.04082 0.20672745,0.06127 0.31452961,0.06029 0.1078025,-9.53e-4 0.21433799,-0.0235 0.31337139,-0.06604 0.099045,-0.04265 0.1886052,-0.104571 0.263465,-0.182081 L 6.5048431,7.6434102 11.613445,12.751855 c 0.152317,0.152312 0.35898,0.237831 0.574302,0.237831 0.215433,0 0.421986,-0.08552 0.574304,-0.237831 C 12.914368,12.599545 13,12.393 13,12.177578 13,11.962157 12.91437,11.75561 12.762051,11.603299 Z"/></svg>\')}h2{margin-block-start:0;margin-block-end:0;margin-inline-start:0px;margin-inline-end:0px}.overlay{position:fixed;display:flex;top:0px;z-index:var(--dialog-z-index);left:0px;width:100%;box-sizing:border-box;height:100vh;background-color:rgba(var(--rgb-background--overlay), var(--opacity--soft));backdrop-filter:blur(var(--background-blur--medium))}.dialog{display:flex;width:80%;position:absolute;top:50%;left:50%;margin-right:-50%;box-sizing:border-box;transform:translate(-50%, -50%);box-shadow:0px 0px 16px rgba(0, 38, 111, 0.122)}@media screen and (min-width: 768px){.dialog{width:50%}}@media screen and (min-width: 992px){.dialog{width:33.33333%}}.dialog__container{width:100%;background:#FFFF;border-radius:0px 6px 6px 0px;box-sizing:border-box;padding:var(--dialog__container-padding)}.dialog__container--default{border-radius:6px 6px 6px 6px}.dialog__critical--indicator{box-sizing:border-box;width:12px;border-radius:6px 0px 0px 6px;background-color:var(--dialog__critical--background-color)}.dialog__warning--indicator{width:12px;border-radius:6px 0px 0px 6px;box-sizing:border-box;background-color:var(--dialog__warning--background-color)}.dialog__success--indicator{width:12px;border-radius:6px 0px 0px 6px;box-sizing:border-box;background-color:var(--dialog__success--background-color)}.message{font-size:var(--dialog__body--font-size);font-weight:var(--dialog__body--text-weight--medium);font-family:var(--dialog__body--font-pattern);text-shadow:var(--dialog__body--text-shadow);padding-bottom:var(--dialog__body--padding-bottom);color:var(--dialog__body--color);max-height:30vh;content-visibility:auto;margin-bottom:var(--space--medium);overflow-y:auto}.changeable__icon__container{background:var(--dialog__warning--background-color);display:flex;justify-content:center;align-items:center;min-width:26px;min-height:26px;border-radius:50%}.changeable__icon{--ez-icon--color:var(--dialog__icon--color)}.changeable__icon__container.title-icon--critical{background-color:var(--dialog__critical--background-color)}.changeable__icon__container.title-icon--success{background-color:var(--dialog__success--background-color)}.changeable__icon__container.title-icon--warn{background-color:var(--dialog__warning--background-color)}.changeable__icon__container.title-icon--warn ez-icon{transform:translateY(-1px)}.title{display:flex;font-family:var(--dialog__title--font-pattern);margin:0;font-weight:var(--dialog__title--weight--large);color:var(--title--primary)}.title__container{display:flex;padding-bottom:var(--dialog__title__container--padding-bottom)}.title__box{display:flex;width:100%;align-items:center;align-self:center}.title__label{padding-left:var(--dialog__title--padding-left)}.title__label--no-icon{padding-left:0}.btn-close{justify-content:flex-end;align-self:flex-start;align-items:flex-start;display:flex;outline:none;width:10%;border:none;background-color:unset;cursor:pointer}.btn-close::after{content:\'\';display:flex;background-color:var(--dialog__btn__close--background-color);width:12px;height:12px;-webkit-mask-image:var(--dialog__btn__close__image);mask-image:var(--dialog__btn__close__image)}.title-icon::after{content:\'\';display:flex;background-color:#FFFF;width:15px;height:15px;-webkit-mask-image:var(--dialog--warning__image);mask-image:var(--dialog--warning__image)}.button-yes-no__container{display:flex;box-sizing:border-box;align-self:center;align-items:center;justify-content:flex-end}.button__cancel{padding-right:var(--dialog__btn__no--padding-right);--ez-button--min-width:var(--dialog__btn__min-width)}.button__confirm{--ez-button--background-color:var(--color--primary);--ez-button--color:var(--color--inverted);--ez-button--hover--background-color:var(--color--primary-600);--ez-button--hover-color:var(--color--inverted);--ez-button--min-width:var(--dialog__btn__min-width)}.button__confirm--danger{--ez-button--background-color:var(--color--alert-error-800, #BD0025);--ez-button--color:var(--color--inverted);--ez-button--hover--background-color:var(--color-alert--error-900, #a10020);--ez-button--hover-color:var(--color--inverted);--ez-button--min-width:var(--dialog__btn__min-width)}.button__confirm--container{display:flex;justify-content:flex-end}.row{width:100%;display:flex;flex-wrap:wrap}.col{display:flex;flex-wrap:wrap;align-self:flex-start;box-sizing:border-box}.col--stretch{align-self:stretch}.col--undefined{width:unset}.col--nowrap{flex-wrap:nowrap}@media screen and (min-width: 320px){.col--sd-1{width:8.33333%}.col--sd-2{width:16.66667%}.col--sd-3{width:25%}.col--sd-4{width:33.33333%}.col--sd-5{width:41.66667%}.col--sd-6{width:50%}.col--sd-7{width:58.33333%}.col--sd-8{width:66.66667%}.col--sd-9{width:75%}.col--sd-10{width:83.33333%}.col--sd-11{width:91.66667%}.col--sd-12{width:100%}}@media screen and (min-width: 480px){.col--pn-1{width:8.33333%}.col--pn-2{width:16.66667%}.col--pn-3{width:25%}.col--pn-4{width:33.33333%}.col--pn-5{width:41.66667%}.col--pn-6{width:50%}.col--pn-7{width:58.33333%}.col--pn-8{width:66.66667%}.col--pn-9{width:75%}.col--pn-10{width:83.33333%}.col--pn-11{width:91.66667%}.col--pn-12{width:100%}}@media screen and (min-width: 768px){.col--tb-1{width:8.33333%}.col--tb-2{width:16.66667%}.col--tb-3{width:25%}.col--tb-4{width:33.33333%}.col--tb-5{width:41.66667%}.col--tb-6{width:50%}.col--tb-7{width:58.33333%}.col--tb-8{width:66.66667%}.col--tb-9{width:75%}.col--tb-10{width:83.33333%}.col--tb-11{width:91.66667%}.col--tb-12{width:100%}}@media screen and (min-width: 992px){.col--md-1{width:8.33333%}.col--md-2{width:16.66667%}.col--md-3{width:25%}.col--md-4{width:33.33333%}.col--md-5{width:41.66667%}.col--md-6{width:50%}.col--md-7{width:58.33333%}.col--md-8{width:66.66667%}.col--md-9{width:75%}.col--md-10{width:83.33333%}.col--md-11{width:91.66667%}.col--md-12{width:100%}}@media screen and (min-width: 1200px){.col--ld-1{width:8.33333%}.col--ld-2{width:16.66667%}.col--ld-3{width:25%}.col--ld-4{width:33.33333%}.col--ld-5{width:41.66667%}.col--ld-6{width:50%}.col--ld-7{width:58.33333%}.col--ld-8{width:66.66667%}.col--ld-9{width:75%}.col--ld-10{width:83.33333%}.col--ld-11{width:91.66667%}.col--ld-12{width:100%}}';export{g as ez_dialog}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { EventEmitter } from '../../stencil-public-runtime';
|
|
2
2
|
import { ITreeItem } from './interfaces/ITreeItem';
|
|
3
|
+
import { UpdateItemConfig } from './types/UpdateItemConfig';
|
|
3
4
|
export declare class EzTree {
|
|
4
5
|
private i18n;
|
|
5
6
|
private _element;
|
|
@@ -32,6 +33,10 @@ export declare class EzTree {
|
|
|
32
33
|
* Define se a árvore deve permitir a filtragem hierárquica.
|
|
33
34
|
*/
|
|
34
35
|
enableHierarchicalFilter: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Define se os itens da árvore são selecionáveis.
|
|
38
|
+
*/
|
|
39
|
+
selectable: boolean;
|
|
35
40
|
/**
|
|
36
41
|
* Emitido quando um item é selecionado na árvore.
|
|
37
42
|
*/
|
|
@@ -44,6 +49,10 @@ export declare class EzTree {
|
|
|
44
49
|
* Emitido ao dar clique duplo em um item da árvore.
|
|
45
50
|
*/
|
|
46
51
|
ezDbClickItem: EventEmitter<ITreeItem>;
|
|
52
|
+
/**
|
|
53
|
+
* Emitido ao remover um item da árvore.
|
|
54
|
+
*/
|
|
55
|
+
ezRemoveItem: EventEmitter<string>;
|
|
47
56
|
/**
|
|
48
57
|
* Efetua a seleção de um item.
|
|
49
58
|
*/
|
|
@@ -87,7 +96,12 @@ export declare class EzTree {
|
|
|
87
96
|
/**
|
|
88
97
|
* Atualiza um item
|
|
89
98
|
*/
|
|
90
|
-
updateItem(item: ITreeItem): Promise<void>;
|
|
99
|
+
updateItem(item: ITreeItem | ITreeItem[], config?: Partial<UpdateItemConfig>): Promise<void>;
|
|
100
|
+
/**
|
|
101
|
+
* Remove um item da árvore pelo seu ID.
|
|
102
|
+
* Se o item removido estiver selecionado, a seleção será limpa.
|
|
103
|
+
*/
|
|
104
|
+
removeItem(id?: string): Promise<void>;
|
|
91
105
|
/**
|
|
92
106
|
* Obtem um item pelo id
|
|
93
107
|
*/
|
|
@@ -104,6 +118,11 @@ export declare class EzTree {
|
|
|
104
118
|
observeItems(newValue: Array<ITreeItem>, oldValue: Array<ITreeItem>): void;
|
|
105
119
|
observeValue(): void;
|
|
106
120
|
onKeyDownListener(event: KeyboardEvent): void;
|
|
121
|
+
private getItemById;
|
|
122
|
+
private addItemInIndexedList;
|
|
123
|
+
private applyDefaultValues;
|
|
124
|
+
private updateItemInIndexedList;
|
|
125
|
+
private removeItemFromIndexedList;
|
|
107
126
|
private getItemPathAttrs;
|
|
108
127
|
private openClose;
|
|
109
128
|
private previousLevel;
|
|
@@ -14,6 +14,7 @@ export declare class Node {
|
|
|
14
14
|
isDisabled(): boolean;
|
|
15
15
|
updateChildren(children: Array<ITreeItem>): void;
|
|
16
16
|
addChild(tree: ITree, item: ITreeItem): void;
|
|
17
|
+
removeChild(id: string): boolean;
|
|
17
18
|
addPlaceHolder(): void;
|
|
18
19
|
getNode(id: string): Node;
|
|
19
20
|
needLoad(): boolean;
|
|
@@ -13,6 +13,7 @@ export declare class Tree extends Node implements ITree {
|
|
|
13
13
|
load(items: Array<ITreeItem>): void;
|
|
14
14
|
setFilterPattern(pattern: string, enableHierarchicalFilter?: boolean): Promise<void>;
|
|
15
15
|
updateItem(item: ITreeItem): void;
|
|
16
|
+
removeItem(id: string): void;
|
|
16
17
|
open(path: string): Promise<void>;
|
|
17
18
|
private setAllChildrenVisible;
|
|
18
19
|
private applyFilter;
|
|
@@ -59,6 +59,7 @@ import { IStyled } from "./components/ez-text-edit/ez-text-edit";
|
|
|
59
59
|
import { TFocusOptions as TFocusOptions1 } from "./components/ez-text-input/ez-text-input";
|
|
60
60
|
import { Placement } from "@floating-ui/dom";
|
|
61
61
|
import { ITreeItem } from "./components/ez-tree/interfaces/ITreeItem";
|
|
62
|
+
import { UpdateItemConfig } from "./components/ez-tree/types/UpdateItemConfig";
|
|
62
63
|
import { Node } from "./components/ez-tree/types/Node";
|
|
63
64
|
import { EzFile } from "./components/ez-upload/ez-upload";
|
|
64
65
|
import { IAppliedFilterColumnOptions, IFilterColumnConfigs } from "./components/ez-grid/subcomponents/filter-column";
|
|
@@ -3395,10 +3396,18 @@ export namespace Components {
|
|
|
3395
3396
|
* Realiza a abertura de um item, incluindo a hieraquia acima. Observação para carga dinâmica (Lazyload): O item solicitado já deve estar carregado na lista. Nos casos onde o item ainda não esteja carregado o id pode ser uma string no formato "id1>>id2>>id3", tornando possível a carga a partir de um ponto já carregado.
|
|
3396
3397
|
*/
|
|
3397
3398
|
"openItem": (id: string) => Promise<void>;
|
|
3399
|
+
/**
|
|
3400
|
+
* Remove um item da árvore pelo seu ID. Se o item removido estiver selecionado, a seleção será limpa.
|
|
3401
|
+
*/
|
|
3402
|
+
"removeItem": (id?: string) => Promise<void>;
|
|
3398
3403
|
/**
|
|
3399
3404
|
* Efetua a seleção de um item.
|
|
3400
3405
|
*/
|
|
3401
3406
|
"selectItem": (id: string) => Promise<void>;
|
|
3407
|
+
/**
|
|
3408
|
+
* Define se os itens da árvore são selecionáveis.
|
|
3409
|
+
*/
|
|
3410
|
+
"selectable": boolean;
|
|
3402
3411
|
/**
|
|
3403
3412
|
* Forma alternativa para atribuir o item selecionado por seu ID.
|
|
3404
3413
|
*/
|
|
@@ -3410,7 +3419,7 @@ export namespace Components {
|
|
|
3410
3419
|
/**
|
|
3411
3420
|
* Atualiza um item
|
|
3412
3421
|
*/
|
|
3413
|
-
"updateItem": (item: ITreeItem) => Promise<void>;
|
|
3422
|
+
"updateItem": (item: ITreeItem | ITreeItem[], config?: Partial<UpdateItemConfig>) => Promise<void>;
|
|
3414
3423
|
/**
|
|
3415
3424
|
* Define o item selecionado na árvore.
|
|
3416
3425
|
*/
|
|
@@ -7477,6 +7486,14 @@ declare namespace LocalJSX {
|
|
|
7477
7486
|
* Emitido quando um item é aberto na árvore.
|
|
7478
7487
|
*/
|
|
7479
7488
|
"onEzOpenItem"?: (event: EzTreeCustomEvent<ITreeItem>) => void;
|
|
7489
|
+
/**
|
|
7490
|
+
* Emitido ao remover um item da árvore.
|
|
7491
|
+
*/
|
|
7492
|
+
"onEzRemoveItem"?: (event: EzTreeCustomEvent<string>) => void;
|
|
7493
|
+
/**
|
|
7494
|
+
* Define se os itens da árvore são selecionáveis.
|
|
7495
|
+
*/
|
|
7496
|
+
"selectable"?: boolean;
|
|
7480
7497
|
/**
|
|
7481
7498
|
* Forma alternativa para atribuir o item selecionado por seu ID.
|
|
7482
7499
|
*/
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { DataUnit } from "@sankhyalabs/core";
|
|
2
2
|
import { IFormConfig, IFormSheetMetadata } from "./interfaces";
|
|
3
|
+
import { IGuideItem } from "../../components/ez-guide-navigator/interfaces";
|
|
3
4
|
export declare class FormMetadata {
|
|
4
5
|
private _sheets;
|
|
5
6
|
private _requiredFields;
|
|
@@ -20,4 +21,4 @@ export declare class FormMetadata {
|
|
|
20
21
|
setDefaultVars(vars: Map<string, any>): void;
|
|
21
22
|
}
|
|
22
23
|
export declare const buildFormConfigFromDataUnit: (dataUnit: DataUnit) => IFormConfig;
|
|
23
|
-
export declare const buildFormMetadata: (config: IFormConfig, dataUnit: DataUnit, includeDetails?: boolean) => FormMetadata;
|
|
24
|
+
export declare const buildFormMetadata: (config: IFormConfig, dataUnit: DataUnit, includeDetails?: boolean, customGuides?: IGuideItem[]) => FormMetadata;
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{h as e,r as t,c as i,f as r,H as s,g as o}from"./p-23a36bb6.js";import{ElementIDUtils as a,StringUtils as n,ObjectUtils as l}from"@sankhyalabs/core";import{i as h}from"./p-641ee538.js";const c=(e,t)=>t?e.iconExpanded||"chevron-down":e.iconContracted||"chevron-right",d=e=>e.tooltip||e.label,m=t=>{const{node:i,selectedId:r,itemClick:s,iconClick:o,iconResolver:n,tooltipResolver:l,itemsList:h,itemDoubleClick:c}=t;if(!i.visible)return;const d=i.item,v=t.level||1,u=i.isDisabled(),b=!u&&d.expanded,g=i.isExpandable(),f=!u&&!i.isPlaceHolder;return f&&h.push(d),e("ul",{class:1===v?"first-level":void 0},e("li",Object.assign({title:l(d,!u,v),class:"tree-item "+(d.id!==r?"tree-item-error":""),onClick:()=>f&&s(d),onDblClick:()=>f&&c(d)},{disabled:u,selected:d.id===r,[a.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:a.getInternalIDInfo(`ezTreeItem_${d.id}`)}),e("div",{class:"item-label-container"},e("div",{class:"item-icon-box"},g&&e("ez-icon",{id:d.id,class:"item-icon",size:"small",iconName:n(d,b,v),onClick:e=>function(e){e.stopPropagation(),f&&o(d)}(e)})),e("label",{class:"item-label "+(d.bold?"item-label--bold":"")},d.label)),function(t,i,r){if(null!=i)return"string"==typeof i?e("div",{class:`tree-item-badge ${r?null:i}`},"error"===i&&e("ez-icon",{id:`${t}-badge-error`,class:"tree-item-badge-error-icon",size:"x-small",style:{color:"white"},iconName:"alert-circle"})):"text"===i.type?e("div",{id:`${t}-badge-text`,class:"tree-item-badge-text"},i.text):e("div",null,e("ez-icon",{id:`${t}-badge-icon`,class:"tree-item-badge-icon",style:{"--ez-icon--color":`var(--ez-tree__badge--icon-color--${i.iconColor||"default"})`},iconName:i.iconName}))}(d.id,d.badge,d.id===r)),b&&i.getChildren().map((t=>e(m,{selectedId:r,node:t,itemClick:s,iconClick:o,level:v+1,iconResolver:n,tooltipResolver:l,itemsList:h,itemDoubleClick:c}))))};class v{constructor(e,t,i,r=!1){this.children=new Map,this.visible=!0,this.item=t,this.parent=i,this._tree=e,this.isPlaceHolder=r,t&&!r?(this._isLazyLoad="function"==typeof t.children||t.childrenCount>0,Array.isArray(t.children)&&(Array.from(t.children).forEach((e=>this.addChild(this._tree,e))),this._childrenLoaded=!0)):(this._isLazyLoad=!1,this._childrenLoaded=!0)}refresh(e){if(this.isPlaceHolder)return;this.item=Object.assign({},e),this._isLazyLoad="function"==typeof this.item.children||this.item.childrenCount>0;const t=this.children;this.children=new Map,Array.isArray(this.item.children)?(void 0===this.item.expanded&&(this.item.expanded=!0),Array.from(this.item.children).forEach((e=>{const i=t.get(e.id);i?(void 0===e.expanded&&(e.expanded=i.item.expanded),i.refresh(e),this.children.set(e.id,i)):(void 0===e.expanded&&(e.expanded=!0),this.addChild(this._tree,Object.assign({},e)))})),this._childrenLoaded=!0):this._childrenLoaded=!1}isDisabled(){return!this.isPlaceHolder&&this._tree.isNodeDisabled(this.item.id,this.item.disabled)}updateChildren(e){this.isPlaceHolder||this.refresh(Object.assign(Object.assign({},this.item),{children:e}))}addChild(e,t){this.children.has(t.id)||this.children.set(t.id,new v(e,t,this))}addPlaceHolder(){this.children.clear();const e=this.item.id;this.children.set(e,new v(void 0,{id:`placeholder_${e}`,label:"Carregando..."},this,!0))}getNode(e){if(this.children.has(e))return this.children.get(e);const t=Array.from(this.children.values());for(const i of t){const t=i.getNode(e);if(t)return t}}needLoad(){return this._isLazyLoad&&!this._childrenLoaded}isExpandable(){return!!this._isLazyLoad||this.children.size>0}getChildren(){return this.isPlaceHolder?[]:(this.needLoad()&&this._tree.loadChildren(this),Array.from(this.children.values()))}}class u extends v{constructor(e){super(void 0),this._disabledValues=new Map,this._changeCallback=e}async addChildAt(e,t){const i=this.getNode(e);null!=i&&(i.addChild(this,t),this._changeCallback())}setDisabled(e,t){this._disabledValues.set(e,t),this._changeCallback()}isNodeDisabled(e,t){return this._disabledValues.has(e)?this._disabledValues.get(e):t}load(e){if(e===this._currentItems)return;this._currentItems=e;const t=this.children;this.children=new Map,this._disabledValues.clear(),e.forEach((e=>{const i=t.get(e.id);i?(i.refresh(e),this.children.set(e.id,i)):this.addChild(this,Object.assign({},e))}))}async setFilterPattern(e,t=!0){if(e&&t&&e.includes(".")){const t=e.split(".").map((e=>n.replaceAccentuatedCharsKeepSymbols(e.trim())));await this.applyLayeredFilter(this,t,0)}else this._filterPattern=n.replaceAccentuatedCharsKeepSymbols(e),this.setAllChildrenExpanded(this,!1),this.applyFilter(this);this._changeCallback()}updateItem(e){if(null==e)return;const t=this.getNode(e.id);null!=t&&(Object.keys(e).forEach((i=>t.item[i]=e[i])),null==e.children?t.children.clear():Array.isArray(e.children)&&t.updateChildren(e.children),this._changeCallback())}async open(e){return new Promise((async t=>{await this.walkPath(this,e,(e=>e.item.expanded=!0)),t()}))}setAllChildrenVisible(e){e.children.forEach((e=>{e.visible=!0,this.setAllChildrenVisible(e)}))}applyFilter(e){if(!this._filterPattern)return e.visible=!0,void this.setAllChildrenVisible(e);if(e.children.forEach((e=>{this.applyFilter(e)})),null==e.item)return;let t=!1;if(n.replaceAccentuatedCharsKeepSymbols(e.item.label).includes(this._filterPattern))t=!0,e.item.expanded=!0,this.setAllChildrenVisible(e);else{const i=Array.from(e.children.values());for(let r=0;r<i.length;r++)if(i[r].visible){t=!0,e.item.expanded=!0;break}}e.visible=t}async applyLayeredFilter(e,t,i){if(!e.item){const r=(await Promise.all(Array.from(e.children.values()).map((e=>this.applyLayeredFilter(e,t,i))))).some(Boolean);return e.visible=r,r}if(!n.replaceAccentuatedCharsKeepSymbols(e.item.label).includes(t[i])){const r=(await Promise.all(Array.from(e.children.values()).map((e=>this.applyLayeredFilter(e,t,i))))).some(Boolean);return r&&(e.item.expanded=!0),e.visible=r,r}if(i===t.length-1)return e.visible=!0,this.setAllChildrenVisible(e),!0;const r=(await Promise.all(Array.from(e.children.values()).map((e=>this.applyLayeredFilter(e,t,i+1))))).some(Boolean);return r&&(e.item.expanded=!0),e.visible=r,r}async walkPath(e,t,i,r=0){return new Promise((async s=>{const o=t.split(">>").map((e=>e.trim()));if(o.length>r){const s=e.getNode(o[r]);s&&(s.needLoad()&&await this.loadLevel(s),i(s),await this.walkPath(s,t,i,r+1))}s()}))}async loadChildren(e){return new Promise((t=>{this.loadLevel(e).then((()=>{t(),this._changeCallback()}))}))}expandAll(){this.setAllChildrenExpanded(this,!0),this._changeCallback()}collapseAll(){this.setAllChildrenExpanded(this,!1),this._changeCallback()}setAllChildrenExpanded(e,t){e.item&&!e.isPlaceHolder&&(e.item.expanded=t),e.children.forEach((e=>{this.setAllChildrenExpanded(e,t)}))}async loadLevel(e){return new Promise((t=>{e.addPlaceHolder(),(0,e.item.children)(e.item).then((i=>{e.updateChildren(i),t()}))}))}}const b=class{constructor(e){t(this,e),this.ezChange=i(this,"ezChange",7),this.ezOpenItem=i(this,"ezOpenItem",7),this.ezDbClickItem=i(this,"ezDbClickItem",7),this._onItemClick=e=>{this._onIconClick(e)},this._onIconClick=e=>{this.openClose(e),this.value=e},this._tree=new u((()=>r(this))),this._waintingForLoad=void 0,this.items=[],this.value=void 0,this.selectedId=void 0,this.iconResolver=c,this.tooltipResolver=void 0,this.enableHierarchicalFilter=!0}async selectItem(e){const t=this._tree.getNode(e);this.value=t?t.item:void 0}async openItem(e){this._waintingForLoad=!0,await this._tree.open(e),this._waintingForLoad=!1}async disableItem(e){[].concat(e).forEach((e=>this._tree.setDisabled(e,!0)))}async enableItem(e){[].concat(e).forEach((e=>this._tree.setDisabled(e,!1)))}async addChild(e,t){var i;null==t&&(t=null===(i=this.value)||void 0===i?void 0:i.id),this._tree.addChildAt(t,e);const r=this._tree.getNode(t);r&&(r.item.expanded=!0)}async applyFilter(e){await this._tree.setFilterPattern(e,this.enableHierarchicalFilter)}async expandAll(){this._tree.expandAll()}async collapseAll(){this._tree.collapseAll()}async updateItem(e){var t;this._tree.updateItem(e),null==(null===(t=this._tree)||void 0===t?void 0:t.getNode(this.selectedId))&&(this.value=this._visibleItems?this._visibleItems[0]:void 0)}async getItem(e){return new Promise((t=>{const i=this._tree.getNode(e);t(null==i?void 0:i.item)}))}async getCurrentPath(){var e,t,i;const r=null===(e=this._tree)||void 0===e?void 0:e.getNode(this.selectedId);if(null==r)return;const s=[];let o,a=null===(t=r.parent)||void 0===t?void 0:t.item;for(s.push(this.getItemPathAttrs(r.item));null!=a;)s.unshift(this.getItemPathAttrs(a)),o=this._tree.getNode(a.id),a=null===(i=null==o?void 0:o.parent)||void 0===i?void 0:i.item;return s}async getParent(e){return new Promise((t=>{var i;const r=this._tree.getNode(e);r&&t(null===(i=r.parent)||void 0===i?void 0:i.item),t(void 0)}))}observeItems(e,t){l.objectToString(e)!==l.objectToString(t)&&this._tree.load(this.items||[])}observeValue(){var e;this.ezChange.emit(this.value),this.selectedId=null===(e=this.value)||void 0===e?void 0:e.id}onKeyDownListener(e){if(!this.value)return;let t=!1;switch(e.key){case"ArrowUp":this.previousItem(),t=!0;break;case"ArrowDown":this.nextItem(),t=!0;break;case"ArrowLeft":this.previousLevel(),t=!0;break;case"ArrowRight":this.nextLevel(),t=!0;break;case" ":this.openClose(this.value),t=!0}t&&(e.stopPropagation(),e.preventDefault())}getItemPathAttrs({id:e,label:t}){return{id:e,label:t}}openClose(e){if(null==e)return;const t=!e.expanded;e.expanded=t,t&&this.ezOpenItem.emit(e),this._tree.updateItem(e)}previousLevel(){var e;if(this.value)if(this.value.expanded)this.value.expanded=!1,this._tree.updateItem(this.value);else{const t=null===(e=this._tree.getNode(this.value.id).parent)||void 0===e?void 0:e.item;t&&(this.value=t)}}nextLevel(){this.value&&this._tree.getNode(this.value.id).isExpandable()&&(this.value.expanded?this.nextItem():(this.value.expanded=!0,this._tree.updateItem(this.value)))}indexOf(e){if(null==e)return-1;for(let t=0;t<this._visibleItems.length;t++)if(this._visibleItems[t].id===e)return t;return-1}selectNextItem(e){var t;const i=this.indexOf(null===(t=this.value)||void 0===t?void 0:t.id)+e;i>-1&&i<this._visibleItems.length&&(this.value=this._visibleItems[i])}nextItem(){this.selectNextItem(1)}previousItem(){this.selectNextItem(-1)}connectedCallback(){this.items&&this._tree.load(this.items)}async componentWillLoad(){this.i18n=await h()}componentWillRender(){var e;if(!this.selectedId||(null===(e=this.value)||void 0===e?void 0:e.id)===this.selectedId)return;const t=this._tree.getNode(this.selectedId);t&&(this.value=t.item)}render(){if(a.addIDInfoIfNotExists(this._element,"ezTree"),null!=this.items)return this._visibleItems=[],e(s,{tabindex:"-1"},this._waintingForLoad?e("label",null,this.i18n("app.loading"),"..."):this._tree.getChildren().map((t=>{var i;return e(m,{selectedId:null===(i=this.value)||void 0===i?void 0:i.id,node:t,itemClick:this._onItemClick,iconClick:this._onIconClick,iconResolver:this.iconResolver,tooltipResolver:this.tooltipResolver||d,itemsList:this._visibleItems,itemDoubleClick:e=>this.ezDbClickItem.emit(e)})})))}get _element(){return o(this)}static get watchers(){return{items:["observeItems"],value:["observeValue"]}}};b.style=":host{--ez-tree--border-radius:var(--border--radius-small, 8px);--ez-tree--padding-inline-start:20px;--ez-tree--margin:var(--space--extra-small, 3px);--ez-tree--margin-right:0px;--ez-tree--font-family:var(--font-pattern, Arial);--ez-tree--font-size:var(--text--medium, 14px);--ez-tree--selected--font-weight:var(--text-weight--large, 600);--ez-tree--font-weight:var(--text-weight--small, 400);--ez-tree--color:var(--title--primary, #2B3A54);--ez-tree--selected--color:var(--color--primary, #008561);--ez-tree--disabled--color:var(--text--disable, #AFB6C0);--ez-tree--font-weight--bold:var(--text-weight--large, 600);--ez-tree__tree-item--height:var(--size-medium, 18px);--ez-tree__tree-item--padding:var(--space--small, 6px);--ez-tree__tree-item--background-color:var(--background--xlight, #FFFFFF);--ez-tree__tree-item--selected--background-color:var(--color--primary-300, #E2F4EF);--ez-tree__tree-item--hover--background-color:var(--background--medium, #F0F3F7);--ez-tree__tree-item--disabled--background-color:var(--ez-tree__tree-Item--background-color);--ez-tree__item-icon-box--height:var(--ez-tree__tree-item--height);--ez-tree__item-icon-box--width:var(--size-medium, 18px);--ez-tree__item-icon-box--padding:var(--ez-tree__tree-item--padding);--ez-tree__badge--icon-color--default:var(--title--primary, #2B3A54);--ez-tree__badge--icon-color--error:var(--color--error, #da4453);--ez-tree__badge--icon-color--success:var(--color-alert--success-800, #157a00);--ez-tree__badge--icon-color--warning:var(--color--warning, #f2d410);--ez-tree__badge--icon-color--disabled:var(--text--disable, #AFB6C0);display:flex;flex-direction:column;margin:0 var(--ez-tree--margin) var(--ez-tree--margin) var(--ez-tree--margin);outline:none}ul{list-style-type:none;margin:0;cursor:default;padding-inline-start:var(--ez-tree--padding-inline-start)}ul.first-level{padding-inline-start:0}.tree-item-badge{width:16px;height:16px;background:transparent;border-radius:50%;transition:all 300ms ease-in-out;display:flex;align-items:center;justify-content:center}.tree-item-badge-error-icon{--ez-icon--color:white}.tree-item-badge-text{font-family:var(--ez-tree--font-family);font-size:var(--ez-tree--font-size);font-weight:var(--ez-tree--font-weight);color:var(--ez-tree--color)}.tree-item-badge.error{background:var(--color--error)}.tree-item-badge.warning{background:var(--color--warning)}.tree-item-badge.success{background:var(--color--success)}.item-label-container{display:flex;align-items:center;overflow:hidden}.tree-item{display:flex;align-items:center;cursor:pointer;margin-top:var(--ez-tree--margin);margin-right:var(--ez-tree--margin-right);border-radius:var(--ez-tree--border-radius);height:var(--ez-tree__tree-item--height);padding:var(--ez-tree__tree-item--padding);justify-content:space-between}.tree-item[selected]{background-color:var(--ez-tree__tree-item--selected--background-color)}.tree-item:hover{background-color:var(--ez-tree__tree-item--hover--background-color)}.tree-item[disabled],.tree-item[disabled]:hover{background-color:var(--ez-tree__tree-item--disabled--background-color)}.item-icon-box{display:flex;align-items:center;justify-content:center;width:var(--ez-tree__item-icon-box--width);height:var(--ez-tree__item-icon-box--height);padding:var(--ez-tree__item-icon-box--padding) var(--ez-tree__item-icon-box--padding) var(--ez-tree__item-icon-box--padding) 0}.item-icon{--ez-icon--color:var(--ez-tree--color)}.item-icon:hover{cursor:pointer}.tree-item[selected] .item-icon{--ez-icon--color:var(--ez-tree--selected--color)}.tree-item[disabled] .item-icon{cursor:unset;--ez-icon--color:var(--ez-tree--disabled--color)}.item-label{cursor:inherit;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;font-family:var(--ez-tree--font-family);font-size:var(--ez-tree--font-size);font-weight:var(--ez-tree--font-weight);color:var(--ez-tree--color)}.item-label--bold{font-weight:var(--ez-tree--font-weight--bold)}.tree-item[selected] .item-label{color:var(--ez-tree--selected--color);font-weight:var(--ez-tree--selected--font-weight)}.tree-item[disabled] .item-label{color:var(--ez-tree--disabled--color)}";export{b as ez_tree}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e,c as t,h as o,H as a,g as i}from"./p-23a36bb6.js";import{KeyboardManager as n}from"@sankhyalabs/core";import{i as s}from"./p-641ee538.js";var l;!function(e){e.CLOSE="CLOSE",e.OK="OK",e.CANCEL="CANCEL",e.LOAD="LOAD"}(l||(l={}));const r=l;var c;!function(e){e.ENABLED="ENABLED",e.DISABLED="DISABLED",e.HIDDEN="HIDDEN"}(c||(c={}));const d=c,h=class{constructor(o){e(this,o),this.ezModalAction=t(this,"ezModalAction",7),this.modalTitle=void 0,this.modalSubTitle=void 0,this.showTitleBar=!0,this.cancelButtonLabel=void 0,this.okButtonLabel=void 0,this.cancelButtonStatus=void 0,this.okButtonStatus=void 0,this.showCloseButton=!0}async handleEzModalAction(e){var t;(null==e?void 0:e.target)&&(null==e?void 0:e.target)===(null===(t=this._element)||void 0===t?void 0:t.parentElement)&&this.closeModal()}cancelIsVisible(){return this.cancelButtonStatus!==d.HIDDEN&&null!=this.cancelButtonLabel}okIsVisible(){return this.okButtonStatus!==d.HIDDEN&&null!=this.okButtonLabel}async componentWillLoad(){this.i18n=await s()}componentDidLoad(){window.requestAnimationFrame((()=>{this.ezModalAction.emit(r.LOAD),this._modalRef.focus()})),this._keyboardManager=new n({propagate:!1,element:this._element}).bind("Enter",this.ezModalAction.emit.bind(r.OK)).bind("Escape",(()=>this.closeModal())).bind("Esc",(()=>this.closeModal()))}disconnectedCallback(){var e;null===(e=this._keyboardManager)||void 0===e||e.unbindAllShortcutKeys()}closeModal(){this.ezModalAction.emit("CLOSE")}focusLast(){null!=this._okButton&&this._okButton.setFocus()}focusFirst(){this._closeButton.focus()}render(){return o(a,null,o("button",{class:"ez-modal-container__focus-ctrl",onFocusin:()=>this.focusLast()}),o("div",{ref:e=>this._modalRef=e,tabIndex:-1,class:"ez-modal-container__header-container"},this.showTitleBar&&o("div",{class:"ez-modal-container__header ez-margin-bottom--medium"},o("div",{class:"ez-col ez-align--middle ez-modal-container__title"},o("h2",{class:"ez-text ez-title--large ez-title--primary ez-text--bold ez-margin-vertical--extra-small"},this.modalTitle),this.modalSubTitle&&o("div",{class:"ez-text ez-text--medium ez-text--primary ez-margin-vertical--extra-small"},this.modalSubTitle)),this.showCloseButton&&o("button",{ref:e=>this._closeButton=e,class:"ez-modal-container__close-button",onClick:()=>this.ezModalAction.emit(r.CLOSE),"aria-label":this.i18n("app.close")},o("ez-icon",{class:"ez-modal-container__close-icon",size:"medium",iconName:"close"})))),o("div",{tabIndex:-1,class:"ez-modal-container__content"},o("slot",null)),o("div",{tabIndex:-1,class:"ez-modal-container__footer"},this.cancelIsVisible()&&o("ez-button",{label:this.cancelButtonLabel||this.i18n("app.cancel"),enabled:this.cancelButtonStatus!==d.DISABLED,onClick:()=>this.ezModalAction.emit(r.CANCEL)}),this.okIsVisible()&&o("ez-button",{ref:e=>this._okButton=e,class:"ez-button--primary",label:this.okButtonLabel||this.i18n("app.ok"),enabled:this.okButtonStatus!==d.DISABLED,onClick:()=>this.ezModalAction.emit(r.OK)})),o("button",{class:"ez-modal-container__focus-ctrl",onFocusin:()=>this.focusFirst()}))}get _element(){return i(this)}};h.style=".sc-ez-modal-container-h{--ez-modal-container-overflow-y:auto;--ez-modal-container-overflow-x:hidden;display:grid;grid-template-rows:0 auto 1fr auto 0;width:100%;height:100%}.ez-modal-container__header-container.sc-ez-modal-container{outline:none}.ez-modal-container__header.sc-ez-modal-container{display:flex;flex-wrap:nowrap;flex-direction:row;justify-content:space-between;align-items:start}.ez-modal-container__content.sc-ez-modal-container{overflow-y:var(--ez-modal-container-overflow-y);overflow-x:var(--ez-modal-container-overflow-x);outline:none}.ez-modal-container__content.sc-ez-modal-container::-webkit-scrollbar{width:var(--space--small);min-width:var(--space--small);max-width:var(--space--small)}.ez-modal-container__footer.sc-ez-modal-container{display:flex;flex-direction:row;justify-content:flex-end;gap:var(--space--medium);width:100%;padding-top:var(--space--small, 6px)}.ez-modal-container__title.sc-ez-modal-container{display:grid}.ez-modal-container__close-button.sc-ez-modal-container{cursor:pointer;background-color:transparent;border:none;outline:none;padding:var(--space--6, 6px) 0px}.ez-modal-container__close-icon.sc-ez-modal-container{--icon--color:var(--title--primary, #2B3A54)}.ez-modal-container__focus-ctrl.sc-ez-modal-container{height:0px;background-color:transparent;border:none}";export{h as ez_modal_container}
|