@chief-editor/flow
Version:
Old核心数据流
1 lines • 1.53 kB
JavaScript
var __extends=this&&this.__extends||function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function o(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(o.prototype=r.prototype,new o)}}();import{BaseTemplate}from"@chief-editor/base";import{getAbsoluteKey}from"../util/keys";import{FlowScheduler}from"./FlowScheduler";import{FlowBrick}from"./FlowBrick";import{FlowBoard}from"./FlowBoard";var FlowTemplate=function(e){function t(t,r){var o=e.call(this)||this;return o.model=t,o.overrideSchedulerOptions=r.overrideSchedulerOptions||{},t.registerTemplate(o.id,o),o.node.appendChild(o.createBoard(r.board)),Object.keys(o.brickMap).forEach((function(e){var t=o.brickMap[e];t.ready||o.getOwnerModel().getWatcher().pendingKey(getAbsoluteKey(t))})),o}return __extends(t,e),t.prototype.getOwnerModel=function(){return this.model},t.prototype.getOwnerContext=function(){return this.model.getOwnerContext()},t.prototype.dispose=function(){e.prototype.dispose.call(this),this.model.unregisterTemplate(this.id)},t.prototype.innerCreateBoard=function(e){return new FlowBoard(this,e)},t.prototype.innerCreateBrick=function(e,t){var r=new FlowScheduler({brickConfig:this.getOwnerContext().getBrickConfig(e.type),model:this.model});return Object.assign(r,this.overrideSchedulerOptions),new FlowBrick(t,{owner:this,scheduler:r,data:e})},t}(BaseTemplate);export{FlowTemplate};