UNPKG

@chief-editor/flow

Version:

Old核心数据流

1 lines 586 B
import{BindType}from"@chief-editor/base";import{wrapFunction,wrapInterpolation,wrapWatcher}from"../util/wrap";export function bindDatasourceLoader(a,r){var t=r,n=t.data,e=t.defaultValue,i=t.func,o=t.bindType,u=t.bindJs,c=t.bindKey,l=wrapInterpolation(o===BindType.VAR?c:u,a.brick),p=l.watchers,d=l.func,f=wrapFunction(d,a.brick),w=null!=i?a.getHook(i):null,b={watcher:wrapWatcher(p,a.brick),loadStaticDatasource:function(){return n},loadDynamicDatasource:function(a){return f(a)}};return null!=e&&(b.loadStaticDefaultValue=function(){return e}),null!=w&&(b.loadDynamicDefaultValue=w),b}