@xy-planning-network/trees 0.6.5 → 0.6.6-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/README.md +0 -22
- package/dist/trees.es.js +2539 -2498
- package/dist/trees.umd.js +9 -9
- package/package.json +1 -2
- package/src/lib-components/lists/DataTable.vue +99 -0
- package/src/lib-components/lists/DownloadCell.vue +5 -3
- package/src/lib-components/lists/{Table.vue → DynamicTable.vue} +87 -61
- package/src/lib-components/navigation/ActionsDropdown.vue +22 -32
- package/types/composables/nav.d.ts +12 -0
- package/types/composables/table.d.ts +52 -22
- package/types/composables/useFlashes.d.ts +5 -0
- package/types/composables/useTable.d.ts +42 -0
- package/types/lib-components/index.d.ts +5 -5
- package/types/lib-components/lists/DataTable.vue.d.ts +33 -0
- package/types/lib-components/lists/DownloadCell.vue.d.ts +0 -3
- package/types/lib-components/lists/DynamicTable.vue.d.ts +54 -0
- package/types/lib-components/lists/StaticTable.vue.d.ts +7 -4
- package/types/lib-components/lists/StaticTableActionSlot.vue.d.ts +27 -0
- package/types/lib-components/navigation/ActionsDropdown.vue.d.ts +3 -11
- package/types/lib-components/navigation/ActionsDropdownCallback.vue.d.ts +18 -0
- package/types/lib-components/navigation/ActionsDropdownEmit.vue.d.ts +22 -0
- package/src/lib-components/lists/StaticTable.vue +0 -83
|
@@ -15,9 +15,9 @@ import { default as Tooltip } from "./overlays/Tooltip.vue";
|
|
|
15
15
|
import { default as StackedLayout } from "./layout/StackedLayout.vue";
|
|
16
16
|
import { default as Paginator } from "./navigation/Paginator.vue";
|
|
17
17
|
import { default as Spinner } from "./overlays/Spinner.vue";
|
|
18
|
-
import { default as
|
|
18
|
+
import { default as DataTable } from "./lists/DataTable.vue";
|
|
19
19
|
import { default as Steps } from "./navigation/Steps.vue";
|
|
20
|
-
import { default as
|
|
20
|
+
import { default as DynamicTable } from "./lists/DynamicTable.vue";
|
|
21
21
|
import { default as Tabs } from "./navigation/Tabs.vue";
|
|
22
22
|
import { default as Toggle } from "./forms/Toggle.vue";
|
|
23
23
|
import { default as XYSpinner } from "./indicators/XYSpinner.vue";
|
|
@@ -34,7 +34,7 @@ import { default as Select } from "./forms/Select.vue";
|
|
|
34
34
|
import { default as TextArea } from "./forms/TextArea.vue";
|
|
35
35
|
import { default as YesOrNoRadio } from "./forms/YesOrNoRadio.vue";
|
|
36
36
|
export { ActionsDropdown, Cards, ContentModal, DateFilter, DetailList, DownloadCell, Flash, Modal, SidebarLayout, Slideover, StackedLayout, Popover, PopoverContent, PopoverPosition, // Type export
|
|
37
|
-
Paginator, Spinner,
|
|
37
|
+
Paginator, Spinner, DataTable, Steps, DynamicTable, Tabs, Toggle, Tooltip, BaseInput, Checkbox, DateRangePicker, InputHelp, InputLabel, FieldsetLegend, MultiCheckboxes, Radio, RadioCards, Select, TextArea, YesOrNoRadio, XYSpinner, };
|
|
38
38
|
/**
|
|
39
39
|
* declare global component types for App.use(Trees)
|
|
40
40
|
*/
|
|
@@ -54,9 +54,9 @@ export interface TreesComponents {
|
|
|
54
54
|
StackedLayout: typeof StackedLayout;
|
|
55
55
|
Paginator: typeof Paginator;
|
|
56
56
|
Spinner: typeof Spinner;
|
|
57
|
-
|
|
57
|
+
DataTable: typeof DataTable;
|
|
58
|
+
DynamicTable: typeof DynamicTable;
|
|
58
59
|
Steps: typeof Steps;
|
|
59
|
-
Table: typeof Table;
|
|
60
60
|
Tabs: typeof Tabs;
|
|
61
61
|
Toggle: typeof Toggle;
|
|
62
62
|
Tooltip: typeof Tooltip;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { TableActions, TableColumns, TableRowsData } from "../../composables/table";
|
|
2
|
+
declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
3
|
+
tableActions?: TableActions<any> | undefined;
|
|
4
|
+
tableColumns: TableColumns<any>;
|
|
5
|
+
tableData: TableRowsData;
|
|
6
|
+
}>, {
|
|
7
|
+
tableActions: () => never[];
|
|
8
|
+
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
|
|
9
|
+
tableActions?: unknown;
|
|
10
|
+
tableColumns?: unknown;
|
|
11
|
+
tableData?: unknown;
|
|
12
|
+
} & {
|
|
13
|
+
tableActions: TableActions<any>;
|
|
14
|
+
tableColumns: TableColumns<any>;
|
|
15
|
+
tableData: TableRowsData;
|
|
16
|
+
} & {}>, {
|
|
17
|
+
tableActions: TableActions<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 ? P[K] & {
|
|
31
|
+
default: D[K];
|
|
32
|
+
} : P[K];
|
|
33
|
+
};
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
declare const _default: import("vue").DefineComponent<__VLS_TypePropsToRuntimeProps<{
|
|
2
2
|
propsData: Record<string, unknown>;
|
|
3
|
-
attribute: string;
|
|
4
3
|
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
|
|
5
4
|
propsData?: unknown;
|
|
6
|
-
attribute?: unknown;
|
|
7
5
|
} & {
|
|
8
6
|
propsData: Record<string, unknown>;
|
|
9
|
-
attribute: string;
|
|
10
7
|
} & {}>, {}>;
|
|
11
8
|
export default _default;
|
|
12
9
|
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { DynamicTableAPI, DynamicTableOptions, TableActions, TableColumns } from "../../composables/table";
|
|
2
|
+
declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
3
|
+
clickable?: boolean | undefined;
|
|
4
|
+
loader?: boolean | undefined;
|
|
5
|
+
tableActions?: TableActions<any> | undefined;
|
|
6
|
+
tableColumns: TableColumns<any>;
|
|
7
|
+
tableOptions: DynamicTableOptions;
|
|
8
|
+
}>, {
|
|
9
|
+
clickable: boolean;
|
|
10
|
+
loader: boolean;
|
|
11
|
+
tableActions: () => never[];
|
|
12
|
+
}>, {
|
|
13
|
+
refresh: () => void;
|
|
14
|
+
reset: () => void;
|
|
15
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
16
|
+
"click:row": (v: {
|
|
17
|
+
[x: string]: any;
|
|
18
|
+
}, c: DynamicTableAPI) => void;
|
|
19
|
+
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
|
|
20
|
+
tableActions?: unknown;
|
|
21
|
+
tableColumns?: unknown;
|
|
22
|
+
clickable?: unknown;
|
|
23
|
+
loader?: unknown;
|
|
24
|
+
tableOptions?: unknown;
|
|
25
|
+
} & {
|
|
26
|
+
tableActions: TableActions<any>;
|
|
27
|
+
tableColumns: TableColumns<any>;
|
|
28
|
+
clickable: boolean;
|
|
29
|
+
loader: boolean;
|
|
30
|
+
tableOptions: DynamicTableOptions;
|
|
31
|
+
} & {}> & {
|
|
32
|
+
"onClick:row"?: ((v: {
|
|
33
|
+
[x: string]: any;
|
|
34
|
+
}, c: DynamicTableAPI) => any) | undefined;
|
|
35
|
+
}, {
|
|
36
|
+
tableActions: TableActions<any>;
|
|
37
|
+
clickable: boolean;
|
|
38
|
+
loader: boolean;
|
|
39
|
+
}>;
|
|
40
|
+
export default _default;
|
|
41
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
42
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
43
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
44
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
45
|
+
} : {
|
|
46
|
+
type: import('vue').PropType<T[K]>;
|
|
47
|
+
required: true;
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
type __VLS_WithDefaults<P, D> = {
|
|
51
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? P[K] & {
|
|
52
|
+
default: D[K];
|
|
53
|
+
} : P[K];
|
|
54
|
+
};
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { TableColumn, TableRow } from "../../composables/table";
|
|
2
2
|
declare const _default: import("vue").DefineComponent<__VLS_TypePropsToRuntimeProps<{
|
|
3
|
-
|
|
3
|
+
columns: TableColumn<TableRow>[];
|
|
4
|
+
rows: TableRow[];
|
|
4
5
|
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
|
|
5
|
-
|
|
6
|
+
columns?: unknown;
|
|
7
|
+
rows?: unknown;
|
|
6
8
|
} & {
|
|
7
|
-
|
|
9
|
+
columns: TableColumn<TableRow>[];
|
|
10
|
+
rows: TableRow[];
|
|
8
11
|
} & {}>, {}>;
|
|
9
12
|
export default _default;
|
|
10
13
|
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
@@ -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
|
+
};
|
|
@@ -1,18 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import * as TableTypes from "../../composables/table";
|
|
3
|
-
import User from "../../composables/user";
|
|
1
|
+
import type { ActionMenuItem } from "../../composables/nav";
|
|
4
2
|
declare const _default: import("vue").DefineComponent<__VLS_TypePropsToRuntimeProps<{
|
|
5
|
-
|
|
6
|
-
items: TableTypes.MenuItem[];
|
|
7
|
-
propsData: any;
|
|
3
|
+
items: ActionMenuItem[];
|
|
8
4
|
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
|
|
9
|
-
currentUser?: unknown;
|
|
10
5
|
items?: unknown;
|
|
11
|
-
propsData?: unknown;
|
|
12
6
|
} & {
|
|
13
|
-
|
|
14
|
-
items: TableTypes.MenuItem[];
|
|
15
|
-
propsData: any;
|
|
7
|
+
items: ActionMenuItem[];
|
|
16
8
|
} & {}>, {}>;
|
|
17
9
|
export default _default;
|
|
18
10
|
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
@@ -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
|
+
};
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { ComponentPublicInstance, getCurrentInstance } from "vue"
|
|
3
|
-
import * as TableTypes from "@/composables/table"
|
|
4
|
-
|
|
5
|
-
defineProps<{
|
|
6
|
-
tableData: TableTypes.Static
|
|
7
|
-
}>()
|
|
8
|
-
|
|
9
|
-
const cellValue = (
|
|
10
|
-
item: Record<string, any>,
|
|
11
|
-
col: TableTypes.Column
|
|
12
|
-
): string => {
|
|
13
|
-
if (col.key) {
|
|
14
|
-
return item[col.key]
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
if (col.presenter) {
|
|
18
|
-
// TODO: discuss this pattern. Current usage can be replaced with modules.
|
|
19
|
-
// https://v3.vuejs.org/api/composition-api.html#getcurrentinstance
|
|
20
|
-
const internalInstance = getCurrentInstance()
|
|
21
|
-
return col.presenter(
|
|
22
|
-
item,
|
|
23
|
-
internalInstance?.proxy as ComponentPublicInstance
|
|
24
|
-
)
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
return ""
|
|
28
|
-
}
|
|
29
|
-
</script>
|
|
30
|
-
<template>
|
|
31
|
-
<div class="flex flex-col">
|
|
32
|
-
<div class="-my-2 overflow-x-auto sm:-mx-6 lg:-mx-8">
|
|
33
|
-
<div class="inline-block min-w-full py-2 align-middle sm:px-6 lg:px-8">
|
|
34
|
-
<div
|
|
35
|
-
class="overflow-hidden border-b border-gray-200 shadow sm:rounded-lg"
|
|
36
|
-
>
|
|
37
|
-
<table class="min-w-full divide-y divide-gray-200">
|
|
38
|
-
<thead>
|
|
39
|
-
<tr>
|
|
40
|
-
<th
|
|
41
|
-
v-for="(col, idx) in tableData.columns"
|
|
42
|
-
:key="idx"
|
|
43
|
-
class="px-6 py-3 text-xs font-medium tracking-wider text-left text-gray-900 uppercase bg-gray-50 leading-4"
|
|
44
|
-
v-text="col.display"
|
|
45
|
-
></th>
|
|
46
|
-
</tr>
|
|
47
|
-
</thead>
|
|
48
|
-
<tbody class="bg-white divide-y divide-gray-200">
|
|
49
|
-
<tr
|
|
50
|
-
v-for="(item, rowIdx) in tableData.items"
|
|
51
|
-
:key="item.id ? (item.id as string) : rowIdx"
|
|
52
|
-
>
|
|
53
|
-
<td
|
|
54
|
-
v-for="(col, colIdx) in tableData.columns"
|
|
55
|
-
:key="rowIdx + '-' + colIdx"
|
|
56
|
-
class="px-6 py-4 text-sm text-gray-700 whitespace-nowrap leading-5"
|
|
57
|
-
>
|
|
58
|
-
<component
|
|
59
|
-
:is="col.component"
|
|
60
|
-
v-if="col.component"
|
|
61
|
-
:props-data="item"
|
|
62
|
-
:current-user="tableData.currentUser"
|
|
63
|
-
:attribute="col.key"
|
|
64
|
-
></component>
|
|
65
|
-
<span v-else v-text="cellValue(item, col)"></span>
|
|
66
|
-
</td>
|
|
67
|
-
</tr>
|
|
68
|
-
|
|
69
|
-
<tr v-if="tableData.items.length == 0">
|
|
70
|
-
<td
|
|
71
|
-
:colspan="tableData.columns.length"
|
|
72
|
-
class="px-6 py-4 text-sm text-gray-700 whitespace-nowrap leading-5"
|
|
73
|
-
>
|
|
74
|
-
No items were found!
|
|
75
|
-
</td>
|
|
76
|
-
</tr>
|
|
77
|
-
</tbody>
|
|
78
|
-
</table>
|
|
79
|
-
</div>
|
|
80
|
-
</div>
|
|
81
|
-
</div>
|
|
82
|
-
</div>
|
|
83
|
-
</template>
|