@umami/react-zen 0.94.0 → 0.95.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/index.d.ts +1 -0
- package/dist/index.js +4 -2
- package/dist/index.mjs +4 -2
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -437,6 +437,7 @@ declare module '@umami/react-zen/DataTable' {
|
|
|
437
437
|
import { ColumnProps, TableProps } from 'react-aria-components';
|
|
438
438
|
export interface DataTableProps extends TableProps {
|
|
439
439
|
data?: any[];
|
|
440
|
+
columns?: string;
|
|
440
441
|
}
|
|
441
442
|
export function DataTable({ data, className, children, ...props }: DataTableProps): import("react").JSX.Element;
|
|
442
443
|
export interface DataColumnProps extends ColumnProps {
|
package/dist/index.js
CHANGED
|
@@ -30346,12 +30346,14 @@ var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
|
30346
30346
|
var import_react180 = require("react");
|
|
30347
30347
|
function DataTable({ data = [], className, children, ...props }) {
|
|
30348
30348
|
const items = data.length && data?.[0]?.id === void 0 ? data.map((record, id) => ({ ...record, id })) : data;
|
|
30349
|
+
const widths = [];
|
|
30349
30350
|
const columns = import_react179.Children.map(children, (child) => {
|
|
30351
|
+
widths.push(child?.props?.width || "1fr");
|
|
30350
30352
|
return { ...child.props };
|
|
30351
30353
|
});
|
|
30352
|
-
const gridTemplateColumns2 =
|
|
30354
|
+
const gridTemplateColumns2 = widths.join(" ");
|
|
30353
30355
|
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(Table2, { ...props, className: (0, import_classnames24.default)(DataTable_default.datatable, className), children: [
|
|
30354
|
-
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(TableHeader, { style: { gridTemplateColumns: gridTemplateColumns2 }, children: columns.filter((n) => n).map(({ id, label, as, hidden, ...columnProps }) => {
|
|
30356
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(TableHeader, { style: { gridTemplateColumns: gridTemplateColumns2 }, children: columns.filter((n) => n).map(({ id, label, as, hidden, width, ...columnProps }) => {
|
|
30355
30357
|
if (hidden) {
|
|
30356
30358
|
return null;
|
|
30357
30359
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -30235,12 +30235,14 @@ import { jsx as jsx33, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
|
30235
30235
|
import { createElement as createElement6 } from "react";
|
|
30236
30236
|
function DataTable({ data = [], className, children, ...props }) {
|
|
30237
30237
|
const items = data.length && data?.[0]?.id === void 0 ? data.map((record, id) => ({ ...record, id })) : data;
|
|
30238
|
+
const widths = [];
|
|
30238
30239
|
const columns = Children2.map(children, (child) => {
|
|
30240
|
+
widths.push(child?.props?.width || "1fr");
|
|
30239
30241
|
return { ...child.props };
|
|
30240
30242
|
});
|
|
30241
|
-
const gridTemplateColumns2 =
|
|
30243
|
+
const gridTemplateColumns2 = widths.join(" ");
|
|
30242
30244
|
return /* @__PURE__ */ jsxs16(Table2, { ...props, className: (0, import_classnames24.default)(DataTable_default.datatable, className), children: [
|
|
30243
|
-
/* @__PURE__ */ jsx33(TableHeader, { style: { gridTemplateColumns: gridTemplateColumns2 }, children: columns.filter((n) => n).map(({ id, label, as, hidden, ...columnProps }) => {
|
|
30245
|
+
/* @__PURE__ */ jsx33(TableHeader, { style: { gridTemplateColumns: gridTemplateColumns2 }, children: columns.filter((n) => n).map(({ id, label, as, hidden, width, ...columnProps }) => {
|
|
30244
30246
|
if (hidden) {
|
|
30245
30247
|
return null;
|
|
30246
30248
|
}
|