File tree Expand file tree Collapse file tree 4 files changed +49
-1
lines changed
packages/react-renderer-demo/src Expand file tree Collapse file tree 4 files changed +49
-1
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import GenericComponentText from './examples-texts/generic-mui-component';
3
3
import TabsText from './examples-texts/tabs' ;
4
4
import CustomComponentText from './examples-texts/custom-component' ;
5
5
import WizardText from './examples-texts/wizard' ;
6
+ import SelectText from './examples-texts/select' ;
6
7
7
8
export const baseExamples = [ {
8
9
component : componentTypes . TEXT_FIELD ,
@@ -120,7 +121,7 @@ export const baseExamples = [{
120
121
{
121
122
component : componentTypes . SELECT_COMPONENT ,
122
123
linkText : 'Select' ,
123
- ContentText : GenericComponentText ,
124
+ ContentText : SelectText ,
124
125
canBeRequired : true ,
125
126
value : { fields : [ {
126
127
component : componentTypes . SELECT_COMPONENT ,
Original file line number Diff line number Diff line change
1
+ import React from 'react' ;
2
+ import GenericComponentText from './generic-mui-component' ;
3
+ import Pf3Select from 'docs/components/pf3-select.md' ;
4
+ import Pf4Select from 'docs/components/pf4-select.md' ;
5
+
6
+ export default ( { activeMapper } ) => activeMapper === 'pf3' ? < Pf3Select /> : activeMapper === 'pf4' ? < Pf4Select /> : < GenericComponentText /> ;
Original file line number Diff line number Diff line change
1
+ ### Async Select
2
+
3
+ PF3 Select allows to load the options asynchronously.
4
+
5
+
6
+ | prop name| type| description|
7
+ | ---------| ----| -----------|
8
+ | loadOptions| ` func ` | A function returning ` Promise ` , only on mount.|
9
+ | loadingMessage| ` string ` | A message shown during the loading.|
10
+
11
+ #### loadOptions example
12
+
13
+ Currently now, PF3 select supports only loading on mounting.
14
+
15
+ ``` jsx
16
+ const asyncLoadOptions = () => new Promise (resolve => setTimeout (() => resolve (options), 2000 ));
17
+ ```
Original file line number Diff line number Diff line change
1
+ ### Async Select
2
+
3
+ PF4 Select allows to load the options asynchronously.
4
+
5
+
6
+ | prop name| type| description|
7
+ | ---------| ----| -----------|
8
+ | loadOptions| ` func ` | A function returning ` Promise ` : ` (searchValue) => new Promise ` |
9
+ | loadingMessage| ` node ` | A message shown during the initial loading.|
10
+ | updatingMessage| ` node ` | A message shown during the loading|
11
+
12
+ #### loadOptions example
13
+
14
+ ` loadOptions ` receives a search input text as an argument.
15
+
16
+ ``` jsx
17
+ const asyncLoadOptions = (searchValue ) => new Promise (resolve => setTimeout (() => {
18
+ if (searchValue && searchValue .trim () !== ' ' ) {
19
+ return resolve (asyncOptions .filter (({ label }) => label .toLocaleLowerCase ().includes (searchValue .trim ().toLocaleLowerCase ())));
20
+ }
21
+
22
+ return resolve (options);
23
+ }, 2000 ));
24
+ ```
You can’t perform that action at this time.
0 commit comments