@webitel/ui-sdk 26.8.43 → 26.8.45

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-DGC1L_qk.js";
1
+ import "./components-Be_GSVom.js";
2
2
  import { t as e } from "./_plugin-vue_export-helper-B3ysoDQm.js";
3
3
  import { l as t } from "./enums-De8CDKZ1.js";
4
4
  import { t as n } from "./wt-button-B7B7qITq.js";
@@ -208,6 +208,7 @@ var W = { class: "wt-datepicker" }, G = { class: "wt-datepicker__button-bar" },
208
208
  Boolean
209
209
  ] },
210
210
  customValidators: { default: () => [] },
211
+ regleValidation: {},
211
212
  modelValue: {},
212
213
  defaultValue: {},
213
214
  name: {},
@@ -320,9 +321,10 @@ var W = { class: "wt-datepicker" }, G = { class: "wt-datepicker__button-bar" },
320
321
  }, 0);
321
322
  }, X = () => {
322
323
  B();
323
- }, Z = f(() => o.required ? `${o.label}*` : o.label), { v: ne, customValidators: re } = j(o), { isValidation: ie, invalid: Q, validationText: $, validationTextColor: ae } = d({
324
+ }, Z = f(() => o.required ? `${o.label}*` : o.label), { v: ne, customValidators: re, regleValidation: ie } = j(o), { isValidation: ae, invalid: Q, validationText: $, validationTextColor: oe } = d({
324
325
  v: ne,
325
- customValidators: re
326
+ customValidators: re,
327
+ regleValidation: ie
326
328
  });
327
329
  return (a, o) => {
328
330
  let s = k("wt-label"), l = k("wt-button"), u = k("wt-icon-btn"), d = k("wt-message");
@@ -438,9 +440,9 @@ var W = { class: "wt-datepicker" }, G = { class: "wt-datepicker__button-bar" },
438
440
  "show-clear",
439
441
  "onBlur"
440
442
  ]),
441
- M(ie) && M($) ? (D(), p(d, {
443
+ M(ae) && M($) ? (D(), p(d, {
442
444
  key: 0,
443
- color: M(ae),
445
+ color: M(oe),
444
446
  variant: M(i).SIMPLE,
445
447
  size: M(r).SM
446
448
  }, {
@@ -454,6 +456,6 @@ var W = { class: "wt-datepicker" }, G = { class: "wt-datepicker__button-bar" },
454
456
  ]);
455
457
  };
456
458
  }
457
- }), [["__scopeId", "data-v-e763bd8a"]]);
459
+ }), [["__scopeId", "data-v-4c2f4f33"]]);
458
460
  //#endregion
459
461
  export { X as default };
@@ -1,4 +1,4 @@
1
- import { C as e, i as t } from "./components-DGC1L_qk.js";
1
+ import { C as e, i as t } from "./components-Be_GSVom.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,6 +1,6 @@
1
1
  import { t as e } from "./rolldown-runtime-BEcgMyyN.js";
2
- import { n as t, r as n } from "./clients-BwMBivjN.js";
3
- import { T as r, n as i, w as a } from "./components-DGC1L_qk.js";
2
+ import { n as t, r as n } from "./clients-BGap1xkq.js";
3
+ import { T as r, n as i, w as a } from "./components-Be_GSVom.js";
4
4
  import { t as o } from "./vue-i18n-Db_oYfO8.js";
5
5
  import { n as s } from "./useEventBus-B-ZeklLu.js";
6
6
  import { createBlock as c, createTextVNode as l, createVNode as u, defineComponent as d, mergeProps as f, onMounted as p, openBlock as m, ref as h, resolveComponent as g, toDisplayString as _, unref as v, withCtx as y } from "vue";
@@ -1,5 +1,5 @@
1
- import { t as e } from "./clients-BwMBivjN.js";
2
- import { a as t, o as n, r, s as i } from "./components-DGC1L_qk.js";
1
+ import { t as e } from "./clients-BGap1xkq.js";
2
+ import { a as t, o as n, r, s as i } from "./components-Be_GSVom.js";
3
3
  import { t as a } from "./enums-De8CDKZ1.js";
4
4
  import { t as o } from "./vue-i18n-Db_oYfO8.js";
5
5
  import { computed as s, createBlock as c, createCommentVNode as l, createVNode as u, defineComponent as d, mergeModels as f, mergeProps as p, openBlock as m, renderSlot as h, resolveComponent as g, unref as _, useModel as v } from "vue";
@@ -1,4 +1,4 @@
1
- import { E as e } from "./components-DGC1L_qk.js";
1
+ import { E as e } from "./components-Be_GSVom.js";
2
2
  import { t } from "./_plugin-vue_export-helper-B3ysoDQm.js";
3
3
  import { l as n } from "./enums-De8CDKZ1.js";
4
4
  import "./wt-button-B7B7qITq.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webitel/ui-sdk",
3
- "version": "26.8.43",
3
+ "version": "26.8.45",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "npm run docs:dev",
@@ -55,7 +55,7 @@
55
55
  >
56
56
  <template #buttonbar="{ todayCallback, clearCallback }">
57
57
  <div class="wt-datepicker__button-bar">
58
- <wt-button
58
+ <wt-button
59
59
  :color="ButtonColor.SECONDARY"
60
60
  :variant="ButtonVariant.OUTLINED"
61
61
  :size="ComponentSize.SM"
