@ng-nest/ui 13.1.3 → 13.1.6

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 (71) hide show
  1. package/auto-complete/auto-complete.component.d.ts +1 -0
  2. package/auto-complete/auto-complete.property.d.ts +6 -1
  3. package/core/config/config.d.ts +5 -0
  4. package/dialog/dialog-portal.component.d.ts +33 -5
  5. package/dialog/dialog-portal.directives.d.ts +17 -0
  6. package/dialog/dialog-ref.d.ts +11 -1
  7. package/dialog/dialog.component.d.ts +3 -5
  8. package/dialog/dialog.module.d.ts +1 -1
  9. package/dialog/dialog.property.d.ts +37 -4
  10. package/dialog/dialog.service.d.ts +1 -0
  11. package/dropdown/dropdown-portal.component.d.ts +2 -0
  12. package/dropdown/dropdown.component.d.ts +1 -0
  13. package/dropdown/dropdown.module.d.ts +2 -1
  14. package/dropdown/dropdown.property.d.ts +11 -1
  15. package/esm2020/auto-complete/auto-complete.component.mjs +23 -9
  16. package/esm2020/auto-complete/auto-complete.property.mjs +8 -2
  17. package/esm2020/core/config/config.mjs +1 -1
  18. package/esm2020/dialog/dialog-portal.component.mjs +54 -12
  19. package/esm2020/dialog/dialog-portal.directives.mjs +47 -1
  20. package/esm2020/dialog/dialog-ref.mjs +83 -2
  21. package/esm2020/dialog/dialog.component.mjs +24 -27
  22. package/esm2020/dialog/dialog.module.mjs +10 -2
  23. package/esm2020/dialog/dialog.property.mjs +10 -3
  24. package/esm2020/dialog/dialog.service.mjs +56 -8
  25. package/esm2020/dropdown/dropdown-portal.component.mjs +10 -4
  26. package/esm2020/dropdown/dropdown.component.mjs +8 -1
  27. package/esm2020/dropdown/dropdown.module.mjs +5 -4
  28. package/esm2020/dropdown/dropdown.property.mjs +11 -2
  29. package/esm2020/list/list-option.component.mjs +21 -8
  30. package/esm2020/list/list.component.mjs +4 -4
  31. package/esm2020/list/list.property.mjs +13 -3
  32. package/esm2020/menu/menu.component.mjs +3 -3
  33. package/esm2020/resizable/resizable.directive.mjs +18 -6
  34. package/fesm2015/ng-nest-ui-auto-complete.mjs +29 -9
  35. package/fesm2015/ng-nest-ui-auto-complete.mjs.map +1 -1
  36. package/fesm2015/ng-nest-ui-core.mjs.map +1 -1
  37. package/fesm2015/ng-nest-ui-dialog.mjs +287 -54
  38. package/fesm2015/ng-nest-ui-dialog.mjs.map +1 -1
  39. package/fesm2015/ng-nest-ui-dropdown.mjs +32 -9
  40. package/fesm2015/ng-nest-ui-dropdown.mjs.map +1 -1
  41. package/fesm2015/ng-nest-ui-list.mjs +37 -16
  42. package/fesm2015/ng-nest-ui-list.mjs.map +1 -1
  43. package/fesm2015/ng-nest-ui-menu.mjs +2 -2
  44. package/fesm2015/ng-nest-ui-menu.mjs.map +1 -1
  45. package/fesm2015/ng-nest-ui-resizable.mjs +17 -5
  46. package/fesm2015/ng-nest-ui-resizable.mjs.map +1 -1
  47. package/fesm2020/ng-nest-ui-auto-complete.mjs +29 -9
  48. package/fesm2020/ng-nest-ui-auto-complete.mjs.map +1 -1
  49. package/fesm2020/ng-nest-ui-core.mjs.map +1 -1
  50. package/fesm2020/ng-nest-ui-dialog.mjs +279 -53
  51. package/fesm2020/ng-nest-ui-dialog.mjs.map +1 -1
  52. package/fesm2020/ng-nest-ui-dropdown.mjs +32 -9
  53. package/fesm2020/ng-nest-ui-dropdown.mjs.map +1 -1
  54. package/fesm2020/ng-nest-ui-list.mjs +37 -16
  55. package/fesm2020/ng-nest-ui-list.mjs.map +1 -1
  56. package/fesm2020/ng-nest-ui-menu.mjs +2 -2
  57. package/fesm2020/ng-nest-ui-menu.mjs.map +1 -1
  58. package/fesm2020/ng-nest-ui-resizable.mjs +17 -5
  59. package/fesm2020/ng-nest-ui-resizable.mjs.map +1 -1
  60. package/list/examples/en_US/default/size/README.md +6 -0
  61. package/list/examples/zh_CN/default/size/README.md +6 -0
  62. package/list/list-option.component.d.ts +8 -2
  63. package/list/list.property.d.ts +13 -3
  64. package/package.json +1 -1
  65. package/rate/examples/en_US/default/color/README.md +6 -0
  66. package/rate/examples/zh_CN/default/color/README.md +6 -0
  67. package/resizable/resizable.directive.d.ts +4 -1
  68. package/style/core/index.css +3 -0
  69. package/style/core/index.css.map +1 -1
  70. package/style/directives/resizable/mixin.scss +5 -0
  71. package/tag/examples/zh_CN/default/bordered/README.md +1 -1
@@ -1,6 +1,6 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, EventEmitter, Component, Input, Output, ViewEncapsulation, ChangeDetectionStrategy, ViewChild, HostBinding, HostListener, Directive, Optional, TemplateRef, Injectable, NgModule } from '@angular/core';
3
- import * as i2$1 from '@ng-nest/ui/core';
2
+ import { InjectionToken, EventEmitter, Component, Input, Output, ViewEncapsulation, ChangeDetectionStrategy, ViewChild, QueryList, HostBinding, HostListener, ContentChildren, Directive, Optional, TemplateRef, Injectable, NgModule } from '@angular/core';
3
+ import * as i2$2 from '@ng-nest/ui/core';
4
4
  import { XInputBoolean, XWithConfig, XIsChange, XIsFunction, XMoveBoxAnimation, fillDefault } from '@ng-nest/ui/core';
5
5
  import { __decorate } from 'tslib';
6
6
  import * as i4 from '@ng-nest/ui/alert';
@@ -17,13 +17,15 @@ import * as i6 from '@ng-nest/ui/outlet';
17
17
  import { XOutletModule } from '@ng-nest/ui/outlet';
18
18
  import * as i7 from '@angular/common';
19
19
  import { CommonModule } from '@angular/common';
20
- import * as i1$1 from '@angular/cdk/portal';
20
+ import * as i3$1 from '@angular/cdk/portal';
21
21
  import { BasePortalOutlet, CdkPortalOutlet, TemplatePortal, ComponentPortal } from '@angular/cdk/portal';
22
+ import * as i1$1 from '@angular/cdk/drag-drop';
23
+ import { CdkDragHandle, CdkDrag, DragDropModule } from '@angular/cdk/drag-drop';
24
+ import * as i2$1 from '@ng-nest/ui/resizable';
25
+ import { XResizableModule } from '@ng-nest/ui/resizable';
22
26
  import { XIconModule } from '@ng-nest/ui/icon';
23
27
  import { FormsModule, ReactiveFormsModule } from '@angular/forms';
24
28
  import { XInputModule } from '@ng-nest/ui/input';
25
- import { XResizableModule } from '@ng-nest/ui/resizable';
26
- import { DragDropModule } from '@angular/cdk/drag-drop';
27
29
 
28
30
  /**
29
31
  * Dialog
@@ -56,6 +58,11 @@ class XDialogProperty extends XAlertProperty {
56
58
  * @en_US Confirm button event
57
59
  */
58
60
  this.confirm = new EventEmitter();
