@natoora-libs/core 0.1.16-dev-doug-6 → 0.1.16-dev-doug-8
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.cjs +100 -76
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.js +102 -78
- package/dist/components/index.js.map +1 -1
- package/package.json +1 -1
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, useMemo as useMemo4 } 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 = ({
|
|
@@ -7818,14 +7834,18 @@ var TableDesktopNumericField = ({
|
|
|
7818
7834
|
field,
|
|
7819
7835
|
variant = "standard",
|
|
7820
7836
|
size,
|
|
7837
|
+
validateInput,
|
|
7821
7838
|
onUpdateEditableCell
|
|
7822
7839
|
}) => {
|
|
7823
7840
|
const [input, setInput] = useState18(initialValue);
|
|
7841
|
+
const oldValue = useRef5(initialValue);
|
|
7842
|
+
const isDirty = useMemo4(() => input !== oldValue.current, [input, oldValue.current]);
|
|
7843
|
+
const hasValidationError = useMemo4(() => isDirty && !validateInput?.(input), [input, validateInput, isDirty]);
|
|
7824
7844
|
const commitValue = (value) => {
|
|
7825
|
-
|
|
7826
|
-
if (!onUpdateEditableCell || !isDirty) {
|
|
7845
|
+
if (hasValidationError || !onUpdateEditableCell || !isDirty) {
|
|
7827
7846
|
return;
|
|
7828
7847
|
}
|
|
7848
|
+
oldValue.current = value;
|
|
7829
7849
|
onUpdateEditableCell(rowId ?? 0, field, value, value);
|
|
7830
7850
|
};
|
|
7831
7851
|
const handleKeyDown = (e) => {
|
|
@@ -7843,6 +7863,7 @@ var TableDesktopNumericField = ({
|
|
|
7843
7863
|
value: input,
|
|
7844
7864
|
disabled,
|
|
7845
7865
|
label: inputLabel,
|
|
7866
|
+
error: hasValidationError,
|
|
7846
7867
|
onKeyDown: handleKeyDown,
|
|
7847
7868
|
onChange: (e) => {
|
|
7848
7869
|
e.target.value = e.target.value.replace(/\D/g, "");
|
|
@@ -7934,7 +7955,7 @@ var TableDesktopSmartSelect = memo22(({
|
|
|
7934
7955
|
});
|
|
7935
7956
|
|
|
7936
7957
|
// src/components/TableDesktopEditableComponent/TableDesktopTextField.tsx
|
|
7937
|
-
import { useMemo as
|
|
7958
|
+
import { useMemo as useMemo5, useState as useState20, useRef as useRef6 } from "react";
|
|
7938
7959
|
import { TextField as TextField9 } from "@mui/material";
|
|
7939
7960
|
import { jsx as jsx122 } from "react/jsx-runtime";
|
|
7940
7961
|
var TableDesktopTextField = ({
|
|
@@ -7949,12 +7970,14 @@ var TableDesktopTextField = ({
|
|
|
7949
7970
|
onUpdateEditableCell
|
|
7950
7971
|
}) => {
|
|
7951
7972
|
const [input, setInput] = useState20(initialValue);
|
|
7952
|
-
const
|
|
7973
|
+
const oldValue = useRef6(initialValue);
|
|
7974
|
+
const isDirty = useMemo5(() => input !== oldValue.current, [input, oldValue.current]);
|
|
7975
|
+
const hasValidationError = useMemo5(() => isDirty && !validateInput?.(input), [input, validateInput]);
|
|
7953
7976
|
const commitValue = (value) => {
|
|
7954
|
-
const isDirty = value !== initialValue;
|
|
7955
7977
|
if (hasValidationError || !onUpdateEditableCell || !isDirty) {
|
|
7956
7978
|
return;
|
|
7957
7979
|
}
|
|
7980
|
+
oldValue.current = value;
|
|
7958
7981
|
onUpdateEditableCell(rowId ?? 0, field, value, value);
|
|
7959
7982
|
};
|
|
7960
7983
|
const handleKeyDown = (e) => {
|
|
@@ -8065,6 +8088,7 @@ var TableDesktopEditableComponent = ({
|
|
|
8065
8088
|
field,
|
|
8066
8089
|
initialValue: editInitialValue ?? "",
|
|
8067
8090
|
inputLabel: inputLabel ?? "",
|
|
8091
|
+
validateInput,
|
|
8068
8092
|
onUpdateEditableCell
|
|
8069
8093
|
}
|
|
8070
8094
|
)
|
|
@@ -8073,7 +8097,7 @@ var TableDesktopEditableComponent = ({
|
|
|
8073
8097
|
};
|
|
8074
8098
|
|
|
8075
8099
|
// src/components/TableDesktopCell/TableDesktopCell.tsx
|
|
8076
|
-
import { useEffect as useEffect13, useRef as
|
|
8100
|
+
import { useEffect as useEffect13, useRef as useRef7, useState as useState21 } from "react";
|
|
8077
8101
|
import CheckIcon2 from "@mui/icons-material/Check";
|
|
8078
8102
|
import CloseIcon from "@mui/icons-material/Close";
|
|
8079
8103
|
import EditIcon from "@mui/icons-material/Edit";
|
|
@@ -8112,7 +8136,7 @@ var TableDesktopCell = ({
|
|
|
8112
8136
|
onUpdateEditableCell,
|
|
8113
8137
|
onCellClick
|
|
8114
8138
|
}) => {
|
|
8115
|
-
const cellRef =
|
|
8139
|
+
const cellRef = useRef7(null);
|
|
8116
8140
|
const [isOverflowed, setIsOverflowed] = useState21(false);
|
|
8117
8141
|
const [isCellHovered, setIsCellHovered] = useState21(false);
|
|
8118
8142
|
const [isCellInEditMode, setIsCellInEditMode] = useState21(false);
|