@ng-nest/ui 13.1.3 → 13.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/core/config/config.d.ts +4 -0
- package/dialog/dialog-portal.component.d.ts +33 -5
- package/dialog/dialog-portal.directives.d.ts +17 -0
- package/dialog/dialog-ref.d.ts +11 -1
- package/dialog/dialog.module.d.ts +1 -1
- package/dialog/dialog.property.d.ts +28 -0
- package/dialog/dialog.service.d.ts +1 -0
- package/esm2020/core/config/config.mjs +1 -1
- package/esm2020/dialog/dialog-portal.component.mjs +49 -12
- package/esm2020/dialog/dialog-portal.directives.mjs +47 -1
- package/esm2020/dialog/dialog-ref.mjs +81 -2
- package/esm2020/dialog/dialog.module.mjs +10 -2
- package/esm2020/dialog/dialog.property.mjs +1 -1
- package/esm2020/dialog/dialog.service.mjs +53 -8
- package/esm2020/list/list-option.component.mjs +21 -8
- package/esm2020/list/list.component.mjs +3 -3
- package/esm2020/list/list.property.mjs +13 -3
- package/esm2020/resizable/resizable.directive.mjs +10 -4
- package/fesm2015/ng-nest-ui-core.mjs.map +1 -1
- package/fesm2015/ng-nest-ui-dialog.mjs +244 -25
- package/fesm2015/ng-nest-ui-dialog.mjs.map +1 -1
- package/fesm2015/ng-nest-ui-list.mjs +36 -15
- package/fesm2015/ng-nest-ui-list.mjs.map +1 -1
- package/fesm2015/ng-nest-ui-resizable.mjs +9 -3
- package/fesm2015/ng-nest-ui-resizable.mjs.map +1 -1
- package/fesm2020/ng-nest-ui-core.mjs.map +1 -1
- package/fesm2020/ng-nest-ui-dialog.mjs +237 -25
- package/fesm2020/ng-nest-ui-dialog.mjs.map +1 -1
- package/fesm2020/ng-nest-ui-list.mjs +36 -15
- package/fesm2020/ng-nest-ui-list.mjs.map +1 -1
- package/fesm2020/ng-nest-ui-resizable.mjs +9 -3
- package/fesm2020/ng-nest-ui-resizable.mjs.map +1 -1
- package/list/examples/en_US/default/size/README.md +6 -0
- package/list/examples/zh_CN/default/size/README.md +6 -0
- package/list/list-option.component.d.ts +8 -2
- package/list/list.property.d.ts +13 -3
- package/package.json +1 -1
- package/rate/examples/en_US/default/color/README.md +6 -0
- package/rate/examples/zh_CN/default/color/README.md +6 -0
- package/resizable/resizable.directive.d.ts +3 -1
- 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$
|
|
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
|
|
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
|
|
@@ -439,10 +441,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
|
|
|
439
441
|
}] } });
|
|
440
442
|
|
|
441
443
|
class XDialogPortalComponent extends BasePortalOutlet {
|
|
442
|
-
constructor() {
|
|
444
|
+
constructor(renderer) {
|
|
443
445
|
super();
|
|
444
|
-
this.
|
|
446
|
+
this.renderer = renderer;
|
|
445
447
|
this.animationChanged = new EventEmitter();
|
|
448
|
+
this.offsetLeft = 0;
|
|
449
|
+
this.offsetTop = 0;
|
|
450
|
+
this.minWidth = '0rem';
|
|
451
|
+
this.minHeight = '0rem';
|
|
452
|
+
this.initHeight = 0;
|
|
453
|
+
this.initContentHeight = 0;
|
|
454
|
+
this.defaultMaximize = false;
|
|
455
|
+
this.distance = { x: 0, y: 0 };
|
|
456
|
+
this.dialogBox = {};
|
|
446
457
|
}
|
|
447
458
|
done({ toState, totalTime }) {
|
|
448
459
|
this.animationChanged.next({ action: 'done', state: toState, totalTime });
|
|
@@ -450,6 +461,17 @@ class XDialogPortalComponent extends BasePortalOutlet {
|
|
|
450
461
|
start({ toState, totalTime }) {
|
|
451
462
|
this.animationChanged.next({ action: 'start', state: toState, totalTime });
|
|
452
463
|
}
|
|
464
|
+
ngOnInit() {
|
|
465
|
+
this.dialogBox['draggable'] = this.defaultMaximize ? this.dialogBox['draggable'] : this.option.draggable;
|
|
466
|
+
this.dialogBox['resizable'] = this.defaultMaximize ? this.dialogBox['resizable'] : this.option.resizable;
|
|
467
|
+
}
|
|
468
|
+
ngAfterViewInit() {
|
|
469
|
+
let list = new QueryList();
|
|
470
|
+
for (let item of this.dialogRef.dragHandleRefs) {
|
|
471
|
+
list.reset([...list.toArray(), new CdkDragHandle(item, this.dragRef)]);
|
|
472
|
+
}
|
|
473
|
+
this.dragRef._handles = list;
|
|
474
|
+
}
|
|
453
475
|
attachComponentPortal(portal) {
|
|
454
476
|
if (this.portalOutlet.hasAttached()) {
|
|
455
477
|
throw Error('dialog portal has attached');
|
|
@@ -462,16 +484,24 @@ class XDialogPortalComponent extends BasePortalOutlet {
|
|
|
462
484
|
}
|
|
463
485
|
return this.portalOutlet.attachTemplatePortal(portal);
|
|
464
486
|
}
|
|
487
|
+
resizing(event) {
|
|
488
|
+
const contentHeight = Number(this.initContentHeight) + Number(event.clientHeight) - Number(this.initHeight);
|
|
489
|
+
this.renderer.setStyle(this.dialogContent, 'max-height', 'initial');
|
|
490
|
+
this.renderer.setStyle(this.dialogContent, 'flex', 'initial');
|
|
491
|
+
if (['top-start', 'top-end', 'bottom', 'top', 'bottom-start', 'bottom-end'].includes(event.direction)) {
|
|
492
|
+
this.renderer.setStyle(this.dialogContent, 'height', `${contentHeight}px`);
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
onDragEnded(event) {
|
|
496
|
+
this.distance = { x: this.distance.x + event.distance.x, y: this.distance.y + event.distance.y };
|
|
497
|
+
}
|
|
465
498
|
}
|
|
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: { "
|
|
499
|
+
/** @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 });
|
|
500
|
+
/** @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 [class.x-dialog-portal-fullscreen]=\"dialogRef.fullscreen\"\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{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
501
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: XDialogPortalComponent, decorators: [{
|
|
469
502
|
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%;
|
|
471
|
-
}], ctorParameters: function () { return []; }, propDecorators: {
|
|
472
|
-
type: HostBinding,
|
|
473
|
-
args: ['class.x-dialog-portal']
|
|
474
|
-
}], placement: [{
|
|
503
|
+
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 [class.x-dialog-portal-fullscreen]=\"dialogRef.fullscreen\"\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{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"] }]
|
|
504
|
+
}], ctorParameters: function () { return [{ type: i0.Renderer2 }]; }, propDecorators: { placement: [{
|
|
475
505
|
type: HostBinding,
|
|
476
506
|
args: ['@x-move-box-animation']
|
|
477
507
|
}], done: [{
|
|
@@ -483,13 +513,24 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
|
|
|
483
513
|
}], portalOutlet: [{
|
|
484
514
|
type: ViewChild,
|
|
485
515
|
args: [CdkPortalOutlet, { static: true }]
|
|
516
|
+
}], dragRef: [{
|
|
517
|
+
type: ViewChild,
|
|
518
|
+
args: [CdkDrag, { static: true }]
|
|
519
|
+
}], handles: [{
|
|
520
|
+
type: ContentChildren,
|
|
521
|
+
args: [CdkDragHandle, { descendants: true }]
|
|
486
522
|
}] } });
|
|
487
523
|
|
|
488
524
|
// TODO: add more function
|
|
489
525
|
class XDialogRef {
|
|
490
|
-
constructor(overlayRef, containerInstance) {
|
|
526
|
+
constructor(overlayRef, containerInstance, renderer, portalService) {
|
|
491
527
|
this.overlayRef = overlayRef;
|
|
492
528
|
this.containerInstance = containerInstance;
|
|
529
|
+
this.renderer = renderer;
|
|
530
|
+
this.portalService = portalService;
|
|
531
|
+
this.fullscreen = false;
|
|
532
|
+
this.dragHandleRefs = [];
|
|
533
|
+
this._isFristFullscreen = true;
|
|
493
534
|
}
|
|
494
535
|
close() {
|
|
495
536
|
this.containerInstance.animationChanged
|
|
@@ -499,6 +540,81 @@ class XDialogRef {
|
|
|
499
540
|
});
|
|
500
541
|
this.containerInstance.placement = 'void';
|
|
501
542
|
}
|
|
543
|
+
onFullscreen() {
|
|
544
|
+
var _a, _b;
|
|
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
|
+
}
|
|
565
|
+
else {
|
|
566
|
+
dialogBox['minWidth'] = this.option.minWidth;
|
|
567
|
+
dialogBox['minHeight'] = this.option.minHeight;
|
|
568
|
+
if (this._isFristFullscreen && defaultMaximize) {
|
|
569
|
+
this.option.draggable = dialogBox['draggable'];
|
|
570
|
+
this.option.resizable = dialogBox['resizable'];
|
|
571
|
+
}
|
|
572
|
+
else {
|
|
573
|
+
dialogBox['draggable'] = this.option.draggable;
|
|
574
|
+
dialogBox['resizable'] = this.option.resizable;
|
|
575
|
+
}
|
|
576
|
+
(_a = dialogRef.overlayRef) === null || _a === void 0 ? void 0 : _a.updateSize({
|
|
577
|
+
width: dialogBox['width'],
|
|
578
|
+
height: dialogBox['height'],
|
|
579
|
+
minWidth: dialogBox['minWidth'],
|
|
580
|
+
minHeight: dialogBox['minHeight']
|
|
581
|
+
});
|
|
582
|
+
dialogRef.fullscreen = false;
|
|
583
|
+
if (this.option.draggable) {
|
|
584
|
+
dialogBox['distance'] = Object.assign({}, distance);
|
|
585
|
+
}
|
|
586
|
+
if (this.option.resizable) {
|
|
587
|
+
if (dialogBox['marginTop']) {
|
|
588
|
+
this.renderer.setStyle(overlayElement, 'margin-top', `${dialogBox['marginTop']}`);
|
|
589
|
+
}
|
|
590
|
+
if (dialogBox['marginLeft']) {
|
|
591
|
+
this.renderer.setStyle(overlayElement, 'margin-left', `${dialogBox['marginLeft']}`);
|
|
592
|
+
}
|
|
593
|
+
if (dialogBox['marginRight']) {
|
|
594
|
+
this.renderer.setStyle(overlayElement, 'margin-right', `${dialogBox['marginRight']}`);
|
|
595
|
+
}
|
|
596
|
+
if (dialogBox['marginBottom']) {
|
|
597
|
+
this.renderer.setStyle(overlayElement, 'margin-bottom', `${dialogBox['marginBottom']}`);
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
if (this._isFristFullscreen && defaultMaximize) {
|
|
601
|
+
(_b = dialogRef.overlayRef) === null || _b === void 0 ? void 0 : _b.updatePositionStrategy(this.portalService.setPlace(this.option.placement, this.option.offset));
|
|
602
|
+
this.renderer.addClass(hostElement, PortalResizablePrefix);
|
|
603
|
+
setTimeout(() => {
|
|
604
|
+
var _a;
|
|
605
|
+
Object.assign(dialogBox, this.portalService.setResizable(overlayElement, this.option.placement));
|
|
606
|
+
this.containerInstance.offsetLeft = overlayElement.offsetLeft;
|
|
607
|
+
this.containerInstance.offsetTop = overlayElement.offsetTop;
|
|
608
|
+
const dialogDraggable = overlayElement === null || overlayElement === void 0 ? void 0 : overlayElement.querySelector('.x-dialog-portal');
|
|
609
|
+
this.containerInstance.initHeight = dialogDraggable.clientHeight;
|
|
610
|
+
this.containerInstance.dialogContent = overlayElement === null || overlayElement === void 0 ? void 0 : overlayElement.querySelector('.x-dialog-portal-content');
|
|
611
|
+
this.containerInstance.initContentHeight = (_a = this.containerInstance.dialogContent) === null || _a === void 0 ? void 0 : _a.clientHeight;
|
|
612
|
+
this.containerInstance.dialogBox = dialogBox;
|
|
613
|
+
});
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
this._isFristFullscreen = false;
|
|
617
|
+
}
|
|
502
618
|
}
|
|
503
619
|
|
|
504
620
|
class XDialogCloseDirective {
|
|
@@ -571,6 +687,56 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
|
|
|
571
687
|
}], propDecorators: { _has: [{
|
|
572
688
|
type: HostBinding,
|
|
573
689
|
args: ['class.x-dialog-portal-actions']
|
|
690
|
+
}] } });
|
|
691
|
+
class XDialogDragHandleDirective {
|
|
692
|
+
constructor(dialogRef, elementRef) {
|
|
693
|
+
this.dialogRef = dialogRef;
|
|
694
|
+
this.elementRef = elementRef;
|
|
695
|
+
}
|
|
696
|
+
get getDraggable() {
|
|
697
|
+
return !this.dialogRef.fullscreen && this.dialogRef.option.draggable;
|
|
698
|
+
}
|
|
699
|
+
ngOnInit() {
|
|
700
|
+
this.dialogRef.dragHandleRefs.push(this.elementRef);
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
/** @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 });
|
|
704
|
+
/** @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 });
|
|
705
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: XDialogDragHandleDirective, decorators: [{
|
|
706
|
+
type: Directive,
|
|
707
|
+
args: [{
|
|
708
|
+
selector: `[x-dialog-drag-handle], x-dialog-drag-handle`
|
|
709
|
+
}]
|
|
710
|
+
}], ctorParameters: function () {
|
|
711
|
+
return [{ type: XDialogRef, decorators: [{
|
|
712
|
+
type: Optional
|
|
713
|
+
}] }, { type: i0.ElementRef }];
|
|
714
|
+
}, propDecorators: { getDraggable: [{
|
|
715
|
+
type: HostBinding,
|
|
716
|
+
args: ['class.x-dialog-portal-drag-handle']
|
|
717
|
+
}] } });
|
|
718
|
+
class XDialogFullscreenDirective {
|
|
719
|
+
constructor(dialogRef) {
|
|
720
|
+
this.dialogRef = dialogRef;
|
|
721
|
+
}
|
|
722
|
+
onFullscreenClick() {
|
|
723
|
+
this.dialogRef && this.dialogRef.onFullscreen();
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
/** @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 });
|
|
727
|
+
/** @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 });
|
|
728
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: XDialogFullscreenDirective, decorators: [{
|
|
729
|
+
type: Directive,
|
|
730
|
+
args: [{
|
|
731
|
+
selector: `[x-dialog-fullscreen], x-dialog-fullscreen`
|
|
732
|
+
}]
|
|
733
|
+
}], ctorParameters: function () {
|
|
734
|
+
return [{ type: XDialogRef, decorators: [{
|
|
735
|
+
type: Optional
|
|
736
|
+
}] }];
|
|
737
|
+
}, propDecorators: { onFullscreenClick: [{
|
|
738
|
+
type: HostListener,
|
|
739
|
+
args: ['click', ['$event']]
|
|
574
740
|
}] } });
|
|
575
741
|
|
|
576
742
|
class XDialogService {
|
|
@@ -583,10 +749,12 @@ class XDialogService {
|
|
|
583
749
|
placement: 'center',
|
|
584
750
|
offset: '1rem',
|
|
585
751
|
width: '32rem',
|
|
752
|
+
minWidth: '18rem',
|
|
753
|
+
minHeight: '9rem',
|
|
586
754
|
backdropClose: true,
|
|
587
|
-
hasBackdrop: true
|
|
588
|
-
|
|
589
|
-
|
|
755
|
+
hasBackdrop: true,
|
|
756
|
+
draggable: false,
|
|
757
|
+
resizable: false
|
|
590
758
|
};
|
|
591
759
|
this.renderer = this.rendererFactory.createRenderer(null, null);
|
|
592
760
|
this.configDefault = this.configService.getConfigForComponent(X_DIALOG_CONFIG_NAME);
|
|
@@ -603,16 +771,49 @@ class XDialogService {
|
|
|
603
771
|
scrollStrategy: this.overlay.scrollStrategies.block(),
|
|
604
772
|
width: option.width,
|
|
605
773
|
height: option.height,
|
|
774
|
+
minWidth: option.minWidth,
|
|
775
|
+
minHeight: option.minHeight,
|
|
606
776
|
positionStrategy: this.portalService.setPlace(option.placement, option.offset)
|
|
607
777
|
}
|
|
608
778
|
});
|
|
609
|
-
// if (option.resizable) {
|
|
610
|
-
// this.renderer.addClass(portal.overlayRef?.hostElement, PortalResizablePrefix);
|
|
611
|
-
// }
|
|
612
779
|
const { overlayRef, componentRef } = portal || {};
|
|
613
780
|
const { instance } = componentRef || {};
|
|
781
|
+
const { hostElement, overlayElement } = overlayRef || {};
|
|
782
|
+
const dialogRef = new XDialogRef(overlayRef, instance, this.renderer, this.portalService);
|
|
783
|
+
let dialogBox = {
|
|
784
|
+
draggable: option.draggable,
|
|
785
|
+
resizable: option.resizable
|
|
786
|
+
};
|
|
787
|
+
let defaultMaximize = this.setMaximize(option);
|
|
788
|
+
Object.assign(dialogBox, {
|
|
789
|
+
width: defaultMaximize ? this.default.width : option.width,
|
|
790
|
+
height: defaultMaximize ? null : option.height,
|
|
791
|
+
minWidth: option.minWidth,
|
|
792
|
+
minHeight: option.minHeight
|
|
793
|
+
});
|
|
614
794
|
instance.placement = option.placement;
|
|
615
|
-
|
|
795
|
+
instance.option = option;
|
|
796
|
+
instance.dialogRef = dialogRef;
|
|
797
|
+
instance.defaultMaximize = defaultMaximize;
|
|
798
|
+
instance.dialogBox = dialogBox;
|
|
799
|
+
instance.hostElement = hostElement;
|
|
800
|
+
instance.overlayElement = overlayElement;
|
|
801
|
+
dialogRef.option = option;
|
|
802
|
+
dialogRef.fullscreen = defaultMaximize;
|
|
803
|
+
if (option.resizable && !defaultMaximize) {
|
|
804
|
+
this.renderer.addClass(hostElement, PortalResizablePrefix);
|
|
805
|
+
setTimeout(() => {
|
|
806
|
+
var _a;
|
|
807
|
+
Object.assign(dialogBox, this.portalService.setResizable(overlayElement, option.placement));
|
|
808
|
+
instance.offsetLeft = overlayElement.offsetLeft;
|
|
809
|
+
instance.offsetTop = overlayElement.offsetTop;
|
|
810
|
+
const dialogDraggable = overlayElement === null || overlayElement === void 0 ? void 0 : overlayElement.querySelector('.x-dialog-portal');
|
|
811
|
+
instance.initHeight = dialogDraggable.clientHeight;
|
|
812
|
+
instance.dialogContent = overlayElement === null || overlayElement === void 0 ? void 0 : overlayElement.querySelector('.x-dialog-portal-content');
|
|
813
|
+
instance.initContentHeight = (_a = instance.dialogContent) === null || _a === void 0 ? void 0 : _a.clientHeight;
|
|
814
|
+
instance.dialogBox = dialogBox;
|
|
815
|
+
});
|
|
816
|
+
}
|
|
616
817
|
if (content instanceof TemplateRef) {
|
|
617
818
|
instance.attachTemplatePortal(new TemplatePortal(content, option.viewContainerRef, { $implicit: option.data, dialogRef: dialogRef }));
|
|
618
819
|
}
|
|
@@ -631,12 +832,22 @@ class XDialogService {
|
|
|
631
832
|
}
|
|
632
833
|
return dialogRef;
|
|
633
834
|
}
|
|
835
|
+
setMaximize(option = {}) {
|
|
836
|
+
const ws = ['100%', '100vw'];
|
|
837
|
+
const hs = ['100%', '100vh'];
|
|
838
|
+
if (ws.includes(option.width) && hs.includes(option.height)) {
|
|
839
|
+
option.resizable = false;
|
|
840
|
+
option.draggable = false;
|
|
841
|
+
return true;
|
|
842
|
+
}
|
|
843
|
+
return false;
|
|
844
|
+
}
|
|
634
845
|
}
|
|
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$
|
|
846
|
+
/** @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
847
|
/** @nocollapse */ /** @nocollapse */ XDialogService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: XDialogService });
|
|
637
848
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: XDialogService, decorators: [{
|
|
638
849
|
type: Injectable
|
|
639
|
-
}], ctorParameters: function () { return [{ type: i1.XPortalService }, { type: i2$
|
|
850
|
+
}], ctorParameters: function () { return [{ type: i1.XPortalService }, { type: i2$2.XConfigService }, { type: i2.Overlay }, { type: i0.RendererFactory2 }]; } });
|
|
640
851
|
|
|
641
852
|
class XDialogModule {
|
|
642
853
|
}
|
|
@@ -646,6 +857,8 @@ class XDialogModule {
|
|
|
646
857
|
XDialogTitleDirective,
|
|
647
858
|
XDialogContentDirective,
|
|
648
859
|
XDialogActionsDirective,
|
|
860
|
+
XDialogDragHandleDirective,
|
|
861
|
+
XDialogFullscreenDirective,
|
|
649
862
|
XDialogPortalComponent,
|
|
650
863
|
XDialogProperty], imports: [CommonModule,
|
|
651
864
|
FormsModule,
|
|
@@ -662,6 +875,8 @@ class XDialogModule {
|
|
|
662
875
|
XDialogTitleDirective,
|
|
663
876
|
XDialogContentDirective,
|
|
664
877
|
XDialogActionsDirective,
|
|
878
|
+
XDialogDragHandleDirective,
|
|
879
|
+
XDialogFullscreenDirective,
|
|
665
880
|
XDialogPortalComponent] });
|
|
666
881
|
/** @nocollapse */ /** @nocollapse */ XDialogModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: XDialogModule, providers: [XDialogService], imports: [[
|
|
667
882
|
CommonModule,
|
|
@@ -685,6 +900,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
|
|
|
685
900
|
XDialogTitleDirective,
|
|
686
901
|
XDialogContentDirective,
|
|
687
902
|
XDialogActionsDirective,
|
|
903
|
+
XDialogDragHandleDirective,
|
|
904
|
+
XDialogFullscreenDirective,
|
|
688
905
|
XDialogPortalComponent,
|
|
689
906
|
XDialogProperty
|
|
690
907
|
],
|
|
@@ -694,6 +911,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
|
|
|
694
911
|
XDialogTitleDirective,
|
|
695
912
|
XDialogContentDirective,
|
|
696
913
|
XDialogActionsDirective,
|
|
914
|
+
XDialogDragHandleDirective,
|
|
915
|
+
XDialogFullscreenDirective,
|
|
697
916
|
XDialogPortalComponent
|
|
698
917
|
],
|
|
699
918
|
imports: [
|
|
@@ -717,5 +936,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
|
|
|
717
936
|
* Generated bundle index. Do not edit.
|
|
718
937
|
*/
|
|
719
938
|
|
|
720
|
-
export { XDialogActionsDirective, XDialogCloseDirective, XDialogComponent, XDialogContainer, XDialogContentDirective, XDialogModule, XDialogPortalComponent, XDialogPrefix, XDialogProperty, XDialogRef, XDialogService, XDialogTitleDirective, X_DIALOG_CONFIG_NAME, X_DIALOG_DATA };
|
|
939
|
+
export { XDialogActionsDirective, XDialogCloseDirective, XDialogComponent, XDialogContainer, XDialogContentDirective, XDialogDragHandleDirective, XDialogFullscreenDirective, XDialogModule, XDialogPortalComponent, XDialogPrefix, XDialogProperty, XDialogRef, XDialogService, XDialogTitleDirective, X_DIALOG_CONFIG_NAME, X_DIALOG_DATA };
|
|
721
940
|
//# sourceMappingURL=ng-nest-ui-dialog.mjs.map
|