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

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. package/.eslintrc.json +31 -0
  2. package/README.md +24 -5
  3. package/ng-package.json +6 -6
  4. package/package.json +13 -13
  5. package/src/lib/contexts/context.ts +38 -0
  6. package/src/lib/contexts/document-annotations-list-context.ts +21 -0
  7. package/src/lib/contexts/index.ts +3 -0
  8. package/src/lib/contexts/render-context.ts +28 -0
  9. package/src/lib/data/access.ts +40 -0
  10. package/src/lib/data/annotations.ts +20 -0
  11. package/src/lib/data/attribute.ts +33 -0
  12. package/src/lib/data/data-object.ts +78 -0
  13. package/src/lib/data/file.ts +25 -0
  14. package/src/lib/data/files-snapshot.ts +9 -0
  15. package/src/lib/data/index.ts +12 -0
  16. package/src/lib/data/modifier.ts +31 -0
  17. package/src/lib/data/object-builder.ts +111 -0
  18. package/src/lib/data/organisation-unit.ts +20 -0
  19. package/src/lib/data/person.ts +17 -0
  20. package/src/lib/data/relation.ts +10 -0
  21. package/src/lib/data/subscriptionType.ts +5 -0
  22. package/src/lib/idata.plugin.ts +1 -1
  23. package/src/lib/injectable/index.ts +4 -1
  24. package/src/lib/injectable/modifier-provider.ts +11 -0
  25. package/src/lib/injectable/objects-repository.ts +74 -0
  26. package/src/lib/injectable/render-context-provider.ts +11 -0
  27. package/src/lib/injectable/repository-events.ts +33 -0
  28. package/src/lib/menu/checkable-menu.builder.ts +14 -14
  29. package/src/lib/menu/index.ts +4 -4
  30. package/src/lib/menu/menu-item.builder.ts +44 -44
  31. package/src/lib/menu/menu.builder.ts +78 -78
  32. package/src/lib/menu/menu.ts +23 -23
  33. package/src/lib/toolbar/index.ts +6 -6
  34. package/src/lib/toolbar/toolbar-item-submenu.handler.ts +11 -3
  35. package/src/lib/toolbar/toolbar-item.builder.ts +44 -44
  36. package/src/lib/toolbar/toolbar-menu-item.builder.ts +15 -15
  37. package/src/lib/toolbar/toolbar-toggle-item.builder.ts +14 -14
  38. package/src/lib/toolbar/toolbar.builder.ts +103 -103
  39. package/src/lib/toolbar/toolbar.ts +30 -30
  40. package/src/lib/tools/attribute-permission.info.ts +51 -0
  41. package/src/lib/tools/guid.ts +63 -0
  42. package/src/lib/tools/index.ts +3 -0
  43. package/src/lib/tools/utils.ts +8 -0
  44. package/src/public-api.ts +10 -8
  45. package/tsconfig.lib.json +15 -14
  46. package/tsconfig.lib.prod.json +10 -10
  47. package/src/lib/context.ts +0 -25
  48. package/src/lib/injectable/objects.repository.ts +0 -7
