@design.estate/dees-catalog 1.0.223 → 1.0.224

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@design.estate/dees-catalog",
3
- "version": "1.0.223",
3
+ "version": "1.0.224",
4
4
  "private": false,
5
5
  "description": "website for lossless.com",
6
6
  "main": "dist_ts_web/index.js",
@@ -3,6 +3,6 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: '@design.estate/dees-catalog',
6
- version: '1.0.223',
6
+ version: '1.0.224',
7
7
  description: 'website for lossless.com'
8
8
  }
@@ -263,6 +263,8 @@ export class DeesTable<T> extends DeesElement {
263
263
  th,
264
264
  td {
265
265
  position: relative;
266
+ vertical-align: top;
267
+
266
268
  padding: 0px;
267
269
  border-right: 1px dashed ${cssManager.bdTheme('#999', '#808080')};
268
270
  }
@@ -582,44 +584,55 @@ export class DeesTable<T> extends DeesElement {
582
584
  `;
583
585
  }
584
586
 
585
- public async firstUpdated() {}
587
+ public async firstUpdated() {
588
+ }
586
589
 
587
590
  public async updated(changedProperties: Map<string | number | symbol, unknown>): Promise<void> {
588
591
  super.updated(changedProperties);
589
- this.freezeColumnWidths();
592
+ this.determineColumnWidths();
590
593
  }
591
594
 
592
- freezeColumnWidths() {
595
+ public async determineColumnWidths() {
596
+ const domtools = await this.domtoolsPromise;
597
+ await domtools.convenience.smartdelay.delayFor(0);
593
598
  // Get the table element
594
599
  const table = this.shadowRoot.querySelector('table');
595
600
  if (!table) return;
596
601
 
597
- // Create a colgroup if it doesn't exist
598
- let colgroup = table.querySelector('colgroup');
599
- if (!colgroup) {
600
- colgroup = document.createElement('colgroup');
601
- table.insertBefore(colgroup, table.firstChild);
602
- }
603
-
604
602
  // Get the first row's cells to measure the widths
605
603
  const cells = table.rows[0].cells;
606
604
 
607
- for (let i = 0; i < cells.length; i++) {
605
+ const handleColumnByIndex = async (i: number, waitForRenderArg: boolean = false) => {
606
+ const done = plugins.smartpromise.defer();
608
607
  const cell = cells[i];
609
608
 
610
609
  // Get computed width
611
610
  const width = window.getComputedStyle(cell).width;
612
-
613
- // Check if there's already a <col> for this cell
614
- let col = colgroup.children[i] as HTMLElement;
615
- if (!col) {
616
- col = document.createElement('col');
617
- colgroup.appendChild(col);
611
+ if (cell.textContent.includes('Actions')) {
612
+ cell.style.minWidth = '68px';
613
+ cell.style.width = `${this.dataActions.filter(actionArg => actionArg.type.includes('inRow')).length * 35}px`;
614
+ } else {
615
+ cell.style.width = width;
616
+ }
617
+ if (waitForRenderArg) {
618
+ requestAnimationFrame(() => {
619
+ done.resolve();
620
+ });
621
+ await done.promise;
618
622
  }
623
+ }
624
+
625
+ if (cells[cells.length - 1].textContent.includes('Actions')) {
626
+ await handleColumnByIndex(cells.length - 1, true);
627
+ }
619
628
 
620
- // Set the width
621
- col.style.width = width;
629
+ for (let i = 0; i < cells.length; i++) {
630
+ if (cells[i].textContent.includes('Actions')) {
631
+ continue;
632
+ }
633
+ await handleColumnByIndex(i);
622
634
  }
635
+ table.style.tableLayout = 'fixed';
623
636
  }
624
637
 
625
638
  getActionsForType(typeArg: ITableAction['type'][0]) {