@ceed/ads 1.29.0 → 1.29.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
|
@@ -2236,6 +2236,15 @@ function calculateColumnGroups(columnGroupingModel, columns, visibleFields) {
|
|
|
2236
2236
|
const correctedMaxLevel = filteredGroupsByLevel.length > 0 ? filteredGroupsByLevel.length - 1 : -1;
|
|
2237
2237
|
return { groups: filteredGroupsByLevel, maxLevel: correctedMaxLevel, fieldsInGroupingModel };
|
|
2238
2238
|
}
|
|
2239
|
+
function parsePxValue(value) {
|
|
2240
|
+
if (!value) return null;
|
|
2241
|
+
const trimmed = value.trim();
|
|
2242
|
+
if (trimmed.endsWith("px")) {
|
|
2243
|
+
const num = parseFloat(trimmed);
|
|
2244
|
+
return isNaN(num) ? null : num;
|
|
2245
|
+
}
|
|
2246
|
+
return null;
|
|
2247
|
+
}
|
|
2239
2248
|
function getTextAlign(props) {
|
|
2240
2249
|
return !props.editMode && ["number", "date", "currency"].includes(props.type || "") ? "end" : "start";
|
|
2241
2250
|
}
|
|
@@ -3535,7 +3544,8 @@ function useDataTableRenderer({
|
|
|
3535
3544
|
isRowSelectable,
|
|
3536
3545
|
columnGroupingModel,
|
|
3537
3546
|
columnVisibilityModel,
|
|
3538
|
-
onColumnVisibilityModelChange
|
|
3547
|
+
onColumnVisibilityModelChange,
|
|
3548
|
+
checkboxSelection
|
|
3539
3549
|
}) {
|
|
3540
3550
|
if (pinnedColumns && columnGroupingModel) {
|
|
3541
3551
|
throw new Error(
|
|
@@ -3568,6 +3578,14 @@ function useDataTableRenderer({
|
|
|
3568
3578
|
[reorderedColumns, visibilityModel]
|
|
3569
3579
|
);
|
|
3570
3580
|
const visibleFieldSet = (0, import_react25.useMemo)(() => new Set(visibleColumns.map((c) => c.field)), [visibleColumns]);
|
|
3581
|
+
const tableMinWidth = (0, import_react25.useMemo)(() => {
|
|
3582
|
+
const DEFAULT_MIN = 50;
|
|
3583
|
+
let total = checkboxSelection ? 40 : 0;
|
|
3584
|
+
for (const col of visibleColumns) {
|
|
3585
|
+
total += parsePxValue(col.minWidth) ?? parsePxValue(col.width) ?? DEFAULT_MIN;
|
|
3586
|
+
}
|
|
3587
|
+
return total;
|
|
3588
|
+
}, [visibleColumns, checkboxSelection]);
|
|
3571
3589
|
const allColumnsByField = (0, import_react25.useMemo)(
|
|
3572
3590
|
() => reorderedColumns.reduce(
|
|
3573
3591
|
(acc, curr) => ({
|
|
@@ -3868,6 +3886,7 @@ function useDataTableRenderer({
|
|
|
3868
3886
|
]
|
|
3869
3887
|
),
|
|
3870
3888
|
columns,
|
|
3889
|
+
tableMinWidth,
|
|
3871
3890
|
processedColumnGroups,
|
|
3872
3891
|
onTotalSelect: (0, import_react25.useCallback)(() => {
|
|
3873
3892
|
const selectableRows = rows.filter((row, i) => {
|
|
@@ -4257,6 +4276,7 @@ function Component(props, apiRef) {
|
|
|
4257
4276
|
onTotalSelect,
|
|
4258
4277
|
HeadCell: HeadCell2,
|
|
4259
4278
|
BodyRow: BodyRow2,
|
|
4279
|
+
tableMinWidth,
|
|
4260
4280
|
// For keyboard selection
|
|
4261
4281
|
selectionAnchor,
|
|
4262
4282
|
setSelectionAnchor
|
|
@@ -4446,7 +4466,7 @@ function Component(props, apiRef) {
|
|
|
4446
4466
|
ref: parentRef,
|
|
4447
4467
|
...backgroundProps
|
|
4448
4468
|
},
|
|
4449
|
-
/* @__PURE__ */ import_react28.default.createElement(Table, { ...innerProps }, /* @__PURE__ */ import_react28.default.createElement("colgroup", null, checkboxSelection && /* @__PURE__ */ import_react28.default.createElement(
|
|
4469
|
+
/* @__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(
|
|
4450
4470
|
"col",
|
|
4451
4471
|
{
|
|
4452
4472
|
style: {
|
|
@@ -4459,7 +4479,8 @@ function Component(props, apiRef) {
|
|
|
4459
4479
|
ref: c.tableColRef,
|
|
4460
4480
|
key: `${c.field.toString()}_${c.width}`,
|
|
4461
4481
|
style: {
|
|
4462
|
-
width: c.width
|
|
4482
|
+
width: c.width,
|
|
4483
|
+
minWidth: c.minWidth ?? "50px"
|
|
4463
4484
|
}
|
|
4464
4485
|
}
|
|
4465
4486
|
))), /* @__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
|
@@ -2102,6 +2102,15 @@ function calculateColumnGroups(columnGroupingModel, columns, visibleFields) {
|
|
|
2102
2102
|
const correctedMaxLevel = filteredGroupsByLevel.length > 0 ? filteredGroupsByLevel.length - 1 : -1;
|
|
2103
2103
|
return { groups: filteredGroupsByLevel, maxLevel: correctedMaxLevel, fieldsInGroupingModel };
|
|
2104
2104
|
}
|
|
2105
|
+
function parsePxValue(value) {
|
|
2106
|
+
if (!value) return null;
|
|
2107
|
+
const trimmed = value.trim();
|
|
2108
|
+
if (trimmed.endsWith("px")) {
|
|
2109
|
+
const num = parseFloat(trimmed);
|
|
2110
|
+
return isNaN(num) ? null : num;
|
|
2111
|
+
}
|
|
2112
|
+
return null;
|
|
2113
|
+
}
|
|
2105
2114
|
function getTextAlign(props) {
|
|
2106
2115
|
return !props.editMode && ["number", "date", "currency"].includes(props.type || "") ? "end" : "start";
|
|
2107
2116
|
}
|
|
@@ -3410,7 +3419,8 @@ function useDataTableRenderer({
|
|
|
3410
3419
|
isRowSelectable,
|
|
3411
3420
|
columnGroupingModel,
|
|
3412
3421
|
columnVisibilityModel,
|
|
3413
|
-
onColumnVisibilityModelChange
|
|
3422
|
+
onColumnVisibilityModelChange,
|
|
3423
|
+
checkboxSelection
|
|
3414
3424
|
}) {
|
|
3415
3425
|
if (pinnedColumns && columnGroupingModel) {
|
|
3416
3426
|
throw new Error(
|
|
@@ -3443,6 +3453,14 @@ function useDataTableRenderer({
|
|
|
3443
3453
|
[reorderedColumns, visibilityModel]
|
|
3444
3454
|
);
|
|
3445
3455
|
const visibleFieldSet = useMemo9(() => new Set(visibleColumns.map((c) => c.field)), [visibleColumns]);
|
|
3456
|
+
const tableMinWidth = useMemo9(() => {
|
|
3457
|
+
const DEFAULT_MIN = 50;
|
|
3458
|
+
let total = checkboxSelection ? 40 : 0;
|
|
3459
|
+
for (const col of visibleColumns) {
|
|
3460
|
+
total += parsePxValue(col.minWidth) ?? parsePxValue(col.width) ?? DEFAULT_MIN;
|
|
3461
|
+
}
|
|
3462
|
+
return total;
|
|
3463
|
+
}, [visibleColumns, checkboxSelection]);
|
|
3446
3464
|
const allColumnsByField = useMemo9(
|
|
3447
3465
|
() => reorderedColumns.reduce(
|
|
3448
3466
|
(acc, curr) => ({
|
|
@@ -3743,6 +3761,7 @@ function useDataTableRenderer({
|
|
|
3743
3761
|
]
|
|
3744
3762
|
),
|
|
3745
3763
|
columns,
|
|
3764
|
+
tableMinWidth,
|
|
3746
3765
|
processedColumnGroups,
|
|
3747
3766
|
onTotalSelect: useCallback10(() => {
|
|
3748
3767
|
const selectableRows = rows.filter((row, i) => {
|
|
@@ -4132,6 +4151,7 @@ function Component(props, apiRef) {
|
|
|
4132
4151
|
onTotalSelect,
|
|
4133
4152
|
HeadCell: HeadCell2,
|
|
4134
4153
|
BodyRow: BodyRow2,
|
|
4154
|
+
tableMinWidth,
|
|
4135
4155
|
// For keyboard selection
|
|
4136
4156
|
selectionAnchor,
|
|
4137
4157
|
setSelectionAnchor
|
|
@@ -4321,7 +4341,7 @@ function Component(props, apiRef) {
|
|
|
4321
4341
|
ref: parentRef,
|
|
4322
4342
|
...backgroundProps
|
|
4323
4343
|
},
|
|
4324
|
-
/* @__PURE__ */ React25.createElement(Table, { ...innerProps }, /* @__PURE__ */ React25.createElement("colgroup", null, checkboxSelection && /* @__PURE__ */ React25.createElement(
|
|
4344
|
+
/* @__PURE__ */ React25.createElement(Table, { ...innerProps, sx: { ...innerProps.sx, minWidth: tableMinWidth } }, /* @__PURE__ */ React25.createElement("colgroup", null, checkboxSelection && /* @__PURE__ */ React25.createElement(
|
|
4325
4345
|
"col",
|
|
4326
4346
|
{
|
|
4327
4347
|
style: {
|
|
@@ -4334,7 +4354,8 @@ function Component(props, apiRef) {
|
|
|
4334
4354
|
ref: c.tableColRef,
|
|
4335
4355
|
key: `${c.field.toString()}_${c.width}`,
|
|
4336
4356
|
style: {
|
|
4337
|
-
width: c.width
|
|
4357
|
+
width: c.width,
|
|
4358
|
+
minWidth: c.minWidth ?? "50px"
|
|
4338
4359
|
}
|
|
4339
4360
|
}
|
|
4340
4361
|
))), /* @__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(
|