bt-core-app 1.1.3 → 1.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/BT-Span.vue.d.ts +17 -0
- package/dist/components/Dialog-Confirm.vue.d.ts +38 -0
- package/dist/components/Dialog-Select-Date.vue.d.ts +36 -0
- package/dist/components/Dialog-Select.vue.d.ts +48 -0
- package/dist/components/Dialog-Text.vue.d.ts +33 -0
- package/dist/composables/actions-tracker.d.ts +19 -0
- package/dist/composables/actions.d.ts +79 -0
- package/dist/composables/api.d.ts +85 -0
- package/dist/composables/auth.d.ts +58 -0
- package/dist/composables/cosmetics.d.ts +34 -0
- package/dist/composables/csv.d.ts +20 -0
- package/dist/composables/dates.d.ts +14 -0
- package/dist/composables/demo.d.ts +8 -0
- package/dist/composables/dialogs.d.ts +75 -0
- package/dist/composables/document-meta.d.ts +10 -0
- package/dist/composables/draggable.d.ts +56 -0
- package/dist/composables/filters.d.ts +10 -0
- package/dist/composables/forage.d.ts +7 -0
- package/dist/composables/helpers.d.ts +102 -0
- package/dist/composables/id.d.ts +1 -0
- package/dist/composables/navigation.d.ts +89 -0
- package/dist/composables/presets.d.ts +7 -0
- package/dist/composables/pwa.d.ts +13 -0
- package/dist/composables/resizable.d.ts +35 -0
- package/dist/composables/rules.d.ts +8 -0
- package/dist/composables/stores.d.ts +100 -0
- package/dist/composables/track.d.ts +12 -0
- package/dist/composables/urls.d.ts +7 -0
- package/dist/core.d.ts +18 -0
- package/dist/index.d.ts +16 -0
- package/dist/types.d.ts +11 -0
- package/dist/useApi.d.ts +30 -0
- package/package.json +2 -1
- package/vite.config.ts +5 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
interface Props {
|
|
2
|
+
filter: string;
|
|
3
|
+
prefix?: string;
|
|
4
|
+
suffix?: string;
|
|
5
|
+
value: any;
|
|
6
|
+
}
|
|
7
|
+
declare const _default: import('vue').DefineComponent<__VLS_TypePropsToRuntimeProps<Props>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<Props>>>, {}, {}>;
|
|
8
|
+
export default _default;
|
|
9
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
10
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
11
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
12
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
13
|
+
} : {
|
|
14
|
+
type: import('vue').PropType<T[K]>;
|
|
15
|
+
required: true;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ConfirmDialogProps } from '../composables/dialogs';
|
|
2
|
+
|
|
3
|
+
declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<ConfirmDialogProps>, {
|
|
4
|
+
cancelValue: boolean;
|
|
5
|
+
confirmValue: boolean;
|
|
6
|
+
startIncludeDetails: boolean;
|
|
7
|
+
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
8
|
+
cancel: (...args: any[]) => void;
|
|
9
|
+
confirm: (...args: any[]) => void;
|
|
10
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<ConfirmDialogProps>, {
|
|
11
|
+
cancelValue: boolean;
|
|
12
|
+
confirmValue: boolean;
|
|
13
|
+
startIncludeDetails: boolean;
|
|
14
|
+
}>>> & {
|
|
15
|
+
onCancel?: ((...args: any[]) => any) | undefined;
|
|
16
|
+
onConfirm?: ((...args: any[]) => any) | undefined;
|
|
17
|
+
}, {
|
|
18
|
+
cancelValue: any;
|
|
19
|
+
confirmValue: any;
|
|
20
|
+
}, {}>;
|
|
21
|
+
export default _default;
|
|
22
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
23
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
24
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
25
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
26
|
+
} : {
|
|
27
|
+
type: import('vue').PropType<T[K]>;
|
|
28
|
+
required: true;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
type __VLS_WithDefaults<P, D> = {
|
|
32
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
33
|
+
default: D[K];
|
|
34
|
+
}> : P[K];
|
|
35
|
+
};
|
|
36
|
+
type __VLS_Prettify<T> = {
|
|
37
|
+
[K in keyof T]: T[K];
|
|
38
|
+
} & {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { SelectDateProps } from '../composables/dialogs';
|
|
2
|
+
|
|
3
|
+
declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<SelectDateProps>, {
|
|
4
|
+
cancelValue: boolean;
|
|
5
|
+
height: string;
|
|
6
|
+
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
7
|
+
cancel: (...args: any[]) => void;
|
|
8
|
+
confirm: (...args: any[]) => void;
|
|
9
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<SelectDateProps>, {
|
|
10
|
+
cancelValue: boolean;
|
|
11
|
+
height: string;
|
|
12
|
+
}>>> & {
|
|
13
|
+
onCancel?: ((...args: any[]) => any) | undefined;
|
|
14
|
+
onConfirm?: ((...args: any[]) => any) | undefined;
|
|
15
|
+
}, {
|
|
16
|
+
height: string;
|
|
17
|
+
cancelValue: any;
|
|
18
|
+
}, {}>;
|
|
19
|
+
export default _default;
|
|
20
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
21
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
22
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
23
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
24
|
+
} : {
|
|
25
|
+
type: import('vue').PropType<T[K]>;
|
|
26
|
+
required: true;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
type __VLS_WithDefaults<P, D> = {
|
|
30
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
31
|
+
default: D[K];
|
|
32
|
+
}> : P[K];
|
|
33
|
+
};
|
|
34
|
+
type __VLS_Prettify<T> = {
|
|
35
|
+
[K in keyof T]: T[K];
|
|
36
|
+
} & {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { SelectDialogProps } from '../composables/dialogs';
|
|
2
|
+
|
|
3
|
+
declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<SelectDialogProps>, {
|
|
4
|
+
cancelValue: boolean;
|
|
5
|
+
height: string;
|
|
6
|
+
showSearch: boolean;
|
|
7
|
+
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
8
|
+
cancel: (...args: any[]) => void;
|
|
9
|
+
confirm: (...args: any[]) => void;
|
|
10
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<SelectDialogProps>, {
|
|
11
|
+
cancelValue: boolean;
|
|
12
|
+
height: string;
|
|
13
|
+
showSearch: boolean;
|
|
14
|
+
}>>> & {
|
|
15
|
+
onCancel?: ((...args: any[]) => any) | undefined;
|
|
16
|
+
onConfirm?: ((...args: any[]) => any) | undefined;
|
|
17
|
+
}, {
|
|
18
|
+
height: string;
|
|
19
|
+
cancelValue: any;
|
|
20
|
+
showSearch: boolean;
|
|
21
|
+
}, {}>, {
|
|
22
|
+
default?(_: {
|
|
23
|
+
item: any;
|
|
24
|
+
}): any;
|
|
25
|
+
}>;
|
|
26
|
+
export default _default;
|
|
27
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
28
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
29
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
30
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
31
|
+
} : {
|
|
32
|
+
type: import('vue').PropType<T[K]>;
|
|
33
|
+
required: true;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
type __VLS_WithDefaults<P, D> = {
|
|
37
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
38
|
+
default: D[K];
|
|
39
|
+
}> : P[K];
|
|
40
|
+
};
|
|
41
|
+
type __VLS_Prettify<T> = {
|
|
42
|
+
[K in keyof T]: T[K];
|
|
43
|
+
} & {};
|
|
44
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
45
|
+
new (): {
|
|
46
|
+
$slots: S;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { TextDialogProps } from '../composables/dialogs';
|
|
2
|
+
|
|
3
|
+
declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<TextDialogProps>, {
|
|
4
|
+
height: string;
|
|
5
|
+
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
6
|
+
cancel: (...args: any[]) => void;
|
|
7
|
+
confirm: (...args: any[]) => void;
|
|
8
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<TextDialogProps>, {
|
|
9
|
+
height: string;
|
|
10
|
+
}>>> & {
|
|
11
|
+
onCancel?: ((...args: any[]) => any) | undefined;
|
|
12
|
+
onConfirm?: ((...args: any[]) => any) | undefined;
|
|
13
|
+
}, {
|
|
14
|
+
height: string;
|
|
15
|
+
}, {}>;
|
|
16
|
+
export default _default;
|
|
17
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
18
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
19
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
20
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
21
|
+
} : {
|
|
22
|
+
type: import('vue').PropType<T[K]>;
|
|
23
|
+
required: true;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
type __VLS_WithDefaults<P, D> = {
|
|
27
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
28
|
+
default: D[K];
|
|
29
|
+
}> : P[K];
|
|
30
|
+
};
|
|
31
|
+
type __VLS_Prettify<T> = {
|
|
32
|
+
[K in keyof T]: T[K];
|
|
33
|
+
} & {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ShallowRef } from 'vue';
|
|
2
|
+
|
|
3
|
+
export interface DoActionOptions {
|
|
4
|
+
completionMsg?: string;
|
|
5
|
+
confirmationMsg?: string;
|
|
6
|
+
errorMsg?: string;
|
|
7
|
+
loadingMsg?: string;
|
|
8
|
+
requireConfirmation?: boolean;
|
|
9
|
+
throwError?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare function useActionsTracker(useOptions?: DoActionOptions): {
|
|
12
|
+
actionErrorMsg: ShallowRef<string | undefined>;
|
|
13
|
+
actionLoadingMsg: ShallowRef<string | undefined>;
|
|
14
|
+
actionCompleteMsg: ShallowRef<string | undefined>;
|
|
15
|
+
clearErrors: () => void;
|
|
16
|
+
doAction: (action: any, options?: DoActionOptions) => Promise<any>;
|
|
17
|
+
isLoading: import('vue').ComputedRef<boolean>;
|
|
18
|
+
logError: (err?: string | Error) => void;
|
|
19
|
+
};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { ShallowRef, ComputedRef } from 'vue';
|
|
2
|
+
import { DoActionOptions } from './actions-tracker';
|
|
3
|
+
import { BTApi, PathOptions } from './api';
|
|
4
|
+
import { BTStore } from './stores';
|
|
5
|
+
import { BladeMode } from '../types';
|
|
6
|
+
|
|
7
|
+
export type OnCanDoAsync = (item: any) => Promise<string | undefined>;
|
|
8
|
+
export type OnDoAsync = (item: any) => Promise<string | undefined>;
|
|
9
|
+
export type OnDoSuccessAsync = (item: any) => Promise<any>;
|
|
10
|
+
export type OnGetAsync = (opt?: GetOptions) => Promise<any>;
|
|
11
|
+
export type OnGetSuccessAsync = (item: any, opt?: GetOptions) => Promise<any>;
|
|
12
|
+
export interface GetOptions extends PathOptions, DoActionOptions {
|
|
13
|
+
/**returns an error msg if failed */
|
|
14
|
+
onGetAsync?: OnGetAsync;
|
|
15
|
+
/**called after get occurs successfully */
|
|
16
|
+
onGetSuccessAsync?: OnGetSuccessAsync;
|
|
17
|
+
store?: BTStore;
|
|
18
|
+
}
|
|
19
|
+
export interface DeleteOptions extends PathOptions, DoActionOptions {
|
|
20
|
+
/**Returns a string if cannot */
|
|
21
|
+
onCanDeleteAsync?: OnCanDoAsync;
|
|
22
|
+
/**Will override the default store delete action */
|
|
23
|
+
onDeleteAsync?: OnDoAsync;
|
|
24
|
+
/**Will open a dialog box requesting user confirmation for delete action */
|
|
25
|
+
onDeleteSuccessAsync?: OnDoAsync;
|
|
26
|
+
store?: BTStore;
|
|
27
|
+
}
|
|
28
|
+
export interface RestoreOptions extends PathOptions, DoActionOptions {
|
|
29
|
+
/**Returns a string if cannot */
|
|
30
|
+
onCanRestoreAsync?: OnCanDoAsync;
|
|
31
|
+
/**Will override the default store delete action */
|
|
32
|
+
onRestoreAsync?: OnDoSuccessAsync;
|
|
33
|
+
/**Called after restore succeeds */
|
|
34
|
+
onRestoreSuccessAsync?: OnDoSuccessAsync;
|
|
35
|
+
store?: BTStore;
|
|
36
|
+
}
|
|
37
|
+
export interface SaveOptions extends PathOptions, DoActionOptions {
|
|
38
|
+
/**will seek to post if 'new' otherwise will patch */
|
|
39
|
+
mode?: BladeMode;
|
|
40
|
+
/**called to check whether to proceed with save */
|
|
41
|
+
onCanSaveAsync?: OnCanDoAsync;
|
|
42
|
+
/**
|
|
43
|
+
* retrieves item to save
|
|
44
|
+
* called before seeing whether it can save
|
|
45
|
+
*/
|
|
46
|
+
onGetSaveAsync?: OnDoSuccessAsync;
|
|
47
|
+
/**Will override the default store post/patch action */
|
|
48
|
+
onSaveAsync?: OnDoSuccessAsync;
|
|
49
|
+
/**Called after save succeeds */
|
|
50
|
+
onSaveSuccessAsync?: OnDoSuccessAsync;
|
|
51
|
+
store?: BTStore;
|
|
52
|
+
}
|
|
53
|
+
export interface ApiActionOptions extends PathOptions, DoActionOptions {
|
|
54
|
+
api: BTApi;
|
|
55
|
+
}
|
|
56
|
+
export interface UseActionsOptions extends DoActionOptions {
|
|
57
|
+
nav?: string;
|
|
58
|
+
proxyID?: string;
|
|
59
|
+
refresh?: boolean;
|
|
60
|
+
store?: BTStore;
|
|
61
|
+
throwError?: boolean;
|
|
62
|
+
url?: string;
|
|
63
|
+
}
|
|
64
|
+
export interface BTActions {
|
|
65
|
+
apiGet: (doOptions: ApiActionOptions) => Promise<any>;
|
|
66
|
+
apiPost: (doOptions: ApiActionOptions) => Promise<any>;
|
|
67
|
+
actionLoadingMsg: ShallowRef<string | undefined>;
|
|
68
|
+
actionErrorMsg: ShallowRef<string | undefined>;
|
|
69
|
+
clearErrors: () => void;
|
|
70
|
+
deleteItem: (doOptions: DeleteOptions) => Promise<any>;
|
|
71
|
+
doAction: (action: any, options?: DoActionOptions) => Promise<any>;
|
|
72
|
+
getAllItems: (doOptions: GetOptions) => Promise<any>;
|
|
73
|
+
getItem: (doOptions: GetOptions) => Promise<any>;
|
|
74
|
+
isLoading: ComputedRef<boolean>;
|
|
75
|
+
logError: (err?: string | Error) => void;
|
|
76
|
+
restoreItem: (doOptions: RestoreOptions) => Promise<any>;
|
|
77
|
+
saveItem: (doOptions: SaveOptions) => Promise<any>;
|
|
78
|
+
}
|
|
79
|
+
export declare function useActions(options?: UseActionsOptions): BTActions;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { BTAuth } from './auth';
|
|
2
|
+
|
|
3
|
+
export interface QueryParams {
|
|
4
|
+
filterBy?: string;
|
|
5
|
+
includeCount?: boolean;
|
|
6
|
+
includeDetails?: boolean;
|
|
7
|
+
includeInactive?: boolean;
|
|
8
|
+
lastUpdate?: string;
|
|
9
|
+
other?: any;
|
|
10
|
+
properties?: string[] | string;
|
|
11
|
+
query?: string;
|
|
12
|
+
searchString?: string;
|
|
13
|
+
sortOrder?: string;
|
|
14
|
+
sortBy?: string;
|
|
15
|
+
takeFrom?: number;
|
|
16
|
+
takeAmount?: number;
|
|
17
|
+
}
|
|
18
|
+
export interface PathOptions {
|
|
19
|
+
/**always added to end before query {url}/{additionalUrl}?{query} */
|
|
20
|
+
additionalUrl?: string;
|
|
21
|
+
/**application/json or other options */
|
|
22
|
+
contentType?: string;
|
|
23
|
+
/**that data to send in the body for POST, PATCH, and DELETE requests */
|
|
24
|
+
data?: any;
|
|
25
|
+
/** resulting url after building {nav | url}/{additionalUrl}?{params} */
|
|
26
|
+
finalUrl?: string;
|
|
27
|
+
/**override default headers */
|
|
28
|
+
headers?: HeadersInit;
|
|
29
|
+
/**id will be added as a url paramter (/{id}?) rather than as a query parameter */
|
|
30
|
+
id?: string;
|
|
31
|
+
/**where to find the url */
|
|
32
|
+
nav?: string;
|
|
33
|
+
/**headers will not be calculated. Only the given headers in these options will be used */
|
|
34
|
+
overrideHeaders?: boolean;
|
|
35
|
+
/**query parameters */
|
|
36
|
+
params?: QueryParams;
|
|
37
|
+
/**attaches a proxyID to the request */
|
|
38
|
+
proxyID?: string;
|
|
39
|
+
/**whether to refresh the store data and go straight to the server */
|
|
40
|
+
refresh?: boolean;
|
|
41
|
+
/**returns result as a json object. Defaults to true. */
|
|
42
|
+
returnJson?: boolean;
|
|
43
|
+
/**returns result as a string */
|
|
44
|
+
returnText?: boolean;
|
|
45
|
+
/**If false, returns response no matter the status code */
|
|
46
|
+
throwError?: boolean;
|
|
47
|
+
/**if exists then overrides default nav */
|
|
48
|
+
url?: string;
|
|
49
|
+
/**whether to preference using the local cache */
|
|
50
|
+
useLocalCache?: boolean;
|
|
51
|
+
}
|
|
52
|
+
type FindPath = (navName?: string) => string | undefined;
|
|
53
|
+
interface UseApiOptions {
|
|
54
|
+
auth?: BTAuth;
|
|
55
|
+
/**overrides the default */
|
|
56
|
+
buildHeaders?: (path: PathOptions) => HeadersInit;
|
|
57
|
+
/**build a query. Overrides the default */
|
|
58
|
+
buildQuery?: (params: any) => string;
|
|
59
|
+
/**overrides the default */
|
|
60
|
+
buildUrl?: (path: PathOptions) => string;
|
|
61
|
+
/**defaults to 'application/json' */
|
|
62
|
+
defaultContentType?: string;
|
|
63
|
+
/**returns result as a json object. Defaults to true. */
|
|
64
|
+
defaultReturnJson?: boolean;
|
|
65
|
+
/**returns result as a string */
|
|
66
|
+
defaultReturnText?: boolean;
|
|
67
|
+
/**defaults to true. Will throw an error on fail */
|
|
68
|
+
defaultThrowError?: boolean;
|
|
69
|
+
/**defaults to a function that returns '' */
|
|
70
|
+
findPath?: FindPath;
|
|
71
|
+
/**if true and logged in then will set an authorization header with 'bearer [token]' */
|
|
72
|
+
useBearerToken?: boolean;
|
|
73
|
+
}
|
|
74
|
+
export interface BTApi {
|
|
75
|
+
buildHeaders: (options: PathOptions) => HeadersInit;
|
|
76
|
+
buildQuery: (params: any) => string;
|
|
77
|
+
buildUrl: (path: PathOptions) => string;
|
|
78
|
+
deleteItem: (pathOptions: PathOptions) => Promise<string | undefined>;
|
|
79
|
+
get: <T>(pathOptions: PathOptions) => Promise<T>;
|
|
80
|
+
getAll: <T>(pathOptions: PathOptions) => Promise<T>;
|
|
81
|
+
post: <T>(pathOptions: PathOptions) => Promise<T | undefined>;
|
|
82
|
+
patch: <T>(pathOptions: PathOptions) => Promise<T | undefined>;
|
|
83
|
+
}
|
|
84
|
+
export declare function createApi(options?: UseApiOptions): BTApi;
|
|
85
|
+
export {};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { BTDemo } from './demo';
|
|
2
|
+
import { RemovableRef } from '@vueuse/core';
|
|
3
|
+
|
|
4
|
+
export interface AuthItem {
|
|
5
|
+
children?: AuthItem[];
|
|
6
|
+
ignoreSuspension?: boolean;
|
|
7
|
+
permissions?: string[];
|
|
8
|
+
requiresAuth?: boolean;
|
|
9
|
+
subscriptions?: string[];
|
|
10
|
+
}
|
|
11
|
+
export interface AuthSubscription {
|
|
12
|
+
code: string;
|
|
13
|
+
value: number;
|
|
14
|
+
}
|
|
15
|
+
export interface BaseAuthCredentials {
|
|
16
|
+
expiresOn?: string;
|
|
17
|
+
isGlobalAdmin?: boolean;
|
|
18
|
+
isLoggedIn?: boolean;
|
|
19
|
+
isSuspended?: boolean;
|
|
20
|
+
permissions?: string;
|
|
21
|
+
subscriptionCode?: string;
|
|
22
|
+
timeZone?: string;
|
|
23
|
+
token?: string;
|
|
24
|
+
userID?: string;
|
|
25
|
+
userPermissions?: string[];
|
|
26
|
+
}
|
|
27
|
+
export type GetAuthUrl = (redirectPath?: string, state?: string) => string;
|
|
28
|
+
export interface CreateAuthOptions {
|
|
29
|
+
defaultTimeZone?: string;
|
|
30
|
+
demo?: BTDemo;
|
|
31
|
+
/**expiry token date format. Defaults to 'd/MM/yyyy h:mm:ss a' */
|
|
32
|
+
expiryTokenFormat?: string;
|
|
33
|
+
/**retrieve the auth item */
|
|
34
|
+
getAuthItem: (navName?: string | AuthItem) => AuthItem | null;
|
|
35
|
+
/**retrieve the url to navigate to for the OAuth 2.0 process */
|
|
36
|
+
getAuthUrl: GetAuthUrl;
|
|
37
|
+
/**sets current credentials on top of default function*/
|
|
38
|
+
setCredentials?: (state: RemovableRef<any>, payload: any) => void;
|
|
39
|
+
/**suboptions */
|
|
40
|
+
subscriptionOptions?: AuthSubscription[];
|
|
41
|
+
}
|
|
42
|
+
export interface BTAuth {
|
|
43
|
+
authState: string;
|
|
44
|
+
canEdit: (navName?: string) => boolean;
|
|
45
|
+
canEditPermit: (permit: string) => boolean;
|
|
46
|
+
canView: (navName?: string) => boolean;
|
|
47
|
+
canViewPermit: (permit: string) => boolean;
|
|
48
|
+
credentials: any;
|
|
49
|
+
doShow: (subcodes?: string[], permissions?: string[], action?: 'view' | 'edit') => boolean;
|
|
50
|
+
doShowByNav: (navName?: string | AuthItem, includeChildren?: boolean) => boolean;
|
|
51
|
+
getAuthUrl: (redirectPath?: string) => string;
|
|
52
|
+
getTimeZone: () => string;
|
|
53
|
+
login: (redirectPath?: string) => void;
|
|
54
|
+
logout: (navNameRedirect?: string) => void;
|
|
55
|
+
setAuth: (jwtToken?: string) => void;
|
|
56
|
+
tryLogin: () => boolean | undefined;
|
|
57
|
+
}
|
|
58
|
+
export declare function createAuth(options: CreateAuthOptions): BTAuth;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
interface CosmeticData {
|
|
2
|
+
dark?: BaseCosmeticTheme;
|
|
3
|
+
drawer?: boolean;
|
|
4
|
+
drawerStick?: boolean;
|
|
5
|
+
light?: BaseCosmeticTheme;
|
|
6
|
+
theme?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface BaseCosmeticTheme {
|
|
9
|
+
primary: string;
|
|
10
|
+
secondary: string;
|
|
11
|
+
accent: string;
|
|
12
|
+
error: string;
|
|
13
|
+
info: string;
|
|
14
|
+
success: string;
|
|
15
|
+
warning: string;
|
|
16
|
+
}
|
|
17
|
+
export interface UseCosmeticsOptions<T extends BaseCosmeticTheme> {
|
|
18
|
+
defaultDarkTheme?: T;
|
|
19
|
+
defaultLightTheme?: T;
|
|
20
|
+
defaultDrawer?: boolean;
|
|
21
|
+
defaultDrawerStick?: boolean;
|
|
22
|
+
defaultTheme?: string;
|
|
23
|
+
}
|
|
24
|
+
export interface BTCosmetics {
|
|
25
|
+
state: CosmeticData;
|
|
26
|
+
resetCosmetics: (toDefault: boolean) => void;
|
|
27
|
+
setTemporaryColor: (color: string) => void;
|
|
28
|
+
toggleDrawer: () => void;
|
|
29
|
+
toggleDrawerStick: () => void;
|
|
30
|
+
toggleLightDark: () => void;
|
|
31
|
+
undoTemporaryColor: () => void;
|
|
32
|
+
}
|
|
33
|
+
export declare function createCosmetics<T extends BaseCosmeticTheme>(options: UseCosmeticsOptions<T>): BTCosmetics;
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface CSVProps {
|
|
2
|
+
canExportCSV?: boolean;
|
|
3
|
+
}
|
|
4
|
+
export declare const csvDefaults: {
|
|
5
|
+
canExportCSV: boolean;
|
|
6
|
+
};
|
|
7
|
+
export interface UseCSVPropsReturn {
|
|
8
|
+
exportToCSV: Function;
|
|
9
|
+
}
|
|
10
|
+
export interface CSVItem {
|
|
11
|
+
header: string;
|
|
12
|
+
itemText?: string;
|
|
13
|
+
value: any;
|
|
14
|
+
}
|
|
15
|
+
declare global {
|
|
16
|
+
interface Navigator {
|
|
17
|
+
msSaveOrOpenBlob: (blob: Blob, fileName: string) => boolean;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export declare function useCSV(): UseCSVPropsReturn;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { DateTime } from 'luxon';
|
|
2
|
+
|
|
3
|
+
export interface BTDates {
|
|
4
|
+
getToday: () => string;
|
|
5
|
+
getTomorrow: () => string;
|
|
6
|
+
tzDate: (val?: string, fromFormat?: string) => DateTime;
|
|
7
|
+
tzString: (val?: string, format?: string, fromFormat?: string) => string;
|
|
8
|
+
utcDate: (val?: string, fromFormat?: string) => DateTime;
|
|
9
|
+
utcString: (val?: string, format?: string, fromFormat?: string) => string;
|
|
10
|
+
}
|
|
11
|
+
export interface CreateDatesOptions {
|
|
12
|
+
getTimeZone: () => string;
|
|
13
|
+
}
|
|
14
|
+
export declare function createDates(options: CreateDatesOptions): BTDates;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { ListProps } from './list';
|
|
2
|
+
|
|
3
|
+
export interface ConfirmDialogProps {
|
|
4
|
+
cancelText?: string;
|
|
5
|
+
cancelValue?: any;
|
|
6
|
+
confirmText?: string;
|
|
7
|
+
confirmValue?: any;
|
|
8
|
+
msg?: string;
|
|
9
|
+
maxWidth?: number;
|
|
10
|
+
minWidth?: number;
|
|
11
|
+
title?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface SelectDateProps {
|
|
14
|
+
cancelText?: string;
|
|
15
|
+
cancelValue?: any;
|
|
16
|
+
confirmText?: string;
|
|
17
|
+
dateFrom?: string;
|
|
18
|
+
dateRules?: Function | unknown[];
|
|
19
|
+
format?: string;
|
|
20
|
+
fromNow?: boolean;
|
|
21
|
+
height?: string;
|
|
22
|
+
msg?: string;
|
|
23
|
+
maxWidth?: number;
|
|
24
|
+
minWidth?: number;
|
|
25
|
+
range?: boolean;
|
|
26
|
+
required?: boolean;
|
|
27
|
+
requireTime?: boolean;
|
|
28
|
+
title?: string;
|
|
29
|
+
useTime?: boolean;
|
|
30
|
+
}
|
|
31
|
+
export interface SelectDialogProps extends ListProps {
|
|
32
|
+
cancelText?: string;
|
|
33
|
+
cancelValue?: any;
|
|
34
|
+
canUnselect?: boolean;
|
|
35
|
+
confirmText?: string;
|
|
36
|
+
height?: string;
|
|
37
|
+
itemSubtext?: string;
|
|
38
|
+
itemText?: string;
|
|
39
|
+
itemValue?: string;
|
|
40
|
+
msg?: string;
|
|
41
|
+
maxWidth?: number;
|
|
42
|
+
minWidth?: number;
|
|
43
|
+
multiple?: boolean;
|
|
44
|
+
nav?: string;
|
|
45
|
+
onFilter?: Function;
|
|
46
|
+
required?: boolean;
|
|
47
|
+
subtextFilter?: string;
|
|
48
|
+
subtextFunction?: Function;
|
|
49
|
+
textFilter?: string;
|
|
50
|
+
textFunction?: Function;
|
|
51
|
+
title?: string;
|
|
52
|
+
}
|
|
53
|
+
export interface TextDialogProps extends ListProps {
|
|
54
|
+
cancelText?: string;
|
|
55
|
+
confirmText?: string;
|
|
56
|
+
height?: string;
|
|
57
|
+
label?: string;
|
|
58
|
+
msg?: string;
|
|
59
|
+
maxWidth?: number;
|
|
60
|
+
minWidth?: number;
|
|
61
|
+
required?: boolean;
|
|
62
|
+
title?: string;
|
|
63
|
+
value?: any;
|
|
64
|
+
}
|
|
65
|
+
export declare function useRequireConfirmation(action: any, props: ConfirmDialogProps, requireConfirm: boolean): void;
|
|
66
|
+
export declare function useConfirmAsync(text: string): Promise<boolean>;
|
|
67
|
+
/**
|
|
68
|
+
* Returns undefined if cancelled
|
|
69
|
+
* [] if multiple
|
|
70
|
+
* Null | Obj if single
|
|
71
|
+
* @param opts
|
|
72
|
+
*/
|
|
73
|
+
export declare function useSelectDialog(opts?: SelectDialogProps): Promise<any>;
|
|
74
|
+
export declare function useSelectDate(opts?: SelectDateProps): Promise<any>;
|
|
75
|
+
export declare function useTextDialog(opts?: TextDialogProps): Promise<any>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { BTDemo } from './demo';
|
|
2
|
+
import { RouteLocationNormalized } from 'vue-router';
|
|
3
|
+
|
|
4
|
+
export interface UseDocumentMetaOptions {
|
|
5
|
+
demo?: BTDemo;
|
|
6
|
+
}
|
|
7
|
+
/**routes with meta object */
|
|
8
|
+
export declare function useDocumentMeta(options?: UseDocumentMetaOptions): {
|
|
9
|
+
updateMeta: (to: RouteLocationNormalized) => void;
|
|
10
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Position } from '@vueuse/core';
|
|
2
|
+
import { ComponentPublicInstance, MaybeRefOrGetter, Ref } from 'vue';
|
|
3
|
+
|
|
4
|
+
export interface UseDraggableOptions {
|
|
5
|
+
/**
|
|
6
|
+
* Only start the dragging when click on the element directly
|
|
7
|
+
*
|
|
8
|
+
* @default false
|
|
9
|
+
*/
|
|
10
|
+
preventDefault?: MaybeRefOrGetter<boolean>;
|
|
11
|
+
stopPropagation?: MaybeRefOrGetter<boolean>;
|
|
12
|
+
/**
|
|
13
|
+
* Whether dispatch events in capturing phase
|
|
14
|
+
*
|
|
15
|
+
* @default true
|
|
16
|
+
*/
|
|
17
|
+
capture?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Element to attach `pointermove` and `pointerup` events to.
|
|
20
|
+
*
|
|
21
|
+
* @default window
|
|
22
|
+
*/
|
|
23
|
+
draggingElement?: MaybeRefOrGetter<HTMLElement | SVGElement | Window | Document | null | undefined>;
|
|
24
|
+
/**
|
|
25
|
+
* Element for calculating bounds (If not set, it will use the event's target).
|
|
26
|
+
*
|
|
27
|
+
* @default undefined
|
|
28
|
+
*/
|
|
29
|
+
/**
|
|
30
|
+
* Handle that triggers the drag event
|
|
31
|
+
*
|
|
32
|
+
* @default target
|
|
33
|
+
*/
|
|
34
|
+
handle?: MaybeRefOrGetter<HTMLElement | SVGElement | null | undefined>;
|
|
35
|
+
/**
|
|
36
|
+
* Initial position of the element.
|
|
37
|
+
*
|
|
38
|
+
* @default { x: 0, y: 0 }
|
|
39
|
+
*/
|
|
40
|
+
initialValue?: MaybeRefOrGetter<Position>;
|
|
41
|
+
onStart?: (position: Position, event: PointerEvent) => void | false;
|
|
42
|
+
onMove?: (position: Position, event: PointerEvent) => void;
|
|
43
|
+
onEnd?: (position: Position, event: PointerEvent) => void;
|
|
44
|
+
/**
|
|
45
|
+
* Axis to drag on.
|
|
46
|
+
*
|
|
47
|
+
* @default 'both'
|
|
48
|
+
*/
|
|
49
|
+
axis?: 'x' | 'y' | 'both';
|
|
50
|
+
}
|
|
51
|
+
export declare function useDraggable(target: MaybeRefOrGetter<ComponentPublicInstance | null>, //HTMLElement | SVGElement | null | undefined>,
|
|
52
|
+
handle: MaybeRefOrGetter<ComponentPublicInstance | null>, options?: UseDraggableOptions): {
|
|
53
|
+
draggingIsOn: Ref<boolean>;
|
|
54
|
+
turnDraggableOff: () => void;
|
|
55
|
+
turnDraggableOn: () => void;
|
|
56
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { BTDates } from './dates';
|
|
2
|
+
|
|
3
|
+
export interface BTFilters {
|
|
4
|
+
findFilter: (mFilter: string | undefined) => Function;
|
|
5
|
+
}
|
|
6
|
+
export interface UseFiltersOptions {
|
|
7
|
+
dates: BTDates;
|
|
8
|
+
}
|
|
9
|
+
export declare function createFilters(options: UseFiltersOptions): BTFilters;
|
|
10
|
+
export type Textfilter = 'toLocationLine' | 'toLocationLineNoCommas' | 'toLongDate' | 'toLongDateAndTime' | 'toPercent' | 'toPrettyCSV' | 'toShortDate' | 'toShortDateAndTime' | 'toTime' | 'toTimeOfDay' | 'toCompanyNameAndLocationLine' | 'toCurrency' | 'toDayDate' | 'toDayMonth' | 'toDayOfWeek' | 'toDayShortDate' | 'toDayShortDateAndTime' | 'toDisplayNumber' | 'toDisplayNumberOver' | 'toDisplayNumberSigned' | 'toFormat';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare function useLocalDb(): LocalForage;
|
|
2
|
+
export declare function useLocalCache(): {
|
|
3
|
+
clearAsync: (storeName: string) => Promise<void>;
|
|
4
|
+
getAsync: <T>(key: string) => Promise<T | null>;
|
|
5
|
+
removeAsync: (key: string) => Promise<void>;
|
|
6
|
+
saveAsync: <T_1>(data: T_1, key: string) => Promise<void>;
|
|
7
|
+
};
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { MaybeRefOrGetter } from 'vue';
|
|
2
|
+
|
|
3
|
+
export declare function appendUrl(originalVal?: string, additionalVal?: string): string;
|
|
4
|
+
export declare function extensionExists(elementId?: string): boolean;
|
|
5
|
+
interface GeoCoordinate {
|
|
6
|
+
lat: number;
|
|
7
|
+
lng: number;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* get area around a certain location with a space of the given size
|
|
11
|
+
* @param location
|
|
12
|
+
* @param radius
|
|
13
|
+
* @returns
|
|
14
|
+
*/
|
|
15
|
+
export declare function getAreaAround(location: GeoCoordinate, radius: number): {
|
|
16
|
+
lat: number;
|
|
17
|
+
lng: number;
|
|
18
|
+
}[];
|
|
19
|
+
/**get square area using the location as the far right line */
|
|
20
|
+
export declare function getAreaToLeft(location: GeoCoordinate, radius: number): {
|
|
21
|
+
lat: number;
|
|
22
|
+
lng: number;
|
|
23
|
+
}[];
|
|
24
|
+
/**get square area using the location as the far left line */
|
|
25
|
+
export declare function getAreaToRight(location: GeoCoordinate, radius: number): {
|
|
26
|
+
lat: number;
|
|
27
|
+
lng: number;
|
|
28
|
+
}[];
|
|
29
|
+
/**
|
|
30
|
+
*
|
|
31
|
+
* @param value converts location to a single string and standardizes state and road names, etc.
|
|
32
|
+
* @returns
|
|
33
|
+
*/
|
|
34
|
+
export declare function getGoogleMapsLocationLine(value: any): any;
|
|
35
|
+
export declare function getLocationLine(value: any, forGoogle?: boolean): any;
|
|
36
|
+
export declare function checkImage(url?: string, goodCallback?: any, badCallback?: any): void;
|
|
37
|
+
export declare function getImageData(url?: string, throwErrorOnFail?: boolean): Promise<unknown>;
|
|
38
|
+
/**
|
|
39
|
+
*
|
|
40
|
+
* @param val Converts string from camel case to every word being capitalized and spaces between
|
|
41
|
+
* @returns
|
|
42
|
+
*/
|
|
43
|
+
export declare function fromCamelCase(val?: string): string | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* Converts props to camel casing
|
|
46
|
+
* @param value
|
|
47
|
+
* @returns
|
|
48
|
+
*/
|
|
49
|
+
export declare function toCamelCase(value: any): any;
|
|
50
|
+
export declare function capitalizeWords(val?: string): string | undefined;
|
|
51
|
+
export declare const weekdayPairs: {
|
|
52
|
+
value: number;
|
|
53
|
+
short: string;
|
|
54
|
+
values: (string | null | undefined)[];
|
|
55
|
+
}[];
|
|
56
|
+
/**returns the sort value of the weekday csv string
|
|
57
|
+
* returns minimum if csv list
|
|
58
|
+
*/
|
|
59
|
+
export declare function weekdayValue(wkDay?: string): number;
|
|
60
|
+
/**returns the sort value of the weekday csv string
|
|
61
|
+
* returns minimum if csv list
|
|
62
|
+
*/
|
|
63
|
+
export declare function weekdayShortName(wkDay?: string): string | undefined;
|
|
64
|
+
/**whether the csv string contains the weekday
|
|
65
|
+
* returns true if either prop is undefined
|
|
66
|
+
*/
|
|
67
|
+
export declare function containsWeekday(weekdays?: string, wkDay?: string): boolean;
|
|
68
|
+
/**adds and sorts the weekday string */
|
|
69
|
+
export declare function addWeekday(weekdays?: string, day?: string): string | undefined;
|
|
70
|
+
export declare function removeWeekday(weekdays?: string, day?: string): string | undefined;
|
|
71
|
+
export declare function isArrayOfLength(val: any, l: number): boolean;
|
|
72
|
+
export declare function isLengthyArray(val: any, greaterThan?: number): boolean;
|
|
73
|
+
export declare function isMinDate(d?: string): boolean;
|
|
74
|
+
export declare function getMinDate(): number;
|
|
75
|
+
export declare function getMinDateString(): string;
|
|
76
|
+
/**
|
|
77
|
+
* rounds the given value to a certain number of decimal places
|
|
78
|
+
* @param v
|
|
79
|
+
* @param dPlaces
|
|
80
|
+
* @returns
|
|
81
|
+
*/
|
|
82
|
+
export declare function roundTo(v: MaybeRefOrGetter<number>, dPlaces: number): number;
|
|
83
|
+
export declare function toggleCSV(value?: string, tag?: string): string | null;
|
|
84
|
+
export declare function csvContains(value?: string, tag?: string): boolean;
|
|
85
|
+
/**copies object and all descendant properties */
|
|
86
|
+
export declare function copyDeep(aObject: any): any;
|
|
87
|
+
/**copies object and returns copied object with descendant properties placed in alphabetical order */
|
|
88
|
+
export declare function copyItemByAlphabet(aObject: any): any;
|
|
89
|
+
/**whether string is contained somewhere in this value */
|
|
90
|
+
export declare function containsSearch(value?: string, str?: string): boolean;
|
|
91
|
+
/**must be an object. Returns a flat map of all items in the prop selector */
|
|
92
|
+
export declare function deepSelect(obj: any, propSelector?: Function): any[];
|
|
93
|
+
export declare function DataURIToBlob(dataURI: any): Blob;
|
|
94
|
+
export declare function extractErrorDescription(error: any): string;
|
|
95
|
+
export declare function getRandomColor(): string;
|
|
96
|
+
/**tests for whether string is contains in any of the given props of the given value */
|
|
97
|
+
export declare function hasSearch(value: any, str?: string, props?: string[]): boolean;
|
|
98
|
+
export declare function toCompareString(str?: string): string | null;
|
|
99
|
+
export declare function twiddleThumbs(mSec?: number): Promise<void>;
|
|
100
|
+
export declare function nestedValue(obj: any, path?: string): any;
|
|
101
|
+
export declare function validEmail(email?: string): boolean;
|
|
102
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useId(pattern?: string): string;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { AuthItem } from './auth';
|
|
2
|
+
import { Ref } from 'vue';
|
|
3
|
+
|
|
4
|
+
export interface ExternalParty {
|
|
5
|
+
party?: string;
|
|
6
|
+
property?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface ExternalNavigation {
|
|
9
|
+
canPull?: boolean;
|
|
10
|
+
canPush?: boolean;
|
|
11
|
+
convertFunc?: Function;
|
|
12
|
+
name?: string;
|
|
13
|
+
localNavigation?: string;
|
|
14
|
+
localDisplayPath?: string;
|
|
15
|
+
localComparePath?: string;
|
|
16
|
+
syncComparePath?: string;
|
|
17
|
+
syncDisplayPath?: string;
|
|
18
|
+
syncIDPath?: string;
|
|
19
|
+
}
|
|
20
|
+
export interface NavigationItem extends AuthItem {
|
|
21
|
+
/**aliases are other names that could use this navigation item's set of permissions, etc.*/
|
|
22
|
+
aliases?: string[];
|
|
23
|
+
/**potentially the nav that leads to the archive */
|
|
24
|
+
archiveName?: string;
|
|
25
|
+
/**the name of the background img to show when the route opens this nav */
|
|
26
|
+
background?: string;
|
|
27
|
+
/**how long until locally cached data is refreshed */
|
|
28
|
+
cacheExpiryHours?: number;
|
|
29
|
+
/**any children of this nav item */
|
|
30
|
+
children?: NavigationItem[];
|
|
31
|
+
/**the name that will be displayed in the navigation menu */
|
|
32
|
+
displayName?: string;
|
|
33
|
+
/**where credentials can be found for external parties*/
|
|
34
|
+
externalPartyCredentialNavigation?: string;
|
|
35
|
+
/**possible external parties to connect to and sync with */
|
|
36
|
+
externalParties?: ExternalParty[];
|
|
37
|
+
/**possible external party navigation items and how to connect/sync */
|
|
38
|
+
externalNavigations?: ExternalNavigation[];
|
|
39
|
+
/**will hide app bar if set to true when the route opens this nav */
|
|
40
|
+
hideAppBar?: boolean;
|
|
41
|
+
/**will hide the nav sidebar if set to true when the route opens this nav */
|
|
42
|
+
hideNavigation?: boolean;
|
|
43
|
+
/**will open a dialog box to confirm navigating away from this route */
|
|
44
|
+
hesitate?: boolean;
|
|
45
|
+
/**the mdi icon that goes with this nav item. Will show in places like the nav menu */
|
|
46
|
+
icon?: string;
|
|
47
|
+
/**default to false. True will mean that even is account is suspended, this will still allow navigation */
|
|
48
|
+
ignoreSuspension?: boolean;
|
|
49
|
+
/**default to true. When false will hide from nav menu */
|
|
50
|
+
isInNavMenu?: boolean;
|
|
51
|
+
/**the microservice the leads to the default url to obtain data from. Defaults to 'default'. */
|
|
52
|
+
microservice?: string;
|
|
53
|
+
/**the name of this nav item. */
|
|
54
|
+
name?: string;
|
|
55
|
+
/**the url path on top of the base microservice url */
|
|
56
|
+
path?: string;
|
|
57
|
+
/**permissions that are required for this navItem. All these permissions must be met. */
|
|
58
|
+
permissions?: string[];
|
|
59
|
+
/**default to true. When false will allow universal access regardless of permission */
|
|
60
|
+
requiresAuth?: boolean;
|
|
61
|
+
/**the name of the route to access individual items */
|
|
62
|
+
singleName?: string;
|
|
63
|
+
/**this nav item is restricted to these subscriptions. So the user needs to have at least one of these subscription codes. */
|
|
64
|
+
subscriptions?: string[];
|
|
65
|
+
/**this nav item is preferred in this subscription codes. */
|
|
66
|
+
subFilters?: string[];
|
|
67
|
+
}
|
|
68
|
+
export interface BTNavigation {
|
|
69
|
+
showAppBar: Ref<boolean>;
|
|
70
|
+
showAppNavigation: Ref<boolean>;
|
|
71
|
+
backgroundName: Ref<string | undefined>;
|
|
72
|
+
hesitate: Ref<boolean>;
|
|
73
|
+
navigationItems: NavigationItem[];
|
|
74
|
+
findArchiveName: (navName?: string) => string | undefined;
|
|
75
|
+
findCacheHours: (navName?: string) => number;
|
|
76
|
+
findDisplay: (navName?: string) => string | undefined;
|
|
77
|
+
findIcon: (navName?: string) => string | undefined;
|
|
78
|
+
findItem: (navName?: string | NavigationItem) => NavigationItem | null;
|
|
79
|
+
findStoreName: (navName?: string) => string;
|
|
80
|
+
findPath: (navName?: string) => string | undefined;
|
|
81
|
+
findSingleDisplay: (navName?: string) => string | undefined;
|
|
82
|
+
updateNavigationProperties: (navName?: string | NavigationItem) => void;
|
|
83
|
+
}
|
|
84
|
+
interface UseNavigationOptions {
|
|
85
|
+
defaultCacheExpiryHours?: number;
|
|
86
|
+
navItems?: NavigationItem[];
|
|
87
|
+
}
|
|
88
|
+
export declare function createNavigation(options: UseNavigationOptions): BTNavigation;
|
|
89
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
|
|
3
|
+
export interface SWEvent extends Event {
|
|
4
|
+
detail: any;
|
|
5
|
+
}
|
|
6
|
+
export interface BTPWA {
|
|
7
|
+
canInstallApp: Ref<boolean>;
|
|
8
|
+
canUpdateApp: Ref<boolean>;
|
|
9
|
+
installApp: () => void;
|
|
10
|
+
isInstalled: () => boolean;
|
|
11
|
+
updateApp: () => void;
|
|
12
|
+
}
|
|
13
|
+
export declare function createPWA(): BTPWA;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { BladeVariant } from '../types';
|
|
2
|
+
import { Position, MaybeRefOrGetter } from '@vueuse/core';
|
|
3
|
+
import { ComponentPublicInstance, Ref } from 'vue';
|
|
4
|
+
|
|
5
|
+
export type ResizeHandle = 't' | 'r' | 'b' | 'l' | 'tr' | 'br' | 'bl' | 'tl';
|
|
6
|
+
export interface PointerOrTouchEvent extends PointerEvent, TouchEvent {
|
|
7
|
+
}
|
|
8
|
+
export interface UseResizeOptions {
|
|
9
|
+
preventDefault?: MaybeRefOrGetter<boolean>;
|
|
10
|
+
stopPropagation?: MaybeRefOrGetter<boolean>;
|
|
11
|
+
handles?: ResizeHandle[];
|
|
12
|
+
/**
|
|
13
|
+
* Callback when the dragging starts. Return `false` to prevent dragging.
|
|
14
|
+
*/
|
|
15
|
+
onStart?: (position: Position, event: PointerEvent) => void | false;
|
|
16
|
+
/**
|
|
17
|
+
* Callback during dragging.
|
|
18
|
+
*/
|
|
19
|
+
onMove?: (position: Position, event: PointerEvent) => void;
|
|
20
|
+
/**
|
|
21
|
+
* Callback when dragging end.
|
|
22
|
+
*/
|
|
23
|
+
onEnd?: (position: Position, event: PointerEvent) => void;
|
|
24
|
+
minWidth?: number;
|
|
25
|
+
maxWidth?: number;
|
|
26
|
+
minHeight?: number;
|
|
27
|
+
maxHeight?: number;
|
|
28
|
+
handleWidth?: number;
|
|
29
|
+
handleZIndex?: number;
|
|
30
|
+
}
|
|
31
|
+
export declare function useResizable(target: MaybeRefOrGetter<ComponentPublicInstance | null>, options?: UseResizeOptions): {
|
|
32
|
+
resizingIsOn: Ref<boolean>;
|
|
33
|
+
turnResizingOn: (handles?: ResizeHandle[], variant?: BladeVariant) => void;
|
|
34
|
+
turnResizingOff: (variant?: BladeVariant | undefined) => void;
|
|
35
|
+
};
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { BTAuth } from './auth';
|
|
2
|
+
import { BaseModel } from '../types';
|
|
3
|
+
import { PathOptions, BTApi } from './api';
|
|
4
|
+
import { StoreDefinition } from 'pinia';
|
|
5
|
+
|
|
6
|
+
export type StoreMode = 'whole-last-updated' | 'partial-last-updated' | 'session';
|
|
7
|
+
export type StorageMode = 'session' | 'local-cache';
|
|
8
|
+
export interface LocalMeta {
|
|
9
|
+
storedOn: string;
|
|
10
|
+
isDetailed?: boolean;
|
|
11
|
+
earliestData?: string;
|
|
12
|
+
lastUpdate?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface LocallyStoredItem<T> {
|
|
15
|
+
meta: LocalMeta;
|
|
16
|
+
data: T;
|
|
17
|
+
count?: number;
|
|
18
|
+
filters?: string[];
|
|
19
|
+
}
|
|
20
|
+
export interface StoreGetAllReturn<T> {
|
|
21
|
+
data: T[];
|
|
22
|
+
count?: number;
|
|
23
|
+
filters?: string[];
|
|
24
|
+
}
|
|
25
|
+
export interface StoreGetReturn<T> {
|
|
26
|
+
data: T;
|
|
27
|
+
}
|
|
28
|
+
export interface BTStore extends StoreDefinition<any, {}, {}, {
|
|
29
|
+
deleteItem: (dOptions: PathOptions) => Promise<string | undefined>;
|
|
30
|
+
get: <T extends BaseModel>(dOptions: PathOptions) => Promise<StoreGetReturn<T>>;
|
|
31
|
+
getAll: <T extends BaseModel>(dOptions: PathOptions) => Promise<StoreGetAllReturn<T>>;
|
|
32
|
+
patch: <T extends BaseModel>(dOptions: PathOptions) => Promise<T | undefined>;
|
|
33
|
+
post: <T extends BaseModel>(dOptions: PathOptions) => Promise<T | undefined>;
|
|
34
|
+
restore: <T extends BaseModel>(dOptions: PathOptions) => Promise<T | undefined>;
|
|
35
|
+
}> {
|
|
36
|
+
}
|
|
37
|
+
export interface ApiError {
|
|
38
|
+
message: string;
|
|
39
|
+
}
|
|
40
|
+
interface UseStoreOptions {
|
|
41
|
+
/**ideally required. Otherwise will struggle to find url path */
|
|
42
|
+
api?: BTApi;
|
|
43
|
+
/**ideally required. For setting unique local storage keys */
|
|
44
|
+
auth?: BTAuth;
|
|
45
|
+
/**build a query. Overrides the default */
|
|
46
|
+
builderQuery?: (params: any) => string;
|
|
47
|
+
/**overrides the default */
|
|
48
|
+
buildUrl?: (path: PathOptions) => string;
|
|
49
|
+
/**particularly what store syle to use */
|
|
50
|
+
storeMode: StoreMode;
|
|
51
|
+
/**whether to store data locally or only for the duration of the session */
|
|
52
|
+
storageMode: StorageMode;
|
|
53
|
+
/**the name of this store */
|
|
54
|
+
storeName: string;
|
|
55
|
+
}
|
|
56
|
+
export interface CreateStoreBuilderOptions {
|
|
57
|
+
/**ideally required. Otherwise will struggle to find url path */
|
|
58
|
+
api?: BTApi;
|
|
59
|
+
/**ideally required. For setting unique local storage keys */
|
|
60
|
+
auth?: BTAuth;
|
|
61
|
+
/**build a query. Overrides the default */
|
|
62
|
+
builderQuery?: (params: any) => string;
|
|
63
|
+
/**overrides the default */
|
|
64
|
+
buildUrl?: (path: PathOptions) => string;
|
|
65
|
+
}
|
|
66
|
+
export interface CreateStoreOptions {
|
|
67
|
+
/**particularly what store syle to use */
|
|
68
|
+
storeMode: StoreMode;
|
|
69
|
+
/**whether to store data locally or only for the duration of the session */
|
|
70
|
+
storageMode: StorageMode;
|
|
71
|
+
/**the name of this store */
|
|
72
|
+
storeName: string;
|
|
73
|
+
}
|
|
74
|
+
export declare function createStoreBuilder(options: CreateStoreBuilderOptions): (opt: CreateStoreOptions) => BTStore;
|
|
75
|
+
export declare function createStore(options: UseStoreOptions): BTStore;
|
|
76
|
+
interface UseSessionStoreOptions {
|
|
77
|
+
/**ideally required. Otherwise will struggle to find url path */
|
|
78
|
+
api?: BTApi;
|
|
79
|
+
/**ideally required. For setting unique local storage keys */
|
|
80
|
+
auth?: BTAuth;
|
|
81
|
+
/**whether to store data locally or only for the duration of the session */
|
|
82
|
+
storageMode: 'session' | 'local-cache';
|
|
83
|
+
/**build a query. Overrides the default */
|
|
84
|
+
buildQuery?: (params: any) => string;
|
|
85
|
+
/**overrides the default */
|
|
86
|
+
buildUrl?: (path: PathOptions) => string;
|
|
87
|
+
/**the name of this store */
|
|
88
|
+
storeName: string;
|
|
89
|
+
}
|
|
90
|
+
export declare function createSessionStore(options: UseSessionStoreOptions): BTStore;
|
|
91
|
+
interface UseWholeLastUpdateStoreOptions {
|
|
92
|
+
/**ideally required. Otherwise will struggle to find url path */
|
|
93
|
+
api?: BTApi;
|
|
94
|
+
/**ideally required. For setting unique local storage keys */
|
|
95
|
+
auth?: BTAuth;
|
|
96
|
+
storageMode: 'session' | 'local-cache';
|
|
97
|
+
storeName: string;
|
|
98
|
+
}
|
|
99
|
+
export declare function createWholeLastUpdateStore(options: UseWholeLastUpdateStoreOptions): BTStore;
|
|
100
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { MaybeRefOrGetter, Ref } from 'vue';
|
|
2
|
+
|
|
3
|
+
export interface UseTrackerOptions {
|
|
4
|
+
propsToIgnore?: string[];
|
|
5
|
+
propsToTrack?: string[];
|
|
6
|
+
useTracker?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare function useTracker(data: MaybeRefOrGetter<any>, options?: UseTrackerOptions): {
|
|
9
|
+
asyncItem: Ref<any>;
|
|
10
|
+
isChanged: Ref<boolean>;
|
|
11
|
+
restartTracker: () => void;
|
|
12
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type Environment = 'production' | 'staging' | 'development';
|
|
2
|
+
/**
|
|
3
|
+
* ms: BASE_AUTH_URL, BASE_DATA_URL, WEB_APP_URL, Microservice, LOCAL_DB_NAME
|
|
4
|
+
* @param microservice
|
|
5
|
+
* @returns
|
|
6
|
+
*/
|
|
7
|
+
export declare function useUrl(microservice?: string): string | undefined;
|
package/dist/core.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { RemovableRef } from '@vueuse/core';
|
|
2
|
+
import { NavigationItem } from './composables/navigation';
|
|
3
|
+
import { BaseCosmeticTheme, UseCosmeticsOptions } from './composables/cosmetics';
|
|
4
|
+
import { GetAuthUrl, AuthSubscription } from './composables/auth';
|
|
5
|
+
import { App } from 'vue';
|
|
6
|
+
|
|
7
|
+
export interface CoreApp {
|
|
8
|
+
install(app: App): void;
|
|
9
|
+
}
|
|
10
|
+
export interface CreateCoreOptions extends UseCosmeticsOptions<BaseCosmeticTheme> {
|
|
11
|
+
defaultCacheExpiryHours?: number;
|
|
12
|
+
navItems?: NavigationItem[];
|
|
13
|
+
getAuthUrl: GetAuthUrl;
|
|
14
|
+
presets: any;
|
|
15
|
+
setCredentials?: (state: RemovableRef<any>, payload: any) => void;
|
|
16
|
+
subscriptionOptions?: AuthSubscription[];
|
|
17
|
+
}
|
|
18
|
+
export declare function createCore(options: CreateCoreOptions): CoreApp;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export * from './composables/actions-tracker';
|
|
2
|
+
export * from './composables/actions';
|
|
3
|
+
export * from './composables/demo';
|
|
4
|
+
export * from './composables/document-meta';
|
|
5
|
+
export * from './composables/draggable';
|
|
6
|
+
export * from './composables/forage';
|
|
7
|
+
export * from './composables/helpers';
|
|
8
|
+
export * from './composables/id';
|
|
9
|
+
export * from './composables/list';
|
|
10
|
+
export * from './composables/resizable';
|
|
11
|
+
export * from './composables/rules';
|
|
12
|
+
export * from './composables/stores';
|
|
13
|
+
export * from './composables/track';
|
|
14
|
+
export * from './composables/urls';
|
|
15
|
+
export * from './useApi';
|
|
16
|
+
export * from './core';
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Inline: merges toolbars | much more compact | hides navigation
|
|
3
|
+
Page: shows navigation and page settings
|
|
4
|
+
Blade: shows blade minimize, maximize, close, and pins as a column
|
|
5
|
+
Free-moving: show blade as draggable and resizable with minimize, maximize, and close and pinning
|
|
6
|
+
*/
|
|
7
|
+
export type BladeVariant = 'page' | 'blade' | 'freestyle' | 'inline' | 'pane';
|
|
8
|
+
export type BladeMode = 'new' | 'view' | 'edit';
|
|
9
|
+
export interface BaseModel {
|
|
10
|
+
id?: string;
|
|
11
|
+
}
|
package/dist/useApi.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { BTStore, CreateStoreOptions } from './composables/stores';
|
|
2
|
+
import { BTPWA } from './composables/pwa';
|
|
3
|
+
import { BTNavigation } from './composables/navigation';
|
|
4
|
+
import { BTFilters } from './composables/filters';
|
|
5
|
+
import { BTDemo } from './composables/demo';
|
|
6
|
+
import { BTDates } from './composables/dates';
|
|
7
|
+
import { BTCosmetics } from './composables/cosmetics';
|
|
8
|
+
import { BTApi } from './composables/api';
|
|
9
|
+
import { BTAuth } from './composables/auth';
|
|
10
|
+
|
|
11
|
+
/**returns a singleton */
|
|
12
|
+
export declare function useApi(): BTApi;
|
|
13
|
+
/**returns a singleton */
|
|
14
|
+
export declare function useAuth(): BTAuth;
|
|
15
|
+
/**returns a singleton */
|
|
16
|
+
export declare function useCosmetics(): BTCosmetics;
|
|
17
|
+
/**returns a singleton */
|
|
18
|
+
export declare function useDates(): BTDates;
|
|
19
|
+
/**returns a singleton */
|
|
20
|
+
export declare function useDemo(): BTDemo;
|
|
21
|
+
/**returns a singleton */
|
|
22
|
+
export declare function useFilters(): BTFilters;
|
|
23
|
+
/**returns a singleton */
|
|
24
|
+
export declare function useNavigation(): BTNavigation;
|
|
25
|
+
/**returns a singleton */
|
|
26
|
+
export declare function usePresets(preset?: string): any;
|
|
27
|
+
/**returns a singleton */
|
|
28
|
+
export declare function usePWA(): BTPWA;
|
|
29
|
+
/**returns a new instance */
|
|
30
|
+
export declare function useStore(): (opt: CreateStoreOptions) => BTStore;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bt-core-app",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.4",
|
|
4
4
|
"description": "Core app tools for some basic features like navigation, authentication, server apis, and cosmetics",
|
|
5
5
|
"homepage": "https://github.com/BlitzItTech/bt-core",
|
|
6
6
|
"bugs": {
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
"msw": "^2.2.10",
|
|
38
38
|
"typescript": "^5.2.2",
|
|
39
39
|
"vite": "^5.1.6",
|
|
40
|
+
"vite-plugin-dts": "^3.8.1",
|
|
40
41
|
"vitest": "^1.4.0",
|
|
41
42
|
"vue": "^3.4.21",
|
|
42
43
|
"vue-tsc": "^1.8.27"
|
package/vite.config.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { defineConfig } from 'vite'
|
|
3
3
|
import path from 'path'
|
|
4
4
|
import vue from '@vitejs/plugin-vue'
|
|
5
|
+
import dts from 'vite-plugin-dts'
|
|
5
6
|
|
|
6
7
|
// https://vitejs.dev/config/
|
|
7
8
|
|
|
@@ -16,7 +17,10 @@ export default defineConfig({
|
|
|
16
17
|
formats: ['es']
|
|
17
18
|
}
|
|
18
19
|
},
|
|
19
|
-
plugins: [
|
|
20
|
+
plugins: [
|
|
21
|
+
vue(),
|
|
22
|
+
dts({ include: ['src'] })
|
|
23
|
+
],
|
|
20
24
|
resolve: {
|
|
21
25
|
alias: {
|
|
22
26
|
'@': path.resolve(__dirname, './src')
|