schummar-table 0.7.0 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +452 -397
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/mui4Theme.js +5 -5
- package/dist/cjs/mui4Theme.js.map +1 -1
- package/dist/cjs/mui5Theme.js +6 -6
- package/dist/cjs/mui5Theme.js.map +1 -1
- package/dist/cjs/tableTheme.js +20 -7
- package/dist/cjs/tableTheme.js.map +1 -1
- package/dist/es/index.js +453 -398
- package/dist/es/index.js.map +1 -1
- package/dist/es/mui4Theme.js +5 -5
- package/dist/es/mui4Theme.js.map +1 -1
- package/dist/es/mui5Theme.js +6 -6
- package/dist/es/mui5Theme.js.map +1 -1
- package/dist/es/tableTheme.js +20 -7
- package/dist/es/tableTheme.js.map +1 -1
- package/dist/types/components/columnFooter.d.ts +1 -0
- package/dist/types/components/columnHeader.d.ts +1 -2
- package/dist/types/components/virtualized.d.ts +2 -1
- package/dist/types/theme/defaultTheme/defaultClasses.d.ts +3 -0
- package/dist/types/types.d.ts +14 -4
- package/package.json +11 -11
package/dist/es/index.js
CHANGED
|
@@ -29,7 +29,7 @@ var __objRest = (source, exclude) => {
|
|
|
29
29
|
}
|
|
30
30
|
return target;
|
|
31
31
|
};
|
|
32
|
-
import { createContext, useContext, useMemo, useState, useEffect,
|
|
32
|
+
import { createContext, useContext, useMemo, useState, useEffect, useCallback, useRef, memo, useLayoutEffect, cloneElement, Fragment as Fragment$1 } from "react";
|
|
33
33
|
import { Store, StoreScope } from "schummar-state/react";
|
|
34
34
|
import { d as defaultClasses, a as darkGray, l as lightGray, P as Popover, T as TableThemeContext, m as mergeThemes, g as globalTableTheme, b as PopoverContext, c as gray } from "./tableTheme.js";
|
|
35
35
|
export { T as TableThemeContext, f as TableThemeProvider, e as configureTableTheme, m as mergeThemes } from "./tableTheme.js";
|
|
@@ -42,7 +42,7 @@ const TableMemoContext = createContext(/* @__PURE__ */ new Map());
|
|
|
42
42
|
function TableMemoContextProvider({
|
|
43
43
|
children
|
|
44
44
|
}) {
|
|
45
|
-
return jsx(TableMemoContext.Provider, {
|
|
45
|
+
return /* @__PURE__ */ jsx(TableMemoContext.Provider, {
|
|
46
46
|
value: useMemo(() => /* @__PURE__ */ new Map(), []),
|
|
47
47
|
children
|
|
48
48
|
});
|
|
@@ -308,10 +308,11 @@ function calcItems(state) {
|
|
|
308
308
|
state2.activeColumns,
|
|
309
309
|
state2.expanded
|
|
310
310
|
], ([items = [], id, parentId, revealFiltered, sort, filters, filterValues, activeColumns], draft) => {
|
|
311
|
-
const tableItems = items.map((item) =>
|
|
311
|
+
const tableItems = items.map((item) => ({
|
|
312
312
|
id: id(item),
|
|
313
313
|
parentId: parentId == null ? void 0 : parentId(item),
|
|
314
|
-
children: []
|
|
314
|
+
children: [],
|
|
315
|
+
value: item
|
|
315
316
|
}));
|
|
316
317
|
let sorted;
|
|
317
318
|
if (sort.length === 0) {
|
|
@@ -326,7 +327,7 @@ function calcItems(state) {
|
|
|
326
327
|
direction: sort2.direction
|
|
327
328
|
}));
|
|
328
329
|
}).filter(Boolean);
|
|
329
|
-
sorted = orderBy(tableItems, selectors.map((x) => x.selector), selectors.map((x) => x.direction));
|
|
330
|
+
sorted = orderBy(tableItems, selectors.map((x) => (item) => x.selector(item.value)), selectors.map((x) => x.direction));
|
|
330
331
|
}
|
|
331
332
|
const lookup = /* @__PURE__ */ new Map();
|
|
332
333
|
for (const item of sorted) {
|
|
@@ -360,7 +361,7 @@ function calcItems(state) {
|
|
|
360
361
|
if (filterValue === void 0 || !filter.isActive(filterValue))
|
|
361
362
|
return true;
|
|
362
363
|
const filterBy = (_a = filter.filterBy) != null ? _a : (x) => x;
|
|
363
|
-
const value = filterBy(column.value(item), item);
|
|
364
|
+
const value = filterBy(column.value(item.value), item.value);
|
|
364
365
|
return castArray(value).some((value2) => filter.test(filterValue, value2));
|
|
365
366
|
}));
|
|
366
367
|
if (isActive && item.parentId !== void 0) {
|
|
@@ -398,7 +399,7 @@ const noopParentId = () => void 0;
|
|
|
398
399
|
function calcProps(props) {
|
|
399
400
|
const cache = useTableMemo();
|
|
400
401
|
return useMemo(() => {
|
|
401
|
-
var
|
|
402
|
+
var _f, _g, _h, _i, _j, _k, _l;
|
|
402
403
|
let id;
|
|
403
404
|
if (props.id instanceof Function || Array.isArray(props.id)) {
|
|
404
405
|
id = cache("id", props.id);
|
|
@@ -423,10 +424,11 @@ function calcProps(props) {
|
|
|
423
424
|
const mapColumn = ({
|
|
424
425
|
id: _id,
|
|
425
426
|
header = ((_a) => (_a = defCol == null ? void 0 : defCol.header) != null ? _a : null)(),
|
|
427
|
+
footer = ((_b) => (_b = defCol == null ? void 0 : defCol.footer) != null ? _b : null)(),
|
|
426
428
|
value,
|
|
427
|
-
renderCell = ((
|
|
428
|
-
exportCell = ((
|
|
429
|
-
sortBy = ((
|
|
429
|
+
renderCell = ((_c) => (_c = defCol == null ? void 0 : defCol.renderCell) != null ? _c : asString)(),
|
|
430
|
+
exportCell = ((_d) => (_d = defCol == null ? void 0 : defCol.exportCell) != null ? _d : asString)(),
|
|
431
|
+
sortBy = ((_e) => (_e = defCol == null ? void 0 : defCol.sortBy) != null ? _e : [(v) => typeof v === "number" || v instanceof Date ? v : String(v)])(),
|
|
430
432
|
cannotHide = defCol == null ? void 0 : defCol.cannotHide,
|
|
431
433
|
classes = defCol == null ? void 0 : defCol.classes,
|
|
432
434
|
filter = defCol == null ? void 0 : defCol.filter,
|
|
@@ -436,7 +438,8 @@ function calcProps(props) {
|
|
|
436
438
|
const cacheKey = typeof id2 === "string" ? `s${id2}` : `n${id2}`;
|
|
437
439
|
return {
|
|
438
440
|
id: id2,
|
|
439
|
-
header,
|
|
441
|
+
header: header instanceof Function ? cache(`columns.${cacheKey}.header`, header) : header,
|
|
442
|
+
footer: footer instanceof Function ? cache(`columns.${cacheKey}.footer`, footer) : footer,
|
|
440
443
|
value: cache(`columns.${cacheKey}.value`, value),
|
|
441
444
|
renderCell: cache(`columns.${cacheKey}.renderCell`, renderCell),
|
|
442
445
|
exportCell,
|
|
@@ -469,13 +472,14 @@ function calcProps(props) {
|
|
|
469
472
|
columns,
|
|
470
473
|
wrapCell,
|
|
471
474
|
rowAction,
|
|
472
|
-
enableSelection: (
|
|
473
|
-
selectSyncChildren: (
|
|
474
|
-
stickyHeader: (
|
|
475
|
+
enableSelection: (_f = props.enableSelection) != null ? _f : true,
|
|
476
|
+
selectSyncChildren: (_g = props.selectSyncChildren) != null ? _g : true,
|
|
477
|
+
stickyHeader: (_h = props.stickyHeader) != null ? _h : true,
|
|
478
|
+
stickyFooter: (_i = props.stickyFooter) != null ? _i : true,
|
|
475
479
|
enableExport,
|
|
476
|
-
enableColumnSelection: (
|
|
477
|
-
enableColumnResize: (
|
|
478
|
-
enableColumnReorder: (
|
|
480
|
+
enableColumnSelection: (_j = props.enableColumnSelection) != null ? _j : true,
|
|
481
|
+
enableColumnResize: (_k = props.enableColumnResize) != null ? _k : true,
|
|
482
|
+
enableColumnReorder: (_l = props.enableColumnReorder) != null ? _l : true
|
|
479
483
|
});
|
|
480
484
|
}, [props]);
|
|
481
485
|
}
|
|
@@ -615,14 +619,259 @@ function useCssVariables() {
|
|
|
615
619
|
"--secondaryContrastText": colors.secondary.contrastText
|
|
616
620
|
}));
|
|
617
621
|
}
|
|
622
|
+
function ColumnFooter() {
|
|
623
|
+
const table = useTableContext();
|
|
624
|
+
const columnId = useColumnContext();
|
|
625
|
+
const stickyFooter = table.useState("props.stickyFooter");
|
|
626
|
+
const columnStyleOverride = table.useState((state) => state.columnStyleOverride.get(columnId), {
|
|
627
|
+
throttle: 16
|
|
628
|
+
});
|
|
629
|
+
const columnClasses = table.useState((state) => {
|
|
630
|
+
var _a;
|
|
631
|
+
return (_a = state.activeColumns.find((column) => column.id === columnId)) == null ? void 0 : _a.classes;
|
|
632
|
+
});
|
|
633
|
+
const classes = useTheme((theme) => theme.classes);
|
|
634
|
+
const content = table.useState((state) => {
|
|
635
|
+
const column = state.activeColumns.find((column2) => column2.id === columnId);
|
|
636
|
+
if ((column == null ? void 0 : column.footer) instanceof Function) {
|
|
637
|
+
const items = state.activeItems;
|
|
638
|
+
const values = items.map((item) => column == null ? void 0 : column.value(item));
|
|
639
|
+
return column == null ? void 0 : column.footer(values, items);
|
|
640
|
+
}
|
|
641
|
+
return column == null ? void 0 : column.footer;
|
|
642
|
+
});
|
|
643
|
+
return /* @__PURE__ */ jsx("div", {
|
|
644
|
+
className: cx(classes == null ? void 0 : classes.footerCell, columnClasses == null ? void 0 : columnClasses.footerCell),
|
|
645
|
+
css: [defaultClasses.footerCell, columnStyleOverride, stickyFooter && defaultClasses.stickyBottom, stickyFooter instanceof Object && stickyFooter],
|
|
646
|
+
children: content
|
|
647
|
+
});
|
|
648
|
+
}
|
|
649
|
+
const FilterControlContext = createContext(() => void 0);
|
|
650
|
+
function FilterControl() {
|
|
651
|
+
const table = useTableContext();
|
|
652
|
+
const columnId = useColumnContext();
|
|
653
|
+
const IconButton2 = useTheme((t) => t.components.IconButton);
|
|
654
|
+
const Popover2 = useTheme((t) => t.components.Popover);
|
|
655
|
+
const FilterList2 = useTheme((t) => t.icons.FilterList);
|
|
656
|
+
const ArrowDropDown2 = useTheme((t) => t.icons.ArrowDropDown);
|
|
657
|
+
const cssVariables = useCssVariables();
|
|
658
|
+
const [anchor, setAnchor] = useState(null);
|
|
659
|
+
const isActive = table.useState((state) => {
|
|
660
|
+
const filter2 = state.filters.get(columnId);
|
|
661
|
+
const filterValue = state.filterValues.get(columnId);
|
|
662
|
+
return filter2 !== void 0 && filterValue !== void 0 && filter2.isActive(filterValue);
|
|
663
|
+
});
|
|
664
|
+
const filter = table.useState((state) => {
|
|
665
|
+
var _a;
|
|
666
|
+
return (_a = state.activeColumns.find((column) => column.id === columnId)) == null ? void 0 : _a.filter;
|
|
667
|
+
});
|
|
668
|
+
function reset() {
|
|
669
|
+
table.update((state) => {
|
|
670
|
+
state.filterValues.delete(columnId);
|
|
671
|
+
});
|
|
672
|
+
}
|
|
673
|
+
const close = useCallback(function() {
|
|
674
|
+
setAnchor(null);
|
|
675
|
+
}, []);
|
|
676
|
+
if (!filter)
|
|
677
|
+
return null;
|
|
678
|
+
return /* @__PURE__ */ jsxs(FilterControlContext.Provider, {
|
|
679
|
+
value: close,
|
|
680
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
681
|
+
onClick: (e2) => setAnchor(e2.currentTarget),
|
|
682
|
+
onContextMenu: (e2) => {
|
|
683
|
+
reset();
|
|
684
|
+
e2.preventDefault();
|
|
685
|
+
return false;
|
|
686
|
+
},
|
|
687
|
+
children: /* @__PURE__ */ jsx(IconButton2, {
|
|
688
|
+
css: [{
|
|
689
|
+
color: "#b0bac9"
|
|
690
|
+
}, isActive && {
|
|
691
|
+
color: "var(--primaryMain) !important"
|
|
692
|
+
}],
|
|
693
|
+
children: isActive ? /* @__PURE__ */ jsx(FilterList2, {}) : /* @__PURE__ */ jsx(ArrowDropDown2, {})
|
|
694
|
+
})
|
|
695
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
696
|
+
onPointerDown: (e2) => {
|
|
697
|
+
e2.stopPropagation();
|
|
698
|
+
},
|
|
699
|
+
onPointerMove: (e2) => {
|
|
700
|
+
e2.stopPropagation();
|
|
701
|
+
},
|
|
702
|
+
children: /* @__PURE__ */ jsx(Popover2, {
|
|
703
|
+
open: true,
|
|
704
|
+
hidden: !anchor,
|
|
705
|
+
onClose: () => setAnchor(null),
|
|
706
|
+
anchorEl: anchor != null ? anchor : document.body,
|
|
707
|
+
css: cssVariables,
|
|
708
|
+
children: filter
|
|
709
|
+
})
|
|
710
|
+
})]
|
|
711
|
+
});
|
|
712
|
+
}
|
|
713
|
+
function ResizeHandle() {
|
|
714
|
+
const table = useTableContext();
|
|
715
|
+
const columnId = useColumnContext();
|
|
716
|
+
const enabled = table.useState("props.enableColumnResize");
|
|
717
|
+
function onPointerDown(e2) {
|
|
718
|
+
e2.stopPropagation();
|
|
719
|
+
const div = e2.target;
|
|
720
|
+
div.setPointerCapture(e2.pointerId);
|
|
721
|
+
}
|
|
722
|
+
function onPointerMove(e2) {
|
|
723
|
+
e2.stopPropagation();
|
|
724
|
+
const div = e2.target;
|
|
725
|
+
if (!div.hasPointerCapture(e2.pointerId))
|
|
726
|
+
return;
|
|
727
|
+
const parent = div.parentElement;
|
|
728
|
+
const width = Math.max(e2.clientX - parent.getBoundingClientRect().left + 5, 50);
|
|
729
|
+
table.update((state) => {
|
|
730
|
+
state.columnWidths.set(columnId, `${width}px`);
|
|
731
|
+
});
|
|
732
|
+
}
|
|
733
|
+
function onPointerUp(e2) {
|
|
734
|
+
e2.stopPropagation();
|
|
735
|
+
const div = e2.target;
|
|
736
|
+
div.releasePointerCapture(e2.pointerId);
|
|
737
|
+
}
|
|
738
|
+
function onDoubleClick(e2) {
|
|
739
|
+
table.update((state) => {
|
|
740
|
+
if (e2.getModifierState("Control")) {
|
|
741
|
+
state.columnWidths.delete(columnId);
|
|
742
|
+
} else {
|
|
743
|
+
state.columnWidths.set(columnId, "max-content");
|
|
744
|
+
}
|
|
745
|
+
});
|
|
746
|
+
}
|
|
747
|
+
return /* @__PURE__ */ jsx(ResizeHandleView, {
|
|
748
|
+
enabled,
|
|
749
|
+
onPointerDown: enabled ? onPointerDown : void 0,
|
|
750
|
+
onPointerMove: enabled ? onPointerMove : void 0,
|
|
751
|
+
onPointerUp: enabled ? onPointerUp : void 0,
|
|
752
|
+
onDoubleClick: enabled ? onDoubleClick : void 0
|
|
753
|
+
});
|
|
754
|
+
}
|
|
755
|
+
function ResizeHandleView(_a) {
|
|
756
|
+
var _b = _a, {
|
|
757
|
+
enabled
|
|
758
|
+
} = _b, props = __objRest(_b, [
|
|
759
|
+
"enabled"
|
|
760
|
+
]);
|
|
761
|
+
return /* @__PURE__ */ jsx("div", __spreadValues({
|
|
762
|
+
css: {
|
|
763
|
+
alignSelf: "stretch",
|
|
764
|
+
padding: "0 5px",
|
|
765
|
+
cursor: enabled ? "col-resize" : "initial",
|
|
766
|
+
display: "flex",
|
|
767
|
+
alignItems: "center",
|
|
768
|
+
"&:after": {
|
|
769
|
+
content: '""',
|
|
770
|
+
width: 1,
|
|
771
|
+
height: "1.5em",
|
|
772
|
+
background: "#c9cfda",
|
|
773
|
+
transition: "transform 300ms"
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
}, props));
|
|
777
|
+
}
|
|
778
|
+
function SortComponent({
|
|
779
|
+
children
|
|
780
|
+
}) {
|
|
781
|
+
const table = useTableContext();
|
|
782
|
+
const columnId = useColumnContext();
|
|
783
|
+
const Badge2 = useTheme((t) => t.components.Badge);
|
|
784
|
+
const ArrowUpward2 = useTheme((t) => t.icons.ArrowUpward);
|
|
785
|
+
const {
|
|
786
|
+
direction,
|
|
787
|
+
index
|
|
788
|
+
} = table.useState((state) => {
|
|
789
|
+
var _a, _b;
|
|
790
|
+
const index2 = (_a = state.sort.findIndex((s) => s.columnId === columnId)) != null ? _a : -1;
|
|
791
|
+
return {
|
|
792
|
+
direction: (_b = state.sort[index2]) == null ? void 0 : _b.direction,
|
|
793
|
+
index: index2 >= 0 && state.sort.length > 1 ? index2 + 1 : void 0
|
|
794
|
+
};
|
|
795
|
+
});
|
|
796
|
+
function toggle2(e2, off) {
|
|
797
|
+
const {
|
|
798
|
+
props: {
|
|
799
|
+
sort: controlledSort,
|
|
800
|
+
onSortChange
|
|
801
|
+
}
|
|
802
|
+
} = table.getState();
|
|
803
|
+
const newDirection = direction === "asc" ? "desc" : "asc";
|
|
804
|
+
const newSort = e2.getModifierState("Control") || off ? table.getState().sort.filter((s) => s.columnId !== columnId) : [];
|
|
805
|
+
if (!off) {
|
|
806
|
+
newSort.push({
|
|
807
|
+
columnId,
|
|
808
|
+
direction: newDirection
|
|
809
|
+
});
|
|
810
|
+
}
|
|
811
|
+
onSortChange == null ? void 0 : onSortChange(newSort);
|
|
812
|
+
if (!controlledSort) {
|
|
813
|
+
table.update((state) => {
|
|
814
|
+
state.sort = newSort;
|
|
815
|
+
});
|
|
816
|
+
}
|
|
817
|
+
e2.preventDefault();
|
|
818
|
+
return false;
|
|
819
|
+
}
|
|
820
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
821
|
+
css: {
|
|
822
|
+
userSelect: "none",
|
|
823
|
+
display: "grid",
|
|
824
|
+
gridTemplateColumns: "minmax(0, 1fr) max-content",
|
|
825
|
+
alignItems: "center",
|
|
826
|
+
cursor: "pointer",
|
|
827
|
+
"& > div": {
|
|
828
|
+
overflow: "hidden",
|
|
829
|
+
textOverflow: "ellipsis"
|
|
830
|
+
}
|
|
831
|
+
},
|
|
832
|
+
onClick: (e2) => toggle2(e2),
|
|
833
|
+
onContextMenu: (e2) => toggle2(e2, true),
|
|
834
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
835
|
+
children
|
|
836
|
+
}), /* @__PURE__ */ jsx(Badge2, {
|
|
837
|
+
badgeContent: index,
|
|
838
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
839
|
+
css: [{
|
|
840
|
+
transition: "all 300ms",
|
|
841
|
+
fontSize: "0.8em"
|
|
842
|
+
}, !direction && {
|
|
843
|
+
opacity: 0
|
|
844
|
+
}, direction === "desc" && {
|
|
845
|
+
transform: "rotate3d(0, 0, 1, 180deg)"
|
|
846
|
+
}],
|
|
847
|
+
children: /* @__PURE__ */ jsx(ArrowUpward2, {})
|
|
848
|
+
})
|
|
849
|
+
})]
|
|
850
|
+
});
|
|
851
|
+
}
|
|
618
852
|
const ColumnHeaderContext = new StoreScope({
|
|
619
853
|
items: /* @__PURE__ */ new Map()
|
|
620
854
|
});
|
|
621
|
-
function ColumnHeader(
|
|
855
|
+
function ColumnHeader() {
|
|
622
856
|
const ref = useRef(null);
|
|
623
857
|
const columnId = useColumnContext();
|
|
624
858
|
const table = useTableContext();
|
|
625
859
|
const enabled = table.useState("props.enableColumnReorder");
|
|
860
|
+
const columnStyleOverride = table.useState((state) => state.columnStyleOverride.get(columnId), {
|
|
861
|
+
throttle: 16
|
|
862
|
+
});
|
|
863
|
+
const stickyHeader = table.useState("props.stickyHeader");
|
|
864
|
+
const classes = useTheme((theme) => theme.classes);
|
|
865
|
+
const {
|
|
866
|
+
header,
|
|
867
|
+
columnClasses
|
|
868
|
+
} = table.useState((state) => {
|
|
869
|
+
const column = state.activeColumns.find((column2) => column2.id === columnId);
|
|
870
|
+
return {
|
|
871
|
+
header: column == null ? void 0 : column.header,
|
|
872
|
+
columnClasses: column == null ? void 0 : column.classes
|
|
873
|
+
};
|
|
874
|
+
});
|
|
626
875
|
const store = ColumnHeaderContext.useStore();
|
|
627
876
|
const draggingStart = useRef();
|
|
628
877
|
const clone = useRef();
|
|
@@ -741,24 +990,31 @@ function ColumnHeader(props) {
|
|
|
741
990
|
clone.current = void 0;
|
|
742
991
|
});
|
|
743
992
|
}
|
|
744
|
-
return
|
|
745
|
-
|
|
993
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
994
|
+
ref,
|
|
995
|
+
className: cx(classes == null ? void 0 : classes.headerCell, columnClasses == null ? void 0 : columnClasses.headerCell),
|
|
996
|
+
css: [{
|
|
746
997
|
position: "relative",
|
|
747
998
|
userSelect: "none"
|
|
748
|
-
},
|
|
749
|
-
ref,
|
|
999
|
+
}, defaultClasses.headerCell, columnStyleOverride, stickyHeader && defaultClasses.sticky, stickyHeader instanceof Object && stickyHeader],
|
|
750
1000
|
onPointerDown: enabled ? onPointerDown : void 0,
|
|
751
1001
|
onPointerMove: enabled ? onPointerMove : void 0,
|
|
752
1002
|
onPointerUp: enabled ? onPointerUp : void 0,
|
|
753
|
-
children:
|
|
754
|
-
|
|
1003
|
+
children: [/* @__PURE__ */ jsx(SortComponent, {
|
|
1004
|
+
children: header
|
|
1005
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
1006
|
+
css: {
|
|
1007
|
+
flex: 1
|
|
1008
|
+
}
|
|
1009
|
+
}), /* @__PURE__ */ jsx(FilterControl, {}), /* @__PURE__ */ jsx(ResizeHandle, {})]
|
|
1010
|
+
});
|
|
755
1011
|
}
|
|
756
1012
|
function FormControlLabel({
|
|
757
1013
|
control,
|
|
758
1014
|
label,
|
|
759
1015
|
disabled
|
|
760
1016
|
}) {
|
|
761
|
-
return jsxs("label", {
|
|
1017
|
+
return /* @__PURE__ */ jsxs("label", {
|
|
762
1018
|
css: [{
|
|
763
1019
|
display: "flex",
|
|
764
1020
|
alignItems: "center",
|
|
@@ -770,7 +1026,7 @@ function FormControlLabel({
|
|
|
770
1026
|
}, disabled && {
|
|
771
1027
|
color: "rgba(0, 0, 0, 0.26)"
|
|
772
1028
|
}],
|
|
773
|
-
children: [control, jsx("span", {
|
|
1029
|
+
children: [control, /* @__PURE__ */ jsx("span", {
|
|
774
1030
|
css: {
|
|
775
1031
|
marginLeft: "var(--spacing)"
|
|
776
1032
|
},
|
|
@@ -808,27 +1064,27 @@ function ColumnSelection() {
|
|
|
808
1064
|
}
|
|
809
1065
|
onHiddenColumnsChange == null ? void 0 : onHiddenColumnsChange(newValue);
|
|
810
1066
|
};
|
|
811
|
-
return jsxs(Fragment, {
|
|
812
|
-
children: [jsx(IconButton2, {
|
|
1067
|
+
return /* @__PURE__ */ jsxs(Fragment, {
|
|
1068
|
+
children: [/* @__PURE__ */ jsx(IconButton2, {
|
|
813
1069
|
onClick: (e2) => setAnchorEl(anchorEl ? null : e2.currentTarget),
|
|
814
|
-
children: jsx(Settings2, {})
|
|
815
|
-
}), jsx(Popover2, {
|
|
1070
|
+
children: /* @__PURE__ */ jsx(Settings2, {})
|
|
1071
|
+
}), /* @__PURE__ */ jsx(Popover2, {
|
|
816
1072
|
anchorEl,
|
|
817
1073
|
open: !!anchorEl,
|
|
818
1074
|
onClose: () => setAnchorEl(null),
|
|
819
1075
|
css: cssVariables,
|
|
820
|
-
children: jsxs("div", {
|
|
1076
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
821
1077
|
css: {
|
|
822
1078
|
padding: `calc(var(--spacing) * 2)`,
|
|
823
1079
|
display: "grid"
|
|
824
1080
|
},
|
|
825
|
-
children: [jsx("div", {
|
|
1081
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
826
1082
|
css: {
|
|
827
1083
|
marginBottom: "var(--spacing)"
|
|
828
1084
|
},
|
|
829
1085
|
children: selectColumns
|
|
830
|
-
}), columns.map((column) => jsx(FormControlLabel, {
|
|
831
|
-
control: jsx(Checkbox2, {
|
|
1086
|
+
}), columns.map((column) => /* @__PURE__ */ jsx(FormControlLabel, {
|
|
1087
|
+
control: /* @__PURE__ */ jsx(Checkbox2, {
|
|
832
1088
|
checked: !hiddenColumns.has(column.id),
|
|
833
1089
|
onChange: () => toggle2(column),
|
|
834
1090
|
disabled: column.cannotHide
|
|
@@ -868,7 +1124,7 @@ function Export$1() {
|
|
|
868
1124
|
activeColumns,
|
|
869
1125
|
activeItems
|
|
870
1126
|
} = table.getState();
|
|
871
|
-
const data = [activeColumns.map((column) => String(column.id)), ...activeItems.map((item) => activeColumns.map((column) => column.exportCell(column.value(item), item)))];
|
|
1127
|
+
const data = [activeColumns.map((column) => String(column.id)), ...activeItems.map((item) => activeColumns.map((column) => column.exportCell(column.value(item.value), item.value)))];
|
|
872
1128
|
return csvExport(data, options);
|
|
873
1129
|
};
|
|
874
1130
|
const copy = () => {
|
|
@@ -882,20 +1138,20 @@ function Export$1() {
|
|
|
882
1138
|
a.click();
|
|
883
1139
|
document.body.removeChild(a);
|
|
884
1140
|
};
|
|
885
|
-
return jsxs(Fragment, {
|
|
886
|
-
children: [jsx(IconButton2, {
|
|
1141
|
+
return /* @__PURE__ */ jsxs(Fragment, {
|
|
1142
|
+
children: [/* @__PURE__ */ jsx(IconButton2, {
|
|
887
1143
|
onClick: (e2) => setAnchor(anchor ? null : e2.currentTarget),
|
|
888
|
-
children: jsx(Export2, {
|
|
1144
|
+
children: /* @__PURE__ */ jsx(Export2, {
|
|
889
1145
|
css: !!anchor && {
|
|
890
1146
|
color: "var(--primaryMain)"
|
|
891
1147
|
}
|
|
892
1148
|
})
|
|
893
|
-
}), jsx(Popover2, {
|
|
1149
|
+
}), /* @__PURE__ */ jsx(Popover2, {
|
|
894
1150
|
open: !!anchor,
|
|
895
1151
|
onClose: () => setAnchor(null),
|
|
896
1152
|
anchorEl: anchor,
|
|
897
1153
|
css: cssVariables,
|
|
898
|
-
children: jsxs("div", {
|
|
1154
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
899
1155
|
css: {
|
|
900
1156
|
padding: `calc(var(--spacing) * 2)`,
|
|
901
1157
|
display: "grid",
|
|
@@ -905,17 +1161,17 @@ function Export$1() {
|
|
|
905
1161
|
justifyContent: "start"
|
|
906
1162
|
}
|
|
907
1163
|
},
|
|
908
|
-
children: [jsx("div", {
|
|
1164
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
909
1165
|
css: {
|
|
910
1166
|
marginBottom: "var(--spacing)"
|
|
911
1167
|
},
|
|
912
1168
|
children: exportTitle
|
|
913
|
-
}), jsx(Button2, {
|
|
914
|
-
startIcon: jsx(Clipboard2, {}),
|
|
1169
|
+
}), /* @__PURE__ */ jsx(Button2, {
|
|
1170
|
+
startIcon: /* @__PURE__ */ jsx(Clipboard2, {}),
|
|
915
1171
|
onClick: copy,
|
|
916
1172
|
children: exportCopy
|
|
917
|
-
}), jsx(Button2, {
|
|
918
|
-
startIcon: jsx(Export2, {}),
|
|
1173
|
+
}), /* @__PURE__ */ jsx(Button2, {
|
|
1174
|
+
startIcon: /* @__PURE__ */ jsx(Export2, {}),
|
|
919
1175
|
onClick: download,
|
|
920
1176
|
children: exportDownload
|
|
921
1177
|
})]
|
|
@@ -923,138 +1179,9 @@ function Export$1() {
|
|
|
923
1179
|
})]
|
|
924
1180
|
});
|
|
925
1181
|
}
|
|
926
|
-
const FilterControlContext = createContext(() => void 0);
|
|
927
|
-
function FilterControl() {
|
|
928
|
-
const table = useTableContext();
|
|
929
|
-
const columnId = useColumnContext();
|
|
930
|
-
const IconButton2 = useTheme((t) => t.components.IconButton);
|
|
931
|
-
const Popover2 = useTheme((t) => t.components.Popover);
|
|
932
|
-
const FilterList2 = useTheme((t) => t.icons.FilterList);
|
|
933
|
-
const ArrowDropDown2 = useTheme((t) => t.icons.ArrowDropDown);
|
|
934
|
-
const cssVariables = useCssVariables();
|
|
935
|
-
const [anchor, setAnchor] = useState(null);
|
|
936
|
-
const isActive = table.useState((state) => {
|
|
937
|
-
const filter2 = state.filters.get(columnId);
|
|
938
|
-
const filterValue = state.filterValues.get(columnId);
|
|
939
|
-
return filter2 !== void 0 && filterValue !== void 0 && filter2.isActive(filterValue);
|
|
940
|
-
});
|
|
941
|
-
const filter = table.useState((state) => {
|
|
942
|
-
var _a;
|
|
943
|
-
return (_a = state.activeColumns.find((column) => column.id === columnId)) == null ? void 0 : _a.filter;
|
|
944
|
-
});
|
|
945
|
-
function reset() {
|
|
946
|
-
table.update((state) => {
|
|
947
|
-
state.filterValues.delete(columnId);
|
|
948
|
-
});
|
|
949
|
-
}
|
|
950
|
-
const close = useCallback(function() {
|
|
951
|
-
setAnchor(null);
|
|
952
|
-
}, []);
|
|
953
|
-
if (!filter)
|
|
954
|
-
return null;
|
|
955
|
-
return jsxs(FilterControlContext.Provider, {
|
|
956
|
-
value: close,
|
|
957
|
-
children: [jsx("div", {
|
|
958
|
-
onClick: (e2) => setAnchor(e2.currentTarget),
|
|
959
|
-
onContextMenu: (e2) => {
|
|
960
|
-
reset();
|
|
961
|
-
e2.preventDefault();
|
|
962
|
-
return false;
|
|
963
|
-
},
|
|
964
|
-
children: jsx(IconButton2, {
|
|
965
|
-
css: [{
|
|
966
|
-
color: "#b0bac9"
|
|
967
|
-
}, isActive && {
|
|
968
|
-
color: "var(--primaryMain) !important"
|
|
969
|
-
}],
|
|
970
|
-
children: isActive ? jsx(FilterList2, {}) : jsx(ArrowDropDown2, {})
|
|
971
|
-
})
|
|
972
|
-
}), jsx("div", {
|
|
973
|
-
onPointerDown: (e2) => {
|
|
974
|
-
e2.stopPropagation();
|
|
975
|
-
},
|
|
976
|
-
onPointerMove: (e2) => {
|
|
977
|
-
e2.stopPropagation();
|
|
978
|
-
},
|
|
979
|
-
children: jsx(Popover2, {
|
|
980
|
-
open: true,
|
|
981
|
-
hidden: !anchor,
|
|
982
|
-
onClose: () => setAnchor(null),
|
|
983
|
-
anchorEl: anchor != null ? anchor : document.body,
|
|
984
|
-
css: cssVariables,
|
|
985
|
-
children: filter
|
|
986
|
-
})
|
|
987
|
-
})]
|
|
988
|
-
});
|
|
989
|
-
}
|
|
990
|
-
function ResizeHandle() {
|
|
991
|
-
const table = useTableContext();
|
|
992
|
-
const columnId = useColumnContext();
|
|
993
|
-
const enabled = table.useState("props.enableColumnResize");
|
|
994
|
-
function onPointerDown(e2) {
|
|
995
|
-
e2.stopPropagation();
|
|
996
|
-
const div = e2.target;
|
|
997
|
-
div.setPointerCapture(e2.pointerId);
|
|
998
|
-
}
|
|
999
|
-
function onPointerMove(e2) {
|
|
1000
|
-
e2.stopPropagation();
|
|
1001
|
-
const div = e2.target;
|
|
1002
|
-
if (!div.hasPointerCapture(e2.pointerId))
|
|
1003
|
-
return;
|
|
1004
|
-
const parent = div.parentElement;
|
|
1005
|
-
const width = Math.max(e2.clientX - parent.getBoundingClientRect().left + 5, 50);
|
|
1006
|
-
table.update((state) => {
|
|
1007
|
-
state.columnWidths.set(columnId, `${width}px`);
|
|
1008
|
-
});
|
|
1009
|
-
}
|
|
1010
|
-
function onPointerUp(e2) {
|
|
1011
|
-
e2.stopPropagation();
|
|
1012
|
-
const div = e2.target;
|
|
1013
|
-
div.releasePointerCapture(e2.pointerId);
|
|
1014
|
-
}
|
|
1015
|
-
function onDoubleClick(e2) {
|
|
1016
|
-
table.update((state) => {
|
|
1017
|
-
if (e2.getModifierState("Control")) {
|
|
1018
|
-
state.columnWidths.delete(columnId);
|
|
1019
|
-
} else {
|
|
1020
|
-
state.columnWidths.set(columnId, "max-content");
|
|
1021
|
-
}
|
|
1022
|
-
});
|
|
1023
|
-
}
|
|
1024
|
-
return jsx(ResizeHandleView, {
|
|
1025
|
-
enabled,
|
|
1026
|
-
onPointerDown: enabled ? onPointerDown : void 0,
|
|
1027
|
-
onPointerMove: enabled ? onPointerMove : void 0,
|
|
1028
|
-
onPointerUp: enabled ? onPointerUp : void 0,
|
|
1029
|
-
onDoubleClick: enabled ? onDoubleClick : void 0
|
|
1030
|
-
});
|
|
1031
|
-
}
|
|
1032
|
-
function ResizeHandleView(_a) {
|
|
1033
|
-
var _b = _a, {
|
|
1034
|
-
enabled
|
|
1035
|
-
} = _b, props = __objRest(_b, [
|
|
1036
|
-
"enabled"
|
|
1037
|
-
]);
|
|
1038
|
-
return jsx("div", __spreadValues({
|
|
1039
|
-
css: {
|
|
1040
|
-
alignSelf: "stretch",
|
|
1041
|
-
padding: "0 5px",
|
|
1042
|
-
cursor: enabled ? "col-resize" : "initial",
|
|
1043
|
-
display: "flex",
|
|
1044
|
-
alignItems: "center",
|
|
1045
|
-
"&:after": {
|
|
1046
|
-
content: '""',
|
|
1047
|
-
width: 1,
|
|
1048
|
-
height: "1.5em",
|
|
1049
|
-
background: "#c9cfda",
|
|
1050
|
-
transition: "transform 300ms"
|
|
1051
|
-
}
|
|
1052
|
-
}
|
|
1053
|
-
}, props));
|
|
1054
|
-
}
|
|
1055
1182
|
const defaultWrapCell = (content) => {
|
|
1056
1183
|
if (typeof content === "string") {
|
|
1057
|
-
return jsx("span", {
|
|
1184
|
+
return /* @__PURE__ */ jsx("span", {
|
|
1058
1185
|
css: defaultClasses.text,
|
|
1059
1186
|
title: content,
|
|
1060
1187
|
children: content
|
|
@@ -1088,11 +1215,11 @@ const Cell = memo(function Cell2({
|
|
|
1088
1215
|
const className2 = useTheme((t) => cx(...calcClassNames(t.classes, item, rowIndex)));
|
|
1089
1216
|
if (!column || !item)
|
|
1090
1217
|
return null;
|
|
1091
|
-
const content = column.renderCell(column.value(item), item);
|
|
1092
|
-
return jsx("div", {
|
|
1218
|
+
const content = column.renderCell(column.value(item.value), item.value);
|
|
1219
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1093
1220
|
className: className2,
|
|
1094
1221
|
css: [defaultClasses.cell, columnStyleOverride],
|
|
1095
|
-
children: wrapCell(content, column.value(item), item, rowIndex)
|
|
1222
|
+
children: wrapCell(content, column.value(item.value), item.value, rowIndex)
|
|
1096
1223
|
});
|
|
1097
1224
|
});
|
|
1098
1225
|
function ExpandControl({
|
|
@@ -1138,21 +1265,21 @@ function ExpandControl({
|
|
|
1138
1265
|
}
|
|
1139
1266
|
}
|
|
1140
1267
|
if (isExpanded && hasDeferredChildren && !hasChildren) {
|
|
1141
|
-
return jsx(Spinner2, {
|
|
1268
|
+
return /* @__PURE__ */ jsx(Spinner2, {
|
|
1142
1269
|
css: {
|
|
1143
1270
|
margin: "0 var(--spacing)"
|
|
1144
1271
|
}
|
|
1145
1272
|
});
|
|
1146
1273
|
}
|
|
1147
|
-
return jsx(IconButton2, {
|
|
1274
|
+
return /* @__PURE__ */ jsx(IconButton2, {
|
|
1148
1275
|
onClick: toggle2,
|
|
1149
|
-
children: jsx("span", {
|
|
1276
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
1150
1277
|
css: {
|
|
1151
1278
|
display: "inline-flex",
|
|
1152
1279
|
transition: "all 300ms",
|
|
1153
1280
|
transform: isExpanded ? "rotate3d(0, 0, 1, 90deg)" : "rotate3d(0, 0, 1, 0deg)"
|
|
1154
1281
|
},
|
|
1155
|
-
children: jsx(ChevronRight2, {})
|
|
1282
|
+
children: /* @__PURE__ */ jsx(ChevronRight2, {})
|
|
1156
1283
|
})
|
|
1157
1284
|
});
|
|
1158
1285
|
}
|
|
@@ -1212,7 +1339,7 @@ function SelectComponent({
|
|
|
1212
1339
|
state.lastSelectedId = itemId;
|
|
1213
1340
|
});
|
|
1214
1341
|
}
|
|
1215
|
-
return jsx(Checkbox2, {
|
|
1342
|
+
return /* @__PURE__ */ jsx(Checkbox2, {
|
|
1216
1343
|
css: {
|
|
1217
1344
|
justifySelf: "start",
|
|
1218
1345
|
color: "#c9cfda"
|
|
@@ -1246,10 +1373,10 @@ const Row = memo(function Row2({
|
|
|
1246
1373
|
className: cx(...calcClassNames(classes, item, rowIndex)),
|
|
1247
1374
|
indent: item ? getAncestors(state.activeItemsById, item).size : 0,
|
|
1248
1375
|
hasChildren: !!(item == null ? void 0 : item.children.length),
|
|
1249
|
-
hasDeferredChildren: item && ((_b = (_a = state.props).hasDeferredChildren) == null ? void 0 : _b.call(_a, item)),
|
|
1376
|
+
hasDeferredChildren: item && ((_b = (_a = state.props).hasDeferredChildren) == null ? void 0 : _b.call(_a, item.value)),
|
|
1250
1377
|
columnIds: state.activeColumns.map((column) => column.id),
|
|
1251
1378
|
enableSelection: state.props.enableSelection,
|
|
1252
|
-
rowAction: state.props.rowAction instanceof Function ? item ? state.props.rowAction(item, rowIndex) : null : state.props.rowAction
|
|
1379
|
+
rowAction: state.props.rowAction instanceof Function ? item ? state.props.rowAction(item.value, rowIndex) : null : state.props.rowAction
|
|
1253
1380
|
};
|
|
1254
1381
|
});
|
|
1255
1382
|
useEffect(() => {
|
|
@@ -1270,110 +1397,36 @@ const Row = memo(function Row2({
|
|
|
1270
1397
|
var _a, _b;
|
|
1271
1398
|
return (_b = (_a = table.getState().props).debugRender) == null ? void 0 : _b.call(_a, "render row", itemId);
|
|
1272
1399
|
});
|
|
1273
|
-
return jsxs(Fragment, {
|
|
1274
|
-
children: [jsx("div", {
|
|
1400
|
+
return /* @__PURE__ */ jsxs(Fragment, {
|
|
1401
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
1275
1402
|
className: className2,
|
|
1276
1403
|
css: [defaultClasses.cellFill],
|
|
1277
1404
|
ref: divRef
|
|
1278
|
-
}), jsxs("div", {
|
|
1405
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
1279
1406
|
className: className2,
|
|
1280
1407
|
css: [defaultClasses.cell, defaultClasses.firstCell],
|
|
1281
|
-
children: [jsx("div", {
|
|
1408
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
1282
1409
|
css: {
|
|
1283
1410
|
width: indent * 20
|
|
1284
1411
|
}
|
|
1285
|
-
}), enableSelection && jsx(SelectComponent, {
|
|
1412
|
+
}), enableSelection && /* @__PURE__ */ jsx(SelectComponent, {
|
|
1286
1413
|
itemId
|
|
1287
|
-
}), (hasChildren || hasDeferredChildren) && jsx(ExpandControl, {
|
|
1414
|
+
}), (hasChildren || hasDeferredChildren) && /* @__PURE__ */ jsx(ExpandControl, {
|
|
1288
1415
|
itemId,
|
|
1289
1416
|
hasDeferredChildren
|
|
1290
1417
|
}), rowAction]
|
|
1291
|
-
}), columnIds.map((columnId) => jsx(ColumnContext.Provider, {
|
|
1418
|
+
}), columnIds.map((columnId) => /* @__PURE__ */ jsx(ColumnContext.Provider, {
|
|
1292
1419
|
value: columnId,
|
|
1293
|
-
children: jsx(Cell, {
|
|
1420
|
+
children: /* @__PURE__ */ jsx(Cell, {
|
|
1294
1421
|
itemId,
|
|
1295
1422
|
rowIndex
|
|
1296
1423
|
})
|
|
1297
|
-
}, columnId)), jsx("div", {
|
|
1424
|
+
}, columnId)), /* @__PURE__ */ jsx("div", {
|
|
1298
1425
|
className: className2,
|
|
1299
1426
|
css: [defaultClasses.cellFill]
|
|
1300
1427
|
})]
|
|
1301
1428
|
});
|
|
1302
1429
|
});
|
|
1303
|
-
function SortComponent({
|
|
1304
|
-
children
|
|
1305
|
-
}) {
|
|
1306
|
-
const table = useTableContext();
|
|
1307
|
-
const columnId = useColumnContext();
|
|
1308
|
-
const Badge2 = useTheme((t) => t.components.Badge);
|
|
1309
|
-
const ArrowUpward2 = useTheme((t) => t.icons.ArrowUpward);
|
|
1310
|
-
const {
|
|
1311
|
-
direction,
|
|
1312
|
-
index
|
|
1313
|
-
} = table.useState((state) => {
|
|
1314
|
-
var _a, _b;
|
|
1315
|
-
const index2 = (_a = state.sort.findIndex((s) => s.columnId === columnId)) != null ? _a : -1;
|
|
1316
|
-
return {
|
|
1317
|
-
direction: (_b = state.sort[index2]) == null ? void 0 : _b.direction,
|
|
1318
|
-
index: index2 >= 0 && state.sort.length > 1 ? index2 + 1 : void 0
|
|
1319
|
-
};
|
|
1320
|
-
});
|
|
1321
|
-
function toggle2(e2, off) {
|
|
1322
|
-
const {
|
|
1323
|
-
props: {
|
|
1324
|
-
sort: controlledSort,
|
|
1325
|
-
onSortChange
|
|
1326
|
-
}
|
|
1327
|
-
} = table.getState();
|
|
1328
|
-
const newDirection = direction === "asc" ? "desc" : "asc";
|
|
1329
|
-
const newSort = e2.getModifierState("Control") || off ? table.getState().sort.filter((s) => s.columnId !== columnId) : [];
|
|
1330
|
-
if (!off) {
|
|
1331
|
-
newSort.push({
|
|
1332
|
-
columnId,
|
|
1333
|
-
direction: newDirection
|
|
1334
|
-
});
|
|
1335
|
-
}
|
|
1336
|
-
onSortChange == null ? void 0 : onSortChange(newSort);
|
|
1337
|
-
if (!controlledSort) {
|
|
1338
|
-
table.update((state) => {
|
|
1339
|
-
state.sort = newSort;
|
|
1340
|
-
});
|
|
1341
|
-
}
|
|
1342
|
-
e2.preventDefault();
|
|
1343
|
-
return false;
|
|
1344
|
-
}
|
|
1345
|
-
return jsxs("div", {
|
|
1346
|
-
css: {
|
|
1347
|
-
userSelect: "none",
|
|
1348
|
-
display: "grid",
|
|
1349
|
-
gridTemplateColumns: "minmax(0, 1fr) max-content",
|
|
1350
|
-
alignItems: "center",
|
|
1351
|
-
cursor: "pointer",
|
|
1352
|
-
"& > div": {
|
|
1353
|
-
overflow: "hidden",
|
|
1354
|
-
textOverflow: "ellipsis"
|
|
1355
|
-
}
|
|
1356
|
-
},
|
|
1357
|
-
onClick: (e2) => toggle2(e2),
|
|
1358
|
-
onContextMenu: (e2) => toggle2(e2, true),
|
|
1359
|
-
children: [jsx("div", {
|
|
1360
|
-
children
|
|
1361
|
-
}), jsx(Badge2, {
|
|
1362
|
-
badgeContent: index,
|
|
1363
|
-
children: jsx("span", {
|
|
1364
|
-
css: [{
|
|
1365
|
-
transition: "all 300ms",
|
|
1366
|
-
fontSize: "0.8em"
|
|
1367
|
-
}, !direction && {
|
|
1368
|
-
opacity: 0
|
|
1369
|
-
}, direction === "desc" && {
|
|
1370
|
-
transform: "rotate3d(0, 0, 1, 180deg)"
|
|
1371
|
-
}],
|
|
1372
|
-
children: jsx(ArrowUpward2, {})
|
|
1373
|
-
})
|
|
1374
|
-
})]
|
|
1375
|
-
});
|
|
1376
|
-
}
|
|
1377
1430
|
function throttle(fn, ms) {
|
|
1378
1431
|
let last = 0;
|
|
1379
1432
|
let lastArgs;
|
|
@@ -1426,9 +1479,11 @@ const relativeOffset = (x, y) => {
|
|
|
1426
1479
|
function Virtualized(_c) {
|
|
1427
1480
|
var _d = _c, {
|
|
1428
1481
|
header,
|
|
1482
|
+
footer,
|
|
1429
1483
|
children
|
|
1430
1484
|
} = _d, props = __objRest(_d, [
|
|
1431
1485
|
"header",
|
|
1486
|
+
"footer",
|
|
1432
1487
|
"children"
|
|
1433
1488
|
]);
|
|
1434
1489
|
var _a, _b;
|
|
@@ -1510,19 +1565,19 @@ function Virtualized(_c) {
|
|
|
1510
1565
|
var _a2, _b2;
|
|
1511
1566
|
return (_b2 = (_a2 = table.getState().props).debugRender) == null ? void 0 : _b2.call(_a2, `Virtualalized render ${from} to ${to}`);
|
|
1512
1567
|
});
|
|
1513
|
-
return jsxs("div", __spreadProps(__spreadValues({}, props), {
|
|
1514
|
-
children: [header, virtual && jsx("div", {
|
|
1568
|
+
return /* @__PURE__ */ jsxs("div", __spreadProps(__spreadValues({}, props), {
|
|
1569
|
+
children: [header, virtual && /* @__PURE__ */ jsx("div", {
|
|
1515
1570
|
style: {
|
|
1516
1571
|
gridColumn: "1 / -1",
|
|
1517
1572
|
height: before
|
|
1518
1573
|
},
|
|
1519
1574
|
ref: probeRef
|
|
1520
|
-
}), children(itemIds, from), virtual && jsx("div", {
|
|
1575
|
+
}), children(itemIds, from), virtual && /* @__PURE__ */ jsx("div", {
|
|
1521
1576
|
style: {
|
|
1522
1577
|
gridColumn: "1 / -1",
|
|
1523
1578
|
height: after
|
|
1524
1579
|
}
|
|
1525
|
-
})]
|
|
1580
|
+
}), footer]
|
|
1526
1581
|
}));
|
|
1527
1582
|
}
|
|
1528
1583
|
const TableContext = createContext(null);
|
|
@@ -1545,10 +1600,10 @@ function Table(props) {
|
|
|
1545
1600
|
var _a, _b;
|
|
1546
1601
|
return (_b = (_a = table.getState().props).debugRender) == null ? void 0 : _b.call(_a, "render table");
|
|
1547
1602
|
});
|
|
1548
|
-
return jsx(TableContext.Provider, {
|
|
1603
|
+
return /* @__PURE__ */ jsx(TableContext.Provider, {
|
|
1549
1604
|
value: table,
|
|
1550
|
-
children: jsx(TableMemoContextProvider, {
|
|
1551
|
-
children: jsx(TableLoadingState, {})
|
|
1605
|
+
children: /* @__PURE__ */ jsx(TableMemoContextProvider, {
|
|
1606
|
+
children: /* @__PURE__ */ jsx(TableLoadingState, {})
|
|
1552
1607
|
})
|
|
1553
1608
|
});
|
|
1554
1609
|
}
|
|
@@ -1560,10 +1615,10 @@ function TableLoadingState() {
|
|
|
1560
1615
|
const handle = setTimeout(() => setShowLoading(true), 500);
|
|
1561
1616
|
return () => clearTimeout(handle);
|
|
1562
1617
|
});
|
|
1563
|
-
return jsxs(Fragment, {
|
|
1564
|
-
children: [!isHydrated && showLoading && jsx("div", {
|
|
1618
|
+
return /* @__PURE__ */ jsxs(Fragment, {
|
|
1619
|
+
children: [!isHydrated && showLoading && /* @__PURE__ */ jsx("div", {
|
|
1565
1620
|
children: loadingText
|
|
1566
|
-
}), jsx(TableInner, {
|
|
1621
|
+
}), /* @__PURE__ */ jsx(TableInner, {
|
|
1567
1622
|
hidden: !isHydrated
|
|
1568
1623
|
})]
|
|
1569
1624
|
});
|
|
@@ -1576,17 +1631,15 @@ const TableInner = memo(function TableInner2({
|
|
|
1576
1631
|
const activeColumns = table.useState((state) => state.activeColumns.map((column) => ({
|
|
1577
1632
|
id: column.id,
|
|
1578
1633
|
width: column.width,
|
|
1579
|
-
classes: column.classes
|
|
1580
|
-
header: column.header
|
|
1634
|
+
classes: column.classes
|
|
1581
1635
|
})));
|
|
1582
1636
|
const columnWidths = table.useState("columnWidths", {
|
|
1583
1637
|
throttle: 16
|
|
1584
1638
|
});
|
|
1585
|
-
const
|
|
1586
|
-
|
|
1587
|
-
});
|
|
1588
|
-
const classes = table.useState("props.classes");
|
|
1639
|
+
const hasFooter = table.useState((state) => state.activeColumns.some((column) => column.footer));
|
|
1640
|
+
const classes = useTheme((theme) => theme.classes);
|
|
1589
1641
|
const stickyHeader = table.useState("props.stickyHeader");
|
|
1642
|
+
const stickyFooter = table.useState("props.stickyFooter");
|
|
1590
1643
|
const enableSelection = table.useState("props.enableSelection");
|
|
1591
1644
|
const enableColumnSelection = table.useState("props.enableColumnSelection");
|
|
1592
1645
|
const enableExport = table.useState((state) => !!state.props.enableExport.copy || !!state.props.enableExport.download);
|
|
@@ -1595,7 +1648,7 @@ const TableInner = memo(function TableInner2({
|
|
|
1595
1648
|
var _a, _b;
|
|
1596
1649
|
return (_b = (_a = table.getState().props).debugRender) == null ? void 0 : _b.call(_a, "render table inner");
|
|
1597
1650
|
});
|
|
1598
|
-
return jsx(Virtualized, {
|
|
1651
|
+
return /* @__PURE__ */ jsx(Virtualized, {
|
|
1599
1652
|
className: classes == null ? void 0 : classes.table,
|
|
1600
1653
|
css: [cssVariables, defaultClasses.table, {
|
|
1601
1654
|
gridTemplateColumns: [
|
|
@@ -1610,38 +1663,40 @@ const TableInner = memo(function TableInner2({
|
|
|
1610
1663
|
}, hidden && {
|
|
1611
1664
|
visibility: "hidden"
|
|
1612
1665
|
}],
|
|
1613
|
-
header: jsxs(Fragment, {
|
|
1614
|
-
children: [jsx("div", {
|
|
1666
|
+
header: /* @__PURE__ */ jsxs(Fragment, {
|
|
1667
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
1615
1668
|
className: classes == null ? void 0 : classes.headerCell,
|
|
1616
1669
|
css: [defaultClasses.headerFill, stickyHeader && defaultClasses.sticky, stickyHeader instanceof Object && stickyHeader]
|
|
1617
|
-
}), jsxs("div", {
|
|
1670
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
1618
1671
|
className: classes == null ? void 0 : classes.headerCell,
|
|
1619
1672
|
css: [defaultClasses.headerCell, stickyHeader && defaultClasses.sticky, stickyHeader instanceof Object && stickyHeader],
|
|
1620
|
-
children: [enableSelection && jsx(SelectComponent, {}), enableColumnSelection && jsx(ColumnSelection, {}), enableExport && jsx(Export$1, {}), jsx(ResizeHandleView, {})]
|
|
1621
|
-
}), jsx(ColumnHeaderContext.Provider, {
|
|
1622
|
-
children: activeColumns.map((column) => {
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
className: cx(classes == null ? void 0 : classes.headerCell, (_a = column.classes) == null ? void 0 : _a.headerCell),
|
|
1628
|
-
css: [defaultClasses.headerCell, columnStyleOverride.get(column.id), stickyHeader && defaultClasses.sticky, stickyHeader instanceof Object && stickyHeader],
|
|
1629
|
-
children: [jsx(SortComponent, {
|
|
1630
|
-
children: column.header
|
|
1631
|
-
}), jsx("div", {
|
|
1632
|
-
css: {
|
|
1633
|
-
flex: 1
|
|
1634
|
-
}
|
|
1635
|
-
}), jsx(FilterControl, {}), jsx(ResizeHandle, {})]
|
|
1636
|
-
}, column.id)
|
|
1637
|
-
}, column.id);
|
|
1638
|
-
})
|
|
1639
|
-
}), jsx("div", {
|
|
1673
|
+
children: [enableSelection && /* @__PURE__ */ jsx(SelectComponent, {}), enableColumnSelection && /* @__PURE__ */ jsx(ColumnSelection, {}), enableExport && /* @__PURE__ */ jsx(Export$1, {}), /* @__PURE__ */ jsx(ResizeHandleView, {})]
|
|
1674
|
+
}), /* @__PURE__ */ jsx(ColumnHeaderContext.Provider, {
|
|
1675
|
+
children: activeColumns.map((column) => /* @__PURE__ */ jsx(ColumnContext.Provider, {
|
|
1676
|
+
value: column.id,
|
|
1677
|
+
children: /* @__PURE__ */ jsx(ColumnHeader, {})
|
|
1678
|
+
}, column.id))
|
|
1679
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
1640
1680
|
className: classes == null ? void 0 : classes.headerCell,
|
|
1641
1681
|
css: [defaultClasses.headerFill, stickyHeader && defaultClasses.sticky, stickyHeader instanceof Object && stickyHeader]
|
|
1642
1682
|
})]
|
|
1643
1683
|
}),
|
|
1644
|
-
|
|
1684
|
+
footer: hasFooter && /* @__PURE__ */ jsxs(Fragment, {
|
|
1685
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
1686
|
+
className: classes == null ? void 0 : classes.footerCell,
|
|
1687
|
+
css: [defaultClasses.footerFill, stickyFooter && defaultClasses.stickyBottom, stickyFooter instanceof Object && stickyFooter]
|
|
1688
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
1689
|
+
className: classes == null ? void 0 : classes.footerCell,
|
|
1690
|
+
css: [defaultClasses.footerFill, stickyFooter && defaultClasses.stickyBottom, stickyFooter instanceof Object && stickyFooter]
|
|
1691
|
+
}), activeColumns.map((column) => /* @__PURE__ */ jsx(ColumnContext.Provider, {
|
|
1692
|
+
value: column.id,
|
|
1693
|
+
children: /* @__PURE__ */ jsx(ColumnFooter, {})
|
|
1694
|
+
}, column.id)), /* @__PURE__ */ jsx("div", {
|
|
1695
|
+
className: classes == null ? void 0 : classes.footerCell,
|
|
1696
|
+
css: [defaultClasses.footerFill, stickyFooter && defaultClasses.stickyBottom, stickyFooter instanceof Object && stickyFooter]
|
|
1697
|
+
})]
|
|
1698
|
+
}),
|
|
1699
|
+
children: (itemIds, startIndex) => itemIds.map((itemId, index) => /* @__PURE__ */ jsx(Row, {
|
|
1645
1700
|
itemId,
|
|
1646
1701
|
rowIndex: startIndex + index
|
|
1647
1702
|
}, itemId))
|
|
@@ -1654,7 +1709,7 @@ const defaultColors = {
|
|
|
1654
1709
|
function Spinner({
|
|
1655
1710
|
className: className2
|
|
1656
1711
|
}) {
|
|
1657
|
-
return jsxs("div", {
|
|
1712
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1658
1713
|
className: className2,
|
|
1659
1714
|
css: css`
|
|
1660
1715
|
display: inline-block;
|
|
@@ -1692,7 +1747,7 @@ function Spinner({
|
|
|
1692
1747
|
}
|
|
1693
1748
|
}
|
|
1694
1749
|
`,
|
|
1695
|
-
children: [jsx("div", {}), jsx("div", {}), jsx("div", {})]
|
|
1750
|
+
children: [/* @__PURE__ */ jsx("div", {}), /* @__PURE__ */ jsx("div", {}), /* @__PURE__ */ jsx("div", {})]
|
|
1696
1751
|
});
|
|
1697
1752
|
}
|
|
1698
1753
|
const Badge = ({
|
|
@@ -1701,14 +1756,14 @@ const Badge = ({
|
|
|
1701
1756
|
}) => {
|
|
1702
1757
|
if (!open)
|
|
1703
1758
|
return null;
|
|
1704
|
-
return jsxs("span", {
|
|
1759
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
1705
1760
|
css: {
|
|
1706
1761
|
display: "inline-flex",
|
|
1707
1762
|
position: "relative",
|
|
1708
1763
|
flexShrink: 0,
|
|
1709
1764
|
verticalAlign: "middle"
|
|
1710
1765
|
},
|
|
1711
|
-
children: [children, jsx("span", {
|
|
1766
|
+
children: [children, /* @__PURE__ */ jsx("span", {
|
|
1712
1767
|
css: [{
|
|
1713
1768
|
top: 0,
|
|
1714
1769
|
right: 0,
|
|
@@ -1746,7 +1801,7 @@ const Button = (_e) => {
|
|
|
1746
1801
|
"children",
|
|
1747
1802
|
"variant"
|
|
1748
1803
|
]);
|
|
1749
|
-
return jsxs("button", __spreadProps(__spreadValues({
|
|
1804
|
+
return /* @__PURE__ */ jsxs("button", __spreadProps(__spreadValues({
|
|
1750
1805
|
css: [{
|
|
1751
1806
|
padding: `var(--spacing) calc(var(--spacing) * 2)`,
|
|
1752
1807
|
display: "inline-flex",
|
|
@@ -1781,12 +1836,12 @@ const Button = (_e) => {
|
|
|
1781
1836
|
}
|
|
1782
1837
|
}]
|
|
1783
1838
|
}, props), {
|
|
1784
|
-
children: [startIcon && jsx("span", {
|
|
1839
|
+
children: [startIcon && /* @__PURE__ */ jsx("span", {
|
|
1785
1840
|
css: {
|
|
1786
1841
|
marginRight: `calc(var(--spacing) * 2)`
|
|
1787
1842
|
},
|
|
1788
1843
|
children: startIcon
|
|
1789
|
-
}), jsx("span", {
|
|
1844
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
1790
1845
|
children
|
|
1791
1846
|
})]
|
|
1792
1847
|
}));
|
|
@@ -1797,7 +1852,7 @@ const Checkbox = (_g) => {
|
|
|
1797
1852
|
} = _h, props = __objRest(_h, [
|
|
1798
1853
|
"className"
|
|
1799
1854
|
]);
|
|
1800
|
-
return jsxs("label", {
|
|
1855
|
+
return /* @__PURE__ */ jsxs("label", {
|
|
1801
1856
|
css: [{
|
|
1802
1857
|
padding: "calc(var(--spacing) * 1.8)",
|
|
1803
1858
|
display: "flex",
|
|
@@ -1811,9 +1866,9 @@ const Checkbox = (_g) => {
|
|
|
1811
1866
|
color: "rgba(0, 0, 0, 0.26)"
|
|
1812
1867
|
}],
|
|
1813
1868
|
className: className2,
|
|
1814
|
-
children: [jsx("input", __spreadValues({
|
|
1869
|
+
children: [/* @__PURE__ */ jsx("input", __spreadValues({
|
|
1815
1870
|
type: "checkbox"
|
|
1816
|
-
}, props)), props.checked ? jsx("svg", {
|
|
1871
|
+
}, props)), props.checked ? /* @__PURE__ */ jsx("svg", {
|
|
1817
1872
|
css: {
|
|
1818
1873
|
fontSize: "1.25rem",
|
|
1819
1874
|
width: "1em",
|
|
@@ -1823,10 +1878,10 @@ const Checkbox = (_g) => {
|
|
|
1823
1878
|
focusable: "false",
|
|
1824
1879
|
viewBox: "0 0 24 24",
|
|
1825
1880
|
"aria-hidden": "true",
|
|
1826
|
-
children: jsx("path", {
|
|
1881
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
1827
1882
|
d: "M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-9 14l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"
|
|
1828
1883
|
})
|
|
1829
|
-
}) : jsx("svg", {
|
|
1884
|
+
}) : /* @__PURE__ */ jsx("svg", {
|
|
1830
1885
|
css: {
|
|
1831
1886
|
fontSize: "1.25rem",
|
|
1832
1887
|
width: "1em",
|
|
@@ -1836,14 +1891,14 @@ const Checkbox = (_g) => {
|
|
|
1836
1891
|
focusable: "false",
|
|
1837
1892
|
viewBox: "0 0 24 24",
|
|
1838
1893
|
"aria-hidden": "true",
|
|
1839
|
-
children: jsx("path", {
|
|
1894
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
1840
1895
|
d: "M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"
|
|
1841
1896
|
})
|
|
1842
1897
|
})]
|
|
1843
1898
|
});
|
|
1844
1899
|
};
|
|
1845
1900
|
const IconButton = (props) => {
|
|
1846
|
-
return jsx("button", __spreadValues({
|
|
1901
|
+
return /* @__PURE__ */ jsx("button", __spreadValues({
|
|
1847
1902
|
css: {
|
|
1848
1903
|
padding: "var(--spacing)",
|
|
1849
1904
|
borderRadius: "50%",
|
|
@@ -1876,12 +1931,12 @@ const TextField = (_i) => {
|
|
|
1876
1931
|
]);
|
|
1877
1932
|
var _a;
|
|
1878
1933
|
const [focus, setFocus] = useState(false);
|
|
1879
|
-
return jsx("div", {
|
|
1934
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1880
1935
|
className: className2,
|
|
1881
1936
|
css: {
|
|
1882
1937
|
display: "flex"
|
|
1883
1938
|
},
|
|
1884
|
-
children: jsxs("span", {
|
|
1939
|
+
children: /* @__PURE__ */ jsxs("span", {
|
|
1885
1940
|
css: [{
|
|
1886
1941
|
flex: 1,
|
|
1887
1942
|
display: "flex",
|
|
@@ -1892,7 +1947,7 @@ const TextField = (_i) => {
|
|
|
1892
1947
|
border: "2px solid var(--primaryMain)",
|
|
1893
1948
|
margin: -1
|
|
1894
1949
|
}],
|
|
1895
|
-
children: [jsx("input", __spreadProps(__spreadValues({
|
|
1950
|
+
children: [/* @__PURE__ */ jsx("input", __spreadProps(__spreadValues({
|
|
1896
1951
|
ref: inputRef
|
|
1897
1952
|
}, props), {
|
|
1898
1953
|
value: (_a = props.value) != null ? _a : "",
|
|
@@ -1926,7 +1981,7 @@ const IconDefaultStyle = css({
|
|
|
1926
1981
|
color: "inherit"
|
|
1927
1982
|
});
|
|
1928
1983
|
function Icon(svg) {
|
|
1929
|
-
return (props) => jsx(ClassNames, {
|
|
1984
|
+
return (props) => /* @__PURE__ */ jsx(ClassNames, {
|
|
1930
1985
|
children: ({
|
|
1931
1986
|
css: css2
|
|
1932
1987
|
}) => cloneElement(svg, __spreadProps(__spreadValues({}, props), {
|
|
@@ -1934,120 +1989,120 @@ function Icon(svg) {
|
|
|
1934
1989
|
}))
|
|
1935
1990
|
});
|
|
1936
1991
|
}
|
|
1937
|
-
const Settings = Icon(jsxs("svg", {
|
|
1992
|
+
const Settings = Icon(/* @__PURE__ */ jsxs("svg", {
|
|
1938
1993
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1939
1994
|
height: "24px",
|
|
1940
1995
|
viewBox: "0 0 24 24",
|
|
1941
1996
|
width: "24px",
|
|
1942
1997
|
fill: "currentColor",
|
|
1943
|
-
children: [jsx("path", {
|
|
1998
|
+
children: [/* @__PURE__ */ jsx("path", {
|
|
1944
1999
|
d: "M0 0h24v24H0V0z",
|
|
1945
2000
|
fill: "none"
|
|
1946
|
-
}), jsx("path", {
|
|
2001
|
+
}), /* @__PURE__ */ jsx("path", {
|
|
1947
2002
|
d: "M3 17v2h6v-2H3zM3 5v2h10V5H3zm10 16v-2h8v-2h-8v-2h-2v6h2zM7 9v2H3v2h4v2h2V9H7zm14 4v-2H11v2h10zm-6-4h2V7h4V5h-4V3h-2v6z"
|
|
1948
2003
|
})]
|
|
1949
2004
|
}));
|
|
1950
|
-
const Export = Icon(jsxs("svg", {
|
|
2005
|
+
const Export = Icon(/* @__PURE__ */ jsxs("svg", {
|
|
1951
2006
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1952
2007
|
enableBackground: "new 0 0 24 24",
|
|
1953
2008
|
height: "24px",
|
|
1954
2009
|
viewBox: "0 0 24 24",
|
|
1955
2010
|
width: "24px",
|
|
1956
2011
|
fill: "currentColor",
|
|
1957
|
-
children: [jsx("g", {
|
|
1958
|
-
children: jsx("rect", {
|
|
2012
|
+
children: [/* @__PURE__ */ jsx("g", {
|
|
2013
|
+
children: /* @__PURE__ */ jsx("rect", {
|
|
1959
2014
|
fill: "none",
|
|
1960
2015
|
height: "24",
|
|
1961
2016
|
width: "24"
|
|
1962
2017
|
})
|
|
1963
|
-
}), jsx("g", {
|
|
1964
|
-
children: jsx("path", {
|
|
2018
|
+
}), /* @__PURE__ */ jsx("g", {
|
|
2019
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
1965
2020
|
d: "M18,15v3H6v-3H4v3c0,1.1,0.9,2,2,2h12c1.1,0,2-0.9,2-2v-3H18z M17,11l-1.41-1.41L13,12.17V4h-2v8.17L8.41,9.59L7,11l5,5 L17,11z"
|
|
1966
2021
|
})
|
|
1967
2022
|
})]
|
|
1968
2023
|
}));
|
|
1969
|
-
const Clipboard = Icon(jsxs("svg", {
|
|
2024
|
+
const Clipboard = Icon(/* @__PURE__ */ jsxs("svg", {
|
|
1970
2025
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1971
2026
|
height: "24px",
|
|
1972
2027
|
viewBox: "0 0 24 24",
|
|
1973
2028
|
width: "24px",
|
|
1974
2029
|
fill: "currentColor",
|
|
1975
|
-
children: [jsx("path", {
|
|
2030
|
+
children: [/* @__PURE__ */ jsx("path", {
|
|
1976
2031
|
d: "M0 0h24v24H0V0z",
|
|
1977
2032
|
fill: "none"
|
|
1978
|
-
}), jsx("path", {
|
|
2033
|
+
}), /* @__PURE__ */ jsx("path", {
|
|
1979
2034
|
d: "M19 2h-4.18C14.4.84 13.3 0 12 0S9.6.84 9.18 2H5c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-7 0c.55 0 1 .45 1 1s-.45 1-1 1-1-.45-1-1 .45-1 1-1zm7 18H5V4h2v3h10V4h2v16z"
|
|
1980
2035
|
})]
|
|
1981
2036
|
}));
|
|
1982
|
-
const ChevronRight = Icon(jsxs("svg", {
|
|
2037
|
+
const ChevronRight = Icon(/* @__PURE__ */ jsxs("svg", {
|
|
1983
2038
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1984
2039
|
height: "24px",
|
|
1985
2040
|
viewBox: "0 0 24 24",
|
|
1986
2041
|
width: "24px",
|
|
1987
2042
|
fill: "currentColor",
|
|
1988
|
-
children: [jsx("path", {
|
|
2043
|
+
children: [/* @__PURE__ */ jsx("path", {
|
|
1989
2044
|
d: "M0 0h24v24H0V0z",
|
|
1990
2045
|
fill: "none"
|
|
1991
|
-
}), jsx("path", {
|
|
2046
|
+
}), /* @__PURE__ */ jsx("path", {
|
|
1992
2047
|
d: "M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6-6-6z"
|
|
1993
2048
|
})]
|
|
1994
2049
|
}));
|
|
1995
|
-
const Search = Icon(jsxs("svg", {
|
|
2050
|
+
const Search = Icon(/* @__PURE__ */ jsxs("svg", {
|
|
1996
2051
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1997
2052
|
height: "24px",
|
|
1998
2053
|
viewBox: "0 0 24 24",
|
|
1999
2054
|
width: "24px",
|
|
2000
2055
|
fill: "currentColor",
|
|
2001
|
-
children: [jsx("path", {
|
|
2056
|
+
children: [/* @__PURE__ */ jsx("path", {
|
|
2002
2057
|
d: "M0 0h24v24H0V0z",
|
|
2003
2058
|
fill: "none"
|
|
2004
|
-
}), jsx("path", {
|
|
2059
|
+
}), /* @__PURE__ */ jsx("path", {
|
|
2005
2060
|
d: "M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"
|
|
2006
2061
|
})]
|
|
2007
2062
|
}));
|
|
2008
|
-
const Clear = Icon(jsxs("svg", {
|
|
2063
|
+
const Clear = Icon(/* @__PURE__ */ jsxs("svg", {
|
|
2009
2064
|
xmlns: "http://www.w3.org/2000/svg",
|
|
2010
2065
|
height: "24px",
|
|
2011
2066
|
viewBox: "0 0 24 24",
|
|
2012
2067
|
width: "24px",
|
|
2013
2068
|
fill: "currentColor",
|
|
2014
|
-
children: [jsx("path", {
|
|
2069
|
+
children: [/* @__PURE__ */ jsx("path", {
|
|
2015
2070
|
d: "M0 0h24v24H0V0z",
|
|
2016
2071
|
fill: "none"
|
|
2017
|
-
}), jsx("path", {
|
|
2072
|
+
}), /* @__PURE__ */ jsx("path", {
|
|
2018
2073
|
d: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"
|
|
2019
2074
|
})]
|
|
2020
2075
|
}));
|
|
2021
|
-
const ArrowDropDown = Icon(jsxs("svg", {
|
|
2076
|
+
const ArrowDropDown = Icon(/* @__PURE__ */ jsxs("svg", {
|
|
2022
2077
|
xmlns: "http://www.w3.org/2000/svg",
|
|
2023
2078
|
height: "24px",
|
|
2024
2079
|
viewBox: "0 0 24 24",
|
|
2025
2080
|
width: "24px",
|
|
2026
2081
|
fill: "currentColor",
|
|
2027
|
-
children: [jsx("path", {
|
|
2082
|
+
children: [/* @__PURE__ */ jsx("path", {
|
|
2028
2083
|
d: "M0 0h24v24H0V0z",
|
|
2029
2084
|
fill: "none"
|
|
2030
|
-
}), jsx("path", {
|
|
2085
|
+
}), /* @__PURE__ */ jsx("path", {
|
|
2031
2086
|
d: "M7 10l5 5 5-5H7z"
|
|
2032
2087
|
})]
|
|
2033
2088
|
}));
|
|
2034
|
-
const FilterList = Icon(jsx("svg", {
|
|
2089
|
+
const FilterList = Icon(/* @__PURE__ */ jsx("svg", {
|
|
2035
2090
|
viewBox: "0 0 24 24",
|
|
2036
|
-
children: jsx("path", {
|
|
2091
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
2037
2092
|
fill: "currentColor",
|
|
2038
2093
|
d: "M14,12V19.88C14.04,20.18 13.94,20.5 13.71,20.71C13.32,21.1 12.69,21.1 12.3,20.71L10.29,18.7C10.06,18.47 9.96,18.16 10,17.87V12H9.97L4.21,4.62C3.87,4.19 3.95,3.56 4.38,3.22C4.57,3.08 4.78,3 5,3V3H19V3C19.22,3 19.43,3.08 19.62,3.22C20.05,3.56 20.13,4.19 19.79,4.62L14.03,12H14Z"
|
|
2039
2094
|
})
|
|
2040
2095
|
}));
|
|
2041
|
-
const ArrowUpward = Icon(jsxs("svg", {
|
|
2096
|
+
const ArrowUpward = Icon(/* @__PURE__ */ jsxs("svg", {
|
|
2042
2097
|
xmlns: "http://www.w3.org/2000/svg",
|
|
2043
2098
|
height: "24px",
|
|
2044
2099
|
viewBox: "0 0 24 24",
|
|
2045
2100
|
width: "24px",
|
|
2046
2101
|
fill: "currentColor",
|
|
2047
|
-
children: [jsx("path", {
|
|
2102
|
+
children: [/* @__PURE__ */ jsx("path", {
|
|
2048
2103
|
d: "M0 0h24v24H0V0z",
|
|
2049
2104
|
fill: "none"
|
|
2050
|
-
}), jsx("path", {
|
|
2105
|
+
}), /* @__PURE__ */ jsx("path", {
|
|
2051
2106
|
d: "M4 12l1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8-8 8z"
|
|
2052
2107
|
})]
|
|
2053
2108
|
}));
|
|
@@ -2130,7 +2185,7 @@ function AutoFocusTextField(props) {
|
|
|
2130
2185
|
ref.current.focus();
|
|
2131
2186
|
}
|
|
2132
2187
|
}, [visible]);
|
|
2133
|
-
return jsx(TextField2, __spreadProps(__spreadValues({}, props), {
|
|
2188
|
+
return /* @__PURE__ */ jsx(TextField2, __spreadProps(__spreadValues({}, props), {
|
|
2134
2189
|
inputRef: ref
|
|
2135
2190
|
}));
|
|
2136
2191
|
}
|
|
@@ -2188,7 +2243,7 @@ function DateInput({
|
|
|
2188
2243
|
}), [locale]);
|
|
2189
2244
|
const parts = format.formatToParts(value != null ? value : defaultDate);
|
|
2190
2245
|
const isEmpty = !value;
|
|
2191
|
-
return jsx("div", {
|
|
2246
|
+
return /* @__PURE__ */ jsx("div", {
|
|
2192
2247
|
css: {
|
|
2193
2248
|
display: "flex",
|
|
2194
2249
|
alignItems: "baseline"
|
|
@@ -2196,8 +2251,8 @@ function DateInput({
|
|
|
2196
2251
|
children: parts.map(({
|
|
2197
2252
|
type,
|
|
2198
2253
|
value: value2
|
|
2199
|
-
}, index) => jsx(Fragment$1, {
|
|
2200
|
-
children: isIncludedType(type) ? jsx("input", {
|
|
2254
|
+
}, index) => /* @__PURE__ */ jsx(Fragment$1, {
|
|
2255
|
+
children: isIncludedType(type) ? /* @__PURE__ */ jsx("input", {
|
|
2201
2256
|
className,
|
|
2202
2257
|
css: {
|
|
2203
2258
|
width: `${length(type, value2)}ch`,
|
|
@@ -2224,7 +2279,7 @@ function DateInput({
|
|
|
2224
2279
|
},
|
|
2225
2280
|
onFocus: (e2) => e2.target.select(),
|
|
2226
2281
|
onBlur: commit
|
|
2227
|
-
}) : type === "literal" ? jsx("span", {
|
|
2282
|
+
}) : type === "literal" ? /* @__PURE__ */ jsx("span", {
|
|
2228
2283
|
children: value2
|
|
2229
2284
|
}) : null
|
|
2230
2285
|
}, index))
|
|
@@ -2362,8 +2417,8 @@ function DatePicker({
|
|
|
2362
2417
|
});
|
|
2363
2418
|
return (year) => format(new Date(year, 0, 1));
|
|
2364
2419
|
}, [locale]);
|
|
2365
|
-
return jsxs("div", {
|
|
2366
|
-
children: [jsxs("div", {
|
|
2420
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
2421
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
2367
2422
|
css: {
|
|
2368
2423
|
display: "grid",
|
|
2369
2424
|
gridAutoFlow: "column",
|
|
@@ -2371,12 +2426,12 @@ function DatePicker({
|
|
|
2371
2426
|
alignItems: "baseline",
|
|
2372
2427
|
gap: "var(--spacing)"
|
|
2373
2428
|
},
|
|
2374
|
-
children: [jsx(DateInput, {
|
|
2429
|
+
children: [/* @__PURE__ */ jsx(DateInput, {
|
|
2375
2430
|
value: min != null ? min : null,
|
|
2376
2431
|
onChange: (date) => set(date != null ? date : void 0, max, "min"),
|
|
2377
2432
|
locale
|
|
2378
|
-
}), rangeSelect && jsxs(Fragment, {
|
|
2379
|
-
children: [" - ", jsx(DateInput, {
|
|
2433
|
+
}), rangeSelect && /* @__PURE__ */ jsxs(Fragment, {
|
|
2434
|
+
children: [" - ", /* @__PURE__ */ jsx(DateInput, {
|
|
2380
2435
|
value: max != null ? max : null,
|
|
2381
2436
|
onChange: (date) => set(min, date != null ? date : void 0, "max"),
|
|
2382
2437
|
locale
|
|
@@ -2386,11 +2441,11 @@ function DatePicker({
|
|
|
2386
2441
|
month,
|
|
2387
2442
|
year,
|
|
2388
2443
|
weeks
|
|
2389
|
-
}) => jsxs("div", {
|
|
2444
|
+
}) => /* @__PURE__ */ jsxs("div", {
|
|
2390
2445
|
css: {
|
|
2391
2446
|
display: "grid"
|
|
2392
2447
|
},
|
|
2393
|
-
children: [jsxs("div", {
|
|
2448
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
2394
2449
|
css: {
|
|
2395
2450
|
margin: "calc(var(--spacing) * 4) 0",
|
|
2396
2451
|
display: "grid",
|
|
@@ -2398,32 +2453,32 @@ function DatePicker({
|
|
|
2398
2453
|
justifyContent: "space-between",
|
|
2399
2454
|
alignItems: "center"
|
|
2400
2455
|
},
|
|
2401
|
-
children: [jsx(IconButton2, __spreadProps(__spreadValues({}, getBackProps({
|
|
2456
|
+
children: [/* @__PURE__ */ jsx(IconButton2, __spreadProps(__spreadValues({}, getBackProps({
|
|
2402
2457
|
calendars
|
|
2403
2458
|
})), {
|
|
2404
|
-
children: jsx(ChevronRight2, {
|
|
2459
|
+
children: /* @__PURE__ */ jsx(ChevronRight2, {
|
|
2405
2460
|
css: {
|
|
2406
2461
|
transform: "rotate3d(0, 0, 1, 180deg)"
|
|
2407
2462
|
}
|
|
2408
2463
|
})
|
|
2409
|
-
})), jsxs("div", {
|
|
2464
|
+
})), /* @__PURE__ */ jsxs("div", {
|
|
2410
2465
|
css: {
|
|
2411
2466
|
display: "flex"
|
|
2412
2467
|
},
|
|
2413
2468
|
children: [formatMonth(month), " ", formatYear(year)]
|
|
2414
|
-
}), jsx(IconButton2, __spreadProps(__spreadValues({}, getForwardProps({
|
|
2469
|
+
}), /* @__PURE__ */ jsx(IconButton2, __spreadProps(__spreadValues({}, getForwardProps({
|
|
2415
2470
|
calendars
|
|
2416
2471
|
})), {
|
|
2417
|
-
children: jsx(ChevronRight2, {})
|
|
2472
|
+
children: /* @__PURE__ */ jsx(ChevronRight2, {})
|
|
2418
2473
|
}))]
|
|
2419
|
-
}), jsxs("div", {
|
|
2474
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
2420
2475
|
css: {
|
|
2421
2476
|
justifySelf: "center",
|
|
2422
2477
|
display: "grid",
|
|
2423
2478
|
gridTemplateColumns: "repeat(7, max-content)",
|
|
2424
2479
|
fontWeight: "bold"
|
|
2425
2480
|
},
|
|
2426
|
-
children: [weekDays.map((_v, weekDay) => jsx("div", {
|
|
2481
|
+
children: [weekDays.map((_v, weekDay) => /* @__PURE__ */ jsx("div", {
|
|
2427
2482
|
css: {
|
|
2428
2483
|
justifySelf: "center",
|
|
2429
2484
|
marginBottom: "var(--spacing)"
|
|
@@ -2431,7 +2486,7 @@ function DatePicker({
|
|
|
2431
2486
|
children: formatWeekday(weekDay)
|
|
2432
2487
|
}, weekDay)), weeks.map((week, index) => week.map((dateObj, dayIndex) => {
|
|
2433
2488
|
if (!dateObj) {
|
|
2434
|
-
return jsx("div", {});
|
|
2489
|
+
return /* @__PURE__ */ jsx("div", {});
|
|
2435
2490
|
}
|
|
2436
2491
|
const {
|
|
2437
2492
|
prevMonth,
|
|
@@ -2450,7 +2505,7 @@ function DatePicker({
|
|
|
2450
2505
|
min: hovered,
|
|
2451
2506
|
max: min
|
|
2452
2507
|
}));
|
|
2453
|
-
return jsx("button", __spreadProps(__spreadValues({
|
|
2508
|
+
return /* @__PURE__ */ jsx("button", __spreadProps(__spreadValues({
|
|
2454
2509
|
css: [{
|
|
2455
2510
|
padding: 10,
|
|
2456
2511
|
border: "1px solid transparent",
|
|
@@ -2486,28 +2541,28 @@ function DatePicker({
|
|
|
2486
2541
|
}), `${index}-${dayIndex}`);
|
|
2487
2542
|
}))]
|
|
2488
2543
|
})]
|
|
2489
|
-
}, `${month}${year}`)), jsxs("div", {
|
|
2544
|
+
}, `${month}${year}`)), /* @__PURE__ */ jsxs("div", {
|
|
2490
2545
|
css: {
|
|
2491
2546
|
marginTop: "var(--spacing)",
|
|
2492
2547
|
display: "grid",
|
|
2493
2548
|
gridAutoFlow: "column",
|
|
2494
2549
|
justifyContent: "center"
|
|
2495
2550
|
},
|
|
2496
|
-
children: [jsx(Button2, {
|
|
2551
|
+
children: [/* @__PURE__ */ jsx(Button2, {
|
|
2497
2552
|
variant: "text",
|
|
2498
2553
|
onClick: () => {
|
|
2499
2554
|
setDirty(void 0);
|
|
2500
2555
|
onChange(today());
|
|
2501
2556
|
},
|
|
2502
2557
|
children: textToday
|
|
2503
|
-
}), jsx(Button2, {
|
|
2558
|
+
}), /* @__PURE__ */ jsx(Button2, {
|
|
2504
2559
|
variant: "text",
|
|
2505
2560
|
onClick: () => {
|
|
2506
2561
|
setDirty(void 0);
|
|
2507
2562
|
onChange(thisWeek(firstDayOfWeek));
|
|
2508
2563
|
},
|
|
2509
2564
|
children: textThisWeek
|
|
2510
|
-
}), jsx(Button2, {
|
|
2565
|
+
}), /* @__PURE__ */ jsx(Button2, {
|
|
2511
2566
|
variant: "text",
|
|
2512
2567
|
onClick: () => {
|
|
2513
2568
|
setDirty(void 0);
|
|
@@ -2565,12 +2620,12 @@ function DateFilter(_k) {
|
|
|
2565
2620
|
return dateIntersect(filterValue, value2);
|
|
2566
2621
|
}
|
|
2567
2622
|
}));
|
|
2568
|
-
return jsx("div", {
|
|
2623
|
+
return /* @__PURE__ */ jsx("div", {
|
|
2569
2624
|
css: {
|
|
2570
2625
|
padding: "calc(var(--spacing) * 2)",
|
|
2571
2626
|
display: "grid"
|
|
2572
2627
|
},
|
|
2573
|
-
children: jsx(DatePicker, {
|
|
2628
|
+
children: /* @__PURE__ */ jsx(DatePicker, {
|
|
2574
2629
|
rangeSelect: !singleSelect,
|
|
2575
2630
|
value,
|
|
2576
2631
|
onChange,
|
|
@@ -2627,49 +2682,49 @@ function SelectFilter(_m) {
|
|
|
2627
2682
|
const column = state.activeColumns.find((column2) => column2.id === columnId);
|
|
2628
2683
|
if (!column)
|
|
2629
2684
|
return [];
|
|
2630
|
-
return uniq(flatMap(state.items, (item) => castArray(filterBy(column.value(item), item))));
|
|
2685
|
+
return uniq(flatMap(state.items, (item) => castArray(filterBy(column.value(item.value), item.value))));
|
|
2631
2686
|
});
|
|
2632
2687
|
const [query, setQuery] = useState("");
|
|
2633
2688
|
const filtered = options.filter((option) => !query || stringValue(option).toLowerCase().includes(query.toLowerCase()));
|
|
2634
|
-
return jsxs("div", {
|
|
2689
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
2635
2690
|
css: {
|
|
2636
2691
|
padding: "calc(var(--spacing) * 2)",
|
|
2637
2692
|
display: "grid",
|
|
2638
2693
|
gap: "var(--spacing)"
|
|
2639
2694
|
},
|
|
2640
|
-
children: [jsx(AutoFocusTextField, {
|
|
2695
|
+
children: [/* @__PURE__ */ jsx(AutoFocusTextField, {
|
|
2641
2696
|
value: query,
|
|
2642
2697
|
onChange: (e2) => setQuery(e2.target.value),
|
|
2643
|
-
endIcon: jsx(IconButton2, {
|
|
2698
|
+
endIcon: /* @__PURE__ */ jsx(IconButton2, {
|
|
2644
2699
|
onClick: () => setQuery(""),
|
|
2645
|
-
children: !query ? jsx(Search2, {}) : jsx(Clear2, {})
|
|
2700
|
+
children: !query ? /* @__PURE__ */ jsx(Search2, {}) : /* @__PURE__ */ jsx(Clear2, {})
|
|
2646
2701
|
}),
|
|
2647
2702
|
css: {
|
|
2648
2703
|
marginBottom: "var(--spacing)"
|
|
2649
2704
|
}
|
|
2650
|
-
}), jsxs("div", {
|
|
2705
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
2651
2706
|
css: {
|
|
2652
2707
|
maxHeight: "20em",
|
|
2653
2708
|
overflowY: "auto"
|
|
2654
2709
|
},
|
|
2655
|
-
children: [jsx(FormControlLabel, {
|
|
2710
|
+
children: [/* @__PURE__ */ jsx(FormControlLabel, {
|
|
2656
2711
|
disabled: value.size === 0,
|
|
2657
|
-
control: jsx(Checkbox2, {
|
|
2712
|
+
control: /* @__PURE__ */ jsx(Checkbox2, {
|
|
2658
2713
|
disabled: value.size === 0,
|
|
2659
2714
|
checked: value.size > 0,
|
|
2660
2715
|
onChange: () => onChange(/* @__PURE__ */ new Set())
|
|
2661
2716
|
}),
|
|
2662
|
-
label: jsxs(Fragment, {
|
|
2717
|
+
label: /* @__PURE__ */ jsxs(Fragment, {
|
|
2663
2718
|
children: ["<", selected(value.size), ">"]
|
|
2664
2719
|
})
|
|
2665
|
-
}), filtered.map((option, index) => jsx(FormControlLabel, {
|
|
2666
|
-
control: jsx(Checkbox2, {
|
|
2720
|
+
}), filtered.map((option, index) => /* @__PURE__ */ jsx(FormControlLabel, {
|
|
2721
|
+
control: /* @__PURE__ */ jsx(Checkbox2, {
|
|
2667
2722
|
checked: value.has(option),
|
|
2668
2723
|
onChange: () => onChange(toggle(value, option, singleSelect))
|
|
2669
2724
|
}),
|
|
2670
2725
|
label: render(option)
|
|
2671
2726
|
}, index))]
|
|
2672
|
-
}), filtered.length === 0 && jsx("span", {
|
|
2727
|
+
}), filtered.length === 0 && /* @__PURE__ */ jsx("span", {
|
|
2673
2728
|
css: {
|
|
2674
2729
|
textAlign: "center"
|
|
2675
2730
|
},
|
|
@@ -2797,17 +2852,17 @@ function TextFilter(_o) {
|
|
|
2797
2852
|
return compare(value2, filterValue);
|
|
2798
2853
|
}
|
|
2799
2854
|
}));
|
|
2800
|
-
return jsx("div", {
|
|
2855
|
+
return /* @__PURE__ */ jsx("div", {
|
|
2801
2856
|
css: {
|
|
2802
2857
|
padding: `calc(var(--spacing) * 2)`,
|
|
2803
2858
|
display: "grid"
|
|
2804
2859
|
},
|
|
2805
|
-
children: jsx(AutoFocusTextField, {
|
|
2860
|
+
children: /* @__PURE__ */ jsx(AutoFocusTextField, {
|
|
2806
2861
|
value,
|
|
2807
2862
|
onChange: (e2) => onChange(e2.target.value),
|
|
2808
|
-
endIcon: jsx(IconButton2, {
|
|
2863
|
+
endIcon: /* @__PURE__ */ jsx(IconButton2, {
|
|
2809
2864
|
onClick: () => onChange(""),
|
|
2810
|
-
children: !value ? jsx(Search2, {}) : jsx(Clear2, {})
|
|
2865
|
+
children: !value ? /* @__PURE__ */ jsx(Search2, {}) : /* @__PURE__ */ jsx(Clear2, {})
|
|
2811
2866
|
})
|
|
2812
2867
|
})
|
|
2813
2868
|
});
|