@compill/admin 1.0.43 → 1.0.45
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/index.cjs.js +77 -68
- package/index.esm.js +75 -66
- package/package.json +1 -1
- package/src/lib/page/PageQueryStateContainer.d.ts +1 -0
- package/src/lib/table/TableTopBar.d.ts +1 -2
package/index.cjs.js
CHANGED
@@ -172,10 +172,10 @@ function InvalidateButton(_a) {
|
|
172
172
|
});
|
173
173
|
return jsxRuntime.jsx(ui.Button, Object.assign({
|
174
174
|
scheme: "dark",
|
175
|
-
variant: "
|
176
|
-
|
177
|
-
|
178
|
-
|
175
|
+
variant: "borderless",
|
176
|
+
size: "sm",
|
177
|
+
corners: "square",
|
178
|
+
aspectRatio: "square",
|
179
179
|
title: "Regenerate",
|
180
180
|
disabled: mutation.isLoading,
|
181
181
|
onClick: invalidate
|
@@ -836,11 +836,12 @@ function PageQueryStateContainerInner(_a) {
|
|
836
836
|
children
|
837
837
|
} = _a,
|
838
838
|
props = __rest$1(_a, ["queryId", "api", "apiFn", "loadingStyles", "errorStyles", "children"]);
|
839
|
+
// @ts-ignore
|
839
840
|
const {
|
840
841
|
data,
|
841
842
|
isLoading,
|
842
843
|
isError
|
843
|
-
} = apiFn == "
|
844
|
+
} = apiFn == "getAll" ? api.useApiQuery(api$1.queryKey, api$1.getAll, props.apiParams) : api.useApiQuery(api$1.queryKey, api$1.get, queryId);
|
844
845
|
const invalidate = api.useInvalidateQuery(api$1.queryKey, queryId);
|
845
846
|
if (isLoading) return jsxRuntime.jsx(components.QueryLoadingState, Object.assign({
|
846
847
|
w: "full",
|
@@ -1362,12 +1363,7 @@ function TableContainer(_a) {
|
|
1362
1363
|
children
|
1363
1364
|
} = _a,
|
1364
1365
|
props = __rest$1(_a, ["initialPageSize", "initialVisibleColumns", "columns", "children"]);
|
1365
|
-
return jsxRuntime.jsx(
|
1366
|
-
scheme: "light",
|
1367
|
-
shadow: true,
|
1368
|
-
rounded: "md",
|
1369
|
-
px: "0",
|
1370
|
-
py: "4",
|
1366
|
+
return jsxRuntime.jsx("div", Object.assign({
|
1371
1367
|
w: "full",
|
1372
1368
|
dflex: true,
|
1373
1369
|
flexCol: true
|
@@ -1389,10 +1385,10 @@ function TableCreateButton(_a) {
|
|
1389
1385
|
} = _a,
|
1390
1386
|
props = __rest$1(_a, ["children"]);
|
1391
1387
|
return jsxRuntime.jsx(DialogButton, Object.assign({
|
1392
|
-
scheme: "
|
1393
|
-
|
1394
|
-
|
1395
|
-
variant: "
|
1388
|
+
scheme: "dark",
|
1389
|
+
size: "sm",
|
1390
|
+
aspectRatio: "square",
|
1391
|
+
variant: "borderless"
|
1396
1392
|
}, props, {
|
1397
1393
|
children: children !== null && children !== void 0 ? children : jsxRuntime.jsx(ui.Icon, {
|
1398
1394
|
path: mdiPlusThick
|
@@ -1407,11 +1403,11 @@ function TableFilterButton(_a) {
|
|
1407
1403
|
side: "bottom-end",
|
1408
1404
|
modal: true,
|
1409
1405
|
children: [jsxRuntime.jsx(ui.Button, Object.assign({
|
1410
|
-
scheme: "
|
1411
|
-
|
1412
|
-
|
1413
|
-
|
1414
|
-
|
1406
|
+
scheme: "dark",
|
1407
|
+
size: "sm",
|
1408
|
+
aspectRatio: "square",
|
1409
|
+
variant: "borderless",
|
1410
|
+
corners: "square"
|
1415
1411
|
}, props, {
|
1416
1412
|
children: jsxRuntime.jsx(ui.Icon, {
|
1417
1413
|
path: mdiFilter
|
@@ -1446,26 +1442,18 @@ function TableFilterButton(_a) {
|
|
1446
1442
|
function TableTopBar(_a) {
|
1447
1443
|
var {
|
1448
1444
|
title,
|
1449
|
-
queryKey,
|
1450
1445
|
children
|
1451
1446
|
} = _a,
|
1452
|
-
props = __rest$1(_a, ["title", "
|
1453
|
-
const invalidate = api.useInvalidateQuery(queryKey);
|
1454
|
-
useHotkeys('ctrl+r', () => invalidate(), {
|
1455
|
-
preventDefault: true
|
1456
|
-
}, [invalidate]);
|
1447
|
+
props = __rest$1(_a, ["title", "children"]);
|
1457
1448
|
return jsxRuntime.jsxs("div", Object.assign({
|
1458
1449
|
dflex: true,
|
1459
1450
|
flexRow: true,
|
1460
|
-
pb: "4",
|
1461
1451
|
alignItems: "center",
|
1462
1452
|
gap: "3",
|
1463
|
-
|
1464
|
-
borderB: "0.5",
|
1465
|
-
borderBColor: "--bg-2"
|
1453
|
+
p: "3"
|
1466
1454
|
}, props, {
|
1467
1455
|
children: [title && jsxRuntime.jsx("h2", {
|
1468
|
-
textSize: "
|
1456
|
+
textSize: "x2",
|
1469
1457
|
fontWeight: "600",
|
1470
1458
|
textColor: "#3f4254",
|
1471
1459
|
textTransform: "capitalize",
|
@@ -1473,22 +1461,7 @@ function TableTopBar(_a) {
|
|
1473
1461
|
}), jsxRuntime.jsx("div", {
|
1474
1462
|
flexGrow: true,
|
1475
1463
|
children: "\u00A0"
|
1476
|
-
}),
|
1477
|
-
spaceX: "2",
|
1478
|
-
dflex: true,
|
1479
|
-
alignItems: "center",
|
1480
|
-
children: [jsxRuntime.jsx(ui.Button, {
|
1481
|
-
scheme: "default",
|
1482
|
-
corners: "pill",
|
1483
|
-
w: "10",
|
1484
|
-
h: "10",
|
1485
|
-
variant: "glass",
|
1486
|
-
onClick: invalidate,
|
1487
|
-
children: jsxRuntime.jsx(ui.Icon, {
|
1488
|
-
path: mdiRefresh
|
1489
|
-
})
|
1490
|
-
}), children]
|
1491
|
-
})]
|
1464
|
+
}), children]
|
1492
1465
|
}));
|
1493
1466
|
}
|
1494
1467
|
|
@@ -1951,15 +1924,14 @@ function TableRowPublishPostButton$1(_a) {
|
|
1951
1924
|
mutation.mutateAsync(id).then(() => reactToastify.toast.success(isDraft ? "Published!" : "Unpublished!")).catch(error => reactToastify.toast.error(`Error: ${error}`));
|
1952
1925
|
}, [mutation, id]);
|
1953
1926
|
return jsxRuntime.jsx(ui.Button, Object.assign({
|
1954
|
-
w: "10",
|
1955
|
-
h: "10",
|
1956
1927
|
variant: "borderless",
|
1957
|
-
corners: "
|
1928
|
+
corners: "square",
|
1958
1929
|
scheme: "default",
|
1959
1930
|
onClick: publish
|
1960
1931
|
}, props, {
|
1961
1932
|
children: jsxRuntime.jsx(ui.Icon, {
|
1962
|
-
path: isDraft ? mdiPublish : mdiPublishOff
|
1933
|
+
path: isDraft ? mdiPublish : mdiPublishOff,
|
1934
|
+
size: "sm"
|
1963
1935
|
})
|
1964
1936
|
}));
|
1965
1937
|
}
|
@@ -1974,8 +1946,14 @@ function TableRowActionsView({
|
|
1974
1946
|
const item = row.original;
|
1975
1947
|
return jsxRuntime.jsx("div", {
|
1976
1948
|
dflex: true,
|
1977
|
-
|
1949
|
+
w: "full",
|
1950
|
+
alignItems: "stretch",
|
1978
1951
|
placeContent: "end",
|
1952
|
+
h: "full",
|
1953
|
+
divideX: "1px",
|
1954
|
+
divideColor: "zinc-100",
|
1955
|
+
rounded: "lg",
|
1956
|
+
overflow: "hidden",
|
1979
1957
|
children: rowActions === null || rowActions === void 0 ? void 0 : rowActions.map((action, index) => jsxRuntime.jsxs(React__default["default"].Fragment, {
|
1980
1958
|
children: [action.type === "publish" && jsxRuntime.jsx(TableRowPublishPostButton$1, {
|
1981
1959
|
id: item.id,
|
@@ -1988,7 +1966,8 @@ function TableRowActionsView({
|
|
1988
1966
|
onClick: () => onAction(action, item),
|
1989
1967
|
scheme: schemes$1[action.type],
|
1990
1968
|
children: jsxRuntime.jsx(ui.Icon, {
|
1991
|
-
path: icons[action.type]
|
1969
|
+
path: icons[action.type],
|
1970
|
+
size: "sm"
|
1992
1971
|
})
|
1993
1972
|
})]
|
1994
1973
|
}, index))
|
@@ -2005,10 +1984,15 @@ function ActionButton$1(_a) {
|
|
2005
1984
|
onClick === null || onClick === void 0 ? void 0 : onClick(event);
|
2006
1985
|
}, [onClick]);
|
2007
1986
|
return jsxRuntime.jsx(ui.Button, Object.assign({
|
2008
|
-
|
2009
|
-
|
1987
|
+
dflex: true,
|
1988
|
+
alignContent: "center",
|
1989
|
+
placeContent: "center",
|
1990
|
+
py: "2.5",
|
1991
|
+
px: "2",
|
1992
|
+
h: "full",
|
1993
|
+
size: "lg",
|
2010
1994
|
variant: "borderless",
|
2011
|
-
corners: "
|
1995
|
+
corners: "square",
|
2012
1996
|
onClick: handleClick
|
2013
1997
|
}, props));
|
2014
1998
|
}
|
@@ -2504,7 +2488,7 @@ function TableView(_a) {
|
|
2504
2488
|
const id = useId(queryField);
|
2505
2489
|
const _screen = react.runIfFn(screen, id);
|
2506
2490
|
return jsxRuntime.jsx(PageContainer, Object.assign({
|
2507
|
-
|
2491
|
+
bgColor: "white"
|
2508
2492
|
}, props, {
|
2509
2493
|
children: jsxRuntime.jsx(TableContainer, {
|
2510
2494
|
columns: _screen.table.columns,
|
@@ -2543,15 +2527,16 @@ function TT({
|
|
2543
2527
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
2544
2528
|
children: [breadcrumbs && jsxRuntime.jsx(PageTopBar, {
|
2545
2529
|
breadcrumbs: breadcrumbs
|
2546
|
-
}), jsxRuntime.
|
2530
|
+
}), jsxRuntime.jsx(TableTopBar, {
|
2547
2531
|
title: title,
|
2548
|
-
|
2549
|
-
children: [jsxRuntime.jsx(ButtonBar, {
|
2532
|
+
children: jsxRuntime.jsx(ButtonBar, {
|
2550
2533
|
buttonBar: buttonBar,
|
2551
2534
|
createView: createView,
|
2552
2535
|
editView: editView,
|
2553
|
-
api: tableApi
|
2554
|
-
|
2536
|
+
api: tableApi,
|
2537
|
+
queryKey: tableApi.queryKey,
|
2538
|
+
children: filters && jsxRuntime.jsx(TableFilterButton, {})
|
2539
|
+
})
|
2555
2540
|
}), filters && jsxRuntime.jsx(TableFilters, {
|
2556
2541
|
form: filters.form,
|
2557
2542
|
initialValues: filters.initialValues,
|
@@ -2576,10 +2561,16 @@ function TT({
|
|
2576
2561
|
}
|
2577
2562
|
function ButtonBar({
|
2578
2563
|
buttonBar,
|
2564
|
+
queryKey,
|
2579
2565
|
createView,
|
2580
2566
|
editView,
|
2581
|
-
api
|
2567
|
+
api: api$1,
|
2568
|
+
children
|
2582
2569
|
}) {
|
2570
|
+
const invalidate = api.useInvalidateQuery(queryKey);
|
2571
|
+
useHotkeys('ctrl+r', () => invalidate(), {
|
2572
|
+
preventDefault: true
|
2573
|
+
}, [invalidate]);
|
2583
2574
|
const createDialog = React__default["default"].useCallback(onClose => {
|
2584
2575
|
const view = createView !== null && createView !== void 0 ? createView : editView;
|
2585
2576
|
if (view.type == "customDialog") return view.render({
|
@@ -2588,17 +2579,33 @@ function ButtonBar({
|
|
2588
2579
|
});else return jsxRuntime.jsx(DialogRenderer, {
|
2589
2580
|
config: view,
|
2590
2581
|
onClose: onClose,
|
2591
|
-
invalidateQueryKey: api.queryKey
|
2582
|
+
invalidateQueryKey: api$1.queryKey
|
2592
2583
|
});
|
2593
|
-
}, [editView, api]);
|
2594
|
-
return jsxRuntime.
|
2595
|
-
|
2584
|
+
}, [editView, api$1]);
|
2585
|
+
return jsxRuntime.jsxs("div", {
|
2586
|
+
dflex: true,
|
2587
|
+
border: "1px",
|
2588
|
+
borderColor: "zinc-200",
|
2589
|
+
divideX: "1px",
|
2590
|
+
divideColor: "zinc-200",
|
2591
|
+
rounded: "lg",
|
2592
|
+
overflow: "hidden",
|
2593
|
+
children: [jsxRuntime.jsx(ui.Button, {
|
2594
|
+
scheme: "dark",
|
2595
|
+
size: "sm",
|
2596
|
+
aspectRatio: "square",
|
2597
|
+
variant: "borderless",
|
2598
|
+
onClick: invalidate,
|
2599
|
+
children: jsxRuntime.jsx(ui.Icon, {
|
2600
|
+
path: mdiRefresh
|
2601
|
+
})
|
2602
|
+
}), buttonBar && buttonBar.map((button, index) => jsxRuntime.jsxs(React__default["default"].Fragment, {
|
2596
2603
|
children: [button.type === "create" && editView && jsxRuntime.jsx(TableCreateButton, {
|
2597
2604
|
buildDialog: createDialog
|
2598
2605
|
}), button.type === "invalidate" && jsxRuntime.jsx(InvalidateButton, {
|
2599
2606
|
pathOrPermalink: button.pathOrPermalink
|
2600
2607
|
}), button.type === "custom" && button.render()]
|
2601
|
-
}, index))
|
2608
|
+
}, index)), children]
|
2602
2609
|
});
|
2603
2610
|
}
|
2604
2611
|
function TableWrapper({
|
@@ -2620,6 +2627,8 @@ function TableWrapper({
|
|
2620
2627
|
};
|
2621
2628
|
}, [subtitle]);
|
2622
2629
|
return jsxRuntime.jsx(table.Table, Object.assign({}, tableProps, {
|
2630
|
+
px: "3",
|
2631
|
+
py: "3",
|
2623
2632
|
title: _subtitle
|
2624
2633
|
}));
|
2625
2634
|
}
|
package/index.esm.js
CHANGED
@@ -163,10 +163,10 @@ function InvalidateButton(_a) {
|
|
163
163
|
});
|
164
164
|
return jsx(Button, Object.assign({
|
165
165
|
scheme: "dark",
|
166
|
-
variant: "
|
167
|
-
|
168
|
-
|
169
|
-
|
166
|
+
variant: "borderless",
|
167
|
+
size: "sm",
|
168
|
+
corners: "square",
|
169
|
+
aspectRatio: "square",
|
170
170
|
title: "Regenerate",
|
171
171
|
disabled: mutation.isLoading,
|
172
172
|
onClick: invalidate
|
@@ -827,11 +827,12 @@ function PageQueryStateContainerInner(_a) {
|
|
827
827
|
children
|
828
828
|
} = _a,
|
829
829
|
props = __rest$1(_a, ["queryId", "api", "apiFn", "loadingStyles", "errorStyles", "children"]);
|
830
|
+
// @ts-ignore
|
830
831
|
const {
|
831
832
|
data,
|
832
833
|
isLoading,
|
833
834
|
isError
|
834
|
-
} = apiFn == "
|
835
|
+
} = apiFn == "getAll" ? useApiQuery(api.queryKey, api.getAll, props.apiParams) : useApiQuery(api.queryKey, api.get, queryId);
|
835
836
|
const invalidate = useInvalidateQuery(api.queryKey, queryId);
|
836
837
|
if (isLoading) return jsx(QueryLoadingState, Object.assign({
|
837
838
|
w: "full",
|
@@ -1353,12 +1354,7 @@ function TableContainer(_a) {
|
|
1353
1354
|
children
|
1354
1355
|
} = _a,
|
1355
1356
|
props = __rest$1(_a, ["initialPageSize", "initialVisibleColumns", "columns", "children"]);
|
1356
|
-
return jsx(
|
1357
|
-
scheme: "light",
|
1358
|
-
shadow: true,
|
1359
|
-
rounded: "md",
|
1360
|
-
px: "0",
|
1361
|
-
py: "4",
|
1357
|
+
return jsx("div", Object.assign({
|
1362
1358
|
w: "full",
|
1363
1359
|
dflex: true,
|
1364
1360
|
flexCol: true
|
@@ -1380,10 +1376,10 @@ function TableCreateButton(_a) {
|
|
1380
1376
|
} = _a,
|
1381
1377
|
props = __rest$1(_a, ["children"]);
|
1382
1378
|
return jsx(DialogButton, Object.assign({
|
1383
|
-
scheme: "
|
1384
|
-
|
1385
|
-
|
1386
|
-
variant: "
|
1379
|
+
scheme: "dark",
|
1380
|
+
size: "sm",
|
1381
|
+
aspectRatio: "square",
|
1382
|
+
variant: "borderless"
|
1387
1383
|
}, props, {
|
1388
1384
|
children: children !== null && children !== void 0 ? children : jsx(Icon, {
|
1389
1385
|
path: mdiPlusThick
|
@@ -1398,11 +1394,11 @@ function TableFilterButton(_a) {
|
|
1398
1394
|
side: "bottom-end",
|
1399
1395
|
modal: true,
|
1400
1396
|
children: [jsx(Button, Object.assign({
|
1401
|
-
scheme: "
|
1402
|
-
|
1403
|
-
|
1404
|
-
|
1405
|
-
|
1397
|
+
scheme: "dark",
|
1398
|
+
size: "sm",
|
1399
|
+
aspectRatio: "square",
|
1400
|
+
variant: "borderless",
|
1401
|
+
corners: "square"
|
1406
1402
|
}, props, {
|
1407
1403
|
children: jsx(Icon, {
|
1408
1404
|
path: mdiFilter
|
@@ -1437,26 +1433,18 @@ function TableFilterButton(_a) {
|
|
1437
1433
|
function TableTopBar(_a) {
|
1438
1434
|
var {
|
1439
1435
|
title,
|
1440
|
-
queryKey,
|
1441
1436
|
children
|
1442
1437
|
} = _a,
|
1443
|
-
props = __rest$1(_a, ["title", "
|
1444
|
-
const invalidate = useInvalidateQuery(queryKey);
|
1445
|
-
useHotkeys('ctrl+r', () => invalidate(), {
|
1446
|
-
preventDefault: true
|
1447
|
-
}, [invalidate]);
|
1438
|
+
props = __rest$1(_a, ["title", "children"]);
|
1448
1439
|
return jsxs("div", Object.assign({
|
1449
1440
|
dflex: true,
|
1450
1441
|
flexRow: true,
|
1451
|
-
pb: "4",
|
1452
1442
|
alignItems: "center",
|
1453
1443
|
gap: "3",
|
1454
|
-
|
1455
|
-
borderB: "0.5",
|
1456
|
-
borderBColor: "--bg-2"
|
1444
|
+
p: "3"
|
1457
1445
|
}, props, {
|
1458
1446
|
children: [title && jsx("h2", {
|
1459
|
-
textSize: "
|
1447
|
+
textSize: "x2",
|
1460
1448
|
fontWeight: "600",
|
1461
1449
|
textColor: "#3f4254",
|
1462
1450
|
textTransform: "capitalize",
|
@@ -1464,22 +1452,7 @@ function TableTopBar(_a) {
|
|
1464
1452
|
}), jsx("div", {
|
1465
1453
|
flexGrow: true,
|
1466
1454
|
children: "\u00A0"
|
1467
|
-
}),
|
1468
|
-
spaceX: "2",
|
1469
|
-
dflex: true,
|
1470
|
-
alignItems: "center",
|
1471
|
-
children: [jsx(Button, {
|
1472
|
-
scheme: "default",
|
1473
|
-
corners: "pill",
|
1474
|
-
w: "10",
|
1475
|
-
h: "10",
|
1476
|
-
variant: "glass",
|
1477
|
-
onClick: invalidate,
|
1478
|
-
children: jsx(Icon, {
|
1479
|
-
path: mdiRefresh
|
1480
|
-
})
|
1481
|
-
}), children]
|
1482
|
-
})]
|
1455
|
+
}), children]
|
1483
1456
|
}));
|
1484
1457
|
}
|
1485
1458
|
|
@@ -1942,15 +1915,14 @@ function TableRowPublishPostButton$1(_a) {
|
|
1942
1915
|
mutation.mutateAsync(id).then(() => toast.success(isDraft ? "Published!" : "Unpublished!")).catch(error => toast.error(`Error: ${error}`));
|
1943
1916
|
}, [mutation, id]);
|
1944
1917
|
return jsx(Button, Object.assign({
|
1945
|
-
w: "10",
|
1946
|
-
h: "10",
|
1947
1918
|
variant: "borderless",
|
1948
|
-
corners: "
|
1919
|
+
corners: "square",
|
1949
1920
|
scheme: "default",
|
1950
1921
|
onClick: publish
|
1951
1922
|
}, props, {
|
1952
1923
|
children: jsx(Icon, {
|
1953
|
-
path: isDraft ? mdiPublish : mdiPublishOff
|
1924
|
+
path: isDraft ? mdiPublish : mdiPublishOff,
|
1925
|
+
size: "sm"
|
1954
1926
|
})
|
1955
1927
|
}));
|
1956
1928
|
}
|
@@ -1965,8 +1937,14 @@ function TableRowActionsView({
|
|
1965
1937
|
const item = row.original;
|
1966
1938
|
return jsx("div", {
|
1967
1939
|
dflex: true,
|
1968
|
-
|
1940
|
+
w: "full",
|
1941
|
+
alignItems: "stretch",
|
1969
1942
|
placeContent: "end",
|
1943
|
+
h: "full",
|
1944
|
+
divideX: "1px",
|
1945
|
+
divideColor: "zinc-100",
|
1946
|
+
rounded: "lg",
|
1947
|
+
overflow: "hidden",
|
1970
1948
|
children: rowActions === null || rowActions === void 0 ? void 0 : rowActions.map((action, index) => jsxs(React.Fragment, {
|
1971
1949
|
children: [action.type === "publish" && jsx(TableRowPublishPostButton$1, {
|
1972
1950
|
id: item.id,
|
@@ -1979,7 +1957,8 @@ function TableRowActionsView({
|
|
1979
1957
|
onClick: () => onAction(action, item),
|
1980
1958
|
scheme: schemes$1[action.type],
|
1981
1959
|
children: jsx(Icon, {
|
1982
|
-
path: icons[action.type]
|
1960
|
+
path: icons[action.type],
|
1961
|
+
size: "sm"
|
1983
1962
|
})
|
1984
1963
|
})]
|
1985
1964
|
}, index))
|
@@ -1996,10 +1975,15 @@ function ActionButton$1(_a) {
|
|
1996
1975
|
onClick === null || onClick === void 0 ? void 0 : onClick(event);
|
1997
1976
|
}, [onClick]);
|
1998
1977
|
return jsx(Button, Object.assign({
|
1999
|
-
|
2000
|
-
|
1978
|
+
dflex: true,
|
1979
|
+
alignContent: "center",
|
1980
|
+
placeContent: "center",
|
1981
|
+
py: "2.5",
|
1982
|
+
px: "2",
|
1983
|
+
h: "full",
|
1984
|
+
size: "lg",
|
2001
1985
|
variant: "borderless",
|
2002
|
-
corners: "
|
1986
|
+
corners: "square",
|
2003
1987
|
onClick: handleClick
|
2004
1988
|
}, props));
|
2005
1989
|
}
|
@@ -2495,7 +2479,7 @@ function TableView(_a) {
|
|
2495
2479
|
const id = useId(queryField);
|
2496
2480
|
const _screen = runIfFn(screen, id);
|
2497
2481
|
return jsx(PageContainer, Object.assign({
|
2498
|
-
|
2482
|
+
bgColor: "white"
|
2499
2483
|
}, props, {
|
2500
2484
|
children: jsx(TableContainer, {
|
2501
2485
|
columns: _screen.table.columns,
|
@@ -2534,15 +2518,16 @@ function TT({
|
|
2534
2518
|
return jsxs(Fragment, {
|
2535
2519
|
children: [breadcrumbs && jsx(PageTopBar, {
|
2536
2520
|
breadcrumbs: breadcrumbs
|
2537
|
-
}),
|
2521
|
+
}), jsx(TableTopBar, {
|
2538
2522
|
title: title,
|
2539
|
-
|
2540
|
-
children: [jsx(ButtonBar, {
|
2523
|
+
children: jsx(ButtonBar, {
|
2541
2524
|
buttonBar: buttonBar,
|
2542
2525
|
createView: createView,
|
2543
2526
|
editView: editView,
|
2544
|
-
api: tableApi
|
2545
|
-
|
2527
|
+
api: tableApi,
|
2528
|
+
queryKey: tableApi.queryKey,
|
2529
|
+
children: filters && jsx(TableFilterButton, {})
|
2530
|
+
})
|
2546
2531
|
}), filters && jsx(TableFilters, {
|
2547
2532
|
form: filters.form,
|
2548
2533
|
initialValues: filters.initialValues,
|
@@ -2567,10 +2552,16 @@ function TT({
|
|
2567
2552
|
}
|
2568
2553
|
function ButtonBar({
|
2569
2554
|
buttonBar,
|
2555
|
+
queryKey,
|
2570
2556
|
createView,
|
2571
2557
|
editView,
|
2572
|
-
api
|
2558
|
+
api,
|
2559
|
+
children
|
2573
2560
|
}) {
|
2561
|
+
const invalidate = useInvalidateQuery(queryKey);
|
2562
|
+
useHotkeys('ctrl+r', () => invalidate(), {
|
2563
|
+
preventDefault: true
|
2564
|
+
}, [invalidate]);
|
2574
2565
|
const createDialog = React.useCallback(onClose => {
|
2575
2566
|
const view = createView !== null && createView !== void 0 ? createView : editView;
|
2576
2567
|
if (view.type == "customDialog") return view.render({
|
@@ -2582,14 +2573,30 @@ function ButtonBar({
|
|
2582
2573
|
invalidateQueryKey: api.queryKey
|
2583
2574
|
});
|
2584
2575
|
}, [editView, api]);
|
2585
|
-
return
|
2586
|
-
|
2576
|
+
return jsxs("div", {
|
2577
|
+
dflex: true,
|
2578
|
+
border: "1px",
|
2579
|
+
borderColor: "zinc-200",
|
2580
|
+
divideX: "1px",
|
2581
|
+
divideColor: "zinc-200",
|
2582
|
+
rounded: "lg",
|
2583
|
+
overflow: "hidden",
|
2584
|
+
children: [jsx(Button, {
|
2585
|
+
scheme: "dark",
|
2586
|
+
size: "sm",
|
2587
|
+
aspectRatio: "square",
|
2588
|
+
variant: "borderless",
|
2589
|
+
onClick: invalidate,
|
2590
|
+
children: jsx(Icon, {
|
2591
|
+
path: mdiRefresh
|
2592
|
+
})
|
2593
|
+
}), buttonBar && buttonBar.map((button, index) => jsxs(React.Fragment, {
|
2587
2594
|
children: [button.type === "create" && editView && jsx(TableCreateButton, {
|
2588
2595
|
buildDialog: createDialog
|
2589
2596
|
}), button.type === "invalidate" && jsx(InvalidateButton, {
|
2590
2597
|
pathOrPermalink: button.pathOrPermalink
|
2591
2598
|
}), button.type === "custom" && button.render()]
|
2592
|
-
}, index))
|
2599
|
+
}, index)), children]
|
2593
2600
|
});
|
2594
2601
|
}
|
2595
2602
|
function TableWrapper({
|
@@ -2611,6 +2618,8 @@ function TableWrapper({
|
|
2611
2618
|
};
|
2612
2619
|
}, [subtitle]);
|
2613
2620
|
return jsx(Table, Object.assign({}, tableProps, {
|
2621
|
+
px: "3",
|
2622
|
+
py: "3",
|
2614
2623
|
title: _subtitle
|
2615
2624
|
}));
|
2616
2625
|
}
|
package/package.json
CHANGED
@@ -12,6 +12,7 @@ type PageQueryContainerProps<T extends CRUD_MODEL> = Omit<ContainerProps, "child
|
|
12
12
|
children: (data: T) => React.ReactElement;
|
13
13
|
} | {
|
14
14
|
apiFn: "getAll";
|
15
|
+
apiParams?: any;
|
15
16
|
children: (data: T[]) => React.ReactElement;
|
16
17
|
}));
|
17
18
|
export declare const PageQueryStateContainer: <T extends CRUD_MODEL>(p: PageQueryContainerProps<T> & {
|
@@ -2,7 +2,6 @@
|
|
2
2
|
import { ParentComponent, SoperioComponent } from "@soperio/react";
|
3
3
|
interface TableTopBarProps extends SoperioComponent, ParentComponent {
|
4
4
|
title?: string;
|
5
|
-
queryKey: string[];
|
6
5
|
}
|
7
|
-
export declare function TableTopBar({ title,
|
6
|
+
export declare function TableTopBar({ title, children, ...props }: TableTopBarProps): JSX.Element;
|
8
7
|
export {};
|