- ✅ Ticket 1.1: Estructura Clean Architecture en backend - ✅ Ticket 1.2: Schemas Zod compartidos - ✅ Ticket 1.3: Refactorización drugs.ts (1362 → 8 archivos modulares) - ✅ Ticket 1.4: Refactorización procedures.ts (3583 → 6 archivos modulares) - ✅ Ticket 1.5: Eliminación de duplicidades (~50 líneas) Cambios principales: - Creada estructura Clean Architecture en backend/src/ - Schemas Zod compartidos en backend/src/shared/schemas/ - Refactorización modular de drugs y procedures - Utilidades genéricas en src/utils/ (filter, validation) - Eliminados scripts obsoletos y documentación antigua - Corregidos errores: QueryClient, import test-error-handling - Build verificado y funcionando correctamente
91 lines
2.3 KiB
JavaScript
91 lines
2.3 KiB
JavaScript
import Event from '../../event/Event.js';
|
|
import HTMLElement from '../html-element/HTMLElement.js';
|
|
import * as PropertySymbol from '../../PropertySymbol.js';
|
|
import ElementEventAttributeUtility from '../element/ElementEventAttributeUtility.js';
|
|
/**
|
|
* HTML Dialog Element.
|
|
*
|
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLDialogElement
|
|
*/
|
|
export default class HTMLDialogElement extends HTMLElement {
|
|
// Internal properties
|
|
[PropertySymbol.returnValue] = '';
|
|
// Events
|
|
/* eslint-disable jsdoc/require-jsdoc */
|
|
get oncancel() {
|
|
return ElementEventAttributeUtility.getEventListener(this, 'oncancel');
|
|
}
|
|
set oncancel(value) {
|
|
this[PropertySymbol.propertyEventListeners].set('oncancel', value);
|
|
}
|
|
get onclose() {
|
|
return ElementEventAttributeUtility.getEventListener(this, 'onclose');
|
|
}
|
|
set onclose(value) {
|
|
this[PropertySymbol.propertyEventListeners].set('onclose', value);
|
|
}
|
|
/* eslint-enable jsdoc/require-jsdoc */
|
|
/**
|
|
* Returns return value.
|
|
*
|
|
* @returns Return value.
|
|
*/
|
|
get returnValue() {
|
|
return this[PropertySymbol.returnValue];
|
|
}
|
|
/**
|
|
* Sets return value.
|
|
*
|
|
* @param value Return value.
|
|
*/
|
|
set returnValue(value) {
|
|
this[PropertySymbol.returnValue] = String(value);
|
|
}
|
|
/**
|
|
* Sets the "open" attribute.
|
|
*
|
|
* @param open Open.
|
|
*/
|
|
set open(open) {
|
|
if (open) {
|
|
this.setAttribute('open', '');
|
|
}
|
|
else {
|
|
this.removeAttribute('open');
|
|
}
|
|
}
|
|
/**
|
|
* Returns open.
|
|
*
|
|
* @returns Open.
|
|
*/
|
|
get open() {
|
|
return this.getAttribute('open') !== null;
|
|
}
|
|
/**
|
|
* Closes the dialog.
|
|
*
|
|
* @param [returnValue] ReturnValue.
|
|
*/
|
|
close(returnValue) {
|
|
const wasOpen = this.open;
|
|
this.removeAttribute('open');
|
|
this.returnValue = returnValue !== undefined ? String(returnValue) : '';
|
|
if (wasOpen) {
|
|
this.dispatchEvent(new Event('close'));
|
|
}
|
|
}
|
|
/**
|
|
* Shows the modal.
|
|
*/
|
|
showModal() {
|
|
this.setAttribute('open', '');
|
|
}
|
|
/**
|
|
* Shows the dialog.
|
|
*/
|
|
show() {
|
|
this.setAttribute('open', '');
|
|
}
|
|
}
|
|
//# sourceMappingURL=HTMLDialogElement.js.map
|