@m4l/components 0.1.26 → 0.1.28
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/assets/Logo/index.228dcb5a.js +42 -35
- package/commonjs.565e6834.js +5 -5
- package/components/CommonActions/components/ActionCancel/index.e498eeb2.js +17 -0
- package/components/CommonActions/components/ActionFormCancel/index.4ff0ad73.js +64 -0
- package/components/CommonActions/components/ActionFormIntro/index.ca4d2674.js +28 -22
- package/components/CommonActions/components/ActionIntro/index.60ef7bd7.js +18 -0
- package/components/CommonActions/components/Actions/index.0645e30f.js +867 -0
- package/components/DataGrid/index.76d8fd25.js +1075 -0
- package/components/DynamicFilter/index.342ba5fe.js +1577 -0
- package/components/ErrorLabel/index.c8615f16.js +13 -12
- package/components/Icon/index.619c31c4.js +96 -0
- package/components/Icon/types.d.ts +2 -1
- package/components/Image/index.93d5f37f.js +190 -0
- package/components/Loadable/index.f5518558.js +8 -8
- package/components/ModalDialog/index.9ea10764.js +184 -0
- package/components/NoItemSelected/{index.9609a7f7.js → index.46d2f632.js} +52 -41
- package/components/ObjectLogs/index.f941fb79.js +288 -0
- package/components/Page/index.4237c241.js +22 -20
- package/components/PaperForm/index.ec9cb8c9.js +112 -0
- package/components/Period/index.2941fbda.js +249 -0
- package/components/PropertyValue/index.dfcfe1ba.js +147 -0
- package/components/PropertyValue/styles.d.ts +2 -1
- package/components/PropertyValue/types.d.ts +3 -3
- package/components/Resizeable/index.45995d2b.js +19 -19
- package/components/ScrollBar/index.39eeb2de.js +26 -21
- package/components/ScrollToTop/index.e06f98f6.js +8 -7
- package/components/SplitLayout/index.4032673d.js +35 -33
- package/components/animate/LoadingScreen/index.1d0c4307.js +33 -33
- package/components/animate/MotionContainer/index.8d9f9d80.js +25 -22
- package/components/animate/MotionLazyContainer/index.572dd012.js +10 -10
- package/components/animate/features.0fbf41e1.js +3 -3
- package/components/animate/variants/bounce.784aaaaa.js +16 -13
- package/components/animate/variants/container.11f82b76.js +8 -6
- package/components/animate/variants/fade.b561c0fc.js +32 -28
- package/components/animate/variants/transition.bd46b9ce.js +17 -12
- package/components/formatters/BooleanFormatter/index.8da35c9c.js +55 -0
- package/components/formatters/DateFormatter/index.1b9baacc.js +69 -0
- package/components/formatters/index.689a8086.js +119 -0
- package/components/hook-form/RHFAutocomplete/index.59a68f9f.js +224 -0
- package/components/hook-form/RHFAutocompleteAsync/index.c3083062.js +87 -0
- package/components/hook-form/RHFCheckbox/index.6dcec9e2.js +49 -39
- package/components/hook-form/RHFDateTime/index.9231a7c7.js +69 -56
- package/components/hook-form/RHFMultiCheckbox/index.2680b3b6.js +23 -23
- package/components/hook-form/RHFPeriod/index.64a228d5.js +55 -0
- package/components/hook-form/RHFRadioGroup/index.b3335e13.js +29 -29
- package/components/hook-form/RHFSelect/index.b6ca8bb2.js +24 -24
- package/components/hook-form/RHFTextField/index.f9aaaa90.js +146 -0
- package/components/hook-form/RHFUpload/RHFUploadImage/{components → subcomponents}/UploadImage/index.d.ts +0 -0
- package/components/hook-form/RHFUpload/RHFUploadImage/{components → subcomponents}/UploadImage/styles.d.ts +4 -3
- package/components/hook-form/RHFUpload/RHFUploadImage/{components → subcomponents}/UploadImage/subcomponents/Skeleton/index.d.ts +0 -0
- package/components/hook-form/RHFUpload/RHFUploadImage/{components → subcomponents}/UploadImage/subcomponents/Skeleton/styles.d.ts +0 -0
- package/components/hook-form/RHFUpload/RHFUploadImage/{components → subcomponents}/UploadImage/types.d.ts +0 -0
- package/components/hook-form/RHFUpload/index.d5cc7c13.js +285 -0
- package/components/mui_extended/Accordion/index.a02ac6ae.js +107 -0
- package/components/mui_extended/Avatar/index.fe06afd7.js +51 -0
- package/components/mui_extended/BoxIcon/index.e638ecc8.js +10 -10
- package/components/mui_extended/Breadcrumbs/index.5e37d903.js +49 -44
- package/components/mui_extended/Button/index.53b56958.js +178 -0
- package/components/mui_extended/CircularProgress/index.ad569afd.js +8 -6
- package/components/mui_extended/IconButton/index.a321e5cb.js +120 -0
- package/components/mui_extended/IconButton/index.d.ts +1 -1
- package/components/mui_extended/LinkWithRoute/index.16436ab8.js +25 -21
- package/components/mui_extended/Pager/index.c0865b70.js +141 -0
- package/components/mui_extended/Popover/index.705275a4.js +278 -0
- package/components/mui_extended/Tab/index.e0653a0a.js +25 -21
- package/components/mui_extended/Typography/index.e5494696.js +25 -21
- package/contexts/ModalContext/index.b92fa565.js +153 -0
- package/contexts/ModalContext/{components → subcomponents}/ContentConfirm/index.d.ts +0 -0
- package/contexts/ModalContext/{components → subcomponents}/ContentConfirm/styles.d.ts +0 -0
- package/contexts/ModalContext/{components → subcomponents}/ContentConfirm/types.d.ts +0 -0
- package/contexts/RHFormContext/index.b142190a.js +63 -0
- package/hooks/useFormAddEdit/index.d4845f1a.js +40 -22
- package/hooks/useModal/index.5fee01a3.js +11 -0
- package/index.js +153 -153
- package/package.json +2 -1
- package/react-data-grid.d46d625e.js +2206 -1663
- package/react-draggable.20e95c61.js +800 -553
- package/react-json-view.f56a7f8e.js +2344 -2340
- package/react-resizable.5277deaf.js +470 -298
- package/react-splitter-layout.7810ac1b.js +130 -128
- package/utils/index.214d9542.js +500 -354
- package/components/CommonActions/components/ActionCancel/index.6736b782.js +0 -17
- package/components/CommonActions/components/ActionFormCancel/index.281ee166.js +0 -49
- package/components/CommonActions/components/ActionIntro/index.4665a611.js +0 -18
- package/components/CommonActions/components/Actions/index.cd7b2671.js +0 -742
- package/components/DataGrid/index.2caf6231.js +0 -894
- package/components/DynamicFilter/index.f2377369.js +0 -1157
- package/components/Icon/index.f569765b.js +0 -82
- package/components/Image/index.c9da2d5a.js +0 -152
- package/components/ModalDialog/index.bee344a5.js +0 -168
- package/components/ObjectLogs/index.6b6f95e6.js +0 -266
- package/components/PaperForm/index.3f8c7ef2.js +0 -105
- package/components/Period/index.a112ce37.js +0 -175
- package/components/PropertyValue/index.ab3dd7e9.js +0 -116
- package/components/contexts/RHFormContext/index.33dba822.js +0 -56
- package/components/formatters/BooleanFormatter/index.3ec56305.js +0 -42
- package/components/formatters/DateFormatter/index.08d8823b.js +0 -57
- package/components/formatters/index.6959c2de.js +0 -106
- package/components/hook-form/RHFAutocomplete/index.5eee9d7c.js +0 -174
- package/components/hook-form/RHFAutocompleteAsync/index.757b5080.js +0 -65
- package/components/hook-form/RHFPeriod/index.979d0898.js +0 -51
- package/components/hook-form/RHFTextField/index.ba2a8f67.js +0 -129
- package/components/hook-form/RHFUpload/index.6347159a.js +0 -258
- package/components/mui_extended/Accordion/index.49f5df8e.js +0 -103
- package/components/mui_extended/Avatar/index.dadb0528.js +0 -37
- package/components/mui_extended/Button/index.52d18aea.js +0 -144
- package/components/mui_extended/IconButton/index.4b5ce8b5.js +0 -103
- package/components/mui_extended/Pager/index.951b6975.js +0 -126
- package/components/mui_extended/Popover/index.4da8587a.js +0 -252
- package/contexts/ModalContext/index.5388dfd5.js +0 -136
- package/hooks/useModal/index.3b1ff084.js +0 -11
- package/node_modules.168cb897.js +0 -55
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
import { useState, useEffect, useCallback, useMemo } from "react";
|
|
2
|
+
import { useNetwork, useModuleDictionary, useEnvironment, usePaginate } from "@m4l/core";
|
|
3
|
+
import { styled } from "@mui/material/styles";
|
|
4
|
+
import { D as DataGrid, g as getDataGridComponentsDictionary } from "../DataGrid/index.76d8fd25.js";
|
|
5
|
+
import { D as DateFormatter } from "../formatters/DateFormatter/index.1b9baacc.js";
|
|
6
|
+
import { Tooltip, IconButton } from "@mui/material";
|
|
7
|
+
import { R as ReactJson } from "../../react-json-view.f56a7f8e.js";
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
import { u as useModal } from "../../hooks/useModal/index.5fee01a3.js";
|
|
10
|
+
import { I as Icon } from "../Icon/index.619c31c4.js";
|
|
11
|
+
import { D as DynamicFilter, g as getDynamicFilterComponentsDictionary } from "../DynamicFilter/index.342ba5fe.js";
|
|
12
|
+
const Container$1 = styled("div")(() => ({
|
|
13
|
+
height: "100%",
|
|
14
|
+
width: "100%",
|
|
15
|
+
display: "flex",
|
|
16
|
+
flexDirection: "column",
|
|
17
|
+
justifyContent: "flex-start"
|
|
18
|
+
}));
|
|
19
|
+
const Actions = styled("div")(({
|
|
20
|
+
theme
|
|
21
|
+
}) => ({
|
|
22
|
+
position: "relative",
|
|
23
|
+
height: "auto",
|
|
24
|
+
display: "flex",
|
|
25
|
+
flexDirection: "row",
|
|
26
|
+
justifyContent: "flex-start",
|
|
27
|
+
alignItems: "center",
|
|
28
|
+
"& .MuiFormControl-root": {
|
|
29
|
+
flexGrow: 1
|
|
30
|
+
},
|
|
31
|
+
[theme.breakpoints.up("sm")]: {
|
|
32
|
+
"& .MuiFormControl-root:nth-of-type(1)": {
|
|
33
|
+
marginRight: theme.spacing(3)
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}));
|
|
37
|
+
const GridWrapper = styled("div")(() => ({
|
|
38
|
+
position: "relative",
|
|
39
|
+
flexGrow: "1",
|
|
40
|
+
width: "100%"
|
|
41
|
+
}));
|
|
42
|
+
const Container = styled("div")(({ theme }) => ({
|
|
43
|
+
color: theme.palette.text.primary,
|
|
44
|
+
display: "flex",
|
|
45
|
+
flexDirection: "column",
|
|
46
|
+
height: "100%",
|
|
47
|
+
width: "100%"
|
|
48
|
+
}));
|
|
49
|
+
styled("span")(({ theme }) => ({
|
|
50
|
+
color: theme.palette.text.primary,
|
|
51
|
+
display: "flex",
|
|
52
|
+
flexDirection: "column",
|
|
53
|
+
height: "100%",
|
|
54
|
+
width: "100%"
|
|
55
|
+
}));
|
|
56
|
+
function DetailDialog(props) {
|
|
57
|
+
const {
|
|
58
|
+
log_id
|
|
59
|
+
} = props;
|
|
60
|
+
const {
|
|
61
|
+
networkOperation
|
|
62
|
+
} = useNetwork();
|
|
63
|
+
const [detail, setDetail] = useState({});
|
|
64
|
+
useEffect(() => {
|
|
65
|
+
let mounted = true;
|
|
66
|
+
networkOperation({
|
|
67
|
+
method: "GET",
|
|
68
|
+
endPoint: `logs/${log_id}`
|
|
69
|
+
}).then((response) => {
|
|
70
|
+
if (mounted) {
|
|
71
|
+
const parseData = JSON.parse(String(response.data.log_detail));
|
|
72
|
+
setDetail(parseData);
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
return function cleanUp() {
|
|
76
|
+
mounted = false;
|
|
77
|
+
};
|
|
78
|
+
}, []);
|
|
79
|
+
return /* @__PURE__ */ jsx(Container, {
|
|
80
|
+
id: "objectLogsDetail",
|
|
81
|
+
children: /* @__PURE__ */ jsx(ReactJson, {
|
|
82
|
+
name: null,
|
|
83
|
+
sortKeys: true,
|
|
84
|
+
displayDataTypes: false,
|
|
85
|
+
quotesOnKeys: false,
|
|
86
|
+
src: detail
|
|
87
|
+
})
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
function DetailFormatter(props) {
|
|
91
|
+
const {
|
|
92
|
+
log_id
|
|
93
|
+
} = props;
|
|
94
|
+
const {
|
|
95
|
+
openModal,
|
|
96
|
+
closeModal
|
|
97
|
+
} = useModal();
|
|
98
|
+
const {
|
|
99
|
+
getLabel
|
|
100
|
+
} = useModuleDictionary();
|
|
101
|
+
const {
|
|
102
|
+
host_static_assets,
|
|
103
|
+
environment_assets
|
|
104
|
+
} = useEnvironment();
|
|
105
|
+
const onClickDetail = () => {
|
|
106
|
+
openModal({
|
|
107
|
+
onQueryClose: () => closeModal(),
|
|
108
|
+
title: getLabel("object_logs.modal_detail_title"),
|
|
109
|
+
iconComponent: /* @__PURE__ */ jsx(Icon, {
|
|
110
|
+
src: `${host_static_assets}/${environment_assets}/frontend/components/object_logs/assets/icons/search.svg`
|
|
111
|
+
}),
|
|
112
|
+
contentComponent: /* @__PURE__ */ jsx(DetailDialog, {
|
|
113
|
+
log_id
|
|
114
|
+
})
|
|
115
|
+
});
|
|
116
|
+
};
|
|
117
|
+
return /* @__PURE__ */ jsx(Tooltip, {
|
|
118
|
+
title: getLabel("object_logs.view_log_detail"),
|
|
119
|
+
children: /* @__PURE__ */ jsx(IconButton, {
|
|
120
|
+
onClick: onClickDetail,
|
|
121
|
+
"aria-label": "filter",
|
|
122
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
123
|
+
src: `${host_static_assets}/${environment_assets}/frontend/components/object_logs/assets/icons/search.svg`
|
|
124
|
+
})
|
|
125
|
+
})
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
function ObjectLogs(props) {
|
|
129
|
+
const {
|
|
130
|
+
resource_id,
|
|
131
|
+
object_id
|
|
132
|
+
} = props;
|
|
133
|
+
const {
|
|
134
|
+
getLabel
|
|
135
|
+
} = useModuleDictionary();
|
|
136
|
+
const {
|
|
137
|
+
host_static_assets,
|
|
138
|
+
environment_assets
|
|
139
|
+
} = useEnvironment();
|
|
140
|
+
const [queryParams, setQueryParams] = useState({
|
|
141
|
+
resource_id,
|
|
142
|
+
object_id
|
|
143
|
+
});
|
|
144
|
+
const dateFormatterCreatedAt = useCallback((rowProps) => /* @__PURE__ */ jsx(DateFormatter, {
|
|
145
|
+
presentationType: "datetime",
|
|
146
|
+
value: rowProps.row.created_at
|
|
147
|
+
}), []);
|
|
148
|
+
const DetailRowFormatter = useCallback((rowProps) => /* @__PURE__ */ jsx(DetailFormatter, {
|
|
149
|
+
log_id: rowProps.row.id
|
|
150
|
+
}), []);
|
|
151
|
+
const columns = useMemo(() => [{
|
|
152
|
+
key: "created_at",
|
|
153
|
+
name: getLabel("object_logs.created_at"),
|
|
154
|
+
type: "date",
|
|
155
|
+
width: 300,
|
|
156
|
+
formatter: dateFormatterCreatedAt
|
|
157
|
+
}, {
|
|
158
|
+
key: "email",
|
|
159
|
+
name: getLabel("object_logs.email"),
|
|
160
|
+
type: "string",
|
|
161
|
+
width: 300
|
|
162
|
+
}, {
|
|
163
|
+
key: "resource_name",
|
|
164
|
+
name: getLabel("object_logs.resource_name"),
|
|
165
|
+
type: "string"
|
|
166
|
+
}, {
|
|
167
|
+
key: "log_preview",
|
|
168
|
+
name: getLabel("object_logs.log_preview"),
|
|
169
|
+
type: "string"
|
|
170
|
+
}, {
|
|
171
|
+
key: "Detail",
|
|
172
|
+
name: getLabel("object_logs.log_detail"),
|
|
173
|
+
type: "custom",
|
|
174
|
+
formatter: DetailRowFormatter
|
|
175
|
+
}, {
|
|
176
|
+
key: "ip",
|
|
177
|
+
name: getLabel("object_logs.ip"),
|
|
178
|
+
type: "string"
|
|
179
|
+
}], [getLabel]);
|
|
180
|
+
const {
|
|
181
|
+
pagerState,
|
|
182
|
+
rows,
|
|
183
|
+
onPageChange,
|
|
184
|
+
onRowsPerPageChange,
|
|
185
|
+
clearRows,
|
|
186
|
+
Refresh
|
|
187
|
+
} = usePaginate({
|
|
188
|
+
endPoint: "logs",
|
|
189
|
+
fireOnChangeParms: false,
|
|
190
|
+
queryParams
|
|
191
|
+
});
|
|
192
|
+
useEffect(() => {
|
|
193
|
+
clearRows();
|
|
194
|
+
setQueryParams((oldParms) => ({
|
|
195
|
+
...oldParms,
|
|
196
|
+
object_id
|
|
197
|
+
}));
|
|
198
|
+
}, [object_id]);
|
|
199
|
+
const onChangeFilter = (_initFilters, rawFilters) => {
|
|
200
|
+
setQueryParams((oldParms) => ({
|
|
201
|
+
...oldParms,
|
|
202
|
+
f: rawFilters
|
|
203
|
+
}));
|
|
204
|
+
Refresh();
|
|
205
|
+
};
|
|
206
|
+
return /* @__PURE__ */ jsxs(Container$1, {
|
|
207
|
+
children: [/* @__PURE__ */ jsx(Actions, {
|
|
208
|
+
id: "objectLogsActions",
|
|
209
|
+
children: /* @__PURE__ */ jsx(DynamicFilter, {
|
|
210
|
+
withAllField: true,
|
|
211
|
+
onChangeFilter,
|
|
212
|
+
automatic: false,
|
|
213
|
+
fields: [{
|
|
214
|
+
name: "user_logs.created_at",
|
|
215
|
+
label: getLabel("object_logs.created_at"),
|
|
216
|
+
type: "datetime",
|
|
217
|
+
multiple: false,
|
|
218
|
+
presence: "fixed",
|
|
219
|
+
urlIcon: `${host_static_assets}/${environment_assets}/frontend/components/object_logs/assets/icons/email.svg`
|
|
220
|
+
}, {
|
|
221
|
+
name: "users.email",
|
|
222
|
+
label: getLabel("object_logs.email"),
|
|
223
|
+
type: "string",
|
|
224
|
+
multiple: true,
|
|
225
|
+
presence: "optional",
|
|
226
|
+
urlIcon: `${host_static_assets}/${environment_assets}/frontend/components/object_logs/assets/icons/email.svg`
|
|
227
|
+
}, {
|
|
228
|
+
name: "user_logs.log_preview",
|
|
229
|
+
label: getLabel("object_logs.log_preview"),
|
|
230
|
+
type: "string",
|
|
231
|
+
multiple: true,
|
|
232
|
+
presence: "optional",
|
|
233
|
+
urlIcon: `${host_static_assets}/${environment_assets}/frontend/components/object_logs/assets/icons/log_preview.svg`
|
|
234
|
+
}, {
|
|
235
|
+
name: "user_logs.log_detail",
|
|
236
|
+
label: getLabel("object_logs.log_detail"),
|
|
237
|
+
type: "string",
|
|
238
|
+
multiple: true,
|
|
239
|
+
presence: "optional",
|
|
240
|
+
urlIcon: `${host_static_assets}/${environment_assets}/frontend/components/object_logs/assets/icons/log_detail.svg`
|
|
241
|
+
}],
|
|
242
|
+
initialFilters: []
|
|
243
|
+
})
|
|
244
|
+
}), /* @__PURE__ */ jsx(GridWrapper, {
|
|
245
|
+
id: "GridWrapper",
|
|
246
|
+
children: /* @__PURE__ */ jsx(DataGrid, {
|
|
247
|
+
id: "users_logs_list",
|
|
248
|
+
columns,
|
|
249
|
+
rows,
|
|
250
|
+
rowKeyGetter: (row) => row.id,
|
|
251
|
+
isMultipleSelect: false,
|
|
252
|
+
withActions: true,
|
|
253
|
+
actionsProps: {
|
|
254
|
+
withPager: true,
|
|
255
|
+
withLocalFilters: true,
|
|
256
|
+
pagerOptions: {
|
|
257
|
+
records: rows.length,
|
|
258
|
+
totalRecords: pagerState.totalRecords,
|
|
259
|
+
rowsPerPageOptions: [1, 2, 3, 4, 5, 10, 25],
|
|
260
|
+
page: pagerState.page,
|
|
261
|
+
rowsPerPage: pagerState.rowsPerPage,
|
|
262
|
+
onPageChange,
|
|
263
|
+
onRowsPerPageChange
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
}, "users_list_logs")
|
|
267
|
+
})]
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
function getObjectLogsComponentsDictionary() {
|
|
271
|
+
return ["object_logs"].concat(getDataGridComponentsDictionary()).concat(getDynamicFilterComponentsDictionary());
|
|
272
|
+
}
|
|
273
|
+
const defaultObjectLogDictionary = {
|
|
274
|
+
object_logs: {
|
|
275
|
+
created_at: "Start date",
|
|
276
|
+
user: "User/email",
|
|
277
|
+
resource_name: "Resource",
|
|
278
|
+
privilege_name: "Privilege",
|
|
279
|
+
log_preview: "Log",
|
|
280
|
+
log_detail: "Detail",
|
|
281
|
+
ip: "Ip"
|
|
282
|
+
}
|
|
283
|
+
};
|
|
284
|
+
export {
|
|
285
|
+
ObjectLogs as O,
|
|
286
|
+
defaultObjectLogDictionary as d,
|
|
287
|
+
getObjectLogsComponentsDictionary as g
|
|
288
|
+
};
|
|
@@ -1,25 +1,27 @@
|
|
|
1
|
-
import { Helmet
|
|
2
|
-
import { useLocales
|
|
3
|
-
import { useModuleSkeleton
|
|
4
|
-
import { jsxs
|
|
5
|
-
const
|
|
1
|
+
import { Helmet } from "react-helmet-async";
|
|
2
|
+
import { useLocales } from "@m4l/graphics";
|
|
3
|
+
import { useModuleSkeleton } from "@m4l/core";
|
|
4
|
+
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
5
|
+
const HelmetPage = (props) => {
|
|
6
6
|
const {
|
|
7
|
-
children
|
|
8
|
-
title
|
|
9
|
-
meta
|
|
10
|
-
subtitle
|
|
11
|
-
} =
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}),
|
|
19
|
-
|
|
7
|
+
children,
|
|
8
|
+
title,
|
|
9
|
+
meta,
|
|
10
|
+
subtitle
|
|
11
|
+
} = props;
|
|
12
|
+
const localeString = useLocales().currentLocale?.localeString;
|
|
13
|
+
const isSkeleton = useModuleSkeleton();
|
|
14
|
+
return /* @__PURE__ */ jsxs(Fragment, {
|
|
15
|
+
children: [!isSkeleton && /* @__PURE__ */ jsxs(Helmet, {
|
|
16
|
+
children: [/* @__PURE__ */ jsx("title", {
|
|
17
|
+
children: `${title}${subtitle ? ` | ${subtitle}` : ""} `
|
|
18
|
+
}), /* @__PURE__ */ jsx("html", {
|
|
19
|
+
lang: localeString
|
|
20
|
+
}), meta]
|
|
21
|
+
}), children]
|
|
20
22
|
});
|
|
21
23
|
};
|
|
22
|
-
|
|
24
|
+
HelmetPage.displayName = "Page";
|
|
23
25
|
export {
|
|
24
|
-
|
|
26
|
+
HelmetPage as H
|
|
25
27
|
};
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { styled } from "@mui/material/styles";
|
|
2
|
+
import { useModuleSkeleton } from "@m4l/core";
|
|
3
|
+
import { Skeleton } from "@mui/material";
|
|
4
|
+
import { I as Icon } from "../Icon/index.619c31c4.js";
|
|
5
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
6
|
+
const WrapperPaper = styled("div")(({
|
|
7
|
+
theme
|
|
8
|
+
}) => ({
|
|
9
|
+
display: "flex",
|
|
10
|
+
flexDirection: "column",
|
|
11
|
+
padding: theme.spacing(1),
|
|
12
|
+
[theme.breakpoints.up("sm")]: {
|
|
13
|
+
margin: `${theme.spacing(1.5)} ${theme.spacing(1.5)} ${theme.spacing(3)} ${theme.spacing(1.5)}`,
|
|
14
|
+
borderRadius: theme.spacing(2),
|
|
15
|
+
boxShadow: theme.customShadows.z8,
|
|
16
|
+
padding: theme.spacing(3),
|
|
17
|
+
backgroundColor: theme.palette.background.paper
|
|
18
|
+
}
|
|
19
|
+
}));
|
|
20
|
+
const HeaderContainer = styled("div")(({
|
|
21
|
+
theme
|
|
22
|
+
}) => ({
|
|
23
|
+
display: "flex",
|
|
24
|
+
flexDirection: "row",
|
|
25
|
+
alignItems: "center",
|
|
26
|
+
borderBottom: `1px solid ${theme.palette.divider}`,
|
|
27
|
+
paddingBottom: theme.spacing(3),
|
|
28
|
+
marginBottom: theme.spacing(2),
|
|
29
|
+
overflow: "hidden"
|
|
30
|
+
}));
|
|
31
|
+
const IconTitleContainer = styled("div")(({
|
|
32
|
+
theme
|
|
33
|
+
}) => ({
|
|
34
|
+
display: "flex",
|
|
35
|
+
flexDirection: "row",
|
|
36
|
+
flexGrow: 1,
|
|
37
|
+
alignItems: "center",
|
|
38
|
+
cursor: "move",
|
|
39
|
+
...theme.typography.subtitle1,
|
|
40
|
+
color: theme.palette.text.primary
|
|
41
|
+
}));
|
|
42
|
+
const IconHeader = styled("div")(({
|
|
43
|
+
theme
|
|
44
|
+
}) => ({
|
|
45
|
+
display: "flex",
|
|
46
|
+
alignItems: "center",
|
|
47
|
+
justifyContent: "center",
|
|
48
|
+
marginRight: theme.spacing(1.5)
|
|
49
|
+
}));
|
|
50
|
+
const Content = styled("div")(() => ({
|
|
51
|
+
flexGrow: 1,
|
|
52
|
+
position: "relative"
|
|
53
|
+
}));
|
|
54
|
+
const SkTPaperFormHeader = styled("div")(({
|
|
55
|
+
theme
|
|
56
|
+
}) => ({
|
|
57
|
+
width: "auto",
|
|
58
|
+
display: "grid",
|
|
59
|
+
gridTemplateColumns: `${theme.spacing(2)} auto`,
|
|
60
|
+
gridGap: `${theme.spacing(1.5)}`,
|
|
61
|
+
paddingBottom: `${theme.spacing(3)}`,
|
|
62
|
+
borderBottom: `1px solid ${theme.palette.divider}`,
|
|
63
|
+
marginBottom: `${theme.spacing(3)}`
|
|
64
|
+
}));
|
|
65
|
+
const Header = (props) => {
|
|
66
|
+
const {
|
|
67
|
+
urlIcon,
|
|
68
|
+
title
|
|
69
|
+
} = props;
|
|
70
|
+
const isSkeleton = useModuleSkeleton();
|
|
71
|
+
return isSkeleton ? /* @__PURE__ */ jsxs(SkTPaperFormHeader, {
|
|
72
|
+
children: [/* @__PURE__ */ jsx(Skeleton, {
|
|
73
|
+
variant: "circular",
|
|
74
|
+
width: 16,
|
|
75
|
+
height: 16
|
|
76
|
+
}), /* @__PURE__ */ jsx(Skeleton, {
|
|
77
|
+
variant: "text",
|
|
78
|
+
width: 68,
|
|
79
|
+
height: 14
|
|
80
|
+
})]
|
|
81
|
+
}) : /* @__PURE__ */ jsx(HeaderContainer, {
|
|
82
|
+
id: "Header",
|
|
83
|
+
children: /* @__PURE__ */ jsxs(IconTitleContainer, {
|
|
84
|
+
className: "draggable-dialog-title",
|
|
85
|
+
children: [/* @__PURE__ */ jsx(IconHeader, {
|
|
86
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
87
|
+
src: urlIcon
|
|
88
|
+
})
|
|
89
|
+
}), title]
|
|
90
|
+
})
|
|
91
|
+
});
|
|
92
|
+
};
|
|
93
|
+
function PaperForm(props) {
|
|
94
|
+
const {
|
|
95
|
+
urlIcon,
|
|
96
|
+
title,
|
|
97
|
+
children
|
|
98
|
+
} = props;
|
|
99
|
+
return /* @__PURE__ */ jsxs(WrapperPaper, {
|
|
100
|
+
id: "ContainerPropertyValue",
|
|
101
|
+
children: [/* @__PURE__ */ jsx(Header, {
|
|
102
|
+
urlIcon,
|
|
103
|
+
title
|
|
104
|
+
}), /* @__PURE__ */ jsx(Content, {
|
|
105
|
+
id: "Content",
|
|
106
|
+
children
|
|
107
|
+
})]
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
export {
|
|
111
|
+
PaperForm as P
|
|
112
|
+
};
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
import { useModuleDictionary, useModuleSkeleton, useEnvironment } from "@m4l/core";
|
|
2
|
+
import { styled, Skeleton, Autocomplete, TextField } from "@mui/material";
|
|
3
|
+
import { useMemo } from "react";
|
|
4
|
+
import { I as Icon } from "../Icon/index.619c31c4.js";
|
|
5
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
6
|
+
import { g as getCommonActionsDictionary } from "../CommonActions/components/Actions/index.0645e30f.js";
|
|
7
|
+
import "@mui/material/Button";
|
|
8
|
+
import "react-hook-form";
|
|
9
|
+
import "react-router-dom";
|
|
10
|
+
import "../../contexts/ModalContext/index.b92fa565.js";
|
|
11
|
+
import "@mui/lab";
|
|
12
|
+
const ContainerPeriod = styled("div")(({
|
|
13
|
+
theme,
|
|
14
|
+
error,
|
|
15
|
+
readOnly
|
|
16
|
+
}) => ({
|
|
17
|
+
display: "flex",
|
|
18
|
+
width: "100%",
|
|
19
|
+
height: "auto",
|
|
20
|
+
alignItems: "center",
|
|
21
|
+
gap: theme.spacing(1),
|
|
22
|
+
border: error ? `1px solid ${theme.palette.error.main}` : `1px solid ${theme.palette.divider}`,
|
|
23
|
+
padding: theme.spacing(0.5, 1),
|
|
24
|
+
borderRadius: "4px",
|
|
25
|
+
...readOnly && {
|
|
26
|
+
border: "0px"
|
|
27
|
+
},
|
|
28
|
+
"& .MuiAutocomplete-root, & .MuiTextField-root": {
|
|
29
|
+
width: "100%"
|
|
30
|
+
},
|
|
31
|
+
"& .MuiAutocomplete-root .MuiTextField-root": {
|
|
32
|
+
width: "100%"
|
|
33
|
+
},
|
|
34
|
+
"& .MuiTextField-root .MuiInput-input": {
|
|
35
|
+
padding: "5px!important"
|
|
36
|
+
}
|
|
37
|
+
}));
|
|
38
|
+
const Gap = styled("div")(({
|
|
39
|
+
theme
|
|
40
|
+
}) => ({
|
|
41
|
+
width: "1px",
|
|
42
|
+
height: "20px",
|
|
43
|
+
backgroundColor: theme.palette.divider
|
|
44
|
+
}));
|
|
45
|
+
const SKTWrapper = styled("div", {
|
|
46
|
+
shouldForwardProp: (props) => props !== "readOnly"
|
|
47
|
+
})(({
|
|
48
|
+
theme,
|
|
49
|
+
readOnly
|
|
50
|
+
}) => ({
|
|
51
|
+
display: "flex",
|
|
52
|
+
width: "100%",
|
|
53
|
+
height: "37.5px",
|
|
54
|
+
alignItems: "center",
|
|
55
|
+
gap: theme.spacing(1),
|
|
56
|
+
border: `1px solid ${theme.palette.divider}`,
|
|
57
|
+
...readOnly && {
|
|
58
|
+
border: "0px"
|
|
59
|
+
},
|
|
60
|
+
padding: theme.spacing(0.5, 1),
|
|
61
|
+
borderRadius: "4px"
|
|
62
|
+
}));
|
|
63
|
+
const FieldPeriod = styled("div")(({
|
|
64
|
+
theme
|
|
65
|
+
}) => ({
|
|
66
|
+
...theme.typography.body2,
|
|
67
|
+
width: "100%",
|
|
68
|
+
display: "flex",
|
|
69
|
+
textOverflow: "elipsis",
|
|
70
|
+
overflow: "hidden",
|
|
71
|
+
padding: "5px",
|
|
72
|
+
textAlign: "left"
|
|
73
|
+
}));
|
|
74
|
+
const FieldValue = styled("div")(({
|
|
75
|
+
theme
|
|
76
|
+
}) => ({
|
|
77
|
+
...theme.typography.body2,
|
|
78
|
+
width: "70px",
|
|
79
|
+
display: "flex",
|
|
80
|
+
textOverflow: "elipsis",
|
|
81
|
+
overflow: "hidden",
|
|
82
|
+
padding: "5px",
|
|
83
|
+
textAlign: "left"
|
|
84
|
+
}));
|
|
85
|
+
var ETimePeriods = /* @__PURE__ */ ((ETimePeriods2) => {
|
|
86
|
+
ETimePeriods2[ETimePeriods2["YEARS"] = 0] = "YEARS";
|
|
87
|
+
ETimePeriods2[ETimePeriods2["MONTHS"] = 1] = "MONTHS";
|
|
88
|
+
ETimePeriods2[ETimePeriods2["DAYS"] = 2] = "DAYS";
|
|
89
|
+
return ETimePeriods2;
|
|
90
|
+
})(ETimePeriods || {});
|
|
91
|
+
const getSelPeriodTime = (period) => {
|
|
92
|
+
if (!period)
|
|
93
|
+
return ETimePeriods.YEARS;
|
|
94
|
+
if (period.selPeriodTime)
|
|
95
|
+
return period.selPeriodTime;
|
|
96
|
+
if (period.years && period.years > 0)
|
|
97
|
+
return ETimePeriods.YEARS;
|
|
98
|
+
if (period.months && period.months > 0)
|
|
99
|
+
return ETimePeriods.MONTHS;
|
|
100
|
+
if (period.days && period.days > 0)
|
|
101
|
+
return ETimePeriods.DAYS;
|
|
102
|
+
return ETimePeriods.YEARS;
|
|
103
|
+
};
|
|
104
|
+
const getSingleValue = (period) => {
|
|
105
|
+
if (!period)
|
|
106
|
+
return "";
|
|
107
|
+
if (period.singleValue !== void 0)
|
|
108
|
+
return period.singleValue;
|
|
109
|
+
if (period.years && period.years > 0)
|
|
110
|
+
return period.years;
|
|
111
|
+
if (period.months && period.months > 0)
|
|
112
|
+
return period.months;
|
|
113
|
+
if (period.days && period.days > 0)
|
|
114
|
+
return period.days;
|
|
115
|
+
return "";
|
|
116
|
+
};
|
|
117
|
+
const Period = (props) => {
|
|
118
|
+
const {
|
|
119
|
+
value,
|
|
120
|
+
onChange,
|
|
121
|
+
error = false,
|
|
122
|
+
readOnly = false,
|
|
123
|
+
skeletonWidth = "100%",
|
|
124
|
+
skeletonHeight = "18px"
|
|
125
|
+
} = props;
|
|
126
|
+
const {
|
|
127
|
+
getLabel
|
|
128
|
+
} = useModuleDictionary();
|
|
129
|
+
const isSkeleton = useModuleSkeleton();
|
|
130
|
+
const selPeriodTime = getSelPeriodTime(value);
|
|
131
|
+
const singleValue = getSingleValue(value);
|
|
132
|
+
const onTotalChange = (newPeriodTime, newValue) => {
|
|
133
|
+
const newPeriod = {
|
|
134
|
+
selPeriodTime: newPeriodTime,
|
|
135
|
+
singleValue: newValue
|
|
136
|
+
};
|
|
137
|
+
if (newValue !== "" && newValue > 0) {
|
|
138
|
+
newPeriod.years = 0;
|
|
139
|
+
newPeriod.months = 0;
|
|
140
|
+
newPeriod.days = 0;
|
|
141
|
+
if (newPeriodTime === ETimePeriods.YEARS)
|
|
142
|
+
newPeriod.years = newValue;
|
|
143
|
+
if (newPeriodTime === ETimePeriods.MONTHS)
|
|
144
|
+
newPeriod.months = newValue;
|
|
145
|
+
if (newPeriodTime === ETimePeriods.DAYS)
|
|
146
|
+
newPeriod.days = newValue;
|
|
147
|
+
}
|
|
148
|
+
onChange(newPeriod);
|
|
149
|
+
};
|
|
150
|
+
const onChangeTime = (newPeriodTime) => {
|
|
151
|
+
if (newPeriodTime) {
|
|
152
|
+
onTotalChange(newPeriodTime.id, singleValue);
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
const {
|
|
156
|
+
host_static_assets,
|
|
157
|
+
environment_assets
|
|
158
|
+
} = useEnvironment();
|
|
159
|
+
const options = useMemo(() => [{
|
|
160
|
+
id: 0,
|
|
161
|
+
label: getLabel("period.label_days")
|
|
162
|
+
}, {
|
|
163
|
+
id: 1,
|
|
164
|
+
label: getLabel("period.label_months")
|
|
165
|
+
}, {
|
|
166
|
+
id: 2,
|
|
167
|
+
label: getLabel("period.label_years")
|
|
168
|
+
}], [getLabel]);
|
|
169
|
+
if (isSkeleton) {
|
|
170
|
+
return /* @__PURE__ */ jsxs(SKTWrapper, {
|
|
171
|
+
readOnly,
|
|
172
|
+
children: [/* @__PURE__ */ jsx(Skeleton, {
|
|
173
|
+
variant: "text",
|
|
174
|
+
width: "50%",
|
|
175
|
+
height: skeletonHeight
|
|
176
|
+
}), /* @__PURE__ */ jsx(Gap, {}), /* @__PURE__ */ jsx(Skeleton, {
|
|
177
|
+
variant: "text",
|
|
178
|
+
width: skeletonWidth,
|
|
179
|
+
height: skeletonHeight
|
|
180
|
+
}), /* @__PURE__ */ jsx(Skeleton, {
|
|
181
|
+
variant: "circular",
|
|
182
|
+
width: 20,
|
|
183
|
+
sx: {
|
|
184
|
+
minWidth: "20px",
|
|
185
|
+
minHeight: "20px"
|
|
186
|
+
}
|
|
187
|
+
})]
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
if (readOnly) {
|
|
191
|
+
/* @__PURE__ */ jsxs(ContainerPeriod, {
|
|
192
|
+
error: false,
|
|
193
|
+
readOnly,
|
|
194
|
+
children: [/* @__PURE__ */ jsx(FieldPeriod, {
|
|
195
|
+
children: value.selPeriodTime
|
|
196
|
+
}), /* @__PURE__ */ jsx(Gap, {}), /* @__PURE__ */ jsx(FieldValue, {
|
|
197
|
+
children: value.singleValue
|
|
198
|
+
}), /* @__PURE__ */ jsx(Icon, {
|
|
199
|
+
src: `${host_static_assets}/${environment_assets}/frontend/components/period/assets/icons/clock.svg`
|
|
200
|
+
})]
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
return /* @__PURE__ */ jsxs(ContainerPeriod, {
|
|
204
|
+
error,
|
|
205
|
+
readOnly,
|
|
206
|
+
children: [/* @__PURE__ */ jsx(Autocomplete, {
|
|
207
|
+
options,
|
|
208
|
+
value: options[selPeriodTime],
|
|
209
|
+
disableClearable: true,
|
|
210
|
+
onChange: (_event, autcValue) => {
|
|
211
|
+
onChangeTime(autcValue);
|
|
212
|
+
},
|
|
213
|
+
renderInput: (params) => {
|
|
214
|
+
return /* @__PURE__ */ jsx(TextField, {
|
|
215
|
+
...params,
|
|
216
|
+
fullWidth: true,
|
|
217
|
+
variant: "standard",
|
|
218
|
+
SelectProps: {
|
|
219
|
+
native: true
|
|
220
|
+
},
|
|
221
|
+
InputProps: {
|
|
222
|
+
disableUnderline: true,
|
|
223
|
+
...params.InputProps
|
|
224
|
+
},
|
|
225
|
+
autoComplete: "off"
|
|
226
|
+
}, `tx_async_${params.id}`);
|
|
227
|
+
}
|
|
228
|
+
}), /* @__PURE__ */ jsx(Gap, {}), /* @__PURE__ */ jsx(TextField, {
|
|
229
|
+
type: "number",
|
|
230
|
+
variant: "standard",
|
|
231
|
+
value: singleValue,
|
|
232
|
+
InputProps: {
|
|
233
|
+
disableUnderline: true
|
|
234
|
+
},
|
|
235
|
+
onChange: (e) => {
|
|
236
|
+
onTotalChange(selPeriodTime, e.target.value === "" ? "" : parseInt(e.target.value));
|
|
237
|
+
}
|
|
238
|
+
}), /* @__PURE__ */ jsx(Icon, {
|
|
239
|
+
src: `${host_static_assets}/${environment_assets}/frontend/components/period/assets/icons/clock.svg`
|
|
240
|
+
})]
|
|
241
|
+
});
|
|
242
|
+
};
|
|
243
|
+
function getPeriodComponetsDictionary() {
|
|
244
|
+
return ["period"].concat(getCommonActionsDictionary());
|
|
245
|
+
}
|
|
246
|
+
export {
|
|
247
|
+
Period as P,
|
|
248
|
+
getPeriodComponetsDictionary as g
|
|
249
|
+
};
|