@weni/unnnic-system 2.35.0 → 2.36.1-alpha.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/CHANGELOG.md +6 -0
- package/dist/{es-793d2c11.mjs → es-b5d4822f.mjs} +1 -1
- package/dist/{index-fb1305c3.mjs → index-5d4788dc.mjs} +7667 -7264
- package/dist/{pt-br-bef40aa7.mjs → pt-br-5e5317a5.mjs} +1 -1
- package/dist/style.css +1 -1
- package/dist/unnnic.mjs +1 -1
- package/dist/unnnic.umd.js +36 -36
- package/package.json +2 -2
- package/src/components/DataTable/index.vue +493 -0
- package/src/components/Dropdown/DropdownSkeleton.vue +8 -1
- package/src/components/Input/Input.vue +3 -3
- package/src/components/SelectTime/index.vue +220 -0
- package/src/components/index.js +6 -0
- package/src/stories/DataTable.stories.js +332 -0
- package/src/stories/SelectTime.stories.js +25 -0
- package/src/utils/hours.js +100 -0
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<section
|
|
3
|
+
v-onClickOutside="() => (active = false)"
|
|
4
|
+
class="unnnic-select-time"
|
|
5
|
+
>
|
|
6
|
+
<DropdownSkeleton
|
|
7
|
+
ref="dropdown-skeleton"
|
|
8
|
+
type="manual"
|
|
9
|
+
:modelValue="active"
|
|
10
|
+
position=""
|
|
11
|
+
useAbsolutePosition
|
|
12
|
+
>
|
|
13
|
+
<TextInput
|
|
14
|
+
:modelValue="modelValue"
|
|
15
|
+
:iconRight="active ? 'keyboard_arrow_up' : 'keyboard_arrow_down'"
|
|
16
|
+
nativeType="time"
|
|
17
|
+
:placeholder="placeholder"
|
|
18
|
+
:disabled="disabled"
|
|
19
|
+
class="unnnic-select-time__input"
|
|
20
|
+
@focus="active = true"
|
|
21
|
+
@blur="handleBlur"
|
|
22
|
+
@update:model-value="handleInput"
|
|
23
|
+
@keydown.enter="handleBlur({ close: true })"
|
|
24
|
+
/>
|
|
25
|
+
|
|
26
|
+
<template #inside="props">
|
|
27
|
+
<section
|
|
28
|
+
:style="{ width: props.width }"
|
|
29
|
+
class="unnnic-select-time__options"
|
|
30
|
+
>
|
|
31
|
+
<section
|
|
32
|
+
v-for="hour in options"
|
|
33
|
+
:ref="`hour-${hour.value}`"
|
|
34
|
+
:key="hour.value"
|
|
35
|
+
:class="{
|
|
36
|
+
'unnnic-select-time__options__item': true,
|
|
37
|
+
'unnnic-select-time__options__item--selected':
|
|
38
|
+
modelValue === hour.value,
|
|
39
|
+
}"
|
|
40
|
+
@click="handleClickTimeOption(hour.value)"
|
|
41
|
+
>
|
|
42
|
+
{{ hour.label }}
|
|
43
|
+
</section>
|
|
44
|
+
</section>
|
|
45
|
+
</template>
|
|
46
|
+
</DropdownSkeleton>
|
|
47
|
+
</section>
|
|
48
|
+
</template>
|
|
49
|
+
|
|
50
|
+
<script>
|
|
51
|
+
import { vOnClickOutside } from '@vueuse/components';
|
|
52
|
+
|
|
53
|
+
import DropdownSkeleton from '../Dropdown/DropdownSkeleton.vue';
|
|
54
|
+
import TextInput from '../Input/TextInput.vue';
|
|
55
|
+
|
|
56
|
+
import { hoursTimesOptions } from '../../utils/hours';
|
|
57
|
+
|
|
58
|
+
export default {
|
|
59
|
+
name: 'SelectTime',
|
|
60
|
+
components: {
|
|
61
|
+
DropdownSkeleton,
|
|
62
|
+
TextInput,
|
|
63
|
+
},
|
|
64
|
+
|
|
65
|
+
directives: {
|
|
66
|
+
onClickOutside: vOnClickOutside,
|
|
67
|
+
},
|
|
68
|
+
props: {
|
|
69
|
+
modelValue: {
|
|
70
|
+
type: String,
|
|
71
|
+
default: '',
|
|
72
|
+
},
|
|
73
|
+
options: {
|
|
74
|
+
type: Array,
|
|
75
|
+
default: () => hoursTimesOptions,
|
|
76
|
+
},
|
|
77
|
+
placeholder: {
|
|
78
|
+
type: String,
|
|
79
|
+
default: '',
|
|
80
|
+
},
|
|
81
|
+
disabled: {
|
|
82
|
+
type: Boolean,
|
|
83
|
+
default: false,
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
emits: ['update:modelValue'],
|
|
87
|
+
data() {
|
|
88
|
+
return {
|
|
89
|
+
active: false,
|
|
90
|
+
};
|
|
91
|
+
},
|
|
92
|
+
methods: {
|
|
93
|
+
handleInput(text) {
|
|
94
|
+
const { value } =
|
|
95
|
+
this.options.find((hour) => hour.value.includes(text)) || {};
|
|
96
|
+
|
|
97
|
+
if (value) {
|
|
98
|
+
const hourRef = this.$refs[`hour-${value}`][0];
|
|
99
|
+
if (hourRef) {
|
|
100
|
+
hourRef.scrollIntoView({ behavior: 'smooth' });
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
this.$emit('update:modelValue', text);
|
|
105
|
+
},
|
|
106
|
+
|
|
107
|
+
handleBlur({ close = false } = {}) {
|
|
108
|
+
if (this.modelValue) {
|
|
109
|
+
const cleanValue = this.modelValue.replace(/[^0-9]/g, '');
|
|
110
|
+
|
|
111
|
+
if (cleanValue.length > 0) {
|
|
112
|
+
let formattedTime = '';
|
|
113
|
+
|
|
114
|
+
if (cleanValue.length === 4) {
|
|
115
|
+
// Format: 0101 -> 01:01, 1310 -> 13:10
|
|
116
|
+
const hours = cleanValue.substring(0, 2);
|
|
117
|
+
const minutes = cleanValue.substring(2, 4);
|
|
118
|
+
|
|
119
|
+
if (parseInt(hours) <= 23 && parseInt(minutes) <= 59) {
|
|
120
|
+
formattedTime = `${hours}:${minutes}`;
|
|
121
|
+
}
|
|
122
|
+
} else if (cleanValue.length === 3) {
|
|
123
|
+
// Format: 123 -> 01:23
|
|
124
|
+
const hours = `0${cleanValue.substring(0, 1)}`;
|
|
125
|
+
const minutes = cleanValue.substring(1, 3);
|
|
126
|
+
|
|
127
|
+
if (parseInt(minutes) <= 59) {
|
|
128
|
+
formattedTime = `${hours}:${minutes}`;
|
|
129
|
+
}
|
|
130
|
+
} else if (cleanValue.length === 2) {
|
|
131
|
+
// Format: 12 -> 12:00
|
|
132
|
+
const hours = cleanValue;
|
|
133
|
+
formattedTime = `${hours}:00`;
|
|
134
|
+
} else if (cleanValue.length === 1) {
|
|
135
|
+
// Format: 1 -> 01:00
|
|
136
|
+
const hours = `0${cleanValue}`;
|
|
137
|
+
formattedTime = `${hours}:00`;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
this.$emit('update:modelValue', formattedTime);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
if (close) {
|
|
145
|
+
this.active = false;
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
handleClickTimeOption(value) {
|
|
149
|
+
this.$emit('update:modelValue', value);
|
|
150
|
+
this.active = false;
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
};
|
|
154
|
+
</script>
|
|
155
|
+
|
|
156
|
+
<style lang="scss" scoped>
|
|
157
|
+
@use '@/assets/scss/unnnic' as *;
|
|
158
|
+
|
|
159
|
+
:deep(.unnnic-select-time__input) {
|
|
160
|
+
&::-webkit-calendar-picker-indicator {
|
|
161
|
+
background: none;
|
|
162
|
+
display: none;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.unnnic-select-time {
|
|
167
|
+
&__options {
|
|
168
|
+
@function calc-max-height($value) {
|
|
169
|
+
@return ($value * $unnnic-font-size) - ($unnnic-spacing-xs * 2);
|
|
170
|
+
}
|
|
171
|
+
margin-top: $unnnic-spacing-nano;
|
|
172
|
+
border-radius: $unnnic-border-radius-sm;
|
|
173
|
+
box-shadow: $unnnic-shadow-level-near;
|
|
174
|
+
background-color: $unnnic-color-background-snow;
|
|
175
|
+
cursor: pointer;
|
|
176
|
+
display: grid;
|
|
177
|
+
max-height: calc-max-height(9.25);
|
|
178
|
+
overflow-y: auto;
|
|
179
|
+
|
|
180
|
+
&__item {
|
|
181
|
+
margin: 0px $unnnic-spacing-nano;
|
|
182
|
+
background-color: $unnnic-color-background-snow;
|
|
183
|
+
padding: $unnnic-spacing-stack-nano $unnnic-inline-xs;
|
|
184
|
+
max-width: 100%;
|
|
185
|
+
font-family: $unnnic-font-family-secondary;
|
|
186
|
+
color: $unnnic-color-neutral-darkest;
|
|
187
|
+
font-weight: $unnnic-font-weight-regular;
|
|
188
|
+
|
|
189
|
+
white-space: nowrap;
|
|
190
|
+
text-overflow: ellipsis;
|
|
191
|
+
overflow: hidden;
|
|
192
|
+
-webkit-line-clamp: 1;
|
|
193
|
+
|
|
194
|
+
&:hover {
|
|
195
|
+
border-radius: $unnnic-border-radius-sm;
|
|
196
|
+
background-color: $unnnic-color-neutral-light;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
&--selected {
|
|
200
|
+
color: $unnnic-color-weni-600;
|
|
201
|
+
font-weight: $unnnic-font-weight-bold;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
&::-webkit-scrollbar {
|
|
206
|
+
width: $unnnic-spacing-inline-nano;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
&::-webkit-scrollbar-thumb {
|
|
210
|
+
background: $unnnic-color-neutral-cleanest;
|
|
211
|
+
border-radius: $unnnic-border-radius-pill;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
&::-webkit-scrollbar-track {
|
|
215
|
+
background: $unnnic-color-neutral-soft;
|
|
216
|
+
border-radius: $unnnic-border-radius-pill;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
</style>
|
package/src/components/index.js
CHANGED
|
@@ -86,6 +86,8 @@ import ModalNext from './ModalNext/ModalNext.vue';
|
|
|
86
86
|
import ModalDialog from './ModalDialog/ModalDialog.vue';
|
|
87
87
|
import Tour from './Tour/Tour.vue';
|
|
88
88
|
import Navigator from './Navigator/index.vue';
|
|
89
|
+
import SelectTime from './SelectTime/index.vue';
|
|
90
|
+
import DataTable from './DataTable/index.vue';
|
|
89
91
|
|
|
90
92
|
export const components = {
|
|
91
93
|
unnnicFormElement: formElement,
|
|
@@ -177,6 +179,8 @@ export const components = {
|
|
|
177
179
|
unnnicTableNext: TableNext,
|
|
178
180
|
unnnicTour: Tour,
|
|
179
181
|
unnnicNavigator: Navigator,
|
|
182
|
+
unnnicSelectTime: SelectTime,
|
|
183
|
+
unnnicDataTable: DataTable,
|
|
180
184
|
};
|
|
181
185
|
|
|
182
186
|
export const unnnicFontSize = fontSize;
|
|
@@ -269,3 +273,5 @@ export const unnnicDrawer = Drawer;
|
|
|
269
273
|
export const unnnicTableNext = TableNext;
|
|
270
274
|
export const unnnicTour = Tour;
|
|
271
275
|
export const unnnicNavigator = Navigator;
|
|
276
|
+
export const unnnicSelectTime = SelectTime;
|
|
277
|
+
export const unnnicDataTable = DataTable;
|
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
import UnnnicDataTable from '../components/DataTable/index.vue';
|
|
2
|
+
import { action } from '@storybook/addon-actions';
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: 'Data Display/DataTable',
|
|
6
|
+
component: UnnnicDataTable,
|
|
7
|
+
tags: ['autodocs'],
|
|
8
|
+
args: {
|
|
9
|
+
page: 1,
|
|
10
|
+
},
|
|
11
|
+
argTypes: {
|
|
12
|
+
headers: {
|
|
13
|
+
description:
|
|
14
|
+
'Array of header items defining the structure of the table header.',
|
|
15
|
+
control: 'object',
|
|
16
|
+
},
|
|
17
|
+
items: {
|
|
18
|
+
description: 'Array of row items defining the content of the table rows.',
|
|
19
|
+
control: 'object',
|
|
20
|
+
},
|
|
21
|
+
size: {
|
|
22
|
+
description:
|
|
23
|
+
'The size of the table. Options are `sm` for small and `md` for medium.',
|
|
24
|
+
control: { type: 'select' },
|
|
25
|
+
options: ['sm', 'md'],
|
|
26
|
+
},
|
|
27
|
+
page: {
|
|
28
|
+
description: 'The current page number for pagination.',
|
|
29
|
+
control: 'number',
|
|
30
|
+
},
|
|
31
|
+
pageTotal: {
|
|
32
|
+
description: 'The total number of pages available for pagination.',
|
|
33
|
+
control: 'number',
|
|
34
|
+
},
|
|
35
|
+
pageInterval: {
|
|
36
|
+
description: 'The number of items displayed per page.',
|
|
37
|
+
control: 'number',
|
|
38
|
+
},
|
|
39
|
+
isLoading: {
|
|
40
|
+
description: 'Indicates whether the table data is loading.',
|
|
41
|
+
control: 'boolean',
|
|
42
|
+
},
|
|
43
|
+
hideHeaders: {
|
|
44
|
+
description: 'Determines if the table headers should be hidden.',
|
|
45
|
+
control: 'boolean',
|
|
46
|
+
},
|
|
47
|
+
height: {
|
|
48
|
+
description: 'The height of the table.',
|
|
49
|
+
control: 'text',
|
|
50
|
+
},
|
|
51
|
+
maxHeight: {
|
|
52
|
+
description: 'The maximum height of the table.',
|
|
53
|
+
control: 'text',
|
|
54
|
+
},
|
|
55
|
+
clickable: {
|
|
56
|
+
description: 'Indicates whether the table rows should be clickable.',
|
|
57
|
+
control: 'boolean',
|
|
58
|
+
},
|
|
59
|
+
fixedHeaders: {
|
|
60
|
+
description:
|
|
61
|
+
'Indicates whether the table headers should be fixed in scroll.',
|
|
62
|
+
control: 'boolean',
|
|
63
|
+
},
|
|
64
|
+
hidePagination: {
|
|
65
|
+
description: 'Indicates whether the pagination should be hidden.',
|
|
66
|
+
control: 'boolean',
|
|
67
|
+
},
|
|
68
|
+
locale: {
|
|
69
|
+
description: 'The locale for the table translations.',
|
|
70
|
+
control: { type: 'select' },
|
|
71
|
+
options: ['en', 'pt-br', 'es'],
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
render: (args) => ({
|
|
75
|
+
components: {
|
|
76
|
+
UnnnicDataTable,
|
|
77
|
+
},
|
|
78
|
+
setup() {
|
|
79
|
+
const sort = ({ order, header }) => {
|
|
80
|
+
action('update:sort')({ order, header });
|
|
81
|
+
if (order === 'asc')
|
|
82
|
+
args.items = args.items.sort((a, b) => a.id - b.id);
|
|
83
|
+
if (order === 'desc')
|
|
84
|
+
args.items = args.items.sort((a, b) => b.id - a.id);
|
|
85
|
+
};
|
|
86
|
+
const updatePage = (page) => {
|
|
87
|
+
action('update:page')(page);
|
|
88
|
+
args.page = page;
|
|
89
|
+
};
|
|
90
|
+
const itemClick = (item) => {
|
|
91
|
+
action('itemClick')(item);
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
return { args, sort, updatePage, itemClick };
|
|
95
|
+
},
|
|
96
|
+
template: `
|
|
97
|
+
<UnnnicDataTable
|
|
98
|
+
v-bind="args"
|
|
99
|
+
:headers="args.headers"
|
|
100
|
+
:items="args.items"
|
|
101
|
+
:pageTotal="125"
|
|
102
|
+
:pageInterval="5"
|
|
103
|
+
@update:sort="sort"
|
|
104
|
+
@update:page="updatePage"
|
|
105
|
+
@itemClick="itemClick"
|
|
106
|
+
>
|
|
107
|
+
</UnnnicDataTable>
|
|
108
|
+
`,
|
|
109
|
+
}),
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
const headers = [
|
|
113
|
+
{
|
|
114
|
+
title: 'ID',
|
|
115
|
+
itemKey: 'id',
|
|
116
|
+
isSortable: true,
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
title: 'Name',
|
|
120
|
+
itemKey: 'name',
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
title: 'Age',
|
|
124
|
+
itemKey: 'age',
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
title: 'Country',
|
|
128
|
+
itemKey: 'country',
|
|
129
|
+
},
|
|
130
|
+
];
|
|
131
|
+
|
|
132
|
+
const items = [
|
|
133
|
+
{
|
|
134
|
+
id: '1',
|
|
135
|
+
name: 'Eduardo',
|
|
136
|
+
age: 27,
|
|
137
|
+
country: 'Brazil',
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
id: '2',
|
|
141
|
+
name: 'Marcus',
|
|
142
|
+
age: 27,
|
|
143
|
+
country: 'Brazil',
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
id: '3',
|
|
147
|
+
name: 'Paulo',
|
|
148
|
+
age: 29,
|
|
149
|
+
country: 'Brazil',
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
id: '4',
|
|
153
|
+
name: 'Cristian',
|
|
154
|
+
age: 27,
|
|
155
|
+
country: 'Brazil',
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
id: '5',
|
|
159
|
+
name: 'Aldemylla',
|
|
160
|
+
age: 27,
|
|
161
|
+
country: 'Brazil',
|
|
162
|
+
},
|
|
163
|
+
];
|
|
164
|
+
|
|
165
|
+
export const Default = {
|
|
166
|
+
args: {
|
|
167
|
+
headers,
|
|
168
|
+
items,
|
|
169
|
+
},
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
export const Clickable = {
|
|
173
|
+
args: {
|
|
174
|
+
headers,
|
|
175
|
+
items,
|
|
176
|
+
clickable: true,
|
|
177
|
+
},
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
export const WithHeightLimit = {
|
|
181
|
+
args: {
|
|
182
|
+
headers,
|
|
183
|
+
items,
|
|
184
|
+
height: '165px',
|
|
185
|
+
},
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
export const FixedHeaders = {
|
|
189
|
+
args: {
|
|
190
|
+
headers,
|
|
191
|
+
items,
|
|
192
|
+
fixedHeaders: true,
|
|
193
|
+
height: '165px',
|
|
194
|
+
},
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
export const Medium = {
|
|
198
|
+
args: {
|
|
199
|
+
headers,
|
|
200
|
+
items,
|
|
201
|
+
size: 'md',
|
|
202
|
+
},
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
export const Small = {
|
|
206
|
+
args: {
|
|
207
|
+
headers,
|
|
208
|
+
items,
|
|
209
|
+
size: 'sm',
|
|
210
|
+
},
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
export const HideHeaders = {
|
|
214
|
+
args: {
|
|
215
|
+
headers,
|
|
216
|
+
items,
|
|
217
|
+
hideHeaders: true,
|
|
218
|
+
},
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
export const SlotHeader = {
|
|
222
|
+
args: { headers, items },
|
|
223
|
+
render: (args) => ({
|
|
224
|
+
components: {
|
|
225
|
+
UnnnicDataTable,
|
|
226
|
+
},
|
|
227
|
+
setup() {
|
|
228
|
+
const sort = ({ order, header }) => {
|
|
229
|
+
action('update:sort')({ order, header });
|
|
230
|
+
if (order === 'asc')
|
|
231
|
+
args.items = args.items.sort((a, b) => a.id - b.id);
|
|
232
|
+
if (order === 'desc')
|
|
233
|
+
args.items = args.items.sort((a, b) => b.id - a.id);
|
|
234
|
+
};
|
|
235
|
+
const updatePage = (page) => {
|
|
236
|
+
action('update:page')(page);
|
|
237
|
+
args.page = page;
|
|
238
|
+
};
|
|
239
|
+
const itemClick = (item) => {
|
|
240
|
+
action('itemClick')(item);
|
|
241
|
+
};
|
|
242
|
+
|
|
243
|
+
return { args, sort, updatePage, itemClick };
|
|
244
|
+
},
|
|
245
|
+
template: `
|
|
246
|
+
<UnnnicDataTable
|
|
247
|
+
v-bind="args"
|
|
248
|
+
:headers="args.headers"
|
|
249
|
+
:items="args.items"
|
|
250
|
+
:pageTotal="125"
|
|
251
|
+
:pageInterval="5"
|
|
252
|
+
@update:sort="sort"
|
|
253
|
+
@update:page="updatePage"
|
|
254
|
+
@itemClick="itemClick"
|
|
255
|
+
>
|
|
256
|
+
<template #header-name="{ header }">
|
|
257
|
+
<button>
|
|
258
|
+
{{ header.title }}
|
|
259
|
+
</button>
|
|
260
|
+
</template>
|
|
261
|
+
</UnnnicDataTable>
|
|
262
|
+
`,
|
|
263
|
+
}),
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
export const SlotItem = {
|
|
267
|
+
args: { headers, items },
|
|
268
|
+
render: (args) => ({
|
|
269
|
+
components: {
|
|
270
|
+
UnnnicDataTable,
|
|
271
|
+
},
|
|
272
|
+
setup() {
|
|
273
|
+
const sort = ({ order, header }) => {
|
|
274
|
+
action('update:sort')({ order, header });
|
|
275
|
+
if (order === 'asc')
|
|
276
|
+
args.items = args.items.sort((a, b) => a.id - b.id);
|
|
277
|
+
if (order === 'desc')
|
|
278
|
+
args.items = args.items.sort((a, b) => b.id - a.id);
|
|
279
|
+
};
|
|
280
|
+
const updatePage = (page) => {
|
|
281
|
+
action('update:page')(page);
|
|
282
|
+
args.page = page;
|
|
283
|
+
};
|
|
284
|
+
const itemClick = (item) => {
|
|
285
|
+
action('itemClick')(item);
|
|
286
|
+
};
|
|
287
|
+
|
|
288
|
+
return { args, sort, updatePage, itemClick };
|
|
289
|
+
},
|
|
290
|
+
template: `
|
|
291
|
+
<UnnnicDataTable
|
|
292
|
+
v-bind="args"
|
|
293
|
+
:headers="args.headers"
|
|
294
|
+
:items="args.items"
|
|
295
|
+
:pageTotal="125"
|
|
296
|
+
:pageInterval="5"
|
|
297
|
+
@update:sort="sort"
|
|
298
|
+
@update:page="updatePage"
|
|
299
|
+
@itemClick="itemClick"
|
|
300
|
+
>
|
|
301
|
+
<template #body-id="{ item }">
|
|
302
|
+
<button>
|
|
303
|
+
{{ item.id }}
|
|
304
|
+
</button>
|
|
305
|
+
</template>
|
|
306
|
+
</UnnnicDataTable>
|
|
307
|
+
`,
|
|
308
|
+
}),
|
|
309
|
+
};
|
|
310
|
+
|
|
311
|
+
export const HidePagination = {
|
|
312
|
+
args: {
|
|
313
|
+
headers,
|
|
314
|
+
items,
|
|
315
|
+
hidePagination: true,
|
|
316
|
+
},
|
|
317
|
+
};
|
|
318
|
+
|
|
319
|
+
export const WithoutResults = {
|
|
320
|
+
args: {
|
|
321
|
+
headers,
|
|
322
|
+
items: [],
|
|
323
|
+
},
|
|
324
|
+
};
|
|
325
|
+
|
|
326
|
+
export const Loading = {
|
|
327
|
+
args: {
|
|
328
|
+
headers,
|
|
329
|
+
items,
|
|
330
|
+
isLoading: true,
|
|
331
|
+
},
|
|
332
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import unnnicSelectTime from '../components/SelectTime/index.vue';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: 'Select/SelectTime',
|
|
5
|
+
component: unnnicSelectTime,
|
|
6
|
+
argTypes: {},
|
|
7
|
+
render: (args) => ({
|
|
8
|
+
components: {
|
|
9
|
+
unnnicSelectTime,
|
|
10
|
+
},
|
|
11
|
+
setup() {
|
|
12
|
+
return { args };
|
|
13
|
+
},
|
|
14
|
+
data() {
|
|
15
|
+
return {
|
|
16
|
+
exampleValue: '',
|
|
17
|
+
};
|
|
18
|
+
},
|
|
19
|
+
template: `
|
|
20
|
+
<unnnicSelectTime v-bind="args" v-model="exampleValue" />
|
|
21
|
+
`,
|
|
22
|
+
}),
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export const Default = {};
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
const hoursTimesOptions = [
|
|
2
|
+
{
|
|
3
|
+
label: '00:00',
|
|
4
|
+
value: '00:00',
|
|
5
|
+
},
|
|
6
|
+
{
|
|
7
|
+
label: '01:00',
|
|
8
|
+
value: '01:00',
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
label: '02:00',
|
|
12
|
+
value: '02:00',
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
label: '03:00',
|
|
16
|
+
value: '03:00',
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
label: '04:00',
|
|
20
|
+
value: '04:00',
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
label: '05:00',
|
|
24
|
+
value: '05:00',
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
label: '06:00',
|
|
28
|
+
value: '06:00',
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
label: '07:00',
|
|
32
|
+
value: '07:00',
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
label: '08:00',
|
|
36
|
+
value: '08:00',
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
label: '09:00',
|
|
40
|
+
value: '09:00',
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
label: '10:00',
|
|
44
|
+
value: '10:00',
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
label: '11:00',
|
|
48
|
+
value: '11:00',
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
label: '12:00',
|
|
52
|
+
value: '12:00',
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
label: '13:00',
|
|
56
|
+
value: '13:00',
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
label: '14:00',
|
|
60
|
+
value: '14:00',
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
label: '15:00',
|
|
64
|
+
value: '15:00',
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
label: '16:00',
|
|
68
|
+
value: '16:00',
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
label: '17:00',
|
|
72
|
+
value: '17:00',
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
label: '18:00',
|
|
76
|
+
value: '18:00',
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
label: '19:00',
|
|
80
|
+
value: '19:00',
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
label: '20:00',
|
|
84
|
+
value: '20:00',
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
label: '21:00',
|
|
88
|
+
value: '21:00',
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
label: '22:00',
|
|
92
|
+
value: '22:00',
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
label: '23:00',
|
|
96
|
+
value: '23:00',
|
|
97
|
+
},
|
|
98
|
+
];
|
|
99
|
+
|
|
100
|
+
export { hoursTimesOptions };
|