@topconsultnpm/sdkui-react-beta 6.16.88 → 6.16.89
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/lib/components/choosers/TMDcmtTypeChooser.d.ts +5 -3
- package/lib/components/choosers/TMDcmtTypeChooser.js +18 -12
- package/lib/components/features/archive/TMArchive.js +1 -1
- package/lib/components/features/search/TMSearch.js +1 -1
- package/lib/components/grids/TMRecentsManager.d.ts +2 -0
- package/lib/components/grids/TMRecentsManager.js +4 -3
- package/lib/components/viewers/TMTidViewer.js +1 -1
- package/package.json +2 -2
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { DcmtTypeDescriptor, ITopMediaSession, TemplateTIDs } from '@topconsultnpm/sdk-ts-beta';
|
|
2
|
+
import { AccessFilter, DcmtTypeDescriptor, ITopMediaSession, TemplateTIDs } from '@topconsultnpm/sdk-ts-beta';
|
|
3
3
|
import { ITMChooserFormProps, ITMChooserProps } from '../../ts';
|
|
4
4
|
interface ITMDcmtTypeChooser extends ITMChooserProps {
|
|
5
5
|
ShowOnlyDcmtTypes?: boolean;
|
|
6
6
|
ShowOnlySAP?: boolean;
|
|
7
7
|
filterTemplateTID?: TemplateTIDs[];
|
|
8
|
-
/** Contiene i TID selezionati */
|
|
9
8
|
values?: number[];
|
|
10
|
-
/** Visualizza il bordo */
|
|
11
9
|
showBorder?: boolean;
|
|
12
10
|
borderRadius?: string;
|
|
13
11
|
openEditorOnSummaryClick?: boolean;
|
|
12
|
+
accessFilter?: AccessFilter;
|
|
13
|
+
filter?: (value: DcmtTypeDescriptor, index: number, array: DcmtTypeDescriptor[]) => unknown;
|
|
14
14
|
}
|
|
15
15
|
declare const TMDcmtTypeChooser: React.FunctionComponent<ITMDcmtTypeChooser>;
|
|
16
16
|
export default TMDcmtTypeChooser;
|
|
@@ -19,5 +19,7 @@ interface ITMDcmtTypeChooserFormProps extends ITMChooserFormProps<DcmtTypeDescri
|
|
|
19
19
|
ShowOnlySAP?: boolean;
|
|
20
20
|
filterTemplateTID?: TemplateTIDs[];
|
|
21
21
|
tmSession?: ITopMediaSession;
|
|
22
|
+
accessFilter?: AccessFilter;
|
|
23
|
+
filter?: (value: DcmtTypeDescriptor, index: number, array: DcmtTypeDescriptor[]) => unknown;
|
|
22
24
|
}
|
|
23
25
|
export declare const TMDcmtTypeChooserForm: React.FunctionComponent<ITMDcmtTypeChooserFormProps>;
|
|
@@ -1,13 +1,13 @@
|
|
|
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 { DcmtTypeListCacheService, SDK_Globals, SDK_Localizator } from '@topconsultnpm/sdk-ts-beta';
|
|
3
|
+
import { AccessLevelsEx, DcmtTypeListCacheService, SDK_Globals, SDK_Localizator } from '@topconsultnpm/sdk-ts-beta';
|
|
4
4
|
import TMSpinner from '../base/TMSpinner';
|
|
5
5
|
import { IconSearch, SDKUI_Localizator } from '../../helper';
|
|
6
6
|
import { StyledDivHorizontal } from '../base/Styled';
|
|
7
7
|
import TMTidViewer, { TMDcmtTypeIcon } from '../viewers/TMTidViewer';
|
|
8
8
|
import TMSummary from '../editors/TMSummary';
|
|
9
9
|
import TMChooserForm from '../forms/TMChooserForm';
|
|
10
|
-
const TMDcmtTypeChooser = ({ tmSession, dataSource, disabled, backgroundColor, showEditButton = true, borderRadius = '4px', buttons = [], placeHolder = `<${SDKUI_Localizator.NoneSelection}>`, openEditorOnSummaryClick, showBorder = true, showId = false, elementStyle, allowMultipleSelection, ShowOnlyDcmtTypes, ShowOnlySAP, filterTemplateTID, values, isModifiedWhen, label, width, height, showClearButton = false, validationItems = [], onValueChanged }) => {
|
|
10
|
+
const TMDcmtTypeChooser = ({ tmSession, dataSource, disabled, backgroundColor, filter, accessFilter = 'all', showEditButton = true, borderRadius = '4px', buttons = [], placeHolder = `<${SDKUI_Localizator.NoneSelection}>`, openEditorOnSummaryClick, showBorder = true, showId = false, elementStyle, allowMultipleSelection, ShowOnlyDcmtTypes, ShowOnlySAP, filterTemplateTID, values, isModifiedWhen, label, width, height, showClearButton = false, validationItems = [], onValueChanged }) => {
|
|
11
11
|
const [showChooser, setShowChooser] = useState(false);
|
|
12
12
|
useEffect(() => {
|
|
13
13
|
TMSpinner.show({ description: `${SDKUI_Localizator.Loading} - ${SDK_Localizator.ListDcmtTypeOrView} ...` });
|
|
@@ -18,29 +18,35 @@ const TMDcmtTypeChooser = ({ tmSession, dataSource, disabled, backgroundColor, s
|
|
|
18
18
|
return (_jsxs(StyledDivHorizontal, { style: { width: 'max-content', height: '100%' }, children: [values && _jsx(TMTidViewer, { tmSession: tmSession, tid: values[0], showIcon: true, showId: showId, noneSelectionText: placeHolder }), values && values.length > 1 && _jsx("p", { style: { marginLeft: '10px' }, children: `(+${values.length - 1} ${values.length == 2 ? 'altro' : 'altri'})` })] }));
|
|
19
19
|
};
|
|
20
20
|
return (_jsxs(_Fragment, { children: [_jsx(TMSummary, { backgroundColor: backgroundColor, buttons: buttons, showBorder: showBorder, borderRadius: borderRadius, hasValue: values && values.length > 0, showClearButton: showClearButton, showEditButton: showEditButton, iconEditButton: _jsx(IconSearch, { fontSize: 16 }), onEditorClick: () => !disabled && setShowChooser(true), elementStyle: elementStyle, isModifiedWhen: isModifiedWhen, label: label, width: width, height: height, template: renderTemplate(), openEditorOnSummaryClick: openEditorOnSummaryClick, onClearClick: showClearButton ? () => { !disabled && onValueChanged?.([]); } : undefined, validationItems: validationItems }), showChooser &&
|
|
21
|
-
_jsx(TMDcmtTypeChooserForm, { tmSession: tmSession, allowMultipleSelection: allowMultipleSelection, dataSource: dataSource, selectedIDs: values, ShowOnlyDcmtTypes: ShowOnlyDcmtTypes, ShowOnlySAP: ShowOnlySAP, filterTemplateTID: filterTemplateTID, onClose: () => setShowChooser(false), onChoose: (IDs) => { onValueChanged?.(IDs); } })] }));
|
|
21
|
+
_jsx(TMDcmtTypeChooserForm, { tmSession: tmSession, allowMultipleSelection: allowMultipleSelection, dataSource: dataSource, selectedIDs: values, ShowOnlyDcmtTypes: ShowOnlyDcmtTypes, ShowOnlySAP: ShowOnlySAP, accessFilter: accessFilter, filterTemplateTID: filterTemplateTID, filter: filter, onClose: () => setShowChooser(false), onChoose: (IDs) => { onValueChanged?.(IDs); } })] }));
|
|
22
22
|
};
|
|
23
23
|
export default TMDcmtTypeChooser;
|
|
24
24
|
const cellRenderIcon = (data) => _jsx(TMDcmtTypeIcon, { dtd: data.data });
|
|
25
25
|
const cellRenderNameAndDesc = (data) => _jsx("p", { style: { textAlign: 'left', color: data.data.isView ? 'red' : '' }, children: data.value });
|
|
26
|
-
export const TMDcmtTypeChooserForm = (
|
|
26
|
+
export const TMDcmtTypeChooserForm = ({ tmSession, allowMultipleSelection, width, height, selectedIDs, dataSource, ShowOnlyDcmtTypes, ShowOnlySAP, filterTemplateTID, accessFilter = 'all', filter, onClose, onChoose }) => {
|
|
27
|
+
const isPermitted = (accessLevel) => accessLevel === AccessLevelsEx.Yes || accessLevel === AccessLevelsEx.Mixed;
|
|
27
28
|
const getItems = async (refreshCache) => {
|
|
28
|
-
let tms =
|
|
29
|
+
let tms = tmSession ?? SDK_Globals.tmSession;
|
|
29
30
|
if (refreshCache)
|
|
30
31
|
DcmtTypeListCacheService.RemoveAllWithoutMetadata(tms);
|
|
31
|
-
let count = DcmtTypeListCacheService.CacheCount(true, tms);
|
|
32
|
+
let count = DcmtTypeListCacheService.CacheCount(true, accessFilter, tms);
|
|
32
33
|
if (count <= 0)
|
|
33
34
|
TMSpinner.show({ description: `${SDKUI_Localizator.Loading} - ${SDK_Localizator.ListDcmtTypeOrView} ...` });
|
|
34
35
|
let dtdList = await DcmtTypeListCacheService.GetAllWithoutMetadataAsync(tms);
|
|
35
36
|
if (count <= 0)
|
|
36
37
|
TMSpinner.hide();
|
|
37
|
-
if (
|
|
38
|
+
if (ShowOnlyDcmtTypes)
|
|
38
39
|
return dtdList?.filter(d => d.isView === false);
|
|
39
|
-
else if (
|
|
40
|
+
else if (ShowOnlySAP)
|
|
40
41
|
return dtdList?.filter(d => isSAPDcmtTypeName(d.name));
|
|
41
|
-
if (
|
|
42
|
-
return dtdList?.filter(d => d.templateTID &&
|
|
43
|
-
|
|
42
|
+
if (filterTemplateTID)
|
|
43
|
+
return dtdList?.filter(d => d.templateTID && filterTemplateTID?.includes(d.templateTID));
|
|
44
|
+
if (accessFilter === 'canArchive')
|
|
45
|
+
return dtdList?.filter(d => isPermitted(d.perm?.canArchive));
|
|
46
|
+
else if (accessFilter === 'canSearch')
|
|
47
|
+
return dtdList?.filter(d => isPermitted(d.perm?.canSearch));
|
|
48
|
+
let dcmtTypes = filter ? dtdList?.filter(filter) : dtdList;
|
|
49
|
+
return dcmtTypes;
|
|
44
50
|
};
|
|
45
51
|
const isSAPDcmtTypeName = (dcmtTypeName) => {
|
|
46
52
|
if (!dcmtTypeName || dcmtTypeName.trim().length === 0)
|
|
@@ -51,5 +57,5 @@ export const TMDcmtTypeChooserForm = (props) => {
|
|
|
51
57
|
return false;
|
|
52
58
|
return true;
|
|
53
59
|
};
|
|
54
|
-
return (_jsx(TMChooserForm, { title: SDK_Localizator.ListDcmtTypeOrView, allowMultipleSelection:
|
|
60
|
+
return (_jsx(TMChooserForm, { title: SDK_Localizator.ListDcmtTypeOrView, allowMultipleSelection: allowMultipleSelection, hasShowOnlySelectedItems: true, width: width, height: height, selectedIDs: selectedIDs, cellRenderIcon: cellRenderIcon, cellRenderNameAndDesc: cellRenderNameAndDesc, dataSource: dataSource, getItems: getItems, onClose: onClose, onChoose: (IDs) => onChoose?.(IDs) }));
|
|
55
61
|
};
|
|
@@ -140,7 +140,7 @@ const TMRecentsManagerWrapper = ({ mruTIDs, currentTID, currentMruTID, deviceTyp
|
|
|
140
140
|
setToolbarButtonVisibility('tmDcmtForm', true);
|
|
141
141
|
}
|
|
142
142
|
}, [currentTID]);
|
|
143
|
-
return (_jsx(TMRecentsManager, { mruTIDs: mruTIDs, currentMruTID: currentMruTID, deviceType: deviceType, onSelectedTID: (tid) => {
|
|
143
|
+
return (_jsx(TMRecentsManager, { accessFilter: 'canArchive', mruTIDs: mruTIDs, currentMruTID: currentMruTID, deviceType: deviceType, onSelectedTID: (tid) => {
|
|
144
144
|
onSelectedTID?.(tid);
|
|
145
145
|
if (deviceType === DeviceType.MOBILE) {
|
|
146
146
|
setPanelVisibilityById('tmDcmtForm', true);
|
|
@@ -220,7 +220,7 @@ const TMTreeSelectorWrapper = ({ isMobile, onSelectedTIDChanged }) => {
|
|
|
220
220
|
};
|
|
221
221
|
const TMRecentsManagerWrapper = ({ mruTIDs, currentMruTID, deviceType, onSelectedTID, onDeletedTID }) => {
|
|
222
222
|
const { setPanelVisibilityById } = useTMPanelManagerContext();
|
|
223
|
-
return (_jsx(TMRecentsManager, { mruTIDs: mruTIDs, currentMruTID: currentMruTID, deviceType: deviceType, onSelectedTID: (tid) => {
|
|
223
|
+
return (_jsx(TMRecentsManager, { accessFilter: 'canSearch', mruTIDs: mruTIDs, currentMruTID: currentMruTID, deviceType: deviceType, onSelectedTID: (tid) => {
|
|
224
224
|
onSelectedTID?.(tid);
|
|
225
225
|
deviceType === DeviceType.MOBILE && setPanelVisibilityById('TMSearchQueryPanel', true);
|
|
226
226
|
}, onDeletedTID: (tid) => {
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { AccessFilter } from '@topconsultnpm/sdk-ts-beta';
|
|
2
3
|
import { DeviceType } from '../base/TMDeviceProvider';
|
|
3
4
|
interface ITMRecentsProps {
|
|
4
5
|
mruTIDs: number[];
|
|
5
6
|
currentMruTID?: number;
|
|
6
7
|
deviceType?: DeviceType;
|
|
8
|
+
accessFilter?: AccessFilter;
|
|
7
9
|
onSelectedTID?: (tid: number) => void;
|
|
8
10
|
onDeletedTID?: (tid: number) => void;
|
|
9
11
|
}
|
|
@@ -63,7 +63,7 @@ const StyledRecentTidItem = styled.div `
|
|
|
63
63
|
}
|
|
64
64
|
`;
|
|
65
65
|
const iconDelete = () => ReactDOMServer.renderToString(_jsx(IconDelete, {}));
|
|
66
|
-
const TMRecentsManager = ({ deviceType, mruTIDs, currentMruTID, onSelectedTID, onDeletedTID }) => {
|
|
66
|
+
const TMRecentsManager = ({ deviceType, mruTIDs, currentMruTID, accessFilter = 'all', onSelectedTID, onDeletedTID }) => {
|
|
67
67
|
const [showDcmtTypeChooser, setShowDcmtTypeChooser] = useState(false);
|
|
68
68
|
const [recentDcmtTypes, setRecentDcmtTypes] = useState([]);
|
|
69
69
|
const [infoDTD, setInfoDTD] = useState();
|
|
@@ -112,7 +112,7 @@ const TMRecentsManager = ({ deviceType, mruTIDs, currentMruTID, onSelectedTID, o
|
|
|
112
112
|
whiteSpace: 'nowrap',
|
|
113
113
|
overflow: 'hidden',
|
|
114
114
|
textOverflow: 'ellipsis'
|
|
115
|
-
}, children: `${SDKUI_Localizator.AllDcmtTypes} (${DcmtTypeListCacheService.CacheCount(true)})` }) }) }, 0), recentDcmtTypes.map((dtd) => {
|
|
115
|
+
}, children: `${SDKUI_Localizator.AllDcmtTypes} (${DcmtTypeListCacheService.CacheCount(true, accessFilter)})` }) }) }, 0), recentDcmtTypes.map((dtd) => {
|
|
116
116
|
const isCurrent = currentMruTID == dtd.id;
|
|
117
117
|
return (_jsxs(StyledRecentTidItem, { id: `tid-${dtd.id}`, "$isMobile": isMobile, onClick: () => { onSelectedTID?.(dtd.id ?? 0); }, children: [_jsxs(StyledDivHorizontal, { style: { alignItems: 'center', gap: 8, width: '100%' }, children: [!isMobile && (_jsx("span", { className: "info-icon", style: {
|
|
118
118
|
marginRight: 4,
|
|
@@ -149,6 +149,7 @@ const TMRecentsManager = ({ deviceType, mruTIDs, currentMruTID, onSelectedTID, o
|
|
|
149
149
|
}
|
|
150
150
|
] : [])
|
|
151
151
|
], target: `#tid-${dtd.id}` })] }, dtd.id));
|
|
152
|
-
})] }), showDcmtTypeChooser &&
|
|
152
|
+
})] }), showDcmtTypeChooser &&
|
|
153
|
+
_jsx(TMDcmtTypeChooserForm, { accessFilter: accessFilter, onClose: () => setShowDcmtTypeChooser(false), onChoose: (tids) => { onSelectedTID?.(tids?.[0] ?? 0); } }), _jsxs(StyledOffCanvasPanel, { ref: panelRef, "$isOpen": isMobile && infoDTD !== undefined, children: [_jsxs(StyledDivHorizontal, { style: { gap: 10, padding: '10px 8px', width: '100%', alignItems: 'center' }, children: [_jsx("p", { style: { fontSize: '1.1rem', fontWeight: 'bold' }, children: `${SDKUI_Localizator.DcmtType} - ${SDKUI_Localizator.About}` }), _jsx(IconCloseOutline, { style: { marginLeft: 'auto', cursor: 'pointer' }, onClick: () => setInfoDTD(undefined) })] }), renderDTDTooltipContent(infoDTD)] })] }));
|
|
153
154
|
};
|
|
154
155
|
export default TMRecentsManager;
|
|
@@ -267,7 +267,7 @@ const TMTidViewer = ({ tmSession, tid, did, showIcon = false, color, showId = fa
|
|
|
267
267
|
setDtd(undefined);
|
|
268
268
|
return;
|
|
269
269
|
}
|
|
270
|
-
let count = DcmtTypeListCacheService.CacheCount(true, tmSession);
|
|
270
|
+
let count = DcmtTypeListCacheService.CacheCount(true, 'all', tmSession);
|
|
271
271
|
if (count <= 0)
|
|
272
272
|
TMSpinner.show({ description: `${SDKUI_Localizator.Loading} - ${SDK_Localizator.ListDcmtTypeOrView} ...` });
|
|
273
273
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@topconsultnpm/sdkui-react-beta",
|
|
3
|
-
"version": "6.16.
|
|
3
|
+
"version": "6.16.89",
|
|
4
4
|
"description": "",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"lib"
|
|
40
40
|
],
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@topconsultnpm/sdk-ts-beta": "6.16.
|
|
42
|
+
"@topconsultnpm/sdk-ts-beta": "6.16.15",
|
|
43
43
|
"buffer": "^6.0.3",
|
|
44
44
|
"devextreme": "25.1.4",
|
|
45
45
|
"devextreme-react": "25.1.4",
|