@almadar/ui 4.22.0 → 4.22.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/avl/index.cjs +17 -13
- package/dist/avl/index.js +17 -13
- package/dist/components/index.cjs +17 -13
- package/dist/components/index.js +17 -13
- package/dist/components/molecules/DataGrid.d.ts +9 -3
- package/dist/components/molecules/DataList.d.ts +9 -3
- package/dist/providers/index.cjs +17 -13
- package/dist/providers/index.js +17 -13
- package/dist/runtime/index.cjs +17 -13
- package/dist/runtime/index.js +17 -13
- package/package.json +1 -1
package/dist/avl/index.cjs
CHANGED
|
@@ -21941,6 +21941,7 @@ function formatValue(value, format) {
|
|
|
21941
21941
|
function DataGrid({
|
|
21942
21942
|
entity,
|
|
21943
21943
|
fields,
|
|
21944
|
+
columns,
|
|
21944
21945
|
itemActions,
|
|
21945
21946
|
cols,
|
|
21946
21947
|
gap = "md",
|
|
@@ -21962,6 +21963,7 @@ function DataGrid({
|
|
|
21962
21963
|
const { t } = useTranslate();
|
|
21963
21964
|
const [selectedIds, setSelectedIds] = React127.useState(/* @__PURE__ */ new Set());
|
|
21964
21965
|
const [visibleCount, setVisibleCount] = React127.useState(pageSize || Infinity);
|
|
21966
|
+
const fieldDefs = fields ?? columns ?? [];
|
|
21965
21967
|
const allData = Array.isArray(entity) ? entity : entity ? [entity] : [];
|
|
21966
21968
|
const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
|
|
21967
21969
|
const hasMoreLocal = pageSize > 0 && visibleCount < allData.length;
|
|
@@ -21989,9 +21991,9 @@ function DataGrid({
|
|
|
21989
21991
|
return next;
|
|
21990
21992
|
});
|
|
21991
21993
|
}, [data, selectionEvent, eventBus]);
|
|
21992
|
-
const titleField =
|
|
21993
|
-
const badgeFields =
|
|
21994
|
-
const bodyFields =
|
|
21994
|
+
const titleField = fieldDefs.find((f3) => f3.variant === "h3" || f3.variant === "h4") ?? fieldDefs[0];
|
|
21995
|
+
const badgeFields = fieldDefs.filter((f3) => f3.variant === "badge" && f3 !== titleField);
|
|
21996
|
+
const bodyFields = fieldDefs.filter((f3) => f3 !== titleField && !badgeFields.includes(f3));
|
|
21995
21997
|
const primaryActions = itemActions?.filter((a) => a.variant !== "danger") ?? [];
|
|
21996
21998
|
const dangerActions = itemActions?.filter((a) => a.variant === "danger") ?? [];
|
|
21997
21999
|
const handleActionClick = (action, itemData) => (e) => {
|
|
@@ -22004,7 +22006,7 @@ function DataGrid({
|
|
|
22004
22006
|
};
|
|
22005
22007
|
const hasRenderProp = typeof children === "function";
|
|
22006
22008
|
React127.useEffect(() => {
|
|
22007
|
-
if (data.length > 0 && !hasRenderProp &&
|
|
22009
|
+
if (data.length > 0 && !hasRenderProp && fieldDefs.length === 0) {
|
|
22008
22010
|
const renderItemRaw = schemaRenderItem;
|
|
22009
22011
|
const isFnLambda = Array.isArray(renderItemRaw) && renderItemRaw.length >= 3 && (renderItemRaw[0] === "fn" || renderItemRaw[0] === "lambda");
|
|
22010
22012
|
dataGridLog.warn("renderItem-unresolved", {
|
|
@@ -22012,7 +22014,7 @@ function DataGrid({
|
|
|
22012
22014
|
renderItemIsFnLambda: isFnLambda
|
|
22013
22015
|
});
|
|
22014
22016
|
}
|
|
22015
|
-
}, [data, hasRenderProp, schemaRenderItem,
|
|
22017
|
+
}, [data, hasRenderProp, schemaRenderItem, fieldDefs]);
|
|
22016
22018
|
const gridTemplateColumns = cols ? void 0 : `repeat(auto-fit, minmax(min(${minCardWidth}px, 100%), 1fr))`;
|
|
22017
22019
|
const colsClass = cols ? {
|
|
22018
22020
|
1: "grid-cols-1",
|
|
@@ -22317,6 +22319,7 @@ function groupData(items, field) {
|
|
|
22317
22319
|
function DataList({
|
|
22318
22320
|
entity,
|
|
22319
22321
|
fields,
|
|
22322
|
+
columns,
|
|
22320
22323
|
itemActions,
|
|
22321
22324
|
gap = "none",
|
|
22322
22325
|
variant = "default",
|
|
@@ -22346,6 +22349,7 @@ function DataList({
|
|
|
22346
22349
|
const eventBus = useEventBus();
|
|
22347
22350
|
const { t } = useTranslate();
|
|
22348
22351
|
const [visibleCount, setVisibleCount] = React127__namespace.default.useState(pageSize || Infinity);
|
|
22352
|
+
const fieldDefs = fields ?? columns ?? [];
|
|
22349
22353
|
const allData = Array.isArray(entity) ? entity : entity ? [entity] : [];
|
|
22350
22354
|
const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
|
|
22351
22355
|
const hasMoreLocal = pageSize > 0 && visibleCount < allData.length;
|
|
@@ -22360,7 +22364,7 @@ function DataList({
|
|
|
22360
22364
|
const isFnLambda = Array.isArray(renderItemRaw) && renderItemRaw.length >= 3 && (renderItemRaw[0] === "fn" || renderItemRaw[0] === "lambda");
|
|
22361
22365
|
dataListLog.warn("renderItem-unresolved", {
|
|
22362
22366
|
rowCount: data.length,
|
|
22363
|
-
fieldsCount:
|
|
22367
|
+
fieldsCount: fieldDefs.length,
|
|
22364
22368
|
renderItemTypeOf,
|
|
22365
22369
|
renderItemIsArray: Array.isArray(renderItemRaw),
|
|
22366
22370
|
renderItemIsFnLambda: isFnLambda,
|
|
@@ -22369,11 +22373,11 @@ function DataList({
|
|
|
22369
22373
|
sampleRowKeys: sampleKeys
|
|
22370
22374
|
});
|
|
22371
22375
|
}
|
|
22372
|
-
}, [data, hasRenderProp, schemaRenderItem, children,
|
|
22373
|
-
const titleField =
|
|
22374
|
-
const badgeFields =
|
|
22375
|
-
const progressFields =
|
|
22376
|
-
const bodyFields =
|
|
22376
|
+
}, [data, hasRenderProp, schemaRenderItem, children, fieldDefs]);
|
|
22377
|
+
const titleField = fieldDefs.find((f3) => f3.variant === "h3" || f3.variant === "h4") ?? fieldDefs[0];
|
|
22378
|
+
const badgeFields = fieldDefs.filter((f3) => f3.variant === "badge" && f3 !== titleField);
|
|
22379
|
+
const progressFields = fieldDefs.filter((f3) => f3.variant === "progress");
|
|
22380
|
+
const bodyFields = fieldDefs.filter(
|
|
22377
22381
|
(f3) => f3 !== titleField && !badgeFields.includes(f3) && !progressFields.includes(f3)
|
|
22378
22382
|
);
|
|
22379
22383
|
const handleActionClick = (action, itemData) => (e) => {
|
|
@@ -22405,7 +22409,7 @@ function DataList({
|
|
|
22405
22409
|
if (isMessage) {
|
|
22406
22410
|
const items2 = data.map((item) => item);
|
|
22407
22411
|
const groups2 = groupBy ? groupData(items2, groupBy) : [{ label: "", items: items2 }];
|
|
22408
|
-
const contentField = titleField?.name ??
|
|
22412
|
+
const contentField = titleField?.name ?? fieldDefs[0]?.name ?? "";
|
|
22409
22413
|
return /* @__PURE__ */ jsxRuntime.jsx(VStack, { gap: "sm", className: cn("py-2", className), children: groups2.map((group, gi) => /* @__PURE__ */ jsxRuntime.jsxs(React127__namespace.default.Fragment, { children: [
|
|
22410
22414
|
group.label && /* @__PURE__ */ jsxRuntime.jsx(Divider, { label: group.label, className: "my-2" }),
|
|
22411
22415
|
group.items.map((itemData, index) => {
|
|
@@ -22413,7 +22417,7 @@ function DataList({
|
|
|
22413
22417
|
const sender = senderField ? String(getNestedValue(itemData, senderField) ?? "") : "";
|
|
22414
22418
|
const isSent = Boolean(currentUser && sender === currentUser);
|
|
22415
22419
|
const content = getNestedValue(itemData, contentField);
|
|
22416
|
-
const timestampField =
|
|
22420
|
+
const timestampField = fieldDefs.find((f3) => f3.format === "date");
|
|
22417
22421
|
const timestamp = timestampField ? getNestedValue(itemData, timestampField.name) : null;
|
|
22418
22422
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
22419
22423
|
Box,
|
package/dist/avl/index.js
CHANGED
|
@@ -21895,6 +21895,7 @@ function formatValue(value, format) {
|
|
|
21895
21895
|
function DataGrid({
|
|
21896
21896
|
entity,
|
|
21897
21897
|
fields,
|
|
21898
|
+
columns,
|
|
21898
21899
|
itemActions,
|
|
21899
21900
|
cols,
|
|
21900
21901
|
gap = "md",
|
|
@@ -21916,6 +21917,7 @@ function DataGrid({
|
|
|
21916
21917
|
const { t } = useTranslate();
|
|
21917
21918
|
const [selectedIds, setSelectedIds] = useState(/* @__PURE__ */ new Set());
|
|
21918
21919
|
const [visibleCount, setVisibleCount] = useState(pageSize || Infinity);
|
|
21920
|
+
const fieldDefs = fields ?? columns ?? [];
|
|
21919
21921
|
const allData = Array.isArray(entity) ? entity : entity ? [entity] : [];
|
|
21920
21922
|
const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
|
|
21921
21923
|
const hasMoreLocal = pageSize > 0 && visibleCount < allData.length;
|
|
@@ -21943,9 +21945,9 @@ function DataGrid({
|
|
|
21943
21945
|
return next;
|
|
21944
21946
|
});
|
|
21945
21947
|
}, [data, selectionEvent, eventBus]);
|
|
21946
|
-
const titleField =
|
|
21947
|
-
const badgeFields =
|
|
21948
|
-
const bodyFields =
|
|
21948
|
+
const titleField = fieldDefs.find((f3) => f3.variant === "h3" || f3.variant === "h4") ?? fieldDefs[0];
|
|
21949
|
+
const badgeFields = fieldDefs.filter((f3) => f3.variant === "badge" && f3 !== titleField);
|
|
21950
|
+
const bodyFields = fieldDefs.filter((f3) => f3 !== titleField && !badgeFields.includes(f3));
|
|
21949
21951
|
const primaryActions = itemActions?.filter((a) => a.variant !== "danger") ?? [];
|
|
21950
21952
|
const dangerActions = itemActions?.filter((a) => a.variant === "danger") ?? [];
|
|
21951
21953
|
const handleActionClick = (action, itemData) => (e) => {
|
|
@@ -21958,7 +21960,7 @@ function DataGrid({
|
|
|
21958
21960
|
};
|
|
21959
21961
|
const hasRenderProp = typeof children === "function";
|
|
21960
21962
|
useEffect(() => {
|
|
21961
|
-
if (data.length > 0 && !hasRenderProp &&
|
|
21963
|
+
if (data.length > 0 && !hasRenderProp && fieldDefs.length === 0) {
|
|
21962
21964
|
const renderItemRaw = schemaRenderItem;
|
|
21963
21965
|
const isFnLambda = Array.isArray(renderItemRaw) && renderItemRaw.length >= 3 && (renderItemRaw[0] === "fn" || renderItemRaw[0] === "lambda");
|
|
21964
21966
|
dataGridLog.warn("renderItem-unresolved", {
|
|
@@ -21966,7 +21968,7 @@ function DataGrid({
|
|
|
21966
21968
|
renderItemIsFnLambda: isFnLambda
|
|
21967
21969
|
});
|
|
21968
21970
|
}
|
|
21969
|
-
}, [data, hasRenderProp, schemaRenderItem,
|
|
21971
|
+
}, [data, hasRenderProp, schemaRenderItem, fieldDefs]);
|
|
21970
21972
|
const gridTemplateColumns = cols ? void 0 : `repeat(auto-fit, minmax(min(${minCardWidth}px, 100%), 1fr))`;
|
|
21971
21973
|
const colsClass = cols ? {
|
|
21972
21974
|
1: "grid-cols-1",
|
|
@@ -22271,6 +22273,7 @@ function groupData(items, field) {
|
|
|
22271
22273
|
function DataList({
|
|
22272
22274
|
entity,
|
|
22273
22275
|
fields,
|
|
22276
|
+
columns,
|
|
22274
22277
|
itemActions,
|
|
22275
22278
|
gap = "none",
|
|
22276
22279
|
variant = "default",
|
|
@@ -22300,6 +22303,7 @@ function DataList({
|
|
|
22300
22303
|
const eventBus = useEventBus();
|
|
22301
22304
|
const { t } = useTranslate();
|
|
22302
22305
|
const [visibleCount, setVisibleCount] = React127__default.useState(pageSize || Infinity);
|
|
22306
|
+
const fieldDefs = fields ?? columns ?? [];
|
|
22303
22307
|
const allData = Array.isArray(entity) ? entity : entity ? [entity] : [];
|
|
22304
22308
|
const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
|
|
22305
22309
|
const hasMoreLocal = pageSize > 0 && visibleCount < allData.length;
|
|
@@ -22314,7 +22318,7 @@ function DataList({
|
|
|
22314
22318
|
const isFnLambda = Array.isArray(renderItemRaw) && renderItemRaw.length >= 3 && (renderItemRaw[0] === "fn" || renderItemRaw[0] === "lambda");
|
|
22315
22319
|
dataListLog.warn("renderItem-unresolved", {
|
|
22316
22320
|
rowCount: data.length,
|
|
22317
|
-
fieldsCount:
|
|
22321
|
+
fieldsCount: fieldDefs.length,
|
|
22318
22322
|
renderItemTypeOf,
|
|
22319
22323
|
renderItemIsArray: Array.isArray(renderItemRaw),
|
|
22320
22324
|
renderItemIsFnLambda: isFnLambda,
|
|
@@ -22323,11 +22327,11 @@ function DataList({
|
|
|
22323
22327
|
sampleRowKeys: sampleKeys
|
|
22324
22328
|
});
|
|
22325
22329
|
}
|
|
22326
|
-
}, [data, hasRenderProp, schemaRenderItem, children,
|
|
22327
|
-
const titleField =
|
|
22328
|
-
const badgeFields =
|
|
22329
|
-
const progressFields =
|
|
22330
|
-
const bodyFields =
|
|
22330
|
+
}, [data, hasRenderProp, schemaRenderItem, children, fieldDefs]);
|
|
22331
|
+
const titleField = fieldDefs.find((f3) => f3.variant === "h3" || f3.variant === "h4") ?? fieldDefs[0];
|
|
22332
|
+
const badgeFields = fieldDefs.filter((f3) => f3.variant === "badge" && f3 !== titleField);
|
|
22333
|
+
const progressFields = fieldDefs.filter((f3) => f3.variant === "progress");
|
|
22334
|
+
const bodyFields = fieldDefs.filter(
|
|
22331
22335
|
(f3) => f3 !== titleField && !badgeFields.includes(f3) && !progressFields.includes(f3)
|
|
22332
22336
|
);
|
|
22333
22337
|
const handleActionClick = (action, itemData) => (e) => {
|
|
@@ -22359,7 +22363,7 @@ function DataList({
|
|
|
22359
22363
|
if (isMessage) {
|
|
22360
22364
|
const items2 = data.map((item) => item);
|
|
22361
22365
|
const groups2 = groupBy ? groupData(items2, groupBy) : [{ label: "", items: items2 }];
|
|
22362
|
-
const contentField = titleField?.name ??
|
|
22366
|
+
const contentField = titleField?.name ?? fieldDefs[0]?.name ?? "";
|
|
22363
22367
|
return /* @__PURE__ */ jsx(VStack, { gap: "sm", className: cn("py-2", className), children: groups2.map((group, gi) => /* @__PURE__ */ jsxs(React127__default.Fragment, { children: [
|
|
22364
22368
|
group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: "my-2" }),
|
|
22365
22369
|
group.items.map((itemData, index) => {
|
|
@@ -22367,7 +22371,7 @@ function DataList({
|
|
|
22367
22371
|
const sender = senderField ? String(getNestedValue(itemData, senderField) ?? "") : "";
|
|
22368
22372
|
const isSent = Boolean(currentUser && sender === currentUser);
|
|
22369
22373
|
const content = getNestedValue(itemData, contentField);
|
|
22370
|
-
const timestampField =
|
|
22374
|
+
const timestampField = fieldDefs.find((f3) => f3.format === "date");
|
|
22371
22375
|
const timestamp = timestampField ? getNestedValue(itemData, timestampField.name) : null;
|
|
22372
22376
|
return /* @__PURE__ */ jsx(
|
|
22373
22377
|
Box,
|
|
@@ -17369,6 +17369,7 @@ function formatValue(value, format) {
|
|
|
17369
17369
|
function DataGrid({
|
|
17370
17370
|
entity,
|
|
17371
17371
|
fields,
|
|
17372
|
+
columns,
|
|
17372
17373
|
itemActions,
|
|
17373
17374
|
cols,
|
|
17374
17375
|
gap = "md",
|
|
@@ -17390,6 +17391,7 @@ function DataGrid({
|
|
|
17390
17391
|
const { t } = useTranslate();
|
|
17391
17392
|
const [selectedIds, setSelectedIds] = React110.useState(/* @__PURE__ */ new Set());
|
|
17392
17393
|
const [visibleCount, setVisibleCount] = React110.useState(pageSize || Infinity);
|
|
17394
|
+
const fieldDefs = fields ?? columns ?? [];
|
|
17393
17395
|
const allData = Array.isArray(entity) ? entity : entity ? [entity] : [];
|
|
17394
17396
|
const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
|
|
17395
17397
|
const hasMoreLocal = pageSize > 0 && visibleCount < allData.length;
|
|
@@ -17417,9 +17419,9 @@ function DataGrid({
|
|
|
17417
17419
|
return next;
|
|
17418
17420
|
});
|
|
17419
17421
|
}, [data, selectionEvent, eventBus]);
|
|
17420
|
-
const titleField =
|
|
17421
|
-
const badgeFields =
|
|
17422
|
-
const bodyFields =
|
|
17422
|
+
const titleField = fieldDefs.find((f3) => f3.variant === "h3" || f3.variant === "h4") ?? fieldDefs[0];
|
|
17423
|
+
const badgeFields = fieldDefs.filter((f3) => f3.variant === "badge" && f3 !== titleField);
|
|
17424
|
+
const bodyFields = fieldDefs.filter((f3) => f3 !== titleField && !badgeFields.includes(f3));
|
|
17423
17425
|
const primaryActions = itemActions?.filter((a) => a.variant !== "danger") ?? [];
|
|
17424
17426
|
const dangerActions = itemActions?.filter((a) => a.variant === "danger") ?? [];
|
|
17425
17427
|
const handleActionClick = (action, itemData) => (e) => {
|
|
@@ -17432,7 +17434,7 @@ function DataGrid({
|
|
|
17432
17434
|
};
|
|
17433
17435
|
const hasRenderProp = typeof children === "function";
|
|
17434
17436
|
React110.useEffect(() => {
|
|
17435
|
-
if (data.length > 0 && !hasRenderProp &&
|
|
17437
|
+
if (data.length > 0 && !hasRenderProp && fieldDefs.length === 0) {
|
|
17436
17438
|
const renderItemRaw = schemaRenderItem;
|
|
17437
17439
|
const isFnLambda = Array.isArray(renderItemRaw) && renderItemRaw.length >= 3 && (renderItemRaw[0] === "fn" || renderItemRaw[0] === "lambda");
|
|
17438
17440
|
dataGridLog.warn("renderItem-unresolved", {
|
|
@@ -17440,7 +17442,7 @@ function DataGrid({
|
|
|
17440
17442
|
renderItemIsFnLambda: isFnLambda
|
|
17441
17443
|
});
|
|
17442
17444
|
}
|
|
17443
|
-
}, [data, hasRenderProp, schemaRenderItem,
|
|
17445
|
+
}, [data, hasRenderProp, schemaRenderItem, fieldDefs]);
|
|
17444
17446
|
const gridTemplateColumns = cols ? void 0 : `repeat(auto-fit, minmax(min(${minCardWidth}px, 100%), 1fr))`;
|
|
17445
17447
|
const colsClass = cols ? {
|
|
17446
17448
|
1: "grid-cols-1",
|
|
@@ -17745,6 +17747,7 @@ function groupData(items, field) {
|
|
|
17745
17747
|
function DataList({
|
|
17746
17748
|
entity,
|
|
17747
17749
|
fields,
|
|
17750
|
+
columns,
|
|
17748
17751
|
itemActions,
|
|
17749
17752
|
gap = "none",
|
|
17750
17753
|
variant = "default",
|
|
@@ -17774,6 +17777,7 @@ function DataList({
|
|
|
17774
17777
|
const eventBus = useEventBus();
|
|
17775
17778
|
const { t } = useTranslate();
|
|
17776
17779
|
const [visibleCount, setVisibleCount] = React110__namespace.default.useState(pageSize || Infinity);
|
|
17780
|
+
const fieldDefs = fields ?? columns ?? [];
|
|
17777
17781
|
const allData = Array.isArray(entity) ? entity : entity ? [entity] : [];
|
|
17778
17782
|
const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
|
|
17779
17783
|
const hasMoreLocal = pageSize > 0 && visibleCount < allData.length;
|
|
@@ -17788,7 +17792,7 @@ function DataList({
|
|
|
17788
17792
|
const isFnLambda = Array.isArray(renderItemRaw) && renderItemRaw.length >= 3 && (renderItemRaw[0] === "fn" || renderItemRaw[0] === "lambda");
|
|
17789
17793
|
dataListLog.warn("renderItem-unresolved", {
|
|
17790
17794
|
rowCount: data.length,
|
|
17791
|
-
fieldsCount:
|
|
17795
|
+
fieldsCount: fieldDefs.length,
|
|
17792
17796
|
renderItemTypeOf,
|
|
17793
17797
|
renderItemIsArray: Array.isArray(renderItemRaw),
|
|
17794
17798
|
renderItemIsFnLambda: isFnLambda,
|
|
@@ -17797,11 +17801,11 @@ function DataList({
|
|
|
17797
17801
|
sampleRowKeys: sampleKeys
|
|
17798
17802
|
});
|
|
17799
17803
|
}
|
|
17800
|
-
}, [data, hasRenderProp, schemaRenderItem, children,
|
|
17801
|
-
const titleField =
|
|
17802
|
-
const badgeFields =
|
|
17803
|
-
const progressFields =
|
|
17804
|
-
const bodyFields =
|
|
17804
|
+
}, [data, hasRenderProp, schemaRenderItem, children, fieldDefs]);
|
|
17805
|
+
const titleField = fieldDefs.find((f3) => f3.variant === "h3" || f3.variant === "h4") ?? fieldDefs[0];
|
|
17806
|
+
const badgeFields = fieldDefs.filter((f3) => f3.variant === "badge" && f3 !== titleField);
|
|
17807
|
+
const progressFields = fieldDefs.filter((f3) => f3.variant === "progress");
|
|
17808
|
+
const bodyFields = fieldDefs.filter(
|
|
17805
17809
|
(f3) => f3 !== titleField && !badgeFields.includes(f3) && !progressFields.includes(f3)
|
|
17806
17810
|
);
|
|
17807
17811
|
const handleActionClick = (action, itemData) => (e) => {
|
|
@@ -17833,7 +17837,7 @@ function DataList({
|
|
|
17833
17837
|
if (isMessage) {
|
|
17834
17838
|
const items2 = data.map((item) => item);
|
|
17835
17839
|
const groups2 = groupBy ? groupData(items2, groupBy) : [{ label: "", items: items2 }];
|
|
17836
|
-
const contentField = titleField?.name ??
|
|
17840
|
+
const contentField = titleField?.name ?? fieldDefs[0]?.name ?? "";
|
|
17837
17841
|
return /* @__PURE__ */ jsxRuntime.jsx(exports.VStack, { gap: "sm", className: cn("py-2", className), children: groups2.map((group, gi) => /* @__PURE__ */ jsxRuntime.jsxs(React110__namespace.default.Fragment, { children: [
|
|
17838
17842
|
group.label && /* @__PURE__ */ jsxRuntime.jsx(exports.Divider, { label: group.label, className: "my-2" }),
|
|
17839
17843
|
group.items.map((itemData, index) => {
|
|
@@ -17841,7 +17845,7 @@ function DataList({
|
|
|
17841
17845
|
const sender = senderField ? String(getNestedValue(itemData, senderField) ?? "") : "";
|
|
17842
17846
|
const isSent = Boolean(currentUser && sender === currentUser);
|
|
17843
17847
|
const content = getNestedValue(itemData, contentField);
|
|
17844
|
-
const timestampField =
|
|
17848
|
+
const timestampField = fieldDefs.find((f3) => f3.format === "date");
|
|
17845
17849
|
const timestamp = timestampField ? getNestedValue(itemData, timestampField.name) : null;
|
|
17846
17850
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
17847
17851
|
exports.Box,
|
package/dist/components/index.js
CHANGED
|
@@ -17324,6 +17324,7 @@ function formatValue(value, format) {
|
|
|
17324
17324
|
function DataGrid({
|
|
17325
17325
|
entity,
|
|
17326
17326
|
fields,
|
|
17327
|
+
columns,
|
|
17327
17328
|
itemActions,
|
|
17328
17329
|
cols,
|
|
17329
17330
|
gap = "md",
|
|
@@ -17345,6 +17346,7 @@ function DataGrid({
|
|
|
17345
17346
|
const { t } = useTranslate();
|
|
17346
17347
|
const [selectedIds, setSelectedIds] = useState(/* @__PURE__ */ new Set());
|
|
17347
17348
|
const [visibleCount, setVisibleCount] = useState(pageSize || Infinity);
|
|
17349
|
+
const fieldDefs = fields ?? columns ?? [];
|
|
17348
17350
|
const allData = Array.isArray(entity) ? entity : entity ? [entity] : [];
|
|
17349
17351
|
const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
|
|
17350
17352
|
const hasMoreLocal = pageSize > 0 && visibleCount < allData.length;
|
|
@@ -17372,9 +17374,9 @@ function DataGrid({
|
|
|
17372
17374
|
return next;
|
|
17373
17375
|
});
|
|
17374
17376
|
}, [data, selectionEvent, eventBus]);
|
|
17375
|
-
const titleField =
|
|
17376
|
-
const badgeFields =
|
|
17377
|
-
const bodyFields =
|
|
17377
|
+
const titleField = fieldDefs.find((f3) => f3.variant === "h3" || f3.variant === "h4") ?? fieldDefs[0];
|
|
17378
|
+
const badgeFields = fieldDefs.filter((f3) => f3.variant === "badge" && f3 !== titleField);
|
|
17379
|
+
const bodyFields = fieldDefs.filter((f3) => f3 !== titleField && !badgeFields.includes(f3));
|
|
17378
17380
|
const primaryActions = itemActions?.filter((a) => a.variant !== "danger") ?? [];
|
|
17379
17381
|
const dangerActions = itemActions?.filter((a) => a.variant === "danger") ?? [];
|
|
17380
17382
|
const handleActionClick = (action, itemData) => (e) => {
|
|
@@ -17387,7 +17389,7 @@ function DataGrid({
|
|
|
17387
17389
|
};
|
|
17388
17390
|
const hasRenderProp = typeof children === "function";
|
|
17389
17391
|
useEffect(() => {
|
|
17390
|
-
if (data.length > 0 && !hasRenderProp &&
|
|
17392
|
+
if (data.length > 0 && !hasRenderProp && fieldDefs.length === 0) {
|
|
17391
17393
|
const renderItemRaw = schemaRenderItem;
|
|
17392
17394
|
const isFnLambda = Array.isArray(renderItemRaw) && renderItemRaw.length >= 3 && (renderItemRaw[0] === "fn" || renderItemRaw[0] === "lambda");
|
|
17393
17395
|
dataGridLog.warn("renderItem-unresolved", {
|
|
@@ -17395,7 +17397,7 @@ function DataGrid({
|
|
|
17395
17397
|
renderItemIsFnLambda: isFnLambda
|
|
17396
17398
|
});
|
|
17397
17399
|
}
|
|
17398
|
-
}, [data, hasRenderProp, schemaRenderItem,
|
|
17400
|
+
}, [data, hasRenderProp, schemaRenderItem, fieldDefs]);
|
|
17399
17401
|
const gridTemplateColumns = cols ? void 0 : `repeat(auto-fit, minmax(min(${minCardWidth}px, 100%), 1fr))`;
|
|
17400
17402
|
const colsClass = cols ? {
|
|
17401
17403
|
1: "grid-cols-1",
|
|
@@ -17700,6 +17702,7 @@ function groupData(items, field) {
|
|
|
17700
17702
|
function DataList({
|
|
17701
17703
|
entity,
|
|
17702
17704
|
fields,
|
|
17705
|
+
columns,
|
|
17703
17706
|
itemActions,
|
|
17704
17707
|
gap = "none",
|
|
17705
17708
|
variant = "default",
|
|
@@ -17729,6 +17732,7 @@ function DataList({
|
|
|
17729
17732
|
const eventBus = useEventBus();
|
|
17730
17733
|
const { t } = useTranslate();
|
|
17731
17734
|
const [visibleCount, setVisibleCount] = React110__default.useState(pageSize || Infinity);
|
|
17735
|
+
const fieldDefs = fields ?? columns ?? [];
|
|
17732
17736
|
const allData = Array.isArray(entity) ? entity : entity ? [entity] : [];
|
|
17733
17737
|
const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
|
|
17734
17738
|
const hasMoreLocal = pageSize > 0 && visibleCount < allData.length;
|
|
@@ -17743,7 +17747,7 @@ function DataList({
|
|
|
17743
17747
|
const isFnLambda = Array.isArray(renderItemRaw) && renderItemRaw.length >= 3 && (renderItemRaw[0] === "fn" || renderItemRaw[0] === "lambda");
|
|
17744
17748
|
dataListLog.warn("renderItem-unresolved", {
|
|
17745
17749
|
rowCount: data.length,
|
|
17746
|
-
fieldsCount:
|
|
17750
|
+
fieldsCount: fieldDefs.length,
|
|
17747
17751
|
renderItemTypeOf,
|
|
17748
17752
|
renderItemIsArray: Array.isArray(renderItemRaw),
|
|
17749
17753
|
renderItemIsFnLambda: isFnLambda,
|
|
@@ -17752,11 +17756,11 @@ function DataList({
|
|
|
17752
17756
|
sampleRowKeys: sampleKeys
|
|
17753
17757
|
});
|
|
17754
17758
|
}
|
|
17755
|
-
}, [data, hasRenderProp, schemaRenderItem, children,
|
|
17756
|
-
const titleField =
|
|
17757
|
-
const badgeFields =
|
|
17758
|
-
const progressFields =
|
|
17759
|
-
const bodyFields =
|
|
17759
|
+
}, [data, hasRenderProp, schemaRenderItem, children, fieldDefs]);
|
|
17760
|
+
const titleField = fieldDefs.find((f3) => f3.variant === "h3" || f3.variant === "h4") ?? fieldDefs[0];
|
|
17761
|
+
const badgeFields = fieldDefs.filter((f3) => f3.variant === "badge" && f3 !== titleField);
|
|
17762
|
+
const progressFields = fieldDefs.filter((f3) => f3.variant === "progress");
|
|
17763
|
+
const bodyFields = fieldDefs.filter(
|
|
17760
17764
|
(f3) => f3 !== titleField && !badgeFields.includes(f3) && !progressFields.includes(f3)
|
|
17761
17765
|
);
|
|
17762
17766
|
const handleActionClick = (action, itemData) => (e) => {
|
|
@@ -17788,7 +17792,7 @@ function DataList({
|
|
|
17788
17792
|
if (isMessage) {
|
|
17789
17793
|
const items2 = data.map((item) => item);
|
|
17790
17794
|
const groups2 = groupBy ? groupData(items2, groupBy) : [{ label: "", items: items2 }];
|
|
17791
|
-
const contentField = titleField?.name ??
|
|
17795
|
+
const contentField = titleField?.name ?? fieldDefs[0]?.name ?? "";
|
|
17792
17796
|
return /* @__PURE__ */ jsx(VStack, { gap: "sm", className: cn("py-2", className), children: groups2.map((group, gi) => /* @__PURE__ */ jsxs(React110__default.Fragment, { children: [
|
|
17793
17797
|
group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: "my-2" }),
|
|
17794
17798
|
group.items.map((itemData, index) => {
|
|
@@ -17796,7 +17800,7 @@ function DataList({
|
|
|
17796
17800
|
const sender = senderField ? String(getNestedValue(itemData, senderField) ?? "") : "";
|
|
17797
17801
|
const isSent = Boolean(currentUser && sender === currentUser);
|
|
17798
17802
|
const content = getNestedValue(itemData, contentField);
|
|
17799
|
-
const timestampField =
|
|
17803
|
+
const timestampField = fieldDefs.find((f3) => f3.format === "date");
|
|
17800
17804
|
const timestamp = timestampField ? getNestedValue(itemData, timestampField.name) : null;
|
|
17801
17805
|
return /* @__PURE__ */ jsx(
|
|
17802
17806
|
Box,
|
|
@@ -55,8 +55,14 @@ export interface DataGridProps<T extends EntityRow = EntityRow> {
|
|
|
55
55
|
* receive cards typed to that exact shape.
|
|
56
56
|
*/
|
|
57
57
|
entity: T | readonly T[];
|
|
58
|
-
/**
|
|
59
|
-
|
|
58
|
+
/**
|
|
59
|
+
* Field definitions for rendering each card. The pattern contract in
|
|
60
|
+
* `@almadar/patterns` documents `columns` as the wire-format alias the
|
|
61
|
+
* compiler emits — both names resolve to the same shape here. Pass either.
|
|
62
|
+
*/
|
|
63
|
+
fields?: readonly DataGridField[];
|
|
64
|
+
/** Alias for `fields` — the compiler emits `columns` for field defs. */
|
|
65
|
+
columns?: readonly DataGridField[];
|
|
60
66
|
/** Per-item action buttons */
|
|
61
67
|
itemActions?: readonly DataGridItemAction[];
|
|
62
68
|
/** Number of columns (uses auto-fit if omitted) */
|
|
@@ -96,7 +102,7 @@ export interface DataGridProps<T extends EntityRow = EntityRow> {
|
|
|
96
102
|
/** Max items to show before "Show More" button. Defaults to 0 (disabled). */
|
|
97
103
|
pageSize?: number;
|
|
98
104
|
}
|
|
99
|
-
export declare function DataGrid<T extends EntityRow = EntityRow>({ entity, fields, itemActions, cols, gap, minCardWidth, className, isLoading, error, imageField, selectable, selectionEvent, infiniteScroll, loadMoreEvent, hasMore, children, pageSize, renderItem: schemaRenderItem, }: DataGridProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
105
|
+
export declare function DataGrid<T extends EntityRow = EntityRow>({ entity, fields, columns, itemActions, cols, gap, minCardWidth, className, isLoading, error, imageField, selectable, selectionEvent, infiniteScroll, loadMoreEvent, hasMore, children, pageSize, renderItem: schemaRenderItem, }: DataGridProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
100
106
|
export declare namespace DataGrid {
|
|
101
107
|
var displayName: string;
|
|
102
108
|
}
|
|
@@ -45,8 +45,14 @@ export interface DataListProps<T extends EntityRow = EntityRow> {
|
|
|
45
45
|
* receive items of that exact shape.
|
|
46
46
|
*/
|
|
47
47
|
entity: T | readonly T[];
|
|
48
|
-
/**
|
|
49
|
-
|
|
48
|
+
/**
|
|
49
|
+
* Field definitions for rendering each row. The pattern contract in
|
|
50
|
+
* `@almadar/patterns` documents `columns` as the wire-format alias the
|
|
51
|
+
* compiler emits — both names resolve to the same shape here. Pass either.
|
|
52
|
+
*/
|
|
53
|
+
fields?: readonly DataListField[];
|
|
54
|
+
/** Alias for `fields` — the compiler emits `columns` for field defs. */
|
|
55
|
+
columns?: readonly DataListField[];
|
|
50
56
|
/** Per-item action buttons */
|
|
51
57
|
itemActions?: readonly DataListItemAction[];
|
|
52
58
|
/** Gap between rows */
|
|
@@ -110,7 +116,7 @@ export interface DataListProps<T extends EntityRow = EntityRow> {
|
|
|
110
116
|
/** Max items to show before "Show More" button. Defaults to 5. Set to 0 to disable. */
|
|
111
117
|
pageSize?: number;
|
|
112
118
|
}
|
|
113
|
-
export declare function DataList<T extends EntityRow = EntityRow>({ entity, fields, itemActions, gap, variant, groupBy, senderField, currentUser, className, isLoading, error, reorderable: _reorderable, reorderEvent: _reorderEvent, swipeLeftEvent: _swipeLeftEvent, swipeLeftActions: _swipeLeftActions, swipeRightEvent: _swipeRightEvent, swipeRightActions: _swipeRightActions, longPressEvent: _longPressEvent, infiniteScroll, loadMoreEvent, hasMore, children, pageSize, renderItem: schemaRenderItem, }: DataListProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
119
|
+
export declare function DataList<T extends EntityRow = EntityRow>({ entity, fields, columns, itemActions, gap, variant, groupBy, senderField, currentUser, className, isLoading, error, reorderable: _reorderable, reorderEvent: _reorderEvent, swipeLeftEvent: _swipeLeftEvent, swipeLeftActions: _swipeLeftActions, swipeRightEvent: _swipeRightEvent, swipeRightActions: _swipeRightActions, longPressEvent: _longPressEvent, infiniteScroll, loadMoreEvent, hasMore, children, pageSize, renderItem: schemaRenderItem, }: DataListProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
114
120
|
export declare namespace DataList {
|
|
115
121
|
var displayName: string;
|
|
116
122
|
}
|
package/dist/providers/index.cjs
CHANGED
|
@@ -18692,6 +18692,7 @@ function formatValue(value, format) {
|
|
|
18692
18692
|
function DataGrid({
|
|
18693
18693
|
entity,
|
|
18694
18694
|
fields,
|
|
18695
|
+
columns,
|
|
18695
18696
|
itemActions,
|
|
18696
18697
|
cols,
|
|
18697
18698
|
gap = "md",
|
|
@@ -18713,6 +18714,7 @@ function DataGrid({
|
|
|
18713
18714
|
const { t } = useTranslate();
|
|
18714
18715
|
const [selectedIds, setSelectedIds] = React115.useState(/* @__PURE__ */ new Set());
|
|
18715
18716
|
const [visibleCount, setVisibleCount] = React115.useState(pageSize || Infinity);
|
|
18717
|
+
const fieldDefs = fields ?? columns ?? [];
|
|
18716
18718
|
const allData = Array.isArray(entity) ? entity : entity ? [entity] : [];
|
|
18717
18719
|
const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
|
|
18718
18720
|
const hasMoreLocal = pageSize > 0 && visibleCount < allData.length;
|
|
@@ -18740,9 +18742,9 @@ function DataGrid({
|
|
|
18740
18742
|
return next;
|
|
18741
18743
|
});
|
|
18742
18744
|
}, [data, selectionEvent, eventBus]);
|
|
18743
|
-
const titleField =
|
|
18744
|
-
const badgeFields =
|
|
18745
|
-
const bodyFields =
|
|
18745
|
+
const titleField = fieldDefs.find((f3) => f3.variant === "h3" || f3.variant === "h4") ?? fieldDefs[0];
|
|
18746
|
+
const badgeFields = fieldDefs.filter((f3) => f3.variant === "badge" && f3 !== titleField);
|
|
18747
|
+
const bodyFields = fieldDefs.filter((f3) => f3 !== titleField && !badgeFields.includes(f3));
|
|
18746
18748
|
const primaryActions = itemActions?.filter((a) => a.variant !== "danger") ?? [];
|
|
18747
18749
|
const dangerActions = itemActions?.filter((a) => a.variant === "danger") ?? [];
|
|
18748
18750
|
const handleActionClick = (action, itemData) => (e) => {
|
|
@@ -18755,7 +18757,7 @@ function DataGrid({
|
|
|
18755
18757
|
};
|
|
18756
18758
|
const hasRenderProp = typeof children === "function";
|
|
18757
18759
|
React115.useEffect(() => {
|
|
18758
|
-
if (data.length > 0 && !hasRenderProp &&
|
|
18760
|
+
if (data.length > 0 && !hasRenderProp && fieldDefs.length === 0) {
|
|
18759
18761
|
const renderItemRaw = schemaRenderItem;
|
|
18760
18762
|
const isFnLambda = Array.isArray(renderItemRaw) && renderItemRaw.length >= 3 && (renderItemRaw[0] === "fn" || renderItemRaw[0] === "lambda");
|
|
18761
18763
|
dataGridLog.warn("renderItem-unresolved", {
|
|
@@ -18763,7 +18765,7 @@ function DataGrid({
|
|
|
18763
18765
|
renderItemIsFnLambda: isFnLambda
|
|
18764
18766
|
});
|
|
18765
18767
|
}
|
|
18766
|
-
}, [data, hasRenderProp, schemaRenderItem,
|
|
18768
|
+
}, [data, hasRenderProp, schemaRenderItem, fieldDefs]);
|
|
18767
18769
|
const gridTemplateColumns = cols ? void 0 : `repeat(auto-fit, minmax(min(${minCardWidth}px, 100%), 1fr))`;
|
|
18768
18770
|
const colsClass = cols ? {
|
|
18769
18771
|
1: "grid-cols-1",
|
|
@@ -19068,6 +19070,7 @@ function groupData(items, field) {
|
|
|
19068
19070
|
function DataList({
|
|
19069
19071
|
entity,
|
|
19070
19072
|
fields,
|
|
19073
|
+
columns,
|
|
19071
19074
|
itemActions,
|
|
19072
19075
|
gap = "none",
|
|
19073
19076
|
variant = "default",
|
|
@@ -19097,6 +19100,7 @@ function DataList({
|
|
|
19097
19100
|
const eventBus = useEventBus();
|
|
19098
19101
|
const { t } = useTranslate();
|
|
19099
19102
|
const [visibleCount, setVisibleCount] = React115__namespace.default.useState(pageSize || Infinity);
|
|
19103
|
+
const fieldDefs = fields ?? columns ?? [];
|
|
19100
19104
|
const allData = Array.isArray(entity) ? entity : entity ? [entity] : [];
|
|
19101
19105
|
const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
|
|
19102
19106
|
const hasMoreLocal = pageSize > 0 && visibleCount < allData.length;
|
|
@@ -19111,7 +19115,7 @@ function DataList({
|
|
|
19111
19115
|
const isFnLambda = Array.isArray(renderItemRaw) && renderItemRaw.length >= 3 && (renderItemRaw[0] === "fn" || renderItemRaw[0] === "lambda");
|
|
19112
19116
|
dataListLog.warn("renderItem-unresolved", {
|
|
19113
19117
|
rowCount: data.length,
|
|
19114
|
-
fieldsCount:
|
|
19118
|
+
fieldsCount: fieldDefs.length,
|
|
19115
19119
|
renderItemTypeOf,
|
|
19116
19120
|
renderItemIsArray: Array.isArray(renderItemRaw),
|
|
19117
19121
|
renderItemIsFnLambda: isFnLambda,
|
|
@@ -19120,11 +19124,11 @@ function DataList({
|
|
|
19120
19124
|
sampleRowKeys: sampleKeys
|
|
19121
19125
|
});
|
|
19122
19126
|
}
|
|
19123
|
-
}, [data, hasRenderProp, schemaRenderItem, children,
|
|
19124
|
-
const titleField =
|
|
19125
|
-
const badgeFields =
|
|
19126
|
-
const progressFields =
|
|
19127
|
-
const bodyFields =
|
|
19127
|
+
}, [data, hasRenderProp, schemaRenderItem, children, fieldDefs]);
|
|
19128
|
+
const titleField = fieldDefs.find((f3) => f3.variant === "h3" || f3.variant === "h4") ?? fieldDefs[0];
|
|
19129
|
+
const badgeFields = fieldDefs.filter((f3) => f3.variant === "badge" && f3 !== titleField);
|
|
19130
|
+
const progressFields = fieldDefs.filter((f3) => f3.variant === "progress");
|
|
19131
|
+
const bodyFields = fieldDefs.filter(
|
|
19128
19132
|
(f3) => f3 !== titleField && !badgeFields.includes(f3) && !progressFields.includes(f3)
|
|
19129
19133
|
);
|
|
19130
19134
|
const handleActionClick = (action, itemData) => (e) => {
|
|
@@ -19156,7 +19160,7 @@ function DataList({
|
|
|
19156
19160
|
if (isMessage) {
|
|
19157
19161
|
const items2 = data.map((item) => item);
|
|
19158
19162
|
const groups2 = groupBy ? groupData(items2, groupBy) : [{ label: "", items: items2 }];
|
|
19159
|
-
const contentField = titleField?.name ??
|
|
19163
|
+
const contentField = titleField?.name ?? fieldDefs[0]?.name ?? "";
|
|
19160
19164
|
return /* @__PURE__ */ jsxRuntime.jsx(VStack, { gap: "sm", className: cn("py-2", className), children: groups2.map((group, gi) => /* @__PURE__ */ jsxRuntime.jsxs(React115__namespace.default.Fragment, { children: [
|
|
19161
19165
|
group.label && /* @__PURE__ */ jsxRuntime.jsx(Divider, { label: group.label, className: "my-2" }),
|
|
19162
19166
|
group.items.map((itemData, index) => {
|
|
@@ -19164,7 +19168,7 @@ function DataList({
|
|
|
19164
19168
|
const sender = senderField ? String(getNestedValue(itemData, senderField) ?? "") : "";
|
|
19165
19169
|
const isSent = Boolean(currentUser && sender === currentUser);
|
|
19166
19170
|
const content = getNestedValue(itemData, contentField);
|
|
19167
|
-
const timestampField =
|
|
19171
|
+
const timestampField = fieldDefs.find((f3) => f3.format === "date");
|
|
19168
19172
|
const timestamp = timestampField ? getNestedValue(itemData, timestampField.name) : null;
|
|
19169
19173
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
19170
19174
|
Box,
|
package/dist/providers/index.js
CHANGED
|
@@ -18647,6 +18647,7 @@ function formatValue(value, format) {
|
|
|
18647
18647
|
function DataGrid({
|
|
18648
18648
|
entity,
|
|
18649
18649
|
fields,
|
|
18650
|
+
columns,
|
|
18650
18651
|
itemActions,
|
|
18651
18652
|
cols,
|
|
18652
18653
|
gap = "md",
|
|
@@ -18668,6 +18669,7 @@ function DataGrid({
|
|
|
18668
18669
|
const { t } = useTranslate();
|
|
18669
18670
|
const [selectedIds, setSelectedIds] = useState(/* @__PURE__ */ new Set());
|
|
18670
18671
|
const [visibleCount, setVisibleCount] = useState(pageSize || Infinity);
|
|
18672
|
+
const fieldDefs = fields ?? columns ?? [];
|
|
18671
18673
|
const allData = Array.isArray(entity) ? entity : entity ? [entity] : [];
|
|
18672
18674
|
const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
|
|
18673
18675
|
const hasMoreLocal = pageSize > 0 && visibleCount < allData.length;
|
|
@@ -18695,9 +18697,9 @@ function DataGrid({
|
|
|
18695
18697
|
return next;
|
|
18696
18698
|
});
|
|
18697
18699
|
}, [data, selectionEvent, eventBus]);
|
|
18698
|
-
const titleField =
|
|
18699
|
-
const badgeFields =
|
|
18700
|
-
const bodyFields =
|
|
18700
|
+
const titleField = fieldDefs.find((f3) => f3.variant === "h3" || f3.variant === "h4") ?? fieldDefs[0];
|
|
18701
|
+
const badgeFields = fieldDefs.filter((f3) => f3.variant === "badge" && f3 !== titleField);
|
|
18702
|
+
const bodyFields = fieldDefs.filter((f3) => f3 !== titleField && !badgeFields.includes(f3));
|
|
18701
18703
|
const primaryActions = itemActions?.filter((a) => a.variant !== "danger") ?? [];
|
|
18702
18704
|
const dangerActions = itemActions?.filter((a) => a.variant === "danger") ?? [];
|
|
18703
18705
|
const handleActionClick = (action, itemData) => (e) => {
|
|
@@ -18710,7 +18712,7 @@ function DataGrid({
|
|
|
18710
18712
|
};
|
|
18711
18713
|
const hasRenderProp = typeof children === "function";
|
|
18712
18714
|
useEffect(() => {
|
|
18713
|
-
if (data.length > 0 && !hasRenderProp &&
|
|
18715
|
+
if (data.length > 0 && !hasRenderProp && fieldDefs.length === 0) {
|
|
18714
18716
|
const renderItemRaw = schemaRenderItem;
|
|
18715
18717
|
const isFnLambda = Array.isArray(renderItemRaw) && renderItemRaw.length >= 3 && (renderItemRaw[0] === "fn" || renderItemRaw[0] === "lambda");
|
|
18716
18718
|
dataGridLog.warn("renderItem-unresolved", {
|
|
@@ -18718,7 +18720,7 @@ function DataGrid({
|
|
|
18718
18720
|
renderItemIsFnLambda: isFnLambda
|
|
18719
18721
|
});
|
|
18720
18722
|
}
|
|
18721
|
-
}, [data, hasRenderProp, schemaRenderItem,
|
|
18723
|
+
}, [data, hasRenderProp, schemaRenderItem, fieldDefs]);
|
|
18722
18724
|
const gridTemplateColumns = cols ? void 0 : `repeat(auto-fit, minmax(min(${minCardWidth}px, 100%), 1fr))`;
|
|
18723
18725
|
const colsClass = cols ? {
|
|
18724
18726
|
1: "grid-cols-1",
|
|
@@ -19023,6 +19025,7 @@ function groupData(items, field) {
|
|
|
19023
19025
|
function DataList({
|
|
19024
19026
|
entity,
|
|
19025
19027
|
fields,
|
|
19028
|
+
columns,
|
|
19026
19029
|
itemActions,
|
|
19027
19030
|
gap = "none",
|
|
19028
19031
|
variant = "default",
|
|
@@ -19052,6 +19055,7 @@ function DataList({
|
|
|
19052
19055
|
const eventBus = useEventBus();
|
|
19053
19056
|
const { t } = useTranslate();
|
|
19054
19057
|
const [visibleCount, setVisibleCount] = React115__default.useState(pageSize || Infinity);
|
|
19058
|
+
const fieldDefs = fields ?? columns ?? [];
|
|
19055
19059
|
const allData = Array.isArray(entity) ? entity : entity ? [entity] : [];
|
|
19056
19060
|
const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
|
|
19057
19061
|
const hasMoreLocal = pageSize > 0 && visibleCount < allData.length;
|
|
@@ -19066,7 +19070,7 @@ function DataList({
|
|
|
19066
19070
|
const isFnLambda = Array.isArray(renderItemRaw) && renderItemRaw.length >= 3 && (renderItemRaw[0] === "fn" || renderItemRaw[0] === "lambda");
|
|
19067
19071
|
dataListLog.warn("renderItem-unresolved", {
|
|
19068
19072
|
rowCount: data.length,
|
|
19069
|
-
fieldsCount:
|
|
19073
|
+
fieldsCount: fieldDefs.length,
|
|
19070
19074
|
renderItemTypeOf,
|
|
19071
19075
|
renderItemIsArray: Array.isArray(renderItemRaw),
|
|
19072
19076
|
renderItemIsFnLambda: isFnLambda,
|
|
@@ -19075,11 +19079,11 @@ function DataList({
|
|
|
19075
19079
|
sampleRowKeys: sampleKeys
|
|
19076
19080
|
});
|
|
19077
19081
|
}
|
|
19078
|
-
}, [data, hasRenderProp, schemaRenderItem, children,
|
|
19079
|
-
const titleField =
|
|
19080
|
-
const badgeFields =
|
|
19081
|
-
const progressFields =
|
|
19082
|
-
const bodyFields =
|
|
19082
|
+
}, [data, hasRenderProp, schemaRenderItem, children, fieldDefs]);
|
|
19083
|
+
const titleField = fieldDefs.find((f3) => f3.variant === "h3" || f3.variant === "h4") ?? fieldDefs[0];
|
|
19084
|
+
const badgeFields = fieldDefs.filter((f3) => f3.variant === "badge" && f3 !== titleField);
|
|
19085
|
+
const progressFields = fieldDefs.filter((f3) => f3.variant === "progress");
|
|
19086
|
+
const bodyFields = fieldDefs.filter(
|
|
19083
19087
|
(f3) => f3 !== titleField && !badgeFields.includes(f3) && !progressFields.includes(f3)
|
|
19084
19088
|
);
|
|
19085
19089
|
const handleActionClick = (action, itemData) => (e) => {
|
|
@@ -19111,7 +19115,7 @@ function DataList({
|
|
|
19111
19115
|
if (isMessage) {
|
|
19112
19116
|
const items2 = data.map((item) => item);
|
|
19113
19117
|
const groups2 = groupBy ? groupData(items2, groupBy) : [{ label: "", items: items2 }];
|
|
19114
|
-
const contentField = titleField?.name ??
|
|
19118
|
+
const contentField = titleField?.name ?? fieldDefs[0]?.name ?? "";
|
|
19115
19119
|
return /* @__PURE__ */ jsx(VStack, { gap: "sm", className: cn("py-2", className), children: groups2.map((group, gi) => /* @__PURE__ */ jsxs(React115__default.Fragment, { children: [
|
|
19116
19120
|
group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: "my-2" }),
|
|
19117
19121
|
group.items.map((itemData, index) => {
|
|
@@ -19119,7 +19123,7 @@ function DataList({
|
|
|
19119
19123
|
const sender = senderField ? String(getNestedValue(itemData, senderField) ?? "") : "";
|
|
19120
19124
|
const isSent = Boolean(currentUser && sender === currentUser);
|
|
19121
19125
|
const content = getNestedValue(itemData, contentField);
|
|
19122
|
-
const timestampField =
|
|
19126
|
+
const timestampField = fieldDefs.find((f3) => f3.format === "date");
|
|
19123
19127
|
const timestamp = timestampField ? getNestedValue(itemData, timestampField.name) : null;
|
|
19124
19128
|
return /* @__PURE__ */ jsx(
|
|
19125
19129
|
Box,
|
package/dist/runtime/index.cjs
CHANGED
|
@@ -18468,6 +18468,7 @@ function formatValue(value, format) {
|
|
|
18468
18468
|
function DataGrid({
|
|
18469
18469
|
entity,
|
|
18470
18470
|
fields,
|
|
18471
|
+
columns,
|
|
18471
18472
|
itemActions,
|
|
18472
18473
|
cols,
|
|
18473
18474
|
gap = "md",
|
|
@@ -18489,6 +18490,7 @@ function DataGrid({
|
|
|
18489
18490
|
const { t } = useTranslate();
|
|
18490
18491
|
const [selectedIds, setSelectedIds] = React113.useState(/* @__PURE__ */ new Set());
|
|
18491
18492
|
const [visibleCount, setVisibleCount] = React113.useState(pageSize || Infinity);
|
|
18493
|
+
const fieldDefs = fields ?? columns ?? [];
|
|
18492
18494
|
const allData = Array.isArray(entity) ? entity : entity ? [entity] : [];
|
|
18493
18495
|
const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
|
|
18494
18496
|
const hasMoreLocal = pageSize > 0 && visibleCount < allData.length;
|
|
@@ -18516,9 +18518,9 @@ function DataGrid({
|
|
|
18516
18518
|
return next;
|
|
18517
18519
|
});
|
|
18518
18520
|
}, [data, selectionEvent, eventBus]);
|
|
18519
|
-
const titleField =
|
|
18520
|
-
const badgeFields =
|
|
18521
|
-
const bodyFields =
|
|
18521
|
+
const titleField = fieldDefs.find((f3) => f3.variant === "h3" || f3.variant === "h4") ?? fieldDefs[0];
|
|
18522
|
+
const badgeFields = fieldDefs.filter((f3) => f3.variant === "badge" && f3 !== titleField);
|
|
18523
|
+
const bodyFields = fieldDefs.filter((f3) => f3 !== titleField && !badgeFields.includes(f3));
|
|
18522
18524
|
const primaryActions = itemActions?.filter((a) => a.variant !== "danger") ?? [];
|
|
18523
18525
|
const dangerActions = itemActions?.filter((a) => a.variant === "danger") ?? [];
|
|
18524
18526
|
const handleActionClick = (action, itemData) => (e) => {
|
|
@@ -18531,7 +18533,7 @@ function DataGrid({
|
|
|
18531
18533
|
};
|
|
18532
18534
|
const hasRenderProp = typeof children === "function";
|
|
18533
18535
|
React113.useEffect(() => {
|
|
18534
|
-
if (data.length > 0 && !hasRenderProp &&
|
|
18536
|
+
if (data.length > 0 && !hasRenderProp && fieldDefs.length === 0) {
|
|
18535
18537
|
const renderItemRaw = schemaRenderItem;
|
|
18536
18538
|
const isFnLambda = Array.isArray(renderItemRaw) && renderItemRaw.length >= 3 && (renderItemRaw[0] === "fn" || renderItemRaw[0] === "lambda");
|
|
18537
18539
|
dataGridLog.warn("renderItem-unresolved", {
|
|
@@ -18539,7 +18541,7 @@ function DataGrid({
|
|
|
18539
18541
|
renderItemIsFnLambda: isFnLambda
|
|
18540
18542
|
});
|
|
18541
18543
|
}
|
|
18542
|
-
}, [data, hasRenderProp, schemaRenderItem,
|
|
18544
|
+
}, [data, hasRenderProp, schemaRenderItem, fieldDefs]);
|
|
18543
18545
|
const gridTemplateColumns = cols ? void 0 : `repeat(auto-fit, minmax(min(${minCardWidth}px, 100%), 1fr))`;
|
|
18544
18546
|
const colsClass = cols ? {
|
|
18545
18547
|
1: "grid-cols-1",
|
|
@@ -18844,6 +18846,7 @@ function groupData(items, field) {
|
|
|
18844
18846
|
function DataList({
|
|
18845
18847
|
entity,
|
|
18846
18848
|
fields,
|
|
18849
|
+
columns,
|
|
18847
18850
|
itemActions,
|
|
18848
18851
|
gap = "none",
|
|
18849
18852
|
variant = "default",
|
|
@@ -18873,6 +18876,7 @@ function DataList({
|
|
|
18873
18876
|
const eventBus = useEventBus();
|
|
18874
18877
|
const { t } = useTranslate();
|
|
18875
18878
|
const [visibleCount, setVisibleCount] = React113__namespace.default.useState(pageSize || Infinity);
|
|
18879
|
+
const fieldDefs = fields ?? columns ?? [];
|
|
18876
18880
|
const allData = Array.isArray(entity) ? entity : entity ? [entity] : [];
|
|
18877
18881
|
const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
|
|
18878
18882
|
const hasMoreLocal = pageSize > 0 && visibleCount < allData.length;
|
|
@@ -18887,7 +18891,7 @@ function DataList({
|
|
|
18887
18891
|
const isFnLambda = Array.isArray(renderItemRaw) && renderItemRaw.length >= 3 && (renderItemRaw[0] === "fn" || renderItemRaw[0] === "lambda");
|
|
18888
18892
|
dataListLog.warn("renderItem-unresolved", {
|
|
18889
18893
|
rowCount: data.length,
|
|
18890
|
-
fieldsCount:
|
|
18894
|
+
fieldsCount: fieldDefs.length,
|
|
18891
18895
|
renderItemTypeOf,
|
|
18892
18896
|
renderItemIsArray: Array.isArray(renderItemRaw),
|
|
18893
18897
|
renderItemIsFnLambda: isFnLambda,
|
|
@@ -18896,11 +18900,11 @@ function DataList({
|
|
|
18896
18900
|
sampleRowKeys: sampleKeys
|
|
18897
18901
|
});
|
|
18898
18902
|
}
|
|
18899
|
-
}, [data, hasRenderProp, schemaRenderItem, children,
|
|
18900
|
-
const titleField =
|
|
18901
|
-
const badgeFields =
|
|
18902
|
-
const progressFields =
|
|
18903
|
-
const bodyFields =
|
|
18903
|
+
}, [data, hasRenderProp, schemaRenderItem, children, fieldDefs]);
|
|
18904
|
+
const titleField = fieldDefs.find((f3) => f3.variant === "h3" || f3.variant === "h4") ?? fieldDefs[0];
|
|
18905
|
+
const badgeFields = fieldDefs.filter((f3) => f3.variant === "badge" && f3 !== titleField);
|
|
18906
|
+
const progressFields = fieldDefs.filter((f3) => f3.variant === "progress");
|
|
18907
|
+
const bodyFields = fieldDefs.filter(
|
|
18904
18908
|
(f3) => f3 !== titleField && !badgeFields.includes(f3) && !progressFields.includes(f3)
|
|
18905
18909
|
);
|
|
18906
18910
|
const handleActionClick = (action, itemData) => (e) => {
|
|
@@ -18932,7 +18936,7 @@ function DataList({
|
|
|
18932
18936
|
if (isMessage) {
|
|
18933
18937
|
const items2 = data.map((item) => item);
|
|
18934
18938
|
const groups2 = groupBy ? groupData(items2, groupBy) : [{ label: "", items: items2 }];
|
|
18935
|
-
const contentField = titleField?.name ??
|
|
18939
|
+
const contentField = titleField?.name ?? fieldDefs[0]?.name ?? "";
|
|
18936
18940
|
return /* @__PURE__ */ jsxRuntime.jsx(VStack, { gap: "sm", className: cn("py-2", className), children: groups2.map((group, gi) => /* @__PURE__ */ jsxRuntime.jsxs(React113__namespace.default.Fragment, { children: [
|
|
18937
18941
|
group.label && /* @__PURE__ */ jsxRuntime.jsx(Divider, { label: group.label, className: "my-2" }),
|
|
18938
18942
|
group.items.map((itemData, index) => {
|
|
@@ -18940,7 +18944,7 @@ function DataList({
|
|
|
18940
18944
|
const sender = senderField ? String(getNestedValue(itemData, senderField) ?? "") : "";
|
|
18941
18945
|
const isSent = Boolean(currentUser && sender === currentUser);
|
|
18942
18946
|
const content = getNestedValue(itemData, contentField);
|
|
18943
|
-
const timestampField =
|
|
18947
|
+
const timestampField = fieldDefs.find((f3) => f3.format === "date");
|
|
18944
18948
|
const timestamp = timestampField ? getNestedValue(itemData, timestampField.name) : null;
|
|
18945
18949
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
18946
18950
|
Box,
|
package/dist/runtime/index.js
CHANGED
|
@@ -18423,6 +18423,7 @@ function formatValue(value, format) {
|
|
|
18423
18423
|
function DataGrid({
|
|
18424
18424
|
entity,
|
|
18425
18425
|
fields,
|
|
18426
|
+
columns,
|
|
18426
18427
|
itemActions,
|
|
18427
18428
|
cols,
|
|
18428
18429
|
gap = "md",
|
|
@@ -18444,6 +18445,7 @@ function DataGrid({
|
|
|
18444
18445
|
const { t } = useTranslate();
|
|
18445
18446
|
const [selectedIds, setSelectedIds] = useState(/* @__PURE__ */ new Set());
|
|
18446
18447
|
const [visibleCount, setVisibleCount] = useState(pageSize || Infinity);
|
|
18448
|
+
const fieldDefs = fields ?? columns ?? [];
|
|
18447
18449
|
const allData = Array.isArray(entity) ? entity : entity ? [entity] : [];
|
|
18448
18450
|
const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
|
|
18449
18451
|
const hasMoreLocal = pageSize > 0 && visibleCount < allData.length;
|
|
@@ -18471,9 +18473,9 @@ function DataGrid({
|
|
|
18471
18473
|
return next;
|
|
18472
18474
|
});
|
|
18473
18475
|
}, [data, selectionEvent, eventBus]);
|
|
18474
|
-
const titleField =
|
|
18475
|
-
const badgeFields =
|
|
18476
|
-
const bodyFields =
|
|
18476
|
+
const titleField = fieldDefs.find((f3) => f3.variant === "h3" || f3.variant === "h4") ?? fieldDefs[0];
|
|
18477
|
+
const badgeFields = fieldDefs.filter((f3) => f3.variant === "badge" && f3 !== titleField);
|
|
18478
|
+
const bodyFields = fieldDefs.filter((f3) => f3 !== titleField && !badgeFields.includes(f3));
|
|
18477
18479
|
const primaryActions = itemActions?.filter((a) => a.variant !== "danger") ?? [];
|
|
18478
18480
|
const dangerActions = itemActions?.filter((a) => a.variant === "danger") ?? [];
|
|
18479
18481
|
const handleActionClick = (action, itemData) => (e) => {
|
|
@@ -18486,7 +18488,7 @@ function DataGrid({
|
|
|
18486
18488
|
};
|
|
18487
18489
|
const hasRenderProp = typeof children === "function";
|
|
18488
18490
|
useEffect(() => {
|
|
18489
|
-
if (data.length > 0 && !hasRenderProp &&
|
|
18491
|
+
if (data.length > 0 && !hasRenderProp && fieldDefs.length === 0) {
|
|
18490
18492
|
const renderItemRaw = schemaRenderItem;
|
|
18491
18493
|
const isFnLambda = Array.isArray(renderItemRaw) && renderItemRaw.length >= 3 && (renderItemRaw[0] === "fn" || renderItemRaw[0] === "lambda");
|
|
18492
18494
|
dataGridLog.warn("renderItem-unresolved", {
|
|
@@ -18494,7 +18496,7 @@ function DataGrid({
|
|
|
18494
18496
|
renderItemIsFnLambda: isFnLambda
|
|
18495
18497
|
});
|
|
18496
18498
|
}
|
|
18497
|
-
}, [data, hasRenderProp, schemaRenderItem,
|
|
18499
|
+
}, [data, hasRenderProp, schemaRenderItem, fieldDefs]);
|
|
18498
18500
|
const gridTemplateColumns = cols ? void 0 : `repeat(auto-fit, minmax(min(${minCardWidth}px, 100%), 1fr))`;
|
|
18499
18501
|
const colsClass = cols ? {
|
|
18500
18502
|
1: "grid-cols-1",
|
|
@@ -18799,6 +18801,7 @@ function groupData(items, field) {
|
|
|
18799
18801
|
function DataList({
|
|
18800
18802
|
entity,
|
|
18801
18803
|
fields,
|
|
18804
|
+
columns,
|
|
18802
18805
|
itemActions,
|
|
18803
18806
|
gap = "none",
|
|
18804
18807
|
variant = "default",
|
|
@@ -18828,6 +18831,7 @@ function DataList({
|
|
|
18828
18831
|
const eventBus = useEventBus();
|
|
18829
18832
|
const { t } = useTranslate();
|
|
18830
18833
|
const [visibleCount, setVisibleCount] = React113__default.useState(pageSize || Infinity);
|
|
18834
|
+
const fieldDefs = fields ?? columns ?? [];
|
|
18831
18835
|
const allData = Array.isArray(entity) ? entity : entity ? [entity] : [];
|
|
18832
18836
|
const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
|
|
18833
18837
|
const hasMoreLocal = pageSize > 0 && visibleCount < allData.length;
|
|
@@ -18842,7 +18846,7 @@ function DataList({
|
|
|
18842
18846
|
const isFnLambda = Array.isArray(renderItemRaw) && renderItemRaw.length >= 3 && (renderItemRaw[0] === "fn" || renderItemRaw[0] === "lambda");
|
|
18843
18847
|
dataListLog.warn("renderItem-unresolved", {
|
|
18844
18848
|
rowCount: data.length,
|
|
18845
|
-
fieldsCount:
|
|
18849
|
+
fieldsCount: fieldDefs.length,
|
|
18846
18850
|
renderItemTypeOf,
|
|
18847
18851
|
renderItemIsArray: Array.isArray(renderItemRaw),
|
|
18848
18852
|
renderItemIsFnLambda: isFnLambda,
|
|
@@ -18851,11 +18855,11 @@ function DataList({
|
|
|
18851
18855
|
sampleRowKeys: sampleKeys
|
|
18852
18856
|
});
|
|
18853
18857
|
}
|
|
18854
|
-
}, [data, hasRenderProp, schemaRenderItem, children,
|
|
18855
|
-
const titleField =
|
|
18856
|
-
const badgeFields =
|
|
18857
|
-
const progressFields =
|
|
18858
|
-
const bodyFields =
|
|
18858
|
+
}, [data, hasRenderProp, schemaRenderItem, children, fieldDefs]);
|
|
18859
|
+
const titleField = fieldDefs.find((f3) => f3.variant === "h3" || f3.variant === "h4") ?? fieldDefs[0];
|
|
18860
|
+
const badgeFields = fieldDefs.filter((f3) => f3.variant === "badge" && f3 !== titleField);
|
|
18861
|
+
const progressFields = fieldDefs.filter((f3) => f3.variant === "progress");
|
|
18862
|
+
const bodyFields = fieldDefs.filter(
|
|
18859
18863
|
(f3) => f3 !== titleField && !badgeFields.includes(f3) && !progressFields.includes(f3)
|
|
18860
18864
|
);
|
|
18861
18865
|
const handleActionClick = (action, itemData) => (e) => {
|
|
@@ -18887,7 +18891,7 @@ function DataList({
|
|
|
18887
18891
|
if (isMessage) {
|
|
18888
18892
|
const items2 = data.map((item) => item);
|
|
18889
18893
|
const groups2 = groupBy ? groupData(items2, groupBy) : [{ label: "", items: items2 }];
|
|
18890
|
-
const contentField = titleField?.name ??
|
|
18894
|
+
const contentField = titleField?.name ?? fieldDefs[0]?.name ?? "";
|
|
18891
18895
|
return /* @__PURE__ */ jsx(VStack, { gap: "sm", className: cn("py-2", className), children: groups2.map((group, gi) => /* @__PURE__ */ jsxs(React113__default.Fragment, { children: [
|
|
18892
18896
|
group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: "my-2" }),
|
|
18893
18897
|
group.items.map((itemData, index) => {
|
|
@@ -18895,7 +18899,7 @@ function DataList({
|
|
|
18895
18899
|
const sender = senderField ? String(getNestedValue(itemData, senderField) ?? "") : "";
|
|
18896
18900
|
const isSent = Boolean(currentUser && sender === currentUser);
|
|
18897
18901
|
const content = getNestedValue(itemData, contentField);
|
|
18898
|
-
const timestampField =
|
|
18902
|
+
const timestampField = fieldDefs.find((f3) => f3.format === "date");
|
|
18899
18903
|
const timestamp = timestampField ? getNestedValue(itemData, timestampField.name) : null;
|
|
18900
18904
|
return /* @__PURE__ */ jsx(
|
|
18901
18905
|
Box,
|