@onereach/ui-components 2.69.0 → 2.69.1-beta.2090.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/{OrCard-58a1ba3e.js → OrCard-29116e1f.js} +2 -2
- package/dist/bundled/v2/OrCardCollection-a8d5ce32.js +328 -0
- package/dist/bundled/v2/{OrSearch-9d402f56.js → OrSearch-19f43fe5.js} +2 -2
- package/dist/bundled/v2/{OrSortHeader-396e6a7c.js → OrSortHeader-9932d28f.js} +2 -2
- package/dist/bundled/v2/components/index.js +4 -4
- package/dist/bundled/v2/components/or-card-collection-v3/OrCardCollection.stories3.d.ts +4 -0
- package/dist/bundled/v2/components/or-card-collection-v3/OrCardCollection.vue.d.ts +61 -37
- package/dist/bundled/v2/components/or-card-collection-v3/OrCardCollectionView.vue2.vue.d.ts +35 -0
- package/dist/bundled/v2/components/or-card-collection-v3/constatnts.d.ts +4 -0
- package/dist/bundled/v2/components/or-card-collection-v3/index.js +7 -4
- package/dist/bundled/v2/components/or-card-collection-v3/types.d.ts +5 -4
- package/dist/bundled/v2/components/or-card-v3/index.js +1 -1
- package/dist/bundled/v2/components/or-search-v3/index.js +1 -1
- package/dist/bundled/v2/components/or-sort-header-v3/index.js +1 -1
- package/dist/bundled/v2/index.js +5 -5
- package/dist/bundled/v3/OrButton-8ab33d9d.js +33 -0
- package/dist/bundled/v3/OrCardCollection.vue_vue_type_script_lang-f9f329a2.js +224 -0
- package/dist/bundled/v3/{OrConfirm.vue_vue_type_script_lang-289b5600.js → OrConfirm.vue_vue_type_script_lang-85472b12.js} +6 -36
- package/dist/bundled/v3/OrMenu-f26e8e55.js +29 -0
- package/dist/bundled/v3/{OrSearch.vue_vue_type_script_lang-ed78b21f.js → OrSearch.vue_vue_type_script_lang-cb2d6612.js} +1 -1
- package/dist/bundled/v3/{OrTabs.vue_vue_type_script_lang-919b2021.js → OrTabs.vue_vue_type_script_lang-61b79a5a.js} +10 -36
- package/dist/bundled/v3/components/index.js +9 -7
- package/dist/bundled/v3/components/or-card-collection-v3/OrCardCollection.stories3.d.ts +4 -0
- package/dist/bundled/v3/components/or-card-collection-v3/OrCardCollection.vue.d.ts +61 -37
- package/dist/bundled/v3/components/or-card-collection-v3/OrCardCollectionView.vue3.vue.d.ts +35 -0
- package/dist/bundled/v3/components/or-card-collection-v3/constatnts.d.ts +4 -0
- package/dist/bundled/v3/components/or-card-collection-v3/index.js +11 -4
- package/dist/bundled/v3/components/or-card-collection-v3/types.d.ts +5 -4
- package/dist/bundled/v3/components/or-confirm-v3/index.js +2 -1
- package/dist/bundled/v3/components/or-search-v3/index.js +1 -1
- package/dist/bundled/v3/components/or-tabs-v3/index.js +2 -1
- package/dist/bundled/v3/index.js +319 -299
- package/dist/esm/v2/OrCardCollection-95b051e1.js +328 -0
- package/dist/esm/v2/components/index.js +1 -1
- package/dist/esm/v2/components/or-card-collection-v3/OrCardCollection.stories3.d.ts +4 -0
- package/dist/esm/v2/components/or-card-collection-v3/OrCardCollection.vue.d.ts +61 -37
- package/dist/esm/v2/components/or-card-collection-v3/OrCardCollectionView.vue2.vue.d.ts +35 -0
- package/dist/esm/v2/components/or-card-collection-v3/constatnts.d.ts +4 -0
- package/dist/esm/v2/components/or-card-collection-v3/index.js +7 -4
- package/dist/esm/v2/components/or-card-collection-v3/types.d.ts +5 -4
- package/dist/esm/v2/index.js +1 -1
- package/dist/esm/v3/OrCardCollection-afd863fc.js +274 -0
- package/dist/esm/v3/components/index.js +1 -1
- package/dist/esm/v3/components/or-card-collection-v3/OrCardCollection.stories3.d.ts +4 -0
- package/dist/esm/v3/components/or-card-collection-v3/OrCardCollection.vue.d.ts +61 -37
- package/dist/esm/v3/components/or-card-collection-v3/OrCardCollectionView.vue3.vue.d.ts +35 -0
- package/dist/esm/v3/components/or-card-collection-v3/constatnts.d.ts +4 -0
- package/dist/esm/v3/components/or-card-collection-v3/index.js +7 -4
- package/dist/esm/v3/components/or-card-collection-v3/types.d.ts +5 -4
- package/dist/esm/v3/index.js +1 -1
- package/package.json +2 -3
- package/src/components/or-card-collection-v3/OrCardCollection.stories3.ts +160 -19
- package/src/components/or-card-collection-v3/OrCardCollection.vue +99 -74
- package/src/components/or-card-collection-v3/OrCardCollectionView.vue2.vue +41 -0
- package/src/components/or-card-collection-v3/OrCardCollectionView.vue3.vue +42 -0
- package/src/components/or-card-collection-v3/constatnts.ts +12 -0
- package/src/components/or-card-collection-v3/styles.ts +1 -1
- package/src/components/or-card-collection-v3/types.ts +5 -4
- package/dist/bundled/v2/OrCardCollection-a9a779ea.js +0 -228
- package/dist/bundled/v3/OrCardCollection.vue_vue_type_script_lang-3993a015.js +0 -164
- package/dist/esm/v2/OrCardCollection-4f001551.js +0 -227
- package/dist/esm/v3/OrCardCollection-5a0febaf.js +0 -198
|
@@ -3,8 +3,10 @@ import { Meta, StoryFn } from '@storybook/vue3';
|
|
|
3
3
|
import { OrIconV3 as OrIcon } from '../or-icon-v3';
|
|
4
4
|
import OrCardCollectionDocs from './OrCardCollection.docs.mdx';
|
|
5
5
|
import OrCardCollection from './OrCardCollection.vue';
|
|
6
|
+
import { defaultViewModes } from './constatnts';
|
|
7
|
+
import { OrCardV3 as OrCard } from '../or-card-v3';
|
|
6
8
|
import { CardCollectionView } from './props';
|
|
7
|
-
import { CardCollectionItem
|
|
9
|
+
import { CardCollectionItem } from './types';
|
|
8
10
|
|
|
9
11
|
export default {
|
|
10
12
|
title: 'Components/Card Collection',
|
|
@@ -70,12 +72,14 @@ export default {
|
|
|
70
72
|
docs: {
|
|
71
73
|
page: OrCardCollectionDocs,
|
|
72
74
|
},
|
|
75
|
+
layout: 'fullscreen',
|
|
73
76
|
},
|
|
74
77
|
} as Meta<typeof OrCardCollection>;
|
|
75
78
|
|
|
76
79
|
const Template: StoryFn<typeof OrCardCollection> = (args) => ({
|
|
77
80
|
components: {
|
|
78
81
|
OrCardCollection,
|
|
82
|
+
OrCard,
|
|
79
83
|
OrIcon,
|
|
80
84
|
},
|
|
81
85
|
|
|
@@ -89,16 +93,19 @@ const Template: StoryFn<typeof OrCardCollection> = (args) => ({
|
|
|
89
93
|
},
|
|
90
94
|
|
|
91
95
|
template: `
|
|
92
|
-
<
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
96
|
+
<div class="p-md bg-surface-1 dark:bg-surface-1-dark">
|
|
97
|
+
<OrCardCollection
|
|
98
|
+
v-bind="args"
|
|
99
|
+
@viewChange="onViewChange"
|
|
100
|
+
@sortChange="onSortChange"
|
|
101
|
+
@searchChange="onSearchChange"
|
|
102
|
+
>
|
|
103
|
+
<template #item="{item, mode}">
|
|
104
|
+
<OrCard>${args.item} ({{mode}})</OrCard>
|
|
105
|
+
</template>
|
|
106
|
+
<template #addon>${args.addon}</template>
|
|
107
|
+
</OrCardCollection>
|
|
108
|
+
</div>
|
|
102
109
|
`,
|
|
103
110
|
});
|
|
104
111
|
|
|
@@ -106,8 +113,7 @@ export const Default = Template.bind({});
|
|
|
106
113
|
|
|
107
114
|
Default.args = {
|
|
108
115
|
// Slots
|
|
109
|
-
|
|
110
|
-
listItem: '{{ item.label }} (list)',
|
|
116
|
+
item: '{{ item.label }}',
|
|
111
117
|
addon: '<OrIcon icon="info" />',
|
|
112
118
|
|
|
113
119
|
// Props
|
|
@@ -139,7 +145,7 @@ Default.args = {
|
|
|
139
145
|
'Yankee',
|
|
140
146
|
'Zulu',
|
|
141
147
|
], (item) => ({
|
|
142
|
-
|
|
148
|
+
key: item.toLowerCase(),
|
|
143
149
|
label: item,
|
|
144
150
|
})),
|
|
145
151
|
};
|
|
@@ -150,13 +156,148 @@ WithSorting.args = {
|
|
|
150
156
|
...Default.args,
|
|
151
157
|
|
|
152
158
|
// Props
|
|
153
|
-
|
|
159
|
+
sort: 'Bar',
|
|
160
|
+
sortOptions: [
|
|
154
161
|
'Foo',
|
|
155
162
|
'Bar',
|
|
156
163
|
'Baz',
|
|
157
164
|
'Qux',
|
|
158
|
-
],
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
165
|
+
],
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
export const OverrideViewContainer: StoryFn<typeof OrCardCollection> = (args) => ({
|
|
170
|
+
components: {
|
|
171
|
+
OrCardCollection,
|
|
172
|
+
OrCard,
|
|
173
|
+
},
|
|
174
|
+
|
|
175
|
+
setup() {
|
|
176
|
+
return {
|
|
177
|
+
args,
|
|
178
|
+
onViewChange: action('viewChange'),
|
|
179
|
+
onSortChange: action('sortChange'),
|
|
180
|
+
onSearchChange: action('searchChange'),
|
|
181
|
+
};
|
|
182
|
+
},
|
|
183
|
+
|
|
184
|
+
template: `
|
|
185
|
+
<div class="p-md bg-surface-1 dark:bg-surface-1-dark">
|
|
186
|
+
<OrCardCollection
|
|
187
|
+
v-bind="args"
|
|
188
|
+
@viewChange="onViewChange"
|
|
189
|
+
@sortChange="onSortChange"
|
|
190
|
+
@searchChange="onSearchChange"
|
|
191
|
+
>
|
|
192
|
+
<template #grid="{items}">
|
|
193
|
+
<div class="typography-headline-3">Custom grid</div>
|
|
194
|
+
<div class="grid grid-cols-3">
|
|
195
|
+
<OrCard
|
|
196
|
+
v-for="item in items"
|
|
197
|
+
:key="item.key"
|
|
198
|
+
>
|
|
199
|
+
{{ item.label }}
|
|
200
|
+
</OrCard>
|
|
201
|
+
</div>
|
|
202
|
+
</template>
|
|
203
|
+
<template #list="{items}">
|
|
204
|
+
<div class="typography-headline-3">Custom list</div>
|
|
205
|
+
<ul>
|
|
206
|
+
<li
|
|
207
|
+
v-for="item in items"
|
|
208
|
+
:key="item.key"
|
|
209
|
+
>
|
|
210
|
+
- {{ item.label }}
|
|
211
|
+
</li>
|
|
212
|
+
</ul>
|
|
213
|
+
</template>
|
|
214
|
+
</OrCardCollection>
|
|
215
|
+
</div>
|
|
216
|
+
`,
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
OverrideViewContainer.args = {
|
|
220
|
+
...Default.args,
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
export const ExtraViewMode: StoryFn<typeof OrCardCollection> = (args) => ({
|
|
224
|
+
components: {
|
|
225
|
+
OrCardCollection,
|
|
226
|
+
OrCard,
|
|
227
|
+
},
|
|
228
|
+
|
|
229
|
+
setup() {
|
|
230
|
+
return {
|
|
231
|
+
args,
|
|
232
|
+
defaultViewModes,
|
|
233
|
+
onViewChange: action('viewChange'),
|
|
234
|
+
onSearchChange: action('searchChange'),
|
|
235
|
+
};
|
|
236
|
+
},
|
|
237
|
+
|
|
238
|
+
template: `
|
|
239
|
+
<div class="p-md bg-surface-1 dark:bg-surface-1-dark">
|
|
240
|
+
<OrCardCollection
|
|
241
|
+
v-bind="args"
|
|
242
|
+
:view-modes="[...defaultViewModes, {view: 'mymode', icon: 'timeline'}]"
|
|
243
|
+
@viewChange="onViewChange"
|
|
244
|
+
@searchChange="onSearchChange"
|
|
245
|
+
>
|
|
246
|
+
<template #item="{item, mode}">
|
|
247
|
+
<OrCard>${args.item} ({{mode}})</OrCard>
|
|
248
|
+
</template>
|
|
249
|
+
<template #mymode="{items}">
|
|
250
|
+
<div class="typography-headline-3">My view mode</div>
|
|
251
|
+
<div class="grid grid-cols-3">
|
|
252
|
+
<OrCard
|
|
253
|
+
v-for="item in items"
|
|
254
|
+
:key="item.key"
|
|
255
|
+
>
|
|
256
|
+
{{ item.label }} (timeline)
|
|
257
|
+
</OrCard>
|
|
258
|
+
</div>
|
|
259
|
+
</template>
|
|
260
|
+
</OrCardCollection>
|
|
261
|
+
</div>
|
|
262
|
+
`,
|
|
263
|
+
});
|
|
264
|
+
|
|
265
|
+
ExtraViewMode.args = {
|
|
266
|
+
...Default.args,
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
export const WithLink: StoryFn<typeof OrCardCollection> = (args) => ({
|
|
270
|
+
components: {
|
|
271
|
+
OrCardCollection,
|
|
272
|
+
OrCard,
|
|
273
|
+
OrIcon,
|
|
274
|
+
},
|
|
275
|
+
|
|
276
|
+
setup() {
|
|
277
|
+
return {
|
|
278
|
+
args,
|
|
279
|
+
onViewChange: action('viewChange'),
|
|
280
|
+
onSortChange: action('sortChange'),
|
|
281
|
+
onSearchChange: action('searchChange'),
|
|
282
|
+
};
|
|
283
|
+
},
|
|
284
|
+
|
|
285
|
+
template: `
|
|
286
|
+
<div class="p-md bg-surface-1 dark:bg-surface-1-dark">
|
|
287
|
+
<OrCardCollection
|
|
288
|
+
v-bind="args"
|
|
289
|
+
@viewChange="onViewChange"
|
|
290
|
+
@sortChange="onSortChange"
|
|
291
|
+
@searchChange="onSearchChange"
|
|
292
|
+
>
|
|
293
|
+
<template #item="{item}">
|
|
294
|
+
<a href="#" @click.prevent><OrCard>${args.item}</OrCard></a>
|
|
295
|
+
</template>
|
|
296
|
+
</OrCardCollection>
|
|
297
|
+
</div>
|
|
298
|
+
`,
|
|
299
|
+
});
|
|
300
|
+
|
|
301
|
+
WithLink.args = {
|
|
302
|
+
...Default.args,
|
|
162
303
|
};
|
|
@@ -6,87 +6,105 @@
|
|
|
6
6
|
>
|
|
7
7
|
<div :class="toolbarStyles">
|
|
8
8
|
<div :class="toolbarPanelStyles">
|
|
9
|
-
<template v-if="
|
|
10
|
-
<
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
<template v-if="sortOptions.length">
|
|
10
|
+
<OrButton
|
|
11
|
+
ref="sortButton"
|
|
12
|
+
variant="link"
|
|
13
|
+
color="inherit"
|
|
14
|
+
@click="sortMenu.toggle()"
|
|
15
15
|
>
|
|
16
|
-
{{
|
|
17
|
-
|
|
16
|
+
{{ proxySort }}
|
|
17
|
+
<OrIcon
|
|
18
|
+
v-if="sortMenu"
|
|
19
|
+
:icon="sortMenu.isOpen ? 'arrow_drop_up' : 'arrow_drop_down'"
|
|
20
|
+
/>
|
|
21
|
+
</OrButton>
|
|
22
|
+
<OrMenu
|
|
23
|
+
ref="sortMenu"
|
|
24
|
+
:trigger="sortButton && sortButton.root"
|
|
25
|
+
>
|
|
26
|
+
<OrMenuItem
|
|
27
|
+
v-for="sortItem in sortOptions"
|
|
28
|
+
:key="sortItem"
|
|
29
|
+
@click="handleSort(sortItem)"
|
|
30
|
+
>
|
|
31
|
+
{{ sortItem }}
|
|
32
|
+
</OrMenuItem>
|
|
33
|
+
</OrMenu>
|
|
18
34
|
</template>
|
|
19
35
|
</div>
|
|
20
36
|
|
|
21
|
-
<div
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
37
|
+
<div
|
|
38
|
+
:class="toolbarPanelStyles"
|
|
39
|
+
>
|
|
40
|
+
<OrSearch
|
|
41
|
+
class="md:w-[350px]"
|
|
42
|
+
size="s"
|
|
43
|
+
@search="handleSearch"
|
|
27
44
|
/>
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
<slot name="addon" />
|
|
45
|
+
<div class="layout-row gap-sm">
|
|
46
|
+
<template v-if="viewModes.length > 1">
|
|
47
|
+
<OrIconButton
|
|
48
|
+
v-for="viewOption in viewModes"
|
|
49
|
+
:key="viewOption.view"
|
|
50
|
+
:icon="{icon: viewOption.icon, variant: viewOption.view === proxyView ? 'filled' : 'outlined'}"
|
|
51
|
+
@click="switchView(viewOption.view)"
|
|
52
|
+
/>
|
|
53
|
+
</template>
|
|
54
|
+
<slot name="addon" />
|
|
55
|
+
</div>
|
|
40
56
|
</div>
|
|
41
57
|
</div>
|
|
42
58
|
|
|
43
|
-
<
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
/>
|
|
53
|
-
</OrCard>
|
|
54
|
-
</template>
|
|
55
|
-
|
|
56
|
-
<template v-if="proxyView === 'list'">
|
|
57
|
-
<OrCard
|
|
58
|
-
v-for="item in items"
|
|
59
|
-
:key="item.id"
|
|
60
|
-
>
|
|
59
|
+
<slot
|
|
60
|
+
:name="proxyView"
|
|
61
|
+
v-bind="{items}"
|
|
62
|
+
>
|
|
63
|
+
<OrCardCollectionView
|
|
64
|
+
:items="items"
|
|
65
|
+
:mode="proxyView"
|
|
66
|
+
>
|
|
67
|
+
<template v-slot:item="props">
|
|
61
68
|
<slot
|
|
62
|
-
name="
|
|
63
|
-
v-bind="
|
|
69
|
+
name="item"
|
|
70
|
+
v-bind="props"
|
|
64
71
|
/>
|
|
65
|
-
</
|
|
66
|
-
</
|
|
67
|
-
</
|
|
72
|
+
</template>
|
|
73
|
+
</OrCardCollectionView>
|
|
74
|
+
</slot>
|
|
68
75
|
</div>
|
|
69
76
|
</template>
|
|
70
77
|
|
|
71
78
|
<script lang="ts">
|
|
72
79
|
import { computed, defineComponent, PropType, ref, watch } from 'vue-demi';
|
|
73
80
|
import { useClassAttribute } from '../../hooks';
|
|
74
|
-
import { OrCardV3 as OrCard } from '../or-card-v3';
|
|
75
81
|
import { OrIconButtonV3 as OrIconButton } from '../or-icon-button-v3';
|
|
76
|
-
import {
|
|
77
|
-
import {
|
|
82
|
+
import { OrMenuV3 as OrMenu } from '../or-menu-v3';
|
|
83
|
+
import { OrMenuItemV3 as OrMenuItem } from '../or-menu-item-v3';
|
|
84
|
+
import { OrIconV3 as OrIcon } from '../or-icon-v3';
|
|
78
85
|
import { CardCollectionView } from './props';
|
|
79
|
-
import {
|
|
80
|
-
|
|
86
|
+
import {
|
|
87
|
+
CardCollectionRoot,
|
|
88
|
+
CardCollectionToolbar,
|
|
89
|
+
CardCollectionToolbarPanel,
|
|
90
|
+
} from './styles';
|
|
91
|
+
import { CardCollectionItem, ViewMode } from './types';
|
|
92
|
+
import OrCardCollectionView from './OrCardCollectionView.vue3.vue';
|
|
93
|
+
import { OrButtonV3 as OrButton } from '../or-button-v3';
|
|
94
|
+
import { OrSearchV3 as OrSearch } from '../or-search-v3';
|
|
95
|
+
import { defaultViewModes } from './constatnts';
|
|
81
96
|
|
|
82
97
|
export default defineComponent({
|
|
83
98
|
name: 'OrCardCollection',
|
|
84
99
|
|
|
85
100
|
components: {
|
|
86
|
-
|
|
101
|
+
OrCardCollectionView,
|
|
87
102
|
OrIconButton,
|
|
88
|
-
|
|
89
|
-
|
|
103
|
+
OrButton,
|
|
104
|
+
OrMenu,
|
|
105
|
+
OrMenuItem,
|
|
106
|
+
OrIcon,
|
|
107
|
+
OrSearch,
|
|
90
108
|
},
|
|
91
109
|
|
|
92
110
|
inheritAttrs: false,
|
|
@@ -98,18 +116,23 @@ export default defineComponent({
|
|
|
98
116
|
},
|
|
99
117
|
|
|
100
118
|
view: {
|
|
101
|
-
type: String as PropType<
|
|
119
|
+
type: String as PropType<string>,
|
|
102
120
|
default: CardCollectionView.Grid,
|
|
103
121
|
},
|
|
104
122
|
|
|
123
|
+
viewModes: {
|
|
124
|
+
type: Array as PropType<ViewMode[]>,
|
|
125
|
+
default: () => defaultViewModes,
|
|
126
|
+
},
|
|
127
|
+
|
|
105
128
|
sort: {
|
|
106
|
-
type:
|
|
129
|
+
type: String,
|
|
107
130
|
default: undefined,
|
|
108
131
|
},
|
|
109
132
|
|
|
110
|
-
|
|
111
|
-
type: Array as PropType<
|
|
112
|
-
default:
|
|
133
|
+
sortOptions: {
|
|
134
|
+
type: Array as PropType<string[]>,
|
|
135
|
+
default: () => [],
|
|
113
136
|
},
|
|
114
137
|
|
|
115
138
|
search: {
|
|
@@ -131,6 +154,8 @@ export default defineComponent({
|
|
|
131
154
|
setup(props, context) {
|
|
132
155
|
// Refs
|
|
133
156
|
const root = ref<HTMLElement>();
|
|
157
|
+
const sortMenu = ref<typeof OrMenu>();
|
|
158
|
+
const sortButton = ref<typeof OrButton>();
|
|
134
159
|
|
|
135
160
|
// Styles
|
|
136
161
|
const classAttribute = useClassAttribute();
|
|
@@ -149,23 +174,21 @@ export default defineComponent({
|
|
|
149
174
|
...CardCollectionToolbarPanel,
|
|
150
175
|
]);
|
|
151
176
|
|
|
152
|
-
const contentStyles = computed(() => [
|
|
153
|
-
...CardCollectionContent,
|
|
154
|
-
...CardCollectionContentViews[proxyView.value],
|
|
155
|
-
]);
|
|
156
|
-
|
|
157
177
|
// State
|
|
158
178
|
const proxyView = ref(props.view);
|
|
159
179
|
const proxySort = ref(props.sort);
|
|
160
180
|
const proxySearch = ref(props.search);
|
|
161
181
|
|
|
162
182
|
// Methods
|
|
163
|
-
function
|
|
164
|
-
proxyView.value =
|
|
183
|
+
function switchView(view: string): void {
|
|
184
|
+
proxyView.value = view;
|
|
185
|
+
}
|
|
186
|
+
function handleSort(sort: string) {
|
|
187
|
+
proxySort.value = sort;
|
|
165
188
|
}
|
|
166
189
|
|
|
167
|
-
function
|
|
168
|
-
|
|
190
|
+
function handleSearch(search: string) {
|
|
191
|
+
proxySearch.value = search;
|
|
169
192
|
}
|
|
170
193
|
|
|
171
194
|
// Effects
|
|
@@ -195,15 +218,17 @@ export default defineComponent({
|
|
|
195
218
|
|
|
196
219
|
return {
|
|
197
220
|
root,
|
|
221
|
+
sortMenu,
|
|
222
|
+
sortButton,
|
|
198
223
|
rootStyles,
|
|
199
224
|
toolbarStyles,
|
|
200
225
|
toolbarPanelStyles,
|
|
201
|
-
contentStyles,
|
|
202
226
|
proxyView,
|
|
203
227
|
proxySort,
|
|
204
228
|
proxySearch,
|
|
205
|
-
|
|
206
|
-
|
|
229
|
+
switchView,
|
|
230
|
+
handleSort,
|
|
231
|
+
handleSearch,
|
|
207
232
|
};
|
|
208
233
|
},
|
|
209
234
|
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="contentStyles">
|
|
3
|
+
<slot
|
|
4
|
+
v-for="(item) in items"
|
|
5
|
+
name="item"
|
|
6
|
+
v-bind="{
|
|
7
|
+
item,
|
|
8
|
+
mode,
|
|
9
|
+
}"
|
|
10
|
+
>
|
|
11
|
+
{{ item.key }}
|
|
12
|
+
</slot>
|
|
13
|
+
</div>
|
|
14
|
+
</template>
|
|
15
|
+
<script lang="ts">
|
|
16
|
+
import { defineComponent, computed, PropType } from 'vue-demi';
|
|
17
|
+
import { CardCollectionContent, CardCollectionContentViews } from './styles';
|
|
18
|
+
import { CardCollectionItem } from './types';
|
|
19
|
+
import { CardCollectionView } from './props';
|
|
20
|
+
|
|
21
|
+
export default defineComponent({
|
|
22
|
+
name: 'OrCardCollectionView',
|
|
23
|
+
props: {
|
|
24
|
+
items: {
|
|
25
|
+
type: Array as PropType<CardCollectionItem[]>,
|
|
26
|
+
default: [] as CardCollectionItem[],
|
|
27
|
+
},
|
|
28
|
+
mode: {
|
|
29
|
+
type: String as PropType<CardCollectionView>,
|
|
30
|
+
required: true,
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
setup(props) {
|
|
34
|
+
const contentStyles = computed(() => [
|
|
35
|
+
...CardCollectionContent,
|
|
36
|
+
...CardCollectionContentViews[props.mode],
|
|
37
|
+
]);
|
|
38
|
+
return { contentStyles };
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
</script>
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="contentStyles">
|
|
3
|
+
<slot
|
|
4
|
+
v-for="(item, index) in items"
|
|
5
|
+
:key="item.key || index"
|
|
6
|
+
name="item"
|
|
7
|
+
v-bind="{
|
|
8
|
+
item,
|
|
9
|
+
mode,
|
|
10
|
+
}"
|
|
11
|
+
>
|
|
12
|
+
{{ item.key }}
|
|
13
|
+
</slot>
|
|
14
|
+
</div>
|
|
15
|
+
</template>
|
|
16
|
+
<script lang="ts">
|
|
17
|
+
import { defineComponent, computed, PropType } from 'vue-demi';
|
|
18
|
+
import { CardCollectionContent, CardCollectionContentViews } from './styles';
|
|
19
|
+
import { CardCollectionItem } from './types';
|
|
20
|
+
import { CardCollectionView } from './props';
|
|
21
|
+
|
|
22
|
+
export default defineComponent({
|
|
23
|
+
name: 'OrCardCollectionView',
|
|
24
|
+
props: {
|
|
25
|
+
items: {
|
|
26
|
+
type: Array as PropType<CardCollectionItem[]>,
|
|
27
|
+
default: [] as CardCollectionItem[],
|
|
28
|
+
},
|
|
29
|
+
mode: {
|
|
30
|
+
type: String as PropType<CardCollectionView>,
|
|
31
|
+
required: true,
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
setup(props) {
|
|
35
|
+
const contentStyles = computed(() => [
|
|
36
|
+
...CardCollectionContent,
|
|
37
|
+
...CardCollectionContentViews[props.mode],
|
|
38
|
+
]);
|
|
39
|
+
return { contentStyles };
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
</script>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ViewMode } from './types';
|
|
2
|
+
|
|
3
|
+
export const gridView: ViewMode = {
|
|
4
|
+
view: 'grid',
|
|
5
|
+
icon: 'grid_view',
|
|
6
|
+
};
|
|
7
|
+
export const listView: ViewMode = {
|
|
8
|
+
view: 'list',
|
|
9
|
+
icon: 'view_agenda',
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const defaultViewModes = [gridView, listView];
|