From 585bb7c75a8daa68150ef4c63dc1ec13c82c3b4d Mon Sep 17 00:00:00 2001 From: ericreis Date: Wed, 2 Sep 2020 18:00:39 -0300 Subject: [PATCH] Add pagination support to Select component --- CHANGELOG.md | 4 + .../components/EXPERIMENTAL_Select/README.md | 46 +++ react/components/EXPERIMENTAL_Select/index.js | 336 +++++++++--------- react/package.json | 1 + react/yarn.lock | 37 ++ 5 files changed, 258 insertions(+), 166 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eb44ceb77..5659a3883 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +### Added + +- Support for lazy loading select options with pagination. + ## [9.128.1] - 2020-08-28 ### Fixed diff --git a/react/components/EXPERIMENTAL_Select/README.md b/react/components/EXPERIMENTAL_Select/README.md index 3bad6c3ba..21c85c6d2 100755 --- a/react/components/EXPERIMENTAL_Select/README.md +++ b/react/components/EXPERIMENTAL_Select/README.md @@ -393,3 +393,49 @@ class SelectWithModalExample extends React.Component { ; ``` + +Paginated + +```js +const options = [] +for (let i = 0; i < 1000; ++i) { + options.push({ + value: i + 1, + label: `Option ${i + 1}`, + }) +} + +const sleep = ms => + new Promise(resolve => { + setTimeout(() => { + resolve() + }, ms) + }) + +;
+
+