Skip to content

feat(plasma-ui): VirtualCarousel #1131

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Conversation

didolf-sber
Copy link

@didolf-sber didolf-sber commented Mar 3, 2022

Этот PR все еще в работе, но я хочу чуть раньше, чем доделаю его до конца отдать в ревью и попробовать внедрять
Что еще в работе:

  • тесты
  • автоматический расчет height/width(удаление carouselHeight и height/width из style на корневом элементе)
  • автоматическая генерация функции estimateSize
  • заменить setTimeout на RAF в useRemoteHandlers
  • вернуть useRemoteHandlers - поддержка long нажатия, подкрутка к определенному элементу извне
📦 Published PR as canary version: Canary Versions

✨ Test out this PR locally via:

npm install @sberdevices/demo-canvas-app@0.62.0-canary.1131.518ed3e5f260979be6bef7e94c9db7abaf7edddf.0
npm install @sberdevices/plasma-b2c@1.44.0-canary.1131.518ed3e5f260979be6bef7e94c9db7abaf7edddf.0
npm install @sberdevices/plasma-core@1.52.0-canary.1131.518ed3e5f260979be6bef7e94c9db7abaf7edddf.0
npm install @sberdevices/plasma-icons@1.70.0-canary.1131.518ed3e5f260979be6bef7e94c9db7abaf7edddf.0
npm install @sberdevices/plasma-temple@1.34.0-canary.1131.518ed3e5f260979be6bef7e94c9db7abaf7edddf.0
npm install @sberdevices/plasma-ui@1.85.0-canary.1131.518ed3e5f260979be6bef7e94c9db7abaf7edddf.0
npm install @sberdevices/plasma-web@1.79.0-canary.1131.518ed3e5f260979be6bef7e94c9db7abaf7edddf.0
npm install @sberdevices/plasma-cy-utils@0.8.0-canary.1131.518ed3e5f260979be6bef7e94c9db7abaf7edddf.0
npm install @sberdevices/plasma-sb-utils@0.51.0-canary.1131.518ed3e5f260979be6bef7e94c9db7abaf7edddf.0
npm install @sberdevices/showcase@0.100.0-canary.1131.518ed3e5f260979be6bef7e94c9db7abaf7edddf.0
npm install @sberdevices/plasma-ui-docs@0.46.0-canary.1131.518ed3e5f260979be6bef7e94c9db7abaf7edddf.0
npm install @sberdevices/plasma-web-docs@0.36.0-canary.1131.518ed3e5f260979be6bef7e94c9db7abaf7edddf.0
npm install @sberdevices/plasma-website@0.34.0-canary.1131.518ed3e5f260979be6bef7e94c9db7abaf7edddf.0
# or 
yarn add @sberdevices/demo-canvas-app@0.62.0-canary.1131.518ed3e5f260979be6bef7e94c9db7abaf7edddf.0
yarn add @sberdevices/plasma-b2c@1.44.0-canary.1131.518ed3e5f260979be6bef7e94c9db7abaf7edddf.0
yarn add @sberdevices/plasma-core@1.52.0-canary.1131.518ed3e5f260979be6bef7e94c9db7abaf7edddf.0
yarn add @sberdevices/plasma-icons@1.70.0-canary.1131.518ed3e5f260979be6bef7e94c9db7abaf7edddf.0
yarn add @sberdevices/plasma-temple@1.34.0-canary.1131.518ed3e5f260979be6bef7e94c9db7abaf7edddf.0
yarn add @sberdevices/plasma-ui@1.85.0-canary.1131.518ed3e5f260979be6bef7e94c9db7abaf7edddf.0
yarn add @sberdevices/plasma-web@1.79.0-canary.1131.518ed3e5f260979be6bef7e94c9db7abaf7edddf.0
yarn add @sberdevices/plasma-cy-utils@0.8.0-canary.1131.518ed3e5f260979be6bef7e94c9db7abaf7edddf.0
yarn add @sberdevices/plasma-sb-utils@0.51.0-canary.1131.518ed3e5f260979be6bef7e94c9db7abaf7edddf.0
yarn add @sberdevices/showcase@0.100.0-canary.1131.518ed3e5f260979be6bef7e94c9db7abaf7edddf.0
yarn add @sberdevices/plasma-ui-docs@0.46.0-canary.1131.518ed3e5f260979be6bef7e94c9db7abaf7edddf.0
yarn add @sberdevices/plasma-web-docs@0.36.0-canary.1131.518ed3e5f260979be6bef7e94c9db7abaf7edddf.0
yarn add @sberdevices/plasma-website@0.34.0-canary.1131.518ed3e5f260979be6bef7e94c9db7abaf7edddf.0

@SberDevices-Eva
Copy link
Collaborator

Demo canvas app deployed!

http://plasma.sberdevices.ru/demo-canvas-app-pr-1131/

@codecov
Copy link

codecov bot commented Mar 3, 2022

Codecov Report

Merging #1131 (f155178) into master (aea3939) will decrease coverage by 1.66%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master    #1131      +/-   ##
==========================================
- Coverage   88.93%   87.27%   -1.67%     
==========================================
  Files         349      316      -33     
  Lines        4611     4125     -486     
  Branches     1368     1225     -143     
==========================================
- Hits         4101     3600     -501     
- Misses        509      524      +15     
  Partials        1        1              
Flag Coverage Δ
plasma-b2c 11.90% <ø> (-83.93%) ⬇️
plasma-core 93.52% <ø> (-1.51%) ⬇️
plasma-temple 76.51% <ø> (ø)
plasma-ui 94.39% <ø> (ø)
plasma-web 96.71% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
packages/plasma-b2c/src/components/Upload/utils.ts 8.33% <0.00%> (-91.67%) ⬇️
.../plasma-b2c/src/components/PreviewGallery/utils.ts 13.33% <0.00%> (-86.67%) ⬇️
...sma-b2c/src/components/AudioPlayer/AudioPlayer.tsx
...s/plasma-b2c/src/components/Select/SelectGroup.tsx
...a-b2c/src/components/UploadVisual/UploadVisual.tsx
...es/plasma-b2c/src/components/Slider/SliderBase.tsx
...sma-b2c/src/components/UploadAudio/UploadAudio.tsx
...plasma-b2c/src/components/Upload/UploadMessage.tsx
...es/plasma-b2c/src/components/Editable/Editable.tsx
...es/plasma-b2c/src/components/Upload/UploadRoot.tsx
... and 25 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update aea3939...f155178. Read the comment docs.

@SberDevices-Eva
Copy link
Collaborator

[min, max],
);

useRemoteListener((key, ev) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

то же самое есть внутри виртуализации (useVirtual) - надо оставить только в одном месте

* Хранилище элементов карусели.
*/
export class VirtualCarouselItemRefs {
public items: MutableRefObject<HTMLElement | null>[] = [];
Copy link
Contributor

Choose a reason for hiding this comment

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

а для чего это надо? сори, не осознала

* Подсчет: от 0 до 1, какое количество ширины/высоты
* каждого элемента находится по центру скролла.
*/
const detectActiveItem = useCallback(
Copy link
Contributor

Choose a reason for hiding this comment

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

useVirtual возвращает currentIndex, надо определиться где оно будет и только в одном месте детектить ActiveItem/currentIndex

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants