@topconsultnpm/sdkui-react 6.22.0-dev2.30 → 6.22.0-dev2.32
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/features/search/TMSearch.js +4 -4
- package/lib/components/features/search/TMSearchQueryPanel.d.ts +1 -0
- package/lib/components/features/search/TMSearchQueryPanel.js +17 -2
- package/lib/helper/SDKUI_Globals.d.ts +8 -0
- package/lib/helper/SDKUI_Globals.js +17 -0
- package/lib/hooks/useShowDossiersV5.d.ts +12 -0
- package/lib/hooks/useShowDossiersV5.js +37 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/package.json +1 -1
|
@@ -208,10 +208,10 @@ const TMSearch = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTask
|
|
|
208
208
|
SDKUI_Globals.userSettings.searchSettings.mruTIDs = newMruTIDS;
|
|
209
209
|
setMruTIDs(newMruTIDS);
|
|
210
210
|
} }), [mruTIDs, currentMruTID, deviceType]);
|
|
211
|
-
const tmSearchQueryPanelElement = useMemo(() => _jsx(TMSearchQueryPanelWrapper, { passToArchiveCallback: passToArchiveCallback, isExpertMode: isExpertMode, showBackToResultButton: searchResult.length > 0, fromDTD: fromDTD, SQD: currentSQD, inputMids: inputMids, maxDcmtsToBeReturned: maxDcmtsToBeReturned, onBackToResult: () => { setCurrentSearchView(TMSearchViews.Result); }, onSearchCompleted: handleSearchCompleted, onSqdSaved: async (newSqd) => {
|
|
211
|
+
const tmSearchQueryPanelElement = useMemo(() => _jsx(TMSearchQueryPanelWrapper, { isSearchViewOnScreen: currentSearchView === TMSearchViews.Search, passToArchiveCallback: passToArchiveCallback, isExpertMode: isExpertMode, showBackToResultButton: searchResult.length > 0, fromDTD: fromDTD, SQD: currentSQD, inputMids: inputMids, maxDcmtsToBeReturned: maxDcmtsToBeReturned, onBackToResult: () => { setCurrentSearchView(TMSearchViews.Result); }, onSearchCompleted: handleSearchCompleted, onSqdSaved: async (newSqd) => {
|
|
212
212
|
await loadDataSQDsAsync(true, newSqd.masterTID);
|
|
213
213
|
await setSQDAsync(newSqd);
|
|
214
|
-
} }), [fromDTD, showSearchResults, setShowSearchResults, currentSQD, isExpertMode, mruTIDs, searchResult, passToArchiveCallback, inputMids, maxDcmtsToBeReturned, handleSearchCompleted]);
|
|
214
|
+
} }), [fromDTD, showSearchResults, setShowSearchResults, currentSQD, currentSearchView, isExpertMode, mruTIDs, searchResult, passToArchiveCallback, inputMids, maxDcmtsToBeReturned, handleSearchCompleted]);
|
|
215
215
|
const tmSavedQuerySelectorElement = useMemo(() => _jsxs(TabPanel, { width: "100%", height: "100%", showNavButtons: true, repaintChangesOnly: true, selectedIndex: currentSQDMode, onSelectedIndexChange: (index) => setCurrentSQDMode(index), children: [(currentTID || currentSQD) ? _jsx(Item, { title: fromDTD?.nameLoc, children: _jsx(TMSavedQuerySelectorWrapper, { allowShowSearch: false, items: filteredByTIDSQDs, selectedId: currentSQD?.id, onRefreshData: () => { loadDataSQDsAsync(true); }, onItemClick: (sqd) => {
|
|
216
216
|
onSQDItemClick(sqd, setSQDAsync);
|
|
217
217
|
}, onDeleted: (sqd) => onSQDDeleted(sqd, sqd.id == currentSQD?.id ? filteredByTIDSQDs.find(o => o.id == 1) : currentSQD, setSQDAsync), refreshFavoriteSavedQueries: refreshFavoriteSavedQueries }) }) : _jsx(_Fragment, {}), _jsx(Item, { title: SDKUI_Localizator.AllFemale, children: _jsx(TMSavedQuerySelectorWrapper, { allowShowSearch: true, items: allSQDs, manageDefault: false, onItemClick: (sqd) => {
|
|
@@ -298,11 +298,11 @@ const TMRecentsManagerWrapper = ({ mruTIDs, currentMruTID, deviceType, onSelecte
|
|
|
298
298
|
onDeletedTID?.(tid);
|
|
299
299
|
} }));
|
|
300
300
|
};
|
|
301
|
-
const TMSearchQueryPanelWrapper = ({ fromDTD, SQD, isExpertMode, showBackToResultButton, onSearchCompleted, onSqdSaved, onBackToResult, passToArchiveCallback, inputMids, maxDcmtsToBeReturned }) => {
|
|
301
|
+
const TMSearchQueryPanelWrapper = ({ isSearchViewOnScreen, fromDTD, SQD, isExpertMode, showBackToResultButton, onSearchCompleted, onSqdSaved, onBackToResult, passToArchiveCallback, inputMids, maxDcmtsToBeReturned }) => {
|
|
302
302
|
const { setPanelVisibilityById, toggleMaximize, countVisibleLeafPanels } = useTMPanelManagerContext();
|
|
303
303
|
const deviceType = useDeviceType();
|
|
304
304
|
const isMobile = deviceType === DeviceType.MOBILE;
|
|
305
|
-
return (_jsx(TMSearchQueryPanel, { onClosePanel: (!isMobile && countVisibleLeafPanels() > 1) ? () => setPanelVisibilityById('TMSearchQueryPanel', false) : undefined, allowMaximize: !isMobile && countVisibleLeafPanels() > 1, onMaximizePanel: (!isMobile && countVisibleLeafPanels() > 1) ? () => toggleMaximize("TMSearchQueryPanel") : undefined, isExpertMode: isExpertMode, fromDTD: fromDTD, SQD: SQD, inputMids: inputMids, onSearchCompleted: onSearchCompleted, onSqdSaved: onSqdSaved, showBackToResultButton: showBackToResultButton, onBackToResult: onBackToResult, passToArchiveCallback: passToArchiveCallback, maxDcmtsToBeReturned: maxDcmtsToBeReturned }));
|
|
305
|
+
return (_jsx(TMSearchQueryPanel, { isSearchViewOnScreen: isSearchViewOnScreen, onClosePanel: (!isMobile && countVisibleLeafPanels() > 1) ? () => setPanelVisibilityById('TMSearchQueryPanel', false) : undefined, allowMaximize: !isMobile && countVisibleLeafPanels() > 1, onMaximizePanel: (!isMobile && countVisibleLeafPanels() > 1) ? () => toggleMaximize("TMSearchQueryPanel") : undefined, isExpertMode: isExpertMode, fromDTD: fromDTD, SQD: SQD, inputMids: inputMids, onSearchCompleted: onSearchCompleted, onSqdSaved: onSqdSaved, showBackToResultButton: showBackToResultButton, onBackToResult: onBackToResult, passToArchiveCallback: passToArchiveCallback, maxDcmtsToBeReturned: maxDcmtsToBeReturned }));
|
|
306
306
|
};
|
|
307
307
|
const TMSavedQuerySelectorWrapper = ({ items, selectedId, allowShowSearch, manageDefault, onRefreshData, onItemClick, onDeleted, refreshFavoriteSavedQueries }) => {
|
|
308
308
|
const { setPanelVisibilityById } = useTMPanelManagerContext();
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { DcmtTypeDescriptor, QueryDescriptor, SavedQueryDescriptor, SearchResultDescriptor } from '@topconsultnpm/sdk-ts';
|
|
3
3
|
interface ITMSearchQueryPanelProps {
|
|
4
|
+
isSearchViewOnScreen?: boolean;
|
|
4
5
|
fromDTD?: DcmtTypeDescriptor;
|
|
5
6
|
SQD?: SavedQueryDescriptor;
|
|
6
7
|
isExpertMode?: boolean;
|
|
@@ -24,7 +24,7 @@ import TMToppyMessage from '../../../helper/TMToppyMessage';
|
|
|
24
24
|
import TMMetadataSorterForm from './TMMetadataSorterForm';
|
|
25
25
|
import TMMetadataOutputForm from './TMMetadataOutputForm';
|
|
26
26
|
import TMTooltip from '../../base/TMTooltip';
|
|
27
|
-
const TMSearchQueryPanel = ({ fromDTD, showBackToResultButton, isExpertMode = SDKUI_Globals.userSettings.advancedSettings.expertMode === 1, SQD, inputMids, onSearchCompleted, onSqdSaved, onBack, onClosePanel, allowMaximize = true, onMaximizePanel, onBackToResult, passToArchiveCallback, maxDcmtsToBeReturned }) => {
|
|
27
|
+
const TMSearchQueryPanel = ({ isSearchViewOnScreen = true, fromDTD, showBackToResultButton, isExpertMode = SDKUI_Globals.userSettings.advancedSettings.expertMode === 1, SQD, inputMids, onSearchCompleted, onSqdSaved, onBack, onClosePanel, allowMaximize = true, onMaximizePanel, onBackToResult, passToArchiveCallback, maxDcmtsToBeReturned }) => {
|
|
28
28
|
const [confirmQueryParams, ConfirmQueryParamsDialog] = useQueryParametersDialog();
|
|
29
29
|
const [qd, setQd] = useState();
|
|
30
30
|
const [shouldSearch, setShouldSearch] = useState(false);
|
|
@@ -44,10 +44,25 @@ const TMSearchQueryPanel = ({ fromDTD, showBackToResultButton, isExpertMode = SD
|
|
|
44
44
|
const deviceType = useDeviceType();
|
|
45
45
|
const isMobile = deviceType === DeviceType.MOBILE;
|
|
46
46
|
let initialMaxItems = deviceType === DeviceType.MOBILE ? 8 : 12;
|
|
47
|
+
const tmPanelRef = useRef(null);
|
|
48
|
+
// Passando nella vista risultati si prenota il focus, che verrà ripreso al rientro nella ricerca
|
|
49
|
+
const shouldRefocusOnReturnRef = useRef(false);
|
|
47
50
|
const appliedInputMidsRef = useRef(null);
|
|
48
51
|
const pendingMidsRef = useRef(null);
|
|
49
52
|
// Flag "accoda": impostato dall'azione secondaria del bottone Ricerca, consumato in executeSearch
|
|
50
53
|
const appendNextSearchRef = useRef(false);
|
|
54
|
+
// Tornando dalla vista risultati il pannello dei metadati di ricerca riprende il focus,
|
|
55
|
+
// così è lui quello evidenziato: prendendo il focus gli altri pannelli ricevono l'onBlur e si disattivano
|
|
56
|
+
useEffect(() => {
|
|
57
|
+
if (!isSearchViewOnScreen) {
|
|
58
|
+
shouldRefocusOnReturnRef.current = true;
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
if (!shouldRefocusOnReturnRef.current)
|
|
62
|
+
return;
|
|
63
|
+
shouldRefocusOnReturnRef.current = false;
|
|
64
|
+
tmPanelRef.current?.focusPanel();
|
|
65
|
+
}, [isSearchViewOnScreen]);
|
|
51
66
|
useEffect(() => {
|
|
52
67
|
if (!SQD)
|
|
53
68
|
return;
|
|
@@ -342,7 +357,7 @@ const TMSearchQueryPanel = ({ fromDTD, showBackToResultButton, isExpertMode = SD
|
|
|
342
357
|
return false;
|
|
343
358
|
return qd?.orderBy && qd.orderBy.length > 0;
|
|
344
359
|
}, [showAdvancedSearch, qd?.orderBy]);
|
|
345
|
-
return (_jsxs(_Fragment, { children: [_jsxs(TMPanel, { title: fromDTD?.nameLoc ?? SDKUI_Localizator.Search_Metadata, allowMaximize: allowMaximize, onMaximize: onMaximizePanel, onHeaderDoubleClick: onMaximizePanel, onBack: onBack, onActiveChanged: handlePanelActiveChanged, toolbar: _jsx(_Fragment, { children: (SQD && !showSqdForm) ?
|
|
360
|
+
return (_jsxs(_Fragment, { children: [_jsxs(TMPanel, { ref: tmPanelRef, title: fromDTD?.nameLoc ?? SDKUI_Localizator.Search_Metadata, allowMaximize: allowMaximize, onMaximize: onMaximizePanel, onHeaderDoubleClick: onMaximizePanel, onBack: onBack, onActiveChanged: handlePanelActiveChanged, toolbar: _jsx(_Fragment, { children: (SQD && !showSqdForm) ?
|
|
346
361
|
_jsx(ContextMenu, { items: contextMenuItems, trigger: "left", children: _jsx(TMButton, { btnStyle: 'icon', caption: 'Altro', icon: _jsx(IconMenuVertical, { color: 'white' }), showTooltip: false, onClick: () => setIsQueryPanelActive(true) }) })
|
|
347
362
|
: _jsx(_Fragment, {}) }), children: [_jsx(ConfirmQueryParamsDialog, {}), SQD
|
|
348
363
|
? _jsxs("div", { onContextMenu: (e) => e.preventDefault(), style: { height: '100%', width: '100%', position: 'relative', display: showSqdForm ? 'none' : 'flex', flexDirection: 'column', gap: 5 }, children: [showAdvancedSearch
|
|
@@ -190,13 +190,21 @@ export declare class DevSettings {
|
|
|
190
190
|
export declare class AdvancedSettings {
|
|
191
191
|
private _expertMode;
|
|
192
192
|
private _scannerLicense;
|
|
193
|
+
private _showDossiersV5;
|
|
193
194
|
get expertMode(): number;
|
|
194
195
|
set expertMode(value: number);
|
|
195
196
|
get scannerLicense(): string;
|
|
196
197
|
set scannerLicense(value: string);
|
|
198
|
+
/**
|
|
199
|
+
* Mostra le pratiche "V5" (i dossier) accanto al CaseFlow che le sostituisce.
|
|
200
|
+
* 0 = nascoste (default), 1 = visibili.
|
|
201
|
+
*/
|
|
202
|
+
get showDossiersV5(): number;
|
|
203
|
+
set showDossiersV5(value: number);
|
|
197
204
|
toJSON(): {
|
|
198
205
|
expertMode: number;
|
|
199
206
|
scannerLicense: string;
|
|
207
|
+
showDossiersV5: number;
|
|
200
208
|
};
|
|
201
209
|
}
|
|
202
210
|
export declare class CtrlWfSettings {
|
|
@@ -286,6 +286,7 @@ export class AdvancedSettings {
|
|
|
286
286
|
constructor() {
|
|
287
287
|
this._expertMode = 0;
|
|
288
288
|
this._scannerLicense = '';
|
|
289
|
+
this._showDossiersV5 = 0;
|
|
289
290
|
}
|
|
290
291
|
get expertMode() {
|
|
291
292
|
return this._expertMode;
|
|
@@ -304,11 +305,27 @@ export class AdvancedSettings {
|
|
|
304
305
|
set scannerLicense(value) {
|
|
305
306
|
this._scannerLicense = value;
|
|
306
307
|
}
|
|
308
|
+
/**
|
|
309
|
+
* Mostra le pratiche "V5" (i dossier) accanto al CaseFlow che le sostituisce.
|
|
310
|
+
* 0 = nascoste (default), 1 = visibili.
|
|
311
|
+
*/
|
|
312
|
+
get showDossiersV5() {
|
|
313
|
+
return this._showDossiersV5;
|
|
314
|
+
}
|
|
315
|
+
set showDossiersV5(value) {
|
|
316
|
+
if (this._showDossiersV5 !== value) {
|
|
317
|
+
this._showDossiersV5 = value;
|
|
318
|
+
// Come per expertMode: chi mostra la funzione può reagire subito.
|
|
319
|
+
const event = new CustomEvent('showDossiersV5Changed', { detail: value });
|
|
320
|
+
window.dispatchEvent(event);
|
|
321
|
+
}
|
|
322
|
+
}
|
|
307
323
|
// Override toJSON to control serialization (called by JSON.stringify)
|
|
308
324
|
toJSON() {
|
|
309
325
|
return {
|
|
310
326
|
expertMode: this._expertMode,
|
|
311
327
|
scannerLicense: this._scannerLicense,
|
|
328
|
+
showDossiersV5: this._showDossiersV5,
|
|
312
329
|
};
|
|
313
330
|
}
|
|
314
331
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Impostazione avanzata "Mostra pratiche V5": le pratiche (i dossier) sono
|
|
3
|
+
* sostituite dal CaseFlow e restano nascoste finché l'utente non le riattiva.
|
|
4
|
+
*
|
|
5
|
+
* Il valore vive in `SDKUI_Globals.userSettings.advancedSettings`, quindi la
|
|
6
|
+
* persistenza è quella delle altre impostazioni utente (per archivio e utente).
|
|
7
|
+
*/
|
|
8
|
+
export declare const SHOW_DOSSIERS_V5_CHANGED_EVENT = "showDossiersV5Changed";
|
|
9
|
+
export declare const getShowDossiersV5: () => boolean;
|
|
10
|
+
export declare const setShowDossiersV5: (value: boolean) => void;
|
|
11
|
+
/** Legge l'impostazione e si aggiorna quando cambia. */
|
|
12
|
+
export declare const useShowDossiersV5: () => boolean;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
import { SDK_Globals } from '@topconsultnpm/sdk-ts';
|
|
3
|
+
import { SDKUI_Globals } from '../helper';
|
|
4
|
+
/**
|
|
5
|
+
* Impostazione avanzata "Mostra pratiche V5": le pratiche (i dossier) sono
|
|
6
|
+
* sostituite dal CaseFlow e restano nascoste finché l'utente non le riattiva.
|
|
7
|
+
*
|
|
8
|
+
* Il valore vive in `SDKUI_Globals.userSettings.advancedSettings`, quindi la
|
|
9
|
+
* persistenza è quella delle altre impostazioni utente (per archivio e utente).
|
|
10
|
+
*/
|
|
11
|
+
export const SHOW_DOSSIERS_V5_CHANGED_EVENT = 'showDossiersV5Changed';
|
|
12
|
+
export const getShowDossiersV5 = () => {
|
|
13
|
+
return SDKUI_Globals.userSettings.advancedSettings?.showDossiersV5 === 1;
|
|
14
|
+
};
|
|
15
|
+
export const setShowDossiersV5 = (value) => {
|
|
16
|
+
SDKUI_Globals.userSettings.advancedSettings.showDossiersV5 = value ? 1 : 0;
|
|
17
|
+
// Il setter di AdvancedSettings emette l'evento, ma dopo un ricaricamento
|
|
18
|
+
// della pagina `advancedSettings` torna da localStorage come oggetto
|
|
19
|
+
// semplice e non lo emette più: lo lanciamo anche qui, così i consumatori
|
|
20
|
+
// non dipendono da quale delle due forme è in memoria.
|
|
21
|
+
globalThis.dispatchEvent(new CustomEvent(SHOW_DOSSIERS_V5_CHANGED_EVENT, { detail: value }));
|
|
22
|
+
};
|
|
23
|
+
/** Legge l'impostazione e si aggiorna quando cambia. */
|
|
24
|
+
export const useShowDossiersV5 = () => {
|
|
25
|
+
const sessionDescr = SDK_Globals.tmSession?.SessionDescr;
|
|
26
|
+
const archiveId = sessionDescr?.archiveID;
|
|
27
|
+
const userId = sessionDescr?.userID;
|
|
28
|
+
const [showDossiersV5, setValue] = useState(getShowDossiersV5);
|
|
29
|
+
// Le impostazioni sono per utente e archivio: al cambio sessione va riletto.
|
|
30
|
+
useEffect(() => { setValue(getShowDossiersV5()); }, [archiveId, userId]);
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
const onChanged = () => setValue(getShowDossiersV5());
|
|
33
|
+
globalThis.addEventListener(SHOW_DOSSIERS_V5_CHANGED_EVENT, onChanged);
|
|
34
|
+
return () => globalThis.removeEventListener(SHOW_DOSSIERS_V5_CHANGED_EVENT, onChanged);
|
|
35
|
+
}, []);
|
|
36
|
+
return showDossiersV5;
|
|
37
|
+
};
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -12,6 +12,7 @@ export * from './hooks/useCaseFlowApprove';
|
|
|
12
12
|
export * from './hooks/useRelatedDocuments';
|
|
13
13
|
export * from './hooks/useSettingsFeedback';
|
|
14
14
|
export * from './hooks/useBetaFeatures';
|
|
15
|
+
export * from './hooks/useShowDossiersV5';
|
|
15
16
|
export * from './services';
|
|
16
17
|
import config from 'devextreme/core/config';
|
|
17
18
|
// DevExtreme License Key (valid for v25.2 and earlier versions)
|