61
+ /**
62
+ * @zh_CN 确认按钮的事件
63
+ * @en_US Confirm button event
64
+ */
65
+ this.close = new EventEmitter();
59
66
  /**
60
67
  * @zh_CN 显示/隐藏改变事件
61
68
  * @en_US Show/hide change events
@@ -74,7 +81,7 @@ class XDialogProperty extends XAlertProperty {
74
81
  }
75
82
  }
76
83
  /** @nocollapse */ /** @nocollapse */ XDialogProperty.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: XDialogProperty, deps: null, target: i0.ɵɵFactoryTarget.Component });
77
- /** @nocollapse */ /** @nocollapse */ XDialogProperty.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.2", type: XDialogProperty, selector: "ng-component", inputs: { visible: "visible", placement: "placement", offset: "offset", type: "type", width: "width", height: "height", minWidth: "minWidth", minHeight: "minHeight", effect: "effect", footer: "footer", showCancel: "showCancel", cancelText: "cancelText", showConfirm: "showConfirm", confirmText: "confirmText", backdropClose: "backdropClose", hasBackdrop: "hasBackdrop", className: "className", buttonsCenter: "buttonsCenter", draggable: "draggable", resizable: "resizable", maximize: "maximize", beforeClose: "beforeClose" }, outputs: { cancel: "cancel", confirm: "confirm", visibleChange: "visibleChange", showDone: "showDone", closeDone: "closeDone" }, usesInheritance: true, ngImport: i0, template: '', isInline: true });
84
+ /** @nocollapse */ /** @nocollapse */ XDialogProperty.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.2", type: XDialogProperty, selector: "ng-component", inputs: { visible: "visible", placement: "placement", offset: "offset", type: "type", width: "width", height: "height", minWidth: "minWidth", minHeight: "minHeight", effect: "effect", footer: "footer", showCancel: "showCancel", cancelText: "cancelText", showConfirm: "showConfirm", confirmText: "confirmText", backdropClose: "backdropClose", hasBackdrop: "hasBackdrop", className: "className", buttonsCenter: "buttonsCenter", draggable: "draggable", resizable: "resizable", maximize: "maximize", beforeClose: "beforeClose" }, outputs: { cancel: "cancel", confirm: "confirm", close: "close", visibleChange: "visibleChange", showDone: "showDone", closeDone: "closeDone" }, usesInheritance: true, ngImport: i0, template: '', isInline: true });
78
85
  __decorate([
79
86
  XInputBoolean()
80
87
  ], XDialogProperty.prototype, "visible", void 0);
@@ -91,7 +98,7 @@ __decorate([
91
98
  XWithConfig(X_DIALOG_CONFIG_NAME, '18rem')
92
99
  ], XDialogProperty.prototype, "minWidth", void 0);
93
100
  __decorate([
94
- XWithConfig(X_DIALOG_CONFIG_NAME, '9rem')
101
+ XWithConfig(X_DIALOG_CONFIG_NAME, '8rem')
95
102
  ], XDialogProperty.prototype, "minHeight", void 0);
96
103
  __decorate([
97
104
  XWithConfig(X_DIALOG_CONFIG_NAME, 'white')
@@ -184,6 +191,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
184
191
  type: Output
185
192
  }], confirm: [{
186
193
  type: Output
194
+ }], close: [{
195
+ type: Output
187
196
  }], visibleChange: [{
188
197
  type: Output
189
198
  }], showDone: [{
@@ -211,6 +220,7 @@ class XDialogComponent extends XDialogProperty {
211
220
  this.contentBox = {};
212
221
  this.distance = { x: 0, y: 0 };
213
222
  this.viewInit = false;
223
+ this.action = null;
214
224
  this._unSubject = new Subject();
215
225
  this.scrollStrategy = this.protalService.overlay.scrollStrategies.block();
216
226
  }
@@ -253,8 +263,7 @@ class XDialogComponent extends XDialogProperty {
253
263
  this.create();
254
264
  }
255
265
  else {
256
- this.detach();
257
- // this.visibleChange.emit(false);
266
+ this.onClose('close', false);
258
267
  }
259
268
  }
260
269
  create() {
@@ -294,7 +303,7 @@ class XDialogComponent extends XDialogProperty {
294
303
  });
295
304
  }
296
305
  if (this.hasBackdrop && this.backdropClose && this.dialogRef?.overlayRef) {
297
- this.backdropClick$ = this.dialogRef.overlayRef.backdropClick().subscribe(() => this.onClose());
306
+ this.backdropClick$ = this.dialogRef.overlayRef.backdropClick().subscribe(() => this.onClose('close'));
298
307
  }
299
308
  }
300
309
  setWidthHeight() {
@@ -307,24 +316,29 @@ class XDialogComponent extends XDialogProperty {
307
316
  this.maximize = false;
308
317
  }
309
318
  }
310
- detach() {
311
- if (this.portalAttached()) {
312
- this.visible = false;
313
- this.visibleChange.emit(this.visible);
314
- this.dialogRef?.overlayRef?.detach();
315
- this.unsubscribe();
316
- this.close.emit();
317
- }
318
- }
319
319
  portalAttached() {
320
320
  return this.dialogRef?.overlayRef?.hasAttached();
321
321
  }
322
- onClose() {
323
- if (XIsFunction(this.beforeClose)) {
324
- this.beforeClose();
322
+ onClose(action, execFunction = true) {
323
+ if (!this.portalAttached())
324
+ return;
325
+ if (XIsFunction(this.beforeClose) && execFunction) {
326
+ this.beforeClose(action);
327
+ this.action = action;
325
328
  }
326
329
  else {
327
- this.detach();
330
+ this.visible = false;
331
+ this.visibleChange.emit(this.visible);
332
+ this.dialogRef?.overlayRef?.detach();
333
+ this.unsubscribe();
334
+ if ([action, this.action].includes('confirm')) {
335
+ this.confirm.emit();
336
+ }
337
+ if ([action, this.action].includes('cancel')) {
338
+ this.cancel.emit();
339
+ }
340
+ this.action = null;
341
+ this.close.emit();
328
342
  }
329
343
  }
330
344
  onDragEnded($event) {
@@ -388,14 +402,6 @@ class XDialogComponent extends XDialogProperty {
388
402
  }
389
403
  }
390
404
  }
391
- onCancel() {
392
- this.onClose();
393
- this.cancel.emit();
394
- }
395
- onConfirm() {
396
- this.onClose();
397
- this.confirm.emit();
398
- }
399
405
  moveDone($event) {
400
406
  if ($event.toState === 'void') {
401
407
  this.closeDone.emit($event);
@@ -421,20 +427,29 @@ class XDialogComponent extends XDialogProperty {
421
427
  }
422
428
  }
423
429
  /** @nocollapse */ /** @nocollapse */ XDialogComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: XDialogComponent, deps: [{ token: i0.Renderer2 }, { token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i0.ViewContainerRef }, { token: i1.XPortalService }, { token: i2.Overlay }, { token: i3.XI18nService }], target: i0.ɵɵFactoryTarget.Component });
