@cocoar/vue-ui 2.3.0 → 2.4.0
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/breadcrumb/CoarBreadcrumb.vue.d.ts +11 -0
- package/dist/components/breadcrumb/CoarBreadcrumb.vue.d.ts.map +1 -1
- package/dist/components/breadcrumb/index.d.ts +1 -0
- package/dist/components/breadcrumb/index.d.ts.map +1 -1
- package/dist/components/icon/core-icons.d.ts +1 -0
- package/dist/components/icon/core-icons.d.ts.map +1 -1
- package/dist/components/tooltip/vTooltip.d.ts +15 -0
- package/dist/components/tooltip/vTooltip.d.ts.map +1 -1
- package/dist/components/tree/CoarTree.vue.d.ts +70 -0
- package/dist/components/tree/CoarTree.vue.d.ts.map +1 -0
- package/dist/components/tree/CoarTreeNode.vue.d.ts +51 -0
- package/dist/components/tree/CoarTreeNode.vue.d.ts.map +1 -0
- package/dist/components/tree/CoarTreeNodeLabel.vue.d.ts +9 -0
- package/dist/components/tree/CoarTreeNodeLabel.vue.d.ts.map +1 -0
- package/dist/components/tree/index.d.ts +8 -0
- package/dist/components/tree/index.d.ts.map +1 -0
- package/dist/components/tree/tree-builder.d.ts +124 -0
- package/dist/components/tree/tree-builder.d.ts.map +1 -0
- package/dist/components/tree/tree-dnd.d.ts +31 -0
- package/dist/components/tree/tree-dnd.d.ts.map +1 -0
- package/dist/components/tree/tree-types.d.ts +131 -0
- package/dist/components/tree/tree-types.d.ts.map +1 -0
- package/dist/components/tree/useTree.d.ts +6 -0
- package/dist/components/tree/useTree.d.ts.map +1 -0
- package/dist/index.css +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3388 -2477
- package/package.json +2 -2
|
@@ -1,8 +1,18 @@
|
|
|
1
|
+
export type CoarBreadcrumbSize = 'm' | 's';
|
|
1
2
|
type __VLS_Props = {
|
|
2
3
|
/** Separator character between breadcrumb items. */
|
|
3
4
|
separator?: string;
|
|
4
5
|
/** Accessible label for the nav landmark. Localizable. */
|
|
5
6
|
ariaLabel?: string;
|
|
7
|
+
/**
|
|
8
|
+
* Visual density. `'m'` (default, 14 px) is the primary-navigation size.
|
|
9
|
+
* `'s'` (13 px) is for secondary chrome — file-explorer paths, settings
|
|
10
|
+
* trails, anywhere the breadcrumb sits above other content as
|
|
11
|
+
* orientation rather than the main interactive surface. Drives the
|
|
12
|
+
* `--coar-breadcrumb-font-size` token only; spacing + colors stay
|
|
13
|
+
* unchanged so both sizes feel consistent in the same UI.
|
|
14
|
+
*/
|
|
15
|
+
size?: CoarBreadcrumbSize;
|
|
6
16
|
};
|
|
7
17
|
declare function __VLS_template(): {
|
|
8
18
|
attrs: Partial<{}>;
|
|
@@ -14,6 +24,7 @@ declare function __VLS_template(): {
|
|
|
14
24
|
};
|
|
15
25
|
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
16
26
|
declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
27
|
+
size: CoarBreadcrumbSize;
|
|
17
28
|
ariaLabel: string;
|
|
18
29
|
separator: string;
|
|
19
30
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLElement>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoarBreadcrumb.vue.d.ts","sourceRoot":"","sources":["../../../src/components/breadcrumb/CoarBreadcrumb.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CoarBreadcrumb.vue.d.ts","sourceRoot":"","sources":["../../../src/components/breadcrumb/CoarBreadcrumb.vue"],"names":[],"mappings":"AAqEA,MAAM,MAAM,kBAAkB,GAAG,GAAG,GAAG,GAAG,CAAC;AAE3C,KAAK,WAAW,GAAG;IACf,oDAAoD;IACpD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0DAA0D;IAC1D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;;;OAOG;IACH,IAAI,CAAC,EAAE,kBAAkB,CAAC;CAC3B,CAAC;AAYJ,iBAAS,cAAc;WAmCT,OAAO,IAA6B;;yBAVrB,GAAG;;;;EAe/B;AAUD,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,QAAA,MAAM,eAAe;UAhEV,kBAAkB;eATb,MAAM;eAFN,MAAM;qFAmFpB,CAAC;wBACkB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAAnG,wBAAoG;AAapG,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/breadcrumb/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,0BAA0B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/breadcrumb/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACjE,YAAY,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,0BAA0B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core-icons.d.ts","sourceRoot":"","sources":["../../../src/components/icon/core-icons.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,eAAO,MAAM,UAAU
|
|
1
|
+
{"version":3,"file":"core-icons.d.ts","sourceRoot":"","sources":["../../../src/components/icon/core-icons.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgItB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,MAAM,OAAO,UAAU,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC"}
|
|
@@ -13,6 +13,21 @@ export interface TooltipOptions {
|
|
|
13
13
|
openDelay?: number;
|
|
14
14
|
/** Close delay in ms. Default: 0 */
|
|
15
15
|
closeDelay?: number;
|
|
16
|
+
/**
|
|
17
|
+
* Only show the tooltip when text is actually truncated.
|
|
18
|
+
*
|
|
19
|
+
* - `true` — check the trigger element itself
|
|
20
|
+
* (`el.scrollWidth > el.clientWidth`).
|
|
21
|
+
* - `string` — treat as a CSS selector on the trigger element and check
|
|
22
|
+
* that descendant's overflow instead. Use this when the tooltip is on a
|
|
23
|
+
* wrapper (so the hover area covers the whole row, including icons) but
|
|
24
|
+
* only the label inside is what gets truncated.
|
|
25
|
+
* - `function` — custom predicate, called with the trigger element on
|
|
26
|
+
* every hover/focus, returning `true` if the tooltip should show.
|
|
27
|
+
*
|
|
28
|
+
* Checked lazily — no `ResizeObserver` overhead. Default: false.
|
|
29
|
+
*/
|
|
30
|
+
onlyOnOverflow?: boolean | string | ((triggerEl: HTMLElement) => boolean);
|
|
16
31
|
}
|
|
17
32
|
type OpenReason = 'hover' | 'focus';
|
|
18
33
|
interface TooltipState {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vTooltip.d.ts","sourceRoot":"","sources":["../../../src/components/tooltip/vTooltip.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2C,KAAK,SAAS,EAAyB,MAAM,KAAK,CAAC;A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ent, CoarTreeNodeSlotProps, CoarTreeRenameEvent, CoarTreeVirtualizeProp } from './tree-types';
|
|
2
|
+
import { TreeBuilder } from './tree-builder';
|
|
3
|
+
declare const _default: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
4
|
+
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
|
|
5
|
+
readonly "onUpdate:expanded"?: ((value: Set<string>) => any) | undefined;
|
|
6
|
+
readonly "onUpdate:selected"?: ((value: string | null) => any) | undefined;
|
|
7
|
+
readonly onActivate?: ((node: T) => any) | undefined;
|
|
8
|
+
readonly "onFiles-drop"?: ((payload: CoarTreeFilesDropEvent<T>) => any) | undefined;
|
|
9
|
+
readonly "onNode-move"?: ((payload: CoarTreeNodeMoveEvent<T>) => any) | undefined;
|
|
10
|
+
readonly onRename?: ((payload: CoarTreeRenameEvent<T>) => any) | undefined;
|
|
11
|
+
readonly "onRename-cancel"?: ((node: T) => any) | undefined;
|
|
12
|
+
readonly "onContext-menu"?: ((node: T | null, ev: MouseEvent) => any) | undefined;
|
|
13
|
+
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onUpdate:expanded" | "onUpdate:selected" | "onActivate" | "onFiles-drop" | "onNode-move" | "onRename" | "onRename-cancel" | "onContext-menu"> & ({
|
|
14
|
+
expanded?: Set<string>;
|
|
15
|
+
selected?: string | null;
|
|
16
|
+
} & {
|
|
17
|
+
/** Fluent builder from `useTree()`. When set, the other config props are ignored. */
|
|
18
|
+
builder?: TreeBuilder<T>;
|
|
19
|
+
nodes?: readonly T[];
|
|
20
|
+
getId?: (node: T) => string;
|
|
21
|
+
getChildren?: (node: T) => readonly T[] | null | undefined;
|
|
22
|
+
getLabel?: (node: T) => string;
|
|
23
|
+
isExpandable?: (node: T) => boolean;
|
|
24
|
+
draggable?: boolean | ((node: T) => boolean);
|
|
25
|
+
canDrop?: (source: T, target: T | null, position: CoarTreeDropPosition) => boolean;
|
|
26
|
+
acceptsFiles?: boolean;
|
|
27
|
+
autoExpandDelay?: number;
|
|
28
|
+
virtualize?: CoarTreeVirtualizeProp;
|
|
29
|
+
/**
|
|
30
|
+
* Opt into the built-in inline rename UI. With this on, `api.startRename(id)`
|
|
31
|
+
* + `@rename` work and `<CoarTreeNodeLabel>` swaps to an `<input>` while the
|
|
32
|
+
* row is renaming. Without it the rename context isn't provided and the
|
|
33
|
+
* label component stays a plain `<span>` (back-compat for existing consumers).
|
|
34
|
+
*/
|
|
35
|
+
renamable?: boolean;
|
|
36
|
+
}) & Partial<{}>> & import('vue').PublicProps;
|
|
37
|
+
expose(exposed: import('vue').ShallowUnwrapRef<{
|
|
38
|
+
focusNode(id: string): void;
|
|
39
|
+
/**
|
|
40
|
+
* Enter inline-rename mode on `id`. No-op if `:renamable` isn't set or
|
|
41
|
+
* the id isn't in the visible-row list. Use from context menu items,
|
|
42
|
+
* keyboard shortcuts, etc. The rename input mounts + auto-focuses on
|
|
43
|
+
* the next frame.
|
|
44
|
+
*/
|
|
45
|
+
startRename: (id: string) => void;
|
|
46
|
+
}>): void;
|
|
47
|
+
attrs: any;
|
|
48
|
+
slots: Readonly<{
|
|
49
|
+
default(props: CoarTreeNodeSlotProps<T>): unknown;
|
|
50
|
+
empty(): unknown;
|
|
51
|
+
}> & {
|
|
52
|
+
default(props: CoarTreeNodeSlotProps<T>): unknown;
|
|
53
|
+
empty(): unknown;
|
|
54
|
+
};
|
|
55
|
+
emit: {
|
|
56
|
+
(e: "activate", node: T): void;
|
|
57
|
+
(e: "context-menu", node: T | null, ev: MouseEvent): void;
|
|
58
|
+
(e: "files-drop", payload: CoarTreeFilesDropEvent<T>): void;
|
|
59
|
+
(e: "node-move", payload: CoarTreeNodeMoveEvent<T>): void;
|
|
60
|
+
(e: "rename", payload: CoarTreeRenameEvent<T>): void;
|
|
61
|
+
(e: "rename-cancel", node: T): void;
|
|
62
|
+
} & (((evt: "update:expanded", value: Set<string>) => void) & ((evt: "update:selected", value: string | null) => void));
|
|
63
|
+
}>) => import('vue').VNode & {
|
|
64
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
|
65
|
+
};
|
|
66
|
+
export default _default;
|
|
67
|
+
type __VLS_PrettifyLocal<T> = {
|
|
68
|
+
[K in keyof T]: T[K];
|
|
69
|
+
} & {};
|
|
70
|
+
//# sourceMappingURL=CoarTree.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CoarTree.vue.d.ts","sourceRoot":"","sources":["../../../src/components/tree/CoarTree.vue"],"names":[],"mappings":"AA8gCA,OAAO,EAIL,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAE3B,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAE1B,KAAK,mBAAmB,EAExB,KAAK,sBAAsB,EAC5B,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;yBAEjC,CAAC,EACjB,aAAa,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,EAC9D,YAAY,mBAAmB,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC,EAC3G,eAAe,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,EACjE;WAulCO,mBAAmB,CAAC;;;;;;;;;;mBAzRf,GAAG,CAAC,MAAM,CAAC;mBACX,MAAM,GAAG,IAAI;;QA7zBtB,qFAAqF;kBAC3E,WAAW,CAAC,CAAC,CAAC;gBAEhB,SAAS,CAAC,EAAE;gBACZ,CAAC,IAAI,EAAE,CAA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CAAC,CAAC;CAAG,GAAG,EAAE,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { CoarTreeDropPosition } from './tree-types';
|
|
2
|
+
declare const _default: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
3
|
+
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
|
|
4
|
+
readonly "onRow-click"?: ((node: T, ev: MouseEvent) => any) | undefined;
|
|
5
|
+
readonly "onRow-dblclick"?: ((node: T, ev: MouseEvent) => any) | undefined;
|
|
6
|
+
readonly "onRow-context-menu"?: ((node: T, ev: MouseEvent) => any) | undefined;
|
|
7
|
+
readonly "onRow-dragstart"?: ((node: T, ev: DragEvent) => any) | undefined;
|
|
8
|
+
readonly "onChevron-click"?: ((node: T) => any) | undefined;
|
|
9
|
+
readonly "onRow-dragend"?: ((node: T) => any) | undefined;
|
|
10
|
+
readonly "onRow-dragleave"?: ((node: T, ev: DragEvent) => any) | undefined;
|
|
11
|
+
readonly "onRow-dragover"?: ((node: T, el: HTMLElement, ev: DragEvent) => any) | undefined;
|
|
12
|
+
readonly "onRow-drop"?: ((node: T, el: HTMLElement, ev: DragEvent) => any) | undefined;
|
|
13
|
+
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onRow-click" | "onRow-dblclick" | "onRow-context-menu" | "onRow-dragstart" | "onChevron-click" | "onRow-dragend" | "onRow-dragleave" | "onRow-dragover" | "onRow-drop"> & {
|
|
14
|
+
node: T;
|
|
15
|
+
nodeId: string;
|
|
16
|
+
depth: number;
|
|
17
|
+
isExpandable: boolean;
|
|
18
|
+
isExpanded: boolean;
|
|
19
|
+
isSelected: boolean;
|
|
20
|
+
isFocused: boolean;
|
|
21
|
+
isRenaming: boolean;
|
|
22
|
+
draggable: boolean;
|
|
23
|
+
posInSet: number;
|
|
24
|
+
setSize: number;
|
|
25
|
+
/** Drop-position indicator when an internal drag is over this row. */
|
|
26
|
+
dropIndicator: CoarTreeDropPosition | null;
|
|
27
|
+
/** Whole-row highlight when an OS file drag is over this folder. */
|
|
28
|
+
fileDropActive: boolean;
|
|
29
|
+
} & Partial<{}>> & import('vue').PublicProps;
|
|
30
|
+
expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
|
|
31
|
+
attrs: any;
|
|
32
|
+
slots: {};
|
|
33
|
+
emit: {
|
|
34
|
+
(e: "row-click", node: T, ev: MouseEvent): void;
|
|
35
|
+
(e: "row-dblclick", node: T, ev: MouseEvent): void;
|
|
36
|
+
(e: "row-context-menu", node: T, ev: MouseEvent): void;
|
|
37
|
+
(e: "chevron-click", node: T): void;
|
|
38
|
+
(e: "row-dragstart", node: T, ev: DragEvent): void;
|
|
39
|
+
(e: "row-dragend", node: T): void;
|
|
40
|
+
(e: "row-dragover", node: T, el: HTMLElement, ev: DragEvent): void;
|
|
41
|
+
(e: "row-dragleave", node: T, ev: DragEvent): void;
|
|
42
|
+
(e: "row-drop", node: T, el: HTMLElement, ev: DragEvent): void;
|
|
43
|
+
};
|
|
44
|
+
}>) => import('vue').VNode & {
|
|
45
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
|
46
|
+
};
|
|
47
|
+
export default _default;
|
|
48
|
+
type __VLS_PrettifyLocal<T> = {
|
|
49
|
+
[K in keyof T]: T[K];
|
|
50
|
+
} & {};
|
|
51
|
+
//# sourceMappingURL=CoarTreeNode.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CoarTreeNode.vue.d.ts","sourceRoot":"","sources":["../../../src/components/tree/CoarTreeNode.vue"],"names":[],"mappings":"AAkOA,OAAO,EAGL,KAAK,oBAAoB,EAE1B,MAAM,cAAc,CAAC;yBAEL,CAAC,EACjB,aAA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AmB,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG,EAAE,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
/** What to render when not renaming — typically the node's name. */
|
|
3
|
+
label: string;
|
|
4
|
+
};
|
|
5
|
+
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
6
|
+
inputEl: HTMLInputElement;
|
|
7
|
+
}, any>;
|
|
8
|
+
export default _default;
|
|
9
|
+
//# sourceMappingURL=CoarTreeNodeLabel.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CoarTreeNodeLabel.vue.d.ts","sourceRoot":"","sources":["../../../src/components/tree/CoarTreeNodeLabel.vue"],"names":[],"mappings":"AAsHA,KAAK,WAAW,GAAG;IACjB,oEAAoE;IACpE,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;;;;AAyGF,wBAOG"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { default as CoarTree } from './CoarTree.vue';
|
|
2
|
+
export { default as CoarTreeNodeLabel } from './CoarTreeNodeLabel.vue';
|
|
3
|
+
export type { CoarTreeDropPosition, CoarTreeFilesDropEvent, CoarTreeNodeMoveEvent, CoarTreeNodeSlotProps, CoarTreeRenameContext, CoarTreeRenameEvent, CoarTreeMenuItem, CoarTreeMenuEntry, } from './tree-types';
|
|
4
|
+
export { COAR_TREE_DRAG_MIME, COAR_TREE_RENAME_KEY, COAR_TREE_ROW_ID_KEY } from './tree-types';
|
|
5
|
+
export { useTree } from './useTree';
|
|
6
|
+
export { TreeBuilder } from './tree-builder';
|
|
7
|
+
export type { TreeApi, TreeBuilderState } from './tree-builder';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/tree/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACvE,YAAY,EACV,oBAAoB,EACpB,sBAAsB,EACtB,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACrB,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAC/F,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,YAAY,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { MaybeRefOrGetter, Ref } from 'vue';
|
|
2
|
+
import { CoarTreeDropPosition, CoarTreeFilesDropEvent, CoarTreeMenuEntry, CoarTreeNodeMoveEvent, CoarTreeVirtualizeProp } from './tree-types';
|
|
3
|
+
/**
|
|
4
|
+
* Internal mutable state owned by the builder. Held as `shallowReactive` so
|
|
5
|
+
* mid-session mutations (e.g. `builder.draggable(true)` after mount) trigger
|
|
6
|
+
* the component to re-evaluate.
|
|
7
|
+
*/
|
|
8
|
+
export interface TreeBuilderState<T> {
|
|
9
|
+
nodes: MaybeRefOrGetter<readonly T[]>;
|
|
10
|
+
getId: (n: T) => string;
|
|
11
|
+
getChildren?: (n: T) => readonly T[] | null | undefined;
|
|
12
|
+
getLabel?: (n: T) => string;
|
|
13
|
+
isExpandable?: (n: T) => boolean;
|
|
14
|
+
draggable: MaybeRefOrGetter<boolean | ((n: T) => boolean)>;
|
|
15
|
+
canDrop?: (s: T, t: T | null, p: CoarTreeDropPosition) => boolean;
|
|
16
|
+
acceptsFiles: MaybeRefOrGetter<boolean>;
|
|
17
|
+
autoExpandDelay: MaybeRefOrGetter<number>;
|
|
18
|
+
virtualize: MaybeRefOrGetter<CoarTreeVirtualizeProp>;
|
|
19
|
+
expanded: Ref<Set<string>>;
|
|
20
|
+
selected: Ref<string | null>;
|
|
21
|
+
onActivate?: (node: T) => void;
|
|
22
|
+
onNodeMove?: (e: CoarTreeNodeMoveEvent<T>) => void;
|
|
23
|
+
onFilesDrop?: (e: CoarTreeFilesDropEvent<T>) => void;
|
|
24
|
+
/** Declarative menus — `<CoarTree>` renders the menu itself when these are set. */
|
|
25
|
+
folderMenu?: (folder: T) => readonly CoarTreeMenuEntry[];
|
|
26
|
+
leafMenu?: (leaf: T) => readonly CoarTreeMenuEntry[];
|
|
27
|
+
viewportMenu?: () => readonly CoarTreeMenuEntry[];
|
|
28
|
+
/** Event variants — escape hatch. If set, the declarative menu for the same target is bypassed. */
|
|
29
|
+
onFolderContextMenu?: (folder: T, ev: MouseEvent) => void;
|
|
30
|
+
onLeafContextMenu?: (leaf: T, ev: MouseEvent) => void;
|
|
31
|
+
onViewportContextMenu?: (ev: MouseEvent) => void;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Public, narrow imperative interface returned by `useTree().api`. Keeps
|
|
35
|
+
* component refs out of consumer code: you call `api.focusNode('x')` instead
|
|
36
|
+
* of digging into a template ref. Readonly refs (`selectedId`, `expandedIds`)
|
|
37
|
+
* mirror the builder state so consumers can `watch()` them without owning
|
|
38
|
+
* the writable refs themselves.
|
|
39
|
+
*/
|
|
40
|
+
export interface TreeApi {
|
|
41
|
+
/** Programmatically move focus + selection to a node. No-op until `<CoarTree>` is mounted. */
|
|
42
|
+
focusNode(id: string): void;
|
|
43
|
+
/** Selected node id (read-only). */
|
|
44
|
+
readonly selectedId: Ref<string | null>;
|
|
45
|
+
/** Currently expanded ids (read-only). */
|
|
46
|
+
readonly expandedIds: Ref<Set<string>>;
|
|
47
|
+
}
|
|
48
|
+
export declare class TreeBuilder<T> {
|
|
49
|
+
readonly state: TreeBuilderState<T>;
|
|
50
|
+
readonly api: TreeApi;
|
|
51
|
+
private _focusNodeImpl;
|
|
52
|
+
private constructor();
|
|
53
|
+
/** Factory — keeps construction sites consistent across call sites. */
|
|
54
|
+
static create<T>(): TreeBuilder<T>;
|
|
55
|
+
/** Root nodes. Accepts a `Ref`, getter, or plain array. */
|
|
56
|
+
nodes(source: MaybeRefOrGetter<readonly T[]>): this;
|
|
57
|
+
getId(fn: (n: T) => string): this;
|
|
58
|
+
getChildren(fn: (n: T) => readonly T[] | null | undefined): this;
|
|
59
|
+
/** Label extractor — used by type-ahead keyboard navigation. */
|
|
60
|
+
getLabel(fn: (n: T) => string): this;
|
|
61
|
+
/**
|
|
62
|
+
* Override the default "branch if `getChildren` returns an array" rule.
|
|
63
|
+
* Useful for lazy-loaded folders that should render as expandable even
|
|
64
|
+
* before their children are fetched.
|
|
65
|
+
*/
|
|
66
|
+
isExpandable(fn: (n: T) => boolean): this;
|
|
67
|
+
/** Enable internal drag-to-reorder. Accepts a per-node predicate. */
|
|
68
|
+
draggable(d: MaybeRefOrGetter<boolean | ((n: T) => boolean)>): this;
|
|
69
|
+
canDrop(fn: (source: T, target: T | null, position: CoarTreeDropPosition) => boolean): this;
|
|
70
|
+
acceptsFiles(b: MaybeRefOrGetter<boolean>): this;
|
|
71
|
+
autoExpandDelay(ms: MaybeRefOrGetter<number>): this;
|
|
72
|
+
/**
|
|
73
|
+
* Enable virtualization. Pass `true` for defaults (itemSize: 28, overscan: 5)
|
|
74
|
+
* or an object for custom row height / overscan. Required for trees with
|
|
75
|
+
* hundreds+ of visible rows; pure overhead for small trees.
|
|
76
|
+
*
|
|
77
|
+
* When virtualized, the tree owns its scroll container — give it an explicit
|
|
78
|
+
* height (or put it in a sized flex/grid cell) so the viewport is measurable.
|
|
79
|
+
*/
|
|
80
|
+
virtualize(v: MaybeRefOrGetter<CoarTreeVirtualizeProp>): this;
|
|
81
|
+
/**
|
|
82
|
+
* Bind the set of expanded folder ids. Must be a writable `Ref` — `api`
|
|
83
|
+
* and folder toggles need to write back. Getters are rejected at runtime
|
|
84
|
+
* because they would silently lose writes.
|
|
85
|
+
*/
|
|
86
|
+
expanded(r: Ref<Set<string>>): this;
|
|
87
|
+
/** Bind the selected-node id. Must be a writable `Ref<string | null>`. */
|
|
88
|
+
selected(r: Ref<string | null>): this;
|
|
89
|
+
/** Fires on double-click or Enter on the focused row. */
|
|
90
|
+
onActivate(h: (node: T) => void): this;
|
|
91
|
+
/** Fires after an internal drag-drop completes. The consumer mutates the tree. */
|
|
92
|
+
onNodeMove(h: (e: CoarTreeNodeMoveEvent<T>) => void): this;
|
|
93
|
+
/** Fires when OS files are dropped onto a folder or the empty background. */
|
|
94
|
+
onFilesDrop(h: (e: CoarTreeFilesDropEvent<T>) => void): this;
|
|
95
|
+
/**
|
|
96
|
+
* Items shown when right-clicking a folder row. When set (and the
|
|
97
|
+
* `onFolderContextMenu` escape hatch is NOT set), `<CoarTree>` renders a
|
|
98
|
+
* `<CoarContextMenu>` itself — no extra markup needed in your template.
|
|
99
|
+
*
|
|
100
|
+
* Pass an array of `{ label, icon?, danger?, disabled?, onClick }` entries
|
|
101
|
+
* or the literal string `'divider'`.
|
|
102
|
+
*/
|
|
103
|
+
folderMenu(fn: (folder: T) => readonly CoarTreeMenuEntry[]): this;
|
|
104
|
+
/** Same as {@link folderMenu} but for leaf (non-folder) nodes. */
|
|
105
|
+
leafMenu(fn: (leaf: T) => readonly CoarTreeMenuEntry[]): this;
|
|
106
|
+
/**
|
|
107
|
+
* Items shown when right-clicking the empty background of the tree pane.
|
|
108
|
+
* No node argument — there isn't one.
|
|
109
|
+
*/
|
|
110
|
+
viewportMenu(fn: () => readonly CoarTreeMenuEntry[]): this;
|
|
111
|
+
/**
|
|
112
|
+
* Raw `contextmenu` event for folder rows. Overrides {@link folderMenu} —
|
|
113
|
+
* use when you want a fully custom popover (e.g. with form inputs, async
|
|
114
|
+
* sub-menus, or a third-party menu library).
|
|
115
|
+
*/
|
|
116
|
+
onFolderContextMenu(h: (folder: T, ev: MouseEvent) => void): this;
|
|
117
|
+
/** Same as {@link onFolderContextMenu} for leaf rows. Overrides {@link leafMenu}. */
|
|
118
|
+
onLeafContextMenu(h: (leaf: T, ev: MouseEvent) => void): this;
|
|
119
|
+
/** Same as {@link onFolderContextMenu} for the empty background. Overrides {@link viewportMenu}. */
|
|
120
|
+
onViewportContextMenu(h: (ev: MouseEvent) => void): this;
|
|
121
|
+
/** @internal — `<CoarTree>` registers its focus impl on mount. */
|
|
122
|
+
_setFocusNodeImpl(fn: ((id: string) => void) | null): void;
|
|
123
|
+
}
|
|
124
|
+
//# sourceMappingURL=tree-builder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tree-builder.d.ts","sourceRoot":"","sources":["../../../src/components/tree/tree-builder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,GAAG,EAIT,MAAM,KAAK,CAAC;AACb,OAAO,KAAK,EACV,oBAAoB,EACpB,sBAAsB,EACtB,iBAAiB,EACjB,qBAAqB,EACrB,sBAAsB,EACvB,MAAM,cAAc,CAAC;AAEtB;;;;GAIG;AACH,MAAM,WAAW,gBAAgB,CAAC,CAAC;IACjC,KAAK,EAAE,gBAAgB,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;IACtC,KAAK,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,SAAS,CAAC,EAAE,GAAG,IAAI,GAAG,SAAS,CAAC;IACxD,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,MA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,SAAS,iBAAiB,EAAE,GAAG,IAAI;IAO1D;;;;OAIG;IACH,mBAAmB,CAAC,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,EAAE,UAAU,KAAK,IAAI,GAAG,IAAI;IAKjE,qFAAqF;IACrF,iBAAiB,CAAC,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,UAAU,KAAK,IAAI,GAAG,IAAI;IAK7D,oGAAoG;IACpG,qBAAqB,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,UAAU,KAAK,IAAI,GAAG,IAAI;IAOxD,kEAAkE;IAClE,iBAAiB,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,IAAI,GAAG,IAAI;CAG3D"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { CoarTreeDropPosition } from './tree-types';
|
|
2
|
+
/**
|
|
3
|
+
* Compute where a drop should land relative to a row given the cursor's Y
|
|
4
|
+
* position within that row's bounding box.
|
|
5
|
+
*
|
|
6
|
+
* Default thresholds:
|
|
7
|
+
* - Top 25% of the row → `'before'`
|
|
8
|
+
* - Bottom 25% of the row → `'after'`
|
|
9
|
+
* - Middle 50% → `'inside'` (only if the target is expandable; otherwise
|
|
10
|
+
* clamped to whichever band is closer)
|
|
11
|
+
*
|
|
12
|
+
* For leaf nodes the `'inside'` band is suppressed because dropping into a
|
|
13
|
+
* leaf doesn't make sense. We split the row 50/50 between before/after in
|
|
14
|
+
* that case so the user never gets a "dead zone".
|
|
15
|
+
*/
|
|
16
|
+
export declare function computeDropPosition(event: {
|
|
17
|
+
clientY: number;
|
|
18
|
+
}, rect: {
|
|
19
|
+
top: number;
|
|
20
|
+
height: number;
|
|
21
|
+
}, opts: {
|
|
22
|
+
expandable: boolean;
|
|
23
|
+
}): CoarTreeDropPosition;
|
|
24
|
+
/**
|
|
25
|
+
* Detect whether a DataTransfer represents a drag of OS files (vs. an internal
|
|
26
|
+
* tree-node drag). `types` is the only DataTransfer field reliably readable
|
|
27
|
+
* during `dragover` — `getData()` returns an empty string on most browsers
|
|
28
|
+
* until `drop` for security reasons.
|
|
29
|
+
*/
|
|
30
|
+
export declare function isFileDrag(dt: DataTransfer | null): boolean;
|
|
31
|
+
//# sourceMappingURL=tree-dnd.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tree-dnd.d.ts","sourceRoot":"","sources":["../../../src/components/tree/tree-dnd.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAEzD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,EAC1B,IAAI,EAAE;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,EACrC,IAAI,EAAE;IAAE,UAAU,EAAE,OAAO,CAAA;CAAE,GAC5B,oBAAoB,CAWtB;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,EAAE,EAAE,YAAY,GAAG,IAAI,GAAG,OAAO,CAE3D"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { InjectionKey, Ref, Slot } from 'vue';
|
|
2
|
+
/**
|
|
3
|
+
* Public types for `<CoarTree>`.
|
|
4
|
+
*
|
|
5
|
+
* The tree is generic over the consumer's node type `T` — identity, children and
|
|
6
|
+
* label are extracted via prop functions rather than imposed by a fixed shape.
|
|
7
|
+
* This lets the same tree render file systems, navigation hierarchies, settings
|
|
8
|
+
* trees, org charts, etc. without forcing a common base type.
|
|
9
|
+
*/
|
|
10
|
+
/** Where a drop lands relative to a target node. */
|
|
11
|
+
export type CoarTreeDropPosition = 'before' | 'inside' | 'after';
|
|
12
|
+
/** Payload for {@link CoarTreeEmits.node-move}. */
|
|
13
|
+
export interface CoarTreeNodeMoveEvent<T> {
|
|
14
|
+
/** Node being moved. */
|
|
15
|
+
source: T;
|
|
16
|
+
/**
|
|
17
|
+
* Sibling / parent the drop is relative to. `null` means the drop landed on
|
|
18
|
+
* the empty tree-pane background — typically interpreted as "move to root".
|
|
19
|
+
*/
|
|
20
|
+
target: T | null;
|
|
21
|
+
/** Where the drop landed relative to `target`. With `target: null` only `'inside'` is meaningful. */
|
|
22
|
+
position: CoarTreeDropPosition;
|
|
23
|
+
}
|
|
24
|
+
/** Payload for {@link CoarTreeEmits.files-drop}. */
|
|
25
|
+
export interface CoarTreeFilesDropEvent<T> {
|
|
26
|
+
/** Files from the OS drag-drop. */
|
|
27
|
+
files: FileList;
|
|
28
|
+
/** Folder the drop landed on, or `null` for the tree background (root). */
|
|
29
|
+
target: T | null;
|
|
30
|
+
}
|
|
31
|
+
/** Context exposed to the default slot for rendering a row body. */
|
|
32
|
+
export interface CoarTreeNodeSlotProps<T> {
|
|
33
|
+
node: T;
|
|
34
|
+
/** Nesting depth — 0 for root nodes. */
|
|
35
|
+
depth: number;
|
|
36
|
+
isExpanded: boolean;
|
|
37
|
+
isSelected: boolean;
|
|
38
|
+
isFocused: boolean;
|
|
39
|
+
isExpandable: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* True while THIS row is in inline-rename mode (only meaningful when
|
|
42
|
+
* `<CoarTree :renamable>` is on). Useful for hiding hover-actions etc.
|
|
43
|
+
* while the user is typing the new name.
|
|
44
|
+
*/
|
|
45
|
+
isRenaming: boolean;
|
|
46
|
+
}
|
|
47
|
+
/** Payload for {@link CoarTreeEmits.rename}. */
|
|
48
|
+
export interface CoarTreeRenameEvent<T> {
|
|
49
|
+
node: T;
|
|
50
|
+
newName: string;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Custom MIME type used to encode an internal node drag in `DataTransfer`.
|
|
54
|
+
* Lets `dragover` distinguish internal moves from OS-file drags without
|
|
55
|
+
* relying on `getData()` (which is unavailable during dragover).
|
|
56
|
+
*/
|
|
57
|
+
export declare const COAR_TREE_DRAG_MIME = "application/x-coar-tree-node";
|
|
58
|
+
/**
|
|
59
|
+
* Internal injection key — `<CoarTree>` provides its row-rendering slot here so
|
|
60
|
+
* the recursive `<CoarTreeNode>` can render it without passing the slot down
|
|
61
|
+
* through prop drilling (Vue's `Slot<T>` type doesn't compose cleanly with
|
|
62
|
+
* `defineSlots`-typed slots in generic components).
|
|
63
|
+
*/
|
|
64
|
+
export declare const COAR_TREE_NODE_SLOT_KEY: InjectionKey<Slot<CoarTreeNodeSlotProps<any>>>;
|
|
65
|
+
/**
|
|
66
|
+
* Internal injection key — `<CoarTreeNode>` provides its row id so
|
|
67
|
+
* `<CoarTreeNodeLabel>` (and any future row-scoped helper) can read it
|
|
68
|
+
* without explicit prop wiring from the consumer.
|
|
69
|
+
*/
|
|
70
|
+
export declare const COAR_TREE_ROW_ID_KEY: InjectionKey<string>;
|
|
71
|
+
/**
|
|
72
|
+
* The rename machinery `<CoarTree :renamable>` provides to descendants.
|
|
73
|
+
* `<CoarTreeNodeLabel>` consumes this; consumers normally never see it
|
|
74
|
+
* directly — they just drop `<CoarTreeNodeLabel :node :label>` into the
|
|
75
|
+
* default slot.
|
|
76
|
+
*/
|
|
77
|
+
export interface CoarTreeRenameContext {
|
|
78
|
+
/** Id of the row currently in rename mode, or `null` if none. */
|
|
79
|
+
readonly renamingId: Readonly<Ref<string | null>>;
|
|
80
|
+
/** Two-way buffer for the input — `v-model` it on the rename input. */
|
|
81
|
+
readonly buffer: Ref<string>;
|
|
82
|
+
/** Commit the current buffer. Tree emits `@rename` then clears state. */
|
|
83
|
+
commit: () => void;
|
|
84
|
+
/** Drop the buffer, leave the original name as-is. */
|
|
85
|
+
cancel: () => void;
|
|
86
|
+
/** Wired to the rename input's `@focus`. Starts the blur grace timer. */
|
|
87
|
+
onFocus: () => void;
|
|
88
|
+
/** Wired to the rename input's `@blur`. Commits after the grace period. */
|
|
89
|
+
onBlur: () => void;
|
|
90
|
+
}
|
|
91
|
+
export declare const COAR_TREE_RENAME_KEY: InjectionKey<CoarTreeRenameContext>;
|
|
92
|
+
/**
|
|
93
|
+
* One entry in a builder-driven context menu. `'divider'` is the only string
|
|
94
|
+
* literal allowed — everything else is an object with `label` + `onClick`.
|
|
95
|
+
*/
|
|
96
|
+
export type CoarTreeMenuEntry = CoarTreeMenuItem | 'divider';
|
|
97
|
+
/**
|
|
98
|
+
* Options for `<CoarTree :virtualize>` / `builder.virtualize(...)`.
|
|
99
|
+
*
|
|
100
|
+
* `useVirtualList` is a *fixed-known-size* virtualizer (no DOM auto-measure),
|
|
101
|
+
* so the consumer must declare row heights up front. The default of 28px
|
|
102
|
+
* matches the standard row layout (13px text + 6px vertical padding); change
|
|
103
|
+
* `itemSize` to match if the slot adds extra padding or multi-line content.
|
|
104
|
+
*/
|
|
105
|
+
export interface CoarTreeVirtualOptions {
|
|
106
|
+
/**
|
|
107
|
+
* Row height in pixels. Either a constant, or a function returning the
|
|
108
|
+
* height for the visible-row at the given index. Default: 28.
|
|
109
|
+
*/
|
|
110
|
+
itemSize?: number | ((index: number) => number);
|
|
111
|
+
/** Rows rendered above/below the viewport as a scroll buffer. Default: 5. */
|
|
112
|
+
overscan?: number;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Prop shorthand: pass `true` to enable virtualization with defaults, an
|
|
116
|
+
* object to customize, or omit / `false` to disable.
|
|
117
|
+
*/
|
|
118
|
+
export type CoarTreeVirtualizeProp = boolean | CoarTreeVirtualOptions;
|
|
119
|
+
export interface CoarTreeMenuItem {
|
|
120
|
+
/** Visible label. Required (use `disabled: true` if the item is a placeholder). */
|
|
121
|
+
label: string;
|
|
122
|
+
/** Optional icon name — passed through to `<CoarMenuItem :icon>`. */
|
|
123
|
+
icon?: string;
|
|
124
|
+
/** Marks the item as destructive (red text on hover). */
|
|
125
|
+
danger?: boolean;
|
|
126
|
+
/** Grays the item out and disables clicks. */
|
|
127
|
+
disabled?: boolean;
|
|
128
|
+
/** Invoked on click. The tree closes the menu automatically afterwards. */
|
|
129
|
+
onClick: () => void;
|
|
130
|
+
}
|
|
131
|
+
//# sourceMappingURL=tree-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tree-types.d.ts","sourceRoot":"","sources":["../../../src/components/tree/tree-types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,oDAAoD;AACpD,MAAM,MAAM,oBAAoB,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEjE,mDAAmD;AACnD,MAAM,WAAW,qBAAqB,CAAC,CAAC;IACtC,wBAAwB;IACxB,MAAM,EAAE,CAAC,CAAC;IACV;;;OAGG;IACH,MAAM,EAAE,CAAC,GAAG,IAAI,CAAC;IACjB,qGAAqG;IACrG,QAAQ,EAAE,oBAAoB,CAAC;CAChC;AAED,oDAAoD;AACpD,MAAM,WAAW,sBAAsB,CAAC,CAAC;IACvC,mCAAmC;IACnC,KAAK,EAAE,QAAQ,CAAC;IAChB,2EAA2E;IAC3E,MAAM,EAAE,CAAC,GAAG,IAAI,CAAC;CAClB;AAED,oEAAoE;AACpE,MAAM,WAAW,qBAAqB,CAAC,CAAC;IACtC,IAAI,EAAE,CAAC,CAAC;IACR,wCAAwC;IACxC,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,YAAY,EAAE,OAAO,CAAC;IACtB;;;;OAIG;IACH,UAAU,EAAE,OAAO,CAAC;CACrB;AAED,gDAAgD;AAChD,MAAM,WAAW,mBAAmB,CAAC,CAAC;IACpC,IAAI,EAAE,CAAC,CAAC;IACR,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,iCAAiC,CAAC;AAElE,OAAO,KAAK,EAAE,YAAY,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAEnD;;;;;GAKG;AAEH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