UNPKG

lml-main

Version:

This is now a mono repository published into many standalone packages.

48 lines 3.5 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const React = require("react"); const react_redux_1 = require("react-redux"); const cosmoui_1 = require("cosmoui"); const components_1 = require("../../../common/components"); const constants_1 = require("../../constants"); class JobLabelTableRowComponent extends cosmoui_1.HoverableComponent { constructor() { super(...arguments); this.cellStyle = { verticalAlign: 'middle' }; this.actionsCellStyle = Object.assign({}, this.cellStyle, { textAlign: 'right', minWidth: '60px' }); this.showEditLabelForm = () => { const { jobLabel } = this.props; this.props.openDrawer(constants_1.JOB_LABEL_FORM_DRAWER_KEY, { jobLabel: jobLabel.label }); }; this.showDeleteConfirmation = () => { const { jobLabel } = this.props; this.props.openModal(constants_1.JOB_LABEL_DELETE_MODAL, { jobLabel }); }; this.isItOn = (value) => value ? 'ON' : 'OFF'; } render() { const { jobLabel } = this.props; return (React.createElement("tr", { onDoubleClick: this.showEditLabelForm, onMouseEnter: this.onMouseEnter, onMouseLeave: this.onMouseLeave }, React.createElement("td", { style: this.cellStyle }, React.createElement(components_1.AvatarIcon, { avatarName: jobLabel.label, id: `label-table-label-${jobLabel.label}` })), React.createElement("td", { style: this.cellStyle, id: `label-table-region-${jobLabel.label}` }, jobLabel.region), React.createElement("td", { style: this.cellStyle, id: `label-table-description-${jobLabel.label}` }, jobLabel.description), React.createElement("td", { style: this.cellStyle, id: `label-table-date-${jobLabel.label}` }), React.createElement("td", { style: this.cellStyle, id: `label-table-smart-${jobLabel.label}` }, React.createElement(components_1.ToggleButton, { id: `label-toggle-smart-available-${jobLabel.label}`, on: jobLabel.availableForAuto, size: 45 })), React.createElement("td", { style: this.cellStyle, id: `label-table-auto-${jobLabel.label}` }, jobLabel.availableForAuto && React.createElement(components_1.ToggleButton, { id: `label-toggle-auto-enabled-${jobLabel.label}`, on: jobLabel.autoIsOn, size: 45 })), React.createElement("td", { style: this.cellStyle, id: `label-table-consolidate-${jobLabel.label}` }, jobLabel.availableForAuto && React.createElement(components_1.ToggleButton, { id: `label-toggle-consolidation-enabled-${jobLabel.label}`, on: jobLabel.consolidation, size: 45 })), React.createElement("td", { style: this.actionsCellStyle }, this.state.hover && React.createElement(React.Fragment, null, React.createElement(components_1.HoverableIcon, { id: `edit-label-button-${jobLabel.label}`, icon: "EditJob", size: 26, onClick: this.showEditLabelForm }), React.createElement(components_1.HoverableIcon, { id: `delete-label-button-${jobLabel.label}`, icon: "Delete", size: 26, onClick: this.showDeleteConfirmation }))))); } } const mapStateToProps = (state, ownProps) => ({}); const mapDispatchToProps = { openModal: cosmoui_1.openModal, openDrawer: cosmoui_1.openDrawer, }; exports.JobLabelTableRow = react_redux_1.connect(mapStateToProps, mapDispatchToProps)(JobLabelTableRowComponent); //# sourceMappingURL=job-label-table-row.js.map