pigallery2-extension-kit 2.5.0-edge6 → 2.5.0-edge8

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.ts CHANGED
@@ -1,2 +1,2 @@
1
- export {IServerExtension, IExtensionObject, IClientExtension, IClientUIConfig} from './lib/backend/model/extension/IExtension';
1
+ export {IServerExtension, IExtensionObject} from './lib/backend/model/extension/IExtension';
2
2
 
@@ -23,7 +23,7 @@ export declare class ExpressRouteWrapper implements IExtensionRESTRoute {
23
23
  private readonly func;
24
24
  private readonly extLogger;
25
25
  constructor(router: express.Router, name: string, func: 'get' | 'use' | 'put' | 'post' | 'delete', extLogger: ILogger);
26
- mediaJsonResponse(paths: string[], minRole: UserRoles, cb: (params: ParamsDictionary, body: any, user: UserDTO, media: MediaEntity, repository: Repository<MediaEntity>) => Promise<unknown> | unknown): string;
26
+ mediaJsonResponse(paths: string[], minRole: UserRoles, invalidateDirectory: boolean, cb: (params: ParamsDictionary, body: any, user: UserDTO, media: MediaEntity, repository: Repository<MediaEntity>) => Promise<unknown> | unknown): string;
27
27
  jsonResponse(paths: string[], minRole: UserRoles, cb: (params?: ParamsDictionary, body?: any, user?: UserDTO) => Promise<unknown> | unknown): string;
28
28
  rawMiddleware(paths: string[], minRole: UserRoles, mw: (req: Request, res: Response, next: NextFunction) => void | Promise<void>): string;
29
29
  private getAuthMWs;
@@ -106,11 +106,13 @@ export interface IExtensionRESTRoute {
106
106
  * Looks for req.body.media for the media path and calls the callback with that media entry.
107
107
  * Sends a pigallery2 standard JSON object with payload or error message back to the client.
108
108
  * @param paths RESTapi path, relative to the extension base endpoint
109
+ * @param invalidateDirectory set to false to prevent invalidating the directory.
110
+ * Invalidation is resource-intensive and should be avoided if media or its directory is not changed.
109
111
  * @param minRole set to null to omit auer check (ie make the endpoint public)
110
112
  * @param cb function callback
111
113
  * @return newly added REST api path
112
114
  */
113
- mediaJsonResponse(paths: string[], minRole: UserRoles, cb: (params: ParamsDictionary, body: any, user: UserDTO, media: MediaEntity, repository: Repository<MediaEntity>) => Promise<unknown> | unknown): string;
115
+ mediaJsonResponse(paths: string[], minRole: UserRoles, invalidateDirectory: boolean, cb: (params: ParamsDictionary, body: any, user: UserDTO, media: MediaEntity, repository: Repository<MediaEntity>) => Promise<unknown> | unknown): string;
114
116
  /**
115
117
  * Sends a pigallery2 standard JSON object with payload or error message back to the client.
116
118
  * @param paths RESTapi path, relative to the extension base endpoint
@@ -10,6 +10,29 @@ export interface IClientSVGIconConfig {
10
10
  */
11
11
  items: string;
12
12
  }
13
+ export interface IClientMediaButtonPopupFields {
14
+ /**
15
+ * Id of the field. This how it will listed in the body.
16
+ */
17
+ id: string;
18
+ /**
19
+ * Type of the field.
20
+ */
21
+ type: 'string' | 'number' | 'boolean';
22
+ /**
23
+ * Label of the field. This string will be shown in the popup.
24
+ */
25
+ label: string;
26
+ /**
27
+ * Default value of the field. Should appropriately to the type.
28
+ */
29
+ defaultValue?: string | number | boolean;
30
+ /**
31
+ * If true, the field will be required.
32
+ * If boolean, the field will be required to be true to click the button.
33
+ */
34
+ required?: boolean;
35
+ }
13
36
  export interface IClientMediaButtonPopupConfig {
14
37
  /**
15
38
  * Header of the popup.
@@ -27,6 +50,10 @@ export interface IClientMediaButtonPopupConfig {
27
50
  * Fields to show in the popup as editable text fields.
28
51
  */
29
52
  fields?: IClientMediaFields[];
53
+ /**
54
+ * Custom fields to show in the popup.
55
+ */
56
+ customFields?: IClientMediaButtonPopupFields[];
30
57
  }
31
58
  export interface IClientMediaButtonConfig {
32
59
  /**
@@ -65,6 +92,12 @@ export interface IClientMediaButtonConfig {
65
92
  * If set, the button will only be shown to users with this role or higher.
66
93
  */
67
94
  minUserRole?: UserRoles;
95
+ /**
96
+ * If set, the button click will not invalidate the directory.
97
+ * Upon invalidation, the whole directory will be recalculated.
98
+ * If you change any media file, you should set this to false.
99
+ */
100
+ skipDirectoryInvalidation?: boolean;
68
101
  }
69
102
  export interface UIExtensionDTO {
70
103
  extensionBasePath: string;
@@ -19,11 +19,13 @@ export declare class ContentLoaderService {
19
19
  };
20
20
  private searchId;
21
21
  private ongoingSearch;
22
+ private currentContentRequest;
22
23
  constructor(networkService: NetworkService, galleryCacheService: GalleryCacheService, shareService: ShareService, navigationService: NavigationService);
23
24
  setContent(content: ContentWrapperWithError): void;
24
- loadDirectory(directoryName: string): Promise<void>;
25
- search(query: string): Promise<void>;
25
+ loadDirectory(directoryName: string, forceReload?: boolean): Promise<void>;
26
+ search(query: string, forceReload?: boolean): Promise<void>;
26
27
  isSearchResult(): boolean;
28
+ reloadCurrentContent(): Promise<void>;
27
29
  }
28
30
  export declare class ContentWrapperWithError extends ContentWrapper {
29
31
  error?: string;
@@ -11,9 +11,12 @@ export declare class MediaButtonModalComponent implements OnInit, OnDestroy {
11
11
  constructor(modalService: MediaButtonModalService);
12
12
  ngOnInit(): void;
13
13
  ngOnDestroy(): void;
14
- private initFormData;
15
14
  getFieldLabel(field: IClientMediaFields): string;
16
15
  getFieldValue(field: IClientMediaFields): any;
17
16
  closeModal(): void;
17
+ onKeyDown(event: KeyboardEvent): void;
18
18
  executeAction(): void;
19
+ isFormValid(): boolean;
20
+ private initFormData;
21
+ private getDefaultValueForType;
19
22
  }
@@ -2,6 +2,7 @@ import { GridMedia } from '../../GridMedia';
2
2
  import { IClientMediaButtonConfigWithBaseApiPath } from '../photo.grid.gallery.component';
3
3
  import { NotificationService } from '../../../../../model/notification.service';
4
4
  import { NetworkService } from '../../../../../model/network/network.service';
5
+ import { ContentLoaderService } from '../../../contentLoader.service';
5
6
  export interface MediaButtonModalData {
6
7
  button: IClientMediaButtonConfigWithBaseApiPath;
7
8
  media: GridMedia;
@@ -10,8 +11,9 @@ export interface MediaButtonModalData {
10
11
  export declare class MediaButtonModalService {
11
12
  private notificationService;
12
13
  private networkService;
14
+ private contentLoader;
13
15
  private modalData$;
14
- constructor(notificationService: NotificationService, networkService: NetworkService);
16
+ constructor(notificationService: NotificationService, networkService: NetworkService, contentLoader: ContentLoaderService);
15
17
  get modalData(): import("rxjs").Observable<MediaButtonModalData>;
16
18
  showModal(button: IClientMediaButtonConfigWithBaseApiPath, media: GridMedia): void;
17
19
  hideModal(): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pigallery2-extension-kit",
3
- "version": "2.5.0-edge6",
3
+ "version": "2.5.0-edge8",
4
4
  "description": "Interfaces for developing extensions for pigallery2",
5
5
  "author": "Patrik J. Braun",
6
6
  "homepage": "https://github.com/bpatrik/pigallery2",