@webitel/ui-sdk 3.1.35 → 3.1.37
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/ui-sdk.common.js +55 -198
- package/dist/ui-sdk.common.js.map +1 -1
- package/dist/ui-sdk.css +1 -1
- package/dist/ui-sdk.umd.js +55 -198
- package/dist/ui-sdk.umd.js.map +1 -1
- package/dist/ui-sdk.umd.min.js +8 -8
- package/dist/ui-sdk.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/src/components/index.js +0 -2
- package/src/components/molecules/wt-datepicker/wt-datepicker.vue +106 -39
- package/src/css/components/molecules/wt-datepicker/_variables.scss +52 -17
- package/src/locale/i18n.js +1 -0
- package/src/modules/QueryFilters/components/filter-datetime.vue +3 -2
- package/src/components/molecules/wt-datetimepicker/__tests__/WtDatetimepicker.spec.js +0 -82
- package/src/components/molecules/wt-datetimepicker/wt-datetimepicker.vue +0 -300
package/package.json
CHANGED
package/src/components/index.js
CHANGED
|
@@ -14,7 +14,6 @@ import WtContextMenu from './atoms/wt-context-menu/wt-context-menu.vue';
|
|
|
14
14
|
|
|
15
15
|
import WtCheckbox from './molecules/wt-checkbox/wt-checkbox.vue';
|
|
16
16
|
import WtDatepicker from './molecules/wt-datepicker/wt-datepicker.vue';
|
|
17
|
-
import WtDatetimepicker from './molecules/wt-datetimepicker/wt-datetimepicker.vue';
|
|
18
17
|
import WtIconBtn from './molecules/wt-icon-btn/wt-icon-btn.vue';
|
|
19
18
|
import WtInput from './molecules/wt-input/wt-input.vue';
|
|
20
19
|
import WtNotification from './molecules/wt-notification/wt-notification.vue';
|
|
@@ -70,7 +69,6 @@ const Components = {
|
|
|
70
69
|
WtRoundedAction,
|
|
71
70
|
WtCheckbox,
|
|
72
71
|
WtDatepicker,
|
|
73
|
-
WtDatetimepicker,
|
|
74
72
|
WtIconBtn,
|
|
75
73
|
WtInput,
|
|
76
74
|
WtHint,
|
|
@@ -11,13 +11,15 @@
|
|
|
11
11
|
</wt-label>
|
|
12
12
|
<vue-datepicker
|
|
13
13
|
ref="datepicker"
|
|
14
|
+
:locale="locale"
|
|
14
15
|
:model-value="+value"
|
|
15
16
|
:placeholder="label || placeholder"
|
|
16
17
|
class="wt-datepicker__datepicker"
|
|
17
18
|
v-bind="{ ...$attrs, ...$props }"
|
|
19
|
+
:format="isDateTime ? 'dd/MM/yyyy HH:mm' : 'dd/MM/yyyy'"
|
|
18
20
|
@closed="isOpened = false"
|
|
19
21
|
@open="isOpened = true"
|
|
20
|
-
@update:model-value="emit('
|
|
22
|
+
@update:model-value="emit('input', $event.getTime())"
|
|
21
23
|
>
|
|
22
24
|
<template v-slot:input-icon>
|
|
23
25
|
<wt-icon
|
|
@@ -43,13 +45,34 @@
|
|
|
43
45
|
icon="arrow-right"
|
|
44
46
|
></wt-icon-btn>
|
|
45
47
|
</template>
|
|
48
|
+
<template
|
|
49
|
+
v-if="isDateTime"
|
|
50
|
+
v-slot:time-picker="{ time, updateTime }"
|
|
51
|
+
>
|
|
52
|
+
<div class="datepicker__timepicker">
|
|
53
|
+
<wt-time-input
|
|
54
|
+
:label="$t('webitelUI.timepicker.hour')"
|
|
55
|
+
:value="time.hours"
|
|
56
|
+
max-value="23"
|
|
57
|
+
@input="updateTime"
|
|
58
|
+
></wt-time-input>
|
|
59
|
+
<wt-time-input
|
|
60
|
+
:label="$t('webitelUI.timepicker.min')"
|
|
61
|
+
:value="time.minutes"
|
|
62
|
+
max-value="59"
|
|
63
|
+
@input="updateTime($event, false)"
|
|
64
|
+
></wt-time-input>
|
|
65
|
+
</div>
|
|
66
|
+
</template>
|
|
46
67
|
<template v-slot:action-select>
|
|
47
68
|
<wt-button
|
|
69
|
+
wide
|
|
48
70
|
@click="datepicker.selectDate()"
|
|
49
71
|
>{{ $t('reusable.ok') }}
|
|
50
72
|
</wt-button>
|
|
51
73
|
<wt-button
|
|
52
74
|
color="secondary"
|
|
75
|
+
wide
|
|
53
76
|
@click="datepicker.closeMenu()"
|
|
54
77
|
>{{ $t('reusable.cancel') }}
|
|
55
78
|
</wt-button>
|
|
@@ -61,9 +84,15 @@
|
|
|
61
84
|
<script setup>
|
|
62
85
|
import VueDatepicker from '@vuepic/vue-datepicker';
|
|
63
86
|
import '@vuepic/vue-datepicker/dist/main.css';
|
|
64
|
-
import { ref } from 'vue';
|
|
87
|
+
import { computed, ref } from 'vue';
|
|
88
|
+
// import { useI18n } from 'vue-i18n';
|
|
65
89
|
|
|
66
90
|
const props = defineProps({
|
|
91
|
+
mode: {
|
|
92
|
+
type: String,
|
|
93
|
+
default: 'date',
|
|
94
|
+
options: ['date', 'datetime'],
|
|
95
|
+
},
|
|
67
96
|
value: {
|
|
68
97
|
type: [String, Number],
|
|
69
98
|
default: 'Date.now()',
|
|
@@ -95,60 +124,98 @@ const props = defineProps({
|
|
|
95
124
|
description: 'Object with props, passed down to wt-label as props',
|
|
96
125
|
},
|
|
97
126
|
});
|
|
98
|
-
const emit = defineEmits(['
|
|
127
|
+
const emit = defineEmits(['input']);
|
|
128
|
+
|
|
129
|
+
// const i18n = useI18n();
|
|
99
130
|
|
|
100
131
|
const isOpened = ref(false);
|
|
101
132
|
const datepicker = ref(null); // template ref
|
|
133
|
+
|
|
134
|
+
const locale = computed(() => {
|
|
135
|
+
const { locale } = { locale: 'ua' };
|
|
136
|
+
if (locale === 'ua') return 'uk';
|
|
137
|
+
return locale;
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
const isDateTime = props.mode === 'datetime';
|
|
102
141
|
</script>
|
|
103
142
|
|
|
104
|
-
<style lang="scss">
|
|
105
|
-
:
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
--dp-input-icon-padding: 24px; /*Padding on the left side of the input if icon is present*/
|
|
120
|
-
--dp-input-padding: 6px 30px 6px 12px; /*Padding in the input*/
|
|
121
|
-
--dp-menu-min-width: 260px; /*Adjust the min width of the menu*/
|
|
122
|
-
--dp-action-buttons-padding: 2px 5px; /*Adjust padding for the action buttons in action row*/
|
|
123
|
-
--dp-row-maring: 5px 0; /*Adjust the spacing between rows in the calendar*/
|
|
124
|
-
--dp-calendar-header-cell-padding: 0.5rem; /*Adjust padding in calendar header cells*/
|
|
125
|
-
--dp-two-calendars-spacing: 10px; /*Space between multiple calendars*/
|
|
126
|
-
--dp-overlay-col-padding: 3px; /*Padding in the overlay column*/
|
|
127
|
-
--dp-time-inc-dec-button-size: 32px; /*Sizing for arrow buttons in the time picker*/
|
|
128
|
-
|
|
129
|
-
/*Font sizes*/
|
|
130
|
-
--dp-font-size: 14px; /*Default font-size*/
|
|
131
|
-
--dp-preview-font-size: 12px; /*Font size of the date preview in the action row*/
|
|
132
|
-
--dp-time-font-size: 12px; /*Font size in the time picker*/
|
|
133
|
-
|
|
134
|
-
/*Transitions*/
|
|
135
|
-
--dp-animation-duration: var(--transition); /*Transition duration*/
|
|
136
|
-
--dp-menu-appear-transition-timing: cubic-bezier(.4, 0, 1, 1); /*Timing on menu appear animation*/
|
|
137
|
-
--dp-transition-timing: ease-out; /*Timing on slide animations*/
|
|
138
|
-
}
|
|
143
|
+
<style lang="scss" scoped>
|
|
144
|
+
.wt-datepicker :deep(.dp__main) {
|
|
145
|
+
.dp__input_icon {
|
|
146
|
+
left: var(--spacing-xs);
|
|
147
|
+
line-height: 0;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.dp__clear_icon {
|
|
151
|
+
right: var(--spacing-xs);
|
|
152
|
+
line-height: 0;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.dp__input {
|
|
156
|
+
line-height: 24px;
|
|
157
|
+
}
|
|
139
158
|
|
|
140
|
-
.wt-datepicker {
|
|
141
159
|
.dp__arrow_top {
|
|
142
160
|
display: none;
|
|
143
161
|
}
|
|
144
162
|
|
|
163
|
+
/*
|
|
164
|
+
don't know why but month or year selection doesn't work
|
|
165
|
+
suppose its related to compatibility build
|
|
166
|
+
*/
|
|
167
|
+
.dp__month_year_wrap {
|
|
168
|
+
pointer-events: none;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// reset right/left arrow hover
|
|
172
|
+
.dp__inner_nav:hover {
|
|
173
|
+
background: inherit;
|
|
174
|
+
}
|
|
175
|
+
|
|
145
176
|
.dp__menu {
|
|
146
177
|
border-radius: var(--border-radius);
|
|
178
|
+
box-shadow: var(--elevation-10);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.dp__calendar_header_separator {
|
|
182
|
+
background: var(--secondary-color);
|
|
147
183
|
}
|
|
148
184
|
|
|
149
185
|
.dp__calendar_header,
|
|
150
186
|
.dp__calendar_row {
|
|
151
187
|
gap: var(--spacing-xs);
|
|
152
188
|
}
|
|
189
|
+
|
|
190
|
+
// switch to time view
|
|
191
|
+
.dp__button {
|
|
192
|
+
display: none;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.dp__action_row {
|
|
196
|
+
flex-direction: column;
|
|
197
|
+
gap: var(--spacing-xs);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
.dp__selection_preview,
|
|
201
|
+
.dp__action_buttons {
|
|
202
|
+
width: 100%;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
.dp__selection_preview {
|
|
206
|
+
text-align: center;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
.dp__action_buttons {
|
|
210
|
+
display: flex;
|
|
211
|
+
gap: var(--spacing-xs);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
.datepicker__timepicker {
|
|
216
|
+
display: flex;
|
|
217
|
+
align-items: center;
|
|
218
|
+
justify-content: center;
|
|
219
|
+
gap: var(--spacing-xs);
|
|
153
220
|
}
|
|
154
221
|
</style>
|
|
@@ -1,21 +1,56 @@
|
|
|
1
|
-
|
|
2
1
|
:root {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
--
|
|
11
|
-
--
|
|
2
|
+
/*General*/
|
|
3
|
+
--dp-font-family: 'Montserrat';
|
|
4
|
+
--dp-border-radius: var(--border-radius); /*Configurable border-radius*/
|
|
5
|
+
--dp-cell-border-radius: var(--border-radius); /*Specific border radius for the calendar cell*/
|
|
6
|
+
|
|
7
|
+
/*Sizing*/
|
|
8
|
+
--dp-button-heigh: 32px; /*Size for buttons in overlays*/
|
|
9
|
+
--dp-month-year-row-height: 32px; /*Height of the month-year select row*/
|
|
10
|
+
--dp-month-year-row-button-size: 32px; /*Specific height for the next/previous buttons*/
|
|
11
|
+
--dp-button-icon-height: var(--icon-md-size); /*Icon sizing in buttons*/
|
|
12
|
+
--dp-cell-size: 32px; /*Width and height of calendar cell*/
|
|
13
|
+
--dp-cell-padding: var(--spacing-2xs); /*Padding in the cell*/
|
|
14
|
+
--dp-common-padding: var(--spacing-xs); /*Common padding used*/
|
|
15
|
+
--dp-input-icon-padding: calc(var(--icon-md-size) + 2 * var(--spacing-xs)); /*Padding on the left side of the input if icon is present*/
|
|
16
|
+
--dp-input-padding: calc(var(--spacing-xs) - 1px) calc(var(--icon-md-size) + 2 * var(--spacing-xs)); /*Padding in the input*/
|
|
17
|
+
//--dp-menu-min-width: 260px; /*Adjust the min width of the menu*/
|
|
18
|
+
--dp-action-buttons-padding: 2px 5px; /*Adjust padding for the action buttons in action row*/
|
|
19
|
+
--dp-row-maring: var(--spacing-xs); /*Adjust the spacing between rows in the calendar*/
|
|
20
|
+
--dp-calendar-header-cell-padding: 0.5rem; /*Adjust padding in calendar header cells*/
|
|
21
|
+
--dp-two-calendars-spacing: 10px; /*Space between multiple calendars*/
|
|
22
|
+
--dp-overlay-col-padding: 3px; /*Padding in the overlay column*/
|
|
23
|
+
--dp-time-inc-dec-button-size: 32px; /*Sizing for arrow buttons in the time picker*/
|
|
12
24
|
|
|
13
|
-
|
|
14
|
-
--
|
|
15
|
-
--
|
|
16
|
-
--
|
|
25
|
+
/*Font sizes*/
|
|
26
|
+
--dp-font-size: 14px; /*Default font-size*/
|
|
27
|
+
--dp-preview-font-size: 12px; /*Font size of the date preview in the action row*/
|
|
28
|
+
--dp-time-font-size: 12px; /*Font size in the time picker*/
|
|
29
|
+
|
|
30
|
+
/*Transitions*/
|
|
31
|
+
--dp-animation-duration: var(--transition); /*Transition duration*/
|
|
32
|
+
--dp-menu-appear-transition-timing: cubic-bezier(.4, 0, 1, 1); /*Timing on menu appear animation*/
|
|
33
|
+
--dp-transition-timing: ease-out; /*Timing on slide animations*/
|
|
34
|
+
}
|
|
17
35
|
|
|
18
|
-
|
|
19
|
-
--
|
|
20
|
-
--
|
|
36
|
+
.dp__theme_light {
|
|
37
|
+
--dp-background-color: var(--main-color);
|
|
38
|
+
--dp-text-color: var(--contrast-color);
|
|
39
|
+
--dp-hover-color: var(--secondary-color-50);
|
|
40
|
+
--dp-hover-text-color: var(--contrast-color);
|
|
41
|
+
--dp-hover-icon-color: var(--icon-color--hover);
|
|
42
|
+
--dp-primary-color: var(--accent-color);
|
|
43
|
+
--dp-primary-text-color: var(--main-color);
|
|
44
|
+
--dp-secondary-color: var(--secondary-color);
|
|
45
|
+
--dp-border-color: var(--form-border-color);
|
|
46
|
+
--dp-menu-border-color: transparent;
|
|
47
|
+
--dp-border-color-hover: var(--form-border--hover-color);
|
|
48
|
+
--dp-disabled-color: var(--disabled-color);
|
|
49
|
+
//--dp-scroll-bar-background: #f3f3f3;
|
|
50
|
+
//--dp-scroll-bar-color: #959595;
|
|
51
|
+
--dp-success-color: var(--true-color);
|
|
52
|
+
//--dp-success-color-disabled: #a3d9b1;
|
|
53
|
+
--dp-icon-color: var(--icon-color);
|
|
54
|
+
--dp-danger-color: var(--false-color);
|
|
55
|
+
//--dp-highlight-color: rgba(25, 118, 210, 0.1);
|
|
21
56
|
}
|
package/src/locale/i18n.js
CHANGED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { shallowMount, mount } from '@vue/test-utils';
|
|
2
|
-
import FloatingVue, { Dropdown, Popper } from 'floating-vue';
|
|
3
|
-
import WtDatetimepicker from '../wt-datetimepicker.vue';
|
|
4
|
-
import WtLabel from '../../wt-label/wt-label.vue';
|
|
5
|
-
import WtIcon from '../../../atoms/wt-icon/wt-icon.vue';
|
|
6
|
-
import WtButton from '../../../atoms/wt-button/wt-button.vue';
|
|
7
|
-
|
|
8
|
-
describe('WtDatetimepicker', () => {
|
|
9
|
-
it('renders a component', () => {
|
|
10
|
-
const wrapper = shallowMount(WtDatetimepicker, {
|
|
11
|
-
global: {
|
|
12
|
-
plugins: [FloatingVue],
|
|
13
|
-
stubs: {
|
|
14
|
-
WtLabel,
|
|
15
|
-
WtIcon,
|
|
16
|
-
WtButton,
|
|
17
|
-
WtTimepicker: true,
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
});
|
|
21
|
-
expect(wrapper.classes('wt-datetimepicker')).toBe(true);
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
it('renders label text when passed', () => {
|
|
25
|
-
const label = 'Hello there';
|
|
26
|
-
const wrapper = mount(WtDatetimepicker, {
|
|
27
|
-
global: {
|
|
28
|
-
plugins: [FloatingVue],
|
|
29
|
-
stubs: {
|
|
30
|
-
WtLabel,
|
|
31
|
-
WtIcon,
|
|
32
|
-
WtButton,
|
|
33
|
-
WtTimepicker: true,
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
props: { label },
|
|
37
|
-
});
|
|
38
|
-
expect(wrapper.find('.wt-label').text()).toBe(label);
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
it('opens form at preview click', async () => {
|
|
42
|
-
const wrapper = shallowMount(WtDatetimepicker, {
|
|
43
|
-
// stubs: {
|
|
44
|
-
// WtLabel,
|
|
45
|
-
// WtIcon,
|
|
46
|
-
// WtButton,
|
|
47
|
-
// WtTimepicker: true,
|
|
48
|
-
// },
|
|
49
|
-
});
|
|
50
|
-
expect(wrapper.find('.wt-datetimepicker__form').element).not.toBeVisible();
|
|
51
|
-
wrapper.find('.wt-datetimepicker__preview').trigger('click');
|
|
52
|
-
await wrapper.vm.$nextTick();
|
|
53
|
-
expect(wrapper.find('.wt-datetimepicker__form').isVisible()).toBe(true);
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
// dunno how to test content of VDropdown popper template :(
|
|
57
|
-
// it('Triggers change event after button "add" click', async () => {
|
|
58
|
-
// const now = Date.now();
|
|
59
|
-
// const wrapper = mount(WtDatetimepicker, {
|
|
60
|
-
// localVue,
|
|
61
|
-
// stubs: {
|
|
62
|
-
// WtLabel,
|
|
63
|
-
// WtIcon,
|
|
64
|
-
// WtButton,
|
|
65
|
-
// VDropdown: Dropdown,
|
|
66
|
-
// WtTimepicker: true,
|
|
67
|
-
// },
|
|
68
|
-
// props: {
|
|
69
|
-
// value: now,
|
|
70
|
-
// },
|
|
71
|
-
// });
|
|
72
|
-
// wrapper.setData({ isOpened: true });
|
|
73
|
-
// // wrapper.find('.wt-datetimepicker__preview').trigger('keyup.enter');
|
|
74
|
-
// await wrapper.vm.$nextTick();
|
|
75
|
-
// await wrapper.vm.$nextTick();
|
|
76
|
-
// await wrapper.vm.$nextTick();
|
|
77
|
-
// console.info(wrapper.html());
|
|
78
|
-
// expect(wrapper.find('.wt-datetimepicker__form').exists()).toBe(true);
|
|
79
|
-
// wrapper.find('.wt-datetimepicker__actions > .wt-button').trigger('click');
|
|
80
|
-
// expect(wrapper.emitted().change.pop()).toEqual([now]);
|
|
81
|
-
// });
|
|
82
|
-
});
|