@m4l/components 0.0.9 → 0.0.10
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/DataGrid/formatters/BooleanFormatter/index.d.ts +3 -0
- package/dist/components/DataGrid/formatters/BooleanFormatter/index.js +26 -0
- package/dist/components/DataGrid/formatters/BooleanFormatter/types.d.ts +5 -0
- package/dist/components/DataGrid/formatters/DateFormatter/index.js +33 -0
- package/dist/components/DataGrid/formatters/index.d.ts +2 -0
- package/dist/components/DataGrid/index.js +2 -32
- package/dist/components/ObjectLogs/index.js +2 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/index.js +4 -2
- package/dist/vendor.js +3 -1
- package/package.json +1 -1
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Checkbox } from "@mui/material";
|
|
2
|
+
import { jsx, Fragment } from "react/jsx-runtime";
|
|
3
|
+
function BooleanFormatter(props) {
|
|
4
|
+
const {
|
|
5
|
+
presentationType,
|
|
6
|
+
value
|
|
7
|
+
} = props;
|
|
8
|
+
if (presentationType === "string_yes_no") {
|
|
9
|
+
return /* @__PURE__ */ jsx(Fragment, {
|
|
10
|
+
children: value ? "Yes" : "No"
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
if (presentationType === "string_true_false") {
|
|
14
|
+
return /* @__PURE__ */ jsx(Fragment, {
|
|
15
|
+
children: value ? "True" : "False"
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
return /* @__PURE__ */ jsx(Checkbox, {
|
|
19
|
+
checked: value !== void 0 ? value : false,
|
|
20
|
+
size: "small",
|
|
21
|
+
readOnly: true,
|
|
22
|
+
disableFocusRipple: true,
|
|
23
|
+
disableRipple: true
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
export { BooleanFormatter as B };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { format } from "date-fns";
|
|
2
|
+
import { jsx, Fragment } from "react/jsx-runtime";
|
|
3
|
+
function DateFormatter(props) {
|
|
4
|
+
const {
|
|
5
|
+
presentationType,
|
|
6
|
+
dateTime,
|
|
7
|
+
formatDate
|
|
8
|
+
} = props;
|
|
9
|
+
let finalFormat = formatDate || "yyyy-MM-dd HH:mm:ss";
|
|
10
|
+
let result;
|
|
11
|
+
let resultDate;
|
|
12
|
+
if (presentationType === "date") {
|
|
13
|
+
finalFormat = formatDate || "yyyy-MM-dd";
|
|
14
|
+
} else if (presentationType === "time") {
|
|
15
|
+
finalFormat = formatDate || "HH:mm:ss";
|
|
16
|
+
}
|
|
17
|
+
try {
|
|
18
|
+
if (typeof dateTime === "number") {
|
|
19
|
+
resultDate = new Date(dateTime);
|
|
20
|
+
} else if (typeof dateTime === "string") {
|
|
21
|
+
resultDate = new Date(Date.parse(dateTime));
|
|
22
|
+
} else {
|
|
23
|
+
resultDate = dateTime;
|
|
24
|
+
}
|
|
25
|
+
result = format(resultDate, finalFormat);
|
|
26
|
+
} catch (e) {
|
|
27
|
+
result = "err_typing";
|
|
28
|
+
}
|
|
29
|
+
return /* @__PURE__ */ jsx(Fragment, {
|
|
30
|
+
children: result
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
export { DateFormatter as D };
|
|
@@ -11,8 +11,8 @@ import { P as Pager, g as getPagerComponentsDictionary, d as defaultPagerDiction
|
|
|
11
11
|
import { I as IconButton } from "../mui_extended/IconButton/index.js";
|
|
12
12
|
import { u as useModal } from "../../hooks/useModal/index.js";
|
|
13
13
|
import { u as useResponsiveDesktop } from "../../vendor.js";
|
|
14
|
+
import "date-fns";
|
|
14
15
|
import { g as getModalDialogComponentsDictionary, d as defaultModalDialogDictionary } from "../ModalDialog/index.js";
|
|
15
|
-
import { format } from "date-fns";
|
|
16
16
|
const WrapperGrid$1 = styled("div")(() => ({
|
|
17
17
|
display: "flex",
|
|
18
18
|
flexDirection: "column",
|
|
@@ -1617,39 +1617,9 @@ function getGridComponentsDictionary() {
|
|
|
1617
1617
|
...defaultPagerDictionary,
|
|
1618
1618
|
...defaultModalDialogDictionary
|
|
1619
1619
|
});
|
|
1620
|
-
function DateFormatter(props) {
|
|
1621
|
-
const {
|
|
1622
|
-
presentationType,
|
|
1623
|
-
dateTime,
|
|
1624
|
-
formatDate
|
|
1625
|
-
} = props;
|
|
1626
|
-
let finalFormat = formatDate || "yyyy-MM-dd HH:mm:ss";
|
|
1627
|
-
let result;
|
|
1628
|
-
let resultDate;
|
|
1629
|
-
if (presentationType === "date") {
|
|
1630
|
-
finalFormat = formatDate || "yyyy-MM-dd";
|
|
1631
|
-
} else if (presentationType === "time") {
|
|
1632
|
-
finalFormat = formatDate || "HH:mm:ss";
|
|
1633
|
-
}
|
|
1634
|
-
try {
|
|
1635
|
-
if (typeof dateTime === "number") {
|
|
1636
|
-
resultDate = new Date(dateTime);
|
|
1637
|
-
} else if (typeof dateTime === "string") {
|
|
1638
|
-
resultDate = new Date(Date.parse(dateTime));
|
|
1639
|
-
} else {
|
|
1640
|
-
resultDate = dateTime;
|
|
1641
|
-
}
|
|
1642
|
-
result = format(resultDate, finalFormat);
|
|
1643
|
-
} catch (e) {
|
|
1644
|
-
result = "err_typing";
|
|
1645
|
-
}
|
|
1646
|
-
return /* @__PURE__ */ jsx(Fragment, {
|
|
1647
|
-
children: result
|
|
1648
|
-
});
|
|
1649
|
-
}
|
|
1650
1620
|
const initialPagerState = {
|
|
1651
1621
|
page: 0,
|
|
1652
1622
|
rowsPerPage: 25,
|
|
1653
1623
|
totalRecords: 0
|
|
1654
1624
|
};
|
|
1655
|
-
export {
|
|
1625
|
+
export { DataGrid as D, getGridComponentsDictionary as g, initialPagerState as i };
|
|
@@ -5,8 +5,9 @@ import { LocalizationProvider, DateTimePicker } from "@mui/x-date-pickers";
|
|
|
5
5
|
import AdapterDateFns from "@mui/lab/AdapterDateFns";
|
|
6
6
|
import { styled, useTheme } from "@mui/material/styles";
|
|
7
7
|
import { startOfMonth, endOfDay } from "date-fns";
|
|
8
|
-
import { D as
|
|
8
|
+
import { D as DataGrid } from "../DataGrid/index.js";
|
|
9
9
|
import { I as IconButton$1 } from "../mui_extended/IconButton/index.js";
|
|
10
|
+
import { D as DateFormatter } from "../DataGrid/formatters/DateFormatter/index.js";
|
|
10
11
|
import { R as ReactJson } from "../../react-json-view.js";
|
|
11
12
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
12
13
|
import { u as useModal } from "../../hooks/useModal/index.js";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { DataGrid } from '../components/DataGrid';
|
|
2
|
+
export { DateFormatter, BooleanFormatter } from '../components/DataGrid/formatters';
|
|
2
3
|
export type { Column } from 'react-data-grid';
|
|
3
4
|
export type { RowKey } from '../components/DataGrid/types';
|
|
4
5
|
export { getGridComponentsDictionary } from '../components/DataGrid/dictionary';
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { D as DataGrid, g as getGridComponentsDictionary } from "./components/DataGrid/index.js";
|
|
2
|
+
export { B as BooleanFormatter } from "./components/DataGrid/formatters/BooleanFormatter/index.js";
|
|
3
|
+
export { D as DateFormatter } from "./components/DataGrid/formatters/DateFormatter/index.js";
|
|
2
4
|
export { F as FormActions, d as defaultActionsDictionary, g as getActionnsComponentsDictionary } from "./components/FormActions/index.js";
|
|
3
5
|
export { F as FormProvider } from "./components/hook-form/FormProvider/index.js";
|
|
4
6
|
export { R as RHFAutocompleteAsync } from "./components/hook-form/RHFAutocompleteAsync/index.js";
|
|
@@ -38,12 +40,12 @@ import "@mui/material/useMediaQuery";
|
|
|
38
40
|
import "react-hook-form";
|
|
39
41
|
import "react-router-dom";
|
|
40
42
|
import "@mui/lab";
|
|
43
|
+
import "date-fns";
|
|
41
44
|
import "./react-draggable.js";
|
|
42
45
|
import "prop-types";
|
|
43
46
|
import "react-dom";
|
|
44
47
|
import "@mui/x-date-pickers";
|
|
45
48
|
import "@mui/lab/AdapterDateFns";
|
|
46
|
-
import "date-fns";
|
|
47
49
|
import "./react-json-view.js";
|
|
48
50
|
import "./commonjs.js";
|
|
49
51
|
import "./react-splitter-layout.js";
|
package/dist/vendor.js
CHANGED
|
@@ -19,6 +19,7 @@ import "./components/mui_extended/Pager/index.js";
|
|
|
19
19
|
import "./components/mui_extended/Tab/index.js";
|
|
20
20
|
import "react-dnd";
|
|
21
21
|
import "react-dnd-html5-backend";
|
|
22
|
+
import "date-fns";
|
|
22
23
|
import "./components/FormActions/index.js";
|
|
23
24
|
import "./react-draggable.js";
|
|
24
25
|
import "./components/ModalDialog/index.js";
|
|
@@ -26,13 +27,14 @@ import "./components/Resizeable/index.js";
|
|
|
26
27
|
import "./components/NoItemSelected/index.js";
|
|
27
28
|
import "@mui/x-date-pickers";
|
|
28
29
|
import "@mui/lab/AdapterDateFns";
|
|
29
|
-
import "date-fns";
|
|
30
30
|
import "./components/ObjectLogs/index.js";
|
|
31
31
|
import "./react-json-view.js";
|
|
32
32
|
import "./components/PropertyValue/index.js";
|
|
33
33
|
import "./components/ScrollBar/index.js";
|
|
34
34
|
import "./react-splitter-layout.js";
|
|
35
35
|
import "./components/SplitLayout/index.js";
|
|
36
|
+
import "./components/DataGrid/formatters/BooleanFormatter/index.js";
|
|
37
|
+
import "./components/DataGrid/formatters/DateFormatter/index.js";
|
|
36
38
|
import "./components/hook-form/RHFMultiCheckbox/index.js";
|
|
37
39
|
import "./components/hook-form/RHFSelect.js";
|
|
38
40
|
import "./components/hook-form/RHFRadioGroup.js";
|