mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-14 18:01:06 +00:00
fix(tree-view): loosen TreeNode
text property type to any (#1576)
* fix(tree-view): loosen `TreeNode` text property type to any * Run "yarn build:docs" * test(tree-view): assert updated property type value
This commit is contained in:
parent
21d841feeb
commit
198e0da4c5
5 changed files with 8 additions and 7 deletions
|
@ -4654,7 +4654,7 @@ export type TreeNodeId = string | number;
|
|||
|
||||
export interface TreeNode {
|
||||
id: TreeNodeId;
|
||||
text: string;
|
||||
text: any;
|
||||
icon?: typeof import("svelte").SvelteComponent;
|
||||
disabled?: boolean;
|
||||
expanded?: boolean;
|
||||
|
|
|
@ -14483,9 +14483,9 @@
|
|||
"ts": "type TreeNodeId = string | number"
|
||||
},
|
||||
{
|
||||
"type": "{ id: TreeNodeId; text: string; icon?: typeof import(\"svelte\").SvelteComponent; disabled?: boolean; expanded?: boolean; children?: TreeNode[]; }",
|
||||
"type": "{ id: TreeNodeId; text: any; icon?: typeof import(\"svelte\").SvelteComponent; disabled?: boolean; expanded?: boolean; children?: TreeNode[]; }",
|
||||
"name": "TreeNode",
|
||||
"ts": "interface TreeNode { id: TreeNodeId; text: string; icon?: typeof import(\"svelte\").SvelteComponent; disabled?: boolean; expanded?: boolean; children?: TreeNode[]; }"
|
||||
"ts": "interface TreeNode { id: TreeNodeId; text: any; icon?: typeof import(\"svelte\").SvelteComponent; disabled?: boolean; expanded?: boolean; children?: TreeNode[]; }"
|
||||
}
|
||||
],
|
||||
"rest_props": { "type": "Element", "name": "ul" }
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<script>
|
||||
/**
|
||||
* @typedef {string | number} TreeNodeId
|
||||
* @typedef {{ id: TreeNodeId; text: string; icon?: typeof import("svelte").SvelteComponent; disabled?: boolean; expanded?: boolean; children?: TreeNode[]; }} TreeNode
|
||||
* @typedef {{ id: TreeNodeId; text: any; icon?: typeof import("svelte").SvelteComponent; disabled?: boolean; expanded?: boolean; children?: TreeNode[]; }} TreeNode
|
||||
* @event {TreeNode & { expanded: boolean; leaf: boolean; }} select
|
||||
* @event {TreeNode & { expanded: boolean; leaf: boolean; }} toggle
|
||||
* @event {TreeNode & { expanded: boolean; leaf: boolean; }} focus
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<script lang="ts">
|
||||
import type { ComponentProps } from "svelte";
|
||||
import { TreeView } from "../types";
|
||||
import type { TreeNodeId } from "../types/TreeView/TreeView.svelte";
|
||||
import Analytics from "carbon-icons-svelte/lib/Analytics.svelte";
|
||||
|
@ -7,11 +8,11 @@
|
|||
let activeId: TreeNodeId = "";
|
||||
let selectedIds = [];
|
||||
let expandedIds = [1];
|
||||
let children = [
|
||||
let children: ComponentProps<TreeView>["children"] = [
|
||||
{ id: 0, text: "AI / Machine learning", icon: Analytics },
|
||||
{
|
||||
id: 1,
|
||||
text: "Analytics",
|
||||
text: 0,
|
||||
children: [
|
||||
{
|
||||
id: 2,
|
||||
|
|
2
types/TreeView/TreeView.svelte.d.ts
vendored
2
types/TreeView/TreeView.svelte.d.ts
vendored
|
@ -5,7 +5,7 @@ export type TreeNodeId = string | number;
|
|||
|
||||
export interface TreeNode {
|
||||
id: TreeNodeId;
|
||||
text: string;
|
||||
text: any;
|
||||
icon?: typeof import("svelte").SvelteComponent;
|
||||
disabled?: boolean;
|
||||
expanded?: boolean;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue