@ng-nest/ui 20.2.0 → 20.2.1

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.
@@ -1 +1 @@
1
- {"version":3,"file":"ng-nest-ui-message-box.mjs","sources":["../../../../lib/ng-nest/ui/message-box/message-box.property.ts","../../../../lib/ng-nest/ui/message-box/message-box.component.ts","../../../../lib/ng-nest/ui/message-box/message-box.component.html","../../../../lib/ng-nest/ui/message-box/message-box.service.ts","../../../../lib/ng-nest/ui/message-box/message-box.module.ts","../../../../lib/ng-nest/ui/message-box/ng-nest-ui-message-box.ts"],"sourcesContent":["import { XStatus, XPlace } from '@ng-nest/ui/core';\r\nimport { XAlertOption } from '@ng-nest/ui/alert';\r\nimport { XMessageBoxComponent } from './message-box.component';\r\nimport { XPortalOverlayRef } from '@ng-nest/ui/portal';\r\nimport { XInputType } from '@ng-nest/ui/input';\r\nimport { Observable } from 'rxjs';\r\n\r\n/**\r\n * MessageBox\r\n * @selector x-message-box\r\n * @decorator component\r\n */\r\nexport const XMessageBoxPrefix = 'x-message-box';\r\n\r\nexport const XMessageBoxPortal = 'x-message-box-portal';\r\n\r\n/**\r\n * MessageBox Option\r\n */\r\nexport interface XMessageBoxOption extends XAlertOption {\r\n /**\r\n * @zh_CN 方位,九宫格\r\n * @en_US Direction, nine grid\r\n * @default 'top'\r\n */\r\n placement?: XPlace;\r\n /**\r\n * @zh_CN 偏移距离\r\n * @en_US Offset distance\r\n * @default '2rem'\r\n */\r\n offset?: string | string[];\r\n /**\r\n * @zh_CN 类型\r\n * @en_US Types of\r\n * @default 'info'\r\n */\r\n type?: XMessageBoxType;\r\n /**\r\n * @zh_CN 宽度\r\n * @en_US Width\r\n * @default '16rem'\r\n */\r\n width?: string;\r\n /**\r\n * @zh_CN 高度\r\n * @en_US Height\r\n */\r\n height?: string;\r\n /**\r\n * @zh_CN 隐藏关闭按钮\r\n * @en_US Hide close button\r\n * @default true\r\n */\r\n hideClose?: boolean;\r\n /**\r\n * @zh_CN 显示图标\r\n * @en_US Show icon\r\n * @default true\r\n */\r\n showIcon?: boolean;\r\n /**\r\n * @zh_CN 显示取消按钮\r\n * @en_US Show cancel button\r\n */\r\n showCancel?: boolean;\r\n /**\r\n * @zh_CN 关闭事件\r\n * @en_US Close event\r\n */\r\n callback?: XMessageBoxCallback;\r\n /**\r\n * @zh_CN 点击遮罩关闭\r\n * @en_US Click the mask to close\r\n * @default false\r\n */\r\n backdropClose?: boolean;\r\n /**\r\n * @zh_CN 确认按钮文字\r\n * @en_US Confirm button text\r\n * @default '确定'\r\n */\r\n confirmText?: string;\r\n /**\r\n * @zh_CN 取消按钮文字\r\n * @en_US Cancel button text\r\n * @default '取消'\r\n */\r\n cancelText?: string;\r\n /**\r\n * @zh_CN 是否显示输入框,显示单行文本框后,将不能显示多行文本框\r\n * @en_US Do not display input box. After displaying a single line text box, multi line text boxes cannot be displayed\r\n */\r\n showInput?: boolean;\r\n /**\r\n * @zh_CN 匹配规则\r\n * @en_US Matching rules\r\n */\r\n inputPattern?: RegExp | RegExp[];\r\n /**\r\n * @zh_CN 匹配失败的信息提示\r\n * @en_US Information prompt for matching failure\r\n */\r\n inputInvalidMessage?: string | string[];\r\n /**\r\n * @zh_CN 输入框的占位符\r\n * @en_US Placeholder for input box\r\n */\r\n inputPlaceholder?: string;\r\n /**\r\n * @zh_CN 输入框的类型\r\n * @en_US Type of input box\r\n */\r\n inputType?: XInputType;\r\n /**\r\n * @zh_CN 输入框的值\r\n * @en_US Value of input box\r\n */\r\n inputValue?: string;\r\n /**\r\n * @zh_CN 输入框的验证函数\r\n * @en_US Validation function of input box\r\n */\r\n inputValidator?: (value: any) => boolean;\r\n /**\r\n * @zh_CN 关闭前处理函数\r\n * @en_US Processing function before closing\r\n */\r\n beforeClose?: XMessageBoxCallback;\r\n /**\r\n * @zh_CN 确认加载\r\n * @en_US confirm Loading\r\n */\r\n confirmLoading?: XMessageBoxConfirmLoading;\r\n /**\r\n * @zh_CN 是否显示多行文本框\r\n * @en_US Whether to show the input box\r\n */\r\n showTextarea?: boolean;\r\n /**\r\n * @zh_CN 输入最大长度\r\n * @en_US Enter the maximum length\r\n */\r\n textareaMaxlength?: number;\r\n /**\r\n * @zh_CN 高度\r\n * @en_US height\r\n */\r\n textareaHeight?: string;\r\n}\r\n\r\n/**\r\n * @zh_CN 关闭的回调函数类型\r\n * @en_US Closed callback function type\r\n */\r\nexport interface XMessageBoxCallback {\r\n (action: XMessageBoxAction, message?: string): void;\r\n}\r\n\r\n/**\r\n * @zh_CN 确认加载\r\n * @en_US confirm Loading\r\n */\r\nexport type XMessageBoxConfirmLoading = () => Observable<boolean>;\r\n\r\n/**\r\n * @zh_CN 触发关闭的类型\r\n * @en_US Type of trigger closure\r\n */\r\nexport type XMessageBoxAction = 'confirm' | 'cancel' | 'close';\r\n\r\n/**\r\n * @zh_CN 创建的消息对象\r\n * @en_US Message object created\r\n */\r\nexport interface XMessageBoxOverlayRef extends XPortalOverlayRef<XMessageBoxComponent> {}\r\n\r\nexport interface XMessageBoxRef {\r\n ref: XMessageBoxOverlayRef;\r\n input: XMessageBoxOption;\r\n close: () => void;\r\n}\r\n\r\n/**\r\n * @zh_CN 类型\r\n * @en_US Types of\r\n */\r\nexport type XMessageBoxType = XStatus;\r\n","import {\r\n Component,\r\n ViewEncapsulation,\r\n Renderer2,\r\n ElementRef,\r\n ChangeDetectorRef,\r\n ChangeDetectionStrategy,\r\n OnInit\r\n} from '@angular/core';\r\nimport { XIsFunction, XMoveBoxAnimation } from '@ng-nest/ui/core';\r\nimport { XMessageBoxPrefix, XMessageBoxRef, XMessageBoxAction } from './message-box.property';\r\nimport { UntypedFormGroup, UntypedFormControl, Validators, FormsModule, ReactiveFormsModule } from '@angular/forms';\r\nimport { XFormInputValidator } from '@ng-nest/ui/base-form';\r\nimport { XAlertComponent } from '@ng-nest/ui/alert';\r\nimport { XButtonComponent, XButtonsComponent } from '@ng-nest/ui/button';\r\nimport { XInputComponent } from '@ng-nest/ui/input';\r\nimport { XOutletDirective } from '@ng-nest/ui/outlet';\r\nimport { NgTemplateOutlet } from '@angular/common';\r\nimport { XTextareaComponent } from '@ng-nest/ui/textarea';\r\n\r\n@Component({\r\n selector: `${XMessageBoxPrefix}`,\r\n imports: [\r\n NgTemplateOutlet,\r\n FormsModule,\r\n ReactiveFormsModule,\r\n XInputComponent,\r\n XTextareaComponent,\r\n XButtonComponent,\r\n XButtonsComponent,\r\n XAlertComponent,\r\n XOutletDirective\r\n ],\r\n templateUrl: './message-box.component.html',\r\n styleUrls: ['./message-box.component.scss'],\r\n encapsulation: ViewEncapsulation.None,\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n animations: [XMoveBoxAnimation]\r\n})\r\nexport class XMessageBoxComponent implements OnInit {\r\n messageBox!: XMessageBoxRef;\r\n action: XMessageBoxAction = 'close';\r\n formGroup: UntypedFormGroup = new UntypedFormGroup({});\r\n loading = false;\r\n constructor(\r\n public renderer: Renderer2,\r\n public elementRef: ElementRef<HTMLElement>,\r\n public cdr: ChangeDetectorRef\r\n ) {}\r\n\r\n get msgInput() {\r\n return this.messageBox.input!;\r\n }\r\n\r\n get msgOverlayRef() {\r\n return this.messageBox.ref!;\r\n }\r\n\r\n get getLabel() {\r\n return this.msgInput.content as string;\r\n }\r\n\r\n get getPattern() {\r\n return this.msgInput.inputPattern as RegExp;\r\n }\r\n\r\n ngOnInit() {\r\n (this.msgInput.showInput || this.msgInput.showTextarea) && this.createFormGroup();\r\n }\r\n\r\n onClose() {\r\n this.action = 'close';\r\n this.hideBox();\r\n }\r\n\r\n onCancel() {\r\n this.action = 'cancel';\r\n this.hideBox();\r\n }\r\n\r\n hideBox() {\r\n if (XIsFunction(this.msgInput.beforeClose)) {\r\n this.msgInput.beforeClose!(this.action, this.getInputValue());\r\n } else {\r\n this.close();\r\n }\r\n }\r\n\r\n close() {\r\n if (this.msgInput.hide && this.msgInput.hide !== true) {\r\n this.msgInput.hide = true;\r\n }\r\n this.msgOverlayRef?.overlayRef?.detach();\r\n this.cdr.detectChanges();\r\n }\r\n\r\n onConfirm() {\r\n const hide = () => {\r\n if (!this.msgInput.showInput || (this.msgInput.showInput && this.formGroup.valid)) {\r\n this.action = 'confirm';\r\n this.hideBox();\r\n } else if (!this.msgInput.showTextarea || (this.msgInput.showTextarea && this.formGroup.valid)) {\r\n this.action = 'confirm';\r\n this.hideBox();\r\n }\r\n };\r\n if (this.msgInput.confirmLoading && XIsFunction(this.msgInput.confirmLoading)) {\r\n this.loading = true;\r\n this.msgInput.confirmLoading().subscribe((x) => {\r\n this.loading = false;\r\n this.cdr.markForCheck();\r\n if (!x) return;\r\n this.action = 'confirm';\r\n hide();\r\n });\r\n } else {\r\n hide();\r\n }\r\n }\r\n\r\n moveDone($event: { toState: string }) {\r\n if ($event.toState === 'void') {\r\n XIsFunction(this.msgInput.callback) && this.msgInput.callback!(this.action, this.getInputValue());\r\n this.msgOverlayRef.overlayRef?.dispose();\r\n }\r\n }\r\n\r\n getInputValue() {\r\n return this.formGroup.controls['inputValue']?.value;\r\n }\r\n\r\n createFormGroup() {\r\n this.formGroup.addControl(\r\n 'inputValue',\r\n new UntypedFormControl(this.msgInput.inputValue, [\r\n Validators.required,\r\n Validators.pattern(this.msgInput.inputPattern as RegExp),\r\n XFormInputValidator(this.msgInput.inputValidator!)\r\n ])\r\n );\r\n }\r\n}\r\n","@if (!msgInput.hide) {\r\n <div\r\n class=\"x-message-box\"\r\n [@x-move-box-animation]=\"msgInput.placement\"\r\n (@x-move-box-animation.done)=\"moveDone($event)\"\r\n >\r\n <x-alert\r\n (close)=\"onClose()\"\r\n [title]=\"msgInput.title\"\r\n [content]=\"contentTpl\"\r\n [type]=\"msgInput.type!\"\r\n [effect]=\"msgInput.effect!\"\r\n [hideClose]=\"msgInput.hideClose!\"\r\n [closeText]=\"msgInput.closeText\"\r\n [showIcon]=\"false\"\r\n [duration]=\"0\"\r\n manual\r\n disabledAnimation\r\n ></x-alert>\r\n <ng-template #contentTpl let-iconTpl=\"$iconTpl\">\r\n <div class=\"x-message-box-inner\">\r\n <div class=\"x-message-box-content\">\r\n @if (msgInput.showInput) {\r\n <form [formGroup]=\"formGroup\">\r\n <x-input\r\n formControlName=\"inputValue\"\r\n [type]=\"msgInput.inputType!\"\r\n [label]=\"getLabel\"\r\n [placeholder]=\"msgInput.inputPlaceholder!\"\r\n [pattern]=\"getPattern\"\r\n [message]=\"msgInput.inputInvalidMessage!\"\r\n [inputValidator]=\"msgInput.inputValidator!\"\r\n ></x-input>\r\n </form>\r\n } @else if (msgInput.showTextarea) {\r\n <form [formGroup]=\"formGroup\">\r\n <x-textarea\r\n formControlName=\"inputValue\"\r\n [placeholder]=\"msgInput.inputPlaceholder!\"\r\n [label]=\"getLabel\"\r\n [pattern]=\"getPattern\"\r\n [message]=\"msgInput.inputInvalidMessage!\"\r\n [inputValidator]=\"msgInput.inputValidator!\"\r\n [maxlength]=\"msgInput.textareaMaxlength!\"\r\n [height]=\"msgInput.textareaHeight!\"\r\n ></x-textarea>\r\n </form>\r\n } @else {\r\n @if (msgInput.showIcon) {\r\n <ng-container *ngTemplateOutlet=\"iconTpl\"></ng-container>\r\n }\r\n <ng-container *xOutlet=\"msgInput.content\">\r\n {{ msgInput.content }}\r\n </ng-container>\r\n }\r\n </div>\r\n <x-buttons space=\"0.5rem\">\r\n @if (msgInput.showCancel) {\r\n <x-button (click)=\"onCancel()\" flat plain>{{ msgInput.cancelText }}</x-button>\r\n }\r\n <x-button type=\"primary\" flat (click)=\"onConfirm()\" [disabled]=\"formGroup!.invalid\" [loading]=\"loading\">{{\r\n msgInput.confirmText\r\n }}</x-button>\r\n </x-buttons>\r\n </div>\r\n </ng-template>\r\n </div>\r\n}\r\n","import { ComponentRef, Injectable, inject } from '@angular/core';\r\nimport { XTemplate, XIsXTemplate, XFillDefault, XIsString } from '@ng-nest/ui/core';\r\nimport { XMessageBoxOption, XMessageBoxOverlayRef, XMessageBoxRef, XMessageBoxPortal } from './message-box.property';\r\nimport { XMessageBoxComponent } from './message-box.component';\r\nimport { XPortalService } from '@ng-nest/ui/portal';\r\nimport { XI18nService } from '@ng-nest/ui/i18n';\r\n\r\n@Injectable({ providedIn: 'root' })\r\nexport class XMessageBoxService {\r\n default: XMessageBoxOption = {\r\n type: 'info',\r\n width: '20rem',\r\n placement: 'center',\r\n offset: '2rem',\r\n effect: 'white',\r\n duration: 3000,\r\n showIcon: false,\r\n showInput: false,\r\n showTextarea: false,\r\n backdropClose: false,\r\n cancelText: '取消',\r\n confirmText: '确认',\r\n inputPlaceholder: '',\r\n hide: false,\r\n textareaHeight: '6rem'\r\n };\r\n\r\n private portal = inject(XPortalService);\r\n private i18n = inject(XI18nService);\r\n\r\n alert(option: XTemplate | XMessageBoxOption): XMessageBoxRef {\r\n return this.createMessageBox(option, { showIcon: false, showCancel: false, showInput: false });\r\n }\r\n\r\n confirm(option: XTemplate | XMessageBoxOption): XMessageBoxRef {\r\n return this.createMessageBox(option, { showIcon: true, showCancel: true, showInput: false });\r\n }\r\n\r\n prompt(option: XTemplate | XMessageBoxOption): XMessageBoxRef {\r\n const opt = option as XMessageBoxOption;\r\n let def: XMessageBoxOption = { showIcon: false, showCancel: true, showInput: true };\r\n if (!opt.showInput && opt.showTextarea) {\r\n def = { showIcon: false, showCancel: true, showTextarea: true };\r\n }\r\n return this.createMessageBox(option, def);\r\n }\r\n\r\n create(option: XMessageBoxOption): XMessageBoxOverlayRef {\r\n const offset = XIsString(option.offset) ? [option.offset as string] : (option.offset as string[]);\r\n return this.portal.attach({\r\n content: XMessageBoxComponent,\r\n overlayConfig: {\r\n panelClass: XMessageBoxPortal,\r\n hasBackdrop: true,\r\n width: option.width,\r\n height: option.height,\r\n positionStrategy: this.portal.setPlace(option.placement, ...offset)\r\n }\r\n });\r\n }\r\n\r\n private createMessageBox(option: XTemplate | XMessageBoxOption, def: XMessageBoxOption): XMessageBoxRef {\r\n let opt: XMessageBoxOption;\r\n if (XIsXTemplate(option)) {\r\n opt = { title: option as XTemplate };\r\n } else {\r\n opt = option as XMessageBoxOption;\r\n }\r\n this.setLocal();\r\n XFillDefault(opt, Object.assign({ ...this.default }, def));\r\n return this.createMessageBoxPlacement(opt);\r\n }\r\n\r\n private createMessageBoxPlacement(option: XMessageBoxOption): XMessageBoxRef {\r\n const ref = this.create(option);\r\n const { overlayRef, componentRef } = ref;\r\n const { instance } = componentRef as ComponentRef<XMessageBoxComponent>;\r\n const result = {\r\n ref: ref,\r\n input: option,\r\n close: () => {\r\n instance.close();\r\n }\r\n };\r\n instance.messageBox = result;\r\n if (option.backdropClose && overlayRef) {\r\n overlayRef.backdropClick().subscribe(() => instance.onClose());\r\n }\r\n return result;\r\n }\r\n\r\n private setLocal() {\r\n const messageBoxLocale = this.i18n.getLocale().messageBox;\r\n this.default = { ...this.default, ...messageBoxLocale };\r\n }\r\n}\r\n","import { NgModule } from '@angular/core';\r\n\r\n@NgModule({\r\n exports: [],\r\n imports: []\r\n})\r\nexport class XMessageBoxModule {}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AAOA;;;;AAIG;AACI,MAAM,iBAAiB,GAAG;AAE1B,MAAM,iBAAiB,GAAG;;MCyBpB,oBAAoB,CAAA;AAK/B,IAAA,WAAA,CACS,QAAmB,EACnB,UAAmC,EACnC,GAAsB,EAAA;QAFtB,IAAA,CAAA,QAAQ,GAAR,QAAQ;QACR,IAAA,CAAA,UAAU,GAAV,UAAU;QACV,IAAA,CAAA,GAAG,GAAH,GAAG;QANZ,IAAA,CAAA,MAAM,GAAsB,OAAO;AACnC,QAAA,IAAA,CAAA,SAAS,GAAqB,IAAI,gBAAgB,CAAC,EAAE,CAAC;QACtD,IAAA,CAAA,OAAO,GAAG,KAAK;IAKZ;AAEH,IAAA,IAAI,QAAQ,GAAA;AACV,QAAA,OAAO,IAAI,CAAC,UAAU,CAAC,KAAM;IAC/B;AAEA,IAAA,IAAI,aAAa,GAAA;AACf,QAAA,OAAO,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AE;IACzD;iIAtFW,kBAAkB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAlB,uBAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,kBAAkB,cADL,MAAM,EAAA,CAAA,CAAA;;2FACnB,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAD9B,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;MCDrB,iBAAiB,CAAA;iIAAjB,iBAAiB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;kIAAjB,iBAAiB,EAAA,CAAA,CAAA;kIAAjB,iBAAiB,EAAA,CAAA,CAAA;;2FAAjB,iBAAiB,EAAA,UAAA,EAAA,CAAA;kBAJ7B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE,EAAE;AACX,oBAAA,OAAO,EAAE;AACV,iBAAA;;;ACLD;;AAEG;;;;"}
1
+ {"version":3,"file":"ng-nest-ui-message-box.mjs","sources":["../../../../lib/ng-nest/ui/message-box/message-box.property.ts","../../../../lib/ng-nest/ui/message-box/message-box.component.ts","../../../../lib/ng-nest/ui/message-box/message-box.component.html","../../../../lib/ng-nest/ui/message-box/message-box.service.ts","../../../../lib/ng-nest/ui/message-box/message-box.module.ts","../../../../lib/ng-nest/ui/message-box/ng-nest-ui-message-box.ts"],"sourcesContent":["import { XStatus, XPlace } from '@ng-nest/ui/core';\r\nimport { XAlertOption } from '@ng-nest/ui/alert';\r\nimport { XMessageBoxComponent } from './message-box.component';\r\nimport { XPortalOverlayRef } from '@ng-nest/ui/portal';\r\nimport { XInputType } from '@ng-nest/ui/input';\r\nimport { Observable } from 'rxjs';\r\n\r\n/**\r\n * MessageBox\r\n * @selector x-message-box\r\n * @decorator component\r\n */\r\nexport const XMessageBoxPrefix = 'x-message-box';\r\n\r\nexport const XMessageBoxPortal = 'x-message-box-portal';\r\n\r\n/**\r\n * MessageBox Option\r\n */\r\nexport interface XMessageBoxOption extends XAlertOption {\r\n /**\r\n * @zh_CN 方位,九宫格\r\n * @en_US Direction, nine grid\r\n * @default 'top'\r\n */\r\n placement?: XPlace;\r\n /**\r\n * @zh_CN 偏移距离\r\n * @en_US Offset distance\r\n * @default '2rem'\r\n */\r\n offset?: string | string[];\r\n /**\r\n * @zh_CN 类型\r\n * @en_US Types of\r\n * @default 'info'\r\n */\r\n type?: XMessageBoxType;\r\n /**\r\n * @zh_CN 宽度\r\n * @en_US Width\r\n * @default '16rem'\r\n */\r\n width?: string;\r\n /**\r\n * @zh_CN 高度\r\n * @en_US Height\r\n */\r\n height?: string;\r\n /**\r\n * @zh_CN 隐藏关闭按钮\r\n * @en_US Hide close button\r\n * @default true\r\n */\r\n hideClose?: boolean;\r\n /**\r\n * @zh_CN 显示图标\r\n * @en_US Show icon\r\n * @default true\r\n */\r\n showIcon?: boolean;\r\n /**\r\n * @zh_CN 显示取消按钮\r\n * @en_US Show cancel button\r\n */\r\n showCancel?: boolean;\r\n /**\r\n * @zh_CN 关闭事件\r\n * @en_US Close event\r\n */\r\n callback?: XMessageBoxCallback;\r\n /**\r\n * @zh_CN 点击遮罩关闭\r\n * @en_US Click the mask to close\r\n * @default false\r\n */\r\n backdropClose?: boolean;\r\n /**\r\n * @zh_CN 确认按钮文字\r\n * @en_US Confirm button text\r\n * @default '确定'\r\n */\r\n confirmText?: string;\r\n /**\r\n * @zh_CN 取消按钮文字\r\n * @en_US Cancel button text\r\n * @default '取消'\r\n */\r\n cancelText?: string;\r\n /**\r\n * @zh_CN 是否显示输入框,显示单行文本框后,将不能显示多行文本框\r\n * @en_US Do not display input box. After displaying a single line text box, multi line text boxes cannot be displayed\r\n */\r\n showInput?: boolean;\r\n /**\r\n * @zh_CN 匹配规则\r\n * @en_US Matching rules\r\n */\r\n inputPattern?: RegExp | RegExp[];\r\n /**\r\n * @zh_CN 匹配失败的信息提示\r\n * @en_US Information prompt for matching failure\r\n */\r\n inputInvalidMessage?: string | string[];\r\n /**\r\n * @zh_CN 输入框的占位符\r\n * @en_US Placeholder for input box\r\n */\r\n inputPlaceholder?: string;\r\n /**\r\n * @zh_CN 输入框的类型\r\n * @en_US Type of input box\r\n */\r\n inputType?: XInputType;\r\n /**\r\n * @zh_CN 输入框的值\r\n * @en_US Value of input box\r\n */\r\n inputValue?: string;\r\n /**\r\n * @zh_CN 输入框的验证函数\r\n * @en_US Validation function of input box\r\n */\r\n inputValidator?: (value: any) => boolean;\r\n /**\r\n * @zh_CN 关闭前处理函数\r\n * @en_US Processing function before closing\r\n */\r\n beforeClose?: XMessageBoxCallback;\r\n /**\r\n * @zh_CN 确认加载\r\n * @en_US confirm Loading\r\n */\r\n confirmLoading?: XMessageBoxConfirmLoading;\r\n /**\r\n * @zh_CN 是否显示多行文本框\r\n * @en_US Whether to show the input box\r\n */\r\n showTextarea?: boolean;\r\n /**\r\n * @zh_CN 输入最大长度\r\n * @en_US Enter the maximum length\r\n */\r\n textareaMaxlength?: number;\r\n /**\r\n * @zh_CN 高度\r\n * @en_US height\r\n */\r\n textareaHeight?: string;\r\n}\r\n\r\n/**\r\n * @zh_CN 关闭的回调函数类型\r\n * @en_US Closed callback function type\r\n */\r\nexport interface XMessageBoxCallback {\r\n (action: XMessageBoxAction, message?: string): void;\r\n}\r\n\r\n/**\r\n * @zh_CN 确认加载\r\n * @en_US confirm Loading\r\n */\r\nexport type XMessageBoxConfirmLoading = () => Observable<boolean>;\r\n\r\n/**\r\n * @zh_CN 触发关闭的类型\r\n * @en_US Type of trigger closure\r\n */\r\nexport type XMessageBoxAction = 'confirm' | 'cancel' | 'close';\r\n\r\n/**\r\n * @zh_CN 创建的消息对象\r\n * @en_US Message object created\r\n */\r\nexport interface XMessageBoxOverlayRef extends XPortalOverlayRef<XMessageBoxComponent> {}\r\n\r\nexport interface XMessageBoxRef {\r\n ref: XMessageBoxOverlayRef;\r\n input: XMessageBoxOption;\r\n close: () => void;\r\n}\r\n\r\n/**\r\n * @zh_CN 类型\r\n * @en_US Types of\r\n */\r\nexport type XMessageBoxType = XStatus;\r\n","import {\r\n Component,\r\n ViewEncapsulation,\r\n Renderer2,\r\n ElementRef,\r\n ChangeDetectorRef,\r\n ChangeDetectionStrategy,\r\n OnInit,\r\n HostListener,\r\n HostBinding\r\n} from '@angular/core';\r\nimport { XIsFunction } from '@ng-nest/ui/core';\r\nimport { XMessageBoxPrefix, XMessageBoxRef, XMessageBoxAction } from './message-box.property';\r\nimport { UntypedFormGroup, UntypedFormControl, Validators, FormsModule, ReactiveFormsModule } from '@angular/forms';\r\nimport { XFormInputValidator } from '@ng-nest/ui/base-form';\r\nimport { XAlertComponent } from '@ng-nest/ui/alert';\r\nimport { XButtonComponent, XButtonsComponent } from '@ng-nest/ui/button';\r\nimport { XInputComponent } from '@ng-nest/ui/input';\r\nimport { XOutletDirective } from '@ng-nest/ui/outlet';\r\nimport { NgTemplateOutlet } from '@angular/common';\r\nimport { XTextareaComponent } from '@ng-nest/ui/textarea';\r\n\r\n@Component({\r\n selector: `${XMessageBoxPrefix}`,\r\n imports: [\r\n NgTemplateOutlet,\r\n FormsModule,\r\n ReactiveFormsModule,\r\n XInputComponent,\r\n XTextareaComponent,\r\n XButtonComponent,\r\n XButtonsComponent,\r\n XAlertComponent,\r\n XOutletDirective\r\n ],\r\n templateUrl: './message-box.component.html',\r\n styleUrls: ['./message-box.component.scss'],\r\n encapsulation: ViewEncapsulation.None,\r\n changeDetection: ChangeDetectionStrategy.OnPush\r\n})\r\nexport class XMessageBoxComponent implements OnInit {\r\n messageBox!: XMessageBoxRef;\r\n action: XMessageBoxAction = 'close';\r\n formGroup: UntypedFormGroup = new UntypedFormGroup({});\r\n loading = false;\r\n\r\n @HostBinding('animate.enter') get animateEnter() {\r\n return `x-move-${this.msgInput.placement}-enter`;\r\n }\r\n @HostBinding('animate.leave') get animateLeave() {\r\n return `x-move-${this.msgInput.placement}-leave`;\r\n }\r\n\r\n @HostListener('animationend', ['$event']) animationend($event: AnimationEvent) {\r\n this.moveDone($event);\r\n }\r\n\r\n constructor(\r\n public renderer: Renderer2,\r\n public elementRef: ElementRef<HTMLElement>,\r\n public cdr: ChangeDetectorRef\r\n ) {}\r\n\r\n get msgInput() {\r\n return this.messageBox.input!;\r\n }\r\n\r\n get msgOverlayRef() {\r\n return this.messageBox.ref!;\r\n }\r\n\r\n get getLabel() {\r\n return this.msgInput.content as string;\r\n }\r\n\r\n get getPattern() {\r\n return this.msgInput.inputPattern as RegExp;\r\n }\r\n\r\n ngOnInit() {\r\n (this.msgInput.showInput || this.msgInput.showTextarea) && this.createFormGroup();\r\n }\r\n\r\n onClose() {\r\n this.action = 'close';\r\n this.hideBox();\r\n }\r\n\r\n onCancel() {\r\n this.action = 'cancel';\r\n this.hideBox();\r\n }\r\n\r\n hideBox() {\r\n if (XIsFunction(this.msgInput.beforeClose)) {\r\n this.msgInput.beforeClose!(this.action, this.getInputValue());\r\n } else {\r\n this.close();\r\n }\r\n }\r\n\r\n close() {\r\n this.msgOverlayRef?.overlayRef?.detach();\r\n }\r\n\r\n onConfirm() {\r\n const hide = () => {\r\n if (!this.msgInput.showInput || (this.msgInput.showInput && this.formGroup.valid)) {\r\n this.action = 'confirm';\r\n this.hideBox();\r\n } else if (!this.msgInput.showTextarea || (this.msgInput.showTextarea && this.formGroup.valid)) {\r\n this.action = 'confirm';\r\n this.hideBox();\r\n }\r\n };\r\n if (this.msgInput.confirmLoading && XIsFunction(this.msgInput.confirmLoading)) {\r\n this.loading = true;\r\n this.msgInput.confirmLoading().subscribe((x) => {\r\n this.loading = false;\r\n this.cdr.markForCheck();\r\n if (!x) return;\r\n this.action = 'confirm';\r\n hide();\r\n });\r\n } else {\r\n hide();\r\n }\r\n }\r\n\r\n moveDone($event: AnimationEvent) {\r\n if ($event.animationName.endsWith('-leave')) {\r\n XIsFunction(this.msgInput.callback) && this.msgInput.callback!(this.action, this.getInputValue());\r\n this.msgOverlayRef.overlayRef?.dispose();\r\n }\r\n }\r\n\r\n getInputValue() {\r\n return this.formGroup.controls['inputValue']?.value;\r\n }\r\n\r\n createFormGroup() {\r\n this.formGroup.addControl(\r\n 'inputValue',\r\n new UntypedFormControl(this.msgInput.inputValue, [\r\n Validators.required,\r\n Validators.pattern(this.msgInput.inputPattern as RegExp),\r\n XFormInputValidator(this.msgInput.inputValidator!)\r\n ])\r\n );\r\n }\r\n}\r\n","<div class=\"x-message-box\">\r\n <x-alert\r\n (close)=\"onClose()\"\r\n [title]=\"msgInput.title\"\r\n [content]=\"contentTpl\"\r\n [type]=\"msgInput.type!\"\r\n [effect]=\"msgInput.effect!\"\r\n [hideClose]=\"msgInput.hideClose!\"\r\n [closeText]=\"msgInput.closeText\"\r\n [showIcon]=\"false\"\r\n [duration]=\"0\"\r\n manual\r\n disabledAnimation\r\n ></x-alert>\r\n <ng-template #contentTpl let-iconTpl=\"$iconTpl\">\r\n <div class=\"x-message-box-inner\">\r\n <div class=\"x-message-box-content\">\r\n @if (msgInput.showInput) {\r\n <form [formGroup]=\"formGroup\">\r\n <x-input\r\n formControlName=\"inputValue\"\r\n [type]=\"msgInput.inputType!\"\r\n [label]=\"getLabel\"\r\n [placeholder]=\"msgInput.inputPlaceholder!\"\r\n [pattern]=\"getPattern\"\r\n [message]=\"msgInput.inputInvalidMessage!\"\r\n [inputValidator]=\"msgInput.inputValidator!\"\r\n ></x-input>\r\n </form>\r\n } @else if (msgInput.showTextarea) {\r\n <form [formGroup]=\"formGroup\">\r\n <x-textarea\r\n formControlName=\"inputValue\"\r\n [placeholder]=\"msgInput.inputPlaceholder!\"\r\n [label]=\"getLabel\"\r\n [pattern]=\"getPattern\"\r\n [message]=\"msgInput.inputInvalidMessage!\"\r\n [inputValidator]=\"msgInput.inputValidator!\"\r\n [maxlength]=\"msgInput.textareaMaxlength!\"\r\n [height]=\"msgInput.textareaHeight!\"\r\n ></x-textarea>\r\n </form>\r\n } @else {\r\n @if (msgInput.showIcon) {\r\n <ng-container *ngTemplateOutlet=\"iconTpl\"></ng-container>\r\n }\r\n <ng-container *xOutlet=\"msgInput.content\">\r\n {{ msgInput.content }}\r\n </ng-container>\r\n }\r\n </div>\r\n <x-buttons space=\"0.5rem\">\r\n @if (msgInput.showCancel) {\r\n <x-button (click)=\"onCancel()\" flat plain>{{ msgInput.cancelText }}</x-button>\r\n }\r\n <x-button type=\"primary\" flat (click)=\"onConfirm()\" [disabled]=\"formGroup!.invalid\" [loading]=\"loading\">{{\r\n msgInput.confirmText\r\n }}</x-button>\r\n </x-buttons>\r\n </div>\r\n </ng-template>\r\n</div>\r\n","import { ComponentRef, Injectable, inject } from '@angular/core';\r\nimport { XTemplate, XIsXTemplate, XFillDefault, XIsString } from '@ng-nest/ui/core';\r\nimport { XMessageBoxOption, XMessageBoxOverlayRef, XMessageBoxRef, XMessageBoxPortal } from './message-box.property';\r\nimport { XMessageBoxComponent } from './message-box.component';\r\nimport { XPortalService } from '@ng-nest/ui/portal';\r\nimport { XI18nService } from '@ng-nest/ui/i18n';\r\n\r\n@Injectable({ providedIn: 'root' })\r\nexport class XMessageBoxService {\r\n default: XMessageBoxOption = {\r\n type: 'info',\r\n width: '20rem',\r\n placement: 'center',\r\n offset: '2rem',\r\n effect: 'white',\r\n duration: 3000,\r\n showIcon: false,\r\n showInput: false,\r\n showTextarea: false,\r\n backdropClose: false,\r\n cancelText: '取消',\r\n confirmText: '确认',\r\n inputPlaceholder: '',\r\n textareaHeight: '6rem'\r\n };\r\n\r\n private portal = inject(XPortalService);\r\n private i18n = inject(XI18nService);\r\n\r\n alert(option: XTemplate | XMessageBoxOption): XMessageBoxRef {\r\n return this.createMessageBox(option, { showIcon: false, showCancel: false, showInput: false });\r\n }\r\n\r\n confirm(option: XTemplate | XMessageBoxOption): XMessageBoxRef {\r\n return this.createMessageBox(option, { showIcon: true, showCancel: true, showInput: false });\r\n }\r\n\r\n prompt(option: XTemplate | XMessageBoxOption): XMessageBoxRef {\r\n const opt = option as XMessageBoxOption;\r\n let def: XMessageBoxOption = { showIcon: false, showCancel: true, showInput: true };\r\n if (!opt.showInput && opt.showTextarea) {\r\n def = { showIcon: false, showCancel: true, showTextarea: true };\r\n }\r\n return this.createMessageBox(option, def);\r\n }\r\n\r\n create(option: XMessageBoxOption): XMessageBoxOverlayRef {\r\n const offset = XIsString(option.offset) ? [option.offset as string] : (option.offset as string[]);\r\n return this.portal.attach({\r\n content: XMessageBoxComponent,\r\n overlayConfig: {\r\n panelClass: XMessageBoxPortal,\r\n hasBackdrop: true,\r\n width: option.width,\r\n height: option.height,\r\n positionStrategy: this.portal.setPlace(option.placement, ...offset)\r\n }\r\n });\r\n }\r\n\r\n private createMessageBox(option: XTemplate | XMessageBoxOption, def: XMessageBoxOption): XMessageBoxRef {\r\n let opt: XMessageBoxOption;\r\n if (XIsXTemplate(option)) {\r\n opt = { title: option as XTemplate };\r\n } else {\r\n opt = option as XMessageBoxOption;\r\n }\r\n this.setLocal();\r\n XFillDefault(opt, Object.assign({ ...this.default }, def));\r\n return this.createMessageBoxPlacement(opt);\r\n }\r\n\r\n private createMessageBoxPlacement(option: XMessageBoxOption): XMessageBoxRef {\r\n const ref = this.create(option);\r\n const { overlayRef, componentRef } = ref;\r\n const { instance } = componentRef as ComponentRef<XMessageBoxComponent>;\r\n const result = {\r\n ref: ref,\r\n input: option,\r\n close: () => {\r\n instance.close();\r\n }\r\n };\r\n instance.messageBox = result;\r\n if (option.backdropClose && overlayRef) {\r\n overlayRef.backdropClick().subscribe(() => instance.onClose());\r\n }\r\n return result;\r\n }\r\n\r\n private setLocal() {\r\n const messageBoxLocale = this.i18n.getLocale().messageBox;\r\n this.default = { ...this.default, ...messageBoxLocale };\r\n }\r\n}\r\n","import { NgModule } from '@angular/core';\r\n\r\n@NgModule({\r\n exports: [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aAAa,EAAE,CAAC,SAAS,CAAC,MAAM,QAAQ,CAAC,OAAO,EAAE,CAAC;QAChE;AACA,QAAA,OAAO,MAAM;IACf;IAEQ,QAAQ,GAAA;QACd,MAAM,gBAAgB,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,UAAU;AACzD,QAAA,IAAI,CAAC,OAAO,GAAG,EAAE,GAAG,IAAI,CAAC,OAAO,EAAE,GAAG,gBAAgB,EAAE;IACzD;iIArFW,kBAAkB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAlB,uBAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,kBAAkB,cADL,MAAM,EAAA,CAAA,CAAA;;2FACnB,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAD9B,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;MCDrB,iBAAiB,CAAA;iIAAjB,iBAAiB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;kIAAjB,iBAAiB,EAAA,CAAA,CAAA;kIAAjB,iBAAiB,EAAA,CAAA,CAAA;;2FAAjB,iBAAiB,EAAA,UAAA,EAAA,CAAA;kBAJ7B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE,EAAE;AACX,oBAAA,OAAO,EAAE;AACV,iBAAA;;;ACLD;;AAEG;;;;"}
@@ -1,6 +1,6 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { inject, ChangeDetectorRef, ChangeDetectionStrategy, ViewEncapsulation, Component, Injectable, NgModule } from '@angular/core';
3
- import { XIsEmpty, XMoveAnimation, XConfigService, XIsXTemplate, XFillDefault, XIsUndefined, XIsString } from '@ng-nest/ui/core';
3
+ import { XIsEmpty, XConfigService, XIsXTemplate, XFillDefault, XIsUndefined, XIsString } from '@ng-nest/ui/core';
4
4
  import { of } from 'rxjs';
5
5
  import { delay } from 'rxjs/operators';
6
6
  import { XAlertComponent } from '@ng-nest/ui/alert';
@@ -26,7 +26,7 @@ class XMessageComponent {
26
26
  this.cdr.detectChanges();
27
27
  }
28
28
  moveDone($event) {
29
- if ($event.toState === 'void' && XIsEmpty(this.message.list)) {
29
+ if ($event.animationName.endsWith('-leave') && XIsEmpty(this.message.list)) {
30
30
  this.message.ref?.overlayRef?.detach();
31
31
  }
32
32
  }
@@ -41,11 +41,11 @@ class XMessageComponent {
41
41
  }
42
42
  }
43
43
  /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.5", ngImport: i0, type: XMessageComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
44
- /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.5", type: XMessageComponent, isStandalone: true, selector: "x-message", ngImport: i0, template: "<div class=\"x-message\">\r\n @for (item of message.list; track item.id) {\r\n <x-alert\r\n [@x-move-animation]=\"item.placement\"\r\n (@x-move-animation.done)=\"moveDone($event)\"\r\n (mouseenter)=\"onEnter(item)\"\r\n (mouseleave)=\"onLeave(item)\"\r\n (close)=\"onClose(item)\"\r\n [hide]=\"item.hide!\"\r\n [title]=\"item.title\"\r\n [content]=\"item.content\"\r\n [type]=\"item.type!\"\r\n [effect]=\"item.effect!\"\r\n [hideClose]=\"item.hideClose!\"\r\n [closeText]=\"item.closeText!\"\r\n [showIcon]=\"item.showIcon!\"\r\n [duration]=\"0\"\r\n manual\r\n disabledAnimation\r\n ></x-alert>\r\n }\r\n</div>\r\n", styles: [".x-message{margin:0;padding:0}.x-message>x-alert{padding:.25rem 0}.x-message>x-alert>.x-alert{box-shadow:var(--x-box-shadow)}.x-message-portal x-message{width:100%}\n"], dependencies: [{ kind: "component", type: XAlertComponent, selector: "x-alert" }], animations: [XMoveAnimation], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
44
+ /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.5", type: XMessageComponent, isStandalone: true, selector: "x-message", ngImport: i0, template: "<div class=\"x-message\">\r\n <!-- TODO The style of x-alert will be cleared when the leave animation starts. This ensures that the style will definitely be loaded -->\r\n <x-alert [style.display]=\"'none'\"></x-alert>\r\n @for (item of message.list; track item.id) {\r\n <x-alert\r\n [animate.enter]=\"`x-move-${item.placement}-enter`\"\r\n [animate.leave]=\"`x-move-${item.placement}-leave`\"\r\n (animationend)=\"moveDone($event)\"\r\n (mouseenter)=\"onEnter(item)\"\r\n (mouseleave)=\"onLeave(item)\"\r\n (close)=\"onClose(item)\"\r\n [hide]=\"item.hide!\"\r\n [title]=\"item.title\"\r\n [content]=\"item.content\"\r\n [type]=\"item.type!\"\r\n [effect]=\"item.effect!\"\r\n [hideClose]=\"item.hideClose!\"\r\n [closeText]=\"item.closeText!\"\r\n [showIcon]=\"item.showIcon!\"\r\n [duration]=\"0\"\r\n manual\r\n disabledAnimation\r\n ></x-alert>\r\n }\r\n</div>\r\n", styles: [".x-message{margin:0;padding:0}.x-message>x-alert{padding:.25rem 0}.x-message>x-alert>.x-alert{box-shadow:var(--x-box-shadow)}.x-message-portal x-message{width:100%}\n"], dependencies: [{ kind: "component", type: XAlertComponent, selector: "x-alert" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
45
45
  }
46
46
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.5", ngImport: i0, type: XMessageComponent, decorators: [{
47
47
  type: Component,
48
- args: [{ selector: `${XMessagePrefix}`, imports: [XAlertComponent], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, animations: [XMoveAnimation], template: "<div class=\"x-message\">\r\n @for (item of message.list; track item.id) {\r\n <x-alert\r\n [@x-move-animation]=\"item.placement\"\r\n (@x-move-animation.done)=\"moveDone($event)\"\r\n (mouseenter)=\"onEnter(item)\"\r\n (mouseleave)=\"onLeave(item)\"\r\n (close)=\"onClose(item)\"\r\n [hide]=\"item.hide!\"\r\n [title]=\"item.title\"\r\n [content]=\"item.content\"\r\n [type]=\"item.type!\"\r\n [effect]=\"item.effect!\"\r\n [hideClose]=\"item.hideClose!\"\r\n [closeText]=\"item.closeText!\"\r\n [showIcon]=\"item.showIcon!\"\r\n [duration]=\"0\"\r\n manual\r\n disabledAnimation\r\n ></x-alert>\r\n }\r\n</div>\r\n", styles: [".x-message{margin:0;padding:0}.x-message>x-alert{padding:.25rem 0}.x-message>x-alert>.x-alert{box-shadow:var(--x-box-shadow)}.x-message-portal x-message{width:100%}\n"] }]
48
+ args: [{ selector: `${XMessagePrefix}`, imports: [XAlertComponent], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"x-message\">\r\n <!-- TODO The style of x-alert will be cleared when the leave animation starts. This ensures that the style will definitely be loaded -->\r\n <x-alert [style.display]=\"'none'\"></x-alert>\r\n @for (item of message.list; track item.id) {\r\n <x-alert\r\n [animate.enter]=\"`x-move-${item.placement}-enter`\"\r\n [animate.leave]=\"`x-move-${item.placement}-leave`\"\r\n (animationend)=\"moveDone($event)\"\r\n (mouseenter)=\"onEnter(item)\"\r\n (mouseleave)=\"onLeave(item)\"\r\n (close)=\"onClose(item)\"\r\n [hide]=\"item.hide!\"\r\n [title]=\"item.title\"\r\n [content]=\"item.content\"\r\n [type]=\"item.type!\"\r\n [effect]=\"item.effect!\"\r\n [hideClose]=\"item.hideClose!\"\r\n [closeText]=\"item.closeText!\"\r\n [showIcon]=\"item.showIcon!\"\r\n [duration]=\"0\"\r\n manual\r\n disabledAnimation\r\n ></x-alert>\r\n }\r\n</div>\r\n", styles: [".x-message{margin:0;padding:0}.x-message>x-alert{padding:.25rem 0}.x-message>x-alert>.x-alert{box-shadow:var(--x-box-shadow)}.x-message-portal x-message{width:100%}\n"] }]
49
49
  }] });
