mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-18 11:36:36 +00:00
fix(data-table): remove "" as the default value for table cells
This commit is contained in:
parent
c36bff5921
commit
4b94fc84d0
1 changed files with 3 additions and 6 deletions
|
@ -127,14 +127,11 @@
|
|||
.map(({ key }, i) => ({ key, id: $headerItems[i] }))
|
||||
.reduce((a, c) => ({ ...a, [c.key]: c.id }), {})
|
||||
);
|
||||
const resolvePath = (object, path, defaultValue) =>
|
||||
const resolvePath = (object, path) =>
|
||||
path
|
||||
.split(/[\.\[\]\'\"]/)
|
||||
.filter((p) => p)
|
||||
.reduce(
|
||||
(o, p) => ((o && typeof o === "object") ? o[p] : defaultValue),
|
||||
object
|
||||
);
|
||||
.reduce((o, p) => (o && typeof o === "object" ? o[p] : o), object);
|
||||
|
||||
setContext("DataTable", {
|
||||
sortHeader,
|
||||
|
@ -172,7 +169,7 @@
|
|||
...row,
|
||||
cells: headerKeys.map((key, index) => ({
|
||||
key,
|
||||
value: resolvePath(row, key, ""),
|
||||
value: resolvePath(row, key),
|
||||
display: headers[index].display,
|
||||
})),
|
||||
}));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue