UNPKG

@lxlib/theme

Version:

This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 9.1.1.

207 lines 16.5 kB
/** * @fileoverview added by tsickle * Generated from: src/services/modal/modal.helper.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ import { Injectable } from '@angular/core'; import { deepMerge } from '@lxlib/util'; import { NzModalService } from 'ng-zorro-antd/modal'; import { Observable } from 'rxjs'; import * as i0 from "@angular/core"; import * as i1 from "ng-zorro-antd/modal"; /** * @record */ export function ModalHelperOptions() { } if (false) { /** * 大小;例如:lg、600,默认:`lg` * @type {?|undefined} */ ModalHelperOptions.prototype.size; /** * 对话框 [ModalOptions](https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/components/modal/modal-types.ts) 参数 * @type {?|undefined} */ ModalHelperOptions.prototype.modalOptions; /** * 是否精准(默认:`true`),若返回值非空值(`null`或`undefined`)视为成功,否则视为错误 * @type {?|undefined} */ ModalHelperOptions.prototype.exact; /** * 是否包裹标签页,修复模态包含标签间距问题 * @type {?|undefined} */ ModalHelperOptions.prototype.includeTabs; } /** * 对话框辅助类 */ export class ModalHelper { /** * @param {?} srv */ constructor(srv) { this.srv = srv; } /** * 构建一个对话框 * * \@example * this.modalHelper.create(FormEditComponent, { i }).subscribe(res => this.load()); * // 对于组件的成功&关闭的处理说明 * // 成功 * this.NzModalRef.close(data); * this.NzModalRef.close(); * // 关闭 * this.NzModalRef.destroy(); * @param {?} comp 组件 * @param {?=} params 组件参数 * @param {?=} options 额外参数 * * @return {?} */ create(comp, params, options) { options = deepMerge({ size: 'lg', exact: true, includeTabs: false, }, options); return new Observable((/** * @param {?} observer * @return {?} */ (observer) => { const { size, includeTabs, modalOptions } = (/** @type {?} */ (options)); /** @type {?} */ let cls = ''; /** @type {?} */ let width = ''; if (size) { if (typeof size === 'number') { width = `${size}px`; } else { cls = `modal-${size}`; } } if (includeTabs) { cls += ' modal-include-tabs'; } if (modalOptions && modalOptions.nzWrapClassName) { cls += ` ${modalOptions.nzWrapClassName}`; delete modalOptions.nzWrapClassName; } /** @type {?} */ const defaultOptions = { nzWrapClassName: cls, nzContent: comp, nzWidth: width ? width : undefined, nzFooter: null, nzComponentParams: params, }; /** @type {?} */ const subject = this.srv.create(Object.assign(Object.assign({}, defaultOptions), modalOptions)); /** @type {?} */ const afterClose$ = subject.afterClose.subscribe((/** * @param {?} res * @return {?} */ (res) => { if ((/** @type {?} */ (options)).exact === true) { if (res != null) { observer.next(res); } } else { observer.next(res); } observer.complete(); afterClose$.unsubscribe(); })); })); } /** * 构建静态框,点击蒙层不允许关闭 * * \@example * this.modalHelper.open(FormEditComponent, { i }).subscribe(res => this.load()); * // 对于组件的成功&关闭的处理说明 * // 成功 * this.NzModalRef.close(data); * this.NzModalRef.close(); * // 关闭 * this.NzModalRef.destroy(); * @param {?} comp 组件 * @param {?=} params 组件参数 * @param {?=} options 额外参数 * * @return {?} */ createStatic(comp, params, options) { /** @type {?} */ const modalOptions = Object.assign({ nzMaskClosable: false }, (options && options.modalOptions)); return this.create(comp, params, Object.assign(Object.assign({}, options), { modalOptions })); } /** * 打开对话框 * \@example * this.modalHelper.open(FormEditComponent, { i }).subscribe(res => this.load()); * // 对于组件的成功&关闭的处理说明 * // 成功 * this.NzModalRef.close(data); * this.NzModalRef.close(); * // 关闭 * this.NzModalRef.destroy(); * @param {?} comp 组件 * @param {?=} params 组件参数 * @param {?=} size 大小;例如:lg、600,默认:lg * * @param {?=} options * @return {?} */ open(comp, params, size = 'lg', options) { return this.create(comp, params, { size, modalOptions: options, exact: false, }); } /** * 静态框,点击蒙层不允许关闭 * \@example * this.modalHelper.open(FormEditComponent, { i }).subscribe(res => this.load()); * // 对于组件的成功&关闭的处理说明 * // 成功 * this.NzModalRef.close(data); * this.NzModalRef.close(); * // 关闭 * this.NzModalRef.destroy(); * @param {?} comp 组件 * @param {?=} params 组件参数 * @param {?=} size 大小;例如:lg、600,默认:lg * * @param {?=} options * @return {?} */ static(comp, params, size = 'lg', options) { return this.open(comp, params, size, Object.assign({ nzMaskClosable: false }, options)); } } ModalHelper.decorators = [ { type: Injectable, args: [{ providedIn: 'root' },] } ]; /** @nocollapse */ ModalHelper.ctorParameters = () => [ { type: NzModalService } ]; /** @nocollapse */ ModalHelper.ɵprov = i0.ɵɵdefineInjectable({ factory: function ModalHelper_Factory() { return new ModalHelper(i0.ɵɵinject(i1.NzModalService)); }, token: ModalHelper, providedIn: "root" }); if (false) { /** * @type {?} * @private */ ModalHelper.prototype.srv; } //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibW9kYWwuaGVscGVyLmpzIiwic291cmNlUm9vdCI6Im5nOi8vQGx4bGliL3RoZW1lLyIsInNvdXJjZXMiOlsic3JjL3NlcnZpY2VzL21vZGFsL21vZGFsLmhlbHBlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQUFBLE9BQU8sRUFBRSxVQUFVLEVBQUUsTUFBTSxlQUFlLENBQUM7QUFDM0MsT0FBTyxFQUFFLFNBQVMsRUFBRSxNQUFNLGFBQWEsQ0FBQztBQUN4QyxPQUFPLEVBQWdCLGNBQWMsRUFBRSxNQUFNLHFCQUFxQixDQUFDO0FBQ25FLE9BQU8sRUFBRSxVQUFVLEVBQVksTUFBTSxNQUFNLENBQUM7Ozs7OztBQUU1Qyx3Q0FTQzs7Ozs7O0lBUEMsa0NBQStDOzs7OztJQUUvQywwQ0FBNEI7Ozs7O0lBRTVCLG1DQUFnQjs7Ozs7SUFFaEIseUNBQXNCOzs7OztBQU94QixNQUFNLE9BQU8sV0FBVzs7OztJQUN0QixZQUFvQixHQUFtQjtRQUFuQixRQUFHLEdBQUgsR0FBRyxDQUFnQjtJQUFHLENBQUM7Ozs7Ozs7Ozs7Ozs7Ozs7OztJQWtCM0MsTUFBTSxDQUFDLElBQVMsRUFBRSxNQUFZLEVBQUUsT0FBNEI7UUFDMUQsT0FBTyxHQUFHLFNB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