API - Task

数据结构

@typedef {Object} RootTaskInstance - 根任务模型实例
@prop {integer} uid - 唯一id,自动生成
@prop {RootTaskInstanceData} data - 根任务数据对象
@typedef {Object} RootTaskInstanceData
@prop {TimeRange[]} [exclusions = []] - 不计算为工期的例外时间数组
@prop {boolean} [excludeWeekends = true] - 周六、日是否为例外日期
@prop {TimeRange[]} [inclusions = []] - 0.2.0新增 计算为工期的周六、日时间数组
@prop {integer} [minDurationSeconds = 3600 * 24] - 任务最短周期秒数
@prop {integer} [maxHistorySize = Infinity] -0.2.0新增 redo栈/undo栈最大元素数量
@prop {Array} [actions = ['createTask', 'createMilestone', 'destroyDescendants',
'switchState']] - 0.2.0新增 可执行动作
@prop {integer} [finishToStartCompensatorySeconds = 0] - 0.2.6新增 前置任务结束时间
与后置任务开始时间的补偿差秒数
@prop {integer} [startToFinishCompensatorySeconds = 0] - 0.2.6新增 前置任务开始时间
与后置任务结束时间的补偿差秒数
@prop {integer} [startToStartCompensatorySeconds = 0] - 0.2.6新增 前置任务开始时间
与后置任务开始时间的补偿差秒数
@prop {integer} [finishToFinishCompensatorySeconds = 0] - 0.2.6新增 前置任务结束时间
与后之任务结束时间的补偿差秒数
@typedef {Object} TaskInstance - 任务模型实例
@prop {integer} uid - 唯一id,自动生成
@prop {TaskInstanceData} data - 任务数据对象
@typedef {Object} TaskInstanceData
@prop {string} [wbs] - 任务wbs编号,如不赋值,则在创建TaskInstance后根据父子级关系自动赋值
@prop {string} [name = 'New Task'] - 任务名称
@prop {string} [beginning = 'yyyy-mm-dd HH:MM:SS'] - 任务开始时间,如果具备父级任务,
默认为父级任务开始时间,否则为当前系统时间
@prop {string} [end = 'yyyy-mm-dd HH:MM:SS'] - 任务结束时间,如果具备父级任务,
默认为父级任务结束时间,否则为当前任务开始时间延后其根任务minDurationSeconds
@prop {Object} [data.dependencies = {}] - 任务依赖(前置任务)
@prop {string} [data.dependencies.finishToStart = ''] - 以,隔开wbs的f2s型依赖
@prop {string} [data.dependencies.startToStart = ''] - 以,隔开wbs的s2s型依赖
@prop {string} [data.dependencies.finishToFinish = ''] - 以,隔开wbs的f2f型依赖
@prop {string} [data.dependencies.startToFinish = ''] - 以,隔开wbs的s2f型依赖
@prop {string} [type = 'task'] - 0.2.0新增 任务类型
@prop {Array} [actions = [...]] - 0.2.0新增 任务可执行动作, 如果为task类型任务,默认动作
为['pick', 'update', 'createTask', 'createMilestone', 'destroy', 'fold'],如果为
milestone类型任务,默认动作为['pick', 'update', 'destroy'],如果为根任务,默认动作为
['createTask', 'createMilestone', 'destroyDescendants', 'switchState']
@prop {Array} [readonlyProps = [
  'uid', 'rootId', 'wbs', 'type', 'created', 'isHidden', 'stacks', 'errors',
  'operations', 'readonlys', 'tasks', 'events', 'pendingDeps'
]] - 0.2.0新增 任务只读属性,默认为内置私有属性和部分不可变更属性

内置事件

事件名称 event.target 是否冒泡 触发时机 携带数据 阻止方式 阻止作用 其它
before-create TaskInstance 任务实例创建完成前 TaskInstance.data 事件监听函数中return false或event.preventDefault() 取消创建当前任务实例 0.2.0新增,可通过覆盖携带数据达到添加或修改默认值等目的。
before-update TaskInstance 任务实例更新前 {/property/: {newVal: /newValue/, oldVal: /oldValue/}} 事件监听函数中return false或event.preventDefault() 取消更新当前任务 0.2.0新增,内置字段newVal不可被重写。对于事务型更新,可通过event.original获取引发事务的任务和属性。
before-destroy TaskInstance 任务实例删除前 事件监听函数中return false或event.preventDefault() 取消删除当前任务 0.2.0新增
after-create TaskInstance 任务实例创建完成
after-touch TaskInstance 任务实例执行写操作完成 {/property/: {newVal: /newValue/, oldVal: /oldValue/}}
after-update TaskInstance 任务实例执行写操作完成且值改变 {/property/: {newVal: /newValue/, oldVal: /oldValue/}}
after-destroy TaskInstance 任务实例销毁完成
after-update-state-stack RootTaskInstance undo栈或redo栈出栈或入栈完成后 {action: /undo|redo/, direction: /push|pop/, state: /stackElement/} 0.2.0新增
after-pop-state-stack RootTaskInstance undo栈或redo栈出栈完成后 {action: /undo|redo/, state: /stackElement/} 0.2.0新增
after-push-state-stack RootTaskInstance undo栈或redo栈入栈完成后 {action: /undo|redo/, state: /stackElement/} 0.2.0新增
after-pop-undo-state-stack RootTaskInstance undo栈出栈完成后 /stackElement/ 0.2.0新增
after-pop-redo-state-stack RootTaskInstance redo栈出栈完成后 /stackElement/ 0.2.0新增
after-push-undo-state-stack RootTaskInstance undo栈入栈完成后 /stackElement/ 0.2.0新增
after-push-redo-state-stack RootTaskInstance redo栈入栈完成后 /stackElement/ 0.2.0新增
after-switch-state RootTaskInstance 撤销或重做完成后 {currentState: /stackElement/, oldState: /stackElement/} 0.2.0新增
after-undo RootTaskInstance 撤销完成后 {currentState: /stackElement/, oldState: /stackElement/} 0.2.0新增
after-redo RootTaskInstance 重做完成后 {currentState: /stackElement/, oldState: /stackElement/} 0.2.0新增
after-range-in-gantt TaskInstance 任务实例在gantt视图中拖拽后
after-render-in-gantt TaskInstance 任务实例在gantt视图中渲染完成
after-render-in-table TaskInstance 任务实例在table视图中渲染完成
after-toggle-in-gantt TaskInstance 任务实例在gantt视图中折叠或展开后代完成后 0.2.0新增
after-toggle-in-table TaskInstance 任务实例在table视图中折叠或展开后代完成后 0.2.0新增
after-activate-form TaskInstance 任务实例modal表单打开后 {$form: /HTMLElement/} 0.2.0新增
after-deactivate-form TaskInstance 任务实例modal表单关闭后 {$form: /HTMLElement/} 0.2.0新增

实例方法

.actions (action1, action2, …)

