@webitel/ui-sdk 26.6.71 → 26.6.72

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.
@@ -1,4 +1,4 @@
1
- import "./components-CXf44HOY.js";
1
+ import "./components-Dk5QOwBa.js";
2
2
  import { t as e } from "./_plugin-vue_export-helper-B3ysoDQm.js";
3
3
  import { l as t } from "./enums-CoY-pIuZ.js";
4
4
  import { t as n } from "./wt-button-BVX4GDCP.js";
@@ -3,10 +3,10 @@ import { d as t, f as n, l as r, r as i } from "./enums-CoY-pIuZ.js";
3
3
  import { a, i as o, n as s, r as c, t as l } from "./toZonedTime-B8L5kbse.js";
4
4
  import { t as u } from "./vue-i18n-Db_oYfO8.js";
5
5
  import { t as d } from "./useValidation-DMp_AiNP.js";
6
- import { computed as f, createBlock as p, createCommentVNode as m, createElementBlock as h, createElementVNode as g, createTextVNode as _, createVNode as v, defineComponent as y, guardReactiveProps as b, mergeModels as x, mergeProps as S, nextTick as C, normalizeProps as w, openBlock as T, renderSlot as E, resolveComponent as D, toDisplayString as O, toRefs as k, unref as A, useModel as j, useTemplateRef as M, vShow as N, withCtx as P, withDirectives as F } from "vue";
7
- import I from "primevue/datepicker";
6
+ import { computed as f, createBlock as p, createCommentVNode as m, createElementBlock as h, createElementVNode as g, createTextVNode as _, createVNode as v, defineComponent as y, guardReactiveProps as b, mergeModels as x, mergeProps as S, nextTick as C, normalizeProps as w, onMounted as T, onUnmounted as E, openBlock as D, renderSlot as O, resolveComponent as k, toDisplayString as A, toRefs as j, unref as M, useModel as N, useTemplateRef as P, vShow as F, withCtx as I, withDirectives as L } from "vue";
7
+ import R from "primevue/datepicker";
8
8
  //#region node_modules/date-fns-tz/dist/esm/fromZonedTime/index.js
