@aquera/nile-elements 0.1.68 → 0.1.69
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/dist/index.js +3 -3
- package/dist/internal/resizable-table-helper.cjs.js +1 -1
- package/dist/internal/resizable-table-helper.cjs.js.map +1 -1
- package/dist/internal/resizable-table-helper.esm.js +1 -1
- package/dist/nile-table-cell-item/nile-table-cell-item.cjs.js +1 -1
- package/dist/nile-table-cell-item/nile-table-cell-item.cjs.js.map +1 -1
- package/dist/nile-table-cell-item/nile-table-cell-item.esm.js +1 -1
- package/dist/nile-table-header-item/nile-table-header-item.cjs.js +1 -1
- package/dist/nile-table-header-item/nile-table-header-item.cjs.js.map +1 -1
- package/dist/nile-table-header-item/nile-table-header-item.esm.js +2 -2
- package/dist/src/internal/resizable-table-helper.d.ts +5 -0
- package/dist/src/internal/resizable-table-helper.js +27 -4
- package/dist/src/internal/resizable-table-helper.js.map +1 -1
- package/dist/src/nile-table-cell-item/nile-table-cell-item.d.ts +2 -1
- package/dist/src/nile-table-cell-item/nile-table-cell-item.js +12 -1
- package/dist/src/nile-table-cell-item/nile-table-cell-item.js.map +1 -1
- package/dist/src/nile-table-header-item/nile-table-header-item.d.ts +2 -1
- package/dist/src/nile-table-header-item/nile-table-header-item.js +12 -1
- package/dist/src/nile-table-header-item/nile-table-header-item.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/internal/resizable-table-helper.ts +31 -8
- package/src/nile-table-cell-item/nile-table-cell-item.ts +15 -1
- package/src/nile-table-header-item/nile-table-header-item.ts +15 -1
package/README.md
CHANGED
@@ -79,6 +79,9 @@ To run a local development server that serves the basic demo located in `demo/in
|
|
79
79
|
|
80
80
|
In this section, you can find the updates for each release of `nile-elements`. It's a good practice to maintain detailed release notes to help users and developers understand what changes have been made from one version to another and how these changes might affect their projects.
|
81
81
|
|
82
|
+
#### Version 0.1.69
|
83
|
+
- Nile Table: Column resize defect fix [UIF-959]
|
84
|
+
|
82
85
|
#### Version 0.1.68
|
83
86
|
- Nile Code Editor: Code Editor Fixes [UIF-956]
|
84
87
|
|
package/dist/index.js
CHANGED
@@ -8754,7 +8754,7 @@ class Hi{constructor(e){this._element=null;const t=e??window;this._node=t,e&&(th
|
|
8754
8754
|
display: block;
|
8755
8755
|
}
|
8756
8756
|
`}
|
8757
|
-
`;function vL(e,t){e.preventDefault(),e.stopPropagation();const{minWidth:M=50,startX:i,startWidth:N,element:o}=t,s=e.target;s.classList.add("resizing");const n=e=>{e.preventDefault(),e.stopPropagation();const t=e.pageX-i,s=Math.max(M,N+t);o.style.width=s+"px",function(e,t){const M=e.closest("nile-table-body");if(!M)return;const i="nile-table-header-item"===e.tagName.toLowerCase(),N="nile-table-cell-item",o=function(e,t){const M=e.closest("nile-table-row");if(M){const i=M.querySelectorAll(t);return Array.from(i).indexOf(e)}return 0}(e,i?"nile-table-header-item":"nile-table-cell-item");M.querySelectorAll("nile-table-row").forEach((e=>{const M=e.querySelectorAll(N);M[o]&&(M[o].style.width=t+"px")}))}(o,s)},r=()=>{s.classList.remove("resizing"),document.removeEventListener("mousemove",n),document.removeEventListener("mouseup",r)};return document.addEventListener("mousemove",n),document.addEventListener("mouseup",r),()=>{document.removeEventListener("mousemove",n),document.removeEventListener("mouseup",r)}}function ZL(e){
|
8757
|
+
`;function vL(e,t){e.preventDefault(),e.stopPropagation();const{minWidth:M=50,startX:i,startWidth:N,element:o}=t,s=e.target;s.classList.add("resizing");const n=e=>{e.preventDefault(),e.stopPropagation();const t=e.pageX-i,s=Math.max(M,N+t);o.style.width=s+"px",function(e,t){const M=e.closest("nile-table-body");if(!M)return;const i="nile-table-header-item"===e.tagName.toLowerCase(),N="nile-table-cell-item",o=function(e,t){const M=e.closest("nile-table-row");if(M){const i=M.querySelectorAll(t);return Array.from(i).indexOf(e)}return 0}(e,i?"nile-table-header-item":"nile-table-cell-item");M.querySelectorAll("nile-table-row").forEach((e=>{const M=e.querySelectorAll(N);M[o]&&(M[o].style.width=t+"px")}))}(o,s)},r=()=>{s.classList.remove("resizing"),document.removeEventListener("mousemove",n),document.removeEventListener("mouseup",r)};return document.addEventListener("mousemove",n),document.addEventListener("mouseup",r),()=>{document.removeEventListener("mousemove",n),document.removeEventListener("mouseup",r)}}function ZL(e){const t=e.querySelectorAll("nile-table-header-item"),M=e.querySelectorAll("nile-table-cell-item");t.forEach((e=>{e.style.removeProperty("width")})),M.forEach((e=>{e.style.removeProperty("width")}))}function VL(e,t=50){return M=>{vL(M,{minWidth:t,startX:M.pageX,startWidth:e.offsetWidth,element:e})}}let WL=class extends Pe{constructor(){super(...arguments),this.hasSlotController=new ve(this,"[default]"),this.resizable=!1,this.handleResizeStart=VL(this,50)}static get styles(){return[YL]}updated(e){if(super.updated(e),e.has("resizable")&&!this.resizable){const e=this.closest("nile-table-body");e&&ZL(e)}}render(){return this.resizable?R`
|
8758
8758
|
<div class="cell__wrapper" part="nile__table-cell">
|
8759
8759
|
${this.hasSlotController.test("[default]")?R` <div class="column" part="nile__table-cell"><slot></slot></div>`:""}
|
8760
8760
|
<div class="resizer" @mousedown=${this.handleResizeStart}></div>
|
@@ -8823,7 +8823,7 @@ class Hi{constructor(e){this._element=null;const t=e??window;this._node=t,e&&(th
|
|
8823
8823
|
}
|
8824
8824
|
|
8825
8825
|
${bL}
|
8826
|
-
`;let _L=class extends Pe{constructor(){super(...arguments),this.type="primary",this.rows_data=[],this.header_rows_data=[],this.hasResizableColumns=!1}static get styles(){return[GL]}firstUpdated(e){this.emit("nile-body-load",{value:this.type,comp:this},!0,!1)}getChildren(e,t){return e.querySelectorAll(t)}getIndexValue(e){return this.header_rows_data.indexOf(e)}checkForResizableColumns(){this.hasResizableColumns=function(e){const t=e.
|
8826
|
+
`;let _L=class extends Pe{constructor(){super(...arguments),this.type="primary",this.rows_data=[],this.header_rows_data=[],this.hasResizableColumns=!1}static get styles(){return[GL]}firstUpdated(e){this.emit("nile-body-load",{value:this.type,comp:this},!0,!1)}getChildren(e,t){return e.querySelectorAll(t)}getIndexValue(e){return this.header_rows_data.indexOf(e)}checkForResizableColumns(){this.hasResizableColumns=function(e){const t=Array.from(e.children),M=t.some((e=>"nile-table-header-item"===e.tagName.toLowerCase()&&e.hasAttribute("resizable"))),i=t.some((e=>"nile-table-cell-item"===e.tagName.toLowerCase()&&e.hasAttribute("resizable")));return M||i}(this)}handleSlotchange(e){let t=[];this._childNodes.forEach((e=>{if(e.tagName&&"nile-table-row"===e?.tagName?.toLowerCase()){let M=this.getChildren(e,"nile-table-cell-item");if(M.length>0)M.forEach((e=>{t.push(e.innerHTML)})),this.rows_data.push(t);else{let t=this.getChildren(e,"nile-table-header-item");t.length>0&&t.forEach(((e,t)=>{this.header_rows_data.push(e.innerHTML)}))}t=[]}})),this.checkForResizableColumns()}handleSort(e){const{curr_sort_string:t,order:M}=e.detail.value,i=this.getIndexValue(t);this.emit("nile-sort",{value:{header_index:i,curr_sort_string:t,order:M}})}handleSearch(e){const t=e.detail.value;this.search__index=this.getIndexValue(e.target.textContent),this.emit("nile-table-search",{index:this.search__index,value:t})}render(){return R`
|
8827
8827
|
<div class="base" part="base">
|
8828
8828
|
<slot name="table__header" class="table__header"></slot>
|
8829
8829
|
<slot
|
@@ -8894,7 +8894,7 @@ class Hi{constructor(e){this._element=null;const t=e??window;this._node=t,e&&(th
|
|
8894
8894
|
|
8895
8895
|
${CL}
|
8896
8896
|
${fL}
|
8897
|
-
`;let FL=class extends Pe{constructor(){super(...arguments),this.hasSlotController=new ve(this,"[default]"),this.havesort=!1,this.havefilter=!1,this.iconName="",this.resizable=!1,this.sorting_ct=0,this.handleResizeStart=VL(this,50)}static get styles(){return[BL]}handleSort(e){this.sorting_ct++;let t=this.hasSlotController.host.innerHTML;this.emit("nile-click-sort",{value:{curr_sort_string:t,order:["normal","asc","des"][this.sorting_ct%3]}})}handleSearch(e){this.emit("nile-search",{value:e.detail.value})}render(){return R`
|
8897
|
+
`;let FL=class extends Pe{constructor(){super(...arguments),this.hasSlotController=new ve(this,"[default]"),this.havesort=!1,this.havefilter=!1,this.iconName="",this.resizable=!1,this.sorting_ct=0,this.handleResizeStart=VL(this,50)}static get styles(){return[BL]}updated(e){if(super.updated(e),e.has("resizable")&&!this.resizable){const e=this.closest("nile-table-body");e&&ZL(e)}}handleSort(e){this.sorting_ct++;let t=this.hasSlotController.host.innerHTML;this.emit("nile-click-sort",{value:{curr_sort_string:t,order:["normal","asc","des"][this.sorting_ct%3]}})}handleSearch(e){this.emit("nile-search",{value:e.detail.value})}render(){return R`
|
8898
8898
|
<div class="header__item__wrapper" part="nile__table-header-cell">
|
8899
8899
|
<div class="headers">
|
8900
8900
|
<slot> </slot>
|
@@ -1,2 +1,2 @@
|
|
1
|
-
System.register([],function(_export,_context){"use strict";function e(e,t){e.preventDefault(),e.stopPropagation();var _t$minWidth=t.minWidth,n=_t$minWidth===void 0?50:_t$minWidth,i=t.startX,o=t.startWidth,
|
1
|
+
System.register([],function(_export,_context){"use strict";function e(e,t){e.preventDefault(),e.stopPropagation();var _t$minWidth=t.minWidth,n=_t$minWidth===void 0?50:_t$minWidth,i=t.startX,o=t.startWidth,l=t.element,r=e.target;r.classList.add("resizing");var a=function a(e){e.preventDefault(),e.stopPropagation();var t=e.pageX-i,r=Math.max(n,o+t);l.style.width=r+"px",function(e,t){var n=e.closest("nile-table-body");if(!n)return;var i="nile-table-header-item"===e.tagName.toLowerCase(),o="nile-table-cell-item",l=function(e,t){var n=e.closest("nile-table-row");if(n){var _i=n.querySelectorAll(t);return Array.from(_i).indexOf(e);}return 0;}(e,i?"nile-table-header-item":"nile-table-cell-item");n.querySelectorAll("nile-table-row").forEach(function(e){var n=e.querySelectorAll(o);n[l]&&(n[l].style.width=t+"px");});}(l,r);},_c=function c(){r.classList.remove("resizing"),document.removeEventListener("mousemove",a),document.removeEventListener("mouseup",_c);};return document.addEventListener("mousemove",a),document.addEventListener("mouseup",_c),function(){document.removeEventListener("mousemove",a),document.removeEventListener("mouseup",_c);};}function t(e){var t=e.querySelectorAll("nile-table-header-item"),n=e.querySelectorAll("nile-table-cell-item");t.forEach(function(e){e.style.removeProperty("width");}),n.forEach(function(e){e.style.removeProperty("width");});}function n(t){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:50;return function(i){e(i,{minWidth:n,startX:i.pageX,startWidth:t.offsetWidth,element:t});};}function i(e){var t=Array.from(e.children),n=t.some(function(e){return"nile-table-header-item"===e.tagName.toLowerCase()&&e.hasAttribute("resizable");}),i=t.some(function(e){return"nile-table-cell-item"===e.tagName.toLowerCase()&&e.hasAttribute("resizable");});return n||i;}_export({c:n,h:i,r:t});return{setters:[],execute:function execute(){}};});
|
2
2
|
//# sourceMappingURL=resizable-table-helper.cjs.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"resizable-table-helper.cjs.js","sources":["../../../src/internal/resizable-table-helper.ts"],"sourcesContent":["/**\n * Copyright Aquera Inc 2025\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n/**\n * Resizable Helper Utility\n * Provides common functionality for resizable table columns\n */\n\nexport interface ResizeOptions {\n minWidth?: number;\n startX: number;\n startWidth: number;\n element: HTMLElement;\n}\n\nexport interface ColumnResizeData {\n columnIndex: number;\n newWidth: number;\n}\n\n/**\n * Handles the start of a resize operation\n * @param e Mouse event\n * @param options Resize configuration options\n * @returns Cleanup function to remove event listeners\n */\nexport function handleResizeStart(e: MouseEvent, options: ResizeOptions): () => void {\n e.preventDefault();\n e.stopPropagation();\n \n const { minWidth = 50, startX, startWidth, element } = options;\n const resizer = e.target as HTMLElement;\n \n resizer.classList.add('resizing');\n\n const onMouseMove = (e: MouseEvent) => {\n e.preventDefault();\n e.stopPropagation();\n \n const delta = e.pageX - startX;\n const newWidth = Math.max(minWidth, startWidth + delta);\n\n element.style.width = newWidth + 'px';\n\n synchronizeColumnWidth(element, newWidth);\n };\n\n const onMouseUp = () => {\n resizer.classList.remove('resizing');\n document.removeEventListener('mousemove', onMouseMove);\n document.removeEventListener('mouseup', onMouseUp);\n };\n\n document.addEventListener('mousemove', onMouseMove);\n document.addEventListener('mouseup', onMouseUp);\n\n return () => {\n document.removeEventListener('mousemove', onMouseMove);\n document.removeEventListener('mouseup', onMouseUp);\n };\n}\n\n/**\n * Gets the column index of an element within its table row\n * @param element The table cell or header element\n * @param selector The CSS selector for the column elements\n * @returns Column index (0-based)\n */\nexport function getColumnIndex(element: HTMLElement, selector: string): number {\n const tableRow = element.closest('nile-table-row');\n if (tableRow) {\n const columns = tableRow.querySelectorAll(selector);\n return Array.from(columns).indexOf(element);\n }\n return 0;\n}\n\n/**\n * Synchronizes the width of all cells in the same column\n * @param sourceElement The element that was resized\n * @param newWidth The new width to apply\n */\nexport function synchronizeColumnWidth(sourceElement: HTMLElement, newWidth: number): void {\n const tableBody = sourceElement.closest('nile-table-body');\n if (!tableBody) return;\n\n const isHeader = sourceElement.tagName.toLowerCase() === 'nile-table-header-item';\n const selector = isHeader ? 'nile-table-header-item' : 'nile-table-cell-item';\n const targetSelector = isHeader ? 'nile-table-cell-item' : 'nile-table-cell-item';\n \n const columnIndex = getColumnIndex(sourceElement, selector);\n const rows = tableBody.querySelectorAll('nile-table-row');\n \n rows.forEach(row => {\n const cells = row.querySelectorAll(targetSelector);\n if (cells[columnIndex]) {\n cells[columnIndex].style.width = newWidth + 'px';\n }\n });\n}\n\n/**\n * Checks if an element has the resizable attribute\n * @param element The element to check\n * @returns True if the element is resizable\n */\nexport function isResizable(element: HTMLElement): boolean {\n return element.hasAttribute('resizable');\n}\n\n/**\n * Creates a resize handler function for use in component event listeners\n * @param element The element to make resizable\n * @param minWidth Minimum width constraint\n * @returns Event handler function\n */\nexport function createResizeHandler(element: HTMLElement, minWidth: number = 50): (e: MouseEvent) => void {\n return (e: MouseEvent) => {\n const options: ResizeOptions = {\n minWidth,\n startX: e.pageX,\n startWidth: element.offsetWidth,\n element\n };\n \n handleResizeStart(e, options);\n };\n}\n\n/**\n * Detects if any columns in a table are resizable\n * @param tableBody The table body element\n * @returns True if any columns have resizable attribute\n */\nexport function hasResizableColumns(tableBody: HTMLElement): boolean {\n const
|
1
|
+
{"version":3,"file":"resizable-table-helper.cjs.js","sources":["../../../src/internal/resizable-table-helper.ts"],"sourcesContent":["/**\n * Copyright Aquera Inc 2025\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n/**\n * Resizable Helper Utility\n * Provides common functionality for resizable table columns\n */\n\nexport interface ResizeOptions {\n minWidth?: number;\n startX: number;\n startWidth: number;\n element: HTMLElement;\n}\n\nexport interface ColumnResizeData {\n columnIndex: number;\n newWidth: number;\n}\n\n/**\n * Handles the start of a resize operation\n * @param e Mouse event\n * @param options Resize configuration options\n * @returns Cleanup function to remove event listeners\n */\nexport function handleResizeStart(e: MouseEvent, options: ResizeOptions): () => void {\n e.preventDefault();\n e.stopPropagation();\n \n const { minWidth = 50, startX, startWidth, element } = options;\n const resizer = e.target as HTMLElement;\n \n resizer.classList.add('resizing');\n\n const onMouseMove = (e: MouseEvent) => {\n e.preventDefault();\n e.stopPropagation();\n \n const delta = e.pageX - startX;\n const newWidth = Math.max(minWidth, startWidth + delta);\n\n element.style.width = newWidth + 'px';\n\n synchronizeColumnWidth(element, newWidth);\n };\n\n const onMouseUp = () => {\n resizer.classList.remove('resizing');\n document.removeEventListener('mousemove', onMouseMove);\n document.removeEventListener('mouseup', onMouseUp);\n };\n\n document.addEventListener('mousemove', onMouseMove);\n document.addEventListener('mouseup', onMouseUp);\n\n return () => {\n document.removeEventListener('mousemove', onMouseMove);\n document.removeEventListener('mouseup', onMouseUp);\n };\n}\n\n/**\n * Gets the column index of an element within its table row\n * @param element The table cell or header element\n * @param selector The CSS selector for the column elements\n * @returns Column index (0-based)\n */\nexport function getColumnIndex(element: HTMLElement, selector: string): number {\n const tableRow = element.closest('nile-table-row');\n if (tableRow) {\n const columns = tableRow.querySelectorAll(selector);\n return Array.from(columns).indexOf(element);\n }\n return 0;\n}\n\n/**\n * Synchronizes the width of all cells in the same column\n * @param sourceElement The element that was resized\n * @param newWidth The new width to apply\n */\nexport function synchronizeColumnWidth(sourceElement: HTMLElement, newWidth: number): void {\n const tableBody = sourceElement.closest('nile-table-body');\n if (!tableBody) return;\n\n const isHeader = sourceElement.tagName.toLowerCase() === 'nile-table-header-item';\n const selector = isHeader ? 'nile-table-header-item' : 'nile-table-cell-item';\n const targetSelector = isHeader ? 'nile-table-cell-item' : 'nile-table-cell-item';\n \n const columnIndex = getColumnIndex(sourceElement, selector);\n const rows = tableBody.querySelectorAll('nile-table-row');\n \n rows.forEach(row => {\n const cells = row.querySelectorAll(targetSelector);\n if (cells[columnIndex]) {\n cells[columnIndex].style.width = newWidth + 'px';\n }\n });\n}\n\n/**\n * Resets all column widths in a table to their default values\n * @param tableBody The table body element to reset\n */\nexport function resetAllColumnWidths(tableBody: HTMLElement): void {\n const headerItems = tableBody.querySelectorAll('nile-table-header-item');\n const cellItems = tableBody.querySelectorAll('nile-table-cell-item');\n \n headerItems.forEach(header => {\n header.style.removeProperty('width');\n });\n \n cellItems.forEach(cell => {\n cell.style.removeProperty('width');\n });\n}\n\n/**\n * Checks if an element has the resizable attribute\n * @param element The element to check\n * @returns True if the element is resizable\n */\nexport function isResizable(element: HTMLElement): boolean {\n return element.hasAttribute('resizable');\n}\n\n/**\n * Creates a resize handler function for use in component event listeners\n * @param element The element to make resizable\n * @param minWidth Minimum width constraint\n * @returns Event handler function\n */\nexport function createResizeHandler(element: HTMLElement, minWidth: number = 50): (e: MouseEvent) => void {\n return (e: MouseEvent) => {\n const options: ResizeOptions = {\n minWidth,\n startX: e.pageX,\n startWidth: element.offsetWidth,\n element\n };\n \n handleResizeStart(e, options);\n };\n}\n\n/**\n * Detects if any columns in a table are resizable\n * @param tableBody The table body element\n * @returns True if any columns have resizable attribute\n */\nexport function hasResizableColumns(tableBody: HTMLElement): boolean {\n const directChildren = Array.from(tableBody.children);\n \n const hasResizableHeaders = directChildren.some(child => {\n if (child.tagName.toLowerCase() === 'nile-table-header-item') {\n return child.hasAttribute('resizable');\n }\n return false;\n });\n \n const hasResizableCells = directChildren.some(child => {\n if (child.tagName.toLowerCase() === 'nile-table-cell-item') {\n return child.hasAttribute('resizable');\n }\n return false;\n });\n \n return hasResizableHeaders || hasResizableCells;\n} \n"],"names":["handleResizeStart","e","options","preventDefault","stopPropagation","_t$minWidth","minWidth","startX","startWidth","element","resizer","target","classList","add","onMouseMove","delta","pageX","newWidth","Math","max","style","width","sourceElement","tableBody","closest","isHeader","tagName","toLowerCase","targetSelector","columnIndex","selector","tableRow","columns","querySelectorAll","Array","from","indexOf","getColumnIndex","forEach","row","cells","synchronizeColumnWidth","onMouseUp","remove","document","removeEventListener","addEventListener","resetAllColumnWidths","headerItems","cellItems","header","removeProperty","cell","createResizeHandler","arguments","length","undefined","offsetWidth","t","hasResizableColumns","directChildren","children","hasResizableHeaders","some","child","hasAttribute","hasResizableCells"],"mappings":"2DA8BgB,QAAAA,CAAAA,CAAAA,CAAkBC,CAAeC,CAAAA,CAAAA,CAAAA,CAC/CD,CAAEE,CAAAA,cAAAA,CAAAA,CAAAA,CACFF,CAAEG,CAAAA,eAAAA,CAAAA,CAAAA,CAEF,IAAAC,WAAA,CAAuDH,CAAAA,CAAjDI,QAAAA,CAAEA,CAAW,CAAAD,WAAA,UAAA,EAAA,CAAAA,WAAA,CAAIE,CAAAA,CAAgCL,CAAAA,CAAlCK,MAAEA,CAAQC,CAAUC,CAAcP,CAAAA,CAA1BM,WAAcC,CAAYP,CAAAA,CAAAA,CAAdO,OAAAA,CACnCC,CAAUT,CAAAA,CAAAA,CAAEU,MAElBD,CAAAA,CAAAA,CAAQE,SAAUC,CAAAA,GAAAA,CAAI,UAEtB,CAAA,CAAA,GAAMC,CAAAA,CAAeb,CAAAA,QAAfa,CAAAA,CAAeb,CAAAA,CAAAA,CAAAA,CACnBA,EAAEE,cACFF,CAAAA,CAAAA,CAA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AA,IAAAD,SAAA,MAAAE,SAAA,CAAAF,SAAA,IAAA,EAAA,CAC3E,MAAQrD,UAAAA,CAAAA,CAAAA,CAQND,CAAkBC,CAAAA,CAAAA,CAPa,CAC7BK,QAAAA,CAAAA,CAAAA,CACAC,MAAQN,CAAAA,CAAAA,CAAEe,KACVR,CAAAA,UAAAA,CAAYC,CAAQgD,CAAAA,WAAAA,CACpBhD,OAG2B,CAAAiD,CAAA,CAAA,CAAA,EAEjC,EAOM,QAAUC,CAAAA,CAAoBpC,CAAAA,CAAAA,CAAAA,CAClC,GAAMqC,CAAAA,CAAAA,CAAiB1B,KAAMC,CAAAA,IAAAA,CAAKZ,EAAUsC,QAEtCC,CAAAA,CAAAA,CAAAA,CAAsBF,CAAeG,CAAAA,IAAAA,CAAKC,SAAAA,CACV,QAAA,wBAAA,GAAhCA,CAAMtC,CAAAA,OAAAA,CAAQC,WACTqC,CAAAA,CAAAA,EAAAA,CAAAA,CAAMC,YAAa,CAAA,WAAA,CAAA,EAAA,CAAA,CAKxBC,CAAoBN,CAAAA,CAAAA,CAAeG,IAAKC,CAAAA,SAAAA,CAAAA,QACR,sBAAhCA,GAAAA,CAAAA,CAAMtC,OAAQC,CAAAA,WAAAA,CAAAA,CAAAA,EACTqC,CAAMC,CAAAA,YAAAA,CAAa,WAK9B,CAAA,EAAA,CAAA,CAAA,MAAOH,CAAAA,CAAuBI,EAAAA,CAChC"}
|
@@ -1 +1 @@
|
|
1
|
-
function e(e,t){e.preventDefault(),e.stopPropagation();const{minWidth:n=50,startX:i,startWidth:o,element:
|
1
|
+
function e(e,t){e.preventDefault(),e.stopPropagation();const{minWidth:n=50,startX:i,startWidth:o,element:l}=t,r=e.target;r.classList.add("resizing");const a=e=>{e.preventDefault(),e.stopPropagation();const t=e.pageX-i,r=Math.max(n,o+t);l.style.width=r+"px",function(e,t){const n=e.closest("nile-table-body");if(!n)return;const i="nile-table-header-item"===e.tagName.toLowerCase(),o="nile-table-cell-item",l=function(e,t){const n=e.closest("nile-table-row");if(n){const i=n.querySelectorAll(t);return Array.from(i).indexOf(e)}return 0}(e,i?"nile-table-header-item":"nile-table-cell-item");n.querySelectorAll("nile-table-row").forEach((e=>{const n=e.querySelectorAll(o);n[l]&&(n[l].style.width=t+"px")}))}(l,r)},c=()=>{r.classList.remove("resizing"),document.removeEventListener("mousemove",a),document.removeEventListener("mouseup",c)};return document.addEventListener("mousemove",a),document.addEventListener("mouseup",c),()=>{document.removeEventListener("mousemove",a),document.removeEventListener("mouseup",c)}}function t(e){const t=e.querySelectorAll("nile-table-header-item"),n=e.querySelectorAll("nile-table-cell-item");t.forEach((e=>{e.style.removeProperty("width")})),n.forEach((e=>{e.style.removeProperty("width")}))}function n(t,n=50){return i=>{e(i,{minWidth:n,startX:i.pageX,startWidth:t.offsetWidth,element:t})}}function i(e){const t=Array.from(e.children),n=t.some((e=>"nile-table-header-item"===e.tagName.toLowerCase()&&e.hasAttribute("resizable"))),i=t.some((e=>"nile-table-cell-item"===e.tagName.toLowerCase()&&e.hasAttribute("resizable")));return n||i}export{n as c,i as h,t as r};
|
@@ -1,2 +1,2 @@
|
|
1
|
-
function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o;}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o;},_typeof(o);}System.register(["tslib","lit","lit/decorators.js","./nile-table-cell-item.css.cjs.js","../internal/nile-element.cjs.js","../internal/slot.cjs.js","../internal/resizable-table-helper.cjs.js","../internal/resizable-table-styles.cjs.js"],function(_export,_context){"use strict";var e,t,s,l,i,r,a,o,_templateObject,_templateObject2,_templateObject3,_templateObject4,c;function _taggedTemplateLiteral(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}));}function _classCallCheck(a,n){if(!(a instanceof n))throw new TypeError("Cannot call a class as a function");}function _defineProperties(e,r){for(var t=0;t<r.length;t++){var o=r[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,_toPropertyKey(o.key),o);}}function _createClass(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e;}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"==_typeof(i)?i:i+"";}function _toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.");}return("string"===r?String:Number)(t);}function _callSuper(t,o,e){return o=_getPrototypeOf(o),_possibleConstructorReturn(t,_isNativeReflectConstruct()?Reflect.construct(o,e||[],_getPrototypeOf(t).constructor):o.apply(t,e));}function _possibleConstructorReturn(t,e){if(e&&("object"==_typeof(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(t);}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e;}function _isNativeReflectConstruct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(t){}return(_isNativeReflectConstruct=function _isNativeReflectConstruct(){return!!t;})();}function _getPrototypeOf(t){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t);},_getPrototypeOf(t);}function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_setPrototypeOf(t,e);}function _setPrototypeOf(t,e){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t;},_setPrototypeOf(t,e);}return{setters:[function(_tslib){e=_tslib.__decorate;},function(_lit){t=_lit.html;},function(_litDecoratorsJs){s=_litDecoratorsJs.property;l=_litDecoratorsJs.customElement;},function(_nileTableCellItemCssCjsJs){i=_nileTableCellItemCssCjsJs.s;},function(_internalNileElementCjsJs){r=_internalNileElementCjsJs.N;},function(_internalSlotCjsJs){a=_internalSlotCjsJs.H;},function(_internalResizableTableHelperCjsJs){o=_internalResizableTableHelperCjsJs.c;},function(_internalResizableTableStylesCjsJs){}],execute:function execute(){_export("N",c=/*#__PURE__*/function(_r){function c(){var _this;_classCallCheck(this,c);_this=_callSuper(this,c,arguments),_this.hasSlotController=new a(_assertThisInitialized(_this),"[default]"),_this.resizable=!1,_this.handleResizeStart=o(_assertThisInitialized(_this),50);return _this;}_inherits(c,_r);return _createClass(c,[{key:"render",value:function render(){return this.resizable?t(_templateObject||(_templateObject=_taggedTemplateLiteral(["\n <div class=\"cell__wrapper\" part=\"nile__table-cell\">\n ","\n <div class=\"resizer\" @mousedown=","></div>\n </div>\n "])),this.hasSlotController.test("[default]")?t(_templateObject2||(_templateObject2=_taggedTemplateLiteral([" <div class=\"column\" part=\"nile__table-cell\"><slot></slot></div>"]))):"",this.handleResizeStart):t(_templateObject3||(_templateObject3=_taggedTemplateLiteral(["\n ","\n "])),this.hasSlotController.test("[default]")?t(_templateObject4||(_templateObject4=_taggedTemplateLiteral([" <slot class=\"column\" part=\"nile__table-cell\"> </slot>"]))):"");}}],[{key:"styles",get:function get(){return[i];}}]);}(r));e([s({type:Boolean,reflect:!0})],c.prototype,"resizable",void 0),_export("N",c=e([l("nile-table-cell-item")],c));}};});
|
1
|
+
function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o;}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o;},_typeof(o);}System.register(["tslib","lit","lit/decorators.js","./nile-table-cell-item.css.cjs.js","../internal/nile-element.cjs.js","../internal/slot.cjs.js","../internal/resizable-table-helper.cjs.js","../internal/resizable-table-styles.cjs.js"],function(_export,_context){"use strict";var e,t,s,l,i,r,a,o,n,_templateObject,_templateObject2,_templateObject3,_templateObject4,c;function _taggedTemplateLiteral(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}));}function _classCallCheck(a,n){if(!(a instanceof n))throw new TypeError("Cannot call a class as a function");}function _defineProperties(e,r){for(var t=0;t<r.length;t++){var o=r[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,_toPropertyKey(o.key),o);}}function _createClass(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e;}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"==_typeof(i)?i:i+"";}function _toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.");}return("string"===r?String:Number)(t);}function _callSuper(t,o,e){return o=_getPrototypeOf(o),_possibleConstructorReturn(t,_isNativeReflectConstruct()?Reflect.construct(o,e||[],_getPrototypeOf(t).constructor):o.apply(t,e));}function _possibleConstructorReturn(t,e){if(e&&("object"==_typeof(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(t);}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e;}function _isNativeReflectConstruct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(t){}return(_isNativeReflectConstruct=function _isNativeReflectConstruct(){return!!t;})();}function _superPropGet(t,o,e,r){var p=_get(_getPrototypeOf(1&r?t.prototype:t),o,e);return 2&r&&"function"==typeof p?function(t){return p.apply(e,t);}:p;}function _get(){return _get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var p=_superPropBase(e,t);if(p){var n=Object.getOwnPropertyDescriptor(p,t);return n.get?n.get.call(arguments.length<3?e:r):n.value;}},_get.apply(null,arguments);}function _superPropBase(t,o){for(;!{}.hasOwnProperty.call(t,o)&&null!==(t=_getPrototypeOf(t)););return t;}function _getPrototypeOf(t){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t);},_getPrototypeOf(t);}function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_setPrototypeOf(t,e);}function _setPrototypeOf(t,e){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t;},_setPrototypeOf(t,e);}return{setters:[function(_tslib){e=_tslib.__decorate;},function(_lit){t=_lit.html;},function(_litDecoratorsJs){s=_litDecoratorsJs.property;l=_litDecoratorsJs.customElement;},function(_nileTableCellItemCssCjsJs){i=_nileTableCellItemCssCjsJs.s;},function(_internalNileElementCjsJs){r=_internalNileElementCjsJs.N;},function(_internalSlotCjsJs){a=_internalSlotCjsJs.H;},function(_internalResizableTableHelperCjsJs){o=_internalResizableTableHelperCjsJs.c;n=_internalResizableTableHelperCjsJs.r;},function(_internalResizableTableStylesCjsJs){}],execute:function execute(){_export("N",c=/*#__PURE__*/function(_r){function c(){var _this;_classCallCheck(this,c);_this=_callSuper(this,c,arguments),_this.hasSlotController=new a(_assertThisInitialized(_this),"[default]"),_this.resizable=!1,_this.handleResizeStart=o(_assertThisInitialized(_this),50);return _this;}_inherits(c,_r);return _createClass(c,[{key:"updated",value:function updated(e){if(_superPropGet(c,"updated",this,3)([e]),e.has("resizable")&&!this.resizable){var _e=this.closest("nile-table-body");_e&&n(_e);}}},{key:"render",value:function render(){return this.resizable?t(_templateObject||(_templateObject=_taggedTemplateLiteral(["\n <div class=\"cell__wrapper\" part=\"nile__table-cell\">\n ","\n <div class=\"resizer\" @mousedown=","></div>\n </div>\n "])),this.hasSlotController.test("[default]")?t(_templateObject2||(_templateObject2=_taggedTemplateLiteral([" <div class=\"column\" part=\"nile__table-cell\"><slot></slot></div>"]))):"",this.handleResizeStart):t(_templateObject3||(_templateObject3=_taggedTemplateLiteral(["\n ","\n "])),this.hasSlotController.test("[default]")?t(_templateObject4||(_templateObject4=_taggedTemplateLiteral([" <slot class=\"column\" part=\"nile__table-cell\"> </slot>"]))):"");}}],[{key:"styles",get:function get(){return[i];}}]);}(r));e([s({type:Boolean,reflect:!0})],c.prototype,"resizable",void 0),_export("N",c=e([l("nile-table-cell-item")],c));}};});
|
2
2
|
//# sourceMappingURL=nile-table-cell-item.cjs.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"nile-table-cell-item.cjs.js","sources":["../../../src/nile-table-cell-item/nile-table-cell-item.ts"],"sourcesContent":["/**\n * Copyright Aquera Inc 2023\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport {\n LitElement,\n html,\n CSSResultArray,\n TemplateResult,\n} from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { styles } from './nile-table-cell-item.css';\nimport NileElement from '../internal/nile-element';\nimport { HasSlotController } from '../internal/slot';\nimport { createResizeHandler } from '../internal/resizable-table-helper';\n\n/**\n * Nile table Cell Item component.\n *\n * @tag nile-table-cell-item\n *\n */\n@customElement('nile-table-cell-item')\nexport class NileTableCellItem extends NileElement {\n private readonly hasSlotController = new HasSlotController(this, '[default]');\n /**\n * The styles for TableCellItem\n * @remarks If you are extending this class you can extend the base styles with super. Eg `return [super(), myCustomStyles]`\n */\n public static get styles(): CSSResultArray {\n return [styles];\n }\n\n /** Enables the resize functionality. */\n @property({ type: Boolean, reflect: true }) resizable = false;\n\n /* #endregion */\n\n /* #region Methods */\n\n private handleResizeStart = createResizeHandler(this, 50);\n\n /**\n * Render method\n * @slot This is a slot test\n */\n public render(): TemplateResult {\n if (this.resizable) {\n return html`\n <div class=\"cell__wrapper\" part=\"nile__table-cell\">\n ${this.hasSlotController.test('[default]')\n ? html` <div class=\"column\" part=\"nile__table-cell\"><slot></slot></div>`\n : ''}\n <div class=\"resizer\" @mousedown=${this.handleResizeStart}></div>\n </div>\n `;\n } else {\n return html`\n ${this.hasSlotController.test('[default]')\n ? html` <slot class=\"column\" part=\"nile__table-cell\"> </slot>`\n : ''}\n `;\n }\n }\n\n /* #endregion */\n}\n\nexport default NileTableCellItem;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-table-cell-item': NileTableCellItem;\n }\n}\n"],"names":["NileTableCellItem","c","this","hasSlotController","HasSlotController","resizable","handleResizeStart","createResizeHandler","_this","_inherits","
|
1
|
+
{"version":3,"file":"nile-table-cell-item.cjs.js","sources":["../../../src/nile-table-cell-item/nile-table-cell-item.ts"],"sourcesContent":["/**\n * Copyright Aquera Inc 2023\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport {\n LitElement,\n html,\n CSSResultArray,\n TemplateResult,\n PropertyValues,\n} from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { styles } from './nile-table-cell-item.css';\nimport NileElement from '../internal/nile-element';\nimport { HasSlotController } from '../internal/slot';\nimport { createResizeHandler, resetAllColumnWidths } from '../internal/resizable-table-helper';\n\n/**\n * Nile table Cell Item component.\n *\n * @tag nile-table-cell-item\n *\n */\n@customElement('nile-table-cell-item')\nexport class NileTableCellItem extends NileElement {\n private readonly hasSlotController = new HasSlotController(this, '[default]');\n /**\n * The styles for TableCellItem\n * @remarks If you are extending this class you can extend the base styles with super. Eg `return [super(), myCustomStyles]`\n */\n public static get styles(): CSSResultArray {\n return [styles];\n }\n\n /** Enables the resize functionality. */\n @property({ type: Boolean, reflect: true }) resizable = false;\n\n /* #endregion */\n\n /* #region Methods */\n\n private handleResizeStart = createResizeHandler(this, 50);\n\n protected updated(changedProperties: PropertyValues) {\n super.updated(changedProperties);\n \n if (changedProperties.has('resizable')) {\n if (!this.resizable) {\n const tableBody = this.closest('nile-table-body');\n if (tableBody) {\n resetAllColumnWidths(tableBody);\n }\n }\n }\n }\n\n /**\n * Render method\n * @slot This is a slot test\n */\n public render(): TemplateResult {\n if (this.resizable) {\n return html`\n <div class=\"cell__wrapper\" part=\"nile__table-cell\">\n ${this.hasSlotController.test('[default]')\n ? html` <div class=\"column\" part=\"nile__table-cell\"><slot></slot></div>`\n : ''}\n <div class=\"resizer\" @mousedown=${this.handleResizeStart}></div>\n </div>\n `;\n } else {\n return html`\n ${this.hasSlotController.test('[default]')\n ? html` <slot class=\"column\" part=\"nile__table-cell\"> </slot>`\n : ''}\n `;\n }\n }\n\n /* #endregion */\n}\n\nexport default NileTableCellItem;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-table-cell-item': NileTableCellItem;\n }\n}\n"],"names":["NileTableCellItem","_r","c","this","hasSlotController","HasSlotController","resizable","handleResizeStart","createResizeHandler","_this","_inherits","_createClass","key","value","updated","changedProperties","super","has","tableBody","closest","resetAllColumnWidths","render","html","_templateObject","_taggedTemplateLiteral","test","_templateObject2","_templateObject3","_templateObject4","get","styles","NileElement","__decorate","property","type","Boolean","reflect","prototype","customElement"],"mappings":"4iIA2BaA,CAAN,uBAAAC,EAAA,EAAA,SAAAC,EAAA,uEACYC,KAAAA,CAAiBC,iBAAAA,CAAG,GAAIC,CAAAA,CAAAA,CAAAA,sBAAAA,CAAAA,KAAAA,EAAwB,WAUrBF,CAAAA,CAAAA,KAAAA,CAASG,SAAG,CAAA,CAAA,CAAA,CAMhDH,KAAAA,CAAAI,iBAAoBC,CAAAA,CAAAA,CAAAA,sBAAAA,CAAAA,KAAAA,EAA0B,EAAA,CAuCvD,QAAAC,KAAA,EAlDQC,SAAA,CAAAR,CAAA,CAAAD,EAAA,SAAAU,YAAA,CAAAT,CAAA,GAAAU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";import{html as t}from"lit";import{property as s,customElement as l}from"lit/decorators.js";import{s as i}from"./nile-table-cell-item.css.esm.js";import{N as r}from"../internal/nile-element.esm.js";import{H as a}from"../internal/slot.esm.js";import{c as o}from"../internal/resizable-table-helper.esm.js";import"../internal/resizable-table-styles.esm.js";let m=class extends r{constructor(){super(...arguments),this.hasSlotController=new a(this,"[default]"),this.resizable=!1,this.handleResizeStart=o(this,50)}static get styles(){return[i]}render(){return this.resizable?t`
|
1
|
+
import{__decorate as e}from"tslib";import{html as t}from"lit";import{property as s,customElement as l}from"lit/decorators.js";import{s as i}from"./nile-table-cell-item.css.esm.js";import{N as r}from"../internal/nile-element.esm.js";import{H as a}from"../internal/slot.esm.js";import{c as o,r as n}from"../internal/resizable-table-helper.esm.js";import"../internal/resizable-table-styles.esm.js";let m=class extends r{constructor(){super(...arguments),this.hasSlotController=new a(this,"[default]"),this.resizable=!1,this.handleResizeStart=o(this,50)}static get styles(){return[i]}updated(e){if(super.updated(e),e.has("resizable")&&!this.resizable){const e=this.closest("nile-table-body");e&&n(e)}}render(){return this.resizable?t`
|
2
2
|
<div class="cell__wrapper" part="nile__table-cell">
|
3
3
|
${this.hasSlotController.test("[default]")?t` <div class="column" part="nile__table-cell"><slot></slot></div>`:""}
|
4
4
|
<div class="resizer" @mousedown=${this.handleResizeStart}></div>
|
@@ -1,2 +1,2 @@
|
|
1
|
-
function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o;}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o;},_typeof(o);}System.register(["tslib","lit","lit/decorators.js","./nile-table-header-item.css.cjs.js","../internal/nile-element.cjs.js","../internal/slot.cjs.js","../internal/resizable-table-helper.cjs.js","../internal/resizable-table-styles.cjs.js"],function(_export,_context){"use strict";var e,i,t,s,l,r,n,o,a,_templateObject,_templateObject2,_templateObject3,_templateObject4,_templateObject5,_templateObject6,_templateObject7,_templateObject8,_templateObject9,
|
1
|
+
function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o;}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o;},_typeof(o);}System.register(["tslib","lit","lit/decorators.js","./nile-table-header-item.css.cjs.js","../internal/nile-element.cjs.js","../internal/slot.cjs.js","../internal/resizable-table-helper.cjs.js","../internal/resizable-table-styles.cjs.js"],function(_export,_context){"use strict";var e,i,t,s,l,r,n,o,a,c,_templateObject,_templateObject2,_templateObject3,_templateObject4,_templateObject5,_templateObject6,_templateObject7,_templateObject8,_templateObject9,h;function _taggedTemplateLiteral(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}));}function _classCallCheck(a,n){if(!(a instanceof n))throw new TypeError("Cannot call a class as a function");}function _defineProperties(e,r){for(var t=0;t<r.length;t++){var o=r[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,_toPropertyKey(o.key),o);}}function _createClass(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e;}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"==_typeof(i)?i:i+"";}function _toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.");}return("string"===r?String:Number)(t);}function _callSuper(t,o,e){return o=_getPrototypeOf(o),_possibleConstructorReturn(t,_isNativeReflectConstruct()?Reflect.construct(o,e||[],_getPrototypeOf(t).constructor):o.apply(t,e));}function _possibleConstructorReturn(t,e){if(e&&("object"==_typeof(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(t);}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e;}function _isNativeReflectConstruct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(t){}return(_isNativeReflectConstruct=function _isNativeReflectConstruct(){return!!t;})();}function _superPropGet(t,o,e,r){var p=_get(_getPrototypeOf(1&r?t.prototype:t),o,e);return 2&r&&"function"==typeof p?function(t){return p.apply(e,t);}:p;}function _get(){return _get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var p=_superPropBase(e,t);if(p){var n=Object.getOwnPropertyDescriptor(p,t);return n.get?n.get.call(arguments.length<3?e:r):n.value;}},_get.apply(null,arguments);}function _superPropBase(t,o){for(;!{}.hasOwnProperty.call(t,o)&&null!==(t=_getPrototypeOf(t)););return t;}function _getPrototypeOf(t){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t);},_getPrototypeOf(t);}function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_setPrototypeOf(t,e);}function _setPrototypeOf(t,e){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t;},_setPrototypeOf(t,e);}return{setters:[function(_tslib){e=_tslib.__decorate;},function(_lit){i=_lit.html;},function(_litDecoratorsJs){t=_litDecoratorsJs.property;s=_litDecoratorsJs.state;l=_litDecoratorsJs.customElement;},function(_nileTableHeaderItemCssCjsJs){r=_nileTableHeaderItemCssCjsJs.s;},function(_internalNileElementCjsJs){n=_internalNileElementCjsJs.N;},function(_internalSlotCjsJs){o=_internalSlotCjsJs.H;},function(_internalResizableTableHelperCjsJs){a=_internalResizableTableHelperCjsJs.c;c=_internalResizableTableHelperCjsJs.r;},function(_internalResizableTableStylesCjsJs){}],execute:function execute(){_export("N",h=/*#__PURE__*/function(_n){function h(){var _this;_classCallCheck(this,h);_this=_callSuper(this,h,arguments),_this.hasSlotController=new o(_assertThisInitialized(_this),"[default]"),_this.havesort=!1,_this.havefilter=!1,_this.iconName="",_this.resizable=!1,_this.sorting_ct=0,_this.handleResizeStart=a(_assertThisInitialized(_this),50);return _this;}_inherits(h,_n);return _createClass(h,[{key:"updated",value:function updated(e){if(_superPropGet(h,"updated",this,3)([e]),e.has("resizable")&&!this.resizable){var _e=this.closest("nile-table-body");_e&&c(_e);}}},{key:"handleSort",value:function handleSort(e){this.sorting_ct++;var i=this.hasSlotController.host.innerHTML;this.emit("nile-click-sort",{value:{curr_sort_string:i,order:["normal","asc","des"][this.sorting_ct%3]}});}},{key:"handleSearch",value:function handleSearch(e){this.emit("nile-search",{value:e.detail.value});}},{key:"render",value:function render(){return i(_templateObject||(_templateObject=_taggedTemplateLiteral(["\n <div class=\"header__item__wrapper\" part=\"nile__table-header-cell\">\n <div class=\"headers\">\n <slot> </slot>\n ","\n ","\n ","\n ","\n ","\n </div>\n ","\n </div>"])),this.havesort&&this.sorting_ct%3==0?i(_templateObject2||(_templateObject2=_taggedTemplateLiteral(["<nile-icon\n name=\"sortdown\"\n size=\"16\"\n @click=","\n class=\"hover__arrow\"\n ></nile-icon>"])),this.handleSort):null,this.havesort&&this.sorting_ct%3==1?i(_templateObject3||(_templateObject3=_taggedTemplateLiteral(["<nile-icon\n name=\"sortdown\"\n size=\"16\"\n @click=","\n ></nile-icon>"])),this.handleSort):null,this.havesort&&this.sorting_ct%3==2?i(_templateObject4||(_templateObject4=_taggedTemplateLiteral(["<nile-icon\n name=\"sortup\"\n size=\"16\"\n @click=","\n ></nile-icon>"])),this.handleSort):null,this.iconName?i(_templateObject5||(_templateObject5=_taggedTemplateLiteral([" <nile-icon name=\"","\" size=\"16\"></nile-icon>"])),this.iconName):i(_templateObject6||(_templateObject6=_taggedTemplateLiteral([""]))),this.havefilter?i(_templateObject7||(_templateObject7=_taggedTemplateLiteral([" <nile-popover title=\"Filter\" placement=\"bottom\">\n <nile-icon name=\"filter\" size=\"16\" slot=\"anchor\"></nile-icon>\n <nile-input\n placeholder=\"Search\"\n @nile-input=","\n part=\"filter__search\"\n ></nile-input>\n <slot name=\"filter__content\" part=\"filter__content\"></slot>\n </nile-popover>"])),this.handleSearch):i(_templateObject8||(_templateObject8=_taggedTemplateLiteral([""]))),this.resizable?i(_templateObject9||(_templateObject9=_taggedTemplateLiteral(["<div class=\"resizer\" @mousedown=","></div>"])),this.handleResizeStart):null);}}],[{key:"styles",get:function get(){return[r];}}]);}(n));e([t({type:Boolean,reflect:!0})],h.prototype,"havesort",void 0),e([t({type:Boolean,reflect:!0})],h.prototype,"havefilter",void 0),e([t({type:String,reflect:!0,attribute:"icon-name"})],h.prototype,"iconName",void 0),e([t({type:Boolean,reflect:!0})],h.prototype,"resizable",void 0),e([s()],h.prototype,"sorting_ct",void 0),_export("N",h=e([l("nile-table-header-item")],h));}};});
|
2
2
|
//# sourceMappingURL=nile-table-header-item.cjs.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"nile-table-header-item.cjs.js","sources":["../../../src/nile-table-header-item/nile-table-header-item.ts"],"sourcesContent":["/**\n * Copyright Aquera Inc 2023\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport {\n LitElement,\n html,\n CSSResultArray,\n TemplateResult,\n} from 'lit';\nimport { customElement, state, property } from 'lit/decorators.js';\nimport { styles } from './nile-table-header-item.css';\nimport NileElement from '../internal/nile-element';\nimport { HasSlotController } from '../internal/slot';\nimport { createResizeHandler } from '../internal/resizable-table-helper';\n\n/**\n * Nile icon component.\n *\n * @tag nile-table-header-item\n *\n */\n@customElement('nile-table-header-item')\nexport class NileTableHeaderItem extends NileElement {\n private readonly hasSlotController = new HasSlotController(this, '[default]');\n /**\n * The styles for TableHeaderItem\n * @remarks If you are extending this class you can extend the base styles with super. Eg `return [super(), myCustomStyles]`\n */\n public static get styles(): CSSResultArray {\n return [styles];\n }\n\n /** Enables the sort functionality. */\n @property({ type: Boolean, reflect: true }) havesort = false;\n\n /** Enables the sort functionality. */\n @property({ type: Boolean, reflect: true }) havefilter = false;\n\n /** Places the icon . */\n @property({ type: String, reflect: true, attribute: 'icon-name' }) iconName =\n '';\n\n /** Enables the resize functionality. */\n @property({ type: Boolean, reflect: true }) resizable = false;\n\n @state() sorting_ct = 0;\n\n /* #endregion */\n\n /* #region Methods */\n\n /**\n * Render method\n * @slot This is a slot test\n */\n private handleSort(e: any) {\n this.sorting_ct++;\n let curr_sort_string = this.hasSlotController.host.innerHTML;\n const order = ['normal', 'asc', 'des'];\n this.emit('nile-click-sort', {\n value: { curr_sort_string, order: order[this.sorting_ct % 3] },\n });\n }\n\n private handleSearch(e: any) {\n this.emit('nile-search', { value: e.detail.value });\n }\n\n private handleResizeStart = createResizeHandler(this, 50);\n\n public render(): TemplateResult {\n return html`\n <div class=\"header__item__wrapper\" part=\"nile__table-header-cell\">\n <div class=\"headers\">\n <slot> </slot>\n ${this.havesort && this.sorting_ct % 3 === 0\n ? html`<nile-icon\n name=\"sortdown\"\n size=\"16\"\n @click=${this.handleSort}\n class=\"hover__arrow\"\n ></nile-icon>`\n : null}\n ${this.havesort && this.sorting_ct % 3 === 1\n ? html`<nile-icon\n name=\"sortdown\"\n size=\"16\"\n @click=${this.handleSort}\n ></nile-icon>`\n : null}\n ${this.havesort && this.sorting_ct % 3 === 2\n ? html`<nile-icon\n name=\"sortup\"\n size=\"16\"\n @click=${this.handleSort}\n ></nile-icon>`\n : null}\n ${this.iconName\n ? html` <nile-icon name=\"${this.iconName}\" size=\"16\"></nile-icon>`\n : html``}\n ${this.havefilter\n ? html` <nile-popover title=\"Filter\" placement=\"bottom\">\n <nile-icon name=\"filter\" size=\"16\" slot=\"anchor\"></nile-icon>\n <nile-input\n placeholder=\"Search\"\n @nile-input=${this.handleSearch}\n part=\"filter__search\"\n ></nile-input>\n <slot name=\"filter__content\" part=\"filter__content\"></slot>\n </nile-popover>`\n : html``}\n </div>\n ${this.resizable \n ? html`<div class=\"resizer\" @mousedown=${this.handleResizeStart}></div>`\n : null}\n </div>`;\n }\n}\n\nexport default NileTableHeaderItem;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-table-header-item': NileTableHeaderItem;\n }\n}\n"],"names":["NileTableHeaderItem","
|
1
|
+
{"version":3,"file":"nile-table-header-item.cjs.js","sources":["../../../src/nile-table-header-item/nile-table-header-item.ts"],"sourcesContent":["/**\n * Copyright Aquera Inc 2023\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport {\n LitElement,\n html,\n CSSResultArray,\n TemplateResult,\n PropertyValues,\n} from 'lit';\nimport { customElement, state, property } from 'lit/decorators.js';\nimport { styles } from './nile-table-header-item.css';\nimport NileElement from '../internal/nile-element';\nimport { HasSlotController } from '../internal/slot';\nimport { createResizeHandler, resetAllColumnWidths } from '../internal/resizable-table-helper';\n\n/**\n * Nile icon component.\n *\n * @tag nile-table-header-item\n *\n */\n@customElement('nile-table-header-item')\nexport class NileTableHeaderItem extends NileElement {\n private readonly hasSlotController = new HasSlotController(this, '[default]');\n /**\n * The styles for TableHeaderItem\n * @remarks If you are extending this class you can extend the base styles with super. Eg `return [super(), myCustomStyles]`\n */\n public static get styles(): CSSResultArray {\n return [styles];\n }\n\n /** Enables the sort functionality. */\n @property({ type: Boolean, reflect: true }) havesort = false;\n\n /** Enables the sort functionality. */\n @property({ type: Boolean, reflect: true }) havefilter = false;\n\n /** Places the icon . */\n @property({ type: String, reflect: true, attribute: 'icon-name' }) iconName =\n '';\n\n /** Enables the resize functionality. */\n @property({ type: Boolean, reflect: true }) resizable = false;\n\n @state() sorting_ct = 0;\n\n /* #endregion */\n\n /* #region Methods */\n\n protected updated(changedProperties: PropertyValues) {\n super.updated(changedProperties);\n \n if (changedProperties.has('resizable')) {\n if (!this.resizable) {\n const tableBody = this.closest('nile-table-body');\n if (tableBody) {\n resetAllColumnWidths(tableBody);\n }\n }\n }\n }\n\n /**\n * Render method\n * @slot This is a slot test\n */\n private handleSort(e: any) {\n this.sorting_ct++;\n let curr_sort_string = this.hasSlotController.host.innerHTML;\n const order = ['normal', 'asc', 'des'];\n this.emit('nile-click-sort', {\n value: { curr_sort_string, order: order[this.sorting_ct % 3] },\n });\n }\n\n private handleSearch(e: any) {\n this.emit('nile-search', { value: e.detail.value });\n }\n\n private handleResizeStart = createResizeHandler(this, 50);\n\n public render(): TemplateResult {\n return html`\n <div class=\"header__item__wrapper\" part=\"nile__table-header-cell\">\n <div class=\"headers\">\n <slot> </slot>\n ${this.havesort && this.sorting_ct % 3 === 0\n ? html`<nile-icon\n name=\"sortdown\"\n size=\"16\"\n @click=${this.handleSort}\n class=\"hover__arrow\"\n ></nile-icon>`\n : null}\n ${this.havesort && this.sorting_ct % 3 === 1\n ? html`<nile-icon\n name=\"sortdown\"\n size=\"16\"\n @click=${this.handleSort}\n ></nile-icon>`\n : null}\n ${this.havesort && this.sorting_ct % 3 === 2\n ? html`<nile-icon\n name=\"sortup\"\n size=\"16\"\n @click=${this.handleSort}\n ></nile-icon>`\n : null}\n ${this.iconName\n ? html` <nile-icon name=\"${this.iconName}\" size=\"16\"></nile-icon>`\n : html``}\n ${this.havefilter\n ? html` <nile-popover title=\"Filter\" placement=\"bottom\">\n <nile-icon name=\"filter\" size=\"16\" slot=\"anchor\"></nile-icon>\n <nile-input\n placeholder=\"Search\"\n @nile-input=${this.handleSearch}\n part=\"filter__search\"\n ></nile-input>\n <slot name=\"filter__content\" part=\"filter__content\"></slot>\n </nile-popover>`\n : html``}\n </div>\n ${this.resizable \n ? html`<div class=\"resizer\" @mousedown=${this.handleResizeStart}></div>`\n : null}\n </div>`;\n }\n}\n\nexport default NileTableHeaderItem;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-table-header-item': NileTableHeaderItem;\n }\n}\n"],"names":["NileTableHeaderItem","h","constructor","this","hasSlotController","HasSlotController","havesort","havefilter","iconName","resizable","sorting_ct","handleResizeStart","createResizeHandler","_this","_inherits","_n","_createClass","key","value","updated","changedProperties","super","has","tableBody","closest","resetAllColumnWidths","handleSort","e","curr_sort_string","host","innerHTML","emit","order","handleSearch","detail","render","html","_templateObject","_taggedTemplateLiteral","_templateObject2","_templateObject3","_templateObject4","_templateObject5","_templateObject6","_templateObject7","_templateObject8","_templateObject9","get","styles","NileElement","__decorate","property","type","Boolean","reflect","prototype","String","attribute","state","_export","customElement"],"mappings":"kqIA2BaA,CAAAA,uBAAAA,EAAAA,EAAN,SAAAC,EAAA,CAAAC,KAAAA,KAAAA,CAAAA,eAAAA,MAAAA,CAAAA,qCACYC,KAAAA,CAAiBC,iBAAAA,CAAG,GAAIC,CAAAA,CAAAA,CAAAA,sBAAAA,CAAAA,KAAAA,EAAwB,WAAA,CAAA,CAUrBF,KAAAA,CAAQG,QAAAA,CAAAA,CAAG,CAGXH,CAAAA,KAAAA,CAAUI,UAAG,CAAA,CAAA,CAAA,CAGUJ,KAAAA,CAAQK,QAAAA,CACzE,EAG0CL,CAAAA,KAAAA,CAASM,SAAG,CAAA,CAAA,CAAA,CAE/CN,KAAAA,CAAUO,UAAAA,CAAG,CAoCdP,CAAAA,KAAAA,CAAAQ,iBAAoBC,CAAAA,CAAAA,CAAAA,sBAAAA,CAAAA,KAAAA,EAA0B,EAAA,CAiDvD,QAAAC,KAAA,EAtGQC,SAAA,CAAAb,CAAA,CAAAc,EAAA,SAAAC,YAAA,CAAAf,CAAA,GAAAgB,GAAA,WAAAC,KAAA,CAuBG,SAAAC,OAAAA,CAAQC,CAAAA,CAAAA,CAGhB,GAFAC,aAAAA,CAAAA,CAAAA,oBAAcD,CAAAA,GAEVA,CAAkBE,CAAAA,GAAAA,CAAI,WACnBnB,CAAAA,EAAAA,CAAAA,IAAAA,CAAKM,SAAW,CAAA,CACnB,GAAMc,CAAAA,EAAAA,CAAYpB,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AA,SAAAA,CAAW,WAC/CzD,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAuD,SAAA,CAAA,UAAA,CAAA,IAAA,EAGuCL,CAAAA,CAAAA,CAAAA,CAAA,CAA3CC,CAAAA,CAAS,CAAEC,IAAAA,CAAMC,OAASC,CAAAA,OAAAA,CAAAA,CAAS,CAA0BtD,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAuD,SAAA,CAAA,WAAA,CAAA,IAAA,EAErDL,CAAAA,CAAAA,CAAAA,CAAA,CAARQ,CAAAA,CAAAA,CAAAA,CAAAA,CAAuB1D,CAAAuD,CAAAA,SAAAA,CAAA,YAAA,CAAA,IAAA,EAAA,CAAA,CAAAI,OAAA,KAvBb3D,CAAmBkD,CAAAA,CAAAA,CAAA,CAD/BU,CAAAA,CAAc,2BACF5D"}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import{__decorate as e}from"tslib";import{html as i}from"lit";import{property as t,state as s,customElement as l}from"lit/decorators.js";import{s as r}from"./nile-table-header-item.css.esm.js";import{N as n}from"../internal/nile-element.esm.js";import{H as o}from"../internal/slot.esm.js";import{c as a}from"../internal/resizable-table-helper.esm.js";import"../internal/resizable-table-styles.esm.js";let
|
1
|
+
import{__decorate as e}from"tslib";import{html as i}from"lit";import{property as t,state as s,customElement as l}from"lit/decorators.js";import{s as r}from"./nile-table-header-item.css.esm.js";import{N as n}from"../internal/nile-element.esm.js";import{H as o}from"../internal/slot.esm.js";import{c as a,r as c}from"../internal/resizable-table-helper.esm.js";import"../internal/resizable-table-styles.esm.js";let h=class extends n{constructor(){super(...arguments),this.hasSlotController=new o(this,"[default]"),this.havesort=!1,this.havefilter=!1,this.iconName="",this.resizable=!1,this.sorting_ct=0,this.handleResizeStart=a(this,50)}static get styles(){return[r]}updated(e){if(super.updated(e),e.has("resizable")&&!this.resizable){const e=this.closest("nile-table-body");e&&c(e)}}handleSort(e){this.sorting_ct++;let i=this.hasSlotController.host.innerHTML;this.emit("nile-click-sort",{value:{curr_sort_string:i,order:["normal","asc","des"][this.sorting_ct%3]}})}handleSearch(e){this.emit("nile-search",{value:e.detail.value})}render(){return i`
|
2
2
|
<div class="header__item__wrapper" part="nile__table-header-cell">
|
3
3
|
<div class="headers">
|
4
4
|
<slot> </slot>
|
@@ -30,4 +30,4 @@ import{__decorate as e}from"tslib";import{html as i}from"lit";import{property as
|
|
30
30
|
</nile-popover>`:i``}
|
31
31
|
</div>
|
32
32
|
${this.resizable?i`<div class="resizer" @mousedown=${this.handleResizeStart}></div>`:null}
|
33
|
-
</div>`}};e([t({type:Boolean,reflect:!0})],
|
33
|
+
</div>`}};e([t({type:Boolean,reflect:!0})],h.prototype,"havesort",void 0),e([t({type:Boolean,reflect:!0})],h.prototype,"havefilter",void 0),e([t({type:String,reflect:!0,attribute:"icon-name"})],h.prototype,"iconName",void 0),e([t({type:Boolean,reflect:!0})],h.prototype,"resizable",void 0),e([s()],h.prototype,"sorting_ct",void 0),h=e([l("nile-table-header-item")],h);export{h as N};
|
@@ -38,6 +38,11 @@ export declare function getColumnIndex(element: HTMLElement, selector: string):
|
|
38
38
|
* @param newWidth The new width to apply
|
39
39
|
*/
|
40
40
|
export declare function synchronizeColumnWidth(sourceElement: HTMLElement, newWidth: number): void;
|
41
|
+
/**
|
42
|
+
* Resets all column widths in a table to their default values
|
43
|
+
* @param tableBody The table body element to reset
|
44
|
+
*/
|
45
|
+
export declare function resetAllColumnWidths(tableBody: HTMLElement): void;
|
41
46
|
/**
|
42
47
|
* Checks if an element has the resizable attribute
|
43
48
|
* @param element The element to check
|
@@ -71,6 +71,20 @@ export function synchronizeColumnWidth(sourceElement, newWidth) {
|
|
71
71
|
}
|
72
72
|
});
|
73
73
|
}
|
74
|
+
/**
|
75
|
+
* Resets all column widths in a table to their default values
|
76
|
+
* @param tableBody The table body element to reset
|
77
|
+
*/
|
78
|
+
export function resetAllColumnWidths(tableBody) {
|
79
|
+
const headerItems = tableBody.querySelectorAll('nile-table-header-item');
|
80
|
+
const cellItems = tableBody.querySelectorAll('nile-table-cell-item');
|
81
|
+
headerItems.forEach(header => {
|
82
|
+
header.style.removeProperty('width');
|
83
|
+
});
|
84
|
+
cellItems.forEach(cell => {
|
85
|
+
cell.style.removeProperty('width');
|
86
|
+
});
|
87
|
+
}
|
74
88
|
/**
|
75
89
|
* Checks if an element has the resizable attribute
|
76
90
|
* @param element The element to check
|
@@ -102,10 +116,19 @@ export function createResizeHandler(element, minWidth = 50) {
|
|
102
116
|
* @returns True if any columns have resizable attribute
|
103
117
|
*/
|
104
118
|
export function hasResizableColumns(tableBody) {
|
105
|
-
const
|
106
|
-
const
|
107
|
-
|
108
|
-
|
119
|
+
const directChildren = Array.from(tableBody.children);
|
120
|
+
const hasResizableHeaders = directChildren.some(child => {
|
121
|
+
if (child.tagName.toLowerCase() === 'nile-table-header-item') {
|
122
|
+
return child.hasAttribute('resizable');
|
123
|
+
}
|
124
|
+
return false;
|
125
|
+
});
|
126
|
+
const hasResizableCells = directChildren.some(child => {
|
127
|
+
if (child.tagName.toLowerCase() === 'nile-table-cell-item') {
|
128
|
+
return child.hasAttribute('resizable');
|
129
|
+
}
|
130
|
+
return false;
|
131
|
+
});
|
109
132
|
return hasResizableHeaders || hasResizableCells;
|
110
133
|
}
|
111
134
|
//# sourceMappingURL=resizable-table-helper.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"resizable-table-helper.js","sourceRoot":"","sources":["../../../src/internal/resizable-table-helper.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAmBH;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAC,CAAa,EAAE,OAAsB;IACrE,CAAC,CAAC,cAAc,EAAE,CAAC;IACnB,CAAC,CAAC,eAAe,EAAE,CAAC;IAEpB,MAAM,EAAE,QAAQ,GAAG,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;IAC/D,MAAM,OAAO,GAAG,CAAC,CAAC,MAAqB,CAA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O,GAAkB;YAC7B,QAAQ;YACR,MAAM,EAAE,CAAC,CAAC,KAAK;YACf,UAAU,EAAE,OAAO,CAAC,WAAW;YAC/B,OAAO;SACR,CAAC;QAEF,iBAAiB,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;IAChC,CAAC,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAAC,SAAsB;IACxD,MAAM,cAAc,GAAG,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;IAEtD,MAAM,mBAAmB,GAAG,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;QACtD,IAAI,KAAK,CAAC,OAAO,CAAC,WAAW,EAAE,KAAK,wBAAwB,EAAE,CAAC;YAC7D,OAAO,KAAK,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC;QACzC,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC,CAAC,CAAC;IAEH,MAAM,iBAAiB,GAAG,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;QACpD,IAAI,KAAK,CAAC,OAAO,CAAC,WAAW,EAAE,KAAK,sBAAsB,EAAE,CAAC;YAC3D,OAAO,KAAK,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC;QACzC,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC,CAAC,CAAC;IAEH,OAAO,mBAAmB,IAAI,iBAAiB,CAAC;AAClD,CAAC","sourcesContent":["/**\n * Copyright Aquera Inc 2025\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n/**\n * Resizable Helper Utility\n * Provides common functionality for resizable table columns\n */\n\nexport interface ResizeOptions {\n minWidth?: number;\n startX: number;\n startWidth: number;\n element: HTMLElement;\n}\n\nexport interface ColumnResizeData {\n columnIndex: number;\n newWidth: number;\n}\n\n/**\n * Handles the start of a resize operation\n * @param e Mouse event\n * @param options Resize configuration options\n * @returns Cleanup function to remove event listeners\n */\nexport function handleResizeStart(e: MouseEvent, options: ResizeOptions): () => void {\n e.preventDefault();\n e.stopPropagation();\n \n const { minWidth = 50, startX, startWidth, element } = options;\n const resizer = e.target as HTMLElement;\n \n resizer.classList.add('resizing');\n\n const onMouseMove = (e: MouseEvent) => {\n e.preventDefault();\n e.stopPropagation();\n \n const delta = e.pageX - startX;\n const newWidth = Math.max(minWidth, startWidth + delta);\n\n element.style.width = newWidth + 'px';\n\n synchronizeColumnWidth(element, newWidth);\n };\n\n const onMouseUp = () => {\n resizer.classList.remove('resizing');\n document.removeEventListener('mousemove', onMouseMove);\n document.removeEventListener('mouseup', onMouseUp);\n };\n\n document.addEventListener('mousemove', onMouseMove);\n document.addEventListener('mouseup', onMouseUp);\n\n return () => {\n document.removeEventListener('mousemove', onMouseMove);\n document.removeEventListener('mouseup', onMouseUp);\n };\n}\n\n/**\n * Gets the column index of an element within its table row\n * @param element The table cell or header element\n * @param selector The CSS selector for the column elements\n * @returns Column index (0-based)\n */\nexport function getColumnIndex(element: HTMLElement, selector: string): number {\n const tableRow = element.closest('nile-table-row');\n if (tableRow) {\n const columns = tableRow.querySelectorAll(selector);\n return Array.from(columns).indexOf(element);\n }\n return 0;\n}\n\n/**\n * Synchronizes the width of all cells in the same column\n * @param sourceElement The element that was resized\n * @param newWidth The new width to apply\n */\nexport function synchronizeColumnWidth(sourceElement: HTMLElement, newWidth: number): void {\n const tableBody = sourceElement.closest('nile-table-body');\n if (!tableBody) return;\n\n const isHeader = sourceElement.tagName.toLowerCase() === 'nile-table-header-item';\n const selector = isHeader ? 'nile-table-header-item' : 'nile-table-cell-item';\n const targetSelector = isHeader ? 'nile-table-cell-item' : 'nile-table-cell-item';\n \n const columnIndex = getColumnIndex(sourceElement, selector);\n const rows = tableBody.querySelectorAll('nile-table-row');\n \n rows.forEach(row => {\n const cells = row.querySelectorAll(targetSelector);\n if (cells[columnIndex]) {\n cells[columnIndex].style.width = newWidth + 'px';\n }\n });\n}\n\n/**\n * Resets all column widths in a table to their default values\n * @param tableBody The table body element to reset\n */\nexport function resetAllColumnWidths(tableBody: HTMLElement): void {\n const headerItems = tableBody.querySelectorAll('nile-table-header-item');\n const cellItems = tableBody.querySelectorAll('nile-table-cell-item');\n \n headerItems.forEach(header => {\n header.style.removeProperty('width');\n });\n \n cellItems.forEach(cell => {\n cell.style.removeProperty('width');\n });\n}\n\n/**\n * Checks if an element has the resizable attribute\n * @param element The element to check\n * @returns True if the element is resizable\n */\nexport function isResizable(element: HTMLElement): boolean {\n return element.hasAttribute('resizable');\n}\n\n/**\n * Creates a resize handler function for use in component event listeners\n * @param element The element to make resizable\n * @param minWidth Minimum width constraint\n * @returns Event handler function\n */\nexport function createResizeHandler(element: HTMLElement, minWidth: number = 50): (e: MouseEvent) => void {\n return (e: MouseEvent) => {\n const options: ResizeOptions = {\n minWidth,\n startX: e.pageX,\n startWidth: element.offsetWidth,\n element\n };\n \n handleResizeStart(e, options);\n };\n}\n\n/**\n * Detects if any columns in a table are resizable\n * @param tableBody The table body element\n * @returns True if any columns have resizable attribute\n */\nexport function hasResizableColumns(tableBody: HTMLElement): boolean {\n const directChildren = Array.from(tableBody.children);\n \n const hasResizableHeaders = directChildren.some(child => {\n if (child.tagName.toLowerCase() === 'nile-table-header-item') {\n return child.hasAttribute('resizable');\n }\n return false;\n });\n \n const hasResizableCells = directChildren.some(child => {\n if (child.tagName.toLowerCase() === 'nile-table-cell-item') {\n return child.hasAttribute('resizable');\n }\n return false;\n });\n \n return hasResizableHeaders || hasResizableCells;\n} \n"]}
|
@@ -4,7 +4,7 @@
|
|
4
4
|
* This source code is licensed under the BSD-3-Clause license found in the
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
6
6
|
*/
|
7
|
-
import { CSSResultArray, TemplateResult } from 'lit';
|
7
|
+
import { CSSResultArray, TemplateResult, PropertyValues } from 'lit';
|
8
8
|
import NileElement from '../internal/nile-element';
|
9
9
|
/**
|
10
10
|
* Nile table Cell Item component.
|
@@ -22,6 +22,7 @@ export declare class NileTableCellItem extends NileElement {
|
|
22
22
|
/** Enables the resize functionality. */
|
23
23
|
resizable: boolean;
|
24
24
|
private handleResizeStart;
|
25
|
+
protected updated(changedProperties: PropertyValues): void;
|
25
26
|
/**
|
26
27
|
* Render method
|
27
28
|
* @slot This is a slot test
|
@@ -10,7 +10,7 @@ import { customElement, property } from 'lit/decorators.js';
|
|
10
10
|
import { styles } from './nile-table-cell-item.css';
|
11
11
|
import NileElement from '../internal/nile-element';
|
12
12
|
import { HasSlotController } from '../internal/slot';
|
13
|
-
import { createResizeHandler } from '../internal/resizable-table-helper';
|
13
|
+
import { createResizeHandler, resetAllColumnWidths } from '../internal/resizable-table-helper';
|
14
14
|
/**
|
15
15
|
* Nile table Cell Item component.
|
16
16
|
*
|
@@ -35,6 +35,17 @@ let NileTableCellItem = class NileTableCellItem extends NileElement {
|
|
35
35
|
static get styles() {
|
36
36
|
return [styles];
|
37
37
|
}
|
38
|
+
updated(changedProperties) {
|
39
|
+
super.updated(changedProperties);
|
40
|
+
if (changedProperties.has('resizable')) {
|
41
|
+
if (!this.resizable) {
|
42
|
+
const tableBody = this.closest('nile-table-body');
|
43
|
+
if (tableBody) {
|
44
|
+
resetAllColumnWidths(tableBody);
|
45
|
+
}
|
46
|
+
}
|
47
|
+
}
|
48
|
+
}
|
38
49
|
/**
|
39
50
|
* Render method
|
40
51
|
* @slot This is a slot test
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"nile-table-cell-item.js","sourceRoot":"","sources":["../../../src/nile-table-cell-item/nile-table-cell-item.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAEH,OAAO,EAEL,IAAI,
|
1
|
+
{"version":3,"file":"nile-table-cell-item.js","sourceRoot":"","sources":["../../../src/nile-table-cell-item/nile-table-cell-item.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAEH,OAAO,EAEL,IAAI,GAIL,MAAM,KAAK,CAAC;AACb,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM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I,CAAC,iBAAiB;;OAE3D,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,OAAO,IAAI,CAAA;UACP,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,WAAW,CAAC;gBACxC,CAAC,CAAC,IAAI,CAAA,wDAAwD;gBAC9D,CAAC,CAAC,EAAE;OACP,CAAC;QACJ,CAAC;IACH,CAAC;CAGF,CAAA;AA7C6C;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;oDAAmB;AAXnD,iBAAiB;IAD7B,aAAa,CAAC,sBAAsB,CAAC;GACzB,iBAAiB,CAwD7B;;AAED,eAAe,iBAAiB,CAAC","sourcesContent":["/**\n * Copyright Aquera Inc 2023\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport {\n LitElement,\n html,\n CSSResultArray,\n TemplateResult,\n PropertyValues,\n} from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { styles } from './nile-table-cell-item.css';\nimport NileElement from '../internal/nile-element';\nimport { HasSlotController } from '../internal/slot';\nimport { createResizeHandler, resetAllColumnWidths } from '../internal/resizable-table-helper';\n\n/**\n * Nile table Cell Item component.\n *\n * @tag nile-table-cell-item\n *\n */\n@customElement('nile-table-cell-item')\nexport class NileTableCellItem extends NileElement {\n private readonly hasSlotController = new HasSlotController(this, '[default]');\n /**\n * The styles for TableCellItem\n * @remarks If you are extending this class you can extend the base styles with super. Eg `return [super(), myCustomStyles]`\n */\n public static get styles(): CSSResultArray {\n return [styles];\n }\n\n /** Enables the resize functionality. */\n @property({ type: Boolean, reflect: true }) resizable = false;\n\n /* #endregion */\n\n /* #region Methods */\n\n private handleResizeStart = createResizeHandler(this, 50);\n\n protected updated(changedProperties: PropertyValues) {\n super.updated(changedProperties);\n \n if (changedProperties.has('resizable')) {\n if (!this.resizable) {\n const tableBody = this.closest('nile-table-body');\n if (tableBody) {\n resetAllColumnWidths(tableBody);\n }\n }\n }\n }\n\n /**\n * Render method\n * @slot This is a slot test\n */\n public render(): TemplateResult {\n if (this.resizable) {\n return html`\n <div class=\"cell__wrapper\" part=\"nile__table-cell\">\n ${this.hasSlotController.test('[default]')\n ? html` <div class=\"column\" part=\"nile__table-cell\"><slot></slot></div>`\n : ''}\n <div class=\"resizer\" @mousedown=${this.handleResizeStart}></div>\n </div>\n `;\n } else {\n return html`\n ${this.hasSlotController.test('[default]')\n ? html` <slot class=\"column\" part=\"nile__table-cell\"> </slot>`\n : ''}\n `;\n }\n }\n\n /* #endregion */\n}\n\nexport default NileTableCellItem;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-table-cell-item': NileTableCellItem;\n }\n}\n"]}
|
@@ -4,7 +4,7 @@
|
|
4
4
|
* This source code is licensed under the BSD-3-Clause license found in the
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
6
6
|
*/
|
7
|
-
import { CSSResultArray, TemplateResult } from 'lit';
|
7
|
+
import { CSSResultArray, TemplateResult, PropertyValues } from 'lit';
|
8
8
|
import NileElement from '../internal/nile-element';
|
9
9
|
/**
|
10
10
|
* Nile icon component.
|
@@ -28,6 +28,7 @@ export declare class NileTableHeaderItem extends NileElement {
|
|
28
28
|
/** Enables the resize functionality. */
|
29
29
|
resizable: boolean;
|
30
30
|
sorting_ct: number;
|
31
|
+
protected updated(changedProperties: PropertyValues): void;
|
31
32
|
/**
|
32
33
|
* Render method
|
33
34
|
* @slot This is a slot test
|
@@ -10,7 +10,7 @@ import { customElement, state, property } from 'lit/decorators.js';
|
|
10
10
|
import { styles } from './nile-table-header-item.css';
|
11
11
|
import NileElement from '../internal/nile-element';
|
12
12
|
import { HasSlotController } from '../internal/slot';
|
13
|
-
import { createResizeHandler } from '../internal/resizable-table-helper';
|
13
|
+
import { createResizeHandler, resetAllColumnWidths } from '../internal/resizable-table-helper';
|
14
14
|
/**
|
15
15
|
* Nile icon component.
|
16
16
|
*
|
@@ -41,6 +41,17 @@ let NileTableHeaderItem = class NileTableHeaderItem extends NileElement {
|
|
41
41
|
}
|
42
42
|
/* #endregion */
|
43
43
|
/* #region Methods */
|
44
|
+
updated(changedProperties) {
|
45
|
+
super.updated(changedProperties);
|
46
|
+
if (changedProperties.has('resizable')) {
|
47
|
+
if (!this.resizable) {
|
48
|
+
const tableBody = this.closest('nile-table-body');
|
49
|
+
if (tableBody) {
|
50
|
+
resetAllColumnWidths(tableBody);
|
51
|
+
}
|
52
|
+
}
|
53
|
+
}
|
54
|
+
}
|
44
55
|
/**
|
45
56
|
* Render method
|
46
57
|
* @slot This is a slot test
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"nile-table-header-item.js","sourceRoot":"","sources":["../../../src/nile-table-header-item/nile-table-header-item.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAEH,OAAO,EAEL,IAAI,
|
1
|
+
{"version":3,"file":"nile-table-header-item.js","sourceRoot":"","sources":["../../../src/nile-table-header-item/nile-table-header-item.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAEH,OAAO,EAEL,IAAI,GAIL,MAAM,KAAK,CAAC;AACb,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AACtD,OAAO,WAAW,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAE/F;;;;;GAKG;AAEI,IAAM,mBAAmB,GAAzB,MAAM,mBAAoB,SAAQ,WAAW;IAA7C;;QACY,sBAAiB,GAAG,IAAI,iBAAiB,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;QAS9E,sCAAsC;QACM,aAAQ,GAAG,KAAK,CAAC;QAE7D,sCAAsC;QACM,eAAU,GAAG,KAAK,CAAC;QAE/D,wBA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;qDAC7D;AAGuC;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;sDAAmB;AAErD;IAAR,KAAK,EAAE;uDAAgB;AAvBb,mBAAmB;IAD/B,aAAa,CAAC,wBAAwB,CAAC;GAC3B,mBAAmB,CA4G/B;;AAED,eAAe,mBAAmB,CAAC","sourcesContent":["/**\n * Copyright Aquera Inc 2023\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport {\n LitElement,\n html,\n CSSResultArray,\n TemplateResult,\n PropertyValues,\n} from 'lit';\nimport { customElement, state, property } from 'lit/decorators.js';\nimport { styles } from './nile-table-header-item.css';\nimport NileElement from '../internal/nile-element';\nimport { HasSlotController } from '../internal/slot';\nimport { createResizeHandler, resetAllColumnWidths } from '../internal/resizable-table-helper';\n\n/**\n * Nile icon component.\n *\n * @tag nile-table-header-item\n *\n */\n@customElement('nile-table-header-item')\nexport class NileTableHeaderItem extends NileElement {\n private readonly hasSlotController = new HasSlotController(this, '[default]');\n /**\n * The styles for TableHeaderItem\n * @remarks If you are extending this class you can extend the base styles with super. Eg `return [super(), myCustomStyles]`\n */\n public static get styles(): CSSResultArray {\n return [styles];\n }\n\n /** Enables the sort functionality. */\n @property({ type: Boolean, reflect: true }) havesort = false;\n\n /** Enables the sort functionality. */\n @property({ type: Boolean, reflect: true }) havefilter = false;\n\n /** Places the icon . */\n @property({ type: String, reflect: true, attribute: 'icon-name' }) iconName =\n '';\n\n /** Enables the resize functionality. */\n @property({ type: Boolean, reflect: true }) resizable = false;\n\n @state() sorting_ct = 0;\n\n /* #endregion */\n\n /* #region Methods */\n\n protected updated(changedProperties: PropertyValues) {\n super.updated(changedProperties);\n \n if (changedProperties.has('resizable')) {\n if (!this.resizable) {\n const tableBody = this.closest('nile-table-body');\n if (tableBody) {\n resetAllColumnWidths(tableBody);\n }\n }\n }\n }\n\n /**\n * Render method\n * @slot This is a slot test\n */\n private handleSort(e: any) {\n this.sorting_ct++;\n let curr_sort_string = this.hasSlotController.host.innerHTML;\n const order = ['normal', 'asc', 'des'];\n this.emit('nile-click-sort', {\n value: { curr_sort_string, order: order[this.sorting_ct % 3] },\n });\n }\n\n private handleSearch(e: any) {\n this.emit('nile-search', { value: e.detail.value });\n }\n\n private handleResizeStart = createResizeHandler(this, 50);\n\n public render(): TemplateResult {\n return html`\n <div class=\"header__item__wrapper\" part=\"nile__table-header-cell\">\n <div class=\"headers\">\n <slot> </slot>\n ${this.havesort && this.sorting_ct % 3 === 0\n ? html`<nile-icon\n name=\"sortdown\"\n size=\"16\"\n @click=${this.handleSort}\n class=\"hover__arrow\"\n ></nile-icon>`\n : null}\n ${this.havesort && this.sorting_ct % 3 === 1\n ? html`<nile-icon\n name=\"sortdown\"\n size=\"16\"\n @click=${this.handleSort}\n ></nile-icon>`\n : null}\n ${this.havesort && this.sorting_ct % 3 === 2\n ? html`<nile-icon\n name=\"sortup\"\n size=\"16\"\n @click=${this.handleSort}\n ></nile-icon>`\n : null}\n ${this.iconName\n ? html` <nile-icon name=\"${this.iconName}\" size=\"16\"></nile-icon>`\n : html``}\n ${this.havefilter\n ? html` <nile-popover title=\"Filter\" placement=\"bottom\">\n <nile-icon name=\"filter\" size=\"16\" slot=\"anchor\"></nile-icon>\n <nile-input\n placeholder=\"Search\"\n @nile-input=${this.handleSearch}\n part=\"filter__search\"\n ></nile-input>\n <slot name=\"filter__content\" part=\"filter__content\"></slot>\n </nile-popover>`\n : html``}\n </div>\n ${this.resizable \n ? html`<div class=\"resizer\" @mousedown=${this.handleResizeStart}></div>`\n : null}\n </div>`;\n }\n}\n\nexport default NileTableHeaderItem;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-table-header-item': NileTableHeaderItem;\n }\n}\n"]}
|