concent-utils
Advanced tools
Comparing version 1.2.3 to 1.2.4
/** | ||
* concent 相关的一些公共封装函数 | ||
*/ | ||
import { IRefCtxM, ModuleDesc, ReducerCallerParams, IReducerFn, IActionCtxBase, ICtxBase, IAnyObj, SettingsType, ComputedValType, ComputedValTypeForFn, MultiComputedFn, MultiComputed } from 'concent'; | ||
import { StateType, IRefCtxM, ModuleDesc, ReducerCallerParams, IReducerFn, IActionCtxBase, ICtxBase, IAnyObj, SettingsType, ComputedValType, ComputedValTypeForFn, MultiComputedFn, MultiComputed } from 'concent'; | ||
/** | ||
@@ -13,42 +13,42 @@ * 调用目标函数,用于对接 reducer里的 ghost函数 | ||
export interface BaseOpts<P extends IAnyObj, Extra extends IAnyObj> { | ||
props?: P; | ||
extra?: Extra; | ||
/** | ||
* 是否透传 cuSpec 给 useConcent函数,默认为true, | ||
* 表示需要透传,此时用户不需要再setup函数体内调用 ctx.computed(cuSpec) | ||
* 如果用户设置passCuSpec为false,表示传入 cuSpec 仅为了方便推导出refComputed类型,但不透传 cuSpec 给 useConcent函数 | ||
* 注意此时用户需要在 setup函数体内调用 ctx.computed(cuSpec) 来完成示例计算函数的定义, | ||
* 否则 refComputed 里拿不到真正的计算结果 | ||
*/ | ||
passCuDesc?: boolean; | ||
/** | ||
* 用于辅助定位 ccc.refs 或者 cc.getRefs 具体ref | ||
*/ | ||
tag?: string; | ||
ccClassKey?: string; | ||
moduleName?: string; | ||
props?: P; | ||
extra?: Extra; | ||
/** | ||
* 是否透传 cuSpec 给 useConcent函数,默认为true, | ||
* 表示需要透传,此时用户不需要再setup函数体内调用 ctx.computed(cuSpec) | ||
* 如果用户设置passCuSpec为false,表示传入 cuSpec 仅为了方便推导出refComputed类型,但不透传 cuSpec 给 useConcent函数 | ||
* 注意此时用户需要在 setup函数体内调用 ctx.computed(cuSpec) 来完成示例计算函数的定义, | ||
* 否则 refComputed 里拿不到真正的计算结果 | ||
*/ | ||
passCuDesc?: boolean; | ||
/** | ||
* 用于辅助定位 ccc.refs 或者 cc.getRefs 具体ref | ||
*/ | ||
tag?: string; | ||
ccClassKey?: string; | ||
moduleName?: string; | ||
} | ||
export interface Opts<CuDesc extends MultiComputed<any>, P extends IAnyObj, Extra extends IAnyObj> extends BaseOpts<P, Extra> { | ||
/** | ||
* 对象型计算函数描述体 | ||
* const cuDesc = { | ||
* xxx:({num}:St)=><button>{num}</button>, | ||
* yyy:({bigNum}:St)=><button>{bigNum}</button>, | ||
* } | ||
*/ | ||
cuDesc?: CuDesc; | ||
/** | ||
* 对象型计算函数描述体 | ||
* const cuDesc = { | ||
* xxx:({num}:St)=><button>{num}</button>, | ||
* yyy:({bigNum}:St)=><button>{bigNum}</button>, | ||
* } | ||
*/ | ||
cuDesc?: CuDesc; | ||
} | ||
export interface CufOpts<CuDesc extends MultiComputedFn<any>, P extends IAnyObj, Extra extends IAnyObj> extends BaseOpts<P, Extra> { | ||
/** | ||
* 函数型计算函数描述体, 通常用于脱离了setup函数体内时,需要拿到渲染上下文句柄做一些其他事情 | ||
* 如获得 ctx.mr 去绑定onClick事件等 | ||
* | ||
* function cuDesc(ctx:CtxPre){ | ||
* const { mr } = ctx; | ||
* return { | ||
* xxx:({num}:St)=><button onClick={mr.add}>{num}</button> | ||
* } | ||
* } | ||
*/ | ||
cuDesc?: CuDesc; | ||
/** | ||
* 函数型计算函数描述体, 通常用于脱离了setup函数体内时,需要拿到渲染上下文句柄做一些其他事情 | ||
* 如获得 ctx.mr 去绑定onClick事件等 | ||
* | ||
* function cuDesc(ctx:CtxPre){ | ||
* const { mr } = ctx; | ||
* return { | ||
* xxx:({num}:St)=><button onClick={mr.add}>{num}</button> | ||
* } | ||
* } | ||
*/ | ||
cuDesc?: CuDesc; | ||
} | ||
@@ -62,3 +62,3 @@ export declare type ValidSetup = (ctx: ICtxBase) => IAnyObj | void; | ||
export declare function makeUseModelWithSetup<RootInfo, ModelDesc extends ModuleDesc>(moduleName: string): | ||
<Setup extends SetupParam, CuDesc extends MultiComputed<IAnyObj>, P extends IAnyObj, Extra extends IAnyObj> | ||
<Setup extends SetupParam, CuDesc extends MultiComputed<StateType<ModuleDesc['state']>>, P extends IAnyObj, Extra extends IAnyObj> | ||
(setup: Setup, opts?: Opts<CuDesc, P, Extra> | undefined) | ||
@@ -71,4 +71,4 @@ => IRefCtxM<RootInfo, P, ModelDesc, SettingsType<Setup>, ComputedValType<CuDesc>, Extra>; | ||
export declare function makeUseModelWithSetupCuf<RootInfo, ModelDesc extends ModuleDesc>(moduleName: string): | ||
<Setup extends SetupParam, CuDesc extends MultiComputedFn<IAnyObj>, P extends IAnyObj, Extra extends IAnyObj> | ||
<Setup extends SetupParam, CuDesc extends MultiComputedFn<StateType<ModuleDesc['state']>>, P extends IAnyObj, Extra extends IAnyObj> | ||
(setup: Setup, opts?: CufOpts<CuDesc, P, Extra> | undefined) | ||
=> IRefCtxM<RootInfo, P, ModelDesc, SettingsType<Setup>, ComputedValTypeForFn<CuDesc>, Extra>; |
@@ -65,3 +65,3 @@ { | ||
}, | ||
"version": "1.2.3" | ||
"version": "1.2.4" | ||
} |
## concent-utils | ||
For helping concent make common functions in ts project | ||
For helping concent make common functions in ts project | ||
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
21135
4