@aquera/nile-elements 0.1.31-beta-1.1 → 0.1.32-beta-1.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/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.32-beta-1.0
83
+ - Nile Table: Workaround Styling update
84
+
82
85
  ### Version 0.1.31-beta-1.1
83
86
  - Nile Stepper: Stylings updates and State change bugfixes
84
87
 
@@ -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.css.cjs.js","../internal/nile-element.cjs.js"],function(_export,_context){"use strict";var t,s,e,i,r,l,_templateObject,a;function _toConsumableArray(r){return _arrayWithoutHoles(r)||_iterableToArray(r)||_unsupportedIterableToArray(r)||_nonIterableSpread();}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(r,a){if(r){if("string"==typeof r)return _arrayLikeToArray(r,a);var t={}.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(r,a):void 0;}}function _iterableToArray(r){if("undefined"!=typeof Symbol&&null!=r[Symbol.iterator]||null!=r["@@iterator"])return Array.from(r);}function _arrayWithoutHoles(r){if(Array.isArray(r))return _arrayLikeToArray(r);}function _arrayLikeToArray(r,a){(null==a||a>r.length)&&(a=r.length);for(var e=0,n=Array(a);e<a;e++)n[e]=r[e];return n;}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){t=_tslib.__decorate;},function(_lit){s=_lit.html;},function(_litDecoratorsJs){e=_litDecoratorsJs.query;i=_litDecoratorsJs.customElement;},function(_nileTableCssCjsJs){r=_nileTableCssCjsJs.s;},function(_internalNileElementCjsJs){l=_internalNileElementCjsJs.N;}],execute:function execute(){_export("N",a=/*#__PURE__*/function(_l){function a(){var _this;_classCallCheck(this,a);_this=_callSuper(this,a,arguments),_this.rows=[],_this.primaryRowWidths=[];return _this;}_inherits(a,_l);return _createClass(a,[{key:"connectedCallback",value:function connectedCallback(){_superPropGet(a,"connectedCallback",this,3)([]),this.addEventListener("nile-body-load",this.handleRows);}},{key:"firstUpdated",value:function firstUpdated(t){var _this2=this;this.updateComplete.then(function(){_this2.handleBodyCssUpdate();});}},{key:"render",value:function render(){return s(_templateObject||(_templateObject=_taggedTemplateLiteral(["\n\t\t\t<slot @slotchange=\"","\"></slot>\n\t\t\t"])),this.repaintTable);}},{key:"handleRows",value:function handleRows(t){this.rows=[].concat(_toConsumableArray(this.rows),[t.detail.comp]);}},{key:"handleBodyCssUpdate",value:function handleBodyCssUpdate(){var _t$0$shadowRoot,_t$shadowRoot;var t=this.rows;if(!t.length)return;var s=(_t$0$shadowRoot=t[0].shadowRoot)===null||_t$0$shadowRoot===void 0?void 0:_t$0$shadowRoot.querySelector("div.base"),e=(_t$shadowRoot=t[t.length-1].shadowRoot)===null||_t$shadowRoot===void 0?void 0:_t$shadowRoot.querySelector("div.base");s&&(s.style.borderTopRightRadius="var(--nile-radius-radius-xl)",s.style.borderTopLeftRadius="var(--nile-radius-radius-xl)",s.style.borderBottomRightRadius="0px",s.style.borderBottomLeftRadius="0px",s.style.borderBottom="none"),e&&(e.style.borderTopRightRadius="0px",e.style.borderTopLeftRadius="0px",e.style.borderBottomRightRadius="var(--nile-radius-radius-xl)",e.style.borderBottomLeftRadius="var(--nile-radius-radius-xl)"),t.forEach(function(s,e){if(e>0&&e<t.length-1){var _s$shadowRoot;var _t=(_s$shadowRoot=s.shadowRoot)===null||_s$shadowRoot===void 0?void 0:_s$shadowRoot.querySelector("div.base");_t&&(_t.style.borderTopRightRadius="0px",_t.style.borderTopLeftRadius="0px",_t.style.borderBottomRightRadius="0px",_t.style.borderBottomLeftRadius="0px",_t.style.borderBottom="none");}});}},{key:"getPrimaryColumnWidths",value:function getPrimaryColumnWidths(){var t=this.rows.find(function(t){return"primary"==t.type;});return this.getTableCellFetchQuery(t).map(function(t){return t.clientWidth;});}},{key:"repaintTable",value:function repaintTable(){var _this3=this;var t=this.getPrimaryColumnWidths();this.rows.filter(function(t){return"primary"!=t.type;}).forEach(function(s){var e=_this3.getTableCellFetchQuery(s);e===null||e===void 0||e.forEach(function(s,e){s.style.setProperty("--cell-width",t.at(e)+"px");});});}},{key:"getTableCellFetchQuery",value:function getTableCellFetchQuery(t){var _t$shadowRoot2;return t===null||t===void 0||(_t$shadowRoot2=t.shadowRoot)===null||_t$shadowRoot2===void 0||(_t$shadowRoot2=_t$shadowRoot2.querySelector("slot:not([name])"))===null||_t$shadowRoot2===void 0||(_t$shadowRoot2=_t$shadowRoot2.assignedElements()[0].shadowRoot)===null||_t$shadowRoot2===void 0||(_t$shadowRoot2=_t$shadowRoot2.querySelector("slot"))===null||_t$shadowRoot2===void 0?void 0:_t$shadowRoot2.assignedElements();}}],[{key:"styles",get:function get(){return[r];}}]);}(l));t([e("slot")],a.prototype,"defaultSlot",void 0),_export("N",a=t([i("nile-table")],a));}};});
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.css.cjs.js","../internal/nile-element.cjs.js"],function(_export,_context){"use strict";var t,s,i,e,r,l,_templateObject,a;function _toConsumableArray(r){return _arrayWithoutHoles(r)||_iterableToArray(r)||_unsupportedIterableToArray(r)||_nonIterableSpread();}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(r,a){if(r){if("string"==typeof r)return _arrayLikeToArray(r,a);var t={}.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(r,a):void 0;}}function _iterableToArray(r){if("undefined"!=typeof Symbol&&null!=r[Symbol.iterator]||null!=r["@@iterator"])return Array.from(r);}function _arrayWithoutHoles(r){if(Array.isArray(r))return _arrayLikeToArray(r);}function _arrayLikeToArray(r,a){(null==a||a>r.length)&&(a=r.length);for(var e=0,n=Array(a);e<a;e++)n[e]=r[e];return n;}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){t=_tslib.__decorate;},function(_lit){s=_lit.html;},function(_litDecoratorsJs){i=_litDecoratorsJs.query;e=_litDecoratorsJs.customElement;},function(_nileTableCssCjsJs){r=_nileTableCssCjsJs.s;},function(_internalNileElementCjsJs){l=_internalNileElementCjsJs.N;}],execute:function execute(){_export("N",a=/*#__PURE__*/function(_l){function a(){var _this;_classCallCheck(this,a);_this=_callSuper(this,a,arguments),_this.rows=[],_this.primaryRowWidths=[];return _this;}_inherits(a,_l);return _createClass(a,[{key:"connectedCallback",value:function connectedCallback(){_superPropGet(a,"connectedCallback",this,3)([]),this.addEventListener("nile-body-load",this.handleRows);}},{key:"firstUpdated",value:function firstUpdated(t){var _this2=this;this.updateComplete.then(function(){_this2.handleBodyCssUpdate();});}},{key:"render",value:function render(){return s(_templateObject||(_templateObject=_taggedTemplateLiteral(["\n\t\t\t<slot @slotchange=\"","\"></slot>\n\t\t\t"])),this.repaintTable);}},{key:"repaintTable",value:function repaintTable(){this.realignStructure(),this.handleBodyCssUpdate();}},{key:"handleRows",value:function handleRows(t){this.rows=[].concat(_toConsumableArray(this.rows),[t.detail.comp]);}},{key:"handleBodyCssUpdate",value:function handleBodyCssUpdate(){var _t$0$shadowRoot,_t$shadowRoot;var t=this.rows;if(!t.length)return;var s=(_t$0$shadowRoot=t[0].shadowRoot)===null||_t$0$shadowRoot===void 0?void 0:_t$0$shadowRoot.querySelector("div.base");s&&(s.style.borderTopRightRadius="var(--nile-radius-radius-xl)",s.style.borderTopLeftRadius="var(--nile-radius-radius-xl)",s.style.borderBottomRightRadius="0px",s.style.borderBottomLeftRadius="0px",s.style.borderBottom="none"),t.forEach(function(s,i){if(i>0&&i<t.length-1){var _s$shadowRoot;var _t=(_s$shadowRoot=s.shadowRoot)===null||_s$shadowRoot===void 0?void 0:_s$shadowRoot.querySelector("div.base");_t&&(_t.style.borderTopRightRadius="0px",_t.style.borderTopLeftRadius="0px",_t.style.borderBottomRightRadius="0px",_t.style.borderBottomLeftRadius="0px",_t.style.borderBottom="none");}});var i=(_t$shadowRoot=t[t.length-1].shadowRoot)===null||_t$shadowRoot===void 0?void 0:_t$shadowRoot.querySelector("div.base");i&&(i.style.borderTopRightRadius="0px",i.style.borderTopLeftRadius="0px",i.style.borderBottomRightRadius="var(--nile-radius-radius-xl)",i.style.borderBottomLeftRadius="var(--nile-radius-radius-xl)");}},{key:"getPrimaryColumnWidths",value:function getPrimaryColumnWidths(){var t=this.rows.find(function(t){return"primary"==t.type;});return this.getTableCellFetchQuery(t).map(function(t){return t.clientWidth;});}},{key:"realignStructure",value:function realignStructure(){var _this3=this;var t=this.getPrimaryColumnWidths();this.rows.filter(function(t){return"primary"!=t.type;}).forEach(function(s){var i=_this3.getTableCellFetchQuery(s);i===null||i===void 0||i.forEach(function(s,i){s.style.setProperty("--cell-width",t.at(i)+"px");});});}},{key:"getTableCellFetchQuery",value:function getTableCellFetchQuery(t){var _t$shadowRoot2;return t===null||t===void 0||(_t$shadowRoot2=t.shadowRoot)===null||_t$shadowRoot2===void 0||(_t$shadowRoot2=_t$shadowRoot2.querySelector("slot:not([name])"))===null||_t$shadowRoot2===void 0||(_t$shadowRoot2=_t$shadowRoot2.assignedElements()[0].shadowRoot)===null||_t$shadowRoot2===void 0||(_t$shadowRoot2=_t$shadowRoot2.querySelector("slot"))===null||_t$shadowRoot2===void 0?void 0:_t$shadowRoot2.assignedElements();}}],[{key:"styles",get:function get(){return[r];}}]);}(l));t([i("slot")],a.prototype,"defaultSlot",void 0),_export("N",a=t([e("nile-table")],a));}};});
2
2
  //# sourceMappingURL=nile-table.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"nile-table.cjs.js","sources":["../../../src/nile-table/nile-table.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 {LitElement, html, CSSResultArray, TemplateResult, PropertyValues} from 'lit';\nimport { customElement, property, query, state} from 'lit/decorators.js';\nimport {styles} from './nile-table.css';\nimport NileElement from '../internal/nile-element';\nimport { NileTableBody } from '../nile-table-body';\nimport { NileTableCellItem } from '../nile-table-cell-item';\nimport { NileTableHeaderItem } from '../nile-table-header-item';\n\n\n/**\n * Nile table component.\n *\n * @tag nile-table\n *\n */\n@customElement('nile-table')\nexport class NileTable extends NileElement {\n @query('slot') defaultSlot: HTMLSlotElement;\n\tprivate rows:Array<NileTableBody>=[];\n\tprivate primaryRowWidths:Array<number>=[]\n\n\n\t/**\n\t * The styles for nile-table\n\t * @remarks If you are extending this class you can extend the base styles with super. Eg `return [super(), myCustomStyles]`\n\t */\n\tpublic static get styles(): CSSResultArray {\n\t\treturn [styles];\n\t}\n\tconnectedCallback(): void {\n\t\tsuper.connectedCallback()\n\t\tthis.addEventListener('nile-body-load',this.handleRows)\n\t}\n\n\tprotected firstUpdated(_changedProperties: PropertyValues): void {\n\t\tthis.updateComplete.then(()=>{\n\t\t\tthis.handleBodyCssUpdate();\n\t\t})\n\t}\n\n\n\t/* #endregion */\n\n\t/* #region Methods */\n\n\t/**\n\t * Render method\n\t * @slot This is a slot test\n\t */\n\tpublic render(): TemplateResult {\n\t\treturn html`\n\t\t\t<slot @slotchange=\"${this.repaintTable}\"></slot>\n\t\t\t`;\n\t}\n\n\thandleRows(e:CustomEvent){\n\t\tthis.rows=[...this.rows,e.detail.comp]\n\t}\n\n\thandleBodyCssUpdate(){\n const tableBodies = this.rows;\n if (!tableBodies.length) return;\n\t\tconst firstEl=tableBodies[0].shadowRoot?.querySelector<HTMLDivElement>('div.base')\n\t\tconst lastEl=tableBodies[tableBodies.length - 1].shadowRoot?.querySelector<HTMLDivElement>('div.base')\n\t\tif(firstEl) {\n\t\t\tfirstEl.style.borderTopRightRadius=\"var(--nile-radius-radius-xl)\";\n\t\t\tfirstEl.style.borderTopLeftRadius = 'var(--nile-radius-radius-xl)';\n\t\t\tfirstEl.style.borderBottomRightRadius=\"0px\";\n\t\t\tfirstEl.style.borderBottomLeftRadius = '0px';\n\t\t\tfirstEl.style.borderBottom = 'none';\n\t\t}\n\t\tif(lastEl){\n\t\t\tlastEl.style.borderTopRightRadius=\"0px\";\n\t\t\tlastEl.style.borderTopLeftRadius = '0px';\n\t\t\tlastEl.style.borderBottomRightRadius=\"var(--nile-radius-radius-xl)\";\n\t\t\tlastEl.style.borderBottomLeftRadius = 'var(--nile-radius-radius-xl)';\n\t\t}\n\t\ttableBodies.forEach((tb,i)=>{\n\t\t\tif(i>0 && i<tableBodies.length-1){\n\t\t\t\tconst el=tb.shadowRoot?.querySelector<HTMLDivElement>('div.base')\n\t\t\t\tif(el) {\n\t\t\t\t\tel.style.borderTopRightRadius=\"0px\";\n\t\t\t\t\tel.style.borderTopLeftRadius = \"0px\";\n\t\t\t\t\tel.style.borderBottomRightRadius=\"0px\";\n\t\t\t\t\tel.style.borderBottomLeftRadius = \"0px\";\n\t\t\t\t\tel.style.borderBottom = 'none';\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t}\n\n\tgetPrimaryColumnWidths(){\n\t\tconst primaryTb=this.rows.find(tb=>tb.type=='primary')!;\n\t\tconst widthArray=this.getTableCellFetchQuery(primaryTb).map((e:LitElement)=>e.clientWidth) as Array<number>\n\t\treturn widthArray;\n\t}\n\t\n\trepaintTable(){\n\t\tconst primaryRowWidths=this.getPrimaryColumnWidths();\n\t\tconst secondaryRows=this.rows.filter(tb=>tb.type!='primary');\n\t\tsecondaryRows.forEach((row)=>{\n\t\t\tlet elements=this.getTableCellFetchQuery(row)\n\t\t\telements?.forEach((el:NileTableCellItem|NileTableHeaderItem,ind)=>{\n\t\t\t\tel.style.setProperty('--cell-width',primaryRowWidths.at(ind)+'px')\n\t\t\t})\n\t\t})\n\t}\n\n\tgetTableCellFetchQuery(row:NileTableBody):Array<Element>{\n\t\treturn row?.shadowRoot?.\n\t\t\tquerySelector<HTMLSlotElement>('slot:not([name])')?.\n\t\t\tassignedElements()[0]\n\t\t\t.shadowRoot?.querySelector<HTMLSlotElement>('slot')?.\n\t\t\tassignedElements()!\n\t}\n\t/* #endregion */\n}\n\nexport default NileTable;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-table': NileTable;\n }\n}"],"names":["NileTable","a","this","rows","primaryRowWidths","_this","_inherits","_l","_createClass","key","value","connectedCallback","super","addEventListener","handleRows","firstUpdated","_changedProperties","updateComplete","then","handleBodyCssUpdate","render","html","_templateObject","_taggedTemplateLiteral","repaintTable","e","detail","comp","tableBodies","length","firstEl","shadowRoot","querySelector","lastEl","style","borderTopRightRadius","borderTopLeftRadius","borderBottomRightRadius","borderBottomLeftRadius","borderBottom","forEach","tb","i","_s$shadowRoot","el","getPrimaryColumnWidths","primaryTb","find","type","getTableCellFetchQuery","map","clientWidth","filter","row","elements","ind","setProperty","at","_t$shadowRoot2","assignedElements","get","styles","NileElement","__decorate","query","prototype","_export","customElement"],"mappings":"ylJAuBaA,CAAAA,uBAAAA,EAAAA,EAAN,SAAAC,EAAA,qEAEEC,EAAAA,KAAAA,CAAIC,IAAsB,CAAA,EAAA,CAC1BD,KAAAA,CAAgBE,gBAAAA,CAAe,EAiGvC,QAAAC,KAAA,EA1FOC,SAAA,CAAAL,CAAA,CAAAM,EAAA,SAAAC,YAAA,CAAAP,CAAA,GAAAQ,GAAA,qBAAAC,KAAA,CAGP,SAAAC,iBAAAA,CAAAA,CACCC,CAAAA,aAAAA,CAAAA,CAAAA,iCACAV,IAAAA,CAAKW,gBAAiB,CAAA,gBAAA,CAAiBX,IAAKY,CAAAA,UAAA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CAAKC,KAAKiD,MAAOX,CAAAA,SAAAA,CAAAA,QAAa,SAATA,EAAAA,CAAAA,CAAGO,IAC9BR,EAAAA,CAAAA,CAAAA,OAAAA,CAASa,SAAAA,GACtB,GAAIC,CAAAA,CAAAA,CAASpD,OAAK+C,sBAAuBI,CAAAA,CAAAA,CAAAA,CACzCC,UAAAA,YAAAA,EAAUd,OAAQ,CAAA,SAACI,CAAyCW,CAAAA,CAAAA,CAAAA,CAC3DX,CAAGV,CAAAA,KAAAA,CAAMsB,YAAY,cAAepD,CAAAA,CAAAA,CAAiBqD,GAAGF,CAAK,CAAA,CAAA,IAAA,CAAK,GACjE,EAEH,CAAA,EAED,GAAA9C,GAAA,0BAAAC,KAAA,UAAAuC,sBAAAA,CAAuBI,CACtB,CAAA,KAAAK,cAAA,CAAA,MAAOL,CAAAA,UAAAA,4BAAAA,EAAKtB,UACXC,UAAAA,cAAAA,YAAAA,cAAAA,CADMqB,cAAAA,CACNrB,aAAAA,CAA+B,sEADzBqB,cAAAA,CAENM,gBAAmB,CAAA,CAAA,CAAA,CAAA,CAAA,CAClB5B,6DAHKsB,cAAAA,CAGOrB,aAA+B,CAAA,MAAA,CAAA,UAAA0B,cAAA,iBAHtCL,cAAAA,CAINM,gBACD,CAAA,CAAA,EAAA,KAAAlD,GAAA,UAAAmD,GAAA,CAxFM,SAAAA,IAAA,CAAWC,CACjB,MAAO,CAACA,CAAAA,CACR,EACD,MAb8BC,CAAxB,GACUC,CAAA,CAAA,CAAdC,EAAM,MAAqChE,CAAAA,CAAAA,CAAAA,CAAAA,CAAAiE,UAAA,aAAA,CAAA,IAAA,EAAA,CAAA,CAAAC,OAAA,KADjClE,EAAS+D,CAAA,CAAA,CADrBI,CAAc,CAAA,YAAA,CAAA,CAAA,CACFnE"}
