Skip to content

[update] data/treecollection api descriptions#60

Merged
mafanya23 merged 5 commits intomasterfrom
update-datacollection-api
Apr 1, 2026
Merged

[update] data/treecollection api descriptions#60
mafanya23 merged 5 commits intomasterfrom
update-datacollection-api

Conversation

@mafanya23
Copy link
Copy Markdown
Contributor

No description provided.

@mafanya23 mafanya23 requested a review from Sorokin-Oleg March 26, 2025 09:17
@@ -12,14 +12,14 @@ description: You can explore the add method of DataCollection in the documentati

@params:
- `new_item: object | array` - the object of a new item or an array of item objects
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mafanya23 посмотри пожалуйста, как в оригинальных типах построена типизация компонентов. В старой документации не было возможности давать больше конкретики. Но сейчас такая возможность есть. Да и на проекте используем TS и отдаем .d.ts

  1. Наименование аргументов, свойств. Обрати пожалуйста на это внимание, мы используем camelCase.
  2. add(newItem: IDataItem | IDataItem[], index?: number): Id | Id[];
type Id = string | number; // Можно где-то про это один раз написать, либо продублировать в паре мест. Метод add() для этого подходит. 
add(newItem: IDataItem | IDataItem[], index?: number): Id | Id[];

(string | number) | (string | number)[] - Можно и оставить. Но Было бы не плохо перейти на Id - он у нас часто встречается.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mafanya23 подход, где мы предоставляем типы будет все же более правильным. Так сейчас делают все современные библиотеки. Главное, чтобы типы были из d.ts, а не абстрактными.

Comment thread docs/data_collection/api/datacollection_foreach_method.md Outdated
Comment thread docs/data_collection/api/datacollection_findall_method.md
Comment thread docs/data_collection/api/datacollection_find_method.md
Comment thread docs/data_collection/api/datacollection_map_method.md
Comment thread docs/data_collection/api/datacollection_maprange_method.md
- `item` - the current item of a data collection
- `callback: function` - a function that will be called for each item in the array. The function is called with the following parameters:
- `acc: any` - the *initialValue*, or the previously returned value of the function
- `item: any` - the current item of a data collection
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mafanya23 IDataItem, посмотри пожалуйста и в других местах

Comment thread docs/data_collection/api/datacollection_update_method.md Outdated
@mafanya23
Copy link
Copy Markdown
Contributor Author

Правки по описанию аргументов и типов вынесены в отдельную задачу https://tracker.webix.io/issue/DHX-5160/Improve-description-of-DataCollection-TreeCollection-API

- `id: string | number` - the old id of an item
- `newId: string | number` - optional, the new id; auto-generated if not set
- `silent: boolean` - true, to prevent changing the id; otherwise, false
- `newId?: string | number` - optional, the new id; auto-generated if not set
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mafanya23 да, тут получается, что newId опционален. Но давай сделаем обязательным. Пользователь может не понять, что произошла смена ID при передаче только первого аргумента. Метод явно требует доработок, нужно было бы возвращать новый ID.

Создал задачу на изменение в suite 9.4 - https://tracker.webix.io/issue/DHX-5162/DataCollection.-Update-method-changeId

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mafanya23 тут больше вопрос, а почему jsx? Когда мы используем вставки из TS будет лучше использовать и расширение для отображения кода как ts. Я попробовал, так действительно лучше видны ключевые слова.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Да, в Usage можно использовать вставки кода с ts расширением, тоже посмотрела

Comment thread docs/data_collection/api/datacollection_reduce_method.md Outdated
Comment thread docs/tree_collection/api/treecollection_mapvisible_method.md Outdated
Comment thread docs/tree_collection/api/treecollection_update_method.md Outdated
@mafanya23 mafanya23 merged commit a77b1b4 into master Apr 1, 2026
@mafanya23 mafanya23 changed the title [update] datacollection api descriptions [update] data/treecollection api descriptions Apr 1, 2026
@mafanya23 mafanya23 deleted the update-datacollection-api branch April 1, 2026 08:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants