smart-webcomponents-react
Version:
[](https://jqwidgets.com/license/)
6 lines (4 loc) • 133 kB
JavaScript
/* Smart UI v23.0.8 (2025-05-13)
Copyright (c) 2011-2024 jQWidgets.
License: https://htmlelements.com/license/ */ //
(()=>{Smart.Utilities.Assign("Grid.Cell",class{constructor(e,t){const l=this;if(l.row=e,l.column=t,l.grid=e.grid,l.rowSpan=1,l.colSpan=1,l.value=void 0,l.fontSize=null,l.fontWeight=null,l.fontFamily=null,l.fontStyle=null,l.color=null,l.background=null,l.textDecoration=null,l.tooltip=null,l.align=null,l.verticalAlign=null,l.readonly=!1,l.oldValue=void 0,l._updating=!1,l.styleChanged=!0,l.editor=null,l.template=null,l.isEditing=!1,l.canNotify=!0,l.selected=!1,l.focused=!1,l.error=!1,l.format=null,l.formula=null,e._style){const t=e._style;l.color=t.color,l.background=t.background,l.fontFamily=t.fontFamily,l.fontSize=t.fontSize,l.fontStyle=t.fontStyle,l.textDecoration=t.textDecoration,l.fontWeight=t.fontWeight}if(l.grid&&l.grid.formulas){let i=e.data[t.dataField];t.formula&&(l.formula=l._parseFormula(t.formula)),i&&(""+i).startsWith("=")&&(l.formula=l._parseFormula(""+i)),l._formula=t.formula}return new Proxy(l,{deleteProperty:function(e,t){return delete e[t],!0},get:function(i,a){if("value"===a){const i=l.column.displayField?l.row.data[l.column.displayField]:l.row.data[l.column.dataField];if(l.grid&&l.grid.formulas&&l.formula){const i=l.grid._formulaParser;if(i){if(l.grid&&l.grid.formulas&&l._formula!==t.formula){let i=e.data[t.dataField];t.formula&&(l.formula=l._parseFormula(t.formula)),i&&(""+i).startsWith("=")&&(l.formula=l._parseFormula(""+i)),l._formula=t.formula}return i.parse(l.formula.slice(1))}}return i}if("editor"===a||"template"===a)return i[a]||l.column[a];if("focused"===a){if(l.grid.selection.allowCellSelection&&l.grid._selection.focusedCell&&l.grid._selection.focusedCell.id===l.row.id&&l.grid._selection.focusedCell.dataField===l.column.dataField)return!(l.grid&&l.grid.dataSource.virtualDataSource&&!l.grid.dataSource.id)||l.grid._selection.focusedCell.id===l.row.index;if(l.grid.selection.allowRowSelection&&l.grid._selection.focusedCell&&l.grid._selection.focusedCell.id===l.row.id&&l.grid._selection.focusedCell.dataField===l.column.dataField)return!(l.grid&&l.grid.dataSource.virtualDataSource&&!l.grid.dataSource.id)||l.grid._selection.focusedCell.id===l.row.index;const e=l.parent();return!!(e&&l.grid.selection.allowCellSelection&&l.grid._selection.focusedCell&&l.grid._selection.focusedCell.id===e.row.id&&l.grid._selection.focusedCell.dataField===e.column.dataField)}if("selected"===a)return!0===l.row.getProperty("selected")||(!0===l.column.getProperty("selected")||!!l.grid._selection.cells["row"+l.row.id]&&l.grid._selection.cells["row"+l.row.id][l.column.dataField]);if("modifiedValue"===a){l.grid._cellsUpdatedValues||(l.grid._cellsUpdatedValues=[]);const e=l.grid._cellsUpdatedValues[l.row.id+"_"+l.column.dataField];return void 0!==e?e:i.value}return i[a]},set:function(e,i,a){const r=this.get(e,i);if(r===a)return!0;if(e[i]=a,"element"===i||"isEditing"===i||"oldValue"===i||"_updating"===i||"notifyFn"===i||i.startsWith("_")||"canNotify"===i)return!0;if("error"===i)return!0;if("focused"===i&&(l.grid._selection.focusedCell={id:l.row.id,dataField:l.column.dataField,value:l.value,index:l.row.index}),"colSpan"!==i&&"rowSpan"!==i||a>=0&&-1===l.grid._cellsMerge.indexOf(l)&&l.grid._cellsMerge.push(l),"row"===i||"column"===i||"grid"===i||"styleChanged"===i||"formula"===i)return"formula"===i&&(l.formula=l._parseFormula(l.formula)),!0;if("background"!==i&&"fontSize"!==i&&"fontWeight"!==i&&"fontFamily"!==i&&"textDecoration"!==i&&"color"!==i&&"fontStyle"!==i||(l.grid._cellStyles["row"+l.row.id]=!0,l.grid._cellStyles.length++,l._styleChanged=!0),"value"===i){void 0===l.oldValue&&(l.oldValue=r),null==a&&delete l._formula;(()=>{if(l.grid.dataSource.boundSource.canNotify=!1,null===a&&(l.column.allowNull||(a="number"===l.column.dataType||"int"===l.column.dataType||"float"===l.column.dataType||"integer"===l.column.dataType?0:"date"===l.column.dataType?new Date:"boolean"!==l.column.dataType&&"bool"!==t.dataType&&"")),void 0===a&&(a=null),null!==a&&void 0!==a.label&&void 0!==a.value)l.row.data[l.column.displayField]=a.label,l.row.data[l.column.dataField]=a.value;else if(l.column.valueField&&(l.row.data[l.column.valueField]=a),l.row.data[l.column.dataField]=a,l.column.displayField!==l.column.dataField&&"object"!=typeof a)if(l.column._dataSource){let e=a;for(let t=0;t<l.column._dataSource.length;t++)if(l.column._dataSource[t].value===a){e=l.column._dataSource[t].label;break}l.row.data[l.column.displayField]=e}else l.row.data[l.column.displayField]=a;const e=l.grid.dataSource.dataItemById[l.row.id];if(e){const t=e.$.index;l.grid.dataSource&&(null!==a&&a.label&&a.value&&l.column.displayField!==l.column.dataField?l.grid._sortedColumns&&l.grid._sortedColumns.length>0?(e[l.column.dataField]=a.value,e[l.column.displayField]=a.label):(l.grid.dataSource.boundSource[t][l.column.dataField]=a.value,l.grid.dataSource.boundSource[t][l.column.displayField]=a.label):a!==l.grid.dataSource.boundSource[t][l.column.dataField]&&(l.grid._sortedColumns&&l.grid._sortedColumns.length>0?e[l.column.dataField]=a:l.grid.dataSource.boundSource[t][l.column.dataField]=a))}l.grid.dataSource.boundSource.canNotify=!0,l.grid.onCellValueChanged&&a!==r&&l.grid.onCellValueChanged({id:l.row.id,dataField:l.column.dataField,value:a,oldValue:r})})()}return"selected"===i?(l.grid._selection.cells["row"+l.row.id]&&(delete l.grid._selection.cells["row"+l.row.id][l.column.dataField],1===Object.getOwnPropertyNames(l.grid._selection.cells["row"+l.row.id]).length&&delete l.grid._selection.cells["row"+l.row.id]),l.grid._selection.cells["column"+l.column.dataField]&&(delete l.grid._selection.cells["column"+l.column.dataField][l.row.id],1===Object.getOwnPropertyNames(l.grid._selection.cells["column"+l.column.dataField]).length&&delete l.grid._selection.cells["column"+l.column.dataField]),a&&(l.grid._selection.cells["row"+l.row.id]||(l.grid._selection.cells["row"+l.row.id]=[]),l.grid._selection.cells["column"+l.column.dataField]||(l.grid._selection.cells["column"+l.column.dataField]=[]),l.grid._selection.cells["row"+l.row.id][l.column.dataField]=!0,l.grid._selection.cells["column"+l.column.dataField][l.row.id]=!0),l.grid._recycle(!1,!0,!1),l.propertyChanged&&l.propertyChanged(name.substring(1),r),!0):!(!l._updating&&l.canNotify)||(l.grid._recycle(),!l.row.canNotify||(l.propertyChanged&&l.propertyChanged(name.substring(1),r),!0))}})}_parseFormula(e){const t=this.row;if(!e)return e;return"string"!=typeof e&&(e=""+e),!1===e.startsWith("=")&&(e="="+e),e=function(e,t){return e.replace(/COL\(([^)]+)\)/g,((e,l)=>`${l}${t}`))}(e,1+t.index)}setStyle(e){this.setProperties(e)}_setStyle(e){const t=this;if(t._styleChanged){if(!t.grid._cellStyles.length)return;let l="";const i={background:"background",color:"color",fontSize:"font-size",fontFamily:"font-family",fontWeight:"font-weight",fontStyle:"font-style",textDecoration:"text-decoration"},a=e=>{const a=t[e];if(""===a||null===a)return;const r=i[e];l+=`${r}: ${a};`},r=["background","color","fontSize","fontFamily","fontWeight","fontStyle","textDecoration"];for(let e=0;e<r.length;e++)a(r[e]);e.getAttribute("style")!==l&&(""===l?e.removeAttribute("style"):e.setAttribute("style",l)),""!==e.style.paddingBottom&&(e.style.paddingBottom=""),t._styleChanged=!1}t.grid&&!t.grid.appearance.showSelectionOnTop||t.selected&&(t.background||t.color)&&(e.style.background="",e.style.color="")}getFormattedValue(e,t){const l=this;if(null==e||""===e)return e;if(!t)return""+e;if(l.column._cellsCachedValues||(l.column._cellsCachedValues=[]),l.column._cellsCachedValues[""+e+t+l.column.grid.locale])return l.column._cellsCachedValues[""+e+t+l.column.grid.locale];if("date"===l.column.dataType||"datetime"===l.column.dataType||"time"===l.column.dataType){if("dateRangeInput"===l.column.editor.template){if(Array.isArray(e)){const i=l.formatDate(e[0],t)+" - "+l.formatDate(e[1],t);return l.column._cellsCachedValues[""+e+t+l.column.grid.locale]=i,i}{const i=l.formatDate(e,t);return l.column._cellsCachedValues[""+e+t+l.column.grid.locale]=i,i}}let i=l.formatDate(e,t);return"1/1/0001 12:00 AM"===i&&(i=""),l.column._cellsCachedValues[""+e+t+l.column.grid.locale]=i,i}if("int"===l.column.dataType||"int64"===l.column.dataType||"float"===l.column.dataType||"number"===l.column.dataType){let i=l.formatNumber(e,t);return"NaN"===i&&(i=""),l.column._cellsCachedValues[""+e+t+l.column.grid.locale]=i,i}if("any"===l.column.dataType||"string"===l.column.dataType&&t&&t.length){let i=!1;const a=""+e;if((a.indexOf("/")>=0||a.indexOf("-")>=0||a.indexOf(":")>=0)&&(t.indexOf("d")>=0&&t.indexOf("M")>=0&&(i=!0),(t.indexOf("d")>=0||t.indexOf("M")>=0||t.indexOf("y")>=0||t.indexOf("h")>=0||t.indexOf("H")>=0||t.indexOf("m")>=0)&&(i=!0)),i){let i=l.formatDate(e,t);return"1/1/0001 12:00 AM"===i&&(i=""),l.column._cellsCachedValues[""+e+t+l.column.grid.locale]=i,i}{"string"==typeof e&&(e=parseFloat(e));let i=l.formatNumber(e,t);return"NaN"===i&&(i=""),l.column._cellsCachedValues[""+e+t+l.column.grid.locale]=i,i}}return e}formatDate(e,t){if(!Smart.Utilities.DateTime)return e;const l=this,i=l.grid;if(l.column.formatSettings.Intl&&l.column.formatSettings.Intl.DateTimeFormat){return new Intl.DateTimeFormat(this.grid.locale,l.column.formatSettings.Intl.DateTimeFormat).format(e)}!t&&l.column.formatSettings.dateFormat&&(t=l.column.formatSettings.dateFormat);try{const l=new Smart.Utilities.DateTime(e);l.calendar.locale=i.locale,i.messages[i.locale]&&i.messages[i.locale].calendar&&(i.messages[i.locale].calendar.months&&(l.calendar.months=i.messages[i.locale].calendar.months),i.messages[i.locale].calendar.days&&(l.calendar.days=i.messages[i.locale].calendar.days),void 0!==i.messages[i.locale].calendar.firstDay&&(l.calendar.firstDay=i.messages[i.locale].calendar.firstDay),void 0!==i.messages[i.locale].calendar.eras&&(l.calendar.eras=i.messages[i.locale].calendar.eras),void 0!==i.messages[i.locale].calendar.AM&&(l.calendar.AM=i.messages[i.locale].calendar.AM),void 0!==i.messages[i.locale].calendar.PM&&(l.calendar.PM=i.messages[i.locale].calendar.PM),void 0!==i.messages[i.locale].calendar["/"]&&(l.calendar["/"]=i.messages[i.locale].calendar["/"]),void 0!==i.messages[i.locale].calendar[":"]&&(l.calendar[":"]=i.messages[i.locale].calendar[":"]),l.calendar.today=i.messages[i.locale].today);let a=l.toString(t);return a!==i.messages[i.locale].today||i.showTodayDateAsString||(l.showTodayDateAsString=!1,a=l.toString(t),delete l.showTodayDateAsString),a}catch(t){return e}}formatNumber(e,t){if(!Smart.Utilities.NumberRenderer)return e;const l=this,i=l.grid;if(l.column.formatSettings.Intl&&l.column.formatSettings.Intl.NumberFormat){if(l.column.formatSettings.Intl.NumberFormat.currency&&Smart.Utilities.CurrencyFormatter){const t=void 0!==l.column.formatSettings.Intl.NumberFormat.maximumFractionDigits?l.column.formatSettings.Intl.NumberFormat.maximumFractionDigits:2,i=(new Smart.Utilities.CurrencyFormatter).format(e,{decimalPlaces:t,currency:l.column.formatSettings.Intl.NumberFormat.currency});return"accounting"===l.column.formatSettings.Intl.NumberFormat.currency.currencySign&&e<0?"("+i.replace("-","")+")":i}if(l.column.formatSettings.Intl.NumberFormat.locale){return new Intl.NumberFormat(l.column.formatSettings.Intl.NumberFormat.locale,l.column.formatSettings.Intl.NumberFormat).format(e)}{const t=new Intl.NumberFormat(this.grid.locale,l.column.formatSettings.Intl.NumberFormat).format(e);return"squaremeter"===l.column.formatSettings.Intl.NumberFormat.type?t+" m²":"cubicmeter"===l.column.formatSettings.Intl.NumberFormat.type?t+" m³":t}}const a=new Smart.Utilities.NumberRenderer;if(a.localizationObject){const e=l.column.formatSettings,t=i.messages[i.locale]?i.messages[i.locale].calendar:{};e.decimalPlaces&&(a.localizationObject.decimalPlaces=e.decimalPlaces),(e.decimalSeparator||t.decimalSeparator)&&(a.localizationObject.decimalSeparator=e.decimalSeparator||t.decimalSeparator,a.localizationObject.decimalseparator=a.localizationObject.decimalSeparator),(e.thousandsSeparator||t.thousandsSeparator)&&(a.localizationObject.thousandsSeparator=e.thousandsSeparator||t.thousandsSeparator,a.localizationObject.thousandsseparator=a.localizationObject.thousandsSeparator),a.localizationObject.currencysymbol=t.currencySymbol,a.localizationObject.currencysymbolposition=t.currencySymbolPosition,e.prefix&&(a.localizationObject.currencysymbol=e.prefix),e.sufix&&(a.localizationObject.currencysymbol=e.sufix,a.localizationObject.currencysymbolposition="after")}const r=a.formatNumber(e,t);return void 0===r?e:e<0&&l.column.formatSettings.negativeWithBrackets?"("+r+")":r}refresh(){const e=this;if(e.element){const t=e.element.firstChild;e._setStyle(t)}}autoWrap(){const e=this;e.element&&e.element._autoWrap()}setProperties(e){const t=this;t._updating=!0;for(let l in e)t[l]=e[l];t._updating=!1,t.grid._recycle()}createElement(){const e=document.createElement("smart-grid-cell");return e.setAttribute("role","gridcell"),this.element=e,e._initialize(this),e}render(){this.element&&this.element._render()}parent(e){const t=this,l=t.row,i=t.column.dataField,a=t.grid;if(!a._cellsMerge.length)return null;if(t.__parentCells&&void 0!==t.__parentCells["row"+l.id+"_column_"+i])return t.__parentCells["row"+l.id+"_column_"+i];let r=a.getVisibleRows();a.paging.enabled&&"page"===a.selection.selectAllMode&&(r=r.slice(a.paging.pageIndex*a.paging.pageSize,(a.paging.pageIndex+1)*a.paging.pageSize)),t.__parentCells||(t.__parentCells=[]);for(let n=0;n<a._cellsMerge.length;n++){const s=a._cellsMerge[n];let o=[],d=[];if(o.push(s.row),s.rowspan>1){const e=r.indexOf(s.row);if(e>=0)for(let t=e;t<e+s.rowSpan;t++)r[t]&&-1===o.indexOf(r[t])&&o.push(r[t])}if(d.push(s.column.dataField),s.colspan>1){const e=a.columns.indexOf(a.columnByDataField[s.column.dataField]);for(let t=e;t<e+s.colSpan;t++)a.columns[t]&&-1===d.indexOf(a.columns[t].dataField)&&d.push(a.columns[t].dataField)}if(o.indexOf(l)>=0&&d.indexOf(i)>=0){if(e){const e={cell:s.row.getCell(s.column.dataField),rows:o,columns:d,row:s.row,column:s.column,endRow:o[o.length-1],endColumn:a.columnByDataField[d[d.length-1]]};return t.__parentCells["row"+l.id+"_column_"+i]=e,e}const r=s.row.getCell(s.column.dataField);return t.__parentCells["row"+l.id+"_column_"+i]=r,r}}return t.__parentCells["row"+l.id+"_column_"+i]=null,null}}),Smart("smart-grid-cell",class extends Smart.BaseElement{static get properties(){return{}}get hasStyleObserver(){return!1}get enableShadowDOM(){return!1}addThemeClass(){}addDefaultClass(){}get isUtilityElement(){return!0}_createTooltip(e,t,l,i){const a=this.cell.grid;if(!a)return;let r={left:e.pageX,top:e.pageY-10};if(!a._cellTooltip){const e=document.createElement("smart-button");e.classList.add("secondary"),e.style.boxShadow="var(--smart-elevation-4)",e.style.opacity=.9,e.style.transition="all cubic-bezier(0.6, 0.2, 0, 0.8) 0.2s",e.style.setProperty("--smart-button-text-transform","normal"),document.body.appendChild(e),e.style.position="absolute",e.style.zIndex=99999999,a._cellTooltip=e}const n=a._cellTooltip;n.innerHTML===t&&n.element===l||(n.innerHTML=""+t,n.style.display="",n.style.visibility="","top"===i?(r=a.offset(l),n.style.top=r.top-n.offsetHeight-5+"px",n.style.left=r.left+l.offsetWidth/2-n.offsetWidth/2+"px"):(n.style.top=r.top+25+"px",n.style.left=r.left-15+"px")),n.innerHTML=""+t,n.style.display="",n.style.visibility=""}_refresh(){const e=this;e.innerHTML="",e._initialize(e.cell)}_createToggleButton(e,t){const l=this,i=document.createElement("div"),a=document.createElement("button"),r=document.createElement("div"),n=document.createElement("div"),s=document.createElement("div"),o=document.createElement("span"),d=t.grid;t.row.expanded?a.setAttribute("toggled",""):a.removeAttribute("toggled",""),a.tabIndex=-1,l.toggleButton=a,l.checkbox=s,e.appendChild(i),e.appendChild(n),n.setAttribute("content",""),i.setAttribute("indent",""),r.setAttribute("label",""),a.setAttribute("toggle-button",""),s.setAttribute("checkbox",""),s.setAttribute("role","checkbox"),l.setAttribute("has-toggle-button",""),n.appendChild(a),n.appendChild(s),o.classList.add("smart-input"),s.appendChild(o),d.checkBoxes.visible?o.classList.remove("smart-hidden"):o.classList.add("smart-hidden"),n.appendChild(r),l.content=r}_initialize(e){const t=this,l=document.createElement("div"),i=e.column,a=e.grid;t._properties=[],t.cell=e,t.appendChild(l);let r=!1;if(i&&i._treeColumn&&a.dataSource.boundHierarchy&&(r=!0,e.row.filterRow&&(r=!1),!a.grouping.enabled&&a.dataSource.groupBy&&a.dataSource.groupBy.length>0&&(r=!1),a.grouping.enabled&&a.dataSource.groupBy&&0===a.dataSource.groupBy.length&&(r=!1)),r)return t._createToggleButton(l,e),void(t.isRendered=!0);{const e=document.createElement("div");l.appendChild(e)}t.content=l,t.isRendered=!0}_renderCommands(){const e=this,t=e.cell.grid;if(t.__cellsCommandTemplate)return e.firstChild.innerHTML=t.__cellsCommandTemplate,void t._updateCommandColumnCommandsVisibility(e.firstChild,e.cell.row);const l=t._getCommandColumnCommandsTemplate();e.firstChild.innerHTML=l,t._updateCommandColumnCommandsVisibility(e.firstChild,e.cell.row),t.__cellsCommandTemplate=l}_renderGroupCell(){const e=this,t=e.cell.grid,l=e.cell.column,i=e.cell.row;[...e.attributes].forEach((t=>e.removeAttribute(t.name))),e.setAttribute("group","");const a=l===t._firstRenderedColumn;e.style.width!==l.computedWidth+"px"&&(e.style.width=l.computedWidth+"px"),a||(t.rightToLeft?e.style.right!==l.left+"px"&&(e.style.right=l.left+"px"):e.style.left!==l.left+"px"&&(e.style.left=l.left+"px")),e.classList.contains("smart-hidden")&&e.classList.remove("smart-hidden"),l===t._firstRenderedColumn||i.summaryRow||e.classList.add("smart-hidden"),l.autoGenerated&&(e.style.width="0px");let r=i.label;const n=function(e,t,l){if(!t)return[];for(let i=0;i<t.length;i++){const a=t[i];a.$&&!1===a.$.filtered||(void 0!==a[e]&&l.push(a),a.summaryRow||(a.children||a.data&&a.data.children)&&n(e,a.children,l))}return l};let s="";if(void 0!==i.label){let o="",d=[];if(t.grouping.summaryRow.visible){let r=[];const s={},c=a?l.summary.length>0?l.summary:["count"]:l.summary;c.length&&(r=n(l.dataField,i.summaryRow?i.parent.data.children:i.data.children,[])),s[l.dataField]=c;const m=c.length>0?t.dataSource.summarize([s],r):null;if(m)for(let r=0;r<c.length;r++){const n=c[r];r>0&&(o+=", ");let u=m[l.dataField][n];const p=l.cellsFormat;if(void 0!==u){if(p&&(u=e.cell.getFormattedValue(u,p)),a){const a=t.columnByDataField[i.groupDataField];if(a){s[a.dataField]=c,m[a.dataField]=m[l.dataField],u=m[a.dataField][n];const t=a.cellsFormat;t&&(u=e.cell.getFormattedValue(u,t))}}o+=t.localize(n,{value:u}),m[l.dataField]&&m[l.dataField][n]&&d.push(m[l.dataField][n])}}}if(t.dataSource.virtualDataSourceOnExpand&&(o=""),a){const l=t.columnByDataField[i.groupDataField],a=l?l.label:"";if("advanced"===t.grouping.renderMode){if(i.summaryRow)r="<div header group-advanced><span group></span><span value></span>",o&&(r+="<div summary>",r+=o,r+="</div>");else{let e=i.label?i.label:t.localize("blankSummary");i.label||"taskStatus"!==i.groupDataField||(e="");let n="";if(l&&l.editor&&l.editor.dataSource){const t=l.editor.dataSource.find((t=>t.value===e||t.label===e));t&&t.color?(n=`--smart-primary: ${t.color}`,t.label&&(e=t.label)):t&&t.label&&(e=t.label)}if(i.label||"taskStatus"!==i.groupDataField||(e=t.localize("uncategorized")),"object"==typeof e&&l.cellsFormat){const t=i.getCell(l.dataField);e=t.getFormattedValue(e,l.cellsFormat)}else if("object"==typeof e&&e&&e instanceof Date){const t=i.getCell(l.dataField);e=t.getFormattedValue(e,"d")}const s=t.editing.addNewRow.visible?'<span add-row class="smart-grid-icon smart-icon-plus-circled show"></span>':"";if(r=`<div style="${n}" header group-advanced><span group>${s}${a}: </span><span value>${e}</span>`,e=""+e,e&&e.indexOf(",")>=0){let t="";r=`<div style="display: flex;" header group-advanced><span group>${s}${a}: </span>`;let i=e.split(",");for(let e=0;e<i.length;e++){let a=i[e].trim();if(l&&l.editor&&l.editor.dataSource){const e=l.editor.dataSource.find((e=>e.value===a||e.label===a));e&&e.color?(n=`--smart-primary: ${e.color}`,e.label&&(a=e.label)):e&&e.label&&(a=e.label),t+=`<span style="${n}" value>${a}</span>`}}r+=t}o&&t.grouping.summaryRow.inline&&(r+="<span summary>",r+=""+o,r+="</span>")}r+="</div>",e.classList.add("smart-grid-column-border-collapse")}else if("compact"===t.grouping.renderMode){if(i.summaryRow)r="<div header><span group></span><span value></span>",o&&(r+="<div summary>",r+=o,r+="</div>");else{let e=i.label;if(l.displayField!==l.dataField&&i.data.data&&(e=i.data.data[l.displayField]),"object"==typeof e&&l.cellsFormat){e=i.getCell(l.dataField).getFormattedValue(e,l.cellsFormat)}r="<div header><span group>"+a+": </span><span value>"+e+"</span>",o&&t.grouping.summaryRow.inline&&(r+="<span summary>",r+=" ("+d+")",r+="</span>")}r+="</div>",e.classList.add("smart-grid-column-border-collapse")}else if("basic"===t.grouping.renderMode){if(r=i.label,l.displayField!==l.dataField&&i.data.data&&(r=i.data.data[l.displayField]),"object"==typeof r&&l.cellsFormat){r=i.getCell(l.dataField).getFormattedValue(r,l.cellsFormat)}i.summaryRow?o&&(r+="<div summary>",r+=o,r+="</div>"):o&&t.grouping.summaryRow.inline&&(r+="<span summary>",r+=" ("+d+")",r+="</span>"),e.classList.add("smart-grid-column-border-collapse")}else if("multipleColumns"===t.grouping.renderMode){if(r=i.label,"object"==typeof r&&l.cellsFormat){r=i.getCell(l.dataField).getFormattedValue(r,l.cellsFormat)}i.summaryRow?o&&(r+="<div summary>",r+=o,r+="</div>"):o&&t.grouping.summaryRow.inline&&(r+="<span summary>",r+=" ("+d+")",r+="</span>"),e.classList.add("smart-grid-column-border-collapse")}e.setAttribute("has-toggle-button","")}else e.removeAttribute("has-toggle-button",""),r=o;s=o}let o=e.firstChild;if(t.dataSource.boundHierarchy&&a){o.children.length<=1&&(e.innerHTML="<div></div>",o=e.firstChild,e._createToggleButton(o,e.cell),o=e.firstChild);const n=o.children[0],s=o.children[1].children[0],d=o.children[1].children[1].firstChild,c=o.children[1].children[2];n.setAttribute("indent",""),i.checked?d.setAttribute("checked",""):!1===i.checked?d.removeAttribute("checked"):null===i.checked&&d.setAttribute("checked","indeterminate"),i.leaf?s.classList.add("smart-visibility-hidden"):(s.classList.remove("smart-visibility-hidden"),i.expanded?s.setAttribute("toggled",""):s.removeAttribute("toggled",""));let m="";if(!l._treeColumn||i.summaryRow||i.filterRow?e.toggleButton.classList.add("smart-hidden"):e.toggleButton.classList.remove("smart-hidden"),l._treeColumn)if(t.grouping.enabled){let e=i.level-1;if(1+e===0)m+="",n.classList.add("smart-hidden");else{if("multipleColumns"===t.grouping.renderMode){let l=0;for(let i=0;i<t.columns.length;i++)i<1+e&&(l+=t.columns[i].computedWidth);m+='<div style="width: '+l+'px;"></div>'}else m+='<div style="width: '+(1+e)*t.grouping.groupIndent+'px;"></div>';n.classList.remove("smart-hidden")}}else for(let e=0;e<i.level;e++)m+="<div class='smart-indent'></div>";if(void 0===i.label||i.summaryRow||i.filterRow?s.classList.add("smart-hidden"):(s.classList.remove("smart-hidden"),s.style.marginLeft=""),n.innerHTML=m,c.innerHTML=r,a&&t.grouping.formatFunction){const a={row:i,column:l,groupDataField:i.groupDataField,cell:e.cell,value:r,template:null},n=t.grouping.formatFunction(a);n&&(a.value=n),a.value!==r?c.innerHTML=a.value:a.template&&(c.innerHTML=a.template)}t.appearance.showTooltips?c.setAttribute("title",i.label?i.label:t._unescapeString(r)):c.hasAttribute("title")&&c.removeAttribute("title")}else void 0!==i.label&&t.grouping.enabled&&!a&&(o.innerHTML=r,l.summary.length&&t.grouping.summaryRow.inline&&r&&e.classList.remove("smart-hidden"));void 0!==i.label&&t.grouping.enabled&&a&&!l._treeColumn&&l.summary.length&&t.grouping.summaryRow.inline&&r&&(t.rightToLeft||e.style.left!==l.left+"px"&&(e.style.left=l.left+"px"),e.removeAttribute("has-toggle-button",""),r=s,o.innerHTML=r);let d="smart-label";e.style.zIndex="";const c=t.editing.addNewColumn.visible&&t._addNewColumn?t._addNewColumn.width-1:0;if(a){const l=t.columnByDataField[i.groupDataField];l&&(l.cellsAlign&&(d+=" align-"+l.cellsAlign),l.cellsVerticalAlign&&(d+=" align-"+l.cellsVerticalAlign)),e.setAttribute("header",""),i.summaryRow||(e.style.width="calc(100% - "+c+"px)"),void 0!==i.label&&(e.style.zIndex=11)}else l===t._firstRenderedColumn&&(e.style.zIndex=4),e.setAttribute("header",""),i.summaryRow||(e.style.width="calc(100% - "+c+"px)"),l.summary.length&&t.grouping.summaryRow.inline&&r&&(e.style.width=l.computedWidth+"px",e.style.zIndex=11,e.classList.add("smart-grid-column-border-collapse"),l.cellsAlign&&(d+=" align-"+l.cellsAlign),l.cellsVerticalAlign&&(d+=" align-"+l.cellsVerticalAlign));if(i.summaryRow&&(e.setAttribute("header",""),e.classList.add("smart-grid-column-border-collapse"),l.cellsAlign&&(d+=" align-"+l.cellsAlign),l.cellsVerticalAlign&&(d+=" align-"+l.cellsVerticalAlign)),o.className!==d&&(o.className=d),l.formatFunction){const t={row:i,column:l,cell:e.cell,value:null,template:null,group:{value:r,template:null}},a=l.formatFunction(t);if(a&&(t.group.value=a),t.group.value!==r)if(l._treeColumn){o.children[1].children[2].innerHTML=t.group.value}else o.innerHTML=t.group.value;null!==t.group.template&&(o.innerHTML=t.group.template)}}_renderFilterCell(e){const t=this,l=t.cell.grid,i=t.cell.column;let a;const r=(e,t)=>{l._handleFilterMenuClick(e,t)};l._filterInfo||(l._filterInfo={},l._filterInfo.stringConditions=[{icon:"smart-icon-contains",command:r,value:"CONTAINS",label:l.localize("CONTAINS")},{icon:"smart-icon-does-not-contain",command:r,value:"DOES_NOT_CONTAIN",label:l.localize("DOES_NOT_CONTAIN")},{icon:"smart-icon-starts-with",command:r,value:"STARTS_WITH",label:l.localize("STARTS_WITH")},{icon:"smart-icon-ends-with",command:r,value:"ENDS_WITH",label:l.localize("ENDS_WITH")},{icon:"smart-icon-equals",command:r,value:"EQUAL",label:l.localize("EQUAL")},{icon:"smart-icon-delete",command:r,value:"CLEAR_FILTER",label:l.localize("CLEAR_FILTER")}],l._filterInfo.numberAndDateConditions=[{icon:"smart-icon-equals",command:r,value:"EQUAL",label:l.localize("EQUAL")},{icon:"smart-icon-not-equal",command:r,value:"NOT_EQUAL",label:l.localize("NOT_EQUAL")},{icon:"smart-icon-less-than",command:r,value:"LESS_THAN",label:l.localize("LESS_THAN")},{icon:"smart-icon-less-than-equal",command:r,value:"LESS_THAN_OR_EQUAL",label:l.localize("LESS_THAN_OR_EQUAL")},{icon:"smart-icon-greater-than",command:r,value:"GREATER_THAN",label:l.localize("GREATER_THAN")},{icon:"smart-icon-greater-than-equal",command:r,value:"GREATER_THAN_OR_EQUAL",label:l.localize("GREATER_THAN_OR_EQUAL")},{icon:"smart-icon-between",command:r,value:"RANGE",label:l.localize("RANGE")},{icon:"smart-icon-delete",command:r,value:"CLEAR_FILTER",label:l.localize("CLEAR_FILTER")}]);const n=l._getFilterDataType(i);a="string"===n?l._filterInfo.stringConditions:l._filterInfo.numberAndDateConditions;let s="smart-icon-search";if(i._filterInfo||(i._filterInfo={condition:""}),i.filterEditor&&i.filterEditor.condition&&(i._filterInfo.condition=i.filterEditor.condition),i.filterEditor&&i.filterEditor.value&&(i._filterInfo.value=i.filterEditor.value),i._filterInfo.dataSource=a,null===i._filterInfo.condition||void 0===i._filterInfo.condition)i._filterInfo.condition="",s="smart-icon-search";else switch(i._filterInfo.condition.toLowerCase()){case"equal":s="smart-icon-equals";break;case"starts_with":s="smart-icon-starts-with";break;case"ends_with":s="smart-icon-ends-with";break;case"not_equal":s="smart-icon-not-equal";break;case"less_than":s="smart-icon-less-than";break;case"less_than_or_equal":s="smart-icon-less-than-or-equal";break;case"greater_than":s="smart-icon-greater-than";break;case"greater_than_or_equal":s="smart-icon-greater-than-or-equal";break;case"contains":s="smart-icon-contains";break;case"does_not_contain":s="smart-icon-does-not-contain";break;case"range":s="smart-icon-between";break;default:s="smart-icon-search"}let o=`<div class="smart-filter-input-type"><i class="smart-grid-icon ${s} show"></i></div> `;if("string"===n)o+=`<input class="smart-filter-input-value" data-type="${n}" /> `,e.innerHTML=o;else if("date"===i.dataType){const a=new Smart.Utilities.DateTime;o+=`<input placeholder = "${a.expandFormat(a.calendar,i.cellsFormat||"d")}" class="smart-filter-input-value" data-type="${i.dataType}"/><div class="smart-filter-input-type"><i class="smart-grid-icon smart-icon-calendar show"></i></div>`,e.innerHTML=o,e.lastElementChild.onpointerdown=function(){l._handleFilterCalendarCellClick(t.cell)}}else if("number"===i.dataType)o+='<div class="smart-grid-cell-editor smart-filter-input-value smart-grid-number-input-cell-editor"><input class="smart-input" type="number"><div tabindex="-1" class="nav"><div tabindex="-1" class="up"></div><div tabindex="-1" class="down"></div></div></div>',e.innerHTML=o,l._handleFilterNumberCellEditor(this.cell,e);else if("boolean"===i.dataType||"bool"===i.dataType){const a=document.createElement("div");a.classList.add("smart-input"),a.classList.add("smart-grid-check-box-cell-editor"),a.classList.add("smart-filter-input-value"),e.tabIndex=0,e.style.outline="none",t.setAttribute("template","checkBox"),a.setAttribute("checked","indeterminate"),i._filterInfo&&i._filterInfo.value?a.setAttribute("checked",""):i._filterInfo&&!1===i._filterInfo.value&&a.removeAttribute("checked"),o=a.outerHTML,e.innerHTML=o,e.classList.add("align-center"),e.classList.add("smart-label"),e.onfocus=()=>{e.setAttribute("focus","")},e.onblur=()=>{e.removeAttribute("focus","")},e.onclick=e=>{e.target.classList.contains("smart-input")&&l._handleFilterCellCheckBoxClick(this.cell)}}const d=e.querySelector("input");if(d&&(e.firstElementChild.onpointerdown=function(){l._handleFilterCellIconClick(this.cell)}.bind(this),d.onpaste=function(e){setTimeout((()=>{l._handleFilterCellKeyUp(this.cell,e)}))}.bind(this),d.onfocus=function(){l._handleFilterCellFocus(this.cell)}.bind(this),d.onblur=function(){l._handleFilterCellBlur(this.cell)}.bind(this),d.onkeyup=function(e){l._handleFilterCellKeyUp(this.cell,e)}.bind(this),d.onkeydown=function(e){l._handleFilterCellKeyDown(this.cell,e)}.bind(this)),e.classList.add("smart-filter-input-container"),i._filterInfo.input=d,i._filterInfo.cell=t.cell,i._filterInfo.editor=e,i._filterInfo.value&&d&&(d.value=i._filterInfo.value,"date"===i.dataType&&(d.value=t.cell.getFormattedValue(i._filterInfo.value,i.cellsFormat))),e.removeAttribute("disabled"),i.allowFilter||(d.disabled=!0,e.setAttribute("disabled","")),i.filterEditor)if(i.filterEditor.template){const t=i.filterEditor.template,l=document.createElement("div");i.filterTemplate instanceof HTMLTemplateElement?l.appendChild(t.content.cloneNode(!0)):t instanceof HTMLElement?l.appendChild(t):l.innerHTML=t,e.innerHTML="",e.appendChild(l),l.style.height="100%",l.style.width="100%";const a=e.querySelector("input");a&&(a.onfocus=()=>{e.setAttribute("focus","")},a.onblur=()=>{e.removeAttribute("focus","")}),i.filterEditor.onInit&&i.filterEditor.onInit(i,l)}else void 0!==i.filterEditor.min&&(d.min=i.filterEditor.min),void 0!==i.filterEditor.max&&(d.max=i.filterEditor.max),void 0!==i.filterEditor.minLength&&(d.minLength=i.filterEditor.minLength),void 0!==i.filterEditor.maxLength&&(d.maxLength=i.filterEditor.maxLength),void 0!==i.filterEditor.placeholder&&(d.placeholder=i.filterEditor.placeholder),void 0!==i.filterEditor.value&&(d.value=i.filterEditor.value),void 0!==i.filterEditor.step&&(d.step=i.filterEditor.step),void 0!==i.filterEditor.disabled&&(d.disabled=i.filterEditor.disabled),void 0!==i.filterEditor.condition&&(i._filterInfo.condition=i.filterEditor.condition),i.filterEditor.onInit&&i.filterEditor.onInit(i,e)}_setTemplate(t,l,i){const a=this,r=a.cell.grid,n=a.cell.column;r._cellCachedValues||(r._cellCachedValues=[]);const s=()=>!!r._cellCachedValues[n.dataField+"_"+t]&&(i.innerHTML!==r._cellCachedValues[n.dataField+"_"+t]&&(i.innerHTML=r._cellCachedValues[n.dataField+"_"+t]),a.cell._setStyle(i),a.setAttribute("template",a.cell.template),!0);let o=null;switch((!r.editing.enabled||!n.allowEdit||a.cell.readonly||"none"===r.editing.action||r.editing.enabled&&r.editing.commandColumn.visible&&r.editing.editRow!==a.cell.row)&&a.setAttribute("readonly",""),l){case"checkBox":case"radioButton":case"switchButton":if(i.firstElementChild&&i.firstElementChild.classList&&i.firstElementChild.classList.contains("smart-input")){if(o=i.firstElementChild,t?o.setAttribute("checked",""):null===t?o.setAttribute("checked","indeterminate"):o.removeAttribute("checked"),a.setAttribute("template",a.cell.template),o.removeAttribute("icon"),o.removeAttribute("color"),o.style.setProperty("--smart-check-template-color","var(--smart-primary)"),a.cell.column.templateSettings&&a.cell.column.templateSettings.icon){if("ok-squared"!==a.cell.column.templateSettings.icon)o.setAttribute("icon",a.cell.column.templateSettings.icon);else{const e=new Smart.Color(a.cell.column.templateSettings.color).getInvertedColor();o.style.setProperty("--smart-check-template-forecolor",e)}o.style.setProperty("--smart-check-template-color",a.cell.column.templateSettings.color),o.setAttribute("color","")}return void a.cell._setStyle(i)}if(o=document.createElement("span"),o.className="smart-input",t?o.setAttribute("checked",""):null===t?o.setAttribute("checked","indeterminate"):o.removeAttribute("checked"),a.setAttribute("template",a.cell.template),o.removeAttribute("icon"),o.removeAttribute("color"),o.style.setProperty("--smart-check-template-color","var(--smart-primary)"),a.cell.column.templateSettings&&a.cell.column.templateSettings.icon){if("ok-squared"!==a.cell.column.templateSettings.icon)o.setAttribute("icon",a.cell.column.templateSettings.icon);else{const e=new Smart.Color(a.cell.column.templateSettings.color).getInvertedColor();o.style.setProperty("--smart-check-template-forecolor",e)}o.setAttribute("color",""),o.style.setProperty("--smart-check-template-color",a.cell.column.templateSettings.color)}i.innerHTML="",i.appendChild(o),a.cell._setStyle(i);break;case"checklist":if(t&&t.indexOf("[")>=0&&(t=JSON.parse(t)),i.firstElementChild&&i.firstElementChild.hasAttribute("value")){const e=i.firstElementChild.getAttribute("value");if(t&&e===t.length)return a.cell._setStyle(i),void a.setAttribute("template",a.cell.template)}if(t&&Array.isArray(t)&&t.length>0){const e=t.filter((e=>e.completed)).length,l=["#D50000","#F4511E","#F6BF26","#33B679"],i=e+"/"+t.length;let a=l[0];e===t.length?a=l[3]:e>0&&e<t.length&&(a=l[2]),t=`<div style="display: grid; grid-template-columns: 25px auto"><div style="margin-left: 4px; align-self: center; border-radius: 50%; display: flex; align-content: center; background: ${a}; width:16px; height: 16px;"><span title="${i}" style="align-content: center; font-size: 13px; color: white;" class="smart-grid-icon show smart-icon-check"></span></div>${i}</span></div>`}else t="";o=document.createElement("span"),o.innerHTML=t,a.setAttribute("template",a.cell.template),o.setAttribute("value",t.length);break;case"createdBy":case"updatedBy":{const e=a.cell.row;let t=null,s=null;if(t="createdBy"===l?e.createdBy:e.updatedBy,e.history&&e.history.length&&(t="createdBy"===l?e.history[0].user:e.history[e.history.length-1].user),i.firstElementChild&&i.firstElementChild.hasAttribute("user-id")){if(t===parseInt(i.firstElementChild.getAttribute("user-id")))return a.cell._setStyle(i),void a.setAttribute("template",a.cell.template);if(null!=t&&-1!==t){s=r.users.find((e=>e.id===t));const e=s;if(e){const l=i.firstElementChild.firstElementChild&&i.firstElementChild.firstElementChild.firstElementChild?i.firstElementChild.firstElementChild.firstElementChild.firstElementChild:null;if(l){i.firstElementChild.setAttribute("user-id",t);const a="string"==typeof e?e:e.name,r="string"==typeof e?null:e.color;if(("string"==typeof e?null:e.image)&&(l.firstElementChild.style.backgroundImage=`url('${e.image}')`),r){const e=new Smart.Color(r).getInvertedColor();l.setAttribute("data-item",a),l.setAttribute("title",a),l.setAttribute("backgroundColor",r),l.setAttribute("color",e),l.lastElementChild.textContent=a}else l.setAttribute("data-item",a),l.setAttribute("title",a),l.setAttribute("backgroundColor",""),l.setAttribute("color","");return}}}}const d=document.createElement("div");d.classList.add("smart-multi-combo-input"),d.setAttribute("data-field",n.dataField),d.setAttribute("row-id",a.cell.row.id),d.style.width="100%",d.style.paddingRight="6px";let c='<div class="smart-flex smart-flex-auto smart-tokens-layout">';if(null!=t&&-1!==t){s=r.users.find((e=>e.id===t));const e=s;if(e){const t="string"==typeof e?e:e.name,l="string"==typeof e?null:e.color,i="string"==typeof e?null:e.image,a=document.createElement("span");if(i&&(a.style.backgroundImage=`url('${e.image}')`,a.className="smart-drop-down-list-selection-image"),l){c+='<span title="'+t+'" data-item="'+t+'" style="background: '+l+"; color: "+new Smart.Color(l).getInvertedColor()+'; overflow: visible;" class="smart-truncate smart-token">'+a.outerHTML+"<span class='smart-drop-down-list-selection-label' role=\"presentation\">"+t+"</span></span>"}else c+='<span title="'+t+'" data-item="'+t+'" class="smart-truncate smart-token">'+a.outerHTML+"<span class='smart-drop-down-list-selection-label' role=\"presentation\">"+t+"</span></span>"}else c=""}d.innerHTML=c+"</div>";const m=document.createElement("div");m.classList.add("smart-multi-combo-input-container","tokens","smart-flex","smart-flex-auto"),d.classList.add("smart-flex-auto"),m.appendChild(d),o=m,o.setAttribute("user-id",t),a.setAttribute("template",a.cell.template);break}case"collaborator":case"tags":{let e=[];"number"==typeof t&&(t=""+t);let d=!1===r.editing.enabled?"smart-visibility-hidden":"";!0!==r.editing.enabled||a.cell.column.allowEdit||(d="smart-visibility-hidden");let c=n.editor.dataSource&&n.editor.dataSource.length;if(n.editor.collaborator&&(c=r.users&&r.users.length),c||(d="smart-visibility-hidden"),""===t||null===t||"uncategorized"===t){let e=`\n <div class="smart-multi-combo-input-container tokens smart-flex smart-flex-auto" data-field="${n.dataField}" row-id="${a.cell.row.id}"> \n <div class="smart-multi-combo-input" data-field="${n.dataField}" row-id="${a.cell.row.id}" class="tokens smart-flex smart-flex-auto">\n <div class=" smart-flex-auto smart-flex"></div>\n </div>\n <span class="smart-arrow-down arrowbtn ${d}"></span>\n </div>\n `;i.innerHTML!==e&&(i.firstElementChild&&i.firstElementChild.firstElementChild&&i.firstElementChild.firstElementChild.firstElementChild&&""===i.firstElementChild.firstElementChild.firstElementChild.textContent?(i.firstElementChild.setAttribute("row-id",a.cell.row.id),i.firstElementChild.firstElementChild.setAttribute("row-id",a.cell.row.id)):i.innerHTML=e);const t=i.querySelector(".smart-arrow-down");return t&&(t.onpointerdown=e=>{if(r.editing.enabled&&a.cell.column.allowEdit){const t=e.target.previousElementSibling,l=t.getAttribute("data-field"),i=t.closest("smart-grid-row").getAttribute("data-id");r.beginEdit(i,l)}e.stopPropagation(),e.preventDefault()}),a.cell._setStyle(i),void a.setAttribute("template",a.cell.template)}if(s()){const e=i.querySelector(".smart-arrow-down");if(e){const t=n.editor.dots;if(i.firstElementChild&&i.firstElementChild.firstElementChild&&i.firstElementChild.firstElementChild.firstElementChild&&(i.firstElementChild.firstElementChild.firstElementChild.classList.remove("smart-flex-wrap"),i.firstElementChild.firstElementChild.firstElementChild.firstElementChild)){const e=i.firstElementChild.firstElementChild.firstElementChild.firstElementChild.firstElementChild;t?e.classList.add("dots"):e.classList.remove("dots")}e.onpointerdown=e=>{if(r.editing.enabled&&a.cell.column.allowEdit){const t=e.target.previousElementSibling,l=t.getAttribute("data-field"),i=t.closest("smart-grid-row").getAttribute("data-id");r.beginEdit(i,l)}e.stopPropagation(),e.preventDefault()}}return}if(null!==t&&(e=Array.isArray(t)?e.map((e=>e.trim())):t.indexOf("{")>=0||"[]"===t?JSON.parse(t):t.split(",").map((e=>e.trim()))),i.firstElementChild&&i.firstElementChild.hasAttribute("value")&&n.editor._items){if(i.firstElementChild.getAttribute("value")===t){a.cell._setStyle(i),a.setAttribute("template",a.cell.template);const e=n.editor.dots;if(i.firstElementChild&&i.firstElementChild.firstElementChild&&i.firstElementChild.firstElementChild.firstElementChild){if(i.firstElementChild.firstElementChild.firstElementChild.classList.remove("smart-flex-wrap"),i.firstElementChild.firstElementChild.firstElementChild.firstElementChild){const t=i.firstElementChild.firstElementChild.firstElementChild.firstElementChild.firstElementChild;e?t.classList.add("dots"):t.classList.remove("dots")}if(a.cell.row.height>45){i.firstElementChild.firstElementChild.firstElementChild.classList.add("smart-flex-wrap");const e=i.firstElementChild.firstElementChild.firstElementChild;if(e.children&&e.children.length>1)for(let t=0;t<e.children.length;t++)e.children[t].style.maxWidth&&(e.children[t].style.maxWidth="")}else if(r.layout.rowHeight<=45&&a.cell.row.height<=45){const e=i.firstElementChild.firstElementChild.firstElementChild;if(e.children&&e.children.length>1){const t=parseInt(n.computedWidth/e.children.length)-5;let l=0;for(let t=0;t<e.children.length;t++)l+=e.children[t].textContent.length,e.children[t].style.maxWidth="";if(14*l*.52+20*e.children.length>n.computedWidth)for(let l=0;l<e.children.length;l++)e.children[l].style.maxWidth=t+"px"}}}return}}const m=document.createElement("div");m.classList.add("smart-multi-combo-input"),m.setAttribute("data-field",n.dataField),m.setAttribute("row-id",a.cell.row.id);let u='<div class="smart-tokens-layout smart-flex smart-flex-auto">';if(e.length>2&&a.cell.row.height>45){u='<div style="max-width: '+(n.computedWidth-10+"px")+'" class="smart-flex smart-flex-wrap">'}let p=0;if(t)for(let t=0;t<e.length;t++){const i=e[t];let a=null;if("collaborator"===l||n.editor&&n.editor.collaborator)a=r.users.find((e=>{if("string"==typeof i||"number"==typeof i){if(e.value===i||parseInt(e.value)===parseInt(i))return e;if(e.id===i||parseInt(e.id)===parseInt(i))return e}else if("object"==typeof i&&e.value===i.value)return e})),a&&(a.label=a.name);else if(n.editor.dataSource)if("string"==typeof i&&n.editor._items&&n.editor._items[i])a=n.editor._items[i];else{for(let e=0;e<n.editor.dataSource.length;e++){const t=n.editor.dataSource[e];if(void 0!==t.value&&void 0!==i&&void 0!==i.value&&t.value===i.value){a=t,n.editor._items||(n.editor._items=[]),n.editor._items[i]=t;break}if(void 0===t.value&&t===i||void 0!==t.value&&""+t.value===i){a=t,n.editor._items||(n.editor._items=[]),n.editor._items[i]=t;break}}n.editor.allowItemsAdd&&!a&&i&&(a=i)}else a=i;if(!a)continue;const s="string"==typeof a?a:a.label,o="string"==typeof a?null:a.color,d="string"==typeof a?null:a.image;if(""===s)continue;const c=document.createElement("span");d&&(c.style.backgroundImage=`url('${a.image}')`,c.className="smart-drop-down-list-selection-image");const m="smart-truncate";if(o&&n.editor.colorItems){const e=new Smart.Color(o).getInvertedColor(),t=n.editor.dots?" dots":"";u+='<span title="'+s+'" data-item="'+s+'" style="background: '+o+"; color: "+e+"; --smart-primary-color: "+e+'; overflow: visible;" class="'+m+' smart-token">'+c.outerHTML+"<span class='smart-drop-down-list-selection-label"+t+'\' role="presentation">'+s+"</span>"}else u+='<span title="'+s+'" data-item="'+s+'" class="'+m+' smart-token">'+c.outerHTML+"<span class='smart-drop-down-list-selection-label' role=\"presentation\">"+s+"</span>";if(p+=s.length,n.editor.dataSource){if(n.editor.singleSelect){u+="</span>";break}u+='<span class=\'smart-hidden smart-drop-down-list-unselect-button\' role="button" aria-label="Unselect"></span></span>'}else u+="</span>"}m.innerHTML=u+"</div>";const g=14*p*.52,f=m.firstElementChild;if(r.layout.rowHeight<=45&&a.cell.row.height<=45&&m&&f.children.length>1&&g+20*f.children.length>n.computedWidth){const e=parseInt(n.computedWidth/f.children.length)-5;for(let t=0;t<f.children.length;t++)f.children[t].style.maxWidth=e+"px"}if(m.style.width="100%",a.onmouseenter=()=>{!0===a.cell.column.allowEdit&&!0===r.editing.enabled&&(m.style.width="calc(100% - 25px)")},a.onmouseleave=()=>{m.style.width="100%"},m.style.paddingRight="6px",m.onpointerdown=t=>{if(!r._mobile)if(t.target&&"#text"!==t.target.nodeName&&t.target.classList.contains("smart-drop-down-list-unselect-button")){let l=t.target.parentNode.getAttribute("data-item");if(n.editor.dataSource&&"string"==typeof l&&n.editor.dataSource)for(let e=0;e<n.editor.dataSource.length;e++)n.editor.dataSource[e].label===l&&(l=n.editor.dataSource[e],l.value&&(l=l.value));if(e[0]&&e[0].label){const i=e.map((e=>e.value)).indexOf(l);if(i>=0){e.splice(i,1);const l=a.cell.value,s=e.join(", ");r.setCellValue(a.cell.row.id,n.dataField,JSON.stringify(e)),r.onCellUpdate&&r.onCellUpdate([a.cell],[l],[s],(function(){}),a),t.preventDefault(),t.stopPropagation()}}else if(e.indexOf(l)>=0){e.splice(e.indexOf(l),1);const i=a.cell.value,s=e.join(", ");r.setCellValue(a.cell.row.id,n.dataField,s),r.onCellUpdate&&r.onCellUpdate([a.cell],[i],[s],(function(){}),a),t.preventDefault(),t.stopPropagation()}}else if(t.target.classList.contains("smart-drop-down-list-selection-label")){if(r.editing.enabled&&r.editing.allowListOpenOnContentClick){const e=t.target.closest(".smart-multi-combo-input"),l=e.getAttribute("data-field"),i=e.getAttribute("row-id");r.beginEdit(i,l)}t.stopPropagation(),t.preventDefault()}},!n.cellsWrap&&n.allowEdit&&r.editing.enabled&&"card"!==r.view){const t=document.createElement("span");t.classList.add("smart-arrow-down","arrowbtn");let l=n.editor.dataSource&&n.editor.dataSource.length;n.editor.collaborator&&(l=r.users&&r.users.length),l||t.classList.add("smart-visibility-hidden");const i=document.createElement("div");i.classList.add("smart-multi-combo-input-container","tokens","smart-flex","smart-flex-auto"),m.classList.add("smart-flex-auto"),m.classList.remove("smart-flex-wrap"),e.length>2&&r.layout.rowHeight>45&&(m.classList.add("smart-flex-wrap"),m.style.maxWidth=n.computedWidth-10+"px"),r.rightToLeft&&(m.style.direction="rtl"),i.appendChild(m),"input"!==n.editor.template&&i.appendChild(t),o=i,t.onpointerdown=e=>{if(!r._mobile){if(r.editing.enabled){const t=e.target.previousElementSibling,l=t.getAttribute("data-field"),i=t.closest("smart-grid-row").getAttribute("data-id");r.beginEdit(i,l)}e.stopPropagation(),e.preventDefault()}}}else if(n.cellsWrap||n.allowEdit){const t=document.createElement("div");t.classList.add("smart-multi-combo-input-container","tokens","smart-flex","smart-flex-auto"),m.classList.add("smart-flex-auto"),m.classList.remove("smart-flex-wrap"),e.length>2&&r.layout.rowHeight>45&&(m.classList.add("smart-flex-wrap"),m.style.maxWidth=n.computedWidth-10+"px"),r.rightToLeft&&(m.style.direction="rtl"),t.appendChild(m),o=t}else m.classList.add("smart-flex-auto","smart-flex","tokens"),o=m;a.setAttribute("template",a.cell.template),o.setAttribute("value",t);break}case"dropdownGrid":case"dropDownList":case"dropdownlist":case"list":{const e=document.createElement("div");if(i.firstElementChild&&i.firstElementChild.hasAttribute("value")){if(i.firstElementChild.getAttribute("value")===t&&!a.cell.column._isDirty)return a.cell._setStyle(i),void a.setAttribute("template",a.cell.template)}if("dropdownGrid"!==a.cell.template){if(s()){const e=i.querySelector(".smart-arrow-down");return void(e&&(e.onpointerdown=e=>{if(!r._mobile){if(r.editing.enabled){const t=e.target.closest("smart-grid-cell"),l=e.target.closest("smart-grid-row"),i=t.getAttribute("data-field"),n=l.getAttribute("data-id");if(r.beginEdit(n,i),a.cell.column.editor&&a.cell.column.editor.instance){const e=a.cell.column.editor,t=e.instance.element;!e.autoOpen&&t.open?t.open():!e.autoOpen&&t.firstElementChild&&t.firstElementChild.open&&setTimeout((()=>{t.firstElementChild.open()}),250)}}e.stopPropagation(),e.preventDefault()}}))}}if("dropdownGrid"===a.cell.template){const l=a.cell.column.templateSettings.dataFields;let i=a.cell.editor.dataSource?a.cell.editor.dataSource[t]:"";if(a.cell.column.relationId&&a.cell.column.relationField&&a.cell.column._isDirty&&(!a.cell.column.editor.dataSource||a.cell.column.editor.dataSource&&0===a.cell.column.editor.dataSource.length)){const e=r._getRelationData(a.cell.column.relationId,a.cell.column.relationField,a.cell.column.relationCascadingFields),l=r._getRelationColumns(a.cell.column.relationId);e&&(i=e[t]),a.cell.column.editor.columns=l,a.cell.column.editor.dataSource=e}if(e.classList.add("smart-flex","center"),e.style.alignItems="center",e.onmouseenter=()=>{e.querySelectorAll("i").forEach((e=>e.classList.add("show")))},e.onmouseleave=()=>{e.querySelectorAll("i").forEach((e=>e.classList.remove("show")))},i){e.style.justifyContent="space-between";let t="";for(let e=0;e<l.length;e++){const a=i[l[e]];a&&(t+='<span style="" class="smart-truncate smart-token smart-flex middle center ">'+a+"</span>")}e.innerHTML=t}else e.style.justifyContent="",e.innerHTML='<span class="smart-truncate"></span>'}else"card"===r.view?e.textContent=t:e.innerHTML='<span class="smart-truncate">'+t+"</span>";if(n.allowEdit&&r.editing.enabled&&"card"!==r.view){const t=document.createElement("span");t.classList.add("smart-arrow-down","arrowbtn");const l=document.createElement("div");l.classList.add("smart-multi-combo-input-container","tokens","smart-flex","smart-flex-auto"),e.classList.add("smart-flex-auto","smart-multi-combo-input"),l.appendChild(e),l.appendChild(t),l.classList.add(a.cell.template.toLowerCase()),o=l,t.onpointerdown=e=>{if(!r._mobile){if(r.editing.enabled){const t=e.target.closest("smart-grid-cell"),l=e.target.closest("smart-grid-row"),i=t.getAttribute("data-field"),n=l.getAttribute("data-id");if(r.beginEdit(n,i),a.cell.column.editor&&a.cell.column.editor.instance){const e=a.cell.column.editor,t=