@sankhyalabs/sankhyablocks 2.4.6 → 2.4.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/dist/cjs/snk-configurator_3.cjs.entry.js +1 -1
  2. package/dist/cjs/snk-filter-bar_7.cjs.entry.js +1 -1
  3. package/dist/cjs/snk-filter-binary-select.cjs.entry.js +1 -1
  4. package/dist/cjs/snk-filter-multi-select.cjs.entry.js +1 -1
  5. package/dist/cjs/snk-filter-number.cjs.entry.js +1 -1
  6. package/dist/cjs/snk-filter-period.cjs.entry.js +1 -1
  7. package/dist/cjs/snk-filter-search.cjs.entry.js +1 -1
  8. package/dist/cjs/snk-filter-text.cjs.entry.js +1 -1
  9. package/dist/cjs/snk-pesquisa.cjs.entry.js +1 -1
  10. package/dist/collection/components/snk-configurator/snk-configurator.css +30 -15
  11. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-binary-select.js +1 -1
  12. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-multi-select.js +1 -1
  13. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-number.js +1 -1
  14. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-period.js +1 -1
  15. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-search.js +1 -1
  16. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-text.js +1 -1
  17. package/dist/collection/components/snk-grid/subcomponents/snk-grid-config/snk-grid-config.css +35 -20
  18. package/dist/collection/components/snk-pesquisa/snk-pesquisa.css +36 -22
  19. package/dist/components/snk-configurator2.js +1 -1
  20. package/dist/components/snk-filter-binary-select.js +1 -1
  21. package/dist/components/snk-filter-multi-select.js +1 -1
  22. package/dist/components/snk-filter-number.js +1 -1
  23. package/dist/components/snk-filter-period.js +1 -1
  24. package/dist/components/snk-filter-search.js +1 -1
  25. package/dist/components/snk-filter-text.js +1 -1
  26. package/dist/components/snk-grid-config2.js +1 -1
  27. package/dist/components/snk-pesquisa2.js +1 -1
  28. package/dist/esm/snk-configurator_3.entry.js +1 -1
  29. package/dist/esm/snk-filter-bar_7.entry.js +1 -1
  30. package/dist/esm/snk-filter-binary-select.entry.js +1 -1
  31. package/dist/esm/snk-filter-multi-select.entry.js +1 -1
  32. package/dist/esm/snk-filter-number.entry.js +1 -1
  33. package/dist/esm/snk-filter-period.entry.js +1 -1
  34. package/dist/esm/snk-filter-search.entry.js +1 -1
  35. package/dist/esm/snk-filter-text.entry.js +1 -1
  36. package/dist/esm/snk-pesquisa.entry.js +1 -1
  37. package/dist/sankhyablocks/p-03f0a380.entry.js +1 -0
  38. package/dist/sankhyablocks/p-14af45cc.entry.js +1 -0
  39. package/dist/sankhyablocks/p-9593c937.entry.js +1 -0
  40. package/dist/sankhyablocks/p-b0a0222f.entry.js +1 -0
  41. package/dist/sankhyablocks/{p-da0a0b8c.entry.js → p-c17be74f.entry.js} +1 -1
  42. package/dist/sankhyablocks/{p-b5799889.entry.js → p-db111acd.entry.js} +1 -1
  43. package/dist/sankhyablocks/p-eff899b0.entry.js +1 -0
  44. package/dist/sankhyablocks/{p-1bc8f32f.entry.js → p-f1de5d1f.entry.js} +1 -1
  45. package/dist/sankhyablocks/{p-5fc34bc1.entry.js → p-fd3b562d.entry.js} +1 -1
  46. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  47. package/package.json +1 -1
  48. package/dist/sankhyablocks/p-4f9aa0b0.entry.js +0 -1
  49. package/dist/sankhyablocks/p-60038252.entry.js +0 -1
  50. package/dist/sankhyablocks/p-63229ecb.entry.js +0 -1
  51. package/dist/sankhyablocks/p-8fca7910.entry.js +0 -1
  52. package/dist/sankhyablocks/p-b05638d2.entry.js +0 -1
