@acorex/components 21.0.1-next.10 → 21.0.1-next.12

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.
@@ -1,14 +1,14 @@
1
- import { AXOverlayService } from '@acorex/cdk/overlay';
2
- import * as i0 from '@angular/core';
3
- import { inject, NgZone, DOCUMENT, input, signal, TemplateRef, ViewContainerRef, HostListener, ViewChild, ViewEncapsulation, ChangeDetectionStrategy, Component, ComponentRef, Injectable, Directive, NgModule } from '@angular/core';
4
- import { Subject } from 'rxjs';
5
1
  import { AXPlatform } from '@acorex/core/platform';
2
+ import * as i0 from '@angular/core';
3
+ import { inject, NgZone, input, signal, TemplateRef, ViewContainerRef, HostListener, ViewChild, ViewEncapsulation, ChangeDetectionStrategy, Component, Directive, ComponentRef, Injectable, NgModule } from '@angular/core';
6
4
  import { MXBaseComponent, AXClosableComponent, AXComponent, AXComponentClosedPromise, AXCommonModule } from '@acorex/cdk/common';
7
5
  import { AXDecoratorCloseButtonComponent, AXDecoratorModule } from '@acorex/components/decorators';
8
6
  import { AXLoadingService } from '@acorex/components/loading';
9
7
  import { AXComponentService } from '@acorex/core/components';
10
8
  import { AXTranslatorPipe, AXTranslationModule } from '@acorex/core/translation';
11
9
  import { AsyncPipe, CommonModule } from '@angular/common';
10
+ import { AXOverlayService } from '@acorex/cdk/overlay';
11
+ import { Subject } from 'rxjs';
12
12
 
