-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathassignment-card.component.js
More file actions
62 lines (53 loc) · 1.99 KB
/
assignment-card.component.js
File metadata and controls
62 lines (53 loc) · 1.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import { ContainerBaseComponent } from "./container-base.component.js";
export class AssignmentCardComponent extends ContainerBaseComponent {
childrenPConns;
arMainButtons$;
arSecondaryButtons$;
actionButtonClick;
props;
actionButtonsComponent;
constructor(componentsManager, pConn, childrenPConns, mainButtons, secondaryButtons, actionButtonClick) {
super(componentsManager, pConn);
this.type = "AssignmentCard";
this.childrenPConns = childrenPConns;
this.arMainButtons$ = mainButtons;
this.arSecondaryButtons$ = secondaryButtons;
this.actionButtonClick = actionButtonClick;
}
init() {
this.componentsManager.onComponentAdded(this);
this.reconcileChildren(this.childrenPConns);
this.actionButtonsComponent = this.componentsManager.create("ActionButtons", [
this.arMainButtons$,
this.arSecondaryButtons$,
this.actionButtonClick,
]);
this.actionButtonsComponent.init();
this.sendPropsUpdate();
}
destroy() {
super.destroy();
this.destroyChildren();
this.sendPropsUpdate();
this.componentsManager.onComponentRemoved(this);
}
update(pConn, pConnChildren, mainButtons, secondaryButtons) {
this.pConn = pConn;
this.childrenPConns = pConnChildren;
this.arMainButtons$ = mainButtons;
this.arSecondaryButtons$ = secondaryButtons;
this.reconcileChildren(this.childrenPConns);
this.sendPropsUpdate();
this.actionButtonsComponent.update(this.arMainButtons$, this.arSecondaryButtons$, this.actionButtonClick);
}
onEvent(event) {
this.childrenComponents.forEach((component) => component.onEvent(event));
}
sendPropsUpdate() {
this.props = {
children: this.getChildrenComponentsIds(),
actionButtons: this.actionButtonsComponent.compId,
};
this.componentsManager.onComponentPropsUpdate(this);
}
}