Skip to content

Commit 5872ecf

Browse files
Merge pull request #104 from DHTMLX/next
Fixed missing information and typos
2 parents 0c41c87 + ac719b1 commit 5872ecf

81 files changed

Lines changed: 2239 additions & 222 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/api/config/js_kanban_cardheight_config.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ cardHeight?: number; // px
1919
:::important
2020
If you combine the [`renderType: "lazy"`](api/config/js_kanban_rendertype_config.md) and [`scrollType: "default"`](api/config/js_kanban_scrolltype_config.md) settings, don't forget to specify a static height for cards via the `cardHeight` property. Unless you specify it, the cards will not be displayed.
2121
When you use [`renderType: "lazy"`](api/config/js_kanban_rendertype_config.md) with [`scrollType: "column"`](api/config/js_kanban_scrolltype_config.md), you should also fix the height of cards via the `cardHeight` property. Although a variable height of cards is supported for this type of layout, it may not work in a stable manner with custom card content.
22+
23+
If `cardHeight` is not specified, the widget falls back to an experimental approximation of card heights based on the visible fields declared in [`cardShape`](api/config/js_kanban_cardshape_config.md). With a custom [`cardTemplate`](api/config/js_kanban_cardtemplate_config.md), this approximation does not apply — in that case, either set `cardHeight` explicitly or supply a custom [`getCardHeight`](api/config/js_kanban_getcardheight_config.md) function.
2224
:::
2325

2426
### Example

docs/api/config/js_kanban_columnshape_config.md

