@xy-planning-network/trees 0.4.0-rc-7 → 0.4.0-rc-8
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 +16 -26
- package/package.json +6 -6
- package/types/components.d.ts +6 -2
- package/types/composables/date.d.ts +4 -0
- package/types/composables/nav.d.ts +13 -0
- package/types/composables/overlay.d.ts +4 -0
- package/types/composables/table.d.ts +32 -0
- package/types/composables/user.d.ts +9 -0
- package/types/global.d.ts +5 -2
- package/types/lib-components/index.d.ts +0 -8
- package/types/lib-components/layout/DateFilter.vue.d.ts +1 -4
- package/types/lib-components/layout/SidebarLayout.vue.d.ts +1 -1
- package/types/lib-components/layout/StackedLayout.vue.d.ts +2 -2
- package/types/lib-components/lists/StaticTable.vue.d.ts +1 -1
- package/types/lib-components/lists/Table.vue.d.ts +1 -1
- package/types/lib-components/navigation/ActionsDropdown.vue.d.ts +2 -2
- package/types/lib-components/navigation/Paginator.vue.d.ts +1 -6
- package/types/lib-components/overlays/Flash.vue.d.ts +0 -4
- package/types/index.d.ts +0 -3
- package/types/nav.d.ts +0 -8
- package/types/table.d.ts +0 -36
- package/types/users.d.ts +0 -10
package/README.md
CHANGED
|
@@ -59,44 +59,34 @@ npm i @xy-planning-network/trees mitt
|
|
|
59
59
|
|
|
60
60
|
This example installs all components of Trees, which may not be necessary for all projects. Assumes you have a vue 3 project with tailwind created.
|
|
61
61
|
|
|
62
|
-
**Establish global types for VueBus and Flashes in global.d.ts**
|
|
63
|
-
|
|
64
|
-
```ts
|
|
65
|
-
// global.d.ts
|
|
66
|
-
|
|
67
|
-
import { Emitter } from "mitt";
|
|
68
|
-
|
|
69
|
-
declare global {
|
|
70
|
-
interface Window {
|
|
71
|
-
Flashes: Array<{ message: string }>;
|
|
72
|
-
VueBus: Emitter;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
```
|
|
76
|
-
|
|
77
62
|
**Initialize trees components in main.ts**
|
|
78
63
|
|
|
79
64
|
```ts
|
|
80
65
|
// main.ts
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
66
|
+
|
|
67
|
+
// include the type interfaces for Window and GlobalComponents
|
|
68
|
+
/// <reference types="@xy-planning-network/trees/types/global" />
|
|
69
|
+
/// <reference types="@xy-planning-network/trees/types/components" />
|
|
70
|
+
|
|
71
|
+
import Vue, { createApp } from "vue"
|
|
72
|
+
import Mitt from "mitt"
|
|
73
|
+
import Trees from "@xy-planning-network/trees"
|
|
74
|
+
import HelloWorld from "@/components/HelloWorld.vue"
|
|
85
75
|
|
|
86
76
|
// import your project's main stylesheet
|
|
87
|
-
import "@/main.css"
|
|
77
|
+
import "@/main.css"
|
|
88
78
|
|
|
89
79
|
// initialize the app
|
|
90
|
-
const app = createApp(HelloWorld)
|
|
80
|
+
const app = createApp(HelloWorld)
|
|
91
81
|
|
|
92
82
|
// initialize mitt on VueBus
|
|
93
|
-
window.VueBus = mitt()
|
|
83
|
+
window.VueBus = mitt()
|
|
94
84
|
|
|
95
85
|
// use all of Trees as a vue plugin
|
|
96
|
-
app.use(Trees)
|
|
86
|
+
app.use(Trees)
|
|
97
87
|
|
|
98
88
|
// mount the application
|
|
99
|
-
app.mount("#vue-app")
|
|
89
|
+
app.mount("#vue-app")
|
|
100
90
|
```
|
|
101
91
|
|
|
102
92
|
**Initialize styles in main.css**
|
|
@@ -129,10 +119,10 @@ Note you may need a deep merge utility depending on the depth of properties you
|
|
|
129
119
|
|
|
130
120
|
```js
|
|
131
121
|
/* eslint-disable */
|
|
132
|
-
const treesConfig = require("@xy-planning-network/trees/config/tailwind.config")
|
|
122
|
+
const treesConfig = require("@xy-planning-network/trees/config/tailwind.config")
|
|
133
123
|
module.exports = {
|
|
134
124
|
...treesConfig,
|
|
135
125
|
mode: "jit", // Optional
|
|
136
126
|
purge: [...treesConfig.purge, ...["./src/**/*.vue"]],
|
|
137
|
-
}
|
|
127
|
+
}
|
|
138
128
|
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xy-planning-network/trees",
|
|
3
|
-
"version": "0.4.0-rc-
|
|
3
|
+
"version": "0.4.0-rc-8",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "github:xy-planning-network/trees",
|
|
@@ -16,17 +16,17 @@
|
|
|
16
16
|
"unpkg": "dist/trees.umd.js",
|
|
17
17
|
"types": "types/entry.d.ts",
|
|
18
18
|
"sideEffects": [
|
|
19
|
-
"*.css"
|
|
20
|
-
"*.vue"
|
|
19
|
+
"*.css"
|
|
21
20
|
],
|
|
22
21
|
"scripts": {
|
|
23
22
|
"dev": "vite",
|
|
24
|
-
"build": "vite build && vue-tsc -p src && npm run copy:types && tsc-alias -p src/tsconfig.json",
|
|
23
|
+
"build": "vite build && vue-tsc -p src --emitDeclarationOnly && npm run copy:types && tsc-alias -p src/tsconfig.json",
|
|
25
24
|
"build:docs": "vue-tsc -p dev --noEmit && vite build --config vite.docs.config.ts",
|
|
26
|
-
"copy:types": "copyfiles -f ./src
|
|
25
|
+
"copy:types": "copyfiles -f ./src/*.d.ts ./types",
|
|
27
26
|
"lint": "eslint --ext .js,.ts,.vue src",
|
|
28
27
|
"lint:fix": "eslint --fix --ext .js,.ts,.vue src dev && prettier -w -u src dev",
|
|
29
|
-
"preview": "vite preview --config vite.docs.config.ts"
|
|
28
|
+
"preview": "vite preview --config vite.docs.config.ts",
|
|
29
|
+
"typecheck": "vue-tsc -p src --noEmit"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@types/node": "^16.11.13",
|
package/types/components.d.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { TreesComponents } from "./lib-components"
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
/**
|
|
4
|
+
* When using App.use(Trees) include a
|
|
5
|
+
* /// <reference types="@xy-planning-network/trees/types/components" /> or
|
|
6
|
+
* import GlobalComponents from "@xy-planning-network/trees/types/components"
|
|
7
|
+
* in the project.
|
|
8
|
+
*/
|
|
5
9
|
declare module "@vue/runtime-core" {
|
|
6
10
|
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
|
7
11
|
interface GlobalComponents extends TreesComponents {}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { DefineComponent, RenderFunction } from "vue";
|
|
2
|
+
export interface Item {
|
|
3
|
+
icon?: DefineComponent<unknown, unknown, any> | RenderFunction;
|
|
4
|
+
name: string;
|
|
5
|
+
openInTab?: boolean;
|
|
6
|
+
url: string;
|
|
7
|
+
}
|
|
8
|
+
export interface Pagination {
|
|
9
|
+
page: number;
|
|
10
|
+
perPage: number;
|
|
11
|
+
totalItems: number;
|
|
12
|
+
totalPages: number;
|
|
13
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ComponentPublicInstance, DefineComponent } from "vue";
|
|
2
|
+
import User from "../composables/user";
|
|
3
|
+
export interface Column {
|
|
4
|
+
display: string;
|
|
5
|
+
class?: string;
|
|
6
|
+
key?: string;
|
|
7
|
+
presenter?(row: any, instance: ComponentPublicInstance): any;
|
|
8
|
+
component?: DefineComponent<unknown, unknown, any>;
|
|
9
|
+
items?: Array<MenuItem>;
|
|
10
|
+
sort?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface Dynamic {
|
|
13
|
+
currentUser: User;
|
|
14
|
+
columns: Array<Column>;
|
|
15
|
+
dateSearch?: boolean;
|
|
16
|
+
defaultSort?: string;
|
|
17
|
+
defaultSortDirection?: string;
|
|
18
|
+
refreshTrigger: number;
|
|
19
|
+
reloadTrigger?: number;
|
|
20
|
+
search?: boolean;
|
|
21
|
+
url: string;
|
|
22
|
+
}
|
|
23
|
+
export interface MenuItem {
|
|
24
|
+
label: string;
|
|
25
|
+
event: string;
|
|
26
|
+
show?(propsData: any, currentUser: User): boolean;
|
|
27
|
+
}
|
|
28
|
+
export interface Static {
|
|
29
|
+
currentUser: User;
|
|
30
|
+
columns: Array<Column>;
|
|
31
|
+
items: Record<string, unknown>[];
|
|
32
|
+
}
|
package/types/global.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { Emitter } from "mitt"
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
/**
|
|
4
|
+
* When using window.VueBus.emit("Flash-show-generic-error", "support@trees.com") include
|
|
5
|
+
* /// <reference types="@xy-planning-network/trees/types/global" />
|
|
6
|
+
* in the project.
|
|
7
|
+
*/
|
|
5
8
|
declare global {
|
|
6
9
|
interface Window {
|
|
7
10
|
Flashes: Array<{ type?: string; message: string }>
|
|
@@ -29,14 +29,6 @@ import { default as YesOrNoRadio } from "./forms/YesOrNoRadio.vue";
|
|
|
29
29
|
export { ActionsDropdown, Cards, ContentModal, DateFilter, DetailList, DownloadCell, Flash, Modal, SidebarLayout, Slideover, StackedLayout, Paginator, Spinner, StaticTable, Steps, Table, Tabs, Toggle, BaseInput, Checkbox, DateRangePicker, InputHelp, InputLabel, MultiCheckboxes, Radio, Select, TextArea, YesOrNoRadio, };
|
|
30
30
|
/**
|
|
31
31
|
* declare global component types for App.use(Trees)
|
|
32
|
-
*
|
|
33
|
-
* apply to project with the following
|
|
34
|
-
import { TreesComponents } from "@xy-planning-network/trees"
|
|
35
|
-
|
|
36
|
-
declare module "@vue/runtime-core" {
|
|
37
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
|
38
|
-
interface GlobalComponents extends TreesComponents {}
|
|
39
|
-
}
|
|
40
32
|
*/
|
|
41
33
|
export interface TreesComponents {
|
|
42
34
|
ActionsDropdown: typeof ActionsDropdown;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as NavTypes from "../../
|
|
2
|
-
import User from "../../
|
|
1
|
+
import * as NavTypes from "../../composables/nav";
|
|
2
|
+
import User from "../../composables/user";
|
|
3
3
|
declare const _default: import("vue").DefineComponent<{
|
|
4
4
|
activeURL: {
|
|
5
5
|
type: import("vue").PropType<string>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as TableTypes from "../../
|
|
1
|
+
import * as TableTypes from "../../composables/table";
|
|
2
2
|
declare const _default: import("vue").DefineComponent<__VLS_DefinePropsToOptions<{
|
|
3
3
|
tableData: TableTypes.Static;
|
|
4
4
|
}>, () => void, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MenuItem } from "@headlessui/vue";
|
|
2
|
-
import * as TableTypes from "../../
|
|
3
|
-
import User from "../../
|
|
2
|
+
import * as TableTypes from "../../composables/table";
|
|
3
|
+
import User from "../../composables/user";
|
|
4
4
|
declare const _default: import("vue").DefineComponent<__VLS_DefinePropsToOptions<{
|
|
5
5
|
currentUser: User;
|
|
6
6
|
items: TableTypes.MenuItem[];
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
page: number;
|
|
3
|
-
perPage: number;
|
|
4
|
-
totalItems: number;
|
|
5
|
-
totalPages: number;
|
|
6
|
-
}
|
|
1
|
+
import { Pagination } from "../../composables/nav";
|
|
7
2
|
declare const _default: import("vue").DefineComponent<__VLS_DefinePropsToOptions<{
|
|
8
3
|
modelValue: Pagination;
|
|
9
4
|
}>, () => void, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
export interface Flash {
|
|
2
|
-
type?: string;
|
|
3
|
-
message: string;
|
|
4
|
-
}
|
|
5
1
|
declare const _default: import("vue").DefineComponent<{}, () => void, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{} & {} & {}>, {}>;
|
|
6
2
|
export default _default;
|
package/types/index.d.ts
DELETED
package/types/nav.d.ts
DELETED
package/types/table.d.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { ComponentPublicInstance, DefineComponent } from "vue"
|
|
2
|
-
import User from "./users"
|
|
3
|
-
|
|
4
|
-
export interface Column {
|
|
5
|
-
display: string
|
|
6
|
-
class?: string
|
|
7
|
-
key?: string
|
|
8
|
-
presenter?(row: any, instance: ComponentPublicInstance): any
|
|
9
|
-
component?: DefineComponent<unknown, unknown, any>
|
|
10
|
-
items?: Array<MenuItem>
|
|
11
|
-
sort?: string
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export interface Dynamic {
|
|
15
|
-
currentUser: User
|
|
16
|
-
columns: Array<Column>
|
|
17
|
-
dateSearch?: boolean
|
|
18
|
-
defaultSort?: string
|
|
19
|
-
defaultSortDirection?: string
|
|
20
|
-
refreshTrigger: number
|
|
21
|
-
reloadTrigger?: number
|
|
22
|
-
search?: boolean
|
|
23
|
-
url: string
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export interface MenuItem {
|
|
27
|
-
label: string
|
|
28
|
-
event: string
|
|
29
|
-
show?(propsData: any, currentUser: User): boolean
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export interface Static {
|
|
33
|
-
currentUser: User
|
|
34
|
-
columns: Array<Column>
|
|
35
|
-
items: Record<string, unknown>[]
|
|
36
|
-
}
|