@sankhyalabs/sankhyablocks 2.4.2 → 2.4.4
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/README.md +1 -0
- package/dist/cjs/snk-pesquisa.cjs.entry.js +2 -1
- package/dist/collection/components/snk-application/snk-application.js +1 -1
- package/dist/collection/components/snk-data-unit/snk-data-unit.css +0 -1
- package/dist/collection/components/snk-pesquisa/snk-pesquisa.js +2 -1
- package/dist/components/snk-pesquisa2.js +2 -1
- package/dist/esm/snk-pesquisa.entry.js +2 -1
- package/dist/sankhyablocks/p-67c1700b.entry.js +1 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-application/snk-application.d.ts +1 -1
- package/dist/types/components.d.ts +1 -1
- package/package.json +2 -2
- package/dist/sankhyablocks/p-b4e199d9.entry.js +0 -1
package/README.md
CHANGED
|
@@ -250,9 +250,10 @@ const SnkPesquisa = class {
|
|
|
250
250
|
return Number(this.argument || undefined);
|
|
251
251
|
}
|
|
252
252
|
createOption(detail) {
|
|
253
|
-
|
|
253
|
+
let { key, title } = detail;
|
|
254
254
|
const startHighlight = new RegExp(this._startHighlightTag, 'g');
|
|
255
255
|
const endHighlight = new RegExp(this._endHighlightTag, 'g');
|
|
256
|
+
title = core.StringUtils.decodeHtmlEntities(title);
|
|
256
257
|
const option = {
|
|
257
258
|
value: key === null || key === void 0 ? void 0 : key.replace(startHighlight, '').replace(endHighlight, ''),
|
|
258
259
|
label: title === null || title === void 0 ? void 0 : title.replace(startHighlight, '').replace(endHighlight, '')
|
|
@@ -872,7 +872,7 @@ export class SnkApplication {
|
|
|
872
872
|
},
|
|
873
873
|
"showPopUp": {
|
|
874
874
|
"complexType": {
|
|
875
|
-
"signature": "(content: HTMLElement, size?:
|
|
875
|
+
"signature": "(content: HTMLElement, size?: \"auto\" | \"full\", useHeader?: boolean) => Promise<void>",
|
|
876
876
|
"parameters": [{
|
|
877
877
|
"tags": [],
|
|
878
878
|
"text": ""
|
|
@@ -242,9 +242,10 @@ export class SnkPesquisa {
|
|
|
242
242
|
return Number(this.argument || undefined);
|
|
243
243
|
}
|
|
244
244
|
createOption(detail) {
|
|
245
|
-
|
|
245
|
+
let { key, title } = detail;
|
|
246
246
|
const startHighlight = new RegExp(this._startHighlightTag, 'g');
|
|
247
247
|
const endHighlight = new RegExp(this._endHighlightTag, 'g');
|
|
248
|
+
title = StringUtils.decodeHtmlEntities(title);
|
|
248
249
|
const option = {
|
|
249
250
|
value: key === null || key === void 0 ? void 0 : key.replace(startHighlight, '').replace(endHighlight, ''),
|
|
250
251
|
label: title === null || title === void 0 ? void 0 : title.replace(startHighlight, '').replace(endHighlight, '')
|
|
@@ -247,9 +247,10 @@ const SnkPesquisa = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
247
247
|
return Number(this.argument || undefined);
|
|
248
248
|
}
|
|
249
249
|
createOption(detail) {
|
|
250
|
-
|
|
250
|
+
let { key, title } = detail;
|
|
251
251
|
const startHighlight = new RegExp(this._startHighlightTag, 'g');
|
|
252
252
|
const endHighlight = new RegExp(this._endHighlightTag, 'g');
|
|
253
|
+
title = StringUtils.decodeHtmlEntities(title);
|
|
253
254
|
const option = {
|
|
254
255
|
value: key === null || key === void 0 ? void 0 : key.replace(startHighlight, '').replace(endHighlight, ''),
|
|
255
256
|
label: title === null || title === void 0 ? void 0 : title.replace(startHighlight, '').replace(endHighlight, '')
|
|
@@ -246,9 +246,10 @@ const SnkPesquisa = class {
|
|
|
246
246
|
return Number(this.argument || undefined);
|
|
247
247
|
}
|
|
248
248
|
createOption(detail) {
|
|
249
|
-
|
|
249
|
+
let { key, title } = detail;
|
|
250
250
|
const startHighlight = new RegExp(this._startHighlightTag, 'g');
|
|
251
251
|
const endHighlight = new RegExp(this._endHighlightTag, 'g');
|
|
252
|
+
title = StringUtils.decodeHtmlEntities(title);
|
|
252
253
|
const option = {
|
|
253
254
|
value: key === null || key === void 0 ? void 0 : key.replace(startHighlight, '').replace(endHighlight, ''),
|
|
254
255
|
label: title === null || title === void 0 ? void 0 : title.replace(startHighlight, '').replace(endHighlight, '')
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as s,h as t,H as e,g as i}from"./p-9ba3df4c.js";import{ObjectUtils as r,StringUtils as n,ElementIDUtils as a}from"@sankhyalabs/core";const o=class{constructor(t){s(this,t),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,t){let e={};for(let i=0;i<s.length;i++){const r=s[i],n=t[r.fieldName];e[r.description]=this.highlightValue(t.__matchFields,r.options&&r.options[n]||n,s,!0)}return e}buildFirstFields(s,t,e=6){return s&&Array.isArray(s)&&s.forEach((s=>{let e=this.removeReference(t,this._mdByName[s]);e&&t.unshift(e)})),t=t.slice(0,e)}doSearch(s){this.searchLoader&&"function"==typeof this.searchLoader&&(this._startLoading=!0,this.searchLoader(s).then((s=>{if(this._startLoading=!1,s){let t=(s=r.stringToObject(s.json.$)).descriptionField,e=s.pkField;if(e){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[e])||void 0===n?void 0:n.toString(),o,!0),title:t?this.highlightValue(r.__matchFields,r[t],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,t){return s.fieldsMetadata.filter((e=>{let i=!n.isEmpty(t[e.fieldName])&&!1!==e.visible&&"B"!==e.type&&s.pkField!==e.fieldName&&s.descriptionField!==e.fieldName&&(e.isPrimaryKey||!e.isLinkField)&&!("S"===e.type&&"H"===e.presentationType);return i&&(this._mdByName[e.fieldName]=e),("string"!=typeof t[e.fieldName]||!(t[e.fieldName].indexOf("<img")>-1||t[e.fieldName].indexOf("<svg")>-1))&&i}))}removeAtIndex(s,t){if(t>=0&&t<s.length)return s.splice(t,1)[0]}removeReference(s,t){let e=this.indexOf(s,t);return this.removeAtIndex(s,e)}indexOf(s,t){let e=-1;return Array.isArray(s)&&this.find(s,((s,i)=>(e=i,this.equals(t,s)))),e}equals(s,t){return r.objectToString(s)===r.objectToString(t)}find(s,t){if(s)for(let e=0,i=s.length;e<i;e++)if(t(s[e],e,s))return s[e]}highlightValue(s,t,e,i){let r=this.replaceHtmlEntities(t);if(this.argument&&(i||this.isIn(s,e.fieldName))){const s=this.getArgumentNumber();let t=(isNaN(s)?this.argument:s.toString()).split(/%|,|\s+/),i=0,n=this.replaceAccentuatedChars(r);t.forEach((s=>{if(s){s=this.replaceAccentuatedChars(s);let t=this.getSpecialCharacters(s);null!=t&&t.length>0&&(s=this.removeSpecialCharacters(s)),(e.mask||"CGC_CPF"===e.uiType||"Phone"===e.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,t=r.substring(i,i+s),e=(null==t?void 0:t.trim())?this._startHighlightTag+t+this._endHighlightTag:"",a=r.substring(0,i),l=r.substring(i+s);r=a+e+l,i+=e.length,n=this.replaceAccentuatedChars(r)}}}))}return r}replaceHtmlEntities(s){return null==s?s:String(s).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}replaceAccentuatedChars(s){return null==s?s:this.replaceToSpace(s,["&","<",">","""]).replace(/[^\w ]/g,(s=>{let t=this._charsWithAccentuation.indexOf(s);return t>-1&&(s=this._charsWithoutAccentuation.charAt(t)),s||""}))}replaceToSpace(s,t=[]){return null==s||t.forEach((t=>{const e=new RegExp(t,"g");let i="";for(let s=0;s<t.length;s++)i+=" ";s=String(s).replace(e,i)})),s}isIn(s,t){return this.indexOf(s,t)>-1}getSpecialCharacters(s){let t,e=[];for(;t=this._specialCharsRegex.exec(s);)e.push(s[t.index]);return e}removeSpecialCharacters(s){return this.getSpecialCharacters(s).forEach((t=>{s=this.replaceAll(s,t,"")})),s}replaceAll(s,t,e){let i=(null!=s?s:"").indexOf(t);for(;i>-1;)i=(s=s.replace(t,e)).indexOf(t);return s}getArgumentNumber(){return Number(this.argument||void 0)}createOption(s){let{key:t,title:e}=s;const i=new RegExp(this._startHighlightTag,"g"),r=new RegExp(this._endHighlightTag,"g");e=n.decodeHtmlEntities(e);const a={value:null==t?void 0:t.replace(i,"").replace(r,""),label:null==e?void 0:e.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 t=this.getArgumentNumber();this.argument&&(!isNaN(t)||this.argument.length>=this._limitCharsToSearch)?this._changeDeboucingTimeout=setTimeout((()=>{this.doSearch(isNaN(t)?this.argument:t.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 t(e,null,t("div",{class:"snk-pesquisa"},t("div",{class:"snk-pesquisa__input"},t("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},t("ez-icon",{slot:"leftIcon",iconName:"search"}),this.argument&&(null===(s=this._textInput)||void 0===s?void 0:s.value)?t("button",{slot:"rightIcon",class:"snk-pesquisa__btn",onClick:()=>this.clearSearch()},t("ez-icon",{iconName:"close"})):void 0),t("ez-button",{class:"ez-button--primary",label:"Pesquisar",onClick:()=>this.onClickSearch()})),t("label",{class:"snk-pesquisa__records"},this.getMessageView()),t("div",{class:"snk-pesquisa__content"},this._itemList&&this._itemList.map((s=>t("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}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as e,b as t}from"./p-9ba3df4c.js";(()=>{const t=import.meta.url,i={};return""!==t&&(i.resourcesUrl=new URL(".",t).href),e(i)})().then((e=>t([["p-44ce5b90",[[1,"teste-pesquisa"]]],["p-eb94df0b",[[2,"snk-data-unit",{dataState:[1040],dataUnitName:[1,"data-unit-name"],entityName:[1,"entity-name"],pageSize:[2,"page-size"],dataUnit:[1040],beforeSave:[16],afterSave:[16],getDataUnit:[64]}]]],["p-63229ecb",[[0,"snk-filter-binary-select",{value:[1544],config:[16],show:[64]},[[0,"ezChange","ezChangeListener"]]]]],["p-4f9aa0b0",[[0,"snk-filter-multi-select",{value:[1544],config:[16],show:[64]},[[0,"ezChange","ezChangeListener"]]]]],["p-5fc34bc1",[[0,"snk-filter-number",{config:[16],value:[2],show:[64]},[[0,"ezChange","ezChangeListener"]]]]],["p-da0a0b8c",[[0,"snk-filter-period",{config:[16],value:[8],show:[64]},[[0,"ezChange","ezChangeListener"]]]]],["p-f50c6ef6",[[0,"snk-filter-personalized",{config:[16],value:[1040],fix:[16],unfix:[16],show:[64]}]]],["p-b5799889",[[0,"snk-filter-search",{config:[16],value:[16],show:[64]},[[0,"ezChange","ezChangeListener"]]]]],["p-8fca7910",[[0,"snk-filter-text",{config:[16],value:[1]},[[0,"ezChange","ezChangeListener"]]]]],["p-
|
|
1
|
+
import{p as e,b as t}from"./p-9ba3df4c.js";(()=>{const t=import.meta.url,i={};return""!==t&&(i.resourcesUrl=new URL(".",t).href),e(i)})().then((e=>t([["p-44ce5b90",[[1,"teste-pesquisa"]]],["p-eb94df0b",[[2,"snk-data-unit",{dataState:[1040],dataUnitName:[1,"data-unit-name"],entityName:[1,"entity-name"],pageSize:[2,"page-size"],dataUnit:[1040],beforeSave:[16],afterSave:[16],getDataUnit:[64]}]]],["p-63229ecb",[[0,"snk-filter-binary-select",{value:[1544],config:[16],show:[64]},[[0,"ezChange","ezChangeListener"]]]]],["p-4f9aa0b0",[[0,"snk-filter-multi-select",{value:[1544],config:[16],show:[64]},[[0,"ezChange","ezChangeListener"]]]]],["p-5fc34bc1",[[0,"snk-filter-number",{config:[16],value:[2],show:[64]},[[0,"ezChange","ezChangeListener"]]]]],["p-da0a0b8c",[[0,"snk-filter-period",{config:[16],value:[8],show:[64]},[[0,"ezChange","ezChangeListener"]]]]],["p-f50c6ef6",[[0,"snk-filter-personalized",{config:[16],value:[1040],fix:[16],unfix:[16],show:[64]}]]],["p-b5799889",[[0,"snk-filter-search",{config:[16],value:[16],show:[64]},[[0,"ezChange","ezChangeListener"]]]]],["p-8fca7910",[[0,"snk-filter-text",{config:[16],value:[1]},[[0,"ezChange","ezChangeListener"]]]]],["p-67c1700b",[[2,"snk-pesquisa",{searchLoader:[16],selectItem:[16],argument:[1025],_itemList:[32],_startLoading:[32]}]]],["p-570cc474",[[2,"snk-config-options",{fieldConfig:[16],idConfig:[513,"id-config"],dataUnit:[16],_defaultType:[32]}]]],["p-cd03ea9e",[[6,"snk-tab-config",{selectedIndex:[1538,"selected-index"],selectedTab:[1537,"selected-tab"],tabs:[1],_processedTabs:[32],_activeEditText:[32],_activeEditTextIndex:[32],_actionsHide:[32],_actionsShow:[32]}]]],["p-cd486089",[[0,"snk-filter-detail",{config:[1040],getMessage:[16],show:[64]}]]],["p-60e7e86d",[[6,"snk-grid",{configName:[1,"config-name"],actionsList:[16],taskbarManager:[16],statusResolver:[16],multipleSelection:[4,"multiple-selection"],_dataUnit:[32],_dataState:[32],_gridConfig:[32],_popUpGridConfig:[32],showConfig:[64],hideConfig:[64],setConfig:[64]}],[2,"snk-configurator",{configName:[1,"config-name"],viewMode:[1,"view-mode"],_opened:[32],_permissions:[32],open:[64],close:[64]}],[2,"snk-field-config",{isConfigActive:[16],fieldConfig:[16],modeInsertion:[516,"mode-insertion"],dataUnit:[16]}]]],["p-d61f2170",[[2,"snk-form-config",{dataUnit:[16],formConfig:[16],configName:[513,"config-name"],_formConfigOptions:[32],_fieldConfigSelected:[32],_layoutFormConfig:[32],_fieldsAvailable:[32],_formConfig:[32],_formConfigChanged:[32],_optionFormConfigSelected:[32],_optionFormConfigChanged:[32],_tempGroups:[32]}]]],["p-d2b0f1fc",[[2,"snk-filter-bar",{dataUnit:[1040],configName:[1,"config-name"],filterConfig:[1040],allowDefault:[32],scrollerLocked:[32]},[[0,"filterChange","filterChangeListener"]]],[2,"snk-grid-config",{selectedIndex:[1026,"selected-index"],columns:[1040],config:[1040],saveConfig:[64]}],[0,"snk-filter-item",{config:[1040],getMessage:[16],detailIsVisible:[32],showUp:[64],hideDetail:[64]},[[2,"click","clickListener"],[2,"mousedown","mouseDownListener"],[0,"filterChange","filterChangeListener"]]],[4,"snk-filter-list",{label:[1],iconName:[1,"icon-name"],items:[16],getMessage:[16],emptyText:[1,"empty-text"],findFilterText:[1,"find-filter-text"],buttonClass:[1,"button-class"],_filterArgument:[32],_showAll:[32],hideDetail:[64]},[[2,"keydown","keyDownHandler"]]],[0,"snk-filter-modal",{getMessage:[16],items:[1040],modalTitle:[1,"modal-title"],modalSubTitle:[1,"modal-sub-title"],cancelButtonLabel:[1,"cancel-button-label"],okButtonLabel:[1,"ok-button-label"],infoText:[1,"info-text"],useSearch:[4,"use-search"],processModalAction:[16],_filterArgument:[32]}],[1,"snk-select-box",{selectedOption:[1,"selected-option"]}],[6,"snk-taskbar",{configName:[1,"config-name"],buttons:[1],customButtons:[16],actionsList:[16],primaryButton:[1,"primary-button"],disabledButtons:[16],dataUnit:[16],_permissions:[32]}]]],["p-2e0747f9",[[2,"snk-form",{configName:[1,"config-name"],recordsValidator:[16],actionsList:[16],taskbarManager:[16],_dataUnit:[32],_dataState:[32],_editionFormConfig:[32],_insertionFormConfig:[32],_showFormConfig:[32],showConfig:[64],hideConfig:[64]}]]],["p-825c8975",[[6,"snk-crud",{configName:[1025,"config-name"],actionsList:[16],taskbarManager:[16],recordsValidator:[16],statusResolver:[16],multipleSelection:[4,"multiple-selection"],_dataUnit:[32],_dataState:[32],_viewMode:[32],goToView:[64]}]]],["p-a72a0a5d",[[2,"snk-application",{messagesBuilder:[1040],configName:[1,"config-name"],isUserSup:[64],hasAccess:[64],getAllAccess:[64],getStringParam:[64],getIntParam:[64],getFloatParam:[64],getBooleanParam:[64],getDateParam:[64],showPopUp:[64],showModal:[64],closeModal:[64],closePopUp:[64],temOpcional:[64],getConfig:[64],saveConfig:[64],getAttributeFromHTMLWrapper:[64],openApp:[64],createDataunit:[64],getDataUnit:[64],getResourceID:[64],getUserID:[64],alert:[64],error:[64],success:[64],message:[64],confirm:[64],info:[64],loadFormConfig:[64],loadGridConfig:[64],fetchUserAvailableConfigs:[64],fetchLegacyConfig:[64],fetchDefaultConfig:[64],loadTotals:[64],saveGridConfig:[64],getFilterBarConfig:[64],saveFilterBarConfig:[64],saveFormConfig:[64],getDefaultValues:[64],getDefaultValue:[64],executeSearch:[64],executePreparedSearch:[64],isDebugMode:[64]}]]]],e)));
|
|
@@ -87,7 +87,7 @@ export declare class SnkApplication {
|
|
|
87
87
|
/**
|
|
88
88
|
* Exibe o conteúdo passado em um Popup.
|
|
89
89
|
*/
|
|
90
|
-
showPopUp(content: HTMLElement, size?:
|
|
90
|
+
showPopUp(content: HTMLElement, size?: "auto" | "full", useHeader?: boolean): Promise<void>;
|
|
91
91
|
/**
|
|
92
92
|
* Exibe o conteúdo passado em um Modal.
|
|
93
93
|
*/
|
|
@@ -192,7 +192,7 @@ export namespace Components {
|
|
|
192
192
|
/**
|
|
193
193
|
* Exibe o conteúdo passado em um Popup.
|
|
194
194
|
*/
|
|
195
|
-
"showPopUp": (content: HTMLElement, size?:
|
|
195
|
+
"showPopUp": (content: HTMLElement, size?: "auto" | "full", useHeader?: boolean) => Promise<void>;
|
|
196
196
|
/**
|
|
197
197
|
* Exibe o diálogo de sucesso de acordo com os parâmetros passados.
|
|
198
198
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sankhyalabs/sankhyablocks",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.4",
|
|
4
4
|
"description": "Stencil Component Starter",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@babel/preset-env": "^7.18.2",
|
|
42
|
-
"@sankhyalabs/core": "^2.3.
|
|
42
|
+
"@sankhyalabs/core": "^2.3.6",
|
|
43
43
|
"@sankhyalabs/ezui": "^2.0.0",
|
|
44
44
|
"@sankhyalabs/skippeerdeps": "^1.0.2",
|
|
45
45
|
"@semantic-release/exec": "^5.0.0",
|
|
@@ -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,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}replaceAccentuatedChars(s){return null==s?s:this.replaceToSpace(s,["&","<",">","""]).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){const{key:e,title:t}=s,i=new RegExp(this._startHighlightTag,"g"),r=new RegExp(this._endHighlightTag,"g"),n={value:null==e?void 0:e.replace(i,"").replace(r,""),label:null==t?void 0:t.replace(i,"").replace(r,"")};this.selectItem(n)}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},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}
|