@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
|
|
@@ -431,10 +433,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
|
|
|
431
433
|
}] } });
|
|
432
434
|
|
|
433
435
|
class XDialogPortalComponent extends BasePortalOutlet {
|
|
434
|
-
constructor() {
|
|
436
|
+
constructor(renderer) {
|
|
435
437
|
super();
|
|
436
|
-
this.
|
|
438
|
+
this.renderer = renderer;
|
|
437
439
|
this.animationChanged = new EventEmitter();
|
|
440
|
+
this.offsetLeft = 0;
|
|
441
|
+
this.offsetTop = 0;
|
|
442
|
+
this.minWidth = '0rem';
|
|
443
|
+
this.minHeight = '0rem';
|
|
444
|
+
this.initHeight = 0;
|
|
445
|
+
this.initContentHeight = 0;
|
|
446
|
+
this.defaultMaximize = false;
|
|
447
|
+
this.distance = { x: 0, y: 0 };
|
|
448
|
+
this.dialogBox = {};
|
|
438
449
|
}
|
|
439
450
|
done({ toState, totalTime }) {
|
|
440
451
|
this.animationChanged.next({ action: 'done', state: toState, totalTime });
|
|
@@ -442,6 +453,17 @@ class XDialogPortalComponent extends BasePortalOutlet {
|
|
|
442
453
|
start({ toState, totalTime }) {
|
|
443
454
|
this.animationChanged.next({ action: 'start', state: toState, totalTime });
|
|
444
455
|
}
|
|
456
|
+
ngOnInit() {
|
|
457
|
+
this.dialogBox['draggable'] = this.defaultMaximize ? this.dialogBox['draggable'] : this.option.draggable;
|
|
458
|
+
this.dialogBox['resizable'] = this.defaultMaximize ? this.dialogBox['resizable'] : this.option.resizable;
|
|
459
|
+
}
|
|
460
|
+
ngAfterViewInit() {
|
|
461
|
+
let list = new QueryList();
|
|
462
|
+
for (let item of this.dialogRef.dragHandleRefs) {
|
|
463
|
+
list.reset([...list.toArray(), new CdkDragHandle(item, this.dragRef)]);
|
|
464
|
+
}
|
|
465
|
+
this.dragRef._handles = list;
|
|
466
|
+
}
|
|
445
467
|
attachComponentPortal(portal) {
|
|
446
468
|
if (this.portalOutlet.hasAttached()) {
|
|
447
469
|
throw Error('dialog portal has attached');
|
|
@@ -454,16 +476,24 @@ class XDialogPortalComponent extends BasePortalOutlet {
|
|
|
454
476
|
}
|
|
455
477
|
return this.portalOutlet.attachTemplatePortal(portal);
|
|
456
478
|
}
|
|
479
|
+
resizing(event) {
|
|
480
|
+
const contentHeight = Number(this.initContentHeight) + Number(event.clientHeight) - Number(this.initHeight);
|
|
481
|
+
this.renderer.setStyle(this.dialogContent, 'max-height', 'initial');
|
|
482
|
+
this.renderer.setStyle(this.dialogContent, 'flex', 'initial');
|
|
483
|
+
if (['top-start', 'top-end', 'bottom', 'top', 'bottom-start', 'bottom-end'].includes(event.direction)) {
|
|
484
|
+
this.renderer.setStyle(this.dialogContent, 'height', `${contentHeight}px`);
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
onDragEnded(event) {
|
|
488
|
+
this.distance = { x: this.distance.x + event.distance.x, y: this.distance.y + event.distance.y };
|
|
489
|
+
}
|
|
457
490
|
}
|
|
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: { "
|
|
491
|
+
/** @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 });
|
|
492
|
+
/** @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 });
|
|
460
493
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: XDialogPortalComponent, decorators: [{
|
|
461
494
|
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%;
|
|
463
|
-
}], ctorParameters: function () { return []; }, propDecorators: {
|
|
464
|
-
type: HostBinding,
|
|
465
|
-
args: ['class.x-dialog-portal']
|
|
466
|
-
}], placement: [{
|
|
495
|
+
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"] }]
|
|
496
|
+
}], ctorParameters: function () { return [{ type: i0.Renderer2 }]; }, propDecorators: { placement: [{
|
|
467
497
|
type: HostBinding,
|
|
468
498
|
args: ['@x-move-box-animation']
|
|
469
499
|
}], done: [{
|
|
@@ -475,13 +505,24 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
|
|
|
475
505
|
}], portalOutlet: [{
|
|
476
506
|
type: ViewChild,
|
|
477
507
|
args: [CdkPortalOutlet, { static: true }]
|
|
508
|
+
}], dragRef: [{
|
|
509
|
+
type: ViewChild,
|
|
510
|
+
args: [CdkDrag, { static: true }]
|
|
511
|
+
}], handles: [{
|
|
512
|
+
type: ContentChildren,
|
|
513
|
+
args: [CdkDragHandle, { descendants: true }]
|
|
478
514
|
}] } });
|
|
479
515
|
|
|
480
516
|
// TODO: add more function
|
|
481
517
|
class XDialogRef {
|
|
482
|
-
constructor(overlayRef, containerInstance) {
|
|
518
|
+
constructor(overlayRef, containerInstance, renderer, portalService) {
|
|
483
519
|
this.overlayRef = overlayRef;
|
|
484
520
|
this.containerInstance = containerInstance;
|
|
521
|
+
this.renderer = renderer;
|
|
522
|
+
this.portalService = portalService;
|
|
523
|
+
this.fullscreen = false;
|
|
524
|
+
this.dragHandleRefs = [];
|
|
525
|
+
this._isFristFullscreen = true;
|
|
485
526
|
}
|
|
486
527
|
close() {
|
|
487
528
|
this.containerInstance.animationChanged
|
|
@@ -491,6 +532,79 @@ class XDialogRef {
|
|
|
491
532
|
});
|
|
492
533
|
this.containerInstance.placement = 'void';
|
|
493
534
|
}
|
|
535
|
+
onFullscreen() {
|
|
536
|
+
let { dialogBox, dialogRef, overlayElement, distance, hostElement, defaultMaximize } = this.containerInstance;
|
|
537
|
+
if (!dialogRef.fullscreen) {
|
|
538
|
+
dialogRef.overlayRef.updateSize({
|
|
539
|
+
width: '100%',
|
|
540
|
+
height: '100%',
|
|
541
|
+
minWidth: '100%',
|
|
542
|
+
minHeight: '100%'
|
|
543
|
+
});
|
|
544
|
+
dialogRef.fullscreen = true;
|
|
545
|
+
dialogBox['minWidth'] = '100%';
|
|
546
|
+
dialogBox['minHeight'] = '100%';
|
|
547
|
+
dialogBox['draggable'] = false;
|
|
548
|
+
dialogBox['resizable'] = false;
|
|
549
|
+
if (this.option.resizable) {
|
|
550
|
+
this.renderer.setStyle(overlayElement, 'margin', '0 0 0 0');
|
|
551
|
+
}
|
|
552
|
+
if (this.option.draggable) {
|
|
553
|
+
dialogBox['distance'] = { x: 0, y: 0 };
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
else {
|
|
557
|
+
dialogBox['minWidth'] = this.option.minWidth;
|
|
558
|
+
dialogBox['minHeight'] = this.option.minHeight;
|
|
559
|
+
if (this._isFristFullscreen && defaultMaximize) {
|
|
560
|
+
this.option.draggable = dialogBox['draggable'];
|
|
561
|
+
this.option.resizable = dialogBox['resizable'];
|
|
562
|
+
}
|
|
563
|
+
else {
|
|
564
|
+
dialogBox['draggable'] = this.option.draggable;
|
|
565
|
+
dialogBox['resizable'] = this.option.resizable;
|
|
566
|
+
}
|
|
567
|
+
dialogRef.overlayRef?.updateSize({
|
|
568
|
+
width: dialogBox['width'],
|
|
569
|
+
height: dialogBox['height'],
|
|
570
|
+
minWidth: dialogBox['minWidth'],
|
|
571
|
+
minHeight: dialogBox['minHeight']
|
|
572
|
+
});
|
|
573
|
+
dialogRef.fullscreen = false;
|
|
574
|
+
if (this.option.draggable) {
|
|
575
|
+
dialogBox['distance'] = { ...distance };
|
|
576
|
+
}
|
|
577
|
+
if (this.option.resizable) {
|
|
578
|
+
if (dialogBox['marginTop']) {
|
|
579
|
+
this.renderer.setStyle(overlayElement, 'margin-top', `${dialogBox['marginTop']}`);
|
|
580
|
+
}
|
|
581
|
+
if (dialogBox['marginLeft']) {
|
|
582
|
+
this.renderer.setStyle(overlayElement, 'margin-left', `${dialogBox['marginLeft']}`);
|
|
583
|
+
}
|
|
584
|
+
if (dialogBox['marginRight']) {
|
|
585
|
+
this.renderer.setStyle(overlayElement, 'margin-right', `${dialogBox['marginRight']}`);
|
|
586
|
+
}
|
|
587
|
+
if (dialogBox['marginBottom']) {
|
|
588
|
+
this.renderer.setStyle(overlayElement, 'margin-bottom', `${dialogBox['marginBottom']}`);
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
if (this._isFristFullscreen && defaultMaximize) {
|
|
592
|
+
dialogRef.overlayRef?.updatePositionStrategy(this.portalService.setPlace(this.option.placement, this.option.offset));
|
|
593
|
+
this.renderer.addClass(hostElement, PortalResizablePrefix);
|
|
594
|
+
setTimeout(() => {
|
|
595
|
+
Object.assign(dialogBox, this.portalService.setResizable(overlayElement, this.option.placement));
|
|
596
|
+
this.containerInstance.offsetLeft = overlayElement.offsetLeft;
|
|
597
|
+
this.containerInstance.offsetTop = overlayElement.offsetTop;
|
|
598
|
+
const dialogDraggable = overlayElement?.querySelector('.x-dialog-portal');
|
|
599
|
+
this.containerInstance.initHeight = dialogDraggable.clientHeight;
|
|
600
|
+
this.containerInstance.dialogContent = overlayElement?.querySelector('.x-dialog-portal-content');
|
|
601
|
+
this.containerInstance.initContentHeight = this.containerInstance.dialogContent?.clientHeight;
|
|
602
|
+
this.containerInstance.dialogBox = dialogBox;
|
|
603
|
+
});
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
this._isFristFullscreen = false;
|
|
607
|
+
}
|
|
494
608
|
}
|
|
495
609
|
|
|
496
610
|
class XDialogCloseDirective {
|
|
@@ -561,6 +675,52 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
|
|
|
561
675
|
}], propDecorators: { _has: [{
|
|
562
676
|
type: HostBinding,
|
|
563
677
|
args: ['class.x-dialog-portal-actions']
|
|
678
|
+
}] } });
|
|
679
|
+
class XDialogDragHandleDirective {
|
|
680
|
+
constructor(dialogRef, elementRef) {
|
|
681
|
+
this.dialogRef = dialogRef;
|
|
682
|
+
this.elementRef = elementRef;
|
|
683
|
+
}
|
|
684
|
+
get getDraggable() {
|
|
685
|
+
return !this.dialogRef.fullscreen && this.dialogRef.option.draggable;
|
|
686
|
+
}
|
|
687
|
+
ngOnInit() {
|
|
688
|
+
this.dialogRef.dragHandleRefs.push(this.elementRef);
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
/** @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 });
|
|
692
|
+
/** @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 });
|
|
693
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: XDialogDragHandleDirective, decorators: [{
|
|
694
|
+
type: Directive,
|
|
695
|
+
args: [{
|
|
696
|
+
selector: `[x-dialog-drag-handle], x-dialog-drag-handle`
|
|
697
|
+
}]
|
|
698
|
+
}], ctorParameters: function () { return [{ type: XDialogRef, decorators: [{
|
|
699
|
+
type: Optional
|
|
700
|
+
}] }, { type: i0.ElementRef }]; }, propDecorators: { getDraggable: [{
|
|
701
|
+
type: HostBinding,
|
|
702
|
+
args: ['class.x-dialog-portal-drag-handle']
|
|
703
|
+
}] } });
|
|
704
|
+
class XDialogFullscreenDirective {
|
|
705
|
+
constructor(dialogRef) {
|
|
706
|
+
this.dialogRef = dialogRef;
|
|
707
|
+
}
|
|
708
|
+
onFullscreenClick() {
|
|
709
|
+
this.dialogRef && this.dialogRef.onFullscreen();
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
/** @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 });
|
|
713
|
+
/** @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 });
|
|
714
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: XDialogFullscreenDirective, decorators: [{
|
|
715
|
+
type: Directive,
|
|
716
|
+
args: [{
|
|
717
|
+
selector: `[x-dialog-fullscreen], x-dialog-fullscreen`
|
|
718
|
+
}]
|
|
719
|
+
}], ctorParameters: function () { return [{ type: XDialogRef, decorators: [{
|
|
720
|
+
type: Optional
|
|
721
|
+
}] }]; }, propDecorators: { onFullscreenClick: [{
|
|
722
|
+
type: HostListener,
|
|
723
|
+
args: ['click', ['$event']]
|
|
564
724
|
}] } });
|
|
565
725
|
|
|
566
726
|
class XDialogService {
|
|
@@ -573,10 +733,12 @@ class XDialogService {
|
|
|
573
733
|
placement: 'center',
|
|
574
734
|
offset: '1rem',
|
|
575
735
|
width: '32rem',
|
|
736
|
+
minWidth: '18rem',
|
|
737
|
+
minHeight: '9rem',
|
|
576
738
|
backdropClose: true,
|
|
577
|
-
hasBackdrop: true
|
|
578
|
-
|
|
579
|
-
|
|
739
|
+
hasBackdrop: true,
|
|
740
|
+
draggable: false,
|
|
741
|
+
resizable: false
|
|
580
742
|
};
|
|
581
743
|
this.renderer = this.rendererFactory.createRenderer(null, null);
|
|
582
744
|
this.configDefault = this.configService.getConfigForComponent(X_DIALOG_CONFIG_NAME);
|
|
@@ -593,16 +755,48 @@ class XDialogService {
|
|
|
593
755
|
scrollStrategy: this.overlay.scrollStrategies.block(),
|
|
594
756
|
width: option.width,
|
|
595
757
|
height: option.height,
|
|
758
|
+
minWidth: option.minWidth,
|
|
759
|
+
minHeight: option.minHeight,
|
|
596
760
|
positionStrategy: this.portalService.setPlace(option.placement, option.offset)
|
|
597
761
|
}
|
|
598
762
|
});
|
|
599
|
-
// if (option.resizable) {
|
|
600
|
-
// this.renderer.addClass(portal.overlayRef?.hostElement, PortalResizablePrefix);
|
|
601
|
-
// }
|
|
602
763
|
const { overlayRef, componentRef } = portal || {};
|
|
603
764
|
const { instance } = componentRef || {};
|
|
765
|
+
const { hostElement, overlayElement } = overlayRef || {};
|
|
766
|
+
const dialogRef = new XDialogRef(overlayRef, instance, this.renderer, this.portalService);
|
|
767
|
+
let dialogBox = {
|
|
768
|
+
draggable: option.draggable,
|
|
769
|
+
resizable: option.resizable
|
|
770
|
+
};
|
|
771
|
+
let defaultMaximize = this.setMaximize(option);
|
|
772
|
+
Object.assign(dialogBox, {
|
|
773
|
+
width: defaultMaximize ? this.default.width : option.width,
|
|
774
|
+
height: defaultMaximize ? null : option.height,
|
|
775
|
+
minWidth: option.minWidth,
|
|
776
|
+
minHeight: option.minHeight
|
|
777
|
+
});
|
|
604
778
|
instance.placement = option.placement;
|
|
605
|
-
|
|
779
|
+
instance.option = option;
|
|
780
|
+
instance.dialogRef = dialogRef;
|
|
781
|
+
instance.defaultMaximize = defaultMaximize;
|
|
782
|
+
instance.dialogBox = dialogBox;
|
|
783
|
+
instance.hostElement = hostElement;
|
|
784
|
+
instance.overlayElement = overlayElement;
|
|
785
|
+
dialogRef.option = option;
|
|
786
|
+
dialogRef.fullscreen = defaultMaximize;
|
|
787
|
+
if (option.resizable && !defaultMaximize) {
|
|
788
|
+
this.renderer.addClass(hostElement, PortalResizablePrefix);
|
|
789
|
+
setTimeout(() => {
|
|
790
|
+
Object.assign(dialogBox, this.portalService.setResizable(overlayElement, option.placement));
|
|
791
|
+
instance.offsetLeft = overlayElement.offsetLeft;
|
|
792
|
+
instance.offsetTop = overlayElement.offsetTop;
|
|
793
|
+
const dialogDraggable = overlayElement?.querySelector('.x-dialog-portal');
|
|
794
|
+
instance.initHeight = dialogDraggable.clientHeight;
|
|
795
|
+
instance.dialogContent = overlayElement?.querySelector('.x-dialog-portal-content');
|
|
796
|
+
instance.initContentHeight = instance.dialogContent?.clientHeight;
|
|
797
|
+
instance.dialogBox = dialogBox;
|
|
798
|
+
});
|
|
799
|
+
}
|
|
606
800
|
if (content instanceof TemplateRef) {
|
|
607
801
|
instance.attachTemplatePortal(new TemplatePortal(content, option.viewContainerRef, { $implicit: option.data, dialogRef: dialogRef }));
|
|
608
802
|
}
|
|
@@ -621,12 +815,22 @@ class XDialogService {
|
|
|
621
815
|
}
|
|
622
816
|
return dialogRef;
|
|
623
817
|
}
|
|
818
|
+
setMaximize(option = {}) {
|
|
819
|
+
const ws = ['100%', '100vw'];
|
|
820
|
+
const hs = ['100%', '100vh'];
|
|
821
|
+
if (ws.includes(option.width) && hs.includes(option.height)) {
|
|
822
|
+
option.resizable = false;
|
|
823
|
+
option.draggable = false;
|
|
824
|
+
return true;
|
|
825
|
+
}
|
|
826
|
+
return false;
|
|
827
|
+
}
|
|
624
828
|
}
|
|
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$
|
|
829
|
+
/** @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
830
|
/** @nocollapse */ /** @nocollapse */ XDialogService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: XDialogService });
|
|
627
831
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: XDialogService, decorators: [{
|
|
628
832
|
type: Injectable
|
|
629
|
-
}], ctorParameters: function () { return [{ type: i1.XPortalService }, { type: i2$
|
|
833
|
+
}], ctorParameters: function () { return [{ type: i1.XPortalService }, { type: i2$2.XConfigService }, { type: i2.Overlay }, { type: i0.RendererFactory2 }]; } });
|
|
630
834
|
|
|
631
835
|
class XDialogModule {
|
|
632
836
|
}
|
|
@@ -636,6 +840,8 @@ class XDialogModule {
|
|
|
636
840
|
XDialogTitleDirective,
|
|
637
841
|
XDialogContentDirective,
|
|
638
842
|
XDialogActionsDirective,
|
|
843
|
+
XDialogDragHandleDirective,
|
|
844
|
+
XDialogFullscreenDirective,
|
|
639
845
|
XDialogPortalComponent,
|
|
640
846
|
XDialogProperty], imports: [CommonModule,
|
|
641
847
|
FormsModule,
|
|
@@ -652,6 +858,8 @@ class XDialogModule {
|
|
|
652
858
|
XDialogTitleDirective,
|
|
653
859
|
XDialogContentDirective,
|
|
654
860
|
XDialogActionsDirective,
|
|
861
|
+
XDialogDragHandleDirective,
|
|
862
|
+
XDialogFullscreenDirective,
|
|
655
863
|
XDialogPortalComponent] });
|
|
656
864
|
/** @nocollapse */ /** @nocollapse */ XDialogModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: XDialogModule, providers: [XDialogService], imports: [[
|
|
657
865
|
CommonModule,
|
|
@@ -675,6 +883,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
|
|
|
675
883
|
XDialogTitleDirective,
|
|
676
884
|
XDialogContentDirective,
|
|
677
885
|
XDialogActionsDirective,
|
|
886
|
+
XDialogDragHandleDirective,
|
|
887
|
+
XDialogFullscreenDirective,
|
|
678
888
|
XDialogPortalComponent,
|
|
679
889
|
XDialogProperty
|
|
680
890
|
],
|
|
@@ -684,6 +894,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
|
|
|
684
894
|
XDialogTitleDirective,
|
|
685
895
|
XDialogContentDirective,
|
|
686
896
|
XDialogActionsDirective,
|
|
897
|
+
XDialogDragHandleDirective,
|
|
898
|
+
XDialogFullscreenDirective,
|
|
687
899
|
XDialogPortalComponent
|
|
688
900
|
],
|
|
689
901
|
imports: [
|
|
@@ -707,5 +919,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
|
|
|
707
919
|
* Generated bundle index. Do not edit.
|
|
708
920
|
*/
|
|
709
921
|
|
|
710
|
-
export { XDialogActionsDirective, XDialogCloseDirective, XDialogComponent, XDialogContainer, XDialogContentDirective, XDialogModule, XDialogPortalComponent, XDialogPrefix, XDialogProperty, XDialogRef, XDialogService, XDialogTitleDirective, X_DIALOG_CONFIG_NAME, X_DIALOG_DATA };
|
|
922
|
+
export { XDialogActionsDirective, XDialogCloseDirective, XDialogComponent, XDialogContainer, XDialogContentDirective, XDialogDragHandleDirective, XDialogFullscreenDirective, XDialogModule, XDialogPortalComponent, XDialogPrefix, XDialogProperty, XDialogRef, XDialogService, XDialogTitleDirective, X_DIALOG_CONFIG_NAME, X_DIALOG_DATA };
|
|
711
923
|
//# sourceMappingURL=ng-nest-ui-dialog.mjs.map
|