@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
  }
@@ -254,8 +264,7 @@ class XDialogComponent extends XDialogProperty {
254
264
  this.create();
255
265
  }
256
266
  else {
257
- this.detach();
258
- // this.visibleChange.emit(false);
267
+ this.onClose('close', false);
259
268
  }
260
269
  }
261
270
  create() {
@@ -297,7 +306,7 @@ class XDialogComponent extends XDialogProperty {
297
306
  });
298
307
  }
299
308
  if (this.hasBackdrop && this.backdropClose && ((_a = this.dialogRef) === null || _a === void 0 ? void 0 : _a.overlayRef)) {
300
- this.backdropClick$ = this.dialogRef.overlayRef.backdropClick().subscribe(() => this.onClose());
309
+ this.backdropClick$ = this.dialogRef.overlayRef.backdropClick().subscribe(() => this.onClose('close'));
301
310
  }
302
311
  }
303
312
  setWidthHeight() {
@@ -310,26 +319,31 @@ class XDialogComponent extends XDialogProperty {
310
319
  this.maximize = false;
311
320
  }
312
321
  }
313
- detach() {
314
- var _a, _b;
315
- if (this.portalAttached()) {
316
- this.visible = false;
317
- this.visibleChange.emit(this.visible);
318
- (_b = (_a = this.dialogRef) === null || _a === void 0 ? void 0 : _a.overlayRef) === null || _b === void 0 ? void 0 : _b.detach();
319
- this.unsubscribe();
320
- this.close.emit();
321
- }
322
- }
323
322
  portalAttached() {
324
323
  var _a, _b;
325
324
  return (_b = (_a = this.dialogRef) === null || _a === void 0 ? void 0 : _a.overlayRef) === null || _b === void 0 ? void 0 : _b.hasAttached();
326
325
  }
