|
|
@ -121,16 +121,23 @@ class ProgramSequenceView extends React.Component<{ |
|
|
|
const editing = this.props.editing || false; |
|
|
|
const editing = this.props.editing || false; |
|
|
|
const className = classNames("programSequence", { editing }); |
|
|
|
const className = classNames("programSequence", { editing }); |
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<ProgramSequenceList |
|
|
|
<div> |
|
|
|
className={className} |
|
|
|
<ProgramSequenceList |
|
|
|
useDragHandle |
|
|
|
className={className} |
|
|
|
list={sequence} |
|
|
|
useDragHandle |
|
|
|
sections={sections} |
|
|
|
helperClass="dragging" |
|
|
|
editing={editing} |
|
|
|
list={sequence} |
|
|
|
onChange={this.changeItem} |
|
|
|
sections={sections} |
|
|
|
onRemove={this.removeItem} |
|
|
|
editing={editing} |
|
|
|
onSortEnd={this.onSortEnd} |
|
|
|
onChange={this.changeItem} |
|
|
|
/> |
|
|
|
onRemove={this.removeItem} |
|
|
|
|
|
|
|
onSortEnd={this.onSortEnd} |
|
|
|
|
|
|
|
/> |
|
|
|
|
|
|
|
<Button onClick={this.addItem}> |
|
|
|
|
|
|
|
<Icon name="add"/> |
|
|
|
|
|
|
|
Add item |
|
|
|
|
|
|
|
</Button> |
|
|
|
|
|
|
|
</div> |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -142,6 +149,24 @@ class ProgramSequenceView extends React.Component<{ |
|
|
|
this.props.sequence.splice(index, 1); |
|
|
|
this.props.sequence.splice(index, 1); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private addItem = () => { |
|
|
|
|
|
|
|
let sectionId = 0; |
|
|
|
|
|
|
|
for (const section of this.props.sections) { |
|
|
|
|
|
|
|
const sectionNotIncluded = this.props.sequence |
|
|
|
|
|
|
|
.every((sequenceItem) => |
|
|
|
|
|
|
|
sequenceItem.section !== section.id); |
|
|
|
|
|
|
|
if (sectionNotIncluded) { |
|
|
|
|
|
|
|
sectionId = section.id; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
const item = new ProgramItem({ |
|
|
|
|
|
|
|
section: sectionId, |
|
|
|
|
|
|
|
duration: new Duration(5, 0).toSeconds(), |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
this.props.sequence.push(item); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private onSortEnd = ({oldIndex, newIndex}: SortEnd) => { |
|
|
|
private onSortEnd = ({oldIndex, newIndex}: SortEnd) => { |
|
|
|
const { sequence: array } = this.props; |
|
|
|
const { sequence: array } = this.props; |
|
|
|
if (newIndex >= array.length) { |
|
|
|
if (newIndex >= array.length) { |
|
|
|