0.2.0新增
@param {string} [action1, action2, ...] - 可执行动作名称
@returns {TaskInstance | Array} - 如果不传入action参数,返回当前任务可执行actions数组,
否则设置当前任务可执行actions为所有传入的action构成的数组,并返回当前任务实例。
根任务默认actions包括:createTask、createMilestone、destroyDescendants、switchState;
task类型任务默认actions包括:pick、fold、update、destroy、createTask、createMilestone;
milestone类型任务默认actions包括:pick、update、destroy;
对于milestone类型任务, createTask、createMilestone、fold为不合法actions。
let myKickoff = kickoff({
  target: '#my-kickoff'
}, [{
  wbs: '1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-22 23:59:59'
}])
// @example 获取wbs编号为1的任务的可执行actions数组
myKickoff.task.find('1').actions()
// @example 设置webs编号为1的任务的可执行actions
myKickoff.task.find('1').actions('update', 'myCustomAction')

.addF2FPredecessors (task1, task2, …)

@param {TaskInstance | string | integer} task1[, task2, ...] - 任务实例或wbs或uid
@returns {TaskInstance}
let myKickoff = kickoff({
  target: '#my-kickoff'
}, [{
  wbs: '1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-22 23:59:59'
}, {
  wbs: '2',
  beginning: '2020-09-23 00:00:00',
  end: '2020-09-30 23:59:59'
}, {
  wbs: '3',
  beginning: '2020-09-24 00:00:00',
  end: '2020-10-01 23:59:59'
}])
// @example 将wbs编号为1和2的任务添加到wbs编号为3的任务的f2f型前置任务中
myKickoff.task.find('3').addF2FPredecessors('1', '2')

.addF2FSuccessors (task1, task2, …)

@param {TaskInstance | string | integer} task1[, task2, ...] - 任务实例或wbs或uid
@returns {TaskInstance}
let myKickoff = kickoff({
  target: '#my-kickoff'
}, [{
  wbs: '1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-22 23:59:59'
}, {
  wbs: '2',
  beginning: '2020-09-23 00:00:00',
  end: '2020-09-30 23:59:59'
}, {
  wbs: '3',
  beginning: '2020-09-24 00:00:00',
  end: '2020-10-01 23:59:59'
}])
// @example 将wbs编号为2和3的任务添加到wbs编号为1的任务的f2f型后置任务中
myKickoff.task.find('1').addF2FSuccessors('2', '3')

.addF2SPredecessors (task1, task2, …)

@param {TaskInstance | string | integer} task1[, task2, ...] - 任务实例或wbs或uid
@returns {TaskInstance}
let myKickoff = kickoff({
  target: '#my-kickoff'
}, [{
  wbs: '1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-22 23:59:59'
}, {
  wbs: '2',
  beginning: '2020-09-23 00:00:00',
  end: '2020-09-30 23:59:59'
}, {
  wbs: '3',
  beginning: '2020-09-24 00:00:00',
  end: '2020-09-25 23:59:59'
}])
// @example 将wbs编号为1和2的任务添加到wbs编号为3的任务的f2s型前置任务中
myKickoff.task.find('3').addF2SPredecessors('1', '2')

.addF2SSuccessors (task1, task2, …)

@param {TaskInstance | string | integer} task1[, task2, ...] - 任务实例或wbs或uid
@returns {TaskInstance}
let myKickoff = kickoff({
  target: '#my-kickoff'
}, [{
  wbs: '1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-22 23:59:59'
}, {
  wbs: '2',
  beginning: '2020-09-23 00:00:00',
  end: '2020-09-30 23:59:59'
}, {
  wbs: '3',
  beginning: '2020-09-24 00:00:00',
  end: '2020-09-25 23:59:59'
}])
// @example 将wbs编号为2和3的任务添加到wbs编号为1的任务的f2s型后置任务中
myKickoff.task.find('1').addF2SSuccessors('2', '3')

.addPredecessors (type, task1, task2, …)

@param {string} type - 依赖类型,s2s, s2f,f2f,f2s可选
@param {TaskInstance | string | integer} task1[, task2, ...] - 任务实例或wbs或uid
@returns {TaskInstance}
let myKickoff = kickoff({
  target: '#my-kickoff'
}, [{
  wbs: '1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-22 23:59:59'
}, {
  wbs: '2',
  beginning: '2020-09-23 00:00:00',
  end: '2020-09-30 23:59:59'
}, {
  wbs: '3',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-25 23:59:59'
}])
// @example 将wbs编号为1和2的任务添加到wbs编号为3的任务的s2f型前置任务中
myKickoff.task.find('3').addPredecessors('s2f', '1', '2')

.addS2FPredecessors (task1, task2, …)

@param {TaskInstance | string | integer} task1[, task2, ...] - 任务实例或wbs或uid
@returns {TaskInstance}
let myKickoff = kickoff({
  target: '#my-kickoff'
}, [{
  wbs: '1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-22 23:59:59'
}, {
  wbs: '2',
  beginning: '2020-09-23 00:00:00',
  end: '2020-09-30 23:59:59'
}, {
  wbs: '3',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-25 23:59:59'
}])
// @example 将wbs编号为1和2的任务添加到wbs编号为3的任务的s2f型前置任务中
myKickoff.task.find('3').addS2FPredecessors('1', '2')

.addS2FSuccessors (task1, task2, …)

@param {TaskInstance | string | integer} task1[, task2, ...] - 任务实例或wbs或uid
@returns {TaskInstance}
let myKickoff = kickoff({
  target: '#my-kickoff'
}, [{
  wbs: '1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-22 23:59:59'
}, {
  wbs: '2',
  beginning: '2020-09-23 00:00:00',
  end: '2020-09-30 23:59:59'
}, {
  wbs: '3',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-25 23:59:59'
}])
// @example 将wbs编号为2和3的任务添加到wbs编号为1的任务的s2f型后置任务中
myKickoff.task.find('1').addS2FSuccessors('2', '3')

.addS2SPredecessors (task1, task2, …)

@param {TaskInstance | string | integer} task1[, task2, ...] - 任务实例或wbs或uid
@returns {TaskInstance}
let myKickoff = kickoff({
  target: '#my-kickoff'
}, [{
  wbs: '1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-22 23:59:59'
}, {
  wbs: '2',
  beginning: '2020-09-23 00:00:00',
  end: '2020-09-30 23:59:59'
}, {
  wbs: '3',
  beginning: '2020-09-24 00:00:00',
  end: '2020-09-25 23:59:59'
}])
// @example 将wbs编号为1和2的任务添加到wbs编号为3的任务的s2s型前置任务中
myKickoff.task.find('3').addS2SPredecessors('1', '2')

.addS2SSuccessors (task1, task2, …)

@param {TaskInstance | string | integer} task1[, task2, ...] - 任务实例或wbs或uid
@returns {TaskInstance}
let myKickoff = kickoff({
  target: '#my-kickoff'
}, [{
  wbs: '1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-22 23:59:59'
}, {
  wbs: '2',
  beginning: '2020-09-23 00:00:00',
  end: '2020-09-30 23:59:59'
}, {
  wbs: '3',
  beginning: '2020-09-24 00:00:00',
  end: '2020-09-25 23:59:59'
}])
// @example 将wbs编号为2和3的任务添加到wbs编号为1的任务的s2s型后置任务中
myKickoff.task.find('1').addS2SSuccessors('2', '3')

.addSuccessors (type, task1, task2, …)