424
- /** @nocollapse */ /** @nocollapse */ XDialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.2", type: XDialogComponent, selector: "x-dialog", viewQueries: [{ propertyName: "dialogTpl", first: true, predicate: ["dialogTpl"], descendants: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<ng-template #dialogTpl>\r\n <div\r\n class=\"x-dialog\"\r\n [@x-move-box-animation]=\"placement\"\r\n (@x-move-box-animation.done)=\"moveDone($event)\"\r\n [class.x-dialog-maximize]=\"isMaximize\"\r\n [class.x-dialog-resizable]=\"resizable\"\r\n [class.x-dialog-default-maximize]=\"isDefaultMaximize\"\r\n >\r\n <x-alert\r\n [draggable]=\"draggable && dialogBox['draggable']\"\r\n [resizable]=\"resizable && dialogBox['resizable']\"\r\n [dragFreeDragPosition]=\"dialogBox['distance']\"\r\n [offsetLeft]=\"offsetLeft\"\r\n [offsetTop]=\"offsetTop\"\r\n [minWidth]=\"dialogBox['minWidth']\"\r\n [minHeight]=\"dialogBox['minHeight']\"\r\n [dragBoundary]=\"'.cdk-overlay-container'\"\r\n [title]=\"title\"\r\n [content]=\"contentTpl\"\r\n [type]=\"type\"\r\n [effect]=\"effect\"\r\n [hideClose]=\"hideClose\"\r\n [closeText]=\"closeText\"\r\n [operationTpl]=\"operationTpl\"\r\n (close)=\"onClose()\"\r\n (dragEnded)=\"onDragEnded($event)\"\r\n (resizing)=\"onResizing($event)\"\r\n showIcon=\"false\"\r\n duration=\"0\"\r\n manual\r\n disabledAnimation\r\n ></x-alert>\r\n </div>\r\n</ng-template>\r\n\r\n<ng-template #contentTpl>\r\n <div class=\"x-dialog-inner\">\r\n <div class=\"x-dialog-content\">\r\n <ng-content></ng-content>\r\n </div>\r\n <div class=\"x-dialog-buttons\" [class.x-dialog-buttons-center]=\"buttonsCenter\">\r\n <ng-container *xOutlet=\"footer\">\r\n <x-buttons space=\"1\" *ngIf=\"showCancel || showConfirm\">\r\n <x-button *ngIf=\"showCancel\" (click)=\"onCancel()\">{{ getCancelText }}</x-button>\r\n <x-button *ngIf=\"showConfirm\" type=\"primary\" (click)=\"onConfirm()\">{{ getConfirmText }}</x-button>\r\n </x-buttons>\r\n </ng-container>\r\n </div>\r\n </div>\r\n</ng-template>\r\n\r\n<ng-template #operationTpl>\r\n <ng-container *ngIf=\"maximize || resizable\">\r\n <x-button size=\"small\" [icon]=\"isMaximize ? 'fto-minimize' : 'fto-maximize'\" [onlyIcon]=\"true\" (click)=\"onSize()\"></x-button>\r\n </ng-container>\r\n</ng-template>\r\n", styles: [".x-dialog{margin:0;padding:0;width:100%;height:100%}.x-dialog>x-alert{height:100%}.x-dialog>x-alert .x-alert{min-height:100%;height:-moz-fit-content;height:fit-content;align-items:inherit;padding:0}.x-dialog>x-alert .x-alert-inner{min-height:100%;display:flex;flex-direction:column}.x-dialog>x-alert .x-alert-title{padding:1rem 1rem 0}.x-dialog>x-alert .x-alert-content{flex:1;display:flex;flex-direction:column;padding:0 1rem .5rem}.x-dialog-inner{display:flex;flex-direction:column;margin:.5rem 0;flex:1}.x-dialog-buttons{display:flex;justify-content:flex-end}.x-dialog-buttons>x-buttons{margin-top:1rem;align-self:flex-end}.x-dialog-buttons-center{justify-content:center}.x-dialog-content{display:inline-flex;flex-direction:column;flex:1;max-height:70vh;overflow:auto;min-height:2rem}.x-dialog-maximize>x-alert .x-alert{left:0!important;top:0!important}.x-dialog-maximize .x-dialog-content{max-height:calc(100vh - 7rem)!important;height:calc(100vh - 7rem)!important}.x-dialog-default-maximize .x-dialog-content{max-height:calc(100vh - 7rem)!important;height:calc(100vh - 7rem)!important;flex:initial}.x-dialog-container x-dialog{width:100%}\n"], components: [{ type: i4.XAlertComponent, selector: "x-alert" }, { type: i5.XButtonsComponent, selector: "x-buttons" }, { type: i5.XButtonComponent, selector: "x-button" }], directives: [{ type: i6.XOutletDirective, selector: "[xOutlet]", inputs: ["xOutletContext", "xOutlet"] }, { type: i7.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], animations: [XMoveBoxAnimation], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
430
+ /** @nocollapse */ /** @nocollapse */ XDialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.2", type: XDialogComponent, selector: "x-dialog", viewQueries: [{ propertyName: "dialogTpl", first: true, predicate: ["dialogTpl"], descendants: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<ng-template #dialogTpl>\r\n <div\r\n class=\"x-dialog\"\r\n [@x-move-box-animation]=\"placement\"\r\n (@x-move-box-animation.done)=\"moveDone($event)\"\r\n [class.x-dialog-maximize]=\"isMaximize\"\r\n [class.x-dialog-resizable]=\"resizable\"\r\n [class.x-dialog-default-maximize]=\"isDefaultMaximize\"\r\n >\r\n <x-alert\r\n [draggable]=\"draggable && dialogBox['draggable']\"\r\n [resizable]=\"resizable && dialogBox['resizable']\"\r\n [dragFreeDragPosition]=\"dialogBox['distance']\"\r\n [offsetLeft]=\"offsetLeft\"\r\n [offsetTop]=\"offsetTop\"\r\n [minWidth]=\"dialogBox['minWidth']\"\r\n [minHeight]=\"dialogBox['minHeight']\"\r\n [dragBoundary]=\"'.cdk-overlay-container'\"\r\n [title]=\"title\"\r\n [content]=\"contentTpl\"\r\n [type]=\"type\"\r\n [effect]=\"effect\"\r\n [hideClose]=\"hideClose\"\r\n [closeText]=\"closeText\"\r\n [operationTpl]=\"operationTpl\"\r\n (close)=\"onClose('close')\"\r\n (dragEnded)=\"onDragEnded($event)\"\r\n (resizing)=\"onResizing($event)\"\r\n showIcon=\"false\"\r\n duration=\"0\"\r\n manual\r\n disabledAnimation\r\n ></x-alert>\r\n </div>\r\n</ng-template>\r\n\r\n<ng-template #contentTpl>\r\n <div class=\"x-dialog-inner\">\r\n <div class=\"x-dialog-content\">\r\n <ng-content></ng-content>\r\n </div>\r\n <div class=\"x-dialog-buttons\" [class.x-dialog-buttons-center]=\"buttonsCenter\">\r\n <ng-container *xOutlet=\"footer\">\r\n <x-buttons space=\"1\" *ngIf=\"showCancel || showConfirm\">\r\n <x-button *ngIf=\"showCancel\" (click)=\"onClose('cancel')\">{{ getCancelText }}</x-button>\r\n <x-button *ngIf=\"showConfirm\" type=\"primary\" (click)=\"onClose('confirm')\">{{ getConfirmText }}</x-button>\r\n </x-buttons>\r\n </ng-container>\r\n </div>\r\n </div>\r\n</ng-template>\r\n\r\n<ng-template #operationTpl>\r\n <ng-container *ngIf=\"maximize || resizable\">\r\n <x-button size=\"small\" [icon]=\"isMaximize ? 'fto-minimize' : 'fto-maximize'\" [onlyIcon]=\"true\" (click)=\"onSize()\"></x-button>\r\n </ng-container>\r\n</ng-template>\r\n", styles: [".x-dialog{margin:0;padding:0;width:100%;height:100%}.x-dialog>x-alert{height:100%}.x-dialog>x-alert .x-alert{min-height:100%;height:-moz-fit-content;height:fit-content;align-items:inherit;padding:0}.x-dialog>x-alert .x-alert-inner{min-height:100%;display:flex;flex-direction:column}.x-dialog>x-alert .x-alert-title{padding:1rem 1rem 0}.x-dialog>x-alert .x-alert-content{flex:1;display:flex;flex-direction:column;padding:0 1rem .5rem}.x-dialog-inner{display:flex;flex-direction:column;margin:.5rem 0;flex:1}.x-dialog-buttons{display:flex;justify-content:flex-end}.x-dialog-buttons>x-buttons{margin-top:1rem;align-self:flex-end}.x-dialog-buttons-center{justify-content:center}.x-dialog-content{display:inline-flex;flex-direction:column;flex:1;max-height:70vh;overflow:auto;min-height:2rem}.x-dialog-maximize>x-alert .x-alert{left:0!important;top:0!important}.x-dialog-maximize .x-dialog-content{max-height:calc(100vh - 7rem)!important;height:calc(100vh - 7rem)!important}.x-dialog-default-maximize .x-dialog-content{max-height:calc(100vh - 7rem)!important;height:calc(100vh - 7rem)!important;flex:initial}.x-dialog-container x-dialog{width:100%}\n"], components: [{ type: i4.XAlertComponent, selector: "x-alert" }, { type: i5.XButtonsComponent, selector: "x-buttons" }, { type: i5.XButtonComponent, selector: "x-button" }], directives: [{ type: i6.XOutletDirective, selector: "[xOutlet]", inputs: ["xOutletContext", "xOutlet"] }, { type: i7.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], animations: [XMoveBoxAnimation], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
425
431
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: XDialogComponent, decorators: [{
426
432
  type: Component,
427
- args: [{ selector: `${XDialogPrefix}`, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, animations: [XMoveBoxAnimation], template: "<ng-template #dialogTpl>\r\n <div\r\n class=\"x-dialog\"\r\n [@x-move-box-animation]=\"placement\"\r\n (@x-move-box-animation.done)=\"moveDone($event)\"\r\n [class.x-dialog-maximize]=\"isMaximize\"\r\n [class.x-dialog-resizable]=\"resizable\"\r\n [class.x-dialog-default-maximize]=\"isDefaultMaximize\"\r\n >\r\n <x-alert\r\n [draggable]=\"draggable && dialogBox['draggable']\"\r\n [resizable]=\"resizable && dialogBox['resizable']\"\r\n [dragFreeDragPosition]=\"dialogBox['distance']\"\r\n [offsetLeft]=\"offsetLeft\"\r\n [offsetTop]=\"offsetTop\"\r\n [minWidth]=\"dialogBox['minWidth']\"\r\n [minHeight]=\"dialogBox['minHeight']\"\r\n [dragBoundary]=\"'.cdk-overlay-container'\"\r\n [title]=\"title\"\r\n [content]=\"contentTpl\"\r\n [type]=\"type\"\r\n [effect]=\"effect\"\r\n [hideClose]=\"hideClose\"\r\n [closeText]=\"closeText\"\r\n [operationTpl]=\"operationTpl\"\r\n (close)=\"onClose()\"\r\n (dragEnded)=\"onDragEnded($event)\"\r\n (resizing)=\"onResizing($event)\"\r\n showIcon=\"false\"\r\n duration=\"0\"\r\n manual\r\n disabledAnimation\r\n ></x-alert>\r\n </div>\r\n</ng-template>\r\n\r\n<ng-template #contentTpl>\r\n <div class=\"x-dialog-inner\">\r\n <div class=\"x-dialog-content\">\r\n <ng-content></ng-content>\r\n </div>\r\n <div class=\"x-dialog-buttons\" [class.x-dialog-buttons-center]=\"buttonsCenter\">\r\n <ng-container *xOutlet=\"footer\">\r\n <x-buttons space=\"1\" *ngIf=\"showCancel || showConfirm\">\r\n <x-button *ngIf=\"showCancel\" (click)=\"onCancel()\">{{ getCancelText }}</x-button>\r\n <x-button *ngIf=\"showConfirm\" type=\"primary\" (click)=\"onConfirm()\">{{ getConfirmText }}</x-button>\r\n </x-buttons>\r\n </ng-container>\r\n </div>\r\n </div>\r\n</ng-template>\r\n\r\n<ng-template #operationTpl>\r\n <ng-container *ngIf=\"maximize || resizable\">\r\n <x-button size=\"small\" [icon]=\"isMaximize ? 'fto-minimize' : 'fto-maximize'\" [onlyIcon]=\"true\" (click)=\"onSize()\"></x-button>\r\n </ng-container>\r\n</ng-template>\r\n", styles: [".x-dialog{margin:0;padding:0;width:100%;height:100%}.x-dialog>x-alert{height:100%}.x-dialog>x-alert .x-alert{min-height:100%;height:-moz-fit-content;height:fit-content;align-items:inherit;padding:0}.x-dialog>x-alert .x-alert-inner{min-height:100%;display:flex;flex-direction:column}.x-dialog>x-alert .x-alert-title{padding:1rem 1rem 0}.x-dialog>x-alert .x-alert-content{flex:1;display:flex;flex-direction:column;padding:0 1rem .5rem}.x-dialog-inner{display:flex;flex-direction:column;margin:.5rem 0;flex:1}.x-dialog-buttons{display:flex;justify-content:flex-end}.x-dialog-buttons>x-buttons{margin-top:1rem;align-self:flex-end}.x-dialog-buttons-center{justify-content:center}.x-dialog-content{display:inline-flex;flex-direction:column;flex:1;max-height:70vh;overflow:auto;min-height:2rem}.x-dialog-maximize>x-alert .x-alert{left:0!important;top:0!important}.x-dialog-maximize .x-dialog-content{max-height:calc(100vh - 7rem)!important;height:calc(100vh - 7rem)!important}.x-dialog-default-maximize .x-dialog-content{max-height:calc(100vh - 7rem)!important;height:calc(100vh - 7rem)!important;flex:initial}.x-dialog-container x-dialog{width:100%}\n"] }]
433
+ args: [{ selector: `${XDialogPrefix}`, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, animations: [XMoveBoxAnimation], template: "<ng-template #dialogTpl>\r\n <div\r\n class=\"x-dialog\"\r\n [@x-move-box-animation]=\"placement\"\r\n (@x-move-box-animation.done)=\"moveDone($event)\"\r\n [class.x-dialog-maximize]=\"isMaximize\"\r\n [class.x-dialog-resizable]=\"resizable\"\r\n [class.x-dialog-default-maximize]=\"isDefaultMaximize\"\r\n >\r\n <x-alert\r\n [draggable]=\"draggable && dialogBox['draggable']\"\r\n [resizable]=\"resizable && dialogBox['resizable']\"\r\n [dragFreeDragPosition]=\"dialogBox['distance']\"\r\n [offsetLeft]=\"offsetLeft\"\r\n [offsetTop]=\"offsetTop\"\r\n [minWidth]=\"dialogBox['minWidth']\"\r\n [minHeight]=\"dialogBox['minHeight']\"\r\n [dragBoundary]=\"'.cdk-overlay-container'\"\r\n [title]=\"title\"\r\n [content]=\"contentTpl\"\r\n [type]=\"type\"\r\n [effect]=\"effect\"\r\n [hideClose]=\"hideClose\"\r\n [closeText]=\"closeText\"\r\n [operationTpl]=\"operationTpl\"\r\n (close)=\"onClose('close')\"\r\n (dragEnded)=\"onDragEnded($event)\"\r\n (resizing)=\"onResizing($event)\"\r\n showIcon=\"false\"\r\n duration=\"0\"\r\n manual\r\n disabledAnimation\r\n ></x-alert>\r\n </div>\r\n</ng-template>\r\n\r\n<ng-template #contentTpl>\r\n <div class=\"x-dialog-inner\">\r\n <div class=\"x-dialog-content\">\r\n <ng-content></ng-content>\r\n </div>\r\n <div class=\"x-dialog-buttons\" [class.x-dialog-buttons-center]=\"buttonsCenter\">\r\n <ng-container *xOutlet=\"footer\">\r\n <x-buttons space=\"1\" *ngIf=\"showCancel || showConfirm\">\r\n <x-button *ngIf=\"showCancel\" (click)=\"onClose('cancel')\">{{ getCancelText }}</x-button>\r\n <x-button *ngIf=\"showConfirm\" type=\"primary\" (click)=\"onClose('confirm')\">{{ getConfirmText }}</x-button>\r\n </x-buttons>\r\n </ng-container>\r\n </div>\r\n </div>\r\n</ng-template>\r\n\r\n<ng-template #operationTpl>\r\n <ng-container *ngIf=\"maximize || resizable\">\r\n <x-button size=\"small\" [icon]=\"isMaximize ? 'fto-minimize' : 'fto-maximize'\" [onlyIcon]=\"true\" (click)=\"onSize()\"></x-button>\r\n </ng-container>\r\n</ng-template>\r\n", styles: [".x-dialog{margin:0;padding:0;width:100%;height:100%}.x-dialog>x-alert{height:100%}.x-dialog>x-alert .x-alert{min-height:100%;height:-moz-fit-content;height:fit-content;align-items:inherit;padding:0}.x-dialog>x-alert .x-alert-inner{min-height:100%;display:flex;flex-direction:column}.x-dialog>x-alert .x-alert-title{padding:1rem 1rem 0}.x-dialog>x-alert .x-alert-content{flex:1;display:flex;flex-direction:column;padding:0 1rem .5rem}.x-dialog-inner{display:flex;flex-direction:column;margin:.5rem 0;flex:1}.x-dialog-buttons{display:flex;justify-content:flex-end}.x-dialog-buttons>x-buttons{margin-top:1rem;align-self:flex-end}.x-dialog-buttons-center{justify-content:center}.x-dialog-content{display:inline-flex;flex-direction:column;flex:1;max-height:70vh;overflow:auto;min-height:2rem}.x-dialog-maximize>x-alert .x-alert{left:0!important;top:0!important}.x-dialog-maximize .x-dialog-content{max-height:calc(100vh - 7rem)!important;height:calc(100vh - 7rem)!important}.x-dialog-default-maximize .x-dialog-content{max-height:calc(100vh - 7rem)!important;height:calc(100vh - 7rem)!important;flex:initial}.x-dialog-container x-dialog{width:100%}\n"] }]
428
434
  }], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i0.ViewContainerRef }, { type: i1.XPortalService }, { type: i2.Overlay }, { type: i3.XI18nService }]; }, propDecorators: { dialogTpl: [{
429
435
  type: ViewChild,
430
436
  args: ['dialogTpl', { static: false }]
431
437
  }] } });