Lines changed: 34 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ columnShape?: {
3030
},
3131
fixedHeaders?: boolean,
3232
css?: (column, cards) => string,
33-
headerTemplate?: template(column => {
33+
headerTemplate?: template(props => {
3434
return "The HTML template of the column header in the expanded state";
3535
}),
36-
collapsedTemplate?: template(column => {
36+
collapsedTemplate?: template(props => {
3737
return "The HTML template of the column header in the collapsed state";
3838
}),
3939
confirmDeletion?: boolean
@@ -94,8 +94,28 @@ To configure the columns appearance, in the **columnShape** object you can speci
9494

9595
- `fixedHeaders` - (optional) freezes column headers during vertical scroll (*true* by default). Scroll must be enabled in Kanban itself (height must be limited)
9696
- `css` - (optional) a function that returns a css class that applies to columns conditionally
97-
- `headerTemplate` - (optional) the HTML template of the column header in the expanded state
98-
- `collapsedTemplate` - (optional) the HTML template of the column header in the collapsed state
97+
- `headerTemplate` - (optional) the HTML template of the column header in the expanded state. The function receives a `props` object with the following properties:
98+
- `column` - (object) the column data (see [`columns`](api/config/js_kanban_columns_config.md) for the structure)
99+
- `columnState` - (object) the current state of the column. It always includes:
100+
- ***columnId*** - (string | number) the ID of the column
101+
- ***column*** - (object) the column data (same as `props.column`)
102+
- ***cardsCount*** - (number) the number of cards in the column
103+
- ***noFreeSpace*** - (boolean) ***true*** when the column cannot accept more cards
104+
105+
When the [`columns[i].limit`](api/config/js_kanban_columns_config.md) parameter is enabled, it also includes:
106+
- ***totalLimit*** - (number) the configured cards limit
107+
- ***isOverLimit*** - (boolean) ***true*** when the number of cards exceeds the limit
108+
109+
When the column belongs to a swimlane (row), it also includes:
110+
- ***rowId*** - (string | number) the ID of the row
111+
- ***row*** - (object) the row data (see [`rows`](api/config/js_kanban_rows_config.md) for the structure)
112+
- ***height*** - (number) the height of the area
113+
- `isMenuVisible` - (boolean) ***true*** when the menu should be shown for this column header
114+
- `renaming` - (boolean) ***true*** when the input for editing the column name is active
115+
- `readonly` - (boolean) ***true*** when column editing is disabled (equivalent of `!readonly.edit`, see the [`readonly`](api/config/js_kanban_readonly_config.md) property)
116+
- `collapsedTemplate` - (optional) the HTML template of the column header in the collapsed state. The function receives a `props` object with the following properties:
117+
- `column` - (object) the column data (see [`columns`](api/config/js_kanban_columns_config.md))
118+
- `columnState` - (object) the current state of the column. The shape is the same as `columnState` in the [`headerTemplate`](#parameters) parameter above
99119
- `confirmDeletion` - (optional) shows/hides the **confirmation dialog** that allows users to confirm or decline the column deletion
100120

101121
### Default config
@@ -160,30 +180,30 @@ const columnShape = {
160180
},
161181
fixedHeaders: false,
162182
css: (column, cards) => column.id == "inprogress" && cards.length < 5 ? "green" : "red",
163-
headerTemplate: template(column => {
183+
headerTemplate: template(props => {
164184
return `<div class="wx-collapse-icon" data-action=${"collapse"}>
165-
<i class=${column.column.collapsed ? "wxi-angle-right" : "wxi-angle-left"}></i>
185+
<i class=${props.column.collapsed ? "wxi-angle-right" : "wxi-angle-left"}></i>
166186
</div>
167187
${
168-
!column.column.collapsed
188+
!props.column.collapsed
169189
? `<div class="wx-label" data-action="rename">
170-
${escapeHTML(column.column.label)}
171-
(${column.columnState.cardsCount})
190+
${escapeHTML(props.column.label)}
191+
(${props.columnState.cardsCount})
172192
</div>`
173193
: ""
174194
}
175195
${
176-
!column.column.collapsed
177-
? `<div class="wx-menu" data-menu-id=${column.id}>
196+
!props.column.collapsed
197+
? `<div class="wx-menu" data-menu-id=${props.column.id}>
178198
<i class="wxi-dots-h"></i>
179199
</div>`
180200
: ""
181201
}`;
182202
}),
183-
collapsedTemplate: template(column => {
203+
collapsedTemplate: template(props => {
184204
return `<div class="wx-collapsed-label">
185-
<div class="wx-label-text">${escapeHTML(column.column.label)} (${
186-
column.columnState?.cardsCount
205+
<div class="wx-label-text">${escapeHTML(props.column.label)} (${
206+
props.columnState?.cardsCount
187207
})</div>
188208
</div>`;
189209
}),

docs/api/config/js_kanban_editorshape_config.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ editorShape?: [
1919
type: string,
2020
key: string,
2121
label?: string,
22+
modalSection?: "left" | "right",
2223

2324
// for the "dateRange" type only
2425
key: {
@@ -182,6 +183,9 @@ In the Kanban editor you can use the following types of fields: **dateRange**, *
182183
~~~
183184

184185
- `label` - (optional) an editor field label
186+
- `modalSection` - (optional) defines in which column of the modal editor the field is placed. Applied only when the editor is shown as a modal window via the [`editor.placement: "modal"`](api/config/js_kanban_editor_config.md) property. The possible values are:
187+
- `"left"` - the field is placed in the left column
188+
- `"right"` - the field is placed in the right column (default)
185189

186190
#### - Parameters for a "dateRange" type
187191

@@ -466,6 +470,7 @@ new kanban.Kanban("#root", {
466470

467471
- The ***dateRange*** type was added in v1.3
468472
- The ***comments*** and ***links*** types of editor, and ***format*** parameters were added in v1.4
473+
- The ***modalSection*** parameter was added in v1.6
469474
- The ***clearButton*** parameter was replaced with the ***clear*** parameter
470475

471476
**Related articles:** [Configuration](guides/configuration.md/#editor)
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
---
2+
sidebar_label: getCardHeight
3+
title: getCardHeight Config
4+
description: You can learn about the getCardHeight config in the documentation of the DHTMLX JavaScript Kanban library. Browse developer guides and API reference, try out code examples and live demos, and download a free 30-day evaluation version of DHTMLX Kanban.
5+
---
6+
7+
# getCardHeight
8+
9+
### Description
10+
11+
@short: Optional. A function that returns an estimated height of a card
12+
13+
The `getCardHeight` function is used by the widget to estimate card heights when the [`cardHeight`](api/config/js_kanban_cardheight_config.md) property is not set and the board is configured with [`renderType: "lazy"`](api/config/js_kanban_rendertype_config.md) and [`scrollType: "column"`](api/config/js_kanban_scrolltype_config.md). The estimated heights let the widget render the scrollbar correctly before the actual cards are measured in the DOM.
14+
15+
:::info
16+
If you set the [`cardHeight`](api/config/js_kanban_cardheight_config.md) property, the widget uses the fixed height and `getCardHeight` is not called. Setting `cardHeight` is the recommended way to combine `renderType: "lazy"` with `scrollType: "column"`.
17+
:::
18+
19+
### Usage
20+
21+
~~~jsx {}
22+
getCardHeight?: (cardShape: object, card: object, cardWidth: number) => number;
23+
~~~
24+
25+
### Parameters
26+
27+
The callback function takes the following arguments:
28+
29+
- `cardShape` - the configuration object of the card (the [`cardShape`](api/config/js_kanban_cardshape_config.md) property)
30+
- `card` - the data object of the card
31+
- `cardWidth` - the current width of the card in pixels
32+
33+
The function must return a number — the estimated height of the card in pixels.
34+
35+
### Default config
36+
37+
By default, the widget uses a built-in function that approximates card height based on the visible fields declared in [`cardShape`](api/config/js_kanban_cardshape_config.md) and the data stored in the card. This default works for boards that rely on the built-in card layout.
38+
39+
If you provide a custom [`cardTemplate`](api/config/js_kanban_cardtemplate_config.md), the built-in approximation can no longer predict the actual height of the rendered markup. In this case, specify a custom `getCardHeight` function that returns the height of the rendered template, or set a static [`cardHeight`](api/config/js_kanban_cardheight_config.md) instead.
40+
41+
### Example
42+
43+
The example below provides a custom `getCardHeight` function for a board with a custom card template:
44+
45+
~~~jsx {15-22,27}
46+
const cardTemplate = ({ cardFields }) => {
47+
const { label, description } = cardFields;
48+
return `
49+
<div class="custom-card" style="padding:20px">
50+
<div class="custom-label">${label}</div>
51+
<div class="custom-description">${description || ""}</div>
52+
</div>
53+
`;
54+
};
55+
56+
new kanban.Kanban("#root", {
57+
cards,
58+
columns,
59+
renderType: "lazy",
60+
scrollType: "column",
61+
cardTemplate: kanban.template(card => cardTemplate(card)),
62+
getCardHeight: (cardShape, card, cardWidth) => {
63+
// estimate the height of the custom template
64+
let height = 60; // base padding + label line
65+
if (card.description) {
66+
height += Math.ceil(card.description.length / 40) * 18;
67+
}
68+
return height;
69+
},
70+
// other parameters
71+
});
72+
~~~
73+
74+
**Related articles:** [Configuration](guides/configuration.md#rendering-and-scrolling)

docs/api/config/js_kanban_rendertype_config.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ renderType?: "default" | "lazy";
2323
:::important
2424
If you combine the `renderType: "lazy"` and [`scrollType: "default"`](api/config/js_kanban_scrolltype_config.md) settings, don't forget to specify a static height for cards via the [`cardHeight`](api/config/js_kanban_cardheight_config.md) property. Unless you specify it, the cards will not be displayed correctly.
2525
When you use `renderType: "lazy"` with [`scrollType: "column"`](api/config/js_kanban_scrolltype_config.md), you should also fix the height of cards via the [`cardHeight`](api/config/js_kanban_cardheight_config.md) property. Although a variable height of cards is supported for this type of layout, it may not work in a stable manner with custom card content.
26+
27+
If `cardHeight` is not set, the widget falls back to an experimental approximation of card heights based on [`cardShape`](api/config/js_kanban_cardshape_config.md). For boards with a custom [`cardTemplate`](api/config/js_kanban_cardtemplate_config.md), supply a custom [`getCardHeight`](api/config/js_kanban_getcardheight_config.md) function instead.
2628
:::
2729

2830
### Default config

docs/api/config/js_kanban_scrolltype_config.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ scrollType: "default"
2929
:::important
3030
If you combine the [`renderType: "lazy"`](api/config/js_kanban_rendertype_config.md) and `scrollType: "default"` settings, don't forget to specify a static height for cards via the [`cardHeight`](api/config/js_kanban_cardheight_config.md) property. Unless you specify it, the cards will not be displayed.
3131
When you use [`renderType: "lazy"`](api/config/js_kanban_rendertype_config.md) with `scrollType: "column"`, you should also fix the height of cards via the [`cardHeight`](api/config/js_kanban_cardheight_config.md) property. Although a variable height of cards is supported for this type of layout, it may not work in a stable manner with custom card content.
32+
33+
If `cardHeight` is not set, the widget falls back to an experimental approximation of card heights based on [`cardShape`](api/config/js_kanban_cardshape_config.md). For boards with a custom [`cardTemplate`](api/config/js_kanban_cardtemplate_config.md), supply a custom [`getCardHeight`](api/config/js_kanban_getcardheight_config.md) function instead.
3234
:::
3335

3436
### Example

docs/api/config/toolbar_items_config.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ items?: [
2626
}
2727
}, {...}
2828
],
29-
resultTemplate?: template(searchResult => {
30-
return "The HTML template of the search result";
29+
resultTemplate?: template(({ result }) => {
30+
return `HTML template using ${result.label}`;
3131
})
3232
},
3333
"sort" | {
@@ -66,7 +66,7 @@ In the **items** array you can specify the following parameters:
6666
- ***card*** - an object of the card data
6767
- ***value*** - a searched value, specified in the search bar
6868
- ***by*** - a key of card field, by which the cards will be searched
69-
- `searchResult` - (optional) a template for displaying the custom search result
69+
- `resultTemplate` - (optional) a template for displaying the custom search result
7070

7171
~~~jsx
7272
items: [
@@ -93,10 +93,10 @@ items: [
9393
}
9494
}
9595
],
96-
resultTemplate: kanban.template(searchResult => {
96+
resultTemplate: kanban.template(({ result }) => {
9797
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>` : ""}
98+
<div class="list-item-text">${result.label}</div>
99+
${result.description ? `<div class="list-item-text item-description">${result.description}</div>` : ""}
100100
</div>`
101101
})
102102
},
@@ -161,10 +161,10 @@ new kanban.Toolbar("#toolbar", {
161161
items: [
162162
{
163163
type: "search",
164-
resultTemplate: kanban.template(searchResult => {
164+
resultTemplate: kanban.template(({ result }) => {
165165
return `<div class="list-item">
166-
<div class="list-item-text">${searchResult.result.label}</div>
167-
${searchResult.result.description ? `<div class="list-item-text item-description">${searchResult.result.description}</div>` : ""}
166+
<div class="list-item-text">${result.label}</div>
167+
${result.description ? `<div class="list-item-text item-description">${result.description}</div>` : ""}
168168
</div>`
169169
})
170170
},
@@ -182,7 +182,7 @@ new kanban.Toolbar("#toolbar", {
182182

183183
- The *"Undo"* and *"Redo"* controls were added in v1.3
184184
- The ***items.options[0].label*** parameter of the **sort** control was replaced by the ***items.options[0].text*** parameter in v1.4
185-
- The ***items.searchResult*** parameter of the **"search"** control was added in v1.6
185+
- The ***items.resultTemplate*** parameter of the **"search"** control was added in v1.6
186186

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

docs/api/overview/internal_rest_overview.md

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,15 @@ description: You can have an Internal RestDataProvider methods overview of JavaS
66

77
# RestDataProvider methods
88

9-
| Name | Description |
10-
| ------------------------------------------------------------ | ------------------------------------------------------------------ |
11-
| [](api/provider/rest_methods/js_kanban_getcards_method.md) | @getshort(api/provider/rest_methods/js_kanban_getcards_method.md) |
12-
| [](api/provider/rest_methods/js_kanban_getcolumns_method.md) | @getshort(api/provider/rest_methods/js_kanban_getcolumns_method.md) |
13-
| [](api/provider/rest_methods/js_kanban_getlinks_method.md) | @getshort(api/provider/rest_methods/js_kanban_getlinks_method.md) |
14-
| [](api/provider/rest_methods/js_kanban_getrows_method.md) | @getshort(api/provider/rest_methods/js_kanban_getrows_method.md) |
15-
| [](api/provider/rest_methods/js_kanban_getusers_method.md) | @getshort(api/provider/rest_methods/js_kanban_getusers_method.md) |
16-
| [](api/provider/rest_methods/js_kanban_send_method.md) | @getshort(api/provider/rest_methods/js_kanban_send_method.md) |
9+
| Name | Description |
10+
| --------------------------------------------------------------- | --------------------------------------------------------------------- |
11+
| [](api/provider/rest_methods/js_kanban_getcards_method.md) | @getshort(api/provider/rest_methods/js_kanban_getcards_method.md) |
12+
| [](api/provider/rest_methods/js_kanban_getcolumns_method.md) | @getshort(api/provider/rest_methods/js_kanban_getcolumns_method.md) |
13+
| [](api/provider/rest_methods/js_kanban_gethandlers_method.md) | @getshort(api/provider/rest_methods/js_kanban_gethandlers_method.md) |
14+
| [](api/provider/rest_methods/js_kanban_getidresolver_method.md) | @getshort(api/provider/rest_methods/js_kanban_getidresolver_method.md)|
15+
| [](api/provider/rest_methods/js_kanban_getlinks_method.md) | @getshort(api/provider/rest_methods/js_kanban_getlinks_method.md) |
16+
| [](api/provider/rest_methods/js_kanban_getqueue_method.md) | @getshort(api/provider/rest_methods/js_kanban_getqueue_method.md) |
17+
| [](api/provider/rest_methods/js_kanban_getrows_method.md) | @getshort(api/provider/rest_methods/js_kanban_getrows_method.md) |
18+
| [](api/provider/rest_methods/js_kanban_getusers_method.md) | @getshort(api/provider/rest_methods/js_kanban_getusers_method.md) |
19+
| [](api/provider/rest_methods/js_kanban_send_method.md) | @getshort(api/provider/rest_methods/js_kanban_send_method.md) |
20+
| [](api/provider/rest_methods/js_kanban_setheaders_method.md) | @getshort(api/provider/rest_methods/js_kanban_setheaders_method.md) |

docs/api/overview/properties_overview.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ To configure the **Kanban**, refer to the [Configuration](guides/configuration.m
2020
| [](api/config/js_kanban_currentuser_config.md) | @getshort(api/config/js_kanban_currentuser_config.md) |
2121
| [](api/config/js_kanban_editor_config.md) | @getshort(api/config/js_kanban_editor_config.md) |
2222
| [](api/config/js_kanban_editorshape_config.md) | @getshort(api/config/js_kanban_editorshape_config.md) |
23+
| [](api/config/js_kanban_getcardheight_config.md) | @getshort(api/config/js_kanban_getcardheight_config.md) |
2324
| [](api/config/js_kanban_history_config.md) | @getshort(api/config/js_kanban_history_config.md) |
2425
| [](api/config/js_kanban_links_config.md) | @getshort(api/config/js_kanban_links_config.md) |
2526
| [](api/config/js_kanban_locale_config.md) | @getshort(api/config/js_kanban_locale_config.md) |

0 commit comments

Comments
 (0)