UNPKG

@smart-webcomponents-angular/cardview

Version:

[![Price](https://img.shields.io/badge/price-COMMERCIAL-0098f7.svg)](https://jqwidgets.com/license/)

6 lines (4 loc) 107 kB
/* Smart UI v22.0.2 (2025-01-31) Copyright (c) 2011-2024 jQWidgets. License: https://htmlelements.com/license/ */ // Smart("smart-grid-panel",class extends Smart.BaseElement{static get properties(){return{closeButtonPosition:{value:"left",allowedValues:["left","right"],type:"string"},dataSource:{value:[],type:"array",reflectToAttribute:!1},messages:{value:{en:{apply:"Ok",booleanFirst:"☐",booleanLast:"☑",cancel:"Cancel",dateFirst:"1",dateLast:"9",from:"from",numberFirst:"1",numberLast:"9",stringFirst:"A",stringLast:"Z",thenBy:"then by"}},type:"object",extend:!0}}}static get listeners(){return{change:"_changeHandler",click:"_clickHandler",keydown:"_keydownHandler","sortable.dragEnd":"_sortableDragEndHandler"}}static get requires(){return{"Smart.Input":"smart.input.js","Smart.Sortable":"smart.sortable.js"}}static get styleUrls(){return["smart.grid.anel.css"]}template(){return'<div id="container" role="presentation">\n <smart-sortable id="sortable" disable-mode="manual" animation="[[animation]]" disabled="[[readonly]]" right-to-left="[[rightToLeft]]"\n drag-mode="handle" handle-position="right" handle-visibility="visible" theme="[[theme]]">\n </smart-sortable>\n <div id="footer" class="smart-grid-panel-container-footer" role="presentation">\n <smart-input id="inputNotSorted" right-to-left="[[rightToLeft]]" animation="[[animation]]" readonly theme="[[theme]]"></smart-input>\n <div id="buttonsContainer" class="smart-grid-panel-buttons-container smart-unselectable" role="presentation">\n <span class="smart-grid-panel-cancel-button" role="button"></span>\n <span class="smart-grid-panel-apply-button primary" role="button"></span>\n </div>\n </div>\n </div>'}ready(){super.ready()}render(){const e=this;e.setAttribute("role","dialog"),"right"===e.closeButtonPosition&&(e.$.sortable.handlePosition="left"),e._localize(),e._createSources(),super.render()}propertyChangedHandler(e,t,a){super.propertyChangedHandler(e,t,a);const l=this;switch(e){case"animation":case"theme":Array.from(l.$.sortable.getElementsByTagName("smart-input")).forEach((t=>t[e]=a));break;case"disabled":case"unfocusable":l._setFocusable();break;case"closeButtonPosition":"right"===l.closeButtonPosition?l.$.sortable.handlePosition="left":l.$.sortable.handlePosition="right";break;case"dataSource":l.$.sortable.$.container.innerHTML="",l._createSources();break;case"locale":case"messages":{const e=l.$.sortable._items;l._localize(),e.length&&(e[0].children[1].innerHTML=l.localize("firstBy"),e.forEach((function(e,t){0!==t&&(e.children[1].innerHTML=l.localize("thenBy"));const a=l._HTMLToSourceMap.get(e),n=l._ascDescTemplates[a.dataType]||l._ascDescTemplates.string;e.children[3].innerHTML=l.localize("from"),e.children[4].firstElementChild.innerHTML=n[0],e.children[4].children[1].innerHTML=n[1]})));break}case"maxLevel":if(null!=a)for(;l.$.sortable._items.length>0&&l.$.sortable._items.length>a;)l._interactionHandler(l.$.sortable._items[l.$.sortable._items.length-1].firstElementChild);l._disableItemAddition();break;case"rightToLeft":l.$.inputNotSorted.rightToLeft=a,l.$.inputNotSorted.dropDownButtonPosition=a?"left":"right",l.$.sortable._items.forEach((e=>{const t=e.querySelector("smart-input");t.rightToLeft=a,t.dropDownButtonPosition=a?"left":"right"}))}}_changeHandler(e){const t=this,a=t.shadowRoot||t.isInShadowDOM?e.composedPath()[0]:e.target;if(t.$.inputNotSorted.contains(a)){const e=t.$.inputNotSorted.value,a=t._labelToSourceMap.get(e);return t._createSortItem(a,t.$.sortable._items.length),t.$.sortable.updateItems(),t._visibleLabels.push(e),t._updateHiddenSource(),t._disableItemAddition(),void(t.$.inputNotSorted.value="")}const l=a.closest("smart-input");if(!l)return;const n=l.parentElement.parentElement,i=n.children[4].firstElementChild,o=n.children[4].children[1],r=l.value,s=t._HTMLToSourceMap.get(n).label,d=t._labelToSourceMap.get(r),c=t._ascDescTemplates[d.dataType]||t._ascDescTemplates.string;t._HTMLToSourceMap.set(n,d),t._visibleLabels.splice(t._visibleLabels.indexOf(s),1,r),t._updateHiddenSource(),i.innerHTML=c[0],o.innerHTML=c[1],d.sortDirection&&-1===d.sortDirection.indexOf("asc")?(o.classList.add("selected"),i.classList.remove("selected")):(i.classList.add("selected"),o.classList.remove("selected"))}_updateHiddenSource(){const e=this;e._hiddenSource=e.dataSource.map((e=>({label:e.label,value:e.dataField,icon:e.icon}))).filter((t=>-1===e._visibleLabels.indexOf(t.label)));const t=e.$.inputNotSorted.context;e.$.inputNotSorted.context=e.$.inputNotSorted,e.$.inputNotSorted.dataSource=e._hiddenSource,e.$.sortable._items.forEach((t=>{const a=t.getElementsByTagName("smart-input")[0],l=a.context;a.context=a,a.dataSource=e._hiddenSource,a.context=l})),e.$.inputNotSorted.context=t,e._disableItemAddition(),e.$.fireEvent("dataSourceChange")}_clickHandler(e){const t=this;t._interactionHandler(t.shadowRoot||t.isInShadowDOM?e.composedPath()[0]:e.target,e)}_interactionHandler(e,t){const a=this;if(a.disabled||a.readonly)return!0;const l=e.closest(".smart-grid-panel-item");if(l){if(e===l.firstElementChild){const e=a._HTMLToSourceMap.get(l).label;a.$.sortable.$.container.removeChild(l),a.$.sortable.updateItems(),a._visibleLabels.splice(a._visibleLabels.indexOf(e),1),a._updateHiddenSource(),a._disableItemAddition(),a.$.sortable._items.length&&(a.$.sortable._items[0].children[1].innerHTML=a.localize("firstBy")),a.$.fireEvent("remove")}else if(l.children[4].contains(e)){const n=l.children[4].firstElementChild,i=l.children[4].children[1];"click"===t.type?e.classList.contains("selected")||(e===n?(i.classList.remove("selected"),n.classList.add("selected"),a._HTMLToSourceMap.get(l).sortDirection="ascending"):e===i&&(n.classList.remove("selected"),i.classList.add("selected"),a._HTMLToSourceMap.get(l).sortDirection="descending")):(n.classList.toggle("selected"),i.classList.toggle("selected"),a._HTMLToSourceMap.get(l).sortDirection=n.classList.contains("selected")?"ascending":"descending")}return!0}if(e===a.$.buttonsContainer.firstElementChild)return a.$.fireEvent("cancel"),!0;if(e===a.$.buttonsContainer.children[1]){const e=[],t={dataFields:[],dataTypes:[],orderBy:[]},l={value:e};return a.$.sortable._items.forEach((l=>{const n=a._HTMLToSourceMap.get(l);e.push({dataField:n.dataField,sortDirection:n.sortDirection}),t.dataFields.push(n.dataField),t.dataTypes.push(n.dataType),t.orderBy.push(n.sortDirection)})),a instanceof Smart.SortPanel&&a.$.maintainSortContainer&&(t.maintainSort=a.$.maintainSortContainer.firstElementChild.hasAttribute("active")),(a instanceof Smart.SortPanel||a instanceof Smart.GroupPanel)&&(l.sortByInfo=t),a.$.fireEvent("apply",l),!0}}_keydownHandler(e){const t=this,a=e.key;" "!==a&&"Enter"!==a||(e.preventDefault(),t._interactionHandler((t.shadowRoot||t.getRootNode()).activeElement,e))}_sortableDragEndHandler(e){const t=this,a=e.detail.oldIndex,l=e.detail.newIndex,n=Math.max(a,l),i=t.$.sortable._items;0===(a&&l)&&(i[0].children[1].innerHTML=t.localize("firstBy"),i[1].children[1].innerHTML=t.localize("thenBy"),n>1&&(i[n].children[1].innerHTML=t.localize("thenBy")))}_localize(){const e=this;e.$.inputNotSorted.placeholder=e.localize("pickAnother"),e.$.buttonsContainer.firstElementChild.innerHTML=e.localize("cancel"),e.$.buttonsContainer.children[1].innerHTML=e.localize("apply"),e._ascDescTemplates={boolean:[e.localize("booleanFirst")+" → "+e.localize("booleanLast"),e.localize("booleanLast")+" → "+e.localize("booleanFirst")],date:[e.localize("dateFirst")+" → "+e.localize("dateLast"),e.localize("dateLast")+" → "+e.localize("dateFirst")],number:[e.localize("numberFirst")+" → "+e.localize("numberLast"),e.localize("numberLast")+" → "+e.localize("numberFirst")],string:[e.localize("stringFirst")+" → "+e.localize("stringLast"),e.localize("stringLast")+" → "+e.localize("stringFirst")]}}_createSources(){const e=this,t=(e instanceof Smart.SortPanel?"sort":"group")+"Index",a=[],l=[];if(e._HTMLToSourceMap=new Map,e._labelToSourceMap=new Map,e.dataSource.forEach((l=>{e._labelToSourceMap.set(l.label,l),-1!==l[t]&&void 0!==l[t]&&a.push(l)})),a.sort(((e,a)=>e[t]-a[t])),void 0!==e.maxLevel&&null!==e.maxLevel)for(;a.length>0&&a.length>e.maxLevel;)a.pop();e.$.inputNotSorted.dropDownButtonPosition=e.rightToLeft?"left":"right",e.$.inputNotSorted.dataSource&&e.$.inputNotSorted.dataSource.length<10&&e.$.inputNotSorted.dataSource.length>0?e.$.inputNotSorted.dropDownHeight="auto":e.$.inputNotSorted.dropDownHeight=250,a.forEach((e=>l.push(e.label))),e._visibleLabels=l,e._updateHiddenSource(),a.forEach(((t,a)=>{e._createSortItem(t,a)})),e.$.sortable.updateItems(),e._disableItemAddition(),e._setFocusable()}_createSortItem(e,t){const a=this,l=a.disabled||a.unfocusable?-1:0,n=document.createElement("div"),i=a._ascDescTemplates[e.dataType]||a._ascDescTemplates.string;n.className="smart-grid-panel-item",n.innerHTML=`<div class="smart-grid-panel-item-close-button" tabindex="${l}" role="button" aria-label="Close"></div>\n<div class="smart-grid-panel-label-by smart-unselectable" role="presentation">${a.localize(t>0?"thenBy":"firstBy")}</div>\n<div class="smart-grid-panel-field-container" role="presentation"><smart-input class="smart-grid-panel-field-selection" value="${e.label}" animation="${a.animation}" readonly theme="${a.theme}" aria-label="Field name"></smart-input></div>\n<div class="smart-grid-panel-from smart-unselectable" role="presentation">${a.localize("from")}</div >\n<div class="smart-grid-panel-direction smart-unselectable" tabindex="${l}" role="presentation">\n <div class="smart-grid-panel-asc" role="button" aria-label="Ascending">${i[0]}</div >\n <div class="smart-grid-panel-desc" role="button" aria-label="Descending">${i[1]}</div>\n</div>\n`;const o=n.querySelector("smart-input");o.dataSource=a._hiddenSource,o.rightToLeft=a.rightToLeft,o.dropDownButtonPosition=a.rightToLeft?"left":"right",o.dataSource&&o.dataSource.length<10?o.dropDownHeight="auto":o.dropDownHeight=250,a.$.sortable.$.container.appendChild(n),o.tabIndex=l,e.sortDirection&&-1===e.sortDirection.indexOf("asc")?n.children[4].children[1].classList.add("selected"):(e.sortDirection="ascending",n.children[4].firstElementChild.classList.add("selected")),a._HTMLToSourceMap.set(n,e)}_disableItemAddition(){const e=this,t=e.maxLevel,a=0===e._hiddenSource.length||null!=t&&Math.max(0,t)===e.$.sortable._items.length;e.$.inputNotSorted.disabled=a,a&&e.$.inputNotSorted.removeAttribute("focus")}_setFocusable(){const e=this,t=e.disabled||e.unfocusable?-1:0,a=Array.from(e.getElementsByClassName("smart-grid-panel-item-close-button")),l=Array.from(e.getElementsByClassName("smart-grid-panel-direction")),n=Array.from(e.getElementsByTagName("input")),i=a.concat(l).concat(n);e.$.buttonsContainer.firstElementChild.tabIndex=t,e.$.buttonsContainer.children[1].tabIndex=t,i.forEach((e=>e.tabIndex=t))}}),Smart("smart-sort-panel",class extends Smart.GridPanel{static get properties(){return{messages:{value:{en:{firstBy:"Sort by",noSorting:"No sorting applied",pickAnother:"Pick another field to sort by",maintainSort:"Maintain Sort",applyOnce:"Apply once"}},type:"object",extend:!0}}}template(){return'<div id="container" role="presentation">\n <smart-sortable disable-mode="manual" right-to-left="[[rightToLeft]]" id="sortable" animation="[[animation]]" disabled="[[readonly]]" drag-mode="handle" handle-position="right" handle-visibility="visible" theme="[[theme]]"></smart-sortable>\n <div id="footer" class="smart-grid-panel-container-footer" role="presentation">\n <div>\n <smart-input right-to-left="[[rightToLeft]]" id="inputNotSorted" animation="[[animation]]" readonly theme="[[theme]]"></smart-input>\n <div id="maintainSortContainer" class="smart-hidden smart-grid-panel-buttons-container smart-grid-panel-maintain-sort smart-unselectable" role="presentation">\n <span class="smart-grid-panel-maintain-sort-button" role="button"></span>\n </div>\n \n </div>\n <div id="buttonsContainer" class="smart-grid-panel-buttons-container smart-unselectable" role="presentation">\n <span class="smart-grid-panel-cancel-button" role="button"></span>\n <span class="smart-grid-panel-apply-button primary" role="button"></span>\n </div>\n </div>\n </div>'}_changeApplyButtonText(e){const t=this,a=t.$.maintainSortContainer.firstElementChild,l=t.querySelector(".smart-grid-panel-apply-button");e?a.hasAttribute("active")?(a.removeAttribute("active"),l&&(l.innerHTML=t.localize("applyOnce"))):(a.setAttribute("active",""),l&&(l.innerHTML=t.localize("apply"))):a.hasAttribute("active")?l.innerHTML=t.localize("apply"):l.innerHTML=t.localize("applyOnce")}_interactionHandler(e,t){const a=this;super._interactionHandler(e,t)||e===a.$.maintainSortContainer.firstElementChild&&a._changeApplyButtonText(!0)}static get styleUrls(){return["smarttextbox.css"]}_localize(){super._localize();const e=this;e.$.sortable.$.container.setAttribute("no-sorting",e.localize("noSorting")),e.$.maintainSortContainer.firstElementChild.innerHTML=e.localize("maintainSort"),e._changeApplyButtonText()}}),Smart("smart-group-panel",class extends Smart.GridPanel{static get properties(){return{maxLevel:{value:8,type:"number?"},messages:{value:{en:{collapseAll:"Collapse all",expandAll:"Expand all",firstBy:"Group by",noGrouping:"No grouping",pickAnother:"Pick another field to group by"}},type:"object",extend:!0}}}template(){return'<div id="container" role="presentation">\n <smart-sortable disable-mode="manual" right-to-left="[[rightToLeft]]" id="sortable" animation="[[animation]]" disabled="[[readonly]]" drag-mode="handle" handle-position="right" handle-visibility="visible" theme="[[theme]]"></smart-sortable>\n <div id="expandCollapseContainer" class="smart-grid-panel-buttons-container smart-grid-panel-expand-collapse smart-unselectable" role="presentation">\n <span class="smart-group-panel-collapse-button" role="button"></span>\n <span class="smart-group-panel-expand-button" role="button"></span>\n </div>\n <div id="footer" class="smart-grid-panel-container-footer" role="presentation">\n <smart-input right-to-left="[[rightToLeft]]" id="inputNotSorted" animation="[[animation]]" readonly theme="[[theme]]"></smart-input>\n <div id="buttonsContainer" class="smart-grid-panel-buttons-container smart-unselectable" role="presentation">\n <span class="smart-grid-panel-cancel-button" role="button"></span>\n <span class="smart-grid-panel-apply-button primary" role="button"></span>\n </div>\n </div>\n </div>'}_interactionHandler(e,t){const a=this;super._interactionHandler(e,t)||(e===a.$.expandCollapseContainer.firstElementChild?a.$.fireEvent("collapseAll"):e===a.$.expandCollapseContainer.children[1]&&a.$.fireEvent("expandAll"))}_localize(){super._localize();const e=this;e.$.expandCollapseContainer.firstElementChild.innerHTML=e.localize("collapseAll"),e.$.expandCollapseContainer.children[1].innerHTML=e.localize("expandAll"),e.$.sortable.$.container.setAttribute("no-grouping",e.localize("noGrouping"))}_setFocusable(){super._setFocusable();const e=this,t=e.disabled||e.unfocusable?-1:0;e.$.expandCollapseContainer.firstElementChild.tabIndex=t,e.$.expandCollapseContainer.children[1].tabIndex=t}}),Smart("smart-multi-column-filter-panel",class extends Smart.BaseElement{static get properties(){return{closeButtonPosition:{value:"left",allowedValues:["left","right"],type:"string"},dataSource:{value:[],type:"array",reflectToAttribute:!1},editorCallback:{value:null,type:"function?",reflectToAttribute:!1},editorPlaceholder:{value:"Value",type:"string"},messages:{value:{en:{addFilter:"+ Add filter",and:"And",apply:"Ok",cancel:"Cancel",CONTAINS:"contains",CONTAINS_CASE_SENSITIVE:"contains (case sensitive)",DOES_NOT_CONTAIN:"does not contain",DOES_NOT_CONTAIN_CASE_SENSITIVE:"does not contain (case sensitive)",EMPTY:"empty",ENDS_WITH:"ends with",ENDS_WITH_CASE_SENSITIVE:"ends with (case sensitive)",EQUAL:"equal",EQUAL_CASE_SENSITIVE:"equal (case sensitive)",GREATER_THAN:"greater than",GREATER_THAN_OR_EQUAL:"greater than or equal",LESS_THAN:"less than",LESS_THAN_OR_EQUAL:"less than or equal",noFilters:"No filters applied",NOT_EMPTY:"not empty",NOT_EQUAL:"not equal",NOT_NULL:"not null",NULL:"null",or:"Or",STARTS_WITH:"starts with",STARTS_WITH_CASE_SENSITIVE:"starts with (case sensitive)",where:"Where",TOMORROW:"Tomorrow",TODAY:"Today",YESTERDAY:"Yesterday",NEXT_WEEK:"Next week",THIS_WEEK:"This week",LAST_WEEK:"Last week",NEXT_MONTH:"Next month",THIS_MONTH:"This month",LAST_MONTH:"Last month"}},type:"object",extend:!0},operator:{value:"and",allowedValues:["and","or"],type:"string"},value:{value:[],type:"array"}}}static get listeners(){return{change:"_changeHandler",click:"_interactionHandler",keydown:"_interactionHandler"}}static get requires(){return{"Smart.Button":"smart.button.js","Smart.CheckBox":"smart.checkbox.js","Smart.DateTimePicker":"smart.datetimepicker.js","Smart.FilterGroup":"smart.filter.js","Smart.Input":"smart.input.js","Smart.NumericTextBox":"smart.numerictextbox.js"}}static get styleUrls(){return["smart.grid.anel.css"]}template(){return'<div id="container" role="presentation">\n <div id="itemsContainer" class="smart-filter-panel-items-container smart-unselectable"></div>\n <div id="footer" class="smart-grid-panel-container-footer" role="presentation">\n <div id="addFilterButton" class="smart-filter-panel-add-filter-button smart-unselectable" role="button"></div>\n <div id="buttonsContainer" class="smart-grid-panel-buttons-container smart-unselectable" role="presentation">\n <span class="smart-grid-panel-cancel-button" role="button"></span>\n <span class="smart-grid-panel-apply-button primary" role="button"></span>\n </div>\n </div>\n </div>'}ready(){super.ready()}render(){const e=this;e.setAttribute("role","dialog"),e._setFocusable(),e._localize(),e._applyValue(),super.render()}propertyChangedHandler(e,t,a){super.propertyChangedHandler(e,t,a);const l=this;switch(e){case"animation":case"theme":case"rightToLeft":Array.from(l.$.itemsContainer.querySelectorAll("smart-date-time-picker, smart-numeric-text-box, smart-check-box, smart-input")).forEach((t=>{t[e]=a,"smart-input"===t.tagName.toLowerCase()&&"rightToLeft"===e&&"none"!==t.dropDownButtonPosition&&(t.dropDownButtonPosition=a?"left":"right")}));break;case"disabled":case"unfocusable":l._setFocusable(!0);break;case"dataSource":case"value":l._applyValue();break;case"editorPlaceholder":Array.from(l.$.itemsContainer.getElementsByClassName("editor")).forEach((e=>e.placeholder=a));break;case"locale":case"messages":l._localize(!0);break;case"operator":l._setOperator()}}_setOperator(){const e=this,t=e.localize(e.operator);for(let a=2;a<e._items.length;a++)e._items[a].children[1].innerHTML=t}_changeHandler(e){const t=this,a=t.shadowRoot||t.isInShadowDOM?e.composedPath()[0]:e.target;if(a instanceof Smart.Input==0)return;const l=a.parentElement,n=l.children;if(a===n[1])t.operator=a.$.input.dataValue,t._setOperator();else if(a===n[2]){let a,i,o=t.dataSource.find((t=>t.dataField===e.detail.oldValue)).dataType,r=t.dataSource.find((t=>t.dataField===e.detail.oldValue)),s=t.dataSource.find((t=>t.dataField===e.detail.value)),d=s.dataType,c=[];if(s.options&&(d="enum",c=s.options.map((e=>{const t=e.color||"var(--smart-primary)";return e.prefix='<span style="background: '+t+'; width: 14px; height: 14px; display: inline-block; border-radius: 50%; margin-left:-4px; margin-right: 8px; top: 2px; position: relative;"></span>',""===e.label&&(e.label=" "),e}))),r&&r.options&&(o="enum"),"enum"!==d&&d===o)return void(t.editorCallback&&t.editorCallback(n[4],s));let u=n[3].value;switch(d){case"date":a=t._dateConditions,i=document.createElement("smart-date-time-picker"),i.calendarButton=!0,i.dropDownAppendTo="body",i.dropDownDisplayMode="auto",i.formatString="M/d/yy H:mm",u="";break;case"number":a=t._numberAndDateConditions,i=document.createElement("smart-numeric-text-box"),u="";break;case"boolean":a=t._booleanConditions,i=document.createElement("smart-check-box"),u="";break;case"enum":a=t._enumConditions,i=document.createElement("smart-input"),i.dataSource=c.length?c:s.options,i.readonly=!0,i.dropDownButtonPosition="right",u=a[0];break;default:a=t._stringConditions,u=t._stringConditions.find((e=>"CONTAINS"===e.value)),i=document.createElement("smart-input")}a.forEach((e=>{delete e.selected})),i.rightToLeft=t.rightToLeft,i.animation=t.animation,i.theme=t.theme,i.unfocusable=t.disabled||t.unfocusable,i.classList.add("underlined"),i.dataSource&&i.dataSource.length<10?i.dropDownHeight="auto":i.dropDownHeight=250,"boolean"!==d&&(i.placeholder=t.editorPlaceholder),t.editorCallback&&t.editorCallback(i,s),n[4]&&n[4].remove(),l.appendChild(i),""===u||a.find((e=>e.label===u))||(u.value?(n[3].value=u.label,n[3].selectedValue=u.value):(n[3].value="",n[3].selectedValue="")),n[3].dataSource=a,""===u&&(n[3].value=a[0].label,n[3].selectedValue=a[0].value),a.length>=10?n[3].dropDownHeight=250:n[3].dropDownHeight="auto",l.dataType=d}else if(a===n[3]){const e=n[4],t=a.$.input.dataValue;-1!==t.indexOf("NULL")||-1!==t.indexOf("EMPTY")||-1!==t.indexOf("THIS_WEEK")||-1!==t.indexOf("LAST_WEEK")||-1!==t.indexOf("NEXT_WEEK")||-1!==t.indexOf("THIS_MONTH")||-1!==t.indexOf("LAST_MONTH")||-1!==t.indexOf("NEXT_MONTH")||-1!==t.indexOf("THIS_YEAR")||-1!==t.indexOf("LAST_YEAR")||-1!==t.indexOf("NEXT_YEAR")||-1!==t.indexOf("TODAY")||-1!==t.indexOf("TOMORROW")||-1!==t.indexOf("YESTERDAY")?(e.value="",e.checked=!1,e.classList.add("smart-visibility-hidden")):e.classList.remove("smart-visibility-hidden"),a.condition=t}}_interactionHandler(e){const t=this;if(t.disabled||t.readonly)return;if("keydown"===e.type){if("Enter"!==e.key)return;e.preventDefault()}const a=t.shadowRoot||t.isInShadowDOM?e.composedPath()[0]:e.target,l=a.closest(".smart-grid-panel-item");if(l){if(a===l.firstElementChild){const e=t._items.indexOf(l);let a;t._items.splice(e,1),l.remove(),t._items.length>0&&e<2&&(0===e&&(t._items[0].children[1].remove(),a=document.createElement("div"),a.innerHTML=t.localize("where"),t._items[0].insertBefore(a,t._items[0].children[1])),t._items.length>1&&(t._items[1].children[1].remove(),a=document.createElement("smart-input"),a.className="underlined",a.dataSource=[{value:"and",label:t.localize("and")},{value:"or",label:t.localize("or")}],a.dropDownButtonPosition=t.rightToLeft?"left":"right",a.readonly=!0,a.value=t.localize(t.operator),a.animation=t.animation,a.theme=t.theme,a.rightToLeft=t.rightToLeft,a.unfocusable=t.disabled||t.unfocusable,t._items[1].insertBefore(a,t._items[1].children[1])))}}else if(a===t.$.addFilterButton&&t.dataSource.length>0)t.$.itemsContainer.appendChild(t._createItem(t.dataSource[0],"","",t._items.length));else if(a!==t.$.buttonsContainer.firstElementChild){if(a===t.$.buttonsContainer.children[1]){let e=t._stringConditions.concat(t._dateConditions),a=t.operator,l=[],n={},i=[];t._customConditions&&(e=e.concat(t._customConditions)),t._items.forEach((i=>{const o=t.dataSource.find((e=>e.label===i.children[2].value)),r=[];let s=i.children[3].value;if(""===s)return;let d=o.dataType;if(s=e.find((e=>e.label===s)).value,r.push(o.dataField,s),-1===s.indexOf("NULL")&&-1===s.indexOf("EMPTY"))if("boolean"===d)r.push(i.children[4].checked);else if("date"===d)r.push(i.children[4].value.toDate());else if("enum"===d||o.options){let e=i.children[4].$.input.dataValue;if(void 0===e){const t=o.options.find((e=>e.label===i.children[4].value));if(!t)return;e=t.value}d="string",r.push(e)}else r.push(i.children[4].value);let c=n[r[0]];void 0===c&&(c=new Smart.Utilities.FilterGroup,n[r[0]]=c);const u=c.createFilter(d,r[2],r[1]);c.addFilter(a,u),l.push(r)}));for(let e in n)i.push([e,n[e]]);t.value=l,t.$.fireEvent("apply",{filters:i,operator:a,value:l})}}else t.$.fireEvent("cancel")}_applyValue(){const e=this,t=document.createDocumentFragment();let a=0;for(e._items=[];e.$.itemsContainer.firstElementChild;)e.$.itemsContainer.firstElementChild.remove();0!==e.dataSource.length&&(e.value.forEach((l=>{if(!Array.isArray(l))return;const n=l[0],i=e.dataSource.find((e=>e.dataField===n));if(!i)return;const o=e._createItem(i,l[1],l[2],a);t.appendChild(o),a++})),e.$.itemsContainer.appendChild(t))}_createItem(e,t,a,l){const n=this,i=n.disabled||n.unfocusable?-1:0,o=document.createElement("div"),r=document.createDocumentFragment(),s=document.createElement("div"),d=document.createElement("smart-input"),c=document.createElement("smart-input");let u,p;if(s.className="smart-grid-panel-item-close-button",s.tabIndex=i,s.setAttribute("role","button"),s.setAttribute("aria-label","button"),r.appendChild(s),0===l?(u=document.createElement("div"),u.innerHTML=n.localize("where"),u.setAttribute("role","presentation")):1===l?(u=document.createElement("smart-input"),u.className="underlined",u.dataSource=[{value:"and",label:n.localize("and")},{value:"or",label:n.localize("or")}],u.dropDownButtonPosition=n.rightToLeft?"left":"right",u.readonly=!0,u.value=n.localize(n.operator),u.animation=n.animation,u.theme=n.theme,u.rightToLeft=n.rightToLeft,u.unfocusable=n.disabled||n.unfocusable,u.setAttribute("aria-label","Operator")):(u=document.createElement("div"),u.innerHTML=n.localize(n.operator),u.setAttribute("role","presentation")),r.appendChild(u),d.className="underlined",d.dataSource=n.dataSource.map((e=>({value:e.dataField,label:e.label,icon:e.icon}))),d.dropDownButtonPosition=n.rightToLeft?"left":"right",d.readonly=!0,d.value=e.label,d.animation=n.animation,d.theme=n.theme,d.rightToLeft=n.rightToLeft,d.unfocusable=n.disabled||n.unfocusable,d.setAttribute("aria-label","Field"),d.dataSource&&d.dataSource.length<10?d.dropDownHeight="auto":d.dropDownHeight=250,r.appendChild(d),"boolean"===e.dataType)c.dataSource=JSON.parse(JSON.stringify(n._booleanConditions)),p=document.createElement("smart-check-box"),p.checked="boolean"==typeof a&&a;else if("date"===e.dataType)c.dataSource=n._dateConditions,p=document.createElement("smart-date-time-picker"),p.dropDownDisplayMode="auto",p.calendarButton=!0,p.dropDownAppendTo="body",p.formatString="M/d/yy H:mm",p.value=a;else if("number"===e.dataType)c.dataSource=JSON.parse(JSON.stringify(n._numberAndDateConditions)),p=document.createElement("smart-numeric-text-box"),p.value="number"==typeof a||"string"==typeof a?a:0;else if("enum"===e.dataType||e.options){c.dataSource=JSON.parse(JSON.stringify(n._enumConditions)),p=document.createElement("smart-input");let t=[];e.options&&(t=e.options.map((e=>{const t=e.color||"var(--smart-primary)";return e.prefix='<span style="background: '+t+'; width: 14px; height: 14px; display: inline-block; border-radius: 50%; margin-left:-4px; margin-right: 8px; top: 2px; position: relative;"></span>',""===e.label&&(e.label=" "),e}))),p.dataSource=t.length?t:e.options,p.readonly=!0,p.dropDownButtonPosition="right";const l=a?e.options.find((e=>e.value===a)):null;p.value=l&&a?l.label:""}else c.dataSource=JSON.parse(JSON.stringify(n._stringConditions)),p=document.createElement("smart-input"),p.value=null!=a?a.toString():"",t||(t="CONTAINS");return c.className="underlined",c.dropDownButtonPosition=n.rightToLeft?"left":"right",c.readonly=!0,c.animation=n.animation,c.theme=n.theme,c.rightToLeft=n.rightToLeft,c.unfocusable=n.disabled||n.unfocusable,c.setAttribute("aria-label","Condition"),c.classList.add("smart-filter-panel-list"),c.dataSource.forEach((e=>{delete e.selected})),c.dataSource.find((e=>e.value===t))?(c.value=n.localize(t),c.selectedValue=t,c.condition=t):(p.value="",p.checked=!1),(void 0===t||-1===t.indexOf("NULL")&&-1===t.indexOf("EMPTY"))&&-1===t.indexOf("THIS_WEEK")&&-1===t.indexOf("LAST_WEEK")&&-1===t.indexOf("NEXT_WEEK")&&-1===t.indexOf("THIS_MONTH")&&-1===t.indexOf("LAST_MONTH")&&-1===t.indexOf("NEXT_MONTH")&&-1===t.indexOf("THIS_YEAR")&&-1===t.indexOf("LAST_YEAR")&&-1===t.indexOf("NEXT_YEAR")&&-1===t.indexOf("TODAY")&&-1===t.indexOf("TOMORROW")&&-1===t.indexOf("YESTERDAY")||(p.value="",p.checked=!1,p.classList.add("smart-visibility-hidden")),c.dataSource&&c.dataSource.length<10?c.dropDownHeight="auto":c.dropDownHeight=250,p.animation=n.animation,p.classList.add("editor"),p.rightToLeft=n.rightToLeft,p.theme=n.theme,p.unfocusable=n.disabled||n.unfocusable,p.classList.add("underlined"),"boolean"!==e.dataType&&(p.placeholder=n.editorPlaceholder),n.editorCallback&&n.editorCallback(p,e),r.appendChild(c),r.appendChild(p),o.appendChild(r),o.className="smart-grid-panel-item",n._items.push(o),o.dataType=e.dataType,o}_localize(e){const t=this;t.$.addFilterButton.innerHTML=t.localize("addFilter"),t.$.buttonsContainer.firstElementChild.innerHTML=t.localize("cancel"),t.$.buttonsContainer.children[1].innerHTML=t.localize("apply"),t.$.itemsContainer.setAttribute("no-filters",t.localize("noFilters")),t._stringConditions=[{prefix:'<span class="smart-icon smart-icon-empty"></span>',value:"EMPTY",label:t.localize("EMPTY")},{prefix:'<span class="smart-icon smart-icon-not-empty"></span>',value:"NOT_EMPTY",label:t.localize("NOT_EMPTY")},{prefix:'<span class="smart-icon smart-icon-contains"></span>',value:"CONTAINS",label:t.localize("CONTAINS")},{prefix:'<span class="smart-icon smart-icon-does-not-contain"></span>',value:"DOES_NOT_CONTAIN",label:t.localize("DOES_NOT_CONTAIN")},{prefix:'<span class="smart-icon smart-icon-starts-with"></span>',value:"STARTS_WITH",label:t.localize("STARTS_WITH")},{prefix:'<span class="smart-icon smart-icon-ends-with"></span>',value:"ENDS_WITH",label:t.localize("ENDS_WITH")},{prefix:'<span class="smart-icon smart-icon-equal"></span>',value:"EQUAL",label:t.localize("EQUAL")},{prefix:'<span class="smart-icon smart-icon-not-equal"></span>',value:"NOT_EQUAL",label:t.localize("NOT_EQUAL")},{prefix:'<span class="smart-icon smart-icon-null"></span>',value:"NULL",label:t.localize("NULL")},{prefix:'<span class="smart-icon smart-icon-not-null"></span>',value:"NOT_NULL",label:t.localize("NOT_NULL")}],t._enumConditions=[{prefix:'<span class="smart-icon smart-icon-equal"></span>',value:"EQUAL",label:t.localize("EQUAL")},{prefix:'<span class="smart-icon smart-icon-not-equal"></span>',value:"NOT_EQUAL",label:t.localize("NOT_EQUAL")}],t._dateConditions=[{prefix:'<span class="smart-icon smart-icon-equal"></span>',value:"EQUAL",label:t.localize("EQUAL")},{prefix:'<span class="smart-icon smart-icon-not-equal"></span>',value:"NOT_EQUAL",label:t.localize("NOT_EQUAL")},{prefix:'<span class="smart-icon smart-icon-less-than"></span>',value:"LESS_THAN",label:t.localize("LESS_THAN")},{prefix:'<span class="smart-icon smart-icon-less-than-equal"></span>',value:"LESS_THAN_OR_EQUAL",label:t.localize("LESS_THAN_OR_EQUAL")},{prefix:'<span class="smart-icon smart-icon-greater-than"></span>',value:"GREATER_THAN",label:t.localize("GREATER_THAN")},{prefix:'<span class="smart-icon smart-icon-greater-than-equal"></span>',value:"GREATER_THAN_OR_EQUAL",label:t.localize("GREATER_THAN_OR_EQUAL")},{prefix:'<span class="smart-icon smart-icon-null"></span>',value:"NULL",label:t.localize("NULL")},{prefix:'<span class="smart-icon smart-icon-not-null"></span>',value:"NOT_NULL",label:t.localize("NOT_NULL")},{prefix:'<span class="smart-icon smart-icon-calendar"></span>',value:"TOMORROW",label:t.localize("TOMORROW")},{prefix:'<span class="smart-icon smart-icon-calendar"></span>',value:"TODAY",label:t.localize("TODAY")},{prefix:'<span class="smart-icon smart-icon-calendar"></span>',value:"YESTERDAY",label:t.localize("YESTERDAY")},{prefix:'<span class="smart-icon smart-icon-calendar"></span>',value:"NEXT_WEEK",label:t.localize("NEXT_WEEK")},{prefix:'<span class="smart-icon smart-icon-calendar"></span>',value:"THIS_WEEK",label:t.localize("THIS_WEEK")},{prefix:'<span class="smart-icon smart-icon-calendar"></span>',value:"LAST_WEEK",label:t.localize("LAST_WEEK")},{prefix:'<span class="smart-icon smart-icon-calendar"></span>',value:"NEXT_MONTH",label:t.localize("NEXT_MONTH")},{prefix:'<span class="smart-icon smart-icon-calendar"></span>',value:"THIS_MONTH",label:t.localize("THIS_MONTH")},{prefix:'<span class="smart-icon smart-icon-calendar"></span>',value:"LAST_MONTH",label:t.localize("LAST_MONTH")}],t._numberAndDateConditions=[{prefix:'<span class="smart-icon smart-icon-equal"></span>',value:"EQUAL",label:t.localize("EQUAL")},{prefix:'<span class="smart-icon smart-icon-not-equal"></span>',value:"NOT_EQUAL",label:t.localize("NOT_EQUAL")},{prefix:'<span class="smart-icon smart-icon-less-than"></span>',value:"LESS_THAN",label:t.localize("LESS_THAN")},{prefix:'<span class="smart-icon smart-icon-less-than-equal"></span>',value:"LESS_THAN_OR_EQUAL",label:t.localize("LESS_THAN_OR_EQUAL")},{prefix:'<span class="smart-icon smart-icon-greater-than"></span>',value:"GREATER_THAN",label:t.localize("GREATER_THAN")},{prefix:'<span class="smart-icon smart-icon-greater-than-equal"></span>',value:"GREATER_THAN_OR_EQUAL",label:t.localize("GREATER_THAN_OR_EQUAL")},{prefix:'<span class="smart-icon smart-icon-null"></span>',value:"NULL",label:t.localize("NULL")},{prefix:'<span class="smart-icon smart-icon-not-null"></span>',value:"NOT_NULL",label:t.localize("NOT_NULL")}],t._booleanConditions=[{prefix:'<span class="smart-icon smart-icon-equal"></span>',value:"EQUAL",label:t.localize("EQUAL")},{prefix:'<span class="smart-icon smart-icon-not-equal"></span>',value:"NOT_EQUAL",label:t.localize("NOT_EQUAL")},{prefix:'<span class="smart-icon smart-icon-null"></span>',value:"NULL",label:t.localize("NULL")},{prefix:'<span class="smart-icon smart-icon-not-null"></span>',value:"NOT_NULL",label:t.localize("NOT_NULL")}],e&&t._items.forEach(((e,a)=>{const l=e.children[1],n=e.children[3];0===a?l.innerHTML=t.localize("where"):1===a?(l.dataSource=[{value:"and",label:t.localize("and")},{value:"or",label:t.localize("or")}],l.value=t.localize(t.operator)):l.innerHTML=t.localize(t.operator),"string"!==e.dataType||e.options?"enum"===e.dataType||e.options?n.dataSource=t._enumConditions:"boolean"===e.dataType?n.dataSource=t._booleanConditions:"date"===e.dataType?n.dataSource=t._dateConditions:n.dataSource=t._numberAndDateConditions:n.dataSource=t._stringConditions,n.value=n.condition?t.localize(n.condition):""}))}_setFocusable(e){const t=this,a=t.disabled||t.unfocusable?-1:0;if(t.$.addFilterButton.tabIndex=a,t.$.buttonsContainer.firstElementChild.tabIndex=a,t.$.buttonsContainer.children[1].tabIndex=a,e){const e=Array.from(t.$.itemsContainer.getElementsByClassName("smart-grid-panel-item-close-button")),l=Array.from(t.$.itemsContainer.querySelectorAll("smart-date-time-picker, smart-numeric-text-box, smart-check-box, smart-input"));e.forEach((e=>e.tabIndex=a)),l.forEach((e=>e.unfocusable=t.disabled||t.unfocusable))}}}),Smart("smart-column-panel",class extends Smart.BaseElement{static get properties(){return{dataSource:{value:[],type:"array",reflectToAttribute:!1},messages:{value:{en:{apply:"Ok",cancel:"Cancel",find:"Find a field",reset:"Reset",noResults:"No results"}},type:"object",extend:!0}}}static get listeners(){return{click:"_interactionHandler",keydown:"_interactionHandler","find.keyup":"_findKeyupHandler","sortable.dragEnd":"_sortableDragEndHandler"}}static get requires(){return{"Smart.Sortable":"smart.sortable.js"}}static get styleUrls(){return["smart.grid.anel.css"]}template(){return'<div id="container" role="presentation">\n <div class="smart-column-panel-find-container" role="search">\n <input id="find" readonly="[[readonly]]" role="searchbox" aria-label="Find a field"></input>\n <span id="clearButton" class="clear-button smart-hidden" role="button" aria-label="Clear"></span>\n </div>\n <smart-sortable id="sortable" disable-mode="manual" right-to-left="[[rightToLeft]]" animation="[[animation]]" disabled="[[readonly]]" drag-mode="handle" handle-position="right" handle-visibility="visible" theme="[[theme]]"></smart-sortable>\n <div id="footer" class="smart-grid-panel-container-footer" role="presentation">\n <span id="reset" class="smart-grid-panel-reset-button" role="button"></span>\n <div id="buttonsContainer" class="smart-grid-panel-buttons-container smart-unselectable" role="presentation">\n <span class="smart-grid-panel-cancel-button" role="button"></span>\n <span class="smart-grid-panel-apply-button primary" role="button"></span>\n </div>\n </div>\n </div>'}ready(){super.ready()}render(){const e=this;e.setAttribute("role","dialog"),e._positionChanged=!1,e._localize(),e._moves=[],e._createSortItems(),super.render()}propertyChangedHandler(e,t,a){super.propertyChangedHandler(e,t,a);const l=this;switch(e){case"disabled":case"unfocusable":l._setFocusable();break;case"dataSource":{const e=l.$.sortable.$.container;for(;e.firstChild;)e.removeChild(e.firstChild);l._createSortItems(),l._positionChanged=!1,l.$.find.value="",l._findKeyupHandler(),l.$.clearButton.classList.add("smart-hidden");break}case"locale":case"messages":l._localize()}}_createSortItems(){const e=this,t=document.createDocumentFragment();e._HTMLToSourceMap=new Map,e.dataSource.forEach((a=>t.appendChild(e._createSortItem(a)))),e.$.sortable.$.container.appendChild(t),e.$.sortable.updateItems(),e._setFocusable()}_createSortItem(e){const t=document.createElement("div"),a=this.id+"Label"+e.dataField;return this._HTMLToSourceMap.set(t,e),t.className="smart-grid-panel-item",t.innerHTML=`<div class="toggle-visibility${!1!==e.visible?"":" hidden"}${e.disableToggle?" disable-toggle":""}" role="button" aria-controls="${a}" aria-label="Toggle visibility"></div>\n<span id="${a}" class="smart-column-panel-label smart-unselectable${e.icon?" icon "+e.icon:""}">${e.label}</span>`,1===e.level?t.classList.add("indent"):0===e.level&&t.classList.add("group"),e.disableDrag&&t.setAttribute("disable-drag",""),e.dataField&&t.setAttribute("data-field",e.dataField),e.parentDataField&&t.setAttribute("parent-data-field",e.parentDataField),!1!==e.allowHide&&!0!==e.disableToggle||(t.style.pointerEvents="none",t.setAttribute("disabled",""),t.style.opacity=.8),t}_interactionHandler(e){const t=this;if(t.disabled||t.readonly||"keydown"===e.type&&-1===[" ","Enter"].indexOf(e.key))return;const a=t.shadowRoot||t.isInShadowDOM?e.composedPath()[0]:e.target;if(a.classList.contains("toggle-visibility")){a.classList.toggle("hidden");const e=a.closest(".smart-grid-panel-item");if(e.hasAttribute("data-field")){const l=e.getAttribute("data-field");if(e.hasAttribute("parent-data-field")||e.hasAttribute("disabled")){const a=e.getAttribute("parent-data-field"),l=t.$.sortable.querySelectorAll(".smart-grid-panel-item");let n=null;if(l.forEach((e=>{e.getAttribute("data-field")===a&&(n=e)})),n){let e=0,t=0;l.forEach((l=>{l.getAttribute("parent-data-field")===a&&(e++,l.firstElementChild.classList.contains("hidden")&&t++)})),t===e?n.firstElementChild.classList.add("hidden"):t<e&&n.firstElementChild.classList.remove("hidden")}}else t.$.sortable._items.forEach((e=>{if(e.hasAttribute("parent-data-field")&&!e.hasAttribute("disabled")){const t=e.getAttribute("parent-data-field"),n=e.firstElementChild;t===l&&(a.classList.contains("hidden")?n.classList.add("hidden"):n.classList.remove("hidden"))}}))}}else if(a.parentElement===t.$.buttonsContainer){if(a===t.$.buttonsContainer.firstElementChild)return t.$.fireEvent("cancel"),void(t._moves=[]);if(a===t.$.buttonsContainer.children[1]){const e=[];Array.from(t.$.sortable.$.container.children).forEach((a=>{const l=Object.assign({},t._HTMLToSourceMap.get(a));l.visible=!a.firstElementChild.classList.contains("hidden"),e.push(l)})),t.$.fireEvent("apply",{value:e,positionChanged:t._positionChanged,moves:t._moves}),t._positionChanged=!1,t._moves=[]}}else if(a===t.$.reset){const e=[];Array.from(t.$.sortable.$.container.children).forEach((a=>{const l=Object.assign({},t._HTMLToSourceMap.get(a));l.visible=!0,e.push(l)})),t.$.fireEvent("apply",{value:e,positionChanged:t._positionChanged,moves:t._moves}),t._positionChanged=!1,t._moves=[]}else a.classList.contains("clear-button")&&(t.$.find.value="",t._findKeyupHandler())}_findKeyupHandler(){const e=this;if(e.disabled||e.readonly)return;const t=e.$.find,a=t.value,l=[...e.$.sortable.$.container.children];if(void 0===e._disabledSortable&&(e._disabledSortable=e.$.sortable.disabled),""===a)return t.parentElement.classList.remove("no-results"),e.$.clearButton.classList.add("smart-hidden"),l.forEach((e=>e.classList.remove("smart-hidden"))),e.$.sortable.disabled=e._disabledSortable||e.readonly,void delete e._disabledSortable;let n=!0;e.$.clearButton.classList.remove("smart-hidden"),l.forEach((t=>{-1===e._HTMLToSourceMap.get(t).label.toLowerCase().indexOf(a.toLowerCase())?t.classList.add("smart-hidden"):(t.classList.remove("smart-hidden"),n=!1)})),e.$.sortable.disabled=n,n?t.parentElement.classList.add("no-results"):t.parentElement.classList.remove("no-results")}_sortableDragEndHandler(e){const t=e.detail;this._positionChanged=!0,this._moves.push({oldIndex:t.oldIndex,newIndex:t.newIndex})}_localize(){const e=this;e.$.find.placeholder=e.localize("find"),e.$.reset.innerHTML=e.localize("reset"),e.$.buttonsContainer.firstElementChild.innerHTML=e.localize("cancel"),e.$.buttonsContainer.children[1].innerHTML=e.localize("apply"),e.$.container.firstElementChild.setAttribute("no-results",e.localize("noResults"))}_setFocusable(){const e=this,t=e.disabled||e.unfocusable?-1:0,a=Array.from(e.$.sortable.getElementsByClassName("toggle-visibility"));e.$.find.tabIndex=t,e.$.clearButton.tabIndex=t,e.$.buttonsContainer.firstElementChild.tabIndex=t,e.$.buttonsContainer.children[1].tabIndex=t,a.forEach((e=>e.tabIndex=e.classList.contains("disable-toggle")?-1:t))}}),Smart("smart-formatting-panel",class extends Smart.BaseElement{static get properties(){return{columns:{value:[],type:"array",reflectToAttribute:!1},dataSource:{value:[],type:"any",reflectToAttribute:!1},items:{value:null,type:"array?",reflectToAttribute:!1},dropDownAppendTo:{value:null,type:"any",reflectToAttribute:!1},messages:{value:{en:{add:"Add condition",all:"All columns",apply:"Ok",between:"Between",cancel:"Cancel",close:"Close",column:"Column:",condition:"Condition:",equal:"Equal To",fontFamily:"Font family:",fontSize:"Font size:",format:"Format:",greaterThan:"Greater Than",highlight:"Highlight",lessThan:"Less Than",notEqual:"Not Equal To",remove:"Remove condition",secondValue:"Second value:",text:"Text",value:"Value:"}},type:"object",extend:!0}}}static get listeners(){return{click:"_interactionHandler",keydown:"_interactionHandler",change:"_changeHandler","popup.change":"_changeHandler","popup.click":"_interactionHandler","popup.keydown":"_interactionHandler","document.down":"_documentDownHandler"}}template(){return'<div id="container" role="presentation">\n <div id="itemsContainer" class="smart-formatting-panel-items-container" role="presentation"></div>\n <div id="addNewButton" class="smart-add-new-button" role="button" aria-label="Add new condition"></div>\n <div id="popup" class="smart-formatting-panel-popup smart-hidden smart-visibility-hidden" role="dialog">\n <div id="popupHeader" class="header" role="presentation">\n <div id="text" class="selected" role="button" aria-label="Text color"></div>\n <div id="highlight" role="button" aria-label="Highlight color"></div>\n </div>\n <div id="colorCode" class="color-code"></div>\n <input id="colorInput" type="color" />\n <div id="colorsContainer" class="colors-container"></div>\n <smart-button id="apply" class="ok primary" animation="[[animation]]" right-to-left="[[rightToLeft]]" theme="[[theme]]" unfocusable="[[unfocusable]]"></smart-button>\n <smart-button id="cancel" class="cancel" animation="[[animation]]" right-to-left="[[rightToLeft]]" theme="[[theme]]" unfocusable="[[unfocusable]]"></smart-button>\n </div>\n </div>'}render(){const e=this,t=getComputedStyle(e);e.setAttribute("role","dialog"),e.$.popup.id=e.id+"Popup",e._basicColors=[[0,0,0],[68,68,68],[102,102,102],[153,153,153],[204,204,204],[238,238,238],[243,243,243],[255,255,255],[255,0,0],[255,153,0],[255,255,0],[0,255,0],[0,255,255],[0,0,255],[153,0,255],[255,0,255],[244,204,204],[252,229,205],[255,242,204],[217,234,211],[208,224,227],[207,226,243],[217,210,233],[234,209,220],[234,153,153],[249,203,156],[255,229,153],[182,215,168],[162,196,201],[159,197,232],[180,167,214],[213,166,189],[224,102,102],[246,178,107],[255,217,102],[147,196,125],[118,165,175],[111,168,220],[142,124,195],[194,123,160],[204,0,0],[230,145,56],[241,194,50],[106,168,79],[69,129,142],[61,133,198],[103,78,167],[166,77,121],[153,0,0],[180,95,6],[191,144,0],[56,118,29],[19,79,92],[11,83,148],[53,28,117],[116,27,71],[102,0,0],[120,63,4],[127,96,0],[39,78,19],[12,52,61],[7,55,99],[32,18,77],[76,17,48]],e._defaults={fontFamily:t.fontFamily,fontSize:t.fontSize,text:e._toHex(t.color),highlight:e._toHex(t.backgroundColor)},t.fontFamily.indexOf("-apple")>=0&&(e._defaults.fontFamily="Segoe UI"),e._localize(),e._setFocusable(),e._populatePopupWithColors(),e._processColumnsAndDataSource(),e._addDefaultItems(),super.render()}attached(){const e=this;super.attached(),e.isCompleted&&e._addDefaultItemsOnAttach&&e._addDefaultItems()}add(e,t){const a=this;if(e&&e.column&&"all"!==e.column&&!a.columns.find((t=>t.dataField===e.column)))return void a.items.splice(t,1);const l=document.createElement("div"),n=a._defaults,i=` animation="${a.animation}"${a.rightToLeft?" right-to-left":""} theme="${a.theme}"${a.unfocusable?" unfocusable":""}`,o=a.disabled||a.unfocusable?"":' tabindex="0"';e=Object.assign({column:"all",condition:"lessThan",firstValue:0,secondValue:1,fontFamily:n.fontFamily,fontSize:n.fontSize,text:n.text,highlight:n.highlight},e);const r=`\n<div class="value-label">${a.localize("value")}</div>\n<smart-input class="columns-input underlined" data-source='${JSON.stringify(a._columnsInputDataSource)}' placeholder="${a.localize("column")}" readonly value="${a._columnsInputDataSource.find((t=>t.value===e.column)).label}"${i}></smart-input>\n<smart-input class="condition-input underlined" data-source='${a._conditionsDataSource}' placeholder="${a.localize("condition")}" readonly value="${a.localize(e.condition)}"${i}></smart-input>\n<smart-input class="first-value underlined" type="number" placeholder="${a.localize("value")}" value="${e.firstValue}"${i}></smart-input>\n<div class="ampersand">&</div>\n<smart-input class="second-value underlined" type="number" placeholder="${a.localize("secondValue")}" value="${e.secondValue}"${i}></smart-input>\n<div class="close-button" title="${a.localize("close")}"${o} role="button" aria-label="Close"></div>\n<div class="format-label">${a.localize("format")}</div>\n<smart-input class="font-family-input underlined" drop-down-height="auto" placeholder="${a.localize("fontFamily")}" readonly${i}></smart-input>\n<smart-input class="font-size-input underlined" data-source='["8px", "9px", "10px", "11px", "12px", "13px", "14px", "15px", "16px"]' drop-down-height="auto" placeholder="${a.localize("fontSize")}" readonly value="${e.fontSize}"${i}></smart-input>\n<div class="popup-button smart-unselectable"${o} role="button" aria-haspopup="dialog" aria-label="Toggle pop-up">A</div>\n<div class="preview smart-unselectable">2.71828</div>`;l.classList.add("smart-formatting-panel-item"),l.classList.toggle("between","between"===e.condition),l.innerHTML=r,l.columnsInput=l.querySelector(".columns-input"),l.conditionInput=l.querySelector(".condition-input"),l.firstValue=l.querySelector(".first-value"),l.secondValue=l.querySelector(".second-value"),l.closeButton=l.querySelector(".close-button"),l.fontFamilyInput=l.querySelector(".font-family-input"),l.fontFamilyInput.dataSource=[n.fontFamily,"Arial","Verdana","Courier New","Georgia","Times New Roman"],l.fontFamilyInput.value=e.fontFamily,l.fontSizeInput=l.querySelector(".font-size-input"),l.popupButton=l.querySelector(".popup-button"),l.fontFamilyInput=l.querySelector(".font-family-input"),l.preview=l.querySelector(".preview"),l.popupButton.style.color=e.text,l.popupButton.style.backgroundColor=e.highlight,l.preview.style.fontFamily=e.fontFamily,l.preview.style.fontSize=e.fontSize,l.preview.style.color=e.text,l.preview.style.backgroundColor=e.highlight,l.data=e,a.$.itemsContainer.appendChild(l),l.columnsInput.$.input.value||(l.columnsInput.$.input.dataValue="all"),l.conditionInput.$.input.dataValue=e.condition,a._checkScrollBar()}apply(){const e=this,t=new Smart.Utilities.ConditionalFormatter(e.dataSource),a=Array.from(e.$.itemsContainer.children),l=[];let n;if(0===a.length)return;if(e.ownerElement&&"smart-pivot-table"===e.ownerElement.nodeName.toLowerCase()){const t=e.ownerElement._dynamicColumns;n=function(e){return"all"===e?t.map((e=>e.id)):t.filter((t=>t.dataFields[t.dataFields.length-1].dataField===e)).map((e=>e.id))}}else n=function(t){return"all"===t?e._columns.map((e=>e.va