@universal-material/data-grid 0.3.2 → 0.3.3
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/dist/grid.js +34 -6
- package/dist/grid.js.map +1 -1
- package/dist/grid.min.js +267 -247
- package/dist/grid.styles.js +22 -2
- package/dist/grid.styles.js.map +1 -1
- package/package.json +1 -1
package/dist/grid.js
CHANGED
|
@@ -1643,6 +1643,8 @@ let DataGrid = class DataGrid extends LitElement {
|
|
|
1643
1643
|
/** Largura visível da porta externa sobre a tabela (0 = rolagem interna). */
|
|
1644
1644
|
this.#visibleWidth = 0;
|
|
1645
1645
|
this.#syncedVisibleWidth = -1;
|
|
1646
|
+
/** Aviso de \`overflow-x\` adiado para depois do render que esconde as colunas (\`autoHideColumns\`). */
|
|
1647
|
+
this.#clipCheckPending = false;
|
|
1646
1648
|
this.#isExpanded = (key, level) => this.#expansion.get(key)?.expanded ?? this.#defaultExpanded(level);
|
|
1647
1649
|
this.#typesVersion = -1;
|
|
1648
1650
|
this.#warnedInfinitePaging = false;
|
|
@@ -4759,6 +4761,11 @@ let DataGrid = class DataGrid extends LitElement {
|
|
|
4759
4761
|
this.#observeToolbar();
|
|
4760
4762
|
this.#observeFixedSections();
|
|
4761
4763
|
this.#syncTableLabel();
|
|
4764
|
+
// Só com a largura da porta medida: antes disso o responsivo ainda não escondeu nada.
|
|
4765
|
+
if (this.#clipCheckPending && !this.#adaptiveDirty && this.#viewportWidth > 0) {
|
|
4766
|
+
this.#clipCheckPending = false;
|
|
4767
|
+
this.#scrollPort.checkHorizontalClip(this.#tableRef.value?.offsetWidth ?? 0);
|
|
4768
|
+
}
|
|
4762
4769
|
// Editor fechou (ou o foco saiu sem focusout no corpo): o reshape adiado roda agora.
|
|
4763
4770
|
if (this.#reshapePending && !this.#reshapeFrozen) {
|
|
4764
4771
|
queueMicrotask(() => this.#flushReshape());
|
|
@@ -8771,15 +8778,27 @@ let DataGrid = class DataGrid extends LitElement {
|
|
|
8771
8778
|
const kept = inputs.filter((_, index) => !hidden.includes(index));
|
|
8772
8779
|
const overflow = kept.reduce((sum, input) => sum + input.width, 0) - available;
|
|
8773
8780
|
if (hidden.length && overflow > 0) {
|
|
8774
|
-
|
|
8781
|
+
const capOf = (index) => {
|
|
8775
8782
|
const column = shown[index];
|
|
8776
8783
|
const width = this.#widthOf(column);
|
|
8777
|
-
|
|
8778
|
-
|
|
8779
|
-
|
|
8780
|
-
|
|
8784
|
+
const min = Math.max(column.minWidth ?? 0, DEFAULT_MIN_COLUMN_WIDTH);
|
|
8785
|
+
return width === undefined || hidden.includes(index) ? undefined : { column, width: Math.max(min, width - overflow) };
|
|
8786
|
+
};
|
|
8787
|
+
for (let index = shown.length - 1; index >= 0 && !this.#adaptiveCap; index--) {
|
|
8788
|
+
if (!inputs[index].fixed) {
|
|
8789
|
+
this.#adaptiveCap = capOf(index);
|
|
8781
8790
|
}
|
|
8782
8791
|
}
|
|
8792
|
+
// Só fixas sobraram (ex.: "Nome" fixa no início com column-auto-width, relato 0.3.2): a mais larga encolhe.
|
|
8793
|
+
if (!this.#adaptiveCap) {
|
|
8794
|
+
let widest = -1;
|
|
8795
|
+
inputs.forEach((input, index) => {
|
|
8796
|
+
if (input.fixed && !hidden.includes(index) && (widest < 0 || input.width > inputs[widest].width)) {
|
|
8797
|
+
widest = index;
|
|
8798
|
+
}
|
|
8799
|
+
});
|
|
8800
|
+
this.#adaptiveCap = widest >= 0 ? capOf(widest) : undefined;
|
|
8801
|
+
}
|
|
8783
8802
|
}
|
|
8784
8803
|
return hidden.map(index => shown[index]);
|
|
8785
8804
|
}
|
|
@@ -9668,8 +9687,17 @@ let DataGrid = class DataGrid extends LitElement {
|
|
|
9668
9687
|
this.#syncFixedRows();
|
|
9669
9688
|
this.#syncRevealMargins();
|
|
9670
9689
|
this.#scrollPort.checkHeight();
|
|
9671
|
-
|
|
9690
|
+
if (this.autoHideColumns) {
|
|
9691
|
+
// As colunas ocultas por falta de espaço saem no próximo render: medir antes avisaria à toa (relato 0.3.2).
|
|
9692
|
+
this.#clipCheckPending = true;
|
|
9693
|
+
this.requestUpdate();
|
|
9694
|
+
}
|
|
9695
|
+
else {
|
|
9696
|
+
this.#scrollPort.checkHorizontalClip(this.#tableRef.value?.offsetWidth ?? 0);
|
|
9697
|
+
}
|
|
9672
9698
|
}
|
|
9699
|
+
/** Aviso de \`overflow-x\` adiado para depois do render que esconde as colunas (\`autoHideColumns\`). */
|
|
9700
|
+
#clipCheckPending;
|
|
9673
9701
|
/**
|
|
9674
9702
|
* Classe, deslocamento `sticky` e limites de cada coluna visível. Os
|
|
9675
9703
|
* deslocamentos usam a largura medida (a tabela pode esticar as colunas).
|