@onereach/ui-components 2.69.2-beta.2106.0 → 2.69.2-beta.2108.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundled/v2/{OrButton-66d37aff.js → OrButton-0e91a808.js} +1 -14
- package/dist/bundled/v2/{OrCardCollection-a9a779ea.js → OrCardCollection-3d1b3b9a.js} +1 -1
- package/dist/bundled/v2/{OrConfirm-e1ca1422.js → OrConfirm-43626f94.js} +2 -2
- package/dist/bundled/v2/{OrInput-8b90e08f.js → OrInput-0a3666aa.js} +18 -11
- package/dist/bundled/v2/{OrInputBox-79ec54ad.js → OrInputBox-dfdcbdce.js} +4 -14
- package/dist/bundled/v2/{OrSearch-9d402f56.js → OrSearch-847c1bab.js} +2 -2
- package/dist/bundled/v2/{OrSelect-ff9e4fbd.js → OrSelect-41c6588d.js} +11 -5
- package/dist/bundled/v2/{OrTextarea-5593fbe9.js → OrTextarea-ff2ba975.js} +2 -1
- package/dist/bundled/v2/components/index.d.ts +0 -1
- package/dist/bundled/v2/components/index.js +9 -9
- package/dist/bundled/v2/components/or-button-v3/OrButton.vue.d.ts +0 -11
- package/dist/bundled/v2/components/or-button-v3/index.js +1 -1
- package/dist/bundled/v2/components/or-card-collection-v3/index.js +4 -3
- package/dist/bundled/v2/components/or-combined-input-v3/OrCombinedInput.stories3.d.ts +27 -0
- package/dist/bundled/v2/components/or-combined-input-v3/OrCombinedInput.vue.d.ts +98 -0
- package/dist/bundled/v2/components/or-combined-input-v3/index.d.ts +2 -0
- package/dist/bundled/v2/components/or-combined-input-v3/index.js +149 -0
- package/dist/bundled/v2/components/or-combined-input-v3/props.d.ts +1 -0
- package/dist/bundled/v2/components/or-combined-input-v3/styles.d.ts +2 -0
- package/dist/bundled/v2/components/or-confirm-v3/index.js +5 -4
- package/dist/bundled/v2/components/or-input-box-v3/index.js +2 -1
- package/dist/bundled/v2/components/or-input-v3/index.js +3 -2
- package/dist/bundled/v2/components/or-search-v3/index.js +4 -3
- package/dist/bundled/v2/components/or-select-v3/OrSelect.vue.d.ts +25 -14
- package/dist/bundled/v2/components/or-select-v3/index.d.ts +0 -1
- package/dist/bundled/v2/components/or-select-v3/index.js +4 -3
- package/dist/bundled/v2/components/or-select-v3/types.d.ts +1 -1
- package/dist/bundled/v2/components/or-textarea-v3/index.js +3 -2
- package/dist/bundled/v2/index.js +10 -10
- package/dist/bundled/v2/props-78496a2d.js +12 -0
- package/dist/bundled/v3/{OrButton.vue_vue_type_script_lang-06d8ead1.js → OrButton.vue_vue_type_script_lang-3718b300.js} +1 -13
- package/dist/bundled/v3/{OrCardCollection.vue_vue_type_script_lang-3993a015.js → OrCardCollection.vue_vue_type_script_lang-fd4d589f.js} +2 -2
- package/dist/bundled/v3/{OrConfirm.vue_vue_type_script_lang-f1b81f00.js → OrConfirm.vue_vue_type_script_lang-338631e0.js} +38 -8
- package/dist/bundled/v3/{OrInput-fa782fc1.js → OrInput-5efc4b9a.js} +17 -14
- package/dist/bundled/v3/{OrInput.vue_vue_type_script_lang-f6d793d3.js → OrInput.vue_vue_type_script_lang-a9f3e530.js} +3 -2
- package/dist/bundled/v3/{OrInputBox-eb54d73d.js → OrInputBox-1b143e00.js} +1 -1
- package/dist/{esm/v2/OrInputBox-4d5a318d.js → bundled/v3/OrInputBox.vue_vue_type_script_lang-70dec655.js} +6 -57
- package/dist/bundled/v3/{OrSearch.vue_vue_type_script_lang-ed78b21f.js → OrSearch.vue_vue_type_script_lang-df09cad8.js} +3 -3
- package/dist/bundled/v3/{OrSelect.vue_vue_type_script_lang-05b03858.js → OrSelect.vue_vue_type_script_lang-cf991ed8.js} +11 -6
- package/dist/bundled/v3/{OrTabs.vue_vue_type_script_lang-61b79a5a.js → OrTabs.vue_vue_type_script_lang-919b2021.js} +36 -10
- package/dist/bundled/v3/{OrTextarea.vue_vue_type_script_lang-8e3531cd.js → OrTextarea.vue_vue_type_script_lang-115a1244.js} +3 -2
- package/dist/bundled/v3/components/index.d.ts +0 -1
- package/dist/bundled/v3/components/index.js +12 -14
- package/dist/bundled/v3/components/or-button-v3/OrButton.vue.d.ts +0 -11
- package/dist/bundled/v3/components/or-button-v3/index.js +1 -1
- package/dist/bundled/v3/components/or-card-collection-v3/index.js +6 -5
- package/dist/bundled/v3/components/or-combined-input-v3/OrCombinedInput.stories3.d.ts +27 -0
- package/dist/bundled/v3/components/or-combined-input-v3/OrCombinedInput.vue.d.ts +98 -0
- package/dist/bundled/v3/components/or-combined-input-v3/index.d.ts +2 -0
- package/dist/bundled/v3/components/or-combined-input-v3/index.js +132 -0
- package/dist/bundled/v3/components/or-combined-input-v3/props.d.ts +1 -0
- package/dist/bundled/v3/components/or-combined-input-v3/styles.d.ts +2 -0
- package/dist/bundled/v3/components/or-confirm-v3/index.js +7 -7
- package/dist/bundled/v3/components/or-input-box-v3/index.js +2 -1
- package/dist/bundled/v3/components/or-input-v3/index.js +4 -3
- package/dist/bundled/v3/components/or-search-v3/index.js +6 -5
- package/dist/bundled/v3/components/or-select-v3/OrSelect.vue.d.ts +25 -14
- package/dist/bundled/v3/components/or-select-v3/index.d.ts +0 -1
- package/dist/bundled/v3/components/or-select-v3/index.js +6 -5
- package/dist/bundled/v3/components/or-select-v3/types.d.ts +1 -1
- package/dist/bundled/v3/components/or-tabs-v3/index.js +1 -2
- package/dist/bundled/v3/components/or-textarea-v3/index.js +4 -3
- package/dist/bundled/v3/index.js +162 -242
- package/dist/bundled/v3/props-78496a2d.js +12 -0
- package/dist/esm/v2/{OrButton-3d4fc9da.js → OrButton-357a5756.js} +1 -14
- package/dist/esm/v2/{OrCardCollection-4f001551.js → OrCardCollection-09e4cb8a.js} +1 -1
- package/dist/esm/v2/{OrConfirm-ba3f8c45.js → OrConfirm-93376443.js} +2 -2
- package/dist/esm/v2/{OrInput-2f16a7ac.js → OrInput-f92456ea.js} +18 -11
- package/dist/esm/v2/OrInputBox-ad7c1875.js +43 -0
- package/dist/{bundled/v3/OrInputBox.vue_vue_type_script_lang-5ee4ee45.js → esm/v2/OrInputBox.vue_rollup-plugin-vue_script-52a54a49.js} +5 -4
- package/dist/esm/v2/{OrSearch-ddb7c1fe.js → OrSearch-4296eecb.js} +2 -2
- package/dist/esm/v2/{OrSelect-651bb83e.js → OrSelect-633a9e09.js} +11 -5
- package/dist/esm/v2/{OrTextarea-6712a150.js → OrTextarea-823d0529.js} +2 -1
- package/dist/esm/v2/components/index.d.ts +0 -1
- package/dist/esm/v2/components/index.js +9 -9
- package/dist/esm/v2/components/or-button-v3/OrButton.vue.d.ts +0 -11
- package/dist/esm/v2/components/or-button-v3/index.js +1 -1
- package/dist/esm/v2/components/or-card-collection-v3/index.js +4 -3
- package/dist/esm/v2/components/or-combined-input-v3/OrCombinedInput.stories3.d.ts +27 -0
- package/dist/esm/v2/components/or-combined-input-v3/OrCombinedInput.vue.d.ts +98 -0
- package/dist/esm/v2/components/or-combined-input-v3/index.d.ts +2 -0
- package/dist/esm/v2/components/or-combined-input-v3/index.js +147 -0
- package/dist/esm/v2/components/or-combined-input-v3/props.d.ts +1 -0
- package/dist/esm/v2/components/or-combined-input-v3/styles.d.ts +2 -0
- package/dist/esm/v2/components/or-confirm-v3/index.js +5 -4
- package/dist/esm/v2/components/or-input-box-v3/index.js +3 -2
- package/dist/esm/v2/components/or-input-v3/index.js +3 -2
- package/dist/esm/v2/components/or-search-v3/index.js +4 -3
- package/dist/esm/v2/components/or-select-v3/OrSelect.vue.d.ts +25 -14
- package/dist/esm/v2/components/or-select-v3/index.d.ts +0 -1
- package/dist/esm/v2/components/or-select-v3/index.js +4 -3
- package/dist/esm/v2/components/or-select-v3/types.d.ts +1 -1
- package/dist/esm/v2/components/or-textarea-v3/index.js +3 -2
- package/dist/esm/v2/index.js +9 -9
- package/dist/esm/v3/{OrButton-970ae320.js → OrButton-f4b9ee51.js} +2 -15
- package/dist/esm/v3/{OrCardCollection-5a0febaf.js → OrCardCollection-37226d46.js} +1 -1
- package/dist/esm/v3/{OrConfirm-7cb2f36b.js → OrConfirm-b27e7221.js} +2 -2
- package/dist/esm/v3/{OrInput-41691fb3.js → OrInput-99776ffe.js} +17 -14
- package/dist/esm/v3/{OrInputBox-5247ab25.js → OrInputBox-36c102a4.js} +2 -2
- package/dist/esm/v3/{OrSearch-cdde55ce.js → OrSearch-188c643f.js} +2 -2
- package/dist/esm/v3/{OrSelect-28a175dc.js → OrSelect-cba3966c.js} +11 -6
- package/dist/esm/v3/{OrTextarea-bb9ef3f2.js → OrTextarea-b3ecc40d.js} +1 -1
- package/dist/esm/v3/components/index.d.ts +0 -1
- package/dist/esm/v3/components/index.js +8 -9
- package/dist/esm/v3/components/or-button-v3/OrButton.vue.d.ts +0 -11
- package/dist/esm/v3/components/or-button-v3/index.js +1 -1
- package/dist/esm/v3/components/or-card-collection-v3/index.js +3 -3
- package/dist/esm/v3/components/or-combined-input-v3/OrCombinedInput.stories3.d.ts +27 -0
- package/dist/esm/v3/components/or-combined-input-v3/OrCombinedInput.vue.d.ts +98 -0
- package/dist/esm/v3/components/or-combined-input-v3/index.d.ts +2 -0
- package/dist/esm/v3/components/or-combined-input-v3/index.js +132 -0
- package/dist/esm/v3/components/or-combined-input-v3/props.d.ts +1 -0
- package/dist/esm/v3/components/or-combined-input-v3/styles.d.ts +2 -0
- package/dist/esm/v3/components/or-confirm-v3/index.js +4 -4
- package/dist/esm/v3/components/or-input-box-v3/index.js +1 -1
- package/dist/esm/v3/components/or-input-v3/index.js +2 -2
- package/dist/esm/v3/components/or-search-v3/index.js +3 -3
- package/dist/esm/v3/components/or-select-v3/OrSelect.vue.d.ts +25 -14
- package/dist/esm/v3/components/or-select-v3/index.d.ts +0 -1
- package/dist/esm/v3/components/or-select-v3/index.js +3 -3
- package/dist/esm/v3/components/or-select-v3/types.d.ts +1 -1
- package/dist/esm/v3/components/or-textarea-v3/index.js +2 -2
- package/dist/esm/v3/index.js +8 -9
- package/package.json +2 -2
- package/src/components/index.ts +0 -1
- package/src/components/or-button-v3/OrButton.stories3.ts +0 -4
- package/src/components/or-button-v3/OrButton.vue +0 -6
- package/src/components/or-button-v3/styles.ts +1 -15
- package/src/components/or-combined-input-v3/OrCombinedInput.docs.mdx +7 -0
- package/src/components/or-combined-input-v3/OrCombinedInput.stories3.ts +202 -0
- package/src/components/or-combined-input-v3/OrCombinedInput.vue +134 -0
- package/src/components/or-combined-input-v3/index.ts +2 -0
- package/src/components/or-combined-input-v3/props.ts +1 -0
- package/src/components/or-combined-input-v3/styles.ts +25 -0
- package/src/components/or-input-box-v3/styles.ts +3 -3
- package/src/components/or-input-v3/OrInput.vue +28 -22
- package/src/components/or-select-v3/OrSelect.stories3.ts +4 -0
- package/src/components/or-select-v3/OrSelect.vue +9 -3
- package/src/components/or-select-v3/index.ts +0 -1
- package/src/components/or-select-v3/types.ts +1 -1
- package/dist/bundled/v2/OrPagination-354e9abd.js +0 -296
- package/dist/bundled/v2/components/or-pagination-v3/OrPagination.stories3.d.ts +0 -12
- package/dist/bundled/v2/components/or-pagination-v3/OrPagination.vue.d.ts +0 -110
- package/dist/bundled/v2/components/or-pagination-v3/index.d.ts +0 -2
- package/dist/bundled/v2/components/or-pagination-v3/index.js +0 -20
- package/dist/bundled/v2/components/or-pagination-v3/styles.d.ts +0 -3
- package/dist/bundled/v2/components/or-pagination-v3/types.d.ts +0 -4
- package/dist/bundled/v3/OrButton-9640286b.js +0 -34
- package/dist/bundled/v3/OrMenu-f26e8e55.js +0 -29
- package/dist/bundled/v3/OrPagination.vue_vue_type_script_lang-ff22b11c.js +0 -180
- package/dist/bundled/v3/components/or-pagination-v3/OrPagination.stories3.d.ts +0 -12
- package/dist/bundled/v3/components/or-pagination-v3/OrPagination.vue.d.ts +0 -110
- package/dist/bundled/v3/components/or-pagination-v3/index.d.ts +0 -2
- package/dist/bundled/v3/components/or-pagination-v3/index.js +0 -22
- package/dist/bundled/v3/components/or-pagination-v3/styles.d.ts +0 -3
- package/dist/bundled/v3/components/or-pagination-v3/types.d.ts +0 -4
- package/dist/esm/v2/OrPagination-a56eb93b.js +0 -296
- package/dist/esm/v2/components/or-pagination-v3/OrPagination.stories3.d.ts +0 -12
- package/dist/esm/v2/components/or-pagination-v3/OrPagination.vue.d.ts +0 -110
- package/dist/esm/v2/components/or-pagination-v3/index.d.ts +0 -2
- package/dist/esm/v2/components/or-pagination-v3/index.js +0 -18
- package/dist/esm/v2/components/or-pagination-v3/styles.d.ts +0 -3
- package/dist/esm/v2/components/or-pagination-v3/types.d.ts +0 -4
- package/dist/esm/v3/OrPagination-d351a13b.js +0 -257
- package/dist/esm/v3/components/or-pagination-v3/OrPagination.stories3.d.ts +0 -12
- package/dist/esm/v3/components/or-pagination-v3/OrPagination.vue.d.ts +0 -110
- package/dist/esm/v3/components/or-pagination-v3/index.d.ts +0 -2
- package/dist/esm/v3/components/or-pagination-v3/index.js +0 -17
- package/dist/esm/v3/components/or-pagination-v3/styles.d.ts +0 -3
- package/dist/esm/v3/components/or-pagination-v3/types.d.ts +0 -4
- package/src/components/or-pagination-v3/OrPagination.docs.mdx +0 -7
- package/src/components/or-pagination-v3/OrPagination.stories3.ts +0 -87
- package/src/components/or-pagination-v3/OrPagination.vue +0 -260
- package/src/components/or-pagination-v3/index.ts +0 -2
- package/src/components/or-pagination-v3/styles.ts +0 -30
- package/src/components/or-pagination-v3/types.ts +0 -4
|
@@ -1,260 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div
|
|
3
|
-
ref="root"
|
|
4
|
-
v-bind="$attrs"
|
|
5
|
-
:class="rootStyles"
|
|
6
|
-
>
|
|
7
|
-
<div :class="offsetControlStyles">
|
|
8
|
-
<OrButton
|
|
9
|
-
:variant="'link'"
|
|
10
|
-
:color="'inherit'"
|
|
11
|
-
:disabled="currentPage === firstPage"
|
|
12
|
-
@click.stop="toPreviousPage()"
|
|
13
|
-
>
|
|
14
|
-
<OrIcon :icon="'keyboard_arrow_left'" />
|
|
15
|
-
</OrButton>
|
|
16
|
-
|
|
17
|
-
<OrButton
|
|
18
|
-
v-for="(page, index) in buttonGroup"
|
|
19
|
-
:key="index"
|
|
20
|
-
:variant="'link'"
|
|
21
|
-
:color="'inherit'"
|
|
22
|
-
:activated="currentPage === page"
|
|
23
|
-
@click.stop="typeof page === 'number' && toPage(page)"
|
|
24
|
-
>
|
|
25
|
-
{{ page }}
|
|
26
|
-
</OrButton>
|
|
27
|
-
|
|
28
|
-
<OrButton
|
|
29
|
-
:variant="'link'"
|
|
30
|
-
:color="'inherit'"
|
|
31
|
-
:disabled="currentPage === lastPage"
|
|
32
|
-
@click.stop="toNextPage()"
|
|
33
|
-
>
|
|
34
|
-
<OrIcon :icon="'keyboard_arrow_right'" />
|
|
35
|
-
</OrButton>
|
|
36
|
-
</div>
|
|
37
|
-
|
|
38
|
-
<div :class="limitControlStyles">
|
|
39
|
-
Per page:
|
|
40
|
-
|
|
41
|
-
<OrButton
|
|
42
|
-
ref="limitButton"
|
|
43
|
-
:variant="'link'"
|
|
44
|
-
:color="'inherit'"
|
|
45
|
-
:activated="true"
|
|
46
|
-
@click.stop="limitMenu.open()"
|
|
47
|
-
>
|
|
48
|
-
{{ currentLimit }} <OrIcon :icon="'arrow_drop_down'" />
|
|
49
|
-
</OrButton>
|
|
50
|
-
|
|
51
|
-
<OrMenu
|
|
52
|
-
ref="limitMenu"
|
|
53
|
-
:trigger="limitButtonRoot"
|
|
54
|
-
>
|
|
55
|
-
<OrMenuItem
|
|
56
|
-
v-for="pageSize in pageSizeOptions"
|
|
57
|
-
:key="pageSize"
|
|
58
|
-
@click.stop="currentLimit = pageSize"
|
|
59
|
-
>
|
|
60
|
-
{{ pageSize }}
|
|
61
|
-
</OrMenuItem>
|
|
62
|
-
</OrMenu>
|
|
63
|
-
</div>
|
|
64
|
-
</div>
|
|
65
|
-
</template>
|
|
66
|
-
|
|
67
|
-
<script lang="ts">
|
|
68
|
-
import { computed, defineComponent, PropType, ref } from 'vue-demi';
|
|
69
|
-
import { useClassAttribute } from '../../hooks';
|
|
70
|
-
import { OrButtonV3 as OrButton } from '../or-button-v3';
|
|
71
|
-
import { OrIconV3 as OrIcon } from '../or-icon-v3';
|
|
72
|
-
import { OrMenuItemV3 as OrMenuItem } from '../or-menu-item-v3';
|
|
73
|
-
import { OrMenuV3 as OrMenu } from '../or-menu-v3';
|
|
74
|
-
import { PaginationLimitControl, PaginationOffsetControl, PaginationRoot } from './styles';
|
|
75
|
-
import { PaginationModel } from './types';
|
|
76
|
-
|
|
77
|
-
export default defineComponent({
|
|
78
|
-
name: 'OrPagination',
|
|
79
|
-
|
|
80
|
-
components: {
|
|
81
|
-
OrButton,
|
|
82
|
-
OrIcon,
|
|
83
|
-
OrMenu,
|
|
84
|
-
OrMenuItem,
|
|
85
|
-
},
|
|
86
|
-
|
|
87
|
-
inheritAttrs: false,
|
|
88
|
-
|
|
89
|
-
props: {
|
|
90
|
-
modelValue: {
|
|
91
|
-
type: Object as PropType<PaginationModel>,
|
|
92
|
-
default: {} as PaginationModel,
|
|
93
|
-
},
|
|
94
|
-
|
|
95
|
-
value: { // TODO: Remove Vue 2 fallback
|
|
96
|
-
type: Object as PropType<PaginationModel>,
|
|
97
|
-
default: {} as PaginationModel,
|
|
98
|
-
},
|
|
99
|
-
|
|
100
|
-
length: {
|
|
101
|
-
type: Number,
|
|
102
|
-
required: true,
|
|
103
|
-
},
|
|
104
|
-
|
|
105
|
-
pageSizeOptions: {
|
|
106
|
-
type: Array as PropType<number[]>,
|
|
107
|
-
default: [50, 20, 10, 5] as number[],
|
|
108
|
-
},
|
|
109
|
-
},
|
|
110
|
-
|
|
111
|
-
emits: [
|
|
112
|
-
'update:modelValue',
|
|
113
|
-
|
|
114
|
-
'input',
|
|
115
|
-
],
|
|
116
|
-
|
|
117
|
-
expose: [
|
|
118
|
-
'root',
|
|
119
|
-
],
|
|
120
|
-
|
|
121
|
-
setup(props, context) {
|
|
122
|
-
// Refs
|
|
123
|
-
const root = ref<HTMLElement>();
|
|
124
|
-
|
|
125
|
-
const limitButton = ref<InstanceType<typeof OrButton>>();
|
|
126
|
-
const limitButtonRoot = computed(() => limitButton.value?.root);
|
|
127
|
-
|
|
128
|
-
const limitMenu = ref<InstanceType<typeof OrMenu>>();
|
|
129
|
-
const limitMenuRoot = computed(() => limitMenu.value?.root);
|
|
130
|
-
|
|
131
|
-
// Styles
|
|
132
|
-
const classAttribute = useClassAttribute();
|
|
133
|
-
|
|
134
|
-
const rootStyles = computed(() => [
|
|
135
|
-
'or-pagination',
|
|
136
|
-
...PaginationRoot,
|
|
137
|
-
classAttribute.value,
|
|
138
|
-
]);
|
|
139
|
-
|
|
140
|
-
const offsetControlStyles = computed(() => [
|
|
141
|
-
...PaginationOffsetControl,
|
|
142
|
-
]);
|
|
143
|
-
|
|
144
|
-
const limitControlStyles = computed(() => [
|
|
145
|
-
...PaginationLimitControl,
|
|
146
|
-
]);
|
|
147
|
-
|
|
148
|
-
// State
|
|
149
|
-
const proxyModelValue = computed({
|
|
150
|
-
get: () => {
|
|
151
|
-
return props.modelValue ?? props.value; // TODO: Remove Vue 2 fallback
|
|
152
|
-
},
|
|
153
|
-
|
|
154
|
-
set: (value) => {
|
|
155
|
-
context.emit('input', value);
|
|
156
|
-
context.emit('update:modelValue', value);
|
|
157
|
-
},
|
|
158
|
-
});
|
|
159
|
-
|
|
160
|
-
const currentLimit = computed<number>({
|
|
161
|
-
get: () => {
|
|
162
|
-
return proxyModelValue.value.limit ?? props.pageSizeOptions[0];
|
|
163
|
-
},
|
|
164
|
-
|
|
165
|
-
set: (value) => {
|
|
166
|
-
proxyModelValue.value = {
|
|
167
|
-
limit: value,
|
|
168
|
-
offset: currentOffset.value,
|
|
169
|
-
};
|
|
170
|
-
},
|
|
171
|
-
});
|
|
172
|
-
|
|
173
|
-
const currentOffset = computed<number>({
|
|
174
|
-
get: () => {
|
|
175
|
-
return proxyModelValue.value.offset ?? 0;
|
|
176
|
-
},
|
|
177
|
-
|
|
178
|
-
set: (value) => {
|
|
179
|
-
proxyModelValue.value = {
|
|
180
|
-
limit: currentLimit.value,
|
|
181
|
-
offset: value,
|
|
182
|
-
};
|
|
183
|
-
},
|
|
184
|
-
});
|
|
185
|
-
|
|
186
|
-
const currentPage = computed<number>({
|
|
187
|
-
get: () => {
|
|
188
|
-
return Math.floor(currentOffset.value / currentLimit.value) + 1;
|
|
189
|
-
},
|
|
190
|
-
|
|
191
|
-
set: (value) => {
|
|
192
|
-
currentOffset.value = (value - 1) * currentLimit.value;
|
|
193
|
-
},
|
|
194
|
-
});
|
|
195
|
-
|
|
196
|
-
const firstPage = computed<number>(() => {
|
|
197
|
-
return 1;
|
|
198
|
-
});
|
|
199
|
-
|
|
200
|
-
const lastPage = computed<number>(() => {
|
|
201
|
-
return Math.ceil(props.length / currentLimit.value);
|
|
202
|
-
});
|
|
203
|
-
|
|
204
|
-
const buttonGroup = computed<(number | string)[]>(() => {
|
|
205
|
-
return Array.from({ length: lastPage.value }, (_, index) => index + 1)
|
|
206
|
-
.map((page) => {
|
|
207
|
-
switch (true) {
|
|
208
|
-
case page > firstPage.value && page < currentPage.value - 1:
|
|
209
|
-
case page > currentPage.value + 1 && page < lastPage.value:
|
|
210
|
-
return '…';
|
|
211
|
-
|
|
212
|
-
default:
|
|
213
|
-
return page;
|
|
214
|
-
}
|
|
215
|
-
})
|
|
216
|
-
.reduce((accumulator, page) => {
|
|
217
|
-
if (accumulator[accumulator.length - 1] === page) {
|
|
218
|
-
return accumulator;
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
return [...accumulator, page];
|
|
222
|
-
}, [] as (number | string)[]);
|
|
223
|
-
});
|
|
224
|
-
|
|
225
|
-
// Functions
|
|
226
|
-
function toPreviousPage(): void {
|
|
227
|
-
currentPage.value = currentPage.value - 1;
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
function toNextPage(): void {
|
|
231
|
-
currentPage.value = currentPage.value + 1;
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
function toPage(page: number): void {
|
|
235
|
-
currentPage.value = page;
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
return {
|
|
239
|
-
root,
|
|
240
|
-
limitButton,
|
|
241
|
-
limitButtonRoot,
|
|
242
|
-
limitMenu,
|
|
243
|
-
limitMenuRoot,
|
|
244
|
-
rootStyles,
|
|
245
|
-
offsetControlStyles,
|
|
246
|
-
limitControlStyles,
|
|
247
|
-
proxyModelValue,
|
|
248
|
-
currentLimit,
|
|
249
|
-
currentOffset,
|
|
250
|
-
currentPage,
|
|
251
|
-
firstPage,
|
|
252
|
-
lastPage,
|
|
253
|
-
buttonGroup,
|
|
254
|
-
toPreviousPage,
|
|
255
|
-
toNextPage,
|
|
256
|
-
toPage,
|
|
257
|
-
};
|
|
258
|
-
},
|
|
259
|
-
});
|
|
260
|
-
</script>
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
export const PaginationRoot: string[] = [
|
|
2
|
-
// Layout
|
|
3
|
-
'layout-row',
|
|
4
|
-
|
|
5
|
-
// Spacing
|
|
6
|
-
'gap-xl',
|
|
7
|
-
|
|
8
|
-
// Typography
|
|
9
|
-
'typography-caption-regular',
|
|
10
|
-
|
|
11
|
-
// Theme
|
|
12
|
-
'theme-foreground-outline',
|
|
13
|
-
'dark:theme-foreground-outline-dark',
|
|
14
|
-
];
|
|
15
|
-
|
|
16
|
-
export const PaginationOffsetControl: string[] = [
|
|
17
|
-
// Layout
|
|
18
|
-
'layout-row',
|
|
19
|
-
|
|
20
|
-
// Spacing
|
|
21
|
-
'gap-md',
|
|
22
|
-
];
|
|
23
|
-
|
|
24
|
-
export const PaginationLimitControl: string[] = [
|
|
25
|
-
// Layout
|
|
26
|
-
'layout-row',
|
|
27
|
-
|
|
28
|
-
// Spacing
|
|
29
|
-
'gap-sm',
|
|
30
|
-
];
|