Skip to content

Commit

Permalink
fix(overlay-menu): missing nested items property (#982)
Browse files Browse the repository at this point in the history
* fix(overlay-menu): missing nested items property

Co-authored-by: wattachai <117723407+wattachai-lseg@users.noreply.github.com>

---------

Co-authored-by: Theeraphat-Sorasetsakul <86758473+Theeraphat-Sorasetsakul@users.noreply.github.com>
  • Loading branch information
1 parent e06ba68 commit bac94cb
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 2 deletions.
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[];
}

0 comments on commit bac94cb

Please sign in to comment.