432
438
 
433
439
  class XDialogPortalComponent extends BasePortalOutlet {
434
- constructor() {
440
+ constructor(renderer) {
435
441
  super();
436
- this._has = true;
442
+ this.renderer = renderer;
437
443
  this.animationChanged = new EventEmitter();
444
+ this.offsetLeft = 0;
445
+ this.offsetTop = 0;
446
+ this.minWidth = '0rem';
447
+ this.minHeight = '0rem';
448
+ this.initHeight = 0;
449
+ this.initContentHeight = 0;
450
+ this.defaultMaximize = false;
451
+ this.distance = { x: 0, y: 0 };
452
+ this.dialogBox = {};
438
453
  }
439
454
  done({ toState, totalTime }) {
440
455
  this.animationChanged.next({ action: 'done', state: toState, totalTime });
@@ -442,6 +457,22 @@ class XDialogPortalComponent extends BasePortalOutlet {
442
457
  start({ toState, totalTime }) {
443
458
  this.animationChanged.next({ action: 'start', state: toState, totalTime });
444
459
  }
460
+ ngOnInit() {
461
+ this.dialogBox['draggable'] = this.defaultMaximize ? this.dialogBox['draggable'] : this.option.draggable;
462
+ this.dialogBox['resizable'] = this.defaultMaximize ? this.dialogBox['resizable'] : this.option.resizable;
463
+ }
464
+ ngAfterViewInit() {
465
+ let list = new QueryList();
466
+ if (this.dialogRef.dragHandleRefs.length === 0) {
467
+ this.dialogBox['draggable'] = false;
468
+ this.option.draggable = false;
469
+ return;
470
+ }
471
+ for (let item of this.dialogRef.dragHandleRefs) {
472
+ list.reset([...list.toArray(), new CdkDragHandle(item, this.dragRef)]);
473
+ }
474
+ this.dragRef._handles = list;
475
+ }
445
476
  attachComponentPortal(portal) {
446
477
  if (this.portalOutlet.hasAttached()) {
447
478
  throw Error('dialog portal has attached');
@@ -454,16 +485,24 @@ class XDialogPortalComponent extends BasePortalOutlet {
454
485
  }
455
486
  return this.portalOutlet.attachTemplatePortal(portal);
456
487
  }
488
+ resizing(event) {
489
+ const contentHeight = Number(this.initContentHeight) + Number(event.clientHeight) - Number(this.initHeight);
490
+ this.renderer.setStyle(this.dialogContent, 'max-height', 'initial');
491
+ this.renderer.setStyle(this.dialogContent, 'flex', 'initial');
492
+ if (['top-start', 'top-end', 'bottom', 'top', 'bottom-start', 'bottom-end'].includes(event.direction)) {
493
+ this.renderer.setStyle(this.dialogContent, 'height', `${contentHeight}px`);
494
+ }
495
+ }
496
+ onDragEnded(event) {
497
+ this.distance = { x: this.distance.x + event.distance.x, y: this.distance.y + event.distance.y };
498
+ }
457
499
  }
458
- /** @nocollapse */ /** @nocollapse */ XDialogPortalComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: XDialogPortalComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
459
- /** @nocollapse */ /** @nocollapse */ XDialogPortalComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.2", type: XDialogPortalComponent, selector: "x-dialog-portal", host: { listeners: { "@x-move-box-animation.done": "done($event)", "@x-move-box-animation.start": "start($event)" }, properties: { "class.x-dialog-portal": "this._has", "@x-move-box-animation": "this.placement" } }, viewQueries: [{ propertyName: "portalOutlet", first: true, predicate: CdkPortalOutlet, descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: "<ng-template cdkPortalOutlet></ng-template>\r\n", styles: [".x-dialog-portal{margin:0;padding:0;width:100%;height:100%;overflow:auto;display:block;padding:1rem;box-sizing:border-box;min-height:inherit;max-height:inherit;background-color:var(--x-background);box-shadow:var(--x-box-shadow) var(--x-box-shadow-light-color);border:.0625rem solid transparent;border-radius:var(--x-border-radius)}.x-dialog-portal-title{display:block;margin:0 0 .5rem;font-weight:600;color:var(--x-text-300);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.x-dialog-portal-content{display:block;margin:0 -1rem;padding:0 1rem;max-height:70vh;overflow:auto;color:var(--x-text-300);font-size:calc(var(--x-font-size) - .0625rem);line-height:1.325rem}.x-dialog-portal-actions{display:flex;align-items:center;justify-content:flex-end;flex-wrap:wrap;box-sizing:content-box;margin-bottom:-1rem;min-height:4rem}.x-dialog-portal-actions[align=center]{justify-content:center}.x-dialog-portal-actions[align=start]{justify-content:flex-start}.x-dialog-portal-actions x-button:not(:first-child){margin-left:1rem}\n"], directives: [{ type: i1$1.CdkPortalOutlet, selector: "[cdkPortalOutlet]", inputs: ["cdkPortalOutlet"], outputs: ["attached"], exportAs: ["cdkPortalOutlet"] }], animations: [XMoveBoxAnimation], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
500
+ /** @nocollapse */ /** @nocollapse */ XDialogPortalComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: XDialogPortalComponent, deps: [{ token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Component });
501
+ /** @nocollapse */ /** @nocollapse */ XDialogPortalComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.2", type: XDialogPortalComponent, selector: "x-dialog-portal", host: { listeners: { "@x-move-box-animation.done": "done($event)", "@x-move-box-animation.start": "start($event)" }, properties: { "@x-move-box-animation": "this.placement" } }, queries: [{ propertyName: "handles", predicate: CdkDragHandle, descendants: true }], viewQueries: [{ propertyName: "portalOutlet", first: true, predicate: CdkPortalOutlet, descendants: true, static: true }, { propertyName: "dragRef", first: true, predicate: CdkDrag, descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: "<div\r\n class=\"x-dialog-portal\"\r\n #dragRef\r\n cdkDrag\r\n [cdkDragDisabled]=\"!option.draggable && !dialogBox['draggable']\"\r\n [cdkDragBoundary]=\"'.cdk-overlay-container'\"\r\n [cdkDragFreeDragPosition]=\"dialogBox['distance']\"\r\n [xResizable]=\"option.resizable && dialogBox['resizable']!\"\r\n (resizing)=\"resizing($event)\"\r\n (cdkDragEnded)=\"onDragEnded($event)\"\r\n [offsetLeft]=\"offsetLeft\"\r\n [offsetTop]=\"offsetTop\"\r\n [style.minWidth]=\"dialogBox['minWidth']\"\r\n [style.minHeight]=\"dialogBox['minHeight']\"\r\n>\r\n <ng-template cdkPortalOutlet></ng-template>\r\n</div>\r\n", styles: [".x-dialog-portal{margin:0;padding:0;width:100%;height:100%;display:block;padding:1rem;box-sizing:border-box;min-height:inherit;max-height:inherit;background-color:var(--x-background);box-shadow:var(--x-box-shadow) var(--x-box-shadow-light-color);border:.0625rem solid transparent;border-radius:var(--x-border-radius)}.x-dialog-portal-title{font-weight:600;color:var(--x-text-300);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;height:3rem;line-height:3rem;display:block;align-items:center;margin:-1rem -1rem 0;padding:0 1rem}.x-dialog-portal-content{display:block;margin:0 -1rem;padding:0 1rem;max-height:70vh;overflow:auto;color:var(--x-text-300);font-size:calc(var(--x-font-size) - .0625rem);line-height:1.325rem}.x-dialog-portal-actions{display:flex;align-items:center;justify-content:flex-end;flex-wrap:wrap;box-sizing:content-box;margin:0 -1rem -1rem;padding:0 1rem;height:4rem}.x-dialog-portal-actions[align=center]{justify-content:center}.x-dialog-portal-actions[align=start]{justify-content:flex-start}.x-dialog-portal-actions x-button:not(:first-child){margin-left:1rem}.x-dialog-portal-drag-handle{cursor:move}.x-dialog-portal-fullscreen{margin:0!important}.x-dialog-portal-fullscreen .x-dialog-portal{left:0!important;top:0!important}.x-dialog-portal-fullscreen .x-dialog-portal-content{max-height:calc(100vh - 7rem)!important;height:calc(100vh - 7rem)!important}x-dialog-portal{width:100%;height:100%}\n"], directives: [{ type: i1$1.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { type: i2$1.XResizableDirective, selector: "[xResizable]" }, { type: i3$1.CdkPortalOutlet, selector: "[cdkPortalOutlet]", inputs: ["cdkPortalOutlet"], outputs: ["attached"], exportAs: ["cdkPortalOutlet"] }], animations: [XMoveBoxAnimation], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
460
502
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: XDialogPortalComponent, decorators: [{
461
503
  type: Component,
462
- args: [{ selector: 'x-dialog-portal', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, animations: [XMoveBoxAnimation], template: "<ng-template cdkPortalOutlet></ng-template>\r\n", styles: [".x-dialog-portal{margin:0;padding:0;width:100%;height:100%;overflow:auto;display:block;padding:1rem;box-sizing:border-box;min-height:inherit;max-height:inherit;background-color:var(--x-background);box-shadow:var(--x-box-shadow) var(--x-box-shadow-light-color);border:.0625rem solid transparent;border-radius:var(--x-border-radius)}.x-dialog-portal-title{display:block;margin:0 0 .5rem;font-weight:600;color:var(--x-text-300);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.x-dialog-portal-content{display:block;margin:0 -1rem;padding:0 1rem;max-height:70vh;overflow:auto;color:var(--x-text-300);font-size:calc(var(--x-font-size) - .0625rem);line-height:1.325rem}.x-dialog-portal-actions{display:flex;align-items:center;justify-content:flex-end;flex-wrap:wrap;box-sizing:content-box;margin-bottom:-1rem;min-height:4rem}.x-dialog-portal-actions[align=center]{justify-content:center}.x-dialog-portal-actions[align=start]{justify-content:flex-start}.x-dialog-portal-actions x-button:not(:first-child){margin-left:1rem}\n"] }]
463
- }], ctorParameters: function () { return []; }, propDecorators: { _has: [{
464
- type: HostBinding,
465
- args: ['class.x-dialog-portal']
466
- }], placement: [{
504
+ args: [{ selector: 'x-dialog-portal', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, animations: [XMoveBoxAnimation], template: "<div\r\n class=\"x-dialog-portal\"\r\n #dragRef\r\n cdkDrag\r\n [cdkDragDisabled]=\"!option.draggable && !dialogBox['draggable']\"\r\n [cdkDragBoundary]=\"'.cdk-overlay-container'\"\r\n [cdkDragFreeDragPosition]=\"dialogBox['distance']\"\r\n [xResizable]=\"option.resizable && dialogBox['resizable']!\"\r\n (resizing)=\"resizing($event)\"\r\n (cdkDragEnded)=\"onDragEnded($event)\"\r\n [offsetLeft]=\"offsetLeft\"\r\n [offsetTop]=\"offsetTop\"\r\n [style.minWidth]=\"dialogBox['minWidth']\"\r\n [style.minHeight]=\"dialogBox['minHeight']\"\r\n>\r\n <ng-template cdkPortalOutlet></ng-template>\r\n</div>\r\n", styles: [".x-dialog-portal{margin:0;padding:0;width:100%;height:100%;display:block;padding:1rem;box-sizing:border-box;min-height:inherit;max-height:inherit;background-color:var(--x-background);box-shadow:var(--x-box-shadow) var(--x-box-shadow-light-color);border:.0625rem solid transparent;border-radius:var(--x-border-radius)}.x-dialog-portal-title{font-weight:600;color:var(--x-text-300);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;height:3rem;line-height:3rem;display:block;align-items:center;margin:-1rem -1rem 0;padding:0 1rem}.x-dialog-portal-content{display:block;margin:0 -1rem;padding:0 1rem;max-height:70vh;overflow:auto;color:var(--x-text-300);font-size:calc(var(--x-font-size) - .0625rem);line-height:1.325rem}.x-dialog-portal-actions{display:flex;align-items:center;justify-content:flex-end;flex-wrap:wrap;box-sizing:content-box;margin:0 -1rem -1rem;padding:0 1rem;height:4rem}.x-dialog-portal-actions[align=center]{justify-content:center}.x-dialog-portal-actions[align=start]{justify-content:flex-start}.x-dialog-portal-actions x-button:not(:first-child){margin-left:1rem}.x-dialog-portal-drag-handle{cursor:move}.x-dialog-portal-fullscreen{margin:0!important}.x-dialog-portal-fullscreen .x-dialog-portal{left:0!important;top:0!important}.x-dialog-portal-fullscreen .x-dialog-portal-content{max-height:calc(100vh - 7rem)!important;height:calc(100vh - 7rem)!important}x-dialog-portal{width:100%;height:100%}\n"] }]
505
+ }], ctorParameters: function () { return [{ type: i0.Renderer2 }]; }, propDecorators: { placement: [{
467
506
  type: HostBinding,
468
507
  args: ['@x-move-box-animation']
469
508
  }], done: [{
@@ -475,13 +514,24 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
475
514
  }], portalOutlet: [{
476
515
  type: ViewChild,
477
516
  args: [CdkPortalOutlet, { static: true }]
517
+ }], dragRef: [{
518
+ type: ViewChild,
519
+ args: [CdkDrag, { static: true }]
520
+ }], handles: [{
521
+ type: ContentChildren,
522
+ args: [CdkDragHandle, { descendants: true }]
478
523
  }] } });
479
524
 
480
525
  // TODO: add more function
481
526
  class XDialogRef {
482
- constructor(overlayRef, containerInstance) {
527
+ constructor(overlayRef, containerInstance, renderer, portalService) {
483
528
  this.overlayRef = overlayRef;
484
529
  this.containerInstance = containerInstance;
530
+ this.renderer = renderer;
531
+ this.portalService = portalService;
532
+ this.fullscreen = false;
533
+ this.dragHandleRefs = [];
534
+ this._isFristFullscreen = true;
485
535
  }
486
536
  close() {
487
537
  this.containerInstance.animationChanged
@@ -491,6 +541,81 @@ class XDialogRef {
491
541
  });
492
542
  this.containerInstance.placement = 'void';
493
543
  }
544
+ onFullscreen() {
545
+ let { dialogBox, dialogRef, overlayElement, distance, hostElement, defaultMaximize } = this.containerInstance;
546
+ if (!dialogRef.fullscreen) {
547
+ dialogRef.overlayRef.updateSize({
548
+ width: '100%',
549
+ height: '100%',
550
+ minWidth: '100%',
551
+ minHeight: '100%'
552
+ });
553
+ dialogRef.fullscreen = true;
554
+ dialogBox['minWidth'] = '100%';
555
+ dialogBox['minHeight'] = '100%';
556
+ dialogBox['draggable'] = false;
557
+ dialogBox['resizable'] = false;
558
+ if (this.option.resizable) {
559
+ this.renderer.setStyle(overlayElement, 'margin', '0 0 0 0');
560
+ }
561
+ if (this.option.draggable) {
562
+ dialogBox['distance'] = { x: 0, y: 0 };
563
+ }
564
+ this.renderer.addClass(overlayElement, 'x-dialog-portal-fullscreen');
565
+ }
566
+ else {
567
+ dialogBox['minWidth'] = this.option.minWidth;
568
+ dialogBox['minHeight'] = this.option.minHeight;
569
+ if (this._isFristFullscreen && defaultMaximize) {
570
+ this.option.draggable = dialogBox['draggable'];
571
+ this.option.resizable = dialogBox['resizable'];
572
+ }
573
+ else {
574
+ dialogBox['draggable'] = this.option.draggable;
575
+ dialogBox['resizable'] = this.option.resizable;
576
+ }
577
+ dialogRef.overlayRef?.updateSize({
578
+ width: dialogBox['width'],
579
+ height: dialogBox['height'],
580
+ minWidth: dialogBox['minWidth'],
581
+ minHeight: dialogBox['minHeight']
582
+ });
583
+ dialogRef.fullscreen = false;
584
+ if (this.option.draggable) {
585
+ dialogBox['distance'] = { ...distance };
586
+ }
587
+ if (this.option.resizable) {
588
+ if (dialogBox['marginTop']) {
589
+ this.renderer.setStyle(overlayElement, 'margin-top', `${dialogBox['marginTop']}`);
590
+ }
591
+ if (dialogBox['marginLeft']) {
592
+ this.renderer.setStyle(overlayElement, 'margin-left', `${dialogBox['marginLeft']}`);
593
+ }
594
+ if (dialogBox['marginRight']) {
595
+ this.renderer.setStyle(overlayElement, 'margin-right', `${dialogBox['marginRight']}`);
596
+ }
597
+ if (dialogBox['marginBottom']) {
598
+ this.renderer.setStyle(overlayElement, 'margin-bottom', `${dialogBox['marginBottom']}`);
599
+ }
600
+ }
601
+ this.renderer.removeClass(overlayElement, 'x-dialog-portal-fullscreen');
602
+ if (this._isFristFullscreen && defaultMaximize) {
603
+ dialogRef.overlayRef?.updatePositionStrategy(this.portalService.setPlace(this.option.placement, this.option.offset));
604
+ this.renderer.addClass(hostElement, PortalResizablePrefix);
605
+ setTimeout(() => {
606
+ Object.assign(dialogBox, this.portalService.setResizable(overlayElement, this.option.placement));
607
+ this.containerInstance.offsetLeft = overlayElement.offsetLeft;
608
+ this.containerInstance.offsetTop = overlayElement.offsetTop;
609
+ const dialogDraggable = overlayElement?.querySelector('.x-dialog-portal');
610
+ this.containerInstance.initHeight = dialogDraggable.clientHeight;
611
+ this.containerInstance.dialogContent = overlayElement?.querySelector('.x-dialog-portal-content');
612
+ this.containerInstance.initContentHeight = this.containerInstance.dialogContent?.clientHeight;
613
+ this.containerInstance.dialogBox = dialogBox;
614
+ });
615
+ }
616
+ }
617
+ this._isFristFullscreen = false;
618
+ }
494
619
  }
495
620
 
496
621
  class XDialogCloseDirective {
@@ -561,6 +686,52 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
561
686
  }], propDecorators: { _has: [{
562
687
  type: HostBinding,
563
688
  args: ['class.x-dialog-portal-actions']
689
+ }] } });
690
+ class XDialogDragHandleDirective {
691
+ constructor(dialogRef, elementRef) {
692
+ this.dialogRef = dialogRef;
693
+ this.elementRef = elementRef;
694
+ }
695
+ get getDraggable() {
696
+ return !this.dialogRef.fullscreen && this.dialogRef.option.draggable;
697
+ }
698
+ ngOnInit() {
699
+ this.dialogRef.dragHandleRefs.push(this.elementRef);
700
+ }
701
+ }
702
+ /** @nocollapse */ /** @nocollapse */ XDialogDragHandleDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: XDialogDragHandleDirective, deps: [{ token: XDialogRef, optional: true }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
703
+ /** @nocollapse */ /** @nocollapse */ XDialogDragHandleDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.2", type: XDialogDragHandleDirective, selector: "[x-dialog-drag-handle], x-dialog-drag-handle", host: { properties: { "class.x-dialog-portal-drag-handle": "this.getDraggable" } }, ngImport: i0 });
704
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: XDialogDragHandleDirective, decorators: [{
705
+ type: Directive,
706
+ args: [{
707
+ selector: `[x-dialog-drag-handle], x-dialog-drag-handle`
708
+ }]
709
+ }], ctorParameters: function () { return [{ type: XDialogRef, decorators: [{
710
+ type: Optional
711
+ }] }, { type: i0.ElementRef }]; }, propDecorators: { getDraggable: [{
712
+ type: HostBinding,
713
+ args: ['class.x-dialog-portal-drag-handle']
714
+ }] } });
715
+ class XDialogFullscreenDirective {
716
+ constructor(dialogRef) {
717
+ this.dialogRef = dialogRef;
718
+ }
719
+ onFullscreenClick() {
720
+ this.dialogRef && this.dialogRef.onFullscreen();
721
+ }
722
+ }
723
+ /** @nocollapse */ /** @nocollapse */ XDialogFullscreenDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: XDialogFullscreenDirective, deps: [{ token: XDialogRef, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
724
+ /** @nocollapse */ /** @nocollapse */ XDialogFullscreenDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.2", type: XDialogFullscreenDirective, selector: "[x-dialog-fullscreen], x-dialog-fullscreen", host: { listeners: { "click": "onFullscreenClick($event)" } }, ngImport: i0 });
725
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: XDialogFullscreenDirective, decorators: [{
726
+ type: Directive,
727
+ args: [{
728
+ selector: `[x-dialog-fullscreen], x-dialog-fullscreen`
729
+ }]
730
+ }], ctorParameters: function () { return [{ type: XDialogRef, decorators: [{
731
+ type: Optional
732
+ }] }]; }, propDecorators: { onFullscreenClick: [{
733
+ type: HostListener,
734
+ args: ['click', ['$event']]
564
735
  }] } });
565
736
 
566
737
  class XDialogService {
@@ -573,10 +744,12 @@ class XDialogService {
573
744
  placement: 'center',
574
745
  offset: '1rem',
575
746
  width: '32rem',
747
+ minWidth: '18rem',
748
+ minHeight: '8rem',
576
749
  backdropClose: true,
577
- hasBackdrop: true
578
- // draggable: false,
579
- // resizable: false
750
+ hasBackdrop: true,
751
+ draggable: false,
752
+ resizable: false
580
753
  };
581
754
  this.renderer = this.rendererFactory.createRenderer(null, null);
582
755
  this.configDefault = this.configService.getConfigForComponent(X_DIALOG_CONFIG_NAME);
@@ -593,16 +766,51 @@ class XDialogService {
593
766
  scrollStrategy: this.overlay.scrollStrategies.block(),
594
767
  width: option.width,
595
768
  height: option.height,
769
+ minWidth: option.minWidth,
770
+ minHeight: option.minHeight,
596
771
  positionStrategy: this.portalService.setPlace(option.placement, option.offset)
597
772
  }
598
773
  });
