@lxlib/theme
Version:
This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 9.1.1.
180 lines • 15.3 kB
JavaScript
/**
* @fileoverview added by tsickle
* Generated from: src/services/drawer/drawer.helper.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
import { Injectable } from '@angular/core';
import { deepMerge } from '@lxlib/util';
import { NzDrawerService } from 'ng-zorro-antd/drawer';
import { Observable } from 'rxjs';
import * as i0 from "@angular/core";
import * as i1 from "ng-zorro-antd/drawer";
/**
* @record
*/
export function DrawerHelperOptions() { }
if (false) {
/**
* 大小,若值为数值类型,则根据 `nzPlacement` 自动转化为 `nzHeight` 或 `nzWidth`;例如:lg、600,默认:`md`
*
* | 类型 | 默认大小 |
* | --- | ------ |
* | `sm` | `300` |
* | `md` | `600` |
* | `lg` | `900` |
* | `xl` | `1200` |
*
* > 以上值,可通过覆盖相应的LESS参数自行调整
* @type {?|undefined}
*/
DrawerHelperOptions.prototype.size;
/**
* 是否包含底部工具条,默认:`true`
* @type {?|undefined}
*/
DrawerHelperOptions.prototype.footer;
/**
* 底部工具条高度,默认:`55`
* @type {?|undefined}
*/
DrawerHelperOptions.prototype.footerHeight;
/**
* 是否精准(默认:`true`),若返回值非空值(`null`或`undefined`)视为成功,否则视为错误
* @type {?|undefined}
*/
DrawerHelperOptions.prototype.exact;
/**
* 抽屉 [NzDrawerOptions](https://ng.ant.design/components/drawer/zh#nzdraweroptions) 参数
* @type {?|undefined}
*/
DrawerHelperOptions.prototype.drawerOptions;
}
/**
* 抽屉辅助类
*
* **注意:** 构建结果都可被订阅,但永远都不会触发 `observer.error`
*
* \@example
* this.drawerHelper.create('Edit', FormEditComponent, { i }).subscribe(res => this.load());
* // 对于组件的成功&关闭的处理说明
* // 成功
* this.NzDrawerRef.close(data);
* this.NzDrawerRef.close(true);
* // 关闭
* this.NzDrawerRef.close();
* this.NzDrawerRef.close(false);
*/
export class DrawerHelper {
/**
* @param {?} srv
*/
constructor(srv) {
this.srv = srv;
}
/**
* 构建一个抽屉
* @param {?} title
* @param {?} comp
* @param {?=} params
* @param {?=} options
* @return {?}
*/
create(title, comp, params, options) {
options = deepMerge({
size: 'md',
footer: true,
footerHeight: 55,
exact: true,
drawerOptions: {
nzPlacement: 'right',
nzWrapClassName: '',
},
}, options);
return new Observable((/**
* @param {?} observer
* @return {?}
*/
(observer) => {
const { size, footer, footerHeight, drawerOptions } = (/** @type {?} */ (options));
/** @type {?} */
const defaultOptions = {
nzContent: comp,
nzContentParams: params,
nzTitle: title,
};
if (typeof size === 'number') {
defaultOptions[(/** @type {?} */ (drawerOptions)).nzPlacement === 'top' || (/** @type {?} */ (drawerOptions)).nzPlacement === 'bottom' ? 'nzHeight' : 'nzWidth'] = (/** @type {?} */ (options)).size;
}
else {
defaultOptions.nzWrapClassName = ((/** @type {?} */ (drawerOptions)).nzWrapClassName + ` drawer-${(/** @type {?} */ (options)).size}`).trim();
delete (/** @type {?} */ (drawerOptions)).nzWrapClassName;
}
if (footer) {
const { nzPlacement, nzHeight } = (/** @type {?} */ (drawerOptions));
// Should be header * footer, because of includes header
/** @type {?} */
const reduceHeight = (/** @type {?} */ (footerHeight)) * 2 - 2;
if (nzPlacement === 'left' || nzPlacement === 'right') {
defaultOptions.nzBodyStyle = {
height: `calc(100% - ${reduceHeight}px)`,
overflow: 'auto',
};
}
else {
defaultOptions.nzBodyStyle = {
height: `${+(nzHeight || 256) - reduceHeight}px`,
overflow: 'auto',
};
}
}
/** @type {?} */
const subject = this.srv.create(Object.assign(Object.assign({}, defaultOptions), drawerOptions));
/** @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();
}));
}));
}
/**
* 构建一个抽屉,点击蒙层不允许关闭
* @param {?} title
* @param {?} comp
* @param {?=} params
* @param {?=} options
* @return {?}
*/
static(title, comp, params, options) {
/** @type {?} */
const drawerOptions = Object.assign({ nzMaskClosable: false }, (options && options.drawerOptions));
return this.create(title, comp, params, Object.assign(Object.assign({}, options), { drawerOptions }));
}
}
DrawerHelper.decorators = [
{ type: Injectable, args: [{ providedIn: 'root' },] }
];
/** @nocollapse */
DrawerHelper.ctorParameters = () => [
{ type: NzDrawerService }
];
/** @nocollapse */ DrawerHelper.ɵprov = i0.ɵɵdefineInjectable({ factory: function DrawerHelper_Factory() { return new DrawerHelper(i0.ɵɵinject(i1.NzDrawerService)); }, token: DrawerHelper, providedIn: "root" });
if (false) {
/**
* @type {?}
* @private
*/
DrawerHelper.prototype.srv;
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZHJhd2VyLmhlbHBlci5qcyIsInNvdXJjZVJvb3QiOiJuZzovL0BseGxpYi90aGVtZS8iLCJzb3VyY2VzIjpbInNyYy9zZXJ2aWNlcy9kcmF3ZXIvZHJhd2VyLmhlbHBlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQUFBLE9BQU8sRUFBRSxVQUFVLEVBQUUsTUFBTSxlQUFlLENBQUM7QUFDM0MsT0FBTyxFQUFFLFNBQVMsRUFBRSxNQUFNLGFBQWEsQ0FBQztBQUN4QyxPQUFPLEVBQW1CLGVBQWUsRUFBRSxNQUFNLHNCQUFzQixDQUFDO0FBQ3hFLE9BQU8sRUFBRSxVQUFVLEVBQVksTUFBTSxNQUFNLENBQUM7Ozs7OztBQUU1Qyx5Q0EwQkM7Ozs7Ozs7Ozs7Ozs7OztJQWJDLG1DQUEwQzs7Ozs7SUFJMUMscUNBQWlCOzs7OztJQUlqQiwyQ0FBc0I7Ozs7O0lBRXRCLG9DQUFnQjs7Ozs7SUFFaEIsNENBQWdDOzs7Ozs7Ozs7Ozs7Ozs7OztBQW1CbEMsTUFBTSxPQUFPLFlBQVk7Ozs7SUFDdkIsWUFBb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