@arsedizioni/ars-utils 19.1.29 → 19.1.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.
@@ -1,6 +1,6 @@
1
1
  import { MatDialogRef } from '@angular/material/dialog';
2
2
  import { DialogService } from '@arsedizioni/ars-utils/ui';
3
- import { ClipperModule, ClipperService } from '@arsedizioni/ars-utils/clipper.common';
3
+ import { ClipperModule, ClipperSelectionMode, ClipperService } from '@arsedizioni/ars-utils/clipper.common';
4
4
  import { ClipperDocumentComponent } from './ui/document/document.component';
5
5
  import { ThemeType } from '@arsedizioni/ars-utils/core';
6
6
  export declare class ClipperDocumentsUtils {
@@ -13,7 +13,7 @@ export declare class ClipperDocumentsUtils {
13
13
  * @param selectionMode : the selection mode (1 = single, 2 = multiple, 3 = any selection)
14
14
  * @param theme: the theme to use. Default is system
15
15
  */
16
- static openDocument(dialogService: DialogService, clipperService: ClipperService, documentId: string, query?: string | null | undefined, selectionMode?: number | null, selectableModules?: ClipperModule[] | null, theme?: ThemeType | null): MatDialogRef<ClipperDocumentComponent> | null;
16
+ static openDocument(dialogService: DialogService, clipperService: ClipperService, documentId: string, query?: string | null | undefined, selectionMode?: ClipperSelectionMode | null, selectableModules?: ClipperModule[] | null, theme?: ThemeType | null): MatDialogRef<ClipperDocumentComponent> | null;
17
17
  /**
18
18
  * Extract document title
19
19
  * @param title : the full document title
@@ -1,11 +1,11 @@
1
1
  import { OnDestroy, OnInit } from '@angular/core';
2
2
  import { MatDrawer } from '@angular/material/sidenav';
3
- import { ClipperDocumentAnchorInfo, ClipperDocumentInfo, ClipperDocumentRelevants, ClipperModule, ClipperQueryReferencesMode, ClipperUserInfo } from '@arsedizioni/ars-utils/clipper.common';
3
+ import { ClipperDocumentAnchorInfo, ClipperDocumentInfo, ClipperDocumentRelevants, ClipperModule, ClipperQueryReferencesMode, ClipperSelectionMode, ClipperUserInfo } from '@arsedizioni/ars-utils/clipper.common';
4
4
  import { ThemeType } from '@arsedizioni/ars-utils/core';
5
5
  import { ClipperDocumentManager } from '../document-manager/document-manager';
6
6
  import * as i0 from "@angular/core";
7
7
  export interface ClipperDocumentDialogData {
8
- selectionMode?: number | null;
8
+ selectionMode?: ClipperSelectionMode | null;
9
9
  selectableModules?: ClipperModule[] | null;
10
10
  id: string;
11
11
  query?: string | null;
@@ -13,7 +13,7 @@ export declare class ClipperDocumentMenuComponent implements OnInit, OnDestroy {
13
13
  private changeDetector;
14
14
  private clipperService;
15
15
  readonly useSelections: import("@angular/core").InputSignal<boolean>;
16
- readonly selectionSource: import("@angular/core").InputSignal<"selection" | "bag" | "none">;
16
+ readonly selectionSource: import("@angular/core").InputSignal<"none" | "selection" | "bag">;
17
17
  protected selection: () => ClipperDocumentInfo[];
18
18
  readonly parent: import("@angular/core").InputSignal<ClipperSearchResultManager>;
19
19
  readonly item: import("@angular/core").InputSignal<ClipperDocumentInfo>;
@@ -1445,11 +1445,15 @@ class ClipperDocumentComponent extends ClipperDocumentManager {
1445
1445
  * Checks if documents can be selected and returned as message
1446
1446
  */
1447
1447
  canSelect() {
1448
- return (this.dialogData.selectionMode ?? 0) > 0 &&
1448
+ console.log(this.dialogData.selectionMode);
1449
+ console.log(this.dialogData.selectableModules?.length ?? 0);
1450
+ const canSelect = (this.dialogData.selectionMode ?? 0) > 0 &&
1449
1451
  this.lastDocument &&
1450
1452
  (this.dialogData.selectableModules?.length ?? 0) === 0
1451
1453
  ? (this.lastDocument?.model === ClipperModel.NormativaVigente || this.lastDocument?.model === ClipperModel.AggiornamentoNormativo)
1452
1454
  : (this.dialogData.selectableModules?.findIndex(x => x === ClipperUtils.getClipperModuleFromModel(this.lastDocument)) !== -1);
1455
+ console.log(canSelect);
1456
+ return canSelect;
1453
1457
  }
1454
1458
  /**
1455
1459
  * Send a message with current selection and close dialog
@@ -2290,6 +2294,7 @@ class ClipperSearchResultManager extends ClipperDocumentManager {
2290
2294
  openDocument(documentId, query = null) {
2291
2295
  if (!documentId)
2292
2296
  return;
2297
+ console.log(this.selectionMode());
2293
2298
  ClipperDocumentsUtils.openDocument(this.dialogService.baseService, this.clipperService, documentId, query ?? this.filterParams.expandTextQueryUsingAI
2294
2299
  ? (this.filterParams.augmentedText ?? this.filterParams.text)
2295
2300
  : this.filterParams.text, this.selectionMode(), null, this.themeService.getTheme());
@@ -3923,11 +3928,11 @@ class ClipperBrowserDialogComponent {
3923
3928
  canSelect() {
3924
3929
  const selection = this.clipperBrowser().selection;
3925
3930
  let allow = selection &&
3926
- ((this.dialogData.selectionMode === 1 &&
3931
+ ((this.dialogData.selectionMode === ClipperSelectionMode.Single &&
3927
3932
  selection.current.selected.length === 1) ||
3928
- (this.dialogData.selectionMode === 2 &&
3933
+ (this.dialogData.selectionMode === ClipperSelectionMode.Multi &&
3929
3934
  selection.current.selected.length > 1) ||
3930
- (this.dialogData.selectionMode === 3 &&
3935
+ (this.dialogData.selectionMode === ClipperSelectionMode.Any &&
3931
3936
  selection.current.selected.length > 0));
3932
3937
  if (allow && (this.dialogData.selectableModules?.length ?? 0) > 0) {
3933
3938
  selection?.current.selected.forEach(n => {