@param {string} type - 依赖类型,s2s, s2f,f2f,f2s可选
@param {TaskInstance | string | integer} task1[, task2, ...] - 任务实例或wbs或uid
@returns {TaskInstance}
let myKickoff = kickoff({
  target: '#my-kickoff'
}, [{
  wbs: '1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-22 23:59:59'
}, {
  wbs: '2',
  beginning: '2020-09-23 00:00:00',
  end: '2020-09-30 23:59:59'
}, {
  wbs: '3',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-25 23:59:59'
}])
// @example 将wbs编号为2和3的任务添加到wbs编号为1的任务的s2f型后置任务中
myKickoff.task.find('1').addSuccessors('s2f', '2', '3')

.ancestors (filter)

@param {Function} [filter] - 祖先任务筛选函数,参数为每个祖先任务实例
@returns {TaskInstance[]}
let myKickoff = myKickoff({
  target: '#my-kickoff'
}, [{
  wbs: '1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-22 23:59:59'
}, {
  wbs: '1.1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-22 23:59:59'
}])
// @example 查找wbs编号为1.1的任务的祖先任务
myKickoff.task.find('1.1').ancestors()
// @example 查找wbs编号为1.1的任务的祖先任务,且其祖先任务须满足开始时间早于 2020-09-18
myKickoff.task.find('1.1').ancestors(function(task) {
  return task.beginning().earlierThan('2020-09-18')
})

.beginning (time)

@param {string | TimeInstance} [time] - 如为字符串,格式应为 yyyy-mm-dd HH:MM:SS
@returns {TimeInstance | TaskInstance | RootTaskInstance} - 如不传入time参数,则返回
当前TaskInstance的开始时间所实例化的TimeInstance,否则根据传入的time更新当前TaskInstance的
开始时间,如果为RootTaskInstance,则不执行更新动作。
let myKickoff = myKickoff({
  target: '#my-kickoff'
}, [{
  wbs: '1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-22 23:59:59'
}])
// @example 获取wbs编号为1的任务开始时间
myKickoff.task.find('1').beginning()
// @example 设置wbs编号为1的任务开始时间
myKickoff.task.find('1').beginning('2020-09-20 00:00:00')

.can (action, enabled)

0.2.0新增
@param {string} action - 任务动作名称
@param {boolean} [enabled] - 是否启用该action
@returns {TaskInstance | boolean} 如果不传入enabled参数,则返回action在当前任务中的启用
状态布尔值,否则返回当前任务实例。
let myKickoff = myKickoff({
  target: '#my-kickoff'
}, [{
  wbs: '1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-22 23:59:59'
}])
// @example 获取wbs编号为1的任务是否可被删除
myKickoff.task.find('1').can('destroy')
// @example 将删除动作从wbs编号为1的任务的可执行动作中移除,使其不可被删除
myKickoff.task.find('1').can('destroy', false)

.canBePicked (enabled)

0.2.0新增
.can('pick', enabled) 别名方法

.canBeFolded (enabled)

0.2.0新增
.can('fold', enabled) 别名方法

.canCreateMilestone (enabled)

0.2.0新增
.can('createMilestone', enabled) 别名方法

.canCreateTask (enabled)

0.2.0新增
.can('createTask', enabled) 别名方法

.canBeDestroied (enabled)

0.2.0新增
.can('destroy', enabled) 别名方法

.canBeUpdated (enabled)

0.2.0新增
.can('update', enabled) 别名方法

.canDestroyDescendants (enabled)

0.2.0新增
.can('destroyDescendants', enabled) 别名方法

.canSwitchState (enabled)

0.2.0新增
.can('switchState', enabled) 别名方法

.children (filter)

@param {Function} [filter] - 子任务筛选函数,参数为每个子任务实例
@returns {TaskInstance[]}
let myKickoff = myKickoff({
  target: '#my-kickoff'
}, [{
  wbs: '1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-22 23:59:59'
}, {
  wbs: '1.1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-22 23:59:59'
}])
// @example 查找wbs编号为1的任务的子任务
myKickoff.task.find('1').children()
// @example 查找wbs编号为1的任务的子任务,且子任务须满足开始时间早于 2020-09-18
myKickoff.task.find('1').children(function(task) {
  return task.beginning().earlierThan('2020-09-18')
})

.create (data1, data2, …)

@param {TaskInstanceData} data1[, data2, ...] - 待创建的任务数据对象
@returns {TaskInstance[]} - 返回创建的任务实例
let myKickoff = myKickoff({target: '#my-kickoff'})
// @example 创建两个TaskInstance,其中一个全部属性使用默认值
myKickoff.task.create({
  wbs: '1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-22 23:59:59'
}, {})

.descendants (filter)

@param {Function} [filter] - 后代任务筛选函数,参数为每个后代任务实例
@returns {TaskInstance[]}
let myKickoff = myKickoff({
  target: '#my-kickoff'
}, [{
  wbs: '1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-22 23:59:59'
}, {
  wbs: '1.1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-22 23:59:59'
}])
// @example 查找wbs编号为1的任务的后代任务
myKickoff.task.find('1').descendants()
// @example 查找wbs编号为1的任务的后代任务,且其后代任务须满足开始时间晚于 2020-09-20
myKickoff.task.find('1').descendants(function(task) {
  return task.beginning().laterThan('2020-09-20')
})

.destroy (task1, task2, …)

@param {TaskInstance | integer | string} [task1, task2, ...] - 通过传入后代任务实例、
后代任务uid或后代任务wbs编号删除后代任务。如果未传入任何参数,则删除当前任务及其后代任务。
@returns {TaskInstance[]} - 返回被删除的任务实例
let myKickoff = myKickoff({
  target: '#my-kickoff'
}, [{
  wbs: '1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-22 23:59:59'
}, {
  wbs: '1.1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-22 23:59:59'
}, {
  wbs: '1.2',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-22 23:59:59'
}])
// @example 删除wbs为1的任务的wbs为1.1的子任务
myKickoff.task.find('1').destroy('1.1')
// @example 删除wbs为1的任务及其子任务
myKickoff.task.find('1').destroy()

.duration (seconds, exceptExclusions)

@param {integer} [seconds] - 任务周期秒数
@param {boolean} [exceptExclusions = true] - 是否扣除例外日期进行计算
@returns {TimeDuration | TaskInstance | RootTaskInstance} - 如果未传入
seconds,返回当前任务周期构建的TimeDuration,否则更新当前任务周期并返回更新后的
TaskInstance。如果为RootTaskInstance,则不执行更新动作。
let myKickoff = myKickoff({
  target: '#my-kickoff'
}, [{
  wbs: '1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-22 23:59:59'
}])
// @example 获取wbs编号为1的任务周期
myKickoff.task.find('1').duration()
// @example 设置wbs编号为1的任务周期为 3600 * 24 秒
myKickoff.task.find('1').duration(3600 * 24)

.end (time)

@param {string | TimeInstance} [time] - 如为字符串,格式应为 yyyy-mm-dd HH:MM:SS
@returns {TimeInstance | TaskInstance | RootTaskInstance} - 如不传入time参数,则返回
当前TaskInstance的结束时间所实例化的TimeInstance,否则根据传入的time更新当前TaskInstance的
结束时间,如果为RootTaskInstance,则不执行更新动作。
let myKickoff = myKickoff({
  target: '#my-kickoff'
}, [{
  wbs: '1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-22 23:59:59'
}])
// @example 获取wbs编号为1的任务结束时间
myKickoff.task.find('1').end()
// @example 设置wbs编号为1的任务结束时间
myKickoff.task.find('1').end('2020-09-23 23:59:59')

