Skip to content

Commit

Permalink
ran prettier
Browse files Browse the repository at this point in the history
Signed-off-by: quobix <[email protected]>
  • Loading branch information
daveshanley committed Nov 30, 2023
1 parent e3f41ea commit 418f3fb
Show file tree
Hide file tree
Showing 2 changed files with 128 additions and 124 deletions.
42 changes: 21 additions & 21 deletions html-report/ui/build/static/js/vacuumReport.js
Original file line number Diff line number Diff line change
Expand Up @@ -304,27 +304,27 @@
<path d="M4 8a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7A.5.5 0 0 1 4 8z" />
</svg>
`;var Ie=function(e,t,o,r){var i,a=arguments.length,n=a<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,o,r);else for(var l=e.length-1;l>=0;l--)(i=e[l])&&(n=(a<3?i(n):a>3?i(t,o,n):i(t,o))||n);return a>3&&n&&Object.defineProperty(t,o,n),n};let qe=class extends ke{otherRuleSelected(){this.open=!1,this.violations=this.renderRoot.querySelector(".violations"),this.violations&&(this.violations.style.display="none"),this._expandState=!1,this._slottedChildren.forEach((e=>{e.selected=!1})),this.requestUpdate()}render(){let e;this.violations=this.renderRoot.querySelector(".violations"),this.truncated&&(e=Q`
<div class="truncated">
<strong>${this.numResults-this.maxViolations}</strong> more
violations not rendered, There are just too many!
</div>
`);const t=this._expandState?Ue:He;return Q`
<nav
aria-label="Rules and Violations"
class="details ${this._expandState?"open":""}"
>
<div class="summary" @click=${this._ruleSelected}>
<span class="expand-state">${t}</span>
<span class="rule-icon">${this.ruleIcon}</span>
<span class="rule-description">${this.description}</span>
<span class="rule-violation-count">${this.numResults}</span>
</div>
<div class="violations" @violationSelected=${this._violationSelected}>
<slot name="results"></slot>
${e}
</div>
</nav>
`}_ruleSelected(){if(this.open)this.violations&&(this.violations.style.display="none"),this._expandState=!1;else{this.violations&&(this.violations.style.display="block");const e=this.parentElement.parentElement.offsetHeight-60*this.totalRulesViolated;this.violations&&(this.violations.style.maxHeight=e+"px"),this._expandState=!0}this.open=!this.open,this.dispatchEvent(new CustomEvent("ruleSelected",{bubbles:!0,composed:!0,detail:{id:this.ruleId}})),this.requestUpdate()}_violationSelected(e){this._slottedChildren.forEach((t=>{t.selected=e.detail.violationId==t.violationId}))}};qe.styles=Me,Ie([xe()],qe.prototype,"totalRulesViolated",void 0),Ie([xe()],qe.prototype,"maxViolations",void 0),Ie([xe()],qe.prototype,"truncated",void 0),Ie([xe()],qe.prototype,"ruleId",void 0),Ie([xe()],qe.prototype,"description",void 0),Ie([xe()],qe.prototype,"numResults",void 0),Ie([xe()],qe.prototype,"ruleIcon",void 0),Ie([xe()],qe.prototype,"open",void 0),qe=Ie([ye("category-rule")],qe);const De=w`
<div class="truncated">
<strong>${this.numResults-this.maxViolations}</strong> more
violations not rendered, There are just too many!
</div>
`);const t=this._expandState?Ue:He;return Q`
<nav
aria-label="Rules and Violations"
class="details ${this._expandState?"open":""}"
>
<div class="summary" @click=${this._ruleSelected}>
<span class="expand-state">${t}</span>
<span class="rule-icon">${this.ruleIcon}</span>
<span class="rule-description">${this.description}</span>
<span class="rule-violation-count">${this.numResults}</span>
</div>
<div class="violations" @violationSelected=${this._violationSelected}>
<slot name="results"></slot>
${e}
</div>
</nav>
`}_ruleSelected(){if(this.open)this.violations&&(this.violations.style.display="none"),this._expandState=!1;else{this.violations&&(this.violations.style.display="block");const e=this.parentElement.parentElement.offsetHeight-60*this.totalRulesViolated;this.violations&&(this.violations.style.maxHeight=e+"px"),this._expandState=!0}this.open=!this.open,this.dispatchEvent(new CustomEvent("ruleSelected",{bubbles:!0,composed:!0,detail:{id:this.ruleId}})),this.requestUpdate()}_violationSelected(e){this._slottedChildren.forEach((t=>{t.selected=e.detail.violationId==t.violationId}))}};qe.styles=Me,Ie([xe()],qe.prototype,"totalRulesViolated",void 0),Ie([xe()],qe.prototype,"maxViolations",void 0),Ie([xe()],qe.prototype,"truncated",void 0),Ie([xe()],qe.prototype,"ruleId",void 0),Ie([xe()],qe.prototype,"description",void 0),Ie([xe()],qe.prototype,"numResults",void 0),Ie([xe()],qe.prototype,"ruleIcon",void 0),Ie([xe()],qe.prototype,"open",void 0),qe=Ie([ye("category-rule")],qe);const De=w`
ul.rule {
margin: 0;
padding: 0;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,126 +1,130 @@
import {BaseComponent} from '../../../ts/base-component';
import {html, TemplateResult} from 'lit';
import {customElement, property} from 'lit/decorators.js';
import {RuleSelected, RuleSelectedEvent, ViolationSelectedEvent,} from '../../../model/events';
import {CategoryRuleResultComponent} from './category-rule-result-component';
import { BaseComponent } from '../../../ts/base-component';
import { html, TemplateResult } from 'lit';
import { customElement, property } from 'lit/decorators.js';
import {
RuleSelected,
RuleSelectedEvent,
ViolationSelectedEvent,
} from '../../../model/events';
import { CategoryRuleResultComponent } from './category-rule-result-component';
import categoryRuleStyles from './category-rule.styles';
import expandIcon from './svg/expand.icon';
import contractIcon from './svg/contract.icon';

@customElement('category-rule')
export class CategoryRuleComponent extends BaseComponent {
static styles = categoryRuleStyles;
static styles = categoryRuleStyles;

@property()
totalRulesViolated: number;
@property()
totalRulesViolated: number;

@property()
maxViolations: number;
@property()
maxViolations: number;

@property()
truncated: boolean;
@property()
truncated: boolean;

@property()
ruleId: string;
@property()
ruleId: string;

@property()
description: string;
@property()
description: string;

@property()
numResults: number;
@property()
numResults: number;

@property()
ruleIcon: number;
@property()
ruleIcon: number;

@property()
open: boolean;
@property()
open: boolean;

// @query('.violations')
private violations: HTMLElement;
// @query('.violations')
private violations: HTMLElement;

private _expandState: boolean;
private _expandState: boolean;

otherRuleSelected() {
this.open = false;
this.violations = this.renderRoot.querySelector('.violations');
if (this.violations) {
this.violations.style.display = 'none';
}
this._expandState = false;
this._slottedChildren.forEach((result: CategoryRuleResultComponent) => {
result.selected = false;
});
this.requestUpdate();
otherRuleSelected() {
this.open = false;
this.violations = this.renderRoot.querySelector('.violations');
if (this.violations) {
this.violations.style.display = 'none';
}

render() {
this.violations = this.renderRoot.querySelector('.violations');
let truncatedAlert: TemplateResult;
if (this.truncated) {
truncatedAlert = html`
<div class="truncated">
<strong>${this.numResults - this.maxViolations}</strong> more
violations not rendered, There are just too many!
</div>
`;
}

const expanded = this._expandState ? contractIcon : expandIcon;

return html`
<nav
aria-label="Rules and Violations"
class="details ${this._expandState ? 'open' : ''}"
>
<div class="summary" @click=${this._ruleSelected}>
<span class="expand-state">${expanded}</span>
<span class="rule-icon">${this.ruleIcon}</span>
<span class="rule-description">${this.description}</span>
<span class="rule-violation-count">${this.numResults}</span>
</div>
<div class="violations" @violationSelected=${this._violationSelected}>
<slot name="results"></slot>
${truncatedAlert}
</div>
</nav>
`;
this._expandState = false;
this._slottedChildren.forEach((result: CategoryRuleResultComponent) => {
result.selected = false;
});
this.requestUpdate();
}

render() {
this.violations = this.renderRoot.querySelector('.violations');
let truncatedAlert: TemplateResult;
if (this.truncated) {
truncatedAlert = html`
<div class="truncated">
<strong>${this.numResults - this.maxViolations}</strong> more
violations not rendered, There are just too many!
</div>
`;
}

private _ruleSelected() {
if (!this.open) {
if (this.violations) {
this.violations.style.display = 'block';
}
// use some intelligence to resize this in a responsive way.
const heightCalc =
this.parentElement.parentElement.offsetHeight -
this.totalRulesViolated * 60;
if (this.violations) {
this.violations.style.maxHeight = heightCalc + 'px';
}
this._expandState = true;
} else {
if (this.violations) {
this.violations.style.display = 'none';
}
this._expandState = false;
}

this.open = !this.open;

this.dispatchEvent(
new CustomEvent<RuleSelectedEvent>(RuleSelected, {
bubbles: true,
composed: true,
detail: {id: this.ruleId},
})
);
this.requestUpdate();
const expanded = this._expandState ? contractIcon : expandIcon;

return html`
<nav
aria-label="Rules and Violations"
class="details ${this._expandState ? 'open' : ''}"
>
<div class="summary" @click=${this._ruleSelected}>
<span class="expand-state">${expanded}</span>
<span class="rule-icon">${this.ruleIcon}</span>
<span class="rule-description">${this.description}</span>
<span class="rule-violation-count">${this.numResults}</span>
</div>
<div class="violations" @violationSelected=${this._violationSelected}>
<slot name="results"></slot>
${truncatedAlert}
</div>
</nav>
`;
}

private _ruleSelected() {
if (!this.open) {
if (this.violations) {
this.violations.style.display = 'block';
}
// use some intelligence to resize this in a responsive way.
const heightCalc =
this.parentElement.parentElement.offsetHeight -
this.totalRulesViolated * 60;
if (this.violations) {
this.violations.style.maxHeight = heightCalc + 'px';
}
this._expandState = true;
} else {
if (this.violations) {
this.violations.style.display = 'none';
}
this._expandState = false;
}

private _violationSelected(evt: CustomEvent<ViolationSelectedEvent>) {
this._slottedChildren.forEach((result: CategoryRuleResultComponent) => {
result.selected = evt.detail.violationId == result.violationId;
});
}
this.open = !this.open;

this.dispatchEvent(
new CustomEvent<RuleSelectedEvent>(RuleSelected, {
bubbles: true,
composed: true,
detail: { id: this.ruleId },
})
);
this.requestUpdate();
}

private _violationSelected(evt: CustomEvent<ViolationSelectedEvent>) {
this._slottedChildren.forEach((result: CategoryRuleResultComponent) => {
result.selected = evt.detail.violationId == result.violationId;
});
}
}

0 comments on commit 418f3fb

Please sign in to comment.