@m4l/components 0.1.13 → 0.1.15
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.js +91 -0
- package/commonjs.js +9 -0
- package/components/CommonActions/components/ActionCancel/index.js +15 -0
- package/components/CommonActions/components/ActionFormCancel/index.js +62 -0
- package/components/CommonActions/components/ActionFormIntro/index.js +35 -0
- package/components/CommonActions/components/ActionIntro/index.js +16 -0
- package/components/CommonActions/components/Actions/index.js +859 -0
- package/components/CompanyLogo/{index.f81c179c.js → index.js} +48 -42
- package/components/DataGrid/index.js +1067 -0
- package/components/DynamicFilter/index.js +1573 -0
- package/components/ErrorLabel/index.js +18 -0
- package/components/Icon/index.js +80 -0
- package/components/Image/index.js +128 -0
- package/components/LanguagePopover/index.js +93 -0
- package/components/Loadable/index.js +13 -0
- package/components/ModalDialog/index.js +180 -0
- package/components/NoItemSelected/{index.12f0ca67.js → index.js} +50 -43
- package/components/ObjectLogs/index.js +284 -0
- package/components/Page/index.js +36 -0
- package/components/PaperForm/index.js +110 -0
- package/components/Period/index.js +230 -0
- package/components/PropertyValue/index.js +142 -0
- package/components/Resizeable/{index.45995d2b.js → index.js} +19 -21
- package/components/ScrollBar/index.js +52 -0
- package/components/ScrollToTop/index.js +10 -0
- package/components/SplitLayout/{index.4032673d.js → index.js} +35 -35
- package/components/animate/LoadingScreen/{index.f1cec7db.js → index.js} +27 -29
- package/components/animate/MotionContainer/index.js +31 -0
- package/components/animate/MotionLazyContainer/index.js +13 -0
- package/components/animate/features.js +2 -0
- package/components/animate/variants/{bounce.784aaaaa.js → bounce.js} +16 -15
- package/components/animate/variants/container.js +20 -0
- package/components/animate/variants/fade.js +61 -0
- package/components/animate/variants/{index.7a912140.js → index.js} +0 -0
- package/components/animate/variants/transition.js +16 -0
- package/components/formatters/BooleanFormatter/index.js +52 -0
- package/components/formatters/DateFormatter/index.js +66 -0
- package/components/formatters/index.js +112 -0
- package/components/hook-form/FormProvider/index.js +61 -0
- package/components/hook-form/RHFAutocomplete/index.js +144 -0
- package/components/hook-form/RHFAutocompleteAsync/index.js +191 -0
- package/components/hook-form/RHFCheckbox/index.js +65 -0
- package/components/hook-form/RHFDateTime/index.js +79 -0
- package/components/hook-form/RHFMultiCheckbox/index.js +32 -0
- package/components/hook-form/RHFPeriod/index.js +47 -0
- package/components/hook-form/RHFRadioGroup/index.js +41 -0
- package/components/hook-form/RHFSelect/index.js +34 -0
- package/components/hook-form/RHFTextField/index.js +87 -0
- package/components/hook-form/RHFUpload/index.js +255 -0
- package/components/mui_extended/Accordion/index.js +105 -0
- package/components/mui_extended/Avatar/index.js +33 -0
- package/components/mui_extended/BoxIcon/index.js +20 -0
- package/components/mui_extended/Breadcrumbs/index.js +92 -0
- package/components/mui_extended/Button/index.js +131 -0
- package/components/mui_extended/IconButton/index.js +108 -0
- package/components/mui_extended/LinkWithRoute/index.js +30 -0
- package/components/mui_extended/MenuPopover/index.js +135 -0
- package/components/mui_extended/Pager/index.js +137 -0
- package/components/mui_extended/Tab/index.js +30 -0
- package/components/mui_extended/Typography/index.js +21 -0
- package/contexts/ModalContext/index.js +165 -0
- package/hooks/useFormAddEdit/index.js +42 -0
- package/hooks/useModal/index.js +4 -0
- package/index.js +70 -162
- package/lodash.js +62 -0
- package/node_modules.js +54 -0
- package/package.json +2 -1
- package/react-data-grid.js +2652 -0
- package/react-draggable.js +960 -0
- package/react-json-view.js +2764 -0
- package/react-lazy-load-image-component.js +792 -0
- package/react-resizable.js +541 -0
- package/react-splitter-layout.js +165 -0
- package/utils/index.js +572 -0
- package/assets/Logo/index.228dcb5a.js +0 -86
- package/commonjs.565e6834.js +0 -12
- package/components/CommonActions/components/ActionCancel/index.cba1b460.js +0 -17
- package/components/CommonActions/components/ActionFormCancel/index.be2fe891.js +0 -49
- package/components/CommonActions/components/ActionFormIntro/index.ca4d2674.js +0 -31
- package/components/CommonActions/components/ActionIntro/index.cc4b1e0e.js +0 -18
- package/components/CommonActions/components/Actions/index.e8148d98.js +0 -743
- package/components/DataGrid/index.b688877d.js +0 -894
- package/components/DynamicFilter/index.82ce857e.js +0 -1158
- package/components/ErrorLabel/index.c8615f16.js +0 -19
- package/components/Icon/index.cbca79b0.js +0 -70
- package/components/Image/index.e790b50b.js +0 -122
- package/components/LanguagePopover/index.3d9611cb.js +0 -87
- package/components/Loadable/index.f5518558.js +0 -15
- package/components/ModalDialog/index.3850c053.js +0 -168
- package/components/ObjectLogs/index.27ef875d.js +0 -266
- package/components/Page/index.6d69977e.js +0 -35
- package/components/PaperForm/index.d7c74064.js +0 -105
- package/components/Period/index.5e68286a.js +0 -160
- package/components/PropertyValue/index.ab3dd7e9.js +0 -116
- package/components/ScrollBar/index.39eeb2de.js +0 -49
- package/components/ScrollToTop/index.e06f98f6.js +0 -11
- package/components/animate/MotionContainer/index.8d9f9d80.js +0 -30
- package/components/animate/MotionLazyContainer/index.572dd012.js +0 -15
- package/components/animate/features.0fbf41e1.js +0 -5
- package/components/animate/variants/container.11f82b76.js +0 -20
- package/components/animate/variants/fade.b561c0fc.js +0 -59
- package/components/animate/variants/transition.bd46b9ce.js +0 -15
- package/components/formatters/BooleanFormatter/index.cca53b7f.js +0 -42
- package/components/formatters/DateFormatter/index.ad8d9b8e.js +0 -57
- package/components/formatters/index.55856d65.js +0 -106
- package/components/hook-form/FormProvider/index.257acd9f.js +0 -55
- package/components/hook-form/RHFAutocomplete/index.6ed76d4c.js +0 -122
- package/components/hook-form/RHFAutocompleteAsync/index.8f2c97ea.js +0 -153
- package/components/hook-form/RHFCheckbox/index.f9ce6c39.js +0 -59
- package/components/hook-form/RHFDateTime/index.fc5cbafe.js +0 -68
- package/components/hook-form/RHFMultiCheckbox/index.2680b3b6.js +0 -34
- package/components/hook-form/RHFPeriod/index.23c254e9.js +0 -45
- package/components/hook-form/RHFRadioGroup/index.b3335e13.js +0 -43
- package/components/hook-form/RHFSelect/index.b6ca8bb2.js +0 -36
- package/components/hook-form/RHFTextField/index.4c455f75.js +0 -77
- package/components/hook-form/RHFUpload/index.ed3d739f.js +0 -244
- package/components/mui_extended/Accordion/index.2116e423.js +0 -103
- package/components/mui_extended/Avatar/index.0a2a4523.js +0 -32
- package/components/mui_extended/BoxIcon/index.e638ecc8.js +0 -22
- package/components/mui_extended/Breadcrumbs/index.5e37d903.js +0 -89
- package/components/mui_extended/Button/index.84d8898c.js +0 -110
- package/components/mui_extended/IconButton/index.88f3aadb.js +0 -98
- package/components/mui_extended/LinkWithRoute/index.d4b263de.js +0 -28
- package/components/mui_extended/MenuPopover/index.488fc536.js +0 -131
- package/components/mui_extended/Pager/index.0576814f.js +0 -126
- package/components/mui_extended/Tab/index.e0653a0a.js +0 -28
- package/components/mui_extended/Typography/index.0c4604b3.js +0 -22
- package/contexts/ModalContext/index.2188b69e.js +0 -150
- package/hooks/useFormAddEdit/index.d4845f1a.js +0 -26
- package/hooks/useModal/index.6571d2d9.js +0 -6
- package/lodash.e09401f0.js +0 -32
- package/node_modules.168cb897.js +0 -55
- package/react-data-grid.d46d625e.js +0 -2115
- package/react-draggable.20e95c61.js +0 -714
- package/react-json-view.f56a7f8e.js +0 -2762
- package/react-lazy-load-image-component.45b56650.js +0 -784
- package/react-resizable.5277deaf.js +0 -371
- package/react-splitter-layout.7810ac1b.js +0 -165
- package/utils/index.214d9542.js +0 -435
|
@@ -0,0 +1,284 @@
|
|
|
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.js";
|
|
5
|
+
import { D as DateFormatter } from "../formatters/DateFormatter/index.js";
|
|
6
|
+
import { Tooltip, IconButton } from "@mui/material";
|
|
7
|
+
import { R as ReactJson } from "../../react-json-view.js";
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
import { u as useModal } from "../../hooks/useModal/index.js";
|
|
10
|
+
import { I as Icon } from "../Icon/index.js";
|
|
11
|
+
import { D as DynamicFilter, g as getDynamicFilterComponentsDictionary } from "../DynamicFilter/index.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 { ObjectLogs as O, defaultObjectLogDictionary as d, getObjectLogsComponentsDictionary as g };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { forwardRef } from "react";
|
|
2
|
+
import { Helmet } from "react-helmet-async";
|
|
3
|
+
import { Box } from "@mui/material";
|
|
4
|
+
import { useLocales } from "@m4l/graphics";
|
|
5
|
+
import { useDomain, useModuleSkeleton } from "@m4l/core";
|
|
6
|
+
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
7
|
+
const Page = forwardRef((props, ref) => {
|
|
8
|
+
const {
|
|
9
|
+
children,
|
|
10
|
+
title,
|
|
11
|
+
meta,
|
|
12
|
+
...other
|
|
13
|
+
} = props;
|
|
14
|
+
const {
|
|
15
|
+
currentLang
|
|
16
|
+
} = useLocales();
|
|
17
|
+
const {
|
|
18
|
+
name: domain_name
|
|
19
|
+
} = useDomain();
|
|
20
|
+
const isSkeleton = useModuleSkeleton();
|
|
21
|
+
return /* @__PURE__ */ jsxs(Fragment, {
|
|
22
|
+
children: [!isSkeleton && /* @__PURE__ */ jsxs(Helmet, {
|
|
23
|
+
children: [/* @__PURE__ */ jsx("title", {
|
|
24
|
+
children: `${title} | ${domain_name}`
|
|
25
|
+
}), /* @__PURE__ */ jsx("html", {
|
|
26
|
+
lang: currentLang.value
|
|
27
|
+
}), meta]
|
|
28
|
+
}), /* @__PURE__ */ jsx(Box, {
|
|
29
|
+
ref,
|
|
30
|
+
...other,
|
|
31
|
+
children
|
|
32
|
+
})]
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
Page.displayName = "Page";
|
|
36
|
+
export { Page as P };
|
|
@@ -0,0 +1,110 @@
|
|
|
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.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 { PaperForm as P };
|
|
@@ -0,0 +1,230 @@
|
|
|
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.js";
|
|
5
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
6
|
+
import { g as getCommonActionsDictionary } from "../CommonActions/components/Actions/index.js";
|
|
7
|
+
import "@mui/material/Button";
|
|
8
|
+
import "../mui_extended/Button/index.js";
|
|
9
|
+
import "react-hook-form";
|
|
10
|
+
import "react-router-dom";
|
|
11
|
+
import "../../contexts/ModalContext/index.js";
|
|
12
|
+
import "@mui/lab";
|
|
13
|
+
const ContainerPeriod = styled("div")(({
|
|
14
|
+
theme,
|
|
15
|
+
error
|
|
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
|
+
"& .MuiAutocomplete-root, & .MuiTextField-root": {
|
|
26
|
+
width: "100%"
|
|
27
|
+
},
|
|
28
|
+
"& .MuiAutocomplete-root .MuiTextField-root": {
|
|
29
|
+
width: "100%"
|
|
30
|
+
},
|
|
31
|
+
"& .MuiTextField-root .MuiInput-input": {
|
|
32
|
+
padding: "5px!important"
|
|
33
|
+
}
|
|
34
|
+
}));
|
|
35
|
+
const Gap = styled("div")(({
|
|
36
|
+
theme
|
|
37
|
+
}) => ({
|
|
38
|
+
width: "1px",
|
|
39
|
+
height: "20px",
|
|
40
|
+
backgroundColor: theme.palette.divider
|
|
41
|
+
}));
|
|
42
|
+
const SKTWrapper = styled("div")(({
|
|
43
|
+
theme
|
|
44
|
+
}) => ({
|
|
45
|
+
display: "flex",
|
|
46
|
+
width: "auto",
|
|
47
|
+
height: "37.5px",
|
|
48
|
+
alignItems: "center",
|
|
49
|
+
gap: theme.spacing(1),
|
|
50
|
+
border: `1px solid ${theme.palette.divider}`,
|
|
51
|
+
padding: theme.spacing(0.5, 1),
|
|
52
|
+
borderRadius: "4px"
|
|
53
|
+
}));
|
|
54
|
+
const FieldPeriod = styled("div")(({
|
|
55
|
+
theme
|
|
56
|
+
}) => ({
|
|
57
|
+
...theme.typography.body2,
|
|
58
|
+
width: "100%",
|
|
59
|
+
display: "flex",
|
|
60
|
+
textOverflow: "elipsis",
|
|
61
|
+
overflow: "hidden",
|
|
62
|
+
padding: "5px",
|
|
63
|
+
textAlign: "left"
|
|
64
|
+
}));
|
|
65
|
+
const FieldValue = styled("div")(({
|
|
66
|
+
theme
|
|
67
|
+
}) => ({
|
|
68
|
+
...theme.typography.body2,
|
|
69
|
+
width: "70px",
|
|
70
|
+
display: "flex",
|
|
71
|
+
textOverflow: "elipsis",
|
|
72
|
+
overflow: "hidden",
|
|
73
|
+
padding: "5px",
|
|
74
|
+
textAlign: "left"
|
|
75
|
+
}));
|
|
76
|
+
var ETimePeriods = /* @__PURE__ */ ((ETimePeriods2) => {
|
|
77
|
+
ETimePeriods2[ETimePeriods2["YEARS"] = 0] = "YEARS";
|
|
78
|
+
ETimePeriods2[ETimePeriods2["MONTHS"] = 1] = "MONTHS";
|
|
79
|
+
ETimePeriods2[ETimePeriods2["DAYS"] = 2] = "DAYS";
|
|
80
|
+
return ETimePeriods2;
|
|
81
|
+
})(ETimePeriods || {});
|
|
82
|
+
const getSelPeriodTime = (period) => {
|
|
83
|
+
if (!period)
|
|
84
|
+
return ETimePeriods.YEARS;
|
|
85
|
+
if (period.selPeriodTime)
|
|
86
|
+
return period.selPeriodTime;
|
|
87
|
+
if (period.years && period.years > 0)
|
|
88
|
+
return ETimePeriods.YEARS;
|
|
89
|
+
if (period.months && period.months > 0)
|
|
90
|
+
return ETimePeriods.MONTHS;
|
|
91
|
+
if (period.days && period.days > 0)
|
|
92
|
+
return ETimePeriods.DAYS;
|
|
93
|
+
return ETimePeriods.YEARS;
|
|
94
|
+
};
|
|
95
|
+
const getSingleValue = (period) => {
|
|
96
|
+
if (!period)
|
|
97
|
+
return "";
|
|
98
|
+
if (period.singleValue !== void 0)
|
|
99
|
+
return period.singleValue;
|
|
100
|
+
if (period.years && period.years > 0)
|
|
101
|
+
return period.years;
|
|
102
|
+
if (period.months && period.months > 0)
|
|
103
|
+
return period.months;
|
|
104
|
+
if (period.days && period.days > 0)
|
|
105
|
+
return period.days;
|
|
106
|
+
return "";
|
|
107
|
+
};
|
|
108
|
+
const Period = (props) => {
|
|
109
|
+
const {
|
|
110
|
+
value,
|
|
111
|
+
onChange,
|
|
112
|
+
error = false,
|
|
113
|
+
readOnly = false
|
|
114
|
+
} = props;
|
|
115
|
+
const {
|
|
116
|
+
getLabel
|
|
117
|
+
} = useModuleDictionary();
|
|
118
|
+
const isSkeleton = useModuleSkeleton();
|
|
119
|
+
const selPeriodTime = getSelPeriodTime(value);
|
|
120
|
+
const singleValue = getSingleValue(value);
|
|
121
|
+
const onTotalChange = (newPeriodTime, newValue) => {
|
|
122
|
+
const newPeriod = {
|
|
123
|
+
selPeriodTime: newPeriodTime,
|
|
124
|
+
singleValue: newValue
|
|
125
|
+
};
|
|
126
|
+
if (newValue !== "" && newValue > 0) {
|
|
127
|
+
newPeriod.years = 0;
|
|
128
|
+
newPeriod.months = 0;
|
|
129
|
+
newPeriod.days = 0;
|
|
130
|
+
if (newPeriodTime === ETimePeriods.YEARS)
|
|
131
|
+
newPeriod.years = newValue;
|
|
132
|
+
if (newPeriodTime === ETimePeriods.MONTHS)
|
|
133
|
+
newPeriod.months = newValue;
|
|
134
|
+
if (newPeriodTime === ETimePeriods.DAYS)
|
|
135
|
+
newPeriod.days = newValue;
|
|
136
|
+
}
|
|
137
|
+
onChange(newPeriod);
|
|
138
|
+
};
|
|
139
|
+
const onChangeTime = (newPeriodTime) => {
|
|
140
|
+
if (newPeriodTime) {
|
|
141
|
+
onTotalChange(newPeriodTime.id, singleValue);
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
const {
|
|
145
|
+
host_static_assets,
|
|
146
|
+
environment_assets
|
|
147
|
+
} = useEnvironment();
|
|
148
|
+
const options = useMemo(() => [{
|
|
149
|
+
id: 0,
|
|
150
|
+
label: getLabel("period.years")
|
|
151
|
+
}, {
|
|
152
|
+
id: 1,
|
|
153
|
+
label: getLabel("period.months")
|
|
154
|
+
}, {
|
|
155
|
+
id: 2,
|
|
156
|
+
label: getLabel("period.days")
|
|
157
|
+
}], [getLabel]);
|
|
158
|
+
if (isSkeleton) {
|
|
159
|
+
return /* @__PURE__ */ jsxs(SKTWrapper, {
|
|
160
|
+
children: [/* @__PURE__ */ jsx(Skeleton, {
|
|
161
|
+
variant: "rounded",
|
|
162
|
+
width: "100%"
|
|
163
|
+
}), /* @__PURE__ */ jsx(Gap, {}), /* @__PURE__ */ jsx(Skeleton, {
|
|
164
|
+
variant: "rounded",
|
|
165
|
+
width: "100%"
|
|
166
|
+
}), /* @__PURE__ */ jsx(Skeleton, {
|
|
167
|
+
variant: "circular",
|
|
168
|
+
width: 20,
|
|
169
|
+
sx: {
|
|
170
|
+
minWidth: "20px",
|
|
171
|
+
minHeight: "20px"
|
|
172
|
+
}
|
|
173
|
+
})]
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
if (readOnly) {
|
|
177
|
+
/* @__PURE__ */ jsxs(ContainerPeriod, {
|
|
178
|
+
error: false,
|
|
179
|
+
children: [/* @__PURE__ */ jsx(FieldPeriod, {
|
|
180
|
+
children: value.selPeriodTime
|
|
181
|
+
}), /* @__PURE__ */ jsx(Gap, {}), /* @__PURE__ */ jsx(FieldValue, {
|
|
182
|
+
children: value.singleValue
|
|
183
|
+
}), /* @__PURE__ */ jsx(Icon, {
|
|
184
|
+
src: `${host_static_assets}/${environment_assets}/frontend/components/period/assets/icons/clock.svg`
|
|
185
|
+
})]
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
return /* @__PURE__ */ jsxs(ContainerPeriod, {
|
|
189
|
+
error,
|
|
190
|
+
children: [/* @__PURE__ */ jsx(Autocomplete, {
|
|
191
|
+
options,
|
|
192
|
+
value: options[selPeriodTime],
|
|
193
|
+
disableClearable: true,
|
|
194
|
+
onChange: (_event, autcValue) => {
|
|
195
|
+
onChangeTime(autcValue);
|
|
196
|
+
},
|
|
197
|
+
renderInput: (params) => {
|
|
198
|
+
return /* @__PURE__ */ jsx(TextField, {
|
|
199
|
+
...params,
|
|
200
|
+
fullWidth: true,
|
|
201
|
+
variant: "standard",
|
|
202
|
+
SelectProps: {
|
|
203
|
+
native: true
|
|
204
|
+
},
|
|
205
|
+
InputProps: {
|
|
206
|
+
disableUnderline: true,
|
|
207
|
+
...params.InputProps
|
|
208
|
+
},
|
|
209
|
+
autoComplete: "off"
|
|
210
|
+
}, `tx_async_${params.id}`);
|
|
211
|
+
}
|
|
212
|
+
}), /* @__PURE__ */ jsx(Gap, {}), /* @__PURE__ */ jsx(TextField, {
|
|
213
|
+
type: "number",
|
|
214
|
+
variant: "standard",
|
|
215
|
+
value: singleValue,
|
|
216
|
+
InputProps: {
|
|
217
|
+
disableUnderline: true
|
|
218
|
+
},
|
|
219
|
+
onChange: (e) => {
|
|
220
|
+
onTotalChange(selPeriodTime, e.target.value === "" ? "" : parseInt(e.target.value));
|
|
221
|
+
}
|
|
222
|
+
}), /* @__PURE__ */ jsx(Icon, {
|
|
223
|
+
src: `${host_static_assets}/${environment_assets}/frontend/components/period/assets/icons/clock.svg`
|
|
224
|
+
})]
|
|
225
|
+
});
|
|
226
|
+
};
|
|
227
|
+
function getPeriodComponetsDictionary() {
|
|
228
|
+
return ["period"].concat(getCommonActionsDictionary());
|
|
229
|
+
}
|
|
230
|
+
export { Period as P, getPeriodComponetsDictionary as g };
|