@onereach/ui-components 2.69.7-beta.2168.0 → 2.69.7-beta.2170.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-4b99c680.js → OrButton-a846fa7e.js} +10 -1
- package/dist/bundled/v2/{OrCardCollection-aa6b8553.js → OrCardCollection-15d11d05.js} +2 -2
- package/dist/bundled/v2/{OrCheckbox-4f665252.js → OrCheckbox-dbef9f9a.js} +3 -3
- package/dist/bundled/v2/{OrConfirm-dc704484.js → OrConfirm-ec3feaf5.js} +2 -2
- package/dist/bundled/v2/{OrInlineInput-6af4fe07.js → OrInlineInput-9add2e1e.js} +2 -2
- package/dist/bundled/v2/{OrInlineTextarea-ddf84267.js → OrInlineTextarea-9c6f9044.js} +2 -2
- package/dist/bundled/v2/{OrInput-e7b864c1.js → OrInput-8b90e08f.js} +13 -20
- package/dist/bundled/v2/{OrInputBox-de8ce3ac.js → OrInputBox-79ec54ad.js} +12 -2
- package/dist/bundled/v2/OrPagination-379c10b8.js +308 -0
- package/dist/bundled/v2/{OrRadio-a60fc5c0.js → OrRadio-cd39b20b.js} +3 -3
- package/dist/bundled/v2/{OrSearch-ad84b460.js → OrSearch-76b002cf.js} +2 -2
- package/dist/bundled/v2/{OrSelect-b393f564.js → OrSelect-8a4d227e.js} +14 -15
- package/dist/bundled/v2/{OrSwitch-fe9b7de7.js → OrSwitch-237a2081.js} +3 -3
- package/dist/bundled/v2/{OrTextarea-59fba95c.js → OrTextarea-5593fbe9.js} +11 -14
- package/dist/bundled/v2/components/index.d.ts +1 -0
- package/dist/bundled/v2/components/index.js +14 -14
- package/dist/bundled/v2/components/or-button-v3/OrButton.vue.d.ts +11 -0
- package/dist/bundled/v2/components/or-button-v3/index.js +1 -1
- package/dist/bundled/v2/components/or-card-collection-v3/index.js +5 -6
- package/dist/bundled/v2/components/or-checkbox-v3/index.js +1 -1
- package/dist/bundled/v2/components/or-confirm-v3/index.js +4 -5
- package/dist/bundled/v2/components/or-inline-input-v3/index.js +1 -1
- package/dist/bundled/v2/components/or-inline-textarea-v3/index.js +1 -1
- package/dist/bundled/v2/components/or-input-box-v3/index.js +1 -2
- package/dist/bundled/v2/components/or-input-v3/index.js +2 -3
- package/dist/bundled/v2/components/or-pagination-v3/OrPagination.stories3.d.ts +12 -0
- package/dist/bundled/v2/components/or-pagination-v3/OrPagination.vue.d.ts +112 -0
- package/dist/bundled/v2/components/or-pagination-v3/index.d.ts +2 -0
- package/dist/bundled/v2/components/or-pagination-v3/index.js +20 -0
- package/dist/bundled/v2/components/or-pagination-v3/styles.d.ts +4 -0
- package/dist/bundled/v2/components/or-pagination-v3/types.d.ts +4 -0
- package/dist/bundled/v2/components/or-radio-v3/index.js +1 -1
- package/dist/bundled/v2/components/or-search-v3/index.js +3 -4
- package/dist/bundled/v2/components/or-select-v3/OrSelect.vue.d.ts +14 -14
- package/dist/bundled/v2/components/or-select-v3/index.d.ts +1 -0
- package/dist/bundled/v2/components/or-select-v3/index.js +4 -5
- package/dist/bundled/v2/components/or-select-v3/types.d.ts +1 -1
- package/dist/bundled/v2/components/or-switch-v3/index.js +1 -1
- package/dist/bundled/v2/components/or-textarea-v3/index.js +2 -3
- package/dist/bundled/v2/index.js +15 -15
- package/dist/bundled/v3/{OrButton-a671b8a1.js → OrButton-2b27c1fd.js} +3 -2
- package/dist/bundled/v3/{OrButton.vue_vue_type_script_lang-b0dc31ca.js → OrButton.vue_vue_type_script_lang-8c44986c.js} +9 -1
- package/dist/bundled/v3/{OrCardCollection.vue_vue_type_script_lang-ece2eab6.js → OrCardCollection.vue_vue_type_script_lang-bd852915.js} +3 -3
- package/dist/bundled/v3/{OrConfirm.vue_vue_type_script_lang-fcbdf2c6.js → OrConfirm.vue_vue_type_script_lang-9e4e2884.js} +4 -4
- package/dist/bundled/v3/{OrInlineInput.vue_vue_type_script_lang-84c521f9.js → OrInlineInput.vue_vue_type_script_lang-f29483f4.js} +2 -2
- package/dist/bundled/v3/{OrInlineTextarea.vue_vue_type_script_lang-9c58faeb.js → OrInlineTextarea.vue_vue_type_script_lang-cc40af48.js} +2 -2
- package/dist/bundled/v3/{OrInput-4ccc2c7b.js → OrInput-fa782fc1.js} +14 -17
- package/dist/bundled/v3/{OrInput.vue_vue_type_script_lang-96ce8121.js → OrInput.vue_vue_type_script_lang-f6d793d3.js} +4 -5
- package/dist/bundled/v3/{OrInputBox-27aa1cec.js → OrInputBox-eb54d73d.js} +1 -1
- package/dist/{esm/v2/OrInputBox.vue_rollup-plugin-vue_script-328ae841.js → bundled/v3/OrInputBox.vue_vue_type_script_lang-5ee4ee45.js} +2 -3
- package/dist/bundled/v3/OrPagination.vue_vue_type_script_lang-c96d7cd7.js +187 -0
- package/dist/bundled/v3/{OrSearch.vue_vue_type_script_lang-71fbb2fc.js → OrSearch.vue_vue_type_script_lang-014ad470.js} +3 -3
- package/dist/bundled/v3/{OrSelect.vue_vue_type_script_lang-363605c5.js → OrSelect.vue_vue_type_script_lang-94063fc4.js} +9 -13
- package/dist/bundled/v3/{OrTextarea.vue_vue_type_script_lang-9f2a0234.js → OrTextarea.vue_vue_type_script_lang-8e3531cd.js} +4 -5
- package/dist/bundled/v3/components/index.d.ts +1 -0
- package/dist/bundled/v3/components/index.js +14 -14
- package/dist/bundled/v3/components/or-button-v3/OrButton.vue.d.ts +11 -0
- package/dist/bundled/v3/components/or-button-v3/index.js +1 -1
- package/dist/bundled/v3/components/or-card-collection-v3/index.js +8 -9
- package/dist/bundled/v3/components/or-confirm-v3/index.js +7 -8
- package/dist/bundled/v3/components/or-inline-input-v3/index.js +1 -1
- package/dist/bundled/v3/components/or-inline-textarea-v3/index.js +1 -1
- package/dist/bundled/v3/components/or-input-box-v3/index.js +1 -2
- package/dist/bundled/v3/components/or-input-v3/index.js +3 -4
- package/dist/bundled/v3/components/or-pagination-v3/OrPagination.stories3.d.ts +12 -0
- package/dist/bundled/v3/components/or-pagination-v3/OrPagination.vue.d.ts +112 -0
- package/dist/bundled/v3/components/or-pagination-v3/index.d.ts +2 -0
- package/dist/bundled/v3/components/or-pagination-v3/index.js +22 -0
- package/dist/bundled/v3/components/or-pagination-v3/styles.d.ts +4 -0
- package/dist/bundled/v3/components/or-pagination-v3/types.d.ts +4 -0
- package/dist/bundled/v3/components/or-search-v3/index.js +5 -6
- package/dist/bundled/v3/components/or-select-v3/OrSelect.vue.d.ts +14 -14
- package/dist/bundled/v3/components/or-select-v3/index.d.ts +1 -0
- package/dist/bundled/v3/components/or-select-v3/index.js +5 -6
- package/dist/bundled/v3/components/or-select-v3/types.d.ts +1 -1
- package/dist/bundled/v3/components/or-textarea-v3/index.js +3 -4
- package/dist/bundled/v3/index.js +277 -191
- package/dist/esm/v2/{OrButton-357e1e2c.js → OrButton-835d4f11.js} +10 -1
- package/dist/esm/v2/{OrCardCollection-fe34fef3.js → OrCardCollection-024cfba9.js} +3 -3
- package/dist/esm/v2/{OrCheckbox-ea48d156.js → OrCheckbox-567e387c.js} +3 -3
- package/dist/esm/v2/{OrConfirm-3bead0be.js → OrConfirm-5e8dd4b6.js} +2 -2
- package/dist/esm/v2/{OrInlineInput-e32f322f.js → OrInlineInput-cfeeea33.js} +2 -2
- package/dist/esm/v2/{OrInlineTextarea-7296fbdb.js → OrInlineTextarea-897b5377.js} +2 -2
- package/dist/esm/v2/{OrInput-db0e2368.js → OrInput-2f16a7ac.js} +13 -20
- package/dist/{bundled/v3/OrInputBox.vue_vue_type_script_lang-28353c10.js → esm/v2/OrInputBox-4d5a318d.js} +55 -4
- package/dist/esm/v2/OrPagination-c0dbec6a.js +308 -0
- package/dist/esm/v2/{OrRadio-6e10f071.js → OrRadio-848ce55d.js} +3 -3
- package/dist/esm/v2/{OrSearch-9d9459f5.js → OrSearch-2f260b09.js} +2 -2
- package/dist/esm/v2/{OrSelect-e6aa1b2a.js → OrSelect-641184f0.js} +14 -15
- package/dist/esm/v2/{OrSwitch-c628d2c5.js → OrSwitch-13b6a7ee.js} +3 -3
- package/dist/esm/v2/{OrTextarea-52354386.js → OrTextarea-6712a150.js} +11 -14
- package/dist/esm/v2/components/index.d.ts +1 -0
- package/dist/esm/v2/components/index.js +14 -14
- package/dist/esm/v2/components/or-button-v3/OrButton.vue.d.ts +11 -0
- package/dist/esm/v2/components/or-button-v3/index.js +1 -1
- package/dist/esm/v2/components/or-card-collection-v3/index.js +5 -6
- package/dist/esm/v2/components/or-checkbox-v3/index.js +1 -1
- package/dist/esm/v2/components/or-confirm-v3/index.js +4 -5
- package/dist/esm/v2/components/or-inline-input-v3/index.js +1 -1
- package/dist/esm/v2/components/or-inline-textarea-v3/index.js +1 -1
- package/dist/esm/v2/components/or-input-box-v3/index.js +2 -3
- package/dist/esm/v2/components/or-input-v3/index.js +2 -3
- package/dist/esm/v2/components/or-pagination-v3/OrPagination.stories3.d.ts +12 -0
- package/dist/esm/v2/components/or-pagination-v3/OrPagination.vue.d.ts +112 -0
- package/dist/esm/v2/components/or-pagination-v3/index.d.ts +2 -0
- package/dist/esm/v2/components/or-pagination-v3/index.js +18 -0
- package/dist/esm/v2/components/or-pagination-v3/styles.d.ts +4 -0
- package/dist/esm/v2/components/or-pagination-v3/types.d.ts +4 -0
- package/dist/esm/v2/components/or-radio-v3/index.js +1 -1
- package/dist/esm/v2/components/or-search-v3/index.js +3 -4
- package/dist/esm/v2/components/or-select-v3/OrSelect.vue.d.ts +14 -14
- package/dist/esm/v2/components/or-select-v3/index.d.ts +1 -0
- package/dist/esm/v2/components/or-select-v3/index.js +4 -5
- package/dist/esm/v2/components/or-select-v3/types.d.ts +1 -1
- package/dist/esm/v2/components/or-switch-v3/index.js +1 -1
- package/dist/esm/v2/components/or-textarea-v3/index.js +2 -3
- package/dist/esm/v2/index.js +14 -14
- package/dist/esm/v3/{OrButton-bb6bf8a9.js → OrButton-0fa67a0d.js} +11 -2
- package/dist/esm/v3/{OrCardCollection-8a84f69c.js → OrCardCollection-286d0f3f.js} +2 -2
- package/dist/esm/v3/{OrCheckbox-d1b516c8.js → OrCheckbox-3e139eac.js} +2 -3
- package/dist/esm/v3/{OrConfirm-5bd1f4db.js → OrConfirm-56ae1494.js} +2 -2
- package/dist/esm/v3/{OrInlineInput-00f0d1b8.js → OrInlineInput-31026cd0.js} +2 -2
- package/dist/esm/v3/{OrInlineTextarea-c1babfda.js → OrInlineTextarea-b28c3d8c.js} +2 -2
- package/dist/esm/v3/{OrInput-2b447f81.js → OrInput-41691fb3.js} +15 -18
- package/dist/esm/v3/OrPagination-a703307d.js +269 -0
- package/dist/esm/v3/{OrRadio-ef9d4c6e.js → OrRadio-54b6d0de.js} +2 -3
- package/dist/esm/v3/{OrSearch-d72cfc74.js → OrSearch-e5a2e93e.js} +1 -1
- package/dist/esm/v3/{OrSelect-e6e006d5.js → OrSelect-08bd0f60.js} +16 -13
- package/dist/esm/v3/{OrSwitch-cc797a48.js → OrSwitch-cca30aa0.js} +3 -3
- package/dist/esm/v3/{OrTextarea-ed35cd0b.js → OrTextarea-bb9ef3f2.js} +14 -16
- package/dist/esm/v3/components/index.d.ts +1 -0
- package/dist/esm/v3/components/index.js +13 -12
- package/dist/esm/v3/components/or-button-v3/OrButton.vue.d.ts +11 -0
- package/dist/esm/v3/components/or-button-v3/index.js +1 -1
- package/dist/esm/v3/components/or-card-collection-v3/index.js +4 -4
- package/dist/esm/v3/components/or-checkbox-v3/index.js +1 -1
- package/dist/esm/v3/components/or-confirm-v3/index.js +3 -3
- package/dist/esm/v3/components/or-inline-input-v3/index.js +1 -1
- package/dist/esm/v3/components/or-inline-textarea-v3/index.js +1 -1
- package/dist/esm/v3/components/or-input-v3/index.js +1 -1
- package/dist/esm/v3/components/or-pagination-v3/OrPagination.stories3.d.ts +12 -0
- package/dist/esm/v3/components/or-pagination-v3/OrPagination.vue.d.ts +112 -0
- package/dist/esm/v3/components/or-pagination-v3/index.d.ts +2 -0
- package/dist/esm/v3/components/or-pagination-v3/index.js +17 -0
- package/dist/esm/v3/components/or-pagination-v3/styles.d.ts +4 -0
- package/dist/esm/v3/components/or-pagination-v3/types.d.ts +4 -0
- package/dist/esm/v3/components/or-radio-v3/index.js +1 -1
- package/dist/esm/v3/components/or-search-v3/index.js +2 -2
- package/dist/esm/v3/components/or-select-v3/OrSelect.vue.d.ts +14 -14
- package/dist/esm/v3/components/or-select-v3/index.d.ts +1 -0
- 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-switch-v3/index.js +1 -1
- package/dist/esm/v3/components/or-textarea-v3/index.js +1 -1
- package/dist/esm/v3/index.js +13 -12
- package/package.json +2 -2
- package/src/components/index.ts +1 -0
- package/src/components/or-button-v3/OrButton.stories3.ts +4 -0
- package/src/components/or-button-v3/OrButton.vue +6 -0
- package/src/components/or-button-v3/styles.ts +9 -1
- package/src/components/or-checkbox-v3/OrCheckbox.vue +1 -1
- package/src/components/or-inline-input-v3/styles.ts +2 -2
- package/src/components/or-inline-textarea-v3/styles.ts +2 -2
- package/src/components/or-input-v3/OrInput.vue +22 -28
- package/src/components/or-input-v3/styles.ts +2 -2
- package/src/components/or-pagination-v3/OrPagination.docs.mdx +7 -0
- package/src/components/or-pagination-v3/OrPagination.stories3.ts +87 -0
- package/src/components/or-pagination-v3/OrPagination.vue +270 -0
- package/src/components/or-pagination-v3/index.ts +2 -0
- package/src/components/or-pagination-v3/styles.ts +38 -0
- package/src/components/or-pagination-v3/types.ts +4 -0
- package/src/components/or-radio-v3/OrRadio.vue +1 -1
- package/src/components/or-select-v3/OrSelect.stories3.ts +0 -4
- package/src/components/or-select-v3/OrSelect.vue +20 -14
- package/src/components/or-select-v3/index.ts +1 -0
- package/src/components/or-select-v3/styles.ts +1 -4
- package/src/components/or-select-v3/types.ts +1 -1
- package/src/components/or-switch-v3/OrSwitch.vue +1 -1
- package/src/components/or-textarea-v3/OrTextarea.vue +1 -5
- package/src/components/or-textarea-v3/styles.ts +2 -2
- package/dist/bundled/v2/components/or-combined-input-v3/OrCombinedInput.stories3.d.ts +0 -27
- package/dist/bundled/v2/components/or-combined-input-v3/OrCombinedInput.vue.d.ts +0 -98
- package/dist/bundled/v2/components/or-combined-input-v3/index.d.ts +0 -2
- package/dist/bundled/v2/components/or-combined-input-v3/index.js +0 -149
- package/dist/bundled/v2/components/or-combined-input-v3/props.d.ts +0 -1
- package/dist/bundled/v2/components/or-combined-input-v3/styles.d.ts +0 -2
- package/dist/bundled/v2/props-78496a2d.js +0 -12
- package/dist/bundled/v3/components/or-combined-input-v3/OrCombinedInput.stories3.d.ts +0 -27
- package/dist/bundled/v3/components/or-combined-input-v3/OrCombinedInput.vue.d.ts +0 -98
- package/dist/bundled/v3/components/or-combined-input-v3/index.d.ts +0 -2
- package/dist/bundled/v3/components/or-combined-input-v3/index.js +0 -132
- package/dist/bundled/v3/components/or-combined-input-v3/props.d.ts +0 -1
- package/dist/bundled/v3/components/or-combined-input-v3/styles.d.ts +0 -2
- package/dist/bundled/v3/props-78496a2d.js +0 -12
- package/dist/esm/v2/OrInputBox-9d1193b5.js +0 -43
- package/dist/esm/v2/components/or-combined-input-v3/OrCombinedInput.stories3.d.ts +0 -27
- package/dist/esm/v2/components/or-combined-input-v3/OrCombinedInput.vue.d.ts +0 -98
- package/dist/esm/v2/components/or-combined-input-v3/index.d.ts +0 -2
- package/dist/esm/v2/components/or-combined-input-v3/index.js +0 -147
- package/dist/esm/v2/components/or-combined-input-v3/props.d.ts +0 -1
- package/dist/esm/v2/components/or-combined-input-v3/styles.d.ts +0 -2
- package/dist/esm/v3/components/or-combined-input-v3/OrCombinedInput.stories3.d.ts +0 -27
- package/dist/esm/v3/components/or-combined-input-v3/OrCombinedInput.vue.d.ts +0 -98
- package/dist/esm/v3/components/or-combined-input-v3/index.d.ts +0 -2
- package/dist/esm/v3/components/or-combined-input-v3/index.js +0 -132
- package/dist/esm/v3/components/or-combined-input-v3/props.d.ts +0 -1
- package/dist/esm/v3/components/or-combined-input-v3/styles.d.ts +0 -2
- package/src/components/or-combined-input-v3/OrCombinedInput.docs.mdx +0 -7
- package/src/components/or-combined-input-v3/OrCombinedInput.stories3.ts +0 -202
- package/src/components/or-combined-input-v3/OrCombinedInput.vue +0 -134
- package/src/components/or-combined-input-v3/index.ts +0 -2
- package/src/components/or-combined-input-v3/props.ts +0 -1
- package/src/components/or-combined-input-v3/styles.ts +0 -25
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { action } from '@storybook/addon-actions';
|
|
2
|
+
import { Meta, StoryFn } from '@storybook/vue3';
|
|
3
|
+
import { ref, watch } from 'vue-demi';
|
|
4
|
+
import OrPaginationDocs from './OrPagination.docs.mdx';
|
|
5
|
+
import OrPagination from './OrPagination.vue';
|
|
6
|
+
import { PaginationModel } from './types';
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
title: 'Components/Pagination',
|
|
10
|
+
component: OrPagination,
|
|
11
|
+
|
|
12
|
+
argTypes: {
|
|
13
|
+
// Props
|
|
14
|
+
modelValue: {
|
|
15
|
+
control: { type: 'text' },
|
|
16
|
+
},
|
|
17
|
+
|
|
18
|
+
value: { // TODO: Remove Vue 2 fallback
|
|
19
|
+
table: { disable: true },
|
|
20
|
+
},
|
|
21
|
+
|
|
22
|
+
length: {
|
|
23
|
+
control: { type: 'number' },
|
|
24
|
+
},
|
|
25
|
+
|
|
26
|
+
// Events
|
|
27
|
+
'update:modelValue': {
|
|
28
|
+
table: { disable: true },
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
input: {
|
|
32
|
+
table: { disable: true },
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
parameters: {
|
|
37
|
+
layout: 'centered',
|
|
38
|
+
|
|
39
|
+
docs: {
|
|
40
|
+
page: OrPaginationDocs,
|
|
41
|
+
},
|
|
42
|
+
|
|
43
|
+
design: {
|
|
44
|
+
type: 'figma',
|
|
45
|
+
url: 'https://www.figma.com/file/o7DdkaznUW2PtX4wiSuhhQ/Core?node-id=4063%3A35218&t=axoGLEPrByClXTTU-4',
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
} as Meta<typeof OrPagination>;
|
|
49
|
+
|
|
50
|
+
const Template: StoryFn<typeof OrPagination> = (args) => ({
|
|
51
|
+
components: {
|
|
52
|
+
OrPagination,
|
|
53
|
+
},
|
|
54
|
+
|
|
55
|
+
setup() {
|
|
56
|
+
// State
|
|
57
|
+
const model = ref<PaginationModel>();
|
|
58
|
+
|
|
59
|
+
// Effects
|
|
60
|
+
watch(model, (value) => {
|
|
61
|
+
console.debug(value);
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
return {
|
|
65
|
+
args,
|
|
66
|
+
model,
|
|
67
|
+
onUpdateModelValue: action('update:modelValue'),
|
|
68
|
+
onInput: action('input'),
|
|
69
|
+
};
|
|
70
|
+
},
|
|
71
|
+
|
|
72
|
+
template: `
|
|
73
|
+
<OrPagination
|
|
74
|
+
v-model="model"
|
|
75
|
+
v-bind="args"
|
|
76
|
+
@update:modelValue="onUpdateModelValue"
|
|
77
|
+
@input="onInput"
|
|
78
|
+
/>
|
|
79
|
+
`,
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
export const Default = Template.bind({});
|
|
83
|
+
|
|
84
|
+
Default.args = {
|
|
85
|
+
// Props
|
|
86
|
+
length: 555,
|
|
87
|
+
};
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
ref="root"
|
|
4
|
+
v-bind="$attrs"
|
|
5
|
+
:class="rootStyles"
|
|
6
|
+
>
|
|
7
|
+
<div :class="offsetControlStyles">
|
|
8
|
+
<OrButton
|
|
9
|
+
:class="itemStyles"
|
|
10
|
+
:variant="'link'"
|
|
11
|
+
:color="'inherit'"
|
|
12
|
+
:disabled="currentPage === firstPage"
|
|
13
|
+
@click.stop="toPreviousPage()"
|
|
14
|
+
>
|
|
15
|
+
<OrIcon :icon="'keyboard_arrow_left'" />
|
|
16
|
+
</OrButton>
|
|
17
|
+
|
|
18
|
+
<OrButton
|
|
19
|
+
v-for="(page, index) in buttonGroup"
|
|
20
|
+
:key="index"
|
|
21
|
+
:class="itemStyles"
|
|
22
|
+
:variant="'link'"
|
|
23
|
+
:color="'inherit'"
|
|
24
|
+
:activated="currentPage === page"
|
|
25
|
+
@click.stop="typeof page === 'number' && toPage(page)"
|
|
26
|
+
>
|
|
27
|
+
{{ page }}
|
|
28
|
+
</OrButton>
|
|
29
|
+
|
|
30
|
+
<OrButton
|
|
31
|
+
:class="itemStyles"
|
|
32
|
+
:variant="'link'"
|
|
33
|
+
:color="'inherit'"
|
|
34
|
+
:disabled="currentPage === lastPage"
|
|
35
|
+
@click.stop="toNextPage()"
|
|
36
|
+
>
|
|
37
|
+
<OrIcon :icon="'keyboard_arrow_right'" />
|
|
38
|
+
</OrButton>
|
|
39
|
+
</div>
|
|
40
|
+
|
|
41
|
+
<div :class="limitControlStyles">
|
|
42
|
+
Per page:
|
|
43
|
+
|
|
44
|
+
<OrButton
|
|
45
|
+
ref="limitButton"
|
|
46
|
+
:class="itemStyles"
|
|
47
|
+
:variant="'link'"
|
|
48
|
+
:color="'inherit'"
|
|
49
|
+
:activated="true"
|
|
50
|
+
@click.stop="limitMenu.open()"
|
|
51
|
+
>
|
|
52
|
+
{{ currentLimit }} <OrIcon :icon="'arrow_drop_down'" />
|
|
53
|
+
</OrButton>
|
|
54
|
+
|
|
55
|
+
<OrMenu
|
|
56
|
+
ref="limitMenu"
|
|
57
|
+
:trigger="limitButtonRoot"
|
|
58
|
+
:placement="'top'"
|
|
59
|
+
>
|
|
60
|
+
<OrMenuItem
|
|
61
|
+
v-for="pageSize in pageSizeOptions"
|
|
62
|
+
:key="pageSize"
|
|
63
|
+
@click.stop="currentLimit = pageSize"
|
|
64
|
+
>
|
|
65
|
+
{{ pageSize }}
|
|
66
|
+
</OrMenuItem>
|
|
67
|
+
</OrMenu>
|
|
68
|
+
</div>
|
|
69
|
+
</div>
|
|
70
|
+
</template>
|
|
71
|
+
|
|
72
|
+
<script lang="ts">
|
|
73
|
+
import { computed, defineComponent, PropType, ref } from 'vue-demi';
|
|
74
|
+
import { useClassAttribute } from '../../hooks';
|
|
75
|
+
import { OrButtonV3 as OrButton } from '../or-button-v3';
|
|
76
|
+
import { OrIconV3 as OrIcon } from '../or-icon-v3';
|
|
77
|
+
import { OrMenuItemV3 as OrMenuItem } from '../or-menu-item-v3';
|
|
78
|
+
import { OrMenuV3 as OrMenu } from '../or-menu-v3';
|
|
79
|
+
import { PaginationItem, PaginationLimitControl, PaginationOffsetControl, PaginationRoot } from './styles';
|
|
80
|
+
import { PaginationModel } from './types';
|
|
81
|
+
|
|
82
|
+
export default defineComponent({
|
|
83
|
+
name: 'OrPagination',
|
|
84
|
+
|
|
85
|
+
components: {
|
|
86
|
+
OrButton,
|
|
87
|
+
OrIcon,
|
|
88
|
+
OrMenu,
|
|
89
|
+
OrMenuItem,
|
|
90
|
+
},
|
|
91
|
+
|
|
92
|
+
inheritAttrs: false,
|
|
93
|
+
|
|
94
|
+
props: {
|
|
95
|
+
modelValue: {
|
|
96
|
+
type: Object as PropType<PaginationModel>,
|
|
97
|
+
default: undefined,
|
|
98
|
+
},
|
|
99
|
+
|
|
100
|
+
value: { // TODO: Remove Vue 2 fallback
|
|
101
|
+
type: Object as PropType<PaginationModel>,
|
|
102
|
+
default: undefined,
|
|
103
|
+
},
|
|
104
|
+
|
|
105
|
+
length: {
|
|
106
|
+
type: Number,
|
|
107
|
+
required: true,
|
|
108
|
+
},
|
|
109
|
+
|
|
110
|
+
pageSizeOptions: {
|
|
111
|
+
type: Array as PropType<number[]>,
|
|
112
|
+
default: () => [50, 20, 10, 5],
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
|
|
116
|
+
emits: [
|
|
117
|
+
'update:modelValue',
|
|
118
|
+
|
|
119
|
+
'input',
|
|
120
|
+
],
|
|
121
|
+
|
|
122
|
+
expose: [
|
|
123
|
+
'root',
|
|
124
|
+
],
|
|
125
|
+
|
|
126
|
+
setup(props, context) {
|
|
127
|
+
// Refs
|
|
128
|
+
const root = ref<HTMLElement>();
|
|
129
|
+
|
|
130
|
+
const limitButton = ref<InstanceType<typeof OrButton>>();
|
|
131
|
+
const limitButtonRoot = computed(() => limitButton.value?.root);
|
|
132
|
+
|
|
133
|
+
const limitMenu = ref<InstanceType<typeof OrMenu>>();
|
|
134
|
+
const limitMenuRoot = computed(() => limitMenu.value?.root);
|
|
135
|
+
|
|
136
|
+
// Styles
|
|
137
|
+
const classAttribute = useClassAttribute();
|
|
138
|
+
|
|
139
|
+
const rootStyles = computed(() => [
|
|
140
|
+
'or-pagination',
|
|
141
|
+
...PaginationRoot,
|
|
142
|
+
classAttribute.value,
|
|
143
|
+
]);
|
|
144
|
+
|
|
145
|
+
const offsetControlStyles = computed(() => [
|
|
146
|
+
...PaginationOffsetControl,
|
|
147
|
+
]);
|
|
148
|
+
|
|
149
|
+
const limitControlStyles = computed(() => [
|
|
150
|
+
...PaginationLimitControl,
|
|
151
|
+
]);
|
|
152
|
+
|
|
153
|
+
const itemStyles = computed(() => [
|
|
154
|
+
...PaginationItem,
|
|
155
|
+
]);
|
|
156
|
+
|
|
157
|
+
// State
|
|
158
|
+
const proxyModelValue = computed({
|
|
159
|
+
get: () => {
|
|
160
|
+
return props.modelValue ?? props.value; // TODO: Remove Vue 2 fallback
|
|
161
|
+
},
|
|
162
|
+
|
|
163
|
+
set: (value) => {
|
|
164
|
+
context.emit('input', value);
|
|
165
|
+
context.emit('update:modelValue', value);
|
|
166
|
+
},
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
const currentLimit = computed<number>({
|
|
170
|
+
get: () => {
|
|
171
|
+
return proxyModelValue.value?.limit ?? props.pageSizeOptions[0];
|
|
172
|
+
},
|
|
173
|
+
|
|
174
|
+
set: (value) => {
|
|
175
|
+
proxyModelValue.value = {
|
|
176
|
+
limit: value,
|
|
177
|
+
offset: 0,
|
|
178
|
+
};
|
|
179
|
+
},
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
const currentOffset = computed<number>({
|
|
183
|
+
get: () => {
|
|
184
|
+
return proxyModelValue.value?.offset ?? 0;
|
|
185
|
+
},
|
|
186
|
+
|
|
187
|
+
set: (value) => {
|
|
188
|
+
proxyModelValue.value = {
|
|
189
|
+
limit: currentLimit.value,
|
|
190
|
+
offset: value,
|
|
191
|
+
};
|
|
192
|
+
},
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
const currentPage = computed<number>({
|
|
196
|
+
get: () => {
|
|
197
|
+
return Math.floor(currentOffset.value / currentLimit.value) + 1;
|
|
198
|
+
},
|
|
199
|
+
|
|
200
|
+
set: (value) => {
|
|
201
|
+
currentOffset.value = (value - 1) * currentLimit.value;
|
|
202
|
+
},
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
const firstPage = computed<number>(() => {
|
|
206
|
+
return 1;
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
const lastPage = computed<number>(() => {
|
|
210
|
+
return Math.ceil(props.length / currentLimit.value);
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
const buttonGroup = computed<(number | string)[]>(() => {
|
|
214
|
+
return Array.from({ length: lastPage.value }, (_, index) => index + 1)
|
|
215
|
+
.map((page) => {
|
|
216
|
+
switch (true) {
|
|
217
|
+
case page > firstPage.value && page < currentPage.value - 1:
|
|
218
|
+
case page > currentPage.value + 1 && page < lastPage.value:
|
|
219
|
+
return '…';
|
|
220
|
+
|
|
221
|
+
default:
|
|
222
|
+
return page;
|
|
223
|
+
}
|
|
224
|
+
})
|
|
225
|
+
.reduce((accumulator, page) => {
|
|
226
|
+
if (accumulator[accumulator.length - 1] === page) {
|
|
227
|
+
return accumulator;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
return [...accumulator, page];
|
|
231
|
+
}, [] as (number | string)[]);
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
// Functions
|
|
235
|
+
function toPreviousPage(): void {
|
|
236
|
+
currentPage.value = currentPage.value - 1;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
function toNextPage(): void {
|
|
240
|
+
currentPage.value = currentPage.value + 1;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
function toPage(page: number): void {
|
|
244
|
+
currentPage.value = page;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
return {
|
|
248
|
+
root,
|
|
249
|
+
limitButton,
|
|
250
|
+
limitButtonRoot,
|
|
251
|
+
limitMenu,
|
|
252
|
+
limitMenuRoot,
|
|
253
|
+
rootStyles,
|
|
254
|
+
offsetControlStyles,
|
|
255
|
+
limitControlStyles,
|
|
256
|
+
itemStyles,
|
|
257
|
+
proxyModelValue,
|
|
258
|
+
currentLimit,
|
|
259
|
+
currentOffset,
|
|
260
|
+
currentPage,
|
|
261
|
+
firstPage,
|
|
262
|
+
lastPage,
|
|
263
|
+
buttonGroup,
|
|
264
|
+
toPreviousPage,
|
|
265
|
+
toNextPage,
|
|
266
|
+
toPage,
|
|
267
|
+
};
|
|
268
|
+
},
|
|
269
|
+
});
|
|
270
|
+
</script>
|
|
@@ -0,0 +1,38 @@
|
|
|
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
|
+
];
|
|
31
|
+
|
|
32
|
+
export const PaginationItem: string[] = [
|
|
33
|
+
// Typography
|
|
34
|
+
'typography-caption-regular',
|
|
35
|
+
|
|
36
|
+
// Typography (activated)
|
|
37
|
+
'activated:typography-caption-bold',
|
|
38
|
+
];
|
|
@@ -39,12 +39,12 @@
|
|
|
39
39
|
@focus="$emit('focus', $event)"
|
|
40
40
|
@blur="$emit('blur', $event)"
|
|
41
41
|
>
|
|
42
|
-
<template v-if="
|
|
43
|
-
<
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
>
|
|
42
|
+
<template v-if="multiple">
|
|
43
|
+
<slot
|
|
44
|
+
name="valueTemplate"
|
|
45
|
+
:model="proxyModelValue"
|
|
46
|
+
>
|
|
47
|
+
<template v-if="proxyModelValue && proxyModelValue.length > 0">
|
|
48
48
|
<OrTag
|
|
49
49
|
v-for="option in selection"
|
|
50
50
|
:key="option.value"
|
|
@@ -53,10 +53,16 @@
|
|
|
53
53
|
>
|
|
54
54
|
{{ option.label }}
|
|
55
55
|
</OrTag>
|
|
56
|
-
</
|
|
57
|
-
</template>
|
|
56
|
+
</template>
|
|
58
57
|
|
|
59
|
-
|
|
58
|
+
<template v-else>
|
|
59
|
+
<span :class="placeholderStyles">{{ placeholder }}</span>
|
|
60
|
+
</template>
|
|
61
|
+
</slot>
|
|
62
|
+
</template>
|
|
63
|
+
|
|
64
|
+
<template v-else>
|
|
65
|
+
<template v-if="proxyModelValue">
|
|
60
66
|
<slot
|
|
61
67
|
name="valueTemplate"
|
|
62
68
|
:model="proxyModelValue"
|
|
@@ -64,10 +70,10 @@
|
|
|
64
70
|
{{ selection.label }}
|
|
65
71
|
</slot>
|
|
66
72
|
</template>
|
|
67
|
-
</template>
|
|
68
73
|
|
|
69
|
-
|
|
70
|
-
|
|
74
|
+
<template v-else>
|
|
75
|
+
<span :class="placeholderStyles">{{ placeholder }}</span>
|
|
76
|
+
</template>
|
|
71
77
|
</template>
|
|
72
78
|
</div>
|
|
73
79
|
|
|
@@ -266,12 +272,12 @@ export default defineComponent({
|
|
|
266
272
|
},
|
|
267
273
|
|
|
268
274
|
modelValue: {
|
|
269
|
-
type: [String, Array] as PropType<string | string[]>,
|
|
275
|
+
type: [String, Number, Array] as PropType<string | number | (string | number)[]>,
|
|
270
276
|
default: undefined,
|
|
271
277
|
},
|
|
272
278
|
|
|
273
279
|
value: { // TODO: Remove Vue 2 fallback
|
|
274
|
-
type: [String, Array] as PropType<string | string[]>,
|
|
280
|
+
type: [String, Number, Array] as PropType<string | number | (string | number)[]>,
|
|
275
281
|
default: undefined,
|
|
276
282
|
},
|
|
277
283
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div
|
|
3
3
|
ref="root"
|
|
4
|
-
v-bind="$attrs"
|
|
5
4
|
:class="rootStyles"
|
|
6
5
|
>
|
|
7
6
|
<template v-if="label">
|
|
@@ -28,14 +27,11 @@
|
|
|
28
27
|
<textarea
|
|
29
28
|
:id="controlId"
|
|
30
29
|
v-model="proxyModelValue"
|
|
30
|
+
v-bind="$attrs"
|
|
31
31
|
:class="controlStyles"
|
|
32
32
|
:placeholder="placeholder"
|
|
33
33
|
:required="required"
|
|
34
34
|
:disabled="disabled"
|
|
35
|
-
|
|
36
|
-
:readonly="readonly"
|
|
37
|
-
:maxlength="maxLength"
|
|
38
|
-
|
|
39
35
|
@keydown="$emit('keydown', $event)"
|
|
40
36
|
@keyup="$emit('keyup', $event)"
|
|
41
37
|
@focus="$emit('focus', $event)"
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { Meta, StoryFn } from '@storybook/vue3';
|
|
2
|
-
declare const _default: Meta<import("vue").ComponentOptions<import("vue").default, import("@vue/composition-api").ShallowUnwrapRef<unknown>, import("@vue/composition-api").MethodOptions, import("@vue/composition-api").ComputedOptions, import("@vue/composition-api").ComponentPropsOptions<import("@vue/composition-api").Data>, import("@vue/composition-api").ExtractPropTypes<import("@vue/composition-api").ComponentPropsOptions<import("@vue/composition-api").Data>>> & Omit<import("vue").VueConstructor<import("vue").default>, never> & (new (...args: any[]) => import("@vue/composition-api").ComponentRenderProxy<{} & {}, import("@vue/composition-api").ShallowUnwrapRef<unknown>, unknown, import("@vue/composition-api").ComputedOptions, import("@vue/composition-api").MethodOptions, unknown, unknown, {
|
|
3
|
-
[x: string]: ((...args: any[]) => any) | null;
|
|
4
|
-
} | string[], {} & {}, {
|
|
5
|
-
[x: number]: string;
|
|
6
|
-
} | {}, true>)>;
|
|
7
|
-
export default _default;
|
|
8
|
-
export declare const Default: StoryFn<import("vue").ComponentOptions<import("vue").default, import("@vue/composition-api").ShallowUnwrapRef<unknown>, import("@vue/composition-api").MethodOptions, import("@vue/composition-api").ComputedOptions, import("@vue/composition-api").ComponentPropsOptions<import("@vue/composition-api").Data>, import("@vue/composition-api").ExtractPropTypes<import("@vue/composition-api").ComponentPropsOptions<import("@vue/composition-api").Data>>> & Omit<import("vue").VueConstructor<import("vue").default>, never> & (new (...args: any[]) => import("@vue/composition-api").ComponentRenderProxy<{} & {}, import("@vue/composition-api").ShallowUnwrapRef<unknown>, unknown, import("@vue/composition-api").ComputedOptions, import("@vue/composition-api").MethodOptions, unknown, unknown, {
|
|
9
|
-
[x: string]: ((...args: any[]) => any) | null;
|
|
10
|
-
} | string[], {} & {}, {
|
|
11
|
-
[x: number]: string;
|
|
12
|
-
} | {}, true>)>;
|
|
13
|
-
export declare const Addon: StoryFn<import("vue").ComponentOptions<import("vue").default, import("@vue/composition-api").ShallowUnwrapRef<unknown>, import("@vue/composition-api").MethodOptions, import("@vue/composition-api").ComputedOptions, import("@vue/composition-api").ComponentPropsOptions<import("@vue/composition-api").Data>, import("@vue/composition-api").ExtractPropTypes<import("@vue/composition-api").ComponentPropsOptions<import("@vue/composition-api").Data>>> & Omit<import("vue").VueConstructor<import("vue").default>, never> & (new (...args: any[]) => import("@vue/composition-api").ComponentRenderProxy<{} & {}, import("@vue/composition-api").ShallowUnwrapRef<unknown>, unknown, import("@vue/composition-api").ComputedOptions, import("@vue/composition-api").MethodOptions, unknown, unknown, {
|
|
14
|
-
[x: string]: ((...args: any[]) => any) | null;
|
|
15
|
-
} | string[], {} & {}, {
|
|
16
|
-
[x: number]: string;
|
|
17
|
-
} | {}, true>)>;
|
|
18
|
-
export declare const Hint: StoryFn<import("vue").ComponentOptions<import("vue").default, import("@vue/composition-api").ShallowUnwrapRef<unknown>, import("@vue/composition-api").MethodOptions, import("@vue/composition-api").ComputedOptions, import("@vue/composition-api").ComponentPropsOptions<import("@vue/composition-api").Data>, import("@vue/composition-api").ExtractPropTypes<import("@vue/composition-api").ComponentPropsOptions<import("@vue/composition-api").Data>>> & Omit<import("vue").VueConstructor<import("vue").default>, never> & (new (...args: any[]) => import("@vue/composition-api").ComponentRenderProxy<{} & {}, import("@vue/composition-api").ShallowUnwrapRef<unknown>, unknown, import("@vue/composition-api").ComputedOptions, import("@vue/composition-api").MethodOptions, unknown, unknown, {
|
|
19
|
-
[x: string]: ((...args: any[]) => any) | null;
|
|
20
|
-
} | string[], {} & {}, {
|
|
21
|
-
[x: number]: string;
|
|
22
|
-
} | {}, true>)>;
|
|
23
|
-
export declare const Error: StoryFn<import("vue").ComponentOptions<import("vue").default, import("@vue/composition-api").ShallowUnwrapRef<unknown>, import("@vue/composition-api").MethodOptions, import("@vue/composition-api").ComputedOptions, import("@vue/composition-api").ComponentPropsOptions<import("@vue/composition-api").Data>, import("@vue/composition-api").ExtractPropTypes<import("@vue/composition-api").ComponentPropsOptions<import("@vue/composition-api").Data>>> & Omit<import("vue").VueConstructor<import("vue").default>, never> & (new (...args: any[]) => import("@vue/composition-api").ComponentRenderProxy<{} & {}, import("@vue/composition-api").ShallowUnwrapRef<unknown>, unknown, import("@vue/composition-api").ComputedOptions, import("@vue/composition-api").MethodOptions, unknown, unknown, {
|
|
24
|
-
[x: string]: ((...args: any[]) => any) | null;
|
|
25
|
-
} | string[], {} & {}, {
|
|
26
|
-
[x: number]: string;
|
|
27
|
-
} | {}, true>)>;
|