@sankhyalabs/ezui 1.1.126 → 1.1.129

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.
Files changed (61) hide show
  1. package/dist/cjs/ez-calendar.cjs.entry.js +8 -8
  2. package/dist/cjs/ez-collapsible-box.cjs.entry.js +4 -4
  3. package/dist/cjs/ez-combo-box.cjs.entry.js +9 -9
  4. package/dist/cjs/ez-form.cjs.entry.js +16 -13
  5. package/dist/cjs/ez-grid.cjs.entry.js +4 -4
  6. package/dist/cjs/ez-tabselector.cjs.entry.js +2 -2
  7. package/dist/cjs/ezui.cjs.js +1 -1
  8. package/dist/cjs/grid-config.cjs.entry.js +1 -1
  9. package/dist/cjs/loader.cjs.js +1 -1
  10. package/dist/cjs/select-box.cjs.entry.js +1 -1
  11. package/dist/collection/components/ez-calendar/ez-calendar.css +2 -1
  12. package/dist/collection/components/ez-calendar/ez-calendar.js +7 -7
  13. package/dist/collection/components/ez-collapsible-box/ez-collapsible-box.css +2 -1
  14. package/dist/collection/components/ez-collapsible-box/ez-collapsible-box.js +8 -8
  15. package/dist/collection/components/ez-combo-box/ez-combo-box.css +17 -64
  16. package/dist/collection/components/ez-combo-box/ez-combo-box.js +11 -9
  17. package/dist/collection/components/ez-form/fieldbuilder/tpl/CheckBox.tpl.js +1 -1
  18. package/dist/collection/components/ez-form/fieldbuilder/tpl/ComboBox.tpl.js +1 -1
  19. package/dist/collection/components/ez-form/fieldbuilder/tpl/DateInput.tpl.js +3 -3
  20. package/dist/collection/components/ez-form/fieldbuilder/tpl/FileInput.tpl.js +1 -1
  21. package/dist/collection/components/ez-form/fieldbuilder/tpl/NumberInput.tpl.js +1 -1
  22. package/dist/collection/components/ez-form/fieldbuilder/tpl/SearchInput.tpl.js +1 -1
  23. package/dist/collection/components/ez-form/fieldbuilder/tpl/TextArea.tpl.js +1 -1
  24. package/dist/collection/components/ez-form/fieldbuilder/tpl/TextInput.tpl.js +1 -1
  25. package/dist/collection/components/ez-form/structure/FormSheet.js +2 -2
  26. package/dist/collection/components/ez-form/structure/FormSheetMetadata.js +4 -1
  27. package/dist/collection/components/ez-grid/ez-grid.js +7 -7
  28. package/dist/collection/components/ez-grid/subcomponents/gridconfig/grid-config.js +1 -1
  29. package/dist/collection/components/ez-grid/subcomponents/select-box/select-box.js +1 -1
  30. package/dist/collection/components/ez-tabselector/ez-tabselector.css +1 -1
  31. package/dist/collection/components/ez-tabselector/ez-tabselector.js +1 -1
  32. package/dist/custom-elements/index.js +45 -42
  33. package/dist/esm/ez-calendar.entry.js +8 -8
  34. package/dist/esm/ez-collapsible-box.entry.js +4 -4
  35. package/dist/esm/ez-combo-box.entry.js +9 -9
  36. package/dist/esm/ez-form.entry.js +16 -13
  37. package/dist/esm/ez-grid.entry.js +4 -4
  38. package/dist/esm/ez-tabselector.entry.js +2 -2
  39. package/dist/esm/ezui.js +1 -1
  40. package/dist/esm/grid-config.entry.js +1 -1
  41. package/dist/esm/loader.js +1 -1
  42. package/dist/esm/select-box.entry.js +1 -1
  43. package/dist/ezui/ezui.esm.js +1 -1
  44. package/dist/ezui/{p-248d8511.entry.js → p-2d165ca8.entry.js} +1 -1
  45. package/dist/ezui/p-47fe4273.entry.js +1 -0
  46. package/dist/ezui/p-593a17e7.entry.js +1 -0
  47. package/dist/ezui/p-5b7405e8.entry.js +1 -0
  48. package/dist/ezui/p-66adbed5.entry.js +1 -0
  49. package/dist/ezui/{p-b59ab2d5.entry.js → p-6d39b7ea.entry.js} +1 -1
  50. package/dist/ezui/p-6e844308.entry.js +1 -0
  51. package/dist/ezui/p-ef17f443.entry.js +1 -0
  52. package/dist/types/components/ez-collapsible-box/ez-collapsible-box.d.ts +2 -3
  53. package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +2 -1
  54. package/dist/types/components.d.ts +8 -8
  55. package/package.json +1 -1
  56. package/dist/ezui/p-1c28d99b.entry.js +0 -1
  57. package/dist/ezui/p-35edc488.entry.js +0 -1
  58. package/dist/ezui/p-7df61f4a.entry.js +0 -1
  59. package/dist/ezui/p-7f87f762.entry.js +0 -1
  60. package/dist/ezui/p-91706181.entry.js +0 -1
  61. package/dist/ezui/p-cf8309fc.entry.js +0 -1
