@topconsultnpm/sdkui-react-beta 6.11.27 → 6.11.29
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.
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useState } from 'react';
|
|
3
|
-
import { OwnershipLevels, SDK_Localizator, UserLevels, UserListCacheService
|
|
3
|
+
import { OwnershipLevels, SDK_Localizator, UserLevels, UserListCacheService } from '@topconsultnpm/sdk-ts-beta';
|
|
4
4
|
import { Column } from 'devextreme-react/cjs/data-grid';
|
|
5
|
-
import { SDKUI_Localizator, IconSearch, IconUserLevelMember, IconUserLevelAdministrator, IconUserLevelSystemAdministrator, IconUserLevelAutonomousAdministrator, IconWarning, LocalizeOwnershipLevels, LocalizeUserLevels
|
|
5
|
+
import { SDKUI_Localizator, IconSearch, IconUserLevelMember, IconUserLevelAdministrator, IconUserLevelSystemAdministrator, IconUserLevelAutonomousAdministrator, IconWarning, LocalizeOwnershipLevels, LocalizeUserLevels } from '../../helper';
|
|
6
6
|
import { StyledDivHorizontal, StyledTooltipContainer, StyledTooltipSeparatorItem } from '../base/Styled';
|
|
7
7
|
import TMSpinner from '../base/TMSpinner';
|
|
8
8
|
import TMTooltip from '../base/TMTooltip';
|
|
@@ -83,7 +83,7 @@ export const TMUserIcon = ({ ud }) => {
|
|
|
83
83
|
if (!ud)
|
|
84
84
|
return null;
|
|
85
85
|
let isExpired = User_IsExpired(ud);
|
|
86
|
-
let icon =
|
|
86
|
+
let icon = getUserIcon(ud.level, ud.ownershipLevel, isExpired);
|
|
87
87
|
return (_jsx(TMUserTooltip, { ud: ud, children: icon }));
|
|
88
88
|
};
|
|
89
89
|
export const TMUserTooltip = ({ ud, children }) => {
|
|
@@ -108,13 +108,6 @@ function User_IsExpired(d) {
|
|
|
108
108
|
const today = new Date();
|
|
109
109
|
return (ud.validFrom && today < ud.validFrom) || (ud.validTo && today > ud.validTo) || ud.disabled;
|
|
110
110
|
}
|
|
111
|
-
const getUserIconWithType = (userLevel, level, type, isExpired) => {
|
|
112
|
-
if (!type || type == UserTypes.TopMedia)
|
|
113
|
-
return (_jsxs(StyledDivHorizontal, { children: [getUserIcon(userLevel, level, isExpired), " ", _jsx(IconFactory, { fontSize: 16 })] }));
|
|
114
|
-
if (type && type == UserTypes.Windows)
|
|
115
|
-
return (_jsxs(StyledDivHorizontal, { children: [getUserIcon(userLevel, level, isExpired), " ", _jsx(IconWorkspace, { fontSize: 16 })] }));
|
|
116
|
-
return _jsx(_Fragment, {});
|
|
117
|
-
};
|
|
118
111
|
const getUserIcon = (userLevel, level, isExpired) => {
|
|
119
112
|
let ownershipColor = "";
|
|
120
113
|
if (isExpired)
|
|
@@ -25,10 +25,12 @@ interface ITMPage<T> {
|
|
|
25
25
|
searchText?: string;
|
|
26
26
|
/** Indica la pagina dell'URL per i link */
|
|
27
27
|
routePage?: string;
|
|
28
|
+
/** Indica quando eseguire il refresh dei dati della lista */
|
|
29
|
+
lastRefreshTime?: Date;
|
|
28
30
|
/** Indica il cambiamento della selezione */
|
|
29
31
|
onSelectionChanged?: (rows: T[]) => void;
|
|
30
32
|
/** Indica il cambiamento dei contatori della lista (totali, selezionati e visibili) */
|
|
31
33
|
onCountersChanged?: (totalItemsCount: number, selectedItemsCount: number, visibleItemsCount: number) => void;
|
|
32
34
|
}
|
|
33
|
-
declare const TMPage: <T>({ id, objClass, objType, listInsteadOfContent, detailInsteadOfContent, routePage, customButtons, customColumns, searchText, detailForm, detailTitlePathKeys, deps, onSelectionChanged, onCountersChanged }: ITMPage<T>) => import("react/jsx-runtime").JSX.Element;
|
|
35
|
+
declare const TMPage: <T>({ id, objClass, lastRefreshTime, objType, listInsteadOfContent, detailInsteadOfContent, routePage, customButtons, customColumns, searchText, detailForm, detailTitlePathKeys, deps, onSelectionChanged, onCountersChanged }: ITMPage<T>) => import("react/jsx-runtime").JSX.Element;
|
|
34
36
|
export default TMPage;
|
|
@@ -17,7 +17,7 @@ import { TMResultManager } from "../forms/TMResultDialog";
|
|
|
17
17
|
import { TMLayoutWaitingContainer } from "../base/TMWaitPanel";
|
|
18
18
|
import TMToolbarCard from "../base/TMToolbarCard";
|
|
19
19
|
let abortController = new AbortController();
|
|
20
|
-
const TMPage = ({ id, objClass = ObjectClasses.None, objType, listInsteadOfContent, detailInsteadOfContent, routePage, customButtons, customColumns, searchText, detailForm, detailTitlePathKeys, deps, onSelectionChanged, onCountersChanged }) => {
|
|
20
|
+
const TMPage = ({ id, objClass = ObjectClasses.None, lastRefreshTime, objType, listInsteadOfContent, detailInsteadOfContent, routePage, customButtons, customColumns, searchText, detailForm, detailTitlePathKeys, deps, onSelectionChanged, onCountersChanged }) => {
|
|
21
21
|
const deviceType = useDeviceType();
|
|
22
22
|
let gridInstance;
|
|
23
23
|
const [showId, setShowId] = useState(false);
|
|
@@ -49,6 +49,11 @@ const TMPage = ({ id, objClass = ObjectClasses.None, objType, listInsteadOfConte
|
|
|
49
49
|
setSelectionListDisabled(false);
|
|
50
50
|
(async () => { await loadDataAsync(id); })();
|
|
51
51
|
}, deps && deps.length > 0 ? [deps[0]] : []);
|
|
52
|
+
useEffect(() => {
|
|
53
|
+
if (lastRefreshTime) {
|
|
54
|
+
loadDataAsync(id);
|
|
55
|
+
}
|
|
56
|
+
}, [lastRefreshTime]);
|
|
52
57
|
useEffect(() => { onCountersChanged?.(items.length, selectedItems.length, visibleItems.length); }, [items, selectedItems, visibleItems]);
|
|
53
58
|
const loadDataAsync = async (id) => {
|
|
54
59
|
try {
|