All Downloads are FREE. Search and download functionalities are using the official Maven repository.

package.dist.features.OpenUI5Enablement.js Maven / Gradle / Ivy

import { registerFeature } from "../FeaturesRegistry.js";
import BusyIndicatorStyles from "../generated/css/BusyIndicator.css.js";
import merge from "../thirdparty/merge.js";
import { isTabPrevious, } from "../Keys.js";
const busyIndicatorMetadata = {
    properties: {
        __isBusy: {
            type: Boolean,
        },
    },
};
class OpenUI5Enablement {
    static wrapTemplateResultInBusyMarkup(html, host, templateResult) {
        if (host.isOpenUI5Component && host.__isBusy) {
            templateResult = html `
			
${templateResult}
`; } return templateResult; } static enrichBusyIndicatorSettings(klass) { OpenUI5Enablement.enrichBusyIndicatorMetadata(klass); OpenUI5Enablement.enrichBusyIndicatorMethods(klass.prototype); } static enrichBusyIndicatorMetadata(klass) { klass.metadata = merge(klass.metadata, busyIndicatorMetadata); } static enrichBusyIndicatorMethods(UI5ElementPrototype) { Object.defineProperties(UI5ElementPrototype, { "__redirectFocus": { value: true, writable: true }, "__suppressFocusBack": { get() { return { handleEvent: (e) => { if (isTabPrevious(e)) { const beforeElem = this.shadowRoot.querySelector("[busy-indicator-before-span]"); this.__redirectFocus = false; beforeElem.focus(); this.__redirectFocus = true; } }, capture: true, passive: false, }; }, }, "isOpenUI5Component": { get: () => { return true; } }, }); UI5ElementPrototype.__suppressFocusIn = function handleFocusIn() { const busyIndicator = this.shadowRoot?.querySelector("[busy-indicator]"); if (busyIndicator && this.__redirectFocus) { busyIndicator.focus(); } }; UI5ElementPrototype.getDomRef = function getDomRef() { // If a component set _getRealDomRef to its children, use the return value of this function if (typeof this._getRealDomRef === "function") { return this._getRealDomRef(); } if (!this.shadowRoot || this.shadowRoot.children.length === 0) { return; } const children = [...this.shadowRoot.children].filter(child => !["link", "style"].includes(child.localName)); if (children.length !== 1) { console.warn(`The shadow DOM for ${this.constructor.getMetadata().getTag()} does not have a top level element, the getDomRef() method might not work as expected`); // eslint-disable-line } if (this.__isBusy) { return children[0].querySelector(".busy-indicator-wrapper > :not([busy-indicator-before-span]):not(.busy-indicator-overlay):not(.busy-indicator-busy-area)"); } return children[0]; }; } static getBusyIndicatorStyles() { return BusyIndicatorStyles; } } registerFeature("OpenUI5Enablement", OpenUI5Enablement); export default OpenUI5Enablement; //# sourceMappingURL=OpenUI5Enablement.js.map




© 2015 - 2024 Weber Informatics LLC | Privacy Policy