UNPKG

@ohayojp/util

Version:

Universal toolset of ohayojp.

1,817 lines (1,785 loc) 78.4 kB
import extend from 'extend'; import addDays from 'date-fns/addDays'; import endOfDay from 'date-fns/endOfDay'; import endOfMonth from 'date-fns/endOfMonth'; import endOfWeek from 'date-fns/endOfWeek'; import endOfYear from 'date-fns/endOfYear'; import parse from 'date-fns/parse'; import parseISO from 'date-fns/parseISO'; import startOfDay from 'date-fns/startOfDay'; import startOfMonth from 'date-fns/startOfMonth'; import startOfWeek from 'date-fns/startOfWeek'; import startOfYear from 'date-fns/startOfYear'; import subMonths from 'date-fns/subMonths'; import subWeeks from 'date-fns/subWeeks'; import subYears from 'date-fns/subYears'; import { DOCUMENT } from '@angular/common'; import { Injectable, Inject, ɵɵdefineInjectable, ɵɵinject, isDevMode, InjectionToken, Optional, NgModule } from '@angular/core'; import { BehaviorSubject } from 'rxjs'; import { share, filter } from 'rxjs/operators'; import { environment } from 'ng-zorro-antd/core/environments'; import { NzTreeNode } from 'ng-zorro-antd/core/tree'; /** * @fileoverview added by tsickle * Generated from: src/other/deep.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * 类似 `_.get`,根据 `path` 获取安全值 * jsperf: https://jsperf.com/es-deep-getttps://jsperf.com/es-deep-get * * @param {?} obj 数据源,无效时直接返回 `defaultValue` 值 * @param {?} path 若 `null`、`[]`、未定义及未找到时返回 `defaultValue` 值 * @param {?=} defaultValue 默认值 * @return {?} */ function deepGet(obj, path, defaultValue) { if (!obj || path == null || path.length === 0) return defaultValue; if (!Array.isArray(path)) { path = ~path.indexOf('.') ? path.split('.') : [path]; } if (path.length === 1) { /** @type {?} */ const checkObj = obj[path[0]]; return typeof checkObj === 'undefined' ? defaultValue : checkObj; } /** @type {?} */ const res = path.reduce((/** * @param {?} o * @param {?} k * @return {?} */ (o, k) => (o || {})[k]), obj); return typeof res === 'undefined' ? defaultValue : res; } /** * 基于 [extend](https://github.com/justmoon/node-extend) 的深度拷贝 * @param {?} obj * @return {?} */ function deepCopy(obj) { /** @type {?} */ const result = extend(true, {}, { _: obj }); return result._; } /** * 深度合并对象 * * @param {?} original 原始对象 * @param {?} arrayProcessMethod 数组处理方式 * - `true` 表示替换新值,不管新值为哪种类型 * - `false` 表示会合并整个数组(将旧数据与新数据合并成新数组) * @param {...?} objects 要合并的对象 * @return {?} */ function deepMergeKey(original, arrayProcessMethod, ...objects) { if (Array.isArray(original) || typeof original !== 'object') return original; /** @type {?} */ const isObject = (/** * @param {?} v * @return {?} */ (v) => typeof v === 'object' || typeof v === 'function'); /** @type {?} */ const merge = (/** * @param {?} target * @param {?} obj * @return {?} */ (target, obj) => { Object.keys(obj) .filter((/** * @param {?} key * @return {?} */ key => key !== '__proto__' && Object.prototype.hasOwnProperty.call(obj, key))) .forEach((/** * @param {?} key * @return {?} */ key => { /** @type {?} */ const fromValue = obj[key]; /** @type {?} */ const toValue = target[key]; if (Array.isArray(toValue)) { target[key] = arrayProcessMethod ? fromValue : [...toValue, ...fromValue]; } else if (fromValue != null && isObject(fromValue) && toValue != null && isObject(toValue)) { target[key] = merge(toValue, fromValue); } else { target[key] = deepCopy(fromValue); } })); return target; }); objects.filter((/** * @param {?} v * @return {?} */ v => v != null && isObject(v))).forEach((/** * @param {?} v * @return {?} */ v => merge(original, v))); return original; } /** * 深度合并对象 * * @param {?} original 原始对象 * @param {...?} objects 要合并的对象 * @return {?} */ function deepMerge(original, ...objects) { return deepMergeKey(original, false, ...objects); } /** * @fileoverview added by tsickle * Generated from: src/string/string.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * 字符串格式化 * ``` * format('this is ${name}', { name: 'asdf' }) * // output: this is asdf * format('this is ${user.name}', { user: { name: 'asdf' } }, true) * // output: this is asdf * ``` * @param {?} str * @param {?} obj * @param {?=} needDeepGet * @return {?} */ function format(str, obj, needDeepGet = false) { return (str || '').replace(/\${([^}]+)}/g, (/** * @param {?} _work * @param {?} key * @return {?} */ (_work, key) => needDeepGet ? deepGet(obj, key.split('.'), '') : (obj || {})[key] || '')); } /** * @fileoverview added by tsickle * Generated from: src/time/time.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * 获取时间范围 * @param {?} type 类型,带 `-` 表示过去一个时间,若指定 `number` 表示天数 * @param {?=} time 开始时间 * @return {?} */ function getTimeDistance(type, time) { time = time ? (typeof time === 'string' ? parse(time, 'yyyy-MM-dd HH:mm:ss', new Date()) : new Date(time)) : new Date(); /** @type {?} */ const options = { weekStartsOn: 1 }; /** @type {?} */ let res; switch (type) { case 'today': res = [time, time]; break; case '-today': res = [addDays(time, -1), time]; break; case 'yesterday': res = [addDays(time, -1), addDays(time, -1)]; break; case 'week': res = [startOfWeek(time, options), endOfWeek(time, options)]; break; case '-week': res = [startOfWeek(subWeeks(time, 1), options), endOfWeek(subWeeks(time, 1), options)]; break; case 'month': res = [startOfMonth(time), endOfMonth(time)]; break; case '-month': res = [startOfMonth(subMonths(time, 1)), endOfMonth(subMonths(time, 1))]; break; case 'year': res = [startOfYear(time), endOfYear(time)]; break; case '-year': res = [startOfYear(subYears(time, 1)), endOfYear(subYears(time, 1))]; break; default: res = type > 0 ? [time, addDays(time, type)] : [addDays(time, type), time]; break; } return fixEndTimeOfRange(res); } /** * fix time is the most, big value * @param {?} dates * @return {?} */ function fixEndTimeOfRange(dates) { return [startOfDay(dates[0]), endOfDay(dates[1])]; } /** * Return the date parsed from string using the given format string * - If the argument is a number, it is treated as a timestamp. * @param {?} value * @param {?=} options * @return {?} */ function toDate(value, options) { if (typeof options === 'string') options = { formatString: options }; const { formatString, defaultValue } = Object.assign({ formatString: 'yyyy-MM-dd HH:mm:ss', defaultValue: new Date(NaN) }, options); if (value == null) return defaultValue; if (value instanceof Date) return value; if (typeof value === 'number') return new Date(value); /** @type {?} */ let tryDate = !isNaN(+value) ? new Date(+value) : parseISO(value); if (isNaN((/** @type {?} */ (tryDate)))) { tryDate = parse(value, (/** @type {?} */ (formatString)), defaultValue); } return isNaN((/** @type {?} */ (tryDate))) ? defaultValue : tryDate; } /** * @fileoverview added by tsickle * Generated from: src/lazy/lazy.service.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @record */ function LazyResult() { } if (false) { /** @type {?} */ LazyResult.prototype.path; /** @type {?} */ LazyResult.prototype.status; /** @type {?|undefined} */ LazyResult.prototype.error; } /** * 延迟加载资源(js 或 css)服务 */ class LazyService { /** * @param {?} doc */ constructor(doc) { this.doc = doc; this.list = {}; this.cached = {}; this._notify = new BehaviorSubject([]); } /** * @return {?} */ get change() { return this._notify.asObservable().pipe(share(), filter((/** * @param {?} ls * @return {?} */ ls => ls.length !== 0))); } /** * @return {?} */ clear() { this.list = {}; this.cached = {}; } /** * @param {?} paths * @return {?} */ load(paths) { if (!Array.isArray(paths)) { paths = [paths]; } /** @type {?} */ const promises = []; paths.forEach((/** * @param {?} path * @return {?} */ path => { if (path.endsWith('.js')) { promises.push(this.loadScript(path)); } else { promises.push(this.loadStyle(path)); } })); return Promise.all(promises).then((/** * @param {?} res * @return {?} */ res => { this._notify.next(res); return Promise.resolve(res); })); } /** * @param {?} path * @param {?=} innerContent * @return {?} */ loadScript(path, innerContent) { return new Promise((/** * @param {?} resolve * @return {?} */ resolve => { if (this.list[path] === true) { resolve(Object.assign(Object.assign({}, this.cached[path]), { status: 'loading' })); return; } this.list[path] = true; /** @type {?} */ const onSuccess = (/** * @param {?} item * @return {?} */ (item) => { this.cached[path] = item; resolve(item); this._notify.next([item]); }); /** @type {?} */ const node = (/** @type {?} */ (this.doc.createElement('script'))); node.type = 'text/javascript'; node.src = path; node.charset = 'utf-8'; if (innerContent) { node.innerHTML = innerContent; } if (node.readyState) { // IE node.onreadystatechange = (/** * @return {?} */ () => { if (node.readyState === 'loaded' || node.readyState === 'complete') { node.onreadystatechange = null; onSuccess({ path, status: 'ok', }); } }); } else { node.onload = (/** * @return {?} */ () => onSuccess({ path, status: 'ok', })); } node.onerror = (/** * @param {?} error * @return {?} */ (error) => onSuccess({ path, status: 'error', error, })); this.doc.getElementsByTagName('head')[0].appendChild(node); })); } /** * @param {?} path * @param {?=} rel * @param {?=} innerContent * @return {?} */ loadStyle(path, rel = 'stylesheet', innerContent) { return new Promise((/** * @param {?} resolve * @return {?} */ resolve => { if (this.list[path] === true) { resolve(this.cached[path]); return; } this.list[path] = true; /** @type {?} */ const node = (/** @type {?} */ (this.doc.createElement('link'))); node.rel = rel; node.type = 'text/css'; node.href = path; if (innerContent) { node.innerHTML = innerContent; } this.doc.getElementsByTagName('head')[0].appendChild(node); /** @type {?} */ const item = { path, status: 'ok', }; this.cached[path] = item; resolve(item); })); } } LazyService.decorators = [ { type: Injectable, args: [{ providedIn: 'root' },] } ]; /** @nocollapse */ LazyService.ctorParameters = () => [ { type: undefined, decorators: [{ type: Inject, args: [DOCUMENT,] }] } ]; /** @nocollapse */ LazyService.ɵprov = ɵɵdefineInjectable({ factory: function LazyService_Factory() { return new LazyService(ɵɵinject(DOCUMENT)); }, token: LazyService, providedIn: "root" }); if (false) { /** * @type {?} * @private */ LazyService.prototype.list; /** * @type {?} * @private */ LazyService.prototype.cached; /** * @type {?} * @private */ LazyService.prototype._notify; /** * @type {?} * @private */ LazyService.prototype.doc; } /** * @fileoverview added by tsickle * Generated from: src/validate/validate.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * 是否为数字 * @param {?} value * @return {?} */ function isNum(value) { return /^((-?\d+\.\d+)|(-?\d+)|(-?\.\d+))$/.test(value.toString()); } /** * 是否为整数 * @param {?} value * @return {?} */ function isInt(value) { return isNum(value) && parseInt(value.toString(), 10).toString() === value.toString(); } /** * 是否为小数 * @param {?} value * @return {?} */ function isDecimal(value) { return isNum(value) && !isInt(value); } /** * 是否为身份证 * @param {?} value * @return {?} */ function isIdCard(value) { return typeof value === 'string' && /(^\d{15}$)|(^\d{17}([0-9]|X)$)/i.test(value); } /** * 是否为手机号 * @param {?} value * @return {?} */ function isMobile(value) { return typeof value === 'string' && /^(0|\+?86|17951)?(13[0-9]|15[0-9]|17[0678]|18[0-9]|14[57])[0-9]{8}$/.test(value); } /** * 是否URL地址 * @param {?} url * @return {?} */ function isUrl(url) { return /(((^https?:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+(?::\d+)?|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))?)$/.test(url); } /** * @fileoverview added by tsickle * Generated from: src/validate/validators.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * 一套日常验证器 */ // tslint:disable-next-line:class-name class _Validators { /** * 是否为数字 * @param {?} control * @return {?} */ static num(control) { return isNum(control.value) ? null : { num: true }; } /** * 是否为整数 * @param {?} control * @return {?} */ static int(control) { return isInt(control.value) ? null : { int: true }; } /** * 是否为小数 * @param {?} control * @return {?} */ static decimal(control) { return isDecimal(control.value) ? null : { decimal: true }; } /** * 是否为身份证 * @param {?} control * @return {?} */ static idCard(control) { return isIdCard(control.value) ? null : { idCard: true }; } /** * 是否为手机号 * @param {?} control * @return {?} */ static mobile(control) { return isMobile(control.value) ? null : { mobile: true }; } /** * 是否URL地址 * @param {?} control * @return {?} */ static url(control) { return isUrl(control.value) ? null : { url: true }; } } /** * @fileoverview added by tsickle * Generated from: src/logger/logger.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ const record = {}; /** @type {?} */ const PREFIX = '[@ohayojp]:'; /** * @param {...?} args * @return {?} */ function notRecorded(...args) { /** @type {?} */ const asRecord = args.reduce((/** * @param {?} acc * @param {?} c * @return {?} */ (acc, c) => acc + c.toString()), ''); if (record[asRecord]) { return false; } else { record[asRecord] = true; return true; } } /** * @param {?} consoleFunc * @param {...?} args * @return {?} */ function consoleCommonBehavior(consoleFunc, ...args) { if (environment.isTestMode || (isDevMode() && notRecorded(...args))) { consoleFunc(...args); } } // Warning should only be printed in dev mode and only once. /** @type {?} */ const warn = (/** * @param {...?} args * @return {?} */ (...args) => consoleCommonBehavior((/** * @param {...?} arg * @return {?} */ (...arg) => console.warn(PREFIX, ...arg)), ...args)); /** @type {?} */ const deprecation11 = (/** * @param {?} comp * @param {?} from * @param {?=} to * @return {?} */ (comp, from, to) => { warnDeprecation(`${comp} => '${from}' is going to be removed in 11.0.0${to ? `, Please use '${to}' instead` : ``}.`); }); /** @type {?} */ const warnDeprecation = (/** * @param {...?} args * @return {?} */ (...args) => { if (!environment.isTestMode) { /** @type {?} */ const stack = new Error().stack; return consoleCommonBehavior((/** * @param {...?} arg * @return {?} */ (...arg) => console.warn(PREFIX, 'deprecated:', ...arg, stack)), ...args); } else { return (/** * @return {?} */ () => { }); } }); // Log should only be printed in dev mode. /** @type {?} */ const log = (/** * @param {...?} args * @return {?} */ (...args) => { if (isDevMode()) { console.log(PREFIX, ...args); } }); /** * @fileoverview added by tsickle * Generated from: src/other/check.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @param {?} element * @return {?} */ function isEmpty(element) { /** @type {?} */ const nodes = element.childNodes; for (let i = 0; i < nodes.length; i++) { /** @type {?} */ const node = nodes.item(i); if (node.nodeType === 1 && ((/** @type {?} */ (node))).outerHTML.toString().trim().length !== 0) { return false; } else if (node.nodeType === 3 && (/** @type {?} */ (node.textContent)).toString().trim().length !== 0) { return false; } } return true; } /** * @template T, D * @param {?} name * @param {?} fallback * @param {?} defaultValue * @return {?} */ function propDecoratorFactory(name, fallback, defaultValue) { /** * @param {?} target * @param {?} propName * @param {?=} originalDescriptor * @return {?} */ function propDecorator(target, propName, originalDescriptor) { /** @type {?} */ const privatePropName = `$$__${propName}`; if (Object.prototype.hasOwnProperty.call(target, privatePropName)) { warn(`The prop "${privatePropName}" is already exist, it will be overrided by ${name} decorator.`); } Object.defineProperty(target, privatePropName, { configurable: true, writable: true, }); return { /** * @return {?} */ get() { return originalDescriptor && originalDescriptor.get ? originalDescriptor.get.bind(this)() : this[privatePropName]; }, /** * @param {?} value * @return {?} */ set(value) { if (originalDescriptor && originalDescriptor.set) { originalDescriptor.set.bind(this)(fallback(value, defaultValue)); } this[privatePropName] = fallback(value, defaultValue); }, }; } return propDecorator; } /** * @param {?} value * @param {?=} allowUndefined * @return {?} */ function toBoolean(value, allowUndefined = false) { return allowUndefined && typeof value === 'undefined' ? undefined : value != null && `${value}` !== 'false'; } /** * Input decorator that handle a prop to do get/set automatically with toBoolean * * ```ts * \@Input() InputBoolean() visible: boolean = false; / \@InputBoolean(null) visible: boolean = false; * ``` * @param {?=} defaultValue * @return {?} */ function InputBoolean(defaultValue = false) { return propDecoratorFactory('InputNumber', toBoolean, defaultValue); } /** * @param {?} value * @param {?=} fallbackValue * @return {?} */ function toNumber(value, fallbackValue = 0) { return !isNaN(parseFloat((/** @type {?} */ (value)))) && !isNaN(Number(value)) ? Number(value) : fallbackValue; } /** * Input decorator that handle a prop to do get/set automatically with toNumber * * ```ts * \@Input() \@InputNumber() visible: number = 1; / \@InputNumber(null) visible: number = 2; * ``` * @param {?=} defaultValue * @return {?} */ function InputNumber(defaultValue = 0) { return propDecoratorFactory('InputNumber', toNumber, defaultValue); } /** * @fileoverview added by tsickle * Generated from: src/other/copy.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * 复制字符串文档至剪贴板 * @param {?} value * @return {?} */ function copy(value) { return new Promise((/** * @param {?} resolve * @return {?} */ (resolve) => { /** @type {?} */ let copyTextArea = null; try { copyTextArea = document.createElement('textarea'); copyTextArea.style.height = '0px'; copyTextArea.style.opacity = '0'; copyTextArea.style.width = '0px'; document.body.appendChild(copyTextArea); copyTextArea.value = value; copyTextArea.select(); document.execCommand('copy'); resolve(value); } finally { if (copyTextArea && copyTextArea.parentNode) { copyTextArea.parentNode.removeChild(copyTextArea); } } })); } /** * @fileoverview added by tsickle * Generated from: src/other/style.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @param {?} el * @param {?} classMap * @param {?} renderer * @return {?} */ function removeClass(el, classMap, renderer) { // tslint:disable-next-line: forin for (const i in classMap) { renderer.removeClass(el, i); } } /** * @param {?} el * @param {?} classMap * @param {?} renderer * @return {?} */ function addClass(el, classMap, renderer) { for (const i in classMap) { if (classMap[i]) { renderer.addClass(el, i); } } } /** * 更新宿主组件样式 `class`,例如: * * ```ts * updateHostClass( * this.el.nativeElement, * this.renderer, * { * [ 'classname' ]: true, * [ 'classname' ]: this.type === '1', * [ this.cls ]: true, * [ `a-${this.cls}` ]: true * }) * ``` * * @param {?} el * @param {?} renderer * @param {?} classMap * @param {?=} cleanAll * @return {?} */ function updateHostClass(el, renderer, classMap, cleanAll = false) { if (cleanAll === true) { renderer.removeAttribute(el, 'class'); } else { removeClass(el, classMap, renderer); } classMap = Object.assign({}, classMap); addClass(el, classMap, renderer); } /** * @fileoverview added by tsickle * Generated from: src/other/index.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * Generated from: src/config/components/error-collect.type.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @record */ function OhayoErrorCollectConfig() { } if (false) { /** * 监听频率,默认:`500` * @type {?|undefined} */ OhayoErrorCollectConfig.prototype.freq; /** * 顶部偏移值,默认:`145` * @type {?|undefined} */ OhayoErrorCollectConfig.prototype.offsetTop; } /** * @fileoverview added by tsickle * Generated from: src/config/components/image.type.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @record */ function OhayoImageConfig() { } if (false) { /** * 默认大小,默认值:`64`,单位:px * @type {?|undefined} */ OhayoImageConfig.prototype.size; /** * 错误图片,默认:`./assets/img/logo.svg` * @type {?|undefined} */ OhayoImageConfig.prototype.error; } /** * @fileoverview added by tsickle * Generated from: src/config/components/date-picker.type.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @record */ function OhayoDateRangePickerConfig() { } if (false) { /** * 默认:`yyyy-MM-dd` * @type {?|undefined} */ OhayoDateRangePickerConfig.prototype.nzFormat; /** @type {?|undefined} */ OhayoDateRangePickerConfig.prototype.nzClassName; /** @type {?|undefined} */ OhayoDateRangePickerConfig.prototype.nzSize; /** @type {?|undefined} */ OhayoDateRangePickerConfig.prototype.nzStyle; /** * 默认:`true` * @type {?|undefined} */ OhayoDateRangePickerConfig.prototype.nzAllowClear; /** * 默认:`false` * @type {?|undefined} */ OhayoDateRangePickerConfig.prototype.nzAutoFocus; /** @type {?|undefined} */ OhayoDateRangePickerConfig.prototype.nzDisabledDate; /** @type {?|undefined} */ OhayoDateRangePickerConfig.prototype.nzDisabledTime; /** * 默认:`{ position: 'relative' }` * @type {?|undefined} */ OhayoDateRangePickerConfig.prototype.nzPopupStyle; /** @type {?|undefined} */ OhayoDateRangePickerConfig.prototype.nzDropdownClassName; /** @type {?|undefined} */ OhayoDateRangePickerConfig.prototype.nzRenderExtraFooter; /** @type {?|undefined} */ OhayoDateRangePickerConfig.prototype.nzShowTime; /** * 默认:`true` * @type {?|undefined} */ OhayoDateRangePickerConfig.prototype.nzShowToday; /** @type {?|undefined} */ OhayoDateRangePickerConfig.prototype.nzMode; /** @type {?|undefined} */ OhayoDateRangePickerConfig.prototype.nzRanges; /** @type {?|undefined} */ OhayoDateRangePickerConfig.prototype.shortcuts; } /** * @record */ function OhayoDateRangePickerShortcut() { } if (false) { /** * Whether to enable, default: `false` * @type {?|undefined} */ OhayoDateRangePickerShortcut.prototype.enabled; /** * Whether to close the panel after clicking, default: `true` * @type {?|undefined} */ OhayoDateRangePickerShortcut.prototype.closed; /** * Shortcut list, default: `今天`, `昨天`, `近3天`, `近7天`, `本周`, `本月`, `全年` * @type {?|undefined} */ OhayoDateRangePickerShortcut.prototype.list; } /** * @record */ function OhayoDateRangePickerShortcutItem() { } if (false) { /** @type {?} */ OhayoDateRangePickerShortcutItem.prototype.text; /** @type {?} */ OhayoDateRangePickerShortcutItem.prototype.fn; /* Skipping unhandled member: [key: string]: NzSafeAny;*/ } /** * @fileoverview added by tsickle * Generated from: src/config/components/loading.type.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @record */ function OhayoLoadingConfig() { } if (false) { /** * 类型,默认:`spin` * @type {?|undefined} */ OhayoLoadingConfig.prototype.type; /** * 显示文本,默认:`加载中...` * @type {?|undefined} */ OhayoLoadingConfig.prototype.text; /** @type {?|undefined} */ OhayoLoadingConfig.prototype.icon; /** @type {?|undefined} */ OhayoLoadingConfig.prototype.custom; /** * 延迟,默认:`0` * @type {?|undefined} */ OhayoLoadingConfig.prototype.delay; } /** * @fileoverview added by tsickle * Generated from: src/config/components/lodop.type.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @record */ function OhayoLodopConfig() { } if (false) { /** * 注册信息:主注册号 * @type {?|undefined} */ OhayoLodopConfig.prototype.license; /** * 注册信息:附加注册号A * @type {?|undefined} */ OhayoLodopConfig.prototype.licenseA; /** * 注册信息:附加注册号B * @type {?|undefined} */ OhayoLodopConfig.prototype.licenseB; /** * 注册信息:注册单位名称 * @type {?|undefined} */ OhayoLodopConfig.prototype.companyName; /** * Lodop 远程脚本URL地址,**注意**务必使用 `name` 属性指定变量值 * * - http://localhost:18000/CLodopfuncs.js * - https://localhost:8443/CLodopfuncs.js [默认] * @type {?|undefined} */ OhayoLodopConfig.prototype.url; /** * Lodop 变量名,默认:`CLODOP` * @type {?|undefined} */ OhayoLodopConfig.prototype.name; /** * 检查次数,默认 `100`,当检查超过时视为异常,这是因为 Lodop 需要连接 WebSocket * @type {?|undefined} */ OhayoLodopConfig.prototype.checkMaxCount; } /** * @fileoverview added by tsickle * Generated from: src/config/components/page-header.type.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @record */ function OhayoPageHeaderConfig() { } if (false) { /** * 首页文本,若指定空表示不显示,默认:`首页` * @type {?|undefined} */ OhayoPageHeaderConfig.prototype.home; /** * 首页链接,默认:`/` * @type {?|undefined} */ OhayoPageHeaderConfig.prototype.homeLink; /** * 首页链接国际化参数 * @type {?|undefined} */ OhayoPageHeaderConfig.prototype.homeI18n; /** * 自动生成导航,以当前路由从主菜单中定位,默认:`true` * @type {?|undefined} */ OhayoPageHeaderConfig.prototype.autoBreadcrumb; /** * 自动向上递归查找,默认:`false` * - 菜单数据源包含 `/ware`,则 `/ware/1` 也视为 `/ware` 项 * @type {?|undefined} */ OhayoPageHeaderConfig.prototype.recursiveBreadcrumb; /** * 自动生成标题,以当前路由从主菜单中定位,默认:`true` * @type {?|undefined} */ OhayoPageHeaderConfig.prototype.autoTitle; /** * 是否自动将标准信息同步至 `TitleService`、`ReuseService` 下,默认:`true` * @type {?|undefined} */ OhayoPageHeaderConfig.prototype.syncTitle; /** * 是否固定模式,默认:`false` * @type {?|undefined} */ OhayoPageHeaderConfig.prototype.fixed; /** * 固定偏移值,默认:`64` * @type {?|undefined} */ OhayoPageHeaderConfig.prototype.fixedOffsetTop; } /** * @fileoverview added by tsickle * Generated from: src/config/components/qr.type.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @record */ function OhayoQRConfig() { } if (false) { /** * [qrious](https://neocotic.com/qrious) 外网地址,默认:`https://cdn.bootcdn.net/ajax/libs/qrious/4.0.2/qrious.min.js` * * 若在 `angular.json` 配置 `"scripts": [ "node_modules/qrious/dist/qrious.min.js" ]` 则优先使用 * @type {?|undefined} */ OhayoQRConfig.prototype.lib; /** * 背景,默认:`white` * @type {?|undefined} */ OhayoQRConfig.prototype.background; /** * 背景透明级别,范围:`0-1` 之间,默认:`1` * @type {?|undefined} */ OhayoQRConfig.prototype.backgroundAlpha; /** * 前景,默认:`black` * @type {?|undefined} */ OhayoQRConfig.prototype.foreground; /** * 前景透明级别,范围:`0-1` 之间,默认:`1` * @type {?|undefined} */ OhayoQRConfig.prototype.foregroundAlpha; /** * 误差校正级别,默认:`L` * @type {?|undefined} */ OhayoQRConfig.prototype.level; /** * 二维码输出图片MIME类型,默认:`image/png` * @type {?|undefined} */ OhayoQRConfig.prototype.mime; /** * 内边距(单位:px),默认:`10` * @type {?|undefined} */ OhayoQRConfig.prototype.padding; /** * 大小(单位:px),默认:`220` * @type {?|undefined} */ OhayoQRConfig.prototype.size; /** @type {?|undefined} */ OhayoQRConfig.prototype.delay; } /** * @fileoverview added by tsickle * Generated from: src/config/components/se.type.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @record */ function OhayoSEConfig() { } if (false) { /** * 大小,默认:`default` * - `compact` 紧凑型,强制忽略 `error`、`extra` 展示 * @type {?|undefined} */ OhayoSEConfig.prototype.size; /** * 布局类型,等同 `nzLayout`,默认:`horizontal` * - `inline` 时强制大小为 `compact` * @type {?|undefined} */ OhayoSEConfig.prototype.nzLayout; /** * 间距,当 `nzLayout:horizontal` 时有效,默认:`32` * @type {?|undefined} */ OhayoSEConfig.prototype.gutter; /** * 列数,默认:`2` * @type {?|undefined} */ OhayoSEConfig.prototype.col; /** * 标签文本宽度,单位:`px`,默认:`150` * @type {?|undefined} */ OhayoSEConfig.prototype.labelWidth; /** * 是否立即呈现错误视觉,默认:`false` * @type {?|undefined} */ OhayoSEConfig.prototype.firstVisual; /** * 是否忽略 `dirty` 校验,默认:`false` * @type {?|undefined} */ OhayoSEConfig.prototype.ingoreDirty; } /** * @fileoverview added by tsickle * Generated from: src/config/components/sv.type.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ class OhayoSVConfig { } if (false) { /** * 大小,默认:`large` * @type {?} */ OhayoSVConfig.prototype.size; /** * 间距,默认:`32` * @type {?} */ OhayoSVConfig.prototype.gutter; /** * 布局,默认:`horizontal` * @type {?} */ OhayoSVConfig.prototype.layout; /** * 列数,默认:`3` * @type {?} */ OhayoSVConfig.prototype.col; /** * 是否显示默认值,当内容为空值时显示 `-`,默认:`true` * @type {?} */ OhayoSVConfig.prototype.default; /** * `label` 固定宽度,若 `null` 或 `undefined` 表示非固定,默认:`null` * @type {?} */ OhayoSVConfig.prototype.labelWidth; } /** * @fileoverview added by tsickle * Generated from: src/config/components/sg.type.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @record */ function OhayoSGConfig() { } if (false) { /** * 间距,默认:`32` * @type {?|undefined} */ OhayoSGConfig.prototype.gutter; /** * 列数,默认:`2` * @type {?|undefined} */ OhayoSGConfig.prototype.col; } /** * @fileoverview added by tsickle * Generated from: src/config/components/st.type.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @record */ function OhayoSTConfig() { } if (false) { /** * 起始页码,默认为:`1` * @type {?|undefined} */ OhayoSTConfig.prototype.pi; /** * 每页数量,默认:`10` * @type {?|undefined} */ OhayoSTConfig.prototype.ps; /** * 是否显示边框,默认:`false` * @type {?|undefined} */ OhayoSTConfig.prototype.bordered; /** * table大小,默认:`default` * @type {?|undefined} */ OhayoSTConfig.prototype.size; /** * 是否开启响应式,默认:`true` * @type {?|undefined} */ OhayoSTConfig.prototype.responsive; /** * 是否在小屏幕下才显示顶部与底部,默认:`false` * @type {?|undefined} */ OhayoSTConfig.prototype.responsiveHideHeaderFooter; /** * 请求体配置 * @type {?|undefined} */ OhayoSTConfig.prototype.req; /** * 返回体配置 * @type {?|undefined} */ OhayoSTConfig.prototype.res; /** * 返回体配置 * @type {?|undefined} */ OhayoSTConfig.prototype.page; /** * 重命名排序值,`columns` 的重命名高于属性 * @type {?|undefined} */ OhayoSTConfig.prototype.sortReName; /** * 单排序规则 * - 若不指定,则返回:`columnName=ascend|descend` * - 若指定,则返回:`sort=columnName.(ascend|descend)` * @type {?|undefined} */ OhayoSTConfig.prototype.singleSort; /** * 是否多排序,当 `sort` 多个相同值时自动合并,建议后端支持时使用 * @type {?|undefined} */ OhayoSTConfig.prototype.multiSort; /** * 按钮模态框配置 * @type {?|undefined} */ OhayoSTConfig.prototype.modal; /** * 按钮抽屉配置 * @type {?|undefined} */ OhayoSTConfig.prototype.drawer; /** * 气泡参数 * @type {?|undefined} */ OhayoSTConfig.prototype.pop; /** * 行单击多少时长之类为双击(单位:毫秒),默认:`200` * @type {?|undefined} */ OhayoSTConfig.prototype.rowClickTime; /** * 过滤按钮确认文本 * @type {?|undefined} */ OhayoSTConfig.prototype.filterConfirmText; /** * 过滤按钮重置文本 * @type {?|undefined} */ OhayoSTConfig.prototype.filterClearText; /** * 按钮图标 * @type {?|undefined} */ OhayoSTConfig.prototype.btnIcon; /** * 行号索引,默认:`1` * - 计算规则为:`index + noIndex` * @type {?|undefined} */ OhayoSTConfig.prototype.noIndex; /** * 表格行的类名 * @type {?|undefined} */ OhayoSTConfig.prototype.rowClassName; /** * 通过点击行来展开子行,Default: `false` * @type {?|undefined} */ OhayoSTConfig.prototype.expandRowByClick; /** * 手风琴模式,Default: `false` * @type {?|undefined} */ OhayoSTConfig.prototype.expandAccordion; /** * 指定 `width` 模式 * @type {?|undefined} */ OhayoSTConfig.prototype.widthMode; /** * Default: `54` * @type {?|undefined} */ OhayoSTConfig.prototype.virtualItemSize; /** * Default: `200` * @type {?|undefined} */ OhayoSTConfig.prototype.virtualMaxBufferPx; /** * Default: `100` * @type {?|undefined} */ OhayoSTConfig.prototype.virtualMinBufferPx; /** * The TrackByFunction to use for tracking changes * @type {?|undefined} */ OhayoSTConfig.prototype.virtualForTrackBy; /** * Conditional expression rendering behavior, can be set to `hide` (default) or `disabled`, Default: `hide` * @type {?|undefined} */ OhayoSTConfig.prototype.iifBehavior; /** * The spinning indicator * @type {?|undefined} */ OhayoSTConfig.prototype.loadingIndicator; /** * Specifies a delay in milliseconds for loading state (prevent flush) * @type {?|undefined} */ OhayoSTConfig.prototype.loadingDelay; /** * Custom no result content * @type {?|undefined} */ OhayoSTConfig.prototype.noResult; } /** * @fileoverview added by tsickle * Generated from: src/config/components/xlsx.type.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @record */ function OhayoXlsxConfig() { } if (false) { /** * Xlsx library path, default: `//cdn.bootcss.com/xlsx/0.15.6/xlsx.full.min.js` * @type {?|undefined} */ OhayoXlsxConfig.prototype.url; /** * Defines which Xlsx optional modules should get loaded, e.g: * * `[ '//cdn.bootcss.com/xlsx/0.15.6/cpexcel.js' ]` * @type {?|undefined} */ OhayoXlsxConfig.prototype.modules; } /** * @fileoverview added by tsickle * Generated from: src/config/components/zip.type.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @record */ function OhayoZipConfig() { } if (false) { /** * Zip library path, Default: `//cdn.bootcss.com/jszip/3.3.0/jszip.min.js` * @type {?|undefined} */ OhayoZipConfig.prototype.url; /** * Defines which zip optional utils should get loaded * @type {?|undefined} */ OhayoZipConfig.prototype.utils; } /** * @fileoverview added by tsickle * Generated from: src/config/components/media.type.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @record */ function OhayoMediaConfig() { } if (false) { /** * Plyr library path, default: `["https://cdn.bootcdn.net/ajax/libs/plyr/3.5.10/plyr.min.js", "https://cdn.bootcdn.net/ajax/libs/plyr/3.5.10/plyr.css"]` * @type {?|undefined} */ OhayoMediaConfig.prototype.urls; /** * Please refer to [plyr options](https://github.com/sampotts/plyr#options) * @type {?|undefined} */ OhayoMediaConfig.prototype.options; } /** * @fileoverview added by tsickle * Generated from: src/config/components/index.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * Generated from: src/config/acl/acl.type.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @record */ function OhayoACLConfig() { } if (false) { /** * Router URL when guard fail, default: `/403` * @type {?|undefined} */ OhayoACLConfig.prototype.guard_url; /** * `can` before execution callback * @type {?|undefined} */ OhayoACLConfig.prototype.preCan; } /** * @record */ function OhayoACLType() { } if (false) { /** * 角色 * @type {?|undefined} */ OhayoACLType.prototype.role; /** * 权限点 * @type {?|undefined} */ OhayoACLType.prototype.ability; /** * Validated against, default: `oneOf` * - `allOf` the value validates against all the roles or abilities * - `oneOf` the value validates against exactly one of the roles or abilities * @type {?|undefined} */ OhayoACLType.prototype.mode; /** * 是否取反,即结果为 `true` 时表示未授权 * @type {?|undefined} */ OhayoACLType.prototype.except; /* Skipping unhandled member: [key: string]: NzSafeAny;*/ } /** * @fileoverview added by tsickle * Generated from: src/config/auth/auth.type.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @record */ function OhayoAuthConfig() { } if (false) { /** * 存储KEY值,默认:`_token` * @type {?|undefined} */ OhayoAuthConfig.prototype.store_key; /** * 无效时跳转至登录页,默认:`true`,包括: * - 无效token值 * - token已过期(限JWT) * @type {?|undefined} */ OhayoAuthConfig.prototype.token_invalid_redirect; /** * token过期时间偏移值,默认:`10` 秒(单位:秒) * @type {?|undefined} */ OhayoAuthConfig.prototype.token_exp_offset; /** * 发送token参数名,默认:· * @type {?|undefined} */ OhayoAuthConfig.prototype.token_send_key; /** * 发送token模板(默认为:`'${token}'`),使用 `${token}` 表示token点位符(**注意:**请务必使用 \`\` 包裹),例如: * * - `Bearer ${token}` * @type {?|undefined} */ OhayoAuthConfig.prototype.token_send_template; /** * 发送token参数位置,默认:`header` * @type {?|undefined} */ OhayoAuthConfig.prototype.token_send_place; /** * 登录页路由地址,默认:`/login` * @type {?|undefined} */ OhayoAuthConfig.prototype.login_url; /** * 忽略TOKEN的URL地址列表,默认值为:`[/\/login/, /assets\//, /passport\//]` * @type {?|undefined} */ OhayoAuthConfig.prototype.ignores; /** * 允许匿名登录KEY,若请求参数中带有该KEY表示忽略TOKEN,默认:`_allow_anonymous` * @type {?|undefined} */ OhayoAuthConfig.prototype.allow_anonymous_key; /** * 是否校验失效时命中后继续调用后续拦截器的 `intercept` 方法,默认:`true` * @type {?|undefined} */ OhayoAuthConfig.prototype.executeOtherInterceptors; /** * 刷新间隔时长(单位:ms),默认:`3000` * @type {?|undefined} */ OhayoAuthConfig.prototype.refreshTime; /** * 过期计算偏移值(单位:ms),默认:`6000` * - **建议**根据 `refreshTime` 倍数来设置 * @type {?|undefined} */ OhayoAuthConfig.prototype.refreshOffset; } /** * @fileoverview added by tsickle * Generated from: src/config/cache/cache.type.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @record */ function OhayoCacheConfig() { } if (false) { /** * Cache mode, default: `promise` * - `promise` Convention mode, allowing `key` to get data as http * - `none` Normal mode * @type {?|undefined} */ OhayoCacheConfig.prototype.mode; /** * Rename the return parameters, default: ``, for example: * - `null` The response body is content * - `list` The response body should be `{ list: [] }` * - `result.list` The response body should be `{ result: { list: [] } }` * @type {?|undefined} */ OhayoCacheConfig.prototype.reName; /** * Set the default storage type * - `m` Storage via memory * - `s` Storage via `localStorage` * @type {?|undefined} */ OhayoCacheConfig.prototype.type; /** * Set the default expire time (Unit: second) * @type {?|undefined} */ OhayoCacheConfig.prototype.expire; /** * Key prefix of persistent data, default: `` * @type {?|undefined} */ OhayoCacheConfig.prototype.prefix; /** * Key name of persistent data metadata storage, default: `__cache_meta` * @type {?|undefined} */ OhayoCacheConfig.prototype.meta_key; } /** * @fileoverview added by tsickle * Generated from: src/config/chart/chart.type.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @record */ function OhayoChartConfig() { } if (false) { /** @type {?|undefined} */ OhayoChartConfig.prototype.theme; } /** * @fileoverview added by tsickle * Generated from: src/config/util/array.type.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @record */ function OhayoUtilArrayConfig() { } if (false) { /** * 深度项名,默认:`'deep'` * @type {?|undefined} */ OhayoUtilArrayConfig.prototype.deepMapName; /** * 扁平后数组的父数据项名,默认:`'parent'` * @type {?|undefined} */ OhayoUtilArrayConfig.prototype.parentMapName; /** * 编号项名,默认:`'id'` * @type {?|undefined} */ OhayoUtilArrayConfig.prototype.idMapName; /** * 父编号项名,默认:`'parent_id'` * @type {?|undefined} */ OhayoUtilArrayConfig.prototype.parentIdMapName; /** * 源数据子项名,默认:`'children'` * @type {?|undefined} */ OhayoUtilArrayConfig.prototype.childrenMapName; /** * 标题项名,默认:`'title'` * @type {?|undefined} */ OhayoUtilArrayConfig.prototype.titleMapName;