From c8d0a30fcbcebe66ba16c7e442732b977737af41 Mon Sep 17 00:00:00 2001 From: Oleg <64714442+aluarius@users.noreply.github.com> Date: Tue, 31 Jan 2023 15:19:19 +0400 Subject: [PATCH] [#2785] Throttling composable, integration to VaSelect and VaDataTable (#2832) --- packages/docs/src/locales/en/en.json | 1 + packages/docs/src/locales/ru/ru.json | 1 + packages/docs/src/locales/zh-cn/zh-cn.json | 4 +- .../va-data-table/VaDataTable.new.demo.vue | 13 +++ .../components/va-data-table/VaDataTable.vue | 3 +- .../va-data-table/hooks/useFilterable.ts | 13 ++- .../va-data-table/hooks/usePaginatedRows.ts | 7 +- .../va-data-table/hooks/useSortable.ts | 7 +- .../components/va-select/VaSelect.demo.vue | 7 ++ .../ui/src/components/va-select/VaSelect.vue | 4 +- .../VaSelectOptionList/VaSelectOptionList.vue | 7 +- packages/ui/src/composables/index.ts | 1 + packages/ui/src/composables/useThrottle.ts | 101 ++++++++++++++++++ 13 files changed, 158 insertions(+), 11 deletions(-) create mode 100644 packages/ui/src/composables/useThrottle.ts diff --git a/packages/docs/src/locales/en/en.json b/packages/docs/src/locales/en/en.json index 633660584b..a5ed2af944 100644 --- a/packages/docs/src/locales/en/en.json +++ b/packages/docs/src/locales/en/en.json @@ -186,6 +186,7 @@ "fallbackText": "Shows an alternative text if image failed to load or src doesn't specified.", "fallbackIcon": "Shows an icon if image failed to load or src doesn't specified.", "fallbackRender": "Allows to use render function to render custom contents if image failed to load or src doesn't specified", + "delay": "Sets throttling delay (ms) for the components any data change (useful for huge data).", "ratio": "Aspect ratio of the component's wrapper." } }, diff --git a/packages/docs/src/locales/ru/ru.json b/packages/docs/src/locales/ru/ru.json index 907d495542..c33cf6e834 100644 --- a/packages/docs/src/locales/ru/ru.json +++ b/packages/docs/src/locales/ru/ru.json @@ -183,6 +183,7 @@ "fallbackText": "Показывает альтернативный текст, если изображение не указано или не удалось загрузить.", "fallbackIcon": "Показывает альтернативную иконку, если изображение не указано или не удалось загрузить.", "fallbackRender": "Позволяет задать функцию-рендерер с настраиваемым содержимым, если изображение не указано или не удалось загрузить.", + "delay": "Устанавливает задержку (тротлинг в ms) изменения данных в компоненте (при рендеринге больших объемов данных).", "ratio": "Соотношение сторон обертки компонента." } }, diff --git a/packages/docs/src/locales/zh-cn/zh-cn.json b/packages/docs/src/locales/zh-cn/zh-cn.json index 239edf24cb..66aa1a76a4 100644 --- a/packages/docs/src/locales/zh-cn/zh-cn.json +++ b/packages/docs/src/locales/zh-cn/zh-cn.json @@ -179,10 +179,12 @@ "plain": "Applies `plain` styling.", "round": "Adds rounded corners (or make a button fully rounded if only icon is passed).", "iconRight": "The icon to be displayed to the right of a title.", + "keyboardNavigation": "Enables keyboard navigation for the component.", "fallbackSrc": "Shows an alternative image if original image failed to load or src doesn't specified.", "fallbackText": "Shows an alternative text if image failed to load or src doesn't specified.", "fallbackIcon": "Shows an icon if image failed to load or src doesn't specified.", - "fallbackRender": "Allows to use render function to render custom contents if image failed to load or src doesn't specified" + "fallbackRender": "Allows to use render function to render custom contents if image failed to load or src doesn't specified", + "delay": "Sets throttling delay (ms) for the components any data change (useful for huge data)." } }, "VaBadge": { diff --git a/packages/ui/src/components/va-data-table/VaDataTable.new.demo.vue b/packages/ui/src/components/va-data-table/VaDataTable.new.demo.vue index cc7acc6db6..f3f6f713e2 100644 --- a/packages/ui/src/components/va-data-table/VaDataTable.new.demo.vue +++ b/packages/ui/src/components/va-data-table/VaDataTable.new.demo.vue @@ -120,6 +120,19 @@ + + + + + + +