Migration to newer versions
1.1 -> 1.2
Api
Properties
The
cardShape
property of Kanban was updated in the following way:the menu parameter
Before v1.2menu: true,
//or
menu: { show: true }
// other parametersFrom v1.2menu: true,
// or
menu: {
show: true,
items: ({ card, store }) => {
if(card.id === 1){
return false;
} else {
return [
{ id: "set-edit", icon: "wxi-edit", label: "Edit" },
{ id: "delete-card", icon: "wxi-delete", label: "Delete" }
];
}
}
},
// other parametersthe users parameter
Before v1.2users: {
show: true,
values: [
{
id: 1,
label: "John Smith",
path: "../assets/user.jpg"
},
]
},
// other parametersFrom v1.2users: {
show: true,
values: [
{
id: 1,
label: "John Smith",
avatar: "../assets/user.jpg"
},
]
},
// other parametersthe start_date and end_date parameters
Before v1.2start_date: true,
end_date: true,
// other parametersFrom v1.2start_date: {
show: true,
format: "%d.%m.%Y"
},
end_date: {
show: true,
format: "%d.%m.%Y"
},
// other parameters
The
editorShape
property of Kanban was updated in the following way:
Before v1.2
{
type: "multiselect",
key: "users",
label: "Users",
values: [
{
id: 1, label: "Alan",
path: "preview_image_path_1.png"
},
]
},
// settings of other fields
From v1.2
{
type: "multiselect",
key: "users",
label: "Users",
values: [
{
id: 1, label: "Alan",
avatar: "preview_image_path_1.png"
},
]
},
// settings of other fields
- The
items
property of Toolbar was updated in the following way:
Before v1.2
items: [
"search",
"controls"
]
From v1.2
items: [
{ // or "search",
type: "search",
options: [
{
id: "label",
label: "By label"
},
{
id: "start_date",
label: "By date",
searchRule: (card, value, by) => {
const date = card[by];
return date?.toString().includes(value);
}
}
]
},
"spacer",
{ // or "sort",
type: "sort",
options: [
{
label: "Sort by label",
by: "label",
dir: "asc"
},
{
label: "Sort by description",
by: "description",
dir: "desc"
}
]
},
"addColumn",
"addRow"
]
Methods
- The
setLocale()
method of Kanban andsetLocale()
method of Toolbar were updated:
Before v1.2
setLocale(kanban.en); // reset to default locale
From v1.2
setLocale(null); // reset to default locale
- The
api.getReactiveState()
method of Kanban was updated:
Before v1.2
api.getReactiveState();
// the method returns an object with the following properties
/*{
dragItemId: {
subscribe: any,
update: any,
set: any
},
before: {...},
overAreaId: {...},
overAreaMeta: {...},
dropAreaItemsCoords: {...},
dropAreasCoords: {...},
dragItemsCoords: {...},
selected: {...}
}*/
From v1.2
api.getReactiveState();
// the method returns an object with the following properties
/*{
areasMeta: {
subscribe: any,
update: any,
set: any
},
before: {...},
cardShape: {...},
cards: {...},
cardsMap: {...},
cardsMeta: {...},
columnKey: {...},
columns: {...},
dragItemId: {...},
dragItemsCoords: {...},
dropAreaItemsCoords: {...},
dropAreasCoords: {...},
edit: {...},
editorShape: {...},
fromAreaMeta: {...},
overAreaId: {...},
overAreaMeta: {...},
readonly: {...},
rowKey: {...},
rows: {...},
scroll: {...},
search: {...},
selected: {...},
sort: {...}
}*/
- The
api.getState()
method of Kanban was updated:
Before v1.2
api.getState();
// the method returns an object with the following properties
/*{
dragItemId: string | number,
before: string | number,
overAreaId: string | number,
overAreaMeta: object,
dropAreaItemsCoords: array,
dropAreasCoords: array,
dragItemsCoords: array,
selected: array
}*/
From v1.2
api.getState();
// the method returns an object with the following properties
/*{
areasMeta: object,
before: string | number,
cardShape: object,
cards: array,
cardsMap: object,
cardsMeta: object,
columnKey: string,
columns: array,
dragItemId: string | number,
dragItemsCoords: array,
dropAreaItemsCoords: array,
dropAreasCoords: array,
edit: object,
editorShape: array,
fromAreaMeta: object,
overAreaId: string | number,
overAreaMeta: object,
readonly: object,
rowKey: string,
rows: array,
scroll: object,
search: object,
selected: array,
sort: object
}*/
- The
api.getStores()
method of Kanban was updated:
Before v1.2
api.getStores();
// the method returns an object with the following stores
/*{
state: StateStore, // ( object )
data: DataStore // ( object )
}*/
From v1.2
api.getStores();
// the method returns an object with the following properties
/*{
state: StateStore, // ( object )
}*/
Localization
Before v1.2
const days = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
const months = [
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December"
];
const monthsShort = [
"Jan",
"Feb",
"Mar",
"Apr",
"May",
"Jun",
"Jul",
"Aug",
"Sep",
"Oct",
"Nov",
"Dec"
];
const wx = {
Today: "Today",
Clear: "Clear",
Close: "Close"
};
const en = {
lang: "en",
__dates: {
months,
monthsShort,
days
},
wx,
kanban: {
Save: "Save",
Close: "Close",
Delete: "Delete",
Name: "Name",
Description: "Description",
Type: "Type",
"Start date": "Start date",
"End date": "End date",
Result: "Result",
"No results": "No results",
Search: "Search",
"Search in": "Search in",
"Add new row": "Add new row",
"Add new column": "Add new column",
"Add new card": "Add new card",
"Edit card": "Edit card",
Edit: "Edit",
Everywhere: "Everywhere",
Label: "Label",
Status: "Status",
Color: "Color",
Date: "Date",
Untitled: "Untitled",
Rename: "Rename"
}
};
From v1.2
const en = {
kanban: { // translations of the Kanabn labels
"Save": "Save",
"Close": "Close",
"Delete": "Delete",
"Name": "Name",
"Description": "Description",
"Type": "Type",
"Start date": "Start date",
"End date": "End date",
"Result": "Result",
"No results": "No results",
"Search": "Search",
"Search in": "Search in",
"Add new row": "Add new row",
"Add new column": "Add new column",
"Add new card": "Add new card",
"Edit card": "Edit card",
"Edit": "Edit",
"Everywhere": "Everywhere",
"Label": "Label",
"Status": "Status",
"Color": "Color",
"Date": "Date",
"Untitled": "Untitled",
"Rename": "Rename",
"Move up": "Move up",
"Move down": "Move down",
"Move left": "Move left",
"Move right": "Move right",
"Sort": "Sort",
"Label (a-z)": "Label (a-z)",
"Label (z-a)": "Label (z-a)",
"Description (a-z)": "Description (a-z)",
"Description (z-a)": "Description (z-a)"
},
calendar: { // translations and settings of the calendar
monthFull: [
"January", "February", "March", "April",
"May", "June", "July", "August",
"September", "October", "November", "December"
],
monthShort: [
"Jan", "Feb", "Mar", "Apr",
"May", "Jun", "Jul", "Aug",
"Sep", "Oct", "Nov", "Dec"
],
dayFull: [
"Sunday",
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday"
],
dayShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
hours: "Hours",
minutes: "Minutes",
done: "Done",
clear: "Clear",
today: "Today",
am: ["am", "AM"],
pm: ["pm", "PM"],
weekStart: 7,
timeFormat: 24
},
core: { // translations of the core elements
ok: "OK",
cancel: "Cancel"
}
};
1.0 -> 1.1
Api
Properties
- The
columns
property was extended by the new parameters. Starting from v1.1, you can use the collapsed, limit and strictLimit configurations.
Before v1.1
const columns = [
{
label: "Backlog",
id: "backlog"
}, ...
];
From v1.1
const columns = [
{
label: "Backlog",
id: "backlog",
collapsed: true,
limit: 3,
strictLimit: true
}, ...
];
new kanban.Kanban("#root", {
columns,
// other parameters
});
- The color parameter of the
cardShape
property was updated.
Before v1.1
const cardShape = {
color: {
show: true,
values: [
{ id: 1, color: "#65D3B3", label: "red" },
{ id: 2, color: "#FFC975", label: "green" }
]
}
};
From v1.1
const cardShape = {
color: {
show: true,
values: ["#65D3B3", "#FFC975", "#58C3FE"]
}
};
new kanban.Kanban("#root", {
cardShape
// other parameters
});
Methods
- The
addColumn
method (andadd-column
event) was updated:
Before v1.1
addColumn(column_data_object);
From v1.1
addColumn({
id: "backlog",
column: {
label: "Backlog",
collapsed: false,
...
}
});
Before v1.1
addRow(row_data_object);
From v1.1
addRow({
id: "feature",
row: {
label: "Feature",
collapsed: false,
...
}
});
- The
updateColumn
method (andupdate-column
event) was updated:
Before v1.1
updateColumn(column_data_object);
From v1.1
updateColumn({
id: "backlog",
column: {
label: "Backlog",
collapsed: true,
...
}
});
- The
updateRow
method (andupdate-row
event) was updated:
Before v1.1
updateRow(row_data_object);
From v1.1
updateRow({
id: "feature",
row: {
label: "Feature",
collapsed: true,
...
}
});
- The
updateCard
method (andupdate-card
event) was updated:
Before v1.1
updateCard(card_data_object);
From v1.1
updateCard({
id: 1,
card: {
label: "Volvo XC 70",
progress: 26
...
}
});
- The
parse
method was updated:
Before v1.1
// you need to reset initial data befor parsing new one
const board = new kanban.Kanban("#root", {
columns: [],
cards: [],
rows: []
});
board.parse({
columns,
cards,
rows
});
From v1.1
// you don't need to reset initial data befor parsing new one
const board = new kanban.Kanban("#root", {});
board.parse({
columns,
cards,
rows
});