.error (property, errorText)

0.2.0新增
@param {Object | string | null} [property] - 当前任务属性
@param {string | null} [errorText] - property错误信息
@returns {TaskInstance| Object | Array | null} - 返回值及执行的操作根据传入
参数类型的不同有以下几种情况:
1. property为string,不传入errorText - 获取当前任务property错误信息,返回错误信息数组或null;
2. 不传入property - 获取并返回当前任务所有属性错误信息Object或null;
3. property为string,errorText为string - 将errorText添加到当前任务的property错误信息中,
   返回当前实例;
4. property为Object - 以property的key和value本别作为任务属性和错误信息添加到当前任务或从当
   前任务中清空,返回当前任务实例;
5. property为string,errorText为null - 清空当前任务的property错误信息,返回当前任务实例;
6. property为null - 清空当前任务所有属性错误信息,返回当前任务实例。
let myKickoff = myKickoff({
  target: '#my-kickoff'
}, [{
  wbs: '1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-22 23:59:59'
}])
// @example 获取wbs编号为1的任务的beginning属性错误信息
myKickoff.task.find('1').error('beginning')
// @example 获取wbs编号为1的任务的所有属性的错误信息
myKickoff.task.find('1').error()
// @example 添加wbs编号为1的任务的beginning属性错误信息
myKickoff.task.find('1').error('beginning', 'cannot be later than 2020-09-01')
// @example 添加多个属性的错误信息到wbs编号为1的任务中
myKickoff.task.find('1').error({end: 'end error txt', customProp: 'error txt'})
// @example 清空wbs编号为1的任务的beginning属性错误信息
myKickoff.task.find('1').error('beginning', null)
// @example 清空wbs编号为1的任务的所有错误信息
myKickoff.task.find('1').error(null)

.f2fPredecessors (filter, deep)

@param {Function | undefined} [filter] - 前置任务过滤函数,参数为每个前置任务实例
@param {boolean} [deep = false] - 是否使用深度查找模式,启用时会查找整个前置任务链条上的任务
@returns {TaskInstance[]}
let myKickoff = kickoff({
  target: '#my-kickoff'
}, [{
  wbs: '1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-22 23:59:59'
}, {
  wbs: '2',
  beginning: '2020-09-23 00:00:00',
  end: '2020-09-30 23:59:59',
  dependencies: {finishToFinish: '1.1'}
}, {
  wbs: '1.1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-21 23:59:59'
}, {
  wbs: '3',
  beginning: '2020-10-01 00:00:00',
  end: '2020-10-25 23:59:59',
  dependencies: {finishToFinish: '2'}
}])
// @example 查找wbs编号为3的任务的f2f型直接前置任务
myKickoff.task.find('3').f2fPredecessors()
// @example 查找wbs编号为3的任务的所有f2f型前置任务
myKickoff.task.find('3').f2fPredecessors(undefined, true)

.f2fSuccessors (filter, deep)

@param {Function | undefined} [filter] - 后置任务过滤函数,参数为每个后置任务实例
@param {boolean} [deep = false] - 是否使用深度查找模式,启用时会查找整个后置任务链条上的任务
@returns {TaskInstance[]}
let myKickoff = kickoff({
  target: '#my-kickoff'
}, [{
  wbs: '1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-22 23:59:59'
}, {
  wbs: '2',
  beginning: '2020-09-23 00:00:00',
  end: '2020-09-30 23:59:59',
  dependencies: {finishToFinish: '1.1'}
}, {
  wbs: '1.1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-21 23:59:59'
}, {
  wbs: '3',
  beginning: '2020-10-01 00:00:00',
  end: '2020-10-25 23:59:59',
  dependencies: {finishToFinish: '2'}
}])
// @example 查找wbs编号为1.1的任务的f2f型直接后置任务
myKickoff.task.find('1.1').f2fSuccessors()
// @example 查找wbs编号为1.1的任务的所有f2f型后置任务
myKickoff.task.find('1.1').f2fSuccessors(undefined, true)

.f2sPredecessors (filter, deep)

@param {Function | undefined} [filter] - 前置任务过滤函数,参数为每个前置任务实例
@param {boolean} [deep = false] - 是否使用深度查找模式,启用时会查找整个前置任务链条上的任务
@returns {TaskInstance[]}
let myKickoff = kickoff({
  target: '#my-kickoff'
}, [{
  wbs: '1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-22 23:59:59'
}, {
  wbs: '2',
  beginning: '2020-09-23 00:00:00',
  end: '2020-09-30 23:59:59',
  dependencies: {finishToStart: '1.1'}
}, {
  wbs: '1.1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-21 23:59:59'
}, {
  wbs: '3',
  beginning: '2020-10-01 00:00:00',
  end: '2020-10-25 23:59:59',
  dependencies: {finishToStart: '2'}
}])
// @example 查找wbs编号为3的任务的f2s型直接前置任务
myKickoff.task.find('3').f2sPredecessors()
// @example 查找wbs编号为3的任务的所有f2s型前置任务
myKickoff.task.find('3').f2sPredecessors(undefined, true)

.f2sSuccessors (filter, deep)

@param {Function | undefined} [filter] - 后置任务过滤函数,参数为每个后置任务实例
@param {boolean} [deep = false] - 是否使用深度查找模式,启用时会查找整个后置任务链条上的任务
@returns {TaskInstance[]}
let myKickoff = kickoff({
  target: '#my-kickoff'
}, [{
  wbs: '1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-22 23:59:59'
}, {
  wbs: '2',
  beginning: '2020-09-23 00:00:00',
  end: '2020-09-30 23:59:59',
  dependencies: {finishToStart: '1.1'}
}, {
  wbs: '1.1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-21 23:59:59'
}, {
  wbs: '3',
  beginning: '2020-10-01 00:00:00',
  end: '2020-10-25 23:59:59',
  dependencies: {finishToStart: '2'}
}])
// @example 查找wbs编号为1.1的任务的f2s型直接后置任务
myKickoff.task.find('1.1').f2sSuccessors()
// @example 查找wbs编号为1.1的任务的所有f2s型后置任务
myKickoff.task.find('1.1').f2sSuccessors(undefined, true)

.find (idOrWbs)

@param {integer | string} idOrWbs - 任务唯一id或wbs编号
@returns {TaskInstance | null}
let myKickoff = myKickoff({
  target: '#my-kickoff'
}, [{
  wbs: '1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-22 23:59:59'
}])
// @example 以wbs编号查找任务实例
let instance = myKickoff.task.find('1')
// @example 以任务uid查找任务实例
myKickoff.task.find(instance.uid)

.firstChild ( )

@returns {TaskInstance}
let myKickoff = myKickoff({
  target: '#my-kickoff'
}, [{
  wbs: '1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-22 23:59:59'
}, {
  wbs: '1.1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-22 23:59:59'
}])
// @example 查找wbs编号为1的任务的第一个子任务
myKickoff.task.find('1').firstChild()

