Skip to content

Commit bc890d6

Browse files
Merge pull request #36 from DHTMLX/sp_next_v2.0
Whats new before release v1.6
2 parents 567c751 + 2740876 commit bc890d6

15 files changed

+281
-51
lines changed

docs/api/config/js_kanban_cardshape_config.md

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ cardShape?: {
5454
avatar?: string
5555
},
5656
{...} // other users data
57-
]
57+
],
58+
maxCount?: number | false
5859
},
5960
priority?: boolean | {
6061
show?: boolean,
@@ -67,7 +68,10 @@ cardShape?: {
6768
{...} // other priorities data
6869
]
6970
},
70-
votes?: boolean | { show?: boolean },
71+
votes?: boolean | {
72+
show?: boolean,
73+
clickable?: boolean
74+
},
7175
css?: (card) => string,
7276
headerFields?: [
7377
{
@@ -151,6 +155,10 @@ To configure the card appearance, in the **cardShape** object you can specify th
151155
- `id` - (required) a user **ID**
152156
- `label` - (optional) a user name
153157
- `avatar` - (optional) a path to the user avatar
158+
- `maxCount` - (optional) a maximum count of users displayed on the card (or ***false***)
159+
160+
You can set the `maxCount` property to the number of users to be displayed on the card.
161+
If you set the `maxCount` property to `false`, you can see all the assigned user on the card.
154162

155163
:::info
156164
The ***users*** field is disabled by default. To enable it, you need to set the `show` parameter to `true` and provide the corresponding users data via the `values` parameter. To assign new users via the editor, you need to configure the corresponding control via the [`editorShape`](api/config/js_kanban_editorshape_config.md#--parameters-for-combo-select-and-multiselect-types) property. Use the ***select*** type for assigning one or user or the ***multiselect*** type for assigning several users.
@@ -162,7 +170,8 @@ To configure the card appearance, in the **cardShape** object you can specify th
162170
values: [
163171
{ id: 1, label: "John Smith", avatar: "../assets/user.jpg" },
164172
{ id: 2, label: "Aaron Short" }
165-
]
173+
],
174+
maxCount: 4 // only 4 users can be displayed on the card
166175
}
167176
}
168177
~~~
@@ -174,7 +183,9 @@ To configure the card appearance, in the **cardShape** object you can specify th
174183
- `id` - (required) a priority **ID**
175184
- `label` - (optional) a priority name
176185
- `color` - (required) a valid HEX code
177-
- `votes` - (optional) shows/hides **votes** on cards. If **true**, the corresponding control will be displayed in the editor
186+
- `votes` - (optional) specifies the **votes** functionality
187+
- `show` - (optional) shows/hides the vote icon on the card and in the editor
188+
- `clickable` - (optional) - makes the vote icon on the card clickable. If `true`, users can vote for the card using the vote icon on this card. Otherwise, users can vote for the card using the vote icon in the editor only
178189
- `css` - a function returns a css class that applies to cards conditionally
179190
- `headerFields` - (optional) an array of objects with the **custom fields** data. Here you can specify the following parameters:
180191
- `key` - (required) a key of the custom field. It is used when configuring the Editor via the [editorShape](../js_kanban_editorshape_config) property
@@ -224,19 +235,22 @@ const defaultCardShape = {
224235
show: false,
225236
values: defaultColors
226237
},
227-
users: false,
238+
users: {
239+
show: false,
240+
maxCount: 2
241+
},
228242
priority: {
229243
show: false,
230244
values: defaultPriorities
231245
},
232246
comments: false,
233-
votes: false,
247+
votes: false
234248
};
235249
~~~
236250

237251
### Example
238252

