@natoora-libs/core 0.1.16-dev-doug-6 → 0.1.16-dev-doug-7
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/components/index.js
CHANGED
|
@@ -7276,10 +7276,32 @@ var TableDesktopFooter = ({
|
|
|
7276
7276
|
);
|
|
7277
7277
|
};
|
|
7278
7278
|
|
|
7279
|
+
// src/components/TableDesktopLoadingState/TableDesktopLoadingState.tsx
|
|
7280
|
+
import { Skeleton as Skeleton4, TableCell as TableCell3, TableRow as TableRow3 } from "@mui/material";
|
|
7281
|
+
import { jsx as jsx114 } from "react/jsx-runtime";
|
|
7282
|
+
var getRange = (n) => Array.from({ length: n }, (_, i) => i + 1);
|
|
7283
|
+
var TableDesktopLoadingState = ({
|
|
7284
|
+
numRows,
|
|
7285
|
+
rowsPerPage,
|
|
7286
|
+
numColumns,
|
|
7287
|
+
rowHeight
|
|
7288
|
+
}) => {
|
|
7289
|
+
return getRange(Math.min(numRows, rowsPerPage)).map((rowNum) => /* @__PURE__ */ jsx114(TableRow3, { children: getRange(numColumns).map((colNum) => /* @__PURE__ */ jsx114(TableCell3, { children: /* @__PURE__ */ jsx114(
|
|
7290
|
+
Skeleton4,
|
|
7291
|
+
{
|
|
7292
|
+
animation: "pulse",
|
|
7293
|
+
variant: "rounded",
|
|
7294
|
+
height: rowHeight - 33,
|
|
7295
|
+
sx: { bgcolor: colors.neutral100 },
|
|
7296
|
+
"data-testid": "loading-skeleton"
|
|
7297
|
+
}
|
|
7298
|
+
) }, colNum)) }, rowNum));
|
|
7299
|
+
};
|
|
7300
|
+
|
|
7279
7301
|
// src/components/TableDesktopNoColumnsMessage/TableDesktopNoColumnsMessage.tsx
|
|
7280
7302
|
import TableBody2 from "@mui/material/TableBody";
|
|
7281
|
-
import
|
|
7282
|
-
import
|
|
7303
|
+
import TableCell4 from "@mui/material/TableCell";
|
|
7304
|
+
import TableRow4 from "@mui/material/TableRow";
|
|
7283
7305
|
import Typography27 from "@mui/material/Typography";
|
|
7284
7306
|
|
|
7285
7307
|
// src/components/Buttons/BaseButton/BaseIconButton.tsx
|
|
@@ -7307,11 +7329,11 @@ var BaseIconButton = ({ icon, sx, ...props }) => {
|
|
|
7307
7329
|
};
|
|
7308
7330
|
|
|
7309
7331
|
// src/components/TableDesktopNoColumnsMessage/TableDesktopNoColumnsMessage.tsx
|
|
7310
|
-
import { jsx as
|
|
7332
|
+
import { jsx as jsx115, jsxs as jsxs78 } from "react/jsx-runtime";
|
|
7311
7333
|
var TableDesktopNoColumnsMessage = ({
|
|
7312
7334
|
onClickNoColumnsMessageOpenMenu
|
|
7313
|
-
}) => /* @__PURE__ */
|
|
7314
|
-
|
|
7335
|
+
}) => /* @__PURE__ */ jsx115(TableBody2, { children: /* @__PURE__ */ jsx115(TableRow4, { children: /* @__PURE__ */ jsxs78(
|
|
7336
|
+
TableCell4,
|
|
7315
7337
|
{
|
|
7316
7338
|
sx: {
|
|
7317
7339
|
py: 8,
|
|
@@ -7323,8 +7345,8 @@ var TableDesktopNoColumnsMessage = ({
|
|
|
7323
7345
|
alignItems: "center"
|
|
7324
7346
|
},
|
|
7325
7347
|
children: [
|
|
7326
|
-
/* @__PURE__ */
|
|
7327
|
-
/* @__PURE__ */
|
|
7348
|
+
/* @__PURE__ */ jsx115(Typography27, { variant: "subtitle2", fontSize: 16, children: "Customise your view" }),
|
|
7349
|
+
/* @__PURE__ */ jsx115(Typography27, { variant: "subtitle1", align: "center", color: "textSecondary", children: "Open the menu to customise your table and search." }),
|
|
7328
7350
|
/* @__PURE__ */ jsxs78(
|
|
7329
7351
|
Typography27,
|
|
7330
7352
|
{
|
|
@@ -7338,18 +7360,18 @@ var TableDesktopNoColumnsMessage = ({
|
|
|
7338
7360
|
},
|
|
7339
7361
|
children: [
|
|
7340
7362
|
"Tips: ",
|
|
7341
|
-
/* @__PURE__ */
|
|
7363
|
+
/* @__PURE__ */ jsx115(Typography27, { component: "strong", children: "Save as default" }),
|
|
7342
7364
|
" to keep these columns for future views"
|
|
7343
7365
|
]
|
|
7344
7366
|
}
|
|
7345
7367
|
),
|
|
7346
|
-
/* @__PURE__ */
|
|
7368
|
+
/* @__PURE__ */ jsx115(
|
|
7347
7369
|
BaseIconButton,
|
|
7348
7370
|
{
|
|
7349
7371
|
variant: "contained",
|
|
7350
7372
|
color: "primary",
|
|
7351
7373
|
onClick: onClickNoColumnsMessageOpenMenu,
|
|
7352
|
-
icon: /* @__PURE__ */
|
|
7374
|
+
icon: /* @__PURE__ */ jsx115(IconTableEdit_default, { fill: colors.white }),
|
|
7353
7375
|
children: "OPEN MENU"
|
|
7354
7376
|
}
|
|
7355
7377
|
)
|
|
@@ -7357,28 +7379,6 @@ var TableDesktopNoColumnsMessage = ({
|
|
|
7357
7379
|
}
|
|
7358
7380
|
) }) });
|
|
7359
7381
|
|
|
7360
|
-
// src/components/TableDesktopLoadingState/TableDesktopLoadingState.tsx
|
|
7361
|
-
import { Skeleton as Skeleton4, TableCell as TableCell4, TableRow as TableRow4 } from "@mui/material";
|
|
7362
|
-
import { jsx as jsx115 } from "react/jsx-runtime";
|
|
7363
|
-
var getRange = (n) => Array.from({ length: n }, (_, i) => i + 1);
|
|
7364
|
-
var TableDesktopLoadingState = ({
|
|
7365
|
-
numRows,
|
|
7366
|
-
rowsPerPage,
|
|
7367
|
-
numColumns,
|
|
7368
|
-
rowHeight
|
|
7369
|
-
}) => {
|
|
7370
|
-
return getRange(Math.min(numRows, rowsPerPage)).map((rowNum) => /* @__PURE__ */ jsx115(TableRow4, { children: getRange(numColumns).map((colNum) => /* @__PURE__ */ jsx115(TableCell4, { children: /* @__PURE__ */ jsx115(
|
|
7371
|
-
Skeleton4,
|
|
7372
|
-
{
|
|
7373
|
-
animation: "pulse",
|
|
7374
|
-
variant: "rounded",
|
|
7375
|
-
height: rowHeight - 33,
|
|
7376
|
-
sx: { bgcolor: colors.neutral100 },
|
|
7377
|
-
"data-testid": "loading-skeleton"
|
|
7378
|
-
}
|
|
7379
|
-
) }, colNum)) }, rowNum));
|
|
7380
|
-
};
|
|
7381
|
-
|
|
7382
7382
|
// src/components/TableDesktopRows/TableDesktopRows.tsx
|
|
7383
7383
|
import { jsx as jsx116 } from "react/jsx-runtime";
|
|
7384
7384
|
var descendingComparator2 = (a, b, orderBy) => {
|
|
@@ -7415,8 +7415,6 @@ var TableDesktopRows = ({
|
|
|
7415
7415
|
keyField,
|
|
7416
7416
|
order,
|
|
7417
7417
|
orderBy,
|
|
7418
|
-
rowsPerPage,
|
|
7419
|
-
isLoading,
|
|
7420
7418
|
disableInternalSort,
|
|
7421
7419
|
enableCheckboxSelection,
|
|
7422
7420
|
enableEditMode,
|
|
@@ -7426,17 +7424,6 @@ var TableDesktopRows = ({
|
|
|
7426
7424
|
deleteItem
|
|
7427
7425
|
}) => {
|
|
7428
7426
|
const sortedData = disableInternalSort ? data : stableSort2(data, getComparator(order, orderBy));
|
|
7429
|
-
if (isLoading) {
|
|
7430
|
-
return /* @__PURE__ */ jsx116(
|
|
7431
|
-
TableDesktopLoadingState,
|
|
7432
|
-
{
|
|
7433
|
-
numRows: data.length,
|
|
7434
|
-
rowsPerPage,
|
|
7435
|
-
numColumns: visibleHeadCells.length + (enableCheckboxSelection ? 1 : 0),
|
|
7436
|
-
rowHeight
|
|
7437
|
-
}
|
|
7438
|
-
);
|
|
7439
|
-
}
|
|
7440
7427
|
return sortedData.map((row, index) => {
|
|
7441
7428
|
const isItemSelected = selectedRows.has(row[keyField]);
|
|
7442
7429
|
return /* @__PURE__ */ jsx116(
|
|
@@ -7557,7 +7544,7 @@ var TableEmptyResult_default = TableEmptyResult;
|
|
|
7557
7544
|
// src/components/TableDesktop/TableDesktop.tsx
|
|
7558
7545
|
import { Fragment as Fragment12, jsx as jsx119, jsxs as jsxs81 } from "react/jsx-runtime";
|
|
7559
7546
|
var TableDesktop = ({
|
|
7560
|
-
data,
|
|
7547
|
+
data = [],
|
|
7561
7548
|
headCells,
|
|
7562
7549
|
RenderItem,
|
|
7563
7550
|
appliedFilters,
|
|
@@ -7674,6 +7661,53 @@ var TableDesktop = ({
|
|
|
7674
7661
|
);
|
|
7675
7662
|
}
|
|
7676
7663
|
}, [data, setSelectedRows, isEveryRowInPageSelected, isRowsFromAllPagesSelected]);
|
|
7664
|
+
const renderBody = useMemo3(
|
|
7665
|
+
() => rowsPerPage !== emptyRows ? /* @__PURE__ */ jsx119(
|
|
7666
|
+
TableDesktopRows,
|
|
7667
|
+
{
|
|
7668
|
+
data,
|
|
7669
|
+
RenderItem,
|
|
7670
|
+
visibleHeadCells,
|
|
7671
|
+
keyField,
|
|
7672
|
+
order,
|
|
7673
|
+
orderBy,
|
|
7674
|
+
disableInternalSort,
|
|
7675
|
+
enableCheckboxSelection,
|
|
7676
|
+
enableEditMode,
|
|
7677
|
+
selectedRows,
|
|
7678
|
+
handleRowCheckboxChange,
|
|
7679
|
+
rowHeight,
|
|
7680
|
+
deleteItem
|
|
7681
|
+
}
|
|
7682
|
+
) : /* @__PURE__ */ jsx119(
|
|
7683
|
+
TableEmptyResult_default,
|
|
7684
|
+
{
|
|
7685
|
+
colSpan: enableCheckboxSelection ? visibleHeadCells.length + 1 : visibleHeadCells.length,
|
|
7686
|
+
showClearFilterButton,
|
|
7687
|
+
handleClickOnClearFiltersButton
|
|
7688
|
+
}
|
|
7689
|
+
),
|
|
7690
|
+
[
|
|
7691
|
+
rowsPerPage,
|
|
7692
|
+
emptyRows,
|
|
7693
|
+
data,
|
|
7694
|
+
RenderItem,
|
|
7695
|
+
visibleHeadCells,
|
|
7696
|
+
keyField,
|
|
7697
|
+
order,
|
|
7698
|
+
orderBy,
|
|
7699
|
+
isLoading,
|
|
7700
|
+
disableInternalSort,
|
|
7701
|
+
enableCheckboxSelection,
|
|
7702
|
+
enableEditMode,
|
|
7703
|
+
selectedRows,
|
|
7704
|
+
handleRowCheckboxChange,
|
|
7705
|
+
rowHeight,
|
|
7706
|
+
deleteItem,
|
|
7707
|
+
showClearFilterButton,
|
|
7708
|
+
handleClickOnClearFiltersButton
|
|
7709
|
+
]
|
|
7710
|
+
);
|
|
7677
7711
|
return /* @__PURE__ */ jsx119(
|
|
7678
7712
|
Box34,
|
|
7679
7713
|
{
|
|
@@ -7740,7 +7774,7 @@ var TableDesktop = ({
|
|
|
7740
7774
|
stickyHeader: true,
|
|
7741
7775
|
"aria-label": "sticky-table",
|
|
7742
7776
|
sx: { tableLayout },
|
|
7743
|
-
children: visibleHeadCells.length === 0 ? /* @__PURE__ */ jsx119(
|
|
7777
|
+
children: visibleHeadCells.length === 0 && !isLoading ? /* @__PURE__ */ jsx119(
|
|
7744
7778
|
TableDesktopNoColumnsMessage,
|
|
7745
7779
|
{
|
|
7746
7780
|
onClickNoColumnsMessageOpenMenu: toolbarProps?.onClickToolbarMenuOpen
|
|
@@ -7762,31 +7796,13 @@ var TableDesktop = ({
|
|
|
7762
7796
|
shouldShowCheckOnFilter
|
|
7763
7797
|
}
|
|
7764
7798
|
),
|
|
7765
|
-
/* @__PURE__ */ jsx119(TableBody3, { children:
|
|
7766
|
-
|
|
7799
|
+
/* @__PURE__ */ jsx119(TableBody3, { children: !isLoading ? renderBody : /* @__PURE__ */ jsx119(
|
|
7800
|
+
TableDesktopLoadingState,
|
|
7767
7801
|
{
|
|
7768
|
-
data,
|
|
7769
|
-
RenderItem,
|
|
7770
|
-
visibleHeadCells,
|
|
7771
|
-
keyField,
|
|
7772
|
-
order,
|
|
7773
|
-
orderBy,
|
|
7802
|
+
numRows: data.length,
|
|
7774
7803
|
rowsPerPage,
|
|
7775
|
-
|
|
7776
|
-
|
|
7777
|
-
enableCheckboxSelection,
|
|
7778
|
-
enableEditMode,
|
|
7779
|
-
selectedRows,
|
|
7780
|
-
handleRowCheckboxChange,
|
|
7781
|
-
rowHeight,
|
|
7782
|
-
deleteItem
|
|
7783
|
-
}
|
|
7784
|
-
) : /* @__PURE__ */ jsx119(
|
|
7785
|
-
TableEmptyResult_default,
|
|
7786
|
-
{
|
|
7787
|
-
colSpan: enableCheckboxSelection ? visibleHeadCells.length + 1 : visibleHeadCells.length,
|
|
7788
|
-
showClearFilterButton,
|
|
7789
|
-
handleClickOnClearFiltersButton
|
|
7804
|
+
numColumns: visibleHeadCells.length + (enableCheckboxSelection ? 1 : 0),
|
|
7805
|
+
rowHeight
|
|
7790
7806
|
}
|
|
7791
7807
|
) })
|
|
7792
7808
|
] })
|
|
@@ -7807,7 +7823,7 @@ var TableDesktop = ({
|
|
|
7807
7823
|
import { Checkbox as Checkbox6, FormControlLabel as FormControlLabel4 } from "@mui/material";
|
|
7808
7824
|
|
|
7809
7825
|
// src/components/TableDesktopEditableComponent/TableDesktopNumericField.tsx
|
|
7810
|
-
import { useState as useState18 } from "react";
|
|
7826
|
+
import { useState as useState18, useRef as useRef5 } from "react";
|
|
7811
7827
|
import { TextField as TextField8 } from "@mui/material";
|
|
7812
7828
|
import { jsx as jsx120 } from "react/jsx-runtime";
|
|
7813
7829
|
var TableDesktopNumericField = ({
|
|
@@ -7821,11 +7837,13 @@ var TableDesktopNumericField = ({
|
|
|
7821
7837
|
onUpdateEditableCell
|
|
7822
7838
|
}) => {
|
|
7823
7839
|
const [input, setInput] = useState18(initialValue);
|
|
7840
|
+
const oldValue = useRef5(initialValue);
|
|
7824
7841
|
const commitValue = (value) => {
|
|
7825
|
-
const isDirty = value !==
|
|
7842
|
+
const isDirty = value !== oldValue.current;
|
|
7826
7843
|
if (!onUpdateEditableCell || !isDirty) {
|
|
7827
7844
|
return;
|
|
7828
7845
|
}
|
|
7846
|
+
oldValue.current = value;
|
|
7829
7847
|
onUpdateEditableCell(rowId ?? 0, field, value, value);
|
|
7830
7848
|
};
|
|
7831
7849
|
const handleKeyDown = (e) => {
|
|
@@ -7934,7 +7952,7 @@ var TableDesktopSmartSelect = memo22(({
|
|
|
7934
7952
|
});
|
|
7935
7953
|
|
|
7936
7954
|
// src/components/TableDesktopEditableComponent/TableDesktopTextField.tsx
|
|
7937
|
-
import { useMemo as useMemo4, useState as useState20 } from "react";
|
|
7955
|
+
import { useMemo as useMemo4, useState as useState20, useRef as useRef6 } from "react";
|
|
7938
7956
|
import { TextField as TextField9 } from "@mui/material";
|
|
7939
7957
|
import { jsx as jsx122 } from "react/jsx-runtime";
|
|
7940
7958
|
var TableDesktopTextField = ({
|
|
@@ -7949,12 +7967,14 @@ var TableDesktopTextField = ({
|
|
|
7949
7967
|
onUpdateEditableCell
|
|
7950
7968
|
}) => {
|
|
7951
7969
|
const [input, setInput] = useState20(initialValue);
|
|
7970
|
+
const oldValue = useRef6(initialValue);
|
|
7952
7971
|
const hasValidationError = useMemo4(() => !validateInput?.(input), [input, validateInput]);
|
|
7953
7972
|
const commitValue = (value) => {
|
|
7954
|
-
const isDirty = value !==
|
|
7973
|
+
const isDirty = value !== oldValue.current;
|
|
7955
7974
|
if (hasValidationError || !onUpdateEditableCell || !isDirty) {
|
|
7956
7975
|
return;
|
|
7957
7976
|
}
|
|
7977
|
+
oldValue.current = value;
|
|
7958
7978
|
onUpdateEditableCell(rowId ?? 0, field, value, value);
|
|
7959
7979
|
};
|
|
7960
7980
|
const handleKeyDown = (e) => {
|
|
@@ -8073,7 +8093,7 @@ var TableDesktopEditableComponent = ({
|
|
|
8073
8093
|
};
|
|
8074
8094
|
|
|
8075
8095
|
// src/components/TableDesktopCell/TableDesktopCell.tsx
|
|
8076
|
-
import { useEffect as useEffect13, useRef as
|
|
8096
|
+
import { useEffect as useEffect13, useRef as useRef7, useState as useState21 } from "react";
|
|
8077
8097
|
import CheckIcon2 from "@mui/icons-material/Check";
|
|
8078
8098
|
import CloseIcon from "@mui/icons-material/Close";
|
|
8079
8099
|
import EditIcon from "@mui/icons-material/Edit";
|
|
@@ -8112,7 +8132,7 @@ var TableDesktopCell = ({
|
|
|
8112
8132
|
onUpdateEditableCell,
|
|
8113
8133
|
onCellClick
|
|
8114
8134
|
}) => {
|
|
8115
|
-
const cellRef =
|
|
8135
|
+
const cellRef = useRef7(null);
|
|
8116
8136
|
const [isOverflowed, setIsOverflowed] = useState21(false);
|
|
8117
8137
|
const [isCellHovered, setIsCellHovered] = useState21(false);
|
|
8118
8138
|
const [isCellInEditMode, setIsCellInEditMode] = useState21(false);
|