-
Notifications
You must be signed in to change notification settings - Fork 2
/
CustomItemDef.tsx
37 lines (31 loc) · 1.13 KB
/
CustomItemDef.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
/** @packageDocumentation
* @module Item
*/
import type * as React from "react";
import { ActionButtonItemDef } from "./ActionButtonItemDef";
import type { CustomItemProps } from "./CustomItemProps";
/** An Item that renders a React component.
* @public
*/
export class CustomItemDef extends ActionButtonItemDef {
private static _sId = 0;
public static customIdPrefix = "Custom-";
public customId: string;
public popupPanelNode?: React.ReactNode;
constructor(props: CustomItemProps) {
super(props);
if (props.customId) this.customId = props.customId;
else {
CustomItemDef._sId++;
this.customId = CustomItemDef.customIdPrefix + CustomItemDef._sId;
}
this.popupPanelNode = props.popupPanelNode;
}
public get id(): string {
return this.customId;
}
}