forked from Yadro/time-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProjectModel.ts
More file actions
35 lines (29 loc) · 851 Bytes
/
ProjectModel.ts
File metadata and controls
35 lines (29 loc) · 851 Bytes
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
import * as colors from '@ant-design/colors';
import AbstractModel from '../../../base/AbstractModel';
import { ITreeItem } from '../../../types/ITreeItem';
export const DEFAULT_PROJECTS: any[] = [
{
key: '1',
title: 'Inbox',
color: colors.blue,
},
];
interface IJsonProjectItem extends ITreeItem<IJsonProjectItem> {
color: string;
}
interface IProjectModel extends ITreeItem<IProjectModel> {
color: string;
}
export default class ProjectModel extends AbstractModel
implements IProjectModel {
key: string = '';
title: string = '';
color: string = '';
expanded: boolean = false;
children?: ProjectModel[] = [];
constructor(props: IJsonProjectItem) {
super();
this.load(props); // TODO вынести итератор
this.children = props.children?.map((json) => new ProjectModel(json)) || [];
}
}