@webitel/ui-sdk 24.12.53 → 24.12.54

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webitel/ui-sdk",
3
- "version": "24.12.53",
3
+ "version": "24.12.54",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "vite",
@@ -17,6 +17,16 @@
17
17
  </slot>
18
18
  </wt-label>
19
19
  <div class="wt-timepicker__wrapper">
20
+ <wt-time-input
21
+ v-if="isDay"
22
+ :disabled="disabled"
23
+ :label="labelDays"
24
+ :max-value="dateMode ? null : 365"
25
+ :v="v"
26
+ :value="day"
27
+ hide-input-info
28
+ @input="day = $event"
29
+ />
20
30
  <wt-time-input
21
31
  v-if="isHour"
22
32
  :disabled="disabled"
@@ -60,6 +70,7 @@
60
70
  <script>
61
71
  import validationMixin from '../../mixins/validationMixin/validationMixin.js';
62
72
 
73
+ const SEC_IN_DAY = 60 * 60 * 24;
63
74
  const SEC_IN_HOUR = 60 * 60;
64
75
  const SEC_IN_MIN = 60;
65
76
 
@@ -78,14 +89,26 @@ export default {
78
89
  type: [String, Number],
79
90
  default: 0,
80
91
  },
92
+
93
+ /**
94
+ * If dateMode is true, timepicker asserts value is timestamp and displays/changes timestamp value
95
+ */
81
96
  dateMode: {
82
97
  type: Boolean,
83
98
  default: false,
84
99
  },
100
+
101
+ /**
102
+ * if passed, replaces "day", "hour", "min", "sec" with a single label + format prop value
103
+ */
85
104
  label: {
86
105
  type: String,
87
106
  default: '',
88
107
  },
108
+
109
+ /**
110
+ * Time format, can be "dd:hh:mm:ss", "hh:mm:ss", "mm:ss", "ss"
111
+ */
89
112
  format: {
90
113
  type: String,
91
114
  default: 'hh:mm:ss',
@@ -94,6 +117,11 @@ export default {
94
117
  type: Boolean,
95
118
  default: false,
96
119
  },
120
+
121
+ /**
122
+ * Object with props, passed down to wt-label as props
123
+ */
124
+
97
125
  labelProps: {
98
126
  type: Object,
99
127
  description: 'Object with props, passed down to wt-label as props',
@@ -110,6 +138,9 @@ export default {
110
138
  },
111
139
 
112
140
  computed: {
141
+ isDay() {
142
+ return this.format.includes('dd');
143
+ },
113
144
  isHour() {
114
145
  return this.format.includes('hh');
115
146
  },
@@ -119,6 +150,10 @@ export default {
119
150
  isSec() {
120
151
  return this.format.includes('ss');
121
152
  },
153
+ labelDays() {
154
+ if (this.noLabel) return null;
155
+ return this.label ? null : this.$t('webitelUI.timepicker.day');
156
+ },
122
157
  labelHours() {
123
158
  if (this.noLabel) return null;
124
159
  return this.label ? null : this.$t('webitelUI.timepicker.hour');
@@ -131,11 +166,24 @@ export default {
131
166
  if (this.noLabel) return null;
132
167
  return this.label ? null : this.$t('webitelUI.timepicker.sec');
133
168
  },
169
+ day: {
170
+ get() {
171
+ return this.dateMode
172
+ ? new Date(+this.value).getDay()
173
+ : Math.floor(this.value / SEC_IN_DAY);
174
+ },
175
+ set(value) {
176
+ const newValue = this.dateMode
177
+ ? new Date(this.value).setDate(value)
178
+ : this.value - this.day * SEC_IN_DAY + value * SEC_IN_DAY;
179
+ this.$emit('input', newValue);
180
+ },
181
+ },
134
182
  hour: {
135
183
  get() {
136
184
  return this.dateMode
137
185
  ? new Date(+this.value).getHours()
138
- : Math.floor(this.value / SEC_IN_HOUR);
186
+ : Math.floor((this.value % SEC_IN_DAY) / SEC_IN_HOUR);
139
187
  },
140
188
  set(value) {
141
189
  const newValue = this.dateMode
@@ -308,6 +308,7 @@ export default {
308
308
  variableSearchHint: 'Query format: "key=value"',
309
309
  },
310
310
  timepicker: {
311
+ day: 'Day:',
311
312
  hour: 'Hour:',
312
313
  min: 'Min:',
313
314
  sec: 'Sec:',
@@ -306,6 +306,7 @@ export default {
306
306
  variableSearchHint: 'Формат запроса: "ключ=значение"',
307
307
  },
308
308
  timepicker: {
309
+ day: 'День:',
309
310
  hour: 'Час:',
310
311
  min: 'Мин:',
311
312
  sec: 'Сек:',
@@ -306,6 +306,7 @@ export default {
306
306
  variableSearchHint: 'Формат запиту: "ключ=значення"',
307
307
  },
308
308
  timepicker: {
309
+ day: 'День:',
309
310
  hour: 'Год:',
310
311
  min: 'Хв:',
311
312
  sec: 'Сек:',