asma-ui-table 1.2.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/asma-ui-table.es.js +276 -266
- package/dist/src/custom-features/row-selection-tooltip/RowSelectionTooltipFeature.d.ts +2 -0
- package/dist/src/custom-features/row-selection-tooltip/index.d.ts +1 -0
- package/dist/src/custom-features/row-selection-tooltip/types.d.ts +8 -0
- package/dist/src/types.d.ts +5 -3
- package/package.json +1 -1
package/dist/asma-ui-table.es.js
CHANGED
|
@@ -9,7 +9,7 @@ import React__default, { useMemo, useLayoutEffect, useEffect, useRef, useCallbac
|
|
|
9
9
|
import * as ReactDOM from "react-dom";
|
|
10
10
|
import ReactDOM__default, { unstable_batchedUpdates, createPortal, flushSync } from "react-dom";
|
|
11
11
|
import { twMerge } from "tailwind-merge";
|
|
12
|
-
import {
|
|
12
|
+
import { Tooltip, MenuItem, Popover, Skeleton } from "@mui/material";
|
|
13
13
|
import PropTypes from "prop-types";
|
|
14
14
|
import { ThemeContext } from "@emotion/react";
|
|
15
15
|
const isCustomAction = (action) => {
|
|
@@ -8010,6 +8010,14 @@ const usePersistedPageSize = (uniqueKey) => {
|
|
|
8010
8010
|
}, [uniqueKey]);
|
|
8011
8011
|
return persistedPageSize;
|
|
8012
8012
|
};
|
|
8013
|
+
const RowSelectionTooltipFeature = {
|
|
8014
|
+
createRow: (row, table) => {
|
|
8015
|
+
row.getRowSelectionTooltip = () => {
|
|
8016
|
+
var _a, _b;
|
|
8017
|
+
return (_b = (_a = table.options).getRowSelectionTooltip) == null ? void 0 : _b.call(_a, row);
|
|
8018
|
+
};
|
|
8019
|
+
}
|
|
8020
|
+
};
|
|
8013
8021
|
const useStyledTable = (props) => {
|
|
8014
8022
|
var _a;
|
|
8015
8023
|
const {
|
|
@@ -8028,7 +8036,7 @@ const useStyledTable = (props) => {
|
|
|
8028
8036
|
const persistedPageSize = usePersistedPageSize(uniqueKey);
|
|
8029
8037
|
const resolvedPageSize = persistedPageSize ?? pageSize ?? 50;
|
|
8030
8038
|
const table = useReactTable({
|
|
8031
|
-
_features: [ExpandedRowsFeature, FocusedRowsFeature, OrderColumnsFeature],
|
|
8039
|
+
_features: [ExpandedRowsFeature, FocusedRowsFeature, OrderColumnsFeature, RowSelectionTooltipFeature],
|
|
8032
8040
|
columns,
|
|
8033
8041
|
data,
|
|
8034
8042
|
meta: { locale: locale ?? "en" },
|
|
@@ -9726,229 +9734,6 @@ const StyledCheckbox = ({
|
|
|
9726
9734
|
}
|
|
9727
9735
|
);
|
|
9728
9736
|
};
|
|
9729
|
-
function selectColumn(isFixed2, rowHeight) {
|
|
9730
|
-
return {
|
|
9731
|
-
id: SELECT_COLUMN_ID,
|
|
9732
|
-
minSize: 38,
|
|
9733
|
-
maxSize: 38,
|
|
9734
|
-
size: 38,
|
|
9735
|
-
header: ({ table }) => {
|
|
9736
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
9737
|
-
"button",
|
|
9738
|
-
{
|
|
9739
|
-
type: "button",
|
|
9740
|
-
className: "pl-2 flex size-full items-center justify-start",
|
|
9741
|
-
onClick: () => table.toggleAllRowsSelected(),
|
|
9742
|
-
children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
9743
|
-
StyledCheckbox,
|
|
9744
|
-
{
|
|
9745
|
-
size: "small",
|
|
9746
|
-
dataTest: "cell-select-all",
|
|
9747
|
-
checked: table.getIsAllRowsSelected(),
|
|
9748
|
-
indeterminate: table.getIsSomeRowsSelected(),
|
|
9749
|
-
hideWrapper: true
|
|
9750
|
-
}
|
|
9751
|
-
)
|
|
9752
|
-
}
|
|
9753
|
-
);
|
|
9754
|
-
},
|
|
9755
|
-
cell: ({ cell }) => {
|
|
9756
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
9757
|
-
"button",
|
|
9758
|
-
{
|
|
9759
|
-
type: "button",
|
|
9760
|
-
style: { height: rowHeight ? rowHeight : "auto" },
|
|
9761
|
-
className: "pl-2 flex w-full items-center justify-start m-0 p-0",
|
|
9762
|
-
onClick: () => cell.row.toggleSelected(),
|
|
9763
|
-
children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
9764
|
-
StyledCheckbox,
|
|
9765
|
-
{
|
|
9766
|
-
size: "small",
|
|
9767
|
-
dataTest: "cell-select",
|
|
9768
|
-
checked: cell.row.getIsSelected(),
|
|
9769
|
-
hideWrapper: true,
|
|
9770
|
-
disabled: !cell.row.getCanSelect(),
|
|
9771
|
-
onMouseUp: (e) => {
|
|
9772
|
-
e.preventDefault();
|
|
9773
|
-
e.stopPropagation();
|
|
9774
|
-
}
|
|
9775
|
-
}
|
|
9776
|
-
)
|
|
9777
|
-
}
|
|
9778
|
-
);
|
|
9779
|
-
},
|
|
9780
|
-
fixedLeft: isFixed2
|
|
9781
|
-
};
|
|
9782
|
-
}
|
|
9783
|
-
function ChevronDownIcon(props) {
|
|
9784
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "1rem", height: "1rem", viewBox: "0 0 24 24", ...props, children: /* @__PURE__ */ jsxRuntimeExports.jsx("path", { fill: "currentColor", d: "M7.41 8.58L12 13.17l4.59-4.59L18 10l-6 6l-6-6z" }) });
|
|
9785
|
-
}
|
|
9786
|
-
function generateExpandColumn(isFixed2, rowHeight) {
|
|
9787
|
-
return {
|
|
9788
|
-
id: EXPAND_COLUMN_ID,
|
|
9789
|
-
minSize: 50,
|
|
9790
|
-
maxSize: 50,
|
|
9791
|
-
size: 50,
|
|
9792
|
-
enableHiding: false,
|
|
9793
|
-
enableSorting: false,
|
|
9794
|
-
header: () => null,
|
|
9795
|
-
cell: ({ cell }) => {
|
|
9796
|
-
const isExpanded = cell.row.getIsExpanded();
|
|
9797
|
-
const canExpand = cell.row.getCanExpand();
|
|
9798
|
-
return canExpand ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
9799
|
-
"span",
|
|
9800
|
-
{
|
|
9801
|
-
className: "flex w-full outline-none focus:outline-none items-center justify-center",
|
|
9802
|
-
onClick: () => cell.row.getToggleExpandedHandler()(),
|
|
9803
|
-
style: { height: rowHeight ? rowHeight : "auto" },
|
|
9804
|
-
children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
9805
|
-
ChevronDownIcon,
|
|
9806
|
-
{
|
|
9807
|
-
width: 24,
|
|
9808
|
-
height: 24,
|
|
9809
|
-
style: {
|
|
9810
|
-
rotate: isExpanded ? "180deg" : "0deg",
|
|
9811
|
-
transitionTimingFunction: "cubic-bezier(0.4, 0, 0.2, 1)",
|
|
9812
|
-
transitionDuration: "500ms"
|
|
9813
|
-
}
|
|
9814
|
-
}
|
|
9815
|
-
)
|
|
9816
|
-
}
|
|
9817
|
-
) : null;
|
|
9818
|
-
},
|
|
9819
|
-
fixedLeft: isFixed2
|
|
9820
|
-
};
|
|
9821
|
-
}
|
|
9822
|
-
const useToggleMenuVisibility = () => {
|
|
9823
|
-
const [anchorEl, setAnchorEl] = useState(null);
|
|
9824
|
-
const [open, setOpen] = useState(false);
|
|
9825
|
-
const handleOpen = useCallback((event) => {
|
|
9826
|
-
setAnchorEl(event.currentTarget);
|
|
9827
|
-
setOpen(true);
|
|
9828
|
-
}, []);
|
|
9829
|
-
const handleClose = useCallback(() => {
|
|
9830
|
-
setOpen(false);
|
|
9831
|
-
}, []);
|
|
9832
|
-
return { open, handleClose, handleOpen, anchorEl };
|
|
9833
|
-
};
|
|
9834
|
-
function DotsVerticalIcon(props) {
|
|
9835
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "1rem", height: "1rem", viewBox: "0 0 24 24", ...props, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
9836
|
-
"path",
|
|
9837
|
-
{
|
|
9838
|
-
fill: "currentColor",
|
|
9839
|
-
d: "M12 16a2 2 0 0 1 2 2a2 2 0 0 1-2 2a2 2 0 0 1-2-2a2 2 0 0 1 2-2m0-6a2 2 0 0 1 2 2a2 2 0 0 1-2 2a2 2 0 0 1-2-2a2 2 0 0 1 2-2m0-6a2 2 0 0 1 2 2a2 2 0 0 1-2 2a2 2 0 0 1-2-2a2 2 0 0 1 2-2"
|
|
9840
|
-
}
|
|
9841
|
-
) });
|
|
9842
|
-
}
|
|
9843
|
-
const StyledMenuItem$1 = (props) => {
|
|
9844
|
-
var _a;
|
|
9845
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
9846
|
-
MenuItem,
|
|
9847
|
-
{
|
|
9848
|
-
...props,
|
|
9849
|
-
classes: {
|
|
9850
|
-
root: clsx("px-3 py-2.5", (_a = props.classes) == null ? void 0 : _a.root),
|
|
9851
|
-
...props.classes
|
|
9852
|
-
},
|
|
9853
|
-
sx: {
|
|
9854
|
-
"&.Mui-disabled": {
|
|
9855
|
-
pointerEvents: "auto",
|
|
9856
|
-
cursor: "not-allowed",
|
|
9857
|
-
"&:hover": {
|
|
9858
|
-
backgroundColor: "transparent !important"
|
|
9859
|
-
}
|
|
9860
|
-
},
|
|
9861
|
-
...props.sx
|
|
9862
|
-
}
|
|
9863
|
-
}
|
|
9864
|
-
);
|
|
9865
|
-
};
|
|
9866
|
-
const contained = "_contained_gteum_27";
|
|
9867
|
-
const common$2 = "_common_gteum_27";
|
|
9868
|
-
const medium = "_medium_gteum_69";
|
|
9869
|
-
const small = "_small_gteum_74";
|
|
9870
|
-
const large = "_large_gteum_79";
|
|
9871
|
-
const error = "_error_gteum_84";
|
|
9872
|
-
const outlined = "_outlined_gteum_141";
|
|
9873
|
-
const text = "_text_gteum_255";
|
|
9874
|
-
const textGray = "_textGray_gteum_369";
|
|
9875
|
-
const textWhite = "_textWhite_gteum_426";
|
|
9876
|
-
const style$3 = {
|
|
9877
|
-
"asma-core-ui-button": "_asma-core-ui-button_gteum_1",
|
|
9878
|
-
contained,
|
|
9879
|
-
common: common$2,
|
|
9880
|
-
medium,
|
|
9881
|
-
small,
|
|
9882
|
-
large,
|
|
9883
|
-
error,
|
|
9884
|
-
outlined,
|
|
9885
|
-
text,
|
|
9886
|
-
textGray,
|
|
9887
|
-
textWhite
|
|
9888
|
-
};
|
|
9889
|
-
const BtnStyles = {
|
|
9890
|
-
contained: style$3["contained"],
|
|
9891
|
-
outlined: style$3["outlined"],
|
|
9892
|
-
text: style$3["text"],
|
|
9893
|
-
textGray: style$3["textGray"],
|
|
9894
|
-
textWhite: style$3["textWhite"],
|
|
9895
|
-
large: style$3["large"],
|
|
9896
|
-
small: style$3["small"],
|
|
9897
|
-
medium: style$3["medium"],
|
|
9898
|
-
error: style$3["error"],
|
|
9899
|
-
common: style$3["common"]
|
|
9900
|
-
};
|
|
9901
|
-
const StyledButton = ({
|
|
9902
|
-
variant = "contained",
|
|
9903
|
-
className = "",
|
|
9904
|
-
size = "medium",
|
|
9905
|
-
children,
|
|
9906
|
-
refLink,
|
|
9907
|
-
startIcon,
|
|
9908
|
-
endIcon,
|
|
9909
|
-
dataTest,
|
|
9910
|
-
error: error2,
|
|
9911
|
-
...otherProps
|
|
9912
|
-
}) => {
|
|
9913
|
-
const isLarge = size === "large" || size === "medium";
|
|
9914
|
-
const color2 = error2 ? "error" : "common";
|
|
9915
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
9916
|
-
"button",
|
|
9917
|
-
{
|
|
9918
|
-
...otherProps,
|
|
9919
|
-
className: clsx(
|
|
9920
|
-
style$3["asma-core-ui-button"],
|
|
9921
|
-
BtnStyles[variant],
|
|
9922
|
-
BtnStyles[color2],
|
|
9923
|
-
BtnStyles[size],
|
|
9924
|
-
className
|
|
9925
|
-
),
|
|
9926
|
-
ref: refLink,
|
|
9927
|
-
"data-test": dataTest,
|
|
9928
|
-
children: [
|
|
9929
|
-
startIcon,
|
|
9930
|
-
children && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
9931
|
-
"div",
|
|
9932
|
-
{
|
|
9933
|
-
style: {
|
|
9934
|
-
overflow: "hidden",
|
|
9935
|
-
textOverflow: "ellipsis",
|
|
9936
|
-
whiteSpace: "nowrap",
|
|
9937
|
-
display: "flex",
|
|
9938
|
-
alignItems: "center",
|
|
9939
|
-
justifyContent: "center",
|
|
9940
|
-
gap: isLarge ? "8px" : "4px",
|
|
9941
|
-
paddingLeft: isLarge ? "8px" : "4px",
|
|
9942
|
-
paddingRight: isLarge ? "8px" : "4px"
|
|
9943
|
-
},
|
|
9944
|
-
children
|
|
9945
|
-
}
|
|
9946
|
-
),
|
|
9947
|
-
endIcon
|
|
9948
|
-
]
|
|
9949
|
-
}
|
|
9950
|
-
);
|
|
9951
|
-
};
|
|
9952
9737
|
function _extends() {
|
|
9953
9738
|
_extends = Object.assign ? Object.assign.bind() : function(target) {
|
|
9954
9739
|
for (var i = 1; i < arguments.length; i++) {
|
|
@@ -10755,7 +10540,7 @@ function getStyleValue(themeMapping, transform, propValueFinal, userValue = prop
|
|
|
10755
10540
|
}
|
|
10756
10541
|
return value;
|
|
10757
10542
|
}
|
|
10758
|
-
function style$
|
|
10543
|
+
function style$3(options) {
|
|
10759
10544
|
const {
|
|
10760
10545
|
prop,
|
|
10761
10546
|
cssProperty = options.prop,
|
|
@@ -10903,12 +10688,12 @@ function resolveCssProperty(props, keys, prop, transformer) {
|
|
|
10903
10688
|
const propValue = props[prop];
|
|
10904
10689
|
return handleBreakpoints(props, propValue, styleFromPropValue);
|
|
10905
10690
|
}
|
|
10906
|
-
function style$
|
|
10691
|
+
function style$2(props, keys) {
|
|
10907
10692
|
const transformer = createUnarySpacing(props.theme);
|
|
10908
10693
|
return Object.keys(props).map((prop) => resolveCssProperty(props, keys, prop, transformer)).reduce(merge, {});
|
|
10909
10694
|
}
|
|
10910
10695
|
function margin(props) {
|
|
10911
|
-
return style$
|
|
10696
|
+
return style$2(props, marginKeys);
|
|
10912
10697
|
}
|
|
10913
10698
|
margin.propTypes = process.env.NODE_ENV !== "production" ? marginKeys.reduce((obj, key) => {
|
|
10914
10699
|
obj[key] = responsivePropType$1;
|
|
@@ -10916,7 +10701,7 @@ margin.propTypes = process.env.NODE_ENV !== "production" ? marginKeys.reduce((ob
|
|
|
10916
10701
|
}, {}) : {};
|
|
10917
10702
|
margin.filterProps = marginKeys;
|
|
10918
10703
|
function padding(props) {
|
|
10919
|
-
return style$
|
|
10704
|
+
return style$2(props, paddingKeys);
|
|
10920
10705
|
}
|
|
10921
10706
|
padding.propTypes = process.env.NODE_ENV !== "production" ? paddingKeys.reduce((obj, key) => {
|
|
10922
10707
|
obj[key] = responsivePropType$1;
|
|
@@ -10974,48 +10759,48 @@ function borderTransform(value) {
|
|
|
10974
10759
|
}
|
|
10975
10760
|
return `${value}px solid`;
|
|
10976
10761
|
}
|
|
10977
|
-
const border = style$
|
|
10762
|
+
const border = style$3({
|
|
10978
10763
|
prop: "border",
|
|
10979
10764
|
themeKey: "borders",
|
|
10980
10765
|
transform: borderTransform
|
|
10981
10766
|
});
|
|
10982
|
-
const borderTop = style$
|
|
10767
|
+
const borderTop = style$3({
|
|
10983
10768
|
prop: "borderTop",
|
|
10984
10769
|
themeKey: "borders",
|
|
10985
10770
|
transform: borderTransform
|
|
10986
10771
|
});
|
|
10987
|
-
const borderRight = style$
|
|
10772
|
+
const borderRight = style$3({
|
|
10988
10773
|
prop: "borderRight",
|
|
10989
10774
|
themeKey: "borders",
|
|
10990
10775
|
transform: borderTransform
|
|
10991
10776
|
});
|
|
10992
|
-
const borderBottom = style$
|
|
10777
|
+
const borderBottom = style$3({
|
|
10993
10778
|
prop: "borderBottom",
|
|
10994
10779
|
themeKey: "borders",
|
|
10995
10780
|
transform: borderTransform
|
|
10996
10781
|
});
|
|
10997
|
-
const borderLeft = style$
|
|
10782
|
+
const borderLeft = style$3({
|
|
10998
10783
|
prop: "borderLeft",
|
|
10999
10784
|
themeKey: "borders",
|
|
11000
10785
|
transform: borderTransform
|
|
11001
10786
|
});
|
|
11002
|
-
const borderColor = style$
|
|
10787
|
+
const borderColor = style$3({
|
|
11003
10788
|
prop: "borderColor",
|
|
11004
10789
|
themeKey: "palette"
|
|
11005
10790
|
});
|
|
11006
|
-
const borderTopColor = style$
|
|
10791
|
+
const borderTopColor = style$3({
|
|
11007
10792
|
prop: "borderTopColor",
|
|
11008
10793
|
themeKey: "palette"
|
|
11009
10794
|
});
|
|
11010
|
-
const borderRightColor = style$
|
|
10795
|
+
const borderRightColor = style$3({
|
|
11011
10796
|
prop: "borderRightColor",
|
|
11012
10797
|
themeKey: "palette"
|
|
11013
10798
|
});
|
|
11014
|
-
const borderBottomColor = style$
|
|
10799
|
+
const borderBottomColor = style$3({
|
|
11015
10800
|
prop: "borderBottomColor",
|
|
11016
10801
|
themeKey: "palette"
|
|
11017
10802
|
});
|
|
11018
|
-
const borderLeftColor = style$
|
|
10803
|
+
const borderLeftColor = style$3({
|
|
11019
10804
|
prop: "borderLeftColor",
|
|
11020
10805
|
themeKey: "palette"
|
|
11021
10806
|
});
|
|
@@ -11076,31 +10861,31 @@ rowGap.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
11076
10861
|
rowGap: responsivePropType$1
|
|
11077
10862
|
} : {};
|
|
11078
10863
|
rowGap.filterProps = ["rowGap"];
|
|
11079
|
-
const gridColumn = style$
|
|
10864
|
+
const gridColumn = style$3({
|
|
11080
10865
|
prop: "gridColumn"
|
|
11081
10866
|
});
|
|
11082
|
-
const gridRow = style$
|
|
10867
|
+
const gridRow = style$3({
|
|
11083
10868
|
prop: "gridRow"
|
|
11084
10869
|
});
|
|
11085
|
-
const gridAutoFlow = style$
|
|
10870
|
+
const gridAutoFlow = style$3({
|
|
11086
10871
|
prop: "gridAutoFlow"
|
|
11087
10872
|
});
|
|
11088
|
-
const gridAutoColumns = style$
|
|
10873
|
+
const gridAutoColumns = style$3({
|
|
11089
10874
|
prop: "gridAutoColumns"
|
|
11090
10875
|
});
|
|
11091
|
-
const gridAutoRows = style$
|
|
10876
|
+
const gridAutoRows = style$3({
|
|
11092
10877
|
prop: "gridAutoRows"
|
|
11093
10878
|
});
|
|
11094
|
-
const gridTemplateColumns = style$
|
|
10879
|
+
const gridTemplateColumns = style$3({
|
|
11095
10880
|
prop: "gridTemplateColumns"
|
|
11096
10881
|
});
|
|
11097
|
-
const gridTemplateRows = style$
|
|
10882
|
+
const gridTemplateRows = style$3({
|
|
11098
10883
|
prop: "gridTemplateRows"
|
|
11099
10884
|
});
|
|
11100
|
-
const gridTemplateAreas = style$
|
|
10885
|
+
const gridTemplateAreas = style$3({
|
|
11101
10886
|
prop: "gridTemplateAreas"
|
|
11102
10887
|
});
|
|
11103
|
-
const gridArea = style$
|
|
10888
|
+
const gridArea = style$3({
|
|
11104
10889
|
prop: "gridArea"
|
|
11105
10890
|
});
|
|
11106
10891
|
compose(gap, columnGap, rowGap, gridColumn, gridRow, gridAutoFlow, gridAutoColumns, gridAutoRows, gridTemplateColumns, gridTemplateRows, gridTemplateAreas, gridArea);
|
|
@@ -11110,18 +10895,18 @@ function paletteTransform(value, userValue) {
|
|
|
11110
10895
|
}
|
|
11111
10896
|
return value;
|
|
11112
10897
|
}
|
|
11113
|
-
const color = style$
|
|
10898
|
+
const color = style$3({
|
|
11114
10899
|
prop: "color",
|
|
11115
10900
|
themeKey: "palette",
|
|
11116
10901
|
transform: paletteTransform
|
|
11117
10902
|
});
|
|
11118
|
-
const bgcolor = style$
|
|
10903
|
+
const bgcolor = style$3({
|
|
11119
10904
|
prop: "bgcolor",
|
|
11120
10905
|
cssProperty: "backgroundColor",
|
|
11121
10906
|
themeKey: "palette",
|
|
11122
10907
|
transform: paletteTransform
|
|
11123
10908
|
});
|
|
11124
|
-
const backgroundColor = style$
|
|
10909
|
+
const backgroundColor = style$3({
|
|
11125
10910
|
prop: "backgroundColor",
|
|
11126
10911
|
themeKey: "palette",
|
|
11127
10912
|
transform: paletteTransform
|
|
@@ -11130,7 +10915,7 @@ compose(color, bgcolor, backgroundColor);
|
|
|
11130
10915
|
function sizingTransform(value) {
|
|
11131
10916
|
return value <= 1 && value !== 0 ? `${value * 100}%` : value;
|
|
11132
10917
|
}
|
|
11133
|
-
const width = style$
|
|
10918
|
+
const width = style$3({
|
|
11134
10919
|
prop: "width",
|
|
11135
10920
|
transform: sizingTransform
|
|
11136
10921
|
});
|
|
@@ -11148,33 +10933,33 @@ const maxWidth = (props) => {
|
|
|
11148
10933
|
return null;
|
|
11149
10934
|
};
|
|
11150
10935
|
maxWidth.filterProps = ["maxWidth"];
|
|
11151
|
-
const minWidth = style$
|
|
10936
|
+
const minWidth = style$3({
|
|
11152
10937
|
prop: "minWidth",
|
|
11153
10938
|
transform: sizingTransform
|
|
11154
10939
|
});
|
|
11155
|
-
const height = style$
|
|
10940
|
+
const height = style$3({
|
|
11156
10941
|
prop: "height",
|
|
11157
10942
|
transform: sizingTransform
|
|
11158
10943
|
});
|
|
11159
|
-
const maxHeight = style$
|
|
10944
|
+
const maxHeight = style$3({
|
|
11160
10945
|
prop: "maxHeight",
|
|
11161
10946
|
transform: sizingTransform
|
|
11162
10947
|
});
|
|
11163
|
-
const minHeight = style$
|
|
10948
|
+
const minHeight = style$3({
|
|
11164
10949
|
prop: "minHeight",
|
|
11165
10950
|
transform: sizingTransform
|
|
11166
10951
|
});
|
|
11167
|
-
style$
|
|
10952
|
+
style$3({
|
|
11168
10953
|
prop: "size",
|
|
11169
10954
|
cssProperty: "width",
|
|
11170
10955
|
transform: sizingTransform
|
|
11171
10956
|
});
|
|
11172
|
-
style$
|
|
10957
|
+
style$3({
|
|
11173
10958
|
prop: "size",
|
|
11174
10959
|
cssProperty: "height",
|
|
11175
10960
|
transform: sizingTransform
|
|
11176
10961
|
});
|
|
11177
|
-
const boxSizing = style$
|
|
10962
|
+
const boxSizing = style$3({
|
|
11178
10963
|
prop: "boxSizing"
|
|
11179
10964
|
});
|
|
11180
10965
|
compose(width, maxWidth, minWidth, height, maxHeight, minHeight, boxSizing);
|
|
@@ -11764,11 +11549,11 @@ function createMixins(breakpoints, mixins) {
|
|
|
11764
11549
|
}
|
|
11765
11550
|
}, mixins);
|
|
11766
11551
|
}
|
|
11767
|
-
const common = {
|
|
11552
|
+
const common$1 = {
|
|
11768
11553
|
black: "#000",
|
|
11769
11554
|
white: "#fff"
|
|
11770
11555
|
};
|
|
11771
|
-
const common$
|
|
11556
|
+
const common$2 = common$1;
|
|
11772
11557
|
const grey = {
|
|
11773
11558
|
50: "#fafafa",
|
|
11774
11559
|
100: "#f5f5f5",
|
|
@@ -11904,8 +11689,8 @@ const light = {
|
|
|
11904
11689
|
// The background colors used to style the surfaces.
|
|
11905
11690
|
// Consistency between these values is important.
|
|
11906
11691
|
background: {
|
|
11907
|
-
paper: common$
|
|
11908
|
-
default: common$
|
|
11692
|
+
paper: common$2.white,
|
|
11693
|
+
default: common$2.white
|
|
11909
11694
|
},
|
|
11910
11695
|
// The colors used to style the action elements.
|
|
11911
11696
|
action: {
|
|
@@ -11929,7 +11714,7 @@ const light = {
|
|
|
11929
11714
|
};
|
|
11930
11715
|
const dark = {
|
|
11931
11716
|
text: {
|
|
11932
|
-
primary: common$
|
|
11717
|
+
primary: common$2.white,
|
|
11933
11718
|
secondary: "rgba(255, 255, 255, 0.7)",
|
|
11934
11719
|
disabled: "rgba(255, 255, 255, 0.5)",
|
|
11935
11720
|
icon: "rgba(255, 255, 255, 0.5)"
|
|
@@ -11940,7 +11725,7 @@ const dark = {
|
|
|
11940
11725
|
default: "#121212"
|
|
11941
11726
|
},
|
|
11942
11727
|
action: {
|
|
11943
|
-
active: common$
|
|
11728
|
+
active: common$2.white,
|
|
11944
11729
|
hover: "rgba(255, 255, 255, 0.08)",
|
|
11945
11730
|
hoverOpacity: 0.08,
|
|
11946
11731
|
selected: "rgba(255, 255, 255, 0.16)",
|
|
@@ -12122,7 +11907,7 @@ const theme2 = createTheme({ palette: {
|
|
|
12122
11907
|
}
|
|
12123
11908
|
const paletteOutput = deepmerge(_extends({
|
|
12124
11909
|
// A collection of common colors.
|
|
12125
|
-
common: _extends({}, common$
|
|
11910
|
+
common: _extends({}, common$2),
|
|
12126
11911
|
// prevent mutable object.
|
|
12127
11912
|
// The palette mode, can be light or dark.
|
|
12128
11913
|
mode,
|
|
@@ -12643,6 +12428,231 @@ const StyledTooltip = (props) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
|
12643
12428
|
...props
|
|
12644
12429
|
}
|
|
12645
12430
|
);
|
|
12431
|
+
function selectColumn(isFixed2, rowHeight) {
|
|
12432
|
+
return {
|
|
12433
|
+
id: SELECT_COLUMN_ID,
|
|
12434
|
+
minSize: 38,
|
|
12435
|
+
maxSize: 38,
|
|
12436
|
+
size: 38,
|
|
12437
|
+
header: ({ table }) => {
|
|
12438
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
12439
|
+
"button",
|
|
12440
|
+
{
|
|
12441
|
+
type: "button",
|
|
12442
|
+
className: "pl-2 flex size-full items-center justify-start",
|
|
12443
|
+
onClick: () => table.toggleAllRowsSelected(),
|
|
12444
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
12445
|
+
StyledCheckbox,
|
|
12446
|
+
{
|
|
12447
|
+
size: "small",
|
|
12448
|
+
dataTest: "cell-select-all",
|
|
12449
|
+
checked: table.getIsAllRowsSelected(),
|
|
12450
|
+
indeterminate: table.getIsSomeRowsSelected(),
|
|
12451
|
+
hideWrapper: true
|
|
12452
|
+
}
|
|
12453
|
+
)
|
|
12454
|
+
}
|
|
12455
|
+
);
|
|
12456
|
+
},
|
|
12457
|
+
cell: ({ cell }) => {
|
|
12458
|
+
const disabled = !cell.row.getCanSelect();
|
|
12459
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
12460
|
+
"button",
|
|
12461
|
+
{
|
|
12462
|
+
type: "button",
|
|
12463
|
+
style: { height: rowHeight ? rowHeight : "auto" },
|
|
12464
|
+
className: "pl-2 flex w-full items-center justify-start m-0 p-0",
|
|
12465
|
+
disabled,
|
|
12466
|
+
onClick: () => cell.row.toggleSelected(),
|
|
12467
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(StyledTooltip, { arrow: true, title: cell.row.getRowSelectionTooltip(), children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: disabled ? "cursor-not-allowed" : "", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
12468
|
+
StyledCheckbox,
|
|
12469
|
+
{
|
|
12470
|
+
size: "small",
|
|
12471
|
+
dataTest: "cell-select",
|
|
12472
|
+
checked: cell.row.getIsSelected(),
|
|
12473
|
+
hideWrapper: true,
|
|
12474
|
+
disabled,
|
|
12475
|
+
onMouseUp: (e) => {
|
|
12476
|
+
e.preventDefault();
|
|
12477
|
+
e.stopPropagation();
|
|
12478
|
+
}
|
|
12479
|
+
}
|
|
12480
|
+
) }) })
|
|
12481
|
+
}
|
|
12482
|
+
);
|
|
12483
|
+
},
|
|
12484
|
+
fixedLeft: isFixed2
|
|
12485
|
+
};
|
|
12486
|
+
}
|
|
12487
|
+
function ChevronDownIcon(props) {
|
|
12488
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "1rem", height: "1rem", viewBox: "0 0 24 24", ...props, children: /* @__PURE__ */ jsxRuntimeExports.jsx("path", { fill: "currentColor", d: "M7.41 8.58L12 13.17l4.59-4.59L18 10l-6 6l-6-6z" }) });
|
|
12489
|
+
}
|
|
12490
|
+
function generateExpandColumn(isFixed2, rowHeight) {
|
|
12491
|
+
return {
|
|
12492
|
+
id: EXPAND_COLUMN_ID,
|
|
12493
|
+
minSize: 50,
|
|
12494
|
+
maxSize: 50,
|
|
12495
|
+
size: 50,
|
|
12496
|
+
enableHiding: false,
|
|
12497
|
+
enableSorting: false,
|
|
12498
|
+
header: () => null,
|
|
12499
|
+
cell: ({ cell }) => {
|
|
12500
|
+
const isExpanded = cell.row.getIsExpanded();
|
|
12501
|
+
const canExpand = cell.row.getCanExpand();
|
|
12502
|
+
return canExpand ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
12503
|
+
"span",
|
|
12504
|
+
{
|
|
12505
|
+
className: "flex w-full outline-none focus:outline-none items-center justify-center",
|
|
12506
|
+
onClick: () => cell.row.getToggleExpandedHandler()(),
|
|
12507
|
+
style: { height: rowHeight ? rowHeight : "auto" },
|
|
12508
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
12509
|
+
ChevronDownIcon,
|
|
12510
|
+
{
|
|
12511
|
+
width: 24,
|
|
12512
|
+
height: 24,
|
|
12513
|
+
style: {
|
|
12514
|
+
rotate: isExpanded ? "180deg" : "0deg",
|
|
12515
|
+
transitionTimingFunction: "cubic-bezier(0.4, 0, 0.2, 1)",
|
|
12516
|
+
transitionDuration: "500ms"
|
|
12517
|
+
}
|
|
12518
|
+
}
|
|
12519
|
+
)
|
|
12520
|
+
}
|
|
12521
|
+
) : null;
|
|
12522
|
+
},
|
|
12523
|
+
fixedLeft: isFixed2
|
|
12524
|
+
};
|
|
12525
|
+
}
|
|
12526
|
+
const useToggleMenuVisibility = () => {
|
|
12527
|
+
const [anchorEl, setAnchorEl] = useState(null);
|
|
12528
|
+
const [open, setOpen] = useState(false);
|
|
12529
|
+
const handleOpen = useCallback((event) => {
|
|
12530
|
+
setAnchorEl(event.currentTarget);
|
|
12531
|
+
setOpen(true);
|
|
12532
|
+
}, []);
|
|
12533
|
+
const handleClose = useCallback(() => {
|
|
12534
|
+
setOpen(false);
|
|
12535
|
+
}, []);
|
|
12536
|
+
return { open, handleClose, handleOpen, anchorEl };
|
|
12537
|
+
};
|
|
12538
|
+
function DotsVerticalIcon(props) {
|
|
12539
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "1rem", height: "1rem", viewBox: "0 0 24 24", ...props, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
12540
|
+
"path",
|
|
12541
|
+
{
|
|
12542
|
+
fill: "currentColor",
|
|
12543
|
+
d: "M12 16a2 2 0 0 1 2 2a2 2 0 0 1-2 2a2 2 0 0 1-2-2a2 2 0 0 1 2-2m0-6a2 2 0 0 1 2 2a2 2 0 0 1-2 2a2 2 0 0 1-2-2a2 2 0 0 1 2-2m0-6a2 2 0 0 1 2 2a2 2 0 0 1-2 2a2 2 0 0 1-2-2a2 2 0 0 1 2-2"
|
|
12544
|
+
}
|
|
12545
|
+
) });
|
|
12546
|
+
}
|
|
12547
|
+
const StyledMenuItem$1 = (props) => {
|
|
12548
|
+
var _a;
|
|
12549
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
12550
|
+
MenuItem,
|
|
12551
|
+
{
|
|
12552
|
+
...props,
|
|
12553
|
+
classes: {
|
|
12554
|
+
root: clsx("px-3 py-2.5", (_a = props.classes) == null ? void 0 : _a.root),
|
|
12555
|
+
...props.classes
|
|
12556
|
+
},
|
|
12557
|
+
sx: {
|
|
12558
|
+
"&.Mui-disabled": {
|
|
12559
|
+
pointerEvents: "auto",
|
|
12560
|
+
cursor: "not-allowed",
|
|
12561
|
+
"&:hover": {
|
|
12562
|
+
backgroundColor: "transparent !important"
|
|
12563
|
+
}
|
|
12564
|
+
},
|
|
12565
|
+
...props.sx
|
|
12566
|
+
}
|
|
12567
|
+
}
|
|
12568
|
+
);
|
|
12569
|
+
};
|
|
12570
|
+
const contained = "_contained_gteum_27";
|
|
12571
|
+
const common = "_common_gteum_27";
|
|
12572
|
+
const medium = "_medium_gteum_69";
|
|
12573
|
+
const small = "_small_gteum_74";
|
|
12574
|
+
const large = "_large_gteum_79";
|
|
12575
|
+
const error = "_error_gteum_84";
|
|
12576
|
+
const outlined = "_outlined_gteum_141";
|
|
12577
|
+
const text = "_text_gteum_255";
|
|
12578
|
+
const textGray = "_textGray_gteum_369";
|
|
12579
|
+
const textWhite = "_textWhite_gteum_426";
|
|
12580
|
+
const style$1 = {
|
|
12581
|
+
"asma-core-ui-button": "_asma-core-ui-button_gteum_1",
|
|
12582
|
+
contained,
|
|
12583
|
+
common,
|
|
12584
|
+
medium,
|
|
12585
|
+
small,
|
|
12586
|
+
large,
|
|
12587
|
+
error,
|
|
12588
|
+
outlined,
|
|
12589
|
+
text,
|
|
12590
|
+
textGray,
|
|
12591
|
+
textWhite
|
|
12592
|
+
};
|
|
12593
|
+
const BtnStyles = {
|
|
12594
|
+
contained: style$1["contained"],
|
|
12595
|
+
outlined: style$1["outlined"],
|
|
12596
|
+
text: style$1["text"],
|
|
12597
|
+
textGray: style$1["textGray"],
|
|
12598
|
+
textWhite: style$1["textWhite"],
|
|
12599
|
+
large: style$1["large"],
|
|
12600
|
+
small: style$1["small"],
|
|
12601
|
+
medium: style$1["medium"],
|
|
12602
|
+
error: style$1["error"],
|
|
12603
|
+
common: style$1["common"]
|
|
12604
|
+
};
|
|
12605
|
+
const StyledButton = ({
|
|
12606
|
+
variant = "contained",
|
|
12607
|
+
className = "",
|
|
12608
|
+
size = "medium",
|
|
12609
|
+
children,
|
|
12610
|
+
refLink,
|
|
12611
|
+
startIcon,
|
|
12612
|
+
endIcon,
|
|
12613
|
+
dataTest,
|
|
12614
|
+
error: error2,
|
|
12615
|
+
...otherProps
|
|
12616
|
+
}) => {
|
|
12617
|
+
const isLarge = size === "large" || size === "medium";
|
|
12618
|
+
const color2 = error2 ? "error" : "common";
|
|
12619
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
12620
|
+
"button",
|
|
12621
|
+
{
|
|
12622
|
+
...otherProps,
|
|
12623
|
+
className: clsx(
|
|
12624
|
+
style$1["asma-core-ui-button"],
|
|
12625
|
+
BtnStyles[variant],
|
|
12626
|
+
BtnStyles[color2],
|
|
12627
|
+
BtnStyles[size],
|
|
12628
|
+
className
|
|
12629
|
+
),
|
|
12630
|
+
ref: refLink,
|
|
12631
|
+
"data-test": dataTest,
|
|
12632
|
+
children: [
|
|
12633
|
+
startIcon,
|
|
12634
|
+
children && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
12635
|
+
"div",
|
|
12636
|
+
{
|
|
12637
|
+
style: {
|
|
12638
|
+
overflow: "hidden",
|
|
12639
|
+
textOverflow: "ellipsis",
|
|
12640
|
+
whiteSpace: "nowrap",
|
|
12641
|
+
display: "flex",
|
|
12642
|
+
alignItems: "center",
|
|
12643
|
+
justifyContent: "center",
|
|
12644
|
+
gap: isLarge ? "8px" : "4px",
|
|
12645
|
+
paddingLeft: isLarge ? "8px" : "4px",
|
|
12646
|
+
paddingRight: isLarge ? "8px" : "4px"
|
|
12647
|
+
},
|
|
12648
|
+
children
|
|
12649
|
+
}
|
|
12650
|
+
),
|
|
12651
|
+
endIcon
|
|
12652
|
+
]
|
|
12653
|
+
}
|
|
12654
|
+
);
|
|
12655
|
+
};
|
|
12646
12656
|
function CircleWarningOutlineIcon(props) {
|
|
12647
12657
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16 ", ...props, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("g", { fill: "none", stroke: "currentColor", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "1.5", children: [
|
|
12648
12658
|
/* @__PURE__ */ jsxRuntimeExports.jsx("circle", { cx: "8", cy: "8", r: "6.25" }),
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './types';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Row, RowData } from '@tanstack/react-table';
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
|
+
export interface RowSelectionTooltipOptions<TData extends RowData> {
|
|
4
|
+
getRowSelectionTooltip?: (row: Row<TData>) => ReactNode;
|
|
5
|
+
}
|
|
6
|
+
export interface RowSelectionTooltipRow<TData extends RowData> {
|
|
7
|
+
getRowSelectionTooltip: () => ReturnType<NonNullable<RowSelectionTooltipOptions<TData>['getRowSelectionTooltip']>>;
|
|
8
|
+
}
|
package/dist/src/types.d.ts
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
import type { ColumnPinningColumnDef, ColumnSizingColumnDef, GroupingColumnDef, RowData, SortingColumnDef, VisibilityColumnDef, AccessorFn, ColumnDefTemplate, CellContext, ColumnMeta, HeaderContext, Row, TableOptions, Table, ColumnDef } from '@tanstack/react-table';
|
|
1
|
+
import type { ColumnPinningColumnDef, ColumnSizingColumnDef, GroupingColumnDef, RowData, SortingColumnDef, VisibilityColumnDef, AccessorFn, ColumnDefTemplate, CellContext, ColumnMeta, HeaderContext, Row, RowModel, TableOptions, Table, ColumnDef } from '@tanstack/react-table';
|
|
2
2
|
export type * from '@tanstack/react-table';
|
|
3
3
|
import type { CSSProperties, MouseEvent, MutableRefObject, ReactElement, ReactNode } from 'react';
|
|
4
4
|
import type { ExpandedRow, ExpandedRowsInstance, ExpandedRowsOptions, ExpandedRowsTableState } from './custom-features/expand-rows';
|
|
5
5
|
import type { TooltipProps } from '@mui/material';
|
|
6
6
|
import type { FocusedRowsOptions, FocusedRowsTableState, FocusedRow, FocusedRowsInstance } from './custom-features/focus-rows';
|
|
7
7
|
import type { OrderedColumnsOptions, OrderedColumnsTableState } from './custom-features/order-columns';
|
|
8
|
+
import type { RowSelectionTooltipOptions, RowSelectionTooltipRow } from './custom-features/row-selection-tooltip';
|
|
8
9
|
declare module '@tanstack/react-table' {
|
|
9
10
|
interface TableState extends ExpandedRowsTableState, FocusedRowsTableState, OrderedColumnsTableState {
|
|
10
11
|
}
|
|
11
|
-
interface TableOptionsResolved<TData extends RowData> extends ExpandedRowsOptions, FocusedRowsOptions, OrderedColumnsOptions {
|
|
12
|
+
interface TableOptionsResolved<TData extends RowData> extends ExpandedRowsOptions, FocusedRowsOptions, OrderedColumnsOptions, RowSelectionTooltipOptions<TData> {
|
|
12
13
|
}
|
|
13
|
-
interface Row<TData extends RowData> extends ExpandedRow, FocusedRow {
|
|
14
|
+
interface Row<TData extends RowData> extends ExpandedRow, FocusedRow, RowSelectionTooltipRow<TData> {
|
|
14
15
|
}
|
|
15
16
|
interface Table<TData extends RowData> extends ExpandedRowsInstance, FocusedRowsInstance {
|
|
17
|
+
getCoreRowModel: () => RowModel<TData>;
|
|
16
18
|
}
|
|
17
19
|
interface ColumnDefExtensions<TData extends RowData, TValue = unknown> extends VisibilityColumnDef, ColumnPinningColumnDef, SortingColumnDef<TData>, GroupingColumnDef<TData, TValue>, ColumnSizingColumnDef {
|
|
18
20
|
className?: string;
|