chore: maintenance
This commit is contained in:
@@ -6,18 +6,24 @@
|
||||
"targets": {
|
||||
"build": {
|
||||
"executor": "@nx/vite:build",
|
||||
"outputs": ["{options.outputPath}"],
|
||||
"outputs": [
|
||||
"{options.outputPath}"
|
||||
],
|
||||
"options": {
|
||||
"outputPath": "dist/libs/accordion"
|
||||
}
|
||||
},
|
||||
"publish": {
|
||||
"command": "node tools/scripts/publish.mjs accordion {args.ver} {args.tag}",
|
||||
"dependsOn": ["build"]
|
||||
"dependsOn": [
|
||||
"build"
|
||||
]
|
||||
},
|
||||
"lint": {
|
||||
"executor": "@nx/linter:eslint",
|
||||
"outputs": ["{options.outputFile}"],
|
||||
"outputs": [
|
||||
"{options.outputFile}"
|
||||
],
|
||||
"options": {
|
||||
"lintFilePatterns": [
|
||||
"libs/accordion/**/*.ts",
|
||||
@@ -27,7 +33,9 @@
|
||||
},
|
||||
"test": {
|
||||
"executor": "@nx/jest:jest",
|
||||
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
|
||||
"outputs": [
|
||||
"{workspaceRoot}/coverage/{projectRoot}"
|
||||
],
|
||||
"options": {
|
||||
"jestConfig": "libs/accordion/jest.config.ts",
|
||||
"passWithNoTests": true
|
||||
@@ -40,5 +48,8 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"tags": ["type:component", ""]
|
||||
"tags": [
|
||||
"type:component",
|
||||
""
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { LitElement, TemplateResult, html } from 'lit';
|
||||
import { customElement, queryAssignedElements } from 'lit/decorators.js';
|
||||
import { customElement, property, queryAssignedElements } from 'lit/decorators.js';
|
||||
|
||||
import AccordionComponent from './accordion.component';
|
||||
|
||||
@customElement('z-accordion.group')
|
||||
@@ -7,22 +8,19 @@ export default class AccordionGroupComponent extends LitElement {
|
||||
@queryAssignedElements({ selector: 'z-accordion' })
|
||||
public items!: NodeListOf<AccordionComponent>;
|
||||
|
||||
@property({ type: Boolean })
|
||||
public closeOthers: boolean = false;
|
||||
|
||||
protected override firstUpdated() {
|
||||
this.items.forEach((item) => {
|
||||
item.addEventListener('open', () => {
|
||||
this.items.forEach((i) => {
|
||||
if (i !== item) {
|
||||
i.open = false;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
item.addEventListener('close', () => {
|
||||
this.items.forEach((i) => {
|
||||
if (i !== item) {
|
||||
i.open = false;
|
||||
}
|
||||
});
|
||||
if (this.closeOthers) {
|
||||
this.items.forEach((i: AccordionComponent) => {
|
||||
if (i !== item) {
|
||||
i.open = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user