Skip to content

[update] setLocale() and setConfig() methods #49

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions docs/api/methods/js_kanban_setconfig_method.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Using this method, you can configure the Kanban widget as well as load data to i

### Example

~~~jsx {10-18,20-23}
~~~jsx {10-20,22-23}
// create Kanban
const board = new kanban.Kanban("#root", {
columns,
Expand All @@ -36,18 +36,18 @@ const board = new kanban.Kanban("#root", {
// create Toolbar
const toolbar = new kanban.Toolbar("#toolbar", { api: board.api });

// set new configuration parameters of Kanban
// specify new configuration parameters of Kanban
board.setConfig({
editorAutoSave: false,
columnKey: "stage",
rowKey: "type",
cardShape,
editorShape,
/*other parameters*/
});

// update configuration parameters of Toolbar
toolbar.setConfig({
api: board.api
editor: {
autoSave: false
},
/* other parameters */
});

// specify new configuration parameters of Toolbar
toolbar.setConfig({ items: ["search", "spacer", "sort"] });
~~~
5 changes: 2 additions & 3 deletions docs/api/methods/js_kanban_setedit_method.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,14 @@ setEdit({ cardId: string | number } | null): void;

### Parameters

The method can take a *null* value or an object with the fallowing parameter:
The method can take a *null* value or an object with the following parameter:

- `cardId` - (required) the ID of the card to be edited

:::note
To close an editor, call the **setEdit()** method with the ***null*** value
:::


### Example

~~~jsx {7}
Expand All @@ -39,4 +38,4 @@ const board = new kanban.Kanban("#root", {
board.setEdit({ cardId: 1 });
~~~

**Change log:** The method was added in v1.2
**Change log:** The method was added in v1.2
4 changes: 2 additions & 2 deletions docs/api/methods/js_kanban_setlocale_method.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ setLocale(null | locale?: object): void;
- `locale` - (optional) the object of data of the new locale to be applied

:::info
Using this method, you can apply a new locale to Kanban. To reset Kanban to the default locale, call the method without arguments (or with a *null* value)
Use the `setLocale()` method to apply a new locale to Kanban only. To reset Kanban to the default locale, call the `setLocale()` method without arguments (or with a *null* value). Use the [`toolbar.setLocale()`](api/methods/toolbar_setlocale_method.md) method to apply a new locale to Toolbar only.
:::

### Example
Expand All @@ -39,6 +39,6 @@ board.setLocale(de);
board.setLocale(); // or board.setLocale(null);
~~~

**Chande log:** The method was updated in v1.2
**Change log:** The method was updated in v1.2

**Related articles:** [Localization](guides/localization.md)
12 changes: 6 additions & 6 deletions docs/api/methods/toolbar_setlocale_method.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ description: You can learn about the setLocale method of Toolbar in the document
### Usage

~~~jsx {}
setLocale(locale?: object, api?: object): void;
setLocale(null | locale?: object): void;
~~~

### Parameters

- `locale` - (optional) an object of the locale to be applied to the Toolbar of Kanban
- `api` - (optional) an object with the internal API of Kanban
- `null` - (optional) resets Toolbar to the default locale (*English*)
- `locale` - (optional) the object of new locale data to be applied to the Toolbar

:::info
The **Toolbar** of Kanban is a separate component. Before changing its locale, be sure that you have already applied the [`setLocale()`](api/methods/toolbar_setlocale_method.md) method to the **Kanban** component
The **Toolbar** of Kanban is a separate component. Use the `toolbar.setLocale()` method to apply a new locale to Toolbar only. To reset Toolbar to the default locale, call the `toolbar.setLocale()` method without arguments (or with a *null* value). Use the [`kanban.setLocale()`](api/methods/js_kanban_setlocale_method.md) method to apply a new locale to Kanban only.
:::

### Example
Expand All @@ -35,9 +35,9 @@ const toolbar = new kanban.Toolbar("#toolbar", { api: board.api });
// apply the "de" locale to Kanban
board.setLocale(de);
// apply the "de" locale to the Toolbar
toolbar.setLocale(de, board.api);
toolbar.setLocale(de);
~~~

**Chande log:** The **api** parameter was added in v1.5.7
**Change log:** The **api** parameter was deprecated in v1.6

**Related articles:** [Localization](guides/localization.md)
3 changes: 2 additions & 1 deletion docs/guides/localization.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const en = {
"Add new row": "Add new row",
"Add new column": "Add new column",
"Add new card": "Add new card",
"Add new card...": "Add new card...",
"Edit card": "Edit card",
Edit: "Edit",

Expand Down Expand Up @@ -76,7 +77,7 @@ const en = {
"Would you like to delete this comment?":
"Would you like to delete this comment?",
"Would you like to delete this card?":
"Would you like to delete this card?",
"Would you like to delete this card?"
},
calendar: { // translations and settings of the calendar
monthFull: [
Expand Down
3 changes: 3 additions & 0 deletions docs/news/whats_new.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ Released on November 13, 2024
- The method doesn't change themes (use the new [`setTheme()`](../../api/methods/js_kanban_settheme_method) method instead)
- The method doesn't destroy Kanban datastore. You don't need to recreate event listeners and reattach Toolbar to Kanban

- The [`setLocale()`](../../api/methods/js_kanban_setlocale_method) method doesn't destroy Kanban datastore. You don't need to recreate event listeners and reattach Toolbar to Kanban
- The `api` parameter of the Toolbar [`setLocale()`](../../api/methods/toolbar_setlocale_method) method was deprecated

### Fixes

- A comment in progress of editing can be removed and text area for new comments disappears
Expand Down
Loading