9
- function L(e, t, n) {
9
+ function z(e, t, n) {
10
10
  if (typeof e == "string" && !e.match(c)) return s(e, {
11
11
  ...n,
12
12
  timeZone: t
@@ -16,24 +16,55 @@ function L(e, t, n) {
16
16
  return new Date(r + i);
17
17
  }
18
18
  //#endregion
19
+ //#region src/components/wt-datepicker/_internals/composables/usePreventZeroPad.ts
20
+ function B(e) {
21
+ let t = null;
22
+ function n(e) {
23
+ let n = e.target, r = n.value, i = n.selectionStart ?? 0, a = r.split("/"), o = 0;
24
+ for (let e = 0; e < Math.min(a.length, 2); e++) {
25
+ let n = a[e], s = o + n.length;
26
+ if (i <= s && n.length === 1 && /^\d$/.test(n)) {
27
+ t = {
28
+ value: r,
29
+ cursor: i
30
+ };
31
+ return;
32
+ }
33
+ o = s + 1;
34
+ }
35
+ }
36
+ function r(e) {
37
+ if (!t) return;
38
+ let n = e.target, { value: r, cursor: i } = t;
39
+ t = null, n.value !== r && (n.value = r, n.setSelectionRange(i, i), e.stopImmediatePropagation());
40
+ }
41
+ T(() => {
42
+ let t = e();
43
+ t && (t.addEventListener("input", n, { capture: !0 }), t.addEventListener("input", r));
44
+ }), E(() => {
45
+ let t = e();
46
+ t && (t.removeEventListener("input", n, { capture: !0 }), t.removeEventListener("input", r));
47
+ });
48
+ }
49
+ //#endregion
19
50
  //#region src/components/wt-datepicker/wt-datepicker.vue?vue&type=script&setup=true&lang.ts
20
- var R = { class: "wt-datepicker" }, z = { class: "wt-datepicker__button-bar" }, B = [
51
+ var V = { class: "wt-datepicker" }, H = { class: "wt-datepicker__button-bar" }, U = [
21
52
  "onMousedown",
22
53
  "onMouseup",
23
54
  "onMouseleave"
24
- ], V = [
55
+ ], W = [
25
56
  "onMousedown",
26
57
  "onMouseup",
27
58
  "onMouseleave"
28
- ], H = [
59
+ ], G = [
29
60
  "onMousedown",
30
61
  "onMouseup",
31
62
  "onMouseleave"
32
- ], U = [
63
+ ], K = [
33
64
  "onMousedown",
34
65
  "onMouseup",
35
66
  "onMouseleave"
36
- ], W = /*#__PURE__*/ e(/* @__PURE__ */ y({
67
+ ], q = /*#__PURE__*/ e(/* @__PURE__ */ y({
37
68
  __name: "wt-datepicker",
38
69
  props: /*@__PURE__*/ x({
39
70
  showTime: { type: Boolean },
@@ -131,7 +162,7 @@ var R = { class: "wt-datepicker" }, z = { class: "wt-datepicker__button-bar" },
131
162
  "keydown"
132
163
  ], ["update:modelValue"]),
133
164
  setup(e, { emit: a }) {
134
- let o = e, s = j(e, "modelValue"), { t: c } = u(), y = f({
165
+ let o = e, s = N(e, "modelValue"), { t: c } = u(), y = f({
135
166
  get() {
136
167
  if (!s.value) return null;
137
168
  let e = /* @__PURE__ */ new Date(+s.value);
@@ -142,10 +173,12 @@ var R = { class: "wt-datepicker" }, z = { class: "wt-datepicker__button-bar" },
142
173
  s.value = null;
143
174
  return;
144
175
  }
145
- let t = o.timezone ? L(e, o.timezone) : e;
176
+ let t = o.timezone ? z(e, o.timezone) : e;
146
177
  s.value = t.getTime();
147
178
  }
148
- }), x = M("datepicker"), W = `datepicker-${Math.random().toString(36).slice(2, 11)}`, G = f(() => o.placholder || `dd/mm/yyyy ${o.showTime ? "hh:mm" : ""}`), K = () => {
179
+ }), x = P("datepicker"), T = `datepicker-${Math.random().toString(36).slice(2, 11)}`;
180
+ B(() => x.value?.$el?.querySelector("input"));
181
+ let E = f(() => o.placholder || `dd/mm/yyyy ${o.showTime ? "hh:mm" : ""}`), q = () => {
149
182
  if (o.showTime && y.value) {
150
183
  let e = y.value;
151
184
  C(() => {
@@ -157,24 +190,24 @@ var R = { class: "wt-datepicker" }, z = { class: "wt-datepicker__button-bar" },
157
190
  let e = x.value?.overlay;
158
191
  e && (e.style.minWidth = "");
159
192
  }, 0);
160
- }, q = f(() => o.required ? `${o.label}*` : o.label), { v: J, customValidators: Y } = k(o), { isValidation: X, invalid: Z, validationText: Q, validationTextColor: $ } = d({
161
- v: J,
162
- customValidators: Y
193
+ }, J = f(() => o.required ? `${o.label}*` : o.label), { v: Y, customValidators: X } = j(o), { isValidation: Z, invalid: Q, validationText: $, validationTextColor: ee } = d({
194
+ v: Y,
195
+ customValidators: X
163
196
  });
164
197
  return (a, o) => {
165
- let s = D("wt-label"), l = D("wt-button"), u = D("wt-icon-btn"), d = D("wt-message");
166
- return T(), h("div", R, [
198
+ let s = k("wt-label"), l = k("wt-button"), u = k("wt-icon-btn"), d = k("wt-message");
199
+ return D(), h("div", V, [
167
200
  v(s, S(e.labelProps, { disabled: e.disabled }, {
168
- for: W,
169
- invalid: A(Z)
201
+ for: T,
202
+ invalid: M(Q)
170
203
  }), {
171
- default: P(() => [E(a.$slots, "label", w(b({ label: e.label })), () => [_(O(q.value), 1)], !0)], void 0, !0),
204
+ default: I(() => [O(a.$slots, "label", w(b({ label: e.label })), () => [_(A(J.value), 1)], !0)], void 0, !0),
172
205
  _: 3
173
206
  }, 16, ["disabled", "invalid"]),
174
- v(A(I), {
207
+ v(M(R), {
175
208
  ref_key: "datepicker",
176
209
  ref: x,
177
- id: W,
210
+ id: T,
178
211
  modelValue: y.value,
179
212
  "onUpdate:modelValue": o[0] ||= (e) => y.value = e,
180
213
  "date-format": "dd/mm/yy",
@@ -183,7 +216,7 @@ var R = { class: "wt-datepicker" }, z = { class: "wt-datepicker__button-bar" },
183
216
  "show-time": e.showTime,
184
217
  "min-date": e.minDate,
185
218
  "max-date": e.maxDate,
186
- placeholder: G.value,
219
+ placeholder: E.value,
187
220
  "show-clear": e.clearable && y.value,
188
221
  "show-button-bar": "",
189
222
  fluid: "",
@@ -196,68 +229,68 @@ var R = { class: "wt-datepicker" }, z = { class: "wt-datepicker__button-bar" },
196
229
  minute: { class: "typo-body-2" },
197
230
  panel: { style: { maxWidth: "380px" } }
198
231
  },
199
- onShow: K
232
+ onShow: q
200
233
  }, {
201
- buttonbar: P(({ todayCallback: i, clearCallback: a }) => [g("div", z, [v(l, {
202
- color: A(n).SECONDARY,
203
- variant: A(t).OUTLINED,
204
- size: A(r).SM,
234
+ buttonbar: I(({ todayCallback: i, clearCallback: a }) => [g("div", H, [v(l, {
235
+ color: M(n).SECONDARY,
236
+ variant: M(t).OUTLINED,
237
+ size: M(r).SM,
205
238
  onClick: i
206
239
  }, {
207
- default: P(() => [_(O(A(c)("reusable.today")), 1)], void 0, !0),
240
+ default: I(() => [_(A(M(c)("reusable.today")), 1)], void 0, !0),
208
241
  _: 1
209
242
  }, 8, [
210
243
  "color",
211
244
  "variant",
212
245
  "size",
213
246
  "onClick"
214
- ]), F(v(l, {
215
- color: A(n).SECONDARY,
216
- variant: A(t).OUTLINED,
217
- size: A(r).SM,
247
+ ]), L(v(l, {
248
+ color: M(n).SECONDARY,
249
+ variant: M(t).OUTLINED,
250
+ size: M(r).SM,
218
251
  onClick: a
219
252
  }, {
220
- default: P(() => [_(O(A(c)("reusable.clear")), 1)], void 0, !0),
253
+ default: I(() => [_(A(M(c)("reusable.clear")), 1)], void 0, !0),
221
254
  _: 1
222
255
  }, 8, [
223
256
  "color",
224
257
  "variant",
225
258
  "size",
226
259
  "onClick"
227
- ]), [[N, e.clearable && y.value]])])]),
228
- prevbutton: P(({ actionCallback: e }) => [v(u, {
260
+ ]), [[F, e.clearable && y.value]])])]),
261
+ prevbutton: I(({ actionCallback: e }) => [v(u, {
229
262
  icon: "arrow-left",
230
263
  onClick: e
231
264
  }, null, 8, ["onClick"])]),
232
- nextbutton: P(({ actionCallback: e }) => [v(u, {
265
+ nextbutton: I(({ actionCallback: e }) => [v(u, {
233
266
  icon: "arrow-right",
234
267
  onClick: e
235
268
  }, null, 8, ["onClick"])]),
236
- clearicon: P(({ clearCallback: e }) => [v(u, {
269
+ clearicon: I(({ clearCallback: e }) => [v(u, {
237
270
  icon: "close",
238
271
  class: "wt-datepicker__clear-icon",
239
272
  onClick: e
240
273
  }, null, 8, ["onClick"])]),
241
- hourincrementbutton: P(({ callbacks: e }) => [g("span", {
274
+ hourincrementbutton: I(({ callbacks: e }) => [g("span", {
242
275
  onMousedown: e.mousedown,
243
276
  onMouseup: e.mouseup,
244
277
  onMouseleave: e.mouseleave
245
- }, [v(u, { icon: "arrow-up" })], 40, B)]),
246
- hourdecrementbutton: P(({ callbacks: e }) => [g("span", {
278
+ }, [v(u, { icon: "arrow-up" })], 40, U)]),
279
+ hourdecrementbutton: I(({ callbacks: e }) => [g("span", {
247
280
  onMousedown: e.mousedown,
248
281
  onMouseup: e.mouseup,
249
282
  onMouseleave: e.mouseleave
250
- }, [v(u, { icon: "arrow-down" })], 40, V)]),
251
- minuteincrementbutton: P(({ callbacks: e }) => [g("span", {
283
+ }, [v(u, { icon: "arrow-down" })], 40, W)]),
284
+ minuteincrementbutton: I(({ callbacks: e }) => [g("span", {
252
285
  onMousedown: e.mousedown,
253
286
  onMouseup: e.mouseup,
254
287
  onMouseleave: e.mouseleave
255
- }, [v(u, { icon: "arrow-up" })], 40, H)]),
256
- minutedecrementbutton: P(({ callbacks: e }) => [g("span", {
288
+ }, [v(u, { icon: "arrow-up" })], 40, G)]),
289
+ minutedecrementbutton: I(({ callbacks: e }) => [g("span", {
257
290
  onMousedown: e.mousedown,
258
291
  onMouseup: e.mouseup,
259
292
  onMouseleave: e.mouseleave
260
- }, [v(u, { icon: "arrow-down" })], 40, U)]),
293
+ }, [v(u, { icon: "arrow-down" })], 40, K)]),
261
294
  _: 1
262
295
  }, 8, [
263
296
  "modelValue",
@@ -269,13 +302,13 @@ var R = { class: "wt-datepicker" }, z = { class: "wt-datepicker__button-bar" },
269
302
  "placeholder",
270
303
  "show-clear"
271
304
  ]),
272
- A(X) && A(Q) ? (T(), p(d, {
305
+ M(Z) && M($) ? (D(), p(d, {
273
306
  key: 0,
274
- color: A($),
275
- variant: A(i).SIMPLE,
276
- size: A(r).SM
307
+ color: M(ee),
308
+ variant: M(i).SIMPLE,
309
+ size: M(r).SM
277
310
  }, {
278
- default: P(() => [_(O(A(Q)), 1)], void 0, !0),
311
+ default: I(() => [_(A(M($)), 1)], void 0, !0),
279
312
  _: 1
280
313
  }, 8, [
281
314
  "color",
@@ -285,6 +318,6 @@ var R = { class: "wt-datepicker" }, z = { class: "wt-datepicker__button-bar" },
285
318
  ]);
286
319
  };
287
320
  }
288
- }), [["__scopeId", "data-v-24efc01b"]]);
321
+ }), [["__scopeId", "data-v-b7a87a75"]]);
289
322
  //#endregion
290
- export { W as default };
323
+ export { q as default };
@@ -1,4 +1,4 @@
1
- import { C as e, i as t } from "./components-CXf44HOY.js";
1
+ import { C as e, i as t } from "./components-Dk5QOwBa.js";
2
2
  import { t as n } from "./_plugin-vue_export-helper-B3ysoDQm.js";
3
3
  import { t as r } from "./displayText-CtaxzaBz.js";
4
4
  import { Fragment as i, computed as a, createCommentVNode as o, createElementBlock as s, createTextVNode as c, createVNode as l, defineComponent as u, openBlock as d, renderList as f, renderSlot as p, toDisplayString as m, unref as h, withCtx as g } from "vue";
@@ -1,4 +1,4 @@
1
- import { n as e } from "./components-CXf44HOY.js";
1
+ import { n as e } from "./components-Dk5QOwBa.js";
2
2
  import { t } from "./vue-i18n-Db_oYfO8.js";
3
3
  import { n, r } from "./clients-DjB6nJHf.js";
4
4
  import { createBlock as i, createTextVNode as a, createVNode as o, defineComponent as s, inject as c, mergeProps as l, onMounted as u, openBlock as d, ref as f, resolveComponent as p, toDisplayString as m, unref as h, withCtx as g } from "vue";
@@ -1,4 +1,4 @@
1
- import { a as e, o as t, r as n, s as r } from "./components-CXf44HOY.js";
1
+ import { a as e, o as t, r as n, s as r } from "./components-Dk5QOwBa.js";
2
2
  import { t as i } from "./enums-CoY-pIuZ.js";
3
3
  import { t as a } from "./vue-i18n-Db_oYfO8.js";
4
4
  import { t as o } from "./clients-DjB6nJHf.js";
@@ -1,4 +1,4 @@
1
- import { w as e } from "./components-CXf44HOY.js";
1
+ import { w as e } from "./components-Dk5QOwBa.js";
2
2
  import { t } from "./_plugin-vue_export-helper-B3ysoDQm.js";
3
3
  import { l as n } from "./enums-CoY-pIuZ.js";
4
4
  import "./wt-button-BVX4GDCP.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webitel/ui-sdk",
3
- "version": "26.6.71",
3
+ "version": "26.6.72",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "npm run docs:dev",
@@ -0,0 +1,72 @@
1
+ import { onMounted, onUnmounted } from 'vue';
2
+
3
+ /**
4
+ * @author @HlukhovYe
5
+ *
6
+ * https://webitel.atlassian.net/browse/WTEL-9865
7
+ *
8
+ * Prevents PrimeVue's DatePicker from zero-padding a dd/mm segment while the user
9
+ * is mid-typing. Without this, typing "2" into a cleared two-digit slot immediately
10
+ * reformats to "02", forcing the user to delete the leading zero before the second digit.
11
+ *
12
+ * Works by registering two listeners on the same input event:
13
+ * - capture phase (before PrimeVue): snapshots the partial single-digit value
14
+ * - bubble phase (after PrimeVue): if PrimeVue zero-padded the value, restores the
15
+ * snapshot and cancels further propagation so the model is not updated yet
16
+ */
17
+ export function usePreventZeroPad(getInput: () => HTMLInputElement | null) {
18
+ let pendingPartial: {
19
+ value: string;
20
+ cursor: number;
21
+ } | null = null;
22
+
23
+ function onInputCapture(event: Event) {
24
+ const input = event.target as HTMLInputElement;
25
+ const raw = input.value;
26
+ const cursor = input.selectionStart ?? 0;
27
+ const parts = raw.split('/');
28
+ let offset = 0;
29
+ for (let i = 0; i < Math.min(parts.length, 2); i++) {
30
+ const seg = parts[i];
31
+ const segEnd = offset + seg.length;
32
+ if (cursor <= segEnd && seg.length === 1 && /^\d$/.test(seg)) {
33
+ pendingPartial = {
34
+ value: raw,
35
+ cursor,
36
+ };
37
+ return;
38
+ }
39
+ offset = segEnd + 1;
40
+ }
41
+ }
42
+
43
+ function onInputBubble(event: Event) {
44
+ if (!pendingPartial) return;
45
+ const input = event.target as HTMLInputElement;
46
+ const { value, cursor } = pendingPartial;
47
+ pendingPartial = null;
48
+ if (input.value !== value) {
49
+ input.value = value;
50
+ input.setSelectionRange(cursor, cursor);
51
+ event.stopImmediatePropagation();
52
+ }
53
+ }
54
+
55
+ onMounted(() => {
56
+ const input = getInput();
57
+ if (!input) return;
58
+ input.addEventListener('input', onInputCapture, {
59
+ capture: true,
60
+ });
61
+ input.addEventListener('input', onInputBubble);
62
+ });
63
+
64
+ onUnmounted(() => {
65
+ const input = getInput();
66
+ if (!input) return;
67
+ input.removeEventListener('input', onInputCapture, {
68
+ capture: true,
69
+ });
70
+ input.removeEventListener('input', onInputBubble);
71
+ });
72
+ }
@@ -150,6 +150,7 @@ import {
150
150
  MessageVariant,
151
151
  } from '../../enums';
152
152
  import { useValidation } from '../../mixins/validationMixin/useValidation';
153
+ import { usePreventZeroPad } from './_internals/composables/usePreventZeroPad';
153
154
 
154
155
  interface Props extends DatePickerProps {
155
156
  showTime?: boolean;
@@ -199,6 +200,8 @@ const datepicker = useTemplateRef<HTMLDivElement>('datepicker');
199
200
 
200
201
  const datepickerId = `datepicker-${Math.random().toString(36).slice(2, 11)}`;
201
202
 
203
+ usePreventZeroPad(() => datepicker.value?.$el?.querySelector('input'));
204
+
202
205
  const getPlaceholder = computed(() => {
203
206
  return props.placholder || `dd/mm/yyyy ${props.showTime ? 'hh:mm' : ''}`;
204
207
  });
@@ -0,0 +1,15 @@
1
+ /**
2
+ * @author @HlukhovYe
3
+ *
4
+ * https://webitel.atlassian.net/browse/WTEL-9865
5
+ *
6
+ * Prevents PrimeVue's DatePicker from zero-padding a dd/mm segment while the user
7
+ * is mid-typing. Without this, typing "2" into a cleared two-digit slot immediately
8
+ * reformats to "02", forcing the user to delete the leading zero before the second digit.
9
+ *
10
+ * Works by registering two listeners on the same input event:
11
+ * - capture phase (before PrimeVue): snapshots the partial single-digit value
12
+ * - bubble phase (after PrimeVue): if PrimeVue zero-padded the value, restores the
13
+ * snapshot and cancels further propagation so the model is not updated yet
14
+ */
15
+ export declare function usePreventZeroPad(getInput: () => HTMLInputElement | null): void;