@onereach/ui-components 2.62.3-beta.1904.0 → 2.62.3
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/v2/{OrConfirm-3896bd11.js → OrConfirm-d561bf82.js} +1 -1
- package/dist/v2/{OrInlineInput-c1d6fb73.js → OrInlineInput-e754cb9f.js} +5 -5
- package/dist/v2/{OrInlineTextarea-7ec4c40d.js → OrInlineTextarea-7dc58bb1.js} +5 -5
- package/dist/v2/{OrInput-0508c3fb.js → OrInput-0dcfba2a.js} +5 -5
- package/dist/v2/{OrSearch-feca9f48.js → OrSearch-45ea8c33.js} +1 -1
- package/dist/v2/{OrSelect-bb539517.js → OrSelect-b44cac14.js} +14 -34
- package/dist/v2/{OrTextarea-cc70afc9.js → OrTextarea-8773d494.js} +5 -5
- package/dist/v2/components/index.d.ts +0 -2
- package/dist/v2/components/or-select-v3/OrSelect.vue.d.ts +2 -2
- package/dist/v2/directives/index.d.ts +2 -0
- package/dist/v2/dropdown-open-0d314aa4.js +28 -0
- package/dist/v2/index.d.ts +1 -0
- package/dist/v2/index.js +8 -9
- package/dist/v2/index11.js +1 -20
- package/dist/v2/index12.js +12 -3
- package/dist/v2/index13.js +2 -3
- package/dist/v2/index14.js +5 -11
- package/dist/v2/index15.js +14 -5
- package/dist/v2/index16.js +19 -4
- package/dist/v2/index17.js +4 -28
- package/dist/v2/index18.js +7 -3
- package/dist/v2/index19.js +23 -5
- package/dist/v2/index2.js +8 -9
- package/dist/v2/index20.js +21 -25
- package/dist/v2/index21.js +18 -21
- package/dist/v2/index22.js +2 -20
- package/dist/v2/index23.js +4 -2
- package/dist/v2/index24.js +1 -2
- package/dist/v2/index25.js +2 -1
- package/dist/v2/index26.js +2 -2
- package/dist/v2/index27.js +7 -4
- package/dist/v2/index28.js +2 -6
- package/dist/v2/index29.js +3 -3
- package/dist/v2/index30.js +10 -3
- package/dist/v2/index31.js +12 -9
- package/dist/v2/index32.js +1 -11
- package/dist/v2/index33.js +1 -1
- package/dist/v2/index34.js +16 -1
- package/dist/v2/index35.js +17 -17
- package/dist/v2/index36.js +17 -17
- package/dist/v2/index37.js +1 -16
- package/dist/v2/index38.js +17 -1
- package/dist/v2/index39.js +22 -18
- package/dist/v2/index40.js +2 -22
- package/dist/v2/index41.js +3 -3
- package/dist/v2/index42.js +1 -1
- package/dist/v2/index43.js +20 -3
- package/dist/v2/index44.js +7 -1
- package/dist/v2/index45.js +1 -24
- package/dist/v2/index46.js +3 -3
- package/dist/v2/index47.js +2 -1
- package/dist/v2/index48.js +9 -2
- package/dist/v2/index49.js +17 -10
- package/dist/v2/index50.js +13 -17
- package/dist/v2/index51.js +14 -13
- package/dist/v2/index52.js +13 -14
- package/dist/v2/index53.js +15 -12
- package/dist/v2/index54.js +1 -16
- package/dist/v2/index55.js +6 -2
- package/dist/v2/index56.js +5 -1
- package/dist/v2/index57.js +3 -10
- package/dist/v2/index58.js +4 -2
- package/dist/v2/index59.js +3 -5
- package/dist/v2/index60.js +1 -2
- package/dist/v2/index61.js +5 -2
- package/dist/v2/index62.js +18 -3
- package/dist/v2/index63.js +15 -18
- package/dist/v2/index64.js +24 -15
- package/dist/v2/index65.js +4 -25
- package/dist/v2/index66.js +1 -2
- package/dist/v2/index67.js +4 -3
- package/dist/v2/index68.js +4 -3
- package/dist/v2/index69.js +10 -3
- package/dist/v2/index70.js +6 -3
- package/dist/v2/index71.js +4 -4
- package/dist/v2/index72.js +6 -15
- package/dist/v2/index73.js +2 -2
- package/dist/v2/index74.js +3 -6
- package/dist/v2/index75.js +3 -4
- package/dist/v2/index76.js +2 -1
- package/dist/v2/index77.js +14 -2
- package/dist/v2/index78.js +10 -2
- package/dist/v2/index79.js +4 -5
- package/dist/v2/index80.js +2 -12
- package/dist/v2/index81.js +2 -14
- package/dist/v2/index82.js +3 -2
- package/dist/v2/index83.js +8 -2
- package/dist/v2/index84.js +20 -2
- package/dist/v2/index85.js +18 -8
- package/dist/v2/index86.js +1 -21
- package/dist/v2/index87.js +16 -17
- package/dist/v2/index88.js +1 -1
- package/dist/v2/index89.js +9 -17
- package/dist/v2/index90.js +12 -2
- package/dist/v2/index91.js +1 -10
- package/dist/v2/index92.js +6 -12
- package/dist/v2/index93.js +1 -5
- package/dist/v3/{OrConfirm-9990d64a.js → OrConfirm-a9d3f157.js} +1 -1
- package/dist/v3/{OrInlineInput-bc5fa87a.js → OrInlineInput-8f473205.js} +3 -5
- package/dist/v3/{OrInlineTextarea-c433b451.js → OrInlineTextarea-86f4506d.js} +3 -5
- package/dist/v3/{OrInput-2b05a69c.js → OrInput-f51916d4.js} +3 -5
- package/dist/v3/{OrSearch-1272c3df.js → OrSearch-e27cadbf.js} +1 -1
- package/dist/v3/{OrSelect-529b4567.js → OrSelect-9d821ef2.js} +13 -35
- package/dist/v3/{OrTextarea-98895b2a.js → OrTextarea-09aa33dc.js} +4 -6
- package/dist/v3/components/index.d.ts +0 -2
- package/dist/v3/components/or-select-v3/OrSelect.vue.d.ts +2 -2
- package/dist/v3/directives/index.d.ts +2 -0
- package/dist/v3/dropdown-open-0d314aa4.js +28 -0
- package/dist/v3/index.d.ts +1 -0
- package/dist/v3/index.js +8 -9
- package/dist/v3/index11.js +1 -19
- package/dist/v3/index12.js +11 -3
- package/dist/v3/index13.js +2 -3
- package/dist/v3/index14.js +4 -9
- package/dist/v3/index15.js +11 -4
- package/dist/v3/index16.js +17 -3
- package/dist/v3/index17.js +4 -25
- package/dist/v3/index18.js +6 -3
- package/dist/v3/index19.js +20 -5
- package/dist/v3/index2.js +8 -9
- package/dist/v3/index20.js +20 -21
- package/dist/v3/index21.js +15 -20
- package/dist/v3/index22.js +1 -16
- package/dist/v3/index23.js +4 -2
- package/dist/v3/index24.js +1 -2
- package/dist/v3/index25.js +2 -1
- package/dist/v3/index26.js +2 -2
- package/dist/v3/index27.js +6 -4
- package/dist/v3/index28.js +2 -5
- package/dist/v3/index29.js +3 -3
- package/dist/v3/index30.js +9 -3
- package/dist/v3/index31.js +11 -8
- package/dist/v3/index32.js +1 -10
- package/dist/v3/index33.js +1 -1
- package/dist/v3/index34.js +15 -1
- package/dist/v3/index35.js +14 -16
- package/dist/v3/index36.js +16 -14
- package/dist/v3/index37.js +2 -16
- package/dist/v3/index38.js +17 -2
- package/dist/v3/index39.js +17 -17
- package/dist/v3/index40.js +1 -16
- package/dist/v3/index41.js +3 -3
- package/dist/v3/index42.js +1 -1
- package/dist/v3/index43.js +16 -3
- package/dist/v3/index44.js +7 -1
- package/dist/v3/index45.js +1 -20
- package/dist/v3/index46.js +3 -3
- package/dist/v3/index47.js +2 -1
- package/dist/v3/index48.js +8 -2
- package/dist/v3/index49.js +14 -9
- package/dist/v3/index50.js +12 -14
- package/dist/v3/index51.js +11 -12
- package/dist/v3/index52.js +12 -11
- package/dist/v3/index53.js +11 -11
- package/dist/v3/index54.js +1 -12
- package/dist/v3/index55.js +5 -2
- package/dist/v3/index56.js +5 -1
- package/dist/v3/index57.js +3 -9
- package/dist/v3/index58.js +4 -2
- package/dist/v3/index59.js +3 -5
- package/dist/v3/index60.js +1 -2
- package/dist/v3/index61.js +4 -1
- package/dist/v3/index62.js +17 -3
- package/dist/v3/index63.js +14 -17
- package/dist/v3/index64.js +22 -13
- package/dist/v3/index65.js +3 -23
- package/dist/v3/index66.js +1 -2
- package/dist/v3/index67.js +4 -3
- package/dist/v3/index68.js +4 -3
- package/dist/v3/index69.js +9 -3
- package/dist/v3/index70.js +4 -3
- package/dist/v3/index71.js +4 -4
- package/dist/v3/index72.js +5 -11
- package/dist/v3/index73.js +2 -2
- package/dist/v3/index74.js +2 -5
- package/dist/v3/index75.js +3 -4
- package/dist/v3/index76.js +2 -1
- package/dist/v3/index77.js +13 -2
- package/dist/v3/index78.js +9 -2
- package/dist/v3/index79.js +4 -5
- package/dist/v3/index80.js +1 -11
- package/dist/v3/index81.js +1 -13
- package/dist/v3/index82.js +3 -1
- package/dist/v3/index83.js +8 -1
- package/dist/v3/index84.js +17 -2
- package/dist/v3/index85.js +14 -7
- package/dist/v3/index86.js +1 -18
- package/dist/v3/index87.js +15 -14
- package/dist/v3/index88.js +1 -1
- package/dist/v3/index89.js +6 -15
- package/dist/v3/index90.js +11 -2
- package/dist/v3/index91.js +1 -8
- package/dist/v3/index92.js +6 -11
- package/dist/v3/index93.js +1 -5
- package/package.json +3 -2
- package/src/components/index.ts +0 -2
- package/src/components/or-inline-input-v3/OrInlineInput.vue +10 -12
- package/src/components/or-inline-textarea-v3/OrInlineTextarea.vue +10 -12
- package/src/components/or-input-v3/OrInput.vue +10 -12
- package/src/components/or-select-v3/OrSelect.vue +12 -11
- package/src/components/or-textarea-v3/OrTextarea.vue +10 -12
- package/src/directives/index.ts +2 -0
- package/src/index.ts +1 -0
- package/dist/v2/OrCardCollection-89a315ed.js +0 -227
- package/dist/v2/OrSortHeader-a6004b24.js +0 -133
- package/dist/v2/components/or-card-collection-v3/OrCardCollection.stories3.d.ts +0 -17
- package/dist/v2/components/or-card-collection-v3/OrCardCollection.vue.d.ts +0 -98
- package/dist/v2/components/or-card-collection-v3/index.d.ts +0 -3
- package/dist/v2/components/or-card-collection-v3/props.d.ts +0 -4
- package/dist/v2/components/or-card-collection-v3/styles.d.ts +0 -6
- package/dist/v2/components/or-card-collection-v3/types.d.ts +0 -7
- package/dist/v2/components/or-sort-header-v3/OrSortHeader.stories3.d.ts +0 -12
- package/dist/v2/components/or-sort-header-v3/OrSortHeader.vue.d.ts +0 -57
- package/dist/v2/components/or-sort-header-v3/index.d.ts +0 -2
- package/dist/v2/components/or-sort-header-v3/styles.d.ts +0 -1
- package/dist/v2/components/or-sort-header-v3/types.d.ts +0 -4
- package/dist/v2/index94.js +0 -3
- package/dist/v3/OrCardCollection-85a00f6c.js +0 -198
- package/dist/v3/OrSortHeader-5eba50cd.js +0 -104
- package/dist/v3/components/or-card-collection-v3/OrCardCollection.stories3.d.ts +0 -17
- package/dist/v3/components/or-card-collection-v3/OrCardCollection.vue.d.ts +0 -98
- package/dist/v3/components/or-card-collection-v3/index.d.ts +0 -3
- package/dist/v3/components/or-card-collection-v3/props.d.ts +0 -4
- package/dist/v3/components/or-card-collection-v3/styles.d.ts +0 -6
- package/dist/v3/components/or-card-collection-v3/types.d.ts +0 -7
- package/dist/v3/components/or-sort-header-v3/OrSortHeader.stories3.d.ts +0 -12
- package/dist/v3/components/or-sort-header-v3/OrSortHeader.vue.d.ts +0 -57
- package/dist/v3/components/or-sort-header-v3/index.d.ts +0 -2
- package/dist/v3/components/or-sort-header-v3/styles.d.ts +0 -1
- package/dist/v3/components/or-sort-header-v3/types.d.ts +0 -4
- package/dist/v3/index94.js +0 -3
- package/src/components/or-card-collection-v3/OrCardCollection.docs.mdx +0 -3
- package/src/components/or-card-collection-v3/OrCardCollection.stories3.ts +0 -162
- package/src/components/or-card-collection-v3/OrCardCollection.vue +0 -210
- package/src/components/or-card-collection-v3/index.ts +0 -3
- package/src/components/or-card-collection-v3/props.ts +0 -4
- package/src/components/or-card-collection-v3/styles.ts +0 -53
- package/src/components/or-card-collection-v3/types.ts +0 -8
- package/src/components/or-sort-header-v3/OrSortHeader.docs.mdx +0 -3
- package/src/components/or-sort-header-v3/OrSortHeader.stories3.ts +0 -132
- package/src/components/or-sort-header-v3/OrSortHeader.vue +0 -111
- package/src/components/or-sort-header-v3/index.ts +0 -2
- package/src/components/or-sort-header-v3/styles.ts +0 -23
- package/src/components/or-sort-header-v3/types.ts +0 -4
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
import { action } from '@storybook/addon-actions';
|
|
2
|
-
import { Meta, StoryFn } from '@storybook/vue3';
|
|
3
|
-
import { OrIconV3 as OrIcon } from '../or-icon-v3';
|
|
4
|
-
import OrCardCollectionDocs from './OrCardCollection.docs.mdx';
|
|
5
|
-
import OrCardCollection from './OrCardCollection.vue';
|
|
6
|
-
import { CardCollectionView } from './props';
|
|
7
|
-
import { CardCollectionItem, CardCollectionSortHeader } from './types';
|
|
8
|
-
|
|
9
|
-
export default {
|
|
10
|
-
title: 'Components/Card Collection',
|
|
11
|
-
component: OrCardCollection,
|
|
12
|
-
|
|
13
|
-
argTypes: {
|
|
14
|
-
// Slots
|
|
15
|
-
gridItem: {
|
|
16
|
-
type: {
|
|
17
|
-
name: 'string',
|
|
18
|
-
required: true,
|
|
19
|
-
},
|
|
20
|
-
|
|
21
|
-
control: { type: 'text' },
|
|
22
|
-
},
|
|
23
|
-
|
|
24
|
-
listItem: {
|
|
25
|
-
type: {
|
|
26
|
-
name: 'string',
|
|
27
|
-
required: true,
|
|
28
|
-
},
|
|
29
|
-
|
|
30
|
-
control: { type: 'text' },
|
|
31
|
-
},
|
|
32
|
-
|
|
33
|
-
// Props
|
|
34
|
-
items: {
|
|
35
|
-
control: { type: 'object' },
|
|
36
|
-
},
|
|
37
|
-
|
|
38
|
-
view: {
|
|
39
|
-
control: { type: 'select' },
|
|
40
|
-
options: Object.values(CardCollectionView),
|
|
41
|
-
},
|
|
42
|
-
|
|
43
|
-
sort: {
|
|
44
|
-
control: { type: 'object' },
|
|
45
|
-
},
|
|
46
|
-
|
|
47
|
-
sortHeaders: {
|
|
48
|
-
control: { type: 'object' },
|
|
49
|
-
},
|
|
50
|
-
|
|
51
|
-
search: {
|
|
52
|
-
control: { type: 'text' },
|
|
53
|
-
},
|
|
54
|
-
|
|
55
|
-
// Events
|
|
56
|
-
viewChange: {
|
|
57
|
-
table: { disable: true },
|
|
58
|
-
},
|
|
59
|
-
|
|
60
|
-
sortChange: {
|
|
61
|
-
table: { disable: true },
|
|
62
|
-
},
|
|
63
|
-
|
|
64
|
-
searchChange: {
|
|
65
|
-
table: { disable: true },
|
|
66
|
-
},
|
|
67
|
-
},
|
|
68
|
-
|
|
69
|
-
parameters: {
|
|
70
|
-
docs: {
|
|
71
|
-
page: OrCardCollectionDocs,
|
|
72
|
-
},
|
|
73
|
-
},
|
|
74
|
-
} as Meta<typeof OrCardCollection>;
|
|
75
|
-
|
|
76
|
-
const Template: StoryFn<typeof OrCardCollection> = (args) => ({
|
|
77
|
-
components: {
|
|
78
|
-
OrCardCollection,
|
|
79
|
-
OrIcon,
|
|
80
|
-
},
|
|
81
|
-
|
|
82
|
-
setup() {
|
|
83
|
-
return {
|
|
84
|
-
args,
|
|
85
|
-
onViewChange: action('viewChange'),
|
|
86
|
-
onSortChange: action('sortChange'),
|
|
87
|
-
onSearchChange: action('searchChange'),
|
|
88
|
-
};
|
|
89
|
-
},
|
|
90
|
-
|
|
91
|
-
template: `
|
|
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>
|
|
102
|
-
`,
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
export const Default = Template.bind({});
|
|
106
|
-
|
|
107
|
-
Default.args = {
|
|
108
|
-
// Slots
|
|
109
|
-
gridItem: '{{ item.label }} (grid)',
|
|
110
|
-
listItem: '{{ item.label }} (list)',
|
|
111
|
-
addon: '<OrIcon icon="info" />',
|
|
112
|
-
|
|
113
|
-
// Props
|
|
114
|
-
items: Array.from<string, CardCollectionItem>([
|
|
115
|
-
'Alfa',
|
|
116
|
-
'Bravo',
|
|
117
|
-
'Charlie',
|
|
118
|
-
'Delta',
|
|
119
|
-
'Echo',
|
|
120
|
-
'Foxtrot',
|
|
121
|
-
'Golf',
|
|
122
|
-
'Hotel',
|
|
123
|
-
'India',
|
|
124
|
-
'Juliett',
|
|
125
|
-
'Kilo',
|
|
126
|
-
'Lima',
|
|
127
|
-
'Mike',
|
|
128
|
-
'November',
|
|
129
|
-
'Oscar',
|
|
130
|
-
'Papa',
|
|
131
|
-
'Quebec',
|
|
132
|
-
'Romeo',
|
|
133
|
-
'Sierra',
|
|
134
|
-
'Tango',
|
|
135
|
-
'Uniform',
|
|
136
|
-
'Victor',
|
|
137
|
-
'Whiskey',
|
|
138
|
-
'X-Ray',
|
|
139
|
-
'Yankee',
|
|
140
|
-
'Zulu',
|
|
141
|
-
], (item) => ({
|
|
142
|
-
id: item.toLowerCase(),
|
|
143
|
-
label: item,
|
|
144
|
-
})),
|
|
145
|
-
};
|
|
146
|
-
|
|
147
|
-
export const WithSorting = Template.bind({});
|
|
148
|
-
|
|
149
|
-
WithSorting.args = {
|
|
150
|
-
...Default.args,
|
|
151
|
-
|
|
152
|
-
// Props
|
|
153
|
-
sortHeaders: Array.from<string, CardCollectionSortHeader>([
|
|
154
|
-
'Foo',
|
|
155
|
-
'Bar',
|
|
156
|
-
'Baz',
|
|
157
|
-
'Qux',
|
|
158
|
-
], (item) => ({
|
|
159
|
-
value: item.toLowerCase(),
|
|
160
|
-
label: item,
|
|
161
|
-
})),
|
|
162
|
-
};
|
|
@@ -1,210 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div
|
|
3
|
-
ref="root"
|
|
4
|
-
v-bind="$attrs"
|
|
5
|
-
:class="rootStyles"
|
|
6
|
-
>
|
|
7
|
-
<div :class="toolbarStyles">
|
|
8
|
-
<div :class="toolbarPanelStyles">
|
|
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
|
-
>
|
|
16
|
-
{{ header.label }}
|
|
17
|
-
</OrSortHeader>
|
|
18
|
-
</template>
|
|
19
|
-
</div>
|
|
20
|
-
|
|
21
|
-
<div :class="toolbarPanelStyles">
|
|
22
|
-
<OrInput
|
|
23
|
-
v-model="proxySearch"
|
|
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()"
|
|
37
|
-
/>
|
|
38
|
-
|
|
39
|
-
<slot name="addon" />
|
|
40
|
-
</div>
|
|
41
|
-
</div>
|
|
42
|
-
|
|
43
|
-
<div :class="contentStyles">
|
|
44
|
-
<template v-if="proxyView === 'grid'">
|
|
45
|
-
<OrCard
|
|
46
|
-
v-for="item in items"
|
|
47
|
-
:key="item.id"
|
|
48
|
-
>
|
|
49
|
-
<slot
|
|
50
|
-
name="gridItem"
|
|
51
|
-
v-bind="item"
|
|
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
|
-
>
|
|
61
|
-
<slot
|
|
62
|
-
name="listItem"
|
|
63
|
-
v-bind="item"
|
|
64
|
-
/>
|
|
65
|
-
</OrCard>
|
|
66
|
-
</template>
|
|
67
|
-
</div>
|
|
68
|
-
</div>
|
|
69
|
-
</template>
|
|
70
|
-
|
|
71
|
-
<script lang="ts">
|
|
72
|
-
import { computed, defineComponent, PropType, ref, watch } from 'vue-demi';
|
|
73
|
-
import { useClassAttribute } from '../../hooks';
|
|
74
|
-
import { OrCardV3 as OrCard } from '../or-card-v3';
|
|
75
|
-
import { OrIconButtonV3 as OrIconButton } from '../or-icon-button-v3';
|
|
76
|
-
import { OrInputV3 as OrInput } from '../or-input-v3';
|
|
77
|
-
import { OrSortHeaderV3 as OrSortHeader, SortHeaderModel } from '../or-sort-header-v3';
|
|
78
|
-
import { CardCollectionView } from './props';
|
|
79
|
-
import { CardCollectionContent, CardCollectionContentViews, CardCollectionRoot, CardCollectionToolbar, CardCollectionToolbarPanel } from './styles';
|
|
80
|
-
import { CardCollectionItem, CardCollectionSortHeader } from './types';
|
|
81
|
-
|
|
82
|
-
export default defineComponent({
|
|
83
|
-
name: 'OrCardCollection',
|
|
84
|
-
|
|
85
|
-
components: {
|
|
86
|
-
OrCard,
|
|
87
|
-
OrIconButton,
|
|
88
|
-
OrInput,
|
|
89
|
-
OrSortHeader,
|
|
90
|
-
},
|
|
91
|
-
|
|
92
|
-
inheritAttrs: false,
|
|
93
|
-
|
|
94
|
-
props: {
|
|
95
|
-
items: {
|
|
96
|
-
type: Array as PropType<CardCollectionItem[]>,
|
|
97
|
-
default: [] as CardCollectionItem[],
|
|
98
|
-
},
|
|
99
|
-
|
|
100
|
-
view: {
|
|
101
|
-
type: String as PropType<CardCollectionView>,
|
|
102
|
-
default: CardCollectionView.Grid,
|
|
103
|
-
},
|
|
104
|
-
|
|
105
|
-
sort: {
|
|
106
|
-
type: Object as PropType<SortHeaderModel>,
|
|
107
|
-
default: undefined,
|
|
108
|
-
},
|
|
109
|
-
|
|
110
|
-
sortHeaders: {
|
|
111
|
-
type: Array as PropType<CardCollectionSortHeader[]>,
|
|
112
|
-
default: undefined,
|
|
113
|
-
},
|
|
114
|
-
|
|
115
|
-
search: {
|
|
116
|
-
type: String,
|
|
117
|
-
default: undefined,
|
|
118
|
-
},
|
|
119
|
-
},
|
|
120
|
-
|
|
121
|
-
emits: [
|
|
122
|
-
'viewChange',
|
|
123
|
-
'sortChange',
|
|
124
|
-
'searchChange',
|
|
125
|
-
],
|
|
126
|
-
|
|
127
|
-
expose: [
|
|
128
|
-
'root',
|
|
129
|
-
],
|
|
130
|
-
|
|
131
|
-
setup(props, context) {
|
|
132
|
-
// Refs
|
|
133
|
-
const root = ref<HTMLElement>();
|
|
134
|
-
|
|
135
|
-
// Styles
|
|
136
|
-
const classAttribute = useClassAttribute();
|
|
137
|
-
|
|
138
|
-
const rootStyles = computed(() => [
|
|
139
|
-
'or-card-collection',
|
|
140
|
-
...CardCollectionRoot,
|
|
141
|
-
classAttribute.value,
|
|
142
|
-
]);
|
|
143
|
-
|
|
144
|
-
const toolbarStyles = computed(() => [
|
|
145
|
-
...CardCollectionToolbar,
|
|
146
|
-
]);
|
|
147
|
-
|
|
148
|
-
const toolbarPanelStyles = computed(() => [
|
|
149
|
-
...CardCollectionToolbarPanel,
|
|
150
|
-
]);
|
|
151
|
-
|
|
152
|
-
const contentStyles = computed(() => [
|
|
153
|
-
...CardCollectionContent,
|
|
154
|
-
...CardCollectionContentViews[proxyView.value],
|
|
155
|
-
]);
|
|
156
|
-
|
|
157
|
-
// State
|
|
158
|
-
const proxyView = ref(props.view);
|
|
159
|
-
const proxySort = ref(props.sort);
|
|
160
|
-
const proxySearch = ref(props.search);
|
|
161
|
-
|
|
162
|
-
// Methods
|
|
163
|
-
function switchToGridView(): void {
|
|
164
|
-
proxyView.value = CardCollectionView.Grid;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
function switchToListView(): void {
|
|
168
|
-
proxyView.value = CardCollectionView.List;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
// Effects
|
|
172
|
-
watch(() => props.view, (value) => {
|
|
173
|
-
proxyView.value = value;
|
|
174
|
-
});
|
|
175
|
-
|
|
176
|
-
watch(proxyView, (value) => {
|
|
177
|
-
context.emit('viewChange', value);
|
|
178
|
-
});
|
|
179
|
-
|
|
180
|
-
watch(() => props.sort, (value) => {
|
|
181
|
-
proxySort.value = value;
|
|
182
|
-
});
|
|
183
|
-
|
|
184
|
-
watch(proxySort, (value) => {
|
|
185
|
-
context.emit('sortChange', value);
|
|
186
|
-
});
|
|
187
|
-
|
|
188
|
-
watch(() => props.search, (value) => {
|
|
189
|
-
proxySearch.value = value;
|
|
190
|
-
});
|
|
191
|
-
|
|
192
|
-
watch(proxySearch, (value) => {
|
|
193
|
-
context.emit('searchChange', value);
|
|
194
|
-
});
|
|
195
|
-
|
|
196
|
-
return {
|
|
197
|
-
root,
|
|
198
|
-
rootStyles,
|
|
199
|
-
toolbarStyles,
|
|
200
|
-
toolbarPanelStyles,
|
|
201
|
-
contentStyles,
|
|
202
|
-
proxyView,
|
|
203
|
-
proxySort,
|
|
204
|
-
proxySearch,
|
|
205
|
-
switchToGridView,
|
|
206
|
-
switchToListView,
|
|
207
|
-
};
|
|
208
|
-
},
|
|
209
|
-
});
|
|
210
|
-
</script>
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { CardCollectionView } from './props';
|
|
2
|
-
|
|
3
|
-
export const CardCollectionRoot: string[] = [
|
|
4
|
-
// Layout
|
|
5
|
-
'flex flex-col',
|
|
6
|
-
|
|
7
|
-
// Spacing
|
|
8
|
-
'gap-md',
|
|
9
|
-
];
|
|
10
|
-
|
|
11
|
-
export const CardCollectionToolbar: string[] = [
|
|
12
|
-
// Layout
|
|
13
|
-
'flex',
|
|
14
|
-
'justify-between',
|
|
15
|
-
'items-center',
|
|
16
|
-
|
|
17
|
-
// Typography
|
|
18
|
-
'typography-body-2-regular',
|
|
19
|
-
|
|
20
|
-
// Theme
|
|
21
|
-
'theme-foreground-default',
|
|
22
|
-
'dark:theme-foreground-default-dark',
|
|
23
|
-
];
|
|
24
|
-
|
|
25
|
-
export const CardCollectionToolbarPanel: string[] = [
|
|
26
|
-
// Layout
|
|
27
|
-
'flex',
|
|
28
|
-
'justify-normal',
|
|
29
|
-
'items-center',
|
|
30
|
-
|
|
31
|
-
// Spacing
|
|
32
|
-
'gap-sm',
|
|
33
|
-
];
|
|
34
|
-
|
|
35
|
-
export const CardCollectionContent: string[] = [
|
|
36
|
-
// Layout
|
|
37
|
-
'grid',
|
|
38
|
-
|
|
39
|
-
// Spacing
|
|
40
|
-
'gap-sm md:gap-md',
|
|
41
|
-
];
|
|
42
|
-
|
|
43
|
-
export const CardCollectionContentViews: Record<CardCollectionView, string[]> = {
|
|
44
|
-
'grid': [
|
|
45
|
-
// Layout
|
|
46
|
-
'sm:grid-cols-1',
|
|
47
|
-
'md:grid-cols-2',
|
|
48
|
-
'lg:grid-cols-4',
|
|
49
|
-
'xl:grid-cols-6',
|
|
50
|
-
],
|
|
51
|
-
|
|
52
|
-
'list': [],
|
|
53
|
-
};
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
import { action } from '@storybook/addon-actions';
|
|
2
|
-
import { Meta, StoryFn } from '@storybook/vue3';
|
|
3
|
-
import { ref, watch } from 'vue-demi';
|
|
4
|
-
import OrSortHeaderDocs from './OrSortHeader.docs.mdx';
|
|
5
|
-
import OrSortHeader from './OrSortHeader.vue';
|
|
6
|
-
import { SortHeaderModel } from './types';
|
|
7
|
-
|
|
8
|
-
export default {
|
|
9
|
-
title: 'Components/Sort Header',
|
|
10
|
-
component: OrSortHeader,
|
|
11
|
-
|
|
12
|
-
argTypes: {
|
|
13
|
-
// Slots
|
|
14
|
-
default: {
|
|
15
|
-
type: {
|
|
16
|
-
name: 'string',
|
|
17
|
-
required: true,
|
|
18
|
-
},
|
|
19
|
-
|
|
20
|
-
control: { type: 'text' },
|
|
21
|
-
},
|
|
22
|
-
|
|
23
|
-
// Props
|
|
24
|
-
modelValue: {
|
|
25
|
-
control: { type: 'object' },
|
|
26
|
-
},
|
|
27
|
-
|
|
28
|
-
value: { // TODO: Remove Vue 2 fallback
|
|
29
|
-
control: { type: 'object' },
|
|
30
|
-
},
|
|
31
|
-
|
|
32
|
-
inputValue: { // TODO: Rename to `value` after complete migration to Vue 3
|
|
33
|
-
control: { type: 'text' },
|
|
34
|
-
},
|
|
35
|
-
|
|
36
|
-
// Events
|
|
37
|
-
'update:modelValue': {
|
|
38
|
-
table: { disable: true },
|
|
39
|
-
},
|
|
40
|
-
|
|
41
|
-
input: {
|
|
42
|
-
table: { disable: true },
|
|
43
|
-
},
|
|
44
|
-
|
|
45
|
-
focus: {
|
|
46
|
-
table: { disable: true },
|
|
47
|
-
},
|
|
48
|
-
|
|
49
|
-
blur: {
|
|
50
|
-
table: { disable: true },
|
|
51
|
-
},
|
|
52
|
-
},
|
|
53
|
-
|
|
54
|
-
parameters: {
|
|
55
|
-
layout: 'centered',
|
|
56
|
-
|
|
57
|
-
docs: {
|
|
58
|
-
page: OrSortHeaderDocs,
|
|
59
|
-
},
|
|
60
|
-
},
|
|
61
|
-
|
|
62
|
-
decorators: [
|
|
63
|
-
() => ({
|
|
64
|
-
template: `
|
|
65
|
-
<div class="flex flex-row gap-sm">
|
|
66
|
-
<story />
|
|
67
|
-
</div>
|
|
68
|
-
`,
|
|
69
|
-
}),
|
|
70
|
-
],
|
|
71
|
-
} as Meta<typeof OrSortHeader>;
|
|
72
|
-
|
|
73
|
-
const Template: StoryFn<typeof OrSortHeader> = (args) => ({
|
|
74
|
-
components: {
|
|
75
|
-
OrSortHeader,
|
|
76
|
-
},
|
|
77
|
-
|
|
78
|
-
setup() {
|
|
79
|
-
// State
|
|
80
|
-
const model = ref<SortHeaderModel>();
|
|
81
|
-
|
|
82
|
-
// Effects
|
|
83
|
-
watch(model, (value) => {
|
|
84
|
-
console.debug(value);
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
return {
|
|
88
|
-
args,
|
|
89
|
-
model,
|
|
90
|
-
onUpdateModelValue: action('update:modelValue'),
|
|
91
|
-
onInput: action('input'),
|
|
92
|
-
onFocus: action('focus'),
|
|
93
|
-
onBlur: action('blur'),
|
|
94
|
-
};
|
|
95
|
-
},
|
|
96
|
-
|
|
97
|
-
template: `
|
|
98
|
-
<div class="contents">
|
|
99
|
-
<OrSortHeader
|
|
100
|
-
v-model="model"
|
|
101
|
-
v-bind="args"
|
|
102
|
-
@update:modelValue="onUpdateModelValue"
|
|
103
|
-
@input="onInput"
|
|
104
|
-
@focus="onFocus"
|
|
105
|
-
@blur="onBlur"
|
|
106
|
-
>
|
|
107
|
-
${args.default}
|
|
108
|
-
</OrSortHeader>
|
|
109
|
-
|
|
110
|
-
<OrSortHeader
|
|
111
|
-
v-model="model"
|
|
112
|
-
input-value="column-2"
|
|
113
|
-
@update:modelValue="onUpdateModelValue"
|
|
114
|
-
@input="onInput"
|
|
115
|
-
@focus="onFocus"
|
|
116
|
-
@blur="onBlur"
|
|
117
|
-
>
|
|
118
|
-
Column 2
|
|
119
|
-
</OrSortHeader>
|
|
120
|
-
</div>
|
|
121
|
-
`,
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
export const Default = Template.bind({});
|
|
125
|
-
|
|
126
|
-
Default.args = {
|
|
127
|
-
// Slots
|
|
128
|
-
default: 'Column 1',
|
|
129
|
-
|
|
130
|
-
// Props
|
|
131
|
-
inputValue: 'column-1',
|
|
132
|
-
};
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div
|
|
3
|
-
ref="root"
|
|
4
|
-
v-bind="$attrs"
|
|
5
|
-
:class="rootStyles"
|
|
6
|
-
:activated="activated ? '' : null"
|
|
7
|
-
@click.stop="toggleDirection()"
|
|
8
|
-
>
|
|
9
|
-
<slot />
|
|
10
|
-
|
|
11
|
-
<template v-if="activated">
|
|
12
|
-
<OrIcon
|
|
13
|
-
:class="{ 'rotate-180': proxyModelValue.direction === 'asc' }"
|
|
14
|
-
:icon="'arrow_downward'"
|
|
15
|
-
/>
|
|
16
|
-
</template>
|
|
17
|
-
</div>
|
|
18
|
-
</template>
|
|
19
|
-
|
|
20
|
-
<script lang="ts">
|
|
21
|
-
import { computed, defineComponent, PropType, ref } from 'vue-demi';
|
|
22
|
-
import { useClassAttribute } from '../../hooks';
|
|
23
|
-
import { OrIconV3 as OrIcon } from '../or-icon-v3';
|
|
24
|
-
import { SortHeaderRoot } from './styles';
|
|
25
|
-
import { SortHeaderModel } from './types';
|
|
26
|
-
|
|
27
|
-
export default defineComponent({
|
|
28
|
-
name: 'OrSortHeader',
|
|
29
|
-
|
|
30
|
-
components: {
|
|
31
|
-
OrIcon,
|
|
32
|
-
},
|
|
33
|
-
|
|
34
|
-
inheritAttrs: false,
|
|
35
|
-
|
|
36
|
-
props: {
|
|
37
|
-
modelValue: {
|
|
38
|
-
type: Object as PropType<SortHeaderModel>,
|
|
39
|
-
default: undefined,
|
|
40
|
-
},
|
|
41
|
-
|
|
42
|
-
value: { // TODO: Remove Vue 2 fallback
|
|
43
|
-
type: Object as PropType<SortHeaderModel>,
|
|
44
|
-
default: undefined,
|
|
45
|
-
},
|
|
46
|
-
|
|
47
|
-
inputValue: { // TODO: Rename to `value` after complete migration to Vue 3
|
|
48
|
-
type: String,
|
|
49
|
-
required: true,
|
|
50
|
-
},
|
|
51
|
-
},
|
|
52
|
-
|
|
53
|
-
emits: [
|
|
54
|
-
'update:modelValue',
|
|
55
|
-
|
|
56
|
-
'input',
|
|
57
|
-
'focus',
|
|
58
|
-
'blur',
|
|
59
|
-
],
|
|
60
|
-
|
|
61
|
-
expose: [
|
|
62
|
-
'root',
|
|
63
|
-
],
|
|
64
|
-
|
|
65
|
-
setup(props, context) {
|
|
66
|
-
// Refs
|
|
67
|
-
const root = ref<HTMLElement>();
|
|
68
|
-
|
|
69
|
-
// Styles
|
|
70
|
-
const classAttribute = useClassAttribute();
|
|
71
|
-
|
|
72
|
-
const rootStyles = computed(() => [
|
|
73
|
-
'or-sort-header',
|
|
74
|
-
...SortHeaderRoot,
|
|
75
|
-
classAttribute.value,
|
|
76
|
-
]);
|
|
77
|
-
|
|
78
|
-
// State
|
|
79
|
-
const proxyModelValue = computed({
|
|
80
|
-
get: () => {
|
|
81
|
-
return props.modelValue ?? props.value; // TODO: Remove Vue 2 fallback
|
|
82
|
-
},
|
|
83
|
-
|
|
84
|
-
set: (value) => {
|
|
85
|
-
context.emit('input', value);
|
|
86
|
-
context.emit('update:modelValue', value);
|
|
87
|
-
},
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
const activated = computed(() => {
|
|
91
|
-
return proxyModelValue.value?.column === props.inputValue;
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
// Methods
|
|
95
|
-
function toggleDirection(): void {
|
|
96
|
-
proxyModelValue.value = {
|
|
97
|
-
column: props.inputValue,
|
|
98
|
-
direction: proxyModelValue.value?.direction === 'asc' ? 'desc' : 'asc',
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
return {
|
|
103
|
-
root,
|
|
104
|
-
rootStyles,
|
|
105
|
-
proxyModelValue,
|
|
106
|
-
activated,
|
|
107
|
-
toggleDirection,
|
|
108
|
-
};
|
|
109
|
-
},
|
|
110
|
-
});
|
|
111
|
-
</script>
|