239-
~~~jsx {14-45,50}
253+
~~~jsx {14-49,54}
240254
const users = [ // users data
241255
{ id: 1, label: "John Smith", avatar: "../assets/user.jpg" },
242256
{ id: 2, label: "Aaron Short" }
@@ -266,13 +280,17 @@ const cardShape = { // card settings
266280
},
267281
users: {
268282
show: true,
269-
values: users
283+
values: users,
284+
maxCount: false
270285
},
271286
priority: {
272287
show: true,
273288
values: cardPriority
274289
},
275-
votes: true,
290+
votes: {
291+
show: true,
292+
clickable: true
293+
},
276294
css: (card) => card.type == "feature" ? "green" : "red",
277295
headerFields: [
278296
{ // custom field
@@ -294,11 +312,12 @@ new kanban.Kanban("#root", {
294312
**Change log:**
295313
- The ***comments***, ***css*** and ***votes*** parameters were added in v1.4
296314
- The ***menu.items[0].label*** parameter was replaced by the ***menu.items[0].text*** parameter in v1.4
315+
- The ***users.maxCount*** and ***votes.clickable*** parameters were added in v1.6
297316

298317
**Related articles:** [Configuration](../../../guides/configuration#cards)
299318

300319
**Related samples:**
301-
302320
- [Kanban. Swimlanes, comments, votes](https://snippet.dhtmlx.com/5hcx01h4?tag=kanban)
303321
- [Kanban. Highlighting outdated and active tasks](https://snippet.dhtmlx.com/7fvc3rr1?tag=kanban)
304-
- [Kanban. Styling cards](https://snippet.dhtmlx.com/qu6rpktk?tag=kanban)
322+
- [Kanban. Styling cards](https://snippet.dhtmlx.com/qu6rpktk?tag=kanban)
323+
- [Kanban. Unlimited user assignments per task](https://snippet.dhtmlx.com/w205dvzg?tag=kanban)

docs/api/config/js_kanban_columnshape_config.md

Lines changed: 42 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,13 @@ columnShape?: {
2828
] | ({ column, columnIndex, columns, store }) => array | boolean
2929
},
3030
fixedHeaders?: boolean,
31-
css?: (column, cards) => string
31+
css?: (column, cards) => string,
32+
headerTemplate?: template(column => {
33+
return "The HTML template of the column header in the expanded state";
34+
}),
35+
collapsedTemplate?: template(column => {
36+
return "The HTML template of the column header in the collapsed state";
37+
})
3238
};
3339
~~~
3440

@@ -80,8 +86,10 @@ To configure the columns appearance, in the **columnShape** object you can speci
8086
~~~
8187
:::
8288

83-
- `fixedHeaders` - (optional) freezes column headers during vertical scroll (*true* by default). Scroll must be enabled in Kanban itself (height must be limited).
84-
- `css` - (optional) a function returns a css class that applies to columns conditionally
89+
- `fixedHeaders` - (optional) freezes column headers during vertical scroll (*true* by default). Scroll must be enabled in Kanban itself (height must be limited)
90+
- `css` - (optional) a function that returns a css class that applies to columns conditionally
91+
- `headerTemplate` - (optional) the HTML template of the column header in the expanded state
92+
- `collapsedTemplate` - (optional) the HTML template of the column header in the collapsed state
8593

8694
### Default config
8795

@@ -114,7 +122,7 @@ const columnShape = {
114122

115123
### Example
116124

117-
~~~jsx {1-30,36}
125+
~~~jsx {1-58,64}
118126
const columnShape = {
119127
menu: {
120128
show: true,
@@ -143,7 +151,34 @@ const columnShape = {
143151
]
144152
},
145153
fixedHeaders: false,
146-
css: (column, cards) => column.id == "inprogress" && cards.length < 5 ? "green" : "red"
154+
css: (column, cards) => column.id == "inprogress" && cards.length < 5 ? "green" : "red",
155+
headerTemplate: template(column => {
156+
return `<div class="wx-collapse-icon" data-action=${"collapse"}>
157+
<i class=${column.column.collapsed ? "wxi-angle-right" : "wxi-angle-left"}></i>
158+
</div>
159+
${
160+
!column.column.collapsed
161+
? `<div class="wx-label" data-action="rename">
162+
${escapeHTML(column.column.label)}
163+
(${column.columnState.cardsCount})
164+
</div>`
165+
: ""
166+
}
167+
${
168+
!column.column.collapsed
169+
? `<div class="wx-menu" data-menu-id={column.id}>
170+
<i class="wxi-dots-h"></i>
171+
</div>`
172+
: ""
173+
}`;
174+
}),
175+
collapsedTemplate: template(column => {
176+
return `<div class="wx-collapsed-label">
177+
<div class="wx-label-text">${escapeHTML(column.column.label)} (${
178+
column.columnState?.cardsCount
179+
})</div>
180+
</div>`;
181+
})
147182
};
148183
149184
new kanban.Kanban("#root", {
@@ -159,9 +194,11 @@ new kanban.Kanban("#root", {
159194
- The ***css*** parameter was added in v1.4
160195
- The ***menu.items[0].label*** parameter was replaced by the ***menu.items[0].text*** parameter in v1.4
161196
- The ***fixedHeaders*** parameter was added in v1.5
197+
- The ***headerTemplate*** and ***collapsedTemplate*** parameters were added in v1.6
162198
163199
**Related articles:** [Configuration](../../../guides/configuration)
164200
165201
**Related samples:**
166202
- [Kanban. Changing color of column via custom menu](https://snippet.dhtmlx.com/fnlvd2g5?tag=kanban)
167203
- [Kanban. Fixed headers, lazy rendering and column scroll](https://snippet.dhtmlx.com/xez9ghqq?tag=kanban)
204+
- [Kanban. Template for column headers](https://snippet.dhtmlx.com/gq2saz9c?tag=kanban)

docs/api/config/js_kanban_editor_config.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,36 +15,44 @@ description: You can learn about the editor config in the documentation of the D
1515
~~~jsx {}
1616
editor?: {
1717
autoSave?: boolean,
18-
debounce?: number
18+
debounce?: number,
19+
placement?: "sidebar" | "modal"
1920
};
2021
~~~
2122

2223
### Parameters
2324

2425
- `autoSave` - (optional) enables/disables an autosave mode of editor
2526
- `debounce` - (optional) time of delay of autosaving data (works with the ***autoSave: true*** parameter only)
27+
- `placement` - (optional) specifies the editor placement. You can set the following values:
28+
- `"sidebar"` - displays the editor as a sidebar
29+
- `"modal"` - displays the editor as a modal window
2630

2731
### Default config
2832

2933
~~~jsx {}
3034
editor: {
3135
autoSave: true,
3236
debounce: 100
37+
placement: "sidebar"
3338
}
3439
~~~
3540

3641
### Example
3742

38-
~~~jsx {4-7}
43+
~~~jsx {4-8}
3944
new kanban.Kanban("#root", {
4045
columns,
4146
cards,
4247
editor: {
4348
autoSave: true,
44-
debounce: 2000
49+
debounce: 2000,
50+
placement: "modal"
4551
}
4652
// other parameters
4753
});
4854
~~~
4955

50-
**Change log:** The property was added in v1.3
56+
**Change log:** The `placement` parameter was added in v1.6
57+
58+
**Related samples:** [Kanban. Opening the editor in a modal window](https://snippet.dhtmlx.com/vt6pe7qz?tag=kanban)

docs/api/config/js_kanban_theme_config.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ description: You can learn about the theme config in the documentation of the DH
1515
~~~jsx {}
1616
theme?: {
1717
name: string, // "material" (default) | "willow" | "willow-dark"
18-
fonts: boolean
18+
fonts?: boolean
1919
};
2020
~~~
2121

@@ -62,7 +62,7 @@ To configure the **theme**, you can use the following parameters.
6262
- `fonts` - (optional) enables/disables fonts loading from the CDN (wxi font)
6363

6464
:::tip
65-
You can also apply the **Willow** and **Willow-Dark** themes as well. To change the current theme dynamically, you can use the [**setConfig()**](../../methods/js_kanban_setconfig_method) method.
65+
You can also apply the **Willow** and **Willow-Dark** themes as well. To change the current theme dynamically, you can use the [`setTheme()`](../../methods/js_kanban_settheme_method) method.
6666
:::
6767

6868
### Default config

docs/api/config/toolbar_items_config.md

Lines changed: 36 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,14 @@ items?: [
2121
{
2222
id: string,
2323
label: string,
24-
searchRule?: (card, value, by) => {} // returns a boolean value
24+
searchRule?: (card, value, by) => {
25+
return boolean
26+
}
2527
}, {...}
26-
]
28+
],
29+
resultTemplate?: template(searchResult => {
30+
return "The HTML template of the search result";
31+
})
2732
},
2833
"sort" | {
2934
// sort parameters
@@ -34,8 +39,7 @@ items?: [
3439
by?: string, // by?: ((card: object) => any),
3540
dir?: "asc" | "desc"
3641
}, {...}
37-
]
38-
42+
]
3943
},
4044
"spacer",
4145
"undo",
@@ -57,18 +61,21 @@ In the **items** array you can specify the following parameters:
5761
- `type` - (required) a type of control (*"search"*)
5862
- `options` - (optional) an array of objects, that define the search parameters. For each object (*search option*) you can specify the following parameters:
5963
- `id` - (required) a key of card field, by which the cards will be searched
60-
- `label` - (required) a name of option, used in a dropdown list of the searchbar selector
64+
- `label` - (required) a name of option, used in a dropdown list of the search bar selector
6165
- `searchRule` (optional) - a custom function that allows defining search rules. It takes the following arguments:
6266
- ***card*** - an object of the card data
63-
- ***value*** - a searched value, specified in the searchbar
67+
- ***value*** - a searched value, specified in the search bar
6468
- ***by*** - a key of card field, by which the cards will be searched
69+
- `searchResult` - (optional) a template for displaying the custom search result
6570

6671
~~~jsx
6772
items: [
6873
"search", // default searchbar
6974
// other controls
7075
]
76+
7177
// or
78+
7279
items: [
7380
{ // custom searchbar
7481
type: "search",
@@ -85,7 +92,13 @@ items: [
8592
return date?.toString().includes(value);
8693
}
8794
}
88-
]
95+
],
96+
resultTemplate: kanban.template(searchResult => {
97+
return `<div class="list-item">
98+
<div class="list-item-text">${searchResult.result.label}</div>
99+
${searchResult.result.description ? `<div class="list-item-text item-description">${searchResult.result.description}</div>` : ""}
100+
</div>`
101+
})
89102
},
90103
// other controls
91104
]
@@ -138,7 +151,7 @@ items: [
138151

139152
### Example
140153

141-
~~~jsx {8-16}
154+
~~~jsx {8-24}
142155
const board = new kanban.Kanban("#root", {
143156
columns,
144157
cards
@@ -147,21 +160,33 @@ const board = new kanban.Kanban("#root", {
147160
new kanban.Toolbar("#toolbar", {
148161
api: board.api,
149162
items: [
150-
"search",
163+
{
164+
type: "search",
165+
resultTemplate: kanban.template(searchResult => {
166+
return `<div class="list-item">
167+
<div class="list-item-text">${searchResult.result.label}</div>
168+
${searchResult.result.description ? `<div class="list-item-text item-description">${searchResult.result.description}</div>` : ""}
169+
</div>`
170+
})
171+
},
151172
"spacer",
152173
"sort",
153174
"undo",
154175
"redo",
155176
"addColumn",
156177
"addRow"
157-
],
178+
]
158179
});
159180
~~~
160181

161182
**Change log:**
183+
162184
- The *"Undo"* and *"Redo"* controls were added in v1.3
163185
- The ***items.options[0].label*** parameter of the **sort** control was replaced by the ***items.options[0].text*** parameter in v1.4
186+
- The ***items.searchResult*** parameter of the **"search"** control was added in v1.6
164187

165188
**Related articles:** [Configuration](../../../guides/configuration#toolbar) and [Customization](../../../guides/customization#custom-toolbar)
166189

167-
**Related sample:** [Kanban. Custom toolbar](https://snippet.dhtmlx.com/s5r5h4ju?tag=kanban)
190+
**Related sample:**
191+
- [Kanban. Custom toolbar](https://snippet.dhtmlx.com/s5r5h4ju?tag=kanban)
192+
- [Kanban. Customization of suggestions in search results](https://snippet.dhtmlx.com/2uo2f5mf?tag=kanban)

0 commit comments

Comments
 (0)