50
50
 
51
51
  // TODO: add more function
@@ -1 +1 @@
1
- {"version":3,"file":"ng-nest-ui-message.mjs","sources":["../../../../lib/ng-nest/ui/message/message.property.ts","../../../../lib/ng-nest/ui/message/message.component.ts","../../../../lib/ng-nest/ui/message/message.component.html","../../../../lib/ng-nest/ui/message/message-ref.ts","../../../../lib/ng-nest/ui/message/message.service.ts","../../../../lib/ng-nest/ui/message/message.module.ts","../../../../lib/ng-nest/ui/message/ng-nest-ui-message.ts"],"sourcesContent":["import { XStatus, XPlace } from '@ng-nest/ui/core';\r\nimport { XAlertOption } from '@ng-nest/ui/alert';\r\nimport { Subscription, Subject } from 'rxjs';\r\nimport { XPortalOverlayRef } from '@ng-nest/ui/portal';\r\nimport { XMessageComponent } from './message.component';\r\n\r\n/**\r\n * Message\r\n * @selector x-message\r\n * @decorator component\r\n */\r\nexport const XMessagePrefix = 'x-message';\r\nexport const XMessagePortal = 'x-message-portal';\r\nexport const X_MESSAGE_CONFIG_NAME = 'message';\r\n\r\n/**\r\n * Message Option\r\n */\r\nexport interface XMessageOption extends XAlertOption {\r\n /**\r\n * @zh_CN 消息框的 id\r\n * @en_US Message id\r\n */\r\n id?: string;\r\n /**\r\n * @zh_CN 方位,九宫格\r\n * @en_US Direction, nine grid\r\n * @default 'top'\r\n * @withConfig true\r\n */\r\n placement?: XPlace;\r\n /**\r\n * @zh_CN 偏移距离\r\n * @en_US Offset distance\r\n * @default '2rem'\r\n * @withConfig true\r\n */\r\n offset?: string | string[];\r\n /**\r\n * @zh_CN 类型\r\n * @en_US Types of\r\n * @default 'info'\r\n * @withConfig true\r\n */\r\n type?: XMessageType;\r\n /**\r\n * @zh_CN 多个消息的时候,显示类型\r\n * @en_US When multiple messages, the display type\r\n * @default 'list'\r\n * @withConfig true\r\n */\r\n displayType?: XMessageDisplayType;\r\n /**\r\n * @zh_CN 宽度\r\n * @en_US Width\r\n * @withConfig true\r\n */\r\n width?: string;\r\n /**\r\n * @zh_CN 高度\r\n * @en_US Height\r\n */\r\n height?: string;\r\n /**\r\n * @zh_CN 延迟关闭时间\r\n * @en_US Delay off time\r\n * @default 3000\r\n * @withConfig true\r\n */\r\n duration?: number;\r\n /**\r\n * @zh_CN 隐藏关闭按钮\r\n * @en_US Hide close button\r\n * @default true\r\n * @withConfig true\r\n */\r\n hideClose?: boolean;\r\n /**\r\n * @zh_CN 显示图标\r\n * @en_US Show icon\r\n * @default true\r\n * @withConfig true\r\n */\r\n showIcon?: boolean;\r\n /**\r\n * @zh_CN 延迟关闭订阅后的对象,用来释放或取消\r\n * @en_US Delayed closing the subscribed object, used to release or cancel\r\n */\r\n durationSubscription?: Subscription | null;\r\n /**\r\n * @zh_CN 延迟关闭订阅对象\r\n * @en_US Delay in closing the subscription object\r\n */\r\n durationSub?: Subject<any>;\r\n}\r\n\r\n/**\r\n * @zh_CN 创建的消息对象\r\n * @en_US Message object created\r\n */\r\nexport interface XMessageOverlayRef extends XPortalOverlayRef<XMessageComponent> {}\r\n\r\n/**\r\n * @zh_CN 九宫格中的消息对象\r\n * @en_US Message object in Jiugongge\r\n */\r\nexport interface XMessagePlacement {\r\n [property: string]: XMessagePlacementRef;\r\n}\r\n\r\n/**\r\n * @zh_CN 九宫格中的消息对象\r\n * @en_US Message object in Jiugongge\r\n */\r\nexport interface XMessagePlacementRef {\r\n /**\r\n * @zh_CN 方位对应的 overlayRef\r\n * @en_US Placement overlayRef\r\n */\r\n ref: XMessageOverlayRef;\r\n /**\r\n * @zh_CN 对应的消息 list 数据\r\n * @en_US Corresponding message list data\r\n */\r\n list: XMessageOption[];\r\n /**\r\n * @zh_CN 关闭所有数据\r\n * @en_US Close all data\r\n */\r\n closeAll: () => void;\r\n}\r\n\r\n/**\r\n * @zh_CN 类型\r\n * @en_US Types of\r\n */\r\nexport type XMessageType = XStatus;\r\n\r\n/**\r\n * @zh_CN 多个消息的时候,显示类型\r\n * @en_US When multiple messages, the display type\r\n */\r\nexport type XMessageDisplayType = 'list' | 'single';\r\n","import { Component, ViewEncapsulation, ChangeDetectorRef, ChangeDetectionStrategy, inject } from '@angular/core';\r\nimport { XMoveAnimation, XIsEmpty } from '@ng-nest/ui/core';\r\nimport { XMessagePrefix, XMessageOption, XMessagePlacementRef } from './message.property';\r\nimport { of } from 'rxjs';\r\nimport { delay } from 'rxjs/operators';\r\nimport { XAlertComponent } from '@ng-nest/ui/alert';\r\n\r\n@Component({\r\n selector: `${XMessagePrefix}`,\r\n imports: [XAlertComponent],\r\n templateUrl: './message.component.html',\r\n styleUrls: ['./message.component.scss'],\r\n encapsulation: ViewEncapsulation.None,\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n animations: [XMoveAnimation]\r\n})\r\nexport class XMessageComponent {\r\n message: XMessagePlacementRef = { ref: {}, list: [], closeAll: () => {} };\r\n cdr = inject(ChangeDetectorRef);\r\n\r\n onClose(item: XMessageOption) {\r\n this.message.list?.splice(this.message.list.indexOf(item), 1);\r\n item.durationSubscription?.unsubscribe();\r\n this.cdr.detectChanges();\r\n }\r\n\r\n moveDone($event: { toState: string }) {\r\n if ($event.toState === 'void' && XIsEmpty(this.message.list)) {\r\n this.message.ref?.overlayRef?.detach();\r\n }\r\n }\r\n\r\n onEnter(item: XMessageOption) {\r\n item.durationSubscription?.unsubscribe();\r\n }\r\n\r\n onLeave(item: XMessageOption) {\r\n if (item.duration) {\r\n item.durationSubscription = of(true)\r\n .pipe(delay(item.duration))\r\n .subscribe(() => this.onClose(item));\r\n }\r\n }\r\n}\r\n","<div class=\"x-message\">\r\n @for (item of message.list; track item.id) {\r\n <x-alert\r\n [@x-move-animation]=\"item.placement\"\r\n (@x-move-animation.done)=\"moveDone($event)\"\r\n (mouseenter)=\"onEnter(item)\"\r\n (mouseleave)=\"onLeave(item)\"\r\n (close)=\"onClose(item)\"\r\n [hide]=\"item.hide!\"\r\n [title]=\"item.title\"\r\n [content]=\"item.content\"\r\n [type]=\"item.type!\"\r\n [effect]=\"item.effect!\"\r\n [hideClose]=\"item.hideClose!\"\r\n [closeText]=\"item.closeText!\"\r\n [showIcon]=\"item.showIcon!\"\r\n [duration]=\"0\"\r\n manual\r\n disabledAnimation\r\n ></x-alert>\r\n }\r\n</div>\r\n","import { XMessageOption } from './message.property';\r\n\r\n// TODO: add more function\r\nexport class XMessageRef {\r\n option: XMessageOption;\r\n constructor(option: XMessageOption) {\r\n if (!option.id) option.id = `${new Date().getTime()}`;\r\n this.option = option;\r\n }\r\n close = () => {};\r\n opened = () => {};\r\n closeAll = () => {};\r\n update = (_option: XMessageOption) => {};\r\n}\r\n","import { Injectable, inject } from '@angular/core';\r\nimport {\r\n XTemplate,\r\n XIsXTemplate,\r\n XIsEmpty,\r\n XFillDefault,\r\n XIsString,\r\n XConfigService,\r\n XMessageConfig,\r\n XIsUndefined\r\n} from '@ng-nest/ui/core';\r\nimport {\r\n XMessageOverlayRef,\r\n XMessageType,\r\n XMessagePlacement,\r\n XMessagePortal,\r\n XMessageOption,\r\n X_MESSAGE_CONFIG_NAME,\r\n XMessagePlacementRef\r\n} from './message.property';\r\nimport { XMessageComponent } from './message.component';\r\nimport { of } from 'rxjs';\r\nimport { delay } from 'rxjs/operators';\r\nimport { XPortalService } from '@ng-nest/ui/portal';\r\nimport { XMessageRef } from './message-ref';\r\n\r\n@Injectable({ providedIn: 'root' })\r\nexport class XMessageService {\r\n messages: XMessagePlacement = {};\r\n\r\n default: XMessageOption = {\r\n type: 'info',\r\n placement: 'top',\r\n offset: '2rem',\r\n effect: 'white',\r\n displayType: 'list',\r\n duration: 3000,\r\n hideClose: true,\r\n showIcon: true,\r\n hide: false\r\n };\r\n\r\n private portal = inject(XPortalService);\r\n private configService = inject(XConfigService);\r\n configDefault?: XMessageConfig = this.configService.getConfigForComponent(X_MESSAGE_CONFIG_NAME);\r\n\r\n constructor() {\r\n Object.assign(this.default, this.configDefault);\r\n }\r\n\r\n info(option: XTemplate | XMessageOption): XMessageRef {\r\n return this.create(option, 'info');\r\n }\r\n\r\n success(option: XTemplate | XMessageOption): XMessageRef {\r\n return this.create(option, 'success');\r\n }\r\n\r\n warning(option: XTemplate | XMessageOption): XMessageRef {\r\n return this.create(option, 'warning');\r\n }\r\n\r\n error(option: XTemplate | XMessageOption): XMessageRef {\r\n return this.create(option, 'error');\r\n }\r\n\r\n loading(option: XTemplate | XMessageOption): XMessageRef {\r\n return this.create(option, 'loading');\r\n }\r\n\r\n create(option: XTemplate | XMessageOption, type: XMessageType): XMessageRef {\r\n let opt: XMessageOption;\r\n if (XIsXTemplate(option)) {\r\n opt = { title: option as XTemplate, type: type };\r\n } else {\r\n opt = option as XMessageOption;\r\n opt.type = type;\r\n }\r\n XFillDefault(opt, this.default);\r\n const ref = new XMessageRef(opt);\r\n if (XIsUndefined(opt.placement)) {\r\n return ref;\r\n }\r\n ref.close = () => {\r\n this.removeMessage(opt);\r\n };\r\n ref.closeAll = () => {\r\n this.closeAll();\r\n };\r\n ref.update = (_opt) => {\r\n this.updateMessage(_opt, opt);\r\n };\r\n ref.opened = () => {\r\n return this.messages[opt.placement!].list.includes(opt);\r\n };\r\n this.setDuration(opt);\r\n this.createMessagePlacement(opt);\r\n\r\n return ref;\r\n }\r\n\r\n private createMessage(option: XMessageOption): XMessageOverlayRef {\r\n const offset = XIsString(option.offset) ? [option.offset as string] : (option.offset as string[]);\r\n return this.portal.attach({\r\n content: XMessageComponent,\r\n overlayConfig: {\r\n panelClass: XMessagePortal,\r\n width: option.width,\r\n height: option.height,\r\n positionStrategy: this.portal.setPlace(option.placement, ...offset)\r\n }\r\n });\r\n }\r\n\r\n private closeAll(excludeOption?: XMessageOption) {\r\n for (let key in this.messages) {\r\n for (let option of this.messages[key].list) {\r\n option !== excludeOption && this.removeMessage(option);\r\n }\r\n }\r\n }\r\n\r\n private createMessagePlacement(option: XMessageOption) {\r\n let msgPlacement = this.messages[option.placement!];\r\n if (XIsEmpty(msgPlacement) || !msgPlacement.ref?.overlayRef?.hasAttached()) {\r\n this.messages[option.placement!] = {\r\n ref: this.createMessage(option),\r\n list: [option],\r\n closeAll: () => {\r\n this.closeAll();\r\n }\r\n };\r\n msgPlacement = this.messages[option.placement!];\r\n } else {\r\n msgPlacement.list = [...(this.messages[option.placement!].list as XMessageOption[]), option];\r\n }\r\n this.messageChange(msgPlacement);\r\n\r\n option.displayType === 'single' && this.closeAll(option);\r\n }\r\n\r\n private messageChange(message: XMessagePlacementRef) {\r\n if (!message.ref?.overlayRef?.hasAttached() || !message?.ref?.componentRef?.instance) return;\r\n message.ref.componentRef.instance.message = message;\r\n message.ref.componentRef.instance.cdr.detectChanges();\r\n }\r\n\r\n private setDuration(option: XMessageOption) {\r\n if (option.duration && option.type !== 'loading') {\r\n option.durationSubscription = of(true)\r\n .pipe(delay(option.duration))\r\n .subscribe(() => {\r\n this.removeMessage(option);\r\n });\r\n }\r\n }\r\n\r\n private removeMessage(option: XMessageOption) {\r\n if (typeof option.placement === 'undefined') return;\r\n this.messages[option.placement].ref?.componentRef?.instance.onClose(option);\r\n }\r\n\r\n private updateMessage(newOption: XMessageOption, oldOption: XMessageOption) {\r\n Object.assign(oldOption, newOption);\r\n this.setDuration(oldOption);\r\n const refs = this.messages[oldOption.placement!];\r\n if (refs) {\r\n refs.ref.componentRef?.instance.cdr.detectChanges();\r\n }\r\n }\r\n}\r\n","import { NgModule } from '@angular/core';\r\n\r\n@NgModule({\r\n exports: [],\r\n imports: []\r\n})\r\nexport class XMessageModule {}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;AAMA;;;;AAIG;AACI,MAAM,cAAc,GAAG;AACvB,MAAM,cAAc,GAAG;AACvB,MAAM,qBAAqB,GAAG;;MCGxB,iBAAiB,CAAA;AAT9B,IAAA,WAAA,GAAA;AAUE,QAAA,IAAA,CAAA,OAAO,GAAyB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,WAAW,CAAC,SAAS,CAAC;QAC3B,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,SAAU,CAAC;QAChD,IAAI,IAAI,EAAE;YACR,IAAI,CAAC,GAAG,CAAC,YAAY,EAAE,QAAQ,CAAC,GAAG,CAAC,aAAa,EAAE;QACrD;IACF;iIA9IW,eAAe,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAf,uBAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,eAAe,cADF,MAAM,EAAA,CAAA,CAAA;;2FACnB,eAAe,EAAA,UAAA,EAAA,CAAA;kBAD3B,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;MCpBrB,cAAc,CAAA;iIAAd,cAAc,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;kIAAd,cAAc,EAAA,CAAA,CAAA;kIAAd,cAAc,EAAA,CAAA,CAAA;;2FAAd,cAAc,EAAA,UAAA,EAAA,CAAA;kBAJ1B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE,EAAE;AACX,oBAAA,OAAO,EAAE;AACV,iBAAA;;;ACLD;;AAEG;;;;"}
1
+ {"version":3,"file":"ng-nest-ui-message.mjs","sources":["../../../../lib/ng-nest/ui/message/message.property.ts","../../../../lib/ng-nest/ui/message/message.component.ts","../../../../lib/ng-nest/ui/message/message.component.html","../../../../lib/ng-nest/ui/message/message-ref.ts","../../../../lib/ng-nest/ui/message/message.service.ts","../../../../lib/ng-nest/ui/message/message.module.ts","../../../../lib/ng-nest/ui/message/ng-nest-ui-message.ts"],"sourcesContent":["import { XStatus, XPlace } from '@ng-nest/ui/core';\r\nimport { XAlertOption } from '@ng-nest/ui/alert';\r\nimport { Subscription, Subject } from 'rxjs';\r\nimport { XPortalOverlayRef } from '@ng-nest/ui/portal';\r\nimport { XMessageComponent } from './message.component';\r\n\r\n/**\r\n * Message\r\n * @selector x-message\r\n * @decorator component\r\n */\r\nexport const XMessagePrefix = 'x-message';\r\nexport const XMessagePortal = 'x-message-portal';\r\nexport const X_MESSAGE_CONFIG_NAME = 'message';\r\n\r\n/**\r\n * Message Option\r\n */\r\nexport interface XMessageOption extends XAlertOption {\r\n /**\r\n * @zh_CN 消息框的 id\r\n * @en_US Message id\r\n */\r\n id?: string;\r\n /**\r\n * @zh_CN 方位,九宫格\r\n * @en_US Direction, nine grid\r\n * @default 'top'\r\n * @withConfig true\r\n */\r\n placement?: XPlace;\r\n /**\r\n * @zh_CN 偏移距离\r\n * @en_US Offset distance\r\n * @default '2rem'\r\n * @withConfig true\r\n */\r\n offset?: string | string[];\r\n /**\r\n * @zh_CN 类型\r\n * @en_US Types of\r\n * @default 'info'\r\n * @withConfig true\r\n */\r\n type?: XMessageType;\r\n /**\r\n * @zh_CN 多个消息的时候,显示类型\r\n * @en_US When multiple messages, the display type\r\n * @default 'list'\r\n * @withConfig true\r\n */\r\n displayType?: XMessageDisplayType;\r\n /**\r\n * @zh_CN 宽度\r\n * @en_US Width\r\n * @withConfig true\r\n */\r\n width?: string;\r\n /**\r\n * @zh_CN 高度\r\n * @en_US Height\r\n */\r\n height?: string;\r\n /**\r\n * @zh_CN 延迟关闭时间\r\n * @en_US Delay off time\r\n * @default 3000\r\n * @withConfig true\r\n */\r\n duration?: number;\r\n /**\r\n * @zh_CN 隐藏关闭按钮\r\n * @en_US Hide close button\r\n * @default true\r\n * @withConfig true\r\n */\r\n hideClose?: boolean;\r\n /**\r\n * @zh_CN 显示图标\r\n * @en_US Show icon\r\n * @default true\r\n * @withConfig true\r\n */\r\n showIcon?: boolean;\r\n /**\r\n * @zh_CN 延迟关闭订阅后的对象,用来释放或取消\r\n * @en_US Delayed closing the subscribed object, used to release or cancel\r\n */\r\n durationSubscription?: Subscription | null;\r\n /**\r\n * @zh_CN 延迟关闭订阅对象\r\n * @en_US Delay in closing the subscription object\r\n */\r\n durationSub?: Subject<any>;\r\n}\r\n\r\n/**\r\n * @zh_CN 创建的消息对象\r\n * @en_US Message object created\r\n */\r\nexport interface XMessageOverlayRef extends XPortalOverlayRef<XMessageComponent> {}\r\n\r\n/**\r\n * @zh_CN 九宫格中的消息对象\r\n * @en_US Message object in Jiugongge\r\n */\r\nexport interface XMessagePlacement {\r\n [property: string]: XMessagePlacementRef;\r\n}\r\n\r\n/**\r\n * @zh_CN 九宫格中的消息对象\r\n * @en_US Message object in Jiugongge\r\n */\r\nexport interface XMessagePlacementRef {\r\n /**\r\n * @zh_CN 方位对应的 overlayRef\r\n * @en_US Placement overlayRef\r\n */\r\n ref: XMessageOverlayRef;\r\n /**\r\n * @zh_CN 对应的消息 list 数据\r\n * @en_US Corresponding message list data\r\n */\r\n list: XMessageOption[];\r\n /**\r\n * @zh_CN 关闭所有数据\r\n * @en_US Close all data\r\n */\r\n closeAll: () => void;\r\n}\r\n\r\n/**\r\n * @zh_CN 类型\r\n * @en_US Types of\r\n */\r\nexport type XMessageType = XStatus;\r\n\r\n/**\r\n * @zh_CN 多个消息的时候,显示类型\r\n * @en_US When multiple messages, the display type\r\n */\r\nexport type XMessageDisplayType = 'list' | 'single';\r\n","import { Component, ViewEncapsulation, ChangeDetectorRef, ChangeDetectionStrategy, inject } from '@angular/core';\r\nimport { XIsEmpty } from '@ng-nest/ui/core';\r\nimport { XMessagePrefix, XMessageOption, XMessagePlacementRef } from './message.property';\r\nimport { of } from 'rxjs';\r\nimport { delay } from 'rxjs/operators';\r\nimport { XAlertComponent } from '@ng-nest/ui/alert';\r\n\r\n@Component({\r\n selector: `${XMessagePrefix}`,\r\n imports: [XAlertComponent],\r\n templateUrl: './message.component.html',\r\n styleUrls: ['./message.component.scss'],\r\n encapsulation: ViewEncapsulation.None,\r\n changeDetection: ChangeDetectionStrategy.OnPush\r\n})\r\nexport class XMessageComponent {\r\n message: XMessagePlacementRef = { ref: {}, list: [], closeAll: () => {} };\r\n cdr = inject(ChangeDetectorRef);\r\n\r\n onClose(item: XMessageOption) {\r\n this.message.list?.splice(this.message.list.indexOf(item), 1);\r\n item.durationSubscription?.unsubscribe();\r\n this.cdr.detectChanges();\r\n }\r\n moveDone($event: AnimationEvent) {\r\n if ($event.animationName.endsWith('-leave') && XIsEmpty(this.message.list)) {\r\n this.message.ref?.overlayRef?.detach();\r\n }\r\n }\r\n\r\n onEnter(item: XMessageOption) {\r\n item.durationSubscription?.unsubscribe();\r\n }\r\n\r\n onLeave(item: XMessageOption) {\r\n if (item.duration) {\r\n item.durationSubscription = of(true)\r\n .pipe(delay(item.duration))\r\n .subscribe(() => this.onClose(item));\r\n }\r\n }\r\n}\r\n","<div class=\"x-message\">\r\n <!-- TODO The style of x-alert will be cleared when the leave animation starts. This ensures that the style will definitely be loaded -->\r\n <x-alert [style.display]=\"'none'\"></x-alert>\r\n @for (item of message.list; track item.id) {\r\n <x-alert\r\n [animate.enter]=\"`x-move-${item.placement}-enter`\"\r\n [animate.leave]=\"`x-move-${item.placement}-leave`\"\r\n (animationend)=\"moveDone($event)\"\r\n (mouseenter)=\"onEnter(item)\"\r\n (mouseleave)=\"onLeave(item)\"\r\n (close)=\"onClose(item)\"\r\n [hide]=\"item.hide!\"\r\n [title]=\"item.title\"\r\n [content]=\"item.content\"\r\n [type]=\"item.type!\"\r\n [effect]=\"item.effect!\"\r\n [hideClose]=\"item.hideClose!\"\r\n [closeText]=\"item.closeText!\"\r\n [showIcon]=\"item.showIcon!\"\r\n [duration]=\"0\"\r\n manual\r\n disabledAnimation\r\n ></x-alert>\r\n }\r\n</div>\r\n","import { XMessageOption } from './message.property';\r\n\r\n// TODO: add more function\r\nexport class XMessageRef {\r\n option: XMessageOption;\r\n constructor(option: XMessageOption) {\r\n if (!option.id) option.id = `${new Date().getTime()}`;\r\n this.option = option;\r\n }\r\n close = () => {};\r\n opened = () => {};\r\n closeAll = () => {};\r\n update = (_option: XMessageOption) => {};\r\n}\r\n","import { Injectable, inject } from '@angular/core';\r\nimport {\r\n XTemplate,\r\n XIsXTemplate,\r\n XIsEmpty,\r\n XFillDefault,\r\n XIsString,\r\n XConfigService,\r\n XMessageConfig,\r\n XIsUndefined\r\n} from '@ng-nest/ui/core';\r\nimport {\r\n XMessageOverlayRef,\r\n XMessageType,\r\n XMessagePlacement,\r\n XMessagePortal,\r\n XMessageOption,\r\n X_MESSAGE_CONFIG_NAME,\r\n XMessagePlacementRef\r\n} from './message.property';\r\nimport { XMessageComponent } from './message.component';\r\nimport { of } from 'rxjs';\r\nimport { delay } from 'rxjs/operators';\r\nimport { XPortalService } from '@ng-nest/ui/portal';\r\nimport { XMessageRef } from './message-ref';\r\n\r\n@Injectable({ providedIn: 'root' })\r\nexport class XMessageService {\r\n messages: XMessagePlacement = {};\r\n\r\n default: XMessageOption = {\r\n type: 'info',\r\n placement: 'top',\r\n offset: '2rem',\r\n effect: 'white',\r\n displayType: 'list',\r\n duration: 3000,\r\n hideClose: true,\r\n showIcon: true,\r\n hide: false\r\n };\r\n\r\n private portal = inject(XPortalService);\r\n private configService = inject(XConfigService);\r\n configDefault?: XMessageConfig = this.configService.getConfigForComponent(X_MESSAGE_CONFIG_NAME);\r\n\r\n constructor() {\r\n Object.assign(this.default, this.configDefault);\r\n }\r\n\r\n info(option: XTemplate | XMessageOption): XMessageRef {\r\n return this.create(option, 'info');\r\n }\r\n\r\n success(option: XTemplate | XMessageOption): XMessageRef {\r\n return this.create(option, 'success');\r\n }\r\n\r\n warning(option: XTemplate | XMessageOption): XMessageRef {\r\n return this.create(option, 'warning');\r\n }\r\n\r\n error(option: XTemplate | XMessageOption): XMessageRef {\r\n return this.create(option, 'error');\r\n }\r\n\r\n loading(option: XTemplate | XMessageOption): XMessageRef {\r\n return this.create(option, 'loading');\r\n }\r\n\r\n create(option: XTemplate | XMessageOption, type: XMessageType): XMessageRef {\r\n let opt: XMessageOption;\r\n if (XIsXTemplate(option)) {\r\n opt = { title: option as XTemplate, type: type };\r\n } else {\r\n opt = option as XMessageOption;\r\n opt.type = type;\r\n }\r\n XFillDefault(opt, this.default);\r\n const ref = new XMessageRef(opt);\r\n if (XIsUndefined(opt.placement)) {\r\n return ref;\r\n }\r\n ref.close = () => {\r\n this.removeMessage(opt);\r\n };\r\n ref.closeAll = () => {\r\n this.closeAll();\r\n };\r\n ref.update = (_opt) => {\r\n this.updateMessage(_opt, opt);\r\n };\r\n ref.opened = () => {\r\n return this.messages[opt.placement!].list.includes(opt);\r\n };\r\n this.setDuration(opt);\r\n this.createMessagePlacement(opt);\r\n\r\n return ref;\r\n }\r\n\r\n private createMessage(option: XMessageOption): XMessageOverlayRef {\r\n const offset = XIsString(option.offset) ? [option.offset as string] : (option.offset as string[]);\r\n return this.portal.attach({\r\n content: XMessageComponent,\r\n overlayConfig: {\r\n panelClass: XMessagePortal,\r\n width: option.width,\r\n height: option.height,\r\n positionStrategy: this.portal.setPlace(option.placement, ...offset)\r\n }\r\n });\r\n }\r\n\r\n private closeAll(excludeOption?: XMessageOption) {\r\n for (let key in this.messages) {\r\n for (let option of this.messages[key].list) {\r\n option !== excludeOption && this.removeMessage(option);\r\n }\r\n }\r\n }\r\n\r\n private createMessagePlacement(option: XMessageOption) {\r\n let msgPlacement = this.messages[option.placement!];\r\n if (XIsEmpty(msgPlacement) || !msgPlacement.ref?.overlayRef?.hasAttached()) {\r\n this.messages[option.placement!] = {\r\n ref: this.createMessage(option),\r\n list: [option],\r\n closeAll: () => {\r\n this.closeAll();\r\n }\r\n };\r\n msgPlacement = this.messages[option.placement!];\r\n } else {\r\n msgPlacement.list = [...(this.messages[option.placement!].list as XMessageOption[]), option];\r\n }\r\n this.messageChange(msgPlacement);\r\n\r\n option.displayType === 'single' && this.closeAll(option);\r\n }\r\n\r\n private messageChange(message: XMessagePlacementRef) {\r\n if (!message.ref?.overlayRef?.hasAttached() || !message?.ref?.componentRef?.instance) return;\r\n message.ref.componentRef.instance.message = message;\r\n message.ref.componentRef.instance.cdr.detectChanges();\r\n }\r\n\r\n private setDuration(option: XMessageOption) {\r\n if (option.duration && option.type !== 'loading') {\r\n option.durationSubscription = of(true)\r\n .pipe(delay(option.duration))\r\n .subscribe(() => {\r\n this.removeMessage(option);\r\n });\r\n }\r\n }\r\n\r\n private removeMessage(option: XMessageOption) {\r\n if (typeof option.placement === 'undefined') return;\r\n this.messages[option.placement].ref?.componentRef?.instance.onClose(option);\r\n }\r\n\r\n private updateMessage(newOption: XMessageOption, oldOption: XMessageOption) {\r\n Object.assign(oldOption, newOption);\r\n this.setDuration(oldOption);\r\n const refs = this.messages[oldOption.placement!];\r\n if (refs) {\r\n refs.ref.componentRef?.instance.cdr.detectChanges();\r\n }\r\n }\r\n}\r\n","import { NgModule } from '@angular/core';\r\n\r\n@NgModule({\r\n exports: [],\r\n imports: []\r\n})\r\nexport class XMessageModule {}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;AAMA;;;;AAIG;AACI,MAAM,cAAc,GAAG;AACvB,MAAM,cAAc,GAAG;AACvB,MAAM,qBAAqB,GAAG;;MCExB,iBAAiB,CAAA;AAR9B,IAAA,WAAA,GAAA;AASE,QAAA,IAAA,CAAA,OAAO,GAAyB,EAAE,GAAG,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,QAAQ,EAAE,MAAK,EAAE,CAAC,EAAE;AACzE,QAAA,IAAA,CAAA,GAAG,GAAG,MAAM,CAAC,iBAAiB,CAAC;AAwBhC,IAAA;AAtBC,IAAA,OAAO,CAAC,IAAoB,EAAA;QAC1B,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;A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AAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,eAAe,cADF,MAAM,EAAA,CAAA,CAAA;;2FACnB,eAAe,EAAA,UAAA,EAAA,CAAA;kBAD3B,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;MCpBrB,cAAc,CAAA;iIAAd,cAAc,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;kIAAd,cAAc,EAAA,CAAA,CAAA;kIAAd,cAAc,EAAA,CAAA,CAAA;;2FAAd,cAAc,EAAA,UAAA,EAAA,CAAA;kBAJ1B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE,EAAE;AACX,oBAAA,OAAO,EAAE;AACV,iBAAA;;;ACLD;;AAEG;;;;"}
@@ -1,6 +1,6 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { inject, ChangeDetectorRef, ChangeDetectionStrategy, ViewEncapsulation, Component, Injectable, NgModule } from '@angular/core';
3
- import { XIsEmpty, XMoveAnimation, XIsString, XIsXTemplate, XFillDefault } from '@ng-nest/ui/core';
3
+ import { XIsEmpty, XIsString, XIsXTemplate, XFillDefault } from '@ng-nest/ui/core';
4
4
  import { of } from 'rxjs';
5
5
  import { delay } from 'rxjs/operators';
6
6
  import { XAlertComponent } from '@ng-nest/ui/alert';
@@ -25,7 +25,7 @@ class XNotificationComponent {
25
25
  this.cdr.detectChanges();
26
26
  }
27
27
  moveDone($event) {
28
- if ($event.toState === 'void' && XIsEmpty(this.notification.list)) {
28
+ if ($event.animationName.endsWith('-leave') && XIsEmpty(this.notification.list)) {
29
29
  this.notification.ref?.overlayRef?.detach();
30
30
  }
31
31
  }
@@ -42,11 +42,11 @@ class XNotificationComponent {
42
42
  }
43
43
  }
44
44
  /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.5", ngImport: i0, type: XNotificationComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
45
- /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.5", type: XNotificationComponent, isStandalone: true, selector: "x-notification", ngImport: i0, template: "<div class=\"x-notification\">\r\n @for (item of notification.list; track item) {\r\n <x-alert\r\n [@x-move-animation]=\"item.placement\"\r\n (@x-move-animation.done)=\"moveDone($event)\"\r\n (mouseenter)=\"onEnter(item)\"\r\n (mouseleave)=\"onLeave(item)\"\r\n (close)=\"onClose(item)\"\r\n [hide]=\"item.hide!\"\r\n [title]=\"item.title\"\r\n [content]=\"item.content\"\r\n [type]=\"item.type!\"\r\n [effect]=\"item.effect!\"\r\n [hideClose]=\"item.hideClose!\"\r\n [closeText]=\"item.closeText\"\r\n [showIcon]=\"item.showIcon!\"\r\n [duration]=\"0\"\r\n manual\r\n disabledAnimation\r\n ></x-alert>\r\n }\r\n</div>\r\n", styles: [".x-notification{margin:0;padding:0}.x-notification>x-alert{padding:.25rem}.x-notification>x-alert>.x-alert{box-shadow:var(--x-box-shadow)}.x-notification>x-alert .x-alert-icon.x-icon{margin-top:.125rem;font-size:1.25rem;align-self:flex-start}.x-notification-portal x-notification{width:100%}\n"], dependencies: [{ kind: "component", type: XAlertComponent, selector: "x-alert" }], animations: [XMoveAnimation], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
45
+ /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.5", type: XNotificationComponent, isStandalone: true, selector: "x-notification", ngImport: i0, template: "<div class=\"x-notification\">\r\n <!-- TODO The style of x-alert will be cleared when the leave animation starts. This ensures that the style will definitely be loaded -->\r\n <x-alert [style.display]=\"'none'\"></x-alert>\r\n @for (item of notification.list; track item) {\r\n <x-alert\r\n [animate.enter]=\"`x-move-${item.placement}-enter`\"\r\n [animate.leave]=\"`x-move-${item.placement}-leave`\"\r\n (animationend)=\"moveDone($event)\"\r\n (mouseenter)=\"onEnter(item)\"\r\n (mouseleave)=\"onLeave(item)\"\r\n (close)=\"onClose(item)\"\r\n [hide]=\"item.hide!\"\r\n [title]=\"item.title\"\r\n [content]=\"item.content\"\r\n [type]=\"item.type!\"\r\n [effect]=\"item.effect!\"\r\n [hideClose]=\"item.hideClose!\"\r\n [closeText]=\"item.closeText\"\r\n [showIcon]=\"item.showIcon!\"\r\n [duration]=\"0\"\r\n manual\r\n disabledAnimation\r\n ></x-alert>\r\n }\r\n</div>\r\n", styles: [".x-notification{margin:0;padding:0}.x-notification>x-alert{padding:.25rem}.x-notification>x-alert>.x-alert{box-shadow:var(--x-box-shadow)}.x-notification>x-alert .x-alert-icon.x-icon{margin-top:.125rem;font-size:1.25rem;align-self:flex-start}.x-notification-portal x-notification{width:100%}\n"], dependencies: [{ kind: "component", type: XAlertComponent, selector: "x-alert" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
46
46
  }
47
47
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.5", ngImport: i0, type: XNotificationComponent, decorators: [{
48
48
  type: Component,
49
- args: [{ selector: `${XNotificationPrefix}`, imports: [XAlertComponent], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, animations: [XMoveAnimation], template: "<div class=\"x-notification\">\r\n @for (item of notification.list; track item) {\r\n <x-alert\r\n [@x-move-animation]=\"item.placement\"\r\n (@x-move-animation.done)=\"moveDone($event)\"\r\n (mouseenter)=\"onEnter(item)\"\r\n (mouseleave)=\"onLeave(item)\"\r\n (close)=\"onClose(item)\"\r\n [hide]=\"item.hide!\"\r\n [title]=\"item.title\"\r\n [content]=\"item.content\"\r\n [type]=\"item.type!\"\r\n [effect]=\"item.effect!\"\r\n [hideClose]=\"item.hideClose!\"\r\n [closeText]=\"item.closeText\"\r\n [showIcon]=\"item.showIcon!\"\r\n [duration]=\"0\"\r\n manual\r\n disabledAnimation\r\n ></x-alert>\r\n }\r\n</div>\r\n", styles: [".x-notification{margin:0;padding:0}.x-notification>x-alert{padding:.25rem}.x-notification>x-alert>.x-alert{box-shadow:var(--x-box-shadow)}.x-notification>x-alert .x-alert-icon.x-icon{margin-top:.125rem;font-size:1.25rem;align-self:flex-start}.x-notification-portal x-notification{width:100%}\n"] }]
49
+ args: [{ selector: `${XNotificationPrefix}`, imports: [XAlertComponent], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"x-notification\">\r\n <!-- TODO The style of x-alert will be cleared when the leave animation starts. This ensures that the style will definitely be loaded -->\r\n <x-alert [style.display]=\"'none'\"></x-alert>\r\n @for (item of notification.list; track item) {\r\n <x-alert\r\n [animate.enter]=\"`x-move-${item.placement}-enter`\"\r\n [animate.leave]=\"`x-move-${item.placement}-leave`\"\r\n (animationend)=\"moveDone($event)\"\r\n (mouseenter)=\"onEnter(item)\"\r\n (mouseleave)=\"onLeave(item)\"\r\n (close)=\"onClose(item)\"\r\n [hide]=\"item.hide!\"\r\n [title]=\"item.title\"\r\n [content]=\"item.content\"\r\n [type]=\"item.type!\"\r\n [effect]=\"item.effect!\"\r\n [hideClose]=\"item.hideClose!\"\r\n [closeText]=\"item.closeText\"\r\n [showIcon]=\"item.showIcon!\"\r\n [duration]=\"0\"\r\n manual\r\n disabledAnimation\r\n ></x-alert>\r\n }\r\n</div>\r\n", styles: [".x-notification{margin:0;padding:0}.x-notification>x-alert{padding:.25rem}.x-notification>x-alert>.x-alert{box-shadow:var(--x-box-shadow)}.x-notification>x-alert .x-alert-icon.x-icon{margin-top:.125rem;font-size:1.25rem;align-self:flex-start}.x-notification-portal x-notification{width:100%}\n"] }]
50
50
  }] });