327
- onClose() {
328
- if (XIsFunction(this.beforeClose)) {
329
- this.beforeClose();
326
+ onClose(action, execFunction = true) {
327
+ var _a, _b;
328
+ if (!this.portalAttached())
329
+ return;
330
+ if (XIsFunction(this.beforeClose) && execFunction) {
331
+ this.beforeClose(action);
332
+ this.action = action;
330
333
  }
331
334
  else {
332
- this.detach();
335
+ this.visible = false;
336
+ this.visibleChange.emit(this.visible);
337
+ (_b = (_a = this.dialogRef) === null || _a === void 0 ? void 0 : _a.overlayRef) === null || _b === void 0 ? void 0 : _b.detach();
338
+ this.unsubscribe();
339
+ if ([action, this.action].includes('confirm')) {
340
+ this.confirm.emit();
341
+ }
342
+ if ([action, this.action].includes('cancel')) {
343
+ this.cancel.emit();
344
+ }
345
+ this.action = null;
346
+ this.close.emit();
333
347
  }
334
348
  }
335
349
  onDragEnded($event) {
@@ -395,14 +409,6 @@ class XDialogComponent extends XDialogProperty {
395
409
  }
396
410
  }
397
411
  }
398
- onCancel() {
399
- this.onClose();
400
- this.cancel.emit();
401
- }
402
- onConfirm() {
403
- this.onClose();
404
- this.confirm.emit();
405
- }
406
412
  moveDone($event) {
407
413
  var _a, _b;
408
414
  if ($event.toState === 'void') {
@@ -429,20 +435,29 @@ class XDialogComponent extends XDialogProperty {
429
435
  }
430
436
  }
431
437
  /** @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 });
432
- /** @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 });
438
+ /** @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 });
433
439
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: XDialogComponent, decorators: [{
434
440
  type: Component,
435
- 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"] }]
441
+ 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"] }]
436
442
  }], 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: [{
437
443
  type: ViewChild,
438
444
  args: ['dialogTpl', { static: false }]
439
445
  }] } });
440
446
 
441
447
  class XDialogPortalComponent extends BasePortalOutlet {
442
- constructor() {
448
+ constructor(renderer) {
443
449
  super();
444
- this._has = true;
450
+ this.renderer = renderer;
445
451
  this.animationChanged = new EventEmitter();
452
+ this.offsetLeft = 0;
453
+ this.offsetTop = 0;
454
+ this.minWidth = '0rem';
455
+ this.minHeight = '0rem';
456
+ this.initHeight = 0;
457
+ this.initContentHeight = 0;
458
+ this.defaultMaximize = false;
459
+ this.distance = { x: 0, y: 0 };
460
+ this.dialogBox = {};
446
461
  }
447
462
  done({ toState, totalTime }) {
448
463
  this.animationChanged.next({ action: 'done', state: toState, totalTime });
@@ -450,6 +465,22 @@ class XDialogPortalComponent extends BasePortalOutlet {
450
465
  start({ toState, totalTime }) {
451
466
  this.animationChanged.next({ action: 'start', state: toState, totalTime });
452
467
  }
468
+ ngOnInit() {
469
+ this.dialogBox['draggable'] = this.defaultMaximize ? this.dialogBox['draggable'] : this.option.draggable;
470
+ this.dialogBox['resizable'] = this.defaultMaximize ? this.dialogBox['resizable'] : this.option.resizable;
471
+ }
472
+ ngAfterViewInit() {
473
+ let list = new QueryList();
474
+ if (this.dialogRef.dragHandleRefs.length === 0) {
475
+ this.dialogBox['draggable'] = false;
476
+ this.option.draggable = false;
477
+ return;
478
+ }
479
+ for (let item of this.dialogRef.dragHandleRefs) {
480
+ list.reset([...list.toArray(), new CdkDragHandle(item, this.dragRef)]);
481
+ }
482
+ this.dragRef._handles = list;
483
+ }
453
484
  attachComponentPortal(portal) {
454
485
  if (this.portalOutlet.hasAttached()) {
455
486
  throw Error('dialog portal has attached');
@@ -462,16 +493,24 @@ class XDialogPortalComponent extends BasePortalOutlet {
462
493
  }
463
494
  return this.portalOutlet.attachTemplatePortal(portal);
464
495
  }
496
+ resizing(event) {
497
+ const contentHeight = Number(this.initContentHeight) + Number(event.clientHeight) - Number(this.initHeight);
498
+ this.renderer.setStyle(this.dialogContent, 'max-height', 'initial');
499
+ this.renderer.setStyle(this.dialogContent, 'flex', 'initial');
500
+ if (['top-start', 'top-end', 'bottom', 'top', 'bottom-start', 'bottom-end'].includes(event.direction)) {
501
+ this.renderer.setStyle(this.dialogContent, 'height', `${contentHeight}px`);
502
+ }
503
+ }
504
+ onDragEnded(event) {
505
+ this.distance = { x: this.distance.x + event.distance.x, y: this.distance.y + event.distance.y };
506
+ }
465
507
  }
466
- /** @nocollapse */ /** @nocollapse */ XDialogPortalComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: XDialogPortalComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
467
- /** @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 });
508
+ /** @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 });
509
+ /** @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 });
468
510
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: XDialogPortalComponent, decorators: [{
469
511
  type: Component,
470
- 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"] }]
471
- }], ctorParameters: function () { return []; }, propDecorators: { _has: [{
472
- type: HostBinding,
473
- args: ['class.x-dialog-portal']
474
- }], placement: [{
512
+ 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"] }]
513
+ }], ctorParameters: function () { return [{ type: i0.Renderer2 }]; }, propDecorators: { placement: [{
475
514
  type: HostBinding,
476
515
  args: ['@x-move-box-animation']
477
516
  }], done: [{
@@ -483,13 +522,24 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
483
522
  }], portalOutlet: [{
484
523
  type: ViewChild,
485
524
  args: [CdkPortalOutlet, { static: true }]
525
+ }], dragRef: [{
526
+ type: ViewChild,
527
+ args: [CdkDrag, { static: true }]
528
+ }], handles: [{
529
+ type: ContentChildren,
530
+ args: [CdkDragHandle, { descendants: true }]
486
531
  }] } });
487
532
 
488
533
  // TODO: add more function
489
534
  class XDialogRef {
490
- constructor(overlayRef, containerInstance) {
535
+ constructor(overlayRef, containerInstance, renderer, portalService) {
491
536
  this.overlayRef = overlayRef;
492
537
  this.containerInstance = containerInstance;
538
+ this.renderer = renderer;
539
+ this.portalService = portalService;
540
+ this.fullscreen = false;
541
+ this.dragHandleRefs = [];
542
+ this._isFristFullscreen = true;
493
543
  }
494
544
  close() {
495
545
  this.containerInstance.animationChanged
@@ -499,6 +549,83 @@ class XDialogRef {
499
549
  });
500
550
  this.containerInstance.placement = 'void';
501
551
  }
552
+ onFullscreen() {
553
+ var _a, _b;
554
+ let { dialogBox, dialogRef, overlayElement, distance, hostElement, defaultMaximize } = this.containerInstance;
555
+ if (!dialogRef.fullscreen) {
556
+ dialogRef.overlayRef.updateSize({
557
+ width: '100%',
558
+ height: '100%',
559
+ minWidth: '100%',
560
+ minHeight: '100%'
561
+ });
562
+ dialogRef.fullscreen = true;
563
+ dialogBox['minWidth'] = '100%';
564
+ dialogBox['minHeight'] = '100%';
565
+ dialogBox['draggable'] = false;
566
+ dialogBox['resizable'] = false;
567
+ if (this.option.resizable) {
568
+ this.renderer.setStyle(overlayElement, 'margin', '0 0 0 0');
569
+ }
570
+ if (this.option.draggable) {
571
+ dialogBox['distance'] = { x: 0, y: 0 };
572
+ }
573
+ this.renderer.addClass(overlayElement, 'x-dialog-portal-fullscreen');
574
+ }
575
+ else {
576
+ dialogBox['minWidth'] = this.option.minWidth;
577
+ dialogBox['minHeight'] = this.option.minHeight;
578
+ if (this._isFristFullscreen && defaultMaximize) {
579
+ this.option.draggable = dialogBox['draggable'];
580
+ this.option.resizable = dialogBox['resizable'];
581
+ }
582
+ else {
583
+ dialogBox['draggable'] = this.option.draggable;
584
+ dialogBox['resizable'] = this.option.resizable;
585
+ }
586
+ (_a = dialogRef.overlayRef) === null || _a === void 0 ? void 0 : _a.updateSize({
587
+ width: dialogBox['width'],
588
+ height: dialogBox['height'],
589
+ minWidth: dialogBox['minWidth'],
590
+ minHeight: dialogBox['minHeight']
591
+ });
592
+ dialogRef.fullscreen = false;
593
+ if (this.option.draggable) {
594
+ dialogBox['distance'] = Object.assign({}, distance);
595
+ }
596
+ if (this.option.resizable) {
597
+ if (dialogBox['marginTop']) {
598
+ this.renderer.setStyle(overlayElement, 'margin-top', `${dialogBox['marginTop']}`);
599
+ }
600
+ if (dialogBox['marginLeft']) {
601
+ this.renderer.setStyle(overlayElement, 'margin-left', `${dialogBox['marginLeft']}`);
602
+ }
603
+ if (dialogBox['marginRight']) {
604
+ this.renderer.setStyle(overlayElement, 'margin-right', `${dialogBox['marginRight']}`);
605
+ }
606
+ if (dialogBox['marginBottom']) {
607
+ this.renderer.setStyle(overlayElement, 'margin-bottom', `${dialogBox['marginBottom']}`);
608
+ }
609
+ }
610
+ this.renderer.removeClass(overlayElement, 'x-dialog-portal-fullscreen');
611
+ if (this._isFristFullscreen && defaultMaximize) {
612
+ (_b = dialogRef.overlayRef) === null || _b === void 0 ? void 0 : _b.updatePositionStrategy(this.portalService.setPlace(this.option.placement, this.option.offset));
613
+ this.renderer.addClass(hostElement, PortalResizablePrefix);
614
+ setTimeout(() => {
615
+ var _a;
616
+ Object.assign(dialogBox, this.portalService.setResizable(overlayElement, this.option.placement));
617
+ this.containerInstance.offsetLeft = overlayElement.offsetLeft;
618
+ this.containerInstance.offsetTop = overlayElement.offsetTop;
619
+ const dialogDraggable = overlayElement === null || overlayElement === void 0 ? void 0 : overlayElement.querySelector('.x-dialog-portal');
620
+ this.containerInstance.initHeight = dialogDraggable.clientHeight;
621
+ this.containerInstance.dialogContent = overlayElement === null || overlayElement === void 0 ? void 0 : overlayElement.querySelector('.x-dialog-portal-content');
622
+ this.containerInstance.initContentHeight = (_a = this.containerInstance.dialogContent) === null || _a === void 0 ? void 0 : _a.clientHeight;
623
+ this.containerInstance.dialogBox = dialogBox;
624
+ });
625
+ }
626
+ }
627
+ this._isFristFullscreen = false;
628
+ }
502
629
  }
503
630
 
504
631
  class XDialogCloseDirective {
@@ -571,6 +698,56 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
571
698
  }], propDecorators: { _has: [{
572
699
  type: HostBinding,
573
700
  args: ['class.x-dialog-portal-actions']
701
+ }] } });
702
+ class XDialogDragHandleDirective {
703
+ constructor(dialogRef, elementRef) {
704
+ this.dialogRef = dialogRef;
705
+ this.elementRef = elementRef;
706
+ }
707
+ get getDraggable() {
708
+ return !this.dialogRef.fullscreen && this.dialogRef.option.draggable;
709
+ }
710
+ ngOnInit() {
711
+ this.dialogRef.dragHandleRefs.push(this.elementRef);
712
+ }
713
+ }
714
+ /** @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 });
715
+ /** @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 });
716
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: XDialogDragHandleDirective, decorators: [{
717
+ type: Directive,
718
+ args: [{
719
+ selector: `[x-dialog-drag-handle], x-dialog-drag-handle`
720
+ }]
721
+ }], ctorParameters: function () {
722
+ return [{ type: XDialogRef, decorators: [{
723
+ type: Optional
724
+ }] }, { type: i0.ElementRef }];
725
+ }, propDecorators: { getDraggable: [{
726
+ type: HostBinding,
727
+ args: ['class.x-dialog-portal-drag-handle']
728
+ }] } });
729
+ class XDialogFullscreenDirective {
730
+ constructor(dialogRef) {
731
+ this.dialogRef = dialogRef;
732
+ }
733
+ onFullscreenClick() {
734
+ this.dialogRef && this.dialogRef.onFullscreen();
735
+ }
736
+ }
737
+ /** @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 });
738
+ /** @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 });
739
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: XDialogFullscreenDirective, decorators: [{
740
+ type: Directive,
741
+ args: [{
742
+ selector: `[x-dialog-fullscreen], x-dialog-fullscreen`
743
+ }]
744
+ }], ctorParameters: function () {
745
+ return [{ type: XDialogRef, decorators: [{
746
+ type: Optional
747
+ }] }];
748
+ }, propDecorators: { onFullscreenClick: [{
749
+ type: HostListener,
750
+ args: ['click', ['$event']]
574
751
  }] } });
575
752
 
576
753
  class XDialogService {
@@ -583,10 +760,12 @@ class XDialogService {
583
760
  placement: 'center',
584
761
  offset: '1rem',
585
762
  width: '32rem',
763
+ minWidth: '18rem',
764
+ minHeight: '8rem',
586
765
  backdropClose: true,
587
- hasBackdrop: true
588
- // draggable: false,
589
- // resizable: false
766
+ hasBackdrop: true,
767
+ draggable: false,
768
+ resizable: false
590
769
  };
591
770
  this.renderer = this.rendererFactory.createRenderer(null, null);
592
771
  this.configDefault = this.configService.getConfigForComponent(X_DIALOG_CONFIG_NAME);
@@ -603,16 +782,52 @@ class XDialogService {
603
782
  scrollStrategy: this.overlay.scrollStrategies.block(),
604
783
  width: option.width,
605
784
  height: option.height,
785
+ minWidth: option.minWidth,
786
+ minHeight: option.minHeight,
606
787
  positionStrategy: this.portalService.setPlace(option.placement, option.offset)
607
788
  }
608
789
  });
609
- // if (option.resizable) {
610
- // this.renderer.addClass(portal.overlayRef?.hostElement, PortalResizablePrefix);
611
- // }
612
790
  const { overlayRef, componentRef } = portal || {};
613
791
  const { instance } = componentRef || {};
792
+ const { hostElement, overlayElement } = overlayRef || {};
793
+ const dialogRef = new XDialogRef(overlayRef, instance, this.renderer, this.portalService);
794
+ let dialogBox = {
795
+ draggable: option.draggable,
796
+ resizable: option.resizable
797
+ };
798
+ let defaultMaximize = this.setMaximize(option);
799
+ Object.assign(dialogBox, {
800
+ width: defaultMaximize ? this.default.width : option.width,
801
+ height: defaultMaximize ? null : option.height,
802
+ minWidth: option.minWidth,
803
+ minHeight: option.minHeight
804
+ });
614
805
  instance.placement = option.placement;
615
- const dialogRef = new XDialogRef(overlayRef, instance);
806
+ instance.option = option;
807
+ instance.dialogRef = dialogRef;
808
+ instance.defaultMaximize = defaultMaximize;
809
+ instance.dialogBox = dialogBox;
810
+ instance.hostElement = hostElement;
811
+ instance.overlayElement = overlayElement;
812
+ dialogRef.option = option;
813
+ dialogRef.fullscreen = defaultMaximize;
814
+ if (option.resizable && !defaultMaximize) {
815
+ this.renderer.addClass(hostElement, PortalResizablePrefix);
816
+ setTimeout(() => {
817
+ var _a;
818
+ Object.assign(dialogBox, this.portalService.setResizable(overlayElement, option.placement));
819
+ instance.offsetLeft = overlayElement.offsetLeft;
820
+ instance.offsetTop = overlayElement.offsetTop;
821
+ const dialogDraggable = overlayElement === null || overlayElement === void 0 ? void 0 : overlayElement.querySelector('.x-dialog-portal');
822
+ instance.initHeight = dialogDraggable.clientHeight;
823
+ instance.dialogContent = overlayElement === null || overlayElement === void 0 ? void 0 : overlayElement.querySelector('.x-dialog-portal-content');
824
+ instance.initContentHeight = (_a = instance.dialogContent) === null || _a === void 0 ? void 0 : _a.clientHeight;
825
+ instance.dialogBox = dialogBox;
826
+ });
827
+ }
828
+ if (defaultMaximize) {
829
+ this.renderer.addClass(overlayElement, 'x-dialog-portal-fullscreen');
830
+ }
616
831
  if (content instanceof TemplateRef) {
617
832
  instance.attachTemplatePortal(new TemplatePortal(content, option.viewContainerRef, { $implicit: option.data, dialogRef: dialogRef }));
618
833
  }
@@ -631,12 +846,22 @@ class XDialogService {
631
846
  }
632
847
  return dialogRef;
633
848
  }
849
+ setMaximize(option = {}) {
850
+ const ws = ['100%', '100vw'];
851
+ const hs = ['100%', '100vh'];
852
+ if (ws.includes(option.width) && hs.includes(option.height)) {
853
+ option.resizable = false;
854
+ option.draggable = false;
855
+ return true;
856
+ }
857
+ return false;
858
+ }
634
859
  }
635
- /** @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 });
860
+ /** @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 });
636
861
  /** @nocollapse */ /** @nocollapse */ XDialogService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: XDialogService });
