@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
|
@@ -8028,6 +8028,38 @@ function measureTextWidth(text, font) {
|
|
|
8028
8028
|
if (!ctx) return 0;
|
|
8029
8029
|
return ctx.measureText(text).width;
|
|
8030
8030
|
}
|
|
8031
|
+
const ACTIONS_INLINE_MAX = 3;
|
|
8032
|
+
function actionsWidthForSlots(slots) {
|
|
8033
|
+
return 30 * Math.max(1, slots) + 14;
|
|
8034
|
+
}
|
|
8035
|
+
function oculta(a, row) {
|
|
8036
|
+
return typeof a.hidden === "function" ? a.hidden(row) : !!a.hidden;
|
|
8037
|
+
}
|
|
8038
|
+
function splitActionSlots(actions, row) {
|
|
8039
|
+
const visiveis = actions.filter((a) => !oculta(a, row));
|
|
8040
|
+
if (visiveis.length === 0) return { inline: [], menu: [] };
|
|
8041
|
+
if (visiveis.some((a) => a.showInMenu)) {
|
|
8042
|
+
return {
|
|
8043
|
+
inline: visiveis.filter((a) => !a.showInMenu),
|
|
8044
|
+
menu: visiveis.filter((a) => a.showInMenu)
|
|
8045
|
+
};
|
|
8046
|
+
}
|
|
8047
|
+
if (visiveis.length <= ACTIONS_INLINE_MAX) return { inline: visiveis, menu: [] };
|
|
8048
|
+
return { inline: [], menu: visiveis };
|
|
8049
|
+
}
|
|
8050
|
+
function countActionSlots(split) {
|
|
8051
|
+
return split.inline.length + (split.menu.length > 0 ? 1 : 0);
|
|
8052
|
+
}
|
|
8053
|
+
function measureActionsWidth(getActions, rows) {
|
|
8054
|
+
if (!getActions || rows.length === 0) return null;
|
|
8055
|
+
let maxSlots = 0;
|
|
8056
|
+
for (const row of rows) {
|
|
8057
|
+
const slots = countActionSlots(splitActionSlots(getActions({ row }), row));
|
|
8058
|
+
if (slots > maxSlots) maxSlots = slots;
|
|
8059
|
+
}
|
|
8060
|
+
if (maxSlots === 0) return null;
|
|
8061
|
+
return actionsWidthForSlots(maxSlots);
|
|
8062
|
+
}
|
|
8031
8063
|
function getFieldValue(row, field) {
|
|
8032
8064
|
if (!field.includes(".")) {
|
|
8033
8065
|
return row[field];
|
|
@@ -8067,7 +8099,7 @@ function calculateColumnWidths(columns, rows, options) {
|
|
|
8067
8099
|
for (const col of columns) {
|
|
8068
8100
|
const field = String(col.field);
|
|
8069
8101
|
if (col.type === "actions") {
|
|
8070
|
-
const w = col.minWidth ?? ACTIONS_COLUMN_WIDTH;
|
|
8102
|
+
const w = col.width ?? col.minWidth ?? measureActionsWidth(col.getActions, rows.slice(0, sampleSize)) ?? ACTIONS_COLUMN_WIDTH;
|
|
8071
8103
|
widths[field] = w;
|
|
8072
8104
|
totalContentWidth += w;
|
|
8073
8105
|
continue;
|
|
@@ -9862,13 +9894,8 @@ function DataTableActionsCell({
|
|
|
9862
9894
|
row,
|
|
9863
9895
|
actions
|
|
9864
9896
|
}) {
|
|
9865
|
-
const
|
|
9866
|
-
|
|
9867
|
-
return !a.hidden;
|
|
9868
|
-
});
|
|
9869
|
-
const inlineActions = visible.filter((a) => !a.showInMenu);
|
|
9870
|
-
const menuActions = visible.filter((a) => a.showInMenu);
|
|
9871
|
-
if (visible.length === 0) return null;
|
|
9897
|
+
const { inline: inlineActions, menu: menuActions } = splitActionSlots(actions, row);
|
|
9898
|
+
if (inlineActions.length === 0 && menuActions.length === 0) return null;
|
|
9872
9899
|
const resolveDisabled = (a) => {
|
|
9873
9900
|
if (typeof a.disabled === "function") return a.disabled(row);
|
|
9874
9901
|
return !!a.disabled;
|
|
@@ -12912,7 +12939,6 @@ function Panel({
|
|
|
12912
12939
|
] })
|
|
12913
12940
|
] });
|
|
12914
12941
|
}
|
|
12915
|
-
exports.ACTIONS_COLUMN_WIDTH = ACTIONS_COLUMN_WIDTH;
|
|
12916
12942
|
exports.AddViewModal = AddViewModal;
|
|
12917
12943
|
exports.AlertModal = AlertModal;
|
|
12918
12944
|
exports.Avatar = Avatar;
|
|
@@ -12990,4 +13016,4 @@ exports.useColumnResize = useColumnResize;
|
|
|
12990
13016
|
exports.useColumnWidths = useColumnWidths;
|
|
12991
13017
|
exports.useDataTableContext = useDataTableContext;
|
|
12992
13018
|
exports.useFloatingPanelResize = useFloatingPanelResize;
|
|
12993
|
-
//# sourceMappingURL=panel-
|
|
13019
|
+
//# sourceMappingURL=panel-INPypAHe.cjs.map
|