.fold (isFolded)

0.2.0新增
@param {boolean} [isFolded] - 是否折叠当前任务后代标识
@returns {TaskInstance | boolean} - 如果传入isFolded则折叠或展开当前任务后代并返回当前
任务实例,否则返回当前任务后代是否被折叠的状态布尔值。
let myKickoff = myKickoff({
  target: '#my-kickoff'
}, [{
  wbs: '1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-22 23:59:59'
}, {
  wbs: '1.1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-22 23:59:59'
}])
// @example 折叠wbs编号为1的任务的后代任务
myKickoff.task.find('1').fold(true)
// @example 展开wbs编号为1的任务的后代任务
myKickoff.task.find('1').fold(false)
// @example 展开wbs编号为1的任务的后代任务当前是被展开还是折叠
myKickoff.task.find('1').fold()

.isMilestone ( )

0.2.0新增
@returns {boolean} - 返回当前任务类型是否为milestone
let myKickoff = kickoff({
  target: '#my-kickoff'
}, [{
  wbs: '1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-22 23:59:59'
}, {
  wbs: '2',
  type: 'milestone',
  end: '2020-09-23 00:00:00'
}])
// @example 判断任务是否为milestone类型
myKickoff.task.find('2').isMilestone()

.isRoot ( )

@returns {boolean}
let myKickoff = myKickoff({
  target: '#my-kickoff'
})
// @example 检查某任务是否为根任务
myKickoff.task.isRoot()

.isTask ( )

0.2.0新增
@returns {boolean} - 返回当前任务类型是否为task
let myKickoff = kickoff({
  target: '#my-kickoff'
}, [{
  wbs: '1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-22 23:59:59'
}, {
  wbs: '2',
  type: 'milestone',
  end: '2020-09-23 00:00:00'
}])
// @example 判断任务是否为task类型
myKickoff.task.find('1').isTask()

.isValidPredecessorOf (task)

@param {TaskInstance} task
@returns {boolean}
let myKickoff = kickoff({
  target: '#my-kickoff'
}, [{
  wbs: '1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-22 23:59:59'
}, {
  wbs: '2',
  beginning: '2020-09-23 00:00:00',
  end: '2020-09-30 23:59:59'
}])
// @example 检查wbs编号为1的任务是否为wbs编号为2的任务的合法前置任务
myKickoff.task.find('1').isValidSuccessorOf(myKickoff.task.find('2'))

.isValidSuccessorOf (task)

@param {TaskInstance} task
@returns {boolean}
let myKickoff = kickoff({
  target: '#my-kickoff'
}, [{
  wbs: '1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-22 23:59:59'
}, {
  wbs: '2',
  beginning: '2020-09-23 00:00:00',
  end: '2020-09-30 23:59:59'
}])
// @example 检查wbs编号为2的任务是否为wbs编号为1的任务的合法后置任务
myKickoff.task.find('2').isValidSuccessorOf(myKickoff.task.find('1'))

.lastChild ( )

@returns {TaskInstance}
let myKickoff = myKickoff({
  target: '#my-kickoff'
}, [{
  wbs: '1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-22 23:59:59'
}, {
  wbs: '1.1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-22 23:59:59'
}])
// @example 查找wbs编号为1的任务的最后一个子任务
myKickoff.task.find('1').lastChild()

.nextSibling ( )

@returns {TaskInstance | null}
let myKickoff = kickoff({
  target: '#my-kickoff'
}, [{
  wbs: '1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-22 23:59:59'
}, {
  wbs: '2',
  beginning: '2020-09-23 00:00:00',
  end: '2020-09-30 23:59:59'
}])
// @example 查找wbs编号为1的任务的后一个兄弟任务
myKickoff.task.find('1').nextSibling()

.nextSiblings (filter)

@param {Function} [filter] - 兄弟任务筛选函数,参数为每个兄弟任务实例
@returns {TaskInstance[]}
let myKickoff = kickoff({
  target: '#my-kickoff'
}, [{
  wbs: '1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-22 23:59:59'
}, {
  wbs: '2',
  beginning: '2020-09-23 00:00:00',
  end: '2020-09-30 23:59:59'
}])
// @example 查找wbs编号为1的任务之后的兄弟任务
myKickoff.task.find('1').nextSiblings()
// @example 查找wbs编号为1的任务之后的兄弟任务,其兄弟任务须满足开始时间晚于 2020-10-01
myKickoff.task.find('1').nextSiblings(function(task){
  return task.beginning().laterThan('2020-10-01')
})

.off (event, callback)

@param {string} event - 事件名称及命名空间,格式为name.ns1.ns2,可以没有命名空间
@params {Function} [callback] - 绑定事件时的回调函数,如不传递,则解绑定该时间下所有监听
@returns {TaskInstance}
let myKickoff = kickoff({
  target: '#my-kickoff'
}, [{
  wbs: '1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-22 23:59:59'
}])
myKickoff.task.on('after-update.my-namespace', function(event, udpated){
  if(event.target.isRoot()) {return}
  console.log(event.target.data.wbs, updated)
})
// @example 解除添加到根任务上的在my-namespace命名空间下的after-update事件监听
myKickoff.task.off('after-update.my-namespace')

.on (event, callback)

@param {string} event - 事件名称及命名空间,格式为name.ns1.ns2,可以没有命名空间
@params {Function} callback - 事件触发时的回调函数
@returns {TaskInstance}
let myKickoff = kickoff({
  target: '#my-kickoff'
}, [{
  wbs: '1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-22 23:59:59'
}])
// @example 向根任务添加在my-namespace命名空间下的after-update事件监听,每当其后代任务
// 执行更新操作后事件会被触发并执行回调函数
myKickoff.task.on('after-update.my-namespace', function(event, udpated){
  if(event.target.isRoot()) {return}
  console.log(event.target.data.wbs, updated)
})

.one (event, callback)

@param {string} event - 事件名称及命名空间,格式为name.ns1.ns2,可以没有命名空间
@params {Function} callback - 事件触发时的回调函数
@returns {TaskInstance}
let myKickoff = kickoff({
  target: '#my-kickoff'
}, [{
  wbs: '1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-22 23:59:59'
}])
// @example 向根任务添加在my-namespace命名空间下的after-update事件监听,当其后代任务
// 执行更新操作后事件会被触发并执行回调函数,但只会被出发并执行一次
myKickoff.task.one('after-update.my-namespace', function(event, udpated){
  if(event.target.isRoot()) {return}
  console.log(event.target.data.wbs, updated)
})

.parent (includeRoot)

@param {boolean} [includeRoot = false] - 是否包括根任务
@returns {null | TaskInstance | RootTaskInstance}
let myKickoff = myKickoff({
  target: '#my-kickoff'
}, [{
  wbs: '1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-22 23:59:59'
}, {
  wbs: '1.1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-22 23:59:59'
}])
// @example 查找wbs编号为1.1的任务的父级任务
myKickoff.task.find('1.1').parent()

.parse ( )

