@topconsultnpm/sdkui-react 6.22.0-dev2.30 → 6.22.0-dev2.31
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.
|
@@ -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)
|