@xy-planning-network/trees 0.9.1 → 0.9.2-rc1
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 +679 -638
- package/dist/trees.umd.js +5 -5
- package/package.json +1 -1
- package/types/composables/index.d.ts +4 -0
- package/types/composables/nav.d.ts +120 -1
- package/types/helpers/Slots.d.ts +2 -0
- package/types/lib-components/lists/StaticTable.vue.d.ts +21 -0
- package/types/lib-components/lists/StaticTableActionSlot.vue.d.ts +27 -0
- package/types/lib-components/lists/Table.vue.d.ts +39 -0
- package/types/lib-components/navigation/ActionsDropdownCallback.vue.d.ts +18 -0
- package/types/lib-components/navigation/ActionsDropdownEmit.vue.d.ts +22 -0
package/package.json
CHANGED
|
@@ -7,5 +7,9 @@ import { useFlashes, useAppFlashes, useAppFlasher } from "./useFlashes";
|
|
|
7
7
|
import type { FlashMessage, FlashType, FlashStore, Flasher } from "./useFlashes";
|
|
8
8
|
export type { FlashMessage, FlashType, FlashStore, Flasher };
|
|
9
9
|
export { useFlashes, useAppFlashes, useAppFlasher };
|
|
10
|
+
import type { URLParams, URLParamValue, UseTabHistoryOpts } from "./nav";
|
|
11
|
+
export type { URLParams, URLParamValue, UseTabHistoryOpts };
|
|
12
|
+
import { useUrlSearchParams, useTabHistory } from "./nav";
|
|
13
|
+
export { useUrlSearchParams, useTabHistory };
|
|
10
14
|
import { useSpinnerDisplay, useAppSpinner } from "./useSpinner";
|
|
11
15
|
export { useSpinnerDisplay, useAppSpinner };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Component, FunctionalComponent, MaybeRef, RenderFunction } from "vue";
|
|
2
2
|
export interface Item {
|
|
3
3
|
icon?: Component | RenderFunction;
|
|
4
4
|
name: string;
|
|
@@ -18,3 +18,122 @@ export interface ActionItem {
|
|
|
18
18
|
label: string;
|
|
19
19
|
show?: boolean | ((...args: any[]) => boolean);
|
|
20
20
|
}
|
|
21
|
+
export interface UseTabHistoryOpts {
|
|
22
|
+
/**
|
|
23
|
+
* The initial value of activeTab.
|
|
24
|
+
* The default value is tabs[0].value.
|
|
25
|
+
*
|
|
26
|
+
* When a valid tab value is found on window.location.search
|
|
27
|
+
* it will replace the initial value.
|
|
28
|
+
*/
|
|
29
|
+
initial?: string;
|
|
30
|
+
/**
|
|
31
|
+
* The param name to use on window.location.search.
|
|
32
|
+
* The default is "tab".
|
|
33
|
+
*/
|
|
34
|
+
paramName?: string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* useTabHistory
|
|
38
|
+
*
|
|
39
|
+
* Example Usage:
|
|
40
|
+
*
|
|
41
|
+
* const {activeTab, tabs} = useTabHistory([{label: "Tab One", value: "tab-1"}, {label: "Tab Two", value: "tab-2"}]})
|
|
42
|
+
*
|
|
43
|
+
* <Tabs v-model="activeTab" :tabs="tabs" />
|
|
44
|
+
*
|
|
45
|
+
* <div v-if="activeTab === 'tab-1'">Tab 1 Content</div>
|
|
46
|
+
* <div v-if="activeTab === 'tab-2'">Tab 2 Content</div>
|
|
47
|
+
*
|
|
48
|
+
* @param opts UseTabHistoryOpts
|
|
49
|
+
* @return {activeTab: Ref<string>, tabs: Ref<{labe: string, value: string}[]>}
|
|
50
|
+
*/
|
|
51
|
+
export declare const useTabHistory: (initialTabs: MaybeRef<{
|
|
52
|
+
label: string;
|
|
53
|
+
value: string;
|
|
54
|
+
}[]>, opts?: UseTabHistoryOpts) => {
|
|
55
|
+
activeTab: import("vue").Ref<string>;
|
|
56
|
+
tabs: import("vue").Ref<{
|
|
57
|
+
label: string;
|
|
58
|
+
value: string;
|
|
59
|
+
}[] | {
|
|
60
|
+
label: string;
|
|
61
|
+
value: string;
|
|
62
|
+
}[]>;
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* URLParamValue is the set of value types that are
|
|
66
|
+
* currently spec'd to be parsed into a query string.
|
|
67
|
+
*/
|
|
68
|
+
export type URLParamValue = string | number | boolean | null | undefined | string[] | number[];
|
|
69
|
+
/**
|
|
70
|
+
* URLParams generic serves as a type constraint ensuring that
|
|
71
|
+
* the search params record used only contains fields that are
|
|
72
|
+
* currently spec'd to be parsed into a query string. See: URLParamValue
|
|
73
|
+
*
|
|
74
|
+
* Example:
|
|
75
|
+
*
|
|
76
|
+
* interface SearchParams {
|
|
77
|
+
* // All Good!
|
|
78
|
+
* q: string
|
|
79
|
+
* count: number
|
|
80
|
+
* isActive: boolean
|
|
81
|
+
* terms: string[]
|
|
82
|
+
* bucketOfNumbers: number[]
|
|
83
|
+
*
|
|
84
|
+
* // Nope!
|
|
85
|
+
* nested: {
|
|
86
|
+
* qTwo: string
|
|
87
|
+
* }
|
|
88
|
+
* }
|
|
89
|
+
*/
|
|
90
|
+
export type URLParams<T> = {
|
|
91
|
+
[P in keyof T]: T[P] extends URLParamValue ? T[P] : never;
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* useUrlSearchParams accepts an initial set of search query params
|
|
95
|
+
* in the shape of Record<string, URLParamValue> and tracks the values
|
|
96
|
+
* of each param on window.location.search.
|
|
97
|
+
*
|
|
98
|
+
* This is a one-way sync where non-nullish, non-falsey values are popped
|
|
99
|
+
* onto window.location.search as they are mutated. The initial values are not read
|
|
100
|
+
* from an existing query string on window.location.search as each values
|
|
101
|
+
* type cannot be inferred safely.
|
|
102
|
+
*
|
|
103
|
+
* This composable ignores query params that may already exist on window.location.search
|
|
104
|
+
* leaving the intact as much as possible, since it's not possible to determine where they
|
|
105
|
+
* came from or what function they may serve.
|
|
106
|
+
*
|
|
107
|
+
* The return value is a ref of the initial set of params.
|
|
108
|
+
*
|
|
109
|
+
* Example Usage:
|
|
110
|
+
* interface SearchParams {
|
|
111
|
+
* q: string
|
|
112
|
+
* isActive: boolean
|
|
113
|
+
* }
|
|
114
|
+
*
|
|
115
|
+
* // NOTE: initial params values should come from the
|
|
116
|
+
* // server in the form of a page prop. Though some
|
|
117
|
+
* // exceptions may exist.
|
|
118
|
+
* const props = defineProps<{
|
|
119
|
+
* initialParams: SearchParams
|
|
120
|
+
* }>
|
|
121
|
+
*
|
|
122
|
+
* const searchParams = useUrlSearchParams(props.initialParam)
|
|
123
|
+
*
|
|
124
|
+
* <BaseInput v-model="searchParams.q" label="Search" type="search" />
|
|
125
|
+
* <Checkbox v-model="searchParams.isActive" label="Is Active" />
|
|
126
|
+
*
|
|
127
|
+
* When q = "jimothy bobbitz" and isActive = false
|
|
128
|
+
* /path?q=jimothy+bobbitz
|
|
129
|
+
*
|
|
130
|
+
* When q = "jimothy bobbitz" and isActive = true
|
|
131
|
+
* /path?q=jimothy+bobbitz&isActive=true
|
|
132
|
+
*
|
|
133
|
+
* * When q = "" and isActive = false
|
|
134
|
+
* /path
|
|
135
|
+
*
|
|
136
|
+
* @param initial any Record<string, URLParamValue> like interface
|
|
137
|
+
* @return Ref<T>
|
|
138
|
+
*/
|
|
139
|
+
export declare const useUrlSearchParams: <T>(initial: URLParams<T>) => import("vue").Ref<import("vue").UnwrapRef<URLParams<T>>>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { TableColumn, TableRow } from "../../composables/table";
|
|
2
|
+
declare const _default: import("vue").DefineComponent<__VLS_TypePropsToRuntimeProps<{
|
|
3
|
+
columns: TableColumn<TableRow>[];
|
|
4
|
+
rows: TableRow[];
|
|
5
|
+
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
|
|
6
|
+
columns?: unknown;
|
|
7
|
+
rows?: unknown;
|
|
8
|
+
} & {
|
|
9
|
+
columns: TableColumn<TableRow>[];
|
|
10
|
+
rows: TableRow[];
|
|
11
|
+
} & {}>, {}>;
|
|
12
|
+
export default _default;
|
|
13
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
14
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
15
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
16
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
17
|
+
} : {
|
|
18
|
+
type: import('vue').PropType<T[K]>;
|
|
19
|
+
required: true;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as TableTypes from "../../composables/table";
|
|
2
|
+
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_TypePropsToRuntimeProps<{
|
|
3
|
+
tableData: Omit<TableTypes.Static, "currentUser">;
|
|
4
|
+
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
|
|
5
|
+
tableData?: unknown;
|
|
6
|
+
} & {
|
|
7
|
+
tableData: Omit<TableTypes.Static, "currentUser">;
|
|
8
|
+
} & {}>, {}>, {
|
|
9
|
+
actions: (_: {
|
|
10
|
+
row: Record<string, unknown>;
|
|
11
|
+
}) => any;
|
|
12
|
+
}>;
|
|
13
|
+
export default _default;
|
|
14
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
15
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
16
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
17
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
18
|
+
} : {
|
|
19
|
+
type: import('vue').PropType<T[K]>;
|
|
20
|
+
required: true;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
24
|
+
new (): {
|
|
25
|
+
$slots: S;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import * as TableTypes from "../../composables/table";
|
|
2
|
+
declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
3
|
+
clickable?: boolean | undefined;
|
|
4
|
+
loader?: boolean | undefined;
|
|
5
|
+
tableData: TableTypes.Dynamic;
|
|
6
|
+
}>, {
|
|
7
|
+
clickable: boolean;
|
|
8
|
+
loader: boolean;
|
|
9
|
+
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
10
|
+
handleClick: (v: any) => void;
|
|
11
|
+
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
|
|
12
|
+
tableData?: unknown;
|
|
13
|
+
clickable?: unknown;
|
|
14
|
+
loader?: unknown;
|
|
15
|
+
} & {
|
|
16
|
+
tableData: TableTypes.Dynamic;
|
|
17
|
+
clickable: boolean;
|
|
18
|
+
loader: boolean;
|
|
19
|
+
} & {}> & {
|
|
20
|
+
onHandleClick?: ((v: any) => any) | undefined;
|
|
21
|
+
}, {
|
|
22
|
+
clickable: boolean;
|
|
23
|
+
loader: boolean;
|
|
24
|
+
}>;
|
|
25
|
+
export default _default;
|
|
26
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
27
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
28
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
29
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
30
|
+
} : {
|
|
31
|
+
type: import('vue').PropType<T[K]>;
|
|
32
|
+
required: true;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
type __VLS_WithDefaults<P, D> = {
|
|
36
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? P[K] & {
|
|
37
|
+
default: D[K];
|
|
38
|
+
} : P[K];
|
|
39
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ActionMenuItemCallback } from "../../composables/nav";
|
|
2
|
+
declare const _default: import("vue").DefineComponent<__VLS_TypePropsToRuntimeProps<{
|
|
3
|
+
items: ActionMenuItemCallback[];
|
|
4
|
+
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
|
|
5
|
+
items?: unknown;
|
|
6
|
+
} & {
|
|
7
|
+
items: ActionMenuItemCallback[];
|
|
8
|
+
} & {}>, {}>;
|
|
9
|
+
export default _default;
|
|
10
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
11
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
12
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
13
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
14
|
+
} : {
|
|
15
|
+
type: import('vue').PropType<T[K]>;
|
|
16
|
+
required: true;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ActionMenuEmit } from "../../composables/nav";
|
|
2
|
+
declare const _default: import("vue").DefineComponent<__VLS_TypePropsToRuntimeProps<{
|
|
3
|
+
items: ActionMenuEmit[];
|
|
4
|
+
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
5
|
+
click: (v: string) => void;
|
|
6
|
+
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
|
|
7
|
+
items?: unknown;
|
|
8
|
+
} & {
|
|
9
|
+
items: ActionMenuEmit[];
|
|
10
|
+
} & {}> & {
|
|
11
|
+
onClick?: ((v: string) => any) | undefined;
|
|
12
|
+
}, {}>;
|
|
13
|
+
export default _default;
|
|
14
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
15
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
16
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
17
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
18
|
+
} : {
|
|
19
|
+
type: import('vue').PropType<T[K]>;
|
|
20
|
+
required: true;
|
|
21
|
+
};
|
|
22
|
+
};
|