Skip to content

Commit 312d02d

Browse files
[update] cards property (add comments and votes parameters)
1 parent 777a061 commit 312d02d

File tree

5 files changed

+77
-29
lines changed

5 files changed

+77
-29
lines changed

docs/api/config/js_kanban_cards_config.md

Lines changed: 46 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,29 @@ cards?: [
2222
start_date?: Date,
2323
end_date?: Date,
2424
attached?: [
25-
id: string | number,
26-
url?: string,
27-
previewURL?: string,
28-
coverURL?: string,
29-
name?: string,
30-
isCover?: boolean
25+
{
26+
id: string | number,
27+
url?: string,
28+
previewURL?: string,
29+
coverURL?: string,
30+
name?: string,
31+
isCover?: boolean
32+
}, {...}
3133
],
3234
color?: string,
3335
users?: array,
3436
priority?: string | number,
3537
css?: string,
38+
votes?: array,
39+
comments?: [
40+
{
41+
id: string | number,
42+
userId: string | number,
43+
cardId: string | number,
44+
text?: string,
45+
date?: Date,
46+
},{...}
47+
],
3648
[custom_key: string]?: any
3749
},
3850
{...} // other cards data
@@ -47,10 +59,10 @@ For each card you can specify the following parameters (data):
4759
- `label` - (optional) a card label. It is displayed in the **Label** field
4860
- `description` - (optional)a card description. It is displayed in the **Description** field
4961
- `progress` - (optional) a progress bar value. You can specify the value in the range from 0 to 100 points. It is displayed in the **Progress bar** field
50-
- `start_date` - (optional) a start date value. It is displayed in the **Start date** field
51-
- `end_date` - (optional) an end date value. It is displayed in the **End date** field
52-
- `attached` - (optional) an array with data of the attached file(s). It is displayed in the **Attachment** field. Here you can specify the following parameters:
53-
- `id` - (required) an **ID** of the attached file
62+
- `start_date` - (optional) a start Date object (do not specify a string date). It is displayed in the **Start date** field
63+
- `end_date` - (optional) an end Date object (do not specify a string date). It is displayed in the **End date** field
64+
- `attached` - (optional) an array of objects with data of the attached file(s). It is displayed in the **Attachment** field. For each object you can specify the following parameters:
65+
- `id` - (required) an **ID** of the attached file
5466
- `url` - (optional) a path to the file to be attached
5567
- `previewURL` - (optional) a path to the preview image
5668
- `coverURL` - (optional) a path to the image to be set as a cover
@@ -60,6 +72,13 @@ For each card you can specify the following parameters (data):
6072
- `users` - (optional) an array with the assigned users **ID**s. To specify the assigned users, you need to define an array with users data in the [cardShape.users](../js_kanban_cardshape_config) property. The users are displayed in the **Users** field
6173
- `priority` - (optional) a card priority **ID**. To specify the card priority, you need to define an array with priorities data in the [cardShape.priority](../js_kanban_cardshape_config) property. It is displayed in the **Priority** field
6274
- `css` - (optional) defines css styles for a separate card
75+
- `votes` - (optional) an array of user IDs
76+
- `comments` - (optional) an array of objects with data of comments. For each comment's object you can specify the following parameters:
77+
- `id` - (required) an **ID** of the comment
78+
- `userId` - (required) an **ID** of a user that posted the comment
79+
- `cardId` - (required) an **ID** of the card that the comment belongs to
80+
- `text` - (optional) a text of the comment. It also can contain html markup
81+
- `date` - (optional) a Date object (do not specify a string date). The date when the comment was posted. It is not updated after editing
6382
- `custom_key` - (optional) a custom key of the card. You can specify the custom keys to place the card into column and row. See the [columnKey](../js_kanban_columnkey_config) and [rowKey](../js_kanban_rowkey_config) properties
6483