1
+ {"version":3,"file":"nile-table.cjs.js","sources":["../../../src/nile-table/nile-table.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 {LitElement, html, CSSResultArray, TemplateResult, PropertyValues} from 'lit';\nimport { customElement, property, query, state} from 'lit/decorators.js';\nimport {styles} from './nile-table.css';\nimport NileElement from '../internal/nile-element';\nimport { NileTableBody } from '../nile-table-body';\nimport { NileTableCellItem } from '../nile-table-cell-item';\nimport { NileTableHeaderItem } from '../nile-table-header-item';\n\n\n/**\n * Nile table component.\n *\n * @tag nile-table\n *\n */\n@customElement('nile-table')\nexport class NileTable extends NileElement {\n @query('slot') defaultSlot: HTMLSlotElement;\n\tprivate rows:Array<NileTableBody>=[];\n\tprivate primaryRowWidths:Array<number>=[]\n\n\n\t/**\n\t * The styles for nile-table\n\t * @remarks If you are extending this class you can extend the base styles with super. Eg `return [super(), myCustomStyles]`\n\t */\n\tpublic static get styles(): CSSResultArray {\n\t\treturn [styles];\n\t}\n\tconnectedCallback(): void {\n\t\tsuper.connectedCallback()\n\t\tthis.addEventListener('nile-body-load',this.handleRows)\n\t}\n\n\tprotected firstUpdated(_changedProperties: PropertyValues): void {\n\t\tthis.updateComplete.then(()=>{\n\t\t\tthis.handleBodyCssUpdate();\n\t\t})\n\t}\n\n\n\t/* #endregion */\n\n\t/* #region Methods */\n\n\t/**\n\t * Render method\n\t * @slot This is a slot test\n\t */\n\tpublic render(): TemplateResult {\n\t\treturn html`\n\t\t\t<slot @slotchange=\"${this.repaintTable}\"></slot>\n\t\t\t`;\n\t}\n\n\trepaintTable(){\n\t\tthis.realignStructure();\n\t\tthis.handleBodyCssUpdate();\n\t}\n\n\thandleRows(e:CustomEvent){\n\t\tthis.rows=[...this.rows,e.detail.comp]\n\t}\n\n\thandleBodyCssUpdate(){\n const tableBodies = this.rows;\n if (!tableBodies.length) return;\n\t\tconst firstEl=tableBodies[0].shadowRoot?.querySelector<HTMLDivElement>('div.base')\n\t\tif(firstEl) {\n\t\t\tfirstEl.style.borderTopRightRadius=\"var(--nile-radius-radius-xl)\";\n\t\t\tfirstEl.style.borderTopLeftRadius = 'var(--nile-radius-radius-xl)';\n\t\t\tfirstEl.style.borderBottomRightRadius=\"0px\";\n\t\t\tfirstEl.style.borderBottomLeftRadius = '0px';\n\t\t\tfirstEl.style.borderBottom = 'none';\n\t\t}\n\t\ttableBodies.forEach((tb,i)=>{\n\t\t\tif(i>0 && i<tableBodies.length-1){\n\t\t\t\tconst el=tb.shadowRoot?.querySelector<HTMLDivElement>('div.base')\n\t\t\t\tif(el) {\n\t\t\t\t\tel.style.borderTopRightRadius=\"0px\";\n\t\t\t\t\tel.style.borderTopLeftRadius = \"0px\";\n\t\t\t\t\tel.style.borderBottomRightRadius=\"0px\";\n\t\t\t\t\tel.style.borderBottomLeftRadius = \"0px\";\n\t\t\t\t\tel.style.borderBottom = 'none';\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t\tconst lastEl=tableBodies[tableBodies.length - 1].shadowRoot?.querySelector<HTMLDivElement>('div.base')\n\t\tif(lastEl){\n\t\t\tlastEl.style.borderTopRightRadius=\"0px\";\n\t\t\tlastEl.style.borderTopLeftRadius = '0px';\n\t\t\tlastEl.style.borderBottomRightRadius=\"var(--nile-radius-radius-xl)\";\n\t\t\tlastEl.style.borderBottomLeftRadius = 'var(--nile-radius-radius-xl)';\n\t\t}\n\t}\n\n\tgetPrimaryColumnWidths(){\n\t\tconst primaryTb=this.rows.find(tb=>tb.type=='primary')!;\n\t\tconst widthArray=this.getTableCellFetchQuery(primaryTb).map((e:LitElement)=>e.clientWidth) as Array<number>\n\t\treturn widthArray;\n\t}\n\t\n\trealignStructure(){\n\t\tconst primaryRowWidths=this.getPrimaryColumnWidths();\n\t\tconst secondaryRows=this.rows.filter(tb=>tb.type!='primary');\n\t\tsecondaryRows.forEach((row)=>{\n\t\t\tlet elements=this.getTableCellFetchQuery(row)\n\t\t\telements?.forEach((el:NileTableCellItem|NileTableHeaderItem,ind)=>{\n\t\t\t\tel.style.setProperty('--cell-width',primaryRowWidths.at(ind)+'px')\n\t\t\t})\n\t\t})\n\t}\n\n\tgetTableCellFetchQuery(row:NileTableBody):Array<Element>{\n\t\treturn row?.shadowRoot?.\n\t\t\tquerySelector<HTMLSlotElement>('slot:not([name])')?.\n\t\t\tassignedElements()[0]\n\t\t\t.shadowRoot?.querySelector<HTMLSlotElement>('slot')?.\n\t\t\tassignedElements()!\n\t}\n\t/* #endregion */\n}\n\nexport default NileTable;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-table': NileTable;\n }\n}"],"names":["NileTable","a","this","rows","primaryRowWidths","_this","_inherits","_l","_createClass","key","value","connectedCallback","super","addEventListener","handleRows","firstUpdated","_changedProperties","updateComplete","then","handleBodyCssUpdate","render","html","_templateObject","_taggedTemplateLiteral","repaintTable","realignStructure","e","detail","comp","_t$0$shadowRoot","_t$shadowRoot","tableBodies","length","firstEl","shadowRoot","querySelector","style","borderTopRightRadius","borderTopLeftRadius","borderBottomRightRadius","borderBottomLeftRadius","borderBottom","forEach","tb","i","_s$shadowRoot","el","lastEl","getPrimaryColumnWidths","primaryTb","find","type","getTableCellFetchQuery","map","clientWidth","_this3","filter","row","elements","ind","setProperty","at","assignedElements","__decorate","get","styles","NileElement","query","prototype","_export","customElement"],"mappings":"ylJAuBaA,CAAAA,uBAAAA,EAAAA,EAAN,SAAAC,EAAA,qEAEEC,EAAAA,KAAAA,CAAIC,IAAsB,CAAA,EAAA,CAC1BD,KAAAA,CAAgBE,gBAAAA,CAAe,EAsGvC,QAAAC,KAAA,EA/FOC,SAAA,CAAAL,CAAA,CAAAM,EAAA,SAAAC,YAAA,CAAAP,CAAA,GAAAQ,GAAA,qBAAAC,KAAA,CAGP,SAAAC,iBAAAA,CAAAA,CACCC,CAAAA,aAAAA,CAAAA,CAAAA,iCACAV,IAAAA,CAAKW,gBAAiB,CAAA,gBAAA,CAAiBX,IAAKY,CAAAA,UAAAA,CAC5C,EAES,GAAAL,GAAA,gBAAAC,KAAA,UAAAK,YAAAA,CAAaC,CACtBd,CAAAA,KAAAA,MAAAA,MAAAA,I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A,CAAqCnE,CAAAoE,CAAAA,SAAAA,CAAA,aAAA,CAAA,IAAA,EAAA,CAAA,CAAAC,OAAA,KADjCrE,EAAS+D,CAAA,CAAA,CADrBO,CAAc,CAAA,YAAA,CAAA,CAAA,CACFtE"}
@@ -1,3 +1,3 @@
1
1
  import{__decorate as t}from"tslib";import{html as s}from"lit";import{query as e,customElement as i}from"lit/decorators.js";import{s as r}from"./nile-table.css.esm.js";import{N as l}from"../internal/nile-element.esm.js";let a=class extends l{constructor(){super(...arguments),this.rows=[],this.primaryRowWidths=[]}static get styles(){return[r]}connectedCallback(){super.connectedCallback(),this.addEventListener("nile-body-load",this.handleRows)}firstUpdated(t){this.updateComplete.then((()=>{this.handleBodyCssUpdate()}))}render(){return s`
2
2
  <slot @slotchange="${this.repaintTable}"></slot>
3
- `}handleRows(t){this.rows=[...this.rows,t.detail.comp]}handleBodyCssUpdate(){const t=this.rows;if(!t.length)return;const s=t[0].shadowRoot?.querySelector("div.base"),e=t[t.length-1].shadowRoot?.querySelector("div.base");s&&(s.style.borderTopRightRadius="var(--nile-radius-radius-xl)",s.style.borderTopLeftRadius="var(--nile-radius-radius-xl)",s.style.borderBottomRightRadius="0px",s.style.borderBottomLeftRadius="0px",s.style.borderBottom="none"),e&&(e.style.borderTopRightRadius="0px",e.style.borderTopLeftRadius="0px",e.style.borderBottomRightRadius="var(--nile-radius-radius-xl)",e.style.borderBottomLeftRadius="var(--nile-radius-radius-xl)"),t.forEach(((s,e)=>{if(e>0&&e<t.length-1){const t=s.shadowRoot?.querySelector("div.base");t&&(t.style.borderTopRightRadius="0px",t.style.borderTopLeftRadius="0px",t.style.borderBottomRightRadius="0px",t.style.borderBottomLeftRadius="0px",t.style.borderBottom="none")}}))}getPrimaryColumnWidths(){const t=this.rows.find((t=>"primary"==t.type));return this.getTableCellFetchQuery(t).map((t=>t.clientWidth))}repaintTable(){const t=this.getPrimaryColumnWidths();this.rows.filter((t=>"primary"!=t.type)).forEach((s=>{let e=this.getTableCellFetchQuery(s);e?.forEach(((s,e)=>{s.style.setProperty("--cell-width",t.at(e)+"px")}))}))}getTableCellFetchQuery(t){return t?.shadowRoot?.querySelector("slot:not([name])")?.assignedElements()[0].shadowRoot?.querySelector("slot")?.assignedElements()}};t([e("slot")],a.prototype,"defaultSlot",void 0),a=t([i("nile-table")],a);export{a as N};
3
+ `}repaintTable(){this.realignStructure(),this.handleBodyCssUpdate()}handleRows(t){this.rows=[...this.rows,t.detail.comp]}handleBodyCssUpdate(){const t=this.rows;if(!t.length)return;const s=t[0].shadowRoot?.querySelector("div.base");s&&(s.style.borderTopRightRadius="var(--nile-radius-radius-xl)",s.style.borderTopLeftRadius="var(--nile-radius-radius-xl)",s.style.borderBottomRightRadius="0px",s.style.borderBottomLeftRadius="0px",s.style.borderBottom="none"),t.forEach(((s,e)=>{if(e>0&&e<t.length-1){const t=s.shadowRoot?.querySelector("div.base");t&&(t.style.borderTopRightRadius="0px",t.style.borderTopLeftRadius="0px",t.style.borderBottomRightRadius="0px",t.style.borderBottomLeftRadius="0px",t.style.borderBottom="none")}}));const e=t[t.length-1].shadowRoot?.querySelector("div.base");e&&(e.style.borderTopRightRadius="0px",e.style.borderTopLeftRadius="0px",e.style.borderBottomRightRadius="var(--nile-radius-radius-xl)",e.style.borderBottomLeftRadius="var(--nile-radius-radius-xl)")}getPrimaryColumnWidths(){const t=this.rows.find((t=>"primary"==t.type));return this.getTableCellFetchQuery(t).map((t=>t.clientWidth))}realignStructure(){const t=this.getPrimaryColumnWidths();this.rows.filter((t=>"primary"!=t.type)).forEach((s=>{let e=this.getTableCellFetchQuery(s);e?.forEach(((s,e)=>{s.style.setProperty("--cell-width",t.at(e)+"px")}))}))}getTableCellFetchQuery(t){return t?.shadowRoot?.querySelector("slot:not([name])")?.assignedElements()[0].shadowRoot?.querySelector("slot")?.assignedElements()}};t([e("slot")],a.prototype,"defaultSlot",void 0),a=t([i("nile-table")],a);export{a as N};
@@ -29,10 +29,11 @@ export declare class NileTable extends NileElement {
29
29
  * @slot This is a slot test
30
30
  */
31
31
  render(): TemplateResult;
32
+ repaintTable(): void;
32
33
  handleRows(e: CustomEvent): void;
33
34
  handleBodyCssUpdate(): void;
34
35
  getPrimaryColumnWidths(): number[];
35
- repaintTable(): void;
36
+ realignStructure(): void;
36
37
  getTableCellFetchQuery(row: NileTableBody): Array<Element>;
37
38
  }
38
39
  export default NileTable;
@@ -49,6 +49,10 @@ let NileTable = class NileTable extends NileElement {
49
49
  <slot @slotchange="${this.repaintTable}"></slot>
50
50
  `;
