@rxap/directives 15.0.0 → 16.0.0-dev.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 (42) hide show
  1. package/esm2022/lib/avatar-background-image.directive.mjs +60 -0
  2. package/esm2022/lib/background-image.directive.mjs +136 -0
  3. package/esm2022/lib/confirm-click.mjs +35 -0
  4. package/esm2022/lib/contenteditable.directive.mjs +83 -0
  5. package/esm2022/lib/full-width.directive.mjs +33 -0
  6. package/esm2022/lib/if-truthy.directive.mjs +74 -0
  7. package/esm2022/lib/method-template.directive.mjs +166 -0
  8. package/esm2022/lib/method.directive.mjs +120 -0
  9. package/esm2022/lib/movable-divider.directive.mjs +105 -0
  10. package/esm2022/lib/prevent-default.directive.mjs +33 -0
  11. package/esm2022/lib/share-button.directive.mjs +78 -0
  12. package/esm2022/lib/stop-immediate-propagation.directive.mjs +33 -0
  13. package/esm2022/lib/stop-propagation.directive.mjs +33 -0
  14. package/{fesm2020 → fesm2022}/rxap-directives.mjs +106 -107
  15. package/fesm2022/rxap-directives.mjs.map +1 -0
  16. package/lib/avatar-background-image.directive.d.ts +1 -1
  17. package/lib/background-image.directive.d.ts +4 -4
  18. package/lib/contenteditable.directive.d.ts +1 -1
  19. package/lib/if-truthy.directive.d.ts +1 -1
  20. package/lib/method-template.directive.d.ts +1 -1
  21. package/lib/method.directive.d.ts +1 -1
  22. package/lib/movable-divider.directive.d.ts +1 -1
  23. package/lib/share-button.directive.d.ts +1 -1
  24. package/package.json +13 -19
  25. package/esm2020/lib/avatar-background-image.directive.mjs +0 -58
  26. package/esm2020/lib/background-image.directive.mjs +0 -134
  27. package/esm2020/lib/confirm-click.mjs +0 -34
  28. package/esm2020/lib/contenteditable.directive.mjs +0 -81
  29. package/esm2020/lib/full-width.directive.mjs +0 -31
  30. package/esm2020/lib/if-truthy.directive.mjs +0 -72
  31. package/esm2020/lib/method-template.directive.mjs +0 -164
  32. package/esm2020/lib/method.directive.mjs +0 -118
  33. package/esm2020/lib/movable-divider.directive.mjs +0 -103
  34. package/esm2020/lib/prevent-default.directive.mjs +0 -31
  35. package/esm2020/lib/share-button.directive.mjs +0 -75
  36. package/esm2020/lib/stop-immediate-propagation.directive.mjs +0 -31
  37. package/esm2020/lib/stop-propagation.directive.mjs +0 -31
  38. package/fesm2015/rxap-directives.mjs +0 -959
  39. package/fesm2015/rxap-directives.mjs.map +0 -1
  40. package/fesm2020/rxap-directives.mjs.map +0 -1
  41. /package/{esm2020 → esm2022}/index.mjs +0 -0
  42. /package/{esm2020 → esm2022}/rxap-directives.mjs +0 -0
