@aquera/nile-elements 0.1.32-beta-1.0 → 0.1.32-beta-1.1

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/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Webcomponent nile-elements following open-wc recommendations",
4
4
  "license": "MIT",
5
5
  "author": "nile-elements",
6
- "version": "0.1.32-beta-1.0",
6
+ "version": "0.1.32-beta-1.1",
7
7
  "main": "dist/src/index.js",
8
8
  "type": "module",
9
9
  "module": "dist/src/index.js",
@@ -12,7 +12,8 @@ import {css} from 'lit';
12
12
  */
13
13
  export const styles = css`
14
14
  :host {
15
-
15
+ display:block;
16
+ width:100%;
16
17
  }
17
18
  `;
18
19
 
@@ -25,6 +25,7 @@ export class NileTable extends NileElement {
25
25
  @query('slot') defaultSlot: HTMLSlotElement;
26
26
  private rows:Array<NileTableBody>=[];
27
27
  private primaryRowWidths:Array<number>=[]
28
+ private resizeObserver:ResizeObserver ;
28
29
 
29
30
 
30
31
  /**
@@ -41,7 +42,7 @@ export class NileTable extends NileElement {
41
42
 
42
43
  protected firstUpdated(_changedProperties: PropertyValues): void {
43
44
  this.updateComplete.then(()=>{
44
- this.handleBodyCssUpdate();
45
+ this.handleResizeObserver();
45
46
  })
46
47
  }
47
48
 
@@ -70,8 +71,8 @@ export class NileTable extends NileElement {
70
71
  }
71
72
 
72
73
  handleBodyCssUpdate(){
74
+ if (this.rows.length<2) return;
73
75
  const tableBodies = this.rows;
74
- if (!tableBodies.length) return;
75
76
  const firstEl=tableBodies[0].shadowRoot?.querySelector<HTMLDivElement>('div.base')
76
77
  if(firstEl) {
77
78
  firstEl.style.borderTopRightRadius="var(--nile-radius-radius-xl)";
@@ -108,6 +109,7 @@ export class NileTable extends NileElement {
108
109
  }
109
110
 
110
111
  realignStructure(){
112
+ if (this.rows.length<2) return;
111
113
  const primaryRowWidths=this.getPrimaryColumnWidths();
112
114
  const secondaryRows=this.rows.filter(tb=>tb.type!='primary');
113
115
  secondaryRows.forEach((row)=>{
@@ -125,6 +127,21 @@ export class NileTable extends NileElement {
125
127
  .shadowRoot?.querySelector<HTMLSlotElement>('slot')?.
126
128
  assignedElements()!
127
129
  }
130
+
131
+ handleResizeObserver(){
132
+ const onResize = (entries:ResizeObserverEntry[]): void=> {
133
+ for (let entry of entries) {
134
+ this.realignStructure();
135
+ }
136
+ };
137
+ this.resizeObserver=new ResizeObserver(onResize)
138
+ this.resizeObserver.observe(this);
139
+ }
140
+
141
+ disconnectedCallback(): void {
142
+ this.resizeObserver.disconnect()
143
+ super.disconnectedCallback()
144
+ }
128
145
  /* #endregion */
129
146
  }
130
147
 
@@ -3332,7 +3332,7 @@
3332
3332
  },
3333
3333
  {
3334
3334
  "name": "nile-table",
3335
- "description": "Nile table component.\n\nProperties:\n\n * `defaultSlot` {`HTMLSlotElement`} - \n\n * `rows` {`NileTableBody[]`} - \n\n * `primaryRowWidths` {`number[]`} - \n\n * `BUBBLES` {`boolean`} - \n\n * `COMPOSED` {`boolean`} - \n\n * `CANCELABLE` {`boolean`} - ",
3335
+ "description": "Nile table component.\n\nProperties:\n\n * `defaultSlot` {`HTMLSlotElement`} - \n\n * `rows` {`NileTableBody[]`} - \n\n * `primaryRowWidths` {`number[]`} - \n\n * `resizeObserver` - \n\n * `BUBBLES` {`boolean`} - \n\n * `COMPOSED` {`boolean`} - \n\n * `CANCELABLE` {`boolean`} - ",
3336
3336
  "attributes": []
3337
3337
  },
3338
3338
  {