@webitel/ui-datalist 26.8.3 → 26.8.4
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 +1 -1
- package/src/modules/card/composables/__tests__/useCardRouting.spec.ts +146 -0
- package/src/modules/card/composables/useCardRouting.ts +12 -6
- package/src/modules/card/composables/useNestedCardComponent.ts +8 -5
- package/src/modules/card/stores/createCardStore.ts +1 -1
- package/src/modules/table/__tests__/createTableStore.spec.ts +186 -0
- package/types/.tsbuildinfo +1 -1
- package/types/modules/card/composables/useCardRouting.d.ts +10 -6
- package/types/modules/card/composables/useNestedCardComponent.d.ts +6 -2
- package/types/modules/card/stores/createCardStore.d.ts +10 -10
- package/types/modules/filters/modules/filterConfig/components/case-service/config.d.ts +1 -1
|
@@ -1,18 +1,22 @@
|
|
|
1
|
-
import { type Ref } from 'vue';
|
|
2
|
-
import type { CardItemId } from '../types/CardStore.types';
|
|
1
|
+
import { type MaybeRefOrGetter, type Ref } from 'vue';
|
|
2
|
+
import type { CardItemId, CardParentId } from '../types/CardStore.types';
|
|
3
3
|
/**
|
|
4
4
|
* Routing logic shared by top-level and nested card components.
|
|
5
5
|
*
|
|
6
6
|
* - `routeParamName` — which `route.params` key holds the item ID (default: `'id'`)
|
|
7
7
|
* - `parentId` — when provided, the card is treated as nested: URL is updated
|
|
8
|
-
* only when a newly created item receives its server-assigned ID
|
|
8
|
+
* only when a newly created item receives its server-assigned ID. Pass a ref
|
|
9
|
+
* or a getter whenever the parent can be created while the card is already
|
|
10
|
+
* mounted — a popup living inside its parent's card page watches
|
|
11
|
+
* `route.params.id` go from `'new'` to a real id underneath it, and a plain
|
|
12
|
+
* string captured at setup would keep addressing `'new'`.
|
|
9
13
|
*/
|
|
10
|
-
export declare const useCardRouting: ({ itemId, routeParamName, parentId, manualSetup, }: {
|
|
14
|
+
export declare const useCardRouting: ({ itemId, routeParamName, parentId: rawParentId, manualSetup, }: {
|
|
11
15
|
itemId: Ref<CardItemId>;
|
|
12
16
|
routeParamName?: string;
|
|
13
|
-
parentId?:
|
|
17
|
+
parentId?: MaybeRefOrGetter<CardParentId>;
|
|
14
18
|
manualSetup?: boolean;
|
|
15
19
|
}) => {
|
|
16
20
|
routeId: import("vue").ComputedRef<any>;
|
|
17
|
-
parentId: string | undefined
|
|
21
|
+
parentId: import("vue").ComputedRef<string | number | null | undefined>;
|
|
18
22
|
};
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { type StoreDefinition } from 'pinia';
|
|
2
|
+
import { type MaybeRefOrGetter } from 'vue';
|
|
3
|
+
import type { CardParentId } from '../types/CardStore.types';
|
|
2
4
|
/**
|
|
3
5
|
* Composable for nested (popup) card components.
|
|
4
6
|
*
|
|
5
7
|
* Wraps `useCardComponent` with `manualSetup: true` and delegates
|
|
6
8
|
* routing to `useCardRouting`. Pass `parentId` from the component —
|
|
7
|
-
* its presence indicates a nested card context.
|
|
9
|
+
* its presence indicates a nested card context. A ref or getter is read on
|
|
10
|
+
* every `initialize`, so a popup mounted while its parent was still `'new'`
|
|
11
|
+
* follows the parent's real id instead of addressing `'new'` forever.
|
|
8
12
|
*
|
|
9
13
|
* @example
|
|
10
14
|
* ```ts
|
|
@@ -21,7 +25,7 @@ export declare const useNestedCardComponent: <CardEntity extends Record<string,
|
|
|
21
25
|
useCardStore: StoreDefinition;
|
|
22
26
|
onLoadErrorHandler?: (err: unknown) => void;
|
|
23
27
|
routeParamName: string;
|
|
24
|
-
parentId?:
|
|
28
|
+
parentId?: MaybeRefOrGetter<CardParentId>;
|
|
25
29
|
}) => {
|
|
26
30
|
modelValue: import("vue").ComputedRef<import("@regle/core").JoinDiscriminatedUnions<import("vue").UnwrapNestedRefs<CardEntity>> | import("@regle/schemas").RegleSchemaStatus<CardEntity, {}, true>["$value"]>;
|
|
27
31
|
debouncedIsLoading: Readonly<import("vue").Ref<any, any>>;
|
|
@@ -2,7 +2,7 @@ import { type RegleSchemaBehaviourOptions } from '@regle/schemas';
|
|
|
2
2
|
import type { ApiModule } from '@webitel/ui-sdk/src/api/types/ApiModule';
|
|
3
3
|
import type { MaybeRef } from 'vue';
|
|
4
4
|
import type { z } from 'zod/v4';
|
|
5
|
-
import type { CardItemId } from '../types/CardStore.types';
|
|
5
|
+
import type { CardItemId, CardParentId } from '../types/CardStore.types';
|
|
6
6
|
export declare const createCardStore: <Entity extends {
|
|
7
7
|
id?: string | number;
|
|
8
8
|
} = {
|
|
@@ -27,7 +27,7 @@ export declare const createCardStore: <Entity extends {
|
|
|
27
27
|
error: import("vue").Ref<unknown, unknown>;
|
|
28
28
|
initialize: ({ itemId: initialItemId, parentId: initialParentId, }?: {
|
|
29
29
|
itemId?: string | number;
|
|
30
|
-
parentId?:
|
|
30
|
+
parentId?: CardParentId;
|
|
31
31
|
}) => Promise<void>;
|
|
32
32
|
saveItem: (draft: Entity) => Promise<void>;
|
|
33
33
|
$reset: () => void;
|
|
@@ -42,7 +42,7 @@ export declare const createCardStore: <Entity extends {
|
|
|
42
42
|
error: import("vue").Ref<unknown, unknown>;
|
|
43
43
|
initialize: ({ itemId: initialItemId, parentId: initialParentId, }?: {
|
|
44
44
|
itemId?: string | number;
|
|
45
|
-
parentId?:
|
|
45
|
+
parentId?: CardParentId;
|
|
46
46
|
}) => Promise<void>;
|
|
47
47
|
saveItem: (draft: Entity) => Promise<void>;
|
|
48
48
|
$reset: () => void;
|
|
@@ -57,7 +57,7 @@ export declare const createCardStore: <Entity extends {
|
|
|
57
57
|
error: import("vue").Ref<unknown, unknown>;
|
|
58
58
|
initialize: ({ itemId: initialItemId, parentId: initialParentId, }?: {
|
|
59
59
|
itemId?: string | number;
|
|
60
|
-
parentId?:
|
|
60
|
+
parentId?: CardParentId;
|
|
61
61
|
}) => Promise<void>;
|
|
62
62
|
saveItem: (draft: Entity) => Promise<void>;
|
|
63
63
|
$reset: () => void;
|
|
@@ -72,7 +72,7 @@ export declare const createCardStore: <Entity extends {
|
|
|
72
72
|
error: import("vue").Ref<unknown, unknown>;
|
|
73
73
|
initialize: ({ itemId: initialItemId, parentId: initialParentId, }?: {
|
|
74
74
|
itemId?: string | number;
|
|
75
|
-
parentId?:
|
|
75
|
+
parentId?: CardParentId;
|
|
76
76
|
}) => Promise<void>;
|
|
77
77
|
saveItem: (draft: Entity) => Promise<void>;
|
|
78
78
|
$reset: () => void;
|
|
@@ -87,7 +87,7 @@ export declare const createCardStore: <Entity extends {
|
|
|
87
87
|
error: import("vue").Ref<unknown, unknown>;
|
|
88
88
|
initialize: ({ itemId: initialItemId, parentId: initialParentId, }?: {
|
|
89
89
|
itemId?: string | number;
|
|
90
|
-
parentId?:
|
|
90
|
+
parentId?: CardParentId;
|
|
91
91
|
}) => Promise<void>;
|
|
92
92
|
saveItem: (draft: Entity) => Promise<void>;
|
|
93
93
|
$reset: () => void;
|
|
@@ -102,7 +102,7 @@ export declare const createCardStore: <Entity extends {
|
|
|
102
102
|
error: import("vue").Ref<unknown, unknown>;
|
|
103
103
|
initialize: ({ itemId: initialItemId, parentId: initialParentId, }?: {
|
|
104
104
|
itemId?: string | number;
|
|
105
|
-
parentId?:
|
|
105
|
+
parentId?: CardParentId;
|
|
106
106
|
}) => Promise<void>;
|
|
107
107
|
saveItem: (draft: Entity) => Promise<void>;
|
|
108
108
|
$reset: () => void;
|
|
@@ -117,7 +117,7 @@ export declare const createCardStore: <Entity extends {
|
|
|
117
117
|
error: import("vue").Ref<unknown, unknown>;
|
|
118
118
|
initialize: ({ itemId: initialItemId, parentId: initialParentId, }?: {
|
|
119
119
|
itemId?: string | number;
|
|
120
|
-
parentId?:
|
|
120
|
+
parentId?: CardParentId;
|
|
121
121
|
}) => Promise<void>;
|
|
122
122
|
saveItem: (draft: Entity) => Promise<void>;
|
|
123
123
|
$reset: () => void;
|
|
@@ -132,7 +132,7 @@ export declare const createCardStore: <Entity extends {
|
|
|
132
132
|
error: import("vue").Ref<unknown, unknown>;
|
|
133
133
|
initialize: ({ itemId: initialItemId, parentId: initialParentId, }?: {
|
|
134
134
|
itemId?: string | number;
|
|
135
|
-
parentId?:
|
|
135
|
+
parentId?: CardParentId;
|
|
136
136
|
}) => Promise<void>;
|
|
137
137
|
saveItem: (draft: Entity) => Promise<void>;
|
|
138
138
|
$reset: () => void;
|
|
@@ -147,7 +147,7 @@ export declare const createCardStore: <Entity extends {
|
|
|
147
147
|
error: import("vue").Ref<unknown, unknown>;
|
|
148
148
|
initialize: ({ itemId: initialItemId, parentId: initialParentId, }?: {
|
|
149
149
|
itemId?: string | number;
|
|
150
|
-
parentId?:
|
|
150
|
+
parentId?: CardParentId;
|
|
151
151
|
}) => Promise<void>;
|
|
152
152
|
saveItem: (draft: Entity) => Promise<void>;
|
|
153
153
|
$reset: () => void;
|
|
@@ -4,7 +4,7 @@ export const searchMethod: (params: import("@webitel/api-services/api/clients/_s
|
|
|
4
4
|
}>;
|
|
5
5
|
export const servicesSearchMethod: (params: Parameters<({ parentId, rootId, ...rest }: {
|
|
6
6
|
parentId?: import("@webitel/api-services/api/clients/_shared/types").ApiId;
|
|
7
|
-
rootId
|
|
7
|
+
rootId?: import("@webitel/api-services/api/clients/_shared/types").ApiId;
|
|
8
8
|
} & import("@webitel/api-services/api/clients/_shared/types").ApiParams) => Promise<{
|
|
9
9
|
items: any;
|
|
10
10
|
next: any;
|