@pilotdev/pilot-web-2d 25.5.0 → 25.8.0

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.
Files changed (2) hide show
  1. package/index.d.ts +60 -3
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -16,9 +16,10 @@ export type StringMap = {
16
16
  };
17
17
  export class Localization {
18
18
  static initialize(options: any): Promise<void>;
19
- static translate<T extends (string | StringMap) = string>(stringToTrans: string): T;
19
+ static translate<T extends (string | StringMap) = string>(stringToTrans: string, options?: {}): T;
20
20
  static setLanguage(language: string): Promise<void>;
21
21
  static extendLocalization(locales: any): boolean;
22
+ static numberToStr(value: number, digitsAfterPoint?: number): string;
22
23
  }
23
24
  export type InitializeSuccessCallback = () => void;
24
25
  export function coreInitializer(options: InitializerOptions, callback: InitializeSuccessCallback): void;
@@ -50,11 +51,15 @@ export class Resizer {
50
51
 
51
52
  constructor(resizableContainer: HTMLElement, containerToRestriction: HTMLElement, elementAnchor?: HTMLElement, windowStater?: WindowStater);
52
53
  get windowState(): IWindowStyle | null;
54
+ set resizeStart(value: () => void);
55
+ set resizeEnd(value: () => void);
56
+ dispose(): void;
53
57
  }
54
58
  export class Dragger {
55
59
 
56
60
  constructor(allowedDraggableElement: HTMLElement, draggableContainer: HTMLElement, containerToRestriction: HTMLElement, windowStater?: WindowStater);
57
61
  get windowState(): IWindowStyle | null;
62
+ dispose(): void;
58
63
  }