@@ -1 +0,0 @@
1
- import{r as s,h as e,H as t,g as i}from"./p-9ba3df4c.js";import{ObjectUtils as r,StringUtils as n,ElementIDUtils as a}from"@sankhyalabs/core";const o=class{constructor(e){s(this,e),this._mdByName={},this._startHighlightTag="<span class='card-item__highlight'>",this._endHighlightTag="</span>",this._specialCharsRegex=/[[.\-\$\+\*,_\&\(\)%\/\\#@!:\|\=\'\"]/gim,this._charsWithAccentuation="ÁÉÍÓÚ_ÃÕ_ÂÊÎÔÛ_ÀÈÌÒÙ_Ü_Ç_áéíóú_ãõ_âêîôû_àèìòù_ü_ç",this._charsWithoutAccentuation="AEIOU_AO_AEIOU_AEIOU_U_C_aeiou_ao_aeiou_aeiou_u_c",this._changeDeboucingTimeout=null,this._limitCharsToSearch=3,this._deboucingTime=450,this._startLoading=!1}observeArgument(){this._textInput&&(this._textInput.value=this.argument)}clearSearch(){this.argument="",this._itemList=void 0}buildDetails(s,e){let t={};for(let i=0;i<s.length;i++){const r=s[i],n=e[r.fieldName];t[r.description]=this.highlightValue(e.__matchFields,r.options&&r.options[n]||n,s,!0)}return t}buildFirstFields(s,e,t=6){return s&&Array.isArray(s)&&s.forEach((s=>{let t=this.removeReference(e,this._mdByName[s]);t&&e.unshift(t)})),e=e.slice(0,t)}doSearch(s){this.searchLoader&&"function"==typeof this.searchLoader&&(this._startLoading=!0,this.searchLoader(s).then((s=>{if(this._startLoading=!1,s){let e=(s=r.stringToObject(s.json.$)).descriptionField,t=s.pkField;if(t){let i=[];s.data.forEach((r=>{var n;let a=this.filterFieldsMetadata(s,r),o=this.buildFirstFields(r.__matchFields,a),l={key:this.highlightValue(r.__matchFields,null===(n=r[t])||void 0===n?void 0:n.toString(),o,!0),title:e?this.highlightValue(r.__matchFields,r[e],o,!0):"",details:this.buildDetails(o,r)};i.push(l)})),this._itemList=i}}})).catch((s=>{this._startLoading=!1,this._itemList=[],console.warn(s)})))}filterFieldsMetadata(s,e){return s.fieldsMetadata.filter((t=>{let i=!n.isEmpty(e[t.fieldName])&&!1!==t.visible&&"B"!==t.type&&s.pkField!==t.fieldName&&s.descriptionField!==t.fieldName&&(t.isPrimaryKey||!t.isLinkField)&&!("S"===t.type&&"H"===t.presentationType);return i&&(this._mdByName[t.fieldName]=t),("string"!=typeof e[t.fieldName]||!(e[t.fieldName].indexOf("<img")>-1||e[t.fieldName].indexOf("<svg")>-1))&&i}))}removeAtIndex(s,e){if(e>=0&&e<s.length)return s.splice(e,1)[0]}removeReference(s,e){let t=this.indexOf(s,e);return this.removeAtIndex(s,t)}indexOf(s,e){let t=-1;return Array.isArray(s)&&this.find(s,((s,i)=>(t=i,this.equals(e,s)))),t}equals(s,e){return r.objectToString(s)===r.objectToString(e)}find(s,e){if(s)for(let t=0,i=s.length;t<i;t++)if(e(s[t],t,s))return s[t]}highlightValue(s,e,t,i){let r=this.replaceHtmlEntities(e);if(this.argument&&(i||this.isIn(s,t.fieldName))){const s=this.getArgumentNumber();let e=(isNaN(s)?this.argument:s.toString()).split(/%|,|\s+/),i=0,n=this.replaceAccentuatedChars(r);e.forEach((s=>{if(s){s=this.replaceAccentuatedChars(s);let e=this.getSpecialCharacters(s);null!=e&&e.length>0&&(s=this.removeSpecialCharacters(s)),(t.mask||"CGC_CPF"===t.uiType||"Phone"===t.uiType)&&(s=s.split("").join("\\.?\\-?\\/?\\(?\\)?"));let a=new RegExp(s,"ig");a.lastIndex=i;let o=a.exec(n);if(o&&o.length>0){i=o.index;let s=o[0].length,e=r.substring(i,i+s),t=(null==e?void 0:e.trim())?this._startHighlightTag+e+this._endHighlightTag:"",a=r.substring(0,i),l=r.substring(i+s);r=a+t+l,i+=t.length,n=this.replaceAccentuatedChars(r)}}}))}return r}replaceHtmlEntities(s){return null==s?s:String(s).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}replaceAccentuatedChars(s){return null==s?s:this.replaceToSpace(s,["&amp;","&lt;","&gt;","&quot;"]).replace(/[^\w ]/g,(s=>{let e=this._charsWithAccentuation.indexOf(s);return e>-1&&(s=this._charsWithoutAccentuation.charAt(e)),s||""}))}replaceToSpace(s,e=[]){return null==s||e.forEach((e=>{const t=new RegExp(e,"g");let i="";for(let s=0;s<e.length;s++)i+=" ";s=String(s).replace(t,i)})),s}isIn(s,e){return this.indexOf(s,e)>-1}getSpecialCharacters(s){let e,t=[];for(;e=this._specialCharsRegex.exec(s);)t.push(s[e.index]);return t}removeSpecialCharacters(s){return this.getSpecialCharacters(s).forEach((e=>{s=this.replaceAll(s,e,"")})),s}replaceAll(s,e,t){let i=(null!=s?s:"").indexOf(e);for(;i>-1;)i=(s=s.replace(e,t)).indexOf(e);return s}getArgumentNumber(){return Number(this.argument||void 0)}createOption(s){let{key:e,title:t}=s;const i=new RegExp(this._startHighlightTag,"g"),r=new RegExp(this._endHighlightTag,"g");t=n.decodeHtmlEntities(t);const a={value:null==e?void 0:e.replace(i,"").replace(r,""),label:null==t?void 0:t.replace(i,"").replace(r,"")};this.selectItem(a)}onChangeValue(s){if(this.clearDeboucingTimeout(),this._startLoading)return void(this._changeDeboucingTimeout=setTimeout((()=>{this.onChangeValue(s)}),this._deboucingTime));this.argument=(s.detail||"").trim();const e=this.getArgumentNumber();this.argument&&(!isNaN(e)||this.argument.length>=this._limitCharsToSearch)?this._changeDeboucingTimeout=setTimeout((()=>{this.doSearch(isNaN(e)?this.argument:e.toString())}),this._deboucingTime):this._itemList=void 0}clearDeboucingTimeout(){this._changeDeboucingTimeout&&(clearTimeout(this._changeDeboucingTimeout),this._changeDeboucingTimeout=void 0)}onClickSearch(){this.doSearch((this.argument||"").trim())}getMessageView(){return this._startLoading?"Aguarde, buscando registros...":this._itemList?this._itemList.length>=1?`${this._itemList.length} ${this._itemList.length>1?"registros encontrados":"registro encontrado"}`:"Nenhum registro encontrado":"Os resultados de sua pesquisa aparecerão aqui..."}componentDidLoad(){a.addIDInfo(this._element)}render(){var s;return e(t,null,e("div",{class:"snk-pesquisa"},e("div",{class:"snk-pesquisa__input"},e("ez-text-input",{label:"Buscar",class:"ez-margin-right--medium",canShowError:!1,ref:s=>this._textInput=s,onEzChange:s=>this.onChangeValue(s),value:this.argument,"data-element-id":"searchInput"},e("ez-icon",{slot:"leftIcon",iconName:"search"}),this.argument&&(null===(s=this._textInput)||void 0===s?void 0:s.value)?e("button",{slot:"rightIcon",class:"snk-pesquisa__btn",onClick:()=>this.clearSearch()},e("ez-icon",{iconName:"close"})):void 0),e("ez-button",{class:"ez-button--primary",label:"Pesquisar",onClick:()=>this.onClickSearch()})),e("label",{class:"snk-pesquisa__records"},this.getMessageView()),e("div",{class:"snk-pesquisa__content"},this._itemList&&this._itemList.map((s=>e("ez-card-item",{onEzClick:s=>this.createOption(s.detail),item:s}))))))}get _element(){return i(this)}static get watchers(){return{argument:["observeArgument"]}}};o.style=".sc-snk-pesquisa-h{--snk-pesquisa--font-size:var(--text--medium, 14px);--snk-pesquisa--font-family:var(--font-pattern, Arial);--snk-pesquisa--font-weight:var(--text-weight--medium, 400);--snk-pesquisa__records--color:var(--text--primary, #626e82);--snk-pesquisa__records--padding-vertical:var(--space--medium, 12px);--snk-pesquisa__content--padding-right:var(--space--small, 6px);--snk-pesquisa__content-scrollbar--background-color-primary:var(--scrollbar--primary, #2B3A54);--snk-pesquisa__content-scrollbar--background-color-secondary:var(--scrollbar--secondary, #E5EAF0);--snk-pesquisa__content-scrollbar--border-radius:var(--border--radius-small, 6px);--snk-pesquisa__content-scrollbar--width:var(--space--medium, 12px);--snk-pesquisa__btn--color:var(--title--primary, #2B3A54);--snk-pesquisa__btn-disabled--color:var(--text--disable, #AFB6C0);--snk-pesquisa__btn-hover--color:var(--color--primary, #4e4e4e);max-height:100%;height:100%;display:flex;flex-direction:column;overflow-y:auto}.snk-pesquisa.sc-snk-pesquisa{display:flex;flex-direction:column;height:100%}.snk-pesquisa__input.sc-snk-pesquisa{display:flex;width:100%;box-sizing:border-box;padding-top:4px;padding-right:4px}.snk-pesquisa__input.sc-snk-pesquisa ez-icon.sc-snk-pesquisa{--ez-icon--color:inherit;font-weight:var(--text-weight--large, 600)}.snk-pesquisa__content.sc-snk-pesquisa{display:flex;flex-direction:column;height:100%;overflow-y:auto;scrollbar-width:thin;scrollbar-color:var(--snk-pesquisa__content-scrollbar--background-color-primary) var(--snk-pesquisa__content-scrollbar--background-color-secondary);padding-right:var(--snk-pesquisa__content--padding-right)}.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar-track{background-color:var(--snk-pesquisa__content-scrollbar--background-color-secondary);border-radius:var(--snk-pesquisa__content-scrollbar--border-radius)}.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar-thumb{background-color:var(--snk-pesquisa__content-scrollbar--background-color-primary);border-radius:var(--snk-pesquisa__content-scrollbar--border-radius)}.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar{background-color:var(--snk-pesquisa__content-scrollbar--background-color-secondary);width:var(--snk-pesquisa__content-scrollbar--width);max-width:var(--snk-pesquisa__content-scrollbar--width);min-width:var(--snk-pesquisa__content-scrollbar--width)}.snk-pesquisa__records.sc-snk-pesquisa{font-family:var(--snk-pesquisa--font-family);font-weight:var(--snk-pesquisa--font-weight);font-size:var(--snk-pesquisa--font-size);color:var(--snk-pesquisa__records--color);padding-bottom:var(--snk-pesquisa__records--padding-vertical);padding-top:var(--snk-pesquisa__records--padding-vertical)}.snk-pesquisa__btn.sc-snk-pesquisa{outline:none;border:none;background:none;cursor:pointer;color:var(--snk-pesquisa__btn--color)}.snk-pesquisa__btn.sc-snk-pesquisa:disabled{cursor:unset;color:var(--snk-pesquisa__btn-disabled--color)}.snk-pesquisa__btn.sc-snk-pesquisa:disabled:hover{cursor:unset;color:var(--snk-pesquisa__btn-disabled--color)}.snk-pesquisa__btn.sc-snk-pesquisa:hover{color:var(--snk-pesquisa__btn-hover--color)}";export{o as snk_pesquisa}