Browse Source

refactor: 调整引用形式

master
alan 5 years ago
parent
commit
88806f8144
  1. 7
      typescript/core/func/array.ts
  2. 108
      typescript/core/func/date.ts
  3. 8
      typescript/core/func/function.ts
  4. 10
      typescript/core/func/index.ts
  5. 8
      typescript/core/func/number.ts
  6. 11
      typescript/core/func/string.ts
  7. 5
      typescript/core/i18n.ts
  8. 42
      typescript/index.ts

7
typescript/core/func/array.ts

@ -3,3 +3,10 @@ export declare type _pushArray = (sArray: any[], array: any[]) => void;
export declare type _pushDistinct = (sArray: any[], obj: any) => void; export declare type _pushDistinct = (sArray: any[], obj: any) => void;
export declare type _pushDistinctArray = (sArray: any[], array: any[]) => void; export declare type _pushDistinctArray = (sArray: any[], array: any[]) => void;
declare type _array = {
pushArray: _pushArray;
pushDistinct: _pushDistinct;
pushDistinctArray: _pushDistinctArray;
}
export default _array;

108
typescript/core/func/date.ts

@ -0,0 +1,108 @@
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;
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;
}
export default _date;

8
typescript/core/func/function.ts

@ -27,3 +27,11 @@ export declare type _beforeFunc = (sFunc: Function, func: Function) => Function;
* @param func B * @param func B
*/ */
export declare type _afterFunc = (sFunc: Function, func: Function) => Function; export declare type _afterFunc = (sFunc: Function, func: Function) => Function;
declare type _function = {
createDistinctName: _createDistinctName;
getSearchResult: _getSearchResult;
beforeFunc: _beforeFunc;
afterFunc: _afterFunc;
}
export default _function;

10
typescript/core/func/index.ts

@ -0,0 +1,10 @@
import _array from "./array";
import _string from "./string";
import _number from "./number";
import _function from "./function";
import _date, {_Date} from "./date";
interface _func extends _array, _string, _number, _function {
Date: _Date;
}
export default _func;

8
typescript/core/func/number.ts

@ -30,3 +30,11 @@ export declare type _mul = (num: number, arg: number) => number;
* @return {Number} * @return {Number}
*/ */
export declare type _div = (num: number, arg: number) => number; export declare type _div = (num: number, arg: number) => number;
declare type _number = {
add: _add;
sub: _sub;
mul: _mul;
div: _div;
}
export default _number

11
typescript/core/func/string.ts

@ -54,3 +54,14 @@ export declare type _perfectStart = (str: string, start: string) => string;
* @return {Number[]} * @return {Number[]}
*/ */
export declare type _allIndexOf = (str: string, sub: string) => 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

5
typescript/core/i18n.ts

@ -1,3 +1,8 @@
export declare type _addI18n = (v: string) => string; export declare type _addI18n = (v: string) => string;
export declare type _i18nText = (key: string) => string; export declare type _i18nText = (key: string) => string;
export declare type _i18n = {
addI18n: _addI18n;
i18nText: _i18nText;
}

42
typescript/index.ts

@ -1,40 +1,8 @@
import { _addI18n, _i18nText } from "./core/i18n"; import { _i18n } from "./core/i18n";
import { _OB } from "./core/ob"; import { _OB } from "./core/ob";
import { _pushArray, _pushDistinct, _pushDistinctArray} from "./core/func/array"; import _func from "./core/func";
import {_startWith, _allIndexOf, _appendQuery, _endWith, _getQuery, _perfectStart, _replaceAll} from "./core/func/string";
import {_add, _sub, _mul, _div} from "./core/func/number";
import {_afterFunc, _beforeFunc, _createDistinctName, _getSearchResult} from "./core/func/function";
export declare module BI { export interface BI extends _func {
namespace i18n { i18n: _i18n;
const addI18n: _addI18n; OB: _OB;
const i18nText: _i18nText;
}
const OB: _OB;
const pushArray: _pushArray;
const pushDistinct: _pushDistinct;
const pushDistinctArray: _pushDistinctArray;
const startWith: _startWith;
const endWith: _endWith;
const getQuery: _getQuery;
const appendQuery: _appendQuery;
const replaceAll: _replaceAll;
const perfectStart: _perfectStart;
const allIndexOf: _allIndexOf;
const add: _add;
const sub: _sub;
const mul: _mul;
const div: _div;
const afterFunc: _afterFunc;
const beforeFunc: _beforeFunc;
namespace Func {
const createDistinctName: _createDistinctName;
const getSearchResult: _getSearchResult;
}
} }
Loading…
Cancel
Save