@arsedizioni/ars-utils 22.5.11 → 22.5.12
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/README.md
CHANGED
|
@@ -48,7 +48,7 @@ di vita proprio vive nel suo entry point. Importare sempre dal path specifico.
|
|
|
48
48
|
| L2 | `ui.tinymce` | `TinymceEditorDirective`, `TinymceLoaderService`, `TinymceUtils`, `TinyMceEditorComponent`, `langs/it.js` | `tinymce` (caricato a runtime) |
|
|
49
49
|
| L2 | `ui.notifications` | `NotificationsBrowserComponent` (ex `support.ui`) | - |
|
|
50
50
|
| L2 | `clipper.common` | `ClipperService`, documents, login, canali e contatori non letti, interceptor auth | solo il necessario a consultare i documenti |
|
|
51
|
-
| L4 | `clipper.ui` | browser, document, references, search-* e `
|
|
51
|
+
| L4 | `clipper.ui` | browser, document, references, search-* e `ClipperDocumentUtilsService` | `clipper.scss` |
|
|
52
52
|
|
|
53
53
|
I peer dependency opzionali (`@azure/msal-*`, `tinymce`) servono
|
|
54
54
|
solo a chi importa rispettivamente `ui.oauth` e `ui.tinymce`: sono dichiarati in
|
|
@@ -2,7 +2,7 @@ import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout';
|
|
|
2
2
|
import * as i6 from '@angular/cdk/scrolling';
|
|
3
3
|
import { ScrollDispatcher, ScrollingModule } from '@angular/cdk/scrolling';
|
|
4
4
|
import * as i0 from '@angular/core';
|
|
5
|
-
import { viewChild, inject, Renderer2, input, computed, ChangeDetectionStrategy, Component, output, ChangeDetectorRef, signal,
|
|
5
|
+
import { viewChild, inject, Renderer2, input, computed, ChangeDetectionStrategy, Component, output, ChangeDetectorRef, signal, Service, DestroyRef, model, afterNextRender, effect, untracked } from '@angular/core';
|
|
6
6
|
import { toSignal, toObservable, takeUntilDestroyed, outputToObservable } from '@angular/core/rxjs-interop';
|
|
7
7
|
import * as i1$2 from '@angular/forms';
|
|
8
8
|
import { FormsModule } from '@angular/forms';
|
|
@@ -958,10 +958,23 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
|
|
|
958
958
|
}]
|
|
959
959
|
}], propDecorators: { populateContacts: [{ type: i0.Output, args: ["populateContacts"] }] } });
|
|
960
960
|
|
|
961
|
-
|
|
961
|
+
/**
|
|
962
|
+
* Opens the Clipper document viewer.
|
|
963
|
+
*
|
|
964
|
+
* It used to be a static method taking an `Injector` and resolving its dependencies through
|
|
965
|
+
* `runInInjectionContext`. That is the escape hatch for code that cannot do DI, and both callers
|
|
966
|
+
* here are components — they were injecting an `Injector` for the sole purpose of handing it over.
|
|
967
|
+
* As a service the dependencies are resolved at field level, which also removes a trap: the
|
|
968
|
+
* asynchronous continuation after the dynamic `import()` is outside the injection context, so an
|
|
969
|
+
* `inject()` added in there would have failed at runtime.
|
|
970
|
+
*/
|
|
971
|
+
class ClipperDocumentUtilsService {
|
|
972
|
+
constructor() {
|
|
973
|
+
this.dialogService = inject(DialogService);
|
|
974
|
+
this.clipperService = inject(ClipperService);
|
|
975
|
+
}
|
|
962
976
|
/**
|
|
963
977
|
* Opens the Clipper document viewer dialog for the given document.
|
|
964
|
-
* @param injector - The Angular injector used to resolve `DialogService` and `ClipperService`.
|
|
965
978
|
* @param documentId - The ID of the document to open.
|
|
966
979
|
* @param query - The search query string used for term highlighting.
|
|
967
980
|
* @param queryChunks - Pipe-separated highlight chunks (e.g. "|1|2|3...").
|
|
@@ -971,54 +984,67 @@ class ClipperDocumentsUtils {
|
|
|
971
984
|
* @param canHandleTooManyResults - When `true`, the component handles oversized result sets.
|
|
972
985
|
* @param replaceUrl - When provided, after the dialog closes the method calls `window.close()`
|
|
973
986
|
* if the page was opened by another window, or navigates to this URL otherwise.
|
|
987
|
+
* @returns void
|
|
974
988
|
*/
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
ref.beforeClosed().subscribe(() => {
|
|
1009
|
-
setTimeout(() => {
|
|
1010
|
-
if (window.opener !== null) {
|
|
1011
|
-
window.close();
|
|
1012
|
-
}
|
|
1013
|
-
else {
|
|
1014
|
-
window.location.replace(replaceUrl);
|
|
1015
|
-
}
|
|
1016
|
-
}, 500);
|
|
1017
|
-
});
|
|
1018
|
-
}
|
|
989
|
+
openDocument(documentId, query, queryChunks, selectionMode, selectableModules, theme, canHandleTooManyResults, replaceUrl) {
|
|
990
|
+
if (!this.clipperService.loggedIn()) {
|
|
991
|
+
this.dialogService.error("Clipper non è disponibile in questo momento. Verifica la connessione.");
|
|
992
|
+
return;
|
|
993
|
+
}
|
|
994
|
+
if (!documentId) {
|
|
995
|
+
this.dialogService.error("Documento non valido.");
|
|
996
|
+
return;
|
|
997
|
+
}
|
|
998
|
+
// NB: `import()` here does NOT make the viewer lazy. ng-packagr flattens every file of an
|
|
999
|
+
// entry point into one FESM module, so a dynamic import of a sibling is inlined at build time
|
|
1000
|
+
// (the cross-entry-point ones in `ui.application` are the ones that survive). It stays as an
|
|
1001
|
+
// import() only because it keeps the module graph honest; to load the viewer on demand for
|
|
1002
|
+
// real it would have to live in an entry point of its own.
|
|
1003
|
+
Promise.resolve().then(function () { return document_component; }).then(({ ClipperDocumentComponent }) => {
|
|
1004
|
+
const ref = this.dialogService.open(ClipperDocumentComponent, {
|
|
1005
|
+
ariaLabel: 'documento',
|
|
1006
|
+
autoFocus: 'dialog',
|
|
1007
|
+
restoreFocus: false,
|
|
1008
|
+
disableClose: false,
|
|
1009
|
+
data: {
|
|
1010
|
+
id: documentId,
|
|
1011
|
+
query: query,
|
|
1012
|
+
queryChunks: queryChunks,
|
|
1013
|
+
selectionMode: selectionMode,
|
|
1014
|
+
selectableModules: selectableModules,
|
|
1015
|
+
theme: theme,
|
|
1016
|
+
canHandleTooManyResults: canHandleTooManyResults
|
|
1017
|
+
},
|
|
1018
|
+
minWidth: '375px',
|
|
1019
|
+
maxWidth: '1400px',
|
|
1020
|
+
width: '100%',
|
|
1021
|
+
height: '100%'
|
|
1019
1022
|
});
|
|
1023
|
+
if (replaceUrl && ref) {
|
|
1024
|
+
ref.beforeClosed().subscribe(() => {
|
|
1025
|
+
setTimeout(() => {
|
|
1026
|
+
if (window.opener !== null) {
|
|
1027
|
+
window.close();
|
|
1028
|
+
}
|
|
1029
|
+
else {
|
|
1030
|
+
window.location.replace(replaceUrl);
|
|
1031
|
+
}
|
|
1032
|
+
}, 500);
|
|
1033
|
+
});
|
|
1034
|
+
}
|
|
1020
1035
|
});
|
|
1021
1036
|
}
|
|
1037
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ClipperDocumentUtilsService, deps: [], target: i0.ɵɵFactoryTarget.Service }); }
|
|
1038
|
+
static { this.ɵprov = i0.ɵɵngDeclareService({ minVersion: "22.0.0", version: "22.1.3", ngImport: i0, type: ClipperDocumentUtilsService }); }
|
|
1039
|
+
}
|
|
1040
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ClipperDocumentUtilsService, decorators: [{
|
|
1041
|
+
type: Service
|
|
1042
|
+
}] });
|
|
1043
|
+
/**
|
|
1044
|
+
* Pure helpers on document data. Deliberately NOT a service: there is nothing to inject, and a
|
|
1045
|
+
* string function that needs an injector to be called is a function nobody can call from a test.
|
|
1046
|
+
*/
|
|
1047
|
+
class ClipperDocumentsUtils {
|
|
1022
1048
|
/**
|
|
1023
1049
|
* Extracts the display title from a full document title by stripping any trailing `[...]` suffix.
|
|
1024
1050
|
* @param title - The full document title, which may contain a bracketed qualifier.
|
|
@@ -1044,7 +1070,7 @@ class ClipperSearchResultManager extends ClipperDocumentManager {
|
|
|
1044
1070
|
this.destroyRef = inject(DestroyRef);
|
|
1045
1071
|
this.changeDetector = inject(ChangeDetectorRef);
|
|
1046
1072
|
this.breakpointObserver = inject(BreakpointObserver);
|
|
1047
|
-
this.
|
|
1073
|
+
this.documentUtils = inject(ClipperDocumentUtilsService);
|
|
1048
1074
|
this.themeService = inject(ThemeService);
|
|
1049
1075
|
this.screenService = inject(ScreenService);
|
|
1050
1076
|
this.selectionMode = signal(ClipperSelectionMode.None, /* @ts-ignore */
|
|
@@ -1518,7 +1544,7 @@ class ClipperSearchResultManager extends ClipperDocumentManager {
|
|
|
1518
1544
|
if (((this.filterParams.flags ?? 0) & ClipperQueryDocumentFlags.UseSemanticSearch) > 0) {
|
|
1519
1545
|
query = '$' + query;
|
|
1520
1546
|
}
|
|
1521
|
-
|
|
1547
|
+
this.documentUtils.openDocument(documentId, query, queryChunks, this.selectionMode(), undefined, this.themeService.getTheme(), this.canHandleTooManyResults());
|
|
1522
1548
|
}
|
|
1523
1549
|
///
|
|
1524
1550
|
// Restorable
|
|
@@ -3058,7 +3084,7 @@ class ClipperDocumentComponent extends ClipperDocumentManager {
|
|
|
3058
3084
|
this.closing = output();
|
|
3059
3085
|
this.opening = output();
|
|
3060
3086
|
this.destroyRef = inject(DestroyRef);
|
|
3061
|
-
this.
|
|
3087
|
+
this.documentUtils = inject(ClipperDocumentUtilsService);
|
|
3062
3088
|
this.breakpointObserver = inject(BreakpointObserver);
|
|
3063
3089
|
this.renderer = inject(Renderer2);
|
|
3064
3090
|
this.router = inject(Router);
|
|
@@ -3702,7 +3728,7 @@ class ClipperDocumentComponent extends ClipperDocumentManager {
|
|
|
3702
3728
|
}
|
|
3703
3729
|
}
|
|
3704
3730
|
/**
|
|
3705
|
-
* Opens a document inline via the {@link
|
|
3731
|
+
* Opens a document inline via the {@link ClipperDocumentUtilsService}.
|
|
3706
3732
|
* @param documentId - The id of the document to open.
|
|
3707
3733
|
* @param query - Optional free-text query for highlight.
|
|
3708
3734
|
* @param queryChunks - Optional chunk offsets for semantic highlight.
|
|
@@ -3710,7 +3736,7 @@ class ClipperDocumentComponent extends ClipperDocumentManager {
|
|
|
3710
3736
|
openDocument(documentId, query, queryChunks) {
|
|
3711
3737
|
if (!documentId)
|
|
3712
3738
|
return;
|
|
3713
|
-
|
|
3739
|
+
this.documentUtils.openDocument(documentId, query, queryChunks, this.dialogData.selectionMode, this.dialogData.selectableModules, this.dialogData.theme, this.dialogData.canHandleTooManyResults);
|
|
3714
3740
|
}
|
|
3715
3741
|
/**
|
|
3716
3742
|
* Opens the references panel for the given document.
|
|
@@ -4497,5 +4523,5 @@ var searchFreeTextQueryBuilder_component = /*#__PURE__*/Object.freeze({
|
|
|
4497
4523
|
* Generated bundle index. Do not edit.
|
|
4498
4524
|
*/
|
|
4499
4525
|
|
|
4500
|
-
export { ClipperBrowserComponent, ClipperBrowserDialogComponent, ClipperDocumentComponent, ClipperDocumentIndexComponent, ClipperDocumentManager, ClipperDocumentMenuComponent, ClipperDocumentsUtils, ClipperReferencesComponent, ClipperSearchCalendarComponent, ClipperSearchFacetsComponent, ClipperSearchFreeTextHelpComponent, ClipperSearchFreeTextQueryBuilderComponent, ClipperSearchResultItemComponent, ClipperSearchResultItemDisplayMode, ClipperSearchResultManager };
|
|
4526
|
+
export { ClipperBrowserComponent, ClipperBrowserDialogComponent, ClipperDocumentComponent, ClipperDocumentIndexComponent, ClipperDocumentManager, ClipperDocumentMenuComponent, ClipperDocumentUtilsService, ClipperDocumentsUtils, ClipperReferencesComponent, ClipperSearchCalendarComponent, ClipperSearchFacetsComponent, ClipperSearchFreeTextHelpComponent, ClipperSearchFreeTextQueryBuilderComponent, ClipperSearchResultItemComponent, ClipperSearchResultItemDisplayMode, ClipperSearchResultManager };
|
|
4501
4527
|
//# sourceMappingURL=arsedizioni-ars-utils-clipper.ui.mjs.map
|