@trismegisto/angular 2.0.0 → 2.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 +4 -0
- package/fesm2022/trismegisto-angular-combobox-multi.mjs +2 -2
- package/fesm2022/trismegisto-angular-combobox-multi.mjs.map +1 -1
- package/fesm2022/trismegisto-angular-combobox.mjs +2 -2
- package/fesm2022/trismegisto-angular-combobox.mjs.map +1 -1
- package/fesm2022/trismegisto-angular-data-grid.mjs +27 -6
- package/fesm2022/trismegisto-angular-data-grid.mjs.map +1 -1
- package/fesm2022/trismegisto-angular-date-picker.mjs +2 -2
- package/fesm2022/trismegisto-angular-date-picker.mjs.map +1 -1
- package/fesm2022/trismegisto-angular-menu.mjs +3 -0
- package/fesm2022/trismegisto-angular-menu.mjs.map +1 -1
- package/fesm2022/trismegisto-angular-session-recovery.mjs +57 -11
- package/fesm2022/trismegisto-angular-session-recovery.mjs.map +1 -1
- package/fesm2022/trismegisto-angular-sidebar.mjs +32 -8
- package/fesm2022/trismegisto-angular-sidebar.mjs.map +1 -1
- package/fesm2022/trismegisto-angular.mjs +1 -1
- package/fesm2022/trismegisto-angular.mjs.map +1 -1
- package/package.json +6 -6
- package/types/trismegisto-angular-data-grid.d.ts +19 -1
- package/types/trismegisto-angular-data-grid.d.ts.map +1 -1
- package/types/trismegisto-angular-menu.d.ts.map +1 -1
- package/types/trismegisto-angular-session-recovery.d.ts +21 -3
- package/types/trismegisto-angular-session-recovery.d.ts.map +1 -1
- package/types/trismegisto-angular-sidebar.d.ts +15 -1
- package/types/trismegisto-angular-sidebar.d.ts.map +1 -1
- package/types/trismegisto-angular.d.ts +2 -2
|
@@ -8,6 +8,7 @@ import { AlertComponent } from '@trismegisto/angular/alert';
|
|
|
8
8
|
import { ButtonComponent } from '@trismegisto/angular/button';
|
|
9
9
|
import { HermesDragDropService, SortableDirective, DraggableDirective, DragHandleDirective } from '@trismegisto/angular/drag-drop';
|
|
10
10
|
import { DropdownComponent, DropdownTriggerDirective, DropdownIfOpenDirective, DropdownMenuComponent } from '@trismegisto/angular/dropdown';
|
|
11
|
+
import { HermesDialogService } from '@trismegisto/angular/dialog';
|
|
11
12
|
import { IconButtonComponent } from '@trismegisto/angular/icon-button';
|
|
12
13
|
import { MenuComponent } from '@trismegisto/angular/menu';
|
|
13
14
|
import { MenuButtonComponent } from '@trismegisto/angular/menu-button';
|
|
@@ -446,6 +447,15 @@ function headerFloor(th) {
|
|
|
446
447
|
const padding = (parseFloat(style.paddingLeft) || 0) + (parseFloat(style.paddingRight) || 0);
|
|
447
448
|
return Math.ceil(end - start + padding);
|
|
448
449
|
}
|
|
450
|
+
/**
|
|
451
|
+
* Largura que uma coluna pede no encaixe automático, a partir do que foi medido no modo de medição (`measured`, o
|
|
452
|
+
* conteúdo sem quebra). Coluna com `initialWidth` (`fixed`): a largura inicial (`current`) é o MÍNIMO, não o tamanho —
|
|
453
|
+
* se o conteúdo pede mais (ex.: o grupo de botões da coluna de ações), ela cresce até caber. Antes o conteúdo dela
|
|
454
|
+
* não era medido: os botões passavam da largura inicial, vazavam da célula e o "…" do grupo ficava fora da tela.
|
|
455
|
+
*/
|
|
456
|
+
function columnNaturalWidth(fixed, current, floor, measured) {
|
|
457
|
+
return fixed ? Math.max(current, floor, measured) : Math.max(measured, floor);
|
|
458
|
+
}
|
|
449
459
|
/** Soma das colunas de sistema (seleção, detalhe, ações), que têm largura própria no CSS. */
|
|
450
460
|
function systemColumnsWidth(table) {
|
|
451
461
|
return Array.from(table.querySelectorAll('thead tr > th:not([data-key])')).reduce((sum, th) => sum + th.getBoundingClientRect().width, 0);
|
|
@@ -676,9 +686,10 @@ class GridColumnSizingFeature {
|
|
|
676
686
|
if (!th)
|
|
677
687
|
continue;
|
|
678
688
|
const floor = this.clamp(headerFloor(th));
|
|
679
|
-
// Coluna com `initialWidth`: o tamanho atual dela é o mínimo, e ela não
|
|
680
|
-
|
|
681
|
-
|
|
689
|
+
// Coluna com `initialWidth`: o tamanho atual dela é o mínimo (cresce se o conteúdo pedir mais), e ela não
|
|
690
|
+
// entra na partilha.
|
|
691
|
+
const content = columnNaturalWidth(fixedKeys.has(key), current.get(key) ?? 0, floor, th.getBoundingClientRect().width);
|
|
692
|
+
natural.set(key, this.clamp(content));
|
|
682
693
|
floors.set(key, floor);
|
|
683
694
|
}
|
|
684
695
|
return { natural, floors };
|
|
@@ -1740,8 +1751,6 @@ class GridVirtualFeature {
|
|
|
1740
1751
|
}
|
|
1741
1752
|
}
|
|
1742
1753
|
|
|
1743
|
-
/** Tipos públicos do `hm-data-grid` — reexportados por `data-grid.component.ts`. */
|
|
1744
|
-
|
|
1745
1754
|
let gridSequence = 0;
|
|
1746
1755
|
/** Clique nestes alvos é do controle, não da linha. */
|
|
1747
1756
|
const INTERACTIVE = 'button, a, input, select, textarea, label, [role="button"]';
|
|
@@ -1951,7 +1960,19 @@ class DataGridComponent {
|
|
|
1951
1960
|
pinned: this.pinnedColumns,
|
|
1952
1961
|
manuallySized: () => this.sizing.manuallySized,
|
|
1953
1962
|
});
|
|
1954
|
-
|
|
1963
|
+
dialogs = inject(HermesDialogService);
|
|
1964
|
+
rowMenu = new GridRowActionsFeature(this.rowActions, (action, row) => void this.triggerAction(action, row));
|
|
1965
|
+
/** Emite `actionTriggered`; com `confirm` na ação, só depois que a pessoa confirma no diálogo. */
|
|
1966
|
+
async triggerAction(id, row) {
|
|
1967
|
+
const action = this.rowActions().find((a) => a.id === id);
|
|
1968
|
+
const confirm = typeof action?.confirm === 'function' ? action.confirm(row) : action?.confirm;
|
|
1969
|
+
if (action && confirm) {
|
|
1970
|
+
const ok = await this.dialogs.confirm({ ...confirm, danger: confirm.danger ?? !!action.danger, confirmLabel: confirm.confirmLabel ?? action.label });
|
|
1971
|
+
if (!ok)
|
|
1972
|
+
return;
|
|
1973
|
+
}
|
|
1974
|
+
this.actionTriggered.emit({ action: id, row });
|
|
1975
|
+
}
|
|
1955
1976
|
// ---------------------------------------------------------------- modelos do template
|
|
1956
1977
|
cellByKey = computed(() => new Map(this.cellTemplates().map((d) => [d.hmCell(), d.template])), ...(ngDevMode ? [{ debugName: "cellByKey" }] : /* istanbul ignore next */ []));
|
|
1957
1978
|
headerByKey = computed(() => new Map(this.headerTemplates().map((d) => [d.hmColumnHeader(), d.template])), ...(ngDevMode ? [{ debugName: "headerByKey" }] : /* istanbul ignore next */ []));
|