raise-common-lib 0.0.216 → 0.0.218

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.
@@ -659,7 +659,7 @@ class CommonGridComponent {
659
659
  CommonGridComponent.decorators = [
660
660
  { type: Component, args: [{
661
661
  selector: "rs-common-grid",
662
- template: "<ejs-grid\r\n #grid\r\n [id]=\"gridId\"\r\n [ngClass]=\"{\r\n 'hide-Check-box': !alwaysShowCheckbox,\r\n 'grid-loading': className === 'grid-loading'\r\n }\"\r\n [dataSource]=\"dataSource\"\r\n [allowPaging]=\"allowPaging && pageSettings\"\r\n [allowResizing]=\"true\"\r\n [pageSettings]=\"pageSettings\"\r\n [showColumnMenu]=\"true\"\r\n [allowSorting]=\"true\"\r\n [allowFiltering]=\"true\"\r\n [allowExcelExport]=\"true\"\r\n [allowRowDragAndDrop]=\"allowRowDragAndDrop\"\r\n [filterSettings]=\"filterSettings\"\r\n [resizeSettings]=\"resizeSettings\"\r\n [allowSelection]=\"true\"\r\n [editSettings]=\"editSettings\"\r\n [childGrid]=\"childGrid\"\r\n [contextMenuItems]=\"dataSource && dataSource.length ? contextMenuItems : null\"\r\n [selectionSettings]=\"selectionSettings\"\r\n (recordClick)=\"_recordClick($event)\"\r\n (recordDoubleClick)=\"_recordDoubleClick($event)\"\r\n (actionBegin)=\"_actionBegin($event)\"\r\n (actionComplete)=\"_actionHandler($event)\"\r\n (rowSelected)=\"_rowSelected($event)\"\r\n (rowDeselecting)=\"_rowDeselecting($event)\"\r\n (rowDeselected)=\"_rowDeselected($event)\"\r\n style=\"border: none\"\r\n (contextMenuClick)=\"_onContextMenu($event)\"\r\n (contextMenuOpen)=\"contextMenuOpen($event)\"\r\n (queryCellInfo)=\"customiseCell($event)\"\r\n (dataBound)=\"_dataBound($event)\"\r\n (rowDataBound)=\"_rowDataBound($event)\"\r\n (rowSelecting)=\"_rowSelecting($event)\"\r\n (excelQueryCellInfo)=\"_exportQueryCellInfo($event)\"\r\n (rowDrop)=\"onRowDrop($event)\"\r\n (rowDragStart)=\"_rowDragStart($event)\"\r\n (rowDrag)=\"_rowDrag($event)\"\r\n (load)=\"_load()\"\r\n [frozenColumns]=\"frozenColumns\"\r\n [columnChooserSettings]=\"columnChooserSettings\"\r\n>\r\n <e-columns>\r\n <e-column\r\n *ngIf=\"showCheckBox\"\r\n type=\"checkbox\"\r\n [width]=\"checkBoxWidth\"\r\n [minWidth]=\"checkBoxWidth\"\r\n [showColumnMenu]=\"false\"\r\n [allowResizing]=\"false\"\r\n ></e-column>\r\n <e-column\r\n *ngFor=\"let item of fields; trackBy: trackByFn; let last = last\"\r\n [field]=\"item.columnName\"\r\n [filter]=\"item.filter ? item.filter : { type: 'CheckBox' }\"\r\n [customAttributes]=\"\r\n item.colName === 'entityUserList' || item.colName === 'kycProgress'\r\n ? { class: 'hideColumnFilterClass' }\r\n : {}\r\n \"\r\n [headerText]=\"item.columnDisplayName\"\r\n [textAlign]=\"item.textAlign\"\r\n [showColumnMenu]=\"item.showColumnMenu === undefined ? true : false\"\r\n [allowFiltering]=\"item.allowFiltering === undefined ? true : false\"\r\n [allowSorting]=\"item.allowSorting === undefined ? true : false\"\r\n [showInColumnChooser]=\"\r\n item.showInColumnChooser === undefined ? true : item.showInColumnChooser\r\n \"\r\n [editType]=\"item.editType\"\r\n [validationRules]=\"item.validationRules\"\r\n [type]=\"item.dataType || 'string'\"\r\n [width]=\"item.width\"\r\n [minWidth]=\"item.minWidth\"\r\n [format]=\"item.format\"\r\n [visible]=\"item.visible\"\r\n [template]=\"item.showTemplate ? columnTemplate : undefined\"\r\n [clipMode]=\"\r\n item.clipMode ? item.clipMode : clipMode || 'EllipsisWithTooltip'\r\n \"\r\n [sortComparer]=\"item.dateComparer || null\"\r\n [allowResizing]=\"!last\"\r\n >\r\n </e-column>\r\n </e-columns>\r\n</ejs-grid>\r\n",
662
+ template: "<ejs-grid\r\n #grid\r\n [id]=\"gridId\"\r\n [ngClass]=\"{\r\n 'hide-Check-box': !alwaysShowCheckbox,\r\n 'grid-loading': className === 'grid-loading'\r\n }\"\r\n [dataSource]=\"dataSource\"\r\n [allowPaging]=\"allowPaging && pageSettings\"\r\n [allowResizing]=\"true\"\r\n [pageSettings]=\"pageSettings\"\r\n [showColumnMenu]=\"true\"\r\n [allowSorting]=\"true\"\r\n [allowFiltering]=\"true\"\r\n [allowExcelExport]=\"true\"\r\n [allowRowDragAndDrop]=\"allowRowDragAndDrop\"\r\n [filterSettings]=\"filterSettings\"\r\n [resizeSettings]=\"resizeSettings\"\r\n [allowSelection]=\"true\"\r\n [editSettings]=\"editSettings\"\r\n [childGrid]=\"childGrid\"\r\n [contextMenuItems]=\"dataSource && dataSource.length ? contextMenuItems : null\"\r\n [selectionSettings]=\"selectionSettings\"\r\n (recordClick)=\"_recordClick($event)\"\r\n (recordDoubleClick)=\"_recordDoubleClick($event)\"\r\n (actionBegin)=\"_actionBegin($event)\"\r\n (actionComplete)=\"_actionHandler($event)\"\r\n (rowSelected)=\"_rowSelected($event)\"\r\n (rowDeselecting)=\"_rowDeselecting($event)\"\r\n (rowDeselected)=\"_rowDeselected($event)\"\r\n style=\"border: none\"\r\n (contextMenuClick)=\"_onContextMenu($event)\"\r\n (contextMenuOpen)=\"contextMenuOpen($event)\"\r\n (queryCellInfo)=\"customiseCell($event)\"\r\n (dataBound)=\"_dataBound($event)\"\r\n (rowDataBound)=\"_rowDataBound($event)\"\r\n (rowSelecting)=\"_rowSelecting($event)\"\r\n (excelQueryCellInfo)=\"_exportQueryCellInfo($event)\"\r\n (rowDrop)=\"onRowDrop($event)\"\r\n (rowDragStart)=\"_rowDragStart($event)\"\r\n (rowDrag)=\"_rowDrag($event)\"\r\n (load)=\"_load()\"\r\n [frozenColumns]=\"frozenColumns\"\r\n [columnChooserSettings]=\"columnChooserSettings\"\r\n>\r\n <e-columns>\r\n <e-column\r\n *ngIf=\"showCheckBox\"\r\n type=\"checkbox\"\r\n [width]=\"checkBoxWidth\"\r\n [minWidth]=\"checkBoxWidth\"\r\n [showColumnMenu]=\"false\"\r\n [allowResizing]=\"false\"\r\n ></e-column>\r\n <e-column\r\n *ngFor=\"let item of fields; trackBy: trackByFn; let last = last\"\r\n [field]=\"item.columnName\"\r\n [filter]=\"item.filter ? item.filter : { type: 'CheckBox' }\"\r\n [customAttributes]=\"\r\n item.colName === 'entityUserList' || item.colName === 'kycProgress'\r\n ? { class: 'hideColumnFilterClass' }\r\n : {}\r\n \"\r\n [headerText]=\"item.columnDisplayName\"\r\n [textAlign]=\"item.textAlign\"\r\n [showColumnMenu]=\"item.showColumnMenu === undefined ? true : false\"\r\n [allowFiltering]=\"item.allowFiltering === undefined ? true : false\"\r\n [allowSorting]=\"item.allowSorting === undefined ? true : false\"\r\n [showInColumnChooser]=\"\r\n item.showInColumnChooser === undefined ? true : item.showInColumnChooser\r\n \"\r\n [editType]=\"item.editType\"\r\n [validationRules]=\"item.validationRules\"\r\n [type]=\"item.dataType || 'string'\"\r\n [width]=\"item.width\"\r\n [minWidth]=\"item.minWidth\"\r\n [format]=\"item.format\"\r\n [visible]=\"item.visible\"\r\n [template]=\"item.showTemplate ? columnTemplate : undefined\"\r\n [clipMode]=\"\r\n item.clipMode ? item.clipMode : clipMode || 'EllipsisWithTooltip'\r\n \"\r\n [sortComparer]=\"item.dateComparer || null\"\r\n [allowResizing]=\"!last\"\r\n [headerTemplate]=\"item.showHeaderTemplate ? headerTemplate : undefined\"\r\n >\r\n </e-column>\r\n </e-columns>\r\n</ejs-grid>\r\n",
663
663
  styles: [""]
664
664
  }] }
665
665
  ];
@@ -691,6 +691,7 @@ CommonGridComponent.propDecorators = {
691
691
  childGrid: [{ type: Input }],
692
692
  frozenColumns: [{ type: Input }],
693
693
  columnChooserSettings: [{ type: Input }],
694
+ headerTemplate: [{ type: Input }],
694
695
  contextMenuItems: [{ type: Input }],
695
696
  selectionSettings: [{ type: Input }],
696
697
  alwaysShowCheckbox: [{ type: Input }],
@@ -761,6 +762,8 @@ if (false) {
761
762
  CommonGridComponent.prototype.frozenColumns;
762
763
  /** @type {?} */
763
764
  CommonGridComponent.prototype.columnChooserSettings;
765
+ /** @type {?} */
766
+ CommonGridComponent.prototype.headerTemplate;
764
767
  /**
765
768
  * Sample: [
766
769
  * {
@@ -22553,6 +22556,7 @@ class CommonDialogComponent {
22553
22556
  this.showErrorIcon = false;
22554
22557
  this.showZoomBtn = false;
22555
22558
  this.customSave = false;
22559
+ this.customPageTitle = false;
22556
22560
  // 显示相关属性
22557
22561
  this.dialogStyle = {};
22558
22562
  this.size = "";
@@ -22637,7 +22641,7 @@ class CommonDialogComponent {
22637
22641
  CommonDialogComponent.decorators = [
22638
22642
  { type: Component, args: [{
22639
22643
  selector: "rs-common-dialog",
22640
- template: "<div class=\"dialog\" [ngClass]=\"size\" [ngStyle]=\"dialogStyle\">\r\n <!-- \u5934\u90E8 -->\r\n <div *ngIf=\"!hideHeader\" mat-dialog-title class=\"dialog__header\">\r\n <div class=\"header__title\">\r\n <img\r\n src=\"../../../assets/img/notification-status-warning.svg\"\r\n alt=\"\"\r\n *ngIf=\"showErrorIcon\"\r\n />\r\n {{ title }}\r\n <ng-content select=\"[titleSlot]\"></ng-content>\r\n </div>\r\n <div class=\"header__actions\">\r\n <div *ngIf=\"showZoomBtn\" class=\"header-btn\" (click)=\"onZoom()\">\r\n <img\r\n class=\"header-icon\"\r\n *ngIf=\"size === 'largest'\"\r\n src=\"../../../assets/img/dialog-shrink.svg\"\r\n />\r\n <img\r\n class=\"header-icon\"\r\n *ngIf=\"size !== 'largest'\"\r\n src=\"../../../assets/img/dialog-grow.svg\"\r\n />\r\n </div>\r\n <div *ngIf=\"!hideCloseIcon\" class=\"header-btn\" (click)=\"onClose()\">\r\n <img class=\"header-icon\" src=\"../../../assets/img/dialog-close.svg\" />\r\n </div>\r\n </div>\r\n </div>\r\n <!-- \u5185\u5BB9 -->\r\n <div class=\"dialog__content\" mat-dialog-content>\r\n <ng-content></ng-content>\r\n </div>\r\n <!-- \u5E95\u90E8\u6309\u94AE -->\r\n <div mat-dialog-actions class=\"dialog__footer\">\r\n <ng-content select=\"[footerSlot]\"></ng-content>\r\n <!-- \u9ED8\u8BA4\u5C55\u793A\u4FDD\u5B58/\u5173\u95ED\u6309\u94AE -->\r\n <ng-container *ngIf=\"!customFooter\">\r\n <ng-template [ngTemplateOutlet]=\"defaultTemplate\"></ng-template>\r\n </ng-container>\r\n <ng-template #defaultTemplate>\r\n <button *ngIf=\"!hideCloseBtn\" class=\"e-btn\" (click)=\"onClose()\">\r\n {{ cancelBtnLabel }}\r\n </button>\r\n <button *ngIf=\"!hideDiscardBtn\" class=\"e-btn\" (click)=\"onDiscard()\">\r\n {{ discardBtnLabel }}\r\n </button>\r\n <button *ngIf=\"!hideSaveBtn\" class=\"e-btn e-primary\" (click)=\"onSave()\">\r\n {{ saveBtnLabel }}\r\n </button>\r\n </ng-template>\r\n </div>\r\n <!-- loading -->\r\n <div class=\"dialog__loading\" [hidden]=\"!loading\">\r\n <img src=\"../../../assets/img/raise_loading.gif\" alt=\"\" />\r\n </div>\r\n</div>\r\n",
22644
+ template: "<div class=\"dialog\" [ngClass]=\"size\" [ngStyle]=\"dialogStyle\">\r\n <!-- \u5934\u90E8 -->\r\n <div *ngIf=\"!hideHeader\" mat-dialog-title class=\"dialog__header\">\r\n <ng-container *ngIf=\"customPageTitle; else defaultTitle\">\r\n <ng-content select=\"[titleSlot]\"></ng-content>\r\n </ng-container>\r\n <ng-template #defaultTitle>\r\n <div class=\"header__title\">\r\n <img\r\n src=\"../../../assets/img/notification-status-warning.svg\"\r\n alt=\"\"\r\n *ngIf=\"showErrorIcon\"\r\n />\r\n {{ title }}\r\n </div>\r\n </ng-template>\r\n <!-- <div class=\"header__title\">\r\n <img\r\n src=\"../../../assets/img/notification-status-warning.svg\"\r\n alt=\"\"\r\n *ngIf=\"showErrorIcon\"\r\n />\r\n {{ title }}\r\n <ng-content select=\"[titleSlot]\"></ng-content>\r\n </div> -->\r\n <div class=\"header__actions\">\r\n <div *ngIf=\"showZoomBtn\" class=\"header-btn\" (click)=\"onZoom()\">\r\n <img\r\n class=\"header-icon\"\r\n *ngIf=\"size === 'largest'\"\r\n src=\"../../../assets/img/dialog-shrink.svg\"\r\n />\r\n <img\r\n class=\"header-icon\"\r\n *ngIf=\"size !== 'largest'\"\r\n src=\"../../../assets/img/dialog-grow.svg\"\r\n />\r\n </div>\r\n <div *ngIf=\"!hideCloseIcon\" class=\"header-btn\" (click)=\"onClose()\">\r\n <img class=\"header-icon\" src=\"../../../assets/img/dialog-close.svg\" />\r\n </div>\r\n </div>\r\n </div>\r\n <!-- \u5185\u5BB9 -->\r\n <div class=\"dialog__content\" mat-dialog-content>\r\n <ng-content></ng-content>\r\n </div>\r\n <!-- \u5E95\u90E8\u6309\u94AE -->\r\n <div mat-dialog-actions class=\"dialog__footer\">\r\n <ng-content select=\"[footerSlot]\"></ng-content>\r\n <!-- \u9ED8\u8BA4\u5C55\u793A\u4FDD\u5B58/\u5173\u95ED\u6309\u94AE -->\r\n <ng-container *ngIf=\"!customFooter\">\r\n <ng-template [ngTemplateOutlet]=\"defaultTemplate\"></ng-template>\r\n </ng-container>\r\n <ng-template #defaultTemplate>\r\n <button *ngIf=\"!hideCloseBtn\" class=\"e-btn\" (click)=\"onClose()\">\r\n {{ cancelBtnLabel }}\r\n </button>\r\n <button *ngIf=\"!hideDiscardBtn\" class=\"e-btn\" (click)=\"onDiscard()\">\r\n {{ discardBtnLabel }}\r\n </button>\r\n <button *ngIf=\"!hideSaveBtn\" class=\"e-btn e-primary\" (click)=\"onSave()\">\r\n {{ saveBtnLabel }}\r\n </button>\r\n </ng-template>\r\n </div>\r\n <!-- loading -->\r\n <div class=\"dialog__loading\" [hidden]=\"!loading\">\r\n <img src=\"../../../assets/img/raise_loading.gif\" alt=\"\" />\r\n </div>\r\n</div>\r\n",
22641
22645
  styles: [":host::ng-deep .dialog{position:relative;max-height:90vh;font-weight:400;padding:20px;overflow:hidden;display:flex;flex-direction:column}:host::ng-deep .dialog.largest{width:96vw!important;height:88vh!important;max-width:2100px;padding:20px}:host::ng-deep .dialog.medium{width:500px;padding:20px}:host::ng-deep .dialog.small{width:350px;padding:20px 16px}:host::ng-deep .dialog.small .dialog__header{color:#002c4f;margin-bottom:16px}:host::ng-deep .dialog.small .dialog__header .header__title{font-size:13px;line-height:16px}:host::ng-deep .dialog.small .dialog__content{font-size:12px;line-height:16px}:host::ng-deep .dialog.small .dialog__footer{min-height:42px;padding:16px 0 0;font-size:12px;line-height:14px}:host::ng-deep .dialog.small .dialog__footer button{padding:6px 12px;min-width:60px}:host::ng-deep .dialog.large{width:800px;padding:20px}:host::ng-deep .dialog .dialog__header{width:100%;display:flex;justify-content:space-between;align-items:center;padding:0}:host::ng-deep .dialog .dialog__header::before{display:none}:host::ng-deep .dialog .dialog__header .header__title{color:#002c4f;font-family:Arial;font-size:15px;font-weight:700;line-height:18px;flex:1;overflow:hidden;display:flex;align-items:center;gap:8px}:host::ng-deep .dialog .dialog__header .header__actions{display:flex;align-items:center;gap:20px}:host::ng-deep .dialog .dialog__header .header-icon{display:block}:host::ng-deep .dialog .dialog__header .header-btn{cursor:pointer;padding:2px;display:flex;justify-content:center;align-items:center}:host::ng-deep .dialog .dialog__content{width:100%;min-height:38px;position:relative;overflow-y:auto;overflow-x:hidden;margin:0;padding:0;font-size:13px;line-height:19px;flex:1;height:0}:host::ng-deep .dialog .dialog__footer{position:relative;display:flex;align-items:center;justify-content:flex-end;gap:12px;padding:20px 0 0;font-size:13px;line-height:16px;margin-bottom:0}:host::ng-deep .dialog .dialog__loading{height:100%;background:0 0;position:fixed;top:0;left:0;right:0;bottom:0;z-index:9999}:host::ng-deep .dialog .dialog__loading img{position:absolute;left:50%;top:50%;width:40px;height:40px;transform:translate(-50%,-50%)}"]
22642
22646
  }] }
22643
22647
  ];
@@ -22657,6 +22661,7 @@ CommonDialogComponent.propDecorators = {
22657
22661
  showErrorIcon: [{ type: Input }],
22658
22662
  showZoomBtn: [{ type: Input }],
22659
22663
  customSave: [{ type: Input }],
22664
+ customPageTitle: [{ type: Input }],
22660
22665
  onCloseRequest: [{ type: Input }],
22661
22666
  dialogStyle: [{ type: Input }],
22662
22667
  size: [{ type: Input }],
@@ -22692,6 +22697,8 @@ if (false) {
22692
22697
  /** @type {?} */
22693
22698
  CommonDialogComponent.prototype.customSave;
22694
22699
  /** @type {?} */
22700
+ CommonDialogComponent.prototype.customPageTitle;
22701
+ /** @type {?} */
22695
22702
  CommonDialogComponent.prototype.onCloseRequest;
22696
22703
  /** @type {?} */
22697
22704
  CommonDialogComponent.prototype.dialogStyle;
@@ -22715,6 +22722,1064 @@ if (false) {
22715
22722
  CommonDialogComponent.prototype.dialogRef;
22716
22723
  }
22717
22724
 
22725
+ /**
22726
+ * @fileoverview added by tsickle
22727
+ * Generated from: lib/smart-popup/index.component.ts
22728
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
22729
+ */
22730
+ class SmartPopupComponent {
22731
+ /**
22732
+ * @param {?} ref
22733
+ */
22734
+ constructor(ref) {
22735
+ this.ref = ref;
22736
+ this._placement = "BottomLeft";
22737
+ this._offset = 8;
22738
+ this._autoAdjust = "yes";
22739
+ this.triggerElementRef = null;
22740
+ this.loading = false;
22741
+ this._open = false;
22742
+ this._width = null;
22743
+ this._height = null;
22744
+ this.openChange = new EventEmitter();
22745
+ this.contentLoad = new EventEmitter();
22746
+ this.currentTriggerElement = null;
22747
+ this.FIXED_CONTAINER_ID = "rs-smart-popup-fixed-container";
22748
+ this.opened = "no";
22749
+ this.positioning = "no";
22750
+ this.actualPlacement = "bottom";
22751
+ this.actualPosition = "start";
22752
+ this.onClickOutside = (/**
22753
+ * @param {?} event
22754
+ * @return {?}
22755
+ */
22756
+ (event) => {
22757
+ /** @type {?} */
22758
+ const target = (/** @type {?} */ (event.target));
22759
+ /** @type {?} */
22760
+ const isClickOnTrigger = this.currentTriggerElement && this.currentTriggerElement.contains(target);
22761
+ /** @type {?} */
22762
+ const isClickOnPopup = this.popupElement &&
22763
+ this.popupElement.nativeElement &&
22764
+ this.popupElement.nativeElement.contains(target);
22765
+ if (!isClickOnTrigger && !isClickOnPopup) {
22766
+ this.close();
22767
+ }
22768
+ });
22769
+ this.onWindowScroll = (/**
22770
+ * @return {?}
22771
+ */
22772
+ () => {
22773
+ if (this.opened === "yes") {
22774
+ this.updatePopupPosition();
22775
+ }
22776
+ });
22777
+ }
22778
+ // 解析placement格式
22779
+ /**
22780
+ * @return {?}
22781
+ */
22782
+ get placementInfo() {
22783
+ /** @type {?} */
22784
+ const placementMap = {
22785
+ TopLeft: { placement: "top", position: "start" },
22786
+ TopCenter: { placement: "top", position: "center" },
22787
+ TopRight: { placement: "top", position: "end" },
22788
+ BottomLeft: { placement: "bottom", position: "start" },
22789
+ BottomCenter: { placement: "bottom", position: "center" },
22790
+ BottomRight: { placement: "bottom", position: "end" },
22791
+ LeftTop: { placement: "left", position: "start" },
22792
+ LeftCenter: { placement: "left", position: "center" },
22793
+ LeftBottom: { placement: "left", position: "end" },
22794
+ RightTop: { placement: "right", position: "start" },
22795
+ RightCenter: { placement: "right", position: "center" },
22796
+ RightBottom: { placement: "right", position: "end" },
22797
+ };
22798
+ return (placementMap[this._placement] || {
22799
+ placement: "bottom",
22800
+ position: "start",
22801
+ });
22802
+ }
22803
+ /**
22804
+ * @return {?}
22805
+ */
22806
+ get offset() {
22807
+ return this._offset || 8;
22808
+ }
22809
+ /**
22810
+ * @return {?}
22811
+ */
22812
+ get autoAdjust() {
22813
+ return this._autoAdjust === "yes";
22814
+ }
22815
+ /**
22816
+ * @return {?}
22817
+ */
22818
+ ngAfterViewInit() {
22819
+ this.fixedContainerEl = this.getFixedContainer();
22820
+ this.fixedContainerEl.append(this.popupElement.nativeElement);
22821
+ this.updateTriggerElement();
22822
+ // 如果提供了固定尺寸,立即应用
22823
+ if (this._width !== null &&
22824
+ this._height !== null &&
22825
+ this.popupElement &&
22826
+ this.popupElement.nativeElement) {
22827
+ /** @type {?} */
22828
+ const popupEl = this.popupElement.nativeElement;
22829
+ popupEl.style.width = this._width + "px";
22830
+ popupEl.style.height = this._height + "px";
22831
+ popupEl.style.minWidth = this._width + "px";
22832
+ popupEl.style.maxWidth = this._width + "px";
22833
+ popupEl.style.minHeight = this._height + "px";
22834
+ popupEl.style.maxHeight = this._height + "px";
22835
+ }
22836
+ // 如果外部传入 open 属性为 true,自动打开
22837
+ if (this._open) {
22838
+ setTimeout((/**
22839
+ * @return {?}
22840
+ */
22841
+ () => this.open()), 0);
22842
+ }
22843
+ }
22844
+ /**
22845
+ * @param {?} changes
22846
+ * @return {?}
22847
+ */
22848
+ ngOnChanges(changes) {
22849
+ // 处理固定尺寸变化
22850
+ if ((changes._width || changes._height) &&
22851
+ this.popupElement &&
22852
+ this.popupElement.nativeElement) {
22853
+ /** @type {?} */
22854
+ const popupEl = this.popupElement.nativeElement;
22855
+ if (this._width !== null) {
22856
+ popupEl.style.width = this._width + "px";
22857
+ popupEl.style.minWidth = this._width + "px";
22858
+ popupEl.style.maxWidth = this._width + "px";
22859
+ }
22860
+ if (this._height !== null) {
22861
+ popupEl.style.height = this._height + "px";
22862
+ popupEl.style.minHeight = this._height + "px";
22863
+ popupEl.style.maxHeight = this._height + "px";
22864
+ }
22865
+ }
22866
+ // 先处理触发元素变化(确保在打开前更新触发元素)
22867
+ if (changes.triggerElementRef) {
22868
+ /** @type {?} */
22869
+ const previousTrigger = this.currentTriggerElement;
22870
+ this.updateTriggerElement();
22871
+ // 如果弹窗已经打开,且触发元素发生了变化,立即更新位置
22872
+ if (this.opened === "yes" &&
22873
+ previousTrigger !== this.currentTriggerElement &&
22874
+ this.currentTriggerElement) {
22875
+ // 使用新的打开方式更新位置
22876
+ this.positioning = "yes";
22877
+ this.ref.markForCheck();
22878
+ requestAnimationFrame((/**
22879
+ * @return {?}
22880
+ */
22881
+ () => {
22882
+ requestAnimationFrame((/**
22883
+ * @return {?}
22884
+ */
22885
+ () => {
22886
+ this.updatePopupPosition();
22887
+ this.positioning = "no";
22888
+ this.ref.markForCheck();
22889
+ }));
22890
+ }));
22891
+ }
22892
+ }
22893
+ // 处理 open 变化(确保在触发元素更新后处理)
22894
+ if (changes._open) {
22895
+ if (this._open && this.opened === "no") {
22896
+ // 确保触发元素已更新
22897
+ this.updateTriggerElement();
22898
+ // 使用 setTimeout 确保所有变更都已处理
22899
+ setTimeout((/**
22900
+ * @return {?}
22901
+ */
22902
+ () => {
22903
+ // 再次确保触发元素已更新
22904
+ this.updateTriggerElement();
22905
+ this.open();
22906
+ }), 0);
22907
+ }
22908
+ else if (!this._open && this.opened === "yes") {
22909
+ this.close();
22910
+ }
22911
+ }
22912
+ // 当加载完成时,更新位置(如果提供了固定尺寸,不需要更新位置)
22913
+ if (changes.loading &&
22914
+ !changes.loading.currentValue &&
22915
+ changes.loading.previousValue) {
22916
+ if (this.opened === "yes") {
22917
+ // 如果提供了固定尺寸,位置已经计算好了,不需要更新
22918
+ if (this._width !== null && this._height !== null) {
22919
+ this.contentLoad.emit();
22920
+ }
22921
+ else {
22922
+ // 如果正在定位,不需要更新位置
22923
+ if (this.positioning === "no") {
22924
+ requestAnimationFrame((/**
22925
+ * @return {?}
22926
+ */
22927
+ () => {
22928
+ this.updatePopupPosition();
22929
+ this.contentLoad.emit();
22930
+ }));
22931
+ }
22932
+ else {
22933
+ // 如果正在定位,等待定位完成后再触发事件
22934
+ /** @type {?} */
22935
+ const checkPositioning = (/**
22936
+ * @return {?}
22937
+ */
22938
+ () => {
22939
+ if (this.positioning === "no") {
22940
+ this.contentLoad.emit();
22941
+ }
22942
+ else {
22943
+ setTimeout(checkPositioning, 10);
22944
+ }
22945
+ });
22946
+ checkPositioning();
22947
+ }
22948
+ }
22949
+ }
22950
+ }
22951
+ }
22952
+ /**
22953
+ * @return {?}
22954
+ */
22955
+ ngOnDestroy() {
22956
+ if (this.popupElement && this.popupElement.nativeElement) {
22957
+ this.popupElement.nativeElement.remove();
22958
+ }
22959
+ window.removeEventListener("click", this.onClickOutside);
22960
+ window.removeEventListener("scroll", this.onWindowScroll, true);
22961
+ }
22962
+ /**
22963
+ * @return {?}
22964
+ */
22965
+ updateTriggerElement() {
22966
+ if (this.triggerElementRef) {
22967
+ this.currentTriggerElement = this.triggerElementRef;
22968
+ }
22969
+ else if (this.internalTriggerElement &&
22970
+ this.internalTriggerElement.nativeElement) {
22971
+ this.currentTriggerElement = this.internalTriggerElement.nativeElement;
22972
+ }
22973
+ else {
22974
+ this.currentTriggerElement = null;
22975
+ }
22976
+ }
22977
+ /**
22978
+ * @return {?}
22979
+ */
22980
+ getFixedContainer() {
22981
+ /** @type {?} */
22982
+ let containerElement = document.getElementById(this.FIXED_CONTAINER_ID);
22983
+ if (!containerElement) {
22984
+ containerElement = document.createElement("div");
22985
+ containerElement.setAttribute("id", this.FIXED_CONTAINER_ID);
22986
+ document.body.append(containerElement);
22987
+ }
22988
+ return containerElement;
22989
+ }
22990
+ /**
22991
+ * @param {?=} triggerElement
22992
+ * @return {?}
22993
+ */
22994
+ open(triggerElement) {
22995
+ // 如果传入了触发元素,使用它
22996
+ if (triggerElement) {
22997
+ this.currentTriggerElement = triggerElement;
22998
+ }
22999
+ else {
23000
+ this.updateTriggerElement();
23001
+ }
23002
+ if (!this.currentTriggerElement) {
23003
+ console.warn("SmartPopupComponent: No trigger element found");
23004
+ return;
23005
+ }
23006
+ // 如果已经打开,先关闭再打开(更新位置)
23007
+ if (this.opened === "yes") {
23008
+ // 先关闭弹窗
23009
+ this.opened = "no";
23010
+ this.positioning = "no";
23011
+ this.ref.markForCheck();
23012
+ // 立即在新位置打开
23013
+ requestAnimationFrame((/**
23014
+ * @return {?}
23015
+ */
23016
+ () => {
23017
+ // 再次确保触发元素已更新
23018
+ this.updateTriggerElement();
23019
+ this.openPopup();
23020
+ }));
23021
+ return;
23022
+ }
23023
+ // 确保触发元素已更新
23024
+ this.updateTriggerElement();
23025
+ this.openPopup();
23026
+ }
23027
+ /**
23028
+ * @private
23029
+ * @return {?}
23030
+ */
23031
+ openPopup() {
23032
+ // 再次确保触发元素已更新
23033
+ this.updateTriggerElement();
23034
+ if (!this.currentTriggerElement) {
23035
+ console.warn("SmartPopupComponent: No trigger element found when opening popup");
23036
+ return;
23037
+ }
23038
+ // 如果提供了固定尺寸,可以在打开前就计算好位置
23039
+ if (this._width !== null && this._height !== null) {
23040
+ // 先计算位置(不依赖DOM渲染,直接根据triggerElement计算)
23041
+ /** @type {?} */
23042
+ const triggerRect = this.currentTriggerElement.getBoundingClientRect();
23043
+ /** @type {?} */
23044
+ const viewportWidth = window.innerWidth;
23045
+ /** @type {?} */
23046
+ const viewportHeight = window.innerHeight;
23047
+ /** @type {?} */
23048
+ const popupSize = {
23049
+ width: this._width,
23050
+ height: this._height,
23051
+ };
23052
+ /** @type {?} */
23053
+ const popupRect = (/** @type {?} */ ({
23054
+ width: popupSize.width,
23055
+ height: popupSize.height,
23056
+ top: 0,
23057
+ left: 0,
23058
+ right: popupSize.width,
23059
+ bottom: popupSize.height,
23060
+ x: 0,
23061
+ y: 0,
23062
+ toJSON: (/**
23063
+ * @return {?}
23064
+ */
23065
+ () => ({})),
23066
+ }));
23067
+ /** @type {?} */
23068
+ const targetInfo = this.placementInfo;
23069
+ /** @type {?} */
23070
+ let finalPlacement = targetInfo.placement;
23071
+ /** @type {?} */
23072
+ let finalPosition = targetInfo.position;
23073
+ if (this.autoAdjust) {
23074
+ /** @type {?} */
23075
+ const optimal = this.calculateOptimalPlacement(triggerRect, popupRect, viewportWidth, viewportHeight);
23076
+ finalPlacement = optimal.placement;
23077
+ finalPosition = optimal.position;
23078
+ }
23079
+ this.actualPlacement = finalPlacement;
23080
+ this.actualPosition = finalPosition;
23081
+ // 计算位置坐标(不依赖DOM,直接计算)
23082
+ /** @type {?} */
23083
+ const position = this.calculatePositionCoordinates(triggerRect, finalPlacement, finalPosition, popupSize);
23084
+ // 先设置打开状态,但保持隐藏(positioning = yes)
23085
+ this.opened = "yes";
23086
+ this.positioning = "yes";
23087
+ this.openChange.emit(true);
23088
+ this.ref.markForCheck();
23089
+ // 强制更新视图,确保DOM已更新
23090
+ this.ref.detectChanges();
23091
+ // 如果元素已经存在,立即设置位置(不等待 requestAnimationFrame)
23092
+ if (this.popupElement && this.popupElement.nativeElement) {
23093
+ /** @type {?} */
23094
+ const popupEl = this.popupElement.nativeElement;
23095
+ // 立即设置尺寸和位置
23096
+ popupEl.style.width = this._width + "px";
23097
+ popupEl.style.height = this._height + "px";
23098
+ popupEl.style.minWidth = this._width + "px";
23099
+ popupEl.style.maxWidth = this._width + "px";
23100
+ popupEl.style.minHeight = this._height + "px";
23101
+ popupEl.style.maxHeight = this._height + "px";
23102
+ popupEl.style.top = position.top;
23103
+ popupEl.style.left = position.left;
23104
+ popupEl.style.transform = `translate(${position.translateX}, ${position.translateY})`;
23105
+ // 强制同步应用样式
23106
+ popupEl.offsetHeight;
23107
+ // 位置设置完成后,立即显示弹窗
23108
+ this.positioning = "no";
23109
+ this.ref.markForCheck();
23110
+ }
23111
+ else {
23112
+ // 如果元素还不存在,等待渲染
23113
+ requestAnimationFrame((/**
23114
+ * @return {?}
23115
+ */
23116
+ () => {
23117
+ if (this.popupElement && this.popupElement.nativeElement) {
23118
+ /** @type {?} */
23119
+ const popupEl = this.popupElement.nativeElement;
23120
+ // 立即设置尺寸和位置
23121
+ popupEl.style.width = this._width + "px";
23122
+ popupEl.style.height = this._height + "px";
23123
+ popupEl.style.minWidth = this._width + "px";
23124
+ popupEl.style.maxWidth = this._width + "px";
23125
+ popupEl.style.minHeight = this._height + "px";
23126
+ popupEl.style.maxHeight = this._height + "px";
23127
+ popupEl.style.top = position.top;
23128
+ popupEl.style.left = position.left;
23129
+ popupEl.style.transform = `translate(${position.translateX}, ${position.translateY})`;
23130
+ // 强制同步应用样式
23131
+ popupEl.offsetHeight;
23132
+ // 位置设置完成后,立即显示弹窗
23133
+ this.positioning = "no";
23134
+ this.ref.markForCheck();
23135
+ }
23136
+ }));
23137
+ }
23138
+ }
23139
+ else {
23140
+ // 没有固定尺寸,需要等待DOM渲染
23141
+ this.positioning = "yes";
23142
+ this.ref.markForCheck();
23143
+ // 立即强制更新视图,确保DOM已更新
23144
+ this.ref.detectChanges();
23145
+ // 使用 requestAnimationFrame 确保在浏览器渲染之前更新位置
23146
+ requestAnimationFrame((/**
23147
+ * @return {?}
23148
+ */
23149
+ () => {
23150
+ // 确保元素已渲染并获取尺寸
23151
+ if (this.popupElement && this.popupElement.nativeElement) {
23152
+ // 强制重新计算布局,确保元素尺寸已计算
23153
+ this.popupElement.nativeElement.offsetHeight;
23154
+ // 计算并设置位置
23155
+ this.updatePopupPosition();
23156
+ // 位置设置完成后,移除定位状态,显示弹窗
23157
+ this.positioning = "no";
23158
+ this.ref.markForCheck();
23159
+ }
23160
+ }));
23161
+ }
23162
+ window.addEventListener("click", this.onClickOutside);
23163
+ window.addEventListener("scroll", this.onWindowScroll, true);
23164
+ }
23165
+ /**
23166
+ * @return {?}
23167
+ */
23168
+ close() {
23169
+ if (this.opened === "no") {
23170
+ return;
23171
+ }
23172
+ this.opened = "no";
23173
+ this.positioning = "no";
23174
+ this.openChange.emit(false);
23175
+ window.removeEventListener("click", this.onClickOutside);
23176
+ window.removeEventListener("scroll", this.onWindowScroll, true);
23177
+ this.ref.markForCheck();
23178
+ }
23179
+ /**
23180
+ * @return {?}
23181
+ */
23182
+ toggle() {
23183
+ if (this.opened === "yes") {
23184
+ this.close();
23185
+ }
23186
+ else {
23187
+ this.open();
23188
+ }
23189
+ }
23190
+ /**
23191
+ * @param {?} event
23192
+ * @return {?}
23193
+ */
23194
+ onClickTrigger(event) {
23195
+ event.stopPropagation();
23196
+ this.toggle();
23197
+ }
23198
+ // 计算并设置位置(支持固定尺寸,可在打开前调用)
23199
+ /**
23200
+ * @private
23201
+ * @return {?}
23202
+ */
23203
+ calculateAndSetPosition() {
23204
+ if (!this.currentTriggerElement) {
23205
+ return;
23206
+ }
23207
+ /** @type {?} */
23208
+ const triggerRect = this.currentTriggerElement.getBoundingClientRect();
23209
+ /** @type {?} */
23210
+ const viewportWidth = window.innerWidth;
23211
+ /** @type {?} */
23212
+ const viewportHeight = window.innerHeight;
23213
+ // 获取弹窗尺寸(优先使用固定尺寸)
23214
+ /** @type {?} */
23215
+ const popupSize = {
23216
+ width: this._width !== null
23217
+ ? this._width
23218
+ : this.popupElement && this.popupElement.nativeElement
23219
+ ? this.popupElement.nativeElement.offsetWidth
23220
+ : 300,
23221
+ height: this._height !== null
23222
+ ? this._height
23223
+ : this.popupElement && this.popupElement.nativeElement
23224
+ ? this.popupElement.nativeElement.offsetHeight
23225
+ : 200,
23226
+ };
23227
+ // 创建虚拟的 popupRect(用于计算)
23228
+ /** @type {?} */
23229
+ const popupRect = (/** @type {?} */ ({
23230
+ width: popupSize.width,
23231
+ height: popupSize.height,
23232
+ top: 0,
23233
+ left: 0,
23234
+ right: popupSize.width,
23235
+ bottom: popupSize.height,
23236
+ x: 0,
23237
+ y: 0,
23238
+ toJSON: (/**
23239
+ * @return {?}
23240
+ */
23241
+ () => ({})),
23242
+ }));
23243
+ // 获取目标位置信息
23244
+ /** @type {?} */
23245
+ const targetInfo = this.placementInfo;
23246
+ /** @type {?} */
23247
+ let finalPlacement = targetInfo.placement;
23248
+ /** @type {?} */
23249
+ let finalPosition = targetInfo.position;
23250
+ if (this.autoAdjust) {
23251
+ /** @type {?} */
23252
+ const optimal = this.calculateOptimalPlacement(triggerRect, popupRect, viewportWidth, viewportHeight);
23253
+ finalPlacement = optimal.placement;
23254
+ finalPosition = optimal.position;
23255
+ }
23256
+ this.actualPlacement = finalPlacement;
23257
+ this.actualPosition = finalPosition;
23258
+ // 立即设置位置(即使元素还没完全渲染,也要先设置位置)
23259
+ if (this.popupElement && this.popupElement.nativeElement) {
23260
+ this.setPopupPosition(triggerRect, popupRect, finalPlacement, finalPosition, popupSize);
23261
+ // 强制应用样式,确保位置立即生效
23262
+ this.ref.detectChanges();
23263
+ }
23264
+ else {
23265
+ // 如果元素还不存在,延迟设置位置
23266
+ setTimeout((/**
23267
+ * @return {?}
23268
+ */
23269
+ () => {
23270
+ if (this.popupElement && this.popupElement.nativeElement) {
23271
+ this.setPopupPosition(triggerRect, popupRect, finalPlacement, finalPosition, popupSize);
23272
+ this.ref.detectChanges();
23273
+ }
23274
+ }), 0);
23275
+ }
23276
+ this.ref.markForCheck();
23277
+ }
23278
+ /**
23279
+ * @return {?}
23280
+ */
23281
+ updatePopupPosition() {
23282
+ if (!this.currentTriggerElement ||
23283
+ !this.popupElement ||
23284
+ !this.popupElement.nativeElement) {
23285
+ return;
23286
+ }
23287
+ // 如果提供了固定尺寸,使用固定尺寸计算
23288
+ if (this._width !== null && this._height !== null) {
23289
+ this.calculateAndSetPosition();
23290
+ return;
23291
+ }
23292
+ /** @type {?} */
23293
+ const triggerRect = this.currentTriggerElement.getBoundingClientRect();
23294
+ /** @type {?} */
23295
+ const popupRect = this.popupElement.nativeElement.getBoundingClientRect();
23296
+ /** @type {?} */
23297
+ const viewportWidth = window.innerWidth;
23298
+ /** @type {?} */
23299
+ const viewportHeight = window.innerHeight;
23300
+ // 获取目标位置信息
23301
+ /** @type {?} */
23302
+ const targetInfo = this.placementInfo;
23303
+ /** @type {?} */
23304
+ let finalPlacement = targetInfo.placement;
23305
+ /** @type {?} */
23306
+ let finalPosition = targetInfo.position;
23307
+ if (this.autoAdjust) {
23308
+ /** @type {?} */
23309
+ const optimal = this.calculateOptimalPlacement(triggerRect, popupRect, viewportWidth, viewportHeight);
23310
+ finalPlacement = optimal.placement;
23311
+ finalPosition = optimal.position;
23312
+ }
23313
+ this.actualPlacement = finalPlacement;
23314
+ this.actualPosition = finalPosition;
23315
+ this.setPopupPosition(triggerRect, popupRect, finalPlacement, finalPosition);
23316
+ this.ref.markForCheck();
23317
+ }
23318
+ /**
23319
+ * @param {?} triggerRect
23320
+ * @param {?} popupRect
23321
+ * @param {?} viewportWidth
23322
+ * @param {?} viewportHeight
23323
+ * @return {?}
23324
+ */
23325
+ calculateOptimalPlacement(triggerRect, popupRect, viewportWidth, viewportHeight) {
23326
+ /** @type {?} */
23327
+ const targetInfo = this.placementInfo;
23328
+ /** @type {?} */
23329
+ const preferred = targetInfo.placement;
23330
+ /** @type {?} */
23331
+ const preferredPosition = targetInfo.position;
23332
+ /** @type {?} */
23333
+ const space = {
23334
+ top: triggerRect.top,
23335
+ bottom: viewportHeight - triggerRect.bottom,
23336
+ left: triggerRect.left,
23337
+ right: viewportWidth - triggerRect.right,
23338
+ };
23339
+ /** @type {?} */
23340
+ const popupSize = {
23341
+ width: popupRect.width || 300,
23342
+ // 默认宽度,如果还没有渲染
23343
+ height: popupRect.height || 200,
23344
+ };
23345
+ // 检查首选位置是否有足够空间
23346
+ /** @type {?} */
23347
+ const hasEnoughSpace = (/**
23348
+ * @param {?} placement
23349
+ * @return {?}
23350
+ */
23351
+ (placement) => {
23352
+ switch (placement) {
23353
+ case "top":
23354
+ return space.top >= popupSize.height + this.offset;
23355
+ case "bottom":
23356
+ return space.bottom >= popupSize.height + this.offset;
23357
+ case "left":
23358
+ return space.left >= popupSize.width + this.offset;
23359
+ case "right":
23360
+ return space.right >= popupSize.width + this.offset;
23361
+ }
23362
+ });
23363
+ // 检查指定位置是否有足够空间
23364
+ /** @type {?} */
23365
+ const checkPositionSpace = (/**
23366
+ * @param {?} placement
23367
+ * @param {?} position
23368
+ * @return {?}
23369
+ */
23370
+ (placement, position) => {
23371
+ if (placement === "top" || placement === "bottom") {
23372
+ // 对于上下位置,检查水平对齐空间
23373
+ /** @type {?} */
23374
+ const popupWidth = popupSize.width;
23375
+ /** @type {?} */
23376
+ const spaceLeft = triggerRect.left;
23377
+ /** @type {?} */
23378
+ const spaceRight = viewportWidth - triggerRect.right;
23379
+ if (position === "center") {
23380
+ return spaceLeft >= popupWidth / 2 && spaceRight >= popupWidth / 2;
23381
+ }
23382
+ else if (position === "start") {
23383
+ return spaceLeft >= popupWidth;
23384
+ }
23385
+ else {
23386
+ // end
23387
+ return spaceRight >= popupWidth;
23388
+ }
23389
+ }
23390
+ else {
23391
+ // 对于左右位置,检查垂直对齐空间
23392
+ /** @type {?} */
23393
+ const popupHeight = popupSize.height;
23394
+ /** @type {?} */
23395
+ const spaceTop = triggerRect.top;
23396
+ /** @type {?} */
23397
+ const spaceBottom = viewportHeight - triggerRect.bottom;
23398
+ if (position === "center") {
23399
+ return spaceTop >= popupHeight / 2 && spaceBottom >= popupHeight / 2;
23400
+ }
23401
+ else if (position === "start") {
23402
+ return spaceTop >= popupHeight;
23403
+ }
23404
+ else {
23405
+ // end
23406
+ return spaceBottom >= popupHeight;
23407
+ }
23408
+ }
23409
+ });
23410
+ // 计算位置是否合适(考虑水平/垂直对齐)
23411
+ /** @type {?} */
23412
+ const calculatePosition = (/**
23413
+ * @param {?} placement
23414
+ * @return {?}
23415
+ */
23416
+ (placement) => {
23417
+ if (placement === "top" || placement === "bottom") {
23418
+ // 对于上下位置,检查水平对齐
23419
+ /** @type {?} */
23420
+ const popupWidth = popupSize.width;
23421
+ /** @type {?} */
23422
+ const spaceLeft = triggerRect.left;
23423
+ /** @type {?} */
23424
+ const spaceRight = viewportWidth - triggerRect.right;
23425
+ // 优先尝试使用用户指定的position
23426
+ if (checkPositionSpace(placement, preferredPosition)) {
23427
+ return preferredPosition;
23428
+ }
23429
+ // 如果中心对齐有足够空间,优先使用中心
23430
+ if (spaceLeft >= popupWidth / 2 && spaceRight >= popupWidth / 2) {
23431
+ return "center";
23432
+ }
23433
+ // 如果左侧空间不足,使用右对齐
23434
+ if (spaceLeft < popupWidth / 2) {
23435
+ return "end";
23436
+ }
23437
+ // 如果右侧空间不足,使用左对齐
23438
+ if (spaceRight < popupWidth / 2) {
23439
+ return "start";
23440
+ }
23441
+ return preferredPosition;
23442
+ }
23443
+ else {
23444
+ // 对于左右位置,检查垂直对齐
23445
+ /** @type {?} */
23446
+ const popupHeight = popupSize.height;
23447
+ /** @type {?} */
23448
+ const spaceTop = triggerRect.top;
23449
+ /** @type {?} */
23450
+ const spaceBottom = viewportHeight - triggerRect.bottom;
23451
+ // 优先尝试使用用户指定的position
23452
+ if (checkPositionSpace(placement, preferredPosition)) {
23453
+ return preferredPosition;
23454
+ }
23455
+ // 如果中心对齐有足够空间,优先使用中心
23456
+ if (spaceTop >= popupHeight / 2 && spaceBottom >= popupHeight / 2) {
23457
+ return "center";
23458
+ }
23459
+ // 如果上方空间不足,使用下对齐
23460
+ if (spaceTop < popupHeight / 2) {
23461
+ return "end";
23462
+ }
23463
+ // 如果下方空间不足,使用上对齐
23464
+ if (spaceBottom < popupHeight / 2) {
23465
+ return "start";
23466
+ }
23467
+ return preferredPosition;
23468
+ }
23469
+ });
23470
+ // 如果首选位置有足够空间,优先使用用户指定的position
23471
+ if (hasEnoughSpace(preferred)) {
23472
+ // 检查用户指定的position是否有足够空间
23473
+ if (checkPositionSpace(preferred, preferredPosition)) {
23474
+ return {
23475
+ placement: preferred,
23476
+ position: preferredPosition,
23477
+ };
23478
+ }
23479
+ // 如果指定的position空间不足,自动计算最佳position
23480
+ return {
23481
+ placement: preferred,
23482
+ position: calculatePosition(preferred),
23483
+ };
23484
+ }
23485
+ // 根据首选位置选择备选位置
23486
+ /** @type {?} */
23487
+ const alternatives = {
23488
+ bottom: ["top", "right", "left"],
23489
+ top: ["bottom", "right", "left"],
23490
+ right: ["left", "bottom", "top"],
23491
+ left: ["right", "bottom", "top"],
23492
+ };
23493
+ /** @type {?} */
23494
+ const altList = alternatives[preferred] || [];
23495
+ // 尝试找到第一个有足够空间的备选位置
23496
+ for (const alt of altList) {
23497
+ if (hasEnoughSpace(alt)) {
23498
+ return {
23499
+ placement: alt,
23500
+ position: calculatePosition(alt),
23501
+ };
23502
+ }
23503
+ }
23504
+ // 如果都没有足够空间,选择空间最大的位置
23505
+ /** @type {?} */
23506
+ const maxSpace = Math.max(space.top, space.bottom, space.left, space.right);
23507
+ /** @type {?} */
23508
+ let bestPlacement;
23509
+ if (maxSpace === space.top)
23510
+ bestPlacement = "top";
23511
+ else if (maxSpace === space.bottom)
23512
+ bestPlacement = "bottom";
23513
+ else if (maxSpace === space.left)
23514
+ bestPlacement = "left";
23515
+ else
23516
+ bestPlacement = "right";
23517
+ return {
23518
+ placement: bestPlacement,
23519
+ position: calculatePosition(bestPlacement),
23520
+ };
23521
+ }
23522
+ // 计算位置坐标(纯计算,不依赖DOM,包含边界约束)
23523
+ /**
23524
+ * @private
23525
+ * @param {?} triggerRect
23526
+ * @param {?} placement
23527
+ * @param {?} position
23528
+ * @param {?} popupSize
23529
+ * @return {?}
23530
+ */
23531
+ calculatePositionCoordinates(triggerRect, placement, position, popupSize) {
23532
+ /** @type {?} */
23533
+ const triggerWidth = triggerRect.width;
23534
+ /** @type {?} */
23535
+ const triggerHeight = triggerRect.height;
23536
+ /** @type {?} */
23537
+ const viewportWidth = window.innerWidth;
23538
+ /** @type {?} */
23539
+ const viewportHeight = window.innerHeight;
23540
+ /** @type {?} */
23541
+ const scrollX = window.scrollX;
23542
+ /** @type {?} */
23543
+ const scrollY = window.scrollY;
23544
+ /** @type {?} */
23545
+ let top = 0;
23546
+ /** @type {?} */
23547
+ let left = 0;
23548
+ /** @type {?} */
23549
+ let translateX = "0";
23550
+ /** @type {?} */
23551
+ let translateY = "0";
23552
+ switch (placement) {
23553
+ case "top":
23554
+ top = triggerRect.top + scrollY - this.offset;
23555
+ translateY = "-100%";
23556
+ if (position === "start") {
23557
+ left = triggerRect.left + scrollX;
23558
+ }
23559
+ else if (position === "center") {
23560
+ left = triggerRect.left + scrollX + triggerWidth / 2;
23561
+ translateX = "-50%";
23562
+ }
23563
+ else {
23564
+ left = triggerRect.left + scrollX + triggerWidth;
23565
+ translateX = "-100%";
23566
+ }
23567
+ // 边界约束:确保弹窗不超出视口
23568
+ if (top - popupSize.height < scrollY) {
23569
+ top = scrollY + 8; // 距离顶部至少8px
23570
+ }
23571
+ if (left < scrollX) {
23572
+ left = scrollX + 8;
23573
+ translateX = "0";
23574
+ }
23575
+ else if (left + popupSize.width > scrollX + viewportWidth) {
23576
+ left = scrollX + viewportWidth - popupSize.width - 8;
23577
+ translateX = "0";
23578
+ }
23579
+ break;
23580
+ case "bottom":
23581
+ top = triggerRect.bottom + scrollY + this.offset;
23582
+ if (position === "start") {
23583
+ left = triggerRect.left + scrollX;
23584
+ }
23585
+ else if (position === "center") {
23586
+ left = triggerRect.left + scrollX + triggerWidth / 2;
23587
+ translateX = "-50%";
23588
+ }
23589
+ else {
23590
+ left = triggerRect.left + scrollX + triggerWidth;
23591
+ translateX = "-100%";
23592
+ }
23593
+ // 边界约束:确保弹窗不超出视口
23594
+ if (top + popupSize.height > scrollY + viewportHeight) {
23595
+ top = scrollY + viewportHeight - popupSize.height - 8; // 距离底部至少8px
23596
+ }
23597
+ if (left < scrollX) {
23598
+ left = scrollX + 8;
23599
+ translateX = "0";
23600
+ }
23601
+ else if (left + popupSize.width > scrollX + viewportWidth) {
23602
+ left = scrollX + viewportWidth - popupSize.width - 8;
23603
+ translateX = "0";
23604
+ }
23605
+ break;
23606
+ case "left":
23607
+ left = triggerRect.left + scrollX - this.offset;
23608
+ translateX = "-100%";
23609
+ if (position === "start") {
23610
+ top = triggerRect.top + scrollY;
23611
+ }
23612
+ else if (position === "center") {
23613
+ top = triggerRect.top + scrollY + triggerHeight / 2;
23614
+ translateY = "-50%";
23615
+ }
23616
+ else {
23617
+ top = triggerRect.top + scrollY + triggerHeight;
23618
+ translateY = "-100%";
23619
+ }
23620
+ // 边界约束:确保弹窗不超出视口
23621
+ if (left - popupSize.width < scrollX) {
23622
+ left = scrollX + 8; // 距离左侧至少8px
23623
+ }
23624
+ if (top < scrollY) {
23625
+ top = scrollY + 8;
23626
+ translateY = "0";
23627
+ }
23628
+ else if (top + popupSize.height > scrollY + viewportHeight) {
23629
+ top = scrollY + viewportHeight - popupSize.height - 8;
23630
+ translateY = "0";
23631
+ }
23632
+ break;
23633
+ case "right":
23634
+ left = triggerRect.right + scrollX + this.offset;
23635
+ if (position === "start") {
23636
+ top = triggerRect.top + scrollY;
23637
+ }
23638
+ else if (position === "center") {
23639
+ top = triggerRect.top + scrollY + triggerHeight / 2;
23640
+ translateY = "-50%";
23641
+ }
23642
+ else {
23643
+ top = triggerRect.top + scrollY + triggerHeight;
23644
+ translateY = "-100%";
23645
+ }
23646
+ // 边界约束:确保弹窗不超出视口
23647
+ if (left + popupSize.width > scrollX + viewportWidth) {
23648
+ left = scrollX + viewportWidth - popupSize.width - 8; // 距离右侧至少8px
23649
+ }
23650
+ if (top < scrollY) {
23651
+ top = scrollY + 8;
23652
+ translateY = "0";
23653
+ }
23654
+ else if (top + popupSize.height > scrollY + viewportHeight) {
23655
+ top = scrollY + viewportHeight - popupSize.height - 8;
23656
+ translateY = "0";
23657
+ }
23658
+ break;
23659
+ }
23660
+ return {
23661
+ top: top + "px",
23662
+ left: left + "px",
23663
+ translateX,
23664
+ translateY,
23665
+ };
23666
+ }
23667
+ /**
23668
+ * @param {?} triggerRect
23669
+ * @param {?} popupRect
23670
+ * @param {?} placement
23671
+ * @param {?} position
23672
+ * @param {?=} popupSize
23673
+ * @return {?}
23674
+ */
23675
+ setPopupPosition(triggerRect, popupRect, placement, position, popupSize) {
23676
+ /** @type {?} */
23677
+ const popupEl = this.popupElement && this.popupElement.nativeElement
23678
+ ? this.popupElement.nativeElement
23679
+ : null;
23680
+ if (!popupEl) {
23681
+ return; // 如果元素还不存在,无法设置位置
23682
+ }
23683
+ // 优先使用传入的固定尺寸,否则从DOM获取
23684
+ /** @type {?} */
23685
+ const popupWidth = popupSize && popupSize.width !== null && popupSize.width !== undefined
23686
+ ? popupSize.width
23687
+ : popupRect.width || popupEl.offsetWidth || 300;
23688
+ /** @type {?} */
23689
+ const popupHeight = popupSize && popupSize.height !== null && popupSize.height !== undefined
23690
+ ? popupSize.height
23691
+ : popupRect.height || popupEl.offsetHeight || 200;
23692
+ /** @type {?} */
23693
+ const coordinates = this.calculatePositionCoordinates(triggerRect, placement, position, { width: popupWidth, height: popupHeight });
23694
+ popupEl.style.top = coordinates.top;
23695
+ popupEl.style.left = coordinates.left;
23696
+ popupEl.style.transform = `translate(${coordinates.translateX}, ${coordinates.translateY})`;
23697
+ }
23698
+ /**
23699
+ * @return {?}
23700
+ */
23701
+ onWindowResize() {
23702
+ if (this.opened === "yes") {
23703
+ this.updatePopupPosition();
23704
+ }
23705
+ }
23706
+ }
23707
+ SmartPopupComponent.decorators = [
23708
+ { type: Component, args: [{
23709
+ selector: "rs-smart-popup",
23710
+ template: "<!-- \u89E6\u53D1\u5143\u7D20\u63D2\u69FD -->\r\n<ng-container #trigger>\r\n <ng-content select=\"[trigger]\"></ng-content>\r\n</ng-container>\r\n\r\n<!-- \u5F39\u7A97\u5185\u5BB9 -->\r\n<div\r\n #popup\r\n class=\"rs-smart-popup-content\"\r\n [attr.data-opened]=\"opened\"\r\n [attr.data-positioning]=\"positioning\"\r\n>\r\n <div *ngIf=\"loading\" class=\"rs-smart-popup-loading\">\r\n <div class=\"loading-spinner\"></div>\r\n </div>\r\n <div *ngIf=\"!loading\" class=\"rs-smart-popup-body\">\r\n <ng-content></ng-content>\r\n </div>\r\n</div>\r\n\r\n",
23711
+ styles: [".rs-smart-popup-trigger{display:inline-block;cursor:pointer}::ng-deep #rs-smart-popup-fixed-container{width:0;height:0;z-index:100000;pointer-events:none}::ng-deep #rs-smart-popup-fixed-container .rs-smart-popup-content{pointer-events:auto;position:fixed;z-index:100001;padding:8px;border-radius:8px;background:#fff;box-shadow:0 0 8px 0 rgba(0,0,0,.25);min-width:200px;max-width:400px;max-height:500px;overflow:auto}::ng-deep #rs-smart-popup-fixed-container .rs-smart-popup-content[data-opened=no]{display:none}::ng-deep #rs-smart-popup-fixed-container .rs-smart-popup-content[data-opened=yes]{display:block}::ng-deep #rs-smart-popup-fixed-container .rs-smart-popup-content[data-opened=yes][data-positioning=yes]{display:none!important}::ng-deep #rs-smart-popup-fixed-container .rs-smart-popup-content[data-opened=yes][data-positioning=no]{display:block;visibility:visible;opacity:1;pointer-events:auto;-webkit-animation:.2s ease-out popup-fade-in;animation:.2s ease-out popup-fade-in}::ng-deep #rs-smart-popup-fixed-container .rs-smart-popup-content .rs-smart-popup-loading{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:20px;min-height:100px}::ng-deep #rs-smart-popup-fixed-container .rs-smart-popup-content .rs-smart-popup-loading .loading-spinner{width:24px;height:24px;border:3px solid #f3f3f3;border-top:3px solid #3498db;border-radius:50%;-webkit-animation:1s linear infinite spin;animation:1s linear infinite spin;margin-bottom:12px}::ng-deep #rs-smart-popup-fixed-container .rs-smart-popup-content .rs-smart-popup-loading .loading-text{color:#666;font-size:14px}@-webkit-keyframes spin{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}@keyframes spin{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}::ng-deep #rs-smart-popup-fixed-container .rs-smart-popup-content .rs-smart-popup-body{width:100%}@-webkit-keyframes popup-fade-in{from{opacity:0;transform:translate(var(--translate-x,0),var(--translate-y,0)) scale(.95)}to{opacity:1;transform:translate(var(--translate-x,0),var(--translate-y,0)) scale(1)}}@keyframes popup-fade-in{from{opacity:0;transform:translate(var(--translate-x,0),var(--translate-y,0)) scale(.95)}to{opacity:1;transform:translate(var(--translate-x,0),var(--translate-y,0)) scale(1)}}"]
23712
+ }] }
23713
+ ];
23714
+ /** @nocollapse */
23715
+ SmartPopupComponent.ctorParameters = () => [
23716
+ { type: ChangeDetectorRef }
23717
+ ];
23718
+ SmartPopupComponent.propDecorators = {
23719
+ _placement: [{ type: Input, args: ["placement",] }],
23720
+ _offset: [{ type: Input, args: ["offset",] }],
23721
+ _autoAdjust: [{ type: Input, args: ["autoAdjust",] }],
23722
+ triggerElementRef: [{ type: Input, args: ["triggerElement",] }],
23723
+ loading: [{ type: Input, args: ["loading",] }],
23724
+ _open: [{ type: Input, args: ["open",] }],
23725
+ _width: [{ type: Input, args: ["width",] }],
23726
+ _height: [{ type: Input, args: ["height",] }],
23727
+ openChange: [{ type: Output, args: ["openChange",] }],
23728
+ contentLoad: [{ type: Output, args: ["contentLoad",] }],
23729
+ internalTriggerElement: [{ type: ViewChild, args: ["trigger", { static: false },] }],
23730
+ popupElement: [{ type: ViewChild, args: ["popup", { static: false },] }],
23731
+ onWindowResize: [{ type: HostListener, args: ["window:resize",] }]
23732
+ };
23733
+ if (false) {
23734
+ /** @type {?} */
23735
+ SmartPopupComponent.prototype._placement;
23736
+ /** @type {?} */
23737
+ SmartPopupComponent.prototype._offset;
23738
+ /** @type {?} */
23739
+ SmartPopupComponent.prototype._autoAdjust;
23740
+ /** @type {?} */
23741
+ SmartPopupComponent.prototype.triggerElementRef;
23742
+ /** @type {?} */
23743
+ SmartPopupComponent.prototype.loading;
23744
+ /** @type {?} */
23745
+ SmartPopupComponent.prototype._open;
23746
+ /** @type {?} */
23747
+ SmartPopupComponent.prototype._width;
23748
+ /** @type {?} */
23749
+ SmartPopupComponent.prototype._height;
23750
+ /** @type {?} */
23751
+ SmartPopupComponent.prototype.openChange;
23752
+ /** @type {?} */
23753
+ SmartPopupComponent.prototype.contentLoad;
23754
+ /** @type {?} */
23755
+ SmartPopupComponent.prototype.internalTriggerElement;
23756
+ /** @type {?} */
23757
+ SmartPopupComponent.prototype.popupElement;
23758
+ /** @type {?} */
23759
+ SmartPopupComponent.prototype.currentTriggerElement;
23760
+ /** @type {?} */
23761
+ SmartPopupComponent.prototype.FIXED_CONTAINER_ID;
23762
+ /** @type {?} */
23763
+ SmartPopupComponent.prototype.fixedContainerEl;
23764
+ /** @type {?} */
23765
+ SmartPopupComponent.prototype.opened;
23766
+ /** @type {?} */
23767
+ SmartPopupComponent.prototype.positioning;
23768
+ /** @type {?} */
23769
+ SmartPopupComponent.prototype.actualPlacement;
23770
+ /** @type {?} */
23771
+ SmartPopupComponent.prototype.actualPosition;
23772
+ /** @type {?} */
23773
+ SmartPopupComponent.prototype.onClickOutside;
23774
+ /** @type {?} */
23775
+ SmartPopupComponent.prototype.onWindowScroll;
23776
+ /**
23777
+ * @type {?}
23778
+ * @private
23779
+ */
23780
+ SmartPopupComponent.prototype.ref;
23781
+ }
23782
+
22718
23783
  /**
22719
23784
  * @fileoverview added by tsickle
22720
23785
  * Generated from: lib/dashboard/dashboard.service.ts
@@ -47700,6 +48765,7 @@ RaiseCommonLibModule.decorators = [
47700
48765
  RSNavCardGroupComponent,
47701
48766
  RSToolbarComponent,
47702
48767
  TruncatedTextToggleComponent,
48768
+ SmartPopupComponent,
47703
48769
  RSStepperComponent,
47704
48770
  PaneGroupNewComponent,
47705
48771
  SidebarIconlistNewComponent,
@@ -47882,6 +48948,7 @@ RaiseCommonLibModule.decorators = [
47882
48948
  RSNavCardGroupComponent,
47883
48949
  RSToolbarComponent,
47884
48950
  TruncatedTextToggleComponent,
48951
+ SmartPopupComponent,
47885
48952
  CommonDialogComponent,
47886
48953
  RSStepperComponent,
47887
48954
  PaneGroupNewComponent,
@@ -47921,5 +48988,5 @@ RaiseCommonLibModule.decorators = [
47921
48988
  * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
47922
48989
  */
47923
48990
 
47924
- export { API_SERVICE_TOKEN, CheckboxGroupComponent, CommonDialogComponent, CommonFunctionService, CommonGridComponent, DefaultDrawerConfig, DialogService, DrawerComponent, DrawerFormComponent, DrawerService, EmailPattern, EncryptedInputComponent, FloatBoxComponent, GridActionComponent, GridActionItemComponent, GridBoxComponent, IconLoaderService, KeepAliveService, MainContainerComponent, MessageType, MultiTabComponent, PBF_TOKEN, PaneGroupNewComponent, ROLE_SERVICE_TOKEN, RSAsideComponent, RSFooterComponent, RSHeaderComponent, RSNavCardGroupComponent, RSStepperComponent, RSToolbarComponent, RadioGroupComponent, RaiseCommonLibModule, RsCommentaryComponent, RsPageListComponent, RsPageTabComponent, SearchInputComponent, SwitchInputComponent, TagInputComponent, ToolbarItemComponent, TranslationService, TruncatedTextToggleComponent, filterShowSection, Debounce as ɵa, DashboardService as ɵb, ApiList as ɵc, DashboardPorletsService as ɵd, debounce as ɵe, RichtexteditorComponent as ɵf, ConfirmSelectComponent as ɵg, NewActionNotificationComponent as ɵh, CommonDeleteComponent as ɵi, SidebarIconlistNewComponent as ɵj, EmptyIconPromptComponent as ɵk, GadgetTableComponent as ɵl, GadgetPivotComponent as ɵm, GadgetPivotChartComponent as ɵn, GadgetTransposeComponent as ɵo, PortletTypeNewComponent as ɵp, FieldFilterComponent as ɵq, FieldFormatComponent as ɵr, DataMartNewComponent as ɵs, BarChartsComponent as ɵt, PaneDownloadComponent as ɵu };
48991
+ export { API_SERVICE_TOKEN, CheckboxGroupComponent, CommonDialogComponent, CommonFunctionService, CommonGridComponent, DefaultDrawerConfig, DialogService, DrawerComponent, DrawerFormComponent, DrawerService, EmailPattern, EncryptedInputComponent, FloatBoxComponent, GridActionComponent, GridActionItemComponent, GridBoxComponent, IconLoaderService, KeepAliveService, MainContainerComponent, MessageType, MultiTabComponent, PBF_TOKEN, PaneGroupNewComponent, ROLE_SERVICE_TOKEN, RSAsideComponent, RSFooterComponent, RSHeaderComponent, RSNavCardGroupComponent, RSStepperComponent, RSToolbarComponent, RadioGroupComponent, RaiseCommonLibModule, RsCommentaryComponent, RsPageListComponent, RsPageTabComponent, SearchInputComponent, SmartPopupComponent, SwitchInputComponent, TagInputComponent, ToolbarItemComponent, TranslationService, TruncatedTextToggleComponent, filterShowSection, Debounce as ɵa, DashboardService as ɵb, ApiList as ɵc, DashboardPorletsService as ɵd, debounce as ɵe, RichtexteditorComponent as ɵf, ConfirmSelectComponent as ɵg, NewActionNotificationComponent as ɵh, CommonDeleteComponent as ɵi, SidebarIconlistNewComponent as ɵj, EmptyIconPromptComponent as ɵk, GadgetTableComponent as ɵl, GadgetPivotComponent as ɵm, GadgetPivotChartComponent as ɵn, GadgetTransposeComponent as ɵo, PortletTypeNewComponent as ɵp, FieldFilterComponent as ɵq, FieldFormatComponent as ɵr, DataMartNewComponent as ɵs, BarChartsComponent as ɵt, PaneDownloadComponent as ɵu };
47925
48992
  //# sourceMappingURL=raise-common-lib.js.map