| 127 | */ |
| 128 | @customElement('dive-module') |
| 129 | export class DiveModule extends LitModule { |
| 130 | // Compatible types are those for which the GroupService can create bins. |
| 131 | static compatibleTypes = [BooleanLitType, CategoryLabel, Scalar]; |
| 132 | static override title = 'Dive'; |
| 133 | static override numCols = 3; |
| 134 | static override shouldDisplayModule = |
| 135 | (modelSpecs: ModelInfoMap, datasetSpec: Spec) => { |
| 136 | // Dive is a two-dimensional matrix of histograms, so we should have at |
| 137 | // least two binnable fields in order to be anlaytically useful. |
| 138 | const compatiblefields: string[] = []; |
| 139 | compatiblefields.push( |
| 140 | ...findSpecKeys(datasetSpec, DiveModule.compatibleTypes)); |
| 141 | for (const {spec} of Object.values(modelSpecs)) { |
| 142 | const {input, output} = spec; |
| 143 | compatiblefields.push( |
| 144 | ...findSpecKeys(input, DiveModule.compatibleTypes)); |
| 145 | compatiblefields.push( |
| 146 | ...findSpecKeys(output, DiveModule.compatibleTypes)); |
| 147 | } |
| 148 | return new Set(compatiblefields).size > 1; |
| 149 | }; |
| 150 | |
| 151 | static override get styles() { |
| 152 | const styles = css` |
| 153 | .scene { |
| 154 | height: 100%; |
| 155 | width: 100%; |
| 156 | cursor: crosshair; |
| 157 | } |
| 158 | |
| 159 | select.limit-width { |
| 160 | width: 150px; |
| 161 | max-width: 150px; |
| 162 | } |
| 163 | |
| 164 | .dive-controls { |
| 165 | width: 100%; |
| 166 | height: 100%; |
| 167 | display: flex; |
| 168 | flex-direction: row; |
| 169 | align-items: center; |
| 170 | justify-content: space-between; |
| 171 | } |
| 172 | |
| 173 | .dive-controls .feature-selectors { |
| 174 | display: flex; |
| 175 | flex-direction: row; |
| 176 | } |
| 177 | |
| 178 | .dive-controls .icon-button { |
| 179 | font-size: 16px; |
| 180 | } |
| 181 | `; |
| 182 | |
| 183 | return [sharedStyles, styles]; |
| 184 | } |
| 185 | |
| 186 | static override template = |
nothing calls this directly
no test coverage detected