@xy-planning-network/trees 0.4.8 → 0.4.9-rc-1
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/trees.es.js +14 -13
- package/dist/trees.umd.js +4 -4
- package/package.json +1 -1
- package/types/api/base.d.ts +4 -4
- package/types/composables/useBaseAPI.d.ts +2 -2
- package/types/composables/useFlashes.d.ts +100 -0
- package/types/lib-components/forms/RadioCards.vue.d.ts +55 -0
- package/types/types/lists.d.ts +12 -0
package/package.json
CHANGED
package/types/api/base.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AxiosRequestConfig } from "axios";
|
|
2
2
|
export declare type RequestMethod = "GET" | "get" | "PUT" | "put" | "POST" | "post" | "DELETE" | "delete";
|
|
3
|
-
export interface RequestOptions
|
|
3
|
+
export interface RequestOptions {
|
|
4
4
|
/**
|
|
5
5
|
* returns the nested data key inside the AxiosResponse data when true
|
|
6
6
|
*/
|
|
@@ -15,10 +15,10 @@ export interface RequestOptions extends AxiosRequestConfig {
|
|
|
15
15
|
withDelay?: number;
|
|
16
16
|
}
|
|
17
17
|
declare const BaseAPI: {
|
|
18
|
-
makeRequest<T = any>(opts: RequestOptions): Promise<T>;
|
|
18
|
+
makeRequest<T = any>(config: AxiosRequestConfig, opts: RequestOptions): Promise<T>;
|
|
19
19
|
get<T_1 = any>(path: string, opts: RequestOptions, params?: Record<string, unknown> | undefined): Promise<T_1>;
|
|
20
20
|
delete<T_2 = any>(path: string, opts: RequestOptions): Promise<T_2>;
|
|
21
|
-
post<T_3 = any>(path: string, data: Record<string, unknown
|
|
22
|
-
put<T_4 = any>(path: string, data: Record<string, unknown
|
|
21
|
+
post<T_3 = any>(path: string, data: Record<string, unknown> | FormData, opts: RequestOptions): Promise<T_3>;
|
|
22
|
+
put<T_4 = any>(path: string, data: Record<string, unknown> | FormData, opts: RequestOptions): Promise<T_4>;
|
|
23
23
|
};
|
|
24
24
|
export default BaseAPI;
|
|
@@ -51,7 +51,7 @@ export interface UseBaseAPI<T> {
|
|
|
51
51
|
* Manually call the axios request
|
|
52
52
|
* can be used multiple times
|
|
53
53
|
*/
|
|
54
|
-
execute: (data?: Record<string, unknown
|
|
54
|
+
execute: (data?: Record<string, unknown> | FormData, opts?: RequestOptions) => Promise<T>;
|
|
55
55
|
}
|
|
56
56
|
/**
|
|
57
57
|
* useBaseAPI is a composable wrapper of BaseAPI
|
|
@@ -69,7 +69,7 @@ export default function useBaseAPI<T = any>(path: string, method?: RequestMethod
|
|
|
69
69
|
isAborted: Ref<boolean>;
|
|
70
70
|
hasFetched: Ref<boolean>;
|
|
71
71
|
abort: () => void;
|
|
72
|
-
execute: (data?: Record<string, unknown
|
|
72
|
+
execute: (data?: Record<string, unknown> | FormData, opts?: RequestOptions) => Promise<T>;
|
|
73
73
|
};
|
|
74
74
|
/**
|
|
75
75
|
* useBaseAPIGet is a convenience function for useBaseAPI
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { Ref } from "vue";
|
|
2
|
+
/**
|
|
3
|
+
* FlashMessage represents the shape of an on screen notification
|
|
4
|
+
* to a user.
|
|
5
|
+
*/
|
|
6
|
+
export interface FlashMessage {
|
|
7
|
+
/**
|
|
8
|
+
* The primary body text of the flash. It supports HTML.
|
|
9
|
+
*/
|
|
10
|
+
message: string;
|
|
11
|
+
/**
|
|
12
|
+
* Allow the flash to stay on the screen until the user removes it.
|
|
13
|
+
*/
|
|
14
|
+
persistent?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Determines the style of the flash.
|
|
17
|
+
*/
|
|
18
|
+
type: FlashType;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* FlashType is used to set the style of the flash that is displayed.
|
|
22
|
+
*/
|
|
23
|
+
export declare type FlashType = "warning" | "error" | "info" | "success";
|
|
24
|
+
/**
|
|
25
|
+
* The FlasherAPI offers a simple set of methods for adding and removing flash messages.
|
|
26
|
+
* The implementor of the FlasherAPI is responsible for determining where flashes are stored.
|
|
27
|
+
*/
|
|
28
|
+
export interface FlasherAPI {
|
|
29
|
+
add(flash: FlashMessage): string;
|
|
30
|
+
remove(id: string): void;
|
|
31
|
+
error(msg: string, persistent?: boolean): string;
|
|
32
|
+
info(msg: string, persistent?: boolean): string;
|
|
33
|
+
success(msg: string, persistent?: boolean): string;
|
|
34
|
+
warning(msg: string, persistent?: boolean): string;
|
|
35
|
+
genericError(email?: string, persistent?: boolean): string;
|
|
36
|
+
setConfig(config: FlasherConfig): void;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* A storage type for flash management.
|
|
40
|
+
*/
|
|
41
|
+
declare type FlashStore = Map<string, FlashMessage>;
|
|
42
|
+
/**
|
|
43
|
+
*
|
|
44
|
+
*/
|
|
45
|
+
interface FlasherConfig {
|
|
46
|
+
removeDelay?: number;
|
|
47
|
+
email?: string;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* newFlasher implements the FlasherAPI interface on the FlashStore it recieves
|
|
51
|
+
* the flash remove delay and a default email address for generic flashes is configurable
|
|
52
|
+
*/
|
|
53
|
+
export declare const newFlasher: (flashStore: FlashStore, flasherConfig?: FlasherConfig | undefined) => {
|
|
54
|
+
add(flash: FlashMessage): string;
|
|
55
|
+
remove(id: string): void;
|
|
56
|
+
flash(flash: FlashMessage): string;
|
|
57
|
+
error(message: string, persistent?: boolean): string;
|
|
58
|
+
info(message: string, persistent?: boolean): string;
|
|
59
|
+
success(message: string, persistent?: boolean): string;
|
|
60
|
+
warning(message: string, persistent?: boolean): string;
|
|
61
|
+
genericError(email?: string, persistent?: boolean): string;
|
|
62
|
+
setConfig: (newConfig: FlasherConfig) => void;
|
|
63
|
+
};
|
|
64
|
+
declare const flasher: {
|
|
65
|
+
add(flash: FlashMessage): string;
|
|
66
|
+
remove(id: string): void;
|
|
67
|
+
flash(flash: FlashMessage): string;
|
|
68
|
+
error(message: string, persistent?: boolean): string;
|
|
69
|
+
info(message: string, persistent?: boolean): string;
|
|
70
|
+
success(message: string, persistent?: boolean): string;
|
|
71
|
+
warning(message: string, persistent?: boolean): string;
|
|
72
|
+
genericError(email?: string, persistent?: boolean): string;
|
|
73
|
+
setConfig: (newConfig: FlasherConfig) => void;
|
|
74
|
+
};
|
|
75
|
+
export default flasher;
|
|
76
|
+
/**
|
|
77
|
+
* useFlashes exposes the module level global flashes and flasher for shared access to
|
|
78
|
+
* the a flash queue when a flashStore isn't provided
|
|
79
|
+
* @returns UseFlashes
|
|
80
|
+
*/
|
|
81
|
+
export declare function useFlashes(flashStore?: Ref<FlashStore>): {
|
|
82
|
+
flasher: {
|
|
83
|
+
add(flash: FlashMessage): string;
|
|
84
|
+
remove(id: string): void;
|
|
85
|
+
flash(flash: FlashMessage): string;
|
|
86
|
+
error(message: string, persistent?: boolean): string;
|
|
87
|
+
info(message: string, persistent?: boolean): string;
|
|
88
|
+
success(message: string, persistent?: boolean): string;
|
|
89
|
+
warning(message: string, persistent?: boolean): string;
|
|
90
|
+
genericError(email?: string, persistent?: boolean): string;
|
|
91
|
+
setConfig: (newConfig: FlasherConfig) => void;
|
|
92
|
+
};
|
|
93
|
+
flashes: Ref<Map<string, FlashMessage>>;
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* A helper method to load any flashes on the global Window.Flashes into the flashes ref.
|
|
97
|
+
* The flasher argument ultimately determines what flashes ref they should be added to.
|
|
98
|
+
* @param flasher FlashAPI
|
|
99
|
+
*/
|
|
100
|
+
export declare const loadWindowFlashes: (flasher: FlasherAPI) => void;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
declare type ModelValue = string | number;
|
|
2
|
+
declare type RadioCard = {
|
|
3
|
+
disabled?: boolean;
|
|
4
|
+
help?: string;
|
|
5
|
+
label: string;
|
|
6
|
+
sublabel?: string;
|
|
7
|
+
value: ModelValue;
|
|
8
|
+
};
|
|
9
|
+
declare const _default: import("vue").DefineComponent<{
|
|
10
|
+
columns: {
|
|
11
|
+
type: import("vue").PropType<2 | 3>;
|
|
12
|
+
} & {
|
|
13
|
+
default: undefined;
|
|
14
|
+
};
|
|
15
|
+
help: {
|
|
16
|
+
type: import("vue").PropType<string>;
|
|
17
|
+
} & {
|
|
18
|
+
default: string;
|
|
19
|
+
};
|
|
20
|
+
legend: {
|
|
21
|
+
type: import("vue").PropType<string>;
|
|
22
|
+
} & {
|
|
23
|
+
default: string;
|
|
24
|
+
};
|
|
25
|
+
modelValue: {
|
|
26
|
+
type: import("vue").PropType<ModelValue>;
|
|
27
|
+
required: true;
|
|
28
|
+
};
|
|
29
|
+
options: {
|
|
30
|
+
type: import("vue").PropType<RadioCard[]>;
|
|
31
|
+
required: true;
|
|
32
|
+
};
|
|
33
|
+
}, () => void, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
34
|
+
"update:modelValue": (modelValue: ModelValue) => void;
|
|
35
|
+
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
|
|
36
|
+
columns?: unknown;
|
|
37
|
+
help?: unknown;
|
|
38
|
+
legend?: unknown;
|
|
39
|
+
modelValue?: unknown;
|
|
40
|
+
options?: unknown;
|
|
41
|
+
} & {
|
|
42
|
+
modelValue: ModelValue;
|
|
43
|
+
help: string;
|
|
44
|
+
options: RadioCard[];
|
|
45
|
+
legend: string;
|
|
46
|
+
} & {
|
|
47
|
+
columns?: 2 | 3 | undefined;
|
|
48
|
+
}> & {
|
|
49
|
+
"onUpdate:modelValue"?: ((modelValue: ModelValue) => any) | undefined;
|
|
50
|
+
}, {
|
|
51
|
+
help: string;
|
|
52
|
+
legend: string;
|
|
53
|
+
columns: 2 | 3;
|
|
54
|
+
}>;
|
|
55
|
+
export default _default;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface Pagination {
|
|
2
|
+
page: number;
|
|
3
|
+
perPage: number;
|
|
4
|
+
totalItems: number;
|
|
5
|
+
totalPages: number;
|
|
6
|
+
}
|
|
7
|
+
export interface PaginationItems<T = any> {
|
|
8
|
+
items: T[];
|
|
9
|
+
}
|
|
10
|
+
export interface PaginationData<T = any> {
|
|
11
|
+
data: Pagination & PaginationItems<T>;
|
|
12
|
+
}
|