@@ -63,7 +63,7 @@
63
63
  >
64
64
  {{ t('reusable.today') }}
65
65
  </wt-button>
66
- <wt-button
66
+ <wt-button
67
67
  v-show="clearable && modelValue"
68
68
  :color="ButtonColor.SECONDARY"
69
69
  :variant="ButtonVariant.OUTLINED"
@@ -76,14 +76,14 @@
76
76
  </template>
77
77
 
78
78
  <template #prevbutton="{ actionCallback }">
79
- <wt-icon-btn
79
+ <wt-icon-btn
80
80
  icon="arrow-left"
81
81
  @click="actionCallback"
82
82
  />
83
83
  </template>
84
84
 
85
85
  <template #nextbutton="{ actionCallback }">
86
- <wt-icon-btn
86
+ <wt-icon-btn
87
87
  icon="arrow-right"
88
88
  @click="actionCallback"
89
89
  />
@@ -133,6 +133,7 @@
133
133
  </template>
134
134
 
135
135
  <script setup lang="ts">
136
+ import type { SuperCompatibleRegleFieldStatus } from '@regle/core';
136
137
  import { fromZonedTime, toZonedTime } from 'date-fns-tz';
137
138
  import PDatepicker, {
138
139
  DatePickerEmitsOptions,
@@ -167,6 +168,7 @@ interface Props extends DatePickerProps {
167
168
  timezone?: string;
168
169
  v?: VuelidateFieldLike;
169
170
  customValidators?: CompatCustomValidator[];
171
+ regleValidation?: SuperCompatibleRegleFieldStatus;
170
172
  }
171
173
 
172
174
  const props = withDefaults(defineProps<Props>(), {
@@ -257,12 +259,13 @@ const requiredLabel = computed(() => {
257
259
  });
258
260
 
259
261
  // https://stackoverflow.com/questions/72408463/use-props-in-composables-vue3
260
- const { v, customValidators } = toRefs(props);
262
+ const { v, customValidators, regleValidation } = toRefs(props);
261
263
 
262
264
  const { isValidation, invalid, validationText, validationTextColor } =
263
265
  useValidation({
264
266
  v,
265
267
  customValidators,
268
+ regleValidation,
266
269
  });
267
270
  </script>
268
271
 
@@ -3,6 +3,11 @@ import type { z } from 'zod/v4';
3
3
 
4
4
  import { isEmpty } from '../../../scripts';
5
5
 
6
+ const isMissingValue = (value: unknown) => {
7
+ if (typeof value === 'number') return false;
8
+ return isEmpty(value) as boolean;
9
+ };
10
+
6
11
  export const customZodErrorsHandler =
7
12
  (t: I18nComposerTranslation) => (issue: z.core.$ZodRawIssue) => {
8
13
  switch (issue.code) {
@@ -13,6 +18,8 @@ export const customZodErrorsHandler =
13
18
  case 'invalid_value':
14
19
  case 'invalid_type':
15
20
  return handleInvalid(issue);
21
+ case 'invalid_union':
22
+ return handleInvalidUnion(issue);
16
23
  case 'custom':
17
24
  return handleCustom(issue);
18
25
  default:
@@ -38,8 +45,7 @@ export const customZodErrorsHandler =
38
45
  return t('validation.required');
39
46
  };
40
47
 
41
- // if empty, show "required" error
42
- if (isEmpty(issue.input) as boolean) {
48
+ if (isMissingValue(issue.input)) {
43
49
  return showRequiredMsg();
44
50
  }
45
51
 
@@ -50,6 +56,13 @@ export const customZodErrorsHandler =
50
56
  });
51
57
  }
52
58
 
59
+ // if date, show formatted date in the "value" error
60
+ if (issue.origin === 'date') {
61
+ return t('validation.minValue', {
62
+ min: new Date(issue.minimum as number).toLocaleString(),
63
+ });
64
+ }
65
+
53
66
  // else, show "value" error
54
67
  return t('validation.minValue', {
55
68
  min: issue.minimum,
@@ -64,6 +77,13 @@ export const customZodErrorsHandler =
64
77
  });
65
78
  }
66
79
 
80
+ // if date, show formatted date in the "value" error
81
+ if (issue.origin === 'date') {
82
+ return t('validation.maxValue', {
83
+ max: new Date(issue.maximum as number).toLocaleString(),
84
+ });
85
+ }
86
+
67
87
  // else, show "value" error
68
88
  return t('validation.maxValue', {
69
89
  max: issue.maximum,
@@ -75,10 +95,20 @@ export const customZodErrorsHandler =
75
95
  | z.core.$ZodRawIssue<z.core.$ZodIssueInvalidType>
76
96
  | z.core.$ZodRawIssue<z.core.$ZodIssueInvalidValue>,
77
97
  ) {
78
- if (isEmpty(issue.input)) {
98
+ if (isMissingValue(issue.input)) {
79
99
  return t('validation.required');
80
100
  }
81
101
 
82
102
  console.error('Unknown Invalid Zod issue:', issue);
83
103
  }
104
+
105
+ function handleInvalidUnion(
106
+ issue: z.core.$ZodRawIssue<z.core.$ZodIssueInvalidUnion>,
107
+ ) {
108
+ if (isMissingValue(issue.input)) {
109
+ return t('validation.required');
110
+ }
111
+
112
+ return t('validation.invalid');
113
+ }
84
114
  };