599
- // if (option.resizable) {
600
- // this.renderer.addClass(portal.overlayRef?.hostElement, PortalResizablePrefix);
601
- // }
602
774
  const { overlayRef, componentRef } = portal || {};
603
775
  const { instance } = componentRef || {};
776
+ const { hostElement, overlayElement } = overlayRef || {};
777
+ const dialogRef = new XDialogRef(overlayRef, instance, this.renderer, this.portalService);
778
+ let dialogBox = {
779
+ draggable: option.draggable,
780
+ resizable: option.resizable
781
+ };
782
+ let defaultMaximize = this.setMaximize(option);
783
+ Object.assign(dialogBox, {
784
+ width: defaultMaximize ? this.default.width : option.width,
785
+ height: defaultMaximize ? null : option.height,
786
+ minWidth: option.minWidth,
787
+ minHeight: option.minHeight
788
+ });
604
789
  instance.placement = option.placement;
605
- const dialogRef = new XDialogRef(overlayRef, instance);
790
+ instance.option = option;
791
+ instance.dialogRef = dialogRef;
792
+ instance.defaultMaximize = defaultMaximize;
793
+ instance.dialogBox = dialogBox;
794
+ instance.hostElement = hostElement;
795
+ instance.overlayElement = overlayElement;
796
+ dialogRef.option = option;
797
+ dialogRef.fullscreen = defaultMaximize;
798
+ if (option.resizable && !defaultMaximize) {
799
+ this.renderer.addClass(hostElement, PortalResizablePrefix);
800
+ setTimeout(() => {
801
+ Object.assign(dialogBox, this.portalService.setResizable(overlayElement, option.placement));
802
+ instance.offsetLeft = overlayElement.offsetLeft;
803
+ instance.offsetTop = overlayElement.offsetTop;
804
+ const dialogDraggable = overlayElement?.querySelector('.x-dialog-portal');
805
+ instance.initHeight = dialogDraggable.clientHeight;
806
+ instance.dialogContent = overlayElement?.querySelector('.x-dialog-portal-content');
807
+ instance.initContentHeight = instance.dialogContent?.clientHeight;
808
+ instance.dialogBox = dialogBox;
809
+ });
810
+ }
811
+ if (defaultMaximize) {
812
+ this.renderer.addClass(overlayElement, 'x-dialog-portal-fullscreen');
813
+ }
606
814
  if (content instanceof TemplateRef) {
607
815
  instance.attachTemplatePortal(new TemplatePortal(content, option.viewContainerRef, { $implicit: option.data, dialogRef: dialogRef }));
608
816
  }
