2021-12-08 22:29:42 +08:00
|
|
|
/**
|
|
|
|
* Webhook Events
|
|
|
|
* Manages dynamic selection control in the webhook form interface.
|
|
|
|
*/
|
2023-04-19 05:20:02 +08:00
|
|
|
import {Component} from './component';
|
2022-11-16 00:04:46 +08:00
|
|
|
|
|
|
|
export class WebhookEvents extends Component {
|
2021-12-08 22:29:42 +08:00
|
|
|
|
|
|
|
setup() {
|
|
|
|
this.checkboxes = this.$el.querySelectorAll('input[type="checkbox"]');
|
2021-12-09 01:35:58 +08:00
|
|
|
this.allCheckbox = this.$el.querySelector('input[type="checkbox"][value="all"]');
|
2021-12-08 22:29:42 +08:00
|
|
|
|
|
|
|
this.$el.addEventListener('change', event => {
|
|
|
|
if (event.target.checked && event.target === this.allCheckbox) {
|
|
|
|
this.deselectIndividualEvents();
|
|
|
|
} else if (event.target.checked) {
|
|
|
|
this.allCheckbox.checked = false;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
deselectIndividualEvents() {
|
|
|
|
for (const checkbox of this.checkboxes) {
|
|
|
|
if (checkbox !== this.allCheckbox) {
|
|
|
|
checkbox.checked = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-04-19 05:20:02 +08:00
|
|
|
}
|