|
@@ -6,8 +6,14 @@ interface ICommandDropdownComponentProps {
|
|
|
globalState: GlobalState;
|
|
|
icon: string;
|
|
|
tooltip: string;
|
|
|
- items: {label: string, onClick?: () => void, onCheck?: (value: boolean) => void, storeKey?: string,
|
|
|
- defaultValue?: boolean;}[]
|
|
|
+ items: {
|
|
|
+ label: string,
|
|
|
+ onClick?: () => void,
|
|
|
+ onCheck?: (value: boolean) => void,
|
|
|
+ storeKey?: string,
|
|
|
+ defaultValue?: boolean | string;
|
|
|
+ subItems?: string[];
|
|
|
+ }[];
|
|
|
}
|
|
|
|
|
|
export class CommandDropdownComponent extends React.Component<ICommandDropdownComponentProps, {isExpanded: boolean}> {
|
|
@@ -38,7 +44,7 @@ export class CommandDropdownComponent extends React.Component<ICommandDropdownCo
|
|
|
return (
|
|
|
<div className="command-dropdown-label" key={m.label} onClick={() => {
|
|
|
if (! m.onClick) {
|
|
|
- let newValue = !Utilities.ReadBoolFromStore(m.storeKey!, m.defaultValue || false);
|
|
|
+ let newValue = !Utilities.ReadBoolFromStore(m.storeKey!, (m.defaultValue as boolean) || false);
|
|
|
Utilities.StoreBoolFromStore(m.storeKey!, newValue);
|
|
|
this.forceUpdate();
|
|
|
m.onCheck!(newValue);
|
|
@@ -58,7 +64,21 @@ export class CommandDropdownComponent extends React.Component<ICommandDropdownCo
|
|
|
this.forceUpdate();
|
|
|
m.onCheck!(evt.target.checked);
|
|
|
}}
|
|
|
- checked={Utilities.ReadBoolFromStore(m.storeKey!, m.defaultValue || false)}/>
|
|
|
+ checked={Utilities.ReadBoolFromStore(m.storeKey!, (m.defaultValue as boolean) || false)}/>
|
|
|
+ }
|
|
|
+ {
|
|
|
+ m.subItems &&
|
|
|
+ <div className={"sub-items " + (this.props.globalState.language === "JS" ? "background-js" : "background-ts")}>
|
|
|
+ {
|
|
|
+ m.subItems.map(s => {
|
|
|
+ return (
|
|
|
+ <div key={s} className="sub-item">
|
|
|
+ {s}
|
|
|
+ </div>
|
|
|
+ )
|
|
|
+ })
|
|
|
+ }
|
|
|
+ </div>
|
|
|
}
|
|
|
</div>
|
|
|
)
|