@snksergio/design-system 0.41.0 → 0.42.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/dist-lib/chunks/{panel-Bje0kUTh.mjs → panel-BI52RBEn.mjs} +94 -68
- package/dist-lib/chunks/panel-BI52RBEn.mjs.map +1 -0
- package/dist-lib/chunks/{panel-DtU3KlKY.cjs → panel-INPypAHe.cjs} +36 -10
- package/dist-lib/chunks/panel-INPypAHe.cjs.map +1 -0
- package/dist-lib/index.cjs +2 -2
- package/dist-lib/index.cjs.map +1 -1
- package/dist-lib/index.mjs +76 -76
- package/dist-lib/index.mjs.map +1 -1
- package/dist-lib/preview/clientes.cjs +1 -1
- package/dist-lib/preview/clientes.mjs +1 -1
- package/dist-lib/src/components/ui/DataTable/builders/column-builders.d.ts.map +1 -1
- package/dist-lib/src/components/ui/DataTable/parts/data-table-actions-cell.d.ts +7 -3
- package/dist-lib/src/components/ui/DataTable/parts/data-table-actions-cell.d.ts.map +1 -1
- package/dist-lib/src/components/ui/DataTable/utils/action-slots.d.ts +76 -0
- package/dist-lib/src/components/ui/DataTable/utils/action-slots.d.ts.map +1 -0
- package/dist-lib/src/components/ui/DataTable/utils/calculate-column-widths.d.ts.map +1 -1
- package/package.json +208 -207
- package/dist-lib/chunks/panel-Bje0kUTh.mjs.map +0 -1
- package/dist-lib/chunks/panel-DtU3KlKY.cjs.map +0 -1
|
@@ -8010,6 +8010,38 @@ function measureTextWidth(text, font) {
|
|
|
8010
8010
|
if (!ctx) return 0;
|
|
8011
8011
|
return ctx.measureText(text).width;
|
|
8012
8012
|
}
|
|
8013
|
+
const ACTIONS_INLINE_MAX = 3;
|
|
8014
|
+
function actionsWidthForSlots(slots) {
|
|
8015
|
+
return 30 * Math.max(1, slots) + 14;
|
|
8016
|
+
}
|
|
8017
|
+
function oculta(a, row) {
|
|
8018
|
+
return typeof a.hidden === "function" ? a.hidden(row) : !!a.hidden;
|
|
8019
|
+
}
|
|
8020
|
+
function splitActionSlots(actions, row) {
|
|
8021
|
+
const visiveis = actions.filter((a) => !oculta(a, row));
|
|
8022
|
+
if (visiveis.length === 0) return { inline: [], menu: [] };
|
|
8023
|
+
if (visiveis.some((a) => a.showInMenu)) {
|
|
8024
|
+
return {
|
|
8025
|
+
inline: visiveis.filter((a) => !a.showInMenu),
|
|
8026
|
+
menu: visiveis.filter((a) => a.showInMenu)
|
|
8027
|
+
};
|
|
8028
|
+
}
|
|
8029
|
+
if (visiveis.length <= ACTIONS_INLINE_MAX) return { inline: visiveis, menu: [] };
|
|
8030
|
+
return { inline: [], menu: visiveis };
|
|
8031
|
+
}
|
|
8032
|
+
function countActionSlots(split) {
|
|
8033
|
+
return split.inline.length + (split.menu.length > 0 ? 1 : 0);
|
|
8034
|
+
}
|
|
8035
|
+
function measureActionsWidth(getActions, rows) {
|
|
8036
|
+
if (!getActions || rows.length === 0) return null;
|
|
8037
|
+
let maxSlots = 0;
|
|
8038
|
+
for (const row of rows) {
|
|
8039
|
+
const slots = countActionSlots(splitActionSlots(getActions({ row }), row));
|
|
8040
|
+
if (slots > maxSlots) maxSlots = slots;
|
|
8041
|
+
}
|
|
8042
|
+
if (maxSlots === 0) return null;
|
|
8043
|
+
return actionsWidthForSlots(maxSlots);
|
|
8044
|
+
}
|
|
8013
8045
|
function getFieldValue(row, field) {
|
|
8014
8046
|
if (!field.includes(".")) {
|
|
8015
8047
|
return row[field];
|
|
@@ -8049,7 +8081,7 @@ function calculateColumnWidths(columns, rows, options) {
|
|
|
8049
8081
|
for (const col of columns) {
|
|
8050
8082
|
const field = String(col.field);
|
|
8051
8083
|
if (col.type === "actions") {
|
|
8052
|
-
const w = col.minWidth ?? ACTIONS_COLUMN_WIDTH;
|
|
8084
|
+
const w = col.width ?? col.minWidth ?? measureActionsWidth(col.getActions, rows.slice(0, sampleSize)) ?? ACTIONS_COLUMN_WIDTH;
|
|
8053
8085
|
widths[field] = w;
|
|
8054
8086
|
totalContentWidth += w;
|
|
8055
8087
|
continue;
|
|
@@ -9844,13 +9876,8 @@ function DataTableActionsCell({
|
|
|
9844
9876
|
row,
|
|
9845
9877
|
actions
|
|
9846
9878
|
}) {
|
|
9847
|
-
const
|
|
9848
|
-
|
|
9849
|
-
return !a.hidden;
|
|
9850
|
-
});
|
|
9851
|
-
const inlineActions = visible.filter((a) => !a.showInMenu);
|
|
9852
|
-
const menuActions = visible.filter((a) => a.showInMenu);
|
|
9853
|
-
if (visible.length === 0) return null;
|
|
9879
|
+
const { inline: inlineActions, menu: menuActions } = splitActionSlots(actions, row);
|
|
9880
|
+
if (inlineActions.length === 0 && menuActions.length === 0) return null;
|
|
9854
9881
|
const resolveDisabled = (a) => {
|
|
9855
9882
|
if (typeof a.disabled === "function") return a.disabled(row);
|
|
9856
9883
|
return !!a.disabled;
|
|
@@ -12895,59 +12922,58 @@ function Panel({
|
|
|
12895
12922
|
] });
|
|
12896
12923
|
}
|
|
12897
12924
|
export {
|
|
12898
|
-
|
|
12925
|
+
SortPanel as $,
|
|
12899
12926
|
AlertModal as A,
|
|
12900
12927
|
BulkActionButton as B,
|
|
12901
12928
|
ColsPanel as C,
|
|
12902
12929
|
DataTable as D,
|
|
12903
|
-
|
|
12930
|
+
DataTableEmpty as E,
|
|
12904
12931
|
FormFieldInput as F,
|
|
12905
|
-
|
|
12906
|
-
|
|
12907
|
-
|
|
12908
|
-
|
|
12909
|
-
|
|
12932
|
+
DataTableFloatingBulkBar as G,
|
|
12933
|
+
DataTableLoading as H,
|
|
12934
|
+
DataTableNoResults as I,
|
|
12935
|
+
DataTableTotalizerRow as J,
|
|
12936
|
+
FLOATING_PANEL_SIZE_PX as K,
|
|
12910
12937
|
ListItem as L,
|
|
12911
|
-
|
|
12912
|
-
|
|
12913
|
-
|
|
12938
|
+
FilterPanel as M,
|
|
12939
|
+
FloatingPanelField as N,
|
|
12940
|
+
FloatingPanelSection as O,
|
|
12914
12941
|
Panel as P,
|
|
12915
|
-
|
|
12916
|
-
|
|
12917
|
-
|
|
12942
|
+
FooterTable as Q,
|
|
12943
|
+
FooterTableSkeleton as R,
|
|
12944
|
+
FormFieldCheckbox as S,
|
|
12918
12945
|
ToolbarToolButton as T,
|
|
12919
|
-
|
|
12920
|
-
|
|
12921
|
-
|
|
12922
|
-
|
|
12923
|
-
|
|
12924
|
-
|
|
12925
|
-
|
|
12946
|
+
FormFieldSwitch as U,
|
|
12947
|
+
Kanban as V,
|
|
12948
|
+
MoreMenu as W,
|
|
12949
|
+
PanelBody as X,
|
|
12950
|
+
PanelFooter as Y,
|
|
12951
|
+
PanelHeader as Z,
|
|
12952
|
+
SELECTION_COLUMN_WIDTH as _,
|
|
12926
12953
|
FormField as a,
|
|
12927
|
-
|
|
12928
|
-
|
|
12929
|
-
|
|
12930
|
-
|
|
12931
|
-
|
|
12932
|
-
|
|
12933
|
-
|
|
12934
|
-
|
|
12935
|
-
|
|
12936
|
-
|
|
12937
|
-
|
|
12938
|
-
|
|
12939
|
-
|
|
12940
|
-
|
|
12941
|
-
|
|
12942
|
-
|
|
12943
|
-
|
|
12944
|
-
|
|
12945
|
-
|
|
12946
|
-
|
|
12947
|
-
|
|
12948
|
-
|
|
12949
|
-
|
|
12950
|
-
useFloatingPanelResize as an,
|
|
12954
|
+
SortPopover as a0,
|
|
12955
|
+
TABLE_HEADER_HEIGHT as a1,
|
|
12956
|
+
Table as a2,
|
|
12957
|
+
TableBody as a3,
|
|
12958
|
+
TableCardRow as a4,
|
|
12959
|
+
TableCell as a5,
|
|
12960
|
+
TableHead as a6,
|
|
12961
|
+
TableHeadCell as a7,
|
|
12962
|
+
TableRow as a8,
|
|
12963
|
+
TableToolbarViews as a9,
|
|
12964
|
+
ToolbarDivider as aa,
|
|
12965
|
+
ToolbarSaveButton as ab,
|
|
12966
|
+
ToolbarSegmented as ac,
|
|
12967
|
+
ToolbarSettingsMenu as ad,
|
|
12968
|
+
ViewsPopover as ae,
|
|
12969
|
+
avatarVariants as af,
|
|
12970
|
+
floatingPanelStyles as ag,
|
|
12971
|
+
panelContainer as ah,
|
|
12972
|
+
savedViewsMockService as ai,
|
|
12973
|
+
useColumnResize as aj,
|
|
12974
|
+
useColumnWidths as ak,
|
|
12975
|
+
useDataTableContext as al,
|
|
12976
|
+
useFloatingPanelResize as am,
|
|
12951
12977
|
FormFieldSelect as b,
|
|
12952
12978
|
FormFieldTextarea as c,
|
|
12953
12979
|
FloatingPanel as d,
|
|
@@ -12957,21 +12983,21 @@ export {
|
|
|
12957
12983
|
ButtonGroup as h,
|
|
12958
12984
|
isFilterEntryActive as i,
|
|
12959
12985
|
ToolbarSimpleFilterDrawer as j,
|
|
12960
|
-
|
|
12961
|
-
|
|
12962
|
-
|
|
12963
|
-
|
|
12964
|
-
|
|
12986
|
+
TableToolbar as k,
|
|
12987
|
+
ToolbarActions as l,
|
|
12988
|
+
ToolbarFilterButton as m,
|
|
12989
|
+
ToolbarSearch as n,
|
|
12990
|
+
ToolbarApplied as o,
|
|
12965
12991
|
presetView as p,
|
|
12966
|
-
|
|
12967
|
-
|
|
12968
|
-
|
|
12969
|
-
|
|
12970
|
-
|
|
12971
|
-
|
|
12972
|
-
|
|
12973
|
-
|
|
12974
|
-
|
|
12975
|
-
|
|
12992
|
+
ToolbarTabs as q,
|
|
12993
|
+
columnTypeRegistry as r,
|
|
12994
|
+
List as s,
|
|
12995
|
+
AddViewModal as t,
|
|
12996
|
+
BulkActionsBar as u,
|
|
12997
|
+
ColsPopover as v,
|
|
12998
|
+
Combobox as w,
|
|
12999
|
+
DEFAULT_FILTER_OPERATORS as x,
|
|
13000
|
+
DataTableActionsCell as y,
|
|
13001
|
+
DataTableEditCell as z
|
|
12976
13002
|
};
|
|
12977
|
-
//# sourceMappingURL=panel-
|
|
13003
|
+
//# sourceMappingURL=panel-BI52RBEn.mjs.map
|