@pilotdev/pilot-web-sdk 23.0.0-alpha.1

Sign up to get free protection for your applications and to get access to all the features.
package/README.md ADDED
@@ -0,0 +1,5 @@
1
+ # Installation
2
+ > `npm install @pilotdev/pilot-web-sdk`
3
+
4
+ # Summary
5
+ This package contains everything you need to develop extension modules for the web version of ASCON Pilot-BIM.
@@ -0,0 +1,7 @@
1
+ {
2
+ "$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
3
+ "dest": "../../dist/pilot-web-sdk",
4
+ "lib": {
5
+ "entryFile": "src/public-api.ts"
6
+ }
7
+ }
package/package.json ADDED
@@ -0,0 +1,13 @@
1
+ {
2
+ "name": "@pilotdev/pilot-web-sdk",
3
+ "version": "23.0.0-alpha.1",
4
+ "peerDependencies": {
5
+ "@angular/common": "15.2.8",
6
+ "@angular/core": "15.2.8",
7
+ "rxjs": "7.8.1"
8
+ },
9
+ "dependencies": {
10
+ "tslib": "2.3.0"
11
+ },
12
+ "sideEffects": false
13
+ }
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Contex for objects view
3
+ */
4
+ export class ObjectsViewContext {
5
+
6
+ constructor(selectedObjects: any[], isContext: boolean, shortcuts?: any[]) {
7
+ this.selectedObjects = selectedObjects;
8
+ this.isContext = isContext;
9
+ this.shortcuts = shortcuts;
10
+ }
11
+
12
+ /**
13
+ *
14
+ */
15
+ readonly selectedObjects: any[]; // IDataObject[]
16
+
17
+ /**
18
+ *
19
+ */
20
+ readonly isContext: boolean;
21
+ /**
22
+ *
23
+ */
24
+ readonly shortcuts: any[]; // IDataObject[]
25
+ }
@@ -0,0 +1,2 @@
1
+
2
+ export interface IDataPlugin {}
@@ -0,0 +1 @@
1
+ export * from './objects.repository';
@@ -0,0 +1,7 @@
1
+ import { Observable } from "rxjs";
2
+
3
+ export interface IObjectsRepository {
4
+ subscribeObjects(ids: string[]): Observable<any>;
5
+ getPerson(id: number): any;
6
+ }
7
+
@@ -0,0 +1,15 @@
1
+ import { IMenuItemBuilder } from "./menu-item.builder";
2
+
3
+ /**
4
+ *
5
+ */
6
+ export abstract class ICheckableMenuItemBuilder extends IMenuItemBuilder {
7
+
8
+ /**
9
+ *
10
+ * @param value
11
+ */
12
+ withIsChecked(value: boolean): ICheckableMenuItemBuilder {
13
+ throw new Error("Method 'withIsChecked(value: boolean)' must be implemented.");
14
+ }
15
+ }
@@ -0,0 +1,5 @@
1
+
2
+ export * from './menu';
3
+ export * from './checkable-menu.builder';
4
+ export * from './menu-item.builder';
5
+ export * from './menu.builder';
@@ -0,0 +1,45 @@
1
+ import { IMenuBuilder } from "./menu.builder";
2
+
3
+ /**
4
+ * Represents a menu item and enables to set parametres to it
5
+ */
6
+ export abstract class IMenuItemBuilder {
7
+
8
+ constructor() {
9
+ if (this.constructor == IMenuItemBuilder) {
10
+ throw new Error("Abstract classes can't be instantiated.");
11
+ }
12
+ }
13
+
14
+ /**
15
+ * Item's name to be displayed
16
+ * @param header value
17
+ */
18
+ withHeader(header: string): IMenuItemBuilder {
19
+ throw new Error("Method 'withHeader(header: string)' must be implemented.");
20
+ }
21
+
22
+ /**
23
+ * Item's icon
24
+ * @param name Icon name
25
+ * @param iconSvg Url of icon or base64 string
26
+ */
27
+ withIcon(name: string, iconSvg: string): IMenuItemBuilder {
28
+ throw new Error("Method 'withIcon(name: string, iconSvg: string)' must be implemented.");
29
+ }
30
+
31
+ /**
32
+ * Enabled the item
33
+ * @param value value
34
+ */
35
+ withIsEnabled(value: boolean): IMenuItemBuilder {
36
+ throw new Error("Method 'withIsEnabled(value: boolean)' must be implemented.");
37
+ }
38
+
39
+ /**
40
+ * Item's submenu
41
+ */
42
+ withSubmenu(): IMenuBuilder {
43
+ throw new Error("Method 'withSubmenu()' must be implemented.");
44
+ }
45
+ }
@@ -0,0 +1,79 @@
1
+ import { ICheckableMenuItemBuilder } from "./checkable-menu.builder";
2
+ import { IMenuItemBuilder } from "./menu-item.builder";
3
+
4
+ /**
5
+ * Represents a menu and enables to add new items to it
6
+ */
7
+ export abstract class IMenuBuilder {
8
+
9
+ constructor() {
10
+ if (this.constructor == IMenuBuilder) {
11
+ throw new Error("Abstract classes can't be instantiated.");
12
+ }
13
+ }
14
+
15
+ /**
16
+ * Gets the list of existing items of associated menu or subitems of an item
17
+ * @returns Existing menu item names
18
+ */
19
+ get itemNames(): string[] {
20
+ throw new Error("Getter 'itemNames()' must be implemented.");
21
+ }
22
+
23
+ /**
24
+ * Gets count of menu items
25
+ */
26
+ get count(): number {
27
+ throw new Error("Getter 'count()' must be implemented.");
28
+ }
29
+
30
+ /**
31
+ * Adds a new separator to the associated menu
32
+ * @param index The index to put the new item at
33
+ */
34
+ addSeparator(index: number): void {
35
+ throw new Error("Method 'addSeparator(index: number)' must be implemented.");
36
+ }
37
+
38
+ /**
39
+ * Adds a new item to the associated menu
40
+ * @param name Item's internal name
41
+ * @param index The index to put the new item at
42
+ */
43
+ addItem(name: string, index: number): IMenuItemBuilder {
44
+ throw new Error("Method 'addItem(name: string, index: number)' must be implemented.");
45
+ }
46
+
47
+ /**
48
+ * Adds a new checkable item to the associated menu
49
+ * @param name Item's internal name
50
+ * @param index The index to put the new item at
51
+ */
52
+ addCheckableItem(name: string, index: number): ICheckableMenuItemBuilder {
53
+ throw new Error("Method 'addCheckableItem(name: string, index: number)' must be implemented.");
54
+ }
55
+
56
+ /**
57
+ * Replaces the item to the associated menu
58
+ * @param name Item's internal name
59
+ */
60
+ replaceItem(name: string): IMenuItemBuilder {
61
+ throw new Error("Method 'replaceItem(name: string)' must be implemented.");
62
+ }
63
+
64
+ /**
65
+ * Removes the item with the specified name
66
+ * @param name Item's internal name
67
+ */
68
+ removeItem(name: string): void {
69
+ throw new Error("Method 'removeItem(name: string)' must be implemented.");
70
+ }
71
+
72
+ /**
73
+ * Gets the item
74
+ * @param name Item's internal name
75
+ */
76
+ getItem(name: string): IMenuBuilder {
77
+ throw new Error("Method 'getItem(name: string)' must be implemented.");
78
+ }
79
+ }
@@ -0,0 +1,24 @@
1
+ import { IMenuBuilder } from "./menu.builder";
2
+
3
+ /**
4
+ * Interface that allows to add new items to the menu and context menus
5
+ */
6
+ export abstract class IMenu<TMenuContext> {
7
+ /**
8
+ * The method is called just before the menu is shown
9
+ * @param builder The menu builder object of associated menu
10
+ * @param context Context
11
+ */
12
+ build(builder: IMenuBuilder, context: TMenuContext): void {
13
+ throw new Error("Method 'build(builder: IMenuBuilder, context: TMenuContext)' must be implemented.");
14
+ }
15
+
16
+ /**
17
+ *
18
+ * @param name
19
+ * @param context
20
+ */
21
+ onMenuItemClick(name: string, context: TMenuContext): void {
22
+ throw new Error("Method 'onMenuItemClick(name: string, context: TMenuContext)' must be implemented.");
23
+ }
24
+ }
@@ -0,0 +1,7 @@
1
+
2
+ export * from './toolbar';
3
+ export * from './toolbar-item.builder';
4
+ export * from './toolbar-item-submenu.handler';
5
+ export * from './toolbar-menu-item.builder';
6
+ export * from './toolbar-toggle-item.builder';
7
+ export * from './toolbar.builder';
@@ -0,0 +1,4 @@
1
+
2
+ export abstract class IToolbarItemSubmenuHandler {
3
+
4
+ }
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Represents a toolbar button and enables to set parametres to it
3
+ */
4
+ export abstract class IToolbarButtonItemBuilder {
5
+
6
+ constructor() {
7
+ if (this.constructor == IToolbarButtonItemBuilder) {
8
+ throw new Error("Abstract classes can't be instantiated.");
9
+ }
10
+ }
11
+
12
+ /**
13
+ * Item's name to be displayed
14
+ * @param header - value
15
+ * @returns instance of IToolbarButtonItemBuilder
16
+ */
17
+ withHeader(header: string): IToolbarButtonItemBuilder {
18
+ throw new Error("Method 'withHeader(header: string)' must be implemented.");
19
+ }
20
+
21
+ /**
22
+ * Item's icon in SVG format
23
+ * @param name - icon name
24
+ * @param svg - url icon or base64 string
25
+ */
26
+ withIcon(name: string, svg: string): IToolbarButtonItemBuilder {
27
+ throw new Error("Method 'withIcon(name: string, svg: string)' must be implemented.");
28
+ }
29
+
30
+ /**
31
+ * Enabled the item
32
+ * @param value - value
33
+ */
34
+ withIsEnabled(value: boolean): IToolbarButtonItemBuilder {
35
+ throw new Error("Method 'withIsEnabled(value: boolean)' must be implemented.");
36
+ }
37
+
38
+ /**
39
+ * Item's hint
40
+ * @param hint - value
41
+ */
42
+ withHint(hint: string): IToolbarButtonItemBuilder {
43
+ throw new Error("Method 'withHint(hint: string)' must be implemented.");
44
+ }
45
+ }
@@ -0,0 +1,16 @@
1
+ import { IToolbarButtonItemBuilder } from "./toolbar-item.builder";
2
+ import { IToolbarItemSubmenuHandler } from "./toolbar-item-submenu.handler";
3
+
4
+ /**
5
+ * Represents a toolbar menu button and enables to set parametres to it
6
+ */
7
+ export abstract class IToolbarMenuButtonItemBuilder extends IToolbarButtonItemBuilder {
8
+ /**
9
+ * Build a dropdown menu
10
+ * @param itemSubmenuHandler - toolbar submenu handler
11
+ * @returns The toolbar button menu builder
12
+ */
13
+ withMenu(itemSubmenuHandler: IToolbarItemSubmenuHandler): IToolbarMenuButtonItemBuilder {
14
+ throw new Error("Method 'withMenu(itemSubmenuHandler: IToolbarItemSubmenuHandler)' must be implemented.");
15
+ }
16
+ }
@@ -0,0 +1,15 @@
1
+ import { IToolbarButtonItemBuilder } from "./toolbar-item.builder";
2
+
3
+ /**
4
+ * Represents a toolbar toggle button and enables to set parametres to it
5
+ */
6
+ export abstract class IToolbarToggleButtonItemBuilder extends IToolbarButtonItemBuilder {
7
+
8
+ /**
9
+ *
10
+ * @param value
11
+ */
12
+ withIsChecked(value: boolean): IToolbarToggleButtonItemBuilder {
13
+ throw new Error("Method 'withIsChecked(value: boolean)' must be implemented.");
14
+ }
15
+ }
@@ -0,0 +1,104 @@
1
+ import { IToolbarButtonItemBuilder } from "./toolbar-item.builder";
2
+ import { IToolbarItemSubmenuHandler } from "./toolbar-item-submenu.handler";
3
+ import { IToolbarMenuButtonItemBuilder } from "./toolbar-menu-item.builder";
4
+ import { IToolbarToggleButtonItemBuilder } from "./toolbar-toggle-item.builder";
5
+
6
+ export abstract class IToolbarBuilder {
7
+
8
+ constructor() {
9
+ if (this.constructor == IToolbarBuilder) {
10
+ throw new Error("Abstract classes can't be instantiated.");
11
+ }
12
+ }
13
+
14
+ /**
15
+ * Adds a new separator to the associated toolbar
16
+ * @param index - The index to put the new item at
17
+ */
18
+ addSeparator(index: number): void {
19
+ throw new Error("Method 'addSeparator(index: number)' must be implemented.");
20
+ }
21
+
22
+ /**
23
+ * Adds a new button to the associated toolbar
24
+ * @param name - Internal item's name
25
+ * @param index - The index to put the new item at
26
+ */
27
+ addButtonItem(name: string, index: number): IToolbarButtonItemBuilder {
28
+ throw new Error("Method 'addButtonItem(name: string, index: number)' must be implemented.");
29
+ }
30
+
31
+ /**
32
+ * Adds a new menu button to the associated toolbar
33
+ * @param name - Internal item's name
34
+ * @param index - The index to put the new item at
35
+ */
36
+ addMenuButtonItem(name: string, index: number): IToolbarMenuButtonItemBuilder {
37
+ throw new Error("Method 'addMenuButtonItem(name: string, index: number)' must be implemented.");
38
+ }
39
+
40
+ /**
41
+ * Adds a new toggle button to the associated toolbar
42
+ * @param name - Internal item's name
43
+ * @param index - The index to put the new item at
44
+ */
45
+ addToggleButtonItem(name: string, index: number): IToolbarToggleButtonItemBuilder {
46
+ throw new Error("Method 'addToggleButtonItem(name: string, index: number)' must be implemented.");
47
+ }
48
+
49
+ /**
50
+ * Replaces the item from the associated toolbar on button
51
+ * @param name - The name of toolbar button to replace
52
+ */
53
+ replaceButtonItem(name: string): IToolbarButtonItemBuilder {
54
+ throw new Error("Method 'replaceButtonItem(name: string)' must be implemented.");
55
+ }
56
+
57
+ /**
58
+ * Replace the item from the associated toolbar on menu button
59
+ * @param name - The name of toolbar menu button to replace
60
+ */
61
+ replaceMenuButtonItem(name: string): IToolbarMenuButtonItemBuilder {
62
+ throw new Error("Method 'replaceMenuButtonItem(name: string)' must be implemented.");
63
+ }
64
+
65
+ /**
66
+ * Enables to set parametres to menu button item submenu
67
+ * @param name - Item's internal name
68
+ * @param itemSubmenuHandler - The toolbar button menu builder
69
+ */
70
+ handleMenuButtonItemSubmenu(name: string, itemSubmenuHandler: IToolbarItemSubmenuHandler): void {
71
+ throw new Error("Method 'handleMenuButtonItemSubmenu(name: string, itemSubmenuHandler: IToolbarItemSubmenuHandler)' must be implemented.");
72
+ }
73
+
74
+ /**
75
+ * Replaces the item from the associated toolbar on toggle button
76
+ * @param name - The name of toolbar toggle button to replace
77
+ */
78
+ replaceToggleButtonItem(name: string): IToolbarToggleButtonItemBuilder {
79
+ throw new Error("Method 'replaceToggleButtonItem(name: string)' must be implemented.");
80
+ }
81
+
82
+ /**
83
+ * Gets the list of existing item names of associated toolbar
84
+ * @returns - Existing toolbar item names
85
+ */
86
+ get itemNames(): string[] {
87
+ throw new Error("Getter 'itemNames()' must be implemented.");
88
+ }
89
+
90
+ /**
91
+ * Gets count of toolbar items
92
+ */
93
+ get count(): number {
94
+ throw new Error("Getter 'count()' must be implemented.");
95
+ }
96
+
97
+ /**
98
+ * Removes specified item
99
+ * @param itemName - Item's internal name
100
+ */
101
+ removeItem(itemName: string): void {
102
+ throw new Error("Method 'removeItem(name: string)' must be implemented.");
103
+ }
104
+ }
@@ -0,0 +1,31 @@
1
+ import { IToolbarBuilder } from "./toolbar.builder";
2
+
3
+ /**
4
+ * Interface that allows to add new items to the toolbar
5
+ */
6
+ export abstract class IToolbar<TToolbarContext> {
7
+
8
+ constructor() {
9
+ if (this.constructor == IToolbar<TToolbarContext>) {
10
+ throw new Error("Abstract classes can't be instantiated.");
11
+ }
12
+ }
13
+
14
+ /**
15
+ * The method is called just before the toolbar is created
16
+ * @param builder - the toolbar builder object of associated toolbar
17
+ * @param context - context
18
+ */
19
+ build(builder: IToolbarBuilder, context: TToolbarContext): void {
20
+ throw new Error("Method 'build(builder: IToolbarBuilder, context: TToolbarContext)' must be implemented.");
21
+ }
22
+
23
+ /**
24
+ *
25
+ * @param name
26
+ * @param context
27
+ */
28
+ onToolbarItemClick(name: string, context: TToolbarContext): void {
29
+ throw new Error("Method 'onToolbarItemClick(name: string, context: TToolbarContext)' must be implemented.");
30
+ }
31
+ }
@@ -0,0 +1,8 @@
1
+ /*
2
+ * Public API Surface of pilot-web-sdk
3
+ */
4
+ export * from './lib/context';
5
+ export * from './lib/idata.plugin';
6
+ export * from './lib/injectable/index';
7
+ export * from './lib/toolbar/index';
8
+ export * from './lib/menu/index';
@@ -0,0 +1,14 @@
1
+ /* To learn more about this file see: https://angular.io/config/tsconfig. */
2
+ {
3
+ "extends": "../../tsconfig.json",
4
+ "compilerOptions": {
5
+ "outDir": "../../out-tsc/lib",
6
+ "declaration": true,
7
+ "declarationMap": true,
8
+ "inlineSources": true,
9
+ "types": []
10
+ },
11
+ "exclude": [
12
+ "**/*.spec.ts"
13
+ ]
14
+ }
@@ -0,0 +1,10 @@
1
+ /* To learn more about this file see: https://angular.io/config/tsconfig. */
2
+ {
3
+ "extends": "./tsconfig.lib.json",
4
+ "compilerOptions": {
5
+ "declarationMap": false
6
+ },
7
+ "angularCompilerOptions": {
8
+ "compilationMode": "partial"
9
+ }
10
+ }