@@ -621,12 +829,22 @@ class XDialogService {
621
829
  }
622
830
  return dialogRef;
623
831
  }
832
+ setMaximize(option = {}) {
833
+ const ws = ['100%', '100vw'];
834
+ const hs = ['100%', '100vh'];
835
+ if (ws.includes(option.width) && hs.includes(option.height)) {
836
+ option.resizable = false;
837
+ option.draggable = false;
838
+ return true;
839
+ }
840
+ return false;
841
+ }
624
842
  }
625
- /** @nocollapse */ /** @nocollapse */ XDialogService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: XDialogService, deps: [{ token: i1.XPortalService }, { token: i2$1.XConfigService }, { token: i2.Overlay }, { token: i0.RendererFactory2 }], target: i0.ɵɵFactoryTarget.Injectable });
843
+ /** @nocollapse */ /** @nocollapse */ XDialogService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: XDialogService, deps: [{ token: i1.XPortalService }, { token: i2$2.XConfigService }, { token: i2.Overlay }, { token: i0.RendererFactory2 }], target: i0.ɵɵFactoryTarget.Injectable });
626
844
  /** @nocollapse */ /** @nocollapse */ XDialogService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: XDialogService });
627
845
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: XDialogService, decorators: [{
628
846
  type: Injectable
629
- }], ctorParameters: function () { return [{ type: i1.XPortalService }, { type: i2$1.XConfigService }, { type: i2.Overlay }, { type: i0.RendererFactory2 }]; } });
847
+ }], ctorParameters: function () { return [{ type: i1.XPortalService }, { type: i2$2.XConfigService }, { type: i2.Overlay }, { type: i0.RendererFactory2 }]; } });
630
848
 
