@dxtmisha/functional 1.15.2 → 1.15.5
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/CHANGELOG.md +26 -0
- package/README.md +42 -21
- package/ai-description.md +29 -25
- package/ai-doc.md +36 -106
- package/ai-types.md +379 -392
- package/dist/classes/ref/GeoIntlRef.d.ts +7 -0
- package/dist/composables/ref/useGeoIntlRef.d.ts +7 -0
- package/dist/composables/ref/useLazyItemByMarginRef.d.ts +6 -4
- package/dist/composables/ref/useLazyRef.d.ts +1 -1
- package/dist/composables/ref/useMeta.d.ts +5 -5
- package/dist/composables/ref/useSearchRef.d.ts +2 -2
- package/dist/library.js +17 -18
- package/dist/types/searchTypes.d.ts +5 -1
- package/package.json +36 -11
package/ai-types.md
CHANGED
|
@@ -6,46 +6,31 @@ The following is the content of "exports" from package.json:
|
|
|
6
6
|
{
|
|
7
7
|
".": {
|
|
8
8
|
"import": "./dist/library.js",
|
|
9
|
-
"types": "./dist/
|
|
9
|
+
"types": "./dist/library.d.ts"
|
|
10
10
|
},
|
|
11
11
|
"./flags": {
|
|
12
12
|
"import": "./dist/flags.js",
|
|
13
|
-
"types": "./dist/
|
|
13
|
+
"types": "./dist/flags.d.ts"
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
export * from '@dxtmisha/functional-basic';
|
|
18
18
|
export declare abstract class DesignAbstract<T extends Record<string, any>, C extends Record<string, any>> {
|
|
19
19
|
constructor(props: T, callback?: ((event: C) => void) | undefined, changed?: string[]);
|
|
20
20
|
make(compelled?: boolean): this;
|
|
21
21
|
makeCallback(compelled?: boolean): void;
|
|
22
22
|
}
|
|
23
|
-
|
|
24
|
-
// File: src/classes/design/DesignAsyncAbstract.d.ts
|
|
25
|
-
import { DesignAbstract } from './DesignAbstract';
|
|
26
23
|
export declare abstract class DesignAsyncAbstract<T extends Record<string, any>, C extends Record<string, any>> extends DesignAbstract<T, C> {
|
|
27
24
|
make(compelled?: boolean): this;
|
|
28
25
|
makeCallback(compelled?: boolean): Promise<void>;
|
|
29
26
|
}
|
|
30
|
-
|
|
31
|
-
// File: src/classes/design/DesignChanged.d.ts
|
|
32
27
|
export declare class DesignChanged<T extends Record<string, any>> {
|
|
33
28
|
constructor(props: T, watch?: string[]);
|
|
34
29
|
is(name: string | string[]): boolean;
|
|
35
30
|
isChanged(): boolean;
|
|
36
31
|
update(): void;
|
|
37
32
|
}
|
|
38
|
-
|
|
39
|
-
// File: src/classes/design/DesignComp.d.ts
|
|
40
|
-
import { DesignComponents } from './DesignComponents';
|
|
41
|
-
import { ConstrComponent, ConstrItem } from '../../types/constructorTypes';
|
|
42
|
-
export declare class DesignComp<COMP extends ConstrComponent, P extends ConstrItem> extends DesignComponents<COMP, P> {
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
// File: src/classes/design/DesignComponents.d.ts
|
|
46
|
-
import { ComputedRef, VNode } from 'vue';
|
|
47
|
-
import { RawChildren, RawSlots } from '../../types/refTypes';
|
|
48
|
-
import { ConstrComponent, ConstrComponentMod, ConstrItem } from '../../types/constructorTypes';
|
|
33
|
+
export declare class DesignComp<COMP extends ConstrComponent, P extends ConstrItem> extends DesignComponents<COMP, P> {}
|
|
49
34
|
export declare class DesignComponents<COMP extends ConstrComponent, P extends ConstrItem> {
|
|
50
35
|
constructor(components?: COMP, modification?: ConstrComponentMod<P> | undefined);
|
|
51
36
|
is<K extends keyof COMP>(name: K): name is K;
|
|
@@ -55,14 +40,7 @@ export declare class DesignComponents<COMP extends ConstrComponent, P extends Co
|
|
|
55
40
|
renderOne<K extends keyof COMP, PK extends keyof P>(name: K & string, props?: P[PK] & ConstrItem | ConstrItem, children?: RawChildren | RawSlots, index?: PK & string | string): VNode | undefined;
|
|
56
41
|
renderAdd<K extends keyof COMP, PK extends keyof P>(item: any[], name: K & string, props?: P[PK] & ConstrItem | ConstrItem, children?: RawChildren | RawSlots, index?: PK & string | string): this;
|
|
57
42
|
}
|
|
58
|
-
|
|
59
|
-
// File: src/classes/design/DesignConstructorAbstract.d.ts
|
|
60
|
-
import { ComputedRef, ToRefs, VNode, Ref } from 'vue';
|
|
61
|
-
import { DesignComponents } from './DesignComponents';
|
|
62
|
-
import { ConstrClass, ConstrClasses, ConstrClassObject, ConstrComponent, ConstrEmit, ConstrExpose, ConstrItem, ConstrOptions, ConstrStyles } from '../../types/constructorTypes';
|
|
63
43
|
export declare abstract class DesignConstructorAbstract<E extends Element, COMP extends ConstrComponent, EMITS extends ConstrItem, EXPOSE extends ConstrItem, SLOTS extends ConstrItem, CLASSES extends ConstrClasses, P extends ConstrItem> {
|
|
64
|
-
protected constructor(name: string, props: Readonly<P>, options?: ConstrOptions<COMP, EMITS, P> | undefined);
|
|
65
|
-
protected init(): this;
|
|
66
44
|
getName(): string;
|
|
67
45
|
getDesign(): string;
|
|
68
46
|
getSubClass(name: string | string[]): string;
|
|
@@ -71,15 +49,7 @@ export declare abstract class DesignConstructorAbstract<E extends Element, COMP
|
|
|
71
49
|
getAttrs(): ConstrItem;
|
|
72
50
|
expose(): ConstrExpose<E, EXPOSE>;
|
|
73
51
|
render(): () => VNode | (VNode | any)[] | undefined;
|
|
74
|
-
protected initSlot<K extends keyof SLOTS>(name: K, children?: any[], props?: ConstrItem): VNode | undefined;
|
|
75
|
-
protected toClass(classes?: ConstrClass): ConstrClassObject;
|
|
76
|
-
protected toClassName<T extends ConstrItem>(classes?: ConstrItem): T;
|
|
77
52
|
}
|
|
78
|
-
|
|
79
|
-
// File: src/classes/ref/DatetimeRef.d.ts
|
|
80
|
-
import { ComputedRef, Ref } from 'vue';
|
|
81
|
-
import { Datetime, GeoDate, GeoFirstDay, GeoHours, NumberOrStringOrDate } from '@dxtmisha/functional-basic';
|
|
82
|
-
import { RefOrNormal } from '../../types/refTypes';
|
|
83
53
|
export declare class DatetimeRef {
|
|
84
54
|
constructor(date: RefOrNormal<NumberOrStringOrDate>, type?: RefOrNormal<GeoDate>, code?: RefOrNormal<string>);
|
|
85
55
|
getItem(): Ref<NumberOrStringOrDate>;
|
|
@@ -97,23 +67,12 @@ export declare class DatetimeRef {
|
|
|
97
67
|
locale(type?: GeoDate, styleOptions?: Intl.DateTimeFormatOptions['month'] | Intl.DateTimeFormatOptions): ComputedRef<string>;
|
|
98
68
|
standard(timeZone?: boolean): ComputedRef<string>;
|
|
99
69
|
}
|
|
100
|
-
|
|
101
|
-
// File: src/classes/ref/EffectScopeGlobal.d.ts
|
|
102
70
|
export declare class EffectScopeGlobal {
|
|
103
71
|
static run<T>(fn: () => T): T | undefined;
|
|
104
72
|
}
|
|
105
|
-
|
|
106
|
-
// File: src/classes/ref/EventRef.d.ts
|
|
107
|
-
import { RefOrNormal } from '../../types/refTypes';
|
|
108
|
-
import { ElementOrString, ElementOrWindow, EventItem, EventListenerDetail, EventOptions } from '@dxtmisha/functional-basic';
|
|
109
73
|
export declare class EventRef<E extends ElementOrWindow, O extends Event, D extends Record<string, any> = Record<string, any>> extends EventItem<E, O, D> {
|
|
110
74
|
constructor(elementSelector?: RefOrNormal<ElementOrString<E> | undefined>, elementSelectorControl?: RefOrNormal<ElementOrString<HTMLElement>>, type?: string | string[], listener?: EventListenerDetail<O, D>, options?: EventOptions, detail?: D);
|
|
111
75
|
}
|
|
112
|
-
|
|
113
|
-
// File: src/classes/ref/GeoFlagRef.d.ts
|
|
114
|
-
import { ComputedRef } from 'vue';
|
|
115
|
-
import { GeoFlag, GeoFlagItem, GeoFlagNational } from '@dxtmisha/functional-basic';
|
|
116
|
-
import { RefOrNormal } from '../../types/refTypes';
|
|
117
76
|
export declare class GeoFlagRef {
|
|
118
77
|
constructor(code?: RefOrNormal<string | undefined>);
|
|
119
78
|
getCode(): string;
|
|
@@ -125,11 +84,6 @@ export declare class GeoFlagRef {
|
|
|
125
84
|
getNational(codes?: RefOrNormal<string[] | undefined>): ComputedRef<GeoFlagNational[]>;
|
|
126
85
|
getNationalLanguage(codes?: RefOrNormal<string[] | undefined>): ComputedRef<GeoFlagNational[]>;
|
|
127
86
|
}
|
|
128
|
-
|
|
129
|
-
// File: src/classes/ref/GeoIntlRef.d.ts
|
|
130
|
-
import { ComputedRef } from 'vue';
|
|
131
|
-
import { GeoDate, ItemValue, NumberOrString, NumberOrStringOrDate } from '@dxtmisha/functional-basic';
|
|
132
|
-
import { RefOrNormal } from '../../types/refTypes';
|
|
133
87
|
export declare class GeoIntlRef {
|
|
134
88
|
constructor(code?: RefOrNormal<string>);
|
|
135
89
|
display(value?: RefOrNormal<string>, typeOptions?: Intl.DisplayNamesOptions['type'] | Intl.DisplayNamesOptions): ComputedRef<string>;
|
|
@@ -155,10 +109,6 @@ export declare class GeoIntlRef {
|
|
|
155
109
|
time(value: RefOrNormal<NumberOrStringOrDate>): ComputedRef<string>;
|
|
156
110
|
sort<T>(data: RefOrNormal<T[]>, compareFn?: (a: T, b: T) => [string, string]): ComputedRef<T[]>;
|
|
157
111
|
}
|
|
158
|
-
|
|
159
|
-
// File: src/classes/ref/GeoRef.d.ts
|
|
160
|
-
import { ComputedRef, Ref } from 'vue';
|
|
161
|
-
import { GeoItemFull } from '@dxtmisha/functional-basic';
|
|
162
112
|
export declare class GeoRef {
|
|
163
113
|
static get(): Ref<GeoItemFull>;
|
|
164
114
|
static getCountry(): ComputedRef<string>;
|
|
@@ -171,11 +121,6 @@ export declare class GeoRef {
|
|
|
171
121
|
static set(code: string): void;
|
|
172
122
|
static setValueDefault(code?: string | (() => string)): void;
|
|
173
123
|
}
|
|
174
|
-
|
|
175
|
-
// File: src/classes/ref/GeoUnitRef.d.ts
|
|
176
|
-
import { ComputedRef, Ref } from 'vue';
|
|
177
|
-
import { GeoUnit, NumberOrString } from '@dxtmisha/functional-basic';
|
|
178
|
-
import { RefOrNormal } from '../../types/refTypes';
|
|
179
124
|
export declare class GeoUnitRef {
|
|
180
125
|
constructor(code?: RefOrNormal<string>);
|
|
181
126
|
getLocation(): ComputedRef<string>;
|
|
@@ -192,12 +137,8 @@ export declare class GeoUnitRef {
|
|
|
192
137
|
liter(value: RefOrNormal<NumberOrString>, options?: Intl.NumberFormatOptions): ComputedRef<string>;
|
|
193
138
|
celsius(value: RefOrNormal<NumberOrString>, options?: Intl.NumberFormatOptions): ComputedRef<string>;
|
|
194
139
|
kilometerPerHour(value: RefOrNormal<NumberOrString>, options?: Intl.NumberFormatOptions): ComputedRef<string>;
|
|
140
|
+
format(value: RefOrNormal<NumberOrString>, unit: RefOrNormal<string>, options?: Intl.NumberFormatOptions): ComputedRef<string>;
|
|
195
141
|
}
|
|
196
|
-
|
|
197
|
-
// File: src/classes/ref/ListDataRef.d.ts
|
|
198
|
-
import { RefOrNormal, RefType } from '../../types/refTypes';
|
|
199
|
-
import { ListDataFull, ListDataItem, ListList, ListListInput, ListNames, ListSelectedItem, ListSelectedList } from '../../types/listTypes';
|
|
200
|
-
import { ComputedRef } from 'vue';
|
|
201
142
|
export declare class ListDataRef {
|
|
202
143
|
constructor(list: RefOrNormal<ListListInput | undefined>, focus?: RefType<ListSelectedItem | undefined> | undefined, highlight?: RefType<string | undefined> | undefined, highlightLengthStart?: RefType<number | undefined> | undefined, filterMode?: RefType<boolean | undefined> | undefined, selected?: RefType<ListSelectedList | undefined> | undefined, keyValue?: RefType<string | undefined> | undefined, keyLabel?: RefType<string | undefined> | undefined, lite?: RefType<number | undefined> | undefined, min?: RefOrNormal<number | string | undefined>, max?: RefOrNormal<number | string | undefined>, parent?: string | undefined);
|
|
203
144
|
readonly data: ComputedRef<ListList>;
|
|
@@ -235,18 +176,17 @@ export declare class ListDataRef {
|
|
|
235
176
|
getIndexByStep(index: string, step: number): ListDataItem | undefined;
|
|
236
177
|
getIndexNext(index: string): ListDataItem | undefined;
|
|
237
178
|
getIndexPrev(index: string): ListDataItem | undefined;
|
|
238
|
-
getItemByIndex(index?: string): {
|
|
179
|
+
getItemByIndex(index?: string): {
|
|
180
|
+
key: number;
|
|
181
|
+
item: ListDataItem;
|
|
182
|
+
} | undefined;
|
|
239
183
|
getItemByKey(key: number): ListDataItem | undefined;
|
|
240
184
|
getFirstItemByParent(parent: string | undefined): ListDataItem | undefined;
|
|
241
185
|
getLastItemByParent(parent: string | undefined): ListDataItem | undefined;
|
|
242
186
|
getSubList(item: ListDataItem): ListDataRef;
|
|
243
187
|
}
|
|
244
|
-
|
|
245
|
-
// File: src/classes/ref/RouterItemRef.d.ts
|
|
246
|
-
import { RouteLocationRaw, Router } from 'vue-router';
|
|
247
|
-
import { ConstrHrefProps } from '../../types/constructorTypes';
|
|
248
188
|
export declare class RouterItemRef {
|
|
249
|
-
static get():
|
|
189
|
+
static get(): _RouterClassic;
|
|
250
190
|
static getLink(name: string, params?: any, query?: any): string | undefined;
|
|
251
191
|
static getHref(name?: string, params?: any, query?: any): ConstrHrefProps;
|
|
252
192
|
static push(to: string | RouteLocationRaw): void;
|
|
@@ -254,56 +194,79 @@ export declare class RouterItemRef {
|
|
|
254
194
|
static setOneTime(router: Router): void;
|
|
255
195
|
static rawToHref(to?: string | RouteLocationRaw): ConstrHrefProps;
|
|
256
196
|
}
|
|
257
|
-
|
|
258
|
-
// File: src/classes/ref/ScrollbarWidthRef.d.ts
|
|
259
|
-
import { Ref, ComputedRef } from 'vue';
|
|
260
197
|
export declare class ScrollbarWidthRef {
|
|
261
198
|
readonly item: Ref<boolean | undefined, boolean | undefined>;
|
|
262
199
|
readonly width: Ref<number, number>;
|
|
263
200
|
constructor();
|
|
264
201
|
readonly is: ComputedRef<boolean>;
|
|
265
202
|
}
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
203
|
+
/**
|
|
204
|
+
* Asynchronous reactive composable for API requests with built-in SSR support.
|
|
205
|
+
* Wraps `useApiRef` and immediately calls `initSsr()` to ensure data is pre-fetched on the server side.
|
|
206
|
+
* Use this composable ONLY if you need the request to be executed on the server side during SSR.
|
|
207
|
+
* For all other cases, use `useApiRef`.
|
|
208
|
+
*
|
|
209
|
+
* @example
|
|
210
|
+
* ```typescript
|
|
211
|
+
* import { Schema as S } from '@effect/schema'
|
|
212
|
+
* import { useApiAsyncRef } from '@dxtmisha/functional'
|
|
213
|
+
*
|
|
214
|
+
* const userSchema = S.Struct({ id: S.Number, name: S.String })
|
|
215
|
+
*
|
|
216
|
+
* // Data will be pre-fetched on the server during SSR (onServerPrefetch)
|
|
217
|
+
* const { data, loading, errorItem, isResponseContractValid } = useApiAsyncRef(
|
|
218
|
+
* '/users/1',
|
|
219
|
+
* { method: 'GET' },
|
|
220
|
+
* true, // reactivity
|
|
221
|
+
* undefined, // conditions
|
|
222
|
+
* undefined, // transformation
|
|
223
|
+
* (data) => { // validateResponseContract
|
|
224
|
+
* try {
|
|
225
|
+
* return { status: 'success', data: S.decodeUnknownSync(userSchema)(data) }
|
|
226
|
+
* } catch (e) {
|
|
227
|
+
* return { status: 'error', errors: e }
|
|
228
|
+
* }
|
|
229
|
+
* },
|
|
230
|
+
* [ // errorContract
|
|
231
|
+
* { status: 404, message: 'User not found' }
|
|
232
|
+
* ]
|
|
233
|
+
* )
|
|
234
|
+
* ```
|
|
235
|
+
*
|
|
236
|
+
* @param path path to request (can be a Ref or Getter)
|
|
237
|
+
* @param options data for the request (headers, method, etc.)
|
|
238
|
+
* @param reactivity should reactivity be enabled (automatically re-fetch on deps change)
|
|
239
|
+
* @param conditions conditions for executing the request (request will wait until true)
|
|
240
|
+
* @param transformation transforms the received response data
|
|
241
|
+
* @param validateResponseContract function to validate response data contract. Used to ensure that the API
|
|
242
|
+
* response matches the expected structure. Highly recommended to use with `@effect/schema`.
|
|
243
|
+
* It should return `ApiDataValidation` containing a `status` ('success' or 'error')
|
|
244
|
+
* and the parsed data or errors.
|
|
245
|
+
* @param errorContract array of expected error contracts for the request (`ApiErrorStorageList`).
|
|
246
|
+
* Highly recommended to add if there is information about possible request errors. Allows you to predefine
|
|
247
|
+
* possible errors (by code, status, or custom validation). If an error occurs matching one of these contracts,
|
|
248
|
+
* it will be automatically processed and made available via the `errorItem` computed property.
|
|
249
|
+
* @param unmounted whether to stop the request and clear data from cache when component is unmounted
|
|
250
|
+
* @param apiInstance Api instance (defaults to global Api instance)
|
|
251
|
+
*/
|
|
272
252
|
export declare function useApiAsyncRef<R, T = R>(path?: RefOrNormal<string | undefined>, options?: ApiOptions, reactivity?: boolean, conditions?: RefType<boolean>, transformation?: (data: T, isResponseContractValid?: ApiDataValidation) => ApiData<R>, validateResponseContract?: (data: T) => ApiDataValidation, errorContract?: ApiErrorStorageList, unmounted?: boolean, apiInstance?: ApiInstance): UseApiRef<R>;
|
|
273
|
-
|
|
274
|
-
// File: src/composables/ref/useApiDelete.d.ts
|
|
275
|
-
import { ApiData, ApiFetch } from '@dxtmisha/functional-basic';
|
|
276
|
-
import { UseApiRequestSetup } from './useApiRequest';
|
|
277
|
-
import { Ref } from 'vue';
|
|
278
|
-
export interface UseApiDeleteSetup<T, Request extends ApiFetch['request'] = ApiFetch['request'], Return extends ApiData<T> = ApiData<T>> extends Omit<UseApiRequestSetup<T, Request, Return>, 'method'> {
|
|
279
|
-
}
|
|
253
|
+
export interface UseApiDeleteSetup<T, Request extends ApiFetch['request'] = ApiFetch['request'], Return extends ApiData<T> = ApiData<T>> extends Omit<UseApiRequestSetup<T, Request, Return>, 'method'> {}
|
|
280
254
|
export declare function useApiDelete<T, Request extends ApiFetch['request'] = ApiFetch['request'], Return extends ApiData<T> = ApiData<T>>(setup: UseApiDeleteSetup<T, Request, Return>): {
|
|
281
255
|
loading: Ref<boolean, boolean>;
|
|
282
256
|
send(request?: Request | undefined): Promise<Return | undefined>;
|
|
283
257
|
};
|
|
284
|
-
|
|
285
|
-
// File: src/composables/ref/useApiGet.d.ts
|
|
286
|
-
import { ApiData, ApiFetch } from '@dxtmisha/functional-basic';
|
|
287
|
-
import { UseApiRequestSetup } from './useApiRequest';
|
|
288
|
-
import { Ref } from 'vue';
|
|
289
|
-
export interface UseApiGetSetup<T, Request extends ApiFetch['request'] = ApiFetch['request'], Return extends ApiData<T> = ApiData<T>> extends Omit<UseApiRequestSetup<T, Request, Return>, 'method'> {
|
|
290
|
-
}
|
|
258
|
+
export interface UseApiGetSetup<T, Request extends ApiFetch['request'] = ApiFetch['request'], Return extends ApiData<T> = ApiData<T>> extends Omit<UseApiRequestSetup<T, Request, Return>, 'method'> {}
|
|
291
259
|
export declare function useApiGet<T, Request extends ApiFetch['request'] = ApiFetch['request'], Return extends ApiData<T> = ApiData<T>>(setup: UseApiGetSetup<T, Request, Return>): {
|
|
292
260
|
loading: Ref<boolean, boolean>;
|
|
293
261
|
send(request?: Request | undefined): Promise<Return | undefined>;
|
|
294
262
|
};
|
|
295
|
-
|
|
296
|
-
// File: src/composables/ref/useApiManagementAsyncRef.d.ts
|
|
297
|
-
import { ApiInstance, ArrayToItem, FormattersListColumns, FormattersOptionsList, SearchColumns, ApiDataValidation, SearchFormatList, ApiData, ApiErrorItem, ApiFetch } from '@dxtmisha/functional-basic';
|
|
298
|
-
import { ApiManagementGet, ApiManagementRequest, ApiManagementSearch, ApiManagementValue } from '../../types/apiTypes';
|
|
299
|
-
import { ComputedRef, Ref } from 'vue';
|
|
300
263
|
export declare function useApiManagementAsyncRef<Return extends ApiManagementValue, FormattersOptions extends FormattersOptionsList, Post extends Record<string, any>, Put extends Record<string, any>, Delete extends Record<string, any>, Type extends ApiManagementValue = Return, Item extends ArrayToItem<Return> = ArrayToItem<Return>, ItemFormatters extends FormattersListColumns<Item, FormattersOptions>[number] = FormattersListColumns<Item, FormattersOptions>[number], Columns extends SearchColumns<ItemFormatters> = []>(propsGet: ApiManagementGet<Return, Type>, formattersOptions?: FormattersOptions, searchOptions?: ApiManagementSearch<Item, Columns>, postRequest?: ApiManagementRequest<Post>, putRequest?: ApiManagementRequest<Put>, deleteRequest?: ApiManagementRequest<Delete>, action?: () => Promise<void> | void, apiInstance?: ApiInstance): {
|
|
301
264
|
isValid: ComputedRef<boolean>;
|
|
302
265
|
isResponseContractValid: ComputedRef<boolean>;
|
|
303
|
-
responseValidationResult: ComputedRef<
|
|
266
|
+
responseValidationResult: ComputedRef<ApiDataValidation | undefined>;
|
|
304
267
|
list: ComputedRef<SearchFormatList<ItemFormatters, Columns>>;
|
|
305
|
-
readonly data: ComputedRef<
|
|
306
|
-
errorItem: ComputedRef<
|
|
268
|
+
readonly data: ComputedRef<ApiData<Return> | undefined>;
|
|
269
|
+
errorItem: ComputedRef<ApiErrorItem | undefined>;
|
|
307
270
|
readonly length: ComputedRef<number>;
|
|
308
271
|
lengthData: ComputedRef<number>;
|
|
309
272
|
starting: ComputedRef<boolean>;
|
|
@@ -319,22 +282,77 @@ export declare function useApiManagementAsyncRef<Return extends ApiManagementVal
|
|
|
319
282
|
initSsr: () => void;
|
|
320
283
|
reset: () => Promise<void>;
|
|
321
284
|
abort: () => void;
|
|
322
|
-
sendPost: (request?: ApiFetch["request"]) => Promise<
|
|
323
|
-
sendPut: (request?: ApiFetch["request"]) => Promise<
|
|
324
|
-
sendDelete: (request?: ApiFetch["request"]) => Promise<
|
|
285
|
+
sendPost: (request?: ApiFetch["request"]) => Promise<ApiData<Post> | undefined>;
|
|
286
|
+
sendPut: (request?: ApiFetch["request"]) => Promise<ApiData<Put> | undefined>;
|
|
287
|
+
sendDelete: (request?: ApiFetch["request"]) => Promise<ApiData<Delete> | undefined>;
|
|
325
288
|
};
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
289
|
+
/**
|
|
290
|
+
* A powerful composable for comprehensive API request orchestration.
|
|
291
|
+
* It centrally manages data loading (GET), list formatting, client-side searching,
|
|
292
|
+
* and mutations (POST, PUT, DELETE) through a single reactive interface.
|
|
293
|
+
*
|
|
294
|
+
* @template Return type of data returned by the API
|
|
295
|
+
* @template FormattersOptions optional formatting rules
|
|
296
|
+
* @template Post data type for POST creation request
|
|
297
|
+
* @template Put data type for PUT update request
|
|
298
|
+
* @template Delete data type for DELETE removal request
|
|
299
|
+
* @template Type original data type (before transformation)
|
|
300
|
+
* @template Item type of a single item in the data list
|
|
301
|
+
* @template ItemFormatters item type after formatters are applied
|
|
302
|
+
* @template Columns search columns derived from formatting
|
|
303
|
+
*
|
|
304
|
+
* @param propsGet main GET request settings (path, reactivity, skeleton, etc.)
|
|
305
|
+
* @param formattersOptions optional reactive formatting rules
|
|
306
|
+
* @param searchOptions optional client-side search settings
|
|
307
|
+
* @param postRequest optional POST mutation settings
|
|
308
|
+
* @param putRequest optional PUT mutation settings
|
|
309
|
+
* @param deleteRequest optional DELETE mutation settings
|
|
310
|
+
* @param action common callback executed after any successful mutation
|
|
311
|
+
* @param apiInstance API instance for requests (defaults to Api.getItem())
|
|
312
|
+
*
|
|
313
|
+
* @returns reactive API management interface
|
|
314
|
+
*
|
|
315
|
+
* @note This hook is recommended to be used in tandem with `executeUse` for centralized state management.
|
|
316
|
+
* By wrapping `useApiManagementRef` in `executeUseProvide` or `executeUseGlobal`, you can ensure
|
|
317
|
+
* a single source of truth across the component tree or the entire application.
|
|
318
|
+
*
|
|
319
|
+
* @remarks
|
|
320
|
+
* Data formatting guidelines for `formattersOptions`:
|
|
321
|
+
* - **Recommended for formatting:** Numbers that represent values (prices, counts), dates, currency, units, and statuses.
|
|
322
|
+
* - **Not recommended for formatting:** Technical identifiers such as ID, UUID, account numbers (if used for logic), types, or internal codes.
|
|
323
|
+
*
|
|
324
|
+
* @example
|
|
325
|
+
* // 1. Comprehensive API orchestration
|
|
326
|
+
* const products = useApiManagementRef(
|
|
327
|
+
* {
|
|
328
|
+
* path: '/api/v1/products',
|
|
329
|
+
* skeleton: () => Array(5).fill({ id: 0, name: 'Loading...', price: 0 })
|
|
330
|
+
* },
|
|
331
|
+
* {
|
|
332
|
+
* // Formatters for display
|
|
333
|
+
* price: (v) => `${v} USD`,
|
|
334
|
+
* created_at: (v) => new Date(v).toLocaleDateString()
|
|
335
|
+
* },
|
|
336
|
+
* {
|
|
337
|
+
* // Client-side search setup
|
|
338
|
+
* columns: ['name', 'category']
|
|
339
|
+
* },
|
|
340
|
+
* { path: '/api/v1/products' }, // POST (create)
|
|
341
|
+
* { path: (data) => `/api/v1/products/${data.id}` }, // PUT (update)
|
|
342
|
+
* { path: (data) => `/api/v1/products/${data.id}` } // DELETE (remove)
|
|
343
|
+
* );
|
|
344
|
+
*
|
|
345
|
+
* // Accessing data:
|
|
346
|
+
* // products.list.value -> processed, formatted, and searched list
|
|
347
|
+
* // products.sendPost({ name: 'New Product', price: 100 }) -> execute mutation
|
|
348
|
+
*/
|
|
331
349
|
export declare function useApiManagementRef<Return extends ApiManagementValue, FormattersOptions extends FormattersOptionsList, Post extends Record<string, any>, Put extends Record<string, any>, Delete extends Record<string, any>, Type extends ApiManagementValue = Return, Item extends ArrayToItem<Return> = ArrayToItem<Return>, ItemFormatters extends FormattersListColumns<Item, FormattersOptions>[number] = FormattersListColumns<Item, FormattersOptions>[number], Columns extends SearchColumns<ItemFormatters> = []>(propsGet: ApiManagementGet<Return, Type>, formattersOptions?: FormattersOptions, searchOptions?: ApiManagementSearch<Item, Columns>, postRequest?: ApiManagementRequest<Post>, putRequest?: ApiManagementRequest<Put>, deleteRequest?: ApiManagementRequest<Delete>, action?: () => Promise<void> | void, apiInstance?: ApiInstance): {
|
|
332
350
|
isValid: ComputedRef<boolean>;
|
|
333
351
|
isResponseContractValid: ComputedRef<boolean>;
|
|
334
|
-
responseValidationResult: ComputedRef<
|
|
352
|
+
responseValidationResult: ComputedRef<ApiDataValidation | undefined>;
|
|
335
353
|
list: ComputedRef<SearchFormatList<ItemFormatters, Columns>>;
|
|
336
354
|
readonly data: ComputedRef<ApiData<Return> | undefined>;
|
|
337
|
-
errorItem: ComputedRef<
|
|
355
|
+
errorItem: ComputedRef<ApiErrorItem | undefined>;
|
|
338
356
|
readonly length: ComputedRef<number>;
|
|
339
357
|
lengthData: ComputedRef<number>;
|
|
340
358
|
starting: ComputedRef<boolean>;
|
|
@@ -354,34 +372,16 @@ export declare function useApiManagementRef<Return extends ApiManagementValue, F
|
|
|
354
372
|
sendPut: (request?: ApiFetch["request"]) => Promise<ApiData<Put> | undefined>;
|
|
355
373
|
sendDelete: (request?: ApiFetch["request"]) => Promise<ApiData<Delete> | undefined>;
|
|
356
374
|
};
|
|
357
|
-
|
|
358
|
-
// File: src/composables/ref/useApiPost.d.ts
|
|
359
|
-
import { ApiData, ApiFetch } from '@dxtmisha/functional-basic';
|
|
360
|
-
import { UseApiRequestSetup } from './useApiRequest';
|
|
361
|
-
import { Ref } from 'vue';
|
|
362
|
-
export interface UseApiPostSetup<T, Request extends ApiFetch['request'] = ApiFetch['request'], Return extends ApiData<T> = ApiData<T>> extends Omit<UseApiRequestSetup<T, Request, Return>, 'method'> {
|
|
363
|
-
}
|
|
375
|
+
export interface UseApiPostSetup<T, Request extends ApiFetch['request'] = ApiFetch['request'], Return extends ApiData<T> = ApiData<T>> extends Omit<UseApiRequestSetup<T, Request, Return>, 'method'> {}
|
|
364
376
|
export declare function useApiPost<T, Request extends ApiFetch['request'] = ApiFetch['request'], Return extends ApiData<T> = ApiData<T>>(setup: UseApiPostSetup<T, Request, Return>): {
|
|
365
377
|
loading: Ref<boolean, boolean>;
|
|
366
378
|
send(request?: Request | undefined): Promise<Return | undefined>;
|
|
367
379
|
};
|
|
368
|
-
|
|
369
|
-
// File: src/composables/ref/useApiPut.d.ts
|
|
370
|
-
import { ApiData, ApiFetch } from '@dxtmisha/functional-basic';
|
|
371
|
-
import { UseApiRequestSetup } from './useApiRequest';
|
|
372
|
-
import { Ref } from 'vue';
|
|
373
|
-
export interface UseApiPutSetup<T, Request extends ApiFetch['request'] = ApiFetch['request'], Return extends ApiData<T> = ApiData<T>> extends Omit<UseApiRequestSetup<T, Request, Return>, 'method'> {
|
|
374
|
-
}
|
|
380
|
+
export interface UseApiPutSetup<T, Request extends ApiFetch['request'] = ApiFetch['request'], Return extends ApiData<T> = ApiData<T>> extends Omit<UseApiRequestSetup<T, Request, Return>, 'method'> {}
|
|
375
381
|
export declare function useApiPut<T, Request extends ApiFetch['request'] = ApiFetch['request'], Return extends ApiData<T> = ApiData<T>>(setup: UseApiPutSetup<T, Request, Return>): {
|
|
376
382
|
loading: Ref<boolean, boolean>;
|
|
377
383
|
send(request?: Request | undefined): Promise<Return | undefined>;
|
|
378
384
|
};
|
|
379
|
-
|
|
380
|
-
// File: src/composables/ref/useApiRef.d.ts
|
|
381
|
-
import { ComputedRef, Ref } from 'vue';
|
|
382
|
-
import { ApiInstance, ApiData, ApiDataValidation, ApiErrorStorageList, ApiErrorItem } from '@dxtmisha/functional-basic';
|
|
383
|
-
import { ApiOptions } from '../../types/apiTypes';
|
|
384
|
-
import { RefOrNormal, RefType } from '../../types/refTypes';
|
|
385
385
|
export interface UseApiRef<R> {
|
|
386
386
|
data: ComputedRef<ApiData<R> | undefined>;
|
|
387
387
|
item: Ref<ApiData<R> | undefined>;
|
|
@@ -402,14 +402,58 @@ export interface UseApiRef<R> {
|
|
|
402
402
|
stop(): void;
|
|
403
403
|
abort(): void;
|
|
404
404
|
}
|
|
405
|
+
/**
|
|
406
|
+
* Main reactive composable for working with API requests in Vue.
|
|
407
|
+
* Automatically handles SSR, reactivity, caching, error storage, data validation, and transformation.
|
|
408
|
+
*
|
|
409
|
+
* @example
|
|
410
|
+
* ```typescript
|
|
411
|
+
* import { Schema as S } from '@effect/schema'
|
|
412
|
+
* import { useApiRef } from '@dxtmisha/functional'
|
|
413
|
+
*
|
|
414
|
+
* // Define a schema using @effect/schema
|
|
415
|
+
* const userSchema = S.Struct({ id: S.Number, name: S.String })
|
|
416
|
+
*
|
|
417
|
+
* const { data, loading, errorItem, isResponseContractValid } = useApiRef(
|
|
418
|
+
* '/users/1',
|
|
419
|
+
* { method: 'GET' },
|
|
420
|
+
* true, // reactivity
|
|
421
|
+
* undefined, // conditions
|
|
422
|
+
* (data) => ({ ...data, isTransformed: true }), // transformation
|
|
423
|
+
* (data) => { // validateResponseContract
|
|
424
|
+
* try {
|
|
425
|
+
* return { status: 'success', data: S.decodeUnknownSync(userSchema)(data) }
|
|
426
|
+
* } catch (e) {
|
|
427
|
+
* return { status: 'error', errors: e }
|
|
428
|
+
* }
|
|
429
|
+
* },
|
|
430
|
+
* [ // errorContract (ApiErrorStorageList)
|
|
431
|
+
* {
|
|
432
|
+
* status: 404,
|
|
433
|
+
* message: 'User not found'
|
|
434
|
+
* }
|
|
435
|
+
* ]
|
|
436
|
+
* )
|
|
437
|
+
* ```
|
|
438
|
+
*
|
|
439
|
+
* @param path path to request (can be a Ref or Getter)
|
|
440
|
+
* @param options data for the request (headers, method, etc.)
|
|
441
|
+
* @param reactivity should reactivity be enabled (automatically re-fetch on deps change)
|
|
442
|
+
* @param conditions conditions for executing the request (request will wait until true)
|
|
443
|
+
* @param transformation transforms the received response data
|
|
444
|
+
* @param validateResponseContract function to validate response data contract. Used to ensure that the API
|
|
445
|
+
* response matches the expected structure. Highly recommended to use with `@effect/schema`.
|
|
446
|
+
* It should return `ApiDataValidation` containing a `status` ('success' or 'error')
|
|
447
|
+
* and the parsed data or errors.
|
|
448
|
+
* @param errorContract array of expected error contracts for the request (`ApiErrorStorageList`).
|
|
449
|
+
* Highly recommended to add if there is information about possible request errors. Allows you to predefine
|
|
450
|
+
* possible errors (by code, status, or custom validation). If an error occurs matching one of these contracts,
|
|
451
|
+
* it will be automatically processed and made available via the `errorItem` computed property.
|
|
452
|
+
* @param unmounted whether to stop the request and clear data from cache when component is unmounted
|
|
453
|
+
* @param apiInstance Api instance (defaults to global Api instance)
|
|
454
|
+
*/
|
|
405
455
|
export declare function useApiRef<R, T = R>(path?: RefOrNormal<string | undefined>, options?: ApiOptions, reactivity?: boolean, conditions?: RefType<boolean>, transformation?: (data: T, isResponseContractValid?: ApiDataValidation) => ApiData<R>, validateResponseContract?: (data: T) => ApiDataValidation, errorContract?: ApiErrorStorageList, unmounted?: boolean, apiInstance?: ApiInstance): UseApiRef<R>;
|
|
406
456
|
export declare const setApiRefGlobalConditions: (conditions: RefType<any>) => void;
|
|
407
|
-
|
|
408
|
-
// File: src/composables/ref/useApiRequest.d.ts
|
|
409
|
-
import { ApiInstance, ApiMethodItem, ApiData, ApiFetch, ApiErrorStorageList, ApiDataValidation } from '@dxtmisha/functional-basic';
|
|
410
|
-
import { ApiOptions } from '../../types/apiTypes';
|
|
411
|
-
import { RefOrNormal } from '../../types/refTypes';
|
|
412
|
-
import { Ref } from 'vue';
|
|
413
457
|
export interface UseApiRequestSetup<T, Request extends ApiFetch['request'] = ApiFetch['request'], Return extends ApiData<T> = ApiData<T>> {
|
|
414
458
|
path?: RefOrNormal<string | undefined>;
|
|
415
459
|
method?: ApiMethodItem;
|
|
@@ -426,48 +470,23 @@ export declare function useApiRequest<T, Request extends ApiFetch['request'] = A
|
|
|
426
470
|
loading: Ref<boolean, boolean>;
|
|
427
471
|
send(request?: Request): Promise<Return | undefined>;
|
|
428
472
|
};
|
|
429
|
-
|
|
430
|
-
// File: src/composables/ref/useBroadcastValueRef.d.ts
|
|
431
|
-
import { Ref } from 'vue';
|
|
432
|
-
type BroadcastValueItem<T> = T | string | undefined;
|
|
433
|
-
export declare function useBroadcastValueRef<T>(name: string, defaultValue?: T | string | (() => (T | string))): Ref<BroadcastValueItem<T>>;
|
|
434
|
-
|
|
435
|
-
// File: src/composables/ref/useCookieRef.d.ts
|
|
436
|
-
import { Ref } from 'vue';
|
|
437
|
-
import { CookieOptions } from '@dxtmisha/functional-basic';
|
|
473
|
+
export declare function useBroadcastValueRef<T>(name: string, defaultValue?: T | string | (() => (T | string))): Ref<T | string | undefined>;
|
|
438
474
|
export declare function useCookieRef<T>(name: string, defaultValue?: T | string | (() => (T | string)), options?: CookieOptions): Ref<T | string | undefined>;
|
|
439
|
-
|
|
440
|
-
// File: src/composables/ref/useFormattersRef.d.ts
|
|
441
|
-
import { FormattersListProp, FormattersOptionsList, FormattersReturn } from '@dxtmisha/functional-basic';
|
|
442
|
-
import { RefType } from '../../types/refTypes';
|
|
443
|
-
import { ComputedRef } from 'vue';
|
|
444
475
|
export declare function useFormattersRef<Options extends FormattersOptionsList = FormattersOptionsList, List extends FormattersListProp = FormattersListProp>(list: RefType<List | undefined>, options: Options): {
|
|
445
476
|
listFormat: ComputedRef<FormattersReturn<List, Options>>;
|
|
446
477
|
length: ComputedRef<number>;
|
|
447
478
|
};
|
|
448
|
-
|
|
449
|
-
// File: src/composables/ref/useGeoIntlRef.d.ts
|
|
450
|
-
import { GeoIntlRef } from '../../classes/ref/GeoIntlRef';
|
|
451
479
|
export declare function useGeoIntlRef(): GeoIntlRef;
|
|
452
|
-
|
|
453
|
-
// File: src/composables/ref/useGeoUnitRef.d.ts
|
|
454
|
-
import { GeoUnitRef } from '../../classes/ref/GeoUnitRef';
|
|
455
480
|
export declare function useGeoUnitRef(): GeoUnitRef;
|
|
456
|
-
|
|
457
|
-
// File: src/composables/ref/useHashRef.d.ts
|
|
458
|
-
import { ShallowRef } from 'vue';
|
|
459
481
|
export declare function useHashRef<T>(name: string, defaultValue?: T | (() => T)): ShallowRef<T>;
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
export declare const useLazyItemByMarginRef: (element: RefType<HTMLElement | undefined>, rootMargin
|
|
465
|
-
lazyItemStatus:
|
|
466
|
-
readonly lazyItem:
|
|
482
|
+
export type LazyItemByMargin = {
|
|
483
|
+
rootMargin: string;
|
|
484
|
+
item: ReturnType<typeof useLazyRef>;
|
|
485
|
+
};
|
|
486
|
+
export declare const useLazyItemByMarginRef: (element: RefType<HTMLElement | undefined>, rootMargin?: string) => {
|
|
487
|
+
lazyItemStatus: ShallowRef<boolean, boolean>;
|
|
488
|
+
readonly lazyItem: LazyItem | undefined;
|
|
467
489
|
};
|
|
468
|
-
|
|
469
|
-
// File: src/composables/ref/useLazyRef.d.ts
|
|
470
|
-
import { Ref, ShallowRef } from 'vue';
|
|
471
490
|
export type LazyItem = {
|
|
472
491
|
status: ShallowRef<boolean>;
|
|
473
492
|
ratio: ShallowRef<number>;
|
|
@@ -477,21 +496,14 @@ export type LazyItem = {
|
|
|
477
496
|
export type LazyList = Record<string, LazyItem>;
|
|
478
497
|
export declare const useLazyRef: (options?: IntersectionObserverInit) => {
|
|
479
498
|
intersectionObserver: IntersectionObserver | undefined;
|
|
480
|
-
getItem(element
|
|
499
|
+
getItem(element?: HTMLElement): LazyItem | undefined;
|
|
481
500
|
addLazyItem(element: Ref<HTMLElement | undefined>): ShallowRef<boolean, boolean>;
|
|
482
501
|
removeLazyItem: (element?: HTMLElement) => void;
|
|
483
502
|
disconnectLazy: () => void | undefined;
|
|
484
503
|
};
|
|
485
|
-
|
|
486
|
-
// File: src/composables/ref/useLoadingRef.d.ts
|
|
487
|
-
import { ShallowRef } from 'vue';
|
|
488
504
|
export declare function useLoadingRef(): ShallowRef<boolean, boolean>;
|
|
489
|
-
|
|
490
|
-
// File: src/composables/ref/useMeta.d.ts
|
|
491
|
-
import { MetaRobots, MetaStatic } from '@dxtmisha/functional-basic';
|
|
492
|
-
import { Ref } from 'vue';
|
|
493
505
|
export declare const useMeta: () => Readonly<{
|
|
494
|
-
meta:
|
|
506
|
+
meta: Meta;
|
|
495
507
|
title: Ref<string, string>;
|
|
496
508
|
keyword: Ref<string, string>;
|
|
497
509
|
description: Ref<string, string>;
|
|
@@ -512,10 +524,10 @@ export declare const useMeta: () => Readonly<{
|
|
|
512
524
|
setCanonical: (value: string) => void;
|
|
513
525
|
setRobots: (value: MetaRobots) => void;
|
|
514
526
|
setSiteName: (value: string) => void;
|
|
515
|
-
setSuffix: (suffix: string) =>
|
|
516
|
-
} & {
|
|
527
|
+
setSuffix: (suffix: string) => void;
|
|
528
|
+
}> & {
|
|
517
529
|
init(): Readonly<{
|
|
518
|
-
meta:
|
|
530
|
+
meta: Meta;
|
|
519
531
|
title: Ref<string, string>;
|
|
520
532
|
keyword: Ref<string, string>;
|
|
521
533
|
description: Ref<string, string>;
|
|
@@ -536,21 +548,11 @@ export declare const useMeta: () => Readonly<{
|
|
|
536
548
|
setCanonical: (value: string) => void;
|
|
537
549
|
setRobots: (value: MetaRobots) => void;
|
|
538
550
|
setSiteName: (value: string) => void;
|
|
539
|
-
setSuffix: (suffix: string) =>
|
|
551
|
+
setSuffix: (suffix: string) => void;
|
|
540
552
|
}>;
|
|
541
553
|
destroyExecute?(): void;
|
|
542
|
-
}
|
|
543
|
-
|
|
544
|
-
// File: src/composables/ref/useQueryRef.d.ts
|
|
545
|
-
import { ShallowRef } from 'vue';
|
|
554
|
+
};
|
|
546
555
|
export declare function useQueryRef<T>(name: string, defaultValue?: T | (() => T)): ShallowRef<T>;
|
|
547
|
-
|
|
548
|
-
// File: src/composables/ref/useRouterList.d.ts
|
|
549
|
-
import { Ref, ComputedRef } from 'vue';
|
|
550
|
-
import { NumberOrString } from '@dxtmisha/functional-basic';
|
|
551
|
-
import { ConstrBind } from '../../types/constructorTypes';
|
|
552
|
-
import { ListDataBasic } from '../../types/listTypes';
|
|
553
|
-
import { RefType } from '../../types/refTypes';
|
|
554
556
|
export declare const useRouterList: <T extends ListDataBasic>(list: RefType<ConstrBind<T>[] | undefined>, selected?: Ref<string> | string, hasTo?: boolean) => {
|
|
555
557
|
item: ComputedRef<T | undefined>;
|
|
556
558
|
selected: Ref<string, string>;
|
|
@@ -559,65 +561,50 @@ export declare const useRouterList: <T extends ListDataBasic>(list: RefType<Cons
|
|
|
559
561
|
to: (name?: string) => void;
|
|
560
562
|
toMain(): void;
|
|
561
563
|
};
|
|
562
|
-
|
|
563
|
-
// File: src/composables/ref/useSearchRef.d.ts
|
|
564
|
-
import { Ref, ComputedRef } from 'vue';
|
|
565
|
-
import { SearchColumns, SearchFormatList, SearchItem, SearchOptions } from '@dxtmisha/functional-basic';
|
|
566
|
-
import { SearchListInput } from '../../types/searchTypes';
|
|
567
|
-
export declare function useSearchRef<T extends SearchItem, K extends SearchColumns<T>>(list: SearchListInput<T>, columns: K, value?: Ref<string>, options?: SearchOptions): {
|
|
564
|
+
export declare function useSearchRef<T extends SearchItem, K extends SearchColumns<T>>(list: SearchListInput<T>, columns?: SearchColumnsInput<T, K>, value?: Ref<string>, options?: SearchOptions): {
|
|
568
565
|
isSearch: ComputedRef<boolean>;
|
|
569
566
|
search: Ref<string, string>;
|
|
570
567
|
loading: Ref<boolean, boolean>;
|
|
571
568
|
listSearch: ComputedRef<SearchFormatList<T, K>>;
|
|
572
569
|
length: ComputedRef<number>;
|
|
573
570
|
};
|
|
574
|
-
|
|
575
|
-
// File: src/composables/ref/useSearchValueRef.d.ts
|
|
576
|
-
import { Ref } from 'vue';
|
|
577
|
-
import { SearchList, SearchColumns, SearchItem } from '@dxtmisha/functional-basic';
|
|
578
571
|
export declare function useSearchValueRef<T extends SearchItem, K extends SearchColumns<T>>(item: SearchList<T, K>, value?: Ref<string>): {
|
|
579
572
|
search: Ref<string, string>;
|
|
580
573
|
searchDelay: Ref<string, string>;
|
|
581
574
|
loading: Ref<boolean, boolean>;
|
|
582
575
|
};
|
|
583
|
-
|
|
584
|
-
// File: src/composables/ref/useSessionRef.d.ts
|
|
585
|
-
import { Ref } from 'vue';
|
|
586
576
|
export declare function useSessionRef<T>(name: string, defaultValue?: T | (() => T)): Ref<T | undefined>;
|
|
587
|
-
|
|
588
|
-
// File: src/composables/ref/useStorageRef.d.ts
|
|
589
|
-
import { Ref } from 'vue';
|
|
590
577
|
export declare function useStorageRef<T>(name: string, defaultValue?: T | (() => T), cache?: number): Ref<T | undefined>;
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
578
|
+
/**
|
|
579
|
+
* Getting the translated text by an array of keys or a string with a key.
|
|
580
|
+
*
|
|
581
|
+
* It returns a `ShallowRef` that automatically updates when the global language changes.
|
|
582
|
+
* Use `as const` for arrays to ensure proper TypeScript key inference.
|
|
583
|
+
*
|
|
584
|
+
* ### Examples:
|
|
585
|
+
* ```typescript
|
|
586
|
+
* // 1. Using the main composable
|
|
587
|
+
* const translations = useTranslateRef(['home.title', 'home.description'] as const);
|
|
588
|
+
*
|
|
589
|
+
* // 2. Using the shorthand 't'
|
|
590
|
+
* const labels = t(['button.save', 'button.cancel'] as const);
|
|
591
|
+
* ```
|
|
592
|
+
*
|
|
593
|
+
* @param names a string or an array with keys
|
|
594
|
+
* @param translateInstance a translate instance
|
|
595
|
+
*/
|
|
595
596
|
export declare function useTranslateRef<T extends (string | string[])[]>(names: T, translateInstance?: TranslateInstance): ShallowRef<TranslateList<T>>;
|
|
597
|
+
/**
|
|
598
|
+
* Shorthand for useTranslateRef.
|
|
599
|
+
* Use `as const` for arrays to ensure proper TypeScript key inference.
|
|
600
|
+
*
|
|
601
|
+
* @param names a string or an array with keys
|
|
602
|
+
*/
|
|
596
603
|
export declare const t: <T extends string[]>(names: T) => ShallowRef<TranslateList<T>>;
|
|
597
|
-
|
|
598
|
-
// File: src/flags.d.ts
|
|
599
604
|
export declare const uiMakeFlags: () => void;
|
|
600
|
-
|
|
601
|
-
// File: src/functions/basic.d.ts
|
|
602
|
-
export * from '@dxtmisha/functional-basic';
|
|
603
|
-
|
|
604
|
-
// File: src/functions/computedAsync.d.ts
|
|
605
|
-
import { ComputedRef, DebuggerOptions } from 'vue';
|
|
606
605
|
export declare function computedAsync<R>(getter: (() => Promise<R>) | (() => R) | R, initialState?: (() => R) | R, ignore?: R, debugOptions?: DebuggerOptions): ComputedRef<R | undefined>;
|
|
607
|
-
|
|
608
|
-
// File: src/functions/computedByLanguage.d.ts
|
|
609
|
-
import { ComputedGetter, ComputedRef, DebuggerOptions } from 'vue';
|
|
610
606
|
export declare function computedByLanguage<T, R extends (T | undefined) = T | undefined>(getter: ComputedGetter<R>, getterNone?: R | (() => R), conditions?: () => boolean, debugOptions?: DebuggerOptions): ComputedRef<R>;
|
|
611
|
-
|
|
612
|
-
// File: src/functions/computedEternity.d.ts
|
|
613
|
-
import { Ref } from 'vue';
|
|
614
607
|
export declare function computedEternity<T>(getter: () => Promise<T> | T, initialState?: (() => T) | T): Ref<T, T>;
|
|
615
|
-
|
|
616
|
-
// File: src/functions/dxtFunctionalPlugin.d.ts
|
|
617
|
-
import { Plugin } from 'vue';
|
|
618
|
-
import { InputSocialIcons } from '@dxtmisha/media';
|
|
619
|
-
import { ApiConfig, ErrorCenterCauseList, ErrorCenterHandlerCallback, ErrorCenterHandlerList, IconsConfig, TranslateConfig } from '@dxtmisha/functional-basic';
|
|
620
|
-
import { Router } from 'vue-router';
|
|
621
608
|
export interface FunctionalPluginOptions {
|
|
622
609
|
api?: ApiConfig;
|
|
623
610
|
translate?: TranslateConfig;
|
|
@@ -630,9 +617,25 @@ export interface FunctionalPluginOptions {
|
|
|
630
617
|
errorHandlers?: ErrorCenterHandlerList;
|
|
631
618
|
errorCallbacks?: ErrorCenterHandlerCallback[];
|
|
632
619
|
}
|
|
620
|
+
/**
|
|
621
|
+
* Vue plugin for initializing and configuring global functional services
|
|
622
|
+
* (Api, Translate, Icons, Meta).
|
|
623
|
+
*
|
|
624
|
+
* @example
|
|
625
|
+
* ```typescript
|
|
626
|
+
* import { createApp } from 'vue'
|
|
627
|
+
* import { dxtFunctionalPlugin } from '@dxtmisha/functional'
|
|
628
|
+
* import router from './router'
|
|
629
|
+
*
|
|
630
|
+
* const app = createApp(App)
|
|
631
|
+
* app.use(dxtFunctionalPlugin, {
|
|
632
|
+
* api: { url: 'https://api.example.com' },
|
|
633
|
+
* metaSuffix: ' | My App',
|
|
634
|
+
* router
|
|
635
|
+
* })
|
|
636
|
+
* ```
|
|
637
|
+
*/
|
|
633
638
|
export declare const dxtFunctionalPlugin: Plugin;
|
|
634
|
-
|
|
635
|
-
// File: src/functions/executeUse.d.ts
|
|
636
639
|
export declare enum ExecuteUseType {
|
|
637
640
|
global = "global",
|
|
638
641
|
provide = "provide",
|
|
@@ -642,152 +645,130 @@ export type ExecuteUseReturn<R> = Readonly<R & {
|
|
|
642
645
|
init(): Readonly<R>;
|
|
643
646
|
destroyExecute?(): void;
|
|
644
647
|
}>;
|
|
648
|
+
/**
|
|
649
|
+
* Creates a managed singleton that encapsulates initialization logic and access mode.
|
|
650
|
+
*
|
|
651
|
+
* It supports three initialization strategies:
|
|
652
|
+
* - `global`: A single instance for the entire application.
|
|
653
|
+
* - `provide`: Shared via provide/inject in the component tree (standard for Vue 3).
|
|
654
|
+
* - `local`: A single instance within the closure of the returned function.
|
|
655
|
+
*
|
|
656
|
+
* @template R return type of the factory function
|
|
657
|
+
* @template O argument types for the factory function
|
|
658
|
+
* @template RI instance type with management methods
|
|
659
|
+
*
|
|
660
|
+
* @param callback initialization function
|
|
661
|
+
* @param type initialization strategy (defaults to provide)
|
|
662
|
+
*
|
|
663
|
+
* @returns {function} accessor function for the singleton
|
|
664
|
+
*
|
|
665
|
+
* @remarks
|
|
666
|
+
* Use this function in the following cases:
|
|
667
|
+
* - **API Services:** Always wrap API clients to ensure a single connection point and unified state.
|
|
668
|
+
* - **Resource Optimization:** For functions where creating multiple instances is undesirable (e.g., heavy objects, event buses).
|
|
669
|
+
* - **Shared State:** To share reactive state within a component tree using the `provide` strategy.
|
|
670
|
+
* - **External SDKs:** Initializing third-party libraries (analytics, maps, charts) that should be singletons.
|
|
671
|
+
*
|
|
672
|
+
* @example
|
|
673
|
+
* // 1. Global API singleton (useApiGet)
|
|
674
|
+
* export const useUserApi = executeUseGlobal(() => {
|
|
675
|
+
* return useApiGet('/api/user');
|
|
676
|
+
* });
|
|
677
|
+
*
|
|
678
|
+
* @example
|
|
679
|
+
* // 2. Shared Reactive State
|
|
680
|
+
* export const useFeatureState = executeUseProvide(() => {
|
|
681
|
+
* // Reactive logic here
|
|
682
|
+
* const items = [];
|
|
683
|
+
* const addItem = (item) => items.push(item);
|
|
684
|
+
* return { items, addItem };
|
|
685
|
+
* });
|
|
686
|
+
*
|
|
687
|
+
* @example
|
|
688
|
+
* // 3. Local Caching
|
|
689
|
+
* export const useHeavyResource = executeUseLocal((config) => {
|
|
690
|
+
* return new HeavyResource(config);
|
|
691
|
+
* });
|
|
692
|
+
*
|
|
693
|
+
* @example
|
|
694
|
+
* // 4. Complex API Service (useApiManagementRef)
|
|
695
|
+
* export const useUserManagement = executeUseGlobal(() => {
|
|
696
|
+
* return useApiManagementRef(
|
|
697
|
+
* { path: '/api/users' }, // GET setup
|
|
698
|
+
* { date: (v) => new Date(v).toLocaleString() }, // Formatters
|
|
699
|
+
* { columns: ['name', 'email'] }, // Search
|
|
700
|
+
* { path: '/api/users' }, // POST (create)
|
|
701
|
+
* { path: (o) => `/api/users/${o.id}` }, // PUT (update)
|
|
702
|
+
* { path: (o) => `/api/users/${o.id}` } // DELETE (remove)
|
|
703
|
+
* );
|
|
704
|
+
* });
|
|
705
|
+
*
|
|
706
|
+
* // Usage in component:
|
|
707
|
+
* // const { list, loading, sendPost, sendDelete } = useUserManagement();
|
|
708
|
+
*/
|
|
645
709
|
export declare function executeUse<R, O extends any[], RI extends ExecuteUseReturn<R> = ExecuteUseReturn<R>>(callback: (...args: O) => R, type?: ExecuteUseType): ((...args: O) => RI) | (() => RI);
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
710
|
+
/**
|
|
711
|
+
* Creates a global singleton.
|
|
712
|
+
*
|
|
713
|
+
* @remarks
|
|
714
|
+
* See {@link executeUse} for more details.
|
|
715
|
+
*
|
|
716
|
+
* @param callback Initialization function
|
|
717
|
+
*/
|
|
718
|
+
export declare function executeUseGlobal<R>(callback: () => R): (() => Readonly<R & {
|
|
719
|
+
init(): Readonly<R>;
|
|
720
|
+
destroyExecute?(): void;
|
|
721
|
+
}>) | (() => Readonly<R & {
|
|
722
|
+
init(): Readonly<R>;
|
|
723
|
+
destroyExecute?(): void;
|
|
724
|
+
}>);
|
|
725
|
+
/**
|
|
726
|
+
* Creates a component-scoped singleton.
|
|
727
|
+
*
|
|
728
|
+
* @remarks
|
|
729
|
+
* Best for sharing state within a component sub-tree.
|
|
730
|
+
* See {@link executeUse} for more details.
|
|
731
|
+
*
|
|
732
|
+
* @param callback Initialization function
|
|
733
|
+
*/
|
|
734
|
+
export declare function executeUseProvide<R, O extends any[]>(callback: (...args: O) => R): ((...args: O) => Readonly<R & {
|
|
735
|
+
init(): Readonly<R>;
|
|
736
|
+
destroyExecute?(): void;
|
|
737
|
+
}>) | (() => Readonly<R & {
|
|
738
|
+
init(): Readonly<R>;
|
|
739
|
+
destroyExecute?(): void;
|
|
740
|
+
}>);
|
|
741
|
+
/**
|
|
742
|
+
* Creates a local singleton.
|
|
743
|
+
*
|
|
744
|
+
* @remarks
|
|
745
|
+
* Best for internal state preservation within a closure.
|
|
746
|
+
* See {@link executeUse} for more details.
|
|
747
|
+
*
|
|
748
|
+
* @param callback Initialization function
|
|
749
|
+
*/
|
|
750
|
+
export declare function executeUseLocal<R, O extends any[]>(callback: (...args: O) => R): ((...args: O) => Readonly<R & {
|
|
751
|
+
init(): Readonly<R>;
|
|
752
|
+
destroyExecute?(): void;
|
|
753
|
+
}>) | (() => Readonly<R & {
|
|
754
|
+
init(): Readonly<R>;
|
|
755
|
+
destroyExecute?(): void;
|
|
756
|
+
}>);
|
|
649
757
|
export declare function executeUseGlobalInit(): void;
|
|
650
|
-
|
|
651
|
-
// File: src/functions/getInject.d.ts
|
|
652
758
|
export declare function getInject<T>(name: string): T | undefined;
|
|
653
|
-
|
|
654
|
-
// File: src/functions/getOptions.d.ts
|
|
655
|
-
import { ApiFetch } from '@dxtmisha/functional-basic';
|
|
656
|
-
import { ApiOptions } from '../types/apiTypes';
|
|
657
|
-
import { RefOrNormal } from '../types/refTypes';
|
|
658
759
|
export declare const getOptions: (options?: ApiOptions) => RefOrNormal<ApiFetch>;
|
|
659
|
-
|
|
660
|
-
// File: src/functions/ref/executeFunctionRef.d.ts
|
|
661
|
-
import { RefOrNormalOrFunction } from '../../types/refTypes';
|
|
662
760
|
export declare function executeFunctionRef<T>(data: RefOrNormalOrFunction<T>): T;
|
|
663
|
-
|
|
664
|
-
// File: src/functions/ref/getApiErrorRef.d.ts
|
|
665
|
-
import { ComputedRef } from 'vue';
|
|
666
|
-
import { ApiData, ApiErrorItem } from '@dxtmisha/functional-basic';
|
|
667
|
-
import { RefType } from '../../types/refTypes';
|
|
668
761
|
export declare function getApiErrorRef<R>(data: RefType<ApiData<R> | undefined>): ComputedRef<ApiErrorItem | undefined>;
|
|
669
|
-
|
|
670
|
-
// File: src/functions/ref/getBindRef.d.ts
|
|
671
|
-
import { ComputedRef } from 'vue';
|
|
672
|
-
import { ItemList } from '@dxtmisha/functional-basic';
|
|
673
|
-
import { RefOrNormal } from '../../types/refTypes';
|
|
674
762
|
export declare function getBindRef<T, R extends ItemList>(value: RefOrNormal<T | R> | undefined, nameExtra?: RefOrNormal<ItemList> | string, name?: string): ComputedRef<R>;
|
|
675
|
-
|
|
676
|
-
// File: src/functions/ref/getRef.d.ts
|
|
677
|
-
import { RefOrNormal } from '../../types/refTypes';
|
|
678
763
|
export declare function getRef<T>(item: RefOrNormal<T>): T;
|
|
679
|
-
|
|
680
|
-
// File: src/functions/ref/render.d.ts
|
|
681
|
-
import { VNode } from 'vue';
|
|
682
|
-
import { ItemList } from '@dxtmisha/functional-basic';
|
|
683
|
-
import { RawChildren, RawSlots } from '../../types/refTypes';
|
|
684
764
|
export declare function render<T extends ItemList>(name: string | any, props?: T, children?: RawChildren | RawSlots, index?: string): VNode;
|
|
685
|
-
|
|
686
|
-
// File: src/functions/ref/setRef.d.ts
|
|
687
|
-
import { Ref } from 'vue';
|
|
688
765
|
export declare function setRef<T>(item: Ref<T>, value: T): void;
|
|
689
|
-
|
|
690
|
-
// File: src/functions/ref/toRefItem.d.ts
|
|
691
|
-
import { Ref } from 'vue';
|
|
692
|
-
import { RefOrNormal } from '../../types/refTypes';
|
|
693
766
|
export declare function toRefItem<T>(item: RefOrNormal<T>): Ref<T>;
|
|
694
|
-
|
|
695
|
-
// File: src/functions/render/getBind.d.ts
|
|
696
|
-
import { ItemList } from '@dxtmisha/functional-basic';
|
|
697
|
-
import { ConstrBind } from '../../types/constructorTypes';
|
|
698
767
|
export declare function getBind<T, R extends ItemList>(value: T | R | undefined | null, nameExtra?: ItemList | string, name?: string, except?: boolean): ConstrBind<R>;
|
|
699
|
-
|
|
700
|
-
// File: src/functions/render/getClassName.d.ts
|
|
701
|
-
import { ItemList } from '@dxtmisha/functional-basic';
|
|
702
768
|
export declare function getClassName<T extends ItemList>(props?: T): string | undefined;
|
|
703
|
-
|
|
704
|
-
// File: src/functions/render/getIndexForRender.d.ts
|
|
705
|
-
import { ItemList } from '@dxtmisha/functional-basic';
|
|
706
769
|
export declare function getIndexForRender<T extends ItemList>(name: string | any, props?: T, index?: string): string | undefined;
|
|
707
|
-
|
|
708
|
-
// File: src/functions/toBind.d.ts
|
|
709
|
-
import { ItemList } from '@dxtmisha/functional-basic';
|
|
710
|
-
import { ConstrBind } from '../types/constructorTypes';
|
|
711
770
|
export declare function toBind<R extends ItemList = ItemList>(extra: ItemList, value: ItemList): ConstrBind<R>;
|
|
712
|
-
|
|
713
|
-
// File: src/functions/toBinds.d.ts
|
|
714
|
-
import { ItemList } from '@dxtmisha/functional-basic';
|
|
715
|
-
import { ConstrBind } from '../types/constructorTypes';
|
|
716
771
|
export declare function toBinds<R extends ItemList = ItemList>(...values: (ItemList | undefined)[]): ConstrBind<R>;
|
|
717
|
-
|
|
718
|
-
// File: src/library.d.ts
|
|
719
|
-
export * from './classes/design/DesignAbstract';
|
|
720
|
-
export * from './classes/design/DesignAsyncAbstract';
|
|
721
|
-
export * from './classes/design/DesignChanged';
|
|
722
|
-
export * from './classes/design/DesignComp';
|
|
723
|
-
export * from './classes/design/DesignComponents';
|
|
724
|
-
export * from './classes/design/DesignConstructorAbstract';
|
|
725
|
-
export * from './classes/ref/DatetimeRef';
|
|
726
|
-
export * from './classes/ref/EffectScopeGlobal';
|
|
727
|
-
export * from './classes/ref/EventRef';
|
|
728
|
-
export * from './classes/ref/GeoFlagRef';
|
|
729
|
-
export * from './classes/ref/GeoIntlRef';
|
|
730
|
-
export * from './classes/ref/GeoRef';
|
|
731
|
-
export * from './classes/ref/GeoUnitRef';
|
|
732
|
-
export * from './classes/ref/ListDataRef';
|
|
733
|
-
export * from './classes/ref/RouterItemRef';
|
|
734
|
-
export * from './classes/ref/ScrollbarWidthRef';
|
|
735
|
-
export * from './composables/ref/useApiAsyncRef';
|
|
736
|
-
export * from './composables/ref/useApiDelete';
|
|
737
|
-
export * from './composables/ref/useApiGet';
|
|
738
|
-
export * from './composables/ref/useApiManagementAsyncRef';
|
|
739
|
-
export * from './composables/ref/useApiManagementRef';
|
|
740
|
-
export * from './composables/ref/useApiPost';
|
|
741
|
-
export * from './composables/ref/useApiPut';
|
|
742
|
-
export * from './composables/ref/useApiRef';
|
|
743
|
-
export * from './composables/ref/useApiRequest';
|
|
744
|
-
export * from './composables/ref/useBroadcastValueRef';
|
|
745
|
-
export * from './composables/ref/useCookieRef';
|
|
746
|
-
export * from './composables/ref/useFormattersRef';
|
|
747
|
-
export * from './composables/ref/useGeoIntlRef';
|
|
748
|
-
export * from './composables/ref/useGeoUnitRef';
|
|
749
|
-
export * from './composables/ref/useHashRef';
|
|
750
|
-
export * from './composables/ref/useLazyItemByMarginRef';
|
|
751
|
-
export * from './composables/ref/useLazyRef';
|
|
752
|
-
export * from './composables/ref/useLoadingRef';
|
|
753
|
-
export * from './composables/ref/useMeta';
|
|
754
|
-
export * from './composables/ref/useQueryRef';
|
|
755
|
-
export * from './composables/ref/useRouterList';
|
|
756
|
-
export * from './composables/ref/useSearchRef';
|
|
757
|
-
export * from './composables/ref/useSearchValueRef';
|
|
758
|
-
export * from './composables/ref/useSessionRef';
|
|
759
|
-
export * from './composables/ref/useStorageRef';
|
|
760
|
-
export * from './composables/ref/useTranslateRef';
|
|
761
|
-
export * from './functions/basic';
|
|
762
|
-
export * from './functions/computedAsync';
|
|
763
|
-
export * from './functions/computedByLanguage';
|
|
764
|
-
export * from './functions/computedEternity';
|
|
765
|
-
export * from './functions/dxtFunctionalPlugin';
|
|
766
|
-
export * from './functions/executeUse';
|
|
767
|
-
export * from './functions/getInject';
|
|
768
|
-
export * from './functions/getOptions';
|
|
769
|
-
export * from './functions/ref/executeFunctionRef';
|
|
770
|
-
export * from './functions/ref/getApiErrorRef';
|
|
771
|
-
export * from './functions/ref/getBindRef';
|
|
772
|
-
export * from './functions/ref/getRef';
|
|
773
|
-
export * from './functions/ref/render';
|
|
774
|
-
export * from './functions/ref/setRef';
|
|
775
|
-
export * from './functions/ref/toRefItem';
|
|
776
|
-
export * from './functions/render/getBind';
|
|
777
|
-
export * from './functions/render/getClassName';
|
|
778
|
-
export * from './functions/render/getIndexForRender';
|
|
779
|
-
export * from './functions/toBind';
|
|
780
|
-
export * from './functions/toBinds';
|
|
781
|
-
export * from './types/apiTypes';
|
|
782
|
-
export * from './types/constructorTypes';
|
|
783
|
-
export * from './types/listTypes';
|
|
784
|
-
export * from './types/refTypes';
|
|
785
|
-
export * from './types/searchTypes';
|
|
786
|
-
|
|
787
|
-
// File: src/types/apiTypes.d.ts
|
|
788
|
-
import { ApiData, ApiDataValidation, ApiDefaultValue, ApiErrorStorageList, ApiFetch, ApiMethodItem, SearchColumns, SearchItem, SearchOptions } from '@dxtmisha/functional-basic';
|
|
789
|
-
import { RefOrNormal, RefType } from './refTypes';
|
|
790
|
-
import { Ref } from 'vue';
|
|
791
772
|
export type ApiOptions = ApiMethodItem | RefOrNormal<ApiFetch>;
|
|
792
773
|
export type ApiManagementValue = ApiDefaultValue | ApiDefaultValue[];
|
|
793
774
|
export type ApiManagementGet<Return extends ApiManagementValue, Type extends ApiManagementValue = Return> = {
|
|
@@ -817,23 +798,28 @@ export type ApiManagementRequest<T, Request extends ApiFetch['request'] = ApiFet
|
|
|
817
798
|
toData?: boolean;
|
|
818
799
|
options?: ApiOptions;
|
|
819
800
|
};
|
|
820
|
-
|
|
821
|
-
// File: src/types/constructorTypes.d.ts
|
|
822
|
-
import { Ref, PropType, ComputedRef } from 'vue';
|
|
823
|
-
import { Undefined } from '@dxtmisha/functional-basic';
|
|
824
|
-
import { RefOrNormal, RefType } from './refTypes';
|
|
825
801
|
export type ConstrItem = Record<string, any>;
|
|
826
|
-
export type ConstrValue<T = any> = {
|
|
802
|
+
export type ConstrValue<T = any> = {
|
|
803
|
+
value?: T;
|
|
804
|
+
};
|
|
827
805
|
export type ConstrComponent = Record<string, any>;
|
|
828
|
-
export type ConstrComponentMod<P extends ConstrItem> = ConstrItem | {
|
|
829
|
-
|
|
806
|
+
export type ConstrComponentMod<P extends ConstrItem> = ConstrItem | {
|
|
807
|
+
[K in keyof P]?: RefOrNormal<P[K]>;
|
|
808
|
+
};
|
|
809
|
+
export type ConstrExpose<E extends Element, EXPOSE extends ConstrItem> = EXPOSE & {
|
|
810
|
+
elementHtml?: ComputedRef<E | undefined>;
|
|
811
|
+
};
|
|
830
812
|
export type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
|
|
831
813
|
export type ConstrEmitItem<T extends ConstrItem> = T[keyof T];
|
|
832
|
-
export type ConstrEmit<T extends ConstrItem = ConstrItem> = UnionToIntersection<ConstrEmitItem<{
|
|
814
|
+
export type ConstrEmit<T extends ConstrItem = ConstrItem> = UnionToIntersection<ConstrEmitItem<{
|
|
815
|
+
[K in keyof T]: (evt: K, ...args: T[K]) => void;
|
|
816
|
+
}>>;
|
|
833
817
|
export type ConstrClassObject = Record<string, boolean | undefined>;
|
|
834
818
|
export type ConstrClass = string | (string | ConstrClass | Undefined)[] | ConstrClassObject;
|
|
835
819
|
export type ConstrClassList = Record<string, ConstrClass>;
|
|
836
|
-
export type ConstrClasses = {
|
|
820
|
+
export type ConstrClasses = {
|
|
821
|
+
main: ConstrClass;
|
|
822
|
+
} & ConstrClassList;
|
|
837
823
|
export type ConstrStylesItem = string | null;
|
|
838
824
|
export type ConstrStyles = Record<string, ConstrStylesItem> | ConstrStyles[];
|
|
839
825
|
export type ConstrOptions<COMP extends ConstrComponent, EMITS extends ConstrItem, P extends ConstrItem> = {
|
|
@@ -849,7 +835,10 @@ export type ConstrSetup<E extends Element, CLASSES extends ConstrClasses, SETUP
|
|
|
849
835
|
classes: RefType<CLASSES>;
|
|
850
836
|
styles: RefType<ConstrStyles>;
|
|
851
837
|
} & SETUP;
|
|
852
|
-
export type ConstrRegistration = {
|
|
838
|
+
export type ConstrRegistration = {
|
|
839
|
+
flag?: boolean;
|
|
840
|
+
translate?: Record<string, string>;
|
|
841
|
+
};
|
|
853
842
|
export type ConstrBind<T> = T & Record<string, any> & {
|
|
854
843
|
key?: string;
|
|
855
844
|
class?: ConstrClass;
|
|
@@ -862,12 +851,12 @@ export type ConstrPropItemOptions<T = any> = {
|
|
|
862
851
|
validator?(value: any, props: any): boolean;
|
|
863
852
|
};
|
|
864
853
|
export type ConstrPropItem<T = any> = ConstrPropItemOptions<T> | PropType<T>;
|
|
865
|
-
export type ConstrProps<P = Record<string, any>> = {
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
854
|
+
export type ConstrProps<P = Record<string, any>> = {
|
|
855
|
+
[K in keyof P]: ConstrPropItem<P[K]>;
|
|
856
|
+
};
|
|
857
|
+
export type ConstrHrefProps = {
|
|
858
|
+
href?: string;
|
|
859
|
+
};
|
|
871
860
|
export type ListType = 'item' | 'space' | 'line' | 'subtitle' | 'html' | 'menu' | 'menu-group' | 'group';
|
|
872
861
|
export type ListDataBasic = {
|
|
873
862
|
label?: NumberOrString;
|
|
@@ -895,18 +884,16 @@ export type ListSelectedItem = NumberOrStringOrBoolean;
|
|
|
895
884
|
export type ListSelectedList = ListSelectedItem | ListSelectedItem[];
|
|
896
885
|
export type ListName = string | number | undefined;
|
|
897
886
|
export type ListNames = ListName[];
|
|
898
|
-
|
|
899
|
-
// File: src/types/refTypes.d.ts
|
|
900
|
-
import { ComputedRef, Ref, VNode, VNodeArrayChildren } from 'vue';
|
|
901
887
|
export type RefType<T> = ComputedRef<T> | Ref<T>;
|
|
902
888
|
export type RefUndefined<T> = RefType<T | undefined>;
|
|
903
889
|
export type RefOrNormal<T> = RefType<T> | T;
|
|
904
890
|
export type RefOrNormalOrFunction<T> = RefOrNormal<T> | (() => RefOrNormal<T>);
|
|
905
891
|
export type RawChildren = string | number | boolean | VNode | VNodeArrayChildren | (() => any);
|
|
906
|
-
export type RawSlots = {
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
import { SearchItem, SearchListValue } from '@dxtmisha/functional-basic';
|
|
892
|
+
export type RawSlots = {
|
|
893
|
+
[name: string]: unknown;
|
|
894
|
+
$stable?: boolean;
|
|
895
|
+
};
|
|
911
896
|
export type SearchListValueRef<T extends SearchItem> = RefOrNormal<SearchListValue<T>>;
|
|
912
|
-
export type SearchListInput<T extends SearchItem> = SearchListValueRef<T> | (() => SearchListValueRef<T>);
|
|
897
|
+
export type SearchListInput<T extends SearchItem> = SearchListValueRef<T> | (() => SearchListValueRef<T>);
|
|
898
|
+
export type SearchColumnsRef<T extends SearchItem, K extends SearchColumns<T>> = RefOrNormal<K>;
|
|
899
|
+
export type SearchColumnsInput<T extends SearchItem, K extends SearchColumns<T>> = SearchColumnsRef<T, K> | (() => SearchColumnsRef<T, K>);
|