59
64
  export namespace Viewer3DIcons {
60
65
  const VIEWER_SETTINGS_ICON: string;
@@ -77,6 +82,7 @@ export namespace Viewer3DIcons {
77
82
  const VIEWER_MEASUREMENT_DIMENSION_ICON: string;
78
83
  const VIEWER_ZOOM_TO_FIT_ICON: string;
79
84
  const VIEWER_RENDER_OPTIONS_ICON: string;
85
+ const VIEWER_CONTEXT_MENU_COPY_PROPS: string;
80
86
  }
81
87
  export namespace ViewerGeneralIcons {
82
88
  const CLOSE: string;
@@ -115,6 +121,7 @@ export class SettingChangedEvent extends Event {
115
121
  providedData: any;
116
122
  }
117
123
  export class LoadingSpinner {
124
+ protected readonly _progress: ProgressBar;
118
125
  set loadingTextKey(value: string);
119
126
  get loadingTextKey(): string;
120
127
  addToDOM(container: HTMLElement): void;
@@ -225,6 +232,7 @@ export class ExtensionBase {
225
232
  onMouseUp(event: MouseEvent): void;
226
233
  onMouseLongTouch(event: MouseEvent): void;
227
234
  onToolbarCreated(toolbar: Toolbar): void;
235
+ onContextMenu(menu: IMenu): void;
228
236
  onTouchStart(event: TouchEvent): void;
229
237
  onTouchEnd(event: TouchEvent): void;
230
238
  }
@@ -337,6 +345,11 @@ export class EventsDispatcherCore implements IEventsDispatcher {
337
345
  removeEvent(type: string): void;
338
346
  clearListeners(): void;
339
347
  }
348
+ export interface IMenuBuilder {
349
+ build(): IControl[];
350
+ removeAllButtons(): IMenuBuilder;
351
+ withButton(controlId: string, icon: string, translationKey: string, command: () => void): IMenuBuilder;
352
+ }
340
353
  export class Button extends Control {
341
354
 
342
355
  constructor(id: string);
@@ -347,6 +360,7 @@ export class Button extends Control {
347
360
  getIsChecked(): boolean;
348
361
  setIcon(iconClassName: string): void;
349
362
  setFromSvgTemlate(template: string): void;
363
+ withoutIcon(): void;
350
364
  /**
351
365
  * Override this method to be notified when the user clicks on the button.
352
366
  * @param {MouseEvent} event
@@ -369,10 +383,15 @@ export namespace Button {
369
383
  CLICK = "click"
370
384
  }
371
385
  }
372
- export class SubMenu implements IMenu {
386
+ export class ContextMenu implements IMenu {
373
387
  readonly controls: IControl[];
374
388
  set selectedIndex(value: number | number[]);
375
389
  get selectedIndex(): number | number[];
390
+ set opened(value: boolean);
391
+ get opened(): boolean;
392
+ set textStubKey(value: string);
393
+ get textStubKey(): string;
394
+ get menuWrapper(): HTMLElement;
376
395
  setEnabled(index: number, value: boolean): void;
377
396
  addControl(control: IControl, index?: number): void;
378
397
  removeControl(index?: number): void;
@@ -383,7 +402,7 @@ export class SubMenu implements IMenu {
383
402
  export class ComboButton extends Control {
384
403
 
385
404
  constructor(id: string, selectedIndex?: number);
386
- get subMenu(): SubMenu;
405
+ get subMenu(): ContextMenu;
387
406
  /**
388
407
  * Override this method to be notified when the user clicks on the button.
389
408
  * @param {MouseEvent} event
@@ -451,6 +470,7 @@ export class Dialog extends Control implements ICloseable {
451
470
  setSvgIcon(template: string): Dialog;
452
471
  setFooter(value: HTMLElement): Dialog;
453
472
  setDialogElementClassNames(value: ElementClass): Dialog;
473
+ setSize(width: number, height: number): Dialog;
454
474
  setResizable(value: boolean): Dialog;
455
475
  setWindowOptions(value: IWindowStateOptions): Dialog;
456
476
  setDraggable(value: boolean): Dialog;
@@ -459,6 +479,8 @@ export class Dialog extends Control implements ICloseable {
459
479
  destroyDialog(): void;
460
480
  isDialogShown(): boolean;
461
481
  subscribe(fn: (state: boolean) => void): void;
482
+ subscribeToResizeStart(fn: () => void): void;
483
+ subscribeToResizeEnd(fn: () => void): void;
462
484
  }
463
485
  export {};
464
486
  export interface ISettingsStorage {
@@ -496,6 +518,9 @@ export function createSvgElement(svgString: string): HTMLElement;
496
518
  export function isString(element: any): boolean;
497
519
  export function isSvg(element: string): boolean;
498
520
  export function isSvgString(element: any): boolean;
521
+ export class GlobalEvents {
522
+ static events: EventsDispatcherCore;
523
+ }
499
524
  export class Viewer2DConfiguration extends ViewerConfiguration {
500
525
 
501
526
  constructor(appearance?: ViewerSettings);
@@ -524,6 +549,7 @@ export interface IDocumentPage {
524
549
  dispose(): any;
525
550
  }
526
551
  export interface IDocument {
552
+ get pageCount(): number;
527
553
  loadDocumentAsync(arrayBuffer: ArrayBuffer): Promise<void>;
528
554
  increaseScale(scaleFactor?: number): void;
529
555
  decreaseScale(scaleFactor?: number): void;
@@ -532,8 +558,23 @@ export interface IDocument {
532
558
  getPageByTarget(element: HTMLElement): IDocumentPage | undefined;
533
559
  getSourceData(): Promise<ArrayBuffer>;
534
560
  scrollPageIntoViewAsync(pageNumber: number): Promise<void>;
561
+ exitFromAnnotationMode(): void;
535
562
  dispose(): void;
536
563
  }
564
+ export enum AnnotationTypes {
565
+ STAMP = "stamp"
566
+ }
567
+ export class AnnotationEventArgs {
568
+ id: string;
569
+ pageNumber: number;
570
+ positionX: number;
571
+ positionY: number;
572
+ type: string;
573
+ }
574
+ export class AnnotationPositionChangedEvent extends Event {
575
+ page: IDocumentPage;
576
+ args: AnnotationEventArgs;
577
+ }
537
578
  export const ZOOM_IN_SCALE_FACTOR = 1.15;
538
579
  export const ZOOM_OUT_SCALE_FACTOR = 0.85;
539
580
  export const ZOOM_MAX_SCALE = 10;
@@ -543,6 +584,7 @@ export class EventTypes extends CoreEventTypes {
543
584
  static DOCUMENT_ZOOM_IN: string;
544
585
  static DOCUMENT_ZOOM_OUT: string;
545
586
  static DOCUMENT_FIT_WIDTH: string;
587
+ static ANNOTATION_MOVED: string;
546
588
  }
547
589
  export class PageRenderedEvent extends Event {
548
590
  page: IDocumentPage;
@@ -554,6 +596,20 @@ export class DocumentLoadingOptions {
554
596
 
555
597
  constructor(documentId?: string);
556
598
  }
599
+ export interface IDocumentPrintOverlay {
600
+ open(indeterminate: boolean): void;
601
+ close(): void;
602
+ updateProgress(progress: number, total: number): void;
603
+ }
604
+ export class DocumentPrintOverlay extends LoadingSpinner implements IDocumentPrintOverlay {
605
+ open(determinate: boolean): void;
606
+ close(): void;
607
+ updateProgress(progress: number, total: number): void;
608
+ }
609
+ export interface IPrintOptions {
610
+ overlay?: IDocumentPrintOverlay;
611
+ resolution?: number;
612
+ }
557
613
  export let ViewerInstance: Viewer2D;
558
614
  export class Viewer2D extends ViewerBase {
559
615
  readonly settings: Readonly<ISettings>;
@@ -564,6 +620,7 @@ export class Viewer2D extends ViewerBase {
564
620
  unloadDocument(): void;
565
621
  start(): Promise<number>;
566
622
  finish(): Promise<void>;
623
+ print(options: IPrintOptions | undefined): Promise<void>;
567
624
  }
568
625
  export class GuiViewer2D extends Viewer2D {
569
626
  getToolbar(): ViewerToolbar;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pilotdev/pilot-web-2d",
3
- "version": "25.5.0",
3
+ "version": "25.8.0",
4
4
  "description": "TypeScript definitions for ASCON PilotWeb2D component",
5
5
  "main": "",
6
6
  "types": "index.d.ts",