@pilotdev/pilot-web-2d 25.8.4-alpha → 25.9.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.
- package/index.d.ts +226 -23
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -80,6 +80,9 @@ export namespace Viewer3DIcons {
|
|
|
80
80
|
const VIEWER_MEASUREMENT_PERPENDICULAR_ICON: string;
|
|
81
81
|
const VIEWER_MEASUREMENT_POINT_COORDINATES_ICON: string;
|
|
82
82
|
const VIEWER_MEASUREMENT_DIMENSION_ICON: string;
|
|
83
|
+
const VIEWER_POSITION_MOVE_ICON: string;
|
|
84
|
+
const VIEWER_POSITION_ROTATE_ICON: string;
|
|
85
|
+
const VIEWER_POSITION_ALIGN_ICON: string;
|
|
83
86
|
const VIEWER_ZOOM_TO_FIT_ICON: string;
|
|
84
87
|
const VIEWER_RENDER_OPTIONS_ICON: string;
|
|
85
88
|
const VIEWER_CONTEXT_MENU_COPY_PROPS: string;
|
|
@@ -98,12 +101,6 @@ export namespace ViewerGeneralIcons {
|
|
|
98
101
|
const ARROW_DR: string;
|
|
99
102
|
const CHECK: string;
|
|
100
103
|
}
|
|
101
|
-
export namespace Viewer2DIcons {
|
|
102
|
-
const REMARK_CIRCLE_ICON: string;
|
|
103
|
-
const ZOOM_IN: string;
|
|
104
|
-
const ZOOM_OUT: string;
|
|
105
|
-
const FIT_WIDTH: string;
|
|
106
|
-
}
|
|
107
104
|
export interface ISettings {
|
|
108
105
|
changeSetting<T>(name: string, value: T, notify?: boolean, providedData?: any): void;
|
|
109
106
|
getSettingValue<T>(name: string): T;
|
|
@@ -160,6 +157,10 @@ export namespace ControlState {
|
|
|
160
157
|
INACTIVE = 1,
|
|
161
158
|
DISABLED = 2
|
|
162
159
|
}
|
|
160
|
+
enum StateMode {
|
|
161
|
+
AUTO = 0,
|
|
162
|
+
MANUAL = 1
|
|
163
|
+
}
|
|
163
164
|
}
|
|
164
165
|
export interface IControl {
|
|
165
166
|
container: HTMLElement;
|
|
@@ -208,17 +209,24 @@ export interface IMenu {
|
|
|
208
209
|
addControl(control: IControl, index?: number): void;
|
|
209
210
|
removeControl(index: number): void;
|
|
210
211
|
}
|
|
212
|
+
export class Separator extends Control {
|
|
213
|
+
|
|
214
|
+
constructor(id: string);
|
|
215
|
+
setVertical(value: boolean): void;
|
|
216
|
+
}
|
|
211
217
|
interface IToolbarButton {
|
|
212
218
|
button: IControl;
|
|
213
219
|
index: number;
|
|
214
220
|
}
|
|
215
221
|
export class Toolbar extends Control implements IMenu {
|
|
222
|
+
/** @deprecated */
|
|
216
223
|
readonly controls: IControl[];
|
|
217
224
|
addControl(control: IControl, index?: number | undefined): void;
|
|
218
225
|
removeControl(index: number): void;
|
|
219
226
|
getControls(): IToolbarButton[];
|
|
220
227
|
changeToolbarPosition(direction: ToolbarPosition): void;
|
|
221
228
|
changeToolbarContentAlignment(content: ToolbarContentAlignment): void;
|
|
229
|
+
clear(): void;
|
|
222
230
|
}
|
|
223
231
|
export {};
|
|
224
232
|
export class ExtensionBase {
|
|
@@ -299,10 +307,7 @@ export type ViewerSettings = Record<string, any>;
|
|
|
299
307
|
export class ViewerConfiguration {
|
|
300
308
|
settingsPrefix: string;
|
|
301
309
|
appearance: ViewerSettings;
|
|
302
|
-
extensionsOptions:
|
|
303
|
-
name: string;
|
|
304
|
-
options: ViewerSettings;
|
|
305
|
-
}>;
|
|
310
|
+
extensionsOptions: Record<string, ViewerSettings>;
|
|
306
311
|
createConfiguration(configuration: ViewerSettings, origin: ViewerSettings): void;
|
|
307
312
|
mergeConfigurationAndSettings(configuration: ViewerSettings, settings: ISettings): void;
|
|
308
313
|
changeTheme(newTheme: string): void;
|
|
@@ -345,6 +350,7 @@ export abstract class ViewerBase {
|
|
|
345
350
|
onExtensionUnloading(extension: ExtensionBase): void;
|
|
346
351
|
onPostExtensionUnload(extension: ExtensionBase): void;
|
|
347
352
|
protected loadExtensions(): void;
|
|
353
|
+
protected loadEmbeddedExtension(extensionName: string, type: typeof ExtensionBase): void;
|
|
348
354
|
protected setThemeFromSettings(): void;
|
|
349
355
|
}
|
|
350
356
|
export class EventsDispatcherCore implements IEventsDispatcher {
|
|
@@ -370,7 +376,9 @@ export class Button extends Control {
|
|
|
370
376
|
getState(): ControlState.State;
|
|
371
377
|
getIsChecked(): boolean;
|
|
372
378
|
setIcon(iconClassName: string): void;
|
|
379
|
+
getIcon(): string;
|
|
373
380
|
setFromSvgTemlate(template: string): void;
|
|
381
|
+
getSvgTemplate(): string;
|
|
374
382
|
withoutIcon(): void;
|
|
375
383
|
/**
|
|
376
384
|
* Override this method to be notified when the user clicks on the button.
|
|
@@ -421,9 +429,11 @@ export class ComboButton extends Control {
|
|
|
421
429
|
onClick(event: PointerEvent): void;
|
|
422
430
|
onOpen(): void;
|
|
423
431
|
onClose(): void;
|
|
432
|
+
setStateMode(mode: ControlState.StateMode): void;
|
|
424
433
|
setState(state: ControlState.State): boolean;
|
|
425
434
|
setText(text: string): void;
|
|
426
435
|
setFromSvgTemlate(template: string): void;
|
|
436
|
+
getSvgTemplate(): string;
|
|
427
437
|
}
|
|
428
438
|
export class Checkbox {
|
|
429
439
|
|
|
@@ -458,6 +468,19 @@ export class Select {
|
|
|
458
468
|
}): void;
|
|
459
469
|
update(array: ISelectItem[], selectedIndex?: number): void;
|
|
460
470
|
}
|
|
471
|
+
export class Input extends Control {
|
|
472
|
+
|
|
473
|
+
constructor(id: string);
|
|
474
|
+
get inputElement(): HTMLInputElement;
|
|
475
|
+
get error(): HTMLElement;
|
|
476
|
+
get valid(): boolean;
|
|
477
|
+
set valid(value: boolean);
|
|
478
|
+
setPlaceholder(placeholder: string): void;
|
|
479
|
+
setDisabled(value: boolean): void;
|
|
480
|
+
onChange(value: string): void;
|
|
481
|
+
setText(text: string): void;
|
|
482
|
+
destroy(): void;
|
|
483
|
+
}
|
|
461
484
|
export class ViewerToolbar extends Toolbar {
|
|
462
485
|
}
|
|
463
486
|
interface ElementClass {
|
|
@@ -477,9 +500,11 @@ export class Dialog extends Control implements ICloseable {
|
|
|
477
500
|
get resizable(): boolean;
|
|
478
501
|
setDialogContent(value: HTMLElement): Dialog;
|
|
479
502
|
setHeader(value: HTMLElement): Dialog;
|
|
503
|
+
setHeaderShown(value: boolean): Dialog;
|
|
480
504
|
setCaption(value: string): Dialog;
|
|
481
505
|
setSvgIcon(template: string): Dialog;
|
|
482
506
|
setFooter(value: HTMLElement): Dialog;
|
|
507
|
+
setFooterShown(value: boolean): Dialog;
|
|
483
508
|
setDialogElementClassNames(value: ElementClass): Dialog;
|
|
484
509
|
setSize(width: number, height: number): Dialog;
|
|
485
510
|
setResizable(value: boolean): Dialog;
|
|
@@ -557,10 +582,17 @@ export interface IDocumentPage {
|
|
|
557
582
|
get width(): number;
|
|
558
583
|
get scale(): number;
|
|
559
584
|
update(params?: IPageUpdateParams): void;
|
|
585
|
+
getViewport(scale: number): DOMRect;
|
|
586
|
+
convertToViewportPoint(x: number, y: number): number[];
|
|
587
|
+
convertToViewportRectangle(rect: number[]): number[];
|
|
588
|
+
convertToPagePoint(x: number, y: number): number[];
|
|
560
589
|
dispose(): any;
|
|
561
590
|
}
|
|
591
|
+
export type DocumentKind = "PDF" | "XPS" | "OTHER";
|
|
562
592
|
export interface IDocument {
|
|
563
593
|
get pageCount(): number;
|
|
594
|
+
get scale(): number;
|
|
595
|
+
get kind(): DocumentKind;
|
|
564
596
|
loadDocumentAsync(arrayBuffer: ArrayBuffer): Promise<void>;
|
|
565
597
|
increaseScale(scaleFactor?: number): void;
|
|
566
598
|
decreaseScale(scaleFactor?: number): void;
|
|
@@ -569,39 +601,136 @@ export interface IDocument {
|
|
|
569
601
|
getPageByTarget(element: HTMLElement): IDocumentPage | undefined;
|
|
570
602
|
getSourceData(): Promise<ArrayBuffer>;
|
|
571
603
|
scrollPageIntoViewAsync(pageNumber: number): Promise<void>;
|
|
572
|
-
exitFromAnnotationMode(): void;
|
|
573
604
|
dispose(): void;
|
|
574
605
|
}
|
|
606
|
+
export type Subtype = "Link" | "Text" | "Widget" | "Popup" | "FreeText" | "Line" | "Arrow" | "Square" | "Circle" | "PolyLine" | "Polygon" | "Cloud" | "Caret" | "Ink" | "Highlight" | "Underline" | "Squiggly" | "StrikeOut" | "Stamp" | "FileAttachment";
|
|
607
|
+
export interface IAnnotation {
|
|
608
|
+
groupId: string;
|
|
609
|
+
borderStyle: IBorderStyle;
|
|
610
|
+
color?: IRGBColor | null;
|
|
611
|
+
backgroundColor?: IRGBColor | null;
|
|
612
|
+
borderColor?: IRGBColor | null;
|
|
613
|
+
rotation: number;
|
|
614
|
+
id: string;
|
|
615
|
+
name?: string | null;
|
|
616
|
+
subtype: Subtype;
|
|
617
|
+
pageNumber: number;
|
|
618
|
+
position?: IPosition;
|
|
619
|
+
size?: ISize;
|
|
620
|
+
}
|
|
621
|
+
export interface IPosition {
|
|
622
|
+
x: number;
|
|
623
|
+
y: number;
|
|
624
|
+
}
|
|
625
|
+
export interface ISize {
|
|
626
|
+
width: number;
|
|
627
|
+
height: number;
|
|
628
|
+
}
|
|
629
|
+
export interface IImageAnnotation extends IAnnotation {
|
|
630
|
+
canvas: HTMLCanvasElement;
|
|
631
|
+
}
|
|
632
|
+
export interface IEllipseAnnotation extends IAnnotation {
|
|
633
|
+
radiusX: number;
|
|
634
|
+
radiusY: number;
|
|
635
|
+
centerX: number;
|
|
636
|
+
centerY: number;
|
|
637
|
+
}
|
|
638
|
+
export interface IPolylineAnnotation extends IAnnotation {
|
|
639
|
+
points: number[];
|
|
640
|
+
type: PolylineType;
|
|
641
|
+
}
|
|
642
|
+
export interface ILineAnnotation extends IAnnotation {
|
|
643
|
+
points: [number, number, number, number];
|
|
644
|
+
lineEndings: [LineEndings, LineEndings];
|
|
645
|
+
}
|
|
646
|
+
export interface IInkAnnotation extends IAnnotation {
|
|
647
|
+
pointsList: number[][];
|
|
648
|
+
}
|
|
649
|
+
export interface ITextDecorationAnnotation extends IAnnotation {
|
|
650
|
+
quadPoints: number[];
|
|
651
|
+
}
|
|
652
|
+
export interface IBorderStyle {
|
|
653
|
+
width: number;
|
|
654
|
+
rawWidth: number;
|
|
655
|
+
style?: number;
|
|
656
|
+
dashArray?: number[];
|
|
657
|
+
horizontalCornerRadius?: number;
|
|
658
|
+
verticalCornerRadius?: number;
|
|
659
|
+
}
|
|
660
|
+
export interface IRGBColor {
|
|
661
|
+
0: number;
|
|
662
|
+
1: number;
|
|
663
|
+
2: number;
|
|
664
|
+
}
|
|
665
|
+
export type LineEndings = "None" | "Square" | "Circle" | "Diamond" | "OpenArrow" | "ClosedArrow" | "Butt" | "ROpenArrow" | "RClosedArrow" | "Slash";
|
|
666
|
+
export type PolylineType = "PolygonCloud" | "Line";
|
|
667
|
+
export class EventTypes extends CoreEventTypes {
|
|
668
|
+
static PAGE_RENDERED: string;
|
|
669
|
+
static DOCUMENT_ZOOM_IN: string;
|
|
670
|
+
static DOCUMENT_ZOOM_OUT: string;
|
|
671
|
+
static DOCUMENT_FIT_WIDTH: string;
|
|
672
|
+
static DOCUMENT_LOADED: string;
|
|
673
|
+
static DOCUMENT_UNLOADED: string;
|
|
674
|
+
static DOCUMENT_SCALE_CHANGED: string;
|
|
675
|
+
static ANNOTATION_MOVED: string;
|
|
676
|
+
static ANNOTATION_CHANGED: string;
|
|
677
|
+
static ANNOTATION_DELETED: string;
|
|
678
|
+
static ANNOTATIONS_LOADED: string;
|
|
679
|
+
static ANNOTATIONS_CREATED: string;
|
|
680
|
+
static ANNOTATION_SELECTED: string;
|
|
681
|
+
static ANNOTATION_DESELECTED: string;
|
|
682
|
+
}
|
|
575
683
|
export enum AnnotationTypes {
|
|
576
684
|
STAMP = "stamp"
|
|
577
685
|
}
|
|
686
|
+
export class AnnotationsLoadedEventArgs extends Event {
|
|
687
|
+
page: IDocumentPage;
|
|
688
|
+
annotations: IAnnotation[];
|
|
689
|
+
}
|
|
578
690
|
export class AnnotationEventArgs {
|
|
579
691
|
id: string;
|
|
580
692
|
pageNumber: number;
|
|
581
|
-
positionX: number;
|
|
582
|
-
positionY: number;
|
|
583
693
|
type: string;
|
|
584
694
|
}
|
|
695
|
+
export class AnnotationSizeChangedEventArgs extends AnnotationEventArgs {
|
|
696
|
+
size: ISize;
|
|
697
|
+
}
|
|
698
|
+
export class AnnotationPositionChangedEventArgs extends AnnotationEventArgs {
|
|
699
|
+
position: IPosition;
|
|
700
|
+
}
|
|
585
701
|
export class AnnotationPositionChangedEvent extends Event {
|
|
586
702
|
page: IDocumentPage;
|
|
587
703
|
args: AnnotationEventArgs;
|
|
588
704
|
}
|
|
705
|
+
export class AnnotationsCreatedEvent extends Event {
|
|
706
|
+
readonly annotations: IAnnotation[];
|
|
707
|
+
}
|
|
708
|
+
export class AnnotationDeletedEvent extends Event {
|
|
709
|
+
readonly annotation: IAnnotation;
|
|
710
|
+
}
|
|
711
|
+
export class AnnotationChangedEvent extends Event {
|
|
712
|
+
readonly annotation: IAnnotation;
|
|
713
|
+
}
|
|
714
|
+
export class AnnotationSelectedEvent extends Event {
|
|
715
|
+
readonly annotation: IAnnotation | null;
|
|
716
|
+
}
|
|
717
|
+
export class AnnotationDeselectedEvent extends Event {
|
|
718
|
+
readonly annotation: IAnnotation | null;
|
|
719
|
+
}
|
|
589
720
|
export const ZOOM_IN_SCALE_FACTOR = 1.15;
|
|
590
721
|
export const ZOOM_OUT_SCALE_FACTOR = 0.85;
|
|
591
722
|
export const ZOOM_MAX_SCALE = 10;
|
|
592
723
|
export const ZOOM_MIN_SCALE = 4;
|
|
593
|
-
export class EventTypes extends CoreEventTypes {
|
|
594
|
-
static PAGE_RENDERED: string;
|
|
595
|
-
static DOCUMENT_ZOOM_IN: string;
|
|
596
|
-
static DOCUMENT_ZOOM_OUT: string;
|
|
597
|
-
static DOCUMENT_FIT_WIDTH: string;
|
|
598
|
-
static ANNOTATION_MOVED: string;
|
|
599
|
-
}
|
|
600
724
|
export class PageRenderedEvent extends Event {
|
|
601
725
|
page: IDocumentPage;
|
|
602
726
|
|
|
603
727
|
constructor(type: string, page: IDocumentPage, eventInitDict?: EventInit);
|
|
604
728
|
}
|
|
729
|
+
export class ScaleChangingEvent extends Event {
|
|
730
|
+
scale: number;
|
|
731
|
+
|
|
732
|
+
constructor(type: string, scale: number, eventInitDict?: EventInit);
|
|
733
|
+
}
|
|
605
734
|
export class DocumentLoadingOptions {
|
|
606
735
|
documentId?: string;
|
|
607
736
|
|
|
@@ -623,6 +752,76 @@ export interface IPrintOptions {
|
|
|
623
752
|
overlay?: IDocumentPrintOverlay;
|
|
624
753
|
resolution?: number;
|
|
625
754
|
}
|
|
755
|
+
export class Extension extends ExtensionBase {
|
|
756
|
+
protected get viewer(): Viewer2D;
|
|
757
|
+
}
|
|
758
|
+
export type AddingAnnotationsProps = {
|
|
759
|
+
isReadonly?: boolean;
|
|
760
|
+
};
|
|
761
|
+
export class AnnotationManager {
|
|
762
|
+
/**
|
|
763
|
+
* @returns All annotations by document as flat array
|
|
764
|
+
*
|
|
765
|
+
*/
|
|
766
|
+
getAllAnnotations(): IAnnotation[];
|
|
767
|
+
/**
|
|
768
|
+
* Adds one or more annotations to the document layer.
|
|
769
|
+
*
|
|
770
|
+
* @param annotations - The list of annotations to add.
|
|
771
|
+
*/
|
|
772
|
+
addAnnotations(annotations: IAnnotation[], addProps?: AddingAnnotationsProps): void;
|
|
773
|
+
/**
|
|
774
|
+
* Removes annotations from the document layer.
|
|
775
|
+
*
|
|
776
|
+
* @param ids - The IDs of the annotations to remove.
|
|
777
|
+
* @returns The annotations that were removed.
|
|
778
|
+
*/
|
|
779
|
+
removeAnnotations(ids: string[]): void;
|
|
780
|
+
/**
|
|
781
|
+
* Retrieves a specific annotation by its ID.
|
|
782
|
+
*
|
|
783
|
+
* @param annotationId - The ID of the annotation to retrieve.
|
|
784
|
+
* @returns The annotation if found, or `undefined` if no matching annotation exists.
|
|
785
|
+
*/
|
|
786
|
+
getAnnotation(annotationId: string): IAnnotation | undefined;
|
|
787
|
+
getAnnotations(groupId: string): IAnnotation[];
|
|
788
|
+
/**
|
|
789
|
+
* Marks an annotation as selected.
|
|
790
|
+
*
|
|
791
|
+
* @param annotationId - The ID of the annotation to select.
|
|
792
|
+
*/
|
|
793
|
+
select(annotationId: string): void;
|
|
794
|
+
/**
|
|
795
|
+
* Removes the selection state from a specific annotation.
|
|
796
|
+
*
|
|
797
|
+
* @param annotationId - The ID of the annotation to deselect.
|
|
798
|
+
*/
|
|
799
|
+
deselect(annotationId: string): void;
|
|
800
|
+
/**
|
|
801
|
+
* Clears the selection state of all annotations.
|
|
802
|
+
*/
|
|
803
|
+
clearSelection(): void;
|
|
804
|
+
/**
|
|
805
|
+
* Updates the visibility state of one or more annotations.
|
|
806
|
+
*
|
|
807
|
+
* @param ids - The IDs of the annotations whose visibility should be updated.
|
|
808
|
+
* @param visible - The desired visibility state (`true` to show, `false` to hide).
|
|
809
|
+
*/
|
|
810
|
+
setVisibility(ids: string[], visible: boolean): void;
|
|
811
|
+
/**
|
|
812
|
+
* Clears all annotations from the document layer.
|
|
813
|
+
*/
|
|
814
|
+
clearAnnotations(): void;
|
|
815
|
+
isRendered(annotation: IAnnotation): Promise<boolean>;
|
|
816
|
+
}
|
|
817
|
+
export class AnnotationsExtension extends Extension {
|
|
818
|
+
get annotationManager(): AnnotationManager;
|
|
819
|
+
load(): boolean | Promise<boolean>;
|
|
820
|
+
getName(): string;
|
|
821
|
+
onToolbarCreated(toolbar: Toolbar): void;
|
|
822
|
+
buildCustomToolbar(toolbar: Toolbar, props?: ToolbarProps): void;
|
|
823
|
+
clearTools(): void;
|
|
824
|
+
}
|
|
626
825
|
export let ViewerInstance: Viewer2D;
|
|
627
826
|
export class Viewer2D extends ViewerBase {
|
|
628
827
|
readonly settings: Readonly<ISettings>;
|
|
@@ -634,6 +833,7 @@ export class Viewer2D extends ViewerBase {
|
|
|
634
833
|
start(): Promise<number>;
|
|
635
834
|
finish(): Promise<void>;
|
|
636
835
|
print(options: IPrintOptions | undefined): Promise<void>;
|
|
836
|
+
protected loadExtensions(): void;
|
|
637
837
|
}
|
|
638
838
|
export class GuiViewer2D extends Viewer2D {
|
|
639
839
|
getToolbar(): ViewerToolbar;
|
|
@@ -648,14 +848,17 @@ export function CreateBasicViewer(container: HTMLElement, configuration?: Viewer
|
|
|
648
848
|
*/
|
|
649
849
|
export function Initializer(options: InitializerOptions, callback: InitializeSuccessCallback): void;
|
|
650
850
|
export function shutdown(): void;
|
|
651
|
-
export class Extension extends ExtensionBase {
|
|
652
|
-
protected _viewer: Viewer2D;
|
|
653
|
-
}
|
|
654
851
|
export class Point2 {
|
|
655
852
|
x: number;
|
|
656
853
|
y: number;
|
|
657
854
|
|
|
658
855
|
constructor(x: number, y: number);
|
|
659
856
|
}
|
|
857
|
+
export namespace Viewer2DIcons {
|
|
858
|
+
const REMARK_CIRCLE_ICON: string;
|
|
859
|
+
const ZOOM_IN: string;
|
|
860
|
+
const ZOOM_OUT: string;
|
|
861
|
+
const FIT_WIDTH: string;
|
|
862
|
+
}
|
|
660
863
|
|
|
661
864
|
}
|