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

[BUG] @prizm-ui/components - "Выбрать всё" в мультиселекте работает некорректно при использовании трансформера #1919

Closed
1 of 9 tasks
sergeycher opened this issue Jul 31, 2024 · 0 comments · Fixed by #1943
Assignees
Labels
state:ready ready for release (pass tested) type:bug Something isn't working
Milestone

Comments

@sergeycher
Copy link

Библиотека

  • @prizm-ui/core
  • @prizm-ui/components
  • @prizm-ui/install
  • @prizm-ui/icons
  • @prizm-ui/flag-icons
  • @prizm-ui/theme
  • @prizm-ui/charts
  • @prizm-ui/ast
  • @prizm-ui/nx-plugin

Компонент

PrizmInputMultiSelectComponent prizm-input-multi-select

Проект в котором используется Prizm

  • Энергоконтроль

Описание проблемы

Если в мультиселект передать selectAllItem и transformer то пункт "Выбрать всё" начинает работать некорректно.

  public select(item: PrizmMultiSelectItemWithChecked<T>): void {
    const newItemState = !item.checked;
    let values: T[]; // тут неправильно (без учета transformer-а) указан тип
    if (this.isSelectAllItem(item)) {
      // вот тут нет прогона через transformer из-за чего в values оказываются значения с неправильным типом
      values = newItemState ? [...this.items] : [];
    } else {
      // а вот тут вызов transformer уже есть
      const selectedValue = this.transformer(item.obj);
      values = newItemState
        ? [...(this.value ?? []), selectedValue]
        : this.value.filter(i => !this.identityMatcher(i, selectedValue));
    }

    this.updateValue(values);
    this.dropdownHostElement?.reCalculatePositions();
  }
@imonogarov imonogarov added this to the 4.3.8 milestone Aug 7, 2024
ickisIckis added a commit that referenced this issue Aug 8, 2024
@ickisIckis ickisIckis added type:bug Something isn't working state:ready ready for release (pass tested) labels Aug 8, 2024
ickisIckis added a commit that referenced this issue Aug 8, 2024
ZurabDev added a commit that referenced this issue Aug 9, 2024
…elect-all-1919

fix(components/multiselect): usage with transformers should cover case with selectAll option #1919
@ZurabDev ZurabDev mentioned this issue Aug 9, 2024
ickisIckis added a commit that referenced this issue Aug 12, 2024
…elect-all-1919_v3

fix(components/multiselect): usage with transformers should cover case with selectAll option #1919
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state:ready ready for release (pass tested) type:bug Something isn't working
Projects
None yet
3 participants