Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 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 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | 93x 93x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x | import { ComponentRender } from '../zd-component/component-render';
import { IComponentRender } from '../zd-component/interfaces';
import { IDropdown } from './interfaces';
/**
* Base class for Dropdown component.
*/
export class Dropdown extends ComponentRender implements IDropdown {
/**
* Applies position absolute to the dropdown.
*/
public absolute = false;
/**
* Designate to put the component that activates the menu.
*/
public activator!: IComponentRender;
/**
* Designates if menu should close when its content is clicked.
*/
public closeOnContentClick = true;
/**
* Designates if menu should close on outside-activator click.
*/
public closeOnClick = true;
/**
* Applies a cursor to the dropdown.
*/
public cursor = '';
/**
* Disables the menu.
*/
public disabled = false;
/**
* Applies hover to the dropdown.
*/
public hover = false;
/**
* Sets the height for the dropdown.
*/
public height?: number | string = 'auto';
/**
* Sets the maximum height for the dropdown.
*/
public maxHeight: number | string = 'none';
/**
* Sets the maximum width for the dropdown.
*/
public maxWidth: number | string = 'none';
/**
* Sets the minimum height for the dropdown.
*/
public minHeight: number | string = 'auto';
/**
* Sets the minimum width for the dropdown.
*/
public minWidth: number | string = 'auto';
/**
* Offset the menu on the x-axis.
*/
public offsetX = false;
/**
* Offset the menu on the x-axis.
*/
public offsetY = false;
/**
* Designates whether menu should open on activator click.
*/
public openOnClick = true;
/**
* Designates whether menu should open on activator hover.
*/
public openOnHover = false;
/**
* Controls whether the component is visible or hidden.
*/
public value?: any;
/* istanbul ignore next */
/**
* Creates a new DropDown.
* @param props DropDown properties
*/
constructor(props: IDropdown) {
super(props);
this.absolute = this.getInitValue('absolute', props.absolute, this.absolute);
this.activator = this.getInitValue('activator', props.activator, this.activator);
this.children = this.getInitValue('children', props.children, this.children);
this.cursor = this.getInitValue('cursor', props.cursor, this.cursor);
this.closeOnContentClick = this.getInitValue(
'closeOnContentClick',
props.closeOnContentClick,
this.closeOnContentClick,
);
this.closeOnClick = this.getInitValue('closeOnClick', props.closeOnClick, this.closeOnClick);
this.disabled = this.getInitValue('disabled', props.disabled, this.disabled);
this.hover = this.getInitValue('hover', props.hover, this.hover);
this.height = this.getInitValue('height', props.height, this.height);
this.maxHeight = this.getInitValue('maxHeight', props.maxHeight, this.maxHeight);
this.minHeight = this.getInitValue('minHeight', props.minHeight, this.minHeight);
this.maxWidth = this.getInitValue('maxWidth', props.maxWidth, this.maxWidth);
this.minWidth = this.getInitValue('minWidth', props.minWidth, this.minWidth);
this.offsetX = this.getInitValue('offsetX', props.offsetX, this.offsetX);
this.offsetY = this.getInitValue('offsetY', props.offsetY, this.offsetY);
this.openOnClick = this.getInitValue('openOnClick', props.openOnClick, this.openOnClick);
this.openOnHover = this.getInitValue('openOnHover', props.openOnHover, this.openOnHover);
this.value = this.getInitValue('value', props.value, this.value);
this.createAccessors();
}
}
|