@momentum-ui/web-components 2.16.16 → 2.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/md-17.js +1 -1
- package/dist/chunks/md-18.js +1 -1
- package/dist/chunks/md-43.js +4 -3
- package/dist/chunks/md-53.js +21 -7
- package/dist/chunks/md-56.js +1 -1
- package/dist/chunks/md-6.js +21 -21
- package/dist/chunks/md-68.js +2 -2
- package/dist/chunks/md-79.js +1 -1
- package/dist/chunks/md-86.js +21 -21
- package/dist/chunks/md-90.js +1 -1
- package/dist/index-entry.js +1 -1
- package/dist/index.js +1 -1
- package/dist/types/components/alert-banner/AlertBanner.d.ts +10 -0
- package/dist/types/components/button/Button.d.ts +1 -1
- package/dist/types/components/datepicker/DatePicker.d.ts +2 -1
- package/dist/types/components/grabber/Grabber.d.ts +2 -2
- package/dist/types/components/help-text/HelpText.d.ts +1 -1
- package/package.json +5 -5
package/dist/chunks/md-86.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(window["momentum-web-components-[id]"]=window["momentum-web-components-[id]"]||[]).push([[86],{109:function(e,t,o){"use strict";o.r(t),o.d(t,"TableAdvanced",(function(){return w}));o(17),o(14),o(36);var r=o(5),i=o(33),a=o(6),l=o(0),n=o(2),s=o(4),d=o(3),c=o(89),h=o(39),p=o.n(h),b=l.css`:host{display:block}.md-table-advanced{width:100%}table{border-collapse:separate;border-spacing:0;max-width:100%;position:relative;width:100%}table.sticky-header{height:100%}table.sticky-header thead th:first-child{border-left:1px solid var(--table-advanced-border-color)}table.sticky-header thead th{background-color:var(--table-advanced-header-bg-color);border-left:0;border-top:0;position:sticky;top:0;z-index:1}table.sticky-header thead th::before{border-top:1px solid var(--table-advanced-border-color);bottom:0;content:" ";left:0;position:absolute;top:0;width:100%}table.sticky-header thead tr:last-child th{top:2.5rem}table.sticky-header thead tr:last-child th::before{border-bottom:1px solid var(--table-advanced-border-color);border-top:1px solid var(--table-advanced-border-color)}table.sticky-header thead tr:first-child th{height:calc(2.5rem + .0625rem*2);top:0}table.sticky-header thead tr:first-child th::before{border-bottom:1px solid var(--table-advanced-border-color);border-top:1px solid var(--table-advanced-border-color)}table.sticky-header thead tr:focus{outline:0}table.sticky-header thead tr:focus th:first-child{border-left:2px solid var(--md-focus-border-color)}table.sticky-header thead tr:focus th:last-child{border-right:2px solid var(--md-focus-border-color)}table.sticky-header thead tr:focus th::before{border-bottom:2px solid var(--md-focus-border-color);border-top:2px solid var(--md-focus-border-color)}thead th:first-child{border-left:1px solid var(--table-advanced-border-color)}thead th{background-color:var(--table-advanced-header-bg-color);border:1px solid var(--table-advanced-border-color);border-left:0;color:var(--md-secondary-text-color);font-family:var(--brand-font-regular, "CiscoSansTT Regular", "Helvetica Neue", Helvetica, Arial, sans-serif);font-size:14px;height:2.5rem;max-width:0;padding:0 .375rem;position:relative;text-align:left}thead th .filter{display:inline-block;height:auto;margin-top:calc(.25rem/2)}thead th .resize{background-color:rgba(0,0,0,0);cursor:col-resize;height:100%;left:calc(-.25rem/2);position:absolute;top:0;width:.25rem;z-index:1}thead .head-inner-cell{align-items:center;display:flex;min-width:.875rem}thead .head-inner-cell .filter-wrap{align-items:center;display:inline-flex;flex:1;justify-content:flex-end}thead .head-inner-cell .filter-icon{color:var(--md-secondary-text-color);cursor:pointer;display:inline-block;height:1.5rem;min-width:1.25rem;position:relative;z-index:1}thead .head-inner-cell .filter-icon::part(button){padding:.25rem;text-align:center;width:1.5rem}thead .head-inner-cell .filter-icon:hover{background-color:var(--table-advanced-filter-hover-bg-color)}thead .head-inner-cell .filter-icon:active{background-color:var(--table-advanced-filter-pressed-bg-color)}thead .head-inner-cell span{display:inline-block;overflow:hidden;padding-right:calc(.25rem*1.25);text-overflow:ellipsis;white-space:nowrap;width:100%}thead .head-inner-cell .sortable{background:rgba(0,0,0,0);border:0;color:var(--md-secondary-text-color);display:inline-flex;align-items:center;min-width:calc(1rem*2.5);overflow:hidden;padding-right:calc(.25rem*4);text-overflow:ellipsis;white-space:nowrap;width:auto}thead md-menu-overlay::part(overlay){top:-.375rem;white-space:normal}@supports(-moz-appearance:none){thead md-menu-overlay::part(overlay){top:-.25rem;white-space:normal}}thead .drag-area-col{cursor:grab;display:block;height:calc(.25rem*10);left:.25rem;position:absolute;right:.25rem;top:0;z-index:1}thead .drag-area-col.drag{border:2px dashed var(--table-advanced-filter-border-color);opacity:1}thead .drag-area-col.over{background-color:#a87ff1;height:100%;opacity:.1}thead .sortable{cursor:pointer;z-index:1;gap:.5rem}.filter-active{display:inline-block;height:1.25rem;text-align:center;vertical-align:bottom;width:1.25rem}.filter-active::part(icon){line-height:.875rem}.filter-menu{background-color:var(--table-advanced-filter-bg-color);padding:calc(.25rem*3);position:relative;z-index:1}.filter-menu select{background-color:var(--table-advanced-filter-bg-color);border:1px solid var(--table-advanced-filter-border-color);color:var(--md-secondary-text-color);min-height:calc(.875rem*1.8);width:100%}.filter-menu input{background-color:var(--table-advanced-filter-bg-color);border:1px solid var(--table-advanced-filter-border-color);color:var(--md-secondary-text-color);margin-top:calc(.25rem*2);width:100%}tbody tr{position:relative}tbody tr td:first-child{border-left:1px solid var(--table-advanced-border-color)}tbody tr td{border-bottom:1px solid var(--table-advanced-border-color);border-right:1px solid var(--table-advanced-border-color);font-size:14px;height:2.5rem;max-width:0;padding:calc(.25rem*1.5);position:relative}tbody tr th:first-child{border-top:1px solid var(--table-advanced-border-color)}tbody tr th{background-color:var(--table-advanced-header-bg-color);border-bottom:1px solid var(--table-advanced-border-color);border-right:1px solid var(--table-advanced-border-color);font-size:14px;max-width:0;padding:0 calc(.25rem*4);position:relative;text-align:left}tbody tr .inner-cell{display:flex;white-space:nowrap;align-items:center}tbody tr .inner-cell .warn-icon{display:inline-block;margin-left:.25rem;max-height:1.25rem;position:relative;vertical-align:middle;z-index:0}tbody tr .inner-cell md-icon::part(icon){line-height:1.25rem}tbody tr .inner-cell span{align-self:center;display:inline-block;flex:1;overflow:hidden;padding:0 .25rem;text-overflow:ellipsis;vertical-align:middle}tbody tr .drag-handle{cursor:grab;float:left;margin-right:calc(.25rem*1.5)}tbody tr .drag-area{height:50%;left:0;opacity:.3;position:absolute;right:0}tbody tr .drag-area.top{top:0}tbody tr .drag-area.bottom{background-color:rgba(0,0,0,0);bottom:0}tbody tr.ghost{opacity:.3}tbody tr:hover{background-color:var(--table-advanced-hover-bg-color)}tbody tr:hover td,tbody tr:hover th{background-color:var(--table-advanced-hover-bg-color)}tbody tr.selected,tbody tr:active{background-color:var(--table-advanced-selected-bg-color)}tbody tr.selected td,tbody tr.selected th,tbody tr:active td,tbody tr:active th{background-color:var(--table-advanced-selected-bg-color)}button.row-collapsible{display:inline-flex;align-items:center;justify-content:center;height:1.25rem;width:1.25rem;margin-right:calc(.25rem*1.5);background-color:rgba(0,0,0,0);border:1px solid var(--table-advanced-border-color);border-radius:2px}button.row-collapsible:hover{background-color:var(--table-advanced-filter-hover-bg-color);border:0}button.row-collapsible:active{background-color:var(--table-advanced-filter-pressed-bg-color);border:0}`;function g(e=250){return function(t,o,r){let i;return function(e,t){if(e.descriptor=e.descriptor||Object.getOwnPropertyDescriptor(e.target,e.key),"function"!=typeof e.descriptor.value)return console.warn(e.key,"Decorator must be used on function"),e.descriptor;const o=e.descriptor.value,r=e.target.constructor.name;return e.descriptor.value=function(...e){return t.call(this,o,e,r)},e.descriptor}({target:t,key:o,descriptor:r},(function(t,o){clearTimeout(i),i=window.setTimeout(()=>{clearTimeout(i),t.apply(this,o)},e)}))}}class m{constructor(e,t){this.target=e,this.eventName=t}emit(e,t={bubbles:!0,composed:!0,cancelable:!1}){this.target.dispatchEvent(new CustomEvent(this.eventName,Object.assign({detail:e},t)))}}const u=new WeakMap,f=Object(n.directive)(e=>t=>{if(!(t instanceof n.NodePart))throw new Error("templateCallback can only be used in text bindings");const o=u.get(t);if(void 0!==o&&e.template===o.template&&t.value===o.fragment)return;const r=document.importNode(e.template.content,!0);e.cb({content:e.content,row:e.row,col:e.col,insertIndex:e.insertIndex,fragment:r}),t.setValue(r),u.set(t,{template:e.template,fragment:r})});var v;!function(e){const t={placeholder:"Filter..."};e.OPTIONS={equals:{label:"Equals",input:t,predicate:(e,t)=>e==t},notEqual:{label:"Not equal",input:t,predicate:(e,t)=>e!=t},contains:{label:"Contains",input:t,predicate:(e,t)=>e.includes(t)},notContains:{label:"Not contains",input:t,predicate:(e,t)=>!e.includes(t)},startsWith:{label:"Starts with",input:t,predicate:(e,t)=>e.startsWith(t)},endsWith:{label:"Ends with",input:t,predicate:(e,t)=>e.endsWith(t)},lessThan:{label:"Less than",input:t,predicate:(e,t)=>e<t},lessThanOrEquals:{label:"Less than or equals",input:t,predicate:(e,t)=>e<=t},greaterThan:{label:"Greater than",input:t,predicate:(e,t)=>e>t},greaterThanOrEquals:{label:"Greater than or equals",input:t,predicate:(e,t)=>e>=t}},e.optionsString=[e.OPTIONS.equals,e.OPTIONS.notEqual,e.OPTIONS.contains,e.OPTIONS.notContains,e.OPTIONS.startsWith,e.OPTIONS.endsWith],e.optionsNumber=[e.OPTIONS.equals,e.OPTIONS.notEqual,e.OPTIONS.lessThan,e.OPTIONS.lessThanOrEquals,e.OPTIONS.greaterThan,e.OPTIONS.greaterThanOrEquals]}(v||(v={}));var y=function(e,t,o,r){var i,a=arguments.length,l=a<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,o,r);else for(var n=e.length-1;n>=0;n--)(i=e[n])&&(l=(a<3?i(l):a>3?i(t,o,l):i(t,o))||l);return a>3&&l&&Object.defineProperty(t,o,l),l};const x=document.createElement("img");var w;x.src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",function(e){let t=class extends(Object(i.a)(l.LitElement)){constructor(){super(...arguments),this.isRowFocusable="true",this.error="",this.COLS=[],this.ROWS=[],this.updCols=()=>this.requestUpdate("COLS"),this.updRows=()=>this.requestUpdate("ROWS"),this.dragRow=-1,this.dropRow=-1,this.drops=[],this.dragRowElem=null,this.dragCol=-1,this.dropCol=-1,this.isResizing=!1,this.isSelectable=!1,this.selected={},this.expandedRowIdx={},this.dragover=e=>e.preventDefault(),this.eX=0,this.onResize=(e,t)=>{var o;if(-1!=this.dragCol||-1!=this.dragRow)return;this.isResizing=!0;const r=e.target;null===(o=e.dataTransfer)||void 0===o||o.setDragImage(x,0,0);const i=this.COLS.map(e=>this.shadowRoot.querySelector("th.col-index-"+e.index));this.COLS.forEach((e,t)=>e.width=i[t].offsetWidth+"px"),this.updCols();const a=e.x;this.eX=e.x;let l=-1,n=-1,s=-1;const d=this.COLS[t.index-1],c=i[t.index],h=i[t.index-1],p=c.offsetWidth,b=h.offsetWidth,g=()=>{const e=this.eX;if(l!=e&&0!=e){l=e;const o=l-a;n=p-o,s=b+o,t.width=n+"px",d.width=s+"px",this.updCols()}},m=e=>this.eX=e.x,u=()=>{this.isResizing=!1,r.removeEventListener("drag",g),r.removeEventListener("dragend",u),document.removeEventListener("dragover",m)};r.addEventListener("drag",g),r.addEventListener("dragend",u),document.addEventListener("dragover",m)}}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("dragover",this.dragover)}connectedCallback(){super.connectedCallback(),document.addEventListener("dragover",this.dragover),this.updateTableConfig(),this.updateTableData(),this.populateTable()}update(e){super.update(e),e.has("data")&&(this.updateTableData(),this.updateDataInTable())}updateTableData(){if("string"==typeof this.data)try{this.tableData=JSON.parse(this.data)}catch(e){console.error("[INVALID_JSON_FORMAT] Please recheck the config json")}else this.tableData=Object.assign({},this.data)}updateTableConfig(){if("string"==typeof this.config)try{this.tableConfig=JSON.parse(this.config)}catch(e){console.error("[INVALID_JSON_FORMAT] Please recheck the data json")}else this.tableConfig=Object.assign({},this.config)}populateColumns(){var e;let t=0;const o=(e,o)=>{var r,i,a,l;const n=e.filters||(null===(i=null===(r=this.tableConfig.default)||void 0===r?void 0:r.col)||void 0===i?void 0:i.filters),s=n?"forString"==n?v.optionsString:"forNumber"==n?v.optionsNumber:n.length?n:null:null;this.COLS.push({options:Object.assign({},e),index:t++,group:o,sort:"default",sorter:e.sorter||(null===(l=null===(a=this.tableConfig.default)||void 0===a?void 0:a.col)||void 0===l?void 0:l.sorter),isCollapsable:this.tableConfig.cols.collapse==e.id,filter:s?{list:s,selectedIndex:0,input:"",active:!1,menuVisible:!1}:void 0})};this.tableConfig.cols.define.forEach(e=>{"children"in e?e.children.forEach(t=>o(t,{name:e.groupName,length:e.children.length})):o(e)}),this.isSelectable=!!this.tableConfig.rows&&"none"!=(null===(e=this.tableConfig.rows)||void 0===e?void 0:e.selectable)}populateData(){const e=this.COLS.length;if("csv"in this.tableData){const e=p.a.parse(this.tableData.csv,{skipEmptyLines:!0,transform:e=>e.trim()});if(e.errors)return void(this.error="PARSE ERROR:\n"+JSON.stringify(e.errors,null,2));{const t=e.data;this.ROWS=t.map(e=>e.map(e=>({text:e})))}}else if("list2d"in this.tableData)this.ROWS=this.tableData.list2d.map(e=>e.map(e=>({text:e})));else{for(;this.tableData.list.length>e;)this.ROWS.push(this.tableData.list.splice(0,e).map(e=>({text:e})));0!=this.tableData.list.length&&this.ROWS.push(this.tableData.list.map(e=>({text:e})))}0!=this.ROWS.length||(this.error="DATA ERROR: Data is empty")}validateData(){const e=this.COLS.length;this.ROWS.reduce((e,t)=>e+t.length,0)%e==0?this.ROWS.forEach((t,o)=>{const r=t.length;r!=e&&(this.error=`DATA ERROR: Total number of cols (=${e}) and data[${o}] length (=${r}) mismatch`)}):this.error=this.error="DATA ERROR: Data length mismatch. You must provide (numberOfRows * numberOfColumns) amount of data values."}populateTemplate(){const e=this.tableConfig.cellTemplates,t=Object.keys(e||{});e&&t.length&&this.ROWS.forEach((t,o)=>{t.forEach((t,r)=>{for(const i in e){const a=t.text.indexOf(i);if(-1!=a){const l=e[i],n=this.querySelector("#"+l.templateName);if(null==n){console.warn(`cellTemplates["${i}"]: Missing '${l.templateName}' template.`);continue}let s=t.text.replace(i,"");l.contentCb&&(s=l.contentCb({col:r,row:o,content:s,insertIndex:a})),this.ROWS[o][r]={text:s,template:{template:n,templateCb:l.templateCb,insertIndex:"replace"==l.contentUse?-1:a}};break}}})})}setDefaultFilterAndSort(){var e,t;const o=null===(e=this.tableConfig.default)||void 0===e?void 0:e.sort;if(o){const e=this.COLS.find(e=>e.options.id==o.colId);e?this.sort(e,o.order):console.warn(`Cant find ${o.colId} col - for sorting`)}const r=null===(t=this.tableConfig.default)||void 0===t?void 0:t.filter;if(r){const e=this.COLS.find(e=>e.options.id==r.colId);e?e.filter?(e.filter.selectedIndex=r.selectedIndex,e.filter.input=r.input,this.updCols(),this.filter(e)):console.warn(`Cant find filters on ${r.colId} col`):console.warn(`Cant find ${r.colId} col - for filtering`)}}populateTable(){this.populateColumns(),this.populateData(),this.validateData(),this.setDefaultFilterAndSort(),this.populateTemplate()}updateDataInTable(){this.populateData(),this.validateData(),this.populateTemplate()}onDropRow(){this.dragRow!=this.dropRow&&this.drops.push([this.dragRow,this.dropRow]),this.dragRow=-1,this.dropRow=-1,this.dragRowElem&&(this.dragRowElem.setAttribute("draggable","false"),this.dragRowElem=null)}onDropCol(){if(this.dragCol!=this.dropCol){const e=this.COLS[this.dragCol],t=this.COLS[this.dropCol],o=e.group,r=t.group,i=e.index,a=t.index;e.group=r,t.group=o,e.index=a,t.index=i,this.COLS[this.dragCol]=t,this.COLS[this.dropCol]=e,this.ROWS.forEach(e=>{const t=e[this.dragCol],o=e[this.dropCol];e[this.dragCol]=o,e[this.dropCol]=t}),this.updCols(),this.updRows()}this.dragCol=-1,this.dropCol=-1}sort(e,t){e.sorter&&(this.clearSelection(),this.drops=[],this.COLS.forEach(o=>{o.options.id==e.options.id?o.sort=t||("default"==o.sort?"ascending":"ascending"==o.sort?"descending":"default"):o.sort="default"}),this.updCols(),this.requestUpdate(),this["md-table-advanced-change"].emit({type:"sort",order:e.sort}))}filter(e){if(!e.filter)return;this.clearSelection(),this.drops=[];const t=e.filter.input.trim(),o=e.filter.list[e.filter.selectedIndex];e.filter.active=!!t,this.requestUpdate(),t?this["md-table-advanced-change"].emit({type:"filter-on",filter:o,input:t}):this["md-table-advanced-change"].emit({type:"filter-off",filter:e.filter.list[e.filter.selectedIndex]})}selectRow(e){var t;const o=e.row.idx,r=Object.prototype.hasOwnProperty.call(this.selected,o);"multiple"==(null===(t=this.tableConfig.rows)||void 0===t?void 0:t.selectable)?(e.metaKey?r?delete this.selected[o]:this.selected[o]=!0:e.shiftKey||(this.selected={[o]:!0}),this["md-table-advanced-change"].emit({type:"multi-select",rows:Object.keys(this.selected).map(e=>+e)})):r?this.clearSelection():(this.selected={[o]:!0},this["md-table-advanced-change"].emit({type:"select",index:o})),this.requestUpdate("selected")}clearSelection(){this.selected={},this.requestUpdate("selected")}collapseToggle(e,t){e.stopPropagation(),this.expandedRowIdx[t]?(delete this.expandedRowIdx[t],this["md-table-advanced-change"].emit({type:"collapse",row:t})):(this.expandedRowIdx[t]=!0,this["md-table-advanced-change"].emit({type:"expand",row:t})),this.clearSelection(),this.requestUpdate()}render(){if(this.error)return l.html` <div>${this.error}</div> `;const{head:e}=this.tableConfig,t=Object(s.classMap)({"sticky-header":!!this.tableConfig.isStickyHeader});return l.html`
|
|
1
|
+
(window["momentum-web-components-[id]"]=window["momentum-web-components-[id]"]||[]).push([[86],{109:function(e,t,r){"use strict";r.r(t),r.d(t,"TableAdvanced",(function(){return w}));r(17),r(14),r(36);var o=r(5),i=r(33),a=r(6),l=r(0),n=r(2),s=r(4),d=r(3),c=r(89),h=r(39),p=r.n(h),b=l.css`:host{display:block}.md-table-advanced{width:100%}table{border-collapse:separate;border-spacing:0;max-width:100%;position:relative;width:100%}table.sticky-header{height:100%}table.sticky-header thead th:first-child{border-left:1px solid var(--table-advanced-border-color)}table.sticky-header thead th{background-color:var(--table-advanced-header-bg-color);border-left:0;border-top:0;position:sticky;top:0;z-index:1}table.sticky-header thead th::before{border-top:1px solid var(--table-advanced-border-color);bottom:0;content:" ";left:0;position:absolute;top:0;width:100%}table.sticky-header thead tr:last-child th{top:2.5rem}table.sticky-header thead tr:last-child th::before{border-bottom:1px solid var(--table-advanced-border-color);border-top:1px solid var(--table-advanced-border-color)}table.sticky-header thead tr:first-child th{height:calc(2.5rem + .0625rem*2);top:0}table.sticky-header thead tr:first-child th::before{border-bottom:1px solid var(--table-advanced-border-color);border-top:1px solid var(--table-advanced-border-color)}table.sticky-header thead tr:focus{outline:0}table.sticky-header thead tr:focus th:first-child{border-left:2px solid var(--md-focus-border-color)}table.sticky-header thead tr:focus th:last-child{border-right:2px solid var(--md-focus-border-color)}table.sticky-header thead tr:focus th::before{border-bottom:2px solid var(--md-focus-border-color);border-top:2px solid var(--md-focus-border-color)}thead th:first-child{border-left:1px solid var(--table-advanced-border-color)}thead th{background-color:var(--table-advanced-header-bg-color);border:1px solid var(--table-advanced-border-color);border-left:0;color:var(--md-secondary-text-color);font-family:var(--brand-font-regular, "CiscoSansTT Regular", "Helvetica Neue", Helvetica, Arial, sans-serif);font-size:14px;height:2.5rem;max-width:0;padding:0 .375rem;position:relative;text-align:left}thead th .filter{display:inline-block;height:auto;margin-top:calc(.25rem/2)}thead th .resize{background-color:rgba(0,0,0,0);cursor:col-resize;height:100%;left:calc(-.25rem/2);position:absolute;top:0;width:.25rem;z-index:1}thead .head-inner-cell{align-items:center;display:flex;min-width:.875rem}thead .head-inner-cell .filter-wrap{align-items:center;display:inline-flex;flex:1;justify-content:flex-end}thead .head-inner-cell .filter-icon{color:var(--md-primary-text-color);cursor:pointer;display:inline-block;height:1.5rem;min-width:1.25rem;position:relative;z-index:1;border-radius:4px}thead .head-inner-cell .filter-icon::part(button){padding:.25rem;text-align:center;width:1.5rem}thead .head-inner-cell .filter-icon:hover{background-color:var(--table-advanced-filter-hover-bg-color)}thead .head-inner-cell .filter-icon:active{background-color:var(--table-advanced-filter-pressed-bg-color)}thead .head-inner-cell span{display:inline-block;overflow:hidden;padding-right:calc(.25rem*1.25);text-overflow:ellipsis;white-space:nowrap;width:100%}thead .head-inner-cell .sortable{background:rgba(0,0,0,0);border:0;color:var(--md-secondary-text-color);display:inline-flex;align-items:center;min-width:calc(1rem*2.5);overflow:hidden;padding-right:calc(.25rem*4);text-overflow:ellipsis;white-space:nowrap;width:auto}thead md-menu-overlay::part(overlay){top:-.375rem;white-space:normal}@supports(-moz-appearance:none){thead md-menu-overlay::part(overlay){top:-.25rem;white-space:normal}}thead .drag-area-col{cursor:grab;display:block;height:calc(.25rem*10);left:.25rem;position:absolute;right:.25rem;top:0;z-index:1}thead .drag-area-col.drag{border:2px dashed var(--table-advanced-filter-border-color);opacity:1}thead .drag-area-col.over{background-color:#a87ff1;height:100%;opacity:.1}thead .sortable{cursor:pointer;z-index:1;gap:.5rem}.filter-active{display:inline-block;height:1.25rem;text-align:center;vertical-align:bottom;width:1.25rem}.filter-active::part(icon){line-height:.875rem}.filter-menu{background-color:var(--table-advanced-filter-bg-color);padding:calc(.25rem*3);position:relative;z-index:1}.filter-menu select{background-color:var(--table-advanced-filter-bg-color);border:1px solid var(--table-advanced-filter-border-color);color:var(--md-secondary-text-color);min-height:calc(.875rem*1.8);width:100%}.filter-menu input{background-color:var(--table-advanced-filter-bg-color);border:1px solid var(--table-advanced-filter-border-color);color:var(--md-secondary-text-color);margin-top:calc(.25rem*2);width:100%}tbody tr{position:relative}tbody tr td:first-child{border-left:1px solid var(--table-advanced-border-color)}tbody tr td{border-bottom:1px solid var(--table-advanced-border-color);border-right:1px solid var(--table-advanced-border-color);font-size:14px;height:2.5rem;max-width:0;padding:calc(.25rem*1.5);position:relative}tbody tr th:first-child{border-top:1px solid var(--table-advanced-border-color)}tbody tr th{background-color:var(--table-advanced-header-bg-color);border-bottom:1px solid var(--table-advanced-border-color);border-right:1px solid var(--table-advanced-border-color);font-size:14px;max-width:0;padding:0 calc(.25rem*4);position:relative;text-align:left}tbody tr .inner-cell{display:flex;white-space:nowrap;align-items:center}tbody tr .inner-cell .warn-icon{display:inline-block;margin-left:.25rem;max-height:1.25rem;position:relative;vertical-align:middle;z-index:0}tbody tr .inner-cell md-icon::part(icon){line-height:1.25rem}tbody tr .inner-cell span{align-self:center;display:inline-block;flex:1;overflow:hidden;padding:0 .25rem;text-overflow:ellipsis;vertical-align:middle}tbody tr .drag-handle{cursor:grab;float:left;margin-right:calc(.25rem*1.5)}tbody tr .drag-area{height:50%;left:0;opacity:.3;position:absolute;right:0}tbody tr .drag-area.top{top:0}tbody tr .drag-area.bottom{background-color:rgba(0,0,0,0);bottom:0}tbody tr.ghost{opacity:.3}tbody tr:hover{background-color:var(--table-advanced-hover-bg-color)}tbody tr:hover td,tbody tr:hover th{background-color:var(--table-advanced-hover-bg-color)}tbody tr.selected,tbody tr:active{background-color:var(--table-advanced-selected-bg-color)}tbody tr.selected td,tbody tr.selected th,tbody tr:active td,tbody tr:active th{background-color:var(--table-advanced-selected-bg-color)}button.row-collapsible{display:inline-flex;align-items:center;justify-content:center;height:1.25rem;width:1.25rem;margin-right:calc(.25rem*1.5);background-color:rgba(0,0,0,0);border:1px solid var(--table-advanced-border-color);border-radius:2px}button.row-collapsible:hover{background-color:var(--table-advanced-filter-hover-bg-color);border:0}button.row-collapsible:active{background-color:var(--table-advanced-filter-pressed-bg-color);border:0}`;function g(e=250){return function(t,r,o){let i;return function(e,t){if(e.descriptor=e.descriptor||Object.getOwnPropertyDescriptor(e.target,e.key),"function"!=typeof e.descriptor.value)return console.warn(e.key,"Decorator must be used on function"),e.descriptor;const r=e.descriptor.value,o=e.target.constructor.name;return e.descriptor.value=function(...e){return t.call(this,r,e,o)},e.descriptor}({target:t,key:r,descriptor:o},(function(t,r){clearTimeout(i),i=window.setTimeout(()=>{clearTimeout(i),t.apply(this,r)},e)}))}}class m{constructor(e,t){this.target=e,this.eventName=t}emit(e,t={bubbles:!0,composed:!0,cancelable:!1}){this.target.dispatchEvent(new CustomEvent(this.eventName,Object.assign({detail:e},t)))}}const u=new WeakMap,f=Object(n.directive)(e=>t=>{if(!(t instanceof n.NodePart))throw new Error("templateCallback can only be used in text bindings");const r=u.get(t);if(void 0!==r&&e.template===r.template&&t.value===r.fragment)return;const o=document.importNode(e.template.content,!0);e.cb({content:e.content,row:e.row,col:e.col,insertIndex:e.insertIndex,fragment:o}),t.setValue(o),u.set(t,{template:e.template,fragment:o})});var v;!function(e){const t={placeholder:"Filter..."};e.OPTIONS={equals:{label:"Equals",input:t,predicate:(e,t)=>e==t},notEqual:{label:"Not equal",input:t,predicate:(e,t)=>e!=t},contains:{label:"Contains",input:t,predicate:(e,t)=>e.includes(t)},notContains:{label:"Not contains",input:t,predicate:(e,t)=>!e.includes(t)},startsWith:{label:"Starts with",input:t,predicate:(e,t)=>e.startsWith(t)},endsWith:{label:"Ends with",input:t,predicate:(e,t)=>e.endsWith(t)},lessThan:{label:"Less than",input:t,predicate:(e,t)=>e<t},lessThanOrEquals:{label:"Less than or equals",input:t,predicate:(e,t)=>e<=t},greaterThan:{label:"Greater than",input:t,predicate:(e,t)=>e>t},greaterThanOrEquals:{label:"Greater than or equals",input:t,predicate:(e,t)=>e>=t}},e.optionsString=[e.OPTIONS.equals,e.OPTIONS.notEqual,e.OPTIONS.contains,e.OPTIONS.notContains,e.OPTIONS.startsWith,e.OPTIONS.endsWith],e.optionsNumber=[e.OPTIONS.equals,e.OPTIONS.notEqual,e.OPTIONS.lessThan,e.OPTIONS.lessThanOrEquals,e.OPTIONS.greaterThan,e.OPTIONS.greaterThanOrEquals]}(v||(v={}));var y=function(e,t,r,o){var i,a=arguments.length,l=a<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,r,o);else for(var n=e.length-1;n>=0;n--)(i=e[n])&&(l=(a<3?i(l):a>3?i(t,r,l):i(t,r))||l);return a>3&&l&&Object.defineProperty(t,r,l),l};const x=document.createElement("img");var w;x.src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",function(e){let t=class extends(Object(i.a)(l.LitElement)){constructor(){super(...arguments),this.isRowFocusable="true",this.error="",this.COLS=[],this.ROWS=[],this.updCols=()=>this.requestUpdate("COLS"),this.updRows=()=>this.requestUpdate("ROWS"),this.dragRow=-1,this.dropRow=-1,this.drops=[],this.dragRowElem=null,this.dragCol=-1,this.dropCol=-1,this.isResizing=!1,this.isSelectable=!1,this.selected={},this.expandedRowIdx={},this.dragover=e=>e.preventDefault(),this.eX=0,this.onResize=(e,t)=>{var r;if(-1!=this.dragCol||-1!=this.dragRow)return;this.isResizing=!0;const o=e.target;null===(r=e.dataTransfer)||void 0===r||r.setDragImage(x,0,0);const i=this.COLS.map(e=>this.shadowRoot.querySelector("th.col-index-"+e.index));this.COLS.forEach((e,t)=>e.width=i[t].offsetWidth+"px"),this.updCols();const a=e.x;this.eX=e.x;let l=-1,n=-1,s=-1;const d=this.COLS[t.index-1],c=i[t.index],h=i[t.index-1],p=c.offsetWidth,b=h.offsetWidth,g=()=>{const e=this.eX;if(l!=e&&0!=e){l=e;const r=l-a;n=p-r,s=b+r,t.width=n+"px",d.width=s+"px",this.updCols()}},m=e=>this.eX=e.x,u=()=>{this.isResizing=!1,o.removeEventListener("drag",g),o.removeEventListener("dragend",u),document.removeEventListener("dragover",m)};o.addEventListener("drag",g),o.addEventListener("dragend",u),document.addEventListener("dragover",m)}}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("dragover",this.dragover)}connectedCallback(){super.connectedCallback(),document.addEventListener("dragover",this.dragover),this.updateTableConfig(),this.updateTableData(),this.populateTable()}update(e){super.update(e),e.has("data")&&(this.updateTableData(),this.updateDataInTable())}updateTableData(){if("string"==typeof this.data)try{this.tableData=JSON.parse(this.data)}catch(e){console.error("[INVALID_JSON_FORMAT] Please recheck the config json")}else this.tableData=Object.assign({},this.data)}updateTableConfig(){if("string"==typeof this.config)try{this.tableConfig=JSON.parse(this.config)}catch(e){console.error("[INVALID_JSON_FORMAT] Please recheck the data json")}else this.tableConfig=Object.assign({},this.config)}populateColumns(){var e;let t=0;const r=(e,r)=>{var o,i,a,l;const n=e.filters||(null===(i=null===(o=this.tableConfig.default)||void 0===o?void 0:o.col)||void 0===i?void 0:i.filters),s=n?"forString"==n?v.optionsString:"forNumber"==n?v.optionsNumber:n.length?n:null:null;this.COLS.push({options:Object.assign({},e),index:t++,group:r,sort:"default",sorter:e.sorter||(null===(l=null===(a=this.tableConfig.default)||void 0===a?void 0:a.col)||void 0===l?void 0:l.sorter),isCollapsable:this.tableConfig.cols.collapse==e.id,filter:s?{list:s,selectedIndex:0,input:"",active:!1,menuVisible:!1}:void 0})};this.tableConfig.cols.define.forEach(e=>{"children"in e?e.children.forEach(t=>r(t,{name:e.groupName,length:e.children.length})):r(e)}),this.isSelectable=!!this.tableConfig.rows&&"none"!=(null===(e=this.tableConfig.rows)||void 0===e?void 0:e.selectable)}populateData(){const e=this.COLS.length;if("csv"in this.tableData){const e=p.a.parse(this.tableData.csv,{skipEmptyLines:!0,transform:e=>e.trim()});if(e.errors)return void(this.error="PARSE ERROR:\n"+JSON.stringify(e.errors,null,2));{const t=e.data;this.ROWS=t.map(e=>e.map(e=>({text:e})))}}else if("list2d"in this.tableData)this.ROWS=this.tableData.list2d.map(e=>e.map(e=>({text:e})));else{for(;this.tableData.list.length>e;)this.ROWS.push(this.tableData.list.splice(0,e).map(e=>({text:e})));0!=this.tableData.list.length&&this.ROWS.push(this.tableData.list.map(e=>({text:e})))}0!=this.ROWS.length||(this.error="DATA ERROR: Data is empty")}validateData(){const e=this.COLS.length;this.ROWS.reduce((e,t)=>e+t.length,0)%e==0?this.ROWS.forEach((t,r)=>{const o=t.length;o!=e&&(this.error=`DATA ERROR: Total number of cols (=${e}) and data[${r}] length (=${o}) mismatch`)}):this.error=this.error="DATA ERROR: Data length mismatch. You must provide (numberOfRows * numberOfColumns) amount of data values."}populateTemplate(){const e=this.tableConfig.cellTemplates,t=Object.keys(e||{});e&&t.length&&this.ROWS.forEach((t,r)=>{t.forEach((t,o)=>{for(const i in e){const a=t.text.indexOf(i);if(-1!=a){const l=e[i],n=this.querySelector("#"+l.templateName);if(null==n){console.warn(`cellTemplates["${i}"]: Missing '${l.templateName}' template.`);continue}let s=t.text.replace(i,"");l.contentCb&&(s=l.contentCb({col:o,row:r,content:s,insertIndex:a})),this.ROWS[r][o]={text:s,template:{template:n,templateCb:l.templateCb,insertIndex:"replace"==l.contentUse?-1:a}};break}}})})}setDefaultFilterAndSort(){var e,t;const r=null===(e=this.tableConfig.default)||void 0===e?void 0:e.sort;if(r){const e=this.COLS.find(e=>e.options.id==r.colId);e?this.sort(e,r.order):console.warn(`Cant find ${r.colId} col - for sorting`)}const o=null===(t=this.tableConfig.default)||void 0===t?void 0:t.filter;if(o){const e=this.COLS.find(e=>e.options.id==o.colId);e?e.filter?(e.filter.selectedIndex=o.selectedIndex,e.filter.input=o.input,this.updCols(),this.filter(e)):console.warn(`Cant find filters on ${o.colId} col`):console.warn(`Cant find ${o.colId} col - for filtering`)}}populateTable(){this.populateColumns(),this.populateData(),this.validateData(),this.setDefaultFilterAndSort(),this.populateTemplate()}updateDataInTable(){this.populateData(),this.validateData(),this.populateTemplate()}onDropRow(){this.dragRow!=this.dropRow&&this.drops.push([this.dragRow,this.dropRow]),this.dragRow=-1,this.dropRow=-1,this.dragRowElem&&(this.dragRowElem.setAttribute("draggable","false"),this.dragRowElem=null)}onDropCol(){if(this.dragCol!=this.dropCol){const e=this.COLS[this.dragCol],t=this.COLS[this.dropCol],r=e.group,o=t.group,i=e.index,a=t.index;e.group=o,t.group=r,e.index=a,t.index=i,this.COLS[this.dragCol]=t,this.COLS[this.dropCol]=e,this.ROWS.forEach(e=>{const t=e[this.dragCol],r=e[this.dropCol];e[this.dragCol]=r,e[this.dropCol]=t}),this.updCols(),this.updRows()}this.dragCol=-1,this.dropCol=-1}sort(e,t){e.sorter&&(this.clearSelection(),this.drops=[],this.COLS.forEach(r=>{r.options.id==e.options.id?r.sort=t||("default"==r.sort?"ascending":"ascending"==r.sort?"descending":"default"):r.sort="default"}),this.updCols(),this.requestUpdate(),this["md-table-advanced-change"].emit({type:"sort",order:e.sort}))}filter(e){if(!e.filter)return;this.clearSelection(),this.drops=[];const t=e.filter.input.trim(),r=e.filter.list[e.filter.selectedIndex];e.filter.active=!!t,this.requestUpdate(),t?this["md-table-advanced-change"].emit({type:"filter-on",filter:r,input:t}):this["md-table-advanced-change"].emit({type:"filter-off",filter:e.filter.list[e.filter.selectedIndex]})}selectRow(e){var t;const r=e.row.idx,o=Object.prototype.hasOwnProperty.call(this.selected,r);"multiple"==(null===(t=this.tableConfig.rows)||void 0===t?void 0:t.selectable)?(e.metaKey?o?delete this.selected[r]:this.selected[r]=!0:e.shiftKey||(this.selected={[r]:!0}),this["md-table-advanced-change"].emit({type:"multi-select",rows:Object.keys(this.selected).map(e=>+e)})):o?this.clearSelection():(this.selected={[r]:!0},this["md-table-advanced-change"].emit({type:"select",index:r})),this.requestUpdate("selected")}clearSelection(){this.selected={},this.requestUpdate("selected")}collapseToggle(e,t){e.stopPropagation(),this.expandedRowIdx[t]?(delete this.expandedRowIdx[t],this["md-table-advanced-change"].emit({type:"collapse",row:t})):(this.expandedRowIdx[t]=!0,this["md-table-advanced-change"].emit({type:"expand",row:t})),this.clearSelection(),this.requestUpdate()}render(){if(this.error)return l.html` <div>${this.error}</div> `;const{head:e}=this.tableConfig,t=Object(s.classMap)({"sticky-header":!!this.tableConfig.isStickyHeader});return l.html`
|
|
2
2
|
<div class="md-table-advanced">
|
|
3
3
|
<slot></slot>
|
|
4
4
|
<table class=${t} summary=${Object(d.ifDefined)(null==e?void 0:e.summary)}>
|
|
@@ -27,15 +27,15 @@
|
|
|
27
27
|
</th>
|
|
28
28
|
`):void 0:this.renderCol(e,2))}
|
|
29
29
|
</tr>
|
|
30
|
-
`}const
|
|
30
|
+
`}const r=l.html`
|
|
31
31
|
<tr tabindex="0">
|
|
32
32
|
${this.COLS.map(e=>t?e.group?this.renderCol(e):void 0:this.renderCol(e))}
|
|
33
33
|
</tr>
|
|
34
34
|
`;return l.html`
|
|
35
35
|
<thead>
|
|
36
|
-
${e} ${
|
|
36
|
+
${e} ${r}
|
|
37
37
|
</thead>
|
|
38
|
-
`}sortIconTemplate(e){return"ascending"===e?l.html`<md-icon name="sort-descending-bold" size="16" iconSet="momentumDesign"></md-icon>`:"descending"===e?l.html`<md-icon name="sort-ascending-bold" size="16" iconSet="momentumDesign"></md-icon>`:l.html`<md-icon name="unsorted-bold" size="16" iconSet="momentumDesign"></md-icon>`}renderCol(e,t){var o
|
|
38
|
+
`}sortIconTemplate(e){return"ascending"===e?l.html`<md-icon name="sort-descending-bold" size="16" iconSet="momentumDesign"></md-icon>`:"descending"===e?l.html`<md-icon name="sort-ascending-bold" size="16" iconSet="momentumDesign"></md-icon>`:l.html`<md-icon name="unsorted-bold" size="16" iconSet="momentumDesign"></md-icon>`}renderCol(e,t){var r,o;const i=null===(o=null===(r=e.filter)||void 0===r?void 0:r.list[e.filter.selectedIndex])||void 0===o?void 0:o.input,a=Object(s.classMap)({ascending:"ascending"==e.sort,descending:"descending"==e.sort});return l.html`
|
|
39
39
|
<th
|
|
40
40
|
rowspan=${Object(d.ifDefined)(t)}
|
|
41
41
|
width=${Object(d.ifDefined)(e.width?e.width:e.options.width)}
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
<md-icon
|
|
64
64
|
class="filter-active"
|
|
65
65
|
name="filter-bold"
|
|
66
|
-
size="
|
|
66
|
+
size="16"
|
|
67
67
|
iconSet="momentumDesign"
|
|
68
68
|
></md-icon>
|
|
69
69
|
`:n.nothing}
|
|
@@ -76,8 +76,8 @@
|
|
|
76
76
|
name="filter-type"
|
|
77
77
|
@change=${t=>{e.filter.selectedIndex=t.target.value,this.updCols(),this.filter(e)}}
|
|
78
78
|
>
|
|
79
|
-
${e.filter.list.map((t,
|
|
80
|
-
<option value=${
|
|
79
|
+
${e.filter.list.map((t,r)=>l.html`
|
|
80
|
+
<option value=${r} ?selected=${e.filter.selectedIndex==r}>${t.label}</option>
|
|
81
81
|
`)}
|
|
82
82
|
</select>
|
|
83
83
|
<input
|
|
@@ -109,25 +109,25 @@
|
|
|
109
109
|
${e.index>0?l.html`
|
|
110
110
|
<div class="resize" draggable="true" @dragstart=${t=>this.onResize(t,e)}></div>
|
|
111
111
|
`:n.nothing}
|
|
112
|
-
`:n.nothing}renderBody(){let e=this.ROWS.map((e,t)=>({cells:e,idx:t,idxDrag:t,collapse:"none",first:0===t,isGhost:!1,children:[]}));const t=this.COLS.length;e=e.filter(e=>{var
|
|
112
|
+
`:n.nothing}renderBody(){let e=this.ROWS.map((e,t)=>({cells:e,idx:t,idxDrag:t,collapse:"none",first:0===t,isGhost:!1,children:[]}));const t=this.COLS.length;e=e.filter(e=>{var r;for(let o=0;o<t;o++){const t=this.COLS[o];if(null===(r=t.filter)||void 0===r?void 0:r.active){if(!t.filter.list[t.filter.selectedIndex].predicate(e.cells[o].text,t.filter.input))return!1}}return!0});const r=this.COLS.find(e=>"default"!=e.sort);if(r){const t=this.ROWS.map((e,t)=>({v:e[r.index].text,i:t})),o="ascending"==r.sort?1:-1;let i=[];if("byNumber"==r.sorter)i=t.sort((e,t)=>1==o?+e.v-+t.v:+t.v-+e.v);else if("byString"==r.sorter)i=t.sort((e,t)=>e.v==t.v?0:e.v>t.v?o:-o);else if("function"==typeof r.sorter){const e=r.sorter;i=t.sort((t,r)=>e(t.v,r.v,o))}e=i.map(t=>e[t.i])}const o=this.COLS.find(e=>e.isCollapsable);if(o){const t=o.index,r=e.reduce((e,r)=>{const o=r.cells[t].text,i=e.find(e=>e.key==o);return i?(r.collapse="child",i.children.push(r)):e.push({key:o,root:r,children:[]}),e},[]);e=[],r.forEach(t=>{e.push(t.root),t.root.collapse=0==t.children.length?"none":this.expandedRowIdx[t.root.idx]?"expanded":"collapsed",t.root.children=t.children})}return this.drops.forEach(({0:t,1:r})=>{e.splice(r,0,e.splice(t,1)[0])}),e.forEach((e,t)=>e.idxDrag=t),-1!=this.dragRow&&(e[this.dragRow].isGhost=!0,-1!=this.dropRow&&e.splice(this.dropRow,0,e.splice(this.dragRow,1)[0])),l.html`
|
|
113
113
|
<tbody>
|
|
114
|
-
${e.map(t=>{const
|
|
115
|
-
${this.renderRow(t,
|
|
114
|
+
${e.map(t=>{const r=e.length,o=t.children.length>0&&"expanded"==t.collapse&&!t.isGhost;return l.html`
|
|
115
|
+
${this.renderRow(t,r)} ${o?t.children.map(e=>this.renderRow(e,r)):n.nothing}
|
|
116
116
|
`})}
|
|
117
117
|
</tbody>
|
|
118
|
-
`}renderRow(e,t){const
|
|
118
|
+
`}renderRow(e,t){const r=Object.prototype.hasOwnProperty.call(this.selected,e.idx),o=Object(s.classMap)({selected:r,selectable:this.isSelectable&&!r,ghost:e.isGhost});return l.html`
|
|
119
119
|
<tr
|
|
120
|
-
class=${
|
|
120
|
+
class=${o}
|
|
121
121
|
tabindex=${Object(d.ifDefined)("true"===this.isRowFocusable?"0":void 0)}
|
|
122
122
|
part=${e.first?"first-row":"row"}
|
|
123
|
-
@click=${({shiftKey:t,metaKey:
|
|
123
|
+
@click=${({shiftKey:t,metaKey:r})=>{this.isSelectable&&this.selectRow({row:e,shiftKey:t,metaKey:r})}}
|
|
124
124
|
>
|
|
125
|
-
${e.cells.map((o
|
|
126
|
-
${f({cb:d.templateCb,insertIndex:d.insertIndex,template:d.template,content:
|
|
125
|
+
${e.cells.map((r,o)=>{var i;const a=this.COLS[o];let s=r.text;const d=r.template;d&&(s=d.templateCb?l.html`
|
|
126
|
+
${f({cb:d.templateCb,insertIndex:d.insertIndex,template:d.template,content:r.text,row:e.idx,col:o})}
|
|
127
127
|
`:l.html` ${Object(c.templateContent)(d.template)} `,-1!=d.insertIndex&&(s=l.html`
|
|
128
|
-
${d.insertIndex>0?
|
|
129
|
-
${d.insertIndex<
|
|
130
|
-
`));const h=(null===(i=this.tableConfig.rows)||void 0===i?void 0:i.isDraggable)&&"child"!=e.collapse,p=h&&-1!=this.dragRow&&this.dragRow!=e.idxDrag,b=h&&0==
|
|
128
|
+
${d.insertIndex>0?r.text.substring(0,d.insertIndex):n.nothing} ${s}
|
|
129
|
+
${d.insertIndex<r.text.length-1?r.text.substring(d.insertIndex):n.nothing}
|
|
130
|
+
`));const h=(null===(i=this.tableConfig.rows)||void 0===i?void 0:i.isDraggable)&&"child"!=e.collapse,p=h&&-1!=this.dragRow&&this.dragRow!=e.idxDrag,b=h&&0==o,g=l.html`
|
|
131
131
|
<div
|
|
132
132
|
class="inner-cell"
|
|
133
133
|
draggable="false"
|
|
@@ -141,7 +141,7 @@
|
|
|
141
141
|
></div>
|
|
142
142
|
<div
|
|
143
143
|
class="drag-area bottom"
|
|
144
|
-
@dragenter=${()=>{if(0==this.dragRow)this.dropRow=e.idxDrag;else{const
|
|
144
|
+
@dragenter=${()=>{if(0==this.dragRow)this.dropRow=e.idxDrag;else{const r=e.idxDrag+1;this.dropRow=r<t?r:t-1}}}
|
|
145
145
|
></div>
|
|
146
146
|
`:n.nothing}
|
|
147
147
|
${b?l.html`
|
|
@@ -163,6 +163,6 @@
|
|
|
163
163
|
<span>${"child"==e.collapse?n.nothing:s}</span>
|
|
164
164
|
`:l.html` <span>${s}</span> `}
|
|
165
165
|
</div>
|
|
166
|
-
`;return a.options.isHeader?l.html` <th part="cell-ishead" scope="row" title="${
|
|
166
|
+
`;return a.options.isHeader?l.html` <th part="cell-ishead" scope="row" title="${r.text}">${g}</th> `:l.html` <td part=${0===o?"first-cell":"cell"} title="${r.text}">${g}</td> `})}
|
|
167
167
|
</tr>
|
|
168
|
-
`}static get styles(){return[a.a,b]}};y([Object(l.property)({attribute:"config"})],t.prototype,"config",void 0),y([Object(l.property)({attribute:"data"})],t.prototype,"data",void 0),y([Object(l.property)({type:String})],t.prototype,"isRowFocusable",void 0),y([(e,t)=>{const
|
|
168
|
+
`}static get styles(){return[a.a,b]}};y([Object(l.property)({attribute:"config"})],t.prototype,"config",void 0),y([Object(l.property)({attribute:"data"})],t.prototype,"data",void 0),y([Object(l.property)({type:String})],t.prototype,"isRowFocusable",void 0),y([(e,t)=>{const r={get(){return new m(this,void 0!==t?t:e.key)},enumerable:!0,configurable:!0};return void 0!==t?Object.defineProperty(e,t,r):{kind:"method",placement:"prototype",key:e.key,descriptor:r}}],t.prototype,"md-table-advanced-change",void 0),y([Object(l.internalProperty)()],t.prototype,"tableConfig",void 0),y([Object(l.internalProperty)()],t.prototype,"tableData",void 0),y([Object(l.internalProperty)()],t.prototype,"error",void 0),y([Object(l.internalProperty)()],t.prototype,"COLS",void 0),y([Object(l.internalProperty)()],t.prototype,"ROWS",void 0),y([Object(l.internalProperty)()],t.prototype,"dragRow",void 0),y([Object(l.internalProperty)()],t.prototype,"dropRow",void 0),y([Object(l.internalProperty)()],t.prototype,"drops",void 0),y([Object(l.internalProperty)()],t.prototype,"dragCol",void 0),y([Object(l.internalProperty)()],t.prototype,"dropCol",void 0),y([Object(l.queryAll)("tr[tabindex]")],t.prototype,"tableRaws",void 0),y([g(500)],t.prototype,"filter",null),t=y([Object(o.a)("md-table-advanced")],t),e.ELEMENT=t}(w||(w={}))}}]);
|