Skip to content

Commit

Permalink
constants
Browse files Browse the repository at this point in the history
  • Loading branch information
xaksis committed Feb 27, 2021
1 parent a918c87 commit 1e773f8
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 4 deletions.
8 changes: 5 additions & 3 deletions src/components/pagination/VgtPagination.vue
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,10 @@
<script>
import cloneDeep from 'lodash.clonedeep';
import VgtPaginationPageInfo from './VgtPaginationPageInfo.vue';
const DEFAULT_ROWS_PER_PAGE_DROPDOWN = [10, 20, 30, 40, 50];
import {
PAGINATION_MODES,
DEFAULT_ROWS_PER_PAGE_DROPDOWN
} from '../utils/constants';
export default {
name: 'VgtPagination',
Expand All @@ -71,7 +73,7 @@ export default {
perPageDropdownEnabled: { default: true },
customRowsPerPageDropdown: { default() { return []; } },
paginateDropdownAllowAll: { default: true },
mode: { default: 'records' },
mode: { default: PAGINATION_MODES.Records },
// text options
nextText: { default: 'Next' },
Expand Down
6 changes: 5 additions & 1 deletion src/components/pagination/VgtPaginationPageInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
</template>

<script>
import {
PAGINATION_MODES,
} from '../utils/constants';
export default {
name: 'VgtPaginationPageInfo',
props: {
Expand All @@ -49,7 +53,7 @@ export default {
},
currentPerPage: {},
mode: {
default: 'records',
default: PAGINATION_MODES.Records,
},
infoFn: { default: null },
},
Expand Down
20 changes: 20 additions & 0 deletions src/components/utils/constants.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const DEFAULT_SORT_TYPE = 'asc';
const SORT_TYPES = {
Ascending: 'asc',
Descending: 'desc',
None: 'none',
};

const PAGINATION_MODES = {
Pages: 'pages',
Records: 'records',
};
const DEFAULT_ROWS_PER_PAGE_DROPDOWN = [10, 20, 30, 40, 50];

export {
DEFAULT_SORT_TYPE,
SORT_TYPES,

PAGINATION_MODES,
DEFAULT_ROWS_PER_PAGE_DROPDOWN,
};

0 comments on commit 1e773f8

Please sign in to comment.