fix(core): update
This commit is contained in:
parent
b47530e254
commit
c724a3e85b
@ -3,6 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@design.estate/dees-catalog',
|
name: '@design.estate/dees-catalog',
|
||||||
version: '1.0.223',
|
version: '1.0.224',
|
||||||
description: 'website for lossless.com'
|
description: 'website for lossless.com'
|
||||||
}
|
}
|
||||||
|
@ -263,6 +263,8 @@ export class DeesTable<T> extends DeesElement {
|
|||||||
th,
|
th,
|
||||||
td {
|
td {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
vertical-align: top;
|
||||||
|
|
||||||
padding: 0px;
|
padding: 0px;
|
||||||
border-right: 1px dashed ${cssManager.bdTheme('#999', '#808080')};
|
border-right: 1px dashed ${cssManager.bdTheme('#999', '#808080')};
|
||||||
}
|
}
|
||||||
@ -582,44 +584,55 @@ export class DeesTable<T> extends DeesElement {
|
|||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async firstUpdated() {}
|
public async firstUpdated() {
|
||||||
|
}
|
||||||
|
|
||||||
public async updated(changedProperties: Map<string | number | symbol, unknown>): Promise<void> {
|
public async updated(changedProperties: Map<string | number | symbol, unknown>): Promise<void> {
|
||||||
super.updated(changedProperties);
|
super.updated(changedProperties);
|
||||||
this.freezeColumnWidths();
|
this.determineColumnWidths();
|
||||||
}
|
}
|
||||||
|
|
||||||
freezeColumnWidths() {
|
public async determineColumnWidths() {
|
||||||
|
const domtools = await this.domtoolsPromise;
|
||||||
|
await domtools.convenience.smartdelay.delayFor(0);
|
||||||
// Get the table element
|
// Get the table element
|
||||||
const table = this.shadowRoot.querySelector('table');
|
const table = this.shadowRoot.querySelector('table');
|
||||||
if (!table) return;
|
if (!table) return;
|
||||||
|
|
||||||
// Create a colgroup if it doesn't exist
|
|
||||||
let colgroup = table.querySelector('colgroup');
|
|
||||||
if (!colgroup) {
|
|
||||||
colgroup = document.createElement('colgroup');
|
|
||||||
table.insertBefore(colgroup, table.firstChild);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get the first row's cells to measure the widths
|
// Get the first row's cells to measure the widths
|
||||||
const cells = table.rows[0].cells;
|
const cells = table.rows[0].cells;
|
||||||
|
|
||||||
for (let i = 0; i < cells.length; i++) {
|
const handleColumnByIndex = async (i: number, waitForRenderArg: boolean = false) => {
|
||||||
|
const done = plugins.smartpromise.defer();
|
||||||
const cell = cells[i];
|
const cell = cells[i];
|
||||||
|
|
||||||
// Get computed width
|
// Get computed width
|
||||||
const width = window.getComputedStyle(cell).width;
|
const width = window.getComputedStyle(cell).width;
|
||||||
|
if (cell.textContent.includes('Actions')) {
|
||||||
// Check if there's already a <col> for this cell
|
cell.style.minWidth = '68px';
|
||||||
let col = colgroup.children[i] as HTMLElement;
|
cell.style.width = `${this.dataActions.filter(actionArg => actionArg.type.includes('inRow')).length * 35}px`;
|
||||||
if (!col) {
|
} else {
|
||||||
col = document.createElement('col');
|
cell.style.width = width;
|
||||||
colgroup.appendChild(col);
|
}
|
||||||
|
if (waitForRenderArg) {
|
||||||
|
requestAnimationFrame(() => {
|
||||||
|
done.resolve();
|
||||||
|
});
|
||||||
|
await done.promise;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the width
|
|
||||||
col.style.width = width;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (cells[cells.length - 1].textContent.includes('Actions')) {
|
||||||
|
await handleColumnByIndex(cells.length - 1, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let i = 0; i < cells.length; i++) {
|
||||||
|
if (cells[i].textContent.includes('Actions')) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
await handleColumnByIndex(i);
|
||||||
|
}
|
||||||
|
table.style.tableLayout = 'fixed';
|
||||||
}
|
}
|
||||||
|
|
||||||
getActionsForType(typeArg: ITableAction['type'][0]) {
|
getActionsForType(typeArg: ITableAction['type'][0]) {
|
||||||
|
Loading…
Reference in New Issue
Block a user