@returns {TaskInstanceData[]} - 返回当前任务及其后代任务按照wbs升序排列的一维数组
let myKickoff = kickoff({
  target: '#my-kickoff'
}, [{
  wbs: '1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-22 23:59:59'
}, {
  wbs: '2',
  beginning: '2020-09-23 00:00:00',
  end: '2020-09-30 23:59:59',
  dependencies: {startToStart: '1.1'}
}, {
  wbs: '1.1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-21 23:59:59'
}])
// @example 获取的所有任务数据数组
myKickoff.task.parse()

.pick (isPicked, cascaded)

@param {boolean} [isPicked = true] - 是否拾取当前任务
@param {boolean} [cascaded = true] - 是否级联拾取当前任务的后代任务
@returns {TaskInstance}
let myKickoff = myKickoff({
  target: '#my-kickoff'
}, [{
  wbs: '1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-22 23:59:59'
}])
// @example 拾取wbs编号为1的任务及其后代任务
myKickoff.task.find('1').pick()
// @example 取消拾取wbs编号为1的任务及其后代任务
myKickoff.task.find('1').pick(false)

.predecessors (type, filter, deep)

@param {string} [type = ''] - 依赖类型, s2s, s2f, f2s, f2f 可选
@param {Function | undefined} [filter] - 前置任务过滤函数,参数为每个前置任务实例
@param {boolean} [deep = false] - 是否使用深度查找模式,启用时会查找整个前置任务链条上的任务
@returns {TaskInstance[]}
let myKickoff = kickoff({
  target: '#my-kickoff'
}, [{
  wbs: '1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-22 23:59:59'
}, {
  wbs: '2',
  beginning: '2020-09-23 00:00:00',
  end: '2020-09-30 23:59:59',
  dependencies: {startToStart: '1.1'}
}, {
  wbs: '1.1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-21 23:59:59'
}, {
  wbs: '3',
  beginning: '2020-09-24 00:00:00',
  end: '2020-09-25 23:59:59',
  dependencies: {startToStart: '2'}
}])
// @example 查找wbs编号为3的任务的直接前置任务
myKickoff.task.find('3').predecessors()
// @example 查找wbs编号为3的任务的s2s型直接前置任务
myKickoff.task.find('3').predecessors('s2s')
// @example 查找wbs编号为3的任务的所有前置任务
myKickoff.task.find('3').predecessors('', undefined, true)

.predecessorType (predecessor)

@param {TaskInstance | string | integer} predecessor - 任务实例或wbs或uid
@returns {Object} - 返回传入的任务在当前任务前置任务中的类型。返回值有两个字段,type为类型全称
shortcut为类型简称,如果传入的任务不是当前任务的前置任务,则返回的对象中两个字段均为空字符串。
let myKickoff = kickoff({
  target: '#my-kickoff'
}, [{
  wbs: '1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-22 23:59:59'
}, {
  wbs: '2',
  beginning: '2020-09-23 00:00:00',
  end: '2020-09-30 23:59:59',
  dependencies: {startToStart: '1'}
}])
// @example 查询wbs编号为1的任务是否为wbs编号为2的任务的前置任务,且返回依赖类型
myKickoff.task.find('2').predecessorType('1')

.prevSibling ( )

@returns {TaskInstance | null}
let myKickoff = kickoff({
  target: '#my-kickoff'
}, [{
  wbs: '1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-22 23:59:59'
}, {
  wbs: '2',
  beginning: '2020-09-23 00:00:00',
  end: '2020-09-30 23:59:59'
}])
// @example 查找wbs编号为2的任务的前一个兄弟任务
myKickoff.task.find('2').prevSibling()

.prevSiblings (filter)

@param {Function} [filter] - 兄弟任务筛选函数,参数为每个兄弟任务实例
@returns {TaskInstance[]}
let myKickoff = kickoff({
  target: '#my-kickoff'
}, [{
  wbs: '1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-22 23:59:59'
}, {
  wbs: '2',
  beginning: '2020-09-23 00:00:00',
  end: '2020-09-30 23:59:59'
}])
// @example 查找wbs编号为2的任务之前的兄弟任务
myKickoff.task.find('2').prevSiblings()
// @example 查找wbs编号为2的任务之前的兄弟任务,其兄弟任务须满足开始时间晚于 2020-10-01
myKickoff.task.find('2').prevSiblings(function(task){
  return task.beginning().laterThan('2020-10-01')
})

.popRedoState ( )

0.2.0新增
@returns {Array | null} - 出栈并返回根任务redo栈的栈顶元素,该元素为入栈时所有任务按照wbs编
号升序排列格式化后构成的数组。如果没有栈顶元素,则返回null。
let myKickoff = kickoff({
  target: '#my-kickoff'
}, [{
  wbs: '1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-22 23:59:59'
}])
myKickoff.task.find('1').create({name: 'A child task'})
myKickoff.task.undo()
// @example 出栈根任务redo栈的栈顶元素
myKickoff.task.popRedoState()

.popUndoState ( )

0.2.0新增
@returns {Array | null} - 出栈并返回根任务undo栈的栈顶元素,该元素为入栈时所有任务按照wbs编
号升序排列格式化后构成的数组。如果没有栈顶元素,则返回null。
let myKickoff = kickoff({
  target: '#my-kickoff'
}, [{
  wbs: '1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-22 23:59:59'
}])
myKickoff.task.find('1').create({name: 'A child task'})
// @example 出栈根任务undo栈的栈顶元素
myKickoff.task.popUndoState()

.pushRedoState ( )

0.2.0新增
@returns {Array | null} - 将当前所有任务按照wbs编号升序排列格式化后构成的数组,入栈到跟任务
redo栈的栈顶并返回。如果经deepEqual比较后,该数组与上一次入栈的数组没有差别,则不入栈并返回null。
调用undo方法时,当前任务状态会自动入栈到根任务redo栈。
let myKickoff = kickoff({
  target: '#my-kickoff'
}, [{
  wbs: '1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-22 23:59:59'
}])
myKickoff.task.find('1').create({name: 'A child task'})
// @example 入栈根任务redo栈的栈顶元素
myKickoff.task.pushRedoState()

.pushUndoState ( )

0.2.0新增
@returns {Array | null} - 将当前所有任务按照wbs编号升序排列格式化后构成的数组,入栈到跟任务
undo栈的栈顶并返回。如果经deepEqual比较后,该数组与上一次入栈的数组没有差别,则不入栈并返回null。
对于内置的起到修改任务状态的方法如create、update、destroy等,修改前的状态会自动入栈。
let myKickoff = kickoff({
  target: '#my-kickoff'
}, [{
  wbs: '1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-22 23:59:59'
}])
myKickoff.task.find('1').create({name: 'A child task'})
// @example 入栈根任务undo栈的栈顶元素
myKickoff.task.pushUndoState()

.redo ( )

0.2.0新增
@returns {TaskInstance} - 重做已撤销的操作并返回当前任务实例
let myKickoff = kickoff({
  target: '#my-kickoff'
}, [{
  wbs: '1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-22 23:59:59'
}])
myKickoff.task.find('1').create({name: 'A child task'})
myKickoff.task.undo()
// @example 重做创建任务操作,无论在根任务还是节点任务上调用,效果均相同。
myKickoff.task.redo()

.readonly (property, isReadonly)

