Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(overlay-menu): missing nested items property #984

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion documents/src/pages/utils/data-management.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ interface CollectionItem {
/**
* Child items collection.
* Used for nested data structures.
* Override this property in sub interfaces with their own type to ensure nested type checking.
* For example, `MyCollectionItem extends CollectionItem { items?: MyCollectionItem[]; }`
*/
items?: this[];
items?: CollectionItem[];
}
```

Expand Down Expand Up @@ -74,6 +76,11 @@ interface DataItem extends CollectionItem {
* item from being interacted with.
*/
disabled?: boolean;

/**
* Used for nested DataItem.
*/
items?: DataItem[];
}
```

Expand Down
4 changes: 4 additions & 0 deletions packages/elements/src/item/helpers/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ interface CommonItem extends DataItem {
* Type of item. Value can be `text`, `header`, `divider`
*/
type?: ItemType;
/**
* Used for nested ItemData.
*/
items?: ItemData[];
}

interface CommonLabelItem extends CommonItem {
Expand Down
5 changes: 5 additions & 0 deletions packages/elements/src/tree/helpers/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ export interface TreeDataItem extends DataItem {
* If `true`, child items will be visible
*/
expanded?: boolean;

/**
* Used for nested TreeDataItem.
*/
items?: TreeDataItem[];
}

/**
Expand Down
4 changes: 3 additions & 1 deletion packages/utils/src/collection/collection-item.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ export interface CollectionItem {
/**
* Child items collection.
* Used for nested data structures.
* Override this property in sub interfaces with their own type to ensure nested type checking.
* For example, `MyCollectionItem extends CollectionItem { items?: MyCollectionItem[]; }`
*/
items?: this[];
items?: CollectionItem[];
}
5 changes: 5 additions & 0 deletions packages/utils/src/collection/data-item.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,9 @@ export interface DataItem extends CollectionItem {
* item from being interacted with.
*/
disabled?: boolean;

/**
* Used for nested DataItem.
*/
items?: DataItem[];
}
Loading