@m4l/components 0.0.37 → 0.0.38
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/index.js +0 -1
- package/dist/components/ObjectLogs/index.js +7 -4
- package/dist/components/{DataGrid/formatters → formatters}/BooleanFormatter/index.d.ts +0 -0
- package/dist/components/formatters/BooleanFormatter/index.js +32 -0
- package/dist/components/{DataGrid/formatters → formatters}/BooleanFormatter/types.d.ts +2 -0
- package/dist/components/{DataGrid/formatters → formatters}/DateFormatter/index.d.ts +0 -0
- package/dist/components/formatters/DateFormatter/index.js +55 -0
- package/dist/components/{DataGrid/formatters → formatters}/DateFormatter/types.d.ts +4 -2
- package/dist/components/{DataGrid/formatters → formatters}/index.d.ts +0 -0
- package/dist/components/formatters/types.d.ts +2 -0
- package/dist/components/index.d.ts +1 -1
- package/dist/index.js +3 -3
- package/dist/vendor.js +3 -3
- package/package.json +2 -2
- package/dist/components/DataGrid/formatters/BooleanFormatter/index.js +0 -26
- package/dist/components/DataGrid/formatters/DateFormatter/index.js +0 -33
|
@@ -11,7 +11,6 @@ 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 { useResponsiveDesktop } from "@m4l/graphics";
|
|
14
|
-
import "date-fns";
|
|
15
14
|
import { g as getModalDialogComponentsDictionary, d as defaultModalDialogDictionary } from "../ModalDialog/index.js";
|
|
16
15
|
const WrapperGrid$1 = styled("div")(() => ({
|
|
17
16
|
display: "flex",
|
|
@@ -2,7 +2,7 @@ import { useState, useEffect, useCallback, useMemo } from "react";
|
|
|
2
2
|
import { useNetwork, useModuleDictionary, useEnvironment, usePaginate } from "@m4l/core";
|
|
3
3
|
import { styled } from "@mui/material/styles";
|
|
4
4
|
import { D as DataGrid } from "../DataGrid/index.js";
|
|
5
|
-
import { D as DateFormatter } from "../
|
|
5
|
+
import { D as DateFormatter } from "../formatters/DateFormatter/index.js";
|
|
6
6
|
import { Tooltip, IconButton } from "@mui/material";
|
|
7
7
|
import { R as ReactJson } from "../../react-json-view.js";
|
|
8
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -79,6 +79,10 @@ function DetailDialog(props) {
|
|
|
79
79
|
return /* @__PURE__ */ jsx(Container, {
|
|
80
80
|
id: "objectLogsDetail",
|
|
81
81
|
children: /* @__PURE__ */ jsx(ReactJson, {
|
|
82
|
+
name: null,
|
|
83
|
+
sortKeys: true,
|
|
84
|
+
displayDataTypes: false,
|
|
85
|
+
quotesOnKeys: false,
|
|
82
86
|
src: detail
|
|
83
87
|
})
|
|
84
88
|
});
|
|
@@ -125,7 +129,6 @@ function ObjectLogs(props) {
|
|
|
125
129
|
const {
|
|
126
130
|
getLabel
|
|
127
131
|
} = useModuleDictionary();
|
|
128
|
-
useEnvironment();
|
|
129
132
|
const {
|
|
130
133
|
resource_id,
|
|
131
134
|
object_id
|
|
@@ -136,7 +139,7 @@ function ObjectLogs(props) {
|
|
|
136
139
|
});
|
|
137
140
|
const dateFormatterCreatedAt = useCallback((rowProps) => /* @__PURE__ */ jsx(DateFormatter, {
|
|
138
141
|
presentationType: "datetime",
|
|
139
|
-
|
|
142
|
+
value: rowProps.row.created_at
|
|
140
143
|
}), []);
|
|
141
144
|
const DetailRowFormatter = useCallback((rowProps) => /* @__PURE__ */ jsx(DetailFormatter, {
|
|
142
145
|
log_id: rowProps.row.id
|
|
@@ -190,7 +193,7 @@ function ObjectLogs(props) {
|
|
|
190
193
|
object_id,
|
|
191
194
|
f: rawFilters
|
|
192
195
|
});
|
|
193
|
-
console.log("filter was change*****", JSON.stringify(rawFilters));
|
|
196
|
+
console.log("filter was change*****", resource_id, object_id, JSON.stringify(rawFilters));
|
|
194
197
|
};
|
|
195
198
|
return /* @__PURE__ */ jsxs(Container$1, {
|
|
196
199
|
children: [/* @__PURE__ */ jsx(Actions, {
|
|
File without changes
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import require$$0 from "react";
|
|
2
|
+
import { useModuleDictionary } from "@m4l/core";
|
|
3
|
+
import { Checkbox } from "@mui/material";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
function BooleanFormatter(props) {
|
|
6
|
+
const {
|
|
7
|
+
presentationType,
|
|
8
|
+
value,
|
|
9
|
+
Component = require$$0.Fragment
|
|
10
|
+
} = props;
|
|
11
|
+
const {
|
|
12
|
+
getLabel
|
|
13
|
+
} = useModuleDictionary();
|
|
14
|
+
if (presentationType === "string_yes_no") {
|
|
15
|
+
return /* @__PURE__ */ jsx(Component, {
|
|
16
|
+
children: value ? getLabel("formatters.boolean_yes") : getLabel("formatters.boolean_no")
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
if (presentationType === "string_true_false") {
|
|
20
|
+
return /* @__PURE__ */ jsx(Component, {
|
|
21
|
+
children: value ? getLabel("formatters.boolean_true") : getLabel("formatters.boolean_false")
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
return /* @__PURE__ */ jsx(Checkbox, {
|
|
25
|
+
checked: value !== void 0 ? value : false,
|
|
26
|
+
size: "small",
|
|
27
|
+
readOnly: true,
|
|
28
|
+
disableFocusRipple: true,
|
|
29
|
+
disableRipple: true
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
export { BooleanFormatter as B };
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { ComponentForrmaterType } from '../types';
|
|
1
2
|
export declare type PresentationType = 'string_yes_no' | 'string_true_false' | 'check';
|
|
2
3
|
export interface BooleanFormatterProps {
|
|
4
|
+
Component?: ComponentForrmaterType;
|
|
3
5
|
presentationType: PresentationType;
|
|
4
6
|
value: boolean;
|
|
5
7
|
}
|
|
File without changes
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { useEnvironment } from "@m4l/core";
|
|
2
|
+
import { format } from "date-fns";
|
|
3
|
+
import require$$0 from "react";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
function DateFormatter(props) {
|
|
6
|
+
const {
|
|
7
|
+
presentationType,
|
|
8
|
+
value,
|
|
9
|
+
format: format$1,
|
|
10
|
+
Component = require$$0.Fragment
|
|
11
|
+
} = props;
|
|
12
|
+
const {
|
|
13
|
+
dfnsFormat
|
|
14
|
+
} = useEnvironment();
|
|
15
|
+
let finalFormat = format$1 || dfnsFormat.datetime_format;
|
|
16
|
+
let result;
|
|
17
|
+
let resultDate;
|
|
18
|
+
switch (presentationType) {
|
|
19
|
+
case "datetime":
|
|
20
|
+
finalFormat = format$1 || dfnsFormat.datetime_format;
|
|
21
|
+
break;
|
|
22
|
+
case "date":
|
|
23
|
+
finalFormat = format$1 || dfnsFormat.date_format;
|
|
24
|
+
break;
|
|
25
|
+
case "time":
|
|
26
|
+
finalFormat = format$1 || dfnsFormat.time_format;
|
|
27
|
+
break;
|
|
28
|
+
}
|
|
29
|
+
try {
|
|
30
|
+
if (typeof value === "number" || typeof value === "string") {
|
|
31
|
+
resultDate = new Date(value);
|
|
32
|
+
} else {
|
|
33
|
+
resultDate = value;
|
|
34
|
+
}
|
|
35
|
+
result = format(resultDate, finalFormat);
|
|
36
|
+
} catch (e) {
|
|
37
|
+
result = "err_typing";
|
|
38
|
+
}
|
|
39
|
+
switch (Component) {
|
|
40
|
+
case "div":
|
|
41
|
+
return /* @__PURE__ */ jsx("div", {
|
|
42
|
+
className: "DateFormatter",
|
|
43
|
+
children: result
|
|
44
|
+
});
|
|
45
|
+
case "span":
|
|
46
|
+
return /* @__PURE__ */ jsx("span", {
|
|
47
|
+
className: "DateFormatter",
|
|
48
|
+
children: result
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
return /* @__PURE__ */ jsx(Component, {
|
|
52
|
+
children: result
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
export { DateFormatter as D };
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { ComponentForrmaterType } from '../types';
|
|
1
2
|
export declare type PresentationType = 'date' | 'datetime' | 'time';
|
|
2
3
|
export interface DateFormatterProps {
|
|
4
|
+
Component?: ComponentForrmaterType;
|
|
3
5
|
presentationType: PresentationType;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
+
format?: string;
|
|
7
|
+
value: Date | string | number;
|
|
6
8
|
}
|
|
File without changes
|
|
@@ -2,8 +2,8 @@ export * from '../components/animate';
|
|
|
2
2
|
export * from '../components/hook-form';
|
|
3
3
|
export * from '../components/mui_extended';
|
|
4
4
|
export * from '../components/CompanyLogo';
|
|
5
|
+
export * from './formatters';
|
|
5
6
|
export { DataGrid } from '../components/DataGrid';
|
|
6
|
-
export { DateFormatter, BooleanFormatter } from '../components/DataGrid/formatters';
|
|
7
7
|
export type { Column } from 'react-data-grid';
|
|
8
8
|
export type { RowKey } from '../components/DataGrid/types';
|
|
9
9
|
export { getGridComponentsDictionary } from '../components/DataGrid/dictionary';
|
package/dist/index.js
CHANGED
|
@@ -26,9 +26,9 @@ export { P as Pager, g as getPagerComponentsDictionary } from "./components/mui_
|
|
|
26
26
|
export { T as Tab } from "./components/mui_extended/Tab/index.js";
|
|
27
27
|
export { T as Typography } from "./components/mui_extended/Typography/index.js";
|
|
28
28
|
export { C as CompanyLogo } from "./components/CompanyLogo/index.js";
|
|
29
|
+
export { B as BooleanFormatter } from "./components/formatters/BooleanFormatter/index.js";
|
|
30
|
+
export { D as DateFormatter } from "./components/formatters/DateFormatter/index.js";
|
|
29
31
|
export { D as DataGrid, g as getGridComponentsDictionary } from "./components/DataGrid/index.js";
|
|
30
|
-
export { B as BooleanFormatter } from "./components/DataGrid/formatters/BooleanFormatter/index.js";
|
|
31
|
-
export { D as DateFormatter } from "./components/DataGrid/formatters/DateFormatter/index.js";
|
|
32
32
|
export { D as DynamicFilter } from "./components/DynamicFilter/index.js";
|
|
33
33
|
export { F as FormActions, d as defaultActionsDictionary, g as getActionnsComponentsDictionary } from "./components/FormActions/index.js";
|
|
34
34
|
export { I as Icon } from "./components/Icon/index.js";
|
|
@@ -62,10 +62,10 @@ import "./commonjs.js";
|
|
|
62
62
|
import "react-dom";
|
|
63
63
|
import "clsx";
|
|
64
64
|
import "./react-lazy-load-image-component.js";
|
|
65
|
+
import "date-fns";
|
|
65
66
|
import "@m4l/graphics";
|
|
66
67
|
import "react-dnd";
|
|
67
68
|
import "react-dnd-html5-backend";
|
|
68
|
-
import "date-fns";
|
|
69
69
|
import "./simplebar.js";
|
|
70
70
|
import "./core-js.js";
|
|
71
71
|
import "./juggle.js";
|
package/dist/vendor.js
CHANGED
|
@@ -25,12 +25,12 @@ import "./components/mui_extended/MenuPopover/index.js";
|
|
|
25
25
|
import "./components/mui_extended/MenuActions/index.js";
|
|
26
26
|
import "./components/mui_extended/Pager/index.js";
|
|
27
27
|
import "./components/mui_extended/Tab/index.js";
|
|
28
|
+
import "date-fns";
|
|
28
29
|
import "@m4l/graphics";
|
|
29
30
|
import "./components/CompanyLogo/index.js";
|
|
30
31
|
import "./components/DataGrid/index.js";
|
|
31
32
|
import "react-dnd";
|
|
32
33
|
import "react-dnd-html5-backend";
|
|
33
|
-
import "date-fns";
|
|
34
34
|
import "./components/ScrollBar/index.js";
|
|
35
35
|
import "./components/DynamicFilter/index.js";
|
|
36
36
|
import "./simplebar.js";
|
|
@@ -60,8 +60,8 @@ import "./components/mui_extended/BoxIcon/index.js";
|
|
|
60
60
|
import "./components/mui_extended/Breadcrumbs/index.js";
|
|
61
61
|
import "./components/mui_extended/LinkWithRoute/index.js";
|
|
62
62
|
import "./components/mui_extended/Typography/index.js";
|
|
63
|
-
import "./components/
|
|
64
|
-
import "./components/
|
|
63
|
+
import "./components/formatters/BooleanFormatter/index.js";
|
|
64
|
+
import "./components/formatters/DateFormatter/index.js";
|
|
65
65
|
import "./components/LanguagePopover/index.js";
|
|
66
66
|
import "./components/Loadable/index.js";
|
|
67
67
|
import "./hooks/useModal/index.js";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@m4l/components",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.38",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"dev": "vite",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"format": "npm run prettier:fix && npm run lint:fix"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@m4l/graphics": "^0.0.
|
|
17
|
+
"@m4l/graphics": "^0.0.30",
|
|
18
18
|
"react": "^17.0.0 || 18.x",
|
|
19
19
|
"react-dom": "^18.0.0",
|
|
20
20
|
"react-draggable": "^4.4.5"
|
|
@@ -1,26 +0,0 @@
|
|
|
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 };
|
|
@@ -1,33 +0,0 @@
|
|
|
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 };
|