0.2.0新增
@param {string} property - 任务属性名
@param {boolean} [isReadonly] - 任务属性只读状态布尔值
@returns {TaskInstance | boolean} - 如果传如isReadonly,则对property只读状态设置或取消
并返回当前任务实例,否则返回当前任务的property是否为只读状态。
内置readonly属性的只读状态无法被修改,包括但不限于 uid、rootId、wbs、type 等。
let myKickoff = kickoff({
  target: '#my-kickoff'
}, [{
  wbs: '1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-22 23:59:59'
}])
// @example 设置wbs编号为1的任务的beginning属性为只读
myKickoff.task.find('1').readonly('beginning', true)
// @example 获取wbs编号为1的任务的beginning属性的只读状态
myKickoff.task.find('1').readonly('beginning')

.readonlyProps (property1, property2, …)

0.2.0新增
@param {string} [property1, property2, ...] - 任务属性名
@returns {Array | TaskInstance} - 如果传入property,则将当前任务的property设置为只读状态
并返回当前任务实例,否则返回当前任务所有的只读属性。
内置readonly属性的只读状态无法被修改,包括但不限于 uid、rootId、wbs、type 等。
let myKickoff = kickoff({
  target: '#my-kickoff'
}, [{
  wbs: '1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-22 23:59:59'
}])
// @example 设置wbs编号为1的任务的beginning属性和end属性为只读
myKickoff.task.find('1').readonlyProps('beginning', 'end')
// @example 获取wbs编号为1的任务的所有只读属性
myKickoff.task.find('1').readonlyProps()

.removePredecessors (task1, task2, …)

@param {TaskInstance | string | integer} [task1, task2, ...] - 任务实例或wbs或uid
@returns {TaskInstance}
let myKickoff = kickoff({
  target: '#my-kickoff'
}, [{
  wbs: '1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-22 23:59:59'
}, {
  wbs: '2',
  beginning: '2020-09-23 00:00:00',
  end: '2020-09-30 23:59:59'
}, {
  wbs: '3',
  beginning: '2020-10-01 00:00:00',
  end: '2020-10-25 23:59:59',
  dependencies: {finishToStart: '1,2'}
}])
// @example 从wbs编号为3的任务中移除wbs编号为1的任务与其的前置关联关系
myKickoff.task.find('3').removePredecessors('1')
// @example 移除wbs编号为3的任务的所有前置任务关联关系
myKickoff.task.find('3').removePredecessors()

.removeSuccessors (task1, task2, …)

@param {TaskInstance | string | integer} [task1, task2, ...] - 任务实例或wbs或uid
@returns {TaskInstance}
let myKickoff = kickoff({
  target: '#my-kickoff'
}, [{
  wbs: '1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-22 23:59:59'
}, {
  wbs: '2',
  beginning: '2020-09-23 00:00:00',
  end: '2020-09-30 23:59:59',
  dependencies: {startToStart: '1'}
}, {
  wbs: '3',
  beginning: '2020-10-01 00:00:00',
  end: '2020-10-25 23:59:59',
  dependencies: {finishToStart: '1'}
}])
// @example 从wbs编号为1的任务中移除wbs编号为2的任务与其的后置关联关系
myKickoff.task.find('1').removeSuccessors('2')
// @example 移除wbs编号为1的任务的所有后置任务关联关系
myKickoff.task.find('1').removeSuccessors()

.root ( )

@returns {RootTaskInstance}
let myKickoff = kickoff({
  target: '#my-kickoff'
}, [{
  wbs: '1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-22 23:59:59'
}])
// @example 查找某任务的根任务
myKickoff.task.find('1').root()

.s2fPredecessors (filter, deep)

@param {Function | undefined} [filter] - 前置任务过滤函数,参数为每个前置任务实例
@param {boolean} [deep = false] - 是否使用深度查找模式,启用时会查找整个前置任务链条上的任务
@returns {TaskInstance[]}
let myKickoff = kickoff({
  target: '#my-kickoff'
}, [{
  wbs: '1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-22 23:59:59'
}, {
  wbs: '2',
  beginning: '2020-09-23 00:00:00',
  end: '2020-09-30 23:59:59',
  dependencies: {startToFinish: '1.1'}
}, {
  wbs: '1.1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-21 23:59:59'
}, {
  wbs: '3',
  beginning: '2020-10-01 00:00:00',
  end: '2020-10-25 23:59:59',
  dependencies: {startToFinish: '2'}
}])
// @example 查找wbs编号为3的任务的s2f型直接前置任务
myKickoff.task.find('3').s2fPredecessors()
// @example 查找wbs编号为3的任务的所有s2f型前置任务
myKickoff.task.find('3').s2fPredecessors(undefined, true)

.s2fSuccessors (filter, deep)

@param {Function | undefined} [filter] - 后置任务过滤函数,参数为每个后置任务实例
@param {boolean} [deep = false] - 是否使用深度查找模式,启用时会查找整个后置任务链条上的任务
@returns {TaskInstance[]}
let myKickoff = kickoff({
  target: '#my-kickoff'
}, [{
  wbs: '1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-22 23:59:59'
}, {
  wbs: '2',
  beginning: '2020-09-23 00:00:00',
  end: '2020-09-30 23:59:59',
  dependencies: {startToFinish: '1.1'}
}, {
  wbs: '1.1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-21 23:59:59'
}, {
  wbs: '3',
  beginning: '2020-10-01 00:00:00',
  end: '2020-10-25 23:59:59',
  dependencies: {startToFinish: '2'}
}])
// @example 查找wbs编号为1.1的任务的s2f型直接后置任务
myKickoff.task.find('1.1').s2fSuccessors()
// @example 查找wbs编号为1.1的任务的所有s2f型后置任务
myKickoff.task.find('1.1').s2fSuccessors(undefined, true)

.s2sPredecessors (filter, deep)

@param {Function | undefined} [filter] - 前置任务过滤函数,参数为每个前置任务实例
@param {boolean} [deep = false] - 是否使用深度查找模式,启用时会查找整个前置任务链条上的任务
@returns {TaskInstance[]}
let myKickoff = kickoff({
  target: '#my-kickoff'
}, [{
  wbs: '1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-22 23:59:59'
}, {
  wbs: '2',
  beginning: '2020-09-23 00:00:00',
  end: '2020-09-30 23:59:59',
  dependencies: {startToStart: '1.1'}
}, {
  wbs: '1.1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-21 23:59:59'
}, {
  wbs: '3',
  beginning: '2020-10-01 00:00:00',
  end: '2020-10-25 23:59:59',
  dependencies: {startToStart: '2'}
}])
// @example 查找wbs编号为3的任务的s2s型直接前置任务
myKickoff.task.find('3').s2sPredecessors()
// @example 查找wbs编号为3的任务的所有s2s型前置任务
myKickoff.task.find('3').s2sPredecessors(undefined, true)

.s2sSuccessors (filter, deep)