6584
:::info
@@ -68,15 +87,15 @@ If you want to load new data for cards dynamically, you can use the [**parse()**
6887

6988
### Example
7089

71-
~~~jsx {1-32,36}
90+
~~~jsx {1-40,44}
7291
const cards = [
7392
{
7493
id: 1,
7594
label: "Integration with React",
7695
description: "Some description",
7796
progress: 25,
78-
start_date: new Date("01/05/2021"),
79-
end_date: new Date("01/15/2021"),
97+
start_date: new Date("02/24/2022"),
98+
end_date: new Date("02/24/2023"),
8099
attached: [
81100
{
82101
id: 234,
@@ -85,11 +104,20 @@ const cards = [
85104
coverURL: "../assets/img-1.jpg",
86105
name: "img-1.jpg",
87106
isCover: true
88-
},
89-
{...} // other attached files data
107+
}, {...} // other attached files data
90108
],
91109
color: "#65D3B3",
92-
users: [1, 2],
110+
users: [1,2],
111+
votes: [3,6,8],
112+
comments: [
113+
{
114+
id: 1,
115+
userId: 1,
116+
cardId: 1,
117+
text: "Greetings, fellow colleagues. I would like to share my insights on this task. I reckon we should deal with at least half of the points in the plan without further delays. ",
118+
date: new Date(),
119+
}, {...}
120+
],
93121
priority: 1,
94122
// custom field to place the card into the "feature" row
95123
// the rowKey config needs to be set to the "type" value
@@ -98,8 +126,7 @@ const cards = [
98126
// the columnKey config needs to be set to the "stage" value
99127
stage: "backlog",
100128
css: "red",
101-
},
102-
{...} // other cards data
129+
},{...} // other cards data
103130
];
104131

105132
new kanban.Kanban("#root", {
@@ -109,7 +136,7 @@ new kanban.Kanban("#root", {
109136
});
110137
~~~
111138

112-
**Change log:** The ***css*** parameter was added in v1.4
139+
**Change log:** The ***css***, ***comments*** and ***votes*** parameters were added in v1.4
113140

114141
**Related articles:**
115142
- [Working with data](../../../guides/working_with_data)

docs/api/config/js_kanban_links_config.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ If you want to load new data for links dynamically, you can use the [**parse()**
4646
~~~jsx {1-9,14}
4747
const links = [
4848
{
49-
id: string | number,
50-
masterId: string | number,
51-
slaveId: string | number,
52-
relation: "relatesTo" | "requiredFor" | "duplicate" | "parent",
49+
id: 1,
50+
masterId: 2,
51+
slaveId: 5,
52+
relation: "relatesTo",
5353
},
5454
{...}
5555
];

docs/guides/working_with_data.md

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ description: You can explore how to work with Data in the documentation of the D
1010

1111
When initializing Kanban, you can provide the initial data for [**columns**](api/config/js_kanban_columns_config.md), [**cards**](api/config/js_kanban_cards_config.md), [**rows**](api/config/js_kanban_rows_config.md) and [**links**](api/config/js_kanban_links_config.md).
1212

13-
~~~jsx {1,17,70,83,95-98}
13+
~~~jsx {1,17,81,94,106-109}
1414
const columns = [ // data for columns
1515
{
1616
label: "Backlog",
@@ -39,10 +39,21 @@ const cards = [ // data for cards
3939
end_date: new Date("01/15/2021"),
4040

4141
progress: 25,
42-
users: [1, 2, 3, 4],
42+
users: [1,2,3,4],
4343
sprint: "1.0",
4444
column: "backlog",
45-
type: "feature"
45+
type: "feature",
46+
css: "red",
47+
votes: [4,6,9],
48+
comments: [
49+
{
50+
id: 1,
51+
userId: 9,
52+
cardId: 6,
53+
text: "Greetings, fellow colleagues. I would like to share my insights on this task. I reckon we should deal with at least half of the points in the plan without further delays.",
54+
date: new Date(),
55+
},{...}
56+
]
4657
},
4758
{
4859
id: 2,

docs/news/migration.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,13 +158,23 @@ description: You can learn about the Migration to Newer Versions in the document
158158
]
159159
~~~
160160

161-
~~~jsx {6} title="From v1.4"
161+
~~~jsx {6-18} title="From v1.4"
162162
[
163163
{
164164
id: 1,
165165
label: "Integration with React",
166166
description: "Some description",
167-
css: "red"
167+
css: "red",
168+
votes: [4,6,9],
169+
comments: [
170+
{
171+
id: 1,
172+
userId: 9,
173+
cardId: 6,
174+
text: "Greetings, fellow colleagues. I would like to share my insights on this task. I reckon we should deal with at least half of the points in the plan without further delays.",
175+
date: new Date(),
176+
},{...}
177+
]
168178
// other parameters
169179
}, ...
170180
]

docs/news/whats_new.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ Released on March 21, 2023
7777
- The [`api.getState()`](../../api/internal/js_kanban_getstate_method) method is updated
7878
- #### Properties
7979

80-
- The [`cards`](../../api/config/js_kanban_cards_config) property is extended by the ***css*** parameter
80+
- The [`cards`](../../api/config/js_kanban_cards_config) property is extended by the ***css***, ***comments*** and ***votes*** parameters
8181
- The [`cardShape`](../../api/config/js_kanban_cardshape_config) property is extended by the ***comments***, ***votes*** ([Example](https://snippet.dhtmlx.com/5hcx01h4?tag=kanban)) and ***css*** ([Example](https://snippet.dhtmlx.com/7fvc3rr1?tag=kanban)) parameters.
8282
- The [`cardTemplate`](../../api/config/js_kanban_cardtemplate_config) property has an ability to display context menu
8383
- The [`columns`](../../api/config/js_kanban_columns_config) property is extended by the ***css*** ([Example](https://snippet.dhtmlx.com/fnlvd2g5?tag=kanban)) and ***overlay*** ([Example](https://snippet.dhtmlx.com/nfv59yif?tag=kanban)) parameters

0 commit comments

Comments
 (0)