Skip to content

Commit 55aa34c

Browse files
Merge pull request #41 from DHTMLX/sp-next-defaultmenus
[update] default options
2 parents b05af0a + 6089b18 commit 55aa34c

20 files changed

+106
-80
lines changed

docs/api/config/js_kanban_cards_config.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,10 @@ cards?: [
4545
cardId: string | number,
4646
text?: string,
4747
date?: Date,
48-
},{...}
48+
}, {...}
4949
],
5050
[custom_key: string]?: any
51-
},
52-
{...} // other cards data
51+
}, {...} // other cards data
5352
];
5453
~~~
5554

@@ -125,7 +124,7 @@ const cards = [
125124
cardId: 1,
126125
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. ",
127126
date: new Date(),
128-
}, {...}
127+
}, {...} // other comments
129128
],
130129
priority: 1,
131130
// custom field to place the card into the "feature" row
@@ -135,7 +134,7 @@ const cards = [
135134
// the columnKey config needs to be set to the "stage" value
136135
stage: "backlog",
137136
css: "red",
138-
},{...} // other cards data
137+
}, {...} // other cards data
139138
];
140139

141140
new kanban.Kanban("#root", {
@@ -151,4 +150,4 @@ new kanban.Kanban("#root", {
151150
- [Working with data](../../../guides/working_with_data)
152151
- [updateCard()](api/methods/js_kanban_updatecard_method.md)
153152

154-
**Related sample:** [Kanban. Styling cards](https://snippet.dhtmlx.com/qu6rpktk?tag=kanban)
153+
**Related sample:** [Kanban. Styling cards](https://snippet.dhtmlx.com/qu6rpktk?tag=kanban)

docs/api/config/js_kanban_cardshape_config.md

Lines changed: 28 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -200,51 +200,47 @@ Unless you specify the cards settings via the **cardShape** property, the widget
200200

201201
~~~jsx {}
202202
const defaultPriorities = [
203-
{ id: 1, color: "#FF5252", label: "high" },
204-
{ id: 2, color: "#FFC975", label: "medium" },
205-
{ id: 3, color: "#0AB169", label: "low" }
203+
{ id: 1, color: "#FE6158", label: "High" },
204+
{ id: 2, color: "#F1B941", label: "Medium" },
205+
{ id: 3, color: "#77D257", label: "Low" }
206206
];
207207

208-
const defaultColors = ["#65D3B3", "#FFC975", "#58C3FE"];
208+
const defaultColors = ["#33B0B4", "#0096FA", "#F1B941"];
209+
210+
export const getDefaultCardMenuItems = ({ store }: { store: DataStore }) => {
211+
const { readonly } = store.getState();
212+
const baseItems = [
213+
{ id: "duplicate-card", icon: "wxi-content-copy", text: "Duplicate" },
214+
{ id: "delete-card", icon: "wxi-delete-outline", text: "Delete" }
215+
];
209216

210-
const getDefaultCardMenuItems = ({ card, store }) => {
211-
const readonly = store.getState();
212217
if (!readonly?.select && readonly?.edit) {
213218
return [
214-
{ id: "set-edit", icon: "wxi-edit", text: "Edit" },
215-
{ id: "delete-card", icon: "wxi-delete", text: "Delete" },
219+
{ id: "set-edit", icon: "wxi-edit-outline", text: "Edit" },
220+
...baseItems,
216221
];
217222
}
218-
return [{ id: "delete-card", icon: "wxi-delete", text: "Delete" }];
223+
return baseItems;
219224
};
220225

221226
const defaultCardShape = {
222-
label: true,
223-
description: false,
224-
progress: false,
225-
start_date: false,
226-
end_date: false,
227-
menu: {
228-
show: true,
229-
items: getDefaultCardMenuItems
230-
},
231-
attached: false,
232-
cover: false,
233-
comments: false,
234-
color: {
227+
label: { show: true },
228+
description: { show: false },
229+
progress: { show: false },
230+
start_date: { show: false },
231+
end_date: { show: false },
232+
users: { show: false },
233+
priority: {
235234
show: false,
236-
values: defaultColors
235+
values: defaultPriorities
237236
},
238-
users: {
237+
color: {
239238
show: false,
240-
maxCount: 2
241-
},
242-
priority: {
243-
show: false,
244-
values: defaultPriorities
239+
values: defaultColors
245240
},
246-
comments: false,
247-
votes: false
241+
cover: { show: false },
242+
attached: { show: false },
243+
menu: { show: true }
248244
};
249245
~~~
250246

@@ -293,7 +289,7 @@ const cardShape = { // card settings
293289
},
294290
css: (card) => card.type == "feature" ? "green" : "red",
295291
headerFields: [
296-
{ // custom field
292+
{ // custom field
297293
key: "sprint",
298294
css: "custom_style",
299295
label: "Sprint"

docs/api/config/js_kanban_cardtemplate_config.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,4 +70,4 @@ new kanban.Kanban("#root", {
7070

7171
**Related articles:** [Customization](../../../guides/customization#custom-cards)
7272

73-
**Related sample:** [Kanban. Custom card](https://snippet.dhtmlx.com/8rhdq81d?tag=kanban)
73+
**Related sample:** [Kanban. Custom card](https://snippet.dhtmlx.com/8rhdq81d?tag=kanban)

docs/api/config/js_kanban_columns_config.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,4 +106,4 @@ new kanban.Kanban("#root", {
106106
**Related samples:**
107107
- [Kanban. Limits for columns and swimlanes](https://snippet.dhtmlx.com/2blo6hx8?tag=kanban)
108108
- [Kanban. Changing color of column via custom menu](https://snippet.dhtmlx.com/fnlvd2g5?tag=kanban)
109-
- [Kanban. Disabling drag and drop to specific columns](https://snippet.dhtmlx.com/nfv59yif?tag=kanban)
109+
- [Kanban. Disabling drag and drop to specific columns](https://snippet.dhtmlx.com/nfv59yif?tag=kanban)

docs/api/config/js_kanban_currentuser_config.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,4 @@ new kanban.Kanban("#root", {
3333

3434
**Change log:** The property was added in v1.4
3535

36-
**Related sample:** [Kanban. Swimlanes, comments, votes](https://snippet.dhtmlx.com/5hcx01h4?tag=kanban)
36+
**Related sample:** [Kanban. Swimlanes, comments, votes](https://snippet.dhtmlx.com/5hcx01h4?tag=kanban)

docs/api/config/js_kanban_editor_config.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ editor?: {
3232

3333
~~~jsx {}
3434
editor: {
35+
debounce: 100,
3536
autoSave: true,
36-
debounce: 100
3737
placement: "sidebar"
3838
}
3939
~~~

docs/api/config/js_kanban_editorshape_config.md

Lines changed: 51 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -316,10 +316,10 @@ where `rec` is the only parameter of the function and is an extended `PointerEve
316316

317317
~~~jsx {}
318318
interface UploadEvent extends PointerEvent {
319-
id: number;
320-
status: "client" | "server" | "error"; // which means in plain English "not sent yet", "sent successfully", "something went wrong, so not sent"
321-
name: string; // the name of the file
322-
file: string | Blob; // the file
319+
id: number;
320+
status: "client" | "server" | "error"; // which means in plain English "not sent yet", "sent successfully", "something went wrong, so not sent"
321+
name: string; // the name of the file
322+
file: string | Blob; // the file
323323
}
324324
~~~
325325

@@ -348,21 +348,57 @@ Unless you specify the editor settings via the `editorShape` property, the widge
348348

349349
~~~jsx {}
350350
const defaultPriorities = [
351-
{ id: 1, color: "#FF5252", label: "high" },
352-
{ id: 2, color: "#FFC975", label: "medium" },
353-
{ id: 3, color: "#0AB169", label: "low" }
351+
{ id: 1, color: "#FE6158", label: "High" },
352+
{ id: 2, color: "#F1B941", label: "Medium" },
353+
{ id: 3, color: "#77D257", label: "Low" }
354354
];
355355

356-
const defaultColors = [ "#65D3B3", "#FFC975", "#58C3FE" ];
356+
const defaultColors = ["#33B0B4", "#0096FA", "#F1B941"];
357357

358358
const defaultEditorShape = [
359-
{ key: "label", type: "text", label: "Label" },
360-
{ key: "description", type: "textarea", label: "Description" },
361-
{ key: "priority", type: "combo", label: "Priority", values: defaultPriorities },
362-
{ key: "color", type: "color", label: "Color", values: defaultColors },
363-
{ key: "progress", type: "progress", label: "Progress" },
364-
{ key: "start_date", type: "date", label: "Start date" },
365-
{ key: "end_date", type: "date", label: "End date" }
359+
{
360+
key: "label",
361+
type: "text",
362+
label: "Label"
363+
},
364+
{
365+
key: "description",
366+
type: "textarea",
367+
label: "Description"
368+
},
369+
{
370+
type: "combo",
371+
label: "Priority",
372+
key: "priority",
373+
config: {
374+
clearButton: true
375+
}
376+
},
377+
{
378+
type: "color",
379+
label: "Color",
380+
key: "color"
381+
},
382+
{
383+
type: "progress",
384+
key: "progress",
385+
label: "Progress"
386+
},
387+
{
388+
type: "date",
389+
key: "start_date",
390+
label: "Start date"
391+
},
392+
{
393+
type: "date",
394+
key: "end_date",
395+
label: "End date"
396+
},
397+
{
398+
type: "multiselect",
399+
key: "users",
400+
label: "Users"
401+
}
366402
];
367403
~~~
368404

docs/api/config/js_kanban_history_config.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,4 @@ new kanban.Kanban("#root", {
4343

4444
**Change log:** The property was added in v1.3
4545

46-
**Related articles:** [`undo()`](api/methods/js_kanban_undo_method.md) and [`redo()`](api/methods/js_kanban_redo_method.md)
46+
**Related articles:** [`undo()`](api/methods/js_kanban_undo_method.md) and [`redo()`](api/methods/js_kanban_redo_method.md)

docs/api/config/js_kanban_links_config.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,8 @@ links?: [
1818
id: string | number,
1919
masterId: string | number,
2020
slaveId: string | number,
21-
relation: "relatesTo" | "requiredFor" | "duplicate" | "parent",
22-
},
23-
{...} // other links data
21+
relation: "relatesTo" | "requiredFor" | "duplicate" | "parent"
22+
}, {...} // other links data
2423
];
2524
~~~
2625

@@ -50,8 +49,7 @@ const links = [
5049
masterId: 2,
5150
slaveId: 5,
5251
relation: "relatesTo",
53-
},
54-
{...}
52+
}, {...} // other link data
5553
];
5654

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

docs/api/config/js_kanban_locale_config.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,4 @@ const board = new kanban.Kanban("#root", {
4242

4343
**Related articles:** [Localization](../../../guides/localization)
4444

45-
**Related sample:** [Kanban. Localization](https://snippet.dhtmlx.com/hrblf1mm?tag=kanban)
45+
**Related sample:** [Kanban. Localization](https://snippet.dhtmlx.com/hrblf1mm?tag=kanban)

0 commit comments

Comments
 (0)