();
}
list.map(c => c.heading).indexOf(this._fieldKey) === -1 && list.push(new SchemaHeaderField(this._fieldKey, '#f1efeb'));
list.map(c => c.heading).indexOf('text') === -1 && list.push(new SchemaHeaderField('text', '#f1efeb'));
alias._pivotField = this._fieldKey.startsWith('#') ? '#' : this._fieldKey;
this.props.tbox.props.addDocTab(alias, OpenWhere.addRight);
}
};
// clicking on the label creates a pivot view collection of all documents
// in the same collection. The pivot field is the fieldKey of this label
onPointerDownLabelSpan = (e: any) => {
setupMoveUpEvents(this, e, returnFalse, returnFalse, e => {
DashFieldViewMenu.createFieldView = this.createPivotForField;
DashFieldViewMenu.Instance.show(e.clientX, e.clientY + 16, this._fieldKey);
});
};
render() {
return (
{this.props.hideKey ? null : (
{this._fieldKey}
)}
{this.props.fieldKey.startsWith('#') ? null : this.fieldValueContent}
);
}
}
@observer
export class DashFieldViewMenu extends AntimodeMenu {
static Instance: DashFieldViewMenu;
static createFieldView: (e: React.MouseEvent) => void = emptyFunction;
constructor(props: any) {
super(props);
DashFieldViewMenu.Instance = this;
}
@action
showFields = (e: React.MouseEvent) => {
DashFieldViewMenu.createFieldView(e);
DashFieldViewMenu.Instance.fadeOut(true);
};
@observable _fieldKey = '';
@action
public show = (x: number, y: number, fieldKey: string) => {
this._fieldKey = fieldKey;
this.jumpTo(x, y, true);
const hideMenu = () => {
this.fadeOut(true);
document.removeEventListener('pointerdown', hideMenu, true);
};
document.addEventListener('pointerdown', hideMenu, true);
};
render() {
return this.getElement(
{`Show Pivot Viewer for '${this._fieldKey}'`}}>
);
}
}