@natoora-libs/core 0.1.13-dev-doug-2 → 0.1.13-dev-doug-4
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.
|
@@ -861,6 +861,7 @@ type HeaderFilters = {
|
|
|
861
861
|
type HeadCell = {
|
|
862
862
|
id: string;
|
|
863
863
|
label?: string;
|
|
864
|
+
labelTooltip?: string;
|
|
864
865
|
fieldName?: string;
|
|
865
866
|
numeric?: boolean;
|
|
866
867
|
disablePadding?: boolean;
|
|
@@ -890,7 +891,7 @@ type TableDesktopProps = {
|
|
|
890
891
|
updateSort?: (sortField: string, sortDir: Order) => void;
|
|
891
892
|
showClearFilterButton?: boolean;
|
|
892
893
|
handleClickOnClearFiltersButton?: () => void;
|
|
893
|
-
deleteItem?: (id:
|
|
894
|
+
deleteItem?: (id: string) => void;
|
|
894
895
|
keyField?: string;
|
|
895
896
|
tableLayout?: 'fixed' | 'auto';
|
|
896
897
|
onApplyFilters?: (updatedFilters: HeaderFilters, shouldSave: boolean) => void;
|
|
@@ -861,6 +861,7 @@ type HeaderFilters = {
|
|
|
861
861
|
type HeadCell = {
|
|
862
862
|
id: string;
|
|
863
863
|
label?: string;
|
|
864
|
+
labelTooltip?: string;
|
|
864
865
|
fieldName?: string;
|
|
865
866
|
numeric?: boolean;
|
|
866
867
|
disablePadding?: boolean;
|
|
@@ -890,7 +891,7 @@ type TableDesktopProps = {
|
|
|
890
891
|
updateSort?: (sortField: string, sortDir: Order) => void;
|
|
891
892
|
showClearFilterButton?: boolean;
|
|
892
893
|
handleClickOnClearFiltersButton?: () => void;
|
|
893
|
-
deleteItem?: (id:
|
|
894
|
+
deleteItem?: (id: string) => void;
|
|
894
895
|
keyField?: string;
|
|
895
896
|
tableLayout?: 'fixed' | 'auto';
|
|
896
897
|
onApplyFilters?: (updatedFilters: HeaderFilters, shouldSave: boolean) => void;
|
package/dist/components/index.js
CHANGED
|
@@ -6596,7 +6596,7 @@ import {
|
|
|
6596
6596
|
FormControlLabel as FormControlLabel3,
|
|
6597
6597
|
Menu as Menu4,
|
|
6598
6598
|
Skeleton as Skeleton3,
|
|
6599
|
-
Tooltip as
|
|
6599
|
+
Tooltip as Tooltip7
|
|
6600
6600
|
} from "@mui/material";
|
|
6601
6601
|
import classNames3 from "classnames";
|
|
6602
6602
|
import { makeStyles as makeStyles48 } from "tss-react/mui";
|
|
@@ -6628,6 +6628,7 @@ import {
|
|
|
6628
6628
|
TableHead,
|
|
6629
6629
|
TableRow,
|
|
6630
6630
|
TableSortLabel,
|
|
6631
|
+
Tooltip as Tooltip6,
|
|
6631
6632
|
Typography as Typography25
|
|
6632
6633
|
} from "@mui/material";
|
|
6633
6634
|
import { makeStyles as makeStyles45 } from "tss-react/mui";
|
|
@@ -6729,7 +6730,7 @@ var SmartTableHeader = ({
|
|
|
6729
6730
|
flexDirection: "row",
|
|
6730
6731
|
gap: headCell.disableSort ? 1 : 0,
|
|
6731
6732
|
children: [
|
|
6732
|
-
headCell.disableSort ? /* @__PURE__ */ jsx108(Typography25, { variant: "subtitle2", mt: 0.25, fontWeight: 600, children: headCell.label }) : /* @__PURE__ */ jsxs73(
|
|
6733
|
+
headCell.disableSort ? headCell.RenderHeader ?? /* @__PURE__ */ jsx108(Tooltip6, { title: headCell.labelTooltip ?? "", arrow: true, children: /* @__PURE__ */ jsx108(Typography25, { variant: "subtitle2", mt: 0.25, fontWeight: 600, children: headCell.label }) }) : /* @__PURE__ */ jsx108(Tooltip6, { title: headCell.labelTooltip ?? "", arrow: true, children: /* @__PURE__ */ jsxs73(
|
|
6733
6734
|
TableSortLabel,
|
|
6734
6735
|
{
|
|
6735
6736
|
"data-testid": "table-sort-label",
|
|
@@ -6741,7 +6742,7 @@ var SmartTableHeader = ({
|
|
|
6741
6742
|
orderBy === headCell.id ? /* @__PURE__ */ jsx108("span", { className: classes.visuallyHidden, children: order === "desc" ? "sorted descending" : "sorted ascending" }) : null
|
|
6742
6743
|
]
|
|
6743
6744
|
}
|
|
6744
|
-
),
|
|
6745
|
+
) }),
|
|
6745
6746
|
headCell.refetchFilterOptions ? /* @__PURE__ */ jsx108(
|
|
6746
6747
|
SmartTableHeaderFilterMenu_default,
|
|
6747
6748
|
{
|
|
@@ -7234,7 +7235,7 @@ var SmartTableHeaderFilterMenu = ({
|
|
|
7234
7235
|
},
|
|
7235
7236
|
resolvedOption
|
|
7236
7237
|
),
|
|
7237
|
-
shouldShowCheckOnFilter?.(headCell.id, option) ? /* @__PURE__ */ jsx111(
|
|
7238
|
+
shouldShowCheckOnFilter?.(headCell.id, option) ? /* @__PURE__ */ jsx111(Tooltip7, { title: "This filter is saved as default", children: /* @__PURE__ */ jsx111(CheckIcon, { fontSize: "small", color: "action" }) }) : null
|
|
7238
7239
|
]
|
|
7239
7240
|
},
|
|
7240
7241
|
resolvedOption
|
|
@@ -7540,7 +7541,10 @@ var TableDesktopFooter = ({
|
|
|
7540
7541
|
|
|
7541
7542
|
// src/components/TableDesktopRowCell/TableDesktopRowCell.tsx
|
|
7542
7543
|
import { useEffect as useEffect13, useRef as useRef5, useState as useState20 } from "react";
|
|
7543
|
-
import
|
|
7544
|
+
import CheckIcon2 from "@mui/icons-material/Check";
|
|
7545
|
+
import Close2 from "@mui/icons-material/Close";
|
|
7546
|
+
import Edit3 from "@mui/icons-material/Edit";
|
|
7547
|
+
import { Box as Box33, Checkbox as Checkbox6, IconButton as IconButton4, TableCell as TableCell5, TextField as TextField9, Tooltip as Tooltip8 } from "@mui/material";
|
|
7544
7548
|
|
|
7545
7549
|
// src/components/TableDesktopRowCell/TableDesktopSmartSelect.tsx
|
|
7546
7550
|
import { useState as useState18, memo as memo22, useEffect as useEffect12 } from "react";
|
|
@@ -7598,12 +7602,9 @@ var TableDesktopSmartSelect = memo22(({
|
|
|
7598
7602
|
);
|
|
7599
7603
|
});
|
|
7600
7604
|
|
|
7601
|
-
// src/components/TableDesktopRowCell/TableDesktopRowCell.tsx
|
|
7602
|
-
import CheckIcon2 from "@mui/icons-material/Check";
|
|
7603
|
-
|
|
7604
7605
|
// src/components/TableDesktopRowCell/TableDesktopTextField.tsx
|
|
7605
|
-
import TextField8 from "@mui/material/TextField";
|
|
7606
7606
|
import { useMemo as useMemo4, useState as useState19 } from "react";
|
|
7607
|
+
import { TextField as TextField8 } from "@mui/material";
|
|
7607
7608
|
import { jsx as jsx116 } from "react/jsx-runtime";
|
|
7608
7609
|
var TableDesktopTextField = ({
|
|
7609
7610
|
rowId,
|
|
@@ -7613,34 +7614,54 @@ var TableDesktopTextField = ({
|
|
|
7613
7614
|
validateInput,
|
|
7614
7615
|
onUpdateEditableCell
|
|
7615
7616
|
}) => {
|
|
7616
|
-
const [
|
|
7617
|
-
const
|
|
7617
|
+
const [input, setInput] = useState19(editInitialValue);
|
|
7618
|
+
const hasValidationError = useMemo4(() => !validateInput?.(input), [input, validateInput]);
|
|
7619
|
+
const commitValue = (value) => {
|
|
7620
|
+
if (hasValidationError) {
|
|
7621
|
+
return;
|
|
7622
|
+
}
|
|
7623
|
+
onUpdateEditableCell?.(rowId, value);
|
|
7624
|
+
};
|
|
7625
|
+
const handleKeyDown = (e) => {
|
|
7626
|
+
if (e.key === "Enter") {
|
|
7627
|
+
e.preventDefault();
|
|
7628
|
+
commitValue(input);
|
|
7629
|
+
}
|
|
7630
|
+
};
|
|
7618
7631
|
return /* @__PURE__ */ jsx116(
|
|
7619
7632
|
TextField8,
|
|
7620
7633
|
{
|
|
7621
7634
|
fullWidth: true,
|
|
7622
7635
|
variant: "standard",
|
|
7623
|
-
|
|
7636
|
+
value: input,
|
|
7624
7637
|
label: inputLabel,
|
|
7625
|
-
error:
|
|
7638
|
+
error: hasValidationError,
|
|
7626
7639
|
disabled,
|
|
7627
|
-
|
|
7628
|
-
|
|
7640
|
+
onKeyDown: handleKeyDown,
|
|
7641
|
+
onChange: ({ target: { value } }) => {
|
|
7642
|
+
setInput(value);
|
|
7629
7643
|
},
|
|
7630
|
-
onBlur: ({ target: { value
|
|
7631
|
-
|
|
7632
|
-
return;
|
|
7633
|
-
}
|
|
7634
|
-
onUpdateEditableCell?.(rowId, value2);
|
|
7644
|
+
onBlur: ({ target: { value } }) => {
|
|
7645
|
+
commitValue(value);
|
|
7635
7646
|
}
|
|
7636
7647
|
}
|
|
7637
7648
|
);
|
|
7638
7649
|
};
|
|
7639
7650
|
|
|
7640
7651
|
// src/components/TableDesktopRowCell/TableDesktopRowCell.tsx
|
|
7641
|
-
import Close2 from "@mui/icons-material/Close";
|
|
7642
|
-
import Edit3 from "@mui/icons-material/Edit";
|
|
7643
7652
|
import { jsx as jsx117, jsxs as jsxs79 } from "react/jsx-runtime";
|
|
7653
|
+
var getReadOnlyBooleanIcon = (value) => {
|
|
7654
|
+
if (value) {
|
|
7655
|
+
return /* @__PURE__ */ jsx117(CheckIcon2, { sx: { fontSize: 16 } });
|
|
7656
|
+
}
|
|
7657
|
+
return "-";
|
|
7658
|
+
};
|
|
7659
|
+
var renderReadOnlyValue = (value) => {
|
|
7660
|
+
if (typeof value === "boolean") {
|
|
7661
|
+
return getReadOnlyBooleanIcon(value);
|
|
7662
|
+
}
|
|
7663
|
+
return value;
|
|
7664
|
+
};
|
|
7644
7665
|
var TableDesktopRowCell = ({
|
|
7645
7666
|
inputLabel,
|
|
7646
7667
|
editInitialValue,
|
|
@@ -7739,17 +7760,11 @@ var TableDesktopRowCell = ({
|
|
|
7739
7760
|
}
|
|
7740
7761
|
)
|
|
7741
7762
|
};
|
|
7742
|
-
const getReadOnlyBooleanIcon = (value) => {
|
|
7743
|
-
if (value) {
|
|
7744
|
-
return /* @__PURE__ */ jsx117(CheckIcon2, { sx: { fontSize: 16 } });
|
|
7745
|
-
}
|
|
7746
|
-
return "-";
|
|
7747
|
-
};
|
|
7748
7763
|
const handleEditClick = (e) => {
|
|
7749
7764
|
e.stopPropagation();
|
|
7750
7765
|
setIsEditMode((prev) => !prev);
|
|
7751
7766
|
};
|
|
7752
|
-
return /* @__PURE__ */ jsx117(
|
|
7767
|
+
return /* @__PURE__ */ jsx117(Tooltip8, { title: isOverflowed ? String(readOnlyValue) : "", arrow: true, children: /* @__PURE__ */ jsx117(
|
|
7753
7768
|
TableCell5,
|
|
7754
7769
|
{
|
|
7755
7770
|
align: "left",
|
|
@@ -7776,7 +7791,7 @@ var TableDesktopRowCell = ({
|
|
|
7776
7791
|
textOverflow: "ellipsis",
|
|
7777
7792
|
whiteSpace: "nowrap",
|
|
7778
7793
|
children: [
|
|
7779
|
-
isCellHovered ? /* @__PURE__ */ jsx117(
|
|
7794
|
+
isCellHovered ? /* @__PURE__ */ jsx117(Tooltip8, { title: isEditMode ? "" : "Toggle Edit Mode", children: /* @__PURE__ */ jsx117(
|
|
7780
7795
|
IconButton4,
|
|
7781
7796
|
{
|
|
7782
7797
|
onClick: handleEditClick,
|
|
@@ -7794,7 +7809,7 @@ var TableDesktopRowCell = ({
|
|
|
7794
7809
|
children: isEditMode ? /* @__PURE__ */ jsx117(Close2, { fontSize: "small", color: "error" }) : /* @__PURE__ */ jsx117(Edit3, { fontSize: "small" })
|
|
7795
7810
|
}
|
|
7796
7811
|
) }) : null,
|
|
7797
|
-
isEditMode && editableCellType ? editableComponents[editableCellType] :
|
|
7812
|
+
isEditMode && editableCellType ? editableComponents[editableCellType] : renderReadOnlyValue(readOnlyValue)
|
|
7798
7813
|
]
|
|
7799
7814
|
}
|
|
7800
7815
|
)
|