51
51
  }
52
+ repaintTable() {
53
+ this.realignStructure();
54
+ this.handleBodyCssUpdate();
55
+ }
52
56
  handleRows(e) {
53
57
  this.rows = [...this.rows, e.detail.comp];
54
58
  }
@@ -57,7 +61,6 @@ let NileTable = class NileTable extends NileElement {
57
61
  if (!tableBodies.length)
58
62
  return;
59
63
  const firstEl = tableBodies[0].shadowRoot?.querySelector('div.base');
60
- const lastEl = tableBodies[tableBodies.length - 1].shadowRoot?.querySelector('div.base');
61
64
  if (firstEl) {
62
65
  firstEl.style.borderTopRightRadius = "var(--nile-radius-radius-xl)";
63
66
  firstEl.style.borderTopLeftRadius = 'var(--nile-radius-radius-xl)';
@@ -65,12 +68,6 @@ let NileTable = class NileTable extends NileElement {
65
68
  firstEl.style.borderBottomLeftRadius = '0px';
66
69
  firstEl.style.borderBottom = 'none';
67
70
  }
68
- if (lastEl) {
69
- lastEl.style.borderTopRightRadius = "0px";
70
- lastEl.style.borderTopLeftRadius = '0px';
71
- lastEl.style.borderBottomRightRadius = "var(--nile-radius-radius-xl)";
72
- lastEl.style.borderBottomLeftRadius = 'var(--nile-radius-radius-xl)';
73
- }
74
71
  tableBodies.forEach((tb, i) => {
75
72
  if (i > 0 && i < tableBodies.length - 1) {
76
73
  const el = tb.shadowRoot?.querySelector('div.base');
@@ -83,13 +80,20 @@ let NileTable = class NileTable extends NileElement {
83
80
  }
84
81
  }
85
82
  });
83
+ const lastEl = tableBodies[tableBodies.length - 1].shadowRoot?.querySelector('div.base');
84
+ if (lastEl) {
85
+ lastEl.style.borderTopRightRadius = "0px";
86
+ lastEl.style.borderTopLeftRadius = '0px';
87
+ lastEl.style.borderBottomRightRadius = "var(--nile-radius-radius-xl)";
88
+ lastEl.style.borderBottomLeftRadius = 'var(--nile-radius-radius-xl)';
89
+ }
86
90
  }
87
91
  getPrimaryColumnWidths() {
88
92
  const primaryTb = this.rows.find(tb => tb.type == 'primary');
89
93
  const widthArray = this.getTableCellFetchQuery(primaryTb).map((e) => e.clientWidth);
90
94
  return widthArray;
91
95
  }
92
- repaintTable() {
96
+ realignStructure() {
93
97
  const primaryRowWidths = this.getPrimaryColumnWidths();
94
98
  const secondaryRows = this.rows.filter(tb => tb.type != 'primary');
95
99
  secondaryRows.forEach((row) => {
@@ -1 +1 @@
1
- {"version":3,"file":"nile-table.js","sourceRoot":"","sources":["../../../src/nile-table/nile-table.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAEH,OAAO,EAAa,IAAI,EAAiD,MAAM,KAAK,CAAC;AACrF,OAAO,EAAE,aAAa,EAAY,KAAK,EAAQ,MAAM,mBAAmB,CAAC;AACzE,OAAO,EAAC,MAAM,EAAC,MAAM,kBAAkB,CAAC;AACxC,OAAO,WAAW,MAAM,0BAA0B,CAAC;AAMnD;;;;;GAKG;AAEI,IAAM,SAAS,GAAf,MAAM,SAAU,SAAQ,WAAW;IAAnC;;QAEE,SAAI,GAAsB,EAAE,CAAC;QAC7B,qBAAgB,GAAe,EAAE,CAAA;QAgGzC,gBAAgB;IACjB,CAAC;IA9FA;;;OAGG;IACI,MAAM,KAAK,MAAM;QACvB,OAAO,CAAC,MAAM,CAAC,CAAC;IACjB,CAAC;IACD,iBAAiB;QAChB,KAAK,CAAC,iBAAiB,EAAE,CAAA;QACzB,IAAI,CAAC,gBAAgB,CAAC,gBAAgB,EAAC,IAAI,CAAC,UAAU,CAAC,CAAA;IACxD,CAAC;IAES,YAAY,CAAC,kBAAkC;QACxD,IAAI,CAAC,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AAC,CAAC,GAAG,EAAC,EAAE;YAC5B,IAAI,QAAQ,GAAC,IAAI,CAAC,sBAAsB,CAAC,GAAG,CAAC,CAAA;YAC7C,QAAQ,EAAE,OAAO,CAAC,CAAC,EAAwC,EAAC,GAAG,EAAC,EAAE;gBACjE,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC,cAAc,EAAC,gBAAgB,CAAC,EAAE,CAAC,GAAG,CAAC,GAAC,IAAI,CAAC,CAAA;YACnE,CAAC,CAAC,CAAA;QACH,CAAC,CAAC,CAAA;IACH,CAAC;IAED,sBAAsB,CAAC,GAAiB;QACvC,OAAO,GAAG,EAAE,UAAU,EAAE;YACvB,aAAa,CAAkB,kBAAkB,CAAC,EAAE;YACpD,gBAAgB,EAAE,CAAC,CAAC,CAAC;aACpB,UAAU,EAAE,aAAa,CAAkB,MAAM,CAAC,EAAE;YACrD,gBAAgB,EAAG,CAAA;IACrB,CAAC;CAED,CAAA;AAnGgB;IAAd,KAAK,CAAC,MAAM,CAAC;8CAA8B;AADjC,SAAS;IADrB,aAAa,CAAC,YAAY,CAAC;GACf,SAAS,CAoGrB;;AAED,eAAe,SAAS,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 {LitElement, html, CSSResultArray, TemplateResult, PropertyValues} from 'lit';\nimport { customElement, property, query, state} from 'lit/decorators.js';\nimport {styles} from './nile-table.css';\nimport NileElement from '../internal/nile-element';\nimport { NileTableBody } from '../nile-table-body';\nimport { NileTableCellItem } from '../nile-table-cell-item';\nimport { NileTableHeaderItem } from '../nile-table-header-item';\n\n\n/**\n * Nile table component.\n *\n * @tag nile-table\n *\n */\n@customElement('nile-table')\nexport class NileTable extends NileElement {\n @query('slot') defaultSlot: HTMLSlotElement;\n\tprivate rows:Array<NileTableBody>=[];\n\tprivate primaryRowWidths:Array<number>=[]\n\n\n\t/**\n\t * The styles for nile-table\n\t * @remarks If you are extending this class you can extend the base styles with super. Eg `return [super(), myCustomStyles]`\n\t */\n\tpublic static get styles(): CSSResultArray {\n\t\treturn [styles];\n\t}\n\tconnectedCallback(): void {\n\t\tsuper.connectedCallback()\n\t\tthis.addEventListener('nile-body-load',this.handleRows)\n\t}\n\n\tprotected firstUpdated(_changedProperties: PropertyValues): void {\n\t\tthis.updateComplete.then(()=>{\n\t\t\tthis.handleBodyCssUpdate();\n\t\t})\n\t}\n\n\n\t/* #endregion */\n\n\t/* #region Methods */\n\n\t/**\n\t * Render method\n\t * @slot This is a slot test\n\t */\n\tpublic render(): TemplateResult {\n\t\treturn html`\n\t\t\t<slot @slotchange=\"${this.repaintTable}\"></slot>\n\t\t\t`;\n\t}\n\n\thandleRows(e:CustomEvent){\n\t\tthis.rows=[...this.rows,e.detail.comp]\n\t}\n\n\thandleBodyCssUpdate(){\n const tableBodies = this.rows;\n if (!tableBodies.length) return;\n\t\tconst firstEl=tableBodies[0].shadowRoot?.querySelector<HTMLDivElement>('div.base')\n\t\tconst lastEl=tableBodies[tableBodies.length - 1].shadowRoot?.querySelector<HTMLDivElement>('div.base')\n\t\tif(firstEl) {\n\t\t\tfirstEl.style.borderTopRightRadius=\"var(--nile-radius-radius-xl)\";\n\t\t\tfirstEl.style.borderTopLeftRadius = 'var(--nile-radius-radius-xl)';\n\t\t\tfirstEl.style.borderBottomRightRadius=\"0px\";\n\t\t\tfirstEl.style.borderBottomLeftRadius = '0px';\n\t\t\tfirstEl.style.borderBottom = 'none';\n\t\t}\n\t\tif(lastEl){\n\t\t\tlastEl.style.borderTopRightRadius=\"0px\";\n\t\t\tlastEl.style.borderTopLeftRadius = '0px';\n\t\t\tlastEl.style.borderBottomRightRadius=\"var(--nile-radius-radius-xl)\";\n\t\t\tlastEl.style.borderBottomLeftRadius = 'var(--nile-radius-radius-xl)';\n\t\t}\n\t\ttableBodies.forEach((tb,i)=>{\n\t\t\tif(i>0 && i<tableBodies.length-1){\n\t\t\t\tconst el=tb.shadowRoot?.querySelector<HTMLDivElement>('div.base')\n\t\t\t\tif(el) {\n\t\t\t\t\tel.style.borderTopRightRadius=\"0px\";\n\t\t\t\t\tel.style.borderTopLeftRadius = \"0px\";\n\t\t\t\t\tel.style.borderBottomRightRadius=\"0px\";\n\t\t\t\t\tel.style.borderBottomLeftRadius = \"0px\";\n\t\t\t\t\tel.style.borderBottom = 'none';\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t}\n\n\tgetPrimaryColumnWidths(){\n\t\tconst primaryTb=this.rows.find(tb=>tb.type=='primary')!;\n\t\tconst widthArray=this.getTableCellFetchQuery(primaryTb).map((e:LitElement)=>e.clientWidth) as Array<number>\n\t\treturn widthArray;\n\t}\n\t\n\trepaintTable(){\n\t\tconst primaryRowWidths=this.getPrimaryColumnWidths();\n\t\tconst secondaryRows=this.rows.filter(tb=>tb.type!='primary');\n\t\tsecondaryRows.forEach((row)=>{\n\t\t\tlet elements=this.getTableCellFetchQuery(row)\n\t\t\telements?.forEach((el:NileTableCellItem|NileTableHeaderItem,ind)=>{\n\t\t\t\tel.style.setProperty('--cell-width',primaryRowWidths.at(ind)+'px')\n\t\t\t})\n\t\t})\n\t}\n\n\tgetTableCellFetchQuery(row:NileTableBody):Array<Element>{\n\t\treturn row?.shadowRoot?.\n\t\t\tquerySelector<HTMLSlotElement>('slot:not([name])')?.\n\t\t\tassignedElements()[0]\n\t\t\t.shadowRoot?.querySelector<HTMLSlotElement>('slot')?.\n\t\t\tassignedElements()!\n\t}\n\t/* #endregion */\n}\n\nexport default NileTable;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-table': NileTable;\n }\n}"]}
1
+ {"version":3,"file":"nile-table.js","sourceRoot":"","sources":["../../../src/nile-table/nile-table.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAEH,OAAO,EAAa,IAAI,EAAiD,MAAM,KAAK,CAAC;AACrF,OAAO,EAAE,aAAa,EAAY,KAAK,EAAQ,MAAM,mBAAmB,CAAC;AACzE,OAA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,MAAM,CAAC;8CAA8B;AADjC,SAAS;IADrB,aAAa,CAAC,YAAY,CAAC;GACf,SAAS,CAyGrB;;AAED,eAAe,SAAS,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 {LitElement, html, CSSResultArray, TemplateResult, PropertyValues} from 'lit';\nimport { customElement, property, query, state} from 'lit/decorators.js';\nimport {styles} from './nile-table.css';\nimport NileElement from '../internal/nile-element';\nimport { NileTableBody } from '../nile-table-body';\nimport { NileTableCellItem } from '../nile-table-cell-item';\nimport { NileTableHeaderItem } from '../nile-table-header-item';\n\n\n/**\n * Nile table component.\n *\n * @tag nile-table\n *\n */\n@customElement('nile-table')\nexport class NileTable extends NileElement {\n @query('slot') defaultSlot: HTMLSlotElement;\n\tprivate rows:Array<NileTableBody>=[];\n\tprivate primaryRowWidths:Array<number>=[]\n\n\n\t/**\n\t * The styles for nile-table\n\t * @remarks If you are extending this class you can extend the base styles with super. Eg `return [super(), myCustomStyles]`\n\t */\n\tpublic static get styles(): CSSResultArray {\n\t\treturn [styles];\n\t}\n\tconnectedCallback(): void {\n\t\tsuper.connectedCallback()\n\t\tthis.addEventListener('nile-body-load',this.handleRows)\n\t}\n\n\tprotected firstUpdated(_changedProperties: PropertyValues): void {\n\t\tthis.updateComplete.then(()=>{\n\t\t\tthis.handleBodyCssUpdate();\n\t\t})\n\t}\n\n\n\t/* #endregion */\n\n\t/* #region Methods */\n\n\t/**\n\t * Render method\n\t * @slot This is a slot test\n\t */\n\tpublic render(): TemplateResult {\n\t\treturn html`\n\t\t\t<slot @slotchange=\"${this.repaintTable}\"></slot>\n\t\t\t`;\n\t}\n\n\trepaintTable(){\n\t\tthis.realignStructure();\n\t\tthis.handleBodyCssUpdate();\n\t}\n\n\thandleRows(e:CustomEvent){\n\t\tthis.rows=[...this.rows,e.detail.comp]\n\t}\n\n\thandleBodyCssUpdate(){\n const tableBodies = this.rows;\n if (!tableBodies.length) return;\n\t\tconst firstEl=tableBodies[0].shadowRoot?.querySelector<HTMLDivElement>('div.base')\n\t\tif(firstEl) {\n\t\t\tfirstEl.style.borderTopRightRadius=\"var(--nile-radius-radius-xl)\";\n\t\t\tfirstEl.style.borderTopLeftRadius = 'var(--nile-radius-radius-xl)';\n\t\t\tfirstEl.style.borderBottomRightRadius=\"0px\";\n\t\t\tfirstEl.style.borderBottomLeftRadius = '0px';\n\t\t\tfirstEl.style.borderBottom = 'none';\n\t\t}\n\t\ttableBodies.forEach((tb,i)=>{\n\t\t\tif(i>0 && i<tableBodies.length-1){\n\t\t\t\tconst el=tb.shadowRoot?.querySelector<HTMLDivElement>('div.base')\n\t\t\t\tif(el) {\n\t\t\t\t\tel.style.borderTopRightRadius=\"0px\";\n\t\t\t\t\tel.style.borderTopLeftRadius = \"0px\";\n\t\t\t\t\tel.style.borderBottomRightRadius=\"0px\";\n\t\t\t\t\tel.style.borderBottomLeftRadius = \"0px\";\n\t\t\t\t\tel.style.borderBottom = 'none';\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t\tconst lastEl=tableBodies[tableBodies.length - 1].shadowRoot?.querySelector<HTMLDivElement>('div.base')\n\t\tif(lastEl){\n\t\t\tlastEl.style.borderTopRightRadius=\"0px\";\n\t\t\tlastEl.style.borderTopLeftRadius = '0px';\n\t\t\tlastEl.style.borderBottomRightRadius=\"var(--nile-radius-radius-xl)\";\n\t\t\tlastEl.style.borderBottomLeftRadius = 'var(--nile-radius-radius-xl)';\n\t\t}\n\t}\n\n\tgetPrimaryColumnWidths(){\n\t\tconst primaryTb=this.rows.find(tb=>tb.type=='primary')!;\n\t\tconst widthArray=this.getTableCellFetchQuery(primaryTb).map((e:LitElement)=>e.clientWidth) as Array<number>\n\t\treturn widthArray;\n\t}\n\t\n\trealignStructure(){\n\t\tconst primaryRowWidths=this.getPrimaryColumnWidths();\n\t\tconst secondaryRows=this.rows.filter(tb=>tb.type!='primary');\n\t\tsecondaryRows.forEach((row)=>{\n\t\t\tlet elements=this.getTableCellFetchQuery(row)\n\t\t\telements?.forEach((el:NileTableCellItem|NileTableHeaderItem,ind)=>{\n\t\t\t\tel.style.setProperty('--cell-width',primaryRowWidths.at(ind)+'px')\n\t\t\t})\n\t\t})\n\t}\n\n\tgetTableCellFetchQuery(row:NileTableBody):Array<Element>{\n\t\treturn row?.shadowRoot?.\n\t\t\tquerySelector<HTMLSlotElement>('slot:not([name])')?.\n\t\t\tassignedElements()[0]\n\t\t\t.shadowRoot?.querySelector<HTMLSlotElement>('slot')?.\n\t\t\tassignedElements()!\n\t}\n\t/* #endregion */\n}\n\nexport default NileTable;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-table': NileTable;\n }\n}"]}