forked from fanruan/fineui
Browse Source
* commit '12670b2fde1bf2f6eb73a6d55e6b2a7ead377c0d': chore: add lib chore: add ignoremaster
Teller
5 years ago
25 changed files with 989 additions and 1 deletions
@ -0,0 +1,10 @@
|
||||
import { _Widget } from "../core/widget"; |
||||
export interface _Pane extends _Widget { |
||||
_assertTip: (..._args: any[]) => void; |
||||
loading: (..._args: any[]) => void; |
||||
loaded: (..._args: any[]) => void; |
||||
check: (..._args: any[]) => void; |
||||
} |
||||
export interface _PaneStatic { |
||||
EVENT_LOADED: "EVENT_LOADED"; |
||||
} |
@ -0,0 +1,18 @@
|
||||
import { _Single } from "../single"; |
||||
export interface _BasicButton extends _Single { |
||||
_createShadow(): void; |
||||
bindEvent(): void; |
||||
_trigger(e: Event): void; |
||||
_doClick(e: Event): void; |
||||
beforeClick(): void; |
||||
doClick(): void; |
||||
handle(): _BasicButton; |
||||
hover(): void; |
||||
dishover(): void; |
||||
setSelected(b: any): void; |
||||
isSelected(): boolean; |
||||
isOnce(): boolean; |
||||
isForceSelected(): boolean; |
||||
isForceNotSelected(): boolean; |
||||
isDisableSelected(): boolean; |
||||
} |
@ -0,0 +1,20 @@
|
||||
import { _Widget } from "../../core/widget"; |
||||
export interface _Single extends _Widget { |
||||
_showToolTip(e: Event, opt?: SingleOpt): void; |
||||
_hideTooltip(): void; |
||||
_clearTimeOut(): void; |
||||
enableHover(opt?: SingleOpt): void; |
||||
disabledHover(): void; |
||||
setTitle(title: string, opt?: SingleOpt): void; |
||||
setWarningTitle(title: string, opt?: SingleOpt): void; |
||||
getTipType(): string; |
||||
isReadOnly(): boolean; |
||||
getTitle(): string; |
||||
getWarningTitle(): string; |
||||
popluate(..._args: any[]): void; |
||||
} |
||||
interface SingleOpt { |
||||
container?: any; |
||||
belowMouse?: boolean; |
||||
} |
||||
export {}; |
@ -0,0 +1,5 @@
|
||||
import { _Single } from "../single"; |
||||
export interface _Trigger extends _Single { |
||||
setKey(..._args: any[]): void; |
||||
getKey(): string; |
||||
} |
@ -0,0 +1,4 @@
|
||||
import { _Pane } from "../../base/pane"; |
||||
export interface _LoadingPane extends _Pane { |
||||
__loaded: (...args: any[]) => void; |
||||
} |
@ -0,0 +1,8 @@
|
||||
import { _OB } from "../ob"; |
||||
export interface _Action extends _OB { |
||||
actionPerformed(src: any, tar: any, callback: Function): void; |
||||
actionBack(tar: any, src: any, callback: Function): void; |
||||
} |
||||
export interface _ActionFactory { |
||||
createAction(key: string, options: any): _Action; |
||||
} |
@ -0,0 +1,3 @@
|
||||
import { _Action } from "./action"; |
||||
export interface _ShowAction extends _Action { |
||||
} |
@ -0,0 +1,193 @@
|
||||
import { _Widget } from "./widget"; |
||||
export interface _base { |
||||
assert: (v: any, is: Function) => Boolean; |
||||
warn: (message: any) => Boolean; |
||||
UUID: () => string; |
||||
isWidget: (widget: any) => widget is _Widget; |
||||
createWidgets: (items: any, options: any, context: any) => any; |
||||
createItems: <T, U, K>(data: T[], innerAttr?: U, outerAttr?: K) => (U & T & K)[]; |
||||
packageItems: (items: any[], layouts: any[]) => any[]; |
||||
formatEL: <T>(obj: T) => { |
||||
el: T; |
||||
} | T; |
||||
stripEL: <T>(obj: { |
||||
el: T; |
||||
} | T) => T; |
||||
trans2Element: (widgets: any[]) => any[]; |
||||
where: (collection: any[] | object | string, source: object) => any[]; |
||||
findWhere: (collection: any[] | object | string, callback?: Function | object | string, thisArg?: any) => object | undefined; |
||||
invoke: (collection: any[] | object | string, methodName: Function | string, arg?: any) => any[]; |
||||
pluck: (collection: any[] | object | string, property: string) => any[]; |
||||
shuffle: (collection: any[] | object | string) => any[]; |
||||
sample: (collection: any[] | object | string, n?: number) => any[]; |
||||
toArray: (collection: any[] | object | string) => any[]; |
||||
size: (collection: any[] | object | string) => number; |
||||
each: <T>(collection: T[] | object | string, callback?: ((index: number, value: T) => void) | object | string, thisArg?: any) => any; |
||||
map: <T, U>(collection: T[] | object | string | null | undefined, callback?: ((index: number, value: T) => U) | object | string, thisArg?: any) => U[]; |
||||
reduce: <T, U>(collection: T[] | object | string, callback?: ((total: U extends T ? U : T, currentValue: T, currentIndex: number) => U extends T ? U : T) | object | string, initialValue?: U | T) => U extends T ? U : T; |
||||
reduceRight: <T, U>(collection: T[] | object | string, callback?: ((total: U extends T ? U : T, currentValue: T, currentIndex: number) => U extends T ? U : T) | object | string, initialValue?: U | T) => U extends T ? U : T; |
||||
find: <T>(collection: T[] | object | string, callback?: ((index: number, value: T) => boolean) | object | string, thisArg?: any) => any; |
||||
filter: <T>(collection: T[] | object | string, callback?: ((index: number, value: T) => boolean) | object | string, thisArg?: any) => any[]; |
||||
reject: <T>(collection: any[] | object | string, callback?: ((index: number, value: T) => boolean) | object | string, thisArg?: any) => any[]; |
||||
every: <T>(collection: any[] | object | string, callback?: ((index: number, value: T) => boolean) | object | string, thisArg?: any) => boolean; |
||||
all: <T>(collection: any[] | object | string, callback?: ((index: number, value: T) => boolean) | object | string, thisArg?: any) => boolean; |
||||
some: <T>(collection: any[] | object | string, callback?: ((index: number, value: T) => boolean) | object | string, thisArg?: any) => boolean; |
||||
any: <T>(collection: T[] | object | string, callback?: ((index: number, value: T) => boolean) | object | string, thisArg?: any) => boolean; |
||||
max: <T>(collection: T[]) => T; |
||||
min: <T>(collection: T[]) => T; |
||||
sortBy: <T>(collection: any[] | object | string, callback?: ((index: number, value: T) => number) | object | string, thisArg?: any) => any[]; |
||||
groupBy: <T>(collection: any[] | object | string, callback?: ((index: number, value: T) => any) | object | string, thisArg?: any) => object; |
||||
indexBy: <T>(collection: any[] | object | string, callback?: ((index: number, value: T) => any) | object | string, thisArg?: any) => object; |
||||
countBy: <T>(collection: any[] | object | string, callback?: ((index: number, value: T) => any) | object | string, thisArg?: any) => object; |
||||
count: (from: number, to: number, predicate: Function) => number; |
||||
inverse: (from: number, to: number, predicate: Function) => number; |
||||
firstKey: (obj: object) => string; |
||||
lastKey: (obj: object) => string; |
||||
firstObject: (obj: object) => any; |
||||
lastObject: (obj: object) => any; |
||||
concat: (obj1: any, obj2: any) => any; |
||||
backEach: (obj: any, predicate: Function, context?: any) => boolean; |
||||
backAny: (obj: any, predicate: Function, context?: any) => boolean; |
||||
backEvery: (obj: any, predicate: Function, context?: any) => boolean; |
||||
backFindKey: (obj: any, predicate: Function, context?: any) => string; |
||||
backFind: (obj: any, predicate: Function, context?: any) => any; |
||||
remove: (obj: any, predicate: any, context?: any) => void; |
||||
removeAt: (obj: any, index: number | number[]) => void; |
||||
string2Array: (str: string) => string[]; |
||||
array2String: (array: any[]) => string; |
||||
abc2Int: (str: string) => number; |
||||
int2Abc: (num: number) => string; |
||||
first: <T>(array: T[], callback?: Function | object | number | string, thisArg?: any) => T; |
||||
initial: <T>(array: T[], callback?: Function | object | number | string, thisArg?: any) => T[]; |
||||
last: <T>(array: T[], callback?: Function | object | number | string, thisArg?: any) => T; |
||||
rest: <T>(array: T[], callback?: Function | object | number | string, thisArg?: any) => T[]; |
||||
compact: (array: any[]) => any[]; |
||||
flatten: (array: any[], isShallow?: boolean, callback?: Function | object | string, thisArg?: any) => any[]; |
||||
without: (array: any[], value?: any) => any[]; |
||||
union: (...array: any[]) => any[]; |
||||
intersection: (...array: any[]) => any[]; |
||||
difference: (...array: any[]) => any[]; |
||||
zip: (...array: any[]) => any[]; |
||||
unzip: (...array: any[]) => any[]; |
||||
object: (keys: string[], values?: any[]) => any[]; |
||||
indexOf: (array: any[], value: any, fromIndex?: number) => number; |
||||
lastIndexOf: (array: any[], value: any, fromIndex?: number) => number; |
||||
sortedIndex: (array: any[], value: any, callback?: Function | object | string, thisArg?: any) => number; |
||||
range: (start: number, end: number, step: number) => number[]; |
||||
take: <T>(array: T[], n: number) => T[]; |
||||
takeRight: <T>(array: T[], n: number) => T[]; |
||||
findIndex: (array: any[], value: any, callback?: Function | object | string, thisArg?: any) => number; |
||||
findLastIndex: (array: any[], value: any, callback?: Function | object | string, thisArg?: any) => number; |
||||
makeArray: <T>(length: number, value?: T) => number[] | T[]; |
||||
makeObject: (array: any[], value: any) => any; |
||||
makeArrayByArray: <T>(array: any[], value: T) => T[]; |
||||
uniq: <T>(array: T[], isSorted?: boolean, iteratee?: any, context?: any) => T[]; |
||||
keys: (object: object) => string[]; |
||||
allKeys: (object: object) => string[]; |
||||
values: (object: object) => any[]; |
||||
pairs: (object: object) => any[]; |
||||
invert: (object: object, multiValue: boolean) => object; |
||||
create: (prototype: object, properties?: object) => object; |
||||
functions: (object: object) => string[]; |
||||
extend: (object: object, ...sources: any[]) => object; |
||||
defaults: (object: object, ...sources: any[]) => object; |
||||
clone: <T>(object: T) => T; |
||||
property: (path: any[] | string) => Function; |
||||
propertyOf: (object: object) => Function; |
||||
isEqual: (value: any, other: any, customizer?: Function, thisArg?: any) => boolean; |
||||
isMatch: (object: object, source: object, customizer?: Function, thisArg?: any) => boolean; |
||||
isEmpty: (value: any[] | object | string | null | undefined | number) => boolean; |
||||
isElement: (value: any) => boolean; |
||||
isNumber: (value: any) => value is number; |
||||
isString: (value: any) => value is string; |
||||
isArray: <T>(value: T[] | any) => value is T[]; |
||||
isObject: (value: any) => value is object; |
||||
isPlainObject: (value: any) => value is object; |
||||
isArguments: (value: any) => boolean; |
||||
isFunction: (value: any) => value is Function; |
||||
isFinite: (value: any) => value is number; |
||||
isBoolean: (value: any) => value is boolean; |
||||
isDate: (value: any) => value is Date; |
||||
isRegExp: (value: any) => value is RegExp; |
||||
isError: (value: any) => value is Error; |
||||
isNaN: (value: any) => value is number; |
||||
isUndefined: (value: any) => value is undefined; |
||||
zipObject: (props: any[], values?: any[]) => object; |
||||
cloneDeep: (value: any, customizer?: Function, thisArg?: any) => any; |
||||
findKey: (object: object, predicate?: Function | object | string, thisArg?: any) => any; |
||||
pick: (object: object, predicate?: Function | string | string[], thisArg?: any) => object; |
||||
omit: (object: object, predicate?: Function | string | string[], thisArg?: any) => object; |
||||
tap: (value: any, interceptor: Function, thisArg?: any) => any; |
||||
inherit: (sb: any, sp: any, overrides?: any) => any; |
||||
init: () => void; |
||||
has: (obj: object, keys: string | string[]) => boolean; |
||||
freeze: <T>(value: T) => T; |
||||
isKey: (key: any) => key is (number | string); |
||||
isCapitalEqual: (a: string | null | undefined, b: string | null | undefined) => boolean; |
||||
isWidthOrHeight: (w: number | string) => boolean; |
||||
isNotNull: <T>(obj: T) => obj is NonNullable<T>; |
||||
isNull: (obj: any) => obj is (undefined | null); |
||||
isEmptyArray: <T, U>(arr: T[] | U) => arr is T[] & { |
||||
length: 0; |
||||
}; |
||||
isNotEmptyArray: <T, U>(arr: T[] | U) => arr is [T, ...T[]]; |
||||
isEmptyObject: (obj: any) => obj is object; |
||||
isNotEmptyObject: (obj: any) => obj is object; |
||||
isWindow: (obj: any) => obj is Window; |
||||
isDeepMatch: (object: any, attrs: any) => boolean; |
||||
contains: (obj: any[], target: any, fromIndex?: number) => number; |
||||
deepContains: (obj: any[], copy: any) => number; |
||||
deepIndexOf: (obj: any[], target: any) => number; |
||||
deepRemove: (obj: any[], target: any) => boolean; |
||||
deepWithout: (obj: any[], target: any) => any[]; |
||||
deepUnique: (array: any[]) => any[]; |
||||
deepDiff: (object: any, other: any) => string[]; |
||||
uniqueId: (prefix?: string) => string; |
||||
result: (object: any, key: string) => any; |
||||
chain: (value: any) => any; |
||||
iteratee: (func?: Function, thisArg?: any) => Function; |
||||
unescape: (str?: string) => string; |
||||
bind: (func: Function, thisArg: any, ...partials: any) => Function; |
||||
once: (func: Function) => Function; |
||||
partial: (func: Function, ...partials: any) => Function; |
||||
debounce: (func: Function, wait?: number, options?: any) => Function; |
||||
throttle: (func: Function, wait?: number, options?: any) => Function; |
||||
delay: (func: Function, wait: number, ...args: any) => number; |
||||
defer: (func: Function, ...args: any) => number; |
||||
wrap: (value: any, wrapper: Function) => Function; |
||||
nextTick: (func: Function) => Promise<any>; |
||||
random: (min?: number, max?: number, floating?: boolean) => number; |
||||
parseInt: (s: string | number) => number; |
||||
parseSafeInt: (s: string) => number; |
||||
parseFloat: (string: string) => number; |
||||
isNaturalNumber: (value: string | number) => boolean; |
||||
isPositiveInteger: (value: string | number) => boolean; |
||||
isNegativeInteger: (value: string | number) => boolean; |
||||
isInteger: (value: string | number) => boolean; |
||||
isNumeric: (value: string | number) => boolean; |
||||
isFloat: (value: string | number) => boolean; |
||||
isOdd: (value: string | number) => boolean; |
||||
isEven: (value: string | number) => boolean; |
||||
sum: (array: any[], iteratee: Function, context: any) => number; |
||||
average: (array: any[], iteratee: Function, context: any) => number; |
||||
trim: (string?: string, chars?: string) => string; |
||||
toUpperCase: (string: string) => string; |
||||
toLowerCase: (string: string) => string; |
||||
isEndWithBlank: (string: string) => boolean; |
||||
isLiteral: (string: string) => boolean; |
||||
stripQuotes: (string: string) => string; |
||||
camelize: (string: string) => string; |
||||
hyphenate: (string: string) => string; |
||||
isNotEmptyString: (string: string) => boolean; |
||||
isEmptyString: (str: any) => str is ""; |
||||
encrypt: (type: string, text: string, key: string) => string; |
||||
escape: (string: string) => string; |
||||
leftPad: (val: string, size: number, ch: string) => string; |
||||
format: (format: string, ...str: string[]) => string; |
||||
isLeapYear: (year: number) => boolean; |
||||
checkDateVoid: (YY: string | number, MM: string | number, DD: string | number, minDate: string, maxDate: string) => (number | string)[]; |
||||
checkDateLegal: (str: string) => boolean; |
||||
parseDateTime: (str: string, fmt: string) => Date; |
||||
getDate: (...args: (number | string)[]) => Date; |
||||
getTime: (...args: any[]) => number; |
||||
} |
@ -0,0 +1,7 @@
|
||||
import { _OB } from "../ob"; |
||||
export interface _Behavior extends _OB { |
||||
doBehavior(items: any[]): void; |
||||
} |
||||
export interface _BehaviorFactory { |
||||
createBehavior(key: string, options: any): _Behavior; |
||||
} |
@ -0,0 +1,3 @@
|
||||
import { _Behavior } from "./behavior"; |
||||
export interface _HighlightBehavior extends _Behavior { |
||||
} |
@ -0,0 +1,3 @@
|
||||
import { _Behavior } from "./behavior"; |
||||
export interface _RedMarkBehavior extends _Behavior { |
||||
} |
@ -0,0 +1,64 @@
|
||||
export declare type Constructor<T> = new (...args: any[]) => T; |
||||
/** |
||||
* 注册widget |
||||
*/ |
||||
export declare function shortcut(): <U>(Target: Constructor<U> & { |
||||
xtype: string; |
||||
}) => void; |
||||
/** |
||||
* 注册model |
||||
*/ |
||||
export declare function model(): <U extends (new (...args: any[]) => {}) & { |
||||
xtype: string; |
||||
context?: readonly string[] | undefined; |
||||
}>(Target: U) => void; |
||||
/** |
||||
* 类注册_store属性 |
||||
* @param Model model类 |
||||
* @param opts 额外条件 |
||||
*/ |
||||
export declare function store<T>(Model: Constructor<T> & { |
||||
xtype: string; |
||||
}, opts?: { |
||||
props?(this: unknown): { |
||||
[key: string]: unknown; |
||||
}; |
||||
}): <U extends new (...args: any[]) => {}>(constructor: U) => { |
||||
new (...args: any[]): { |
||||
_store(): any; |
||||
}; |
||||
} & U; |
||||
/** |
||||
* Model基类 |
||||
*/ |
||||
export declare class Model<U extends { |
||||
types?: { |
||||
[key: string]: unknown; |
||||
} | {}; |
||||
context?: ReadonlyArray<string>; |
||||
} = {}> extends Fix.Model { |
||||
model: Pick<{ |
||||
[key in keyof U["types"]]: U["types"][key]; |
||||
}, U["context"][number]> & { |
||||
[key in keyof ReturnType<this["state"]>]: ReturnType<this["state"]>[key]; |
||||
} & { |
||||
[key in keyof this["computed"]]: ReturnType<this["computed"][key]>; |
||||
}; |
||||
store: this["actions"]; |
||||
state(): { |
||||
[key: string]: unknown; |
||||
} | {}; |
||||
context: U["context"]; |
||||
actions: { |
||||
[key: string]: (...args: any[]) => any; |
||||
}; |
||||
childContext: ReadonlyArray<keyof (this["computed"] & ReturnType<this["state"]>)>; |
||||
TYPE: Pick<{ |
||||
[key in keyof this["computed"]]: ReturnType<this["computed"][key]>; |
||||
} & { |
||||
[key in keyof ReturnType<this["state"]>]: ReturnType<this["state"]>[key]; |
||||
}, this["childContext"][number]>; |
||||
computed: { |
||||
[key: string]: () => unknown; |
||||
} | {}; |
||||
} |
@ -0,0 +1,9 @@
|
||||
export declare type _pushArray = (sArray: any[], array: any[]) => void; |
||||
export declare type _pushDistinct = (sArray: any[], obj: any) => void; |
||||
export declare type _pushDistinctArray = (sArray: any[], array: any[]) => void; |
||||
declare type _array = { |
||||
pushArray: _pushArray; |
||||
pushDistinct: _pushDistinct; |
||||
pushDistinctArray: _pushDistinctArray; |
||||
}; |
||||
export default _array; |
@ -0,0 +1,92 @@
|
||||
export declare type _Date = { |
||||
SECOND: number; |
||||
MINUTE: number; |
||||
HOUR: number; |
||||
DAY: number; |
||||
WEEK: number; |
||||
_DN: string[]; |
||||
_SDN: string[]; |
||||
_FD: number; |
||||
_MN: string[]; |
||||
_SMN: number[]; |
||||
_QN: string[]; |
||||
_MD: number[]; |
||||
_OFFSET: number[]; |
||||
}; |
||||
/** |
||||
* 获取时区 |
||||
*/ |
||||
export declare type _getTimezone = (date: Date) => string; |
||||
/** |
||||
* 获取指定月共有多少天 |
||||
*/ |
||||
export declare type _getMonthDays = (date: Date, month: number) => string; |
||||
/** |
||||
* 获取指定月的最后一天 |
||||
*/ |
||||
export declare type _getLastDateOfMonth = (data: Date) => Date; |
||||
/** |
||||
* 获取指定时间距离当年已经过了多少天 |
||||
*/ |
||||
export declare type _getDayOfYear = (data: Date) => number; |
||||
/** |
||||
* 获取指定时间距离当年已经过了多少周 |
||||
*/ |
||||
export declare type _getWeekNumber = (data: Date) => number; |
||||
/** |
||||
* 获取指定时间的所处季度 |
||||
*/ |
||||
export declare type _getQuarter = (date: Date) => number; |
||||
/** |
||||
* 离当前时间多少天的时间 |
||||
*/ |
||||
export declare type _getOffsetDate = (date: Date, offset: number) => Date; |
||||
/** |
||||
* 离当前时间多少天季度的时间 |
||||
*/ |
||||
export declare type _getOffsetQuarter = (date: Date, n: number) => Date; |
||||
/** |
||||
* 得到本季度的起始月份 |
||||
*/ |
||||
export declare type _getQuarterStartMonth = (date: Date) => number; |
||||
/** |
||||
* 获得本季度的起始日期 |
||||
*/ |
||||
export declare type _getQuarterStartDate = (date: Date) => number; |
||||
/** |
||||
* 获取本季度的其实日期 |
||||
*/ |
||||
export declare type _getQuarterEndDate = (date: Date) => number; |
||||
/** |
||||
* 指定日期n个月之前或之后的日期 |
||||
*/ |
||||
export declare type _getOffsetMonth = (date: Date, n: number) => Date; |
||||
/** |
||||
* 获取本周的起始日期 |
||||
*/ |
||||
export declare type _getWeekStartDate = (date: Date) => Date; |
||||
/** |
||||
* 获取本周的结束日期 |
||||
*/ |
||||
export declare type _getWeekEndDate = (date: Date) => Date; |
||||
/** |
||||
* 格式化打印日期 |
||||
*/ |
||||
export declare type _print = (date: Date, str: string) => string; |
||||
export declare type _date = { |
||||
getTimezone: _getTimezone; |
||||
getMonthDays: _getMonthDays; |
||||
getLastDateOfMonth: _getLastDateOfMonth; |
||||
getDayOfYear: _getDayOfYear; |
||||
getWeekNumber: _getWeekNumber; |
||||
getQuarter: _getQuarter; |
||||
getOffsetDate: _getOffsetDate; |
||||
getOffsetQuarter: _getOffsetQuarter; |
||||
getQuarterStartMonth: _getQuarterStartMonth; |
||||
getQuarterStartDate: _getQuarterStartDate; |
||||
getQuarterEndDate: _getQuarterEndDate; |
||||
getOffsetMonth: _getOffsetMonth; |
||||
getWeekStartDate: _getWeekStartDate; |
||||
getWeekEndDate: _getWeekEndDate; |
||||
print: _print; |
||||
}; |
@ -0,0 +1,36 @@
|
||||
/** |
||||
* 创建唯一的名字 |
||||
* @param array 已有的名字集合 |
||||
* @param name 待生成的名字 |
||||
* @return 生成后的名字 |
||||
*/ |
||||
export declare type _createDistinctName = (array: any[], name: string) => string; |
||||
/** |
||||
* 获取搜索结果 |
||||
* @param items 待搜索的数据 |
||||
* @param keyword 关键字 |
||||
* @param param 搜索哪个属性 |
||||
*/ |
||||
export declare type _getSearchResult = (items: any, keyword: any, param: string) => { |
||||
find: any; |
||||
match: any; |
||||
}; |
||||
/** |
||||
* 在方法A执行之前执行方法B |
||||
* @param sFunc 方法A |
||||
* @param func 方法B |
||||
*/ |
||||
export declare type _beforeFunc = (sFunc: Function, func: Function) => Function; |
||||
/** |
||||
* 在方法A执行之后执行方法B |
||||
* @param sFunc 方法A |
||||
* @param func 方法B |
||||
*/ |
||||
export declare type _afterFunc = (sFunc: Function, func: Function) => Function; |
||||
declare type _function = { |
||||
createDistinctName: _createDistinctName; |
||||
getSearchResult: _getSearchResult; |
||||
beforeFunc: _beforeFunc; |
||||
afterFunc: _afterFunc; |
||||
}; |
||||
export default _function; |
@ -0,0 +1,8 @@
|
||||
import _array from "./array"; |
||||
import _string from "./string"; |
||||
import _number from "./number"; |
||||
import _function from "./function"; |
||||
import { _Date } from "./date"; |
||||
export interface _func extends _array, _string, _number, _function { |
||||
Date: _Date; |
||||
} |
@ -0,0 +1,35 @@
|
||||
/** |
||||
* 加法函数,用来得到精确的加法结果 |
||||
* @param {Number} num 被加数 |
||||
* @param {Number} arg 加数 |
||||
* @return {Number} 两个数字相加后的结果 |
||||
*/ |
||||
export declare type _add = (num: number, arg: number) => number; |
||||
/** |
||||
* 减法函数,用来得到精确的减法结果 |
||||
* @param {Number} num 被减数 |
||||
* @param {Number} arg 减数 |
||||
* @return {Number} 两个数字相减后的结果 |
||||
*/ |
||||
export declare type _sub = (num: number, arg: number) => number; |
||||
/** |
||||
* 乘法函数,用来得到精确的乘法结果 |
||||
* @param {Number} num 被乘数 |
||||
* @param {Number} arg 乘数 |
||||
* @return {Number} 两个数字相乘后的结果 |
||||
*/ |
||||
export declare type _mul = (num: number, arg: number) => number; |
||||
/** |
||||
* 除法函数,用来得到精确的除法结果 |
||||
* @param {Number} num 被除数 |
||||
* @param {Number} arg 除数 |
||||
* @return {Number} 两个数字相除后的结果 |
||||
*/ |
||||
export declare type _div = (num: number, arg: number) => number; |
||||
declare type _number = { |
||||
add: _add; |
||||
sub: _sub; |
||||
mul: _mul; |
||||
div: _div; |
||||
}; |
||||
export default _number; |
@ -0,0 +1,62 @@
|
||||
/** |
||||
* 判断字符串是否已指定的字符串开始 |
||||
* @param str source字符串 |
||||
* @param {String} startTag 指定的开始字符串 |
||||
* @return {Boolean} 如果字符串以指定字符串开始则返回true,否则返回false |
||||
*/ |
||||
export declare type _startWith = (str: string, startTag: string) => boolean; |
||||
/** |
||||
* 判断字符串是否以指定的字符串结束 |
||||
* @param str source字符串 |
||||
* @param {String} endTag 指定的字符串 |
||||
* @return {Boolean} 如果字符串以指定字符串结束则返回true,否则返回false |
||||
*/ |
||||
export declare type _endWith = (str: string, endTag: string) => boolean; |
||||
/** |
||||
* 获取url中指定名字的参数 |
||||
* @param str source字符串 |
||||
* @param {String} name 参数的名字 |
||||
* @return {String} 参数的值 |
||||
*/ |
||||
export declare type _getQuery = (str: string, name: string) => string | null; |
||||
/** |
||||
* 给url加上给定的参数 |
||||
* @param str source字符串 |
||||
* @param {Object} paras 参数对象,是一个键值对对象 |
||||
* @return {String} 添加了给定参数的url |
||||
*/ |
||||
export declare type _appendQuery = (str: string, paras: { |
||||
[key: string]: string | number; |
||||
}) => string; |
||||
/** |
||||
* 将所有符合第一个字符串所表示的字符串替换成为第二个字符串 |
||||
* @param str source字符串 |
||||
* @param {String} s1 要替换的字符串的正则表达式 |
||||
* @param {String} s2 替换的结果字符串 |
||||
* @returns {String} 替换后的字符串 |
||||
*/ |
||||
export declare type _replaceAll = (str: string, s1: string, s2: string) => string; |
||||
/** |
||||
* 总是让字符串以指定的字符开头 |
||||
* @param str source字符串 |
||||
* @param {String} start 指定的字符 |
||||
* @returns {String} 以指定字符开头的字符串 |
||||
*/ |
||||
export declare type _perfectStart = (str: string, start: string) => string; |
||||
/** |
||||
* 获取字符串中某字符串的所有项位置数组 |
||||
* @param str source字符串 |
||||
* @param {String} sub 子字符串 |
||||
* @return {Number[]} 子字符串在父字符串中出现的所有位置组成的数组 |
||||
*/ |
||||
export declare type _allIndexOf = (str: string, sub: string) => number[]; |
||||
declare type _string = { |
||||
startWith: _startWith; |
||||
endWith: _endWith; |
||||
getQuery: _getQuery; |
||||
appendQuery: _appendQuery; |
||||
replaceAll: _replaceAll; |
||||
perfectStart: _perfectStart; |
||||
allIndexOf: _allIndexOf; |
||||
}; |
||||
export default _string; |
@ -0,0 +1,6 @@
|
||||
export declare type _addI18n = (v: string | object) => string; |
||||
export declare type _i18nText = (key: string, ..._args: any[]) => string; |
||||
export declare type _i18n = { |
||||
addI18n: _addI18n; |
||||
i18nText: _i18nText; |
||||
}; |
@ -0,0 +1,35 @@
|
||||
export interface _OB { |
||||
props: Props | (<T>(config: T) => Props & T); |
||||
options: this["props"]; |
||||
events?: { |
||||
[eventName: string]: Function[]; |
||||
}; |
||||
init?(): void; |
||||
destroyed?(): void; |
||||
_defaultConfig(..._args: any[]): { |
||||
[key: string]: any; |
||||
} | {}; |
||||
_init(): void; |
||||
_initListeners(): void; |
||||
_getEvents(): { |
||||
[eventName: string]: Function[]; |
||||
}; |
||||
on(eventName: string, fn: Function): void; |
||||
once(eventName: string, fn: Function): void; |
||||
un(eName: string, fn: Function): void; |
||||
_initRef(): void; |
||||
_purgeRef(): void; |
||||
purgeListeners(): void; |
||||
fireEvent(eName: string, ...args: any[]): boolean | null; |
||||
destroy(): void; |
||||
} |
||||
interface Props { |
||||
listeners?: { |
||||
eventName: string; |
||||
action: (...args: any[]) => any; |
||||
target?: _OB; |
||||
once?: boolean; |
||||
}[]; |
||||
[key: string]: any; |
||||
} |
||||
export {}; |
@ -0,0 +1,323 @@
|
||||
import { _OB } from "./ob"; |
||||
export interface _WidgetStatic { |
||||
/** |
||||
* 注册渲染引擎 |
||||
* @param engine 引擎 |
||||
*/ |
||||
registerRenderEngine(engine: RenderEngine): void; |
||||
} |
||||
export interface _Widget extends _OB { |
||||
/** |
||||
* 出现loading的锁 |
||||
*/ |
||||
__asking: boolean; |
||||
/** |
||||
* 同步锁 |
||||
*/ |
||||
__async: boolean; |
||||
/** |
||||
* widget类标识符 |
||||
*/ |
||||
widgetName: string | null; |
||||
/** |
||||
* 是否为根节点 |
||||
*/ |
||||
_isRoot: boolean; |
||||
/** |
||||
* 父节点 |
||||
*/ |
||||
_parent: _Widget | null; |
||||
/** |
||||
* 真实dom的类jQuery对象 |
||||
*/ |
||||
element: any; |
||||
/** |
||||
* 子元素 |
||||
*/ |
||||
_children: { |
||||
[key: string]: _Widget; |
||||
}; |
||||
/** |
||||
* 是否已挂载 |
||||
*/ |
||||
_isMounted: boolean; |
||||
/** |
||||
* 手动设置enable |
||||
*/ |
||||
_manualSetEnable: boolean; |
||||
/** |
||||
* 手动设置valid |
||||
*/ |
||||
_manualSetValid: boolean; |
||||
/** |
||||
* 渲染引擎 |
||||
*/ |
||||
_renderEngine: RenderEngine; |
||||
_store(): void; |
||||
/** |
||||
* 初始化前 |
||||
*/ |
||||
beforeInit?(cb: Function): void; |
||||
/** |
||||
* 创建前 |
||||
*/ |
||||
beforeCreate?(): void; |
||||
/** |
||||
* 创建 |
||||
*/ |
||||
created?(): void; |
||||
/** |
||||
* 渲染 |
||||
*/ |
||||
render?(): any; |
||||
/** |
||||
* 挂载前 |
||||
*/ |
||||
beforeMount?(): void; |
||||
/** |
||||
* 挂载 |
||||
*/ |
||||
mounted?(): void; |
||||
/** |
||||
* 更新前 |
||||
*/ |
||||
shouldUpdate?(): void; |
||||
/** |
||||
* 更新 |
||||
*/ |
||||
update?(...args: any[]): void; |
||||
/** |
||||
* 销毁前 |
||||
*/ |
||||
beforeDestroy?(): void; |
||||
/** |
||||
* 销毁 |
||||
*/ |
||||
destroyed?(): void; |
||||
/** |
||||
* 初始化render函数 |
||||
*/ |
||||
_initRender: () => void; |
||||
/** |
||||
* 内部主render函数 |
||||
*/ |
||||
_render: () => void; |
||||
/** |
||||
* 初始化根节点 |
||||
*/ |
||||
_initRoot: () => void; |
||||
/** |
||||
* 初始化元素宽度 |
||||
*/ |
||||
_initElementWidth: () => void; |
||||
/** |
||||
* 初始化元素高度 |
||||
*/ |
||||
_initElementHeight: () => void; |
||||
/** |
||||
* 初始化元素可见 |
||||
*/ |
||||
_initVisual: () => void; |
||||
/** |
||||
* 初始化元素可用不可用 |
||||
*/ |
||||
_initEffects: () => void; |
||||
/** |
||||
* 设置mounted锁 |
||||
*/ |
||||
_initState: () => void; |
||||
/** |
||||
* 生成真实dom |
||||
*/ |
||||
_initElement: () => void; |
||||
/** |
||||
* 设置父节点 |
||||
*/ |
||||
_setParent: () => void; |
||||
/** |
||||
* @param force 是否强制挂载子节点 |
||||
* @param deep 子节点是否也是按照当前force处理 |
||||
* @param lifeHook 生命周期钩子触不触发,默认触发 |
||||
* @param predicate 递归每个widget的回调 |
||||
*/ |
||||
_mount(force?: boolean, deep?: boolean, lifeHook?: boolean, predicate?: Function): boolean; |
||||
/** |
||||
* 挂载子节点 |
||||
*/ |
||||
_mountChildren?(): void; |
||||
/** |
||||
* 是否已挂载 |
||||
*/ |
||||
isMounted(): boolean; |
||||
/** |
||||
* 设置宽度 |
||||
*/ |
||||
setWidth(w: number): void; |
||||
/** |
||||
* 设置高度 |
||||
*/ |
||||
setHeight(h: number): void; |
||||
/** |
||||
* 设置可用 |
||||
*/ |
||||
_setEnable(enable: boolean): void; |
||||
/** |
||||
* 设置合法 |
||||
*/ |
||||
_setValid(valid: boolean): void; |
||||
/** |
||||
* 设置可见 |
||||
*/ |
||||
_setVisible(visible: boolean): void; |
||||
/** |
||||
* 设置是否可用 |
||||
*/ |
||||
setEnable(enable: boolean): void; |
||||
/** |
||||
* 设置是否可见 |
||||
*/ |
||||
setVisible(visible: boolean): void; |
||||
/** |
||||
* 设置是否合法 |
||||
*/ |
||||
setValid(valid: boolean): void; |
||||
/** |
||||
* 设置反馈效果 |
||||
* @param args arguments参数 |
||||
*/ |
||||
doBehavior(...args: any[]): void; |
||||
/** |
||||
* 获取宽度 |
||||
*/ |
||||
getWidth(): number; |
||||
/** |
||||
* 获取高度 |
||||
*/ |
||||
getHeight(): number; |
||||
/** |
||||
* 是否合法 |
||||
*/ |
||||
isValid(): boolean; |
||||
/** |
||||
* 新增子元素 |
||||
*/ |
||||
addWidget(_name: any, _widget: _Widget): _Widget; |
||||
/** |
||||
* 根据wigetname获取子元素实例 |
||||
*/ |
||||
getWidgetByName(_name: string): _Widget | undefined; |
||||
/** |
||||
* 移除子元素 |
||||
* @param nameOrWidget widgetName或widget实例 |
||||
*/ |
||||
removeWidget(nameOrWidget: string | _Widget): void; |
||||
/** |
||||
* 是否有某个子元素 |
||||
*/ |
||||
hasWidget(name: string): boolean; |
||||
/** |
||||
* 获取widgetName |
||||
*/ |
||||
getName(): string; |
||||
/** |
||||
* 设置tag |
||||
* @param tag html tag |
||||
*/ |
||||
setTag(tag: string): void; |
||||
/** |
||||
* 获取tag |
||||
*/ |
||||
getTag(): string; |
||||
/** |
||||
* 设置属性 |
||||
* @param key 键 |
||||
* @param value 值 |
||||
*/ |
||||
attr(key: string | { |
||||
[key: string]: any; |
||||
}, value?: any): any; |
||||
/** |
||||
* 获取text |
||||
*/ |
||||
getText(): string; |
||||
/** |
||||
* 设置text |
||||
*/ |
||||
setText(text: string): void; |
||||
/** |
||||
* 获取值 |
||||
*/ |
||||
getValue(): any; |
||||
/** |
||||
* 设置值 |
||||
*/ |
||||
setValue(...args: any[]): void; |
||||
/** |
||||
* 获取是否enable |
||||
*/ |
||||
isEnabled(): boolean; |
||||
/** |
||||
* 是否可见 |
||||
*/ |
||||
isVisible(): boolean; |
||||
/** |
||||
* disable元素 |
||||
*/ |
||||
disable(): void; |
||||
/** |
||||
* enable元素 |
||||
*/ |
||||
enable(): void; |
||||
/** |
||||
* 是widget合法 |
||||
*/ |
||||
valid(): void; |
||||
/** |
||||
* 使元素不合法 |
||||
*/ |
||||
invalid(): void; |
||||
/** |
||||
* 使不可见 |
||||
*/ |
||||
invisible(..._args: any[]): void; |
||||
/** |
||||
* 可见 |
||||
*/ |
||||
visible(..._args: any[]): void; |
||||
/** |
||||
* 清除子元素 |
||||
*/ |
||||
__d(): void; |
||||
/** |
||||
* 取消挂载 |
||||
*/ |
||||
_unMount(): void; |
||||
/** |
||||
* hang元素 |
||||
*/ |
||||
isolate(): void; |
||||
/** |
||||
* 请除元素 |
||||
*/ |
||||
empty(): void; |
||||
/** |
||||
* 内部destory方法 |
||||
*/ |
||||
_destroy(): void; |
||||
/** |
||||
* destory元素 |
||||
*/ |
||||
destroy(): void; |
||||
} |
||||
interface RenderEngine { |
||||
/** |
||||
* 创建元素方法,返回的类jQuery对象 |
||||
* @param widget widget对象 |
||||
*/ |
||||
createElement: (widget: any) => any; |
||||
/** |
||||
* 创建DocumentFragment对象 |
||||
*/ |
||||
createFragment: () => DocumentFragment; |
||||
} |
||||
export {}; |
@ -0,0 +1,42 @@
|
||||
import * as decorator from "./core/decorator/decorator"; |
||||
import { _i18n } from "./core/i18n"; |
||||
import { _OB } from "./core/ob"; |
||||
import { _func } from "./core/func"; |
||||
import { _Widget, _WidgetStatic } from "./core/widget"; |
||||
import { _Single } from "./base/single/single"; |
||||
import { _base } from "./core/base"; |
||||
import { _BasicButton } from "./base/single/button/button.basic"; |
||||
import { _Trigger } from "./base/single/trigger/trigger"; |
||||
import { _Action, _ActionFactory } from "./core/action/action"; |
||||
import { _ShowAction } from "./core/action/action.show"; |
||||
import { _Behavior, _BehaviorFactory } from "./core/behavior/behavior"; |
||||
import { _HighlightBehavior } from "./core/behavior/behavior.highlight"; |
||||
import { _RedMarkBehavior } from "./core/behavior/behavior.redmark"; |
||||
import { _Pane, _PaneStatic } from "./base/pane"; |
||||
import { _LoadingPane } from "./case/loading/loading_pane"; |
||||
declare type ClassConstructor<T extends {}> = T & { |
||||
new (config: any): T; |
||||
(config: any): T; |
||||
readonly prototype: T; |
||||
}; |
||||
export interface BI extends _func, _i18n, _base { |
||||
OB: ClassConstructor<_OB>; |
||||
Widget: ClassConstructor<_Widget> & _WidgetStatic; |
||||
Single: ClassConstructor<_Single>; |
||||
BasicButton: ClassConstructor<_BasicButton>; |
||||
Trigger: ClassConstructor<_Trigger>; |
||||
Action: ClassConstructor<_Action>; |
||||
ActionFactory: ClassConstructor<_ActionFactory>; |
||||
ShowAction: ClassConstructor<_ShowAction>; |
||||
Behavior: ClassConstructor<_Behavior>; |
||||
BehaviorFactory: ClassConstructor<_BehaviorFactory>; |
||||
HighlightBehavior: ClassConstructor<_HighlightBehavior>; |
||||
RedMarkBehavior: ClassConstructor<_RedMarkBehavior>; |
||||
Pane: ClassConstructor<_Pane> & _PaneStatic; |
||||
LoadingPane: ClassConstructor<_LoadingPane>; |
||||
Decorators: typeof decorator; |
||||
} |
||||
declare const _default: { |
||||
Decorators: typeof decorator; |
||||
}; |
||||
export default _default; |
Loading…
Reference in new issue