@@ -1,959 +0,0 @@
1
- import { __awaiter, __decorate, __metadata } from 'tslib';
2
- import * as i0 from '@angular/core';
3
- import { isDevMode, ElementRef, Renderer2, Directive, Inject, Input, NgModule, HostListener, Injectable, HostBinding, EventEmitter, Output, TemplateRef, ViewContainerRef, ChangeDetectorRef } from '@angular/core';
4
- import * as i1 from '@rxap/services';
5
- import { ImageLoaderService, AvatarImageService } from '@rxap/services';
6
- import { Required, DebounceCall, coerceBoolean } from '@rxap/utilities';
7
- import { ToggleSubject } from '@rxap/utilities/rxjs';
8
- import { Subscription, fromEvent } from 'rxjs';
9
- import { tap } from 'rxjs/operators';
10
-
11
- var GlobalStyleOptions;
12
- (function (GlobalStyleOptions) {
13
- GlobalStyleOptions["INITIAL"] = "initial";
14
- GlobalStyleOptions["INHERIT"] = "inherit";
15
- })(GlobalStyleOptions || (GlobalStyleOptions = {}));
16
- // TODO : complete description
17
- // https://www.w3schools.com/cssref/css3_pr_background-size.asp
18
- var BackgroundSizeOptions;
19
- (function (BackgroundSizeOptions) {
20
- BackgroundSizeOptions["AUTO"] = "auto";
21
- BackgroundSizeOptions["COVER"] = "cover";
22
- BackgroundSizeOptions["CONTAIN"] = "contain";
23
- })(BackgroundSizeOptions || (BackgroundSizeOptions = {}));
24
- // TODO : complete options and description
25
- // https://www.w3schools.com/cssref/pr_background-repeat.asp
26
- var BackgroundRepeatOptions;
27
- (function (BackgroundRepeatOptions) {
28
- BackgroundRepeatOptions["NO_REPEAT"] = "no-repeat";
29
- })(BackgroundRepeatOptions || (BackgroundRepeatOptions = {}));
30
- // TODO : complete options and description
31
- // https://www.w3schools.com/cssref/pr_background-position.asp
32
- var BackgroundPositionOptions;
33
- (function (BackgroundPositionOptions) {
34
- BackgroundPositionOptions["CENTER"] = "center";
35
- BackgroundPositionOptions["CENTER_CENTER"] = "center center";
36
- })(BackgroundPositionOptions || (BackgroundPositionOptions = {}));
37
- class BackgroundImageDirective {
38
- // TODO : add inputs for all 'background-*' styles
39
- constructor(host, renderer, imageLoader) {
40
- this.host = host;
41
- this.renderer = renderer;
42
- this.imageLoader = imageLoader;
43
- this.imageUrl = null;
44
- }
45
- ngOnInit() {
46
- if (this.size) {
47
- this.sizeChange(this.size);
48
- }
49
- if (this.position) {
50
- this.positionChange(this.position);
51
- }
52
- if (this.repeat) {
53
- this.repeatChange(this.repeat);
54
- }
55
- }
56
- ngOnChanges(changes) {
57
- for (const propertyKey of Object.keys(changes)) {
58
- switch (propertyKey) {
59
- case 'imageUrl':
60
- if (changes.imageUrl.currentValue) {
61
- this.imageUrlChange(changes.imageUrl.currentValue);
62
- }
63
- break;
64
- case 'size':
65
- this.sizeChange(changes.size.currentValue);
66
- break;
67
- case 'repeat':
68
- this.repeatChange(changes.repeat.currentValue);
69
- break;
70
- case 'position':
71
- this.positionChange(changes.position.currentValue);
72
- break;
73
- }
74
- }
75
- }
76
- repeatChange(repeat) {
77
- this.renderer.setStyle(this.host.nativeElement, 'background-repeat', repeat);
78
- }
79
- positionChange(position) {
80
- this.renderer.setStyle(this.host.nativeElement, 'background-position', position);
81
- }
82
- sizeChange(size) {
83
- this.renderer.setStyle(this.host.nativeElement, 'background-size', size);
84
- }
85
- imageUrlChange(imageUrl) {
86
- return __awaiter(this, void 0, void 0, function* () {
87
- if (this.placeholderImageUrl) {
88
- this.renderer.setStyle(this.host.nativeElement, 'background-image', `url("${this.placeholderImageUrl}")`);
89
- }
90
- if (imageUrl) {
91
- yield this.imageLoader.load(imageUrl);
92
- this.renderer.setStyle(this.host.nativeElement, 'background-image', `url("${imageUrl}")`);
93
- }
94
- else {
95
- if (isDevMode()) {
96
- console.warn('background image url is not defined');
97
- }
98
- }
99
- });
100
- }
101
- }
102
- BackgroundImageDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: BackgroundImageDirective, deps: [{ token: ElementRef }, { token: Renderer2 }, { token: ImageLoaderService }], target: i0.ɵɵFactoryTarget.Directive });
103
- BackgroundImageDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.3", type: BackgroundImageDirective, selector: "[rxapBackgroundImage]", inputs: { imageUrl: ["rxapBackgroundImage", "imageUrl"], placeholderImageUrl: "placeholderImageUrl", size: "size", repeat: "repeat", position: "position" }, usesOnChanges: true, ngImport: i0 });
104
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: BackgroundImageDirective, decorators: [{
105
- type: Directive,
106
- args: [{
107
- selector: '[rxapBackgroundImage]',
108
- }]
109
- }], ctorParameters: function () {
110
- return [{ type: i0.ElementRef, decorators: [{
111
- type: Inject,
112
- args: [ElementRef]
113
- }] }, { type: i0.Renderer2, decorators: [{
114
- type: Inject,
115
- args: [Renderer2]
116
- }] }, { type: i1.ImageLoaderService, decorators: [{
117
- type: Inject,
118
- args: [ImageLoaderService]
119
- }] }];
120
- }, propDecorators: { imageUrl: [{
121
- type: Input,
122
- args: ['rxapBackgroundImage']
123
- }], placeholderImageUrl: [{
124
- type: Input
125
- }], size: [{
126
- type: Input
127
- }], repeat: [{
128
- type: Input
129
- }], position: [{
130
- type: Input
131
- }] } });
132
- class BackgroundImageDirectiveModule {
133
- }
134
- BackgroundImageDirectiveModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: BackgroundImageDirectiveModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
135
- BackgroundImageDirectiveModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.0.3", ngImport: i0, type: BackgroundImageDirectiveModule, declarations: [BackgroundImageDirective], exports: [BackgroundImageDirective] });
136
- BackgroundImageDirectiveModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: BackgroundImageDirectiveModule });
137
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: BackgroundImageDirectiveModule, decorators: [{
138
- type: NgModule,
139
- args: [{
140
- declarations: [BackgroundImageDirective],
141
- exports: [BackgroundImageDirective],
142
- }]
143
- }] });
144
-
145
- class PreventDefaultDirective {
146
- onClick($event) {
147
- $event.preventDefault();
148
- }
149
- }
150
- PreventDefaultDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: PreventDefaultDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
151
- PreventDefaultDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.3", type: PreventDefaultDirective, selector: "[rxapPreventDefault]", host: { listeners: { "click": "onClick($event)" } }, ngImport: i0 });
152
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: PreventDefaultDirective, decorators: [{
153
- type: Directive,
154
- args: [{
155
- selector: '[rxapPreventDefault]'
156
- }]
157
- }], propDecorators: { onClick: [{
158
- type: HostListener,
159
- args: ['click', ['$event']]
160
- }] } });
161
- class PreventDefaultDirectiveModule {
162
- }
163
- PreventDefaultDirectiveModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: PreventDefaultDirectiveModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
164
- PreventDefaultDirectiveModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.0.3", ngImport: i0, type: PreventDefaultDirectiveModule, declarations: [PreventDefaultDirective], exports: [PreventDefaultDirective] });
165
- PreventDefaultDirectiveModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: PreventDefaultDirectiveModule });
166
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: PreventDefaultDirectiveModule, decorators: [{
167
- type: NgModule,
168
- args: [{
169
- exports: [PreventDefaultDirective],
170
- declarations: [PreventDefaultDirective]
171
- }]
172
- }] });
173
-
174
- class StopImmediatePropagationDirective {
175
- onClick($event) {
176
- $event.stopImmediatePropagation();
177
- }
178
- }
179
- StopImmediatePropagationDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: StopImmediatePropagationDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
180
- StopImmediatePropagationDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.3", type: StopImmediatePropagationDirective, selector: "[rxapStopImmediatePropagation]", host: { listeners: { "click": "onClick($event)" } }, ngImport: i0 });
181
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: StopImmediatePropagationDirective, decorators: [{
182
- type: Directive,
183
- args: [{
184
- selector: '[rxapStopImmediatePropagation]'
185
- }]
186
- }], propDecorators: { onClick: [{
187
- type: HostListener,
188
- args: ['click', ['$event']]
189
- }] } });
190
- class StopImmediatePropagationDirectiveModule {
191
- }
192
- StopImmediatePropagationDirectiveModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: StopImmediatePropagationDirectiveModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
193
- StopImmediatePropagationDirectiveModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.0.3", ngImport: i0, type: StopImmediatePropagationDirectiveModule, declarations: [StopImmediatePropagationDirective], exports: [StopImmediatePropagationDirective] });
194
- StopImmediatePropagationDirectiveModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: StopImmediatePropagationDirectiveModule });
195
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: StopImmediatePropagationDirectiveModule, decorators: [{
196
- type: NgModule,
197
- args: [{
198
- exports: [StopImmediatePropagationDirective],
199
- declarations: [StopImmediatePropagationDirective]
200
- }]
201
- }] });
202
-
203
- class StopPropagationDirective {
204
- onClick($event) {
205
- $event.stopPropagation();
206
- }
207
- }
208
- StopPropagationDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: StopPropagationDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
209
- StopPropagationDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.3", type: StopPropagationDirective, selector: "[rxapStopPropagation]", host: { listeners: { "click": "onClick($event)" } }, ngImport: i0 });
210
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: StopPropagationDirective, decorators: [{
211
- type: Directive,
212
- args: [{
213
- selector: '[rxapStopPropagation]'
214
- }]
215
- }], propDecorators: { onClick: [{
216
- type: HostListener,
217
- args: ['click', ['$event']]
218
- }] } });
219
- class StopPropagationDirectiveModule {
220
- }
221
- StopPropagationDirectiveModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: StopPropagationDirectiveModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
222
- StopPropagationDirectiveModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.0.3", ngImport: i0, type: StopPropagationDirectiveModule, declarations: [StopPropagationDirective], exports: [StopPropagationDirective] });
223
- StopPropagationDirectiveModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: StopPropagationDirectiveModule });
224
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: StopPropagationDirectiveModule, decorators: [{
225
- type: NgModule,
226
- args: [{
227
- exports: [StopPropagationDirective],
228
- declarations: [StopPropagationDirective]
229
- }]
230
- }] });
231
-
232
- class ShareService {
233
- share(data) {
234
- return __awaiter(this, void 0, void 0, function* () {
235
- if (this.isShareSupported()) {
236
- if (navigator.canShare(data)) {
237
- yield navigator.share(data);
238
- }
239
- else {
240
- console.debug('share data:', data);
241
- throw new Error('Can not share data. Data is invalid!');
242
- }
243
- }
244
- else {
245
- alert('Native share is not supported!');
246
- }
247
- });
248
- }
249
- isShareSupported() {
250
- return !!navigator.share;
251
- }
252
- }
253
- ShareService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: ShareService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
254
- ShareService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: ShareService, providedIn: 'root' });
255
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: ShareService, decorators: [{
256
- type: Injectable,
257
- args: [{ providedIn: 'root' }]
258
- }] });
259
- class ShareButtonDirective {
260
- constructor(shareService) {
261
- this.shareService = shareService;
262
- }
263
- share() {
264
- this.shareService.share({ url: this.url, text: this.text, files: this.files, title: this.title })
265
- .then(() => console.log('share successfully'))
266
- .catch(err => console.error('share failed', err.message));
267
- }
268
- }
269
- ShareButtonDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: ShareButtonDirective, deps: [{ token: ShareService }], target: i0.ɵɵFactoryTarget.Directive });
270
- ShareButtonDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.3", type: ShareButtonDirective, selector: "[rxapShareButton]", inputs: { url: "url", text: "text", title: "title", files: "files" }, host: { listeners: { "click": "share()" } }, ngImport: i0 });
271
- __decorate([
272
- Required,
273
- __metadata("design:type", String)
274
- ], ShareButtonDirective.prototype, "title", void 0);
275
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: ShareButtonDirective, decorators: [{
276
- type: Directive,
277
- args: [{
278
- selector: '[rxapShareButton]'
279
- }]
280
- }], ctorParameters: function () { return [{ type: ShareService }]; }, propDecorators: { url: [{
281
- type: Input
282
- }], text: [{
283
- type: Input
284
- }], title: [{
285
- type: Input
286
- }], files: [{
287
- type: Input
288
- }], share: [{
289
- type: HostListener,
290
- args: ['click']
291
- }] } });
292
- class ShareButtonDirectiveModule {
293
- }
294
- ShareButtonDirectiveModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: ShareButtonDirectiveModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
295
- ShareButtonDirectiveModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.0.3", ngImport: i0, type: ShareButtonDirectiveModule, declarations: [ShareButtonDirective], exports: [ShareButtonDirective] });
296
- ShareButtonDirectiveModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: ShareButtonDirectiveModule });
297
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: ShareButtonDirectiveModule, decorators: [{
298
- type: NgModule,
299
- args: [{
300
- exports: [ShareButtonDirective],
301
- declarations: [ShareButtonDirective]
302
- }]
303
- }] });
304
-
305
- class FullWidthDirective {
306
- constructor() {
307
- this.width = '100%';
308
- }
309
- }
310
- FullWidthDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: FullWidthDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
311
- FullWidthDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.3", type: FullWidthDirective, selector: "[rxapFullWidth]", host: { properties: { "style.width": "this.width" } }, ngImport: i0 });
312
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: FullWidthDirective, decorators: [{
313
- type: Directive,
314
- args: [{
315
- selector: '[rxapFullWidth]',
316
- }]
317
- }], propDecorators: { width: [{
318
- type: HostBinding,
319
- args: ['style.width']
320
- }] } });
321
- class FullWidthDirectiveModule {
322
- }
323
- FullWidthDirectiveModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: FullWidthDirectiveModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
324
- FullWidthDirectiveModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.0.3", ngImport: i0, type: FullWidthDirectiveModule, declarations: [FullWidthDirective], exports: [FullWidthDirective] });
325
- FullWidthDirectiveModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: FullWidthDirectiveModule });
326
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: FullWidthDirectiveModule, decorators: [{
327
- type: NgModule,
328
- args: [{
329
- declarations: [FullWidthDirective],
330
- exports: [FullWidthDirective]
331
- }]
332
- }] });
333
-
334
- class AvatarBackgroundImageDirective extends BackgroundImageDirective {
335
- constructor(host, renderer, imageLoader, avatarImage) {
336
- super(host, renderer, imageLoader);
337
- this.avatarImage = avatarImage;
338
- this.imageUrl = null;
339
- this.size = BackgroundSizeOptions.COVER;
340
- this.repeat = BackgroundRepeatOptions.NO_REPEAT;
341
- }
342
- set name(name) {
343
- if (!this.placeholderImageUrl) {
344
- this.placeholderImageUrl = this.avatarImage.get({ name });
345
- }
346
- }
347
- }
348
- AvatarBackgroundImageDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: AvatarBackgroundImageDirective, deps: [{ token: ElementRef }, { token: Renderer2 }, { token: ImageLoaderService }, { token: AvatarImageService }], target: i0.ɵɵFactoryTarget.Directive });
349
- AvatarBackgroundImageDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.3", type: AvatarBackgroundImageDirective, selector: "[rxapAvatarBackgroundImage]", inputs: { name: "name", imageUrl: ["rxapAvatarBackgroundImage", "imageUrl"] }, usesInheritance: true, ngImport: i0 });
350
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: AvatarBackgroundImageDirective, decorators: [{
351
- type: Directive,
352
- args: [{
353
- // tslint:disable-next-line:directive-selector
354
- selector: '[rxapAvatarBackgroundImage]',
355
- }]
356
- }], ctorParameters: function () {
357
- return [{ type: i0.ElementRef, decorators: [{
358
- type: Inject,
359
- args: [ElementRef]
360
- }] }, { type: i0.Renderer2, decorators: [{
361
- type: Inject,
362
- args: [Renderer2]
363
- }] }, { type: i1.ImageLoaderService, decorators: [{
364
- type: Inject,
365
- args: [ImageLoaderService]
366
- }] }, { type: i1.AvatarImageService, decorators: [{
367
- type: Inject,
368
- args: [AvatarImageService]
369
- }] }];
370
- }, propDecorators: { name: [{
371
- type: Input
372
- }], imageUrl: [{
373
- type: Input,
374
- args: ['rxapAvatarBackgroundImage']
375
- }] } });
376
- class AvatarBackgroundImageDirectiveModule {
377
- }
378
- AvatarBackgroundImageDirectiveModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: AvatarBackgroundImageDirectiveModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
379
- AvatarBackgroundImageDirectiveModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.0.3", ngImport: i0, type: AvatarBackgroundImageDirectiveModule, declarations: [AvatarBackgroundImageDirective], exports: [AvatarBackgroundImageDirective] });
380
- AvatarBackgroundImageDirectiveModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: AvatarBackgroundImageDirectiveModule });
381
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: AvatarBackgroundImageDirectiveModule, decorators: [{
382
- type: NgModule,
383
- args: [{
384
- declarations: [AvatarBackgroundImageDirective],
385
- exports: [AvatarBackgroundImageDirective],
386
- }]
387
- }] });
388
-
389
- class ContenteditableDirective {
390
- constructor(elementRef) {
391
- this.elementRef = elementRef;
392
- this.contenteditable = true;
393
- this.spellcheck = false;
394
- this.change = new EventEmitter();
395
- }
396
- onClick($event) {
397
- $event.stopPropagation();
398
- }
399
- onInput($event) {
400
- var _a, _b;
401
- return __awaiter(this, void 0, void 0, function* () {
402
- const value = (_a = ($event.target.textContent)) === null || _a === void 0 ? void 0 : _a.trim();
403
- if (value && value.length >= 2) {
404
- const event = {
405
- value,
406
- parameters: this.parameters
407
- };
408
- this.change.emit(event);
409
- const result = yield ((_b = this.method) === null || _b === void 0 ? void 0 : _b.call(event));
410
- if (result && typeof result === 'string') {
411
- this.initial = this.elementRef.nativeElement.innerText = result;
412
- }
413
- else if (this.initial) {
414
- this.elementRef.nativeElement.innerText = this.initial;
415
- }
416
- }
417
- });
418
- }
419
- }
420
- ContenteditableDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: ContenteditableDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
421
- ContenteditableDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.3", type: ContenteditableDirective, selector: "[rxapContenteditable]", inputs: { method: ["rxapContenteditable", "method"], parameters: "parameters", initial: "initial" }, outputs: { change: "rxapContenteditable" }, host: { listeners: { "click": "onClick($event)", "input": "onInput($event)" }, properties: { "attr.contenteditable": "this.contenteditable", "attr.spellcheck": "this.spellcheck" } }, ngImport: i0 });
422
- __decorate([
423
- DebounceCall(1000),
424
- __metadata("design:type", Function),
425
- __metadata("design:paramtypes", [Object]),
426
- __metadata("design:returntype", Promise)
427
- ], ContenteditableDirective.prototype, "onInput", null);
428
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: ContenteditableDirective, decorators: [{
429
- type: Directive,
430
- args: [{
431
- selector: '[rxapContenteditable]'
432
- }]
433
- }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { contenteditable: [{
434
- type: HostBinding,
435
- args: ['attr.contenteditable']
436
- }], spellcheck: [{
437
- type: HostBinding,
438
- args: ['attr.spellcheck']
439
- }], method: [{
440
- type: Input,
441
- args: ['rxapContenteditable']
442
- }], change: [{
443
- type: Output,
444
- args: ['rxapContenteditable']
445
- }], parameters: [{
446
- type: Input
447
- }], initial: [{
448
- type: Input
449
- }], onClick: [{
450
- type: HostListener,
451
- args: ['click', ['$event']]
452
- }], onInput: [{
453
- type: HostListener,
454
- args: ['input', ['$event']]
455
- }] } });
456
- class ContenteditableDirectiveModule {
457
- }
458
- ContenteditableDirectiveModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: ContenteditableDirectiveModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
459
- ContenteditableDirectiveModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.0.3", ngImport: i0, type: ContenteditableDirectiveModule, declarations: [ContenteditableDirective], exports: [ContenteditableDirective] });
460
- ContenteditableDirectiveModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: ContenteditableDirectiveModule });
461
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: ContenteditableDirectiveModule, decorators: [{
462
- type: NgModule,
463
- args: [{
464
- declarations: [ContenteditableDirective],
465
- exports: [ContenteditableDirective]
466
- }]
467
- }] });
468
-
469
- class ConfirmClick {
470
- constructor() {
471
- this._hasConfirmDirective = false;
472
- }
473
- set hasConfirmDirective(value) {
474
- this._hasConfirmDirective = coerceBoolean(value);
475
- }
476
- onClick() {
477
- if (!this._hasConfirmDirective) {
478
- this.execute();
479
- }
480
- }
481
- onConfirm() {
482
- this.execute();
483
- }
484
- }
485
- ConfirmClick.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: ConfirmClick, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
486
- ConfirmClick.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: ConfirmClick });
487
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: ConfirmClick, decorators: [{
488
- type: Injectable
489
- }], propDecorators: { hasConfirmDirective: [{
490
- type: Input,
491
- args: ['rxapConfirm']
492
- }], onClick: [{
493
- type: HostListener,
494
- args: ['click']
495
- }], onConfirm: [{
496
- type: HostListener,
497
- args: ['confirmed']
498
- }] } });
499
-
500
- class MethodDirective {
501
- constructor() {
502
- this._hasConfirmDirective = false;
503
- this.immediately = false;
504
- this.executed$ = new EventEmitter();
505
- this.failure$ = new EventEmitter();
506
- this.successful$ = new EventEmitter();
507
- /**
508
- * true - a remote method call is in progress
509
- */
510
- this.executing$ = new ToggleSubject();
511
- }
512
- set hasConfirmDirective(value) {
513
- this._hasConfirmDirective = coerceBoolean(value);
514
- }
515
- ngOnInit() {
516
- if (this.immediately) {
517
- this.execute();
518
- }
519
- }
520
- onConfirmed() {
521
- return this.execute();
522
- }
523
- onClick() {
524
- if (!this._hasConfirmDirective) {
525
- return this.execute();
526
- }
527
- else {
528
- if (isDevMode()) {
529
- console.debug('Skip method call. Wait for confirmation.');
530
- }
531
- }
532
- return Promise.resolve();
533
- }
534
- execute() {
535
- return __awaiter(this, void 0, void 0, function* () {
536
- this.executing$.enable();
537
- try {
538
- const result = yield this.method.call(this.parameters);
539
- this.executed(result);
540
- this.successful(result);
541
- }
542
- catch (error) {
543
- if (isDevMode()) {
544
- console.error(`Method directive execution failed:`, error.message);
545
- }
546
- this.failure(error);
547
- }
548
- finally {
549
- this.executing$.disable();
550
- }
551
- });
552
- }
553
- setParameter(parameterKey, value) {
554
- this.updateParameters({ [parameterKey]: value });
555
- }
556
- updateParameters(parameters) {
557
- var _a;
558
- this.parameters = Object.assign(Object.assign({}, ((_a = this.parameters) !== null && _a !== void 0 ? _a : {})), parameters);
559
- }
560
- executed(result) {
561
- this.executed$.emit(result);
562
- }
563
- failure(error) {
564
- this.failure$.emit(error);
565
- }
566
- successful(result) {
567
- this.successful$.emit(result);
568
- }
569
- }
570
- MethodDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: MethodDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
571
- MethodDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.3", type: MethodDirective, selector: "[rxapMethod]", inputs: { hasConfirmDirective: ["rxapConfirm", "hasConfirmDirective"], method: ["rxapMethod", "method"], parameters: "parameters", immediately: "immediately" }, outputs: { executed$: "executed", failure$: "failure", successful$: "successful" }, host: { listeners: { "confirmed": "onConfirmed()", "click": "onClick()" } }, exportAs: ["rxapMethod"], ngImport: i0 });
572
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: MethodDirective, decorators: [{
573
- type: Directive,
574
- args: [{
575
- selector: '[rxapMethod]',
576
- exportAs: 'rxapMethod'
577
- }]
578
- }], ctorParameters: function () { return []; }, propDecorators: { hasConfirmDirective: [{
579
- type: Input,
580
- args: ['rxapConfirm']
581
- }], method: [{
582
- type: Input,
583
- args: ['rxapMethod']
584
- }], parameters: [{
585
- type: Input
586
- }], immediately: [{
587
- type: Input
588
- }], executed$: [{
589
- type: Output,
590
- args: ['executed']
591
- }], failure$: [{
592
- type: Output,
593
- args: ['failure']
594
- }], successful$: [{
595
- type: Output,
596
- args: ['successful']
597
- }], onConfirmed: [{
598
- type: HostListener,
599
- args: ['confirmed']
600
- }], onClick: [{
601
- type: HostListener,
602
- args: ['click']
603
- }] } });
604
- class MethodDirectiveModule {
605
- }
606
- MethodDirectiveModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: MethodDirectiveModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
607
- MethodDirectiveModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.0.3", ngImport: i0, type: MethodDirectiveModule, declarations: [MethodDirective], exports: [MethodDirective] });
608
- MethodDirectiveModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: MethodDirectiveModule });
609
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: MethodDirectiveModule, decorators: [{
610
- type: NgModule,
611
- args: [{
612
- declarations: [MethodDirective],
613
- exports: [MethodDirective]
614
- }]
615
- }] });
616
-
617
- class MovableDividerDirective {
618
- constructor(renderer) {
619
- this.renderer = renderer;
620
- this.origin = 'right';
621
- this.cursor = 'ew-resize';
622
- this._subscription = new Subscription();
623
- /**
624
- * Indicates that the divider is moved with mouse down
625
- * @private
626
- */
627
- this._moveDivider = false;
628
- /**
629
- * Holds the current fixed element width.
630
- * If null the move divider feature was not yet used and the initial
631
- * fixed element width is not calculated
632
- * @private
633
- */
634
- this._fixedElementWidth = null;
635
- }
636
- ngOnDestroy() {
637
- var _a;
638
- (_a = this._subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
639
- }
640
- ngOnInit() {
641
- this._subscription.add(fromEvent(this.containerElement, 'mousemove').pipe(tap(($event) => {
642
- if (this._moveDivider) {
643
- if (!this._fixedElementWidth) {
644
- this._fixedElementWidth = this.fixedElement.clientWidth;
645
- }
646
- if (this.origin === 'right') {
647
- this._fixedElementWidth = $event.clientX - this.containerElement.getBoundingClientRect().left;
648
- }
649
- else if (this.origin === 'left') {
650
- if (isDevMode()) {
651
- console.log({
652
- clientWidth: this.containerElement.clientWidth,
653
- clientX: $event.clientX,
654
- clientLeft: this.containerElement.getBoundingClientRect().left
655
- });
656
- }
657
- this._fixedElementWidth = this.containerElement.clientWidth - $event.clientX + this.containerElement.getBoundingClientRect().left;
658
- }
659
- else {
660
- throw new Error(`The origin '${this.origin}' is not supported.`);
661
- }
662
- const width = this._fixedElementWidth + 'px';
663
- this.renderer.setStyle(this.fixedElement, 'max-width', width);
664
- this.renderer.setStyle(this.fixedElement, 'min-width', width);
665
- this.renderer.setStyle(this.fixedElement, 'flex-basis', width);
666
- }
667
- })).subscribe());
668
- this._subscription.add(fromEvent(this.containerElement, 'mouseup').pipe(tap(() => this._moveDivider = false)).subscribe());
669
- }
670
- onMousedown() {
671
- this._moveDivider = true;
672
- }
673
- }
674
- MovableDividerDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: MovableDividerDirective, deps: [{ token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive });
675
- MovableDividerDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.3", type: MovableDividerDirective, selector: "[rxapMovableDivider]", inputs: { containerElement: "containerElement", fixedElement: "fixedElement", origin: "origin" }, host: { listeners: { "mousedown": "onMousedown()" }, properties: { "style.cursor": "this.cursor" } }, ngImport: i0 });
676
- __decorate([
677
- Required,
678
- __metadata("design:type", HTMLDivElement)
679
- ], MovableDividerDirective.prototype, "containerElement", void 0);
680
- __decorate([
681
- Required,
682
- __metadata("design:type", HTMLDivElement)
683
- ], MovableDividerDirective.prototype, "fixedElement", void 0);
684
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: MovableDividerDirective, decorators: [{
685
- type: Directive,
686
- args: [{
687
- selector: '[rxapMovableDivider]'
688
- }]
689
- }], ctorParameters: function () { return [{ type: i0.Renderer2 }]; }, propDecorators: { containerElement: [{
690
- type: Input
691
- }], fixedElement: [{
692
- type: Input
693
- }], origin: [{
694
- type: Input
695
- }], cursor: [{
696
- type: HostBinding,
697
- args: ['style.cursor']
698
- }], onMousedown: [{
699
- type: HostListener,
700
- args: ['mousedown']
701
- }] } });
702
- class MovableDividerDirectiveModule {
703
- }
704
- MovableDividerDirectiveModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: MovableDividerDirectiveModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
705
- MovableDividerDirectiveModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.0.3", ngImport: i0, type: MovableDividerDirectiveModule, declarations: [MovableDividerDirective], exports: [MovableDividerDirective] });
706
- MovableDividerDirectiveModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: MovableDividerDirectiveModule });
707
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: MovableDividerDirectiveModule, decorators: [{
708
- type: NgModule,
709
- args: [{
710
- declarations: [MovableDividerDirective],
711
- exports: [MovableDividerDirective]
712
- }]
713
- }] });
714
-
715
- // TODO : mv to rxap package
716
- class IfTruthyDirective {
717
- constructor(templateRef, viewContainerRef, cdr) {
718
- this.templateRef = templateRef;
719
- this.viewContainerRef = viewContainerRef;
720
- this.cdr = cdr;
721
- }
722
- /**
723
- * Asserts the correct type of the context for the template that `NgForOf` will render.
724
- *
725
- * The presence of this method is a signal to the Ivy template type-check compiler that the
726
- * `NgForOf` structural directive renders its template with a specific context type.
727
- */
728
- static ngTemplateContextGuard(dir, ctx) {
729
- return true;
730
- }
731
- ngOnChanges(changes) {
732
- if (this.method && this.parameters) {
733
- this.execute();
734
- }
735
- }
736
- execute() {
737
- return __awaiter(this, void 0, void 0, function* () {
738
- const result = yield this.method.call(this.parameters);
739
- if (this.hasChanged(result)) {
740
- this.viewContainerRef.clear();
741
- if (result) {
742
- this.viewContainerRef.createEmbeddedView(this.templateRef, { $implicit: result });
743
- }
744
- }
745
- this.cdr.detectChanges();
746
- });
747
- }
748
- hasChanged(current) {
749
- if (this._last !== undefined) {
750
- const currentTrackBy = this.trackBy ? this.trackBy(current) : current;
751
- const lastTrackBy = this.trackBy ? this.trackBy(this._last) : this._last;
752
- return currentTrackBy !== lastTrackBy;
753
- }
754
- return true;
755
- }
756
- }
757
- IfTruthyDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: IfTruthyDirective, deps: [{ token: i0.TemplateRef }, { token: i0.ViewContainerRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });
758
- IfTruthyDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.3", type: IfTruthyDirective, selector: "[rxapIfTruthy]", inputs: { method: ["rxapIfTruthy", "method"], parameters: ["rxapIfTruthyParameters", "parameters"], trackBy: ["rxapIfTruthyTrackBy", "trackBy"] }, usesOnChanges: true, ngImport: i0 });
759
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: IfTruthyDirective, decorators: [{
760
- type: Directive,
761
- args: [{
762
- selector: '[rxapIfTruthy]'
763
- }]
764
- }], ctorParameters: function () { return [{ type: i0.TemplateRef }, { type: i0.ViewContainerRef }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { method: [{
765
- type: Input,
766
- args: ['rxapIfTruthy']
767
- }], parameters: [{
768
- type: Input,
769
- args: ['rxapIfTruthyParameters']
770
- }], trackBy: [{
771
- type: Input,
772
- args: ['rxapIfTruthyTrackBy']
773
- }] } });
774
- class IfTruthyDirectiveModule {
775
- }
776
- IfTruthyDirectiveModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: IfTruthyDirectiveModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
777
- IfTruthyDirectiveModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.0.3", ngImport: i0, type: IfTruthyDirectiveModule, declarations: [IfTruthyDirective], exports: [IfTruthyDirective] });
778
- IfTruthyDirectiveModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: IfTruthyDirectiveModule });
779
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: IfTruthyDirectiveModule, decorators: [{
780
- type: NgModule,
781
- args: [{
782
- declarations: [IfTruthyDirective],
783
- exports: [IfTruthyDirective]
784
- }]
785
- }] });
786
-
787
- class MethodTemplateDirective {
788
- constructor(template, viewContainerRef, cdr) {
789
- this.template = template;
790
- this.viewContainerRef = viewContainerRef;
791
- this.cdr = cdr;
792
- this.withoutParameters = false;
793
- this.immediately = false;
794
- this.executed$ = new EventEmitter();
795
- this.failure$ = new EventEmitter();
796
- this.successful$ = new EventEmitter();
797
- /**
798
- * true - a remote method call is in progress
799
- */
800
- this.executing$ = new ToggleSubject();
801
- this.embedded = new EventEmitter();
802
- }
803
- static ngTemplateContextGuard(dir, ctx) {
804
- return true;
805
- }
806
- ngOnChanges(changes) {
807
- const parametersChanges = changes.parameters;
808
- if (parametersChanges) {
809
- this.execute(parametersChanges.currentValue);
810
- }
811
- }
812
- ngOnInit() {
813
- this.renderLoadingTemplate();
814
- if (this.withoutParameters) {
815
- this.execute();
816
- }
817
- }
818
- onConfirmed() {
819
- return this.execute();
820
- }
821
- execute(parameters = this.parameters) {
822
- return __awaiter(this, void 0, void 0, function* () {
823
- this.executing$.enable();
824
- try {
825
- const result = yield this.method.call(parameters);
826
- this.executed(result);
827
- this.renderTemplate(result);
828
- this.successful(result);
829
- }
830
- catch (error) {
831
- if (isDevMode()) {
832
- console.error(`Method directive execution failed:`, error.message);
833
- }
834
- this.renderErrorTemplate(error);
835
- this.failure(error);
836
- }
837
- finally {
838
- this.executing$.disable();
839
- }
840
- });
841
- }
842
- setParameter(parameterKey, value) {
843
- this.updateParameters({ [parameterKey]: value });
844
- }
845
- updateParameters(parameters) {
846
- var _a;
847
- this.parameters = Object.assign(Object.assign({}, ((_a = this.parameters) !== null && _a !== void 0 ? _a : {})), parameters);
848
- }
849
- renderLoadingTemplate() {
850
- if (this.loadingTemplate) {
851
- this.viewContainerRef.clear();
852
- this.viewContainerRef.createEmbeddedView(this.loadingTemplate);
853
- }
854
- }
855
- executed(result) {
856
- this.executed$.emit(result);
857
- }
858
- failure(error) {
859
- this.failure$.emit(error);
860
- }
861
- successful(result) {
862
- this.successful$.emit(result);
863
- }
864
- renderErrorTemplate(error) {
865
- if (this.errorTemplate) {
866
- this.viewContainerRef.clear();
867
- if (this.errorTemplate) {
868
- this.viewContainerRef.createEmbeddedView(this.errorTemplate, { $implicit: error, message: error.message });
869
- }
870
- }
871
- }
872
- renderTemplate(result) {
873
- this.viewContainerRef.clear();
874
- try {
875
- this.viewContainerRef.createEmbeddedView(this.template, { $implicit: result });
876
- }
877
- catch (error) {
878
- this.renderErrorTemplate(error);
879
- console.error(error.message);
880
- throw error;
881
- }
882
- this.embedded.emit();
883
- this.cdr.detectChanges();
884
- }
885
- }
886
- MethodTemplateDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: MethodTemplateDirective, deps: [{ token: TemplateRef }, { token: ViewContainerRef }, { token: ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });
887
- MethodTemplateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.3", type: MethodTemplateDirective, selector: "[rxapMethod]", inputs: { method: ["rxapMethodCall", "method"], parameters: ["rxapMethodParameters", "parameters"], errorTemplate: ["rxapMethodError", "errorTemplate"], loadingTemplate: ["rxapMethodLoading", "loadingTemplate"], withoutParameters: ["rxapMethodWithoutParameters", "withoutParameters"], immediately: "immediately" }, outputs: { executed$: "executed", failure$: "failure", successful$: "successful", executing$: "executing", embedded: "embedded" }, host: { listeners: { "confirmed": "onConfirmed()" } }, exportAs: ["rxapMethod"], usesOnChanges: true, ngImport: i0 });
888
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: MethodTemplateDirective, decorators: [{
889
- type: Directive,
890
- args: [{
891
- selector: '[rxapMethod]',
892
- exportAs: 'rxapMethod'
893
- }]
894
- }], ctorParameters: function () {
895
- return [{ type: i0.TemplateRef, decorators: [{
896
- type: Inject,
897
- args: [TemplateRef]
898
- }] }, { type: i0.ViewContainerRef, decorators: [{
899
- type: Inject,
900
- args: [ViewContainerRef]
901
- }] }, { type: i0.ChangeDetectorRef, decorators: [{
902
- type: Inject,
903
- args: [ChangeDetectorRef]
904
- }] }];
905
- }, propDecorators: { method: [{
906
- type: Input,
907
- args: ['rxapMethodCall']
908
- }], parameters: [{
909
- type: Input,
910
- args: ['rxapMethodParameters']
911
- }], errorTemplate: [{
912
- type: Input,
913
- args: ['rxapMethodError']
914
- }], loadingTemplate: [{
915
- type: Input,
916
- args: ['rxapMethodLoading']
917
- }], withoutParameters: [{
918
- type: Input,
919
- args: ['rxapMethodWithoutParameters']
920
- }], immediately: [{
921
- type: Input
922
- }], executed$: [{
923
- type: Output,
924
- args: ['executed']
925
- }], failure$: [{
926
- type: Output,
927
- args: ['failure']
928
- }], successful$: [{
929
- type: Output,
930
- args: ['successful']
931
- }], executing$: [{
932
- type: Output,
933
- args: ['executing']
934
- }], embedded: [{
935
- type: Output
936
- }], onConfirmed: [{
937
- type: HostListener,
938
- args: ['confirmed']
939
- }] } });
940
- class MethodTemplateDirectiveModule {
941
- }
942
- MethodTemplateDirectiveModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: MethodTemplateDirectiveModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
943
- MethodTemplateDirectiveModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.0.3", ngImport: i0, type: MethodTemplateDirectiveModule, declarations: [MethodTemplateDirective], exports: [MethodTemplateDirective] });
944
- MethodTemplateDirectiveModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: MethodTemplateDirectiveModule });
945
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: MethodTemplateDirectiveModule, decorators: [{
946
- type: NgModule,
947
- args: [{
948
- declarations: [MethodTemplateDirective],
949
- exports: [MethodTemplateDirective]
950
- }]
951
- }] });
952
-
953
- /**
954
- * Generated bundle index. Do not edit.
955
- */
956
-
957
- export { AvatarBackgroundImageDirective, AvatarBackgroundImageDirectiveModule, BackgroundImageDirective, BackgroundImageDirectiveModule, BackgroundPositionOptions, BackgroundRepeatOptions, BackgroundSizeOptions, ConfirmClick, ContenteditableDirective, ContenteditableDirectiveModule, FullWidthDirective, FullWidthDirectiveModule, GlobalStyleOptions, IfTruthyDirective, IfTruthyDirectiveModule, MethodDirective, MethodDirectiveModule, MethodTemplateDirective, MethodTemplateDirectiveModule, MovableDividerDirective, MovableDividerDirectiveModule, PreventDefaultDirective, PreventDefaultDirectiveModule, ShareButtonDirective, ShareButtonDirectiveModule, ShareService, StopImmediatePropagationDirective, StopImmediatePropagationDirectiveModule, StopPropagationDirective, StopPropagationDirectiveModule };
958
- //# sourceMappingURL=rxap-directives.mjs.map
959
- //# sourceMappingURL=rxap-directives.mjs.map