package/.eslintrc.json ADDED
@@ -0,0 +1,31 @@
1
+ {
2
+ "extends": "../../.eslintrc.json",
3
+ "ignorePatterns": ["!**/*"],
4
+ "overrides": [
5
+ {
6
+ "files": ["*.ts"],
7
+ "rules": {
8
+ "@angular-eslint/directive-selector": [
9
+ "error",
10
+ {
11
+ "type": "attribute",
12
+ "prefix": "lib",
13
+ "style": "camelCase"
14
+ }
15
+ ],
16
+ "@angular-eslint/component-selector": [
17
+ "error",
18
+ {
19
+ "type": "element",
20
+ "prefix": "lib",
21
+ "style": "kebab-case"
22
+ }
23
+ ]
24
+ }
25
+ },
26
+ {
27
+ "files": ["*.html"],
28
+ "rules": {}
29
+ }
30
+ ]
31
+ }
package/README.md CHANGED
@@ -1,5 +1,24 @@
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.
1
+ # PilotWebSdk
2
+
3
+ This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 15.1.0.
4
+
5
+ ## Code scaffolding
6
+
7
+ Run `ng generate component component-name --project pilot-web-sdk` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project pilot-web-sdk`.
8
+ > Note: Don't forget to add `--project pilot-web-sdk` or else it will be added to the default project in your `angular.json` file.
9
+
10
+ ## Build
11
+
12
+ Run `ng build pilot-web-sdk` to build the project. The build artifacts will be stored in the `dist/` directory.
13
+
14
+ ## Publishing
15
+
16
+ After building your library with `ng build pilot-web-sdk`, go to the dist folder `cd dist/pilot-web-sdk` and run `npm publish`.
17
+
18
+ ## Running unit tests
19
+
20
+ Run `ng test pilot-web-sdk` to execute the unit tests via [Karma](https://karma-runner.github.io).
21
+
22
+ ## Further help
23
+
24
+ To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
package/ng-package.json CHANGED
@@ -1,7 +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
- }
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
7
  }
package/package.json CHANGED
@@ -1,13 +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
- }
1
+ {
2
+ "name": "@pilotdev/pilot-web-sdk",
3
+ "version": "24.4.0",
4
+ "peerDependencies": {
5
+ "@angular/common": "^15.1.4",
6
+ "@angular/core": "^15.1.4",
7
+ "rxjs": "7.8.1"
8
+ },
9
+ "dependencies": {
10
+ "tslib": "^2.3.0"
11
+ },
12
+ "sideEffects": false
13
+ }
@@ -0,0 +1,38 @@
1
+ import { IDataObject } from "../data";
2
+
3
+
4
+ /**
5
+ * Contex for objects view
6
+ */
7
+ export class ObjectsViewContext {
8
+ private readonly _selectedObjects: IDataObject[];
9
+ private readonly _shortcuts: IDataObject[];
10
+ private readonly _context: IDataObject;
11
+
12
+ constructor(selectedObjects: IDataObject[], context: IDataObject, shortcuts?: IDataObject[]) {
13
+ this._selectedObjects = selectedObjects;
14
+ this._context = context;
15
+ this._shortcuts = shortcuts ?? [];
16
+ }
17
+
18
+ /**
19
+ *
20
+ */
21
+ public get selectedObjects(): IDataObject[] {
22
+ return this._selectedObjects;
23
+ }
24
+
25
+ /**
26
+ *
27
+ */
28
+ public get contextObject(): IDataObject {
29
+ return this._context;
30
+ }
31
+
32
+ /**
33
+ *
34
+ */
35
+ public get shortcuts(): IDataObject[] {
36
+ return this._shortcuts;
37
+ }
38
+ }
@@ -0,0 +1,21 @@
1
+ import { IAnnotationContainerObject } from "../data";
2
+
3
+
4
+ /**
5
+ * Context for document annotations list
6
+ */
7
+ export class DocumentAnnotationsListContext {
8
+ private readonly _selectedAnnotations: IAnnotationContainerObject[];
9
+
10
+ constructor(selectedAnnotations: IAnnotationContainerObject[]) {
11
+ this._selectedAnnotations = selectedAnnotations;
12
+ }
13
+
14
+ /**
15
+ *
16
+ */
17
+ public get selectedAnnotations(): IAnnotationContainerObject[] {
18
+ return this._selectedAnnotations;
19
+ }
20
+
21
+ }
@@ -0,0 +1,3 @@
1
+ export * from './context';
2
+ export * from './document-annotations-list-context';
3
+ export * from './render-context';
@@ -0,0 +1,28 @@
1
+ import { IDataObject } from "../data";
2
+
3
+ /**
4
+ * Context for xps render
5
+ */
6
+ export class RenderContext {
7
+ private readonly _dataObject: IDataObject;
8
+ private readonly _selectedVersion: string;
9
+
10
+ constructor(dataObject: IDataObject, selectedVersion: string) {
11
+ this._dataObject = dataObject;
12
+ this._selectedVersion = selectedVersion;
13
+ }
14
+
15
+ /**
16
+ * Target object
17
+ */
18
+ public get dataObject(): IDataObject {
19
+ return this._dataObject;
20
+ }
21
+
22
+ /**
23
+ * Selected version time
24
+ */
25
+ public get selectedVersion(): string {
26
+ return this._selectedVersion;
27
+ }
28
+ }
@@ -0,0 +1,40 @@
1
+ export enum AccessLevel {
2
+ None = 0,
3
+ Create = 1 << 0,
4
+ Edit = 1 << 1,
5
+ View = 1 << 2,
6
+ Freeze = 1 << 3,
7
+ Agreement = 1 << 4,
8
+ Share = 1 << 5,
9
+
10
+ ViewCreate = View | Create,
11
+ ViewEdit = View | Create | Edit,
12
+ ViewEditAgrement = ViewEdit | Agreement,
13
+ Full = View | Create | Edit | Freeze | Agreement | Share
14
+ }
15
+
16
+ export enum AccessType {
17
+ Allow,
18
+ Deny
19
+ }
20
+
21
+ export enum AccessInheritance {
22
+ None,
23
+ InheritUntilSecret,
24
+ InheritWholeSubtree
25
+ }
26
+
27
+ export interface IAccessRecord {
28
+ get orgUnitId(): number;
29
+ get access(): IAccess;
30
+ get recordOwnerPosition(): number;
31
+ get inheritanceSource(): string;
32
+ }
33
+
34
+ export interface IAccess {
35
+ get type(): AccessType;
36
+ get accessLevel(): AccessLevel;
37
+ get validThrough(): string;
38
+ get inheritance(): AccessInheritance;
39
+ get typeIds(): number[];
40
+ }
@@ -0,0 +1,20 @@
1
+ import { IDataObject } from "./data-object";
2
+
3
+
4
+ export interface IAnnotationContainerObject {
5
+ get container(): IAnnotationContainer;
6
+ get source(): IDataObject;
7
+ get attributes(): any;
8
+ }
9
+
10
+
11
+ export interface IAnnotationContainer {
12
+ get annotationId(): string;
13
+ get version(): string;
14
+ get positionX(): number;
15
+ get positionY(): number;
16
+ get pageNumber(): number;
17
+ get data(): string;
18
+ get kind(): string;
19
+ }
20
+
@@ -0,0 +1,33 @@
1
+
2
+ export interface IAttribute {
3
+ get name(): string;
4
+ get title(): string;
5
+ get obligatory(): boolean;
6
+ get type(): AttributeType;
7
+ get displayHeight(): number;
8
+ get showInTree(): boolean;
9
+ get displaySortOrder(): number;
10
+ get isService(): boolean;
11
+ get configuration(): string;
12
+ get joinWithPrevious(): boolean;
13
+ get isUnique(): boolean;
14
+ get groupTitle(): string;
15
+ get editableForPositionsSource(): string[];
16
+ }
17
+
18
+
19
+ export enum AttributeType {
20
+ Integer = 0,
21
+ Double = 1,
22
+ DateTime = 2,
23
+ String = 3,
24
+ Decimal = 4,
25
+ Numerator = 5,
26
+ Array = 6,
27
+ UserState = 7,
28
+ OrgUnit = 8,
29
+ ElementBook = 9,
30
+ Guid = 10,
31
+ IntegerArray = 11,
32
+ Unknown = 99
33
+ }
@@ -0,0 +1,78 @@
1
+ import { AccessLevel, IAccessRecord } from "./access";
2
+ import { IAttribute } from "./attribute";
3
+ import { IFileSnapshot } from "./files-snapshot";
4
+ import { IPerson } from "./person";
5
+ import { IRelation } from "./relation";
6
+
7
+
8
+ export enum RelationType {
9
+ SourceFiles = 1,
10
+ TaskInitiatorAttachments = 2,
11
+ TaskExecutorAttachments = 3,
12
+ MessageAttachments = 4,
13
+ Custom = 5,
14
+ TaskAttachments = 6,
15
+ }
16
+
17
+ export enum ObjectState {
18
+ Alive,
19
+ InRecycleBin,
20
+ DeletedPermanently,
21
+ Frozen,
22
+ LockRequested,
23
+ LockAccepted
24
+ }
25
+
26
+ export interface IDataObject {
27
+ get id(): string;
28
+ get parentId(): string;
29
+ get title(): string;
30
+ get type(): IType;
31
+ get attributes(): { [key: string]: any; };
32
+ get children(): IChild[];
33
+ get creator(): IPerson;
34
+ get created(): string;
35
+ get actualFileSnapshot(): IFileSnapshot;
36
+ get previousFileSnapshots(): IFileSnapshot[];
37
+ get context(): string[];
38
+ get relations(): IRelation[];
39
+ get access(): IAccessRecord[];
40
+ get accessLevels(): { [key: number]: AccessLevel; };
41
+ get stateInfo(): IStateInfo;
42
+ get secretInfo(): ISecretInfo;
43
+ }
44
+
45
+ export interface IType {
46
+ get id(): number;
47
+ get title(): string;
48
+ get name(): string;
49
+ get icon(): string;
50
+ get sort(): number;
51
+ get hasFiles(): boolean;
52
+ get children(): number[];
53
+ get attributes(): IAttribute[];
54
+ get isDeleted(): boolean;
55
+ get kind(): number;
56
+ get isMountable(): boolean;
57
+ get isService(): boolean;
58
+ get isProject(): boolean;
59
+ get configuration(): string;
60
+ }
61
+
62
+ export interface IChild {
63
+ get objectId(): string;
64
+ get typeId(): number;
65
+ }
66
+
67
+ export interface ISecretInfo {
68
+ get isSecret(): boolean;
69
+ get secretParentId(): string;
70
+ get secretChangedBy(): number;
71
+ }
72
+
73
+ export interface IStateInfo {
74
+ get state(): ObjectState;
75
+ get date(): string;
76
+ get personId(): number;
77
+ get positionId(): number;
78
+ }
@@ -0,0 +1,25 @@
1
+ export interface IFile {
2
+ get body(): IFileBody;
3
+ get name(): string;
4
+ get signatures(): ISignature[];
5
+ }
6
+
7
+ export interface IFileBody {
8
+ get id(): string;
9
+ get size(): number;
10
+ get md5(): any;
11
+ get modified(): string;
12
+ get created(): string;
13
+ get accessed(): string;
14
+ }
15
+
16
+ export interface ISignature {
17
+ get id(): string;
18
+ get databaseId(): string;
19
+ get positionId(): number;
20
+ get role(): string;
21
+ get sign(): string;
22
+ get requestedSigner(): string;
23
+ get isAdditional(): boolean;
24
+ get objectId(): string;
25
+ }
@@ -0,0 +1,9 @@
1
+ import { IFile } from "./file";
2
+
3
+ export interface IFileSnapshot {
4
+ get created(): string;
5
+ get creatorId(): number;
6
+ get reason(): string;
7
+ get files(): IFile[];
8
+ get hasAnnotations(): boolean;
9
+ }
@@ -0,0 +1,12 @@
1
+ export * from './access';
2
+ export * from './annotations';
3
+ export * from './attribute';
4
+ export * from './data-object';
5
+ export * from './file';
6
+ export * from './files-snapshot';
7
+ export * from './person';
8
+ export * from './relation';
9
+ export * from './object-builder';
10
+ export * from './modifier';
11
+ export * from './organisation-unit'
12
+ export * from './subscriptionType'
@@ -0,0 +1,31 @@
1
+ import { Observable } from "rxjs/internal/Observable";
2
+ import { IDataObject } from ".";
3
+ import { IObjectBuilder } from "./object-builder";
4
+
5
+ /**
6
+ * Creates, modifies and deletes objects
7
+ */
8
+ export interface IModifier {
9
+ /**
10
+ * Creates a new object
11
+ *
12
+ * @param id New object id
13
+ * @param parentId Parent id
14
+ * @param typeId Creating object's type id
15
+ * @return Fluent interface that enables you to modify created object
16
+ */
17
+ create(id: string, parentId: string, typeId: number): IObjectBuilder;
18
+ /**
19
+ * Edits existing object
20
+ *
21
+ * @param id Id of object to modify
22
+ * @returns Fluent interface that enables you to modify created object
23
+ */
24
+ edit(id: string) : IObjectBuilder;
25
+ /**
26
+ * Applies all the changes have been made in modifier
27
+ *
28
+ * @returns Created and edited objects wrapped in cold Observable
29
+ */
30
+ apply(): Observable<IDataObject[]>;
31
+ }
@@ -0,0 +1,111 @@
1
+ import { AttributeType } from "./attribute";
2
+ import { IAnnotationContainer } from "./annotations";
3
+ import { IAccessRecord } from "./access";
4
+ import { IRelation } from "./relation";
5
+
6
+ /**
7
+ * Fluent interface that enables you to modify the associated object
8
+ */
9
+ export interface IObjectBuilder {
10
+ /**
11
+ * Sets the string attribute value
12
+ *
13
+ * @param name Attribute name
14
+ * @param value Attribute value
15
+ * @returns Self
16
+ */
17
+ setAttribute(name: string, value: any, type: AttributeType): IObjectBuilder;
18
+ /**
19
+ * Adds access record to an object
20
+ *
21
+ * @param record Access record
22
+ * @returns Self
23
+ */
24
+ setAccess(record: IAccessRecord): IObjectBuilder;
25
+ /**
26
+ * Removes access record
27
+ *
28
+ * @param record Access record
29
+ * @returns Self
30
+ */
31
+ removeAccess(record: IAccessRecord): IObjectBuilder;
32
+ /**
33
+ * Adds a relation
34
+ *
35
+ * @param relation Relation
36
+ * @returns Self
37
+ */
38
+ addRelation(relation: IRelation): IObjectBuilder;
39
+ /**
40
+ * Removes relation
41
+ *
42
+ * @param relationId Relation id
43
+ * @returns Self
44
+ */
45
+ removeRelation(relationId: string): IObjectBuilder;
46
+ /**
47
+ * Sets new type. It is recommended to use this method only for recovering permanently deleted objects. In other cases, this can lead to system malfunction.
48
+ *
49
+ * @param typeId Type id
50
+ * @returns Self
51
+ */
52
+ setTypeId(typeId: number): IObjectBuilder;
53
+ /**
54
+ * Sets new parent
55
+ *
56
+ * @param parentId Parent id
57
+ * @returns Self
58
+ */
59
+ setParentId(parentId: string): IObjectBuilder;
60
+ /**
61
+ * Adds file snapshot
62
+ *
63
+ * @param reason Reason
64
+ * @returns Self
65
+ */
66
+ createSnapshot(reason: string): IObjectBuilder;
67
+ /**
68
+ * Makes file snapshot actual
69
+ *
70
+ * @param version Version of file snapshot to make actual
71
+ * @param reason Reason
72
+ * @returns Self
73
+ */
74
+ createSnapshotFrom(version: string, reason: string): IObjectBuilder;
75
+ /**
76
+ * Sets permanently deleted flag
77
+ *
78
+ * @param isDeleted Value
79
+ * @returns Self
80
+ */
81
+ setIsDeleted(isDeleted: boolean): IObjectBuilder;
82
+ /**
83
+ * Set flag in recycle bin
84
+ *
85
+ * @param isInRecycleBin Value
86
+ * @returns Self
87
+ */
88
+ setIsInRecycleBin(isInRecycleBin: boolean): IObjectBuilder;
89
+ /**
90
+ * Sets frozen flag
91
+ *
92
+ * @param isFreezed Value
93
+ * @returns Self
94
+ */
95
+ setIsFreezed(isFreezed: boolean): IObjectBuilder;
96
+ /**
97
+ * Sets object's secret info
98
+ *
99
+ * @param isSecret Value
100
+ * @returns Self
101
+ */
102
+ setIsSecret(isSecret: boolean): IObjectBuilder;
103
+ /**
104
+ * Adds or changes a annotation
105
+ *
106
+ * @param container Annotation container
107
+ * @param attrbutes Annotation attributes
108
+ * @returns Self
109
+ */
110
+ addAnnotationContainer(container: IAnnotationContainer, attrbutes: any): IObjectBuilder;
111
+ }
@@ -0,0 +1,20 @@
1
+
2
+ export interface IOrganizationUnit {
3
+ get id(): number;
4
+ get title(): string;
5
+ get kind(): OrgUnitKind;
6
+ get children(): number[];
7
+ get isDeleted(): boolean;
8
+ get isBoss(): boolean;
9
+ get version(): number;
10
+ get person(): number;
11
+ get vicePersons(): number[];
12
+ get isCanceled(): boolean;
13
+ get groupPersons(): number[];
14
+ }
15
+
16
+ export enum OrgUnitKind {
17
+ Department = 0,
18
+ Position = 1,
19
+ Group = 2
20
+ }
@@ -0,0 +1,17 @@
1
+ export interface IPerson {
2
+ get id(): number;
3
+ get login(): string;
4
+ get isInactive(): boolean;
5
+ get displayName(): string;
6
+ get positions(): number[];
7
+ get groups(): number[];
8
+ get bossOf(): number[];
9
+ get allOrgUnits(): number[];
10
+ get comment(): string;
11
+ get email(): string;
12
+ get sid(): string;
13
+ get uidDn(): string;
14
+ get isDeleted(): boolean;
15
+ get isAdmin(): boolean;
16
+ get version(): number;
17
+ }
@@ -0,0 +1,10 @@
1
+ import { getErrorString } from "@microsoft/signalr/dist/esm/Utils";
2
+ import { RelationType } from "./data-object";
3
+
4
+ export interface IRelation {
5
+ get id(): string;
6
+ get targetId(): string;
7
+ get type(): RelationType;
8
+ get name(): string;
9
+ get versionId(): string;
10
+ }
@@ -0,0 +1,5 @@
1
+
2
+ export enum SubscriptionType {
3
+ Shallow,
4
+ Deep
5
+ }
@@ -1,2 +1,2 @@
1
-
1
+
2
2
  export interface IDataPlugin {}
@@ -1 +1,4 @@
1
- export * from './objects.repository';
1
+ export * from './objects-repository';
2
+ export * from './render-context-provider';
3
+ export * from './modifier-provider'
4
+ export * from './repository-events'
@@ -0,0 +1,11 @@
1
+ import { IModifier } from "../data/modifier";
2
+
3
+ /**
4
+ * Provides modifier
5
+ */
6
+ export interface IModifierProvider {
7
+ /**
8
+ *
9
+ */
10
+ newModifier(): IModifier;
11
+ }