@sankhyalabs/ezui 5.22.0-dev.72 → 5.22.0-dev.74
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{DataBinder-b4ef826a.js → DataBinder-e92314c2.js} +2 -2
- package/dist/cjs/ez-dropdown_2.cjs.entry.js +1 -1
- package/dist/cjs/ez-form.cjs.entry.js +1 -1
- package/dist/cjs/ez-grid.cjs.entry.js +67 -38
- package/dist/cjs/ez-icon.cjs.entry.js +1 -1
- package/dist/cjs/ez-search.cjs.entry.js +3 -2
- package/dist/cjs/ez-tree.cjs.entry.js +5 -4
- package/dist/cjs/ezui.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +13 -9
- package/dist/collection/components/ez-grid/controller/ag-grid/DataSource.js +44 -26
- package/dist/collection/components/ez-grid/ez-grid.js +70 -9
- package/dist/collection/components/ez-icon/ez-icon.css +70 -68
- package/dist/collection/components/ez-search/ez-search.js +22 -4
- package/dist/collection/components/ez-skeleton/ez-skeleton.css +54 -34
- package/dist/collection/components/ez-tree/ez-tree.js +21 -1
- package/dist/collection/components/ez-tree/subcomponents/TreeItem.js +3 -3
- package/dist/collection/utils/form/DataBinder.js +2 -2
- package/dist/custom-elements/index.js +80 -49
- package/dist/esm/{DataBinder-d2ecbb0f.js → DataBinder-9c877244.js} +2 -2
- package/dist/esm/ez-dropdown_2.entry.js +1 -1
- package/dist/esm/ez-form.entry.js +1 -1
- package/dist/esm/ez-grid.entry.js +67 -38
- package/dist/esm/ez-icon.entry.js +1 -1
- package/dist/esm/ez-search.entry.js +3 -2
- package/dist/esm/ez-tree.entry.js +5 -4
- package/dist/esm/ezui.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/ezui/ezui.esm.js +1 -1
- package/dist/ezui/p-2f45506d.entry.js +1 -0
- package/dist/ezui/p-35464ae8.entry.js +1 -0
- package/dist/ezui/{p-a62caecc.entry.js → p-3e7f12cc.entry.js} +2 -2
- package/dist/ezui/{p-d520839d.entry.js → p-3e8b13fb.entry.js} +1 -1
- package/dist/ezui/{p-7ed30844.entry.js → p-420f97ff.entry.js} +1 -1
- package/dist/ezui/{p-ceadecd9.js → p-acddfb2e.js} +1 -1
- package/dist/ezui/p-da1b4a38.entry.js +1 -0
- package/dist/types/components/ez-grid/controller/EzGridController.d.ts +12 -1
- package/dist/types/components/ez-grid/controller/ag-grid/DataSource.d.ts +2 -1
- package/dist/types/components/ez-grid/ez-grid.d.ts +18 -6
- package/dist/types/components/ez-search/ez-search.d.ts +5 -1
- package/dist/types/components/ez-tree/ez-tree.d.ts +4 -0
- package/dist/types/components/ez-tree/interfaces/ITreeItem.d.ts +1 -0
- package/dist/types/components/ez-tree/subcomponents/TreeItem.d.ts +1 -0
- package/dist/types/components.d.ts +44 -8
- package/package.json +1 -1
- package/dist/ezui/p-181b5ae8.entry.js +0 -1
- package/dist/ezui/p-8888d9ed.entry.js +0 -1
- package/dist/ezui/p-c4320a39.entry.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,c as e,h as i,f as n,H as r,g as s}from"./p-23a36bb6.js";import{DateUtils as o,Action as l,StringUtils as a,DataUnit as h,ElementIDUtils as u}from"@sankhyalabs/core";import{b as c,D as d}from"./p-
|
|
1
|
+
import{r as t,c as e,h as i,f as n,H as r,g as s}from"./p-23a36bb6.js";import{DateUtils as o,Action as l,StringUtils as a,DataUnit as h,ElementIDUtils as u}from"@sankhyalabs/core";import{b as c,D as d}from"./p-acddfb2e.js";import"./p-2187f86c.js";import"./p-ab574d59.js";const f=/child\[([^\]]+)\]/,p=/\$\{.+\}/;class v{constructor(){this._sheets=new Map,this._requiredFields=[],this._cleanOnCopyFields=[],this._defaultValues={}}static getDetailName(t){const e=f.exec(t);return e?e[1]:void 0}getSheet(t){return this._sheets.get(t)}getAllSheets(){return this._sheets}addSheet(t){this._sheets.set(t.name,t)}addRequiredFields(t){this._requiredFields=this._requiredFields.concat(t)}getRequiredFields(){return this._requiredFields}addCleanOnCopyFields(t){this._cleanOnCopyFields=this._cleanOnCopyFields.concat(t)}getCleanOnCopyFields(){return this._cleanOnCopyFields}addDefaultValues(t){return this._defaultValues=Object.assign(Object.assign({},this._defaultValues),t)}getDefaultValues(){const t={};return Object.entries(this._defaultValues).forEach((([e,i])=>{if("string"==typeof i){const t=p.exec(i);t&&(i=this.getDefaultVar(t[0]))}t[e]=i})),t}getDefaultVar(t){return"${data}"===t?o.getToday():"${datahora}"===t?o.getToday(!0):this._defaultVars?this._defaultVars.get(t):void 0}setDefaultVars(t){this._defaultVars=t}}const b=(t,e)=>"__main"==t[0].label?-1:(t[0].order||1e4)-(e[0].order||1e4);function m(t){return"Minified Redux error #"+t+"; visit https://redux.js.org/Errors?code="+t+" for the full message or use the non-minified dev environment for full errors. "}var y="function"==typeof Symbol&&Symbol.observable||"@@observable",w=function(){return Math.random().toString(36).substring(7).split("").join(".")},g={INIT:"@@redux/INIT"+w(),REPLACE:"@@redux/REPLACE"+w(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+w()}};function E(t){if("object"!=typeof t||null===t)return!1;for(var e=t;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e}function O(t,e,i){var n;if("function"==typeof e&&"function"==typeof i||"function"==typeof i&&"function"==typeof arguments[3])throw new Error(m(0));if("function"==typeof e&&void 0===i&&(i=e,e=void 0),void 0!==i){if("function"!=typeof i)throw new Error(m(1));return i(O)(t,e)}if("function"!=typeof t)throw new Error(m(2));var r=t,s=e,o=[],l=o,a=!1;function h(){l===o&&(l=o.slice())}function u(){if(a)throw new Error(m(3));return s}function c(t){if("function"!=typeof t)throw new Error(m(4));if(a)throw new Error(m(5));var e=!0;return h(),l.push(t),function(){if(e){if(a)throw new Error(m(6));e=!1,h();var i=l.indexOf(t);l.splice(i,1),o=null}}}function d(t){if(!E(t))throw new Error(m(7));if(void 0===t.type)throw new Error(m(8));if(a)throw new Error(m(9));try{a=!0,s=r(s,t)}finally{a=!1}for(var e=o=l,i=0;i<e.length;i++)(0,e[i])();return t}function f(t){if("function"!=typeof t)throw new Error(m(10));r=t,d({type:g.REPLACE})}function p(){var t,e=c;return(t={subscribe:function(t){if("object"!=typeof t||null===t)throw new Error(m(11));function i(){t.next&&t.next(u())}return i(),{unsubscribe:e(i)}}})[y]=function(){return this},t}return d({type:g.INIT}),(n={dispatch:d,subscribe:c,getState:u,replaceReducer:f})[y]=p,n}const C={};function j(t=C,e){switch(e.type){case F.METADATA_LOADED:return Object.assign(Object.assign({},t),{formMetadata:e.payload,currentSheet:void 0});case F.CHANGE_TAB:return Object.assign(Object.assign({},t),{currentSheet:e.payload});default:return t}}function _(t){return t.formMetadata}function A(t){const e=function(t){return t.currentSheet}(t);return e?t.formMetadata.getSheet(e):Array.from(t.formMetadata.getAllSheets().values())[0]}var F;!function(t){t.METADATA_LOADED="FORM/METADATA_LOADED",t.CHANGE_TAB="FORM/CHANGE_TAB"}(F||(F={}));const z=class{constructor(i){t(this,i),this.ezFormRequestClearFieldToFocus=e(this,"ezFormRequestClearFieldToFocus",7),this.ezFormSetFields=e(this,"ezFormSetFields",7),this.ezReady=e(this,"ezReady",7),this.formItemsReady=e(this,"formItemsReady",7),this._customEditors=new Map,this.onDataUnitAction=t=>{t.type===l.METADATA_LOADED&&this.processMetadata()},this._fieldsProps=new Map,this.dataUnit=void 0,this.config=void 0,this.recordsValidator=void 0,this.fieldToFocus=void 0,this.onlyStaticFields=!1}validate(){return this._dataBinder.validate()}async addCustomEditor(t,e,i){if(this._formView)return void this._formView.addCustomEditor(t,e,i);const n=new Map(this._customEditors);n.set(t,{customEditor:e,detailContext:i}),this._customEditors=n}observeConfig(){this.processMetadata()}async setFieldProp(t,e,i){const n=new Map(this._fieldsProps),r=this._fieldsProps.get(t);n.set(t,Object.assign(Object.assign({},r),{[e]:i})),this._fieldsProps=n}getDynamicContent(){var t;const e=_(this._store.getState());if(!e)return null;const n=Array.from(e.getAllSheets().values()),r=A(null===(t=this._store)||void 0===t?void 0:t.getState());let s=[];if(n.length>1){const t=n.map(((t,e)=>({tabKey:t.name,label:t.label,index:e}))),e="selector";s.push(i("ez-tabselector",{tabs:this.buildIdTabSelector(t),onEzChange:t=>this._store.dispatch(function(t){return{type:F.CHANGE_TAB,payload:"string"==typeof t?t:t.tabKey}}(t.detail)),selectedTab:r.name,"data-element-id":e}))}return s=s.concat(this.buildFormContent(r)),s}buildFormContent(t){const e=null==t?void 0:t.fields;if(null==t)return;this.ezFormSetFields.emit(e);const n=`${a.replaceAccentuatedChars(a.toCamelCase(null==t?void 0:t.label),!1)}_selectorContainer`;return i("div",{class:"dynamic-content","data-element-id":n},i("ez-form-view",{ref:t=>this._formView=t,class:"ez-row ez-padding-vertical--small",fields:e,selectedRecord:this.dataUnit.getSelectedRecord()}))}processMetadata(){if(this.bindFields()&&this.dataUnit&&this._store){const t=((t,e,i=!1)=>{var n,r;null!=t&&!0!==(null==t?void 0:t.emptyConfig)||(t=(t=>{const e=t.metadata;let i;return e&&(i=e.fields.filter((t=>!1!==t.visible)).map((t=>({name:t.name,defaultValue:t.defaultValue})))),{emptyConfig:!1,fields:i}})(e));const s=new Map,o=new Map,l=[],a=[],h={};null===(n=null==t?void 0:t.tabs)||void 0===n||n.forEach((t=>{o.has(t.label)||!1!==t.visible||o.set(t.label,t)})),null===(r=null==t?void 0:t.fields)||void 0===r||r.forEach((t=>{var i,n,r;if(!1!==t.visible){const u=((t,e)=>("string"==typeof t?Array.from(e.keys()).find((e=>e.label===t)):t)||{label:t,visible:!0})(t.tab||"__main",s);if(o.has(u.label))return;const d=e.getField(t.name);if(d&&(null==d.visible||!0===d.visible)&&u.visible){s.has(u)||s.set(u,[]);const e=c(d,t);s.get(u).push(e),e.required&&l.push(t.name),((null==t.cleanOnCopy?null===(i=d.properties)||void 0===i?void 0:i.cleanOnCopy:t.cleanOnCopy)||(null===(n=d.properties)||void 0===n?void 0:n.cleanOnCopy))&&a.push(t.name);let o=null==t.defaultValue?null===(r=d.properties)||void 0===r?void 0:r.defaultValue:t.defaultValue;if(o&&null!=o.value){const{type:e,value:i}=o;if(e)if("V"===e)o=i;else try{const t=JSON.parse(i);o=t&&"value"in t?t:i}catch(t){}h[t.name]=o}}}}));const u=new v;if(u.setDefaultVars(t.defaultVars),i){const t=e.metadata;null!=t&&null!=t.children&&t.children.forEach((t=>{const{label:e,name:i,fields:n}=(t=>({name:`child[${t.name}]`,label:t.label,fields:[]}))(t);s.set({name:i,label:e},n)}))}return Array.from(s.entries()).sort(b).forEach((([t,e])=>{u.addSheet({label:"__main"===t.label?"Principal":t.label,name:t.name||t.label,fields:e})})),u.addRequiredFields(l),u.addCleanOnCopyFields(a),u.addDefaultValues(h),u})(this.config,this.dataUnit);this._store.dispatch({type:F.METADATA_LOADED,payload:t})}}isStatic(){var t;return(null===(t=this._staticFields)||void 0===t?void 0:t.length)>0}bindFields(){return!this.isStatic()||!1===this.onlyStaticFields}componentWillLoad(){void 0===this.dataUnit&&(this.dataUnit=new h("ez-form")),this.dataUnit.unsubscribe(this.onDataUnitAction),this.dataUnit.subscribe(this.onDataUnitAction),this._dataBinder=new d(this.dataUnit),this._store=O(j),this._store.subscribe((()=>n(this))),this._staticFields=Array.from(this._element.querySelectorAll("[data-field-name]")),this.processMetadata(),u.addIDInfo(this._element,null,{dataUnit:this.dataUnit})}componentDidRender(){const t=_(this._store.getState());t.addRequiredFields(this._staticFields.filter((t=>t.dataset.required)).map((t=>t.dataset.fieldName))),this._dataBinder.bind(Array.from(this._element.querySelectorAll("[data-field-name]")),this.dataUnit.dataUnitId,t,this.recordsValidator),this.ezReady.emit(),this.handleFieldToFocus(),this.setCustomEditors(),this.setFieldsProps()}setCustomEditors(){if(this._formView)for(const[t,e]of this._customEditors)this._formView.addCustomEditor(t,e.customEditor,e.detailContext),this._customEditors.delete(t)}handleFieldToFocus(){var t;if(null==this.fieldToFocus)return;const e=A(null===(t=this._store)||void 0===t?void 0:t.getState());(null==e?void 0:e.fields).some((t=>t.name===this.fieldToFocus))&&requestAnimationFrame((()=>{this._dataBinder.setFocus(this.fieldToFocus),this.ezFormRequestClearFieldToFocus.emit()}))}setFieldsProps(){if(this._formView)for(const[t,e]of this._fieldsProps){for(const i in e)this._formView.setFieldProp(t,i,e[i]);this._fieldsProps.delete(t)}}disconnectedCallback(){this.dataUnit.unsubscribe(this.onDataUnitAction),this._dataBinder.onDisconnectedCallback()}buildIdTabSelector(t){return t&&t.forEach((t=>t[u.DATA_ELEMENT_ID_ATTRIBUTE_NAME]=a.toCamelCase(t.label))),t}render(){return i(r,null,this.isStatic()?null:this.getDynamicContent())}get _element(){return s(this)}static get watchers(){return{config:["observeConfig"]}}};z.style=".sc-ez-form-h{display:flex;flex-direction:column;width:100%}.dynamic-content.sc-ez-form ez-collapsible-box.sc-ez-form{--ez-collapsible-box__header--padding-right:var(--space-small, 6px);--ez-collapsible-box__header--padding-left:var(--space-small, 6px)}";export{z as ez_form}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e,h as o,H as n,g as t}from"./p-23a36bb6.js";import{StringUtils as c,ElementIDUtils as i}from"@sankhyalabs/core";const
|
|
1
|
+
import{r as e,h as o,H as n,g as t}from"./p-23a36bb6.js";import{StringUtils as c,ElementIDUtils as i}from"@sankhyalabs/core";const a=class{constructor(o){e(this,o),this.size="medium",this.href=void 0,this.iconName=void 0}isSprite(){return this.href&&this.href.indexOf("#")>-1}getIconClassName(){return`ez-icon-${this.iconName}`}getIconContent(){return this.isSprite()?o("svg",{class:this.size,role:"img"},o("use",{xlinkHref:this.href})):c.isEmpty(this.iconName)?o("img",{class:this.size,src:this.href}):o("span",{class:`icon-content ${this.getIconClassName()} ${this.size}--font`})}componentDidLoad(){i.addIDInfo(this._hostElement,"icon")}render(){return o(n,null,this.getIconContent())}get _hostElement(){return t(this)}};a.style=':host{display:flex;overflow:hidden;position:relative;--ez-icon--color:var(--icon--color, #ffffff)}svg{display:flex;justify-content:center;align-items:center;fill:var(--ez-icon--color)}.x-small{width:12px;height:12px}.small{width:16px;height:16px}.medium{width:20px;height:20px}.large{width:24px;height:24px}.x-large{width:30px;height:30px}[class^="ez-icon-"],[class*=" ez-icon-"]{color:var(--ez-icon--color)}[class^="ez-icon-"],[class*=" ez-icon-"]{font-family:\'ez-icons\' !important;font-size:16px;font-style:normal;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.ez-icon-2chevron-down:before{content:"\\ea01"}.ez-icon-2chevron-up:before{content:"\\ea02"}.ez-icon-acao:before{content:"\\ea03"}.ez-icon-account-outline:before{content:"\\ea04"}.ez-icon-account:before{content:"\\ea05"}.ez-icon-add-to-cart:before{content:"\\ea06"}.ez-icon-alert-circle-inverted:before{content:"\\ea07"}.ez-icon-alert-circle:before{content:"\\ea08"}.ez-icon-alert-mail:before{content:"\\ea09"}.ez-icon-alert-popup:before{content:"\\ea0a"}.ez-icon-anexo:before{content:"\\ea0b"}.ez-icon-antecipação:before{content:"\\ea0c"}.ez-icon-apps:before{content:"\\ea0d"}.ez-icon-arrow-forward:before{content:"\\ea0e"}.ez-icon-arrow-upward:before{content:"\\ea0f"}.ez-icon-arrow_back:before{content:"\\ea10"}.ez-icon-arrow_downward:before{content:"\\ea11"}.ez-icon-baixa:before{content:"\\ea12"}.ez-icon-balance:before{content:"\\ea13"}.ez-icon-bell-inverted:before{content:"\\ea14"}.ez-icon-bell:before{content:"\\ea15"}.ez-icon-boleto:before{content:"\\ea16"}.ez-icon-boolean:before{content:"\\ea17"}.ez-icon-business-center:before{content:"\\ea18"}.ez-icon-calendar-clock:before{content:"\\ea19"}.ez-icon-calendar:before{content:"\\ea1a"}.ez-icon-cart-history:before{content:"\\ea1b"}.ez-icon-cash-remove:before{content:"\\ea1c"}.ez-icon-check-circle-inverted:before{content:"\\ea1d"}.ez-icon-check-circle:before{content:"\\ea1e"}.ez-icon-check:before{content:"\\ea1f"}.ez-icon-chevron-down:before{content:"\\ea20"}.ez-icon-chevron-left:before{content:"\\ea21"}.ez-icon-chevron-right:before{content:"\\ea22"}.ez-icon-chevron-up:before{content:"\\ea23"}.ez-icon-circle--medium:before{content:"\\ea24"}.ez-icon-circle:before{content:"\\ea25"}.ez-icon-clean-cart:before{content:"\\ea26"}.ez-icon-cleaning:before{content:"\\ea27"}.ez-icon-clipboard:before{content:"\\ea28"}.ez-icon-clock-rotate-left:before{content:"\\ea29"}.ez-icon-close:before{content:"\\ea2a"}.ez-icon-cobrar:before{content:"\\ea2b"}.ez-icon-code:before{content:"\\ea2c"}.ez-icon-configuration:before{content:"\\ea2d"}.ez-icon-content-cut:before{content:"\\ea2e"}.ez-icon-copy:before{content:"\\ea2f"}.ez-icon-credit_card:before{content:"\\ea30"}.ez-icon-crop:before{content:"\\ea31"}.ez-icon-custom:before{content:"\\ea32"}.ez-icon-delete-file:before{content:"\\ea33"}.ez-icon-delete:before{content:"\\ea34"}.ez-icon-description:before{content:"\\ea35"}.ez-icon-dividir:before{content:"\\ea36"}.ez-icon-docx:before{content:"\\ea37"}.ez-icon-dot-notification:before{content:"\\ea38"}.ez-icon-dots-horizontal:before{content:"\\ea39"}.ez-icon-dots-vertical:before{content:"\\ea3a"}.ez-icon-drag-indicator:before{content:"\\ea3b"}.ez-icon-dual-chevron-down:before{content:"\\ea3c"}.ez-icon-dual-chevron-left:before{content:"\\ea3d"}.ez-icon-dual-chevron-right:before{content:"\\ea3e"}.ez-icon-dual-chevron-up:before{content:"\\ea3f"}.ez-icon-edit-file:before{content:"\\ea40"}.ez-icon-edit-table:before{content:"\\ea41"}.ez-icon-edit-time:before{content:"\\ea42"}.ez-icon-edit-value:before{content:"\\ea43"}.ez-icon-edit:before{content:"\\ea44"}.ez-icon-email:before{content:"\\ea45"}.ez-icon-estorno:before{content:"\\ea46"}.ez-icon-exe:before{content:"\\ea47"}.ez-icon-expand:before{content:"\\ea48"}.ez-icon-expandir_card:before{content:"\\ea49"}.ez-icon-extrato:before{content:"\\ea4a"}.ez-icon-eye-off:before{content:"\\ea4b"}.ez-icon-eye:before{content:"\\ea4c"}.ez-icon-favorite:before{content:"\\ea4d"}.ez-icon-figma:before{content:"\\ea4e"}.ez-icon-file-download:before{content:"\\ea4f"}.ez-icon-file-upload:before{content:"\\ea50"}.ez-icon-filter:before{content:"\\ea51"}.ez-icon-find-file:before{content:"\\ea52"}.ez-icon-find-page:before{content:"\\ea53"}.ez-icon-format-color-fill:before{content:"\\ea54"}.ez-icon-generic:before{content:"\\ea55"}.ez-icon-gif:before{content:"\\ea56"}.ez-icon-graph_bar:before{content:"\\ea57"}.ez-icon-handshake:before{content:"\\ea58"}.ez-icon-help-inverted:before{content:"\\ea59"}.ez-icon-help:before{content:"\\ea5a"}.ez-icon-hide-list:before{content:"\\ea5b"}.ez-icon-hide_menu:before{content:"\\ea5c"}.ez-icon-home:before{content:"\\ea5d"}.ez-icon-icons104:before{content:"\\ea5e"}.ez-icon-language:before{content:"\\ea5f"}.ez-icon-launch:before{content:"\\ea60"}.ez-icon-lightbulb:before{content:"\\ea61"}.ez-icon-list:before{content:"\\ea62"}.ez-icon-location:before{content:"\\ea63"}.ez-icon-lock-outline:before{content:"\\ea64"}.ez-icon-lock:before{content:"\\ea65"}.ez-icon-menu:before{content:"\\ea66"}.ez-icon-mid:before{content:"\\ea67"}.ez-icon-minus:before{content:"\\ea68"}.ez-icon-money-off:before{content:"\\ea69"}.ez-icon-money:before{content:"\\ea6a"}.ez-icon-more:before{content:"\\ea6b"}.ez-icon-mp3:before{content:"\\ea6c"}.ez-icon-mp4:before{content:"\\ea6d"}.ez-icon-multiple-files:before{content:"\\ea6e"}.ez-icon-north-west:before{content:"\\ea6f"}.ez-icon-number:before{content:"\\ea70"}.ez-icon-ordem-ascendente:before{content:"\\ea71"}.ez-icon-ordem-descendente:before{content:"\\ea72"}.ez-icon-parcelar:before{content:"\\ea73"}.ez-icon-pause:before{content:"\\ea74"}.ez-icon-payments:before{content:"\\ea75"}.ez-icon-pdf:before{content:"\\ea76"}.ez-icon-play:before{content:"\\ea77"}.ez-icon-plus:before{content:"\\ea78"}.ez-icon-png:before{content:"\\ea79"}.ez-icon-power:before{content:"\\ea7a"}.ez-icon-pptx:before{content:"\\ea7b"}.ez-icon-preview:before{content:"\\ea7c"}.ez-icon-print:before{content:"\\ea7d"}.ez-icon-push-pin:before{content:"\\ea7e"}.ez-icon-rateio:before{content:"\\ea7f"}.ez-icon-receipt:before{content:"\\ea80"}.ez-icon-recolher_card:before{content:"\\ea81"}.ez-icon-remove-from-cart:before{content:"\\ea82"}.ez-icon-restore:before{content:"\\ea83"}.ez-icon-return:before{content:"\\ea84"}.ez-icon-sankhya-place:before{content:"\\ea85"}.ez-icon-save:before{content:"\\ea86"}.ez-icon-search:before{content:"\\ea87"}.ez-icon-settings-inverted:before{content:"\\ea88"}.ez-icon-settings:before{content:"\\ea89"}.ez-icon-share:before{content:"\\ea8a"}.ez-icon-shield:before{content:"\\ea8b"}.ez-icon-show-list:before{content:"\\ea8c"}.ez-icon-show_menu:before{content:"\\ea8d"}.ez-icon-south-east:before{content:"\\ea8e"}.ez-icon-sync:before{content:"\\ea8f"}.ez-icon-table:before{content:"\\ea90"}.ez-icon-tag_code:before{content:"\\ea91"}.ez-icon-text:before{content:"\\ea92"}.ez-icon-timeline:before{content:"\\ea93"}.ez-icon-timer-outline:before{content:"\\ea94"}.ez-icon-trending-up:before{content:"\\ea95"}.ez-icon-tune:before{content:"\\ea96"}.ez-icon-txt:before{content:"\\ea97"}.ez-icon-un-pin:before{content:"\\ea98"}.ez-icon-unfold_less:before{content:"\\ea99"}.ez-icon-unfold_more:before{content:"\\ea9a"}.ez-icon-user-circle:before{content:"\\ea9b"}.ez-icon-warning-outline:before{content:"\\ea9c"}.ez-icon-warning_triangle:before{content:"\\ea9d"}.ez-icon-whatshot:before{content:"\\ea9e"}.ez-icon-xlsx:before{content:"\\ea9f"}.ez-icon-zip:before{content:"\\eaa0"}.x-small--font{font-size:12px}.small--font{font-size:16px}.medium--font{font-size:20px}.large--font{font-size:24px}.x-large--font{font-size:30px}';export{a as ez_icon}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{UserInterface as t,Action as s,StringUtils as i,ApplicationContext as e,WaitingChangeException as n,DataUnitAction as h}from"@sankhyalabs/core";import{A as a}from"./p-2187f86c.js";const r=(s,i)=>{let e,n,{name:h,label:a,group:r}=Object.assign({},i),{readOnly:o,required:c}=Object.assign({},i);return s&&(a=a||s.label,h=h||s.name,c=s.required||(null==i?void 0:i.required),o=s.readOnly||(null==i?void 0:i.readOnly),e=s.properties,n=s.userInterface),{name:h,label:a,group:r,readOnly:o,required:c,props:e,userInterface:n||t.SHORTTEXT}};class o{constructor(t,s,i){this._dataUnit=t,this._validationSource=s,this._validator=i}validate(t=!0){return new Promise(((s,i)=>{const e=this._dataUnit.getModifiedRecords();for(let s=0;s<e.length;s++){const n=e[s],h=[];let a=this.validateRequired(n);if(a&&!a.isValid&&h.push(a),this._validator&&(a=this._validator.validateRecord(n),a&&!a.isValid&&h.push(a)),h.length>0){if(!t&&h[0].invalidFields.length>0){this._validationSource.markAsInvalid(h[0].invalidFields[0],n.__record__id__),i();break}this.processValidationResult(h,n.__record__id__),i();break}}return s()}))}validateRequired(t){const s=this._validationSource.getRequiredFields(),i=[];if(new Set(s).forEach((s=>{const e=t[s];if(null==e||""===e){const e=this._validationSource.getMessageForField(s,t.__record__id__);i.push(e?{name:s,message:e}:{name:s,message:"Essa informação é obrigatória"})}})),i.length>0)return{isValid:!1,invalidFields:i,infoMessage:"Há pelo menos um campo obrigatório não preenchido."}}processValidationResult(t,s){t.forEach((t=>{const i=t.invalidFields;if(this._dataUnit.savingCanceled(i,s),i&&i.forEach((t=>{this.markAsInvalid(t,s)})),t.infoMessage&&a.info(t.infoMessage),t.errorMessage){const{errorTitle:s,errorMessage:i}=t;a.error(s,i)}}))}markAsInvalid(t,s){this._dataUnit.setInvalidField(t.name,t.message,s),this._validationSource.markAsInvalid(t,s)}}class c{constructor(t){this.onDataUnitEvent=t=>{var i,e;switch(t.type){case s.DATA_LOADED:case s.DATA_SAVED:case s.RECORDS_REMOVED:case s.RECORDS_ADDED:case s.RECORDS_COPIED:case s.EDITION_CANCELED:case s.SELECTION_CHANGED:case s.NEXT_SELECTED:case s.PREVIOUS_SELECTED:this.clearInvalid();case s.DATA_CHANGED:case s.CHANGE_UNDONE:case s.CHANGE_REDONE:case s.RECORD_LOADED:null===(i=this._fields)||void 0===i||i.forEach((t=>{this.updateValue(t.fieldName,t.field)})),this.clearFieldError(Object.keys(t.payload)[0]);break;case s.FIELD_INVALIDATED:null===(e=this._fields)||void 0===e||e.forEach((t=>{this.updateErrorMessage(t.fieldName,t.field)}))}},this._uuid=i.generateUUID(),this._fields=new Map,this._dataUnit=t,this.applyDefaultValues(),this._dataUnit.subscribe(this.onDataUnitEvent),this._dataUnit.addInterceptor(this),this.setContextDataBinder(t)}get dataBinderId(){return this._uuid}setContextDataBinder(t){const s=e.getContextValue("__DATABINDER_BY_DATAUNIT__")||new Map,i=[...s.get(t.dataUnitId)||[],this];s.set(t.dataUnitId,i),e.setContextValue("__DATABINDER_BY_DATAUNIT__",s)}applyDefaultValues(){const t=(this._dataUnit.getAddedRecords()||[]).map((t=>t.__record__id__));if(t.length>0){const s=this.getDefaultValues();s&&Object.keys(s).forEach((i=>{this._dataUnit.setFieldValue(i,s[i],t)}))}}bind(t,s,i,e){t.forEach((t=>{const{fieldName:i,contextName:e}=t.dataset;null!=e&&e!==s||this.updateBind(i,t)})),this._formMetadata=i,this._recordValidatorProcessor=new o(this._dataUnit,{getRequiredFields:()=>this.getFormRequiredFields(),markAsInvalid:t=>this.markInvalid(t),getMessageForField:t=>this.getErrorMessage(t)},e)}getFormRequiredFields(){return this._formMetadata.getRequiredFields()}disconnectDataUnit(){const t=e.getContextValue("__DATABINDER_BY_DATAUNIT__")||new Map,s=t.get(this._dataUnit.dataUnitId).filter((t=>t.dataBinderId!==this.dataBinderId));t.set(this._dataUnit.dataUnitId,s),e.setContextValue("__DATABINDER_BY_DATAUNIT__",t)}onDisconnectedCallback(){this._dataUnit.unsubscribe(this.onDataUnitEvent),this._dataUnit.removeInterceptor(this),this.disconnectDataUnit()}getCurrentRecordId(){const t=this._dataUnit.getSelectedRecord();return null==t?void 0:t.__record__id__}markInvalid(t){if(this._fields.has(t.name)){const s=this._fields.get(t.name).field;this.updateErrorMessage(t.name,s,t.message)}}setFocus(t){if(!this._fields.has(t))return;const s=this._fields.get(t).field;"function"==typeof s.setFocus&&s.setFocus()}clearInvalid(t){this._dataUnit.clearInvalid(t),this._fields.forEach((t=>{t.field.errorMessage=""}))}clearFieldError(t){var s;const i=null===(s=this._fields.get(t))||void 0===s?void 0:s.field;i.errorMessage&&(i.errorMessage="",this._dataUnit.clearInvalid(this.getCurrentRecordId(),t))}updateValue(t,s){const i=this._fields.get(t);try{i&&(i.listen=!1),s.value=this._dataUnit.getFieldValue(t),this.updateErrorMessage(t,s)}finally{i&&(i.listen=!0)}}validate(){return this._recordValidatorProcessor.validate()}static async validateByDataunit(t){try{const s=this.getDataBindersByDataUnit(t);return await Promise.all(s.map((t=>t.validate()))),!0}catch(t){return!1}}static getDataBindersByDataUnit(t){const s=e.getContextValue("__DATABINDER_BY_DATAUNIT__");return(null==s?void 0:s.get(t.dataUnitId))||[]}updateErrorMessage(t,s,i){null==i&&(i=this._dataUnit.getInvalidMessage(this.getCurrentRecordId(),t)),s.errorMessage||(s.errorMessage=i)}getErrorMessage(t){if(this._fields.has(t))return this._fields.get(t).field.errorMessage}updateBind(t,s){const i=this._fields.get(t);i&&i.destroy(),this.bindSearchOptionsLoader(t,s),s.value=this._dataUnit.getFieldValue(t),this.updateErrorMessage(t,s),this._fields.set(t,l.create(t,s,((t,s)=>this.changeStarted(t,s)),(t=>this.cancelWaitingChange(t)),((t,s)=>this.setFieldValue(t,s)))),this.applyEzUploadContext(t,s)}changeStarted(t,s){if(0===this._dataUnit.records.length&&this._dataUnit.addRecord(),!s.blocking&&null==s.promise){const i=this._fields.get(t);i&&(s.promise=new Promise(((t,s)=>{i.waitingChangePromiseResolve=t,i.waitingChangePromiseReject=s})))}this._dataUnit.startChange(t,s)}cancelWaitingChange(t){if(this._dataUnit.waitingForChange(t)){this._dataUnit.cancelWaitingChange(t);const s=this._fields.get(t);s&&s.rejectWaitingChange(new n("Change canceled",t))}}setFieldValue(t,s){0===this._dataUnit.records.length&&this._dataUnit.addRecord(),this._dataUnit.clearInvalid(this.getCurrentRecordId(),t);const i=this._dataUnit.getSelectedRecord();if(this._dataUnit.setFieldValue(t,s,i?[i.__record__id__]:void 0),this._dataUnit.waitingForChange(t)){const s=this._fields.get(t);s&&s.acceptWaitingChange()}}bindSearchOptionsLoader(t,s){if("EZ-SEARCH"===s.nodeName&&null==s.optionLoader){const i=e.getContextValue("__EZUI__SEARCH__OPTION__LOADER__");i&&(s.optionLoader=s=>i(s,t,this._dataUnit))}}applyEzUploadContext(t,s){var i,n;if("EZ-UPLOAD"===s.nodeName){s.urlUpload=e.getContextValue("__EZUI__UPLOAD__ADD__URL__"),s.urlDelete=e.getContextValue("__EZUI__UPLOAD__DEL__URL__");const h=this._dataUnit.getField(t),a=null===(i=h.properties)||void 0===i?void 0:i.DESTINATION;a&&(s.requestHeaders={XTRAINF:`{"destination": "${a}"}`}),s.maxFiles=(null===(n=h.properties)||void 0===n?void 0:n.MAX_FILES)||0}}interceptAction(t){if(t.type===s.RECORDS_COPIED){const i=this._formMetadata.getCleanOnCopyFields();if(i)return new h(s.RECORDS_COPIED,t.payload.map((t=>{const s=Object.assign({},t);return i.forEach((t=>delete s[t])),s})))}if(t.type===s.SAVING_DATA)return new Promise((s=>{this.validate().then((()=>s(t))).catch((()=>{}))}));if(t.type===s.RECORDS_ADDED){const i=this.getDefaultValues();if(i)return new h(s.RECORDS_ADDED,t.payload.map((t=>Object.assign(Object.assign({},t),i))))}return t}getDefaultValues(){var t;const s=null===(t=this._formMetadata)||void 0===t?void 0:t.getDefaultValues();if(s){const t={};for(const i in s)t[i]=this._dataUnit.valueFromString(i,s[i]);return t}}}class l{constructor(){this.listen=!0,this.startChangeEventName="ezStartChange",this.cancelWaitingChangeEventName="ezCancelWaitingChange",this.changeEventName="ezChange"}destroy(){this.field.removeEventListener(this.startChangeEventName,this.startChangeListener),this.field.removeEventListener(this.cancelWaitingChangeEventName,this.cancelWaitingChangeListener),this.field.removeEventListener(this.changeEventName,this.changeListener)}acceptWaitingChange(){this.waitingChangePromiseResolve&&(this.waitingChangePromiseResolve(),this.waitingChangePromiseReject=void 0,this.waitingChangePromiseResolve=void 0)}rejectWaitingChange(t){this.waitingChangePromiseReject&&(this.waitingChangePromiseReject(t),this.waitingChangePromiseReject=void 0,this.waitingChangePromiseResolve=void 0)}static create(t,s,i,e,n){const h=new l;return h.field=s,h.fieldName=t,h.startChangeListener=s=>{h.listen&&i(t,s.detail)},h.field.addEventListener(h.startChangeEventName,h.startChangeListener),h.cancelWaitingChangeListener=()=>{h.listen&&e(t)},h.field.addEventListener(h.cancelWaitingChangeEventName,h.cancelWaitingChangeListener),h.changeListener=s=>{h.listen&&n(t,s.detail)},h.field.addEventListener(h.changeEventName,h.changeListener),h}}export{c as D,o as R,r as b}
|
|
1
|
+
import{UserInterface as t,Action as s,StringUtils as i,ApplicationContext as e,WaitingChangeException as n,DataUnitAction as h}from"@sankhyalabs/core";import{A as a}from"./p-2187f86c.js";const r=(s,i)=>{let e,n,{name:h,label:a,group:r}=Object.assign({},i),{readOnly:o,required:c}=Object.assign({},i);return s&&(a=a||s.label,h=h||s.name,c=s.required||(null==i?void 0:i.required),o=s.readOnly||(null==i?void 0:i.readOnly),e=s.properties,n=s.userInterface),{name:h,label:a,group:r,readOnly:o,required:c,props:e,userInterface:n||t.SHORTTEXT}};class o{constructor(t,s,i){this._dataUnit=t,this._validationSource=s,this._validator=i}validate(t=!0){return new Promise(((s,i)=>{const e=this._dataUnit.getModifiedRecords();for(let s=0;s<e.length;s++){const n=e[s],h=[];let a=this.validateRequired(n);if(a&&!a.isValid&&h.push(a),this._validator&&(a=this._validator.validateRecord(n),a&&!a.isValid&&h.push(a)),h.length>0){if(!t&&h[0].invalidFields.length>0){this._validationSource.markAsInvalid(h[0].invalidFields[0],n.__record__id__),i();break}this.processValidationResult(h,n.__record__id__),i();break}}return s()}))}validateRequired(t){const s=this._validationSource.getRequiredFields(),i=[];if(new Set(s).forEach((s=>{const e=t[s];if(null==e||""===e){const e=this._validationSource.getMessageForField(s,t.__record__id__);i.push(e?{name:s,message:e}:{name:s,message:"Essa informação é obrigatória"})}})),i.length>0)return{isValid:!1,invalidFields:i,infoMessage:"Há pelo menos um campo obrigatório não preenchido."}}processValidationResult(t,s){t.forEach((t=>{const i=t.invalidFields;if(this._dataUnit.savingCanceled(i,s),i&&i.forEach((t=>{this.markAsInvalid(t,s)})),t.infoMessage&&a.info(t.infoMessage),t.errorMessage){const{errorTitle:s,errorMessage:i}=t;a.error(s,i)}}))}markAsInvalid(t,s){this._dataUnit.setInvalidField(t.name,t.message,s),this._validationSource.markAsInvalid(t,s)}}class c{constructor(t){this.onDataUnitEvent=t=>{var i,e;switch(t.type){case s.DATA_LOADED:case s.DATA_SAVED:case s.RECORDS_REMOVED:case s.RECORDS_ADDED:case s.RECORDS_COPIED:case s.EDITION_CANCELED:case s.SELECTION_CHANGED:case s.NEXT_SELECTED:case s.PREVIOUS_SELECTED:this.clearInvalid();case s.DATA_CHANGED:case s.CHANGE_UNDONE:case s.CHANGE_REDONE:case s.RECORD_LOADED:null===(i=this._fields)||void 0===i||i.forEach((t=>{this.updateValue(t.fieldName,t.field)})),this.clearFieldError(Object.keys(t.payload)[0]);break;case s.FIELD_INVALIDATED:null===(e=this._fields)||void 0===e||e.forEach((t=>{this.updateErrorMessage(t.fieldName,t.field)}))}},this._uuid=i.generateUUID(),this._fields=new Map,this._dataUnit=t,this.applyDefaultValues(),this._dataUnit.subscribe(this.onDataUnitEvent),this._dataUnit.addInterceptor(this),this.setContextDataBinder(t)}get dataBinderId(){return this._uuid}setContextDataBinder(t){const s=e.getContextValue("__DATABINDER_BY_DATAUNIT__")||new Map,i=[...s.get(t.dataUnitId)||[],this];s.set(t.dataUnitId,i),e.setContextValue("__DATABINDER_BY_DATAUNIT__",s)}applyDefaultValues(){const t=(this._dataUnit.getAddedRecords()||[]).map((t=>t.__record__id__));if(t.length>0){const s=this.getDefaultValues();s&&Object.keys(s).forEach((i=>{this._dataUnit.setFieldValue(i,s[i],t)}))}}bind(t,s,i,e){t.forEach((t=>{const{fieldName:i,contextName:e}=t.dataset;null!=e&&e!==s||this.updateBind(i,t)})),this._formMetadata=i,this._recordValidatorProcessor=new o(this._dataUnit,{getRequiredFields:()=>this.getFormRequiredFields(),markAsInvalid:t=>this.markInvalid(t),getMessageForField:t=>this.getErrorMessage(t)},e)}getFormRequiredFields(){return this._formMetadata.getRequiredFields()}disconnectDataUnit(){const t=e.getContextValue("__DATABINDER_BY_DATAUNIT__")||new Map,s=t.get(this._dataUnit.dataUnitId).filter((t=>t.dataBinderId!==this.dataBinderId));t.set(this._dataUnit.dataUnitId,s),e.setContextValue("__DATABINDER_BY_DATAUNIT__",t)}onDisconnectedCallback(){this._dataUnit.unsubscribe(this.onDataUnitEvent),this._dataUnit.removeInterceptor(this),this.disconnectDataUnit()}getCurrentRecordId(){const t=this._dataUnit.getSelectedRecord();return null==t?void 0:t.__record__id__}markInvalid(t){if(this._fields.has(t.name)){const s=this._fields.get(t.name).field;this.updateErrorMessage(t.name,s,t.message)}}setFocus(t){if(!this._fields.has(t))return;const s=this._fields.get(t).field;"function"==typeof s.setFocus&&s.setFocus()}clearInvalid(t){this._dataUnit.clearInvalid(t),this._fields.forEach((t=>{t.field.errorMessage=""}))}clearFieldError(t){var s;const i=null===(s=this._fields.get(t))||void 0===s?void 0:s.field;i.errorMessage&&(i.errorMessage="",this._dataUnit.clearInvalid(this.getCurrentRecordId(),t))}updateValue(t,s){const i=this._fields.get(t);try{i&&(i.listen=!1),s.value=this._dataUnit.getFieldValue(t),this.updateErrorMessage(t,s)}finally{i&&(i.listen=!0)}}validate(){return this._recordValidatorProcessor.validate()}static async validateByDataunit(t){try{const s=this.getDataBindersByDataUnit(t);return await Promise.all(s.map((t=>t.validate()))),!0}catch(t){return!1}}static getDataBindersByDataUnit(t){const s=e.getContextValue("__DATABINDER_BY_DATAUNIT__");return(null==s?void 0:s.get(t.dataUnitId))||[]}updateErrorMessage(t,s,i){null==i&&(i=this._dataUnit.getInvalidMessage(this.getCurrentRecordId(),t)),s.errorMessage||(s.errorMessage=i)}getErrorMessage(t){if(this._fields.has(t))return this._fields.get(t).field.errorMessage}updateBind(t,s){const i=this._fields.get(t);i&&i.destroy(),this.bindSearchOptionsLoader(t,s),s.value=this._dataUnit.getFieldValue(t),this.updateErrorMessage(t,s),this._fields.set(t,l.create(t,s,((t,s)=>this.changeStarted(t,s)),(t=>this.cancelWaitingChange(t)),((t,s)=>this.setFieldValue(t,s)))),this.applyEzUploadContext(t,s)}changeStarted(t,s){if(0===this._dataUnit.records.length&&this._dataUnit.addRecord(),!s.blocking&&null==s.promise){const i=this._fields.get(t);i&&(s.promise=new Promise(((t,s)=>{i.waitingChangePromiseResolve=t,i.waitingChangePromiseReject=s})))}this._dataUnit.startChange(t,s)}cancelWaitingChange(t){if(this._dataUnit.waitingForChange(t)){this._dataUnit.cancelWaitingChange(t);const s=this._fields.get(t);s&&s.rejectWaitingChange(new n("Change canceled",t))}}setFieldValue(t,s){0===this._dataUnit.records.length&&this._dataUnit.addRecord(),this._dataUnit.clearInvalid(this.getCurrentRecordId(),t);const i=this._dataUnit.getSelectedRecord();if(this._dataUnit.setFieldValue(t,s,i?[i.__record__id__]:void 0),this._dataUnit.waitingForChange(t)){const s=this._fields.get(t);s&&s.acceptWaitingChange()}}bindSearchOptionsLoader(t,s){if("EZ-SEARCH"===s.nodeName&&null==s.optionLoader){const i=e.getContextValue("__EZUI__SEARCH__OPTION__LOADER__");i&&(s.optionLoader=(s,e)=>i(s,t,this._dataUnit,e))}}applyEzUploadContext(t,s){var i,n;if("EZ-UPLOAD"===s.nodeName){s.urlUpload=e.getContextValue("__EZUI__UPLOAD__ADD__URL__"),s.urlDelete=e.getContextValue("__EZUI__UPLOAD__DEL__URL__");const h=this._dataUnit.getField(t),a=null===(i=h.properties)||void 0===i?void 0:i.DESTINATION;a&&(s.requestHeaders={XTRAINF:`{"destination": "${a}"}`}),s.maxFiles=(null===(n=h.properties)||void 0===n?void 0:n.MAX_FILES)||0}}interceptAction(t){if(t.type===s.RECORDS_COPIED){const i=this._formMetadata.getCleanOnCopyFields();if(i)return new h(s.RECORDS_COPIED,t.payload.map((t=>{const s=Object.assign({},t);return i.forEach((t=>delete s[t])),s})))}if(t.type===s.SAVING_DATA)return new Promise((s=>{this.validate().then((()=>s(t))).catch((()=>{}))}));if(t.type===s.RECORDS_ADDED){const i=this.getDefaultValues();if(i)return new h(s.RECORDS_ADDED,t.payload.map((t=>Object.assign(Object.assign({},t),i))))}return t}getDefaultValues(){var t;const s=null===(t=this._formMetadata)||void 0===t?void 0:t.getDefaultValues();if(s){const t={};for(const i in s)t[i]=this._dataUnit.valueFromString(i,s[i]);return t}}}class l{constructor(){this.listen=!0,this.startChangeEventName="ezStartChange",this.cancelWaitingChangeEventName="ezCancelWaitingChange",this.changeEventName="ezChange"}destroy(){this.field.removeEventListener(this.startChangeEventName,this.startChangeListener),this.field.removeEventListener(this.cancelWaitingChangeEventName,this.cancelWaitingChangeListener),this.field.removeEventListener(this.changeEventName,this.changeListener)}acceptWaitingChange(){this.waitingChangePromiseResolve&&(this.waitingChangePromiseResolve(),this.waitingChangePromiseReject=void 0,this.waitingChangePromiseResolve=void 0)}rejectWaitingChange(t){this.waitingChangePromiseReject&&(this.waitingChangePromiseReject(t),this.waitingChangePromiseReject=void 0,this.waitingChangePromiseResolve=void 0)}static create(t,s,i,e,n){const h=new l;return h.field=s,h.fieldName=t,h.startChangeListener=s=>{h.listen&&i(t,s.detail)},h.field.addEventListener(h.startChangeEventName,h.startChangeListener),h.cancelWaitingChangeListener=()=>{h.listen&&e(t)},h.field.addEventListener(h.cancelWaitingChangeEventName,h.cancelWaitingChangeListener),h.changeListener=s=>{h.listen&&n(t,s.detail)},h.field.addEventListener(h.changeEventName,h.changeListener),h}}export{c as D,o as R,r as b}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{h as e,r as t,c as i,f as r,H as s,g as o}from"./p-23a36bb6.js";import{ElementIDUtils as a,StringUtils as n,ObjectUtils as l}from"@sankhyalabs/core";const h=(e,t)=>t?e.iconExpanded||"chevron-down":e.iconContracted||"chevron-right",c=e=>e.tooltip||e.label,d=t=>{const{node:i,selectedId:r,itemClick:s,iconClick:o,iconResolver:n,tooltipResolver:l,itemsList:h,itemDoubleClick:c}=t;if(!i.visible)return;const m=i.item,v=t.level||1,u=i.isDisabled(),b=!u&&m.expanded,g=i.isExpandable(),z=!u&&!i.isPlaceHolder;return z&&h.push(m),e("ul",{class:1===v?"first-level":void 0},e("li",Object.assign({title:l(m,!u,v),class:"tree-item "+(m.id!==r?"tree-item-error":""),onClick:()=>z&&s(m),onDblClick:()=>z&&c(m)},{disabled:u,selected:m.id===r,[a.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:a.getInternalIDInfo(`ezTreeItem_${m.id}`)}),e("div",{class:"item-label-container"},e("div",{class:"item-icon-box"},g&&e("ez-icon",{id:m.id,class:"item-icon",size:"small",iconName:n(m,b,v),onClick:()=>z&&o(m)})),e("label",{class:"item-label "+(m.bold?"item-label--bold":"")},m.label)),function(t,i,r){if(null!=i)return"string"==typeof i?e("div",{class:`tree-item-badge ${r?null:i}`},"error"===i&&e("ez-icon",{id:`${t}-badge-error`,class:"tree-item-badge-error-icon",size:"x-small",style:{color:"white"},iconName:"alert-circle"})):"text"===i.type?e("div",{id:`${t}-badge-text`,class:"tree-item-badge-text"},i.text):e("div",null,e("ez-icon",{id:`${t}-badge-icon`,class:"tree-item-badge-icon",style:{"--ez-icon--color":`var(--ez-tree__badge--icon-color--${i.iconColor||"default"})`},iconName:i.iconName}))}(m.id,m.badge,m.id===r)),b&&i.getChildren().map((t=>e(d,{selectedId:r,node:t,itemClick:s,iconClick:o,level:v+1,iconResolver:n,tooltipResolver:l,itemsList:h,itemDoubleClick:c}))))};class m{constructor(e,t,i,r=!1){this.children=new Map,this.visible=!0,this.item=t,this.parent=i,this._tree=e,this.isPlaceHolder=r,t&&!r?(this._isLazyLoad="function"==typeof t.children||t.childrenCount>0,Array.isArray(t.children)&&(Array.from(t.children).forEach((e=>this.addChild(this._tree,e))),this._childrenLoaded=!0)):(this._isLazyLoad=!1,this._childrenLoaded=!0)}refresh(e){if(this.isPlaceHolder)return;this.item=Object.assign({},e),this._isLazyLoad="function"==typeof this.item.children||this.item.childrenCount>0;const t=this.children;this.children=new Map,Array.isArray(this.item.children)?(void 0===this.item.expanded&&(this.item.expanded=!0),Array.from(this.item.children).forEach((e=>{const i=t.get(e.id);i?(void 0===e.expanded&&(e.expanded=i.item.expanded),i.refresh(e),this.children.set(e.id,i)):(void 0===e.expanded&&(e.expanded=!0),this.addChild(this._tree,Object.assign({},e)))})),this._childrenLoaded=!0):this._childrenLoaded=!1}isDisabled(){return!this.isPlaceHolder&&this._tree.isNodeDisabled(this.item.id,this.item.disabled)}updateChildren(e){this.isPlaceHolder||this.refresh(Object.assign(Object.assign({},this.item),{children:e}))}addChild(e,t){this.children.has(t.id)||this.children.set(t.id,new m(e,t,this))}addPlaceHolder(){this.children.clear();const e=this.item.id;this.children.set(e,new m(void 0,{id:`placeholder_${e}`,label:"Carregando..."},this,!0))}getNode(e){if(this.children.has(e))return this.children.get(e);const t=Array.from(this.children.values());for(const i of t){const t=i.getNode(e);if(t)return t}}needLoad(){return this._isLazyLoad&&!this._childrenLoaded}isExpandable(){return!!this._isLazyLoad||this.children.size>0}getChildren(){return this.isPlaceHolder?[]:(this.needLoad()&&this._tree.loadChildren(this),Array.from(this.children.values()))}}class v extends m{constructor(e){super(void 0),this._disabledValues=new Map,this._changeCallback=e}async addChildAt(e,t){const i=this.getNode(e);null!=i&&(i.addChild(this,t),this._changeCallback())}setDisabled(e,t){this._disabledValues.set(e,t),this._changeCallback()}isNodeDisabled(e,t){return this._disabledValues.has(e)?this._disabledValues.get(e):t}load(e){if(e===this._currentItems)return;this._currentItems=e;const t=this.children;this.children=new Map,this._disabledValues.clear(),e.forEach((e=>{const i=t.get(e.id);i?(i.refresh(e),this.children.set(e.id,i)):this.addChild(this,Object.assign({},e))}))}setFilterPattern(e){this._filterPattern=n.replaceAccentuatedCharsKeepSymbols(e),this.applyFilter(this),this._changeCallback()}updateItem(e){if(null==e)return;const t=this.getNode(e.id);null!=t&&(Object.keys(e).forEach((i=>t.item[i]=e[i])),null==e.children?t.children.clear():Array.isArray(e.children)&&t.updateChildren(e.children),this._changeCallback())}async open(e){return new Promise((async t=>{await this.walkPath(this,e,(e=>e.item.expanded=!0)),t()}))}applyFilter(e){if(e.children.forEach((e=>{this.applyFilter(e)})),null==e.item)return;let t=!1;if(n.replaceAccentuatedCharsKeepSymbols(e.item.label).includes(this._filterPattern))t=!0;else{const i=Array.from(e.children.values());for(let r=0;r<i.length;r++)if(i[r].visible){t=!0,e.item.expanded=!0;break}}e.visible=t}async walkPath(e,t,i,r=0){return new Promise((async s=>{const o=t.split(">>").map((e=>e.trim()));if(o.length>r){const s=e.getNode(o[r]);s&&(s.needLoad()&&await this.loadLevel(s),i(s),await this.walkPath(s,t,i,r+1))}s()}))}async loadChildren(e){return new Promise((t=>{this.loadLevel(e).then((()=>{t(),this._changeCallback()}))}))}async loadLevel(e){return new Promise((t=>{e.addPlaceHolder(),(0,e.item.children)(e.item).then((i=>{e.updateChildren(i),t()}))}))}}const u=class{constructor(e){t(this,e),this.ezChange=i(this,"ezChange",7),this.ezOpenItem=i(this,"ezOpenItem",7),this.ezDbClickItem=i(this,"ezDbClickItem",7),this._onItemClick=e=>{this.value=e},this._onIconClick=e=>{this.openClose(e),this.value=e},this._tree=new v((()=>r(this))),this._waintingForLoad=void 0,this.items=[],this.value=void 0,this.selectedId=void 0,this.iconResolver=h,this.tooltipResolver=void 0}async selectItem(e){const t=this._tree.getNode(e);this.value=t?t.item:void 0}async openItem(e){this._waintingForLoad=!0,await this._tree.open(e),this._waintingForLoad=!1}async disableItem(e){[].concat(e).forEach((e=>this._tree.setDisabled(e,!0)))}async enableItem(e){[].concat(e).forEach((e=>this._tree.setDisabled(e,!1)))}async addChild(e,t){var i;null==t&&(t=null===(i=this.value)||void 0===i?void 0:i.id),this._tree.addChildAt(t,e);const r=this._tree.getNode(t);r&&(r.item.expanded=!0)}async applyFilter(e){this._tree.setFilterPattern(e)}async updateItem(e){var t;this._tree.updateItem(e),null==(null===(t=this._tree)||void 0===t?void 0:t.getNode(this.selectedId))&&(this.value=this._visibleItems?this._visibleItems[0]:void 0)}async getItem(e){return new Promise((t=>{const i=this._tree.getNode(e);t(null==i?void 0:i.item)}))}async getCurrentPath(){var e,t,i;const r=null===(e=this._tree)||void 0===e?void 0:e.getNode(this.selectedId);if(null==r)return;const s=[];let o,a=null===(t=r.parent)||void 0===t?void 0:t.item;for(s.push(this.getItemPathAttrs(r.item));null!=a;)s.unshift(this.getItemPathAttrs(a)),o=this._tree.getNode(a.id),a=null===(i=null==o?void 0:o.parent)||void 0===i?void 0:i.item;return s}async getParent(e){return new Promise((t=>{var i;const r=this._tree.getNode(e);r&&t(null===(i=r.parent)||void 0===i?void 0:i.item),t(void 0)}))}observeItems(e,t){l.objectToString(e)!==l.objectToString(t)&&this._tree.load(this.items||[])}observeValue(){var e;this.ezChange.emit(this.value),this.selectedId=null===(e=this.value)||void 0===e?void 0:e.id}onKeyDownListener(e){if(!this.value)return;let t=!1;switch(e.key){case"ArrowUp":this.previousItem(),t=!0;break;case"ArrowDown":this.nextItem(),t=!0;break;case"ArrowLeft":this.previousLevel(),t=!0;break;case"ArrowRight":this.nextLevel(),t=!0;break;case" ":this.openClose(this.value),t=!0}t&&(e.stopPropagation(),e.preventDefault())}getItemPathAttrs({id:e,label:t}){return{id:e,label:t}}openClose(e){if(null==e)return;const t=!e.expanded;e.expanded=t,t&&this.ezOpenItem.emit(e),this._tree.updateItem(e)}previousLevel(){var e;if(this.value)if(this.value.expanded)this.value.expanded=!1,this._tree.updateItem(this.value);else{const t=null===(e=this._tree.getNode(this.value.id).parent)||void 0===e?void 0:e.item;t&&(this.value=t)}}nextLevel(){this.value&&this._tree.getNode(this.value.id).isExpandable()&&(this.value.expanded?this.nextItem():(this.value.expanded=!0,this._tree.updateItem(this.value)))}indexOf(e){if(null==e)return-1;for(let t=0;t<this._visibleItems.length;t++)if(this._visibleItems[t].id===e)return t;return-1}selectNextItem(e){var t;const i=this.indexOf(null===(t=this.value)||void 0===t?void 0:t.id)+e;i>-1&&i<this._visibleItems.length&&(this.value=this._visibleItems[i])}nextItem(){this.selectNextItem(1)}previousItem(){this.selectNextItem(-1)}connectedCallback(){this.items&&this._tree.load(this.items)}componentWillRender(){var e;if(!this.selectedId||(null===(e=this.value)||void 0===e?void 0:e.id)===this.selectedId)return;const t=this._tree.getNode(this.selectedId);t&&(this.value=t.item)}render(){if(a.addIDInfoIfNotExists(this._element,"ezTree"),null!=this.items)return this._visibleItems=[],e(s,{tabindex:"-1"},this._waintingForLoad?e("label",null,"Carregando..."):this._tree.getChildren().map((t=>{var i;return e(d,{selectedId:null===(i=this.value)||void 0===i?void 0:i.id,node:t,itemClick:this._onItemClick,iconClick:this._onIconClick,iconResolver:this.iconResolver,tooltipResolver:this.tooltipResolver||c,itemsList:this._visibleItems,itemDoubleClick:e=>this.ezDbClickItem.emit(e)})})))}get _element(){return o(this)}static get watchers(){return{items:["observeItems"],value:["observeValue"]}}};u.style=":host{--ez-tree--border-radius:var(--border--radius-small, 8px);--ez-tree--padding-inline-start:20px;--ez-tree--margin:var(--space--extra-small, 3px);--ez-tree--margin-right:calc(var(--space--small, 6px) + 2px);--ez-tree--font-family:var(--font-pattern, Arial);--ez-tree--font-size:var(--text--medium, 14px);--ez-tree--selected--font-weight:var(--text-weight--large, 600);--ez-tree--font-weight:var(--text-weight--small, 400);--ez-tree--color:var(--title--primary, #2B3A54);--ez-tree--selected--color:var(--color--primary, #008561);--ez-tree--disabled--color:var(--text--disable, #AFB6C0);--ez-tree--font-weight--bold:var(--text-weight--large, 600);--ez-tree__tree-item--height:var(--size-medium, 18px);--ez-tree__tree-item--padding:var(--space--small, 6px);--ez-tree__tree-item--background-color:var(--background--xlight, #FFFFFF);--ez-tree__tree-item--selected--background-color:var(--color--primary-300, #E2F4EF);--ez-tree__tree-item--hover--background-color:var(--background--medium, #F0F3F7);--ez-tree__tree-item--disabled--background-color:var(--ez-tree__tree-Item--background-color);--ez-tree__item-icon-box--height:var(--ez-tree__tree-item--height);--ez-tree__item-icon-box--width:var(--size-medium, 18px);--ez-tree__item-icon-box--padding:var(--ez-tree__tree-item--padding);--ez-tree__badge--icon-color--default:var(--title--primary, #2B3A54);--ez-tree__badge--icon-color--error:var(--color--error, #da4453);--ez-tree__badge--icon-color--success:var(--color-alert--success-800, #157a00);--ez-tree__badge--icon-color--warning:var(--color--warning, #f2d410);--ez-tree__badge--icon-color--disabled:var(--text--disable, #AFB6C0);display:flex;flex-direction:column;margin:0 var(--ez-tree--margin) var(--ez-tree--margin) var(--ez-tree--margin);outline:none}ul{list-style-type:none;margin:0;padding-inline-start:var(--ez-tree--padding-inline-start)}ul.first-level{padding-inline-start:0}.tree-item-badge{width:16px;height:16px;background:transparent;border-radius:50%;transition:all 300ms ease-in-out;display:flex;align-items:center;justify-content:center}.tree-item-badge-error-icon{--ez-icon--color:white}.tree-item-badge-text{font-family:var(--ez-tree--font-family);font-size:var(--ez-tree--font-size);font-weight:var(--ez-tree--font-weight);color:var(--ez-tree--color)}.tree-item-badge.error{background:var(--color--error)}.tree-item-badge.warning{background:var(--color--warning)}.tree-item-badge.success{background:var(--color--success)}.item-label-container{display:flex;align-items:center}.tree-item{display:flex;align-items:center;margin-top:var(--ez-tree--margin);margin-right:var(--ez-tree--margin-right);border-radius:var(--ez-tree--border-radius);height:var(--ez-tree__tree-item--height);padding:var(--ez-tree__tree-item--padding);justify-content:space-between}.tree-item[selected]{background-color:var(--ez-tree__tree-item--selected--background-color)}.tree-item:hover{background-color:var(--ez-tree__tree-item--hover--background-color)}.tree-item[disabled],.tree-item[disabled]:hover{background-color:var(--ez-tree__tree-item--disabled--background-color)}.item-icon-box{display:flex;align-items:center;justify-content:center;width:var(--ez-tree__item-icon-box--width);height:var(--ez-tree__item-icon-box--height);padding:var(--ez-tree__item-icon-box--padding) var(--ez-tree__item-icon-box--padding) var(--ez-tree__item-icon-box--padding) 0}.item-icon{--ez-icon--color:var(--ez-tree--color)}.item-icon:hover{cursor:pointer}.tree-item[selected] .item-icon{--ez-icon--color:var(--ez-tree--selected--color)}.tree-item[disabled] .item-icon{cursor:unset;--ez-icon--color:var(--ez-tree--disabled--color)}.item-label{cursor:inherit;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;font-family:var(--ez-tree--font-family);font-size:var(--ez-tree--font-size);font-weight:var(--ez-tree--font-weight);color:var(--ez-tree--color)}.item-label--bold{font-weight:var(--ez-tree--font-weight--bold)}.tree-item[selected] .item-label{color:var(--ez-tree--selected--color);font-weight:var(--ez-tree--selected--font-weight)}.tree-item[disabled] .item-label{color:var(--ez-tree--disabled--color)}";export{u as ez_tree}
|
|
@@ -257,11 +257,22 @@ export interface EzGridOptions {
|
|
|
257
257
|
* Só funciona quando a prop enableGridInsert está ativa
|
|
258
258
|
*/
|
|
259
259
|
enableContinuousInsert?: boolean;
|
|
260
|
-
|
|
260
|
+
/**
|
|
261
|
+
* Ativa o gerenciamento de locks na grade pela Taskbar.
|
|
262
|
+
*/
|
|
263
|
+
enableLockManagerTaskbarClick?: boolean;
|
|
264
|
+
/**
|
|
265
|
+
* Define se o componente deve usar o LockManager para controle de carregamento da aplicação
|
|
266
|
+
*/
|
|
267
|
+
enableLockManagerLoadingComp?: boolean;
|
|
261
268
|
/**
|
|
262
269
|
* Ativa/desativa modo de linhas com cores alternadas.
|
|
263
270
|
*/
|
|
264
271
|
enableRowTableStriped?: boolean;
|
|
272
|
+
/**
|
|
273
|
+
* Informa se a coluna de chechbox deve ser suprimida
|
|
274
|
+
*/
|
|
275
|
+
suppressCheckBoxCol?: boolean;
|
|
265
276
|
}
|
|
266
277
|
/**
|
|
267
278
|
* Representa cada coluna da grade.
|
|
@@ -7,6 +7,7 @@ export default class DataSource implements IServerSideDatasource {
|
|
|
7
7
|
private _options;
|
|
8
8
|
private _lastLoadingParams;
|
|
9
9
|
private _waitingForLoad;
|
|
10
|
+
private _resolveLoading;
|
|
10
11
|
quickFilter: QuickFilter;
|
|
11
12
|
readonly RECORD_ARCHIVE = "__RECORD_ARCHIVE__";
|
|
12
13
|
private duObserver;
|
|
@@ -33,7 +34,7 @@ export default class DataSource implements IServerSideDatasource {
|
|
|
33
34
|
private updateLoadedRecords;
|
|
34
35
|
private handleFocusFirstRow;
|
|
35
36
|
private isSilentChange;
|
|
36
|
-
constructor(dataUnit: DataUnit, controller: EzGridController, options: EzGridOptions);
|
|
37
|
+
constructor(dataUnit: DataUnit, controller: EzGridController, options: EzGridOptions, resolveLoading?: any);
|
|
37
38
|
private updateSelection;
|
|
38
39
|
setAutoFocus(autoFocus: boolean): void;
|
|
39
40
|
setEnableGridInsert(enable: boolean): void;
|
|
@@ -48,6 +48,14 @@ export declare class EzGrid {
|
|
|
48
48
|
* Emitido quando o componente estiver completamente carregado.
|
|
49
49
|
*/
|
|
50
50
|
componentReady: EventEmitter<void>;
|
|
51
|
+
/**
|
|
52
|
+
* Define se o componente deve usar o LockManager para controle de carregamento da aplicação
|
|
53
|
+
*/
|
|
54
|
+
enableLockManagerLoadingComp?: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Ativa inserção de registros no modo grade pela Taskbar.
|
|
57
|
+
*/
|
|
58
|
+
enableLockManagerTaskbarClick?: boolean;
|
|
51
59
|
/**
|
|
52
60
|
* Habilita a seleção de várias linhas.
|
|
53
61
|
*/
|
|
@@ -107,19 +115,23 @@ export declare class EzGrid {
|
|
|
107
115
|
*/
|
|
108
116
|
enableContinuousInsert?: boolean;
|
|
109
117
|
/**
|
|
110
|
-
*
|
|
118
|
+
* Informa se a coluna de chechbox deve ser suprimida
|
|
111
119
|
*/
|
|
112
|
-
|
|
120
|
+
suppressCheckboxColumn?: boolean;
|
|
113
121
|
/**
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
122
|
+
* Altera visualmente as sombras e bordas do componente
|
|
123
|
+
* Quando false, aplica o padrão de sombras ao componente (Utilizar quando for o elemento principal do layout)
|
|
124
|
+
* Quando true, aplica o padrão de outline ao componente (Utilizar quando estiver contido em outro elemento como um painel ou pop-up)
|
|
125
|
+
*/
|
|
118
126
|
outlineMode?: boolean;
|
|
119
127
|
/**
|
|
120
128
|
* Ativa modo de linhas com cores alternadas.
|
|
121
129
|
*/
|
|
122
130
|
enableRowTableStriped?: boolean;
|
|
131
|
+
/**
|
|
132
|
+
* Define se a grade deve ser exibida em modo compacto
|
|
133
|
+
*/
|
|
134
|
+
compact?: boolean;
|
|
123
135
|
/**
|
|
124
136
|
* Aplica a definição de colunas.
|
|
125
137
|
*/
|
|
@@ -46,7 +46,11 @@ export declare class EzSearch {
|
|
|
46
46
|
/**
|
|
47
47
|
* Carrega as opções dinamicamente.
|
|
48
48
|
*/
|
|
49
|
-
optionLoader: (argument: ISearchArgument) => Promise<Array<IOption>> | Array<IOption> | IOption;
|
|
49
|
+
optionLoader: (argument: ISearchArgument, ctxProperties?: any) => Promise<Array<IOption>> | Array<IOption> | IOption;
|
|
50
|
+
/**
|
|
51
|
+
* Propriedades de contexto da aplicação.
|
|
52
|
+
*/
|
|
53
|
+
contextProperties?: any;
|
|
50
54
|
/**
|
|
51
55
|
* Se false a opção selecionada deve exibir somente o `label`.
|
|
52
56
|
*/
|
|
@@ -35,6 +35,10 @@ export declare class EzTree {
|
|
|
35
35
|
* Emitido quando um item é aberto na árvore.
|
|
36
36
|
*/
|
|
37
37
|
ezOpenItem: EventEmitter<ITreeItem>;
|
|
38
|
+
/**
|
|
39
|
+
* Emitido ao dar clique duplo em um item da árvore.
|
|
40
|
+
*/
|
|
41
|
+
ezDbClickItem: EventEmitter<ITreeItem>;
|
|
38
42
|
/**
|
|
39
43
|
* Efetua a seleção de um item.
|
|
40
44
|
*/
|
|
@@ -4,6 +4,7 @@ import { Node } from "../types/Node";
|
|
|
4
4
|
interface TreeItemProps {
|
|
5
5
|
node: Node;
|
|
6
6
|
selectedId: string;
|
|
7
|
+
itemDoubleClick: (item: ITreeItem) => void;
|
|
7
8
|
itemClick: (item: ITreeItem) => void;
|
|
8
9
|
iconClick: (item: ITreeItem) => void;
|
|
9
10
|
iconResolver: (item: ITreeItem, expanded: boolean, level: number) => string;
|
|
@@ -893,6 +893,10 @@ export namespace Components {
|
|
|
893
893
|
* Define um `IMultiSelectionListDataSource` responsável por alimentar o filtro de colunas.
|
|
894
894
|
*/
|
|
895
895
|
"columnfilterDataSource": IMultiSelectionListDataSource;
|
|
896
|
+
/**
|
|
897
|
+
* Define se a grade deve ser exibida em modo compacto
|
|
898
|
+
*/
|
|
899
|
+
"compact"?: boolean;
|
|
896
900
|
/**
|
|
897
901
|
* Configuração de exibição da grade.
|
|
898
902
|
*/
|
|
@@ -910,9 +914,13 @@ export namespace Components {
|
|
|
910
914
|
*/
|
|
911
915
|
"enableGridInsert"?: boolean;
|
|
912
916
|
/**
|
|
913
|
-
*
|
|
917
|
+
* Define se o componente deve usar o LockManager para controle de carregamento da aplicação
|
|
918
|
+
*/
|
|
919
|
+
"enableLockManagerLoadingComp"?: boolean;
|
|
920
|
+
/**
|
|
921
|
+
* Ativa inserção de registros no modo grade pela Taskbar.
|
|
914
922
|
*/
|
|
915
|
-
"
|
|
923
|
+
"enableLockManagerTaskbarClick"?: boolean;
|
|
916
924
|
/**
|
|
917
925
|
* Ativa modo de linhas com cores alternadas.
|
|
918
926
|
*/
|
|
@@ -946,7 +954,7 @@ export namespace Components {
|
|
|
946
954
|
*/
|
|
947
955
|
"multipleSelection": boolean;
|
|
948
956
|
/**
|
|
949
|
-
* Altera visualmente as sombras e bordas do componente Quando
|
|
957
|
+
* Altera visualmente as sombras e bordas do componente Quando false, aplica o padrão de sombras ao componente (Utilizar quando for o elemento principal do layout) Quando true, aplica o padrão de outline ao componente (Utilizar quando estiver contido em outro elemento como um painel ou pop-up)
|
|
950
958
|
*/
|
|
951
959
|
"outlineMode"?: boolean;
|
|
952
960
|
/**
|
|
@@ -1001,6 +1009,10 @@ export namespace Components {
|
|
|
1001
1009
|
* Para a edição da grade.
|
|
1002
1010
|
*/
|
|
1003
1011
|
"stopEdit": () => Promise<void>;
|
|
1012
|
+
/**
|
|
1013
|
+
* Informa se a coluna de chechbox deve ser suprimida
|
|
1014
|
+
*/
|
|
1015
|
+
"suppressCheckboxColumn"?: boolean;
|
|
1004
1016
|
/**
|
|
1005
1017
|
* Quando verdadeiro, o ENTER fará a navegação como se fosse a tecla TAB na grade.
|
|
1006
1018
|
*/
|
|
@@ -1407,6 +1419,10 @@ export namespace Components {
|
|
|
1407
1419
|
* Limpa o valor do campo de pesquisa
|
|
1408
1420
|
*/
|
|
1409
1421
|
"clearValue": () => Promise<void>;
|
|
1422
|
+
/**
|
|
1423
|
+
* Propriedades de contexto da aplicação.
|
|
1424
|
+
*/
|
|
1425
|
+
"contextProperties"?: any;
|
|
1410
1426
|
/**
|
|
1411
1427
|
* Se false o usuário não pode interagir com o campo.
|
|
1412
1428
|
*/
|
|
@@ -1455,7 +1471,7 @@ export namespace Components {
|
|
|
1455
1471
|
/**
|
|
1456
1472
|
* Carrega as opções dinamicamente.
|
|
1457
1473
|
*/
|
|
1458
|
-
"optionLoader": (argument: ISearchArgument) => Promise<Array<IOption>> | Array<IOption> | IOption;
|
|
1474
|
+
"optionLoader": (argument: ISearchArgument, ctxProperties?: any) => Promise<Array<IOption>> | Array<IOption> | IOption;
|
|
1459
1475
|
/**
|
|
1460
1476
|
* Array com as opções do ez-combo-box. Os elementos devem obedecer o formato: `{value: string, label: string}`.
|
|
1461
1477
|
*/
|
|
@@ -3434,6 +3450,10 @@ declare namespace LocalJSX {
|
|
|
3434
3450
|
* Define um `IMultiSelectionListDataSource` responsável por alimentar o filtro de colunas.
|
|
3435
3451
|
*/
|
|
3436
3452
|
"columnfilterDataSource"?: IMultiSelectionListDataSource;
|
|
3453
|
+
/**
|
|
3454
|
+
* Define se a grade deve ser exibida em modo compacto
|
|
3455
|
+
*/
|
|
3456
|
+
"compact"?: boolean;
|
|
3437
3457
|
/**
|
|
3438
3458
|
* Configuração de exibição da grade.
|
|
3439
3459
|
*/
|
|
@@ -3451,9 +3471,13 @@ declare namespace LocalJSX {
|
|
|
3451
3471
|
*/
|
|
3452
3472
|
"enableGridInsert"?: boolean;
|
|
3453
3473
|
/**
|
|
3454
|
-
*
|
|
3474
|
+
* Define se o componente deve usar o LockManager para controle de carregamento da aplicação
|
|
3455
3475
|
*/
|
|
3456
|
-
"
|
|
3476
|
+
"enableLockManagerLoadingComp"?: boolean;
|
|
3477
|
+
/**
|
|
3478
|
+
* Ativa inserção de registros no modo grade pela Taskbar.
|
|
3479
|
+
*/
|
|
3480
|
+
"enableLockManagerTaskbarClick"?: boolean;
|
|
3457
3481
|
/**
|
|
3458
3482
|
* Ativa modo de linhas com cores alternadas.
|
|
3459
3483
|
*/
|
|
@@ -3483,7 +3507,7 @@ declare namespace LocalJSX {
|
|
|
3483
3507
|
*/
|
|
3484
3508
|
"onEzSelectionChange"?: (event: EzGridCustomEvent<ISelection>) => void;
|
|
3485
3509
|
/**
|
|
3486
|
-
* Altera visualmente as sombras e bordas do componente Quando
|
|
3510
|
+
* Altera visualmente as sombras e bordas do componente Quando false, aplica o padrão de sombras ao componente (Utilizar quando for o elemento principal do layout) Quando true, aplica o padrão de outline ao componente (Utilizar quando estiver contido em outro elemento como um painel ou pop-up)
|
|
3487
3511
|
*/
|
|
3488
3512
|
"outlineMode"?: boolean;
|
|
3489
3513
|
/**
|
|
@@ -3506,6 +3530,10 @@ declare namespace LocalJSX {
|
|
|
3506
3530
|
* Define um `IStatusResolver` responsável pelo estado da coluna de status.
|
|
3507
3531
|
*/
|
|
3508
3532
|
"statusResolver"?: IStatusResolver | StatusResolverFunction;
|
|
3533
|
+
/**
|
|
3534
|
+
* Informa se a coluna de chechbox deve ser suprimida
|
|
3535
|
+
*/
|
|
3536
|
+
"suppressCheckboxColumn"?: boolean;
|
|
3509
3537
|
/**
|
|
3510
3538
|
* Quando verdadeiro, o ENTER fará a navegação como se fosse a tecla TAB na grade.
|
|
3511
3539
|
*/
|
|
@@ -3884,6 +3912,10 @@ declare namespace LocalJSX {
|
|
|
3884
3912
|
* Se false deixa de exibir a mensagem de erro dentro do campo.
|
|
3885
3913
|
*/
|
|
3886
3914
|
"canShowError"?: boolean;
|
|
3915
|
+
/**
|
|
3916
|
+
* Propriedades de contexto da aplicação.
|
|
3917
|
+
*/
|
|
3918
|
+
"contextProperties"?: any;
|
|
3887
3919
|
/**
|
|
3888
3920
|
* Se false o usuário não pode interagir com o campo.
|
|
3889
3921
|
*/
|
|
@@ -3931,7 +3963,7 @@ declare namespace LocalJSX {
|
|
|
3931
3963
|
/**
|
|
3932
3964
|
* Carrega as opções dinamicamente.
|
|
3933
3965
|
*/
|
|
3934
|
-
"optionLoader"?: (argument: ISearchArgument) => Promise<Array<IOption>> | Array<IOption> | IOption;
|
|
3966
|
+
"optionLoader"?: (argument: ISearchArgument, ctxProperties?: any) => Promise<Array<IOption>> | Array<IOption> | IOption;
|
|
3935
3967
|
/**
|
|
3936
3968
|
* Array com as opções do ez-combo-box. Os elementos devem obedecer o formato: `{value: string, label: string}`.
|
|
3937
3969
|
*/
|
|
@@ -4354,6 +4386,10 @@ declare namespace LocalJSX {
|
|
|
4354
4386
|
* Emitido quando um item é selecionado na árvore.
|
|
4355
4387
|
*/
|
|
4356
4388
|
"onEzChange"?: (event: EzTreeCustomEvent<ITreeItem>) => void;
|
|
4389
|
+
/**
|
|
4390
|
+
* Emitido ao dar clique duplo em um item da árvore.
|
|
4391
|
+
*/
|
|
4392
|
+
"onEzDbClickItem"?: (event: EzTreeCustomEvent<ITreeItem>) => void;
|
|
4357
4393
|
/**
|
|
4358
4394
|
* Emitido quando um item é aberto na árvore.
|
|
4359
4395
|
*/
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,c as i,h as s,H as e,g as r}from"./p-23a36bb6.js";import{C as o}from"./p-9e11fc7b.js";import{ObjectUtils as a,StringUtils as h,FloatingManager as l,ElementIDUtils as n}from"@sankhyalabs/core";import{A as c}from"./p-2187f86c.js";import"./p-ab574d59.js";import"./p-b853763b.js";import"./p-4607fb89.js";import{R as d}from"./p-05e1f4e7.js";const u=class{constructor(s){t(this,s),this.ezChange=i(this,"ezChange",7),this._changeDeboucingTimeout=null,this._limitCharsToSearch=3,this._deboucingTime=300,this._maxWidthValue=0,this._tabPressed=!1,this._textEmptyList="Nenhum resultado encontrado",this._textEmptySearch="Nenhum resultado de {0} encontrado",this._startHighlightTag="<span class='card-item__highlight'>",this._endHighlightTag="</span>",this._preSelection=void 0,this._visibleOptions=void 0,this._startLoading=!1,this._showLoading=!0,this._showLoadingDescription=!1,this._criteria=void 0,this.value=void 0,this.label=void 0,this.enabled=!0,this.errorMessage=void 0,this.optionLoader=void 0,this.showSelectedValue=!0,this.showOptionValue=!0,this.suppressEmptyOption=!1,this.stopPropagateEnterKeyEvent=!1,this.mode="regular",this.canShowError=!0,this.hideErrorOnFocusOut=!0,this.listOptionsPosition=void 0,this.isTextSearch=!1,this.ignoreLimitCharsToSearch=!1,this.noMargin=!1,this.options=void 0,this.suppressSearch=!1,this.ensureClearButtonVisible=!1,this.suppressPreLoad=!0,this.autoFocus=!1}observeErrorMessage(){var t;this._textInput&&(this._textInput.errorMessage=this.errorMessage,!(null===(t=this.errorMessage)||void 0===t?void 0:t.trim())&&this.errorMessage&&this.setInputValue())}getValue(t){return"object"==typeof t?null==t?void 0:t.value:t}validateNewValue(t,i){const s=this.getValue(t),e=this.getValue(i);return!("[object Object]"===s||s===e)}async observeValue(t,i){if(this._textInput&&this.validateNewValue(t,i)){if("string"==typeof t)return void await this.handleValueAsString(t);const i=this.getSelectedOption(t),s=this.getSelectedOption(this._currentValue);this.isDifferentValues(s,i)&&(this._currentValue=i,this.setInputValue(),this.ezChange.emit(null!=i?i:void 0)),this.resetOptions()}}observeOptions(t,i){!t.length&&this.suppressPreLoad||(null==t?void 0:t.join(""))!==(null==i?void 0:i.join(""))&&this.loadOptions(v.PRELOAD)}async getValueAsync(){return new Promise(this._showLoading?t=>{let i=setInterval((()=>{this._showLoading||(clearInterval(i),t(this.value))}),100)}:t=>t(this.value))}async setFocus(t){this._textInput&&this._textInput.setFocus(t)}async setBlur(){this._textInput&&this._textInput.setBlur()}async isInvalid(){return"string"==typeof this.errorMessage&&""!==this.errorMessage.trim()}async clearValue(){this.clearSearch()}scrollListener(){var t;null!=this._floatingID&&((null===(t=this.listOptionsPosition)||void 0===t?void 0:t.hardPosition)?this.hideOptions():window.requestAnimationFrame((()=>{this.updateListPosition()})))}async handleValueAsString(t){this.getSelectedOption(t)?this.setInputValue():(await this.loadDescriptionValue(t),this._currentValue&&(this.setInputValue(),this.ezChange.emit(this.value),this._currentValue=this.value))}updateListPosition(){let{verticalPosition:t,horizontalPosition:i,fromBottom:s,fromRight:e,bottomLimit:r,hardPosition:o}=this.getListPosition();const a=this._listWrapper.getBoundingClientRect(),h=this._listContainer.getBoundingClientRect(),l=this._textInput.getBoundingClientRect(),n=r||window.innerHeight;!s&&(a.top<0||h.bottom+a.height>n)&&(s=!0),o||(t=t||0,i=i||0,s?t=window.innerHeight-l.top+t:t+=h.top,e?i=window.innerWidth-l.right+i:i+=h.left),null!=t&&(this._listWrapper.style[s?"bottom":"top"]=`${t}px`,this._listWrapper.style[s?"top":"bottom"]=""),null!=i&&(this._listWrapper.style[e?"right":"left"]=`${i}px`,this._listWrapper.style[e?"left":"right"]="")}getListPosition(){return this.listOptionsPosition?this.listOptionsPosition:{verticalPosition:6}}isDifferentValues(t,i){return a.objectToString(t||{})!==a.objectToString(i||{})}getFormattedText(t){if(null==t)return;let i=this.showSelectedValue&&null!=t.value?t.label?`${t.value} - ${t.label}`:t.value:t.label;return i=null==i?void 0:i.replace(new RegExp(this._startHighlightTag,"g"),"").replace(new RegExp(this._endHighlightTag,"g"),""),i}getText(){const t=this.getSelectedOption(this._currentValue),i=this.getFormattedText(t);return this.replaceQuotes(i)}replaceQuotes(t){if(null!=t)return String(t).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"')}getSelectedOption(t){return"string"==typeof t||t instanceof String?this._visibleOptions.find((i=>i.value===t)):t?Object.assign(Object.assign({},t),{value:this.replaceHighlight(null==t?void 0:t.value),label:this.replaceHighlight(null==t?void 0:t.label)}):t}updateVisibleOptions(){let t=this._source||[];this._visibleOptions=this.suppressEmptyOption?t:[{value:void 0,label:""}].concat(t),this._maxWidthValue=this.getMaxWidthValue()}getMaxWidthValue(){var t;const i=[];return null===(t=this._visibleOptions)||void 0===t||t.forEach((t=>{const s=this.getWidthValue(t.value);i.includes(s)||i.push(s)})),i.length>1?Math.max(...i):0}getWidthValue(t){if(null!=this._itemValueBasis){const i=this._itemValueBasis;if(null!=t)return i.innerHTML=t,i.clientWidth>0?i.clientWidth+2:0;i.innerHTML=""}return 0}createOption(t){let{key:i,title:s}=t;const e=new RegExp(this._startHighlightTag,"g"),r=new RegExp(this._endHighlightTag,"g");s=h.decodeHtmlEntities(s);const o={value:null==i?void 0:i.replace(e,"").replace(r,""),label:null==s?void 0:s.replace(e,"").replace(r,"")};this.selectOption(o)}buildItem(t,i){t.label=t.label||t.value;const e={key:t.value,title:t.label,details:t.details};return s("div",{style:{height:"100%"},class:i===this._preSelection?"item preselected":"item",id:`item_${t.value}`,onMouseDown:()=>this.createOption(e),onMouseOver:()=>this._preSelection=i},s("ez-card-item",{item:e,compacted:!0,enableKey:this.showOptionValue}))}showOptions(){this.enabled&&(this.isOptionsVisible()||(this._resizeObserver&&this._resizeObserver.observe(this._textInput),this._floatingID=l.float(this._listWrapper,this._listContainer,{autoClose:!1,isFixed:!0,backClickListener:()=>this.hideOptions()}),this.setFocus(),window.requestAnimationFrame((()=>{this.updateListPosition(),this.listOptionsPosition||this._listWrapper.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})}))))}hideOptions(){void 0!==this._floatingID&&l.close(this._floatingID),this._floatingID=void 0,this._resizeObserver&&this._resizeObserver.unobserve(this._textInput)}isOptionsVisible(){return void 0!==this._floatingID&&l.isFloating(this._floatingID)}nextOption(){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]))}previousOption(){this._preSelection=void 0===this._preSelection?0:Math.max(this._preSelection-1,0),this.scrollToOption(this._visibleOptions[this._preSelection])}scrollToOption(t){window.requestAnimationFrame((()=>{const i=(null==t?void 0:t.value)?this._optionsList.querySelector(`div#item_${t.value.replace(/([ #;&,.+*~':"!^$[\]()=<>|/\\])/g,"\\$1")}`):void 0;i&&i.scrollIntoView({behavior:"smooth",block:"nearest"})}))}selectCurrentOption(){void 0!==this._preSelection?(this.selectOption(this._visibleOptions[this._preSelection]),this._preSelection=void 0):this.controlListWithOnlyOne()}updateSource(t){this._startLoading=!1,t instanceof Promise?(this._showLoading=!0,this._showLoadingDescription=!0,t.then((t=>{this.updateSource(t)})).finally((()=>{this._showLoading=!1,this._showLoadingDescription=!1})),this.updateVisibleOptions()):(this._showLoading=!1,Array.isArray(t)?(this._source=t,this.updateVisibleOptions(),this._tabPressed&&(this._tabPressed=!1,this.controlEmptySearch(!1))):this.selectOption(t))}clearSource(){this._source=[],this.updateVisibleOptions()}replaceHighlight(t){const i=new RegExp(this._startHighlightTag,"g"),s=new RegExp(this._endHighlightTag,"g");return String(null!=t?t:"").replace(i,"").replace(s,"")}selectOption(t,i=!0){var s,e;const r=this.getSelectedOption(this.value),o=Object.assign(Object.assign({},t),{value:this.replaceHighlight(null==t?void 0:t.value),label:this.replaceHighlight(null==t?void 0:t.label)}),a=Object.assign(Object.assign({},o),{value:this.replaceQuotes(null==o?void 0:o.value),label:this.replaceQuotes(null==o?void 0:o.label)});if((null===(s=null==r?void 0:r.value)||void 0===s?void 0:s.toString())!==(null===(e=null==a?void 0:a.value)||void 0===e?void 0:e.toString())||null==r&&null!=a&&"value"in a){const t=(null==a?void 0:a.value)?a:void 0;this.value=t,this._currentValue=t}else this.setInputValue(),this.resetOptions();this._visibleOptions=[],this.clearSource(),i&&setTimeout((()=>{this.setFocus()}),0)}loadOptions(t,i=""){this._criteria=i,this._startLoading=!0,this.updateSource(this.optionLoader?this.optionLoader({mode:t,argument:i}):this.options)}cancelPreselection(){!this._textInput.value&&this._currentValue?this.selectOption(void 0):window.setTimeout((()=>{this.setInputValue()}),this._deboucingTime),this.resetOptions()}setInputValue(t=!0){const i=this.getText();(this._textInput.value||"")!==i&&(this._textInput.value=i,t&&(this.errorMessage=null))}clearSearch(){this.value=null,this._currentValue=null}controlListWithOnlyOne(t=!0){var i,s;const e=null===(i=this._visibleOptions)||void 0===i?void 0:i.filter((t=>""!==t.label&&null!=t.value));if((null==e?void 0:e.length)>0){const i=new RegExp(this._startHighlightTag,"g"),r=new RegExp(this._endHighlightTag,"g");let o=h.decodeHtmlEntities(e[0].label);const a={value:null===(s=e[0].value)||void 0===s?void 0:s.replace(i,"").replace(r,""),label:null==o?void 0:o.replace(i,"").replace(r,"")};this.selectOption(a,t)}}controlEmptySearch(t=!0){var i;(null===(i=this._visibleOptions)||void 0===i?void 0:i.length)?this.controlListWithOnlyOne(t):(this.clearSearch(),c.info(this._textEmptyList))}async loadDescriptionValue(t){var i,s;if(null==t)return;if((null===(i=this.options)||void 0===i?void 0:i.length)>0)return void this.loadOptionValue(t);const e={mode:v.PREDICTIVE,argument:t},r=await(null===(s=this.optionLoader)||void 0===s?void 0:s.call(this,e));null!=r&&(r instanceof Promise?r.then((t=>{this.setDescriptionValue(t)})):this.setDescriptionValue(r))}setDescriptionValue(t){const i=(null==t?void 0:t[0])||t;null!=i&&Object.keys(i).length?(this._currentValue=i?Object.assign(Object.assign({},i),{value:this.replaceHighlight(i.value),label:this.replaceHighlight(i.label)}):i,this.value=this._currentValue,this.setTextInputValue()):this.showNoResultMessage()}setTextInputValue(){if(this._textInput&&null==this._textInput.value){if(null==this.value)return;const t="string"==typeof this.value?this.value:this.getFormattedText(this.value);this._textInput.value=this.replaceQuotes(t)}}loadOptionValue(t){var i;const s=null===(i=this.options)||void 0===i?void 0:i.find((i=>i.value===t));null!=s?this.selectOption(s):this.showNoResultMessage()}async showNoResultMessage(){this.clearSearch(),c.info(this._textEmptySearch.replace("{0}",this.getFieldLabel()))}getFieldLabel(){var t;return null===(t=this.label)||void 0===t?void 0:t.replace(d,"").toUpperCase()}resetOptions(){this.hideOptions(),this._criteria=void 0,this._preSelection=void 0,this.updateVisibleOptions()}async handleInitialValue(){if(!this.getValue(this.value))return;if("string"==typeof this.value)return void await this.handleValueAsString(this.value);let t=this.getFormattedText(this.value);t=this.replaceQuotes(t),this._textInput.value=t}componentWillLoad(){if(void 0===this.options){this.options=[];const t=this.el.querySelectorAll("option");t&&t.forEach((t=>{let i=t.innerText,s=t.getAttribute("value"),e=t.getAttribute("details");s||(s=i),this.options.push({label:i,value:s,details:e}),t.hidden=!0}))}this.updateSource([])}componentDidRender(){var t;void 0===this._floatingID&&this._listWrapper.remove(),null===(t=this._optionsList)||void 0===t||t.querySelectorAll(".item").forEach((t=>{n.addIDInfoIfNotExists(t,"itemSearch")}))}async componentDidLoad(){this._currentValue=this.value,o.applyVarsTextInput(this.el,this._textInput),this._resizeObserver=new ResizeObserver((t=>{window.requestAnimationFrame((()=>{if(!Array.isArray(t)||!t.length)return;const{clientWidth:i}=this._listContainer;i>0&&this._listWrapper&&(this._listWrapper.style.width=`${i}px`)}))})),await this.handleInitialValue(),this.autoFocus&&requestAnimationFrame((()=>{this.setFocus({selectText:!0})}))}disconnectedCallback(){var t;null===(t=this._resizeObserver)||void 0===t||t.disconnect()}handlerIconClick(){this.loadOptions(v.ADVANCED)}buildNumberArgument(t){return this.isTextSearch?NaN:Number(t||void 0)}onTextInputChangeHandler(t){var i;if(this.clearDeboucingTimeout(),this._startLoading)return void(this._changeDeboucingTimeout=window.setTimeout((()=>{this.onTextInputChangeHandler(t)}),this._deboucingTime));const s=null===(i=t.target.value)||void 0===i?void 0:i.trim(),e=this.buildNumberArgument(s);this._criteria||(this._textInput.value=t.data||s),this._criteria=s,s?(this._showLoading=!1,this.clearSource(),this.ignoreLimitCharsToSearch||!isNaN(e)||s.length>=this._limitCharsToSearch?(this._showLoading=!0,this._changeDeboucingTimeout=window.setTimeout((()=>{this.loadOptions(v.PREDICTIVE,isNaN(e)?s:e.toString())}),this._deboucingTime),this.showOptions()):this.hideOptions()):(this.hideOptions(),this._showLoading=!1,this.clearSource())}clearDeboucingTimeout(){this._changeDeboucingTimeout&&(window.clearTimeout(this._changeDeboucingTimeout),this._changeDeboucingTimeout=null)}keyDownHandler(t){switch(this._tabPressed=!1,t.ctrlKey&&("f"!==t.key&&"F"!==t.key||(this.loadOptions(v.ADVANCED),t.stopPropagation(),t.stopImmediatePropagation(),t.preventDefault())),t.key){case"ArrowDown":t.stopPropagation(),this.canShowListOptions()&&t.preventDefault(),this.nextOption();break;case"ArrowUp":t.stopPropagation(),this.canShowListOptions()&&t.preventDefault(),this.previousOption();break;case"Enter":this.handleEventPropagation(t),this.selectCurrentOption();break;case"Escape":this.cancelPreselection();break;case"Tab":this._tabPressed=!0,this.controlListWithOnlyOne(!1)}}handleEventPropagation(t){this._listContainer.hasChildNodes()&&this.stopPropagateEnterKeyEvent&&t.stopPropagation()}onTextInputFocusOutHandler(){this.hideErrorOnFocusOut&&this.cancelPreselection()}canShowListOptions(){return!this._showLoading&&this._visibleOptions.length>0}canShowLoadSpinDescription(){return this._showLoadingDescription&&null==this._floatingID}render(){var t;return n.addIDInfoIfNotExists(this.el,"input"),s(e,null,s("ez-text-input",{"data-element-id":n.getInternalIDInfo("textInput"),class:this.suppressSearch?"suppressed-search-input":"",ref:t=>this._textInput=t,"data-slave-mode":"true",enabled:this.enabled&&!this.suppressSearch,onInput:t=>this.onTextInputChangeHandler(t),onFocusout:()=>this.onTextInputFocusOutHandler(),onKeyDown:t=>this.keyDownHandler(t),label:this.label,canShowError:this.canShowError,errorMessage:this.errorMessage,mode:this.mode,noMargin:this.noMargin},s("button",{class:"btn",slot:"leftIcon",disabled:!this.enabled,tabindex:-1,onClick:()=>this.handlerIconClick()},this.canShowLoadSpinDescription()?s("div",{class:"message__loading"}):s("ez-icon",{iconName:"search"})),(null===(t=this._textInput)||void 0===t?void 0:t.value)&&(this._criteria||this.value)||this.ensureClearButtonVisible?s("button",{class:"btn btn__close",slot:"rightIcon",disabled:!this.enabled,tabindex:-1,onClick:()=>this.clearSearch()},s("ez-icon",{iconName:"close"})):void 0),s("section",{class:"list-container",ref:t=>this._listContainer=t},s("div",{class:"list-wrapper",ref:t=>this._listWrapper=t},s("ul",{class:"list-options",ref:t=>this._optionsList=t},!this._showLoading&&0===this._visibleOptions.length&&s("div",{class:"message"},s("span",{class:"message__no-result"},this._textEmptyList)),this._showLoading&&s("div",{class:"message"},s("div",{class:"message__loading"})),s("span",{class:"item__value item__value--hidden",ref:t=>this._itemValueBasis=t}),this.canShowListOptions()&&this._visibleOptions.map(((t,i)=>this.buildItem(t,i)))))))}get el(){return r(this)}static get watchers(){return{errorMessage:["observeErrorMessage"],value:["observeValue"],options:["observeOptions"]}}};var v;!function(t){t.ADVANCED="ADVANCED",t.PRELOAD="PRELOAD",t.PREDICTIVE="PREDICTIVE"}(v||(v={})),u.style=":host{--ez-search--height:42px;--ez-search--width:100%;--ez-search__icon--width:48px;--ez-search--border-radius:var(--border--radius-medium, 12px);--ez-search--border-radius-small:var(--border--radius-small, 6px);--ez-search--font-size:var(--text--medium, 14px);--ez-search--font-family:var(--font-pattern, Arial);--ez-search--font-weight--large:var(--text-weight--large, 500);--ez-search--font-weight--medium:var(--text-weight--medium, 400);--ez-search--background-color--xlight:var(--background--xlight, #fff);--ez-search--background-medium:var(--background--medium, #f0f3f7);--ez-search--line-height:calc(var(--text--medium, 14px) + 4px);--ez-search__input--background-color:var(--background--medium, #e0e0e0);--ez-search__input--border:var(--border--medium, 2px solid);--ez-search__input--border-color:var(--ez-search__input--background-color);--ez-search__input--focus--border-color:var(--color--primary, #008561);--ez-search__input--disabled--background-color:var(--color--disable-secondary, #F2F5F8);--ez-search__input--disabled--color:var(--text--disable, #AFB6C0);--ez-search__input--error--border-color:#CC2936;--ez-search__btn--color:var(--title--primary, #2B3A54);--ez-search__btn-disabled--color:var(--text--disable, #AFB6C0);--ez-search__btn-hover--color:var(--color--primary, #4e4e4e);--ez-search__label--color:var(--title--primary, #2B3A54);--ez-search__list-title--primary:var(--title--primary, #2B3A54);--ez-search__list-text--primary:var(--text--primary, #626e82);--ez-search__list-height:calc(var(--ez-search--font-size) + var(--ez-search--space--medium) + 4px);--ez-search__list-min-width:64px;--ez-search--space--medium:var(--space--medium, 12px);--ez-search--space--small:var(--space--small, 6px);--ez-search__scrollbar--color-default:var(--scrollbar--default, #626e82);--ez-search__scrollbar--color-background:var(--scrollbar--background, #E5EAF0);--ez-search__scrollbar--color-hover:var(--scrollbar--hover, #2B3A54);--ez-search__scrollbar--color-clicked:var(--scrollbar--clicked, #a2abb9);--ez-search__scrollbar--border-radius:var(--border--radius-small, 6px);--ez-search__scrollbar--width:var(--space--medium, 12px);display:flex;flex-wrap:wrap;position:relative;width:var(--ez-search--width)}ez-icon{--ez-icon--color:inherit;font-weight:var(--text-weight--large, 600)}.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, #2B3A54)}.list-container{min-width:var(--ez-search__list-min-width);overflow:auto;position:relative;width:100%}.list-wrapper{display:flex;flex-direction:column;box-sizing:border-box;width:0;z-index:var(--more-visible, 2);max-height:350px;min-width:150px;background-color:var(--ez-search--background-color--xlight);border-radius:var(--ez-search--border-radius);box-shadow:var(--shadow, 0px 0px 16px 0px #000)}.list-options{margin-top:0px;box-sizing:border-box;width:100%;height:100%;padding:0;display:flex;flex-direction:column;scroll-behavior:smooth;overflow-y:auto;overflow-x:hidden;scrollbar-width:thin;scrollbar-color:var(--ez-search__scrollbar--color-clicked) var(--ez-search__scrollbar--color-background)}.list-options::-webkit-scrollbar{background-color:var(--scrollbar--background);width:var(--space--small);max-width:var(--space--small);min-width:var(--space--small);height:var(--space--small);max-height:var(--space--small);min-height:var(--space--small)}.list-options::-webkit-scrollbar-track{background-color:var(--ez-search__scrollbar--color-background);border-radius:var(--ez-search__scrollbar--border-radius)}.list-options::-webkit-scrollbar-thumb{background-color:var(--ez-search__scrollbar--color-default);border-radius:var(--ez-search__scrollbar--border-radius)}.list-options::-webkit-scrollbar-thumb:vertical:hover,.list-options::-webkit-scrollbar-thumb:horizontal:hover{background-color:var(--ez-search__scrollbar--color-hover)}.list-options::-webkit-scrollbar-thumb:vertical:active,.list-options::-webkit-scrollbar-thumb:horizontal:active{background-color:var(--ez-search__scrollbar--color-clicked)}.item{display:flex;align-items:center;width:100%;box-sizing:border-box;list-style-type:none;cursor:pointer;border-radius:var(--ez-search--border-radius-small);gap:var(--space--small, 6px)}.item__value,.item__label{flex-basis:auto;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--ez-search__list-title--primary);font-family:var(--ez-search--font-family);font-size:var(--ez-search--font-size);line-height:var(--ez-search--line-height)}.item__label{font-weight:var(--ez-search--font-weight--medium)}.item__label--bold{font-weight:var(--ez-search--font-weight--large)}.item__value{text-align:center;color:var(--ez-search__list-text--primary);font-weight:var(--ez-search--font-weight--large)}.item__value--hidden{visibility:hidden;position:absolute;white-space:nowrap;z-index:-1;top:0;left:0}.item__label{text-align:left}.message{text-align:center;display:flex;justify-content:center;align-items:center;list-style-type:none;min-height:var(--ez-search__list-height)}.message__no-result{color:var(--ez-search__list-title--primary);font-family:var(--ez-search--font-family);font-size:var(--ez-search--font-size)}.message__loading{border-radius:50%;width:14px;height:14px;-webkit-animation:spin 1s linear infinite;animation:spin 1s linear infinite;border:3px solid var(--ez-search__list-title--primary);border-top:3px solid transparent}.item__list>li:hover{background-color:var(--ez-search--background-medium)}.preselected{background-color:var(--background--medium)}.btn{outline:none;border:none;background:none;cursor:pointer;color:var(--ez-search__btn--color)}.btn:disabled{cursor:not-allowed;color:var(--ez-search__btn-disabled--color)}.btn:disabled:hover{cursor:not-allowed;color:var(--ez-search__btn-disabled--color)}.btn:hover{color:var(--ez-search__btn-hover--color)}.btn__close{visibility:hidden}ez-text-input:hover .btn__close,ez-text-input:focus .btn__close{visibility:visible}@-webkit-keyframes spin{0%{-webkit-transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg)}}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}@supports not (scrollbar-width: thin){.item{padding-right:8px}}";export{u as ez_search}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{h as e,r as t,c as i,f as r,H as s,g as o}from"./p-23a36bb6.js";import{ElementIDUtils as a,StringUtils as n,ObjectUtils as l}from"@sankhyalabs/core";const h=(e,t)=>t?e.iconExpanded||"chevron-down":e.iconContracted||"chevron-right",c=e=>e.tooltip||e.label,d=t=>{const{node:i,selectedId:r,itemClick:s,iconClick:o,iconResolver:n,tooltipResolver:l,itemsList:h}=t;if(!i.visible)return;const c=i.item,v=t.level||1,m=i.isDisabled(),u=!m&&c.expanded,g=i.isExpandable(),b=!m&&!i.isPlaceHolder;return b&&h.push(c),e("ul",{class:1===v?"first-level":void 0},e("li",Object.assign({title:l(c,!m,v),class:"tree-item "+(c.id!==r?"tree-item-error":""),onClick:()=>b&&s(c)},{disabled:m,selected:c.id===r,[a.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:a.getInternalIDInfo(`ezTreeItem_${c.id}`)}),e("div",{class:"item-label-container"},e("div",{class:"item-icon-box"},g&&e("ez-icon",{id:c.id,class:"item-icon",size:"small",iconName:n(c,u,v),onClick:()=>b&&o(c)})),e("label",{class:"item-label "+(c.bold?"item-label--bold":"")},c.label)),function(t,i,r){if(null!=i)return"string"==typeof i?e("div",{class:`tree-item-badge ${r?null:i}`},"error"===i&&e("ez-icon",{id:`${t}-badge-error`,class:"tree-item-badge-error-icon",size:"x-small",style:{color:"white"},iconName:"alert-circle"})):"text"===i.type?e("div",{id:`${t}-badge-text`,class:"tree-item-badge-text"},i.text):e("div",null,e("ez-icon",{id:`${t}-badge-icon`,class:"tree-item-badge-icon",style:{"--ez-icon--color":`var(--ez-tree__badge--icon-color--${i.iconColor||"default"})`},iconName:i.iconName}))}(c.id,c.badge,c.id===r)),u&&i.getChildren().map((t=>e(d,{selectedId:r,node:t,itemClick:s,iconClick:o,level:v+1,iconResolver:n,tooltipResolver:l,itemsList:h}))))};class v{constructor(e,t,i,r=!1){this.children=new Map,this.visible=!0,this.item=t,this.parent=i,this._tree=e,this.isPlaceHolder=r,t&&!r?(this._isLazyLoad="function"==typeof t.children||t.childrenCount>0,Array.isArray(t.children)&&(Array.from(t.children).forEach((e=>this.addChild(this._tree,e))),this._childrenLoaded=!0)):(this._isLazyLoad=!1,this._childrenLoaded=!0)}refresh(e){if(this.isPlaceHolder)return;this.item=Object.assign({},e),this._isLazyLoad="function"==typeof this.item.children||this.item.childrenCount>0;const t=this.children;this.children=new Map,Array.isArray(this.item.children)?(void 0===this.item.expanded&&(this.item.expanded=!0),Array.from(this.item.children).forEach((e=>{const i=t.get(e.id);i?(void 0===e.expanded&&(e.expanded=i.item.expanded),i.refresh(e),this.children.set(e.id,i)):(void 0===e.expanded&&(e.expanded=!0),this.addChild(this._tree,Object.assign({},e)))})),this._childrenLoaded=!0):this._childrenLoaded=!1}isDisabled(){return!this.isPlaceHolder&&this._tree.isNodeDisabled(this.item.id,this.item.disabled)}updateChildren(e){this.isPlaceHolder||this.refresh(Object.assign(Object.assign({},this.item),{children:e}))}addChild(e,t){this.children.has(t.id)||this.children.set(t.id,new v(e,t,this))}addPlaceHolder(){this.children.clear();const e=this.item.id;this.children.set(e,new v(void 0,{id:`placeholder_${e}`,label:"Carregando..."},this,!0))}getNode(e){if(this.children.has(e))return this.children.get(e);const t=Array.from(this.children.values());for(const i of t){const t=i.getNode(e);if(t)return t}}needLoad(){return this._isLazyLoad&&!this._childrenLoaded}isExpandable(){return!!this._isLazyLoad||this.children.size>0}getChildren(){return this.isPlaceHolder?[]:(this.needLoad()&&this._tree.loadChildren(this),Array.from(this.children.values()))}}class m extends v{constructor(e){super(void 0),this._disabledValues=new Map,this._changeCallback=e}async addChildAt(e,t){const i=this.getNode(e);null!=i&&(i.addChild(this,t),this._changeCallback())}setDisabled(e,t){this._disabledValues.set(e,t),this._changeCallback()}isNodeDisabled(e,t){return this._disabledValues.has(e)?this._disabledValues.get(e):t}load(e){if(e===this._currentItems)return;this._currentItems=e;const t=this.children;this.children=new Map,this._disabledValues.clear(),e.forEach((e=>{const i=t.get(e.id);i?(i.refresh(e),this.children.set(e.id,i)):this.addChild(this,Object.assign({},e))}))}setFilterPattern(e){this._filterPattern=n.replaceAccentuatedCharsKeepSymbols(e),this.applyFilter(this),this._changeCallback()}updateItem(e){if(null==e)return;const t=this.getNode(e.id);null!=t&&(Object.keys(e).forEach((i=>t.item[i]=e[i])),null==e.children?t.children.clear():Array.isArray(e.children)&&t.updateChildren(e.children),this._changeCallback())}async open(e){return new Promise((async t=>{await this.walkPath(this,e,(e=>e.item.expanded=!0)),t()}))}applyFilter(e){if(e.children.forEach((e=>{this.applyFilter(e)})),null==e.item)return;let t=!1;if(n.replaceAccentuatedCharsKeepSymbols(e.item.label).includes(this._filterPattern))t=!0;else{const i=Array.from(e.children.values());for(let r=0;r<i.length;r++)if(i[r].visible){t=!0,e.item.expanded=!0;break}}e.visible=t}async walkPath(e,t,i,r=0){return new Promise((async s=>{const o=t.split(">>").map((e=>e.trim()));if(o.length>r){const s=e.getNode(o[r]);s&&(s.needLoad()&&await this.loadLevel(s),i(s),await this.walkPath(s,t,i,r+1))}s()}))}async loadChildren(e){return new Promise((t=>{this.loadLevel(e).then((()=>{t(),this._changeCallback()}))}))}async loadLevel(e){return new Promise((t=>{e.addPlaceHolder(),(0,e.item.children)(e.item).then((i=>{e.updateChildren(i),t()}))}))}}const u=class{constructor(e){t(this,e),this.ezChange=i(this,"ezChange",7),this.ezOpenItem=i(this,"ezOpenItem",7),this._onItemClick=e=>{this.value=e},this._onIconClick=e=>{this.openClose(e),this.value=e},this._tree=new m((()=>r(this))),this._waintingForLoad=void 0,this.items=[],this.value=void 0,this.selectedId=void 0,this.iconResolver=h,this.tooltipResolver=void 0}async selectItem(e){const t=this._tree.getNode(e);this.value=t?t.item:void 0}async openItem(e){this._waintingForLoad=!0,await this._tree.open(e),this._waintingForLoad=!1}async disableItem(e){[].concat(e).forEach((e=>this._tree.setDisabled(e,!0)))}async enableItem(e){[].concat(e).forEach((e=>this._tree.setDisabled(e,!1)))}async addChild(e,t){var i;null==t&&(t=null===(i=this.value)||void 0===i?void 0:i.id),this._tree.addChildAt(t,e);const r=this._tree.getNode(t);r&&(r.item.expanded=!0)}async applyFilter(e){this._tree.setFilterPattern(e)}async updateItem(e){var t;this._tree.updateItem(e),null==(null===(t=this._tree)||void 0===t?void 0:t.getNode(this.selectedId))&&(this.value=this._visibleItems?this._visibleItems[0]:void 0)}async getItem(e){return new Promise((t=>{const i=this._tree.getNode(e);t(null==i?void 0:i.item)}))}async getCurrentPath(){var e,t,i;const r=null===(e=this._tree)||void 0===e?void 0:e.getNode(this.selectedId);if(null==r)return;const s=[];let o,a=null===(t=r.parent)||void 0===t?void 0:t.item;for(s.push(this.getItemPathAttrs(r.item));null!=a;)s.unshift(this.getItemPathAttrs(a)),o=this._tree.getNode(a.id),a=null===(i=null==o?void 0:o.parent)||void 0===i?void 0:i.item;return s}async getParent(e){return new Promise((t=>{var i;const r=this._tree.getNode(e);r&&t(null===(i=r.parent)||void 0===i?void 0:i.item),t(void 0)}))}observeItems(e,t){l.objectToString(e)!==l.objectToString(t)&&this._tree.load(this.items||[])}observeValue(){var e;this.ezChange.emit(this.value),this.selectedId=null===(e=this.value)||void 0===e?void 0:e.id}onKeyDownListener(e){if(!this.value)return;let t=!1;switch(e.key){case"ArrowUp":this.previousItem(),t=!0;break;case"ArrowDown":this.nextItem(),t=!0;break;case"ArrowLeft":this.previousLevel(),t=!0;break;case"ArrowRight":this.nextLevel(),t=!0;break;case" ":this.openClose(this.value),t=!0}t&&(e.stopPropagation(),e.preventDefault())}getItemPathAttrs({id:e,label:t}){return{id:e,label:t}}openClose(e){if(null==e)return;const t=!e.expanded;e.expanded=t,t&&this.ezOpenItem.emit(e),this._tree.updateItem(e)}previousLevel(){var e;if(this.value)if(this.value.expanded)this.value.expanded=!1,this._tree.updateItem(this.value);else{const t=null===(e=this._tree.getNode(this.value.id).parent)||void 0===e?void 0:e.item;t&&(this.value=t)}}nextLevel(){this.value&&this._tree.getNode(this.value.id).isExpandable()&&(this.value.expanded?this.nextItem():(this.value.expanded=!0,this._tree.updateItem(this.value)))}indexOf(e){if(null==e)return-1;for(let t=0;t<this._visibleItems.length;t++)if(this._visibleItems[t].id===e)return t;return-1}selectNextItem(e){var t;const i=this.indexOf(null===(t=this.value)||void 0===t?void 0:t.id)+e;i>-1&&i<this._visibleItems.length&&(this.value=this._visibleItems[i])}nextItem(){this.selectNextItem(1)}previousItem(){this.selectNextItem(-1)}connectedCallback(){this.items&&this._tree.load(this.items)}componentWillRender(){var e;if(!this.selectedId||(null===(e=this.value)||void 0===e?void 0:e.id)===this.selectedId)return;const t=this._tree.getNode(this.selectedId);t&&(this.value=t.item)}render(){if(a.addIDInfoIfNotExists(this._element,"ezTree"),null!=this.items)return this._visibleItems=[],e(s,{tabindex:"-1"},this._waintingForLoad?e("label",null,"Carregando..."):this._tree.getChildren().map((t=>{var i;return e(d,{selectedId:null===(i=this.value)||void 0===i?void 0:i.id,node:t,itemClick:this._onItemClick,iconClick:this._onIconClick,iconResolver:this.iconResolver,tooltipResolver:this.tooltipResolver||c,itemsList:this._visibleItems})})))}get _element(){return o(this)}static get watchers(){return{items:["observeItems"],value:["observeValue"]}}};u.style=":host{--ez-tree--border-radius:var(--border--radius-small, 8px);--ez-tree--padding-inline-start:20px;--ez-tree--margin:var(--space--extra-small, 3px);--ez-tree--margin-right:calc(var(--space--small, 6px) + 2px);--ez-tree--font-family:var(--font-pattern, Arial);--ez-tree--font-size:var(--text--medium, 14px);--ez-tree--selected--font-weight:var(--text-weight--large, 600);--ez-tree--font-weight:var(--text-weight--small, 400);--ez-tree--color:var(--title--primary, #2B3A54);--ez-tree--selected--color:var(--color--primary, #008561);--ez-tree--disabled--color:var(--text--disable, #AFB6C0);--ez-tree--font-weight--bold:var(--text-weight--large, 600);--ez-tree__tree-item--height:var(--size-medium, 18px);--ez-tree__tree-item--padding:var(--space--small, 6px);--ez-tree__tree-item--background-color:var(--background--xlight, #FFFFFF);--ez-tree__tree-item--selected--background-color:var(--color--primary-300, #E2F4EF);--ez-tree__tree-item--hover--background-color:var(--background--medium, #F0F3F7);--ez-tree__tree-item--disabled--background-color:var(--ez-tree__tree-Item--background-color);--ez-tree__item-icon-box--height:var(--ez-tree__tree-item--height);--ez-tree__item-icon-box--width:var(--size-medium, 18px);--ez-tree__item-icon-box--padding:var(--ez-tree__tree-item--padding);--ez-tree__badge--icon-color--default:var(--title--primary, #2B3A54);--ez-tree__badge--icon-color--error:var(--color--error, #da4453);--ez-tree__badge--icon-color--success:var(--color-alert--success-800, #157a00);--ez-tree__badge--icon-color--warning:var(--color--warning, #f2d410);--ez-tree__badge--icon-color--disabled:var(--text--disable, #AFB6C0);display:flex;flex-direction:column;margin:0 var(--ez-tree--margin) var(--ez-tree--margin) var(--ez-tree--margin);outline:none}ul{list-style-type:none;margin:0;padding-inline-start:var(--ez-tree--padding-inline-start)}ul.first-level{padding-inline-start:0}.tree-item-badge{width:16px;height:16px;background:transparent;border-radius:50%;transition:all 300ms ease-in-out;display:flex;align-items:center;justify-content:center}.tree-item-badge-error-icon{--ez-icon--color:white}.tree-item-badge-text{font-family:var(--ez-tree--font-family);font-size:var(--ez-tree--font-size);font-weight:var(--ez-tree--font-weight);color:var(--ez-tree--color)}.tree-item-badge.error{background:var(--color--error)}.tree-item-badge.warning{background:var(--color--warning)}.tree-item-badge.success{background:var(--color--success)}.item-label-container{display:flex;align-items:center}.tree-item{display:flex;align-items:center;margin-top:var(--ez-tree--margin);margin-right:var(--ez-tree--margin-right);border-radius:var(--ez-tree--border-radius);height:var(--ez-tree__tree-item--height);padding:var(--ez-tree__tree-item--padding);justify-content:space-between}.tree-item[selected]{background-color:var(--ez-tree__tree-item--selected--background-color)}.tree-item:hover{background-color:var(--ez-tree__tree-item--hover--background-color)}.tree-item[disabled],.tree-item[disabled]:hover{background-color:var(--ez-tree__tree-item--disabled--background-color)}.item-icon-box{display:flex;align-items:center;justify-content:center;width:var(--ez-tree__item-icon-box--width);height:var(--ez-tree__item-icon-box--height);padding:var(--ez-tree__item-icon-box--padding) var(--ez-tree__item-icon-box--padding) var(--ez-tree__item-icon-box--padding) 0}.item-icon{--ez-icon--color:var(--ez-tree--color)}.item-icon:hover{cursor:pointer}.tree-item[selected] .item-icon{--ez-icon--color:var(--ez-tree--selected--color)}.tree-item[disabled] .item-icon{cursor:unset;--ez-icon--color:var(--ez-tree--disabled--color)}.item-label{cursor:inherit;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;font-family:var(--ez-tree--font-family);font-size:var(--ez-tree--font-size);font-weight:var(--ez-tree--font-weight);color:var(--ez-tree--color)}.item-label--bold{font-weight:var(--ez-tree--font-weight--bold)}.tree-item[selected] .item-label{color:var(--ez-tree--selected--color);font-weight:var(--ez-tree--selected--font-weight)}.tree-item[disabled] .item-label{color:var(--ez-tree--disabled--color)}";export{u as ez_tree}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{h as o,r,c as e,H as n,g as t}from"./p-23a36bb6.js";import{ElementIDUtils as i,ObjectUtils as d}from"@sankhyalabs/core";const l=({item:r,hasIcon:e,hasChildren:n,isLockedLevels:t,onSubActionClick:i})=>o("div",{class:"ez-dropdown__item-wrapper",title:r.label},a(r,e),o("span",{class:"ez-dropdown__item-label"},r.label),s(r,n,t,i)),a=(r,e)=>{if(null!=r&&e)return o("ez-icon",r.iconName?Object.assign({class:"ez-dropdown__icon-left",iconName:r.iconName,size:"medium"},{[i.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:`${r.id}_ezDropdownItemIcon`}):{class:"ez-dropdown__icon-left ez-dropdown__hidden",size:"medium"})},s=(r,e,n,t)=>{var d,l;if(null!=r){if(!(null===(d=r.children)||void 0===d?void 0:d.length)&&null!=r.subAction&&Object.keys(r.subAction).length>0)return o("span",Object.assign({onClick:()=>t(r),title:r.subAction.label,class:`ez-dropdown__link ez-dropdown__link--${r.subAction.type||"primary"}`},{[i.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:`${r.subAction.id}_ezDropdownItemSubAction`}),r.subAction.label);if(!n&&e)return(null===(l=r.children)||void 0===l?void 0:l.length)>0?o("ez-icon",Object.assign({class:"ez-dropdown__icon-right",iconName:"chevron-right",size:"medium"},{[i.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:`${r.id}_ezDropdownIconOpenChildren`})):o("ez-icon",{class:"ez-dropdown__icon-right ez-dropdown__hidden",size:"medium"})}};class p{constructor(){}show(o){const r=null==o?void 0:o.querySelector(".ez-dropdown__submenu");null!=o&&null!=r&&(r.classList.remove("ez-dropdown__submenu--hide"),this.setPosition(o),this.setScrollContainer(o),this.setMaxHeight(r))}hide(o){if(null==o)return;const r=o.querySelector(".ez-dropdown__submenu:not(.ez-dropdown__submenu--hide)");this.reset(r),this.hideChild(r)}hideChild(o){null!=o&&o.querySelectorAll(".ez-dropdown__submenu").forEach((o=>{this.reset(o)}))}setPosition(o){const r=null==o?void 0:o.querySelector(".ez-dropdown__submenu"),e=null==o?void 0:o.closest(".ez-dropdown");if(null==r||null==e)return;r.style.top=this.getPositionTop(o),r.style.left=this.getPositionRight(e);const n=null==r?void 0:r.getBoundingClientRect(),t=document.body.clientWidth;(null==n?void 0:n.right)>t&&this.updatePosition(e,r)}setMaxHeight(o){var r;const e=(null==o?void 0:o.shadowRoot)||o,n=null==e?void 0:e.querySelector(".ez-dropdown"),t=document.body.clientHeight;let i,d;if(null!=(null==e?void 0:e.tagName)?(i=e,d=null==i?void 0:i.getBoundingClientRect()):d=null==n?void 0:n.getBoundingClientRect(),null!=n&&null!=d){if(d.y+d.height>t)if(null!=i){const o=i.closest(".ez-dropdown"),e=null==o?void 0:o.getBoundingClientRect(),l=parseFloat((null===(r=getComputedStyle(i))||void 0===r?void 0:r.marginTop)||"0");if(null==o||null==e)return;e.y+d.height>t?(i.style.top=e.y-l+"px",n.style.maxHeight=t-e.y+"px"):i.style.top=t-d.height-l+"px"}else{let o=t-d.y;o<0&&(o=d.height-t),n.style.maxHeight=o+"px"}this.setSpacerContainer(n)}}setSpacerContainer(o){const r=null==o?void 0:o.querySelector(".ez-dropdown__container");null!=r&&(r.scrollHeight>r.clientHeight?r.classList.add("ez-dropdown__container--spacer"):r.classList.remove("ez-dropdown__container--spacer"))}reset(o){if(null==o)return;o.classList.add("ez-dropdown__submenu--hide"),o.style.left="",o.style.top="";const r=o.querySelector(".ez-dropdown");this.resetDropdown(r)}resetDropdown(o){null!=o&&(o.style.maxHeight="",this.setSpacerContainer(o))}setScrollContainer(o){const r=null==o?void 0:o.closest(".ez-dropdown__container");null!=r&&(r.onscroll=this.onScrollContainer.bind(this))}onScrollContainer(o){this.hideChild(null==o?void 0:o.target)}getPositionTop(o){const r=null==o?void 0:o.getBoundingClientRect();if(null!=r)return r.y+"px"}getPositionRight(o){const r=null==o?void 0:o.getBoundingClientRect();if(null!=r)return r.x+r.width+"px"}getPositionLeft(o,r){const e=null==o?void 0:o.getBoundingClientRect(),n=null==r?void 0:r.getBoundingClientRect();if(null!=e&&null!=n)return e.x-n.width+"px"}updatePosition(o,r){const e=null==o?void 0:o.getBoundingClientRect(),n=null==r?void 0:r.getBoundingClientRect();null!=e&&null!=n&&e.x<n.right&&(r.style.left=this.getPositionLeft(o,r),this.updatePosition(o,r))}}const c=class{constructor(o){r(this,o),this.ezClick=e(this,"ezClick",7),this.ezSubActionClick=e(this,"ezSubActionClick",7),this.ezOutsideClick=e(this,"ezOutsideClick",7),this.ezHover=e(this,"ezHover",7),this._itemList={},this._submenuList=[],this._openedMenuList={},this._levelLimits=3,this.items=[],this.value=void 0,this.itemBuilder=void 0}handleClickOutside(o){this._element.contains(o.target)||this.ezOutsideClick.emit()}defaultItemBuilder(r,e,n,t){return o(l,{item:r,hasIcon:n,hasChildren:t,isLockedLevels:e,onSubActionClick:this.onSubActionClick.bind(this)})}getMaxOrder(o){return null==o||0===o.length?-1:Math.max(...o.map((o=>{var r;const e=null===(r=o.group)||void 0===r?void 0:r.order;return null!=e&&e>=0?e:-1})))}hasIcon(o){return null==o?void 0:o.some((o=>""!==(o.iconName||"")))}hasGroup(o){return null==o?void 0:o.some((o=>""!==(o.group||"")))}hasChildren(o){return null==o?void 0:o.some((o=>(o.children||[]).length>0))}isLockedLevels(o){return!!this._levelLimits&&o===this._levelLimits+1}getItemsByGroup(o,r){let e={};const n=this.getMaxOrder(o);return o.forEach((o=>{const t=o.group&&null!=o.group.label?o.group.label||"noGroup":o.group||"noGroup";let i=e[t];null==i&&(i={items:[],order:o.group&&null!=o.group.order?o.group.order:o.group?n+1:n+2}),this.validateItem(o,r),i.items.push(o),e[t]=i})),d.sortByProperty(e,"order")}validateItem(o,r){if(null==this._itemList&&(this._itemList={}),null==o.type&&(o.type="item"),null==o.id){const e=`level_${r}_${o.type}`,n=Object.keys(this._itemList).filter((o=>o.includes(e))).length;o.id=`${e}_${n+1}`}null==o.label&&(o.label=""),null!=o.subAction&&(null==o.subAction.id&&(o.subAction.id=`subAction_${o.id}`),null==o.subAction.label&&(o.subAction.label="")),null==this._itemList[o.id]&&(this._itemList[o.id]={})}getContainerItemBuilder(r,e,n,t,i){if(null==this.itemBuilder)return;const d=this.itemBuilder(r,e);return null==d?this.defaultItemBuilder(r,n,t,i):"string"!=typeof d?o("div",{class:"ez-dropdown__item-builder"},d):o("div",{class:"ez-dropdown__item-builder",innerHTML:d})}getItemsRender(r,e,n,t){if(null==r)return;let d=e,l=!1;return t&&(d++,l=this.isLockedLevels(d)),r.map((r=>{var a;switch(r.type){case"loading":return o("div",{class:"ez-dropdown__item"},o("ez-skeleton",{width:"200px"}));case"divider":return o("hr",Object.assign({class:"ez-dropdown__divider"},{[i.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:i.getInternalIDInfo(`${r.id}_ezDropdownDivider`)}));case"item":return o("div",Object.assign({ref:o=>this._itemList[r.id]=o,class:"ez-dropdown__item","data-level":e},{[i.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:i.getInternalIDInfo(`${r.id}_ezDropdownItem`)}),o("div",{class:"ez-dropdown__item-content",onClick:o=>this.onItemClick(o,r),onMouseOver:o=>this.onShowSubmenu(o,r),onMouseEnter:()=>this.ezHover.emit(r)},this.itemBuilder?this.getContainerItemBuilder(r,e,l,n,t):this.defaultItemBuilder(r,l,n,t)),(null===(a=r.children)||void 0===a?void 0:a.length)>0&&!l&&t&&o("div",{ref:o=>this._submenuList.push(o),class:"ez-dropdown__submenu ez-dropdown__submenu--hide"},this.renderDropdown(r.children,d)))}}))}renderDropdown(r=this.items,e=1){if(null==r||this.isLockedLevels(e))return;const n=this.getItemsByGroup(r,e),t=this.hasGroup(r),d=this.hasIcon(r),l=this.hasChildren(r);return o("div",{class:"ez-dropdown ez-dropdown__max-height","data-level":e},o("div",{class:"ez-dropdown__container"},Object.keys(n).map((r=>o("div",Object.assign({class:"ez-dropdown__group"},{[i.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:i.getInternalIDInfo(`${r}_ezDropdownGroup`)}),"noGroup"!==r&&o("label",{class:"ez-dropdown__group-label",title:r},r),t&&"noGroup"===r&&o("hr",Object.assign({class:"ez-dropdown__divider"},{[i.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:i.getInternalIDInfo(`${r}_ezDropdownDivider`)})),this.getItemsRender(n[r].items,e,d,l))))))}hasOpenedSubmenu(o){const r=Object.keys(this._openedMenuList);return r.includes(o.toString())||r.some((r=>Number(r)>o))}hasSubmenuOpened(){var o;return null===(o=this._submenuList)||void 0===o?void 0:o.some((o=>!o.classList.contains("ez-dropdown__submenu--hide")))}setEvents(){document.removeEventListener("click",this.onHideAllSubmenu.bind(this)),document.addEventListener("click",this.onHideAllSubmenu.bind(this)),document.removeEventListener("scroll",this.onSubmenuReposition.bind(this)),document.addEventListener("scroll",this.onSubmenuReposition.bind(this))}onShowSubmenu(o,r){var e;if(null==o)return;const n=this._itemList[r.id];if(!(null==n?void 0:n.classList.contains("ez-dropdown__item")))return;const t=Number(n.dataset.level||"0");this.hasOpenedSubmenu(t)&&(this._submenuControl.hide(this._openedMenuList[t]),delete this._openedMenuList[t]),(null===(e=r.children)||void 0===e?void 0:e.length)&&(this._openedMenuList[n.dataset.level]=n,this._submenuControl.show(n))}onItemClick(o,r){const e=null==o?void 0:o.target;(null==e?void 0:e.classList.contains("ez-dropdown__link"))||(this.value=r,this.ezClick.emit(r))}onSubActionClick(o){this.ezSubActionClick.emit(o.subAction)}onHideAllSubmenu(o){const r=null==o?void 0:o.target;this.hasSubmenuOpened()&&(null==r||!r.closest(".ez-dropdown")&&"EZ-DROPDOWN"!==r.tagName)&&(this._openedMenuList={},this._submenuList.forEach(this._submenuControl.reset.bind(this._submenuControl)))}onSubmenuReposition(){null!=this._openedMenuList&&Object.keys(this._openedMenuList).forEach((o=>{this._submenuControl.setPosition(this._openedMenuList[o])}))}componentDidLoad(){i.addIDInfo(this._element),this._submenuControl=new p,this._submenuControl.setMaxHeight(this._element)}componentDidUpdate(){this._submenuControl.setMaxHeight(this._element)}componentDidRender(){this.setEvents()}render(){return o(n,null,this.renderDropdown())}get _element(){return t(this)}};c.style=":host{--ez-dropdown--z-index:var(--more-visible, 2);--ez-dropdown--padding:var(--space--small, 6px);--ez-dropdown--box-shadow:var(--shadow--medium, 0px 8px 24px rgba(0, 38, 111, 0.1));--ez-dropdown--border-radius:var(--border--radius-medium, 12px);--ez-dropdown--background-color:var(--background--xlight, #fff);--ez-dropdown--font-family:var(--font-pattern, 'Roboto');--ez-dropdown--max-height:415px;--ez-dropdown__item--padding:var(--space--small, 6px);--ez-dropdown__item--gap:var(--space--small, 6px);--ez-dropdown__item--border-radius:var(--border--radius-small, 6px);--ez-dropdown__item--color:var(--title--primary, #2b3a54);--ez-dropdown__item--font-weight:var(--text-weight--medium, 400);--ez-dropdown__item--font-size:var(--text--medium, 14px);--ez-dropdown__item--line-height:calc(var(--ez-dropdown__item--font-size) + 4px);--ez-dropdown__item--background-color:var(--background--medium, #f0f3f7);--ez-dropdown__item--transition:var(--transition, .2s linear);--ez-dropdown__item-label--margin-right:var(--space--medium, 12px);--ez-dropdown__icon--size:var(--icon--medium, 18px);--ez-dropdown__divider--background-color:var(--color--disable-secondary, #f2f5f8);--ez-dropdown__divider--margin:var(--space--extra-small, 3px) 0;--ez-dropdown__group-label--color:var(--text--secondary, #A2ABB9);--ez-dropdown__group-label--font-weight:var(--text-weight--large, 600);--ez-dropdown__group-label--font-size:var(--text--small, 12px);--ez-dropdown__group-label--line-height:var(--text--medium, 14px);--ez-dropdown__group-label--padding:var(--space--small, 6px);--ez-dropdown__submenu--z-index:var(--most-visible, 3);--ez-dropdown__link--font-weight:var(--text-weight--large, 600);--ez-dropdown__link--primary--color:var(--color--primary, #008561);--ez-dropdown__link--critical--color:var(--color-alert--error-800, #BD0025);--ez-dropdown__scrollbar--color-default:var(--scrollbar--default, #626e82);--ez-dropdown__scrollbar--color-background:var(--scrollbar--background, #E5EAF0);--ez-dropdown__scrollbar--color-hover:var(--scrollbar--hover, #2B3A54);--ez-dropdown__scrollbar--color-clicked:var(--scrollbar--clicked, #a2abb9);--ez-dropdown__scrollbar--border-radius:var(--border--radius-small, 6px);--ez-dropdown__scrollbar--width:var(--space--small, 6px);--ez-dropdown__scrollbar--padding-right:var(--space--extra-small, 3px);display:flex;flex-direction:column;height:fit-content;user-select:none;box-sizing:border-box;position:fixed;z-index:var(--ez-dropdown--z-index)}:host *{box-sizing:border-box}.ez-dropdown{display:flex;padding:var(--ez-dropdown--padding);box-shadow:var(--ez-dropdown--box-shadow);border-radius:var(--ez-dropdown--border-radius);background-color:var(--ez-dropdown--background-color);max-width:var(--ez-dropdown--max-width)}.ez-dropdown__max-height{max-height:var(--ez-dropdown--max-height)}.ez-dropdown *{font-family:var(--ez-dropdown--font-family)}.ez-dropdown__container{display:flex;flex-direction:column;overflow-y:auto;scrollbar-width:thin;flex:auto;scrollbar-color:var(--ez-dropdown__scrollbar--color-clicked) var(--ez-dropdown__scrollbar--color-background)}.ez-dropdown__container::-webkit-scrollbar{background-color:var(--ez-dropdown__scrollbar--color-background);width:var(--ez-dropdown__scrollbar--width);max-width:var(--ez-dropdown__scrollbar--width);min-width:var(--ez-dropdown__scrollbar--width)}.ez-dropdown__container::-webkit-scrollbar-track{background-color:var(--ez-dropdown__scrollbar--color-background);border-radius:var(--ez-dropdown__scrollbar--border-radius)}.ez-dropdown__container::-webkit-scrollbar-thumb{background-color:var(--ez-dropdown__scrollbar--color-default);border-radius:var(--ez-dropdown__scrollbar--border-radius)}.ez-dropdown__container::-webkit-scrollbar-thumb:vertical:hover,.ez-dropdown__container::-webkit-scrollbar-thumb:horizontal:hover{background-color:var(--ez-dropdown__scrollbar--color-hover)}.ez-dropdown__container::-webkit-scrollbar-thumb:vertical:active,.ez-dropdown__container::-webkit-scrollbar-thumb:horizontal:active{background-color:var(--ez-dropdown__scrollbar--color-clicked)}.ez-dropdown__container--spacer{padding-right:var(--ez-dropdown__scrollbar--padding-right)}.ez-dropdown__item{display:flex;align-items:center;background-color:transparent;border-radius:var(--ez-dropdown__item--border-radius);transition:var(--ez-dropdown__item--transition)}.ez-dropdown__item:hover{background-color:var(--ez-dropdown__item--background-color)}.ez-dropdown__item-wrapper{display:flex;align-items:center;position:relative;cursor:pointer;width:100%;margin:0;white-space:nowrap;gap:var(--ez-dropdown__item--gap);color:var(--ez-dropdown__item--color);font-weight:var(--ez-dropdown__item--font-weight);font-size:var(--ez-dropdown__item--font-size);line-height:var(--ez-dropdown__item--line-height);padding:var(--ez-dropdown__item--padding)}.ez-dropdown__item-wrapper ez-icon{display:flex;justify-content:center;align-items:center;width:var(--ez-dropdown__icon--size);height:var(--ez-dropdown__icon--size);min-width:var(--ez-dropdown__icon--size);min-height:var(--ez-dropdown__icon--size)}.ez-dropdown__item-content{display:flex;align-items:center;flex:auto;overflow:hidden;gap:var(--ez-dropdown__item--gap)}.ez-dropdown__item-label{text-align:left;text-overflow:ellipsis;overflow:hidden;flex:auto}.ez-dropdown__item-label:not(:last-child){margin-right:var(--ez-dropdown__item-label--margin-right)}.ez-dropdown__item-content+.ez-dropdown__link{margin-left:var(--ez-dropdown__item-label--margin-right);margin-right:var(--ez-dropdown__item--padding)}.ez-dropdown__item-builder{flex:auto}.ez-dropdown__divider{width:100%;height:2px;border-radius:1px;border:none;display:block;background-color:var(--ez-dropdown__divider--background-color);margin:var(--ez-dropdown__divider--margin)}.ez-dropdown__hidden{visibility:hidden}.ez-dropdown__group{display:flex;flex-direction:column}.ez-dropdown__group-label{display:block;width:100%;text-align:left;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--ez-dropdown__group-label--color);font-weight:var(--ez-dropdown__group-label--font-weight);font-size:var(--ez-dropdown__group-label--font-size);line-height:var(--ez-dropdown__group-label--line-height);padding:var(--ez-dropdown__group-label--padding)}.ez-dropdown__icon-right{margin-left:auto}.ez-dropdown__submenu{position:fixed;z-index:var(--ez-dropdown__submenu--z-index);margin-top:calc(var(--ez-dropdown__item--padding) * -1)}.ez-dropdown__submenu--hide{display:none}.ez-dropdown__link{display:block;margin-left:auto;cursor:pointer;text-overflow:ellipsis;overflow:hidden;font-weight:var(--ez-dropdown__link--font-weight);max-width:calc(var(--ez-dropdown--max-width) * 0.43)}.ez-dropdown__link--primary{color:var(--ez-dropdown__link--primary--color)}.ez-dropdown__link--critical{color:var(--ez-dropdown__link--critical--color)}.ez-dropdown__link:hover{text-decoration:underline}";const u=["progress","progress-dark","pulse","false"],_=class{constructor(o){r(this,o),this.items=[],this.count=1,this.variant="text",this.width=null,this.height=null,this.marginBottom=null,this.animation="progress"}componentWillLoad(){this.init()}componentWillUpdate(){this.init()}init(){this.items.length=this.count,this.items.fill(1),u.includes(this.animation)||(this.animation="progress")}get style(){let o={width:null,height:null,marginBottom:null};return this.width&&(o.width=this.width),this.height&&(o.height=this.height),this.marginBottom&&(o.marginBottom=this.marginBottom),o}render(){return this.items.map(((r,e)=>o("span",{key:e,class:{circle:"circle"===this.variant,rect:"rect"===this.variant,progress:"progress"===this.animation,"progress-dark":"progress-dark"===this.animation,pulse:"pulse"===this.animation,skeleton:!0},"data-busy":"true","data-valuemin":"0","data-valuemax":"100","data-valuetext":"Loading...",role:"progressbar",tabindex:"0",style:this.style})))}};_.style=".skeleton {\n\tbox-sizing: border-box;\n\toutline: none;\n\toverflow: hidden;\n\tposition: relative;\n\n\tbackground:var(--skeleton-background, #eff1f6) no-repeat;\n\n\tborder-radius: var(--skeleton-border-radius, 4px);\n\twidth: var(--skeleton-width, 100%);\n\theight: var(--skeleton-height, 20px);\n\tdisplay: inline-block;\n\tmargin-bottom: var(--skeleton-margin-bottom, 0px);\n\twill-change: transform;\n\n\t&:after,\n\t&:before {\n\t\tbox-sizing: border-box;\n\t}\n\n\t&.circle {\n\t\twidth: var(--skeleton-width, 40px);\n\t\theight: var(--skeleton-height, 40px);\n\t\tmargin-bottom: var(--skeleton-margin-bottom, 5px);\n\t\tborder-radius: var(--skeleton-border-radius, 50%);\n\t}\n\n\t&.rect {\n\t\tborder-radius: var(--skeleton-border-radius, 0px);\n\t}\n\n\t&.progress,\n\t&.progress-dark {\n\t\tanimation: progress 2s cubic-bezier(0.4, 0, 0.2, 1) infinite;\n\t\tbackground-size: 200px 100%;\n\t}\n\n\t&.progress {\n\t\tbackground-image: linear-gradient(\n\t\t\t90deg,\n\t\t\trgba(255, 255, 255, 0),\n\t\t\trgba(255, 255, 255, 0.6),\n\t\t\trgba(255, 255, 255, 0)\n\t\t);\n\t}\n\n\t&.progress-dark {\n\t\tbackground-image: linear-gradient(\n\t\t\t90deg,\n\t\t\ttransparent,\n\t\t\trgba(0, 0, 0, 0.2),\n\t\t\ttransparent\n\t\t);\n\t}\n\n\t&.pulse {\n\t\tanimation: pulse 1.5s cubic-bezier(0.4, 0, 0.2, 1) infinite;\n\t\tanimation-delay: 0.5s;\n\t}\n\n\t@media (prefers-reduced-motion: reduce) {\n\t\t&.pulse,\n\t\t&.progress-dark,\n\t\t&.progress {\n\t\t\tanimation: none;\n\t\t}\n\n\t\t&.progress,\n\t\t&.progress-dark {\n\t\t\tbackground-image: none;\n\t\t}\n\t}\n}\n\n@keyframes progress {\n\t0% {\n\t\tbackground-position: -200px 0;\n\t}\n\t100% {\n\t\tbackground-position: calc(200px + 100%) 0;\n\t}\n}\n\n@keyframes pulse {\n\t0% {\n\t\topacity: 1;\n\t}\n\t50% {\n\t\topacity: 0.4;\n\t}\n\t100% {\n\t\topacity: 1;\n\t}\n}";export{c as ez_dropdown,_ as ez_skeleton}
|