631
849
  class XDialogModule {
632
850
  }
@@ -636,6 +854,8 @@ class XDialogModule {
636
854
  XDialogTitleDirective,
637
855
  XDialogContentDirective,
638
856
  XDialogActionsDirective,
857
+ XDialogDragHandleDirective,
858
+ XDialogFullscreenDirective,
639
859
  XDialogPortalComponent,
640
860
  XDialogProperty], imports: [CommonModule,
641
861
  FormsModule,
@@ -652,6 +872,8 @@ class XDialogModule {
652
872
  XDialogTitleDirective,
653
873
  XDialogContentDirective,
654
874
  XDialogActionsDirective,
875
+ XDialogDragHandleDirective,
876
+ XDialogFullscreenDirective,
655
877
  XDialogPortalComponent] });
656
878
  /** @nocollapse */ /** @nocollapse */ XDialogModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: XDialogModule, providers: [XDialogService], imports: [[
657
879
  CommonModule,
@@ -675,6 +897,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
675
897
  XDialogTitleDirective,
676
898
  XDialogContentDirective,
677
899
  XDialogActionsDirective,
900
+ XDialogDragHandleDirective,
901
+ XDialogFullscreenDirective,
678
902
  XDialogPortalComponent,
679
903
  XDialogProperty
680
904
  ],
@@ -684,6 +908,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
684
908
  XDialogTitleDirective,
685
909
  XDialogContentDirective,
686
910
  XDialogActionsDirective,
911
+ XDialogDragHandleDirective,
912
+ XDialogFullscreenDirective,
687
913
  XDialogPortalComponent
688
914
  ],
689
915
  imports: [
@@ -707,5 +933,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
707
933
  * Generated bundle index. Do not edit.
708
934
  */
709
935
 
710
- export { XDialogActionsDirective, XDialogCloseDirective, XDialogComponent, XDialogContainer, XDialogContentDirective, XDialogModule, XDialogPortalComponent, XDialogPrefix, XDialogProperty, XDialogRef, XDialogService, XDialogTitleDirective, X_DIALOG_CONFIG_NAME, X_DIALOG_DATA };
936
+ export { XDialogActionsDirective, XDialogCloseDirective, XDialogComponent, XDialogContainer, XDialogContentDirective, XDialogDragHandleDirective, XDialogFullscreenDirective, XDialogModule, XDialogPortalComponent, XDialogPrefix, XDialogProperty, XDialogRef, XDialogService, XDialogTitleDirective, X_DIALOG_CONFIG_NAME, X_DIALOG_DATA };
711
937
  //# sourceMappingURL=ng-nest-ui-dialog.mjs.map