@param {Function | undefined} [filter] - 后置任务过滤函数,参数为每个后置任务实例
@param {boolean} [deep = false] - 是否使用深度查找模式,启用时会查找整个后置任务链条上的任务
@returns {TaskInstance[]}
let myKickoff = kickoff({
  target: '#my-kickoff'
}, [{
  wbs: '1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-22 23:59:59'
}, {
  wbs: '2',
  beginning: '2020-09-23 00:00:00',
  end: '2020-09-30 23:59:59',
  dependencies: {startToStart: '1.1'}
}, {
  wbs: '1.1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-21 23:59:59'
}, {
  wbs: '3',
  beginning: '2020-10-01 00:00:00',
  end: '2020-10-25 23:59:59',
  dependencies: {startToStart: '2'}
}])
// @example 查找wbs编号为1.1的任务的s2s型直接后置任务
myKickoff.task.find('1.1').s2sSuccessors()
// @example 查找wbs编号为1.1的任务的所有s2s型后置任务
myKickoff.task.find('1.1').s2sSuccessors(undefined, true)

.startTrackingHistory ( )

0.2.0新增
@returns {TaskInstance} - 开始追踪所有任务操作历史并返回当前任务实例
let myKickoff = kickoff({
  target: '#my-kickoff'
}, [{
  wbs: '1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-22 23:59:59'
}])
myKickoff.task.stopTrackingHistory()
myKickoff.task.create({name: 'A new task'})
// @example 开始追踪操作记录
myKickoff.task.startTrackingHistory()

.stopTrackingHistory ( )

0.2.0新增
@returns {TaskInstance} - 停止追踪所有任务操作历史并返回当前任务实例
let myKickoff = kickoff({
  target: '#my-kickoff'
}, [{
  wbs: '1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-22 23:59:59'
}])
// @example 停止追踪历史操作记录
myKickoff.task.stopTrackingHistory()
myKickoff.task.create({name: 'A new task'})

.stringify ( )

@returns {TaskInstanceData[]} - 返回当前任务及其后代任务按照wbs升序排列的一维数组字符串
let myKickoff = kickoff({
  target: '#my-kickoff'
}, [{
  wbs: '1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-22 23:59:59'
}, {
  wbs: '2',
  beginning: '2020-09-23 00:00:00',
  end: '2020-09-30 23:59:59',
  dependencies: {startToStart: '1.1'}
}, {
  wbs: '1.1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-21 23:59:59'
}])
// @example 获取的所有任务数据数组字符串
myKickoff.task.stringify()

.successors (type, filter, deep)

@param {string} [type = ''] - 依赖类型, s2s, s2f, f2s, f2f 可选
@param {Function | undefined} [filter] - 后置任务过滤函数,参数为每个后置任务实例
@param {boolean} [deep = false] - 是否使用深度查找模式,启用时会查找整个后置任务链条上的任务
@returns {TaskInstance[]}
let myKickoff = kickoff({
  target: '#my-kickoff'
}, [{
  wbs: '1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-22 23:59:59'
}, {
  wbs: '2',
  beginning: '2020-09-23 00:00:00',
  end: '2020-09-30 23:59:59',
  dependencies: {startToStart: '1.1'}
}, {
  wbs: '1.1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-21 23:59:59'
}, {
  wbs: '3',
  beginning: '2020-09-24 00:00:00',
  end: '2020-09-25 23:59:59',
  dependencies: {startToStart: '2'}
}])
// @example 查找wbs编号为1.1的任务的直接后置任务
myKickoff.task.find('1.1').successors()
// @example 查找wbs编号为1.1的任务的s2s型直接后置任务
myKickoff.task.find('1.1').successors('s2s')
// @example 查找wbs编号为1.1的任务的所有后置任务
myKickoff.task.find('1.1').successors('', undefined, true)

.successorType (successor)

@param {TaskInstance | string | integer} predecessor - 任务实例或wbs或uid
@returns {Object} - 返回传入的任务在当前任务后置任务中的类型。返回值有两个字段,type为类型全称
shortcut为类型简称,如果传入的任务不是当前任务的后置任务,则返回的对象中两个字段均为空字符串。
let myKickoff = kickoff({
  target: '#my-kickoff'
}, [{
  wbs: '1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-22 23:59:59'
}, {
  wbs: '2',
  beginning: '2020-09-23 00:00:00',
  end: '2020-09-30 23:59:59',
  dependencies: {startToStart: '1'}
}])
// @example 查询wbs编号为2的任务是否为wbs编号为1的任务的前置任务,且返回依赖类型
myKickoff.task.find('1').successorType('2')

.travel (seconds)

@param {integer} seconds - 当期任务周期前移或后移秒数
@returns {TaskInstance}
let myKickoff = myKickoff({
  target: '#my-kickoff'
}, [{
  wbs: '1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-22 23:59:59'
}])
// @example 将wbs编号为1的任务周期后移3600秒
myKickoff.task.find('1').travel(3600)
// @example 将wbs编号为1的任务周期前移3600秒
myKickoff.task.find('1').travel(-3600)

.trigger (event, detail)

@param {string} event - 事件名称
@params {*} detail - 事件需要携带的数据
@returns {TaskInstance}
let myKickoff = kickoff({
  target: '#my-kickoff'
}, [{
  wbs: '1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-22 23:59:59'
}])
// @example 在wbs编号为1的任务上触发一个自定义事件,监听过此事件的回调会依次执行,且会在回调函数
// 的第二个参数位置收到触发时携带的数据
myKickoff.task.find('1').trigger('my-custom-event', {foo: 'bar'})

.type ( )

0.2.0新增
@returns {string} - 返回当前任务类型,task或milestone
let myKickoff = kickoff({
  target: '#my-kickoff'
}, [{
  wbs: '1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-22 23:59:59'
}, {
  wbs: '2',
  type: 'milestone',
  end: '2020-09-23 00:00:00'
}])
// @example 获取任务类型
myKickoff.task.find('1').type()
myKickoff.task.find('2').type()

.undo ( )

0.2.0新增
@returns {TaskInstance} - 撤销已执行的操作并返回当前任务实例
let myKickoff = kickoff({
  target: '#my-kickoff'
}, [{
  wbs: '1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-22 23:59:59'
}])
myKickoff.task.find('1').create({name: 'A child task'})
// @example 撤销创建任务操作,无论在根任务还是节点任务上调用,效果均相同。
myKickoff.task.undo()

.update (data)

@param {TaskInstanceData} data
@returns {TaskInstance}
let myKickoff = myKickoff({
  target: '#my-kickoff'
}, [{
  wbs: '1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-22 23:59:59'
}])
// @example 更新wbs编号为1的任务的结束时间
myKickoff.task.find('1').update({end: '2020-10-01 23:59:59'})

.where (filter)

@param {Function | Object} filter - 后代任务过滤函数或查询条件对象
@returns {TaskInstance[]}
let myKickoff = kickoff({
  target: '#my-kickoff'
}, [{
  wbs: '1',
  beginning: '2020-09-19 00:00:00',
  end: '2020-09-22 23:59:59'
}, {
  wbs: '2',
  beginning: '2020-09-23 00:00:00',
  end: '2020-09-30 23:59:59'
}])
// @example 查找开始时间为2020-09-19 00:00:00的后代任务
myKickoff.task.where({beginning: '2020-09-19 00:00:00'})
// @example 查找开始时间晚于2020-09-19 00:00:00的后代任务
myKickoff.task.where(function(task){
  return task.beginning().laterThan('2020-09-19 00:00:00')
})