13
13
  /**
14
14
  * The Popup is a component which displays content in a dialog overlay
@@ -19,7 +19,6 @@ class AXPopupComponent extends MXBaseComponent {
19
19
  constructor() {
20
20
  super(...arguments);
21
21
  this._zone = inject(NgZone);
22
- this._document = inject(DOCUMENT);
23
22
  this.loadingService = inject(AXLoadingService);
24
23
  this._platform = inject(AXPlatform);
25
24
  this.componentService = inject(AXComponentService);
@@ -88,13 +87,14 @@ class AXPopupComponent extends MXBaseComponent {
88
87
  // Set data inputs (only if the component has the input defined)
89
88
  if (config?.data && typeof config.data === 'object') {
90
89
  Object.entries(config.data).forEach(([key, value]) => {
90
+ componentRef.instance[key] = value;
91
+ });
92
+ }
93
+ if (config?.inputs && typeof config.inputs === 'object') {
94
+ Object.entries(config.inputs).forEach(([key, value]) => {
91
95
  if (inputDefs && key in inputDefs) {
92
96
  componentRef.setInput(key, value);
93
97
  }
94
- else {
95
- // Fallback: set as property directly on the instance
96
- componentRef.instance[key] = value;
97
- }
98
98
  });
99
99
  }
100
100
  // Set popup reference (only if the component has this input)
@@ -119,10 +119,8 @@ class AXPopupComponent extends MXBaseComponent {
119
119
  this._zone.runOutsideAngular(() => {
120
120
  setTimeout(() => {
121
121
  const body = this.getHostElement().querySelector('.ax-popup-body-container');
122
- if (!body)
123
- return;
124
122
  const content = body.children[0];
125
- if (!content)
123
+ if (!content || !body)
126
124
  return;
127
125
  const popHeader = this.getHostElement().querySelector('.ax-popup-header-container');
128
126
  const popFooter = this.getHostElement().querySelector('.ax-popup-footer-container');
@@ -274,18 +272,77 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImpo
274
272
  args: ['document:mouseup']
275
273
  }] } });
276
274
 
277
- class AXPopupStateService {
275
+ class AXPopupComponentBase {
276
+ constructor() {
277
+ this.__popup__ = input(...(ngDevMode ? [undefined, { debugName: "__popup__" }] : []));
278
+ }
279
+ close(data = null) {
280
+ this.__popup__().close(data);
281
+ }
282
+ setTitle(title) {
283
+ this.__popup__().setTitle(title);
284
+ }
285
+ bringToFront() {
286
+ this.__popup__().bringToFront();
287
+ }
288
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: AXPopupComponentBase, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
289
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.3.15", type: AXPopupComponentBase, isStandalone: true, inputs: { __popup__: { classPropertyName: "__popup__", publicName: "__popup__", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 }); }
290
+ }
291
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: AXPopupComponentBase, decorators: [{
292
+ type: Directive
293
+ }], propDecorators: { __popup__: [{ type: i0.Input, args: [{ isSignal: true, alias: "__popup__", required: false }] }] } });
294
+
295
+ /**
296
+ * This is a service which you can create popup with it
297
+ *
298
+ * @category Components
299
+ */
300
+ class AXPopupService {
278
301
  constructor() {
279
302
  this.popupList = new Map();
280
303
  this.overlayService = inject(AXOverlayService);
281
304
  }
305
+ /**
306
+ * @ignore
307
+ */
308
+ open(arg1, arg2) {
309
+ let config = {
310
+ closeButton: true,
311
+ header: true,
312
+ size: 'md',
313
+ maximizable: false,
314
+ draggable: true,
315
+ hasBackdrop: true,
316
+ closeOnBackdropClick: false,
317
+ data: {},
318
+ };
319
+ if (typeof arg2 === 'string') {
320
+ config.title = arg2;
321
+ }
322
+ else {
323
+ config = Object.assign(config, arg2);
324
+ }
325
+ const promise = new AXComponentClosedPromise((resolve) => {
326
+ this.openInternal(arg1, config).then((ref) => {
327
+ ref.onClose.subscribe((data) => {
328
+ if (resolve) {
329
+ resolve({
330
+ sender: null,
331
+ data: data,
332
+ });
333
+ }
334
+ });
335
+ });
336
+ });
337
+ return promise;
338
+ }
282
339
  /**
283
340
  * Opens a popup with the specified content and configuration.
284
341
  * @param content - Component or template to display
285
342
  * @param config - Configuration options for the popup
286
343
  * @returns Promise<AXPopupRef> - Reference to the opened popup
287
344
  */
288
- async open(content, config) {
345
+ async openInternal(content, config) {
289
346
  const randomId = Math.floor(Math.random() * 100000000000);
290
347
  const onClose = new Subject();
291
348
  const returnRef = {
@@ -330,7 +387,7 @@ class AXPopupStateService {
330
387
  * @param id - The popup ID to close
331
388
  * @param data - Optional data to pass to the close event
332
389
  */
333
- async close(id, data) {
390
+ close(id, data) {
334
391
  const ref = this.popupList.get(id);
335
392
  if (!ref)
336
393
  return;
@@ -344,7 +401,7 @@ class AXPopupStateService {
344
401
  * @param id - The popup ID
345
402
  * @param values - Object containing input values to set
346
403
  */
347
- async setInputs(id, values) {
404
+ setInputs(id, values) {
348
405
  const ref = this.popupList.get(id)?.overlay.instance;
349
406
  if (!ref)
350
407
  return;
@@ -358,7 +415,7 @@ class AXPopupStateService {
358
415
  * @param id - The popup ID
359
416
  * @param title - The new title
360
417
  */
361
- async setTitle(id, title) {
418
+ setTitle(id, title) {
362
419
  const ref = this.popupList.get(id)?.overlay.instance;
363
420
  if (!ref)
364
421
  return;
@@ -377,86 +434,16 @@ class AXPopupStateService {
377
434
  return;
378
435
  ref.overlay.bringToFront();
379
436
  }
380
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: AXPopupStateService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
381
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: AXPopupStateService, providedIn: 'root' }); }
437
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: AXPopupService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
438
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: AXPopupService, providedIn: 'root' }); }
382
439
  }
383
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: AXPopupStateService, decorators: [{
440
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: AXPopupService, decorators: [{
384
441
  type: Injectable,
385
442
  args: [{
386
443
  providedIn: 'root',
387
444
  }]
388
445
  }] });
389
446
 
390
- class AXPopupComponentBase {
391
- constructor() {
392
- this.__popup__ = input(...(ngDevMode ? [undefined, { debugName: "__popup__" }] : []));
393
- }
394
- close(data = null) {
395
- this.__popup__().close(data);
396
- }
397
- setTitle(title) {
398
- this.__popup__().setTitle(title);
399
- }
400
- bringToFront() {
401
- this.__popup__().bringToFront();
402
- }
403
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: AXPopupComponentBase, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
404
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.3.15", type: AXPopupComponentBase, isStandalone: true, inputs: { __popup__: { classPropertyName: "__popup__", publicName: "__popup__", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 }); }
405
- }
406
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: AXPopupComponentBase, decorators: [{
407
- type: Directive
408
- }], propDecorators: { __popup__: [{ type: i0.Input, args: [{ isSignal: true, alias: "__popup__", required: false }] }] } });
409
-
410
- /**
411
- * This is a service which you can create popup with it
412
- *
413
- * @category Components
414
- */
415
- class AXPopupService {
416
- constructor() {
417
- this.stateService = inject(AXPopupStateService);
418
- }
419
- /**
420
- * @ignore
421
- */
422
- open(arg1, arg2) {
423
- let config = {
424
- closeButton: true,
425
- header: true,
426
- size: 'md',
427
- maximizable: false,
428
- draggable: true,
429
- hasBackdrop: true,
430
- closeOnBackdropClick: false,
431
- data: {},
432
- };
433
- if (typeof arg2 === 'string') {
434
- config.title = arg2;
435
- }
436
- else {
437
- config = Object.assign(config, arg2);
438
- }
439
- const promise = new AXComponentClosedPromise((resolve) => {
440
- this.stateService.open(arg1, config).then((ref) => {
441
- ref.onClose.subscribe((data) => {
442
- if (resolve) {
443
- resolve({
444
- sender: null,
445
- data: data,
446
- });
447
- }
448
- });
449
- });
450
- });
451
- return promise;
452
- }
453
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: AXPopupService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
454
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: AXPopupService }); }
455
- }
456
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: AXPopupService, decorators: [{
457
- type: Injectable
458
- }] });
459
-
460
447
  const COMPONENT = [AXPopupComponent];
461
448
  const MODULES = [CommonModule, AXCommonModule, AXDecoratorModule, AXTranslationModule];
462
449
  class AXPopupModule {
@@ -477,5 +464,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImpo
477
464
  * Generated bundle index. Do not edit.
478
465
  */
479
466
 
480
- export { AXPopupComponent, AXPopupComponentBase, AXPopupModule, AXPopupService, AXPopupStateService };
467
+ export { AXPopupComponent, AXPopupComponentBase, AXPopupModule, AXPopupService };
481
468
  //# sourceMappingURL=acorex-components-popup.mjs.map