pam-grid 1.1.1 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.css +5699 -5689
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +117 -83
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +117 -83
- package/dist/index.mjs.map +1 -1
- package/dist/styles/pam.core.css +5670 -5670
- package/dist/styles/pam.core.css.map +1 -1
- package/dist/styles/pam.grid.css +30 -20
- package/dist/styles/pam.grid.css.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -17,6 +17,7 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
|
17
17
|
function PamDropdown({
|
|
18
18
|
trigger,
|
|
19
19
|
items,
|
|
20
|
+
title,
|
|
20
21
|
placement = "bottom-start",
|
|
21
22
|
offset = 6,
|
|
22
23
|
disabled = false,
|
|
@@ -118,7 +119,7 @@ function PamDropdown({
|
|
|
118
119
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
119
120
|
/* @__PURE__ */ jsx("span", { ref: triggerRef, className: `pam-dropdown-trigger ${className}`, children: /* @__PURE__ */ jsx("span", { onClick: toggle, style: { display: "inline-flex" }, children: trigger }) }),
|
|
120
121
|
open && createPortal(
|
|
121
|
-
/* @__PURE__ */
|
|
122
|
+
/* @__PURE__ */ jsxs(
|
|
122
123
|
"div",
|
|
123
124
|
{
|
|
124
125
|
ref: menuRef,
|
|
@@ -127,17 +128,20 @@ function PamDropdown({
|
|
|
127
128
|
top: pos.top,
|
|
128
129
|
left: pos.left
|
|
129
130
|
},
|
|
130
|
-
children:
|
|
131
|
-
|
|
132
|
-
{
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
131
|
+
children: [
|
|
132
|
+
title && /* @__PURE__ */ jsx("div", { className: "pam-dropdown-title", children: title }),
|
|
133
|
+
/* @__PURE__ */ jsx("div", { className: "pam-list-wrapper", children: /* @__PURE__ */ jsx(
|
|
134
|
+
PamDropdownList,
|
|
135
|
+
{
|
|
136
|
+
items,
|
|
137
|
+
closeOnItemClick,
|
|
138
|
+
onClose: close,
|
|
139
|
+
openSubKeys,
|
|
140
|
+
setOpenSubKeys,
|
|
141
|
+
level: 0
|
|
142
|
+
}
|
|
143
|
+
) })
|
|
144
|
+
]
|
|
141
145
|
}
|
|
142
146
|
),
|
|
143
147
|
portalRoot
|
|
@@ -573,62 +577,71 @@ var FacetFilter = ({
|
|
|
573
577
|
if (facetLoading?.[columnKey]) {
|
|
574
578
|
return /* @__PURE__ */ jsx3("div", { className: "p-3 text-center", children: /* @__PURE__ */ jsx3("p", { className: "text-secondary", children: "Loading..." }) });
|
|
575
579
|
}
|
|
576
|
-
return /* @__PURE__ */ jsxs3(
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
580
|
+
return /* @__PURE__ */ jsxs3(
|
|
581
|
+
"div",
|
|
582
|
+
{
|
|
583
|
+
className: "pam-grid-facet-filter",
|
|
584
|
+
style: { width: 240 },
|
|
585
|
+
onClick: (e) => e.stopPropagation(),
|
|
586
|
+
onMouseDown: (e) => e.stopPropagation(),
|
|
587
|
+
children: [
|
|
588
|
+
/* @__PURE__ */ jsx3("div", { className: "mb-2", children: /* @__PURE__ */ jsx3(
|
|
589
|
+
"input",
|
|
590
|
+
{
|
|
591
|
+
type: "search",
|
|
592
|
+
className: "form-control form-control-sm",
|
|
593
|
+
placeholder: "Search...",
|
|
594
|
+
value: search,
|
|
595
|
+
onChange: (e) => setSearch(e.target.value)
|
|
596
|
+
}
|
|
597
|
+
) }),
|
|
598
|
+
/* @__PURE__ */ jsxs3(
|
|
599
|
+
"div",
|
|
600
|
+
{
|
|
601
|
+
className: "list-group list-group-flush text-truncate",
|
|
602
|
+
style: {
|
|
603
|
+
maxHeight: 220,
|
|
604
|
+
overflowY: "auto"
|
|
605
|
+
},
|
|
606
|
+
children: [
|
|
607
|
+
filteredItems.map((item) => {
|
|
608
|
+
const checked = selected.some((s) => s.id === item.id);
|
|
609
|
+
return /* @__PURE__ */ jsxs3(
|
|
610
|
+
"label",
|
|
611
|
+
{
|
|
612
|
+
className: "list-group-item list-group-item-action d-flex align-items-center gap-2 py-2",
|
|
613
|
+
children: [
|
|
614
|
+
/* @__PURE__ */ jsx3(
|
|
615
|
+
"input",
|
|
616
|
+
{
|
|
617
|
+
type: "checkbox",
|
|
618
|
+
className: "form-check-input mt-0",
|
|
619
|
+
checked,
|
|
620
|
+
onChange: () => toggleFacetFilter(columnKey, item)
|
|
621
|
+
}
|
|
622
|
+
),
|
|
623
|
+
/* @__PURE__ */ jsx3("span", { className: "flex-grow-1", children: item.name }),
|
|
624
|
+
checked && /* @__PURE__ */ jsx3("i", { className: "bx bx-check text-primary" })
|
|
625
|
+
]
|
|
626
|
+
},
|
|
627
|
+
item.id
|
|
628
|
+
);
|
|
629
|
+
}),
|
|
630
|
+
!filteredItems.length && /* @__PURE__ */ jsx3("div", { className: "text-center text-muted py-3 small", children: "No results" })
|
|
631
|
+
]
|
|
632
|
+
}
|
|
633
|
+
),
|
|
634
|
+
selected.length > 0 && /* @__PURE__ */ jsx3("div", { className: "pt-2 border-top mt-2 d-flex justify-content-end", children: /* @__PURE__ */ jsx3(
|
|
635
|
+
"button",
|
|
636
|
+
{
|
|
637
|
+
className: "btn btn-sm btn-label-secondary",
|
|
638
|
+
onClick: clearFacetFilters,
|
|
639
|
+
children: "Clear"
|
|
640
|
+
}
|
|
641
|
+
) })
|
|
642
|
+
]
|
|
643
|
+
}
|
|
644
|
+
);
|
|
632
645
|
};
|
|
633
646
|
var FacetFilter_default = FacetFilter;
|
|
634
647
|
|
|
@@ -1347,6 +1360,7 @@ var PamGrid = ({
|
|
|
1347
1360
|
rows,
|
|
1348
1361
|
page,
|
|
1349
1362
|
totalPages,
|
|
1363
|
+
totalRecord,
|
|
1350
1364
|
pageSize,
|
|
1351
1365
|
setPage,
|
|
1352
1366
|
setPageSize,
|
|
@@ -1371,7 +1385,12 @@ var PamGrid = ({
|
|
|
1371
1385
|
addNewRecord,
|
|
1372
1386
|
advanceFilters,
|
|
1373
1387
|
setColumnAdvanceFilter
|
|
1374
|
-
} = grid
|
|
1388
|
+
} = grid || safeGridHandle;
|
|
1389
|
+
useEffect5(() => {
|
|
1390
|
+
return () => {
|
|
1391
|
+
hideTooltip();
|
|
1392
|
+
};
|
|
1393
|
+
}, []);
|
|
1375
1394
|
const onResizeMouseDown = (e, key, side = "right") => {
|
|
1376
1395
|
e.preventDefault();
|
|
1377
1396
|
const startX = e.clientX;
|
|
@@ -1707,20 +1726,32 @@ var PamGrid = ({
|
|
|
1707
1726
|
),
|
|
1708
1727
|
features.pagination && /* @__PURE__ */ jsxs10("div", { className: "d-flex justify-content-between align-items-center mt-2", children: [
|
|
1709
1728
|
/* @__PURE__ */ jsxs10("div", { className: "d-flex flex-row align-items-center gap-2", children: [
|
|
1710
|
-
|
|
1711
|
-
"
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1729
|
+
/* @__PURE__ */ jsxs10("small", { className: "text-secondary", children: [
|
|
1730
|
+
"Showing ",
|
|
1731
|
+
rows.length === 0 ? 0 : (page - 1) * pageSize + 1,
|
|
1732
|
+
" - ",
|
|
1733
|
+
(page - 1) * pageSize + rows.length,
|
|
1734
|
+
" of ",
|
|
1735
|
+
totalRecord
|
|
1736
|
+
] }),
|
|
1737
|
+
features.pageSizeSelector && /* @__PURE__ */ jsxs10("div", { className: "d-flex align-items-center gap-2 ms-2", children: [
|
|
1738
|
+
/* @__PURE__ */ jsx13(
|
|
1739
|
+
PamDropdown,
|
|
1740
|
+
{
|
|
1741
|
+
placement: "top-start",
|
|
1742
|
+
trigger: /* @__PURE__ */ jsxs10("button", { className: "btn btn-sm border bg-white d-flex align-items-center gap-1", children: [
|
|
1743
|
+
pageSize,
|
|
1744
|
+
" ",
|
|
1745
|
+
/* @__PURE__ */ jsx13("i", { className: "bx bx-chevron-down text-muted" })
|
|
1746
|
+
] }),
|
|
1747
|
+
items: [20, 50, 100].map((n) => ({
|
|
1748
|
+
key: String(n),
|
|
1749
|
+
label: String(n),
|
|
1750
|
+
onClick: () => setPageSize(n)
|
|
1751
|
+
}))
|
|
1752
|
+
}
|
|
1753
|
+
),
|
|
1754
|
+
/* @__PURE__ */ jsx13("small", { className: "text-secondary", children: "per page" })
|
|
1724
1755
|
] })
|
|
1725
1756
|
] }),
|
|
1726
1757
|
/* @__PURE__ */ jsx13("div", { children: /* @__PURE__ */ jsx13(
|
|
@@ -2038,6 +2069,7 @@ function useGridCore({
|
|
|
2038
2069
|
}) {
|
|
2039
2070
|
const [page, setPage] = useState6(1);
|
|
2040
2071
|
const [pageSize, setPageSize] = useState6(initialPageSize);
|
|
2072
|
+
const [totalRecord, setTotalRecord] = useState6(0);
|
|
2041
2073
|
const [search, setSearch] = useState6("");
|
|
2042
2074
|
const [debouncedSearch, setDebouncedSearch] = useState6("");
|
|
2043
2075
|
const [groupBy, setGroupBy] = useState6(null);
|
|
@@ -2356,6 +2388,8 @@ function useGridCore({
|
|
|
2356
2388
|
setPageSize,
|
|
2357
2389
|
totalRows,
|
|
2358
2390
|
totalPages,
|
|
2391
|
+
totalRecord,
|
|
2392
|
+
setTotalRecord,
|
|
2359
2393
|
// search
|
|
2360
2394
|
search,
|
|
2361
2395
|
setSearch,
|