const ZBX_STYLE_WIDGET_PLACEHOLDER = 'dashboard-widget-placeholder';
const ZBX_STYLE_WIDGET_PLACEHOLDER_BOX = 'dashboard-widget-placeholder-box';
const ZBX_STYLE_WIDGET_PLACEHOLDER_LABEL = 'dashboard-widget-placeholder-label';
const ZBX_STYLE_WIDGET_PLACEHOLDER_RESIZING = 'dashboard-widget-placeholder-resizing';
const ZBX_STYLE_WIDGET_PLACEHOLDER_HIDDEN = 'hidden';
const WIDGET_PLACEHOLDER_STATE_ADD_NEW = 0;
const WIDGET_PLACEHOLDER_STATE_RESIZING = 1;
const WIDGET_PLACEHOLDER_STATE_POSITIONING = 2;
const WIDGET_PLACEHOLDER_EVENT_ADD_NEW_WIDGET = 'widget-placeholder-add-new-widget';
class CDashboardWidgetPlaceholder extends CBaseComponent {
constructor(cell_width, cell_height) {
super(document.createElement('div'));
this._cell_width = cell_width;
this._cell_height = cell_height;
this._target.classList.add(ZBX_STYLE_WIDGET_PLACEHOLDER);
this._placeholder_box = document.createElement('div');
this._placeholder_box.classList.add(ZBX_STYLE_WIDGET_PLACEHOLDER_BOX);
this._placeholder_box_label = document.createElement('div');
this._placeholder_box_label.classList.add(ZBX_STYLE_WIDGET_PLACEHOLDER_LABEL);
this._placeholder_box_label_wrap = document.createElement('div');
this._placeholder_box_label.appendChild(this._placeholder_box_label_wrap);
this._placeholder_box.appendChild(this._placeholder_box_label);
this._target.appendChild(this._placeholder_box);
this.setState(WIDGET_PLACEHOLDER_STATE_ADD_NEW);
}
getNode() {
return this._target;
}
setState(state) {
this._target.classList.add(ZBX_STYLE_WIDGET_PLACEHOLDER_HIDDEN);
this._target.classList.remove('disabled');
this._placeholder_box.classList.remove(ZBX_STYLE_WIDGET_PLACEHOLDER_RESIZING);
this._placeholder_box_label_wrap.textContent = '';
switch (state) {
case WIDGET_PLACEHOLDER_STATE_ADD_NEW: