@bsol-oss/react-datatable5 12.0.0-beta.0 → 12.0.0-beta.10
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 +54 -45
- package/dist/index.js +381 -311
- package/dist/index.mjs +378 -310
- package/dist/types/components/DataTable/DataTable.d.ts +1 -1
- package/dist/types/components/DataTable/DataTableServer.d.ts +1 -1
- package/dist/types/components/DataTable/DefaultTable.d.ts +5 -5
- package/dist/types/components/DataTable/components/TextCell.d.ts +10 -0
- package/dist/types/components/DataTable/context/DataTableContext.d.ts +2 -1
- package/dist/types/components/DataTable/controls/DensityFeature.d.ts +23 -0
- package/dist/types/components/DataTable/controls/DensityToggleButton.d.ts +6 -0
- package/dist/types/components/DataTable/controls/EditSortingButton.d.ts +7 -0
- package/dist/types/components/DataTable/controls/FilterDialog.d.ts +5 -0
- package/dist/types/components/DataTable/controls/PageSizeControl.d.ts +4 -0
- package/dist/types/components/DataTable/controls/Pagination.d.ts +1 -0
- package/dist/types/components/DataTable/controls/ReloadButton.d.ts +5 -0
- package/dist/types/components/DataTable/controls/ResetFilteringButton.d.ts +4 -0
- package/dist/types/components/DataTable/controls/ResetSelectionButton.d.ts +4 -0
- package/dist/types/components/DataTable/controls/ResetSortingButton.d.ts +4 -0
- package/dist/types/components/DataTable/controls/RowCountText.d.ts +1 -0
- package/dist/types/components/DataTable/controls/SelectAllRowsToggle.d.ts +8 -0
- package/dist/types/components/DataTable/controls/TableControls.d.ts +21 -0
- package/dist/types/components/DataTable/controls/TableFilterTags.d.ts +1 -0
- package/dist/types/components/DataTable/controls/TableFilters.d.ts +1 -0
- package/dist/types/components/DataTable/controls/TableSelector.d.ts +1 -0
- package/dist/types/components/DataTable/controls/TableSorter.d.ts +1 -0
- package/dist/types/components/DataTable/controls/TableViewer.d.ts +1 -0
- package/dist/types/components/DataTable/controls/ViewDialog.d.ts +5 -0
- package/dist/types/components/DataTable/display/CardHeader.d.ts +13 -0
- package/dist/types/components/DataTable/display/DataDisplay.d.ts +6 -0
- package/dist/types/components/DataTable/display/EmptyState.d.ts +5 -0
- package/dist/types/components/DataTable/display/ErrorAlert.d.ts +4 -0
- package/dist/types/components/DataTable/display/RecordDisplay.d.ts +9 -0
- package/dist/types/components/DataTable/display/Table.d.ts +10 -0
- package/dist/types/components/DataTable/display/TableBody.d.ts +21 -0
- package/dist/types/components/DataTable/display/TableCardContainer.d.ts +7 -0
- package/dist/types/components/DataTable/display/TableCards.d.ts +11 -0
- package/dist/types/components/DataTable/display/TableComponent.d.ts +6 -0
- package/dist/types/components/DataTable/display/TableDataDisplay.d.ts +4 -0
- package/dist/types/components/DataTable/display/TableFooter.d.ts +9 -0
- package/dist/types/components/DataTable/display/TableHeader.d.ts +13 -0
- package/dist/types/components/DataTable/display/TableLoadingComponent.d.ts +5 -0
- package/dist/types/components/DataTable/display/TextCell.d.ts +10 -0
- package/dist/types/components/DataTable/useDataTable.d.ts +1 -1
- package/dist/types/components/Form/SchemaFormContext.d.ts +13 -0
- package/dist/types/components/Form/components/core/DefaultForm.d.ts +7 -0
- package/dist/types/components/Form/components/core/FormBody.d.ts +1 -0
- package/dist/types/components/Form/components/core/FormRoot.d.ts +39 -0
- package/dist/types/components/Form/components/core/FormTitle.d.ts +1 -0
- package/dist/types/components/Form/components/core/SubmitButton.d.ts +1 -0
- package/dist/types/index.d.ts +37 -35
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -4,12 +4,13 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
4
4
|
var react = require('@chakra-ui/react');
|
|
5
5
|
var ai = require('react-icons/ai');
|
|
6
6
|
var React = require('react');
|
|
7
|
-
var md = require('react-icons/md');
|
|
8
7
|
var lu = require('react-icons/lu');
|
|
9
|
-
var
|
|
8
|
+
var md = require('react-icons/md');
|
|
10
9
|
var fa6 = require('react-icons/fa6');
|
|
11
10
|
var bi = require('react-icons/bi');
|
|
12
11
|
var cg = require('react-icons/cg');
|
|
12
|
+
var Dayzed = require('@bsol-oss/dayzed-react19');
|
|
13
|
+
var hi2 = require('react-icons/hi2');
|
|
13
14
|
var io = require('react-icons/io');
|
|
14
15
|
var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
|
|
15
16
|
var bindEventListener = require('bind-event-listener');
|
|
@@ -17,7 +18,7 @@ var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
|
17
18
|
var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
|
|
18
19
|
var rafSchd = require('raf-schd');
|
|
19
20
|
var invariant = require('tiny-invariant');
|
|
20
|
-
var
|
|
21
|
+
var hi = require('react-icons/hi');
|
|
21
22
|
var reactTable = require('@tanstack/react-table');
|
|
22
23
|
var matchSorterUtils = require('@tanstack/match-sorter-utils');
|
|
23
24
|
var bs = require('react-icons/bs');
|
|
@@ -25,7 +26,6 @@ var usehooks = require('@uidotdev/usehooks');
|
|
|
25
26
|
var reactQuery = require('@tanstack/react-query');
|
|
26
27
|
var io5 = require('react-icons/io5');
|
|
27
28
|
var gr = require('react-icons/gr');
|
|
28
|
-
var hi = require('react-icons/hi');
|
|
29
29
|
var reactI18next = require('react-i18next');
|
|
30
30
|
var axios = require('axios');
|
|
31
31
|
var reactHookForm = require('react-hook-form');
|
|
@@ -98,6 +98,32 @@ react.Dialog.Description;
|
|
|
98
98
|
const DialogTrigger = react.Dialog.Trigger;
|
|
99
99
|
react.Dialog.ActionTrigger;
|
|
100
100
|
|
|
101
|
+
const TableSorter = () => {
|
|
102
|
+
const { table } = useDataTableContext();
|
|
103
|
+
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: table.getHeaderGroups().map((headerGroup) => (jsxRuntime.jsx(jsxRuntime.Fragment, { children: headerGroup.headers.map((header) => {
|
|
104
|
+
const displayName = header.column.columnDef.meta === undefined
|
|
105
|
+
? header.column.id
|
|
106
|
+
: header.column.columnDef.meta.displayName;
|
|
107
|
+
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: header.column.getCanSort() && (jsxRuntime.jsxs(react.Flex, { alignItems: "center", gap: "0.5rem", padding: "0.5rem", children: [jsxRuntime.jsx(react.Text, { children: displayName }), jsxRuntime.jsxs(react.Button, { variant: "ghost", onClick: () => {
|
|
108
|
+
header.column.toggleSorting();
|
|
109
|
+
}, children: [header.column.getIsSorted() === false && jsxRuntime.jsx(fa6.FaUpDown, {}), header.column.getIsSorted() === "asc" && jsxRuntime.jsx(bi.BiDownArrow, {}), header.column.getIsSorted() === "desc" && jsxRuntime.jsx(bi.BiUpArrow, {})] }), header.column.getIsSorted() && (jsxRuntime.jsx(react.Button, { onClick: () => {
|
|
110
|
+
header.column.clearSorting();
|
|
111
|
+
}, children: jsxRuntime.jsx(cg.CgClose, {}) }))] })) }));
|
|
112
|
+
}) }))) }));
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
const ResetSortingButton = ({ text = "Reset Sorting", }) => {
|
|
116
|
+
const { table } = useDataTableContext();
|
|
117
|
+
return (jsxRuntime.jsx(react.Button, { onClick: () => {
|
|
118
|
+
table.resetSorting();
|
|
119
|
+
}, children: text }));
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
const EditSortingButton = ({ text, icon = jsxRuntime.jsx(md.MdOutlineSort, {}), title = "Edit Sorting", }) => {
|
|
123
|
+
const sortingModal = react.useDisclosure();
|
|
124
|
+
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsxs(DialogRoot, { size: ["full", "full", "md", "md"], children: [jsxRuntime.jsx(react.DialogBackdrop, {}), jsxRuntime.jsx(DialogTrigger, { children: jsxRuntime.jsxs(react.Button, { as: "div", variant: "ghost", onClick: sortingModal.onOpen, children: [icon, " ", text] }) }), jsxRuntime.jsxs(DialogContent, { children: [jsxRuntime.jsx(DialogCloseTrigger, {}), jsxRuntime.jsxs(DialogHeader, { children: [jsxRuntime.jsx(DialogTitle, {}), title] }), jsxRuntime.jsx(DialogBody, { children: jsxRuntime.jsxs(react.Flex, { flexFlow: "column", gap: "0.25rem", children: [jsxRuntime.jsx(TableSorter, {}), jsxRuntime.jsx(ResetSortingButton, {})] }) }), jsxRuntime.jsx(DialogFooter, {})] })] }) }));
|
|
125
|
+
};
|
|
126
|
+
|
|
101
127
|
const Radio = React__namespace.forwardRef(function Radio(props, ref) {
|
|
102
128
|
const { children, inputProps, rootRef, ...rest } = props;
|
|
103
129
|
return (jsxRuntime.jsxs(react.RadioGroup.Item, { ref: rootRef, ...rest, children: [jsxRuntime.jsx(react.RadioGroup.ItemHiddenInput, { ref: ref, ...inputProps }), jsxRuntime.jsx(react.RadioGroup.ItemIndicator, {}), children && (jsxRuntime.jsx(react.RadioGroup.ItemText, { children: children }))] }));
|
|
@@ -380,87 +406,138 @@ const FilterDialog = ({ icon = jsxRuntime.jsx(md.MdFilterAlt, {}), }) => {
|
|
|
380
406
|
return (jsxRuntime.jsxs(DialogRoot, { size: ["full", "full", "md", "md"], open: filterModal.open, children: [jsxRuntime.jsx(DialogTrigger, { asChild: true, children: jsxRuntime.jsxs(react.Button, { as: react.Box, variant: "ghost", onClick: filterModal.onOpen, children: [icon, " ", translate.t("filterDialog.buttonText")] }) }), jsxRuntime.jsxs(DialogContent, { children: [jsxRuntime.jsx(DialogHeader, { children: jsxRuntime.jsx(DialogTitle, { children: translate.t("filterDialog.title") }) }), jsxRuntime.jsx(DialogBody, { display: "flex", flexFlow: "column", children: jsxRuntime.jsx(TableFilter, {}) }), jsxRuntime.jsxs(DialogFooter, { children: [jsxRuntime.jsx(ResetFilteringButton, { text: translate.t("filterDialog.reset") }), jsxRuntime.jsx(react.Button, { onClick: filterModal.onClose, variant: "subtle", children: translate.t("filterDialog.close") })] }), jsxRuntime.jsx(DialogCloseTrigger, { onClick: filterModal.onClose })] })] }));
|
|
381
407
|
};
|
|
382
408
|
|
|
383
|
-
const
|
|
384
|
-
const
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
},
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
.map((column) => {
|
|
416
|
-
const displayName = column.columnDef.meta === undefined
|
|
417
|
-
? column.id
|
|
418
|
-
: column.columnDef.meta.displayName;
|
|
419
|
-
return jsxRuntime.jsx("span", { children: displayName }, column.id);
|
|
420
|
-
}), jsxRuntime.jsx(react.IconButton, { onClick: () => {
|
|
421
|
-
const nextIndex = index + 1;
|
|
422
|
-
if (nextIndex < order.length) {
|
|
423
|
-
handleChangeOrder(index, nextIndex);
|
|
424
|
-
}
|
|
425
|
-
}, disabled: index === order.length - 1, "aria-label": "", children: jsxRuntime.jsx(md.MdArrowDownward, {}) })] }, columnId))) }), jsxRuntime.jsxs(react.Flex, { gap: "0.25rem", children: [jsxRuntime.jsx(react.Button, { onClick: () => {
|
|
426
|
-
table.setColumnOrder(order);
|
|
427
|
-
}, children: "Apply" }), jsxRuntime.jsx(react.Button, { onClick: () => {
|
|
428
|
-
table.setColumnOrder(originalOrder);
|
|
429
|
-
}, children: "Reset" })] })] }));
|
|
430
|
-
};
|
|
431
|
-
const TableOrderer = () => {
|
|
409
|
+
const MenuContent = React__namespace.forwardRef(function MenuContent(props, ref) {
|
|
410
|
+
const { portalled = true, portalRef, ...rest } = props;
|
|
411
|
+
return (jsxRuntime.jsx(react.Portal, { disabled: !portalled, container: portalRef, children: jsxRuntime.jsx(react.Menu.Positioner, { children: jsxRuntime.jsx(react.Menu.Content, { ref: ref, ...rest }) }) }));
|
|
412
|
+
});
|
|
413
|
+
React__namespace.forwardRef(function MenuArrow(props, ref) {
|
|
414
|
+
return (jsxRuntime.jsx(react.Menu.Arrow, { ref: ref, ...props, children: jsxRuntime.jsx(react.Menu.ArrowTip, {}) }));
|
|
415
|
+
});
|
|
416
|
+
React__namespace.forwardRef(function MenuCheckboxItem(props, ref) {
|
|
417
|
+
return (jsxRuntime.jsxs(react.Menu.CheckboxItem, { ref: ref, ...props, children: [jsxRuntime.jsx(react.Menu.ItemIndicator, { hidden: false, children: jsxRuntime.jsx(lu.LuCheck, {}) }), props.children] }));
|
|
418
|
+
});
|
|
419
|
+
React__namespace.forwardRef(function MenuRadioItem(props, ref) {
|
|
420
|
+
const { children, ...rest } = props;
|
|
421
|
+
return (jsxRuntime.jsxs(react.Menu.RadioItem, { ps: "8", ref: ref, ...rest, children: [jsxRuntime.jsx(react.AbsoluteCenter, { axis: "horizontal", left: "4", asChild: true, children: jsxRuntime.jsx(react.Menu.ItemIndicator, { children: jsxRuntime.jsx(lu.LuCheck, {}) }) }), jsxRuntime.jsx(react.Menu.ItemText, { children: children })] }));
|
|
422
|
+
});
|
|
423
|
+
React__namespace.forwardRef(function MenuItemGroup(props, ref) {
|
|
424
|
+
const { title, children, ...rest } = props;
|
|
425
|
+
return (jsxRuntime.jsxs(react.Menu.ItemGroup, { ref: ref, ...rest, children: [title && (jsxRuntime.jsx(react.Menu.ItemGroupLabel, { userSelect: "none", children: title })), children] }));
|
|
426
|
+
});
|
|
427
|
+
React__namespace.forwardRef(function MenuTriggerItem(props, ref) {
|
|
428
|
+
const { startIcon, children, ...rest } = props;
|
|
429
|
+
return (jsxRuntime.jsxs(react.Menu.TriggerItem, { ref: ref, ...rest, children: [startIcon, children, jsxRuntime.jsx(lu.LuChevronRight, {})] }));
|
|
430
|
+
});
|
|
431
|
+
react.Menu.RadioItemGroup;
|
|
432
|
+
react.Menu.ContextTrigger;
|
|
433
|
+
const MenuRoot = react.Menu.Root;
|
|
434
|
+
react.Menu.Separator;
|
|
435
|
+
const MenuItem = react.Menu.Item;
|
|
436
|
+
react.Menu.ItemText;
|
|
437
|
+
react.Menu.ItemCommand;
|
|
438
|
+
const MenuTrigger = react.Menu.Trigger;
|
|
439
|
+
|
|
440
|
+
const PageSizeControl = ({ pageSizes = [10, 20, 30, 40, 50], }) => {
|
|
432
441
|
const { table } = useDataTableContext();
|
|
433
|
-
return (jsxRuntime.
|
|
442
|
+
return (jsxRuntime.jsxs(MenuRoot, { children: [jsxRuntime.jsx(MenuTrigger, { asChild: true, children: jsxRuntime.jsxs(react.Button, { variant: "ghost", gap: "0.5rem", children: [table.getState().pagination.pageSize, " ", jsxRuntime.jsx(bi.BiDownArrow, {})] }) }), jsxRuntime.jsx(MenuContent, { children: pageSizes.map((pageSize) => (jsxRuntime.jsx(MenuItem, { value: `chakra-table-pageSize-${pageSize}`, onClick: () => {
|
|
443
|
+
table.setPageSize(Number(pageSize));
|
|
444
|
+
}, children: pageSize }, `chakra-table-pageSize-${pageSize}`))) })] }));
|
|
434
445
|
};
|
|
435
446
|
|
|
436
|
-
const
|
|
437
|
-
|
|
447
|
+
const { withContext } = react.createRecipeContext({ key: "button" });
|
|
448
|
+
// Replace "a" with your framework's link component
|
|
449
|
+
const LinkButton = withContext("a");
|
|
450
|
+
|
|
451
|
+
const [RootPropsProvider, useRootProps] = react.createContext({
|
|
452
|
+
name: "RootPropsProvider",
|
|
453
|
+
});
|
|
454
|
+
const variantMap = {
|
|
455
|
+
outline: { default: "ghost", ellipsis: "plain", current: "outline" },
|
|
456
|
+
solid: { default: "outline", ellipsis: "outline", current: "solid" },
|
|
457
|
+
subtle: { default: "ghost", ellipsis: "plain", current: "subtle" },
|
|
458
|
+
};
|
|
459
|
+
const PaginationRoot = React__namespace.forwardRef(function PaginationRoot(props, ref) {
|
|
460
|
+
const { size = "sm", variant = "outline", getHref, ...rest } = props;
|
|
461
|
+
return (jsxRuntime.jsx(RootPropsProvider, { value: { size, variantMap: variantMap[variant], getHref }, children: jsxRuntime.jsx(react.Pagination.Root, { ref: ref, type: getHref ? "link" : "button", ...rest }) }));
|
|
462
|
+
});
|
|
463
|
+
const PaginationEllipsis = React__namespace.forwardRef(function PaginationEllipsis(props, ref) {
|
|
464
|
+
const { size, variantMap } = useRootProps();
|
|
465
|
+
return (jsxRuntime.jsx(react.Pagination.Ellipsis, { ref: ref, ...props, asChild: true, children: jsxRuntime.jsx(react.Button, { as: "span", variant: variantMap.ellipsis, size: size, children: jsxRuntime.jsx(hi2.HiMiniEllipsisHorizontal, {}) }) }));
|
|
466
|
+
});
|
|
467
|
+
const PaginationItem = React__namespace.forwardRef(function PaginationItem(props, ref) {
|
|
468
|
+
const { page } = react.usePaginationContext();
|
|
469
|
+
const { size, variantMap, getHref } = useRootProps();
|
|
470
|
+
const current = page === props.value;
|
|
471
|
+
const variant = current ? variantMap.current : variantMap.default;
|
|
472
|
+
if (getHref) {
|
|
473
|
+
return (jsxRuntime.jsx(LinkButton, { href: getHref(props.value), variant: variant, size: size, children: props.value }));
|
|
474
|
+
}
|
|
475
|
+
return (jsxRuntime.jsx(react.Pagination.Item, { ref: ref, ...props, asChild: true, children: jsxRuntime.jsx(react.Button, { variant: variant, size: size, children: props.value }) }));
|
|
476
|
+
});
|
|
477
|
+
const PaginationPrevTrigger = React__namespace.forwardRef(function PaginationPrevTrigger(props, ref) {
|
|
478
|
+
const { size, variantMap, getHref } = useRootProps();
|
|
479
|
+
const { previousPage } = react.usePaginationContext();
|
|
480
|
+
if (getHref) {
|
|
481
|
+
return (jsxRuntime.jsx(LinkButton, { href: previousPage != null ? getHref(previousPage) : undefined, variant: variantMap.default, size: size, children: jsxRuntime.jsx(hi2.HiChevronLeft, {}) }));
|
|
482
|
+
}
|
|
483
|
+
return (jsxRuntime.jsx(react.Pagination.PrevTrigger, { ref: ref, asChild: true, ...props, children: jsxRuntime.jsx(react.IconButton, { variant: variantMap.default, size: size, children: jsxRuntime.jsx(hi2.HiChevronLeft, {}) }) }));
|
|
484
|
+
});
|
|
485
|
+
const PaginationNextTrigger = React__namespace.forwardRef(function PaginationNextTrigger(props, ref) {
|
|
486
|
+
const { size, variantMap, getHref } = useRootProps();
|
|
487
|
+
const { nextPage } = react.usePaginationContext();
|
|
488
|
+
if (getHref) {
|
|
489
|
+
return (jsxRuntime.jsx(LinkButton, { href: nextPage != null ? getHref(nextPage) : undefined, variant: variantMap.default, size: size, children: jsxRuntime.jsx(hi2.HiChevronRight, {}) }));
|
|
490
|
+
}
|
|
491
|
+
return (jsxRuntime.jsx(react.Pagination.NextTrigger, { ref: ref, asChild: true, ...props, children: jsxRuntime.jsx(react.IconButton, { variant: variantMap.default, size: size, children: jsxRuntime.jsx(hi2.HiChevronRight, {}) }) }));
|
|
492
|
+
});
|
|
493
|
+
const PaginationItems = (props) => {
|
|
494
|
+
return (jsxRuntime.jsx(react.Pagination.Context, { children: ({ pages }) => pages.map((page, index) => {
|
|
495
|
+
return page.type === "ellipsis" ? (jsxRuntime.jsx(PaginationEllipsis, { index: index, ...props }, index)) : (jsxRuntime.jsx(PaginationItem, { type: "page", value: page.value, ...props }, index));
|
|
496
|
+
}) }));
|
|
438
497
|
};
|
|
498
|
+
const PaginationPageText = React__namespace.forwardRef(function PaginationPageText(props, ref) {
|
|
499
|
+
const { format = "compact", ...rest } = props;
|
|
500
|
+
const { page, totalPages, pageRange, count } = react.usePaginationContext();
|
|
501
|
+
const content = React__namespace.useMemo(() => {
|
|
502
|
+
if (format === "short")
|
|
503
|
+
return `${page} / ${totalPages}`;
|
|
504
|
+
if (format === "compact")
|
|
505
|
+
return `${page} / ${totalPages}`;
|
|
506
|
+
return `${pageRange.start + 1} - ${Math.min(pageRange.end, count)} / ${count}`;
|
|
507
|
+
}, [format, page, totalPages, pageRange, count]);
|
|
508
|
+
return (jsxRuntime.jsx(react.Text, { fontWeight: "medium", ref: ref, ...rest, children: content }));
|
|
509
|
+
});
|
|
439
510
|
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
511
|
+
// TODO: not working in client side
|
|
512
|
+
const Pagination = () => {
|
|
513
|
+
const { table, type } = useDataTableContext();
|
|
514
|
+
const getCount = () => {
|
|
515
|
+
if (type === "client") {
|
|
516
|
+
return table.getFilteredRowModel().flatRows.length ?? 0;
|
|
517
|
+
}
|
|
518
|
+
return table.getRowCount();
|
|
519
|
+
};
|
|
520
|
+
return (jsxRuntime.jsx(PaginationRoot, { page: table.getState().pagination.pageIndex + 1, count: getCount(), pageSize: table.getState().pagination.pageSize, onPageChange: (e) => {
|
|
521
|
+
table.setPageIndex(e.page - 1);
|
|
522
|
+
}, children: jsxRuntime.jsxs(react.HStack, { children: [jsxRuntime.jsx(PaginationPrevTrigger, {}), jsxRuntime.jsx(PaginationItems, {}), jsxRuntime.jsx(PaginationNextTrigger, {})] }) }));
|
|
452
523
|
};
|
|
453
524
|
|
|
454
|
-
const
|
|
525
|
+
const ResetSelectionButton = ({ text = "Reset Selection", }) => {
|
|
455
526
|
const { table } = useDataTableContext();
|
|
456
527
|
return (jsxRuntime.jsx(react.Button, { onClick: () => {
|
|
457
|
-
table.
|
|
528
|
+
table.resetRowSelection();
|
|
458
529
|
}, children: text }));
|
|
459
530
|
};
|
|
460
531
|
|
|
461
|
-
const
|
|
462
|
-
const
|
|
463
|
-
|
|
532
|
+
const RowCountText = () => {
|
|
533
|
+
const { table, type } = useDataTableContext();
|
|
534
|
+
const getCount = () => {
|
|
535
|
+
if (type === "client") {
|
|
536
|
+
return table.getFilteredRowModel().flatRows.length ?? 0;
|
|
537
|
+
}
|
|
538
|
+
return table.getRowCount();
|
|
539
|
+
};
|
|
540
|
+
return jsxRuntime.jsx(react.Text, { children: getCount() });
|
|
464
541
|
};
|
|
465
542
|
|
|
466
543
|
// pulling this into a separate file so adapter(s) that don't
|
|
@@ -2380,13 +2457,16 @@ function ColumnCard({ columnId }) {
|
|
|
2380
2457
|
onDrop: () => setDragging(false), // NEW
|
|
2381
2458
|
});
|
|
2382
2459
|
}, [columnId, table]);
|
|
2383
|
-
return (jsxRuntime.jsxs(react.Grid, { ref: ref, templateColumns: "auto 1fr", gap: "0.5rem", alignItems: "center", style: dragging ? { opacity: 0.4 } : {}, children: [jsxRuntime.jsx(react.Flex, { alignItems: "center", padding: "0", cursor:
|
|
2460
|
+
return (jsxRuntime.jsxs(react.Grid, { ref: ref, templateColumns: "auto 1fr", gap: "0.5rem", alignItems: "center", style: dragging ? { opacity: 0.4 } : {}, children: [jsxRuntime.jsx(react.Flex, { alignItems: "center", padding: "0", cursor: "grab", children: jsxRuntime.jsx(fa6.FaGripLinesVertical, { color: "gray.400" }) }), jsxRuntime.jsx(react.Flex, { justifyContent: "space-between", alignItems: "center", children: jsxRuntime.jsx(CheckboxCard, { variant: "surface", label: displayName, checked: column.getIsVisible(), onChange: column.getToggleVisibilityHandler() }) })] }));
|
|
2384
2461
|
}
|
|
2385
2462
|
function CardContainer({ location, children }) {
|
|
2386
2463
|
const ref = React.useRef(null);
|
|
2387
2464
|
const [isDraggedOver, setIsDraggedOver] = React.useState(false);
|
|
2388
2465
|
React.useEffect(() => {
|
|
2389
2466
|
const el = ref.current;
|
|
2467
|
+
if (el === null) {
|
|
2468
|
+
return;
|
|
2469
|
+
}
|
|
2390
2470
|
invariant(el);
|
|
2391
2471
|
return dropTargetForElements({
|
|
2392
2472
|
element: el,
|
|
@@ -2461,146 +2541,34 @@ const ViewDialog = ({ icon = jsxRuntime.jsx(io.IoMdEye, {}) }) => {
|
|
|
2461
2541
|
return (jsxRuntime.jsxs(DialogRoot, { children: [jsxRuntime.jsx(react.DialogBackdrop, {}), jsxRuntime.jsx(DialogTrigger, { asChild: true, children: jsxRuntime.jsxs(react.Button, { as: react.Box, variant: "ghost", onClick: viewModel.onOpen, children: [icon, " ", translate.t("viewDialog.buttonText")] }) }), jsxRuntime.jsxs(DialogContent, { children: [jsxRuntime.jsx(DialogCloseTrigger, {}), jsxRuntime.jsx(DialogHeader, { children: jsxRuntime.jsx(DialogTitle, { children: translate.t("viewDialog.title") }) }), jsxRuntime.jsx(DialogBody, { children: jsxRuntime.jsx(TableViewer, {}) }), jsxRuntime.jsx(DialogFooter, {})] })] }));
|
|
2462
2542
|
};
|
|
2463
2543
|
|
|
2464
|
-
const
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
}
|
|
2468
|
-
|
|
2469
|
-
return (jsxRuntime.jsx(react.
|
|
2470
|
-
});
|
|
2471
|
-
React__namespace.forwardRef(function MenuCheckboxItem(props, ref) {
|
|
2472
|
-
return (jsxRuntime.jsxs(react.Menu.CheckboxItem, { ref: ref, ...props, children: [jsxRuntime.jsx(react.Menu.ItemIndicator, { hidden: false, children: jsxRuntime.jsx(lu.LuCheck, {}) }), props.children] }));
|
|
2473
|
-
});
|
|
2474
|
-
React__namespace.forwardRef(function MenuRadioItem(props, ref) {
|
|
2475
|
-
const { children, ...rest } = props;
|
|
2476
|
-
return (jsxRuntime.jsxs(react.Menu.RadioItem, { ps: "8", ref: ref, ...rest, children: [jsxRuntime.jsx(react.AbsoluteCenter, { axis: "horizontal", left: "4", asChild: true, children: jsxRuntime.jsx(react.Menu.ItemIndicator, { children: jsxRuntime.jsx(lu.LuCheck, {}) }) }), jsxRuntime.jsx(react.Menu.ItemText, { children: children })] }));
|
|
2477
|
-
});
|
|
2478
|
-
React__namespace.forwardRef(function MenuItemGroup(props, ref) {
|
|
2479
|
-
const { title, children, ...rest } = props;
|
|
2480
|
-
return (jsxRuntime.jsxs(react.Menu.ItemGroup, { ref: ref, ...rest, children: [title && (jsxRuntime.jsx(react.Menu.ItemGroupLabel, { userSelect: "none", children: title })), children] }));
|
|
2481
|
-
});
|
|
2482
|
-
React__namespace.forwardRef(function MenuTriggerItem(props, ref) {
|
|
2483
|
-
const { startIcon, children, ...rest } = props;
|
|
2484
|
-
return (jsxRuntime.jsxs(react.Menu.TriggerItem, { ref: ref, ...rest, children: [startIcon, children, jsxRuntime.jsx(lu.LuChevronRight, {})] }));
|
|
2485
|
-
});
|
|
2486
|
-
react.Menu.RadioItemGroup;
|
|
2487
|
-
react.Menu.ContextTrigger;
|
|
2488
|
-
const MenuRoot = react.Menu.Root;
|
|
2489
|
-
react.Menu.Separator;
|
|
2490
|
-
const MenuItem = react.Menu.Item;
|
|
2491
|
-
react.Menu.ItemText;
|
|
2492
|
-
react.Menu.ItemCommand;
|
|
2493
|
-
const MenuTrigger = react.Menu.Trigger;
|
|
2494
|
-
|
|
2495
|
-
const PageSizeControl = ({ pageSizes = [10, 20, 30, 40, 50], }) => {
|
|
2496
|
-
const { table } = useDataTableContext();
|
|
2497
|
-
return (jsxRuntime.jsxs(MenuRoot, { children: [jsxRuntime.jsx(MenuTrigger, { asChild: true, children: jsxRuntime.jsxs(react.Button, { variant: "ghost", gap: "0.5rem", children: [table.getState().pagination.pageSize, " ", jsxRuntime.jsx(bi.BiDownArrow, {})] }) }), jsxRuntime.jsx(MenuContent, { children: pageSizes.map((pageSize) => (jsxRuntime.jsx(MenuItem, { value: `chakra-table-pageSize-${pageSize}`, onClick: () => {
|
|
2498
|
-
table.setPageSize(Number(pageSize));
|
|
2499
|
-
}, children: pageSize }, `chakra-table-pageSize-${pageSize}`))) })] }));
|
|
2500
|
-
};
|
|
2501
|
-
|
|
2502
|
-
const ResetSelectionButton = ({ text = "Reset Selection", }) => {
|
|
2503
|
-
const { table } = useDataTableContext();
|
|
2504
|
-
return (jsxRuntime.jsx(react.Button, { onClick: () => {
|
|
2505
|
-
table.resetRowSelection();
|
|
2506
|
-
}, children: text }));
|
|
2507
|
-
};
|
|
2508
|
-
|
|
2509
|
-
const RowCountText = () => {
|
|
2510
|
-
const { table, type } = useDataTableContext();
|
|
2511
|
-
const getCount = () => {
|
|
2512
|
-
if (type === "client") {
|
|
2513
|
-
return table.getFilteredRowModel().flatRows.length ?? 0;
|
|
2514
|
-
}
|
|
2515
|
-
return table.getRowCount();
|
|
2516
|
-
};
|
|
2517
|
-
return jsxRuntime.jsx(react.Text, { children: getCount() });
|
|
2544
|
+
const CardHeader = ({ row, imageColumnId = undefined, titleColumnId = undefined, tagColumnId = undefined, tagIcon = undefined, showTag = true, imageProps = {}, }) => {
|
|
2545
|
+
if (!!row.original === false) {
|
|
2546
|
+
return jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
2547
|
+
}
|
|
2548
|
+
const isShowFirstColumn = !!titleColumnId || showTag;
|
|
2549
|
+
return (jsxRuntime.jsxs(react.Grid, { templateRows: "auto auto", gap: "1rem", children: [!!imageColumnId && (jsxRuntime.jsx(react.Image, { width: "100%", src: row.original[imageColumnId], ...imageProps })), isShowFirstColumn && (jsxRuntime.jsxs(react.Flex, { gap: "0.5rem", flexFlow: "wrap", children: [!!titleColumnId && (jsxRuntime.jsx(react.Text, { fontWeight: "bold", fontSize: "large", children: row.original[titleColumnId] })), showTag && (jsxRuntime.jsx(Tag, { fontSize: "large", startElement: tagIcon && tagIcon({}), children: row.original[tagColumnId] }))] }))] }));
|
|
2518
2550
|
};
|
|
2519
2551
|
|
|
2520
|
-
const
|
|
2521
|
-
|
|
2522
|
-
const LinkButton = withContext("a");
|
|
2523
|
-
|
|
2524
|
-
const [RootPropsProvider, useRootProps] = react.createContext({
|
|
2525
|
-
name: "RootPropsProvider",
|
|
2526
|
-
});
|
|
2527
|
-
const variantMap = {
|
|
2528
|
-
outline: { default: "ghost", ellipsis: "plain", current: "outline" },
|
|
2529
|
-
solid: { default: "outline", ellipsis: "outline", current: "solid" },
|
|
2530
|
-
subtle: { default: "ghost", ellipsis: "plain", current: "subtle" },
|
|
2531
|
-
};
|
|
2532
|
-
const PaginationRoot = React__namespace.forwardRef(function PaginationRoot(props, ref) {
|
|
2533
|
-
const { size = "sm", variant = "outline", getHref, ...rest } = props;
|
|
2534
|
-
return (jsxRuntime.jsx(RootPropsProvider, { value: { size, variantMap: variantMap[variant], getHref }, children: jsxRuntime.jsx(react.Pagination.Root, { ref: ref, type: getHref ? "link" : "button", ...rest }) }));
|
|
2535
|
-
});
|
|
2536
|
-
const PaginationEllipsis = React__namespace.forwardRef(function PaginationEllipsis(props, ref) {
|
|
2537
|
-
const { size, variantMap } = useRootProps();
|
|
2538
|
-
return (jsxRuntime.jsx(react.Pagination.Ellipsis, { ref: ref, ...props, asChild: true, children: jsxRuntime.jsx(react.Button, { as: "span", variant: variantMap.ellipsis, size: size, children: jsxRuntime.jsx(hi2.HiMiniEllipsisHorizontal, {}) }) }));
|
|
2539
|
-
});
|
|
2540
|
-
const PaginationItem = React__namespace.forwardRef(function PaginationItem(props, ref) {
|
|
2541
|
-
const { page } = react.usePaginationContext();
|
|
2542
|
-
const { size, variantMap, getHref } = useRootProps();
|
|
2543
|
-
const current = page === props.value;
|
|
2544
|
-
const variant = current ? variantMap.current : variantMap.default;
|
|
2545
|
-
if (getHref) {
|
|
2546
|
-
return (jsxRuntime.jsx(LinkButton, { href: getHref(props.value), variant: variant, size: size, children: props.value }));
|
|
2547
|
-
}
|
|
2548
|
-
return (jsxRuntime.jsx(react.Pagination.Item, { ref: ref, ...props, asChild: true, children: jsxRuntime.jsx(react.Button, { variant: variant, size: size, children: props.value }) }));
|
|
2549
|
-
});
|
|
2550
|
-
const PaginationPrevTrigger = React__namespace.forwardRef(function PaginationPrevTrigger(props, ref) {
|
|
2551
|
-
const { size, variantMap, getHref } = useRootProps();
|
|
2552
|
-
const { previousPage } = react.usePaginationContext();
|
|
2553
|
-
if (getHref) {
|
|
2554
|
-
return (jsxRuntime.jsx(LinkButton, { href: previousPage != null ? getHref(previousPage) : undefined, variant: variantMap.default, size: size, children: jsxRuntime.jsx(hi2.HiChevronLeft, {}) }));
|
|
2555
|
-
}
|
|
2556
|
-
return (jsxRuntime.jsx(react.Pagination.PrevTrigger, { ref: ref, asChild: true, ...props, children: jsxRuntime.jsx(react.IconButton, { variant: variantMap.default, size: size, children: jsxRuntime.jsx(hi2.HiChevronLeft, {}) }) }));
|
|
2557
|
-
});
|
|
2558
|
-
const PaginationNextTrigger = React__namespace.forwardRef(function PaginationNextTrigger(props, ref) {
|
|
2559
|
-
const { size, variantMap, getHref } = useRootProps();
|
|
2560
|
-
const { nextPage } = react.usePaginationContext();
|
|
2561
|
-
if (getHref) {
|
|
2562
|
-
return (jsxRuntime.jsx(LinkButton, { href: nextPage != null ? getHref(nextPage) : undefined, variant: variantMap.default, size: size, children: jsxRuntime.jsx(hi2.HiChevronRight, {}) }));
|
|
2563
|
-
}
|
|
2564
|
-
return (jsxRuntime.jsx(react.Pagination.NextTrigger, { ref: ref, asChild: true, ...props, children: jsxRuntime.jsx(react.IconButton, { variant: variantMap.default, size: size, children: jsxRuntime.jsx(hi2.HiChevronRight, {}) }) }));
|
|
2552
|
+
const DataTableServerContext = React.createContext({
|
|
2553
|
+
url: "",
|
|
2565
2554
|
});
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2555
|
+
|
|
2556
|
+
const useDataTableServerContext = () => {
|
|
2557
|
+
const context = React.useContext(DataTableServerContext);
|
|
2558
|
+
const { query } = context;
|
|
2559
|
+
const isEmpty = (query.data?.count ?? 0) <= 0;
|
|
2560
|
+
return { ...context, isEmpty };
|
|
2570
2561
|
};
|
|
2571
|
-
const PaginationPageText = React__namespace.forwardRef(function PaginationPageText(props, ref) {
|
|
2572
|
-
const { format = "compact", ...rest } = props;
|
|
2573
|
-
const { page, totalPages, pageRange, count } = react.usePaginationContext();
|
|
2574
|
-
const content = React__namespace.useMemo(() => {
|
|
2575
|
-
if (format === "short")
|
|
2576
|
-
return `${page} / ${totalPages}`;
|
|
2577
|
-
if (format === "compact")
|
|
2578
|
-
return `${page} / ${totalPages}`;
|
|
2579
|
-
return `${pageRange.start + 1} - ${Math.min(pageRange.end, count)} / ${count}`;
|
|
2580
|
-
}, [format, page, totalPages, pageRange, count]);
|
|
2581
|
-
return (jsxRuntime.jsx(react.Text, { fontWeight: "medium", ref: ref, ...rest, children: content }));
|
|
2582
|
-
});
|
|
2583
2562
|
|
|
2584
|
-
|
|
2585
|
-
const
|
|
2586
|
-
|
|
2587
|
-
const getCount = () => {
|
|
2588
|
-
if (type === "client") {
|
|
2589
|
-
return table.getFilteredRowModel().flatRows.length ?? 0;
|
|
2590
|
-
}
|
|
2591
|
-
return table.getRowCount();
|
|
2592
|
-
};
|
|
2593
|
-
return (jsxRuntime.jsx(PaginationRoot, { page: table.getState().pagination.pageIndex + 1, count: getCount(), pageSize: table.getState().pagination.pageSize, onPageChange: (e) => {
|
|
2594
|
-
table.setPageIndex(e.page - 1);
|
|
2595
|
-
}, children: jsxRuntime.jsxs(react.HStack, { children: [jsxRuntime.jsx(PaginationPrevTrigger, {}), jsxRuntime.jsx(PaginationItems, {}), jsxRuntime.jsx(PaginationNextTrigger, {})] }) }));
|
|
2563
|
+
const EmptyState$1 = ({ title = "No records", description = "Add a new events to get started or refine your search", }) => {
|
|
2564
|
+
const { isEmpty } = useDataTableServerContext();
|
|
2565
|
+
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: isEmpty && (jsxRuntime.jsx(react.EmptyState.Root, { children: jsxRuntime.jsxs(react.EmptyState.Content, { children: [jsxRuntime.jsx(react.EmptyState.Indicator, { children: jsxRuntime.jsx(hi.HiColorSwatch, {}) }), jsxRuntime.jsxs(react.VStack, { textAlign: "center", children: [jsxRuntime.jsx(react.EmptyState.Title, { children: title }), jsxRuntime.jsx(react.EmptyState.Description, { children: description })] })] }) })) }));
|
|
2596
2566
|
};
|
|
2597
2567
|
|
|
2598
|
-
const
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
}
|
|
2602
|
-
const isShowFirstColumn = !!titleColumnId || showTag;
|
|
2603
|
-
return (jsxRuntime.jsxs(react.Grid, { templateRows: "auto auto", gap: "1rem", children: [!!imageColumnId && (jsxRuntime.jsx(react.Image, { width: "100%", src: row.original[imageColumnId], ...imageProps })), isShowFirstColumn && (jsxRuntime.jsxs(react.Flex, { gap: "0.5rem", flexFlow: "wrap", children: [!!titleColumnId && (jsxRuntime.jsx(react.Text, { fontWeight: "bold", fontSize: "large", children: row.original[titleColumnId] })), showTag && (jsxRuntime.jsx(Tag, { fontSize: "large", startElement: tagIcon && tagIcon({}), children: row.original[tagColumnId] }))] }))] }));
|
|
2568
|
+
const ErrorAlert = ({ showMessage = true }) => {
|
|
2569
|
+
const { query } = useDataTableServerContext();
|
|
2570
|
+
const { isError, error } = query;
|
|
2571
|
+
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: isError && (jsxRuntime.jsxs(react.Alert.Root, { status: "error", children: [jsxRuntime.jsx(react.Alert.Indicator, {}), jsxRuntime.jsxs(react.Alert.Content, { children: [jsxRuntime.jsx(react.Alert.Title, { children: error.name }), showMessage && (jsxRuntime.jsx(react.Alert.Description, { children: error.message }))] })] })) }));
|
|
2604
2572
|
};
|
|
2605
2573
|
|
|
2606
2574
|
const snakeToLabel = (str) => {
|
|
@@ -2846,13 +2814,25 @@ function DataTable({ columns, data, enableRowSelection = true, enableMultiRowSel
|
|
|
2846
2814
|
setGlobalFilter,
|
|
2847
2815
|
type: "client",
|
|
2848
2816
|
translate,
|
|
2817
|
+
columns,
|
|
2818
|
+
sorting,
|
|
2819
|
+
setSorting,
|
|
2820
|
+
columnFilters,
|
|
2821
|
+
setColumnFilters,
|
|
2822
|
+
pagination,
|
|
2823
|
+
setPagination,
|
|
2824
|
+
rowSelection,
|
|
2825
|
+
setRowSelection,
|
|
2826
|
+
columnOrder,
|
|
2827
|
+
setColumnOrder,
|
|
2828
|
+
density,
|
|
2829
|
+
setDensity,
|
|
2830
|
+
columnVisibility,
|
|
2831
|
+
setColumnVisibility,
|
|
2832
|
+
data,
|
|
2849
2833
|
}, children: children }));
|
|
2850
2834
|
}
|
|
2851
2835
|
|
|
2852
|
-
const DataTableServerContext = React.createContext({
|
|
2853
|
-
url: "",
|
|
2854
|
-
});
|
|
2855
|
-
|
|
2856
2836
|
/**
|
|
2857
2837
|
* DataTableServer will create a context to hold all values to
|
|
2858
2838
|
* help the render of the DataTable in serverside
|
|
@@ -2918,6 +2898,22 @@ function DataTableServer({ columns, enableRowSelection = true, enableMultiRowSel
|
|
|
2918
2898
|
setGlobalFilter,
|
|
2919
2899
|
type: "server",
|
|
2920
2900
|
translate,
|
|
2901
|
+
columns,
|
|
2902
|
+
sorting,
|
|
2903
|
+
setSorting,
|
|
2904
|
+
columnFilters,
|
|
2905
|
+
setColumnFilters,
|
|
2906
|
+
pagination,
|
|
2907
|
+
setPagination,
|
|
2908
|
+
rowSelection,
|
|
2909
|
+
setRowSelection,
|
|
2910
|
+
columnOrder,
|
|
2911
|
+
setColumnOrder,
|
|
2912
|
+
density,
|
|
2913
|
+
setDensity,
|
|
2914
|
+
columnVisibility,
|
|
2915
|
+
setColumnVisibility,
|
|
2916
|
+
data: query.data?.data ?? [],
|
|
2921
2917
|
}, children: jsxRuntime.jsx(DataTableServerContext.Provider, { value: { url, query }, children: children }) }));
|
|
2922
2918
|
}
|
|
2923
2919
|
|
|
@@ -2927,6 +2923,7 @@ const Checkbox = React__namespace.forwardRef(function Checkbox(props, ref) {
|
|
|
2927
2923
|
});
|
|
2928
2924
|
|
|
2929
2925
|
const TableBody = ({ pinnedBgColor = { light: "gray.50", dark: "gray.700" }, showSelector = false, alwaysShowSelector = true, canResize = true, }) => {
|
|
2926
|
+
"use no memo";
|
|
2930
2927
|
const { table } = useDataTableContext();
|
|
2931
2928
|
const SELECTION_BOX_WIDTH = 20;
|
|
2932
2929
|
const [hoveredRow, setHoveredRow] = React.useState(-1);
|
|
@@ -3036,13 +3033,6 @@ const GlobalFilter = () => {
|
|
|
3036
3033
|
} }) }) }));
|
|
3037
3034
|
};
|
|
3038
3035
|
|
|
3039
|
-
const useDataTableServerContext = () => {
|
|
3040
|
-
const context = React.useContext(DataTableServerContext);
|
|
3041
|
-
const { query } = context;
|
|
3042
|
-
const isEmpty = (query.data?.count ?? 0) <= 0;
|
|
3043
|
-
return { ...context, isEmpty };
|
|
3044
|
-
};
|
|
3045
|
-
|
|
3046
3036
|
const ReloadButton = ({ text = "Reload", variant = "icon", }) => {
|
|
3047
3037
|
const { url } = useDataTableServerContext();
|
|
3048
3038
|
const queryClient = reactQuery.useQueryClient();
|
|
@@ -3256,12 +3246,12 @@ const TableHeader = ({ canResize = true, pinnedBgColor = { light: "gray.50", dar
|
|
|
3256
3246
|
})] }, `chakra-table-headergroup-${headerGroup.id}`))) }));
|
|
3257
3247
|
};
|
|
3258
3248
|
|
|
3259
|
-
const EmptyState
|
|
3249
|
+
const EmptyState = React__namespace.forwardRef(function EmptyState(props, ref) {
|
|
3260
3250
|
const { title, description, icon, children, ...rest } = props;
|
|
3261
3251
|
return (jsxRuntime.jsx(react.EmptyState.Root, { ref: ref, ...rest, children: jsxRuntime.jsxs(react.EmptyState.Content, { children: [icon && (jsxRuntime.jsx(react.EmptyState.Indicator, { children: icon })), description ? (jsxRuntime.jsxs(react.VStack, { textAlign: "center", children: [jsxRuntime.jsx(react.EmptyState.Title, { children: title }), jsxRuntime.jsx(react.EmptyState.Description, { children: description })] })) : (jsxRuntime.jsx(react.EmptyState.Title, { children: title })), children] }) }));
|
|
3262
3252
|
});
|
|
3263
3253
|
|
|
3264
|
-
const EmptyResult = (jsxRuntime.jsx(EmptyState
|
|
3254
|
+
const EmptyResult = (jsxRuntime.jsx(EmptyState, { icon: jsxRuntime.jsx(hi.HiColorSwatch, {}), title: "No results found", description: "Try adjusting your search", children: jsxRuntime.jsxs(react.List.Root, { variant: "marker", children: [jsxRuntime.jsx(react.List.Item, { children: "Try removing filters" }), jsxRuntime.jsx(react.List.Item, { children: "Try different keywords" })] }) }));
|
|
3265
3255
|
const Table = ({ children, emptyComponent = EmptyResult, canResize = true, ...props }) => {
|
|
3266
3256
|
const { table } = useDataTableContext();
|
|
3267
3257
|
if (table.getRowModel().rows.length <= 0) {
|
|
@@ -3530,16 +3520,75 @@ const getColumns = ({ schema, include = [], ignore = [], width = [], meta = {},
|
|
|
3530
3520
|
return columns;
|
|
3531
3521
|
};
|
|
3532
3522
|
|
|
3533
|
-
const
|
|
3534
|
-
const {
|
|
3535
|
-
|
|
3523
|
+
const TableDataDisplay = ({ colorPalette }) => {
|
|
3524
|
+
const { table, columns, translate, data } = useDataTableContext();
|
|
3525
|
+
const columnDef = table._getColumnDefs();
|
|
3526
|
+
console.log(columnDef, "glp");
|
|
3527
|
+
console.log(columnDef, columns, table.getState().columnOrder, data, "glp");
|
|
3528
|
+
const columnsMap = Object.fromEntries(columns.map((def) => {
|
|
3529
|
+
const { accessorKey, id } = def;
|
|
3530
|
+
if (accessorKey) {
|
|
3531
|
+
return [accessorKey, def];
|
|
3532
|
+
}
|
|
3533
|
+
return [id, def];
|
|
3534
|
+
}));
|
|
3535
|
+
const columnHeaders = Object.keys(columnsMap);
|
|
3536
|
+
const totalWidths = columns
|
|
3537
|
+
.map(({ size }) => {
|
|
3538
|
+
if (!!size === false) {
|
|
3539
|
+
return 0;
|
|
3540
|
+
}
|
|
3541
|
+
if (typeof size === "number") {
|
|
3542
|
+
return size;
|
|
3543
|
+
}
|
|
3544
|
+
return 0;
|
|
3545
|
+
})
|
|
3546
|
+
.reduce((previous, current) => previous + current, 0);
|
|
3547
|
+
const columnWidths = columns
|
|
3548
|
+
.map(({ size }) => {
|
|
3549
|
+
if (!!size === false) {
|
|
3550
|
+
return "1fr";
|
|
3551
|
+
}
|
|
3552
|
+
return `minmax(${size}px, ${(size / totalWidths) * 100}%)`;
|
|
3553
|
+
})
|
|
3554
|
+
.join(" ");
|
|
3555
|
+
console.log({ columnWidths }, "hadfg");
|
|
3556
|
+
const cellProps = {
|
|
3557
|
+
flex: "1 0 0%",
|
|
3558
|
+
overflow: "auto",
|
|
3559
|
+
paddingX: "2",
|
|
3560
|
+
py: "1",
|
|
3561
|
+
borderBottomColor: { base: "colorPalette.200", _dark: "colorPalette.800" },
|
|
3562
|
+
borderBottomWidth: "1px",
|
|
3563
|
+
...{ colorPalette },
|
|
3564
|
+
};
|
|
3565
|
+
return (jsxRuntime.jsxs(react.Grid, { templateColumns: `${columnWidths}`, overflow: "auto", borderWidth: "1px", borderColor: { base: "colorPalette.200", _dark: "colorPalette.800" }, colorPalette, children: [jsxRuntime.jsx(react.Grid, { templateColumns: `${columnWidths}`, column: `1/span ${columns.length}`, bg: { base: "colorPalette.200", _dark: "colorPalette.800" }, colorPalette, children: columnHeaders.map((header) => {
|
|
3566
|
+
return (jsxRuntime.jsx(react.Box, { flex: "1 0 0%", paddingX: "2", py: "1", overflow: "auto", textOverflow: "ellipsis", children: translate.t(`column_header.${header}`) }));
|
|
3567
|
+
}) }), data.map((record) => {
|
|
3568
|
+
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: columnHeaders.map((header) => {
|
|
3569
|
+
if (!!record === false) {
|
|
3570
|
+
return (jsxRuntime.jsx(react.Box, { ...cellProps, children: translate.t(`column_cell.placeholder`) }));
|
|
3571
|
+
}
|
|
3572
|
+
if (!!record[header] === false) {
|
|
3573
|
+
return (jsxRuntime.jsx(react.Box, { ...cellProps, children: translate.t(`column_cell.placeholder`) }));
|
|
3574
|
+
}
|
|
3575
|
+
if (typeof record[header] === "object") {
|
|
3576
|
+
return (jsxRuntime.jsx(react.Box, { ...cellProps, children: jsxRuntime.jsx(RecordDisplay, { object: record[header] }) }));
|
|
3577
|
+
}
|
|
3578
|
+
return jsxRuntime.jsx(react.Box, { ...cellProps, children: record[header] ?? "" });
|
|
3579
|
+
}) }));
|
|
3580
|
+
})] }));
|
|
3536
3581
|
};
|
|
3537
3582
|
|
|
3538
|
-
const
|
|
3539
|
-
const {
|
|
3540
|
-
|
|
3541
|
-
|
|
3542
|
-
|
|
3583
|
+
const AccordionItemTrigger = React__namespace.forwardRef(function AccordionItemTrigger(props, ref) {
|
|
3584
|
+
const { children, indicatorPlacement = "end", ...rest } = props;
|
|
3585
|
+
return (jsxRuntime.jsxs(react.Accordion.ItemTrigger, { ...rest, ref: ref, children: [indicatorPlacement === "start" && (jsxRuntime.jsx(react.Accordion.ItemIndicator, { rotate: { base: "-90deg", _open: "0deg" }, children: jsxRuntime.jsx(lu.LuChevronDown, {}) })), jsxRuntime.jsx(react.HStack, { gap: "4", flex: "1", textAlign: "start", width: "full", children: children }), indicatorPlacement === "end" && (jsxRuntime.jsx(react.Accordion.ItemIndicator, { children: jsxRuntime.jsx(lu.LuChevronDown, {}) }))] }));
|
|
3586
|
+
});
|
|
3587
|
+
const AccordionItemContent = React__namespace.forwardRef(function AccordionItemContent(props, ref) {
|
|
3588
|
+
return (jsxRuntime.jsx(react.Accordion.ItemContent, { children: jsxRuntime.jsx(react.Accordion.ItemBody, { ...props, ref: ref }) }));
|
|
3589
|
+
});
|
|
3590
|
+
const AccordionRoot = react.Accordion.Root;
|
|
3591
|
+
const AccordionItem = react.Accordion.Item;
|
|
3543
3592
|
|
|
3544
3593
|
//@ts-expect-error TODO: find appropriate type
|
|
3545
3594
|
const SchemaFormContext = React.createContext({
|
|
@@ -3562,15 +3611,56 @@ const clearEmptyString = (object) => {
|
|
|
3562
3611
|
return Object.fromEntries(Object.entries(object).filter(([, value]) => value !== ""));
|
|
3563
3612
|
};
|
|
3564
3613
|
|
|
3565
|
-
const
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
}
|
|
3569
|
-
const
|
|
3570
|
-
|
|
3571
|
-
});
|
|
3572
|
-
|
|
3573
|
-
|
|
3614
|
+
const idPickerSanityCheck = (column, foreign_key) => {
|
|
3615
|
+
if (!!foreign_key == false) {
|
|
3616
|
+
throw new Error(`The key foreign_key does not exist in properties of column ${column} when using id-picker.`);
|
|
3617
|
+
}
|
|
3618
|
+
const { table, column: foreignKeyColumn, display_column } = foreign_key;
|
|
3619
|
+
if (!!table == false) {
|
|
3620
|
+
throw new Error(`The key table does not exist in properties of column ${table} when using id-picker.`);
|
|
3621
|
+
}
|
|
3622
|
+
if (!!display_column == false) {
|
|
3623
|
+
throw new Error(`The key display_column does not exist in properties of column ${column} when using id-picker.`);
|
|
3624
|
+
}
|
|
3625
|
+
if (!!foreignKeyColumn == false) {
|
|
3626
|
+
throw new Error(`The key column does not exist in properties of column ${column} when using id-picker.`);
|
|
3627
|
+
}
|
|
3628
|
+
};
|
|
3629
|
+
const FormRoot = ({ schema, idMap, setIdMap, form, serverUrl, translate, children, order = [], ignore = [], include = [], onSubmit = undefined, rowNumber = undefined, requestOptions = {}, getUpdatedData = () => { }, }) => {
|
|
3630
|
+
const [isSuccess, setIsSuccess] = React.useState(false);
|
|
3631
|
+
const [isError, setIsError] = React.useState(false);
|
|
3632
|
+
const [isSubmiting, setIsSubmiting] = React.useState(false);
|
|
3633
|
+
const [isConfirming, setIsConfirming] = React.useState(false);
|
|
3634
|
+
const [validatedData, setValidatedData] = React.useState();
|
|
3635
|
+
const [error, setError] = React.useState();
|
|
3636
|
+
return (jsxRuntime.jsx(SchemaFormContext.Provider, { value: {
|
|
3637
|
+
schema,
|
|
3638
|
+
serverUrl,
|
|
3639
|
+
order,
|
|
3640
|
+
ignore,
|
|
3641
|
+
include,
|
|
3642
|
+
// @ts-expect-error TODO: find appropriate types
|
|
3643
|
+
onSubmit,
|
|
3644
|
+
rowNumber,
|
|
3645
|
+
idMap,
|
|
3646
|
+
setIdMap,
|
|
3647
|
+
translate,
|
|
3648
|
+
requestOptions,
|
|
3649
|
+
isSuccess,
|
|
3650
|
+
setIsSuccess,
|
|
3651
|
+
isError,
|
|
3652
|
+
setIsError,
|
|
3653
|
+
isSubmiting,
|
|
3654
|
+
setIsSubmiting,
|
|
3655
|
+
isConfirming,
|
|
3656
|
+
setIsConfirming,
|
|
3657
|
+
validatedData,
|
|
3658
|
+
setValidatedData,
|
|
3659
|
+
error,
|
|
3660
|
+
setError,
|
|
3661
|
+
getUpdatedData,
|
|
3662
|
+
}, children: jsxRuntime.jsx(reactHookForm.FormProvider, { ...form, children: children }) }));
|
|
3663
|
+
};
|
|
3574
3664
|
|
|
3575
3665
|
function removeIndex(str) {
|
|
3576
3666
|
return str.replace(/\.\d+\./g, '.');
|
|
@@ -3721,10 +3811,11 @@ const DatePicker = ({ column, schema, prefix }) => {
|
|
|
3721
3811
|
const colLabel = `${prefix}${column}`;
|
|
3722
3812
|
const [open, setOpen] = React.useState(false);
|
|
3723
3813
|
const selectedDate = watch(colLabel);
|
|
3814
|
+
const formatedDate = dayjs(selectedDate).format("YYYY-MM-DD");
|
|
3724
3815
|
return (jsxRuntime.jsxs(Field, { label: `${translate.t(removeIndex(`${colLabel}.fieldLabel`))}`, required: isRequired, alignItems: "stretch", gridColumn,
|
|
3725
3816
|
gridRow, children: [jsxRuntime.jsxs(PopoverRoot, { open: open, onOpenChange: (e) => setOpen(e.open), closeOnInteractOutside: true, children: [jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: jsxRuntime.jsx(Button, { size: "sm", variant: "outline", onClick: () => {
|
|
3726
3817
|
setOpen(true);
|
|
3727
|
-
}, children: selectedDate !== undefined ?
|
|
3818
|
+
}, children: selectedDate !== undefined ? `${formatedDate}` : "" }) }), jsxRuntime.jsx(PopoverContent, { children: jsxRuntime.jsxs(PopoverBody, { children: [jsxRuntime.jsx(PopoverTitle, {}), jsxRuntime.jsx(DatePicker$1
|
|
3728
3819
|
// @ts-expect-error TODO: find appropriate types
|
|
3729
3820
|
, {
|
|
3730
3821
|
// @ts-expect-error TODO: find appropriate types
|
|
@@ -4206,7 +4297,7 @@ const getTableData = async ({ serverUrl, in_table, searching = "", where = [], l
|
|
|
4206
4297
|
|
|
4207
4298
|
const IdPicker = ({ column, schema, prefix, isMultiple = false, }) => {
|
|
4208
4299
|
const { watch, formState: { errors }, setValue, } = reactHookForm.useFormContext();
|
|
4209
|
-
const { serverUrl, idMap, setIdMap, translate } = useSchemaContext();
|
|
4300
|
+
const { serverUrl, idMap, setIdMap, translate, schema: parentSchema, } = useSchemaContext();
|
|
4210
4301
|
const { required, gridColumn, gridRow, renderDisplay, foreign_key } = schema;
|
|
4211
4302
|
const isRequired = required?.some((columnId) => columnId === column);
|
|
4212
4303
|
const { table, column: column_ref, display_column, } = foreign_key;
|
|
@@ -4249,7 +4340,10 @@ const IdPicker = ({ column, schema, prefix, isMultiple = false, }) => {
|
|
|
4249
4340
|
const watchId = watch(colLabel);
|
|
4250
4341
|
const watchIds = (watch(colLabel) ?? []);
|
|
4251
4342
|
reactQuery.useQuery({
|
|
4252
|
-
queryKey: [
|
|
4343
|
+
queryKey: [
|
|
4344
|
+
`idpicker`,
|
|
4345
|
+
{ form: parentSchema.title, column, searchText, limit, page },
|
|
4346
|
+
],
|
|
4253
4347
|
queryFn: async () => {
|
|
4254
4348
|
const data = await getTableData({
|
|
4255
4349
|
serverUrl,
|
|
@@ -4271,7 +4365,6 @@ const IdPicker = ({ column, schema, prefix, isMultiple = false, }) => {
|
|
|
4271
4365
|
});
|
|
4272
4366
|
return data;
|
|
4273
4367
|
},
|
|
4274
|
-
staleTime: 300000,
|
|
4275
4368
|
});
|
|
4276
4369
|
const onSearchChange = async (event) => {
|
|
4277
4370
|
setSearchText(event.target.value);
|
|
@@ -4925,30 +5018,23 @@ const ColumnViewer = ({ column, properties, prefix, }) => {
|
|
|
4925
5018
|
return jsxRuntime.jsx(SchemaViewer, { schema: colSchema, prefix, column });
|
|
4926
5019
|
};
|
|
4927
5020
|
|
|
4928
|
-
const
|
|
4929
|
-
|
|
4930
|
-
|
|
4931
|
-
|
|
4932
|
-
const
|
|
4933
|
-
|
|
4934
|
-
|
|
4935
|
-
|
|
4936
|
-
|
|
4937
|
-
|
|
4938
|
-
|
|
4939
|
-
|
|
4940
|
-
throw new Error(`The key column does not exist in properties of column ${column} when using id-picker.`);
|
|
4941
|
-
}
|
|
5021
|
+
const SubmitButton = () => {
|
|
5022
|
+
const { translate, setValidatedData, setIsError, setIsConfirming } = useSchemaContext();
|
|
5023
|
+
const methods = reactHookForm.useFormContext();
|
|
5024
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5025
|
+
const onValid = (data) => {
|
|
5026
|
+
setValidatedData(data);
|
|
5027
|
+
setIsError(false);
|
|
5028
|
+
setIsConfirming(true);
|
|
5029
|
+
};
|
|
5030
|
+
return (jsxRuntime.jsx(react.Button, { onClick: () => {
|
|
5031
|
+
methods.handleSubmit(onValid)();
|
|
5032
|
+
}, formNoValidate: true, children: translate.t("submit") }));
|
|
4942
5033
|
};
|
|
4943
|
-
|
|
4944
|
-
|
|
5034
|
+
|
|
5035
|
+
const FormBody = () => {
|
|
5036
|
+
const { schema, requestUrl, order, ignore, include, onSubmit, rowNumber, translate, requestOptions, isSuccess, setIsSuccess, isError, setIsError, isSubmiting, setIsSubmiting, isConfirming, setIsConfirming, validatedData, setValidatedData, error, setError, getUpdatedData, } = useSchemaContext();
|
|
4945
5037
|
const methods = reactHookForm.useFormContext();
|
|
4946
|
-
const [isSuccess, setIsSuccess] = React.useState(false);
|
|
4947
|
-
const [isError, setIsError] = React.useState(false);
|
|
4948
|
-
const [isSubmiting, setIsSubmiting] = React.useState(false);
|
|
4949
|
-
const [isConfirming, setIsConfirming] = React.useState(false);
|
|
4950
|
-
const [validatedData, setValidatedData] = React.useState();
|
|
4951
|
-
const [error, setError] = React.useState();
|
|
4952
5038
|
const { properties } = schema;
|
|
4953
5039
|
const onBeforeSubmit = () => {
|
|
4954
5040
|
setIsSubmiting(true);
|
|
@@ -4956,8 +5042,9 @@ const FormInternal = () => {
|
|
|
4956
5042
|
const onAfterSubmit = () => {
|
|
4957
5043
|
setIsSubmiting(false);
|
|
4958
5044
|
};
|
|
4959
|
-
const onSubmitError = () => {
|
|
5045
|
+
const onSubmitError = (error) => {
|
|
4960
5046
|
setIsError(true);
|
|
5047
|
+
setError(error);
|
|
4961
5048
|
};
|
|
4962
5049
|
const onSubmitSuccess = () => {
|
|
4963
5050
|
setIsSuccess(true);
|
|
@@ -4969,9 +5056,7 @@ const FormInternal = () => {
|
|
|
4969
5056
|
onSubmitSuccess();
|
|
4970
5057
|
}
|
|
4971
5058
|
catch (error) {
|
|
4972
|
-
|
|
4973
|
-
setError(error);
|
|
4974
|
-
onSubmitError();
|
|
5059
|
+
onSubmitError(error);
|
|
4975
5060
|
}
|
|
4976
5061
|
finally {
|
|
4977
5062
|
onAfterSubmit();
|
|
@@ -4994,12 +5079,6 @@ const FormInternal = () => {
|
|
|
4994
5079
|
}
|
|
4995
5080
|
await defaultOnSubmit(onSubmit(data));
|
|
4996
5081
|
};
|
|
4997
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4998
|
-
const onValid = (data) => {
|
|
4999
|
-
setValidatedData(data);
|
|
5000
|
-
setIsError(false);
|
|
5001
|
-
setIsConfirming(true);
|
|
5002
|
-
};
|
|
5003
5082
|
const renderColumns = ({ order, keys, ignore, include, }) => {
|
|
5004
5083
|
const included = include.length > 0 ? include : keys;
|
|
5005
5084
|
const not_exist = included.filter((columnA) => !order.some((columnB) => columnA === columnB));
|
|
@@ -5014,58 +5093,47 @@ const FormInternal = () => {
|
|
|
5014
5093
|
include,
|
|
5015
5094
|
});
|
|
5016
5095
|
if (isSuccess) {
|
|
5017
|
-
return (jsxRuntime.jsxs(react.
|
|
5096
|
+
return (jsxRuntime.jsxs(react.Flex, { flexFlow: "column", gap: "2", children: [jsxRuntime.jsxs(react.Alert.Root, { status: "success", children: [jsxRuntime.jsx(react.Alert.Indicator, {}), jsxRuntime.jsx(react.Alert.Title, { children: translate.t("submitSuccess") })] }), jsxRuntime.jsx(react.Flex, { justifyContent: "end", children: jsxRuntime.jsx(react.Button, { onClick: async () => {
|
|
5018
5097
|
setIsError(false);
|
|
5019
5098
|
setIsSubmiting(false);
|
|
5020
5099
|
setIsSuccess(false);
|
|
5021
5100
|
setIsConfirming(false);
|
|
5022
5101
|
setValidatedData(undefined);
|
|
5023
|
-
|
|
5102
|
+
const data = await getUpdatedData();
|
|
5103
|
+
methods.reset(data);
|
|
5024
5104
|
}, formNoValidate: true, children: translate.t("submitAgain") }) })] }));
|
|
5025
5105
|
}
|
|
5026
5106
|
if (isConfirming) {
|
|
5027
|
-
return (jsxRuntime.jsxs(react.
|
|
5107
|
+
return (jsxRuntime.jsxs(react.Flex, { flexFlow: "column", gap: "2", children: [jsxRuntime.jsx(react.Grid, { gap: 4, gridTemplateColumns: "repeat(12, 1fr)", gridTemplateRows: `repeat(${rowNumber ?? "auto-fit"}, auto)`, children: ordered.map((column) => {
|
|
5028
5108
|
return (jsxRuntime.jsx(ColumnViewer
|
|
5029
5109
|
// @ts-expect-error find suitable types
|
|
5030
5110
|
, {
|
|
5031
5111
|
// @ts-expect-error find suitable types
|
|
5032
5112
|
properties: properties, prefix: ``, column }, `form-viewer-${column}`));
|
|
5033
|
-
}) }), jsxRuntime.jsxs(react.Flex, { justifyContent: "end", gap: "2", children: [jsxRuntime.jsx(Button, { onClick: () => {
|
|
5113
|
+
}) }), jsxRuntime.jsxs(react.Flex, { justifyContent: "end", gap: "2", children: [jsxRuntime.jsx(react.Button, { onClick: () => {
|
|
5034
5114
|
setIsConfirming(false);
|
|
5035
|
-
}, variant: "subtle", children: translate.t("cancel") }), jsxRuntime.jsx(Button, { onClick: () => {
|
|
5115
|
+
}, variant: "subtle", children: translate.t("cancel") }), jsxRuntime.jsx(react.Button, { onClick: () => {
|
|
5036
5116
|
onFormSubmit(validatedData);
|
|
5037
|
-
}, children: translate.t("confirm") })] }), isSubmiting && (jsxRuntime.jsx(react.Box, { pos: "absolute", inset: "0", bg: "bg/80", children: jsxRuntime.jsx(react.Center, { h: "full", children: jsxRuntime.jsx(react.Spinner, { color: "teal.500" }) }) })), isError && (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsx(react.Alert.Root, { status: "error", children: jsxRuntime.jsx(react.Alert.Title, { children: jsxRuntime.jsx(AccordionRoot, { collapsible: true, defaultValue: [
|
|
5117
|
+
}, children: translate.t("confirm") })] }), isSubmiting && (jsxRuntime.jsx(react.Box, { pos: "absolute", inset: "0", bg: "bg/80", children: jsxRuntime.jsx(react.Center, { h: "full", children: jsxRuntime.jsx(react.Spinner, { color: "teal.500" }) }) })), isError && (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsx(react.Alert.Root, { status: "error", children: jsxRuntime.jsx(react.Alert.Title, { children: jsxRuntime.jsx(AccordionRoot, { collapsible: true, defaultValue: [], children: jsxRuntime.jsxs(AccordionItem, { value: "b", children: [jsxRuntime.jsxs(AccordionItemTrigger, { children: [jsxRuntime.jsx(react.Alert.Indicator, {}), `${error}`] }), jsxRuntime.jsx(AccordionItemContent, { children: `${JSON.stringify(error)}` })] }) }) }) }) }))] }));
|
|
5038
5118
|
}
|
|
5039
|
-
return (jsxRuntime.
|
|
5040
|
-
|
|
5119
|
+
return (jsxRuntime.jsxs(react.Flex, { flexFlow: "column", gap: "2", children: [jsxRuntime.jsx(react.Grid, { gap: "4", gridTemplateColumns: "repeat(12, 1fr)", gridTemplateRows: `repeat(${rowNumber ?? "auto-fit"}, auto)`, children: ordered.map((column) => {
|
|
5120
|
+
return (jsxRuntime.jsx(ColumnRenderer
|
|
5121
|
+
// @ts-expect-error find suitable types
|
|
5122
|
+
, {
|
|
5041
5123
|
// @ts-expect-error find suitable types
|
|
5042
|
-
, {
|
|
5043
|
-
|
|
5044
|
-
|
|
5045
|
-
|
|
5046
|
-
methods.reset();
|
|
5047
|
-
}, variant: "subtle", children: translate.t("reset") }), jsxRuntime.jsx(Button, { onClick: () => {
|
|
5048
|
-
methods.handleSubmit(onValid)();
|
|
5049
|
-
}, formNoValidate: true, children: translate.t("submit") })] })] }) }));
|
|
5124
|
+
properties: properties, prefix: ``, column }, `form-input-${column}`));
|
|
5125
|
+
}) }), jsxRuntime.jsxs(react.Flex, { justifyContent: "end", gap: "2", children: [jsxRuntime.jsx(react.Button, { onClick: () => {
|
|
5126
|
+
methods.reset();
|
|
5127
|
+
}, variant: "subtle", children: translate.t("reset") }), jsxRuntime.jsx(SubmitButton, {})] })] }));
|
|
5050
5128
|
};
|
|
5051
|
-
|
|
5052
|
-
|
|
5053
|
-
|
|
5054
|
-
|
|
5055
|
-
|
|
5056
|
-
|
|
5057
|
-
|
|
5058
|
-
|
|
5059
|
-
ignore,
|
|
5060
|
-
include,
|
|
5061
|
-
// @ts-expect-error TODO: find appropriate types
|
|
5062
|
-
onSubmit,
|
|
5063
|
-
rowNumber,
|
|
5064
|
-
idMap,
|
|
5065
|
-
setIdMap,
|
|
5066
|
-
translate,
|
|
5067
|
-
requestOptions,
|
|
5068
|
-
}, children: jsxRuntime.jsx(reactHookForm.FormProvider, { ...form, children: jsxRuntime.jsx(FormInternal, {}) }) }));
|
|
5129
|
+
|
|
5130
|
+
const FormTitle = () => {
|
|
5131
|
+
const { translate } = useSchemaContext();
|
|
5132
|
+
return jsxRuntime.jsx(react.Heading, { children: translate.t("title") });
|
|
5133
|
+
};
|
|
5134
|
+
|
|
5135
|
+
const DefaultForm = ({ formConfig, showTitle = true, }) => {
|
|
5136
|
+
return (jsxRuntime.jsx(FormRoot, { ...formConfig, children: jsxRuntime.jsxs(react.Grid, { gap: "2", children: [showTitle && jsxRuntime.jsx(FormTitle, {}), jsxRuntime.jsx(FormBody, {})] }) }));
|
|
5069
5137
|
};
|
|
5070
5138
|
|
|
5071
5139
|
const useForm = ({ preLoadedValues, keyPrefix }) => {
|
|
@@ -5103,15 +5171,17 @@ exports.DataDisplay = DataDisplay;
|
|
|
5103
5171
|
exports.DataTable = DataTable;
|
|
5104
5172
|
exports.DataTableServer = DataTableServer;
|
|
5105
5173
|
exports.DefaultCardTitle = DefaultCardTitle;
|
|
5174
|
+
exports.DefaultForm = DefaultForm;
|
|
5106
5175
|
exports.DefaultTable = DefaultTable;
|
|
5107
5176
|
exports.DensityToggleButton = DensityToggleButton;
|
|
5108
|
-
exports.EditOrderButton = EditOrderButton;
|
|
5109
5177
|
exports.EditSortingButton = EditSortingButton;
|
|
5110
|
-
exports.EmptyState = EmptyState;
|
|
5178
|
+
exports.EmptyState = EmptyState$1;
|
|
5111
5179
|
exports.ErrorAlert = ErrorAlert;
|
|
5112
5180
|
exports.FilterDialog = FilterDialog;
|
|
5113
5181
|
exports.FilterOptions = FilterOptions;
|
|
5114
|
-
exports.
|
|
5182
|
+
exports.FormBody = FormBody;
|
|
5183
|
+
exports.FormRoot = FormRoot;
|
|
5184
|
+
exports.FormTitle = FormTitle;
|
|
5115
5185
|
exports.GlobalFilter = GlobalFilter;
|
|
5116
5186
|
exports.PageSizeControl = PageSizeControl;
|
|
5117
5187
|
exports.Pagination = Pagination;
|
|
@@ -5127,12 +5197,12 @@ exports.TableCardContainer = TableCardContainer;
|
|
|
5127
5197
|
exports.TableCards = TableCards;
|
|
5128
5198
|
exports.TableComponent = TableComponent;
|
|
5129
5199
|
exports.TableControls = TableControls;
|
|
5200
|
+
exports.TableDataDisplay = TableDataDisplay;
|
|
5130
5201
|
exports.TableFilter = TableFilter;
|
|
5131
5202
|
exports.TableFilterTags = TableFilterTags;
|
|
5132
5203
|
exports.TableFooter = TableFooter;
|
|
5133
5204
|
exports.TableHeader = TableHeader;
|
|
5134
5205
|
exports.TableLoadingComponent = TableLoadingComponent;
|
|
5135
|
-
exports.TableOrderer = TableOrderer;
|
|
5136
5206
|
exports.TableSelector = TableSelector;
|
|
5137
5207
|
exports.TableSorter = TableSorter;
|
|
5138
5208
|
exports.TableViewer = TableViewer;
|