Skip to content

Commit 8e0050a

Browse files
Merge pull request #45 from DHTMLX/next
[update] the confirmDeletion parameter (missing feature)
2 parents 62a07d5 + ffe2c49 commit 8e0050a

File tree

6 files changed

+55
-20
lines changed

6 files changed

+55
-20
lines changed

docs/api/config/js_kanban_cardshape_config.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ cardShape?: {
2020
attached?: boolean | { show?: boolean },
2121
cover?: boolean | { show?: boolean },
2222
comments?: boolean | { show?: boolean },
23+
confirmDeletion?: boolean | { show?: boolean },
2324
start_date?: boolean | {
2425
show?: boolean,
2526
format?: string
@@ -107,6 +108,7 @@ To configure the card appearance, in the **cardShape** object you can specify th
107108
- `attached` - (optional) shows/hides an **attachment** field
108109
- `cover` - (optional) shows/hides a **card picture**
109110
- `comments` - (optional) shows/hides **comments** on cards
111+
- `confirmDeletion` - (optional) shows/hides the **confirmation dialog** that allows users to confirm or decline the card deletion
110112
- `start_date` - (optional) an object of parameters of a **start date** field
111113
- `show` - (optional) shows/hides a card start date
112114
- `format` - (optional) defines format of a card start date. The available parameters can be found [here](https://docs.dhtmlx.com/suite/calendar/api/calendar_dateformat_config/)
@@ -230,6 +232,7 @@ const defaultCardShape = {
230232
start_date: { show: false },
231233
end_date: { show: false },
232234
users: { show: false },
235+
confirmDeletion: { show: true },
233236
priority: {
234237
show: false,
235238
values: defaultPriorities
@@ -270,6 +273,7 @@ const cardShape = { // card settings
270273
attached: true,
271274
cover: false,
272275
comments: false,
276+
confirmDeletion: false,
273277
color: {
274278
show: true,
275279
values: cardColors

docs/api/config/js_kanban_columnshape_config.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ columnShape?: {
3434
}),
3535
collapsedTemplate?: template(column => {
3636
return "The HTML template of the column header in the collapsed state";
37-
})
37+
}),
38+
confirmDeletion?: boolean
3839
};
3940
~~~
4041

@@ -90,6 +91,7 @@ To configure the columns appearance, in the **columnShape** object you can speci
9091
- `css` - (optional) a function that returns a css class that applies to columns conditionally
9192
- `headerTemplate` - (optional) the HTML template of the column header in the expanded state
9293
- `collapsedTemplate` - (optional) the HTML template of the column header in the collapsed state
94+
- `confirmDeletion` - (optional) shows/hides the **confirmation dialog** that allows users to confirm or decline the column deletion
9395

9496
### Default config
9597

@@ -116,7 +118,8 @@ const columnShape = {
116118
show: true,
117119
items: getDefaultColumnMenuItems
118120
},
119-
fixedHeaders: true
121+
fixedHeaders: true,
122+
confirmDeletion: true
120123
};
121124
~~~
122125

@@ -178,7 +181,8 @@ const columnShape = {
178181
column.columnState?.cardsCount
179182
})</div>
180183
</div>`;
181-
})
184+
}),
185+
confirmDeletion: true
182186
};
183187
184188
new kanban.Kanban("#root", {

docs/api/config/js_kanban_editorshape_config.md

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ description: You can learn about the editorShape config in the documentation of
1212

1313
### Usage
1414

15-
~~~jsx {3,8,27,40,50,71,86,95,106,115}
15+
~~~jsx {3,8,28,42,52,73,88,97,108,117,125}
1616
editorShape?: [
1717
{
1818
// common parameters for all types
@@ -126,15 +126,21 @@ editorShape?: [
126126
accept?: string,
127127
disabled?: boolean,
128128
multiple?: boolean,
129-
folder?: boolean
129+
folder?: boolean,
130130
},
131131

132132
// for a "comments" type only
133133
config?: {
134134
format?: string,
135135
placement?: "page" | "editor",
136-
html?: boolean
137-
}
136+
html?: boolean,
137+
confirmDeletion?: boolean
138+
},
139+
140+
// for a "links" type only
141+
config?: {
142+
confirmDeletion?: boolean
143+
},
138144
}, { /* other control settings */ }
139145
];
140146
~~~
@@ -343,6 +349,12 @@ interface UploadEvent extends PointerEvent {
343349
- `"editor"` - comments will be displayed in the editor
344350
- `"page"` - comments will be displayed in a separate panel
345351
- `html` - (optional) - enables/disables using of the HTML markup in comments
352+
- `confirmDeletion` - (optional) shows/hides the **confirmation dialog** that allows users to confirm or decline the comment deletion
353+
354+
#### - Parameters for a "links" type
355+
356+
- `config` - (optional) a configuration object of the **"links"** field. Here you can specify the following parameters:
357+
- `confirmDeletion` - (optional) shows/hides the **confirmation dialog** that allows users to confirm or decline the link deletion
346358

347359
:::info
348360
Unless you specify the editor settings via the `editorShape` property, the widget will apply a **defaultEditorShape** set of parameters!
@@ -408,7 +420,7 @@ const defaultEditorShape = [
408420

409421
### Example
410422

411-
~~~jsx {6-29,34}
423+
~~~jsx {6-35,40}
412424
const users = [ // user data
413425
{ id: 1, label: "John Smith", avatar: "../assets/user.jpg" },
414426
{ id: 2, label: "Aaron Short" }
@@ -429,13 +441,19 @@ const editorShape = [ // editor settings
429441
config: {
430442
format: "%M %d",
431443
placement: "page",
432-
html: true
444+
html: true,
445+
config: {
446+
confirmDeletion: true
447+
}
433448
}
434449
},
435450
{
436451
type: "links",
437452
key:"links",
438-
label: "Links"
453+
label: "Links",
454+
config: {
455+
confirmDeletion: true
456+
}
439457
}
440458
];
441459

docs/api/config/js_kanban_links_config.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ If you want to load new data for links dynamically, you can use the [**parse()**
4242

4343
### Example
4444

45-
~~~jsx {1-9,14}
45+
~~~jsx {1-8,13}
4646
const links = [
4747
{
4848
id: 1,

docs/api/config/js_kanban_rowshape_config.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ rowShape?: {
2626
}, {...} // other item data
2727
] | ({ row, rowIndex, rows, store }) => array | boolean
2828
},
29-
css?: (row, cards) => string
29+
css?: (row, cards) => string,
30+
confirmDeletion?: boolean
3031
};
3132
~~~
3233

@@ -82,6 +83,7 @@ To configure the rows appearance, in the **rowShape** object you can specify the
8283
:::
8384

8485
- `css` - a function returns a css class that applies to rows conditionally
86+
- `confirmDeletion` - (optional) shows/hides the **confirmation dialog** that allows users to confirm or decline the row deletion
8587

8688
### Default config
8789

@@ -106,13 +108,14 @@ const rowShape = {
106108
menu: {
107109
show: true,
108110
items: getDefaultRowMenuItems
109-
}
111+
},
112+
confirmDeletion: true
110113
};
111114
~~~
112115

113116
### Example
114117

115-
~~~jsx {10-42,48}
118+
~~~jsx {10-43,48}
116119
const changeRowColor = (row, cssClass) => board.updateRow({
117120
id: row.id,
118121
row: {
@@ -153,7 +156,8 @@ const rowShape = {
153156
]
154157
}
155158
},
156-
css: (row, cards) => row.id == "task" && cards.length < 3 ? "green" : "red"
159+
css: (row, cards) => row.id == "task" && cards.length < 3 ? "green" : "red",
160+
confirmDeletion: false
157161
};
158162

159163
new kanban.Kanban("#root", {

docs/guides/configuration.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ The board of Kanban consists of the *cards* distributed into *columns* and *rows
5959

6060
- a card cover (*preview image*) via the `cover: boolean` config
6161
- a card comment(s) via the `comments: boolean` config
62+
- a confirmation dialog to confirm or decline the card deletion via the `confirmDeletion: boolean` config
6263
- a card vote(s) via the `votes: boolean | { show: boolean, clicable: true }` config
6364
- a card assignment (users) via the `users: boolean | { show: boolean, values: object, maxCount: number | false }` config
6465

@@ -365,7 +366,7 @@ new kanban.Kanban("#root", {
365366

366367
The editor field of **comments** type can be set in the following way:
367368

368-
~~~jsx {3-12}
369+
~~~jsx {3-13}
369370
new kanban.Kanban("#root", {
370371
editorShape: [
371372
{
@@ -376,7 +377,8 @@ new kanban.Kanban("#root", {
376377
dateFormat: "%M %d",
377378
placement: "page", // or "editor"
378379
html: true,
379-
},
380+
confirmDeletion: true
381+
}
380382
},
381383
// settings of other fields
382384
]
@@ -387,20 +389,23 @@ new kanban.Kanban("#root", {
387389

388390
The editor field of **links** type can be set in the following way:
389391

390-
~~~jsx {3-7}
392+
~~~jsx {3-10}
391393
new kanban.Kanban("#root", {
392394
editorShape: [
393395
{
394396
type: "links",
395397
key: "links",
396398
label: "Links",
399+
config: {
400+
confirmDeletion: true
401+
}
397402
},
398403
// settings of other fields
399404
]
400405
});
401406
~~~
402407

403-
### Linking editor fields to card fields
408+
### Binding editor fields to card fields
404409

405410
:::info
406411
To link the editor field to the corresponding card field, you need to provide special **key** in the object of [`editorShape`](api/config/js_kanban_editorshape_config.md) property (`key: "editor_field_key"`). The value of this key needs to be set to *true* in the [`cardShape`](api/config/js_kanban_cardshape_config.md) property (for built-in card fields) or specified in the **headerFields** array (for custom card fields). You can provide the initial data of any field via this key as well.
@@ -506,7 +511,7 @@ new kanban.Toolbar("#toolbar", { api: board.api });
506511

507512
You can manage (*hide/show/customize*) the Toolbar controls using the **items** property:
508513

509-
~~~jsx {6-15}
514+
~~~jsx {6-51}
510515
// create Kanban
511516
const board = new kanban.Kanban("#root", {...});
512517

0 commit comments

Comments
 (0)