@ceed/ads 1.41.3-next.6 → 1.41.3-next.7
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/components/DataTable/utils.d.ts +6 -0
- package/dist/index.browser.js +6 -6
- package/dist/index.browser.js.map +3 -3
- package/dist/index.cjs +23 -11
- package/dist/index.js +180 -168
- package/dist/libs/slot-props.d.ts +2 -2
- package/framer/index.js +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -458,16 +458,25 @@ function useSlotRef(slotProp, ref) {
|
|
|
458
458
|
const isFunctionForm = typeof slotProp === "function";
|
|
459
459
|
const slotRef = isFunctionForm ? void 0 : slotProp?.ref;
|
|
460
460
|
const mergedRef = useMergedRef(slotRef, ref);
|
|
461
|
+
const latestSlotRef = (0, import_react6.useRef)(null);
|
|
462
|
+
const stableMergedRef = (0, import_react6.useCallback)(
|
|
463
|
+
(value) => {
|
|
464
|
+
assignRef(latestSlotRef.current, value);
|
|
465
|
+
assignRef(ref, value);
|
|
466
|
+
},
|
|
467
|
+
[ref]
|
|
468
|
+
);
|
|
461
469
|
return (0, import_react6.useMemo)(() => {
|
|
462
470
|
if (isFunctionForm) {
|
|
463
471
|
return ((ownerState) => {
|
|
464
472
|
const resolved = slotProp(ownerState) ?? {};
|
|
465
|
-
const
|
|
466
|
-
|
|
473
|
+
const resolvedRef = resolved.ref;
|
|
474
|
+
latestSlotRef.current = resolvedRef ?? null;
|
|
475
|
+
return resolvedRef || ref ? { ...resolved, ref: stableMergedRef } : { ...resolved };
|
|
467
476
|
});
|
|
468
477
|
}
|
|
469
478
|
return mergedRef ? { ...slotProp, ref: mergedRef } : { ...slotProp };
|
|
470
|
-
}, [isFunctionForm, slotProp, mergedRef, ref]);
|
|
479
|
+
}, [isFunctionForm, slotProp, mergedRef, ref, stableMergedRef]);
|
|
471
480
|
}
|
|
472
481
|
|
|
473
482
|
// src/components/Autocomplete/Autocomplete.tsx
|
|
@@ -2610,7 +2619,10 @@ function computeAutoFitWidth(params) {
|
|
|
2610
2619
|
return finalWidth;
|
|
2611
2620
|
}
|
|
2612
2621
|
function getHeaderCellId(tableId, columnId) {
|
|
2613
|
-
return `${tableId}_header_${columnId}
|
|
2622
|
+
return `${tableId}_header_${columnId}`;
|
|
2623
|
+
}
|
|
2624
|
+
function sanitizeColumnId(field) {
|
|
2625
|
+
return String(field).trim().replace(/\s+/g, "_");
|
|
2614
2626
|
}
|
|
2615
2627
|
|
|
2616
2628
|
// src/components/DataTable/styled.tsx
|
|
@@ -3948,8 +3960,8 @@ function useColumnWidths(columnsById) {
|
|
|
3948
3960
|
});
|
|
3949
3961
|
setWidths((prev) => {
|
|
3950
3962
|
const keys = Object.keys(measured);
|
|
3951
|
-
const same = keys.
|
|
3952
|
-
return same ? prev : measured;
|
|
3963
|
+
const same = keys.every((key) => prev[key] === measured[key]);
|
|
3964
|
+
return same ? prev : { ...prev, ...measured };
|
|
3953
3965
|
});
|
|
3954
3966
|
return () => roRef.current?.disconnect();
|
|
3955
3967
|
}, [columnsById]);
|
|
@@ -4036,10 +4048,10 @@ function useDataTableRenderer({
|
|
|
4036
4048
|
[reorderedColumns]
|
|
4037
4049
|
);
|
|
4038
4050
|
const allColumnIds = (0, import_react27.useMemo)(() => {
|
|
4039
|
-
const taken = new Set(reorderedColumns.map((column) =>
|
|
4051
|
+
const taken = new Set(reorderedColumns.map((column) => sanitizeColumnId(column.field)));
|
|
4040
4052
|
const assigned = /* @__PURE__ */ new Set();
|
|
4041
4053
|
return reorderedColumns.map((column) => {
|
|
4042
|
-
const field =
|
|
4054
|
+
const field = sanitizeColumnId(column.field);
|
|
4043
4055
|
if (!assigned.has(field)) {
|
|
4044
4056
|
assigned.add(field);
|
|
4045
4057
|
return field;
|
|
@@ -4190,7 +4202,7 @@ function useDataTableRenderer({
|
|
|
4190
4202
|
field: key
|
|
4191
4203
|
}));
|
|
4192
4204
|
return baseColumns.map((column, index) => {
|
|
4193
|
-
const columnId = columnIds[index] ??
|
|
4205
|
+
const columnId = columnIds[index] ?? sanitizeColumnId(column.field);
|
|
4194
4206
|
const isLeftPinned = effectivePinnedLeft?.includes(column.field);
|
|
4195
4207
|
const isRightPinned = effectivePinnedRight?.includes(column.field);
|
|
4196
4208
|
const isPinned = isLeftPinned || isRightPinned;
|
|
@@ -5028,13 +5040,13 @@ function Component(props, apiRef) {
|
|
|
5028
5040
|
}
|
|
5029
5041
|
},
|
|
5030
5042
|
headerCheckboxElement
|
|
5031
|
-
), columns.map((c
|
|
5043
|
+
), columns.map((c) => (
|
|
5032
5044
|
// @ts-ignore
|
|
5033
5045
|
/* @__PURE__ */ import_react30.default.createElement(
|
|
5034
5046
|
HeadCell2,
|
|
5035
5047
|
{
|
|
5036
5048
|
tableId,
|
|
5037
|
-
key:
|
|
5049
|
+
key: c.columnId,
|
|
5038
5050
|
stickyHeader: props.stickyHeader,
|
|
5039
5051
|
editMode: !!c.isCellEditable,
|
|
5040
5052
|
onSortChange: handleSortChange,
|