@onereach/ui-components 2.69.1-beta.2099.0 → 2.69.1-beta.2101.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/{OrAvatar-2fa559e1.js → OrAvatar-1ada4581.js} +7 -1
- package/dist/bundled/v2/{OrCard-29116e1f.js → OrCard-58a1ba3e.js} +2 -2
- package/dist/bundled/v2/OrCardCollection-a9a779ea.js +228 -0
- package/dist/bundled/v2/{OrSearch-a11b3621.js → OrSearch-9d402f56.js} +3 -9
- package/dist/bundled/v2/{OrSortHeader-9932d28f.js → OrSortHeader-396e6a7c.js} +2 -2
- package/dist/bundled/v2/components/index.js +5 -5
- package/dist/bundled/v2/components/or-avatar-v3/index.js +1 -1
- package/dist/bundled/v2/components/or-avatar-v3/props.d.ts +2 -1
- package/dist/bundled/v2/components/or-card-collection-v3/OrCardCollection.stories3.d.ts +0 -5
- package/dist/bundled/v2/components/or-card-collection-v3/OrCardCollection.vue.d.ts +39 -65
- package/dist/bundled/v2/components/or-card-collection-v3/index.js +4 -7
- package/dist/bundled/v2/components/or-card-collection-v3/types.d.ts +3 -8
- package/dist/bundled/v2/components/or-card-v3/index.js +1 -1
- package/dist/bundled/v2/components/or-search-v3/OrSearch.vue.d.ts +0 -13
- 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 +6 -6
- package/dist/bundled/v3/{OrAvatar.vue_vue_type_script_lang-22e46ce1.js → OrAvatar.vue_vue_type_script_lang-a0a72134.js} +7 -1
- package/dist/bundled/v3/OrCardCollection.vue_vue_type_script_lang-3993a015.js +164 -0
- package/dist/bundled/v3/{OrConfirm.vue_vue_type_script_lang-85472b12.js → OrConfirm.vue_vue_type_script_lang-289b5600.js} +36 -6
- package/dist/bundled/v3/{OrSearch.vue_vue_type_script_lang-0ae8a6dd.js → OrSearch.vue_vue_type_script_lang-ed78b21f.js} +2 -8
- 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/components/index.js +8 -10
- package/dist/bundled/v3/components/or-avatar-v3/index.js +1 -1
- package/dist/bundled/v3/components/or-avatar-v3/props.d.ts +2 -1
- package/dist/bundled/v3/components/or-card-collection-v3/OrCardCollection.stories3.d.ts +0 -5
- package/dist/bundled/v3/components/or-card-collection-v3/OrCardCollection.vue.d.ts +39 -65
- package/dist/bundled/v3/components/or-card-collection-v3/index.js +4 -11
- package/dist/bundled/v3/components/or-card-collection-v3/types.d.ts +3 -8
- package/dist/bundled/v3/components/or-confirm-v3/index.js +1 -2
- package/dist/bundled/v3/components/or-search-v3/OrSearch.vue.d.ts +0 -13
- package/dist/bundled/v3/components/or-search-v3/index.js +1 -1
- package/dist/bundled/v3/components/or-tabs-v3/index.js +1 -2
- package/dist/bundled/v3/index.js +298 -329
- package/dist/esm/v2/{OrAvatar-0afdef36.js → OrAvatar-95b029b4.js} +7 -1
- package/dist/esm/v2/OrCardCollection-4f001551.js +227 -0
- package/dist/esm/v2/{OrSearch-62d91301.js → OrSearch-ddb7c1fe.js} +1 -7
- package/dist/esm/v2/components/index.js +3 -3
- package/dist/esm/v2/components/or-avatar-v3/index.js +1 -1
- package/dist/esm/v2/components/or-avatar-v3/props.d.ts +2 -1
- package/dist/esm/v2/components/or-card-collection-v3/OrCardCollection.stories3.d.ts +0 -5
- package/dist/esm/v2/components/or-card-collection-v3/OrCardCollection.vue.d.ts +39 -65
- package/dist/esm/v2/components/or-card-collection-v3/index.js +4 -7
- package/dist/esm/v2/components/or-card-collection-v3/types.d.ts +3 -8
- package/dist/esm/v2/components/or-search-v3/OrSearch.vue.d.ts +0 -13
- package/dist/esm/v2/components/or-search-v3/index.js +1 -1
- package/dist/esm/v2/index.js +3 -3
- package/dist/esm/v3/{OrAvatar-ef88d31c.js → OrAvatar-9ed782da.js} +7 -1
- package/dist/esm/v3/OrCardCollection-5a0febaf.js +198 -0
- package/dist/esm/v3/{OrSearch-aafb93b4.js → OrSearch-cdde55ce.js} +1 -7
- package/dist/esm/v3/components/index.js +3 -3
- package/dist/esm/v3/components/or-avatar-v3/index.js +1 -1
- package/dist/esm/v3/components/or-avatar-v3/props.d.ts +2 -1
- package/dist/esm/v3/components/or-card-collection-v3/OrCardCollection.stories3.d.ts +0 -5
- package/dist/esm/v3/components/or-card-collection-v3/OrCardCollection.vue.d.ts +39 -65
- package/dist/esm/v3/components/or-card-collection-v3/index.js +4 -7
- package/dist/esm/v3/components/or-card-collection-v3/types.d.ts +3 -8
- package/dist/esm/v3/components/or-search-v3/OrSearch.vue.d.ts +0 -13
- package/dist/esm/v3/components/or-search-v3/index.js +1 -1
- package/dist/esm/v3/index.js +3 -3
- package/package.json +1 -1
- package/src/components/or-avatar-v3/props.ts +1 -0
- package/src/components/or-avatar-v3/styles.ts +9 -0
- package/src/components/or-card-collection-v3/OrCardCollection.stories3.ts +28 -229
- package/src/components/or-card-collection-v3/OrCardCollection.vue +76 -119
- package/src/components/or-card-collection-v3/styles.ts +1 -1
- package/src/components/or-card-collection-v3/types.ts +3 -9
- package/src/components/or-search-v3/OrSearch.vue +1 -7
- package/dist/bundled/v2/OrCardCollection-953657a7.js +0 -347
- package/dist/bundled/v2/components/or-card-collection-v3/OrCardCollectionView.vue2.vue.d.ts +0 -35
- package/dist/bundled/v2/components/or-card-collection-v3/constatnts.d.ts +0 -4
- package/dist/bundled/v3/OrButton-8ab33d9d.js +0 -33
- package/dist/bundled/v3/OrCardCollection.vue_vue_type_script_lang-4debae8a.js +0 -229
- package/dist/bundled/v3/OrMenu-f26e8e55.js +0 -29
- package/dist/bundled/v3/components/or-card-collection-v3/OrCardCollectionView.vue3.vue.d.ts +0 -35
- package/dist/bundled/v3/components/or-card-collection-v3/constatnts.d.ts +0 -4
- package/dist/esm/v2/OrCardCollection-55e282a7.js +0 -347
- package/dist/esm/v2/components/or-card-collection-v3/OrCardCollectionView.vue2.vue.d.ts +0 -35
- package/dist/esm/v2/components/or-card-collection-v3/constatnts.d.ts +0 -4
- package/dist/esm/v3/OrCardCollection-0c6da4b8.js +0 -290
- package/dist/esm/v3/components/or-card-collection-v3/OrCardCollectionView.vue3.vue.d.ts +0 -35
- package/dist/esm/v3/components/or-card-collection-v3/constatnts.d.ts +0 -4
- package/src/components/or-card-collection-v3/OrCardCollectionView.vue2.vue +0 -41
- package/src/components/or-card-collection-v3/OrCardCollectionView.vue3.vue +0 -42
- package/src/components/or-card-collection-v3/constatnts.ts +0 -12
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import { action } from '@storybook/addon-actions';
|
|
2
2
|
import { Meta, StoryFn } from '@storybook/vue3';
|
|
3
|
-
import { ref } from 'vue-demi';
|
|
4
3
|
import { OrIconV3 as OrIcon } from '../or-icon-v3';
|
|
5
4
|
import OrCardCollectionDocs from './OrCardCollection.docs.mdx';
|
|
6
5
|
import OrCardCollection from './OrCardCollection.vue';
|
|
7
|
-
import { defaultViewModes } from './constatnts';
|
|
8
|
-
import { OrCardV3 as OrCard } from '../or-card-v3';
|
|
9
6
|
import { CardCollectionView } from './props';
|
|
10
|
-
import { CardCollectionItem } from './types';
|
|
7
|
+
import { CardCollectionItem, CardCollectionSortHeader } from './types';
|
|
11
8
|
|
|
12
9
|
export default {
|
|
13
10
|
title: 'Components/Card Collection',
|
|
@@ -15,7 +12,7 @@ export default {
|
|
|
15
12
|
|
|
16
13
|
argTypes: {
|
|
17
14
|
// Slots
|
|
18
|
-
|
|
15
|
+
gridItem: {
|
|
19
16
|
type: {
|
|
20
17
|
name: 'string',
|
|
21
18
|
required: true,
|
|
@@ -24,9 +21,10 @@ export default {
|
|
|
24
21
|
control: { type: 'text' },
|
|
25
22
|
},
|
|
26
23
|
|
|
27
|
-
|
|
24
|
+
listItem: {
|
|
28
25
|
type: {
|
|
29
26
|
name: 'string',
|
|
27
|
+
required: true,
|
|
30
28
|
},
|
|
31
29
|
|
|
32
30
|
control: { type: 'text' },
|
|
@@ -46,7 +44,7 @@ export default {
|
|
|
46
44
|
control: { type: 'object' },
|
|
47
45
|
},
|
|
48
46
|
|
|
49
|
-
|
|
47
|
+
sortHeaders: {
|
|
50
48
|
control: { type: 'object' },
|
|
51
49
|
},
|
|
52
50
|
|
|
@@ -72,48 +70,35 @@ export default {
|
|
|
72
70
|
docs: {
|
|
73
71
|
page: OrCardCollectionDocs,
|
|
74
72
|
},
|
|
75
|
-
layout: 'fullscreen',
|
|
76
73
|
},
|
|
77
74
|
} as Meta<typeof OrCardCollection>;
|
|
78
75
|
|
|
79
76
|
const Template: StoryFn<typeof OrCardCollection> = (args) => ({
|
|
80
77
|
components: {
|
|
81
78
|
OrCardCollection,
|
|
82
|
-
OrCard,
|
|
83
79
|
OrIcon,
|
|
84
80
|
},
|
|
85
81
|
|
|
86
82
|
setup() {
|
|
87
|
-
const sort = ref(args.sort);
|
|
88
|
-
const onSortChange = (newSort: string) => {
|
|
89
|
-
sort.value = newSort;
|
|
90
|
-
action('searchChange')(newSort);
|
|
91
|
-
};
|
|
92
|
-
|
|
93
83
|
return {
|
|
94
84
|
args,
|
|
95
|
-
sort,
|
|
96
|
-
onSortChange,
|
|
97
85
|
onViewChange: action('viewChange'),
|
|
86
|
+
onSortChange: action('sortChange'),
|
|
98
87
|
onSearchChange: action('searchChange'),
|
|
99
88
|
};
|
|
100
89
|
},
|
|
101
90
|
|
|
102
91
|
template: `
|
|
103
|
-
<
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
>
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
</template>
|
|
114
|
-
<template #addon>${args.addon}</template>
|
|
115
|
-
</OrCardCollection>
|
|
116
|
-
</div>
|
|
92
|
+
<OrCardCollection
|
|
93
|
+
v-bind="args"
|
|
94
|
+
@viewChange="onViewChange"
|
|
95
|
+
@sortChange="onSortChange"
|
|
96
|
+
@searchChange="onSearchChange"
|
|
97
|
+
>
|
|
98
|
+
<template #gridItem="item">${args.gridItem}</template>
|
|
99
|
+
<template #listItem="item">${args.listItem}</template>
|
|
100
|
+
<template #addon>${args.addon}</template>
|
|
101
|
+
</OrCardCollection>
|
|
117
102
|
`,
|
|
118
103
|
});
|
|
119
104
|
|
|
@@ -121,7 +106,8 @@ export const Default = Template.bind({});
|
|
|
121
106
|
|
|
122
107
|
Default.args = {
|
|
123
108
|
// Slots
|
|
124
|
-
|
|
109
|
+
gridItem: '{{ item.label }} (grid)',
|
|
110
|
+
listItem: '{{ item.label }} (list)',
|
|
125
111
|
addon: '<OrIcon icon="info" />',
|
|
126
112
|
|
|
127
113
|
// Props
|
|
@@ -153,7 +139,7 @@ Default.args = {
|
|
|
153
139
|
'Yankee',
|
|
154
140
|
'Zulu',
|
|
155
141
|
], (item) => ({
|
|
156
|
-
|
|
142
|
+
id: item.toLowerCase(),
|
|
157
143
|
label: item,
|
|
158
144
|
})),
|
|
159
145
|
};
|
|
@@ -164,200 +150,13 @@ WithSorting.args = {
|
|
|
164
150
|
...Default.args,
|
|
165
151
|
|
|
166
152
|
// Props
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
},
|
|
177
|
-
{
|
|
178
|
-
label: 'Baz',
|
|
179
|
-
value: 'baz',
|
|
180
|
-
},
|
|
181
|
-
{
|
|
182
|
-
label: 'Qux',
|
|
183
|
-
value: 'qux',
|
|
184
|
-
},
|
|
185
|
-
],
|
|
186
|
-
};
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
export const OverrideViewContainer: StoryFn<typeof OrCardCollection> = (args) => ({
|
|
190
|
-
components: {
|
|
191
|
-
OrCardCollection,
|
|
192
|
-
OrCard,
|
|
193
|
-
},
|
|
194
|
-
|
|
195
|
-
setup() {
|
|
196
|
-
return {
|
|
197
|
-
args,
|
|
198
|
-
onViewChange: action('viewChange'),
|
|
199
|
-
onSortChange: action('sortChange'),
|
|
200
|
-
onSearchChange: action('searchChange'),
|
|
201
|
-
};
|
|
202
|
-
},
|
|
203
|
-
|
|
204
|
-
template: `
|
|
205
|
-
<div class="p-md bg-surface-1 dark:bg-surface-1-dark">
|
|
206
|
-
<OrCardCollection
|
|
207
|
-
v-bind="args"
|
|
208
|
-
@viewChange="onViewChange"
|
|
209
|
-
@sortChange="onSortChange"
|
|
210
|
-
@searchChange="onSearchChange"
|
|
211
|
-
>
|
|
212
|
-
<template #header="{mode}">
|
|
213
|
-
${args.header}
|
|
214
|
-
</template>
|
|
215
|
-
<template #grid="{items}">
|
|
216
|
-
<div class="grid grid-cols-3">
|
|
217
|
-
<OrCard
|
|
218
|
-
v-for="item in items"
|
|
219
|
-
:key="item.key"
|
|
220
|
-
>
|
|
221
|
-
{{ item.label }}
|
|
222
|
-
</OrCard>
|
|
223
|
-
</div>
|
|
224
|
-
</template>
|
|
225
|
-
<template #list="{items}">
|
|
226
|
-
<ul>
|
|
227
|
-
<li
|
|
228
|
-
v-for="item in items"
|
|
229
|
-
:key="item.key"
|
|
230
|
-
>
|
|
231
|
-
- {{ item.label }}
|
|
232
|
-
</li>
|
|
233
|
-
</ul>
|
|
234
|
-
</template>
|
|
235
|
-
</OrCardCollection>
|
|
236
|
-
</div>
|
|
237
|
-
`,
|
|
238
|
-
});
|
|
239
|
-
|
|
240
|
-
OverrideViewContainer.args = {
|
|
241
|
-
...Default.args,
|
|
242
|
-
header: '<div class="typography-headline-3">Custom {{ mode }}</div>',
|
|
243
|
-
};
|
|
244
|
-
|
|
245
|
-
export const ExtraViewMode: StoryFn<typeof OrCardCollection> = (args) => ({
|
|
246
|
-
components: {
|
|
247
|
-
OrCardCollection,
|
|
248
|
-
OrCard,
|
|
249
|
-
},
|
|
250
|
-
|
|
251
|
-
setup() {
|
|
252
|
-
return {
|
|
253
|
-
args,
|
|
254
|
-
defaultViewModes,
|
|
255
|
-
onViewChange: action('viewChange'),
|
|
256
|
-
onSearchChange: action('searchChange'),
|
|
257
|
-
};
|
|
258
|
-
},
|
|
259
|
-
|
|
260
|
-
template: `
|
|
261
|
-
<div class="p-md bg-surface-1 dark:bg-surface-1-dark">
|
|
262
|
-
<OrCardCollection
|
|
263
|
-
v-bind="args"
|
|
264
|
-
:view-modes="[...defaultViewModes, {view: 'mymode', icon: 'timeline'}]"
|
|
265
|
-
@viewChange="onViewChange"
|
|
266
|
-
@searchChange="onSearchChange"
|
|
267
|
-
>
|
|
268
|
-
<template #item="{item, mode}">
|
|
269
|
-
<OrCard>${args.item} ({{mode}})</OrCard>
|
|
270
|
-
</template>
|
|
271
|
-
<template #mymode="{items}">
|
|
272
|
-
<div class="typography-headline-3">My view mode</div>
|
|
273
|
-
<div class="grid grid-cols-3">
|
|
274
|
-
<OrCard
|
|
275
|
-
v-for="item in items"
|
|
276
|
-
:key="item.key"
|
|
277
|
-
>
|
|
278
|
-
{{ item.label }} (timeline)
|
|
279
|
-
</OrCard>
|
|
280
|
-
</div>
|
|
281
|
-
</template>
|
|
282
|
-
</OrCardCollection>
|
|
283
|
-
</div>
|
|
284
|
-
`,
|
|
285
|
-
});
|
|
286
|
-
|
|
287
|
-
ExtraViewMode.args = {
|
|
288
|
-
...Default.args,
|
|
289
|
-
};
|
|
290
|
-
|
|
291
|
-
export const WithLink: StoryFn<typeof OrCardCollection> = (args) => ({
|
|
292
|
-
components: {
|
|
293
|
-
OrCardCollection,
|
|
294
|
-
OrCard,
|
|
295
|
-
OrIcon,
|
|
296
|
-
},
|
|
297
|
-
|
|
298
|
-
setup() {
|
|
299
|
-
return {
|
|
300
|
-
args,
|
|
301
|
-
onViewChange: action('viewChange'),
|
|
302
|
-
onSortChange: action('sortChange'),
|
|
303
|
-
onSearchChange: action('searchChange'),
|
|
304
|
-
};
|
|
305
|
-
},
|
|
306
|
-
|
|
307
|
-
template: `
|
|
308
|
-
<div class="p-md bg-surface-1 dark:bg-surface-1-dark">
|
|
309
|
-
<OrCardCollection
|
|
310
|
-
v-bind="args"
|
|
311
|
-
@viewChange="onViewChange"
|
|
312
|
-
@sortChange="onSortChange"
|
|
313
|
-
@searchChange="onSearchChange"
|
|
314
|
-
>
|
|
315
|
-
<template #item="{item}">
|
|
316
|
-
<a href="#" @click.prevent><OrCard>${args.item}</OrCard></a>
|
|
317
|
-
</template>
|
|
318
|
-
</OrCardCollection>
|
|
319
|
-
</div>
|
|
320
|
-
`,
|
|
321
|
-
});
|
|
322
|
-
|
|
323
|
-
WithLink.args = {
|
|
324
|
-
...Default.args,
|
|
325
|
-
};
|
|
326
|
-
|
|
327
|
-
export const EmptySearchResults: StoryFn<typeof OrCardCollection> = (args) => ({
|
|
328
|
-
components: {
|
|
329
|
-
OrCardCollection,
|
|
330
|
-
OrCard,
|
|
331
|
-
OrIcon,
|
|
332
|
-
},
|
|
333
|
-
|
|
334
|
-
setup() {
|
|
335
|
-
return {
|
|
336
|
-
args,
|
|
337
|
-
onViewChange: action('viewChange'),
|
|
338
|
-
onSortChange: action('sortChange'),
|
|
339
|
-
onSearchChange: action('searchChange'),
|
|
340
|
-
};
|
|
341
|
-
},
|
|
342
|
-
|
|
343
|
-
template: `
|
|
344
|
-
<div class="p-md h-screen bg-surface-1 dark:bg-surface-1-dark">
|
|
345
|
-
<OrCardCollection
|
|
346
|
-
v-bind="args"
|
|
347
|
-
@viewChange="onViewChange"
|
|
348
|
-
@sortChange="onSortChange"
|
|
349
|
-
@searchChange="onSearchChange"
|
|
350
|
-
>
|
|
351
|
-
<template #noSearchResults="{search}">
|
|
352
|
-
<p class="text-center typography-headline-3">No results for "{{search}}"</p>
|
|
353
|
-
</template>
|
|
354
|
-
</OrCardCollection>
|
|
355
|
-
</div>
|
|
356
|
-
`,
|
|
357
|
-
});
|
|
358
|
-
|
|
359
|
-
EmptySearchResults.args = {
|
|
360
|
-
...Default.args,
|
|
361
|
-
search: 'My favorite ..',
|
|
362
|
-
items: [],
|
|
153
|
+
sortHeaders: Array.from<string, CardCollectionSortHeader>([
|
|
154
|
+
'Foo',
|
|
155
|
+
'Bar',
|
|
156
|
+
'Baz',
|
|
157
|
+
'Qux',
|
|
158
|
+
], (item) => ({
|
|
159
|
+
value: item.toLowerCase(),
|
|
160
|
+
label: item,
|
|
161
|
+
})),
|
|
363
162
|
};
|
|
@@ -6,119 +6,87 @@
|
|
|
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="sortHeaders">
|
|
10
|
+
<OrSortHeader
|
|
11
|
+
v-for="header in sortHeaders"
|
|
12
|
+
:key="header.value"
|
|
13
|
+
v-model="proxySort"
|
|
14
|
+
:input-value="header.value"
|
|
15
15
|
>
|
|
16
|
-
{{
|
|
17
|
-
|
|
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.value)"
|
|
30
|
-
>
|
|
31
|
-
{{ sortItem.label }}
|
|
32
|
-
</OrMenuItem>
|
|
33
|
-
</OrMenu>
|
|
16
|
+
{{ header.label }}
|
|
17
|
+
</OrSortHeader>
|
|
34
18
|
</template>
|
|
35
19
|
</div>
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
<OrSearch
|
|
20
|
+
|
|
21
|
+
<div :class="toolbarPanelStyles">
|
|
22
|
+
<OrInput
|
|
40
23
|
v-model="proxySearch"
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
24
|
+
:type="'search'"
|
|
25
|
+
:placeholder="'Search'"
|
|
26
|
+
:size="'s'"
|
|
27
|
+
/>
|
|
28
|
+
|
|
29
|
+
<OrIconButton
|
|
30
|
+
:icon="'grid_view'"
|
|
31
|
+
@click="switchToGridView()"
|
|
32
|
+
/>
|
|
33
|
+
|
|
34
|
+
<OrIconButton
|
|
35
|
+
:icon="'view_list'"
|
|
36
|
+
@click="switchToListView()"
|
|
44
37
|
/>
|
|
45
|
-
|
|
46
|
-
|
|
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>
|
|
38
|
+
|
|
39
|
+
<slot name="addon" />
|
|
56
40
|
</div>
|
|
57
41
|
</div>
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
v-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
<slot
|
|
66
|
-
v-if="items.length"
|
|
67
|
-
:name="proxyView"
|
|
68
|
-
v-bind="{items}"
|
|
69
|
-
>
|
|
70
|
-
<OrCardCollectionView
|
|
71
|
-
:items="items"
|
|
72
|
-
:mode="proxyView"
|
|
73
|
-
>
|
|
74
|
-
<template v-slot:item="props">
|
|
42
|
+
|
|
43
|
+
<div :class="contentStyles">
|
|
44
|
+
<template v-if="proxyView === 'grid'">
|
|
45
|
+
<OrCard
|
|
46
|
+
v-for="item in items"
|
|
47
|
+
:key="item.id"
|
|
48
|
+
>
|
|
75
49
|
<slot
|
|
76
|
-
name="
|
|
77
|
-
v-bind="
|
|
50
|
+
name="gridItem"
|
|
51
|
+
v-bind="item"
|
|
78
52
|
/>
|
|
79
|
-
</
|
|
80
|
-
</
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
53
|
+
</OrCard>
|
|
54
|
+
</template>
|
|
55
|
+
|
|
56
|
+
<template v-if="proxyView === 'list'">
|
|
57
|
+
<OrCard
|
|
58
|
+
v-for="item in items"
|
|
59
|
+
:key="item.id"
|
|
60
|
+
>
|
|
61
|
+
<slot
|
|
62
|
+
name="listItem"
|
|
63
|
+
v-bind="item"
|
|
64
|
+
/>
|
|
65
|
+
</OrCard>
|
|
66
|
+
</template>
|
|
67
|
+
</div>
|
|
89
68
|
</div>
|
|
90
69
|
</template>
|
|
91
70
|
|
|
92
71
|
<script lang="ts">
|
|
93
72
|
import { computed, defineComponent, PropType, ref, watch } from 'vue-demi';
|
|
94
73
|
import { useClassAttribute } from '../../hooks';
|
|
74
|
+
import { OrCardV3 as OrCard } from '../or-card-v3';
|
|
95
75
|
import { OrIconButtonV3 as OrIconButton } from '../or-icon-button-v3';
|
|
96
|
-
import {
|
|
97
|
-
import {
|
|
98
|
-
import { OrIconV3 as OrIcon } from '../or-icon-v3';
|
|
76
|
+
import { OrInputV3 as OrInput } from '../or-input-v3';
|
|
77
|
+
import { OrSortHeaderV3 as OrSortHeader, SortHeaderModel } from '../or-sort-header-v3';
|
|
99
78
|
import { CardCollectionView } from './props';
|
|
100
|
-
import {
|
|
101
|
-
|
|
102
|
-
CardCollectionToolbar,
|
|
103
|
-
CardCollectionToolbarPanel,
|
|
104
|
-
} from './styles';
|
|
105
|
-
import { CardCollectionItem, SortOption, ViewMode } from './types';
|
|
106
|
-
import OrCardCollectionView from './OrCardCollectionView.vue3.vue';
|
|
107
|
-
import { OrButtonV3 as OrButton } from '../or-button-v3';
|
|
108
|
-
import { OrSearchV3 as OrSearch } from '../or-search-v3';
|
|
109
|
-
import { defaultViewModes } from './constatnts';
|
|
79
|
+
import { CardCollectionContent, CardCollectionContentViews, CardCollectionRoot, CardCollectionToolbar, CardCollectionToolbarPanel } from './styles';
|
|
80
|
+
import { CardCollectionItem, CardCollectionSortHeader } from './types';
|
|
110
81
|
|
|
111
82
|
export default defineComponent({
|
|
112
83
|
name: 'OrCardCollection',
|
|
113
84
|
|
|
114
85
|
components: {
|
|
115
|
-
|
|
86
|
+
OrCard,
|
|
116
87
|
OrIconButton,
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
OrMenuItem,
|
|
120
|
-
OrIcon,
|
|
121
|
-
OrSearch,
|
|
88
|
+
OrInput,
|
|
89
|
+
OrSortHeader,
|
|
122
90
|
},
|
|
123
91
|
|
|
124
92
|
inheritAttrs: false,
|
|
@@ -130,28 +98,23 @@ export default defineComponent({
|
|
|
130
98
|
},
|
|
131
99
|
|
|
132
100
|
view: {
|
|
133
|
-
type: String
|
|
101
|
+
type: String as PropType<CardCollectionView>,
|
|
134
102
|
default: CardCollectionView.Grid,
|
|
135
103
|
},
|
|
136
104
|
|
|
137
|
-
viewModes: {
|
|
138
|
-
type: Array as PropType<ViewMode[]>,
|
|
139
|
-
default: () => defaultViewModes,
|
|
140
|
-
},
|
|
141
|
-
|
|
142
105
|
sort: {
|
|
143
|
-
type:
|
|
106
|
+
type: Object as PropType<SortHeaderModel>,
|
|
144
107
|
default: undefined,
|
|
145
108
|
},
|
|
146
109
|
|
|
147
|
-
|
|
148
|
-
type: Array as PropType<
|
|
149
|
-
default:
|
|
110
|
+
sortHeaders: {
|
|
111
|
+
type: Array as PropType<CardCollectionSortHeader[]>,
|
|
112
|
+
default: undefined,
|
|
150
113
|
},
|
|
151
114
|
|
|
152
115
|
search: {
|
|
153
116
|
type: String,
|
|
154
|
-
default:
|
|
117
|
+
default: undefined,
|
|
155
118
|
},
|
|
156
119
|
},
|
|
157
120
|
|
|
@@ -168,8 +131,6 @@ export default defineComponent({
|
|
|
168
131
|
setup(props, context) {
|
|
169
132
|
// Refs
|
|
170
133
|
const root = ref<HTMLElement>();
|
|
171
|
-
const sortMenu = ref<typeof OrMenu>();
|
|
172
|
-
const sortButton = ref<typeof OrButton>();
|
|
173
134
|
|
|
174
135
|
// Styles
|
|
175
136
|
const classAttribute = useClassAttribute();
|
|
@@ -188,24 +149,23 @@ export default defineComponent({
|
|
|
188
149
|
...CardCollectionToolbarPanel,
|
|
189
150
|
]);
|
|
190
151
|
|
|
191
|
-
const
|
|
192
|
-
|
|
193
|
-
|
|
152
|
+
const contentStyles = computed(() => [
|
|
153
|
+
...CardCollectionContent,
|
|
154
|
+
...CardCollectionContentViews[proxyView.value],
|
|
155
|
+
]);
|
|
156
|
+
|
|
194
157
|
// State
|
|
195
158
|
const proxyView = ref(props.view);
|
|
196
159
|
const proxySort = ref(props.sort);
|
|
197
160
|
const proxySearch = ref(props.search);
|
|
198
161
|
|
|
199
162
|
// Methods
|
|
200
|
-
function
|
|
201
|
-
proxyView.value =
|
|
202
|
-
}
|
|
203
|
-
function handleSort(sort: string) {
|
|
204
|
-
proxySort.value = sort;
|
|
163
|
+
function switchToGridView(): void {
|
|
164
|
+
proxyView.value = CardCollectionView.Grid;
|
|
205
165
|
}
|
|
206
166
|
|
|
207
|
-
function
|
|
208
|
-
|
|
167
|
+
function switchToListView(): void {
|
|
168
|
+
proxyView.value = CardCollectionView.List;
|
|
209
169
|
}
|
|
210
170
|
|
|
211
171
|
// Effects
|
|
@@ -235,18 +195,15 @@ export default defineComponent({
|
|
|
235
195
|
|
|
236
196
|
return {
|
|
237
197
|
root,
|
|
238
|
-
sortMenu,
|
|
239
|
-
sortButton,
|
|
240
198
|
rootStyles,
|
|
241
199
|
toolbarStyles,
|
|
242
200
|
toolbarPanelStyles,
|
|
201
|
+
contentStyles,
|
|
243
202
|
proxyView,
|
|
244
203
|
proxySort,
|
|
245
204
|
proxySearch,
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
handleSort,
|
|
249
|
-
handleSearch,
|
|
205
|
+
switchToGridView,
|
|
206
|
+
switchToListView,
|
|
250
207
|
};
|
|
251
208
|
},
|
|
252
209
|
});
|
|
@@ -1,14 +1,8 @@
|
|
|
1
1
|
export interface CardCollectionItem {
|
|
2
|
-
|
|
3
|
-
[key: string|number]: any;
|
|
2
|
+
id: string;
|
|
4
3
|
}
|
|
5
4
|
|
|
6
|
-
export interface
|
|
7
|
-
view: string;
|
|
8
|
-
icon: string;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export interface SortOption {
|
|
12
|
-
label: string;
|
|
5
|
+
export interface CardCollectionSortHeader {
|
|
13
6
|
value: string;
|
|
7
|
+
label: string;
|
|
14
8
|
}
|
|
@@ -35,12 +35,6 @@ export default defineComponent({
|
|
|
35
35
|
inheritAttrs: false,
|
|
36
36
|
|
|
37
37
|
props: {
|
|
38
|
-
modelValue: {
|
|
39
|
-
type: String,
|
|
40
|
-
default: '',
|
|
41
|
-
required: false,
|
|
42
|
-
},
|
|
43
|
-
|
|
44
38
|
size: {
|
|
45
39
|
type: String as PropType<SearchSize>,
|
|
46
40
|
default: SearchSize.M,
|
|
@@ -96,7 +90,7 @@ export default defineComponent({
|
|
|
96
90
|
]);
|
|
97
91
|
|
|
98
92
|
// State
|
|
99
|
-
const localModelValue = ref(
|
|
93
|
+
const localModelValue = ref('');
|
|
100
94
|
|
|
101
95
|
// Events
|
|
102
96
|
debouncedWatch(
|