637
862
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: XDialogService, decorators: [{
638
863
  type: Injectable
639
- }], ctorParameters: function () { return [{ type: i1.XPortalService }, { type: i2$1.XConfigService }, { type: i2.Overlay }, { type: i0.RendererFactory2 }]; } });
864
+ }], ctorParameters: function () { return [{ type: i1.XPortalService }, { type: i2$2.XConfigService }, { type: i2.Overlay }, { type: i0.RendererFactory2 }]; } });
640
865
 
641
866
  class XDialogModule {
642
867
  }
@@ -646,6 +871,8 @@ class XDialogModule {
646
871
  XDialogTitleDirective,
647
872
  XDialogContentDirective,
648
873
  XDialogActionsDirective,
874
+ XDialogDragHandleDirective,
875
+ XDialogFullscreenDirective,
649
876
  XDialogPortalComponent,
650
877
  XDialogProperty], imports: [CommonModule,
651
878
  FormsModule,
@@ -662,6 +889,8 @@ class XDialogModule {
662
889
  XDialogTitleDirective,
663
890
  XDialogContentDirective,
664
891
  XDialogActionsDirective,
892
+ XDialogDragHandleDirective,
893
+ XDialogFullscreenDirective,
665
894
  XDialogPortalComponent] });
666
895
  /** @nocollapse */ /** @nocollapse */ XDialogModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: XDialogModule, providers: [XDialogService], imports: [[
667
896
  CommonModule,
@@ -685,6 +914,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
685
914
  XDialogTitleDirective,
686
915
  XDialogContentDirective,
687
916
  XDialogActionsDirective,
917
+ XDialogDragHandleDirective,
918
+ XDialogFullscreenDirective,
688
919
  XDialogPortalComponent,
689
920
  XDialogProperty
690
921
  ],
@@ -694,6 +925,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
694
925
  XDialogTitleDirective,
695
926
  XDialogContentDirective,
696
927
  XDialogActionsDirective,
928
+ XDialogDragHandleDirective,
929
+ XDialogFullscreenDirective,
697
930
  XDialogPortalComponent
698
931
  ],
699
932
  imports: [
@@ -717,5 +950,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
717
950
  * Generated bundle index. Do not edit.
718
951
  */
719
952
 
720
- export { XDialogActionsDirective, XDialogCloseDirective, XDialogComponent, XDialogContainer, XDialogContentDirective, XDialogModule, XDialogPortalComponent, XDialogPrefix, XDialogProperty, XDialogRef, XDialogService, XDialogTitleDirective, X_DIALOG_CONFIG_NAME, X_DIALOG_DATA };
953
+ export { XDialogActionsDirective, XDialogCloseDirective, XDialogComponent, XDialogContainer, XDialogContentDirective, XDialogDragHandleDirective, XDialogFullscreenDirective, XDialogModule, XDialogPortalComponent, XDialogPrefix, XDialogProperty, XDialogRef, XDialogService, XDialogTitleDirective, X_DIALOG_CONFIG_NAME, X_DIALOG_DATA };
721
954
  //# sourceMappingURL=ng-nest-ui-dialog.mjs.map