@webitel/ui-datalist 1.1.47 → 1.1.48

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,9 +1,10 @@
1
1
  {
2
2
  "name": "@webitel/ui-datalist",
3
- "version": "1.1.47",
3
+ "version": "1.1.48",
4
4
  "description": "Toolkit for building data lists in webitel ui system",
5
5
  "scripts": {
6
6
  "build:types": "vue-tsc -p ./tsconfig.build.json",
7
+ "typecheck": "vue-tsc --noEmit -p ./tsconfig.typecheck.json",
7
8
  "lint:fix": "npx biome check --write ./src",
8
9
  "biome:ci:gh": "biome ci ./src --reporter=github",
9
10
  "test:unit": "node -e \"process.exit(0)\"",
@@ -5,6 +5,8 @@
5
5
  :model-value="model?.from"
6
6
  class="date-time-filter-value-field__picker"
7
7
  show-time
8
+ required
9
+ :v="v$.from"
8
10
  @update:model-value="handleInput('from', $event)"
9
11
  />
10
12
 
@@ -13,14 +15,18 @@
13
15
  :model-value="model?.to"
14
16
  class="date-time-filter-value-field__picker"
15
17
  show-time
18
+ required
19
+ :v="v$.to"
16
20
  @update:model-value="handleInput('to', $event)"
17
21
  />
18
22
  </div>
19
23
  </template>
20
24
 
21
25
  <script lang="ts" setup>
26
+ import { useVuelidate } from '@vuelidate/core';
27
+ import { required } from '@vuelidate/validators';
22
28
  import { endOfToday, startOfToday } from 'date-fns';
23
- import { onMounted } from 'vue';
29
+ import { computed, onMounted, watch } from 'vue';
24
30
  import { useI18n } from 'vue-i18n';
25
31
 
26
32
  type ModelValue = {
@@ -28,9 +34,48 @@ type ModelValue = {
28
34
  to: number;
29
35
  };
30
36
 
37
+ const emit = defineEmits<{
38
+ 'update:invalid': [
39
+ boolean,
40
+ ];
41
+ }>();
42
+
31
43
  const model = defineModel<ModelValue>();
32
44
  const { t } = useI18n();
33
45
 
46
+ const from = computed(() => model.value?.from);
47
+ const to = computed(() => model.value?.to);
48
+
49
+ const v$ = useVuelidate(
50
+ computed(() => ({
51
+ from: {
52
+ required,
53
+ },
54
+ to: {
55
+ required,
56
+ },
57
+ })),
58
+ {
59
+ from,
60
+ to,
61
+ },
62
+ {
63
+ $autoDirty: true,
64
+ },
65
+ );
66
+
67
+ v$.value.$touch();
68
+
69
+ watch(
70
+ () => v$.value.$invalid,
71
+ (invalid) => {
72
+ emit('update:invalid', invalid);
73
+ },
74
+ {
75
+ immediate: true,
76
+ },
77
+ );
78
+
34
79
  const handleInput = (key: keyof ModelValue, value: number) => {
35
80
  model.value = {
36
81
  ...model.value,
@@ -8,7 +8,7 @@
8
8
 
9
9
  <script lang="ts" setup>
10
10
  import { useVuelidate } from '@vuelidate/core';
11
- import variableSearchValidator from '@webitel/ui-sdk/validators/variableSearchValidator/variableSearchValidator';
11
+ import { required } from '@vuelidate/validators';
12
12
  import { computed, watch } from 'vue';
13
13
  import { useI18n } from 'vue-i18n';
14
14
 
@@ -24,7 +24,7 @@ const { t } = useI18n();
24
24
  const v$ = useVuelidate(
25
25
  computed(() => ({
26
26
  model: {
27
- required: variableSearchValidator(),
27
+ required,
28
28
  },
29
29
  })),
30
30
  {
@@ -7,8 +7,10 @@ type __VLS_ModelProps = {
7
7
  };
8
8
  declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
9
9
  "update:modelValue": (value: ModelValue) => any;
10
+ "update:invalid": (args_0: boolean) => any;
10
11
  }, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
11
12
  "onUpdate:modelValue"?: (value: ModelValue) => any;
13
+ "onUpdate:invalid"?: (args_0: boolean) => any;
12
14
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
13
15
  declare const _default: typeof __VLS_export;
14
16
  export default _default;