@@ -0,0 +1 @@
1
+ import{h as e,r as t,c as i,f as n,H as r,g as o}from"./p-60138b72.js";import{UserInterface as a,Action as s,ApplicationContext as l,DataUnitAction as c,DataUnit as d}from"@sankhyalabs/core";import{A as u}from"./p-0cd386db.js";const h=({name:t,label:i})=>e("div",{class:"ez-col ez-col--sd-12 ez-col--tb-3 ez-padding-horizontal--small"},e("ez-text-input",{label:i,"data-field-name":t,key:t}));function f(t,i,n,r=!1){return e("div",{class:"ez-col ez-col--sd-12 ez-col--tb-3 ez-align--middle ez-padding-horizontal--small ez-padding-bottom--large"},e("ez-check",{enabled:!n,label:i,mode:r?"switch":"regular","data-field-name":t,key:t}))}function b(t,i,n,r,o){return e("div",{class:"ez-col ez-col--sd-12 ez-col--tb-3 ez-padding-horizontal--small"},e("ez-number-input",{enabled:!n,label:i,precision:r,prettyPrecision:o,"data-field-name":t,key:t}))}const p=new Map;p.set(a.LONGTEXT,(({name:t,label:i,readOnly:n})=>e("div",{class:"ez-col ez-col--sd-12 ez-padding-horizontal--small",key:t},e("ez-text-area",{enabled:!n,label:i,"data-field-name":t})))),p.set(a.CHECKBOX,(e=>f(e.name,e.label,e.readOnly,!1))),p.set(a.SWITCH,(e=>f(e.name,e.label,e.readOnly,!0))),p.set(a.OPTIONSELECTOR,(({name:t,label:i,readOnly:n,required:r},o)=>{const a=null==o?void 0:o.options;let s;if("string"==typeof a){const e=JSON.parse(a);s=Object.keys(e).map((t=>({value:t,label:e[t]})))}else s=a;return e("div",{class:"ez-col ez-col--sd-12 ez-col--tb-3 ez-padding-horizontal--small"},e("ez-combo-box",{enabled:!n,suppressEmptyOption:r,label:i,"data-field-name":t,key:t,options:s}))})),p.set(a.SEARCH,(({name:t,label:i,readOnly:n,required:r})=>e("div",{class:"ez-col ez-col--sd-12 ez-col--tb-3 ez-padding-horizontal--small"},e("ez-search",{enabled:!n,suppressEmptyOption:r,label:i,"data-field-name":t,key:t})))),p.set(a.FILE,(({name:t,label:i,readOnly:n})=>e("div",{class:"ez-col ez-col--sd-12 ez-padding-horizontal--small"},e("ez-upload",{enabled:!n,label:i,"data-field-name":t,key:t})))),p.set(a.DATE,(({name:t,label:i,readOnly:n})=>e("div",{class:"ez-col ez-col--sd-12 ez-col--tb-3 ez-padding-horizontal--small"},e("ez-date-input",{enabled:!n,label:i,"data-field-name":t,key:t})))),p.set(a.TIME,(({name:t,label:i})=>e("div",{class:"ez-col ez-col--sd-12 ez-col--tb-3 ez-padding-horizontal--small"},e("ez-time-input",{label:i,"data-field-name":t,key:t})))),p.set(a.DATETIME,(({name:t,label:i})=>e("div",{class:"ez-col ez-col--sd-12 ez-col--tb-3 ez-padding-horizontal--small"},e("ez-date-time-input",{label:i,"data-field-name":t,key:t})))),p.set(a.DECIMALNUMBER,(({name:e,label:t,readOnly:i},n)=>{const r=Number((null==n?void 0:n.precision)||2);return b(e,t,i,r,Number((null==n?void 0:n.prettyPrecision)||r))})),p.set(a.INTEGERNUMBER,(({name:e,label:t,readOnly:i})=>b(e,t,i,0,0)));const m=e=>{const t=e.descriptor,i=Object.assign({},e.config);let n,r;return t&&(i.label||(i.label=t.label),i.name||(i.name=t.name),void 0===i.required&&(i.required=t.required),void 0===i.readOnly&&(i.readOnly=t.readOnly),r=t.properties,n=p.get(t.userInterface)),i.required&&(i.label=`* ${i.label} (obrigatório)`),n||(n=h),n(i,r)},z=({source:t})=>"items"in t?e("ez-collapsible-box",{label:t.label,"header-size":"large"},t.items.map((e=>m(e)))):m(t),v=({store:t,source:i})=>e("div",{class:"dynamic-content ez-box__container"},e("div",{class:"ez-row ez-padding-vertical--small"},i.items.map((i=>e(z,{store:t,source:i})))));class y{constructor(){this._sheets=new Map,this._requiredFields=[],this._cleanOnCopyFields=[]}getSheet(e){return this._sheets.get(e)}getAllSheets(){return this._sheets}addSheet(e){this._sheets.set(e.name,e),this._requiredFields=this._requiredFields.concat(e.requiredFields),this._cleanOnCopyFields=this._cleanOnCopyFields.concat(e.cleanOnCopyFields)}getRequiredFields(){return this._requiredFields}getCleanOnCopyFields(){return this._cleanOnCopyFields}}function g(e,t){return"Geral"==e[0].label?-1:(e[0].order||1e4)-(t[0].order||1e4)}function _(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var w="function"==typeof Symbol&&Symbol.observable||"@@observable",O=function(){return Math.random().toString(36).substring(7).split("").join(".")},E={INIT:"@@redux/INIT"+O(),REPLACE:"@@redux/REPLACE"+O(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+O()}};function A(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function C(e,t,i){var n;if("function"==typeof t&&"function"==typeof i||"function"==typeof i&&"function"==typeof arguments[3])throw new Error(_(0));if("function"==typeof t&&void 0===i&&(i=t,t=void 0),void 0!==i){if("function"!=typeof i)throw new Error(_(1));return i(C)(e,t)}if("function"!=typeof e)throw new Error(_(2));var r=e,o=t,a=[],s=a,l=!1;function c(){s===a&&(s=a.slice())}function d(){if(l)throw new Error(_(3));return o}function u(e){if("function"!=typeof e)throw new Error(_(4));if(l)throw new Error(_(5));var t=!0;return c(),s.push(e),function(){if(t){if(l)throw new Error(_(6));t=!1,c();var i=s.indexOf(e);s.splice(i,1),a=null}}}function h(e){if(!A(e))throw new Error(_(7));if(void 0===e.type)throw new Error(_(8));if(l)throw new Error(_(9));try{l=!0,o=r(o,e)}finally{l=!1}for(var t=a=s,i=0;i<t.length;i++)(0,t[i])();return e}function f(e){if("function"!=typeof e)throw new Error(_(10));r=e,h({type:E.REPLACE})}function b(){var e,t=u;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new Error(_(11));function i(){e.next&&e.next(d())}return i(),{unsubscribe:t(i)}}})[w]=function(){return this},e}return h({type:E.INIT}),(n={dispatch:h,subscribe:u,getState:d,replaceReducer:f})[w]=b,n}const x={};function R(e=x,t){switch(t.type){case j.METADATA_LOADED:return Object.assign(Object.assign({},e),{formMetadata:t.payload});case j.CHANGE_TAB:return Object.assign(Object.assign({},e),{currentSheet:t.payload});default:return e}}function N(e){return e.formMetadata}var j;!function(e){e.METADATA_LOADED="FORM/METADATA_LOADED",e.CHANGE_TAB="FORM/CHANGE_TAB"}(j||(j={}));class k{constructor(e){this.onDataUnitEvent=e=>{var t;switch(e.type){case s.DATA_LOADED:case s.DATA_SAVED:case s.RECORDS_REMOVED:case s.RECORDS_ADDED:case s.RECORDS_COPIED:case s.DATA_CHANGED:case s.EDITION_CANCELED:case s.CHANGE_UNDONE:case s.CHANGE_REDONE:case s.SELECTION_CHANGED:case s.NEXT_SELECTED:case s.PREVIOUS_SELECTED:null===(t=this._fields)||void 0===t||t.forEach((e=>{this.updateValue(e.fieldName,e.field)}))}},this._fields=new Map,this._dataUnit=e,this._dataUnit.subscribe(this.onDataUnitEvent)}bind(e){e.forEach((e=>{this.updateBind(e.dataset.fieldName,e)}))}onDisconnectedCallback(){this._dataUnit.unsubscribe(this.onDataUnitEvent)}updateValue(e,t){const i=t.value,n=this._dataUnit.getFieldValue(e);i!=n&&(t.value=n)}updateBind(e,t){const i=this._fields.get(e);i&&i.destroy(),t.value=this._dataUnit.getFieldValue(e),this._fields.set(e,S.create(e,t,((e,t)=>this.changeStarted(e,t)),((e,t)=>this.setFieldValue(e,t)))),this.bindSearchOptionsLoader(e,t),this.applyEzUploadContext(e,t)}changeStarted(e,t){0===this._dataUnit.records.length&&this._dataUnit.addRecord(),this._dataUnit.startChange(e,t)}setFieldValue(e,t){0===this._dataUnit.records.length&&this._dataUnit.addRecord(),this._dataUnit.setFieldValue(e,t)}bindSearchOptionsLoader(e,t){if("EZ-SEARCH"===t.nodeName&&void 0===t.optionLoader){const i=l.getContextValue("__EZUI__SEARCH__OPTION__LOADER__");i&&(t.optionLoader=t=>i(t,e,this._dataUnit))}}applyEzUploadContext(e,t){var i,n;if("EZ-UPLOAD"===t.nodeName){t.urlUpload=l.getContextValue("__EZUI__UPLOAD__ADD__URL__"),t.urlDelete=l.getContextValue("__EZUI__UPLOAD__DEL__URL__");const r=this._dataUnit.getField(e),o=null===(i=r.properties)||void 0===i?void 0:i.DESTINATION;o&&(t.requestHeaders={XTRAINF:`{"destination": "${o}"}`}),t.maxFiles=(null===(n=r.properties)||void 0===n?void 0:n.MAX_FILES)||0}}}class S{constructor(){this.startChangeEventName="ezStartChange",this.changeEventName="ezChange"}destroy(){this.field.removeEventListener(this.startChangeEventName,this.startChangeListener),this.field.removeEventListener(this.changeEventName,this.changeListener)}static create(e,t,i,n){const r=new S;return r.field=t,r.fieldName=e,r.startChangeListener=t=>{i(e,t.detail)},r.field.addEventListener(r.startChangeEventName,r.startChangeListener),r.changeListener=t=>{n(e,t.detail)},r.field.addEventListener(r.changeEventName,r.changeListener),r}}let D=class{constructor(e){t(this,e),this.ezReady=i(this,"ezReady",7),this.onDataUnitAction=e=>{e.type===s.METADATA_LOADED&&this.processMetadata()}}submit(){return Promise.resolve()}cancel(){return Promise.resolve()}validate(){return new Promise(((e,t)=>{const i=N(this._store.getState()),n=this._staticFields.filter((e=>e.dataset.required)).map((e=>e.dataset.fieldName)).concat(i.getRequiredFields()),r=this.dataUnit.records;for(let e=0;e<r.length;e++)if(!this.validateRequired(n,r[e])){t();break}e()}))}configChanged(){this.processMetadata()}validateRequired(e,t){const i=[];e.forEach((e=>{const n=t[e],r=this._element.querySelector(`[data-field-name=${e}]`);null==n||""===n?(i.push(e),r.errorMessage="Essa informação é obrigatória"):r.errorMessage=""}));const n=0===i.length;return n||u.info("Há pelo menos um campo obrigatório não preenchido."),n}getDynamicContent(){var t;const i=N(this._store.getState());if(!i)return null;const n=(r=null===(t=this._store)||void 0===t?void 0:t.getState()).currentSheet?r.formMetadata.getSheet(r.currentSheet):Array.from(r.formMetadata.getAllSheets().values())[0];var r;if(!n)return null;const o=Array.from(i.getAllSheets().values()),a=[];return o.length>1&&a.push(e("ez-tabselector",{onEzChange:e=>this._store.dispatch(function(e){return{type:j.CHANGE_TAB,payload:e.tabKey}}(e.detail)),selectedTab:n.name},o.map((t=>e("ez-tab",{tabKey:t.name,label:t.label}))))),a.push(e(v,{store:this._store,source:n})),a}processMetadata(){if(!this.isStatic()){const e=this.config&&this.config.length>0?((e,t)=>{const i=new Map,n=[],r=[];e.forEach((e=>{var o;if(!1!==e.visible){const a=function(e,t){return("string"==typeof e?Array.from(t.keys()).find((t=>t.label===e)):e)||{label:e,visible:!0}}(e.tab||"Geral",i),s=t.getField(e.name);if(s&&a.visible){i.has(a)||i.set(a,new Map);const t=i.get(a);(void 0===e.required?s.required:e.required)&&n.push(e.name),(void 0===e.cleanOnCopy?null===(o=s.properties)||void 0===o?void 0:o.cleanOnCopy:e.cleanOnCopy)&&r.push(e.name);const l={config:e,descriptor:s},c=e.group;if(c){const e=`group::${c}`;t.has(e)?t.get(e).items.push(l):t.set(e,{label:c,items:[l]})}else t.set(e.name,l)}}}));const o=new y;return Array.from(i.entries()).sort(g).forEach((([e,t])=>{o.addSheet({label:e.label,name:e.label,items:Array.from(t.values()),requiredFields:n,cleanOnCopyFields:r})})),o})(this.config,this.dataUnit):(()=>{var e;const t=this.dataUnit.metadata,i=new y;if(t){const n=null===(e=t.fields)||void 0===e?void 0:e.filter((e=>!1!==e.visible));i.addSheet({label:t.label,name:t.name,items:n.map((e=>({descriptor:e}))),requiredFields:n.filter((e=>e.required)).map((e=>e.name)),cleanOnCopyFields:n.filter((e=>{var t;return null===(t=e.properties)||void 0===t?void 0:t.cleanOnCopy})).map((e=>e.name))})}return i})();this._store.dispatch({type:j.METADATA_LOADED,payload:e})}}isStatic(){var e;return(null===(e=this._staticFields)||void 0===e?void 0:e.length)>0}interceptAction(e){if(e.type===s.RECORDS_COPIED){const t=N(this._store.getState()).getCleanOnCopyFields();if(t)return new c(s.RECORDS_COPIED,e.payload.map((e=>{const i=Object.assign({},e);return t.forEach((e=>delete i[e])),i})))}return e}componentWillLoad(){void 0===this.dataUnit&&(this.dataUnit=new d("ez-form")),this.dataUnit.addInterceptor(this),this.dataUnit.subscribe(this.onDataUnitAction),this._dataBinder=new k(this.dataUnit),this._store=C(R),this._store.subscribe((()=>n(this))),this._staticFields=Array.from(this._element.querySelectorAll("[data-field-name]")),this.processMetadata()}componentDidRender(){this._dataBinder.bind(Array.from(this._element.querySelectorAll("[data-field-name]"))),this.ezReady.emit()}disconnectedCallback(){this.dataUnit.unsubscribe(this.onDataUnitAction),this.dataUnit.removeInterceptor(this),this._dataBinder.onDisconnectedCallback()}render(){return e(r,null,this.isStatic()?null:this.getDynamicContent())}get _element(){return o(this)}static get watchers(){return{config:["configChanged"]}}};D.style="ez-form{display:flex;flex-direction:column;width:100%}.dynamic-content ez-collapsible-box{--ez-collapsible-box__header--padding-right:var(--space-small, 6px);--ez-collapsible-box__header--padding-left:var(--space-small, 6px)}";export{D as ez_form}
@@ -0,0 +1 @@
1
+ import{r as a,c as e,f as r,h as l}from"./p-60138b72.js";import{FloatingManager as t}from"@sankhyalabs/core";let i=class{constructor(r){a(this,r),this.ezChange=e(this,"ezChange",7),this._firstRender=!0,this._todayLabel="Hoje",this._weekDayLabels=["D","S","T","Q","Q","S","S"],this._monthLabels=["Janeiro","Fevereiro","Março","Abril","Maio","Junho","Julho","Agosto","Setembro","Outubro","Novembro","Dezembro"],this._hoursLabel=["00","01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22","23"],this._minutosLabel=["00","01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40","41","42","43","44","45","46","47","48","49","50","51","52","53","54","55","56","57","58","59"],this.value=new Date,this.floating=!1,this.time=!1,this.showSeconds=!1}async show(a,e,r,l){this.floating&&(this._floatingID=t.float(this._box,this._container,{autoClose:!0,top:a,left:e,bottom:r,right:l}),window.requestAnimationFrame((()=>{this._box.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})})),this.scroll())}async fitVertical(a,e){const r=this._container.getBoundingClientRect().bottom+this._calendarHeight;(window.innerHeight||document.documentElement.clientHeight)>r?this.show(a+"px",void 0,"unset"):this.show("unset",void 0,e+"px")}async hide(){void 0!==this._floatingID&&(t.close(this._floatingID),this._floatingID=void 0)}valueChanged(){this.value&&(this._currentPosition.setTime(this.value.getTime()),this._currentPosition.setDate(1))}getMonthLabel(){return this._monthLabels[this._currentPosition.getMonth()]+" "+this._currentPosition.getFullYear()}isSelectedDate(a){return!!this.value&&this.value.getDate()==a.getDate()&&this.value.getMonth()==a.getMonth()&&this.value.getFullYear()==a.getFullYear()}changeMonth(a){this._currentPosition.setMonth(this._currentPosition.getMonth()+a),r(this)}selectDate(a){let e=a;this.value&&(this.time||this.showSeconds)&&(e.setHours(this.value.getHours()),e.setMinutes(this.value.getMinutes()),e.setSeconds(this.showSeconds?this.value.getSeconds():0)),this.value=e,this.ezChange.emit(this.value)}selectHours(a){this.value||(this.value=new Date),this.value=new Date(this.value.getFullYear(),this.value.getMonth(),this.value.getDate(),a,this.value.getMinutes(),this.value.getSeconds()),this.ezChange.emit(this.value)}selectMinutes(a){this.value||(this.value=new Date),this.value=new Date(this.value.getFullYear(),this.value.getMonth(),this.value.getDate(),this.value.getHours(),a,this.value.getSeconds()),this.ezChange.emit(this.value)}selectSeconds(a){this.value||(this.value=new Date),this.value=new Date(this.value.getFullYear(),this.value.getMonth(),this.value.getDate(),this.value.getHours(),this.value.getMinutes(),a),this.ezChange.emit(this.value)}updateScroll(a){if(a){const{scrollHeight:e,clientHeight:r,scrollTop:l}=a;e-r-Math.ceil(l)>0?a.classList.add("endHidden"):a.classList.remove("endHidden")}}componentDidRender(){this.floating&&this._firstRender&&(this._calendarHeight=this._box.clientHeight,this._box.remove(),this._firstRender=!1),this.updateScroll(this._hoursScroll),this.updateScroll(this._minutesScroll),this.updateScroll(this._secondsScroll)}componentDidLoad(){this.scroll()}scroll(){(this.time||this.showSeconds)&&(this._hoursScroll.scrollTop=this._hoursSelect.offsetTop-64,this._minutesScroll.scrollTop=this._minutesSelect.offsetTop-64,this.updateScroll(this._hoursScroll),this.updateScroll(this._minutesScroll),this.showSeconds&&(this._secondsScroll.scrollTop=this._secondsSelect.offsetTop-64,this.updateScroll(this._secondsScroll)))}render(){null==this._currentPosition&&(this._currentPosition=new Date,this.value&&this._currentPosition.setTime(this.value.getTime()),this._currentPosition.setDate(1));const a=new Date;return a.setTime(this._currentPosition.getTime()),a.setDate(1-a.getDay()),l("section",{ref:a=>this._container=a},l("div",{ref:a=>this._box=a,class:"calendar__container"},l("div",{class:"calendar"},l("div",{class:"calendar__header"},l("button",{class:"calendar__btn-previous",onClick:()=>this.changeMonth(-1)}),l("label",{class:"calendar__lbl-month"},this.getMonthLabel()),l("button",{class:"calendar__btn-next",onClick:()=>this.changeMonth(1)})),l("div",{class:"calendar__body"},l("div",{class:"calendar__line"},this._weekDayLabels.map((a=>l("div",{"data-day":a,class:"calendar__cell calendar__cell--unselectable"},a)))),[0,7,14,21,28,35].map((e=>l("div",{class:"calendar__line"},[0,1,2,3,4,5,6].map((r=>{const t=new Date;t.setTime(a.getTime()),t.setDate(t.getDate()+e+r);let i="calendar__cell";return this._currentPosition.getMonth()!=t.getMonth()?i+=" calendar__cell--secondary":this.isSelectedDate(t)&&(i+=" calendar__cell--selected"),l("div",{class:i,onClick:()=>this.selectDate(t)},t.getDate())})))))),l("div",{class:"calendar__footer"},l("button",{class:"calendar__btn-today",onClick:()=>this.selectDate(new Date)},this._todayLabel))),(this.time||this.showSeconds)&&l("div",{class:"calendar-time"},l("div",{class:"calendar-time__header"},l("div",null,"H"),l("div",{class:"separatorTime"},":"),l("div",null,"M"),this.showSeconds&&l("div",{class:"separatorTime"},":"),this.showSeconds&&l("div",null,"S")),l("div",{class:"calendar__body ",style:{display:"flex",paddingLeft:"12px",paddingRight:"12px"}},l("div",{class:"calendar__column",ref:a=>this._hoursScroll=a,onScroll:()=>this.updateScroll(this._hoursScroll)},this._hoursLabel.map(((a,e)=>e===this.value.getHours()?l("div",{style:{display:"flex"},ref:a=>this._hoursSelect=a},l("div",{"data-hour":a,class:"calendar__cell calendar__cell--selected",onClick:()=>this.selectHours(e)},a),l("div",{class:"separatorTime"},":")):l("div",{style:{display:"flex"}},l("div",{"data-hour":a,class:"calendar__cell",onClick:()=>this.selectHours(e)},a),l("div",{class:"separatorTime"},":"))))),l("div",{class:"calendar__column",ref:a=>this._minutesScroll=a,onScroll:()=>this.updateScroll(this._minutesScroll)},this._minutosLabel.map(((a,e)=>e===this.value.getMinutes()?l("div",{style:{display:"flex"},ref:a=>this._minutesSelect=a},l("div",{"data-minute":a,class:"calendar__cell calendar__cell--selected",onClick:()=>this.selectMinutes(e)},a),this.showSeconds&&l("div",{class:"separatorTime"},":")):l("div",{style:{display:"flex"}},l("div",{"data-minute":a,class:"calendar__cell",onClick:()=>this.selectMinutes(e)},a),this.showSeconds&&l("div",{class:"separatorTime"},":"))))),this.showSeconds&&l("div",{class:"calendar__column",ref:a=>this._secondsScroll=a,onScroll:()=>this.updateScroll(this._secondsScroll)},this._minutosLabel.map(((a,e)=>e===this.value.getSeconds()?l("div",{"data-second":a,class:"calendar__cell calendar__cell--selected",onClick:()=>this.selectSeconds(e),ref:a=>this._secondsSelect=a},a):l("div",{"data-second":a,class:"calendar__cell",onClick:()=>this.selectSeconds(e)},a))))))))}static get watchers(){return{value:["valueChanged"]}}};i.style=':host{--ez-calendar--font-family:var(--font-pattern, Arial);--ez-calendar--color:var(--title--primary, #626e82);--ez-calendar--text-shadow:var(--text-shadow, 0 0 0 #353535, 0 0 1px transparent);--ez-calendar__body--background-color:var(--background--xlight, #FFF);--ez-calendar__time--background-color:var(--background--xlight, #FAFAFA);--ez-calendar__body--padding:var(--space--medium, 12px) var(--space--small, 6px);--ez-calendar__body--border-radius:var(--border--radius-medium, 12px);--ez-calendar__body--shadow:var(--shadow, 0px 0px 16px 0px #000);--ez-container--z-index:var(--more-visible, 2);--ez-calendar__header-line--stroke:1px;--ez-calendar__header-line--color:var(--color--strokes, #C0C0C0);--ez-calendar__nav-btn--fill:var(--text--primary, #008561);--ez-calendar__nav-btn--hover--fill:var(--color--primary, #350404);--ez-calendar__nav-btn--width:10px;--ez-calendar__nav-btn--height:16px;--ez-calendar__nav-btn--previous-image:url(\'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" height="16px" width="10px"><path d="M 9.7808475,13.860393 3.9204526,8.0000004 9.7808475,2.0624965 7.9301965,0.28895552 0.21915255,8.0000004 7.9301965,15.711044 Z"/></svg>\');--ez-calendar__nav-btn--next-image:url(\'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" height="16px" width="10px"><path d="M 0.21915251,13.860393 6.0795475,8.0000007 0.21915251,2.0624968 2.0698036,0.28895588 9.7808475,8.0000007 2.0698036,15.711044 Z"/></svg>\');--ez-calendar__cell--margin:0px 1.5px;--ez-calendar__cell--width:var(--space--large, 24px);--ez-calendar__cell--padding:1.5px 0px;--ez-calendar__cell--border-radius:var(--border--radius-small, 6px);--ez-calendar__cell--over--background-color:var(--color--primary, #E2F4EF);--ez-calendar__cell--over--color:var(--color--primary-300, #008561);--ez-calendar__cell--outset--color:var(--color--disable-primary, #E5EAF0);--ez-calendar__cell--selected--background-color:var(--color--primary, #008561);--ez-calendar__cell--selected--color:var(--color--inverted, #FFF);--ez-calendar__btn-today--color:var(--color--primary);--ez-calendar__btn-today--hover--background-color:var(--color--primary-300, #E2F4EF);--ez-calendar__btn-today--border-radius:var(--border--radius-small, 6px);position:relative;display:flex;user-select:none}.calendar__container{display:flex;z-index:var(--more-visible, 2)}.calendar{z-index:var(--more-visible, 2);display:flex;flex-direction:column;background-color:var(--ez-calendar__body--background-color);padding:var(--ez-calendar__body--padding);border-radius:var(--ez-calendar__body--border-radius);box-shadow:var(--ez-calendar__body--shadow)}.calendar__header{display:flex;justify-content:space-between;padding-bottom:var(--space--small, 6px);margin:0px var(--space--, 12px) var(--space--small, 6px) var(--space--, 12px);font-family:var(--ez-calendar--font-family);color:var(--ez-calendar--color);text-shadow:var(--ez-calendar--text-shadow);border-bottom:solid var(--ez-calendar__header-line--stroke) var(--ez-calendar__header-line--color)}.calendar__btn-next,.calendar__btn-previous{outline:none;border:none;background-color:unset;cursor:pointer;padding:0px}.calendar__btn-next::after,.calendar__btn-previous::after{content:\'\';display:flex;background-color:var(--ez-calendar__nav-btn--fill);width:var(--ez-calendar__nav-btn--width);height:var(--ez-calendar__nav-btn--height)}.calendar__btn-previous::after{-webkit-mask-image:var(--ez-calendar__nav-btn--previous-image);mask-image:var(--ez-calendar__nav-btn--previous-image)}.calendar__btn-next::after{-webkit-mask-image:var(--ez-calendar__nav-btn--next-image);mask-image:var(--ez-calendar__nav-btn--next-image)}.calendar__btn-next:hover::after,.calendar__btn-previous:hover::after{background-color:var(--ez-calendar__nav-btn--hover--fill)}.calendar__lbl-month{font-weight:var(--text-weight--extra-large, 700);font-size:var(--title--small, 14px);font-family:var(--ez-calendar--font-family);color:var(--ez-calendar--color);text-shadow:var(--ez-calendar--text-shadow)}.calendar__line{display:flex;padding:0px;margin:0px}.calendar__cell{display:flex;justify-content:center;align-content:center;cursor:pointer;font-size:var(--text--extra-small, 10px);font-family:var(--ez-calendar--font-family);color:var(--ez-calendar--color);text-shadow:var(--ez-calendar--text-shadow);padding:var(--ez-calendar__cell--padding);margin:var(--ez-calendar__cell--margin);min-width:var(--ez-calendar__cell--width);border-radius:var(--ez-calendar__cell--border-radius)}.calendar__cell:hover{background-color:var(--ez-calendar__cell--over--background-color);color:var(--ez-calendar__cell--over--color)}.calendar__cell--secondary{color:var(--ez-calendar__cell--outset--color)}.calendar__cell--unselectable:hover{background-color:unset;border-radius:unset;cursor:unset;color:var(--ez-calendar--color)}.calendar__cell--unselectable{font-weight:var(--text-weight--large, 600);font-family:var(--ez-calendar--font-family);color:var(--ez-calendar--color);text-shadow:var(--ez-calendar--text-shadow)}.calendar__cell--selected,.calendar__cell--selected:hover{background-color:var(--ez-calendar__cell--selected--background-color);color:var(--ez-calendar__cell--selected--color)}.calendar__footer{display:flex;flex-direction:column}.calendar__btn-today{border:none;background-color:unset;cursor:pointer;font-weight:var(--text-weight--large, 600);font-size:var(--title--extra-small, 12px);padding:0px;font-family:var(--ez-calendar--font-family);text-shadow:var(--ez-calendar--text-shadow);color:var(--ez-calendar__btn-today--color);border-radius:var(--ez-calendar__btn-today--border-radius)}.calendar__btn-today:hover{background-color:var(--ez-calendar__btn-today--hover--background-color)}section{display:flex}.calendar-time{margin-left:-10px;display:flex;flex-direction:column;padding:12px 0px 0px 10px;background-color:var(--ez-calendar__time--background-color);border-top-right-radius:var(--ez-calendar__body--border-radius);border-bottom-right-radius:var(--ez-calendar__body--border-radius);box-shadow:var(--ez-calendar__body--shadow)}.calendar__column{height:136px;padding:0px;margin:0px;overflow:auto}.calendar__column::-webkit-scrollbar{width:0px;max-width:0px;min-width:0px}.calendar-time__header{padding-left:var(--space--small, 6px);padding-right:var(--space--small, 6px);display:flex;justify-content:space-between;padding-bottom:var(--space--small, 6px);margin:0px var(--space--, 12px) var(--space--small, 6px) var(--space--, 12px);font-weight:var(--text-weight--extra-large, 700);font-size:var(--title--small, 14px);font-family:var(--ez-calendar--font-family);color:var(--ez-calendar--color);text-shadow:var(--ez-calendar--text-shadow);border-bottom:solid var(--ez-calendar__header-line--stroke) var(--ez-calendar__header-line--color);font-family:var(--ez-calendar--font-family);color:var(--ez-calendar--color);text-shadow:var(--ez-calendar--text-shadow)}.separatorTime{color:#A2ABB9;padding:0px 1px;line-height:16px;font-size:17px;font-weight:normal}.endHidden{-webkit-mask-image:linear-gradient(180deg, #000 calc(100% - 48px), transparent 100%)}.calendar__column .calendar__cell{margin:0px;padding:1.5px 1.5px}';export{i as ez_calendar}
@@ -0,0 +1 @@
1
+ import{r as e,c as t,h as o}from"./p-60138b72.js";let s=class{constructor(o){e(this,o),this.ezChange=t(this,"ezChange",7),this.selectedOption={value:"na",label:"N/A"}}render(){return o("ez-combo-box",{class:"grid-config-combo ez-input--inverted",label:"",suppressSearch:!0,value:this.selectedOption,enabled:!0,canShowError:!1,suppressEmptyOption:!0},o("option",{value:"na"},"N/A"),o("option",{value:"asc"},"A-Z"),o("option",{value:"desc"},"Z-A"))}static get assetsDirs(){return["../assets"]}};s.style="ez-combo-box{width:100px}.grid-config-combo{--ez-text-input--height:28px;--ez-text-input__input--background-color:#fff;--ez-text-input__input--border-color:#dce0e8}";export{s as select_box}
@@ -0,0 +1 @@
1
+ import{r as t,c as i,h as s,H as e,g as a}from"./p-60138b72.js";let o=class{constructor(s){t(this,s),this.ezChange=i(this,"ezChange",7),this.setFocusedParam=t=>{if("Enter"===t.key){const i=this._processedTabs[this._focusedIndex];this.handleTabClick(i),t.preventDefault(),this.setFocusedTab(i.index)}else if("ArrowLeft"===t.key||"ArrowRight"===t.key){let i;if("ArrowLeft"===t.key)i=!1;else{if("ArrowRight"!==t.key)return;i=!0}this._focusedIndex=void 0===this._focusedIndex?!1===i?void 0!==this.selectedIndex?this.selectedIndex-1:void 0:void 0!==this.selectedIndex?this.selectedIndex+1:void 0:!1===i?this._focusedIndex-1:this._focusedIndex+1,this._focusedIndex<0?this._focusedIndex=0:this._focusedIndex>this._processedTabs.length-1&&(this._focusedIndex=this._processedTabs.length-1),this.setFocusedBtn(!0,this._focusedIndex),this.setFocusedTab(this._focusedIndex)}else if("Tab"===t.key||"Escape"===t.key){const i=this._processedTabs[this.selectedIndex];this._focusedIndex=void 0,this.handleTabClick(i),t.preventDefault(),this.setFocusedTab(this.selectedIndex)}}}handleTabClick(t){this.selectedIndex=t.index,this._focusedIndex=void 0,this.selectedTab=t.tabKey,this.ezChange.emit(t),this.setFocusedBtn(!1,t.index)}componentWillRender(){this._processedTabs||(this._processedTabs=[],this.tabs&&this.tabs.split(",").forEach((t=>{t=t.trim(),this._processedTabs.push({label:t,tabKey:t,index:this._processedTabs.length})})),this._hostElem.querySelectorAll("ez-tab").forEach((t=>{const i=t.getAttribute("tabKey"),s={label:t.getAttribute("label"),tabKey:i,index:this._processedTabs.length},e=t.firstChild;e&&(e.setAttribute("slot","tab"+s.index),this._hostElem.appendChild(e)),this._processedTabs.push(s)})))}handleSlotChange(t){const i=t.target.assignedElements()[0];i&&(i.style.marginLeft="6px")}scrollBackward(){const t=this._scrollContainer;t&&(t.scrollLeft-=t.clientWidth)}scrollFoward(){const t=this._scrollContainer;if(t){let i=null;t.querySelectorAll(".tab").forEach((s=>{s.getBoundingClientRect().right<t.clientWidth&&(i=s)})),t.scrollLeft=i.offsetLeft+i.offsetWidth}}componentDidRender(){this.updateScroll()}updateScroll(){const t=this._scrollContainer;if(t){const{scrollWidth:i,clientWidth:s,scrollLeft:e}=t,a=i-s-Math.ceil(e);this._startHidden=t.scrollLeft>0,this._endHidden=a>0,this._startHidden?this._backwardButton.classList.remove("hidden"):this._backwardButton.classList.add("hidden"),this._endHidden?this._forwardButton.classList.remove("hidden"):this._forwardButton.classList.add("hidden");const o=["","startHidden","endHidden","middle"],r=o[Number(this._startHidden)|Number(this._endHidden)<<1];o.forEach((i=>{i!==r&&t.classList.contains(i)&&t.classList.remove(i)})),r&&!t.classList.contains(r)&&t.classList.add(r)}}domScrollHandler(){window.clearTimeout(this._scrollCallBack),this._scrollCallBack=window.setTimeout((()=>{this.updateScroll()}),200)}setFocusedTab(t){window.clearTimeout(this._scrollCallBackTest),this._scrollCallBackTest=window.setTimeout((()=>{this._scrollContainer.querySelector(`#tab${t}`).scrollIntoView()}),200)}getTextWidth(t){void 0===this._textMesurement&&(this._textMesurement=this._hostElem.shadowRoot.ownerDocument.createElement("canvas"));const i=this._textMesurement.getContext("2d");return i.font="14px Sora, Algerian",Math.min(220,24+i.measureText(t).width)+"px"}setFocusedBtn(t,i){this._scrollContainer.querySelectorAll(".tab").forEach((s=>{s.classList.remove("is-focused"),s.id==="tab"+i&&t&&s.classList.add("is-focused")}))}render(){return s(e,null,s("button",{class:"backward-button",ref:t=>this._backwardButton=t,onClick:()=>this.scrollBackward()}),s("div",{class:"scroll",ref:t=>this._scrollContainer=t,onScroll:()=>this.domScrollHandler(),onKeyDown:t=>this.setFocusedParam(t)},this._processedTabs.map(((t,i)=>{const e={"min-width":this.getTextWidth(t.label)},a="tab"+i,o=i===this.selectedIndex||this.selectedTab&&t.tabKey===this.selectedTab;return o&&(this.selectedTab=t.tabKey,this.selectedIndex=i),s("button",{id:a,class:"tab"+(o?" is-active":""),onClick:()=>this.handleTabClick(t),style:e},s("span",{class:"tab-label",title:t.label},t.label),s("slot",{name:a,onSlotchange:t=>{this.handleSlotChange(t)}}))}))),s("button",{class:"forward-button",ref:t=>this._forwardButton=t,onClick:()=>this.scrollFoward()}))}get _hostElem(){return a(this)}};o.style='@keyframes activate{0%{clip-path:inset(calc(100% - 3px) 50% 0px 50%)}100%{clip-path:inset(calc(100% - 3px) 0px 0px 0px)}}:host{display:flex;position:relative;width:100%;overflow:hidden;--tabselector--backward-icon:url(\'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" height="16px" width="10px"><path d="M 9.7808475,13.860393 3.9204526,8.0000004 9.7808475,2.0624965 7.9301965,0.28895552 0.21915255,8.0000004 7.9301965,15.711044 Z"/></svg>\');--tabselector--forward-icon:url(\'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" height="16px" width="10px"><path d="M 0.21915251,13.860393 6.0795475,8.0000007 0.21915251,2.0624968 2.0698036,0.28895588 9.7808475,8.0000007 2.0698036,15.711044 Z"/></svg>\')}.scroll{display:flex;width:100%;scroll-behavior:smooth;overflow-x:auto;scrollbar-width:none}.scroll.startHidden{-webkit-mask-image:linear-gradient(90deg, transparent 20px, #000 48px)}.scroll.middle{-webkit-mask-image:linear-gradient(90deg, transparent 20px, #000 48px, #000 calc(100% - 48px), transparent calc(100% - 20px))}.scroll.endHidden{-webkit-mask-image:linear-gradient(90deg, #000 calc(100% - 48px), transparent calc(100% - 20px))}.tab{display:flex;border:none;min-width:100px;background-color:unset;cursor:pointer;padding:6px 12px;align-items:center;justify-content:center;color:var(--text--primary, #626e82);font-family:var(--font-pattern, "Sora, Algerian");font-size:var(--title--small, 14px)}.tab:focus,.forward-button,.backward-button{outline:none}.is-active{position:relative;color:var(--color--primary, #008561)}.is-active::after{content:"";position:absolute;width:100%;height:100%;background-color:var(--color--primary, #008561);clip-path:inset(calc(100% - 3px) 0px 0px 0px);animation:activate 0.25s ease-in-out}.is-focused{border:1px dashed var(--color--primary, #000000c5)}.tab-label{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;text-shadow:var(--text-shadow);margin-bottom:var(--space--extra-small, 3px)}.forward-button,.backward-button{position:absolute;z-index:1;display:flex;box-sizing:border-box;padding:0px;top:0px;right:0px;width:16px;height:100%;border:none;background-color:unset;cursor:pointer;justify-content:center;align-items:center}.backward-button{left:0px}.forward-button::after,.backward-button::after{content:\'\';display:flex;background-color:var(--text--primary, #008561);width:10px;height:16px}.forward-button::after{-webkit-mask-image:var(--tabselector--forward-icon);mask-image:var(--tabselector--forward-icon)}.backward-button::after{-webkit-mask-image:var(--tabselector--backward-icon);mask-image:var(--tabselector--backward-icon)}.forward-button:hover::after,.backward-button:hover::after{background-color:var(--color--primary, #4e4e4e)}.hidden{display:none}.scroll::-webkit-scrollbar{display:none}';export{o as ez_tabselector}
@@ -1 +1 @@
1
- import{r as i,c as t,h as e,H as r}from"./p-60138b72.js";import{StringUtils as o}from"@sankhyalabs/core";import{g as s}from"./p-51b878f7.js";let a=class{constructor(e){i(this,e),this.configFinish=t(this,"configFinish",7),this.configCancel=t(this,"configCancel",7),this._orderListItems=[],this._orderPriorityList=[],this._columListItems=[],this._selectedIndex=-1,this.selectedTab="Colunas"}createOrderList(){let i=[];this.columns.forEach((t=>{var e;let r=null===(e=this.config)||void 0===e?void 0:e.columns.find((i=>i.name===t.name)),o={name:t.name,label:t.label};r&&(o.orderIndex=r.orderIndex,o.ascending=r.ascending),t.hidden||i.push(o)})),i.sort(((i,t)=>0!=i.orderIndex||0!=t.orderIndex||null==i.ascending&&null==t.ascending?null!=i.ascending&&null!=t.ascending?i.orderIndex-t.orderIndex:null!=i.ascending||null!=t.ascending?null!=i.ascending?-1:null!=t.ascending?1:0:i.orderIndex-t.orderIndex:null!=i.ascending?-1:null!=t.ascending?1:0)),this._orderListItems=i}createColumnList(){let i={group:"Visíveis",items:[]},t={group:"Ocultas",items:[],sort:"ASC"};this.columns.forEach((e=>{let r={label:e.label};e.hidden?t.items.push(r):i.items.push(r)})),this._columListItems=[i,t]}buildColumnListSlot(i,t){return e("div",null,e("ez-check",{mode:"switch",id:"switch"+i+t,value:"Visíveis"===t.group,onEzChange:t=>{this.switchColumnGroup(t,i)}}))}buildOrderListSlot(i){let t="na";return null!=(null==i?void 0:i.ascending)&&(t=1==i.ascending?"asc":"desc"),e("div",null,e("select-box",{selectedOption:t,key:"select-box"+i,onEzChange:t=>{t.stopPropagation(),this.updateOrder(t.detail,i.label)}}))}updateOrder(i,t){var e;let r,o=[...this.columns],s=o.find((i=>i.label===t));s&&(s.sort="na"===i.value?void 0:i.value),(null===(e=this._orderPriorityList)||void 0===e?void 0:e.length)>0?(this._orderPriorityList.find((i=>i.label===s.label)).sort=i,this._orderPriorityList.filter((i=>i.sort)).map(((i,t)=>{i.label===s.label&&(s.sortIndex=t)}))):(r=o.filter((i=>i.sort&&!0!==i.hidden)).map(((i,t)=>({label:i.label,orderIndex:t}))),r.forEach((i=>{o.find((t=>t.label===i.label)).sortIndex=i.orderIndex}))),this.columns=o}switchColumnGroup(i,t){i.stopPropagation();let e=[...this._columListItems];if(!0===i.detail){let i=e.find((i=>"Ocultas"===i.group)),r=i.items.findIndex((i=>i.label===t.label));r>=0&&i.items.splice(r,1),e.find((i=>"Visíveis"===i.group)).items.push(t),this._columListItems=e,this.createOrderList()}else if(!1===i.detail){let i=e.find((i=>"Visíveis"===i.group)),r=i.items.findIndex((i=>i.label===t.label));r>=0&&i.items.splice(r,1),e.find((i=>"Ocultas"===i.group)).items.push(t),this._columListItems=e,this.createOrderList()}}finish(){let i=[];this._columListItems.forEach((t=>{t.items.forEach((e=>{const r=this.columns.find((i=>i.label===e.label));let o=Object.assign({},r);o.hidden="Ocultas"===t.group,i.push(o)}))})),this.columns=i,this.save()}save(){var i;let t;t=this.config?this.config:this.createConfigFromState(this.columns);let e,r=[];if((null===(i=this._orderPriorityList)||void 0===i?void 0:i.length)>0){e=this.columns.filter((i=>i.sort&&!0!==i.hidden)).map((i=>({label:i.label,orderIndex:0})));let i=0,t=[];this._orderPriorityList.forEach((r=>{let o=e.find((i=>i.label===r.label));o&&(o.orderIndex=i,t.push(o),i++)})),t.length>0&&(e=t)}for(let i=0;i<this.columns.length;i++){const s=this.columns[i];let a=t.columns.find((i=>s.name===i.name));!0===s.hidden&&a||(a?a.width=s.width:!1===s.hidden&&(a={name:s.name,width:s.width,orderIndex:0}),a&&(s.sort?(a.ascending="ASC"===s.sort.toUpperCase(),e?o(s,a):a.orderIndex=s.sortIndex):(delete a.ascending,a.orderIndex=0),r.push(a)))}function o(i,t){if(e){let r=e.find((t=>t.label===i.label));r&&(t.orderIndex=r.orderIndex)}}t.columns=r,this.configFinish.emit(t),this._orderList.clearHistory()}createConfigFromState(i){let t={columns:[]};return i.forEach((i=>{if(!i.hidden){let e={name:i.name};i.width&&(e.width=i.width),i.sort?(e.ascending="ASC"===i.sort.toUpperCase(),e.orderIndex=i.sortIndex):e.orderIndex=0,e&&t.columns.push(e)}})),t}async locateColumn(i,t){var e;const r="Enter"===i.key;t||(t=null===(e=i.currentTarget)||void 0===e?void 0:e.value);let o=-1;if("Ordenação das linhas"===this.selectedTab)if(t){const i=[];let e,s;if(await this._orderList.getList().then((r=>{e=r,e.forEach(((e,r)=>{this.compareWords(e,t)&&i.push(r)}))})),i.length>0){if(r)for(let t=0;t<i.length;t++)if(i[t]>this._selectedIndex){o=i[t];break}-1===o&&(o=i[0])}this._selectedIndex=o,s=e[o],s?this._orderList.setSelection({label:s.label},!0):this._orderList.setSelection(void 0)}else this._orderList.setSelection(void 0);else if(t){const i=[];if(this.columns.forEach(((e,r)=>{this.compareWords(e,t)&&i.push(r)})),i.length>0){if(r)for(let t=0;t<i.length;t++)if(i[t]>this._selectedIndex){o=i[t];break}-1===o&&(o=i[0])}this._selectedIndex=o;let e=this.columns[o];e?this._columnList.setSelection({label:e.label},!0):this._columnList.setSelection(void 0)}else this._columnList.setSelection(void 0)}compareWords(i,t){return o.replaceAccentuatedChars(i.label).indexOf(o.replaceAccentuatedChars(t))>-1}closeConfig(){this.configCancel.emit(),this._orderList.clearHistory()}handleTabChange(i){var t;(null===(t=null==i?void 0:i.target)||void 0===t?void 0:t.selectedTab)&&("Ordenação das linhas"===i.target.selectedTab&&this.createOrderList(),this.selectedTab=i.target.selectedTab)}handleColumnListChange(i){var t;if(i.detail){let e=null===(t=i.detail.find((i=>"Visíveis"===i.group)))||void 0===t?void 0:t.items;e&&(this._orderListItems=e)}}handleOrderListChange(i){if(i.detail){let t=i.detail;t&&(this._orderPriorityList=t)}}componentWillRender(){var i;(null===(i=this.columns)||void 0===i?void 0:i.length)>0&&this.createColumnList()}componentDidRender(){var i;(null===(i=this.columns)||void 0===i?void 0:i.length)>0&&this.locateColumn(new KeyboardEvent("arrow-right",{key:"ArrowRight"}),this._searchElement.value)}render(){return e(r,null,e("div",{class:"grid-config__header"},e("div",{class:"title-container"},e("div",{class:""},e("label",{class:"title"},"Configuração da Grade"),e("label",{class:"subtitle"},"Defina visibilidade e ordem das colunas.")),e("div",{class:"button-close"},e("ez-button",{mode:"icon",image:s("close"),size:"medium",onClick:()=>this.closeConfig()}))),e("div",{class:"tabselector-container"},e("ez-tabselector",{selectedTab:this.selectedTab,selectedIndex:0,onEzChange:i=>{this.handleTabChange(i)},tabs:"Colunas, Ordenação das linhas"})),e("div",null,e("ez-text-input",{ref:i=>this._searchElement=i,label:"Localizar coluna",onKeyUp:i=>this.locateColumn(i)},e("ez-icon",{slot:"leftIcon",size:"medium",href:s("search")})))),e("div",{class:"grid-config__main"},e("ez-list",{ref:i=>this._columnList=i,class:"Colunas"===this.selectedTab?"":"hidden",dataSource:this._columListItems,onEzChange:i=>this.handleColumnListChange(i),ezDraggable:!0,ezSelectable:!0,itemSlotBuilder:(i,t)=>this.buildColumnListSlot(i,t),useGroups:!0}),e("div",{class:"Ordenação das linhas"===this.selectedTab?"group-name":"hidden"},"Sequência da ordenação"),e("ez-list",{ref:i=>this._orderList=i,class:"Ordenação das linhas"===this.selectedTab?"heigth-calc":"hidden",dataSource:this._orderListItems,ezSelectable:!0,onEzChange:i=>this.handleOrderListChange(i),ezDraggable:!0,itemSlotBuilder:i=>this.buildOrderListSlot(i)})),e("div",{class:"grid-config__footer"},e("ez-button",{class:"padding-right--medium",label:"Cancelar",onClick:()=>this.closeConfig()}),e("ez-button",{label:"Concluir",class:"button--primary",onClick:()=>this.finish()})))}static get assetsDirs(){return["../assets"]}};a.style='.sc-grid-config-h{--ez-grid-config__footer--padding-top:var(--space--medium, 12px);--ez-grid-config__main--padding-right:var(--space--medium, 12px);--ez-grid-config__tabselector-container--padding:var(--space--medium, 12px);--ez-grid-config__button-close--padding-left:var(--space--medium, 12px);--ez-grid-config__subtitle--font-family:var(--font-pattern, "Sora");--ez-grid-config__title--font-family:var(--font-pattern, "Sora");--ez-grid-config__title--font-weight:var(--text-weight--large, 700);--ez-grid-config__subtitle--font-size:var(--text--medium, 14px);--ez-grid-config__scrollbar--width:var(--space--medium, 12px);--ez-grid-config__main__scrollbar--background-color:var(--text--primary, #626e82);--ez-grid-config__main__scrollbar--border-radius:var(--border--radius-medium, 12px);--ez-grid__group--font-family:var(--font-pattern, "Sora");--ez-grid__group--font-size:var(--text--medium, 14px);--ez-grid__group--font-weight:var(--text-weight--large, 600);--ez-grid__group--padding-bottom:var(--space-small, 6px);display:grid;grid-template-rows:auto 1fr auto;max-height:100%;width:100%}.padding-right--medium.sc-grid-config{padding-right:var(--space--medium)}ez-list.sc-grid-config{height:100%}.heigth-calc.sc-grid-config{max-height:calc(100% - 24px)}.grid-config__footer.sc-grid-config{padding-top:var(--ez-grid-config__footer--padding-top);display:flex;justify-content:flex-end;width:100%}.hidden.sc-grid-config{display:none}.grid-config__main.sc-grid-config{padding-right:var(--ez-grid-config__main--padding-right);overflow-y:auto}.tabselector-container.sc-grid-config{padding:var(--ez-grid-config__tabselector-container--padding) 0}.button-close.sc-grid-config{padding-left:var(--ez-grid-config__button-close--padding-left)}.title-container.sc-grid-config{display:flex;justify-content:space-between;align-items:center;width:359px}.subtitle.sc-grid-config{font-family:var(--ez-grid-config__subtitle--font-family);font-size:var(--ez-grid-config__subtitle--font-size);color:var(--text--primary)}.title.sc-grid-config{display:flex;margin:0;font-family:var(--ez-grid-config__title--font-family);font-size:var(--title--large);font-weight:var(--ez-grid-config__title--font-weight);line-height:normal;letter-spacing:0em;text-align:left;color:var(--title--primary)}.grid-config__main.sc-grid-config::-webkit-scrollbar-track{background-color:#f0f2f5}.grid-config__main.sc-grid-config::-webkit-scrollbar-thumb{background-color:var(--ez-grid-config__main__scrollbar--background-color);border-radius:var(--ez-grid-config__main__scrollbar--border-radius)}.grid-config__main.sc-grid-config::-webkit-scrollbar{background-color:#f0f2f5;width:var(--ez-grid-config__scrollbar--width);max-width:var(--ez-grid-config__scrollbar--width);min-width:var(--ez-grid-config__scrollbar--width)}.group-name.sc-grid-config{font-family:var(--ez-grid__group--font-family);font-size:var(--ez-grid__group--font-size);font-weight:var(--ez-grid__group--font-weight);padding-bottom:var(--ez-grid__group--padding-bottom)}';export{a as grid_config}
1
+ import{r as i,c as t,h as e,H as r}from"./p-60138b72.js";import{StringUtils as o}from"@sankhyalabs/core";import{g as s}from"./p-51b878f7.js";let a=class{constructor(e){i(this,e),this.configFinish=t(this,"configFinish",7),this.configCancel=t(this,"configCancel",7),this._orderListItems=[],this._orderPriorityList=[],this._columListItems=[],this._selectedIndex=-1,this.selectedTab="Colunas"}createOrderList(){let i=[];this.columns.forEach((t=>{var e;let r=null===(e=this.config)||void 0===e?void 0:e.columns.find((i=>i.name===t.name)),o={name:t.name,label:t.label};r&&(o.orderIndex=r.orderIndex,o.ascending=r.ascending),t.hidden||i.push(o)})),i.sort(((i,t)=>0!=i.orderIndex||0!=t.orderIndex||null==i.ascending&&null==t.ascending?null!=i.ascending&&null!=t.ascending?i.orderIndex-t.orderIndex:null!=i.ascending||null!=t.ascending?null!=i.ascending?-1:null!=t.ascending?1:0:i.orderIndex-t.orderIndex:null!=i.ascending?-1:null!=t.ascending?1:0)),this._orderListItems=i}createColumnList(){let i={group:"Visíveis",items:[]},t={group:"Ocultas",items:[],sort:"ASC"};this.columns.forEach((e=>{let r={label:e.label};e.hidden?t.items.push(r):i.items.push(r)})),this._columListItems=[i,t]}buildColumnListSlot(i,t){return e("div",null,e("ez-check",{mode:"switch",id:"switch"+i+t,value:"Visíveis"===t.group,onEzChange:t=>{this.switchColumnGroup(t,i)}}))}buildOrderListSlot(i){let t="na";return null!=(null==i?void 0:i.ascending)&&(t=1==i.ascending?"asc":"desc"),e("div",null,e("select-box",{selectedOption:t,key:"select-box"+i,onEzChange:t=>{t.stopPropagation(),this.updateOrder(t.detail,i.label)}}))}updateOrder(i,t){var e;let r,o=[...this.columns],s=o.find((i=>i.label===t));s&&(s.sort="na"===i.value?void 0:i.value),(null===(e=this._orderPriorityList)||void 0===e?void 0:e.length)>0?(this._orderPriorityList.find((i=>i.label===s.label)).sort=i,this._orderPriorityList.filter((i=>i.sort)).map(((i,t)=>{i.label===s.label&&(s.sortIndex=t)}))):(r=o.filter((i=>i.sort&&!0!==i.hidden)).map(((i,t)=>({label:i.label,orderIndex:t}))),r.forEach((i=>{o.find((t=>t.label===i.label)).sortIndex=i.orderIndex}))),this.columns=o}switchColumnGroup(i,t){i.stopPropagation();let e=[...this._columListItems];if(!0===i.detail){let i=e.find((i=>"Ocultas"===i.group)),r=i.items.findIndex((i=>i.label===t.label));r>=0&&i.items.splice(r,1),e.find((i=>"Visíveis"===i.group)).items.push(t),this._columListItems=e,this.createOrderList()}else if(!1===i.detail){let i=e.find((i=>"Visíveis"===i.group)),r=i.items.findIndex((i=>i.label===t.label));r>=0&&i.items.splice(r,1),e.find((i=>"Ocultas"===i.group)).items.push(t),this._columListItems=e,this.createOrderList()}}finish(){let i=[];this._columListItems.forEach((t=>{t.items.forEach((e=>{const r=this.columns.find((i=>i.label===e.label));let o=Object.assign({},r);o.hidden="Ocultas"===t.group,i.push(o)}))})),this.columns=i,this.save()}save(){var i;let t;t=this.config?this.config:this.createConfigFromState(this.columns);let e,r=[];if((null===(i=this._orderPriorityList)||void 0===i?void 0:i.length)>0){e=this.columns.filter((i=>i.sort&&!0!==i.hidden)).map((i=>({label:i.label,orderIndex:0})));let i=0,t=[];this._orderPriorityList.forEach((r=>{let o=e.find((i=>i.label===r.label));o&&(o.orderIndex=i,t.push(o),i++)})),t.length>0&&(e=t)}for(let i=0;i<this.columns.length;i++){const s=this.columns[i];let a=t.columns.find((i=>s.name===i.name));!0===s.hidden&&a||(a?a.width=s.width:!1===s.hidden&&(a={name:s.name,width:s.width,orderIndex:0}),a&&(s.sort?(a.ascending="ASC"===s.sort.toUpperCase(),e?o(s,a):a.orderIndex=s.sortIndex):(delete a.ascending,a.orderIndex=0),r.push(a)))}function o(i,t){if(e){let r=e.find((t=>t.label===i.label));r&&(t.orderIndex=r.orderIndex)}}t.columns=r,this.configFinish.emit(t),this._orderList.clearHistory()}createConfigFromState(i){let t={columns:[]};return i.forEach((i=>{if(!i.hidden){let e={name:i.name};i.width&&(e.width=i.width),i.sort?(e.ascending="ASC"===i.sort.toUpperCase(),e.orderIndex=i.sortIndex):e.orderIndex=0,e&&t.columns.push(e)}})),t}async locateColumn(i,t){var e;const r="Enter"===i.key;t||(t=null===(e=i.currentTarget)||void 0===e?void 0:e.value);let o=-1;if("Ordenação das linhas"===this.selectedTab)if(t){const i=[];let e,s;if(await this._orderList.getList().then((r=>{e=r,e.forEach(((e,r)=>{this.compareWords(e,t)&&i.push(r)}))})),i.length>0){if(r)for(let t=0;t<i.length;t++)if(i[t]>this._selectedIndex){o=i[t];break}-1===o&&(o=i[0])}this._selectedIndex=o,s=e[o],s?this._orderList.setSelection({label:s.label},!0):this._orderList.setSelection(void 0)}else this._orderList.setSelection(void 0);else if(t){const i=[];if(this.columns.forEach(((e,r)=>{this.compareWords(e,t)&&i.push(r)})),i.length>0){if(r)for(let t=0;t<i.length;t++)if(i[t]>this._selectedIndex){o=i[t];break}-1===o&&(o=i[0])}this._selectedIndex=o;let e=this.columns[o];e?this._columnList.setSelection({label:e.label},!0):this._columnList.setSelection(void 0)}else this._columnList.setSelection(void 0)}compareWords(i,t){return o.replaceAccentuatedChars(i.label).indexOf(o.replaceAccentuatedChars(t))>-1}closeConfig(){this.configCancel.emit(),this._orderList.clearHistory()}handleTabChange(i){var t;(null===(t=null==i?void 0:i.target)||void 0===t?void 0:t.selectedTab)&&("Ordenação das linhas"===i.target.selectedTab&&this.createOrderList(),this.selectedTab=i.target.selectedTab)}handleColumnListChange(i){var t;if(i.detail){let e=null===(t=i.detail.find((i=>"Visíveis"===i.group)))||void 0===t?void 0:t.items;e&&(this._orderListItems=e)}}handleOrderListChange(i){if(i.detail){let t=i.detail;t&&(this._orderPriorityList=t)}}componentWillRender(){var i;(null===(i=this.columns)||void 0===i?void 0:i.length)>0&&this.createColumnList()}componentDidRender(){var i;(null===(i=this.columns)||void 0===i?void 0:i.length)>0&&this.locateColumn(new KeyboardEvent("arrow-right",{key:"ArrowRight"}),this._searchElement.value)}render(){return e(r,null,e("div",{class:"grid-config__header"},e("div",{class:"title-container"},e("div",{class:""},e("label",{class:"title"},"Configuração da Grade"),e("label",{class:"subtitle"},"Defina visibilidade e ordem das colunas.")),e("div",{class:"button-close"},e("ez-button",{mode:"icon",image:s("close"),size:"medium",onClick:()=>this.closeConfig()}))),e("div",{class:"tabselector-container"},e("ez-tabselector",{selectedTab:this.selectedTab,selectedIndex:0,onEzChange:i=>{this.handleTabChange(i)},tabs:"Colunas, Ordenação das linhas"})),e("div",null,e("ez-text-input",{ref:i=>this._searchElement=i,label:"Localizar coluna",onKeyUp:i=>this.locateColumn(i)},e("ez-icon",{slot:"leftIcon",size:"medium",href:s("search")})))),e("div",{class:"grid-config__main"},e("ez-list",{ref:i=>this._columnList=i,class:"Colunas"===this.selectedTab?"":"hidden",dataSource:this._columListItems,onEzChange:i=>this.handleColumnListChange(i),ezDraggable:!0,ezSelectable:!0,itemSlotBuilder:(i,t)=>this.buildColumnListSlot(i,t),useGroups:!0}),e("div",{class:"Ordenação das linhas"===this.selectedTab?"group-name":"hidden"},"Sequência da ordenação"),e("ez-list",{ref:i=>this._orderList=i,class:"Ordenação das linhas"===this.selectedTab?"heigth-calc":"hidden",dataSource:this._orderListItems,ezSelectable:!0,onEzChange:i=>this.handleOrderListChange(i),ezDraggable:!0,itemSlotBuilder:i=>this.buildOrderListSlot(i)})),e("div",{class:"grid-config__footer"},e("ez-button",{class:"padding-right--medium",label:"Cancelar",onClick:()=>this.closeConfig()}),e("ez-button",{label:"Concluir",class:"ez-button--primary",onClick:()=>this.finish()})))}static get assetsDirs(){return["../assets"]}};a.style='.sc-grid-config-h{--ez-grid-config__footer--padding-top:var(--space--medium, 12px);--ez-grid-config__main--padding-right:var(--space--medium, 12px);--ez-grid-config__tabselector-container--padding:var(--space--medium, 12px);--ez-grid-config__button-close--padding-left:var(--space--medium, 12px);--ez-grid-config__subtitle--font-family:var(--font-pattern, "Sora");--ez-grid-config__title--font-family:var(--font-pattern, "Sora");--ez-grid-config__title--font-weight:var(--text-weight--large, 700);--ez-grid-config__subtitle--font-size:var(--text--medium, 14px);--ez-grid-config__scrollbar--width:var(--space--medium, 12px);--ez-grid-config__main__scrollbar--background-color:var(--text--primary, #626e82);--ez-grid-config__main__scrollbar--border-radius:var(--border--radius-medium, 12px);--ez-grid__group--font-family:var(--font-pattern, "Sora");--ez-grid__group--font-size:var(--text--medium, 14px);--ez-grid__group--font-weight:var(--text-weight--large, 600);--ez-grid__group--padding-bottom:var(--space-small, 6px);display:grid;grid-template-rows:auto 1fr auto;max-height:100%;width:100%}.padding-right--medium.sc-grid-config{padding-right:var(--space--medium)}ez-list.sc-grid-config{height:100%}.heigth-calc.sc-grid-config{max-height:calc(100% - 24px)}.grid-config__footer.sc-grid-config{padding-top:var(--ez-grid-config__footer--padding-top);display:flex;justify-content:flex-end;width:100%}.hidden.sc-grid-config{display:none}.grid-config__main.sc-grid-config{padding-right:var(--ez-grid-config__main--padding-right);overflow-y:auto}.tabselector-container.sc-grid-config{padding:var(--ez-grid-config__tabselector-container--padding) 0}.button-close.sc-grid-config{padding-left:var(--ez-grid-config__button-close--padding-left)}.title-container.sc-grid-config{display:flex;justify-content:space-between;align-items:center;width:359px}.subtitle.sc-grid-config{font-family:var(--ez-grid-config__subtitle--font-family);font-size:var(--ez-grid-config__subtitle--font-size);color:var(--text--primary)}.title.sc-grid-config{display:flex;margin:0;font-family:var(--ez-grid-config__title--font-family);font-size:var(--title--large);font-weight:var(--ez-grid-config__title--font-weight);line-height:normal;letter-spacing:0em;text-align:left;color:var(--title--primary)}.grid-config__main.sc-grid-config::-webkit-scrollbar-track{background-color:#f0f2f5}.grid-config__main.sc-grid-config::-webkit-scrollbar-thumb{background-color:var(--ez-grid-config__main__scrollbar--background-color);border-radius:var(--ez-grid-config__main__scrollbar--border-radius)}.grid-config__main.sc-grid-config::-webkit-scrollbar{background-color:#f0f2f5;width:var(--ez-grid-config__scrollbar--width);max-width:var(--ez-grid-config__scrollbar--width);min-width:var(--ez-grid-config__scrollbar--width)}.group-name.sc-grid-config{font-family:var(--ez-grid__group--font-family);font-size:var(--ez-grid__group--font-size);font-weight:var(--ez-grid__group--font-weight);padding-bottom:var(--ez-grid__group--padding-bottom)}';export{a as grid_config}
@@ -0,0 +1 @@
1
+ import{r as o,c as t,h as i,H as e,g as s}from"./p-60138b72.js";import{FloatingManager as r}from"@sankhyalabs/core";import{C as a}from"./p-933a7475.js";let h=class{constructor(i){o(this,i),this.ezChange=t(this,"ezChange",7),this.enabled=!0,this.showSelectedValue=!1,this.showOptionValue=!1,this.suppressSearch=!1,this.suppressEmptyOption=!1,this.canShowError=!0,this.mode="regular"}observerValue(){this._inputElement&&(this._inputElement.value=this.getText()),this.hideOptions(),this._criteria=void 0,this._preSelection=void 0,this.updateVisibleOptions()}async setFocus(){this._inputElement.setFocus()}async setBlur(){this._inputElement.setBlur()}getText(){let o="";const t=this.getSelectedOption();return t&&(o=this.showSelectedValue?`${t.value} - ${t.label}`:t.label),o}getSelectedOption(){return"string"==typeof this.value||this.value instanceof String?this._visibleOptions.find((o=>o.value===this.value)):this.value}updateVisibleOptions(){let o=this._source||[];if(!this.searchMode&&this._criteria){const t=this._criteria.toUpperCase();o=o.filter((o=>o.label.toLocaleUpperCase().indexOf(t)>-1))}this._visibleOptions=this.suppressEmptyOption?o:[{value:void 0,label:""}].concat(o)}buildItem(o,t){return i("li",{class:t===this._preSelection?"item preselected":"item",id:`item_${o.value}`,onMouseDown:()=>this.selectOption(o),onMouseOver:()=>this._preSelection=void 0},i("span",{class:"item--label",title:o.label},o.label),this.showOptionValue?i("span",{class:"item--value",title:o.value},o.value):void 0)}showOptions(){this.enabled&&(this._floatingID=r.float(this._optionsList,this._listContainer,{autoClose:!0,top:this.errorMessage||!this.canShowError||"slim"==this.mode?"0px":"-19px"}),window.requestAnimationFrame((()=>{this._optionsList.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})})))}hideOptions(){void 0!==this._floatingID&&r.close(this._floatingID),this._floatingID=void 0}isOptionsVisible(){return void 0!==this._floatingID&&r.isFloating(this._floatingID)}nextOption(){this.searchMode&&!this.isOptionsVisible()||(this.showOptions(),this._preSelection=void 0===this._preSelection?0:Math.min(this._preSelection+1,this._visibleOptions.length-1),this.scrollToOption(this._visibleOptions[this._preSelection],!0))}previousOption(){this._preSelection=void 0===this._preSelection?0:Math.max(this._preSelection-1,0),this.scrollToOption(this._visibleOptions[this._preSelection],!1)}scrollToOption(o,t){window.requestAnimationFrame((()=>{const i=this._optionsList.querySelector(`li#item_${o.value}`);if(i){const o=i.parentElement,e=o.getBoundingClientRect(),s=i.getBoundingClientRect();t&&s.bottom>e.bottom?o.scrollTop=s.top:!t&&s.top<e.top&&(o.scrollTop=0)}}))}selectCurrentOption(){void 0!==this._preSelection&&(this.selectOption(this._visibleOptions[this._preSelection]),this._preSelection=void 0)}selectOption(o){if(this.getSelectedOption()!==o){const t=(null==o?void 0:o.value)?o:void 0;this.value=t,this.errorMessage="",this.ezChange.emit(t)}else this.observerValue()}updateSource(o){o instanceof Promise?(o.then((o=>this.updateSource(o))),this.updateVisibleOptions()):Array.isArray(o)?(this._source=o,this.updateVisibleOptions()):this.value=o}loadOptions(o,t=""){this._criteria=t,this.updateSource(this.optionLoader?this.optionLoader({mode:o,argument:t}):this.options)}cancelPreselection(){!this._inputElement.value&&this.value?this.selectOption(void 0):this.observerValue()}componentWillLoad(){if(void 0===this.options){this.options=[];const o=this.el.querySelectorAll("option");o&&o.forEach((o=>{let t=o.innerText,i=o.getAttribute("value");i||(i=t),this.options.push({label:t,value:i}),o.hidden=!0}))}this.searchMode?this.updateSource([]):this.loadOptions("PRELOAD")}componentDidRender(){void 0===this._floatingID&&this._optionsList.remove()}componentDidLoad(){a.applyVarsTextInput(this.el,this._inputElement)}handlerIconClick(){this.searchMode?this.loadOptions("ADVANCED"):this.showOptions()}onTextInputChangeHandler(o){this._criteria||(this._inputElement.value=o.data);const t=o.target.value;this._criteria=t,this._criteria&&(this.searchMode?(this._changeDeboucingTimeout&&window.clearTimeout(this._changeDeboucingTimeout),this._changeDeboucingTimeout=window.setTimeout((()=>{this.loadOptions("PREDICTIVE",t)}),200)):this.updateVisibleOptions(),this.showOptions())}onTextInputClickHandler(){this.searchMode||this.showOptions()}keyDownHandler(o){switch(o.key){case"ArrowDown":this.nextOption();break;case"ArrowUp":this.previousOption();break;case"Enter":this.selectCurrentOption();break;case"Escape":this.cancelPreselection()}o.stopPropagation()}onTextInputFocusOutHandler(){this.cancelPreselection()}render(){return i(e,null,i("ez-text-input",{class:this.suppressSearch?"suppressed-search-input":"",ref:o=>this._inputElement=o,enabled:this.enabled&&!this.suppressSearch,onInput:o=>this.onTextInputChangeHandler(o),onClick:()=>this.onTextInputClickHandler(),onFocusout:()=>this.onTextInputFocusOutHandler(),onEzChange:o=>o.stopPropagation(),onKeyDown:o=>this.keyDownHandler(o),label:this.label,value:this.getText(),canShowError:this.canShowError,errorMessage:this.errorMessage,mode:this.mode},i("button",{class:"btn",slot:this.searchMode?"leftIcon":"rightIcon",disabled:!this.enabled,tabindex:-1,onClick:()=>this.handlerIconClick()},i("ez-icon",{slot:"icon","icon-name":this.searchMode?"search":"chevron-down"}))),i("section",{class:"list-container",ref:o=>this._listContainer=o},i("div",{class:"options-list",ref:o=>this._optionsList=o},this._visibleOptions.map(((o,t)=>this.buildItem(o,t))))))}get el(){return s(this)}static get watchers(){return{value:["observerValue"]}}};h.style=":host{--ez-combo-box--height:42px;--ez-combo-box--width:100%;--ez-combo-box__icon--width:48px;--ez-combo-box--border-radius:var(--border--radius-medium, 12px);--ez-combo-box--border-radius-small:var(--border--radius-small, 6px);--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__input--background-color:var(--background--medium, #e0e0e0);--ez-combo-box__input--border:var(--border--medium, 2px solid);--ez-combo-box__input--border-color:var(--ez-combo-box__input--background-color);--ez-combo-box__input--focus--border-color:var(--color--primary, #008561);--ez-combo-box__input--disabled--background-color:var(--color--disable-secondary, #F2F5F8);--ez-combo-box__input--disabled--color:var(--text--disable, #AFB6C0);--ez-combo-box__input--error--border-color:#CC2936;--ez-combo-box__btn--color:var(--text--primary, #626e82);--ez-combo-box__btn-disabled--color:var(--text--disable, #AFB6C0);--ez-combo-box__btn-hover--color:var(--color--primary, #4e4e4e);--ez-combo-box__label--color:var(--title--primary, #919191);--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));--ez-combo-box--space--medium:var(--space--medium, 12px);--ez-combo-box--space--small:var(--space--small, 6px);display:flex;flex-wrap:wrap;position:relative;width:var(--ez-combo-box--width)}ez-icon{--ez-icon--color:inherit}.suppressed-search-input{--ez-text-input__input--border-color:var(--color--strokes, #dce0e8);--ez-text-input__input--disabled--background-color:var(--background--xlight, #fff);--ez-text-input__input--disabled--color:var(--title--primary, #000)}.list-container{position:relative;width:100%}.options-list{box-sizing:border-box;width:100%;z-index:var(--more-visible, 2);display:flex;flex-direction:column;background-color:var(--ez-combo-box--background-color--xlight);padding:var(--ez-combo-box--space--small);border-radius:var(--ez-combo-box--border-radius);box-shadow:var(--shadow, 0px 0px 16px 0px #000);scroll-behavior:smooth;max-height:calc(4*var(--ez-combo-box__list-height) + 2*var(--ez-combo-box--space--small));overflow:auto}.item{text-align:left;display:flex;justify-content:space-between;align-items:center;border-radius:var(--ez-combo-box--border-radius-small);padding:0 var(--ez-combo-box--space--small);list-style-type:none;min-height:var(--ez-combo-box__list-height)}.item--label{text-align:left;flex-basis:85%;flex-grow:1;color:var(--ez-combo-box__list-text--primary);font-weight:var(--ez-combo-box--font-weight--large);font-family:var(--ez-combo-box--font-family);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.item--value{text-align:right;flex-basis:15%;flex-grow:0;color:var(--ez-combo-box__list-text--primary);font-weight:var(--ez-combo-box--font-weight--large);font-family:var(--ez-combo-box--font-family);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}li:hover{background-color:var(--ez-combo-box--background-medium)}.preselected{background-color:var(--background--medium)}.btn{outline:none;border:none;background:none;cursor:pointer;color:var(--ez-combo-box__btn--color)}.btn:disabled{color:var(--ez-combo-box__btn-disabled--color);cursor:unset}.btn:disabled:hover{color:var(--ez-combo-box__btn-disabled--color);cursor:unset}.btn:hover{color:var(--ez-combo-box__btn-hover--color)}";export{h as ez_combo_box}
@@ -0,0 +1 @@
1
+ import{r as l,c as o,h as e}from"./p-60138b72.js";let i=class{constructor(e){l(this,e),this.ezChange=o(this,"ezChange",7),this.value=!1,this.headerSize="small",this.iconPlacement="left",this.stretchTitle=!1}observeCollapsedValue(){this.ezChange.emit(this.value)}async showHide(){this.value=!this.value}getHeaderSize(){const l=this.headerSize&&this.headerSize.toLowerCase(),o=["xsmall","xlarge"].includes(l)?l.replace("x","x-"):l;return["x-small","small","medium","large","x-large"].includes(o)?o:"small"}render(){return e("div",{class:"collapsible-box"},e("div",{class:"collapsible-box__header"},e("button",{onClick:()=>this.showHide(),class:"collapsible-box__title"+("right"===this.iconPlacement?" collapsible-box__title--icon-right":"")+(this.stretchTitle?" collapsible-box__title--stretched":"")},e("ez-icon",{slot:"icon","icon-name":"chevron-right",size:this.getHeaderSize(),class:"collapsible-box__icon collapsible-box__icon--"+this.getHeaderSize()+(this.value?" collapsible-box__icon--collapsed":"")}),e("label",{class:"collapsible-box__label font--"+this.getHeaderSize(),title:this.label},this.label))),e("div",{class:"collapsible-box__content"+(this.value?"":" collapsible-box__content--show")},e("slot",null)))}static get watchers(){return{value:["observeCollapsedValue"]}}};i.style=":host{--ez-collapsible-box--font-size:var(--title--medium, 14px);--ez-collapsible-box--font-family:var(--font-pattern, Arial);--ez-collapsible-box--font-weight:var(--text-weight--large, 600);--ez-collapsible-box--color:var(--title--primary);--ez-collapsible-box__icon--color:var(--ez-collapsible-box--color);--ez-collapsible-box__header--padding-top:0px;--ez-collapsible-box__header--padding-bottom:0px;--ez-collapsible-box__header--padding-right:0px;--ez-collapsible-box__header--padding-left:0px;display:flex;flex-wrap:wrap;width:100%}.collapsible-box{display:flex;flex-direction:column;width:100%}.collapsible-box__header{display:flex;box-sizing:border-box;padding-top:var(--ez-collapsible-box__header--padding-top);padding-bottom:var(--ez-collapsible-box__header--padding-bottom);padding-right:var(--ez-collapsible-box__header--padding-right);padding-left:var(--ez-collapsible-box__header--padding-left)}.collapsible-box__title{position:relative;width:auto;display:flex;box-sizing:border-box;align-items:center;outline:none;border:none;background-color:unset;cursor:pointer;padding:0px;text-align:left;margin-bottom:var(--space--medium, 12px)}.collapsible-box__label{white-space:nowrap;overflow:hidden;cursor:pointer;text-overflow:ellipsis;box-sizing:border-box;margin-left:6px;font-family:var(--ez-collapsible-box--font-family);font-size:var(--ez-collapsible-box--font-size);font-weight:var(--ez-collapsible-box--font-weight);color:var(--ez-collapsible-box--color)}.collapsible-box__icon{transform:rotate(90deg) translate(0px, 14%);transition:transform var(--transition);--ez-icon--color:var(--ez-collapsible-box__icon--color, --ez-collapsible-box--color)}.collapsible-box__icon--collapsed{transform:rotate(0deg) translate(-14%, 0px)}.collapsible-box__title--icon-right{flex-direction:row-reverse}.collapsible-box__title--icon-right .collapsible-box__icon{transform:rotate(90deg) translate(0px, -14%)}.collapsible-box__title--icon-right .collapsible-box__icon--collapsed{transform:rotate(0deg) translate(14%, 0px)}.collapsible-box__title--icon-right .collapsible-box__label{margin-left:0px;margin-right:6px}.collapsible-box__title--stretched{width:100%;justify-content:space-between}.collapsible-box__content{display:flex;flex-wrap:wrap;width:100%;height:0px;max-height:0px;opacity:0;overflow:hidden;transition:all var(--transition, 0.5s)}.collapsible-box__content--show{height:100%;max-height:none;opacity:1;overflow:visible;transition:all var(--transition, 0.5s)}.font--x-small{font-size:10px}.font--small{font-size:12px}.font--medium{font-size:14px}.font--large{font-size:16px}.font--x-large{font-size:20px}";export{i as ez_collapsible_box}
@@ -10,13 +10,12 @@ export declare class EzCollapsibleBox {
10
10
  label: string;
11
11
  /**
12
12
  * Define o tamanho do texto e do ícone do componente.
13
- * Tamanhos suportados: "x-small", "small", "medium", "large" e "x-large".
14
13
  */
15
- headerSize: string;
14
+ headerSize: "x-small" | "small" | "medium" | "large" | "x-large" | undefined;
16
15
  /**
17
16
  * Define o local onde o ícone será renderizado.
18
17
  */
19
- iconPlacement: string;
18
+ iconPlacement: "left" | "right";
20
19
  /**
21
20
  * Define se o titulo irá ocupar toda a largura do componente.
22
21
  */
@@ -63,7 +63,7 @@ export declare class EzComboBox {
63
63
  * Define o modo do tamanho do campo; opções: slim e regular.
64
64
  */
65
65
  mode: string;
66
- private internalUpdate;
66
+ private observerValue;
67
67
  /**
68
68
  * Realiza o foco no componente de seleção
69
69
  */
@@ -90,6 +90,7 @@ export declare class EzComboBox {
90
90
  componentWillLoad(): void;
91
91
  componentDidRender(): void;
92
92
  componentDidLoad(): void;
93
+ private handlerIconClick;
93
94
  private onTextInputChangeHandler;
94
95
  private onTextInputClickHandler;
95
96
  private keyDownHandler;
@@ -119,13 +119,13 @@ export namespace Components {
119
119
  }
120
120
  interface EzCollapsibleBox {
121
121
  /**
122
- * Define o tamanho do texto e do ícone do componente. Tamanhos suportados: "x-small", "small", "medium", "large" e "x-large".
122
+ * Define o tamanho do texto e do ícone do componente.
123
123
  */
124
- "headerSize": string;
124
+ "headerSize": "x-small" | "small" | "medium" | "large" | "x-large" | undefined;
125
125
  /**
126
126
  * Define o local onde o ícone será renderizado.
127
127
  */
128
- "iconPlacement": string;
128
+ "iconPlacement": "left" | "right";
129
129
  /**
130
130
  * Título do campo
131
131
  */
@@ -200,7 +200,7 @@ export namespace Components {
200
200
  /**
201
201
  * Valor selecionado no campo
202
202
  */
203
- "value": Option|string;
203
+ "value": Option | string;
204
204
  }
205
205
  interface EzDateInput {
206
206
  /**
@@ -1174,13 +1174,13 @@ declare namespace LocalJSX {
1174
1174
  }
1175
1175
  interface EzCollapsibleBox {
1176
1176
  /**
1177
- * Define o tamanho do texto e do ícone do componente. Tamanhos suportados: "x-small", "small", "medium", "large" e "x-large".
1177
+ * Define o tamanho do texto e do ícone do componente.
1178
1178
  */
1179
- "headerSize"?: string;
1179
+ "headerSize"?: "x-small" | "small" | "medium" | "large" | "x-large" | undefined;
1180
1180
  /**
1181
1181
  * Define o local onde o ícone será renderizado.
1182
1182
  */
1183
- "iconPlacement"?: string;
1183
+ "iconPlacement"?: "left" | "right";
1184
1184
  /**
1185
1185
  * Título do campo
1186
1186
  */
@@ -1251,7 +1251,7 @@ declare namespace LocalJSX {
1251
1251
  /**
1252
1252
  * Valor selecionado no campo
1253
1253
  */
1254
- "value"?: Option|string;
1254
+ "value"?: Option | string;
1255
1255
  }
1256
1256
  interface EzDateInput {
1257
1257
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sankhyalabs/ezui",
3
- "version": "1.1.126",
3
+ "version": "1.1.129",
4
4
  "description": "Biblioteca de componentes Sankhya.",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/custom-elements/index.js",
@@ -1 +0,0 @@
1
- import{r as t,c as i,h as s,H as e,g as a}from"./p-60138b72.js";let o=class{constructor(s){t(this,s),this.ezChange=i(this,"ezChange",7),this.setFocusedParam=t=>{if("Enter"===t.key){const i=this._processedTabs[this._focusedIndex];this.handleTabClick(i),t.preventDefault(),this.setFocusedTab(i.index)}else if("ArrowLeft"===t.key||"ArrowRight"===t.key){let i;if("ArrowLeft"===t.key)i=!1;else{if("ArrowRight"!==t.key)return;i=!0}this._focusedIndex=void 0===this._focusedIndex?!1===i?void 0!==this.selectedIndex?this.selectedIndex-1:void 0:void 0!==this.selectedIndex?this.selectedIndex+1:void 0:!1===i?this._focusedIndex-1:this._focusedIndex+1,this._focusedIndex<0?this._focusedIndex=0:this._focusedIndex>this._processedTabs.length-1&&(this._focusedIndex=this._processedTabs.length-1),this.setFocusedBtn(!0,this._focusedIndex),this.setFocusedTab(this._focusedIndex)}else if("Tab"===t.key||"Escape"===t.key){const i=this._processedTabs[this.selectedIndex];this._focusedIndex=void 0,this.handleTabClick(i),t.preventDefault(),this.setFocusedTab(this.selectedIndex)}}}handleTabClick(t){this.selectedIndex=t.index,this._focusedIndex=void 0,this.selectedTab=t.tabKey,this.ezChange.emit(t),this.setFocusedBtn(!1,t.index)}componentWillRender(){this._processedTabs||(this._processedTabs=[],this.tabs&&this.tabs.split(",").forEach((t=>{t=t.trim(),this._processedTabs.push({label:t,tabKey:t,index:this._processedTabs.length})})),this._hostElem.querySelectorAll("ez-tab").forEach((t=>{const i=t.getAttribute("tabKey"),s={label:t.getAttribute("label"),tabKey:i,index:this._processedTabs.length},e=t.firstChild;e&&(e.setAttribute("slot","tab"+s.index),this._hostElem.appendChild(e)),this._processedTabs.push(s)})))}handleSlotChange(t){const i=t.target.assignedElements()[0];i&&(i.style.marginLeft="6px")}scrollBackward(){const t=this._scrollContainer;t&&(t.scrollLeft-=t.clientWidth)}scrollFoward(){const t=this._scrollContainer;if(t){let i=null;t.querySelectorAll(".tab").forEach((s=>{s.getBoundingClientRect().right<t.clientWidth&&(i=s)})),t.scrollLeft=i.offsetLeft+i.offsetWidth}}componentDidRender(){this.updateScroll()}updateScroll(){const t=this._scrollContainer;if(t){const{scrollWidth:i,clientWidth:s,scrollLeft:e}=t,a=i-s-Math.ceil(e);this._startHidden=t.scrollLeft>0,this._endHidden=a>0,this._startHidden?this._backwardButton.classList.remove("hidden"):this._backwardButton.classList.add("hidden"),this._endHidden?this._forwardButton.classList.remove("hidden"):this._forwardButton.classList.add("hidden");const o=["","startHidden","endHidden","midle"],r=o[Number(this._startHidden)|Number(this._endHidden)<<1];o.forEach((i=>{i!==r&&t.classList.contains(i)&&t.classList.remove(i)})),r&&!t.classList.contains(r)&&t.classList.add(r)}}domScrollHandler(){window.clearTimeout(this._scrollCallBack),this._scrollCallBack=window.setTimeout((()=>{this.updateScroll()}),200)}setFocusedTab(t){window.clearTimeout(this._scrollCallBackTest),this._scrollCallBackTest=window.setTimeout((()=>{this._scrollContainer.querySelector(`#tab${t}`).scrollIntoView()}),200)}getTextWidth(t){void 0===this._textMesurement&&(this._textMesurement=this._hostElem.shadowRoot.ownerDocument.createElement("canvas"));const i=this._textMesurement.getContext("2d");return i.font="14px Sora, Algerian",Math.min(220,24+i.measureText(t).width)+"px"}setFocusedBtn(t,i){this._scrollContainer.querySelectorAll(".tab").forEach((s=>{s.classList.remove("is-focused"),s.id==="tab"+i&&t&&s.classList.add("is-focused")}))}render(){return s(e,null,s("button",{class:"backward-button",ref:t=>this._backwardButton=t,onClick:()=>this.scrollBackward()}),s("div",{class:"scroll",ref:t=>this._scrollContainer=t,onScroll:()=>this.domScrollHandler(),onKeyDown:t=>this.setFocusedParam(t)},this._processedTabs.map(((t,i)=>{const e={"min-width":this.getTextWidth(t.label)},a="tab"+i,o=i===this.selectedIndex||this.selectedTab&&t.tabKey===this.selectedTab;return o&&(this.selectedTab=t.tabKey,this.selectedIndex=i),s("button",{id:a,class:"tab"+(o?" is-active":""),onClick:()=>this.handleTabClick(t),style:e},s("span",{class:"tab-label",title:t.label},t.label),s("slot",{name:a,onSlotchange:t=>{this.handleSlotChange(t)}}))}))),s("button",{class:"forward-button",ref:t=>this._forwardButton=t,onClick:()=>this.scrollFoward()}))}get _hostElem(){return a(this)}};o.style='@keyframes activate{0%{clip-path:inset(calc(100% - 3px) 50% 0px 50%)}100%{clip-path:inset(calc(100% - 3px) 0px 0px 0px)}}:host{display:flex;position:relative;width:100%;overflow:hidden;--tabselector--backward-icon:url(\'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" height="16px" width="10px"><path d="M 9.7808475,13.860393 3.9204526,8.0000004 9.7808475,2.0624965 7.9301965,0.28895552 0.21915255,8.0000004 7.9301965,15.711044 Z"/></svg>\');--tabselector--forward-icon:url(\'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" height="16px" width="10px"><path d="M 0.21915251,13.860393 6.0795475,8.0000007 0.21915251,2.0624968 2.0698036,0.28895588 9.7808475,8.0000007 2.0698036,15.711044 Z"/></svg>\')}.scroll{display:flex;width:100%;scroll-behavior:smooth;overflow-x:auto;scrollbar-width:none}.scroll.startHidden{-webkit-mask-image:linear-gradient(90deg, transparent 20px, #000 48px)}.scroll.midle{-webkit-mask-image:linear-gradient(90deg, transparent 20px, #000 48px, #000 calc(100% - 48px), transparent calc(100% - 20px))}.scroll.endHidden{-webkit-mask-image:linear-gradient(90deg, #000 calc(100% - 48px), transparent calc(100% - 20px))}.tab{display:flex;border:none;min-width:100px;background-color:unset;cursor:pointer;padding:6px 12px;align-items:center;justify-content:center;color:var(--text--primary, #626e82);font-family:var(--font-pattern, "Sora, Algerian");font-size:var(--title--small, 14px)}.tab:focus,.forward-button,.backward-button{outline:none}.is-active{position:relative;color:var(--color--primary, #008561)}.is-active::after{content:"";position:absolute;width:100%;height:100%;background-color:var(--color--primary, #008561);clip-path:inset(calc(100% - 3px) 0px 0px 0px);animation:activate 0.25s ease-in-out}.is-focused{border:1px dashed var(--color--primary, #000000c5)}.tab-label{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;text-shadow:var(--text-shadow);margin-bottom:var(--space--extra-small, 3px)}.forward-button,.backward-button{position:absolute;z-index:1;display:flex;box-sizing:border-box;padding:0px;top:0px;right:0px;width:16px;height:100%;border:none;background-color:unset;cursor:pointer;justify-content:center;align-items:center}.backward-button{left:0px}.forward-button::after,.backward-button::after{content:\'\';display:flex;background-color:var(--text--primary, #008561);width:10px;height:16px}.forward-button::after{-webkit-mask-image:var(--tabselector--forward-icon);mask-image:var(--tabselector--forward-icon)}.backward-button::after{-webkit-mask-image:var(--tabselector--backward-icon);mask-image:var(--tabselector--backward-icon)}.forward-button:hover::after,.backward-button:hover::after{background-color:var(--color--primary, #4e4e4e)}.hidden{display:none}.scroll::-webkit-scrollbar{display:none}';export{o as ez_tabselector}
@@ -1 +0,0 @@
1
- import{r as e,c as t,h as o}from"./p-60138b72.js";let s=class{constructor(o){e(this,o),this.ezChange=t(this,"ezChange",7),this.selectedOption={value:"na",label:"N/A"}}render(){return o("ez-combo-box",{class:"grid-config-combo inverted",label:"",suppressSearch:!0,value:this.selectedOption,enabled:!0,canShowError:!1,suppressEmptyOption:!0},o("option",{value:"na"},"N/A"),o("option",{value:"asc"},"A-Z"),o("option",{value:"desc"},"Z-A"))}static get assetsDirs(){return["../assets"]}};s.style="ez-combo-box{width:100px}.grid-config-combo{--ez-text-input--height:28px;--ez-text-input__input--background-color:#fff;--ez-text-input__input--border-color:#dce0e8}";export{s as select_box}
@@ -1 +0,0 @@
1
- import{r as a,c as e,f as r,h as l}from"./p-60138b72.js";import{FloatingManager as t}from"@sankhyalabs/core";let i=class{constructor(r){a(this,r),this.ezChange=e(this,"ezChange",7),this._firstRender=!0,this._todayLabel="Hoje",this._weekDayLabels=["D","S","T","Q","Q","S","S"],this._monthLabels=["Janeiro","Fevereiro","Março","Abril","Maio","Junho","Julho","Agosto","Setembro","Outubro","Novembro","Dezembro"],this._hoursLabel=["00","01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22","23"],this._minutosLabel=["00","01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40","41","42","43","44","45","46","47","48","49","50","51","52","53","54","55","56","57","58","59"],this.value=new Date,this.floating=!1,this.time=!1,this.showSeconds=!1}async show(a,e,r,l){this.floating&&(this._floatingID=t.float(this._box,this._container,{autoClose:!0,top:a,left:e,bottom:r,right:l}),window.requestAnimationFrame((()=>{this._box.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})})),this.scroll())}async fitVertical(a,e){const r=this._container.getBoundingClientRect().bottom+this._calendarHeight;(window.innerHeight||document.documentElement.clientHeight)>r?this.show(a+"px",void 0,"unset"):this.show("unset",void 0,e+"px")}async hide(){void 0!==this._floatingID&&(t.close(this._floatingID),this._floatingID=void 0)}valueChanged(){this.value&&(this._currentPosition.setTime(this.value.getTime()),this._currentPosition.setDate(1))}getMonthLabel(){return this._monthLabels[this._currentPosition.getMonth()]+" "+this._currentPosition.getFullYear()}isSelectedDate(a){return!!this.value&&this.value.getDate()==a.getDate()&&this.value.getMonth()==a.getMonth()&&this.value.getFullYear()==a.getFullYear()}changeMonth(a){this._currentPosition.setMonth(this._currentPosition.getMonth()+a),r(this)}selectDate(a){let e=a;this.value&&(this.time||this.showSeconds)&&(e.setHours(this.value.getHours()),e.setMinutes(this.value.getMinutes()),e.setSeconds(this.showSeconds?this.value.getSeconds():0)),this.value=e,this.ezChange.emit(this.value)}selectHours(a){this.value||(this.value=new Date),this.value=new Date(this.value.getFullYear(),this.value.getMonth(),this.value.getDate(),a,this.value.getMinutes(),this.value.getSeconds()),this.ezChange.emit(this.value)}selectMinutes(a){this.value||(this.value=new Date),this.value=new Date(this.value.getFullYear(),this.value.getMonth(),this.value.getDate(),this.value.getHours(),a,this.value.getSeconds()),this.ezChange.emit(this.value)}selectSeconds(a){this.value||(this.value=new Date),this.value=new Date(this.value.getFullYear(),this.value.getMonth(),this.value.getDate(),this.value.getHours(),this.value.getMinutes(),a),this.ezChange.emit(this.value)}updateScroll(a){if(a){const{scrollHeight:e,clientHeight:r,scrollTop:l}=a;e-r-Math.ceil(l)>0?a.classList.add("endHidden"):a.classList.remove("endHidden")}}componentDidRender(){this.floating&&this._firstRender&&(this._calendarHeight=this._box.clientHeight,this._box.remove(),this._firstRender=!1),this.updateScroll(this._hoursScroll),this.updateScroll(this._minutesScroll),this.updateScroll(this._secondsScroll)}componentDidLoad(){this.scroll()}scroll(){(this.time||this.showSeconds)&&(this._hoursScroll.scrollTop=this._hoursSelect.offsetTop-64,this._minutesScroll.scrollTop=this._minutesSelect.offsetTop-64,this.updateScroll(this._hoursScroll),this.updateScroll(this._minutesScroll),this.showSeconds&&(this._secondsScroll.scrollTop=this._secondsSelect.offsetTop-64,this.updateScroll(this._secondsScroll)))}render(){null==this._currentPosition&&(this._currentPosition=new Date,this.value&&this._currentPosition.setTime(this.value.getTime()),this._currentPosition.setDate(1));const a=new Date;return a.setTime(this._currentPosition.getTime()),a.setDate(1-a.getDay()),l("section",{ref:a=>this._container=a},l("div",{ref:a=>this._box=a,class:"calendar__container"},l("div",{class:"calendar"},l("div",{class:"calendar__header"},l("button",{class:"calendar__btn-previous",onClick:()=>this.changeMonth(-1)}),l("label",{class:"calendar__lbl-month"},this.getMonthLabel()),l("button",{class:"calendar__btn-next",onClick:()=>this.changeMonth(1)})),l("div",{class:"calendar__body"},l("div",{class:"calendar__line"},this._weekDayLabels.map((a=>l("div",{class:"calendar__cell calendar__cell--unselectable"},a)))),[0,7,14,21,28,35].map((e=>l("div",{class:"calendar__line"},[0,1,2,3,4,5,6].map((r=>{const t=new Date;t.setTime(a.getTime()),t.setDate(t.getDate()+e+r);let i="calendar__cell";return this._currentPosition.getMonth()!=t.getMonth()?i+=" calendar__cell--secondary":this.isSelectedDate(t)&&(i+=" calendar__cell--selected"),l("div",{class:i,onClick:()=>this.selectDate(t)},t.getDate())})))))),l("div",{class:"calendar__footer"},l("button",{class:"calendar__btn-today",onClick:()=>this.selectDate(new Date)},this._todayLabel))),(this.time||this.showSeconds)&&l("div",{class:"calendar-time"},l("div",{class:"calendar-time__header"},l("div",null,"H"),l("div",{class:"separatorTime"},":"),l("div",null,"M"),this.showSeconds&&l("div",{class:"separatorTime"},":"),this.showSeconds&&l("div",null,"S")),l("div",{class:"calendar__body ",style:{display:"flex",paddingLeft:"12px",paddingRight:"12px"}},l("div",{class:"calendar__column",ref:a=>this._hoursScroll=a,onScroll:()=>this.updateScroll(this._hoursScroll)},this._hoursLabel.map(((a,e)=>e===this.value.getHours()?l("div",{style:{display:"flex"},ref:a=>this._hoursSelect=a},l("div",{class:"calendar__cell calendar__cell--selected",onClick:()=>this.selectHours(e)},a),l("div",{class:"separatorTime"},":")):l("div",{style:{display:"flex"}},l("div",{class:"calendar__cell",onClick:()=>this.selectHours(e)},a),l("div",{class:"separatorTime"},":"))))),l("div",{class:"calendar__column",ref:a=>this._minutesScroll=a,onScroll:()=>this.updateScroll(this._minutesScroll)},this._minutosLabel.map(((a,e)=>e===this.value.getMinutes()?l("div",{style:{display:"flex"},ref:a=>this._minutesSelect=a},l("div",{class:"calendar__cell calendar__cell--selected",onClick:()=>this.selectMinutes(e)},a),this.showSeconds&&l("div",{class:"separatorTime"},":")):l("div",{style:{display:"flex"}},l("div",{class:"calendar__cell",onClick:()=>this.selectMinutes(e)},a),this.showSeconds&&l("div",{class:"separatorTime"},":"))))),this.showSeconds&&l("div",{class:"calendar__column",ref:a=>this._secondsScroll=a,onScroll:()=>this.updateScroll(this._secondsScroll)},this._minutosLabel.map(((a,e)=>e===this.value.getSeconds()?l("div",{class:"calendar__cell calendar__cell--selected",onClick:()=>this.selectSeconds(e),ref:a=>this._secondsSelect=a},a):l("div",{class:"calendar__cell",onClick:()=>this.selectSeconds(e)},a))))))))}static get watchers(){return{value:["valueChanged"]}}};i.style=':host{--ez-calendar--font-family:var(--font-pattern, Arial);--ez-calendar--color:var(--title--primary, #626e82);--ez-calendar--text-shadow:var(--text-shadow, 0 0 0 #353535, 0 0 1px transparent);--ez-calendar__body--background-color:var(--background--xlight, #FFF);--ez-calendar__time--background-color:var(--background--xlight, #FAFAFA);--ez-calendar__body--padding:var(--space--medium, 12px) var(--space--small, 6px);--ez-calendar__body--border-radius:var(--border--radius-medium, 12px);--ez-calendar__body--shadow:var(--shadow, 0px 0px 16px 0px #000);--ez-container--z-index:var(--more-visible, 2);--ez-calendar__header-line--stroke:1px;--ez-calendar__header-line--color:var(--color--strokes, #C0C0C0);--ez-calendar__nav-btn--fill:var(--text--primary, #008561);--ez-calendar__nav-btn--hover--fill:var(--color--primary, #350404);--ez-calendar__nav-btn--width:10px;--ez-calendar__nav-btn--height:16px;--ez-calendar__nav-btn--previous-image:url(\'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" height="16px" width="10px"><path d="M 9.7808475,13.860393 3.9204526,8.0000004 9.7808475,2.0624965 7.9301965,0.28895552 0.21915255,8.0000004 7.9301965,15.711044 Z"/></svg>\');--ez-calendar__nav-btn--next-image:url(\'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" height="16px" width="10px"><path d="M 0.21915251,13.860393 6.0795475,8.0000007 0.21915251,2.0624968 2.0698036,0.28895588 9.7808475,8.0000007 2.0698036,15.711044 Z"/></svg>\');--ez-calendar__cell--margin:0px 1.5px;--ez-calendar__cell--width:var(--space--large, 24px);--ez-calendar__cell--padding:1.5px 0px;--ez-calendar__cell--border-radius:var(--border--radius-small, 6px);--ez-calendar__cell--over--background-color:var(--color--primary, #E2F4EF);--ez-calendar__cell--over--color:var(--color--primary-300, #008561);--ez-calendar__cell--outset--color:var(--color--disable-primary, #E5EAF0);--ez-calendar__cell--selected--background-color:var(--color--primary, #008561);--ez-calendar__cell--selected--color:var(--color--inverted, #FFF);--ez-calendar__btn-today--color:var(--color--primary);--ez-calendar__btn-today--hover--background-color:var(--color--primary-300, #E2F4EF);--ez-calendar__btn-today--border-radius:var(--border--radius-small, 6px);position:relative;display:flex;user-select:none}.calendar__container{display:flex;z-index:var(--more-visible, 2)}.calendar{z-index:var(--more-visible, 2);display:flex;flex-direction:column;background-color:var(--ez-calendar__body--background-color);padding:var(--ez-calendar__body--padding);border-radius:var(--ez-calendar__body--border-radius);box-shadow:var(--ez-calendar__body--shadow)}.calendar__header{display:flex;justify-content:space-between;padding-bottom:var(--space--small, 6px);margin:0px var(--space--, 12px) var(--space--small, 6px) var(--space--, 12px);font-family:var(--ez-calendar--font-family);color:var(--ez-calendar--color);text-shadow:var(--ez-calendar--text-shadow);border-bottom:solid var(--ez-calendar__header-line--stroke) var(--ez-calendar__header-line--color)}.calendar__btn-next,.calendar__btn-previous{outline:none;border:none;background-color:unset;cursor:pointer;padding:0px}.calendar__btn-next::after,.calendar__btn-previous::after{content:\'\';display:flex;background-color:var(--ez-calendar__nav-btn--fill);width:var(--ez-calendar__nav-btn--width);height:var(--ez-calendar__nav-btn--height)}.calendar__btn-previous::after{-webkit-mask-image:var(--ez-calendar__nav-btn--previous-image);mask-image:var(--ez-calendar__nav-btn--previous-image)}.calendar__btn-next::after{-webkit-mask-image:var(--ez-calendar__nav-btn--next-image);mask-image:var(--ez-calendar__nav-btn--next-image)}.calendar__btn-next:hover::after,.calendar__btn-previous:hover::after{background-color:var(--ez-calendar__nav-btn--hover--fill)}.calendar__lbl-month{font-weight:var(--text-weight--extra-large, 700);font-size:var(--title--small, 14px);font-family:var(--ez-calendar--font-family);color:var(--ez-calendar--color);text-shadow:var(--ez-calendar--text-shadow)}.calendar__line{display:flex;padding:0px;margin:0px}.calendar__cell{display:flex;justify-content:center;align-content:center;cursor:pointer;font-size:var(--text--extra-small, 10px);font-family:var(--ez-calendar--font-family);color:var(--ez-calendar--color);text-shadow:var(--ez-calendar--text-shadow);padding:var(--ez-calendar__cell--padding);margin:var(--ez-calendar__cell--margin);min-width:var(--ez-calendar__cell--width);border-radius:var(--ez-calendar__cell--border-radius)}.calendar__cell:hover{background-color:var(--ez-calendar__cell--over--background-color);color:var(--ez-calendar__cell--over--color)}.calendar__cell--secondary{color:var(--ez-calendar__cell--outset--color)}.calendar__cell--unselectable:hover{background-color:unset;border-radius:unset;cursor:unset}.calendar__cell--unselectable{font-weight:var(--text-weight--large, 600);font-family:var(--ez-calendar--font-family);color:var(--ez-calendar--color);text-shadow:var(--ez-calendar--text-shadow)}.calendar__cell--selected,.calendar__cell--selected:hover{background-color:var(--ez-calendar__cell--selected--background-color);color:var(--ez-calendar__cell--selected--color)}.calendar__footer{display:flex;flex-direction:column}.calendar__btn-today{border:none;background-color:unset;cursor:pointer;font-weight:var(--text-weight--large, 600);font-size:var(--title--extra-small, 12px);padding:0px;font-family:var(--ez-calendar--font-family);text-shadow:var(--ez-calendar--text-shadow);color:var(--ez-calendar__btn-today--color);border-radius:var(--ez-calendar__btn-today--border-radius)}.calendar__btn-today:hover{background-color:var(--ez-calendar__btn-today--hover--background-color)}section{display:flex}.calendar-time{margin-left:-10px;display:flex;flex-direction:column;padding:12px 0px 0px 10px;background-color:var(--ez-calendar__time--background-color);border-top-right-radius:var(--ez-calendar__body--border-radius);border-bottom-right-radius:var(--ez-calendar__body--border-radius);box-shadow:var(--ez-calendar__body--shadow)}.calendar__column{height:136px;padding:0px;margin:0px;overflow:auto}.calendar__column::-webkit-scrollbar{width:0px;max-width:0px;min-width:0px}.calendar-time__header{padding-left:var(--space--small, 6px);padding-right:var(--space--small, 6px);display:flex;justify-content:space-between;padding-bottom:var(--space--small, 6px);margin:0px var(--space--, 12px) var(--space--small, 6px) var(--space--, 12px);font-weight:var(--text-weight--extra-large, 700);font-size:var(--title--small, 14px);font-family:var(--ez-calendar--font-family);color:var(--ez-calendar--color);text-shadow:var(--ez-calendar--text-shadow);border-bottom:solid var(--ez-calendar__header-line--stroke) var(--ez-calendar__header-line--color);font-family:var(--ez-calendar--font-family);color:var(--ez-calendar--color);text-shadow:var(--ez-calendar--text-shadow)}.separatorTime{color:#A2ABB9;padding:0px 1px;line-height:16px;font-size:17px;font-weight:normal}.endHidden{-webkit-mask-image:linear-gradient(180deg, #000 calc(100% - 48px), transparent 100%)}.calendar__column .calendar__cell{margin:0px;padding:1.5px 1.5px}';export{i as ez_calendar}
@@ -1 +0,0 @@
1
- import{r as l,c as o,h as e}from"./p-60138b72.js";let i=class{constructor(e){l(this,e),this.ezChange=o(this,"ezChange",7),this.value=!1,this.headerSize="small",this.iconPlacement="left",this.stretchTitle=!1}observeCollapsedValue(){this.ezChange.emit(this.value)}async showHide(){this.value=!this.value}getHeaderSize(){const l=["xsmall","xlarge"].includes(this.headerSize)?this.headerSize.replace("x","x-"):this.headerSize;return["x-small","small","medium","large","x-large"].includes(l)?l:"small"}render(){return e("div",{class:"collapsible-box"},e("div",{class:"collapsible-box__header"},e("button",{onClick:()=>this.showHide(),class:"collapsible-box__title"+("right"===this.iconPlacement?" collapsible-box__title--icon-right":"")+(this.stretchTitle?" collapsible-box__title--stretched":"")},e("ez-icon",{slot:"icon","icon-name":"chevron-right",size:this.getHeaderSize(),class:"collapsible-box__icon collapsible-box__icon--"+this.getHeaderSize()+(this.value?" collapsible-box__icon--collapsed":"")}),e("label",{class:"collapsible-box__label font--"+this.getHeaderSize(),title:this.label},this.label))),e("div",{class:"collapsible-box__content"+(this.value?"":" collapsible-box__content--show")},e("slot",null)))}static get watchers(){return{value:["observeCollapsedValue"]}}};i.style=":host{--ez-collapsible-box--font-size:var(--title--medium, 14px);--ez-collapsible-box--font-family:var(--font-pattern, Arial);--ez-collapsible-box--font-weight:var(--text-weight--large, 600);--ez-collapsible-box--color:var(--title--primary);--ez-collapsible-box__icon--color:var(--ez-collapsible-box--color);--ez-collapsible-box__header--padding-top:0px;--ez-collapsible-box__header--padding-bottom:0px;--ez-collapsible-box__header--padding-right:0px;--ez-collapsible-box__header--padding-left:0px;display:flex;flex-wrap:wrap;width:100%}.collapsible-box{display:flex;flex-direction:column;width:100%}.collapsible-box__header{display:flex;box-sizing:border-box;padding-top:var(--ez-collapsible-box__header--padding-top);padding-bottom:var(--ez-collapsible-box__header--padding-bottom);padding-right:var(--ez-collapsible-box__header--padding-right);padding-left:var(--ez-collapsible-box__header--padding-left)}.collapsible-box__title{position:relative;width:auto;display:flex;box-sizing:border-box;align-items:center;outline:none;border:none;background-color:unset;cursor:pointer;padding:0px;text-align:left;margin-bottom:var(--space--medium, 12px)}.collapsible-box__label{white-space:nowrap;overflow:hidden;cursor:pointer;text-overflow:ellipsis;box-sizing:border-box;margin-left:6px;font-family:var(--ez-collapsible-box--font-family);font-size:var(--ez-collapsible-box--font-size);font-weight:var(--ez-collapsible-box--font-weight);color:var(--ez-collapsible-box--color)}.collapsible-box__icon{transform:rotate(90deg) translate(0px, 14%);transition:transform var(--transition);--ez-icon--color:var(--ez-collapsible-box__icon--color, --ez-collapsible-box--color)}.collapsible-box__icon--collapsed{transform:rotate(0deg) translate(-14%, 0px)}.collapsible-box__title--icon-right{flex-direction:row-reverse}.collapsible-box__title--icon-right .collapsible-box__icon{transform:rotate(90deg) translate(0px, -14%)}.collapsible-box__title--icon-right .collapsible-box__icon--collapsed{transform:rotate(0deg) translate(14%, 0px)}.collapsible-box__title--icon-right .collapsible-box__label{margin-left:0px;margin-right:6px}.collapsible-box__title--stretched{width:100%;justify-content:space-between}.collapsible-box__content{display:flex;flex-wrap:wrap;overflow:hidden;width:100%;height:0px;max-height:0px;opacity:0;transition:all var(--transition, 0.5s)}.collapsible-box__content--show{height:100%;max-height:none;opacity:1;transition:all var(--transition, 0.5s)}.font--x-small{font-size:10px}.font--small{font-size:12px}.font--medium{font-size:14px}.font--large{font-size:16px}.font--x-large{font-size:20px}";export{i as ez_collapsible_box}
@@ -1 +0,0 @@
1
- import{h as e,r as t,c as i,f as n,H as r,g as o}from"./p-60138b72.js";import{UserInterface as a,Action as s,ApplicationContext as l,DataUnitAction as c,DataUnit as d}from"@sankhyalabs/core";import{A as u}from"./p-0cd386db.js";const h=({name:t,label:i})=>e("div",{class:"col col--sd-12 col--tb-3 padding-horizontal--small"},e("ez-text-input",{label:i,"data-field-name":t,key:t}));function f(t,i,n,r=!1){return e("div",{class:"col col--sd-12 col--tb-3 align--middle padding-horizontal--small padding-bottom--large"},e("ez-check",{enabled:!n,label:i,mode:r?"switch":"regular","data-field-name":t,key:t}))}function b(t,i,n,r,o){return e("div",{class:"col col--sd-12 col--tb-3 padding-horizontal--small"},e("ez-number-input",{enabled:!n,label:i,precision:r,prettyPrecision:o,"data-field-name":t,key:t}))}const p=new Map;p.set(a.LONGTEXT,(({name:t,label:i,readOnly:n})=>e("div",{class:"col col--sd-12 padding-horizontal--small",key:t},e("ez-text-area",{enabled:!n,label:i,"data-field-name":t})))),p.set(a.CHECKBOX,(e=>f(e.name,e.label,e.readOnly,!1))),p.set(a.SWITCH,(e=>f(e.name,e.label,e.readOnly,!0))),p.set(a.OPTIONSELECTOR,(({name:t,label:i,readOnly:n,required:r},o)=>{const a=null==o?void 0:o.options;let s;if("string"==typeof a){const e=JSON.parse(a);s=Object.keys(e).map((t=>({value:t,label:e[t]})))}else s=a;return e("div",{class:"col col--sd-12 col--tb-3 padding-horizontal--small"},e("ez-combo-box",{enabled:!n,suppressEmptyOption:r,label:i,"data-field-name":t,key:t,options:s}))})),p.set(a.SEARCH,(({name:t,label:i,readOnly:n,required:r})=>e("div",{class:"col col--sd-12 col--tb-3 padding-horizontal--small"},e("ez-search",{enabled:!n,suppressEmptyOption:r,label:i,"data-field-name":t,key:t})))),p.set(a.FILE,(({name:t,label:i,readOnly:n})=>e("div",{class:"col col--sd-12 padding-horizontal--small"},e("ez-upload",{enabled:!n,label:i,"data-field-name":t,key:t})))),p.set(a.DATE,(({name:t,label:i,readOnly:n})=>e("div",{class:"col col--sd-12 col--tb-3 padding-horizontal--small"},e("ez-date-input",{enabled:!n,label:i,"data-field-name":t,key:t})))),p.set(a.TIME,(({name:t,label:i})=>e("div",{class:"col col--sd-12 col--tb-3 padding-horizontal--small"},e("ez-time-input",{label:i,"data-field-name":t,key:t})))),p.set(a.DATETIME,(({name:t,label:i})=>e("div",{class:"col col--sd-12 col--tb-3 padding-horizontal--small"},e("ez-date-time-input",{label:i,"data-field-name":t,key:t})))),p.set(a.DECIMALNUMBER,(({name:e,label:t,readOnly:i},n)=>{const r=Number((null==n?void 0:n.precision)||2);return b(e,t,i,r,Number((null==n?void 0:n.prettyPrecision)||r))})),p.set(a.INTEGERNUMBER,(({name:e,label:t,readOnly:i})=>b(e,t,i,0,0)));const m=e=>{const t=e.descriptor,i=Object.assign({},e.config);let n,r;return t&&(i.label||(i.label=t.label),i.name||(i.name=t.name),void 0===i.required&&(i.required=t.required),void 0===i.readOnly&&(i.readOnly=t.readOnly),r=t.properties,n=p.get(t.userInterface)),i.required&&(i.label=`* ${i.label} (obrigatório)`),n||(n=h),n(i,r)},v=({source:t})=>"items"in t?e("ez-collapsible-box",{label:t.label,"header-size":"large"},t.items.map((e=>m(e)))):m(t),y=({store:t,source:i})=>e("div",{class:"dynamic-content box__container"},e("div",{class:"row padding-vertical--small"},i.items.map((i=>e(v,{store:t,source:i})))));class g{constructor(){this._sheets=new Map,this._requiredFields=[],this._cleanOnCopyFields=[]}getSheet(e){return this._sheets.get(e)}getAllSheets(){return this._sheets}addSheet(e){this._sheets.set(e.name,e),this._requiredFields=this._requiredFields.concat(e.requiredFields),this._cleanOnCopyFields=this._cleanOnCopyFields.concat(e.cleanOnCopyFields)}getRequiredFields(){return this._requiredFields}getCleanOnCopyFields(){return this._cleanOnCopyFields}}function _(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var w="function"==typeof Symbol&&Symbol.observable||"@@observable",O=function(){return Math.random().toString(36).substring(7).split("").join(".")},E={INIT:"@@redux/INIT"+O(),REPLACE:"@@redux/REPLACE"+O(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+O()}};function z(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function A(e,t,i){var n;if("function"==typeof t&&"function"==typeof i||"function"==typeof i&&"function"==typeof arguments[3])throw new Error(_(0));if("function"==typeof t&&void 0===i&&(i=t,t=void 0),void 0!==i){if("function"!=typeof i)throw new Error(_(1));return i(A)(e,t)}if("function"!=typeof e)throw new Error(_(2));var r=e,o=t,a=[],s=a,l=!1;function c(){s===a&&(s=a.slice())}function d(){if(l)throw new Error(_(3));return o}function u(e){if("function"!=typeof e)throw new Error(_(4));if(l)throw new Error(_(5));var t=!0;return c(),s.push(e),function(){if(t){if(l)throw new Error(_(6));t=!1,c();var i=s.indexOf(e);s.splice(i,1),a=null}}}function h(e){if(!z(e))throw new Error(_(7));if(void 0===e.type)throw new Error(_(8));if(l)throw new Error(_(9));try{l=!0,o=r(o,e)}finally{l=!1}for(var t=a=s,i=0;i<t.length;i++)(0,t[i])();return e}function f(e){if("function"!=typeof e)throw new Error(_(10));r=e,h({type:E.REPLACE})}function b(){var e,t=u;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new Error(_(11));function i(){e.next&&e.next(d())}return i(),{unsubscribe:t(i)}}})[w]=function(){return this},e}return h({type:E.INIT}),(n={dispatch:h,subscribe:u,getState:d,replaceReducer:f})[w]=b,n}const C={};function x(e=C,t){switch(t.type){case N.METADATA_LOADED:return Object.assign(Object.assign({},e),{formMetadata:t.payload});case N.CHANGE_TAB:return Object.assign(Object.assign({},e),{currentSheet:t.payload});default:return e}}function R(e){return e.formMetadata}var N;!function(e){e.METADATA_LOADED="FORM/METADATA_LOADED",e.CHANGE_TAB="FORM/CHANGE_TAB"}(N||(N={}));class j{constructor(e){this.onDataUnitEvent=e=>{var t;switch(e.type){case s.DATA_LOADED:case s.DATA_SAVED:case s.RECORDS_REMOVED:case s.RECORDS_ADDED:case s.RECORDS_COPIED:case s.DATA_CHANGED:case s.EDITION_CANCELED:case s.CHANGE_UNDONE:case s.CHANGE_REDONE:case s.SELECTION_CHANGED:case s.NEXT_SELECTED:case s.PREVIOUS_SELECTED:null===(t=this._fields)||void 0===t||t.forEach((e=>{this.updateValue(e.fieldName,e.field)}))}},this._fields=new Map,this._dataUnit=e,this._dataUnit.subscribe(this.onDataUnitEvent)}bind(e){e.forEach((e=>{this.updateBind(e.dataset.fieldName,e)}))}onDisconnectedCallback(){this._dataUnit.unsubscribe(this.onDataUnitEvent)}updateValue(e,t){const i=t.value,n=this._dataUnit.getFieldValue(e);i!=n&&(t.value=n)}updateBind(e,t){const i=this._fields.get(e);i&&i.destroy(),t.value=this._dataUnit.getFieldValue(e),this._fields.set(e,k.create(e,t,((e,t)=>this.changeStarted(e,t)),((e,t)=>this.setFieldValue(e,t)))),this.bindSearchOptionsLoader(e,t),this.applyEzUploadContext(e,t)}changeStarted(e,t){0===this._dataUnit.records.length&&this._dataUnit.addRecord(),this._dataUnit.startChange(e,t)}setFieldValue(e,t){0===this._dataUnit.records.length&&this._dataUnit.addRecord(),this._dataUnit.setFieldValue(e,t)}bindSearchOptionsLoader(e,t){if("EZ-SEARCH"===t.nodeName&&void 0===t.optionLoader){const i=l.getContextValue("__EZUI__SEARCH__OPTION__LOADER__");i&&(t.optionLoader=t=>i(t,e,this._dataUnit))}}applyEzUploadContext(e,t){var i,n;if("EZ-UPLOAD"===t.nodeName){t.urlUpload=l.getContextValue("__EZUI__UPLOAD__ADD__URL__"),t.urlDelete=l.getContextValue("__EZUI__UPLOAD__DEL__URL__");const r=this._dataUnit.getField(e),o=null===(i=r.properties)||void 0===i?void 0:i.DESTINATION;o&&(t.requestHeaders={XTRAINF:`{"destination": "${o}"}`}),t.maxFiles=(null===(n=r.properties)||void 0===n?void 0:n.MAX_FILES)||0}}}class k{constructor(){this.startChangeEventName="ezStartChange",this.changeEventName="ezChange"}destroy(){this.field.removeEventListener(this.startChangeEventName,this.startChangeListener),this.field.removeEventListener(this.changeEventName,this.changeListener)}static create(e,t,i,n){const r=new k;return r.field=t,r.fieldName=e,r.startChangeListener=t=>{i(e,t.detail)},r.field.addEventListener(r.startChangeEventName,r.startChangeListener),r.changeListener=t=>{n(e,t.detail)},r.field.addEventListener(r.changeEventName,r.changeListener),r}}let S=class{constructor(e){t(this,e),this.ezReady=i(this,"ezReady",7),this.onDataUnitAction=e=>{e.type===s.METADATA_LOADED&&this.processMetadata()}}submit(){return Promise.resolve()}cancel(){return Promise.resolve()}validate(){return new Promise(((e,t)=>{const i=R(this._store.getState()),n=this._staticFields.filter((e=>e.dataset.required)).map((e=>e.dataset.fieldName)).concat(i.getRequiredFields()),r=this.dataUnit.records;for(let e=0;e<r.length;e++)if(!this.validateRequired(n,r[e])){t();break}e()}))}configChanged(){this.processMetadata()}validateRequired(e,t){const i=[];e.forEach((e=>{const n=t[e],r=this._element.querySelector(`[data-field-name=${e}]`);null==n||""===n?(i.push(e),r.errorMessage="Essa informação é obrigatória"):r.errorMessage=""}));const n=0===i.length;return n||u.info("Há pelo menos um campo obrigatório não preenchido."),n}getDynamicContent(){var t;const i=R(this._store.getState());if(!i)return null;const n=(r=null===(t=this._store)||void 0===t?void 0:t.getState()).currentSheet?r.formMetadata.getSheet(r.currentSheet):Array.from(r.formMetadata.getAllSheets().values())[0];var r;if(!n)return null;const o=Array.from(i.getAllSheets().values()),a=[];return o.length>1&&a.push(e("ez-tabselector",{onEzChange:e=>this._store.dispatch(function(e){return{type:N.CHANGE_TAB,payload:e.tabKey}}(e.detail)),selectedTab:n.name},o.map((t=>e("ez-tab",{tabKey:t.name,label:t.label}))))),a.push(e(y,{store:this._store,source:n})),a}processMetadata(){if(!this.isStatic()){const e=this.config&&this.config.length>0?((e,t)=>{const i=new Map,n=[],r=[];e.forEach((e=>{var o;if(!1!==e.visible){const a=function(e,t){return("string"==typeof e?Array.from(t.keys()).find((t=>t.label===e)):e)||{label:e,visible:!0}}(e.tab||"Geral",i),s=t.getField(e.name);if(s&&a.visible){i.has(a)||i.set(a,new Map);const t=i.get(a);(void 0===e.required?s.required:e.required)&&n.push(e.name),(void 0===e.cleanOnCopy?null===(o=s.properties)||void 0===o?void 0:o.cleanOnCopy:e.cleanOnCopy)&&r.push(e.name);const l={config:e,descriptor:s},c=e.group;if(c){const e=`group::${c}`;t.has(e)?t.get(e).items.push(l):t.set(e,{label:c,items:[l]})}else t.set(e.name,l)}}}));const o=new g;return Array.from(i.entries()).sort(((e,t)=>(e[0].order||1e4)-(t[0].order||1e4))).forEach((([e,t])=>{o.addSheet({label:e.label,name:e.label,items:Array.from(t.values()),requiredFields:n,cleanOnCopyFields:r})})),o})(this.config,this.dataUnit):(()=>{var e;const t=this.dataUnit.metadata,i=new g;if(t){const n=null===(e=t.fields)||void 0===e?void 0:e.filter((e=>!1!==e.visible));i.addSheet({label:t.label,name:t.name,items:n.map((e=>({descriptor:e}))),requiredFields:n.filter((e=>e.required)).map((e=>e.name)),cleanOnCopyFields:n.filter((e=>{var t;return null===(t=e.properties)||void 0===t?void 0:t.cleanOnCopy})).map((e=>e.name))})}return i})();this._store.dispatch({type:N.METADATA_LOADED,payload:e})}}isStatic(){var e;return(null===(e=this._staticFields)||void 0===e?void 0:e.length)>0}interceptAction(e){if(e.type===s.RECORDS_COPIED){const t=R(this._store.getState()).getCleanOnCopyFields();if(t)return new c(s.RECORDS_COPIED,e.payload.map((e=>{const i=Object.assign({},e);return t.forEach((e=>delete i[e])),i})))}return e}componentWillLoad(){void 0===this.dataUnit&&(this.dataUnit=new d("ez-form")),this.dataUnit.addInterceptor(this),this.dataUnit.subscribe(this.onDataUnitAction),this._dataBinder=new j(this.dataUnit),this._store=A(x),this._store.subscribe((()=>n(this))),this._staticFields=Array.from(this._element.querySelectorAll("[data-field-name]")),this.processMetadata()}componentDidRender(){this._dataBinder.bind(Array.from(this._element.querySelectorAll("[data-field-name]"))),this.ezReady.emit()}disconnectedCallback(){this.dataUnit.unsubscribe(this.onDataUnitAction),this.dataUnit.removeInterceptor(this),this._dataBinder.onDisconnectedCallback()}render(){return e(r,null,this.isStatic()?null:this.getDynamicContent())}get _element(){return o(this)}static get watchers(){return{config:["configChanged"]}}};S.style="ez-form{display:flex;flex-direction:column;width:100%}.dynamic-content ez-collapsible-box{--ez-collapsible-box__header--padding-right:var(--space-small, 6px);--ez-collapsible-box__header--padding-left:var(--space-small, 6px)}";export{S as ez_form}
@@ -1 +0,0 @@
1
- import{r as o,c as t,h as e,H as i,g as s}from"./p-60138b72.js";import{FloatingManager as r}from"@sankhyalabs/core";import{C as a}from"./p-933a7475.js";let n=class{constructor(e){o(this,e),this.ezChange=t(this,"ezChange",7),this.enabled=!0,this.showSelectedValue=!1,this.showOptionValue=!1,this.suppressSearch=!1,this.suppressEmptyOption=!1,this.canShowError=!0,this.mode="regular"}internalUpdate(){this._inputElement&&(this._inputElement.value=this.getText()),this.hideOptions(),this._criteria=void 0,this._preSelection=void 0,this.updateVisibleOptions()}async setFocus(){this._inputElement.setFocus()}async setBlur(){this._inputElement.setBlur()}getText(){let o="";const t=this.getSelectedOption();return t&&(o=this.showSelectedValue?`${t.value} - ${t.label}`:t.label),o}getSelectedOption(){return"string"==typeof this.value||this.value instanceof String?this._visibleOptions.find((o=>o.value===this.value)):this.value}updateVisibleOptions(){let o=this._source||[];if(!this.searchMode&&this._criteria){const t=this._criteria.toUpperCase();o=o.filter((o=>o.label.toLocaleUpperCase().indexOf(t)>-1))}this._visibleOptions=this.suppressEmptyOption?o:[{value:void 0,label:""}].concat(o)}buildItem(o,t){return e("li",{class:t===this._preSelection?"item preselected":"item",id:`item_${o.value}`,onMouseDown:()=>this.selectOption(o),onMouseOver:()=>this._preSelection=void 0},e("span",{class:"item--label",title:o.label},o.label),this.showOptionValue?e("span",{class:"item--value",title:o.value},o.value):void 0)}showOptions(){this.enabled&&(this._floatingID=r.float(this._optionsList,this._listContainer,{autoClose:!0,top:this.errorMessage||!this.canShowError||"slim"==this.mode?"0px":"-19px"}),window.requestAnimationFrame((()=>{this._optionsList.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})})))}hideOptions(){void 0!==this._floatingID&&r.close(this._floatingID),this._floatingID=void 0}isOptionsVisible(){return void 0!==this._floatingID&&r.isFloating(this._floatingID)}nextOption(){this.searchMode&&!this.isOptionsVisible()||(this.showOptions(),this._preSelection=void 0===this._preSelection?0:Math.min(this._preSelection+1,this._visibleOptions.length-1),this.scrollToOption(this._visibleOptions[this._preSelection],!0))}previousOption(){this._preSelection=void 0===this._preSelection?0:Math.max(this._preSelection-1,0),this.scrollToOption(this._visibleOptions[this._preSelection],!1)}scrollToOption(o,t){window.requestAnimationFrame((()=>{const e=this._optionsList.querySelector(`li#item_${o.value}`);if(e){const o=e.parentElement,i=o.getBoundingClientRect(),s=e.getBoundingClientRect();t&&s.bottom>i.bottom?o.scrollTop=s.top:!t&&s.top<i.top&&(o.scrollTop=0)}}))}selectCurrentOption(){void 0!==this._preSelection&&(this.selectOption(this._visibleOptions[this._preSelection]),this._preSelection=void 0)}selectOption(o){if(this.getSelectedOption()!==o){const t=(null==o?void 0:o.value)?o:void 0;this.value=t,this.errorMessage="",this.ezChange.emit(t)}else this.internalUpdate()}updateSource(o){o instanceof Promise?(o.then((o=>this.updateSource(o))),this.updateVisibleOptions()):Array.isArray(o)?(this._source=o,this.updateVisibleOptions()):this.value=o}loadOptions(o,t=""){this._criteria=t,this.updateSource(this.optionLoader?this.optionLoader({mode:o,argument:t}):this.options)}cancelPreselection(){!this._inputElement.value&&this.value?this.selectOption(void 0):this.internalUpdate()}componentWillLoad(){if(void 0===this.options){this.options=[];const o=this.el.querySelectorAll("option");o&&o.forEach((o=>{let t=o.innerText,e=o.getAttribute("value");e||(e=t),this.options.push({label:t,value:e}),o.hidden=!0}))}this.searchMode?this.updateSource([]):this.loadOptions("PRELOAD")}componentDidRender(){void 0===this._floatingID&&this._optionsList.remove()}componentDidLoad(){a.applyVarsTextInput(this.el,this._inputElement)}onTextInputChangeHandler(o){this._criteria||(this._inputElement.value=o.data);const t=o.target.value;this._criteria=t,this._criteria&&(this.searchMode?(this._changeDeboucingTimeout&&window.clearTimeout(this._changeDeboucingTimeout),this._changeDeboucingTimeout=window.setTimeout((()=>{this.loadOptions("PREDICTIVE",t)}),200)):this.updateVisibleOptions(),this.showOptions())}onTextInputClickHandler(){this.searchMode||this.showOptions()}keyDownHandler(o){switch(o.key){case"ArrowDown":this.nextOption();break;case"ArrowUp":this.previousOption();break;case"Enter":this.selectCurrentOption();break;case"Escape":this.cancelPreselection()}o.stopPropagation()}onTextInputFocusOutHandler(){this.cancelPreselection()}render(){return e(i,null,e("ez-text-input",{class:this.suppressSearch?"suppressed-search-input":"",ref:o=>this._inputElement=o,enabled:this.enabled&&!this.suppressSearch,onInput:o=>this.onTextInputChangeHandler(o),onClick:()=>this.onTextInputClickHandler(),onFocusout:()=>this.onTextInputFocusOutHandler(),onEzChange:o=>o.stopPropagation(),onKeyDown:o=>this.keyDownHandler(o),label:this.label,value:this.getText(),canShowError:this.canShowError,errorMessage:this.errorMessage,mode:this.mode},e("button",this.searchMode?{disabled:!this.enabled,tabindex:-1,class:"btn-open-search",onClick:()=>{this.loadOptions("ADVANCED")},slot:"leftIcon"}:{disabled:!this.enabled,tabindex:-1,class:"btn-open-options",slot:"rightIcon",onClick:()=>this.showOptions()})),e("section",{class:"list-container",ref:o=>this._listContainer=o},e("div",{class:"options-list",ref:o=>this._optionsList=o},this._visibleOptions.map(((o,t)=>this.buildItem(o,t))))))}get el(){return s(this)}static get watchers(){return{value:["internalUpdate"]}}};n.style=':host{--ez-combo-box--height:42px;--ez-combo-box--width:100%;--ez-combo-box__icon--width:48px;--ez-combo-box--border-radius:var(--border--radius-medium, 12px);--ez-combo-box--border-radius-small:var(--border--radius-small, 6px);--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__input--background-color:var(--background--medium, #e0e0e0);--ez-combo-box__input--border:var(--border--medium, 2px solid);--ez-combo-box__input--border-color:var(--ez-combo-box__input--background-color);--ez-combo-box__input--focus--border-color:var(--color--primary, #008561);--ez-combo-box__input--disabled--background-color:var(--color--disable-secondary, #F2F5F8);--ez-combo-box__input--disabled--color:var(--text--disable, #AFB6C0);--ez-combo-box__input--error--border-color:#CC2936;--ez-combo-box__btn-search--background-color:var(--text--primary, #626e82);--ez-combo-box__btn-search-disabled--background-color:var(--text--disable, #AFB6C0);--ez-combo-box__btn-search-hover--background-color:var(--color--primary, #4e4e4e);--ez-combo-box__btn-options--background-color:var(--text--primary, #626e82);--ez-combo-box__btn-options-disabled--background-color:var(--text--disable, #AFB6C0);--ez-combo-box__btn-options-hover--background-color:var(--color--primary, #4e4e4e);--ez-combo-box__label--color:var(--title--primary, #919191);--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));--ez-combo-box__drop-down-image:url(\'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" height="16px" width="16px"><path d="M 1.8585859,3.0707069 7.9999998,9.2121212 14.141414,3.0707069 16,5.0101006 7.9999998,12.929293 0,4.9292932 Z"/></svg>\');--ez-combo-box__search-image:url(\'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" height="22px" width="22px"><path d="m 9.4,2.3 c 4.1,0 7.4,3.2 7.4,7.2 0,1.8 -0.7,3.4 -1.8,4.7 l 0.3,0.3 h 0.9 l 5.7,5.6 -1.7,1.7 -5.7,-5.6 V 15.3 L 14.3,15 C 13,16.1 11.3,16.7 9.5,16.7 5.3,16.7 2,13.5 2,9.5 2,5.5 5.3,2.3 9.4,2.3 m 0,2.2 c -2.9,0 -5.1,2.2 -5.1,5 0,2.8 2.3,5 5.1,5 2.8,0 5.1,-2.2 5.1,-5 0,-2.8 -2.2,-5 -5.1,-5 z"/></svg>\');--ez-combo-box--space--medium:var(--space--medium, 12px);--ez-combo-box--space--small:var(--space--small, 6px);display:flex;flex-wrap:wrap;position:relative;width:var(--ez-combo-box--width)}.suppressed-search-input{--ez-text-input__input--border-color:var(--color--strokes, #dce0e8);--ez-text-input__input--disabled--background-color:var(--background--xlight, #fff);--ez-text-input__input--disabled--color:var(--title--primary, #000)}.list-container{position:relative;width:100%}.options-list{box-sizing:border-box;width:100%;z-index:var(--more-visible, 2);display:flex;flex-direction:column;background-color:var(--ez-combo-box--background-color--xlight);padding:var(--ez-combo-box--space--small);border-radius:var(--ez-combo-box--border-radius);box-shadow:var(--shadow, 0px 0px 16px 0px #000);scroll-behavior:smooth;max-height:calc(4*var(--ez-combo-box__list-height) + 2*var(--ez-combo-box--space--small));overflow:auto}.item{text-align:left;display:flex;justify-content:space-between;align-items:center;border-radius:var(--ez-combo-box--border-radius-small);padding:0 var(--ez-combo-box--space--small);list-style-type:none;min-height:var(--ez-combo-box__list-height)}.item--label{text-align:left;flex-basis:85%;flex-grow:1;color:var(--ez-combo-box__list-text--primary);font-weight:var(--ez-combo-box--font-weight--large);font-family:var(--ez-combo-box--font-family);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.item--value{text-align:right;flex-basis:15%;flex-grow:0;color:var(--ez-combo-box__list-text--primary);font-weight:var(--ez-combo-box--font-weight--large);font-family:var(--ez-combo-box--font-family);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}li:hover{background-color:var(--ez-combo-box--background-medium)}.preselected{background-color:var(--background--medium)}.btn-open-options{outline:none;border:none;background-color:unset;cursor:pointer}.btn-open-options:disabled{cursor:unset}.btn-open-options::after{content:\'\';display:flex;background-color:var(--ez-combo-box__btn-options--background-color);width:16px;height:16px;-webkit-mask-image:var(--ez-combo-box__drop-down-image);mask-image:var(--ez-combo-box__drop-down-image)}.btn-open-options:disabled:after{background-color:var(--ez-combo-box__btn-options-disabled--background-color)}.btn-open-options:enabled:hover::after{background-color:var(--ez-combo-box__btn-options-hover--background-color)}.btn-open-search{outline:none;border:none;background-color:unset;cursor:pointer}.btn-open-search:disabled{cursor:unset}.btn-open-search::after{content:\'\';display:flex;background-color:var(--ez-combo-box__btn-search--background-color);width:22px;height:22px;-webkit-mask-image:var(--ez-combo-box__search-image);mask-image:var(--ez-combo-box__search-image)}.btn-open-search:disabled:after{background-color:var(--ez-combo-box__btn-search-disabled--background-color)}.btn-open-search:enabled:hover::after{background-color:var(--ez-combo-box__btn-search-hover--background-color)}';export{n as ez_combo_box}