web: Components: Fixed Paging component and story.

This commit is contained in:
Ilya Oleshko 2019-08-14 17:24:01 +03:00
parent d6e09f19e4
commit e352086fc3
3 changed files with 11 additions and 17 deletions

View File

@ -42,7 +42,7 @@ const nextAction = () => {
const Paging = props => {
//console.log("Paging render");
const { previousLabel, nextLabel, previousAction, nextAction, pageItems, countItems,
openDirection, disablePrevious, disableNext, defaultPageItem, defaultCountItem} = props;
openDirection, disablePrevious, disableNext, selectedPageItem, selectedCountItem} = props;
const onSelectPageAction = (option) => {
props.onSelectPage(option);
@ -68,7 +68,7 @@ const Paging = props => {
directionY={openDirection}
options={pageItems}
onSelect={onSelectPageAction}
selectedOption={defaultPageItem}
selectedOption={selectedPageItem}
{...setDropDownMaxHeight} />
</StyledPage>
}
@ -84,7 +84,7 @@ const Paging = props => {
directionY={openDirection}
options={countItems}
onSelect={onSelectCountAction}
selectedOption={defaultCountItem}/>
selectedOption={selectedCountItem}/>
</StyledOnPage>
}
</StyledPaging>
@ -101,8 +101,8 @@ Paging.propTypes = {
disablePrevious: PropTypes.bool,
disableNext: PropTypes.bool,
defaultPageItem: PropTypes.object,
defaultCountItem: PropTypes.object,
selectedPageItem: PropTypes.object,
selectedCountItem: PropTypes.object,
onSelectPage: PropTypes.func,
onSelectCount: PropTypes.func

View File

@ -19,10 +19,6 @@ import { Paging } from 'asc-web-components';
openDirection='bottom'
disablePrevious={false}
disableNext={false}
selectedPage={1}
selectedCount={25}
emptyPagePlaceholder='1 of 1'
emptyCountPlaceholder='25 per page'
/>
```
@ -39,7 +35,5 @@ import { Paging } from 'asc-web-components';
| `openDirection` | `string` | - | `top`, `bottom` | `bottom`| Indicates opening direction of combo box |
| `disablePrevious` | `bool` | - | - | `false` | Set previous button disabled |
| `disableNext` | `bool` | - | - | `false` | Set next button disabled |
| `selectedPage` | `string`,`number` | - | - | - | Initial value for pageItems |
| `selectedCount` | `string`,`number` | - | - | - | Initial value for countItems |
| `emptyPagePlaceholder` | `string` | - | - | - | Value that will be displayed in page selection when collection is empty|
| `emptyCountPlaceholder`| `string` | - | - | - | Value that will be displayed in count selection when collection is empty|
| `selectedPageItem` | `object` | - | - | - | Initial value for pageItems |
| `selectedCountItem` | `object` | - | - | - | Initial value for countItems |

View File

@ -42,16 +42,16 @@ storiesOf('Components|Paging', module)
const selectedCount = select('selectedCount', [25, 50, 100], 100);
const pageCount = number('Count of pages', 10);
const pageItems = createPageItems(pageCount);
const defaultPageItem = pageItems[0];
const defaultCountItem = countItems[0];
const selectedPageItem = pageItems[0];
const selectedCountItem = countItems[0];
return (
<Section>
<Paging previousLabel={text('previousLabel', 'Previous')}
nextLabel={text('nextLabel', 'Next')}
pageItems={displayItems ? pageItems : undefined}
defaultPageItem={defaultPageItem}
defaultCountItem={defaultCountItem}
selectedPageItem={selectedPageItem}
selectedCountItem={selectedCountItem}
countItems={displayCount ? countItems : undefined}
disablePrevious={boolean('disablePrevious', false)}
disableNext={boolean('disableNext', false)}