@ceed/cds 1.28.0 → 1.28.1
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/index.cjs
CHANGED
|
@@ -2238,6 +2238,15 @@ function calculateColumnGroups(columnGroupingModel, columns, visibleFields) {
|
|
|
2238
2238
|
const correctedMaxLevel = filteredGroupsByLevel.length > 0 ? filteredGroupsByLevel.length - 1 : -1;
|
|
2239
2239
|
return { groups: filteredGroupsByLevel, maxLevel: correctedMaxLevel, fieldsInGroupingModel };
|
|
2240
2240
|
}
|
|
2241
|
+
function parsePxValue(value) {
|
|
2242
|
+
if (!value) return null;
|
|
2243
|
+
const trimmed = value.trim();
|
|
2244
|
+
if (trimmed.endsWith("px")) {
|
|
2245
|
+
const num = parseFloat(trimmed);
|
|
2246
|
+
return isNaN(num) ? null : num;
|
|
2247
|
+
}
|
|
2248
|
+
return null;
|
|
2249
|
+
}
|
|
2241
2250
|
function getTextAlign(props) {
|
|
2242
2251
|
return !props.editMode && ["number", "date", "currency"].includes(props.type || "") ? "end" : "start";
|
|
2243
2252
|
}
|
|
@@ -3537,7 +3546,8 @@ function useDataTableRenderer({
|
|
|
3537
3546
|
isRowSelectable,
|
|
3538
3547
|
columnGroupingModel,
|
|
3539
3548
|
columnVisibilityModel,
|
|
3540
|
-
onColumnVisibilityModelChange
|
|
3549
|
+
onColumnVisibilityModelChange,
|
|
3550
|
+
checkboxSelection
|
|
3541
3551
|
}) {
|
|
3542
3552
|
if (pinnedColumns && columnGroupingModel) {
|
|
3543
3553
|
throw new Error(
|
|
@@ -3570,6 +3580,14 @@ function useDataTableRenderer({
|
|
|
3570
3580
|
[reorderedColumns, visibilityModel]
|
|
3571
3581
|
);
|
|
3572
3582
|
const visibleFieldSet = (0, import_react25.useMemo)(() => new Set(visibleColumns.map((c) => c.field)), [visibleColumns]);
|
|
3583
|
+
const tableMinWidth = (0, import_react25.useMemo)(() => {
|
|
3584
|
+
const DEFAULT_MIN = 50;
|
|
3585
|
+
let total = checkboxSelection ? 40 : 0;
|
|
3586
|
+
for (const col of visibleColumns) {
|
|
3587
|
+
total += parsePxValue(col.minWidth) ?? parsePxValue(col.width) ?? DEFAULT_MIN;
|
|
3588
|
+
}
|
|
3589
|
+
return total;
|
|
3590
|
+
}, [visibleColumns, checkboxSelection]);
|
|
3573
3591
|
const allColumnsByField = (0, import_react25.useMemo)(
|
|
3574
3592
|
() => reorderedColumns.reduce(
|
|
3575
3593
|
(acc, curr) => ({
|
|
@@ -3870,6 +3888,7 @@ function useDataTableRenderer({
|
|
|
3870
3888
|
]
|
|
3871
3889
|
),
|
|
3872
3890
|
columns,
|
|
3891
|
+
tableMinWidth,
|
|
3873
3892
|
processedColumnGroups,
|
|
3874
3893
|
onTotalSelect: (0, import_react25.useCallback)(() => {
|
|
3875
3894
|
const selectableRows = rows.filter((row, i) => {
|
|
@@ -4259,6 +4278,7 @@ function Component(props, apiRef) {
|
|
|
4259
4278
|
onTotalSelect,
|
|
4260
4279
|
HeadCell: HeadCell2,
|
|
4261
4280
|
BodyRow: BodyRow2,
|
|
4281
|
+
tableMinWidth,
|
|
4262
4282
|
// For keyboard selection
|
|
4263
4283
|
selectionAnchor,
|
|
4264
4284
|
setSelectionAnchor
|
|
@@ -4448,7 +4468,7 @@ function Component(props, apiRef) {
|
|
|
4448
4468
|
ref: parentRef,
|
|
4449
4469
|
...backgroundProps
|
|
4450
4470
|
},
|
|
4451
|
-
/* @__PURE__ */ import_react28.default.createElement(Table, { ...innerProps }, /* @__PURE__ */ import_react28.default.createElement("colgroup", null, checkboxSelection && /* @__PURE__ */ import_react28.default.createElement(
|
|
4471
|
+
/* @__PURE__ */ import_react28.default.createElement(Table, { ...innerProps, sx: { ...innerProps.sx, minWidth: tableMinWidth } }, /* @__PURE__ */ import_react28.default.createElement("colgroup", null, checkboxSelection && /* @__PURE__ */ import_react28.default.createElement(
|
|
4452
4472
|
"col",
|
|
4453
4473
|
{
|
|
4454
4474
|
style: {
|
|
@@ -4461,7 +4481,8 @@ function Component(props, apiRef) {
|
|
|
4461
4481
|
ref: c.tableColRef,
|
|
4462
4482
|
key: `${c.field.toString()}_${c.width}`,
|
|
4463
4483
|
style: {
|
|
4464
|
-
width: c.width
|
|
4484
|
+
width: c.width,
|
|
4485
|
+
minWidth: c.minWidth ?? "50px"
|
|
4465
4486
|
}
|
|
4466
4487
|
}
|
|
4467
4488
|
))), /* @__PURE__ */ import_react28.default.createElement("thead", null, processedColumnGroups && processedColumnGroups.groups.length > 0 && processedColumnGroups.groups.map((levelGroups, level) => /* @__PURE__ */ import_react28.default.createElement("tr", { key: `group-level-${level}` }, checkboxSelection && level === 0 && /* @__PURE__ */ import_react28.default.createElement(
|
package/dist/index.js
CHANGED
|
@@ -2112,6 +2112,15 @@ function calculateColumnGroups(columnGroupingModel, columns, visibleFields) {
|
|
|
2112
2112
|
const correctedMaxLevel = filteredGroupsByLevel.length > 0 ? filteredGroupsByLevel.length - 1 : -1;
|
|
2113
2113
|
return { groups: filteredGroupsByLevel, maxLevel: correctedMaxLevel, fieldsInGroupingModel };
|
|
2114
2114
|
}
|
|
2115
|
+
function parsePxValue(value) {
|
|
2116
|
+
if (!value) return null;
|
|
2117
|
+
const trimmed = value.trim();
|
|
2118
|
+
if (trimmed.endsWith("px")) {
|
|
2119
|
+
const num = parseFloat(trimmed);
|
|
2120
|
+
return isNaN(num) ? null : num;
|
|
2121
|
+
}
|
|
2122
|
+
return null;
|
|
2123
|
+
}
|
|
2115
2124
|
function getTextAlign(props) {
|
|
2116
2125
|
return !props.editMode && ["number", "date", "currency"].includes(props.type || "") ? "end" : "start";
|
|
2117
2126
|
}
|
|
@@ -3420,7 +3429,8 @@ function useDataTableRenderer({
|
|
|
3420
3429
|
isRowSelectable,
|
|
3421
3430
|
columnGroupingModel,
|
|
3422
3431
|
columnVisibilityModel,
|
|
3423
|
-
onColumnVisibilityModelChange
|
|
3432
|
+
onColumnVisibilityModelChange,
|
|
3433
|
+
checkboxSelection
|
|
3424
3434
|
}) {
|
|
3425
3435
|
if (pinnedColumns && columnGroupingModel) {
|
|
3426
3436
|
throw new Error(
|
|
@@ -3453,6 +3463,14 @@ function useDataTableRenderer({
|
|
|
3453
3463
|
[reorderedColumns, visibilityModel]
|
|
3454
3464
|
);
|
|
3455
3465
|
const visibleFieldSet = useMemo9(() => new Set(visibleColumns.map((c) => c.field)), [visibleColumns]);
|
|
3466
|
+
const tableMinWidth = useMemo9(() => {
|
|
3467
|
+
const DEFAULT_MIN = 50;
|
|
3468
|
+
let total = checkboxSelection ? 40 : 0;
|
|
3469
|
+
for (const col of visibleColumns) {
|
|
3470
|
+
total += parsePxValue(col.minWidth) ?? parsePxValue(col.width) ?? DEFAULT_MIN;
|
|
3471
|
+
}
|
|
3472
|
+
return total;
|
|
3473
|
+
}, [visibleColumns, checkboxSelection]);
|
|
3456
3474
|
const allColumnsByField = useMemo9(
|
|
3457
3475
|
() => reorderedColumns.reduce(
|
|
3458
3476
|
(acc, curr) => ({
|
|
@@ -3753,6 +3771,7 @@ function useDataTableRenderer({
|
|
|
3753
3771
|
]
|
|
3754
3772
|
),
|
|
3755
3773
|
columns,
|
|
3774
|
+
tableMinWidth,
|
|
3756
3775
|
processedColumnGroups,
|
|
3757
3776
|
onTotalSelect: useCallback10(() => {
|
|
3758
3777
|
const selectableRows = rows.filter((row, i) => {
|
|
@@ -4142,6 +4161,7 @@ function Component(props, apiRef) {
|
|
|
4142
4161
|
onTotalSelect,
|
|
4143
4162
|
HeadCell: HeadCell2,
|
|
4144
4163
|
BodyRow: BodyRow2,
|
|
4164
|
+
tableMinWidth,
|
|
4145
4165
|
// For keyboard selection
|
|
4146
4166
|
selectionAnchor,
|
|
4147
4167
|
setSelectionAnchor
|
|
@@ -4331,7 +4351,7 @@ function Component(props, apiRef) {
|
|
|
4331
4351
|
ref: parentRef,
|
|
4332
4352
|
...backgroundProps
|
|
4333
4353
|
},
|
|
4334
|
-
/* @__PURE__ */ React25.createElement(Table, { ...innerProps }, /* @__PURE__ */ React25.createElement("colgroup", null, checkboxSelection && /* @__PURE__ */ React25.createElement(
|
|
4354
|
+
/* @__PURE__ */ React25.createElement(Table, { ...innerProps, sx: { ...innerProps.sx, minWidth: tableMinWidth } }, /* @__PURE__ */ React25.createElement("colgroup", null, checkboxSelection && /* @__PURE__ */ React25.createElement(
|
|
4335
4355
|
"col",
|
|
4336
4356
|
{
|
|
4337
4357
|
style: {
|
|
@@ -4344,7 +4364,8 @@ function Component(props, apiRef) {
|
|
|
4344
4364
|
ref: c.tableColRef,
|
|
4345
4365
|
key: `${c.field.toString()}_${c.width}`,
|
|
4346
4366
|
style: {
|
|
4347
|
-
width: c.width
|
|
4367
|
+
width: c.width,
|
|
4368
|
+
minWidth: c.minWidth ?? "50px"
|
|
4348
4369
|
}
|
|
4349
4370
|
}
|
|
4350
4371
|
))), /* @__PURE__ */ React25.createElement("thead", null, processedColumnGroups && processedColumnGroups.groups.length > 0 && processedColumnGroups.groups.map((levelGroups, level) => /* @__PURE__ */ React25.createElement("tr", { key: `group-level-${level}` }, checkboxSelection && level === 0 && /* @__PURE__ */ React25.createElement(
|