51
51
 
52
52
  class XNotificationService {
@@ -1 +1 @@
1
- {"version":3,"file":"ng-nest-ui-notification.mjs","sources":["../../../../lib/ng-nest/ui/notification/notification.property.ts","../../../../lib/ng-nest/ui/notification/notification.component.ts","../../../../lib/ng-nest/ui/notification/notification.component.html","../../../../lib/ng-nest/ui/notification/notification.service.ts","../../../../lib/ng-nest/ui/notification/notification.module.ts","../../../../lib/ng-nest/ui/notification/ng-nest-ui-notification.ts"],"sourcesContent":["import { XStatus, XCorner } from '@ng-nest/ui/core';\r\nimport { XAlertOption } from '@ng-nest/ui/alert';\r\nimport { XNotificationComponent } from './notification.component';\r\nimport { XPortalOverlayRef } from '@ng-nest/ui/portal';\r\nimport { Subscription, Subject } from 'rxjs';\r\n\r\n/**\r\n * Notification\r\n * @selector x-notification\r\n * @decorator component\r\n */\r\nexport const XNotificationPrefix = 'x-notification';\r\n\r\nexport const XNotificationPortal = 'x-notification-portal';\r\n\r\n/**\r\n * Notification Option\r\n */\r\nexport interface XNotificationOption extends XAlertOption {\r\n /**\r\n * @zh_CN 方位\r\n * @en_US Placement\r\n * @default 'top-end'\r\n */\r\n placement?: XCorner;\r\n /**\r\n * @zh_CN 偏移距离\r\n * @en_US Offset distance\r\n * @default '0.5rem'\r\n */\r\n offset?: string | string[];\r\n /**\r\n * @zh_CN 类型\r\n * @en_US Types of\r\n * @default 'info'\r\n */\r\n type?: XNotificationType;\r\n /**\r\n * @zh_CN 宽度\r\n * @en_US Width\r\n * @default '20rem'\r\n */\r\n width?: string;\r\n /**\r\n * @zh_CN 高度\r\n * @en_US Height\r\n */\r\n height?: string;\r\n /**\r\n * @zh_CN 延迟关闭时间\r\n * @en_US Delay off time\r\n * @default 4500\r\n */\r\n duration?: number;\r\n /**\r\n * @zh_CN 隐藏关闭按钮\r\n * @en_US Hide close button\r\n * @default true\r\n */\r\n hideClose?: boolean;\r\n /**\r\n * @zh_CN 显示图标\r\n * @en_US Show icon\r\n * @default true\r\n */\r\n showIcon?: boolean;\r\n /**\r\n * @zh_CN 延迟关闭订阅后的对象,用来释放或取消\r\n * @en_US Delayed closing the subscribed object, used to release or cancel\r\n */\r\n durationSubscription?: Subscription | null;\r\n /**\r\n * @zh_CN 延迟关闭订阅对象\r\n * @en_US Delay in closing the subscription object\r\n */\r\n durationSub?: Subject<any>;\r\n}\r\n\r\n/**\r\n * @zh_CN 创建的消息对象\r\n * @en_US Message object created\r\n */\r\nexport interface XNotificationOverlayRef extends XPortalOverlayRef<XNotificationComponent> {}\r\n\r\n/**\r\n * @zh_CN 九宫格中的消息对象\r\n * @en_US Message object in nine grid\r\n */\r\nexport interface XNotificationPlacement {\r\n [property: string]: XNotificationRef;\r\n}\r\n\r\nexport interface XNotificationRef {\r\n ref?: XNotificationOverlayRef;\r\n list?: XNotificationOption[];\r\n}\r\n\r\n/**\r\n * @zh_CN 类型\r\n * @en_US Types of\r\n */\r\nexport type XNotificationType = XStatus;\r\n","import { Component, ViewEncapsulation, ChangeDetectorRef, ChangeDetectionStrategy, inject } from '@angular/core';\r\nimport { XMoveAnimation, XIsEmpty } from '@ng-nest/ui/core';\r\nimport { XNotificationPrefix, XNotificationOption, XNotificationRef } from './notification.property';\r\nimport { of } from 'rxjs';\r\nimport { delay } from 'rxjs/operators';\r\nimport { XAlertComponent } from '@ng-nest/ui/alert';\r\n\r\n@Component({\r\n selector: `${XNotificationPrefix}`,\r\n imports: [XAlertComponent],\r\n templateUrl: './notification.component.html',\r\n styleUrls: ['./notification.component.scss'],\r\n encapsulation: ViewEncapsulation.None,\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n animations: [XMoveAnimation]\r\n})\r\nexport class XNotificationComponent {\r\n notification: XNotificationRef = { list: [] };\r\n\r\n cdr = inject(ChangeDetectorRef);\r\n\r\n onClose(item: XNotificationOption) {\r\n this.notification.list?.splice(this.notification.list.indexOf(item), 1);\r\n item.durationSubscription && item.durationSubscription.unsubscribe();\r\n this.cdr.detectChanges();\r\n }\r\n\r\n moveDone($event: { toState: string }) {\r\n if ($event.toState === 'void' && XIsEmpty(this.notification.list)) {\r\n this.notification.ref?.overlayRef?.detach();\r\n }\r\n }\r\n\r\n onEnter(item: XNotificationOption) {\r\n item.durationSubscription && item.durationSubscription.unsubscribe();\r\n }\r\n\r\n onLeave(item: XNotificationOption) {\r\n if (item.duration) {\r\n item.durationSubscription = of(true)\r\n .pipe(delay(item.duration))\r\n .subscribe(() => {\r\n this.onClose(item);\r\n });\r\n }\r\n }\r\n}\r\n","<div class=\"x-notification\">\r\n @for (item of notification.list; track item) {\r\n <x-alert\r\n [@x-move-animation]=\"item.placement\"\r\n (@x-move-animation.done)=\"moveDone($event)\"\r\n (mouseenter)=\"onEnter(item)\"\r\n (mouseleave)=\"onLeave(item)\"\r\n (close)=\"onClose(item)\"\r\n [hide]=\"item.hide!\"\r\n [title]=\"item.title\"\r\n [content]=\"item.content\"\r\n [type]=\"item.type!\"\r\n [effect]=\"item.effect!\"\r\n [hideClose]=\"item.hideClose!\"\r\n [closeText]=\"item.closeText\"\r\n [showIcon]=\"item.showIcon!\"\r\n [duration]=\"0\"\r\n manual\r\n disabledAnimation\r\n ></x-alert>\r\n }\r\n</div>\r\n","import { Injectable, inject } from '@angular/core';\r\nimport { XTemplate, XIsXTemplate, XFillDefault, XIsEmpty, XIsString } from '@ng-nest/ui/core';\r\nimport {\r\n XNotificationOption,\r\n XNotificationOverlayRef,\r\n XNotificationType,\r\n XNotificationPlacement,\r\n XNotificationRef,\r\n XNotificationPortal\r\n} from './notification.property';\r\nimport { XNotificationComponent } from './notification.component';\r\nimport { of } from 'rxjs';\r\nimport { delay } from 'rxjs/operators';\r\nimport { XPortalService } from '@ng-nest/ui/portal';\r\n\r\n@Injectable({ providedIn: 'root' })\r\nexport class XNotificationService {\r\n notifications: XNotificationPlacement = {};\r\n\r\n default: XNotificationOption = {\r\n type: 'info',\r\n width: '20rem',\r\n placement: 'top-end',\r\n offset: '0.5rem',\r\n effect: 'white',\r\n duration: 4500,\r\n showIcon: true\r\n };\r\n\r\n private portal = inject(XPortalService);\r\n\r\n info(option: XTemplate | XNotificationOption): XNotificationRef {\r\n return this.createNotification(option, 'info');\r\n }\r\n\r\n success(option: XTemplate | XNotificationOption): XNotificationRef {\r\n return this.createNotification(option, 'success');\r\n }\r\n\r\n warning(option: XTemplate | XNotificationOption): XNotificationRef {\r\n return this.createNotification(option, 'warning');\r\n }\r\n\r\n error(option: XTemplate | XNotificationOption): XNotificationRef {\r\n return this.createNotification(option, 'error');\r\n }\r\n\r\n create(option: XNotificationOption): XNotificationOverlayRef {\r\n const offset = XIsString(option.offset) ? [option.offset as string] : (option.offset as string[]);\r\n return this.portal.attach({\r\n content: XNotificationComponent,\r\n overlayConfig: {\r\n panelClass: XNotificationPortal,\r\n width: option.width,\r\n height: option.height,\r\n positionStrategy: this.portal.setPlace(option.placement, ...offset)\r\n }\r\n });\r\n }\r\n\r\n private createNotification(option: XTemplate | XNotificationOption, type: XNotificationType): XNotificationRef {\r\n let opt: XNotificationOption;\r\n if (XIsXTemplate(option)) {\r\n opt = { title: option as XTemplate, type: type };\r\n } else {\r\n opt = option as XNotificationOption;\r\n opt.type = type;\r\n }\r\n XFillDefault(opt, this.default);\r\n return this.createNotificationPlacement(opt);\r\n }\r\n\r\n private createNotificationPlacement(option: XNotificationOption): XNotificationRef {\r\n if (typeof option.placement === 'undefined') return {};\r\n let msgPlacement = this.notifications[option.placement];\r\n this.setDuration(option);\r\n if (XIsEmpty(msgPlacement) || !msgPlacement.ref?.overlayRef?.hasAttached()) {\r\n this.notifications[option.placement] = {\r\n ref: this.create(option),\r\n list: [option]\r\n };\r\n } else {\r\n this.notifications[option.placement].list = [\r\n ...(this.notifications[option.placement].list as XNotificationOption[]),\r\n option\r\n ];\r\n }\r\n this.notificationChange(this.notifications[option.placement]);\r\n\r\n return this.notifications[option.placement];\r\n }\r\n\r\n private notificationChange(notification: XNotificationRef) {\r\n if (!notification.ref?.overlayRef?.hasAttached() || !notification?.ref?.componentRef?.instance) return;\r\n notification.ref.componentRef.instance.notification = notification;\r\n notification.ref.componentRef.instance.cdr.detectChanges();\r\n }\r\n\r\n private setDuration(option: XNotificationOption) {\r\n if (option.duration) {\r\n option.durationSubscription = of(true)\r\n .pipe(delay(option.duration))\r\n .subscribe(() => {\r\n this.removeNotification(option);\r\n option.durationSubscription && option.durationSubscription.unsubscribe();\r\n });\r\n }\r\n }\r\n\r\n private removeNotification(option: XNotificationOption) {\r\n if (typeof option.placement === 'undefined') return;\r\n this.notifications[option.placement].ref?.componentRef?.instance.onClose(option);\r\n }\r\n}\r\n","import { NgModule } from '@angular/core';\r\n\r\n@NgModule({\r\n exports: [],\r\n imports: []\r\n})\r\nexport class XNotificationModule {}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;AAMA;;;;AAIG;AACI,MAAM,mBAAmB,GAAG;AAE5B,MAAM,mBAAmB,GAAG;;MCGtB,sBAAsB,CAAA;AATnC,IAAA,WAAA,GAAA;AAUE,QAAA,IAAA,CAAA,YAAY,GAAqB,EAAE,IAAI,EAAE,EAAE,EAAE;AAE7C,QAAA,IAAA,CAAA,GAAG,GAAG,MAAM,CAAC,iBAAiB,CAAC;AA2BhC,IAAA;AAzBC,IAAA,OAAO,CAAC,IAAyB,EAAA;QAC/B,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACvE,IAAI,CAAC,oBAAoB,IAAI,IAAI,CAAC,oBAAoB,CAAC,WAAW,EAAE;AACpE,QAAA,IAAI,CAAC,GAAG,CAAC,aAAa,EAAE;IAC1B;AAEA,IAAA,QAAQ,CAAC,MAA2B,EAAA;AAClC,QAAA,IAAI,MAAM,CAAC,OAAO,KAAK,MAAM,IAAI,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE;YACjE,IAAI,CAAC,YAAY,CAAC,GAAG,EAAE,UAAU,EAAE,MAAM,EAAE;QAC7C;IACF;AAEA,IAAA,OAAO,CAAC,IAAyB,EAAA;QAC/B,IAAI,CAAC,oBAAoB,IAAI,IAAI,CAAC,oBAAoB,C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IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,oBAAoB,cADP,MAAM,EAAA,CAAA,CAAA;;2FACnB,oBAAoB,EAAA,UAAA,EAAA,CAAA;kBADhC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;MCTrB,mBAAmB,CAAA;iIAAnB,mBAAmB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;kIAAnB,mBAAmB,EAAA,CAAA,CAAA;kIAAnB,mBAAmB,EAAA,CAAA,CAAA;;2FAAnB,mBAAmB,EAAA,UAAA,EAAA,CAAA;kBAJ/B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE,EAAE;AACX,oBAAA,OAAO,EAAE;AACV,iBAAA;;;ACLD;;AAEG;;;;"}
1
+ {"version":3,"file":"ng-nest-ui-notification.mjs","sources":["../../../../lib/ng-nest/ui/notification/notification.property.ts","../../../../lib/ng-nest/ui/notification/notification.component.ts","../../../../lib/ng-nest/ui/notification/notification.component.html","../../../../lib/ng-nest/ui/notification/notification.service.ts","../../../../lib/ng-nest/ui/notification/notification.module.ts","../../../../lib/ng-nest/ui/notification/ng-nest-ui-notification.ts"],"sourcesContent":["import { XStatus, XCorner } from '@ng-nest/ui/core';\r\nimport { XAlertOption } from '@ng-nest/ui/alert';\r\nimport { XNotificationComponent } from './notification.component';\r\nimport { XPortalOverlayRef } from '@ng-nest/ui/portal';\r\nimport { Subscription, Subject } from 'rxjs';\r\n\r\n/**\r\n * Notification\r\n * @selector x-notification\r\n * @decorator component\r\n */\r\nexport const XNotificationPrefix = 'x-notification';\r\n\r\nexport const XNotificationPortal = 'x-notification-portal';\r\n\r\n/**\r\n * Notification Option\r\n */\r\nexport interface XNotificationOption extends XAlertOption {\r\n /**\r\n * @zh_CN 方位\r\n * @en_US Placement\r\n * @default 'top-end'\r\n */\r\n placement?: XCorner;\r\n /**\r\n * @zh_CN 偏移距离\r\n * @en_US Offset distance\r\n * @default '0.5rem'\r\n */\r\n offset?: string | string[];\r\n /**\r\n * @zh_CN 类型\r\n * @en_US Types of\r\n * @default 'info'\r\n */\r\n type?: XNotificationType;\r\n /**\r\n * @zh_CN 宽度\r\n * @en_US Width\r\n * @default '20rem'\r\n */\r\n width?: string;\r\n /**\r\n * @zh_CN 高度\r\n * @en_US Height\r\n */\r\n height?: string;\r\n /**\r\n * @zh_CN 延迟关闭时间\r\n * @en_US Delay off time\r\n * @default 4500\r\n */\r\n duration?: number;\r\n /**\r\n * @zh_CN 隐藏关闭按钮\r\n * @en_US Hide close button\r\n * @default true\r\n */\r\n hideClose?: boolean;\r\n /**\r\n * @zh_CN 显示图标\r\n * @en_US Show icon\r\n * @default true\r\n */\r\n showIcon?: boolean;\r\n /**\r\n * @zh_CN 延迟关闭订阅后的对象,用来释放或取消\r\n * @en_US Delayed closing the subscribed object, used to release or cancel\r\n */\r\n durationSubscription?: Subscription | null;\r\n /**\r\n * @zh_CN 延迟关闭订阅对象\r\n * @en_US Delay in closing the subscription object\r\n */\r\n durationSub?: Subject<any>;\r\n}\r\n\r\n/**\r\n * @zh_CN 创建的消息对象\r\n * @en_US Message object created\r\n */\r\nexport interface XNotificationOverlayRef extends XPortalOverlayRef<XNotificationComponent> {}\r\n\r\n/**\r\n * @zh_CN 九宫格中的消息对象\r\n * @en_US Message object in nine grid\r\n */\r\nexport interface XNotificationPlacement {\r\n [property: string]: XNotificationRef;\r\n}\r\n\r\nexport interface XNotificationRef {\r\n ref?: XNotificationOverlayRef;\r\n list?: XNotificationOption[];\r\n}\r\n\r\n/**\r\n * @zh_CN 类型\r\n * @en_US Types of\r\n */\r\nexport type XNotificationType = XStatus;\r\n","import { Component, ViewEncapsulation, ChangeDetectorRef, ChangeDetectionStrategy, inject } from '@angular/core';\r\nimport { XIsEmpty } from '@ng-nest/ui/core';\r\nimport { XNotificationPrefix, XNotificationOption, XNotificationRef } from './notification.property';\r\nimport { of } from 'rxjs';\r\nimport { delay } from 'rxjs/operators';\r\nimport { XAlertComponent } from '@ng-nest/ui/alert';\r\n\r\n@Component({\r\n selector: `${XNotificationPrefix}`,\r\n imports: [XAlertComponent],\r\n templateUrl: './notification.component.html',\r\n styleUrls: ['./notification.component.scss'],\r\n encapsulation: ViewEncapsulation.None,\r\n changeDetection: ChangeDetectionStrategy.OnPush\r\n})\r\nexport class XNotificationComponent {\r\n notification: XNotificationRef = { list: [] };\r\n\r\n cdr = inject(ChangeDetectorRef);\r\n\r\n onClose(item: XNotificationOption) {\r\n this.notification.list?.splice(this.notification.list.indexOf(item), 1);\r\n item.durationSubscription && item.durationSubscription.unsubscribe();\r\n this.cdr.detectChanges();\r\n }\r\n\r\n moveDone($event: AnimationEvent) {\r\n if ($event.animationName.endsWith('-leave') && XIsEmpty(this.notification.list)) {\r\n this.notification.ref?.overlayRef?.detach();\r\n }\r\n }\r\n\r\n onEnter(item: XNotificationOption) {\r\n item.durationSubscription && item.durationSubscription.unsubscribe();\r\n }\r\n\r\n onLeave(item: XNotificationOption) {\r\n if (item.duration) {\r\n item.durationSubscription = of(true)\r\n .pipe(delay(item.duration))\r\n .subscribe(() => {\r\n this.onClose(item);\r\n });\r\n }\r\n }\r\n}\r\n","<div class=\"x-notification\">\r\n <!-- TODO The style of x-alert will be cleared when the leave animation starts. This ensures that the style will definitely be loaded -->\r\n <x-alert [style.display]=\"'none'\"></x-alert>\r\n @for (item of notification.list; track item) {\r\n <x-alert\r\n [animate.enter]=\"`x-move-${item.placement}-enter`\"\r\n [animate.leave]=\"`x-move-${item.placement}-leave`\"\r\n (animationend)=\"moveDone($event)\"\r\n (mouseenter)=\"onEnter(item)\"\r\n (mouseleave)=\"onLeave(item)\"\r\n (close)=\"onClose(item)\"\r\n [hide]=\"item.hide!\"\r\n [title]=\"item.title\"\r\n [content]=\"item.content\"\r\n [type]=\"item.type!\"\r\n [effect]=\"item.effect!\"\r\n [hideClose]=\"item.hideClose!\"\r\n [closeText]=\"item.closeText\"\r\n [showIcon]=\"item.showIcon!\"\r\n [duration]=\"0\"\r\n manual\r\n disabledAnimation\r\n ></x-alert>\r\n }\r\n</div>\r\n","import { Injectable, inject } from '@angular/core';\r\nimport { XTemplate, XIsXTemplate, XFillDefault, XIsEmpty, XIsString } from '@ng-nest/ui/core';\r\nimport {\r\n XNotificationOption,\r\n XNotificationOverlayRef,\r\n XNotificationType,\r\n XNotificationPlacement,\r\n XNotificationRef,\r\n XNotificationPortal\r\n} from './notification.property';\r\nimport { XNotificationComponent } from './notification.component';\r\nimport { of } from 'rxjs';\r\nimport { delay } from 'rxjs/operators';\r\nimport { XPortalService } from '@ng-nest/ui/portal';\r\n\r\n@Injectable({ providedIn: 'root' })\r\nexport class XNotificationService {\r\n notifications: XNotificationPlacement = {};\r\n\r\n default: XNotificationOption = {\r\n type: 'info',\r\n width: '20rem',\r\n placement: 'top-end',\r\n offset: '0.5rem',\r\n effect: 'white',\r\n duration: 4500,\r\n showIcon: true\r\n };\r\n\r\n private portal = inject(XPortalService);\r\n\r\n info(option: XTemplate | XNotificationOption): XNotificationRef {\r\n return this.createNotification(option, 'info');\r\n }\r\n\r\n success(option: XTemplate | XNotificationOption): XNotificationRef {\r\n return this.createNotification(option, 'success');\r\n }\r\n\r\n warning(option: XTemplate | XNotificationOption): XNotificationRef {\r\n return this.createNotification(option, 'warning');\r\n }\r\n\r\n error(option: XTemplate | XNotificationOption): XNotificationRef {\r\n return this.createNotification(option, 'error');\r\n }\r\n\r\n create(option: XNotificationOption): XNotificationOverlayRef {\r\n const offset = XIsString(option.offset) ? [option.offset as string] : (option.offset as string[]);\r\n return this.portal.attach({\r\n content: XNotificationComponent,\r\n overlayConfig: {\r\n panelClass: XNotificationPortal,\r\n width: option.width,\r\n height: option.height,\r\n positionStrategy: this.portal.setPlace(option.placement, ...offset)\r\n }\r\n });\r\n }\r\n\r\n private createNotification(option: XTemplate | XNotificationOption, type: XNotificationType): XNotificationRef {\r\n let opt: XNotificationOption;\r\n if (XIsXTemplate(option)) {\r\n opt = { title: option as XTemplate, type: type };\r\n } else {\r\n opt = option as XNotificationOption;\r\n opt.type = type;\r\n }\r\n XFillDefault(opt, this.default);\r\n return this.createNotificationPlacement(opt);\r\n }\r\n\r\n private createNotificationPlacement(option: XNotificationOption): XNotificationRef {\r\n if (typeof option.placement === 'undefined') return {};\r\n let msgPlacement = this.notifications[option.placement];\r\n this.setDuration(option);\r\n if (XIsEmpty(msgPlacement) || !msgPlacement.ref?.overlayRef?.hasAttached()) {\r\n this.notifications[option.placement] = {\r\n ref: this.create(option),\r\n list: [option]\r\n };\r\n } else {\r\n this.notifications[option.placement].list = [\r\n ...(this.notifications[option.placement].list as XNotificationOption[]),\r\n option\r\n ];\r\n }\r\n this.notificationChange(this.notifications[option.placement]);\r\n\r\n return this.notifications[option.placement];\r\n }\r\n\r\n private notificationChange(notification: XNotificationRef) {\r\n if (!notification.ref?.overlayRef?.hasAttached() || !notification?.ref?.componentRef?.instance) return;\r\n notification.ref.componentRef.instance.notification = notification;\r\n notification.ref.componentRef.instance.cdr.detectChanges();\r\n }\r\n\r\n private setDuration(option: XNotificationOption) {\r\n if (option.duration) {\r\n option.durationSubscription = of(true)\r\n .pipe(delay(option.duration))\r\n .subscribe(() => {\r\n this.removeNotification(option);\r\n option.durationSubscription && option.durationSubscription.unsubscribe();\r\n });\r\n }\r\n }\r\n\r\n private removeNotification(option: XNotificationOption) {\r\n if (typeof option.placement === 'undefined') return;\r\n this.notifications[option.placement].ref?.componentRef?.instance.onClose(option);\r\n }\r\n}\r\n","import { NgModule } from '@angular/core';\r\n\r\n@NgModule({\r\n exports: [],\r\n imports: []\r\n})\r\nexport class XNotificationModule {}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;AAMA;;;;AAI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AAA,CAAA,CAAA;;2FAAnB,mBAAmB,EAAA,UAAA,EAAA,CAAA;kBAJ/B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE,EAAE;AACX,oBAAA,OAAO,EAAE;AACV,iBAAA;;;ACLD;;AAEG;;;;"}
@@ -684,7 +684,7 @@ class XTableHeadComponent extends XTableHeadProperty {
684
684
  this.sort = signal([], ...(ngDevMode ? [{ debugName: "sort" }] : []));
685
685
  this.sortStr = signal('', ...(ngDevMode ? [{ debugName: "sortStr" }] : []));
686
686
  this.theadStyle = computed(() => {
687
- let height = this.rowHeight() === 0 ? '' : this.rowHeight();
687
+ let height = this.getHeaderHeight();
688
688
  if (this.cellConfig() && this.cellConfig().cells) {
689
689
  const spt = this.cellConfig().cells?.map((x) => {
690
690
  const gridAreaSpt = x.gridArea?.split('/');
@@ -693,7 +693,7 @@ class XTableHeadComponent extends XTableHeadProperty {
693
693
  height = ((Math.max(...spt) - 1) * height);
694
694
  }
695
695
  return {
696
- ['min-height']: `${this.getRowHeight()}px`
696
+ ['min-height']: `${height}px`
697
697
  };
698
698
  }, ...(ngDevMode ? [{ debugName: "theadStyle" }] : []));
699
699
  this.thClassMap = computed(() => ({
@@ -814,7 +814,7 @@ class XTableHeadComponent extends XTableHeadProperty {
814
814
  this.table.columnDragEnded.emit(column);
815
815
  }
816
816
  /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.5", ngImport: i0, type: XTableHeadComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
817
- /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.5", type: XTableHeadComponent, isStandalone: true, selector: "x-table-head", viewQueries: [{ propertyName: "thead", first: true, predicate: ["thead"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<thead\r\n #thead\r\n [ngStyle]=\"theadStyle()\"\r\n [class.x-table-head-top]=\"position() === 'top'\"\r\n [class.x-table-head-bottom]=\"position() === 'bottom'\"\r\n>\r\n @if (cellConfig()) {\r\n <tr [style.gridTemplateColumns]=\"cellConfig()!.gridTemplateColumns\" [style.min-height.px]=\"getRowHeight()\">\r\n @for (column of cellConfig()!.cells; track column.id) {\r\n <th\r\n [class.x-table-sticky]=\"table.getStickyLeft(column) || table.getStickyRight(column)\"\r\n [class.x-table-sticky-left]=\"table.getStickyLeft(column)\"\r\n [class.x-table-sticky-right]=\"table.getStickyRight(column)\"\r\n [class.x-table-sticky-left-last]=\"table.getStickyLeftLast(column)\"\r\n [class.x-table-sticky-right-first]=\"table.getStickyRightFirst(column)\"\r\n [class.x-table-width-drag]=\"column.dragWidth\"\r\n [style.grid-area]=\"column.gridArea\"\r\n [style.left.px]=\"column.left\"\r\n [style.right.px]=\"column.right\"\r\n [style.min-height.px]=\"getHeaderHeight()\"\r\n [title]=\"column?.label\"\r\n >\r\n <ng-container *ngTemplateOutlet=\"columnBaseTpl; context: { column: column }\"></ng-container>\r\n @if (column.dragWidth) {\r\n <div\r\n class=\"x-table-drag-width\"\r\n x-drag\r\n (dragMoved)=\"dragWidthMoved($event, column)\"\r\n (dragStarted)=\"dragWidthStarted($event, column)\"\r\n (dragEnded)=\"dragWidthEnded($event, column)\"\r\n ></div>\r\n }\r\n </th>\r\n }\r\n </tr>\r\n } @else {\r\n <ng-container *ngTemplateOutlet=\"columnsTpl\"></ng-container>\r\n }\r\n @if (table.headSearchTpl()) {\r\n <ng-container *ngTemplateOutlet=\"columnsTpl; context: { case: 'search' }\"></ng-container>\r\n }\r\n</thead>\r\n\r\n<ng-template #columnsTpl let-case=\"case\">\r\n <tr\r\n cdkDropList\r\n cdkDropListOrientation=\"horizontal\"\r\n (cdkDropListSorted)=\"dropListSorted($event)\"\r\n (cdkDropListDropped)=\"dropListDropped($event)\"\r\n [style.height.px]=\"getHeaderHeight()\"\r\n [style.min-height.px]=\"getHeaderHeight()\"\r\n [style.padding-right.px]=\"scrollYWidth()\"\r\n [style.min-width.px]=\"scrollXWidth()\"\r\n [class.x-table-search]=\"case === 'search'\"\r\n >\r\n @for (column of initColumns(); track column.id) {\r\n <th\r\n cdkDrag\r\n [cdkDragDisabled]=\"column.draggingWidth || !column.dragColumn\"\r\n (cdkDragStarted)=\"dragStarted($event, column)\"\r\n (cdkDragEnded)=\"dragEnded(column)\"\r\n [ngClass]=\"thClassMap()\"\r\n [class.x-table-th]=\"true\"\r\n [class.x-table-sticky]=\"table.getSticky(column)\"\r\n [class.x-table-sticky-left]=\"table.getStickyLeft(column)\"\r\n [class.x-table-sticky-right]=\"table.getStickyRight(column)\"\r\n [class.x-table-sticky-left-last]=\"table.getStickyLeftLast(column)\"\r\n [class.x-table-sticky-right-first]=\"table.getStickyRightFirst(column)\"\r\n [style.min-height.px]=\"getHeaderHeight()\"\r\n [style.width.px]=\"getColumnWidth(column)\"\r\n [style.left.px]=\"column.left\"\r\n [style.right.px]=\"getColumnRight(column.right)\"\r\n [style.flex]=\"getFlex(column)\"\r\n >\r\n @switch (case) {\r\n @case ('search') {\r\n <ng-container *xOutlet=\"table.headSearchTpl()!; context: { $column: column }\"></ng-container>\r\n }\r\n @default {\r\n <ng-container *ngTemplateOutlet=\"columnBaseTpl; context: { column: column }\"></ng-container>\r\n @if (column.dragWidth) {\r\n <div\r\n class=\"x-table-drag-width\"\r\n x-drag\r\n (dragMoved)=\"dragWidthMoved($event, column)\"\r\n (dragStarted)=\"dragWidthStarted($event, column);\"\r\n (dragEnded)=\"dragWidthEnded($event, column)\"\r\n ></div>\r\n }\r\n }\r\n }\r\n </th>\r\n }\r\n </tr>\r\n</ng-template>\r\n\r\n<ng-template #columnBaseTpl let-column=\"column\">\r\n @switch (column.type) {\r\n @case ('checkbox') {\r\n @if (column.headChecked) {\r\n <x-checkbox\r\n [data]=\"[{ id: true, label: column.label }]\"\r\n [(ngModel)]=\"table.checkedValues()[column.id]\"\r\n (ngModelChange)=\"table.headChecked($event, column)\"\r\n [indeterminate]=\"table.checkedValues()[column.id + table.indeterminate()]\"\r\n single\r\n ></x-checkbox>\r\n }\r\n @if (!column.headChecked) {\r\n <ng-container *ngTemplateOutlet=\"cloumnDefaultTpl; context: { column: column }\"></ng-container>\r\n }\r\n }\r\n @case ('index') {\r\n <a\r\n ><ng-container *xOutlet=\"columnTpl()[column.id]; context: { $column: column }\">\r\n <ng-container *xOutlet=\"table.headThTpl(); context: { $column: column }\">\r\n {{ column.label }}\r\n </ng-container>\r\n </ng-container></a\r\n >\r\n }\r\n @default {\r\n <ng-container *ngTemplateOutlet=\"cloumnDefaultTpl; context: { column: column }\"></ng-container>\r\n }\r\n }\r\n</ng-template>\r\n\r\n<ng-template #cloumnDefaultTpl let-column=\"column\">\r\n <a [class.x-table-sort]=\"column.sort\" (click)=\"onSort(column)\" [style.text-align]=\"column.textAlign\">\r\n <ng-container *xOutlet=\"columnTpl()[column.id]; context: { $column: column }\">\r\n <ng-container *xOutlet=\"table.headThTpl(); context: { $column: column }\">\r\n {{ column.label }}\r\n </ng-container>\r\n </ng-container>\r\n @if (column.sort) {\r\n <x-icon\r\n type=\"fto-bar-chart\"\r\n class=\"x-table-sort-icon\"\r\n [class.x-table-icon-up]=\"sortStr() === column.id + ' desc'\"\r\n [class.x-table-icon-down]=\"sortStr() === column.id + ' asc'\"\r\n ></x-icon>\r\n }\r\n </a>\r\n</ng-template>\r\n", dependencies: [{ kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: XDragDirective, selector: "[x-drag]" }, { kind: "ngmodule", type: DragDropModule }, { kind: "directive", type: i2.CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "cdkDropListData", "cdkDropListOrientation", "id", "cdkDropListLockAxis", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListAutoScrollDisabled", "cdkDropListAutoScrollStep", "cdkDropListElementContainer", "cdkDropListHasAnchor"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { kind: "directive", type: i2.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer", "cdkDragScale"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "component", type: XCheckboxComponent, selector: "x-checkbox" }, { kind: "directive", type: XOutletDirective, selector: "[xOutlet]", inputs: ["xOutletContext", "xOutlet"] }, { kind: "component", type: XIconComponent, selector: "x-icon" }], encapsulation: i0.ViewEncapsulation.None }); }
817
+ /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.5", type: XTableHeadComponent, isStandalone: true, selector: "x-table-head", viewQueries: [{ propertyName: "thead", first: true, predicate: ["thead"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<thead\r\n #thead\r\n [ngStyle]=\"theadStyle()\"\r\n [class.x-table-head-top]=\"position() === 'top'\"\r\n [class.x-table-head-bottom]=\"position() === 'bottom'\"\r\n>\r\n @if (cellConfig()) {\r\n <tr [style.gridTemplateColumns]=\"cellConfig()!.gridTemplateColumns\" [style.min-height.px]=\"getHeaderHeight()\">\r\n @for (column of cellConfig()!.cells; track column.id) {\r\n <th\r\n [class.x-table-sticky]=\"table.getStickyLeft(column) || table.getStickyRight(column)\"\r\n [class.x-table-sticky-left]=\"table.getStickyLeft(column)\"\r\n [class.x-table-sticky-right]=\"table.getStickyRight(column)\"\r\n [class.x-table-sticky-left-last]=\"table.getStickyLeftLast(column)\"\r\n [class.x-table-sticky-right-first]=\"table.getStickyRightFirst(column)\"\r\n [class.x-table-width-drag]=\"column.dragWidth\"\r\n [style.grid-area]=\"column.gridArea\"\r\n [style.left.px]=\"column.left\"\r\n [style.right.px]=\"column.right\"\r\n [style.min-height.px]=\"getHeaderHeight()\"\r\n [title]=\"column?.label\"\r\n >\r\n <ng-container *ngTemplateOutlet=\"columnBaseTpl; context: { column: column }\"></ng-container>\r\n @if (column.dragWidth) {\r\n <div\r\n class=\"x-table-drag-width\"\r\n x-drag\r\n (dragMoved)=\"dragWidthMoved($event, column)\"\r\n (dragStarted)=\"dragWidthStarted($event, column)\"\r\n (dragEnded)=\"dragWidthEnded($event, column)\"\r\n ></div>\r\n }\r\n </th>\r\n }\r\n </tr>\r\n } @else {\r\n <ng-container *ngTemplateOutlet=\"columnsTpl\"></ng-container>\r\n }\r\n @if (table.headSearchTpl()) {\r\n <ng-container *ngTemplateOutlet=\"columnsTpl; context: { case: 'search' }\"></ng-container>\r\n }\r\n</thead>\r\n\r\n<ng-template #columnsTpl let-case=\"case\">\r\n <tr\r\n cdkDropList\r\n cdkDropListOrientation=\"horizontal\"\r\n (cdkDropListSorted)=\"dropListSorted($event)\"\r\n (cdkDropListDropped)=\"dropListDropped($event)\"\r\n [style.height.px]=\"getHeaderHeight()\"\r\n [style.min-height.px]=\"getHeaderHeight()\"\r\n [style.padding-right.px]=\"scrollYWidth()\"\r\n [style.min-width.px]=\"scrollXWidth()\"\r\n [class.x-table-search]=\"case === 'search'\"\r\n >\r\n @for (column of initColumns(); track column.id) {\r\n <th\r\n cdkDrag\r\n [cdkDragDisabled]=\"column.draggingWidth || !column.dragColumn\"\r\n (cdkDragStarted)=\"dragStarted($event, column)\"\r\n (cdkDragEnded)=\"dragEnded(column)\"\r\n [ngClass]=\"thClassMap()\"\r\n [class.x-table-th]=\"true\"\r\n [class.x-table-sticky]=\"table.getSticky(column)\"\r\n [class.x-table-sticky-left]=\"table.getStickyLeft(column)\"\r\n [class.x-table-sticky-right]=\"table.getStickyRight(column)\"\r\n [class.x-table-sticky-left-last]=\"table.getStickyLeftLast(column)\"\r\n [class.x-table-sticky-right-first]=\"table.getStickyRightFirst(column)\"\r\n [style.min-height.px]=\"getHeaderHeight()\"\r\n [style.width.px]=\"getColumnWidth(column)\"\r\n [style.left.px]=\"column.left\"\r\n [style.right.px]=\"getColumnRight(column.right)\"\r\n [style.flex]=\"getFlex(column)\"\r\n >\r\n @switch (case) {\r\n @case ('search') {\r\n <ng-container *xOutlet=\"table.headSearchTpl()!; context: { $column: column }\"></ng-container>\r\n }\r\n @default {\r\n <ng-container *ngTemplateOutlet=\"columnBaseTpl; context: { column: column }\"></ng-container>\r\n @if (column.dragWidth) {\r\n <div\r\n class=\"x-table-drag-width\"\r\n x-drag\r\n (dragMoved)=\"dragWidthMoved($event, column)\"\r\n (dragStarted)=\"dragWidthStarted($event, column);\"\r\n (dragEnded)=\"dragWidthEnded($event, column)\"\r\n ></div>\r\n }\r\n }\r\n }\r\n </th>\r\n }\r\n </tr>\r\n</ng-template>\r\n\r\n<ng-template #columnBaseTpl let-column=\"column\">\r\n @switch (column.type) {\r\n @case ('checkbox') {\r\n @if (column.headChecked) {\r\n <x-checkbox\r\n [data]=\"[{ id: true, label: column.label }]\"\r\n [(ngModel)]=\"table.checkedValues()[column.id]\"\r\n (ngModelChange)=\"table.headChecked($event, column)\"\r\n [indeterminate]=\"table.checkedValues()[column.id + table.indeterminate()]\"\r\n single\r\n ></x-checkbox>\r\n }\r\n @if (!column.headChecked) {\r\n <ng-container *ngTemplateOutlet=\"cloumnDefaultTpl; context: { column: column }\"></ng-container>\r\n }\r\n }\r\n @case ('index') {\r\n <a\r\n ><ng-container *xOutlet=\"columnTpl()[column.id]; context: { $column: column }\">\r\n <ng-container *xOutlet=\"table.headThTpl(); context: { $column: column }\">\r\n {{ column.label }}\r\n </ng-container>\r\n </ng-container></a\r\n >\r\n }\r\n @default {\r\n <ng-container *ngTemplateOutlet=\"cloumnDefaultTpl; context: { column: column }\"></ng-container>\r\n }\r\n }\r\n</ng-template>\r\n\r\n<ng-template #cloumnDefaultTpl let-column=\"column\">\r\n <a [class.x-table-sort]=\"column.sort\" (click)=\"onSort(column)\" [style.text-align]=\"column.textAlign\">\r\n <ng-container *xOutlet=\"columnTpl()[column.id]; context: { $column: column }\">\r\n <ng-container *xOutlet=\"table.headThTpl(); context: { $column: column }\">\r\n {{ column.label }}\r\n </ng-container>\r\n </ng-container>\r\n @if (column.sort) {\r\n <x-icon\r\n type=\"fto-bar-chart\"\r\n class=\"x-table-sort-icon\"\r\n [class.x-table-icon-up]=\"sortStr() === column.id + ' desc'\"\r\n [class.x-table-icon-down]=\"sortStr() === column.id + ' asc'\"\r\n ></x-icon>\r\n }\r\n </a>\r\n</ng-template>\r\n", dependencies: [{ kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: XDragDirective, selector: "[x-drag]" }, { kind: "ngmodule", type: DragDropModule }, { kind: "directive", type: i2.CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "cdkDropListData", "cdkDropListOrientation", "id", "cdkDropListLockAxis", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListAutoScrollDisabled", "cdkDropListAutoScrollStep", "cdkDropListElementContainer", "cdkDropListHasAnchor"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { kind: "directive", type: i2.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer", "cdkDragScale"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "component", type: XCheckboxComponent, selector: "x-checkbox" }, { kind: "directive", type: XOutletDirective, selector: "[xOutlet]", inputs: ["xOutletContext", "xOutlet"] }, { kind: "component", type: XIconComponent, selector: "x-icon" }], encapsulation: i0.ViewEncapsulation.None }); }
818
818
  }
819
819
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.5", ngImport: i0, type: XTableHeadComponent, decorators: [{
820
820
  type: Component,
@@ -828,7 +828,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.5", ngImpor
828
828
  XCheckboxComponent,
829
829
  XOutletDirective,
830
830
  XIconComponent
831
- ], encapsulation: ViewEncapsulation.None, template: "<thead\r\n #thead\r\n [ngStyle]=\"theadStyle()\"\r\n [class.x-table-head-top]=\"position() === 'top'\"\r\n [class.x-table-head-bottom]=\"position() === 'bottom'\"\r\n>\r\n @if (cellConfig()) {\r\n <tr [style.gridTemplateColumns]=\"cellConfig()!.gridTemplateColumns\" [style.min-height.px]=\"getRowHeight()\">\r\n @for (column of cellConfig()!.cells; track column.id) {\r\n <th\r\n [class.x-table-sticky]=\"table.getStickyLeft(column) || table.getStickyRight(column)\"\r\n [class.x-table-sticky-left]=\"table.getStickyLeft(column)\"\r\n [class.x-table-sticky-right]=\"table.getStickyRight(column)\"\r\n [class.x-table-sticky-left-last]=\"table.getStickyLeftLast(column)\"\r\n [class.x-table-sticky-right-first]=\"table.getStickyRightFirst(column)\"\r\n [class.x-table-width-drag]=\"column.dragWidth\"\r\n [style.grid-area]=\"column.gridArea\"\r\n [style.left.px]=\"column.left\"\r\n [style.right.px]=\"column.right\"\r\n [style.min-height.px]=\"getHeaderHeight()\"\r\n [title]=\"column?.label\"\r\n >\r\n <ng-container *ngTemplateOutlet=\"columnBaseTpl; context: { column: column }\"></ng-container>\r\n @if (column.dragWidth) {\r\n <div\r\n class=\"x-table-drag-width\"\r\n x-drag\r\n (dragMoved)=\"dragWidthMoved($event, column)\"\r\n (dragStarted)=\"dragWidthStarted($event, column)\"\r\n (dragEnded)=\"dragWidthEnded($event, column)\"\r\n ></div>\r\n }\r\n </th>\r\n }\r\n </tr>\r\n } @else {\r\n <ng-container *ngTemplateOutlet=\"columnsTpl\"></ng-container>\r\n }\r\n @if (table.headSearchTpl()) {\r\n <ng-container *ngTemplateOutlet=\"columnsTpl; context: { case: 'search' }\"></ng-container>\r\n }\r\n</thead>\r\n\r\n<ng-template #columnsTpl let-case=\"case\">\r\n <tr\r\n cdkDropList\r\n cdkDropListOrientation=\"horizontal\"\r\n (cdkDropListSorted)=\"dropListSorted($event)\"\r\n (cdkDropListDropped)=\"dropListDropped($event)\"\r\n [style.height.px]=\"getHeaderHeight()\"\r\n [style.min-height.px]=\"getHeaderHeight()\"\r\n [style.padding-right.px]=\"scrollYWidth()\"\r\n [style.min-width.px]=\"scrollXWidth()\"\r\n [class.x-table-search]=\"case === 'search'\"\r\n >\r\n @for (column of initColumns(); track column.id) {\r\n <th\r\n cdkDrag\r\n [cdkDragDisabled]=\"column.draggingWidth || !column.dragColumn\"\r\n (cdkDragStarted)=\"dragStarted($event, column)\"\r\n (cdkDragEnded)=\"dragEnded(column)\"\r\n [ngClass]=\"thClassMap()\"\r\n [class.x-table-th]=\"true\"\r\n [class.x-table-sticky]=\"table.getSticky(column)\"\r\n [class.x-table-sticky-left]=\"table.getStickyLeft(column)\"\r\n [class.x-table-sticky-right]=\"table.getStickyRight(column)\"\r\n [class.x-table-sticky-left-last]=\"table.getStickyLeftLast(column)\"\r\n [class.x-table-sticky-right-first]=\"table.getStickyRightFirst(column)\"\r\n [style.min-height.px]=\"getHeaderHeight()\"\r\n [style.width.px]=\"getColumnWidth(column)\"\r\n [style.left.px]=\"column.left\"\r\n [style.right.px]=\"getColumnRight(column.right)\"\r\n [style.flex]=\"getFlex(column)\"\r\n >\r\n @switch (case) {\r\n @case ('search') {\r\n <ng-container *xOutlet=\"table.headSearchTpl()!; context: { $column: column }\"></ng-container>\r\n }\r\n @default {\r\n <ng-container *ngTemplateOutlet=\"columnBaseTpl; context: { column: column }\"></ng-container>\r\n @if (column.dragWidth) {\r\n <div\r\n class=\"x-table-drag-width\"\r\n x-drag\r\n (dragMoved)=\"dragWidthMoved($event, column)\"\r\n (dragStarted)=\"dragWidthStarted($event, column);\"\r\n (dragEnded)=\"dragWidthEnded($event, column)\"\r\n ></div>\r\n }\r\n }\r\n }\r\n </th>\r\n }\r\n </tr>\r\n</ng-template>\r\n\r\n<ng-template #columnBaseTpl let-column=\"column\">\r\n @switch (column.type) {\r\n @case ('checkbox') {\r\n @if (column.headChecked) {\r\n <x-checkbox\r\n [data]=\"[{ id: true, label: column.label }]\"\r\n [(ngModel)]=\"table.checkedValues()[column.id]\"\r\n (ngModelChange)=\"table.headChecked($event, column)\"\r\n [indeterminate]=\"table.checkedValues()[column.id + table.indeterminate()]\"\r\n single\r\n ></x-checkbox>\r\n }\r\n @if (!column.headChecked) {\r\n <ng-container *ngTemplateOutlet=\"cloumnDefaultTpl; context: { column: column }\"></ng-container>\r\n }\r\n }\r\n @case ('index') {\r\n <a\r\n ><ng-container *xOutlet=\"columnTpl()[column.id]; context: { $column: column }\">\r\n <ng-container *xOutlet=\"table.headThTpl(); context: { $column: column }\">\r\n {{ column.label }}\r\n </ng-container>\r\n </ng-container></a\r\n >\r\n }\r\n @default {\r\n <ng-container *ngTemplateOutlet=\"cloumnDefaultTpl; context: { column: column }\"></ng-container>\r\n }\r\n }\r\n</ng-template>\r\n\r\n<ng-template #cloumnDefaultTpl let-column=\"column\">\r\n <a [class.x-table-sort]=\"column.sort\" (click)=\"onSort(column)\" [style.text-align]=\"column.textAlign\">\r\n <ng-container *xOutlet=\"columnTpl()[column.id]; context: { $column: column }\">\r\n <ng-container *xOutlet=\"table.headThTpl(); context: { $column: column }\">\r\n {{ column.label }}\r\n </ng-container>\r\n </ng-container>\r\n @if (column.sort) {\r\n <x-icon\r\n type=\"fto-bar-chart\"\r\n class=\"x-table-sort-icon\"\r\n [class.x-table-icon-up]=\"sortStr() === column.id + ' desc'\"\r\n [class.x-table-icon-down]=\"sortStr() === column.id + ' asc'\"\r\n ></x-icon>\r\n }\r\n </a>\r\n</ng-template>\r\n" }]
831
+ ], encapsulation: ViewEncapsulation.None, template: "<thead\r\n #thead\r\n [ngStyle]=\"theadStyle()\"\r\n [class.x-table-head-top]=\"position() === 'top'\"\r\n [class.x-table-head-bottom]=\"position() === 'bottom'\"\r\n>\r\n @if (cellConfig()) {\r\n <tr [style.gridTemplateColumns]=\"cellConfig()!.gridTemplateColumns\" [style.min-height.px]=\"getHeaderHeight()\">\r\n @for (column of cellConfig()!.cells; track column.id) {\r\n <th\r\n [class.x-table-sticky]=\"table.getStickyLeft(column) || table.getStickyRight(column)\"\r\n [class.x-table-sticky-left]=\"table.getStickyLeft(column)\"\r\n [class.x-table-sticky-right]=\"table.getStickyRight(column)\"\r\n [class.x-table-sticky-left-last]=\"table.getStickyLeftLast(column)\"\r\n [class.x-table-sticky-right-first]=\"table.getStickyRightFirst(column)\"\r\n [class.x-table-width-drag]=\"column.dragWidth\"\r\n [style.grid-area]=\"column.gridArea\"\r\n [style.left.px]=\"column.left\"\r\n [style.right.px]=\"column.right\"\r\n [style.min-height.px]=\"getHeaderHeight()\"\r\n [title]=\"column?.label\"\r\n >\r\n <ng-container *ngTemplateOutlet=\"columnBaseTpl; context: { column: column }\"></ng-container>\r\n @if (column.dragWidth) {\r\n <div\r\n class=\"x-table-drag-width\"\r\n x-drag\r\n (dragMoved)=\"dragWidthMoved($event, column)\"\r\n (dragStarted)=\"dragWidthStarted($event, column)\"\r\n (dragEnded)=\"dragWidthEnded($event, column)\"\r\n ></div>\r\n }\r\n </th>\r\n }\r\n </tr>\r\n } @else {\r\n <ng-container *ngTemplateOutlet=\"columnsTpl\"></ng-container>\r\n }\r\n @if (table.headSearchTpl()) {\r\n <ng-container *ngTemplateOutlet=\"columnsTpl; context: { case: 'search' }\"></ng-container>\r\n }\r\n</thead>\r\n\r\n<ng-template #columnsTpl let-case=\"case\">\r\n <tr\r\n cdkDropList\r\n cdkDropListOrientation=\"horizontal\"\r\n (cdkDropListSorted)=\"dropListSorted($event)\"\r\n (cdkDropListDropped)=\"dropListDropped($event)\"\r\n [style.height.px]=\"getHeaderHeight()\"\r\n [style.min-height.px]=\"getHeaderHeight()\"\r\n [style.padding-right.px]=\"scrollYWidth()\"\r\n [style.min-width.px]=\"scrollXWidth()\"\r\n [class.x-table-search]=\"case === 'search'\"\r\n >\r\n @for (column of initColumns(); track column.id) {\r\n <th\r\n cdkDrag\r\n [cdkDragDisabled]=\"column.draggingWidth || !column.dragColumn\"\r\n (cdkDragStarted)=\"dragStarted($event, column)\"\r\n (cdkDragEnded)=\"dragEnded(column)\"\r\n [ngClass]=\"thClassMap()\"\r\n [class.x-table-th]=\"true\"\r\n [class.x-table-sticky]=\"table.getSticky(column)\"\r\n [class.x-table-sticky-left]=\"table.getStickyLeft(column)\"\r\n [class.x-table-sticky-right]=\"table.getStickyRight(column)\"\r\n [class.x-table-sticky-left-last]=\"table.getStickyLeftLast(column)\"\r\n [class.x-table-sticky-right-first]=\"table.getStickyRightFirst(column)\"\r\n [style.min-height.px]=\"getHeaderHeight()\"\r\n [style.width.px]=\"getColumnWidth(column)\"\r\n [style.left.px]=\"column.left\"\r\n [style.right.px]=\"getColumnRight(column.right)\"\r\n [style.flex]=\"getFlex(column)\"\r\n >\r\n @switch (case) {\r\n @case ('search') {\r\n <ng-container *xOutlet=\"table.headSearchTpl()!; context: { $column: column }\"></ng-container>\r\n }\r\n @default {\r\n <ng-container *ngTemplateOutlet=\"columnBaseTpl; context: { column: column }\"></ng-container>\r\n @if (column.dragWidth) {\r\n <div\r\n class=\"x-table-drag-width\"\r\n x-drag\r\n (dragMoved)=\"dragWidthMoved($event, column)\"\r\n (dragStarted)=\"dragWidthStarted($event, column);\"\r\n (dragEnded)=\"dragWidthEnded($event, column)\"\r\n ></div>\r\n }\r\n }\r\n }\r\n </th>\r\n }\r\n </tr>\r\n</ng-template>\r\n\r\n<ng-template #columnBaseTpl let-column=\"column\">\r\n @switch (column.type) {\r\n @case ('checkbox') {\r\n @if (column.headChecked) {\r\n <x-checkbox\r\n [data]=\"[{ id: true, label: column.label }]\"\r\n [(ngModel)]=\"table.checkedValues()[column.id]\"\r\n (ngModelChange)=\"table.headChecked($event, column)\"\r\n [indeterminate]=\"table.checkedValues()[column.id + table.indeterminate()]\"\r\n single\r\n ></x-checkbox>\r\n }\r\n @if (!column.headChecked) {\r\n <ng-container *ngTemplateOutlet=\"cloumnDefaultTpl; context: { column: column }\"></ng-container>\r\n }\r\n }\r\n @case ('index') {\r\n <a\r\n ><ng-container *xOutlet=\"columnTpl()[column.id]; context: { $column: column }\">\r\n <ng-container *xOutlet=\"table.headThTpl(); context: { $column: column }\">\r\n {{ column.label }}\r\n </ng-container>\r\n </ng-container></a\r\n >\r\n }\r\n @default {\r\n <ng-container *ngTemplateOutlet=\"cloumnDefaultTpl; context: { column: column }\"></ng-container>\r\n }\r\n }\r\n</ng-template>\r\n\r\n<ng-template #cloumnDefaultTpl let-column=\"column\">\r\n <a [class.x-table-sort]=\"column.sort\" (click)=\"onSort(column)\" [style.text-align]=\"column.textAlign\">\r\n <ng-container *xOutlet=\"columnTpl()[column.id]; context: { $column: column }\">\r\n <ng-container *xOutlet=\"table.headThTpl(); context: { $column: column }\">\r\n {{ column.label }}\r\n </ng-container>\r\n </ng-container>\r\n @if (column.sort) {\r\n <x-icon\r\n type=\"fto-bar-chart\"\r\n class=\"x-table-sort-icon\"\r\n [class.x-table-icon-up]=\"sortStr() === column.id + ' desc'\"\r\n [class.x-table-icon-down]=\"sortStr() === column.id + ' asc'\"\r\n ></x-icon>\r\n }\r\n </a>\r\n</ng-template>\r\n" }]
832
832
  }], propDecorators: { thead: [{ type: i0.ViewChild, args: ['thead', { isSignal: true }] }] } });
833
833
 
834
834
  class XTableFootComponent extends XTableFootProperty {