Skip to content
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

Complete the editbar guide #44

Open
wants to merge 8 commits into
base: next
Choose a base branch
from
Open

Conversation

mafanya23
Copy link
Contributor

No description provided.

- [`$swimlane`](#configure-editbar-for-swimlanes) - allows configuring Editbar controls for all elements with the [**swimlane**](/swimlanes/) type
- [`$line`](#configure-editbar-for-lines) allows configuring Editbar controls for all elements with the [**line**](/lines/) type
- [`$lineTitle`](#configure-editbar-for-line-titles) - allows configuring Editbar controls for all elements with the [**lineTitle**](/line_titles/) type
- The `colorpicker`, `spacer` and `button` controls are used for all the Diagram items with the `shape` type
Copy link
Contributor

Choose a reason for hiding this comment

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

@mafanya23 а нужно ли тут дробить текст на подразделы? Что мы этим хотели показать?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Хотела выделить, что базовые контролы настраиваются просто внутри свойства properties, а для комплексных нужно еще свойство $properties

- [`$line`](#configure-editbar-for-lines) allows configuring Editbar controls for all elements with the [**line**](/lines/) type
- [`$lineTitle`](#configure-editbar-for-line-titles) - allows configuring Editbar controls for all elements with the [**lineTitle**](/line_titles/) type
- The `colorpicker`, `spacer` and `button` controls are used for all the Diagram items with the `shape` type
- The configs of the `colorpicker` and `button` controls are redefined especially for this type of Diagram items
Copy link
Contributor

Choose a reason for hiding this comment

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

@mafanya23 especially for this type - речь же идет про все типы фигур, а не конкретного типа, так?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Да, наверное, здесь лучше написать especially for the $shape group of Diagram items, i.e. for all shapes

@@ -56,7 +184,8 @@ properties: {

**Related complex controls:** [Grid step](/api/diagram_editor/editbar/complex_controls/gridstep/), [Border](/api/diagram_editor/editbar/complex_controls/border/), [Arrange](/api/diagram_editor/editbar/complex_controls/arrange/)

## Configure Editbar for shapes

### Configuring Editbar for shapes
Copy link
Contributor

Choose a reason for hiding this comment

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

@mafanya23 хотелось бы дополнить этот раздел описанием, и сам пример по аналогии с примерами выше/ниже, то есть код целиком.


**Related sample:** [Diagram Editor. Default mode. PERT сhart with the legend](https://snippet.dhtmlx.com/w8mrh3ay?mode=js)

### Configuring Editbar for the grid area
Copy link
Contributor

Choose a reason for hiding this comment

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

@mafanya23 хотелось бы дополнить этот раздел описанием, и сам пример по аналогии с примерами выше/ниже, то есть код целиком.

@@ -77,7 +206,7 @@ properties: {

**Related complex controls:** [Border](/api/diagram_editor/editbar/complex_controls/border/), [Arrange](/api/diagram_editor/editbar/complex_controls/arrange/), [Position](/api/diagram_editor/editbar/complex_controls/position/), [Size](/api/diagram_editor/editbar/complex_controls/size/), [Text align](/api/diagram_editor/editbar/complex_controls/textalign/), [Text style](/api/diagram_editor/editbar/complex_controls/textstyle/)

## Configure Editbar for group elements
### Configuring Editbar for group elements
Copy link
Contributor

Choose a reason for hiding this comment

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

@mafanya23 хотелось бы дополнить этот раздел описанием, и сам пример по аналогии с примерами выше/ниже, то есть код целиком.

@@ -113,7 +242,7 @@ properties: {

**Related complex controls:** [Border](/api/diagram_editor/editbar/complex_controls/border/), [Arrange](/api/diagram_editor/editbar/complex_controls/arrange/), [Header](/api/diagram_editor/editbar/complex_controls/header/), [Header common](/api/diagram_editor/editbar/complex_controls/headercommon/), [Header position](/api/diagram_editor/editbar/complex_controls/headerposition/), [Size](/api/diagram_editor/editbar/complex_controls/size/), [Text align](/api/diagram_editor/editbar/complex_controls/textalign/), [Text style](/api/diagram_editor/editbar/complex_controls/textstyle/)

## Configure Editbar for lines
### Configuring Editbar for lines
Copy link
Contributor

Choose a reason for hiding this comment

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

@mafanya23 хотелось бы дополнить этот раздел описанием, и сам пример по аналогии с примерами выше/ниже, то есть код целиком.

@@ -131,13 +260,13 @@ properties: {

**Related complex controls:** [Border](/api/diagram_editor/editbar/complex_controls/border/), [Line shape](/api/diagram_editor/editbar/complex_controls/lineshape/), [Pointer view](/api/diagram_editor/editbar/complex_controls/pointerview/)

## Configure Editbar for line titles
### Configuring Editbar for line titles
Copy link
Contributor

Choose a reason for hiding this comment

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

@mafanya23 хотелось бы дополнить этот раздел описанием, и сам пример по аналогии с примерами выше/ниже, то есть код целиком.

There is a possibility to create an Editbar that will dynamically change depending on certain conditions, e.g.:
the selected shape type, absence of selected items, the properties of the selected item. Check the example:

~~~jsx
Copy link
Contributor

Choose a reason for hiding this comment

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

@mafanya23 этот пример не про динамическое отображение Editbar, скорей про базовую конфигурацию и переопределение определенных типов элементов (фигур)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Убрала

To make a dynamic Editbar that will change *depending on the properties of a selected shape*, you need to specify a function as a value of the property that defines the [type of a shape](/shapes/default_shapes/) or a [group of items](/guides/items_index/) within the [`properties`](api/diagram_editor/editbar/config/properties_property.md) configuration object:

~~~jsx
editbar: {
Copy link
Contributor

Choose a reason for hiding this comment

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

@mafanya23 тут можно привести весь конфиг, он не большой. При этом было бы не плохо описать, что происходит в примере. Если очень кратко, то метод hasOwnProperty проверяет на наличие в объекте собственного свойства, указанного в качестве аргумента. И когда условие выполняется, мы отображаем определенный контрол. Например, в объекте есть свойство title, тогда мы отобразим контрол, который будет отвечать за отображение/изменение данного свойства. С остальными по аналогии, будет так же.

Copy link
Contributor

Choose a reason for hiding this comment

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

Заметил описание есть пониже, возможно стоит чуть больше разбавить?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Обновила


In the above example the `$shape` property is specified as a function that provides a set of default controls for all Diagram shapes and allows using additional controls, depending on whether a Diagram item has a particular property in its configuration.

## Setting the width of Editbar
Copy link
Contributor

Choose a reason for hiding this comment

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

@mafanya23 в задаче есть еще два не плохих примера которые можно показать с описанием. Хотелось бы рассказать о них в гайде. Покажут как пользоваться сервисными свойствами.
image

Copy link
Contributor

Choose a reason for hiding this comment

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

Там где про сервисные свойства, нужно таблички с предупреждениями показать дополнительно

Copy link
Contributor Author

@mafanya23 mafanya23 Sep 16, 2024

Choose a reason for hiding this comment

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

Добавила раздел Redefining service properties of basic controls в главу про создание кастомных контролов

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