@webitel/ui-datalist 1.0.37 → 1.0.38

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-datalist",
3
- "version": "1.0.37",
3
+ "version": "1.0.38",
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",
@@ -53,7 +53,7 @@
53
53
  "@vuelidate/validators": "^2.0.4",
54
54
  "@webitel/styleguide": "^24.12.26",
55
55
  "@webitel/ui-sdk": "^25.4.76",
56
- "zod": "^4.0.0-beta.20250505T195954"
56
+ "zod": "^3.25.55"
57
57
  },
58
58
  "devDependencies": {
59
59
  "@eslint/js": "^9.22.0",
@@ -81,9 +81,6 @@
81
81
  "vite-plugin-checker": "^0.9.0",
82
82
  "vue-tsc": "^2.2.8"
83
83
  },
84
- "overrides": {
85
- "zod": "^4.0.0-beta.20250505T195954"
86
- },
87
84
  "engines": {
88
85
  "npm": "10",
89
86
  "node": "v22"
@@ -0,0 +1,26 @@
1
+ import { refDebounced } from '@vueuse/core';
2
+ import { Ref, computed, MaybeRef } from 'vue';
3
+
4
+ export const useFormComponent = ({
5
+ checkIfInvalid,
6
+ isLoading,
7
+ saveItem,
8
+ // itemId, // todo: is really needed?
9
+ }: {
10
+ checkIfInvalid?: () => boolean;
11
+ isLoading?: Ref<boolean>;
12
+ // itemId?: MaybeRef<string | number>; // todo: is really needed?
13
+ saveItem: () => Promise<unknown>;
14
+ }) => {
15
+ const debouncedIsLoading = refDebounced(isLoading, 300);
16
+
17
+ const save = () => {
18
+ if (checkIfInvalid && !checkIfInvalid()) return;
19
+ return saveItem();
20
+ };
21
+
22
+ return {
23
+ debouncedIsLoading,
24
+ save,
25
+ };
26
+ };
@@ -0,0 +1,22 @@
1
+ import { computed, Ref } from 'vue';
2
+ import { useI18n } from 'vue-i18n';
3
+
4
+ export const useItemCardSaveText = ({
5
+ isNew,
6
+ isEdited,
7
+ }: {
8
+ isNew: Ref<boolean>;
9
+ isEdited: Ref<boolean>;
10
+ }) => {
11
+ const { t } = useI18n();
12
+
13
+ const saveText = computed(() => {
14
+ return isNew.value || isEdited.value
15
+ ? t('reusable.save')
16
+ : t('reusable.saved');
17
+ });
18
+
19
+ return {
20
+ saveText,
21
+ };
22
+ };
@@ -0,0 +1,34 @@
1
+ import {
2
+ RegleSchema,
3
+ } from '@regle/schemas';
4
+ import { computed, Ref } from 'vue';
5
+
6
+ export const useValidation = <TState, TSchema>({
7
+ validationSchema,
8
+ }: {
9
+ validationSchema: Ref<RegleSchema<TState, TSchema>>,
10
+ }) => {
11
+ const disabledSave = computed(() => {
12
+ return validationSchema.value.r$.$error;
13
+ });
14
+
15
+ const isEdited = computed(() => {
16
+ return validationSchema.value.r$.$anyEdited;
17
+ });
18
+
19
+ const touch = () => {
20
+ validationSchema.value.r$.$touch();
21
+ };
22
+
23
+ const checkIfInvalid = () => {
24
+ touch();
25
+ return disabledSave.value;
26
+ };
27
+
28
+ return {
29
+ disabledSave,
30
+ isEdited,
31
+ touch,
32
+ checkIfInvalid,
33
+ };
34
+ };
@@ -1 +1,4 @@
1
+ export * from './composables/useFormComponent';
2
+ export * from './composables/useItemCardSaveText';
3
+ export * from './composables/useValidation';
1
4
  export * from './stores/createFormStore';
@@ -1,8 +1,8 @@
1
- import { ref } from 'vue';
2
- import { useRegleSchema, RegleSchemaBehaviourOptions } from '@regle/schemas';
1
+ import { RegleSchemaBehaviourOptions,useRegleSchema } from '@regle/schemas';
3
2
  import type { StandardSchemaV1 } from '@standard-schema/spec';
4
3
  import { ApiModule } from '@webitel/ui-sdk/api/types/ApiModule.type';
5
4
  import { defineStore } from 'pinia';
5
+ import { ref } from 'vue';
6
6
 
7
7
  export const createFormStore = <Entity = object>({
8
8
  namespace,
@@ -73,7 +73,7 @@ export const createFormStore = <Entity = object>({
73
73
  itemInstance?: Entity;
74
74
  itemId?: string | number;
75
75
  parentId?: string | number;
76
- }) => {
76
+ } = {}) => {
77
77
  if (initialParentId) {
78
78
  parentId.value = initialParentId;
79
79
  }
@@ -102,6 +102,7 @@ export const createFormStore = <Entity = object>({
102
102
  error,
103
103
 
104
104
  initialize,
105
+ saveItem,
105
106
  };
106
107
  });
107
108
  };
@@ -0,0 +1,11 @@
1
+ type __VLS_PublicProps = {
2
+ modelValue?: string;
3
+ };
4
+ declare const _default: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
5
+ "update:modelValue": (value: string) => any;
6
+ "update:invalid": (args_0: boolean) => any;
7
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
8
+ "onUpdate:modelValue"?: (value: string) => any;
9
+ "onUpdate:invalid"?: (args_0: boolean) => any;
10
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
11
+ export default _default;
@@ -0,0 +1,16 @@
1
+ import { AnyFilterConfig } from "../../modules/filterConfig/classes/FilterConfig";
2
+ type __VLS_Props = {
3
+ filterConfig: AnyFilterConfig;
4
+ label?: string;
5
+ };
6
+ type __VLS_PublicProps = __VLS_Props & {
7
+ modelValue?: unknown;
8
+ };
9
+ declare const _default: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
10
+ "update:modelValue": (value: unknown) => any;
11
+ "update:invalid": (args_0: boolean) => any;
12
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
13
+ "onUpdate:modelValue"?: (value: unknown) => any;
14
+ "onUpdate:invalid"?: (args_0: boolean) => any;
15
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
16
+ export default _default;
@@ -0,0 +1,93 @@
1
+ import { WtButton, WtSelect } from '@webitel/ui-sdk/components';
2
+ import { FilterInitParams, IFilter } from "../../classes/Filter";
3
+ import { BaseFilterConfig } from "../../modules/filterConfig/classes/FilterConfig";
4
+ import DynamicFilterConfigFormLabel from './dynamic-filter-config-form-label.vue';
5
+ import DynamicFilterConfigFormValueInput from "./dynamic-filter-config-form-value-input.vue";
6
+ type __VLS_Props = {
7
+ /**
8
+ * @description
9
+ * "Add" mode
10
+ */
11
+ filterConfigs?: BaseFilterConfig[];
12
+ /**
13
+ * @description
14
+ * "Edit" mode
15
+ */
16
+ filterConfig?: BaseFilterConfig;
17
+ /**
18
+ * @description
19
+ * Edited filter instance
20
+ */
21
+ filter?: IFilter;
22
+ };
23
+ declare const emit: ((evt: "submit", args_0: FilterInitParams) => void) & ((evt: "cancel") => void);
24
+ declare const t: import("vue-i18n").ComposerTranslation<{
25
+ [x: string]: import("@intlify/core-base").LocaleMessage<import("vue-i18n").VueMessageType>;
26
+ }, string, import("@intlify/core-base").RemoveIndexSignature<{
27
+ [x: string]: import("vue-i18n").LocaleMessageValue<import("vue-i18n").VueMessageType>;
28
+ }>, never, never, never>;
29
+ declare const filterName: import("vue").Ref<any, any>;
30
+ declare const filterLabel: import("vue").Ref<string, string>;
31
+ declare const filterValue: import("vue").Ref<any, any>;
32
+ declare const editMode: boolean;
33
+ declare const invalid: import("vue").Ref<boolean, boolean>;
34
+ declare const filterConfigOptions: import("vue").ComputedRef<BaseFilterConfig[]>;
35
+ declare const selectedFilterConfig: import("vue").ComputedRef<BaseFilterConfig>;
36
+ declare const onValueChange: (v: any) => void;
37
+ declare const onValueInvalidChange: (v: any) => void;
38
+ declare const valueInputLabelText: import("vue").ComputedRef<string>;
39
+ declare const onLabelValueUpdate: (val: string) => void;
40
+ declare const onFilterNameUpdate: (val: string) => void;
41
+ declare const submit: () => void;
42
+ declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
43
+ declare var __VLS_9: {
44
+ filterName: any;
45
+ filterValue: any;
46
+ inputLabel: string;
47
+ onValueChange: (v: any) => void;
48
+ onValueInvalidChange: (v: any) => void;
49
+ };
50
+ type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
51
+ 'value-input'?: (props: typeof __VLS_9) => any;
52
+ }>;
53
+ declare const __VLS_self: import("vue").DefineComponent<__VLS_Props, {
54
+ WtButton: typeof WtButton;
55
+ WtSelect: typeof WtSelect;
56
+ DynamicFilterConfigFormLabel: typeof DynamicFilterConfigFormLabel;
57
+ DynamicFilterConfigFormValueInput: typeof DynamicFilterConfigFormValueInput;
58
+ emit: typeof emit;
59
+ t: typeof t;
60
+ filterName: typeof filterName;
61
+ filterLabel: typeof filterLabel;
62
+ filterValue: typeof filterValue;
63
+ editMode: typeof editMode;
64
+ invalid: typeof invalid;
65
+ filterConfigOptions: typeof filterConfigOptions;
66
+ selectedFilterConfig: typeof selectedFilterConfig;
67
+ onValueChange: typeof onValueChange;
68
+ onValueInvalidChange: typeof onValueInvalidChange;
69
+ valueInputLabelText: typeof valueInputLabelText;
70
+ onLabelValueUpdate: typeof onLabelValueUpdate;
71
+ onFilterNameUpdate: typeof onFilterNameUpdate;
72
+ submit: typeof submit;
73
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
74
+ submit: (args_0: FilterInitParams) => any;
75
+ cancel: () => any;
76
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
77
+ onSubmit?: (args_0: FilterInitParams) => any;
78
+ onCancel?: () => any;
79
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
80
+ declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
81
+ submit: (args_0: FilterInitParams) => any;
82
+ cancel: () => any;
83
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
84
+ onSubmit?: (args_0: FilterInitParams) => any;
85
+ onCancel?: () => any;
86
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
87
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
88
+ export default _default;
89
+ type __VLS_WithSlots<T, S> = T & {
90
+ new (): {
91
+ $slots: S;
92
+ };
93
+ };
@@ -0,0 +1,27 @@
1
+ import { WtTooltip } from '@webitel/ui-sdk/components';
2
+ interface Props {
3
+ disabled?: boolean;
4
+ disableClickAway?: boolean;
5
+ }
6
+ declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
7
+ declare var __VLS_5: {
8
+ tooltipSlotScope: any;
9
+ }, __VLS_7: {
10
+ tooltipSlotScope: any;
11
+ };
12
+ type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
13
+ activator?: (props: typeof __VLS_5) => any;
14
+ } & {
15
+ content?: (props: typeof __VLS_7) => any;
16
+ }>;
17
+ declare const __VLS_self: import("vue").DefineComponent<Props, {
18
+ WtTooltip: typeof WtTooltip;
19
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
20
+ declare const __VLS_component: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
21
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
22
+ export default _default;
23
+ type __VLS_WithSlots<T, S> = T & {
24
+ new (): {
25
+ $slots: S;
26
+ };
27
+ };
@@ -0,0 +1,9 @@
1
+ import { Ref } from 'vue';
2
+ export declare const useFormComponent: ({ checkIfInvalid, isLoading, saveItem, }: {
3
+ checkIfInvalid?: () => boolean;
4
+ isLoading?: Ref<boolean>;
5
+ saveItem: () => Promise<unknown>;
6
+ }) => {
7
+ debouncedIsLoading: Readonly<Ref<boolean, boolean>>;
8
+ save: () => Promise<unknown>;
9
+ };
@@ -0,0 +1,7 @@
1
+ import { Ref } from 'vue';
2
+ export declare const useItemCardSaveText: ({ isNew, isEdited, }: {
3
+ isNew: Ref<boolean>;
4
+ isEdited: Ref<boolean>;
5
+ }) => {
6
+ saveText: import("vue").ComputedRef<string>;
7
+ };
@@ -0,0 +1,10 @@
1
+ import { RegleSchema } from '@regle/schemas';
2
+ import { Ref } from 'vue';
3
+ export declare const useValidation: <TState, TSchema>({ validationSchema, }: {
4
+ validationSchema: Ref<RegleSchema<TState, TSchema>>;
5
+ }) => {
6
+ disabledSave: import("vue").ComputedRef<boolean>;
7
+ isEdited: import("vue").ComputedRef<boolean>;
8
+ touch: () => void;
9
+ checkIfInvalid: () => boolean;
10
+ };
@@ -1 +1,4 @@
1
+ export * from './composables/useFormComponent';
2
+ export * from './composables/useItemCardSaveText';
3
+ export * from './composables/useValidation';
1
4
  export * from './stores/createFormStore';
@@ -14,11 +14,12 @@ export declare const createFormStore: <Entity = object>({ namespace, apiModule,
14
14
  isLoading: import("vue").Ref<boolean, boolean>;
15
15
  isSaving: import("vue").Ref<boolean, boolean>;
16
16
  error: import("vue").Ref<any, any>;
17
- initialize: ({ itemInstance: initialItemInstance, itemId: initialItemId, parentId: initialParentId, }: {
17
+ initialize: ({ itemInstance: initialItemInstance, itemId: initialItemId, parentId: initialParentId, }?: {
18
18
  itemInstance?: Entity;
19
19
  itemId?: string | number;
20
20
  parentId?: string | number;
21
21
  }) => Promise<void>;
22
+ saveItem: () => Promise<void>;
22
23
  }, keyof ({
23
24
  parentId: import("vue").Ref<string | number, string | number>;
24
25
  itemId: import("vue").Ref<string | number, string | number>;
@@ -27,11 +28,12 @@ export declare const createFormStore: <Entity = object>({ namespace, apiModule,
27
28
  isLoading: import("vue").Ref<boolean, boolean>;
28
29
  isSaving: import("vue").Ref<boolean, boolean>;
29
30
  error: import("vue").Ref<any, any>;
30
- initialize: ({ itemInstance: initialItemInstance, itemId: initialItemId, parentId: initialParentId, }: {
31
+ initialize: ({ itemInstance: initialItemInstance, itemId: initialItemId, parentId: initialParentId, }?: {
31
32
  itemInstance?: Entity;
32
33
  itemId?: string | number;
33
34
  parentId?: string | number;
34
35
  }) => Promise<void>;
36
+ saveItem: () => Promise<void>;
35
37
  } extends infer T ? { [K in keyof T as {
36
38
  parentId: import("vue").Ref<string | number, string | number>;
37
39
  itemId: import("vue").Ref<string | number, string | number>;
@@ -40,11 +42,12 @@ export declare const createFormStore: <Entity = object>({ namespace, apiModule,
40
42
  isLoading: import("vue").Ref<boolean, boolean>;
41
43
  isSaving: import("vue").Ref<boolean, boolean>;
42
44
  error: import("vue").Ref<any, any>;
43
- initialize: ({ itemInstance: initialItemInstance, itemId: initialItemId, parentId: initialParentId, }: {
45
+ initialize: ({ itemInstance: initialItemInstance, itemId: initialItemId, parentId: initialParentId, }?: {
44
46
  itemInstance?: Entity;
45
47
  itemId?: string | number;
46
48
  parentId?: string | number;
47
49
  }) => Promise<void>;
50
+ saveItem: () => Promise<void>;
48
51
  }[K] extends import("vue").ComputedRef<any> | import("pinia")._Method ? never : K]: any; } : never)>, Pick<{
49
52
  parentId: import("vue").Ref<string | number, string | number>;
50
53
  itemId: import("vue").Ref<string | number, string | number>;
@@ -53,11 +56,12 @@ export declare const createFormStore: <Entity = object>({ namespace, apiModule,
53
56
  isLoading: import("vue").Ref<boolean, boolean>;
54
57
  isSaving: import("vue").Ref<boolean, boolean>;
55
58
  error: import("vue").Ref<any, any>;
56
- initialize: ({ itemInstance: initialItemInstance, itemId: initialItemId, parentId: initialParentId, }: {
59
+ initialize: ({ itemInstance: initialItemInstance, itemId: initialItemId, parentId: initialParentId, }?: {
57
60
  itemInstance?: Entity;
58
61
  itemId?: string | number;
59
62
  parentId?: string | number;
60
63
  }) => Promise<void>;
64
+ saveItem: () => Promise<void>;
61
65
  }, keyof ({
62
66
  parentId: import("vue").Ref<string | number, string | number>;
63
67
  itemId: import("vue").Ref<string | number, string | number>;
@@ -66,11 +70,12 @@ export declare const createFormStore: <Entity = object>({ namespace, apiModule,
66
70
  isLoading: import("vue").Ref<boolean, boolean>;
67
71
  isSaving: import("vue").Ref<boolean, boolean>;
68
72
  error: import("vue").Ref<any, any>;
69
- initialize: ({ itemInstance: initialItemInstance, itemId: initialItemId, parentId: initialParentId, }: {
73
+ initialize: ({ itemInstance: initialItemInstance, itemId: initialItemId, parentId: initialParentId, }?: {
70
74
  itemInstance?: Entity;
71
75
  itemId?: string | number;
72
76
  parentId?: string | number;
73
77
  }) => Promise<void>;
78
+ saveItem: () => Promise<void>;
74
79
  } extends infer T_1 ? { [K_1 in keyof T_1 as {
75
80
  parentId: import("vue").Ref<string | number, string | number>;
76
81
  itemId: import("vue").Ref<string | number, string | number>;
@@ -79,11 +84,12 @@ export declare const createFormStore: <Entity = object>({ namespace, apiModule,
79
84
  isLoading: import("vue").Ref<boolean, boolean>;
80
85
  isSaving: import("vue").Ref<boolean, boolean>;
81
86
  error: import("vue").Ref<any, any>;
82
- initialize: ({ itemInstance: initialItemInstance, itemId: initialItemId, parentId: initialParentId, }: {
87
+ initialize: ({ itemInstance: initialItemInstance, itemId: initialItemId, parentId: initialParentId, }?: {
83
88
  itemInstance?: Entity;
84
89
  itemId?: string | number;
85
90
  parentId?: string | number;
86
91
  }) => Promise<void>;
92
+ saveItem: () => Promise<void>;
87
93
  }[K_1] extends import("vue").ComputedRef<any> ? K_1 : never]: any; } : never)>, Pick<{
88
94
  parentId: import("vue").Ref<string | number, string | number>;
89
95
  itemId: import("vue").Ref<string | number, string | number>;
@@ -92,11 +98,12 @@ export declare const createFormStore: <Entity = object>({ namespace, apiModule,
92
98
  isLoading: import("vue").Ref<boolean, boolean>;
93
99
  isSaving: import("vue").Ref<boolean, boolean>;
94
100
  error: import("vue").Ref<any, any>;
95
- initialize: ({ itemInstance: initialItemInstance, itemId: initialItemId, parentId: initialParentId, }: {
101
+ initialize: ({ itemInstance: initialItemInstance, itemId: initialItemId, parentId: initialParentId, }?: {
96
102
  itemInstance?: Entity;
97
103
  itemId?: string | number;
98
104
  parentId?: string | number;
99
105
  }) => Promise<void>;
106
+ saveItem: () => Promise<void>;
100
107
  }, keyof ({
101
108
  parentId: import("vue").Ref<string | number, string | number>;
102
109
  itemId: import("vue").Ref<string | number, string | number>;
@@ -105,11 +112,12 @@ export declare const createFormStore: <Entity = object>({ namespace, apiModule,
105
112
  isLoading: import("vue").Ref<boolean, boolean>;
106
113
  isSaving: import("vue").Ref<boolean, boolean>;
107
114
  error: import("vue").Ref<any, any>;
108
- initialize: ({ itemInstance: initialItemInstance, itemId: initialItemId, parentId: initialParentId, }: {
115
+ initialize: ({ itemInstance: initialItemInstance, itemId: initialItemId, parentId: initialParentId, }?: {
109
116
  itemInstance?: Entity;
110
117
  itemId?: string | number;
111
118
  parentId?: string | number;
112
119
  }) => Promise<void>;
120
+ saveItem: () => Promise<void>;
113
121
  } extends infer T_2 ? { [K_2 in keyof T_2 as {
114
122
  parentId: import("vue").Ref<string | number, string | number>;
115
123
  itemId: import("vue").Ref<string | number, string | number>;
@@ -118,9 +126,10 @@ export declare const createFormStore: <Entity = object>({ namespace, apiModule,
118
126
  isLoading: import("vue").Ref<boolean, boolean>;
119
127
  isSaving: import("vue").Ref<boolean, boolean>;
120
128
  error: import("vue").Ref<any, any>;
121
- initialize: ({ itemInstance: initialItemInstance, itemId: initialItemId, parentId: initialParentId, }: {
129
+ initialize: ({ itemInstance: initialItemInstance, itemId: initialItemId, parentId: initialParentId, }?: {
122
130
  itemInstance?: Entity;
123
131
  itemId?: string | number;
124
132
  parentId?: string | number;
125
133
  }) => Promise<void>;
134
+ saveItem: () => Promise<void>;
126
135
  }[K_2] extends import("pinia")._Method ? K_2 : never]: any; } : never)>>;