@webitel/ui-datalist 1.1.14 → 1.1.15

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.1.14",
3
+ "version": "1.1.15",
4
4
  "description": "Toolkit for building data lists in webitel ui system",
5
5
  "scripts": {
6
6
  "make-all": "npm version patch --git-tag-version false && ( npm run lint:fix || true) && (npm run build:types || true) && npm run utils:publish",
@@ -1,6 +1,6 @@
1
1
  import { refDebounced } from '@vueuse/core';
2
2
  import { StoreDefinition, storeToRefs } from 'pinia';
3
- import { onUnmounted } from 'vue';
3
+ import { onUnmounted, watch } from 'vue';
4
4
 
5
5
  import { useCardAnyFieldEditedWatcher } from './useCardAnyFieldEditedWatcher';
6
6
  import { useCardIsNew } from './useCardIsNew';
@@ -11,8 +11,10 @@ import { useItemCardSaveText } from './useItemCardSaveText';
11
11
 
12
12
  export const useCardComponent = <CardEntity>({
13
13
  useCardStore,
14
+ onLoadErrorHandler,
14
15
  }: {
15
16
  useCardStore: StoreDefinition;
17
+ onLoadErrorHandler?: (err: any) => void;
16
18
  }) => {
17
19
  const cardStore = useCardStore();
18
20
 
@@ -22,7 +24,7 @@ export const useCardComponent = <CardEntity>({
22
24
  validationSchema,
23
25
  isLoading,
24
26
  // isSaving, // todo: use me
25
- // error, // todo: use me
27
+ error,
26
28
  } = storeToRefs(cardStore);
27
29
 
28
30
  const { initialize, saveItem, $reset } = cardStore;
@@ -63,6 +65,10 @@ export const useCardComponent = <CardEntity>({
63
65
 
64
66
  onUnmounted($reset);
65
67
 
68
+ watch(error, (err) => {
69
+ if (onLoadErrorHandler) onLoadErrorHandler(err);
70
+ });
71
+
66
72
  return {
67
73
  // models
68
74
  modelValue,
@@ -70,6 +76,7 @@ export const useCardComponent = <CardEntity>({
70
76
  // state
71
77
  debouncedIsLoading,
72
78
  originalItemInstance,
79
+ error,
73
80
 
74
81
  // computed
75
82
  isNew,
@@ -1,10 +1,12 @@
1
1
  import { StoreDefinition } from 'pinia';
2
- export declare const useCardComponent: <CardEntity>({ useCardStore, }: {
2
+ export declare const useCardComponent: <CardEntity>({ useCardStore, onLoadErrorHandler, }: {
3
3
  useCardStore: StoreDefinition;
4
+ onLoadErrorHandler?: (err: any) => void;
4
5
  }) => {
5
6
  modelValue: import("vue").ComputedRef<unknown>;
6
7
  debouncedIsLoading: Readonly<import("vue").Ref<any, any>>;
7
8
  originalItemInstance: import("vue").Ref<any, any> & import("vue").ComputedRef<any>;
9
+ error: import("vue").Ref<any, any> & import("vue").ComputedRef<any>;
8
10
  isNew: import("vue").ComputedRef<boolean>;
9
11
  saveText: import("vue").ComputedRef<any>;
10
12
  hasValidationErrors: import("vue").ComputedRef<boolean>;