@piveau/sdk-vue 1.0.0-beta.5 → 1.0.0-beta.6
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/dist/index.d.mts +334 -248
- package/dist/index.d.ts +334 -248
- package/dist/index.mjs +269 -192
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as vue_demi from 'vue-demi';
|
|
2
|
+
import { MaybeRefOrGetter, InjectionKey, Slot, VNode, PropType, VNodeArrayChildren, MaybeRef, ComputedRef, Ref, App } from 'vue-demi';
|
|
2
3
|
import { UseQueryReturnType, QueryClient } from '@tanstack/vue-query';
|
|
3
4
|
export { QueryClient, UseQueryReturnType } from '@tanstack/vue-query';
|
|
5
|
+
import { Resource, SearchParamsBase, GetResourceResult, GetResourceByIdParams, SearchResult, Dataset, Distribution, Catalog, SearchParams, SearchResultFacetGroup } from '@piveau/sdk-core';
|
|
4
6
|
import * as zod from 'zod';
|
|
5
7
|
import { z, ZodSchema } from 'zod';
|
|
6
8
|
export { Schema, ZodObject as _ZodObject } from 'zod';
|
|
7
|
-
import { SearchParamsBase, GetResourceResult, GetResourceByIdParams, SearchResult, Resource, Dataset, Distribution, SearchParams, SearchResultFacetGroup } from '@piveau/sdk-core';
|
|
8
9
|
export { getNestedValue, getObjectValueByPath, replace } from './utils/vHelpers.mjs';
|
|
9
10
|
|
|
10
11
|
interface LocaleMessages {
|
|
@@ -42,6 +43,335 @@ declare function useLocaleUnwrapped(): UnwrappedLocaleInstance;
|
|
|
42
43
|
declare const localeKey: InjectionKey<LocaleInstance>;
|
|
43
44
|
declare function useLocale(): LocaleInstance;
|
|
44
45
|
|
|
46
|
+
/**
|
|
47
|
+
* Returns the representative locale from the given candidates based on the priority list.
|
|
48
|
+
* If none of the locales in the priority list are found in the candidates, the first candidate is returned.
|
|
49
|
+
* @returns The representative locale.
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```ts
|
|
53
|
+
* const candidates = ['en-US', 'en-GB', 'en']
|
|
54
|
+
* const preferredLocale = ['en-GB', 'en-US']
|
|
55
|
+
* const representativeLocale = getRepresentativeLocaleOf({ candidates, preferredLocale })
|
|
56
|
+
* console.log(representativeLocale) // 'en-GB'
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
declare function getRepresentativeLocaleOf({ candidates, preferredLocale, }: {
|
|
60
|
+
candidates: string[];
|
|
61
|
+
preferredLocale?: string | string[] | null;
|
|
62
|
+
}): string | undefined;
|
|
63
|
+
/**
|
|
64
|
+
* Retrieves the translation for the specified object based on the preferred locale.
|
|
65
|
+
* If the preferred locale is not found, an empty string is returned.
|
|
66
|
+
*
|
|
67
|
+
* @param obj - A record containing key-value pairs where keys represent locale codes and values represent translations.
|
|
68
|
+
* @param preferredLocale - A single locale or an array of locales representing the preference order.
|
|
69
|
+
* @returns The translation string for the most preferred available locale, or an empty string if no match is found.
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```ts
|
|
73
|
+
* const translations = { 'en': 'Hello', 'fr': 'Bonjour' }
|
|
74
|
+
* const locale = getTranslationFor(translations, ['fr', 'en'])
|
|
75
|
+
* console.log(locale) // 'Bonjour'
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
declare function getTranslationFor(obj?: Record<string, string> | null, preferredLocale?: string | string[] | null): string | undefined;
|
|
79
|
+
/**
|
|
80
|
+
* Retrieves a localized value from an object based on the preferred locale.
|
|
81
|
+
* If a translation is not found for the preferred locale, it attempts to use the fallback locale.
|
|
82
|
+
*
|
|
83
|
+
* @returns The translation string for the most preferred available locale, or an empty string if no match is found.
|
|
84
|
+
*/
|
|
85
|
+
declare function getLocalizedValue({ obj, fallbackLocale, }: {
|
|
86
|
+
obj?: Record<string, string> | null;
|
|
87
|
+
fallbackLocale: MaybeRefOrGetter<string>;
|
|
88
|
+
}): string;
|
|
89
|
+
/**
|
|
90
|
+
* Type guard that checks if the given value is not null or undefined. Helps with typings when
|
|
91
|
+
* filtering out null or undefined values from an array.
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* ```ts
|
|
95
|
+
* const filteredArray = array.filter(nonNullable)
|
|
96
|
+
* ```
|
|
97
|
+
*
|
|
98
|
+
* @param value - The value to check.
|
|
99
|
+
* @returns true if the value is not null or undefined, false otherwise.
|
|
100
|
+
*/
|
|
101
|
+
declare function nonNullable<T>(value: T): value is NonNullable<T>;
|
|
102
|
+
declare function isUrl(str: string): boolean;
|
|
103
|
+
/**
|
|
104
|
+
* Type guard for arrays that checks if all elements are strings.
|
|
105
|
+
*
|
|
106
|
+
*/
|
|
107
|
+
declare function isStringArray(x: any[]): x is string[];
|
|
108
|
+
/**
|
|
109
|
+
* Checks if the given value is empty.
|
|
110
|
+
*
|
|
111
|
+
* @param value - The value to check.
|
|
112
|
+
* @returns true if the value is empty, false otherwise.
|
|
113
|
+
*
|
|
114
|
+
* A value is considered empty if it is:
|
|
115
|
+
* - undefined
|
|
116
|
+
* - null
|
|
117
|
+
* - An object with no keys
|
|
118
|
+
* - A string with no content (after trimming)
|
|
119
|
+
*/
|
|
120
|
+
declare function isEmpty(value: any): boolean;
|
|
121
|
+
/**
|
|
122
|
+
* Converts the given value to an array if it is not already an array.
|
|
123
|
+
*/
|
|
124
|
+
declare function asArray<T>(arg: T | T[] | null): T[];
|
|
125
|
+
declare function hasSlotContent(slot: Slot | undefined | null, props?: any): boolean;
|
|
126
|
+
declare function isSlotEmpty(slot: Slot | undefined | null, props?: any): boolean;
|
|
127
|
+
declare function isVNodeEmpty(vnode: VNode | VNode[] | undefined | null): boolean;
|
|
128
|
+
interface SelectOption {
|
|
129
|
+
label: string;
|
|
130
|
+
value: string;
|
|
131
|
+
}
|
|
132
|
+
type SelectOptionList = SelectOption[];
|
|
133
|
+
interface Facet {
|
|
134
|
+
id: string;
|
|
135
|
+
label: string;
|
|
136
|
+
value?: string;
|
|
137
|
+
count?: number;
|
|
138
|
+
}
|
|
139
|
+
type FacetList<T extends string = string> = {
|
|
140
|
+
id: T;
|
|
141
|
+
label: string;
|
|
142
|
+
items: Facet[];
|
|
143
|
+
}[];
|
|
144
|
+
|
|
145
|
+
/** @public */
|
|
146
|
+
interface PropertyTableEntryBase {
|
|
147
|
+
id: string;
|
|
148
|
+
}
|
|
149
|
+
/** @public */
|
|
150
|
+
interface PropertyTableCellHref {
|
|
151
|
+
label: string;
|
|
152
|
+
href: string;
|
|
153
|
+
}
|
|
154
|
+
/** @public */
|
|
155
|
+
interface PropertyTableCellContact {
|
|
156
|
+
type: 'adress';
|
|
157
|
+
name: string;
|
|
158
|
+
address: string;
|
|
159
|
+
telephone: string;
|
|
160
|
+
email: string;
|
|
161
|
+
organization: string;
|
|
162
|
+
}
|
|
163
|
+
/** @public */
|
|
164
|
+
type PropertyTableCell = string | number;
|
|
165
|
+
/** @public */
|
|
166
|
+
interface PropertyTableEntryNode extends PropertyTableEntryBase {
|
|
167
|
+
type: 'node';
|
|
168
|
+
label: string;
|
|
169
|
+
help?: string;
|
|
170
|
+
isRoot?: boolean;
|
|
171
|
+
data?: PropertyTableEntry[];
|
|
172
|
+
/** @private */
|
|
173
|
+
__processed?: boolean;
|
|
174
|
+
}
|
|
175
|
+
/** @public */
|
|
176
|
+
interface PropertyTableRoot extends PropertyTableEntryNode {
|
|
177
|
+
type: 'node';
|
|
178
|
+
isRoot: true;
|
|
179
|
+
data?: PropertyTableEntry[];
|
|
180
|
+
}
|
|
181
|
+
/** @public */
|
|
182
|
+
interface PropertyTableEntryNodeSimplified extends PropertyTableEntryBase {
|
|
183
|
+
data: PropertyTableEntrySimplified | PropertyTableEntrySimplified[];
|
|
184
|
+
}
|
|
185
|
+
/** @public */
|
|
186
|
+
interface PropertyTableEntryValue extends PropertyTableEntryBase {
|
|
187
|
+
type: 'value';
|
|
188
|
+
badge?: string;
|
|
189
|
+
data: PropertyTableCell[] | PropertyTableCell;
|
|
190
|
+
}
|
|
191
|
+
/** @public */
|
|
192
|
+
interface PropertyTableEntryHref extends PropertyTableEntryBase {
|
|
193
|
+
type: 'href';
|
|
194
|
+
badge?: string;
|
|
195
|
+
data: PropertyTableCellHref | PropertyTableCellHref[];
|
|
196
|
+
}
|
|
197
|
+
/** @public */
|
|
198
|
+
interface PropertyTableLeafValue extends PropertyTableEntryBase {
|
|
199
|
+
type: 'value';
|
|
200
|
+
badge?: string;
|
|
201
|
+
data: string;
|
|
202
|
+
}
|
|
203
|
+
/** @public */
|
|
204
|
+
interface PropertyTableLeafHref extends PropertyTableEntryBase {
|
|
205
|
+
type: 'href';
|
|
206
|
+
badge?: string;
|
|
207
|
+
data: {
|
|
208
|
+
href: string;
|
|
209
|
+
label?: string;
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
/** @public */
|
|
213
|
+
type PropertyTableEntryLeaf = PropertyTableLeafValue | PropertyTableLeafHref;
|
|
214
|
+
/** @public */
|
|
215
|
+
type PropertyTableEntry = PropertyTableEntryNode | PropertyTableEntryLeaf;
|
|
216
|
+
/** @public */
|
|
217
|
+
type PropertyTableEntrySimplified = undefined | null | string | string[] | PropertyTableEntry | DefinePropertyNodeOptions & {
|
|
218
|
+
type: 'node';
|
|
219
|
+
};
|
|
220
|
+
/** @public */
|
|
221
|
+
type PropertyTableProps = PropertyTableEntry[];
|
|
222
|
+
/** @public */
|
|
223
|
+
interface DefinePropertyNodeOptions {
|
|
224
|
+
id: string;
|
|
225
|
+
label?: string;
|
|
226
|
+
help?: string;
|
|
227
|
+
data?: PropertyTableEntrySimplified | PropertyTableEntrySimplified[] | null;
|
|
228
|
+
__processed?: boolean;
|
|
229
|
+
}
|
|
230
|
+
/** @public */
|
|
231
|
+
interface DefinePropertyNodeGeneralOptions {
|
|
232
|
+
compact?: boolean;
|
|
233
|
+
debug?: boolean;
|
|
234
|
+
maxDepth?: number;
|
|
235
|
+
}
|
|
236
|
+
/** @public */
|
|
237
|
+
declare function definePropertyNode(nodeOptions: DefinePropertyNodeOptions, options?: DefinePropertyNodeGeneralOptions): PropertyTableEntryNode;
|
|
238
|
+
/** @public */
|
|
239
|
+
declare function definePropertyNodeCompact(nodeOptions: DefinePropertyNodeOptions, options?: Omit<DefinePropertyNodeGeneralOptions, 'compact'>): PropertyTableEntryNode;
|
|
240
|
+
/** @public */
|
|
241
|
+
interface DefinePropertyValueOptions {
|
|
242
|
+
id?: string;
|
|
243
|
+
data?: string | string[];
|
|
244
|
+
}
|
|
245
|
+
/** @public */
|
|
246
|
+
declare function definePropertyValue(propertyOptions: DefinePropertyValueOptions): PropertyTableEntryLeaf;
|
|
247
|
+
/**
|
|
248
|
+
* Parses a Resource object to a PropertyTableEntry.
|
|
249
|
+
* Determines the type of entry based on the presence of a resource URL.
|
|
250
|
+
* If the resource URL exists, it returns an entry of type 'href'.
|
|
251
|
+
* Otherwise, it returns an entry of type 'value'.
|
|
252
|
+
*
|
|
253
|
+
* @param obj - The Resource object to be parsed.
|
|
254
|
+
* @param id - An optional string used as a fallback for the entry's id.
|
|
255
|
+
* @returns A PropertyTableEntry object with type 'href' or 'value', or undefined if the input object is invalid.
|
|
256
|
+
* @public
|
|
257
|
+
*/
|
|
258
|
+
declare function parseResource(obj?: Resource | null, id?: string): PropertyTableEntryLeaf | undefined;
|
|
259
|
+
/**
|
|
260
|
+
* Parses an array of Resource objects to an array of PropertyTableEntry objects.
|
|
261
|
+
* It applies the parseResource function to each element and filters out any undefined values.
|
|
262
|
+
*
|
|
263
|
+
* @param obj - The array of Resource objects to be parsed.
|
|
264
|
+
* @param id - An optional string used as a fallback for the entry's id.
|
|
265
|
+
* @returns An array of PropertyTableEntry objects with type 'href' or 'value'.
|
|
266
|
+
* @public
|
|
267
|
+
*/
|
|
268
|
+
declare function parseResourceList(obj?: Resource[] | null, id?: string): PropertyTableEntryLeaf[];
|
|
269
|
+
/** @public */
|
|
270
|
+
declare function parseUrl(url?: string | null, id?: string): PropertyTableLeafHref | undefined;
|
|
271
|
+
/** @public */
|
|
272
|
+
declare function parseUrlList(urls?: string[] | null): PropertyTableLeafHref[];
|
|
273
|
+
interface SelectNodesOptions {
|
|
274
|
+
select?: string[];
|
|
275
|
+
discardUnused?: boolean;
|
|
276
|
+
}
|
|
277
|
+
/** @public */
|
|
278
|
+
interface SelectNodesByIdParams extends SelectNodesOptions {
|
|
279
|
+
nodes: PropertyTableEntryNode[];
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* Selects nodes by their id from a list of nodes.
|
|
283
|
+
*
|
|
284
|
+
* The function returns a new list of nodes that is sorted according to the order of their ids in the `select` array and does not contain any nodes that are not in the `select` array.
|
|
285
|
+
*
|
|
286
|
+
* @returns A new list of nodes that is sorted and filtered according to the options.
|
|
287
|
+
* @public
|
|
288
|
+
*/
|
|
289
|
+
declare function selectNodesById(options: SelectNodesByIdParams): PropertyTableEntryNode[];
|
|
290
|
+
|
|
291
|
+
declare const PropertyTableNode: vue_demi.DefineComponent<vue_demi.ExtractPropTypes<{
|
|
292
|
+
as: {
|
|
293
|
+
type: (StringConstructor | ObjectConstructor)[];
|
|
294
|
+
default: string;
|
|
295
|
+
};
|
|
296
|
+
nodes: {
|
|
297
|
+
type: PropType<PropertyTableEntry[]>;
|
|
298
|
+
default: () => never[];
|
|
299
|
+
};
|
|
300
|
+
depth: {
|
|
301
|
+
type: NumberConstructor;
|
|
302
|
+
default: number;
|
|
303
|
+
};
|
|
304
|
+
nodeClass: {
|
|
305
|
+
type: StringConstructor;
|
|
306
|
+
default: string;
|
|
307
|
+
};
|
|
308
|
+
}>, () => VNode<vue_demi.RendererNode, vue_demi.RendererElement, {
|
|
309
|
+
[key: string]: any;
|
|
310
|
+
}> | VNodeArrayChildren, {}, {}, {}, vue_demi.ComponentOptionsMixin, vue_demi.ComponentOptionsMixin, {}, string, vue_demi.PublicProps, Readonly<vue_demi.ExtractPropTypes<{
|
|
311
|
+
as: {
|
|
312
|
+
type: (StringConstructor | ObjectConstructor)[];
|
|
313
|
+
default: string;
|
|
314
|
+
};
|
|
315
|
+
nodes: {
|
|
316
|
+
type: PropType<PropertyTableEntry[]>;
|
|
317
|
+
default: () => never[];
|
|
318
|
+
};
|
|
319
|
+
depth: {
|
|
320
|
+
type: NumberConstructor;
|
|
321
|
+
default: number;
|
|
322
|
+
};
|
|
323
|
+
nodeClass: {
|
|
324
|
+
type: StringConstructor;
|
|
325
|
+
default: string;
|
|
326
|
+
};
|
|
327
|
+
}>> & Readonly<{}>, {
|
|
328
|
+
nodes: PropertyTableEntry[];
|
|
329
|
+
as: string | Record<string, any>;
|
|
330
|
+
depth: number;
|
|
331
|
+
nodeClass: string;
|
|
332
|
+
}, {}, {}, {}, string, vue_demi.ComponentProvideOptions, true, {}, any>;
|
|
333
|
+
declare const PropertyTable: vue_demi.DefineComponent<vue_demi.ExtractPropTypes<{
|
|
334
|
+
as: {
|
|
335
|
+
type: (StringConstructor | ObjectConstructor)[];
|
|
336
|
+
default: string;
|
|
337
|
+
};
|
|
338
|
+
root: {
|
|
339
|
+
type: BooleanConstructor;
|
|
340
|
+
default: boolean;
|
|
341
|
+
};
|
|
342
|
+
node: {
|
|
343
|
+
type: PropType<PropertyTableEntryNode>;
|
|
344
|
+
required: true;
|
|
345
|
+
};
|
|
346
|
+
nodeClass: {
|
|
347
|
+
type: StringConstructor;
|
|
348
|
+
default: string;
|
|
349
|
+
};
|
|
350
|
+
}>, () => VNode<vue_demi.RendererNode, vue_demi.RendererElement, {
|
|
351
|
+
[key: string]: any;
|
|
352
|
+
}>, {}, {}, {}, vue_demi.ComponentOptionsMixin, vue_demi.ComponentOptionsMixin, {}, string, vue_demi.PublicProps, Readonly<vue_demi.ExtractPropTypes<{
|
|
353
|
+
as: {
|
|
354
|
+
type: (StringConstructor | ObjectConstructor)[];
|
|
355
|
+
default: string;
|
|
356
|
+
};
|
|
357
|
+
root: {
|
|
358
|
+
type: BooleanConstructor;
|
|
359
|
+
default: boolean;
|
|
360
|
+
};
|
|
361
|
+
node: {
|
|
362
|
+
type: PropType<PropertyTableEntryNode>;
|
|
363
|
+
required: true;
|
|
364
|
+
};
|
|
365
|
+
nodeClass: {
|
|
366
|
+
type: StringConstructor;
|
|
367
|
+
default: string;
|
|
368
|
+
};
|
|
369
|
+
}>> & Readonly<{}>, {
|
|
370
|
+
as: string | Record<string, any>;
|
|
371
|
+
nodeClass: string;
|
|
372
|
+
root: boolean;
|
|
373
|
+
}, {}, {}, {}, string, vue_demi.ComponentProvideOptions, true, {}, any>;
|
|
374
|
+
|
|
45
375
|
type Reffify<T> = {
|
|
46
376
|
[key in keyof T]: MaybeRef<T[key]>;
|
|
47
377
|
};
|
|
@@ -1043,152 +1373,6 @@ declare function dcatApDataset(options?: DcatApDatasetParams): {
|
|
|
1043
1373
|
}>;
|
|
1044
1374
|
};
|
|
1045
1375
|
|
|
1046
|
-
/** @public */
|
|
1047
|
-
interface PropertyTableEntryBase {
|
|
1048
|
-
id: string;
|
|
1049
|
-
}
|
|
1050
|
-
/** @public */
|
|
1051
|
-
interface PropertyTableCellHref {
|
|
1052
|
-
label: string;
|
|
1053
|
-
href: string;
|
|
1054
|
-
}
|
|
1055
|
-
/** @public */
|
|
1056
|
-
interface PropertyTableCellContact {
|
|
1057
|
-
type: 'adress';
|
|
1058
|
-
name: string;
|
|
1059
|
-
address: string;
|
|
1060
|
-
telephone: string;
|
|
1061
|
-
email: string;
|
|
1062
|
-
organization: string;
|
|
1063
|
-
}
|
|
1064
|
-
/** @public */
|
|
1065
|
-
type PropertyTableCell = string | number;
|
|
1066
|
-
/** @public */
|
|
1067
|
-
interface PropertyTableEntryNode extends PropertyTableEntryBase {
|
|
1068
|
-
type: 'node';
|
|
1069
|
-
label: string;
|
|
1070
|
-
help?: string;
|
|
1071
|
-
isRoot?: boolean;
|
|
1072
|
-
data?: PropertyTableEntry[];
|
|
1073
|
-
/** @private */
|
|
1074
|
-
__processed?: boolean;
|
|
1075
|
-
}
|
|
1076
|
-
/** @public */
|
|
1077
|
-
interface PropertyTableRoot extends PropertyTableEntryNode {
|
|
1078
|
-
type: 'node';
|
|
1079
|
-
isRoot: true;
|
|
1080
|
-
data?: PropertyTableEntry[];
|
|
1081
|
-
}
|
|
1082
|
-
/** @public */
|
|
1083
|
-
interface PropertyTableEntryNodeSimplified extends PropertyTableEntryBase {
|
|
1084
|
-
data: PropertyTableEntrySimplified | PropertyTableEntrySimplified[];
|
|
1085
|
-
}
|
|
1086
|
-
/** @public */
|
|
1087
|
-
interface PropertyTableEntryValue extends PropertyTableEntryBase {
|
|
1088
|
-
type: 'value';
|
|
1089
|
-
badge?: string;
|
|
1090
|
-
data: PropertyTableCell[] | PropertyTableCell;
|
|
1091
|
-
}
|
|
1092
|
-
/** @public */
|
|
1093
|
-
interface PropertyTableEntryHref extends PropertyTableEntryBase {
|
|
1094
|
-
type: 'href';
|
|
1095
|
-
badge?: string;
|
|
1096
|
-
data: PropertyTableCellHref | PropertyTableCellHref[];
|
|
1097
|
-
}
|
|
1098
|
-
/** @public */
|
|
1099
|
-
interface PropertyTableLeafValue extends PropertyTableEntryBase {
|
|
1100
|
-
type: 'value';
|
|
1101
|
-
badge?: string;
|
|
1102
|
-
data: string;
|
|
1103
|
-
}
|
|
1104
|
-
/** @public */
|
|
1105
|
-
interface PropertyTableLeafHref extends PropertyTableEntryBase {
|
|
1106
|
-
type: 'href';
|
|
1107
|
-
badge?: string;
|
|
1108
|
-
data: {
|
|
1109
|
-
href: string;
|
|
1110
|
-
label?: string;
|
|
1111
|
-
};
|
|
1112
|
-
}
|
|
1113
|
-
/** @public */
|
|
1114
|
-
type PropertyTableEntryLeaf = PropertyTableLeafValue | PropertyTableLeafHref;
|
|
1115
|
-
/** @public */
|
|
1116
|
-
type PropertyTableEntry = PropertyTableEntryNode | PropertyTableEntryLeaf;
|
|
1117
|
-
/** @public */
|
|
1118
|
-
type PropertyTableEntrySimplified = undefined | null | string | string[] | PropertyTableEntry | DefinePropertyNodeOptions & {
|
|
1119
|
-
type: 'node';
|
|
1120
|
-
};
|
|
1121
|
-
/** @public */
|
|
1122
|
-
type PropertyTableProps = PropertyTableEntry[];
|
|
1123
|
-
/** @public */
|
|
1124
|
-
interface DefinePropertyNodeOptions {
|
|
1125
|
-
id: string;
|
|
1126
|
-
label?: string;
|
|
1127
|
-
help?: string;
|
|
1128
|
-
data?: PropertyTableEntrySimplified | PropertyTableEntrySimplified[] | null;
|
|
1129
|
-
__processed?: boolean;
|
|
1130
|
-
}
|
|
1131
|
-
/** @public */
|
|
1132
|
-
interface DefinePropertyNodeGeneralOptions {
|
|
1133
|
-
compact?: boolean;
|
|
1134
|
-
debug?: boolean;
|
|
1135
|
-
maxDepth?: number;
|
|
1136
|
-
}
|
|
1137
|
-
/** @public */
|
|
1138
|
-
declare function definePropertyNode(nodeOptions: DefinePropertyNodeOptions, options?: DefinePropertyNodeGeneralOptions): PropertyTableEntryNode;
|
|
1139
|
-
/** @public */
|
|
1140
|
-
declare function definePropertyNodeCompact(nodeOptions: DefinePropertyNodeOptions, options?: Omit<DefinePropertyNodeGeneralOptions, 'compact'>): PropertyTableEntryNode;
|
|
1141
|
-
/** @public */
|
|
1142
|
-
interface DefinePropertyValueOptions {
|
|
1143
|
-
id?: string;
|
|
1144
|
-
data?: string | string[];
|
|
1145
|
-
}
|
|
1146
|
-
/** @public */
|
|
1147
|
-
declare function definePropertyValue(propertyOptions: DefinePropertyValueOptions): PropertyTableEntryLeaf;
|
|
1148
|
-
/**
|
|
1149
|
-
* Parses a Resource object to a PropertyTableEntry.
|
|
1150
|
-
* Determines the type of entry based on the presence of a resource URL.
|
|
1151
|
-
* If the resource URL exists, it returns an entry of type 'href'.
|
|
1152
|
-
* Otherwise, it returns an entry of type 'value'.
|
|
1153
|
-
*
|
|
1154
|
-
* @param obj - The Resource object to be parsed.
|
|
1155
|
-
* @param id - An optional string used as a fallback for the entry's id.
|
|
1156
|
-
* @returns A PropertyTableEntry object with type 'href' or 'value', or undefined if the input object is invalid.
|
|
1157
|
-
* @public
|
|
1158
|
-
*/
|
|
1159
|
-
declare function parseResource(obj?: Resource | null, id?: string): PropertyTableEntryLeaf | undefined;
|
|
1160
|
-
/**
|
|
1161
|
-
* Parses an array of Resource objects to an array of PropertyTableEntry objects.
|
|
1162
|
-
* It applies the parseResource function to each element and filters out any undefined values.
|
|
1163
|
-
*
|
|
1164
|
-
* @param obj - The array of Resource objects to be parsed.
|
|
1165
|
-
* @param id - An optional string used as a fallback for the entry's id.
|
|
1166
|
-
* @returns An array of PropertyTableEntry objects with type 'href' or 'value'.
|
|
1167
|
-
* @public
|
|
1168
|
-
*/
|
|
1169
|
-
declare function parseResourceList(obj?: Resource[] | null, id?: string): PropertyTableEntryLeaf[];
|
|
1170
|
-
/** @public */
|
|
1171
|
-
declare function parseUrl(url?: string | null, id?: string): PropertyTableLeafHref | undefined;
|
|
1172
|
-
/** @public */
|
|
1173
|
-
declare function parseUrlList(urls?: string[] | null): PropertyTableLeafHref[];
|
|
1174
|
-
interface SelectNodesOptions {
|
|
1175
|
-
select?: string[];
|
|
1176
|
-
discardUnused?: boolean;
|
|
1177
|
-
}
|
|
1178
|
-
/** @public */
|
|
1179
|
-
interface SelectNodesByIdParams extends SelectNodesOptions {
|
|
1180
|
-
nodes: PropertyTableEntryNode[];
|
|
1181
|
-
}
|
|
1182
|
-
/**
|
|
1183
|
-
* Selects nodes by their id from a list of nodes.
|
|
1184
|
-
*
|
|
1185
|
-
* The function returns a new list of nodes that is sorted according to the order of their ids in the `select` array and does not contain any nodes that are not in the `select` array.
|
|
1186
|
-
*
|
|
1187
|
-
* @returns A new list of nodes that is sorted and filtered according to the options.
|
|
1188
|
-
* @public
|
|
1189
|
-
*/
|
|
1190
|
-
declare function selectNodesById(options: SelectNodesByIdParams): PropertyTableEntryNode[];
|
|
1191
|
-
|
|
1192
1376
|
interface GetPropertyTableBase<T> {
|
|
1193
1377
|
data: T;
|
|
1194
1378
|
localeInstance: UnwrappedLocaleInstance;
|
|
@@ -1202,6 +1386,7 @@ declare function getPropertyTableDataset(options: GetPropertyTableDatasetParams)
|
|
|
1202
1386
|
getPropertyTable: PropertyTableEntryNode[];
|
|
1203
1387
|
};
|
|
1204
1388
|
declare function getPropertyTableDistribution(options: GetPropertyTableDistributionParams): PropertyTableEntryNode[];
|
|
1389
|
+
declare function getPropertyTableCatalog(options: GetPropertyTableBase<Catalog>): PropertyTableEntryNode[];
|
|
1205
1390
|
|
|
1206
1391
|
interface SearchResultFacetGroupLocalized {
|
|
1207
1392
|
id: string;
|
|
@@ -1290,105 +1475,6 @@ interface UseSearchParams<TFacetNames extends string> {
|
|
|
1290
1475
|
}
|
|
1291
1476
|
declare function useSearchFactory<TSetup extends object, TFacetNames extends string, TIndex extends string = string, TModelSchema = any>(options: UseSearchFactoryParams<TFacetNames, TIndex, TModelSchema>, setup?: SetupFn<TSetup, TModelSchema>): (params: UseSearchParams<TFacetNames>) => UseSearchFactoryReturn<TFacetNames, TModelSchema, TSetup>;
|
|
1292
1477
|
|
|
1293
|
-
/**
|
|
1294
|
-
* Returns the representative locale from the given candidates based on the priority list.
|
|
1295
|
-
* If none of the locales in the priority list are found in the candidates, the first candidate is returned.
|
|
1296
|
-
* @returns The representative locale.
|
|
1297
|
-
*
|
|
1298
|
-
* @example
|
|
1299
|
-
* ```ts
|
|
1300
|
-
* const candidates = ['en-US', 'en-GB', 'en']
|
|
1301
|
-
* const preferredLocale = ['en-GB', 'en-US']
|
|
1302
|
-
* const representativeLocale = getRepresentativeLocaleOf({ candidates, preferredLocale })
|
|
1303
|
-
* console.log(representativeLocale) // 'en-GB'
|
|
1304
|
-
* ```
|
|
1305
|
-
*/
|
|
1306
|
-
declare function getRepresentativeLocaleOf({ candidates, preferredLocale, }: {
|
|
1307
|
-
candidates: string[];
|
|
1308
|
-
preferredLocale?: string | string[] | null;
|
|
1309
|
-
}): string | undefined;
|
|
1310
|
-
/**
|
|
1311
|
-
* Retrieves the translation for the specified object based on the preferred locale.
|
|
1312
|
-
* If the preferred locale is not found, an empty string is returned.
|
|
1313
|
-
*
|
|
1314
|
-
* @param obj - A record containing key-value pairs where keys represent locale codes and values represent translations.
|
|
1315
|
-
* @param preferredLocale - A single locale or an array of locales representing the preference order.
|
|
1316
|
-
* @returns The translation string for the most preferred available locale, or an empty string if no match is found.
|
|
1317
|
-
*
|
|
1318
|
-
* @example
|
|
1319
|
-
* ```ts
|
|
1320
|
-
* const translations = { 'en': 'Hello', 'fr': 'Bonjour' }
|
|
1321
|
-
* const locale = getTranslationFor(translations, ['fr', 'en'])
|
|
1322
|
-
* console.log(locale) // 'Bonjour'
|
|
1323
|
-
* ```
|
|
1324
|
-
*/
|
|
1325
|
-
declare function getTranslationFor(obj?: Record<string, string> | null, preferredLocale?: string | string[] | null): string | undefined;
|
|
1326
|
-
/**
|
|
1327
|
-
* Retrieves a localized value from an object based on the preferred locale.
|
|
1328
|
-
* If a translation is not found for the preferred locale, it attempts to use the fallback locale.
|
|
1329
|
-
*
|
|
1330
|
-
* @returns The translation string for the most preferred available locale, or an empty string if no match is found.
|
|
1331
|
-
*/
|
|
1332
|
-
declare function getLocalizedValue({ obj, fallbackLocale, }: {
|
|
1333
|
-
obj?: Record<string, string> | null;
|
|
1334
|
-
fallbackLocale: MaybeRefOrGetter<string>;
|
|
1335
|
-
}): string;
|
|
1336
|
-
/**
|
|
1337
|
-
* Type guard that checks if the given value is not null or undefined. Helps with typings when
|
|
1338
|
-
* filtering out null or undefined values from an array.
|
|
1339
|
-
*
|
|
1340
|
-
* @example
|
|
1341
|
-
* ```ts
|
|
1342
|
-
* const filteredArray = array.filter(nonNullable)
|
|
1343
|
-
* ```
|
|
1344
|
-
*
|
|
1345
|
-
* @param value - The value to check.
|
|
1346
|
-
* @returns true if the value is not null or undefined, false otherwise.
|
|
1347
|
-
*/
|
|
1348
|
-
declare function nonNullable<T>(value: T): value is NonNullable<T>;
|
|
1349
|
-
declare function isUrl(str: string): boolean;
|
|
1350
|
-
/**
|
|
1351
|
-
* Type guard for arrays that checks if all elements are strings.
|
|
1352
|
-
*
|
|
1353
|
-
*/
|
|
1354
|
-
declare function isStringArray(x: any[]): x is string[];
|
|
1355
|
-
/**
|
|
1356
|
-
* Checks if the given value is empty.
|
|
1357
|
-
*
|
|
1358
|
-
* @param value - The value to check.
|
|
1359
|
-
* @returns true if the value is empty, false otherwise.
|
|
1360
|
-
*
|
|
1361
|
-
* A value is considered empty if it is:
|
|
1362
|
-
* - undefined
|
|
1363
|
-
* - null
|
|
1364
|
-
* - An object with no keys
|
|
1365
|
-
* - A string with no content (after trimming)
|
|
1366
|
-
*/
|
|
1367
|
-
declare function isEmpty(value: any): boolean;
|
|
1368
|
-
/**
|
|
1369
|
-
* Converts the given value to an array if it is not already an array.
|
|
1370
|
-
*/
|
|
1371
|
-
declare function asArray<T>(arg: T | T[] | null): T[];
|
|
1372
|
-
declare function hasSlotContent(slot: Slot | undefined | null, props?: any): boolean;
|
|
1373
|
-
declare function isSlotEmpty(slot: Slot | undefined | null, props?: any): boolean;
|
|
1374
|
-
declare function isVNodeEmpty(vnode: VNode | VNode[] | undefined | null): boolean;
|
|
1375
|
-
interface SelectOption {
|
|
1376
|
-
label: string;
|
|
1377
|
-
value: string;
|
|
1378
|
-
}
|
|
1379
|
-
type SelectOptionList = SelectOption[];
|
|
1380
|
-
interface Facet {
|
|
1381
|
-
id: string;
|
|
1382
|
-
label: string;
|
|
1383
|
-
value?: string;
|
|
1384
|
-
count?: number;
|
|
1385
|
-
}
|
|
1386
|
-
type FacetList<T extends string = string> = {
|
|
1387
|
-
id: T;
|
|
1388
|
-
label: string;
|
|
1389
|
-
items: Facet[];
|
|
1390
|
-
}[];
|
|
1391
|
-
|
|
1392
1478
|
interface PiveauKitPluginOptions {
|
|
1393
1479
|
queryClient?: QueryClient;
|
|
1394
1480
|
locale?: LocaleOptions;
|
|
@@ -1404,4 +1490,4 @@ declare const piveauKitPlugin: {
|
|
|
1404
1490
|
install(app: App, options?: PiveauKitPluginOptions): void;
|
|
1405
1491
|
};
|
|
1406
1492
|
|
|
1407
|
-
export { type DateFormatStrings, type DateFormats, type DateLike, type DcatApDatasetParams, type DefineHubSearchOptions, type DefinePropertyNodeGeneralOptions, type DefinePropertyNodeOptions, type DefinePropertyValueOptions, type Facet, type FacetList, type GetPropertyTableBase, type GetPropertyTableDatasetParams, type GetPropertyTableDistributionParams, type HubSearchDefinition, type HubSearchIntegrationOptions, type LinkedDataFormats, type LocaleInstance, type LocaleMessages, type LocaleOptions, type PiveauKitPluginOptions, type PropertyTableCell, type PropertyTableCellContact, type PropertyTableCellHref, type PropertyTableEntry, type PropertyTableEntryBase, type PropertyTableEntryHref, type PropertyTableEntryLeaf, type PropertyTableEntryNode, type PropertyTableEntryNodeSimplified, type PropertyTableEntrySimplified, type PropertyTableEntryValue, type PropertyTableLeafHref, type PropertyTableLeafValue, type PropertyTableProps, type PropertyTableRoot, type ResolvedSetupFn, type SearchResultFacetGroupLocalized, type SelectNodesByIdParams, type SelectNodesOptions, type SelectOption, type SelectOptionList, type SetupContext, type SetupFn, type UnwrappedLocaleInstance, type UseResourceFactoryParams, type UseResourceFunction, type UseResourceParams, type UseResourceResult, type UseResourceResultBase, type UseResourceResultNoData, type UseResourceResultWithData, type UseSearchFactoryParams, type UseSearchFactoryReturn, type UseSearchParams, type _UseQueryReturnType, asArray, dcatApDataset, defineHubSearch, defineHubSearchIntegration, definePropertyNode, definePropertyNodeCompact, definePropertyValue, getCurrentApp, getLocalizedValue, getPropertyTableDataset, getPropertyTableDistribution, getRepresentativeLocaleOf, getTranslationFor, hasSlotContent, isEmpty, isSlotEmpty, isStringArray, isUrl, isVNodeEmpty, keyQueryClient, localeKey, nonNullable, parseResource, parseResourceList, parseUrl, parseUrlList, piveauKitPlugin, plugin, selectNodesById, unwrapLocaleInstance, useLocale, useLocaleUnwrapped, useQueryClient, useResourceFactory, useSearchFactory };
|
|
1493
|
+
export { type DateFormatStrings, type DateFormats, type DateLike, type DcatApDatasetParams, type DefineHubSearchOptions, type DefinePropertyNodeGeneralOptions, type DefinePropertyNodeOptions, type DefinePropertyValueOptions, type Facet, type FacetList, type GetPropertyTableBase, type GetPropertyTableDatasetParams, type GetPropertyTableDistributionParams, type HubSearchDefinition, type HubSearchIntegrationOptions, type LinkedDataFormats, type LocaleInstance, type LocaleMessages, type LocaleOptions, type PiveauKitPluginOptions, PropertyTable, type PropertyTableCell, type PropertyTableCellContact, type PropertyTableCellHref, type PropertyTableEntry, type PropertyTableEntryBase, type PropertyTableEntryHref, type PropertyTableEntryLeaf, type PropertyTableEntryNode, type PropertyTableEntryNodeSimplified, type PropertyTableEntrySimplified, type PropertyTableEntryValue, type PropertyTableLeafHref, type PropertyTableLeafValue, PropertyTableNode, type PropertyTableProps, type PropertyTableRoot, type ResolvedSetupFn, type SearchResultFacetGroupLocalized, type SelectNodesByIdParams, type SelectNodesOptions, type SelectOption, type SelectOptionList, type SetupContext, type SetupFn, type UnwrappedLocaleInstance, type UseResourceFactoryParams, type UseResourceFunction, type UseResourceParams, type UseResourceResult, type UseResourceResultBase, type UseResourceResultNoData, type UseResourceResultWithData, type UseSearchFactoryParams, type UseSearchFactoryReturn, type UseSearchParams, type _UseQueryReturnType, asArray, dcatApDataset, defineHubSearch, defineHubSearchIntegration, definePropertyNode, definePropertyNodeCompact, definePropertyValue, getCurrentApp, getLocalizedValue, getPropertyTableCatalog, getPropertyTableDataset, getPropertyTableDistribution, getRepresentativeLocaleOf, getTranslationFor, hasSlotContent, isEmpty, isSlotEmpty, isStringArray, isUrl, isVNodeEmpty, keyQueryClient, localeKey, nonNullable, parseResource, parseResourceList, parseUrl, parseUrlList, piveauKitPlugin, plugin, selectNodesById, unwrapLocaleInstance, useLocale, useLocaleUnwrapped, useQueryClient, useResourceFactory, useSearchFactory };
|